next 15.3.0-canary.2 → 15.3.0-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +10 -2
- package/dist/build/index.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/components/react-dev-overlay/app/hot-reloader-client.js +10 -33
- package/dist/client/components/react-dev-overlay/app/hot-reloader-client.js.map +1 -1
- package/dist/client/components/react-dev-overlay/pages/hot-reloader-client.d.ts +1 -2
- package/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js +13 -39
- package/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js.map +1 -1
- package/dist/client/components/react-dev-overlay/shared.d.ts +3 -0
- package/dist/client/components/react-dev-overlay/shared.js +12 -0
- package/dist/client/components/react-dev-overlay/shared.js.map +1 -1
- package/dist/client/components/react-dev-overlay/utils/report-hmr-latency.d.ts +6 -0
- package/dist/client/components/react-dev-overlay/utils/report-hmr-latency.js +36 -0
- package/dist/client/components/react-dev-overlay/utils/report-hmr-latency.js.map +1 -0
- package/dist/client/dev/amp-dev.js +2 -2
- package/dist/client/dev/amp-dev.js.map +1 -1
- package/dist/client/dev/hot-middleware-client.d.ts +1 -1
- package/dist/client/dev/hot-middleware-client.js +2 -2
- package/dist/client/dev/hot-middleware-client.js.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/next-dev-turbopack.js +1 -1
- package/dist/client/next-dev-turbopack.js.map +1 -1
- package/dist/client/next-dev.js +1 -1
- package/dist/client/next-dev.js.map +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +3 -3
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +3 -3
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/esm/build/index.js +10 -2
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/app/hot-reloader-client.js +10 -33
- package/dist/esm/client/components/react-dev-overlay/app/hot-reloader-client.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/pages/hot-reloader-client.js +14 -40
- package/dist/esm/client/components/react-dev-overlay/pages/hot-reloader-client.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/shared.js +4 -0
- package/dist/esm/client/components/react-dev-overlay/shared.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/utils/report-hmr-latency.js +20 -0
- package/dist/esm/client/components/react-dev-overlay/utils/report-hmr-latency.js.map +1 -0
- package/dist/esm/client/dev/amp-dev.js +2 -2
- package/dist/esm/client/dev/amp-dev.js.map +1 -1
- package/dist/esm/client/dev/hot-middleware-client.js +2 -2
- package/dist/esm/client/dev/hot-middleware-client.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/client/next-dev-turbopack.js +1 -1
- package/dist/esm/client/next-dev-turbopack.js.map +1 -1
- package/dist/esm/client/next-dev.js +1 -1
- package/dist/esm/client/next-dev.js.map +1 -1
- package/dist/esm/server/config-schema.js +2 -1
- package/dist/esm/server/config-schema.js.map +1 -1
- package/dist/esm/server/config-shared.js +2 -1
- package/dist/esm/server/config-shared.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/router-server.js +1 -1
- package/dist/esm/server/lib/router-server.js.map +1 -1
- package/dist/esm/server/lib/router-utils/block-cross-site.js +5 -1
- package/dist/esm/server/lib/router-utils/block-cross-site.js.map +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/server/config-schema.js +2 -1
- package/dist/server/config-schema.js.map +1 -1
- package/dist/server/config-shared.d.ts +2 -1
- package/dist/server/config-shared.js +2 -1
- package/dist/server/config-shared.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/router-server.js +1 -1
- package/dist/server/lib/router-server.js.map +1 -1
- package/dist/server/lib/router-utils/block-cross-site.js +5 -1
- package/dist/server/lib/router-utils/block-cross-site.js.map +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
package/dist/build/swc/index.js
CHANGED
@@ -119,7 +119,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
119
119
|
}
|
120
120
|
return newObj;
|
121
121
|
}
|
122
|
-
const nextVersion = "15.3.0-canary.
|
122
|
+
const nextVersion = "15.3.0-canary.4";
|
123
123
|
const ArchName = (0, _os.arch)();
|
124
124
|
const PlatformName = (0, _os.platform)();
|
125
125
|
function infoLog(...args) {
|
@@ -1626,7 +1626,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
1626
1626
|
isClient && new _copyfileplugin.CopyFilePlugin({
|
1627
1627
|
// file path to build output of `@next/polyfill-nomodule`
|
1628
1628
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
1629
|
-
cacheKey: "15.3.0-canary.
|
1629
|
+
cacheKey: "15.3.0-canary.4",
|
1630
1630
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
1631
1631
|
minimize: false,
|
1632
1632
|
info: {
|
@@ -1803,7 +1803,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
1803
1803
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
1804
1804
|
// - Next.js version
|
1805
1805
|
// - next.config.js keys that affect compilation
|
1806
|
-
version: `${__dirname}|${"15.3.0-canary.
|
1806
|
+
version: `${__dirname}|${"15.3.0-canary.4"}|${configVars}`,
|
1807
1807
|
cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
|
1808
1808
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
1809
1809
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
@@ -39,6 +39,7 @@ const _navigationuntracked = require("../../navigation-untracked");
|
|
39
39
|
const _stitchederror = require("../../errors/stitched-error");
|
40
40
|
const _iserrorthrownwhilerenderingrsc = require("../../../lib/is-error-thrown-while-rendering-rsc");
|
41
41
|
const _handledevbuildindicatorhmrevents = require("../../../dev/dev-build-indicator/internal/handle-dev-build-indicator-hmr-events");
|
42
|
+
const _reporthmrlatency = /*#__PURE__*/ _interop_require_default._(require("../utils/report-hmr-latency"));
|
42
43
|
let mostRecentCompilationHash = null;
|
43
44
|
let __nextDevClientId = Math.round(Math.random() * 100 + Date.now());
|
44
45
|
let reloading = false;
|
@@ -57,36 +58,12 @@ function setPendingHotUpdateWebpack() {
|
|
57
58
|
function waitForWebpackRuntimeHotUpdate() {
|
58
59
|
return pendingHotUpdateWebpack;
|
59
60
|
}
|
60
|
-
function handleBeforeHotUpdateWebpack(dispatcher, hasUpdates) {
|
61
|
-
if (hasUpdates) {
|
62
|
-
dispatcher.onBeforeRefresh();
|
63
|
-
}
|
64
|
-
}
|
65
61
|
function handleSuccessfulHotUpdateWebpack(dispatcher, sendMessage, updatedModules) {
|
66
62
|
resolvePendingHotUpdateWebpack();
|
67
63
|
dispatcher.onBuildOk();
|
68
|
-
|
64
|
+
(0, _reporthmrlatency.default)(sendMessage, updatedModules, startLatency, Date.now());
|
69
65
|
dispatcher.onRefresh();
|
70
66
|
}
|
71
|
-
function reportHmrLatency(sendMessage, updatedModules) {
|
72
|
-
if (!startLatency) return;
|
73
|
-
// turbopack has a debounce for the "built" event which we don't want to
|
74
|
-
// incorrectly show in this number, use the last TURBOPACK_MESSAGE time
|
75
|
-
let endLatency = turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now();
|
76
|
-
const latency = endLatency - startLatency;
|
77
|
-
console.log("[Fast Refresh] done in " + latency + "ms");
|
78
|
-
sendMessage(JSON.stringify({
|
79
|
-
event: 'client-hmr-latency',
|
80
|
-
id: window.__nextDevClientId,
|
81
|
-
startTime: startLatency,
|
82
|
-
endTime: endLatency,
|
83
|
-
page: window.location.pathname,
|
84
|
-
updatedModules,
|
85
|
-
// Whether the page (tab) was hidden at the time the event occurred.
|
86
|
-
// This can impact the accuracy of the event's timing.
|
87
|
-
isPageHidden: document.visibilityState === 'hidden'
|
88
|
-
}));
|
89
|
-
}
|
90
67
|
// There is a newer version of the code available.
|
91
68
|
function handleAvailableHash(hash) {
|
92
69
|
// Update last known compilation hash.
|
@@ -141,13 +118,13 @@ function tryApplyUpdates(onBeforeUpdate, onHotUpdateSuccess, sendMessage, dispat
|
|
141
118
|
if (!isUpdateAvailable() || !canApplyUpdates()) {
|
142
119
|
resolvePendingHotUpdateWebpack();
|
143
120
|
dispatcher.onBuildOk();
|
144
|
-
|
121
|
+
(0, _reporthmrlatency.default)(sendMessage, [], startLatency, Date.now());
|
145
122
|
return;
|
146
123
|
}
|
147
124
|
function handleApplyUpdates(err, updatedModules) {
|
148
125
|
if (err || _runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError || !updatedModules) {
|
149
126
|
if (err) {
|
150
|
-
console.warn(
|
127
|
+
console.warn(_shared.REACT_REFRESH_FULL_RELOAD);
|
151
128
|
} else if (_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
|
152
129
|
console.warn(_shared.REACT_REFRESH_FULL_RELOAD_FROM_ERROR);
|
153
130
|
}
|
@@ -221,12 +198,14 @@ function tryApplyUpdates(onBeforeUpdate, onHotUpdateSuccess, sendMessage, dispat
|
|
221
198
|
function handleHotUpdate() {
|
222
199
|
if (process.env.TURBOPACK) {
|
223
200
|
dispatcher.onBuildOk();
|
224
|
-
|
201
|
+
(0, _reporthmrlatency.default)(sendMessage, [
|
225
202
|
...turbopackUpdatedModules
|
226
|
-
]);
|
203
|
+
], startLatency, turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now());
|
227
204
|
} else {
|
228
205
|
tryApplyUpdates(function onBeforeHotUpdate(hasUpdates) {
|
229
|
-
|
206
|
+
if (hasUpdates) {
|
207
|
+
dispatcher.onBeforeRefresh();
|
208
|
+
}
|
230
209
|
}, function onSuccessfulHotUpdate(webpackUpdatedModules) {
|
231
210
|
// Only dismiss it when we're sure it's a hot update.
|
232
211
|
// Otherwise it would flicker right before the reload.
|
@@ -312,7 +291,6 @@ function tryApplyUpdates(onBeforeUpdate, onHotUpdateSuccess, sendMessage, dispat
|
|
312
291
|
clientId: __nextDevClientId
|
313
292
|
}));
|
314
293
|
if (obj.action === _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.BUILT) {
|
315
|
-
// Handle hot updates
|
316
294
|
handleHotUpdate();
|
317
295
|
}
|
318
296
|
return;
|
@@ -551,8 +529,7 @@ function HotReload(param) {
|
|
551
529
|
(0, _handledevbuildindicatorhmrevents.handleDevBuildIndicatorHmrEvents)(obj);
|
552
530
|
processMessage(obj, sendMessage, processTurbopackMessage, router, dispatcher, appIsrManifestRef, pathnameRef);
|
553
531
|
} catch (err) {
|
554
|
-
|
555
|
-
console.warn('[HMR] Invalid message: ' + JSON.stringify(event.data) + '\n' + ((_err_stack = err == null ? void 0 : err.stack) != null ? _err_stack : ''));
|
532
|
+
(0, _shared.reportInvalidHmrMessage)(event, err);
|
556
533
|
}
|
557
534
|
};
|
558
535
|
websocket.addEventListener('message', handler);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/app/hot-reloader-client.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport {\n useCallback,\n useEffect,\n startTransition,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from 'react'\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\nimport formatWebpackMessages from '../utils/format-webpack-messages'\nimport { useRouter } from '../../navigation'\nimport {\n ACTION_BEFORE_REFRESH,\n ACTION_BUILD_ERROR,\n ACTION_BUILD_OK,\n ACTION_DEBUG_INFO,\n ACTION_DEV_INDICATOR,\n ACTION_REFRESH,\n ACTION_STATIC_INDICATOR,\n ACTION_UNHANDLED_ERROR,\n ACTION_UNHANDLED_REJECTION,\n ACTION_VERSION_INFO,\n useErrorOverlayReducer,\n} from '../shared'\nimport { parseStack } from '../utils/parse-stack'\nimport { AppDevOverlay } from './app-dev-overlay'\nimport { useErrorHandler } from '../../errors/use-error-handler'\nimport { RuntimeErrorHandler } from '../../errors/runtime-error-handler'\nimport {\n useSendMessage,\n useTurbopack,\n useWebsocket,\n useWebsocketPing,\n} from '../utils/use-websocket'\nimport { parseComponentStack } from '../utils/parse-component-stack'\nimport type { VersionInfo } from '../../../../server/dev/parse-version-info'\nimport { HMR_ACTIONS_SENT_TO_BROWSER } from '../../../../server/dev/hot-reloader-types'\nimport type {\n HMR_ACTION_TYPES,\n TurbopackMsgToBrowser,\n} from '../../../../server/dev/hot-reloader-types'\nimport { extractModulesFromTurbopackMessage } from '../../../../server/dev/extract-modules-from-turbopack-message'\nimport { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from '../shared'\nimport type { HydrationErrorState } from '../../errors/hydration-error-info'\nimport type { DebugInfo } from '../types'\nimport { useUntrackedPathname } from '../../navigation-untracked'\nimport { getReactStitchedError } from '../../errors/stitched-error'\nimport { shouldRenderRootLevelErrorOverlay } from '../../../lib/is-error-thrown-while-rendering-rsc'\nimport { handleDevBuildIndicatorHmrEvents } from '../../../dev/dev-build-indicator/internal/handle-dev-build-indicator-hmr-events'\nimport type { GlobalErrorComponent } from '../../error-boundary'\nimport type { DevIndicatorServerState } from '../../../../server/dev/dev-indicator-server-state'\n\nexport interface Dispatcher {\n onBuildOk(): void\n onBuildError(message: string): void\n onVersionInfo(versionInfo: VersionInfo): void\n onDebugInfo(debugInfo: DebugInfo): void\n onBeforeRefresh(): void\n onRefresh(): void\n onStaticIndicator(status: boolean): void\n onDevIndicator(devIndicator: DevIndicatorServerState): void\n}\n\nlet mostRecentCompilationHash: any = null\nlet __nextDevClientId = Math.round(Math.random() * 100 + Date.now())\nlet reloading = false\nlet startLatency: number | null = null\nlet turbopackLastUpdateLatency: number | null = null\nlet turbopackUpdatedModules: Set<string> = new Set()\n\nlet pendingHotUpdateWebpack = Promise.resolve()\nlet resolvePendingHotUpdateWebpack: () => void = () => {}\nfunction setPendingHotUpdateWebpack() {\n pendingHotUpdateWebpack = new Promise((resolve) => {\n resolvePendingHotUpdateWebpack = () => {\n resolve()\n }\n })\n}\n\nexport function waitForWebpackRuntimeHotUpdate() {\n return pendingHotUpdateWebpack\n}\n\nfunction handleBeforeHotUpdateWebpack(\n dispatcher: Dispatcher,\n hasUpdates: boolean\n) {\n if (hasUpdates) {\n dispatcher.onBeforeRefresh()\n }\n}\n\nfunction handleSuccessfulHotUpdateWebpack(\n dispatcher: Dispatcher,\n sendMessage: (message: string) => void,\n updatedModules: ReadonlyArray<string>\n) {\n resolvePendingHotUpdateWebpack()\n dispatcher.onBuildOk()\n reportHmrLatency(sendMessage, updatedModules)\n\n dispatcher.onRefresh()\n}\n\nfunction reportHmrLatency(\n sendMessage: (message: string) => void,\n updatedModules: ReadonlyArray<string>\n) {\n if (!startLatency) return\n // turbopack has a debounce for the \"built\" event which we don't want to\n // incorrectly show in this number, use the last TURBOPACK_MESSAGE time\n let endLatency = turbopackLastUpdateLatency ?? Date.now()\n const latency = endLatency - startLatency\n console.log(`[Fast Refresh] done in ${latency}ms`)\n sendMessage(\n JSON.stringify({\n event: 'client-hmr-latency',\n id: window.__nextDevClientId,\n startTime: startLatency,\n endTime: endLatency,\n page: window.location.pathname,\n updatedModules,\n // Whether the page (tab) was hidden at the time the event occurred.\n // This can impact the accuracy of the event's timing.\n isPageHidden: document.visibilityState === 'hidden',\n })\n )\n}\n\n// There is a newer version of the code available.\nfunction handleAvailableHash(hash: string) {\n // Update last known compilation hash.\n mostRecentCompilationHash = hash\n}\n\n/**\n * Is there a newer version of this code available?\n * For webpack: Check if the hash changed compared to __webpack_hash__\n * For Turbopack: Always true because it doesn't have __webpack_hash__\n */\nfunction isUpdateAvailable() {\n if (process.env.TURBOPACK) {\n return true\n }\n\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_hash__\n}\n\n// Webpack disallows updates in other states.\nfunction canApplyUpdates() {\n // @ts-expect-error module.hot exists\n return module.hot.status() === 'idle'\n}\nfunction afterApplyUpdates(fn: any) {\n if (canApplyUpdates()) {\n fn()\n } else {\n function handler(status: any) {\n if (status === 'idle') {\n // @ts-expect-error module.hot exists\n module.hot.removeStatusHandler(handler)\n fn()\n }\n }\n // @ts-expect-error module.hot exists\n module.hot.addStatusHandler(handler)\n }\n}\n\nfunction performFullReload(err: any, sendMessage: any) {\n const stackTrace =\n err &&\n ((err.stack && err.stack.split('\\n').slice(0, 5).join('\\n')) ||\n err.message ||\n err + '')\n\n sendMessage(\n JSON.stringify({\n event: 'client-full-reload',\n stackTrace,\n hadRuntimeError: !!RuntimeErrorHandler.hadRuntimeError,\n dependencyChain: err ? err.dependencyChain : undefined,\n })\n )\n\n if (reloading) return\n reloading = true\n window.location.reload()\n}\n\n// Attempt to update code on the fly, fall back to a hard reload.\nfunction tryApplyUpdates(\n onBeforeUpdate: (hasUpdates: boolean) => void,\n onHotUpdateSuccess: (updatedModules: string[]) => void,\n sendMessage: any,\n dispatcher: Dispatcher\n) {\n if (!isUpdateAvailable() || !canApplyUpdates()) {\n resolvePendingHotUpdateWebpack()\n dispatcher.onBuildOk()\n reportHmrLatency(sendMessage, [])\n return\n }\n\n function handleApplyUpdates(err: any, updatedModules: string[] | null) {\n if (err || RuntimeErrorHandler.hadRuntimeError || !updatedModules) {\n if (err) {\n console.warn(\n '[Fast Refresh] performing full reload\\n\\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\" +\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' +\n 'Consider migrating the non-React component export to a separate file and importing it into both files.\\n\\n' +\n 'It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\\n' +\n 'Fast Refresh requires at least one parent function component in your React tree.'\n )\n } else if (RuntimeErrorHandler.hadRuntimeError) {\n console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR)\n }\n performFullReload(err, sendMessage)\n return\n }\n\n const hasUpdates = Boolean(updatedModules.length)\n if (typeof onHotUpdateSuccess === 'function') {\n // Maybe we want to do something.\n onHotUpdateSuccess(updatedModules)\n }\n\n if (isUpdateAvailable()) {\n // While we were updating, there was a new update! Do it again.\n tryApplyUpdates(\n hasUpdates ? () => {} : onBeforeUpdate,\n hasUpdates ? () => dispatcher.onBuildOk() : onHotUpdateSuccess,\n sendMessage,\n dispatcher\n )\n } else {\n dispatcher.onBuildOk()\n if (process.env.__NEXT_TEST_MODE) {\n afterApplyUpdates(() => {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB()\n self.__NEXT_HMR_CB = null\n }\n })\n }\n }\n }\n\n // https://webpack.js.org/api/hot-module-replacement/#check\n // @ts-expect-error module.hot exists\n module.hot\n .check(/* autoApply */ false)\n .then((updatedModules: any[] | null) => {\n if (!updatedModules) {\n return null\n }\n\n if (typeof onBeforeUpdate === 'function') {\n const hasUpdates = Boolean(updatedModules.length)\n onBeforeUpdate(hasUpdates)\n }\n // https://webpack.js.org/api/hot-module-replacement/#apply\n // @ts-expect-error module.hot exists\n return module.hot.apply()\n })\n .then(\n (updatedModules: any[] | null) => {\n handleApplyUpdates(null, updatedModules)\n },\n (err: any) => {\n handleApplyUpdates(err, null)\n }\n )\n}\n\n/** Handles messages from the sevrer for the App Router. */\nfunction processMessage(\n obj: HMR_ACTION_TYPES,\n sendMessage: (message: string) => void,\n processTurbopackMessage: (msg: TurbopackMsgToBrowser) => void,\n router: ReturnType<typeof useRouter>,\n dispatcher: Dispatcher,\n appIsrManifestRef: ReturnType<typeof useRef>,\n pathnameRef: ReturnType<typeof useRef>\n) {\n if (!('action' in obj)) {\n return\n }\n\n function handleErrors(errors: ReadonlyArray<unknown>) {\n // \"Massage\" webpack messages.\n const formatted = formatWebpackMessages({\n errors: errors,\n warnings: [],\n })\n\n // Only show the first error.\n dispatcher.onBuildError(formatted.errors[0])\n\n // Also log them to the console.\n for (let i = 0; i < formatted.errors.length; i++) {\n console.error(stripAnsi(formatted.errors[i]))\n }\n\n // Do not attempt to reload now.\n // We will reload on next success instead.\n if (process.env.__NEXT_TEST_MODE) {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB(formatted.errors[0])\n self.__NEXT_HMR_CB = null\n }\n }\n }\n\n function handleHotUpdate() {\n if (process.env.TURBOPACK) {\n dispatcher.onBuildOk()\n reportHmrLatency(sendMessage, [...turbopackUpdatedModules])\n } else {\n tryApplyUpdates(\n function onBeforeHotUpdate(hasUpdates: boolean) {\n handleBeforeHotUpdateWebpack(dispatcher, hasUpdates)\n },\n function onSuccessfulHotUpdate(webpackUpdatedModules: string[]) {\n // Only dismiss it when we're sure it's a hot update.\n // Otherwise it would flicker right before the reload.\n handleSuccessfulHotUpdateWebpack(\n dispatcher,\n sendMessage,\n webpackUpdatedModules\n )\n },\n sendMessage,\n dispatcher\n )\n }\n }\n\n switch (obj.action) {\n case HMR_ACTIONS_SENT_TO_BROWSER.ISR_MANIFEST: {\n if (process.env.__NEXT_DEV_INDICATOR) {\n if (appIsrManifestRef) {\n appIsrManifestRef.current = obj.data\n\n // handle initial status on receiving manifest\n // navigation is handled in useEffect for pathname changes\n // as we'll receive the updated manifest before usePathname\n // triggers for new value\n if ((pathnameRef.current as string) in obj.data) {\n dispatcher.onStaticIndicator(true)\n } else {\n dispatcher.onStaticIndicator(false)\n }\n }\n }\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILDING: {\n startLatency = Date.now()\n turbopackLastUpdateLatency = null\n turbopackUpdatedModules.clear()\n if (!process.env.TURBOPACK) {\n setPendingHotUpdateWebpack()\n }\n console.log('[Fast Refresh] rebuilding')\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILT:\n case HMR_ACTIONS_SENT_TO_BROWSER.SYNC: {\n if (obj.hash) {\n handleAvailableHash(obj.hash)\n }\n\n const { errors, warnings } = obj\n\n // Is undefined when it's a 'built' event\n if ('versionInfo' in obj) dispatcher.onVersionInfo(obj.versionInfo)\n if ('debug' in obj && obj.debug) dispatcher.onDebugInfo(obj.debug)\n if ('devIndicator' in obj) dispatcher.onDevIndicator(obj.devIndicator)\n\n const hasErrors = Boolean(errors && errors.length)\n // Compilation with errors (e.g. syntax error or missing modules).\n if (hasErrors) {\n sendMessage(\n JSON.stringify({\n event: 'client-error',\n errorCount: errors.length,\n clientId: __nextDevClientId,\n })\n )\n\n handleErrors(errors)\n return\n }\n\n const hasWarnings = Boolean(warnings && warnings.length)\n if (hasWarnings) {\n sendMessage(\n JSON.stringify({\n event: 'client-warning',\n warningCount: warnings.length,\n clientId: __nextDevClientId,\n })\n )\n\n // Print warnings to the console.\n const formattedMessages = formatWebpackMessages({\n warnings: warnings,\n errors: [],\n })\n\n for (let i = 0; i < formattedMessages.warnings.length; i++) {\n if (i === 5) {\n console.warn(\n 'There were more warnings in other files.\\n' +\n 'You can find a complete log in the terminal.'\n )\n break\n }\n console.warn(stripAnsi(formattedMessages.warnings[i]))\n }\n\n // No early return here as we need to apply modules in the same way between warnings only and compiles without warnings\n }\n\n sendMessage(\n JSON.stringify({\n event: 'client-success',\n clientId: __nextDevClientId,\n })\n )\n\n if (obj.action === HMR_ACTIONS_SENT_TO_BROWSER.BUILT) {\n // Handle hot updates\n handleHotUpdate()\n }\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED: {\n processTurbopackMessage({\n type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED,\n data: {\n sessionId: obj.data.sessionId,\n },\n })\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE: {\n dispatcher.onBeforeRefresh()\n processTurbopackMessage({\n type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE,\n data: obj.data,\n })\n dispatcher.onRefresh()\n if (RuntimeErrorHandler.hadRuntimeError) {\n console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR)\n performFullReload(null, sendMessage)\n }\n for (const module of extractModulesFromTurbopackMessage(obj.data)) {\n turbopackUpdatedModules.add(module)\n }\n turbopackLastUpdateLatency = Date.now()\n break\n }\n // TODO-APP: make server component change more granular\n case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES: {\n sendMessage(\n JSON.stringify({\n event: 'server-component-reload-page',\n clientId: __nextDevClientId,\n hash: obj.hash,\n })\n )\n\n // Store the latest hash in a session cookie so that it's sent back to the\n // server with any subsequent requests.\n document.cookie = `__next_hmr_refresh_hash__=${obj.hash}`\n\n if (RuntimeErrorHandler.hadRuntimeError) {\n if (reloading) return\n reloading = true\n return window.location.reload()\n }\n\n startTransition(() => {\n router.hmrRefresh()\n dispatcher.onRefresh()\n })\n\n if (process.env.__NEXT_TEST_MODE) {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB()\n self.__NEXT_HMR_CB = null\n }\n }\n\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE: {\n sendMessage(\n JSON.stringify({\n event: 'client-reload-page',\n clientId: __nextDevClientId,\n })\n )\n if (reloading) return\n reloading = true\n return window.location.reload()\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE:\n case HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE: {\n // TODO-APP: potentially only refresh if the currently viewed page was added/removed.\n return router.hmrRefresh()\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR: {\n const { errorJSON } = obj\n if (errorJSON) {\n const { message, stack } = JSON.parse(errorJSON)\n const error = new Error(message)\n error.stack = stack\n handleErrors([error])\n }\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE: {\n return\n }\n default: {\n }\n }\n}\n\nexport default function HotReload({\n assetPrefix,\n children,\n globalError,\n}: {\n assetPrefix: string\n children: ReactNode\n globalError: [GlobalErrorComponent, React.ReactNode]\n}) {\n const [state, dispatch] = useErrorOverlayReducer('app')\n\n const dispatcher = useMemo<Dispatcher>(() => {\n return {\n onBuildOk() {\n dispatch({ type: ACTION_BUILD_OK })\n },\n onBuildError(message) {\n dispatch({ type: ACTION_BUILD_ERROR, message })\n },\n onBeforeRefresh() {\n dispatch({ type: ACTION_BEFORE_REFRESH })\n },\n onRefresh() {\n dispatch({ type: ACTION_REFRESH })\n },\n onVersionInfo(versionInfo) {\n dispatch({ type: ACTION_VERSION_INFO, versionInfo })\n },\n onStaticIndicator(status: boolean) {\n dispatch({ type: ACTION_STATIC_INDICATOR, staticIndicator: status })\n },\n onDebugInfo(debugInfo) {\n dispatch({ type: ACTION_DEBUG_INFO, debugInfo })\n },\n onDevIndicator(devIndicator) {\n dispatch({\n type: ACTION_DEV_INDICATOR,\n devIndicator,\n })\n },\n }\n }, [dispatch])\n\n // We render a separate error overlay at the root when an error is thrown from rendering RSC, so\n // we should not render an additional error overlay in the descendent. However, we need to\n // keep rendering these hooks to ensure HMR works when the error is addressed.\n const shouldRenderErrorOverlay = useSyncExternalStore(\n () => () => {},\n () => !shouldRenderRootLevelErrorOverlay(),\n () => true\n )\n\n const handleOnUnhandledError = useCallback(\n (error: Error): void => {\n const errorDetails = (error as any).details as\n | HydrationErrorState\n | undefined\n // Component stack is added to the error in use-error-handler in case there was a hydration error\n const componentStackTrace =\n (error as any)._componentStack || errorDetails?.componentStack\n const warning = errorDetails?.warning\n\n dispatch({\n type: ACTION_UNHANDLED_ERROR,\n reason: error,\n frames: parseStack(error.stack || ''),\n componentStackFrames:\n typeof componentStackTrace === 'string'\n ? parseComponentStack(componentStackTrace)\n : undefined,\n warning,\n })\n },\n [dispatch]\n )\n\n const handleOnUnhandledRejection = useCallback(\n (reason: Error): void => {\n const stitchedError = getReactStitchedError(reason)\n dispatch({\n type: ACTION_UNHANDLED_REJECTION,\n reason: stitchedError,\n frames: parseStack(stitchedError.stack || ''),\n })\n },\n [dispatch]\n )\n useErrorHandler(handleOnUnhandledError, handleOnUnhandledRejection)\n\n const webSocketRef = useWebsocket(assetPrefix)\n useWebsocketPing(webSocketRef)\n const sendMessage = useSendMessage(webSocketRef)\n const processTurbopackMessage = useTurbopack(sendMessage, (err) =>\n performFullReload(err, sendMessage)\n )\n\n const router = useRouter()\n\n // We don't want access of the pathname for the dev tools to trigger a dynamic\n // access (as the dev overlay will never be present in production).\n const pathname = useUntrackedPathname()\n const appIsrManifestRef = useRef<Record<string, false | number>>({})\n const pathnameRef = useRef(pathname)\n\n if (process.env.__NEXT_DEV_INDICATOR) {\n // this conditional is only for dead-code elimination which\n // isn't a runtime conditional only build-time so ignore hooks rule\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n pathnameRef.current = pathname\n\n const appIsrManifest = appIsrManifestRef.current\n\n if (appIsrManifest) {\n if (pathname && pathname in appIsrManifest) {\n try {\n dispatcher.onStaticIndicator(true)\n } catch (reason) {\n let message = ''\n\n if (reason instanceof DOMException) {\n // Most likely a SecurityError, because of an unavailable localStorage\n message = reason.stack ?? reason.message\n } else if (reason instanceof Error) {\n message = 'Error: ' + reason.message + '\\n' + (reason.stack ?? '')\n } else {\n message = 'Unexpected Exception: ' + reason\n }\n\n console.warn('[HMR] ' + message)\n }\n } else {\n dispatcher.onStaticIndicator(false)\n }\n }\n }, [pathname, dispatcher])\n }\n\n useEffect(() => {\n const websocket = webSocketRef.current\n if (!websocket) return\n\n const handler = (event: MessageEvent<any>) => {\n try {\n const obj = JSON.parse(event.data)\n handleDevBuildIndicatorHmrEvents(obj)\n processMessage(\n obj,\n sendMessage,\n processTurbopackMessage,\n router,\n dispatcher,\n appIsrManifestRef,\n pathnameRef\n )\n } catch (err: any) {\n console.warn(\n '[HMR] Invalid message: ' +\n JSON.stringify(event.data) +\n '\\n' +\n (err?.stack ?? '')\n )\n }\n }\n\n websocket.addEventListener('message', handler)\n return () => websocket.removeEventListener('message', handler)\n }, [\n sendMessage,\n router,\n webSocketRef,\n dispatcher,\n processTurbopackMessage,\n appIsrManifestRef,\n ])\n\n if (shouldRenderErrorOverlay) {\n return (\n <AppDevOverlay state={state} globalError={globalError}>\n {children}\n </AppDevOverlay>\n )\n }\n\n return children\n}\n"],"names":["HotReload","waitForWebpackRuntimeHotUpdate","mostRecentCompilationHash","__nextDevClientId","Math","round","random","Date","now","reloading","startLatency","turbopackLastUpdateLatency","turbopackUpdatedModules","Set","pendingHotUpdateWebpack","Promise","resolve","resolvePendingHotUpdateWebpack","setPendingHotUpdateWebpack","handleBeforeHotUpdateWebpack","dispatcher","hasUpdates","onBeforeRefresh","handleSuccessfulHotUpdateWebpack","sendMessage","updatedModules","onBuildOk","reportHmrLatency","onRefresh","endLatency","latency","console","log","JSON","stringify","event","id","window","startTime","endTime","page","location","pathname","isPageHidden","document","visibilityState","handleAvailableHash","hash","isUpdateAvailable","process","env","TURBOPACK","__webpack_hash__","canApplyUpdates","module","hot","status","afterApplyUpdates","fn","handler","removeStatusHandler","addStatusHandler","performFullReload","err","stackTrace","stack","split","slice","join","message","hadRuntimeError","RuntimeErrorHandler","dependencyChain","undefined","reload","tryApplyUpdates","onBeforeUpdate","onHotUpdateSuccess","handleApplyUpdates","warn","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","Boolean","length","__NEXT_TEST_MODE","self","__NEXT_HMR_CB","check","then","apply","processMessage","obj","processTurbopackMessage","router","appIsrManifestRef","pathnameRef","handleErrors","errors","formatted","formatWebpackMessages","warnings","onBuildError","i","error","stripAnsi","handleHotUpdate","onBeforeHotUpdate","onSuccessfulHotUpdate","webpackUpdatedModules","action","HMR_ACTIONS_SENT_TO_BROWSER","ISR_MANIFEST","__NEXT_DEV_INDICATOR","current","data","onStaticIndicator","BUILDING","clear","BUILT","SYNC","onVersionInfo","versionInfo","debug","onDebugInfo","onDevIndicator","devIndicator","hasErrors","errorCount","clientId","hasWarnings","warningCount","formattedMessages","TURBOPACK_CONNECTED","type","sessionId","TURBOPACK_MESSAGE","extractModulesFromTurbopackMessage","add","SERVER_COMPONENT_CHANGES","cookie","startTransition","hmrRefresh","RELOAD_PAGE","ADDED_PAGE","REMOVED_PAGE","SERVER_ERROR","errorJSON","parse","Error","DEV_PAGES_MANIFEST_UPDATE","assetPrefix","children","globalError","state","dispatch","useErrorOverlayReducer","useMemo","ACTION_BUILD_OK","ACTION_BUILD_ERROR","ACTION_BEFORE_REFRESH","ACTION_REFRESH","ACTION_VERSION_INFO","ACTION_STATIC_INDICATOR","staticIndicator","debugInfo","ACTION_DEBUG_INFO","ACTION_DEV_INDICATOR","shouldRenderErrorOverlay","useSyncExternalStore","shouldRenderRootLevelErrorOverlay","handleOnUnhandledError","useCallback","errorDetails","details","componentStackTrace","_componentStack","componentStack","warning","ACTION_UNHANDLED_ERROR","reason","frames","parseStack","componentStackFrames","parseComponentStack","handleOnUnhandledRejection","stitchedError","getReactStitchedError","ACTION_UNHANDLED_REJECTION","useErrorHandler","webSocketRef","useWebsocket","useWebsocketPing","useSendMessage","useTurbopack","useRouter","useUntrackedPathname","useRef","useEffect","appIsrManifest","DOMException","websocket","handleDevBuildIndicatorHmrEvents","addEventListener","removeEventListener","AppDevOverlay"],"mappings":";;;;;;;;;;;;;;;IA0hBA,OAyLC;eAzLuBA;;IAzcRC,8BAA8B;eAA9BA;;;;;uBAzET;oEACe;gFACY;4BACR;wBAanB;4BACoB;+BACG;iCACE;qCACI;8BAM7B;qCAC6B;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;QACAoE;QACAgG;QACAxK;QACAuE;QACAE;KACD;IAED,IAAIyE,0BAA0B;QAC5B,qBACE,qBAACqC,4BAAa;YAACnD,OAAOA;YAAOD,aAAaA;sBACvCD;;IAGP;IAEA,OAAOA;AACT"}
|
1
|
+
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/app/hot-reloader-client.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport {\n useCallback,\n useEffect,\n startTransition,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from 'react'\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\nimport formatWebpackMessages from '../utils/format-webpack-messages'\nimport { useRouter } from '../../navigation'\nimport {\n ACTION_BEFORE_REFRESH,\n ACTION_BUILD_ERROR,\n ACTION_BUILD_OK,\n ACTION_DEBUG_INFO,\n ACTION_DEV_INDICATOR,\n ACTION_REFRESH,\n ACTION_STATIC_INDICATOR,\n ACTION_UNHANDLED_ERROR,\n ACTION_UNHANDLED_REJECTION,\n ACTION_VERSION_INFO,\n REACT_REFRESH_FULL_RELOAD,\n reportInvalidHmrMessage,\n useErrorOverlayReducer,\n} from '../shared'\nimport { parseStack } from '../utils/parse-stack'\nimport { AppDevOverlay } from './app-dev-overlay'\nimport { useErrorHandler } from '../../errors/use-error-handler'\nimport { RuntimeErrorHandler } from '../../errors/runtime-error-handler'\nimport {\n useSendMessage,\n useTurbopack,\n useWebsocket,\n useWebsocketPing,\n} from '../utils/use-websocket'\nimport { parseComponentStack } from '../utils/parse-component-stack'\nimport type { VersionInfo } from '../../../../server/dev/parse-version-info'\nimport { HMR_ACTIONS_SENT_TO_BROWSER } from '../../../../server/dev/hot-reloader-types'\nimport type {\n HMR_ACTION_TYPES,\n TurbopackMsgToBrowser,\n} from '../../../../server/dev/hot-reloader-types'\nimport { extractModulesFromTurbopackMessage } from '../../../../server/dev/extract-modules-from-turbopack-message'\nimport { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from '../shared'\nimport type { HydrationErrorState } from '../../errors/hydration-error-info'\nimport type { DebugInfo } from '../types'\nimport { useUntrackedPathname } from '../../navigation-untracked'\nimport { getReactStitchedError } from '../../errors/stitched-error'\nimport { shouldRenderRootLevelErrorOverlay } from '../../../lib/is-error-thrown-while-rendering-rsc'\nimport { handleDevBuildIndicatorHmrEvents } from '../../../dev/dev-build-indicator/internal/handle-dev-build-indicator-hmr-events'\nimport type { GlobalErrorComponent } from '../../error-boundary'\nimport type { DevIndicatorServerState } from '../../../../server/dev/dev-indicator-server-state'\nimport reportHmrLatency from '../utils/report-hmr-latency'\n\nexport interface Dispatcher {\n onBuildOk(): void\n onBuildError(message: string): void\n onVersionInfo(versionInfo: VersionInfo): void\n onDebugInfo(debugInfo: DebugInfo): void\n onBeforeRefresh(): void\n onRefresh(): void\n onStaticIndicator(status: boolean): void\n onDevIndicator(devIndicator: DevIndicatorServerState): void\n}\n\nlet mostRecentCompilationHash: any = null\nlet __nextDevClientId = Math.round(Math.random() * 100 + Date.now())\nlet reloading = false\nlet startLatency: number | null = null\nlet turbopackLastUpdateLatency: number | null = null\nlet turbopackUpdatedModules: Set<string> = new Set()\n\nlet pendingHotUpdateWebpack = Promise.resolve()\nlet resolvePendingHotUpdateWebpack: () => void = () => {}\nfunction setPendingHotUpdateWebpack() {\n pendingHotUpdateWebpack = new Promise((resolve) => {\n resolvePendingHotUpdateWebpack = () => {\n resolve()\n }\n })\n}\n\nexport function waitForWebpackRuntimeHotUpdate() {\n return pendingHotUpdateWebpack\n}\n\nfunction handleSuccessfulHotUpdateWebpack(\n dispatcher: Dispatcher,\n sendMessage: (message: string) => void,\n updatedModules: ReadonlyArray<string>\n) {\n resolvePendingHotUpdateWebpack()\n dispatcher.onBuildOk()\n reportHmrLatency(sendMessage, updatedModules, startLatency!, Date.now())\n\n dispatcher.onRefresh()\n}\n\n// There is a newer version of the code available.\nfunction handleAvailableHash(hash: string) {\n // Update last known compilation hash.\n mostRecentCompilationHash = hash\n}\n\n/**\n * Is there a newer version of this code available?\n * For webpack: Check if the hash changed compared to __webpack_hash__\n * For Turbopack: Always true because it doesn't have __webpack_hash__\n */\nfunction isUpdateAvailable() {\n if (process.env.TURBOPACK) {\n return true\n }\n\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_hash__\n}\n\n// Webpack disallows updates in other states.\nfunction canApplyUpdates() {\n // @ts-expect-error module.hot exists\n return module.hot.status() === 'idle'\n}\nfunction afterApplyUpdates(fn: any) {\n if (canApplyUpdates()) {\n fn()\n } else {\n function handler(status: any) {\n if (status === 'idle') {\n // @ts-expect-error module.hot exists\n module.hot.removeStatusHandler(handler)\n fn()\n }\n }\n // @ts-expect-error module.hot exists\n module.hot.addStatusHandler(handler)\n }\n}\n\nfunction performFullReload(err: any, sendMessage: any) {\n const stackTrace =\n err &&\n ((err.stack && err.stack.split('\\n').slice(0, 5).join('\\n')) ||\n err.message ||\n err + '')\n\n sendMessage(\n JSON.stringify({\n event: 'client-full-reload',\n stackTrace,\n hadRuntimeError: !!RuntimeErrorHandler.hadRuntimeError,\n dependencyChain: err ? err.dependencyChain : undefined,\n })\n )\n\n if (reloading) return\n reloading = true\n window.location.reload()\n}\n\n// Attempt to update code on the fly, fall back to a hard reload.\nfunction tryApplyUpdates(\n onBeforeUpdate: (hasUpdates: boolean) => void,\n onHotUpdateSuccess: (updatedModules: string[]) => void,\n sendMessage: any,\n dispatcher: Dispatcher\n) {\n if (!isUpdateAvailable() || !canApplyUpdates()) {\n resolvePendingHotUpdateWebpack()\n dispatcher.onBuildOk()\n reportHmrLatency(sendMessage, [], startLatency!, Date.now())\n return\n }\n\n function handleApplyUpdates(err: any, updatedModules: string[] | null) {\n if (err || RuntimeErrorHandler.hadRuntimeError || !updatedModules) {\n if (err) {\n console.warn(REACT_REFRESH_FULL_RELOAD)\n } else if (RuntimeErrorHandler.hadRuntimeError) {\n console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR)\n }\n performFullReload(err, sendMessage)\n return\n }\n\n const hasUpdates = Boolean(updatedModules.length)\n if (typeof onHotUpdateSuccess === 'function') {\n // Maybe we want to do something.\n onHotUpdateSuccess(updatedModules)\n }\n\n if (isUpdateAvailable()) {\n // While we were updating, there was a new update! Do it again.\n tryApplyUpdates(\n hasUpdates ? () => {} : onBeforeUpdate,\n hasUpdates ? () => dispatcher.onBuildOk() : onHotUpdateSuccess,\n sendMessage,\n dispatcher\n )\n } else {\n dispatcher.onBuildOk()\n if (process.env.__NEXT_TEST_MODE) {\n afterApplyUpdates(() => {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB()\n self.__NEXT_HMR_CB = null\n }\n })\n }\n }\n }\n\n // https://webpack.js.org/api/hot-module-replacement/#check\n // @ts-expect-error module.hot exists\n module.hot\n .check(/* autoApply */ false)\n .then((updatedModules: any[] | null) => {\n if (!updatedModules) {\n return null\n }\n\n if (typeof onBeforeUpdate === 'function') {\n const hasUpdates = Boolean(updatedModules.length)\n onBeforeUpdate(hasUpdates)\n }\n // https://webpack.js.org/api/hot-module-replacement/#apply\n // @ts-expect-error module.hot exists\n return module.hot.apply()\n })\n .then(\n (updatedModules: any[] | null) => {\n handleApplyUpdates(null, updatedModules)\n },\n (err: any) => {\n handleApplyUpdates(err, null)\n }\n )\n}\n\n/** Handles messages from the sevrer for the App Router. */\nfunction processMessage(\n obj: HMR_ACTION_TYPES,\n sendMessage: (message: string) => void,\n processTurbopackMessage: (msg: TurbopackMsgToBrowser) => void,\n router: ReturnType<typeof useRouter>,\n dispatcher: Dispatcher,\n appIsrManifestRef: ReturnType<typeof useRef>,\n pathnameRef: ReturnType<typeof useRef>\n) {\n if (!('action' in obj)) {\n return\n }\n\n function handleErrors(errors: ReadonlyArray<unknown>) {\n // \"Massage\" webpack messages.\n const formatted = formatWebpackMessages({\n errors: errors,\n warnings: [],\n })\n\n // Only show the first error.\n dispatcher.onBuildError(formatted.errors[0])\n\n // Also log them to the console.\n for (let i = 0; i < formatted.errors.length; i++) {\n console.error(stripAnsi(formatted.errors[i]))\n }\n\n // Do not attempt to reload now.\n // We will reload on next success instead.\n if (process.env.__NEXT_TEST_MODE) {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB(formatted.errors[0])\n self.__NEXT_HMR_CB = null\n }\n }\n }\n\n function handleHotUpdate() {\n if (process.env.TURBOPACK) {\n dispatcher.onBuildOk()\n reportHmrLatency(\n sendMessage,\n [...turbopackUpdatedModules],\n startLatency!,\n turbopackLastUpdateLatency ?? Date.now()\n )\n } else {\n tryApplyUpdates(\n function onBeforeHotUpdate(hasUpdates: boolean) {\n if (hasUpdates) {\n dispatcher.onBeforeRefresh()\n }\n },\n function onSuccessfulHotUpdate(webpackUpdatedModules: string[]) {\n // Only dismiss it when we're sure it's a hot update.\n // Otherwise it would flicker right before the reload.\n handleSuccessfulHotUpdateWebpack(\n dispatcher,\n sendMessage,\n webpackUpdatedModules\n )\n },\n sendMessage,\n dispatcher\n )\n }\n }\n\n switch (obj.action) {\n case HMR_ACTIONS_SENT_TO_BROWSER.ISR_MANIFEST: {\n if (process.env.__NEXT_DEV_INDICATOR) {\n if (appIsrManifestRef) {\n appIsrManifestRef.current = obj.data\n\n // handle initial status on receiving manifest\n // navigation is handled in useEffect for pathname changes\n // as we'll receive the updated manifest before usePathname\n // triggers for new value\n if ((pathnameRef.current as string) in obj.data) {\n dispatcher.onStaticIndicator(true)\n } else {\n dispatcher.onStaticIndicator(false)\n }\n }\n }\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILDING: {\n startLatency = Date.now()\n turbopackLastUpdateLatency = null\n turbopackUpdatedModules.clear()\n if (!process.env.TURBOPACK) {\n setPendingHotUpdateWebpack()\n }\n console.log('[Fast Refresh] rebuilding')\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILT:\n case HMR_ACTIONS_SENT_TO_BROWSER.SYNC: {\n if (obj.hash) {\n handleAvailableHash(obj.hash)\n }\n\n const { errors, warnings } = obj\n\n // Is undefined when it's a 'built' event\n if ('versionInfo' in obj) dispatcher.onVersionInfo(obj.versionInfo)\n if ('debug' in obj && obj.debug) dispatcher.onDebugInfo(obj.debug)\n if ('devIndicator' in obj) dispatcher.onDevIndicator(obj.devIndicator)\n\n const hasErrors = Boolean(errors && errors.length)\n // Compilation with errors (e.g. syntax error or missing modules).\n if (hasErrors) {\n sendMessage(\n JSON.stringify({\n event: 'client-error',\n errorCount: errors.length,\n clientId: __nextDevClientId,\n })\n )\n\n handleErrors(errors)\n return\n }\n\n const hasWarnings = Boolean(warnings && warnings.length)\n if (hasWarnings) {\n sendMessage(\n JSON.stringify({\n event: 'client-warning',\n warningCount: warnings.length,\n clientId: __nextDevClientId,\n })\n )\n\n // Print warnings to the console.\n const formattedMessages = formatWebpackMessages({\n warnings: warnings,\n errors: [],\n })\n\n for (let i = 0; i < formattedMessages.warnings.length; i++) {\n if (i === 5) {\n console.warn(\n 'There were more warnings in other files.\\n' +\n 'You can find a complete log in the terminal.'\n )\n break\n }\n console.warn(stripAnsi(formattedMessages.warnings[i]))\n }\n\n // No early return here as we need to apply modules in the same way between warnings only and compiles without warnings\n }\n\n sendMessage(\n JSON.stringify({\n event: 'client-success',\n clientId: __nextDevClientId,\n })\n )\n\n if (obj.action === HMR_ACTIONS_SENT_TO_BROWSER.BUILT) {\n handleHotUpdate()\n }\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED: {\n processTurbopackMessage({\n type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED,\n data: {\n sessionId: obj.data.sessionId,\n },\n })\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE: {\n dispatcher.onBeforeRefresh()\n processTurbopackMessage({\n type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE,\n data: obj.data,\n })\n dispatcher.onRefresh()\n if (RuntimeErrorHandler.hadRuntimeError) {\n console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR)\n performFullReload(null, sendMessage)\n }\n for (const module of extractModulesFromTurbopackMessage(obj.data)) {\n turbopackUpdatedModules.add(module)\n }\n turbopackLastUpdateLatency = Date.now()\n break\n }\n // TODO-APP: make server component change more granular\n case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES: {\n sendMessage(\n JSON.stringify({\n event: 'server-component-reload-page',\n clientId: __nextDevClientId,\n hash: obj.hash,\n })\n )\n\n // Store the latest hash in a session cookie so that it's sent back to the\n // server with any subsequent requests.\n document.cookie = `__next_hmr_refresh_hash__=${obj.hash}`\n\n if (RuntimeErrorHandler.hadRuntimeError) {\n if (reloading) return\n reloading = true\n return window.location.reload()\n }\n\n startTransition(() => {\n router.hmrRefresh()\n dispatcher.onRefresh()\n })\n\n if (process.env.__NEXT_TEST_MODE) {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB()\n self.__NEXT_HMR_CB = null\n }\n }\n\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE: {\n sendMessage(\n JSON.stringify({\n event: 'client-reload-page',\n clientId: __nextDevClientId,\n })\n )\n if (reloading) return\n reloading = true\n return window.location.reload()\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE:\n case HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE: {\n // TODO-APP: potentially only refresh if the currently viewed page was added/removed.\n return router.hmrRefresh()\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR: {\n const { errorJSON } = obj\n if (errorJSON) {\n const { message, stack } = JSON.parse(errorJSON)\n const error = new Error(message)\n error.stack = stack\n handleErrors([error])\n }\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE: {\n return\n }\n default: {\n }\n }\n}\n\nexport default function HotReload({\n assetPrefix,\n children,\n globalError,\n}: {\n assetPrefix: string\n children: ReactNode\n globalError: [GlobalErrorComponent, React.ReactNode]\n}) {\n const [state, dispatch] = useErrorOverlayReducer('app')\n\n const dispatcher = useMemo<Dispatcher>(() => {\n return {\n onBuildOk() {\n dispatch({ type: ACTION_BUILD_OK })\n },\n onBuildError(message) {\n dispatch({ type: ACTION_BUILD_ERROR, message })\n },\n onBeforeRefresh() {\n dispatch({ type: ACTION_BEFORE_REFRESH })\n },\n onRefresh() {\n dispatch({ type: ACTION_REFRESH })\n },\n onVersionInfo(versionInfo) {\n dispatch({ type: ACTION_VERSION_INFO, versionInfo })\n },\n onStaticIndicator(status: boolean) {\n dispatch({ type: ACTION_STATIC_INDICATOR, staticIndicator: status })\n },\n onDebugInfo(debugInfo) {\n dispatch({ type: ACTION_DEBUG_INFO, debugInfo })\n },\n onDevIndicator(devIndicator) {\n dispatch({\n type: ACTION_DEV_INDICATOR,\n devIndicator,\n })\n },\n }\n }, [dispatch])\n\n // We render a separate error overlay at the root when an error is thrown from rendering RSC, so\n // we should not render an additional error overlay in the descendent. However, we need to\n // keep rendering these hooks to ensure HMR works when the error is addressed.\n const shouldRenderErrorOverlay = useSyncExternalStore(\n () => () => {},\n () => !shouldRenderRootLevelErrorOverlay(),\n () => true\n )\n\n const handleOnUnhandledError = useCallback(\n (error: Error): void => {\n const errorDetails = (error as any).details as\n | HydrationErrorState\n | undefined\n // Component stack is added to the error in use-error-handler in case there was a hydration error\n const componentStackTrace =\n (error as any)._componentStack || errorDetails?.componentStack\n const warning = errorDetails?.warning\n\n dispatch({\n type: ACTION_UNHANDLED_ERROR,\n reason: error,\n frames: parseStack(error.stack || ''),\n componentStackFrames:\n typeof componentStackTrace === 'string'\n ? parseComponentStack(componentStackTrace)\n : undefined,\n warning,\n })\n },\n [dispatch]\n )\n\n const handleOnUnhandledRejection = useCallback(\n (reason: Error): void => {\n const stitchedError = getReactStitchedError(reason)\n dispatch({\n type: ACTION_UNHANDLED_REJECTION,\n reason: stitchedError,\n frames: parseStack(stitchedError.stack || ''),\n })\n },\n [dispatch]\n )\n useErrorHandler(handleOnUnhandledError, handleOnUnhandledRejection)\n\n const webSocketRef = useWebsocket(assetPrefix)\n useWebsocketPing(webSocketRef)\n const sendMessage = useSendMessage(webSocketRef)\n const processTurbopackMessage = useTurbopack(sendMessage, (err) =>\n performFullReload(err, sendMessage)\n )\n\n const router = useRouter()\n\n // We don't want access of the pathname for the dev tools to trigger a dynamic\n // access (as the dev overlay will never be present in production).\n const pathname = useUntrackedPathname()\n const appIsrManifestRef = useRef<Record<string, false | number>>({})\n const pathnameRef = useRef(pathname)\n\n if (process.env.__NEXT_DEV_INDICATOR) {\n // this conditional is only for dead-code elimination which\n // isn't a runtime conditional only build-time so ignore hooks rule\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n pathnameRef.current = pathname\n\n const appIsrManifest = appIsrManifestRef.current\n\n if (appIsrManifest) {\n if (pathname && pathname in appIsrManifest) {\n try {\n dispatcher.onStaticIndicator(true)\n } catch (reason) {\n let message = ''\n\n if (reason instanceof DOMException) {\n // Most likely a SecurityError, because of an unavailable localStorage\n message = reason.stack ?? reason.message\n } else if (reason instanceof Error) {\n message = 'Error: ' + reason.message + '\\n' + (reason.stack ?? '')\n } else {\n message = 'Unexpected Exception: ' + reason\n }\n\n console.warn('[HMR] ' + message)\n }\n } else {\n dispatcher.onStaticIndicator(false)\n }\n }\n }, [pathname, dispatcher])\n }\n\n useEffect(() => {\n const websocket = webSocketRef.current\n if (!websocket) return\n\n const handler = (event: MessageEvent<any>) => {\n try {\n const obj = JSON.parse(event.data)\n handleDevBuildIndicatorHmrEvents(obj)\n processMessage(\n obj,\n sendMessage,\n processTurbopackMessage,\n router,\n dispatcher,\n appIsrManifestRef,\n pathnameRef\n )\n } catch (err: unknown) {\n reportInvalidHmrMessage(event, err)\n }\n }\n\n websocket.addEventListener('message', handler)\n return () => websocket.removeEventListener('message', handler)\n }, [\n sendMessage,\n router,\n webSocketRef,\n dispatcher,\n processTurbopackMessage,\n appIsrManifestRef,\n ])\n\n if (shouldRenderErrorOverlay) {\n return (\n <AppDevOverlay state={state} globalError={globalError}>\n {children}\n </AppDevOverlay>\n )\n }\n\n return children\n}\n"],"names":["HotReload","waitForWebpackRuntimeHotUpdate","mostRecentCompilationHash","__nextDevClientId","Math","round","random","Date","now","reloading","startLatency","turbopackLastUpdateLatency","turbopackUpdatedModules","Set","pendingHotUpdateWebpack","Promise","resolve","resolvePendingHotUpdateWebpack","setPendingHotUpdateWebpack","handleSuccessfulHotUpdateWebpack","dispatcher","sendMessage","updatedModules","onBuildOk","reportHmrLatency","onRefresh","handleAvailableHash","hash","isUpdateAvailable","process","env","TURBOPACK","__webpack_hash__","canApplyUpdates","module","hot","status","afterApplyUpdates","fn","handler","removeStatusHandler","addStatusHandler","performFullReload","err","stackTrace","stack","split","slice","join","message","JSON","stringify","event","hadRuntimeError","RuntimeErrorHandler","dependencyChain","undefined","window","location","reload","tryApplyUpdates","onBeforeUpdate","onHotUpdateSuccess","handleApplyUpdates","console","warn","REACT_REFRESH_FULL_RELOAD","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","hasUpdates","Boolean","length","__NEXT_TEST_MODE","self","__NEXT_HMR_CB","check","then","apply","processMessage","obj","processTurbopackMessage","router","appIsrManifestRef","pathnameRef","handleErrors","errors","formatted","formatWebpackMessages","warnings","onBuildError","i","error","stripAnsi","handleHotUpdate","onBeforeHotUpdate","onBeforeRefresh","onSuccessfulHotUpdate","webpackUpdatedModules","action","HMR_ACTIONS_SENT_TO_BROWSER","ISR_MANIFEST","__NEXT_DEV_INDICATOR","current","data","onStaticIndicator","BUILDING","clear","log","BUILT","SYNC","onVersionInfo","versionInfo","debug","onDebugInfo","onDevIndicator","devIndicator","hasErrors","errorCount","clientId","hasWarnings","warningCount","formattedMessages","TURBOPACK_CONNECTED","type","sessionId","TURBOPACK_MESSAGE","extractModulesFromTurbopackMessage","add","SERVER_COMPONENT_CHANGES","document","cookie","startTransition","hmrRefresh","RELOAD_PAGE","ADDED_PAGE","REMOVED_PAGE","SERVER_ERROR","errorJSON","parse","Error","DEV_PAGES_MANIFEST_UPDATE","assetPrefix","children","globalError","state","dispatch","useErrorOverlayReducer","useMemo","ACTION_BUILD_OK","ACTION_BUILD_ERROR","ACTION_BEFORE_REFRESH","ACTION_REFRESH","ACTION_VERSION_INFO","ACTION_STATIC_INDICATOR","staticIndicator","debugInfo","ACTION_DEBUG_INFO","ACTION_DEV_INDICATOR","shouldRenderErrorOverlay","useSyncExternalStore","shouldRenderRootLevelErrorOverlay","handleOnUnhandledError","useCallback","errorDetails","details","componentStackTrace","_componentStack","componentStack","warning","ACTION_UNHANDLED_ERROR","reason","frames","parseStack","componentStackFrames","parseComponentStack","handleOnUnhandledRejection","stitchedError","getReactStitchedError","ACTION_UNHANDLED_REJECTION","useErrorHandler","webSocketRef","useWebsocket","useWebsocketPing","useSendMessage","useTurbopack","useRouter","pathname","useUntrackedPathname","useRef","useEffect","appIsrManifest","DOMException","websocket","handleDevBuildIndicatorHmrEvents","reportInvalidHmrMessage","addEventListener","removeEventListener","AppDevOverlay"],"mappings":";;;;;;;;;;;;;;;IA0fA,OAoLC;eApLuBA;;IAtaRC,8BAA8B;eAA9BA;;;;;uBA5ET;oEACe;gFACY;4BACR;wBAenB;4BACoB;+BACG;iCACE;qCACI;8BAM7B;qCAC6B;kCAEQ;oDAKO;qCAId;+BACC;gDACY;kDACD;2EAGpB;AAa7B,IAAIC,4BAAiC;AACrC,IAAIC,oBAAoBC,KAAKC,KAAK,CAACD,KAAKE,MAAM,KAAK,MAAMC,KAAKC,GAAG;AACjE,IAAIC,YAAY;AAChB,IAAIC,eAA8B;AAClC,IAAIC,6BAA4C;AAChD,IAAIC,0BAAuC,IAAIC;AAE/C,IAAIC,0BAA0BC,QAAQC,OAAO;AAC7C,IAAIC,iCAA6C,KAAO;AACxD,SAASC;IACPJ,0BAA0B,IAAIC,QAAQ,CAACC;QACrCC,iCAAiC;YAC/BD;QACF;IACF;AACF;AAEO,SAASf;IACd,OAAOa;AACT;AAEA,SAASK,iCACPC,UAAsB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,aACA0D,yBACAC,QACA5D,YACA6D,mBACAC;YAEJ,EAAE,OAAOvC,KAAc;gBACrBsJ,IAAAA,+BAAuB,EAAC7I,OAAOT;YACjC;QACF;QAEAoJ,UAAUG,gBAAgB,CAAC,WAAW3J;QACtC,OAAO,IAAMwJ,UAAUI,mBAAmB,CAAC,WAAW5J;IACxD,GAAG;QACDlB;QACA2D;QACAmG;QACA/J;QACA2D;QACAE;KACD;IAED,IAAI4E,0BAA0B;QAC5B,qBACE,qBAACuC,4BAAa;YAACrD,OAAOA;YAAOD,aAAaA;sBACvCD;;IAGP;IAEA,OAAOA;AACT"}
|
@@ -26,10 +26,9 @@ declare global {
|
|
26
26
|
const __webpack_hash__: string;
|
27
27
|
interface Window {
|
28
28
|
__nextDevClientId: number;
|
29
|
-
__NEXT_HMR_LATENCY_CB: any;
|
30
29
|
}
|
31
30
|
}
|
32
|
-
export default function connect(
|
31
|
+
export default function connect(): {
|
33
32
|
subscribeToHmrEvent(handler: any): void;
|
34
33
|
onUnrecoverableError(): void;
|
35
34
|
addTurbopackMessageListener(cb: (msg: TurbopackMsgToBrowser) => void): void;
|
@@ -59,12 +59,11 @@ const _hotreloadertypes = require("../../../../server/dev/hot-reloader-types");
|
|
59
59
|
const _extractmodulesfromturbopackmessage = require("../../../../server/dev/extract-modules-from-turbopack-message");
|
60
60
|
const _shared = require("../shared");
|
61
61
|
const _runtimeerrorhandler = require("../../errors/runtime-error-handler");
|
62
|
+
const _reporthmrlatency = /*#__PURE__*/ _interop_require_default._(require("../utils/report-hmr-latency"));
|
62
63
|
window.__nextDevClientId = Math.round(Math.random() * 100 + Date.now());
|
63
64
|
let customHmrEventHandler;
|
64
65
|
let turbopackMessageListeners = [];
|
65
|
-
|
66
|
-
function connect(mode) {
|
67
|
-
MODE = mode;
|
66
|
+
function connect() {
|
68
67
|
(0, _client.register)();
|
69
68
|
(0, _websocket.addMessageListener)((payload)=>{
|
70
69
|
if (!('action' in payload)) {
|
@@ -73,8 +72,7 @@ function connect(mode) {
|
|
73
72
|
try {
|
74
73
|
processMessage(payload);
|
75
74
|
} catch (err) {
|
76
|
-
|
77
|
-
console.warn('[HMR] Invalid message: ' + JSON.stringify(payload) + '\n' + ((_err_stack = err == null ? void 0 : err.stack) != null ? _err_stack : ''));
|
75
|
+
(0, _shared.reportInvalidHmrMessage)(payload, err);
|
78
76
|
}
|
79
77
|
});
|
80
78
|
return {
|
@@ -110,7 +108,12 @@ function clearOutdatedErrors() {
|
|
110
108
|
// Successful compilation.
|
111
109
|
function handleSuccess() {
|
112
110
|
clearOutdatedErrors();
|
113
|
-
if (
|
111
|
+
if (process.env.TURBOPACK) {
|
112
|
+
(0, _reporthmrlatency.default)(_websocket.sendMessage, [
|
113
|
+
...turbopackUpdatedModules
|
114
|
+
], startLatency, turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now());
|
115
|
+
(0, _client.onBuildOk)();
|
116
|
+
} else {
|
114
117
|
const isHotUpdate = !isFirstCompilation || window.__NEXT_DATA__.page !== '/_error' && isUpdateAvailable();
|
115
118
|
isFirstCompilation = false;
|
116
119
|
hasCompileErrors = false;
|
@@ -118,11 +121,6 @@ function handleSuccess() {
|
|
118
121
|
if (isHotUpdate) {
|
119
122
|
tryApplyUpdates(onBeforeFastRefresh, onFastRefresh);
|
120
123
|
}
|
121
|
-
} else {
|
122
|
-
reportHmrLatency([
|
123
|
-
...turbopackUpdatedModules
|
124
|
-
]);
|
125
|
-
(0, _client.onBuildOk)();
|
126
124
|
}
|
127
125
|
}
|
128
126
|
// Compilation with warnings (e.g. ESLint).
|
@@ -199,30 +197,7 @@ function onFastRefresh(updatedModules) {
|
|
199
197
|
return;
|
200
198
|
}
|
201
199
|
(0, _client.onRefresh)();
|
202
|
-
|
203
|
-
}
|
204
|
-
function reportHmrLatency(updatedModules) {
|
205
|
-
if (updatedModules === void 0) updatedModules = [];
|
206
|
-
if (!startLatency) return;
|
207
|
-
// turbopack has a debounce for the BUILT event which we don't want to
|
208
|
-
// incorrectly show in this number, use the last TURBOPACK_MESSAGE time
|
209
|
-
let endLatency = turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now();
|
210
|
-
const latency = endLatency - startLatency;
|
211
|
-
console.log("[Fast Refresh] done in " + latency + "ms");
|
212
|
-
(0, _websocket.sendMessage)(JSON.stringify({
|
213
|
-
event: 'client-hmr-latency',
|
214
|
-
id: window.__nextDevClientId,
|
215
|
-
startTime: startLatency,
|
216
|
-
endTime: endLatency,
|
217
|
-
page: window.location.pathname,
|
218
|
-
updatedModules,
|
219
|
-
// Whether the page (tab) was hidden at the time the event occurred.
|
220
|
-
// This can impact the accuracy of the event's timing.
|
221
|
-
isPageHidden: document.visibilityState === 'hidden'
|
222
|
-
}));
|
223
|
-
if (self.__NEXT_HMR_LATENCY_CB) {
|
224
|
-
self.__NEXT_HMR_LATENCY_CB(latency);
|
225
|
-
}
|
200
|
+
(0, _reporthmrlatency.default)(_websocket.sendMessage, updatedModules, startLatency, turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now());
|
226
201
|
}
|
227
202
|
// There is a newer version of the code available.
|
228
203
|
function handleAvailableHash(hash) {
|
@@ -235,7 +210,7 @@ function handleStaticIndicator() {
|
|
235
210
|
const routeInfo = window.next.router.components[window.next.router.pathname];
|
236
211
|
const pageComponent = routeInfo == null ? void 0 : routeInfo.Component;
|
237
212
|
const appComponent = (_window_next_router_components__app = window.next.router.components['/_app']) == null ? void 0 : _window_next_router_components__app.Component;
|
238
|
-
const isDynamicPage = Boolean(pageComponent == null ? void 0 : pageComponent.getInitialProps) || Boolean(routeInfo.__N_SSP);
|
213
|
+
const isDynamicPage = Boolean(pageComponent == null ? void 0 : pageComponent.getInitialProps) || Boolean(routeInfo == null ? void 0 : routeInfo.__N_SSP);
|
239
214
|
const hasAppGetInitialProps = Boolean(appComponent == null ? void 0 : appComponent.getInitialProps) && (appComponent == null ? void 0 : appComponent.getInitialProps) !== (appComponent == null ? void 0 : appComponent.origGetInitialProps);
|
240
215
|
const isPageStatic = window.location.pathname in isrManifest || !isDynamicPage && !hasAppGetInitialProps;
|
241
216
|
(0, _client.onStaticIndicator)(isPageStatic);
|
@@ -245,7 +220,6 @@ function handleStaticIndicator() {
|
|
245
220
|
if (!('action' in obj)) {
|
246
221
|
return;
|
247
222
|
}
|
248
|
-
// Use turbopack message for analytics, (still need built for webpack)
|
249
223
|
switch(obj.action){
|
250
224
|
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.ISR_MANIFEST:
|
251
225
|
{
|
@@ -402,9 +376,9 @@ function tryApplyUpdates(onBeforeHotUpdate, onHotUpdateSuccess) {
|
|
402
376
|
function handleApplyUpdates(err, updatedModules) {
|
403
377
|
if (err || _runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError || !updatedModules) {
|
404
378
|
if (err) {
|
405
|
-
console.warn(
|
379
|
+
console.warn(_shared.REACT_REFRESH_FULL_RELOAD);
|
406
380
|
} else if (_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
|
407
|
-
console.warn(
|
381
|
+
console.warn(_shared.REACT_REFRESH_FULL_RELOAD_FROM_ERROR);
|
408
382
|
}
|
409
383
|
performFullReload(err);
|
410
384
|
return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/pages/hot-reloader-client.ts"],"sourcesContent":["// TODO: Remove use of `any` type. Fix no-use-before-define violations.\n/* eslint-disable @typescript-eslint/no-use-before-define */\n/**\n * MIT License\n *\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n// This file is a modified version of the Create React App HMR dev client that\n// can be found here:\n// https://github.com/facebook/create-react-app/blob/v3.4.1/packages/react-dev-utils/webpackHotDevClient.js\n\nimport {\n register,\n onBuildError,\n onBuildOk,\n onBeforeRefresh,\n onRefresh,\n onVersionInfo,\n onStaticIndicator,\n onDevIndicator,\n} from './client'\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\nimport { addMessageListener, sendMessage } from './websocket'\nimport formatWebpackMessages from '../utils/format-webpack-messages'\nimport { HMR_ACTIONS_SENT_TO_BROWSER } from '../../../../server/dev/hot-reloader-types'\nimport type {\n HMR_ACTION_TYPES,\n TurbopackMsgToBrowser,\n} from '../../../../server/dev/hot-reloader-types'\nimport { extractModulesFromTurbopackMessage } from '../../../../server/dev/extract-modules-from-turbopack-message'\nimport { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from '../shared'\nimport { RuntimeErrorHandler } from '../../errors/runtime-error-handler'\n// This alternative WebpackDevServer combines the functionality of:\n// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js\n// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js\n\n// It only supports their simplest configuration (hot updates on same server).\n// It makes some opinionated choices on top, like adding a syntax error overlay\n// that looks similar to our console output. The error overlay is inspired by:\n// https://github.com/glenjamin/webpack-hot-middleware\n\ndeclare global {\n const __webpack_hash__: string\n interface Window {\n __nextDevClientId: number\n __NEXT_HMR_LATENCY_CB: any\n }\n}\n\nwindow.__nextDevClientId = Math.round(Math.random() * 100 + Date.now())\n\nlet customHmrEventHandler: any\nlet turbopackMessageListeners: ((msg: TurbopackMsgToBrowser) => void)[] = []\nlet MODE: 'webpack' | 'turbopack' = 'webpack'\nexport default function connect(mode: 'webpack' | 'turbopack') {\n MODE = mode\n register()\n\n addMessageListener((payload) => {\n if (!('action' in payload)) {\n return\n }\n\n try {\n processMessage(payload)\n } catch (err: any) {\n console.warn(\n '[HMR] Invalid message: ' +\n JSON.stringify(payload) +\n '\\n' +\n (err?.stack ?? '')\n )\n }\n })\n\n return {\n subscribeToHmrEvent(handler: any) {\n customHmrEventHandler = handler\n },\n onUnrecoverableError() {\n RuntimeErrorHandler.hadRuntimeError = true\n },\n addTurbopackMessageListener(cb: (msg: TurbopackMsgToBrowser) => void) {\n turbopackMessageListeners.push(cb)\n },\n sendTurbopackMessage(msg: string) {\n sendMessage(msg)\n },\n handleUpdateError(err: unknown) {\n performFullReload(err)\n },\n }\n}\n\n// Remember some state related to hot module replacement.\nvar isFirstCompilation = true\nvar mostRecentCompilationHash: string | null = null\nvar hasCompileErrors = false\n\nfunction clearOutdatedErrors() {\n // Clean up outdated compile errors, if any.\n if (typeof console !== 'undefined' && typeof console.clear === 'function') {\n if (hasCompileErrors) {\n console.clear()\n }\n }\n}\n\n// Successful compilation.\nfunction handleSuccess() {\n clearOutdatedErrors()\n\n if (MODE === 'webpack') {\n const isHotUpdate =\n !isFirstCompilation ||\n (window.__NEXT_DATA__.page !== '/_error' && isUpdateAvailable())\n isFirstCompilation = false\n hasCompileErrors = false\n\n // Attempt to apply hot updates or reload.\n if (isHotUpdate) {\n tryApplyUpdates(onBeforeFastRefresh, onFastRefresh)\n }\n } else {\n reportHmrLatency([...turbopackUpdatedModules])\n onBuildOk()\n }\n}\n\n// Compilation with warnings (e.g. ESLint).\nfunction handleWarnings(warnings: any) {\n clearOutdatedErrors()\n\n const isHotUpdate = !isFirstCompilation\n isFirstCompilation = false\n hasCompileErrors = false\n\n function printWarnings() {\n // Print warnings to the console.\n const formatted = formatWebpackMessages({\n warnings: warnings,\n errors: [],\n })\n\n if (typeof console !== 'undefined' && typeof console.warn === 'function') {\n for (let i = 0; i < formatted.warnings?.length; i++) {\n if (i === 5) {\n console.warn(\n 'There were more warnings in other files.\\n' +\n 'You can find a complete log in the terminal.'\n )\n break\n }\n console.warn(stripAnsi(formatted.warnings[i]))\n }\n }\n }\n\n printWarnings()\n\n // Attempt to apply hot updates or reload.\n if (isHotUpdate) {\n tryApplyUpdates(onBeforeFastRefresh, onFastRefresh)\n }\n}\n\n// Compilation with errors (e.g. syntax error or missing modules).\nfunction handleErrors(errors: any) {\n clearOutdatedErrors()\n\n isFirstCompilation = false\n hasCompileErrors = true\n\n // \"Massage\" webpack messages.\n var formatted = formatWebpackMessages({\n errors: errors,\n warnings: [],\n })\n\n // Only show the first error.\n\n onBuildError(formatted.errors[0])\n\n // Also log them to the console.\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n for (var i = 0; i < formatted.errors.length; i++) {\n console.error(stripAnsi(formatted.errors[i]))\n }\n }\n\n // Do not attempt to reload now.\n // We will reload on next success instead.\n if (process.env.__NEXT_TEST_MODE) {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB(formatted.errors[0])\n self.__NEXT_HMR_CB = null\n }\n }\n}\n\nlet startLatency: number | null = null\nlet turbopackLastUpdateLatency: number | null = null\nlet turbopackUpdatedModules: Set<string> = new Set()\nlet isrManifest: Record<string, boolean> = {}\n\nfunction onBeforeFastRefresh(updatedModules: string[]) {\n if (updatedModules.length > 0) {\n // Only trigger a pending state if we have updates to apply\n // (cf. onFastRefresh)\n onBeforeRefresh()\n }\n}\n\nfunction onFastRefresh(updatedModules: ReadonlyArray<string> = []) {\n onBuildOk()\n if (updatedModules.length === 0) {\n return\n }\n\n onRefresh()\n\n reportHmrLatency()\n}\n\nfunction reportHmrLatency(updatedModules: ReadonlyArray<string> = []) {\n if (!startLatency) return\n // turbopack has a debounce for the BUILT event which we don't want to\n // incorrectly show in this number, use the last TURBOPACK_MESSAGE time\n let endLatency = turbopackLastUpdateLatency ?? Date.now()\n const latency = endLatency - startLatency\n console.log(`[Fast Refresh] done in ${latency}ms`)\n sendMessage(\n JSON.stringify({\n event: 'client-hmr-latency',\n id: window.__nextDevClientId,\n startTime: startLatency,\n endTime: endLatency,\n page: window.location.pathname,\n updatedModules,\n // Whether the page (tab) was hidden at the time the event occurred.\n // This can impact the accuracy of the event's timing.\n isPageHidden: document.visibilityState === 'hidden',\n })\n )\n if (self.__NEXT_HMR_LATENCY_CB) {\n self.__NEXT_HMR_LATENCY_CB(latency)\n }\n}\n\n// There is a newer version of the code available.\nfunction handleAvailableHash(hash: string) {\n // Update last known compilation hash.\n mostRecentCompilationHash = hash\n}\n\nexport function handleStaticIndicator() {\n if (process.env.__NEXT_DEV_INDICATOR) {\n const routeInfo = window.next.router.components[window.next.router.pathname]\n const pageComponent = routeInfo?.Component\n const appComponent = window.next.router.components['/_app']?.Component\n const isDynamicPage =\n Boolean(pageComponent?.getInitialProps) || Boolean(routeInfo.__N_SSP)\n const hasAppGetInitialProps =\n Boolean(appComponent?.getInitialProps) &&\n appComponent?.getInitialProps !== appComponent?.origGetInitialProps\n\n const isPageStatic =\n window.location.pathname in isrManifest ||\n (!isDynamicPage && !hasAppGetInitialProps)\n\n onStaticIndicator(isPageStatic)\n }\n}\n\n/** Handles messages from the sevrer for the Pages Router. */\nfunction processMessage(obj: HMR_ACTION_TYPES) {\n if (!('action' in obj)) {\n return\n }\n\n // Use turbopack message for analytics, (still need built for webpack)\n switch (obj.action) {\n case HMR_ACTIONS_SENT_TO_BROWSER.ISR_MANIFEST: {\n isrManifest = obj.data\n handleStaticIndicator()\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILDING: {\n startLatency = Date.now()\n turbopackLastUpdateLatency = null\n turbopackUpdatedModules.clear()\n console.log('[Fast Refresh] rebuilding')\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILT:\n case HMR_ACTIONS_SENT_TO_BROWSER.SYNC: {\n if (obj.hash) handleAvailableHash(obj.hash)\n\n const { errors, warnings } = obj\n\n // Is undefined when it's a 'built' event\n if ('versionInfo' in obj) onVersionInfo(obj.versionInfo)\n if ('devIndicator' in obj) onDevIndicator(obj.devIndicator)\n\n const hasErrors = Boolean(errors && errors.length)\n if (hasErrors) {\n sendMessage(\n JSON.stringify({\n event: 'client-error',\n errorCount: errors.length,\n clientId: window.__nextDevClientId,\n })\n )\n return handleErrors(errors)\n }\n\n const hasWarnings = Boolean(warnings && warnings.length)\n if (hasWarnings) {\n sendMessage(\n JSON.stringify({\n event: 'client-warning',\n warningCount: warnings.length,\n clientId: window.__nextDevClientId,\n })\n )\n return handleWarnings(warnings)\n }\n\n sendMessage(\n JSON.stringify({\n event: 'client-success',\n clientId: window.__nextDevClientId,\n })\n )\n return handleSuccess()\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES: {\n if (hasCompileErrors || RuntimeErrorHandler.hadRuntimeError) {\n window.location.reload()\n }\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR: {\n const { errorJSON } = obj\n if (errorJSON) {\n const { message, stack } = JSON.parse(errorJSON)\n const error = new Error(message)\n error.stack = stack\n handleErrors([error])\n }\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED: {\n for (const listener of turbopackMessageListeners) {\n listener({\n type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED,\n data: obj.data,\n })\n }\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE: {\n const updatedModules = extractModulesFromTurbopackMessage(obj.data)\n onBeforeFastRefresh([...updatedModules])\n for (const listener of turbopackMessageListeners) {\n listener({\n type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE,\n data: obj.data,\n })\n }\n if (RuntimeErrorHandler.hadRuntimeError) {\n console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR)\n performFullReload(null)\n }\n onRefresh()\n for (const module of updatedModules) {\n turbopackUpdatedModules.add(module)\n }\n turbopackLastUpdateLatency = Date.now()\n break\n }\n default: {\n if (customHmrEventHandler) {\n customHmrEventHandler(obj)\n break\n }\n break\n }\n }\n}\n\n// Is there a newer version of this code available?\nfunction isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_hash__\n}\n\n// Webpack disallows updates in other states.\nfunction canApplyUpdates() {\n // @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.\n return module.hot.status() === 'idle'\n}\nfunction afterApplyUpdates(fn: () => void) {\n if (canApplyUpdates()) {\n fn()\n } else {\n function handler(status: string) {\n if (status === 'idle') {\n // @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.\n module.hot.removeStatusHandler(handler)\n fn()\n }\n }\n // @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.\n module.hot.addStatusHandler(handler)\n }\n}\n\n// Attempt to update code on the fly, fall back to a hard reload.\nfunction tryApplyUpdates(\n onBeforeHotUpdate: ((updatedModules: string[]) => unknown) | undefined,\n onHotUpdateSuccess: (updatedModules: string[]) => unknown\n) {\n // @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.\n if (!module.hot) {\n // HotModuleReplacementPlugin is not in Webpack configuration.\n console.error('HotModuleReplacementPlugin is not in Webpack configuration.')\n // window.location.reload();\n return\n }\n\n if (!isUpdateAvailable() || !canApplyUpdates()) {\n onBuildOk()\n return\n }\n\n function handleApplyUpdates(err: any, updatedModules: string[] | null) {\n if (err || RuntimeErrorHandler.hadRuntimeError || !updatedModules) {\n if (err) {\n console.warn(\n '[Fast Refresh] performing full reload\\n\\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\" +\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' +\n 'Consider migrating the non-React component export to a separate file and importing it into both files.\\n\\n' +\n 'It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\\n' +\n 'Fast Refresh requires at least one parent function component in your React tree.'\n )\n } else if (RuntimeErrorHandler.hadRuntimeError) {\n console.warn(\n '[Fast Refresh] performing full reload because your application had an unrecoverable error'\n )\n }\n performFullReload(err)\n return\n }\n\n if (typeof onHotUpdateSuccess === 'function') {\n // Maybe we want to do something.\n onHotUpdateSuccess(updatedModules)\n }\n\n if (isUpdateAvailable()) {\n // While we were updating, there was a new update! Do it again.\n // However, this time, don't trigger a pending refresh state.\n tryApplyUpdates(\n updatedModules.length > 0 ? undefined : onBeforeHotUpdate,\n updatedModules.length > 0 ? onBuildOk : onHotUpdateSuccess\n )\n } else {\n onBuildOk()\n if (process.env.__NEXT_TEST_MODE) {\n afterApplyUpdates(() => {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB()\n self.__NEXT_HMR_CB = null\n }\n })\n }\n }\n }\n\n // https://webpack.js.org/api/hot-module-replacement/#check\n // @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.\n module.hot\n .check(/* autoApply */ false)\n .then((updatedModules: any) => {\n if (!updatedModules) {\n return null\n }\n\n if (typeof onBeforeHotUpdate === 'function') {\n onBeforeHotUpdate(updatedModules)\n }\n // @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.\n return module.hot.apply()\n })\n .then(\n (updatedModules: any) => {\n handleApplyUpdates(null, updatedModules)\n },\n (err: any) => {\n handleApplyUpdates(err, null)\n }\n )\n}\n\nexport function performFullReload(err: any) {\n const stackTrace =\n err &&\n ((err.stack && err.stack.split('\\n').slice(0, 5).join('\\n')) ||\n err.message ||\n err + '')\n\n sendMessage(\n JSON.stringify({\n event: 'client-full-reload',\n stackTrace,\n hadRuntimeError: !!RuntimeErrorHandler.hadRuntimeError,\n dependencyChain: err ? err.dependencyChain : undefined,\n })\n )\n\n window.location.reload()\n}\n"],"names":["connect","handleStaticIndicator","performFullReload","window","__nextDevClientId","Math","round","random","Date","now","customHmrEventHandler","turbopackMessageListeners","MODE","mode","register","addMessageListener","payload","processMessage","err","console","warn","JSON","stringify","stack","subscribeToHmrEvent","handler","onUnrecoverableError","RuntimeErrorHandler","hadRuntimeError","addTurbopackMessageListener","cb","push","sendTurbopackMessage","msg","sendMessage","handleUpdateError","isFirstCompilation","mostRecentCompilationHash","hasCompileErrors","clearOutdatedErrors","clear","handleSuccess","isHotUpdate","__NEXT_DATA__","page","isUpdateAvailable","tryApplyUpdates","onBeforeFastRefresh","onFastRefresh","reportHmrLatency","turbopackUpdatedModules","onBuildOk","handleWarnings","warnings","printWarnings","formatted","formatWebpackMessages","errors","i","length","stripAnsi","handleErrors","onBuildError","error","process","env","__NEXT_TEST_MODE","self","__NEXT_HMR_CB","startLatency","turbopackLastUpdateLatency","Set","isrManifest","updatedModules","onBeforeRefresh","onRefresh","endLatency","latency","log","event","id","startTime","endTime","location","pathname","isPageHidden","document","visibilityState","__NEXT_HMR_LATENCY_CB","handleAvailableHash","hash","__NEXT_DEV_INDICATOR","routeInfo","next","router","components","pageComponent","Component","appComponent","isDynamicPage","Boolean","getInitialProps","__N_SSP","hasAppGetInitialProps","origGetInitialProps","isPageStatic","onStaticIndicator","obj","action","HMR_ACTIONS_SENT_TO_BROWSER","ISR_MANIFEST","data","BUILDING","BUILT","SYNC","onVersionInfo","versionInfo","onDevIndicator","devIndicator","hasErrors","errorCount","clientId","hasWarnings","warningCount","SERVER_COMPONENT_CHANGES","reload","SERVER_ERROR","errorJSON","message","parse","Error","TURBOPACK_CONNECTED","listener","type","TURBOPACK_MESSAGE","extractModulesFromTurbopackMessage","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","module","add","__webpack_hash__","canApplyUpdates","hot","status","afterApplyUpdates","fn","removeStatusHandler","addStatusHandler","onBeforeHotUpdate","onHotUpdateSuccess","handleApplyUpdates","undefined","check","then","apply","stackTrace","split","slice","join","dependencyChain"],"mappings":"AAAA,uEAAuE;AACvE,0DAA0D,GAC1D;;;;;;;;;;;;;;;;;;;;;;CAsBC,GAED,8EAA8E;AAC9E,qBAAqB;AACrB,2GAA2G;;;;;;;;;;;;;;;;;IA6C3G,OAsCC;eAtCuBA;;IAyMRC,qBAAqB;eAArBA;;IA6PAC,iBAAiB;eAAjBA;;;;wBAxeT;oEACe;2BAC0B;gFACd;kCACU;oDAKO;wBACE;qCACjB;AAkBpCC,OAAOC,iBAAiB,GAAGC,KAAKC,KAAK,CAACD,KAAKE,MAAM,KAAK,MAAMC,KAAKC,GAAG;AAEpE,IAAIC;AACJ,IAAIC,4BAAsE,EAAE;AAC5E,IAAIC,OAAgC;AACrB,SAASZ,QAAQa,IAA6B;IAC3DD,OAAOC;IACPC,IAAAA,gBAAQ;IAERC,IAAAA,6BAAkB,EAAC,CAACC;QAClB,IAAI,CAAE,CAAA,YAAYA,OAAM,GAAI;YAC1B;QACF;QAEA,IAAI;YACFC,eAAeD;QACjB,EAAE,OAAOE,KAAU;gBAKZA;YAJLC,QAAQC,IAAI,CACV,4BACEC,KAAKC,SAAS,CAACN,WACf,OACCE,CAAAA,CAAAA,aAAAA,uBAAAA,IAAKK,KAAK,YAAVL,aAAc,EAAC;QAEtB;IACF;IAEA,OAAO;QACLM,qBAAoBC,OAAY;YAC9Bf,wBAAwBe;QAC1B;QACAC;YACEC,wCAAmB,CAACC,eAAe,GAAG;QACxC;QACAC,6BAA4BC,EAAwC;YAClEnB,0BAA0BoB,IAAI,CAACD;QACjC;QACAE,sBAAqBC,GAAW;YAC9BC,IAAAA,sBAAW,EAACD;QACd;QACAE,mBAAkBjB,GAAY;YAC5BhB,kBAAkBgB;QACpB;IACF;AACF;A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C/D,6DAA6D;YAC7DC,gBACE2B,eAAed,MAAM,GAAG,IAAI2F,YAAYH,mBACxC1E,eAAed,MAAM,GAAG,IAAIR,iBAAS,GAAGiG;QAE5C,OAAO;YACLjG,IAAAA,iBAAS;YACT,IAAIa,QAAQC,GAAG,CAACC,gBAAgB,EAAE;gBAChC6E,kBAAkB;oBAChB,IAAI5E,KAAKC,aAAa,EAAE;wBACtBD,KAAKC,aAAa;wBAClBD,KAAKC,aAAa,GAAG;oBACvB;gBACF;YACF;QACF;IACF;IAEA,2DAA2D;IAC3D,yIAAyI;IACzIqE,OAAOI,GAAG,CACPU,KAAK,CAAC,aAAa,GAAG,OACtBC,IAAI,CAAC,CAAC/E;QACL,IAAI,CAACA,gBAAgB;YACnB,OAAO;QACT;QAEA,IAAI,OAAO0E,sBAAsB,YAAY;YAC3CA,kBAAkB1E;QACpB;QACA,yIAAyI;QACzI,OAAOgE,OAAOI,GAAG,CAACY,KAAK;IACzB,GACCD,IAAI,CACH,CAAC/E;QACC4E,mBAAmB,MAAM5E;IAC3B,GACA,CAACvD;QACCmI,mBAAmBnI,KAAK;IAC1B;AAEN;AAEO,SAAShB,kBAAkBgB,GAAQ;IACxC,MAAMwI,aACJxI,OACC,CAAA,AAACA,IAAIK,KAAK,IAAIL,IAAIK,KAAK,CAACoI,KAAK,CAAC,MAAMC,KAAK,CAAC,GAAG,GAAGC,IAAI,CAAC,SACpD3I,IAAI8G,OAAO,IACX9G,MAAM,EAAC;IAEXgB,IAAAA,sBAAW,EACTb,KAAKC,SAAS,CAAC;QACbyD,OAAO;QACP2E;QACA9H,iBAAiB,CAAC,CAACD,wCAAmB,CAACC,eAAe;QACtDkI,iBAAiB5I,MAAMA,IAAI4I,eAAe,GAAGR;IAC/C;IAGFnJ,OAAOgF,QAAQ,CAAC0C,MAAM;AACxB"}
|
1
|
+
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/pages/hot-reloader-client.ts"],"sourcesContent":["// TODO: Remove use of `any` type. Fix no-use-before-define violations.\n/* eslint-disable @typescript-eslint/no-use-before-define */\n/**\n * MIT License\n *\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n// This file is a modified version of the Create React App HMR dev client that\n// can be found here:\n// https://github.com/facebook/create-react-app/blob/v3.4.1/packages/react-dev-utils/webpackHotDevClient.js\n\nimport {\n register,\n onBuildError,\n onBuildOk,\n onBeforeRefresh,\n onRefresh,\n onVersionInfo,\n onStaticIndicator,\n onDevIndicator,\n} from './client'\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\nimport { addMessageListener, sendMessage } from './websocket'\nimport formatWebpackMessages from '../utils/format-webpack-messages'\nimport { HMR_ACTIONS_SENT_TO_BROWSER } from '../../../../server/dev/hot-reloader-types'\nimport type {\n HMR_ACTION_TYPES,\n TurbopackMsgToBrowser,\n} from '../../../../server/dev/hot-reloader-types'\nimport { extractModulesFromTurbopackMessage } from '../../../../server/dev/extract-modules-from-turbopack-message'\nimport {\n REACT_REFRESH_FULL_RELOAD,\n REACT_REFRESH_FULL_RELOAD_FROM_ERROR,\n reportInvalidHmrMessage,\n} from '../shared'\nimport { RuntimeErrorHandler } from '../../errors/runtime-error-handler'\nimport reportHmrLatency from '../utils/report-hmr-latency'\n// This alternative WebpackDevServer combines the functionality of:\n// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js\n// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js\n\n// It only supports their simplest configuration (hot updates on same server).\n// It makes some opinionated choices on top, like adding a syntax error overlay\n// that looks similar to our console output. The error overlay is inspired by:\n// https://github.com/glenjamin/webpack-hot-middleware\n\ndeclare global {\n const __webpack_hash__: string\n interface Window {\n __nextDevClientId: number\n }\n}\n\nwindow.__nextDevClientId = Math.round(Math.random() * 100 + Date.now())\n\nlet customHmrEventHandler: any\nlet turbopackMessageListeners: ((msg: TurbopackMsgToBrowser) => void)[] = []\nexport default function connect() {\n register()\n\n addMessageListener((payload) => {\n if (!('action' in payload)) {\n return\n }\n\n try {\n processMessage(payload)\n } catch (err: unknown) {\n reportInvalidHmrMessage(payload, err)\n }\n })\n\n return {\n subscribeToHmrEvent(handler: any) {\n customHmrEventHandler = handler\n },\n onUnrecoverableError() {\n RuntimeErrorHandler.hadRuntimeError = true\n },\n addTurbopackMessageListener(cb: (msg: TurbopackMsgToBrowser) => void) {\n turbopackMessageListeners.push(cb)\n },\n sendTurbopackMessage(msg: string) {\n sendMessage(msg)\n },\n handleUpdateError(err: unknown) {\n performFullReload(err)\n },\n }\n}\n\n// Remember some state related to hot module replacement.\nvar isFirstCompilation = true\nvar mostRecentCompilationHash: string | null = null\nvar hasCompileErrors = false\n\nfunction clearOutdatedErrors() {\n // Clean up outdated compile errors, if any.\n if (typeof console !== 'undefined' && typeof console.clear === 'function') {\n if (hasCompileErrors) {\n console.clear()\n }\n }\n}\n\n// Successful compilation.\nfunction handleSuccess() {\n clearOutdatedErrors()\n\n if (process.env.TURBOPACK) {\n reportHmrLatency(\n sendMessage,\n [...turbopackUpdatedModules],\n startLatency!,\n turbopackLastUpdateLatency ?? Date.now()\n )\n onBuildOk()\n } else {\n const isHotUpdate =\n !isFirstCompilation ||\n (window.__NEXT_DATA__.page !== '/_error' && isUpdateAvailable())\n isFirstCompilation = false\n hasCompileErrors = false\n\n // Attempt to apply hot updates or reload.\n if (isHotUpdate) {\n tryApplyUpdates(onBeforeFastRefresh, onFastRefresh)\n }\n }\n}\n\n// Compilation with warnings (e.g. ESLint).\nfunction handleWarnings(warnings: any) {\n clearOutdatedErrors()\n\n const isHotUpdate = !isFirstCompilation\n isFirstCompilation = false\n hasCompileErrors = false\n\n function printWarnings() {\n // Print warnings to the console.\n const formatted = formatWebpackMessages({\n warnings: warnings,\n errors: [],\n })\n\n if (typeof console !== 'undefined' && typeof console.warn === 'function') {\n for (let i = 0; i < formatted.warnings?.length; i++) {\n if (i === 5) {\n console.warn(\n 'There were more warnings in other files.\\n' +\n 'You can find a complete log in the terminal.'\n )\n break\n }\n console.warn(stripAnsi(formatted.warnings[i]))\n }\n }\n }\n\n printWarnings()\n\n // Attempt to apply hot updates or reload.\n if (isHotUpdate) {\n tryApplyUpdates(onBeforeFastRefresh, onFastRefresh)\n }\n}\n\n// Compilation with errors (e.g. syntax error or missing modules).\nfunction handleErrors(errors: any) {\n clearOutdatedErrors()\n\n isFirstCompilation = false\n hasCompileErrors = true\n\n // \"Massage\" webpack messages.\n var formatted = formatWebpackMessages({\n errors: errors,\n warnings: [],\n })\n\n // Only show the first error.\n\n onBuildError(formatted.errors[0])\n\n // Also log them to the console.\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n for (var i = 0; i < formatted.errors.length; i++) {\n console.error(stripAnsi(formatted.errors[i]))\n }\n }\n\n // Do not attempt to reload now.\n // We will reload on next success instead.\n if (process.env.__NEXT_TEST_MODE) {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB(formatted.errors[0])\n self.__NEXT_HMR_CB = null\n }\n }\n}\n\nlet startLatency: number | null = null\nlet turbopackLastUpdateLatency: number | null = null\nlet turbopackUpdatedModules: Set<string> = new Set()\nlet isrManifest: Record<string, boolean> = {}\n\nfunction onBeforeFastRefresh(updatedModules: string[]) {\n if (updatedModules.length > 0) {\n // Only trigger a pending state if we have updates to apply\n // (cf. onFastRefresh)\n onBeforeRefresh()\n }\n}\n\nfunction onFastRefresh(updatedModules: ReadonlyArray<string> = []) {\n onBuildOk()\n if (updatedModules.length === 0) {\n return\n }\n\n onRefresh()\n\n reportHmrLatency(\n sendMessage,\n updatedModules,\n startLatency!,\n turbopackLastUpdateLatency ?? Date.now()\n )\n}\n\n// There is a newer version of the code available.\nfunction handleAvailableHash(hash: string) {\n // Update last known compilation hash.\n mostRecentCompilationHash = hash\n}\n\nexport function handleStaticIndicator() {\n if (process.env.__NEXT_DEV_INDICATOR) {\n const routeInfo = window.next.router.components[window.next.router.pathname]\n const pageComponent = routeInfo?.Component\n const appComponent = window.next.router.components['/_app']?.Component\n const isDynamicPage =\n Boolean(pageComponent?.getInitialProps) || Boolean(routeInfo?.__N_SSP)\n const hasAppGetInitialProps =\n Boolean(appComponent?.getInitialProps) &&\n appComponent?.getInitialProps !== appComponent?.origGetInitialProps\n\n const isPageStatic =\n window.location.pathname in isrManifest ||\n (!isDynamicPage && !hasAppGetInitialProps)\n\n onStaticIndicator(isPageStatic)\n }\n}\n\n/** Handles messages from the sevrer for the Pages Router. */\nfunction processMessage(obj: HMR_ACTION_TYPES) {\n if (!('action' in obj)) {\n return\n }\n\n switch (obj.action) {\n case HMR_ACTIONS_SENT_TO_BROWSER.ISR_MANIFEST: {\n isrManifest = obj.data\n handleStaticIndicator()\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILDING: {\n startLatency = Date.now()\n turbopackLastUpdateLatency = null\n turbopackUpdatedModules.clear()\n console.log('[Fast Refresh] rebuilding')\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILT:\n case HMR_ACTIONS_SENT_TO_BROWSER.SYNC: {\n if (obj.hash) handleAvailableHash(obj.hash)\n\n const { errors, warnings } = obj\n\n // Is undefined when it's a 'built' event\n if ('versionInfo' in obj) onVersionInfo(obj.versionInfo)\n if ('devIndicator' in obj) onDevIndicator(obj.devIndicator)\n\n const hasErrors = Boolean(errors && errors.length)\n if (hasErrors) {\n sendMessage(\n JSON.stringify({\n event: 'client-error',\n errorCount: errors.length,\n clientId: window.__nextDevClientId,\n })\n )\n return handleErrors(errors)\n }\n\n const hasWarnings = Boolean(warnings && warnings.length)\n if (hasWarnings) {\n sendMessage(\n JSON.stringify({\n event: 'client-warning',\n warningCount: warnings.length,\n clientId: window.__nextDevClientId,\n })\n )\n return handleWarnings(warnings)\n }\n\n sendMessage(\n JSON.stringify({\n event: 'client-success',\n clientId: window.__nextDevClientId,\n })\n )\n return handleSuccess()\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES: {\n if (hasCompileErrors || RuntimeErrorHandler.hadRuntimeError) {\n window.location.reload()\n }\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR: {\n const { errorJSON } = obj\n if (errorJSON) {\n const { message, stack } = JSON.parse(errorJSON)\n const error = new Error(message)\n error.stack = stack\n handleErrors([error])\n }\n return\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED: {\n for (const listener of turbopackMessageListeners) {\n listener({\n type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED,\n data: obj.data,\n })\n }\n break\n }\n case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE: {\n const updatedModules = extractModulesFromTurbopackMessage(obj.data)\n onBeforeFastRefresh([...updatedModules])\n for (const listener of turbopackMessageListeners) {\n listener({\n type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE,\n data: obj.data,\n })\n }\n if (RuntimeErrorHandler.hadRuntimeError) {\n console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR)\n performFullReload(null)\n }\n onRefresh()\n for (const module of updatedModules) {\n turbopackUpdatedModules.add(module)\n }\n turbopackLastUpdateLatency = Date.now()\n break\n }\n default: {\n if (customHmrEventHandler) {\n customHmrEventHandler(obj)\n break\n }\n break\n }\n }\n}\n\n// Is there a newer version of this code available?\nfunction isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_hash__\n}\n\n// Webpack disallows updates in other states.\nfunction canApplyUpdates() {\n // @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.\n return module.hot.status() === 'idle'\n}\nfunction afterApplyUpdates(fn: () => void) {\n if (canApplyUpdates()) {\n fn()\n } else {\n function handler(status: string) {\n if (status === 'idle') {\n // @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.\n module.hot.removeStatusHandler(handler)\n fn()\n }\n }\n // @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.\n module.hot.addStatusHandler(handler)\n }\n}\n\n// Attempt to update code on the fly, fall back to a hard reload.\nfunction tryApplyUpdates(\n onBeforeHotUpdate: ((updatedModules: string[]) => unknown) | undefined,\n onHotUpdateSuccess: (updatedModules: string[]) => unknown\n) {\n // @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.\n if (!module.hot) {\n // HotModuleReplacementPlugin is not in Webpack configuration.\n console.error('HotModuleReplacementPlugin is not in Webpack configuration.')\n // window.location.reload();\n return\n }\n\n if (!isUpdateAvailable() || !canApplyUpdates()) {\n onBuildOk()\n return\n }\n\n function handleApplyUpdates(err: any, updatedModules: string[] | null) {\n if (err || RuntimeErrorHandler.hadRuntimeError || !updatedModules) {\n if (err) {\n console.warn(REACT_REFRESH_FULL_RELOAD)\n } else if (RuntimeErrorHandler.hadRuntimeError) {\n console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR)\n }\n performFullReload(err)\n return\n }\n\n if (typeof onHotUpdateSuccess === 'function') {\n // Maybe we want to do something.\n onHotUpdateSuccess(updatedModules)\n }\n\n if (isUpdateAvailable()) {\n // While we were updating, there was a new update! Do it again.\n // However, this time, don't trigger a pending refresh state.\n tryApplyUpdates(\n updatedModules.length > 0 ? undefined : onBeforeHotUpdate,\n updatedModules.length > 0 ? onBuildOk : onHotUpdateSuccess\n )\n } else {\n onBuildOk()\n if (process.env.__NEXT_TEST_MODE) {\n afterApplyUpdates(() => {\n if (self.__NEXT_HMR_CB) {\n self.__NEXT_HMR_CB()\n self.__NEXT_HMR_CB = null\n }\n })\n }\n }\n }\n\n // https://webpack.js.org/api/hot-module-replacement/#check\n // @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.\n module.hot\n .check(/* autoApply */ false)\n .then((updatedModules: any) => {\n if (!updatedModules) {\n return null\n }\n\n if (typeof onBeforeHotUpdate === 'function') {\n onBeforeHotUpdate(updatedModules)\n }\n // @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.\n return module.hot.apply()\n })\n .then(\n (updatedModules: any) => {\n handleApplyUpdates(null, updatedModules)\n },\n (err: any) => {\n handleApplyUpdates(err, null)\n }\n )\n}\n\nexport function performFullReload(err: any) {\n const stackTrace =\n err &&\n ((err.stack && err.stack.split('\\n').slice(0, 5).join('\\n')) ||\n err.message ||\n err + '')\n\n sendMessage(\n JSON.stringify({\n event: 'client-full-reload',\n stackTrace,\n hadRuntimeError: !!RuntimeErrorHandler.hadRuntimeError,\n dependencyChain: err ? err.dependencyChain : undefined,\n })\n )\n\n window.location.reload()\n}\n"],"names":["connect","handleStaticIndicator","performFullReload","window","__nextDevClientId","Math","round","random","Date","now","customHmrEventHandler","turbopackMessageListeners","register","addMessageListener","payload","processMessage","err","reportInvalidHmrMessage","subscribeToHmrEvent","handler","onUnrecoverableError","RuntimeErrorHandler","hadRuntimeError","addTurbopackMessageListener","cb","push","sendTurbopackMessage","msg","sendMessage","handleUpdateError","isFirstCompilation","mostRecentCompilationHash","hasCompileErrors","clearOutdatedErrors","console","clear","handleSuccess","process","env","TURBOPACK","reportHmrLatency","turbopackUpdatedModules","startLatency","turbopackLastUpdateLatency","onBuildOk","isHotUpdate","__NEXT_DATA__","page","isUpdateAvailable","tryApplyUpdates","onBeforeFastRefresh","onFastRefresh","handleWarnings","warnings","printWarnings","formatted","formatWebpackMessages","errors","warn","i","length","stripAnsi","handleErrors","onBuildError","error","__NEXT_TEST_MODE","self","__NEXT_HMR_CB","Set","isrManifest","updatedModules","onBeforeRefresh","onRefresh","handleAvailableHash","hash","__NEXT_DEV_INDICATOR","routeInfo","next","router","components","pathname","pageComponent","Component","appComponent","isDynamicPage","Boolean","getInitialProps","__N_SSP","hasAppGetInitialProps","origGetInitialProps","isPageStatic","location","onStaticIndicator","obj","action","HMR_ACTIONS_SENT_TO_BROWSER","ISR_MANIFEST","data","BUILDING","log","BUILT","SYNC","onVersionInfo","versionInfo","onDevIndicator","devIndicator","hasErrors","JSON","stringify","event","errorCount","clientId","hasWarnings","warningCount","SERVER_COMPONENT_CHANGES","reload","SERVER_ERROR","errorJSON","message","stack","parse","Error","TURBOPACK_CONNECTED","listener","type","TURBOPACK_MESSAGE","extractModulesFromTurbopackMessage","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","module","add","__webpack_hash__","canApplyUpdates","hot","status","afterApplyUpdates","fn","removeStatusHandler","addStatusHandler","onBeforeHotUpdate","onHotUpdateSuccess","handleApplyUpdates","REACT_REFRESH_FULL_RELOAD","undefined","check","then","apply","stackTrace","split","slice","join","dependencyChain"],"mappings":"AAAA,uEAAuE;AACvE,0DAA0D,GAC1D;;;;;;;;;;;;;;;;;;;;;;CAsBC,GAED,8EAA8E;AAC9E,qBAAqB;AACrB,2GAA2G;;;;;;;;;;;;;;;;;IAgD3G,OAgCC;eAhCuBA;;IAoLRC,q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XY,IAAAA,sBAAW,EACT+E,KAAKC,SAAS,CAAC;QACbC,OAAO;QACPqC;QACA5H,iBAAiB,CAAC,CAACD,wCAAmB,CAACC,eAAe;QACtDgI,iBAAiBtI,MAAMA,IAAIsI,eAAe,GAAGR;IAC/C;IAGF3I,OAAOwF,QAAQ,CAACwB,MAAM;AACxB"}
|
@@ -4,6 +4,7 @@ import type { SupportedErrorEvent } from './ui/container/runtime-error/render-er
|
|
4
4
|
import type { ComponentStackFrame } from './utils/parse-component-stack';
|
5
5
|
import type { DebugInfo } from './types';
|
6
6
|
import type { DevIndicatorServerState } from '../../../server/dev/dev-indicator-server-state';
|
7
|
+
import type { HMR_ACTION_TYPES } from '../../../server/dev/hot-reloader-types';
|
7
8
|
type FastRefreshState =
|
8
9
|
/** No refresh in progress. */
|
9
10
|
{
|
@@ -86,5 +87,7 @@ export declare const INITIAL_OVERLAY_STATE: Omit<OverlayState, 'routerType'>;
|
|
86
87
|
export declare function useErrorOverlayReducer(routerType: 'pages' | 'app'): [OverlayState & {
|
87
88
|
routerType: "pages" | "app";
|
88
89
|
}, import("react").ActionDispatch<[action: BusEvent]>];
|
90
|
+
export declare const REACT_REFRESH_FULL_RELOAD: string;
|
89
91
|
export declare const REACT_REFRESH_FULL_RELOAD_FROM_ERROR = "[Fast Refresh] performing full reload because your application had an unrecoverable error";
|
92
|
+
export declare function reportInvalidHmrMessage(message: HMR_ACTION_TYPES | MessageEvent<unknown>, err: unknown): void;
|
90
93
|
export {};
|