next 15.2.0-canary.65 → 15.2.0-canary.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of next might be problematic. Click here for more details.
- package/dist/bin/next +5 -1
- package/dist/bin/next.map +1 -1
- package/dist/build/entries.d.ts +1 -0
- package/dist/build/entries.js +12 -1
- package/dist/build/entries.js.map +1 -1
- package/dist/build/index.js +3 -3
- package/dist/build/index.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack/config/blocks/base.js +3 -1
- package/dist/build/webpack/config/blocks/base.js.map +1 -1
- package/dist/build/webpack/config/blocks/css/index.js +3 -1
- package/dist/build/webpack/config/blocks/css/index.js.map +1 -1
- package/dist/build/webpack/config/blocks/css/loaders/client.js +3 -1
- package/dist/build/webpack/config/blocks/css/loaders/client.js.map +1 -1
- package/dist/build/webpack/loaders/next-flight-client-entry-loader.js +4 -0
- package/dist/build/webpack/loaders/next-flight-client-entry-loader.js.map +1 -1
- package/dist/build/webpack/loaders/next-flight-client-module-loader.js +7 -1
- package/dist/build/webpack/loaders/next-flight-client-module-loader.js.map +1 -1
- package/dist/build/webpack/loaders/next-flight-loader/index.js +8 -2
- package/dist/build/webpack/loaders/next-flight-loader/index.js.map +1 -1
- package/dist/build/webpack/loaders/utils.js +1 -1
- package/dist/build/webpack/loaders/utils.js.map +1 -1
- package/dist/build/webpack/plugins/build-manifest-plugin.d.ts +1 -1
- package/dist/build/webpack/plugins/build-manifest-plugin.js +13 -4
- package/dist/build/webpack/plugins/build-manifest-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/flight-client-entry-plugin.d.ts +1 -1
- package/dist/build/webpack/plugins/flight-client-entry-plugin.js +28 -18
- package/dist/build/webpack/plugins/flight-client-entry-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/flight-manifest-plugin.js +3 -3
- package/dist/build/webpack/plugins/flight-manifest-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/middleware-plugin.js +6 -3
- package/dist/build/webpack/plugins/middleware-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js +11 -1
- package/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader.js +1 -1
- package/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader.js.map +1 -1
- package/dist/build/webpack/plugins/rspack-flight-client-entry-plugin.d.ts +36 -0
- package/dist/build/webpack/plugins/rspack-flight-client-entry-plugin.js +97 -0
- package/dist/build/webpack/plugins/rspack-flight-client-entry-plugin.js.map +1 -0
- package/dist/build/webpack/plugins/rspack-profiling-plugin.d.ts +9 -0
- package/dist/build/webpack/plugins/rspack-profiling-plugin.js +62 -0
- package/dist/build/webpack/plugins/rspack-profiling-plugin.js.map +1 -0
- package/dist/build/webpack/plugins/wellknown-errors-plugin/parseNextAppLoaderError.js +2 -1
- package/dist/build/webpack/plugins/wellknown-errors-plugin/parseNextAppLoaderError.js.map +1 -1
- package/dist/build/webpack/utils.js +6 -2
- package/dist/build/webpack/utils.js.map +1 -1
- package/dist/build/webpack-config.js +37 -5
- package/dist/build/webpack-config.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/app-dir/link.js +2 -0
- package/dist/client/app-dir/link.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js +34 -26
- package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.stories.js +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/font/font-styles.d.ts +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/font-styles.js +41 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/font-styles.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/geist-latin-ext.woff2 +0 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/geist-latin.woff2 +0 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/geist-mono-latin-ext.woff2 +0 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/geist-mono-latin.woff2 +0 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/get-dev-overlay-font-middleware.d.ts +2 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/get-dev-overlay-font-middleware.js +72 -0
- package/dist/client/components/react-dev-overlay/_experimental/font/get-dev-overlay-font-middleware.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/code-frame/code-frame.js +16 -8
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/code-frame/code-frame.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.js +3 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/dialog/dialog.js +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/dialog/dialog.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.d.ts +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +82 -31
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.d.ts +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js +20 -21
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.d.ts +8 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js +80 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/route-info.d.ts +9 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/route-info.js +158 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/route-info.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.d.ts +8 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js +212 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.d.ts +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +28 -6
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-message/error-message.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-message/error-message.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.d.ts +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js +3 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-layout/error-overlay-layout.d.ts +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-layout/error-overlay-layout.js +4 -4
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-layout/error-overlay-layout.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.d.ts +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.js +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.stories.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.d.ts +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.js +9 -9
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.stories.js +4 -4
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/terminal/terminal.js +15 -10
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/terminal/terminal.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.js +3 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.d.ts +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js +7 -7
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js +5 -5
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/render-error.d.ts +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/render-error.js +4 -12
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/render-error.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/icons/collapse-icon.js +3 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/icons/collapse-icon.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/icons/stop-icon.d.ts +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/icons/stop-icon.js +34 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/icons/stop-icon.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/component-styles.js +7 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/component-styles.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js +6 -2
- package/dist/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js.map +1 -1
- package/dist/client/components/react-dev-overlay/hydration-diff/diff-view.js +2 -2
- package/dist/client/components/react-dev-overlay/hydration-diff/diff-view.js.map +1 -1
- package/dist/client/components/react-dev-overlay/server/get-next-error-feedback-middleware.js +4 -4
- package/dist/client/components/react-dev-overlay/server/get-next-error-feedback-middleware.js.map +1 -1
- package/dist/client/components/react-dev-overlay/server/middleware-response.d.ts +9 -0
- package/dist/client/components/react-dev-overlay/server/middleware-response.js +46 -0
- package/dist/client/components/react-dev-overlay/server/middleware-response.js.map +1 -0
- package/dist/client/components/react-dev-overlay/server/middleware-turbopack.js +13 -12
- package/dist/client/components/react-dev-overlay/server/middleware-turbopack.js.map +1 -1
- package/dist/client/components/react-dev-overlay/server/middleware-webpack.js +12 -11
- package/dist/client/components/react-dev-overlay/server/middleware-webpack.js.map +1 -1
- package/dist/client/components/react-dev-overlay/server/shared.d.ts +0 -7
- package/dist/client/components/react-dev-overlay/server/shared.js +1 -51
- package/dist/client/components/react-dev-overlay/server/shared.js.map +1 -1
- package/dist/client/components/react-dev-overlay/shared.d.ts +1 -0
- package/dist/client/components/react-dev-overlay/shared.js +2 -0
- package/dist/client/components/react-dev-overlay/shared.js.map +1 -1
- package/dist/client/index.js +2 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/link.js.map +1 -1
- package/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js +8 -44
- package/dist/compiled/@next/font/dist/google/fetch-font-file.d.ts +2 -1
- package/dist/compiled/@next/font/dist/google/fetch-font-file.js +6 -20
- package/dist/compiled/@next/font/dist/google/fetch-resource.d.ts +6 -0
- package/dist/compiled/@next/font/dist/google/fetch-resource.js +46 -0
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +3 -3
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +3 -3
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +2 -2
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/compiled/node-fetch/index.js +1 -1
- package/dist/compiled/sass-loader/cjs.js +1 -1
- package/dist/compiled/webpack/webpack.js +23 -1
- package/dist/esm/build/entries.js +9 -2
- package/dist/esm/build/entries.js.map +1 -1
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack/config/blocks/base.js +3 -1
- package/dist/esm/build/webpack/config/blocks/base.js.map +1 -1
- package/dist/esm/build/webpack/config/blocks/css/index.js +3 -1
- package/dist/esm/build/webpack/config/blocks/css/index.js.map +1 -1
- package/dist/esm/build/webpack/config/blocks/css/loaders/client.js +3 -1
- package/dist/esm/build/webpack/config/blocks/css/loaders/client.js.map +1 -1
- package/dist/esm/build/webpack/loaders/next-flight-client-entry-loader.js +4 -0
- package/dist/esm/build/webpack/loaders/next-flight-client-entry-loader.js.map +1 -1
- package/dist/esm/build/webpack/loaders/next-flight-client-module-loader.js +7 -1
- package/dist/esm/build/webpack/loaders/next-flight-client-module-loader.js.map +1 -1
- package/dist/esm/build/webpack/loaders/next-flight-loader/index.js +8 -2
- package/dist/esm/build/webpack/loaders/next-flight-loader/index.js.map +1 -1
- package/dist/esm/build/webpack/loaders/utils.js +1 -1
- package/dist/esm/build/webpack/loaders/utils.js.map +1 -1
- package/dist/esm/build/webpack/plugins/build-manifest-plugin.js +14 -5
- package/dist/esm/build/webpack/plugins/build-manifest-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/flight-client-entry-plugin.js +28 -18
- package/dist/esm/build/webpack/plugins/flight-client-entry-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/flight-manifest-plugin.js +3 -3
- package/dist/esm/build/webpack/plugins/flight-manifest-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/middleware-plugin.js +6 -3
- package/dist/esm/build/webpack/plugins/middleware-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/next-trace-entrypoints-plugin.js +11 -1
- package/dist/esm/build/webpack/plugins/next-trace-entrypoints-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/nextjs-require-cache-hot-reloader.js +1 -1
- package/dist/esm/build/webpack/plugins/nextjs-require-cache-hot-reloader.js.map +1 -1
- package/dist/esm/build/webpack/plugins/rspack-flight-client-entry-plugin.js +87 -0
- package/dist/esm/build/webpack/plugins/rspack-flight-client-entry-plugin.js.map +1 -0
- package/dist/esm/build/webpack/plugins/rspack-profiling-plugin.js +40 -0
- package/dist/esm/build/webpack/plugins/rspack-profiling-plugin.js.map +1 -0
- package/dist/esm/build/webpack/plugins/wellknown-errors-plugin/parseNextAppLoaderError.js +2 -1
- package/dist/esm/build/webpack/plugins/wellknown-errors-plugin/parseNextAppLoaderError.js.map +1 -1
- package/dist/esm/build/webpack/utils.js +6 -2
- package/dist/esm/build/webpack/utils.js.map +1 -1
- package/dist/esm/build/webpack-config.js +37 -5
- package/dist/esm/build/webpack-config.js.map +1 -1
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/app-dir/link.js +2 -0
- package/dist/esm/client/app-dir/link.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js +34 -26
- package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.stories.js +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/font/font-styles.js +25 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/font/font-styles.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/font/geist-latin-ext.woff2 +0 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/font/geist-latin.woff2 +0 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/font/geist-mono-latin-ext.woff2 +0 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/font/geist-mono-latin.woff2 +0 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/font/get-dev-overlay-font-middleware.js +54 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/font/get-dev-overlay-font-middleware.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/code-frame/code-frame.js +16 -8
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/code-frame/code-frame.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.js +3 -3
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/dialog/dialog.js +2 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/dialog/dialog.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +83 -31
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js +13 -14
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js +52 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/route-info.js +130 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/route-info.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js +184 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +28 -6
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-message/error-message.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-message/error-message.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js +3 -3
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-layout/error-overlay-layout.js +4 -4
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-layout/error-overlay-layout.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.js +2 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.stories.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-nav/error-overlay-nav.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.js +9 -9
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.stories.js +4 -4
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-pagination/error-overlay-pagination.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/terminal/terminal.js +15 -10
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/terminal/terminal.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.js +3 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js +7 -7
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js +5 -5
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/render-error.js +4 -12
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/render-error.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/icons/collapse-icon.js +3 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/icons/collapse-icon.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/icons/stop-icon.js +18 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/icons/stop-icon.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js +2 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/component-styles.js +7 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/component-styles.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js +6 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/hydration-diff/diff-view.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/hydration-diff/diff-view.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/server/get-next-error-feedback-middleware.js +4 -4
- package/dist/esm/client/components/react-dev-overlay/server/get-next-error-feedback-middleware.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/server/middleware-response.js +30 -0
- package/dist/esm/client/components/react-dev-overlay/server/middleware-response.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/server/middleware-turbopack.js +14 -13
- package/dist/esm/client/components/react-dev-overlay/server/middleware-turbopack.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/server/middleware-webpack.js +13 -12
- package/dist/esm/client/components/react-dev-overlay/server/middleware-webpack.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/server/shared.js +0 -26
- package/dist/esm/client/components/react-dev-overlay/server/shared.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/shared.js +2 -0
- package/dist/esm/client/components/react-dev-overlay/shared.js.map +1 -1
- package/dist/esm/client/index.js +2 -3
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/client/link.js.map +1 -1
- package/dist/esm/server/base-server.js +15 -15
- package/dist/esm/server/base-server.js.map +1 -1
- package/dist/esm/server/config-shared.js.map +1 -1
- package/dist/esm/server/config.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +4 -2
- package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +4 -2
- package/dist/esm/server/dev/hot-reloader-webpack.js.map +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/get-rspack.js +32 -0
- package/dist/esm/shared/lib/get-rspack.js.map +1 -0
- package/dist/server/base-server.js +15 -15
- package/dist/server/base-server.js.map +1 -1
- package/dist/server/config-shared.d.ts +3 -3
- package/dist/server/config-shared.js.map +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +4 -2
- package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +4 -2
- package/dist/server/dev/hot-reloader-webpack.js.map +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/get-rspack.d.ts +2 -0
- package/dist/shared/lib/get-rspack.js +54 -0
- package/dist/shared/lib/get-rspack.js.map +1 -0
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/dist/trace/trace-uploader.js +1 -2
- package/dist/trace/trace-uploader.js.map +1 -1
- package/package.json +15 -15
- package/dist/client/components/react-dev-overlay/internal/icons/CollapseIcon.d.ts +0 -3
- package/dist/client/components/react-dev-overlay/internal/icons/CollapseIcon.js +0 -43
- package/dist/client/components/react-dev-overlay/internal/icons/CollapseIcon.js.map +0 -1
- package/dist/esm/client/components/react-dev-overlay/internal/icons/CollapseIcon.js +0 -27
- package/dist/esm/client/components/react-dev-overlay/internal/icons/CollapseIcon.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/build/webpack/plugins/flight-manifest-plugin.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport path from 'path'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport {\n APP_CLIENT_INTERNALS,\n BARREL_OPTIMIZATION_PREFIX,\n CLIENT_REFERENCE_MANIFEST,\n SYSTEM_ENTRYPOINTS,\n} from '../../../shared/lib/constants'\nimport { relative } from 'path'\nimport { getProxiedPluginState } from '../../build-context'\n\nimport { WEBPACK_LAYERS } from '../../../lib/constants'\nimport { normalizePagePath } from '../../../shared/lib/page-path/normalize-page-path'\nimport { CLIENT_STATIC_FILES_RUNTIME_MAIN_APP } from '../../../shared/lib/constants'\nimport { getDeploymentIdQueryOrEmptyString } from '../../deployment-id'\nimport {\n formatBarrelOptimizedResource,\n getModuleReferencesInOrder,\n} from '../utils'\nimport type { ChunkGroup } from 'webpack'\nimport { encodeURIPath } from '../../../shared/lib/encode-uri-path'\nimport type { ModuleInfo } from './flight-client-entry-plugin'\n\ninterface Options {\n dev: boolean\n appDir: string\n experimentalInlineCss: boolean\n}\n\n/**\n * Webpack module id\n */\n// TODO-APP ensure `null` is included as it is used.\ntype ModuleId = string | number /*| null*/\n\n// double indexed chunkId, filename\nexport type ManifestChunks = Array<string>\n\nconst pluginState = getProxiedPluginState({\n ssrModules: {} as { [ssrModuleId: string]: ModuleInfo },\n edgeSsrModules: {} as { [ssrModuleId: string]: ModuleInfo },\n\n rscModules: {} as { [rscModuleId: string]: ModuleInfo },\n edgeRscModules: {} as { [rscModuleId: string]: ModuleInfo },\n})\n\nexport interface ManifestNode {\n [moduleExport: string]: {\n /**\n * Webpack module id\n */\n id: ModuleId\n /**\n * Export name\n */\n name: string\n /**\n * Chunks for the module. JS and CSS.\n */\n chunks: ManifestChunks\n\n /**\n * If chunk contains async module\n */\n async?: boolean\n }\n}\n\nexport interface ClientReferenceManifestForRsc {\n clientModules: ManifestNode\n rscModuleMapping: {\n [moduleId: string]: ManifestNode\n }\n edgeRscModuleMapping: {\n [moduleId: string]: ManifestNode\n }\n}\n\nexport type CssResource = InlinedCssFile | UninlinedCssFile\n\ninterface InlinedCssFile {\n path: string\n inlined: true\n content: string\n}\n\ninterface UninlinedCssFile {\n path: string\n inlined: false\n}\n\nexport interface ClientReferenceManifest extends ClientReferenceManifestForRsc {\n readonly moduleLoading: {\n prefix: string\n crossOrigin: string | null\n }\n ssrModuleMapping: {\n [moduleId: string]: ManifestNode\n }\n edgeSSRModuleMapping: {\n [moduleId: string]: ManifestNode\n }\n entryCSSFiles: {\n [entry: string]: CssResource[]\n }\n entryJSFiles?: {\n [entry: string]: string[]\n }\n}\n\nfunction getAppPathRequiredChunks(\n chunkGroup: webpack.ChunkGroup,\n excludedFiles: Set<string>\n) {\n const deploymentIdChunkQuery = getDeploymentIdQueryOrEmptyString()\n\n const chunks: Array<string> = []\n chunkGroup.chunks.forEach((chunk) => {\n if (SYSTEM_ENTRYPOINTS.has(chunk.name || '')) {\n return null\n }\n\n // Get the actual chunk file names from the chunk file list.\n // It's possible that the chunk is generated via `import()`, in\n // that case the chunk file name will be '[name].[contenthash]'\n // instead of '[name]-[chunkhash]'.\n if (chunk.id != null) {\n const chunkId = '' + chunk.id\n chunk.files.forEach((file) => {\n // It's possible that a chunk also emits CSS files, that will\n // be handled separatedly.\n if (!file.endsWith('.js')) return null\n if (file.endsWith('.hot-update.js')) return null\n if (excludedFiles.has(file)) return null\n\n // We encode the file as a URI because our server (and many other services such as S3)\n // expect to receive reserved characters such as `[` and `]` as encoded. This was\n // previously done for dynamic chunks by patching the webpack runtime but we want\n // these filenames to be managed by React's Flight runtime instead and so we need\n // to implement any special handling of the file name here.\n return chunks.push(\n chunkId,\n encodeURIPath(file) + deploymentIdChunkQuery\n )\n })\n }\n })\n return chunks\n}\n\n// Normalize the entry names to their \"group names\" so a page can easily track\n// all the manifest items it needs from parent groups by looking up the group\n// segments:\n// - app/foo/loading -> app/foo\n// - app/foo/page -> app/foo\n// - app/(group)/@named/foo/page -> app/foo\n// - app/(.)foo/(..)bar/loading -> app/bar\n// - app/[...catchAll]/page -> app\n// - app/foo/@slot/[...catchAll]/page -> app/foo\nfunction entryNameToGroupName(entryName: string) {\n let groupName = entryName\n .slice(0, entryName.lastIndexOf('/'))\n // Remove slots\n .replace(/\\/@[^/]+/g, '')\n // Remove the group with lookahead to make sure it's not interception route\n .replace(/\\/\\([^/]+\\)(?=(\\/|$))/g, '')\n // Remove catch-all routes since they should be part of the parent group that the catch-all would apply to.\n // This is necessary to support parallel routes since multiple page components can be rendered on the same page.\n // In order to do that, we need to ensure that the manifests are merged together by putting them in the same group.\n .replace(/\\/\\[?\\[\\.\\.\\.[^\\]]*]]?/g, '')\n\n // Interception routes\n groupName = groupName\n .replace(/^.+\\/\\(\\.\\.\\.\\)/g, 'app/')\n .replace(/\\/\\(\\.\\)/g, '/')\n\n // Interception routes (recursive)\n while (/\\/[^/]+\\/\\(\\.\\.\\)/.test(groupName)) {\n groupName = groupName.replace(/\\/[^/]+\\/\\(\\.\\.\\)/g, '/')\n }\n\n return groupName\n}\n\nfunction mergeManifest(\n manifest: ClientReferenceManifest,\n manifestToMerge: ClientReferenceManifest\n) {\n Object.assign(manifest.clientModules, manifestToMerge.clientModules)\n Object.assign(manifest.ssrModuleMapping, manifestToMerge.ssrModuleMapping)\n Object.assign(\n manifest.edgeSSRModuleMapping,\n manifestToMerge.edgeSSRModuleMapping\n )\n Object.assign(manifest.entryCSSFiles, manifestToMerge.entryCSSFiles)\n Object.assign(manifest.rscModuleMapping, manifestToMerge.rscModuleMapping)\n Object.assign(\n manifest.edgeRscModuleMapping,\n manifestToMerge.edgeRscModuleMapping\n )\n}\n\nconst PLUGIN_NAME = 'ClientReferenceManifestPlugin'\n\nexport class ClientReferenceManifestPlugin {\n dev: Options['dev'] = false\n appDir: Options['appDir']\n appDirBase: string\n experimentalInlineCss: Options['experimentalInlineCss']\n\n constructor(options: Options) {\n this.dev = options.dev\n this.appDir = options.appDir\n this.appDirBase = path.dirname(this.appDir) + path.sep\n this.experimentalInlineCss = options.experimentalInlineCss\n }\n\n apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: PLUGIN_NAME,\n // Have to be in the optimize stage to run after updating the CSS\n // asset hash via extract mini css plugin.\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,\n },\n () => this.createAsset(compilation, compiler.context)\n )\n })\n }\n\n createAsset(compilation: webpack.Compilation, context: string) {\n const manifestsPerGroup = new Map<string, ClientReferenceManifest[]>()\n const manifestEntryFiles: string[] = []\n\n const configuredCrossOriginLoading =\n compilation.outputOptions.crossOriginLoading\n const crossOriginMode =\n typeof configuredCrossOriginLoading === 'string'\n ? configuredCrossOriginLoading === 'use-credentials'\n ? configuredCrossOriginLoading\n : 'anonymous'\n : null\n\n if (typeof compilation.outputOptions.publicPath !== 'string') {\n throw new Error(\n 'Expected webpack publicPath to be a string when using App Router. To customize where static assets are loaded from, use the `assetPrefix` option in next.config.js. If you are customizing your webpack config please make sure you are not modifying or removing the publicPath configuration option'\n )\n }\n const prefix = compilation.outputOptions.publicPath || ''\n\n // We want to omit any files that will always be loaded on any App Router page\n // because they will already be loaded by the main entrypoint.\n const rootMainFiles: Set<string> = new Set()\n compilation.entrypoints\n .get(CLIENT_STATIC_FILES_RUNTIME_MAIN_APP)\n ?.getFiles()\n .forEach((file) => {\n if (/(?<!\\.hot-update)\\.(js|css)($|\\?)/.test(file)) {\n rootMainFiles.add(file.replace(/\\\\/g, '/'))\n }\n })\n\n for (let [entryName, entrypoint] of compilation.entrypoints) {\n if (\n entryName === CLIENT_STATIC_FILES_RUNTIME_MAIN_APP ||\n entryName === APP_CLIENT_INTERNALS\n ) {\n entryName = ''\n } else if (!/^app[\\\\/]/.test(entryName)) {\n continue\n }\n\n const manifest: ClientReferenceManifest = {\n moduleLoading: {\n prefix,\n crossOrigin: crossOriginMode,\n },\n ssrModuleMapping: {},\n edgeSSRModuleMapping: {},\n clientModules: {},\n entryCSSFiles: {},\n rscModuleMapping: {},\n edgeRscModuleMapping: {},\n }\n\n // Absolute path without the extension\n const chunkEntryName = (this.appDirBase + entryName).replace(\n /[\\\\/]/g,\n path.sep\n )\n\n manifest.entryCSSFiles[chunkEntryName] = entrypoint\n .getFiles()\n .filter((f) => !f.startsWith('static/css/pages/') && f.endsWith('.css'))\n .map((file) => {\n const source = compilation.getAsset(file)!.source.source()\n if (\n this.experimentalInlineCss &&\n // Inline CSS currently does not work properly with HMR, so we only\n // inline CSS in production.\n !this.dev\n ) {\n return {\n inlined: true,\n path: file,\n content: typeof source === 'string' ? source : source.toString(),\n }\n }\n return {\n inlined: false,\n path: file,\n }\n })\n\n const requiredChunks = getAppPathRequiredChunks(entrypoint, rootMainFiles)\n const recordModule = (modId: ModuleId, mod: webpack.NormalModule) => {\n let resource =\n mod.type === 'css/mini-extract'\n ? // @ts-expect-error TODO: use `identifier()` instead.\n mod._identifier.slice(mod._identifier.lastIndexOf('!') + 1)\n : mod.resource\n\n if (!resource) {\n return\n }\n\n const moduleReferences = manifest.clientModules\n const moduleIdMapping = manifest.ssrModuleMapping\n const edgeModuleIdMapping = manifest.edgeSSRModuleMapping\n\n const rscIdMapping = manifest.rscModuleMapping\n const edgeRscIdMapping = manifest.edgeRscModuleMapping\n\n // Note that this isn't that reliable as webpack is still possible to assign\n // additional queries to make sure there's no conflict even using the `named`\n // module ID strategy.\n let ssrNamedModuleId = relative(\n context,\n mod.resourceResolveData?.path || resource\n )\n\n const rscNamedModuleId = relative(\n context,\n mod.resourceResolveData?.path || resource\n )\n\n if (!ssrNamedModuleId.startsWith('.'))\n ssrNamedModuleId = `./${ssrNamedModuleId.replace(/\\\\/g, '/')}`\n\n // The client compiler will always use the CJS Next.js build, so here we\n // also add the mapping for the ESM build (Edge runtime) to consume.\n const esmResource = /[\\\\/]next[\\\\/]dist[\\\\/]/.test(resource)\n ? resource.replace(\n /[\\\\/]next[\\\\/]dist[\\\\/]/,\n '/next/dist/esm/'.replace(/\\//g, path.sep)\n )\n : null\n\n // An extra query param is added to the resource key when it's optimized\n // through the Barrel Loader. That's because the same file might be created\n // as multiple modules (depending on what you import from it).\n // See also: webpack/loaders/next-flight-loader/index.ts.\n if (mod.matchResource?.startsWith(BARREL_OPTIMIZATION_PREFIX)) {\n ssrNamedModuleId = formatBarrelOptimizedResource(\n ssrNamedModuleId,\n mod.matchResource\n )\n resource = formatBarrelOptimizedResource(resource, mod.matchResource)\n }\n\n function addClientReference() {\n const isAsync = Boolean(\n compilation.moduleGraph.isAsync(mod) ||\n pluginState.ssrModules[ssrNamedModuleId]?.async ||\n pluginState.edgeSsrModules[ssrNamedModuleId]?.async\n )\n\n const exportName = resource\n manifest.clientModules[exportName] = {\n id: modId,\n name: '*',\n chunks: requiredChunks,\n async: isAsync,\n }\n if (esmResource) {\n const edgeExportName = esmResource\n manifest.clientModules[edgeExportName] =\n manifest.clientModules[exportName]\n }\n }\n\n function addSSRIdMapping() {\n const exportName = resource\n const moduleInfo = pluginState.ssrModules[ssrNamedModuleId]\n\n if (moduleInfo) {\n moduleIdMapping[modId] = moduleIdMapping[modId] || {}\n moduleIdMapping[modId]['*'] = {\n ...manifest.clientModules[exportName],\n // During SSR, we don't have external chunks to load on the server\n // side with our architecture of Webpack / Turbopack. We can keep\n // this field empty to save some bytes.\n chunks: [],\n id: moduleInfo.moduleId,\n async: moduleInfo.async,\n }\n }\n\n const edgeModuleInfo = pluginState.edgeSsrModules[ssrNamedModuleId]\n\n if (edgeModuleInfo) {\n edgeModuleIdMapping[modId] = edgeModuleIdMapping[modId] || {}\n edgeModuleIdMapping[modId]['*'] = {\n ...manifest.clientModules[exportName],\n // During SSR, we don't have external chunks to load on the server\n // side with our architecture of Webpack / Turbopack. We can keep\n // this field empty to save some bytes.\n chunks: [],\n id: edgeModuleInfo.moduleId,\n async: edgeModuleInfo.async,\n }\n }\n }\n\n function addRSCIdMapping() {\n const exportName = resource\n const moduleInfo = pluginState.rscModules[rscNamedModuleId]\n\n if (moduleInfo) {\n rscIdMapping[modId] = rscIdMapping[modId] || {}\n rscIdMapping[modId]['*'] = {\n ...manifest.clientModules[exportName],\n // During SSR, we don't have external chunks to load on the server\n // side with our architecture of Webpack / Turbopack. We can keep\n // this field empty to save some bytes.\n chunks: [],\n id: moduleInfo.moduleId,\n async: moduleInfo.async,\n }\n }\n\n const edgeModuleInfo = pluginState.ssrModules[rscNamedModuleId]\n\n if (edgeModuleInfo) {\n edgeRscIdMapping[modId] = edgeRscIdMapping[modId] || {}\n edgeRscIdMapping[modId]['*'] = {\n ...manifest.clientModules[exportName],\n // During SSR, we don't have external chunks to load on the server\n // side with our architecture of Webpack / Turbopack. We can keep\n // this field empty to save some bytes.\n chunks: [],\n id: edgeModuleInfo.moduleId,\n async: edgeModuleInfo.async,\n }\n }\n }\n\n addClientReference()\n addSSRIdMapping()\n addRSCIdMapping()\n\n manifest.clientModules = moduleReferences\n manifest.ssrModuleMapping = moduleIdMapping\n manifest.edgeSSRModuleMapping = edgeModuleIdMapping\n manifest.rscModuleMapping = rscIdMapping\n manifest.edgeRscModuleMapping = edgeRscIdMapping\n }\n\n const checkedChunkGroups = new Set()\n const checkedChunks = new Set()\n\n function recordChunkGroup(chunkGroup: ChunkGroup) {\n // Ensure recursion is stopped if we've already checked this chunk group.\n if (checkedChunkGroups.has(chunkGroup)) return\n checkedChunkGroups.add(chunkGroup)\n // Only apply following logic to client module requests from client entry,\n // or if the module is marked as client module. That's because other\n // client modules don't need to be in the manifest at all as they're\n // never be referenced by the server/client boundary.\n // This saves a lot of bytes in the manifest.\n chunkGroup.chunks.forEach((chunk: webpack.Chunk) => {\n // Ensure recursion is stopped if we've already checked this chunk.\n if (checkedChunks.has(chunk)) return\n checkedChunks.add(chunk)\n const entryMods =\n compilation.chunkGraph.getChunkEntryModulesIterable(chunk)\n for (const mod of entryMods) {\n if (mod.layer !== WEBPACK_LAYERS.appPagesBrowser) continue\n\n const request = (mod as webpack.NormalModule).request\n\n if (\n !request ||\n !request.includes('next-flight-client-entry-loader.js?')\n ) {\n continue\n }\n\n const connections = getModuleReferencesInOrder(\n mod,\n compilation.moduleGraph\n )\n\n for (const connection of connections) {\n const dependency = connection.dependency\n if (!dependency) continue\n\n const clientEntryMod = compilation.moduleGraph.getResolvedModule(\n dependency\n ) as webpack.NormalModule\n const modId = compilation.chunkGraph.getModuleId(\n clientEntryMod\n ) as string | number | null\n\n if (modId !== null) {\n recordModule(modId, clientEntryMod)\n } else {\n // If this is a concatenation, register each child to the parent ID.\n if (\n connection.module?.constructor.name === 'ConcatenatedModule'\n ) {\n const concatenatedMod = connection.module\n const concatenatedModId =\n compilation.chunkGraph.getModuleId(concatenatedMod)\n if (concatenatedModId) {\n recordModule(concatenatedModId, clientEntryMod)\n }\n }\n }\n }\n }\n })\n\n // Walk through all children chunk groups too.\n for (const child of chunkGroup.childrenIterable) {\n recordChunkGroup(child)\n }\n }\n\n recordChunkGroup(entrypoint)\n\n // A page's entry name can have extensions. For example, these are both valid:\n // - app/foo/page\n // - app/foo/page.page\n if (/\\/page(\\.[^/]+)?$/.test(entryName)) {\n manifestEntryFiles.push(entryName.replace(/\\/page(\\.[^/]+)?$/, '/page'))\n }\n\n // We also need to create manifests for route handler entrypoints to\n // enable `'use cache'`.\n if (/\\/route$/.test(entryName)) {\n manifestEntryFiles.push(entryName)\n }\n\n const groupName = entryNameToGroupName(entryName)\n if (!manifestsPerGroup.has(groupName)) {\n manifestsPerGroup.set(groupName, [])\n }\n manifestsPerGroup.get(groupName)!.push(manifest)\n }\n\n // Generate per-page manifests.\n for (const pageName of manifestEntryFiles) {\n const mergedManifest: ClientReferenceManifest = {\n moduleLoading: {\n prefix,\n crossOrigin: crossOriginMode,\n },\n ssrModuleMapping: {},\n edgeSSRModuleMapping: {},\n clientModules: {},\n entryCSSFiles: {},\n rscModuleMapping: {},\n edgeRscModuleMapping: {},\n }\n\n const segments = [...entryNameToGroupName(pageName).split('/'), 'page']\n let group = ''\n for (const segment of segments) {\n for (const manifest of manifestsPerGroup.get(group) || []) {\n mergeManifest(mergedManifest, manifest)\n }\n group += (group ? '/' : '') + segment\n }\n\n const json = JSON.stringify(mergedManifest)\n\n const pagePath = pageName.replace(/%5F/g, '_')\n const pageBundlePath = normalizePagePath(pagePath.slice('app'.length))\n compilation.emitAsset(\n 'server/app' + pageBundlePath + '_' + CLIENT_REFERENCE_MANIFEST + '.js',\n new sources.RawSource(\n `globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST[${JSON.stringify(\n pagePath.slice('app'.length)\n )}]=${json}`\n ) as unknown as webpack.sources.RawSource\n )\n }\n }\n}\n"],"names":["ClientReferenceManifestPlugin","pluginState","getProxiedPluginState","ssrModules","edgeSsrModules","rscModules","edgeRscModules","getAppPathRequiredChunks","chunkGroup","excludedFiles","deploymentIdChunkQuery","getDeploymentIdQueryOrEmptyString","chunks","forEach","chunk","SYSTEM_ENTRYPOINTS","has","name","id","chunkId","files","file","endsWith","push","encodeURIPath","entryNameToGroupName","entryName","groupName","slice","lastIndexOf","replace","test","mergeManifest","manifest","manifestToMerge","Object","assign","clientModules","ssrModuleMapping","edgeSSRModuleMapping","entryCSSFiles","rscModuleMapping","edgeRscModuleMapping","PLUGIN_NAME","constructor","options","dev","appDir","appDirBase","path","dirname","sep","experimentalInlineCss","apply","compiler","hooks","compilation","tap","processAssets","stage","webpack","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_HASH","createAsset","context","manifestsPerGroup","Map","manifestEntryFiles","configuredCrossOriginLoading","outputOptions","crossOriginLoading","crossOriginMode","publicPath","Error","prefix","rootMainFiles","Set","entrypoints","get","CLIENT_STATIC_FILES_RUNTIME_MAIN_APP","getFiles","add","entrypoint","APP_CLIENT_INTERNALS","moduleLoading","crossOrigin","chunkEntryName","filter","f","startsWith","map","source","getAsset","inlined","content","toString","requiredChunks","recordModule","modId","mod","resource","type","_identifier","moduleReferences","moduleIdMapping","edgeModuleIdMapping","rscIdMapping","edgeRscIdMapping","ssrNamedModuleId","relative","resourceResolveData","rscNamedModuleId","esmResource","matchResource","BARREL_OPTIMIZATION_PREFIX","formatBarrelOptimizedResource","addClientReference","isAsync","Boolean","moduleGraph","async","exportName","edgeExportName","addSSRIdMapping","moduleInfo","moduleId","edgeModuleInfo","addRSCIdMapping","checkedChunkGroups","checkedChunks","recordChunkGroup","entryMods","chunkGraph","getChunkEntryModulesIterable","layer","WEBPACK_LAYERS","appPagesBrowser","request","includes","connections","getModuleReferencesInOrder","connection","dependency","clientEntryMod","getResolvedModule","getModuleId","module","concatenatedMod","concatenatedModId","child","childrenIterable","set","pageName","mergedManifest","segments","split","group","segment","json","JSON","stringify","pagePath","pageBundlePath","normalizePagePath","length","emitAsset","CLIENT_REFERENCE_MANIFEST","sources","RawSource"],"mappings":"AAAA;;;;;CAKC;;;;+BA8MYA;;;eAAAA;;;8DA5MI;yBACgB;2BAM1B;8BAE+B;4BAEP;mCACG;8BAEgB;uBAI3C;+BAEuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkB9B,MAAMC,cAAcC,IAAAA,mCAAqB,EAAC;IACxCC,YAAY,CAAC;IACbC,gBAAgB,CAAC;IAEjBC,YAAY,CAAC;IACbC,gBAAgB,CAAC;AACnB;AAkEA,SAASC,yBACPC,UAA8B,EAC9BC,aAA0B;IAE1B,MAAMC,yBAAyBC,IAAAA,+CAAiC;IAEhE,MAAMC,SAAwB,EAAE;IAChCJ,WAAWI,MAAM,CAACC,OAAO,CAAC,CAACC;QACzB,IAAIC,6BAAkB,CAACC,GAAG,CAACF,MAAMG,IAAI,IAAI,KAAK;YAC5C,OAAO;QACT;QAEA,4DAA4D;QAC5D,+DAA+D;QAC/D,+DAA+D;QAC/D,mCAAmC;QACnC,IAAIH,MAAMI,EAAE,IAAI,MAAM;YACpB,MAAMC,UAAU,KAAKL,MAAMI,EAAE;YAC7BJ,MAAMM,KAAK,CAACP,OAAO,CAAC,CAACQ;gBACnB,6DAA6D;gBAC7D,0BAA0B;gBAC1B,IAAI,CAACA,KAAKC,QAAQ,CAAC,QAAQ,OAAO;gBAClC,IAAID,KAAKC,QAAQ,CAAC,mBAAmB,OAAO;gBAC5C,IAAIb,cAAcO,GAAG,CAACK,OAAO,OAAO;gBAEpC,sFAAsF;gBACtF,iFAAiF;gBACjF,iFAAiF;gBACjF,iFAAiF;gBACjF,2DAA2D;gBAC3D,OAAOT,OAAOW,IAAI,CAChBJ,SACAK,IAAAA,4BAAa,EAACH,QAAQX;YAE1B;QACF;IACF;IACA,OAAOE;AACT;AAEA,8EAA8E;AAC9E,6EAA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AGlB;IACF;AACF"}
|
1
|
+
{"version":3,"sources":["../../../../src/build/webpack/plugins/flight-manifest-plugin.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport path from 'path'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport {\n APP_CLIENT_INTERNALS,\n BARREL_OPTIMIZATION_PREFIX,\n CLIENT_REFERENCE_MANIFEST,\n SYSTEM_ENTRYPOINTS,\n} from '../../../shared/lib/constants'\nimport { relative } from 'path'\nimport { getProxiedPluginState } from '../../build-context'\n\nimport { WEBPACK_LAYERS } from '../../../lib/constants'\nimport { normalizePagePath } from '../../../shared/lib/page-path/normalize-page-path'\nimport { CLIENT_STATIC_FILES_RUNTIME_MAIN_APP } from '../../../shared/lib/constants'\nimport { getDeploymentIdQueryOrEmptyString } from '../../deployment-id'\nimport {\n formatBarrelOptimizedResource,\n getModuleReferencesInOrder,\n} from '../utils'\nimport type { ChunkGroup } from 'webpack'\nimport { encodeURIPath } from '../../../shared/lib/encode-uri-path'\nimport type { ModuleInfo } from './flight-client-entry-plugin'\n\ninterface Options {\n dev: boolean\n appDir: string\n experimentalInlineCss: boolean\n}\n\n/**\n * Webpack module id\n */\n// TODO-APP ensure `null` is included as it is used.\ntype ModuleId = string | number /*| null*/\n\n// double indexed chunkId, filename\nexport type ManifestChunks = Array<string>\n\nconst pluginState = getProxiedPluginState({\n ssrModules: {} as { [ssrModuleId: string]: ModuleInfo },\n edgeSsrModules: {} as { [ssrModuleId: string]: ModuleInfo },\n\n rscModules: {} as { [rscModuleId: string]: ModuleInfo },\n edgeRscModules: {} as { [rscModuleId: string]: ModuleInfo },\n})\n\nexport interface ManifestNode {\n [moduleExport: string]: {\n /**\n * Webpack module id\n */\n id: ModuleId\n /**\n * Export name\n */\n name: string\n /**\n * Chunks for the module. JS and CSS.\n */\n chunks: ManifestChunks\n\n /**\n * If chunk contains async module\n */\n async?: boolean\n }\n}\n\nexport interface ClientReferenceManifestForRsc {\n clientModules: ManifestNode\n rscModuleMapping: {\n [moduleId: string]: ManifestNode\n }\n edgeRscModuleMapping: {\n [moduleId: string]: ManifestNode\n }\n}\n\nexport type CssResource = InlinedCssFile | UninlinedCssFile\n\ninterface InlinedCssFile {\n path: string\n inlined: true\n content: string\n}\n\ninterface UninlinedCssFile {\n path: string\n inlined: false\n}\n\nexport interface ClientReferenceManifest extends ClientReferenceManifestForRsc {\n readonly moduleLoading: {\n prefix: string\n crossOrigin: string | null\n }\n ssrModuleMapping: {\n [moduleId: string]: ManifestNode\n }\n edgeSSRModuleMapping: {\n [moduleId: string]: ManifestNode\n }\n entryCSSFiles: {\n [entry: string]: CssResource[]\n }\n entryJSFiles?: {\n [entry: string]: string[]\n }\n}\n\nfunction getAppPathRequiredChunks(\n chunkGroup: webpack.ChunkGroup,\n excludedFiles: Set<string>\n) {\n const deploymentIdChunkQuery = getDeploymentIdQueryOrEmptyString()\n\n const chunks: Array<string> = []\n chunkGroup.chunks.forEach((chunk) => {\n if (SYSTEM_ENTRYPOINTS.has(chunk.name || '')) {\n return null\n }\n\n // Get the actual chunk file names from the chunk file list.\n // It's possible that the chunk is generated via `import()`, in\n // that case the chunk file name will be '[name].[contenthash]'\n // instead of '[name]-[chunkhash]'.\n if (chunk.id != null) {\n const chunkId = '' + chunk.id\n chunk.files.forEach((file) => {\n // It's possible that a chunk also emits CSS files, that will\n // be handled separatedly.\n if (!file.endsWith('.js')) return null\n if (file.endsWith('.hot-update.js')) return null\n if (excludedFiles.has(file)) return null\n\n // We encode the file as a URI because our server (and many other services such as S3)\n // expect to receive reserved characters such as `[` and `]` as encoded. This was\n // previously done for dynamic chunks by patching the webpack runtime but we want\n // these filenames to be managed by React's Flight runtime instead and so we need\n // to implement any special handling of the file name here.\n return chunks.push(\n chunkId,\n encodeURIPath(file) + deploymentIdChunkQuery\n )\n })\n }\n })\n return chunks\n}\n\n// Normalize the entry names to their \"group names\" so a page can easily track\n// all the manifest items it needs from parent groups by looking up the group\n// segments:\n// - app/foo/loading -> app/foo\n// - app/foo/page -> app/foo\n// - app/(group)/@named/foo/page -> app/foo\n// - app/(.)foo/(..)bar/loading -> app/bar\n// - app/[...catchAll]/page -> app\n// - app/foo/@slot/[...catchAll]/page -> app/foo\nfunction entryNameToGroupName(entryName: string) {\n let groupName = entryName\n .slice(0, entryName.lastIndexOf('/'))\n // Remove slots\n .replace(/\\/@[^/]+/g, '')\n // Remove the group with lookahead to make sure it's not interception route\n .replace(/\\/\\([^/]+\\)(?=(\\/|$))/g, '')\n // Remove catch-all routes since they should be part of the parent group that the catch-all would apply to.\n // This is necessary to support parallel routes since multiple page components can be rendered on the same page.\n // In order to do that, we need to ensure that the manifests are merged together by putting them in the same group.\n .replace(/\\/\\[?\\[\\.\\.\\.[^\\]]*]]?/g, '')\n\n // Interception routes\n groupName = groupName\n .replace(/^.+\\/\\(\\.\\.\\.\\)/g, 'app/')\n .replace(/\\/\\(\\.\\)/g, '/')\n\n // Interception routes (recursive)\n while (/\\/[^/]+\\/\\(\\.\\.\\)/.test(groupName)) {\n groupName = groupName.replace(/\\/[^/]+\\/\\(\\.\\.\\)/g, '/')\n }\n\n return groupName\n}\n\nfunction mergeManifest(\n manifest: ClientReferenceManifest,\n manifestToMerge: ClientReferenceManifest\n) {\n Object.assign(manifest.clientModules, manifestToMerge.clientModules)\n Object.assign(manifest.ssrModuleMapping, manifestToMerge.ssrModuleMapping)\n Object.assign(\n manifest.edgeSSRModuleMapping,\n manifestToMerge.edgeSSRModuleMapping\n )\n Object.assign(manifest.entryCSSFiles, manifestToMerge.entryCSSFiles)\n Object.assign(manifest.rscModuleMapping, manifestToMerge.rscModuleMapping)\n Object.assign(\n manifest.edgeRscModuleMapping,\n manifestToMerge.edgeRscModuleMapping\n )\n}\n\nconst PLUGIN_NAME = 'ClientReferenceManifestPlugin'\n\nexport class ClientReferenceManifestPlugin {\n dev: Options['dev'] = false\n appDir: Options['appDir']\n appDirBase: string\n experimentalInlineCss: Options['experimentalInlineCss']\n\n constructor(options: Options) {\n this.dev = options.dev\n this.appDir = options.appDir\n this.appDirBase = path.dirname(this.appDir) + path.sep\n this.experimentalInlineCss = options.experimentalInlineCss\n }\n\n apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: PLUGIN_NAME,\n // Have to be in the optimize stage to run after updating the CSS\n // asset hash via extract mini css plugin.\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,\n },\n () => this.createAsset(compilation, compiler.context)\n )\n })\n }\n\n createAsset(compilation: webpack.Compilation, context: string) {\n const manifestsPerGroup = new Map<string, ClientReferenceManifest[]>()\n const manifestEntryFiles: string[] = []\n\n const configuredCrossOriginLoading =\n compilation.outputOptions.crossOriginLoading\n const crossOriginMode =\n typeof configuredCrossOriginLoading === 'string'\n ? configuredCrossOriginLoading === 'use-credentials'\n ? configuredCrossOriginLoading\n : 'anonymous'\n : null\n\n if (typeof compilation.outputOptions.publicPath !== 'string') {\n throw new Error(\n 'Expected webpack publicPath to be a string when using App Router. To customize where static assets are loaded from, use the `assetPrefix` option in next.config.js. If you are customizing your webpack config please make sure you are not modifying or removing the publicPath configuration option'\n )\n }\n const prefix = compilation.outputOptions.publicPath || ''\n\n // We want to omit any files that will always be loaded on any App Router page\n // because they will already be loaded by the main entrypoint.\n const rootMainFiles: Set<string> = new Set()\n compilation.entrypoints\n .get(CLIENT_STATIC_FILES_RUNTIME_MAIN_APP)\n ?.getFiles()\n .forEach((file) => {\n if (/(?<!\\.hot-update)\\.(js|css)($|\\?)/.test(file)) {\n rootMainFiles.add(file.replace(/\\\\/g, '/'))\n }\n })\n\n for (let [entryName, entrypoint] of compilation.entrypoints) {\n if (\n entryName === CLIENT_STATIC_FILES_RUNTIME_MAIN_APP ||\n entryName === APP_CLIENT_INTERNALS\n ) {\n entryName = ''\n } else if (!/^app[\\\\/]/.test(entryName)) {\n continue\n }\n\n const manifest: ClientReferenceManifest = {\n moduleLoading: {\n prefix,\n crossOrigin: crossOriginMode,\n },\n ssrModuleMapping: {},\n edgeSSRModuleMapping: {},\n clientModules: {},\n entryCSSFiles: {},\n rscModuleMapping: {},\n edgeRscModuleMapping: {},\n }\n\n // Absolute path without the extension\n const chunkEntryName = (this.appDirBase + entryName).replace(\n /[\\\\/]/g,\n path.sep\n )\n\n manifest.entryCSSFiles[chunkEntryName] = entrypoint\n .getFiles()\n .filter((f) => !f.startsWith('static/css/pages/') && f.endsWith('.css'))\n .map((file) => {\n const source = compilation.getAsset(file)!.source.source()\n if (\n this.experimentalInlineCss &&\n // Inline CSS currently does not work properly with HMR, so we only\n // inline CSS in production.\n !this.dev\n ) {\n return {\n inlined: true,\n path: file,\n content: typeof source === 'string' ? source : source.toString(),\n }\n }\n return {\n inlined: false,\n path: file,\n }\n })\n\n const requiredChunks = getAppPathRequiredChunks(entrypoint, rootMainFiles)\n const recordModule = (modId: ModuleId, mod: webpack.NormalModule) => {\n let resource =\n mod.type === 'css/mini-extract'\n ? mod.identifier().slice(mod.identifier().lastIndexOf('!') + 1)\n : mod.resource\n\n if (!resource) {\n return\n }\n\n const moduleReferences = manifest.clientModules\n const moduleIdMapping = manifest.ssrModuleMapping\n const edgeModuleIdMapping = manifest.edgeSSRModuleMapping\n\n const rscIdMapping = manifest.rscModuleMapping\n const edgeRscIdMapping = manifest.edgeRscModuleMapping\n\n // Note that this isn't that reliable as webpack is still possible to assign\n // additional queries to make sure there's no conflict even using the `named`\n // module ID strategy.\n let ssrNamedModuleId = relative(\n context,\n mod.resourceResolveData?.path || resource\n )\n\n const rscNamedModuleId = relative(\n context,\n mod.resourceResolveData?.path || resource\n )\n\n if (!ssrNamedModuleId.startsWith('.'))\n ssrNamedModuleId = `./${ssrNamedModuleId.replace(/\\\\/g, '/')}`\n\n // The client compiler will always use the CJS Next.js build, so here we\n // also add the mapping for the ESM build (Edge runtime) to consume.\n const esmResource = /[\\\\/]next[\\\\/]dist[\\\\/]/.test(resource)\n ? resource.replace(\n /[\\\\/]next[\\\\/]dist[\\\\/]/,\n '/next/dist/esm/'.replace(/\\//g, path.sep)\n )\n : null\n\n // An extra query param is added to the resource key when it's optimized\n // through the Barrel Loader. That's because the same file might be created\n // as multiple modules (depending on what you import from it).\n // See also: webpack/loaders/next-flight-loader/index.ts.\n if (mod.matchResource?.startsWith(BARREL_OPTIMIZATION_PREFIX)) {\n ssrNamedModuleId = formatBarrelOptimizedResource(\n ssrNamedModuleId,\n mod.matchResource\n )\n resource = formatBarrelOptimizedResource(resource, mod.matchResource)\n }\n\n function addClientReference() {\n const isAsync = Boolean(\n compilation.moduleGraph.isAsync(mod) ||\n pluginState.ssrModules[ssrNamedModuleId]?.async ||\n pluginState.edgeSsrModules[ssrNamedModuleId]?.async\n )\n\n const exportName = resource\n manifest.clientModules[exportName] = {\n id: modId,\n name: '*',\n chunks: requiredChunks,\n async: isAsync,\n }\n if (esmResource) {\n const edgeExportName = esmResource\n manifest.clientModules[edgeExportName] =\n manifest.clientModules[exportName]\n }\n }\n\n function addSSRIdMapping() {\n const exportName = resource\n const moduleInfo = pluginState.ssrModules[ssrNamedModuleId]\n\n if (moduleInfo) {\n moduleIdMapping[modId] = moduleIdMapping[modId] || {}\n moduleIdMapping[modId]['*'] = {\n ...manifest.clientModules[exportName],\n // During SSR, we don't have external chunks to load on the server\n // side with our architecture of Webpack / Turbopack. We can keep\n // this field empty to save some bytes.\n chunks: [],\n id: moduleInfo.moduleId,\n async: moduleInfo.async,\n }\n }\n\n const edgeModuleInfo = pluginState.edgeSsrModules[ssrNamedModuleId]\n\n if (edgeModuleInfo) {\n edgeModuleIdMapping[modId] = edgeModuleIdMapping[modId] || {}\n edgeModuleIdMapping[modId]['*'] = {\n ...manifest.clientModules[exportName],\n // During SSR, we don't have external chunks to load on the server\n // side with our architecture of Webpack / Turbopack. We can keep\n // this field empty to save some bytes.\n chunks: [],\n id: edgeModuleInfo.moduleId,\n async: edgeModuleInfo.async,\n }\n }\n }\n\n function addRSCIdMapping() {\n const exportName = resource\n const moduleInfo = pluginState.rscModules[rscNamedModuleId]\n\n if (moduleInfo) {\n rscIdMapping[modId] = rscIdMapping[modId] || {}\n rscIdMapping[modId]['*'] = {\n ...manifest.clientModules[exportName],\n // During SSR, we don't have external chunks to load on the server\n // side with our architecture of Webpack / Turbopack. We can keep\n // this field empty to save some bytes.\n chunks: [],\n id: moduleInfo.moduleId,\n async: moduleInfo.async,\n }\n }\n\n const edgeModuleInfo = pluginState.ssrModules[rscNamedModuleId]\n\n if (edgeModuleInfo) {\n edgeRscIdMapping[modId] = edgeRscIdMapping[modId] || {}\n edgeRscIdMapping[modId]['*'] = {\n ...manifest.clientModules[exportName],\n // During SSR, we don't have external chunks to load on the server\n // side with our architecture of Webpack / Turbopack. We can keep\n // this field empty to save some bytes.\n chunks: [],\n id: edgeModuleInfo.moduleId,\n async: edgeModuleInfo.async,\n }\n }\n }\n\n addClientReference()\n addSSRIdMapping()\n addRSCIdMapping()\n\n manifest.clientModules = moduleReferences\n manifest.ssrModuleMapping = moduleIdMapping\n manifest.edgeSSRModuleMapping = edgeModuleIdMapping\n manifest.rscModuleMapping = rscIdMapping\n manifest.edgeRscModuleMapping = edgeRscIdMapping\n }\n\n const checkedChunkGroups = new Set()\n const checkedChunks = new Set()\n\n function recordChunkGroup(chunkGroup: ChunkGroup) {\n // Ensure recursion is stopped if we've already checked this chunk group.\n if (checkedChunkGroups.has(chunkGroup)) return\n checkedChunkGroups.add(chunkGroup)\n // Only apply following logic to client module requests from client entry,\n // or if the module is marked as client module. That's because other\n // client modules don't need to be in the manifest at all as they're\n // never be referenced by the server/client boundary.\n // This saves a lot of bytes in the manifest.\n chunkGroup.chunks.forEach((chunk: webpack.Chunk) => {\n // Ensure recursion is stopped if we've already checked this chunk.\n if (checkedChunks.has(chunk)) return\n checkedChunks.add(chunk)\n const entryMods =\n compilation.chunkGraph.getChunkEntryModulesIterable(chunk)\n for (const mod of entryMods) {\n if (mod.layer !== WEBPACK_LAYERS.appPagesBrowser) continue\n\n const request = (mod as webpack.NormalModule).request\n\n if (\n !request ||\n !request.includes('next-flight-client-entry-loader.js?')\n ) {\n continue\n }\n\n const connections = getModuleReferencesInOrder(\n mod,\n compilation.moduleGraph\n )\n\n for (const connection of connections) {\n const dependency = connection.dependency\n if (!dependency) continue\n\n const clientEntryMod = compilation.moduleGraph.getResolvedModule(\n dependency\n ) as webpack.NormalModule\n const modId = compilation.chunkGraph.getModuleId(\n clientEntryMod\n ) as string | number | null\n\n if (modId !== null) {\n recordModule(modId, clientEntryMod)\n } else {\n // If this is a concatenation, register each child to the parent ID.\n if (\n connection.module?.constructor.name ===\n 'ConcatenatedModule' ||\n (Boolean(process.env.NEXT_RSPACK) &&\n (connection.module as any)?.constructorName ===\n 'ConcatenatedModule')\n ) {\n const concatenatedMod = connection.module\n const concatenatedModId =\n compilation.chunkGraph.getModuleId(concatenatedMod)\n if (concatenatedModId) {\n recordModule(concatenatedModId, clientEntryMod)\n }\n }\n }\n }\n }\n })\n\n // Walk through all children chunk groups too.\n for (const child of chunkGroup.childrenIterable) {\n recordChunkGroup(child)\n }\n }\n\n recordChunkGroup(entrypoint)\n\n // A page's entry name can have extensions. For example, these are both valid:\n // - app/foo/page\n // - app/foo/page.page\n if (/\\/page(\\.[^/]+)?$/.test(entryName)) {\n manifestEntryFiles.push(entryName.replace(/\\/page(\\.[^/]+)?$/, '/page'))\n }\n\n // We also need to create manifests for route handler entrypoints to\n // enable `'use cache'`.\n if (/\\/route$/.test(entryName)) {\n manifestEntryFiles.push(entryName)\n }\n\n const groupName = entryNameToGroupName(entryName)\n if (!manifestsPerGroup.has(groupName)) {\n manifestsPerGroup.set(groupName, [])\n }\n manifestsPerGroup.get(groupName)!.push(manifest)\n }\n\n // Generate per-page manifests.\n for (const pageName of manifestEntryFiles) {\n const mergedManifest: ClientReferenceManifest = {\n moduleLoading: {\n prefix,\n crossOrigin: crossOriginMode,\n },\n ssrModuleMapping: {},\n edgeSSRModuleMapping: {},\n clientModules: {},\n entryCSSFiles: {},\n rscModuleMapping: {},\n edgeRscModuleMapping: {},\n }\n\n const segments = [...entryNameToGroupName(pageName).split('/'), 'page']\n let group = ''\n for (const segment of segments) {\n for (const manifest of manifestsPerGroup.get(group) || []) {\n mergeManifest(mergedManifest, manifest)\n }\n group += (group ? '/' : '') + segment\n }\n\n const json = JSON.stringify(mergedManifest)\n\n const pagePath = pageName.replace(/%5F/g, '_')\n const pageBundlePath = normalizePagePath(pagePath.slice('app'.length))\n compilation.emitAsset(\n 'server/app' + pageBundlePath + '_' + CLIENT_REFERENCE_MANIFEST + '.js',\n new sources.RawSource(\n `globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST[${JSON.stringify(\n pagePath.slice('app'.length)\n )}]=${json}`\n ) as unknown as webpack.sources.RawSource\n )\n }\n }\n}\n"],"names":["ClientReferenceManifestPlugin","pluginState","getProxiedPluginState","ssrModules","edgeSsrModules","rscModules","edgeRscModules","getAppPathRequiredChunks","chunkGroup","excludedFiles","deploymentIdChunkQuery","getDeploymentIdQueryOrEmptyString","chunks","forEach","chunk","SYSTEM_ENTRYPOINTS","has","name","id","chunkId","files","file","endsWith","push","encodeURIPath","entryNameToGroupName","entryName","groupName","slice","lastIndexOf","replace","test","mergeManifest","manifest","manifestToMerge","Object","assign","clientModules","ssrModuleMapping","edgeSSRModuleMapping","entryCSSFiles","rscModuleMapping","edgeRscModuleMapping","PLUGIN_NAME","constructor","options","dev","appDir","appDirBase","path","dirname","sep","experimentalInlineCss","apply","compiler","hooks","compilation","tap","processAssets","stage","webpack","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_HASH","createAsset","context","manifestsPerGroup","Map","manifestEntryFiles","configuredCrossOriginLoading","outputOptions","crossOriginLoading","crossOriginMode","publicPath","Error","prefix","rootMainFiles","Set","entrypoints","get","CLIENT_STATIC_FILES_RUNTIME_MAIN_APP","getFiles","add","entrypoint","APP_CLIENT_INTERNALS","moduleLoading","crossOrigin","chunkEntryName","filter","f","startsWith","map","source","getAsset","inlined","content","toString","requiredChunks","recordModule","modId","mod","resource","type","identifier","moduleReferences","moduleIdMapping","edgeModuleIdMapping","rscIdMapping","edgeRscIdMapping","ssrNamedModuleId","relative","resourceResolveData","rscNamedModuleId","esmResource","matchResource","BARREL_OPTIMIZATION_PREFIX","formatBarrelOptimizedResource","addClientReference","isAsync","Boolean","moduleGraph","async","exportName","edgeExportName","addSSRIdMapping","moduleInfo","moduleId","edgeModuleInfo","addRSCIdMapping","checkedChunkGroups","checkedChunks","recordChunkGroup","entryMods","chunkGraph","getChunkEntryModulesIterable","layer","WEBPACK_LAYERS","appPagesBrowser","request","includes","connections","getModuleReferencesInOrder","connection","dependency","clientEntryMod","getResolvedModule","getModuleId","module","process","env","NEXT_RSPACK","constructorName","concatenatedMod","concatenatedModId","child","childrenIterable","set","pageName","mergedManifest","segments","split","group","segment","json","JSON","stringify","pagePath","pageBundlePath","normalizePagePath","length","emitAsset","CLIENT_REFERENCE_MANIFEST","sources","RawSource"],"mappings":"AAAA;;;;;CAKC;;;;+BA8MYA;;;eAAAA;;;8DA5MI;yBACgB;2BAM1B;8BAE+B;4BAEP;mCACG;8BAEgB;uBAI3C;+BAEuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkB9B,MAAMC,cAAcC,IAAAA,mCAAqB,EAAC;IACxCC,YAAY,CAAC;IACbC,gBAAgB,CAAC;IAEjBC,YAAY,CAAC;IACbC,gBAAgB,CAAC;AACnB;AAkEA,SAASC,yBACPC,UAA8B,EAC9BC,aAA0B;IAE1B,MAAMC,yBAAyBC,IAAAA,+CAAiC;IAEhE,MAAMC,SAAwB,EAAE;IAChCJ,WAAWI,MAAM,CAACC,OAAO,CAAC,CAACC;QACzB,IAAIC,6BAAkB,CAACC,GAAG,CAACF,MAAMG,IAAI,IAAI,KAAK;YAC5C,OAAO;QAC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C;gBACnBC,sBAAsB,CAAC;YACzB;YAEA,MAAMoH,WAAW;mBAAIrI,qBAAqBmI,UAAUG,KAAK,CAAC;gBAAM;aAAO;YACvE,IAAIC,QAAQ;YACZ,KAAK,MAAMC,WAAWH,SAAU;gBAC9B,KAAK,MAAM7H,YAAYgC,kBAAkBa,GAAG,CAACkF,UAAU,EAAE,CAAE;oBACzDhI,cAAc6H,gBAAgB5H;gBAChC;gBACA+H,SAAS,AAACA,CAAAA,QAAQ,MAAM,EAAC,IAAKC;YAChC;YAEA,MAAMC,OAAOC,KAAKC,SAAS,CAACP;YAE5B,MAAMQ,WAAWT,SAAS9H,OAAO,CAAC,QAAQ;YAC1C,MAAMwI,iBAAiBC,IAAAA,oCAAiB,EAACF,SAASzI,KAAK,CAAC,MAAM4I,MAAM;YACpEhH,YAAYiH,SAAS,CACnB,eAAeH,iBAAiB,MAAMI,oCAAyB,GAAG,OAClE,IAAIC,gBAAO,CAACC,SAAS,CACnB,CAAC,oFAAoF,EAAET,KAAKC,SAAS,CACnGC,SAASzI,KAAK,CAAC,MAAM4I,MAAM,GAC3B,EAAE,EAAEN,MAAM;QAGlB;IACF;AACF"}
|
@@ -503,9 +503,12 @@ class MiddlewarePlugin {
|
|
503
503
|
compiler,
|
504
504
|
compilation
|
505
505
|
});
|
506
|
-
hooks
|
507
|
-
|
508
|
-
|
506
|
+
// parser hooks aren't available in rspack
|
507
|
+
if (!process.env.NEXT_RSPACK) {
|
508
|
+
hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer);
|
509
|
+
hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer);
|
510
|
+
hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer);
|
511
|
+
}
|
509
512
|
/**
|
510
513
|
* Extract all metadata for the entry points in a Map object.
|
511
514
|
*/ const metadataByEntry = new Map();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/build/webpack/plugins/middleware-plugin.ts"],"sourcesContent":["import type {\n AssetBinding,\n EdgeMiddlewareMeta,\n} from '../loaders/get-module-build-info'\nimport type { EdgeSSRMeta } from '../loaders/get-module-build-info'\nimport type { MiddlewareMatcher } from '../../analysis/get-page-static-info'\nimport { getNamedMiddlewareRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport path from 'path'\nimport {\n EDGE_RUNTIME_WEBPACK,\n EDGE_UNSUPPORTED_NODE_APIS,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n MIDDLEWARE_MANIFEST,\n MIDDLEWARE_REACT_LOADABLE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n NEXT_FONT_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n} from '../../../shared/lib/constants'\nimport type { MiddlewareConfig } from '../../analysis/get-page-static-info'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport { traceGlobals } from '../../../trace/shared'\nimport { EVENT_BUILD_FEATURE_USAGE } from '../../../telemetry/events'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport {\n INSTRUMENTATION_HOOK_FILENAME,\n WEBPACK_LAYERS,\n} from '../../../lib/constants'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport { getDynamicCodeEvaluationError } from './wellknown-errors-plugin/parse-dynamic-code-evaluation-error'\nimport { getModuleReferencesInOrder } from '../utils'\n\nconst KNOWN_SAFE_DYNAMIC_PACKAGES =\n require('../../../lib/known-edge-safe-packages.json') as string[]\n\nexport interface EdgeFunctionDefinition {\n files: string[]\n name: string\n page: string\n matchers: MiddlewareMatcher[]\n env: Record<string, string>\n wasm?: AssetBinding[]\n assets?: AssetBinding[]\n regions?: string[] | string\n}\n\nexport interface MiddlewareManifest {\n version: 3\n sortedMiddleware: string[]\n middleware: { [page: string]: EdgeFunctionDefinition }\n functions: { [page: string]: EdgeFunctionDefinition }\n}\n\ninterface EntryMetadata {\n edgeMiddleware?: EdgeMiddlewareMeta\n edgeApiFunction?: EdgeMiddlewareMeta\n edgeSSR?: EdgeSSRMeta\n wasmBindings: Map<string, string>\n assetBindings: Map<string, string>\n regions?: string[] | string\n}\n\nconst NAME = 'MiddlewarePlugin'\nconst MANIFEST_VERSION = 3\n\n/**\n * Checks the value of usingIndirectEval and when it is a set of modules it\n * check if any of the modules is actually being used. If the value is\n * simply truthy it will return true.\n */\nfunction isUsingIndirectEvalAndUsedByExports(args: {\n module: webpack.Module\n moduleGraph: webpack.ModuleGraph\n runtime: any\n usingIndirectEval: true | Set<string>\n wp: typeof webpack\n}): boolean {\n const { moduleGraph, runtime, module, usingIndirectEval, wp } = args\n if (typeof usingIndirectEval === 'boolean') {\n return usingIndirectEval\n }\n\n const exportsInfo = moduleGraph.getExportsInfo(module)\n for (const exportName of usingIndirectEval) {\n if (exportsInfo.getUsed(exportName, runtime) !== wp.UsageState.Unused) {\n return true\n }\n }\n\n return false\n}\n\nfunction getEntryFiles(\n entryFiles: string[],\n meta: EntryMetadata,\n hasInstrumentationHook: boolean,\n opts: Options\n) {\n const files: string[] = []\n if (meta.edgeSSR) {\n if (meta.edgeSSR.isServerComponent) {\n files.push(`server/${SERVER_REFERENCE_MANIFEST}.js`)\n if (opts.sriEnabled) {\n files.push(`server/${SUBRESOURCE_INTEGRITY_MANIFEST}.js`)\n }\n files.push(\n ...entryFiles\n .filter(\n (file) =>\n file.startsWith('app/') && !file.endsWith('.hot-update.js')\n )\n .map(\n (file) =>\n 'server/' +\n file.replace(/\\.js$/, '_' + CLIENT_REFERENCE_MANIFEST + '.js')\n )\n )\n }\n if (!opts.dev && !meta.edgeSSR.isAppDir) {\n files.push(`server/${DYNAMIC_CSS_MANIFEST}.js`)\n }\n\n files.push(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,\n `server/${NEXT_FONT_MANIFEST}.js`,\n `server/${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n }\n\n if (hasInstrumentationHook) {\n files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`)\n }\n\n files.push(\n ...entryFiles\n .filter((file) => !file.endsWith('.hot-update.js'))\n .map((file) => 'server/' + file)\n )\n\n return files\n}\n\nfunction getCreateAssets(params: {\n compilation: webpack.Compilation\n metadataByEntry: Map<string, EntryMetadata>\n opts: Options\n}) {\n const { compilation, metadataByEntry, opts } = params\n return () => {\n const middlewareManifest: MiddlewareManifest = {\n version: MANIFEST_VERSION,\n middleware: {},\n functions: {},\n sortedMiddleware: [],\n }\n\n const hasInstrumentationHook = compilation.entrypoints.has(\n INSTRUMENTATION_HOOK_FILENAME\n )\n\n // we only emit this entry for the edge runtime since it doesn't have access to a routes manifest\n // and we don't need to provide the entire route manifest, just the interception routes.\n const interceptionRewrites = JSON.stringify(\n opts.rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n compilation.emitAsset(\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )}`\n ) as unknown as webpack.sources.RawSource\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (!entrypoint.name) {\n continue\n }\n\n // There should always be metadata for the entrypoint.\n const metadata = metadataByEntry.get(entrypoint.name)\n const page =\n metadata?.edgeMiddleware?.page ||\n metadata?.edgeSSR?.page ||\n metadata?.edgeApiFunction?.page\n if (!page) {\n continue\n }\n\n const matcherSource = metadata.edgeSSR?.isAppDir\n ? normalizeAppPath(page)\n : page\n\n const catchAll = !metadata.edgeSSR && !metadata.edgeApiFunction\n\n const { namedRegex } = getNamedMiddlewareRegex(matcherSource, {\n catchAll,\n })\n const matchers = metadata?.edgeMiddleware?.matchers ?? [\n {\n regexp: namedRegex,\n originalSource: page === '/' && catchAll ? '/:path*' : matcherSource,\n },\n ]\n\n const isEdgeFunction = !!(metadata.edgeApiFunction || metadata.edgeSSR)\n const edgeFunctionDefinition: EdgeFunctionDefinition = {\n files: getEntryFiles(\n entrypoint.getFiles(),\n metadata,\n hasInstrumentationHook,\n opts\n ),\n name: entrypoint.name,\n page: page,\n matchers,\n wasm: Array.from(metadata.wasmBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n assets: Array.from(metadata.assetBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n env: opts.edgeEnvironments,\n ...(metadata.regions && { regions: metadata.regions }),\n }\n\n if (isEdgeFunction) {\n middlewareManifest.functions[page] = edgeFunctionDefinition\n } else {\n middlewareManifest.middleware[page] = edgeFunctionDefinition\n }\n }\n\n middlewareManifest.sortedMiddleware = getSortedRoutes(\n Object.keys(middlewareManifest.middleware)\n )\n\n compilation.emitAsset(\n MIDDLEWARE_MANIFEST,\n new sources.RawSource(\n JSON.stringify(middlewareManifest, null, 2)\n ) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction buildWebpackError({\n message,\n loc,\n compilation,\n entryModule,\n parser,\n}: {\n message: string\n loc?: any\n compilation: webpack.Compilation\n entryModule?: webpack.Module\n parser?: webpack.javascript.JavascriptParser\n}) {\n const error = new compilation.compiler.webpack.WebpackError(message)\n error.name = NAME\n const module = entryModule ?? parser?.state.current\n if (module) {\n error.module = module\n }\n error.loc = loc\n return error\n}\n\nfunction isInMiddlewareLayer(parser: webpack.javascript.JavascriptParser) {\n const layer = parser.state.module?.layer\n return layer === WEBPACK_LAYERS.middleware || layer === WEBPACK_LAYERS.api\n}\n\nfunction isNodeJsModule(moduleName: string) {\n return require('module').builtinModules.includes(moduleName)\n}\n\nfunction isDynamicCodeEvaluationAllowed(\n fileName: string,\n middlewareConfig?: MiddlewareConfig,\n rootDir?: string\n) {\n // Some packages are known to use `eval` but are safe to use in the Edge\n // Runtime because the dynamic code will never be executed.\n if (\n KNOWN_SAFE_DYNAMIC_PACKAGES.some((pkg) =>\n fileName.includes(`/node_modules/${pkg}/`.replace(/\\//g, path.sep))\n )\n ) {\n return true\n }\n\n const name = fileName.replace(rootDir ?? '', '')\n\n return picomatch(middlewareConfig?.unstable_allowDynamic ?? [], {\n dot: true,\n })(name)\n}\n\nfunction buildUnsupportedApiError({\n apiName,\n loc,\n ...rest\n}: {\n apiName: string\n loc: any\n compilation: webpack.Compilation\n parser: webpack.javascript.JavascriptParser\n}) {\n return buildWebpackError({\n message: `A Node.js API is used (${apiName} at line: ${loc.start.line}) which is not supported in the Edge Runtime.\nLearn more: https://nextjs.org/docs/api-reference/edge-runtime`,\n loc,\n ...rest,\n })\n}\n\nfunction registerUnsupportedApiHooks(\n parser: webpack.javascript.JavascriptParser,\n compilation: webpack.Compilation\n) {\n for (const expression of EDGE_UNSUPPORTED_NODE_APIS) {\n const warnForUnsupportedApi = (node: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: expression,\n ...node,\n })\n )\n return true\n }\n parser.hooks.call.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.expression.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.callMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n parser.hooks.expressionMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n }\n\n const warnForUnsupportedProcessApi = (node: any, [callee]: string[]) => {\n if (!isInMiddlewareLayer(parser) || callee === 'env') {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: `process.${callee}`,\n ...node,\n })\n )\n return true\n }\n\n parser.hooks.callMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n parser.hooks.expressionMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n}\n\nfunction getCodeAnalyzer(params: {\n dev: boolean\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n}) {\n return (parser: webpack.javascript.JavascriptParser) => {\n const {\n dev,\n compiler: { webpack: wp },\n compilation,\n } = params\n const { hooks } = parser\n\n /**\n * For an expression this will check the graph to ensure it is being used\n * by exports. Then it will store in the module buildInfo a boolean to\n * express that it contains dynamic code and, if it is available, the\n * module path that is using it.\n */\n const handleExpression = () => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n wp.optimize.InnerGraph.onUsage(parser.state, (used = true) => {\n const buildInfo = getModuleBuildInfo(parser.state.module)\n if (buildInfo.usingIndirectEval === true || used === false) {\n return\n }\n\n if (!buildInfo.usingIndirectEval || used === true) {\n buildInfo.usingIndirectEval = used\n return\n }\n\n buildInfo.usingIndirectEval = new Set([\n ...Array.from(buildInfo.usingIndirectEval),\n ...Array.from(used),\n ])\n })\n }\n\n /**\n * This expression handler allows to wrap a dynamic code expression with a\n * function call where we can warn about dynamic code not being allowed\n * but actually execute the expression.\n */\n const handleWrapExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_eval__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n return true\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.compile invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n */\n const handleWrapWasmCompileExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_compile__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.instatiate invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n *\n * Note that we don't update `usingIndirectEval`, i.e. we don't abort a production build\n * since we can't determine statically if the first parameter is a module (legit use) or\n * a buffer (dynamic code generation).\n */\n const handleWrapWasmInstantiateExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n if (dev) {\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_instantiate__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n }\n }\n\n /**\n * Handler to store original source location of static and dynamic imports into module's buildInfo.\n */\n const handleImport = (node: any) => {\n if (isInMiddlewareLayer(parser) && node.source?.value && node?.loc) {\n const { module, source } = parser.state\n const buildInfo = getModuleBuildInfo(module)\n if (!buildInfo.importLocByPath) {\n buildInfo.importLocByPath = new Map()\n }\n\n const importedModule = node.source.value?.toString()\n buildInfo.importLocByPath.set(importedModule, {\n sourcePosition: {\n ...node.loc.start,\n source: module.identifier(),\n },\n sourceContent: source.toString(),\n })\n\n if (\n !dev &&\n isNodeJsModule(importedModule) &&\n !SUPPORTED_NATIVE_MODULES.includes(importedModule)\n ) {\n compilation.warnings.push(\n buildWebpackError({\n message: `A Node.js module is loaded ('${importedModule}' at line ${node.loc.start.line}) which is not supported in the Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`,\n compilation,\n parser,\n ...node,\n })\n )\n }\n }\n }\n\n /**\n * A noop handler to skip analyzing some cases.\n * Order matters: for it to work, it must be registered first\n */\n const skip = () => (isInMiddlewareLayer(parser) ? true : undefined)\n\n for (const prefix of ['', 'global.']) {\n hooks.expression.for(`${prefix}Function.prototype`).tap(NAME, skip)\n hooks.expression.for(`${prefix}Function.bind`).tap(NAME, skip)\n hooks.call.for(`${prefix}eval`).tap(NAME, handleWrapExpression)\n hooks.call.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.new.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.call\n .for(`${prefix}WebAssembly.compile`)\n .tap(NAME, handleWrapWasmCompileExpression)\n hooks.call\n .for(`${prefix}WebAssembly.instantiate`)\n .tap(NAME, handleWrapWasmInstantiateExpression)\n }\n\n hooks.importCall.tap(NAME, handleImport)\n hooks.import.tap(NAME, handleImport)\n\n if (!dev) {\n // do not issue compilation warning on dev: invoking code will provide details\n registerUnsupportedApiHooks(parser, compilation)\n }\n }\n}\n\nfunction getExtractMetadata(params: {\n compilation: webpack.Compilation\n compiler: webpack.Compiler\n dev: boolean\n metadataByEntry: Map<string, EntryMetadata>\n}): () => Promise<void> {\n const { dev, compilation, metadataByEntry, compiler } = params\n const { webpack: wp } = compiler\n return async () => {\n metadataByEntry.clear()\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n\n for (const [entryName, entry] of compilation.entries) {\n if (entry.options.runtime !== EDGE_RUNTIME_WEBPACK) {\n // Only process edge runtime entries\n continue\n }\n const entryDependency = entry.dependencies?.[0]\n const resolvedModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)\n if (!resolvedModule) {\n continue\n }\n const { rootDir, route } = getModuleBuildInfo(resolvedModule)\n\n const { moduleGraph } = compilation\n const modules = new Set<webpack.NormalModule>()\n const addEntriesFromDependency = (dependency: any) => {\n const module = moduleGraph.getModule(dependency)\n if (module) {\n modules.add(module as webpack.NormalModule)\n }\n }\n\n entry.dependencies.forEach(addEntriesFromDependency)\n entry.includeDependencies.forEach(addEntriesFromDependency)\n\n const entryMetadata: EntryMetadata = {\n wasmBindings: new Map(),\n assetBindings: new Map(),\n }\n\n if (route?.middlewareConfig?.regions) {\n entryMetadata.regions = route.middlewareConfig.regions\n }\n\n if (route?.preferredRegion) {\n const preferredRegion = route.preferredRegion\n entryMetadata.regions =\n // Ensures preferredRegion is always an array in the manifest.\n typeof preferredRegion === 'string'\n ? [preferredRegion]\n : preferredRegion\n }\n\n let ogImageGenerationCount = 0\n\n for (const module of modules) {\n const buildInfo = getModuleBuildInfo(module)\n\n /**\n * Check if it uses the image generation feature.\n */\n if (!dev) {\n const resource = module.resource\n const hasOGImageGeneration =\n resource &&\n /[\\\\/]node_modules[\\\\/]@vercel[\\\\/]og[\\\\/]dist[\\\\/]index\\.(edge|node)\\.js$|[\\\\/]next[\\\\/]dist[\\\\/](esm[\\\\/])?server[\\\\/]og[\\\\/]image-response\\.js$/.test(\n resource\n )\n\n if (hasOGImageGeneration) {\n ogImageGenerationCount++\n }\n }\n\n /**\n * When building for production checks if the module is using `eval`\n * and in such case produces a compilation error. The module has to\n * be in use.\n */\n if (\n !dev &&\n buildInfo.usingIndirectEval &&\n isUsingIndirectEvalAndUsedByExports({\n module,\n moduleGraph,\n runtime: wp.util.runtime.getEntryRuntime(compilation, entryName),\n usingIndirectEval: buildInfo.usingIndirectEval,\n wp,\n })\n ) {\n const id = module.identifier()\n if (/node_modules[\\\\/]regenerator-runtime[\\\\/]runtime\\.js/.test(id)) {\n continue\n }\n if (route?.middlewareConfig?.unstable_allowDynamic) {\n telemetry?.record({\n eventName: 'NEXT_EDGE_ALLOW_DYNAMIC_USED',\n payload: {\n file: route?.absolutePagePath.replace(rootDir ?? '', ''),\n config: route?.middlewareConfig,\n fileWithDynamicCode: module.userRequest.replace(\n rootDir ?? '',\n ''\n ),\n },\n })\n }\n if (\n !isDynamicCodeEvaluationAllowed(\n module.userRequest,\n route?.middlewareConfig,\n rootDir\n )\n ) {\n const message = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime ${\n typeof buildInfo.usingIndirectEval !== 'boolean'\n ? `\\nUsed by ${Array.from(buildInfo.usingIndirectEval).join(\n ', '\n )}`\n : ''\n }\\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`\n compilation.errors.push(\n getDynamicCodeEvaluationError(\n message,\n module,\n compilation,\n compiler\n )\n )\n }\n }\n\n /**\n * The entry module has to be either a page or a middleware and hold\n * the corresponding metadata.\n */\n if (buildInfo?.nextEdgeSSR) {\n entryMetadata.edgeSSR = buildInfo.nextEdgeSSR\n } else if (buildInfo?.nextEdgeMiddleware) {\n entryMetadata.edgeMiddleware = buildInfo.nextEdgeMiddleware\n } else if (buildInfo?.nextEdgeApiFunction) {\n entryMetadata.edgeApiFunction = buildInfo.nextEdgeApiFunction\n }\n\n /**\n * If the module is a WASM module we read the binding information and\n * append it to the entry wasm bindings.\n */\n if (buildInfo?.nextWasmMiddlewareBinding) {\n entryMetadata.wasmBindings.set(\n buildInfo.nextWasmMiddlewareBinding.name,\n buildInfo.nextWasmMiddlewareBinding.filePath\n )\n }\n\n if (buildInfo?.nextAssetMiddlewareBinding) {\n entryMetadata.assetBindings.set(\n buildInfo.nextAssetMiddlewareBinding.name,\n buildInfo.nextAssetMiddlewareBinding.filePath\n )\n }\n\n /**\n * Append to the list of modules to process outgoingConnections from\n * the module that is being processed.\n */\n for (const conn of getModuleReferencesInOrder(module, moduleGraph)) {\n if (conn.module) {\n modules.add(conn.module as webpack.NormalModule)\n }\n }\n }\n\n telemetry?.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'vercelImageGeneration',\n invocationCount: ogImageGenerationCount,\n },\n })\n metadataByEntry.set(entryName, entryMetadata)\n }\n }\n}\n\n// These values will be replaced again in edge runtime deployment build.\n// `buildId` represents BUILD_ID to be externalized in env vars.\n// `encryptionKey` represents server action encryption key to be externalized in env vars.\ntype EdgeRuntimeEnvironments = Record<string, string> & {\n __NEXT_BUILD_ID: string\n NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: string\n}\n\ninterface Options {\n dev: boolean\n sriEnabled: boolean\n rewrites: CustomRoutes['rewrites']\n edgeEnvironments: EdgeRuntimeEnvironments\n}\n\nexport default class MiddlewarePlugin {\n private readonly dev: Options['dev']\n private readonly sriEnabled: Options['sriEnabled']\n private readonly rewrites: Options['rewrites']\n private readonly edgeEnvironments: EdgeRuntimeEnvironments\n\n constructor({ dev, sriEnabled, rewrites, edgeEnvironments }: Options) {\n this.dev = dev\n this.sriEnabled = sriEnabled\n this.rewrites = rewrites\n this.edgeEnvironments = edgeEnvironments\n }\n\n public apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(NAME, (compilation, params) => {\n const { hooks } = params.normalModuleFactory\n /**\n * This is the static code analysis phase.\n */\n const codeAnalyzer = getCodeAnalyzer({\n dev: this.dev,\n compiler,\n compilation,\n })\n hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)\n\n /**\n * Extract all metadata for the entry points in a Map object.\n */\n const metadataByEntry = new Map<string, EntryMetadata>()\n compilation.hooks.finishModules.tapPromise(\n NAME,\n getExtractMetadata({\n compilation,\n compiler,\n dev: this.dev,\n metadataByEntry,\n })\n )\n\n /**\n * Emit the middleware manifest.\n */\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsMiddlewareManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n getCreateAssets({\n compilation,\n metadataByEntry,\n opts: {\n sriEnabled: this.sriEnabled,\n rewrites: this.rewrites,\n edgeEnvironments: this.edgeEnvironments,\n dev: this.dev,\n },\n })\n )\n })\n }\n}\n\nexport const SUPPORTED_NATIVE_MODULES = [\n 'buffer',\n 'events',\n 'assert',\n 'util',\n 'async_hooks',\n] as const\n\nconst supportedEdgePolyfills = new Set<string>(SUPPORTED_NATIVE_MODULES)\n\nexport function getEdgePolyfilledModules() {\n const records: Record<string, string> = {}\n for (const mod of SUPPORTED_NATIVE_MODULES) {\n records[mod] = `commonjs node:${mod}`\n records[`node:${mod}`] = `commonjs node:${mod}`\n }\n return records\n}\n\nexport async function handleWebpackExternalForEdgeRuntime({\n request,\n context,\n contextInfo,\n getResolve,\n}: {\n request: string\n context: string\n contextInfo: any\n getResolve: () => any\n}) {\n if (\n (contextInfo.issuerLayer === WEBPACK_LAYERS.middleware ||\n contextInfo.issuerLayer === WEBPACK_LAYERS.api) &&\n isNodeJsModule(request) &&\n !supportedEdgePolyfills.has(request)\n ) {\n // allows user to provide and use their polyfills, as we do with buffer.\n try {\n await getResolve()(context, request)\n } catch {\n return `root globalThis.__import_unsupported('${request}')`\n }\n }\n}\n"],"names":["SUPPORTED_NATIVE_MODULES","MiddlewarePlugin","getEdgePolyfilledModules","handleWebpackExternalForEdgeRuntime","KNOWN_SAFE_DYNAMIC_PACKAGES","require","NAME","MANIFEST_VERSION","isUsingIndirectEvalAndUsedByExports","args","moduleGraph","runtime","module","usingIndirectEval","wp","exportsInfo","getExportsInfo","exportName","getUsed","UsageState","Unused","getEntryFiles","entryFiles","meta","hasInstrumentationHook","opts","files","edgeSSR","isServerComponent","push","SERVER_REFERENCE_MANIFEST","sriEnabled","SUBRESOURCE_INTEGRITY_MANIFEST","filter","file","startsWith","endsWith","map","replace","CLIENT_REFERENCE_MANIFEST","dev","isAppDir","DYNAMIC_CSS_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_REACT_LOADABLE_MANIFEST","NEXT_FONT_MANIFEST","INTERCEPTION_ROUTE_REWRITE_MANIFEST","INSTRUMENTATION_HOOK_FILENAME","getCreateAssets","params","compilation","metadataByEntry","middlewareManifest","version","middleware","functions","sortedMiddleware","entrypoints","has","interceptionRewrites","JSON","stringify","rewrites","beforeFiles","isInterceptionRouteRewrite","emitAsset","sources","RawSource","entrypoint","values","metadata","name","get","page","edgeMiddleware","edgeApiFunction","matcherSource","normalizeAppPath","catchAll","namedRegex","getNamedMiddlewareRegex","matchers","regexp","originalSource","isEdgeFunction","edgeFunctionDefinition","getFiles","wasm","Array","from","wasmBindings","filePath","assets","assetBindings","env","edgeEnvironments","regions","getSortedRoutes","Object","keys","MIDDLEWARE_MANIFEST","buildWebpackError","message","loc","entryModule","parser","error","compiler","webpack","WebpackError","state","current","isInMiddlewareLayer","layer","WEBPACK_LAYERS","api","isNodeJsModule","moduleName","builtinModules","includes","isDynamicCodeEvaluationAllowed","fileName","middlewareConfig","rootDir","some","pkg","path","sep","picomatch","unstable_allowDynamic","dot","buildUnsupportedApiError","apiName","rest","start","line","registerUnsupportedApiHooks","expression","EDGE_UNSUPPORTED_NODE_APIS","warnForUnsupportedApi","node","warnings","hooks","call","for","tap","callMemberChain","expressionMemberChain","warnForUnsupportedProcessApi","callee","getCodeAnalyzer","handleExpression","optimize","InnerGraph","onUsage","used","buildInfo","getModuleBuildInfo","Set","handleWrapExpression","expr","ConstDependency","dependencies","dep1","range","addPresentationalDependency","dep2","handleWrapWasmCompileExpression","handleWrapWasmInstantiateExpression","handleImport","source","value","importLocByPath","Map","importedModule","toString","set","sourcePosition","identifier","sourceContent","skip","undefined","prefix","new","importCall","import","getExtractMetadata","clear","telemetry","traceGlobals","entryName","entry","entries","route","options","EDGE_RUNTIME_WEBPACK","entryDependency","resolvedModule","getResolvedModule","modules","addEntriesFromDependency","dependency","getModule","add","forEach","includeDependencies","entryMetadata","preferredRegion","ogImageGenerationCount","resource","hasOGImageGeneration","test","util","getEntryRuntime","id","record","eventName","payload","absolutePagePath","config","fileWithDynamicCode","userRequest","join","errors","getDynamicCodeEvaluationError","nextEdgeSSR","nextEdgeMiddleware","nextEdgeApiFunction","nextWasmMiddlewareBinding","nextAssetMiddlewareBinding","conn","getModuleReferencesInOrder","EVENT_BUILD_FEATURE_USAGE","featureName","invocationCount","constructor","apply","normalModuleFactory","codeAnalyzer","finishModules","tapPromise","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS","supportedEdgePolyfills","records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;IACF;AACF;AAEO,MAAMxC,2BAA2B;IACtC;IACA;IACA;IACA;IACA;CACD;AAED,MAAMqP,yBAAyB,IAAIvF,IAAY9J;AAExC,SAASE;IACd,MAAMoP,UAAkC,CAAC;IACzC,KAAK,MAAMC,OAAOvP,yBAA0B;QAC1CsP,OAAO,CAACC,IAAI,GAAG,CAAC,cAAc,EAAEA,KAAK;QACrCD,OAAO,CAAC,CAAC,KAAK,EAAEC,KAAK,CAAC,GAAG,CAAC,cAAc,EAAEA,KAAK;IACjD;IACA,OAAOD;AACT;AAEO,eAAenP,oCAAoC,EACxDqP,OAAO,EACPC,OAAO,EACPC,WAAW,EACXC,UAAU,EAMX;IACC,IACE,AAACD,CAAAA,YAAYE,WAAW,KAAK1I,0BAAc,CAAC5D,UAAU,IACpDoM,YAAYE,WAAW,KAAK1I,0BAAc,CAACC,GAAG,AAAD,KAC/CC,eAAeoI,YACf,CAACH,uBAAuB3L,GAAG,CAAC8L,UAC5B;QACA,wEAAwE;QACxE,IAAI;YACF,MAAMG,aAAaF,SAASD;QAC9B,EAAE,OAAM;YACN,OAAO,CAAC,sCAAsC,EAAEA,QAAQ,EAAE,CAAC;QAC7D;IACF;AACF"}
|
1
|
+
{"version":3,"sources":["../../../../src/build/webpack/plugins/middleware-plugin.ts"],"sourcesContent":["import type {\n AssetBinding,\n EdgeMiddlewareMeta,\n} from '../loaders/get-module-build-info'\nimport type { EdgeSSRMeta } from '../loaders/get-module-build-info'\nimport type { MiddlewareMatcher } from '../../analysis/get-page-static-info'\nimport { getNamedMiddlewareRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport path from 'path'\nimport {\n EDGE_RUNTIME_WEBPACK,\n EDGE_UNSUPPORTED_NODE_APIS,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n MIDDLEWARE_MANIFEST,\n MIDDLEWARE_REACT_LOADABLE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n NEXT_FONT_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n} from '../../../shared/lib/constants'\nimport type { MiddlewareConfig } from '../../analysis/get-page-static-info'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport { traceGlobals } from '../../../trace/shared'\nimport { EVENT_BUILD_FEATURE_USAGE } from '../../../telemetry/events'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport {\n INSTRUMENTATION_HOOK_FILENAME,\n WEBPACK_LAYERS,\n} from '../../../lib/constants'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport { getDynamicCodeEvaluationError } from './wellknown-errors-plugin/parse-dynamic-code-evaluation-error'\nimport { getModuleReferencesInOrder } from '../utils'\n\nconst KNOWN_SAFE_DYNAMIC_PACKAGES =\n require('../../../lib/known-edge-safe-packages.json') as string[]\n\nexport interface EdgeFunctionDefinition {\n files: string[]\n name: string\n page: string\n matchers: MiddlewareMatcher[]\n env: Record<string, string>\n wasm?: AssetBinding[]\n assets?: AssetBinding[]\n regions?: string[] | string\n}\n\nexport interface MiddlewareManifest {\n version: 3\n sortedMiddleware: string[]\n middleware: { [page: string]: EdgeFunctionDefinition }\n functions: { [page: string]: EdgeFunctionDefinition }\n}\n\ninterface EntryMetadata {\n edgeMiddleware?: EdgeMiddlewareMeta\n edgeApiFunction?: EdgeMiddlewareMeta\n edgeSSR?: EdgeSSRMeta\n wasmBindings: Map<string, string>\n assetBindings: Map<string, string>\n regions?: string[] | string\n}\n\nconst NAME = 'MiddlewarePlugin'\nconst MANIFEST_VERSION = 3\n\n/**\n * Checks the value of usingIndirectEval and when it is a set of modules it\n * check if any of the modules is actually being used. If the value is\n * simply truthy it will return true.\n */\nfunction isUsingIndirectEvalAndUsedByExports(args: {\n module: webpack.Module\n moduleGraph: webpack.ModuleGraph\n runtime: any\n usingIndirectEval: true | Set<string>\n wp: typeof webpack\n}): boolean {\n const { moduleGraph, runtime, module, usingIndirectEval, wp } = args\n if (typeof usingIndirectEval === 'boolean') {\n return usingIndirectEval\n }\n\n const exportsInfo = moduleGraph.getExportsInfo(module)\n for (const exportName of usingIndirectEval) {\n if (exportsInfo.getUsed(exportName, runtime) !== wp.UsageState.Unused) {\n return true\n }\n }\n\n return false\n}\n\nfunction getEntryFiles(\n entryFiles: string[],\n meta: EntryMetadata,\n hasInstrumentationHook: boolean,\n opts: Options\n) {\n const files: string[] = []\n if (meta.edgeSSR) {\n if (meta.edgeSSR.isServerComponent) {\n files.push(`server/${SERVER_REFERENCE_MANIFEST}.js`)\n if (opts.sriEnabled) {\n files.push(`server/${SUBRESOURCE_INTEGRITY_MANIFEST}.js`)\n }\n files.push(\n ...entryFiles\n .filter(\n (file) =>\n file.startsWith('app/') && !file.endsWith('.hot-update.js')\n )\n .map(\n (file) =>\n 'server/' +\n file.replace(/\\.js$/, '_' + CLIENT_REFERENCE_MANIFEST + '.js')\n )\n )\n }\n if (!opts.dev && !meta.edgeSSR.isAppDir) {\n files.push(`server/${DYNAMIC_CSS_MANIFEST}.js`)\n }\n\n files.push(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,\n `server/${NEXT_FONT_MANIFEST}.js`,\n `server/${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n }\n\n if (hasInstrumentationHook) {\n files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`)\n }\n\n files.push(\n ...entryFiles\n .filter((file) => !file.endsWith('.hot-update.js'))\n .map((file) => 'server/' + file)\n )\n\n return files\n}\n\nfunction getCreateAssets(params: {\n compilation: webpack.Compilation\n metadataByEntry: Map<string, EntryMetadata>\n opts: Options\n}) {\n const { compilation, metadataByEntry, opts } = params\n return () => {\n const middlewareManifest: MiddlewareManifest = {\n version: MANIFEST_VERSION,\n middleware: {},\n functions: {},\n sortedMiddleware: [],\n }\n\n const hasInstrumentationHook = compilation.entrypoints.has(\n INSTRUMENTATION_HOOK_FILENAME\n )\n\n // we only emit this entry for the edge runtime since it doesn't have access to a routes manifest\n // and we don't need to provide the entire route manifest, just the interception routes.\n const interceptionRewrites = JSON.stringify(\n opts.rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n compilation.emitAsset(\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )}`\n ) as unknown as webpack.sources.RawSource\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (!entrypoint.name) {\n continue\n }\n\n // There should always be metadata for the entrypoint.\n const metadata = metadataByEntry.get(entrypoint.name)\n const page =\n metadata?.edgeMiddleware?.page ||\n metadata?.edgeSSR?.page ||\n metadata?.edgeApiFunction?.page\n if (!page) {\n continue\n }\n\n const matcherSource = metadata.edgeSSR?.isAppDir\n ? normalizeAppPath(page)\n : page\n\n const catchAll = !metadata.edgeSSR && !metadata.edgeApiFunction\n\n const { namedRegex } = getNamedMiddlewareRegex(matcherSource, {\n catchAll,\n })\n const matchers = metadata?.edgeMiddleware?.matchers ?? [\n {\n regexp: namedRegex,\n originalSource: page === '/' && catchAll ? '/:path*' : matcherSource,\n },\n ]\n\n const isEdgeFunction = !!(metadata.edgeApiFunction || metadata.edgeSSR)\n const edgeFunctionDefinition: EdgeFunctionDefinition = {\n files: getEntryFiles(\n entrypoint.getFiles(),\n metadata,\n hasInstrumentationHook,\n opts\n ),\n name: entrypoint.name,\n page: page,\n matchers,\n wasm: Array.from(metadata.wasmBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n assets: Array.from(metadata.assetBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n env: opts.edgeEnvironments,\n ...(metadata.regions && { regions: metadata.regions }),\n }\n\n if (isEdgeFunction) {\n middlewareManifest.functions[page] = edgeFunctionDefinition\n } else {\n middlewareManifest.middleware[page] = edgeFunctionDefinition\n }\n }\n\n middlewareManifest.sortedMiddleware = getSortedRoutes(\n Object.keys(middlewareManifest.middleware)\n )\n\n compilation.emitAsset(\n MIDDLEWARE_MANIFEST,\n new sources.RawSource(\n JSON.stringify(middlewareManifest, null, 2)\n ) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction buildWebpackError({\n message,\n loc,\n compilation,\n entryModule,\n parser,\n}: {\n message: string\n loc?: any\n compilation: webpack.Compilation\n entryModule?: webpack.Module\n parser?: webpack.javascript.JavascriptParser\n}) {\n const error = new compilation.compiler.webpack.WebpackError(message)\n error.name = NAME\n const module = entryModule ?? parser?.state.current\n if (module) {\n error.module = module\n }\n error.loc = loc\n return error\n}\n\nfunction isInMiddlewareLayer(parser: webpack.javascript.JavascriptParser) {\n const layer = parser.state.module?.layer\n return layer === WEBPACK_LAYERS.middleware || layer === WEBPACK_LAYERS.api\n}\n\nfunction isNodeJsModule(moduleName: string) {\n return require('module').builtinModules.includes(moduleName)\n}\n\nfunction isDynamicCodeEvaluationAllowed(\n fileName: string,\n middlewareConfig?: MiddlewareConfig,\n rootDir?: string\n) {\n // Some packages are known to use `eval` but are safe to use in the Edge\n // Runtime because the dynamic code will never be executed.\n if (\n KNOWN_SAFE_DYNAMIC_PACKAGES.some((pkg) =>\n fileName.includes(`/node_modules/${pkg}/`.replace(/\\//g, path.sep))\n )\n ) {\n return true\n }\n\n const name = fileName.replace(rootDir ?? '', '')\n\n return picomatch(middlewareConfig?.unstable_allowDynamic ?? [], {\n dot: true,\n })(name)\n}\n\nfunction buildUnsupportedApiError({\n apiName,\n loc,\n ...rest\n}: {\n apiName: string\n loc: any\n compilation: webpack.Compilation\n parser: webpack.javascript.JavascriptParser\n}) {\n return buildWebpackError({\n message: `A Node.js API is used (${apiName} at line: ${loc.start.line}) which is not supported in the Edge Runtime.\nLearn more: https://nextjs.org/docs/api-reference/edge-runtime`,\n loc,\n ...rest,\n })\n}\n\nfunction registerUnsupportedApiHooks(\n parser: webpack.javascript.JavascriptParser,\n compilation: webpack.Compilation\n) {\n for (const expression of EDGE_UNSUPPORTED_NODE_APIS) {\n const warnForUnsupportedApi = (node: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: expression,\n ...node,\n })\n )\n return true\n }\n parser.hooks.call.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.expression.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.callMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n parser.hooks.expressionMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n }\n\n const warnForUnsupportedProcessApi = (node: any, [callee]: string[]) => {\n if (!isInMiddlewareLayer(parser) || callee === 'env') {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: `process.${callee}`,\n ...node,\n })\n )\n return true\n }\n\n parser.hooks.callMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n parser.hooks.expressionMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n}\n\nfunction getCodeAnalyzer(params: {\n dev: boolean\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n}) {\n return (parser: webpack.javascript.JavascriptParser) => {\n const {\n dev,\n compiler: { webpack: wp },\n compilation,\n } = params\n const { hooks } = parser\n\n /**\n * For an expression this will check the graph to ensure it is being used\n * by exports. Then it will store in the module buildInfo a boolean to\n * express that it contains dynamic code and, if it is available, the\n * module path that is using it.\n */\n const handleExpression = () => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n wp.optimize.InnerGraph.onUsage(parser.state, (used = true) => {\n const buildInfo = getModuleBuildInfo(parser.state.module)\n if (buildInfo.usingIndirectEval === true || used === false) {\n return\n }\n\n if (!buildInfo.usingIndirectEval || used === true) {\n buildInfo.usingIndirectEval = used\n return\n }\n\n buildInfo.usingIndirectEval = new Set([\n ...Array.from(buildInfo.usingIndirectEval),\n ...Array.from(used),\n ])\n })\n }\n\n /**\n * This expression handler allows to wrap a dynamic code expression with a\n * function call where we can warn about dynamic code not being allowed\n * but actually execute the expression.\n */\n const handleWrapExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_eval__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n return true\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.compile invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n */\n const handleWrapWasmCompileExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_compile__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.instatiate invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n *\n * Note that we don't update `usingIndirectEval`, i.e. we don't abort a production build\n * since we can't determine statically if the first parameter is a module (legit use) or\n * a buffer (dynamic code generation).\n */\n const handleWrapWasmInstantiateExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n if (dev) {\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_instantiate__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n }\n }\n\n /**\n * Handler to store original source location of static and dynamic imports into module's buildInfo.\n */\n const handleImport = (node: any) => {\n if (isInMiddlewareLayer(parser) && node.source?.value && node?.loc) {\n const { module, source } = parser.state\n const buildInfo = getModuleBuildInfo(module)\n if (!buildInfo.importLocByPath) {\n buildInfo.importLocByPath = new Map()\n }\n\n const importedModule = node.source.value?.toString()\n buildInfo.importLocByPath.set(importedModule, {\n sourcePosition: {\n ...node.loc.start,\n source: module.identifier(),\n },\n sourceContent: source.toString(),\n })\n\n if (\n !dev &&\n isNodeJsModule(importedModule) &&\n !SUPPORTED_NATIVE_MODULES.includes(importedModule)\n ) {\n compilation.warnings.push(\n buildWebpackError({\n message: `A Node.js module is loaded ('${importedModule}' at line ${node.loc.start.line}) which is not supported in the Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`,\n compilation,\n parser,\n ...node,\n })\n )\n }\n }\n }\n\n /**\n * A noop handler to skip analyzing some cases.\n * Order matters: for it to work, it must be registered first\n */\n const skip = () => (isInMiddlewareLayer(parser) ? true : undefined)\n\n for (const prefix of ['', 'global.']) {\n hooks.expression.for(`${prefix}Function.prototype`).tap(NAME, skip)\n hooks.expression.for(`${prefix}Function.bind`).tap(NAME, skip)\n hooks.call.for(`${prefix}eval`).tap(NAME, handleWrapExpression)\n hooks.call.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.new.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.call\n .for(`${prefix}WebAssembly.compile`)\n .tap(NAME, handleWrapWasmCompileExpression)\n hooks.call\n .for(`${prefix}WebAssembly.instantiate`)\n .tap(NAME, handleWrapWasmInstantiateExpression)\n }\n\n hooks.importCall.tap(NAME, handleImport)\n hooks.import.tap(NAME, handleImport)\n\n if (!dev) {\n // do not issue compilation warning on dev: invoking code will provide details\n registerUnsupportedApiHooks(parser, compilation)\n }\n }\n}\n\nfunction getExtractMetadata(params: {\n compilation: webpack.Compilation\n compiler: webpack.Compiler\n dev: boolean\n metadataByEntry: Map<string, EntryMetadata>\n}): () => Promise<void> {\n const { dev, compilation, metadataByEntry, compiler } = params\n const { webpack: wp } = compiler\n return async () => {\n metadataByEntry.clear()\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n\n for (const [entryName, entry] of compilation.entries) {\n if (entry.options.runtime !== EDGE_RUNTIME_WEBPACK) {\n // Only process edge runtime entries\n continue\n }\n const entryDependency = entry.dependencies?.[0]\n const resolvedModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)\n if (!resolvedModule) {\n continue\n }\n const { rootDir, route } = getModuleBuildInfo(resolvedModule)\n\n const { moduleGraph } = compilation\n const modules = new Set<webpack.NormalModule>()\n const addEntriesFromDependency = (dependency: any) => {\n const module = moduleGraph.getModule(dependency)\n if (module) {\n modules.add(module as webpack.NormalModule)\n }\n }\n\n entry.dependencies.forEach(addEntriesFromDependency)\n entry.includeDependencies.forEach(addEntriesFromDependency)\n\n const entryMetadata: EntryMetadata = {\n wasmBindings: new Map(),\n assetBindings: new Map(),\n }\n\n if (route?.middlewareConfig?.regions) {\n entryMetadata.regions = route.middlewareConfig.regions\n }\n\n if (route?.preferredRegion) {\n const preferredRegion = route.preferredRegion\n entryMetadata.regions =\n // Ensures preferredRegion is always an array in the manifest.\n typeof preferredRegion === 'string'\n ? [preferredRegion]\n : preferredRegion\n }\n\n let ogImageGenerationCount = 0\n\n for (const module of modules) {\n const buildInfo = getModuleBuildInfo(module)\n\n /**\n * Check if it uses the image generation feature.\n */\n if (!dev) {\n const resource = module.resource\n const hasOGImageGeneration =\n resource &&\n /[\\\\/]node_modules[\\\\/]@vercel[\\\\/]og[\\\\/]dist[\\\\/]index\\.(edge|node)\\.js$|[\\\\/]next[\\\\/]dist[\\\\/](esm[\\\\/])?server[\\\\/]og[\\\\/]image-response\\.js$/.test(\n resource\n )\n\n if (hasOGImageGeneration) {\n ogImageGenerationCount++\n }\n }\n\n /**\n * When building for production checks if the module is using `eval`\n * and in such case produces a compilation error. The module has to\n * be in use.\n */\n if (\n !dev &&\n buildInfo.usingIndirectEval &&\n isUsingIndirectEvalAndUsedByExports({\n module,\n moduleGraph,\n runtime: wp.util.runtime.getEntryRuntime(compilation, entryName),\n usingIndirectEval: buildInfo.usingIndirectEval,\n wp,\n })\n ) {\n const id = module.identifier()\n if (/node_modules[\\\\/]regenerator-runtime[\\\\/]runtime\\.js/.test(id)) {\n continue\n }\n if (route?.middlewareConfig?.unstable_allowDynamic) {\n telemetry?.record({\n eventName: 'NEXT_EDGE_ALLOW_DYNAMIC_USED',\n payload: {\n file: route?.absolutePagePath.replace(rootDir ?? '', ''),\n config: route?.middlewareConfig,\n fileWithDynamicCode: module.userRequest.replace(\n rootDir ?? '',\n ''\n ),\n },\n })\n }\n if (\n !isDynamicCodeEvaluationAllowed(\n module.userRequest,\n route?.middlewareConfig,\n rootDir\n )\n ) {\n const message = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime ${\n typeof buildInfo.usingIndirectEval !== 'boolean'\n ? `\\nUsed by ${Array.from(buildInfo.usingIndirectEval).join(\n ', '\n )}`\n : ''\n }\\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`\n compilation.errors.push(\n getDynamicCodeEvaluationError(\n message,\n module,\n compilation,\n compiler\n )\n )\n }\n }\n\n /**\n * The entry module has to be either a page or a middleware and hold\n * the corresponding metadata.\n */\n if (buildInfo?.nextEdgeSSR) {\n entryMetadata.edgeSSR = buildInfo.nextEdgeSSR\n } else if (buildInfo?.nextEdgeMiddleware) {\n entryMetadata.edgeMiddleware = buildInfo.nextEdgeMiddleware\n } else if (buildInfo?.nextEdgeApiFunction) {\n entryMetadata.edgeApiFunction = buildInfo.nextEdgeApiFunction\n }\n\n /**\n * If the module is a WASM module we read the binding information and\n * append it to the entry wasm bindings.\n */\n if (buildInfo?.nextWasmMiddlewareBinding) {\n entryMetadata.wasmBindings.set(\n buildInfo.nextWasmMiddlewareBinding.name,\n buildInfo.nextWasmMiddlewareBinding.filePath\n )\n }\n\n if (buildInfo?.nextAssetMiddlewareBinding) {\n entryMetadata.assetBindings.set(\n buildInfo.nextAssetMiddlewareBinding.name,\n buildInfo.nextAssetMiddlewareBinding.filePath\n )\n }\n\n /**\n * Append to the list of modules to process outgoingConnections from\n * the module that is being processed.\n */\n for (const conn of getModuleReferencesInOrder(module, moduleGraph)) {\n if (conn.module) {\n modules.add(conn.module as webpack.NormalModule)\n }\n }\n }\n\n telemetry?.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'vercelImageGeneration',\n invocationCount: ogImageGenerationCount,\n },\n })\n metadataByEntry.set(entryName, entryMetadata)\n }\n }\n}\n\n// These values will be replaced again in edge runtime deployment build.\n// `buildId` represents BUILD_ID to be externalized in env vars.\n// `encryptionKey` represents server action encryption key to be externalized in env vars.\ntype EdgeRuntimeEnvironments = Record<string, string> & {\n __NEXT_BUILD_ID: string\n NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: string\n}\n\ninterface Options {\n dev: boolean\n sriEnabled: boolean\n rewrites: CustomRoutes['rewrites']\n edgeEnvironments: EdgeRuntimeEnvironments\n}\n\nexport default class MiddlewarePlugin {\n private readonly dev: Options['dev']\n private readonly sriEnabled: Options['sriEnabled']\n private readonly rewrites: Options['rewrites']\n private readonly edgeEnvironments: EdgeRuntimeEnvironments\n\n constructor({ dev, sriEnabled, rewrites, edgeEnvironments }: Options) {\n this.dev = dev\n this.sriEnabled = sriEnabled\n this.rewrites = rewrites\n this.edgeEnvironments = edgeEnvironments\n }\n\n public apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(NAME, (compilation, params) => {\n const { hooks } = params.normalModuleFactory\n /**\n * This is the static code analysis phase.\n */\n const codeAnalyzer = getCodeAnalyzer({\n dev: this.dev,\n compiler,\n compilation,\n })\n\n // parser hooks aren't available in rspack\n if (!process.env.NEXT_RSPACK) {\n hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)\n }\n\n /**\n * Extract all metadata for the entry points in a Map object.\n */\n const metadataByEntry = new Map<string, EntryMetadata>()\n compilation.hooks.finishModules.tapPromise(\n NAME,\n getExtractMetadata({\n compilation,\n compiler,\n dev: this.dev,\n metadataByEntry,\n })\n )\n\n /**\n * Emit the middleware manifest.\n */\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsMiddlewareManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n getCreateAssets({\n compilation,\n metadataByEntry,\n opts: {\n sriEnabled: this.sriEnabled,\n rewrites: this.rewrites,\n edgeEnvironments: this.edgeEnvironments,\n dev: this.dev,\n },\n })\n )\n })\n }\n}\n\nexport const SUPPORTED_NATIVE_MODULES = [\n 'buffer',\n 'events',\n 'assert',\n 'util',\n 'async_hooks',\n] as const\n\nconst supportedEdgePolyfills = new Set<string>(SUPPORTED_NATIVE_MODULES)\n\nexport function getEdgePolyfilledModules() {\n const records: Record<string, string> = {}\n for (const mod of SUPPORTED_NATIVE_MODULES) {\n records[mod] = `commonjs node:${mod}`\n records[`node:${mod}`] = `commonjs node:${mod}`\n }\n return records\n}\n\nexport async function handleWebpackExternalForEdgeRuntime({\n request,\n context,\n contextInfo,\n getResolve,\n}: {\n request: string\n context: string\n contextInfo: any\n getResolve: () => any\n}) {\n if (\n (contextInfo.issuerLayer === WEBPACK_LAYERS.middleware ||\n contextInfo.issuerLayer === WEBPACK_LAYERS.api) &&\n isNodeJsModule(request) &&\n !supportedEdgePolyfills.has(request)\n ) {\n // allows user to provide and use their polyfills, as we do with buffer.\n try {\n await getResolve()(context, request)\n } catch {\n return `root globalThis.__import_unsupported('${request}')`\n }\n }\n}\n"],"names":["SUPPORTED_NATIVE_MODULES","MiddlewarePlugin","getEdgePolyfilledModules","handleWebpackExternalForEdgeRuntime","KNOWN_SAFE_DYNAMIC_PACKAGES","require","NAME","MANIFEST_VERSION","isUsingIndirectEvalAndUsedByExports","args","moduleGraph","runtime","module","usingIndirectEval","wp","exportsInfo","getExportsInfo","exportName","getUsed","UsageState","Unused","getEntryFiles","entryFiles","meta","hasInstrumentationHook","opts","files","edgeSSR","isServerComponent","push","SERVER_REFERENCE_MANIFEST","sriEnabled","SUBRESOURCE_INTEGRITY_MANIFEST","filter","file","startsWith","endsWith","map","replace","CLIENT_REFERENCE_MANIFEST","dev","isAppDir","DYNAMIC_CSS_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_REACT_LOADABLE_MANIFEST","NEXT_FONT_MANIFEST","INTERCEPTION_ROUTE_REWRITE_MANIFEST","INSTRUMENTATION_HOOK_FILENAME","getCreateAssets","params","compilation","metadataByEntry","middlewareManifest","version","middleware","functions","sortedMiddleware","entrypoints","has","interceptionRewrites","JSON","stringify","rewrites","beforeFiles","isInterceptionRouteRewrite","emitAsset","sources","RawSource","entrypoint","values","metadata","name","get","page","edgeMiddleware","edgeApiFunction","matcherSource","normalizeAppPath","catchAll","namedRegex","getNamedMiddlewareRegex","matchers","regexp","originalSource","isEdgeFunction","edgeFunctionDefinition","getFiles","wasm","Array","from","wasmBindings","filePath","assets","assetBindings","env","edgeEnvironments","regions","getSortedRoutes","Object","keys","MIDDLEWARE_MANIFEST","buildWebpackError","message","loc","entryModule","parser","error","compiler","webpack","WebpackError","state","current","isInMiddlewareLayer","layer","WEBPACK_LAYERS","api","isNodeJsModule","moduleName","builtinModules","includes","isDynamicCodeEvaluationAllowed","fileName","middlewareConfig","rootDir","some","pkg","path","sep","picomatch","unstable_allowDynamic","dot","buildUnsupportedApiError","apiName","rest","start","line","registerUnsupportedApiHooks","expression","EDGE_UNSUPPORTED_NODE_APIS","warnForUnsupportedApi","node","warnings","hooks","call","for","tap","callMemberChain","expressionMemberChain","warnForUnsupportedProcessApi","callee","getCodeAnalyzer","handleExpression","optimize","InnerGraph","onUsage","used","buildInfo","getModuleBuildInfo","Set","handleWrapExpression","expr","ConstDependency","dependencies","dep1","range","addPresentationalDependency","dep2","handleWrapWasmCompileExpression","handleWrapWasmInstantiateExpression","handleImport","source","value","importLocByPath","Map","importedModule","toString","set","sourcePosition","identifier","sourceContent","skip","undefined","prefix","new","importCall","import","getExtractMetadata","clear","telemetry","traceGlobals","entryName","entry","entries","route","options","EDGE_RUNTIME_WEBPACK","entryDependency","resolvedModule","getResolvedModule","modules","addEntriesFromDependency","dependency","getModule","add","forEach","includeDependencies","entryMetadata","preferredRegion","ogImageGenerationCount","resource","hasOGImageGeneration","test","util","getEntryRuntime","id","record","eventName","payload","absolutePagePath","config","fileWithDynamicCode","userRequest","join","errors","getDynamicCodeEvaluationError","nextEdgeSSR","nextEdgeMiddleware","nextEdgeApiFunction","nextWasmMiddlewareBinding","nextAssetMiddlewareBinding","conn","getModuleReferencesInOrder","EVENT_BUILD_FEATURE_USAGE","featureName","invocationCount","constructor","apply","normalModuleFactory","codeAnalyzer","process","NEXT_RSPACK","finishModules","tapPromise","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS","supportedEdgePolyfills","records","mod","request","context","contextInfo","getResolve","issuerLayer"],"mappings":";;;;;;;;;;;;;;;;;IAs0BaA,wBAAwB;eAAxBA;;IArEb,OAmEC;eAnEoBC;;IA+ELC,wBAAwB;eAAxBA;;IASMC,mCAAmC;eAAnCA;;;4BAn1BkB;oCACL;uBACH;yBACC;kEACX;6DACL;2BAaV;wBAGsB;wBACa;0BACT;4BAI1B;oDAEoC;iDACG;wBACH;;;;;;AAE3C,MAAMC,8BACJC,QAAQ;AA6BV,MAAMC,OAAO;AACb,MAAMC,mBAAmB;AAEzB;;;;CAI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,EAAEC,KAAK,CAAC,GAAG,CAAC,cAAc,EAAEA,KAAK;IACjD;IACA,OAAOD;AACT;AAEO,eAAerP,oCAAoC,EACxDuP,OAAO,EACPC,OAAO,EACPC,WAAW,EACXC,UAAU,EAMX;IACC,IACE,AAACD,CAAAA,YAAYE,WAAW,KAAK5I,0BAAc,CAAC5D,UAAU,IACpDsM,YAAYE,WAAW,KAAK5I,0BAAc,CAACC,GAAG,AAAD,KAC/CC,eAAesI,YACf,CAACH,uBAAuB7L,GAAG,CAACgM,UAC5B;QACA,wEAAwE;QACxE,IAAI;YACF,MAAMG,aAAaF,SAASD;QAC9B,EAAE,OAAM;YACN,OAAO,CAAC,sCAAsC,EAAEA,QAAQ,EAAE,CAAC;QAC7D;IACF;AACF"}
|
@@ -123,7 +123,7 @@ class TraceEntryPointsPlugin {
|
|
123
123
|
});
|
124
124
|
for (const entrypoint of compilation.entrypoints.values()){
|
125
125
|
const entryFiles = new Set();
|
126
|
-
for (const chunk of entrypoint.getEntrypointChunk().getAllReferencedChunks()){
|
126
|
+
for (const chunk of process.env.NEXT_RSPACK ? entrypoint.chunks : entrypoint.getEntrypointChunk().getAllReferencedChunks()){
|
127
127
|
for (const file of chunk.files){
|
128
128
|
if (isTraceable(file)) {
|
129
129
|
const filePath = _path.default.join(outputPath, file);
|
@@ -397,6 +397,16 @@ class TraceEntryPointsPlugin {
|
|
397
397
|
}
|
398
398
|
apply(compiler) {
|
399
399
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
400
|
+
compilation.hooks.processAssets.tapAsync({
|
401
|
+
name: PLUGIN_NAME,
|
402
|
+
stage: _webpack.webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
403
|
+
}, (_assets, callback)=>{
|
404
|
+
this.createTraceAssets(compilation, traceEntrypointsPluginSpan).then(()=>callback()).catch((err)=>callback(err));
|
405
|
+
});
|
406
|
+
// rspack doesn't support all API below so only create trace assets
|
407
|
+
if (process.env.NEXT_RSPACK) {
|
408
|
+
return;
|
409
|
+
}
|
400
410
|
const readlink = async (path)=>{
|
401
411
|
try {
|
402
412
|
return await new Promise((resolve, reject)=>{
|