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
@@ -14,10 +14,12 @@ Object.defineProperty(exports, "__esModule", {
14
14
  ACTION_UNHANDLED_REJECTION: null,
15
15
  ACTION_VERSION_INFO: null,
16
16
  INITIAL_OVERLAY_STATE: null,
17
+ REACT_REFRESH_FULL_RELOAD: null,
17
18
  REACT_REFRESH_FULL_RELOAD_FROM_ERROR: null,
18
19
  STORAGE_KEY_POSITION: null,
19
20
  STORAGE_KEY_SCALE: null,
20
21
  STORAGE_KEY_THEME: null,
22
+ reportInvalidHmrMessage: null,
21
23
  useErrorOverlayReducer: null
22
24
  });
23
25
  function _export(target, all) {
@@ -60,6 +62,9 @@ _export(exports, {
60
62
  INITIAL_OVERLAY_STATE: function() {
61
63
  return INITIAL_OVERLAY_STATE;
62
64
  },
65
+ REACT_REFRESH_FULL_RELOAD: function() {
66
+ return REACT_REFRESH_FULL_RELOAD;
67
+ },
63
68
  REACT_REFRESH_FULL_RELOAD_FROM_ERROR: function() {
64
69
  return REACT_REFRESH_FULL_RELOAD_FROM_ERROR;
65
70
  },
@@ -72,6 +77,9 @@ _export(exports, {
72
77
  STORAGE_KEY_THEME: function() {
73
78
  return STORAGE_KEY_THEME;
74
79
  },
80
+ reportInvalidHmrMessage: function() {
81
+ return reportInvalidHmrMessage;
82
+ },
75
83
  useErrorOverlayReducer: function() {
76
84
  return useErrorOverlayReducer;
77
85
  }
@@ -241,7 +249,11 @@ function useErrorOverlayReducer(routerType) {
241
249
  }
242
250
  }, getInitialState(routerType));
243
251
  }
252
+ 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.';
244
253
  const REACT_REFRESH_FULL_RELOAD_FROM_ERROR = '[Fast Refresh] performing full reload because your application had an unrecoverable error';
254
+ function reportInvalidHmrMessage(message, err) {
255
+ console.warn('[HMR] Invalid message: ' + JSON.stringify(message) + '\n' + (err instanceof Error && (err == null ? void 0 : err.stack) || ''));
256
+ }
245
257
 
246
258
  if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
247
259
  Object.defineProperty(exports.default, '__esModule', { value: true });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/client/components/react-dev-overlay/shared.ts"],"sourcesContent":["import { useReducer } from 'react'\n\nimport type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\nimport type { VersionInfo } from '../../../server/dev/parse-version-info'\nimport type { SupportedErrorEvent } from './ui/container/runtime-error/render-error'\nimport type { ComponentStackFrame } from './utils/parse-component-stack'\nimport type { DebugInfo } from './types'\nimport type { DevIndicatorServerState } from '../../../server/dev/dev-indicator-server-state'\n\ntype FastRefreshState =\n /** No refresh in progress. */\n | { type: 'idle' }\n /** The refresh process has been triggered, but the new code has not been executed yet. */\n | { type: 'pending'; errors: SupportedErrorEvent[] }\n\nexport interface OverlayState {\n nextId: number\n buildError: string | null\n errors: SupportedErrorEvent[]\n refreshState: FastRefreshState\n rootLayoutMissingTags: typeof window.__next_root_layout_missing_tags\n versionInfo: VersionInfo\n notFound: boolean\n staticIndicator: boolean\n disableDevIndicator: boolean\n debugInfo: DebugInfo\n routerType: 'pages' | 'app'\n}\n\nexport const ACTION_STATIC_INDICATOR = 'static-indicator'\nexport const ACTION_BUILD_OK = 'build-ok'\nexport const ACTION_BUILD_ERROR = 'build-error'\nexport const ACTION_BEFORE_REFRESH = 'before-fast-refresh'\nexport const ACTION_REFRESH = 'fast-refresh'\nexport const ACTION_VERSION_INFO = 'version-info'\nexport const ACTION_UNHANDLED_ERROR = 'unhandled-error'\nexport const ACTION_UNHANDLED_REJECTION = 'unhandled-rejection'\nexport const ACTION_DEBUG_INFO = 'debug-info'\nexport const ACTION_DEV_INDICATOR = 'dev-indicator'\n\nexport const STORAGE_KEY_THEME = '__nextjs-dev-tools-theme'\nexport const STORAGE_KEY_POSITION = '__nextjs-dev-tools-position'\nexport const STORAGE_KEY_SCALE = '__nextjs-dev-tools-scale'\n\ninterface StaticIndicatorAction {\n type: typeof ACTION_STATIC_INDICATOR\n staticIndicator: boolean\n}\n\ninterface BuildOkAction {\n type: typeof ACTION_BUILD_OK\n}\ninterface BuildErrorAction {\n type: typeof ACTION_BUILD_ERROR\n message: string\n}\ninterface BeforeFastRefreshAction {\n type: typeof ACTION_BEFORE_REFRESH\n}\ninterface FastRefreshAction {\n type: typeof ACTION_REFRESH\n}\n\nexport interface UnhandledErrorAction {\n type: typeof ACTION_UNHANDLED_ERROR\n reason: Error\n frames: StackFrame[]\n componentStackFrames?: ComponentStackFrame[]\n warning?: [string, string, string]\n}\nexport interface UnhandledRejectionAction {\n type: typeof ACTION_UNHANDLED_REJECTION\n reason: Error\n frames: StackFrame[]\n}\n\nexport interface DebugInfoAction {\n type: typeof ACTION_DEBUG_INFO\n debugInfo: any\n}\n\ninterface VersionInfoAction {\n type: typeof ACTION_VERSION_INFO\n versionInfo: VersionInfo\n}\n\ninterface DevIndicatorAction {\n type: typeof ACTION_DEV_INDICATOR\n devIndicator: DevIndicatorServerState\n}\n\nexport type BusEvent =\n | BuildOkAction\n | BuildErrorAction\n | BeforeFastRefreshAction\n | FastRefreshAction\n | UnhandledErrorAction\n | UnhandledRejectionAction\n | VersionInfoAction\n | StaticIndicatorAction\n | DebugInfoAction\n | DevIndicatorAction\n\nfunction pushErrorFilterDuplicates(\n errors: SupportedErrorEvent[],\n err: SupportedErrorEvent\n): SupportedErrorEvent[] {\n return [\n ...errors.filter((e) => {\n // Filter out duplicate errors\n return e.event.reason.stack !== err.event.reason.stack\n }),\n err,\n ]\n}\n\nconst shouldDisableDevIndicator =\n process.env.__NEXT_DEV_INDICATOR?.toString() === 'false'\n\nexport const INITIAL_OVERLAY_STATE: Omit<OverlayState, 'routerType'> = {\n nextId: 1,\n buildError: null,\n errors: [],\n notFound: false,\n staticIndicator: false,\n // To prevent flickering, set the initial state to disabled.\n disableDevIndicator: true,\n refreshState: { type: 'idle' },\n rootLayoutMissingTags: [],\n versionInfo: { installed: '0.0.0', staleness: 'unknown' },\n debugInfo: { devtoolsFrontendUrl: undefined },\n}\n\nfunction getInitialState(\n routerType: 'pages' | 'app'\n): OverlayState & { routerType: 'pages' | 'app' } {\n return {\n ...INITIAL_OVERLAY_STATE,\n routerType,\n }\n}\n\nexport function useErrorOverlayReducer(routerType: 'pages' | 'app') {\n return useReducer((_state: OverlayState, action: BusEvent): OverlayState => {\n switch (action.type) {\n case ACTION_DEBUG_INFO: {\n return { ..._state, debugInfo: action.debugInfo }\n }\n case ACTION_STATIC_INDICATOR: {\n return { ..._state, staticIndicator: action.staticIndicator }\n }\n case ACTION_BUILD_OK: {\n return { ..._state, buildError: null }\n }\n case ACTION_BUILD_ERROR: {\n return { ..._state, buildError: action.message }\n }\n case ACTION_BEFORE_REFRESH: {\n return { ..._state, refreshState: { type: 'pending', errors: [] } }\n }\n case ACTION_REFRESH: {\n return {\n ..._state,\n buildError: null,\n errors:\n // Errors can come in during updates. In this case, UNHANDLED_ERROR\n // and UNHANDLED_REJECTION events might be dispatched between the\n // BEFORE_REFRESH and the REFRESH event. We want to keep those errors\n // around until the next refresh. Otherwise we run into a race\n // condition where those errors would be cleared on refresh completion\n // before they can be displayed.\n _state.refreshState.type === 'pending'\n ? _state.refreshState.errors\n : [],\n refreshState: { type: 'idle' },\n }\n }\n case ACTION_UNHANDLED_ERROR:\n case ACTION_UNHANDLED_REJECTION: {\n switch (_state.refreshState.type) {\n case 'idle': {\n return {\n ..._state,\n nextId: _state.nextId + 1,\n errors: pushErrorFilterDuplicates(_state.errors, {\n id: _state.nextId,\n event: action,\n }),\n }\n }\n case 'pending': {\n return {\n ..._state,\n nextId: _state.nextId + 1,\n refreshState: {\n ..._state.refreshState,\n errors: pushErrorFilterDuplicates(_state.refreshState.errors, {\n id: _state.nextId,\n event: action,\n }),\n },\n }\n }\n default:\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = _state.refreshState\n return _state\n }\n }\n case ACTION_VERSION_INFO: {\n return { ..._state, versionInfo: action.versionInfo }\n }\n case ACTION_DEV_INDICATOR: {\n return {\n ..._state,\n disableDevIndicator:\n shouldDisableDevIndicator || !!action.devIndicator.disabledUntil,\n }\n }\n default: {\n return _state\n }\n }\n }, getInitialState(routerType))\n}\n\nexport const REACT_REFRESH_FULL_RELOAD_FROM_ERROR =\n '[Fast Refresh] performing full reload because your application had an unrecoverable error'\n"],"names":["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","INITIAL_OVERLAY_STATE","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","STORAGE_KEY_POSITION","STORAGE_KEY_SCALE","STORAGE_KEY_THEME","useErrorOverlayReducer","process","pushErrorFilterDuplicates","errors","err","filter","e","event","reason","stack","shouldDisableDevIndicator","env","__NEXT_DEV_INDICATOR","toString","nextId","buildError","notFound","staticIndicator","disableDevIndicator","refreshState","type","rootLayoutMissingTags","versionInfo","installed","staleness","debugInfo","devtoolsFrontendUrl","undefined","getInitialState","routerType","useReducer","_state","action","message","id","_","devIndicator","disabledUntil"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCaA,qBAAqB;eAArBA;;IADAC,kBAAkB;eAAlBA;;IADAC,eAAe;eAAfA;;IAOAC,iBAAiB;eAAjBA;;IACAC,oBAAoB;eAApBA;;IALAC,cAAc;eAAdA;;IAJAC,uBAAuB;eAAvBA;;IAMAC,sBAAsB;eAAtBA;;IACAC,0BAA0B;eAA1BA;;IAFAC,mBAAmB;eAAnBA;;IAqFAC,qBAAqB;eAArBA;;IA2GAC,oCAAoC;eAApCA;;IAzLAC,oBAAoB;eAApBA;;IACAC,iBAAiB;eAAjBA;;IAFAC,iBAAiB;eAAjBA;;IAsGGC,sBAAsB;eAAtBA;;;uBA9IW;IAqHzBC;AAxFK,MAAMV,0BAA0B;AAChC,MAAMJ,kBAAkB;AACxB,MAAMD,qBAAqB;AAC3B,MAAMD,wBAAwB;AAC9B,MAAMK,iBAAiB;AACvB,MAAMI,sBAAsB;AAC5B,MAAMF,yBAAyB;AAC/B,MAAMC,6BAA6B;AACnC,MAAML,oBAAoB;AAC1B,MAAMC,uBAAuB;AAE7B,MAAMU,oBAAoB;AAC1B,MAAMF,uBAAuB;AAC7B,MAAMC,oBAAoB;AA6DjC,SAASI,0BACPC,MAA6B,EAC7BC,GAAwB;IAExB,OAAO;WACFD,OA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C;AACrB;AAEO,MAAMjC,uCACX"}
1
+ {"version":3,"sources":["../../../../src/client/components/react-dev-overlay/shared.ts"],"sourcesContent":["import { useReducer } from 'react'\n\nimport type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\nimport type { VersionInfo } from '../../../server/dev/parse-version-info'\nimport type { SupportedErrorEvent } from './ui/container/runtime-error/render-error'\nimport type { ComponentStackFrame } from './utils/parse-component-stack'\nimport type { DebugInfo } from './types'\nimport type { DevIndicatorServerState } from '../../../server/dev/dev-indicator-server-state'\nimport type { HMR_ACTION_TYPES } from '../../../server/dev/hot-reloader-types'\n\ntype FastRefreshState =\n /** No refresh in progress. */\n | { type: 'idle' }\n /** The refresh process has been triggered, but the new code has not been executed yet. */\n | { type: 'pending'; errors: SupportedErrorEvent[] }\n\nexport interface OverlayState {\n nextId: number\n buildError: string | null\n errors: SupportedErrorEvent[]\n refreshState: FastRefreshState\n rootLayoutMissingTags: typeof window.__next_root_layout_missing_tags\n versionInfo: VersionInfo\n notFound: boolean\n staticIndicator: boolean\n disableDevIndicator: boolean\n debugInfo: DebugInfo\n routerType: 'pages' | 'app'\n}\n\nexport const ACTION_STATIC_INDICATOR = 'static-indicator'\nexport const ACTION_BUILD_OK = 'build-ok'\nexport const ACTION_BUILD_ERROR = 'build-error'\nexport const ACTION_BEFORE_REFRESH = 'before-fast-refresh'\nexport const ACTION_REFRESH = 'fast-refresh'\nexport const ACTION_VERSION_INFO = 'version-info'\nexport const ACTION_UNHANDLED_ERROR = 'unhandled-error'\nexport const ACTION_UNHANDLED_REJECTION = 'unhandled-rejection'\nexport const ACTION_DEBUG_INFO = 'debug-info'\nexport const ACTION_DEV_INDICATOR = 'dev-indicator'\n\nexport const STORAGE_KEY_THEME = '__nextjs-dev-tools-theme'\nexport const STORAGE_KEY_POSITION = '__nextjs-dev-tools-position'\nexport const STORAGE_KEY_SCALE = '__nextjs-dev-tools-scale'\n\ninterface StaticIndicatorAction {\n type: typeof ACTION_STATIC_INDICATOR\n staticIndicator: boolean\n}\n\ninterface BuildOkAction {\n type: typeof ACTION_BUILD_OK\n}\ninterface BuildErrorAction {\n type: typeof ACTION_BUILD_ERROR\n message: string\n}\ninterface BeforeFastRefreshAction {\n type: typeof ACTION_BEFORE_REFRESH\n}\ninterface FastRefreshAction {\n type: typeof ACTION_REFRESH\n}\n\nexport interface UnhandledErrorAction {\n type: typeof ACTION_UNHANDLED_ERROR\n reason: Error\n frames: StackFrame[]\n componentStackFrames?: ComponentStackFrame[]\n warning?: [string, string, string]\n}\nexport interface UnhandledRejectionAction {\n type: typeof ACTION_UNHANDLED_REJECTION\n reason: Error\n frames: StackFrame[]\n}\n\nexport interface DebugInfoAction {\n type: typeof ACTION_DEBUG_INFO\n debugInfo: any\n}\n\ninterface VersionInfoAction {\n type: typeof ACTION_VERSION_INFO\n versionInfo: VersionInfo\n}\n\ninterface DevIndicatorAction {\n type: typeof ACTION_DEV_INDICATOR\n devIndicator: DevIndicatorServerState\n}\n\nexport type BusEvent =\n | BuildOkAction\n | BuildErrorAction\n | BeforeFastRefreshAction\n | FastRefreshAction\n | UnhandledErrorAction\n | UnhandledRejectionAction\n | VersionInfoAction\n | StaticIndicatorAction\n | DebugInfoAction\n | DevIndicatorAction\n\nfunction pushErrorFilterDuplicates(\n errors: SupportedErrorEvent[],\n err: SupportedErrorEvent\n): SupportedErrorEvent[] {\n return [\n ...errors.filter((e) => {\n // Filter out duplicate errors\n return e.event.reason.stack !== err.event.reason.stack\n }),\n err,\n ]\n}\n\nconst shouldDisableDevIndicator =\n process.env.__NEXT_DEV_INDICATOR?.toString() === 'false'\n\nexport const INITIAL_OVERLAY_STATE: Omit<OverlayState, 'routerType'> = {\n nextId: 1,\n buildError: null,\n errors: [],\n notFound: false,\n staticIndicator: false,\n // To prevent flickering, set the initial state to disabled.\n disableDevIndicator: true,\n refreshState: { type: 'idle' },\n rootLayoutMissingTags: [],\n versionInfo: { installed: '0.0.0', staleness: 'unknown' },\n debugInfo: { devtoolsFrontendUrl: undefined },\n}\n\nfunction getInitialState(\n routerType: 'pages' | 'app'\n): OverlayState & { routerType: 'pages' | 'app' } {\n return {\n ...INITIAL_OVERLAY_STATE,\n routerType,\n }\n}\n\nexport function useErrorOverlayReducer(routerType: 'pages' | 'app') {\n return useReducer((_state: OverlayState, action: BusEvent): OverlayState => {\n switch (action.type) {\n case ACTION_DEBUG_INFO: {\n return { ..._state, debugInfo: action.debugInfo }\n }\n case ACTION_STATIC_INDICATOR: {\n return { ..._state, staticIndicator: action.staticIndicator }\n }\n case ACTION_BUILD_OK: {\n return { ..._state, buildError: null }\n }\n case ACTION_BUILD_ERROR: {\n return { ..._state, buildError: action.message }\n }\n case ACTION_BEFORE_REFRESH: {\n return { ..._state, refreshState: { type: 'pending', errors: [] } }\n }\n case ACTION_REFRESH: {\n return {\n ..._state,\n buildError: null,\n errors:\n // Errors can come in during updates. In this case, UNHANDLED_ERROR\n // and UNHANDLED_REJECTION events might be dispatched between the\n // BEFORE_REFRESH and the REFRESH event. We want to keep those errors\n // around until the next refresh. Otherwise we run into a race\n // condition where those errors would be cleared on refresh completion\n // before they can be displayed.\n _state.refreshState.type === 'pending'\n ? _state.refreshState.errors\n : [],\n refreshState: { type: 'idle' },\n }\n }\n case ACTION_UNHANDLED_ERROR:\n case ACTION_UNHANDLED_REJECTION: {\n switch (_state.refreshState.type) {\n case 'idle': {\n return {\n ..._state,\n nextId: _state.nextId + 1,\n errors: pushErrorFilterDuplicates(_state.errors, {\n id: _state.nextId,\n event: action,\n }),\n }\n }\n case 'pending': {\n return {\n ..._state,\n nextId: _state.nextId + 1,\n refreshState: {\n ..._state.refreshState,\n errors: pushErrorFilterDuplicates(_state.refreshState.errors, {\n id: _state.nextId,\n event: action,\n }),\n },\n }\n }\n default:\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = _state.refreshState\n return _state\n }\n }\n case ACTION_VERSION_INFO: {\n return { ..._state, versionInfo: action.versionInfo }\n }\n case ACTION_DEV_INDICATOR: {\n return {\n ..._state,\n disableDevIndicator:\n shouldDisableDevIndicator || !!action.devIndicator.disabledUntil,\n }\n }\n default: {\n return _state\n }\n }\n }, getInitialState(routerType))\n}\n\nexport const REACT_REFRESH_FULL_RELOAD =\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\nexport const REACT_REFRESH_FULL_RELOAD_FROM_ERROR =\n '[Fast Refresh] performing full reload because your application had an unrecoverable error'\n\nexport function reportInvalidHmrMessage(\n message: HMR_ACTION_TYPES | MessageEvent<unknown>,\n err: unknown\n) {\n console.warn(\n '[HMR] Invalid message: ' +\n JSON.stringify(message) +\n '\\n' +\n ((err instanceof Error && err?.stack) || '')\n )\n}\n"],"names":["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","INITIAL_OVERLAY_STATE","REACT_REFRESH_FULL_RELOAD","REACT_REFRESH_FULL_RELOAD_FROM_ERROR","STORAGE_KEY_POSITION","STORAGE_KEY_SCALE","STORAGE_KEY_THEME","reportInvalidHmrMessage","useErrorOverlayReducer","process","pushErrorFilterDuplicates","errors","err","filter","e","event","reason","stack","shouldDisableDevIndicator","env","__NEXT_DEV_INDICATOR","toString","nextId","buildError","notFound","staticIndicator","disableDevIndicator","refreshState","type","rootLayoutMissingTags","versionInfo","installed","staleness","debugInfo","devtoolsFrontendUrl","undefined","getInitialState","routerType","useReducer","_state","action","message","id","_","devIndicator","disabledUntil","console","warn","JSON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OAAQwC,OAAOZ,YAAY,CAACC,IAAI;wBAC9B,KAAK;4BAAQ;gCACX,OAAO;oCACL,GAAGW,MAAM;oCACTjB,QAAQiB,OAAOjB,MAAM,GAAG;oCACxBX,QAAQD,0BAA0B6B,OAAO5B,MAAM,EAAE;wCAC/C+B,IAAIH,OAAOjB,MAAM;wCACjBP,OAAOyB;oCACT;gCACF;4BACF;wBACA,KAAK;4BAAW;gCACd,OAAO;oCACL,GAAGD,MAAM;oCACTjB,QAAQiB,OAAOjB,MAAM,GAAG;oCACxBK,cAAc;wCACZ,GAAGY,OAAOZ,YAAY;wCACtBhB,QAAQD,0BAA0B6B,OAAOZ,YAAY,CAAChB,MAAM,EAAE;4CAC5D+B,IAAIH,OAAOjB,MAAM;4CACjBP,OAAOyB;wCACT;oCACF;gCACF;4BACF;wBACA;4BACE,6DAA6D;4BAC7D,MAAMG,IAAWJ,OAAOZ,YAAY;4BACpC,OAAOY;oBACX;gBACF;YACA,KAAKvC;gBAAqB;oBACxB,OAAO;wBAAE,GAAGuC,MAAM;wBAAET,aAAaU,OAAOV,WAAW;oBAAC;gBACtD;YACA,KAAKnC;gBAAsB;oBACzB,OAAO;wBACL,GAAG4C,MAAM;wBACTb,qBACER,6BAA6B,CAAC,CAACsB,OAAOI,YAAY,CAACC,aAAa;oBACpE;gBACF;YACA;gBAAS;oBACP,OAAON;gBACT;QACF;IACF,GAAGH,gBAAgBC;AACrB;AAEO,MAAMnC,4BACX,8CACA,mIACA,qIACA,+GACA,8HACA;AAEK,MAAMC,uCACX;AAEK,SAASI,wBACdkC,OAAiD,EACjD7B,GAAY;IAEZkC,QAAQC,IAAI,CACV,4BACEC,KAAKC,SAAS,CAACR,WACf,OACC,CAAA,AAAC7B,eAAesC,UAAStC,uBAAAA,IAAKK,KAAK,KAAK,EAAC;AAEhD"}
@@ -0,0 +1,6 @@
1
+ declare global {
2
+ interface Window {
3
+ __NEXT_HMR_LATENCY_CB: ((latencyMs: number) => void) | undefined;
4
+ }
5
+ }
6
+ export default function reportHmrLatency(sendMessage: (message: string) => void, updatedModules: ReadonlyArray<string>, startMsSinceEpoch: number, endMsSinceEpoch: number): void;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return reportHmrLatency;
9
+ }
10
+ });
11
+ function reportHmrLatency(sendMessage, updatedModules, startMsSinceEpoch, endMsSinceEpoch) {
12
+ const latencyMs = endMsSinceEpoch - startMsSinceEpoch;
13
+ console.log("[Fast Refresh] done in " + latencyMs + "ms");
14
+ sendMessage(JSON.stringify({
15
+ event: 'client-hmr-latency',
16
+ id: window.__nextDevClientId,
17
+ startTime: startMsSinceEpoch,
18
+ endTime: endMsSinceEpoch,
19
+ page: window.location.pathname,
20
+ updatedModules,
21
+ // Whether the page (tab) was hidden at the time the event occurred.
22
+ // This can impact the accuracy of the event's timing.
23
+ isPageHidden: document.visibilityState === 'hidden'
24
+ }));
25
+ if (self.__NEXT_HMR_LATENCY_CB) {
26
+ self.__NEXT_HMR_LATENCY_CB(latencyMs);
27
+ }
28
+ }
29
+
30
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
31
+ Object.defineProperty(exports.default, '__esModule', { value: true });
32
+ Object.assign(exports.default, exports);
33
+ module.exports = exports.default;
34
+ }
35
+
36
+ //# sourceMappingURL=report-hmr-latency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/utils/report-hmr-latency.ts"],"sourcesContent":["declare global {\n interface Window {\n __NEXT_HMR_LATENCY_CB: ((latencyMs: number) => void) | undefined\n }\n}\n\nexport default function reportHmrLatency(\n sendMessage: (message: string) => void,\n updatedModules: ReadonlyArray<string>,\n startMsSinceEpoch: number,\n endMsSinceEpoch: number\n) {\n const latencyMs = endMsSinceEpoch - startMsSinceEpoch\n console.log(`[Fast Refresh] done in ${latencyMs}ms`)\n sendMessage(\n JSON.stringify({\n event: 'client-hmr-latency',\n id: window.__nextDevClientId,\n startTime: startMsSinceEpoch,\n endTime: endMsSinceEpoch,\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(latencyMs)\n }\n}\n"],"names":["reportHmrLatency","sendMessage","updatedModules","startMsSinceEpoch","endMsSinceEpoch","latencyMs","console","log","JSON","stringify","event","id","window","__nextDevClientId","startTime","endTime","page","location","pathname","isPageHidden","document","visibilityState","self","__NEXT_HMR_LATENCY_CB"],"mappings":";;;;+BAMA;;;eAAwBA;;;AAAT,SAASA,iBACtBC,WAAsC,EACtCC,cAAqC,EACrCC,iBAAyB,EACzBC,eAAuB;IAEvB,MAAMC,YAAYD,kBAAkBD;IACpCG,QAAQC,GAAG,CAAC,AAAC,4BAAyBF,YAAU;IAChDJ,YACEO,KAAKC,SAAS,CAAC;QACbC,OAAO;QACPC,IAAIC,OAAOC,iBAAiB;QAC5BC,WAAWX;QACXY,SAASX;QACTY,MAAMJ,OAAOK,QAAQ,CAACC,QAAQ;QAC9BhB;QACA,oEAAoE;QACpE,sDAAsD;QACtDiB,cAAcC,SAASC,eAAe,KAAK;IAC7C;IAEF,IAAIC,KAAKC,qBAAqB,EAAE;QAC9BD,KAAKC,qBAAqB,CAAClB;IAC7B;AACF"}
@@ -7,6 +7,7 @@ const _fouc = require("./fouc");
7
7
  const _ondemandentriesclient = /*#__PURE__*/ _interop_require_default._(require("./on-demand-entries-client"));
8
8
  const _websocket = require("../components/react-dev-overlay/pages/websocket");
9
9
  const _hotreloadertypes = require("../../server/dev/hot-reloader-types");
10
+ const _shared = require("../components/react-dev-overlay/shared");
10
11
  const data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent);
11
12
  window.__NEXT_DATA__ = data;
12
13
  let { assetPrefix, page } = data;
@@ -68,8 +69,7 @@ async function tryApplyUpdates() {
68
69
  window.location.reload();
69
70
  }
70
71
  } catch (err) {
71
- var _err_stack;
72
- console.warn('[HMR] Invalid message: ' + JSON.stringify(message) + '\n' + ((_err_stack = err == null ? void 0 : err.stack) != null ? _err_stack : ''));
72
+ (0, _shared.reportInvalidHmrMessage)(message, err);
73
73
  }
74
74
  });
