Initial commit
This commit is contained in:
commit
78f8d225ee
21173 changed files with 2907774 additions and 0 deletions
1
node_modules/next/dist/client/components/errors/attach-hydration-error-state.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/attach-hydration-error-state.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function attachHydrationErrorState(error: Error): void;
|
||||
84
node_modules/next/dist/client/components/errors/attach-hydration-error-state.js
generated
vendored
Normal file
84
node_modules/next/dist/client/components/errors/attach-hydration-error-state.js
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "attachHydrationErrorState", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return attachHydrationErrorState;
|
||||
}
|
||||
});
|
||||
const _ishydrationerror = require("../is-hydration-error");
|
||||
const _hydrationerrorinfo = require("./hydration-error-info");
|
||||
function attachHydrationErrorState(error) {
|
||||
let parsedHydrationErrorState = {};
|
||||
const isHydrationWarning = (0, _ishydrationerror.testReactHydrationWarning)(error.message);
|
||||
const isHydrationRuntimeError = (0, _ishydrationerror.isHydrationError)(error);
|
||||
// If it's not hydration warnings or errors, skip
|
||||
if (!(isHydrationRuntimeError || isHydrationWarning)) {
|
||||
return;
|
||||
}
|
||||
const reactHydrationDiffSegments = (0, _hydrationerrorinfo.getReactHydrationDiffSegments)(error.message);
|
||||
// If the reactHydrationDiffSegments exists
|
||||
// and the diff (reactHydrationDiffSegments[1]) exists
|
||||
// e.g. the hydration diff log error.
|
||||
if (reactHydrationDiffSegments) {
|
||||
const diff = reactHydrationDiffSegments[1];
|
||||
parsedHydrationErrorState = {
|
||||
...error.details,
|
||||
..._hydrationerrorinfo.hydrationErrorState,
|
||||
// If diff is present in error, we don't need to pick up the console logged warning.
|
||||
// - if hydration error has diff, and is not hydration diff log, then it's a normal hydration error.
|
||||
// - if hydration error no diff, then leverage the one from the hydration diff log.
|
||||
warning: (diff && !isHydrationWarning ? null : _hydrationerrorinfo.hydrationErrorState.warning) || [
|
||||
(0, _ishydrationerror.getDefaultHydrationErrorMessage)(),
|
||||
'',
|
||||
''
|
||||
],
|
||||
// When it's hydration diff log, do not show notes section.
|
||||
// This condition is only for the 1st squashed error.
|
||||
notes: isHydrationWarning ? '' : reactHydrationDiffSegments[0],
|
||||
reactOutputComponentDiff: diff
|
||||
};
|
||||
// Cache the `reactOutputComponentDiff` into hydrationErrorState.
|
||||
// This is only required for now when we still squashed the hydration diff log into hydration error.
|
||||
// Once the all error is logged to dev overlay in order, this will go away.
|
||||
if (!_hydrationerrorinfo.hydrationErrorState.reactOutputComponentDiff && diff) {
|
||||
_hydrationerrorinfo.hydrationErrorState.reactOutputComponentDiff = diff;
|
||||
}
|
||||
// If it's hydration runtime error that doesn't contain the diff, combine the diff from the cached hydration diff.
|
||||
if (!diff && isHydrationRuntimeError && _hydrationerrorinfo.hydrationErrorState.reactOutputComponentDiff) {
|
||||
parsedHydrationErrorState.reactOutputComponentDiff = _hydrationerrorinfo.hydrationErrorState.reactOutputComponentDiff;
|
||||
}
|
||||
} else {
|
||||
// Normal runtime error, where it doesn't contain the hydration diff.
|
||||
// If there's any extra information in the error message to display,
|
||||
// append it to the error message details property
|
||||
if (_hydrationerrorinfo.hydrationErrorState.warning) {
|
||||
// The patched console.error found hydration errors logged by React
|
||||
// Append the logged warning to the error message
|
||||
parsedHydrationErrorState = {
|
||||
...error.details,
|
||||
// It contains the warning, component stack, server and client tag names
|
||||
..._hydrationerrorinfo.hydrationErrorState
|
||||
};
|
||||
}
|
||||
// Consume the cached hydration diff.
|
||||
// This is only required for now when we still squashed the hydration diff log into hydration error.
|
||||
// Once the all error is logged to dev overlay in order, this will go away.
|
||||
if (_hydrationerrorinfo.hydrationErrorState.reactOutputComponentDiff) {
|
||||
parsedHydrationErrorState.reactOutputComponentDiff = _hydrationerrorinfo.hydrationErrorState.reactOutputComponentDiff;
|
||||
}
|
||||
}
|
||||
// If it's a hydration error, store the hydration error state into the error object
|
||||
;
|
||||
error.details = parsedHydrationErrorState;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=attach-hydration-error-state.js.map
|
||||
1
node_modules/next/dist/client/components/errors/attach-hydration-error-state.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/attach-hydration-error-state.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
node_modules/next/dist/client/components/errors/console-error.d.ts
generated
vendored
Normal file
11
node_modules/next/dist/client/components/errors/console-error.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
declare const digestSym: unique symbol;
|
||||
declare const consoleTypeSym: unique symbol;
|
||||
export type ConsoleError = Error & {
|
||||
[digestSym]: 'NEXT_CONSOLE_ERROR';
|
||||
[consoleTypeSym]: 'string' | 'error';
|
||||
environmentName: string;
|
||||
};
|
||||
export declare function createConsoleError(message: string | Error, environmentName?: string | null): ConsoleError;
|
||||
export declare const isConsoleError: (error: any) => error is ConsoleError;
|
||||
export declare const getConsoleErrorType: (error: ConsoleError) => "string" | "error";
|
||||
export {};
|
||||
56
node_modules/next/dist/client/components/errors/console-error.js
generated
vendored
Normal file
56
node_modules/next/dist/client/components/errors/console-error.js
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
// To distinguish from React error.digest, we use a different symbol here to determine if the error is from console.error or unhandled promise rejection.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createConsoleError: null,
|
||||
getConsoleErrorType: null,
|
||||
isConsoleError: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createConsoleError: function() {
|
||||
return createConsoleError;
|
||||
},
|
||||
getConsoleErrorType: function() {
|
||||
return getConsoleErrorType;
|
||||
},
|
||||
isConsoleError: function() {
|
||||
return isConsoleError;
|
||||
}
|
||||
});
|
||||
const digestSym = Symbol.for('next.console.error.digest');
|
||||
const consoleTypeSym = Symbol.for('next.console.error.type');
|
||||
function createConsoleError(message, environmentName) {
|
||||
const error = typeof message === 'string' ? Object.defineProperty(new Error(message), "__NEXT_ERROR_CODE", {
|
||||
value: "E394",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}) : message;
|
||||
error[digestSym] = 'NEXT_CONSOLE_ERROR';
|
||||
error[consoleTypeSym] = typeof message === 'string' ? 'string' : 'error';
|
||||
if (environmentName && !error.environmentName) {
|
||||
error.environmentName = environmentName;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
const isConsoleError = (error)=>{
|
||||
return error && error[digestSym] === 'NEXT_CONSOLE_ERROR';
|
||||
};
|
||||
const getConsoleErrorType = (error)=>{
|
||||
return error[consoleTypeSym];
|
||||
};
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=console-error.js.map
|
||||
1
node_modules/next/dist/client/components/errors/console-error.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/console-error.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/client/components/errors/console-error.ts"],"sourcesContent":["// To distinguish from React error.digest, we use a different symbol here to determine if the error is from console.error or unhandled promise rejection.\nconst digestSym = Symbol.for('next.console.error.digest')\nconst consoleTypeSym = Symbol.for('next.console.error.type')\n\n// Represent non Error shape unhandled promise rejections or console.error errors.\n// Those errors will be captured and displayed in Error Overlay.\nexport type ConsoleError = Error & {\n [digestSym]: 'NEXT_CONSOLE_ERROR'\n [consoleTypeSym]: 'string' | 'error'\n environmentName: string\n}\n\nexport function createConsoleError(\n message: string | Error,\n environmentName?: string | null\n): ConsoleError {\n const error = (\n typeof message === 'string' ? new Error(message) : message\n ) as ConsoleError\n error[digestSym] = 'NEXT_CONSOLE_ERROR'\n error[consoleTypeSym] = typeof message === 'string' ? 'string' : 'error'\n\n if (environmentName && !error.environmentName) {\n error.environmentName = environmentName\n }\n\n return error\n}\n\nexport const isConsoleError = (error: any): error is ConsoleError => {\n return error && error[digestSym] === 'NEXT_CONSOLE_ERROR'\n}\n\nexport const getConsoleErrorType = (error: ConsoleError) => {\n return error[consoleTypeSym]\n}\n"],"names":["createConsoleError","getConsoleErrorType","isConsoleError","digestSym","Symbol","for","consoleTypeSym","message","environmentName","error","Error"],"mappings":"AAAA,yJAAyJ;;;;;;;;;;;;;;;;;IAYzIA,kBAAkB;eAAlBA;;IAqBHC,mBAAmB;eAAnBA;;IAJAC,cAAc;eAAdA;;;AA5Bb,MAAMC,YAAYC,OAAOC,GAAG,CAAC;AAC7B,MAAMC,iBAAiBF,OAAOC,GAAG,CAAC;AAU3B,SAASL,mBACdO,OAAuB,EACvBC,eAA+B;IAE/B,MAAMC,QACJ,OAAOF,YAAY,WAAW,qBAAkB,CAAlB,IAAIG,MAAMH,UAAV,qBAAA;eAAA;oBAAA;sBAAA;IAAiB,KAAIA;IAErDE,KAAK,CAACN,UAAU,GAAG;IACnBM,KAAK,CAACH,eAAe,GAAG,OAAOC,YAAY,WAAW,WAAW;IAEjE,IAAIC,mBAAmB,CAACC,MAAMD,eAAe,EAAE;QAC7CC,MAAMD,eAAe,GAAGA;IAC1B;IAEA,OAAOC;AACT;AAEO,MAAMP,iBAAiB,CAACO;IAC7B,OAAOA,SAASA,KAAK,CAACN,UAAU,KAAK;AACvC;AAEO,MAAMF,sBAAsB,CAACQ;IAClC,OAAOA,KAAK,CAACH,eAAe;AAC9B"}
|
||||
1
node_modules/next/dist/client/components/errors/enqueue-client-error.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/enqueue-client-error.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function enqueueConsecutiveDedupedError(queue: Array<Error>, error: Error): void;
|
||||
27
node_modules/next/dist/client/components/errors/enqueue-client-error.js
generated
vendored
Normal file
27
node_modules/next/dist/client/components/errors/enqueue-client-error.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Dedupe the two consecutive errors: If the previous one is same as current one, ignore the current one.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "enqueueConsecutiveDedupedError", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return enqueueConsecutiveDedupedError;
|
||||
}
|
||||
});
|
||||
function enqueueConsecutiveDedupedError(queue, error) {
|
||||
const previousError = queue[queue.length - 1];
|
||||
// Compare the error stack to dedupe the consecutive errors
|
||||
if (previousError && previousError.stack === error.stack) {
|
||||
return;
|
||||
}
|
||||
queue.push(error);
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=enqueue-client-error.js.map
|
||||
1
node_modules/next/dist/client/components/errors/enqueue-client-error.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/enqueue-client-error.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/client/components/errors/enqueue-client-error.ts"],"sourcesContent":["// Dedupe the two consecutive errors: If the previous one is same as current one, ignore the current one.\nexport function enqueueConsecutiveDedupedError(\n queue: Array<Error>,\n error: Error\n) {\n const previousError = queue[queue.length - 1]\n // Compare the error stack to dedupe the consecutive errors\n if (previousError && previousError.stack === error.stack) {\n return\n }\n queue.push(error)\n}\n"],"names":["enqueueConsecutiveDedupedError","queue","error","previousError","length","stack","push"],"mappings":"AAAA,yGAAyG;;;;;+BACzFA;;;eAAAA;;;AAAT,SAASA,+BACdC,KAAmB,EACnBC,KAAY;IAEZ,MAAMC,gBAAgBF,KAAK,CAACA,MAAMG,MAAM,GAAG,EAAE;IAC7C,2DAA2D;IAC3D,IAAID,iBAAiBA,cAAcE,KAAK,KAAKH,MAAMG,KAAK,EAAE;QACxD;IACF;IACAJ,MAAMK,IAAI,CAACJ;AACb"}
|
||||
19
node_modules/next/dist/client/components/errors/hydration-error-info.d.ts
generated
vendored
Normal file
19
node_modules/next/dist/client/components/errors/hydration-error-info.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
export type HydrationErrorState = {
|
||||
warning?: [string, string, string];
|
||||
serverContent?: string;
|
||||
clientContent?: string;
|
||||
notes?: string;
|
||||
reactOutputComponentDiff?: string;
|
||||
};
|
||||
type NullableText = string | null | undefined;
|
||||
export declare const hydrationErrorState: HydrationErrorState;
|
||||
export declare const getHydrationWarningType: (message: NullableText) => "tag" | "text" | "text-in-tag";
|
||||
export declare const getReactHydrationDiffSegments: (msg: NullableText) => (string | undefined)[] | undefined;
|
||||
/**
|
||||
* Patch console.error to capture hydration errors.
|
||||
* If any of the knownHydrationWarnings are logged, store the message and component stack.
|
||||
* When the hydration runtime error is thrown, the message and component stack are added to the error.
|
||||
* This results in a more helpful error message in the error overlay.
|
||||
*/
|
||||
export declare function storeHydrationErrorStateFromConsoleArgs(...args: any[]): void;
|
||||
export {};
|
||||
171
node_modules/next/dist/client/components/errors/hydration-error-info.js
generated
vendored
Normal file
171
node_modules/next/dist/client/components/errors/hydration-error-info.js
generated
vendored
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getHydrationWarningType: null,
|
||||
getReactHydrationDiffSegments: null,
|
||||
hydrationErrorState: null,
|
||||
storeHydrationErrorStateFromConsoleArgs: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getHydrationWarningType: function() {
|
||||
return getHydrationWarningType;
|
||||
},
|
||||
getReactHydrationDiffSegments: function() {
|
||||
return getReactHydrationDiffSegments;
|
||||
},
|
||||
hydrationErrorState: function() {
|
||||
return hydrationErrorState;
|
||||
},
|
||||
storeHydrationErrorStateFromConsoleArgs: function() {
|
||||
return storeHydrationErrorStateFromConsoleArgs;
|
||||
}
|
||||
});
|
||||
const _ishydrationerror = require("../is-hydration-error");
|
||||
const hydrationErrorState = {};
|
||||
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
|
||||
const htmlTagsWarnings = new Set([
|
||||
'Warning: In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s',
|
||||
'Warning: In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s',
|
||||
'Warning: In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.',
|
||||
"Warning: In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.",
|
||||
'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s',
|
||||
'Warning: Did not expect server HTML to contain a <%s> in <%s>.%s'
|
||||
]);
|
||||
const textAndTagsMismatchWarnings = new Set([
|
||||
'Warning: Expected server HTML to contain a matching text node for "%s" in <%s>.%s',
|
||||
'Warning: Did not expect server HTML to contain the text node "%s" in <%s>.%s'
|
||||
]);
|
||||
const getHydrationWarningType = (message)=>{
|
||||
if (typeof message !== 'string') {
|
||||
// TODO: Doesn't make sense to treat no message as a hydration error message.
|
||||
// We should bail out somewhere earlier.
|
||||
return 'text';
|
||||
}
|
||||
const normalizedMessage = message.startsWith('Warning: ') ? message : "Warning: " + message;
|
||||
if (isHtmlTagsWarning(normalizedMessage)) return 'tag';
|
||||
if (isTextInTagsMismatchWarning(normalizedMessage)) return 'text-in-tag';
|
||||
return 'text';
|
||||
};
|
||||
const isHtmlTagsWarning = (message)=>htmlTagsWarnings.has(message);
|
||||
const isTextInTagsMismatchWarning = (msg)=>textAndTagsMismatchWarnings.has(msg);
|
||||
const getReactHydrationDiffSegments = (msg)=>{
|
||||
if (msg) {
|
||||
const { message, diff } = (0, _ishydrationerror.getHydrationErrorStackInfo)(msg);
|
||||
if (message) return [
|
||||
message,
|
||||
diff
|
||||
];
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
function storeHydrationErrorStateFromConsoleArgs() {
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
let [msg, firstContent, secondContent, ...rest] = args;
|
||||
if ((0, _ishydrationerror.testReactHydrationWarning)(msg)) {
|
||||
// Some hydration warnings has 4 arguments, some has 3, fallback to the last argument
|
||||
// when the 3rd argument is not the component stack but an empty string
|
||||
const isReact18 = msg.startsWith('Warning: ');
|
||||
// For some warnings, there's only 1 argument for template.
|
||||
// The second argument is the diff or component stack.
|
||||
if (args.length === 3) {
|
||||
secondContent = '';
|
||||
}
|
||||
const warning = [
|
||||
// remove the last %s from the message
|
||||
msg,
|
||||
firstContent,
|
||||
secondContent
|
||||
];
|
||||
const lastArg = (rest[rest.length - 1] || '').trim();
|
||||
if (!isReact18) {
|
||||
hydrationErrorState.reactOutputComponentDiff = lastArg;
|
||||
} else {
|
||||
hydrationErrorState.reactOutputComponentDiff = generateHydrationDiffReact18(msg, firstContent, secondContent, lastArg);
|
||||
}
|
||||
hydrationErrorState.warning = warning;
|
||||
hydrationErrorState.serverContent = firstContent;
|
||||
hydrationErrorState.clientContent = secondContent;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Some hydration errors in React 18 does not have the diff in the error message.
|
||||
* Instead it has the error stack trace which is component stack that we can leverage.
|
||||
* Will parse the diff from the error stack trace
|
||||
* e.g.
|
||||
* Warning: Expected server HTML to contain a matching <div> in <p>.
|
||||
* at div
|
||||
* at p
|
||||
* at div
|
||||
* at div
|
||||
* at Page
|
||||
* output:
|
||||
* <Page>
|
||||
* <div>
|
||||
* <p>
|
||||
* > <div>
|
||||
*
|
||||
*/ function generateHydrationDiffReact18(message, firstContent, secondContent, lastArg) {
|
||||
const componentStack = lastArg;
|
||||
let firstIndex = -1;
|
||||
let secondIndex = -1;
|
||||
const hydrationWarningType = getHydrationWarningType(message);
|
||||
// at div\n at Foo\n at Bar (....)\n -> [div, Foo]
|
||||
const components = componentStack.split('\n')// .reverse()
|
||||
.map((line, index)=>{
|
||||
// `<space>at <component> (<location>)` -> `at <component> (<location>)`
|
||||
line = line.trim();
|
||||
// extract `<space>at <component>` to `<<component>>`
|
||||
// e.g. ` at Foo` -> `<Foo>`
|
||||
const [, component, location] = /at (\w+)( \((.*)\))?/.exec(line) || [];
|
||||
// If there's no location then it's user-land stack frame
|
||||
if (!location) {
|
||||
if (component === firstContent && firstIndex === -1) {
|
||||
firstIndex = index;
|
||||
} else if (component === secondContent && secondIndex === -1) {
|
||||
secondIndex = index;
|
||||
}
|
||||
}
|
||||
return location ? '' : component;
|
||||
}).filter(Boolean).reverse();
|
||||
let diff = '';
|
||||
for(let i = 0; i < components.length; i++){
|
||||
const component = components[i];
|
||||
const matchFirstContent = hydrationWarningType === 'tag' && i === components.length - firstIndex - 1;
|
||||
const matchSecondContent = hydrationWarningType === 'tag' && i === components.length - secondIndex - 1;
|
||||
if (matchFirstContent || matchSecondContent) {
|
||||
const spaces = ' '.repeat(Math.max(i * 2 - 2, 0) + 2);
|
||||
diff += "> " + spaces + "<" + component + ">\n";
|
||||
} else {
|
||||
const spaces = ' '.repeat(i * 2 + 2);
|
||||
diff += spaces + "<" + component + ">\n";
|
||||
}
|
||||
}
|
||||
if (hydrationWarningType === 'text') {
|
||||
const spaces = ' '.repeat(components.length * 2);
|
||||
diff += "+ " + spaces + '"' + firstContent + '"\n';
|
||||
diff += "- " + spaces + '"' + secondContent + '"\n';
|
||||
} else if (hydrationWarningType === 'text-in-tag') {
|
||||
const spaces = ' '.repeat(components.length * 2);
|
||||
diff += "> " + spaces + "<" + secondContent + ">\n";
|
||||
diff += "> " + spaces + '"' + firstContent + '"\n';
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=hydration-error-info.js.map
|
||||
1
node_modules/next/dist/client/components/errors/hydration-error-info.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/hydration-error-info.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/next/dist/client/components/errors/runtime-error-handler.d.ts
generated
vendored
Normal file
3
node_modules/next/dist/client/components/errors/runtime-error-handler.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export declare const RuntimeErrorHandler: {
|
||||
hadRuntimeError: boolean;
|
||||
};
|
||||
21
node_modules/next/dist/client/components/errors/runtime-error-handler.js
generated
vendored
Normal file
21
node_modules/next/dist/client/components/errors/runtime-error-handler.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "RuntimeErrorHandler", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return RuntimeErrorHandler;
|
||||
}
|
||||
});
|
||||
const RuntimeErrorHandler = {
|
||||
hadRuntimeError: false
|
||||
};
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=runtime-error-handler.js.map
|
||||
1
node_modules/next/dist/client/components/errors/runtime-error-handler.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/runtime-error-handler.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/client/components/errors/runtime-error-handler.ts"],"sourcesContent":["export const RuntimeErrorHandler = {\n hadRuntimeError: false,\n}\n"],"names":["RuntimeErrorHandler","hadRuntimeError"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,sBAAsB;IACjCC,iBAAiB;AACnB"}
|
||||
1
node_modules/next/dist/client/components/errors/stitched-error.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/stitched-error.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function getReactStitchedError<T = unknown>(err: T): Error | T;
|
||||
60
node_modules/next/dist/client/components/errors/stitched-error.js
generated
vendored
Normal file
60
node_modules/next/dist/client/components/errors/stitched-error.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getReactStitchedError", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getReactStitchedError;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
|
||||
const _iserror = /*#__PURE__*/ _interop_require_default._(require("../../../lib/is-error"));
|
||||
const _errortelemetryutils = require("../../../lib/error-telemetry-utils");
|
||||
const REACT_ERROR_STACK_BOTTOM_FRAME = 'react-stack-bottom-frame';
|
||||
const REACT_ERROR_STACK_BOTTOM_FRAME_REGEX = new RegExp("(at " + REACT_ERROR_STACK_BOTTOM_FRAME + " )|(" + REACT_ERROR_STACK_BOTTOM_FRAME + "\\@)");
|
||||
function getReactStitchedError(err) {
|
||||
const isErrorInstance = (0, _iserror.default)(err);
|
||||
const originStack = isErrorInstance ? err.stack || '' : '';
|
||||
const originMessage = isErrorInstance ? err.message : '';
|
||||
const stackLines = originStack.split('\n');
|
||||
const indexOfSplit = stackLines.findIndex((line)=>REACT_ERROR_STACK_BOTTOM_FRAME_REGEX.test(line));
|
||||
const isOriginalReactError = indexOfSplit >= 0 // has the react-stack-bottom-frame
|
||||
;
|
||||
let newStack = isOriginalReactError ? stackLines.slice(0, indexOfSplit).join('\n') : originStack;
|
||||
const newError = Object.defineProperty(new Error(originMessage), "__NEXT_ERROR_CODE", {
|
||||
value: "E394",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
// Copy all enumerable properties, e.g. digest
|
||||
Object.assign(newError, err);
|
||||
(0, _errortelemetryutils.copyNextErrorCode)(err, newError);
|
||||
newError.stack = newStack;
|
||||
// Avoid duplicate overriding stack frames
|
||||
appendOwnerStack(newError);
|
||||
return newError;
|
||||
}
|
||||
function appendOwnerStack(error) {
|
||||
if (!_react.default.captureOwnerStack) {
|
||||
return;
|
||||
}
|
||||
let stack = error.stack || '';
|
||||
// This module is only bundled in development mode so this is safe.
|
||||
const ownerStack = _react.default.captureOwnerStack();
|
||||
// Avoid duplicate overriding stack frames
|
||||
if (ownerStack && stack.endsWith(ownerStack) === false) {
|
||||
stack += ownerStack;
|
||||
// Override stack
|
||||
error.stack = stack;
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=stitched-error.js.map
|
||||
1
node_modules/next/dist/client/components/errors/stitched-error.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/stitched-error.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/client/components/errors/stitched-error.ts"],"sourcesContent":["import React from 'react'\nimport isError from '../../../lib/is-error'\nimport { copyNextErrorCode } from '../../../lib/error-telemetry-utils'\n\nconst REACT_ERROR_STACK_BOTTOM_FRAME = 'react-stack-bottom-frame'\nconst REACT_ERROR_STACK_BOTTOM_FRAME_REGEX = new RegExp(\n `(at ${REACT_ERROR_STACK_BOTTOM_FRAME} )|(${REACT_ERROR_STACK_BOTTOM_FRAME}\\\\@)`\n)\n\nexport function getReactStitchedError<T = unknown>(err: T): Error | T {\n const isErrorInstance = isError(err)\n const originStack = isErrorInstance ? err.stack || '' : ''\n const originMessage = isErrorInstance ? err.message : ''\n const stackLines = originStack.split('\\n')\n const indexOfSplit = stackLines.findIndex((line) =>\n REACT_ERROR_STACK_BOTTOM_FRAME_REGEX.test(line)\n )\n const isOriginalReactError = indexOfSplit >= 0 // has the react-stack-bottom-frame\n let newStack = isOriginalReactError\n ? stackLines.slice(0, indexOfSplit).join('\\n')\n : originStack\n\n const newError = new Error(originMessage)\n // Copy all enumerable properties, e.g. digest\n Object.assign(newError, err)\n copyNextErrorCode(err, newError)\n newError.stack = newStack\n\n // Avoid duplicate overriding stack frames\n appendOwnerStack(newError)\n\n return newError\n}\n\nfunction appendOwnerStack(error: Error) {\n if (!React.captureOwnerStack) {\n return\n }\n let stack = error.stack || ''\n // This module is only bundled in development mode so this is safe.\n const ownerStack = React.captureOwnerStack()\n // Avoid duplicate overriding stack frames\n if (ownerStack && stack.endsWith(ownerStack) === false) {\n stack += ownerStack\n // Override stack\n error.stack = stack\n }\n}\n"],"names":["getReactStitchedError","REACT_ERROR_STACK_BOTTOM_FRAME","REACT_ERROR_STACK_BOTTOM_FRAME_REGEX","RegExp","err","isErrorInstance","isError","originStack","stack","originMessage","message","stackLines","split","indexOfSplit","findIndex","line","test","isOriginalReactError","newStack","slice","join","newError","Error","Object","assign","copyNextErrorCode","appendOwnerStack","error","React","captureOwnerStack","ownerStack","endsWith"],"mappings":";;;;+BASgBA;;;eAAAA;;;;gEATE;kEACE;qCACc;AAElC,MAAMC,iCAAiC;AACvC,MAAMC,uCAAuC,IAAIC,OAC/C,AAAC,SAAMF,iCAA+B,SAAMA,iCAA+B;AAGtE,SAASD,sBAAmCI,GAAM;IACvD,MAAMC,kBAAkBC,IAAAA,gBAAO,EAACF;IAChC,MAAMG,cAAcF,kBAAkBD,IAAII,KAAK,IAAI,KAAK;IACxD,MAAMC,gBAAgBJ,kBAAkBD,IAAIM,OAAO,GAAG;IACtD,MAAMC,aAAaJ,YAAYK,KAAK,CAAC;IACrC,MAAMC,eAAeF,WAAWG,SAAS,CAAC,CAACC,OACzCb,qCAAqCc,IAAI,CAACD;IAE5C,MAAME,uBAAuBJ,gBAAgB,EAAE,mCAAmC;;IAClF,IAAIK,WAAWD,uBACXN,WAAWQ,KAAK,CAAC,GAAGN,cAAcO,IAAI,CAAC,QACvCb;IAEJ,MAAMc,WAAW,qBAAwB,CAAxB,IAAIC,MAAMb,gBAAV,qBAAA;eAAA;oBAAA;sBAAA;IAAuB;IACxC,8CAA8C;IAC9Cc,OAAOC,MAAM,CAACH,UAAUjB;IACxBqB,IAAAA,sCAAiB,EAACrB,KAAKiB;IACvBA,SAASb,KAAK,GAAGU;IAEjB,0CAA0C;IAC1CQ,iBAAiBL;IAEjB,OAAOA;AACT;AAEA,SAASK,iBAAiBC,KAAY;IACpC,IAAI,CAACC,cAAK,CAACC,iBAAiB,EAAE;QAC5B;IACF;IACA,IAAIrB,QAAQmB,MAAMnB,KAAK,IAAI;IAC3B,mEAAmE;IACnE,MAAMsB,aAAaF,cAAK,CAACC,iBAAiB;IAC1C,0CAA0C;IAC1C,IAAIC,cAActB,MAAMuB,QAAQ,CAACD,gBAAgB,OAAO;QACtDtB,SAASsB;QACT,iBAAiB;QACjBH,MAAMnB,KAAK,GAAGA;IAChB;AACF"}
|
||||
5
node_modules/next/dist/client/components/errors/use-error-handler.d.ts
generated
vendored
Normal file
5
node_modules/next/dist/client/components/errors/use-error-handler.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export type ErrorHandler = (error: Error) => void;
|
||||
export declare function handleConsoleError(originError: unknown, consoleErrorArgs: any[]): void;
|
||||
export declare function handleClientError(originError: unknown): void;
|
||||
export declare function useErrorHandler(handleOnUnhandledError: ErrorHandler, handleOnUnhandledRejection: ErrorHandler): void;
|
||||
export declare function handleGlobalErrors(): void;
|
||||
158
node_modules/next/dist/client/components/errors/use-error-handler.js
generated
vendored
Normal file
158
node_modules/next/dist/client/components/errors/use-error-handler.js
generated
vendored
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
handleClientError: null,
|
||||
handleConsoleError: null,
|
||||
handleGlobalErrors: null,
|
||||
useErrorHandler: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
handleClientError: function() {
|
||||
return handleClientError;
|
||||
},
|
||||
handleConsoleError: function() {
|
||||
return handleConsoleError;
|
||||
},
|
||||
handleGlobalErrors: function() {
|
||||
return handleGlobalErrors;
|
||||
},
|
||||
useErrorHandler: function() {
|
||||
return useErrorHandler;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _react = require("react");
|
||||
const _attachhydrationerrorstate = require("./attach-hydration-error-state");
|
||||
const _isnextroutererror = require("../is-next-router-error");
|
||||
const _hydrationerrorinfo = require("./hydration-error-info");
|
||||
const _console = require("../../lib/console");
|
||||
const _iserror = /*#__PURE__*/ _interop_require_default._(require("../../../lib/is-error"));
|
||||
const _consoleerror = require("./console-error");
|
||||
const _enqueueclienterror = require("./enqueue-client-error");
|
||||
const _stitchederror = require("../errors/stitched-error");
|
||||
const queueMicroTask = globalThis.queueMicrotask || ((cb)=>Promise.resolve().then(cb));
|
||||
const errorQueue = [];
|
||||
const errorHandlers = [];
|
||||
const rejectionQueue = [];
|
||||
const rejectionHandlers = [];
|
||||
function handleConsoleError(originError, consoleErrorArgs) {
|
||||
let error;
|
||||
const { environmentName } = (0, _console.parseConsoleArgs)(consoleErrorArgs);
|
||||
if ((0, _iserror.default)(originError)) {
|
||||
error = (0, _consoleerror.createConsoleError)(originError, environmentName);
|
||||
} else {
|
||||
error = (0, _consoleerror.createConsoleError)((0, _console.formatConsoleArgs)(consoleErrorArgs), environmentName);
|
||||
}
|
||||
error = (0, _stitchederror.getReactStitchedError)(error);
|
||||
(0, _hydrationerrorinfo.storeHydrationErrorStateFromConsoleArgs)(...consoleErrorArgs);
|
||||
(0, _attachhydrationerrorstate.attachHydrationErrorState)(error);
|
||||
(0, _enqueueclienterror.enqueueConsecutiveDedupedError)(errorQueue, error);
|
||||
for (const handler of errorHandlers){
|
||||
// Delayed the error being passed to React Dev Overlay,
|
||||
// avoid the state being synchronously updated in the component.
|
||||
queueMicroTask(()=>{
|
||||
handler(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
function handleClientError(originError) {
|
||||
let error;
|
||||
if ((0, _iserror.default)(originError)) {
|
||||
error = originError;
|
||||
} else {
|
||||
// If it's not an error, format the args into an error
|
||||
const formattedErrorMessage = originError + '';
|
||||
error = Object.defineProperty(new Error(formattedErrorMessage), "__NEXT_ERROR_CODE", {
|
||||
value: "E394",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
error = (0, _stitchederror.getReactStitchedError)(error);
|
||||
(0, _attachhydrationerrorstate.attachHydrationErrorState)(error);
|
||||
(0, _enqueueclienterror.enqueueConsecutiveDedupedError)(errorQueue, error);
|
||||
for (const handler of errorHandlers){
|
||||
// Delayed the error being passed to React Dev Overlay,
|
||||
// avoid the state being synchronously updated in the component.
|
||||
queueMicroTask(()=>{
|
||||
handler(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
function useErrorHandler(handleOnUnhandledError, handleOnUnhandledRejection) {
|
||||
(0, _react.useEffect)(()=>{
|
||||
// Handle queued errors.
|
||||
errorQueue.forEach(handleOnUnhandledError);
|
||||
rejectionQueue.forEach(handleOnUnhandledRejection);
|
||||
// Listen to new errors.
|
||||
errorHandlers.push(handleOnUnhandledError);
|
||||
rejectionHandlers.push(handleOnUnhandledRejection);
|
||||
return ()=>{
|
||||
// Remove listeners.
|
||||
errorHandlers.splice(errorHandlers.indexOf(handleOnUnhandledError), 1);
|
||||
rejectionHandlers.splice(rejectionHandlers.indexOf(handleOnUnhandledRejection), 1);
|
||||
// Reset error queues.
|
||||
errorQueue.splice(0, errorQueue.length);
|
||||
rejectionQueue.splice(0, rejectionQueue.length);
|
||||
};
|
||||
}, [
|
||||
handleOnUnhandledError,
|
||||
handleOnUnhandledRejection
|
||||
]);
|
||||
}
|
||||
function onUnhandledError(event) {
|
||||
if ((0, _isnextroutererror.isNextRouterError)(event.error)) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
// When there's an error property present, we log the error to error overlay.
|
||||
// Otherwise we don't do anything as it's not logging in the console either.
|
||||
if (event.error) {
|
||||
handleClientError(event.error);
|
||||
}
|
||||
}
|
||||
function onUnhandledRejection(ev) {
|
||||
const reason = ev == null ? void 0 : ev.reason;
|
||||
if ((0, _isnextroutererror.isNextRouterError)(reason)) {
|
||||
ev.preventDefault();
|
||||
return;
|
||||
}
|
||||
let error = reason;
|
||||
if (error && !(0, _iserror.default)(error)) {
|
||||
error = Object.defineProperty(new Error(error + ''), "__NEXT_ERROR_CODE", {
|
||||
value: "E394",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
rejectionQueue.push(error);
|
||||
for (const handler of rejectionHandlers){
|
||||
handler(error);
|
||||
}
|
||||
}
|
||||
function handleGlobalErrors() {
|
||||
if (typeof window !== 'undefined') {
|
||||
try {
|
||||
// Increase the number of stack frames on the client
|
||||
Error.stackTraceLimit = 50;
|
||||
} catch (e) {}
|
||||
window.addEventListener('error', onUnhandledError);
|
||||
window.addEventListener('unhandledrejection', onUnhandledRejection);
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=use-error-handler.js.map
|
||||
1
node_modules/next/dist/client/components/errors/use-error-handler.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/errors/use-error-handler.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue