added fonts
This commit is contained in:
1 parent
4134e3a234
commit
142d2986b6
9079 files changed
+1498421
-2
No files matched your search
Generated
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
// This file is only used in app router due to the specific error state handling.
|
||||
import { getReactStitchedError } from '../components/errors/stitched-error';
|
||||
import { handleClientError } from '../components/errors/use-error-handler';
|
||||
import { isNextRouterError } from '../components/is-next-router-error';
|
||||
import { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr';
|
||||
import { reportGlobalError } from './report-global-error';
|
||||
import { originConsoleError } from '../components/globals/intercept-console-error';
|
||||
import { ErrorBoundaryHandler, GlobalError as DefaultErrorBoundary } from '../components/error-boundary';
|
||||
export function onCaughtError(err, errorInfo) {
|
||||
var _errorInfo_errorBoundary;
|
||||
const errorBoundaryComponent = (_errorInfo_errorBoundary = errorInfo.errorBoundary) == null ? void 0 : _errorInfo_errorBoundary.constructor;
|
||||
let isImplicitErrorBoundary;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const { AppDevOverlayErrorBoundary } = require('../components/react-dev-overlay/app/app-dev-overlay-error-boundary');
|
||||
isImplicitErrorBoundary = errorBoundaryComponent === AppDevOverlayErrorBoundary;
|
||||
}
|
||||
isImplicitErrorBoundary = isImplicitErrorBoundary || errorBoundaryComponent === ErrorBoundaryHandler && errorInfo.errorBoundary.props.errorComponent === DefaultErrorBoundary;
|
||||
if (isImplicitErrorBoundary) {
|
||||
// We don't consider errors caught unless they're caught by an explicit error
|
||||
// boundary. The built-in ones are considered implicit.
|
||||
// This mimics how the same app would behave without Next.js.
|
||||
return onUncaughtError(err, errorInfo);
|
||||
}
|
||||
// Skip certain custom errors which are not expected to be reported on client
|
||||
if (isBailoutToCSRError(err) || isNextRouterError(err)) return;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var _errorInfo_componentStack;
|
||||
const errorBoundaryName = (// read react component displayName
|
||||
errorBoundaryComponent == null ? void 0 : errorBoundaryComponent.displayName) || (errorBoundaryComponent == null ? void 0 : errorBoundaryComponent.name) || 'Unknown';
|
||||
const componentThatErroredFrame = errorInfo == null ? void 0 : (_errorInfo_componentStack = errorInfo.componentStack) == null ? void 0 : _errorInfo_componentStack.split('\n')[1];
|
||||
var // regex to match the function name in the stack trace
|
||||
// example 1: at Page (http://localhost:3000/_next/static/chunks/pages/index.js?ts=1631600000000:2:1)
|
||||
// example 2: Page@http://localhost:3000/_next/static/chunks/pages/index.js?ts=1631600000000:2:1
|
||||
_componentThatErroredFrame_match;
|
||||
// Match chrome or safari stack trace
|
||||
const matches = (_componentThatErroredFrame_match = componentThatErroredFrame == null ? void 0 : componentThatErroredFrame.match(/\s+at (\w+)\s+|(\w+)@/)) != null ? _componentThatErroredFrame_match : [];
|
||||
const componentThatErroredName = matches[1] || matches[2] || 'Unknown';
|
||||
// Create error location with errored component and error boundary, to match the behavior of default React onCaughtError handler.
|
||||
const errorBoundaryMessage = "It was handled by the <" + errorBoundaryName + "> error boundary.";
|
||||
const componentErrorMessage = componentThatErroredName ? "The above error occurred in the <" + componentThatErroredName + "> component." : "The above error occurred in one of your components.";
|
||||
const errorLocation = componentErrorMessage + " " + errorBoundaryMessage;
|
||||
const stitchedError = getReactStitchedError(err);
|
||||
// TODO: change to passing down errorInfo later
|
||||
// In development mode, pass along the component stack to the error
|
||||
if (errorInfo.componentStack) {
|
||||
;
|
||||
stitchedError._componentStack = errorInfo.componentStack;
|
||||
}
|
||||
// Log and report the error with location but without modifying the error stack
|
||||
originConsoleError('%o\n\n%s', err, errorLocation);
|
||||
handleClientError(stitchedError);
|
||||
} else {
|
||||
originConsoleError(err);
|
||||
}
|
||||
}
|
||||
export function onUncaughtError(err, errorInfo) {
|
||||
// Skip certain custom errors which are not expected to be reported on client
|
||||
if (isBailoutToCSRError(err) || isNextRouterError(err)) return;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const stitchedError = getReactStitchedError(err);
|
||||
// TODO: change to passing down errorInfo later
|
||||
// In development mode, pass along the component stack to the error
|
||||
if (errorInfo.componentStack) {
|
||||
;
|
||||
stitchedError._componentStack = errorInfo.componentStack;
|
||||
}
|
||||
// TODO: Add an adendum to the overlay telling people about custom error boundaries.
|
||||
reportGlobalError(stitchedError);
|
||||
} else {
|
||||
reportGlobalError(err);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=error-boundary-callbacks.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/react-client-callbacks/error-boundary-callbacks.ts"],"sourcesContent":["// This file is only used in app router due to the specific error state handling.\n\nimport type { ErrorInfo } from 'react'\nimport { getReactStitchedError } from '../components/errors/stitched-error'\nimport { handleClientError } from '../components/errors/use-error-handler'\nimport { isNextRouterError } from '../components/is-next-router-error'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { reportGlobalError } from './report-global-error'\nimport { originConsoleError } from '../components/globals/intercept-console-error'\nimport {\n ErrorBoundaryHandler,\n GlobalError as DefaultErrorBoundary,\n} from '../components/error-boundary'\n\nexport function onCaughtError(\n err: unknown,\n errorInfo: ErrorInfo & { errorBoundary?: React.Component }\n) {\n const errorBoundaryComponent = errorInfo.errorBoundary?.constructor\n\n let isImplicitErrorBoundary\n\n if (process.env.NODE_ENV !== 'production') {\n const { AppDevOverlayErrorBoundary } =\n require('../components/react-dev-overlay/app/app-dev-overlay-error-boundary') as typeof import('../components/react-dev-overlay/app/app-dev-overlay-error-boundary')\n\n isImplicitErrorBoundary =\n errorBoundaryComponent === AppDevOverlayErrorBoundary\n }\n\n isImplicitErrorBoundary =\n isImplicitErrorBoundary ||\n (errorBoundaryComponent === ErrorBoundaryHandler &&\n (errorInfo.errorBoundary! as InstanceType<typeof ErrorBoundaryHandler>)\n .props.errorComponent === DefaultErrorBoundary)\n\n if (isImplicitErrorBoundary) {\n // We don't consider errors caught unless they're caught by an explicit error\n // boundary. The built-in ones are considered implicit.\n // This mimics how the same app would behave without Next.js.\n return onUncaughtError(err, errorInfo)\n }\n\n // Skip certain custom errors which are not expected to be reported on client\n if (isBailoutToCSRError(err) || isNextRouterError(err)) return\n\n if (process.env.NODE_ENV !== 'production') {\n const errorBoundaryName =\n // read react component displayName\n (errorBoundaryComponent as any)?.displayName ||\n errorBoundaryComponent?.name ||\n 'Unknown'\n\n const componentThatErroredFrame = errorInfo?.componentStack?.split('\\n')[1]\n\n // Match chrome or safari stack trace\n const matches =\n // regex to match the function name in the stack trace\n // example 1: at Page (http://localhost:3000/_next/static/chunks/pages/index.js?ts=1631600000000:2:1)\n // example 2: Page@http://localhost:3000/_next/static/chunks/pages/index.js?ts=1631600000000:2:1\n componentThatErroredFrame?.match(/\\s+at (\\w+)\\s+|(\\w+)@/) ?? []\n const componentThatErroredName = matches[1] || matches[2] || 'Unknown'\n\n // Create error location with errored component and error boundary, to match the behavior of default React onCaughtError handler.\n const errorBoundaryMessage = `It was handled by the <${errorBoundaryName}> error boundary.`\n const componentErrorMessage = componentThatErroredName\n ? `The above error occurred in the <${componentThatErroredName}> component.`\n : `The above error occurred in one of your components.`\n\n const errorLocation = `${componentErrorMessage} ${errorBoundaryMessage}`\n\n const stitchedError = getReactStitchedError(err)\n // TODO: change to passing down errorInfo later\n // In development mode, pass along the component stack to the error\n if (errorInfo.componentStack) {\n ;(stitchedError as any)._componentStack = errorInfo.componentStack\n }\n\n // Log and report the error with location but without modifying the error stack\n originConsoleError('%o\\n\\n%s', err, errorLocation)\n\n handleClientError(stitchedError)\n } else {\n originConsoleError(err)\n }\n}\n\nexport function onUncaughtError(err: unknown, errorInfo: React.ErrorInfo) {\n // Skip certain custom errors which are not expected to be reported on client\n if (isBailoutToCSRError(err) || isNextRouterError(err)) return\n\n if (process.env.NODE_ENV !== 'production') {\n const stitchedError = getReactStitchedError(err)\n // TODO: change to passing down errorInfo later\n // In development mode, pass along the component stack to the error\n if (errorInfo.componentStack) {\n ;(stitchedError as any)._componentStack = errorInfo.componentStack\n }\n\n // TODO: Add an adendum to the overlay telling people about custom error boundaries.\n reportGlobalError(stitchedError)\n } else {\n reportGlobalError(err)\n }\n}\n"],"names":["getReactStitchedError","handleClientError","isNextRouterError","isBailoutToCSRError","reportGlobalError","originConsoleError","ErrorBoundaryHandler","GlobalError","DefaultErrorBoundary","onCaughtError","err","errorInfo","errorBoundaryComponent","errorBoundary","constructoLine truncated
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// This module can be shared between both pages router and app router
|
||||
import { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr';
|
||||
import { reportGlobalError } from './report-global-error';
|
||||
import { getReactStitchedError } from '../components/errors/stitched-error';
|
||||
import isError from '../../lib/is-error';
|
||||
export const onRecoverableError = (error, errorInfo)=>{
|
||||
// x-ref: https://github.com/facebook/react/pull/28736
|
||||
const cause = isError(error) && 'cause' in error ? error.cause : error;
|
||||
const stitchedError = getReactStitchedError(cause);
|
||||
// In development mode, pass along the component stack to the error
|
||||
if (process.env.NODE_ENV === 'development' && errorInfo.componentStack) {
|
||||
;
|
||||
stitchedError._componentStack = errorInfo.componentStack;
|
||||
}
|
||||
// Skip certain custom errors which are not expected to be reported on client
|
||||
if (isBailoutToCSRError(cause)) return;
|
||||
reportGlobalError(stitchedError);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=on-recoverable-error.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/react-client-callbacks/on-recoverable-error.ts"],"sourcesContent":["// This module can be shared between both pages router and app router\n\nimport type { HydrationOptions } from 'react-dom/client'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { reportGlobalError } from './report-global-error'\nimport { getReactStitchedError } from '../components/errors/stitched-error'\nimport isError from '../../lib/is-error'\n\nexport const onRecoverableError: HydrationOptions['onRecoverableError'] = (\n error,\n errorInfo\n) => {\n // x-ref: https://github.com/facebook/react/pull/28736\n const cause = isError(error) && 'cause' in error ? error.cause : error\n const stitchedError = getReactStitchedError(cause)\n // In development mode, pass along the component stack to the error\n if (process.env.NODE_ENV === 'development' && errorInfo.componentStack) {\n ;(stitchedError as any)._componentStack = errorInfo.componentStack\n }\n // Skip certain custom errors which are not expected to be reported on client\n if (isBailoutToCSRError(cause)) return\n\n reportGlobalError(stitchedError)\n}\n"],"names":["isBailoutToCSRError","reportGlobalError","getReactStitchedError","isError","onRecoverableError","error","errorInfo","cause","stitchedError","process","env","NODE_ENV","componentStack","_componentStack"],"mappings":"AAAA,qEAAqE;AAGrE,SAASA,mBAAmB,QAAQ,+CAA8C;AAClF,SAASC,iBAAiB,QAAQ,wBAAuB;AACzD,SAASC,qBAAqB,QAAQ,sCAAqC;AAC3E,OAAOC,aAAa,qBAAoB;AAExC,OAAO,MAAMC,qBAA6D,CACxEC,OACAC;IAEA,sDAAsD;IACtD,MAAMC,QAAQJ,QAAQE,UAAU,WAAWA,QAAQA,MAAME,KAAK,GAAGF;IACjE,MAAMG,gBAAgBN,sBAAsBK;IAC5C,mEAAmE;IACnE,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,iBAAiBL,UAAUM,cAAc,EAAE;;QACpEJ,cAAsBK,eAAe,GAAGP,UAAUM,cAAc;IACpE;IACA,6EAA6E;IAC7E,IAAIZ,oBAAoBO,QAAQ;IAEhCN,kBAAkBO;AACpB,EAAC"}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
export const reportGlobalError = typeof reportError === 'function' ? // emulating an uncaught JavaScript error.
|
||||
reportError : (error)=>{
|
||||
// TODO: Dispatch error event
|
||||
globalThis.console.error(error);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=report-global-error.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/react-client-callbacks/report-global-error.ts"],"sourcesContent":["export const reportGlobalError =\n typeof reportError === 'function'\n ? // In modern browsers, reportError will dispatch an error event,\n // emulating an uncaught JavaScript error.\n reportError\n : (error: unknown) => {\n // TODO: Dispatch error event\n globalThis.console.error(error)\n }\n"],"names":["reportGlobalError","reportError","error","globalThis","console"],"mappings":"AAAA,OAAO,MAAMA,oBACX,OAAOC,gBAAgB,aAEnB,0CAA0C;AAC1CA,cACA,CAACC;IACC,6BAA6B;IAC7BC,WAAWC,OAAO,CAACF,KAAK,CAACA;AAC3B,EAAC"}
|
||||
Reference in new issue
Block a user