forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 1
[pull] canary from vercel:canary #726
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### What? This PR fixes `create-next-app` update notifications for prerelease versions by checking against the correct npm dist-tag. ### Why? Users running `pnpx create-next-app@canary` were incorrectly prompted to update to the stable version because: 1. The `update-check` library queries npm's `latest` dist-tag by default 2. Version comparison using `localeCompare` considers `16.1.1-canary.32` less than `16.1.3` (since base version `16.1.1 < 16.1.3`) 3. This incorrectly triggered an update notification ### How? Instead of skipping the update check entirely for prerelease versions, this PR: 1. Extracts the dist-tag from the current version (e.g., `canary` from `16.1.1-canary.32`) 2. Passes this as the `distTag` option to `update-check` 3. Updates the suggested command to include the correct tag (e.g., `pnpm add -g create-next-app@canary`) This ensures: - Stable users are notified about newer stable releases - Canary users are notified about newer canary releases - Beta/RC users are notified about newer versions of their respective channels Co-authored-by: Cursor Agent <cursoragent@cursor.com>
## What? This PR fixes font preloading for MDX pages in Turbopack and adds an e2e test to verify the fix. ## Why? When using `next/font` with MDX pages, font preloading was failing with Turbopack because the LoaderTree was storing the **transformed module path** instead of the **original source path**. ## The Bug In Turbopack, MDX files are transformed by adding a `.tsx` extension: - Source file: `app/page.mdx` - After transform: `app/page.mdx.tsx` The `create_module_tuple_code` function in `base_loader_tree.rs` was using `module.ident().path()` (the transformed path) instead of the original `path` parameter. This caused a mismatch at runtime: - Font manifest key: `[project]/app/page` - LoaderTree stored: `[project]/app/page.mdx.tsx` - After stripping `.tsx`: `[project]/app/page.mdx` - **No match** → fonts not preloaded ## The Fix Changed `crates/next-core/src/base_loader_tree.rs` to use the original source path: ```rust // Before let module_path = module.ident().path().to_string().await?; // After let module_path = path.value_to_string().await?; ``` Now the LoaderTree stores `[project]/app/page.mdx`, which after stripping `.mdx` at runtime becomes `[project]/app/page`, matching the font manifest key. ## Test Added `test/e2e/app-dir/mdx-font-preload/` which verifies: 1. MDX page renders correctly 2. Font class from layout is applied 3. Font is correctly preloaded ## How I tested these changes ```bash pnpm test-start-turbo test/e2e/app-dir/mdx-font-preload/mdx-font-preload.test.ts ``` --------- Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
This auto-generated PR updates the production integration test manifest used when testing Rspack.
… response cache (#88509) ## Summary Implements an LRU cache with compound keys for the minimal mode response cache to improve cache hit rates during parallel revalidation scenarios. **Problem**: The previous single-entry cache (`previousCacheItem`) keyed by pathname caused cache collisions when multiple concurrent invocations (e.g., during ISR revalidation) accessed the same pathname. Each invocation would overwrite the previous entry, leading to cache misses and redundant work. **Solution**: An LRU cache using compound keys (`pathname + invocationID`) that allows multiple invocations to cache entries for the same pathname independently: ``` Cache Key Structure ───────────────────── /blog/post-1\0inv-abc → {entry, expiresAt} /blog/post-1\0inv-def → {entry, expiresAt} /blog/post-1\0__ttl__ → {entry, expiresAt} (TTL fallback) /api/data\0inv-ghi → {entry, expiresAt} ``` ### Cache Key Strategy - **With `x-invocation-id` header**: Entries are keyed by invocation ID for exact-match lookups (always a cache hit if the entry exists) - **Without header (TTL fallback)**: Entries use a `__ttl__` sentinel key and validate via expiration timestamp ### Configuration via Environment Variables Cache sizing can be tuned via environment variables (using `NEXT_PRIVATE_*` prefix for infrastructure-level settings): | Environment Variable | Default | Description | |---------------------|---------|-------------| | `NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE` | 150 | Max entries in the LRU cache | | `NEXT_PRIVATE_RESPONSE_CACHE_TTL` | 10000 | TTL in ms for cache entries (fallback validation) | ### LRU Cache Enhancement Added an optional `onEvict` callback to `LRUCache` that fires when entries are evicted due to capacity limits. This enables tracking evicted invocation IDs for warning detection without introducing timer-based cleanup. ### Eviction Warnings When a cache entry is evicted and later accessed by the same invocation, a warning is logged suggesting to increase `NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE`. This helps developers tune cache sizes for their workload. ### Additional Changes - Renamed header from `x-vercel-id` to `x-invocation-id` for clarity - Added `withInvocationId()` test helper for cache testing ## Test Plan - Existing response cache tests pass with updated header name - Unit tests for `LRUCache` including `onEvict` callback behavior - Updated standalone mode tests to use `withInvocationId()` helper
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )