-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Prepare RouterContentSource for basePath #5218
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ This change can build |
|
Linux Benchmark for adb3170Click to view benchmark
|
MacOS Benchmark for adb3170
Click to view full benchmark
|
if cfg!(debug_assertions) { | ||
let prefix_string = prefix.await?; | ||
debug_assert!(prefix_string.is_empty() || prefix_string.ends_with('/')); | ||
debug_assert!(prefix_string.starts_with('/')); | ||
} |
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.
This could also be achieved with a BasePath
newtype (BasePathVc
), which would make these assertions in its String -> BasePath constructor.
But I don't think the newtype Vc story is good enough to warrant this for now.
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 we could generalize this to a PathStr
type, which would have match these same rules. All ContentSource
's would receive this as the path
param. PrefixedRouterContentSource
and StaticAssetsContentSource
could receive them as the prefix as well.
Linux Benchmark for 53f59af
Click to view full benchmark
|
MacOS Benchmark for 53f59af
Click to view full benchmark
|
### Turbopack Updates * vercel/turborepo#5156 * vercel/turborepo#5159 * vercel/turborepo#5162 * vercel/turborepo#5161 * vercel/turborepo#5174 * vercel/turborepo#5178 * vercel/turborepo#5121 * vercel/turborepo#5200 * vercel/turborepo#5207 * vercel/turborepo#5211 * vercel/turborepo#5210 * vercel/turborepo#5221 * vercel/turborepo#5218 * vercel/turborepo#5226 * vercel/turborepo#5139 * vercel/turborepo#5227 * vercel/turborepo#5189
### Turbopack Updates * vercel/turborepo#5156 * vercel/turborepo#5159 * vercel/turborepo#5162 * vercel/turborepo#5161 * vercel/turborepo#5174 * vercel/turborepo#5178 * vercel/turborepo#5121 * vercel/turborepo#5200 * vercel/turborepo#5207 * vercel/turborepo#5211 * vercel/turborepo#5210 * vercel/turborepo#5221 * vercel/turborepo#5218 * vercel/turborepo#5226 * vercel/turborepo#5139 * vercel/turborepo#5227 * vercel/turborepo#5189
### Description This is part 2 of [WEB-993](https://linear.app/vercel/issue/WEB-993) basePath support. A few of our next-specific content sources will need to be scoped under the `basePath` (like `_next/image` and `__nextjs_original-stack-frame`). These are currently served with a `RouterContentSource`, but it didn't have support for arbitrary prefixes. We _could_ have changed the subpath for these sources to include the `basePath`, but that would require reading the `next_config.base_path()` in the [source](https://github.com/vercel/next.js/blob/2b1f0d9351610b04d01638efed19252ca81d0023/packages/next-swc/crates/next-dev/src/lib.rs#L413-L423) method, and it would invalidate our entire call graph whenever the `next.config.js` changed. Not a good choice. ### Testing Instructions <!-- Give a quick description of steps to test your changes. -->
### Description This is part 2 of [WEB-993](https://linear.app/vercel/issue/WEB-993) basePath support. A few of our next-specific content sources will need to be scoped under the `basePath` (like `_next/image` and `__nextjs_original-stack-frame`). These are currently served with a `RouterContentSource`, but it didn't have support for arbitrary prefixes. We _could_ have changed the subpath for these sources to include the `basePath`, but that would require reading the `next_config.base_path()` in the [source](https://github.com/vercel/next.js/blob/2b1f0d9351610b04d01638efed19252ca81d0023/packages/next-swc/crates/next-dev/src/lib.rs#L413-L423) method, and it would invalidate our entire call graph whenever the `next.config.js` changed. Not a good choice. ### Testing Instructions <!-- Give a quick description of steps to test your changes. -->
### Description This is part 2 of [WEB-993](https://linear.app/vercel/issue/WEB-993) basePath support. A few of our next-specific content sources will need to be scoped under the `basePath` (like `_next/image` and `__nextjs_original-stack-frame`). These are currently served with a `RouterContentSource`, but it didn't have support for arbitrary prefixes. We _could_ have changed the subpath for these sources to include the `basePath`, but that would require reading the `next_config.base_path()` in the [source](https://github.com/vercel/next.js/blob/2b1f0d9351610b04d01638efed19252ca81d0023/packages/next-swc/crates/next-dev/src/lib.rs#L413-L423) method, and it would invalidate our entire call graph whenever the `next.config.js` changed. Not a good choice. ### Testing Instructions <!-- Give a quick description of steps to test your changes. -->
Description
This is part 2 of WEB-993 basePath support. A few of our next-specific content sources will need to be scoped under the
basePath
(like_next/image
and__nextjs_original-stack-frame
). These are currently served with aRouterContentSource
, but it didn't have support for arbitrary prefixes.We could have changed the subpath for these sources to include the
basePath
, but that would require reading thenext_config.base_path()
in the source method, and it would invalidate our entire call graph whenever thenext.config.js
changed. Not a good choice.Testing Instructions