From a8bc1a1cf2d570fbfe431d38951bebc7e8328540 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 19 Oct 2023 17:34:18 -0700 Subject: [PATCH 01/23] Update runner for e2e deploy tests (#57089) This attempts to fix our tests timing out from an obscure lost connection to runner message ![CleanShot 2023-10-19 at 16 29 50@2x](https://github.com/vercel/next.js/assets/22380829/594b21c4-4df9-418b-afbb-5e290020d25d) --- .github/workflows/test_e2e_deploy.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e_deploy.yml b/.github/workflows/test_e2e_deploy.yml index 8046bfd136d41..016ee56921ce8 100644 --- a/.github/workflows/test_e2e_deploy.yml +++ b/.github/workflows/test_e2e_deploy.yml @@ -9,7 +9,12 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: + - 'self-hosted' + - 'linux' + - 'x64' + - 'metal' + env: VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }} VERCEL_TEST_TEAM: vtest314-next-e2e-tests From 040a4f75e896f5070a592e3b886e9fef4a3ab9da Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 19 Oct 2023 17:43:56 -0700 Subject: [PATCH 02/23] update test manifest (#56938) Update test manifest from daily test run Closes WEB-1792 --- test/turbopack-tests-manifest.json | 163 +++++++++++++++-------------- 1 file changed, 85 insertions(+), 78 deletions(-) diff --git a/test/turbopack-tests-manifest.json b/test/turbopack-tests-manifest.json index 9acc60dc3e211..39be66f58d980 100644 --- a/test/turbopack-tests-manifest.json +++ b/test/turbopack-tests-manifest.json @@ -892,9 +892,10 @@ "runtimeError": false }, "test/development/acceptance-app/ReactRefreshRegression.test.ts": { - "passed": [], + "passed": [ + "ReactRefreshRegression app can fast refresh a page with static generation" + ], "failed": [ - "ReactRefreshRegression app can fast refresh a page with static generation", "ReactRefreshRegression app custom loader mdx should have Fast Refresh enabled", "ReactRefreshRegression app shows an overlay for anonymous function server-side error", "ReactRefreshRegression app shows an overlay for server-side error in client component", @@ -2214,12 +2215,12 @@ "test/e2e/app-dir/app-basepath/index.test.ts": { "passed": [ "app dir - basepath should prefix redirect() with basePath", + "app dir - basepath should render usePathname without the basePath", "app dir - basepath should support Link with basePath prefixed", "app dir - basepath should support `basePath`" ], "failed": [ - "app dir - basepath should prefix metadata og image with basePath", - "app dir - basepath should render usePathname without the basePath" + "app dir - basepath should prefix metadata og image with basePath" ], "pending": [], "flakey": [], @@ -2373,13 +2374,9 @@ "runtimeError": false }, "test/e2e/app-dir/app-middleware/app-middleware.test.ts": { - "passed": ["app dir - middleware without pages dir Updates headers"], - "failed": [ - "app dir - middleware with middleware in src dir works without crashing when using requestAsyncStorage", - "app-dir with middleware Mutate request headers for Edge Functions Adds new headers", - "app-dir with middleware Mutate request headers for Edge Functions Deletes headers", + "passed": [ + "app dir - middleware without pages dir Updates headers", "app-dir with middleware Mutate request headers for Edge Functions Supports draft mode", - "app-dir with middleware Mutate request headers for Edge Functions Updates headers", "app-dir with middleware Mutate request headers for Serverless Functions Adds new headers", "app-dir with middleware Mutate request headers for Serverless Functions Deletes headers", "app-dir with middleware Mutate request headers for Serverless Functions Supports draft mode", @@ -2390,6 +2387,12 @@ "app-dir with middleware Mutate request headers for next/headers Updates headers", "app-dir with middleware should filter correctly after middleware rewrite" ], + "failed": [ + "app dir - middleware with middleware in src dir works without crashing when using requestAsyncStorage", + "app-dir with middleware Mutate request headers for Edge Functions Adds new headers", + "app-dir with middleware Mutate request headers for Edge Functions Deletes headers", + "app-dir with middleware Mutate request headers for Edge Functions Updates headers" + ], "pending": [], "flakey": [], "runtimeError": false @@ -2764,10 +2767,18 @@ "test/e2e/app-dir/app/index.test.ts": { "passed": [ "app dir - basic should allow linking from app page to pages page", + "app dir - basic should be soft for back navigation", + "app dir - basic should be soft for forward navigation", + "app dir - basic should hard push", + "app dir - basic should hard replace", "app dir - basic should navigate to pages dynamic route from pages page if it overlaps with an app page", "app dir - basic should push to external url", "app dir - basic should replace to external url", + "app dir - basic should soft push", + "app dir - basic HMR should HMR correctly for client component", + "app dir - basic HMR should HMR correctly for server component", "app dir - basic bootstrap scripts should only bootstrap with one script, prinitializing the rest", + "app dir - basic bootstrap scripts should successfully bootstrap even when using CSP", "app dir - basic data fetch with response over 16KB with chunked encoding should load page when fetching a large amount of data", "app dir - basic error component should display error digest for error in server component with default error boundary", "app dir - basic error component should trigger error component when an error happens during rendering", @@ -2839,14 +2850,6 @@ "app dir - basic template component should render the template that holds state in a client component and reset on navigation" ], "failed": [ - "app dir - basic should be soft for back navigation", - "app dir - basic should be soft for forward navigation", - "app dir - basic should hard push", - "app dir - basic should hard replace", - "app dir - basic should soft push", - "app dir - basic HMR should HMR correctly for client component", - "app dir - basic HMR should HMR correctly for server component", - "app dir - basic bootstrap scripts should fail to bootstrap when using CSP in Dev due to eval", "app dir - basic rewrites should support rewrites on client-side navigation", "app dir - basic rewrites should support rewrites on client-side navigation from pages to app with existing pages path", "app dir - basic rewrites should support rewrites on initial load", @@ -3331,6 +3334,9 @@ "app dir - metadata basic should support title template", "app dir - metadata basic should support verification tags", "app dir - metadata basic should use parent layout title when no title is defined in page", + "app dir - metadata file based icons should handle updates to the file icon name and order", + "app dir - metadata file based icons should not render if image file is not specified", + "app dir - metadata file based icons should render icon and apple touch icon meta if their images are specified", "app dir - metadata icons should merge icons from layout if no static icons files are specified", "app dir - metadata icons should not hoist meta[itemProp] to head", "app dir - metadata icons should support basic complex descriptor icons field", @@ -3345,6 +3351,7 @@ "app dir - metadata react cache should have same title and page value when navigating", "app dir - metadata should not effect metadata images convention like files under pages directory", "app dir - metadata static routes should have /favicon.ico as route", + "app dir - metadata static routes should have icons as route", "app dir - metadata static routes should support sitemap.xml under every routes", "app dir - metadata static routes should support static manifest.webmanifest", "app dir - metadata twitter should render twitter card summary when image is not present", @@ -3354,13 +3361,9 @@ ], "failed": [ "app dir - metadata basic should support other basic tags (edge)", - "app dir - metadata file based icons should handle hmr updates to the file icon", - "app dir - metadata file based icons should not render if image file is not specified", - "app dir - metadata file based icons should render icon and apple touch icon meta if their images are specified", "app dir - metadata icons should support root level of favicon.ico", "app dir - metadata navigation should render root not-found with default metadata", "app dir - metadata opengraph should pick up opengraph-image and twitter-image as static metadata files", - "app dir - metadata static routes should have icons as route", "app dir - metadata static routes should support root dir robots.txt" ], "pending": [], @@ -3391,6 +3394,7 @@ "app dir - navigation not-found should trigger not-found while streaming", "app dir - navigation query string should handle unicode search params", "app dir - navigation query string should set query correctly", + "app dir - navigation query string useParams identity between renders should be stable in app", "app dir - navigation redirect components should redirect client-side", "app dir - navigation redirect components should redirect in a client component", "app dir - navigation redirect components should redirect in a server component", @@ -3408,7 +3412,9 @@ "app dir - navigation relative hashes and queries should work with a query-only href", "app dir - navigation relative hashes and queries should work with both relative hashes and queries" ], - "failed": [], + "failed": [ + "app dir - navigation query string useParams identity between renders should be stable in pages" + ], "pending": [], "flakey": [], "runtimeError": false @@ -3898,6 +3904,13 @@ "flakey": [], "runtimeError": false }, + "test/e2e/app-dir/x-forwarded-headers/x-forwarded-headers.test.ts": { + "passed": ["x-forwarded-headers should include x-forwarded-* headers"], + "failed": [], + "pending": [], + "flakey": [], + "runtimeError": false + }, "test/e2e/basepath-trailing-slash.test.ts": { "passed": [ "basePath + trailingSlash should allow URL query strings on index without refresh", @@ -4716,6 +4729,7 @@ }, "test/e2e/middleware-general/test/index.test.ts": { "passed": [ + "Middleware Runtime with i18n allows shallow linking with middleware", "Middleware Runtime with i18n allows to access env variables", "Middleware Runtime with i18n hard-navigates when the data request failed", "Middleware Runtime with i18n should accept a URL instance for fetch", @@ -4727,6 +4741,9 @@ "Middleware Runtime with i18n should have correct dynamic route params for middleware rewrite to dynamic route", "Middleware Runtime with i18n should have correct dynamic route params on client-transition to dynamic route", "Middleware Runtime with i18n should have correct query values for rewrite to ssg page", + "Middleware Runtime with i18n should have correct route params for chained rewrite from middleware to config rewrite", + "Middleware Runtime with i18n should have correct route params for rewrite from config dynamic route", + "Middleware Runtime with i18n should have correct route params for rewrite from config non-dynamic route", "Middleware Runtime with i18n should have init header for NextResponse.redirect", "Middleware Runtime with i18n should keep non data requests in their original shape", "Middleware Runtime with i18n should normalize data requests into page requests", @@ -4748,6 +4765,7 @@ "Middleware Runtime with i18n should warn when using NextResponse.redirect with a relative URL", "Middleware Runtime with i18n should warn when using Response.redirect with a relative URL", "Middleware Runtime with i18n should work with notFound: true correctly", + "Middleware Runtime without i18n allows shallow linking with middleware", "Middleware Runtime without i18n allows to access env variables", "Middleware Runtime without i18n hard-navigates when the data request failed", "Middleware Runtime without i18n should accept a URL instance for fetch", @@ -4759,6 +4777,9 @@ "Middleware Runtime without i18n should have correct dynamic route params for middleware rewrite to dynamic route", "Middleware Runtime without i18n should have correct dynamic route params on client-transition to dynamic route", "Middleware Runtime without i18n should have correct query values for rewrite to ssg page", + "Middleware Runtime without i18n should have correct route params for chained rewrite from middleware to config rewrite", + "Middleware Runtime without i18n should have correct route params for rewrite from config dynamic route", + "Middleware Runtime without i18n should have correct route params for rewrite from config non-dynamic route", "Middleware Runtime without i18n should keep non data requests in their original shape", "Middleware Runtime without i18n should normalize data requests into page requests", "Middleware Runtime without i18n should only contain middleware route in dev middleware manifest", @@ -4779,18 +4800,10 @@ "Middleware Runtime without i18n should work with notFound: true correctly" ], "failed": [ - "Middleware Runtime with i18n allows shallow linking with middleware", "Middleware Runtime with i18n passes search params with rewrites", "Middleware Runtime with i18n refreshes the page when middleware changes ", - "Middleware Runtime with i18n should have correct route params for chained rewrite from middleware to config rewrite", - "Middleware Runtime with i18n should have correct route params for rewrite from config dynamic route", - "Middleware Runtime with i18n should have correct route params for rewrite from config non-dynamic route", - "Middleware Runtime without i18n allows shallow linking with middleware", "Middleware Runtime without i18n passes search params with rewrites", "Middleware Runtime without i18n refreshes the page when middleware changes ", - "Middleware Runtime without i18n should have correct route params for chained rewrite from middleware to config rewrite", - "Middleware Runtime without i18n should have correct route params for rewrite from config dynamic route", - "Middleware Runtime without i18n should have correct route params for rewrite from config non-dynamic route", "Middleware Runtime without i18n should have init header for NextResponse.redirect" ], "pending": [], @@ -4927,6 +4940,8 @@ "Middleware Rewrite should add a cookie and rewrite to a/b test", "Middleware Rewrite should allow to opt-out prefetch caching", "Middleware Rewrite should allow to rewrite keeping the locale in pathname", + "Middleware Rewrite should allow to rewrite to a `afterFiles` rewrite config", + "Middleware Rewrite should allow to rewrite to a `beforeFiles` rewrite config", "Middleware Rewrite should allow to rewrite to a different locale", "Middleware Rewrite should allow to switch locales", "Middleware Rewrite should behave consistently on recursive rewrites", @@ -4937,6 +4952,7 @@ "Middleware Rewrite should handle shallow navigation correctly (dynamic page)", "Middleware Rewrite should handle shallow navigation correctly (non-dynamic page)", "Middleware Rewrite should handle static dynamic rewrite from middleware correctly", + "Middleware Rewrite should handle static rewrite from next.config.js correctly", "Middleware Rewrite should hard navigate on 404 for data request", "Middleware Rewrite should have correct query info for dynamic route after query hydration", "Middleware Rewrite should not call middleware with shallow push", @@ -4958,11 +4974,7 @@ "Middleware Rewrite should rewrite without hard navigation", "Middleware Rewrite support colons in path" ], - "failed": [ - "Middleware Rewrite should allow to rewrite to a `afterFiles` rewrite config", - "Middleware Rewrite should allow to rewrite to a `beforeFiles` rewrite config", - "Middleware Rewrite should handle static rewrite from next.config.js correctly" - ], + "failed": [], "pending": [ "Middleware Rewrite includes the locale in rewrites by default" ], @@ -4980,9 +4992,14 @@ }, "test/e2e/middleware-trailing-slash/test/index.test.ts": { "passed": [ + "Middleware Runtime trailing slash allows shallow linking with middleware", "Middleware Runtime trailing slash should add a rewrite header on data requests for rewrites", "Middleware Runtime trailing slash should have correct dynamic route params for middleware rewrite to dynamic route", "Middleware Runtime trailing slash should have correct dynamic route params on client-transition to dynamic route", + "Middleware Runtime trailing slash should have correct route params for chained rewrite from middleware to config rewrite", + "Middleware Runtime trailing slash should have correct route params for rewrite from config dynamic route", + "Middleware Runtime trailing slash should have correct route params for rewrite from config non-dynamic route", + "Middleware Runtime trailing slash should have init header for NextResponse.redirect", "Middleware Runtime trailing slash should keep non data requests in their original shape", "Middleware Runtime trailing slash should normalize data requests into page requests", "Middleware Runtime trailing slash should redirect the same for direct visit and client-transition", @@ -4999,13 +5016,8 @@ "Middleware Runtime trailing slash without .html extension should work when requesting the page directly" ], "failed": [ - "Middleware Runtime trailing slash allows shallow linking with middleware", "Middleware Runtime trailing slash refreshes the page when middleware changes ", - "Middleware Runtime trailing slash should have correct query values for rewrite to ssg page", - "Middleware Runtime trailing slash should have correct route params for chained rewrite from middleware to config rewrite", - "Middleware Runtime trailing slash should have correct route params for rewrite from config dynamic route", - "Middleware Runtime trailing slash should have correct route params for rewrite from config non-dynamic route", - "Middleware Runtime trailing slash should have init header for NextResponse.redirect" + "Middleware Runtime trailing slash should have correct query values for rewrite to ssg page" ], "pending": [], "flakey": [], @@ -5350,6 +5362,7 @@ "Prerender should navigate to dynamic page with brackets in param as string", "Prerender should never show fallback for page not in getStaticPaths when blocking", "Prerender should not contain headers already sent error", + "Prerender should not error when rewriting to fallback dynamic SSG page", "Prerender should not fail to update incremental cache", "Prerender should not fallback before invalid JSON is returned from getStaticProps when blocking fallback", "Prerender should not have attempted sending invalid payload", @@ -5384,9 +5397,7 @@ "Prerender should support prerendered catchall-explicit route (nested)", "Prerender should support prerendered catchall-explicit route (single)" ], - "failed": [ - "Prerender should not error when rewriting to fallback dynamic SSG page" - ], + "failed": [], "pending": [], "flakey": [], "runtimeError": false @@ -7167,13 +7178,12 @@ }, "test/integration/custom-routes-i18n/test/index.test.js": { "passed": [ + "Custom routes i18n dev mode should navigate on the client with rewrites correctly", "Custom routes i18n dev mode should respond to default locale redirects correctly", "Custom routes i18n dev mode should rewrite correctly", "Custom routes i18n dev mode should rewrite index routes correctly" ], - "failed": [ - "Custom routes i18n dev mode should navigate on the client with rewrites correctly" - ], + "failed": [], "pending": [ "Custom routes i18n production mode should navigate on the client with rewrites correctly", "Custom routes i18n production mode should respond to default locale redirects correctly", @@ -7199,6 +7209,8 @@ "Custom routes dev mode should handle api rewrite with param successfully", "Custom routes dev mode should handle api rewrite with un-named param successfully", "Custom routes dev mode should handle basic api rewrite successfully", + "Custom routes dev mode should handle beforeFiles rewrite to dynamic route correctly", + "Custom routes dev mode should handle beforeFiles rewrite to partly dynamic route correctly", "Custom routes dev mode should handle chained redirects successfully", "Custom routes dev mode should handle chained rewrites successfully", "Custom routes dev mode should handle encoded value in the pathname correctly", @@ -7235,6 +7247,7 @@ "Custom routes dev mode should match has query redirect correctly", "Custom routes dev mode should match has query redirect with duplicate query key", "Custom routes dev mode should match has query rewrite correctly", + "Custom routes dev mode should match has rewrite correctly before files", "Custom routes dev mode should match missing cookie headers correctly", "Custom routes dev mode should match missing cookie redirect correctly", "Custom routes dev mode should match missing cookie rewrite correctly", @@ -7253,8 +7266,10 @@ "Custom routes dev mode should not pass non captured has value for rewrite correctly", "Custom routes dev mode should not rewrite for _next/data route when a match is found", "Custom routes dev mode should overwrite param values correctly", + "Custom routes dev mode should parse params correctly for rewrite to auto-export dynamic page", "Custom routes dev mode should pass captured has value for rewrite correctly", "Custom routes dev mode should pass has segment for rewrite correctly", + "Custom routes dev mode should provide params correctly for rewrite to auto-export non-dynamic page", "Custom routes dev mode should redirect successfully with catchall", "Custom routes dev mode should redirect successfully with permanent: false", "Custom routes dev mode should redirect successfully with provided statusCode", @@ -7262,6 +7277,7 @@ "Custom routes dev mode should redirect with URL in query correctly non-encoded", "Custom routes dev mode should redirect with hash successfully", "Custom routes dev mode should redirect with params successfully", + "Custom routes dev mode should resolveHref correctly navigating through history", "Custom routes dev mode should rewrite with params successfully", "Custom routes dev mode should server static files through a rewrite", "Custom routes dev mode should successfully rewrite a WebSocket request", @@ -7274,6 +7290,8 @@ "Custom routes dev mode should support unnamed parameters correctly", "Custom routes dev mode should work successfully on the client", "Custom routes dev mode should work with rewrite when manually specifying href/as", + "Custom routes dev mode should work with rewrite when only specifying href", + "Custom routes dev mode should work with rewrite when only specifying href and ends in dynamic route", "Custom routes dev mode show allow redirect to override the page", "Custom routes no-op rewrite should not error for no-op rewrite and auto export dynamic route", "Custom routes should load custom routes when only one type is used dev mode should work with just headers", @@ -7281,15 +7299,7 @@ "Custom routes should load custom routes when only one type is used dev mode should work with just rewrites" ], "failed": [ - "Custom routes dev mode should handle beforeFiles rewrite to dynamic route correctly", - "Custom routes dev mode should handle beforeFiles rewrite to partly dynamic route correctly", - "Custom routes dev mode should handle external beforeFiles rewrite correctly", - "Custom routes dev mode should match has rewrite correctly before files", - "Custom routes dev mode should parse params correctly for rewrite to auto-export dynamic page", - "Custom routes dev mode should provide params correctly for rewrite to auto-export non-dynamic page", - "Custom routes dev mode should resolveHref correctly navigating through history", - "Custom routes dev mode should work with rewrite when only specifying href", - "Custom routes dev mode should work with rewrite when only specifying href and ends in dynamic route" + "Custom routes dev mode should handle external beforeFiles rewrite correctly" ], "pending": [ "Custom routes export production mode should not show warning for custom routes when next export on Vercel", @@ -10243,11 +10253,10 @@ }, "test/integration/gssp-redirect-with-rewrites/test/index.test.js": { "passed": [ - "getServerSideProps redirects should fallback to browser navigation for an unknown URL" - ], - "failed": [ + "getServerSideProps redirects should fallback to browser navigation for an unknown URL", "getServerSideProps redirects should use a client-side navigation for a rewritten URL" ], + "failed": [], "pending": [], "flakey": [], "runtimeError": false @@ -10263,6 +10272,7 @@ "GS(S)P Redirect Support dev mode should apply redirect when fallback GSP page is visited directly (external domain)", "GS(S)P Redirect Support dev mode should apply redirect when fallback GSP page is visited directly (external)", "GS(S)P Redirect Support dev mode should apply redirect when fallback GSP page is visited directly (internal dynamic)", + "GS(S)P Redirect Support dev mode should apply redirect when fallback GSP page is visited directly (internal normal)", "GS(S)P Redirect Support dev mode should apply redirect when fallback GSSP page is visited directly (external domain)", "GS(S)P Redirect Support dev mode should apply redirect when fallback blocking GSP page is visited directly (internal dynamic)", "GS(S)P Redirect Support dev mode should apply redirect when fallback blocking GSP page is visited directly (internal dynamic) second visit", @@ -10276,9 +10286,7 @@ "GS(S)P Redirect Support dev mode should not replace history of the origin page when GSSP page is navigated to client-side (external)", "GS(S)P Redirect Support dev mode should not replace history of the origin page when GSSP page is navigated to client-side (internal normal)" ], - "failed": [ - "GS(S)P Redirect Support dev mode should apply redirect when fallback GSP page is visited directly (internal normal)" - ], + "failed": [], "pending": [ "GS(S)P Redirect Support production mode should apply permanent redirect when visited directly for GSSP page", "GS(S)P Redirect Support production mode should apply redirect when GSP page is navigated to client-side (external)", @@ -10609,11 +10617,10 @@ }, "test/integration/i18n-support-index-rewrite/test/index.test.js": { "passed": [ + "Custom routes i18n support index rewrite dev mode should handle index rewrite on client correctly", "Custom routes i18n support index rewrite dev mode should rewrite index route correctly" ], - "failed": [ - "Custom routes i18n support index rewrite dev mode should handle index rewrite on client correctly" - ], + "failed": [], "pending": [ "Custom routes i18n support index rewrite production mode should handle index rewrite on client correctly", "Custom routes i18n support index rewrite production mode should rewrite index route correctly" @@ -13669,10 +13676,10 @@ "runtimeError": false }, "test/integration/rewrite-with-browser-history/test/index.test.js": { - "passed": [], - "failed": [ + "passed": [ "rewrites persist with browser history actions dev mode back-button should go back to rewritten path successfully" ], + "failed": [], "pending": [ "rewrites persist with browser history actions production mode back-button should go back to rewritten path successfully" ], @@ -13710,11 +13717,11 @@ "runtimeError": false }, "test/integration/rewrites-has-condition/test/index.test.js": { - "passed": [], - "failed": [ + "passed": [ "rewrites has condition dev mode should navigate to a has rewrite without error", "rewrites has condition dev mode should navigate to a simple rewrite without error" ], + "failed": [], "pending": [ "rewrites has condition production mode should navigate to a has rewrite without error", "rewrites has condition production mode should navigate to a simple rewrite without error" @@ -13723,11 +13730,11 @@ "runtimeError": false }, "test/integration/rewrites-manual-href-as/test/index.test.js": { - "passed": [], - "failed": [ + "passed": [ "rewrites manual href/as dev mode should allow manual href/as on dynamic page", "rewrites manual href/as dev mode should allow manual href/as on index page" ], + "failed": [], "pending": [ "rewrites manual href/as production mode should allow manual href/as on dynamic page", "rewrites manual href/as production mode should allow manual href/as on index page" @@ -13945,22 +13952,22 @@ }, "test/integration/scroll-back-restoration/test/index.test.js": { "passed": [ - "Scroll Restoration Support dev mode should restore the scroll position on navigating back" + "Scroll Back Restoration Support dev mode should restore the scroll position on navigating back" ], "failed": [], "pending": [ - "Scroll Restoration Support production mode should restore the scroll position on navigating back" + "Scroll Back Restoration Support production mode should restore the scroll position on navigating back" ], "flakey": [], "runtimeError": false }, "test/integration/scroll-forward-restoration/test/index.test.js": { - "passed": [], - "failed": [ - "Scroll Restoration Support dev mode should restore the scroll position on navigating forward" + "passed": [ + "Scroll Forward Restoration Support dev mode should restore the scroll position on navigating forward" ], + "failed": [], "pending": [ - "Scroll Restoration Support production mode should restore the scroll position on navigating forward" + "Scroll Forward Restoration Support production mode should restore the scroll position on navigating forward" ], "flakey": [], "runtimeError": false From 6d2df8636a019f0c420397284001f6f5e8b4e4e6 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Fri, 20 Oct 2023 02:57:06 +0200 Subject: [PATCH 03/23] build: don't error when bundling optional peer deps (#57073) This PR adds a resolver plugin to verify during bundling that when a module is unresolved, that it is not an optional peer dependency specified in the package.json of the caller. An error would happen if you try to bundle packages like `typeorm` since there are `require` calls in the code to those dependencies. Also, swallow dynamic dependencies warnings in `require` calls error if they come from `node_modules`. They are not actionable at all generally. --- packages/next/src/build/webpack-config.ts | 5 +- ...optional-peer-dependency-resolve-plugin.ts | 53 +++++++++++++++++++ .../plugins/wellknown-errors-plugin/index.ts | 13 +++++ test/e2e/transpile-packages/index.test.ts | 13 +++++ test/e2e/transpile-packages/npm/app/layout.js | 10 ++++ test/e2e/transpile-packages/npm/app/page.js | 5 ++ .../package-with-optional-deps/index.js | 17 ++++++ .../package-with-optional-deps/package.json | 17 ++++++ 8 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 packages/next/src/build/webpack/plugins/optional-peer-dependency-resolve-plugin.ts create mode 100644 test/e2e/transpile-packages/npm/app/layout.js create mode 100644 test/e2e/transpile-packages/npm/app/page.js create mode 100644 test/e2e/transpile-packages/npm/node_modules_bak/package-with-optional-deps/index.js create mode 100644 test/e2e/transpile-packages/npm/node_modules_bak/package-with-optional-deps/package.json diff --git a/packages/next/src/build/webpack-config.ts b/packages/next/src/build/webpack-config.ts index 3305e4764d679..c6cec8330e4a5 100644 --- a/packages/next/src/build/webpack-config.ts +++ b/packages/next/src/build/webpack-config.ts @@ -78,6 +78,7 @@ import { getMainField, edgeConditionNames, } from './webpack-config-rules/resolve' +import { OptionalPeerDependencyResolverPlugin } from './webpack/plugins/optional-peer-dependency-resolve-plugin' type ExcludesFalse = (x: T | false) => x is T type ClientEntries = { @@ -930,7 +931,9 @@ export default async function getBaseWebpackConfig( ...(isEdgeServer && { conditionNames: edgeConditionNames, }), - plugins: [], + plugins: [ + isNodeServer ? new OptionalPeerDependencyResolverPlugin() : undefined, + ].filter(Boolean) as webpack.ResolvePluginInstance[], } const terserOptions: any = { diff --git a/packages/next/src/build/webpack/plugins/optional-peer-dependency-resolve-plugin.ts b/packages/next/src/build/webpack/plugins/optional-peer-dependency-resolve-plugin.ts new file mode 100644 index 0000000000000..8a1be4d9fbece --- /dev/null +++ b/packages/next/src/build/webpack/plugins/optional-peer-dependency-resolve-plugin.ts @@ -0,0 +1,53 @@ +import type { Resolver } from 'webpack' + +const pluginSymbol = Symbol('OptionalPeerDependencyResolverPlugin') + +export class OptionalPeerDependencyResolverPlugin { + apply(resolver: Resolver) { + const target = resolver.ensureHook('raw-module') + target.tapAsync( + 'OptionalPeerDependencyResolverPlugin', + (request, resolveContext, callback) => { + // if we've already recursed into this plugin, we want to skip it + if ((request as any)[pluginSymbol]) { + return callback() + } + + // popping the stack to prevent the recursion check + resolveContext.stack?.delete(Array.from(resolveContext.stack).pop()!) + + resolver.doResolve( + target, + // when we call doResolve again, we need to make sure we don't + // recurse into this plugin again + { ...request, [pluginSymbol]: true } as any, + null, + resolveContext, + (err, result) => { + if ( + !result && + request?.descriptionFileData?.peerDependenciesMeta && + request.request + ) { + const peerDependenciesMeta = request.descriptionFileData + .peerDependenciesMeta as Record + + const isOptional = + peerDependenciesMeta && + peerDependenciesMeta[request.request] && + peerDependenciesMeta[request.request].optional + + if (isOptional) { + return callback(null, { + path: false, + }) + } + } + + return callback(err, result) + } + ) + } + ) + } +} diff --git a/packages/next/src/build/webpack/plugins/wellknown-errors-plugin/index.ts b/packages/next/src/build/webpack/plugins/wellknown-errors-plugin/index.ts index 953ba57db0e23..ffe51e0e99e7d 100644 --- a/packages/next/src/build/webpack/plugins/wellknown-errors-plugin/index.ts +++ b/packages/next/src/build/webpack/plugins/wellknown-errors-plugin/index.ts @@ -7,6 +7,19 @@ export class WellKnownErrorsPlugin { apply(compiler: webpack.Compiler) { compiler.hooks.compilation.tap(NAME, (compilation) => { compilation.hooks.afterSeal.tapPromise(NAME, async () => { + if (compilation.warnings?.length) { + await Promise.all( + compilation.warnings.map(async (warn, i) => { + if ( + warn.name === 'ModuleDependencyWarning' && + warn.module.context?.includes('node_modules') + ) { + delete compilation.warnings[i] + } + }) + ) + } + if (compilation.errors?.length) { await Promise.all( compilation.errors.map(async (err, i) => { diff --git a/test/e2e/transpile-packages/index.test.ts b/test/e2e/transpile-packages/index.test.ts index 841d3ba01bb9f..a4d5a54f75f84 100644 --- a/test/e2e/transpile-packages/index.test.ts +++ b/test/e2e/transpile-packages/index.test.ts @@ -84,4 +84,17 @@ describe('transpile packages', () => { ).toBe('rgb(0, 0, 255)') }) }) + describe('optional deps', () => { + it('should not throw an error when optional deps are not installed', async () => { + expect(next.cliOutput).not.toContain( + "Module not found: Error: Can't resolve 'foo'" + ) + }) + + it('should hide dynammic module dependency errors from node_modules', async () => { + expect(next.cliOutput).not.toContain( + 'Critical dependency: the request of a dependency is an expression' + ) + }) + }) }) diff --git a/test/e2e/transpile-packages/npm/app/layout.js b/test/e2e/transpile-packages/npm/app/layout.js new file mode 100644 index 0000000000000..0932ed942945a --- /dev/null +++ b/test/e2e/transpile-packages/npm/app/layout.js @@ -0,0 +1,10 @@ +export default function Layout({ children }) { + return ( + + + My page + + {children} + + ) +} diff --git a/test/e2e/transpile-packages/npm/app/page.js b/test/e2e/transpile-packages/npm/app/page.js new file mode 100644 index 0000000000000..180eb39becdbb --- /dev/null +++ b/test/e2e/transpile-packages/npm/app/page.js @@ -0,0 +1,5 @@ +import { hello } from 'package-with-optional-deps' + +export default function Page() { + return hello() +} diff --git a/test/e2e/transpile-packages/npm/node_modules_bak/package-with-optional-deps/index.js b/test/e2e/transpile-packages/npm/node_modules_bak/package-with-optional-deps/index.js new file mode 100644 index 0000000000000..4af07541ba902 --- /dev/null +++ b/test/e2e/transpile-packages/npm/node_modules_bak/package-with-optional-deps/index.js @@ -0,0 +1,17 @@ +function getDynamicPath() { + return 'foo' +} + +function unusedFunctionWithRequire() { + require('foo') + require(getDynamicPath()) +} + +function hello() { + return 'world' +} + +module.exports = { + hello, + unusedFunctionWithRequire, +} diff --git a/test/e2e/transpile-packages/npm/node_modules_bak/package-with-optional-deps/package.json b/test/e2e/transpile-packages/npm/node_modules_bak/package-with-optional-deps/package.json new file mode 100644 index 0000000000000..e6d28eef1bdf6 --- /dev/null +++ b/test/e2e/transpile-packages/npm/node_modules_bak/package-with-optional-deps/package.json @@ -0,0 +1,17 @@ +{ + "name": "my-package", + "version": "1.0.0", + "description": "My package description", + "main": "index.js", + "keywords": [], + "author": "", + "license": "ISC", + "peerDependenciesMeta": { + "foo": { + "optional": true + } + }, + "peerDependencies": { + "foo": "^1.0.0" + } +} From c41debd23a9c3d8eca66909ea04ce34ce534656e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Thu, 19 Oct 2023 19:02:37 -0700 Subject: [PATCH 04/23] Expose Experimental Taint APIs (#56507) Exposes the new experimental Taint APIs using the `taint` flag which enables experimental React. As an example for how we can use it, I use it to taint `process.env` with a better error message. I'm not sure where this should live since it's a global init but it needs access to the global config. It's unnecessary to retaint it for every render but not sure if there's a better place for it. --------- Co-authored-by: Jimmy Lai Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../crates/next-core/src/next_config.rs | 1 + .../webpack/plugins/define-env-plugin.ts | 2 +- .../next/src/lib/needs-experimental-react.ts | 6 +++- .../next/src/server/app-render/app-render.tsx | 9 ++++++ .../next/src/server/app-render/entry-base.ts | 3 ++ .../next/src/server/app-render/rsc/taint.ts | 30 +++++++++++++++++++ packages/next/src/server/app-render/types.ts | 1 + packages/next/src/server/base-server.ts | 2 ++ packages/next/src/server/config-schema.ts | 1 + packages/next/src/server/config-shared.ts | 6 ++++ test/e2e/app-dir/rsc-basic/rsc-basic.test.ts | 2 +- test/e2e/app-dir/taint/app/component.tsx | 9 ++++++ test/e2e/app-dir/taint/app/error.tsx | 5 ++++ test/e2e/app-dir/taint/app/layout.tsx | 11 +++++++ test/e2e/app-dir/taint/app/page.tsx | 5 ++++ test/e2e/app-dir/taint/next.config.js | 6 ++++ test/e2e/app-dir/taint/process-taint.test.ts | 25 ++++++++++++++++ 17 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 packages/next/src/server/app-render/rsc/taint.ts create mode 100644 test/e2e/app-dir/taint/app/component.tsx create mode 100644 test/e2e/app-dir/taint/app/error.tsx create mode 100644 test/e2e/app-dir/taint/app/layout.tsx create mode 100644 test/e2e/app-dir/taint/app/page.tsx create mode 100644 test/e2e/app-dir/taint/next.config.js create mode 100644 test/e2e/app-dir/taint/process-taint.test.ts diff --git a/packages/next-swc/crates/next-core/src/next_config.rs b/packages/next-swc/crates/next-core/src/next_config.rs index 5576234070065..cf8787db59dc7 100644 --- a/packages/next-swc/crates/next-core/src/next_config.rs +++ b/packages/next-swc/crates/next-core/src/next_config.rs @@ -486,6 +486,7 @@ pub struct ExperimentalConfig { /// Using this feature will enable the `react@experimental` for the `app` /// directory. ppr: Option, + taint: Option, proxy_timeout: Option, /// Allows adjusting body parser size limit for server actions. server_actions_body_size_limit: Option, diff --git a/packages/next/src/build/webpack/plugins/define-env-plugin.ts b/packages/next/src/build/webpack/plugins/define-env-plugin.ts index b579f8f605919..57ae2cbd9e2d9 100644 --- a/packages/next/src/build/webpack/plugins/define-env-plugin.ts +++ b/packages/next/src/build/webpack/plugins/define-env-plugin.ts @@ -213,7 +213,7 @@ export function getDefineEnv({ } : undefined), 'process.env.TURBOPACK': JSON.stringify(false), - ...(isNodeServer + ...(isNodeOrEdgeCompilation ? { 'process.env.__NEXT_EXPERIMENTAL_REACT': JSON.stringify( needsExperimentalReact(config) diff --git a/packages/next/src/lib/needs-experimental-react.ts b/packages/next/src/lib/needs-experimental-react.ts index 36ffa9a89c5ae..cafade3c3ec5b 100644 --- a/packages/next/src/lib/needs-experimental-react.ts +++ b/packages/next/src/lib/needs-experimental-react.ts @@ -1,5 +1,9 @@ import type { NextConfig } from '../server/config-shared' export function needsExperimentalReact(config: NextConfig) { - return Boolean(config.experimental?.serverActions || config.experimental?.ppr) + return Boolean( + config.experimental?.serverActions || + config.experimental?.ppr || + config.experimental?.taint + ) } diff --git a/packages/next/src/server/app-render/app-render.tsx b/packages/next/src/server/app-render/app-render.tsx index 5c786662e1f11..ca88145c5bd20 100644 --- a/packages/next/src/server/app-render/app-render.tsx +++ b/packages/next/src/server/app-render/app-render.tsx @@ -408,6 +408,7 @@ async function renderToHTMLOrFlightImpl( buildId, appDirDevErrorLogger, assetPrefix = '', + enableTainting, } = renderOpts // We need to expose the bundled `require` API globally for @@ -476,8 +477,16 @@ async function renderToHTMLOrFlightImpl( AppRouter, GlobalError, tree: loaderTree, + taintObjectReference, } = ComponentMod + if (enableTainting) { + taintObjectReference( + 'Do not pass process.env to client components since it will leak sensitive data', + process.env + ) + } + const { staticGenerationStore, requestStore } = baseCtx const { urlPathname } = staticGenerationStore diff --git a/packages/next/src/server/app-render/entry-base.ts b/packages/next/src/server/app-render/entry-base.ts index ae7e186764a4d..5da552fd5145f 100644 --- a/packages/next/src/server/app-render/entry-base.ts +++ b/packages/next/src/server/app-render/entry-base.ts @@ -23,6 +23,8 @@ import { preconnect, } from '../../server/app-render/rsc/preloads' +import { taintObjectReference } from '../../server/app-render/rsc/taint' + const { NotFoundBoundary } = require('next/dist/client/components/not-found-boundary') as typeof import('../../client/components/not-found-boundary') @@ -39,6 +41,7 @@ export { preloadStyle, preloadFont, preconnect, + taintObjectReference, StaticGenerationSearchParamsBailoutProvider, NotFoundBoundary, } diff --git a/packages/next/src/server/app-render/rsc/taint.ts b/packages/next/src/server/app-render/rsc/taint.ts new file mode 100644 index 0000000000000..a37e0bf15d0d6 --- /dev/null +++ b/packages/next/src/server/app-render/rsc/taint.ts @@ -0,0 +1,30 @@ +/* + +Files in the rsc directory are meant to be packaged as part of the RSC graph using next-app-loader. + +*/ + +import * as React from 'react' + +type Reference = object +type TaintableUniqueValue = string | bigint | ArrayBufferView + +function notImplemented() { + throw new Error('Taint can only be used with the taint flag.') +} + +export const taintObjectReference: ( + message: string | undefined, + object: Reference +) => void = process.env.__NEXT_EXPERIMENTAL_REACT + ? // @ts-ignore + React.experimental_taintObjectReference + : notImplemented +export const taintUniqueValue: ( + message: string | undefined, + lifetime: Reference, + value: TaintableUniqueValue +) => void = process.env.__NEXT_EXPERIMENTAL_REACT + ? // @ts-ignore + React.experimental_taintUniqueValue + : notImplemented diff --git a/packages/next/src/server/app-render/types.ts b/packages/next/src/server/app-render/types.ts index 59d23ef982431..6cb576558b882 100644 --- a/packages/next/src/server/app-render/types.ts +++ b/packages/next/src/server/app-render/types.ts @@ -111,6 +111,7 @@ export interface RenderOptsPartial { supportsDynamicHTML: boolean runtime?: ServerRuntime serverComponents?: boolean + enableTainting?: boolean assetPrefix?: string crossOrigin?: '' | 'anonymous' | 'use-credentials' | undefined nextFontManifest?: NextFontManifest diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts index 3b65c5bee8dd9..02f96a6723f01 100644 --- a/packages/next/src/server/base-server.ts +++ b/packages/next/src/server/base-server.ts @@ -230,6 +230,7 @@ type BaseRenderOpts = { distDir: string runtime?: ServerRuntime serverComponents?: boolean + enableTainting?: boolean crossOrigin?: 'anonymous' | 'use-credentials' | '' | undefined supportsDynamicHTML?: boolean isBot?: boolean @@ -478,6 +479,7 @@ export default abstract class Server { domainLocales: this.nextConfig.i18n?.domains, distDir: this.distDir, serverComponents, + enableTainting: this.nextConfig.experimental.taint, crossOrigin: this.nextConfig.crossOrigin ? this.nextConfig.crossOrigin : undefined, diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts index 6d8cbf38249b7..b4e36831976b7 100644 --- a/packages/next/src/server/config-schema.ts +++ b/packages/next/src/server/config-schema.ts @@ -281,6 +281,7 @@ export const configSchema: zod.ZodType = z.lazy(() => .record(z.string(), z.array(z.string())) .optional(), ppr: z.boolean().optional(), + taint: z.boolean().optional(), proxyTimeout: z.number().gte(0).optional(), serverComponentsExternalPackages: z.array(z.string()).optional(), scrollRestoration: z.boolean().optional(), diff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts index 8064d3b8d5570..9bccd1bde88e2 100644 --- a/packages/next/src/server/config-shared.ts +++ b/packages/next/src/server/config-shared.ts @@ -307,6 +307,12 @@ export interface ExperimentalConfig { */ ppr?: boolean + /** + * Enables experimental taint APIs in React. + * Using this feature will enable the `react@experimental` for the `app` directory. + */ + taint?: boolean + /** * Allows adjusting body parser size limit for server actions. */ diff --git a/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts b/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts index d4c75be2f425e..93295a1126c6b 100644 --- a/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts +++ b/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts @@ -591,7 +591,7 @@ createNextDescribe( } describe('react@experimental', () => { - it.each([{ flag: 'ppr' }, { flag: 'serverActions' }])( + it.each([{ flag: 'ppr' }, { flag: 'serverActions' }, { flag: 'taint' }])( 'should opt into the react@experimental when enabling $flag', async ({ flag }) => { await next.stop() diff --git a/test/e2e/app-dir/taint/app/component.tsx b/test/e2e/app-dir/taint/app/component.tsx new file mode 100644 index 0000000000000..360e55542e0c6 --- /dev/null +++ b/test/e2e/app-dir/taint/app/component.tsx @@ -0,0 +1,9 @@ +'use client' + +export default function ClientComponent({ + config, +}: { + config: { [key: string]: string } +}) { + return

{config.something}

+} diff --git a/test/e2e/app-dir/taint/app/error.tsx b/test/e2e/app-dir/taint/app/error.tsx new file mode 100644 index 0000000000000..465b8e87d78c0 --- /dev/null +++ b/test/e2e/app-dir/taint/app/error.tsx @@ -0,0 +1,5 @@ +'use client' + +export default function ErrorComponent({ error }) { + return

{error.message}

+} diff --git a/test/e2e/app-dir/taint/app/layout.tsx b/test/e2e/app-dir/taint/app/layout.tsx new file mode 100644 index 0000000000000..ce81757e7c107 --- /dev/null +++ b/test/e2e/app-dir/taint/app/layout.tsx @@ -0,0 +1,11 @@ +import React from 'react' + +export const dynamic = 'force-dynamic' + +export default function Root({ children }: { children: React.ReactNode }) { + return ( + + {children} + + ) +} diff --git a/test/e2e/app-dir/taint/app/page.tsx b/test/e2e/app-dir/taint/app/page.tsx new file mode 100644 index 0000000000000..a923c52c5d6bf --- /dev/null +++ b/test/e2e/app-dir/taint/app/page.tsx @@ -0,0 +1,5 @@ +import ClientComponent from './component' + +export default async function Page() { + return +} diff --git a/test/e2e/app-dir/taint/next.config.js b/test/e2e/app-dir/taint/next.config.js new file mode 100644 index 0000000000000..a0053fdee74a6 --- /dev/null +++ b/test/e2e/app-dir/taint/next.config.js @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +module.exports = { + experimental: { + taint: true, + }, +} diff --git a/test/e2e/app-dir/taint/process-taint.test.ts b/test/e2e/app-dir/taint/process-taint.test.ts new file mode 100644 index 0000000000000..fec666d089495 --- /dev/null +++ b/test/e2e/app-dir/taint/process-taint.test.ts @@ -0,0 +1,25 @@ +import { createNextDescribe } from 'e2e-utils' + +const GENERIC_RSC_ERROR = + 'An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.' + +export function runTest({ next, isNextDev }) { + it('should error when passing process env to client component', async () => { + const browser = await next.browser('/') + expect(await browser.waitForElementByCss('#error-component').text()).toBe( + isNextDev + ? 'Do not pass process.env to client components since it will leak sensitive data' + : GENERIC_RSC_ERROR + ) + }) +} + +createNextDescribe( + 'app dir - taint', + { + files: __dirname, + }, + ({ next, isNextDev }) => { + runTest({ next, isNextDev }) + } +) From 6ad017d23fa59d6d7fa90050f30da48603dbe6a2 Mon Sep 17 00:00:00 2001 From: Vercel Release Bot <88769842+vercel-release-bot@users.noreply.github.com> Date: Fri, 20 Oct 2023 00:44:45 -0400 Subject: [PATCH 05/23] Update font data (#57094) This auto-generated PR updates font data with latest available --- packages/font/src/google/font-data.json | 57 ++++++++++++++++++++++++- packages/font/src/google/index.ts | 57 ++++++++++++++++++++++++- 2 files changed, 111 insertions(+), 3 deletions(-) diff --git a/packages/font/src/google/font-data.json b/packages/font/src/google/font-data.json index 7d9e4378c4339..7b3eb52f9b0be 100644 --- a/packages/font/src/google/font-data.json +++ b/packages/font/src/google/font-data.json @@ -10495,6 +10495,29 @@ "styles": ["normal", "italic"], "subsets": ["cyrillic", "latin", "latin-ext", "vietnamese"] }, + "Playpen Sans": { + "weights": [ + "100", + "200", + "300", + "400", + "500", + "600", + "700", + "800", + "variable" + ], + "styles": ["normal"], + "axes": [ + { + "tag": "wght", + "min": 100, + "max": 800, + "defaultValue": 400 + } + ], + "subsets": ["latin", "latin-ext", "math", "symbols", "vietnamese"] + }, "Plus Jakarta Sans": { "weights": ["200", "300", "400", "500", "600", "700", "800", "variable"], "styles": ["normal", "italic"], @@ -11122,8 +11145,27 @@ ] }, "Roboto Condensed": { - "weights": ["300", "400", "700"], + "weights": [ + "100", + "200", + "300", + "400", + "500", + "600", + "700", + "800", + "900", + "variable" + ], "styles": ["normal", "italic"], + "axes": [ + { + "tag": "wght", + "min": 100, + "max": 900, + "defaultValue": 400 + } + ], "subsets": [ "cyrillic", "cyrillic-ext", @@ -12216,6 +12258,19 @@ "styles": ["normal"], "subsets": ["latin"] }, + "Sometype Mono": { + "weights": ["400", "500", "600", "700", "variable"], + "styles": ["normal", "italic"], + "axes": [ + { + "tag": "wght", + "min": 400, + "max": 700, + "defaultValue": 400 + } + ], + "subsets": ["latin", "latin-ext"] + }, "Song Myung": { "weights": ["400"], "styles": ["normal"], diff --git a/packages/font/src/google/index.ts b/packages/font/src/google/index.ts index ac1987902e635..2269aa0cb8abf 100644 --- a/packages/font/src/google/index.ts +++ b/packages/font/src/google/index.ts @@ -17952,6 +17952,28 @@ export declare function Playfair_Display_SC< adjustFontFallback?: boolean subsets?: Array<'cyrillic' | 'latin' | 'latin-ext' | 'vietnamese'> }): T extends undefined ? NextFont : NextFontWithVariable +export declare function Playpen_Sans< + T extends CssVariable | undefined = undefined +>(options?: { + weight?: + | '100' + | '200' + | '300' + | '400' + | '500' + | '600' + | '700' + | '800' + | 'variable' + | Array<'100' | '200' | '300' | '400' | '500' | '600' | '700' | '800'> + style?: 'normal' | Array<'normal'> + display?: Display + variable?: T + preload?: boolean + fallback?: string[] + adjustFontFallback?: boolean + subsets?: Array<'latin' | 'latin-ext' | 'math' | 'symbols' | 'vietnamese'> +}): T extends undefined ? NextFont : NextFontWithVariable export declare function Plus_Jakarta_Sans< T extends CssVariable | undefined = undefined >(options?: { @@ -19116,8 +19138,21 @@ export declare function Roboto< }): T extends undefined ? NextFont : NextFontWithVariable export declare function Roboto_Condensed< T extends CssVariable | undefined = undefined ->(options: { - weight: '300' | '400' | '700' | Array<'300' | '400' | '700'> +>(options?: { + weight?: + | '100' + | '200' + | '300' + | '400' + | '500' + | '600' + | '700' + | '800' + | '900' + | 'variable' + | Array< + '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' + > style?: 'normal' | 'italic' | Array<'normal' | 'italic'> display?: Display variable?: T @@ -21099,6 +21134,24 @@ export declare function Solway< adjustFontFallback?: boolean subsets?: Array<'latin'> }): T extends undefined ? NextFont : NextFontWithVariable +export declare function Sometype_Mono< + T extends CssVariable | undefined = undefined +>(options?: { + weight?: + | '400' + | '500' + | '600' + | '700' + | 'variable' + | Array<'400' | '500' | '600' | '700'> + style?: 'normal' | 'italic' | Array<'normal' | 'italic'> + display?: Display + variable?: T + preload?: boolean + fallback?: string[] + adjustFontFallback?: boolean + subsets?: Array<'latin' | 'latin-ext'> +}): T extends undefined ? NextFont : NextFontWithVariable export declare function Song_Myung< T extends CssVariable | undefined = undefined >(options: { From 5d6592d8958db553ed2bf4c300c3f9758c2f65f2 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Fri, 20 Oct 2023 06:56:04 -0700 Subject: [PATCH 06/23] Upgrade edge-runtime/cookies (#57124) Backport fix on 13.5.6 to canary x-ref: #57021 --- packages/next/package.json | 2 +- .../compiled/@edge-runtime/cookies/index.js | 55 ++++++++++++++++++- .../@edge-runtime/cookies/package.json | 2 +- pnpm-lock.yaml | 8 +-- 4 files changed, 60 insertions(+), 7 deletions(-) diff --git a/packages/next/package.json b/packages/next/package.json index 6acf370d7fa19..a31097d947f0b 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -137,7 +137,7 @@ "@babel/traverse": "7.22.5", "@babel/types": "7.22.5", "@capsizecss/metrics": "1.1.0", - "@edge-runtime/cookies": "4.0.1", + "@edge-runtime/cookies": "4.0.2", "@edge-runtime/ponyfill": "2.4.1", "@edge-runtime/primitives": "4.0.2", "@hapi/accept": "5.0.2", diff --git a/packages/next/src/compiled/@edge-runtime/cookies/index.js b/packages/next/src/compiled/@edge-runtime/cookies/index.js index e02e1c992b3e8..a8863193013c5 100644 --- a/packages/next/src/compiled/@edge-runtime/cookies/index.js +++ b/packages/next/src/compiled/@edge-runtime/cookies/index.js @@ -111,6 +111,57 @@ function parsePriority(string) { string = string.toLowerCase(); return PRIORITY.includes(string) ? string : void 0; } +function splitCookiesString(cookiesString) { + if (!cookiesString) + return []; + var cookiesStrings = []; + var pos = 0; + var start; + var ch; + var lastComma; + var nextStart; + var cookiesSeparatorFound; + function skipWhitespace() { + while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) { + pos += 1; + } + return pos < cookiesString.length; + } + function notSpecialChar() { + ch = cookiesString.charAt(pos); + return ch !== "=" && ch !== ";" && ch !== ","; + } + while (pos < cookiesString.length) { + start = pos; + cookiesSeparatorFound = false; + while (skipWhitespace()) { + ch = cookiesString.charAt(pos); + if (ch === ",") { + lastComma = pos; + pos += 1; + skipWhitespace(); + nextStart = pos; + while (pos < cookiesString.length && notSpecialChar()) { + pos += 1; + } + if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") { + cookiesSeparatorFound = true; + pos = nextStart; + cookiesStrings.push(cookiesString.substring(start, lastComma)); + start = pos; + } else { + pos = lastComma + 1; + } + } else { + pos += 1; + } + } + if (!cookiesSeparatorFound || pos >= cookiesString.length) { + cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); + } + } + return cookiesStrings; +} // src/request-cookies.ts var RequestCookies = class { @@ -196,8 +247,10 @@ var ResponseCookies = class { constructor(responseHeaders) { /** @internal */ this._parsed = /* @__PURE__ */ new Map(); + var _a, _b, _c; this._headers = responseHeaders; - const cookieStrings = responseHeaders.getSetCookie(); + const setCookie = (_c = (_b = (_a = responseHeaders.getSetCookie) == null ? void 0 : _a.call(responseHeaders)) != null ? _b : responseHeaders.get("set-cookie")) != null ? _c : []; + const cookieStrings = Array.isArray(setCookie) ? setCookie : splitCookiesString(setCookie); for (const cookieString of cookieStrings) { const parsed = parseSetCookie(cookieString); if (parsed) diff --git a/packages/next/src/compiled/@edge-runtime/cookies/package.json b/packages/next/src/compiled/@edge-runtime/cookies/package.json index db2b1b50104b0..e3b8088040316 100644 --- a/packages/next/src/compiled/@edge-runtime/cookies/package.json +++ b/packages/next/src/compiled/@edge-runtime/cookies/package.json @@ -1 +1 @@ -{"name":"@edge-runtime/cookies","version":"4.0.1","main":"./index.js","license":"MPL-2.0"} +{"name":"@edge-runtime/cookies","version":"4.0.2","main":"./index.js","license":"MPL-2.0"} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 60eb7288909b9..c331fece485c0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -896,8 +896,8 @@ importers: specifier: 1.1.0 version: 1.1.0 '@edge-runtime/cookies': - specifier: 4.0.1 - version: 4.0.1 + specifier: 4.0.2 + version: 4.0.2 '@edge-runtime/ponyfill': specifier: 2.4.1 version: 2.4.1 @@ -3448,8 +3448,8 @@ packages: resolution: {integrity: sha512-smLocSfrt3s53H/XSVP3/1kP42oqvrkjUPtyaFd1F79ux24oE31BKt+q0c6lsa6hOYrFzsIwyc5GXAI5JmfOew==} dev: true - /@edge-runtime/cookies@4.0.1: - resolution: {integrity: sha512-QIZ1lz6rAF8rTrFdGkljedUaZpXbGIWmRdbA+kwm15ddFfryyekYwI3luFKB33KDcXRHrBi6WdMuyQN19CS6pg==} + /@edge-runtime/cookies@4.0.2: + resolution: {integrity: sha512-BphVamVz/yt9FN1b60ZXp+iTJVRLUHI0POxKYZG3gn+RsP+M0phqS87Z9JnDn2YOsPx9SRhhrN9AB7yhpexNEw==} engines: {node: '>=16'} dev: true From 0a7dd4ac8a09db6d6c6b18b9252546549d4dd5e0 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Fri, 20 Oct 2023 07:42:07 -0700 Subject: [PATCH 07/23] Remove warning messages (#57087) We no longer need these for the next major. --- packages/next/src/server/config.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/packages/next/src/server/config.ts b/packages/next/src/server/config.ts index a357a685486ec..aa55b453b60f1 100644 --- a/packages/next/src/server/config.ts +++ b/packages/next/src/server/config.ts @@ -406,20 +406,6 @@ function assignDefaults( } } - // TODO: Remove this warning in Next.js 14 - warnOptionHasBeenDeprecated( - result, - 'experimental.appDir', - 'App router is available by default now, `experimental.appDir` option can be safely removed.', - silent - ) - // TODO: Remove this warning in Next.js 14 - warnOptionHasBeenDeprecated( - result, - 'experimental.runtime', - 'You are using `experimental.runtime` which was removed. Check https://nextjs.org/docs/api-routes/edge-api-routes on how to use edge runtime.', - silent - ) warnOptionHasBeenMovedOutOfExperimental( result, 'relay', From c84f5ed794217009410d22373098075b6e38cdf5 Mon Sep 17 00:00:00 2001 From: berlysia Date: Sat, 21 Oct 2023 02:10:53 +0900 Subject: [PATCH 08/23] Add retry for fetching subsetted Google Fonts (#56583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What? Add the same re-retrieval process for subseted font files of Google Font as for CSS files. + make use of [async-retry](https://github.com/vercel/async-retry) ### Why? It was reported in #45080 that Japanese fonts such as Noto Sans JP were frequently `Failed to fetch`. A retry process was added in #51890, but it did not resolve the issue completely ( https://github.com/vercel/next.js/pull/51890#issuecomment-1614558064 ). Here is my reproduction code with 13.5.5-canary.4 (please run locally). https://stackblitz.com/edit/stackblitz-starters-n8zxlq?file=app%2Fpage.tsx
And my local error log is here(folded) ``` $ npm run -- dev > nextjs@0.1.0 dev > next dev ⚠ Port 3000 is in use, trying 3001 instead. ▲ Next.js 13.5.5-canary.4 - Local: http://localhost:3001 ✓ Ready in 23.9s ○ Compiling /page ... FetchError: request to https://fonts.gstatic.com/s/notosansjp/v52/-F6jfjtqLzI2JPCgQBnw7HFyzSD-AsregP8VFBEj757Y0rw_qMHVdbR2L8Y9QTJ1LwkRmR5GprQAe69m.4.woff2 failed, reason: at ClientRequest. (/mnt/c/Users/berlysia/Downloads/stackblitz-starters-n8zxlq/node_modules/next/dist/compiled/node-fetch/index.js:1:65756) at ClientRequest.emit (node:events:514:28) at TLSSocket.socketErrorListener (node:_http_client:495:9) at TLSSocket.emit (node:events:514:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { type: 'system', errno: 'ETIMEDOUT', code: 'ETIMEDOUT' } ⨯ Failed to download `Noto Sans JP` from Google Fonts. Using fallback font instead. Failed to fetch `Noto Sans JP` from Google Fonts.} FetchError: request to https://fonts.gstatic.com/s/notosansjp/v52/-F6jfjtqLzI2JPCgQBnw7HFyzSD-AsregP8VFBEj757Y0rw_qMHVdbR2L8Y9QTJ1LwkRmR5GprQAe69m.28.woff2 failed, reason: at ClientRequest. (/mnt/c/Users/berlysia/Downloads/stackblitz-starters-n8zxlq/node_modules/next/dist/compiled/node-fetch/index.js:1:65756) at ClientRequest.emit (node:events:514:28) at TLSSocket.socketErrorListener (node:_http_client:495:9) at TLSSocket.emit (node:events:514:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at processTicksAndRejections (node:internal/process/task_queues:82:21) at runNextTicks (node:internal/process/task_queues:64:3) at listOnTimeout (node:internal/timers:540:9) at process.processTimers (node:internal/timers:514:7) { type: 'system', errno: 'ETIMEDOUT', code: 'ETIMEDOUT' } ...(15 errors emitted) ```
I've found that the issue is not limited to fetching CSS, fetching subset font files is also failing. By adding retry handling to the fetch of individual subseted font files as well, I (almost) never see `Failed to fetch` anymore. The issue tends to become more apparent when downloading a larger number of subsetted fonts. This suggests that the problem is more likely to occur with larger fonts, such as those designed for CJK languages. ### How? Add the same re-retrieval process for subseted font files of Google Font as for CSS files. Related to #51890 #53239 #45080 #53279 --- packages/font/package.json | 2 ++ .../src/google/fetch-css-from-google-fonts.ts | 17 +------------ packages/font/src/google/fetch-font-file.ts | 25 +++++++++++-------- packages/font/src/google/retry.ts | 17 +++++++++++++ pnpm-lock.yaml | 14 ++++++++++- 5 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 packages/font/src/google/retry.ts diff --git a/packages/font/package.json b/packages/font/package.json index 38d1242e7c76f..b5fa92a48dfa7 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -20,8 +20,10 @@ "ncc-fontkit": "ncc build ./fontkit.js -o dist/fontkit" }, "devDependencies": { + "@types/async-retry": "1.4.2", "@types/fontkit": "2.0.0", "@vercel/ncc": "0.34.0", + "async-retry": "1.3.3", "fontkit": "2.0.2" } } diff --git a/packages/font/src/google/fetch-css-from-google-fonts.ts b/packages/font/src/google/fetch-css-from-google-fonts.ts index 5c6fedf21349c..386357e793d2b 100644 --- a/packages/font/src/google/fetch-css-from-google-fonts.ts +++ b/packages/font/src/google/fetch-css-from-google-fonts.ts @@ -2,22 +2,7 @@ import fetch from 'next/dist/compiled/node-fetch' import { nextFontError } from '../next-font-error' import { getProxyAgent } from './get-proxy-agent' - -async function retry(fn: () => Promise, attempts: number): Promise { - let cnt = attempts - while (true) { - try { - return await fn() - } catch (err) { - cnt-- - if (cnt <= 0) throw err - console.error( - (err as Error).message + `\n\nRetrying ${attempts - cnt}/3...` - ) - await new Promise((resolve) => setTimeout(resolve, 100)) - } - } -} +import { retry } from './retry' /** * Fetches the CSS containing the @font-face declarations from Google Fonts. diff --git a/packages/font/src/google/fetch-font-file.ts b/packages/font/src/google/fetch-font-file.ts index c399a993f6878..22080bda32993 100644 --- a/packages/font/src/google/fetch-font-file.ts +++ b/packages/font/src/google/fetch-font-file.ts @@ -1,6 +1,7 @@ // @ts-ignore import fetch from 'next/dist/compiled/node-fetch' import { getProxyAgent } from './get-proxy-agent' +import { retry } from './retry' /** * Fetch the url and return a buffer with the font file. @@ -16,16 +17,18 @@ export async function fetchFontFile(url: string, isDev: boolean) { return Buffer.from(url) } - const controller = new AbortController() - const timeoutId = setTimeout(() => controller.abort(), 3000) - const arrayBuffer = await fetch(url, { - agent: getProxyAgent(), - // Add a timeout in dev - signal: isDev ? controller.signal : undefined, - }) - .then((r: any) => r.arrayBuffer()) - .finally(() => { - clearTimeout(timeoutId) + return await retry(async () => { + const controller = new AbortController() + const timeoutId = setTimeout(() => controller.abort(), 3000) + const arrayBuffer = await fetch(url, { + agent: getProxyAgent(), + // Add a timeout in dev + signal: isDev ? controller.signal : undefined, }) - return Buffer.from(arrayBuffer) + .then((r: any) => r.arrayBuffer()) + .finally(() => { + clearTimeout(timeoutId) + }) + return Buffer.from(arrayBuffer) + }, 3) } diff --git a/packages/font/src/google/retry.ts b/packages/font/src/google/retry.ts new file mode 100644 index 0000000000000..555f95b34b150 --- /dev/null +++ b/packages/font/src/google/retry.ts @@ -0,0 +1,17 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import asyncRetry from 'async-retry' + +export async function retry( + fn: asyncRetry.RetryFunction, + retries: number +) { + return await asyncRetry(fn, { + retries, + onRetry(e, attempt) { + console.error( + (e as Error).message + `\n\nRetrying ${attempt}/${retries}...` + ) + }, + minTimeout: 100, + }) +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c331fece485c0..9ab079b163498 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -786,12 +786,18 @@ importers: packages/font: devDependencies: + '@types/async-retry': + specifier: 1.4.2 + version: 1.4.2 '@types/fontkit': specifier: 2.0.0 version: 2.0.0 '@vercel/ncc': specifier: 0.34.0 version: 0.34.0 + async-retry: + specifier: 1.3.3 + version: 1.3.3 fontkit: specifier: 2.0.2 version: 2.0.2 @@ -7958,6 +7964,12 @@ packages: retry: 0.12.0 dev: true + /async-retry@1.3.3: + resolution: {integrity: sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==} + dependencies: + retry: 0.13.1 + dev: true + /async-sema@3.0.0: resolution: {integrity: sha512-zyCMBDl4m71feawrxYcVbHxv/UUkqm4nKJiLu3+l9lfiQha6jQ/9dxhrXLnzzBXVFqCTDwiUkZOz9XFbdEGQsg==} dev: true @@ -21426,7 +21438,7 @@ packages: dev: true /retry@0.12.0: - resolution: {integrity: sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=} + resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} engines: {node: '>= 4'} dev: true From 2b60475c2b8145fe0d40b235e4045cbd17eb8445 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Fri, 20 Oct 2023 17:19:41 +0000 Subject: [PATCH 09/23] v13.5.7-canary.12 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-dev-overlay/package.json | 2 +- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 16 ++++++++-------- 18 files changed, 33 insertions(+), 33 deletions(-) diff --git a/lerna.json b/lerna.json index 1ea5ef7fd9550..69200f9f4241f 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "13.5.7-canary.11" + "version": "13.5.7-canary.12" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index f75174273df27..c0b73ee07dcfd 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 1a368cc9dde1b..57d1249361e2c 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "13.5.7-canary.11", + "@next/eslint-plugin-next": "13.5.7-canary.12", "@rushstack/eslint-patch": "^1.3.3", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0", "eslint-import-resolver-node": "^0.3.6", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 374b7d40e0d6d..357c59c097a40 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index b5fa92a48dfa7..5bb28709232ad 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,6 +1,6 @@ { "name": "@next/font", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index eed20f495c252..bef7fe11c142d 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 3c97152c83aed..989dab1c737f1 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 8e131efa404de..077a9526707de 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 090aa32fb6b35..3766ca1d78b07 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 5d3507fffca74..9bf86717dfbe2 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index 23752c9f379a9..4826621472cc0 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index 30806c69eb6e7..9b0fce616917e 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 6c0a75032fabf..8d2e8ad92b6fa 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index a31097d947f0b..2647c8ac8e665 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -92,7 +92,7 @@ ] }, "dependencies": { - "@next/env": "13.5.7-canary.11", + "@next/env": "13.5.7-canary.12", "@swc/helpers": "0.5.2", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", @@ -146,11 +146,11 @@ "@mswjs/interceptors": "0.23.0", "@napi-rs/cli": "2.16.2", "@napi-rs/triples": "1.1.0", - "@next/polyfill-module": "13.5.7-canary.11", - "@next/polyfill-nomodule": "13.5.7-canary.11", - "@next/react-dev-overlay": "13.5.7-canary.11", - "@next/react-refresh-utils": "13.5.7-canary.11", - "@next/swc": "13.5.7-canary.11", + "@next/polyfill-module": "13.5.7-canary.12", + "@next/polyfill-nomodule": "13.5.7-canary.12", + "@next/react-dev-overlay": "13.5.7-canary.12", + "@next/react-refresh-utils": "13.5.7-canary.12", + "@next/swc": "13.5.7-canary.12", "@opentelemetry/api": "1.4.1", "@playwright/test": "^1.35.1", "@taskr/clear": "1.1.0", diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json index 4b35ec7c07915..16ec8cf820bc8 100644 --- a/packages/react-dev-overlay/package.json +++ b/packages/react-dev-overlay/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-dev-overlay", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "description": "A development-only overlay for developing React applications.", "repository": { "url": "vercel/next.js", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 77406c4609e29..a76592572e0c7 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index a5b0eb793cba5..50ba5f67d22c1 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "13.5.7-canary.11", + "version": "13.5.7-canary.12", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -22,7 +22,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "13.5.7-canary.11", + "next": "13.5.7-canary.12", "outdent": "0.8.0", "prettier": "2.5.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9ab079b163498..c8674a7f2a7f4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -738,7 +738,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 13.5.7-canary.11 + specifier: 13.5.7-canary.12 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.3.3 @@ -805,7 +805,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 13.5.7-canary.11 + specifier: 13.5.7-canary.12 version: link:../next-env '@swc/helpers': specifier: 0.5.2 @@ -929,19 +929,19 @@ importers: specifier: 1.1.0 version: 1.1.0 '@next/polyfill-module': - specifier: 13.5.7-canary.11 + specifier: 13.5.7-canary.12 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 13.5.7-canary.11 + specifier: 13.5.7-canary.12 version: link:../next-polyfill-nomodule '@next/react-dev-overlay': - specifier: 13.5.7-canary.11 + specifier: 13.5.7-canary.12 version: link:../react-dev-overlay '@next/react-refresh-utils': - specifier: 13.5.7-canary.11 + specifier: 13.5.7-canary.12 version: link:../react-refresh-utils '@next/swc': - specifier: 13.5.7-canary.11 + specifier: 13.5.7-canary.12 version: link:../next-swc '@opentelemetry/api': specifier: 1.4.1 @@ -1592,7 +1592,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 13.5.7-canary.11 + specifier: 13.5.7-canary.12 version: link:../next outdent: specifier: 0.8.0 From 920a7e8ba6d029042e73df94c0041ee206639dbe Mon Sep 17 00:00:00 2001 From: Josh Story Date: Fri, 20 Oct 2023 10:42:27 -0700 Subject: [PATCH 10/23] Update React from a41957507 to d803f519e (#57015) ## React upstream Changes - https://github.com/facebook/react/pull/27542 - https://github.com/facebook/react/pull/27551 - https://github.com/facebook/react/pull/27537 - https://github.com/facebook/react/pull/27549 - https://github.com/facebook/react/pull/27544 - https://github.com/facebook/react/pull/27543 - https://github.com/facebook/react/pull/27541 - https://github.com/facebook/react/pull/27538 - https://github.com/facebook/react/pull/27536 --- package.json | 20 +- ...t-dom-server-legacy.browser.development.js | 21 +- ...om-server-legacy.browser.production.min.js | 4 +- ...eact-dom-server-legacy.node.development.js | 21 +- ...t-dom-server-legacy.node.production.min.js | 4 +- ...t-dom-server-rendering-stub.development.js | 2 +- ...om-server-rendering-stub.production.min.js | 2 +- .../react-dom-server.browser.development.js | 24 +- ...react-dom-server.browser.production.min.js | 78 ++-- .../cjs/react-dom-server.edge.development.js | 24 +- .../react-dom-server.edge.production.min.js | 84 ++--- .../cjs/react-dom-server.node.development.js | 18 +- .../react-dom-server.node.production.min.js | 6 +- .../react-dom-unstable_testing.development.js | 2 +- ...act-dom-unstable_testing.production.min.js | 6 +- .../cjs/react-dom.development.js | 2 +- .../cjs/react-dom.production.min.js | 6 +- .../cjs/react-dom.profiling.min.js | 6 +- .../react-dom-experimental/package.json | 4 +- ...t-dom-server-legacy.browser.development.js | 21 +- ...om-server-legacy.browser.production.min.js | 4 +- ...eact-dom-server-legacy.node.development.js | 21 +- ...t-dom-server-legacy.node.production.min.js | 6 +- ...t-dom-server-rendering-stub.development.js | 2 +- ...om-server-rendering-stub.production.min.js | 2 +- .../react-dom-server.browser.development.js | 20 +- ...react-dom-server.browser.production.min.js | 8 +- .../cjs/react-dom-server.edge.development.js | 20 +- .../react-dom-server.edge.production.min.js | 8 +- .../cjs/react-dom-server.node.development.js | 18 +- .../react-dom-server.node.production.min.js | 6 +- .../react-dom/cjs/react-dom.development.js | 2 +- .../react-dom/cjs/react-dom.production.min.js | 6 +- .../react-dom/cjs/react-dom.profiling.min.js | 6 +- .../next/src/compiled/react-dom/package.json | 4 +- .../cjs/react.development.js | 2 +- .../cjs/react.production.min.js | 2 +- .../cjs/react.shared-subset.development.js | 2 +- .../cjs/react.shared-subset.production.min.js | 2 +- ...om-turbopack-client.browser.development.js | 37 +- ...turbopack-client.browser.production.min.js | 33 +- ...r-dom-turbopack-client.edge.development.js | 46 ++- ...om-turbopack-client.edge.production.min.js | 48 +-- ...r-dom-turbopack-client.node.development.js | 37 +- ...om-turbopack-client.node.production.min.js | 21 +- ...opack-client.node.unbundled.development.js | 37 +- ...ck-client.node.unbundled.production.min.js | 62 ++-- ...om-turbopack-server.browser.development.js | 217 ++++++++--- ...turbopack-server.browser.production.min.js | 116 +++--- ...r-dom-turbopack-server.edge.development.js | 217 ++++++++--- ...om-turbopack-server.edge.production.min.js | 120 ++++--- ...r-dom-turbopack-server.node.development.js | 217 ++++++++--- ...om-turbopack-server.node.production.min.js | 114 +++--- ...opack-server.node.unbundled.development.js | 217 ++++++++--- ...ck-server.node.unbundled.production.min.js | 112 +++--- .../package.json | 4 +- ...om-turbopack-client.browser.development.js | 37 +- ...turbopack-client.browser.production.min.js | 43 +-- ...r-dom-turbopack-client.edge.development.js | 46 ++- ...om-turbopack-client.edge.production.min.js | 56 +-- ...r-dom-turbopack-client.node.development.js | 37 +- ...om-turbopack-client.node.production.min.js | 11 +- ...opack-client.node.unbundled.development.js | 37 +- ...ck-client.node.unbundled.production.min.js | 13 +- ...om-turbopack-server.browser.development.js | 339 +++++++----------- ...turbopack-server.browser.production.min.js | 125 +++---- ...r-dom-turbopack-server.edge.development.js | 339 +++++++----------- ...om-turbopack-server.edge.production.min.js | 125 +++---- ...r-dom-turbopack-server.node.development.js | 339 +++++++----------- ...om-turbopack-server.node.production.min.js | 139 +++---- ...opack-server.node.unbundled.development.js | 339 +++++++----------- ...ck-server.node.unbundled.production.min.js | 133 +++---- .../react-server-dom-turbopack/package.json | 4 +- ...-dom-webpack-client.browser.development.js | 37 +- ...m-webpack-client.browser.production.min.js | 33 +- ...ver-dom-webpack-client.edge.development.js | 46 ++- ...-dom-webpack-client.edge.production.min.js | 48 +-- ...ver-dom-webpack-client.node.development.js | 37 +- ...-dom-webpack-client.node.production.min.js | 21 +- ...bpack-client.node.unbundled.development.js | 37 +- ...ck-client.node.unbundled.production.min.js | 62 ++-- ...-dom-webpack-server.browser.development.js | 217 ++++++++--- ...m-webpack-server.browser.production.min.js | 118 +++--- ...ver-dom-webpack-server.edge.development.js | 217 ++++++++--- ...-dom-webpack-server.edge.production.min.js | 120 ++++--- ...ver-dom-webpack-server.node.development.js | 217 ++++++++--- ...-dom-webpack-server.node.production.min.js | 112 +++--- ...bpack-server.node.unbundled.development.js | 217 ++++++++--- ...ck-server.node.unbundled.production.min.js | 110 +++--- .../package.json | 4 +- ...-dom-webpack-client.browser.development.js | 37 +- ...m-webpack-client.browser.production.min.js | 43 +-- ...ver-dom-webpack-client.edge.development.js | 46 ++- ...-dom-webpack-client.edge.production.min.js | 56 +-- ...ver-dom-webpack-client.node.development.js | 37 +- ...-dom-webpack-client.node.production.min.js | 11 +- ...bpack-client.node.unbundled.development.js | 37 +- ...ck-client.node.unbundled.production.min.js | 13 +- ...-dom-webpack-server.browser.development.js | 339 +++++++----------- ...m-webpack-server.browser.production.min.js | 127 +++---- ...ver-dom-webpack-server.edge.development.js | 339 +++++++----------- ...-dom-webpack-server.edge.production.min.js | 127 +++---- ...ver-dom-webpack-server.node.development.js | 339 +++++++----------- ...-dom-webpack-server.node.production.min.js | 143 ++++---- ...bpack-server.node.unbundled.development.js | 339 +++++++----------- ...ck-server.node.unbundled.production.min.js | 137 +++---- .../react-server-dom-webpack/package.json | 4 +- .../compiled/react/cjs/react.development.js | 2 +- .../react/cjs/react.production.min.js | 2 +- .../cjs/react.shared-subset.development.js | 2 +- .../cjs/react.shared-subset.production.min.js | 2 +- pnpm-lock.yaml | 104 +++--- 112 files changed, 4499 insertions(+), 3753 deletions(-) diff --git a/package.json b/package.json index 53f56641fbdcc..71f8a7e73a484 100644 --- a/package.json +++ b/package.json @@ -194,16 +194,16 @@ "random-seed": "0.3.0", "react": "18.2.0", "react-17": "npm:react@17.0.2", - "react-builtin": "npm:react@18.3.0-canary-a41957507-20231017", + "react-builtin": "npm:react@18.3.0-canary-d803f519e-20231020", "react-dom": "18.2.0", "react-dom-17": "npm:react-dom@17.0.2", - "react-dom-builtin": "npm:react-dom@18.3.0-canary-a41957507-20231017", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-a41957507-20231017", - "react-experimental-builtin": "npm:react@0.0.0-experimental-a41957507-20231017", - "react-server-dom-turbopack": "18.3.0-canary-a41957507-20231017", - "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-a41957507-20231017", - "react-server-dom-webpack": "18.3.0-canary-a41957507-20231017", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-a41957507-20231017", + "react-dom-builtin": "npm:react-dom@18.3.0-canary-d803f519e-20231020", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-d803f519e-20231020", + "react-experimental-builtin": "npm:react@0.0.0-experimental-d803f519e-20231020", + "react-server-dom-turbopack": "18.3.0-canary-d803f519e-20231020", + "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-d803f519e-20231020", + "react-server-dom-webpack": "18.3.0-canary-d803f519e-20231020", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-d803f519e-20231020", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -213,8 +213,8 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.10.6", - "scheduler-builtin": "npm:scheduler@0.24.0-canary-a41957507-20231017", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-a41957507-20231017", + "scheduler-builtin": "npm:scheduler@0.24.0-canary-d803f519e-20231020", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-d803f519e-20231020", "seedrandom": "3.0.5", "selenium-webdriver": "4.0.0-beta.4", "semver": "7.3.7", diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js index 0fa29c5711881..d931cac2fd243 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") { var React = require("next/dist/compiled/react-experimental"); var ReactDOM = require('react-dom'); -var ReactVersion = '18.3.0-experimental-a41957507-20231017'; +var ReactVersion = '18.3.0-experimental-d803f519e-20231020'; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; @@ -11256,7 +11256,10 @@ function flushCompletedQueues(request, destination) { } // We're done. - close(destination); + close(destination); // We need to stop flowing now because we do not want any async contexts which might call + // float methods to initiate any flushes after this point + + stopFlowing(request); } } } @@ -11276,10 +11279,17 @@ function enqueueFlush(request) { request.pingedTasks.length === 0 && // If there is no destination there is nothing we can flush to. A flush will // happen when we start flowing again request.destination !== null) { - var destination = request.destination; request.flushScheduled = true; scheduleWork(function () { - return flushCompletedQueues(request, destination); + // We need to existence check destination again here because it might go away + // in between the enqueueFlush call and the work execution + var destination = request.destination; + + if (destination) { + flushCompletedQueues(request, destination); + } else { + request.flushScheduled = false; + } }); } } @@ -11309,6 +11319,9 @@ function startFlowing(request, destination) { fatalError(request, error); } } +function stopFlowing(request) { + request.destination = null; +} // This is called to early terminate a request. It puts all pending boundaries in client rendered state. function abort(request, reason) { try { diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js index 2c549a83c8060..2f966742637a4 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js @@ -188,8 +188,8 @@ b);q.highImagePreloads.clear();q.styles.forEach(lc,b);q.scripts.forEach(K,b);q.s ba?(q.push(V.startInlineScript),0===(A.instructions&4)?(A.instructions|=4,q.push('$RX=function(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};;$RX("')):q.push('$RX("')):q.push('')){a.destination=null;c++;O.splice(0,c);return}}O.splice(0,c);var W=a.completedBoundaries;for(c=0;c")),a.hasHtml&&(b.push(""))),b.push(null))}}function oc(a){if(!1===a.flushScheduled&&0===a.pingedTasks.length&&null!==a.destination){var b=a.destination;a.flushScheduled=!0;Oe(a,b)}} +0===a.clientRenderedBoundaries.length&&0===a.completedBoundaries.length&&(a.flushScheduled=!1,null===a.trackedPostpones&&(c=a.resumableState,c.hasBody&&(b.push("")),c.hasHtml&&(b.push(""))),b.push(null),a.destination=null)}}function oc(a){if(!1===a.flushScheduled&&0===a.pingedTasks.length&&null!==a.destination){a.flushScheduled=!0;var b=a.destination;b?Oe(a,b):a.flushScheduled=!1}} function Ue(a,b){try{var c=a.abortableTasks;if(0"):!p.push('">')){a.destination=null;c++;N.splice(0,c);return}}N.splice(0,c);var V=a.completedBoundaries;for(c=0;c")),a.hasHtml&&(b.push(""))),b.push(null))}}function pc(a){if(!1===a.flushScheduled&&0===a.pingedTasks.length&&null!==a.destination){var b=a.destination;a.flushScheduled=!0;Pe(a,b)}} +0===a.clientRenderedBoundaries.length&&0===a.completedBoundaries.length&&(a.flushScheduled=!1,null===a.trackedPostpones&&(c=a.resumableState,c.hasBody&&(b.push("")),c.hasHtml&&(b.push(""))),b.push(null),a.destination=null)}}function pc(a){if(!1===a.flushScheduled&&0===a.pingedTasks.length&&null!==a.destination){a.flushScheduled=!0;var b=a.destination;b?Pe(a,b):a.flushScheduled=!1}} function Ve(a,b){if(1===a.status)a.status=2,b.destroy(a.fatalError);else if(2!==a.status&&null===a.destination){a.destination=b;try{Pe(a,b)}catch(c){W(a,c),Ae(a,c)}}}function We(a,b){try{var c=a.abortableTasks;if(0'),cb=A("