-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial work for compile-time evaluation #3495
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 10 Ignored Deployments
|
Benchmark for 178ea44Click to view benchmark
|
|
Benchmark for de0f2d5
Click to view full benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs please!
require("fail"); | ||
import("fail"); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test that verifies the error case as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean with the error case?
I added a check if it runs through the "then" branch. Is that enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error case is when require("fail")
or import("fail")
fail to compile. Do we have a test case for this?
Benchmark for 4a91ae7
Click to view full benchmark
|
x-ref: #3347 |
Benchmark for 840f922
Click to view full benchmark
|
Benchmark for 906ada4
Click to view full benchmark
|
Benchmark for ecd6823
Click to view full benchmark
|
Do any other bundlers have a specific value dedicated to detecting them? ( |
Benchmark for 1501f94
Click to view full benchmark
|
Not as far as I know. |
crates/next-dev-tests/tests/integration/turbopack/basic/comptime/index.js
Outdated
Show resolved
Hide resolved
} | ||
_ => false, | ||
}, | ||
JsValue::MemberCall(_, box ref mut obj, box ref mut prop, _) => match obj { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to name these members (struct-like variant vs. tuple-like variant). There's a possibility to confuse prop
and obj
otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but that's something for a follow-up PR
/// Checks if we known that the value ends with a given string. Returns | ||
/// None if we don't know. Returns Some if we know if or if not the | ||
/// value ends with the given string. | ||
pub fn ends_with(&self, str: &str) -> Option<bool> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to give an example of why this particular function is needed too.
Benchmark for 5a967cf
Click to view full benchmark
|
Benchmark for ae45cde
Click to view full benchmark
|
Allows to skip unreachable code based on compile-time constant conditions e. g. ``` if (!process.turbopack) { require("will-not-be-processed"); } ``` * add if() and process.turbopack fixes WEB-491 * Removes unreachable code fixes WEB-498 * evaluate some logical operations `&&`, `||`, `??`, `!` * fix arguments handling fixes WEB-529 * nested effects for function called with closures * handle closures when array methods are used fixes WEB-538 * evaluates `process.turbopack` fixes WEB-496
…49736102+kodiakhq[bot]@users.noreply.github.com> # New Features - vercel/turborepo#3540 - vercel/turborepo#3549 - vercel/turborepo#3465 - vercel/turborepo#3550 - vercel/turborepo#3495 - vercel/turborepo#3624 - vercel/turborepo#3600 - vercel/turborepo#3676 - vercel/turborepo#3689 # Fixes - vercel/turborepo#3437 - vercel/turborepo#3542 - vercel/turborepo#3531 - vercel/turborepo#3552 - vercel/turborepo#3551 - vercel/turborepo#3597 - vercel/turborepo#3644 - vercel/turborepo#3623 - vercel/turborepo#3634 - vercel/turborepo#3574 - vercel/turborepo#3673 - vercel/turborepo#3675 - vercel/turborepo#3723 - vercel/turborepo#3677 - vercel/turborepo#3717 - vercel/turborepo#3701 # Performance Improvements - vercel/turborepo#3361 - vercel/turborepo#3619 --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Allows to skip unreachable code based on compile-time constant conditions e. g. ``` if (!process.turbopack) { require("will-not-be-processed"); } ``` * add if() and process.turbopack fixes WEB-491 * Removes unreachable code fixes WEB-498 * evaluate some logical operations `&&`, `||`, `??`, `!` * fix arguments handling fixes WEB-529 * nested effects for function called with closures * handle closures when array methods are used fixes WEB-538 * evaluates `process.turbopack` fixes WEB-496
Allows to skip unreachable code based on compile-time constant conditions e. g. ``` if (!process.turbopack) { require("will-not-be-processed"); } ``` * add if() and process.turbopack fixes WEB-491 * Removes unreachable code fixes WEB-498 * evaluate some logical operations `&&`, `||`, `??`, `!` * fix arguments handling fixes WEB-529 * nested effects for function called with closures * handle closures when array methods are used fixes WEB-538 * evaluates `process.turbopack` fixes WEB-496
Allows to skip unreachable code based on compile-time constant conditions e. g. ``` if (!process.turbopack) { require("will-not-be-processed"); } ``` * add if() and process.turbopack fixes WEB-491 * Removes unreachable code fixes WEB-498 * evaluate some logical operations `&&`, `||`, `??`, `!` * fix arguments handling fixes WEB-529 * nested effects for function called with closures * handle closures when array methods are used fixes WEB-538 * evaluates `process.turbopack` fixes WEB-496
Allows to skip unreachable code based on compile-time constant conditions e. g. ``` if (!process.turbopack) { require("will-not-be-processed"); } ``` * add if() and process.turbopack fixes WEB-491 * Removes unreachable code fixes WEB-498 * evaluate some logical operations `&&`, `||`, `??`, `!` * fix arguments handling fixes WEB-529 * nested effects for function called with closures * handle closures when array methods are used fixes WEB-538 * evaluates `process.turbopack` fixes WEB-496
Allows to skip unreachable code based on compile-time constant conditions e. g. ``` if (!process.turbopack) { require("will-not-be-processed"); } ``` * add if() and process.turbopack fixes WEB-491 * Removes unreachable code fixes WEB-498 * evaluate some logical operations `&&`, `||`, `??`, `!` * fix arguments handling fixes WEB-529 * nested effects for function called with closures * handle closures when array methods are used fixes WEB-538 * evaluates `process.turbopack` fixes WEB-496
Allows to skip unreachable code based on compile-time constant conditions
e. g.
&&
,||
,??
,!
process.turbopack
fixes WEB-496