/
opt
/
canhelp
/
node_modules
/
next
/
dist
/
esm
/
server
/
/opt/canhelp/node_modules/next/dist/esm/server
mkdir
upload
Name
Size
Mode
Actions
after/
-
0755
rm
api-utils/
-
0755
rm
app-render/
-
0755
rm
async-storage/
-
0755
rm
base-http/
-
0755
rm
dev/
-
0755
rm
instrumentation/
-
0755
rm
lib/
-
0755
rm
node-environment-extensions/
-
0755
rm
normalizers/
-
0755
rm
og/
-
0755
rm
request/
-
0755
rm
response-cache/
-
0755
rm
resume-data-cache/
-
0755
rm
route-definitions/
-
0755
rm
route-matcher-managers/
-
0755
rm
route-matcher-providers/
-
0755
rm
route-matchers/
-
0755
rm
route-matches/
-
0755
rm
route-modules/
-
0755
rm
stream-utils/
-
0755
rm
typescript/
-
0755
rm
use-cache/
-
0755
rm
web/
-
0755
rm
accept-header.js
3852
0644
edit
dl
rm
accept-header.js.map
6454
0644
edit
dl
rm
base-server.js
96521
0644
edit
dl
rm
base-server.js.map
162133
0644
edit
dl
rm
body-streams.js
2979
0644
edit
dl
rm
body-streams.js.map
5408
0644
edit
dl
rm
cache-dir.js
324
0644
edit
dl
rm
cache-dir.js.map
698
0644
edit
dl
rm
ci-info.js
656
0644
edit
dl
rm
ci-info.js.map
1317
0644
edit
dl
rm
client-component-renderer-logger.js
1739
0644
edit
dl
rm
client-component-renderer-logger.js.map
2984
0644
edit
dl
rm
config-schema.js
27350
0644
edit
dl
rm
config-schema.js.map
54160
0644
edit
dl
rm
config-shared.js
6602
0644
edit
dl
rm
config-shared.js.map
58073
0644
edit
dl
rm
config-utils.js
5676
0644
edit
dl
rm
config-utils.js.map
6582
0644
edit
dl
rm
config.js
71488
0644
edit
dl
rm
config.js.map
99681
0644
edit
dl
rm
create-deduped-by-callsite-server-error-logger.js
2330
0644
edit
dl
rm
create-deduped-by-callsite-server-error-logger.js.map
3641
0644
edit
dl
rm
crypto-utils.js
2330
0644
edit
dl
rm
crypto-utils.js.map
4299
0644
edit
dl
rm
dynamic-rendering-utils.js
2984
0644
edit
dl
rm
dynamic-rendering-utils.js.map
4883
0644
edit
dl
rm
font-utils.js
1554
0644
edit
dl
rm
font-utils.js.map
3073
0644
edit
dl
rm
get-app-route-from-entrypoint.js
452
0644
edit
dl
rm
get-app-route-from-entrypoint.js.map
852
0644
edit
dl
rm
get-page-files.js
547
0644
edit
dl
rm
get-page-files.js.map
1699
0644
edit
dl
rm
get-route-from-entrypoint.js
794
0644
edit
dl
rm
get-route-from-entrypoint.js.map
1398
0644
edit
dl
rm
htmlescape.js
510
0644
edit
dl
rm
htmlescape.js.map
961
0644
edit
dl
rm
image-optimizer.js
33424
0644
edit
dl
rm
image-optimizer.js.map
55392
0644
edit
dl
rm
internal-utils.js
578
0644
edit
dl
rm
internal-utils.js.map
1308
0644
edit
dl
rm
load-components.js
6205
0644
edit
dl
rm
load-components.js.map
13185
0644
edit
dl
rm
load-default-error-components.js
1556
0644
edit
dl
rm
load-default-error-components.js.map
3887
0644
edit
dl
rm
load-manifest.external.js
2308
0644
edit
dl
rm
load-manifest.external.js.map
5763
0644
edit
dl
rm
match-bundle.js
320
0644
edit
dl
rm
match-bundle.js.map
705
0644
edit
dl
rm
next-server.js
65451
0644
edit
dl
rm
next-server.js.map
110145
0644
edit
dl
rm
next-typescript.js
91
0644
edit
dl
rm
next-typescript.js.map
215
0644
edit
dl
rm
next.js
13540
0644
edit
dl
rm
next.js.map
26930
0644
edit
dl
rm
node-environment-baseline.js
876
0644
edit
dl
rm
node-environment-baseline.js.map
1554
0644
edit
dl
rm
node-environment.js
757
0644
edit
dl
rm
node-environment.js.map
1165
0644
edit
dl
rm
node-polyfill-crypto.js
544
0644
edit
dl
rm
node-polyfill-crypto.js.map
1013
0644
edit
dl
rm
optimize-amp.js
360
0644
edit
dl
rm
optimize-amp.js.map
823
0644
edit
dl
rm
patch-error-inspect.js
17533
0644
edit
dl
rm
patch-error-inspect.js.map
28593
0644
edit
dl
rm
pipe-readable.js
5021
0644
edit
dl
rm
pipe-readable.js.map
7702
0644
edit
dl
rm
post-process.js
1800
0644
edit
dl
rm
post-process.js.map
3997
0644
edit
dl
rm
ReactDOMServerPages.d.ts
38
0644
edit
dl
rm
ReactDOMServerPages.js
584
0644
edit
dl
rm
ReactDOMServerPages.js.map
956
0644
edit
dl
rm
render-result.js
7204
0644
edit
dl
rm
render-result.js.map
14239
0644
edit
dl
rm
render.js
53487
0644
edit
dl
rm
render.js.map
85442
0644
edit
dl
rm
request-meta.js
1341
0644
edit
dl
rm
request-meta.js.map
9433
0644
edit
dl
rm
require-hook.js
2277
0644
edit
dl
rm
require-hook.js.map
4397
0644
edit
dl
rm
require.js
3042
0644
edit
dl
rm
require.js.map
6107
0644
edit
dl
rm
revalidation-utils.js
2917
0644
edit
dl
rm
revalidation-utils.js.map
5708
0644
edit
dl
rm
route-kind.js
829
0644
edit
dl
rm
route-kind.js.map
927
0644
edit
dl
rm
send-payload.js
2174
0644
edit
dl
rm
send-payload.js.map
4212
0644
edit
dl
rm
send-response.js
3040
0644
edit
dl
rm
send-response.js.map
4598
0644
edit
dl
rm
serve-static.js
1334
0644
edit
dl
rm
serve-static.js.map
2603
0644
edit
dl
rm
server-route-utils.js
1061
0644
edit
dl
rm
server-route-utils.js.map
1999
0644
edit
dl
rm
server-utils.js
15315
0644
edit
dl
rm
server-utils.js.map
26139
0644
edit
dl
rm
setup-http-agent-env.js
832
0644
edit
dl
rm
setup-http-agent-env.js.map
1439
0644
edit
dl
rm
utils.js
2672
0644
edit
dl
rm
utils.js.map
4139
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/next/dist/esm/server/patch-error-inspect.js
(17533B)
import { findSourceMap as nativeFindSourceMap } from 'module'; import * as path from 'path'; import * as url from 'url'; import { SourceMapConsumer as SyncSourceMapConsumer } from 'next/dist/compiled/source-map'; import { findApplicableSourceMapPayload, ignoreListAnonymousStackFramesIfSandwiched as ignoreListAnonymousStackFramesIfSandwichedGeneric, sourceMapIgnoreListsEverything } from './lib/source-maps'; import { parseStack } from './lib/parse-stack'; import { getOriginalCodeFrame } from '../next-devtools/server/shared'; import { workUnitAsyncStorage } from './app-render/work-unit-async-storage.external'; import { dim } from '../lib/picocolors'; // Find a source map using the bundler's API. // This is only a fallback for when Node.js fails to due to bugs e.g. https://github.com/nodejs/node/issues/52102 // TODO: Remove once all supported Node.js versions are fixed. // TODO(veil): Set from Webpack as well let bundlerFindSourceMapPayload = ()=>undefined; export function setBundlerFindSourceMapImplementation(findSourceMapImplementation) { bundlerFindSourceMapPayload = findSourceMapImplementation; } function frameToString(methodName, sourceURL, line1, column1) { let sourceLocation = line1 !== null ? `:${line1}` : ''; if (column1 !== null && sourceLocation !== '') { sourceLocation += `:${column1}`; } let fileLocation; if (sourceURL !== null && sourceURL.startsWith('file://') && URL.canParse(sourceURL)) { // If not relative to CWD, the path is ambiguous to IDEs and clicking will prompt to select the file first. // In a multi-app repo, this leads to potentially larger file names but will make clicking snappy. // There's no tradeoff for the cases where `dir` in `next dev [dir]` is omitted // since relative to cwd is both the shortest and snappiest. fileLocation = path.relative(process.cwd(), url.fileURLToPath(sourceURL)); } else if (sourceURL !== null && sourceURL.startsWith('/')) { fileLocation = path.relative(process.cwd(), sourceURL); } else { fileLocation = sourceURL; } return methodName ? ` at ${methodName} (${fileLocation}${sourceLocation})` : ` at ${fileLocation}${sourceLocation}`; } function computeErrorName(error) { // TODO: Node.js seems to use a different algorithm // class ReadonlyRequestCookiesError extends Error {}` would read `ReadonlyRequestCookiesError: [...]` // in the stack i.e. seems like under certain conditions it favors the constructor name. return error.name || 'Error'; } function prepareUnsourcemappedStackTrace(error, structuredStackTrace) { const name = computeErrorName(error); const message = error.message || ''; let stack = name + ': ' + message; for(let i = 0; i < structuredStackTrace.length; i++){ stack += '\n at ' + structuredStackTrace[i].toString(); } return stack; } function shouldIgnoreListGeneratedFrame(file) { return file.startsWith('node:') || file.includes('node_modules'); } function shouldIgnoreListOriginalFrame(file) { return file.includes('node_modules'); } function createUnsourcemappedFrame(frame) { return { stack: { file: frame.file, line1: frame.line1, column1: frame.column1, methodName: frame.methodName, arguments: frame.arguments, ignored: shouldIgnoreListGeneratedFrame(frame.file) }, code: null }; } function ignoreListAnonymousStackFramesIfSandwiched(sourceMappedFrames) { return ignoreListAnonymousStackFramesIfSandwichedGeneric(sourceMappedFrames, (frame)=>frame.stack.file === '<anonymous>', (frame)=>frame.stack.ignored, (frame)=>frame.stack.methodName, (frame)=>{ frame.stack.ignored = true; }); } /** * @param frame * @param sourceMapCache * @returns The original frame if not sourcemapped. */ function getSourcemappedFrameIfPossible(frame, sourceMapCache, inspectOptions) { var _frame_methodName_replace, _frame_methodName; const sourceMapCacheEntry = sourceMapCache.get(frame.file); let sourceMapConsumer; let sourceMapPayload; if (sourceMapCacheEntry === undefined) { let sourceURL = frame.file; // e.g. "/APP/.next/server/chunks/ssr/[root-of-the-server]__2934a0._.js" // will be keyed by Node.js as "file:///APP/.next/server/chunks/ssr/[root-of-the-server]__2934a0._.js". // This is likely caused by `callsite.toString()` in `Error.prepareStackTrace converting file URLs to paths. if (sourceURL.startsWith('/')) { sourceURL = url.pathToFileURL(frame.file).toString(); } let maybeSourceMapPayload; try { const sourceMap = nativeFindSourceMap(sourceURL); maybeSourceMapPayload = sourceMap == null ? void 0 : sourceMap.payload; } catch (cause) { // We should not log an actual error instance here because that will re-enter // this codepath during error inspection and could lead to infinite recursion. console.error(`${sourceURL}: Invalid source map. Only conformant source maps can be used to find the original code. Cause: ${cause}`); // If loading fails once, it'll fail every time. // So set the cache to avoid duplicate errors. sourceMapCache.set(frame.file, null); // Don't even fall back to the bundler because it might be not as strict // with regards to parsing and then we fail later once we consume the // source map payload. // This essentially avoids a redundant error where we fail here and then // later on consumption because the bundler just handed back an invalid // source map. return createUnsourcemappedFrame(frame); } if (maybeSourceMapPayload === undefined) { maybeSourceMapPayload = bundlerFindSourceMapPayload(sourceURL); } if (maybeSourceMapPayload === undefined) { return createUnsourcemappedFrame(frame); } sourceMapPayload = maybeSourceMapPayload; try { sourceMapConsumer = new SyncSourceMapConsumer(// @ts-expect-error -- Module.SourceMap['version'] is number but SyncSourceMapConsumer wants a string sourceMapPayload); } catch (cause) { // We should not log an actual error instance here because that will re-enter // this codepath during error inspection and could lead to infinite recursion. console.error(`${sourceURL}: Invalid source map. Only conformant source maps can be used to find the original code. Cause: ${cause}`); // If creating the consumer fails once, it'll fail every time. // So set the cache to avoid duplicate errors. sourceMapCache.set(frame.file, null); return createUnsourcemappedFrame(frame); } sourceMapCache.set(frame.file, { map: sourceMapConsumer, payload: sourceMapPayload }); } else if (sourceMapCacheEntry === null) { // We failed earlier getting the payload or consumer. // Just return an unsourcemapped frame. // Errors will already be logged. return createUnsourcemappedFrame(frame); } else { sourceMapConsumer = sourceMapCacheEntry.map; sourceMapPayload = sourceMapCacheEntry.payload; } const sourcePosition = sourceMapConsumer.originalPositionFor({ column: (frame.column1 ?? 1) - 1, line: frame.line1 ?? 1 }); const applicableSourceMap = findApplicableSourceMapPayload((frame.line1 ?? 1) - 1, (frame.column1 ?? 1) - 1, sourceMapPayload); let ignored = applicableSourceMap !== undefined && sourceMapIgnoreListsEverything(applicableSourceMap); if (sourcePosition.source === null) { return { stack: { arguments: frame.arguments, file: frame.file, line1: frame.line1, column1: frame.column1, methodName: frame.methodName, ignored: ignored || shouldIgnoreListGeneratedFrame(frame.file) }, code: null }; } // TODO(veil): Upstream a method to sourcemap consumer that immediately says if a frame is ignored or not. if (applicableSourceMap === undefined) { console.error('No applicable source map found in sections for frame', frame); } else if (!ignored && shouldIgnoreListOriginalFrame(sourcePosition.source)) { // Externals may be libraries that don't ship ignoreLists. // This is really taking control away from libraries. // They should still ship `ignoreList` so that attached debuggers ignore-list their frames. // TODO: Maybe only ignore library sourcemaps if `ignoreList` is absent? // Though keep in mind that Turbopack omits empty `ignoreList`. // So if we establish this convention, we should communicate it to the ecosystem. ignored = true; } else if (!ignored) { var _applicableSourceMap_ignoreList; // TODO: O(n^2). Consider moving `ignoreList` into a Set const sourceIndex = applicableSourceMap.sources.indexOf(sourcePosition.source); ignored = ((_applicableSourceMap_ignoreList = applicableSourceMap.ignoreList) == null ? void 0 : _applicableSourceMap_ignoreList.includes(sourceIndex)) ?? false; } const originalFrame = { // We ignore the sourcemapped name since it won't be the correct name. // The callsite will point to the column of the variable name instead of the // name of the enclosing function. // TODO(NDX-531): Spy on prepareStackTrace to get the enclosing line number for method name mapping. methodName: (_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__.', ''), file: sourcePosition.source, line1: sourcePosition.line, column1: sourcePosition.column + 1, // TODO: c&p from async createOriginalStackFrame but why not frame.arguments? arguments: [], ignored }; /** undefined = not yet computed*/ let codeFrame; return Object.defineProperty({ stack: originalFrame, code: null }, 'code', { get: ()=>{ if (codeFrame === undefined) { const sourceContent = sourceMapConsumer.sourceContentFor(sourcePosition.source, /* returnNullOnMissing */ true) ?? null; codeFrame = getOriginalCodeFrame(originalFrame, sourceContent, inspectOptions.colors); } return codeFrame; } }); } function parseAndSourceMap(error, inspectOptions) { // TODO(veil): Expose as CLI arg or config option. Useful for local debugging. const showIgnoreListed = false; // We overwrote Error.prepareStackTrace earlier so error.stack is not sourcemapped. let unparsedStack = String(error.stack); // We could just read it from `error.stack`. // This works around cases where a 3rd party `Error.prepareStackTrace` implementation // doesn't implement the name computation correctly. const errorName = computeErrorName(error); let idx = unparsedStack.indexOf('react_stack_bottom_frame'); if (idx !== -1) { idx = unparsedStack.lastIndexOf('\n', idx); } else { idx = unparsedStack.indexOf('react-stack-bottom-frame'); if (idx !== -1) { idx = unparsedStack.lastIndexOf('\n', idx); } } if (idx !== -1 && !showIgnoreListed) { // Cut off everything after the bottom frame since it'll be React internals. unparsedStack = unparsedStack.slice(0, idx); } const unsourcemappedStack = parseStack(unparsedStack); const sourceMapCache = new Map(); const sourceMappedFrames = []; let sourceFrame = null; for (const frame of unsourcemappedStack){ if (frame.file === null) { sourceMappedFrames.push({ code: null, stack: { file: frame.file, line1: frame.line1, column1: frame.column1, methodName: frame.methodName, arguments: frame.arguments, ignored: false } }); } else { const sourcemappedFrame = getSourcemappedFrameIfPossible(// We narrowed this earlier by bailing if `frame.file` is null. frame, sourceMapCache, inspectOptions); sourceMappedFrames.push(sourcemappedFrame); // We can determine the sourceframe here. // anonymous frames won't have a sourceframe so we don't need to scan // all stacks again to check if they are sandwiched between ignored frames. if (sourceFrame === null && // TODO: Is this the right choice? !sourcemappedFrame.stack.ignored && sourcemappedFrame.code !== null) { sourceFrame = sourcemappedFrame.code; } } } ignoreListAnonymousStackFramesIfSandwiched(sourceMappedFrames); let sourceMappedStack = ''; for(let i = 0; i < sourceMappedFrames.length; i++){ const frame = sourceMappedFrames[i]; if (!frame.stack.ignored) { sourceMappedStack += '\n' + frameToString(frame.stack.methodName, frame.stack.file, frame.stack.line1, frame.stack.column1); } else if (showIgnoreListed) { sourceMappedStack += '\n' + dim(frameToString(frame.stack.methodName, frame.stack.file, frame.stack.line1, frame.stack.column1)); } } return errorName + ': ' + error.message + sourceMappedStack + (sourceFrame !== null ? '\n' + sourceFrame : ''); } function sourceMapError(error, inspectOptions) { // Create a new Error object with the source mapping applied and then use native // Node.js formatting on the result. const newError = error.cause !== undefined ? Object.defineProperty(new Error(error.message, { cause: error.cause }), "__NEXT_ERROR_CODE", { value: "E394", enumerable: false, configurable: true }) : Object.defineProperty(new Error(error.message), "__NEXT_ERROR_CODE", { value: "E394", enumerable: false, configurable: true }); // TODO: Ensure `class MyError extends Error {}` prints `MyError` as the name newError.stack = parseAndSourceMap(error, inspectOptions); for(const key in error){ if (!Object.prototype.hasOwnProperty.call(newError, key)) { // @ts-expect-error -- We're copying all enumerable properties. // So they definitely exist on `this` and obviously have no type on `newError` (yet) newError[key] = error[key]; } } return newError; } export function patchErrorInspectNodeJS(errorConstructor) { const inspectSymbol = Symbol.for('nodejs.util.inspect.custom'); errorConstructor.prepareStackTrace = prepareUnsourcemappedStackTrace; // @ts-expect-error -- TODO upstream types // eslint-disable-next-line no-extend-native -- We're not extending but overriding. errorConstructor.prototype[inspectSymbol] = function(depth, inspectOptions, inspect) { // avoid false-positive dynamic i/o warnings e.g. due to usage of `Math.random` in `source-map`. return workUnitAsyncStorage.exit(()=>{ const newError = sourceMapError(this, inspectOptions); const originalCustomInspect = newError[inspectSymbol]; // Prevent infinite recursion. // { customInspect: false } would result in `error.cause` not using our inspect. Object.defineProperty(newError, inspectSymbol, { value: undefined, enumerable: false, writable: true }); try { return inspect(newError, { ...inspectOptions, depth: (inspectOptions.depth ?? // Default in Node.js 2) - depth }); } finally{ ; newError[inspectSymbol] = originalCustomInspect; } }); }; } export function patchErrorInspectEdgeLite(errorConstructor) { const inspectSymbol = Symbol.for('edge-runtime.inspect.custom'); errorConstructor.prepareStackTrace = prepareUnsourcemappedStackTrace; // @ts-expect-error -- TODO upstream types // eslint-disable-next-line no-extend-native -- We're not extending but overriding. errorConstructor.prototype[inspectSymbol] = function({ format }) { // avoid false-positive dynamic i/o warnings e.g. due to usage of `Math.random` in `source-map`. return workUnitAsyncStorage.exit(()=>{ const newError = sourceMapError(this, {}); const originalCustomInspect = newError[inspectSymbol]; // Prevent infinite recursion. Object.defineProperty(newError, inspectSymbol, { value: undefined, enumerable: false, writable: true }); try { return format(newError); } finally{ ; newError[inspectSymbol] = originalCustomInspect; } }); }; } //# sourceMappingURL=patch-error-inspect.js.map
Save
cmd:
run