-
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
add next.config.js validation to turbopack #3105
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Ignored Deployments
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
|
03e89eb
to
ede02a5
Compare
ede02a5
to
e126a23
Compare
e126a23
to
586f141
Compare
nextConfig.rewrites = await nextConfig.rewrites?.(); | ||
|
||
nextConfig.generateBuildId = await nextConfig.generateBuildId?.(); | ||
nextConfig.headers = await nextConfig.headers?.(); |
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 loadCustomRoutes
from next/dist/lib/load-custom-routes
will perform some validation and loading for headers
/redirects
/rewrites
.
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.
I'm not entirely sure what you're telling me here, is that a function I should use?
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TraceRawVcs)] | ||
#[serde(rename_all = "camelCase")] | ||
struct OnDemandEntriesConfig { | ||
max_inactive_age: f64, |
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.
Are these floats or u64s?
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.
I guess JS can always provide Infinity
there, hence we treat any number as a f64.
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, ideally these would be u64
, but for JS compat I've put them in here as f64
for now
I admittedly didn't fully review every line. |
I'm also validating next.config.js in #3071 (basePath specifically) so that will likely cause a conflict. |
crates/next-core/Cargo.toml
Outdated
@@ -11,9 +11,11 @@ bench = false | |||
[dependencies] | |||
anyhow = "1.0.47" | |||
auto-hash-map = { path = "../auto-hash-map" } | |||
crossterm = "0.25" |
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.
Put this dependency at the workspace level? We now use it for both turbopack-cli-utils and this.
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.
I think there are a lot of dependencies that are used across multiple crates but are not at the workspace level, anyhow
above is a good example
Should we move all of those to the workspace?
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.
Yes. I created WEB-174 a while back to tackle this.
// default to 50MB limit | ||
isr_memory_cache_size: Some(50.0 * 1024.0 * 1024.0), | ||
// default to 128KB | ||
large_page_data_bytes: Some(128.0 * 1000.0), |
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.
large_page_data_bytes: Some(128.0 * 1000.0), | |
large_page_data_bytes: Some(128.0 * 1024.0), |
Unless it was also defined this way in JS land?
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.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TraceRawVcs)] | ||
#[serde(rename_all = "camelCase")] | ||
struct OnDemandEntriesConfig { | ||
max_inactive_age: f64, |
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.
I guess JS can always provide Infinity
there, hence we treat any number as a f64.
crates/next-core/src/next_config.rs
Outdated
"experimental.serverComponentsExternalPackages", | ||
]; | ||
|
||
pub async fn validate_next_config( |
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.
Does this need to be pub
?
pub async fn validate_next_config( | |
async fn validate_next_config( |
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.
Nope 👍
pub images: ImageConfig, | ||
|
||
#[serde(flatten)] |
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.
That's a cool use of flatten.
586f141
to
c72eea5
Compare
c72eea5
to
66720b7
Compare
d77177d
to
842604d
Compare
closing for now |
No description provided.