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.
Files changed (84) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +10 -2
  3. package/dist/build/index.js.map +1 -1
  4. package/dist/build/swc/index.js +1 -1
  5. package/dist/build/webpack-config.js +2 -2
  6. package/dist/client/app-bootstrap.js +1 -1
  7. package/dist/client/components/react-dev-overlay/app/hot-reloader-client.js +10 -33
  8. package/dist/client/components/react-dev-overlay/app/hot-reloader-client.js.map +1 -1
  9. package/dist/client/components/react-dev-overlay/pages/hot-reloader-client.d.ts +1 -2
  10. package/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js +13 -39
  11. package/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js.map +1 -1
  12. package/dist/client/components/react-dev-overlay/shared.d.ts +3 -0
  13. package/dist/client/components/react-dev-overlay/shared.js +12 -0
  14. package/dist/client/components/react-dev-overlay/shared.js.map +1 -1
  15. package/dist/client/components/react-dev-overlay/utils/report-hmr-latency.d.ts +6 -0
  16. package/dist/client/components/react-dev-overlay/utils/report-hmr-latency.js +36 -0
  17. package/dist/client/components/react-dev-overlay/utils/report-hmr-latency.js.map +1 -0
  18. package/dist/client/dev/amp-dev.js +2 -2
  19. package/dist/client/dev/amp-dev.js.map +1 -1
  20. package/dist/client/dev/hot-middleware-client.d.ts +1 -1
  21. package/dist/client/dev/hot-middleware-client.js +2 -2
  22. package/dist/client/dev/hot-middleware-client.js.map +1 -1
  23. package/dist/client/index.js +1 -1
  24. package/dist/client/next-dev-turbopack.js +1 -1
  25. package/dist/client/next-dev-turbopack.js.map +1 -1
  26. package/dist/client/next-dev.js +1 -1
  27. package/dist/client/next-dev.js.map +1 -1
  28. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +3 -3
  29. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  30. package/dist/compiled/next-server/app-page.runtime.dev.js +3 -3
  31. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  32. package/dist/esm/build/index.js +10 -2
  33. package/dist/esm/build/index.js.map +1 -1
  34. package/dist/esm/build/swc/index.js +1 -1
  35. package/dist/esm/build/webpack-config.js +2 -2
  36. package/dist/esm/client/app-bootstrap.js +1 -1
  37. package/dist/esm/client/components/react-dev-overlay/app/hot-reloader-client.js +10 -33
  38. package/dist/esm/client/components/react-dev-overlay/app/hot-reloader-client.js.map +1 -1
  39. package/dist/esm/client/components/react-dev-overlay/pages/hot-reloader-client.js +14 -40
  40. package/dist/esm/client/components/react-dev-overlay/pages/hot-reloader-client.js.map +1 -1
  41. package/dist/esm/client/components/react-dev-overlay/shared.js +4 -0
  42. package/dist/esm/client/components/react-dev-overlay/shared.js.map +1 -1
  43. package/dist/esm/client/components/react-dev-overlay/utils/report-hmr-latency.js +20 -0
  44. package/dist/esm/client/components/react-dev-overlay/utils/report-hmr-latency.js.map +1 -0
  45. package/dist/esm/client/dev/amp-dev.js +2 -2
  46. package/dist/esm/client/dev/amp-dev.js.map +1 -1
  47. package/dist/esm/client/dev/hot-middleware-client.js +2 -2
  48. package/dist/esm/client/dev/hot-middleware-client.js.map +1 -1
  49. package/dist/esm/client/index.js +1 -1
  50. package/dist/esm/client/next-dev-turbopack.js +1 -1
  51. package/dist/esm/client/next-dev-turbopack.js.map +1 -1
  52. package/dist/esm/client/next-dev.js +1 -1
  53. package/dist/esm/client/next-dev.js.map +1 -1
  54. package/dist/esm/server/config-schema.js +2 -1
  55. package/dist/esm/server/config-schema.js.map +1 -1
  56. package/dist/esm/server/config-shared.js +2 -1
  57. package/dist/esm/server/config-shared.js.map +1 -1
  58. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  59. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  60. package/dist/esm/server/lib/app-info-log.js +1 -1
  61. package/dist/esm/server/lib/router-server.js +1 -1
  62. package/dist/esm/server/lib/router-server.js.map +1 -1
  63. package/dist/esm/server/lib/router-utils/block-cross-site.js +5 -1
  64. package/dist/esm/server/lib/router-utils/block-cross-site.js.map +1 -1
  65. package/dist/esm/server/lib/start-server.js +1 -1
  66. package/dist/esm/shared/lib/canary-only.js +1 -1
  67. package/dist/server/config-schema.js +2 -1
  68. package/dist/server/config-schema.js.map +1 -1
  69. package/dist/server/config-shared.d.ts +2 -1
  70. package/dist/server/config-shared.js +2 -1
  71. package/dist/server/config-shared.js.map +1 -1
  72. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  73. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  74. package/dist/server/lib/app-info-log.js +1 -1
  75. package/dist/server/lib/router-server.js +1 -1
  76. package/dist/server/lib/router-server.js.map +1 -1
  77. package/dist/server/lib/router-utils/block-cross-site.js +5 -1
  78. package/dist/server/lib/router-utils/block-cross-site.js.map +1 -1
  79. package/dist/server/lib/start-server.js +1 -1
  80. package/dist/shared/lib/canary-only.js +1 -1
  81. package/dist/telemetry/anonymous-meta.js +1 -1
  82. package/dist/telemetry/events/session-stopped.js +2 -2
  83. package/dist/telemetry/events/version.js +2 -2
  84. package/package.json +15 -15
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
11
11
  import { getDefineEnv } from '../webpack/plugins/define-env-plugin';
