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
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
|
|
11
11
|
import { getDefineEnv } from '../webpack/plugins/define-env-plugin';
|
12
12
|
import { getReactCompilerLoader } from '../get-babel-loader-config';
|
13
13
|
import { TurbopackInternalError } from '../../shared/lib/turbopack/utils';
|
14
|
-
const nextVersion = "15.2.0-canary.
|
14
|
+
const nextVersion = "15.2.0-canary.66";
|
15
15
|
const ArchName = arch();
|
16
16
|
const PlatformName = platform();
|
17
17
|
function infoLog(...args) {
|
@@ -21,6 +21,8 @@ export const base = curry(function base(ctx, config) {
|
|
21
21
|
if (ctx.isDevelopment) {
|
22
22
|
if (process.env.__NEXT_TEST_MODE && !process.env.__NEXT_TEST_WITH_DEVTOOL) {
|
23
23
|
config.devtool = false;
|
24
|
+
} else if (process.env.NEXT_RSPACK) {
|
25
|
+
config.devtool = 'source-map';
|
24
26
|
} else {
|
25
27
|
// `eval-source-map` provides full-fidelity source maps for the
|
26
28
|
// original source, including columns and original variable names.
|
@@ -52,7 +54,7 @@ export const base = curry(function base(ctx, config) {
|
|
52
54
|
config.plugins.push(new DevToolsIgnorePlugin({
|
53
55
|
shouldIgnorePath
|
54
56
|
}));
|
55
|
-
} else if (config.devtool === 'eval-source-map') {
|
57
|
+
} else if (config.devtool === 'eval-source-map' && !process.env.NEXT_RSPACK) {
|
56
58
|
var _config_output;
|
57
59
|
// We're using a fork of `eval-source-map`
|
58
60
|
config.devtool = false;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/build/webpack/config/blocks/base.ts"],"sourcesContent":["import curry from 'next/dist/compiled/lodash.curry'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { COMPILER_NAMES } from '../../../../shared/lib/constants'\nimport type { ConfigurationContext } from '../utils'\nimport DevToolsIgnorePlugin from '../../plugins/devtools-ignore-list-plugin'\nimport EvalSourceMapDevToolPlugin from '../../plugins/eval-source-map-dev-tool-plugin'\n\nfunction shouldIgnorePath(modulePath: string): boolean {\n return (\n modulePath.includes('node_modules') ||\n // Only relevant for when Next.js is symlinked e.g. in the Next.js monorepo\n modulePath.includes('next/dist')\n )\n}\n\nexport const base = curry(function base(\n ctx: ConfigurationContext,\n config: webpack.Configuration\n) {\n config.mode = ctx.isDevelopment ? 'development' : 'production'\n config.name = ctx.isServer\n ? ctx.isEdgeRuntime\n ? COMPILER_NAMES.edgeServer\n : COMPILER_NAMES.server\n : COMPILER_NAMES.client\n\n config.target = !ctx.targetWeb\n ? 'node18.17' // Same version defined in packages/next/package.json#engines\n : ctx.isEdgeRuntime\n ? ['web', 'es6']\n : ['web', 'es6']\n\n // https://webpack.js.org/configuration/devtool/#development\n if (ctx.isDevelopment) {\n if (process.env.__NEXT_TEST_MODE && !process.env.__NEXT_TEST_WITH_DEVTOOL) {\n config.devtool = false\n } else {\n // `eval-source-map` provides full-fidelity source maps for the\n // original source, including columns and original variable names.\n // This is desirable so the in-browser debugger can correctly pause\n // and show scoped variables with their original names.\n config.devtool = 'eval-source-map'\n }\n } else {\n if (\n ctx.isEdgeRuntime ||\n (ctx.isServer && ctx.serverSourceMaps) ||\n // Enable browser sourcemaps:\n (ctx.productionBrowserSourceMaps && ctx.isClient)\n ) {\n config.devtool = 'source-map'\n config.plugins ??= []\n config.plugins.push(\n new DevToolsIgnorePlugin({\n // TODO: eval-source-map has different module paths than source-map.\n // We're currently not actually ignore listing anything.\n shouldIgnorePath,\n })\n )\n } else {\n config.devtool = false\n }\n }\n\n if (!config.module) {\n config.module = { rules: [] }\n }\n\n config.plugins ??= []\n if (config.devtool === 'source-map') {\n config.plugins.push(\n new DevToolsIgnorePlugin({\n shouldIgnorePath,\n })\n )\n } else if (config.devtool === 'eval-source-map') {\n // We're using a fork of `eval-source-map`\n config.devtool = false\n config.plugins.push(\n new EvalSourceMapDevToolPlugin({\n moduleFilenameTemplate: config.output?.devtoolModuleFilenameTemplate,\n shouldIgnorePath,\n })\n )\n }\n\n // TODO: add codemod for \"Should not import the named export\" with JSON files\n // config.module.strictExportPresence = !isWebpack5\n\n return config\n})\n"],"names":["curry","COMPILER_NAMES","DevToolsIgnorePlugin","EvalSourceMapDevToolPlugin","shouldIgnorePath","modulePath","includes","base","ctx","config","mode","isDevelopment","name","isServer","isEdgeRuntime","edgeServer","server","client","target","targetWeb","process","env","__NEXT_TEST_MODE","__NEXT_TEST_WITH_DEVTOOL","devtool","serverSourceMaps","productionBrowserSourceMaps","isClient","plugins","push","module","rules","moduleFilenameTemplate","output","devtoolModuleFilenameTemplate"],"mappings":"AAAA,OAAOA,WAAW,kCAAiC;AAEnD,SAASC,cAAc,QAAQ,mCAAkC;AAEjE,OAAOC,0BAA0B,4CAA2C;AAC5E,OAAOC,gCAAgC,gDAA+C;AAEtF,SAASC,iBAAiBC,UAAkB;IAC1C,OACEA,WAAWC,QAAQ,CAAC,mBACpB,2EAA2E;IAC3ED,WAAWC,QAAQ,CAAC;AAExB;AAEA,OAAO,MAAMC,OAAOP,MAAM,SAASO,KACjCC,GAAyB,EACzBC,MAA6B;IAE7BA,OAAOC,IAAI,GAAGF,IAAIG,aAAa,GAAG,gBAAgB;IAClDF,OAAOG,IAAI,GAAGJ,IAAIK,QAAQ,GACtBL,IAAIM,aAAa,GACfb,eAAec,UAAU,GACzBd,eAAee,MAAM,GACvBf,eAAegB,MAAM;IAEzBR,OAAOS,MAAM,GAAG,CAACV,IAAIW,SAAS,GAC1B,YAAY,6DAA6D;OACzEX,IAAIM,aAAa,GACf;QAAC;QAAO;KAAM,GACd;QAAC;QAAO;KAAM;IAEpB,4DAA4D;IAC5D,IAAIN,IAAIG,aAAa,EAAE;QACrB,IAAIS,QAAQC,GAAG,CAACC,gBAAgB,IAAI,CAACF,QAAQC,GAAG,CAACE,wBAAwB,EAAE;YACzEd,OAAOe,OAAO,GAAG;QACnB,OAAO;YACL,+DAA+D;YAC/D,kEAAkE;YAClE,mEAAmE;YACnE,uDAAuD;YACvDf,OAAOe,OAAO,GAAG;QACnB;IACF,OAAO;QACL,IACEhB,IAAIM,aAAa,IAChBN,IAAIK,QAAQ,IAAIL,
|
1
|
+
{"version":3,"sources":["../../../../../src/build/webpack/config/blocks/base.ts"],"sourcesContent":["import curry from 'next/dist/compiled/lodash.curry'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { COMPILER_NAMES } from '../../../../shared/lib/constants'\nimport type { ConfigurationContext } from '../utils'\nimport DevToolsIgnorePlugin from '../../plugins/devtools-ignore-list-plugin'\nimport EvalSourceMapDevToolPlugin from '../../plugins/eval-source-map-dev-tool-plugin'\n\nfunction shouldIgnorePath(modulePath: string): boolean {\n return (\n modulePath.includes('node_modules') ||\n // Only relevant for when Next.js is symlinked e.g. in the Next.js monorepo\n modulePath.includes('next/dist')\n )\n}\n\nexport const base = curry(function base(\n ctx: ConfigurationContext,\n config: webpack.Configuration\n) {\n config.mode = ctx.isDevelopment ? 'development' : 'production'\n config.name = ctx.isServer\n ? ctx.isEdgeRuntime\n ? COMPILER_NAMES.edgeServer\n : COMPILER_NAMES.server\n : COMPILER_NAMES.client\n\n config.target = !ctx.targetWeb\n ? 'node18.17' // Same version defined in packages/next/package.json#engines\n : ctx.isEdgeRuntime\n ? ['web', 'es6']\n : ['web', 'es6']\n\n // https://webpack.js.org/configuration/devtool/#development\n if (ctx.isDevelopment) {\n if (process.env.__NEXT_TEST_MODE && !process.env.__NEXT_TEST_WITH_DEVTOOL) {\n config.devtool = false\n } else if (process.env.NEXT_RSPACK) {\n config.devtool = 'source-map'\n } else {\n // `eval-source-map` provides full-fidelity source maps for the\n // original source, including columns and original variable names.\n // This is desirable so the in-browser debugger can correctly pause\n // and show scoped variables with their original names.\n config.devtool = 'eval-source-map'\n }\n } else {\n if (\n ctx.isEdgeRuntime ||\n (ctx.isServer && ctx.serverSourceMaps) ||\n // Enable browser sourcemaps:\n (ctx.productionBrowserSourceMaps && ctx.isClient)\n ) {\n config.devtool = 'source-map'\n config.plugins ??= []\n config.plugins.push(\n new DevToolsIgnorePlugin({\n // TODO: eval-source-map has different module paths than source-map.\n // We're currently not actually ignore listing anything.\n shouldIgnorePath,\n })\n )\n } else {\n config.devtool = false\n }\n }\n\n if (!config.module) {\n config.module = { rules: [] }\n }\n\n config.plugins ??= []\n if (config.devtool === 'source-map') {\n config.plugins.push(\n new DevToolsIgnorePlugin({\n shouldIgnorePath,\n })\n )\n } else if (config.devtool === 'eval-source-map' && !process.env.NEXT_RSPACK) {\n // We're using a fork of `eval-source-map`\n config.devtool = false\n config.plugins.push(\n new EvalSourceMapDevToolPlugin({\n moduleFilenameTemplate: config.output?.devtoolModuleFilenameTemplate,\n shouldIgnorePath,\n })\n )\n }\n\n // TODO: add codemod for \"Should not import the named export\" with JSON files\n // config.module.strictExportPresence = !isWebpack5\n\n return config\n})\n"],"names":["curry","COMPILER_NAMES","DevToolsIgnorePlugin","EvalSourceMapDevToolPlugin","shouldIgnorePath","modulePath","includes","base","ctx","config","mode","isDevelopment","name","isServer","isEdgeRuntime","edgeServer","server","client","target","targetWeb","process","env","__NEXT_TEST_MODE","__NEXT_TEST_WITH_DEVTOOL","devtool","NEXT_RSPACK","serverSourceMaps","productionBrowserSourceMaps","isClient","plugins","push","module","rules","moduleFilenameTemplate","output","devtoolModuleFilenameTemplate"],"mappings":"AAAA,OAAOA,WAAW,kCAAiC;AAEnD,SAASC,cAAc,QAAQ,mCAAkC;AAEjE,OAAOC,0BAA0B,4CAA2C;AAC5E,OAAOC,gCAAgC,gDAA+C;AAEtF,SAASC,iBAAiBC,UAAkB;IAC1C,OACEA,WAAWC,QAAQ,CAAC,mBACpB,2EAA2E;IAC3ED,WAAWC,QAAQ,CAAC;AAExB;AAEA,OAAO,MAAMC,OAAOP,MAAM,SAASO,KACjCC,GAAyB,EACzBC,MAA6B;IAE7BA,OAAOC,IAAI,GAAGF,IAAIG,aAAa,GAAG,gBAAgB;IAClDF,OAAOG,IAAI,GAAGJ,IAAIK,QAAQ,GACtBL,IAAIM,aAAa,GACfb,eAAec,UAAU,GACzBd,eAAee,MAAM,GACvBf,eAAegB,MAAM;IAEzBR,OAAOS,MAAM,GAAG,CAACV,IAAIW,SAAS,GAC1B,YAAY,6DAA6D;OACzEX,IAAIM,aAAa,GACf;QAAC;QAAO;KAAM,GACd;QAAC;QAAO;KAAM;IAEpB,4DAA4D;IAC5D,IAAIN,IAAIG,aAAa,EAAE;QACrB,IAAIS,QAAQC,GAAG,CAACC,gBAAgB,IAAI,CAACF,QAAQC,GAAG,CAACE,wBAAwB,EAAE;YACzEd,OAAOe,OAAO,GAAG;QACnB,OAAO,IAAIJ,QAAQC,GAAG,CAACI,WAAW,EAAE;YAClChB,OAAOe,OAAO,GAAG;QACnB,OAAO;YACL,+DAA+D;YAC/D,kEAAkE;YAClE,mEAAmE;YACnE,uDAAuD;YACvDf,OAAOe,OAAO,GAAG;QACnB;IACF,OAAO;QACL,IACEhB,IAAIM,aAAa,IAChBN,IAAIK,QAAQ,IAAIL,IAAIkB,gBAAgB,IACrC,6BAA6B;QAC5BlB,IAAImB,2BAA2B,IAAInB,IAAIoB,QAAQ,EAChD;YACAnB,OAAOe,OAAO,GAAG;YACjBf,OAAOoB,OAAO,KAAK,EAAE;YACrBpB,OAAOoB,OAAO,CAACC,IAAI,CACjB,IAAI5B,qBAAqB;gBACvB,oEAAoE;gBACpE,wDAAwD;gBACxDE;YACF;QAEJ,OAAO;YACLK,OAAOe,OAAO,GAAG;QACnB;IACF;IAEA,IAAI,CAACf,OAAOsB,MAAM,EAAE;QAClBtB,OAAOsB,MAAM,GAAG;YAAEC,OAAO,EAAE;QAAC;IAC9B;IAEAvB,OAAOoB,OAAO,KAAK,EAAE;IACrB,IAAIpB,OAAOe,OAAO,KAAK,cAAc;QACnCf,OAAOoB,OAAO,CAACC,IAAI,CACjB,IAAI5B,qBAAqB;YACvBE;QACF;IAEJ,OAAO,IAAIK,OAAOe,OAAO,KAAK,qBAAqB,CAACJ,QAAQC,GAAG,CAACI,WAAW,EAAE;YAK/ChB;QAJ5B,0CAA0C;QAC1CA,OAAOe,OAAO,GAAG;QACjBf,OAAOoB,OAAO,CAACC,IAAI,CACjB,IAAI3B,2BAA2B;YAC7B8B,sBAAsB,GAAExB,iBAAAA,OAAOyB,MAAM,qBAAbzB,eAAe0B,6BAA6B;YACpE/B;QACF;IAEJ;IAEA,6EAA6E;IAC7E,mDAAmD;IAEnD,OAAOK;AACT,GAAE"}
|
@@ -7,6 +7,7 @@ import { getCustomDocumentError, getGlobalImportError, getGlobalModuleImportErro
|
|
7
7
|
import { getPostCssPlugins } from './plugins';
|
8
8
|
import { nonNullable } from '../../../../../lib/non-nullable';
|
9
9
|
import { WEBPACK_LAYERS } from '../../../../../lib/constants';
|
10
|
+
import { getRspackCore } from '../../../../../shared/lib/get-rspack';
|
10
11
|
// RegExps for all Style Sheet variants
|
11
12
|
export const regexLikeCss = /\.(css|scss|sass)$/;
|
12
13
|
// RegExps for Style Sheets
|
@@ -101,6 +102,7 @@ export async function lazyPostCSS(rootDirectory, supportedBrowsers, disablePostc
|
|
101
102
|
return postcssInstancePromise;
|
102
103
|
}
|
103
104
|
export const css = curry(async function css(ctx, config) {
|
105
|
+
const isRspack = Boolean(process.env.NEXT_RSPACK);
|
104
106
|
const { prependData: sassPrependData, additionalData: sassAdditionalData, implementation: sassImplementation, ...sassOptions } = ctx.sassOptions;
|
105
107
|
const lazyPostCSSInitializer = ()=>lazyPostCSS(ctx.rootDirectory, ctx.supportedBrowsers, ctx.experimental.disablePostcssPresetEnv, ctx.experimental.useLightningcss);
|
106
108
|
const sassPreprocessors = [
|
@@ -508,7 +510,7 @@ export const css = curry(async function css(ctx, config) {
|
|
508
510
|
// Enable full mini-css-extract-plugin hmr for prod mode pages or app dir
|
509
511
|
if (ctx.isClient && (ctx.isProduction || ctx.hasAppDir)) {
|
510
512
|
// Extract CSS as CSS file(s) in the client-side production bundle.
|
511
|
-
const MiniCssExtractPlugin = require('../../../plugins/mini-css-extract-plugin').default;
|
513
|
+
const MiniCssExtractPlugin = isRspack ? getRspackCore().CssExtractRspackPlugin : require('../../../plugins/mini-css-extract-plugin').default;
|
512
514
|
fns.push(plugin(// @ts-ignore webpack 5 compat
|
513
515
|
new MiniCssExtractPlugin({
|
514
516
|
filename: ctx.isProduction ? 'static/css/[contenthash].css' : 'static/css/[name].css',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/build/webpack/config/blocks/css/index.ts"],"sourcesContent":["import curry from 'next/dist/compiled/lodash.curry'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { loader, plugin } from '../../helpers'\nimport { pipe } from '../../utils'\nimport type { ConfigurationContext, ConfigurationFn } from '../../utils'\nimport { getCssModuleLoader, getGlobalCssLoader } from './loaders'\nimport { getNextFontLoader } from './loaders/next-font'\nimport {\n getCustomDocumentError,\n getGlobalImportError,\n getGlobalModuleImportError,\n getLocalModuleImportError,\n} from './messages'\nimport { getPostCssPlugins } from './plugins'\nimport { nonNullable } from '../../../../../lib/non-nullable'\nimport { WEBPACK_LAYERS } from '../../../../../lib/constants'\n\n// RegExps for all Style Sheet variants\nexport const regexLikeCss = /\\.(css|scss|sass)$/\n\n// RegExps for Style Sheets\nconst regexCssGlobal = /(?<!\\.module)\\.css$/\nconst regexCssModules = /\\.module\\.css$/\n\n// RegExps for Syntactically Awesome Style Sheets\nconst regexSassGlobal = /(?<!\\.module)\\.(scss|sass)$/\nconst regexSassModules = /\\.module\\.(scss|sass)$/\n\nconst APP_LAYER_RULE = {\n or: [\n WEBPACK_LAYERS.reactServerComponents,\n WEBPACK_LAYERS.serverSideRendering,\n WEBPACK_LAYERS.appPagesBrowser,\n ],\n}\n\nconst PAGES_LAYER_RULE = {\n not: [\n WEBPACK_LAYERS.reactServerComponents,\n WEBPACK_LAYERS.serverSideRendering,\n WEBPACK_LAYERS.appPagesBrowser,\n ],\n}\n\n/**\n * Mark a rule as removable if built-in CSS support is disabled\n */\nfunction markRemovable(r: webpack.RuleSetRule): webpack.RuleSetRule {\n Object.defineProperty(r, Symbol.for('__next_css_remove'), {\n enumerable: false,\n value: true,\n })\n return r\n}\n\nlet postcssInstancePromise: Promise<any>\nexport async function lazyPostCSS(\n rootDirectory: string,\n supportedBrowsers: string[] | undefined,\n disablePostcssPresetEnv: boolean | undefined,\n useLightningcss: boolean | undefined\n) {\n if (!postcssInstancePromise) {\n postcssInstancePromise = (async () => {\n const postcss = require('postcss')\n // @ts-ignore backwards compat\n postcss.plugin = function postcssPlugin(name, initializer) {\n function creator(...args: any) {\n let transformer = initializer(...args)\n transformer.postcssPlugin = name\n // transformer.postcssVersion = new Processor().version\n return transformer\n }\n\n let cache: any\n Object.defineProperty(creator, 'postcss', {\n get() {\n if (!cache) cache = creator()\n return cache\n },\n })\n\n creator.process = function (\n css: any,\n processOpts: any,\n pluginOpts: any\n ) {\n return postcss([creator(pluginOpts)]).process(css, processOpts)\n }\n\n return creator\n }\n\n // @ts-ignore backwards compat\n postcss.vendor = {\n /**\n * Returns the vendor prefix extracted from an input string.\n *\n * @example\n * postcss.vendor.prefix('-moz-tab-size') //=> '-moz-'\n * postcss.vendor.prefix('tab-size') //=> ''\n */\n prefix: function prefix(prop: string): string {\n const match = prop.match(/^(-\\w+-)/)\n\n if (match) {\n return match[0]\n }\n\n return ''\n },\n\n /**\n * Returns the input string stripped of its vendor prefix.\n *\n * @example\n * postcss.vendor.unprefixed('-moz-tab-size') //=> 'tab-size'\n */\n unprefixed: function unprefixed(\n /**\n * String with or without vendor prefix.\n */\n prop: string\n ): string {\n return prop.replace(/^-\\w+-/, '')\n },\n }\n\n const postCssPlugins = await getPostCssPlugins(\n rootDirectory,\n supportedBrowsers,\n disablePostcssPresetEnv,\n useLightningcss\n )\n\n return {\n postcss,\n postcssWithPlugins: postcss(postCssPlugins),\n }\n })()\n }\n\n return postcssInstancePromise\n}\n\nexport const css = curry(async function css(\n ctx: ConfigurationContext,\n config: webpack.Configuration\n) {\n const {\n prependData: sassPrependData,\n additionalData: sassAdditionalData,\n implementation: sassImplementation,\n ...sassOptions\n } = ctx.sassOptions\n\n const lazyPostCSSInitializer = () =>\n lazyPostCSS(\n ctx.rootDirectory,\n ctx.supportedBrowsers,\n ctx.experimental.disablePostcssPresetEnv,\n ctx.experimental.useLightningcss\n )\n\n const sassPreprocessors: webpack.RuleSetUseItem[] = [\n // First, process files with `sass-loader`: this inlines content, and\n // compiles away the proprietary syntax.\n {\n loader: require.resolve('next/dist/compiled/sass-loader'),\n options: {\n implementation: sassImplementation,\n // Source maps are required so that `resolve-url-loader` can locate\n // files original to their source directory.\n sourceMap: true,\n sassOptions: {\n // The \"fibers\" option is not needed for Node.js 16+, but it's causing\n // problems for Node.js <= 14 users as you'll have to manually install\n // the `fibers` package:\n // https://github.com/webpack-contrib/sass-loader#:~:text=We%20automatically%20inject%20the%20fibers%20package\n // https://github.com/vercel/next.js/issues/45052\n // Since it's optional and not required, we'll disable it by default\n // to avoid the confusion.\n fibers: false,\n // TODO: Remove this once we upgrade to sass-loader 16\n silenceDeprecations: ['legacy-js-api'],\n ...sassOptions,\n },\n additionalData: sassPrependData || sassAdditionalData,\n },\n },\n // Then, `sass-loader` will have passed-through CSS imports as-is instead\n // of inlining them. Because they were inlined, the paths are no longer\n // correct.\n // To fix this, we use `resolve-url-loader` to rewrite the CSS\n // imports to real file paths.\n {\n loader: require.resolve('../../../loaders/resolve-url-loader/index'),\n options: {\n postcss: lazyPostCSSInitializer,\n // Source maps are not required here, but we may as well emit\n // them.\n sourceMap: true,\n },\n },\n ]\n\n const fns: ConfigurationFn[] = []\n\n const googleLoader = require.resolve(\n 'next/dist/compiled/@next/font/google/loader'\n )\n const localLoader = require.resolve(\n 'next/dist/compiled/@next/font/local/loader'\n )\n const nextFontLoaders: Array<[string | RegExp, string, any?]> = [\n [require.resolve('next/font/google/target.css'), googleLoader],\n [require.resolve('next/font/local/target.css'), localLoader],\n ]\n\n nextFontLoaders.forEach(([fontLoaderTarget, fontLoaderPath]) => {\n // Matches the resolved font loaders noop files to run next-font-loader\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n sideEffects: false,\n test: fontLoaderTarget,\n use: getNextFontLoader(ctx, lazyPostCSSInitializer, fontLoaderPath),\n }),\n ],\n })\n )\n })\n\n // CSS cannot be imported in _document. This comes before everything because\n // global CSS nor CSS modules work in said file.\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: regexLikeCss,\n // Use a loose regex so we don't have to crawl the file system to\n // find the real file name (if present).\n issuer: /pages[\\\\/]_document\\./,\n use: {\n loader: 'error-loader',\n options: {\n reason: getCustomDocumentError(),\n },\n },\n }),\n ],\n })\n )\n\n const shouldIncludeExternalCSSImports =\n !!ctx.experimental.craCompat || !!ctx.transpilePackages\n\n // CSS modules & SASS modules support. They are allowed to be imported in anywhere.\n fns.push(\n // CSS Modules should never have side effects. This setting will\n // allow unused CSS to be removed from the production build.\n // We ensure this by disallowing `:global()` CSS at the top-level\n // via the `pure` mode in `css-loader`.\n loader({\n oneOf: [\n // For app dir, we need to match the specific app layer.\n ctx.hasAppDir\n ? markRemovable({\n sideEffects: true,\n test: regexCssModules,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: true,\n },\n },\n ...getCssModuleLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer\n ),\n ],\n })\n : null,\n markRemovable({\n sideEffects: true,\n test: regexCssModules,\n issuerLayer: PAGES_LAYER_RULE,\n use: getCssModuleLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n ].filter(nonNullable),\n }),\n // Opt-in support for Sass (using .scss or .sass extensions).\n // Sass Modules should never have side effects. This setting will\n // allow unused Sass to be removed from the production build.\n // We ensure this by disallowing `:global()` Sass at the top-level\n // via the `pure` mode in `css-loader`.\n loader({\n oneOf: [\n // For app dir, we need to match the specific app layer.\n ctx.hasAppDir\n ? markRemovable({\n sideEffects: true,\n test: regexSassModules,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: true,\n },\n },\n ...getCssModuleLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n ],\n })\n : null,\n markRemovable({\n sideEffects: true,\n test: regexSassModules,\n issuerLayer: PAGES_LAYER_RULE,\n use: getCssModuleLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ].filter(nonNullable),\n }),\n // Throw an error for CSS Modules used outside their supported scope\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssModules, regexSassModules],\n use: {\n loader: 'error-loader',\n options: {\n reason: getLocalModuleImportError(),\n },\n },\n }),\n ],\n })\n )\n\n // Global CSS and SASS support.\n if (ctx.isServer) {\n fns.push(\n loader({\n oneOf: [\n ctx.hasAppDir && !ctx.isProduction\n ? markRemovable({\n sideEffects: true,\n test: [regexCssGlobal, regexSassGlobal],\n issuerLayer: APP_LAYER_RULE,\n use: {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n })\n : null,\n markRemovable({\n // CSS imports have side effects, even on the server side.\n sideEffects: true,\n test: [regexCssGlobal, regexSassGlobal],\n use: require.resolve('next/dist/compiled/ignore-loader'),\n }),\n ].filter(nonNullable),\n })\n )\n } else {\n // External CSS files are allowed to be loaded when any of the following is true:\n // - hasAppDir: all CSS files are allowed\n // - If the CSS file is located in `node_modules`\n // - If the CSS file is located in another package in a monorepo (outside of the current rootDir)\n // - If the issuer is pages/_app (matched later)\n const allowedPagesGlobalCSSPath = ctx.hasAppDir\n ? undefined\n : {\n and: [\n {\n or: [\n /node_modules/,\n {\n not: [ctx.rootDirectory],\n },\n ],\n },\n ],\n }\n const allowedPagesGlobalCSSIssuer = ctx.hasAppDir\n ? undefined\n : shouldIncludeExternalCSSImports\n ? undefined\n : {\n and: [ctx.rootDirectory],\n not: [/node_modules/],\n }\n\n fns.push(\n loader({\n oneOf: [\n ...(ctx.hasAppDir\n ? [\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n ...getGlobalCssLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer\n ),\n ],\n }),\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n ...getGlobalCssLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n ],\n }),\n ]\n : []),\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n include: allowedPagesGlobalCSSPath,\n issuer: allowedPagesGlobalCSSIssuer,\n issuerLayer: PAGES_LAYER_RULE,\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n include: allowedPagesGlobalCSSPath,\n issuer: allowedPagesGlobalCSSIssuer,\n issuerLayer: PAGES_LAYER_RULE,\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ].filter(nonNullable),\n })\n )\n\n if (ctx.customAppFile) {\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n issuer: { and: [ctx.customAppFile] },\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n ],\n }),\n loader({\n oneOf: [\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n issuer: { and: [ctx.customAppFile] },\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ],\n })\n )\n }\n }\n\n // Throw an error for Global CSS used inside of `node_modules`\n if (!shouldIncludeExternalCSSImports) {\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssGlobal, regexSassGlobal],\n issuer: { and: [/node_modules/] },\n use: {\n loader: 'error-loader',\n options: {\n reason: getGlobalModuleImportError(),\n },\n },\n }),\n ],\n })\n )\n }\n\n // Throw an error for Global CSS used outside of our custom <App> file\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssGlobal, regexSassGlobal],\n issuer: ctx.hasAppDir\n ? {\n // If it's inside the app dir, but not importing from a layout file,\n // throw an error.\n and: [ctx.rootDirectory],\n not: [/layout\\.(js|mjs|jsx|ts|tsx)$/],\n }\n : undefined,\n use: {\n loader: 'error-loader',\n options: {\n reason: getGlobalImportError(),\n },\n },\n }),\n ],\n })\n )\n\n if (ctx.isClient) {\n // Automatically transform references to files (i.e. url()) into URLs\n // e.g. url(./logo.svg)\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n // This should only be applied to CSS files\n issuer: regexLikeCss,\n // Exclude extensions that webpack handles by default\n exclude: [\n /\\.(js|mjs|jsx|ts|tsx)$/,\n /\\.html$/,\n /\\.json$/,\n /\\.webpack\\[[^\\]]+\\]$/,\n ],\n // `asset/resource` always emits a URL reference, where `asset`\n // might inline the asset as a data URI\n type: 'asset/resource',\n }),\n ],\n })\n )\n }\n\n // Enable full mini-css-extract-plugin hmr for prod mode pages or app dir\n if (ctx.isClient && (ctx.isProduction || ctx.hasAppDir)) {\n // Extract CSS as CSS file(s) in the client-side production bundle.\n const MiniCssExtractPlugin =\n require('../../../plugins/mini-css-extract-plugin').default\n fns.push(\n plugin(\n // @ts-ignore webpack 5 compat\n new MiniCssExtractPlugin({\n filename: ctx.isProduction\n ? 'static/css/[contenthash].css'\n : 'static/css/[name].css',\n chunkFilename: ctx.isProduction\n ? 'static/css/[contenthash].css'\n : 'static/css/[name].css',\n // Next.js guarantees that CSS order \"doesn't matter\", due to imposed\n // restrictions:\n // 1. Global CSS can only be defined in a single entrypoint (_app)\n // 2. CSS Modules generate scoped class names by default and cannot\n // include Global CSS (:global() selector).\n //\n // While not a perfect guarantee (e.g. liberal use of `:global()`\n // selector), this assumption is required to code-split CSS.\n //\n // If this warning were to trigger, it'd be unactionable by the user,\n // but likely not valid -- so we disable it.\n ignoreOrder: true,\n insert: function (linkTag: HTMLLinkElement) {\n if (typeof _N_E_STYLE_LOAD === 'function') {\n const { href, onload, onerror } = linkTag\n _N_E_STYLE_LOAD(\n href.indexOf(window.location.origin) === 0\n ? new URL(href).pathname\n : href\n ).then(\n () => onload?.call(linkTag, { type: 'load' } as Event),\n () => onerror?.call(linkTag, {} as Event)\n )\n } else {\n document.head.appendChild(linkTag)\n }\n },\n })\n )\n )\n }\n\n const fn = pipe(...fns)\n return fn(config)\n})\n"],"names":["curry","loader","plugin","pipe","getCssModuleLoader","getGlobalCssLoader","getNextFontLoader","getCustomDocumentError","getGlobalImportError","getGlobalModuleImportError","getLocalModuleImportError","getPostCssPlugins","nonNullable","WEBPACK_LAYERS","regexLikeCss","regexCssGlobal","regexCssModules","regexSassGlobal","regexSassModules","APP_LAYER_RULE","or","reactServerComponents","serverSideRendering","appPagesBrowser","PAGES_LAYER_RULE","not","markRemovable","r","Object","defineProperty","Symbol","for","enumerable","value","postcssInstancePromise","lazyPostCSS","rootDirectory","supportedBrowsers","disablePostcssPresetEnv","useLightningcss","postcss","require","postcssPlugin","name","initializer","creator","args","transformer","cache","get","process","css","processOpts","pluginOpts","vendor","prefix","prop","match","unprefixed","replace","postCssPlugins","postcssWithPlugins","ctx","config","prependData","sassPrependData","additionalData","sassAdditionalData","implementation","sassImplementation","sassOptions","lazyPostCSSInitializer","experimental","sassPreprocessors","resolve","options","sourceMap","fibers","silenceDeprecations","fns","googleLoader","localLoader","nextFontLoaders","forEach","fontLoaderTarget","fontLoaderPath","push","oneOf","sideEffects","test","use","issuer","reason","shouldIncludeExternalCSSImports","craCompat","transpilePackages","hasAppDir","issuerLayer","cssModules","isAppDir","filter","isServer","isProduction","allowedPagesGlobalCSSPath","undefined","and","allowedPagesGlobalCSSIssuer","include","customAppFile","isClient","exclude","type","MiniCssExtractPlugin","default","filename","chunkFilename","ignoreOrder","insert","linkTag","_N_E_STYLE_LOAD","href","onload","onerror","indexOf","window","location","origin","URL","pathname","then","call","document","head","appendChild","fn"],"mappings":"AAAA,OAAOA,WAAW,kCAAiC;AAEnD,SAASC,MAAM,EAAEC,MAAM,QAAQ,gBAAe;AAC9C,SAASC,IAAI,QAAQ,cAAa;AAElC,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,YAAW;AAClE,SAASC,iBAAiB,QAAQ,sBAAqB;AACvD,SACEC,sBAAsB,EACtBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,yBAAyB,QACpB,aAAY;AACnB,SAASC,iBAAiB,QAAQ,YAAW;AAC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YAClE,mEAAmE;YACnE,8CAA8C;YAC9C,EAAE;YACF,iEAAiE;YACjE,4DAA4D;YAC5D,EAAE;YACF,qEAAqE;YACrE,4CAA4C;YAC5Cc,aAAa;YACbC,QAAQ,SAAUC,OAAwB;gBACxC,IAAI,OAAOC,oBAAoB,YAAY;oBACzC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGJ;oBAClCC,gBACEC,KAAKG,OAAO,CAACC,OAAOC,QAAQ,CAACC,MAAM,MAAM,IACrC,IAAIC,IAAIP,MAAMQ,QAAQ,GACtBR,MACJS,IAAI,CACJ,IAAMR,0BAAAA,OAAQS,IAAI,CAACZ,SAAS;4BAAEP,MAAM;wBAAO,IAC3C,IAAMW,2BAAAA,QAASQ,IAAI,CAACZ,SAAS,CAAC;gBAElC,OAAO;oBACLa,SAASC,IAAI,CAACC,WAAW,CAACf;gBAC5B;YACF;QACF;IAGN;IAEA,MAAMgB,KAAKnI,QAAQ4E;IACnB,OAAOuD,GAAGvE;AACZ,GAAE"}
|
1
|
+
{"version":3,"sources":["../../../../../../src/build/webpack/config/blocks/css/index.ts"],"sourcesContent":["import curry from 'next/dist/compiled/lodash.curry'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { loader, plugin } from '../../helpers'\nimport { pipe } from '../../utils'\nimport type { ConfigurationContext, ConfigurationFn } from '../../utils'\nimport { getCssModuleLoader, getGlobalCssLoader } from './loaders'\nimport { getNextFontLoader } from './loaders/next-font'\nimport {\n getCustomDocumentError,\n getGlobalImportError,\n getGlobalModuleImportError,\n getLocalModuleImportError,\n} from './messages'\nimport { getPostCssPlugins } from './plugins'\nimport { nonNullable } from '../../../../../lib/non-nullable'\nimport { WEBPACK_LAYERS } from '../../../../../lib/constants'\nimport { getRspackCore } from '../../../../../shared/lib/get-rspack'\n\n// RegExps for all Style Sheet variants\nexport const regexLikeCss = /\\.(css|scss|sass)$/\n\n// RegExps for Style Sheets\nconst regexCssGlobal = /(?<!\\.module)\\.css$/\nconst regexCssModules = /\\.module\\.css$/\n\n// RegExps for Syntactically Awesome Style Sheets\nconst regexSassGlobal = /(?<!\\.module)\\.(scss|sass)$/\nconst regexSassModules = /\\.module\\.(scss|sass)$/\n\nconst APP_LAYER_RULE = {\n or: [\n WEBPACK_LAYERS.reactServerComponents,\n WEBPACK_LAYERS.serverSideRendering,\n WEBPACK_LAYERS.appPagesBrowser,\n ],\n}\n\nconst PAGES_LAYER_RULE = {\n not: [\n WEBPACK_LAYERS.reactServerComponents,\n WEBPACK_LAYERS.serverSideRendering,\n WEBPACK_LAYERS.appPagesBrowser,\n ],\n}\n\n/**\n * Mark a rule as removable if built-in CSS support is disabled\n */\nfunction markRemovable(r: webpack.RuleSetRule): webpack.RuleSetRule {\n Object.defineProperty(r, Symbol.for('__next_css_remove'), {\n enumerable: false,\n value: true,\n })\n return r\n}\n\nlet postcssInstancePromise: Promise<any>\nexport async function lazyPostCSS(\n rootDirectory: string,\n supportedBrowsers: string[] | undefined,\n disablePostcssPresetEnv: boolean | undefined,\n useLightningcss: boolean | undefined\n) {\n if (!postcssInstancePromise) {\n postcssInstancePromise = (async () => {\n const postcss = require('postcss')\n // @ts-ignore backwards compat\n postcss.plugin = function postcssPlugin(name, initializer) {\n function creator(...args: any) {\n let transformer = initializer(...args)\n transformer.postcssPlugin = name\n // transformer.postcssVersion = new Processor().version\n return transformer\n }\n\n let cache: any\n Object.defineProperty(creator, 'postcss', {\n get() {\n if (!cache) cache = creator()\n return cache\n },\n })\n\n creator.process = function (\n css: any,\n processOpts: any,\n pluginOpts: any\n ) {\n return postcss([creator(pluginOpts)]).process(css, processOpts)\n }\n\n return creator\n }\n\n // @ts-ignore backwards compat\n postcss.vendor = {\n /**\n * Returns the vendor prefix extracted from an input string.\n *\n * @example\n * postcss.vendor.prefix('-moz-tab-size') //=> '-moz-'\n * postcss.vendor.prefix('tab-size') //=> ''\n */\n prefix: function prefix(prop: string): string {\n const match = prop.match(/^(-\\w+-)/)\n\n if (match) {\n return match[0]\n }\n\n return ''\n },\n\n /**\n * Returns the input string stripped of its vendor prefix.\n *\n * @example\n * postcss.vendor.unprefixed('-moz-tab-size') //=> 'tab-size'\n */\n unprefixed: function unprefixed(\n /**\n * String with or without vendor prefix.\n */\n prop: string\n ): string {\n return prop.replace(/^-\\w+-/, '')\n },\n }\n\n const postCssPlugins = await getPostCssPlugins(\n rootDirectory,\n supportedBrowsers,\n disablePostcssPresetEnv,\n useLightningcss\n )\n\n return {\n postcss,\n postcssWithPlugins: postcss(postCssPlugins),\n }\n })()\n }\n\n return postcssInstancePromise\n}\n\nexport const css = curry(async function css(\n ctx: ConfigurationContext,\n config: webpack.Configuration\n) {\n const isRspack = Boolean(process.env.NEXT_RSPACK)\n const {\n prependData: sassPrependData,\n additionalData: sassAdditionalData,\n implementation: sassImplementation,\n ...sassOptions\n } = ctx.sassOptions\n\n const lazyPostCSSInitializer = () =>\n lazyPostCSS(\n ctx.rootDirectory,\n ctx.supportedBrowsers,\n ctx.experimental.disablePostcssPresetEnv,\n ctx.experimental.useLightningcss\n )\n\n const sassPreprocessors: webpack.RuleSetUseItem[] = [\n // First, process files with `sass-loader`: this inlines content, and\n // compiles away the proprietary syntax.\n {\n loader: require.resolve('next/dist/compiled/sass-loader'),\n options: {\n implementation: sassImplementation,\n // Source maps are required so that `resolve-url-loader` can locate\n // files original to their source directory.\n sourceMap: true,\n sassOptions: {\n // The \"fibers\" option is not needed for Node.js 16+, but it's causing\n // problems for Node.js <= 14 users as you'll have to manually install\n // the `fibers` package:\n // https://github.com/webpack-contrib/sass-loader#:~:text=We%20automatically%20inject%20the%20fibers%20package\n // https://github.com/vercel/next.js/issues/45052\n // Since it's optional and not required, we'll disable it by default\n // to avoid the confusion.\n fibers: false,\n // TODO: Remove this once we upgrade to sass-loader 16\n silenceDeprecations: ['legacy-js-api'],\n ...sassOptions,\n },\n additionalData: sassPrependData || sassAdditionalData,\n },\n },\n // Then, `sass-loader` will have passed-through CSS imports as-is instead\n // of inlining them. Because they were inlined, the paths are no longer\n // correct.\n // To fix this, we use `resolve-url-loader` to rewrite the CSS\n // imports to real file paths.\n {\n loader: require.resolve('../../../loaders/resolve-url-loader/index'),\n options: {\n postcss: lazyPostCSSInitializer,\n // Source maps are not required here, but we may as well emit\n // them.\n sourceMap: true,\n },\n },\n ]\n\n const fns: ConfigurationFn[] = []\n\n const googleLoader = require.resolve(\n 'next/dist/compiled/@next/font/google/loader'\n )\n const localLoader = require.resolve(\n 'next/dist/compiled/@next/font/local/loader'\n )\n const nextFontLoaders: Array<[string | RegExp, string, any?]> = [\n [require.resolve('next/font/google/target.css'), googleLoader],\n [require.resolve('next/font/local/target.css'), localLoader],\n ]\n\n nextFontLoaders.forEach(([fontLoaderTarget, fontLoaderPath]) => {\n // Matches the resolved font loaders noop files to run next-font-loader\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n sideEffects: false,\n test: fontLoaderTarget,\n use: getNextFontLoader(ctx, lazyPostCSSInitializer, fontLoaderPath),\n }),\n ],\n })\n )\n })\n\n // CSS cannot be imported in _document. This comes before everything because\n // global CSS nor CSS modules work in said file.\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: regexLikeCss,\n // Use a loose regex so we don't have to crawl the file system to\n // find the real file name (if present).\n issuer: /pages[\\\\/]_document\\./,\n use: {\n loader: 'error-loader',\n options: {\n reason: getCustomDocumentError(),\n },\n },\n }),\n ],\n })\n )\n\n const shouldIncludeExternalCSSImports =\n !!ctx.experimental.craCompat || !!ctx.transpilePackages\n\n // CSS modules & SASS modules support. They are allowed to be imported in anywhere.\n fns.push(\n // CSS Modules should never have side effects. This setting will\n // allow unused CSS to be removed from the production build.\n // We ensure this by disallowing `:global()` CSS at the top-level\n // via the `pure` mode in `css-loader`.\n loader({\n oneOf: [\n // For app dir, we need to match the specific app layer.\n ctx.hasAppDir\n ? markRemovable({\n sideEffects: true,\n test: regexCssModules,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: true,\n },\n },\n ...getCssModuleLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer\n ),\n ],\n })\n : null,\n markRemovable({\n sideEffects: true,\n test: regexCssModules,\n issuerLayer: PAGES_LAYER_RULE,\n use: getCssModuleLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n ].filter(nonNullable),\n }),\n // Opt-in support for Sass (using .scss or .sass extensions).\n // Sass Modules should never have side effects. This setting will\n // allow unused Sass to be removed from the production build.\n // We ensure this by disallowing `:global()` Sass at the top-level\n // via the `pure` mode in `css-loader`.\n loader({\n oneOf: [\n // For app dir, we need to match the specific app layer.\n ctx.hasAppDir\n ? markRemovable({\n sideEffects: true,\n test: regexSassModules,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: true,\n },\n },\n ...getCssModuleLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n ],\n })\n : null,\n markRemovable({\n sideEffects: true,\n test: regexSassModules,\n issuerLayer: PAGES_LAYER_RULE,\n use: getCssModuleLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ].filter(nonNullable),\n }),\n // Throw an error for CSS Modules used outside their supported scope\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssModules, regexSassModules],\n use: {\n loader: 'error-loader',\n options: {\n reason: getLocalModuleImportError(),\n },\n },\n }),\n ],\n })\n )\n\n // Global CSS and SASS support.\n if (ctx.isServer) {\n fns.push(\n loader({\n oneOf: [\n ctx.hasAppDir && !ctx.isProduction\n ? markRemovable({\n sideEffects: true,\n test: [regexCssGlobal, regexSassGlobal],\n issuerLayer: APP_LAYER_RULE,\n use: {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n })\n : null,\n markRemovable({\n // CSS imports have side effects, even on the server side.\n sideEffects: true,\n test: [regexCssGlobal, regexSassGlobal],\n use: require.resolve('next/dist/compiled/ignore-loader'),\n }),\n ].filter(nonNullable),\n })\n )\n } else {\n // External CSS files are allowed to be loaded when any of the following is true:\n // - hasAppDir: all CSS files are allowed\n // - If the CSS file is located in `node_modules`\n // - If the CSS file is located in another package in a monorepo (outside of the current rootDir)\n // - If the issuer is pages/_app (matched later)\n const allowedPagesGlobalCSSPath = ctx.hasAppDir\n ? undefined\n : {\n and: [\n {\n or: [\n /node_modules/,\n {\n not: [ctx.rootDirectory],\n },\n ],\n },\n ],\n }\n const allowedPagesGlobalCSSIssuer = ctx.hasAppDir\n ? undefined\n : shouldIncludeExternalCSSImports\n ? undefined\n : {\n and: [ctx.rootDirectory],\n not: [/node_modules/],\n }\n\n fns.push(\n loader({\n oneOf: [\n ...(ctx.hasAppDir\n ? [\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n ...getGlobalCssLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer\n ),\n ],\n }),\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n ...getGlobalCssLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n ],\n }),\n ]\n : []),\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n include: allowedPagesGlobalCSSPath,\n issuer: allowedPagesGlobalCSSIssuer,\n issuerLayer: PAGES_LAYER_RULE,\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n include: allowedPagesGlobalCSSPath,\n issuer: allowedPagesGlobalCSSIssuer,\n issuerLayer: PAGES_LAYER_RULE,\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ].filter(nonNullable),\n })\n )\n\n if (ctx.customAppFile) {\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n issuer: { and: [ctx.customAppFile] },\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n ],\n }),\n loader({\n oneOf: [\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n issuer: { and: [ctx.customAppFile] },\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ],\n })\n )\n }\n }\n\n // Throw an error for Global CSS used inside of `node_modules`\n if (!shouldIncludeExternalCSSImports) {\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssGlobal, regexSassGlobal],\n issuer: { and: [/node_modules/] },\n use: {\n loader: 'error-loader',\n options: {\n reason: getGlobalModuleImportError(),\n },\n },\n }),\n ],\n })\n )\n }\n\n // Throw an error for Global CSS used outside of our custom <App> file\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssGlobal, regexSassGlobal],\n issuer: ctx.hasAppDir\n ? {\n // If it's inside the app dir, but not importing from a layout file,\n // throw an error.\n and: [ctx.rootDirectory],\n not: [/layout\\.(js|mjs|jsx|ts|tsx)$/],\n }\n : undefined,\n use: {\n loader: 'error-loader',\n options: {\n reason: getGlobalImportError(),\n },\n },\n }),\n ],\n })\n )\n\n if (ctx.isClient) {\n // Automatically transform references to files (i.e. url()) into URLs\n // e.g. url(./logo.svg)\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n // This should only be applied to CSS files\n issuer: regexLikeCss,\n // Exclude extensions that webpack handles by default\n exclude: [\n /\\.(js|mjs|jsx|ts|tsx)$/,\n /\\.html$/,\n /\\.json$/,\n /\\.webpack\\[[^\\]]+\\]$/,\n ],\n // `asset/resource` always emits a URL reference, where `asset`\n // might inline the asset as a data URI\n type: 'asset/resource',\n }),\n ],\n })\n )\n }\n\n // Enable full mini-css-extract-plugin hmr for prod mode pages or app dir\n if (ctx.isClient && (ctx.isProduction || ctx.hasAppDir)) {\n // Extract CSS as CSS file(s) in the client-side production bundle.\n const MiniCssExtractPlugin = isRspack\n ? getRspackCore().CssExtractRspackPlugin\n : require('../../../plugins/mini-css-extract-plugin').default\n\n fns.push(\n plugin(\n // @ts-ignore webpack 5 compat\n new MiniCssExtractPlugin({\n filename: ctx.isProduction\n ? 'static/css/[contenthash].css'\n : 'static/css/[name].css',\n chunkFilename: ctx.isProduction\n ? 'static/css/[contenthash].css'\n : 'static/css/[name].css',\n // Next.js guarantees that CSS order \"doesn't matter\", due to imposed\n // restrictions:\n // 1. Global CSS can only be defined in a single entrypoint (_app)\n // 2. CSS Modules generate scoped class names by default and cannot\n // include Global CSS (:global() selector).\n //\n // While not a perfect guarantee (e.g. liberal use of `:global()`\n // selector), this assumption is required to code-split CSS.\n //\n // If this warning were to trigger, it'd be unactionable by the user,\n // but likely not valid -- so we disable it.\n ignoreOrder: true,\n insert: function (linkTag: HTMLLinkElement) {\n if (typeof _N_E_STYLE_LOAD === 'function') {\n const { href, onload, onerror } = linkTag\n _N_E_STYLE_LOAD(\n href.indexOf(window.location.origin) === 0\n ? new URL(href).pathname\n : href\n ).then(\n () => onload?.call(linkTag, { type: 'load' } as Event),\n () => onerror?.call(linkTag, {} as Event)\n )\n } else {\n document.head.appendChild(linkTag)\n }\n },\n })\n )\n )\n }\n\n const fn = pipe(...fns)\n return fn(config)\n})\n"],"names":["curry","loader","plugin","pipe","getCssModuleLoader","getGlobalCssLoader","getNextFontLoader","getCustomDocumentError","getGlobalImportError","getGlobalModuleImportError","getLocalModuleImportError","getPostCssPlugins","nonNullable","WEBPACK_LAYERS","getRspackCore","regexLikeCss","regexCssGlobal","regexCssModules","regexSassGlobal","regexSassModules","APP_LAYER_RULE","or","reactServerComponents","serverSideRendering","appPagesBrowser","PAGES_LAYER_RULE","not","markRemovable","r","Object","defineProperty","Symbol","for","enumerable","value","postcssInstancePromise","lazyPostCSS","rootDirectory","supportedBrowsers","disablePostcssPresetEnv","useLightningcss","postcss","require","postcssPlugin","name","initializer","creator","args","transformer","cache","get","process","css","processOpts","pluginOpts","vendor","prefix","prop","match","unprefixed","replace","postCssPlugins","postcssWithPlugins","ctx","config","isRspack","Boolean","env","NEXT_RSPACK","prependData","sassPrependData","additionalData","sassAdditionalData","implementation","sassImplementation","sassOptions","lazyPostCSSInitializer","experimental","sassPreprocessors","resolve","options","sourceMap","fibers","silenceDeprecations","fns","googleLoader","localLoader","nextFontLoaders","forEach","fontLoaderTarget","fontLoaderPath","push","oneOf","sideEffects","test","use","issuer","reason","shouldIncludeExternalCSSImports","craCompat","transpilePackages","hasAppDir","issuerLayer","cssModules","isAppDir","filter","isServer","isProduction","allowedPagesGlobalCSSPath","undefined","and","allowedPagesGlobalCSSIssuer","include","customAppFile","isClient","exclude","type","MiniCssExtractPlugin","CssExtractRspackPlugin","default","filename","chunkFilename","ignoreOrder","insert","linkTag","_N_E_STYLE_LOAD","href","onload","onerror","indexOf","window","location","origin","URL","pathname","then","call","document","head","appendChild","fn"],"mappings":"AAAA,OAAOA,WAAW,kCAAiC;AAEnD,SAASC,MAAM,EAAEC,MAAM,QAAQ,gBAAe;AAC9C,SAASC,IAAI,QAAQ,cAAa;AAElC,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,YAAW;AAClE,SAASC,iBAAiB,QAAQ,sBAAqB;AACvD,SACEC,sBAAsB,EACtBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,yBAAyB,QACpB,aAAY;AACnB,SAASC,iBAAiB,QAAQ,YAAW;AAC7C,SAASC,WAAW,QAAQ,kCAAiC;AAC7D,SAASC,cAAc,QAAQ,+BAA8B;AAC7D,SAASC,aA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ACrE,gBAAgB;YAChB,kEAAkE;YAClE,mEAAmE;YACnE,8CAA8C;YAC9C,EAAE;YACF,iEAAiE;YACjE,4DAA4D;YAC5D,EAAE;YACF,qEAAqE;YACrE,4CAA4C;YAC5Ce,aAAa;YACbC,QAAQ,SAAUC,OAAwB;gBACxC,IAAI,OAAOC,oBAAoB,YAAY;oBACzC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGJ;oBAClCC,gBACEC,KAAKG,OAAO,CAACC,OAAOC,QAAQ,CAACC,MAAM,MAAM,IACrC,IAAIC,IAAIP,MAAMQ,QAAQ,GACtBR,MACJS,IAAI,CACJ,IAAMR,0BAAAA,OAAQS,IAAI,CAACZ,SAAS;4BAAER,MAAM;wBAAO,IAC3C,IAAMY,2BAAAA,QAASQ,IAAI,CAACZ,SAAS,CAAC;gBAElC,OAAO;oBACLa,SAASC,IAAI,CAACC,WAAW,CAACf;gBAC5B;YACF;QACF;IAGN;IAEA,MAAMgB,KAAKzI,QAAQiF;IACnB,OAAOwD,GAAG5E;AACZ,GAAE"}
|
@@ -1,4 +1,6 @@
|
|
1
|
+
import { getRspackCore } from '../../../../../../shared/lib/get-rspack';
|
1
2
|
export function getClientStyleLoader({ hasAppDir, isAppDir, isDevelopment, assetPrefix }) {
|
3
|
+
const isRspack = Boolean(process.env.NEXT_RSPACK);
|
2
4
|
const shouldEnableApp = typeof isAppDir === 'boolean' ? isAppDir : hasAppDir;
|
3
5
|
// Keep next-style-loader for development mode in `pages/`
|
4
6
|
if (isDevelopment && !shouldEnableApp) {
|
@@ -24,7 +26,7 @@ export function getClientStyleLoader({ hasAppDir, isAppDir, isDevelopment, asset
|
|
24
26
|
}
|
25
27
|
};
|
26
28
|
}
|
27
|
-
const MiniCssExtractPlugin = require('../../../../plugins/mini-css-extract-plugin').default;
|
29
|
+
const MiniCssExtractPlugin = isRspack ? getRspackCore().rspack.CssExtractRspackPlugin : require('../../../../plugins/mini-css-extract-plugin').default;
|
28
30
|
return {
|
29
31
|
loader: MiniCssExtractPlugin.loader,
|
30
32
|
options: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/client.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\n\nexport function getClientStyleLoader({\n hasAppDir,\n isAppDir,\n isDevelopment,\n assetPrefix,\n}: {\n hasAppDir: boolean\n isAppDir?: boolean\n isDevelopment: boolean\n assetPrefix: string\n}): webpack.RuleSetUseItem {\n const shouldEnableApp = typeof isAppDir === 'boolean' ? isAppDir : hasAppDir\n\n // Keep next-style-loader for development mode in `pages/`\n if (isDevelopment && !shouldEnableApp) {\n return {\n loader: 'next-style-loader',\n options: {\n insert: function (element: Node) {\n // By default, style-loader injects CSS into the bottom\n // of <head>. This causes ordering problems between dev\n // and prod. To fix this, we render a <noscript> tag as\n // an anchor for the styles to be placed before. These\n // styles will be applied _before_ <style jsx global>.\n\n // These elements should always exist. If they do not,\n // this code should fail.\n var anchorElement = document.querySelector(\n '#__next_css__DO_NOT_USE__'\n )!\n var parentNode = anchorElement.parentNode! // Normally <head>\n\n // Each style tag should be placed right before our\n // anchor. By inserting before and not after, we do not\n // need to track the last inserted element.\n parentNode.insertBefore(element, anchorElement)\n },\n },\n }\n }\n\n const MiniCssExtractPlugin
|
1
|
+
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/client.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { getRspackCore } from '../../../../../../shared/lib/get-rspack'\n\nexport function getClientStyleLoader({\n hasAppDir,\n isAppDir,\n isDevelopment,\n assetPrefix,\n}: {\n hasAppDir: boolean\n isAppDir?: boolean\n isDevelopment: boolean\n assetPrefix: string\n}): webpack.RuleSetUseItem {\n const isRspack = Boolean(process.env.NEXT_RSPACK)\n const shouldEnableApp = typeof isAppDir === 'boolean' ? isAppDir : hasAppDir\n\n // Keep next-style-loader for development mode in `pages/`\n if (isDevelopment && !shouldEnableApp) {\n return {\n loader: 'next-style-loader',\n options: {\n insert: function (element: Node) {\n // By default, style-loader injects CSS into the bottom\n // of <head>. This causes ordering problems between dev\n // and prod. To fix this, we render a <noscript> tag as\n // an anchor for the styles to be placed before. These\n // styles will be applied _before_ <style jsx global>.\n\n // These elements should always exist. If they do not,\n // this code should fail.\n var anchorElement = document.querySelector(\n '#__next_css__DO_NOT_USE__'\n )!\n var parentNode = anchorElement.parentNode! // Normally <head>\n\n // Each style tag should be placed right before our\n // anchor. By inserting before and not after, we do not\n // need to track the last inserted element.\n parentNode.insertBefore(element, anchorElement)\n },\n },\n }\n }\n\n const MiniCssExtractPlugin = isRspack\n ? getRspackCore().rspack.CssExtractRspackPlugin\n : require('../../../../plugins/mini-css-extract-plugin').default\n\n return {\n loader: MiniCssExtractPlugin.loader,\n options: {\n publicPath: `${assetPrefix}/_next/`,\n esModule: false,\n },\n }\n}\n"],"names":["getRspackCore","getClientStyleLoader","hasAppDir","isAppDir","isDevelopment","assetPrefix","isRspack","Boolean","process","env","NEXT_RSPACK","shouldEnableApp","loader","options","insert","element","anchorElement","document","querySelector","parentNode","insertBefore","MiniCssExtractPlugin","rspack","CssExtractRspackPlugin","require","default","publicPath","esModule"],"mappings":"AACA,SAASA,aAAa,QAAQ,0CAAyC;AAEvE,OAAO,SAASC,qBAAqB,EACnCC,SAAS,EACTC,QAAQ,EACRC,aAAa,EACbC,WAAW,EAMZ;IACC,MAAMC,WAAWC,QAAQC,QAAQC,GAAG,CAACC,WAAW;IAChD,MAAMC,kBAAkB,OAAOR,aAAa,YAAYA,WAAWD;IAEnE,0DAA0D;IAC1D,IAAIE,iBAAiB,CAACO,iBAAiB;QACrC,OAAO;YACLC,QAAQ;YACRC,SAAS;gBACPC,QAAQ,SAAUC,OAAa;oBAC7B,uDAAuD;oBACvD,uDAAuD;oBACvD,uDAAuD;oBACvD,sDAAsD;oBACtD,sDAAsD;oBAEtD,sDAAsD;oBACtD,yBAAyB;oBACzB,IAAIC,gBAAgBC,SAASC,aAAa,CACxC;oBAEF,IAAIC,aAAaH,cAAcG,UAAU,AAAE,kBAAkB;;oBAE7D,mDAAmD;oBACnD,uDAAuD;oBACvD,2CAA2C;oBAC3CA,WAAWC,YAAY,CAACL,SAASC;gBACnC;YACF;QACF;IACF;IAEA,MAAMK,uBAAuBf,WACzBN,gBAAgBsB,MAAM,CAACC,sBAAsB,GAC7CC,QAAQ,+CAA+CC,OAAO;IAElE,OAAO;QACLb,QAAQS,qBAAqBT,MAAM;QACnCC,SAAS;YACPa,YAAY,GAAGrB,YAAY,OAAO,CAAC;YACnCsB,UAAU;QACZ;IACF;AACF"}
|
@@ -25,6 +25,10 @@ export default function transformSource() {
|
|
25
25
|
buildInfo.rsc = {
|
26
26
|
type: RSC_MODULE_TYPES.client
|
27
27
|
};
|
28
|
+
if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {
|
29
|
+
const rscModuleInformationJson = JSON.stringify(buildInfo.rsc);
|
30
|
+
return `/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */\n` + code;
|
31
|
+
}
|
28
32
|
return code;
|
29
33
|
}
|
30
34
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-client-entry-loader.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport {\n BARREL_OPTIMIZATION_PREFIX,\n RSC_MODULE_TYPES,\n} from '../../../shared/lib/constants'\nimport { getModuleBuildInfo } from './get-module-build-info'\nimport { regexCSS } from './utils'\n\n/**\n * { [client import path]: [exported names] }\n */\nexport type ClientComponentImports = Record<string, Set<string>>\nexport type CssImports = Record<string, string[]>\n\nexport type NextFlightClientEntryLoaderOptions = {\n modules: string[] | string\n /** This is transmitted as a string to `getOptions` */\n server: boolean | 'true' | 'false'\n}\n\nexport type FlightClientEntryModuleItem = {\n // module path\n request: string\n // imported identifiers\n ids: string[]\n}\n\nexport default function transformSource(\n this: webpack.LoaderContext<NextFlightClientEntryLoaderOptions>\n) {\n let { modules, server } = this.getOptions()\n const isServer = server === 'true'\n\n if (!Array.isArray(modules)) {\n modules = modules ? [modules] : []\n }\n\n const code = modules\n .map((x) => JSON.parse(x) as FlightClientEntryModuleItem)\n // Filter out CSS files in the SSR compilation\n .filter(({ request }) => (isServer ? !regexCSS.test(request) : true))\n .map(({ request, ids }: FlightClientEntryModuleItem) => {\n const importPath = JSON.stringify(\n request.startsWith(BARREL_OPTIMIZATION_PREFIX)\n ? request.replace(':', '!=!')\n : request\n )\n\n // When we cannot determine the export names, we use eager mode to include the whole module.\n // Otherwise, we use eager mode with webpackExports to only include the necessary exports.\n // If we have '*' in the ids, we include all the imports\n if (ids.length === 0 || ids.includes('*')) {\n return `import(/* webpackMode: \"eager\" */ ${importPath});\\n`\n } else {\n return `import(/* webpackMode: \"eager\", webpackExports: ${JSON.stringify(\n ids\n )} */ ${importPath});\\n`\n }\n })\n .join(';\\n')\n\n const buildInfo = getModuleBuildInfo(this._module!)\n\n buildInfo.rsc = {\n type: RSC_MODULE_TYPES.client,\n }\n\n return code\n}\n"],"names":["BARREL_OPTIMIZATION_PREFIX","RSC_MODULE_TYPES","getModuleBuildInfo","regexCSS","transformSource","modules","server","getOptions","isServer","Array","isArray","code","map","x","JSON","parse","filter","request","test","ids","importPath","stringify","startsWith","replace","length","includes","join","buildInfo","_module","rsc","type","client"],"mappings":"AACA,SACEA,0BAA0B,EAC1BC,gBAAgB,QACX,gCAA+B;AACtC,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,QAAQ,QAAQ,UAAS;AAqBlC,eAAe,SAASC;IAGtB,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAG,IAAI,CAACC,UAAU;IACzC,MAAMC,WAAWF,WAAW;IAE5B,IAAI,CAACG,MAAMC,OAAO,CAACL,UAAU;QAC3BA,UAAUA,UAAU;YAACA;SAAQ,GAAG,EAAE;IACpC;IAEA,MAAMM,OAAON,QACVO,GAAG,CAAC,CAACC,IAAMC,KAAKC,KAAK,CAACF,GACvB,8CAA8C;KAC7CG,MAAM,CAAC,CAAC,EAAEC,OAAO,EAAE,GAAMT,WAAW,CAACL,SAASe,IAAI,CAACD,WAAW,MAC9DL,GAAG,CAAC,CAAC,EAAEK,OAAO,EAAEE,GAAG,EAA+B;QACjD,MAAMC,aAAaN,KAAKO,SAAS,CAC/BJ,QAAQK,UAAU,CAACtB,8BACfiB,QAAQM,OAAO,CAAC,KAAK,SACrBN;QAGN,4FAA4F;QAC5F,0FAA0F;QAC1F,wDAAwD;QACxD,IAAIE,IAAIK,MAAM,KAAK,KAAKL,IAAIM,QAAQ,CAAC,MAAM;YACzC,OAAO,CAAC,kCAAkC,EAAEL,WAAW,IAAI,CAAC;QAC9D,OAAO;YACL,OAAO,CAAC,gDAAgD,EAAEN,KAAKO,SAAS,CACtEF,KACA,IAAI,EAAEC,WAAW,IAAI,CAAC;QAC1B;IACF,GACCM,IAAI,CAAC;IAER,MAAMC,YAAYzB,mBAAmB,IAAI,CAAC0B,OAAO;IAEjDD,UAAUE,GAAG,GAAG;QACdC,MAAM7B,iBAAiB8B,MAAM;IAC/B;IAEA,
|
1
|
+
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-client-entry-loader.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport {\n BARREL_OPTIMIZATION_PREFIX,\n RSC_MODULE_TYPES,\n} from '../../../shared/lib/constants'\nimport { getModuleBuildInfo } from './get-module-build-info'\nimport { regexCSS } from './utils'\n\n/**\n * { [client import path]: [exported names] }\n */\nexport type ClientComponentImports = Record<string, Set<string>>\nexport type CssImports = Record<string, string[]>\n\nexport type NextFlightClientEntryLoaderOptions = {\n modules: string[] | string\n /** This is transmitted as a string to `getOptions` */\n server: boolean | 'true' | 'false'\n}\n\nexport type FlightClientEntryModuleItem = {\n // module path\n request: string\n // imported identifiers\n ids: string[]\n}\n\nexport default function transformSource(\n this: webpack.LoaderContext<NextFlightClientEntryLoaderOptions>\n) {\n let { modules, server } = this.getOptions()\n const isServer = server === 'true'\n\n if (!Array.isArray(modules)) {\n modules = modules ? [modules] : []\n }\n\n const code = modules\n .map((x) => JSON.parse(x) as FlightClientEntryModuleItem)\n // Filter out CSS files in the SSR compilation\n .filter(({ request }) => (isServer ? !regexCSS.test(request) : true))\n .map(({ request, ids }: FlightClientEntryModuleItem) => {\n const importPath = JSON.stringify(\n request.startsWith(BARREL_OPTIMIZATION_PREFIX)\n ? request.replace(':', '!=!')\n : request\n )\n\n // When we cannot determine the export names, we use eager mode to include the whole module.\n // Otherwise, we use eager mode with webpackExports to only include the necessary exports.\n // If we have '*' in the ids, we include all the imports\n if (ids.length === 0 || ids.includes('*')) {\n return `import(/* webpackMode: \"eager\" */ ${importPath});\\n`\n } else {\n return `import(/* webpackMode: \"eager\", webpackExports: ${JSON.stringify(\n ids\n )} */ ${importPath});\\n`\n }\n })\n .join(';\\n')\n\n const buildInfo = getModuleBuildInfo(this._module!)\n\n buildInfo.rsc = {\n type: RSC_MODULE_TYPES.client,\n }\n if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {\n const rscModuleInformationJson = JSON.stringify(buildInfo.rsc)\n return (\n `/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */\\n` +\n code\n )\n }\n\n return code\n}\n"],"names":["BARREL_OPTIMIZATION_PREFIX","RSC_MODULE_TYPES","getModuleBuildInfo","regexCSS","transformSource","modules","server","getOptions","isServer","Array","isArray","code","map","x","JSON","parse","filter","request","test","ids","importPath","stringify","startsWith","replace","length","includes","join","buildInfo","_module","rsc","type","client","process","env","BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN","rscModuleInformationJson"],"mappings":"AACA,SACEA,0BAA0B,EAC1BC,gBAAgB,QACX,gCAA+B;AACtC,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,QAAQ,QAAQ,UAAS;AAqBlC,eAAe,SAASC;IAGtB,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAG,IAAI,CAACC,UAAU;IACzC,MAAMC,WAAWF,WAAW;IAE5B,IAAI,CAACG,MAAMC,OAAO,CAACL,UAAU;QAC3BA,UAAUA,UAAU;YAACA;SAAQ,GAAG,EAAE;IACpC;IAEA,MAAMM,OAAON,QACVO,GAAG,CAAC,CAACC,IAAMC,KAAKC,KAAK,CAACF,GACvB,8CAA8C;KAC7CG,MAAM,CAAC,CAAC,EAAEC,OAAO,EAAE,GAAMT,WAAW,CAACL,SAASe,IAAI,CAACD,WAAW,MAC9DL,GAAG,CAAC,CAAC,EAAEK,OAAO,EAAEE,GAAG,EAA+B;QACjD,MAAMC,aAAaN,KAAKO,SAAS,CAC/BJ,QAAQK,UAAU,CAACtB,8BACfiB,QAAQM,OAAO,CAAC,KAAK,SACrBN;QAGN,4FAA4F;QAC5F,0FAA0F;QAC1F,wDAAwD;QACxD,IAAIE,IAAIK,MAAM,KAAK,KAAKL,IAAIM,QAAQ,CAAC,MAAM;YACzC,OAAO,CAAC,kCAAkC,EAAEL,WAAW,IAAI,CAAC;QAC9D,OAAO;YACL,OAAO,CAAC,gDAAgD,EAAEN,KAAKO,SAAS,CACtEF,KACA,IAAI,EAAEC,WAAW,IAAI,CAAC;QAC1B;IACF,GACCM,IAAI,CAAC;IAER,MAAMC,YAAYzB,mBAAmB,IAAI,CAAC0B,OAAO;IAEjDD,UAAUE,GAAG,GAAG;QACdC,MAAM7B,iBAAiB8B,MAAM;IAC/B;IACA,IAAIC,QAAQC,GAAG,CAACC,kCAAkC,EAAE;QAClD,MAAMC,2BAA2BrB,KAAKO,SAAS,CAACM,UAAUE,GAAG;QAC7D,OACE,CAAC,yDAAyD,EAAEM,yBAAyB,KAAK,CAAC,GAC3FxB;IAEJ;IAEA,OAAOA;AACT"}
|
@@ -15,6 +15,12 @@ const flightClientModuleLoader = function transformSource(source, sourceMap) {
|
|
15
15
|
// Assign the RSC meta information to buildInfo.
|
16
16
|
const buildInfo = getModuleBuildInfo(this._module);
|
17
17
|
buildInfo.rsc = getRSCModuleInformation(source, false);
|
18
|
+
let prefix = '';
|
19
|
+
if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {
|
20
|
+
const rscModuleInformationJson = JSON.stringify(buildInfo.rsc);
|
21
|
+
prefix = `/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */\n`;
|
22
|
+
source = prefix + source;
|
23
|
+
}
|
18
24
|
// This is a server action entry module in the client layer. We need to
|
19
25
|
// create re-exports of "virtual modules" to expose the reference IDs to the
|
20
26
|
// client separately so they won't be always in the same one module which is
|
@@ -22,7 +28,7 @@ const flightClientModuleLoader = function transformSource(source, sourceMap) {
|
|
22
28
|
// production mode. In development mode, we want to preserve the original
|
23
29
|
// modules (as transformed by SWC) to ensure that source mapping works.
|
24
30
|
if (buildInfo.rsc.actionIds && process.env.NODE_ENV === 'production') {
|
25
|
-
return Object.entries(buildInfo.rsc.actionIds).map(([id, name])=>{
|
31
|
+
return prefix + Object.entries(buildInfo.rsc.actionIds).map(([id, name])=>{
|
26
32
|
return `export { ${name} } from 'next-flight-server-reference-proxy-loader?id=${id}&name=${name}!'`;
|
27
33
|
}).join('\n');
|
28
34
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-client-module-loader.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { getRSCModuleInformation } from '../../analysis/get-page-static-info'\nimport { getModuleBuildInfo } from './get-module-build-info'\n\nconst flightClientModuleLoader: webpack.LoaderDefinitionFunction =\n function transformSource(this, source: string, sourceMap: any) {\n // Avoid buffer to be consumed\n if (typeof source !== 'string') {\n throw new Error('Expected source to have been transformed to a string.')\n }\n\n if (!this._module) {\n return source\n }\n // Assign the RSC meta information to buildInfo.\n const buildInfo = getModuleBuildInfo(this._module)\n buildInfo.rsc = getRSCModuleInformation(source, false)\n\n // This is a server action entry module in the client layer. We need to\n // create re-exports of \"virtual modules\" to expose the reference IDs to the\n // client separately so they won't be always in the same one module which is\n // not splittable. This server action module tree shaking is only applied in\n // production mode. In development mode, we want to preserve the original\n // modules (as transformed by SWC) to ensure that source mapping works.\n if (buildInfo.rsc.actionIds && process.env.NODE_ENV === 'production') {\n return Object.entries(buildInfo.rsc.actionIds)\n
|
1
|
+
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-client-module-loader.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { getRSCModuleInformation } from '../../analysis/get-page-static-info'\nimport { getModuleBuildInfo } from './get-module-build-info'\n\nconst flightClientModuleLoader: webpack.LoaderDefinitionFunction =\n function transformSource(this, source: string, sourceMap: any) {\n // Avoid buffer to be consumed\n if (typeof source !== 'string') {\n throw new Error('Expected source to have been transformed to a string.')\n }\n\n if (!this._module) {\n return source\n }\n // Assign the RSC meta information to buildInfo.\n const buildInfo = getModuleBuildInfo(this._module)\n buildInfo.rsc = getRSCModuleInformation(source, false)\n let prefix = ''\n if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {\n const rscModuleInformationJson = JSON.stringify(buildInfo.rsc)\n prefix = `/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */\\n`\n source = prefix + source\n }\n\n // This is a server action entry module in the client layer. We need to\n // create re-exports of \"virtual modules\" to expose the reference IDs to the\n // client separately so they won't be always in the same one module which is\n // not splittable. This server action module tree shaking is only applied in\n // production mode. In development mode, we want to preserve the original\n // modules (as transformed by SWC) to ensure that source mapping works.\n if (buildInfo.rsc.actionIds && process.env.NODE_ENV === 'production') {\n return (\n prefix +\n Object.entries(buildInfo.rsc.actionIds)\n .map(([id, name]) => {\n return `export { ${name} } from 'next-flight-server-reference-proxy-loader?id=${id}&name=${name}!'`\n })\n .join('\\n')\n )\n }\n\n return this.callback(null, source, sourceMap)\n }\n\nexport default flightClientModuleLoader\n"],"names":["getRSCModuleInformation","getModuleBuildInfo","flightClientModuleLoader","transformSource","source","sourceMap","Error","_module","buildInfo","rsc","prefix","process","env","BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN","rscModuleInformationJson","JSON","stringify","actionIds","NODE_ENV","Object","entries","map","id","name","join","callback"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,sCAAqC;AAC7E,SAASC,kBAAkB,QAAQ,0BAAyB;AAE5D,MAAMC,2BACJ,SAASC,gBAAsBC,MAAc,EAAEC,SAAc;IAC3D,8BAA8B;IAC9B,IAAI,OAAOD,WAAW,UAAU;QAC9B,MAAM,qBAAkE,CAAlE,IAAIE,MAAM,0DAAV,qBAAA;mBAAA;wBAAA;0BAAA;QAAiE;IACzE;IAEA,IAAI,CAAC,IAAI,CAACC,OAAO,EAAE;QACjB,OAAOH;IACT;IACA,gDAAgD;IAChD,MAAMI,YAAYP,mBAAmB,IAAI,CAACM,OAAO;IACjDC,UAAUC,GAAG,GAAGT,wBAAwBI,QAAQ;IAChD,IAAIM,SAAS;IACb,IAAIC,QAAQC,GAAG,CAACC,kCAAkC,EAAE;QAClD,MAAMC,2BAA2BC,KAAKC,SAAS,CAACR,UAAUC,GAAG;QAC7DC,SAAS,CAAC,yDAAyD,EAAEI,yBAAyB,KAAK,CAAC;QACpGV,SAASM,SAASN;IACpB;IAEA,uEAAuE;IACvE,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAC5E,yEAAyE;IACzE,uEAAuE;IACvE,IAAII,UAAUC,GAAG,CAACQ,SAAS,IAAIN,QAAQC,GAAG,CAACM,QAAQ,KAAK,cAAc;QACpE,OACER,SACAS,OAAOC,OAAO,CAACZ,UAAUC,GAAG,CAACQ,SAAS,EACnCI,GAAG,CAAC,CAAC,CAACC,IAAIC,KAAK;YACd,OAAO,CAAC,SAAS,EAAEA,KAAK,sDAAsD,EAAED,GAAG,MAAM,EAAEC,KAAK,EAAE,CAAC;QACrG,GACCC,IAAI,CAAC;IAEZ;IAEA,OAAO,IAAI,CAACC,QAAQ,CAAC,MAAMrB,QAAQC;AACrC;AAEF,eAAeH,yBAAwB"}
|
@@ -47,6 +47,12 @@ export default function transformSource(source, sourceMap) {
|
|
47
47
|
// Exclude next internal files which are not marked as client files
|
48
48
|
const buildInfo = getModuleBuildInfo(module);
|
49
49
|
buildInfo.rsc = getRSCModuleInformation(source, true);
|
50
|
+
let prefix = '';
|
51
|
+
if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {
|
52
|
+
const rscModuleInformationJson = JSON.stringify(buildInfo.rsc);
|
53
|
+
prefix = `/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */\n`;
|
54
|
+
source = prefix + source;
|
55
|
+
}
|
50
56
|
// Resource key is the unique identifier for the resource. When RSC renders
|
51
57
|
// a client module, that key is used to identify that module across all compiler
|
52
58
|
// layers.
|
@@ -80,7 +86,7 @@ export default function transformSource(source, sourceMap) {
|
|
80
86
|
}));
|
81
87
|
return;
|
82
88
|
}
|
83
|
-
let esmSource = `\
|
89
|
+
let esmSource = prefix + `\
|
84
90
|
import { registerClientReference } from "react-server-dom-webpack/server.edge";
|
85
91
|
`;
|
86
92
|
for (const ref of clientRefs){
|
@@ -106,7 +112,7 @@ ${JSON.stringify(ref)},
|
|
106
112
|
}
|
107
113
|
return this.callback(null, esmSource, sourceMap);
|
108
114
|
} else if (assumedSourceType === 'commonjs') {
|
109
|
-
let cjsSource = `\
|
115
|
+
let cjsSource = prefix + `\
|
110
116
|
const { createProxy } = require("${MODULE_PROXY_PATH}")
|
111
117
|
|
112
118
|
module.exports = createProxy(${stringifiedResourceKey})
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/index.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { RSC_MOD_REF_PROXY_ALIAS } from '../../../../lib/constants'\nimport {\n BARREL_OPTIMIZATION_PREFIX,\n RSC_MODULE_TYPES,\n} from '../../../../shared/lib/constants'\nimport { warnOnce } from '../../../../shared/lib/utils/warn-once'\nimport { getRSCModuleInformation } from '../../../analysis/get-page-static-info'\nimport { formatBarrelOptimizedResource } from '../../utils'\nimport { getModuleBuildInfo } from '../get-module-build-info'\nimport type {\n javascript,\n LoaderContext,\n} from 'next/dist/compiled/webpack/webpack'\n\ntype SourceType = javascript.JavascriptParser['sourceType'] | 'commonjs'\n\nconst noopHeadPath = require.resolve('next/dist/client/components/noop-head')\n// For edge runtime it will be aliased to esm version by webpack\nconst MODULE_PROXY_PATH =\n 'next/dist/build/webpack/loaders/next-flight-loader/module-proxy'\n\nexport function getAssumedSourceType(\n mod: webpack.Module,\n sourceType: SourceType\n): SourceType {\n const buildInfo = getModuleBuildInfo(mod)\n const detectedClientEntryType = buildInfo?.rsc?.clientEntryType\n const clientRefs = buildInfo?.rsc?.clientRefs || []\n\n // It's tricky to detect the type of a client boundary, but we should always\n // use the `module` type when we can, to support `export *` and `export from`\n // syntax in other modules that import this client boundary.\n\n if (sourceType === 'auto') {\n if (detectedClientEntryType === 'auto') {\n if (clientRefs.length === 0) {\n // If there's zero export detected in the client boundary, and it's the\n // `auto` type, we can safely assume it's a CJS module because it doesn't\n // have ESM exports.\n return 'commonjs'\n } else if (!clientRefs.includes('*')) {\n // Otherwise, we assume it's an ESM module.\n return 'module'\n }\n } else if (detectedClientEntryType === 'cjs') {\n return 'commonjs'\n }\n }\n\n return sourceType\n}\n\nexport default function transformSource(\n this: LoaderContext<undefined>,\n source: string,\n sourceMap: any\n) {\n // Avoid buffer to be consumed\n if (typeof source !== 'string') {\n throw new Error('Expected source to have been transformed to a string.')\n }\n\n const module = this._module!\n\n // Assign the RSC meta information to buildInfo.\n // Exclude next internal files which are not marked as client files\n const buildInfo = getModuleBuildInfo(module)\n buildInfo.rsc = getRSCModuleInformation(source, true)\n\n // Resource key is the unique identifier for the resource. When RSC renders\n // a client module, that key is used to identify that module across all compiler\n // layers.\n //\n // Usually it's the module's file path + the export name (e.g. `foo.js#bar`).\n // But with Barrel Optimizations, one file can be splitted into multiple modules,\n // so when you import `foo.js#bar` and `foo.js#baz`, they are actually different\n // \"foo.js\" being created by the Barrel Loader (one only exports `bar`, the other\n // only exports `baz`).\n //\n // Because of that, we must add another query param to the resource key to\n // differentiate them.\n let resourceKey: string = this.resourcePath\n if (module.matchResource?.startsWith(BARREL_OPTIMIZATION_PREFIX)) {\n resourceKey = formatBarrelOptimizedResource(\n resourceKey,\n module.matchResource\n )\n }\n\n // A client boundary.\n if (buildInfo.rsc?.type === RSC_MODULE_TYPES.client) {\n const assumedSourceType = getAssumedSourceType(\n module,\n (module.parser as javascript.JavascriptParser).sourceType\n )\n\n const clientRefs = buildInfo.rsc.clientRefs!\n const stringifiedResourceKey = JSON.stringify(resourceKey)\n\n if (assumedSourceType === 'module') {\n if (clientRefs.length === 0) {\n return this.callback(null, 'export {}')\n }\n\n if (clientRefs.includes('*')) {\n this.callback(\n new Error(\n `It's currently unsupported to use \"export *\" in a client boundary. Please use named exports instead.`\n )\n )\n return\n }\n\n let esmSource = `\\\nimport { registerClientReference } from \"react-server-dom-webpack/server.edge\";\n`\n for (const ref of clientRefs) {\n if (ref === 'default') {\n esmSource += `export default registerClientReference(\nfunction() { throw new Error(${JSON.stringify(`Attempted to call the default \\\nexport of ${stringifiedResourceKey} from the server, but it's on the client. \\\nIt's not possible to invoke a client function from the server, it can only be \\\nrendered as a Component or passed to props of a Client Component.`)}); },\n${stringifiedResourceKey},\n\"default\",\n);\\n`\n } else {\n esmSource += `export const ${ref} = registerClientReference(\nfunction() { throw new Error(${JSON.stringify(`Attempted to call ${ref}() from \\\nthe server but ${ref} is on the client. It's not possible to invoke a client \\\nfunction from the server, it can only be rendered as a Component or passed to \\\nprops of a Client Component.`)}); },\n${stringifiedResourceKey},\n${JSON.stringify(ref)},\n);`\n }\n }\n\n return this.callback(null, esmSource, sourceMap)\n } else if (assumedSourceType === 'commonjs') {\n let cjsSource = `\\\nconst { createProxy } = require(\"${MODULE_PROXY_PATH}\")\n\nmodule.exports = createProxy(${stringifiedResourceKey})\n`\n\n return this.callback(null, cjsSource, sourceMap)\n }\n }\n\n if (buildInfo.rsc?.type !== RSC_MODULE_TYPES.client) {\n if (noopHeadPath === this.resourcePath) {\n warnOnce(\n `Warning: You're using \\`next/head\\` inside the \\`app\\` directory, please migrate to the Metadata API. See https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#step-3-migrating-nexthead for more details.`\n )\n }\n }\n\n const replacedSource = source.replace(\n RSC_MOD_REF_PROXY_ALIAS,\n MODULE_PROXY_PATH\n )\n this.callback(null, replacedSource, sourceMap)\n}\n"],"names":["RSC_MOD_REF_PROXY_ALIAS","BARREL_OPTIMIZATION_PREFIX","RSC_MODULE_TYPES","warnOnce","getRSCModuleInformation","formatBarrelOptimizedResource","getModuleBuildInfo","noopHeadPath","require","resolve","MODULE_PROXY_PATH","getAssumedSourceType","mod","sourceType","buildInfo","detectedClientEntryType","rsc","clientEntryType","clientRefs","length","includes","transformSource","source","sourceMap","module","Error","_module","resourceKey","resourcePath","matchResource","startsWith","type","client","assumedSourceType","parser","stringifiedResourceKey","JSON","stringify","callback","esmSource","ref","cjsSource","replacedSource","replace"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,4BAA2B;AACnE,SACEC,0BAA0B,EAC1BC,gBAAgB,QACX,mCAAkC;AACzC,SAASC,QAAQ,QAAQ,yCAAwC;AACjE,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,6BAA6B,QAAQ,cAAa;AAC3D,SAASC,kBAAkB,QAAQ,2BAA0B;AAQ7D,MAAMC,eAAeC,QAAQC,OAAO,CAAC;AACrC,gEAAgE;AAChE,MAAMC,oBACJ;AAEF,OAAO,SAASC,qBACdC,GAAmB,EACnBC,UAAsB;QAGUC,gBACbA;IAFnB,MAAMA,YAAYR,mBAAmBM;IACrC,MAAMG,0BAA0BD,8BAAAA,iBAAAA,UAAWE,GAAG,qBAAdF,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EAAAA,kBAAAA,UAAUE,GAAG,qBAAbF,gBAAeiB,IAAI,MAAK7B,iBAAiB8B,MAAM,EAAE;QACnD,IAAIzB,iBAAiB,IAAI,CAACqB,YAAY,EAAE;YACtCzB,SACE,CAAC,0OAA0O,CAAC;QAEhP;IACF;IAEA,MAAMuC,iBAAiBpB,OAAOqB,OAAO,CACnC3C,yBACAU;IAEF,IAAI,CAAC4B,QAAQ,CAAC,MAAMI,gBAAgBnB;AACtC"}
|
1
|
+
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/index.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { RSC_MOD_REF_PROXY_ALIAS } from '../../../../lib/constants'\nimport {\n BARREL_OPTIMIZATION_PREFIX,\n RSC_MODULE_TYPES,\n} from '../../../../shared/lib/constants'\nimport { warnOnce } from '../../../../shared/lib/utils/warn-once'\nimport { getRSCModuleInformation } from '../../../analysis/get-page-static-info'\nimport { formatBarrelOptimizedResource } from '../../utils'\nimport { getModuleBuildInfo } from '../get-module-build-info'\nimport type {\n javascript,\n LoaderContext,\n} from 'next/dist/compiled/webpack/webpack'\n\ntype SourceType = javascript.JavascriptParser['sourceType'] | 'commonjs'\n\nconst noopHeadPath = require.resolve('next/dist/client/components/noop-head')\n// For edge runtime it will be aliased to esm version by webpack\nconst MODULE_PROXY_PATH =\n 'next/dist/build/webpack/loaders/next-flight-loader/module-proxy'\n\nexport function getAssumedSourceType(\n mod: webpack.Module,\n sourceType: SourceType\n): SourceType {\n const buildInfo = getModuleBuildInfo(mod)\n const detectedClientEntryType = buildInfo?.rsc?.clientEntryType\n const clientRefs = buildInfo?.rsc?.clientRefs || []\n\n // It's tricky to detect the type of a client boundary, but we should always\n // use the `module` type when we can, to support `export *` and `export from`\n // syntax in other modules that import this client boundary.\n\n if (sourceType === 'auto') {\n if (detectedClientEntryType === 'auto') {\n if (clientRefs.length === 0) {\n // If there's zero export detected in the client boundary, and it's the\n // `auto` type, we can safely assume it's a CJS module because it doesn't\n // have ESM exports.\n return 'commonjs'\n } else if (!clientRefs.includes('*')) {\n // Otherwise, we assume it's an ESM module.\n return 'module'\n }\n } else if (detectedClientEntryType === 'cjs') {\n return 'commonjs'\n }\n }\n\n return sourceType\n}\n\nexport default function transformSource(\n this: LoaderContext<undefined>,\n source: string,\n sourceMap: any\n) {\n // Avoid buffer to be consumed\n if (typeof source !== 'string') {\n throw new Error('Expected source to have been transformed to a string.')\n }\n const module = this._module!\n\n // Assign the RSC meta information to buildInfo.\n // Exclude next internal files which are not marked as client files\n const buildInfo = getModuleBuildInfo(module)\n buildInfo.rsc = getRSCModuleInformation(source, true)\n let prefix = ''\n if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {\n const rscModuleInformationJson = JSON.stringify(buildInfo.rsc)\n prefix = `/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */\\n`\n source = prefix + source\n }\n\n // Resource key is the unique identifier for the resource. When RSC renders\n // a client module, that key is used to identify that module across all compiler\n // layers.\n //\n // Usually it's the module's file path + the export name (e.g. `foo.js#bar`).\n // But with Barrel Optimizations, one file can be splitted into multiple modules,\n // so when you import `foo.js#bar` and `foo.js#baz`, they are actually different\n // \"foo.js\" being created by the Barrel Loader (one only exports `bar`, the other\n // only exports `baz`).\n //\n // Because of that, we must add another query param to the resource key to\n // differentiate them.\n let resourceKey: string = this.resourcePath\n if (module.matchResource?.startsWith(BARREL_OPTIMIZATION_PREFIX)) {\n resourceKey = formatBarrelOptimizedResource(\n resourceKey,\n module.matchResource\n )\n }\n\n // A client boundary.\n if (buildInfo.rsc?.type === RSC_MODULE_TYPES.client) {\n const assumedSourceType = getAssumedSourceType(\n module,\n (module.parser as javascript.JavascriptParser).sourceType\n )\n\n const clientRefs = buildInfo.rsc.clientRefs!\n const stringifiedResourceKey = JSON.stringify(resourceKey)\n\n if (assumedSourceType === 'module') {\n if (clientRefs.length === 0) {\n return this.callback(null, 'export {}')\n }\n\n if (clientRefs.includes('*')) {\n this.callback(\n new Error(\n `It's currently unsupported to use \"export *\" in a client boundary. Please use named exports instead.`\n )\n )\n return\n }\n\n let esmSource =\n prefix +\n `\\\nimport { registerClientReference } from \"react-server-dom-webpack/server.edge\";\n`\n for (const ref of clientRefs) {\n if (ref === 'default') {\n esmSource += `export default registerClientReference(\nfunction() { throw new Error(${JSON.stringify(`Attempted to call the default \\\nexport of ${stringifiedResourceKey} from the server, but it's on the client. \\\nIt's not possible to invoke a client function from the server, it can only be \\\nrendered as a Component or passed to props of a Client Component.`)}); },\n${stringifiedResourceKey},\n\"default\",\n);\\n`\n } else {\n esmSource += `export const ${ref} = registerClientReference(\nfunction() { throw new Error(${JSON.stringify(`Attempted to call ${ref}() from \\\nthe server but ${ref} is on the client. It's not possible to invoke a client \\\nfunction from the server, it can only be rendered as a Component or passed to \\\nprops of a Client Component.`)}); },\n${stringifiedResourceKey},\n${JSON.stringify(ref)},\n);`\n }\n }\n\n return this.callback(null, esmSource, sourceMap)\n } else if (assumedSourceType === 'commonjs') {\n let cjsSource =\n prefix +\n `\\\nconst { createProxy } = require(\"${MODULE_PROXY_PATH}\")\n\nmodule.exports = createProxy(${stringifiedResourceKey})\n`\n return this.callback(null, cjsSource, sourceMap)\n }\n }\n\n if (buildInfo.rsc?.type !== RSC_MODULE_TYPES.client) {\n if (noopHeadPath === this.resourcePath) {\n warnOnce(\n `Warning: You're using \\`next/head\\` inside the \\`app\\` directory, please migrate to the Metadata API. See https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#step-3-migrating-nexthead for more details.`\n )\n }\n }\n\n const replacedSource = source.replace(\n RSC_MOD_REF_PROXY_ALIAS,\n MODULE_PROXY_PATH\n )\n this.callback(null, replacedSource, sourceMap)\n}\n"],"names":["RSC_MOD_REF_PROXY_ALIAS","BARREL_OPTIMIZATION_PREFIX","RSC_MODULE_TYPES","warnOnce","getRSCModuleInformation","formatBarrelOptimizedResource","getModuleBuildInfo","noopHeadPath","require","resolve","MODULE_PROXY_PATH","getAssumedSourceType","mod","sourceType","buildInfo","detectedClientEntryType","rsc","clientEntryType","clientRefs","length","includes","transformSource","source","sourceMap","module","Error","_module","prefix","process","env","BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN","rscModuleInformationJson","JSON","stringify","resourceKey","resourcePath","matchResource","startsWith","type","client","assumedSourceType","parser","stringifiedResourceKey","callback","esmSource","ref","cjsSource","replacedSource","replace"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,4BAA2B;AACnE,SACEC,0BAA0B,EAC1BC,gBAAgB,QACX,mCAAkC;AACzC,SAASC,QAAQ,QAAQ,yCAAwC;AACjE,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,6BAA6B,QAAQ,cAAa;AAC3D,SAASC,kBAAkB,QAAQ,2BAA0B;AAQ7D,MAAMC,eAAeC,QAAQC,OAAO,CAAC;AACrC,gEAAgE;AAChE,MAAMC,oBACJ;AAEF,OAAO,SAASC,qBACdC,GAAmB,EACnBC,UAAsB;QAGUC,gBACbA;IAFnB,MAAMA,YAAYR,mBAAmBM;IACrC,MAAMG,0BAA0BD,8BAAAA,iBAAAA,UAAWE,GAAG,qBAAdF,eAAgBG,eAAe;IAC/D,MAAMC,aAAaJ,CAAAA,8BAAAA,kBAAAA,UAAWE,GAAG,qBAAdF,gBAAgBI,UAAU,KAAI,EAAE;IAEnD,4EAA4E;IAC5E,6EAA6E;IAC7E,4DAA4D;IAE5D,IAAIL,eAAe,QAAQ;QACzB,IAAIE,4BAA4B,QAAQ;YACtC,IAAIG,WAAWC,MAAM,KAAK,GAAG;gBAC3B,uEAAuE;gBACvE,yEAAyE;gBACzE,oBAAoB;gBACpB,OAAO;YACT,OAAO,IAAI,CAACD,WAAWE,QAAQ,CAAC,MAAM;gBACpC,2CAA2C;gBAC3C,OAAO;YACT;QACF,OAAO,IAAIL,4BAA4B,OAAO;YAC5C,OAAO;QACT;IACF;IAEA,OAAOF;AACT;AAEA,eAAe,SAASQ,gBAEtB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C"}
|
@@ -26,7 +26,7 @@ export const regexCSS = /\.(css|scss|sass)(\?.*)?$/;
|
|
26
26
|
// never only rely on a single regex to do that.
|
27
27
|
export function isCSSMod(mod) {
|
28
28
|
var _mod_loaders;
|
29
|
-
return !!(mod.type === 'css/mini-extract' || mod.resource && regexCSS.test(mod.resource) || ((_mod_loaders = mod.loaders) == null ? void 0 : _mod_loaders.some(({ loader })=>loader.includes('next-style-loader/index.js') || loader.includes('mini-css-extract-plugin/loader.js') || loader.includes('@vanilla-extract/webpack-plugin/loader/'))));
|
29
|
+
return !!(mod.type === 'css/mini-extract' || mod.resource && regexCSS.test(mod.resource) || ((_mod_loaders = mod.loaders) == null ? void 0 : _mod_loaders.some(({ loader })=>loader.includes('next-style-loader/index.js') || process.env.NEXT_RSPACK && loader.includes('rspack.CssExtractRspackPlugin.loader') || loader.includes('mini-css-extract-plugin/loader.js') || loader.includes('@vanilla-extract/webpack-plugin/loader/'))));
|
30
30
|
}
|
31
31
|
export function encodeToBase64(obj) {
|
32
32
|
return Buffer.from(JSON.stringify(obj)).toString('base64');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/build/webpack/loaders/utils.ts"],"sourcesContent":["import type webpack from 'webpack'\nimport { RSC_MODULE_TYPES } from '../../../shared/lib/constants'\nimport { getModuleBuildInfo } from './get-module-build-info'\n\nconst imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'avif', 'ico', 'svg']\nconst imageRegex = new RegExp(`\\\\.(${imageExtensions.join('|')})$`)\n\n// Determine if the whole module is client action, 'use server' in nested closure in the client module\nfunction isActionClientLayerModule(mod: webpack.NormalModule) {\n const rscInfo = getModuleBuildInfo(mod).rsc\n return !!(rscInfo?.actionIds && rscInfo?.type === RSC_MODULE_TYPES.client)\n}\n\nexport function isClientComponentEntryModule(mod: webpack.NormalModule) {\n const rscInfo = getModuleBuildInfo(mod).rsc\n const hasClientDirective = rscInfo?.isClientRef\n const isActionLayerEntry = isActionClientLayerModule(mod)\n return (\n hasClientDirective || isActionLayerEntry || imageRegex.test(mod.resource)\n )\n}\n\nexport const regexCSS = /\\.(css|scss|sass)(\\?.*)?$/\n\n// This function checks if a module is able to emit CSS resources. You should\n// never only rely on a single regex to do that.\nexport function isCSSMod(mod: {\n resource: string\n type?: string\n loaders?: { loader: string }[]\n}): boolean {\n return !!(\n mod.type === 'css/mini-extract' ||\n (mod.resource && regexCSS.test(mod.resource)) ||\n mod.loaders?.some(\n ({ loader }) =>\n loader.includes('next-style-loader/index.js') ||\n loader.includes('mini-css-extract-plugin/loader.js') ||\n loader.includes('@vanilla-extract/webpack-plugin/loader/')\n )\n )\n}\n\nexport function encodeToBase64<T extends object>(obj: T): string {\n return Buffer.from(JSON.stringify(obj)).toString('base64')\n}\n\nexport function decodeFromBase64<T extends object>(str: string): T {\n return JSON.parse(Buffer.from(str, 'base64').toString('utf8'))\n}\n\nexport async function getLoaderModuleNamedExports(\n resourcePath: string,\n context: webpack.LoaderContext<any>\n): Promise<string[]> {\n const mod = await new Promise<webpack.NormalModule>((res, rej) => {\n context.loadModule(\n resourcePath,\n (err: null | Error, _source: any, _sourceMap: any, module: any) => {\n if (err) {\n return rej(err)\n }\n res(module)\n }\n )\n })\n\n const exportNames =\n mod.dependencies\n ?.filter((dep) => {\n return (\n [\n 'HarmonyExportImportedSpecifierDependency',\n 'HarmonyExportSpecifierDependency',\n ].includes(dep.constructor.name) &&\n 'name' in dep &&\n dep.name !== 'default'\n )\n })\n .map((dep: any) => {\n return dep.name\n }) || []\n return exportNames\n}\n"],"names":["RSC_MODULE_TYPES","getModuleBuildInfo","imageExtensions","imageRegex","RegExp","join","isActionClientLayerModule","mod","rscInfo","rsc","actionIds","type","client","isClientComponentEntryModule","hasClientDirective","isClientRef","isActionLayerEntry","test","resource","regexCSS","isCSSMod","loaders","some","loader","includes","encodeToBase64","obj","Buffer","from","JSON","stringify","toString","decodeFromBase64","str","parse","getLoaderModuleNamedExports","resourcePath","context","Promise","res","rej","loadModule","err","_source","_sourceMap","module","exportNames","dependencies","filter","dep","constructor","name","map"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,gCAA+B;AAChE,SAASC,kBAAkB,QAAQ,0BAAyB;AAE5D,MAAMC,kBAAkB;IAAC;IAAO;IAAQ;IAAO;IAAQ;IAAQ;IAAO;CAAM;AAC5E,MAAMC,aAAa,IAAIC,OAAO,CAAC,IAAI,EAAEF,gBAAgBG,IAAI,CAAC,KAAK,EAAE,CAAC;AAElE,sGAAsG;AACtG,SAASC,0BAA0BC,GAAyB;IAC1D,MAAMC,UAAUP,mBAAmBM,KAAKE,GAAG;IAC3C,OAAO,CAAC,CAAED,CAAAA,CAAAA,2BAAAA,QAASE,SAAS,KAAIF,CAAAA,2BAAAA,QAASG,IAAI,MAAKX,iBAAiBY,MAAM,AAAD;AAC1E;AAEA,OAAO,SAASC,6BAA6BN,GAAyB;IACpE,MAAMC,UAAUP,mBAAmBM,KAAKE,GAAG;IAC3C,MAAMK,qBAAqBN,2BAAAA,QAASO,WAAW;IAC/C,MAAMC,qBAAqBV,0BAA0BC;IACrD,OACEO,sBAAsBE,sBAAsBb,WAAWc,IAAI,CAACV,IAAIW,QAAQ;AAE5E;AAEA,OAAO,MAAMC,WAAW,4BAA2B;AAEnD,6EAA6E;AAC7E,gDAAgD;AAChD,OAAO,SAASC,SAASb,GAIxB;QAIGA;IAHF,OAAO,CAAC,CACNA,CAAAA,IAAII,IAAI,KAAK,sBACZJ,IAAIW,QAAQ,IAAIC,SAASF,IAAI,CAACV,IAAIW,QAAQ,OAC3CX,eAAAA,IAAIc,OAAO,qBAAXd,aAAae,IAAI,CACf,CAAC,EAAEC,MAAM,EAAE,GACTA,OAAOC,QAAQ,CAAC,
|
1
|
+
{"version":3,"sources":["../../../../src/build/webpack/loaders/utils.ts"],"sourcesContent":["import type webpack from 'webpack'\nimport { RSC_MODULE_TYPES } from '../../../shared/lib/constants'\nimport { getModuleBuildInfo } from './get-module-build-info'\n\nconst imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'avif', 'ico', 'svg']\nconst imageRegex = new RegExp(`\\\\.(${imageExtensions.join('|')})$`)\n\n// Determine if the whole module is client action, 'use server' in nested closure in the client module\nfunction isActionClientLayerModule(mod: webpack.NormalModule) {\n const rscInfo = getModuleBuildInfo(mod).rsc\n return !!(rscInfo?.actionIds && rscInfo?.type === RSC_MODULE_TYPES.client)\n}\n\nexport function isClientComponentEntryModule(mod: webpack.NormalModule) {\n const rscInfo = getModuleBuildInfo(mod).rsc\n const hasClientDirective = rscInfo?.isClientRef\n const isActionLayerEntry = isActionClientLayerModule(mod)\n return (\n hasClientDirective || isActionLayerEntry || imageRegex.test(mod.resource)\n )\n}\n\nexport const regexCSS = /\\.(css|scss|sass)(\\?.*)?$/\n\n// This function checks if a module is able to emit CSS resources. You should\n// never only rely on a single regex to do that.\nexport function isCSSMod(mod: {\n resource: string\n type?: string\n loaders?: { loader: string }[]\n}): boolean {\n return !!(\n mod.type === 'css/mini-extract' ||\n (mod.resource && regexCSS.test(mod.resource)) ||\n mod.loaders?.some(\n ({ loader }) =>\n loader.includes('next-style-loader/index.js') ||\n (process.env.NEXT_RSPACK &&\n loader.includes('rspack.CssExtractRspackPlugin.loader')) ||\n loader.includes('mini-css-extract-plugin/loader.js') ||\n loader.includes('@vanilla-extract/webpack-plugin/loader/')\n )\n )\n}\n\nexport function encodeToBase64<T extends object>(obj: T): string {\n return Buffer.from(JSON.stringify(obj)).toString('base64')\n}\n\nexport function decodeFromBase64<T extends object>(str: string): T {\n return JSON.parse(Buffer.from(str, 'base64').toString('utf8'))\n}\n\nexport async function getLoaderModuleNamedExports(\n resourcePath: string,\n context: webpack.LoaderContext<any>\n): Promise<string[]> {\n const mod = await new Promise<webpack.NormalModule>((res, rej) => {\n context.loadModule(\n resourcePath,\n (err: null | Error, _source: any, _sourceMap: any, module: any) => {\n if (err) {\n return rej(err)\n }\n res(module)\n }\n )\n })\n\n const exportNames =\n mod.dependencies\n ?.filter((dep) => {\n return (\n [\n 'HarmonyExportImportedSpecifierDependency',\n 'HarmonyExportSpecifierDependency',\n ].includes(dep.constructor.name) &&\n 'name' in dep &&\n dep.name !== 'default'\n )\n })\n .map((dep: any) => {\n return dep.name\n }) || []\n return exportNames\n}\n"],"names":["RSC_MODULE_TYPES","getModuleBuildInfo","imageExtensions","imageRegex","RegExp","join","isActionClientLayerModule","mod","rscInfo","rsc","actionIds","type","client","isClientComponentEntryModule","hasClientDirective","isClientRef","isActionLayerEntry","test","resource","regexCSS","isCSSMod","loaders","some","loader","includes","process","env","NEXT_RSPACK","encodeToBase64","obj","Buffer","from","JSON","stringify","toString","decodeFromBase64","str","parse","getLoaderModuleNamedExports","resourcePath","context","Promise","res","rej","loadModule","err","_source","_sourceMap","module","exportNames","dependencies","filter","dep","constructor","name","map"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,gCAA+B;AAChE,SAASC,kBAAkB,QAAQ,0BAAyB;AAE5D,MAAMC,kBAAkB;IAAC;IAAO;IAAQ;IAAO;IAAQ;IAAQ;IAAO;CAAM;AAC5E,MAAMC,aAAa,IAAIC,OAAO,CAAC,IAAI,EAAEF,gBAAgBG,IAAI,CAAC,KAAK,EAAE,CAAC;AAElE,sGAAsG;AACtG,SAASC,0BAA0BC,GAAyB;IAC1D,MAAMC,UAAUP,mBAAmBM,KAAKE,GAAG;IAC3C,OAAO,CAAC,CAAED,CAAAA,CAAAA,2BAAAA,QAASE,SAAS,KAAIF,CAAAA,2BAAAA,QAASG,IAAI,MAAKX,iBAAiBY,MAAM,AAAD;AAC1E;AAEA,OAAO,SAASC,6BAA6BN,GAAyB;IACpE,MAAMC,UAAUP,mBAAmBM,KAAKE,GAAG;IAC3C,MAAMK,qBAAqBN,2BAAAA,QAASO,WAAW;IAC/C,MAAMC,qBAAqBV,0BAA0BC;IACrD,OACEO,sBAAsBE,sBAAsBb,WAAWc,IAAI,CAACV,IAAIW,QAAQ;AAE5E;AAEA,OAAO,MAAMC,WAAW,4BAA2B;AAEnD,6EAA6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_BUILD_MANIFEST, CLIENT_STATIC_FILES_PATH, CL
|
|
4
4
|
import getRouteFromEntrypoint from '../../../server/get-route-from-entrypoint';
|
5
5
|
import { ampFirstEntryNamesMap } from './next-drop-client-page-plugin';
|
6
6
|
import { getSortedRoutes } from '../../../shared/lib/router/utils';
|
7
|
-
import { spans } from './profiling-plugin';
|
7
|
+
import { spans as webpackSpans } from './profiling-plugin';
|
8
|
+
import { compilationSpans as rspackSpans } from './rspack-profiling-plugin';
|
8
9
|
import { Span } from '../../../trace';
|
10
|
+
const compilationSpans = process.env.NEXT_RSPACK ? rspackSpans : webpackSpans;
|
9
11
|
// Add the runtime ssg manifest file as a lazy-loaded file dependency.
|
10
12
|
// We also stub this file out for development mode (when it is not
|
11
13
|
// generated).
|
@@ -51,7 +53,7 @@ export function normalizeRewritesForBuildManifest(rewrites) {
|
|
51
53
|
// This function takes the asset map generated in BuildManifestPlugin and creates a
|
52
54
|
// reduced version to send to the client.
|
53
55
|
export function generateClientManifest(assetMap, rewrites, clientRouterFilters, compiler, compilation) {
|
54
|
-
const compilationSpan = compilation ?
|
56
|
+
const compilationSpan = compilation ? compilationSpans.get(compilation) : compiler ? compilationSpans.get(compiler) : new Span({
|
55
57
|
name: 'client-manifest'
|
56
58
|
});
|
57
59
|
const genClientManifestSpan = compilationSpan == null ? void 0 : compilationSpan.traceChild('NextJsBuildManifest-generateClientManifest');
|
@@ -116,9 +118,16 @@ export default class BuildManifestPlugin {
|
|
116
118
|
this.rewrites.fallback = options.rewrites.fallback.map(processRoute);
|
117
119
|
}
|
118
120
|
createAssets(compiler, compilation) {
|
119
|
-
const compilationSpan =
|
120
|
-
|
121
|
-
|
121
|
+
const compilationSpan = compilationSpans.get(compilation) ?? compilationSpans.get(compiler);
|
122
|
+
if (!compilationSpan) {
|
123
|
+
throw Object.defineProperty(new Error('No span found for compilation'), "__NEXT_ERROR_CODE", {
|
124
|
+
value: "E646",
|
125
|
+
enumerable: false,
|
126
|
+
configurable: true
|
127
|
+
});
|
128
|
+
}
|
129
|
+
const createAssetsSpan = compilationSpan.traceChild('NextJsBuildManifest-createassets');
|
130
|
+
return createAssetsSpan.traceFn(()=>{
|
122
131
|
const entrypoints = compilation.entrypoints;
|
123
132
|
const assetMap = {
|
124
133
|
polyfillFiles: [],
|