Initial boiler plate project
This commit is contained in:
23
node_modules/next/dist/client/components/react-dev-overlay/pages/ErrorBoundary.d.ts
generated
vendored
Normal file
23
node_modules/next/dist/client/components/react-dev-overlay/pages/ErrorBoundary.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import * as React from 'react';
|
||||
type ErrorBoundaryProps = {
|
||||
children?: React.ReactNode;
|
||||
onError: (error: Error, componentStack: string | null) => void;
|
||||
globalOverlay?: boolean;
|
||||
isMounted?: boolean;
|
||||
};
|
||||
type ErrorBoundaryState = {
|
||||
error: Error | null;
|
||||
};
|
||||
export declare class ErrorBoundary extends React.PureComponent<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||
state: {
|
||||
error: null;
|
||||
};
|
||||
static getDerivedStateFromError(error: Error): {
|
||||
error: Error;
|
||||
};
|
||||
componentDidCatch(error: Error, errorInfo?: {
|
||||
componentStack?: string | null;
|
||||
}): void;
|
||||
render(): React.ReactNode;
|
||||
}
|
||||
export {};
|
||||
56
node_modules/next/dist/client/components/react-dev-overlay/pages/ErrorBoundary.js
generated
vendored
Normal file
56
node_modules/next/dist/client/components/react-dev-overlay/pages/ErrorBoundary.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "ErrorBoundary", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return ErrorBoundary;
|
||||
}
|
||||
});
|
||||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
||||
class ErrorBoundary extends _react.PureComponent {
|
||||
static getDerivedStateFromError(error) {
|
||||
return {
|
||||
error
|
||||
};
|
||||
}
|
||||
componentDidCatch(error, // Loosely typed because it depends on the React version and was
|
||||
// accidentally excluded in some versions.
|
||||
errorInfo) {
|
||||
this.props.onError(error, (errorInfo == null ? void 0 : errorInfo.componentStack) || null);
|
||||
if (!this.props.globalOverlay) {
|
||||
this.setState({
|
||||
error
|
||||
});
|
||||
}
|
||||
}
|
||||
// Explicit type is needed to avoid the generated `.d.ts` having a wide return type that could be specific the the `@types/react` version.
|
||||
render() {
|
||||
// The component has to be unmounted or else it would continue to error
|
||||
return this.state.error || this.props.globalOverlay && this.props.isMounted ? // When the overlay is global for the application and it wraps a component rendering `<html>`
|
||||
// we have to render the html shell otherwise the shadow root will not be able to attach
|
||||
this.props.globalOverlay ? /*#__PURE__*/ (0, _jsxruntime.jsxs)("html", {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("head", {}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("body", {})
|
||||
]
|
||||
}) : null : this.props.children;
|
||||
}
|
||||
constructor(...args){
|
||||
super(...args);
|
||||
this.state = {
|
||||
error: null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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=ErrorBoundary.js.map
|
||||
1
node_modules/next/dist/client/components/react-dev-overlay/pages/ErrorBoundary.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/react-dev-overlay/pages/ErrorBoundary.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/pages/ErrorBoundary.tsx"],"names":["ErrorBoundary","React","PureComponent","getDerivedStateFromError","error","componentDidCatch","errorInfo","props","onError","componentStack","globalOverlay","setState","render","state","isMounted","html","head","body","children"],"mappings":";;;;+BAUaA;;;eAAAA;;;;;iEAVU;AAUhB,MAAMA,sBAAsBC,OAAMC,aAAa;IAMpD,OAAOC,yBAAyBC,KAAY,EAAE;QAC5C,OAAO;YAAEA;QAAM;IACjB;IAEAC,kBACED,KAAY,EACZ,gEAAgE;IAChE,0CAA0C;IAC1CE,SAA8C,EAC9C;QACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACJ,OAAOE,CAAAA,6BAAAA,UAAWG,cAAc,KAAI;QACvD,IAAI,CAAC,IAAI,CAACF,KAAK,CAACG,aAAa,EAAE;YAC7B,IAAI,CAACC,QAAQ,CAAC;gBAAEP;YAAM;QACxB;IACF;IAEA,0IAA0I;IAC1IQ,SAA0B;QACxB,uEAAuE;QACvE,OAAO,IAAI,CAACC,KAAK,CAACT,KAAK,IACpB,IAAI,CAACG,KAAK,CAACG,aAAa,IAAI,IAAI,CAACH,KAAK,CAACO,SAAS,GACjD,6FAA6F;QAC7F,wFAAwF;QACxF,IAAI,CAACP,KAAK,CAACG,aAAa,iBACtB,sBAACK;;8BACC,qBAACC;8BACD,qBAACC;;aAED,OAEJ,IAAI,CAACV,KAAK,CAACW,QAAQ;IAEvB;;;aAlCAL,QAAQ;YAAET,OAAO;QAAK;;AAmCxB"}
|
||||
9
node_modules/next/dist/client/components/react-dev-overlay/pages/ReactDevOverlay.d.ts
generated
vendored
Normal file
9
node_modules/next/dist/client/components/react-dev-overlay/pages/ReactDevOverlay.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import * as React from 'react';
|
||||
type ErrorType = 'runtime' | 'build';
|
||||
interface ReactDevOverlayProps {
|
||||
children?: React.ReactNode;
|
||||
preventDisplay?: ErrorType[];
|
||||
globalOverlay?: boolean;
|
||||
}
|
||||
export default function ReactDevOverlay({ children, preventDisplay, globalOverlay, }: ReactDevOverlayProps): import("react/jsx-runtime").JSX.Element;
|
||||
export {};
|
||||
82
node_modules/next/dist/client/components/react-dev-overlay/pages/ReactDevOverlay.js
generated
vendored
Normal file
82
node_modules/next/dist/client/components/react-dev-overlay/pages/ReactDevOverlay.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return ReactDevOverlay;
|
||||
}
|
||||
});
|
||||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
||||
const _bus = /*#__PURE__*/ _interop_require_wildcard._(require("./bus"));
|
||||
const _ShadowPortal = require("../internal/components/ShadowPortal");
|
||||
const _BuildError = require("../internal/container/BuildError");
|
||||
const _Errors = require("../internal/container/Errors");
|
||||
const _ErrorBoundary = require("./ErrorBoundary");
|
||||
const _Base = require("../internal/styles/Base");
|
||||
const _ComponentStyles = require("../internal/styles/ComponentStyles");
|
||||
const _CssReset = require("../internal/styles/CssReset");
|
||||
const _shared = require("../shared");
|
||||
const shouldPreventDisplay = (errorType, preventType)=>{
|
||||
if (!preventType || !errorType) {
|
||||
return false;
|
||||
}
|
||||
return preventType.includes(errorType);
|
||||
};
|
||||
function ReactDevOverlay(param) {
|
||||
let { children, preventDisplay, globalOverlay } = param;
|
||||
const [state, dispatch] = (0, _shared.useErrorOverlayReducer)();
|
||||
_react.useEffect(()=>{
|
||||
_bus.on(dispatch);
|
||||
return function() {
|
||||
_bus.off(dispatch);
|
||||
};
|
||||
}, [
|
||||
dispatch
|
||||
]);
|
||||
const onComponentError = _react.useCallback((_error, _componentStack)=>{
|
||||
// TODO: special handling
|
||||
}, []);
|
||||
const hasBuildError = state.buildError != null;
|
||||
const hasRuntimeErrors = Boolean(state.errors.length);
|
||||
const errorType = hasBuildError ? "build" : hasRuntimeErrors ? "runtime" : null;
|
||||
const isMounted = errorType !== null;
|
||||
const displayPrevented = shouldPreventDisplay(errorType, preventDisplay);
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(_ErrorBoundary.ErrorBoundary, {
|
||||
globalOverlay: globalOverlay,
|
||||
isMounted: isMounted,
|
||||
onError: onComponentError,
|
||||
children: children != null ? children : null
|
||||
}),
|
||||
isMounted ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_ShadowPortal.ShadowPortal, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(_CssReset.CssReset, {}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Base.Base, {}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(_ComponentStyles.ComponentStyles, {}),
|
||||
displayPrevented ? null : hasBuildError ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_BuildError.BuildError, {
|
||||
message: state.buildError,
|
||||
versionInfo: state.versionInfo
|
||||
}) : hasRuntimeErrors ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Errors.Errors, {
|
||||
isAppDir: false,
|
||||
errors: state.errors,
|
||||
versionInfo: state.versionInfo,
|
||||
initialDisplayState: "fullscreen"
|
||||
}) : undefined
|
||||
]
|
||||
}) : undefined
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
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=ReactDevOverlay.js.map
|
||||
1
node_modules/next/dist/client/components/react-dev-overlay/pages/ReactDevOverlay.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/react-dev-overlay/pages/ReactDevOverlay.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/pages/ReactDevOverlay.tsx"],"names":["ReactDevOverlay","shouldPreventDisplay","errorType","preventType","includes","children","preventDisplay","globalOverlay","state","dispatch","useErrorOverlayReducer","React","useEffect","Bus","on","off","onComponentError","useCallback","_error","_componentStack","hasBuildError","buildError","hasRuntimeErrors","Boolean","errors","length","isMounted","displayPrevented","ErrorBoundary","onError","ShadowPortal","CssReset","Base","ComponentStyles","BuildError","message","versionInfo","Errors","isAppDir","initialDisplayState","undefined"],"mappings":";;;;+BA8BA;;;eAAwBA;;;;;iEA9BD;+DAEF;8BACQ;4BACF;wBACJ;+BACO;sBACT;iCACW;0BACP;wBACc;AAIvC,MAAMC,uBAAuB,CAC3BC,WACAC;IAEA,IAAI,CAACA,eAAe,CAACD,WAAW;QAC9B,OAAO;IACT;IACA,OAAOC,YAAYC,QAAQ,CAACF;AAC9B;AAQe,SAASF,gBAAgB,KAIjB;IAJiB,IAAA,EACtCK,QAAQ,EACRC,cAAc,EACdC,aAAa,EACQ,GAJiB;IAKtC,MAAM,CAACC,OAAOC,SAAS,GAAGC,IAAAA,8BAAsB;IAEhDC,OAAMC,SAAS,CAAC;QACdC,KAAIC,EAAE,CAACL;QACP,OAAO;YACLI,KAAIE,GAAG,CAACN;QACV;IACF,GAAG;QAACA;KAAS;IAEb,MAAMO,mBAAmBL,OAAMM,WAAW,CACxC,CAACC,QAAeC;IACd,yBAAyB;IAC3B,GACA,EAAE;IAGJ,MAAMC,gBAAgBZ,MAAMa,UAAU,IAAI;IAC1C,MAAMC,mBAAmBC,QAAQf,MAAMgB,MAAM,CAACC,MAAM;IACpD,MAAMvB,YAAYkB,gBACd,UACAE,mBACA,YACA;IACJ,MAAMI,YAAYxB,cAAc;IAEhC,MAAMyB,mBAAmB1B,qBAAqBC,WAAWI;IAEzD,qBACE;;0BACE,qBAACsB,4BAAa;gBACZrB,eAAeA;gBACfmB,WAAWA;gBACXG,SAASb;0BAERX,mBAAAA,WAAY;;YAEdqB,0BACC,sBAACI,0BAAY;;kCACX,qBAACC,kBAAQ;kCACT,qBAACC,UAAI;kCACL,qBAACC,gCAAe;oBAEfN,mBAAmB,OAAOP,8BACzB,qBAACc,sBAAU;wBACTC,SAAS3B,MAAMa,UAAU;wBACzBe,aAAa5B,MAAM4B,WAAW;yBAE9Bd,iCACF,qBAACe,cAAM;wBACLC,UAAU;wBACVd,QAAQhB,MAAMgB,MAAM;wBACpBY,aAAa5B,MAAM4B,WAAW;wBAC9BG,qBAAqB;yBAErBC;;iBAEJA;;;AAGV"}
|
||||
5
node_modules/next/dist/client/components/react-dev-overlay/pages/bus.d.ts
generated
vendored
Normal file
5
node_modules/next/dist/client/components/react-dev-overlay/pages/bus.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import type { BusEvent } from '../shared';
|
||||
export type BusEventHandler = (ev: BusEvent) => void;
|
||||
export declare function emit(ev: BusEvent): void;
|
||||
export declare function on(fn: BusEventHandler): boolean;
|
||||
export declare function off(fn: BusEventHandler): boolean;
|
||||
70
node_modules/next/dist/client/components/react-dev-overlay/pages/bus.js
generated
vendored
Normal file
70
node_modules/next/dist/client/components/react-dev-overlay/pages/bus.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
emit: null,
|
||||
off: null,
|
||||
on: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
emit: function() {
|
||||
return emit;
|
||||
},
|
||||
off: function() {
|
||||
return off;
|
||||
},
|
||||
on: function() {
|
||||
return on;
|
||||
}
|
||||
});
|
||||
let handlers = new Set();
|
||||
let queue = [];
|
||||
function drain() {
|
||||
// Draining should never happen synchronously in case multiple handlers are
|
||||
// registered.
|
||||
setTimeout(function() {
|
||||
while(// Until we are out of events:
|
||||
Boolean(queue.length) && // Or, if all handlers removed themselves as a result of handling the
|
||||
// event(s)
|
||||
Boolean(handlers.size)){
|
||||
const ev = queue.shift();
|
||||
handlers.forEach((handler)=>handler(ev));
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
function emit(ev) {
|
||||
queue.push(Object.freeze({
|
||||
...ev
|
||||
}));
|
||||
drain();
|
||||
}
|
||||
function on(fn) {
|
||||
if (handlers.has(fn)) {
|
||||
return false;
|
||||
}
|
||||
handlers.add(fn);
|
||||
drain();
|
||||
return true;
|
||||
}
|
||||
function off(fn) {
|
||||
if (handlers.has(fn)) {
|
||||
handlers.delete(fn);
|
||||
return true;
|
||||
}
|
||||
return 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=bus.js.map
|
||||
1
node_modules/next/dist/client/components/react-dev-overlay/pages/bus.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/react-dev-overlay/pages/bus.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/pages/bus.ts"],"names":["emit","off","on","handlers","Set","queue","drain","setTimeout","Boolean","length","size","ev","shift","forEach","handler","push","Object","freeze","fn","has","add","delete"],"mappings":";;;;;;;;;;;;;;;;IAwBgBA,IAAI;eAAJA;;IAeAC,GAAG;eAAHA;;IAVAC,EAAE;eAAFA;;;AAzBhB,IAAIC,WAAiC,IAAIC;AACzC,IAAIC,QAAoB,EAAE;AAE1B,SAASC;IACP,2EAA2E;IAC3E,cAAc;IACdC,WAAW;QACT,MACE,8BAA8B;QAC9BC,QAAQH,MAAMI,MAAM,KACpB,qEAAqE;QACrE,WAAW;QACXD,QAAQL,SAASO,IAAI,EACrB;YACA,MAAMC,KAAKN,MAAMO,KAAK;YACtBT,SAASU,OAAO,CAAC,CAACC,UAAYA,QAAQH;QACxC;IACF,GAAG;AACL;AAEO,SAASX,KAAKW,EAAY;IAC/BN,MAAMU,IAAI,CAACC,OAAOC,MAAM,CAAC;QAAE,GAAGN,EAAE;IAAC;IACjCL;AACF;AAEO,SAASJ,GAAGgB,EAAmB;IACpC,IAAIf,SAASgB,GAAG,CAACD,KAAK;QACpB,OAAO;IACT;IAEAf,SAASiB,GAAG,CAACF;IACbZ;IACA,OAAO;AACT;AAEO,SAASL,IAAIiB,EAAmB;IACrC,IAAIf,SAASgB,GAAG,CAACD,KAAK;QACpBf,SAASkB,MAAM,CAACH;QAChB,OAAO;IACT;IAEA,OAAO;AACT"}
|
||||
11
node_modules/next/dist/client/components/react-dev-overlay/pages/client.d.ts
generated
vendored
Normal file
11
node_modules/next/dist/client/components/react-dev-overlay/pages/client.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import type { VersionInfo } from '../../../../server/dev/parse-version-info';
|
||||
export declare function register(): void;
|
||||
export declare function unregister(): void;
|
||||
export declare function onBuildOk(): void;
|
||||
export declare function onBuildError(message: string): void;
|
||||
export declare function onRefresh(): void;
|
||||
export declare function onBeforeRefresh(): void;
|
||||
export declare function onVersionInfo(versionInfo: VersionInfo): void;
|
||||
export { getErrorByType } from '../internal/helpers/getErrorByType';
|
||||
export { getServerError } from '../internal/helpers/nodeStackFrames';
|
||||
export { default as ReactDevOverlay } from './ReactDevOverlay';
|
||||
172
node_modules/next/dist/client/components/react-dev-overlay/pages/client.js
generated
vendored
Normal file
172
node_modules/next/dist/client/components/react-dev-overlay/pages/client.js
generated
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
ReactDevOverlay: null,
|
||||
getErrorByType: null,
|
||||
getServerError: null,
|
||||
onBeforeRefresh: null,
|
||||
onBuildError: null,
|
||||
onBuildOk: null,
|
||||
onRefresh: null,
|
||||
onVersionInfo: null,
|
||||
register: null,
|
||||
unregister: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
ReactDevOverlay: function() {
|
||||
return _ReactDevOverlay.default;
|
||||
},
|
||||
getErrorByType: function() {
|
||||
return _getErrorByType.getErrorByType;
|
||||
},
|
||||
getServerError: function() {
|
||||
return _nodeStackFrames.getServerError;
|
||||
},
|
||||
onBeforeRefresh: function() {
|
||||
return onBeforeRefresh;
|
||||
},
|
||||
onBuildError: function() {
|
||||
return onBuildError;
|
||||
},
|
||||
onBuildOk: function() {
|
||||
return onBuildOk;
|
||||
},
|
||||
onRefresh: function() {
|
||||
return onRefresh;
|
||||
},
|
||||
onVersionInfo: function() {
|
||||
return onVersionInfo;
|
||||
},
|
||||
register: function() {
|
||||
return register;
|
||||
},
|
||||
unregister: function() {
|
||||
return unregister;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
const _bus = /*#__PURE__*/ _interop_require_wildcard._(require("./bus"));
|
||||
const _parseStack = require("../internal/helpers/parseStack");
|
||||
const _parsecomponentstack = require("../internal/helpers/parse-component-stack");
|
||||
const _hydrationerrorinfo = require("../internal/helpers/hydration-error-info");
|
||||
const _shared = require("../shared");
|
||||
const _getErrorByType = require("../internal/helpers/getErrorByType");
|
||||
const _nodeStackFrames = require("../internal/helpers/nodeStackFrames");
|
||||
const _ReactDevOverlay = /*#__PURE__*/ _interop_require_default._(require("./ReactDevOverlay"));
|
||||
// Patch console.error to collect information about hydration errors
|
||||
(0, _hydrationerrorinfo.patchConsoleError)();
|
||||
let isRegistered = false;
|
||||
let stackTraceLimit = undefined;
|
||||
function onUnhandledError(ev) {
|
||||
const error = ev == null ? void 0 : ev.error;
|
||||
if (!error || !(error instanceof Error) || typeof error.stack !== "string") {
|
||||
// A non-error was thrown, we don't have anything to show. :-(
|
||||
return;
|
||||
}
|
||||
if (error.message.match(/(hydration|content does not match|did not match)/i)) {
|
||||
if (_hydrationerrorinfo.hydrationErrorState.warning) {
|
||||
error.details = {
|
||||
...error.details,
|
||||
// It contains the warning, component stack, server and client tag names
|
||||
..._hydrationerrorinfo.hydrationErrorState
|
||||
};
|
||||
}
|
||||
error.message += "\nSee more info here: https://nextjs.org/docs/messages/react-hydration-error";
|
||||
}
|
||||
const e = error;
|
||||
const componentStackFrames = typeof _hydrationerrorinfo.hydrationErrorState.componentStack === "string" ? (0, _parsecomponentstack.parseComponentStack)(_hydrationerrorinfo.hydrationErrorState.componentStack) : undefined;
|
||||
// Skip ModuleBuildError and ModuleNotFoundError, as it will be sent through onBuildError callback.
|
||||
// This is to avoid same error as different type showing up on client to cause flashing.
|
||||
if (e.name !== "ModuleBuildError" && e.name !== "ModuleNotFoundError") {
|
||||
_bus.emit({
|
||||
type: _shared.ACTION_UNHANDLED_ERROR,
|
||||
reason: error,
|
||||
frames: (0, _parseStack.parseStack)(e.stack),
|
||||
componentStackFrames
|
||||
});
|
||||
}
|
||||
}
|
||||
function onUnhandledRejection(ev) {
|
||||
const reason = ev == null ? void 0 : ev.reason;
|
||||
if (!reason || !(reason instanceof Error) || typeof reason.stack !== "string") {
|
||||
// A non-error was thrown, we don't have anything to show. :-(
|
||||
return;
|
||||
}
|
||||
const e = reason;
|
||||
_bus.emit({
|
||||
type: _shared.ACTION_UNHANDLED_REJECTION,
|
||||
reason: reason,
|
||||
frames: (0, _parseStack.parseStack)(e.stack)
|
||||
});
|
||||
}
|
||||
function register() {
|
||||
if (isRegistered) {
|
||||
return;
|
||||
}
|
||||
isRegistered = true;
|
||||
try {
|
||||
const limit = Error.stackTraceLimit;
|
||||
Error.stackTraceLimit = 50;
|
||||
stackTraceLimit = limit;
|
||||
} catch (e) {}
|
||||
window.addEventListener("error", onUnhandledError);
|
||||
window.addEventListener("unhandledrejection", onUnhandledRejection);
|
||||
}
|
||||
function unregister() {
|
||||
if (!isRegistered) {
|
||||
return;
|
||||
}
|
||||
isRegistered = false;
|
||||
if (stackTraceLimit !== undefined) {
|
||||
try {
|
||||
Error.stackTraceLimit = stackTraceLimit;
|
||||
} catch (e) {}
|
||||
stackTraceLimit = undefined;
|
||||
}
|
||||
window.removeEventListener("error", onUnhandledError);
|
||||
window.removeEventListener("unhandledrejection", onUnhandledRejection);
|
||||
}
|
||||
function onBuildOk() {
|
||||
_bus.emit({
|
||||
type: _shared.ACTION_BUILD_OK
|
||||
});
|
||||
}
|
||||
function onBuildError(message) {
|
||||
_bus.emit({
|
||||
type: _shared.ACTION_BUILD_ERROR,
|
||||
message
|
||||
});
|
||||
}
|
||||
function onRefresh() {
|
||||
_bus.emit({
|
||||
type: _shared.ACTION_REFRESH
|
||||
});
|
||||
}
|
||||
function onBeforeRefresh() {
|
||||
_bus.emit({
|
||||
type: _shared.ACTION_BEFORE_REFRESH
|
||||
});
|
||||
}
|
||||
function onVersionInfo(versionInfo) {
|
||||
_bus.emit({
|
||||
type: _shared.ACTION_VERSION_INFO,
|
||||
versionInfo
|
||||
});
|
||||
}
|
||||
|
||||
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=client.js.map
|
||||
1
node_modules/next/dist/client/components/react-dev-overlay/pages/client.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/react-dev-overlay/pages/client.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/pages/client.ts"],"names":["ReactDevOverlay","getErrorByType","getServerError","onBeforeRefresh","onBuildError","onBuildOk","onRefresh","onVersionInfo","register","unregister","patchConsoleError","isRegistered","stackTraceLimit","undefined","onUnhandledError","ev","error","Error","stack","message","match","hydrationErrorState","warning","details","e","componentStackFrames","componentStack","parseComponentStack","name","Bus","emit","type","ACTION_UNHANDLED_ERROR","reason","frames","parseStack","onUnhandledRejection","ACTION_UNHANDLED_REJECTION","limit","window","addEventListener","removeEventListener","ACTION_BUILD_OK","ACTION_BUILD_ERROR","ACTION_REFRESH","ACTION_BEFORE_REFRESH","versionInfo","ACTION_VERSION_INFO"],"mappings":"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"}
|
||||
39
node_modules/next/dist/client/components/react-dev-overlay/pages/hot-reloader-client.d.ts
generated
vendored
Normal file
39
node_modules/next/dist/client/components/react-dev-overlay/pages/hot-reloader-client.d.ts
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import type { TurbopackMsgToBrowser } from '../../../../server/dev/hot-reloader-types';
|
||||
declare global {
|
||||
const __webpack_hash__: string;
|
||||
interface Window {
|
||||
__nextDevClientId: number;
|
||||
__NEXT_HMR_LATENCY_CB: any;
|
||||
}
|
||||
}
|
||||
export default function connect(mode: 'webpack' | 'turbopack'): {
|
||||
subscribeToHmrEvent(handler: any): void;
|
||||
onUnrecoverableError(): void;
|
||||
addTurbopackMessageListener(cb: (msg: TurbopackMsgToBrowser) => void): void;
|
||||
sendTurbopackMessage(msg: string): void;
|
||||
handleUpdateError(err: unknown): void;
|
||||
};
|
||||
export declare function performFullReload(err: any): void;
|
||||
422
node_modules/next/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js
generated
vendored
Normal file
422
node_modules/next/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js
generated
vendored
Normal file
@ -0,0 +1,422 @@
|
||||
// TODO: Remove use of `any` type. Fix no-use-before-define violations.
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */ /**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/ // This file is a modified version of the Create React App HMR dev client that
|
||||
// can be found here:
|
||||
// https://github.com/facebook/create-react-app/blob/v3.4.1/packages/react-dev-utils/webpackHotDevClient.js
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
default: null,
|
||||
performFullReload: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
default: function() {
|
||||
return connect;
|
||||
},
|
||||
performFullReload: function() {
|
||||
return performFullReload;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _client = require("./client");
|
||||
const _stripansi = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/strip-ansi"));
|
||||
const _websocket = require("./websocket");
|
||||
const _formatwebpackmessages = /*#__PURE__*/ _interop_require_default._(require("../internal/helpers/format-webpack-messages"));
|
||||
const _hotreloadertypes = require("../../../../server/dev/hot-reloader-types");
|
||||
const _extractmodulesfromturbopackmessage = require("../../../../server/dev/extract-modules-from-turbopack-message");
|
||||
const _shared = require("../shared");
|
||||
const _runtimeerrorhandler = require("../internal/helpers/runtime-error-handler");
|
||||
window.__nextDevClientId = Math.round(Math.random() * 100 + Date.now());
|
||||
let customHmrEventHandler;
|
||||
let turbopackMessageListeners = [];
|
||||
let MODE = "webpack";
|
||||
function connect(mode) {
|
||||
MODE = mode;
|
||||
(0, _client.register)();
|
||||
(0, _websocket.addMessageListener)((payload)=>{
|
||||
if (!("action" in payload)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
processMessage(payload);
|
||||
} catch (err) {
|
||||
var _err_stack;
|
||||
console.warn("[HMR] Invalid message: " + payload + "\n" + ((_err_stack = err == null ? void 0 : err.stack) != null ? _err_stack : ""));
|
||||
}
|
||||
});
|
||||
return {
|
||||
subscribeToHmrEvent (handler) {
|
||||
customHmrEventHandler = handler;
|
||||
},
|
||||
onUnrecoverableError () {
|
||||
_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError = true;
|
||||
},
|
||||
addTurbopackMessageListener (cb) {
|
||||
turbopackMessageListeners.push(cb);
|
||||
},
|
||||
sendTurbopackMessage (msg) {
|
||||
(0, _websocket.sendMessage)(msg);
|
||||
},
|
||||
handleUpdateError (err) {
|
||||
performFullReload(err);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Remember some state related to hot module replacement.
|
||||
var isFirstCompilation = true;
|
||||
var mostRecentCompilationHash = null;
|
||||
var hasCompileErrors = false;
|
||||
function clearOutdatedErrors() {
|
||||
// Clean up outdated compile errors, if any.
|
||||
if (typeof console !== "undefined" && typeof console.clear === "function") {
|
||||
if (hasCompileErrors) {
|
||||
console.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Successful compilation.
|
||||
function handleSuccess() {
|
||||
clearOutdatedErrors();
|
||||
if (MODE === "webpack") {
|
||||
const isHotUpdate = !isFirstCompilation || window.__NEXT_DATA__.page !== "/_error" && isUpdateAvailable();
|
||||
isFirstCompilation = false;
|
||||
hasCompileErrors = false;
|
||||
// Attempt to apply hot updates or reload.
|
||||
if (isHotUpdate) {
|
||||
tryApplyUpdates(onBeforeFastRefresh, onFastRefresh);
|
||||
}
|
||||
} else {
|
||||
(0, _client.onBuildOk)();
|
||||
}
|
||||
}
|
||||
// Compilation with warnings (e.g. ESLint).
|
||||
function handleWarnings(warnings) {
|
||||
clearOutdatedErrors();
|
||||
const isHotUpdate = !isFirstCompilation;
|
||||
isFirstCompilation = false;
|
||||
hasCompileErrors = false;
|
||||
function printWarnings() {
|
||||
// Print warnings to the console.
|
||||
const formatted = (0, _formatwebpackmessages.default)({
|
||||
warnings: warnings,
|
||||
errors: []
|
||||
});
|
||||
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
||||
var _formatted_warnings;
|
||||
for(let i = 0; i < ((_formatted_warnings = formatted.warnings) == null ? void 0 : _formatted_warnings.length); i++){
|
||||
if (i === 5) {
|
||||
console.warn("There were more warnings in other files.\n" + "You can find a complete log in the terminal.");
|
||||
break;
|
||||
}
|
||||
console.warn((0, _stripansi.default)(formatted.warnings[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
printWarnings();
|
||||
// Attempt to apply hot updates or reload.
|
||||
if (isHotUpdate) {
|
||||
tryApplyUpdates(onBeforeFastRefresh, onFastRefresh);
|
||||
}
|
||||
}
|
||||
// Compilation with errors (e.g. syntax error or missing modules).
|
||||
function handleErrors(errors) {
|
||||
clearOutdatedErrors();
|
||||
isFirstCompilation = false;
|
||||
hasCompileErrors = true;
|
||||
// "Massage" webpack messages.
|
||||
var formatted = (0, _formatwebpackmessages.default)({
|
||||
errors: errors,
|
||||
warnings: []
|
||||
});
|
||||
// Only show the first error.
|
||||
(0, _client.onBuildError)(formatted.errors[0]);
|
||||
// Also log them to the console.
|
||||
if (typeof console !== "undefined" && typeof console.error === "function") {
|
||||
for(var i = 0; i < formatted.errors.length; i++){
|
||||
console.error((0, _stripansi.default)(formatted.errors[i]));
|
||||
}
|
||||
}
|
||||
// Do not attempt to reload now.
|
||||
// We will reload on next success instead.
|
||||
if (process.env.__NEXT_TEST_MODE) {
|
||||
if (self.__NEXT_HMR_CB) {
|
||||
self.__NEXT_HMR_CB(formatted.errors[0]);
|
||||
self.__NEXT_HMR_CB = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
let startLatency = undefined;
|
||||
function onBeforeFastRefresh(updatedModules) {
|
||||
if (updatedModules.length > 0) {
|
||||
// Only trigger a pending state if we have updates to apply
|
||||
// (cf. onFastRefresh)
|
||||
(0, _client.onBeforeRefresh)();
|
||||
}
|
||||
}
|
||||
function onFastRefresh(updatedModules) {
|
||||
if (updatedModules === void 0) updatedModules = [];
|
||||
(0, _client.onBuildOk)();
|
||||
if (updatedModules.length === 0) {
|
||||
return;
|
||||
}
|
||||
(0, _client.onRefresh)();
|
||||
reportHmrLatency();
|
||||
}
|
||||
function reportHmrLatency(updatedModules) {
|
||||
if (updatedModules === void 0) updatedModules = [];
|
||||
if (startLatency) {
|
||||
const endLatency = Date.now();
|
||||
const latency = endLatency - startLatency;
|
||||
console.log("[Fast Refresh] done in " + latency + "ms");
|
||||
(0, _websocket.sendMessage)(JSON.stringify({
|
||||
event: "client-hmr-latency",
|
||||
id: window.__nextDevClientId,
|
||||
startTime: startLatency,
|
||||
endTime: endLatency,
|
||||
page: window.location.pathname,
|
||||
updatedModules,
|
||||
// Whether the page (tab) was hidden at the time the event occurred.
|
||||
// This can impact the accuracy of the event's timing.
|
||||
isPageHidden: document.visibilityState === "hidden"
|
||||
}));
|
||||
if (self.__NEXT_HMR_LATENCY_CB) {
|
||||
self.__NEXT_HMR_LATENCY_CB(latency);
|
||||
}
|
||||
}
|
||||
}
|
||||
// There is a newer version of the code available.
|
||||
function handleAvailableHash(hash) {
|
||||
// Update last known compilation hash.
|
||||
mostRecentCompilationHash = hash;
|
||||
}
|
||||
/** Handles messages from the sevrer for the Pages Router. */ function processMessage(obj) {
|
||||
if (!("action" in obj)) {
|
||||
return;
|
||||
}
|
||||
// Use turbopack message for analytics, (still need built for webpack)
|
||||
switch(obj.action){
|
||||
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.BUILDING:
|
||||
{
|
||||
startLatency = Date.now();
|
||||
console.log("[Fast Refresh] rebuilding");
|
||||
break;
|
||||
}
|
||||
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.BUILT:
|
||||
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SYNC:
|
||||
{
|
||||
if (obj.hash) handleAvailableHash(obj.hash);
|
||||
const { errors, warnings } = obj;
|
||||
// Is undefined when it's a 'built' event
|
||||
if ("versionInfo" in obj) (0, _client.onVersionInfo)(obj.versionInfo);
|
||||
const hasErrors = Boolean(errors && errors.length);
|
||||
if (hasErrors) {
|
||||
(0, _websocket.sendMessage)(JSON.stringify({
|
||||
event: "client-error",
|
||||
errorCount: errors.length,
|
||||
clientId: window.__nextDevClientId
|
||||
}));
|
||||
return handleErrors(errors);
|
||||
}
|
||||
const hasWarnings = Boolean(warnings && warnings.length);
|
||||
if (hasWarnings) {
|
||||
(0, _websocket.sendMessage)(JSON.stringify({
|
||||
event: "client-warning",
|
||||
warningCount: warnings.length,
|
||||
clientId: window.__nextDevClientId
|
||||
}));
|
||||
return handleWarnings(warnings);
|
||||
}
|
||||
(0, _websocket.sendMessage)(JSON.stringify({
|
||||
event: "client-success",
|
||||
clientId: window.__nextDevClientId
|
||||
}));
|
||||
return handleSuccess();
|
||||
}
|
||||
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES:
|
||||
{
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR:
|
||||
{
|
||||
const { errorJSON } = obj;
|
||||
if (errorJSON) {
|
||||
const { message, stack } = JSON.parse(errorJSON);
|
||||
const error = new Error(message);
|
||||
error.stack = stack;
|
||||
handleErrors([
|
||||
error
|
||||
]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED:
|
||||
{
|
||||
for (const listener of turbopackMessageListeners){
|
||||
listener({
|
||||
type: _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE:
|
||||
{
|
||||
const updatedModules = (0, _extractmodulesfromturbopackmessage.extractModulesFromTurbopackMessage)(obj.data);
|
||||
onBeforeFastRefresh(updatedModules);
|
||||
for (const listener of turbopackMessageListeners){
|
||||
listener({
|
||||
type: _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE,
|
||||
data: obj.data
|
||||
});
|
||||
}
|
||||
if (_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
|
||||
console.warn(_shared.REACT_REFRESH_FULL_RELOAD_FROM_ERROR);
|
||||
performFullReload(null);
|
||||
}
|
||||
(0, _client.onRefresh)();
|
||||
reportHmrLatency(updatedModules);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (customHmrEventHandler) {
|
||||
customHmrEventHandler(obj);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Is there a newer version of this code available?
|
||||
function isUpdateAvailable() {
|
||||
/* globals __webpack_hash__ */ // __webpack_hash__ is the hash of the current compilation.
|
||||
// It's a global variable injected by Webpack.
|
||||
return mostRecentCompilationHash !== __webpack_hash__;
|
||||
}
|
||||
// Webpack disallows updates in other states.
|
||||
function canApplyUpdates() {
|
||||
// @ts-expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
|
||||
return module.hot.status() === "idle";
|
||||
}
|
||||
function afterApplyUpdates(fn) {
|
||||
if (canApplyUpdates()) {
|
||||
fn();
|
||||
} else {
|
||||
function handler(status) {
|
||||
if (status === "idle") {
|
||||
// @ts-expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
|
||||
module.hot.removeStatusHandler(handler);
|
||||
fn();
|
||||
}
|
||||
}
|
||||
// @ts-expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
|
||||
module.hot.addStatusHandler(handler);
|
||||
}
|
||||
}
|
||||
// Attempt to update code on the fly, fall back to a hard reload.
|
||||
function tryApplyUpdates(onBeforeHotUpdate, onHotUpdateSuccess) {
|
||||
// @ts-expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
|
||||
if (!module.hot) {
|
||||
// HotModuleReplacementPlugin is not in Webpack configuration.
|
||||
console.error("HotModuleReplacementPlugin is not in Webpack configuration.");
|
||||
// window.location.reload();
|
||||
return;
|
||||
}
|
||||
if (!isUpdateAvailable() || !canApplyUpdates()) {
|
||||
(0, _client.onBuildOk)();
|
||||
return;
|
||||
}
|
||||
function handleApplyUpdates(err, updatedModules) {
|
||||
if (err || _runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError || !updatedModules) {
|
||||
if (err) {
|
||||
console.warn("[Fast Refresh] performing full reload\n\n" + "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React rendering tree.\n" + "You might have a file which exports a React component but also exports a value that is imported by a non-React component file.\n" + "Consider migrating the non-React component export to a separate file and importing it into both files.\n\n" + "It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\n" + "Fast Refresh requires at least one parent function component in your React tree.");
|
||||
} else if (_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
|
||||
console.warn("[Fast Refresh] performing full reload because your application had an unrecoverable error");
|
||||
}
|
||||
performFullReload(err);
|
||||
return;
|
||||
}
|
||||
if (typeof onHotUpdateSuccess === "function") {
|
||||
// Maybe we want to do something.
|
||||
onHotUpdateSuccess(updatedModules);
|
||||
}
|
||||
if (isUpdateAvailable()) {
|
||||
// While we were updating, there was a new update! Do it again.
|
||||
// However, this time, don't trigger a pending refresh state.
|
||||
tryApplyUpdates(updatedModules.length > 0 ? undefined : onBeforeHotUpdate, updatedModules.length > 0 ? _client.onBuildOk : onHotUpdateSuccess);
|
||||
} else {
|
||||
(0, _client.onBuildOk)();
|
||||
if (process.env.__NEXT_TEST_MODE) {
|
||||
afterApplyUpdates(()=>{
|
||||
if (self.__NEXT_HMR_CB) {
|
||||
self.__NEXT_HMR_CB();
|
||||
self.__NEXT_HMR_CB = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// https://webpack.js.org/api/hot-module-replacement/#check
|
||||
// @ts-expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
|
||||
module.hot.check(/* autoApply */ false).then((updatedModules)=>{
|
||||
if (!updatedModules) {
|
||||
return null;
|
||||
}
|
||||
if (typeof onBeforeHotUpdate === "function") {
|
||||
onBeforeHotUpdate(updatedModules);
|
||||
}
|
||||
// @ts-expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
|
||||
return module.hot.apply();
|
||||
}).then((updatedModules)=>{
|
||||
handleApplyUpdates(null, updatedModules);
|
||||
}, (err)=>{
|
||||
handleApplyUpdates(err, null);
|
||||
});
|
||||
}
|
||||
function performFullReload(err) {
|
||||
const stackTrace = err && (err.stack && err.stack.split("\n").slice(0, 5).join("\n") || err.message || err + "");
|
||||
(0, _websocket.sendMessage)(JSON.stringify({
|
||||
event: "client-full-reload",
|
||||
stackTrace,
|
||||
hadRuntimeError: !!_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError,
|
||||
dependencyChain: err ? err.dependencyChain : undefined
|
||||
}));
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
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=hot-reloader-client.js.map
|
||||
1
node_modules/next/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
9
node_modules/next/dist/client/components/react-dev-overlay/pages/websocket.d.ts
generated
vendored
Normal file
9
node_modules/next/dist/client/components/react-dev-overlay/pages/websocket.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import type { HMR_ACTION_TYPES } from '../../../../server/dev/hot-reloader-types';
|
||||
type ActionCallback = (action: HMR_ACTION_TYPES) => void;
|
||||
export declare function addMessageListener(callback: ActionCallback): void;
|
||||
export declare function sendMessage(data: string): void;
|
||||
export declare function connectHMR(options: {
|
||||
path: string;
|
||||
assetPrefix: string;
|
||||
}): void;
|
||||
export {};
|
||||
83
node_modules/next/dist/client/components/react-dev-overlay/pages/websocket.js
generated
vendored
Normal file
83
node_modules/next/dist/client/components/react-dev-overlay/pages/websocket.js
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
addMessageListener: null,
|
||||
connectHMR: null,
|
||||
sendMessage: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
addMessageListener: function() {
|
||||
return addMessageListener;
|
||||
},
|
||||
connectHMR: function() {
|
||||
return connectHMR;
|
||||
},
|
||||
sendMessage: function() {
|
||||
return sendMessage;
|
||||
}
|
||||
});
|
||||
const _getsocketurl = require("../internal/helpers/get-socket-url");
|
||||
let source;
|
||||
const eventCallbacks = [];
|
||||
function addMessageListener(callback) {
|
||||
eventCallbacks.push(callback);
|
||||
}
|
||||
function sendMessage(data) {
|
||||
if (!source || source.readyState !== source.OPEN) return;
|
||||
return source.send(data);
|
||||
}
|
||||
let reconnections = 0;
|
||||
function connectHMR(options) {
|
||||
function init() {
|
||||
if (source) source.close();
|
||||
function handleOnline() {
|
||||
reconnections = 0;
|
||||
window.console.log("[HMR] connected");
|
||||
}
|
||||
function handleMessage(event) {
|
||||
// Coerce into HMR_ACTION_TYPES as that is the format.
|
||||
const msg = JSON.parse(event.data);
|
||||
for (const eventCallback of eventCallbacks){
|
||||
eventCallback(msg);
|
||||
}
|
||||
}
|
||||
let timer;
|
||||
function handleDisconnect() {
|
||||
source.onerror = null;
|
||||
source.onclose = null;
|
||||
source.close();
|
||||
reconnections++;
|
||||
// After 25 reconnects we'll want to reload the page as it indicates the dev server is no longer running.
|
||||
if (reconnections > 25) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
clearTimeout(timer);
|
||||
// Try again after 5 seconds
|
||||
timer = setTimeout(init, reconnections > 5 ? 5000 : 1000);
|
||||
}
|
||||
const url = (0, _getsocketurl.getSocketUrl)(options.assetPrefix);
|
||||
source = new window.WebSocket("" + url + options.path);
|
||||
source.onopen = handleOnline;
|
||||
source.onerror = handleDisconnect;
|
||||
source.onclose = handleDisconnect;
|
||||
source.onmessage = handleMessage;
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
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=websocket.js.map
|
||||
1
node_modules/next/dist/client/components/react-dev-overlay/pages/websocket.js.map
generated
vendored
Normal file
1
node_modules/next/dist/client/components/react-dev-overlay/pages/websocket.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/pages/websocket.ts"],"names":["addMessageListener","connectHMR","sendMessage","source","eventCallbacks","callback","push","data","readyState","OPEN","send","reconnections","options","init","close","handleOnline","window","console","log","handleMessage","event","msg","JSON","parse","eventCallback","timer","handleDisconnect","onerror","onclose","location","reload","clearTimeout","setTimeout","url","getSocketUrl","assetPrefix","WebSocket","path","onopen","onmessage"],"mappings":";;;;;;;;;;;;;;;;IASgBA,kBAAkB;eAAlBA;;IAWAC,UAAU;eAAVA;;IAPAC,WAAW;eAAXA;;;8BAZa;AAE7B,IAAIC;AAIJ,MAAMC,iBAAwC,EAAE;AAEzC,SAASJ,mBAAmBK,QAAwB;IACzDD,eAAeE,IAAI,CAACD;AACtB;AAEO,SAASH,YAAYK,IAAY;IACtC,IAAI,CAACJ,UAAUA,OAAOK,UAAU,KAAKL,OAAOM,IAAI,EAAE;IAClD,OAAON,OAAOO,IAAI,CAACH;AACrB;AAEA,IAAII,gBAAgB;AAEb,SAASV,WAAWW,OAA8C;IACvE,SAASC;QACP,IAAIV,QAAQA,OAAOW,KAAK;QAExB,SAASC;YACPJ,gBAAgB;YAChBK,OAAOC,OAAO,CAACC,GAAG,CAAC;QACrB;QAEA,SAASC,cAAcC,KAA2B;YAChD,sDAAsD;YACtD,MAAMC,MAAwBC,KAAKC,KAAK,CAACH,MAAMb,IAAI;YACnD,KAAK,MAAMiB,iBAAiBpB,eAAgB;gBAC1CoB,cAAcH;YAChB;QACF;QAEA,IAAII;QACJ,SAASC;YACPvB,OAAOwB,OAAO,GAAG;YACjBxB,OAAOyB,OAAO,GAAG;YACjBzB,OAAOW,KAAK;YACZH;YACA,yGAAyG;YACzG,IAAIA,gBAAgB,IAAI;gBACtBK,OAAOa,QAAQ,CAACC,MAAM;gBACtB;YACF;YAEAC,aAAaN;YACb,4BAA4B;YAC5BA,QAAQO,WAAWnB,MAAMF,gBAAgB,IAAI,OAAO;QACtD;QAEA,MAAMsB,MAAMC,IAAAA,0BAAY,EAACtB,QAAQuB,WAAW;QAE5ChC,SAAS,IAAIa,OAAOoB,SAAS,CAAC,AAAC,KAAEH,MAAMrB,QAAQyB,IAAI;QACnDlC,OAAOmC,MAAM,GAAGvB;QAChBZ,OAAOwB,OAAO,GAAGD;QACjBvB,OAAOyB,OAAO,GAAGF;QACjBvB,OAAOoC,SAAS,GAAGpB;IACrB;IAEAN;AACF"}
|
||||
Reference in New Issue
Block a user