From b8ae8d210ad9953f3f481ded56cbcb4a01bf495a Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 4 Jul 2023 09:40:50 +0200 Subject: [PATCH 01/28] update tests list to include all passing tests (#52026) ### What? Add all passing tests ### Why? We enforced that they all run turbopack and these are passing. If any of these tests would become red, that indicated a problem. --- .github/workflows/build_and_test.yml | 15 ++ .../crates/next-dev-tests/tests-manifest.js | 194 ++++++------------ 2 files changed, 83 insertions(+), 126 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index bd4616a55247d..38533b20a62fc 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -122,6 +122,21 @@ jobs: afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/packages/next-swc/crates/next-dev-tests/tests-manifest.js" TURBOPACK=1 __INTERNAL_CUSTOM_TURBOPACK_BINDINGS="$(pwd)/packages/next-swc/native/next-swc.linux-x64-gnu.node" NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev node run-tests.js --type development --timings -c ${TEST_CONCURRENCY} secrets: inherit + test-turbopack-integration: + name: test turbopack integration + needs: ['build-native', 'build-next'] + strategy: + fail-fast: false + matrix: + group: [1, 2, 3, 4, 5, 6] + + uses: ./.github/workflows/build_reusable.yml + with: + nodeVersion: 16 + skipForDocsOnly: 'yes' + afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/packages/next-swc/crates/next-dev-tests/tests-manifest.js" TURBOPACK=1 __INTERNAL_CUSTOM_TURBOPACK_BINDINGS="$(pwd)/packages/next-swc/native/next-swc.linux-x64-gnu.node" node run-tests.js --timings -g ${{ matrix.group }}/6 -c ${TEST_CONCURRENCY} --test-pattern '^(integration)/.*\.test\.(js|jsx|ts|tsx)$' + secrets: inherit + test-next-swc-wasm: name: test next-swc wasm needs: ['build-native', 'build-next'] diff --git a/packages/next-swc/crates/next-dev-tests/tests-manifest.js b/packages/next-swc/crates/next-dev-tests/tests-manifest.js index 30828b5cc76be..a43e51a1effdb 100644 --- a/packages/next-swc/crates/next-dev-tests/tests-manifest.js +++ b/packages/next-swc/crates/next-dev-tests/tests-manifest.js @@ -2,10 +2,12 @@ // Only tests that are actively testing against Turbopack should // be enabled here const enabledTests = [ + 'test/development/acceptance-app/ReactRefresh.test.ts', 'test/development/acceptance-app/ReactRefreshLogBoxMisc.test.ts', 'test/development/acceptance-app/ReactRefreshRequire.test.ts', + 'test/development/acceptance-app/app-hmr-changes.test.ts', 'test/development/acceptance-app/dynamic-error.test.ts', - // 'test/development/acceptance/ReactRefresh.test.ts', + 'test/development/acceptance-app/version-staleness.test.ts', 'test/development/acceptance/ReactRefreshLogBox-scss.test.ts', 'test/development/acceptance/ReactRefreshLogBoxMisc.test.ts', 'test/development/api-cors-with-rewrite/index.test.ts', @@ -14,6 +16,7 @@ const enabledTests = [ 'test/development/basic/define-class-fields.test.ts', 'test/development/basic/emotion-swc.test.ts', 'test/development/basic/legacy-decorators.test.ts', + 'test/development/basic/project-directory-rename.test.ts', 'test/development/basic/tailwind-jit.test.ts', 'test/development/basic/theme-ui.test.ts', 'test/development/dotenv-default-expansion/index.test.ts', @@ -23,29 +26,26 @@ const enabledTests = [ 'test/development/repeated-dev-edits/repeated-dev-edits.test.ts', 'test/development/tsconfig-path-reloading/index.test.ts', 'test/e2e/app-dir/_allow-underscored-root-directory/_allow-underscored-root-directory.test.ts', - 'test/e2e/app-dir/actions/app-action-export.test.ts', + 'test/e2e/app-dir/actions/app-action-invalid.test.ts', + 'test/e2e/app-dir/actions/app-action-size-limit-invalid.test.ts', 'test/e2e/app-dir/app-alias/app-alias.test.ts', 'test/e2e/app-dir/app-client-cache/client-cache.test.ts', 'test/e2e/app-dir/app-css-pageextensions/index.test.ts', - 'test/e2e/app-dir/app-external/app-external.test.ts', + 'test/e2e/app-dir/app-edge-root-layout/index.test.ts', + 'test/e2e/app-dir/app-edge/app-edge.test.ts', + 'test/e2e/app-dir/app-prefetch-false/app-prefetch-false.test.ts', 'test/e2e/app-dir/app-prefetch/prefetching.test.ts', 'test/e2e/app-dir/app-validation/validation.test.ts', - 'test/e2e/app-dir/app/standalone.test.ts', - 'test/e2e/app-dir/app/useReportWebVitals.test.ts', - 'test/e2e/app-dir/app/vercel-speed-insights.test.ts', 'test/e2e/app-dir/asset-prefix/asset-prefix.test.ts', 'test/e2e/app-dir/async-component-preload/async-component-preload.test.ts', 'test/e2e/app-dir/autoscroll-with-css-modules/index.test.ts', 'test/e2e/app-dir/back-button-download-bug/back-button-download-bug.test.ts', - 'test/e2e/app-dir/dynamic/dynamic.test.ts', + 'test/e2e/app-dir/build-size/index.test.ts', 'test/e2e/app-dir/global-error/global-error.test.ts', + 'test/e2e/app-dir/hello-world/hello-world.test.ts', 'test/e2e/app-dir/import/import.test.ts', - 'test/e2e/app-dir/interpolability-with-pages/navigation.test.ts', 'test/e2e/app-dir/layout-params/layout-params.test.ts', - 'test/e2e/app-dir/metadata-missing-metadata-base/index.test.ts', 'test/e2e/app-dir/metadata-suspense/index.test.ts', - 'test/e2e/app-dir/navigation/navigation.test.ts', - 'test/e2e/app-dir/not-found/not-found.test.ts', 'test/e2e/app-dir/rewrites-redirects/rewrites-redirects.test.ts', 'test/e2e/app-dir/route-page-manifest-bug/route-page-manifest-bug.test.ts', 'test/e2e/app-dir/router-autoscroll/router-autoscroll.test.ts', @@ -53,217 +53,159 @@ const enabledTests = [ 'test/e2e/app-dir/rsc-basic/rsc-basic.test.ts', 'test/e2e/app-dir/search-params-react-key/layout-params.test.ts', 'test/e2e/app-dir/searchparams-static-bailout/searchparams-static-bailout.test.ts', - 'test/e2e/app-dir/similar-pages-paths/similar-pages-paths.test.ts', 'test/e2e/app-dir/test-template/{{ toFileName name }}/{{ toFileName name }}.test.ts', - 'test/e2e/app-dir/underscore-ignore-app-paths/underscore-ignore-app-paths.test.ts', - 'test/e2e/app-dir/use-params/use-params.test.ts', 'test/e2e/app-dir/use-selected-layout-segment-s/use-selected-layout-segment-s.test.ts', 'test/e2e/browserslist-extends/index.test.ts', 'test/e2e/config-promise-export/async-function.test.ts', 'test/e2e/config-promise-export/promise.test.ts', + 'test/e2e/conflicting-app-page-error/index.test.ts', 'test/e2e/disable-js-preload/test/index.test.js', - 'test/e2e/dynamic-route-interpolation/index.test.ts', - 'test/e2e/edge-api-endpoints-can-receive-body/index.test.ts', - 'test/e2e/edge-async-local-storage/index.test.ts', - 'test/e2e/edge-compiler-module-exports-preference/index.test.ts', - 'test/e2e/edge-runtime-uses-edge-light-import-specifier-for-packages/edge-runtime-uses-edge-light-import-specifier-for-packages.test.ts', - 'test/e2e/handle-non-hoisted-swc-helpers/index.test.ts', - 'test/e2e/ignore-invalid-popstateevent/without-i18n.test.ts', + 'test/e2e/hello-world/hello-world.test.ts', + 'test/e2e/i18n-api-support/index.test.ts', + 'test/e2e/i18n-disallow-multiple-locales/i18n-disallow-multiple-locales.test.ts', + 'test/e2e/i18n-ignore-rewrite-source-locale/rewrites-with-basepath.test.ts', + 'test/e2e/i18n-ignore-rewrite-source-locale/rewrites.test.ts', 'test/e2e/link-with-api-rewrite/index.test.ts', - 'test/e2e/middleware-base-path/test/index.test.ts', - 'test/e2e/middleware-general/test/index.test.ts', - 'test/e2e/middleware-responses/test/index.test.ts', + 'test/e2e/middleware-fetches-with-body/index.test.ts', 'test/e2e/middleware-shallow-link/index.test.ts', - 'test/e2e/multi-zone/multi-zone.test.ts', 'test/e2e/new-link-behavior/child-a-tag-error.test.ts', 'test/e2e/new-link-behavior/index.test.ts', 'test/e2e/new-link-behavior/material-ui.test.ts', 'test/e2e/new-link-behavior/stitches.test.ts', 'test/e2e/new-link-behavior/typescript.test.ts', + 'test/e2e/next-head/index.test.ts', 'test/e2e/next-image-forward-ref/index.test.ts', 'test/e2e/no-eslint-warn-with-no-eslint-config/index.test.ts', 'test/e2e/nonce-head-manager/index.test.ts', - 'test/e2e/optimized-loading/test/index.test.ts', 'test/e2e/postcss-config-cjs/index.test.ts', - 'test/e2e/prerender-native-module.test.ts', 'test/e2e/proxy-request-with-middleware/test/index.test.ts', 'test/e2e/repeated-forward-slashes-error/repeated-forward-slashes-error.test.ts', - 'test/e2e/ssr-react-context/index.test.ts', 'test/e2e/styled-jsx/index.test.ts', + 'test/e2e/test-template/{{ toFileName name }}/{{ toFileName name }}.test.ts', 'test/e2e/test-utils-tests/basic/basic.test.ts', 'test/e2e/trailingslash-with-rewrite/index.test.ts', 'test/e2e/transpile-packages/index.test.ts', 'test/e2e/type-module-interop/index.test.ts', + 'test/e2e/typescript-version-no-warning/typescript-version-no-warning.test.ts', + 'test/e2e/typescript-version-warning/typescript-version-warning.test.ts', 'test/e2e/undici-fetch/index.test.ts', 'test/e2e/yarn-pnp/test/with-eslint.test.ts', - 'test/e2e/yarn-pnp/test/with-mdx.test.ts', 'test/e2e/yarn-pnp/test/with-next-sass.test.ts', - 'test/integration/404-page-app/test/index.test.js', 'test/integration/404-page-custom-error/test/index.test.js', - 'test/integration/404-page-ssg/test/index.test.js', - 'test/integration/absolute-assetprefix/test/index.test.js', 'test/integration/amp-export-validation/test/index.test.js', - 'test/integration/amphtml-custom-optimizer/test/index.test.js', 'test/integration/amphtml-custom-validator/test/index.test.js', 'test/integration/amphtml-fragment-style/test/index.test.js', 'test/integration/api-body-parser/test/index.test.js', 'test/integration/api-catch-all/test/index.test.js', 'test/integration/app-aspath/test/index.test.js', - 'test/integration/app-dir-export/test/config.test.ts', - 'test/integration/app-dir-export/test/dynamicapiroute-prod.test.ts', - 'test/integration/app-dir-export/test/dynamicpage-prod.test.ts', - 'test/integration/app-dir-export/test/start.test.ts', - 'test/integration/app-dir-export/test/trailing-slash-start.test.ts', - 'test/integration/app-document-style-fragment/test/index.test.js', - 'test/integration/app-dynamic-error/test/index.test.ts', + 'test/integration/app-config-asset-prefix/test/index.test.js', 'test/integration/app-functional/test/index.test.js', - 'test/integration/app-tree/test/index.test.js', - 'test/integration/app-types/app-types.test.js', - // TODO: should babel be tested with turbopack? - 'test/integration/babel-custom/test/index.test.js', + 'test/integration/auto-export-error-bail/test/index.test.js', + 'test/integration/auto-export-query-error/test/index.test.js', 'test/integration/bigint/test/index.test.js', 'test/integration/catches-missing-getStaticProps/test/index.test.js', - 'test/integration/chunking/test/index.test.js', - 'test/integration/client-404/test/index.test.js', + 'test/integration/clean-distdir/test/index.test.js', 'test/integration/client-navigation-a11y/test/index.test.js', - 'test/integration/client-shallow-routing/test/index.test.js', 'test/integration/config-experimental-warning/test/index.test.js', - 'test/integration/config-promise-error/test/index.test.js', - 'test/integration/config-resolve-alias/test/index.test.js', - 'test/integration/css-customization/test/index.test.js', - 'test/integration/css-features/test/index.test.js', - 'test/integration/css-minify/test/index.test.js', + 'test/integration/config-schema-check/test/index.test.js', + 'test/integration/config-syntax-error/test/index.test.js', + 'test/integration/config-validation/test/index.test.ts', + 'test/integration/conflicting-ssg-paths/test/index.test.js', + 'test/integration/create-next-app/index.test.ts', + 'test/integration/create-next-app/package-manager.test.ts', + 'test/integration/create-next-app/templates-app.test.ts', + 'test/integration/create-next-app/templates-pages.test.ts', + 'test/integration/css/test/dev-css-handling.test.js', 'test/integration/custom-error-page-exception/test/index.test.js', + 'test/integration/custom-server-types/test/index.test.js', + 'test/integration/custom-server/test/index.test.js', 'test/integration/dedupes-scripts/test/index.test.js', 'test/integration/development-hmr-refresh/test/index.test.js', 'test/integration/disable-js/test/index.test.js', - 'test/integration/document-file-dependencies/test/index.test.js', 'test/integration/document-head-warnings/test/index.test.js', 'test/integration/duplicate-pages/test/index.test.js', 'test/integration/dynamic-require/test/index.test.js', 'test/integration/dynamic-route-rename/test/index.test.js', 'test/integration/empty-object-getInitialProps/test/index.test.js', - 'test/integration/error-in-error/test/index.test.js', - 'test/integration/error-load-fail/test/index.test.js', - 'test/integration/error-plugin-stack-overflow/test/index.test.js', 'test/integration/errors-on-output-to-public/test/index.test.js', 'test/integration/errors-on-output-to-static/test/index.test.js', - 'test/integration/eslint/test/index.test.js', - 'test/integration/externalize-next-server/test/index.test.js', - 'test/integration/externals-esm-loose/test/index.test.js', - 'test/integration/externals-esm/test/index.test.js', + 'test/integration/eslint/test/lint-cache.test.js', + 'test/integration/eslint/test/next-lint.test.js', + 'test/integration/export-404/test/index.test.js', + 'test/integration/export-default-map/test/index.test.js', + 'test/integration/export-dynamic-pages/test/index.test.js', + 'test/integration/export-fallback-true-error/test/index.test.js', + 'test/integration/export-getInitialProps-warn/test/index.test.js', + 'test/integration/export-image-default/test/index.test.js', + 'test/integration/export-image-loader-legacy/test/index.test.js', + 'test/integration/export-index-not-found-gsp/test/index.test.ts', + 'test/integration/export-intent/test/index.test.js', + 'test/integration/export-no-build/test/index.test.js', + 'test/integration/export-progress-status-message/test/index.test.js', + 'test/integration/export-subfolders/test/index.test.js', 'test/integration/fallback-modules/test/index.test.js', - 'test/integration/fetch-polyfill-ky-universal/test/index.test.js', - 'test/integration/fetch-polyfill/test/index.test.js', 'test/integration/filesystempublicroutes/test/index.test.js', 'test/integration/firebase-grpc/test/index.test.js', - 'test/integration/font-optimization/test/index.test.js', 'test/integration/future/test/index.test.js', - 'test/integration/getserversideprops-export-error/test/index.test.js', - 'test/integration/gip-identifier/test/index.test.js', - 'test/integration/gsp-build-errors/test/index.test.js', 'test/integration/gsp-extension/test/index.test.js', - 'test/integration/gssp-pageProps-merge/test/index.test.js', 'test/integration/handles-export-errors/test/index.test.js', 'test/integration/hashbang/test/index.test.js', - 'test/integration/hydrate-then-render/test/index.test.js', - 'test/integration/hydration/test/index.test.js', - 'test/integration/image-generation/test/index.test.ts', - 'test/integration/image-optimizer/test/old-sharp.test.ts', 'test/integration/index-index/test/index.test.js', 'test/integration/initial-ref/test/index.test.js', 'test/integration/invalid-config-values/test/index.test.js', - 'test/integration/invalid-document-image-import/test/index.test.js', - 'test/integration/invalid-href/test/index.test.js', 'test/integration/invalid-page-automatic-static-optimization/test/index.test.js', 'test/integration/invalid-revalidate-values/test/index.test.js', 'test/integration/invalid-server-options/test/index.test.js', - 'test/integration/jsconfig-empty/test/index.test.js', - 'test/integration/jsconfig/test/index.test.js', 'test/integration/json-serialize-original-error/test/index.test.js', 'test/integration/legacy-ssg-methods-error/test/index.test.js', 'test/integration/link-ref/test/index.test.js', 'test/integration/link-with-multiple-child/test/index.test.js', 'test/integration/link-without-router/test/index.test.js', + 'test/integration/middleware-build-errors/test/index.test.js', 'test/integration/middleware-overrides-node.js-api/test/index.test.ts', - 'test/integration/middleware-prefetch/tests/index.test.js', - 'test/integration/middleware-src/test/index.test.js', 'test/integration/missing-document-component-error/test/index.test.js', - 'test/integration/mixed-ssg-serverprops-error/test/index.test.js', - 'test/integration/next-dynamic/test/index.test.js', - 'test/integration/next-image-legacy/basic/test/index.test.ts', 'test/integration/next-image-legacy/custom-resolver/test/index.test.ts', - 'test/integration/next-image-legacy/default/test/static.test.ts', 'test/integration/next-image-legacy/no-intersection-observer-fallback/test/index.test.ts', 'test/integration/next-image-legacy/noscript/test/index.test.ts', 'test/integration/next-image-legacy/react-virtualized/test/index.test.ts', + 'test/integration/next-image-legacy/unoptimized/test/index.test.ts', 'test/integration/next-image-new/react-virtualized/test/index.test.ts', + 'test/integration/next-image-new/unoptimized/test/index.test.ts', 'test/integration/no-op-export/test/index.test.js', - 'test/integration/no-page-props/test/index.test.js', 'test/integration/non-next-dist-exclude/test/index.test.js', 'test/integration/non-standard-node-env-warning/test/index.test.js', - 'test/integration/not-found-revalidate/test/index.test.js', - 'test/integration/numeric-sep/test/index.test.js', 'test/integration/ondemand/test/index.test.js', 'test/integration/optional-chaining-nullish-coalescing/test/index.test.js', - 'test/integration/page-config/test/index.test.js', - 'test/integration/page-extensions/test/index.test.js', 'test/integration/plugin-mdx-rs/test/index.test.js', - 'test/integration/polyfilling-minimal/test/index.test.js', - 'test/integration/polyfills/test/index.test.js', - 'test/integration/port-env-var/test/index.test.js', - 'test/integration/preload-viewport/test/index.test.js', 'test/integration/prerender-invalid-catchall-params/test/index.test.js', 'test/integration/prerender-invalid-paths/test/index.test.js', 'test/integration/prerender-legacy/test/index.test.js', - 'test/integration/prerender-no-revalidate/test/index.test.js', - 'test/integration/prerender-revalidate/test/index.test.js', - 'test/integration/production-browser-sourcemaps/test/index.test.js', 'test/integration/production-build-dir/test/index.test.js', - 'test/integration/production-config/test/index.test.js', - 'test/integration/production-nav/test/index.test.js', 'test/integration/production-start-no-build/test/index.test.js', - 'test/integration/production/test/index.test.js', - 'test/integration/query-with-encoding/test/index.test.js', - 'test/integration/re-export-all-exports-from-page-disallowed/test/index.test.js', - 'test/integration/react-profiling-mode/test/index.test.js', - 'test/integration/react-streaming/test/index.test.js', - 'test/integration/read-only-source-hmr/test/index.test.js', - 'test/integration/relay-analytics-disabled/test/index.test.js', - 'test/integration/relay-analytics/test/index.test.js', - 'test/integration/render-error-on-module-error/test/index.test.js', - 'test/integration/render-error-on-top-level-error/with-get-initial-props/test/index.test.js', - 'test/integration/render-error-on-top-level-error/without-get-initial-props/test/index.test.js', - 'test/integration/required-server-files-ssr-404/test/index.test.js', - 'test/integration/revalidate-as-path/test/index.test.js', - 'test/integration/rewrites-destination-query-array/test/index.test.js', - 'test/integration/root-optional-revalidate/test/index.test.js', - 'test/integration/route-indexes/test/index.test.js', - 'test/integration/route-load-cancel-css/test/index.test.js', - 'test/integration/route-load-cancel/test/index.test.js', 'test/integration/router-hash-navigation/test/index.test.js', - 'test/integration/router-is-ready-app-gip/test/index.test.js', - 'test/integration/router-is-ready/test/index.test.js', 'test/integration/router-prefetch/test/index.test.js', - 'test/integration/scss/test/group-2.test.js', + 'test/integration/router-rerender/test/index.test.js', + 'test/integration/scss/test/dev-css-handling.test.js', 'test/integration/src-dir-support-double-dir/test/index.test.js', - 'test/integration/src-dir-support/test/index.test.js', - 'test/integration/ssg-data-404/test/index.test.js', 'test/integration/ssg-dynamic-routes-404-page/test/index.test.js', 'test/integration/static-404/test/index.test.js', 'test/integration/static-page-name/test/index.test.js', - 'test/integration/styled-jsx-plugin/test/index.test.js', + 'test/integration/trailing-slashes-href-resolving/test/index.test.js', 'test/integration/tsconfig-verifier/test/index.test.js', - 'test/integration/telemetry/test/page-features.test.js', - 'test/integration/turbopack-unsupported-log/index.test.ts', - 'test/integration/turbotrace-with-webpack-worker/test/index.test.js', - 'test/integration/typeof-window-replace/test/index.test.js', 'test/integration/typescript-baseurl/test/index.test.js', - 'test/integration/typescript-custom-tsconfig/test/index.test.js', + 'test/integration/typescript-external-dir/project/test/index.test.js', 'test/integration/typescript-filtered-files/test/index.test.js', - 'test/integration/typescript-ignore-errors/test/index.test.js', - 'test/integration/webpack-config-extensionalias/test/index.test.js', + 'test/integration/typescript-hmr/test/index.test.js', 'test/integration/webpack-config-mainjs/test/index.test.js', + 'test/integration/with-electron/test/index.test.js', + 'test/production/ci-missing-typescript-deps/index.test.ts', + 'test/production/enoent-during-require/index.test.ts', + 'test/production/eslint-plugin-deps/index.test.ts', + 'test/production/fallback-export-error/index.test.ts', + 'test/production/jest/new-link-behavior.test.ts', + 'test/production/jest/transpile-packages.test.ts', + 'test/production/postcss-plugin-config-as-string/index.test.ts', + 'test/production/supports-module-resolution-nodenext/supports-moduleresolution-nodenext.test.ts', ] module.exports = { enabledTests } From 5d06b79e92fc3ea467a0da9029a259d8c4093521 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Tue, 4 Jul 2023 10:25:25 +0200 Subject: [PATCH 02/28] Support scroll: false for Link component for app router (#51869) ### What Support `scroll={false}` for Link component in app router. This can be used when you don't need to scroll back to top again when route url changes. For instance hash query changes, if you want to keep the scrolling as it is, you can use this option. ### How Handling the `scroll` option in navigation reducer on client side. Fixes #50105 Fixes NEXT-1377 --------- Co-authored-by: Jiachi Liu --- .../next/src/client/components/app-router.tsx | 21 ++- .../router-reducer/handle-mutable.ts | 29 ++- .../reducers/navigate-reducer.test.tsx | 174 ++++++++++++++++++ .../reducers/navigate-reducer.ts | 5 +- .../reducers/server-patch-reducer.test.tsx | 1 + .../router-reducer/router-reducer-types.ts | 5 +- packages/next/src/client/link.tsx | 4 +- .../next/src/shared/lib/app-router-context.ts | 1 + test/e2e/app-dir/import/next.config.js | 4 +- .../navigation/app/hash-changes/page.js | 75 ++++++++ .../e2e/app-dir/navigation/navigation.test.ts | 11 ++ .../app-dir/router-autoscroll/next.config.js | 4 +- 12 files changed, 308 insertions(+), 26 deletions(-) create mode 100644 test/e2e/app-dir/navigation/app/hash-changes/page.js diff --git a/packages/next/src/client/components/app-router.tsx b/packages/next/src/client/components/app-router.tsx index da8e27b8b7e0d..9f6e87fa5943a 100644 --- a/packages/next/src/client/components/app-router.tsx +++ b/packages/next/src/client/components/app-router.tsx @@ -231,11 +231,7 @@ function Router({ ) const navigate: RouterNavigate = useCallback( - ( - href: string, - navigateType: 'push' | 'replace', - forceOptimisticNavigation: boolean - ) => { + (href, navigateType, forceOptimisticNavigation, shouldScroll) => { const url = new URL(addBasePath(href), location.href) return dispatch({ @@ -244,6 +240,7 @@ function Router({ isExternalUrl: isExternalURL(url), locationSearch: location.search, forceOptimisticNavigation, + shouldScroll: shouldScroll ?? true, navigateType, cache: createEmptyCacheNode(), mutable: {}, @@ -296,12 +293,22 @@ function Router({ }, replace: (href, options = {}) => { startTransition(() => { - navigate(href, 'replace', Boolean(options.forceOptimisticNavigation)) + navigate( + href, + 'replace', + Boolean(options.forceOptimisticNavigation), + options.scroll ?? true + ) }) }, push: (href, options = {}) => { startTransition(() => { - navigate(href, 'push', Boolean(options.forceOptimisticNavigation)) + navigate( + href, + 'push', + Boolean(options.forceOptimisticNavigation), + options.scroll ?? true + ) }) }, refresh: () => { diff --git a/packages/next/src/client/components/router-reducer/handle-mutable.ts b/packages/next/src/client/components/router-reducer/handle-mutable.ts index 91b49c72b4e92..a1444072f1661 100644 --- a/packages/next/src/client/components/router-reducer/handle-mutable.ts +++ b/packages/next/src/client/components/router-reducer/handle-mutable.ts @@ -9,6 +9,9 @@ export function handleMutable( state: ReadonlyReducerState, mutable: Mutable ): ReducerState { + // shouldScroll is true by default, can override to false. + const shouldScroll = mutable.shouldScroll ?? true + return { buildId: state.buildId, // Set href. @@ -30,19 +33,25 @@ export function handleMutable( }, // All navigation requires scroll and focus management to trigger. focusAndScrollRef: { - apply: - mutable?.scrollableSegments !== undefined + apply: shouldScroll + ? mutable?.scrollableSegments !== undefined ? true - : state.focusAndScrollRef.apply, - hashFragment: - // Empty hash should trigger default behavior of scrolling layout into view. - // #top is handled in layout-router. - mutable.hashFragment && mutable.hashFragment !== '' + : state.focusAndScrollRef.apply + : // If shouldScroll is false then we should not apply scroll and focus management. + false, + hashFragment: shouldScroll + ? // Empty hash should trigger default behavior of scrolling layout into view. + // #top is handled in layout-router. + mutable.hashFragment && mutable.hashFragment !== '' ? // Remove leading # and decode hash to make non-latin hashes work. decodeURIComponent(mutable.hashFragment.slice(1)) - : state.focusAndScrollRef.hashFragment, - segmentPaths: - mutable?.scrollableSegments ?? state.focusAndScrollRef.segmentPaths, + : state.focusAndScrollRef.hashFragment + : // If shouldScroll is false then we should not apply scroll and focus management. + null, + segmentPaths: shouldScroll + ? mutable?.scrollableSegments ?? state.focusAndScrollRef.segmentPaths + : // If shouldScroll is false then we should not apply scroll and focus management. + [], }, // Apply cache. cache: mutable.cache ? mutable.cache : state.cache, diff --git a/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.test.tsx b/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.test.tsx index 75a4d5abdc96a..a5f9580c327c0 100644 --- a/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.test.tsx +++ b/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.test.tsx @@ -3,6 +3,7 @@ import type { fetchServerResponse as fetchServerResponseType } from '../fetch-se import type { FlightData } from '../../../../server/app-render/types' const buildId = 'development' + const flightData: FlightData = [ [ 'children', @@ -58,6 +59,9 @@ jest.mock('../fetch-server-response', () => { fetchServerResponse: ( url: URL ): ReturnType => { + if (url.pathname === '/linking' && url.hash === '#hash') { + return Promise.resolve(['', undefined]) + } if (url.pathname === '/linking/about') { return Promise.resolve([flightData, undefined]) } @@ -174,6 +178,7 @@ describe('navigateReducer', () => { isExternalUrl: false, locationSearch: '', navigateType: 'push', + shouldScroll: true, forceOptimisticNavigation: false, cache: { status: CacheStates.LAZY_INITIALIZED, @@ -362,6 +367,7 @@ describe('navigateReducer', () => { isExternalUrl: false, locationSearch: '', navigateType: 'push', + shouldScroll: true, forceOptimisticNavigation: false, cache: { status: CacheStates.LAZY_INITIALIZED, @@ -555,6 +561,7 @@ describe('navigateReducer', () => { isExternalUrl, locationSearch: '', navigateType: 'push', + shouldScroll: true, forceOptimisticNavigation: false, cache: { status: CacheStates.LAZY_INITIALIZED, @@ -717,6 +724,7 @@ describe('navigateReducer', () => { isExternalUrl, locationSearch: '', navigateType: 'replace', + shouldScroll: true, forceOptimisticNavigation: false, cache: { status: CacheStates.LAZY_INITIALIZED, @@ -876,6 +884,7 @@ describe('navigateReducer', () => { isExternalUrl: false, locationSearch: '', navigateType: 'push', + shouldScroll: true, forceOptimisticNavigation: true, cache: { status: CacheStates.LAZY_INITIALIZED, @@ -977,6 +986,169 @@ describe('navigateReducer', () => { expect(newState).toMatchObject(expectedState) }) + it('should apply navigation for scroll', async () => { + const initialTree = getInitialRouterStateTree() + const initialCanonicalUrl = '/linking' + const children = ( + + + Root layout + + ) + const initialParallelRoutes: CacheNode['parallelRoutes'] = new Map([ + [ + 'children', + new Map([ + [ + 'linking', + { + status: CacheStates.READY, + parallelRoutes: new Map([ + [ + 'children', + new Map([ + [ + '__PAGE__', + { + status: CacheStates.READY, + data: null, + subTreeData: <>Linking page, + parallelRoutes: new Map(), + }, + ], + ]), + ], + ]), + data: null, + subTreeData: <>Linking layout level, + }, + ], + ]), + ], + ]) + + const state = createInitialRouterState({ + buildId, + initialTree, + initialHead: null, + initialCanonicalUrl, + children, + initialParallelRoutes, + isServer: false, + location: new URL('/linking', 'https://localhost') as any, + }) + + const state2 = createInitialRouterState({ + buildId, + initialTree, + initialHead: null, + initialCanonicalUrl, + children, + initialParallelRoutes, + isServer: false, + location: new URL('/linking#hash', 'https://localhost') as any, + }) + + const action: NavigateAction = { + type: ACTION_NAVIGATE, + url: new URL('/linking#hash', 'https://localhost'), + isExternalUrl: false, + locationSearch: '', + navigateType: 'push', + shouldScroll: false, // should not scroll + forceOptimisticNavigation: false, + cache: { + status: CacheStates.LAZY_INITIALIZED, + data: null, + subTreeData: null, + parallelRoutes: new Map(), + }, + mutable: {}, + } + + await runPromiseThrowChain(() => navigateReducer(state, action)) + + const newState = await runPromiseThrowChain(() => + navigateReducer(state2, action) + ) + + const expectedState: ReturnType = { + buildId, + prefetchCache: new Map(), + pushRef: { + mpaNavigation: true, + pendingPush: true, + }, + focusAndScrollRef: { + apply: false, + hashFragment: null, + segmentPaths: [], + }, + canonicalUrl: '', + nextUrl: '/linking', + cache: { + status: CacheStates.READY, + data: null, + subTreeData: ( + + + Root layout + + ), + parallelRoutes: new Map([ + [ + 'children', + new Map([ + [ + 'linking', + { + status: CacheStates.READY, + parallelRoutes: new Map([ + [ + 'children', + new Map([ + [ + '__PAGE__', + { + status: CacheStates.READY, + // Real promise is not needed here. + data: null, + parallelRoutes: new Map(), + subTreeData: <>Linking page, + }, + ], + ]), + ], + ]), + // Real promise is not needed here. + data: null, + subTreeData: <>Linking layout level, + }, + ], + ]), + ], + ]), + }, + tree: [ + '', + { + children: [ + 'linking', + { + children: ['__PAGE__', {}], + }, + ], + }, + // TODO-APP: optimistic tree is wrong + undefined, + undefined, + true, + ], + } + + expect(newState).toMatchObject(expectedState) + }) + it('should apply navigation with prefetched data', async () => { const initialTree = getInitialRouterStateTree() const initialCanonicalUrl = '/linking' @@ -1060,6 +1232,7 @@ describe('navigateReducer', () => { isExternalUrl: false, navigateType: 'push', locationSearch: '', + shouldScroll: true, forceOptimisticNavigation: false, cache: { status: CacheStates.LAZY_INITIALIZED, @@ -1342,6 +1515,7 @@ describe('navigateReducer', () => { isExternalUrl: false, locationSearch: '', navigateType: 'push', + shouldScroll: true, forceOptimisticNavigation: false, cache: { status: CacheStates.LAZY_INITIALIZED, diff --git a/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.ts b/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.ts index 1ef59e2cb1cf2..f22bfc72401aa 100644 --- a/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.ts +++ b/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.ts @@ -114,6 +114,7 @@ export function navigateReducer( cache, mutable, forceOptimisticNavigation, + shouldScroll, } = action const { pathname, hash } = url const href = createHrefFromUrl(url) @@ -191,6 +192,7 @@ export function navigateReducer( mutable.patchedTree = optimisticTree mutable.pendingPush = pendingPush mutable.hashFragment = hash + mutable.shouldScroll = shouldScroll mutable.scrollableSegments = [] mutable.cache = temporaryCacheNode mutable.canonicalUrl = href @@ -355,12 +357,13 @@ export function navigateReducer( mutable.previousTree = state.tree mutable.patchedTree = currentTree - mutable.scrollableSegments = scrollableSegments mutable.canonicalUrl = canonicalUrlOverride ? createHrefFromUrl(canonicalUrlOverride) : href mutable.pendingPush = pendingPush + mutable.scrollableSegments = scrollableSegments mutable.hashFragment = hash + mutable.shouldScroll = shouldScroll return handleMutable(state, mutable) } diff --git a/packages/next/src/client/components/router-reducer/reducers/server-patch-reducer.test.tsx b/packages/next/src/client/components/router-reducer/reducers/server-patch-reducer.test.tsx index 6ffcd0548496c..913b1dd8afcc7 100644 --- a/packages/next/src/client/components/router-reducer/reducers/server-patch-reducer.test.tsx +++ b/packages/next/src/client/components/router-reducer/reducers/server-patch-reducer.test.tsx @@ -502,6 +502,7 @@ describe('serverPatchReducer', () => { isExternalUrl: false, locationSearch: '', navigateType: 'push', + shouldScroll: true, forceOptimisticNavigation: false, cache: { status: CacheStates.LAZY_INITIALIZED, diff --git a/packages/next/src/client/components/router-reducer/router-reducer-types.ts b/packages/next/src/client/components/router-reducer/router-reducer-types.ts index 9a066acb573e6..c7dfe69472ee7 100644 --- a/packages/next/src/client/components/router-reducer/router-reducer-types.ts +++ b/packages/next/src/client/components/router-reducer/router-reducer-types.ts @@ -23,7 +23,8 @@ export type RouterChangeByServerResponse = ( export type RouterNavigate = ( href: string, navigateType: 'push' | 'replace', - forceOptimisticNavigation: boolean + forceOptimisticNavigation: boolean, + shouldScroll: boolean ) => void export interface Mutable { @@ -36,6 +37,7 @@ export interface Mutable { cache?: CacheNode prefetchCache?: AppRouterState['prefetchCache'] hashFragment?: string + shouldScroll?: boolean } export interface ServerActionMutable { @@ -125,6 +127,7 @@ export interface NavigateAction { locationSearch: Location['search'] navigateType: 'push' | 'replace' forceOptimisticNavigation: boolean + shouldScroll: boolean cache: CacheNode mutable: Mutable } diff --git a/packages/next/src/client/link.tsx b/packages/next/src/client/link.tsx index d17341b43edd2..39fd9ecbd0719 100644 --- a/packages/next/src/client/link.tsx +++ b/packages/next/src/client/link.tsx @@ -217,15 +217,17 @@ function linkClicked( const navigate = () => { // If the router is an NextRouter instance it will have `beforePopState` + const routerScroll = scroll ?? true if ('beforePopState' in router) { router[replace ? 'replace' : 'push'](href, as, { shallow, locale, - scroll, + scroll: routerScroll, }) } else { router[replace ? 'replace' : 'push'](as || href, { forceOptimisticNavigation: !prefetchEnabled, + scroll: routerScroll, }) } } diff --git a/packages/next/src/shared/lib/app-router-context.ts b/packages/next/src/shared/lib/app-router-context.ts index b0ca3c444afb6..6d47491eb8b9f 100644 --- a/packages/next/src/shared/lib/app-router-context.ts +++ b/packages/next/src/shared/lib/app-router-context.ts @@ -70,6 +70,7 @@ export type CacheNode = export interface NavigateOptions { /** @internal */ forceOptimisticNavigation?: boolean + scroll?: boolean } export interface PrefetchOptions { diff --git a/test/e2e/app-dir/import/next.config.js b/test/e2e/app-dir/import/next.config.js index 53c8bdda514e2..4ba52ba2c8df6 100644 --- a/test/e2e/app-dir/import/next.config.js +++ b/test/e2e/app-dir/import/next.config.js @@ -1,3 +1 @@ -module.exports = { - strictMode: true, -} +module.exports = {} diff --git a/test/e2e/app-dir/navigation/app/hash-changes/page.js b/test/e2e/app-dir/navigation/app/hash-changes/page.js new file mode 100644 index 0000000000000..39ec0bde5cd5f --- /dev/null +++ b/test/e2e/app-dir/navigation/app/hash-changes/page.js @@ -0,0 +1,75 @@ +'use client' + +import React from 'react' +import Link from 'next/link' +import { useRouter } from 'next/navigation' + +const HashChanges = () => { + const router = useRouter() + + return ( +
+
+ + Via Link + +
+ +
+ + Via Empty Hash + +
+ +
+ + Go to item 400 + +
+ +
+ + Go to name item 400 + +
+ +
+ + Go to name item 400 (no scroll) + +
+ +
+ + Go to CJK anchor + +
+ +
+ + Via Top Hash + +
+
ASPATH: {router.asPath}
+
PATHNAME: {router.pathname}
+
CJK anchor
+ {Array.from({ length: 500 }, (x, i) => i + 1).map((i) => { + return ( +
+ {i} +
+ ) + })} +
+ ) +} + +export default HashChanges diff --git a/test/e2e/app-dir/navigation/navigation.test.ts b/test/e2e/app-dir/navigation/navigation.test.ts index 8aaf93dd0bf30..a6e6fab2bcac7 100644 --- a/test/e2e/app-dir/navigation/navigation.test.ts +++ b/test/e2e/app-dir/navigation/navigation.test.ts @@ -85,6 +85,17 @@ createNextDescribe( await checkLink('top', 0) await checkLink('non-existent', 0) }) + + it('should not scroll to hash when scroll={false} is set', async () => { + const browser = await next.browser('/hash-changes') + const curScroll = await browser.eval( + 'document.documentElement.scrollTop' + ) + await browser.elementByCss('#scroll-to-name-item-400-no-scroll').click() + expect(curScroll).toBe( + await browser.eval('document.documentElement.scrollTop') + ) + }) }) describe('hash-with-scroll-offset', () => { diff --git a/test/e2e/app-dir/router-autoscroll/next.config.js b/test/e2e/app-dir/router-autoscroll/next.config.js index 53c8bdda514e2..4ba52ba2c8df6 100644 --- a/test/e2e/app-dir/router-autoscroll/next.config.js +++ b/test/e2e/app-dir/router-autoscroll/next.config.js @@ -1,3 +1 @@ -module.exports = { - strictMode: true, -} +module.exports = {} From 4f75c7993815dac50a6db3e078c51e6ae8d5bbdc Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Tue, 4 Jul 2023 08:30:06 +0000 Subject: [PATCH 03/28] v13.4.9-canary.1 --- 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 +- pnpm-lock.yaml | 14 +++++++------- 17 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lerna.json b/lerna.json index a731589982fea..6ddf4755ccb51 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "13.4.9-canary.0" + "version": "13.4.9-canary.1" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 605fcd77ccc71..1ac0192a04c33 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.4.9-canary.0", + "version": "13.4.9-canary.1", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index b3fca89e7b91f..83b4d515c5378 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.4.9-canary.0", + "version": "13.4.9-canary.1", "description": "ESLint configuration used by NextJS.", "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.4.9-canary.0", + "@next/eslint-plugin-next": "13.4.9-canary.1", "@rushstack/eslint-patch": "^1.1.3", "@typescript-eslint/parser": "^5.42.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 c337c07226d17..eb4887ef88a47 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.4.9-canary.0", + "version": "13.4.9-canary.1", "description": "ESLint plugin for NextJS.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index 97ebe6fc4ff5c..16264ce78f1b0 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,6 +1,6 @@ { "name": "@next/font", - "version": "13.4.9-canary.0", + "version": "13.4.9-canary.1", "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 1f6d290c9d75a..3333083681ff1 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.4.9-canary.0", + "version": "13.4.9-canary.1", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 020715f23e558..7add070441647 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "13.4.9-canary.0", + "version": "13.4.9-canary.1", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 9a0df2dd86815..bc78e48354262 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "13.4.9-canary.0", + "version": "13.4.9-canary.1", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index c6bcfaa47940c..96478d83cf322 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "13.4.9-canary.0", + "version": "13.4.9-canary.1", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index b4699deb1578f..1b68bf892e804 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.4.9-canary.0", + "version": "13.4.9-canary.1", "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 d4e046c409ed5..679b8f503fc29 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.4.9-canary.0", + "version": "13.4.9-canary.1", "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 1532f3be7dcf0..da3d8d940acd2 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.4.9-canary.0", + "version": "13.4.9-canary.1", "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 f46b59fcafeb4..8428d0bc19cb6 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "13.4.9-canary.0", + "version": "13.4.9-canary.1", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 81dd1d8721948..8f906e872e1a3 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "13.4.9-canary.0", + "version": "13.4.9-canary.1", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -83,7 +83,7 @@ ] }, "dependencies": { - "@next/env": "13.4.9-canary.0", + "@next/env": "13.4.9-canary.1", "@swc/helpers": "0.5.1", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", @@ -141,11 +141,11 @@ "@jest/types": "29.5.0", "@napi-rs/cli": "2.14.7", "@napi-rs/triples": "1.1.0", - "@next/polyfill-module": "13.4.9-canary.0", - "@next/polyfill-nomodule": "13.4.9-canary.0", - "@next/react-dev-overlay": "13.4.9-canary.0", - "@next/react-refresh-utils": "13.4.9-canary.0", - "@next/swc": "13.4.9-canary.0", + "@next/polyfill-module": "13.4.9-canary.1", + "@next/polyfill-nomodule": "13.4.9-canary.1", + "@next/react-dev-overlay": "13.4.9-canary.1", + "@next/react-refresh-utils": "13.4.9-canary.1", + "@next/swc": "13.4.9-canary.1", "@opentelemetry/api": "1.4.1", "@segment/ajv-human-errors": "2.1.2", "@taskr/clear": "1.1.0", diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json index 6721c8e80872d..1ad0c4abbaa2f 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.4.9-canary.0", + "version": "13.4.9-canary.1", "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 7a58632ffd3ee..2147ba1314ec4 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.4.9-canary.0", + "version": "13.4.9-canary.1", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8e63a10a41af..fb0370b341138 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -436,7 +436,7 @@ importers: packages/eslint-config-next: specifiers: - '@next/eslint-plugin-next': 13.4.9-canary.0 + '@next/eslint-plugin-next': 13.4.9-canary.1 '@rushstack/eslint-patch': ^1.1.3 '@typescript-eslint/parser': ^5.42.0 eslint: ^7.23.0 || ^8.0.0 @@ -513,12 +513,12 @@ importers: '@jest/types': 29.5.0 '@napi-rs/cli': 2.14.7 '@napi-rs/triples': 1.1.0 - '@next/env': 13.4.9-canary.0 - '@next/polyfill-module': 13.4.9-canary.0 - '@next/polyfill-nomodule': 13.4.9-canary.0 - '@next/react-dev-overlay': 13.4.9-canary.0 - '@next/react-refresh-utils': 13.4.9-canary.0 - '@next/swc': 13.4.9-canary.0 + '@next/env': 13.4.9-canary.1 + '@next/polyfill-module': 13.4.9-canary.1 + '@next/polyfill-nomodule': 13.4.9-canary.1 + '@next/react-dev-overlay': 13.4.9-canary.1 + '@next/react-refresh-utils': 13.4.9-canary.1 + '@next/swc': 13.4.9-canary.1 '@opentelemetry/api': 1.4.1 '@segment/ajv-human-errors': 2.1.2 '@swc/helpers': 0.5.1 From ae3db7ce6b0c09cc9bc3e96105cb180ace516505 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Tue, 4 Jul 2023 11:11:21 +0200 Subject: [PATCH 04/28] Memoize useRouter from next/navigation when used in Pages Router (#52177) ## What? Ensures the router instance passed for `next/navigation` in Pages Router is a stable reference. For App Router the router instance is already a stable reference, so making this one stable too would fix #18127. ## How? Added `React.useMemo` around `adaptForAppRouterInstance`, previously it was recreated each render but that's not needed for this particular case. The searchParamsContext and pathnameContext do need a new value each render in order to ensure they get the latest value. Fixes #18127 Fixes NEXT-1375 --- packages/next/src/client/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/next/src/client/index.tsx b/packages/next/src/client/index.tsx index 87a45c7ab4ed1..d1b1140616976 100644 --- a/packages/next/src/client/index.tsx +++ b/packages/next/src/client/index.tsx @@ -326,6 +326,10 @@ function renderApp(App: AppComponent, appProps: AppProps) { function AppContainer({ children, }: React.PropsWithChildren<{}>): React.ReactElement { + // Create a memoized value for next/navigation router context. + const adaptedForAppRouter = React.useMemo(() => { + return adaptForAppRouterInstance(router) + }, []) return ( @@ -336,7 +340,7 @@ function AppContainer({ ) } > - + Date: Tue, 4 Jul 2023 05:32:31 -0400 Subject: [PATCH 05/28] chore(deps): bump react `18.3.0-canary-1fdacbefd-20230630` (#52005) This PR updates the vendored react dependencies using `pnpm sync-react` ### React upstream changes - https://github.com/facebook/react/pull/27028 - https://github.com/facebook/react/pull/27027 - https://github.com/facebook/react/pull/27019 - https://github.com/facebook/react/pull/26954 - https://github.com/facebook/react/pull/26987 - https://github.com/facebook/react/pull/26985 - https://github.com/facebook/react/pull/26933 - https://github.com/facebook/react/pull/26625 - https://github.com/facebook/react/pull/27011 - https://github.com/facebook/react/pull/27008 - https://github.com/facebook/react/pull/26997 - https://github.com/facebook/react/pull/26989 - https://github.com/facebook/react/pull/26955 - https://github.com/facebook/react/pull/26963 - https://github.com/facebook/react/pull/26983 - https://github.com/facebook/react/pull/26914 - https://github.com/facebook/react/pull/26951 - https://github.com/facebook/react/pull/26977 - https://github.com/facebook/react/pull/26958 - https://github.com/facebook/react/pull/26940 - https://github.com/facebook/react/pull/26939 - https://github.com/facebook/react/pull/26887 - https://github.com/facebook/react/pull/26947 - https://github.com/facebook/react/pull/26945 - https://github.com/facebook/react/pull/26942 - https://github.com/facebook/react/pull/26938 - https://github.com/facebook/react/pull/26844 - https://github.com/facebook/react/pull/25510 - https://github.com/facebook/react/pull/26932 - https://github.com/facebook/react/pull/26896 - https://github.com/facebook/react/pull/26913 - https://github.com/facebook/react/pull/26888 - https://github.com/facebook/react/pull/26827 - https://github.com/facebook/react/pull/26889 - https://github.com/facebook/react/pull/26877 - https://github.com/facebook/react/pull/26873 - https://github.com/facebook/react/pull/26880 - https://github.com/facebook/react/pull/26842 - https://github.com/facebook/react/pull/26858 - https://github.com/facebook/react/pull/26754 - https://github.com/facebook/react/pull/26753 - https://github.com/facebook/react/pull/26881 ### Related Closes #49409 (by https://github.com/facebook/react/pull/26977) fix NEXT-1189 Co-authored-by: Shu Ding --- package.json | 16 +- ...t-dom-server-legacy.browser.development.js | 420 +++++------ ...om-server-legacy.browser.production.min.js | 250 ++++--- ...eact-dom-server-legacy.node.development.js | 423 +++++------ ...t-dom-server-legacy.node.production.min.js | 272 ++++--- ...t-dom-server-rendering-stub.development.js | 10 +- ...om-server-rendering-stub.production.min.js | 6 +- .../react-dom-server.browser.development.js | 426 +++++------ ...react-dom-server.browser.production.min.js | 262 ++++--- .../cjs/react-dom-server.edge.development.js | 426 +++++------ .../react-dom-server.edge.production.min.js | 282 ++++---- .../cjs/react-dom-server.node.development.js | 416 +++++------ .../react-dom-server.node.production.min.js | 281 ++++---- .../react-dom-static.browser.development.js | 426 +++++------ ...react-dom-static.browser.production.min.js | 262 ++++--- .../cjs/react-dom-static.edge.development.js | 426 +++++------ .../react-dom-static.edge.production.min.js | 264 ++++--- .../cjs/react-dom-static.node.development.js | 416 +++++------ .../react-dom-static.node.production.min.js | 285 ++++---- .../react-dom-unstable_testing.development.js | 386 ++++------ ...act-dom-unstable_testing.production.min.js | 624 ++++++++-------- .../cjs/react-dom.development.js | 386 ++++------ .../cjs/react-dom.production.min.js | 594 ++++++++-------- .../cjs/react-dom.profiling.min.js | 646 ++++++++--------- .../react-dom-experimental/package.json | 4 +- ...t-dom-server-legacy.browser.development.js | 420 +++++------ ...om-server-legacy.browser.production.min.js | 243 ++++--- ...eact-dom-server-legacy.node.development.js | 423 +++++------ ...t-dom-server-legacy.node.production.min.js | 266 ++++--- ...t-dom-server-rendering-stub.development.js | 10 +- ...om-server-rendering-stub.production.min.js | 5 +- .../react-dom-server.browser.development.js | 426 +++++------ ...react-dom-server.browser.production.min.js | 253 ++++--- .../cjs/react-dom-server.edge.development.js | 426 +++++------ .../react-dom-server.edge.production.min.js | 273 ++++--- .../cjs/react-dom-server.node.development.js | 416 +++++------ .../react-dom-server.node.production.min.js | 274 ++++--- .../react-dom/cjs/react-dom.development.js | 376 ++++------ .../react-dom/cjs/react-dom.production.min.js | 578 +++++++-------- .../react-dom/cjs/react-dom.profiling.min.js | 605 ++++++++-------- .../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 +- ...-dom-webpack-client.browser.development.js | 669 ++++++++++++------ ...m-webpack-client.browser.production.min.js | 53 +- ...ver-dom-webpack-client.edge.development.js | 574 ++++++++++++--- ...-dom-webpack-client.edge.production.min.js | 54 +- ...ver-dom-webpack-client.node.development.js | 590 ++++++++++++--- ...-dom-webpack-client.node.production.min.js | 53 +- ...bpack-client.node.unbundled.development.js | 538 +++++++++++--- ...ck-client.node.unbundled.production.min.js | 50 +- ...-dom-webpack-server.browser.development.js | 309 ++++++-- ...m-webpack-server.browser.production.min.js | 108 +-- ...ver-dom-webpack-server.edge.development.js | 309 ++++++-- ...-dom-webpack-server.edge.production.min.js | 110 +-- ...ver-dom-webpack-server.node.development.js | 298 ++++++-- ...-dom-webpack-server.node.production.min.js | 98 +-- ...bpack-server.node.unbundled.development.js | 243 ++++++- ...ck-server.node.unbundled.production.min.js | 119 ++-- .../package.json | 4 +- ...-dom-webpack-client.browser.development.js | 517 ++++++++------ ...m-webpack-client.browser.production.min.js | 49 +- ...ver-dom-webpack-client.edge.development.js | 422 ++++++++--- ...-dom-webpack-client.edge.production.min.js | 51 +- ...ver-dom-webpack-client.node.development.js | 438 +++++++++--- ...-dom-webpack-client.node.production.min.js | 51 +- ...bpack-client.node.unbundled.development.js | 386 +++++++--- ...ck-client.node.unbundled.production.min.js | 48 +- ...-dom-webpack-server.browser.development.js | 215 ++++-- ...m-webpack-server.browser.production.min.js | 98 +-- ...ver-dom-webpack-server.edge.development.js | 215 ++++-- ...-dom-webpack-server.edge.production.min.js | 102 +-- ...ver-dom-webpack-server.node.development.js | 210 ++++-- ...-dom-webpack-server.node.production.min.js | 86 +-- ...bpack-server.node.unbundled.development.js | 155 +++- ...ck-server.node.unbundled.production.min.js | 115 +-- .../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 | 80 +-- 84 files changed, 11825 insertions(+), 8819 deletions(-) diff --git a/package.json b/package.json index 1abeac7f1399c..2a5bcb52767ac 100644 --- a/package.json +++ b/package.json @@ -189,14 +189,14 @@ "random-seed": "0.3.0", "react": "18.2.0", "react-17": "npm:react@17.0.2", - "react-builtin": "npm:react@18.3.0-canary-1cea38448-20230530", + "react-builtin": "npm:react@18.3.0-canary-1fdacbefd-20230630", "react-dom": "18.2.0", "react-dom-17": "npm:react-dom@17.0.2", - "react-dom-builtin": "npm:react-dom@18.3.0-canary-1cea38448-20230530", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-1cea38448-20230530", - "react-experimental-builtin": "npm:react@0.0.0-experimental-1cea38448-20230530", - "react-server-dom-webpack": "18.3.0-canary-1cea38448-20230530", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-1cea38448-20230530", + "react-dom-builtin": "npm:react-dom@18.3.0-canary-1fdacbefd-20230630", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-1fdacbefd-20230630", + "react-experimental-builtin": "npm:react@0.0.0-experimental-1fdacbefd-20230630", + "react-server-dom-webpack": "18.3.0-canary-1fdacbefd-20230630", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-1fdacbefd-20230630", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -206,8 +206,8 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.9.1", - "scheduler-builtin": "npm:scheduler@0.24.0-canary-1cea38448-20230530", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-1cea38448-20230530", + "scheduler-builtin": "npm:scheduler@0.24.0-canary-1fdacbefd-20230630", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-1fdacbefd-20230630", "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 543bc0d8816cf..9874568260791 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-1cea38448-20230530'; +var ReactVersion = '18.3.0-experimental-1fdacbefd-20230630'; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; @@ -1877,6 +1877,7 @@ var startScriptSrc = stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1906,7 +1907,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState$1(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState$1(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1913,7 +1914,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState$1(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState$1(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1986,7 +1987,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1986,7 +1987,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -2054,7 +2055,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1986,7 +1987,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1986,7 +1987,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -2055,7 +2056,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1868,7 +1869,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState$1(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState$1(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1875,7 +1876,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState$1(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState$1(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1949,7 +1950,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1949,7 +1950,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -2017,7 +2018,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1907,7 +1906,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState$1(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState$1(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1914,7 +1913,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState$1(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState$1(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1987,7 +1986,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1987,7 +1986,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -2055,7 +2054,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1987,7 +1986,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1987,7 +1986,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -2056,7 +2055,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1869,7 +1868,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState$1(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState$1(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1876,7 +1875,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState$1(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState$1(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1950,7 +1949,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -1950,7 +1949,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk(''); /** * This escaping function is designed to work with bootstrapScriptContent only. @@ -2018,7 +2017,7 @@ var scriptReplacer = function (match, prefix, s, suffix) { // is set, the server will send instructions via data attributes (instead of inline scripts) -function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { +function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) { var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix; var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk('