next 15.0.4-canary.37 → 15.0.4-canary.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of next might be problematic. Click here for more details.

Files changed (30) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack-config.js +2 -2
  5. package/dist/client/app-bootstrap.js +1 -1
  6. package/dist/client/components/react-dev-overlay/server/middleware-turbopack.js +83 -1
  7. package/dist/client/components/react-dev-overlay/server/middleware-turbopack.js.map +1 -1
  8. package/dist/client/index.js +1 -1
  9. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  10. package/dist/esm/build/index.js +2 -2
  11. package/dist/esm/build/swc/index.js +1 -1
  12. package/dist/esm/build/webpack-config.js +2 -2
  13. package/dist/esm/client/app-bootstrap.js +1 -1
  14. package/dist/esm/client/components/react-dev-overlay/server/middleware-turbopack.js +83 -1
  15. package/dist/esm/client/components/react-dev-overlay/server/middleware-turbopack.js.map +1 -1
  16. package/dist/esm/client/index.js +1 -1
  17. package/dist/esm/server/config.js +1 -1
  18. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  19. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  20. package/dist/esm/server/lib/app-info-log.js +1 -1
  21. package/dist/esm/server/lib/start-server.js +1 -1
  22. package/dist/server/config.js +1 -1
  23. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  24. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  25. package/dist/server/lib/app-info-log.js +1 -1
  26. package/dist/server/lib/start-server.js +1 -1
  27. package/dist/telemetry/anonymous-meta.js +1 -1
  28. package/dist/telemetry/events/session-stopped.js +2 -2
  29. package/dist/telemetry/events/version.js +2 -2
  30. package/package.json +15 -15
package/dist/bin/next CHANGED
@@ -75,7 +75,7 @@ const program = new NextRootCommand();
75
75
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
76
76
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
77
77
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
78
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.0.4-canary.37"}`, '-v, --version', 'Outputs the Next.js version.');
78
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.0.4-canary.38"}`, '-v, --version', 'Outputs the Next.js version.');
79
79
  program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').addOption(new _commander.Option('--experimental-turbo').hideHelp()).addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
80
80
  'compile',
81
81
  'generate'
@@ -361,7 +361,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
361
361
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
362
362
  buildMode: experimentalBuildMode,
363
363
  isTurboBuild: String(turboNextBuild),
364
- version: "15.0.4-canary.37"
364
+ version: "15.0.4-canary.38"
365
365
  });
366
366
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
367
367
  _buildcontext.NextBuildContext.dir = dir;
@@ -764,7 +764,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
764
764
  // Files outside of the distDir can be "type": "module"
765
765
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
766
766
  // These are written to distDir, so they need to come after creating and cleaning distDr.
767
- await (0, _builddiagnostics.recordFrameworkVersion)("15.0.4-canary.37");
767
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.0.4-canary.38");
768
768
  await (0, _builddiagnostics.updateBuildDiagnostics)({
769
769
  buildStage: 'start'
770
770
  });
@@ -127,7 +127,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
127
127
  }
128
128
  return newObj;
129
129
  }
130
- const nextVersion = "15.0.4-canary.37";
130
+ const nextVersion = "15.0.4-canary.38";
131
131
  const ArchName = (0, _os.arch)();
132
132
  const PlatformName = (0, _os.platform)();