75
75
  (0, _websocket.connectHMR)({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/dev/amp-dev.ts"],"sourcesContent":["/* globals __webpack_hash__ */\nimport { displayContent } from './fouc'\nimport initOnDemandEntries from './on-demand-entries-client'\nimport {\n addMessageListener,\n connectHMR,\n} from '../components/react-dev-overlay/pages/websocket'\nimport { HMR_ACTIONS_SENT_TO_BROWSER } from '../../server/dev/hot-reloader-types'\n\ndeclare global {\n const __webpack_runtime_id__: string\n}\n\nconst data = JSON.parse(\n (document.getElementById('__NEXT_DATA__') as any).textContent\n)\nwindow.__NEXT_DATA__ = data\n\nlet { assetPrefix, page } = data\nassetPrefix = assetPrefix || ''\nlet mostRecentHash: null | string = null\n/* eslint-disable-next-line */\nlet curHash = __webpack_hash__\nconst hotUpdatePath =\n assetPrefix + (assetPrefix.endsWith('/') ? '' : '/') + '_next/static/webpack/'\n\n// Is there a newer version of this code available?\nfunction isUpdateAvailable() {\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n /* eslint-disable-next-line */\n return mostRecentHash !== __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}\n\n// This function reads code updates on the fly and hard\n// reloads the page when it has changed.\nasync function tryApplyUpdates() {\n if (!isUpdateAvailable() || !canApplyUpdates()) {\n return\n }\n try {\n const res = await fetch(\n typeof __webpack_runtime_id__ !== 'undefined'\n ? // eslint-disable-next-line no-undef\n `${hotUpdatePath}${curHash}.${__webpack_runtime_id__}.hot-update.json`\n : `${hotUpdatePath}${curHash}.hot-update.json`\n )\n const jsonData = await res.json()\n const curPage = page === '/' ? 'index' : page\n // webpack 5 uses an array instead\n const pageUpdated = (\n Array.isArray(jsonData.c) ? jsonData.c : Object.keys(jsonData.c)\n ).some((mod: string) => {\n return (\n mod.indexOf(\n `pages${curPage.startsWith('/') ? curPage : `/${curPage}`}`\n ) !== -1 ||\n mod.indexOf(\n `pages${curPage.startsWith('/') ? curPage : `/${curPage}`}`.replace(\n /\\//g,\n '\\\\'\n )\n ) !== -1\n )\n })\n\n if (pageUpdated) {\n window.location.reload()\n } else {\n curHash = mostRecentHash as string\n }\n } catch (err) {\n console.error('Error occurred checking for update', err)\n window.location.reload()\n }\n}\n\naddMessageListener((message) => {\n if (!('action' in message)) {\n return\n }\n\n try {\n // actions which are not related to amp-dev\n if (\n message.action === HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR ||\n message.action === HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE\n ) {\n return\n }\n if (\n message.action === HMR_ACTIONS_SENT_TO_BROWSER.SYNC ||\n message.action === HMR_ACTIONS_SENT_TO_BROWSER.BUILT\n ) {\n if (!message.hash) {\n return\n }\n mostRecentHash = message.hash\n tryApplyUpdates()\n } else if (message.action === HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE) {\n window.location.reload()\n }\n } catch (err: any) {\n console.warn(\n '[HMR] Invalid message: ' +\n JSON.stringify(message) +\n '\\n' +\n (err?.stack ?? '')\n )\n }\n})\n\nconnectHMR({\n assetPrefix,\n path: '/_next/webpack-hmr',\n})\ndisplayContent()\n\ninitOnDemandEntries(data.page)\n"],"names":["data","JSON","parse","document","getElementById","textContent","window","__NEXT_DATA__","assetPrefix","page","mostRecentHash","curHash","__webpack_hash__","hotUpdatePath","endsWith","isUpdateAvailable","canApplyUpdates","module","hot","status","tryApplyUpdates","res","fetch","__webpack_runtime_id__","jsonData","json","curPage","pageUpdated","Array","isArray","c","Object","keys","some","mod","indexOf","startsWith","replace","location","reload","err","console","error","addMessageListener","message","action","HMR_ACTIONS_SENT_TO_BROWSER","SERVER_ERROR","DEV_PAGES_MANIFEST_UPDATE","SYNC","BUILT","hash","RELOAD_PAGE","warn","stringify","stack","connectHMR","path","displayContent","initOnDemandEntries"],"mappings":"AAAA,4BAA4B;;;;;sBACG;gFACC;2BAIzB;kCACqC;AAM5C,MAAMA,OAAOC,KAAKC,KAAK,CACrB,AAACC,SAASC,cAAc,CAAC,iBAAyBC,WAAW;AAE/DC,OAAOC,aAAa,GAAGP;AAEvB,IAAI,EAAEQ,WAAW,EAAEC,IAAI,EAAE,GAAGT;AAC5BQ,cAAcA,eAAe;AAC7B,IAAIE,iBAAgC;AACpC,4BAA4B,GAC5B,IAAIC,UAAUC;AACd,MAAMC,gBACJL,cAAeA,CAAAA,YAAYM,QAAQ,CAAC,OAAO,KAAK,GAAE,IAAK;AAEzD,mDAAmD;AACnD,SAASC;IACP,2DAA2D;IAC3D,8CAA8C;IAC9C,4BAA4B,GAC5B,OAAOL,mBAAmBE;AAC5B;AAEA,6CAA6C;AAC7C,SAASI;IACP,yIAAyI;IACzI,OAAOC,OAAOC,GAAG,CAACC,MAAM,OAAO;AACjC;AAEA,uDAAuD;AACvD,wCAAwC;AACxC,eAAeC;IACb,IAAI,CAACL,uBAAuB,CAACC,mBAAmB;QAC9C;IACF;IACA,IAAI;QACF,MAAMK,MAAM,MAAMC,MAChB,OAAOC,2BAA2B,cAE9B,AAAC,KAAEV,gBAAgBF,UAAQ,MAAGY,yBAAuB,qBACrD,AAAC,KAAEV,gBAAgBF,UAAQ;QAEjC,MAAMa,WAAW,MAAMH,IAAII,IAAI;QAC/B,MAAMC,UAAUjB,SAAS,MAAM,UAAUA;QACzC,kCAAkC;QAClC,MAAMkB,cAAc,AAClBC,CAAAA,MAAMC,OAAO,CAACL,SA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AKe,KAAK,YAAVf,aAAc,EAAC;IAEtB;AACF;AAEAgB,IAAAA,qBAAU,EAAC;IACThD;IACAiD,MAAM;AACR;AACAC,IAAAA,oBAAc;AAEdC,IAAAA,8BAAmB,EAAC3D,KAAKS,IAAI"}
1
+ {"version":3,"sources":["../../../src/client/dev/amp-dev.ts"],"sourcesContent":["/* globals __webpack_hash__ */\nimport { displayContent } from './fouc'\nimport initOnDemandEntries from './on-demand-entries-client'\nimport {\n addMessageListener,\n connectHMR,\n} from '../components/react-dev-overlay/pages/websocket'\nimport { HMR_ACTIONS_SENT_TO_BROWSER } from '../../server/dev/hot-reloader-types'\nimport { reportInvalidHmrMessage } from '../components/react-dev-overlay/shared'\n\ndeclare global {\n const __webpack_runtime_id__: string\n}\n\nconst data = JSON.parse(\n (document.getElementById('__NEXT_DATA__') as any).textContent\n)\nwindow.__NEXT_DATA__ = data\n\nlet { assetPrefix, page } = data\nassetPrefix = assetPrefix || ''\nlet mostRecentHash: null | string = null\n/* eslint-disable-next-line */\nlet curHash = __webpack_hash__\nconst hotUpdatePath =\n assetPrefix + (assetPrefix.endsWith('/') ? '' : '/') + '_next/static/webpack/'\n\n// Is there a newer version of this code available?\nfunction isUpdateAvailable() {\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n /* eslint-disable-next-line */\n return mostRecentHash !== __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}\n\n// This function reads code updates on the fly and hard\n// reloads the page when it has changed.\nasync function tryApplyUpdates() {\n if (!isUpdateAvailable() || !canApplyUpdates()) {\n return\n }\n try {\n const res = await fetch(\n typeof __webpack_runtime_id__ !== 'undefined'\n ? // eslint-disable-next-line no-undef\n `${hotUpdatePath}${curHash}.${__webpack_runtime_id__}.hot-update.json`\n : `${hotUpdatePath}${curHash}.hot-update.json`\n )\n const jsonData = await res.json()\n const curPage = page === '/' ? 'index' : page\n // webpack 5 uses an array instead\n const pageUpdated = (\n Array.isArray(jsonData.c) ? jsonData.c : Object.keys(jsonData.c)\n ).some((mod: string) => {\n return (\n mod.indexOf(\n `pages${curPage.startsWith('/') ? curPage : `/${curPage}`}`\n ) !== -1 ||\n mod.indexOf(\n `pages${curPage.startsWith('/') ? curPage : `/${curPage}`}`.replace(\n /\\//g,\n '\\\\'\n )\n ) !== -1\n )\n })\n\n if (pageUpdated) {\n window.location.reload()\n } else {\n curHash = mostRecentHash as string\n }\n } catch (err) {\n console.error('Error occurred checking for update', err)\n window.location.reload()\n }\n}\n\naddMessageListener((message) => {\n if (!('action' in message)) {\n return\n }\n\n try {\n // actions which are not related to amp-dev\n if (\n message.action === HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR ||\n message.action === HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE\n ) {\n return\n }\n if (\n message.action === HMR_ACTIONS_SENT_TO_BROWSER.SYNC ||\n message.action === HMR_ACTIONS_SENT_TO_BROWSER.BUILT\n ) {\n if (!message.hash) {\n return\n }\n mostRecentHash = message.hash\n tryApplyUpdates()\n } else if (message.action === HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE) {\n window.location.reload()\n }\n } catch (err: unknown) {\n reportInvalidHmrMessage(message, err)\n }\n})\n\nconnectHMR({\n assetPrefix,\n path: '/_next/webpack-hmr',\n})\ndisplayContent()\n\ninitOnDemandEntries(data.page)\n"],"names":["data","JSON","parse","document","getElementById","textContent","window","__NEXT_DATA__","assetPrefix","page","mostRecentHash","curHash","__webpack_hash__","hotUpdatePath","endsWith","isUpdateAvailable","canApplyUpdates","module","hot","status","tryApplyUpdates","res","fetch","__webpack_runtime_id__","jsonData","json","curPage","pageUpdated","Array","isArray","c","Object","keys","some","mod","indexOf","startsWith","replace","location","reload","err","console","error","addMessageListener","message","action","HMR_ACTIONS_SENT_TO_BROWSER","SERVER_ERROR","DEV_PAGES_MANIFEST_UPDATE","SYNC","BUILT","hash","RELOAD_PAGE","reportInvalidHmrMessage","connectHMR","path","displayContent","initOnDemandEntries"],"mappings":"AAAA,4BAA4B;;;;;sBACG;gFACC;2BAIzB;kCACqC;wBACJ;AAMxC,MAAMA,OAAOC,KAAKC,KAAK,CACrB,AAACC,SAASC,cAAc,CAAC,iBAAyBC,WAAW;AAE/DC,OAAOC,aAAa,GAAGP;AAEvB,IAAI,EAAEQ,WAAW,EAAEC,IAAI,EAAE,GAAGT;AAC5BQ,cAAcA,eAAe;AAC7B,IAAIE,iBAAgC;AACpC,4BAA4B,GAC5B,IAAIC,UAAUC;AACd,MAAMC,gBACJL,cAAeA,CAAAA,YAAYM,QAAQ,CAAC,OAAO,KAAK,GAAE,IAAK;AAEzD,mDAAmD;AACnD,SAASC;IACP,2DAA2D;IAC3D,8CAA8C;IAC9C,4BAA4B,GAC5B,OAAOL,mBAAmBE;AAC5B;AAEA,6CAA6C;AAC7C,SAASI;IACP,yIAAyI;IACzI,OAAOC,OAAOC,GAAG,CAACC,MAAM,OAAO;AACjC;AAEA,uDAAuD;AACvD,wCAAwC;AACxC,eAAeC;IACb,IAAI,CAACL,uBAAuB,CAACC,mBAAmB;QAC9C;IACF;IACA,IAAI;QACF,MAAMK,MAAM,MAAMC,MAChB,OAAOC,2BAA2B,cAE9B,AAAC,KAAEV,gBAAgBF,UAAQ,MAAGY,yBAAuB,qBACrD,AAAC,KAAEV,gBAAgBF,UAAQ;QAEjC,MAAMa,WAAW,MAAMH,IAAII,IAAI;QAC/B,MAAMC,UAAUjB,SAAS,MAAM,UAAUA;QACzC,kCAAkC;QAClC,MAAMkB,cAAc,AAClBC,CAAAA,MAAMC,OAAO,CAACL,SAASM,CAAC,IAAIN,SAASM,CAAC,GAAGC,OAAOC,IAAI,CAACR,SAASM,CAAC,CAAA,EAC/DG,IAAI,CAAC,CAACC;YACN,OACEA,IAAIC,OAAO,CACT,AAAC,UAAOT,CAAAA,QAAQU,UAAU,CAAC,OAAOV,UAAU,AAAC,MAAGA,OAAQ,OACpD,CAAC,KACPQ,IAAIC,OAAO,CACT,CAAA,AAAC,UAAOT,CAAAA,QAAQU,UAAU,CAAC,OAAOV,UAAU,AAAC,MAAGA,OAAQ,CAAE,EAAEW,OAAO,CACjE,OACA,WAEE,CAAC;QAEX;QAEA,IAAIV,aAAa;YACfrB,OAAOgC,QAAQ,CAACC,MAAM;QACxB,OAAO;YACL5B,UAAUD;QACZ;IACF,EAAE,OAAO8B,KAAK;QACZC,QAAQC,KAAK,CAAC,sCAAsCF;QACpDlC,OAAOgC,QAAQ,CAACC,MAAM;IACxB;AACF;AAEAI,IAAAA,6BAAkB,EAAC,CAACC;IAClB,IAAI,CAAE,CAAA,YAAYA,OAAM,GAAI;QAC1B;IACF;IAEA,IAAI;QACF,2CAA2C;QAC3C,IACEA,QAAQC,MAAM,KAAKC,6CAA2B,CAACC,YAAY,IAC3DH,QAAQC,MAAM,KAAKC,6CAA2B,CAACE,yBAAyB,EACxE;YACA;QACF;QACA,IACEJ,QAAQC,MAAM,KAAKC,6CAA2B,CAACG,IAAI,IACnDL,QAAQC,MAAM,KAAKC,6CAA2B,CAACI,KAAK,EACpD;YACA,IAAI,CAACN,QAAQO,IAAI,EAAE;gBACjB;YACF;YACAzC,iBAAiBkC,QAAQO,IAAI;YAC7B/B;QACF,OAAO,IAAIwB,QAAQC,MAAM,KAAKC,6CAA2B,CAACM,WAAW,EAAE;YACrE9C,OAAOgC,QAAQ,CAACC,MAAM;QACxB;IACF,EAAE,OAAOC,KAAc;QACrBa,IAAAA,+BAAuB,EAACT,SAASJ;IACnC;AACF;AAEAc,IAAAA,qBAAU,EAAC;IACT9C;IACA+C,MAAM;AACR;AACAC,IAAAA,oBAAc;AAEdC,IAAAA,8BAAmB,EAACzD,KAAKS,IAAI"}
@@ -1,4 +1,4 @@
1
- declare const _default: (mode: "webpack" | "turbopack") => {
1
+ declare const _default: () => {
2
2
  subscribeToHmrEvent(handler: any): void;
3
3
  onUnrecoverableError(): void;
4
4
  addTurbopackMessageListener(cb: (msg: import("../../server/dev/hot-reloader-types").TurbopackMsgToBrowser) => void): void;
@@ -12,8 +12,8 @@ const _interop_require_default = require("@swc/helpers/_/_interop_require_defaul
12
12
  const _hotreloaderclient = /*#__PURE__*/ _interop_require_default._(require("../components/react-dev-overlay/pages/hot-reloader-client"));
13
13
  const _websocket = require("../components/react-dev-overlay/pages/websocket");
14
14
  let reloading = false;
15
- const _default = (mode)=>{
16
- const devClient = (0, _hotreloaderclient.default)(mode);
15
+ const _default = ()=>{
16
+ const devClient = (0, _hotreloaderclient.default)();
17
17
  devClient.subscribeToHmrEvent((obj)=>{
18
18
  var _window_next;
19
19
  if (reloading) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/dev/hot-middleware-client.ts"],"sourcesContent":["import type {\n NextRouter,\n PrivateRouteInfo,\n} from '../../shared/lib/router/router'\nimport connect from '../components/react-dev-overlay/pages/hot-reloader-client'\nimport { sendMessage } from '../components/react-dev-overlay/pages/websocket'\n\n// Define a local type for the window.next object\ninterface NextWindow {\n next?: {\n router?: NextRouter & {\n components: { [pathname: string]: PrivateRouteInfo }\n }\n }\n __nextDevClientId?: string\n location: Location\n}\n\ndeclare const window: NextWindow\n\nlet reloading = false\n\nexport default (mode: 'webpack' | 'turbopack') => {\n const devClient = connect(mode)\n\n devClient.subscribeToHmrEvent((obj: any) => {\n if (reloading) return\n\n // Retrieve the router if it's available\n const router = window.next?.router\n\n // Determine if we're on an error page or the router is not initialized\n const isOnErrorPage =\n !router || router.pathname === '/404' || router.pathname === '/_error'\n\n switch (obj.action) {\n case 'reloadPage': {\n sendMessage(\n JSON.stringify({\n event: 'client-reload-page',\n clientId: window.__nextDevClientId,\n })\n )\n reloading = true\n return window.location.reload()\n }\n case 'removedPage': {\n const [page] = obj.data\n\n // Check if the removed page is the current page\n const isCurrentPage = page === router?.pathname\n\n // We enter here if the removed page is currently being viewed\n // or if we happen to be on an error page.\n if (isCurrentPage || isOnErrorPage) {\n sendMessage(\n JSON.stringify({\n event: 'client-removed-page',\n clientId: window.__nextDevClientId,\n page,\n })\n )\n return window.location.reload()\n }\n return\n }\n case 'addedPage': {\n const [page] = obj.data\n\n // Check if the added page is the current page\n const isCurrentPage = page === router?.pathname\n\n // Check if the page component is not yet loaded\n const isPageNotLoaded =\n typeof router?.components?.[page] === 'undefined'\n\n // We enter this block if the newly added page is the one currently being viewed\n // but hasn't been loaded yet, or if we're on an error page.\n if ((isCurrentPage && isPageNotLoaded) || isOnErrorPage) {\n sendMessage(\n JSON.stringify({\n event: 'client-added-page',\n clientId: window.__nextDevClientId,\n page,\n })\n )\n return window.location.reload()\n }\n return\n }\n case 'serverError':\n case 'devPagesManifestUpdate':\n case 'isrManifest':\n case 'building':\n case 'finishBuilding': {\n return\n }\n default: {\n throw new Error('Unexpected action ' + obj.action)\n }\n }\n })\n\n return devClient\n}\n"],"names":["reloading","mode","devClient","connect","subscribeToHmrEvent","obj","window","router","next","isOnErrorPage","pathname","action","sendMessage","JSON","stringify","event","clientId","__nextDevClientId","location","reload","page","data","isCurrentPage","isPageNotLoaded","components","Error"],"mappings":";;;;+BAsBA;;;eAAA;;;;4EAlBoB;2BACQ;AAe5B,IAAIA,YAAY;MAEhB,WAAe,CAACC;IACd,MAAMC,YAAYC,IAAAA,0BAAO,EAACF;IAE1BC,UAAUE,mBAAmB,CAAC,CAACC;YAIdC;QAHf,IAAIN,WAAW;QAEf,wCAAwC;QACxC,MAAMO,UAASD,eAAAA,OAAOE,IAAI,qBAAXF,aAAaC,MAAM;QAElC,uEAAuE;QACvE,MAAME,gBACJ,CAACF,UAAUA,OAAOG,QAAQ,KAAK,UAAUH,OAAOG,QAAQ,KAAK;QAE/D,OAAQL,IAAIM,MAAM;YAChB,KAAK;gBAAc;oBACjBC,IAAAA,sBAAW,EACTC,KAAKC,SAAS,CAAC;wBACbC,OAAO;wBACPC,UAAUV,OAAOW,iBAAiB;oBACpC;oBAEFjB,YAAY;oBACZ,OAAOM,OAAOY,QAAQ,CAACC,MAAM;gBAC/B;YACA,KAAK;gBAAe;oBAClB,MAAM,CAACC,KAAK,GAAGf,IAAIgB,IAAI;oBAEvB,gDAAgD;oBAChD,MAAMC,gBAAgBF,UAASb,0BAAAA,OAAQG,QAAQ;oBAE/C,8DAA8D;oBAC9D,0CAA0C;oBAC1C,IAAIY,iBAAiBb,eAAe;wBAClCG,IAAAA,sBAAW,EACTC,KAAKC,SAAS,CAAC;4BACbC,OAAO;4BACPC,UAAUV,OAAOW,iBAAiB;4BAClCG;wBACF;wBAEF,OAAOd,OAAOY,QAAQ,CAACC,MAAM;oBAC/B;oBACA;gBACF;YACA,KAAK;gBAAa;wBAQPZ;oBAPT,MAAM,CAACa,KAAK,GAAGf,IAAIgB,IAAI;oBAEvB,8CAA8C;oBAC9C,MAAMC,gBAAgBF,UAASb,0BAAAA,OAAQG,QAAQ;oBAE/C,gDAAgD;oBAChD,MAAMa,kBACJ,QAAOhB,2BAAAA,qBAAAA,OAAQiB,UAAU,qBAAlBjB,kBAAoB,CAACa,KAAK,MAAK;oBAExC,gFAAgF;oBAChF,4DAA4D;oBAC5D,IAAI,AAACE,iBAAiBC,mBAAoBd,eAAe;wBACvDG,IAAAA,sBAAW,EACTC,KAAKC,SAAS,CAAC;4BACbC,OAAO;4BACPC,UAAUV,OAAOW,iBAAiB;4BAClCG;wBACF;wBAEF,OAAOd,OAAOY,QAAQ,CAACC,MAAM;oBAC/B;oBACA;gBACF;YACA,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;gBAAkB;oBACrB;gBACF;YACA;gBAAS;oBACP,MAAM,qBAA4C,CAA5C,IAAIM,MAAM,uBAAuBpB,IAAIM,MAAM,GAA3C,qBAAA;+BAAA;oCAAA;sCAAA;oBAA2C;gBACnD;QACF;IACF;IAEA,OAAOT;AACT"}
1
+ {"version":3,"sources":["../../../src/client/dev/hot-middleware-client.ts"],"sourcesContent":["import type {\n NextRouter,\n PrivateRouteInfo,\n} from '../../shared/lib/router/router'\nimport connect from '../components/react-dev-overlay/pages/hot-reloader-client'\nimport { sendMessage } from '../components/react-dev-overlay/pages/websocket'\n\n// Define a local type for the window.next object\ninterface NextWindow {\n next?: {\n router?: NextRouter & {\n components: { [pathname: string]: PrivateRouteInfo }\n }\n }\n __nextDevClientId?: string\n location: Location\n}\n\ndeclare const window: NextWindow\n\nlet reloading = false\n\nexport default () => {\n const devClient = connect()\n\n devClient.subscribeToHmrEvent((obj: any) => {\n if (reloading) return\n\n // Retrieve the router if it's available\n const router = window.next?.router\n\n // Determine if we're on an error page or the router is not initialized\n const isOnErrorPage =\n !router || router.pathname === '/404' || router.pathname === '/_error'\n\n switch (obj.action) {\n case 'reloadPage': {\n sendMessage(\n JSON.stringify({\n event: 'client-reload-page',\n clientId: window.__nextDevClientId,\n })\n )\n reloading = true\n return window.location.reload()\n }\n case 'removedPage': {\n const [page] = obj.data\n\n // Check if the removed page is the current page\n const isCurrentPage = page === router?.pathname\n\n // We enter here if the removed page is currently being viewed\n // or if we happen to be on an error page.\n if (isCurrentPage || isOnErrorPage) {\n sendMessage(\n JSON.stringify({\n event: 'client-removed-page',\n clientId: window.__nextDevClientId,\n page,\n })\n )\n return window.location.reload()\n }\n return\n }\n case 'addedPage': {\n const [page] = obj.data\n\n // Check if the added page is the current page\n const isCurrentPage = page === router?.pathname\n\n // Check if the page component is not yet loaded\n const isPageNotLoaded =\n typeof router?.components?.[page] === 'undefined'\n\n // We enter this block if the newly added page is the one currently being viewed\n // but hasn't been loaded yet, or if we're on an error page.\n if ((isCurrentPage && isPageNotLoaded) || isOnErrorPage) {\n sendMessage(\n JSON.stringify({\n event: 'client-added-page',\n clientId: window.__nextDevClientId,\n page,\n })\n )\n return window.location.reload()\n }\n return\n }\n case 'serverError':\n case 'devPagesManifestUpdate':\n case 'isrManifest':\n case 'building':\n case 'finishBuilding': {\n return\n }\n default: {\n throw new Error('Unexpected action ' + obj.action)\n }\n }\n })\n\n return devClient\n}\n"],"names":["reloading","devClient","connect","subscribeToHmrEvent","obj","window","router","next","isOnErrorPage","pathname","action","sendMessage","JSON","stringify","event","clientId","__nextDevClientId","location","reload","page","data","isCurrentPage","isPageNotLoaded","components","Error"],"mappings":";;;;+BAsBA;;;eAAA;;;;4EAlBoB;2BACQ;AAe5B,IAAIA,YAAY;MAEhB,WAAe;IACb,MAAMC,YAAYC,IAAAA,0BAAO;IAEzBD,UAAUE,mBAAmB,CAAC,CAACC;YAIdC;QAHf,IAAIL,WAAW;QAEf,wCAAwC;QACxC,MAAMM,UAASD,eAAAA,OAAOE,IAAI,qBAAXF,aAAaC,MAAM;QAElC,uEAAuE;QACvE,MAAME,gBACJ,CAACF,UAAUA,OAAOG,QAAQ,KAAK,UAAUH,OAAOG,QAAQ,KAAK;QAE/D,OAAQL,IAAIM,MAAM;YAChB,KAAK;gBAAc;oBACjBC,IAAAA,sBAAW,EACTC,KAAKC,SAAS,CAAC;wBACbC,OAAO;wBACPC,UAAUV,OAAOW,iBAAiB;oBACpC;oBAEFhB,YAAY;oBACZ,OAAOK,OAAOY,QAAQ,CAACC,MAAM;gBAC/B;YACA,KAAK;gBAAe;oBAClB,MAAM,CAACC,KAAK,GAAGf,IAAIgB,IAAI;oBAEvB,gDAAgD;oBAChD,MAAMC,gBAAgBF,UAASb,0BAAAA,OAAQG,QAAQ;oBAE/C,8DAA8D;oBAC9D,0CAA0C;oBAC1C,IAAIY,iBAAiBb,eAAe;wBAClCG,IAAAA,sBAAW,EACTC,KAAKC,SAAS,CAAC;4BACbC,OAAO;4BACPC,UAAUV,OAAOW,iBAAiB;4BAClCG;wBACF;wBAEF,OAAOd,OAAOY,QAAQ,CAACC,MAAM;oBAC/B;oBACA;gBACF;YACA,KAAK;gBAAa;wBAQPZ;oBAPT,MAAM,CAACa,KAAK,GAAGf,IAAIgB,IAAI;oBAEvB,8CAA8C;oBAC9C,MAAMC,gBAAgBF,UAASb,0BAAAA,OAAQG,QAAQ;oBAE/C,gDAAgD;oBAChD,MAAMa,kBACJ,QAAOhB,2BAAAA,qBAAAA,OAAQiB,UAAU,qBAAlBjB,kBAAoB,CAACa,KAAK,MAAK;oBAExC,gFAAgF;oBAChF,4DAA4D;oBAC5D,IAAI,AAACE,iBAAiBC,mBAAoBd,eAAe;wBACvDG,IAAAA,sBAAW,EACTC,KAAKC,SAAS,CAAC;4BACbC,OAAO;4BACPC,UAAUV,OAAOW,iBAAiB;4BAClCG;wBACF;wBAEF,OAAOd,OAAOY,QAAQ,CAACC,MAAM;oBAC/B;oBACA;gBACF;YACA,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;gBAAkB;oBACrB;gBACF;YACA;gBAAS;oBACP,MAAM,qBAA4C,CAA5C,IAAIM,MAAM,uBAAuBpB,IAAIM,MAAM,GAA3C,qBAAA;+BAAA;oCAAA;sCAAA;oBAA2C;gBACnD;QACF;IACF;IAEA,OAAOT;AACT"}
@@ -61,7 +61,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
61
61
  const _onrecoverableerror = require("./react-client-callbacks/on-recoverable-error");
62
62
  const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
63
63
  const _isnextroutererror = require("./components/is-next-router-error");
64
- const version = "15.3.0-canary.2";
64
+ const version = "15.3.0-canary.4";
65
65
  let router;
66
66
  const emitter = (0, _mitt.default)();
67
67
  const looseToArray = (input)=>[].slice.call(input);
@@ -18,7 +18,7 @@ window.next = {
18
18
  };
19
19
  self.__next_set_public_path__ = ()=>{};
20
20
  self.__webpack_hash__ = '';
21
- const devClient = (0, _hotmiddlewareclient.default)('turbopack');
21
+ const devClient = (0, _hotmiddlewareclient.default)();
22
22
  (0, _.initialize)({
23
23
  devClient
24
24
  }).then((param)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/next-dev-turbopack.ts"],"sourcesContent":["// TODO: Remove use of `any` type.\nimport { initialize, version, router, emitter } from './'\nimport initHMR from './dev/hot-middleware-client'\n\nimport { pageBootstrap } from './page-bootstrap'\n//@ts-expect-error requires \"moduleResolution\": \"node16\" in tsconfig.json and not .ts extension\nimport { connect } from '@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts'\nimport type { TurbopackMsgToBrowser } from '../server/dev/hot-reloader-types'\n\nwindow.next = {\n version: `${version}-turbo`,\n // router is initialized later so it has to be live-binded\n get router() {\n return router\n },\n emitter,\n}\n;(self as any).__next_set_public_path__ = () => {}\n;(self as any).__webpack_hash__ = ''\n\n// for the page loader\ndeclare let __turbopack_load__: any\n\nconst devClient = initHMR('turbopack')\ninitialize({\n devClient,\n})\n .then(({ assetPrefix }) => {\n // for the page loader\n ;(self as any).__turbopack_load_page_chunks__ = (\n page: string,\n chunksData: any\n ) => {\n const chunkPromises = chunksData.map(__turbopack_load__)\n\n Promise.all(chunkPromises).catch((err) =>\n console.error('failed to load chunks for page ' + page, err)\n )\n }\n\n connect({\n addMessageListener(cb: (msg: TurbopackMsgToBrowser) => void) {\n devClient.addTurbopackMessageListener(cb)\n },\n sendMessage: devClient.sendTurbopackMessage,\n onUpdateError: devClient.handleUpdateError,\n })\n\n return pageBootstrap(assetPrefix)\n })\n .catch((err) => {\n console.error('Error was not caught', err)\n })\n"],"names":["window","next","version","router","emitter","self","__next_set_public_path__","__webpack_hash__","devClient","initHMR","initialize","then","assetPrefix","__turbopack_load_page_chunks__","page","chunksData","chunkPromises","map","__turbopack_load__","Promise","all","catch","err","console","error","connect","addMessageListener","cb","addTurbopackMessageListener","sendMessage","sendTurbopackMessage","onUpdateError","handleUpdateError","pageBootstrap"],"mappings":"AAAA,kCAAkC;;;;;;kBACmB;8EACjC;+BAEU;6BAEN;AAGxBA,OAAOC,IAAI,GAAG;IACZC,SAAS,AAAC,KAAEA,SAAO,GAAC;IACpB,0DAA0D;IAC1D,IAAIC,UAAS;QACX,OAAOA,QAAM;IACf;IACAC,SAAAA,SAAO;AACT;AACEC,KAAaC,wBAAwB,GAAG,KAAO;AAC/CD,KAAaE,gBAAgB,GAAG;AAKlC,MAAMC,YAAYC,IAAAA,4BAAO,EAAC;AAC1BC,IAAAA,YAAU,EAAC;IACTF;AACF,GACGG,IAAI,CAAC;QAAC,EAAEC,WAAW,EAAE;IACpB,sBAAsB;;IACpBP,KAAaQ,8BAA8B,GAAG,CAC9CC,MACAC;QAEA,MAAMC,gBAAgBD,WAAWE,GAAG,CAACC;QAErCC,QAAQC,GAAG,CAACJ,eAAeK,KAAK,CAAC,CAACC,MAChCC,QAAQC,KAAK,CAAC,oCAAoCV,MAAMQ;IAE5D;IAEAG,IAAAA,oBAAO,EAAC;QACNC,oBAAmBC,EAAwC;YACzDnB,UAAUoB,2BAA2B,CAACD;QACxC;QACAE,aAAarB,UAAUsB,oBAAoB;QAC3CC,eAAevB,UAAUwB,iBAAiB;IAC5C;IAEA,OAAOC,IAAAA,4BAAa,EAACrB;AACvB,GACCS,KAAK,CAAC,CAACC;IACNC,QAAQC,KAAK,CAAC,wBAAwBF;AACxC"}
1
+ {"version":3,"sources":["../../src/client/next-dev-turbopack.ts"],"sourcesContent":["// TODO: Remove use of `any` type.\nimport { initialize, version, router, emitter } from './'\nimport initHMR from './dev/hot-middleware-client'\n\nimport { pageBootstrap } from './page-bootstrap'\n//@ts-expect-error requires \"moduleResolution\": \"node16\" in tsconfig.json and not .ts extension\nimport { connect } from '@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts'\nimport type { TurbopackMsgToBrowser } from '../server/dev/hot-reloader-types'\n\nwindow.next = {\n version: `${version}-turbo`,\n // router is initialized later so it has to be live-binded\n get router() {\n return router\n },\n emitter,\n}\n;(self as any).__next_set_public_path__ = () => {}\n;(self as any).__webpack_hash__ = ''\n\n// for the page loader\ndeclare let __turbopack_load__: any\n\nconst devClient = initHMR()\ninitialize({\n devClient,\n})\n .then(({ assetPrefix }) => {\n // for the page loader\n ;(self as any).__turbopack_load_page_chunks__ = (\n page: string,\n chunksData: any\n ) => {\n const chunkPromises = chunksData.map(__turbopack_load__)\n\n Promise.all(chunkPromises).catch((err) =>\n console.error('failed to load chunks for page ' + page, err)\n )\n }\n\n connect({\n addMessageListener(cb: (msg: TurbopackMsgToBrowser) => void) {\n devClient.addTurbopackMessageListener(cb)\n },\n sendMessage: devClient.sendTurbopackMessage,\n onUpdateError: devClient.handleUpdateError,\n })\n\n return pageBootstrap(assetPrefix)\n })\n .catch((err) => {\n console.error('Error was not caught', err)\n })\n"],"names":["window","next","version","router","emitter","self","__next_set_public_path__","__webpack_hash__","devClient","initHMR","initialize","then","assetPrefix","__turbopack_load_page_chunks__","page","chunksData","chunkPromises","map","__turbopack_load__","Promise","all","catch","err","console","error","connect","addMessageListener","cb","addTurbopackMessageListener","sendMessage","sendTurbopackMessage","onUpdateError","handleUpdateError","pageBootstrap"],"mappings":"AAAA,kCAAkC;;;;;;kBACmB;8EACjC;+BAEU;6BAEN;AAGxBA,OAAOC,IAAI,GAAG;IACZC,SAAS,AAAC,KAAEA,SAAO,GAAC;IACpB,0DAA0D;IAC1D,IAAIC,UAAS;QACX,OAAOA,QAAM;IACf;IACAC,SAAAA,SAAO;AACT;AACEC,KAAaC,wBAAwB,GAAG,KAAO;AAC/CD,KAAaE,gBAAgB,GAAG;AAKlC,MAAMC,YAAYC,IAAAA,4BAAO;AACzBC,IAAAA,YAAU,EAAC;IACTF;AACF,GACGG,IAAI,CAAC;QAAC,EAAEC,WAAW,EAAE;IACpB,sBAAsB;;IACpBP,KAAaQ,8BAA8B,GAAG,CAC9CC,MACAC;QAEA,MAAMC,gBAAgBD,WAAWE,GAAG,CAACC;QAErCC,QAAQC,GAAG,CAACJ,eAAeK,KAAK,CAAC,CAACC,MAChCC,QAAQC,KAAK,CAAC,oCAAoCV,MAAMQ;IAE5D;IAEAG,IAAAA,oBAAO,EAAC;QACNC,oBAAmBC,EAAwC;YACzDnB,UAAUoB,2BAA2B,CAACD;QACxC;QACAE,aAAarB,UAAUsB,oBAAoB;QAC3CC,eAAevB,UAAUwB,iBAAiB;IAC5C;IAEA,OAAOC,IAAAA,4BAAa,EAACrB;AACvB,GACCS,KAAK,CAAC,CAACC;IACNC,QAAQC,KAAK,CAAC,wBAAwBF;AACxC"}
@@ -16,7 +16,7 @@ window.next = {
16
16
  },
17
17
  emitter: _.emitter
18
18
  };
19
- const devClient = (0, _hotmiddlewareclient.default)('webpack');
19
+ const devClient = (0, _hotmiddlewareclient.default)();
20
20
  (0, _.initialize)({
21
21
  devClient
22
22
  }).then((param)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/next-dev.ts"],"sourcesContent":["// TODO: Remove use of `any` type.\nimport './webpack'\nimport { initialize, version, router, emitter } from './'\nimport initHMR from './dev/hot-middleware-client'\nimport { pageBootstrap } from './page-bootstrap'\n\nwindow.next = {\n version,\n // router is initialized later so it has to be live-binded\n get router() {\n return router\n },\n emitter,\n}\n\nconst devClient = initHMR('webpack')\ninitialize({ devClient })\n .then(({ assetPrefix }) => {\n return pageBootstrap(assetPrefix)\n })\n .catch((err) => {\n console.error('Error was not caught', err)\n })\n"],"names":["window","next","version","router","emitter","devClient","initHMR","initialize","then","assetPrefix","pageBootstrap","catch","err","console","error"],"mappings":"AAAA,kCAAkC;;;;;;QAC3B;kBAC8C;8EACjC;+BACU;AAE9BA,OAAOC,IAAI,GAAG;IACZC,SAAAA,SAAO;IACP,0DAA0D;IAC1D,IAAIC,UAAS;QACX,OAAOA,QAAM;IACf;IACAC,SAAAA,SAAO;AACT;AAEA,MAAMC,YAAYC,IAAAA,4BAAO,EAAC;AAC1BC,IAAAA,YAAU,EAAC;IAAEF;AAAU,GACpBG,IAAI,CAAC;QAAC,EAAEC,WAAW,EAAE;IACpB,OAAOC,IAAAA,4BAAa,EAACD;AACvB,GACCE,KAAK,CAAC,CAACC;IACNC,QAAQC,KAAK,CAAC,wBAAwBF;AACxC"}
1
+ {"version":3,"sources":["../../src/client/next-dev.ts"],"sourcesContent":["// TODO: Remove use of `any` type.\nimport './webpack'\nimport { initialize, version, router, emitter } from './'\nimport initHMR from './dev/hot-middleware-client'\nimport { pageBootstrap } from './page-bootstrap'\n\nwindow.next = {\n version,\n // router is initialized later so it has to be live-binded\n get router() {\n return router\n },\n emitter,\n}\n\nconst devClient = initHMR()\ninitialize({ devClient })\n .then(({ assetPrefix }) => {\n return pageBootstrap(assetPrefix)\n })\n .catch((err) => {\n console.error('Error was not caught', err)\n })\n"],"names":["window","next","version","router","emitter","devClient","initHMR","initialize","then","assetPrefix","pageBootstrap","catch","err","console","error"],"mappings":"AAAA,kCAAkC;;;;;;QAC3B;kBAC8C;8EACjC;+BACU;AAE9BA,OAAOC,IAAI,GAAG;IACZC,SAAAA,SAAO;IACP,0DAA0D;IAC1D,IAAIC,UAAS;QACX,OAAOA,QAAM;IACf;IACAC,SAAAA,SAAO;AACT;AAEA,MAAMC,YAAYC,IAAAA,4BAAO;AACzBC,IAAAA,YAAU,EAAC;IAAEF;AAAU,GACpBG,IAAI,CAAC;QAAC,EAAEC,WAAW,EAAE;IACpB,OAAOC,IAAAA,4BAAa,EAACD;AACvB,GACCE,KAAK,CAAC,CAACC;IACNC,QAAQC,KAAK,CAAC,wBAAwBF;AACxC"}