@openuiai/next 16.0.6 → 16.0.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 +1 -1
- package/dist/build/index.js +3 -3
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack/loaders/css-loader/src/utils.js +2 -1
- package/dist/build/webpack/loaders/css-loader/src/utils.js.map +1 -1
- package/dist/build/webpack/plugins/jsconfig-paths-plugin.js +4 -0
- package/dist/build/webpack/plugins/jsconfig-paths-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/profiling-plugin.js +4 -1
- package/dist/build/webpack/plugins/profiling-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/react-loadable-plugin.js +2 -0
- package/dist/build/webpack/plugins/react-loadable-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.js +8 -0
- package/dist/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.js.map +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +2 -0
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack/loaders/css-loader/src/utils.js +2 -1
- package/dist/esm/build/webpack/loaders/css-loader/src/utils.js.map +1 -1
- package/dist/esm/build/webpack/plugins/jsconfig-paths-plugin.js +4 -0
- package/dist/esm/build/webpack/plugins/jsconfig-paths-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/profiling-plugin.js +4 -1
- package/dist/esm/build/webpack/plugins/profiling-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/react-loadable-plugin.js +2 -0
- package/dist/esm/build/webpack/plugins/react-loadable-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.js +8 -0
- package/dist/esm/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.js.map +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/dev/middleware-webpack.js +10 -3
- package/dist/esm/server/dev/middleware-webpack.js.map +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/dev/middleware-webpack.js +10 -3
- package/dist/server/dev/middleware-webpack.js.map +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/errors/canary-only-config-error.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 +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.ts"],"sourcesContent":["import { bold, cyan, green, red, yellow } from '../../../../lib/picocolors'\nimport { SimpleWebpackError } from './simpleWebpackError'\nimport {\n createOriginalStackFrame,\n getIgnoredSources,\n} from '../../../../server/dev/middleware-webpack'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport type { RawSourceMap } from 'next/dist/compiled/source-map08'\n\n// Based on https://github.com/webpack/webpack/blob/fcdd04a833943394bbb0a9eeb54a962a24cc7e41/lib/stats/DefaultStatsFactoryPlugin.js#L422-L431\n/*\nCopyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\nfunction getModuleTrace(input: any, compilation: any) {\n const visitedModules = new Set()\n const moduleTrace = []\n let current = input.module\n while (current) {\n if (visitedModules.has(current)) break // circular (technically impossible, but who knows)\n visitedModules.add(current)\n const origin = compilation.moduleGraph.getIssuer(current)\n if (!origin) break\n moduleTrace.push({ origin, module: current })\n current = origin\n }\n\n return moduleTrace\n}\n\nfunction sourceMapIgnoreListsEverything(\n sourceMap: RawSourceMap & { ignoreList?: number[] }\n): boolean {\n return sourceMap.sources.length === sourceMap.ignoreList?.length\n}\n\nasync function getSourceFrame(\n input: any,\n fileName: any,\n compilation: any\n): Promise<{ frame: string; line1: string; column1: string }> {\n try {\n const loc =\n input.loc || input.dependencies.map((d: any) => d.loc).filter(Boolean)[0]\n const module = input.module as webpack.Module\n const originalSource = module.originalSource()\n const sourceMap = originalSource?.map() ?? undefined\n\n if (sourceMap) {\n const moduleId = compilation.chunkGraph.getModuleId(module)\n\n const result = await createOriginalStackFrame({\n ignoredByDefault: sourceMapIgnoreListsEverything(sourceMap),\n source: {\n type: 'bundle',\n sourceMap,\n ignoredSources: getIgnoredSources(sourceMap),\n compilation,\n moduleId,\n moduleURL: fileName,\n },\n rootDirectory: compilation.options.context!,\n frame: {\n arguments: [],\n file: fileName,\n methodName: '',\n line1: loc.start.line,\n // loc is 0-based but columns in stack frames are 1-based.\n column1: (loc.start.column ?? 0) + 1,\n },\n })\n\n return {\n frame: result?.originalCodeFrame ?? '',\n line1: result?.originalStackFrame?.line1?.toString() ?? '',\n column1: result?.originalStackFrame?.column1?.toString() ?? '',\n }\n }\n } catch {}\n\n return { frame: '', line1: '', column1: '' }\n}\n\nfunction getFormattedFileName(\n fileName: string,\n module: any,\n lineNumber?: string,\n column?: string\n): string {\n if (\n module.loaders?.find((loader: any) =>\n /next-font-loader[/\\\\]index.js/.test(loader.loader)\n )\n ) {\n // Parse the query and get the path of the file where the font function was called.\n // provided by next-swc next-transform-font\n return JSON.parse(module.resourceResolveData.query.slice(1)).path\n } else {\n let formattedFileName: string = cyan(fileName)\n if (lineNumber && column) {\n formattedFileName += `:${yellow(lineNumber)}:${yellow(column)}`\n }\n\n return formattedFileName\n }\n}\n\nexport async function getNotFoundError(\n compilation: webpack.Compilation,\n input: any,\n fileName: string,\n module: any\n) {\n if (\n input.name !== 'ModuleNotFoundError' &&\n !(\n input.name === 'ModuleBuildError' &&\n /Error: Can't resolve '.+' in /.test(input.message)\n )\n ) {\n return false\n }\n\n try {\n const { frame, line1, column1 } = await getSourceFrame(\n input,\n fileName,\n compilation\n )\n\n const errorMessage = input.error.message\n .replace(/ in '.*?'/, '')\n .replace(/Can't resolve '(.*)'/, `Can't resolve '${green('$1')}'`)\n\n const importTrace = () => {\n const moduleTrace = getModuleTrace(input, compilation)\n .map(({ origin }) =>\n origin.readableIdentifier(compilation.requestShortener)\n )\n .filter(\n (name) =>\n name &&\n !/next-(app|middleware|client-pages|route|flight-(client|server|client-entry))-loader/.test(\n name\n ) &&\n !/css-loader.+\\.js/.test(name)\n )\n if (moduleTrace.length === 0) return ''\n\n return `\\nImport trace for requested module:\\n${moduleTrace.join('\\n')}`\n }\n\n let message =\n red(bold('Module not found')) +\n `: ${errorMessage}` +\n '\\n' +\n frame +\n (frame !== '' ? '\\n' : '') +\n '\\nhttps://nextjs.org/docs/messages/module-not-found\\n' +\n importTrace()\n\n const formattedFileName = getFormattedFileName(\n fileName,\n module,\n line1,\n column1\n )\n\n return new SimpleWebpackError(formattedFileName, message)\n } catch (err) {\n // Don't fail on failure to resolve sourcemaps\n return input\n }\n}\n\nexport async function getImageError(\n compilation: any,\n input: any,\n err: Error\n): Promise<SimpleWebpackError | false> {\n if (err.name !== 'InvalidImageFormatError') {\n return false\n }\n\n const moduleTrace = getModuleTrace(input, compilation)\n const { origin, module } = moduleTrace[0] || {}\n if (!origin || !module) {\n return false\n }\n const page = origin.rawRequest.replace(/^private-next-pages/, './pages')\n const importedFile = module.rawRequest\n const source = origin.originalSource().buffer().toString('utf8') as string\n let lineNumber = -1\n source.split('\\n').some((line) => {\n lineNumber++\n return line.includes(importedFile)\n })\n return new SimpleWebpackError(\n `${cyan(page)}:${yellow(lineNumber.toString())}`,\n red(bold('Error')).concat(\n `: Image import \"${importedFile}\" is not a valid image file. The image may be corrupted or an unsupported format.`\n )\n )\n}\n"],"names":["bold","cyan","green","red","yellow","SimpleWebpackError","createOriginalStackFrame","getIgnoredSources","getModuleTrace","input","compilation","visitedModules","Set","moduleTrace","current","module","has","add","origin","moduleGraph","getIssuer","push","sourceMapIgnoreListsEverything","sourceMap","sources","length","ignoreList","getSourceFrame","fileName","loc","dependencies","map","d","filter","Boolean","originalSource","undefined","result","moduleId","chunkGraph","getModuleId","ignoredByDefault","source","type","ignoredSources","moduleURL","rootDirectory","options","context","frame","arguments","file","methodName","line1","start","line","column1","column","originalCodeFrame","originalStackFrame","toString","getFormattedFileName","lineNumber","loaders","find","loader","test","JSON","parse","resourceResolveData","query","slice","path","formattedFileName","getNotFoundError","name","message","errorMessage","error","replace","importTrace","readableIdentifier","requestShortener","join","err","getImageError","page","rawRequest","importedFile","buffer","split","some","includes","concat"],"mappings":"AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,MAAM,QAAQ,6BAA4B;AAC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AK,2BAA2B;QAC1C,OAAO;IACT;IAEA,MAAM9D,cAAcL,eAAeC,OAAOC;IAC1C,MAAM,EAAEQ,MAAM,EAAEH,MAAM,EAAE,GAAGF,WAAW,CAAC,EAAE,IAAI,CAAC;IAC9C,IAAI,CAACK,UAAU,CAACH,QAAQ;QACtB,OAAO;IACT;IACA,MAAMuE,OAAOpE,OAAOqE,UAAU,CAACR,OAAO,CAAC,uBAAuB;IAC9D,MAAMS,eAAezE,OAAOwE,UAAU;IACtC,MAAM7C,SAASxB,OAAOiB,cAAc,GAAGsD,MAAM,GAAG7B,QAAQ,CAAC;IACzD,IAAIE,aAAa,CAAC;IAClBpB,OAAOgD,KAAK,CAAC,MAAMC,IAAI,CAAC,CAACpC;QACvBO;QACA,OAAOP,KAAKqC,QAAQ,CAACJ;IACvB;IACA,OAAO,IAAInF,mBACT,GAAGJ,KAAKqF,MAAM,CAAC,EAAElF,OAAO0D,WAAWF,QAAQ,KAAK,EAChDzD,IAAIH,KAAK,UAAU6F,MAAM,CACvB,CAAC,gBAAgB,EAAEL,aAAa,iFAAiF,CAAC;AAGxH","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.ts"],"sourcesContent":["import { bold, cyan, green, red, yellow } from '../../../../lib/picocolors'\nimport { SimpleWebpackError } from './simpleWebpackError'\nimport {\n createOriginalStackFrame,\n getIgnoredSources,\n} from '../../../../server/dev/middleware-webpack'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport type { RawSourceMap } from 'next/dist/compiled/source-map08'\n\n// Based on https://github.com/webpack/webpack/blob/fcdd04a833943394bbb0a9eeb54a962a24cc7e41/lib/stats/DefaultStatsFactoryPlugin.js#L422-L431\n/*\nCopyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\nfunction getModuleTrace(input: any, compilation: any) {\n const visitedModules = new Set()\n const moduleTrace = []\n let current = input.module\n while (current) {\n if (visitedModules.has(current)) break // circular (technically impossible, but who knows)\n visitedModules.add(current)\n const origin = compilation.moduleGraph.getIssuer(current)\n if (!origin) break\n moduleTrace.push({ origin, module: current })\n current = origin\n }\n\n return moduleTrace\n}\n\nfunction sourceMapIgnoreListsEverything(\n sourceMap: RawSourceMap & { ignoreList?: number[] }\n): boolean {\n return sourceMap.sources.length === sourceMap.ignoreList?.length\n}\n\nasync function getSourceFrame(\n input: any,\n fileName: any,\n compilation: any\n): Promise<{ frame: string; line1: string; column1: string }> {\n try {\n const loc =\n input.loc || input.dependencies.map((d: any) => d.loc).filter(Boolean)[0]\n const module = input.module as webpack.Module\n const originalSource = module.originalSource()\n const sourceMap = originalSource?.map() ?? undefined\n\n if (sourceMap) {\n const moduleId = compilation.chunkGraph.getModuleId(module)\n // Skip if moduleId is undefined (Bun compatibility)\n if (moduleId === undefined || moduleId === null) {\n return { frame: '', line1: '', column1: '' }\n }\n\n const result = await createOriginalStackFrame({\n ignoredByDefault: sourceMapIgnoreListsEverything(sourceMap),\n source: {\n type: 'bundle',\n sourceMap,\n ignoredSources: getIgnoredSources(sourceMap),\n compilation,\n moduleId,\n moduleURL: fileName,\n },\n rootDirectory: compilation.options.context!,\n frame: {\n arguments: [],\n file: fileName,\n methodName: '',\n line1: loc.start.line,\n // loc is 0-based but columns in stack frames are 1-based.\n column1: (loc.start.column ?? 0) + 1,\n },\n })\n\n return {\n frame: result?.originalCodeFrame ?? '',\n line1: result?.originalStackFrame?.line1?.toString() ?? '',\n column1: result?.originalStackFrame?.column1?.toString() ?? '',\n }\n }\n } catch {}\n\n return { frame: '', line1: '', column1: '' }\n}\n\nfunction getFormattedFileName(\n fileName: string,\n module: any,\n lineNumber?: string,\n column?: string\n): string {\n if (\n module.loaders?.find((loader: any) =>\n /next-font-loader[/\\\\]index.js/.test(loader.loader)\n )\n ) {\n // Parse the query and get the path of the file where the font function was called.\n // provided by next-swc next-transform-font\n return JSON.parse(module.resourceResolveData.query.slice(1)).path\n } else {\n let formattedFileName: string = cyan(fileName)\n if (lineNumber && column) {\n formattedFileName += `:${yellow(lineNumber)}:${yellow(column)}`\n }\n\n return formattedFileName\n }\n}\n\nexport async function getNotFoundError(\n compilation: webpack.Compilation,\n input: any,\n fileName: string,\n module: any\n) {\n if (\n input.name !== 'ModuleNotFoundError' &&\n !(\n input.name === 'ModuleBuildError' &&\n /Error: Can't resolve '.+' in /.test(input.message)\n )\n ) {\n return false\n }\n\n try {\n const { frame, line1, column1 } = await getSourceFrame(\n input,\n fileName,\n compilation\n )\n\n const errorMessage = input.error.message\n .replace(/ in '.*?'/, '')\n .replace(/Can't resolve '(.*)'/, `Can't resolve '${green('$1')}'`)\n\n const importTrace = () => {\n const moduleTrace = getModuleTrace(input, compilation)\n .map(({ origin }) =>\n origin.readableIdentifier(compilation.requestShortener)\n )\n .filter(\n (name) =>\n name &&\n !/next-(app|middleware|client-pages|route|flight-(client|server|client-entry))-loader/.test(\n name\n ) &&\n !/css-loader.+\\.js/.test(name)\n )\n if (moduleTrace.length === 0) return ''\n\n return `\\nImport trace for requested module:\\n${moduleTrace.join('\\n')}`\n }\n\n let message =\n red(bold('Module not found')) +\n `: ${errorMessage}` +\n '\\n' +\n frame +\n (frame !== '' ? '\\n' : '') +\n '\\nhttps://nextjs.org/docs/messages/module-not-found\\n' +\n importTrace()\n\n const formattedFileName = getFormattedFileName(\n fileName,\n module,\n line1,\n column1\n )\n\n return new SimpleWebpackError(formattedFileName, message)\n } catch (err) {\n // Don't fail on failure to resolve sourcemaps\n return input\n }\n}\n\nexport async function getImageError(\n compilation: any,\n input: any,\n err: Error\n): Promise<SimpleWebpackError | false> {\n if (err.name !== 'InvalidImageFormatError') {\n return false\n }\n\n const moduleTrace = getModuleTrace(input, compilation)\n const { origin, module } = moduleTrace[0] || {}\n if (!origin || !module) {\n return false\n }\n const page = origin.rawRequest.replace(/^private-next-pages/, './pages')\n const importedFile = module.rawRequest\n const source = origin.originalSource().buffer().toString('utf8') as string\n let lineNumber = -1\n source.split('\\n').some((line) => {\n lineNumber++\n return line.includes(importedFile)\n })\n return new SimpleWebpackError(\n `${cyan(page)}:${yellow(lineNumber.toString())}`,\n red(bold('Error')).concat(\n `: Image import \"${importedFile}\" is not a valid image file. The image may be corrupted or an unsupported format.`\n )\n )\n}\n"],"names":["bold","cyan","green","red","yellow","SimpleWebpackError","createOriginalStackFrame","getIgnoredSources","getModuleTrace","input","compilation","visitedModules","Set","moduleTrace","current","module","has","add","origin","moduleGraph","getIssuer","push","sourceMapIgnoreListsEverything","sourceMap","sources","length","ignoreList","getSourceFrame","fileName","loc","dependencies","map","d","filter","Boolean","originalSource","undefined","result","moduleId","chunkGraph","getModuleId","frame","line1","column1","ignoredByDefault","source","type","ignoredSources","moduleURL","rootDirectory","options","context","arguments","file","methodName","start","line","column","originalCodeFrame","originalStackFrame","toString","getFormattedFileName","lineNumber","loaders","find","loader","test","JSON","parse","resourceResolveData","query","slice","path","formattedFileName","getNotFoundError","name","message","errorMessage","error","replace","importTrace","readableIdentifier","requestShortener","join","err","getImageError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C;QAEF,MAAMP,oBAAoBZ,qBACxBjC,UACAb,QACA2B,OACAC;QAGF,OAAO,IAAItC,mBAAmBoE,mBAAmBG;IACnD,EAAE,OAAOQ,KAAK;QACZ,8CAA8C;QAC9C,OAAO3E;IACT;AACF;AAEA,OAAO,eAAe4E,cACpB3E,WAAgB,EAChBD,KAAU,EACV2E,GAAU;IAEV,IAAIA,IAAIT,IAAI,KAAK,2BAA2B;QAC1C,OAAO;IACT;IAEA,MAAM9D,cAAcL,eAAeC,OAAOC;IAC1C,MAAM,EAAEQ,MAAM,EAAEH,MAAM,EAAE,GAAGF,WAAW,CAAC,EAAE,IAAI,CAAC;IAC9C,IAAI,CAACK,UAAU,CAACH,QAAQ;QACtB,OAAO;IACT;IACA,MAAMuE,OAAOpE,OAAOqE,UAAU,CAACR,OAAO,CAAC,uBAAuB;IAC9D,MAAMS,eAAezE,OAAOwE,UAAU;IACtC,MAAM1C,SAAS3B,OAAOiB,cAAc,GAAGsD,MAAM,GAAG7B,QAAQ,CAAC;IACzD,IAAIE,aAAa,CAAC;IAClBjB,OAAO6C,KAAK,CAAC,MAAMC,IAAI,CAAC,CAACnC;QACvBM;QACA,OAAON,KAAKoC,QAAQ,CAACJ;IACvB;IACA,OAAO,IAAInF,mBACT,GAAGJ,KAAKqF,MAAM,CAAC,EAAElF,OAAO0D,WAAWF,QAAQ,KAAK,EAChDzD,IAAIH,KAAK,UAAU6F,MAAM,CACvB,CAAC,gBAAgB,EAAEL,aAAa,iFAAiF,CAAC;AAGxH","ignoreList":[0]}
|
|
@@ -1610,7 +1610,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1610
1610
|
isClient && new CopyFilePlugin({
|
|
1611
1611
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1612
1612
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1613
|
-
cacheKey: "16.0.
|
|
1613
|
+
cacheKey: "16.0.8",
|
|
1614
1614
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1615
1615
|
minimize: false,
|
|
1616
1616
|
info: {
|
|
@@ -1801,7 +1801,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1801
1801
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1802
1802
|
// - Next.js version
|
|
1803
1803
|
// - next.config.js keys that affect compilation
|
|
1804
|
-
version: `${__dirname}|${"16.0.
|
|
1804
|
+
version: `${__dirname}|${"16.0.8"}|${configVars}`,
|
|
1805
1805
|
cacheDirectory: path.join(distDir, 'cache', 'webpack'),
|
|
1806
1806
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1807
1807
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* - next/script with `beforeInteractive` strategy
|
|
6
6
|
*/ import { getAssetPrefix } from './asset-prefix';
|
|
7
7
|
import { setAttributesFromProps } from './set-attributes-from-props';
|
|
8
|
-
const version = "16.0.
|
|
8
|
+
const version = "16.0.8";
|
|
9
9
|
window.next = {
|
|
10
10
|
version,
|
|
11
11
|
appDir: true
|
package/dist/esm/client/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
|
|
|
25
25
|
import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
|
|
26
26
|
import tracer from './tracing/tracer';
|
|
27
27
|
import { isNextRouterError } from './components/is-next-router-error';
|
|
28
|
-
export const version = "16.0.
|
|
28
|
+
export const version = "16.0.8";
|
|
29
29
|
export let router;
|
|
30
30
|
export const emitter = mitt();
|
|
31
31
|
const looseToArray = (input)=>[].slice.call(input);
|
|
@@ -163,7 +163,7 @@ export default class HotReloaderWebpack {
|
|
|
163
163
|
this.previewProps = previewProps;
|
|
164
164
|
this.rewrites = rewrites;
|
|
165
165
|
this.hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
166
|
-
version: "16.0.
|
|
166
|
+
version: "16.0.8"
|
|
167
167
|
});
|
|
168
168
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
169
169
|
// of the current `next dev` invocation.
|
|
@@ -238,11 +238,18 @@ export async function getOriginalStackFrames({ isServer, isEdgeServer, isAppDire
|
|
|
238
238
|
value
|
|
239
239
|
};
|
|
240
240
|
}, (reason)=>{
|
|
241
|
+
let reasonStr;
|
|
242
|
+
try {
|
|
243
|
+
reasonStr = inspect(reason, {
|
|
244
|
+
colors: false
|
|
245
|
+
});
|
|
246
|
+
} catch {
|
|
247
|
+
// Bun compatibility: inspect may throw on certain objects
|
|
248
|
+
reasonStr = String(reason);
|
|
249
|
+
}
|
|
241
250
|
return {
|
|
242
251
|
status: 'rejected',
|
|
243
|
-
reason:
|
|
244
|
-
colors: false
|
|
245
|
-
})
|
|
252
|
+
reason: reasonStr
|
|
246
253
|
};
|
|
247
254
|
})));
|
|
248
255
|
ignoreListAnonymousStackFramesIfSandwiched(frameResponses);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/server/dev/middleware-webpack.ts"],"sourcesContent":["import { findSourceMap, type SourceMap } from '../../lib/module-loader-adapter'\nimport path from 'path'\nimport { fileURLToPath, pathToFileURL } from 'url'\nimport { SourceMapConsumer } from 'next/dist/compiled/source-map08'\nimport { getSourceMapFromFile } from './get-source-map-from-file'\nimport {\n devirtualizeReactServerURL,\n findApplicableSourceMapPayload,\n sourceMapIgnoreListsEverything,\n type BasicSourceMapPayload,\n type ModernSourceMapPayload,\n} from '../lib/source-maps'\nimport { openFileInEditor } from '../../next-devtools/server/launch-editor'\nimport {\n getOriginalCodeFrame,\n ignoreListAnonymousStackFramesIfSandwiched,\n type StackFrame,\n type IgnorableStackFrame,\n type OriginalStackFrameResponse,\n type OriginalStackFramesRequest,\n type OriginalStackFramesResponse,\n} from '../../next-devtools/server/shared'\nimport { middlewareResponse } from '../../next-devtools/server/middleware-response'\n\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type webpack from 'webpack'\nimport type {\n NullableMappedPosition,\n RawSourceMap,\n} from 'next/dist/compiled/source-map08'\nimport { formatFrameSourceFile } from '../../next-devtools/shared/webpack-module-path'\nimport type { MappedPosition } from 'source-map'\nimport { inspect } from 'util'\n\nfunction shouldIgnoreSource(sourceURL: string): boolean {\n return (\n sourceURL.includes('node_modules') ||\n // Only relevant for when Next.js is symlinked e.g. in the Next.js monorepo\n sourceURL.includes('next/dist') ||\n sourceURL.startsWith('node:')\n )\n}\n\ntype IgnoredSources = Array<{ url: string; ignored: boolean }>\n\ntype SourceAttributes = {\n sourcePosition: NullableMappedPosition\n sourceContent: string | null\n}\n\ntype Source =\n | {\n type: 'file'\n sourceMap: BasicSourceMapPayload\n ignoredSources: IgnoredSources\n moduleURL: string\n }\n | {\n type: 'bundle'\n sourceMap: BasicSourceMapPayload\n ignoredSources: IgnoredSources\n compilation: webpack.Compilation\n moduleId: string\n moduleURL: string\n }\n\nfunction getModuleById(\n id: string | undefined,\n compilation: webpack.Compilation\n) {\n const { chunkGraph, modules } = compilation\n\n return [...modules].find((module) => chunkGraph.getModuleId(module) === id)\n}\n\nfunction findModuleNotFoundFromError(errorMessage: string | undefined) {\n return errorMessage?.match(/'([^']+)' module/)?.[1]\n}\n\nfunction getSourcePath(source: string) {\n if (source.startsWith('file://')) {\n return fileURLToPath(source)\n }\n return source.replace(/^(webpack:\\/\\/\\/|webpack:\\/\\/|webpack:\\/\\/_N_E\\/)/, '')\n}\n\n/**\n * @returns 1-based lines and 0-based columns\n */\nasync function findOriginalSourcePositionAndContent(\n sourceMap: ModernSourceMapPayload,\n position: { line1: number | null; column1: number | null }\n): Promise<SourceAttributes | null> {\n let consumer: SourceMapConsumer\n try {\n consumer = await new SourceMapConsumer(sourceMap)\n } catch (cause) {\n console.error(\n new Error(\n `${sourceMap.file}: Invalid source map. Only conformant source maps can be used to find the original code.`,\n { cause }\n )\n )\n return null\n }\n\n try {\n const sourcePosition = consumer.originalPositionFor({\n line: position.line1 ?? 1,\n // 0-based columns out requires 0-based columns in.\n column: (position.column1 ?? 1) - 1,\n })\n\n if (!sourcePosition.source) {\n return null\n }\n\n const sourceContent: string | null =\n consumer.sourceContentFor(\n sourcePosition.source,\n /* returnNullOnMissing */ true\n ) ?? null\n\n return {\n sourcePosition,\n sourceContent,\n }\n } finally {\n consumer.destroy()\n }\n}\n\nexport function getIgnoredSources(\n sourceMap: RawSourceMap & { ignoreList?: number[] }\n): IgnoredSources {\n const ignoreList = new Set<number>(sourceMap.ignoreList ?? [])\n const moduleFilenames = sourceMap?.sources ?? []\n\n for (let index = 0; index < moduleFilenames.length; index++) {\n // bundlerFilePath case: webpack://./app/page.tsx\n const webpackSourceURL = moduleFilenames[index]\n // Format the path to the normal file path\n const formattedFilePath = formatFrameSourceFile(webpackSourceURL)\n if (shouldIgnoreSource(formattedFilePath)) {\n ignoreList.add(index)\n }\n }\n\n const ignoredSources = sourceMap.sources.map((source, index) => {\n return {\n url: source,\n ignored: ignoreList.has(sourceMap.sources.indexOf(source)),\n content: sourceMap.sourcesContent?.[index] ?? null,\n }\n })\n return ignoredSources\n}\n\nfunction isIgnoredSource(\n source: Source,\n sourcePosition: MappedPosition | NullableMappedPosition\n) {\n if (sourcePosition.source == null) {\n return true\n }\n for (const ignoredSource of source.ignoredSources) {\n if (ignoredSource.ignored && ignoredSource.url === sourcePosition.source) {\n return true\n }\n }\n\n return false\n}\n\nfunction findOriginalSourcePositionAndContentFromCompilation(\n moduleId: string | undefined,\n importedModule: string,\n compilation: webpack.Compilation\n): SourceAttributes | null {\n const module = getModuleById(moduleId, compilation)\n return module?.buildInfo?.importLocByPath?.get(importedModule) ?? null\n}\n\nexport async function createOriginalStackFrame({\n ignoredByDefault,\n source,\n rootDirectory,\n frame,\n errorMessage,\n}: {\n /** setting this to true will not consult ignoreList */\n ignoredByDefault: boolean\n source: Source\n rootDirectory: string\n frame: StackFrame\n errorMessage?: string\n}): Promise<OriginalStackFrameResponse | null> {\n const moduleNotFound = findModuleNotFoundFromError(errorMessage)\n const result = await (() => {\n if (moduleNotFound) {\n if (source.type === 'file') {\n return undefined\n }\n\n return findOriginalSourcePositionAndContentFromCompilation(\n source.moduleId,\n moduleNotFound,\n source.compilation\n )\n }\n return findOriginalSourcePositionAndContent(source.sourceMap, frame)\n })()\n\n if (!result) {\n return null\n }\n const { sourcePosition, sourceContent } = result\n\n if (!sourcePosition.source) {\n return null\n }\n\n const ignored =\n ignoredByDefault ||\n isIgnoredSource(source, sourcePosition) ||\n // If the source file is externals, should be excluded even it's not ignored source.\n // e.g. webpack://next/dist/.. needs to be ignored\n shouldIgnoreSource(source.moduleURL)\n\n const sourcePath = getSourcePath(\n // When sourcePosition.source is the loader path the modulePath is generally better.\n (sourcePosition.source!.includes('|')\n ? source.moduleURL\n : sourcePosition.source) || source.moduleURL\n )\n const filePath = path.resolve(rootDirectory, sourcePath)\n const resolvedFilePath = path.relative(rootDirectory, filePath)\n\n const traced: IgnorableStackFrame = {\n file: resolvedFilePath,\n line1: sourcePosition.line,\n column1: sourcePosition.column === null ? null : sourcePosition.column + 1,\n methodName:\n // We ignore the sourcemapped name since it won't be the correct name.\n // The callsite will point to the column of the variable name instead of the\n // name of the enclosing function.\n // TODO(NDX-531): Spy on prepareStackTrace to get the enclosing line number for method name mapping.\n // default is not a valid identifier in JS so webpack uses a custom variable when it's an unnamed default export\n // Resolve it back to `default` for the method name if the source position didn't have the method.\n frame.methodName\n ?.replace('__WEBPACK_DEFAULT_EXPORT__', 'default')\n ?.replace('__webpack_exports__.', ''),\n arguments: [],\n ignored,\n }\n\n return {\n originalStackFrame: traced,\n originalCodeFrame: getOriginalCodeFrame(traced, sourceContent),\n }\n}\n\nasync function getSourceMapFromCompilation(\n id: string,\n compilation: webpack.Compilation\n): Promise<RawSourceMap | undefined> {\n try {\n const module = getModuleById(id, compilation)\n\n if (!module) {\n return undefined\n }\n\n // @ts-expect-error The types for `CodeGenerationResults.get` require a\n // runtime to be passed as second argument, but apparently it also works\n // without it.\n const codeGenerationResult = compilation.codeGenerationResults.get(module)\n const source = codeGenerationResult?.sources.get('javascript')\n\n return source?.map() ?? undefined\n } catch (err) {\n console.error(`Failed to lookup module by ID (\"${id}\"):`, err)\n return undefined\n }\n}\n\nasync function getSource(\n frame: {\n file: string | null\n line1: number | null\n column1: number | null\n },\n options: {\n getCompilations: () => webpack.Compilation[]\n }\n): Promise<Source | undefined> {\n let sourceURL = frame.file ?? ''\n const { getCompilations } = options\n\n sourceURL = devirtualizeReactServerURL(sourceURL)\n\n let nativeSourceMap: SourceMap | undefined\n try {\n nativeSourceMap = findSourceMap(sourceURL)\n } catch (cause) {\n throw new Error(\n `${sourceURL}: Invalid source map. Only conformant source maps can be used to find the original code.`,\n { cause }\n )\n }\n\n if (nativeSourceMap !== undefined) {\n const sourceMapPayload = nativeSourceMap.payload as ModernSourceMapPayload\n return {\n type: 'file',\n sourceMap: findApplicableSourceMapPayload(\n (frame.line1 ?? 1) - 1,\n (frame.column1 ?? 1) - 1,\n sourceMapPayload\n )!,\n\n ignoredSources: getIgnoredSources(\n // @ts-expect-error -- TODO: Support IndexSourceMap\n sourceMapPayload\n ),\n moduleURL: sourceURL,\n }\n }\n\n if (path.isAbsolute(sourceURL)) {\n sourceURL = pathToFileURL(sourceURL).href\n }\n\n if (sourceURL.startsWith('file:')) {\n const sourceMap = await getSourceMapFromFile(sourceURL)\n return sourceMap\n ? {\n type: 'file',\n sourceMap,\n ignoredSources: getIgnoredSources(sourceMap),\n moduleURL: sourceURL,\n }\n : undefined\n }\n\n // webpack-internal:///./src/hello.tsx => ./src/hello.tsx\n // webpack://_N_E/./src/hello.tsx => ./src/hello.tsx\n const moduleId = sourceURL\n .replace(/^(webpack-internal:\\/\\/\\/|webpack:\\/\\/(_N_E\\/)?)/, '')\n .replace(/\\?\\d+$/, '')\n\n // (rsc)/./src/hello.tsx => ./src/hello.tsx\n const moduleURL = moduleId.replace(/^(\\(.*\\)\\/?)/, '')\n\n for (const compilation of getCompilations()) {\n const sourceMap = await getSourceMapFromCompilation(moduleId, compilation)\n\n if (sourceMap) {\n const ignoredSources = getIgnoredSources(sourceMap)\n return {\n type: 'bundle',\n sourceMap,\n compilation,\n moduleId,\n moduleURL,\n ignoredSources,\n }\n }\n }\n\n return undefined\n}\n\nexport async function getOriginalStackFrames({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n}: {\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n frames: readonly StackFrame[]\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n rootDirectory: string\n}): Promise<OriginalStackFramesResponse> {\n const frameResponses = await Promise.all(\n frames.map(\n (frame): Promise<OriginalStackFramesResponse[number]> =>\n getOriginalStackFrame({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frame,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n }).then(\n (value) => {\n return {\n status: 'fulfilled',\n value,\n }\n },\n (reason) => {\n return {\n status: 'rejected',\n reason: inspect(reason, { colors: false }),\n }\n }\n )\n )\n )\n\n ignoreListAnonymousStackFramesIfSandwiched(frameResponses)\n\n return frameResponses\n}\n\nasync function getOriginalStackFrame({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frame,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n}: {\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n frame: StackFrame\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n rootDirectory: string\n}): Promise<OriginalStackFrameResponse> {\n const filename = frame.file ?? ''\n const source = await getSource(frame, {\n getCompilations: () => {\n const compilations: webpack.Compilation[] = []\n\n // Try Client Compilation first. In `pages` we leverage\n // `isClientError` to check. In `app` it depends on if it's a server\n // / client component and when the code throws. E.g. during HTML\n // rendering it's the server/edge compilation.\n if ((!isEdgeServer && !isServer) || isAppDirectory) {\n const compilation = clientStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n // Try Server Compilation. In `pages` this could be something\n // imported in getServerSideProps/getStaticProps as the code for\n // those is tree-shaken. In `app` this finds server components and\n // code that was imported from a server component. It also covers\n // when client component code throws during HTML rendering.\n if (isServer || isAppDirectory) {\n const compilation = serverStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n // Try Edge Server Compilation. Both cases are the same as Server\n // Compilation, main difference is that it covers `runtime: 'edge'`\n // pages/app routes.\n if (isEdgeServer || isAppDirectory) {\n const compilation = edgeServerStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n return compilations\n },\n })\n\n let defaultNormalizedStackFrameLocation = frame.file\n if (\n defaultNormalizedStackFrameLocation !== null &&\n defaultNormalizedStackFrameLocation.startsWith('file://')\n ) {\n defaultNormalizedStackFrameLocation = path.relative(\n rootDirectory,\n fileURLToPath(defaultNormalizedStackFrameLocation)\n )\n }\n // This stack frame is used for the one that couldn't locate the source or source mapped frame\n const defaultStackFrame: IgnorableStackFrame = {\n file: defaultNormalizedStackFrameLocation,\n line1: frame.line1,\n column1: frame.column1,\n methodName: frame.methodName,\n ignored: shouldIgnoreSource(filename),\n arguments: [],\n }\n if (!source) {\n // return original stack frame with no source map\n return {\n originalStackFrame: defaultStackFrame,\n originalCodeFrame: null,\n }\n }\n defaultStackFrame.ignored ||= sourceMapIgnoreListsEverything(source.sourceMap)\n\n const originalStackFrameResponse = await createOriginalStackFrame({\n ignoredByDefault: defaultStackFrame.ignored,\n frame,\n source,\n rootDirectory,\n })\n\n if (!originalStackFrameResponse) {\n return {\n originalStackFrame: defaultStackFrame,\n originalCodeFrame: null,\n }\n }\n\n return originalStackFrameResponse\n}\n\nexport function getOverlayMiddleware(options: {\n rootDirectory: string\n isSrcDir: boolean\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n}) {\n const { rootDirectory, isSrcDir, clientStats, serverStats, edgeServerStats } =\n options\n\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(`http://n${req.url}`)\n\n if (pathname === '/__nextjs_original-stack-frames') {\n if (req.method !== 'POST') {\n return middlewareResponse.badRequest(res)\n }\n\n const body = await new Promise<string>((resolve, reject) => {\n let data = ''\n req.on('data', (chunk) => {\n data += chunk\n })\n req.on('end', () => resolve(data))\n req.on('error', reject)\n })\n\n try {\n const { frames, isServer, isEdgeServer, isAppDirectory } = JSON.parse(\n body\n ) as OriginalStackFramesRequest\n\n return middlewareResponse.json(\n res,\n await getOriginalStackFrames({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n })\n )\n } catch (err) {\n return middlewareResponse.badRequest(res)\n }\n } else if (pathname === '/__nextjs_launch-editor') {\n const frame = {\n file: searchParams.get('file') as string,\n methodName: searchParams.get('methodName') as string,\n line1: parseInt(searchParams.get('line1') ?? '1', 10) || 1,\n column1: parseInt(searchParams.get('column1') ?? '1', 10) || 1,\n arguments: searchParams.getAll('arguments').filter(Boolean),\n } satisfies StackFrame\n\n if (!frame.file) return middlewareResponse.badRequest(res)\n\n let openEditorResult\n const isAppRelativePath = searchParams.get('isAppRelativePath') === '1'\n if (isAppRelativePath) {\n const relativeFilePath = searchParams.get('file') || ''\n const appPath = path.join(\n 'app',\n isSrcDir ? 'src' : '',\n relativeFilePath\n )\n openEditorResult = await openFileInEditor(appPath, 1, 1, rootDirectory)\n } else {\n // TODO: How do we differentiate layers and actual file paths with round brackets?\n // frame files may start with their webpack layer, like (middleware)/middleware.js\n const filePath = frame.file.replace(/^\\([^)]+\\)\\//, '')\n openEditorResult = await openFileInEditor(\n filePath,\n frame.line1,\n frame.column1 ?? 1,\n rootDirectory\n )\n }\n if (openEditorResult.error) {\n console.error('Failed to launch editor:', openEditorResult.error)\n return middlewareResponse.internalServerError(\n res,\n openEditorResult.error\n )\n }\n if (!openEditorResult.found) {\n return middlewareResponse.notFound(res)\n }\n return middlewareResponse.noContent(res)\n }\n\n return next()\n }\n}\n\nexport function getSourceMapMiddleware(options: {\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n}) {\n const { clientStats, serverStats, edgeServerStats } = options\n\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(`http://n${req.url}`)\n\n if (pathname !== '/__nextjs_source-map') {\n return next()\n }\n\n const filename = searchParams.get('filename')\n\n if (!filename) {\n return middlewareResponse.badRequest(res)\n }\n\n let source: Source | undefined\n\n try {\n source = await getSource(\n {\n file: filename,\n // Webpack doesn't use Index Source Maps\n line1: null,\n column1: null,\n },\n {\n getCompilations: () => {\n const compilations: webpack.Compilation[] = []\n\n for (const stats of [\n clientStats(),\n serverStats(),\n edgeServerStats(),\n ]) {\n if (stats?.compilation) {\n compilations.push(stats.compilation)\n }\n }\n\n return compilations\n },\n }\n )\n } catch (error) {\n return middlewareResponse.internalServerError(res, error)\n }\n\n if (!source) {\n return middlewareResponse.noContent(res)\n }\n\n return middlewareResponse.json(res, source.sourceMap)\n }\n}\n"],"names":["findSourceMap","path","fileURLToPath","pathToFileURL","SourceMapConsumer","getSourceMapFromFile","devirtualizeReactServerURL","findApplicableSourceMapPayload","sourceMapIgnoreListsEverything","openFileInEditor","getOriginalCodeFrame","ignoreListAnonymousStackFramesIfSandwiched","middlewareResponse","formatFrameSourceFile","inspect","shouldIgnoreSource","sourceURL","includes","startsWith","getModuleById","id","compilation","chunkGraph","modules","find","module","getModuleId","findModuleNotFoundFromError","errorMessage","match","getSourcePath","source","replace","findOriginalSourcePositionAndContent","sourceMap","position","consumer","cause","console","error","Error","file","sourcePosition","originalPositionFor","line","line1","column","column1","sourceContent","sourceContentFor","destroy","getIgnoredSources","ignoreList","Set","moduleFilenames","sources","index","length","webpackSourceURL","formattedFilePath","add","ignoredSources","map","url","ignored","has","indexOf","content","sourcesContent","isIgnoredSource","ignoredSource","findOriginalSourcePositionAndContentFromCompilation","moduleId","importedModule","buildInfo","importLocByPath","get","createOriginalStackFrame","ignoredByDefault","rootDirectory","frame","moduleNotFound","result","type","undefined","moduleURL","sourcePath","filePath","resolve","resolvedFilePath","relative","traced","methodName","arguments","originalStackFrame","originalCodeFrame","getSourceMapFromCompilation","codeGenerationResult","codeGenerationResults","err","getSource","options","getCompilations","nativeSourceMap","sourceMapPayload","payload","isAbsolute","href","getOriginalStackFrames","isServer","isEdgeServer","isAppDirectory","frames","clientStats","serverStats","edgeServerStats","frameResponses","Promise","all","getOriginalStackFrame","then","value","status","reason","colors","filename","compilations","push","defaultNormalizedStackFrameLocation","defaultStackFrame","originalStackFrameResponse","getOverlayMiddleware","isSrcDir","req","res","next","pathname","searchParams","URL","method","badRequest","body","reject","data","on","chunk","JSON","parse","json","parseInt","getAll","filter","Boolean","openEditorResult","isAppRelativePath","relativeFilePath","appPath","join","internalServerError","found","notFound","noContent","getSourceMapMiddleware","stats"],"mappings":"AAAA,SAASA,aAAa,QAAwB,kCAAiC;AAC/E,OAAOC,UAAU,OAAM;AACvB,SAASC,aAAa,EAAEC,aAAa,QAAQ,MAAK;AAClD,SAASC,iBAAiB,QAAQ,kCAAiC;AACnE,SAASC,oBAAoB,QAAQ,6BAA4B;AACjE,SACEC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,8BAA8B,QAGzB,qBAAoB;AAC3B,SAASC,gBAAgB,QAAQ,2CAA0C;AAC3E,SACEC,oBAAoB,EACpBC,0CAA0C,QAMrC,oCAAmC;AAC1C,SAASC,kBAAkB,QAAQ,iDAAgD;AAQnF,SAASC,qBAAqB,QAAQ,iDAAgD;AAEtF,SAASC,OAAO,QAAQ,OAAM;AAE9B,SAASC,mBAAmBC,SAAiB;IAC3C,OACEA,UAAUC,QAAQ,CAAC,mB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AOnJ,mBAAmBoJ,QAAQ,CAAC1B;YACrC;YACA,OAAO1H,mBAAmBqJ,SAAS,CAAC3B;QACtC;QAEA,OAAOC;IACT;AACF;AAEA,OAAO,SAAS2B,uBAAuB7D,OAItC;IACC,MAAM,EAAEY,WAAW,EAAEC,WAAW,EAAEC,eAAe,EAAE,GAAGd;IAEtD,OAAO,eACLgC,GAAoB,EACpBC,GAAmB,EACnBC,IAAgB;QAEhB,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAG,IAAIC,IAAI,CAAC,QAAQ,EAAEL,IAAItE,GAAG,EAAE;QAE/D,IAAIyE,aAAa,wBAAwB;YACvC,OAAOD;QACT;QAEA,MAAMV,WAAWY,aAAa7D,GAAG,CAAC;QAElC,IAAI,CAACiD,UAAU;YACb,OAAOjH,mBAAmBgI,UAAU,CAACN;QACvC;QAEA,IAAIvG;QAEJ,IAAI;YACFA,SAAS,MAAMqE,UACb;gBACE3D,MAAMoF;gBACN,wCAAwC;gBACxChF,OAAO;gBACPE,SAAS;YACX,GACA;gBACEuD,iBAAiB;oBACf,MAAMwB,eAAsC,EAAE;oBAE9C,KAAK,MAAMqC,SAAS;wBAClBlD;wBACAC;wBACAC;qBACD,CAAE;wBACD,IAAIgD,yBAAAA,MAAO9I,WAAW,EAAE;4BACtByG,aAAaC,IAAI,CAACoC,MAAM9I,WAAW;wBACrC;oBACF;oBAEA,OAAOyG;gBACT;YACF;QAEJ,EAAE,OAAOvF,OAAO;YACd,OAAO3B,mBAAmBkJ,mBAAmB,CAACxB,KAAK/F;QACrD;QAEA,IAAI,CAACR,QAAQ;YACX,OAAOnB,mBAAmBqJ,SAAS,CAAC3B;QACtC;QAEA,OAAO1H,mBAAmBwI,IAAI,CAACd,KAAKvG,OAAOG,SAAS;IACtD;AACF","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/server/dev/middleware-webpack.ts"],"sourcesContent":["import { findSourceMap, type SourceMap } from '../../lib/module-loader-adapter'\nimport path from 'path'\nimport { fileURLToPath, pathToFileURL } from 'url'\nimport { SourceMapConsumer } from 'next/dist/compiled/source-map08'\nimport { getSourceMapFromFile } from './get-source-map-from-file'\nimport {\n devirtualizeReactServerURL,\n findApplicableSourceMapPayload,\n sourceMapIgnoreListsEverything,\n type BasicSourceMapPayload,\n type ModernSourceMapPayload,\n} from '../lib/source-maps'\nimport { openFileInEditor } from '../../next-devtools/server/launch-editor'\nimport {\n getOriginalCodeFrame,\n ignoreListAnonymousStackFramesIfSandwiched,\n type StackFrame,\n type IgnorableStackFrame,\n type OriginalStackFrameResponse,\n type OriginalStackFramesRequest,\n type OriginalStackFramesResponse,\n} from '../../next-devtools/server/shared'\nimport { middlewareResponse } from '../../next-devtools/server/middleware-response'\n\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type webpack from 'webpack'\nimport type {\n NullableMappedPosition,\n RawSourceMap,\n} from 'next/dist/compiled/source-map08'\nimport { formatFrameSourceFile } from '../../next-devtools/shared/webpack-module-path'\nimport type { MappedPosition } from 'source-map'\nimport { inspect } from 'util'\n\nfunction shouldIgnoreSource(sourceURL: string): boolean {\n return (\n sourceURL.includes('node_modules') ||\n // Only relevant for when Next.js is symlinked e.g. in the Next.js monorepo\n sourceURL.includes('next/dist') ||\n sourceURL.startsWith('node:')\n )\n}\n\ntype IgnoredSources = Array<{ url: string; ignored: boolean }>\n\ntype SourceAttributes = {\n sourcePosition: NullableMappedPosition\n sourceContent: string | null\n}\n\ntype Source =\n | {\n type: 'file'\n sourceMap: BasicSourceMapPayload\n ignoredSources: IgnoredSources\n moduleURL: string\n }\n | {\n type: 'bundle'\n sourceMap: BasicSourceMapPayload\n ignoredSources: IgnoredSources\n compilation: webpack.Compilation\n moduleId: string\n moduleURL: string\n }\n\nfunction getModuleById(\n id: string | undefined,\n compilation: webpack.Compilation\n) {\n const { chunkGraph, modules } = compilation\n\n return [...modules].find((module) => chunkGraph.getModuleId(module) === id)\n}\n\nfunction findModuleNotFoundFromError(errorMessage: string | undefined) {\n return errorMessage?.match(/'([^']+)' module/)?.[1]\n}\n\nfunction getSourcePath(source: string) {\n if (source.startsWith('file://')) {\n return fileURLToPath(source)\n }\n return source.replace(/^(webpack:\\/\\/\\/|webpack:\\/\\/|webpack:\\/\\/_N_E\\/)/, '')\n}\n\n/**\n * @returns 1-based lines and 0-based columns\n */\nasync function findOriginalSourcePositionAndContent(\n sourceMap: ModernSourceMapPayload,\n position: { line1: number | null; column1: number | null }\n): Promise<SourceAttributes | null> {\n let consumer: SourceMapConsumer\n try {\n consumer = await new SourceMapConsumer(sourceMap)\n } catch (cause) {\n console.error(\n new Error(\n `${sourceMap.file}: Invalid source map. Only conformant source maps can be used to find the original code.`,\n { cause }\n )\n )\n return null\n }\n\n try {\n const sourcePosition = consumer.originalPositionFor({\n line: position.line1 ?? 1,\n // 0-based columns out requires 0-based columns in.\n column: (position.column1 ?? 1) - 1,\n })\n\n if (!sourcePosition.source) {\n return null\n }\n\n const sourceContent: string | null =\n consumer.sourceContentFor(\n sourcePosition.source,\n /* returnNullOnMissing */ true\n ) ?? null\n\n return {\n sourcePosition,\n sourceContent,\n }\n } finally {\n consumer.destroy()\n }\n}\n\nexport function getIgnoredSources(\n sourceMap: RawSourceMap & { ignoreList?: number[] }\n): IgnoredSources {\n const ignoreList = new Set<number>(sourceMap.ignoreList ?? [])\n const moduleFilenames = sourceMap?.sources ?? []\n\n for (let index = 0; index < moduleFilenames.length; index++) {\n // bundlerFilePath case: webpack://./app/page.tsx\n const webpackSourceURL = moduleFilenames[index]\n // Format the path to the normal file path\n const formattedFilePath = formatFrameSourceFile(webpackSourceURL)\n if (shouldIgnoreSource(formattedFilePath)) {\n ignoreList.add(index)\n }\n }\n\n const ignoredSources = sourceMap.sources.map((source, index) => {\n return {\n url: source,\n ignored: ignoreList.has(sourceMap.sources.indexOf(source)),\n content: sourceMap.sourcesContent?.[index] ?? null,\n }\n })\n return ignoredSources\n}\n\nfunction isIgnoredSource(\n source: Source,\n sourcePosition: MappedPosition | NullableMappedPosition\n) {\n if (sourcePosition.source == null) {\n return true\n }\n for (const ignoredSource of source.ignoredSources) {\n if (ignoredSource.ignored && ignoredSource.url === sourcePosition.source) {\n return true\n }\n }\n\n return false\n}\n\nfunction findOriginalSourcePositionAndContentFromCompilation(\n moduleId: string | undefined,\n importedModule: string,\n compilation: webpack.Compilation\n): SourceAttributes | null {\n const module = getModuleById(moduleId, compilation)\n return module?.buildInfo?.importLocByPath?.get(importedModule) ?? null\n}\n\nexport async function createOriginalStackFrame({\n ignoredByDefault,\n source,\n rootDirectory,\n frame,\n errorMessage,\n}: {\n /** setting this to true will not consult ignoreList */\n ignoredByDefault: boolean\n source: Source\n rootDirectory: string\n frame: StackFrame\n errorMessage?: string\n}): Promise<OriginalStackFrameResponse | null> {\n const moduleNotFound = findModuleNotFoundFromError(errorMessage)\n const result = await (() => {\n if (moduleNotFound) {\n if (source.type === 'file') {\n return undefined\n }\n\n return findOriginalSourcePositionAndContentFromCompilation(\n source.moduleId,\n moduleNotFound,\n source.compilation\n )\n }\n return findOriginalSourcePositionAndContent(source.sourceMap, frame)\n })()\n\n if (!result) {\n return null\n }\n const { sourcePosition, sourceContent } = result\n\n if (!sourcePosition.source) {\n return null\n }\n\n const ignored =\n ignoredByDefault ||\n isIgnoredSource(source, sourcePosition) ||\n // If the source file is externals, should be excluded even it's not ignored source.\n // e.g. webpack://next/dist/.. needs to be ignored\n shouldIgnoreSource(source.moduleURL)\n\n const sourcePath = getSourcePath(\n // When sourcePosition.source is the loader path the modulePath is generally better.\n (sourcePosition.source!.includes('|')\n ? source.moduleURL\n : sourcePosition.source) || source.moduleURL\n )\n const filePath = path.resolve(rootDirectory, sourcePath)\n const resolvedFilePath = path.relative(rootDirectory, filePath)\n\n const traced: IgnorableStackFrame = {\n file: resolvedFilePath,\n line1: sourcePosition.line,\n column1: sourcePosition.column === null ? null : sourcePosition.column + 1,\n methodName:\n // We ignore the sourcemapped name since it won't be the correct name.\n // The callsite will point to the column of the variable name instead of the\n // name of the enclosing function.\n // TODO(NDX-531): Spy on prepareStackTrace to get the enclosing line number for method name mapping.\n // default is not a valid identifier in JS so webpack uses a custom variable when it's an unnamed default export\n // Resolve it back to `default` for the method name if the source position didn't have the method.\n frame.methodName\n ?.replace('__WEBPACK_DEFAULT_EXPORT__', 'default')\n ?.replace('__webpack_exports__.', ''),\n arguments: [],\n ignored,\n }\n\n return {\n originalStackFrame: traced,\n originalCodeFrame: getOriginalCodeFrame(traced, sourceContent),\n }\n}\n\nasync function getSourceMapFromCompilation(\n id: string,\n compilation: webpack.Compilation\n): Promise<RawSourceMap | undefined> {\n try {\n const module = getModuleById(id, compilation)\n\n if (!module) {\n return undefined\n }\n\n // @ts-expect-error The types for `CodeGenerationResults.get` require a\n // runtime to be passed as second argument, but apparently it also works\n // without it.\n const codeGenerationResult = compilation.codeGenerationResults.get(module)\n const source = codeGenerationResult?.sources.get('javascript')\n\n return source?.map() ?? undefined\n } catch (err) {\n console.error(`Failed to lookup module by ID (\"${id}\"):`, err)\n return undefined\n }\n}\n\nasync function getSource(\n frame: {\n file: string | null\n line1: number | null\n column1: number | null\n },\n options: {\n getCompilations: () => webpack.Compilation[]\n }\n): Promise<Source | undefined> {\n let sourceURL = frame.file ?? ''\n const { getCompilations } = options\n\n sourceURL = devirtualizeReactServerURL(sourceURL)\n\n let nativeSourceMap: SourceMap | undefined\n try {\n nativeSourceMap = findSourceMap(sourceURL)\n } catch (cause) {\n throw new Error(\n `${sourceURL}: Invalid source map. Only conformant source maps can be used to find the original code.`,\n { cause }\n )\n }\n\n if (nativeSourceMap !== undefined) {\n const sourceMapPayload = nativeSourceMap.payload as ModernSourceMapPayload\n return {\n type: 'file',\n sourceMap: findApplicableSourceMapPayload(\n (frame.line1 ?? 1) - 1,\n (frame.column1 ?? 1) - 1,\n sourceMapPayload\n )!,\n\n ignoredSources: getIgnoredSources(\n // @ts-expect-error -- TODO: Support IndexSourceMap\n sourceMapPayload\n ),\n moduleURL: sourceURL,\n }\n }\n\n if (path.isAbsolute(sourceURL)) {\n sourceURL = pathToFileURL(sourceURL).href\n }\n\n if (sourceURL.startsWith('file:')) {\n const sourceMap = await getSourceMapFromFile(sourceURL)\n return sourceMap\n ? {\n type: 'file',\n sourceMap,\n ignoredSources: getIgnoredSources(sourceMap),\n moduleURL: sourceURL,\n }\n : undefined\n }\n\n // webpack-internal:///./src/hello.tsx => ./src/hello.tsx\n // webpack://_N_E/./src/hello.tsx => ./src/hello.tsx\n const moduleId = sourceURL\n .replace(/^(webpack-internal:\\/\\/\\/|webpack:\\/\\/(_N_E\\/)?)/, '')\n .replace(/\\?\\d+$/, '')\n\n // (rsc)/./src/hello.tsx => ./src/hello.tsx\n const moduleURL = moduleId.replace(/^(\\(.*\\)\\/?)/, '')\n\n for (const compilation of getCompilations()) {\n const sourceMap = await getSourceMapFromCompilation(moduleId, compilation)\n\n if (sourceMap) {\n const ignoredSources = getIgnoredSources(sourceMap)\n return {\n type: 'bundle',\n sourceMap,\n compilation,\n moduleId,\n moduleURL,\n ignoredSources,\n }\n }\n }\n\n return undefined\n}\n\nexport async function getOriginalStackFrames({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n}: {\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n frames: readonly StackFrame[]\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n rootDirectory: string\n}): Promise<OriginalStackFramesResponse> {\n const frameResponses = await Promise.all(\n frames.map(\n (frame): Promise<OriginalStackFramesResponse[number]> =>\n getOriginalStackFrame({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frame,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n }).then(\n (value) => {\n return {\n status: 'fulfilled',\n value,\n }\n },\n (reason) => {\n let reasonStr: string\n try {\n reasonStr = inspect(reason, { colors: false })\n } catch {\n // Bun compatibility: inspect may throw on certain objects\n reasonStr = String(reason)\n }\n return {\n status: 'rejected',\n reason: reasonStr,\n }\n }\n )\n )\n )\n\n ignoreListAnonymousStackFramesIfSandwiched(frameResponses)\n\n return frameResponses\n}\n\nasync function getOriginalStackFrame({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frame,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n}: {\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n frame: StackFrame\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n rootDirectory: string\n}): Promise<OriginalStackFrameResponse> {\n const filename = frame.file ?? ''\n const source = await getSource(frame, {\n getCompilations: () => {\n const compilations: webpack.Compilation[] = []\n\n // Try Client Compilation first. In `pages` we leverage\n // `isClientError` to check. In `app` it depends on if it's a server\n // / client component and when the code throws. E.g. during HTML\n // rendering it's the server/edge compilation.\n if ((!isEdgeServer && !isServer) || isAppDirectory) {\n const compilation = clientStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n // Try Server Compilation. In `pages` this could be something\n // imported in getServerSideProps/getStaticProps as the code for\n // those is tree-shaken. In `app` this finds server components and\n // code that was imported from a server component. It also covers\n // when client component code throws during HTML rendering.\n if (isServer || isAppDirectory) {\n const compilation = serverStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n // Try Edge Server Compilation. Both cases are the same as Server\n // Compilation, main difference is that it covers `runtime: 'edge'`\n // pages/app routes.\n if (isEdgeServer || isAppDirectory) {\n const compilation = edgeServerStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n return compilations\n },\n })\n\n let defaultNormalizedStackFrameLocation = frame.file\n if (\n defaultNormalizedStackFrameLocation !== null &&\n defaultNormalizedStackFrameLocation.startsWith('file://')\n ) {\n defaultNormalizedStackFrameLocation = path.relative(\n rootDirectory,\n fileURLToPath(defaultNormalizedStackFrameLocation)\n )\n }\n // This stack frame is used for the one that couldn't locate the source or source mapped frame\n const defaultStackFrame: IgnorableStackFrame = {\n file: defaultNormalizedStackFrameLocation,\n line1: frame.line1,\n column1: frame.column1,\n methodName: frame.methodName,\n ignored: shouldIgnoreSource(filename),\n arguments: [],\n }\n if (!source) {\n // return original stack frame with no source map\n return {\n originalStackFrame: defaultStackFrame,\n originalCodeFrame: null,\n }\n }\n defaultStackFrame.ignored ||= sourceMapIgnoreListsEverything(source.sourceMap)\n\n const originalStackFrameResponse = await createOriginalStackFrame({\n ignoredByDefault: defaultStackFrame.ignored,\n frame,\n source,\n rootDirectory,\n })\n\n if (!originalStackFrameResponse) {\n return {\n originalStackFrame: defaultStackFrame,\n originalCodeFrame: null,\n }\n }\n\n return originalStackFrameResponse\n}\n\nexport function getOverlayMiddleware(options: {\n rootDirectory: string\n isSrcDir: boolean\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n}) {\n const { rootDirectory, isSrcDir, clientStats, serverStats, edgeServerStats } =\n options\n\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(`http://n${req.url}`)\n\n if (pathname === '/__nextjs_original-stack-frames') {\n if (req.method !== 'POST') {\n return middlewareResponse.badRequest(res)\n }\n\n const body = await new Promise<string>((resolve, reject) => {\n let data = ''\n req.on('data', (chunk) => {\n data += chunk\n })\n req.on('end', () => resolve(data))\n req.on('error', reject)\n })\n\n try {\n const { frames, isServer, isEdgeServer, isAppDirectory } = JSON.parse(\n body\n ) as OriginalStackFramesRequest\n\n return middlewareResponse.json(\n res,\n await getOriginalStackFrames({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n })\n )\n } catch (err) {\n return middlewareResponse.badRequest(res)\n }\n } else if (pathname === '/__nextjs_launch-editor') {\n const frame = {\n file: searchParams.get('file') as string,\n methodName: searchParams.get('methodName') as string,\n line1: parseInt(searchParams.get('line1') ?? '1', 10) || 1,\n column1: parseInt(searchParams.get('column1') ?? '1', 10) || 1,\n arguments: searchParams.getAll('arguments').filter(Boolean),\n } satisfies StackFrame\n\n if (!frame.file) return middlewareResponse.badRequest(res)\n\n let openEditorResult\n const isAppRelativePath = searchParams.get('isAppRelativePath') === '1'\n if (isAppRelativePath) {\n const relativeFilePath = searchParams.get('file') || ''\n const appPath = path.join(\n 'app',\n isSrcDir ? 'src' : '',\n relativeFilePath\n )\n openEditorResult = await openFileInEditor(appPath, 1, 1, rootDirectory)\n } else {\n // TODO: How do we differentiate layers and actual file paths with round brackets?\n // frame files may start with their webpack layer, like (middleware)/middleware.js\n const filePath = frame.file.replace(/^\\([^)]+\\)\\//, '')\n openEditorResult = await openFileInEditor(\n filePath,\n frame.line1,\n frame.column1 ?? 1,\n rootDirectory\n )\n }\n if (openEditorResult.error) {\n console.error('Failed to launch editor:', openEditorResult.error)\n return middlewareResponse.internalServerError(\n res,\n openEditorResult.error\n )\n }\n if (!openEditorResult.found) {\n return middlewareResponse.notFound(res)\n }\n return middlewareResponse.noContent(res)\n }\n\n return next()\n }\n}\n\nexport function getSourceMapMiddleware(options: {\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n}) {\n const { clientStats, serverStats, edgeServerStats } = options\n\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(`http://n${req.url}`)\n\n if (pathname !== '/__nextjs_source-map') {\n return next()\n }\n\n const filename = searchParams.get('filename')\n\n if (!filename) {\n return middlewareResponse.badRequest(res)\n }\n\n let source: Source | undefined\n\n try {\n source = await getSource(\n {\n file: filename,\n // Webpack doesn't use Index Source Maps\n line1: null,\n column1: null,\n },\n {\n getCompilations: () => {\n const compilations: webpack.Compilation[] = []\n\n for (const stats of [\n clientStats(),\n serverStats(),\n edgeServerStats(),\n ]) {\n if (stats?.compilation) {\n compilations.push(stats.compilation)\n }\n }\n\n return compilations\n },\n }\n )\n } catch (error) {\n return middlewareResponse.internalServerError(res, error)\n }\n\n if (!source) {\n return middlewareResponse.noContent(res)\n }\n\n return middlewareResponse.json(res, source.sourceMap)\n }\n}\n"],"names":["findSourceMap","path","fileURLToPath","pathToFileURL","SourceMapConsumer","getSourceMapFromFile","devirtualizeReactServerURL","findApplicableSourceMapPayload","sourceMapIgnoreListsEverything","openFileInEditor","getOriginalCodeFrame","ignoreListAnonymousStackFramesIfSandwiched","middlewareResponse","formatFrameSourceFile","inspect","shouldIgnoreSource","sourceURL","includes","startsWith","getModuleById","id","compilation","chunkGraph","modules","find","module","getModuleId","findModuleNotFoundFromError","errorMessage","match","getSourcePath","source","replace","findOriginalSourcePositionAndContent","sourceMap","position","consumer","cause","console","error","Error","file","sourcePosition","originalPositionFor","line","line1","column","column1","sourceContent","sourceContentFor","destroy","getIgnoredSources","ignoreList","Set","moduleFilenames","sources","index","length","webpackSourceURL","formattedFilePath","add","ignoredSources","map","url","ignored","has","indexOf","content","sourcesContent","isIgnoredSource","ignoredSource","findOriginalSourcePositionAndContentFromCompilation","moduleId","importedModule","buildInfo","importLocByPath","get","createOriginalStackFrame","ignoredByDefault","rootDirectory","frame","moduleNotFound","result","type","undefined","moduleURL","sourcePath","filePath","resolve","resolvedFilePath","relative","traced","methodName","arguments","originalStackFrame","originalCodeFrame","getSourceMapFromCompilation","codeGenerationResult","codeGenerationResults","err","getSource","options","getCompilations","nativeSourceMap","sourceMapPayload","payload","isAbsolute","href","getOriginalStackFrames","isServer","isEdgeServer","isAppDirectory","frames","clientStats","serverStats","edgeServerStats","frameResponses","Promise","all","getOriginalStackFrame","then","value","status","reason","reasonStr","colors","String","filename","compilations","push","defaultNormalizedStackFrameLocation","defaultStackFrame","originalStackFrameResponse","getOverlayMiddleware","isSrcDir","req","res","next","pathname","searchParams","URL","method","badRequest","body","reject","data","on","chunk","JSON","parse","json","parseInt","getAll","filter","Boolean","openEditorResult","isAppRelativePath","relativeFilePath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,MAAMqE,UACb;gBACE3D,MAAMsF;gBACN,wCAAwC;gBACxClF,OAAO;gBACPE,SAAS;YACX,GACA;gBACEuD,iBAAiB;oBACf,MAAM0B,eAAsC,EAAE;oBAE9C,KAAK,MAAMqC,SAAS;wBAClBpD;wBACAC;wBACAC;qBACD,CAAE;wBACD,IAAIkD,yBAAAA,MAAOhJ,WAAW,EAAE;4BACtB2G,aAAaC,IAAI,CAACoC,MAAMhJ,WAAW;wBACrC;oBACF;oBAEA,OAAO2G;gBACT;YACF;QAEJ,EAAE,OAAOzF,OAAO;YACd,OAAO3B,mBAAmBoJ,mBAAmB,CAACxB,KAAKjG;QACrD;QAEA,IAAI,CAACR,QAAQ;YACX,OAAOnB,mBAAmBuJ,SAAS,CAAC3B;QACtC;QAEA,OAAO5H,mBAAmB0I,IAAI,CAACd,KAAKzG,OAAOG,SAAS;IACtD;AACF","ignoreList":[0]}
|
|
@@ -20,7 +20,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
|
|
|
20
20
|
if (parts.length > 0) {
|
|
21
21
|
versionSuffix = ` (${parts.join(', ')})`;
|
|
22
22
|
}
|
|
23
|
-
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"16.0.
|
|
23
|
+
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"16.0.8"}`))}${versionSuffix}`);
|
|
24
24
|
if (appUrl) {
|
|
25
25
|
Log.bootstrap(`- Local: ${appUrl}`);
|
|
26
26
|
}
|
|
@@ -110,7 +110,7 @@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
|
|
|
110
110
|
export async function startServer(serverOptions) {
|
|
111
111
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
|
112
112
|
let { port } = serverOptions;
|
|
113
|
-
process.title = `next-server (v${"16.0.
|
|
113
|
+
process.title = `next-server (v${"16.0.8"})`;
|
|
114
114
|
let handlersReady = ()=>{};
|
|
115
115
|
let handlersError = ()=>{};
|
|
116
116
|
let handlersPromise = new Promise((resolve, reject)=>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function isStableBuild() {
|
|
2
|
-
return !"16.0.
|
|
2
|
+
return !"16.0.8"?.includes('canary') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
|
|
3
3
|
}
|
|
4
4
|
export class CanaryOnlyConfigError extends Error {
|
|
5
5
|
constructor(arg){
|
|
@@ -231,7 +231,7 @@ class HotReloaderWebpack {
|
|
|
231
231
|
this.previewProps = previewProps;
|
|
232
232
|
this.rewrites = rewrites;
|
|
233
233
|
this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
|
|
234
|
-
version: "16.0.
|
|
234
|
+
version: "16.0.8"
|
|
235
235
|
});
|
|
236
236
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
237
237
|
// of the current `next dev` invocation.
|
|
@@ -277,11 +277,18 @@ async function getOriginalStackFrames({ isServer, isEdgeServer, isAppDirectory,
|
|
|
277
277
|
value
|
|
278
278
|
};
|
|
279
279
|
}, (reason)=>{
|
|
280
|
+
let reasonStr;
|
|
281
|
+
try {
|
|
282
|
+
reasonStr = (0, _util.inspect)(reason, {
|
|
283
|
+
colors: false
|
|
284
|
+
});
|
|
285
|
+
} catch {
|
|
286
|
+
// Bun compatibility: inspect may throw on certain objects
|
|
287
|
+
reasonStr = String(reason);
|
|
288
|
+
}
|
|
280
289
|
return {
|
|
281
290
|
status: 'rejected',
|
|
282
|
-
reason:
|
|
283
|
-
colors: false
|
|
284
|
-
})
|
|
291
|
+
reason: reasonStr
|
|
285
292
|
};
|
|
286
293
|
})));
|
|
287
294
|
(0, _shared.ignoreListAnonymousStackFramesIfSandwiched)(frameResponses);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/dev/middleware-webpack.ts"],"sourcesContent":["import { findSourceMap, type SourceMap } from '../../lib/module-loader-adapter'\nimport path from 'path'\nimport { fileURLToPath, pathToFileURL } from 'url'\nimport { SourceMapConsumer } from 'next/dist/compiled/source-map08'\nimport { getSourceMapFromFile } from './get-source-map-from-file'\nimport {\n devirtualizeReactServerURL,\n findApplicableSourceMapPayload,\n sourceMapIgnoreListsEverything,\n type BasicSourceMapPayload,\n type ModernSourceMapPayload,\n} from '../lib/source-maps'\nimport { openFileInEditor } from '../../next-devtools/server/launch-editor'\nimport {\n getOriginalCodeFrame,\n ignoreListAnonymousStackFramesIfSandwiched,\n type StackFrame,\n type IgnorableStackFrame,\n type OriginalStackFrameResponse,\n type OriginalStackFramesRequest,\n type OriginalStackFramesResponse,\n} from '../../next-devtools/server/shared'\nimport { middlewareResponse } from '../../next-devtools/server/middleware-response'\n\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type webpack from 'webpack'\nimport type {\n NullableMappedPosition,\n RawSourceMap,\n} from 'next/dist/compiled/source-map08'\nimport { formatFrameSourceFile } from '../../next-devtools/shared/webpack-module-path'\nimport type { MappedPosition } from 'source-map'\nimport { inspect } from 'util'\n\nfunction shouldIgnoreSource(sourceURL: string): boolean {\n return (\n sourceURL.includes('node_modules') ||\n // Only relevant for when Next.js is symlinked e.g. in the Next.js monorepo\n sourceURL.includes('next/dist') ||\n sourceURL.startsWith('node:')\n )\n}\n\ntype IgnoredSources = Array<{ url: string; ignored: boolean }>\n\ntype SourceAttributes = {\n sourcePosition: NullableMappedPosition\n sourceContent: string | null\n}\n\ntype Source =\n | {\n type: 'file'\n sourceMap: BasicSourceMapPayload\n ignoredSources: IgnoredSources\n moduleURL: string\n }\n | {\n type: 'bundle'\n sourceMap: BasicSourceMapPayload\n ignoredSources: IgnoredSources\n compilation: webpack.Compilation\n moduleId: string\n moduleURL: string\n }\n\nfunction getModuleById(\n id: string | undefined,\n compilation: webpack.Compilation\n) {\n const { chunkGraph, modules } = compilation\n\n return [...modules].find((module) => chunkGraph.getModuleId(module) === id)\n}\n\nfunction findModuleNotFoundFromError(errorMessage: string | undefined) {\n return errorMessage?.match(/'([^']+)' module/)?.[1]\n}\n\nfunction getSourcePath(source: string) {\n if (source.startsWith('file://')) {\n return fileURLToPath(source)\n }\n return source.replace(/^(webpack:\\/\\/\\/|webpack:\\/\\/|webpack:\\/\\/_N_E\\/)/, '')\n}\n\n/**\n * @returns 1-based lines and 0-based columns\n */\nasync function findOriginalSourcePositionAndContent(\n sourceMap: ModernSourceMapPayload,\n position: { line1: number | null; column1: number | null }\n): Promise<SourceAttributes | null> {\n let consumer: SourceMapConsumer\n try {\n consumer = await new SourceMapConsumer(sourceMap)\n } catch (cause) {\n console.error(\n new Error(\n `${sourceMap.file}: Invalid source map. Only conformant source maps can be used to find the original code.`,\n { cause }\n )\n )\n return null\n }\n\n try {\n const sourcePosition = consumer.originalPositionFor({\n line: position.line1 ?? 1,\n // 0-based columns out requires 0-based columns in.\n column: (position.column1 ?? 1) - 1,\n })\n\n if (!sourcePosition.source) {\n return null\n }\n\n const sourceContent: string | null =\n consumer.sourceContentFor(\n sourcePosition.source,\n /* returnNullOnMissing */ true\n ) ?? null\n\n return {\n sourcePosition,\n sourceContent,\n }\n } finally {\n consumer.destroy()\n }\n}\n\nexport function getIgnoredSources(\n sourceMap: RawSourceMap & { ignoreList?: number[] }\n): IgnoredSources {\n const ignoreList = new Set<number>(sourceMap.ignoreList ?? [])\n const moduleFilenames = sourceMap?.sources ?? []\n\n for (let index = 0; index < moduleFilenames.length; index++) {\n // bundlerFilePath case: webpack://./app/page.tsx\n const webpackSourceURL = moduleFilenames[index]\n // Format the path to the normal file path\n const formattedFilePath = formatFrameSourceFile(webpackSourceURL)\n if (shouldIgnoreSource(formattedFilePath)) {\n ignoreList.add(index)\n }\n }\n\n const ignoredSources = sourceMap.sources.map((source, index) => {\n return {\n url: source,\n ignored: ignoreList.has(sourceMap.sources.indexOf(source)),\n content: sourceMap.sourcesContent?.[index] ?? null,\n }\n })\n return ignoredSources\n}\n\nfunction isIgnoredSource(\n source: Source,\n sourcePosition: MappedPosition | NullableMappedPosition\n) {\n if (sourcePosition.source == null) {\n return true\n }\n for (const ignoredSource of source.ignoredSources) {\n if (ignoredSource.ignored && ignoredSource.url === sourcePosition.source) {\n return true\n }\n }\n\n return false\n}\n\nfunction findOriginalSourcePositionAndContentFromCompilation(\n moduleId: string | undefined,\n importedModule: string,\n compilation: webpack.Compilation\n): SourceAttributes | null {\n const module = getModuleById(moduleId, compilation)\n return module?.buildInfo?.importLocByPath?.get(importedModule) ?? null\n}\n\nexport async function createOriginalStackFrame({\n ignoredByDefault,\n source,\n rootDirectory,\n frame,\n errorMessage,\n}: {\n /** setting this to true will not consult ignoreList */\n ignoredByDefault: boolean\n source: Source\n rootDirectory: string\n frame: StackFrame\n errorMessage?: string\n}): Promise<OriginalStackFrameResponse | null> {\n const moduleNotFound = findModuleNotFoundFromError(errorMessage)\n const result = await (() => {\n if (moduleNotFound) {\n if (source.type === 'file') {\n return undefined\n }\n\n return findOriginalSourcePositionAndContentFromCompilation(\n source.moduleId,\n moduleNotFound,\n source.compilation\n )\n }\n return findOriginalSourcePositionAndContent(source.sourceMap, frame)\n })()\n\n if (!result) {\n return null\n }\n const { sourcePosition, sourceContent } = result\n\n if (!sourcePosition.source) {\n return null\n }\n\n const ignored =\n ignoredByDefault ||\n isIgnoredSource(source, sourcePosition) ||\n // If the source file is externals, should be excluded even it's not ignored source.\n // e.g. webpack://next/dist/.. needs to be ignored\n shouldIgnoreSource(source.moduleURL)\n\n const sourcePath = getSourcePath(\n // When sourcePosition.source is the loader path the modulePath is generally better.\n (sourcePosition.source!.includes('|')\n ? source.moduleURL\n : sourcePosition.source) || source.moduleURL\n )\n const filePath = path.resolve(rootDirectory, sourcePath)\n const resolvedFilePath = path.relative(rootDirectory, filePath)\n\n const traced: IgnorableStackFrame = {\n file: resolvedFilePath,\n line1: sourcePosition.line,\n column1: sourcePosition.column === null ? null : sourcePosition.column + 1,\n methodName:\n // We ignore the sourcemapped name since it won't be the correct name.\n // The callsite will point to the column of the variable name instead of the\n // name of the enclosing function.\n // TODO(NDX-531): Spy on prepareStackTrace to get the enclosing line number for method name mapping.\n // default is not a valid identifier in JS so webpack uses a custom variable when it's an unnamed default export\n // Resolve it back to `default` for the method name if the source position didn't have the method.\n frame.methodName\n ?.replace('__WEBPACK_DEFAULT_EXPORT__', 'default')\n ?.replace('__webpack_exports__.', ''),\n arguments: [],\n ignored,\n }\n\n return {\n originalStackFrame: traced,\n originalCodeFrame: getOriginalCodeFrame(traced, sourceContent),\n }\n}\n\nasync function getSourceMapFromCompilation(\n id: string,\n compilation: webpack.Compilation\n): Promise<RawSourceMap | undefined> {\n try {\n const module = getModuleById(id, compilation)\n\n if (!module) {\n return undefined\n }\n\n // @ts-expect-error The types for `CodeGenerationResults.get` require a\n // runtime to be passed as second argument, but apparently it also works\n // without it.\n const codeGenerationResult = compilation.codeGenerationResults.get(module)\n const source = codeGenerationResult?.sources.get('javascript')\n\n return source?.map() ?? undefined\n } catch (err) {\n console.error(`Failed to lookup module by ID (\"${id}\"):`, err)\n return undefined\n }\n}\n\nasync function getSource(\n frame: {\n file: string | null\n line1: number | null\n column1: number | null\n },\n options: {\n getCompilations: () => webpack.Compilation[]\n }\n): Promise<Source | undefined> {\n let sourceURL = frame.file ?? ''\n const { getCompilations } = options\n\n sourceURL = devirtualizeReactServerURL(sourceURL)\n\n let nativeSourceMap: SourceMap | undefined\n try {\n nativeSourceMap = findSourceMap(sourceURL)\n } catch (cause) {\n throw new Error(\n `${sourceURL}: Invalid source map. Only conformant source maps can be used to find the original code.`,\n { cause }\n )\n }\n\n if (nativeSourceMap !== undefined) {\n const sourceMapPayload = nativeSourceMap.payload as ModernSourceMapPayload\n return {\n type: 'file',\n sourceMap: findApplicableSourceMapPayload(\n (frame.line1 ?? 1) - 1,\n (frame.column1 ?? 1) - 1,\n sourceMapPayload\n )!,\n\n ignoredSources: getIgnoredSources(\n // @ts-expect-error -- TODO: Support IndexSourceMap\n sourceMapPayload\n ),\n moduleURL: sourceURL,\n }\n }\n\n if (path.isAbsolute(sourceURL)) {\n sourceURL = pathToFileURL(sourceURL).href\n }\n\n if (sourceURL.startsWith('file:')) {\n const sourceMap = await getSourceMapFromFile(sourceURL)\n return sourceMap\n ? {\n type: 'file',\n sourceMap,\n ignoredSources: getIgnoredSources(sourceMap),\n moduleURL: sourceURL,\n }\n : undefined\n }\n\n // webpack-internal:///./src/hello.tsx => ./src/hello.tsx\n // webpack://_N_E/./src/hello.tsx => ./src/hello.tsx\n const moduleId = sourceURL\n .replace(/^(webpack-internal:\\/\\/\\/|webpack:\\/\\/(_N_E\\/)?)/, '')\n .replace(/\\?\\d+$/, '')\n\n // (rsc)/./src/hello.tsx => ./src/hello.tsx\n const moduleURL = moduleId.replace(/^(\\(.*\\)\\/?)/, '')\n\n for (const compilation of getCompilations()) {\n const sourceMap = await getSourceMapFromCompilation(moduleId, compilation)\n\n if (sourceMap) {\n const ignoredSources = getIgnoredSources(sourceMap)\n return {\n type: 'bundle',\n sourceMap,\n compilation,\n moduleId,\n moduleURL,\n ignoredSources,\n }\n }\n }\n\n return undefined\n}\n\nexport async function getOriginalStackFrames({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n}: {\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n frames: readonly StackFrame[]\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n rootDirectory: string\n}): Promise<OriginalStackFramesResponse> {\n const frameResponses = await Promise.all(\n frames.map(\n (frame): Promise<OriginalStackFramesResponse[number]> =>\n getOriginalStackFrame({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frame,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n }).then(\n (value) => {\n return {\n status: 'fulfilled',\n value,\n }\n },\n (reason) => {\n return {\n status: 'rejected',\n reason: inspect(reason, { colors: false }),\n }\n }\n )\n )\n )\n\n ignoreListAnonymousStackFramesIfSandwiched(frameResponses)\n\n return frameResponses\n}\n\nasync function getOriginalStackFrame({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frame,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n}: {\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n frame: StackFrame\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n rootDirectory: string\n}): Promise<OriginalStackFrameResponse> {\n const filename = frame.file ?? ''\n const source = await getSource(frame, {\n getCompilations: () => {\n const compilations: webpack.Compilation[] = []\n\n // Try Client Compilation first. In `pages` we leverage\n // `isClientError` to check. In `app` it depends on if it's a server\n // / client component and when the code throws. E.g. during HTML\n // rendering it's the server/edge compilation.\n if ((!isEdgeServer && !isServer) || isAppDirectory) {\n const compilation = clientStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n // Try Server Compilation. In `pages` this could be something\n // imported in getServerSideProps/getStaticProps as the code for\n // those is tree-shaken. In `app` this finds server components and\n // code that was imported from a server component. It also covers\n // when client component code throws during HTML rendering.\n if (isServer || isAppDirectory) {\n const compilation = serverStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n // Try Edge Server Compilation. Both cases are the same as Server\n // Compilation, main difference is that it covers `runtime: 'edge'`\n // pages/app routes.\n if (isEdgeServer || isAppDirectory) {\n const compilation = edgeServerStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n return compilations\n },\n })\n\n let defaultNormalizedStackFrameLocation = frame.file\n if (\n defaultNormalizedStackFrameLocation !== null &&\n defaultNormalizedStackFrameLocation.startsWith('file://')\n ) {\n defaultNormalizedStackFrameLocation = path.relative(\n rootDirectory,\n fileURLToPath(defaultNormalizedStackFrameLocation)\n )\n }\n // This stack frame is used for the one that couldn't locate the source or source mapped frame\n const defaultStackFrame: IgnorableStackFrame = {\n file: defaultNormalizedStackFrameLocation,\n line1: frame.line1,\n column1: frame.column1,\n methodName: frame.methodName,\n ignored: shouldIgnoreSource(filename),\n arguments: [],\n }\n if (!source) {\n // return original stack frame with no source map\n return {\n originalStackFrame: defaultStackFrame,\n originalCodeFrame: null,\n }\n }\n defaultStackFrame.ignored ||= sourceMapIgnoreListsEverything(source.sourceMap)\n\n const originalStackFrameResponse = await createOriginalStackFrame({\n ignoredByDefault: defaultStackFrame.ignored,\n frame,\n source,\n rootDirectory,\n })\n\n if (!originalStackFrameResponse) {\n return {\n originalStackFrame: defaultStackFrame,\n originalCodeFrame: null,\n }\n }\n\n return originalStackFrameResponse\n}\n\nexport function getOverlayMiddleware(options: {\n rootDirectory: string\n isSrcDir: boolean\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n}) {\n const { rootDirectory, isSrcDir, clientStats, serverStats, edgeServerStats } =\n options\n\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(`http://n${req.url}`)\n\n if (pathname === '/__nextjs_original-stack-frames') {\n if (req.method !== 'POST') {\n return middlewareResponse.badRequest(res)\n }\n\n const body = await new Promise<string>((resolve, reject) => {\n let data = ''\n req.on('data', (chunk) => {\n data += chunk\n })\n req.on('end', () => resolve(data))\n req.on('error', reject)\n })\n\n try {\n const { frames, isServer, isEdgeServer, isAppDirectory } = JSON.parse(\n body\n ) as OriginalStackFramesRequest\n\n return middlewareResponse.json(\n res,\n await getOriginalStackFrames({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n })\n )\n } catch (err) {\n return middlewareResponse.badRequest(res)\n }\n } else if (pathname === '/__nextjs_launch-editor') {\n const frame = {\n file: searchParams.get('file') as string,\n methodName: searchParams.get('methodName') as string,\n line1: parseInt(searchParams.get('line1') ?? '1', 10) || 1,\n column1: parseInt(searchParams.get('column1') ?? '1', 10) || 1,\n arguments: searchParams.getAll('arguments').filter(Boolean),\n } satisfies StackFrame\n\n if (!frame.file) return middlewareResponse.badRequest(res)\n\n let openEditorResult\n const isAppRelativePath = searchParams.get('isAppRelativePath') === '1'\n if (isAppRelativePath) {\n const relativeFilePath = searchParams.get('file') || ''\n const appPath = path.join(\n 'app',\n isSrcDir ? 'src' : '',\n relativeFilePath\n )\n openEditorResult = await openFileInEditor(appPath, 1, 1, rootDirectory)\n } else {\n // TODO: How do we differentiate layers and actual file paths with round brackets?\n // frame files may start with their webpack layer, like (middleware)/middleware.js\n const filePath = frame.file.replace(/^\\([^)]+\\)\\//, '')\n openEditorResult = await openFileInEditor(\n filePath,\n frame.line1,\n frame.column1 ?? 1,\n rootDirectory\n )\n }\n if (openEditorResult.error) {\n console.error('Failed to launch editor:', openEditorResult.error)\n return middlewareResponse.internalServerError(\n res,\n openEditorResult.error\n )\n }\n if (!openEditorResult.found) {\n return middlewareResponse.notFound(res)\n }\n return middlewareResponse.noContent(res)\n }\n\n return next()\n }\n}\n\nexport function getSourceMapMiddleware(options: {\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n}) {\n const { clientStats, serverStats, edgeServerStats } = options\n\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(`http://n${req.url}`)\n\n if (pathname !== '/__nextjs_source-map') {\n return next()\n }\n\n const filename = searchParams.get('filename')\n\n if (!filename) {\n return middlewareResponse.badRequest(res)\n }\n\n let source: Source | undefined\n\n try {\n source = await getSource(\n {\n file: filename,\n // Webpack doesn't use Index Source Maps\n line1: null,\n column1: null,\n },\n {\n getCompilations: () => {\n const compilations: webpack.Compilation[] = []\n\n for (const stats of [\n clientStats(),\n serverStats(),\n edgeServerStats(),\n ]) {\n if (stats?.compilation) {\n compilations.push(stats.compilation)\n }\n }\n\n return compilations\n },\n }\n )\n } catch (error) {\n return middlewareResponse.internalServerError(res, error)\n }\n\n if (!source) {\n return middlewareResponse.noContent(res)\n }\n\n return middlewareResponse.json(res, source.sourceMap)\n }\n}\n"],"names":["createOriginalStackFrame","getIgnoredSources","getOriginalStackFrames","getOverlayMiddleware","getSourceMapMiddleware","shouldIgnoreSource","sourceURL","includes","startsWith","getModuleById","id","compilation","chunkGraph","modules","find","module","getModuleId","findModuleNotFoundFromError","errorMessage","match","getSourcePath","source","fileURLToPath","replace","findOriginalSourcePositionAndContent","sourceMap","position","consumer","SourceMapConsumer","cause","console","error","Error","file","sourcePosition","originalPositionFor","line","line1","column","column1","sourceContent","sourceContentFor","destroy","ignoreList","Set","moduleFilenames","sources","index","length","webpackSourceURL","formattedFilePath","formatFrameSourceFile","add","ignoredSources","map","url","ignored","has","indexOf","content","sourcesContent","isIgnoredSource","ignoredSource","findOriginalSourcePositionAndContentFromCompilation","moduleId","importedModule","buildInfo","importLocByPath","get","ignoredByDefault","rootDirectory","frame","moduleNotFound","result","type","undefined","moduleURL","sourcePath","filePath","path","resolve","resolvedFilePath","relative","traced","methodName","arguments","originalStackFrame","originalCodeFrame","getOriginalCodeFrame","getSourceMapFromCompilation","codeGenerationResult","codeGenerationResults","err","getSource","options","getCompilations","devirtualizeReactServerURL","nativeSourceMap","findSourceMap","sourceMapPayload","payload","findApplicableSourceMapPayload","isAbsolute","pathToFileURL","href","getSourceMapFromFile","isServer","isEdgeServer","isAppDirectory","frames","clientStats","serverStats","edgeServerStats","frameResponses","Promise","all","getOriginalStackFrame","then","value","status","reason","inspect","colors","ignoreListAnonymousStackFramesIfSandwiched","filename","compilations","push","defaultNormalizedStackFrameLocation","defaultStackFrame","sourceMapIgnoreListsEverything","originalStackFrameResponse","isSrcDir","req","res","next","pathname","searchParams","URL","method","middlewareResponse","badRequest","body","reject","data","on","chunk","JSON","parse","json","parseInt","getAll","filter","Boolean","openEditorResult","isAppRelativePath","relativeFilePath","appPath","join","openFileInEditor","internalServerError","found","notFound","noContent","stats"],"mappings":";;;;;;;;;;;;;;;;;;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,CAAE;wBACD,IAAImD,yBAAAA,MAAOxJ,WAAW,EAAE;4BACtBkH,aAAaC,IAAI,CAACqC,MAAMxJ,WAAW;wBACrC;oBACF;oBAEA,OAAOkH;gBACT;YACF;QAEJ,EAAE,OAAO9F,OAAO;YACd,OAAO4G,sCAAkB,CAACoB,mBAAmB,CAAC1B,KAAKtG;QACrD;QAEA,IAAI,CAACV,QAAQ;YACX,OAAOsH,sCAAkB,CAACuB,SAAS,CAAC7B;QACtC;QAEA,OAAOM,sCAAkB,CAACS,IAAI,CAACf,KAAKhH,OAAOI,SAAS;IACtD;AACF","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../../src/server/dev/middleware-webpack.ts"],"sourcesContent":["import { findSourceMap, type SourceMap } from '../../lib/module-loader-adapter'\nimport path from 'path'\nimport { fileURLToPath, pathToFileURL } from 'url'\nimport { SourceMapConsumer } from 'next/dist/compiled/source-map08'\nimport { getSourceMapFromFile } from './get-source-map-from-file'\nimport {\n devirtualizeReactServerURL,\n findApplicableSourceMapPayload,\n sourceMapIgnoreListsEverything,\n type BasicSourceMapPayload,\n type ModernSourceMapPayload,\n} from '../lib/source-maps'\nimport { openFileInEditor } from '../../next-devtools/server/launch-editor'\nimport {\n getOriginalCodeFrame,\n ignoreListAnonymousStackFramesIfSandwiched,\n type StackFrame,\n type IgnorableStackFrame,\n type OriginalStackFrameResponse,\n type OriginalStackFramesRequest,\n type OriginalStackFramesResponse,\n} from '../../next-devtools/server/shared'\nimport { middlewareResponse } from '../../next-devtools/server/middleware-response'\n\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type webpack from 'webpack'\nimport type {\n NullableMappedPosition,\n RawSourceMap,\n} from 'next/dist/compiled/source-map08'\nimport { formatFrameSourceFile } from '../../next-devtools/shared/webpack-module-path'\nimport type { MappedPosition } from 'source-map'\nimport { inspect } from 'util'\n\nfunction shouldIgnoreSource(sourceURL: string): boolean {\n return (\n sourceURL.includes('node_modules') ||\n // Only relevant for when Next.js is symlinked e.g. in the Next.js monorepo\n sourceURL.includes('next/dist') ||\n sourceURL.startsWith('node:')\n )\n}\n\ntype IgnoredSources = Array<{ url: string; ignored: boolean }>\n\ntype SourceAttributes = {\n sourcePosition: NullableMappedPosition\n sourceContent: string | null\n}\n\ntype Source =\n | {\n type: 'file'\n sourceMap: BasicSourceMapPayload\n ignoredSources: IgnoredSources\n moduleURL: string\n }\n | {\n type: 'bundle'\n sourceMap: BasicSourceMapPayload\n ignoredSources: IgnoredSources\n compilation: webpack.Compilation\n moduleId: string\n moduleURL: string\n }\n\nfunction getModuleById(\n id: string | undefined,\n compilation: webpack.Compilation\n) {\n const { chunkGraph, modules } = compilation\n\n return [...modules].find((module) => chunkGraph.getModuleId(module) === id)\n}\n\nfunction findModuleNotFoundFromError(errorMessage: string | undefined) {\n return errorMessage?.match(/'([^']+)' module/)?.[1]\n}\n\nfunction getSourcePath(source: string) {\n if (source.startsWith('file://')) {\n return fileURLToPath(source)\n }\n return source.replace(/^(webpack:\\/\\/\\/|webpack:\\/\\/|webpack:\\/\\/_N_E\\/)/, '')\n}\n\n/**\n * @returns 1-based lines and 0-based columns\n */\nasync function findOriginalSourcePositionAndContent(\n sourceMap: ModernSourceMapPayload,\n position: { line1: number | null; column1: number | null }\n): Promise<SourceAttributes | null> {\n let consumer: SourceMapConsumer\n try {\n consumer = await new SourceMapConsumer(sourceMap)\n } catch (cause) {\n console.error(\n new Error(\n `${sourceMap.file}: Invalid source map. Only conformant source maps can be used to find the original code.`,\n { cause }\n )\n )\n return null\n }\n\n try {\n const sourcePosition = consumer.originalPositionFor({\n line: position.line1 ?? 1,\n // 0-based columns out requires 0-based columns in.\n column: (position.column1 ?? 1) - 1,\n })\n\n if (!sourcePosition.source) {\n return null\n }\n\n const sourceContent: string | null =\n consumer.sourceContentFor(\n sourcePosition.source,\n /* returnNullOnMissing */ true\n ) ?? null\n\n return {\n sourcePosition,\n sourceContent,\n }\n } finally {\n consumer.destroy()\n }\n}\n\nexport function getIgnoredSources(\n sourceMap: RawSourceMap & { ignoreList?: number[] }\n): IgnoredSources {\n const ignoreList = new Set<number>(sourceMap.ignoreList ?? [])\n const moduleFilenames = sourceMap?.sources ?? []\n\n for (let index = 0; index < moduleFilenames.length; index++) {\n // bundlerFilePath case: webpack://./app/page.tsx\n const webpackSourceURL = moduleFilenames[index]\n // Format the path to the normal file path\n const formattedFilePath = formatFrameSourceFile(webpackSourceURL)\n if (shouldIgnoreSource(formattedFilePath)) {\n ignoreList.add(index)\n }\n }\n\n const ignoredSources = sourceMap.sources.map((source, index) => {\n return {\n url: source,\n ignored: ignoreList.has(sourceMap.sources.indexOf(source)),\n content: sourceMap.sourcesContent?.[index] ?? null,\n }\n })\n return ignoredSources\n}\n\nfunction isIgnoredSource(\n source: Source,\n sourcePosition: MappedPosition | NullableMappedPosition\n) {\n if (sourcePosition.source == null) {\n return true\n }\n for (const ignoredSource of source.ignoredSources) {\n if (ignoredSource.ignored && ignoredSource.url === sourcePosition.source) {\n return true\n }\n }\n\n return false\n}\n\nfunction findOriginalSourcePositionAndContentFromCompilation(\n moduleId: string | undefined,\n importedModule: string,\n compilation: webpack.Compilation\n): SourceAttributes | null {\n const module = getModuleById(moduleId, compilation)\n return module?.buildInfo?.importLocByPath?.get(importedModule) ?? null\n}\n\nexport async function createOriginalStackFrame({\n ignoredByDefault,\n source,\n rootDirectory,\n frame,\n errorMessage,\n}: {\n /** setting this to true will not consult ignoreList */\n ignoredByDefault: boolean\n source: Source\n rootDirectory: string\n frame: StackFrame\n errorMessage?: string\n}): Promise<OriginalStackFrameResponse | null> {\n const moduleNotFound = findModuleNotFoundFromError(errorMessage)\n const result = await (() => {\n if (moduleNotFound) {\n if (source.type === 'file') {\n return undefined\n }\n\n return findOriginalSourcePositionAndContentFromCompilation(\n source.moduleId,\n moduleNotFound,\n source.compilation\n )\n }\n return findOriginalSourcePositionAndContent(source.sourceMap, frame)\n })()\n\n if (!result) {\n return null\n }\n const { sourcePosition, sourceContent } = result\n\n if (!sourcePosition.source) {\n return null\n }\n\n const ignored =\n ignoredByDefault ||\n isIgnoredSource(source, sourcePosition) ||\n // If the source file is externals, should be excluded even it's not ignored source.\n // e.g. webpack://next/dist/.. needs to be ignored\n shouldIgnoreSource(source.moduleURL)\n\n const sourcePath = getSourcePath(\n // When sourcePosition.source is the loader path the modulePath is generally better.\n (sourcePosition.source!.includes('|')\n ? source.moduleURL\n : sourcePosition.source) || source.moduleURL\n )\n const filePath = path.resolve(rootDirectory, sourcePath)\n const resolvedFilePath = path.relative(rootDirectory, filePath)\n\n const traced: IgnorableStackFrame = {\n file: resolvedFilePath,\n line1: sourcePosition.line,\n column1: sourcePosition.column === null ? null : sourcePosition.column + 1,\n methodName:\n // We ignore the sourcemapped name since it won't be the correct name.\n // The callsite will point to the column of the variable name instead of the\n // name of the enclosing function.\n // TODO(NDX-531): Spy on prepareStackTrace to get the enclosing line number for method name mapping.\n // default is not a valid identifier in JS so webpack uses a custom variable when it's an unnamed default export\n // Resolve it back to `default` for the method name if the source position didn't have the method.\n frame.methodName\n ?.replace('__WEBPACK_DEFAULT_EXPORT__', 'default')\n ?.replace('__webpack_exports__.', ''),\n arguments: [],\n ignored,\n }\n\n return {\n originalStackFrame: traced,\n originalCodeFrame: getOriginalCodeFrame(traced, sourceContent),\n }\n}\n\nasync function getSourceMapFromCompilation(\n id: string,\n compilation: webpack.Compilation\n): Promise<RawSourceMap | undefined> {\n try {\n const module = getModuleById(id, compilation)\n\n if (!module) {\n return undefined\n }\n\n // @ts-expect-error The types for `CodeGenerationResults.get` require a\n // runtime to be passed as second argument, but apparently it also works\n // without it.\n const codeGenerationResult = compilation.codeGenerationResults.get(module)\n const source = codeGenerationResult?.sources.get('javascript')\n\n return source?.map() ?? undefined\n } catch (err) {\n console.error(`Failed to lookup module by ID (\"${id}\"):`, err)\n return undefined\n }\n}\n\nasync function getSource(\n frame: {\n file: string | null\n line1: number | null\n column1: number | null\n },\n options: {\n getCompilations: () => webpack.Compilation[]\n }\n): Promise<Source | undefined> {\n let sourceURL = frame.file ?? ''\n const { getCompilations } = options\n\n sourceURL = devirtualizeReactServerURL(sourceURL)\n\n let nativeSourceMap: SourceMap | undefined\n try {\n nativeSourceMap = findSourceMap(sourceURL)\n } catch (cause) {\n throw new Error(\n `${sourceURL}: Invalid source map. Only conformant source maps can be used to find the original code.`,\n { cause }\n )\n }\n\n if (nativeSourceMap !== undefined) {\n const sourceMapPayload = nativeSourceMap.payload as ModernSourceMapPayload\n return {\n type: 'file',\n sourceMap: findApplicableSourceMapPayload(\n (frame.line1 ?? 1) - 1,\n (frame.column1 ?? 1) - 1,\n sourceMapPayload\n )!,\n\n ignoredSources: getIgnoredSources(\n // @ts-expect-error -- TODO: Support IndexSourceMap\n sourceMapPayload\n ),\n moduleURL: sourceURL,\n }\n }\n\n if (path.isAbsolute(sourceURL)) {\n sourceURL = pathToFileURL(sourceURL).href\n }\n\n if (sourceURL.startsWith('file:')) {\n const sourceMap = await getSourceMapFromFile(sourceURL)\n return sourceMap\n ? {\n type: 'file',\n sourceMap,\n ignoredSources: getIgnoredSources(sourceMap),\n moduleURL: sourceURL,\n }\n : undefined\n }\n\n // webpack-internal:///./src/hello.tsx => ./src/hello.tsx\n // webpack://_N_E/./src/hello.tsx => ./src/hello.tsx\n const moduleId = sourceURL\n .replace(/^(webpack-internal:\\/\\/\\/|webpack:\\/\\/(_N_E\\/)?)/, '')\n .replace(/\\?\\d+$/, '')\n\n // (rsc)/./src/hello.tsx => ./src/hello.tsx\n const moduleURL = moduleId.replace(/^(\\(.*\\)\\/?)/, '')\n\n for (const compilation of getCompilations()) {\n const sourceMap = await getSourceMapFromCompilation(moduleId, compilation)\n\n if (sourceMap) {\n const ignoredSources = getIgnoredSources(sourceMap)\n return {\n type: 'bundle',\n sourceMap,\n compilation,\n moduleId,\n moduleURL,\n ignoredSources,\n }\n }\n }\n\n return undefined\n}\n\nexport async function getOriginalStackFrames({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n}: {\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n frames: readonly StackFrame[]\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n rootDirectory: string\n}): Promise<OriginalStackFramesResponse> {\n const frameResponses = await Promise.all(\n frames.map(\n (frame): Promise<OriginalStackFramesResponse[number]> =>\n getOriginalStackFrame({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frame,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n }).then(\n (value) => {\n return {\n status: 'fulfilled',\n value,\n }\n },\n (reason) => {\n let reasonStr: string\n try {\n reasonStr = inspect(reason, { colors: false })\n } catch {\n // Bun compatibility: inspect may throw on certain objects\n reasonStr = String(reason)\n }\n return {\n status: 'rejected',\n reason: reasonStr,\n }\n }\n )\n )\n )\n\n ignoreListAnonymousStackFramesIfSandwiched(frameResponses)\n\n return frameResponses\n}\n\nasync function getOriginalStackFrame({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frame,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n}: {\n isServer: boolean\n isEdgeServer: boolean\n isAppDirectory: boolean\n frame: StackFrame\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n rootDirectory: string\n}): Promise<OriginalStackFrameResponse> {\n const filename = frame.file ?? ''\n const source = await getSource(frame, {\n getCompilations: () => {\n const compilations: webpack.Compilation[] = []\n\n // Try Client Compilation first. In `pages` we leverage\n // `isClientError` to check. In `app` it depends on if it's a server\n // / client component and when the code throws. E.g. during HTML\n // rendering it's the server/edge compilation.\n if ((!isEdgeServer && !isServer) || isAppDirectory) {\n const compilation = clientStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n // Try Server Compilation. In `pages` this could be something\n // imported in getServerSideProps/getStaticProps as the code for\n // those is tree-shaken. In `app` this finds server components and\n // code that was imported from a server component. It also covers\n // when client component code throws during HTML rendering.\n if (isServer || isAppDirectory) {\n const compilation = serverStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n // Try Edge Server Compilation. Both cases are the same as Server\n // Compilation, main difference is that it covers `runtime: 'edge'`\n // pages/app routes.\n if (isEdgeServer || isAppDirectory) {\n const compilation = edgeServerStats()?.compilation\n\n if (compilation) {\n compilations.push(compilation)\n }\n }\n\n return compilations\n },\n })\n\n let defaultNormalizedStackFrameLocation = frame.file\n if (\n defaultNormalizedStackFrameLocation !== null &&\n defaultNormalizedStackFrameLocation.startsWith('file://')\n ) {\n defaultNormalizedStackFrameLocation = path.relative(\n rootDirectory,\n fileURLToPath(defaultNormalizedStackFrameLocation)\n )\n }\n // This stack frame is used for the one that couldn't locate the source or source mapped frame\n const defaultStackFrame: IgnorableStackFrame = {\n file: defaultNormalizedStackFrameLocation,\n line1: frame.line1,\n column1: frame.column1,\n methodName: frame.methodName,\n ignored: shouldIgnoreSource(filename),\n arguments: [],\n }\n if (!source) {\n // return original stack frame with no source map\n return {\n originalStackFrame: defaultStackFrame,\n originalCodeFrame: null,\n }\n }\n defaultStackFrame.ignored ||= sourceMapIgnoreListsEverything(source.sourceMap)\n\n const originalStackFrameResponse = await createOriginalStackFrame({\n ignoredByDefault: defaultStackFrame.ignored,\n frame,\n source,\n rootDirectory,\n })\n\n if (!originalStackFrameResponse) {\n return {\n originalStackFrame: defaultStackFrame,\n originalCodeFrame: null,\n }\n }\n\n return originalStackFrameResponse\n}\n\nexport function getOverlayMiddleware(options: {\n rootDirectory: string\n isSrcDir: boolean\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n}) {\n const { rootDirectory, isSrcDir, clientStats, serverStats, edgeServerStats } =\n options\n\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(`http://n${req.url}`)\n\n if (pathname === '/__nextjs_original-stack-frames') {\n if (req.method !== 'POST') {\n return middlewareResponse.badRequest(res)\n }\n\n const body = await new Promise<string>((resolve, reject) => {\n let data = ''\n req.on('data', (chunk) => {\n data += chunk\n })\n req.on('end', () => resolve(data))\n req.on('error', reject)\n })\n\n try {\n const { frames, isServer, isEdgeServer, isAppDirectory } = JSON.parse(\n body\n ) as OriginalStackFramesRequest\n\n return middlewareResponse.json(\n res,\n await getOriginalStackFrames({\n isServer,\n isEdgeServer,\n isAppDirectory,\n frames,\n clientStats,\n serverStats,\n edgeServerStats,\n rootDirectory,\n })\n )\n } catch (err) {\n return middlewareResponse.badRequest(res)\n }\n } else if (pathname === '/__nextjs_launch-editor') {\n const frame = {\n file: searchParams.get('file') as string,\n methodName: searchParams.get('methodName') as string,\n line1: parseInt(searchParams.get('line1') ?? '1', 10) || 1,\n column1: parseInt(searchParams.get('column1') ?? '1', 10) || 1,\n arguments: searchParams.getAll('arguments').filter(Boolean),\n } satisfies StackFrame\n\n if (!frame.file) return middlewareResponse.badRequest(res)\n\n let openEditorResult\n const isAppRelativePath = searchParams.get('isAppRelativePath') === '1'\n if (isAppRelativePath) {\n const relativeFilePath = searchParams.get('file') || ''\n const appPath = path.join(\n 'app',\n isSrcDir ? 'src' : '',\n relativeFilePath\n )\n openEditorResult = await openFileInEditor(appPath, 1, 1, rootDirectory)\n } else {\n // TODO: How do we differentiate layers and actual file paths with round brackets?\n // frame files may start with their webpack layer, like (middleware)/middleware.js\n const filePath = frame.file.replace(/^\\([^)]+\\)\\//, '')\n openEditorResult = await openFileInEditor(\n filePath,\n frame.line1,\n frame.column1 ?? 1,\n rootDirectory\n )\n }\n if (openEditorResult.error) {\n console.error('Failed to launch editor:', openEditorResult.error)\n return middlewareResponse.internalServerError(\n res,\n openEditorResult.error\n )\n }\n if (!openEditorResult.found) {\n return middlewareResponse.notFound(res)\n }\n return middlewareResponse.noContent(res)\n }\n\n return next()\n }\n}\n\nexport function getSourceMapMiddleware(options: {\n clientStats: () => webpack.Stats | null\n serverStats: () => webpack.Stats | null\n edgeServerStats: () => webpack.Stats | null\n}) {\n const { clientStats, serverStats, edgeServerStats } = options\n\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(`http://n${req.url}`)\n\n if (pathname !== '/__nextjs_source-map') {\n return next()\n }\n\n const filename = searchParams.get('filename')\n\n if (!filename) {\n return middlewareResponse.badRequest(res)\n }\n\n let source: Source | undefined\n\n try {\n source = await getSource(\n {\n file: filename,\n // Webpack doesn't use Index Source Maps\n line1: null,\n column1: null,\n },\n {\n getCompilations: () => {\n const compilations: webpack.Compilation[] = []\n\n for (const stats of [\n clientStats(),\n serverStats(),\n edgeServerStats(),\n ]) {\n if (stats?.compilation) {\n compilations.push(stats.compilation)\n }\n }\n\n return compilations\n },\n }\n )\n } catch (error) {\n return middlewareResponse.internalServerError(res, error)\n }\n\n if (!source) {\n return middlewareResponse.noContent(res)\n }\n\n return middlewareResponse.json(res, source.sourceMap)\n }\n}\n"],"names":["createOriginalStackFrame","getIgnoredSources","getOriginalStackFrames","getOverlayMiddleware","getSourceMapMiddleware","shouldIgnoreSource","sourceURL","includes","startsWith","getModuleById","id","compilation","chunkGraph","modules","find","module","getModuleId","findModuleNotFoundFromError","errorMessage","match","getSourcePath","source","fileURLToPath","replace","findOriginalSourcePositionAndContent","sourceMap","position","consumer","SourceMapConsumer","cause","console","error","Error","file","sourcePosition","originalPositionFor","line","line1","column","column1","sourceContent","sourceContentFor","destroy","ignoreList","Set","moduleFilenames","sources","index","length","webpackSourceURL","formattedFilePath","formatFrameSourceFile","add","ignoredSources","map","url","ignored","has","indexOf","content","sourcesContent","isIgnoredSource","ignoredSource","findOriginalSourcePositionAndContentFromCompilation","moduleId","importedModule","buildInfo","importLocByPath","get","ignoredByDefault","rootDirectory","frame","moduleNotFound","result","type","undefined","moduleURL","sourcePath","filePath","path","resolve","resolvedFilePath","relative","traced","methodName","arguments","originalStackFrame","originalCodeFrame","getOriginalCodeFrame","getSourceMapFromCompilation","codeGenerationResult","codeGenerationResults","err","getSource","options","getCompilations","devirtualizeReactServerURL","nativeSourceMap","findSourceMap","sourceMapPayload","payload","findApplicableSourceMapPayload","isAbsolute","pathToFileURL","href","getSourceMapFromFile","isServer","isEdgeServer","isAppDirectory","frames","clientStats","serverStats","edgeServerStats","frameResponses","Promise","all","getOriginalStackFrame","then","value","status","reason","reasonStr","inspect","colors","String","ignoreListAnonymousStackFramesIfSandwiched","filename","compilations","push","defaultNormalizedStackFrameLocation","defaultStackFrame","sourceMapIgnoreListsEverything","originalStackFrameResponse","isSrcDir","req","res","next","pathname","searchParams","URL","method","middlewareResponse","badRequest","body","reject","data","on","chunk","JSON","parse","json","parseInt","getAll","filter","Boolean","openEditorResult","isAppRelativePath","relativeFilePath","appPath","join","openFileInEditor","internalServerError","found","notFound","noContent","stats"],"mappings":";;;;;;;;;;;;;;;;;;IAuLsBA,wBAAwB;eAAxBA;;IAnDNC,iBAAiB;eAAjBA;;IAiPMC,sBAAsB;eAAtBA;;IAyKNC,oBAAoB;eAApBA;;IAqGAC,sBAAsB;eAAtBA;;;qCAnoB8B;6DAC7B;qBAC4B;6BACX;sCACG;4BAO9B;8BAC0B;wBAS1B;oCAC4B;mCAQG;sBAEd;;;;;;AAExB,SAASC,mBAAmBC,SAAiB;IAC3C,OACEA,UAAUC,QAAQ,CAAC,mBACnB,2EAA2E;IAC3ED,UAAUC,QAAQ,CAAC,gBACnBD,UAAUE,UAAU,CAAC;AAEzB;AAyBA,SAASC,cACPC,EAAsB,EACtBC,WAAgC;IAEhC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE,GAAGF;IAEhC,OAAO;WAAIE;KAAQ,CAACC,IAAI,CAAC,CAACC,UAAWH,WAAWI,WAAW,CAACD,aAAYL;AAC1E;AAEA,SAASO,4BAA4BC,YAAgC;QAC5DA;IAAP,OAAOA,iCAAAA,sBAAAA,aAAcC,KAAK,CAAC,wCAApBD,mBAAyC,CAAC,E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AEA,OAAOC;IACT;AACF;AAEO,SAASpI,uBAAuB0F,OAItC;IACC,MAAM,EAAEgB,WAAW,EAAEC,WAAW,EAAEC,eAAe,EAAE,GAAGlB;IAEtD,OAAO,eACLwC,GAAoB,EACpBC,GAAmB,EACnBC,IAAgB;QAEhB,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAG,IAAIC,IAAI,CAAC,QAAQ,EAAEL,IAAI/E,GAAG,EAAE;QAE/D,IAAIkF,aAAa,wBAAwB;YACvC,OAAOD;QACT;QAEA,MAAMV,WAAWY,aAAatE,GAAG,CAAC;QAElC,IAAI,CAAC0D,UAAU;YACb,OAAOe,sCAAkB,CAACC,UAAU,CAACP;QACvC;QAEA,IAAIlH;QAEJ,IAAI;YACFA,SAAS,MAAMwE,UACb;gBACE5D,MAAM6F;gBACN,wCAAwC;gBACxCzF,OAAO;gBACPE,SAAS;YACX,GACA;gBACEwD,iBAAiB;oBACf,MAAMgC,eAAsC,EAAE;oBAE9C,KAAK,MAAMsC,SAAS;wBAClBvD;wBACAC;wBACAC;qBACD,CAAE;wBACD,IAAIqD,yBAAAA,MAAO1J,WAAW,EAAE;4BACtBoH,aAAaC,IAAI,CAACqC,MAAM1J,WAAW;wBACrC;oBACF;oBAEA,OAAOoH;gBACT;YACF;QAEJ,EAAE,OAAOhG,OAAO;YACd,OAAO8G,sCAAkB,CAACoB,mBAAmB,CAAC1B,KAAKxG;QACrD;QAEA,IAAI,CAACV,QAAQ;YACX,OAAOwH,sCAAkB,CAACuB,SAAS,CAAC7B;QACtC;QAEA,OAAOM,sCAAkB,CAACS,IAAI,CAACf,KAAKlH,OAAOI,SAAS;IACtD;AACF","ignoreList":[0]}
|
|
@@ -88,7 +88,7 @@ function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, logBu
|
|
|
88
88
|
if (parts.length > 0) {
|
|
89
89
|
versionSuffix = ` (${parts.join(', ')})`;
|
|
90
90
|
}
|
|
91
|
-
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"16.0.
|
|
91
|
+
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"16.0.8"}`))}${versionSuffix}`);
|
|
92
92
|
if (appUrl) {
|
|
93
93
|
_log.bootstrap(`- Local: ${appUrl}`);
|
|
94
94
|
}
|
|
@@ -178,7 +178,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
|
|
|
178
178
|
async function startServer(serverOptions) {
|
|
179
179
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
|
180
180
|
let { port } = serverOptions;
|
|
181
|
-
process.title = `next-server (v${"16.0.
|
|
181
|
+
process.title = `next-server (v${"16.0.8"})`;
|
|
182
182
|
let handlersReady = ()=>{};
|
|
183
183
|
let handlersError = ()=>{};
|
|
184
184
|
let handlersPromise = new Promise((resolve, reject)=>{
|
|
@@ -21,7 +21,7 @@ _export(exports, {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
function isStableBuild() {
|
|
24
|
-
return !"16.0.
|
|
24
|
+
return !"16.0.8"?.includes('canary') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
|
|
25
25
|
}
|
|
26
26
|
class CanaryOnlyConfigError extends Error {
|
|
27
27
|
constructor(arg){
|
|
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "eventCliSessionStopped", {
|
|
|
11
11
|
const EVENT_VERSION = 'NEXT_CLI_SESSION_STOPPED';
|
|
12
12
|
function eventCliSessionStopped(event) {
|
|
13
13
|
// This should be an invariant, if it fails our build tooling is broken.
|
|
14
|
-
if (typeof "16.0.
|
|
14
|
+
if (typeof "16.0.8" !== 'string') {
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
17
|
const payload = {
|
|
18
|
-
nextVersion: "16.0.
|
|
18
|
+
nextVersion: "16.0.8",
|
|
19
19
|
nodeVersion: process.version,
|
|
20
20
|
cliCommand: event.cliCommand,
|
|
21
21
|
durationMilliseconds: event.durationMilliseconds,
|