next 15.3.0-canary.5 → 15.3.0-canary.8
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.
- package/dist/bin/next +3 -2
- package/dist/bin/next.map +1 -1
- package/dist/build/collect-build-traces.js +1 -1
- package/dist/build/collect-build-traces.js.map +1 -1
- package/dist/build/create-compiler-aliases.js +9 -0
- package/dist/build/create-compiler-aliases.js.map +1 -1
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +24 -11
- package/dist/build/index.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack/plugins/define-env-plugin.js +1 -0
- package/dist/build/webpack/plugins/define-env-plugin.js.map +1 -1
- package/dist/build/webpack-config.js +4 -6
- package/dist/build/webpack-config.js.map +1 -1
- package/dist/cli/next-build.d.ts +1 -1
- package/dist/cli/next-build.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/app-index.js +1 -0
- package/dist/client/app-index.js.map +1 -1
- package/dist/client/app-next-dev.d.ts +1 -0
- package/dist/client/app-next-dev.js +1 -0
- package/dist/client/app-next-dev.js.map +1 -1
- package/dist/client/app-next-turbopack.d.ts +1 -1
- package/dist/client/app-next-turbopack.js +1 -0
- package/dist/client/app-next-turbopack.js.map +1 -1
- package/dist/client/app-next.d.ts +1 -0
- package/dist/client/app-next.js +1 -0
- package/dist/client/app-next.js.map +1 -1
- package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.d.ts +1 -1
- package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js +30 -36
- package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js.map +1 -1
- package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.d.ts +8 -0
- package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js +90 -0
- package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js.map +1 -0
- package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js +2 -2
- package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js.map +1 -1
- package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.d.ts +1 -1
- package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js +1 -1
- package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
- package/dist/client/components/react-dev-overlay/ui/container/runtime-error/index.d.ts +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/next-turbopack.d.ts +1 -1
- package/dist/client/next-turbopack.js +1 -1
- package/dist/client/next-turbopack.js.map +1 -1
- package/dist/client/next.d.ts +1 -0
- package/dist/client/next.js +1 -0
- package/dist/client/next.js.map +1 -1
- package/dist/client/page-bootstrap.d.ts +1 -0
- package/dist/client/page-bootstrap.js +1 -0
- package/dist/client/page-bootstrap.js.map +1 -1
- 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 +4 -4
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/collect-build-traces.js +1 -1
- package/dist/esm/build/collect-build-traces.js.map +1 -1
- package/dist/esm/build/create-compiler-aliases.js +9 -0
- package/dist/esm/build/create-compiler-aliases.js.map +1 -1
- package/dist/esm/build/index.js +24 -11
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack/plugins/define-env-plugin.js +1 -0
- package/dist/esm/build/webpack/plugins/define-env-plugin.js.map +1 -1
- package/dist/esm/build/webpack-config.js +5 -7
- package/dist/esm/build/webpack-config.js.map +1 -1
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/app-index.js +1 -0
- package/dist/esm/client/app-index.js.map +1 -1
- package/dist/esm/client/app-next-dev.js +1 -0
- package/dist/esm/client/app-next-dev.js.map +1 -1
- package/dist/esm/client/app-next-turbopack.js +1 -0
- package/dist/esm/client/app-next-turbopack.js.map +1 -1
- package/dist/esm/client/app-next.js +1 -0
- package/dist/esm/client/app-next.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js +30 -35
- package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js +58 -0
- package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js +2 -2
- package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
- package/dist/esm/client/index.js +2 -1
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/client/next-turbopack.js +1 -0
- package/dist/esm/client/next-turbopack.js.map +1 -1
- package/dist/esm/client/next.js +1 -0
- package/dist/esm/client/next.js.map +1 -1
- package/dist/esm/client/page-bootstrap.js +1 -0
- package/dist/esm/client/page-bootstrap.js.map +1 -1
- package/dist/esm/lib/require-instrumentation-client.js +10 -0
- package/dist/esm/lib/require-instrumentation-client.js.map +1 -0
- package/dist/esm/server/base-server.js +2 -1
- package/dist/esm/server/base-server.js.map +1 -1
- package/dist/esm/server/config-schema.js +2 -2
- package/dist/esm/server/config-schema.js.map +1 -1
- package/dist/esm/server/config-shared.js +0 -1
- package/dist/esm/server/config-shared.js.map +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/decode-query-path-parameter.js +16 -0
- package/dist/esm/server/lib/decode-query-path-parameter.js.map +1 -0
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/server/typescript/index.js +7 -4
- package/dist/esm/server/typescript/index.js.map +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/lib/require-instrumentation-client.d.ts +6 -0
- package/dist/lib/require-instrumentation-client.js +11 -0
- package/dist/lib/require-instrumentation-client.js.map +1 -0
- package/dist/server/base-server.js +2 -1
- package/dist/server/base-server.js.map +1 -1
- package/dist/server/config-schema.js +2 -2
- package/dist/server/config-schema.js.map +1 -1
- package/dist/server/config-shared.d.ts +8 -1
- package/dist/server/config-shared.js +0 -1
- package/dist/server/config-shared.js.map +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/decode-query-path-parameter.d.ts +7 -0
- package/dist/server/lib/decode-query-path-parameter.js +26 -0
- package/dist/server/lib/decode-query-path-parameter.js.map +1 -0
- package/dist/server/lib/start-server.js +1 -1
- package/dist/server/typescript/index.js +7 -4
- package/dist/server/typescript/index.js.map +1 -1
- package/dist/shared/lib/canary-only.js +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
@@ -116,7 +116,7 @@ export async function collectBuildTraces({ dir, config, distDir, edgeRuntimeRout
|
|
116
116
|
...isStandalone ? [] : [
|
117
117
|
'**/next/dist/compiled/jest-worker/**/*'
|
118
118
|
],
|
119
|
-
'**/next/dist/compiled/webpack
|
119
|
+
'**/next/dist/compiled/webpack/*',
|
120
120
|
'**/node_modules/webpack5/**/*',
|
121
121
|
'**/next/dist/server/lib/route-resolver*',
|
122
122
|
'next/dist/compiled/semver/semver/**/*.js',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/build/collect-build-traces.ts"],"sourcesContent":["import { Span } from '../trace'\nimport type { NextConfigComplete } from '../server/config-shared'\n\nimport {\n TRACE_IGNORES,\n type BuildTraceContext,\n getFilesMapFromReasons,\n} from './webpack/plugins/next-trace-entrypoints-plugin'\n\nimport path from 'path'\nimport fs from 'fs/promises'\nimport { nonNullable } from '../lib/non-nullable'\nimport * as ciEnvironment from '../server/ci-info'\nimport debugOriginal from 'next/dist/compiled/debug'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport { defaultOverrides } from '../server/require-hook'\nimport { nodeFileTrace } from 'next/dist/compiled/@vercel/nft'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport isError from '../lib/is-error'\nimport type { NodeFileTraceReasons } from '@vercel/nft'\nimport type { RoutesUsingEdgeRuntime } from './utils'\n\nconst debug = debugOriginal('next:build:build-traces')\n\nfunction shouldIgnore(\n file: string,\n serverIgnoreFn: (file: string) => boolean,\n reasons: NodeFileTraceReasons,\n cachedIgnoreFiles: Map<string, boolean>,\n children: Set<string> = new Set()\n) {\n if (cachedIgnoreFiles.has(file)) {\n return cachedIgnoreFiles.get(file)\n }\n\n if (serverIgnoreFn(file)) {\n cachedIgnoreFiles.set(file, true)\n return true\n }\n children.add(file)\n\n const reason = reasons.get(file)\n if (!reason || reason.parents.size === 0 || reason.type.includes('initial')) {\n cachedIgnoreFiles.set(file, false)\n return false\n }\n\n // if all parents are ignored the child file\n // should be ignored as well\n let allParentsIgnored = true\n\n for (const parent of reason.parents.values()) {\n if (!children.has(parent)) {\n children.add(parent)\n if (\n !shouldIgnore(\n parent,\n serverIgnoreFn,\n reasons,\n cachedIgnoreFiles,\n children\n )\n ) {\n allParentsIgnored = false\n break\n }\n }\n }\n\n cachedIgnoreFiles.set(file, allParentsIgnored)\n return allParentsIgnored\n}\n\nexport async function collectBuildTraces({\n dir,\n config,\n distDir,\n edgeRuntimeRoutes,\n staticPages,\n nextBuildSpan = new Span({ name: 'build' }),\n hasSsrAmpPages,\n buildTraceContext,\n outputFileTracingRoot,\n}: {\n dir: string\n distDir: string\n staticPages: string[]\n hasSsrAmpPages: boolean\n outputFileTracingRoot: string\n // pageInfos is serialized when this function runs in a worker.\n edgeRuntimeRoutes: RoutesUsingEdgeRuntime\n nextBuildSpan?: Span\n config: NextConfigComplete\n buildTraceContext?: BuildTraceContext\n}) {\n const startTime = Date.now()\n debug('starting build traces')\n\n const { outputFileTracingIncludes = {}, outputFileTracingExcludes = {} } =\n config\n const excludeGlobKeys = Object.keys(outputFileTracingExcludes)\n const includeGlobKeys = Object.keys(outputFileTracingIncludes)\n\n await nextBuildSpan\n .traceChild('node-file-trace-build', {\n isTurbotrace: 'false', // TODO(arlyon): remove this\n })\n .traceAsyncFn(async () => {\n const nextServerTraceOutput = path.join(\n distDir,\n 'next-server.js.nft.json'\n )\n const nextMinimalTraceOutput = path.join(\n distDir,\n 'next-minimal-server.js.nft.json'\n )\n const root = outputFileTracingRoot\n\n // Under standalone mode, we need to trace the extra IPC server and\n // worker files.\n const isStandalone = config.output === 'standalone'\n const sharedEntriesSet = Object.keys(defaultOverrides).map((value) =>\n require.resolve(value, {\n paths: [require.resolve('next/dist/server/require-hook')],\n })\n )\n\n const { cacheHandler } = config\n const { cacheHandlers } = config.experimental\n\n // ensure we trace any dependencies needed for custom\n // incremental cache handler\n if (cacheHandler) {\n sharedEntriesSet.push(\n require.resolve(\n path.isAbsolute(cacheHandler)\n ? cacheHandler\n : path.join(dir, cacheHandler)\n )\n )\n }\n\n if (cacheHandlers) {\n for (const handlerPath of Object.values(cacheHandlers)) {\n if (handlerPath) {\n sharedEntriesSet.push(\n require.resolve(\n path.isAbsolute(handlerPath)\n ? handlerPath\n : path.join(dir, handlerPath)\n )\n )\n }\n }\n }\n\n const serverEntries = [\n ...sharedEntriesSet,\n ...(isStandalone\n ? [\n require.resolve('next/dist/server/lib/start-server'),\n require.resolve('next/dist/server/next'),\n require.resolve('next/dist/server/require-hook'),\n ]\n : []),\n require.resolve('next/dist/server/next-server'),\n ].filter(Boolean) as string[]\n\n const minimalServerEntries = [\n ...sharedEntriesSet,\n require.resolve('next/dist/compiled/next-server/server.runtime.prod'),\n ].filter(Boolean)\n\n const additionalIgnores = new Set<string>()\n\n for (const glob of excludeGlobKeys) {\n if (picomatch(glob)('next-server')) {\n outputFileTracingExcludes[glob].forEach((exclude) => {\n additionalIgnores.add(exclude)\n })\n }\n }\n\n const makeIgnoreFn = (ignores: string[]) => {\n // pre compile the ignore globs\n const isMatch = picomatch(ignores, {\n contains: true,\n dot: true,\n })\n\n return (pathname: string) => {\n if (path.isAbsolute(pathname) && !pathname.startsWith(root)) {\n return true\n }\n\n return isMatch(pathname)\n }\n }\n\n const sharedIgnores = [\n '**/next/dist/compiled/next-server/**/*.dev.js',\n ...(isStandalone ? [] : ['**/next/dist/compiled/jest-worker/**/*']),\n '**/next/dist/compiled/webpack/(bundle4|bundle5).js',\n '**/node_modules/webpack5/**/*',\n '**/next/dist/server/lib/route-resolver*',\n 'next/dist/compiled/semver/semver/**/*.js',\n\n ...(ciEnvironment.hasNextSupport\n ? [\n // only ignore image-optimizer code when\n // this is being handled outside of next-server\n '**/next/dist/server/image-optimizer.js',\n ]\n : []),\n\n ...(!hasSsrAmpPages\n ? ['**/next/dist/compiled/@ampproject/toolbox-optimizer/**/*']\n : []),\n\n ...(isStandalone ? [] : TRACE_IGNORES),\n ...additionalIgnores,\n ]\n\n const sharedIgnoresFn = makeIgnoreFn(sharedIgnores)\n\n const serverIgnores = [\n ...sharedIgnores,\n '**/node_modules/react{,-dom,-dom-server-turbopack}/**/*.development.js',\n '**/*.d.ts',\n '**/*.map',\n '**/next/dist/pages/**/*',\n ...(ciEnvironment.hasNextSupport\n ? ['**/node_modules/sharp/**/*', '**/@img/sharp-libvips*/**/*']\n : []),\n ].filter(nonNullable)\n const serverIgnoreFn = makeIgnoreFn(serverIgnores)\n\n const minimalServerIgnores = [\n ...serverIgnores,\n '**/next/dist/compiled/edge-runtime/**/*',\n '**/next/dist/server/web/sandbox/**/*',\n '**/next/dist/server/post-process.js',\n ]\n const minimalServerIgnoreFn = makeIgnoreFn(minimalServerIgnores)\n\n const routesIgnores = [\n ...sharedIgnores,\n // server chunks are provided via next-trace-entrypoints-plugin plugin\n // as otherwise all chunks are traced here and included for all pages\n // whether they are needed or not\n '**/.next/server/chunks/**',\n '**/next/dist/server/optimize-amp.js',\n '**/next/dist/server/post-process.js',\n ].filter(nonNullable)\n\n const routeIgnoreFn = makeIgnoreFn(routesIgnores)\n\n const serverTracedFiles = new Set<string>()\n const minimalServerTracedFiles = new Set<string>()\n\n function addToTracedFiles(base: string, file: string, dest: Set<string>) {\n dest.add(\n path.relative(distDir, path.join(base, file)).replace(/\\\\/g, '/')\n )\n }\n\n if (isStandalone) {\n addToTracedFiles(\n '',\n require.resolve('next/dist/compiled/jest-worker/processChild'),\n serverTracedFiles\n )\n addToTracedFiles(\n '',\n require.resolve('next/dist/compiled/jest-worker/threadChild'),\n serverTracedFiles\n )\n }\n\n {\n const chunksToTrace: string[] = [\n ...(buildTraceContext?.chunksTrace?.action.input || []),\n ...serverEntries,\n ...minimalServerEntries,\n ]\n const result = await nodeFileTrace(chunksToTrace, {\n base: outputFileTracingRoot,\n processCwd: dir,\n mixedModules: true,\n async readFile(p) {\n try {\n return await fs.readFile(p, 'utf8')\n } catch (e) {\n if (isError(e) && (e.code === 'ENOENT' || e.code === 'EISDIR')) {\n // since tracing runs in parallel with static generation server\n // files might be removed from that step so tolerate ENOENT\n // errors gracefully\n return ''\n }\n throw e\n }\n },\n async readlink(p) {\n try {\n return await fs.readlink(p)\n } catch (e) {\n if (\n isError(e) &&\n (e.code === 'EINVAL' ||\n e.code === 'ENOENT' ||\n e.code === 'UNKNOWN')\n ) {\n return null\n }\n throw e\n }\n },\n async stat(p) {\n try {\n return await fs.stat(p)\n } catch (e) {\n if (isError(e) && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {\n return null\n }\n throw e\n }\n },\n // handle shared ignores at top-level as it\n // avoids over-tracing when we don't need to\n // and speeds up total trace time\n ignore(p) {\n if (sharedIgnoresFn(p)) {\n return true\n }\n\n // if a chunk is attempting to be traced that isn't\n // in our initial list we need to ignore it to prevent\n // over tracing as webpack needs to be the source of\n // truth for which chunks should be included for each entry\n if (\n p.includes('.next/server/chunks') &&\n !chunksToTrace.includes(path.join(outputFileTracingRoot, p))\n ) {\n return true\n }\n return false\n },\n })\n const reasons = result.reasons\n const fileList = result.fileList\n for (const file of result.esmFileList) {\n fileList.add(file)\n }\n\n const parentFilesMap = getFilesMapFromReasons(fileList, reasons)\n const cachedLookupIgnore = new Map<string, boolean>()\n const cachedLookupIgnoreMinimal = new Map<string, boolean>()\n\n for (const [entries, tracedFiles] of [\n [serverEntries, serverTracedFiles],\n [minimalServerEntries, minimalServerTracedFiles],\n ] as Array<[string[], Set<string>]>) {\n for (const file of entries) {\n const curFiles = [\n ...(parentFilesMap\n .get(path.relative(outputFileTracingRoot, file))\n ?.keys() || []),\n ]\n tracedFiles.add(path.relative(distDir, file).replace(/\\\\/g, '/'))\n\n for (const curFile of curFiles || []) {\n const filePath = path.join(outputFileTracingRoot, curFile)\n\n if (\n !shouldIgnore(\n curFile,\n tracedFiles === minimalServerTracedFiles\n ? minimalServerIgnoreFn\n : serverIgnoreFn,\n reasons,\n tracedFiles === minimalServerTracedFiles\n ? cachedLookupIgnoreMinimal\n : cachedLookupIgnore\n )\n ) {\n tracedFiles.add(\n path.relative(distDir, filePath).replace(/\\\\/g, '/')\n )\n }\n }\n }\n }\n\n const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}\n\n const cachedLookupIgnoreRoutes = new Map<string, boolean>()\n\n await Promise.all(\n [\n ...(entryNameFilesMap\n ? Object.entries(entryNameFilesMap)\n : new Map()),\n ].map(async ([entryName, entryNameFiles]) => {\n const isApp = entryName.startsWith('app/')\n const isPages = entryName.startsWith('pages/')\n let route = entryName\n if (isApp) {\n route = normalizeAppPath(route.substring('app'.length))\n }\n if (isPages) {\n route = normalizePagePath(route.substring('pages'.length))\n }\n\n // we don't need to trace for automatically statically optimized\n // pages as they don't have server bundles, note there is\n // the caveat with flying shuttle mode as it needs this for\n // detecting changed entries\n if (staticPages.includes(route)) {\n return\n }\n const entryOutputPath = path.join(\n distDir,\n 'server',\n `${entryName}.js`\n )\n const traceOutputPath = `${entryOutputPath}.nft.json`\n const existingTrace = JSON.parse(\n await fs.readFile(traceOutputPath, 'utf8')\n ) as {\n version: number\n files: string[]\n fileHashes: Record<string, string>\n }\n const traceOutputDir = path.dirname(traceOutputPath)\n const curTracedFiles = new Set<string>()\n\n for (const file of [...entryNameFiles, entryOutputPath]) {\n const curFiles = [\n ...(parentFilesMap\n .get(path.relative(outputFileTracingRoot, file))\n ?.keys() || []),\n ]\n for (const curFile of curFiles || []) {\n if (\n !shouldIgnore(\n curFile,\n routeIgnoreFn,\n reasons,\n cachedLookupIgnoreRoutes\n )\n ) {\n const filePath = path.join(outputFileTracingRoot, curFile)\n const outputFile = path\n .relative(traceOutputDir, filePath)\n .replace(/\\\\/g, '/')\n curTracedFiles.add(outputFile)\n }\n }\n }\n\n for (const file of existingTrace.files || []) {\n curTracedFiles.add(file)\n }\n\n await fs.writeFile(\n traceOutputPath,\n JSON.stringify({\n ...existingTrace,\n files: [...curTracedFiles].sort(),\n })\n )\n })\n )\n }\n\n const moduleTypes = ['app-page', 'pages']\n\n for (const type of moduleTypes) {\n const modulePath = require.resolve(\n `next/dist/server/route-modules/${type}/module.compiled`\n )\n const relativeModulePath = path.relative(root, modulePath)\n\n const contextDir = path.join(\n path.dirname(modulePath),\n 'vendored',\n 'contexts'\n )\n\n for (const item of await fs.readdir(contextDir)) {\n const itemPath = path.relative(root, path.join(contextDir, item))\n if (!serverIgnoreFn(itemPath)) {\n addToTracedFiles(root, itemPath, serverTracedFiles)\n addToTracedFiles(root, itemPath, minimalServerTracedFiles)\n }\n }\n addToTracedFiles(root, relativeModulePath, serverTracedFiles)\n addToTracedFiles(root, relativeModulePath, minimalServerTracedFiles)\n }\n\n await Promise.all([\n fs.writeFile(\n nextServerTraceOutput,\n JSON.stringify({\n version: 1,\n files: Array.from(serverTracedFiles),\n } as {\n version: number\n files: string[]\n })\n ),\n fs.writeFile(\n nextMinimalTraceOutput,\n JSON.stringify({\n version: 1,\n files: Array.from(minimalServerTracedFiles),\n } as {\n version: number\n files: string[]\n })\n ),\n ])\n })\n\n // apply outputFileTracingIncludes/outputFileTracingExcludes after runTurbotrace\n const includeExcludeSpan = nextBuildSpan.traceChild('apply-include-excludes')\n await includeExcludeSpan.traceAsyncFn(async () => {\n const globOrig =\n require('next/dist/compiled/glob') as typeof import('next/dist/compiled/glob')\n const glob = (pattern: string): Promise<string[]> => {\n return new Promise((resolve, reject) => {\n globOrig(\n pattern,\n { cwd: dir, nodir: true, dot: true },\n (err, files) => {\n if (err) {\n return reject(err)\n }\n resolve(files)\n }\n )\n })\n }\n\n const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}\n\n await Promise.all(\n [\n ...(entryNameFilesMap ? Object.entries(entryNameFilesMap) : new Map()),\n ].map(async ([entryName]) => {\n const isApp = entryName.startsWith('app/')\n const isPages = entryName.startsWith('pages/')\n let route = entryName\n if (isApp) {\n route = normalizeAppPath(entryName)\n }\n if (isPages) {\n route = normalizePagePath(entryName)\n }\n\n if (staticPages.includes(route)) {\n return\n }\n\n // edge routes have no trace files\n if (edgeRuntimeRoutes.hasOwnProperty(route)) {\n return\n }\n\n const combinedIncludes = new Set<string>()\n const combinedExcludes = new Set<string>()\n for (const curGlob of includeGlobKeys) {\n const isMatch = picomatch(curGlob, { dot: true, contains: true })\n if (isMatch(route)) {\n for (const include of outputFileTracingIncludes[curGlob]) {\n combinedIncludes.add(include.replace(/\\\\/g, '/'))\n }\n }\n }\n\n for (const curGlob of excludeGlobKeys) {\n const isMatch = picomatch(curGlob, { dot: true, contains: true })\n if (isMatch(route)) {\n for (const exclude of outputFileTracingExcludes[curGlob]) {\n combinedExcludes.add(exclude)\n }\n }\n }\n\n if (!combinedIncludes?.size && !combinedExcludes?.size) {\n return\n }\n\n const traceFile = path.join(\n distDir,\n `server`,\n `${entryName}.js.nft.json`\n )\n const pageDir = path.dirname(traceFile)\n const traceContent = JSON.parse(await fs.readFile(traceFile, 'utf8'))\n const includes: string[] = []\n const resolvedTraceIncludes = new Map<string, string[]>()\n\n if (combinedIncludes?.size) {\n await Promise.all(\n [...combinedIncludes].map(async (includeGlob) => {\n const results = await glob(includeGlob)\n const resolvedInclude = resolvedTraceIncludes.get(\n includeGlob\n ) || [\n ...results.map((file) => {\n return path.relative(pageDir, path.join(dir, file))\n }),\n ]\n includes.push(...resolvedInclude)\n resolvedTraceIncludes.set(includeGlob, resolvedInclude)\n })\n )\n }\n const combined = new Set([...traceContent.files, ...includes])\n\n if (combinedExcludes?.size) {\n const resolvedGlobs = [...combinedExcludes].map((exclude) =>\n path.join(dir, exclude)\n )\n\n // pre compile before forEach\n const isMatch = picomatch(resolvedGlobs, {\n dot: true,\n contains: true,\n })\n\n combined.forEach((file) => {\n if (isMatch(path.join(pageDir, file))) {\n combined.delete(file)\n }\n })\n }\n\n // overwrite trace file with custom includes/excludes\n await fs.writeFile(\n traceFile,\n JSON.stringify({\n version: traceContent.version,\n files: [...combined],\n })\n )\n })\n )\n })\n\n debug(`finished build tracing ${Date.now() - startTime}ms`)\n}\n"],"names":["Span","TRACE_IGNORES","getFilesMapFromReasons","path","fs","nonNullable","ciEnvironment","debugOriginal","picomatch","defaultOverrides","nodeFileTrace","normalizePagePath","normalizeAppPath","isError","debug","shouldIgnore","file","serverIgnoreFn","reasons","cachedIgnoreFiles","children","Set","has","get","set","add","reason","parents","size","type","includes","allParentsIgnored","parent","values","collectBuildTraces","dir","config","distDir","edgeRuntimeRoutes","staticPages","nextBuildSpan","name","hasSsrAmpPages","buildTraceContext","outputFileTracingRoot","startTime","Date","now","outputFileTracingIncludes","outputFileTracingExcludes","excludeGlobKeys","Object","keys","includeGlobKeys","traceChild","isTurbotrace","traceAsyncFn","nextServerTraceOutput","join","nextMinimalTraceOutput","root","isStandalone","output","sharedEntriesSet","map","value","require","resolve","paths","cacheHandler","cacheHandlers","experimental","push","isAbsolute","handlerPath","serverEntries","filter","Boolean","minimalServerEntries","additionalIgnores","glob","forEach","exclude","makeIgnoreFn","ignores","isMatch","contains","dot","pathname","startsWith","sharedIgnores","hasNextSupport","sharedIgnoresFn","serverIgnores","minimalServerIgnores","minimalServerIgnoreFn","routesIgnores","routeIgnoreFn","serverTracedFiles","minimalServerTracedFiles","addToTracedFiles","base","dest","relative","replace","chunksToTrace","chunksTrace","action","input","result","processCwd","mixedModules","readFile","p","e","code","readlink","stat","ignore","fileList","esmFileList","parentFilesMap","cachedLookupIgnore","Map","cachedLookupIgnoreMinimal","entries","tracedFiles","curFiles","curFile","filePath","entryNameFilesMap","cachedLookupIgnoreRoutes","Promise","all","entryName","entryNameFiles","isApp","isPages","route","substring","length","entryOutputPath","traceOutputPath","existingTrace","JSON","parse","traceOutputDir","dirname","curTracedFiles","outputFile","files","writeFile","stringify","sort","moduleTypes","modulePath","relativeModulePath","contextDir","item","readdir","itemPath","version","Array","from","includeExcludeSpan","globOrig","pattern","reject","cwd","nodir","err","hasOwnProperty","combinedIncludes","combinedExcludes","curGlob","include","traceFile","pageDir","traceContent","resolvedTraceIncludes","includeGlob","results","resolvedInclude","combined","resolvedGlobs","delete"],"mappings":"AAAA,SAASA,IAAI,QAAQ,WAAU;AAG/B,SACEC,aAAa,EAEbC,sBAAsB,QACjB,kDAAiD;AAExD,OAAOC,UAAU,OAAM;AACvB,OAAOC,QAAQ,cAAa;AAC5B,SAASC,WAAW,QAAQ,sBAAqB;AACjD,YAAYC,mBAAmB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U,EAAE,CAAC;AAC5D"}
|
1
|
+
{"version":3,"sources":["../../src/build/collect-build-traces.ts"],"sourcesContent":["import { Span } from '../trace'\nimport type { NextConfigComplete } from '../server/config-shared'\n\nimport {\n TRACE_IGNORES,\n type BuildTraceContext,\n getFilesMapFromReasons,\n} from './webpack/plugins/next-trace-entrypoints-plugin'\n\nimport path from 'path'\nimport fs from 'fs/promises'\nimport { nonNullable } from '../lib/non-nullable'\nimport * as ciEnvironment from '../server/ci-info'\nimport debugOriginal from 'next/dist/compiled/debug'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport { defaultOverrides } from '../server/require-hook'\nimport { nodeFileTrace } from 'next/dist/compiled/@vercel/nft'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport isError from '../lib/is-error'\nimport type { NodeFileTraceReasons } from '@vercel/nft'\nimport type { RoutesUsingEdgeRuntime } from './utils'\n\nconst debug = debugOriginal('next:build:build-traces')\n\nfunction shouldIgnore(\n file: string,\n serverIgnoreFn: (file: string) => boolean,\n reasons: NodeFileTraceReasons,\n cachedIgnoreFiles: Map<string, boolean>,\n children: Set<string> = new Set()\n) {\n if (cachedIgnoreFiles.has(file)) {\n return cachedIgnoreFiles.get(file)\n }\n\n if (serverIgnoreFn(file)) {\n cachedIgnoreFiles.set(file, true)\n return true\n }\n children.add(file)\n\n const reason = reasons.get(file)\n if (!reason || reason.parents.size === 0 || reason.type.includes('initial')) {\n cachedIgnoreFiles.set(file, false)\n return false\n }\n\n // if all parents are ignored the child file\n // should be ignored as well\n let allParentsIgnored = true\n\n for (const parent of reason.parents.values()) {\n if (!children.has(parent)) {\n children.add(parent)\n if (\n !shouldIgnore(\n parent,\n serverIgnoreFn,\n reasons,\n cachedIgnoreFiles,\n children\n )\n ) {\n allParentsIgnored = false\n break\n }\n }\n }\n\n cachedIgnoreFiles.set(file, allParentsIgnored)\n return allParentsIgnored\n}\n\nexport async function collectBuildTraces({\n dir,\n config,\n distDir,\n edgeRuntimeRoutes,\n staticPages,\n nextBuildSpan = new Span({ name: 'build' }),\n hasSsrAmpPages,\n buildTraceContext,\n outputFileTracingRoot,\n}: {\n dir: string\n distDir: string\n staticPages: string[]\n hasSsrAmpPages: boolean\n outputFileTracingRoot: string\n // pageInfos is serialized when this function runs in a worker.\n edgeRuntimeRoutes: RoutesUsingEdgeRuntime\n nextBuildSpan?: Span\n config: NextConfigComplete\n buildTraceContext?: BuildTraceContext\n}) {\n const startTime = Date.now()\n debug('starting build traces')\n\n const { outputFileTracingIncludes = {}, outputFileTracingExcludes = {} } =\n config\n const excludeGlobKeys = Object.keys(outputFileTracingExcludes)\n const includeGlobKeys = Object.keys(outputFileTracingIncludes)\n\n await nextBuildSpan\n .traceChild('node-file-trace-build', {\n isTurbotrace: 'false', // TODO(arlyon): remove this\n })\n .traceAsyncFn(async () => {\n const nextServerTraceOutput = path.join(\n distDir,\n 'next-server.js.nft.json'\n )\n const nextMinimalTraceOutput = path.join(\n distDir,\n 'next-minimal-server.js.nft.json'\n )\n const root = outputFileTracingRoot\n\n // Under standalone mode, we need to trace the extra IPC server and\n // worker files.\n const isStandalone = config.output === 'standalone'\n const sharedEntriesSet = Object.keys(defaultOverrides).map((value) =>\n require.resolve(value, {\n paths: [require.resolve('next/dist/server/require-hook')],\n })\n )\n\n const { cacheHandler } = config\n const { cacheHandlers } = config.experimental\n\n // ensure we trace any dependencies needed for custom\n // incremental cache handler\n if (cacheHandler) {\n sharedEntriesSet.push(\n require.resolve(\n path.isAbsolute(cacheHandler)\n ? cacheHandler\n : path.join(dir, cacheHandler)\n )\n )\n }\n\n if (cacheHandlers) {\n for (const handlerPath of Object.values(cacheHandlers)) {\n if (handlerPath) {\n sharedEntriesSet.push(\n require.resolve(\n path.isAbsolute(handlerPath)\n ? handlerPath\n : path.join(dir, handlerPath)\n )\n )\n }\n }\n }\n\n const serverEntries = [\n ...sharedEntriesSet,\n ...(isStandalone\n ? [\n require.resolve('next/dist/server/lib/start-server'),\n require.resolve('next/dist/server/next'),\n require.resolve('next/dist/server/require-hook'),\n ]\n : []),\n require.resolve('next/dist/server/next-server'),\n ].filter(Boolean) as string[]\n\n const minimalServerEntries = [\n ...sharedEntriesSet,\n require.resolve('next/dist/compiled/next-server/server.runtime.prod'),\n ].filter(Boolean)\n\n const additionalIgnores = new Set<string>()\n\n for (const glob of excludeGlobKeys) {\n if (picomatch(glob)('next-server')) {\n outputFileTracingExcludes[glob].forEach((exclude) => {\n additionalIgnores.add(exclude)\n })\n }\n }\n\n const makeIgnoreFn = (ignores: string[]) => {\n // pre compile the ignore globs\n const isMatch = picomatch(ignores, {\n contains: true,\n dot: true,\n })\n\n return (pathname: string) => {\n if (path.isAbsolute(pathname) && !pathname.startsWith(root)) {\n return true\n }\n\n return isMatch(pathname)\n }\n }\n\n const sharedIgnores = [\n '**/next/dist/compiled/next-server/**/*.dev.js',\n ...(isStandalone ? [] : ['**/next/dist/compiled/jest-worker/**/*']),\n '**/next/dist/compiled/webpack/*',\n '**/node_modules/webpack5/**/*',\n '**/next/dist/server/lib/route-resolver*',\n 'next/dist/compiled/semver/semver/**/*.js',\n\n ...(ciEnvironment.hasNextSupport\n ? [\n // only ignore image-optimizer code when\n // this is being handled outside of next-server\n '**/next/dist/server/image-optimizer.js',\n ]\n : []),\n\n ...(!hasSsrAmpPages\n ? ['**/next/dist/compiled/@ampproject/toolbox-optimizer/**/*']\n : []),\n\n ...(isStandalone ? [] : TRACE_IGNORES),\n ...additionalIgnores,\n ]\n\n const sharedIgnoresFn = makeIgnoreFn(sharedIgnores)\n\n const serverIgnores = [\n ...sharedIgnores,\n '**/node_modules/react{,-dom,-dom-server-turbopack}/**/*.development.js',\n '**/*.d.ts',\n '**/*.map',\n '**/next/dist/pages/**/*',\n ...(ciEnvironment.hasNextSupport\n ? ['**/node_modules/sharp/**/*', '**/@img/sharp-libvips*/**/*']\n : []),\n ].filter(nonNullable)\n const serverIgnoreFn = makeIgnoreFn(serverIgnores)\n\n const minimalServerIgnores = [\n ...serverIgnores,\n '**/next/dist/compiled/edge-runtime/**/*',\n '**/next/dist/server/web/sandbox/**/*',\n '**/next/dist/server/post-process.js',\n ]\n const minimalServerIgnoreFn = makeIgnoreFn(minimalServerIgnores)\n\n const routesIgnores = [\n ...sharedIgnores,\n // server chunks are provided via next-trace-entrypoints-plugin plugin\n // as otherwise all chunks are traced here and included for all pages\n // whether they are needed or not\n '**/.next/server/chunks/**',\n '**/next/dist/server/optimize-amp.js',\n '**/next/dist/server/post-process.js',\n ].filter(nonNullable)\n\n const routeIgnoreFn = makeIgnoreFn(routesIgnores)\n\n const serverTracedFiles = new Set<string>()\n const minimalServerTracedFiles = new Set<string>()\n\n function addToTracedFiles(base: string, file: string, dest: Set<string>) {\n dest.add(\n path.relative(distDir, path.join(base, file)).replace(/\\\\/g, '/')\n )\n }\n\n if (isStandalone) {\n addToTracedFiles(\n '',\n require.resolve('next/dist/compiled/jest-worker/processChild'),\n serverTracedFiles\n )\n addToTracedFiles(\n '',\n require.resolve('next/dist/compiled/jest-worker/threadChild'),\n serverTracedFiles\n )\n }\n\n {\n const chunksToTrace: string[] = [\n ...(buildTraceContext?.chunksTrace?.action.input || []),\n ...serverEntries,\n ...minimalServerEntries,\n ]\n const result = await nodeFileTrace(chunksToTrace, {\n base: outputFileTracingRoot,\n processCwd: dir,\n mixedModules: true,\n async readFile(p) {\n try {\n return await fs.readFile(p, 'utf8')\n } catch (e) {\n if (isError(e) && (e.code === 'ENOENT' || e.code === 'EISDIR')) {\n // since tracing runs in parallel with static generation server\n // files might be removed from that step so tolerate ENOENT\n // errors gracefully\n return ''\n }\n throw e\n }\n },\n async readlink(p) {\n try {\n return await fs.readlink(p)\n } catch (e) {\n if (\n isError(e) &&\n (e.code === 'EINVAL' ||\n e.code === 'ENOENT' ||\n e.code === 'UNKNOWN')\n ) {\n return null\n }\n throw e\n }\n },\n async stat(p) {\n try {\n return await fs.stat(p)\n } catch (e) {\n if (isError(e) && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {\n return null\n }\n throw e\n }\n },\n // handle shared ignores at top-level as it\n // avoids over-tracing when we don't need to\n // and speeds up total trace time\n ignore(p) {\n if (sharedIgnoresFn(p)) {\n return true\n }\n\n // if a chunk is attempting to be traced that isn't\n // in our initial list we need to ignore it to prevent\n // over tracing as webpack needs to be the source of\n // truth for which chunks should be included for each entry\n if (\n p.includes('.next/server/chunks') &&\n !chunksToTrace.includes(path.join(outputFileTracingRoot, p))\n ) {\n return true\n }\n return false\n },\n })\n const reasons = result.reasons\n const fileList = result.fileList\n for (const file of result.esmFileList) {\n fileList.add(file)\n }\n\n const parentFilesMap = getFilesMapFromReasons(fileList, reasons)\n const cachedLookupIgnore = new Map<string, boolean>()\n const cachedLookupIgnoreMinimal = new Map<string, boolean>()\n\n for (const [entries, tracedFiles] of [\n [serverEntries, serverTracedFiles],\n [minimalServerEntries, minimalServerTracedFiles],\n ] as Array<[string[], Set<string>]>) {\n for (const file of entries) {\n const curFiles = [\n ...(parentFilesMap\n .get(path.relative(outputFileTracingRoot, file))\n ?.keys() || []),\n ]\n tracedFiles.add(path.relative(distDir, file).replace(/\\\\/g, '/'))\n\n for (const curFile of curFiles || []) {\n const filePath = path.join(outputFileTracingRoot, curFile)\n\n if (\n !shouldIgnore(\n curFile,\n tracedFiles === minimalServerTracedFiles\n ? minimalServerIgnoreFn\n : serverIgnoreFn,\n reasons,\n tracedFiles === minimalServerTracedFiles\n ? cachedLookupIgnoreMinimal\n : cachedLookupIgnore\n )\n ) {\n tracedFiles.add(\n path.relative(distDir, filePath).replace(/\\\\/g, '/')\n )\n }\n }\n }\n }\n\n const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}\n\n const cachedLookupIgnoreRoutes = new Map<string, boolean>()\n\n await Promise.all(\n [\n ...(entryNameFilesMap\n ? Object.entries(entryNameFilesMap)\n : new Map()),\n ].map(async ([entryName, entryNameFiles]) => {\n const isApp = entryName.startsWith('app/')\n const isPages = entryName.startsWith('pages/')\n let route = entryName\n if (isApp) {\n route = normalizeAppPath(route.substring('app'.length))\n }\n if (isPages) {\n route = normalizePagePath(route.substring('pages'.length))\n }\n\n // we don't need to trace for automatically statically optimized\n // pages as they don't have server bundles, note there is\n // the caveat with flying shuttle mode as it needs this for\n // detecting changed entries\n if (staticPages.includes(route)) {\n return\n }\n const entryOutputPath = path.join(\n distDir,\n 'server',\n `${entryName}.js`\n )\n const traceOutputPath = `${entryOutputPath}.nft.json`\n const existingTrace = JSON.parse(\n await fs.readFile(traceOutputPath, 'utf8')\n ) as {\n version: number\n files: string[]\n fileHashes: Record<string, string>\n }\n const traceOutputDir = path.dirname(traceOutputPath)\n const curTracedFiles = new Set<string>()\n\n for (const file of [...entryNameFiles, entryOutputPath]) {\n const curFiles = [\n ...(parentFilesMap\n .get(path.relative(outputFileTracingRoot, file))\n ?.keys() || []),\n ]\n for (const curFile of curFiles || []) {\n if (\n !shouldIgnore(\n curFile,\n routeIgnoreFn,\n reasons,\n cachedLookupIgnoreRoutes\n )\n ) {\n const filePath = path.join(outputFileTracingRoot, curFile)\n const outputFile = path\n .relative(traceOutputDir, filePath)\n .replace(/\\\\/g, '/')\n curTracedFiles.add(outputFile)\n }\n }\n }\n\n for (const file of existingTrace.files || []) {\n curTracedFiles.add(file)\n }\n\n await fs.writeFile(\n traceOutputPath,\n JSON.stringify({\n ...existingTrace,\n files: [...curTracedFiles].sort(),\n })\n )\n })\n )\n }\n\n const moduleTypes = ['app-page', 'pages']\n\n for (const type of moduleTypes) {\n const modulePath = require.resolve(\n `next/dist/server/route-modules/${type}/module.compiled`\n )\n const relativeModulePath = path.relative(root, modulePath)\n\n const contextDir = path.join(\n path.dirname(modulePath),\n 'vendored',\n 'contexts'\n )\n\n for (const item of await fs.readdir(contextDir)) {\n const itemPath = path.relative(root, path.join(contextDir, item))\n if (!serverIgnoreFn(itemPath)) {\n addToTracedFiles(root, itemPath, serverTracedFiles)\n addToTracedFiles(root, itemPath, minimalServerTracedFiles)\n }\n }\n addToTracedFiles(root, relativeModulePath, serverTracedFiles)\n addToTracedFiles(root, relativeModulePath, minimalServerTracedFiles)\n }\n\n await Promise.all([\n fs.writeFile(\n nextServerTraceOutput,\n JSON.stringify({\n version: 1,\n files: Array.from(serverTracedFiles),\n } as {\n version: number\n files: string[]\n })\n ),\n fs.writeFile(\n nextMinimalTraceOutput,\n JSON.stringify({\n version: 1,\n files: Array.from(minimalServerTracedFiles),\n } as {\n version: number\n files: string[]\n })\n ),\n ])\n })\n\n // apply outputFileTracingIncludes/outputFileTracingExcludes after runTurbotrace\n const includeExcludeSpan = nextBuildSpan.traceChild('apply-include-excludes')\n await includeExcludeSpan.traceAsyncFn(async () => {\n const globOrig =\n require('next/dist/compiled/glob') as typeof import('next/dist/compiled/glob')\n const glob = (pattern: string): Promise<string[]> => {\n return new Promise((resolve, reject) => {\n globOrig(\n pattern,\n { cwd: dir, nodir: true, dot: true },\n (err, files) => {\n if (err) {\n return reject(err)\n }\n resolve(files)\n }\n )\n })\n }\n\n const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}\n\n await Promise.all(\n [\n ...(entryNameFilesMap ? Object.entries(entryNameFilesMap) : new Map()),\n ].map(async ([entryName]) => {\n const isApp = entryName.startsWith('app/')\n const isPages = entryName.startsWith('pages/')\n let route = entryName\n if (isApp) {\n route = normalizeAppPath(entryName)\n }\n if (isPages) {\n route = normalizePagePath(entryName)\n }\n\n if (staticPages.includes(route)) {\n return\n }\n\n // edge routes have no trace files\n if (edgeRuntimeRoutes.hasOwnProperty(route)) {\n return\n }\n\n const combinedIncludes = new Set<string>()\n const combinedExcludes = new Set<string>()\n for (const curGlob of includeGlobKeys) {\n const isMatch = picomatch(curGlob, { dot: true, contains: true })\n if (isMatch(route)) {\n for (const include of outputFileTracingIncludes[curGlob]) {\n combinedIncludes.add(include.replace(/\\\\/g, '/'))\n }\n }\n }\n\n for (const curGlob of excludeGlobKeys) {\n const isMatch = picomatch(curGlob, { dot: true, contains: true })\n if (isMatch(route)) {\n for (const exclude of outputFileTracingExcludes[curGlob]) {\n combinedExcludes.add(exclude)\n }\n }\n }\n\n if (!combinedIncludes?.size && !combinedExcludes?.size) {\n return\n }\n\n const traceFile = path.join(\n distDir,\n `server`,\n `${entryName}.js.nft.json`\n )\n const pageDir = path.dirname(traceFile)\n const traceContent = JSON.parse(await fs.readFile(traceFile, 'utf8'))\n const includes: string[] = []\n const resolvedTraceIncludes = new Map<string, string[]>()\n\n if (combinedIncludes?.size) {\n await Promise.all(\n [...combinedIncludes].map(async (includeGlob) => {\n const results = await glob(includeGlob)\n const resolvedInclude = resolvedTraceIncludes.get(\n includeGlob\n ) || [\n ...results.map((file) => {\n return path.relative(pageDir, path.join(dir, file))\n }),\n ]\n includes.push(...resolvedInclude)\n resolvedTraceIncludes.set(includeGlob, resolvedInclude)\n })\n )\n }\n const combined = new Set([...traceContent.files, ...includes])\n\n if (combinedExcludes?.size) {\n const resolvedGlobs = [...combinedExcludes].map((exclude) =>\n path.join(dir, exclude)\n )\n\n // pre compile before forEach\n const isMatch = picomatch(resolvedGlobs, {\n dot: true,\n contains: true,\n })\n\n combined.forEach((file) => {\n if (isMatch(path.join(pageDir, file))) {\n combined.delete(file)\n }\n })\n }\n\n // overwrite trace file with custom includes/excludes\n await fs.writeFile(\n traceFile,\n JSON.stringify({\n version: traceContent.version,\n files: [...combined],\n })\n )\n })\n )\n })\n\n debug(`finished build tracing ${Date.now() - startTime}ms`)\n}\n"],"names":["Span","TRACE_IGNORES","getFilesMapFromReasons","path","fs","nonNullable","ciEnvironment","debugOriginal","picomatch","defaultOverrides","nodeFileTrace","normalizePagePath","normalizeAppPath","isError","debug","shouldIgnore","file","serverIgnoreFn","reasons","cachedIgnoreFiles","children","Set","has","get","set","add","reason","parents","size","type","includes","allParentsIgnored","parent","values","collectBuildTraces","dir","config","distDir","edgeRuntimeRoutes","staticPages","nextBuildSpan","name","hasSsrAmpPages","buildTraceContext","outputFileTracingRoot","startTime","Date","now","outputFileTracingIncludes","outputFileTracingExcludes","excludeGlobKeys","Object","keys","includeGlobKeys","traceChild","isTurbotrace","traceAsyncFn","nextServerTraceOutput","join","nextMinimalTraceOutput","root","isStandalone","output","sharedEntriesSet","map","value","require","resolve","paths","cacheHandler","cacheHandlers","experimental","push","isAbsolute","handlerPath","serverEntries","filter","Boolean","minimalServerEntries","additionalIgnores","glob","forEach","exclude","makeIgnoreFn","ignores","isMatch","contains","dot","pathname","startsWith","sharedIgnores","hasNextSupport","sharedIgnoresFn","serverIgnores","minimalServerIgnores","minimalServerIgnoreFn","routesIgnores","routeIgnoreFn","serverTracedFiles","minimalServerTracedFiles","addToTracedFiles","base","dest","relative","replace","chunksToTrace","chunksTrace","action","input","result","processCwd","mixedModules","readFile","p","e","code","readlink","stat","ignore","fileList","esmFileList","parentFilesMap","cachedLookupIgnore","Map","cachedLookupIgnoreMinimal","entries","tracedFiles","curFiles","curFile","filePath","entryNameFilesMap","cachedLookupIgnoreRoutes","Promise","all","entryName","entryNameFiles","isApp","isPages","route","substring","length","entryOutputPath","traceOutputPath","existingTrace","JSON","parse","traceOutputDir","dirname","curTracedFiles","outputFile","files","writeFile","stringify","sort","moduleTypes","modulePath","relativeModulePath","contextDir","item","readdir","itemPath","version","Array","from","includeExcludeSpan","globOrig","pattern","reject","cwd","nodir","err","hasOwnProperty","combinedIncludes","combinedExcludes","curGlob","include","traceFile","pageDir","traceContent","resolvedTraceIncludes","includeGlob","results","resolvedInclude","combined","resolvedGlobs","delete"],"mappings":"AAAA,SAASA,IAAI,QAAQ,WAAU;AAG/B,SACEC,aAAa,EAEbC,sBAAsB,QACjB,kDAAiD;AAExD,OAAOC,UAAU,OAAM;AACvB,OAAOC,QAAQ,cAAa;AAC5B,SAASC,WAAW,QAAQ,sBAAqB;AACjD,YAAYC,mBAAmB,oBAAmB;AAClD,OAAOC,mBAAmB,2BAA0B;AACpD,OAAOC,eAAe,+BAA8B;AACpD,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,aAAa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ir
|
78
78
|
} : {},
|
79
79
|
[ROOT_DIR_ALIAS]: dir,
|
80
|
+
...isClient ? {
|
81
|
+
'private-next-instrumentation-client': [
|
82
|
+
path.join(dir, 'src', 'instrumentation-client'),
|
83
|
+
path.join(dir, 'instrumentation-client'),
|
84
|
+
'private-next-empty-module'
|
85
|
+
],
|
86
|
+
// disable typechecker, webpack5 allows aliases to be set to false to create a no-op module
|
87
|
+
'private-next-empty-module': false
|
88
|
+
} : {},
|
80
89
|
[DOT_NEXT_ALIAS]: distDir,
|
81
90
|
...isClient || isEdgeServer ? getOptimizedModuleAliases() : {},
|
82
91
|
...reactProductionProfiling ? getReactProfilingInProduction() : {},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/build/create-compiler-aliases.ts"],"sourcesContent":["import path from 'path'\nimport * as React from 'react'\nimport {\n DOT_NEXT_ALIAS,\n PAGES_DIR_ALIAS,\n ROOT_DIR_ALIAS,\n APP_DIR_ALIAS,\n RSC_ACTION_PROXY_ALIAS,\n RSC_ACTION_CLIENT_WRAPPER_ALIAS,\n RSC_ACTION_VALIDATE_ALIAS,\n RSC_ACTION_ENCRYPTION_ALIAS,\n RSC_CACHE_WRAPPER_ALIAS,\n type WebpackLayerName,\n} from '../lib/constants'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport { defaultOverrides } from '../server/require-hook'\nimport { hasExternalOtelApiPackage } from './webpack-config'\nimport { NEXT_PROJECT_ROOT } from './next-dir-paths'\nimport { WEBPACK_LAYERS } from '../lib/constants'\nimport { isWebpackServerOnlyLayer } from './utils'\n\ninterface CompilerAliases {\n [alias: string]: string | string[]\n}\n\nconst isReact19 = typeof React.use === 'function'\n\nexport function createWebpackAliases({\n distDir,\n isClient,\n isEdgeServer,\n isNodeServer,\n dev,\n config,\n pagesDir,\n appDir,\n dir,\n reactProductionProfiling,\n hasRewrites,\n}: {\n distDir: string\n isClient: boolean\n isEdgeServer: boolean\n isNodeServer: boolean\n dev: boolean\n config: NextConfigComplete\n pagesDir: string | undefined\n appDir: string | undefined\n dir: string\n reactProductionProfiling: boolean\n hasRewrites: boolean\n}): CompilerAliases {\n const pageExtensions = config.pageExtensions\n const clientResolveRewrites = require.resolve(\n '../shared/lib/router/utils/resolve-rewrites'\n )\n const customAppAliases: CompilerAliases = {}\n const customDocumentAliases: CompilerAliases = {}\n\n // tell webpack where to look for _app and _document\n // using aliases to allow falling back to the default\n // version when removed or not present\n if (dev) {\n const nextDistPath = 'next/dist/' + (isEdgeServer ? 'esm/' : '')\n customAppAliases[`${PAGES_DIR_ALIAS}/_app`] = [\n ...(pagesDir\n ? pageExtensions.reduce((prev, ext) => {\n prev.push(path.join(pagesDir, `_app.${ext}`))\n return prev\n }, [] as string[])\n : []),\n `${nextDistPath}pages/_app.js`,\n ]\n customAppAliases[`${PAGES_DIR_ALIAS}/_error`] = [\n ...(pagesDir\n ? pageExtensions.reduce((prev, ext) => {\n prev.push(path.join(pagesDir, `_error.${ext}`))\n return prev\n }, [] as string[])\n : []),\n `${nextDistPath}pages/_error.js`,\n ]\n customDocumentAliases[`${PAGES_DIR_ALIAS}/_document`] = [\n ...(pagesDir\n ? pageExtensions.reduce((prev, ext) => {\n prev.push(path.join(pagesDir, `_document.${ext}`))\n return prev\n }, [] as string[])\n : []),\n `${nextDistPath}pages/_document.js`,\n ]\n }\n\n return {\n '@vercel/og$': 'next/dist/server/og/image-response',\n\n // Avoid bundling both entrypoints in React 19 when we just need one.\n // Also avoids bundler warnings in React 18 where react-dom/server.edge doesn't exist.\n 'next/dist/server/ReactDOMServerPages': isReact19\n ? 'react-dom/server.edge'\n : 'react-dom/server.browser',\n\n // Alias next/dist imports to next/dist/esm assets,\n // let this alias hit before `next` alias.\n ...(isEdgeServer\n ? {\n 'next/dist/api': 'next/dist/esm/api',\n 'next/dist/build': 'next/dist/esm/build',\n 'next/dist/client': 'next/dist/esm/client',\n 'next/dist/shared': 'next/dist/esm/shared',\n 'next/dist/pages': 'next/dist/esm/pages',\n 'next/dist/lib': 'next/dist/esm/lib',\n 'next/dist/server': 'next/dist/esm/server',\n\n ...createNextApiEsmAliases(),\n }\n : undefined),\n\n // For RSC server bundle\n ...(!hasExternalOtelApiPackage() && {\n '@opentelemetry/api': 'next/dist/compiled/@opentelemetry/api',\n }),\n\n ...(config.images.loaderFile\n ? {\n 'next/dist/shared/lib/image-loader': config.images.loaderFile,\n ...(isEdgeServer && {\n 'next/dist/esm/shared/lib/image-loader': config.images.loaderFile,\n }),\n }\n : undefined),\n\n 'styled-jsx/style$': defaultOverrides['styled-jsx/style'],\n 'styled-jsx$': defaultOverrides['styled-jsx'],\n\n ...customAppAliases,\n ...customDocumentAliases,\n\n ...(pagesDir ? { [PAGES_DIR_ALIAS]: pagesDir } : {}),\n ...(appDir ? { [APP_DIR_ALIAS]: appDir } : {}),\n [ROOT_DIR_ALIAS]: dir,\n [DOT_NEXT_ALIAS]: distDir,\n ...(isClient || isEdgeServer ? getOptimizedModuleAliases() : {}),\n ...(reactProductionProfiling ? getReactProfilingInProduction() : {}),\n\n // For Node server, we need to re-alias the package imports to prefer to\n // resolve to the ESM export.\n ...(isNodeServer\n ? getBarrelOptimizationAliases(\n config.experimental.optimizePackageImports || []\n )\n : {}),\n\n [RSC_ACTION_VALIDATE_ALIAS]:\n 'next/dist/build/webpack/loaders/next-flight-loader/action-validate',\n\n [RSC_ACTION_CLIENT_WRAPPER_ALIAS]:\n 'next/dist/build/webpack/loaders/next-flight-loader/action-client-wrapper',\n\n [RSC_ACTION_PROXY_ALIAS]:\n 'next/dist/build/webpack/loaders/next-flight-loader/server-reference',\n\n [RSC_ACTION_ENCRYPTION_ALIAS]: 'next/dist/server/app-render/encryption',\n\n [RSC_CACHE_WRAPPER_ALIAS]:\n 'next/dist/build/webpack/loaders/next-flight-loader/cache-wrapper',\n\n ...(isClient || isEdgeServer\n ? {\n [clientResolveRewrites]: hasRewrites\n ? clientResolveRewrites\n : // With webpack 5 an alias can be pointed to false to noop\n false,\n }\n : {}),\n\n '@swc/helpers/_': path.join(\n path.dirname(require.resolve('@swc/helpers/package.json')),\n '_'\n ),\n\n setimmediate: 'next/dist/compiled/setimmediate',\n }\n}\n\nexport function createServerOnlyClientOnlyAliases(\n isServer: boolean\n): CompilerAliases {\n return isServer\n ? {\n 'server-only$': 'next/dist/compiled/server-only/empty',\n 'client-only$': 'next/dist/compiled/client-only/error',\n 'next/dist/compiled/server-only$':\n 'next/dist/compiled/server-only/empty',\n 'next/dist/compiled/client-only$':\n 'next/dist/compiled/client-only/error',\n }\n : {\n 'server-only$': 'next/dist/compiled/server-only/index',\n 'client-only$': 'next/dist/compiled/client-only/index',\n 'next/dist/compiled/client-only$':\n 'next/dist/compiled/client-only/index',\n 'next/dist/compiled/server-only':\n 'next/dist/compiled/server-only/index',\n }\n}\n\nexport function createNextApiEsmAliases() {\n const mapping = {\n head: 'next/dist/api/head',\n image: 'next/dist/api/image',\n constants: 'next/dist/api/constants',\n router: 'next/dist/api/router',\n dynamic: 'next/dist/api/dynamic',\n script: 'next/dist/api/script',\n link: 'next/dist/api/link',\n form: 'next/dist/api/form',\n navigation: 'next/dist/api/navigation',\n headers: 'next/dist/api/headers',\n og: 'next/dist/api/og',\n server: 'next/dist/api/server',\n // pages api\n document: 'next/dist/api/document',\n app: 'next/dist/api/app',\n }\n const aliasMap: Record<string, string> = {}\n // Handle fully specified imports like `next/image.js`\n for (const [key, value] of Object.entries(mapping)) {\n const nextApiFilePath = path.join(NEXT_PROJECT_ROOT, key)\n aliasMap[nextApiFilePath + '.js'] = value\n }\n\n return aliasMap\n}\n\nexport function createAppRouterApiAliases(isServerOnlyLayer: boolean) {\n const mapping: Record<string, string> = {\n head: 'next/dist/client/components/noop-head',\n dynamic: 'next/dist/api/app-dynamic',\n link: 'next/dist/client/app-dir/link',\n form: 'next/dist/client/app-dir/form',\n }\n\n if (isServerOnlyLayer) {\n mapping['navigation'] = 'next/dist/api/navigation.react-server'\n }\n\n const aliasMap: Record<string, string> = {}\n for (const [key, value] of Object.entries(mapping)) {\n const nextApiFilePath = path.join(NEXT_PROJECT_ROOT, key)\n aliasMap[nextApiFilePath + '.js'] = value\n }\n return aliasMap\n}\n\nexport function createRSCAliases(\n bundledReactChannel: string,\n {\n layer,\n isEdgeServer,\n reactProductionProfiling,\n }: {\n layer: WebpackLayerName\n isEdgeServer: boolean\n reactProductionProfiling: boolean\n }\n): CompilerAliases {\n const isServerOnlyLayer = isWebpackServerOnlyLayer(layer)\n // For middleware, instrumentation layers, treat them as rsc layer.\n // Since we only built the runtime package for rsc, convert everything to rsc\n // to ensure the runtime modules path existed.\n if (isServerOnlyLayer) {\n layer = WEBPACK_LAYERS.reactServerComponents\n }\n\n let alias: Record<string, string> = {\n react$: `next/dist/compiled/react${bundledReactChannel}`,\n 'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}`,\n 'react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime`,\n 'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime`,\n 'react/compiler-runtime$': `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,\n 'react-dom/client$': `next/dist/compiled/react-dom${bundledReactChannel}/client`,\n 'react-dom/server$': `next/dist/compiled/react-dom${bundledReactChannel}/server`,\n 'react-dom/server.browser$': `next/dist/compiled/react-dom${bundledReactChannel}/server.browser`,\n 'react-dom/static$': `next/dist/compiled/react-dom${bundledReactChannel}/static`,\n 'react-dom/static.edge$': `next/dist/compiled/react-dom${bundledReactChannel}/static.edge`,\n 'react-dom/static.browser$': `next/dist/compiled/react-dom${bundledReactChannel}/static.browser`,\n // optimizations to ignore the legacy build of react-dom/server in `server.edge` build\n 'react-dom/server.edge$': `next/dist/build/webpack/alias/react-dom-server-edge${bundledReactChannel}.js`,\n // react-server-dom-webpack alias\n 'react-server-dom-webpack/client$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/client`,\n 'react-server-dom-webpack/client.edge$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/client.edge`,\n 'react-server-dom-webpack/server.edge$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/server.edge`,\n 'react-server-dom-webpack/server.node$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/server.node`,\n 'react-server-dom-webpack/static.edge$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/static.edge`,\n }\n\n if (!isEdgeServer) {\n if (layer === WEBPACK_LAYERS.serverSideRendering) {\n alias = Object.assign(alias, {\n 'react/jsx-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-jsx-runtime`,\n 'react/jsx-dev-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-jsx-dev-runtime`,\n 'react/compiler-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-compiler-runtime`,\n react$: `next/dist/server/route-modules/app-page/vendored/${layer}/react`,\n 'react-dom$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-dom`,\n 'react-server-dom-webpack/client.edge$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-client-edge`,\n })\n } else if (layer === WEBPACK_LAYERS.reactServerComponents) {\n alias = Object.assign(alias, {\n 'react/jsx-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-jsx-runtime`,\n 'react/jsx-dev-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-jsx-dev-runtime`,\n 'react/compiler-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-compiler-runtime`,\n react$: `next/dist/server/route-modules/app-page/vendored/${layer}/react`,\n 'react-dom$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-dom`,\n 'react-server-dom-webpack/server.edge$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-server-edge`,\n 'react-server-dom-webpack/server.node$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-server-node`,\n 'react-server-dom-webpack/static.edge$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-static-edge`,\n })\n }\n }\n\n if (isEdgeServer) {\n if (layer === WEBPACK_LAYERS.reactServerComponents) {\n alias = Object.assign(alias, {\n react$: `next/dist/compiled/react${bundledReactChannel}/react.react-server`,\n 'next/dist/compiled/react$': `next/dist/compiled/react${bundledReactChannel}/react.react-server`,\n 'next/dist/compiled/react-experimental$': `next/dist/compiled/react-experimental/react.react-server`,\n 'react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`,\n 'react/compiler-runtime$': `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,\n 'next/dist/compiled/react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`,\n 'next/dist/compiled/react-experimental/jsx-runtime$': `next/dist/compiled/react-experimental/jsx-runtime.react-server`,\n 'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`,\n 'next/dist/compiled/react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`,\n 'next/dist/compiled/react-experimental/jsx-dev-runtime$': `next/dist/compiled/react-experimental/jsx-dev-runtime.react-server`,\n 'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`,\n 'next/dist/compiled/react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`,\n 'next/dist/compiled/react-dom-experimental$': `next/dist/compiled/react-dom-experimental/react-dom.react-server`,\n })\n }\n }\n\n if (reactProductionProfiling) {\n alias['react-dom/client$'] =\n `next/dist/compiled/react-dom${bundledReactChannel}/profiling`\n }\n\n alias[\n '@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts'\n ] = `next/dist/client/dev/noop-turbopack-hmr`\n\n return alias\n}\n\n// Insert aliases for Next.js stubs of fetch, object-assign, and url\n// Keep in sync with insert_optimized_module_aliases in import_map.rs\nexport function getOptimizedModuleAliases(): CompilerAliases {\n return {\n unfetch: require.resolve('next/dist/build/polyfills/fetch/index.js'),\n 'isomorphic-unfetch': require.resolve(\n 'next/dist/build/polyfills/fetch/index.js'\n ),\n 'whatwg-fetch': require.resolve(\n 'next/dist/build/polyfills/fetch/whatwg-fetch.js'\n ),\n 'object-assign': require.resolve(\n 'next/dist/build/polyfills/object-assign.js'\n ),\n 'object.assign/auto': require.resolve(\n 'next/dist/build/polyfills/object.assign/auto.js'\n ),\n 'object.assign/implementation': require.resolve(\n 'next/dist/build/polyfills/object.assign/implementation.js'\n ),\n 'object.assign/polyfill': require.resolve(\n 'next/dist/build/polyfills/object.assign/polyfill.js'\n ),\n 'object.assign/shim': require.resolve(\n 'next/dist/build/polyfills/object.assign/shim.js'\n ),\n url: require.resolve('next/dist/compiled/native-url'),\n }\n}\n\n// Alias these modules to be resolved with \"module\" if possible.\nfunction getBarrelOptimizationAliases(packages: string[]): CompilerAliases {\n const aliases: { [pkg: string]: string } = {}\n const mainFields = ['module', 'main']\n\n for (const pkg of packages) {\n try {\n const descriptionFileData = require(`${pkg}/package.json`)\n const descriptionFilePath = require.resolve(`${pkg}/package.json`)\n\n for (const field of mainFields) {\n if (descriptionFileData.hasOwnProperty(field)) {\n aliases[pkg + '$'] = path.join(\n path.dirname(descriptionFilePath),\n descriptionFileData[field]\n )\n break\n }\n }\n } catch {}\n }\n\n return aliases\n}\nfunction getReactProfilingInProduction(): CompilerAliases {\n return {\n 'react-dom/client$': 'react-dom/profiling',\n }\n}\n"],"names":["path","React","DOT_NEXT_ALIAS","PAGES_DIR_ALIAS","ROOT_DIR_ALIAS","APP_DIR_ALIAS","RSC_ACTION_PROXY_ALIAS","RSC_ACTION_CLIENT_WRAPPER_ALIAS","RSC_ACTION_VALIDATE_ALIAS","RSC_ACTION_ENCRYPTION_ALIAS","RSC_CACHE_WRAPPER_ALIAS","defaultOverrides","hasExternalOtelApiPackage","NEXT_PROJECT_ROOT","WEBPACK_LAYERS","isWebpackServerOnlyLayer","isReact19","use","createWebpackAliases","distDir","isClient","isEdgeServer","isNodeServer","dev","config","pagesDir","appDir","dir","reactProductionProfiling","hasRewrites","pageExtensions","clientResolveRewrites","require","resolve","customAppAliases","customDocumentAliases","nextDistPath","reduce","prev","ext","push","join","createNextApiEsmAliases","undefined","images","loaderFile","getOptimizedModuleAliases","getReactProfilingInProduction","getBarrelOptimizationAliases","experimental","optimizePackageImports","dirname","setimmediate","createServerOnlyClientOnlyAliases","isServer","mapping","head","image","constants","router","dynamic","script","link","form","navigation","headers","og","server","document","app","aliasMap","key","value","Object","entries","nextApiFilePath","createAppRouterApiAliases","isServerOnlyLayer","createRSCAliases","bundledReactChannel","layer","reactServerComponents","alias","react$","serverSideRendering","assign","unfetch","url","packages","aliases","mainFields","pkg","descriptionFileData","descriptionFilePath","field","hasOwnProperty"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,YAAYC,WAAW,QAAO;AAC9B,SACEC,cAAc,EACdC,eAAe,EACfC,cAAc,EACdC,aAAa,EACbC,sBAAsB,EACtBC,+BAA+B,EAC/BC,yBAAyB,EACzBC,2BAA2B,EAC3BC,uBAAuB,QAElB,mBAAkB;AAEzB,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,yBAAyB,QAAQ,mBAAkB;AAC5D,SAASC,iBAAiB,QAAQ,mBAAkB;AACpD,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SAASC,wBAAwB,QAAQ,UAAS;AAMlD,MAAMC,YAAY,OAAOf,MAAMgB,GAAG,KAAK;AAEvC,OAAO,SAASC,qBAAqB,EACnCC,OAAO,EACPC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,GAAG,EACHC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,GAAG,EACHC,wBAAwB,EACxBC,WAAW,EAaZ;IACC,MAAMC,iBAAiBN,OAAOM,cAAc;IAC5C,MAAMC,wBAAwBC,QAAQC,OAAO,CAC3C;IAEF,MAAMC,mBAAoC,CAAC;IAC3C,MAAMC,wBAAyC,CAAC;IAEhD,oDAAoD;IACpD,qDAAqD;IACrD,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C,KAAKmD,OAAO,CAAC0C,sBACbD,mBAAmB,CAACE,MAAM;oBAE5B;gBACF;YACF;QACF,EAAE,OAAM,CAAC;IACX;IAEA,OAAOL;AACT;AACA,SAAS1C;IACP,OAAO;QACL,qBAAqB;IACvB;AACF"}
|
1
|
+
{"version":3,"sources":["../../src/build/create-compiler-aliases.ts"],"sourcesContent":["import path from 'path'\nimport * as React from 'react'\nimport {\n DOT_NEXT_ALIAS,\n PAGES_DIR_ALIAS,\n ROOT_DIR_ALIAS,\n APP_DIR_ALIAS,\n RSC_ACTION_PROXY_ALIAS,\n RSC_ACTION_CLIENT_WRAPPER_ALIAS,\n RSC_ACTION_VALIDATE_ALIAS,\n RSC_ACTION_ENCRYPTION_ALIAS,\n RSC_CACHE_WRAPPER_ALIAS,\n type WebpackLayerName,\n} from '../lib/constants'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport { defaultOverrides } from '../server/require-hook'\nimport { hasExternalOtelApiPackage } from './webpack-config'\nimport { NEXT_PROJECT_ROOT } from './next-dir-paths'\nimport { WEBPACK_LAYERS } from '../lib/constants'\nimport { isWebpackServerOnlyLayer } from './utils'\n\ninterface CompilerAliases {\n [alias: string]: string | string[]\n}\n\nconst isReact19 = typeof React.use === 'function'\n\nexport function createWebpackAliases({\n distDir,\n isClient,\n isEdgeServer,\n isNodeServer,\n dev,\n config,\n pagesDir,\n appDir,\n dir,\n reactProductionProfiling,\n hasRewrites,\n}: {\n distDir: string\n isClient: boolean\n isEdgeServer: boolean\n isNodeServer: boolean\n dev: boolean\n config: NextConfigComplete\n pagesDir: string | undefined\n appDir: string | undefined\n dir: string\n reactProductionProfiling: boolean\n hasRewrites: boolean\n}): CompilerAliases {\n const pageExtensions = config.pageExtensions\n const clientResolveRewrites = require.resolve(\n '../shared/lib/router/utils/resolve-rewrites'\n )\n const customAppAliases: CompilerAliases = {}\n const customDocumentAliases: CompilerAliases = {}\n\n // tell webpack where to look for _app and _document\n // using aliases to allow falling back to the default\n // version when removed or not present\n if (dev) {\n const nextDistPath = 'next/dist/' + (isEdgeServer ? 'esm/' : '')\n customAppAliases[`${PAGES_DIR_ALIAS}/_app`] = [\n ...(pagesDir\n ? pageExtensions.reduce((prev, ext) => {\n prev.push(path.join(pagesDir, `_app.${ext}`))\n return prev\n }, [] as string[])\n : []),\n `${nextDistPath}pages/_app.js`,\n ]\n customAppAliases[`${PAGES_DIR_ALIAS}/_error`] = [\n ...(pagesDir\n ? pageExtensions.reduce((prev, ext) => {\n prev.push(path.join(pagesDir, `_error.${ext}`))\n return prev\n }, [] as string[])\n : []),\n `${nextDistPath}pages/_error.js`,\n ]\n customDocumentAliases[`${PAGES_DIR_ALIAS}/_document`] = [\n ...(pagesDir\n ? pageExtensions.reduce((prev, ext) => {\n prev.push(path.join(pagesDir, `_document.${ext}`))\n return prev\n }, [] as string[])\n : []),\n `${nextDistPath}pages/_document.js`,\n ]\n }\n\n return {\n '@vercel/og$': 'next/dist/server/og/image-response',\n\n // Avoid bundling both entrypoints in React 19 when we just need one.\n // Also avoids bundler warnings in React 18 where react-dom/server.edge doesn't exist.\n 'next/dist/server/ReactDOMServerPages': isReact19\n ? 'react-dom/server.edge'\n : 'react-dom/server.browser',\n\n // Alias next/dist imports to next/dist/esm assets,\n // let this alias hit before `next` alias.\n ...(isEdgeServer\n ? {\n 'next/dist/api': 'next/dist/esm/api',\n 'next/dist/build': 'next/dist/esm/build',\n 'next/dist/client': 'next/dist/esm/client',\n 'next/dist/shared': 'next/dist/esm/shared',\n 'next/dist/pages': 'next/dist/esm/pages',\n 'next/dist/lib': 'next/dist/esm/lib',\n 'next/dist/server': 'next/dist/esm/server',\n\n ...createNextApiEsmAliases(),\n }\n : undefined),\n\n // For RSC server bundle\n ...(!hasExternalOtelApiPackage() && {\n '@opentelemetry/api': 'next/dist/compiled/@opentelemetry/api',\n }),\n\n ...(config.images.loaderFile\n ? {\n 'next/dist/shared/lib/image-loader': config.images.loaderFile,\n ...(isEdgeServer && {\n 'next/dist/esm/shared/lib/image-loader': config.images.loaderFile,\n }),\n }\n : undefined),\n\n 'styled-jsx/style$': defaultOverrides['styled-jsx/style'],\n 'styled-jsx$': defaultOverrides['styled-jsx'],\n\n ...customAppAliases,\n ...customDocumentAliases,\n\n ...(pagesDir ? { [PAGES_DIR_ALIAS]: pagesDir } : {}),\n ...(appDir ? { [APP_DIR_ALIAS]: appDir } : {}),\n [ROOT_DIR_ALIAS]: dir,\n ...(isClient\n ? {\n 'private-next-instrumentation-client': [\n path.join(dir, 'src', 'instrumentation-client'),\n path.join(dir, 'instrumentation-client'),\n 'private-next-empty-module',\n ],\n\n // disable typechecker, webpack5 allows aliases to be set to false to create a no-op module\n 'private-next-empty-module': false as any,\n }\n : {}),\n\n [DOT_NEXT_ALIAS]: distDir,\n ...(isClient || isEdgeServer ? getOptimizedModuleAliases() : {}),\n ...(reactProductionProfiling ? getReactProfilingInProduction() : {}),\n\n // For Node server, we need to re-alias the package imports to prefer to\n // resolve to the ESM export.\n ...(isNodeServer\n ? getBarrelOptimizationAliases(\n config.experimental.optimizePackageImports || []\n )\n : {}),\n\n [RSC_ACTION_VALIDATE_ALIAS]:\n 'next/dist/build/webpack/loaders/next-flight-loader/action-validate',\n\n [RSC_ACTION_CLIENT_WRAPPER_ALIAS]:\n 'next/dist/build/webpack/loaders/next-flight-loader/action-client-wrapper',\n\n [RSC_ACTION_PROXY_ALIAS]:\n 'next/dist/build/webpack/loaders/next-flight-loader/server-reference',\n\n [RSC_ACTION_ENCRYPTION_ALIAS]: 'next/dist/server/app-render/encryption',\n\n [RSC_CACHE_WRAPPER_ALIAS]:\n 'next/dist/build/webpack/loaders/next-flight-loader/cache-wrapper',\n\n ...(isClient || isEdgeServer\n ? {\n [clientResolveRewrites]: hasRewrites\n ? clientResolveRewrites\n : // With webpack 5 an alias can be pointed to false to noop\n false,\n }\n : {}),\n\n '@swc/helpers/_': path.join(\n path.dirname(require.resolve('@swc/helpers/package.json')),\n '_'\n ),\n\n setimmediate: 'next/dist/compiled/setimmediate',\n }\n}\n\nexport function createServerOnlyClientOnlyAliases(\n isServer: boolean\n): CompilerAliases {\n return isServer\n ? {\n 'server-only$': 'next/dist/compiled/server-only/empty',\n 'client-only$': 'next/dist/compiled/client-only/error',\n 'next/dist/compiled/server-only$':\n 'next/dist/compiled/server-only/empty',\n 'next/dist/compiled/client-only$':\n 'next/dist/compiled/client-only/error',\n }\n : {\n 'server-only$': 'next/dist/compiled/server-only/index',\n 'client-only$': 'next/dist/compiled/client-only/index',\n 'next/dist/compiled/client-only$':\n 'next/dist/compiled/client-only/index',\n 'next/dist/compiled/server-only':\n 'next/dist/compiled/server-only/index',\n }\n}\n\nexport function createNextApiEsmAliases() {\n const mapping = {\n head: 'next/dist/api/head',\n image: 'next/dist/api/image',\n constants: 'next/dist/api/constants',\n router: 'next/dist/api/router',\n dynamic: 'next/dist/api/dynamic',\n script: 'next/dist/api/script',\n link: 'next/dist/api/link',\n form: 'next/dist/api/form',\n navigation: 'next/dist/api/navigation',\n headers: 'next/dist/api/headers',\n og: 'next/dist/api/og',\n server: 'next/dist/api/server',\n // pages api\n document: 'next/dist/api/document',\n app: 'next/dist/api/app',\n }\n const aliasMap: Record<string, string> = {}\n // Handle fully specified imports like `next/image.js`\n for (const [key, value] of Object.entries(mapping)) {\n const nextApiFilePath = path.join(NEXT_PROJECT_ROOT, key)\n aliasMap[nextApiFilePath + '.js'] = value\n }\n\n return aliasMap\n}\n\nexport function createAppRouterApiAliases(isServerOnlyLayer: boolean) {\n const mapping: Record<string, string> = {\n head: 'next/dist/client/components/noop-head',\n dynamic: 'next/dist/api/app-dynamic',\n link: 'next/dist/client/app-dir/link',\n form: 'next/dist/client/app-dir/form',\n }\n\n if (isServerOnlyLayer) {\n mapping['navigation'] = 'next/dist/api/navigation.react-server'\n }\n\n const aliasMap: Record<string, string> = {}\n for (const [key, value] of Object.entries(mapping)) {\n const nextApiFilePath = path.join(NEXT_PROJECT_ROOT, key)\n aliasMap[nextApiFilePath + '.js'] = value\n }\n return aliasMap\n}\n\nexport function createRSCAliases(\n bundledReactChannel: string,\n {\n layer,\n isEdgeServer,\n reactProductionProfiling,\n }: {\n layer: WebpackLayerName\n isEdgeServer: boolean\n reactProductionProfiling: boolean\n }\n): CompilerAliases {\n const isServerOnlyLayer = isWebpackServerOnlyLayer(layer)\n // For middleware, instrumentation layers, treat them as rsc layer.\n // Since we only built the runtime package for rsc, convert everything to rsc\n // to ensure the runtime modules path existed.\n if (isServerOnlyLayer) {\n layer = WEBPACK_LAYERS.reactServerComponents\n }\n\n let alias: Record<string, string> = {\n react$: `next/dist/compiled/react${bundledReactChannel}`,\n 'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}`,\n 'react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime`,\n 'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime`,\n 'react/compiler-runtime$': `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,\n 'react-dom/client$': `next/dist/compiled/react-dom${bundledReactChannel}/client`,\n 'react-dom/server$': `next/dist/compiled/react-dom${bundledReactChannel}/server`,\n 'react-dom/server.browser$': `next/dist/compiled/react-dom${bundledReactChannel}/server.browser`,\n 'react-dom/static$': `next/dist/compiled/react-dom${bundledReactChannel}/static`,\n 'react-dom/static.edge$': `next/dist/compiled/react-dom${bundledReactChannel}/static.edge`,\n 'react-dom/static.browser$': `next/dist/compiled/react-dom${bundledReactChannel}/static.browser`,\n // optimizations to ignore the legacy build of react-dom/server in `server.edge` build\n 'react-dom/server.edge$': `next/dist/build/webpack/alias/react-dom-server-edge${bundledReactChannel}.js`,\n // react-server-dom-webpack alias\n 'react-server-dom-webpack/client$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/client`,\n 'react-server-dom-webpack/client.edge$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/client.edge`,\n 'react-server-dom-webpack/server.edge$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/server.edge`,\n 'react-server-dom-webpack/server.node$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/server.node`,\n 'react-server-dom-webpack/static.edge$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/static.edge`,\n }\n\n if (!isEdgeServer) {\n if (layer === WEBPACK_LAYERS.serverSideRendering) {\n alias = Object.assign(alias, {\n 'react/jsx-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-jsx-runtime`,\n 'react/jsx-dev-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-jsx-dev-runtime`,\n 'react/compiler-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-compiler-runtime`,\n react$: `next/dist/server/route-modules/app-page/vendored/${layer}/react`,\n 'react-dom$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-dom`,\n 'react-server-dom-webpack/client.edge$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-client-edge`,\n })\n } else if (layer === WEBPACK_LAYERS.reactServerComponents) {\n alias = Object.assign(alias, {\n 'react/jsx-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-jsx-runtime`,\n 'react/jsx-dev-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-jsx-dev-runtime`,\n 'react/compiler-runtime$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-compiler-runtime`,\n react$: `next/dist/server/route-modules/app-page/vendored/${layer}/react`,\n 'react-dom$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-dom`,\n 'react-server-dom-webpack/server.edge$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-server-edge`,\n 'react-server-dom-webpack/server.node$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-server-node`,\n 'react-server-dom-webpack/static.edge$': `next/dist/server/route-modules/app-page/vendored/${layer}/react-server-dom-webpack-static-edge`,\n })\n }\n }\n\n if (isEdgeServer) {\n if (layer === WEBPACK_LAYERS.reactServerComponents) {\n alias = Object.assign(alias, {\n react$: `next/dist/compiled/react${bundledReactChannel}/react.react-server`,\n 'next/dist/compiled/react$': `next/dist/compiled/react${bundledReactChannel}/react.react-server`,\n 'next/dist/compiled/react-experimental$': `next/dist/compiled/react-experimental/react.react-server`,\n 'react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`,\n 'react/compiler-runtime$': `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,\n 'next/dist/compiled/react/jsx-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`,\n 'next/dist/compiled/react-experimental/jsx-runtime$': `next/dist/compiled/react-experimental/jsx-runtime.react-server`,\n 'react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`,\n 'next/dist/compiled/react/jsx-dev-runtime$': `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`,\n 'next/dist/compiled/react-experimental/jsx-dev-runtime$': `next/dist/compiled/react-experimental/jsx-dev-runtime.react-server`,\n 'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`,\n 'next/dist/compiled/react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`,\n 'next/dist/compiled/react-dom-experimental$': `next/dist/compiled/react-dom-experimental/react-dom.react-server`,\n })\n }\n }\n\n if (reactProductionProfiling) {\n alias['react-dom/client$'] =\n `next/dist/compiled/react-dom${bundledReactChannel}/profiling`\n }\n\n alias[\n '@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts'\n ] = `next/dist/client/dev/noop-turbopack-hmr`\n\n return alias\n}\n\n// Insert aliases for Next.js stubs of fetch, object-assign, and url\n// Keep in sync with insert_optimized_module_aliases in import_map.rs\nexport function getOptimizedModuleAliases(): CompilerAliases {\n return {\n unfetch: require.resolve('next/dist/build/polyfills/fetch/index.js'),\n 'isomorphic-unfetch': require.resolve(\n 'next/dist/build/polyfills/fetch/index.js'\n ),\n 'whatwg-fetch': require.resolve(\n 'next/dist/build/polyfills/fetch/whatwg-fetch.js'\n ),\n 'object-assign': require.resolve(\n 'next/dist/build/polyfills/object-assign.js'\n ),\n 'object.assign/auto': require.resolve(\n 'next/dist/build/polyfills/object.assign/auto.js'\n ),\n 'object.assign/implementation': require.resolve(\n 'next/dist/build/polyfills/object.assign/implementation.js'\n ),\n 'object.assign/polyfill': require.resolve(\n 'next/dist/build/polyfills/object.assign/polyfill.js'\n ),\n 'object.assign/shim': require.resolve(\n 'next/dist/build/polyfills/object.assign/shim.js'\n ),\n url: require.resolve('next/dist/compiled/native-url'),\n }\n}\n\n// Alias these modules to be resolved with \"module\" if possible.\nfunction getBarrelOptimizationAliases(packages: string[]): CompilerAliases {\n const aliases: { [pkg: string]: string } = {}\n const mainFields = ['module', 'main']\n\n for (const pkg of packages) {\n try {\n const descriptionFileData = require(`${pkg}/package.json`)\n const descriptionFilePath = require.resolve(`${pkg}/package.json`)\n\n for (const field of mainFields) {\n if (descriptionFileData.hasOwnProperty(field)) {\n aliases[pkg + '$'] = path.join(\n path.dirname(descriptionFilePath),\n descriptionFileData[field]\n )\n break\n }\n }\n } catch {}\n }\n\n return aliases\n}\nfunction getReactProfilingInProduction(): CompilerAliases {\n return {\n 'react-dom/client$': 'react-dom/profiling',\n }\n}\n"],"names":["path","React","DOT_NEXT_ALIAS","PAGES_DIR_ALIAS","ROOT_DIR_ALIAS","APP_DIR_ALIAS","RSC_ACTION_PROXY_ALIAS","RSC_ACTION_CLIENT_WRAPPER_ALIAS","RSC_ACTION_VALIDATE_ALIAS","RSC_ACTION_ENCRYPTION_ALIAS","RSC_CACHE_WRAPPER_ALIAS","defaultOverrides","hasExternalOtelApiPackage","NEXT_PROJECT_ROOT","WEBPACK_LAYERS","isWebpackServerOnlyLayer","isReact19","use","createWebpackAliases","distDir","isClient","isEdgeServer","isNodeServer","dev","config","pagesDir","appDir","dir","reactProductionProfiling","hasRewrites","pageExtensions","clientResolveRewrites","require","resolve","customAppAliases","customDocumentAliases","nextDistPath","reduce","prev","ext","push","join","createNextApiEsmAliases","undefined","images","loaderFile","getOptimizedModuleAliases","getReactProfilingInProduction","getBarrelOptimizationAliases","experimental","optimizePackageImports","dirname","setimmediate","createServerOnlyClientOnlyAliases","isServer","mapping","head","image","constants","router","dynamic","script","link","form","navigation","headers","og","server","document","app","aliasMap","key","value","Object","entries","nextApiFilePath","createAppRouterApiAliases","isServerOnlyLayer","createRSCAliases","bundledReactChannel","layer","reactServerComponents","alias","react$","serverSideRendering","assign","unfetch","url","packages","aliases","mainFields","pkg","descriptionFileData","descriptionFilePath","field","hasOwnProperty"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,YAAYC,WAAW,QAAO;AAC9B,SACEC,cAAc,EACdC,eAAe,EACfC,cAAc,EACdC,aAAa,EACbC,sBAAsB,EACtBC,+BAA+B,EAC/BC,yBAAyB,EACzBC,2BAA2B,EAC3BC,uBAAuB,QAElB,mBAAkB;AAEzB,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,yBAAyB,QAAQ,mBAAkB;AAC5D,SAASC,iBAAiB,QAAQ,mBAAkB;AACpD,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SAASC,wBAAwB,QAAQ,UAAS;AAMlD,MAAMC,YAAY,OAAOf,MAAMgB,GAAG,KAAK;AAEvC,OAAO,SAASC,qBAAqB,EACnCC,OAAO,EACPC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,GAAG,EACHC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,GAAG,EACHC,wBAAwB,EACxBC,WAAW,EAaZ;IACC,MAAMC,iBAAiBN,OAAOM,cAAc;IAC5C,MAAMC,wBAAwBC,QAAQC,OAAO,CAC3C;IAEF,MAAMC,mBAAoC,CAAC;IAC3C,MAAMC,wBAAyC,CAAC;IAEhD,oDAAoD;IACpD,qDAAqD;IACrD,sCAAsC;IACtC,IAAIZ,KAAK;QACP,MAAMa,eAAe,eAAgBf,CAAAA,eAAe,SAAS,EAAC;QAC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AoBG,cAAc,CAACD,QAAQ;oBAC7CL,OAAO,CAACE,MAAM,IAAI,GAAG3F,KAAKyC,IAAI,CAC5BzC,KAAKmD,OAAO,CAAC0C,sBACbD,mBAAmB,CAACE,MAAM;oBAE5B;gBACF;YACF;QACF,EAAE,OAAM,CAAC;IACX;IAEA,OAAOL;AACT;AACA,SAAS1C;IACP,OAAO;QACL,qBAAqB;IACvB;AACF"}
|
package/dist/esm/build/index.js
CHANGED
@@ -300,7 +300,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
300
300
|
const nextBuildSpan = trace('next-build', undefined, {
|
301
301
|
buildMode: experimentalBuildMode,
|
302
302
|
isTurboBuild: String(turboNextBuild),
|
303
|
-
version: "15.3.0-canary.
|
303
|
+
version: "15.3.0-canary.8"
|
304
304
|
});
|
305
305
|
NextBuildContext.nextBuildSpan = nextBuildSpan;
|
306
306
|
NextBuildContext.dir = dir;
|
@@ -332,6 +332,23 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
332
332
|
setGlobal('distDir', distDir);
|
333
333
|
const buildId = await getBuildId(isGenerateMode, distDir, nextBuildSpan, config);
|
334
334
|
NextBuildContext.buildId = buildId;
|
335
|
+
if (experimentalBuildMode === 'generate-env') {
|
336
|
+
if (turboNextBuild) {
|
337
|
+
Log.warn('generate-env is not needed with turbopack');
|
338
|
+
process.exit(0);
|
339
|
+
}
|
340
|
+
Log.info('Inlining static env ...');
|
341
|
+
await nextBuildSpan.traceChild('inline-static-env').traceAsyncFn(async ()=>{
|
342
|
+
await inlineStaticEnv({
|
343
|
+
distDir,
|
344
|
+
config
|
345
|
+
});
|
346
|
+
});
|
347
|
+
Log.info('Complete');
|
348
|
+
await flushAllTraces();
|
349
|
+
teardownTraceSubscriber();
|
350
|
+
process.exit(0);
|
351
|
+
}
|
335
352
|
// when using compile mode static env isn't inlined so we
|
336
353
|
// need to populate in normal runtime env
|
337
354
|
if (isCompileMode || isGenerateMode) {
|
@@ -664,7 +681,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
664
681
|
// Files outside of the distDir can be "type": "module"
|
665
682
|
await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
666
683
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
667
|
-
await recordFrameworkVersion("15.3.0-canary.
|
684
|
+
await recordFrameworkVersion("15.3.0-canary.8");
|
668
685
|
await updateBuildDiagnostics({
|
669
686
|
buildStage: 'start'
|
670
687
|
});
|
@@ -1242,7 +1259,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
1242
1259
|
cacheHandlers: normalizedCacheHandlers,
|
1243
1260
|
trustHostHeader: ciEnvironment.hasNextSupport,
|
1244
1261
|
// @ts-expect-error internal field TODO: fix this, should use a separate mechanism to pass the info.
|
1245
|
-
isExperimentalCompile: isCompileMode
|
1262
|
+
isExperimentalCompile: isCompileMode
|
1246
1263
|
}
|
1247
1264
|
},
|
1248
1265
|
appDir: dir,
|
@@ -1407,20 +1424,13 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
1407
1424
|
// we don't need to inline for turbopack build as
|
1408
1425
|
// it will handle it's own caching separate of compile
|
1409
1426
|
if (isGenerateMode && !turboNextBuild) {
|
1427
|
+
Log.info('Inlining static env ...');
|
1410
1428
|
await nextBuildSpan.traceChild('inline-static-env').traceAsyncFn(async ()=>{
|
1411
1429
|
await inlineStaticEnv({
|
1412
1430
|
distDir,
|
1413
1431
|
config
|
1414
1432
|
});
|
1415
1433
|
});
|
1416
|
-
// users might only want to inline env during experimental generate
|
1417
|
-
// instead of also prerendering e.g. for test mode so exit after
|
1418
|
-
if (config.experimental.generateOnlyEnv) {
|
1419
|
-
Log.info('Inlined static env, exiting due to experimental.generateOnlyEnv');
|
1420
|
-
await flushAllTraces();
|
1421
|
-
teardownTraceSubscriber();
|
1422
|
-
process.exit(0);
|
1423
|
-
}
|
1424
1434
|
}
|
1425
1435
|
const middlewareManifest = await readManifest(path.join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST));
|
1426
1436
|
const prerenderManifest = {
|
@@ -2192,6 +2202,9 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
2192
2202
|
buildTracesSpinner.stopAndPersist();
|
2193
2203
|
buildTracesSpinner = undefined;
|
2194
2204
|
}
|
2205
|
+
if (isCompileMode) {
|
2206
|
+
Log.info(`Build ran with "compile" mode, to finalize the build run either "generate" or "generate-env" mode as well`);
|
2207
|
+
}
|
2195
2208
|
if (config.output === 'export') {
|
2196
2209
|
await writeFullyStaticExport(config, dir, enabledDirectories, configOutDir, nextBuildSpan);
|
2197
2210
|
}
|