next 15.2.0-canary.28 → 15.2.0-canary.29

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.

Potentially problematic release.


This version of next might be problematic. Click here for more details.

Files changed (144) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack/plugins/define-env-plugin.js +2 -1
  5. package/dist/build/webpack/plugins/define-env-plugin.js.map +1 -1
  6. package/dist/build/webpack/plugins/slow-module-detection-plugin.d.ts +12 -0
  7. package/dist/build/webpack/plugins/slow-module-detection-plugin.js +187 -0
  8. package/dist/build/webpack/plugins/slow-module-detection-plugin.js.map +1 -0
  9. package/dist/build/webpack-config.js +19 -4
  10. package/dist/build/webpack-config.js.map +1 -1
  11. package/dist/client/app-bootstrap.js +1 -1
  12. package/dist/client/components/errors/stitched-error.js +3 -3
  13. package/dist/client/components/errors/stitched-error.js.map +1 -1
  14. package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js +3 -3
  15. package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js.map +1 -1
  16. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.d.ts +2 -2
  17. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +273 -144
  18. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
  19. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js +4 -4
  20. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js.map +1 -1
  21. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.d.ts +3 -3
  22. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +9 -14
  23. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js.map +1 -1
  24. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js +1 -1
  25. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js.map +1 -1
  26. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js +1 -3
  27. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js.map +1 -1
  28. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.d.ts +2 -1
  29. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js +2 -2
  30. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js.map +1 -1
  31. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js +2 -1
  32. package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js.map +1 -1
  33. package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.d.ts +1 -4
  34. package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js +2 -3
  35. package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
  36. package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js +111 -86
  37. package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js.map +1 -1
  38. package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.d.ts +4 -3
  39. package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js +8 -2
  40. package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js.map +1 -1
  41. package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.d.ts +14 -0
  42. package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js +49 -0
  43. package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js.map +1 -0
  44. package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js +8 -2
  45. package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
  46. package/dist/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js +3 -3
  47. package/dist/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js.map +1 -1
  48. package/dist/client/components/react-dev-overlay/internal/styles/Base.js +8 -2
  49. package/dist/client/components/react-dev-overlay/internal/styles/Base.js.map +1 -1
  50. package/dist/client/index.js +1 -1
  51. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
  52. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  53. package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
  54. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  55. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +2 -2
  56. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  57. package/dist/compiled/next-server/server.runtime.prod.js +1 -1
  58. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  59. package/dist/esm/build/index.js +2 -2
  60. package/dist/esm/build/swc/index.js +1 -1
  61. package/dist/esm/build/webpack/plugins/define-env-plugin.js +2 -1
  62. package/dist/esm/build/webpack/plugins/define-env-plugin.js.map +1 -1
  63. package/dist/esm/build/webpack/plugins/slow-module-detection-plugin.js +177 -0
  64. package/dist/esm/build/webpack/plugins/slow-module-detection-plugin.js.map +1 -0
  65. package/dist/esm/build/webpack-config.js +19 -4
  66. package/dist/esm/build/webpack-config.js.map +1 -1
  67. package/dist/esm/client/app-bootstrap.js +1 -1
  68. package/dist/esm/client/components/errors/stitched-error.js +3 -3
  69. package/dist/esm/client/components/errors/stitched-error.js.map +1 -1
  70. package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js +3 -3
  71. package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js.map +1 -1
  72. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +274 -146
  73. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
  74. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js +4 -4
  75. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js.map +1 -1
  76. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +9 -15
  77. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js.map +1 -1
  78. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js +1 -1
  79. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js.map +1 -1
  80. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js +1 -3
  81. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js.map +1 -1
  82. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js +2 -2
  83. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js.map +1 -1
  84. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js +2 -1
  85. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js.map +1 -1
  86. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js +2 -3
  87. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
  88. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js +111 -86
  89. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js.map +1 -1
  90. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js +8 -2
  91. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js.map +1 -1
  92. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js +33 -0
  93. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js.map +1 -0
  94. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js +8 -2
  95. package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
  96. package/dist/esm/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js +3 -3
  97. package/dist/esm/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js.map +1 -1
  98. package/dist/esm/client/components/react-dev-overlay/internal/styles/Base.js +8 -2
  99. package/dist/esm/client/components/react-dev-overlay/internal/styles/Base.js.map +1 -1
  100. package/dist/esm/client/index.js +1 -1
  101. package/dist/esm/export/worker.js +9 -1
  102. package/dist/esm/export/worker.js.map +1 -1
  103. package/dist/esm/lib/turbopack-warning.js +2 -1
  104. package/dist/esm/lib/turbopack-warning.js.map +1 -1
  105. package/dist/esm/server/base-server.js +4 -4
  106. package/dist/esm/server/base-server.js.map +1 -1
  107. package/dist/esm/server/config-schema.js +4 -1
  108. package/dist/esm/server/config-schema.js.map +1 -1
  109. package/dist/esm/server/config-shared.js +2 -1
  110. package/dist/esm/server/config-shared.js.map +1 -1
  111. package/dist/esm/server/config.js +1 -1
  112. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  113. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  114. package/dist/esm/server/lib/app-info-log.js +1 -1
  115. package/dist/esm/server/lib/start-server.js +1 -1
  116. package/dist/esm/server/server-utils.js +22 -19
  117. package/dist/esm/server/server-utils.js.map +1 -1
  118. package/dist/esm/server/web-server.js +2 -2
  119. package/dist/esm/server/web-server.js.map +1 -1
  120. package/dist/export/worker.js +9 -1
  121. package/dist/export/worker.js.map +1 -1
  122. package/dist/lib/turbopack-warning.js +2 -1
  123. package/dist/lib/turbopack-warning.js.map +1 -1
  124. package/dist/server/base-server.js +4 -4
  125. package/dist/server/base-server.js.map +1 -1
  126. package/dist/server/config-schema.js +4 -1
  127. package/dist/server/config-schema.js.map +1 -1
  128. package/dist/server/config-shared.d.ts +11 -0
  129. package/dist/server/config-shared.js +2 -1
  130. package/dist/server/config-shared.js.map +1 -1
  131. package/dist/server/config.js +1 -1
  132. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  133. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  134. package/dist/server/lib/app-info-log.js +1 -1
  135. package/dist/server/lib/start-server.js +1 -1
  136. package/dist/server/server-utils.d.ts +4 -4
  137. package/dist/server/server-utils.js +22 -19
  138. package/dist/server/server-utils.js.map +1 -1
  139. package/dist/server/web-server.js +2 -2
  140. package/dist/server/web-server.js.map +1 -1
  141. package/dist/telemetry/anonymous-meta.js +1 -1
  142. package/dist/telemetry/events/session-stopped.js +2 -2
  143. package/dist/telemetry/events/version.js +2 -2
  144. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/container/errors.tsx"],"sourcesContent":["import { useState, useMemo, useEffect } from 'react'\nimport type { DebugInfo } from '../../../types'\nimport { Overlay } from '../components/overlay'\nimport type { ReadyRuntimeError } from '../helpers/get-error-by-type'\nimport { noop as css } from '../helpers/noop-template'\nimport { RuntimeError } from './runtime-error'\nimport type { VersionInfo } from '../../../../../../server/dev/parse-version-info'\nimport { getErrorSource } from '../../../../../../shared/lib/error-source'\nimport { HotlinkedText } from '../components/hot-linked-text'\nimport { PseudoHtmlDiff } from './runtime-error/component-stack-pseudo-html'\nimport {\n type HydrationErrorState,\n getHydrationWarningType,\n} from '../../../../errors/hydration-error-info'\nimport {\n getUnhandledErrorType,\n isUnhandledConsoleOrRejection,\n} from '../../../../errors/console-error'\nimport { extractNextErrorCode } from '../../../../../../lib/error-telemetry-utils'\nimport { ErrorOverlayLayout } from '../components/errors/error-overlay-layout/error-overlay-layout'\nimport type { SupportedErrorEvent } from './runtime-error/use-error-hook'\n\nexport type ErrorsProps = {\n errors: SupportedErrorEvent[]\n readyErrors: ReadyRuntimeError[]\n isTurbopack: boolean\n versionInfo: VersionInfo\n hasStaticIndicator: boolean\n debugInfo: DebugInfo\n onClose: () => void\n}\n\ntype ReadyErrorEvent = ReadyRuntimeError\n\nfunction isNextjsLink(text: string): boolean {\n return text.startsWith('https://nextjs.org')\n}\n\nfunction ErrorDescription({\n error,\n hydrationWarning,\n}: {\n error: Error\n hydrationWarning: string | null\n}) {\n const isUnhandledOrReplayError = isUnhandledConsoleOrRejection(error)\n const unhandledErrorType = isUnhandledOrReplayError\n ? getUnhandledErrorType(error)\n : null\n const isConsoleErrorStringMessage = unhandledErrorType === 'string'\n // If the error is:\n // - hydration warning\n // - captured console error or unhandled rejection\n // skip displaying the error name\n const title =\n (isUnhandledOrReplayError && isConsoleErrorStringMessage) ||\n hydrationWarning\n ? ''\n : error.name + ': '\n\n // If it's replayed error, display the environment name\n const environmentName =\n 'environmentName' in error ? error['environmentName'] : ''\n const envPrefix = environmentName ? `[ ${environmentName} ] ` : ''\n return (\n <>\n {envPrefix}\n {title}\n <HotlinkedText\n text={hydrationWarning || error.message}\n matcher={isNextjsLink}\n />\n </>\n )\n}\n\nexport function Errors({\n errors,\n readyErrors,\n debugInfo,\n versionInfo,\n isTurbopack,\n onClose,\n}: ErrorsProps) {\n useEffect(() => {\n // Close the error overlay when pressing escape\n function handleKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n onClose()\n }\n }\n\n document.addEventListener('keydown', handleKeyDown)\n return () => document.removeEventListener('keydown', handleKeyDown)\n }, [onClose])\n\n const isLoading = useMemo<boolean>(() => {\n return readyErrors.length < 1 && Boolean(errors.length)\n }, [errors.length, readyErrors.length])\n\n const [activeIdx, setActiveIndex] = useState<number>(0)\n\n const activeError = useMemo<ReadyErrorEvent | null>(\n () => readyErrors[activeIdx] ?? null,\n [activeIdx, readyErrors]\n )\n\n if (isLoading) {\n // TODO: better loading state\n return <Overlay />\n }\n\n if (!activeError) {\n return null\n }\n\n const error = activeError.error\n const isServerError = ['server', 'edge-server'].includes(\n getErrorSource(error) || ''\n )\n const isUnhandledError = isUnhandledConsoleOrRejection(error)\n const errorDetails: HydrationErrorState = (error as any).details || {}\n const notes = errorDetails.notes || ''\n const [warningTemplate, serverContent, clientContent] =\n errorDetails.warning || [null, '', '']\n\n const hydrationErrorType = getHydrationWarningType(warningTemplate)\n const hydrationWarning = warningTemplate\n ? warningTemplate\n .replace('%s', serverContent)\n .replace('%s', clientContent)\n .replace('%s', '') // remove the %s for stack\n .replace(/%s$/, '') // If there's still a %s at the end, remove it\n .replace(/^Warning: /, '')\n .replace(/^Error: /, '')\n : null\n\n const errorCode = extractNextErrorCode(error)\n\n const footerMessage = isServerError\n ? 'This error happened while generating the page. Any console logs will be displayed in the terminal window.'\n : undefined\n\n return (\n <ErrorOverlayLayout\n errorCode={errorCode}\n errorType={\n isServerError\n ? 'Runtime Error'\n : isUnhandledError\n ? 'Console Error'\n : 'Unhandled Runtime Error'\n }\n errorMessage={\n <ErrorDescription error={error} hydrationWarning={hydrationWarning} />\n }\n onClose={isServerError ? undefined : onClose}\n debugInfo={debugInfo}\n error={error}\n readyErrors={readyErrors}\n activeIdx={activeIdx}\n setActiveIndex={setActiveIndex}\n footerMessage={footerMessage}\n versionInfo={versionInfo}\n isTurbopack={isTurbopack}\n >\n <div className=\"error-overlay-notes-container\">\n {notes ? (\n <>\n <p\n id=\"nextjs__container_errors__notes\"\n className=\"nextjs__container_errors__notes\"\n >\n {notes}\n </p>\n </>\n ) : null}\n {hydrationWarning ? (\n <p\n id=\"nextjs__container_errors__link\"\n className=\"nextjs__container_errors__link\"\n >\n <HotlinkedText text=\"See more info here: https://nextjs.org/docs/messages/react-hydration-error\" />\n </p>\n ) : null}\n </div>\n\n {hydrationWarning &&\n (activeError.componentStackFrames?.length ||\n !!errorDetails.reactOutputComponentDiff) ? (\n <PseudoHtmlDiff\n className=\"nextjs__container_errors__component-stack\"\n hydrationMismatchType={hydrationErrorType}\n componentStackFrames={activeError.componentStackFrames || []}\n firstContent={serverContent}\n secondContent={clientContent}\n reactOutputComponentDiff={errorDetails.reactOutputComponentDiff}\n />\n ) : null}\n <RuntimeError key={activeError.id.toString()} error={activeError} />\n </ErrorOverlayLayout>\n )\n}\n\nexport const styles = css`\n .nextjs-error-with-static {\n bottom: calc(var(--size-gap-double) * 4.5);\n }\n p.nextjs__container_errors__link {\n color: var(--color-text-color-red-1);\n font-weight: 600;\n font-size: 15px;\n }\n p.nextjs__container_errors__notes {\n color: var(--color-stack-notes);\n font-weight: 600;\n font-size: 15px;\n }\n .nextjs-container-errors-body > h2:not(:first-child) {\n margin-top: calc(var(--size-gap-double) + var(--size-gap));\n }\n .nextjs-container-errors-body > h2 {\n color: var(--color-title-color);\n margin-bottom: var(--size-gap);\n font-size: var(--size-font-big);\n }\n .nextjs-toast-errors-parent {\n cursor: pointer;\n transition: transform 0.2s ease;\n }\n .nextjs-toast-errors-parent:hover {\n transform: scale(1.1);\n }\n .nextjs-toast-errors {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n }\n .nextjs-toast-errors > svg {\n margin-right: var(--size-gap);\n }\n .nextjs-toast-hide-button {\n margin-left: var(--size-gap-triple);\n border: none;\n background: none;\n color: var(--color-ansi-bright-white);\n padding: 0;\n transition: opacity 0.25s ease;\n opacity: 0.7;\n }\n .nextjs-toast-hide-button:hover {\n opacity: 1;\n }\n .nextjs__container_errors_inspect_copy_button {\n cursor: pointer;\n background: none;\n border: none;\n color: var(--color-ansi-bright-white);\n font-size: 1.5rem;\n padding: 0;\n margin: 0;\n margin-left: var(--size-gap);\n transition: opacity 0.25s ease;\n }\n .nextjs__container_errors__error_title {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: var(--size-3);\n }\n .error-overlay-notes-container {\n padding: 0 var(--size-4);\n }\n`\n"],"names":["Errors","styles","isNextjsLink","text","startsWith","ErrorDescription","error","hydrationWarning","isUnhandledOrReplayError","isUnhandledConsoleOrRejection","unhandledErrorType","getUnhandledErrorType","isConsoleErrorStringMessage","title","name","environmentName","envPrefix","HotlinkedText","message","matcher","errors","readyErrors","debugInfo","versionInfo","isTurbopack","onClose","activeError","useEffect","handleKeyDown","event","key","document","addEventListener","removeEventListener","isLoading","useMemo","length","Boolean","activeIdx","setActiveIndex","useState","Overlay","isServerError","includes","getErrorSource","isUnhandledError","errorDetails","details","notes","warningTemplate","serverContent","clientContent","warning","hydrationErrorType","getHydrationWarningType","replace","errorCode","extractNextErrorCode","footerMessage","undefined","ErrorOverlayLayout","errorType","errorMessage","div","className","p","id","componentStackFrames","reactOutputComponentDiff","PseudoHtmlDiff","hydrationMismatchType","firstContent","secondContent","RuntimeError","toString","css"],"mappings":";;;;;;;;;;;;;;;IA4EgBA,MAAM;eAANA;;IAgIHC,MAAM;eAANA;;;;;uBA5MgC;yBAErB;8BAEI;8BACC;6BAEE;+BACD;0CACC;oCAIxB;8BAIA;qCAC8B;oCACF;;;;;;;;;;AAenC,SAASC,aAAaC,IAAY;IAChC,OAAOA,KAAKC,UAAU,CAAC;AACzB;AAEA,SAASC,iBAAiB,KAMzB;IANyB,IAAA,EACxBC,KAAK,EACLC,gBAAgB,EAIjB,GANyB;IAOxB,MAAMC,2BAA2BC,IAAAA,2CAA6B,EAACH;IAC/D,MAAMI,qBAAqBF,2BACvBG,IAAAA,mCAAqB,EAACL,SACtB;IACJ,MAAMM,8BAA8BF,uBAAuB;IAC3D,mBAAmB;IACnB,sBAAsB;IACtB,kDAAkD;IAClD,iCAAiC;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vC,CAAC,CAACU,aAAasB,wBAAwB,AAAD,kBACtC,qBAACC,wCAAc;gBACbL,WAAU;gBACVM,uBAAuBjB;gBACvBc,sBAAsBzC,YAAYyC,oBAAoB,IAAI,EAAE;gBAC5DI,cAAcrB;gBACdsB,eAAerB;gBACfiB,0BAA0BtB,aAAasB,wBAAwB;iBAE/D;0BACJ,qBAACK,0BAAY;gBAAiCnE,OAAOoB;eAAlCA,YAAYwC,EAAE,CAACQ,QAAQ;;;AAGhD;AAEO,MAAMzE,aAAS0E,kBAAG"}
1
+ {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/container/errors.tsx"],"sourcesContent":["import { useState, useMemo, useEffect } from 'react'\nimport type { DebugInfo } from '../../../types'\nimport { Overlay } from '../components/overlay'\nimport type { ReadyRuntimeError } from '../helpers/get-error-by-type'\nimport { noop as css } from '../helpers/noop-template'\nimport { RuntimeError } from './runtime-error'\nimport type { VersionInfo } from '../../../../../../server/dev/parse-version-info'\nimport { getErrorSource } from '../../../../../../shared/lib/error-source'\nimport { HotlinkedText } from '../components/hot-linked-text'\nimport { PseudoHtmlDiff } from './runtime-error/component-stack-pseudo-html'\nimport {\n type HydrationErrorState,\n getHydrationWarningType,\n} from '../../../../errors/hydration-error-info'\nimport {\n getUnhandledErrorType,\n isUnhandledConsoleOrRejection,\n} from '../../../../errors/console-error'\nimport { extractNextErrorCode } from '../../../../../../lib/error-telemetry-utils'\nimport { ErrorOverlayLayout } from '../components/errors/error-overlay-layout/error-overlay-layout'\n\nexport type ErrorsProps = {\n readyErrors: ReadyRuntimeError[]\n isTurbopack: boolean\n versionInfo: VersionInfo\n debugInfo: DebugInfo\n onClose: () => void\n}\n\ntype ReadyErrorEvent = ReadyRuntimeError\n\nfunction isNextjsLink(text: string): boolean {\n return text.startsWith('https://nextjs.org')\n}\n\nfunction ErrorDescription({\n error,\n hydrationWarning,\n}: {\n error: Error\n hydrationWarning: string | null\n}) {\n const isUnhandledOrReplayError = isUnhandledConsoleOrRejection(error)\n const unhandledErrorType = isUnhandledOrReplayError\n ? getUnhandledErrorType(error)\n : null\n const isConsoleErrorStringMessage = unhandledErrorType === 'string'\n // If the error is:\n // - hydration warning\n // - captured console error or unhandled rejection\n // skip displaying the error name\n const title =\n (isUnhandledOrReplayError && isConsoleErrorStringMessage) ||\n hydrationWarning\n ? ''\n : error.name + ': '\n\n // If it's replayed error, display the environment name\n const environmentName =\n 'environmentName' in error ? error['environmentName'] : ''\n const envPrefix = environmentName ? `[ ${environmentName} ] ` : ''\n return (\n <>\n {envPrefix}\n {title}\n <HotlinkedText\n text={hydrationWarning || error.message}\n matcher={isNextjsLink}\n />\n </>\n )\n}\n\nexport function Errors({\n readyErrors,\n debugInfo,\n versionInfo,\n isTurbopack,\n onClose,\n}: ErrorsProps) {\n useEffect(() => {\n // Close the error overlay when pressing escape\n function handleKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n onClose()\n }\n }\n\n document.addEventListener('keydown', handleKeyDown)\n return () => document.removeEventListener('keydown', handleKeyDown)\n }, [onClose])\n\n const isLoading = useMemo<boolean>(() => {\n return readyErrors.length < 1\n }, [readyErrors.length])\n\n const [activeIdx, setActiveIndex] = useState<number>(0)\n\n const activeError = useMemo<ReadyErrorEvent | null>(\n () => readyErrors[activeIdx] ?? null,\n [activeIdx, readyErrors]\n )\n\n if (isLoading) {\n // TODO: better loading state\n return <Overlay />\n }\n\n if (!activeError) {\n return null\n }\n\n const error = activeError.error\n const isServerError = ['server', 'edge-server'].includes(\n getErrorSource(error) || ''\n )\n const isUnhandledError = isUnhandledConsoleOrRejection(error)\n const errorDetails: HydrationErrorState = (error as any).details || {}\n const notes = errorDetails.notes || ''\n const [warningTemplate, serverContent, clientContent] =\n errorDetails.warning || [null, '', '']\n\n const hydrationErrorType = getHydrationWarningType(warningTemplate)\n const hydrationWarning = warningTemplate\n ? warningTemplate\n .replace('%s', serverContent)\n .replace('%s', clientContent)\n .replace('%s', '') // remove the %s for stack\n .replace(/%s$/, '') // If there's still a %s at the end, remove it\n .replace(/^Warning: /, '')\n .replace(/^Error: /, '')\n : null\n\n const errorCode = extractNextErrorCode(error)\n\n const footerMessage = isServerError\n ? 'This error happened while generating the page. Any console logs will be displayed in the terminal window.'\n : undefined\n\n return (\n <ErrorOverlayLayout\n errorCode={errorCode}\n errorType={\n isServerError\n ? 'Runtime Error'\n : isUnhandledError\n ? 'Console Error'\n : 'Unhandled Runtime Error'\n }\n errorMessage={\n <ErrorDescription error={error} hydrationWarning={hydrationWarning} />\n }\n onClose={isServerError ? undefined : onClose}\n debugInfo={debugInfo}\n error={error}\n readyErrors={readyErrors}\n activeIdx={activeIdx}\n setActiveIndex={setActiveIndex}\n footerMessage={footerMessage}\n versionInfo={versionInfo}\n isTurbopack={isTurbopack}\n >\n <div className=\"error-overlay-notes-container\">\n {notes ? (\n <>\n <p\n id=\"nextjs__container_errors__notes\"\n className=\"nextjs__container_errors__notes\"\n >\n {notes}\n </p>\n </>\n ) : null}\n {hydrationWarning ? (\n <p\n id=\"nextjs__container_errors__link\"\n className=\"nextjs__container_errors__link\"\n >\n <HotlinkedText text=\"See more info here: https://nextjs.org/docs/messages/react-hydration-error\" />\n </p>\n ) : null}\n </div>\n\n {hydrationWarning &&\n (activeError.componentStackFrames?.length ||\n !!errorDetails.reactOutputComponentDiff) ? (\n <PseudoHtmlDiff\n className=\"nextjs__container_errors__component-stack\"\n hydrationMismatchType={hydrationErrorType}\n componentStackFrames={activeError.componentStackFrames || []}\n firstContent={serverContent}\n secondContent={clientContent}\n reactOutputComponentDiff={errorDetails.reactOutputComponentDiff}\n />\n ) : null}\n <RuntimeError key={activeError.id.toString()} error={activeError} />\n </ErrorOverlayLayout>\n )\n}\n\nexport const styles = css`\n .nextjs-error-with-static {\n bottom: calc(var(--size-gap-double) * 4.5);\n }\n p.nextjs__container_errors__link {\n color: var(--color-text-color-red-1);\n font-weight: 600;\n font-size: 15px;\n }\n p.nextjs__container_errors__notes {\n color: var(--color-stack-notes);\n font-weight: 600;\n font-size: 15px;\n }\n .nextjs-container-errors-body > h2:not(:first-child) {\n margin-top: calc(var(--size-gap-double) + var(--size-gap));\n }\n .nextjs-container-errors-body > h2 {\n color: var(--color-title-color);\n margin-bottom: var(--size-gap);\n font-size: var(--size-font-big);\n }\n .nextjs-toast-errors-parent {\n cursor: pointer;\n transition: transform 0.2s ease;\n }\n .nextjs-toast-errors-parent:hover {\n transform: scale(1.1);\n }\n .nextjs-toast-errors {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n }\n .nextjs-toast-errors > svg {\n margin-right: var(--size-gap);\n }\n .nextjs-toast-hide-button {\n margin-left: var(--size-gap-triple);\n border: none;\n background: none;\n color: var(--color-ansi-bright-white);\n padding: 0;\n transition: opacity 0.25s ease;\n opacity: 0.7;\n }\n .nextjs-toast-hide-button:hover {\n opacity: 1;\n }\n .nextjs__container_errors_inspect_copy_button {\n cursor: pointer;\n background: none;\n border: none;\n color: var(--color-ansi-bright-white);\n font-size: 1.5rem;\n padding: 0;\n margin: 0;\n margin-left: var(--size-gap);\n transition: opacity 0.25s ease;\n }\n .nextjs__container_errors__error_title {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: var(--size-3);\n }\n .error-overlay-notes-container {\n padding: 0 var(--size-4);\n }\n`\n"],"names":["Errors","styles","isNextjsLink","text","startsWith","ErrorDescription","error","hydrationWarning","isUnhandledOrReplayError","isUnhandledConsoleOrRejection","unhandledErrorType","getUnhandledErrorType","isConsoleErrorStringMessage","title","name","environmentName","envPrefix","HotlinkedText","message","matcher","readyErrors","debugInfo","versionInfo","isTurbopack","onClose","activeError","useEffect","handleKeyDown","event","key","document","addEventListener","removeEventListener","isLoading","useMemo","length","activeIdx","setActiveIndex","useState","Overlay","isServerError","includes","getErrorSource","isUnhandledError","errorDetails","details","notes","warningTemplate","serverContent","clientContent","warning","hydrationErrorType","getHydrationWarningType","replace","errorCode","extractNextErrorCode","footerMessage","undefined","ErrorOverlayLayout","errorType","errorMessage","div","className","p","id","componentStackFrames","reactOutputComponentDiff","PseudoHtmlDiff","hydrationMismatchType","firstContent","secondContent","RuntimeError","toString","css"],"mappings":";;;;;;;;;;;;;;;IAyEgBA,MAAM;eAANA;;IA+HHC,MAAM;eAANA;;;;;uBAxMgC;yBAErB;8BAEI;8BACC;6BAEE;+BACD;0CACC;oCAIxB;8BAIA;qCAC8B;oCACF;;;;;;;;;;AAYnC,SAASC,aAAaC,IAAY;IAChC,OAAOA,KAAKC,UAAU,CAAC;AACzB;AAEA,SAASC,iBAAiB,KAMzB;IANyB,IAAA,EACxBC,KAAK,EACLC,gBAAgB,EAIjB,GANyB;IAOxB,MAAMC,2BAA2BC,IAAAA,2CAA6B,EAACH;IAC/D,MAAMI,qBAAqBF,2BACvBG,IAAAA,mCAAqB,EAACL,SACtB;IACJ,MAAMM,8BAA8BF,uBAAuB;IAC3D,mBAAmB;IACnB,sBAAsB;IACtB,kDAAkD;IAClD,iCAAiC;IACjC,MAAMG,QACJ,AAACL,4BAA4BI,+BAC7BL,mBACI,KACAD,MAAMQ,IAAI,GAAG;IAEnB,uDAAuD;IACvD,MAAMC,kBACJ,qBAAqBT,QAAQA,KAAK,CAAC,kBAAkB,GAAG;IAC1D,MAAMU,YAAYD,kBAAkB,AAAC,OAAIA,kBAAgB,QAAO;IAChE,qBACE;;YACGC;YACAH;0BACD,qBAACI,4BAAa;gBACZd,MAAMI,oBAAoBD,MAAMY,OAAO;gBACvCC,SAASjB;;;;AAIjB;AAEO,SAASF,OAAO,KAMT;IANS,IAAA,EACrBoB,WAAW,EACXC,SAAS,EACTC,WAAW,EACXC,WAAW,EACXC,OAAO,EACK,GANS;QA+GhBC;IAxGLC,IAAAA,gBAAS,EAAC;QACR,+CAA+C;QAC/C,SAASC,cAAcC,KAAoB;YACzC,IAAIA,MAAMC,GAAG,KAAK,UAAU;gBAC1BL;YACF;QACF;QAEAM,SAASC,gBAAgB,CAAC,WAAWJ;QACrC,OAAO,IAAMG,SAASE,mBAAmB,CAAC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AG,mBACE,kBACA;QAERiB,4BACE,qBAACvD;YAAiBC,OAAOA;YAAOC,kBAAkBA;;QAEpDiB,SAASgB,gBAAgBiB,YAAYjC;QACrCH,WAAWA;QACXf,OAAOA;QACPc,aAAaA;QACbgB,WAAWA;QACXC,gBAAgBA;QAChBmB,eAAeA;QACflC,aAAaA;QACbC,aAAaA;;0BAEb,sBAACsC;gBAAIC,WAAU;;oBACZhB,sBACC;kCACE,cAAA,qBAACiB;4BACCC,IAAG;4BACHF,WAAU;sCAEThB;;yBAGH;oBACHvC,iCACC,qBAACwD;wBACCC,IAAG;wBACHF,WAAU;kCAEV,cAAA,qBAAC7C,4BAAa;4BAACd,MAAK;;yBAEpB;;;YAGLI,oBACAkB,CAAAA,EAAAA,oCAAAA,YAAYwC,oBAAoB,qBAAhCxC,kCAAkCU,MAAM,KACvC,CAAC,CAACS,aAAasB,wBAAwB,AAAD,kBACtC,qBAACC,wCAAc;gBACbL,WAAU;gBACVM,uBAAuBjB;gBACvBc,sBAAsBxC,YAAYwC,oBAAoB,IAAI,EAAE;gBAC5DI,cAAcrB;gBACdsB,eAAerB;gBACfiB,0BAA0BtB,aAAasB,wBAAwB;iBAE/D;0BACJ,qBAACK,0BAAY;gBAAiCjE,OAAOmB;eAAlCA,YAAYuC,EAAE,CAACQ,QAAQ;;;AAGhD;AAEO,MAAMvE,aAASwE,kBAAG"}
@@ -34,7 +34,6 @@ _export(exports, {
34
34
  });
35
35
  const _errors = require("./errors");
36
36
  const _withshadowportal = require("../storybook/with-shadow-portal");
37
- const _shared = require("../../../shared");
38
37
  const meta = {
39
38
  component: _errors.Errors,
40
39
  parameters: {
@@ -45,86 +44,101 @@ const meta = {
45
44
  ]
46
45
  };
47
46
  const _default = meta;
48
- const errors = [
47
+ const originalCodeFrame = (message)=>{
48
+ return "\x1b[0m \x1b[90m 1 \x1b[39m \x1b[36mexport\x1b[39m \x1b[36mdefault\x1b[39m \x1b[36mfunction\x1b[39m \x1b[33mHome\x1b[39m() {\x1b[0m\n\x1b[0m\x1b[31m\x1b[1m>\x1b[22m\x1b[39m\x1b[90m 2 \x1b[39m \x1b[36mthrow\x1b[39m \x1b[36mnew\x1b[39m \x1b[33mError\x1b[39m(\x1b[32m'" + message + "'\x1b[39m)\x1b[0m\n\x1b[0m \x1b[90m \x1b[39m \x1b[31m\x1b[1m^\x1b[22m\x1b[39m\x1b[0m\n\x1b[0m \x1b[90m 3 \x1b[39m \x1b[36mreturn\x1b[39m \x1b[33m<\x1b[39m\x1b[33mdiv\x1b[39m\x1b[33m>\x1b[39m\x1b[33mHello\x1b[39m \x1b[33mWorld\x1b[39m\x1b[33m<\x1b[39m\x1b[33m/\x1b[39m\x1b[33mdiv\x1b[39m\x1b[33m>\x1b[39m\x1b[0m\n\x1b[0m \x1b[90m 4 \x1b[39m }\x1b[0m\n\x1b[0m \x1b[90m 5 \x1b[39m\x1b[0m";
49
+ };
50
+ const sourceStackFrame = {
51
+ file: 'app/page.tsx',
52
+ methodName: 'Home',
53
+ arguments: [],
54
+ lineNumber: 2,
55
+ column: 9
56
+ };
57
+ const originalStackFrame = {
58
+ file: 'app/page.tsx',
59
+ methodName: 'Home',
60
+ arguments: [],
61
+ lineNumber: 2,
62
+ column: 9,
63
+ ignored: false
64
+ };
65
+ const readyErrors = [
49
66
  {
50
67
  id: 1,
51
- event: {
52
- type: _shared.ACTION_UNHANDLED_ERROR,
53
- reason: Object.assign(new Error('First error message'), {
54
- __NEXT_ERROR_CODE: 'E001'
55
- }),
56
- componentStackFrames: [
57
- {
58
- file: 'app/page.tsx',
59
- component: 'Home',
60
- lineNumber: 10,
61
- column: 5,
62
- canOpenInEditor: true
63
- }
64
- ],
65
- frames: [
66
- {
67
- file: 'app/page.tsx',
68
- methodName: 'Home',
69
- arguments: [],
70
- lineNumber: 10,
71
- column: 5
72
- }
73
- ]
74
- }
68
+ runtime: true,
69
+ error: new Error('First error message'),
70
+ frames: [
71
+ {
72
+ error: true,
73
+ reason: 'First error message',
74
+ external: false,
75
+ ignored: false,
76
+ sourceStackFrame,
77
+ originalStackFrame,
78
+ originalCodeFrame: originalCodeFrame('First error message')
79
+ }
80
+ ]
75
81
  },
76
82
  {
77
83
  id: 2,
78
- event: {
79
- type: _shared.ACTION_UNHANDLED_ERROR,
80
- reason: Object.assign(new Error('Second error message'), {
81
- __NEXT_ERROR_CODE: 'E002'
82
- }),
83
- frames: []
84
- }
84
+ runtime: true,
85
+ error: new Error('Second error message'),
86
+ frames: [
87
+ {
88
+ error: true,
89
+ reason: 'Second error message',
90
+ external: false,
91
+ ignored: false,
92
+ sourceStackFrame,
93
+ originalStackFrame,
94
+ originalCodeFrame: originalCodeFrame('Second error message')
95
+ }
96
+ ]
85
97
  },
86
98
  {
87
99
  id: 3,
88
- event: {
89
- type: _shared.ACTION_UNHANDLED_ERROR,
90
- reason: Object.assign(new Error('Third error message'), {
91
- __NEXT_ERROR_CODE: 'E003'
92
- }),
93
- frames: []
94
- }
100
+ runtime: true,
101
+ error: new Error('Third error message'),
102
+ frames: [
103
+ {
104
+ error: true,
105
+ reason: 'Third error message',
106
+ external: false,
107
+ ignored: false,
108
+ sourceStackFrame,
109
+ originalStackFrame,
110
+ originalCodeFrame: originalCodeFrame('Third error message')
111
+ }
112
+ ]
95
113
  },
96
114
  {
97
115
  id: 4,
98
- event: {
99
- type: _shared.ACTION_UNHANDLED_ERROR,
100
- reason: Object.assign(new Error('Fourth error message'), {
101
- __NEXT_ERROR_CODE: 'E004'
102
- }),
103
- frames: []
104
- }
105
- }
106
- ];
107
- const readyErrors = [
108
- {
109
- id: 1,
110
116
  runtime: true,
111
- error: errors[0].event.reason,
112
- frames: []
117
+ error: new Error('Fourth error message'),
118
+ frames: [
119
+ {
120
+ error: true,
121
+ reason: 'Fourth error message',
122
+ external: false,
123
+ ignored: false,
124
+ sourceStackFrame,
125
+ originalStackFrame,
126
+ originalCodeFrame: originalCodeFrame('Fourth error message')
127
+ }
128
+ ]
113
129
  }
114
130
  ];
115
131
  const Default = {
116
132
  args: {
117
- errors,
118
133
  readyErrors,
119
134
  versionInfo: {
120
135
  installed: '15.0.0',
121
136
  staleness: 'fresh'
122
137
  },
123
- hasStaticIndicator: true,
124
- isTurbopack: true,
125
138
  debugInfo: {
126
139
  devtoolsFrontendUrl: undefined
127
140
  },
141
+ isTurbopack: false,
128
142
  onClose: ()=>{}
129
143
  }
130
144
  };
@@ -141,40 +155,51 @@ const Minimized = {
141
155
  };
142
156
  const WithHydrationWarning = {
143
157
  args: {
144
- errors: [
158
+ readyErrors: [
145
159
  {
146
160
  id: 1,
147
- event: {
148
- type: _shared.ACTION_UNHANDLED_ERROR,
149
- reason: Object.assign(new Error('Hydration error'), {
150
- details: {
151
- warning: [
152
- 'Text content does not match server-rendered HTML: "%s" !== "%s"',
153
- 'Server Content',
154
- 'Client Content'
155
- ],
156
- reactOutputComponentDiff: "<MyComponent>\n <ParentComponent>\n <div>\n- <p> hello world </p>\n+ <div> hello world </div>"
161
+ runtime: true,
162
+ error: Object.assign(new Error('Hydration error'), {
163
+ details: {
164
+ warning: [
165
+ 'Text content does not match server-rendered HTML: "%s" !== "%s"',
166
+ 'Server Content',
167
+ 'Client Content'
168
+ ],
169
+ reactOutputComponentDiff: "<MyComponent>\n <ParentComponent>\n <div>\n- <p> hello world </p>\n+ <div> hello world </div>"
170
+ },
171
+ componentStackFrames: [
172
+ {
173
+ component: 'MyComponent',
174
+ file: 'app/page.tsx',
175
+ lineNumber: 10,
176
+ columnNumber: 5
157
177
  },
158
- componentStackFrames: [
159
- {
160
- component: 'MyComponent',
161
- file: 'app/page.tsx',
162
- lineNumber: 10,
163
- columnNumber: 5
164
- },
165
- {
166
- component: 'ParentComponent',
167
- file: 'app/layout.tsx',
168
- lineNumber: 20,
169
- columnNumber: 3
170
- }
171
- ]
172
- }),
173
- frames: []
174
- }
178
+ {
179
+ component: 'ParentComponent',
180
+ file: 'app/layout.tsx',
181
+ lineNumber: 20,
182
+ columnNumber: 3
183
+ }
184
+ ]
185
+ }),
186
+ frames: [
187
+ {
188
+ error: true,
189
+ reason: 'First error message',
190
+ external: false,
191
+ ignored: false,
192
+ sourceStackFrame: {
193
+ file: 'app/page.tsx',
194
+ methodName: 'Home',
195
+ arguments: [],
196
+ lineNumber: 10,
197
+ column: 5
198
+ }
199
+ }
200
+ ]
175
201
  }
176
202
  ],
177
- readyErrors: [],
178
203
  debugInfo: {
179
204
  devtoolsFrontendUrl: undefined
180
205
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from '@storybook/react'\nimport type { SupportedErrorEvent } from '../../../internal/container/Errors'\nimport type { ReadyRuntimeError } from '../helpers/get-error-by-type'\n\nimport { Errors } from './errors'\nimport { withShadowPortal } from '../storybook/with-shadow-portal'\nimport { ACTION_UNHANDLED_ERROR } from '../../../shared'\n\nconst meta: Meta<typeof Errors> = {\n component: Errors,\n parameters: {\n layout: 'fullscreen',\n },\n decorators: [withShadowPortal],\n}\n\nexport default meta\ntype Story = StoryObj<typeof Errors>\n\nconst errors: SupportedErrorEvent[] = [\n {\n id: 1,\n event: {\n type: ACTION_UNHANDLED_ERROR,\n reason: Object.assign(new Error('First error message'), {\n __NEXT_ERROR_CODE: 'E001',\n }),\n componentStackFrames: [\n {\n file: 'app/page.tsx',\n component: 'Home',\n lineNumber: 10,\n column: 5,\n canOpenInEditor: true,\n },\n ],\n frames: [\n {\n file: 'app/page.tsx',\n methodName: 'Home',\n arguments: [],\n lineNumber: 10,\n column: 5,\n },\n ],\n },\n },\n {\n id: 2,\n event: {\n type: ACTION_UNHANDLED_ERROR,\n reason: Object.assign(new Error('Second error message'), {\n __NEXT_ERROR_CODE: 'E002',\n }),\n frames: [],\n },\n },\n {\n id: 3,\n event: {\n type: ACTION_UNHANDLED_ERROR,\n reason: Object.assign(new Error('Third error message'), {\n __NEXT_ERROR_CODE: 'E003',\n }),\n frames: [],\n },\n },\n {\n id: 4,\n event: {\n type: ACTION_UNHANDLED_ERROR,\n reason: Object.assign(new Error('Fourth error message'), {\n __NEXT_ERROR_CODE: 'E004',\n }),\n frames: [],\n },\n },\n]\n\nconst readyErrors: ReadyRuntimeError[] = [\n {\n id: 1,\n runtime: true,\n error: errors[0].event.reason,\n frames: [],\n },\n]\n\nexport const Default: Story = {\n args: {\n errors,\n readyErrors,\n versionInfo: {\n installed: '15.0.0',\n staleness: 'fresh',\n },\n hasStaticIndicator: true,\n isTurbopack: true,\n debugInfo: { devtoolsFrontendUrl: undefined },\n onClose: () => {},\n },\n}\n\nexport const Turbopack: Story = {\n args: {\n ...Default.args,\n isTurbopack: true,\n },\n}\n\nexport const Minimized: Story = {\n args: {\n ...Default.args,\n },\n}\n\nexport const WithHydrationWarning: Story = {\n args: {\n errors: [\n {\n id: 1,\n event: {\n type: ACTION_UNHANDLED_ERROR,\n reason: Object.assign(new Error('Hydration error'), {\n details: {\n warning: [\n 'Text content does not match server-rendered HTML: \"%s\" !== \"%s\"',\n 'Server Content',\n 'Client Content',\n ],\n reactOutputComponentDiff: `<MyComponent>\n <ParentComponent>\n <div>\n- <p> hello world </p>\n+ <div> hello world </div>`,\n },\n componentStackFrames: [\n {\n component: 'MyComponent',\n file: 'app/page.tsx',\n lineNumber: 10,\n columnNumber: 5,\n },\n {\n component: 'ParentComponent',\n file: 'app/layout.tsx',\n lineNumber: 20,\n columnNumber: 3,\n },\n ],\n }),\n frames: [],\n },\n },\n ],\n readyErrors: [],\n debugInfo: { devtoolsFrontendUrl: undefined },\n onClose: () => {},\n },\n}\n"],"names":["Default","Minimized","Turbopack","WithHydrationWarning","meta","component","Errors","parameters","layout","decorators","withShadowPortal","errors","id","event","type","ACTION_UNHANDLED_ERROR","reason","Object","assign","Error","__NEXT_ERROR_CODE","componentStackFrames","file","lineNumber","column","canOpenInEditor","frames","methodName","arguments","readyErrors","runtime","error","args","versionInfo","installed","staleness","hasStaticIndicator","isTurbopack","debugInfo","devtoolsFrontendUrl","undefined","onClose","details","warning","reactOutputComponentDiff","columnNumber"],"mappings":";;;;;;;;;;;;;;;;;;IAwFaA,OAAO;eAAPA;;IAsBAC,SAAS;eAATA;;IAPAC,SAAS;eAATA;;IAaAC,oBAAoB;eAApBA;;IApGb,OAAmB;eAAnB;;;wBAZuB;kCACU;wBACM;AAEvC,MAAMC,OAA4B;IAChCC,WAAWC,cAAM;IACjBC,YAAY;QACVC,QAAQ;IACV;IACAC,YAAY;QAACC,kCAAgB;KAAC;AAChC;MAEA,WAAeN;AAGf,MAAMO,SAAgC;IACpC;QACEC,IAAI;QACJC,OAAO;YACLC,MAAMC,8BAAsB;YAC5BC,QAAQC,OAAOC,MAAM,CAAC,IAAIC,MAAM,wBAAwB;gBACtDC,mBAAmB;YACrB;YACAC,sBAAsB;gBACpB;oBACEC,MAAM;oBACNjB,WAAW;oBACXkB,YAAY;oBACZC,QAAQ;oBACRC,iBAAiB;gBACnB;aACD;YACDC,QAAQ;gBACN;oBACEJ,MAAM;oBACNK,YAAY;oBACZC,WAAW,EAAE;oBACbL,YAAY;oBACZC,QAAQ;gBACV;aACD;QACH;IACF;IACA;QACEZ,IAAI;QACJC,OAAO;YACLC,MAAMC,8BAAsB;YAC5BC,QAAQC,OAAOC,MAAM,CAAC,IAAIC,MAAM,yBAAyB;gBACvDC,mBAAmB;YACrB;YACAM,QAAQ,EAAE;QACZ;IACF;IACA;QACEd,IAAI;QACJC,OAAO;YACLC,MAAMC,8BAAsB;YAC5BC,QAAQC,OAAOC,MAAM,CAAC,IAAIC,MAAM,wBAAwB;gBACtDC,mBAAmB;YACrB;YACAM,QAAQ,EAAE;QACZ;IACF;IACA;QACEd,IAAI;QACJC,OAAO;YACLC,MAAMC,8BAAsB;YAC5BC,QAAQC,OAAOC,MAAM,CAAC,IAAIC,MAAM,yBAAyB;gBACvDC,mBAAmB;YACrB;YACAM,QAAQ,EAAE;QACZ;IACF;CACD;AAED,MAAMG,cAAmC;IACvC;QACEjB,IAAI;QACJkB,SAAS;QACTC,OAAOpB,MAAM,CAAC,EAAE,CAACE,KAAK,CAACG,MAAM;QAC7BU,QAAQ,EAAE;IACZ;CACD;AAEM,MAAM1B,UAAiB;IAC5BgC,MAAM;QACJrB;QACAkB;QACAI,aAAa;YACXC,WAAW;YACXC,WAAW;QACb;QACAC,oBAAoB;QACpBC,aAAa;QACbC,WAAW;YAAEC,qBAAqBC;QAAU;QAC5CC,SAAS,KAAO;IAClB;AACF;AAEO,MAAMvC,YAAmB;IAC9B8B,MAAM;QACJ,GAAGhC,QAAQgC,IAAI;QACfK,aAAa;IACf;AACF;AAEO,MAAMpC,YAAmB;IAC9B+B,MAAM;QACJ,GAAGhC,QAAQgC,IAAI;IACjB;AACF;AAEO,MAAM7B,uBAA8B;IACzC6B,MAAM;QACJrB,QAAQ;YACN;gBACEC,IAAI;gBACJC,OAAO;oBACLC,MAAMC,8BAAsB;oBAC5BC,QAAQC,OAAOC,MAAM,CAAC,IAAIC,MAAM,oBAAoB;wBAClDuB,SAAS;4BACPC,SAAS;gCACP;gCACA;gCACA;6BACD;4BACDC,0BAA2B;wBAK7B;wBACAvB,sBAAsB;4BACpB;gCACEhB,WAAW;gCACXiB,MAAM;gCACNC,YAAY;gCACZsB,cAAc;4BAChB;4BACA;gCACExC,WAAW;gCACXiB,MAAM;gCACNC,YAAY;gCACZsB,cAAc;4BAChB;yBACD;oBACH;oBACAnB,QAAQ,EAAE;gBACZ;YACF;SACD;QACDG,aAAa,EAAE;QACfS,WAAW;YAAEC,qBAAqBC;QAAU;QAC5CC,SAAS,KAAO;IAClB;AACF"}
1
+ {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from '@storybook/react'\nimport type { ReadyRuntimeError } from '../helpers/get-error-by-type'\n\nimport { Errors } from './errors'\nimport { withShadowPortal } from '../storybook/with-shadow-portal'\n\nconst meta: Meta<typeof Errors> = {\n component: Errors,\n parameters: {\n layout: 'fullscreen',\n },\n decorators: [withShadowPortal],\n}\n\nexport default meta\ntype Story = StoryObj<typeof Errors>\n\nconst originalCodeFrame = (message: string) => {\n return `\\u001b[0m \\u001b[90m 1 \\u001b[39m \\u001b[36mexport\\u001b[39m \\u001b[36mdefault\\u001b[39m \\u001b[36mfunction\\u001b[39m \\u001b[33mHome\\u001b[39m() {\\u001b[0m\n\\u001b[0m\\u001b[31m\\u001b[1m>\\u001b[22m\\u001b[39m\\u001b[90m 2 \\u001b[39m \\u001b[36mthrow\\u001b[39m \\u001b[36mnew\\u001b[39m \\u001b[33mError\\u001b[39m(\\u001b[32m'${message}'\\u001b[39m)\\u001b[0m\n\\u001b[0m \\u001b[90m \\u001b[39m \\u001b[31m\\u001b[1m^\\u001b[22m\\u001b[39m\\u001b[0m\n\\u001b[0m \\u001b[90m 3 \\u001b[39m \\u001b[36mreturn\\u001b[39m \\u001b[33m<\\u001b[39m\\u001b[33mdiv\\u001b[39m\\u001b[33m>\\u001b[39m\\u001b[33mHello\\u001b[39m \\u001b[33mWorld\\u001b[39m\\u001b[33m<\\u001b[39m\\u001b[33m/\\u001b[39m\\u001b[33mdiv\\u001b[39m\\u001b[33m>\\u001b[39m\\u001b[0m\n\\u001b[0m \\u001b[90m 4 \\u001b[39m }\\u001b[0m\n\\u001b[0m \\u001b[90m 5 \\u001b[39m\\u001b[0m`\n}\n\nconst sourceStackFrame = {\n file: 'app/page.tsx',\n methodName: 'Home',\n arguments: [],\n lineNumber: 2,\n column: 9,\n}\n\nconst originalStackFrame = {\n file: 'app/page.tsx',\n methodName: 'Home',\n arguments: [],\n lineNumber: 2,\n column: 9,\n ignored: false,\n}\n\nconst readyErrors: ReadyRuntimeError[] = [\n {\n id: 1,\n runtime: true,\n error: new Error('First error message'),\n frames: [\n {\n error: true,\n reason: 'First error message',\n external: false,\n ignored: false,\n sourceStackFrame,\n originalStackFrame,\n originalCodeFrame: originalCodeFrame('First error message'),\n },\n ],\n },\n {\n id: 2,\n runtime: true,\n error: new Error('Second error message'),\n frames: [\n {\n error: true,\n reason: 'Second error message',\n external: false,\n ignored: false,\n sourceStackFrame,\n originalStackFrame,\n originalCodeFrame: originalCodeFrame('Second error message'),\n },\n ],\n },\n {\n id: 3,\n runtime: true,\n error: new Error('Third error message'),\n frames: [\n {\n error: true,\n reason: 'Third error message',\n external: false,\n ignored: false,\n sourceStackFrame,\n originalStackFrame,\n originalCodeFrame: originalCodeFrame('Third error message'),\n },\n ],\n },\n {\n id: 4,\n runtime: true,\n error: new Error('Fourth error message'),\n frames: [\n {\n error: true,\n reason: 'Fourth error message',\n external: false,\n ignored: false,\n sourceStackFrame,\n originalStackFrame,\n originalCodeFrame: originalCodeFrame('Fourth error message'),\n },\n ],\n },\n]\n\nexport const Default: Story = {\n args: {\n readyErrors,\n versionInfo: {\n installed: '15.0.0',\n staleness: 'fresh',\n },\n debugInfo: { devtoolsFrontendUrl: undefined },\n isTurbopack: false,\n onClose: () => {},\n },\n}\n\nexport const Turbopack: Story = {\n args: {\n ...Default.args,\n isTurbopack: true,\n },\n}\n\nexport const Minimized: Story = {\n args: {\n ...Default.args,\n },\n}\n\nexport const WithHydrationWarning: Story = {\n args: {\n readyErrors: [\n {\n id: 1,\n runtime: true,\n error: Object.assign(new Error('Hydration error'), {\n details: {\n warning: [\n 'Text content does not match server-rendered HTML: \"%s\" !== \"%s\"',\n 'Server Content',\n 'Client Content',\n ],\n reactOutputComponentDiff: `<MyComponent>\n <ParentComponent>\n <div>\n- <p> hello world </p>\n+ <div> hello world </div>`,\n },\n componentStackFrames: [\n {\n component: 'MyComponent',\n file: 'app/page.tsx',\n lineNumber: 10,\n columnNumber: 5,\n },\n {\n component: 'ParentComponent',\n file: 'app/layout.tsx',\n lineNumber: 20,\n columnNumber: 3,\n },\n ],\n }),\n frames: [\n {\n error: true,\n reason: 'First error message',\n external: false,\n ignored: false,\n sourceStackFrame: {\n file: 'app/page.tsx',\n methodName: 'Home',\n arguments: [],\n lineNumber: 10,\n column: 5,\n },\n },\n ],\n },\n ],\n debugInfo: { devtoolsFrontendUrl: undefined },\n onClose: () => {},\n },\n}\n"],"names":["Default","Minimized","Turbopack","WithHydrationWarning","meta","component","Errors","parameters","layout","decorators","withShadowPortal","originalCodeFrame","message","sourceStackFrame","file","methodName","arguments","lineNumber","column","originalStackFrame","ignored","readyErrors","id","runtime","error","Error","frames","reason","external","args","versionInfo","installed","staleness","debugInfo","devtoolsFrontendUrl","undefined","isTurbopack","onClose","Object","assign","details","warning","reactOutputComponentDiff","componentStackFrames","columnNumber"],"mappings":";;;;;;;;;;;;;;;;;;IA8GaA,OAAO;eAAPA;;IAoBAC,SAAS;eAATA;;IAPAC,SAAS;eAATA;;IAaAC,oBAAoB;eAApBA;;IA1Hb,OAAmB;eAAnB;;;wBAXuB;kCACU;AAEjC,MAAMC,OAA4B;IAChCC,WAAWC,cAAM;IACjBC,YAAY;QACVC,QAAQ;IACV;IACAC,YAAY;QAACC,kCAAgB;KAAC;AAChC;MAEA,WAAeN;AAGf,MAAMO,oBAAoB,CAACC;IACzB,OAAO,AAAC,gRAC0JA,UAAQ;AAK5K;AAEA,MAAMC,mBAAmB;IACvBC,MAAM;IACNC,YAAY;IACZC,WAAW,EAAE;IACbC,YAAY;IACZC,QAAQ;AACV;AAEA,MAAMC,qBAAqB;IACzBL,MAAM;IACNC,YAAY;IACZC,WAAW,EAAE;IACbC,YAAY;IACZC,QAAQ;IACRE,SAAS;AACX;AAEA,MAAMC,cAAmC;IACvC;QACEC,IAAI;QACJC,SAAS;QACTC,OAAO,IAAIC,MAAM;QACjBC,QAAQ;YACN;gBACEF,OAAO;gBACPG,QAAQ;gBACRC,UAAU;gBACVR,SAAS;gBACTP;gBACAM;gBACAR,mBAAmBA,kBAAkB;YACvC;SACD;IACH;IACA;QACEW,IAAI;QACJC,SAAS;QACTC,OAAO,IAAIC,MAAM;QACjBC,QAAQ;YACN;gBACEF,OAAO;gBACPG,QAAQ;gBACRC,UAAU;gBACVR,SAAS;gBACTP;gBACAM;gBACAR,mBAAm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WAAW,EAAE;4BACbC,YAAY;4BACZC,QAAQ;wBACV;oBACF;iBACD;YACH;SACD;QACDe,WAAW;YAAEC,qBAAqBC;QAAU;QAC5CE,SAAS,KAAO;IAClB;AACF"}
@@ -1,12 +1,13 @@
1
1
  import type { ReadyRuntimeError } from '../../helpers/get-error-by-type';
2
- import type { UnhandledErrorAction, UnhandledRejectionAction } from '../../../../shared';
2
+ import type { OverlayState, UnhandledErrorAction, UnhandledRejectionAction } from '../../../../shared';
3
3
  export type SupportedErrorEvent = {
4
4
  id: number;
5
5
  event: UnhandledErrorAction | UnhandledRejectionAction;
6
6
  };
7
- export declare function useErrorHook({ errors, isAppDir, }: {
8
- errors: SupportedErrorEvent[];
7
+ export declare function useErrorHook({ state, isAppDir, }: {
8
+ state: OverlayState;
9
9
  isAppDir: boolean;
10
10
  }): {
11
11
  readyErrors: ReadyRuntimeError[];
12
+ totalErrorCount: number;
12
13
  };
@@ -27,7 +27,8 @@ function getErrorSignature(ev) {
27
27
  return '';
28
28
  }
29
29
  function useErrorHook(param) {
30
- let { errors, isAppDir } = param;
30
+ let { state, isAppDir } = param;
31
+ const { errors, rootLayoutMissingTags, buildError } = state;
31
32
  const [lookups, setLookups] = (0, _react.useState)({});
32
33
  const [readyErrors, nextError] = (0, _react.useMemo)(()=>{
33
34
  let ready = [];
@@ -84,7 +85,12 @@ function useErrorHook(param) {
84
85
  isAppDir
85
86
  ]);
86
87
  return {
87
- readyErrors
88
+ readyErrors,
89
+ // Total number of errors are based on the priority that
90
+ // will be displayed. Since build error and root layout
91
+ // missing tags won't be dismissed until resolved, the
92
+ // total number of errors may be fixed to their length.
93
+ totalErrorCount: (rootLayoutMissingTags == null ? void 0 : rootLayoutMissingTags.length) ? rootLayoutMissingTags.length : !!buildError ? 1 : errors.length
88
94
  };
89
95
  }
90
96
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.ts"],"sourcesContent":["import type { ReadyRuntimeError } from '../../helpers/get-error-by-type'\nimport type {\n UnhandledErrorAction,\n UnhandledRejectionAction,\n} from '../../../../shared'\n\nimport { useMemo, useState, useEffect } from 'react'\nimport { getErrorByType } from '../../helpers/get-error-by-type'\nimport {\n ACTION_UNHANDLED_ERROR,\n ACTION_UNHANDLED_REJECTION,\n} from '../../../../shared'\n\nexport type SupportedErrorEvent = {\n id: number\n event: UnhandledErrorAction | UnhandledRejectionAction\n}\n\nfunction getErrorSignature(ev: SupportedErrorEvent): string {\n const { event } = ev\n switch (event.type) {\n case ACTION_UNHANDLED_ERROR:\n case ACTION_UNHANDLED_REJECTION: {\n return `${event.reason.name}::${event.reason.message}::${event.reason.stack}`\n }\n default: {\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = event as never\n return ''\n}\n\nexport function useErrorHook({\n errors,\n isAppDir,\n}: {\n errors: SupportedErrorEvent[]\n isAppDir: boolean\n}) {\n const [lookups, setLookups] = useState<{\n [eventId: string]: ReadyRuntimeError\n }>({})\n const [readyErrors, nextError] = useMemo<\n [ReadyRuntimeError[], SupportedErrorEvent | null]\n >(() => {\n let ready: ReadyRuntimeError[] = []\n let next: SupportedErrorEvent | null = null\n\n // Ensure errors are displayed in the order they occurred in:\n for (let idx = 0; idx < errors.length; ++idx) {\n const e = errors[idx]\n const { id } = e\n if (id in lookups) {\n ready.push(lookups[id])\n continue\n }\n\n // Check for duplicate errors\n if (idx > 0) {\n const prev = errors[idx - 1]\n if (getErrorSignature(prev) === getErrorSignature(e)) {\n continue\n }\n }\n\n next = e\n break\n }\n\n return [ready, next]\n }, [errors, lookups])\n\n useEffect(() => {\n if (nextError == null) {\n return\n }\n let mounted = true\n\n getErrorByType(nextError, isAppDir).then(\n (resolved) => {\n // We don't care if the desired error changed while we were resolving,\n // thus we're not tracking it using a ref. Once the work has been done,\n // we'll store it.\n if (mounted) {\n setLookups((m) => ({ ...m, [resolved.id]: resolved }))\n }\n },\n () => {\n // TODO: handle this, though an edge case\n }\n )\n\n return () => {\n mounted = false\n }\n }, [nextError, isAppDir])\n\n return {\n readyErrors,\n }\n}\n"],"names":["useErrorHook","getErrorSignature","ev","event","type","ACTION_UNHANDLED_ERROR","ACTION_UNHANDLED_REJECTION","reason","name","message","stack","_","errors","isAppDir","lookups","setLookups","useState","readyErrors","nextError","useMemo","ready","next","idx","length","e","id","push","prev","useEffect","mounted","getErrorByType","then","resolved","m"],"mappings":";;;;+BAkCgBA;;;eAAAA;;;uBA5B6B;gCACd;wBAIxB;AAOP,SAASC,kBAAkBC,EAAuB;IAChD,MAAM,EAAEC,KAAK,EAAE,GAAGD;IAClB,OAAQC,MAAMC,IAAI;QAChB,KAAKC,8BAAsB;QAC3B,KAAKC,kCAA0B;YAAE;gBAC/B,OAAO,AAAGH,MAAMI,MAAM,CAACC,IAAI,GAAC,OAAIL,MAAMI,MAAM,CAACE,OAAO,GAAC,OAAIN,MAAMI,MAAM,CAACG,KAAK;YAC7E;QACA;YAAS,CACT;IACF;IAEA,6DAA6D;IAC7D,MAAMC,IAAWR;IACjB,OAAO;AACT;AAEO,SAASH,aAAa,KAM5B;IAN4B,IAAA,EAC3BY,MAAM,EACNC,QAAQ,EAIT,GAN4B;IAO3B,MAAM,CAACC,SAASC,WAAW,GAAGC,IAAAA,eAAQ,EAEnC,CAAC;IACJ,MAAM,CAACC,aAAaC,UAAU,GAAGC,IAAAA,cAAO,EAEtC;QACA,IAAIC,QAA6B,EAAE;QACnC,IAAIC,OAAmC;QAEvC,6DAA6D;QAC7D,IAAK,IAAIC,MAAM,GAAGA,MAAMV,OAAOW,MAAM,EAAE,EAAED,IAAK;YAC5C,MAAME,IAAIZ,MAAM,CAACU,IAAI;YACrB,MAAM,EAAEG,EAAE,EAAE,GAAGD;YACf,IAAIC,MAAMX,SAAS;gBACjBM,MAAMM,IAAI,CAACZ,OAAO,CAACW,GAAG;gBACtB;YACF;YAEA,6BAA6B;YAC7B,IAAIH,MAAM,GAAG;gBACX,MAAMK,OAAOf,MAAM,CAACU,MAAM,EAAE;gBAC5B,IAAIrB,kBAAkB0B,UAAU1B,kBAAkBuB,IAAI;oBACpD;gBACF;YACF;YAEAH,OAAOG;YACP;QACF;QAEA,OAAO;YAACJ;YAAOC;SAAK;IACtB,GAAG;QAACT;QAAQE;KAAQ;IAEpBc,IAAAA,gBAAS,EAAC;QACR,IAAIV,aAAa,MAAM;YACrB;QACF;QACA,IAAIW,UAAU;QAEdC,IAAAA,8BAAc,EAACZ,WAAWL,UAAUkB,IAAI,CACtC,CAACC;YACC,sEAAsE;YACtE,uEAAuE;YACvE,kBAAkB;YAClB,IAAIH,SAAS;gBACXd,WAAW,CAACkB,IAAO,CAAA;wBAAE,GAAGA,CAAC;wBAAE,CAACD,SAASP,EAAE,CAAC,EAAEO;oBAAS,CAAA;YACrD;QACF,GACA;QACE,yCAAyC;QAC3C;QAGF,OAAO;YACLH,UAAU;QACZ;IACF,GAAG;QAACX;QAAWL;KAAS;IAExB,OAAO;QACLI;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.ts"],"sourcesContent":["import type { ReadyRuntimeError } from '../../helpers/get-error-by-type'\nimport type {\n OverlayState,\n UnhandledErrorAction,\n UnhandledRejectionAction,\n} from '../../../../shared'\n\nimport { useMemo, useState, useEffect } from 'react'\nimport { getErrorByType } from '../../helpers/get-error-by-type'\nimport {\n ACTION_UNHANDLED_ERROR,\n ACTION_UNHANDLED_REJECTION,\n} from '../../../../shared'\n\nexport type SupportedErrorEvent = {\n id: number\n event: UnhandledErrorAction | UnhandledRejectionAction\n}\n\nfunction getErrorSignature(ev: SupportedErrorEvent): string {\n const { event } = ev\n switch (event.type) {\n case ACTION_UNHANDLED_ERROR:\n case ACTION_UNHANDLED_REJECTION: {\n return `${event.reason.name}::${event.reason.message}::${event.reason.stack}`\n }\n default: {\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = event as never\n return ''\n}\n\nexport function useErrorHook({\n state,\n isAppDir,\n}: {\n state: OverlayState\n isAppDir: boolean\n}) {\n const { errors, rootLayoutMissingTags, buildError } = state\n\n const [lookups, setLookups] = useState<{\n [eventId: string]: ReadyRuntimeError\n }>({})\n const [readyErrors, nextError] = useMemo<\n [ReadyRuntimeError[], SupportedErrorEvent | null]\n >(() => {\n let ready: ReadyRuntimeError[] = []\n let next: SupportedErrorEvent | null = null\n\n // Ensure errors are displayed in the order they occurred in:\n for (let idx = 0; idx < errors.length; ++idx) {\n const e = errors[idx]\n const { id } = e\n if (id in lookups) {\n ready.push(lookups[id])\n continue\n }\n\n // Check for duplicate errors\n if (idx > 0) {\n const prev = errors[idx - 1]\n if (getErrorSignature(prev) === getErrorSignature(e)) {\n continue\n }\n }\n\n next = e\n break\n }\n\n return [ready, next]\n }, [errors, lookups])\n\n useEffect(() => {\n if (nextError == null) {\n return\n }\n let mounted = true\n\n getErrorByType(nextError, isAppDir).then(\n (resolved) => {\n // We don't care if the desired error changed while we were resolving,\n // thus we're not tracking it using a ref. Once the work has been done,\n // we'll store it.\n if (mounted) {\n setLookups((m) => ({ ...m, [resolved.id]: resolved }))\n }\n },\n () => {\n // TODO: handle this, though an edge case\n }\n )\n\n return () => {\n mounted = false\n }\n }, [nextError, isAppDir])\n\n return {\n readyErrors,\n // Total number of errors are based on the priority that\n // will be displayed. Since build error and root layout\n // missing tags won't be dismissed until resolved, the\n // total number of errors may be fixed to their length.\n totalErrorCount: rootLayoutMissingTags?.length\n ? rootLayoutMissingTags.length\n : !!buildError\n ? 1\n : errors.length,\n }\n}\n"],"names":["useErrorHook","getErrorSignature","ev","event","type","ACTION_UNHANDLED_ERROR","ACTION_UNHANDLED_REJECTION","reason","name","message","stack","_","state","isAppDir","errors","rootLayoutMissingTags","buildError","lookups","setLookups","useState","readyErrors","nextError","useMemo","ready","next","idx","length","e","id","push","prev","useEffect","mounted","getErrorByType","then","resolved","m","totalErrorCount"],"mappings":";;;;+BAm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AC;QACR,IAAIV,aAAa,MAAM;YACrB;QACF;QACA,IAAIW,UAAU;QAEdC,IAAAA,8BAAc,EAACZ,WAAWR,UAAUqB,IAAI,CACtC,CAACC;YACC,sEAAsE;YACtE,uEAAuE;YACvE,kBAAkB;YAClB,IAAIH,SAAS;gBACXd,WAAW,CAACkB,IAAO,CAAA;wBAAE,GAAGA,CAAC;wBAAE,CAACD,SAASP,EAAE,CAAC,EAAEO;oBAAS,CAAA;YACrD;QACF,GACA;QACE,yCAAyC;QAC3C;QAGF,OAAO;YACLH,UAAU;QACZ;IACF,GAAG;QAACX;QAAWR;KAAS;IAExB,OAAO;QACLO;QACA,wDAAwD;QACxD,uDAAuD;QACvD,sDAAsD;QACtD,uDAAuD;QACvDiB,iBAAiBtB,CAAAA,yCAAAA,sBAAuBW,MAAM,IAC1CX,sBAAsBW,MAAM,GAC5B,CAAC,CAACV,aACA,IACAF,OAAOY,MAAM;IACrB;AACF"}
@@ -0,0 +1,14 @@
1
+ import type * as React from 'react';
2
+ /**
3
+ * A function that merges React refs into one.
4
+ * Supports both functions and ref objects created using createRef() and useRef().
5
+ *
6
+ * Usage:
7
+ * ```tsx
8
+ * <div ref={mergeRefs(ref1, ref2, ref3)} />
9
+ * ```
10
+ *
11
+ * @param {(React.Ref<T> | undefined)[]} inputRefs Array of refs
12
+ * @returns {React.Ref<T> | React.RefCallback<T>} Merged refs
13
+ */
14
+ export default function mergeRefs<T>(...inputRefs: (React.Ref<T> | undefined)[]): React.Ref<T> | React.RefCallback<T>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, /**
6
+ * A function that merges React refs into one.
7
+ * Supports both functions and ref objects created using createRef() and useRef().
8
+ *
9
+ * Usage:
10
+ * ```tsx
11
+ * <div ref={mergeRefs(ref1, ref2, ref3)} />
12
+ * ```
13
+ *
14
+ * @param {(React.Ref<T> | undefined)[]} inputRefs Array of refs
15
+ * @returns {React.Ref<T> | React.RefCallback<T>} Merged refs
16
+ */ "default", {
17
+ enumerable: true,
18
+ get: function() {
19
+ return mergeRefs;
20
+ }
21
+ });
22
+ function mergeRefs() {
23
+ for(var _len = arguments.length, inputRefs = new Array(_len), _key = 0; _key < _len; _key++){
24
+ inputRefs[_key] = arguments[_key];
25
+ }
26
+ const filteredInputRefs = inputRefs.filter(Boolean);
27
+ if (filteredInputRefs.length <= 1) {
28
+ const firstRef = filteredInputRefs[0];
29
+ return firstRef || null;
30
+ }
31
+ return function mergedRefs(ref) {
32
+ for (const inputRef of filteredInputRefs){
33
+ if (typeof inputRef === 'function') {
34
+ inputRef(ref);
35
+ } else if (inputRef) {
36
+ ;
37
+ inputRef.current = ref;
38
+ }
39
+ }
40
+ };
41
+ }
42
+
43
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
44
+ Object.defineProperty(exports.default, '__esModule', { value: true });
45
+ Object.assign(exports.default, exports);
46
+ module.exports = exports.default;
47
+ }
48
+
49
+ //# sourceMappingURL=merge-refs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.ts"],"sourcesContent":["import type * as React from 'react'\n\n/**\n * A function that merges React refs into one.\n * Supports both functions and ref objects created using createRef() and useRef().\n *\n * Usage:\n * ```tsx\n * <div ref={mergeRefs(ref1, ref2, ref3)} />\n * ```\n *\n * @param {(React.Ref<T> | undefined)[]} inputRefs Array of refs\n * @returns {React.Ref<T> | React.RefCallback<T>} Merged refs\n */\nexport default function mergeRefs<T>(\n ...inputRefs: (React.Ref<T> | undefined)[]\n): React.Ref<T> | React.RefCallback<T> {\n const filteredInputRefs = inputRefs.filter(Boolean)\n\n if (filteredInputRefs.length <= 1) {\n const firstRef = filteredInputRefs[0]\n\n return firstRef || null\n }\n\n return function mergedRefs(ref) {\n for (const inputRef of filteredInputRefs) {\n if (typeof inputRef === 'function') {\n inputRef(ref)\n } else if (inputRef) {\n ;(inputRef as React.MutableRefObject<T | null>).current = ref\n }\n }\n }\n}\n"],"names":["mergeRefs","inputRefs","filteredInputRefs","filter","Boolean","length","firstRef","mergedRefs","ref","inputRef","current"],"mappings":";;;;+BAEA;;;;;;;;;;;CAWC,GACD;;;eAAwBA;;;AAAT,SAASA;IACtB,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGC,YAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA;QAAGA,UAAH,QAAA,SAAA,CAAA,KAA0C;;IAE1C,MAAMC,oBAAoBD,UAAUE,MAAM,CAACC;IAE3C,IAAIF,kBAAkBG,MAAM,IAAI,GAAG;QACjC,MAAMC,WAAWJ,iBAAiB,CAAC,EAAE;QAErC,OAAOI,YAAY;IACrB;IAEA,OAAO,SAASC,WAAWC,GAAG;QAC5B,KAAK,MAAMC,YAAYP,kBAAmB;YACxC,IAAI,OAAOO,aAAa,YAAY;gBAClCA,SAASD;YACX,OAAO,IAAIC,UAAU;;gBACjBA,SAA8CC,OAAO,GAAGF;YAC5D;QACF;IACF;AACF"}
@@ -15,7 +15,8 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
15
15
  const _nooptemplate = require("../helpers/noop-template");
16
16
  function _templateObject() {
17
17
  const data = _tagged_template_literal_loose._([
18
- "\n @import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;900&family=Geist+Mono:wght@400;900&display=swap');\n\n :host {\n --size-gap-half: 4px;\n --size-gap: 8px;\n --size-gap-double: 16px;\n --size-gap-triple: 24px;\n --size-gap-quad: 32px;\n\n --size-font-11: 11px;\n --size-font-smaller: 12px;\n --size-font-small: 14px;\n --size-font: 16px;\n --size-font-big: 20px;\n --size-font-bigger: 24px;\n\n --color-background: white;\n --color-font: #757575;\n --color-backdrop: rgba(17, 17, 17, 0.2);\n --color-border-shadow: rgba(0, 0, 0, 0.145);\n\n --color-title-color: #1f1f1f;\n --color-stack-h6: #222;\n --color-stack-headline: #666;\n --color-stack-subline: #999;\n --color-stack-notes: #777;\n\n --color-accents-1: #808080;\n --color-accents-2: #222222;\n --color-accents-3: #404040;\n\n --color-text-color-red-1: #ff5555;\n --color-text-background-red-1: #fff9f9;\n\n --font-stack-monospace: 'Geist Mono', 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --font-stack-sans: 'Geist', -apple-system, 'Source Sans Pro',\n sans-serif;\n\n font-family: var(--font-stack-sans);\n\n /* TODO: Remove replaced ones. */\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),\n 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);\n --shadow-none: 0 0 #0000;\n --shadow-menu: 0px 1px 1px rgba(0, 0, 0, 0.02),\n 0px 4px 8px -4px rgba(0, 0, 0, 0.04),\n 0px 16px 24px -8px rgba(0, 0, 0, 0.06);\n\n --rounded-none: 0px;\n --rounded-sm: 0.125rem; /* 2px */\n --rounded-md: 0.25rem; /* 4px */\n --rounded-lg: 0.5rem; /* 8px */\n --rounded-xl: 0.75rem; /* 12px */\n --rounded-2xl: 1rem; /* 16px */\n --rounded-3xl: 1.5rem; /* 24px */\n --rounded-full: 9999px;\n\n --size-0: 0px;\n --size-px: 1px;\n --size-0_5: 0.125rem; /* 2px */\n --size-1: 0.25rem; /* 4px */\n --size-1_5: 0.375rem; /* 6px */\n --size-2: 0.5rem; /* 8px */\n --size-2_5: 0.625rem; /* 10px */\n --size-3: 0.75rem; /* 12px */\n --size-3_5: 0.875rem; /* 14px */\n --size-4: 1rem; /* 16px */\n --size-4_5: 1.125rem; /* 18px */\n --size-5: 1.25rem; /* 20px */\n --size-5_5: 1.375rem; /* 22px */\n --size-6: 1.5rem; /* 24px */\n --size-6_5: 1.625rem; /* 26px */\n --size-7: 1.75rem; /* 28px */\n --size-7_5: 1.875rem; /* 30px */\n --size-8: 2rem; /* 32px */\n --size-8_5: 2.125rem; /* 34px */\n --size-9: 2.25rem; /* 36px */\n --size-9_5: 2.375rem; /* 38px */\n --size-10: 2.5rem; /* 40px */\n --size-10_5: 2.625rem; /* 42px */\n --size-11: 2.75rem; /* 44px */\n --size-11_5: 2.875rem; /* 46px */\n --size-12: 3rem; /* 48px */\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --color-background: rgb(28, 28, 30);\n --color-font: white;\n --color-backdrop: rgb(44, 44, 46);\n --color-border-shadow: rgba(255, 255, 255, 0.145);\n\n --color-title-color: #fafafa;\n --color-stack-h6: rgb(200, 200, 204);\n --color-stack-headline: rgb(99, 99, 102);\n --color-stack-notes: #a9a9a9;\n --color-stack-subline: rgb(121, 121, 121);\n\n --color-accents-3: rgb(118, 118, 118);\n\n --color-text-background-red-1: #2a1e1e;\n }\n }\n\n .mono {\n font-family: var(--font-stack-monospace);\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-bottom: var(--size-gap);\n font-weight: 500;\n line-height: 1.5;\n }\n "
18
+ "\n @import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;900&family=Geist+Mono:wght@400;900&display=swap');\n\n :host {\n ",
19
+ "\n\n --size-gap-half: 4px;\n --size-gap: 8px;\n --size-gap-double: 16px;\n --size-gap-triple: 24px;\n --size-gap-quad: 32px;\n\n --size-font-11: 11px;\n --size-font-smaller: 12px;\n --size-font-small: 14px;\n --size-font: 16px;\n --size-font-big: 20px;\n --size-font-bigger: 24px;\n\n --color-background: white;\n --color-font: #757575;\n --color-backdrop: rgba(17, 17, 17, 0.2);\n --color-border-shadow: rgba(0, 0, 0, 0.145);\n\n --color-title-color: #1f1f1f;\n --color-stack-h6: #222;\n --color-stack-headline: #666;\n --color-stack-subline: #999;\n --color-stack-notes: #777;\n\n --color-accents-1: #808080;\n --color-accents-2: #222222;\n --color-accents-3: #404040;\n\n --color-text-color-red-1: #ff5555;\n --color-text-background-red-1: #fff9f9;\n\n --font-stack-monospace: 'Geist Mono', 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --font-stack-sans: 'Geist', -apple-system, 'Source Sans Pro',\n sans-serif;\n\n font-family: var(--font-stack-sans);\n\n /* TODO: Remove replaced ones. */\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),\n 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);\n --shadow-none: 0 0 #0000;\n\n --shadow-small: 0px 2px 2px rgba(0, 0, 0, 0.04);\n --shadow-menu: 0px 1px 1px rgba(0, 0, 0, 0.02),\n 0px 4px 8px -4px rgba(0, 0, 0, 0.04),\n 0px 16px 24px -8px rgba(0, 0, 0, 0.06);\n\n --rounded-none: 0px;\n --rounded-sm: 0.125rem; /* 2px */\n --rounded-md: 0.25rem; /* 4px */\n --rounded-lg: 0.5rem; /* 8px */\n --rounded-xl: 0.75rem; /* 12px */\n --rounded-2xl: 1rem; /* 16px */\n --rounded-3xl: 1.5rem; /* 24px */\n --rounded-full: 9999px;\n\n --size-0: 0px;\n --size-px: 1px;\n --size-0_5: 0.125rem; /* 2px */\n --size-1: 0.25rem; /* 4px */\n --size-1_5: 0.375rem; /* 6px */\n --size-2: 0.5rem; /* 8px */\n --size-2_5: 0.625rem; /* 10px */\n --size-3: 0.75rem; /* 12px */\n --size-3_5: 0.875rem; /* 14px */\n --size-4: 1rem; /* 16px */\n --size-4_5: 1.125rem; /* 18px */\n --size-5: 1.25rem; /* 20px */\n --size-5_5: 1.375rem; /* 22px */\n --size-6: 1.5rem; /* 24px */\n --size-6_5: 1.625rem; /* 26px */\n --size-7: 1.75rem; /* 28px */\n --size-7_5: 1.875rem; /* 30px */\n --size-8: 2rem; /* 32px */\n --size-8_5: 2.125rem; /* 34px */\n --size-9: 2.25rem; /* 36px */\n --size-9_5: 2.375rem; /* 38px */\n --size-10: 2.5rem; /* 40px */\n --size-10_5: 2.625rem; /* 42px */\n --size-11: 2.75rem; /* 44px */\n --size-11_5: 2.875rem; /* 46px */\n --size-12: 3rem; /* 48px */\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --color-background: rgb(28, 28, 30);\n --color-font: white;\n --color-backdrop: rgb(44, 44, 46);\n --color-border-shadow: rgba(255, 255, 255, 0.145);\n\n --color-title-color: #fafafa;\n --color-stack-h6: rgb(200, 200, 204);\n --color-stack-headline: rgb(99, 99, 102);\n --color-stack-notes: #a9a9a9;\n --color-stack-subline: rgb(121, 121, 121);\n\n --color-accents-3: rgb(118, 118, 118);\n\n --color-text-background-red-1: #2a1e1e;\n }\n }\n\n .mono {\n font-family: var(--font-stack-monospace);\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-bottom: var(--size-gap);\n font-weight: 500;\n line-height: 1.5;\n }\n "
19
20
  ]);
20
21
  _templateObject = function() {
21
22
  return data;
@@ -24,7 +25,12 @@ function _templateObject() {
24
25
  }
25
26
  function Base() {
26
27
  return /*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
27
- children: (0, _nooptemplate.noop)(_templateObject())
28
+ children: (0, _nooptemplate.noop)(_templateObject(), // Although the style applied to the shadow host is isolated,
29
+ // the element that attached the shadow host (i.e. `nextjs-portal`)
30
+ // is still affected by the parent's style (e.g. `body`). This may
31
+ // occur style conflicts like `display: flex`, with other children
32
+ // elements therefore give the shadow host an absolute position.
33
+ 'position: absolute;')
28
34
  });
29
35
  }
30
36
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/styles/base.tsx"],"sourcesContent":["import * as React from 'react'\nimport { noop as css } from '../helpers/noop-template'\n\nexport function Base() {\n return (\n <style>\n {css`\n @import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;900&family=Geist+Mono:wght@400;900&display=swap');\n\n :host {\n --size-gap-half: 4px;\n --size-gap: 8px;\n --size-gap-double: 16px;\n --size-gap-triple: 24px;\n --size-gap-quad: 32px;\n\n --size-font-11: 11px;\n --size-font-smaller: 12px;\n --size-font-small: 14px;\n --size-font: 16px;\n --size-font-big: 20px;\n --size-font-bigger: 24px;\n\n --color-background: white;\n --color-font: #757575;\n --color-backdrop: rgba(17, 17, 17, 0.2);\n --color-border-shadow: rgba(0, 0, 0, 0.145);\n\n --color-title-color: #1f1f1f;\n --color-stack-h6: #222;\n --color-stack-headline: #666;\n --color-stack-subline: #999;\n --color-stack-notes: #777;\n\n --color-accents-1: #808080;\n --color-accents-2: #222222;\n --color-accents-3: #404040;\n\n --color-text-color-red-1: #ff5555;\n --color-text-background-red-1: #fff9f9;\n\n --font-stack-monospace: 'Geist Mono', 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --font-stack-sans: 'Geist', -apple-system, 'Source Sans Pro',\n sans-serif;\n\n font-family: var(--font-stack-sans);\n\n /* TODO: Remove replaced ones. */\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),\n 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);\n --shadow-none: 0 0 #0000;\n --shadow-menu: 0px 1px 1px rgba(0, 0, 0, 0.02),\n 0px 4px 8px -4px rgba(0, 0, 0, 0.04),\n 0px 16px 24px -8px rgba(0, 0, 0, 0.06);\n\n --rounded-none: 0px;\n --rounded-sm: 0.125rem; /* 2px */\n --rounded-md: 0.25rem; /* 4px */\n --rounded-lg: 0.5rem; /* 8px */\n --rounded-xl: 0.75rem; /* 12px */\n --rounded-2xl: 1rem; /* 16px */\n --rounded-3xl: 1.5rem; /* 24px */\n --rounded-full: 9999px;\n\n --size-0: 0px;\n --size-px: 1px;\n --size-0_5: 0.125rem; /* 2px */\n --size-1: 0.25rem; /* 4px */\n --size-1_5: 0.375rem; /* 6px */\n --size-2: 0.5rem; /* 8px */\n --size-2_5: 0.625rem; /* 10px */\n --size-3: 0.75rem; /* 12px */\n --size-3_5: 0.875rem; /* 14px */\n --size-4: 1rem; /* 16px */\n --size-4_5: 1.125rem; /* 18px */\n --size-5: 1.25rem; /* 20px */\n --size-5_5: 1.375rem; /* 22px */\n --size-6: 1.5rem; /* 24px */\n --size-6_5: 1.625rem; /* 26px */\n --size-7: 1.75rem; /* 28px */\n --size-7_5: 1.875rem; /* 30px */\n --size-8: 2rem; /* 32px */\n --size-8_5: 2.125rem; /* 34px */\n --size-9: 2.25rem; /* 36px */\n --size-9_5: 2.375rem; /* 38px */\n --size-10: 2.5rem; /* 40px */\n --size-10_5: 2.625rem; /* 42px */\n --size-11: 2.75rem; /* 44px */\n --size-11_5: 2.875rem; /* 46px */\n --size-12: 3rem; /* 48px */\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --color-background: rgb(28, 28, 30);\n --color-font: white;\n --color-backdrop: rgb(44, 44, 46);\n --color-border-shadow: rgba(255, 255, 255, 0.145);\n\n --color-title-color: #fafafa;\n --color-stack-h6: rgb(200, 200, 204);\n --color-stack-headline: rgb(99, 99, 102);\n --color-stack-notes: #a9a9a9;\n --color-stack-subline: rgb(121, 121, 121);\n\n --color-accents-3: rgb(118, 118, 118);\n\n --color-text-background-red-1: #2a1e1e;\n }\n }\n\n .mono {\n font-family: var(--font-stack-monospace);\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-bottom: var(--size-gap);\n font-weight: 500;\n line-height: 1.5;\n }\n `}\n </style>\n )\n}\n"],"names":["Base","style","css"],"mappings":";;;;+BAGgBA;;;eAAAA;;;;;;iEAHO;8BACK;;;;;;;;;;AAErB,SAASA;IACd,qBACE,qBAACC;sBACEC,kBAAG;;AAoIV"}
1
+ {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/styles/base.tsx"],"sourcesContent":["import * as React from 'react'\nimport { noop as css } from '../helpers/noop-template'\n\nexport function Base() {\n return (\n <style>\n {css`\n @import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;900&family=Geist+Mono:wght@400;900&display=swap');\n\n :host {\n ${\n // Although the style applied to the shadow host is isolated,\n // the element that attached the shadow host (i.e. `nextjs-portal`)\n // is still affected by the parent's style (e.g. `body`). This may\n // occur style conflicts like `display: flex`, with other children\n // elements therefore give the shadow host an absolute position.\n 'position: absolute;'\n }\n\n --size-gap-half: 4px;\n --size-gap: 8px;\n --size-gap-double: 16px;\n --size-gap-triple: 24px;\n --size-gap-quad: 32px;\n\n --size-font-11: 11px;\n --size-font-smaller: 12px;\n --size-font-small: 14px;\n --size-font: 16px;\n --size-font-big: 20px;\n --size-font-bigger: 24px;\n\n --color-background: white;\n --color-font: #757575;\n --color-backdrop: rgba(17, 17, 17, 0.2);\n --color-border-shadow: rgba(0, 0, 0, 0.145);\n\n --color-title-color: #1f1f1f;\n --color-stack-h6: #222;\n --color-stack-headline: #666;\n --color-stack-subline: #999;\n --color-stack-notes: #777;\n\n --color-accents-1: #808080;\n --color-accents-2: #222222;\n --color-accents-3: #404040;\n\n --color-text-color-red-1: #ff5555;\n --color-text-background-red-1: #fff9f9;\n\n --font-stack-monospace: 'Geist Mono', 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --font-stack-sans: 'Geist', -apple-system, 'Source Sans Pro',\n sans-serif;\n\n font-family: var(--font-stack-sans);\n\n /* TODO: Remove replaced ones. */\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),\n 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);\n --shadow-none: 0 0 #0000;\n\n --shadow-small: 0px 2px 2px rgba(0, 0, 0, 0.04);\n --shadow-menu: 0px 1px 1px rgba(0, 0, 0, 0.02),\n 0px 4px 8px -4px rgba(0, 0, 0, 0.04),\n 0px 16px 24px -8px rgba(0, 0, 0, 0.06);\n\n --rounded-none: 0px;\n --rounded-sm: 0.125rem; /* 2px */\n --rounded-md: 0.25rem; /* 4px */\n --rounded-lg: 0.5rem; /* 8px */\n --rounded-xl: 0.75rem; /* 12px */\n --rounded-2xl: 1rem; /* 16px */\n --rounded-3xl: 1.5rem; /* 24px */\n --rounded-full: 9999px;\n\n --size-0: 0px;\n --size-px: 1px;\n --size-0_5: 0.125rem; /* 2px */\n --size-1: 0.25rem; /* 4px */\n --size-1_5: 0.375rem; /* 6px */\n --size-2: 0.5rem; /* 8px */\n --size-2_5: 0.625rem; /* 10px */\n --size-3: 0.75rem; /* 12px */\n --size-3_5: 0.875rem; /* 14px */\n --size-4: 1rem; /* 16px */\n --size-4_5: 1.125rem; /* 18px */\n --size-5: 1.25rem; /* 20px */\n --size-5_5: 1.375rem; /* 22px */\n --size-6: 1.5rem; /* 24px */\n --size-6_5: 1.625rem; /* 26px */\n --size-7: 1.75rem; /* 28px */\n --size-7_5: 1.875rem; /* 30px */\n --size-8: 2rem; /* 32px */\n --size-8_5: 2.125rem; /* 34px */\n --size-9: 2.25rem; /* 36px */\n --size-9_5: 2.375rem; /* 38px */\n --size-10: 2.5rem; /* 40px */\n --size-10_5: 2.625rem; /* 42px */\n --size-11: 2.75rem; /* 44px */\n --size-11_5: 2.875rem; /* 46px */\n --size-12: 3rem; /* 48px */\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --color-background: rgb(28, 28, 30);\n --color-font: white;\n --color-backdrop: rgb(44, 44, 46);\n --color-border-shadow: rgba(255, 255, 255, 0.145);\n\n --color-title-color: #fafafa;\n --color-stack-h6: rgb(200, 200, 204);\n --color-stack-headline: rgb(99, 99, 102);\n --color-stack-notes: #a9a9a9;\n --color-stack-subline: rgb(121, 121, 121);\n\n --color-accents-3: rgb(118, 118, 118);\n\n --color-text-background-red-1: #2a1e1e;\n }\n }\n\n .mono {\n font-family: var(--font-stack-monospace);\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-bottom: var(--size-gap);\n font-weight: 500;\n line-height: 1.5;\n }\n `}\n </style>\n )\n}\n"],"names":["Base","style","css"],"mappings":";;;;+BAGgBA;;;eAAAA;;;;;;iEAHO;8BACK;;;;;;;;;;;AAErB,SAASA;IACd,qBACE,qBAACC;sBACEC,kBAAG,qBAKE,6DAA6D;QAC7D,mEAAmE;QACnE,kEAAkE;QAClE,kEAAkE;QAClE,gEAAgE;QAChE;;AAqIZ"}
@@ -24,8 +24,8 @@ const _useerrorhook = require("../internal/container/runtime-error/use-error-hoo
24
24
  function ReactDevOverlay(param) {
25
25
  let { children } = param;
26
26
  const { isMounted, state, onComponentError, hasRuntimeErrors, hasBuildError } = (0, _hooks.usePagesReactDevOverlay)();
27
- const { readyErrors } = (0, _useerrorhook.useErrorHook)({
28
- errors: state.errors,
27
+ const { readyErrors, totalErrorCount } = (0, _useerrorhook.useErrorHook)({
28
+ state,
29
29
  isAppDir: false
30
30
  });
31
31
  const [isErrorOverlayOpen, setIsErrorOverlayOpen] = (0, _react.useState)(true);
@@ -44,7 +44,7 @@ function ReactDevOverlay(param) {
44
44
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_componentstyles.ComponentStyles, {}),
45
45
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_devtoolsindicator.DevToolsIndicator, {
46
46
  state: state,
47
- readyErrorsLength: readyErrors.length,
47
+ errorCount: totalErrorCount,
48
48
  setIsErrorOverlayOpen: setIsErrorOverlayOpen
49
49
  }),
50
50
  (hasRuntimeErrors || hasBuildError) && /*#__PURE__*/ (0, _jsxruntime.jsx)(_erroroverlay.ErrorOverlay, {