133
133
  function infoLog(...args) {
@@ -1502,7 +1502,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1502
1502
  isClient && new _copyfileplugin.CopyFilePlugin({
1503
1503
  // file path to build output of `@next/polyfill-nomodule`
1504
1504
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1505
- cacheKey: "15.0.4-canary.37",
1505
+ cacheKey: "15.0.4-canary.38",
1506
1506
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1507
1507
  minimize: false,
1508
1508
  info: {
@@ -1731,7 +1731,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1731
1731
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1732
1732
  // - Next.js version
1733
1733
  // - next.config.js keys that affect compilation
1734
- version: `${__dirname}|${"15.0.4-canary.37"}|${configVars}`,
1734
+ version: `${__dirname}|${"15.0.4-canary.38"}|${configVars}`,
1735
1735
  cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
1736
1736
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1737
1737
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "appBootstrap", {
13
13
  return appBootstrap;
14
14
  }
15
15
  });
16
- const version = "15.0.4-canary.37";
16
+ const version = "15.0.4-canary.38";
17
17
  window.next = {
18
18
  version,
19
19
  appDir: true
@@ -35,6 +35,7 @@ const _promises = /*#__PURE__*/ _interop_require_wildcard._(require("fs/promises
35
35
  const _path = /*#__PURE__*/ _interop_require_default._(require("path"));
36
36
  const _url = /*#__PURE__*/ _interop_require_default._(require("url"));
37
37
  const _launchEditor = require("../internal/helpers/launchEditor");
38
+ const _sourcemap08 = require("next/dist/compiled/source-map08");
38
39
  const _getsourcemapfromfile = require("../internal/helpers/get-source-map-from-file");
39
40
  const _nodemodule = require("node:module");
40
41
  function shouldIgnorePath(modulePath) {
@@ -108,8 +109,87 @@ function createStackFrame(searchParams) {
108
109
  isServer: searchParams.get('isServer') === 'true'
109
110
  };
110
111
  }
112
+ /**
113
+ * Finds the sourcemap payload applicable to a given frame.
114
+ * Equal to the input unless an Index Source Map is used.
115
+ */ function findApplicableSourceMapPayload(frame, payload) {
116
+ if ('sections' in payload) {
117
+ var _frame_line;
118
+ const frameLine = (_frame_line = frame.line) != null ? _frame_line : 0;
119
+ var _frame_column;
120
+ const frameColumn = (_frame_column = frame.column) != null ? _frame_column : 0;
121
+ // Sections must not overlap and must be sorted: https://tc39.es/source-map/#section-object
122
+ // Therefore the last section that has an offset less than or equal to the frame is the applicable one.
123
+ // TODO(veil): Binary search
124
+ let section = payload.sections[0];
125
+ for(let i = 0; i < payload.sections.length && payload.sections[i].offset.line <= frameLine && payload.sections[i].offset.column <= frameColumn; i++){
126
+ section = payload.sections[i];
127
+ }
128
+ return section === undefined ? undefined : section.map;
129
+ } else {
130
+ return payload;
131
+ }
132
+ }
133
+ async function nativeTraceSource(frame) {
134
+ const sourceMap = (0, _nodemodule.findSourceMap)(// TODO(veil): Why are the frames sent encoded?
135
+ decodeURIComponent(frame.file));
136
+ if (sourceMap !== undefined) {
137
+ const traced = await _sourcemap08.SourceMapConsumer.with(sourceMap.payload, null, async (consumer)=>{
138
+ var _frame_line, _frame_column;
139
+ const originalPosition = consumer.originalPositionFor({
140
+ line: (_frame_line = frame.line) != null ? _frame_line : 1,
141
+ column: (_frame_column = frame.column) != null ? _frame_column : 1
142
+ });
143
+ if (originalPosition.source === null) {
144
+ return null;
145
+ }
146
+ var _consumer_sourceContentFor;
147
+ const sourceContent = (_consumer_sourceContentFor = consumer.sourceContentFor(originalPosition.source, /* returnNullOnMissing */ true)) != null ? _consumer_sourceContentFor : null;
148
+ return {
149
+ originalPosition,
150
+ sourceContent
151
+ };
152
+ });
153
+ if (traced !== null) {
154
+ var // default is not a valid identifier in JS so webpack uses a custom variable when it's an unnamed default export
155
+ // Resolve it back to `default` for the method name if the source position didn't have the method.
156
+ _frame_methodName_replace, _frame_methodName, _originalPosition_source;
157
+ const { originalPosition, sourceContent } = traced;
158
+ const applicableSourceMap = findApplicableSourceMapPayload(frame, sourceMap.payload);
159
+ // TODO(veil): Upstream a method to sourcemap consumer that immediately says if a frame is ignored or not.
160
+ let ignored = false;
161
+ if (applicableSourceMap === undefined) {
162
+ console.error('No applicable source map found in sections for frame', frame);
163
+ } else {
164
+ var _applicableSourceMap_ignoreList;
165
+ // TODO: O(n^2). Consider moving `ignoreList` into a Set
166
+ const sourceIndex = applicableSourceMap.sources.indexOf(originalPosition.source);
167
+ var _applicableSourceMap_ignoreList_includes;
168
+ ignored = (_applicableSourceMap_ignoreList_includes = (_applicableSourceMap_ignoreList = applicableSourceMap.ignoreList) == null ? void 0 : _applicableSourceMap_ignoreList.includes(sourceIndex)) != null ? _applicableSourceMap_ignoreList_includes : false;
169
+ }
170
+ var _originalPosition_column, _originalPosition_line;
171
+ const originalStackFrame = {
172
+ methodName: originalPosition.name || ((_frame_methodName = frame.methodName) == null ? void 0 : (_frame_methodName_replace = _frame_methodName.replace('__WEBPACK_DEFAULT_EXPORT__', 'default')) == null ? void 0 : _frame_methodName_replace.replace('__webpack_exports__.', '')) || '<unknown>',
173
+ column: ((_originalPosition_column = originalPosition.column) != null ? _originalPosition_column : 0) + 1,
174
+ file: ((_originalPosition_source = originalPosition.source) == null ? void 0 : _originalPosition_source.startsWith('file://')) ? _path.default.relative(process.cwd(), _url.default.fileURLToPath(originalPosition.source)) : originalPosition.source,
175
+ lineNumber: (_originalPosition_line = originalPosition.line) != null ? _originalPosition_line : 0,
176
+ // TODO: c&p from async createOriginalStackFrame but why not frame.arguments?
177
+ arguments: [],
178
+ ignored
179
+ };
180
+ return {
181
+ frame: originalStackFrame,
182
+ source: sourceContent
183
+ };
184
+ }
185
+ }
186
+ return undefined;
187
+ }
111
188
  async function createOriginalStackFrame(project, frame) {
112
- const traced = await batchedTraceSource(project, frame);
189
+ var _ref;
190
+ const traced = (_ref = await nativeTraceSource(frame)) != null ? _ref : // TODO(veil): When would the bundler know more than native?
191
+ // If it's faster, try the bundler first and fall back to native later.
192
+ await batchedTraceSource(project, frame);
113
193
  if (!traced) {
114
194
  return null;
115
195
  }
@@ -163,6 +243,8 @@ function getSourceMapMiddleware(project) {
163
243
  if (!filename) {
164
244
  return (0, _shared.badRequest)(res);
165
245
  }
246
+ // TODO(veil): Always try the native version first.
247
+ // Externals could also be files that aren't bundled via Webpack.
166
248
  if (filename.startsWith('webpack://') || filename.startsWith('webpack-internal:///')) {
167
249
  const sourceMap = (0, _nodemodule.findSourceMap)(filename);
168
250
  if (sourceMap) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/server/middleware-turbopack.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http'\nimport {\n badRequest,\n getOriginalCodeFrame,\n internalServerError,\n json,\n jsonString,\n noContent,\n type OriginalStackFrameResponse,\n} from './shared'\n\nimport fs, { constants as FS } from 'fs/promises'\nimport path from 'path'\nimport url from 'url'\nimport { launchEditor } from '../internal/helpers/launchEditor'\nimport type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\nimport type { Project, TurbopackStackFrame } from '../../../../build/swc/types'\nimport { getSourceMapFromFile } from '../internal/helpers/get-source-map-from-file'\nimport { findSourceMap } from 'node:module'\n\nfunction shouldIgnorePath(modulePath: string): boolean {\n return (\n modulePath.includes('node_modules') ||\n // Only relevant for when Next.js is symlinked e.g. in the Next.js monorepo\n modulePath.includes('next/dist')\n )\n}\n\ntype IgnorableStackFrame = StackFrame & { ignored: boolean }\n\nconst currentSourcesByFile: Map<string, Promise<string | null>> = new Map()\nexport async function batchedTraceSource(\n project: Project,\n frame: TurbopackStackFrame\n): Promise<{ frame: IgnorableStackFrame; source: string | null } | undefined> {\n const file = frame.file ? decodeURIComponent(frame.file) : undefined\n if (!file) return\n\n const sourceFrame = await project.traceSource(frame)\n if (!sourceFrame) {\n return {\n frame: {\n file,\n lineNumber: frame.line ?? 0,\n column: frame.column ?? 0,\n methodName: frame.methodName ?? '<unknown>',\n ignored: shouldIgnorePath(frame.file),\n arguments: [],\n },\n source: null,\n }\n }\n\n let source = null\n // Don't look up source for node_modules or internals. These can often be large bundled files.\n const ignored =\n shouldIgnorePath(sourceFrame.file) ||\n // isInternal means resource starts with turbopack://[turbopack]\n !!sourceFrame.isInternal\n if (sourceFrame && sourceFrame.file && !ignored) {\n let sourcePromise = currentSourcesByFile.get(sourceFrame.file)\n if (!sourcePromise) {\n sourcePromise = project.getSourceForAsset(sourceFrame.file)\n currentSourcesByFile.set(sourceFrame.file, sourcePromise)\n setTimeout(() => {\n // Cache file reads for 100ms, as frames will often reference the same\n // files and can be large.\n currentSourcesByFile.delete(sourceFrame.file!)\n }, 100)\n }\n source = await sourcePromise\n }\n\n // TODO: get ignoredList from turbopack source map\n const ignorableFrame = {\n file: sourceFrame.file,\n lineNumber: sourceFrame.line ?? 0,\n column: sourceFrame.column ?? 0,\n methodName: sourceFrame.methodName ?? frame.methodName ?? '<unknown>',\n ignored,\n arguments: [],\n }\n\n return {\n frame: ignorableFrame,\n source,\n }\n}\n\nfunction createStackFrame(searchParams: URLSearchParams) {\n const fileParam = searchParams.get('file')\n\n if (!fileParam) {\n return undefined\n }\n\n // rsc://React/Server/file://<filename>?42 => file://<filename>\n const file = fileParam\n .replace(/^rsc:\\/\\/React\\/[^/]+\\//, '')\n .replace(/\\?\\d+$/, '')\n\n return {\n file,\n methodName: searchParams.get('methodName') ?? '<unknown>',\n line: parseInt(searchParams.get('lineNumber') ?? '0', 10) || 0,\n column: parseInt(searchParams.get('column') ?? '0', 10) || 0,\n isServer: searchParams.get('isServer') === 'true',\n } satisfies TurbopackStackFrame\n}\n\nexport async function createOriginalStackFrame(\n project: Project,\n frame: TurbopackStackFrame\n): Promise<OriginalStackFrameResponse | null> {\n const traced = await batchedTraceSource(project, frame)\n if (!traced) {\n return null\n }\n\n return {\n originalStackFrame: traced.frame,\n originalCodeFrame: getOriginalCodeFrame(traced.frame, traced.source),\n }\n}\n\nexport function getOverlayMiddleware(project: Project) {\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(req.url!, 'http://n')\n\n if (pathname === '/__nextjs_original-stack-frame') {\n const frame = createStackFrame(searchParams)\n\n if (!frame) return badRequest(res)\n\n let originalStackFrame: OriginalStackFrameResponse | null\n try {\n originalStackFrame = await createOriginalStackFrame(project, frame)\n } catch (e: any) {\n return internalServerError(res, e.message)\n }\n\n if (!originalStackFrame) {\n res.statusCode = 404\n res.end('Unable to resolve sourcemap')\n return\n }\n\n return json(res, originalStackFrame)\n } else if (pathname === '/__nextjs_launch-editor') {\n const frame = createStackFrame(searchParams)\n\n if (!frame) return badRequest(res)\n\n const fileExists = await fs.access(frame.file, FS.F_OK).then(\n () => true,\n () => false\n )\n if (!fileExists) return noContent(res)\n\n try {\n launchEditor(frame.file, frame.line ?? 1, frame.column ?? 1)\n } catch (err) {\n console.log('Failed to launch editor:', err)\n return internalServerError(res)\n }\n\n noContent(res)\n }\n\n return next()\n }\n}\n\nexport function getSourceMapMiddleware(project: Project) {\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(req.url!, 'http://n')\n\n if (pathname !== '/__nextjs_source-map') {\n return next()\n }\n\n let filename = searchParams.get('filename')\n\n if (!filename) {\n return badRequest(res)\n }\n\n if (\n filename.startsWith('webpack://') ||\n filename.startsWith('webpack-internal:///')\n ) {\n const sourceMap = findSourceMap(filename)\n\n if (sourceMap) {\n return json(res, sourceMap.payload)\n }\n\n return noContent(res)\n }\n\n try {\n // Turbopack chunk filenames might be URL-encoded.\n filename = decodeURI(filename)\n\n if (path.isAbsolute(filename)) {\n filename = url.pathToFileURL(filename).href\n }\n\n const sourceMapString = await project.getSourceMap(filename)\n\n if (sourceMapString) {\n return jsonString(res, sourceMapString)\n }\n\n if (filename.startsWith('file:')) {\n const sourceMap = await getSourceMapFromFile(filename)\n\n if (sourceMap) {\n return json(res, sourceMap)\n }\n }\n } catch (error) {\n console.error('Failed to get source map:', error)\n }\n\n noContent(res)\n }\n}\n"],"names":["batchedTraceSource","createOriginalStackFrame","getOverlayMiddleware","getSourceMapMiddleware","shouldIgnorePath","modulePath","includes","currentSourcesByFile","Map","project","frame","file","decodeURIComponent","undefined","sourceFrame","traceSource","lineNumber","line","column","methodName","ignored","arguments","source","isInternal","sourcePromise","get","getSourceForAsset","set","setTimeout","delete","ignorableFrame","createStackFrame","searchParams","fileParam","replace","parseInt","isServer","traced","originalStackFrame","originalCodeFrame","getOriginalCodeFrame","req","res","next","pathname","URL","url","badRequest","e","internalServerError","message","statusCode","end","json","fileExists","fs","access","FS","F_OK","then","noContent","launchEditor","err","console","log","filename","startsWith","sourceMap","findSourceMap","payload","decodeURI","path","isAbsolute","pathToFileURL","href","sourceMapString","getSourceMap","jsonString","getSourceMapFromFile","error"],"mappings":";;;;;;;;;;;;;;;;;IA+BsBA,kBAAkB;eAAlBA;;IA+EAC,wBAAwB;eAAxBA;;IAeNC,oBAAoB;eAApBA;;IAoDAC,sBAAsB;eAAtBA;;;;;wBAxKT;oEAE6B;+DACnB;8DACD;8BACa;sCAGQ;4BACP;AAE9B,SAASC,iBAAiBC,UAAkB;IAC1C,OACEA,WAAWC,QAAQ,CAAC,mBACpB,2EAA2E;IAC3ED,WAAWC,QAAQ,CAAC;AAExB;AAIA,MAAMC,uBAA4D,IAAIC;AAC/D,eAAeR,mBACpBS,OAAgB,EAChBC,KAA0B;IAE1B,MAAMC,OAA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U;YACb,OAAOlB,IAAAA,kBAAU,EAACL;QACpB;QAEA,IACEuB,SAASC,UAAU,CAAC,iBACpBD,SAASC,UAAU,CAAC,yBACpB;YACA,MAAMC,YAAYC,IAAAA,yBAAa,EAACH;YAEhC,IAAIE,WAAW;gBACb,OAAOd,IAAAA,YAAI,EAACX,KAAKyB,UAAUE,OAAO;YACpC;YAEA,OAAOT,IAAAA,iBAAS,EAAClB;QACnB;QAEA,IAAI;YACF,kDAAkD;YAClDuB,WAAWK,UAAUL;YAErB,IAAIM,aAAI,CAACC,UAAU,CAACP,WAAW;gBAC7BA,WAAWnB,YAAG,CAAC2B,aAAa,CAACR,UAAUS,IAAI;YAC7C;YAEA,MAAMC,kBAAkB,MAAMlE,QAAQmE,YAAY,CAACX;YAEnD,IAAIU,iBAAiB;gBACnB,OAAOE,IAAAA,kBAAU,EAACnC,KAAKiC;YACzB;YAEA,IAAIV,SAASC,UAAU,CAAC,UAAU;gBAChC,MAAMC,YAAY,MAAMW,IAAAA,0CAAoB,EAACb;gBAE7C,IAAIE,WAAW;oBACb,OAAOd,IAAAA,YAAI,EAACX,KAAKyB;gBACnB;YACF;QACF,EAAE,OAAOY,OAAO;YACdhB,QAAQgB,KAAK,CAAC,6BAA6BA;QAC7C;QAEAnB,IAAAA,iBAAS,EAAClB;IACZ;AACF"}
1
+ {"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/server/middleware-turbopack.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http'\nimport {\n badRequest,\n getOriginalCodeFrame,\n internalServerError,\n json,\n jsonString,\n noContent,\n type OriginalStackFrameResponse,\n} from './shared'\n\nimport fs, { constants as FS } from 'fs/promises'\nimport path from 'path'\nimport url from 'url'\nimport { launchEditor } from '../internal/helpers/launchEditor'\nimport type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\nimport { SourceMapConsumer } from 'next/dist/compiled/source-map08'\nimport type { Project, TurbopackStackFrame } from '../../../../build/swc/types'\nimport { getSourceMapFromFile } from '../internal/helpers/get-source-map-from-file'\nimport { findSourceMap, type SourceMapPayload } from 'node:module'\n\nfunction shouldIgnorePath(modulePath: string): boolean {\n return (\n modulePath.includes('node_modules') ||\n // Only relevant for when Next.js is symlinked e.g. in the Next.js monorepo\n modulePath.includes('next/dist')\n )\n}\n\ntype IgnorableStackFrame = StackFrame & { ignored: boolean }\n\nconst currentSourcesByFile: Map<string, Promise<string | null>> = new Map()\nexport async function batchedTraceSource(\n project: Project,\n frame: TurbopackStackFrame\n): Promise<{ frame: IgnorableStackFrame; source: string | null } | undefined> {\n const file = frame.file\n ? // TODO(veil): Why are the frames sent encoded?\n decodeURIComponent(frame.file)\n : undefined\n if (!file) return\n\n const sourceFrame = await project.traceSource(frame)\n if (!sourceFrame) {\n return {\n frame: {\n file,\n lineNumber: frame.line ?? 0,\n column: frame.column ?? 0,\n methodName: frame.methodName ?? '<unknown>',\n ignored: shouldIgnorePath(frame.file),\n arguments: [],\n },\n source: null,\n }\n }\n\n let source = null\n // Don't look up source for node_modules or internals. These can often be large bundled files.\n const ignored =\n shouldIgnorePath(sourceFrame.file) ||\n // isInternal means resource starts with turbopack://[turbopack]\n !!sourceFrame.isInternal\n if (sourceFrame && sourceFrame.file && !ignored) {\n let sourcePromise = currentSourcesByFile.get(sourceFrame.file)\n if (!sourcePromise) {\n sourcePromise = project.getSourceForAsset(sourceFrame.file)\n currentSourcesByFile.set(sourceFrame.file, sourcePromise)\n setTimeout(() => {\n // Cache file reads for 100ms, as frames will often reference the same\n // files and can be large.\n currentSourcesByFile.delete(sourceFrame.file!)\n }, 100)\n }\n source = await sourcePromise\n }\n\n // TODO: get ignoredList from turbopack source map\n const ignorableFrame = {\n file: sourceFrame.file,\n lineNumber: sourceFrame.line ?? 0,\n column: sourceFrame.column ?? 0,\n methodName: sourceFrame.methodName ?? frame.methodName ?? '<unknown>',\n ignored,\n arguments: [],\n }\n\n return {\n frame: ignorableFrame,\n source,\n }\n}\n\nfunction createStackFrame(searchParams: URLSearchParams) {\n const fileParam = searchParams.get('file')\n\n if (!fileParam) {\n return undefined\n }\n\n // rsc://React/Server/file://<filename>?42 => file://<filename>\n const file = fileParam\n .replace(/^rsc:\\/\\/React\\/[^/]+\\//, '')\n .replace(/\\?\\d+$/, '')\n\n return {\n file,\n methodName: searchParams.get('methodName') ?? '<unknown>',\n line: parseInt(searchParams.get('lineNumber') ?? '0', 10) || 0,\n column: parseInt(searchParams.get('column') ?? '0', 10) || 0,\n isServer: searchParams.get('isServer') === 'true',\n } satisfies TurbopackStackFrame\n}\n\n/**\n * https://tc39.es/source-map/#index-map\n */\ninterface IndexSourceMapSection {\n offset: {\n line: number\n column: number\n }\n map: ModernRawSourceMap\n}\n\n// TODO(veil): Upstream types\ninterface IndexSourceMap {\n version: number\n file: string\n sections: IndexSourceMapSection[]\n}\n\ninterface ModernRawSourceMap extends SourceMapPayload {\n ignoreList?: number[]\n}\n\ntype ModernSourceMapPayload = ModernRawSourceMap | IndexSourceMap\n\n/**\n * Finds the sourcemap payload applicable to a given frame.\n * Equal to the input unless an Index Source Map is used.\n */\nfunction findApplicableSourceMapPayload(\n frame: TurbopackStackFrame,\n payload: ModernSourceMapPayload\n): ModernRawSourceMap | undefined {\n if ('sections' in payload) {\n const frameLine = frame.line ?? 0\n const frameColumn = frame.column ?? 0\n // Sections must not overlap and must be sorted: https://tc39.es/source-map/#section-object\n // Therefore the last section that has an offset less than or equal to the frame is the applicable one.\n // TODO(veil): Binary search\n let section: IndexSourceMapSection | undefined = payload.sections[0]\n for (\n let i = 0;\n i < payload.sections.length &&\n payload.sections[i].offset.line <= frameLine &&\n payload.sections[i].offset.column <= frameColumn;\n i++\n ) {\n section = payload.sections[i]\n }\n\n return section === undefined ? undefined : section.map\n } else {\n return payload\n }\n}\n\nasync function nativeTraceSource(\n frame: TurbopackStackFrame\n): Promise<{ frame: IgnorableStackFrame; source: string | null } | undefined> {\n const sourceMap = findSourceMap(\n // TODO(veil): Why are the frames sent encoded?\n decodeURIComponent(frame.file)\n )\n if (sourceMap !== undefined) {\n const traced = await SourceMapConsumer.with(\n sourceMap.payload,\n null,\n async (consumer) => {\n const originalPosition = consumer.originalPositionFor({\n line: frame.line ?? 1,\n column: frame.column ?? 1,\n })\n\n if (originalPosition.source === null) {\n return null\n }\n\n const sourceContent: string | null =\n consumer.sourceContentFor(\n originalPosition.source,\n /* returnNullOnMissing */ true\n ) ?? null\n\n return { originalPosition, sourceContent }\n }\n )\n\n if (traced !== null) {\n const { originalPosition, sourceContent } = traced\n const applicableSourceMap = findApplicableSourceMapPayload(\n frame,\n sourceMap.payload\n )\n\n // TODO(veil): Upstream a method to sourcemap consumer that immediately says if a frame is ignored or not.\n let ignored = false\n if (applicableSourceMap === undefined) {\n console.error(\n 'No applicable source map found in sections for frame',\n frame\n )\n } else {\n // TODO: O(n^2). Consider moving `ignoreList` into a Set\n const sourceIndex = applicableSourceMap.sources.indexOf(\n originalPosition.source!\n )\n ignored = applicableSourceMap.ignoreList?.includes(sourceIndex) ?? false\n }\n\n const originalStackFrame: IgnorableStackFrame = {\n methodName:\n originalPosition.name ||\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 '<unknown>',\n column: (originalPosition.column ?? 0) + 1,\n file: originalPosition.source?.startsWith('file://')\n ? path.relative(\n process.cwd(),\n url.fileURLToPath(originalPosition.source)\n )\n : originalPosition.source,\n lineNumber: originalPosition.line ?? 0,\n // TODO: c&p from async createOriginalStackFrame but why not frame.arguments?\n arguments: [],\n ignored,\n }\n\n return {\n frame: originalStackFrame,\n source: sourceContent,\n }\n }\n }\n\n return undefined\n}\n\nexport async function createOriginalStackFrame(\n project: Project,\n frame: TurbopackStackFrame\n): Promise<OriginalStackFrameResponse | null> {\n const traced =\n (await nativeTraceSource(frame)) ??\n // TODO(veil): When would the bundler know more than native?\n // If it's faster, try the bundler first and fall back to native later.\n (await batchedTraceSource(project, frame))\n if (!traced) {\n return null\n }\n\n return {\n originalStackFrame: traced.frame,\n originalCodeFrame: getOriginalCodeFrame(traced.frame, traced.source),\n }\n}\n\nexport function getOverlayMiddleware(project: Project) {\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(req.url!, 'http://n')\n\n if (pathname === '/__nextjs_original-stack-frame') {\n const frame = createStackFrame(searchParams)\n\n if (!frame) return badRequest(res)\n\n let originalStackFrame: OriginalStackFrameResponse | null\n try {\n originalStackFrame = await createOriginalStackFrame(project, frame)\n } catch (e: any) {\n return internalServerError(res, e.message)\n }\n\n if (!originalStackFrame) {\n res.statusCode = 404\n res.end('Unable to resolve sourcemap')\n return\n }\n\n return json(res, originalStackFrame)\n } else if (pathname === '/__nextjs_launch-editor') {\n const frame = createStackFrame(searchParams)\n\n if (!frame) return badRequest(res)\n\n const fileExists = await fs.access(frame.file, FS.F_OK).then(\n () => true,\n () => false\n )\n if (!fileExists) return noContent(res)\n\n try {\n launchEditor(frame.file, frame.line ?? 1, frame.column ?? 1)\n } catch (err) {\n console.log('Failed to launch editor:', err)\n return internalServerError(res)\n }\n\n noContent(res)\n }\n\n return next()\n }\n}\n\nexport function getSourceMapMiddleware(project: Project) {\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname, searchParams } = new URL(req.url!, 'http://n')\n\n if (pathname !== '/__nextjs_source-map') {\n return next()\n }\n\n let filename = searchParams.get('filename')\n\n if (!filename) {\n return badRequest(res)\n }\n\n // TODO(veil): Always try the native version first.\n // Externals could also be files that aren't bundled via Webpack.\n if (\n filename.startsWith('webpack://') ||\n filename.startsWith('webpack-internal:///')\n ) {\n const sourceMap = findSourceMap(filename)\n\n if (sourceMap) {\n return json(res, sourceMap.payload)\n }\n\n return noContent(res)\n }\n\n try {\n // Turbopack chunk filenames might be URL-encoded.\n filename = decodeURI(filename)\n\n if (path.isAbsolute(filename)) {\n filename = url.pathToFileURL(filename).href\n }\n\n const sourceMapString = await project.getSourceMap(filename)\n\n if (sourceMapString) {\n return jsonString(res, sourceMapString)\n }\n\n if (filename.startsWith('file:')) {\n const sourceMap = await getSourceMapFromFile(filename)\n\n if (sourceMap) {\n return json(res, sourceMap)\n }\n }\n } catch (error) {\n console.error('Failed to get source map:', error)\n }\n\n noContent(res)\n }\n}\n"],"names":["batchedTraceSource","createOriginalStackFrame","getOverlayMiddleware","getSourceMapMiddleware","shouldIgnorePath","modulePath","includes","currentSourcesByFile","Map","project","frame","file","decodeURIComponent","undefined","sourceFrame","traceSource","lineNumber","line","column","methodName","ignored","arguments","source","isInternal","sourcePromise","get","getSourceForAsset","set","setTimeout","delete","ignorableFrame","createStackFrame","searchParams","fileParam","replace","parseInt","isServer","findApplicableSourceMapPayload","payload","frameLine","frameColumn","section","sections","i","length","offset","map","nativeTraceSource","sourceMap","findSourceMap","traced","SourceMapConsumer","with","consumer","originalPosition","originalPositionFor","sourceContent","sourceContentFor","applicableSourceMap","console","error","sourceIndex","sources","indexOf","ignoreList","originalStackFrame","name","startsWith","path","relative","process","cwd","url","fileURLToPath","originalCodeFrame","getOriginalCodeFrame","req","res","next","pathname","URL","badRequest","e","internalServerError","message","statusCode","end","json","fileExists","fs","access","FS","F_OK","then","noContent","launchEditor","err","log","filename","decodeURI","isAbsolute","pathToFileURL","href","sourceMapString","getSourceMap","jsonString","getSourceMapFromFile"],"mappings":";;;;;;;;;;;;;;;;;IAgCsBA,kBAAkB;eAAlBA;;IA8NAC,wBAAwB;eAAxBA;;IAmBNC,oBAAoB;eAApBA;;IAoDAC,sBAAsB;eAAtBA;;;;;wBA5TT;oEAE6B;+DACnB;8DACD;8BACa;6BAEK;sCAEG;4BACgB;AAErD,SAASC,iBAAiBC,UAAkB;IAC1C,OACEA,WAAWC,QAAQ,CAAC,mBACpB,2EAA2E;IAC3ED,WAAWC,QAAQ,CAAC;AAExB;A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,OAAgB;IACrD,OAAO,eACLmE,GAAoB,EACpBC,GAAmB,EACnBC,IAAgB;QAEhB,MAAM,EAAEC,QAAQ,EAAE/C,YAAY,EAAE,GAAG,IAAIgD,IAAIJ,IAAIJ,GAAG,EAAG;QAErD,IAAIO,aAAa,wBAAwB;YACvC,OAAOD;QACT;QAEA,IAAIoB,WAAWlE,aAAaP,GAAG,CAAC;QAEhC,IAAI,CAACyE,UAAU;YACb,OAAOjB,IAAAA,kBAAU,EAACJ;QACpB;QAEA,mDAAmD;QACnD,iEAAiE;QACjE,IACEqB,SAAS/B,UAAU,CAAC,iBACpB+B,SAAS/B,UAAU,CAAC,yBACpB;YACA,MAAMnB,YAAYC,IAAAA,yBAAa,EAACiD;YAEhC,IAAIlD,WAAW;gBACb,OAAOuC,IAAAA,YAAI,EAACV,KAAK7B,UAAUV,OAAO;YACpC;YAEA,OAAOwD,IAAAA,iBAAS,EAACjB;QACnB;QAEA,IAAI;YACF,kDAAkD;YAClDqB,WAAWC,UAAUD;YAErB,IAAI9B,aAAI,CAACgC,UAAU,CAACF,WAAW;gBAC7BA,WAAW1B,YAAG,CAAC6B,aAAa,CAACH,UAAUI,IAAI;YAC7C;YAEA,MAAMC,kBAAkB,MAAM9F,QAAQ+F,YAAY,CAACN;YAEnD,IAAIK,iBAAiB;gBACnB,OAAOE,IAAAA,kBAAU,EAAC5B,KAAK0B;YACzB;YAEA,IAAIL,SAAS/B,UAAU,CAAC,UAAU;gBAChC,MAAMnB,YAAY,MAAM0D,IAAAA,0CAAoB,EAACR;gBAE7C,IAAIlD,WAAW;oBACb,OAAOuC,IAAAA,YAAI,EAACV,KAAK7B;gBACnB;YACF;QACF,EAAE,OAAOY,OAAO;YACdD,QAAQC,KAAK,CAAC,6BAA6BA;QAC7C;QAEAkC,IAAAA,iBAAS,EAACjB;IACZ;AACF"}
@@ -62,7 +62,7 @@ const _shared = require("./react-client-callbacks/shared");
62
62
  const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
63
63
  const _reporttosocket = /*#__PURE__*/ _interop_require_default._(require("./tracing/report-to-socket"));
64
64
  const _isnextroutererror = require("./components/is-next-router-error");
65
- const version = "15.0.4-canary.37";
65
+ const version = "15.0.4-canary.38";
66
66
  let router;
67
67
  const emitter = (0, _mitt.default)();
68
68
  const looseToArray = (input)=>[].slice.call(input);