next 15.2.0-canary.28 → 15.2.0-canary.29
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 +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack/plugins/define-env-plugin.js +2 -1
- package/dist/build/webpack/plugins/define-env-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/slow-module-detection-plugin.d.ts +12 -0
- package/dist/build/webpack/plugins/slow-module-detection-plugin.js +187 -0
- package/dist/build/webpack/plugins/slow-module-detection-plugin.js.map +1 -0
- package/dist/build/webpack-config.js +19 -4
- package/dist/build/webpack-config.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/components/errors/stitched-error.js +3 -3
- package/dist/client/components/errors/stitched-error.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js +3 -3
- package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.d.ts +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +273 -144
- 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.js +4 -4
- 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/internal/next-logo.d.ts +3 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +9 -14
- 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/dev-tools-indicator/styles.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js +1 -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-footer/error-feedback/error-feedback.d.ts +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.d.ts +1 -4
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js +2 -3
- 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 +111 -86
- 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/use-error-hook.d.ts +4 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js +8 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.d.ts +14 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js +49 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js +8 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js +3 -3
- package/dist/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js.map +1 -1
- package/dist/client/components/react-dev-overlay/internal/styles/Base.js +8 -2
- package/dist/client/components/react-dev-overlay/internal/styles/Base.js.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js +2 -2
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack/plugins/define-env-plugin.js +2 -1
- package/dist/esm/build/webpack/plugins/define-env-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/slow-module-detection-plugin.js +177 -0
- package/dist/esm/build/webpack/plugins/slow-module-detection-plugin.js.map +1 -0
- package/dist/esm/build/webpack-config.js +19 -4
- package/dist/esm/build/webpack-config.js.map +1 -1
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/components/errors/stitched-error.js +3 -3
- package/dist/esm/client/components/errors/stitched-error.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js +3 -3
- 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/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +274 -146
- 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 +4 -4
- 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/internal/next-logo.js +9 -15
- 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/dev-tools-indicator/styles.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js +1 -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-footer/error-feedback/error-feedback.js +2 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js +2 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js +2 -3
- 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 +111 -86
- 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/use-error-hook.js +8 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js +33 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js +8 -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/pages/react-dev-overlay.js +3 -3
- 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/internal/styles/Base.js +8 -2
- package/dist/esm/client/components/react-dev-overlay/internal/styles/Base.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/export/worker.js +9 -1
- package/dist/esm/export/worker.js.map +1 -1
- package/dist/esm/lib/turbopack-warning.js +2 -1
- package/dist/esm/lib/turbopack-warning.js.map +1 -1
- package/dist/esm/server/base-server.js +4 -4
- package/dist/esm/server/base-server.js.map +1 -1
- package/dist/esm/server/config-schema.js +4 -1
- package/dist/esm/server/config-schema.js.map +1 -1
- package/dist/esm/server/config-shared.js +2 -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 +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +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/server/server-utils.js +22 -19
- package/dist/esm/server/server-utils.js.map +1 -1
- package/dist/esm/server/web-server.js +2 -2
- package/dist/esm/server/web-server.js.map +1 -1
- package/dist/export/worker.js +9 -1
- package/dist/export/worker.js.map +1 -1
- package/dist/lib/turbopack-warning.js +2 -1
- package/dist/lib/turbopack-warning.js.map +1 -1
- package/dist/server/base-server.js +4 -4
- package/dist/server/base-server.js.map +1 -1
- package/dist/server/config-schema.js +4 -1
- package/dist/server/config-schema.js.map +1 -1
- package/dist/server/config-shared.d.ts +11 -0
- package/dist/server/config-shared.js +2 -1
- package/dist/server/config-shared.js.map +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/server/server-utils.d.ts +4 -4
- package/dist/server/server-utils.js +22 -19
- package/dist/server/server-utils.js.map +1 -1
- package/dist/server/web-server.js +2 -2
- package/dist/server/web-server.js.map +1 -1
- 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/package.json +15 -15
package/dist/bin/next
CHANGED
|
@@ -75,7 +75,7 @@ const program = new NextRootCommand();
|
|
|
75
75
|
program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
|
|
76
76
|
formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
|
|
77
77
|
subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
|
|
78
|
-
}).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.2.0-canary.
|
|
78
|
+
}).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.2.0-canary.29"}`, '-v, --version', 'Outputs the Next.js version.');
|
|
79
79
|
program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').addOption(new _commander.Option('--experimental-turbo').hideHelp()).addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
|
|
80
80
|
'compile',
|
|
81
81
|
'generate'
|
package/dist/build/index.js
CHANGED
|
@@ -362,7 +362,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
|
|
|
362
362
|
const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
|
|
363
363
|
buildMode: experimentalBuildMode,
|
|
364
364
|
isTurboBuild: String(turboNextBuild),
|
|
365
|
-
version: "15.2.0-canary.
|
|
365
|
+
version: "15.2.0-canary.29"
|
|
366
366
|
});
|
|
367
367
|
_buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
|
|
368
368
|
_buildcontext.NextBuildContext.dir = dir;
|
|
@@ -722,7 +722,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
|
|
|
722
722
|
// Files outside of the distDir can be "type": "module"
|
|
723
723
|
await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
|
724
724
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
|
725
|
-
await (0, _builddiagnostics.recordFrameworkVersion)("15.2.0-canary.
|
|
725
|
+
await (0, _builddiagnostics.recordFrameworkVersion)("15.2.0-canary.29");
|
|
726
726
|
await (0, _builddiagnostics.updateBuildDiagnostics)({
|
|
727
727
|
buildStage: 'start'
|
|
728
728
|
});
|
package/dist/build/swc/index.js
CHANGED
|
@@ -119,7 +119,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
119
119
|
}
|
|
120
120
|
return newObj;
|
|
121
121
|
}
|
|
122
|
-
const nextVersion = "15.2.0-canary.
|
|
122
|
+
const nextVersion = "15.2.0-canary.29";
|
|
123
123
|
const ArchName = (0, _os.arch)();
|
|
124
124
|
const PlatformName = (0, _os.platform)();
|
|
125
125
|
function infoLog(...args) {
|
|
@@ -187,7 +187,8 @@ function getDefineEnv({ isTurbopack, clientRouterFilters, config, dev, distDir,
|
|
|
187
187
|
} : undefined,
|
|
188
188
|
'process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY': // When `__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY` is set on CI,
|
|
189
189
|
// we need to pass it here so it can be enabled.
|
|
190
|
-
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' || config.experimental.newDevOverlay || false
|
|
190
|
+
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' || config.experimental.newDevOverlay || false,
|
|
191
|
+
'process.env.__NEXT_REACT_OWNER_STACK': config.experimental.reactOwnerStack ?? false
|
|
191
192
|
};
|
|
192
193
|
const userDefines = ((_config_compiler = config.compiler) == null ? void 0 : _config_compiler.define) ?? {};
|
|
193
194
|
for(const key in userDefines){
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/build/webpack/plugins/define-env-plugin.ts"],"sourcesContent":["import type {\n I18NDomains,\n NextConfigComplete,\n} from '../../../server/config-shared'\nimport type { MiddlewareMatcher } from '../../analysis/get-page-static-info'\nimport { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { needsExperimentalReact } from '../../../lib/needs-experimental-react'\nimport { checkIsAppPPREnabled } from '../../../server/lib/experimental/ppr'\n\nfunction errorIfEnvConflicted(config: NextConfigComplete, key: string) {\n const isPrivateKey = /^(?:NODE_.+)|^(?:__.+)$/i.test(key)\n const hasNextRuntimeKey = key === 'NEXT_RUNTIME'\n\n if (isPrivateKey || hasNextRuntimeKey) {\n throw new Error(\n `The key \"${key}\" under \"env\" in ${config.configFileName} is not allowed. https://nextjs.org/docs/messages/env-key-not-allowed`\n )\n }\n}\n\ntype BloomFilter = ReturnType<\n import('../../../shared/lib/bloom-filter').BloomFilter['export']\n>\n\nexport interface DefineEnvPluginOptions {\n isTurbopack: boolean\n clientRouterFilters?: {\n staticFilter: BloomFilter\n dynamicFilter: BloomFilter\n }\n config: NextConfigComplete\n dev: boolean\n distDir: string\n fetchCacheKeyPrefix: string | undefined\n hasRewrites: boolean\n isClient: boolean\n isEdgeServer: boolean\n isNodeOrEdgeCompilation: boolean\n isNodeServer: boolean\n middlewareMatchers: MiddlewareMatcher[] | undefined\n}\n\ninterface DefineEnv {\n [key: string]:\n | string\n | string[]\n | boolean\n | MiddlewareMatcher[]\n | BloomFilter\n | Partial<NextConfigComplete['images']>\n | I18NDomains\n}\n\ninterface SerializedDefineEnv {\n [key: string]: string\n}\n\n/**\n * Collects all environment variables that are using the `NEXT_PUBLIC_` prefix.\n */\nexport function getNextPublicEnvironmentVariables(): DefineEnv {\n const defineEnv: DefineEnv = {}\n for (const key in process.env) {\n if (key.startsWith('NEXT_PUBLIC_')) {\n const value = process.env[key]\n if (value != null) {\n defineEnv[`process.env.${key}`] = value\n }\n }\n }\n return defineEnv\n}\n\n/**\n * Collects the `env` config value from the Next.js config.\n */\nexport function getNextConfigEnv(config: NextConfigComplete): DefineEnv {\n // Refactored code below to use for-of\n const defineEnv: DefineEnv = {}\n const env = config.env\n for (const key in env) {\n const value = env[key]\n if (value != null) {\n errorIfEnvConflicted(config, key)\n defineEnv[`process.env.${key}`] = value\n }\n }\n return defineEnv\n}\n\n/**\n * Serializes the DefineEnv config so that it can be inserted into the code by Webpack/Turbopack, JSON stringifies each value.\n */\nfunction serializeDefineEnv(defineEnv: DefineEnv): SerializedDefineEnv {\n const defineEnvStringified: SerializedDefineEnv = {}\n for (const key in defineEnv) {\n const value = defineEnv[key]\n defineEnvStringified[key] = JSON.stringify(value)\n }\n\n return defineEnvStringified\n}\n\nfunction getImageConfig(\n config: NextConfigComplete,\n dev: boolean\n): { 'process.env.__NEXT_IMAGE_OPTS': Partial<NextConfigComplete['images']> } {\n return {\n 'process.env.__NEXT_IMAGE_OPTS': {\n deviceSizes: config.images.deviceSizes,\n imageSizes: config.images.imageSizes,\n qualities: config.images.qualities,\n path: config.images.path,\n loader: config.images.loader,\n dangerouslyAllowSVG: config.images.dangerouslyAllowSVG,\n unoptimized: config?.images?.unoptimized,\n ...(dev\n ? {\n // additional config in dev to allow validating on the client\n domains: config.images.domains,\n remotePatterns: config.images?.remotePatterns,\n localPatterns: config.images?.localPatterns,\n output: config.output,\n }\n : {}),\n },\n }\n}\n\nexport function getDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix,\n hasRewrites,\n isClient,\n isEdgeServer,\n isNodeOrEdgeCompilation,\n isNodeServer,\n middlewareMatchers,\n}: DefineEnvPluginOptions): SerializedDefineEnv {\n const nextPublicEnv = getNextPublicEnvironmentVariables()\n const nextConfigEnv = getNextConfigEnv(config)\n\n const isPPREnabled = checkIsAppPPREnabled(config.experimental.ppr)\n const isDynamicIOEnabled = !!config.experimental.dynamicIO\n const isUseCacheEnabled = !!config.experimental.useCache\n\n const defineEnv: DefineEnv = {\n // internal field to identify the plugin config\n __NEXT_DEFINE_ENV: true,\n\n ...nextPublicEnv,\n ...nextConfigEnv,\n ...(!isEdgeServer\n ? {}\n : {\n EdgeRuntime:\n /**\n * Cloud providers can set this environment variable to allow users\n * and library authors to have different implementations based on\n * the runtime they are running with, if it's not using `edge-runtime`\n */\n process.env.NEXT_EDGE_RUNTIME_PROVIDER ?? 'edge-runtime',\n\n // process should be only { env: {...} } for edge runtime.\n // For ignore avoid warn on `process.emit` usage but directly omit it.\n 'process.emit': false,\n }),\n 'process.turbopack': isTurbopack,\n 'process.env.TURBOPACK': isTurbopack,\n // TODO: enforce `NODE_ENV` on `process.env`, and add a test:\n 'process.env.NODE_ENV':\n dev || config.experimental.allowDevelopmentBuild\n ? 'development'\n : 'production',\n 'process.env.NEXT_RUNTIME': isEdgeServer\n ? 'edge'\n : isNodeServer\n ? 'nodejs'\n : '',\n 'process.env.NEXT_MINIMAL': '',\n 'process.env.__NEXT_APP_NAV_FAIL_HANDLING': Boolean(\n config.experimental.appNavFailHandling\n ),\n 'process.env.__NEXT_APP_ISR_INDICATOR': Boolean(\n config.devIndicators.appIsrStatus\n ),\n 'process.env.__NEXT_PPR': isPPREnabled,\n 'process.env.__NEXT_DYNAMIC_IO': isDynamicIOEnabled,\n 'process.env.__NEXT_USE_CACHE': isUseCacheEnabled,\n 'process.env.NEXT_DEPLOYMENT_ID': config.deploymentId || false,\n 'process.env.__NEXT_FETCH_CACHE_KEY_PREFIX': fetchCacheKeyPrefix ?? '',\n ...(isTurbopack\n ? {}\n : {\n 'process.env.__NEXT_MIDDLEWARE_MATCHERS': middlewareMatchers ?? [],\n }),\n 'process.env.__NEXT_MANUAL_CLIENT_BASE_PATH':\n config.experimental.manualClientBasePath ?? false,\n 'process.env.__NEXT_CLIENT_ROUTER_DYNAMIC_STALETIME': JSON.stringify(\n isNaN(Number(config.experimental.staleTimes?.dynamic))\n ? 0\n : config.experimental.staleTimes?.dynamic\n ),\n 'process.env.__NEXT_CLIENT_ROUTER_STATIC_STALETIME': JSON.stringify(\n isNaN(Number(config.experimental.staleTimes?.static))\n ? 5 * 60 // 5 minutes\n : config.experimental.staleTimes?.static\n ),\n 'process.env.__NEXT_CLIENT_ROUTER_FILTER_ENABLED':\n config.experimental.clientRouterFilter ?? true,\n 'process.env.__NEXT_CLIENT_ROUTER_S_FILTER':\n clientRouterFilters?.staticFilter ?? false,\n 'process.env.__NEXT_CLIENT_ROUTER_D_FILTER':\n clientRouterFilters?.dynamicFilter ?? false,\n 'process.env.__NEXT_CLIENT_SEGMENT_CACHE': Boolean(\n config.experimental.clientSegmentCache\n ),\n 'process.env.__NEXT_OPTIMISTIC_CLIENT_CACHE':\n config.experimental.optimisticClientCache ?? true,\n 'process.env.__NEXT_MIDDLEWARE_PREFETCH':\n config.experimental.middlewarePrefetch ?? 'flexible',\n 'process.env.__NEXT_CROSS_ORIGIN': config.crossOrigin,\n 'process.browser': isClient,\n 'process.env.__NEXT_TEST_MODE': process.env.__NEXT_TEST_MODE ?? false,\n // This is used in client/dev-error-overlay/hot-dev-client.js to replace the dist directory\n ...(dev && (isClient ?? isEdgeServer)\n ? {\n 'process.env.__NEXT_DIST_DIR': distDir,\n }\n : {}),\n 'process.env.__NEXT_TRAILING_SLASH': config.trailingSlash,\n 'process.env.__NEXT_BUILD_INDICATOR':\n config.devIndicators.buildActivity ?? true,\n 'process.env.__NEXT_BUILD_INDICATOR_POSITION':\n config.devIndicators.buildActivityPosition ?? 'bottom-right',\n 'process.env.__NEXT_STRICT_MODE':\n config.reactStrictMode === null ? false : config.reactStrictMode,\n 'process.env.__NEXT_STRICT_MODE_APP':\n // When next.config.js does not have reactStrictMode it's enabled by default.\n config.reactStrictMode === null ? true : config.reactStrictMode,\n 'process.env.__NEXT_OPTIMIZE_CSS':\n (config.experimental.optimizeCss && !dev) ?? false,\n 'process.env.__NEXT_SCRIPT_WORKERS':\n (config.experimental.nextScriptWorkers && !dev) ?? false,\n 'process.env.__NEXT_SCROLL_RESTORATION':\n config.experimental.scrollRestoration ?? false,\n ...getImageConfig(config, dev),\n 'process.env.__NEXT_ROUTER_BASEPATH': config.basePath,\n 'process.env.__NEXT_STRICT_NEXT_HEAD':\n config.experimental.strictNextHead ?? true,\n 'process.env.__NEXT_HAS_REWRITES': hasRewrites,\n 'process.env.__NEXT_CONFIG_OUTPUT': config.output,\n 'process.env.__NEXT_I18N_SUPPORT': !!config.i18n,\n 'process.env.__NEXT_I18N_DOMAINS': config.i18n?.domains ?? false,\n 'process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE':\n config.skipMiddlewareUrlNormalize,\n 'process.env.__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE':\n config.experimental.externalMiddlewareRewritesResolve ?? false,\n 'process.env.__NEXT_MANUAL_TRAILING_SLASH':\n config.skipTrailingSlashRedirect,\n 'process.env.__NEXT_HAS_WEB_VITALS_ATTRIBUTION':\n (config.experimental.webVitalsAttribution &&\n config.experimental.webVitalsAttribution.length > 0) ??\n false,\n 'process.env.__NEXT_WEB_VITALS_ATTRIBUTION':\n config.experimental.webVitalsAttribution ?? false,\n 'process.env.__NEXT_LINK_NO_TOUCH_START':\n config.experimental.linkNoTouchStart ?? false,\n 'process.env.__NEXT_ASSET_PREFIX': config.assetPrefix,\n 'process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS':\n !!config.experimental.authInterrupts,\n ...(isNodeOrEdgeCompilation\n ? {\n // Fix bad-actors in the npm ecosystem (e.g. `node-formidable`)\n // This is typically found in unmaintained modules from the\n // pre-webpack era (common in server-side code)\n 'global.GENTLY': false,\n }\n : undefined),\n ...(isNodeOrEdgeCompilation\n ? {\n 'process.env.__NEXT_EXPERIMENTAL_REACT':\n needsExperimentalReact(config),\n }\n : undefined),\n 'process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY':\n // When `__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY` is set on CI,\n // we need to pass it here so it can be enabled.\n process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||\n config.experimental.newDevOverlay ||\n false,\n }\n\n const userDefines = config.compiler?.define ?? {}\n for (const key in userDefines) {\n if (defineEnv.hasOwnProperty(key)) {\n throw new Error(\n `The \\`compiler.define\\` option is configured to replace the \\`${key}\\` variable. This variable is either part of a Next.js built-in or is already configured via the \\`env\\` option.`\n )\n }\n defineEnv[key] = userDefines[key]\n }\n\n return serializeDefineEnv(defineEnv)\n}\n\nexport function getDefineEnvPlugin(options: DefineEnvPluginOptions) {\n return new webpack.DefinePlugin(getDefineEnv(options))\n}\n"],"names":["getDefineEnv","getDefineEnvPlugin","getNextConfigEnv","getNextPublicEnvironmentVariables","errorIfEnvConflicted","config","key","isPrivateKey","test","hasNextRuntimeKey","Error","configFileName","defineEnv","process","env","startsWith","value","serializeDefineEnv","defineEnvStringified","JSON","stringify","getImageConfig","dev","deviceSizes","images","imageSizes","qualities","path","loader","dangerouslyAllowSVG","unoptimized","domains","remotePatterns","localPatterns","output","isTurbopack","clientRouterFilters","distDir","fetchCacheKeyPrefix","hasRewrites","isClient","isEdgeServer","isNodeOrEdgeCompilation","isNodeServer","middlewareMatchers","nextPublicEnv","nextConfigEnv","isPPREnabled","checkIsAppPPREnabled","experimental","ppr","isDynamicIOEnabled","dynamicIO","isUseCacheEnabled","useCache","__NEXT_DEFINE_ENV","EdgeRuntime","NEXT_EDGE_RUNTIME_PROVIDER","allowDevelopmentBuild","Boolean","appNavFailHandling","devIndicators","appIsrStatus","deploymentId","manualClientBasePath","isNaN","Number","staleTimes","dynamic","static","clientRouterFilter","staticFilter","dynamicFilter","clientSegmentCache","optimisticClientCache","middlewarePrefetch","crossOrigin","__NEXT_TEST_MODE","trailingSlash","buildActivity","buildActivityPosition","reactStrictMode","optimizeCss","nextScriptWorkers","scrollRestoration","basePath","strictNextHead","i18n","skipMiddlewareUrlNormalize","externalMiddlewareRewritesResolve","skipTrailingSlashRedirect","webVitalsAttribution","length","linkNoTouchStart","assetPrefix","authInterrupts","undefined","needsExperimentalReact","__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY","newDevOverlay","userDefines","compiler","define","hasOwnProperty","options","webpack","DefinePlugin"],"mappings":";;;;;;;;;;;;;;;;;IAiIgBA,YAAY;eAAZA;;IAqLAC,kBAAkB;eAAlBA;;IA1OAC,gBAAgB;eAAhBA;;IAhBAC,iCAAiC;eAAjCA;;;yBAvDQ;wCACe;qBACF;AAErC,SAASC,qBAAqBC,MAA0B,EAAEC,GAAW;IACnE,MAAMC,eAAe,2BAA2BC,IAAI,CAACF;IACrD,MAAMG,oBAAoBH,QAAQ;IAElC,IAAIC,gBAAgBE,mBAAmB;QACrC,MAAM,qBAEL,CAFK,IAAIC,MACR,CAAC,SAAS,EAAEJ,IAAI,iBAAiB,EAAED,OAAOM,cAAc,CAAC,qEAAqE,CAAC,GAD3H,qBAAA;mBAAA;wBAAA;QAEN;IACF;AACF;AA0CO,SAASR;IACd,MAAMS,YAAuB,CAAC;IAC9B,IAAK,MAAMN,OAAOO,QAAQC,GAAG,CAAE;QAC7B,IAAIR,IAAIS,UAAU,CAAC,iBAAiB;YAClC,MAAMC,QAAQH,QAAQC,GAAG,CAACR,IAAI;YAC9B,IAAIU,SAAS,MAAM;gBACjBJ,SAAS,CAA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3D,gDAAgD;QAChDnF,QAAQC,GAAG,CAACoF,mCAAmC,KAAK,UACpD7F,OAAO4C,YAAY,CAACkD,aAAa,IACjC;IACJ;IAEA,MAAMC,cAAc/F,EAAAA,mBAAAA,OAAOgG,QAAQ,qBAAfhG,iBAAiBiG,MAAM,KAAI,CAAC;IAChD,IAAK,MAAMhG,OAAO8F,YAAa;QAC7B,IAAIxF,UAAU2F,cAAc,CAACjG,MAAM;YACjC,MAAM,qBAEL,CAFK,IAAII,MACR,CAAC,8DAA8D,EAAEJ,IAAI,gHAAgH,CAAC,GADlL,qBAAA;uBAAA;4BAAA;YAEN;QACF;QACAM,SAAS,CAACN,IAAI,GAAG8F,WAAW,CAAC9F,IAAI;IACnC;IAEA,OAAOW,mBAAmBL;AAC5B;AAEO,SAASX,mBAAmBuG,OAA+B;IAChE,OAAO,IAAIC,gBAAO,CAACC,YAAY,CAAC1G,aAAawG;AAC/C"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/build/webpack/plugins/define-env-plugin.ts"],"sourcesContent":["import type {\n I18NDomains,\n NextConfigComplete,\n} from '../../../server/config-shared'\nimport type { MiddlewareMatcher } from '../../analysis/get-page-static-info'\nimport { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { needsExperimentalReact } from '../../../lib/needs-experimental-react'\nimport { checkIsAppPPREnabled } from '../../../server/lib/experimental/ppr'\n\nfunction errorIfEnvConflicted(config: NextConfigComplete, key: string) {\n const isPrivateKey = /^(?:NODE_.+)|^(?:__.+)$/i.test(key)\n const hasNextRuntimeKey = key === 'NEXT_RUNTIME'\n\n if (isPrivateKey || hasNextRuntimeKey) {\n throw new Error(\n `The key \"${key}\" under \"env\" in ${config.configFileName} is not allowed. https://nextjs.org/docs/messages/env-key-not-allowed`\n )\n }\n}\n\ntype BloomFilter = ReturnType<\n import('../../../shared/lib/bloom-filter').BloomFilter['export']\n>\n\nexport interface DefineEnvPluginOptions {\n isTurbopack: boolean\n clientRouterFilters?: {\n staticFilter: BloomFilter\n dynamicFilter: BloomFilter\n }\n config: NextConfigComplete\n dev: boolean\n distDir: string\n fetchCacheKeyPrefix: string | undefined\n hasRewrites: boolean\n isClient: boolean\n isEdgeServer: boolean\n isNodeOrEdgeCompilation: boolean\n isNodeServer: boolean\n middlewareMatchers: MiddlewareMatcher[] | undefined\n}\n\ninterface DefineEnv {\n [key: string]:\n | string\n | string[]\n | boolean\n | MiddlewareMatcher[]\n | BloomFilter\n | Partial<NextConfigComplete['images']>\n | I18NDomains\n}\n\ninterface SerializedDefineEnv {\n [key: string]: string\n}\n\n/**\n * Collects all environment variables that are using the `NEXT_PUBLIC_` prefix.\n */\nexport function getNextPublicEnvironmentVariables(): DefineEnv {\n const defineEnv: DefineEnv = {}\n for (const key in process.env) {\n if (key.startsWith('NEXT_PUBLIC_')) {\n const value = process.env[key]\n if (value != null) {\n defineEnv[`process.env.${key}`] = value\n }\n }\n }\n return defineEnv\n}\n\n/**\n * Collects the `env` config value from the Next.js config.\n */\nexport function getNextConfigEnv(config: NextConfigComplete): DefineEnv {\n // Refactored code below to use for-of\n const defineEnv: DefineEnv = {}\n const env = config.env\n for (const key in env) {\n const value = env[key]\n if (value != null) {\n errorIfEnvConflicted(config, key)\n defineEnv[`process.env.${key}`] = value\n }\n }\n return defineEnv\n}\n\n/**\n * Serializes the DefineEnv config so that it can be inserted into the code by Webpack/Turbopack, JSON stringifies each value.\n */\nfunction serializeDefineEnv(defineEnv: DefineEnv): SerializedDefineEnv {\n const defineEnvStringified: SerializedDefineEnv = {}\n for (const key in defineEnv) {\n const value = defineEnv[key]\n defineEnvStringified[key] = JSON.stringify(value)\n }\n\n return defineEnvStringified\n}\n\nfunction getImageConfig(\n config: NextConfigComplete,\n dev: boolean\n): { 'process.env.__NEXT_IMAGE_OPTS': Partial<NextConfigComplete['images']> } {\n return {\n 'process.env.__NEXT_IMAGE_OPTS': {\n deviceSizes: config.images.deviceSizes,\n imageSizes: config.images.imageSizes,\n qualities: config.images.qualities,\n path: config.images.path,\n loader: config.images.loader,\n dangerouslyAllowSVG: config.images.dangerouslyAllowSVG,\n unoptimized: config?.images?.unoptimized,\n ...(dev\n ? {\n // additional config in dev to allow validating on the client\n domains: config.images.domains,\n remotePatterns: config.images?.remotePatterns,\n localPatterns: config.images?.localPatterns,\n output: config.output,\n }\n : {}),\n },\n }\n}\n\nexport function getDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix,\n hasRewrites,\n isClient,\n isEdgeServer,\n isNodeOrEdgeCompilation,\n isNodeServer,\n middlewareMatchers,\n}: DefineEnvPluginOptions): SerializedDefineEnv {\n const nextPublicEnv = getNextPublicEnvironmentVariables()\n const nextConfigEnv = getNextConfigEnv(config)\n\n const isPPREnabled = checkIsAppPPREnabled(config.experimental.ppr)\n const isDynamicIOEnabled = !!config.experimental.dynamicIO\n const isUseCacheEnabled = !!config.experimental.useCache\n\n const defineEnv: DefineEnv = {\n // internal field to identify the plugin config\n __NEXT_DEFINE_ENV: true,\n\n ...nextPublicEnv,\n ...nextConfigEnv,\n ...(!isEdgeServer\n ? {}\n : {\n EdgeRuntime:\n /**\n * Cloud providers can set this environment variable to allow users\n * and library authors to have different implementations based on\n * the runtime they are running with, if it's not using `edge-runtime`\n */\n process.env.NEXT_EDGE_RUNTIME_PROVIDER ?? 'edge-runtime',\n\n // process should be only { env: {...} } for edge runtime.\n // For ignore avoid warn on `process.emit` usage but directly omit it.\n 'process.emit': false,\n }),\n 'process.turbopack': isTurbopack,\n 'process.env.TURBOPACK': isTurbopack,\n // TODO: enforce `NODE_ENV` on `process.env`, and add a test:\n 'process.env.NODE_ENV':\n dev || config.experimental.allowDevelopmentBuild\n ? 'development'\n : 'production',\n 'process.env.NEXT_RUNTIME': isEdgeServer\n ? 'edge'\n : isNodeServer\n ? 'nodejs'\n : '',\n 'process.env.NEXT_MINIMAL': '',\n 'process.env.__NEXT_APP_NAV_FAIL_HANDLING': Boolean(\n config.experimental.appNavFailHandling\n ),\n 'process.env.__NEXT_APP_ISR_INDICATOR': Boolean(\n config.devIndicators.appIsrStatus\n ),\n 'process.env.__NEXT_PPR': isPPREnabled,\n 'process.env.__NEXT_DYNAMIC_IO': isDynamicIOEnabled,\n 'process.env.__NEXT_USE_CACHE': isUseCacheEnabled,\n 'process.env.NEXT_DEPLOYMENT_ID': config.deploymentId || false,\n 'process.env.__NEXT_FETCH_CACHE_KEY_PREFIX': fetchCacheKeyPrefix ?? '',\n ...(isTurbopack\n ? {}\n : {\n 'process.env.__NEXT_MIDDLEWARE_MATCHERS': middlewareMatchers ?? [],\n }),\n 'process.env.__NEXT_MANUAL_CLIENT_BASE_PATH':\n config.experimental.manualClientBasePath ?? false,\n 'process.env.__NEXT_CLIENT_ROUTER_DYNAMIC_STALETIME': JSON.stringify(\n isNaN(Number(config.experimental.staleTimes?.dynamic))\n ? 0\n : config.experimental.staleTimes?.dynamic\n ),\n 'process.env.__NEXT_CLIENT_ROUTER_STATIC_STALETIME': JSON.stringify(\n isNaN(Number(config.experimental.staleTimes?.static))\n ? 5 * 60 // 5 minutes\n : config.experimental.staleTimes?.static\n ),\n 'process.env.__NEXT_CLIENT_ROUTER_FILTER_ENABLED':\n config.experimental.clientRouterFilter ?? true,\n 'process.env.__NEXT_CLIENT_ROUTER_S_FILTER':\n clientRouterFilters?.staticFilter ?? false,\n 'process.env.__NEXT_CLIENT_ROUTER_D_FILTER':\n clientRouterFilters?.dynamicFilter ?? false,\n 'process.env.__NEXT_CLIENT_SEGMENT_CACHE': Boolean(\n config.experimental.clientSegmentCache\n ),\n 'process.env.__NEXT_OPTIMISTIC_CLIENT_CACHE':\n config.experimental.optimisticClientCache ?? true,\n 'process.env.__NEXT_MIDDLEWARE_PREFETCH':\n config.experimental.middlewarePrefetch ?? 'flexible',\n 'process.env.__NEXT_CROSS_ORIGIN': config.crossOrigin,\n 'process.browser': isClient,\n 'process.env.__NEXT_TEST_MODE': process.env.__NEXT_TEST_MODE ?? false,\n // This is used in client/dev-error-overlay/hot-dev-client.js to replace the dist directory\n ...(dev && (isClient ?? isEdgeServer)\n ? {\n 'process.env.__NEXT_DIST_DIR': distDir,\n }\n : {}),\n 'process.env.__NEXT_TRAILING_SLASH': config.trailingSlash,\n 'process.env.__NEXT_BUILD_INDICATOR':\n config.devIndicators.buildActivity ?? true,\n 'process.env.__NEXT_BUILD_INDICATOR_POSITION':\n config.devIndicators.buildActivityPosition ?? 'bottom-right',\n 'process.env.__NEXT_STRICT_MODE':\n config.reactStrictMode === null ? false : config.reactStrictMode,\n 'process.env.__NEXT_STRICT_MODE_APP':\n // When next.config.js does not have reactStrictMode it's enabled by default.\n config.reactStrictMode === null ? true : config.reactStrictMode,\n 'process.env.__NEXT_OPTIMIZE_CSS':\n (config.experimental.optimizeCss && !dev) ?? false,\n 'process.env.__NEXT_SCRIPT_WORKERS':\n (config.experimental.nextScriptWorkers && !dev) ?? false,\n 'process.env.__NEXT_SCROLL_RESTORATION':\n config.experimental.scrollRestoration ?? false,\n ...getImageConfig(config, dev),\n 'process.env.__NEXT_ROUTER_BASEPATH': config.basePath,\n 'process.env.__NEXT_STRICT_NEXT_HEAD':\n config.experimental.strictNextHead ?? true,\n 'process.env.__NEXT_HAS_REWRITES': hasRewrites,\n 'process.env.__NEXT_CONFIG_OUTPUT': config.output,\n 'process.env.__NEXT_I18N_SUPPORT': !!config.i18n,\n 'process.env.__NEXT_I18N_DOMAINS': config.i18n?.domains ?? false,\n 'process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE':\n config.skipMiddlewareUrlNormalize,\n 'process.env.__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE':\n config.experimental.externalMiddlewareRewritesResolve ?? false,\n 'process.env.__NEXT_MANUAL_TRAILING_SLASH':\n config.skipTrailingSlashRedirect,\n 'process.env.__NEXT_HAS_WEB_VITALS_ATTRIBUTION':\n (config.experimental.webVitalsAttribution &&\n config.experimental.webVitalsAttribution.length > 0) ??\n false,\n 'process.env.__NEXT_WEB_VITALS_ATTRIBUTION':\n config.experimental.webVitalsAttribution ?? false,\n 'process.env.__NEXT_LINK_NO_TOUCH_START':\n config.experimental.linkNoTouchStart ?? false,\n 'process.env.__NEXT_ASSET_PREFIX': config.assetPrefix,\n 'process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS':\n !!config.experimental.authInterrupts,\n ...(isNodeOrEdgeCompilation\n ? {\n // Fix bad-actors in the npm ecosystem (e.g. `node-formidable`)\n // This is typically found in unmaintained modules from the\n // pre-webpack era (common in server-side code)\n 'global.GENTLY': false,\n }\n : undefined),\n ...(isNodeOrEdgeCompilation\n ? {\n 'process.env.__NEXT_EXPERIMENTAL_REACT':\n needsExperimentalReact(config),\n }\n : undefined),\n 'process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY':\n // When `__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY` is set on CI,\n // we need to pass it here so it can be enabled.\n process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||\n config.experimental.newDevOverlay ||\n false,\n 'process.env.__NEXT_REACT_OWNER_STACK':\n config.experimental.reactOwnerStack ?? false,\n }\n\n const userDefines = config.compiler?.define ?? {}\n for (const key in userDefines) {\n if (defineEnv.hasOwnProperty(key)) {\n throw new Error(\n `The \\`compiler.define\\` option is configured to replace the \\`${key}\\` variable. This variable is either part of a Next.js built-in or is already configured via the \\`env\\` option.`\n )\n }\n defineEnv[key] = userDefines[key]\n }\n\n return serializeDefineEnv(defineEnv)\n}\n\nexport function getDefineEnvPlugin(options: DefineEnvPluginOptions) {\n return new webpack.DefinePlugin(getDefineEnv(options))\n}\n"],"names":["getDefineEnv","getDefineEnvPlugin","getNextConfigEnv","getNextPublicEnvironmentVariables","errorIfEnvConflicted","config","key","isPrivateKey","test","hasNextRuntimeKey","Error","configFileName","defineEnv","process","env","startsWith","value","serializeDefineEnv","defineEnvStringified","JSON","stringify","getImageConfig","dev","deviceSizes","images","imageSizes","qualities","path","loader","dangerouslyAllowSVG","unoptimized","domains","remotePatterns","localPatterns","output","isTurbopack","clientRouterFilters","distDir","fetchCacheKeyPrefix","hasRewrites","isClient","isEdgeServer","isNodeOrEdgeCompilation","isNodeServer","middlewareMatchers","nextPublicEnv","nextConfigEnv","isPPREnabled","checkIsAppPPREnabled","experimental","ppr","isDynamicIOEnabled","dynamicIO","isUseCacheEnabled","useCache","__NEXT_DEFINE_ENV","EdgeRuntime","NEXT_EDGE_RUNTIME_PROVIDER","allowDevelopmentBuild","Boolean","appNavFailHandling","devIndicators","appIsrStatus","deploymentId","manualClientBasePath","isNaN","Number","staleTimes","dynamic","static","clientRouterFilter","staticFilter","dynamicFilter","clientSegmentCache","optimisticClientCache","middlewarePrefetch","crossOrigin","__NEXT_TEST_MODE","trailingSlash","buildActivity","buildActivityPosition","reactStrictMode","optimizeCss","nextScriptWorkers","scrollRestoration","basePath","strictNextHead","i18n","skipMiddlewareUrlNormalize","externalMiddlewareRewritesResolve","skipTrailingSlashRedirect","webVitalsAttribution","length","linkNoTouchStart","assetPrefix","authInterrupts","undefined","needsExperimentalReact","__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY","newDevOverlay","reactOwnerStack","userDefines","compiler","define","hasOwnProperty","options","webpack","DefinePlugin"],"mappings":";;;;;;;;;;;;;;;;;IAiIgBA,YAAY;eAAZA;;IAuLAC,kBAAkB;eAAlBA;;IA5OAC,gBAAgB;eAAhBA;;IAhBAC,iCAAiC;eAAjCA;;;yBAvDQ;wCACe;qBACF;AAErC,SAASC,qBAAqBC,MAA0B,EAAEC,GAAW;IACnE,MAAMC,eAAe,2BAA2BC,IAAI,CAACF;IACrD,MAAMG,oBAAoBH,QAAQ;IAElC,IAAIC,gBAAgBE,mBAAmB;QACrC,MAAM,qBAEL,CAFK,IAAIC,MACR,CAAC,SAAS,EAAEJ,IAAI,iBAAiB,EAAED,OAAOM,cAAc,CAAC,qEAAqE,CAAC,GAD3H,qBAAA;mBAAA;wBAAA;QAEN;IACF;AACF;AA0CO,SAASR;IAC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AAc;QACtC,GAAIrD,0BACA;YACE,+DAA+D;YAC/D,2DAA2D;YAC3D,+CAA+C;YAC/C,iBAAiB;QACnB,IACAsD,SAAS;QACb,GAAItD,0BACA;YACE,yCACEuD,IAAAA,8CAAsB,EAAC5F;QAC3B,IACA2F,SAAS;QACb,mDACE,2DAA2D;QAC3D,gDAAgD;QAChDnF,QAAQC,GAAG,CAACoF,mCAAmC,KAAK,UACpD7F,OAAO4C,YAAY,CAACkD,aAAa,IACjC;QACF,wCACE9F,OAAO4C,YAAY,CAACmD,eAAe,IAAI;IAC3C;IAEA,MAAMC,cAAchG,EAAAA,mBAAAA,OAAOiG,QAAQ,qBAAfjG,iBAAiBkG,MAAM,KAAI,CAAC;IAChD,IAAK,MAAMjG,OAAO+F,YAAa;QAC7B,IAAIzF,UAAU4F,cAAc,CAAClG,MAAM;YACjC,MAAM,qBAEL,CAFK,IAAII,MACR,CAAC,8DAA8D,EAAEJ,IAAI,gHAAgH,CAAC,GADlL,qBAAA;uBAAA;4BAAA;YAEN;QACF;QACAM,SAAS,CAACN,IAAI,GAAG+F,WAAW,CAAC/F,IAAI;IACnC;IAEA,OAAOW,mBAAmBL;AAC5B;AAEO,SAASX,mBAAmBwG,OAA+B;IAChE,OAAO,IAAIC,gBAAO,CAACC,YAAY,CAAC3G,aAAayG;AAC/C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Compiler } from 'webpack';
|
|
2
|
+
import type { CompilerNameValues } from '../../../shared/lib/constants';
|
|
3
|
+
interface ModuleBuildTimeAnalyzerOptions {
|
|
4
|
+
compilerType: CompilerNameValues;
|
|
5
|
+
buildTimeThresholdMs: number;
|
|
6
|
+
}
|
|
7
|
+
export default class SlowModuleDetectionPlugin {
|
|
8
|
+
private options;
|
|
9
|
+
constructor(options: ModuleBuildTimeAnalyzerOptions);
|
|
10
|
+
apply: (compiler: Compiler) => void;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return SlowModuleDetectionPlugin;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _picocolors = require("../../../lib/picocolors");
|
|
12
|
+
const PLUGIN_NAME = 'SlowModuleDetectionPlugin';
|
|
13
|
+
const TreeSymbols = {
|
|
14
|
+
VERTICAL_LINE: '│ ',
|
|
15
|
+
BRANCH: '├─ '
|
|
16
|
+
};
|
|
17
|
+
const PATH_TRUNCATION_LENGTH = 120;
|
|
18
|
+
// Matches node_modules paths, including pnpm-style paths
|
|
19
|
+
const NODE_MODULES_PATH_PATTERN = /node_modules(?:\/\.pnpm)?\/(.*)/;
|
|
20
|
+
const getModuleIdentifier = (module)=>{
|
|
21
|
+
const debugId = module.debugId;
|
|
22
|
+
return String(debugId);
|
|
23
|
+
};
|
|
24
|
+
const getModuleDisplayName = (module)=>{
|
|
25
|
+
const resourcePath = 'resource' in module && typeof module.resource === 'string' ? module.resource : undefined;
|
|
26
|
+
if (!resourcePath) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
let displayPath = resourcePath.replace(process.cwd(), '.');
|
|
30
|
+
const nodeModulesMatch = displayPath.match(NODE_MODULES_PATH_PATTERN);
|
|
31
|
+
if (nodeModulesMatch) {
|
|
32
|
+
return nodeModulesMatch[1];
|
|
33
|
+
}
|
|
34
|
+
return displayPath;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Truncates a path to a maximum length. If the path exceeds this length,
|
|
38
|
+
* it will be truncated in the middle and replaced with '...'.
|
|
39
|
+
*/ function truncatePath(path, maxLength) {
|
|
40
|
+
// If the path length is within the limit, return it as is
|
|
41
|
+
if (path.length <= maxLength) return path;
|
|
42
|
+
// Calculate the available length for the start and end segments after accounting for '...'
|
|
43
|
+
const availableLength = maxLength - 3;
|
|
44
|
+
const startSegmentLength = Math.ceil(availableLength / 2);
|
|
45
|
+
const endSegmentLength = Math.floor(availableLength / 2);
|
|
46
|
+
// Extract the start and end segments of the path
|
|
47
|
+
const startSegment = path.slice(0, startSegmentLength);
|
|
48
|
+
const endSegment = path.slice(-endSegmentLength);
|
|
49
|
+
// Return the truncated path with '...' in the middle
|
|
50
|
+
return `${startSegment}...${endSegment}`;
|
|
51
|
+
}
|
|
52
|
+
class ModuleBuildTimeAnalyzer {
|
|
53
|
+
constructor(options){
|
|
54
|
+
this.options = options;
|
|
55
|
+
this.pendingModules = [];
|
|
56
|
+
this.modules = new Map();
|
|
57
|
+
this.moduleParents = new Map();
|
|
58
|
+
this.moduleChildren = new Map();
|
|
59
|
+
this.isFinalized = false;
|
|
60
|
+
this.moduleBuildTimes = new WeakMap();
|
|
61
|
+
this.buildTimeThresholdMs = options.buildTimeThresholdMs;
|
|
62
|
+
}
|
|
63
|
+
recordModuleBuildTime(module, duration) {
|
|
64
|
+
// Webpack guarantees that no more modules will be built after finishModules hook is called,
|
|
65
|
+
// where we generate the report. This check is just a defensive measure.
|
|
66
|
+
if (this.isFinalized) {
|
|
67
|
+
throw Object.defineProperty(new Error(`Invariant (SlowModuleDetectionPlugin): Module is recorded after the report is generated. This is a Next.js internal bug.`), "__NEXT_ERROR_CODE", {
|
|
68
|
+
value: "E630",
|
|
69
|
+
enumerable: false
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (duration < this.buildTimeThresholdMs) {
|
|
73
|
+
return; // Skip fast modules
|
|
74
|
+
}
|
|
75
|
+
this.moduleBuildTimes.set(module, duration);
|
|
76
|
+
this.pendingModules.push(module);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* For each slow module, traverses up the dependency chain to find all ancestor modules.
|
|
80
|
+
* Builds a directed graph where:
|
|
81
|
+
* 1. Each slow module and its ancestors become nodes
|
|
82
|
+
* 2. Edges represent "imported by" relationships
|
|
83
|
+
* 3. Root nodes are entry points with no parents
|
|
84
|
+
*
|
|
85
|
+
* The resulting graph allows us to visualize the import chains that led to slow builds.
|
|
86
|
+
*/ prepareReport(compilation) {
|
|
87
|
+
for (const module of this.pendingModules){
|
|
88
|
+
const chain = new Set();
|
|
89
|
+
// Walk up the module graph until we hit a root module (no issuer) to populate the chain
|
|
90
|
+
{
|
|
91
|
+
let currentModule = module;
|
|
92
|
+
chain.add(currentModule);
|
|
93
|
+
while(true){
|
|
94
|
+
const issuerModule = compilation.moduleGraph.getIssuer(currentModule);
|
|
95
|
+
if (!issuerModule) break;
|
|
96
|
+
if (chain.has(issuerModule)) {
|
|
97
|
+
throw Object.defineProperty(new Error(`Invariant (SlowModuleDetectionPlugin): Circular dependency detected in module graph. This is a Next.js internal bug.`), "__NEXT_ERROR_CODE", {
|
|
98
|
+
value: "E631",
|
|
99
|
+
enumerable: false
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
chain.add(issuerModule);
|
|
103
|
+
currentModule = issuerModule;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Add all visited modules to our graph and create parent-child relationships
|
|
107
|
+
let previousModule = null;
|
|
108
|
+
for (const currentModule of chain){
|
|
109
|
+
const moduleId = getModuleIdentifier(currentModule);
|
|
110
|
+
if (!this.modules.has(moduleId)) {
|
|
111
|
+
this.modules.set(moduleId, currentModule);
|
|
112
|
+
}
|
|
113
|
+
if (previousModule) {
|
|
114
|
+
this.moduleParents.set(previousModule, currentModule);
|
|
115
|
+
let parentChildren = this.moduleChildren.get(currentModule);
|
|
116
|
+
if (!parentChildren) {
|
|
117
|
+
parentChildren = new Map();
|
|
118
|
+
this.moduleChildren.set(currentModule, parentChildren);
|
|
119
|
+
}
|
|
120
|
+
parentChildren.set(getModuleIdentifier(previousModule), previousModule);
|
|
121
|
+
}
|
|
122
|
+
previousModule = currentModule;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this.isFinalized = true;
|
|
126
|
+
}
|
|
127
|
+
generateReport(compilation) {
|
|
128
|
+
if (!this.isFinalized) {
|
|
129
|
+
this.prepareReport(compilation);
|
|
130
|
+
}
|
|
131
|
+
// Find root modules (those with no parents)
|
|
132
|
+
const rootModules = [
|
|
133
|
+
...this.modules.values()
|
|
134
|
+
].filter((node)=>!this.moduleParents.has(node));
|
|
135
|
+
const formatModuleNode = (node, depth)=>{
|
|
136
|
+
const moduleName = getModuleDisplayName(node) || '';
|
|
137
|
+
if (!moduleName) {
|
|
138
|
+
return formatChildModules(node, depth);
|
|
139
|
+
}
|
|
140
|
+
const prefix = ' ' + TreeSymbols.VERTICAL_LINE.repeat(depth) + TreeSymbols.BRANCH;
|
|
141
|
+
const moduleText = (0, _picocolors.blue)(truncatePath(moduleName, PATH_TRUNCATION_LENGTH - prefix.length));
|
|
142
|
+
const buildTimeMs = this.moduleBuildTimes.get(node);
|
|
143
|
+
const duration = buildTimeMs ? (0, _picocolors.yellow)(` (${Math.ceil(buildTimeMs)}ms)`) : '';
|
|
144
|
+
return prefix + moduleText + duration + '\n' + formatChildModules(node, depth + 1);
|
|
145
|
+
};
|
|
146
|
+
const formatChildModules = (node, depth)=>{
|
|
147
|
+
const children = this.moduleChildren.get(node);
|
|
148
|
+
if (!children) return '';
|
|
149
|
+
return [
|
|
150
|
+
...children
|
|
151
|
+
].map(([_, child])=>formatModuleNode(child, depth)).join('');
|
|
152
|
+
};
|
|
153
|
+
const report = rootModules.map((root)=>formatModuleNode(root, 0)).join('');
|
|
154
|
+
if (report) {
|
|
155
|
+
console.log((0, _picocolors.green)(`🐌 Detected slow modules while compiling ${this.options.compilerType}:`) + '\n' + report);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
class SlowModuleDetectionPlugin {
|
|
160
|
+
constructor(options){
|
|
161
|
+
this.options = options;
|
|
162
|
+
this.apply = (compiler)=>{
|
|
163
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
164
|
+
const analyzer = new ModuleBuildTimeAnalyzer(this.options);
|
|
165
|
+
const moduleBuildStartTimes = new WeakMap();
|
|
166
|
+
compilation.hooks.buildModule.tap(PLUGIN_NAME, (module)=>{
|
|
167
|
+
moduleBuildStartTimes.set(module, performance.now());
|
|
168
|
+
});
|
|
169
|
+
compilation.hooks.succeedModule.tap(PLUGIN_NAME, (module)=>{
|
|
170
|
+
const startTime = moduleBuildStartTimes.get(module);
|
|
171
|
+
if (!startTime) {
|
|
172
|
+
throw Object.defineProperty(new Error(`Invariant (SlowModuleDetectionPlugin): Unable to find the start time for a module build. This is a Next.js internal bug.`), "__NEXT_ERROR_CODE", {
|
|
173
|
+
value: "E629",
|
|
174
|
+
enumerable: false
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
analyzer.recordModuleBuildTime(module, performance.now() - startTime);
|
|
178
|
+
});
|
|
179
|
+
compilation.hooks.finishModules.tap(PLUGIN_NAME, ()=>{
|
|
180
|
+
analyzer.generateReport(compilation);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
//# sourceMappingURL=slow-module-detection-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/build/webpack/plugins/slow-module-detection-plugin.ts"],"sourcesContent":["import type { Compiler, Module, Compilation } from 'webpack'\nimport type { CompilerNameValues } from '../../../shared/lib/constants'\nimport { yellow, green, blue } from '../../../lib/picocolors'\n\nconst PLUGIN_NAME = 'SlowModuleDetectionPlugin'\n\nconst TreeSymbols = {\n VERTICAL_LINE: '│ ',\n BRANCH: '├─ ',\n} as const\n\nconst PATH_TRUNCATION_LENGTH = 120\n\n// Matches node_modules paths, including pnpm-style paths\nconst NODE_MODULES_PATH_PATTERN = /node_modules(?:\\/\\.pnpm)?\\/(.*)/\n\ninterface ModuleBuildTimeAnalyzerOptions {\n compilerType: CompilerNameValues\n buildTimeThresholdMs: number\n}\n\nconst getModuleIdentifier = (module: Module): string => {\n const debugId = module.debugId\n return String(debugId)\n}\n\nconst getModuleDisplayName = (module: Module): string | undefined => {\n const resourcePath =\n 'resource' in module && typeof module.resource === 'string'\n ? module.resource\n : undefined\n\n if (!resourcePath) {\n return undefined\n }\n\n let displayPath = resourcePath.replace(process.cwd(), '.')\n\n const nodeModulesMatch = displayPath.match(NODE_MODULES_PATH_PATTERN)\n if (nodeModulesMatch) {\n return nodeModulesMatch[1]\n }\n\n return displayPath\n}\n\n/**\n * Truncates a path to a maximum length. If the path exceeds this length,\n * it will be truncated in the middle and replaced with '...'.\n */\nfunction truncatePath(path: string, maxLength: number): string {\n // If the path length is within the limit, return it as is\n if (path.length <= maxLength) return path\n\n // Calculate the available length for the start and end segments after accounting for '...'\n const availableLength = maxLength - 3\n const startSegmentLength = Math.ceil(availableLength / 2)\n const endSegmentLength = Math.floor(availableLength / 2)\n\n // Extract the start and end segments of the path\n const startSegment = path.slice(0, startSegmentLength)\n const endSegment = path.slice(-endSegmentLength)\n\n // Return the truncated path with '...' in the middle\n return `${startSegment}...${endSegment}`\n}\n\nclass ModuleBuildTimeAnalyzer {\n private pendingModules: Module[] = []\n private modules = new Map<string, Module>()\n private moduleParents = new Map<Module, Module>()\n private moduleChildren = new Map<Module, Map<string, Module>>()\n private isFinalized = false\n private buildTimeThresholdMs: number\n private moduleBuildTimes = new WeakMap<Module, number>()\n\n constructor(private options: ModuleBuildTimeAnalyzerOptions) {\n this.buildTimeThresholdMs = options.buildTimeThresholdMs\n }\n\n recordModuleBuildTime(module: Module, duration: number) {\n // Webpack guarantees that no more modules will be built after finishModules hook is called,\n // where we generate the report. This check is just a defensive measure.\n if (this.isFinalized) {\n throw new Error(\n `Invariant (SlowModuleDetectionPlugin): Module is recorded after the report is generated. This is a Next.js internal bug.`\n )\n }\n\n if (duration < this.buildTimeThresholdMs) {\n return // Skip fast modules\n }\n\n this.moduleBuildTimes.set(module, duration)\n this.pendingModules.push(module)\n }\n\n /**\n * For each slow module, traverses up the dependency chain to find all ancestor modules.\n * Builds a directed graph where:\n * 1. Each slow module and its ancestors become nodes\n * 2. Edges represent \"imported by\" relationships\n * 3. Root nodes are entry points with no parents\n *\n * The resulting graph allows us to visualize the import chains that led to slow builds.\n */\n private prepareReport(compilation: Compilation) {\n for (const module of this.pendingModules) {\n const chain = new Set<Module>()\n\n // Walk up the module graph until we hit a root module (no issuer) to populate the chain\n {\n let currentModule = module\n chain.add(currentModule)\n while (true) {\n const issuerModule = compilation.moduleGraph.getIssuer(currentModule)\n if (!issuerModule) break\n if (chain.has(issuerModule)) {\n throw new Error(\n `Invariant (SlowModuleDetectionPlugin): Circular dependency detected in module graph. This is a Next.js internal bug.`\n )\n }\n chain.add(issuerModule)\n currentModule = issuerModule\n }\n }\n\n // Add all visited modules to our graph and create parent-child relationships\n let previousModule: Module | null = null\n for (const currentModule of chain) {\n const moduleId = getModuleIdentifier(currentModule)\n if (!this.modules.has(moduleId)) {\n this.modules.set(moduleId, currentModule)\n }\n\n if (previousModule) {\n this.moduleParents.set(previousModule, currentModule)\n\n let parentChildren = this.moduleChildren.get(currentModule)\n if (!parentChildren) {\n parentChildren = new Map()\n this.moduleChildren.set(currentModule, parentChildren)\n }\n parentChildren.set(\n getModuleIdentifier(previousModule),\n previousModule\n )\n }\n\n previousModule = currentModule\n }\n }\n this.isFinalized = true\n }\n\n generateReport(compilation: Compilation) {\n if (!this.isFinalized) {\n this.prepareReport(compilation)\n }\n\n // Find root modules (those with no parents)\n const rootModules = [...this.modules.values()].filter(\n (node) => !this.moduleParents.has(node)\n )\n\n const formatModuleNode = (node: Module, depth: number): string => {\n const moduleName = getModuleDisplayName(node) || ''\n\n if (!moduleName) {\n return formatChildModules(node, depth)\n }\n\n const prefix =\n ' ' + TreeSymbols.VERTICAL_LINE.repeat(depth) + TreeSymbols.BRANCH\n\n const moduleText = blue(\n truncatePath(moduleName, PATH_TRUNCATION_LENGTH - prefix.length)\n )\n\n const buildTimeMs = this.moduleBuildTimes.get(node)\n const duration = buildTimeMs\n ? yellow(` (${Math.ceil(buildTimeMs)}ms)`)\n : ''\n\n return (\n prefix +\n moduleText +\n duration +\n '\\n' +\n formatChildModules(node, depth + 1)\n )\n }\n\n const formatChildModules = (node: Module, depth: number): string => {\n const children = this.moduleChildren.get(node)\n if (!children) return ''\n\n return [...children]\n .map(([_, child]) => formatModuleNode(child, depth))\n .join('')\n }\n\n const report = rootModules.map((root) => formatModuleNode(root, 0)).join('')\n\n if (report) {\n console.log(\n green(\n `🐌 Detected slow modules while compiling ${this.options.compilerType}:`\n ) +\n '\\n' +\n report\n )\n }\n }\n}\n\nexport default class SlowModuleDetectionPlugin {\n constructor(private options: ModuleBuildTimeAnalyzerOptions) {}\n\n apply = (compiler: Compiler) => {\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n const analyzer = new ModuleBuildTimeAnalyzer(this.options)\n const moduleBuildStartTimes = new WeakMap<Module, number>()\n\n compilation.hooks.buildModule.tap(PLUGIN_NAME, (module) => {\n moduleBuildStartTimes.set(module, performance.now())\n })\n\n compilation.hooks.succeedModule.tap(PLUGIN_NAME, (module) => {\n const startTime = moduleBuildStartTimes.get(module)\n if (!startTime) {\n throw new Error(\n `Invariant (SlowModuleDetectionPlugin): Unable to find the start time for a module build. This is a Next.js internal bug.`\n )\n }\n analyzer.recordModuleBuildTime(module, performance.now() - startTime)\n })\n\n compilation.hooks.finishModules.tap(PLUGIN_NAME, () => {\n analyzer.generateReport(compilation)\n })\n })\n }\n}\n"],"names":["SlowModuleDetectionPlugin","PLUGIN_NAME","TreeSymbols","VERTICAL_LINE","BRANCH","PATH_TRUNCATION_LENGTH","NODE_MODULES_PATH_PATTERN","getModuleIdentifier","module","debugId","String","getModuleDisplayName","resourcePath","resource","undefined","displayPath","replace","process","cwd","nodeModulesMatch","match","truncatePath","path","maxLength","length","availableLength","startSegmentLength","Math","ceil","endSegmentLength","floor","startSegment","slice","endSegment","ModuleBuildTimeAnalyzer","constructor","options","pendingModules","modules","Map","moduleParents","moduleChildren","isFinalized","moduleBuildTimes","WeakMap","buildTimeThresholdMs","recordModuleBuildTime","duration","Error","set","push","prepareReport","compilation","chain","Set","currentModule","add","issuerModule","moduleGraph","getIssuer","has","previousModule","moduleId","parentChildren","get","generateReport","rootModules","values","filter","node","formatModuleNode","depth","moduleName","formatChildModules","prefix","repeat","moduleText","blue","buildTimeMs","yellow","children","map","_","child","join","report","root","console","log","green","compilerType","apply","compiler","hooks","tap","analyzer","moduleBuildStartTimes","buildModule","performance","now","succeedModule","startTime","finishModules"],"mappings":";;;;+BAwNA;;;eAAqBA;;;4BAtNe;AAEpC,MAAMC,cAAc;AAEpB,MAAMC,cAAc;IAClBC,eAAe;IACfC,QAAQ;AACV;AAEA,MAAMC,yBAAyB;AAE/B,yDAAyD;AACzD,MAAMC,4BAA4B;AAOlC,MAAMC,sBAAsB,CAACC;IAC3B,MAAMC,UAAUD,OAAOC,OAAO;IAC9B,OAAOC,OAAOD;AAChB;AAEA,MAAME,uBAAuB,CAACH;IAC5B,MAAMI,eACJ,cAAcJ,UAAU,OAAOA,OAAOK,QAAQ,KAAK,WAC/CL,OAAOK,QAAQ,GACfC;IAEN,IAAI,CAACF,cAAc;QACjB,OAAOE;IACT;IAEA,IAAIC,cAAcH,aAAaI,OAAO,CAACC,QAAQC,GAAG,IAAI;IAEtD,MAAMC,mBAAmBJ,YAAYK,KAAK,CAACd;IAC3C,IAAIa,kBAAkB;QACpB,OAAOA,gBAAgB,CAAC,EAAE;IAC5B;IAEA,OAAOJ;AACT;AAEA;;;CAGC,GACD,SAASM,aAAaC,IAAY,EAAEC,SAAiB;IACnD,0DAA0D;IAC1D,IAAID,KAAKE,MAAM,IAAID,WAAW,OAAOD;IAErC,2FAA2F;IAC3F,MAAMG,kBAAkBF,YAAY;IACpC,MAAMG,qBAAqBC,KAAKC,IAAI,CAACH,kBAAkB;IACvD,MAAMI,mBAAmBF,KAAKG,KAAK,CAACL,kBAAk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AAYL,sBAAsBhC,GAAG,CAACxD;oBAC5C,IAAI,CAAC6F,WAAW;wBACd,MAAM,qBAEL,CAFK,IAAIrD,MACR,CAAC,wHAAwH,CAAC,GADtH,qBAAA;mCAAA;wCAAA;wBAEN;oBACF;oBACA+C,SAASjD,qBAAqB,CAACtC,QAAQ0F,YAAYC,GAAG,KAAKE;gBAC7D;gBAEAjD,YAAYyC,KAAK,CAACS,aAAa,CAACR,GAAG,CAAC7F,aAAa;oBAC/C8F,SAAS9B,cAAc,CAACb;gBAC1B;YACF;QACF;IAzB8D;AA0BhE"}
|
|
@@ -629,8 +629,19 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
629
629
|
pageExtensionsRegex
|
|
630
630
|
];
|
|
631
631
|
const builtinModules = require('module').builtinModules;
|
|
632
|
+
const shouldEnableSlowModuleDetection = !!config.experimental.slowModuleDetection && dev;
|
|
633
|
+
const getParallelism = ()=>{
|
|
634
|
+
const override = Number(process.env.NEXT_WEBPACK_PARALLELISM);
|
|
635
|
+
if (shouldEnableSlowModuleDetection) {
|
|
636
|
+
if (override) {
|
|
637
|
+
console.warn('NEXT_WEBPACK_PARALLELISM is specified but will be ignored due to experimental.slowModuleDetection being enabled.');
|
|
638
|
+
}
|
|
639
|
+
return 1;
|
|
640
|
+
}
|
|
641
|
+
return override || undefined;
|
|
642
|
+
};
|
|
632
643
|
let webpackConfig = {
|
|
633
|
-
parallelism:
|
|
644
|
+
parallelism: getParallelism(),
|
|
634
645
|
...isNodeServer ? {
|
|
635
646
|
externalsPresets: {
|
|
636
647
|
node: true
|
|
@@ -1499,7 +1510,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1499
1510
|
isClient && new _copyfileplugin.CopyFilePlugin({
|
|
1500
1511
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1501
1512
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1502
|
-
cacheKey: "15.2.0-canary.
|
|
1513
|
+
cacheKey: "15.2.0-canary.29",
|
|
1503
1514
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1504
1515
|
minimize: false,
|
|
1505
1516
|
info: {
|
|
@@ -1594,7 +1605,11 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1594
1605
|
],
|
|
1595
1606
|
SWCBinaryTarget
|
|
1596
1607
|
].filter(Boolean))),
|
|
1597
|
-
!dev && isNodeServer && new (require('./webpack/plugins/telemetry-plugin/telemetry-plugin')).TelemetryPlugin(new Map())
|
|
1608
|
+
!dev && isNodeServer && new (require('./webpack/plugins/telemetry-plugin/telemetry-plugin')).TelemetryPlugin(new Map()),
|
|
1609
|
+
shouldEnableSlowModuleDetection && new (require('./webpack/plugins/slow-module-detection-plugin')).default({
|
|
1610
|
+
compilerType,
|
|
1611
|
+
...config.experimental.slowModuleDetection
|
|
1612
|
+
})
|
|
1598
1613
|
].filter(Boolean)
|
|
1599
1614
|
};
|
|
1600
1615
|
// Support tsconfig and jsconfig baseUrl
|
|
@@ -1728,7 +1743,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1728
1743
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1729
1744
|
// - Next.js version
|
|
1730
1745
|
// - next.config.js keys that affect compilation
|
|
1731
|
-
version: `${__dirname}|${"15.2.0-canary.
|
|
1746
|
+
version: `${__dirname}|${"15.2.0-canary.29"}|${configVars}`,
|
|
1732
1747
|
cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
|
|
1733
1748
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1734
1749
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|