12
12
  import { getReactCompilerLoader } from '../get-babel-loader-config';
13
13
  import { TurbopackInternalError } from '../../shared/lib/turbopack/utils';
14
- const nextVersion = "15.3.0-canary.2";
14
+ const nextVersion = "15.3.0-canary.4";
15
15
  const ArchName = arch();
16
16
  const PlatformName = platform();
17
17
  function infoLog(...args) {
@@ -1527,7 +1527,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1527
1527
  isClient && new CopyFilePlugin({
1528
1528
  // file path to build output of `@next/polyfill-nomodule`
1529
1529
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1530
- cacheKey: "15.3.0-canary.2",
1530
+ cacheKey: "15.3.0-canary.4",
1531
1531
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1532
1532
  minimize: false,
1533
1533
  info: {
@@ -1704,7 +1704,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1704
1704
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1705
1705
  // - Next.js version
1706
1706
  // - next.config.js keys that affect compilation
1707
- version: `${__dirname}|${"15.3.0-canary.2"}|${configVars}`,
1707
+ version: `${__dirname}|${"15.3.0-canary.4"}|${configVars}`,
1708
1708
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1709
1709
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1710
1710
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -3,7 +3,7 @@
3
3
  * sure the following scripts are executed in the correct order:
4
4
  * - Polyfills
5
5
  * - next/script with `beforeInteractive` strategy
6
- */ const version = "15.3.0-canary.2";
6
+ */ const version = "15.3.0-canary.4";
7
7
  window.next = {
8
8
  version,
9
9
  appDir: true
@@ -3,7 +3,7 @@ import { useCallback, useEffect, startTransition, useMemo, useRef, useSyncExtern
3
3
  import stripAnsi from 'next/dist/compiled/strip-ansi';
4
4
  import formatWebpackMessages from '../utils/format-webpack-messages';
5
5
  import { useRouter } from '../../navigation';
6
- import { ACTION_BEFORE_REFRESH, ACTION_BUILD_ERROR, ACTION_BUILD_OK, ACTION_DEBUG_INFO, ACTION_DEV_INDICATOR, ACTION_REFRESH, ACTION_STATIC_INDICATOR, ACTION_UNHANDLED_ERROR, ACTION_UNHANDLED_REJECTION, ACTION_VERSION_INFO, useErrorOverlayReducer } from '../shared';
6
+ import { ACTION_BEFORE_REFRESH, ACTION_BUILD_ERROR, ACTION_BUILD_OK, ACTION_DEBUG_INFO, ACTION_DEV_INDICATOR, ACTION_REFRESH, ACTION_STATIC_INDICATOR, ACTION_UNHANDLED_ERROR, ACTION_UNHANDLED_REJECTION, ACTION_VERSION_INFO, REACT_REFRESH_FULL_RELOAD, reportInvalidHmrMessage, useErrorOverlayReducer } from '../shared';
7
7
  import { parseStack } from '../utils/parse-stack';
8
8
  import { AppDevOverlay } from './app-dev-overlay';
9
9
  import { useErrorHandler } from '../../errors/use-error-handler';
@@ -17,6 +17,7 @@ import { useUntrackedPathname } from '../../navigation-untracked';
17
17
  import { getReactStitchedError } from '../../errors/stitched-error';
18
18
  import { shouldRenderRootLevelErrorOverlay } from '../../../lib/is-error-thrown-while-rendering-rsc';
19
19
  import { handleDevBuildIndicatorHmrEvents } from '../../../dev/dev-build-indicator/internal/handle-dev-build-indicator-hmr-events';
20
+ import reportHmrLatency from '../utils/report-hmr-latency';
20
21
  let mostRecentCompilationHash = null;
21
22
  let __nextDevClientId = Math.round(Math.random() * 100 + Date.now());
22
23
  let reloading = false;
@@ -35,36 +36,12 @@ function setPendingHotUpdateWebpack() {
35
36
  export function waitForWebpackRuntimeHotUpdate() {
36
37
  return pendingHotUpdateWebpack;
37
38
  }
38
- function handleBeforeHotUpdateWebpack(dispatcher, hasUpdates) {
39
- if (hasUpdates) {
40
- dispatcher.onBeforeRefresh();
41
- }
42
- }
43
39
  function handleSuccessfulHotUpdateWebpack(dispatcher, sendMessage, updatedModules) {
44
40
  resolvePendingHotUpdateWebpack();
45
41
  dispatcher.onBuildOk();
46
- reportHmrLatency(sendMessage, updatedModules);
42
+ reportHmrLatency(sendMessage, updatedModules, startLatency, Date.now());
47
43
  dispatcher.onRefresh();
48
44
  }
49
- function reportHmrLatency(sendMessage, updatedModules) {
50
- if (!startLatency) return;
51
- // turbopack has a debounce for the "built" event which we don't want to
52
- // incorrectly show in this number, use the last TURBOPACK_MESSAGE time
53
- let endLatency = turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now();
54
- const latency = endLatency - startLatency;
55
- console.log("[Fast Refresh] done in " + latency + "ms");
56
- sendMessage(JSON.stringify({
57
- event: 'client-hmr-latency',
58
- id: window.__nextDevClientId,
59
- startTime: startLatency,
60
- endTime: endLatency,
61
- page: window.location.pathname,
62
- updatedModules,
63
- // Whether the page (tab) was hidden at the time the event occurred.
64
- // This can impact the accuracy of the event's timing.
65
- isPageHidden: document.visibilityState === 'hidden'
66
- }));
67
- }
68
45
  // There is a newer version of the code available.
69
46
  function handleAvailableHash(hash) {
70
47
  // Update last known compilation hash.
@@ -119,13 +96,13 @@ function tryApplyUpdates(onBeforeUpdate, onHotUpdateSuccess, sendMessage, dispat
119
96
  if (!isUpdateAvailable() || !canApplyUpdates()) {
120
97
  resolvePendingHotUpdateWebpack();
121
98
  dispatcher.onBuildOk();
122
- reportHmrLatency(sendMessage, []);
99
+ reportHmrLatency(sendMessage, [], startLatency, Date.now());
123
100
  return;
124
101
  }
125
102
  function handleApplyUpdates(err, updatedModules) {
126
103
  if (err || RuntimeErrorHandler.hadRuntimeError || !updatedModules) {
127
104
  if (err) {
128
- console.warn('[Fast Refresh] performing full reload\n\n' + "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React rendering tree.\n" + 'You might have a file which exports a React component but also exports a value that is imported by a non-React component file.\n' + 'Consider migrating the non-React component export to a separate file and importing it into both files.\n\n' + 'It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\n' + 'Fast Refresh requires at least one parent function component in your React tree.');
105
+ console.warn(REACT_REFRESH_FULL_RELOAD);
129
106
  } else if (RuntimeErrorHandler.hadRuntimeError) {
130
107
  console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR);
131
108
  }
@@ -201,10 +178,12 @@ function tryApplyUpdates(onBeforeUpdate, onHotUpdateSuccess, sendMessage, dispat
201
178
  dispatcher.onBuildOk();
202
179
  reportHmrLatency(sendMessage, [
203
180
  ...turbopackUpdatedModules
204
- ]);
181
+ ], startLatency, turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now());
205
182
  } else {
206
183
  tryApplyUpdates(function onBeforeHotUpdate(hasUpdates) {
207
- handleBeforeHotUpdateWebpack(dispatcher, hasUpdates);
184
+ if (hasUpdates) {
185
+ dispatcher.onBeforeRefresh();
186
+ }
208
187
  }, function onSuccessfulHotUpdate(webpackUpdatedModules) {
209
188
  // Only dismiss it when we're sure it's a hot update.
210
189
  // Otherwise it would flicker right before the reload.
@@ -290,7 +269,6 @@ function tryApplyUpdates(onBeforeUpdate, onHotUpdateSuccess, sendMessage, dispat
290
269
  clientId: __nextDevClientId
291
270
  }));
292
271
  if (obj.action === HMR_ACTIONS_SENT_TO_BROWSER.BUILT) {
293
- // Handle hot updates
294
272
  handleHotUpdate();
295
273
  }
296
274
  return;
@@ -529,8 +507,7 @@ export default function HotReload(param) {
529
507
  handleDevBuildIndicatorHmrEvents(obj);
530
508
  processMessage(obj, sendMessage, processTurbopackMessage, router, dispatcher, appIsrManifestRef, pathnameRef);
531
509
  } catch (err) {
532
- var _err_stack;
533
- console.warn('[HMR] Invalid message: ' + JSON.stringify(event.data) + '\n' + ((_err_stack = err == null ? void 0 : err.stack) != null ? _err_stack : ''));
510
+ reportInvalidHmrMessage(event, err);
534
511
  }
535
512
  };
536
513
  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":["useCallback","useEffect","startTransition","useMemo","useRef","useSyncExternalStore","stripAnsi","formatWebpackMessages","useRouter","ACTION_BEFORE_REFRESH","ACTION_BUILD_ERROR","ACTION_BUILD_OK","ACTION_DEBUG_INFO","ACTION_DEV_INDICATOR","ACTION_REFRESH","ACTION_STATIC_INDICATOR","ACTION_UNHANDLED_ERROR","ACTION_UNHANDLED_REJECTION","ACTION_VERSION_INFO","useErrorOverlayReducer","parseStack","AppDevOverlay","useErrorHandler","RuntimeErrorHandler","useSendMessage","useTurbopack","useWebsocket","useWebsocketPing","parseComponentStack","HMR_ACTIONS_SENT_TO_BROWSER","extractModulesFromTurbopackMessage","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","useUntrackedPathname","getReactStitchedError","shouldRenderRootLevelErrorOverlay","handleDevBuildIndicatorHmrEvents","mostRecentCompilationHash","__nextDevClientId","Math","round","random","Date","now","reloading","startLatency","turbopackLastUpdateLatency","turbopackUpdatedModules","Set","pendingHotUpdateWebpack","Promise","resolve","resolvePendingHotUpdateWebpack","setPendingHotUpdateWebpack","waitForWebpackRuntimeHotUpdate","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","dependencyChain","undefined","reload","tryApplyUpdates","onBeforeUpdate","onHotUpdateSuccess","handleApplyUpdates","warn","Boolean","length","__NEXT_TEST_MODE","self","__NEXT_HMR_CB","check","then","apply","processMessage","obj","processTurbopackMessage","router","appIsrManifestRef","pathnameRef","handleErrors","errors","formatted","warnings","onBuildError","i","error","handleHotUpdate","onBeforeHotUpdate","onSuccessfulHotUpdate","webpackUpdatedModules","action","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","add","SERVER_COMPONENT_CHANGES","cookie","hmrRefresh","RELOAD_PAGE","ADDED_PAGE","REMOVED_PAGE","SERVER_ERROR","errorJSON","parse","Error","DEV_PAGES_MANIFEST_UPDATE","HotReload","assetPrefix","children","globalError","state","dispatch","staticIndicator","debugInfo","shouldRenderErrorOverlay","handleOnUnhandledError","errorDetails","details","componentStackTrace","_componentStack","componentStack","warning","reason","frames","componentStackFrames","handleOnUnhandledRejection","stitchedError","webSocketRef","appIsrManifest","DOMException","websocket","addEventListener","removeEventListener"],"mappings":";AACA,SACEA,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,oBAAoB,QACf,QAAO;AACd,OAAOC,eAAe,gCAA+B;AACrD,OAAOC,2BAA2B,mCAAkC;AACpE,SAASC,SAAS,QAAQ,mBAAkB;AAC5C,SACEC,qBAAqB,EACrBC,kBAAkB,EAClBC,eAAe,EACfC,iBAAiB,EACjBC,oBAAoB,EACpBC,cAAc,EACdC,uBAAuB,EACvBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,sBAAsB,QACjB,YAAW;AAClB,SAASC,UAAU,QAAQ,uBAAsB;AACjD,SAASC,aAAa,QAAQ,oBAAmB;AACjD,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SACEC,cAAc,EACdC,YAAY,EACZC,YAAY,EACZC,gBAAgB,QACX,yBAAwB;AAC/B,SAASC,mBAAmB,QAAQ,iCAAgC;AAEpE,SAASC,2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O7F,KAAK,YAAZ6F,gBAAgBA,OAAOzF,OAAO;wBAC1C,OAAO,IAAIyF,kBAAkBlB,OAAO;gCACakB;4BAA/CzF,UAAU,YAAYyF,OAAOzF,OAAO,GAAG,OAAQyF,CAAAA,CAAAA,iBAAAA,OAAO7F,KAAK,YAAZ6F,iBAAgB,EAAC;wBAClE,OAAO;4BACLzF,UAAU,2BAA2ByF;wBACvC;wBAEA/H,QAAQ+C,IAAI,CAAC,WAAWT;oBAC1B;gBACF,OAAO;oBACLjD,WAAWyF,iBAAiB,CAAC;gBAC/B;YACF;QACF,GAAG;YAACnE;YAAUtB;SAAW;IAC3B;IAEAtD,UAAU;QACR,MAAMwM,YAAYH,aAAaxD,OAAO;QACtC,IAAI,CAAC2D,WAAW;QAEhB,MAAM3G,UAAU,CAACxB;YACf,IAAI;gBACF,MAAMqD,MAAMvD,KAAK0G,KAAK,CAACxG,MAAMyE,IAAI;gBACjC5G,iCAAiCwF;gBACjCD,eACEC,KACAhE,aACAiE,yBACAC,QACAtE,YACAuE,mBACAC;YAEJ,EAAE,OAAO7B,KAAU;oBAKZA;gBAJLhC,QAAQ+C,IAAI,CACV,4BACE7C,KAAKC,SAAS,CAACC,MAAMyE,IAAI,IACzB,OACC7C,CAAAA,CAAAA,aAAAA,uBAAAA,IAAKE,KAAK,YAAVF,aAAc,EAAC;YAEtB;QACF;QAEAuG,UAAUC,gBAAgB,CAAC,WAAW5G;QACtC,OAAO,IAAM2G,UAAUE,mBAAmB,CAAC,WAAW7G;IACxD,GAAG;QACDnC;QACAkE;QACAyE;QACA/I;QACAqE;QACAE;KACD;IAED,IAAI2D,0BAA0B;QAC5B,qBACE,KAACpK;YAAcgK,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":["useCallback","useEffect","startTransition","useMemo","useRef","useSyncExternalStore","stripAnsi","formatWebpackMessages","useRouter","ACTION_BEFORE_REFRESH","ACTION_BUILD_ERROR","ACTION_BUILD_OK","ACTION_DEBUG_INFO","ACTION_DEV_INDICATOR","ACTION_REFRESH","ACTION_STATIC_INDICATOR","ACTION_UNHANDLED_ERROR","ACTION_UNHANDLED_REJECTION","ACTION_VERSION_INFO","REACT_REFRESH_FULL_RELOAD","reportInvalidHmrMessage","useErrorOverlayReducer","parseStack","AppDevOverlay","useErrorHandler","RuntimeErrorHandler","useSendMessage","useTurbopack","useWebsocket","useWebsocketPing","parseComponentStack","HMR_ACTIONS_SENT_TO_BROWSER","extractModulesFromTurbopackMessage","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","useUntrackedPathname","getReactStitchedError","shouldRenderRootLevelErrorOverlay","handleDevBuildIndicatorHmrEvents","reportHmrLatency","mostRecentCompilationHash","__nextDevClientId","Math","round","random","Date","now","reloading","startLatency","turbopackLastUpdateLatency","turbopackUpdatedModules","Set","pendingHotUpdateWebpack","Promise","resolve","resolvePendingHotUpdateWebpack","setPendingHotUpdateWebpack","waitForWebpackRuntimeHotUpdate","handleSuccessfulHotUpdateWebpack","dispatcher","sendMessage","updatedModules","onBuildOk","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","dependencyChain","undefined","window","location","reload","tryApplyUpdates","onBeforeUpdate","onHotUpdateSuccess","handleApplyUpdates","console","warn","hasUpdates","Boolean","length","__NEXT_TEST_MODE","self","__NEXT_HMR_CB","check","then","apply","processMessage","obj","processTurbopackMessage","router","appIsrManifestRef","pathnameRef","handleErrors","errors","formatted","warnings","onBuildError","i","error","handleHotUpdate","onBeforeHotUpdate","onBeforeRefresh","onSuccessfulHotUpdate","webpackUpdatedModules","action","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","add","SERVER_COMPONENT_CHANGES","document","cookie","hmrRefresh","RELOAD_PAGE","ADDED_PAGE","REMOVED_PAGE","SERVER_ERROR","errorJSON","parse","Error","DEV_PAGES_MANIFEST_UPDATE","HotReload","assetPrefix","children","globalError","state","dispatch","staticIndicator","debugInfo","shouldRenderErrorOverlay","handleOnUnhandledError","errorDetails","details","componentStackTrace","_componentStack","componentStack","warning","reason","frames","componentStackFrames","handleOnUnhandledRejection","stitchedError","webSocketRef","pathname","appIsrManifest","DOMException","websocket","addEventListener","removeEventListener"],"mappings":";AACA,SACEA,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,oBAAoB,QACf,QAAO;AACd,OAAOC,eAAe,gCAA+B;AACrD,OAAOC,2BAA2B,mCAAkC;AACpE,SAASC,SAAS,QAAQ,mBAAkB;AAC5C,SACEC,qBAAqB,EACrBC,kBAAkB,EAClBC,eAAe,EACfC,iBAAiB,EACjBC,oBAAoB,EACpBC,cAAc,EACdC,uBAAuB,EACvBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,yBAAyB,EACzBC,uBAAuB,EACvBC,sBAAsB,QACjB,YAAW;AAClB,SAASC,UAAU,QAAQ,uBAAsB;AACjD,SAASC,aAAa,QAAQ,oBAAmB;AACjD,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SACEC,cAAc,EACdC,YAAY,EACZC,YAAY,EACZC,gBAAgB,QACX,yBAAwB;AAC/B,SAASC,mBAAmB,QAAQ,iCAAgC;AAEpE,SAASC,2BAA2B,QAAQ,4CAA2C;AAKvF,SAASC,kCAAkC,QAAQ,gEAA+D;AAClH,SAASC,oCAAoC,QAAQ,YAAW;AAGhE,SAASC,oBAAoB,QAAQ,6BAA4B;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,iCAAiC,QAAQ,mDAAkD;AACpG,SAASC,gCAAgC,QAAQ,kFA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AAgB,CAAC,WAAWvH;QACtC,OAAO,IAAMsH,UAAUE,mBAAmB,CAAC,WAAWxH;IACxD,GAAG;QACDjB;QACAuD;QACA4E;QACApI;QACAuD;QACAE;KACD;IAED,IAAI8D,0BAA0B;QAC5B,qBACE,KAAC1J;YAAcsJ,OAAOA;YAAOD,aAAaA;sBACvCD;;IAGP;IAEA,OAAOA;AACT"}
@@ -30,14 +30,13 @@ import { addMessageListener, sendMessage } from './websocket';
30
30
  import formatWebpackMessages from '../utils/format-webpack-messages';
31
31
  import { HMR_ACTIONS_SENT_TO_BROWSER } from '../../../../server/dev/hot-reloader-types';
32
32
  import { extractModulesFromTurbopackMessage } from '../../../../server/dev/extract-modules-from-turbopack-message';
33
- import { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from '../shared';
33
+ import { REACT_REFRESH_FULL_RELOAD, REACT_REFRESH_FULL_RELOAD_FROM_ERROR, reportInvalidHmrMessage } from '../shared';
34
34
  import { RuntimeErrorHandler } from '../../errors/runtime-error-handler';
35
+ import reportHmrLatency from '../utils/report-hmr-latency';
35
36
  window.__nextDevClientId = Math.round(Math.random() * 100 + Date.now());
36
37
  let customHmrEventHandler;
37
38
  let turbopackMessageListeners = [];
38
- let MODE = 'webpack';
39
- export default function connect(mode) {
40
- MODE = mode;
39
+ export default function connect() {
41
40
  register();
42
41
  addMessageListener((payload)=>{
43
42
  if (!('action' in payload)) {
@@ -46,8 +45,7 @@ export default function connect(mode) {
46
45
  try {
47
46
  processMessage(payload);
48
47
  } catch (err) {
49
- var _err_stack;
50
- console.warn('[HMR] Invalid message: ' + JSON.stringify(payload) + '\n' + ((_err_stack = err == null ? void 0 : err.stack) != null ? _err_stack : ''));
48
+ reportInvalidHmrMessage(payload, err);
51
49
  }
52
50
  });
53
51
  return {
@@ -83,7 +81,12 @@ function clearOutdatedErrors() {
83
81
  // Successful compilation.
84
82
  function handleSuccess() {
85
83
  clearOutdatedErrors();
86
- if (MODE === 'webpack') {
84
+ if (process.env.TURBOPACK) {
85
+ reportHmrLatency(sendMessage, [
86
+ ...turbopackUpdatedModules
87
+ ], startLatency, turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now());
88
+ onBuildOk();
89
+ } else {
87
90
  const isHotUpdate = !isFirstCompilation || window.__NEXT_DATA__.page !== '/_error' && isUpdateAvailable();
88
91
  isFirstCompilation = false;
89
92
  hasCompileErrors = false;
@@ -91,11 +94,6 @@ function handleSuccess() {
91
94
  if (isHotUpdate) {
92
95
  tryApplyUpdates(onBeforeFastRefresh, onFastRefresh);
93
96
  }
94
- } else {
95
- reportHmrLatency([
96
- ...turbopackUpdatedModules
97
- ]);
98
- onBuildOk();
99
97
  }
100
98
  }
101
99
  // Compilation with warnings (e.g. ESLint).
@@ -172,30 +170,7 @@ function onFastRefresh(updatedModules) {
172
170
  return;
173
171
  }
174
172
  onRefresh();
175
- reportHmrLatency();
176
- }
177
- function reportHmrLatency(updatedModules) {
178
- if (updatedModules === void 0) updatedModules = [];
179
- if (!startLatency) return;
180
- // turbopack has a debounce for the BUILT event which we don't want to
181
- // incorrectly show in this number, use the last TURBOPACK_MESSAGE time
182
- let endLatency = turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now();
183
- const latency = endLatency - startLatency;
184
- console.log("[Fast Refresh] done in " + latency + "ms");
185
- sendMessage(JSON.stringify({
186
- event: 'client-hmr-latency',
187
- id: window.__nextDevClientId,
188
- startTime: startLatency,
189
- endTime: endLatency,
190
- page: window.location.pathname,
191
- updatedModules,
192
- // Whether the page (tab) was hidden at the time the event occurred.
193
- // This can impact the accuracy of the event's timing.
194
- isPageHidden: document.visibilityState === 'hidden'
195
- }));
196
- if (self.__NEXT_HMR_LATENCY_CB) {
197
- self.__NEXT_HMR_LATENCY_CB(latency);
198
- }
173
+ reportHmrLatency(sendMessage, updatedModules, startLatency, turbopackLastUpdateLatency != null ? turbopackLastUpdateLatency : Date.now());
199
174
  }
200
175
  // There is a newer version of the code available.
201
176
  function handleAvailableHash(hash) {
@@ -208,7 +183,7 @@ export function handleStaticIndicator() {
208
183
  const routeInfo = window.next.router.components[window.next.router.pathname];
209
184
  const pageComponent = routeInfo == null ? void 0 : routeInfo.Component;
210
185
  const appComponent = (_window_next_router_components__app = window.next.router.components['/_app']) == null ? void 0 : _window_next_router_components__app.Component;
211
- const isDynamicPage = Boolean(pageComponent == null ? void 0 : pageComponent.getInitialProps) || Boolean(routeInfo.__N_SSP);
186
+ const isDynamicPage = Boolean(pageComponent == null ? void 0 : pageComponent.getInitialProps) || Boolean(routeInfo == null ? void 0 : routeInfo.__N_SSP);
212
187
  const hasAppGetInitialProps = Boolean(appComponent == null ? void 0 : appComponent.getInitialProps) && (appComponent == null ? void 0 : appComponent.getInitialProps) !== (appComponent == null ? void 0 : appComponent.origGetInitialProps);
213
188
  const isPageStatic = window.location.pathname in isrManifest || !isDynamicPage && !hasAppGetInitialProps;
214
189
  onStaticIndicator(isPageStatic);
@@ -218,7 +193,6 @@ export function handleStaticIndicator() {
218
193
  if (!('action' in obj)) {
219
194
  return;
220
195
  }
221
- // Use turbopack message for analytics, (still need built for webpack)
222
196
  switch(obj.action){
223
197
  case HMR_ACTIONS_SENT_TO_BROWSER.ISR_MANIFEST:
224
198
  {
@@ -375,9 +349,9 @@ function tryApplyUpdates(onBeforeHotUpdate, onHotUpdateSuccess) {
375
349
  function handleApplyUpdates(err, updatedModules) {
376
350
  if (err || RuntimeErrorHandler.hadRuntimeError || !updatedModules) {
377
351
  if (err) {
378
- console.warn('[Fast Refresh] performing full reload\n\n' + "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React rendering tree.\n" + 'You might have a file which exports a React component but also exports a value that is imported by a non-React component file.\n' + 'Consider migrating the non-React component export to a separate file and importing it into both files.\n\n' + 'It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\n' + 'Fast Refresh requires at least one parent function component in your React tree.');
352
+ console.warn(REACT_REFRESH_FULL_RELOAD);
379
353
  } else if (RuntimeErrorHandler.hadRuntimeError) {
380
- console.warn('[Fast Refresh] performing full reload because your application had an unrecoverable error');
354
+ console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR);
381
355
  }
382
356
  performFullReload(err);
383
357
  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":["register","onBuildError","onBuildOk","onBeforeRefresh","onRefresh","onVersionInfo","onStaticIndicator","onDevIndicator","stripAnsi","addMessageListener","sendMessage","formatWebpackMessages","HMR_ACTIONS_SENT_TO_BROWSER","extractModulesFromTurbopackMessage","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","RuntimeErrorHandler","window","__nextDevClientId","Math","round","random","Date","now","customHmrEventHandler","turbopackMessageListeners","MODE","connect","mode","payload","processMessage","err","console","warn","JSON","stringify","stack","subscribeToHmrEvent","handler","onUnrecoverableError","hadRuntimeError","addTurbopackMessageListener","cb","push","sendTurbopackMessage","msg","handleUpdateError","performFullReload","isFirstCompilation","mostRecentCompilationHash","hasCompileErrors","clearOutdatedErrors","clear","handleSuccess","isHotUpdate","__NEXT_DATA__","page","isUpdateAvailable","tryApplyUpdates","onBeforeFastRefresh","onFastRefresh","reportHmrLatency","turbopackUpdatedModules","handleWarnings","warnings","printWarnings","formatted","errors","i","length","handleErrors","error","process","env","__NEXT_TEST_MODE","self","__NEXT_HMR_CB","startLatency","turbopackLastUpdateLatency","Set","isrManifest","updatedModules","endLatency","latency","log","event","id","startTime","endTime","location","pathname","isPageHidden","document","visibilityState","__NEXT_HMR_LATENCY_CB","handleAvailableHash","hash","handleStaticIndicator","__NEXT_DEV_INDICATOR","routeInfo","next","router","components","pageComponent","Component","appComponent","isDynamicPage","Boolean","getInitialProps","__N_SSP","hasAppGetInitialProps","origGetInitialProps","isPageStatic","obj","action","ISR_MANIFEST","data","BUILDING","BUILT","SYNC","versionInfo","devIndicator","hasErrors","errorCount","clientId","hasWarnings","warningCount","SERVER_COMPONENT_CHANGES","reload","SERVER_ERROR","errorJSON","message","parse","Error","TURBOPACK_CONNECTED","listener","type","TURBOPACK_MESSAGE","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;AAE3G,SACEA,QAAQ,EACRC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,SAAS,EACTC,aAAa,EACbC,iBAAiB,EACjBC,cAAc,QACT,WAAU;AACjB,OAAOC,eAAe,gCAA+B;AACrD,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,cAAa;AAC7D,OAAOC,2BAA2B,mCAAkC;AACpE,SAASC,2BAA2B,QAAQ,4CAA2C;AAKvF,SAASC,kCAAkC,QAAQ,gEAA+D;AAClH,SAASC,oCAAoC,QAAQ,YAAW;AAChE,SAASC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AAIK,KAAK,IAAIL,IAAIK,KAAK,CAACwH,KAAK,CAAC,MAAMC,KAAK,CAAC,GAAG,GAAGC,IAAI,CAAC,SACpD/H,IAAIoG,OAAO,IACXpG,MAAM,EAAC;IAEXpB,YACEuB,KAAKC,SAAS,CAAC;QACbkD,OAAO;QACPsE;QACAnH,iBAAiB,CAAC,CAACxB,oBAAoBwB,eAAe;QACtDuH,iBAAiBhI,MAAMA,IAAIgI,eAAe,GAAGR;IAC/C;IAGFtI,OAAOwE,QAAQ,CAACuC,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":["register","onBuildError","onBuildOk","onBeforeRefresh","onRefresh","onVersionInfo","onStaticIndicator","onDevIndicator","stripAnsi","addMessageListener","sendMessage","formatWebpackMessages","HMR_ACTIONS_SENT_TO_BROWSER","extractModulesFromTurbopackMessage","REACT_REFRESH_FULL_RELOAD","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","reportInvalidHmrMessage","RuntimeErrorHandler","reportHmrLatency","window","__nextDevClientId","Math","round","random","Date","now","customHmrEventHandler","turbopackMessageListeners","connect","payload","processMessage","err","subscribeToHmrEvent","handler","onUnrecoverableError","hadRuntimeError","addTurbopackMessageListener","cb","push","sendTurbopackMessage","msg","handleUpdateError","performFullReload","isFirstCompilation","mostRecentCompilationHash","hasCompileErrors","clearOutdatedErrors","console","clear","handleSuccess","process","env","TURBOPACK","turbopackUpdatedModules","startLatency","turbopackLastUpdateLatency","isHotUpdate","__NEXT_DATA__","page","isUpdateAvailable","tryApplyUpdates","onBeforeFastRefresh","onFastRefresh","handleWarnings","warnings","printWarnings","formatted","errors","warn","i","length","handleErrors","error","__NEXT_TEST_MODE","self","__NEXT_HMR_CB","Set","isrManifest","updatedModules","handleAvailableHash","hash","handleStaticIndicator","__NEXT_DEV_INDICATOR","routeInfo","next","router","components","pathname","pageComponent","Component","appComponent","isDynamicPage","Boolean","getInitialProps","__N_SSP","hasAppGetInitialProps","origGetInitialProps","isPageStatic","location","obj","action","ISR_MANIFEST","data","BUILDING","log","BUILT","SYNC","versionInfo","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","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;AAE3G,SACEA,QAAQ,EACRC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,SAAS,EACTC,aAAa,EACbC,iBAAiB,EACjBC,cAAc,QACT,WAAU;AACjB,OAAOC,eAAe,gCAA+B;AACrD,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,cAAa;AAC7D,OAAOC,2BAA2B,mCAAkC;AACpE,SAASC,2BAA2B,QAAQ,4CAA2C;AAKvF,SAASC,kCAAkC,QAAQ,gEAA+D;AAClH,SACEC,yBAAyB,EACzBC,oCAAoC,EACpCC,uBAAuB,QAClB,YAAW;AAClB,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,OAAOC,sBAAsB,8BAA6B;AAiB1DC,OAAOC,iBAAiB,GAAGC,KAAKC,KAAK,CAACD,KAAKE,MAAM,KAAK,MAAMC,KAAKC,GAAG;AAEpE,IAAIC;AACJ,IAAIC,4BAAsE,EAAE;AAC5E,eAAe,SAASC;IACtB5B;IAEAS,mBAAmB,CAACoB;QAClB,IAAI,CAAE,CAAA,YAAYA,OAAM,GAAI;YAC1B;QACF;QAEA,IAAI;YACFC,eAAeD;QACjB,EAAE,OAAOE,KAAc;YACrBf,wBAAwBa,SAASE;QACnC;IACF;IAEA,OAAO;QACLC,qBAAoBC,OAAY;YAC9BP,wBAAwBO;QAC1B;QACAC;YACEjB,oBAAoBkB,eAAe,GAAG;QACx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;IAC3B,GACA,CAAC/C;QACC8G,mBAAmB9G,KAAK;IAC1B;AAEN;AAEA,OAAO,SAASW,kBAAkBX,GAAQ;IACxC,MAAMmH,aACJnH,OACC,CAAA,AAACA,IAAI2F,KAAK,IAAI3F,IAAI2F,KAAK,CAACyB,KAAK,CAAC,MAAMC,KAAK,CAAC,GAAG,GAAGC,IAAI,CAAC,SACpDtH,IAAI0F,OAAO,IACX1F,MAAM,EAAC;IAEXrB,YACEoG,KAAKC,SAAS,CAAC;QACbC,OAAO;QACPkC;QACA/G,iBAAiB,CAAC,CAAClB,oBAAoBkB,eAAe;QACtDmH,iBAAiBvH,MAAMA,IAAIuH,eAAe,GAAGR;IAC/C;IAGF3H,OAAO+E,QAAQ,CAACoB,MAAM;AACxB"}
@@ -163,6 +163,10 @@ export function useErrorOverlayReducer(routerType) {
163
163
  }
164
164
  }, getInitialState(routerType));
165
165
  }
166
+ export const REACT_REFRESH_FULL_RELOAD = '[Fast Refresh] performing full reload\n\n' + "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React rendering tree.\n" + 'You might have a file which exports a React component but also exports a value that is imported by a non-React component file.\n' + 'Consider migrating the non-React component export to a separate file and importing it into both files.\n\n' + 'It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\n' + 'Fast Refresh requires at least one parent function component in your React tree.';
166
167
  export const REACT_REFRESH_FULL_RELOAD_FROM_ERROR = '[Fast Refresh] performing full reload because your application had an unrecoverable error';
168
+ export function reportInvalidHmrMessage(message, err) {
169
+ console.warn('[HMR] Invalid message: ' + JSON.stringify(message) + '\n' + (err instanceof Error && (err == null ? void 0 : err.stack) || ''));
170
+ }
167
171
 
168
172
  //# sourceMappingURL=shared.js.map