forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 1
[pull] canary from vercel:canary #741
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
#88967) ## What? This PR reapplies #87746 which adds bundling support for Node.js `worker_threads` in Turbopack. ## Why? The original PR (#87746) was reverted in #88725 because it broke builds that use packages like `pino` with transports. These packages use dynamic patterns like `join(__dirname, 'lib', 'worker.js')` to resolve worker entry points, which can match non-evaluatable files like `package.json` or `tsconfig.json`. ## How? This PR reapplies the original changes with the following fixes: 1. **Downgrade errors to warnings in tracing contexts**: When `loose_errors` is enabled (tracing mode) or `in_try` is true, worker entry point validation errors are now emitted as warnings instead of errors. This follows the established Turbopack pattern used in `handle_resolve_error` and other resolve error handling. 2. **Improved error messages**: Error messages for non-chunkable and non-evaluatable worker entry point modules now include: - The module identifier (so you can see which file caused the issue) - The issue source location (pointing to the `new Worker()` call in source code) 3. **Added regression test**: A new pino-based test case exercises the `thread-stream` worker pattern that caused the original failure. This test runs in `CodeGenerationAndTracing` mode via `test-start-turbo`. ## Changes from original PR - Added `source` field to `CodeGenerationIssue` to support showing issue source locations - Added `get_issue_severity()` helper that checks `loose_errors` and `in_try` to determine severity - Fixed typo: `"SharedbWorker"` → `"SharedWorker"` in `to_string` implementation - Added pino regression test in `test/e2e/app-dir/node-worker-threads/` ## Testing - ✅ `pnpm test-dev-turbo test/e2e/app-dir/node-worker-threads/` - all tests pass - ✅ `pnpm test-start-turbo test/e2e/app-dir/node-worker-threads/` - all tests pass (exercises bundling mode) - ✅ Verified test fails without the `loose_errors` fix - ✅ Verified vercel-docs build succeeds with warnings instead of errors
…ed growth (#89040) ### What? Prevent LRU cache unbounded growth by requiring `calculateSize` to return values > 0. ### Why? When `calculateSize` returned 0 (e.g., for `null` values in the filesystem route cache), items were never evicted because they didn't contribute to `totalSize`. This caused unbounded memory growth when handling dynamic routes like `/api/logs/[id]` where each unique ID created a new cache entry with size 0. ### How? 1. **LRUCache now throws an error if size ≤ 0** - This catches bugs at development time rather than silently masking them: ```typescript if (size <= 0) { throw new Error( \`LRUCache: calculateSize returned ${size}, but size must be > 0. \` + \`Items with size 0 would never be evicted, causing unbounded cache growth.\` ) } ``` 2. **Fixed filesystem.ts** - Null entries (negative cache) now return size 1 instead of 0: ```typescript if (!value) { // Null entries (negative cache) still need a non-zero size for LRU eviction return 1 } ``` 3. **Fixed next-dev-server.ts** - Static paths cache now uses `|| 1` instead of `?? 0`: ```typescript return JSON.stringify(value.staticPaths)?.length || 1 ```
As a defense-in-depth mechanism, we're converting the server actions manifests and client reference manifests to use null-prototype objects, so that property lookups cannot traverse `Object.prototype`.
This script has been quietly failing on cron occasionally, this updates to ensure it shows as failing when the inner requests fail and also adds back-off logic for re-creating the project after deleting the previous. x-ref: https://github.com/vercel/next.js/actions/runs/21327384008/job/61386921911#step:6:12
This applies the following builder changes to the adapters outputs as well: - vercel/vercel#14689 - vercel/vercel#14695
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 : )