next 15.2.0-canary.51 → 15.2.0-canary.52
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.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/load-jsconfig.d.ts +1 -0
- package/dist/build/load-jsconfig.js +2 -1
- package/dist/build/load-jsconfig.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack-config.d.ts +3 -1
- package/dist/build/webpack-config.js +44 -23
- package/dist/build/webpack-config.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/components/errors/attach-hydration-error-state.js +37 -24
- package/dist/client/components/errors/attach-hydration-error-state.js.map +1 -1
- package/dist/client/components/errors/hydration-error-info.js +86 -19
- package/dist/client/components/errors/hydration-error-info.js.map +1 -1
- package/dist/client/components/is-hydration-error.d.ts +1 -0
- package/dist/client/components/is-hydration-error.js +41 -3
- package/dist/client/components/is-hydration-error.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js +1 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.d.ts +1 -56
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js +4 -240
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.stories.js +0 -21
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/hydration-diff/diff-view.d.ts +54 -0
- package/dist/client/components/react-dev-overlay/hydration-diff/diff-view.js +101 -0
- package/dist/client/components/react-dev-overlay/hydration-diff/diff-view.js.map +1 -0
- package/dist/client/components/react-dev-overlay/internal/container/Errors.js +1 -2
- package/dist/client/components/react-dev-overlay/internal/container/Errors.js.map +1 -1
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.d.ts +2 -56
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.js +28 -227
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.js.map +1 -1
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/index.js +1 -1
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/index.js.map +1 -1
- package/dist/client/components/react-dev-overlay/internal/styles/ComponentStyles.js +3 -1
- package/dist/client/components/react-dev-overlay/internal/styles/ComponentStyles.js.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +6 -6
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/load-jsconfig.js +2 -1
- package/dist/esm/build/load-jsconfig.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack-config.js +44 -23
- package/dist/esm/build/webpack-config.js.map +1 -1
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/components/errors/attach-hydration-error-state.js +38 -25
- package/dist/esm/client/components/errors/attach-hydration-error-state.js.map +1 -1
- package/dist/esm/client/components/errors/hydration-error-info.js +87 -20
- package/dist/esm/client/components/errors/hydration-error-info.js.map +1 -1
- package/dist/esm/client/components/is-hydration-error.js +36 -2
- package/dist/esm/client/components/is-hydration-error.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js +1 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js +3 -287
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.stories.js +0 -21
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/hydration-diff/diff-view.js +132 -0
- package/dist/esm/client/components/react-dev-overlay/hydration-diff/diff-view.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/internal/container/Errors.js +1 -2
- package/dist/esm/client/components/react-dev-overlay/internal/container/Errors.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.js +12 -271
- package/dist/esm/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/container/RuntimeError/index.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/container/RuntimeError/index.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/styles/ComponentStyles.js +3 -1
- package/dist/esm/client/components/react-dev-overlay/internal/styles/ComponentStyles.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/config.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/container/Errors.tsx"],"sourcesContent":["import { useState, useEffect, useMemo, useCallback, Suspense } from 'react'\nimport {\n ACTION_UNHANDLED_ERROR,\n ACTION_UNHANDLED_REJECTION,\n type UnhandledErrorAction,\n type UnhandledRejectionAction,\n} from '../../shared'\nimport type { DebugInfo } from '../../types'\nimport {\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n} from '../components/Dialog'\nimport { LeftRightDialogHeader } from '../components/LeftRightDialogHeader'\nimport { Overlay } from '../components/Overlay'\nimport { Toast } from '../components/Toast'\nimport { getErrorByType } from '../helpers/get-error-by-type'\nimport type { ReadyRuntimeError } from '../helpers/get-error-by-type'\nimport { noop as css } from '../helpers/noop-template'\nimport { CloseIcon } from '../icons/CloseIcon'\nimport { RuntimeError } from './RuntimeError'\nimport { VersionStalenessInfo } from '../components/VersionStalenessInfo'\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 './RuntimeError/component-stack-pseudo-html'\nimport {\n type HydrationErrorState,\n getHydrationWarningType,\n} from '../../../errors/hydration-error-info'\nimport { NodejsInspectorCopyButton } from '../components/nodejs-inspector'\nimport { CopyButton } from '../components/copy-button'\nimport {\n getUnhandledErrorType,\n isUnhandledConsoleOrRejection,\n} from '../../../errors/console-error'\nimport { extractNextErrorCode } from '../../../../../lib/error-telemetry-utils'\n\nexport type SupportedErrorEvent = {\n id: number\n event: UnhandledErrorAction | UnhandledRejectionAction\n}\nexport type ErrorsProps = {\n isAppDir: boolean\n errors: SupportedErrorEvent[]\n initialDisplayState: DisplayState\n versionInfo?: VersionInfo\n hasStaticIndicator?: boolean\n debugInfo?: DebugInfo\n}\n\ntype ReadyErrorEvent = ReadyRuntimeError\n\ntype DisplayState = 'minimized' | 'fullscreen' | 'hidden'\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\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\n return ''\n}\n\nexport function Errors({\n isAppDir,\n errors,\n initialDisplayState,\n versionInfo,\n hasStaticIndicator,\n debugInfo,\n}: ErrorsProps) {\n const [lookups, setLookups] = useState(\n {} as { [eventId: string]: ReadyErrorEvent }\n )\n\n const [readyErrors, nextError] = useMemo<\n [ReadyErrorEvent[], SupportedErrorEvent | null]\n >(() => {\n let ready: ReadyErrorEvent[] = []\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 const isLoading = useMemo<boolean>(() => {\n return readyErrors.length < 1 && Boolean(errors.length)\n }, [errors.length, readyErrors.length])\n\n useEffect(() => {\n if (nextError == null) {\n return\n }\n\n let mounted = true\n getErrorByType(nextError, isAppDir).then((resolved) => {\n if (mounted) {\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 setLookups((m) => ({ ...m, [resolved.id]: resolved }))\n }\n })\n\n return () => {\n mounted = false\n }\n }, [nextError, isAppDir])\n\n const [displayState, setDisplayState] =\n useState<DisplayState>(initialDisplayState)\n const [activeIdx, setActiveIndex] = useState<number>(0)\n const previous = useCallback(\n () => setActiveIndex((v) => Math.max(0, v - 1)),\n []\n )\n const next = useCallback(\n () =>\n setActiveIndex((v) =>\n Math.max(0, Math.min(readyErrors.length - 1, v + 1))\n ),\n [readyErrors.length]\n )\n\n const activeError = useMemo<ReadyErrorEvent | null>(\n () => readyErrors[activeIdx] ?? null,\n [activeIdx, readyErrors]\n )\n\n // Reset component state when there are no errors to be displayed.\n // This should never happen, but lets handle it.\n useEffect(() => {\n if (errors.length < 1) {\n setLookups({})\n setDisplayState('hidden')\n setActiveIndex(0)\n }\n }, [errors.length])\n\n const minimize = useCallback(() => setDisplayState('minimized'), [])\n const hide = useCallback(() => setDisplayState('hidden'), [])\n const fullscreen = useCallback(() => setDisplayState('fullscreen'), [])\n\n // This component shouldn't be rendered with no errors, but if it is, let's\n // handle it gracefully by rendering nothing.\n if (errors.length < 1 || activeError == null) {\n return null\n }\n\n if (isLoading) {\n // TODO: better loading state\n return <Overlay />\n }\n\n if (displayState === 'hidden') {\n return null\n }\n\n if (displayState === 'minimized') {\n return (\n <Toast\n data-nextjs-toast\n data-issues\n className={`nextjs-toast-errors-parent${hasStaticIndicator ? ' nextjs-error-with-static' : ''}`}\n onClick={fullscreen}\n >\n <div className=\"nextjs-toast-errors\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line>\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>\n </svg>\n <span>\n <span data-issues-count>{readyErrors.length}</span> issue\n {readyErrors.length > 1 ? 's' : ''}\n </span>\n <button\n data-nextjs-toast-errors-hide-button\n className=\"nextjs-toast-hide-button\"\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n hide()\n }}\n aria-label=\"Hide Issues\"\n >\n <CloseIcon />\n </button>\n </div>\n </Toast>\n )\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 return (\n <Overlay>\n <Dialog\n type=\"error\"\n aria-labelledby=\"nextjs__container_errors_label\"\n aria-describedby=\"nextjs__container_errors_desc\"\n onClose={isServerError ? undefined : minimize}\n >\n <DialogContent>\n <DialogHeader className=\"nextjs-container-errors-header\">\n <LeftRightDialogHeader\n previous={activeIdx > 0 ? previous : null}\n next={activeIdx < readyErrors.length - 1 ? next : null}\n close={isServerError ? undefined : minimize}\n >\n <small>\n <span>{activeIdx + 1}</span> of{' '}\n <span data-nextjs-dialog-header-total-count>\n {readyErrors.length}\n </span>\n {' issue'}\n {readyErrors.length < 2 ? '' : 's'}\n </small>\n <VersionStalenessInfo versionInfo={versionInfo} />\n </LeftRightDialogHeader>\n\n <div\n className=\"nextjs__container_errors__error_title\"\n data-nextjs-error-code={extractNextErrorCode(error)} // allow assertion in tests before error rating is implemented\n >\n <h1\n id=\"nextjs__container_errors_label\"\n className=\"nextjs__container_errors_label\"\n >\n {isServerError\n ? 'Server Error'\n : isUnhandledError\n ? 'Console Error'\n : 'Unhandled Runtime Error'}\n </h1>\n <span>\n <CopyButton\n data-nextjs-data-runtime-error-copy-stack\n actionLabel=\"Copy error stack\"\n successLabel=\"Copied\"\n content={error.stack || ''}\n disabled={!error.stack}\n />\n\n <NodejsInspectorCopyButton\n devtoolsFrontendUrl={debugInfo?.devtoolsFrontendUrl}\n />\n </span>\n </div>\n <p\n id=\"nextjs__container_errors_desc\"\n className=\"nextjs__container_errors_desc\"\n >\n <ErrorDescription\n error={error}\n hydrationWarning={hydrationWarning}\n />\n </p>\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\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 {isServerError ? (\n <div>\n <small>\n This error happened while generating the page. Any console\n logs will be displayed in the terminal window.\n </small>\n </div>\n ) : undefined}\n </DialogHeader>\n <Suspense fallback={<div data-nextjs-error-suspended />}>\n <DialogBody className=\"nextjs-container-errors-body\">\n <RuntimeError\n key={activeError.id.toString()}\n error={activeError}\n />\n </DialogBody>\n </Suspense>\n </DialogContent>\n </Dialog>\n </Overlay>\n )\n}\n\nexport const styles = css`\n .nextjs-error-with-static {\n bottom: calc(var(--size-gap-double) * 4.5);\n }\n .nextjs-container-errors-header {\n position: relative;\n }\n .nextjs-container-errors-header > h1 {\n font-size: var(--size-font-big);\n line-height: var(--size-font-bigger);\n font-weight: bold;\n margin: calc(var(--size-gap-double) * 1.5) 0;\n color: var(--color-title-h1);\n }\n .nextjs-container-errors-header small {\n font-size: var(--size-font-small);\n color: var(--color-accents-1);\n margin-left: var(--size-gap-double);\n }\n .nextjs-container-errors-header small > span {\n font-family: var(--font-stack-monospace);\n }\n .nextjs-container-errors-header p {\n font-size: var(--size-font-small);\n line-height: var(--size-font-big);\n white-space: pre-wrap;\n }\n .nextjs__container_errors_desc {\n font-family: var(--font-stack-monospace);\n padding: var(--size-gap) var(--size-gap-double);\n border-left: 2px solid var(--color-text-color-red-1);\n margin-top: var(--size-gap);\n font-weight: bold;\n color: var(--color-text-color-red-1);\n background-color: var(--color-text-background-red-1);\n }\n p.nextjs__container_errors__link {\n margin: var(--size-gap-double) auto;\n color: var(--color-text-color-red-1);\n font-weight: 600;\n font-size: 15px;\n }\n p.nextjs__container_errors__notes {\n margin: var(--size-gap-double) auto;\n color: var(--color-stack-notes);\n font-weight: 600;\n font-size: 15px;\n }\n .nextjs-container-errors-header > div > small {\n margin: 0;\n margin-top: var(--size-gap-half);\n }\n .nextjs-container-errors-header > p > a {\n color: inherit;\n font-weight: bold;\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__container_errors__component-stack {\n padding: 12px 32px;\n color: var(--color-ansi-fg);\n background: var(--color-ansi-bg);\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-header\n > .nextjs-container-build-error-version-status {\n position: absolute;\n top: 0;\n right: 0;\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 }\n .nextjs-data-runtime-error-inspect-link,\n .nextjs-data-runtime-error-inspect-link:hover {\n margin: 0 8px;\n color: inherit;\n }\n`\n"],"names":["Errors","styles","isNextjsLink","text","startsWith","ErrorDescription","error","hydrationWarning","isUnhandledOrReplayError","isUnhandledConsoleOrRejection","unhandledErrorType","getUnhandledErrorType","isConsoleErrorStringMessage","title","name","environmentName","envPrefix","HotlinkedText","message","matcher","getErrorSignature","ev","event","type","ACTION_UNHANDLED_ERROR","ACTION_UNHANDLED_REJECTION","reason","stack","_","isAppDir","errors","initialDisplayState","versionInfo","hasStaticIndicator","debugInfo","activeError","lookups","setLookups","useState","readyErrors","nextError","useMemo","ready","next","idx","length","e","id","push","prev","isLoading","Boolean","useEffect","mounted","getErrorByType","then","resolved","m","displayState","setDisplayState","activeIdx","setActiveIndex","previous","useCallback","v","Math","max","min","minimize","hide","fullscreen","Overlay","Toast","data-nextjs-toast","data-issues","className","onClick","div","svg","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","circle","cx","cy","r","line","x1","y1","x2","y2","span","data-issues-count","button","data-nextjs-toast-errors-hide-button","stopPropagation","aria-label","CloseIcon","isServerError","includes","getErrorSource","isUnhandledError","errorDetails","details","notes","warningTemplate","serverContent","clientContent","warning","hydrationErrorType","getHydrationWarningType","replace","Dialog","aria-labelledby","aria-describedby","onClose","undefined","DialogContent","DialogHeader","LeftRightDialogHeader","close","small","data-nextjs-dialog-header-total-count","VersionStalenessInfo","data-nextjs-error-code","extractNextErrorCode","h1","CopyButton","data-nextjs-data-runtime-error-copy-stack","actionLabel","successLabel","content","disabled","NodejsInspectorCopyButton","devtoolsFrontendUrl","p","componentStackFrames","reactOutputComponentDiff","PseudoHtmlDiff","hydrationMismatchType","firstContent","secondContent","Suspense","fallback","data-nextjs-error-suspended","DialogBody","RuntimeError","toString","css"],"mappings":";;;;;;;;;;;;;;;IAkHgBA,MAAM;eAANA;;IA0SHC,MAAM;eAANA;;;;;uBA5ZuD;wBAM7D;wBAOA;uCAC+B;yBACd;uBACF;gCACS;8BAEH;2BACF;8BACG;sCACQ;6BAEN;+BACD;0CACC;oCAIxB;iCACmC;4BACf;8BAIpB;qCAC8B;;;;;;;;;;AAmBrC,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;IAC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2G,oBAAoB,IAAI,EAAE;gCAC5DI,cAAclC;gCACdmC,eAAelC;gCACf8B,0BAA0BnC,aAAamC,wBAAwB;iCAE/D;4BACHvC,8BACC,qBAAC3B;0CACC,cAAA,qBAACkD;8CAAM;;iCAKPL;;;kCAEN,qBAAC0B,eAAQ;wBAACC,wBAAU,qBAACxE;4BAAIyE,6BAA2B;;kCAClD,cAAA,qBAACC,kBAAU;4BAAC5E,WAAU;sCACpB,cAAA,qBAAC6E,0BAAY;gCAEXlJ,OAAO6B;+BADFA,YAAYY,EAAE,CAAC0G,QAAQ;;;;;;;AAS5C;AAEO,MAAMxJ,aAASyJ,kBAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/container/Errors.tsx"],"sourcesContent":["import { useState, useEffect, useMemo, useCallback, Suspense } from 'react'\nimport {\n ACTION_UNHANDLED_ERROR,\n ACTION_UNHANDLED_REJECTION,\n type UnhandledErrorAction,\n type UnhandledRejectionAction,\n} from '../../shared'\nimport type { DebugInfo } from '../../types'\nimport {\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n} from '../components/Dialog'\nimport { LeftRightDialogHeader } from '../components/LeftRightDialogHeader'\nimport { Overlay } from '../components/Overlay'\nimport { Toast } from '../components/Toast'\nimport { getErrorByType } from '../helpers/get-error-by-type'\nimport type { ReadyRuntimeError } from '../helpers/get-error-by-type'\nimport { noop as css } from '../helpers/noop-template'\nimport { CloseIcon } from '../icons/CloseIcon'\nimport { RuntimeError } from './RuntimeError'\nimport { VersionStalenessInfo } from '../components/VersionStalenessInfo'\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 './RuntimeError/component-stack-pseudo-html'\nimport {\n type HydrationErrorState,\n getHydrationWarningType,\n} from '../../../errors/hydration-error-info'\nimport { NodejsInspectorCopyButton } from '../components/nodejs-inspector'\nimport { CopyButton } from '../components/copy-button'\nimport {\n getUnhandledErrorType,\n isUnhandledConsoleOrRejection,\n} from '../../../errors/console-error'\nimport { extractNextErrorCode } from '../../../../../lib/error-telemetry-utils'\n\nexport type SupportedErrorEvent = {\n id: number\n event: UnhandledErrorAction | UnhandledRejectionAction\n}\nexport type ErrorsProps = {\n isAppDir: boolean\n errors: SupportedErrorEvent[]\n initialDisplayState: DisplayState\n versionInfo?: VersionInfo\n hasStaticIndicator?: boolean\n debugInfo?: DebugInfo\n}\n\ntype ReadyErrorEvent = ReadyRuntimeError\n\ntype DisplayState = 'minimized' | 'fullscreen' | 'hidden'\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\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\n return ''\n}\n\nexport function Errors({\n isAppDir,\n errors,\n initialDisplayState,\n versionInfo,\n hasStaticIndicator,\n debugInfo,\n}: ErrorsProps) {\n const [lookups, setLookups] = useState(\n {} as { [eventId: string]: ReadyErrorEvent }\n )\n\n const [readyErrors, nextError] = useMemo<\n [ReadyErrorEvent[], SupportedErrorEvent | null]\n >(() => {\n let ready: ReadyErrorEvent[] = []\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 const isLoading = useMemo<boolean>(() => {\n return readyErrors.length < 1 && Boolean(errors.length)\n }, [errors.length, readyErrors.length])\n\n useEffect(() => {\n if (nextError == null) {\n return\n }\n\n let mounted = true\n getErrorByType(nextError, isAppDir).then((resolved) => {\n if (mounted) {\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 setLookups((m) => ({ ...m, [resolved.id]: resolved }))\n }\n })\n\n return () => {\n mounted = false\n }\n }, [nextError, isAppDir])\n\n const [displayState, setDisplayState] =\n useState<DisplayState>(initialDisplayState)\n const [activeIdx, setActiveIndex] = useState<number>(0)\n const previous = useCallback(\n () => setActiveIndex((v) => Math.max(0, v - 1)),\n []\n )\n const next = useCallback(\n () =>\n setActiveIndex((v) =>\n Math.max(0, Math.min(readyErrors.length - 1, v + 1))\n ),\n [readyErrors.length]\n )\n\n const activeError = useMemo<ReadyErrorEvent | null>(\n () => readyErrors[activeIdx] ?? null,\n [activeIdx, readyErrors]\n )\n\n // Reset component state when there are no errors to be displayed.\n // This should never happen, but lets handle it.\n useEffect(() => {\n if (errors.length < 1) {\n setLookups({})\n setDisplayState('hidden')\n setActiveIndex(0)\n }\n }, [errors.length])\n\n const minimize = useCallback(() => setDisplayState('minimized'), [])\n const hide = useCallback(() => setDisplayState('hidden'), [])\n const fullscreen = useCallback(() => setDisplayState('fullscreen'), [])\n\n // This component shouldn't be rendered with no errors, but if it is, let's\n // handle it gracefully by rendering nothing.\n if (errors.length < 1 || activeError == null) {\n return null\n }\n\n if (isLoading) {\n // TODO: better loading state\n return <Overlay />\n }\n\n if (displayState === 'hidden') {\n return null\n }\n\n if (displayState === 'minimized') {\n return (\n <Toast\n data-nextjs-toast\n data-issues\n className={`nextjs-toast-errors-parent${hasStaticIndicator ? ' nextjs-error-with-static' : ''}`}\n onClick={fullscreen}\n >\n <div className=\"nextjs-toast-errors\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line>\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>\n </svg>\n <span>\n <span data-issues-count>{readyErrors.length}</span> issue\n {readyErrors.length > 1 ? 's' : ''}\n </span>\n <button\n data-nextjs-toast-errors-hide-button\n className=\"nextjs-toast-hide-button\"\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n hide()\n }}\n aria-label=\"Hide Issues\"\n >\n <CloseIcon />\n </button>\n </div>\n </Toast>\n )\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 return (\n <Overlay>\n <Dialog\n type=\"error\"\n aria-labelledby=\"nextjs__container_errors_label\"\n aria-describedby=\"nextjs__container_errors_desc\"\n onClose={isServerError ? undefined : minimize}\n >\n <DialogContent>\n <DialogHeader className=\"nextjs-container-errors-header\">\n <LeftRightDialogHeader\n previous={activeIdx > 0 ? previous : null}\n next={activeIdx < readyErrors.length - 1 ? next : null}\n close={isServerError ? undefined : minimize}\n >\n <small>\n <span>{activeIdx + 1}</span> of{' '}\n <span data-nextjs-dialog-header-total-count>\n {readyErrors.length}\n </span>\n {' issue'}\n {readyErrors.length < 2 ? '' : 's'}\n </small>\n <VersionStalenessInfo versionInfo={versionInfo} />\n </LeftRightDialogHeader>\n\n <div\n className=\"nextjs__container_errors__error_title\"\n data-nextjs-error-code={extractNextErrorCode(error)} // allow assertion in tests before error rating is implemented\n >\n <h1\n id=\"nextjs__container_errors_label\"\n className=\"nextjs__container_errors_label\"\n >\n {isServerError\n ? 'Server Error'\n : isUnhandledError\n ? 'Console Error'\n : 'Unhandled Runtime Error'}\n </h1>\n <span>\n <CopyButton\n data-nextjs-data-runtime-error-copy-stack\n actionLabel=\"Copy error stack\"\n successLabel=\"Copied\"\n content={error.stack || ''}\n disabled={!error.stack}\n />\n\n <NodejsInspectorCopyButton\n devtoolsFrontendUrl={debugInfo?.devtoolsFrontendUrl}\n />\n </span>\n </div>\n <p\n id=\"nextjs__container_errors_desc\"\n className=\"nextjs__container_errors_desc\"\n >\n <ErrorDescription\n error={error}\n hydrationWarning={hydrationWarning}\n />\n </p>\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\n {hydrationWarning &&\n (activeError.componentStackFrames?.length ||\n !!errorDetails.reactOutputComponentDiff) ? (\n <PseudoHtmlDiff\n className=\"nextjs__container_errors__component-stack\"\n hydrationMismatchType={hydrationErrorType}\n firstContent={serverContent}\n secondContent={clientContent}\n reactOutputComponentDiff={\n errorDetails.reactOutputComponentDiff || ''\n }\n />\n ) : null}\n {isServerError ? (\n <div>\n <small>\n This error happened while generating the page. Any console\n logs will be displayed in the terminal window.\n </small>\n </div>\n ) : undefined}\n </DialogHeader>\n <Suspense fallback={<div data-nextjs-error-suspended />}>\n <DialogBody className=\"nextjs-container-errors-body\">\n <RuntimeError\n key={activeError.id.toString()}\n error={activeError}\n />\n </DialogBody>\n </Suspense>\n </DialogContent>\n </Dialog>\n </Overlay>\n )\n}\n\nexport const styles = css`\n .nextjs-error-with-static {\n bottom: calc(var(--size-gap-double) * 4.5);\n }\n .nextjs-container-errors-header {\n position: relative;\n }\n .nextjs-container-errors-header > h1 {\n font-size: var(--size-font-big);\n line-height: var(--size-font-bigger);\n font-weight: bold;\n margin: calc(var(--size-gap-double) * 1.5) 0;\n color: var(--color-title-h1);\n }\n .nextjs-container-errors-header small {\n font-size: var(--size-font-small);\n color: var(--color-accents-1);\n margin-left: var(--size-gap-double);\n }\n .nextjs-container-errors-header small > span {\n font-family: var(--font-stack-monospace);\n }\n .nextjs-container-errors-header p {\n font-size: var(--size-font-small);\n line-height: var(--size-font-big);\n white-space: pre-wrap;\n }\n .nextjs__container_errors_desc {\n font-family: var(--font-stack-monospace);\n padding: var(--size-gap) var(--size-gap-double);\n border-left: 2px solid var(--color-text-color-red-1);\n margin-top: var(--size-gap);\n font-weight: bold;\n color: var(--color-text-color-red-1);\n background-color: var(--color-text-background-red-1);\n }\n p.nextjs__container_errors__link {\n margin: var(--size-gap-double) auto;\n color: var(--color-text-color-red-1);\n font-weight: 600;\n font-size: 15px;\n }\n p.nextjs__container_errors__notes {\n margin: var(--size-gap-double) auto;\n color: var(--color-stack-notes);\n font-weight: 600;\n font-size: 15px;\n }\n .nextjs-container-errors-header > div > small {\n margin: 0;\n margin-top: var(--size-gap-half);\n }\n .nextjs-container-errors-header > p > a {\n color: inherit;\n font-weight: bold;\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__container_errors__component-stack {\n padding: 12px 32px;\n color: var(--color-ansi-fg);\n background: var(--color-ansi-bg);\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-header\n > .nextjs-container-build-error-version-status {\n position: absolute;\n top: 0;\n right: 0;\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 }\n .nextjs-data-runtime-error-inspect-link,\n .nextjs-data-runtime-error-inspect-link:hover {\n margin: 0 8px;\n color: inherit;\n }\n`\n"],"names":["Errors","styles","isNextjsLink","text","startsWith","ErrorDescription","error","hydrationWarning","isUnhandledOrReplayError","isUnhandledConsoleOrRejection","unhandledErrorType","getUnhandledErrorType","isConsoleErrorStringMessage","title","name","environmentName","envPrefix","HotlinkedText","message","matcher","getErrorSignature","ev","event","type","ACTION_UNHANDLED_ERROR","ACTION_UNHANDLED_REJECTION","reason","stack","_","isAppDir","errors","initialDisplayState","versionInfo","hasStaticIndicator","debugInfo","activeError","lookups","setLookups","useState","readyErrors","nextError","useMemo","ready","next","idx","length","e","id","push","prev","isLoading","Boolean","useEffect","mounted","getErrorByType","then","resolved","m","displayState","setDisplayState","activeIdx","setActiveIndex","previous","useCallback","v","Math","max","min","minimize","hide","fullscreen","Overlay","Toast","data-nextjs-toast","data-issues","className","onClick","div","svg","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","circle","cx","cy","r","line","x1","y1","x2","y2","span","data-issues-count","button","data-nextjs-toast-errors-hide-button","stopPropagation","aria-label","CloseIcon","isServerError","includes","getErrorSource","isUnhandledError","errorDetails","details","notes","warningTemplate","serverContent","clientContent","warning","hydrationErrorType","getHydrationWarningType","replace","Dialog","aria-labelledby","aria-describedby","onClose","undefined","DialogContent","DialogHeader","LeftRightDialogHeader","close","small","data-nextjs-dialog-header-total-count","VersionStalenessInfo","data-nextjs-error-code","extractNextErrorCode","h1","CopyButton","data-nextjs-data-runtime-error-copy-stack","actionLabel","successLabel","content","disabled","NodejsInspectorCopyButton","devtoolsFrontendUrl","p","componentStackFrames","reactOutputComponentDiff","PseudoHtmlDiff","hydrationMismatchType","firstContent","secondContent","Suspense","fallback","data-nextjs-error-suspended","DialogBody","RuntimeError","toString","css"],"mappings":";;;;;;;;;;;;;;;IAkHgBA,MAAM;eAANA;;IA2SHC,MAAM;eAANA;;;;;uBA7ZuD;wBAM7D;wBAOA;uCAC+B;yBACd;uBACF;gCACS;8BAEH;2BACF;8BACG;sCACQ;6BAEN;+BACD;0CACC;oCAIxB;iCACmC;4BACf;8BAIpB;qCAC8B;;;;;;;;;;AAmBrC,SAASC,aAAaC,IAA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sI;gCACC9F,IAAG;gCACH4B,WAAU;0CAEV,cAAA,qBAAC1D,4BAAa;oCAACd,MAAK;;iCAEpB;4BAEHI,oBACA4B,CAAAA,EAAAA,oCAAAA,YAAY2G,oBAAoB,qBAAhC3G,kCAAkCU,MAAM,KACvC,CAAC,CAAC+D,aAAamC,wBAAwB,AAAD,kBACtC,qBAACC,wCAAc;gCACbrE,WAAU;gCACVsE,uBAAuB9B;gCACvB+B,cAAclC;gCACdmC,eAAelC;gCACf8B,0BACEnC,aAAamC,wBAAwB,IAAI;iCAG3C;4BACHvC,8BACC,qBAAC3B;0CACC,cAAA,qBAACkD;8CAAM;;iCAKPL;;;kCAEN,qBAAC0B,eAAQ;wBAACC,wBAAU,qBAACxE;4BAAIyE,6BAA2B;;kCAClD,cAAA,qBAACC,kBAAU;4BAAC5E,WAAU;sCACpB,cAAA,qBAAC6E,0BAAY;gCAEXlJ,OAAO6B;+BADFA,YAAYY,EAAE,CAAC0G,QAAQ;;;;;;;AAS5C;AAEO,MAAMxJ,aAASyJ,kBAAG"}
|
|
@@ -1,56 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Format component stack into pseudo HTML
|
|
5
|
-
* component stack is an array of strings, e.g.: ['p', 'p', 'Page', ...]
|
|
6
|
-
*
|
|
7
|
-
* For html tags mismatch, it will render it for the code block
|
|
8
|
-
*
|
|
9
|
-
* ```
|
|
10
|
-
* <pre>
|
|
11
|
-
* <code>{`
|
|
12
|
-
* <Page>
|
|
13
|
-
* <p red>
|
|
14
|
-
* <p red>
|
|
15
|
-
* `}</code>
|
|
16
|
-
* </pre>
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* For text mismatch, it will render it for the code block
|
|
20
|
-
*
|
|
21
|
-
* ```
|
|
22
|
-
* <pre>
|
|
23
|
-
* <code>{`
|
|
24
|
-
* <Page>
|
|
25
|
-
* <p>
|
|
26
|
-
* "Server Text" (green)
|
|
27
|
-
* "Client Text" (red)
|
|
28
|
-
* </p>
|
|
29
|
-
* </Page>
|
|
30
|
-
* `}</code>
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* For bad text under a tag it will render it for the code block,
|
|
34
|
-
* e.g. "Mismatched Text" under <p>
|
|
35
|
-
*
|
|
36
|
-
* ```
|
|
37
|
-
* <pre>
|
|
38
|
-
* <code>{`
|
|
39
|
-
* <Page>
|
|
40
|
-
* <div>
|
|
41
|
-
* <p>
|
|
42
|
-
* "Mismatched Text" (red)
|
|
43
|
-
* </p>
|
|
44
|
-
* </div>
|
|
45
|
-
* </Page>
|
|
46
|
-
* `}</code>
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
|
-
export declare function PseudoHtmlDiff({ componentStackFrames, firstContent, secondContent, hydrationMismatchType, reactOutputComponentDiff, ...props }: {
|
|
51
|
-
componentStackFrames: ComponentStackFrame[];
|
|
52
|
-
firstContent: string;
|
|
53
|
-
secondContent: string;
|
|
54
|
-
reactOutputComponentDiff: string | undefined;
|
|
55
|
-
hydrationMismatchType: 'tag' | 'text' | 'text-in-tag';
|
|
56
|
-
} & React.HTMLAttributes<HTMLPreElement>): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export { PseudoHtmlDiff } from '../../../hydration-diff/diff-view';
|
|
2
|
+
export declare const styles: string;
|
|
@@ -2,237 +2,38 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return PseudoHtmlDiff;
|
|
9
|
-
}
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
PseudoHtmlDiff: null,
|
|
7
|
+
styles: null
|
|
10
8
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'data-nextjs-container-errors-pseudo-html--tag-adjacent': isAdj
|
|
17
|
-
};
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: all[name]
|
|
13
|
+
});
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
let trimmedLine = line.trim();
|
|
35
|
-
const isDiffLine = trimmedLine[0] === '+' || trimmedLine[0] === '-';
|
|
36
|
-
const spaces = ' '.repeat(Math.max(componentStacks.length * 2, 1));
|
|
37
|
-
if (isDiffLine) {
|
|
38
|
-
const sign = trimmedLine[0];
|
|
39
|
-
trimmedLine = trimmedLine.slice(1).trim() // trim spaces after sign
|
|
40
|
-
;
|
|
41
|
-
diffHtmlStack.push(/*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
|
|
42
|
-
"data-nextjs-container-errors-pseudo-html--diff": sign === '+' ? 'add' : 'remove',
|
|
43
|
-
children: [
|
|
44
|
-
sign,
|
|
45
|
-
spaces,
|
|
46
|
-
trimmedLine,
|
|
47
|
-
'\n'
|
|
48
|
-
]
|
|
49
|
-
}, 'comp-diff' + index));
|
|
50
|
-
} else if (currentComponentIndex >= 0) {
|
|
51
|
-
const isUserLandComponent = trimmedLine.startsWith('<' + componentStackFrames[currentComponentIndex].component);
|
|
52
|
-
// If it's matched userland component or it's ... we will keep the component stack in diff
|
|
53
|
-
if (isUserLandComponent || trimmedLine === '...') {
|
|
54
|
-
currentComponentIndex--;
|
|
55
|
-
componentStacks.push(/*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
|
|
56
|
-
children: [
|
|
57
|
-
spaces,
|
|
58
|
-
trimmedLine,
|
|
59
|
-
'\n'
|
|
60
|
-
]
|
|
61
|
-
}, 'comp-diff' + index));
|
|
62
|
-
} else if (!isHtmlCollapsed) {
|
|
63
|
-
componentStacks.push(/*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
|
|
64
|
-
children: [
|
|
65
|
-
spaces,
|
|
66
|
-
trimmedLine,
|
|
67
|
-
'\n'
|
|
68
|
-
]
|
|
69
|
-
}, 'comp-diff' + index));
|
|
70
|
-
}
|
|
71
|
-
} else if (!isHtmlCollapsed) {
|
|
72
|
-
// In general, if it's not collapsed, show the whole diff
|
|
73
|
-
componentStacks.push(/*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
|
|
74
|
-
children: [
|
|
75
|
-
spaces,
|
|
76
|
-
trimmedLine,
|
|
77
|
-
'\n'
|
|
78
|
-
]
|
|
79
|
-
}, 'comp-diff' + index));
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
return componentStacks.concat(diffHtmlStack);
|
|
83
|
-
}
|
|
84
|
-
const nestedHtmlStack = [];
|
|
85
|
-
const tagNames = isHtmlTagsWarning ? [
|
|
86
|
-
firstContent.replace(/<|>/g, ''),
|
|
87
|
-
secondContent.replace(/<|>/g, '')
|
|
88
|
-
] : [];
|
|
89
|
-
let lastText = '';
|
|
90
|
-
const componentStack = componentStackFrames.map((frame)=>frame.component).reverse();
|
|
91
|
-
// [child index, parent index]
|
|
92
|
-
const matchedIndex = [
|
|
93
|
-
-1,
|
|
94
|
-
-1
|
|
95
|
-
];
|
|
96
|
-
if (isHtmlTagsWarning) {
|
|
97
|
-
// Reverse search for the child tag
|
|
98
|
-
for(let i = componentStack.length - 1; i >= 0; i--){
|
|
99
|
-
if (componentStack[i] === tagNames[0]) {
|
|
100
|
-
matchedIndex[0] = i;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Start searching parent tag from child tag above
|
|
105
|
-
for(let i = matchedIndex[0] - 1; i >= 0; i--){
|
|
106
|
-
if (componentStack[i] === tagNames[1]) {
|
|
107
|
-
matchedIndex[1] = i;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
componentStack.forEach((component, index, componentList)=>{
|
|
113
|
-
const spaces = ' '.repeat(nestedHtmlStack.length * 2);
|
|
114
|
-
// When component is the server or client tag name, highlight it
|
|
115
|
-
const isHighlightedTag = isHtmlTagsWarning ? index === matchedIndex[0] || index === matchedIndex[1] : tagNames.includes(component);
|
|
116
|
-
const isAdjacentTag = isHighlightedTag || Math.abs(index - matchedIndex[0]) <= 1 || Math.abs(index - matchedIndex[1]) <= 1;
|
|
117
|
-
const isLastFewFrames = !isHtmlTagsWarning && index >= componentList.length - 6;
|
|
118
|
-
const adjProps = getAdjacentProps(isAdjacentTag);
|
|
119
|
-
if (isHtmlTagsWarning && isAdjacentTag || isLastFewFrames) {
|
|
120
|
-
const codeLine = /*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
|
|
121
|
-
children: [
|
|
122
|
-
spaces,
|
|
123
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
124
|
-
...adjProps,
|
|
125
|
-
...isHighlightedTag ? {
|
|
126
|
-
'data-nextjs-container-errors-pseudo-html--tag-error': true
|
|
127
|
-
} : undefined,
|
|
128
|
-
children: "<" + component + ">\n"
|
|
129
|
-
})
|
|
130
|
-
]
|
|
131
|
-
});
|
|
132
|
-
lastText = component;
|
|
133
|
-
const wrappedCodeLine = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
134
|
-
children: [
|
|
135
|
-
codeLine,
|
|
136
|
-
isHighlightedTag && /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
137
|
-
"data-nextjs-container-errors-pseudo-html--hint": true,
|
|
138
|
-
children: spaces + '^'.repeat(component.length + 2) + '\n'
|
|
139
|
-
})
|
|
140
|
-
]
|
|
141
|
-
}, nestedHtmlStack.length);
|
|
142
|
-
nestedHtmlStack.push(wrappedCodeLine);
|
|
143
|
-
} else {
|
|
144
|
-
if (nestedHtmlStack.length >= MAX_NON_COLLAPSED_FRAMES && isHtmlCollapsed) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (!isHtmlCollapsed || isLastFewFrames) {
|
|
148
|
-
nestedHtmlStack.push(/*#__PURE__*/ (0, _react.createElement)("span", {
|
|
149
|
-
...adjProps,
|
|
150
|
-
key: nestedHtmlStack.length,
|
|
151
|
-
children: [
|
|
152
|
-
spaces,
|
|
153
|
-
'<' + component + '>\n'
|
|
154
|
-
]
|
|
155
|
-
}));
|
|
156
|
-
} else if (isHtmlCollapsed && lastText !== '...') {
|
|
157
|
-
lastText = '...';
|
|
158
|
-
nestedHtmlStack.push(/*#__PURE__*/ (0, _react.createElement)("span", {
|
|
159
|
-
...adjProps,
|
|
160
|
-
key: nestedHtmlStack.length,
|
|
161
|
-
children: [
|
|
162
|
-
spaces,
|
|
163
|
-
'...\n'
|
|
164
|
-
]
|
|
165
|
-
}));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
// Hydration mismatch: text or text-tag
|
|
170
|
-
if (!isHtmlTagsWarning) {
|
|
171
|
-
const spaces = ' '.repeat(nestedHtmlStack.length * 2);
|
|
172
|
-
let wrappedCodeLine;
|
|
173
|
-
if (hydrationMismatchType === 'text') {
|
|
174
|
-
// hydration type is "text", represent [server content, client content]
|
|
175
|
-
wrappedCodeLine = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
176
|
-
children: [
|
|
177
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
178
|
-
"data-nextjs-container-errors-pseudo-html--diff": "remove",
|
|
179
|
-
children: spaces + ('"' + firstContent + '"\n')
|
|
180
|
-
}),
|
|
181
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
182
|
-
"data-nextjs-container-errors-pseudo-html--diff": "add",
|
|
183
|
-
children: spaces + ('"' + secondContent + '"\n')
|
|
184
|
-
})
|
|
185
|
-
]
|
|
186
|
-
}, nestedHtmlStack.length);
|
|
187
|
-
} else if (hydrationMismatchType === 'text-in-tag') {
|
|
188
|
-
// hydration type is "text-in-tag", represent [parent tag, mismatch content]
|
|
189
|
-
wrappedCodeLine = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
190
|
-
children: [
|
|
191
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
192
|
-
"data-nextjs-container-errors-pseudo-html--tag-adjacent": true,
|
|
193
|
-
children: spaces + ("<" + secondContent + ">\n")
|
|
194
|
-
}),
|
|
195
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
196
|
-
"data-nextjs-container-errors-pseudo-html--diff": "remove",
|
|
197
|
-
children: spaces + (' "' + firstContent + '"\n')
|
|
198
|
-
})
|
|
199
|
-
]
|
|
200
|
-
}, nestedHtmlStack.length);
|
|
201
|
-
}
|
|
202
|
-
nestedHtmlStack.push(wrappedCodeLine);
|
|
203
|
-
}
|
|
204
|
-
return nestedHtmlStack;
|
|
205
|
-
}, [
|
|
206
|
-
componentStackFrames,
|
|
207
|
-
isHtmlCollapsed,
|
|
208
|
-
firstContent,
|
|
209
|
-
secondContent,
|
|
210
|
-
isHtmlTagsWarning,
|
|
211
|
-
hydrationMismatchType,
|
|
212
|
-
MAX_NON_COLLAPSED_FRAMES,
|
|
213
|
-
isReactHydrationDiff,
|
|
214
|
-
reactOutputComponentDiff
|
|
15
|
+
_export(exports, {
|
|
16
|
+
PseudoHtmlDiff: function() {
|
|
17
|
+
return _diffview.PseudoHtmlDiff;
|
|
18
|
+
},
|
|
19
|
+
styles: function() {
|
|
20
|
+
return styles;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _tagged_template_literal_loose = require("@swc/helpers/_/_tagged_template_literal_loose");
|
|
24
|
+
const _nooptemplate = require("../../helpers/noop-template");
|
|
25
|
+
const _diffview = require("../../../hydration-diff/diff-view");
|
|
26
|
+
function _templateObject() {
|
|
27
|
+
const data = _tagged_template_literal_loose._([
|
|
28
|
+
"\n [data-nextjs-container-errors-pseudo-html] {\n position: relative;\n }\n [data-nextjs-container-errors-pseudo-html-collapse-button] {\n position: absolute;\n left: 10px;\n top: 10px;\n color: inherit;\n background: none;\n border: none;\n padding: 0;\n }\n [data-nextjs-container-errors-pseudo-html-line] {\n display: inline-block;\n width: 100%;\n padding-left: var(--size-10);\n font-size: var(--size-font-small);\n line-height: calc(5 / 3);\n white-space: pre;\n }\n [data-nextjs-container-errors-pseudo-html--diff='add'] {\n color: var(--color-ansi-green);\n }\n [data-nextjs-container-errors-pseudo-html--diff='remove'] {\n color: var(--color-ansi-red);\n }\n [data-nextjs-container-errors-pseudo-html-line--error] {\n color: var(--color-ansi-yellow);\n font-weight: bold;\n }\n [data-nextjs-container-errors-pseudo-html--tag-error] {\n color: var(--color-ansi-red);\n font-weight: bold;\n }\n ",
|
|
29
|
+
"\n [data-nextjs-container-errors-pseudo-html--hint] {\n display: inline-block;\n font-size: 0;\n }\n [data-nextjs-container-errors-pseudo-html-collapse='true']\n .nextjs__container_errors__component-stack\n code {\n max-height: 100px;\n mask-image: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, black 50%);\n }\n .nextjs__container_errors__component-stack code {\n display: block;\n width: 100%;\n white-space: pre-wrap;\n scroll-snap-type: y mandatory;\n overflow-y: hidden;\n }\n [data-nextjs-container-errors-pseudo-html--diff],\n [data-nextjs-container-errors-pseudo-html-line--error] {\n scroll-snap-align: center;\n }\n"
|
|
215
30
|
]);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
tabIndex: 10,
|
|
221
|
-
"data-nextjs-container-errors-pseudo-html-collapse": true,
|
|
222
|
-
onClick: ()=>toggleCollapseHtml(!isHtmlCollapsed),
|
|
223
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_CollapseIcon.CollapseIcon, {
|
|
224
|
-
collapsed: isHtmlCollapsed
|
|
225
|
-
})
|
|
226
|
-
}),
|
|
227
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("pre", {
|
|
228
|
-
...props,
|
|
229
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("code", {
|
|
230
|
-
children: htmlComponents
|
|
231
|
-
})
|
|
232
|
-
})
|
|
233
|
-
]
|
|
234
|
-
});
|
|
31
|
+
_templateObject = function() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
return data;
|
|
235
35
|
}
|
|
36
|
+
const styles = (0, _nooptemplate.noop)(_templateObject(), '');
|
|
236
37
|
|
|
237
38
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
238
39
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.tsx"],"sourcesContent":["import { useMemo, Fragment, useState } from 'react'\nimport type { ComponentStackFrame } from '../../helpers/parse-component-stack'\nimport { CollapseIcon } from '../../icons/CollapseIcon'\n\nfunction getAdjacentProps(isAdj: boolean) {\n return { 'data-nextjs-container-errors-pseudo-html--tag-adjacent': isAdj }\n}\n\n/**\n *\n * Format component stack into pseudo HTML\n * component stack is an array of strings, e.g.: ['p', 'p', 'Page', ...]\n *\n * For html tags mismatch, it will render it for the code block\n *\n * ```\n * <pre>\n * <code>{`\n * <Page>\n * <p red>\n * <p red>\n * `}</code>\n * </pre>\n * ```\n *\n * For text mismatch, it will render it for the code block\n *\n * ```\n * <pre>\n * <code>{`\n * <Page>\n * <p>\n * \"Server Text\" (green)\n * \"Client Text\" (red)\n * </p>\n * </Page>\n * `}</code>\n * ```\n *\n * For bad text under a tag it will render it for the code block,\n * e.g. \"Mismatched Text\" under <p>\n *\n * ```\n * <pre>\n * <code>{`\n * <Page>\n * <div>\n * <p>\n * \"Mismatched Text\" (red)\n * </p>\n * </div>\n * </Page>\n * `}</code>\n * ```\n *\n */\nexport function PseudoHtmlDiff({\n componentStackFrames,\n firstContent,\n secondContent,\n hydrationMismatchType,\n reactOutputComponentDiff,\n ...props\n}: {\n componentStackFrames: ComponentStackFrame[]\n firstContent: string\n secondContent: string\n reactOutputComponentDiff: string | undefined\n hydrationMismatchType: 'tag' | 'text' | 'text-in-tag'\n} & React.HTMLAttributes<HTMLPreElement>) {\n const isHtmlTagsWarning = hydrationMismatchType === 'tag'\n const isReactHydrationDiff = !!reactOutputComponentDiff\n\n // For text mismatch, mismatched text will take 2 rows, so we display 4 rows of component stack\n const MAX_NON_COLLAPSED_FRAMES = isHtmlTagsWarning ? 6 : 4\n const [isHtmlCollapsed, toggleCollapseHtml] = useState(true)\n\n const htmlComponents = useMemo(() => {\n const componentStacks: React.ReactNode[] = []\n // React 19 unified mismatch\n if (isReactHydrationDiff) {\n let currentComponentIndex = componentStackFrames.length - 1\n const reactComponentDiffLines = reactOutputComponentDiff.split('\\n')\n const diffHtmlStack: React.ReactNode[] = []\n reactComponentDiffLines.forEach((line, index) => {\n let trimmedLine = line.trim()\n const isDiffLine = trimmedLine[0] === '+' || trimmedLine[0] === '-'\n const spaces = ' '.repeat(Math.max(componentStacks.length * 2, 1))\n\n if (isDiffLine) {\n const sign = trimmedLine[0]\n trimmedLine = trimmedLine.slice(1).trim() // trim spaces after sign\n diffHtmlStack.push(\n <span\n key={'comp-diff' + index}\n data-nextjs-container-errors-pseudo-html--diff={\n sign === '+' ? 'add' : 'remove'\n }\n >\n {sign}\n {spaces}\n {trimmedLine}\n {'\\n'}\n </span>\n )\n } else if (currentComponentIndex >= 0) {\n const isUserLandComponent = trimmedLine.startsWith(\n '<' + componentStackFrames[currentComponentIndex].component\n )\n // If it's matched userland component or it's ... we will keep the component stack in diff\n if (isUserLandComponent || trimmedLine === '...') {\n currentComponentIndex--\n componentStacks.push(\n <span key={'comp-diff' + index}>\n {spaces}\n {trimmedLine}\n {'\\n'}\n </span>\n )\n } else if (!isHtmlCollapsed) {\n componentStacks.push(\n <span key={'comp-diff' + index}>\n {spaces}\n {trimmedLine}\n {'\\n'}\n </span>\n )\n }\n } else if (!isHtmlCollapsed) {\n // In general, if it's not collapsed, show the whole diff\n componentStacks.push(\n <span key={'comp-diff' + index}>\n {spaces}\n {trimmedLine}\n {'\\n'}\n </span>\n )\n }\n })\n return componentStacks.concat(diffHtmlStack)\n }\n\n const nestedHtmlStack: React.ReactNode[] = []\n const tagNames = isHtmlTagsWarning\n ? // tags could have < or > in the name, so we always remove them to match\n [firstContent.replace(/<|>/g, ''), secondContent.replace(/<|>/g, '')]\n : []\n\n let lastText = ''\n\n const componentStack = componentStackFrames\n .map((frame) => frame.component)\n .reverse()\n\n // [child index, parent index]\n const matchedIndex = [-1, -1]\n if (isHtmlTagsWarning) {\n // Reverse search for the child tag\n for (let i = componentStack.length - 1; i >= 0; i--) {\n if (componentStack[i] === tagNames[0]) {\n matchedIndex[0] = i\n break\n }\n }\n // Start searching parent tag from child tag above\n for (let i = matchedIndex[0] - 1; i >= 0; i--) {\n if (componentStack[i] === tagNames[1]) {\n matchedIndex[1] = i\n break\n }\n }\n }\n\n componentStack.forEach((component, index, componentList) => {\n const spaces = ' '.repeat(nestedHtmlStack.length * 2)\n\n // When component is the server or client tag name, highlight it\n const isHighlightedTag = isHtmlTagsWarning\n ? index === matchedIndex[0] || index === matchedIndex[1]\n : tagNames.includes(component)\n const isAdjacentTag =\n isHighlightedTag ||\n Math.abs(index - matchedIndex[0]) <= 1 ||\n Math.abs(index - matchedIndex[1]) <= 1\n\n const isLastFewFrames =\n !isHtmlTagsWarning && index >= componentList.length - 6\n\n const adjProps = getAdjacentProps(isAdjacentTag)\n\n if ((isHtmlTagsWarning && isAdjacentTag) || isLastFewFrames) {\n const codeLine = (\n <span>\n {spaces}\n <span\n {...adjProps}\n {...{\n ...(isHighlightedTag\n ? {\n 'data-nextjs-container-errors-pseudo-html--tag-error':\n true,\n }\n : undefined),\n }}\n >\n {`<${component}>\\n`}\n </span>\n </span>\n )\n lastText = component\n\n const wrappedCodeLine = (\n <Fragment key={nestedHtmlStack.length}>\n {codeLine}\n {/* Add ^^^^ to the target tags used for snapshots but not displayed for users */}\n {isHighlightedTag && (\n <span data-nextjs-container-errors-pseudo-html--hint>\n {spaces + '^'.repeat(component.length + 2) + '\\n'}\n </span>\n )}\n </Fragment>\n )\n nestedHtmlStack.push(wrappedCodeLine)\n } else {\n if (\n nestedHtmlStack.length >= MAX_NON_COLLAPSED_FRAMES &&\n isHtmlCollapsed\n ) {\n return\n }\n\n if (!isHtmlCollapsed || isLastFewFrames) {\n nestedHtmlStack.push(\n <span {...adjProps} key={nestedHtmlStack.length}>\n {spaces}\n {'<' + component + '>\\n'}\n </span>\n )\n } else if (isHtmlCollapsed && lastText !== '...') {\n lastText = '...'\n nestedHtmlStack.push(\n <span {...adjProps} key={nestedHtmlStack.length}>\n {spaces}\n {'...\\n'}\n </span>\n )\n }\n }\n })\n // Hydration mismatch: text or text-tag\n if (!isHtmlTagsWarning) {\n const spaces = ' '.repeat(nestedHtmlStack.length * 2)\n let wrappedCodeLine\n if (hydrationMismatchType === 'text') {\n // hydration type is \"text\", represent [server content, client content]\n wrappedCodeLine = (\n <Fragment key={nestedHtmlStack.length}>\n <span data-nextjs-container-errors-pseudo-html--diff=\"remove\">\n {spaces + `\"${firstContent}\"\\n`}\n </span>\n <span data-nextjs-container-errors-pseudo-html--diff=\"add\">\n {spaces + `\"${secondContent}\"\\n`}\n </span>\n </Fragment>\n )\n } else if (hydrationMismatchType === 'text-in-tag') {\n // hydration type is \"text-in-tag\", represent [parent tag, mismatch content]\n wrappedCodeLine = (\n <Fragment key={nestedHtmlStack.length}>\n <span data-nextjs-container-errors-pseudo-html--tag-adjacent>\n {spaces + `<${secondContent}>\\n`}\n </span>\n <span data-nextjs-container-errors-pseudo-html--diff=\"remove\">\n {spaces + ` \"${firstContent}\"\\n`}\n </span>\n </Fragment>\n )\n }\n nestedHtmlStack.push(wrappedCodeLine)\n }\n\n return nestedHtmlStack\n }, [\n componentStackFrames,\n isHtmlCollapsed,\n firstContent,\n secondContent,\n isHtmlTagsWarning,\n hydrationMismatchType,\n MAX_NON_COLLAPSED_FRAMES,\n isReactHydrationDiff,\n reactOutputComponentDiff,\n ])\n\n return (\n <div data-nextjs-container-errors-pseudo-html>\n <button\n tabIndex={10} // match CallStackFrame\n data-nextjs-container-errors-pseudo-html-collapse\n onClick={() => toggleCollapseHtml(!isHtmlCollapsed)}\n >\n <CollapseIcon collapsed={isHtmlCollapsed} />\n </button>\n <pre {...props}>\n <code>{htmlComponents}</code>\n </pre>\n </div>\n )\n}\n"],"names":["PseudoHtmlDiff","getAdjacentProps","isAdj","componentStackFrames","firstContent","secondContent","hydrationMismatchType","reactOutputComponentDiff","props","isHtmlTagsWarning","isReactHydrationDiff","MAX_NON_COLLAPSED_FRAMES","isHtmlCollapsed","toggleCollapseHtml","useState","htmlComponents","useMemo","componentStacks","currentComponentIndex","length","reactComponentDiffLines","split","diffHtmlStack","forEach","line","index","trimmedLine","trim","isDiffLine","spaces","repeat","Math","max","sign","slice","push","span","data-nextjs-container-errors-pseudo-html--diff","isUserLandComponent","startsWith","component","concat","nestedHtmlStack","tagNames","replace","lastText","componentStack","map","frame","reverse","matchedIndex","i","componentList","isHighlightedTag","includes","isAdjacentTag","abs","isLastFewFrames","adjProps","codeLine","undefined","wrappedCodeLine","Fragment","data-nextjs-container-errors-pseudo-html--hint","key","data-nextjs-container-errors-pseudo-html--tag-adjacent","div","data-nextjs-container-errors-pseudo-html","button","tabIndex","data-nextjs-container-errors-pseudo-html-collapse","onClick","CollapseIcon","collapsed","pre","code"],"mappings":";;;;+BAwDgBA;;;eAAAA;;;;uBAxD4B;8BAEf;AAE7B,SAASC,iBAAiBC,KAAc;IACtC,OAAO;QAAE,0DAA0DA;IAAM;AAC3E;AAkDO,SAASF,eAAe,KAaS;IAbT,IAAA,EAC7BG,oBAAoB,EACpBC,YAAY,EACZC,aAAa,EACbC,qBAAqB,EACrBC,wBAAwB,EACxB,GAAG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BAAgBvB,MAAM,GAAG;YACnD,IAAI0C;YACJ,IAAIvD,0BAA0B,QAAQ;gBACpC,uEAAuE;gBACvEuD,gCACE,sBAACC,eAAQ;;sCACP,qBAAC1B;4BAAKC,kDAA+C;sCAClDR,SAAS,CAAA,AAAC,MAAGzB,eAAa,KAAG;;sCAEhC,qBAACgC;4BAAKC,kDAA+C;sCAClDR,SAAS,CAAA,AAAC,MAAGxB,gBAAc,KAAG;;;mBALpBqC,gBAAgBvB,MAAM;YASzC,OAAO,IAAIb,0BAA0B,eAAe;gBAClD,4EAA4E;gBAC5EuD,gCACE,sBAACC,eAAQ;;sCACP,qBAAC1B;4BAAK6B,wDAAsD;sCACzDpC,SAAS,CAAA,AAAC,MAAGxB,gBAAc,KAAG;;sCAEjC,qBAAC+B;4BAAKC,kDAA+C;sCAClDR,SAAS,CAAA,AAAC,QAAKzB,eAAa,KAAG;;;mBALrBsC,gBAAgBvB,MAAM;YASzC;YACAuB,gBAAgBP,IAAI,CAAC0B;QACvB;QAEA,OAAOnB;IACT,GAAG;QACDvC;QACAS;QACAR;QACAC;QACAI;QACAH;QACAK;QACAD;QACAH;KACD;IAED,qBACE,sBAAC2D;QAAIC,0CAAwC;;0BAC3C,qBAACC;gBACCC,UAAU;gBACVC,mDAAiD;gBACjDC,SAAS,IAAM1D,mBAAmB,CAACD;0BAEnC,cAAA,qBAAC4D,0BAAY;oBAACC,WAAW7D;;;0BAE3B,qBAAC8D;gBAAK,GAAGlE,KAAK;0BACZ,cAAA,qBAACmE;8BAAM5D;;;;;AAIf"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.tsx"],"sourcesContent":["import { noop as css } from '../../helpers/noop-template'\n\nexport { PseudoHtmlDiff } from '../../../hydration-diff/diff-view'\n\nexport const styles = css`\n [data-nextjs-container-errors-pseudo-html] {\n position: relative;\n }\n [data-nextjs-container-errors-pseudo-html-collapse-button] {\n position: absolute;\n left: 10px;\n top: 10px;\n color: inherit;\n background: none;\n border: none;\n padding: 0;\n }\n [data-nextjs-container-errors-pseudo-html-line] {\n display: inline-block;\n width: 100%;\n padding-left: var(--size-10);\n font-size: var(--size-font-small);\n line-height: calc(5 / 3);\n white-space: pre;\n }\n [data-nextjs-container-errors-pseudo-html--diff='add'] {\n color: var(--color-ansi-green);\n }\n [data-nextjs-container-errors-pseudo-html--diff='remove'] {\n color: var(--color-ansi-red);\n }\n [data-nextjs-container-errors-pseudo-html-line--error] {\n color: var(--color-ansi-yellow);\n font-weight: bold;\n }\n [data-nextjs-container-errors-pseudo-html--tag-error] {\n color: var(--color-ansi-red);\n font-weight: bold;\n }\n ${/* hide but text are still accessible in DOM */ ''}\n [data-nextjs-container-errors-pseudo-html--hint] {\n display: inline-block;\n font-size: 0;\n }\n [data-nextjs-container-errors-pseudo-html-collapse='true']\n .nextjs__container_errors__component-stack\n code {\n max-height: 100px;\n mask-image: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, black 50%);\n }\n .nextjs__container_errors__component-stack code {\n display: block;\n width: 100%;\n white-space: pre-wrap;\n scroll-snap-type: y mandatory;\n overflow-y: hidden;\n }\n [data-nextjs-container-errors-pseudo-html--diff],\n [data-nextjs-container-errors-pseudo-html-line--error] {\n scroll-snap-align: center;\n }\n`\n"],"names":["PseudoHtmlDiff","styles","css"],"mappings":";;;;;;;;;;;;;;;IAESA,cAAc;eAAdA,wBAAc;;IAEVC,MAAM;eAANA;;;;8BAJe;0BAEG;;;;;;;;;;;AAExB,MAAMA,aAASC,kBAAG,qBAmC2B"}
|
|
@@ -30,7 +30,7 @@ const _nooptemplate = require("../../helpers/noop-template");
|
|
|
30
30
|
const _CallStackFrame = require("./CallStackFrame");
|
|
31
31
|
function _templateObject() {
|
|
32
32
|
const data = _tagged_template_literal_loose._([
|
|
33
|
-
"\n [data-nextjs-call-stack-frame]:not(:last-child),\n [data-nextjs-component-stack-frame]:not(:last-child) {\n margin-bottom: var(--size-gap-double);\n }\n\n [data-expand-ignore-button]:focus:not(:focus-visible),\n [data-expand-ignore-button] {\n background: none;\n border: none;\n color: var(--color-font);\n cursor: pointer;\n font-size: var(--size-font);\n margin: var(--size-gap) 0;\n padding: 0;\n text-decoration: underline;\n outline: none;\n }\n\n [data-nextjs-data-runtime-error-copy-button],\n [data-nextjs-data-runtime-error-copy-button]:focus:not(:focus-visible) {\n position: relative;\n margin-left: var(--size-gap);\n padding: 0;\n border: none;\n background: none;\n outline: none;\n }\n [data-nextjs-data-runtime-error-copy-button] > svg {\n vertical-align: middle;\n }\n .nextjs-data-runtime-error-copy-button {\n color: inherit;\n }\n .nextjs-data-runtime-error-copy-button--initial:hover {\n cursor: pointer;\n }\n .nextjs-data-runtime-error-copy-button[aria-disabled='true'] {\n opacity: 0.3;\n cursor: not-allowed;\n }\n .nextjs-data-runtime-error-copy-button--error,\n .nextjs-data-runtime-error-copy-button--error:hover {\n color: var(--color-ansi-red);\n }\n .nextjs-data-runtime-error-copy-button--success {\n color: var(--color-ansi-green);\n }\n\n [data-nextjs-call-stack-frame] > h3,\n [data-nextjs-component-stack-frame] > h3 {\n margin-top: 0;\n margin-bottom: 0;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-font);\n }\n [data-nextjs-call-stack-frame] > h3[data-nextjs-frame-expanded='false'] {\n color: #666;\n display: inline-block;\n }\n [data-nextjs-call-stack-frame] > div,\n [data-nextjs-component-stack-frame] > div {\n display: flex;\n align-items: center;\n padding-left: calc(var(--size-gap) + var(--size-gap-half));\n font-size: var(--size-font-small);\n color: #999;\n }\n [data-nextjs-call-stack-frame] > div > svg,\n [data-nextjs-component-stack-frame] > [role='link'] > svg {\n width: auto;\n height: var(--size-font-small);\n margin-left: var(--size-gap);\n flex-shrink: 0;\n display: none;\n }\n\n [data-nextjs-call-stack-frame] > div[data-has-source],\n [data-nextjs-component-stack-frame] > [role='link'] {\n cursor: pointer;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source]:hover,\n [data-nextjs-component-stack-frame] > [role='link']:hover {\n text-decoration: underline dotted;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source] > svg,\n [data-nextjs-component-stack-frame] > [role='link'] > svg {\n display: unset;\n }\n\n [data-nextjs-call-stack-framework-icon] {\n margin-right: var(--size-gap);\n }\n [data-nextjs-call-stack-framework-icon='next'] > mask {\n mask-type: alpha;\n }\n [data-nextjs-call-stack-framework-icon='react'] {\n color: rgb(20, 158, 202);\n }\n [data-nextjs-collapsed-call-stack-details][open]\n [data-nextjs-call-stack-chevron-icon] {\n transform: rotate(90deg);\n }\n [data-nextjs-collapsed-call-stack-details] summary {\n display: flex;\n align-items: center;\n margin-bottom: var(--size-gap);\n list-style: none;\n }\n [data-nextjs-collapsed-call-stack-details] summary::-webkit-details-marker {\n display: none;\n }\n\n [data-nextjs-collapsed-call-stack-details] h3 {\n color: #666;\n }\n [data-nextjs-collapsed-call-stack-details] [data-nextjs-call-stack-frame] {\n margin-bottom: var(--size-gap-double);\n }\n
|
|
33
|
+
"\n [data-nextjs-call-stack-frame]:not(:last-child),\n [data-nextjs-component-stack-frame]:not(:last-child) {\n margin-bottom: var(--size-gap-double);\n }\n\n [data-expand-ignore-button]:focus:not(:focus-visible),\n [data-expand-ignore-button] {\n background: none;\n border: none;\n color: var(--color-font);\n cursor: pointer;\n font-size: var(--size-font);\n margin: var(--size-gap) 0;\n padding: 0;\n text-decoration: underline;\n outline: none;\n }\n\n [data-nextjs-data-runtime-error-copy-button],\n [data-nextjs-data-runtime-error-copy-button]:focus:not(:focus-visible) {\n position: relative;\n margin-left: var(--size-gap);\n padding: 0;\n border: none;\n background: none;\n outline: none;\n }\n [data-nextjs-data-runtime-error-copy-button] > svg {\n vertical-align: middle;\n }\n .nextjs-data-runtime-error-copy-button {\n color: inherit;\n }\n .nextjs-data-runtime-error-copy-button--initial:hover {\n cursor: pointer;\n }\n .nextjs-data-runtime-error-copy-button[aria-disabled='true'] {\n opacity: 0.3;\n cursor: not-allowed;\n }\n .nextjs-data-runtime-error-copy-button--error,\n .nextjs-data-runtime-error-copy-button--error:hover {\n color: var(--color-ansi-red);\n }\n .nextjs-data-runtime-error-copy-button--success {\n color: var(--color-ansi-green);\n }\n\n [data-nextjs-call-stack-frame] > h3,\n [data-nextjs-component-stack-frame] > h3 {\n margin-top: 0;\n margin-bottom: 0;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-font);\n }\n [data-nextjs-call-stack-frame] > h3[data-nextjs-frame-expanded='false'] {\n color: #666;\n display: inline-block;\n }\n [data-nextjs-call-stack-frame] > div,\n [data-nextjs-component-stack-frame] > div {\n display: flex;\n align-items: center;\n padding-left: calc(var(--size-gap) + var(--size-gap-half));\n font-size: var(--size-font-small);\n color: #999;\n }\n [data-nextjs-call-stack-frame] > div > svg,\n [data-nextjs-component-stack-frame] > [role='link'] > svg {\n width: auto;\n height: var(--size-font-small);\n margin-left: var(--size-gap);\n flex-shrink: 0;\n display: none;\n }\n\n [data-nextjs-call-stack-frame] > div[data-has-source],\n [data-nextjs-component-stack-frame] > [role='link'] {\n cursor: pointer;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source]:hover,\n [data-nextjs-component-stack-frame] > [role='link']:hover {\n text-decoration: underline dotted;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source] > svg,\n [data-nextjs-component-stack-frame] > [role='link'] > svg {\n display: unset;\n }\n\n [data-nextjs-call-stack-framework-icon] {\n margin-right: var(--size-gap);\n }\n [data-nextjs-call-stack-framework-icon='next'] > mask {\n mask-type: alpha;\n }\n [data-nextjs-call-stack-framework-icon='react'] {\n color: rgb(20, 158, 202);\n }\n [data-nextjs-collapsed-call-stack-details][open]\n [data-nextjs-call-stack-chevron-icon] {\n transform: rotate(90deg);\n }\n [data-nextjs-collapsed-call-stack-details] summary {\n display: flex;\n align-items: center;\n margin-bottom: var(--size-gap);\n list-style: none;\n }\n [data-nextjs-collapsed-call-stack-details] summary::-webkit-details-marker {\n display: none;\n }\n\n [data-nextjs-collapsed-call-stack-details] h3 {\n color: #666;\n }\n [data-nextjs-collapsed-call-stack-details] [data-nextjs-call-stack-frame] {\n margin-bottom: var(--size-gap-double);\n }\n"
|
|
34
34
|
]);
|
|
35
35
|
_templateObject = function() {
|
|
36
36
|
return data;
|
package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { CodeFrame } from '../../components/CodeFrame'\nimport {\n useFrames,\n type ReadyRuntimeError,\n} from '../../helpers/get-error-by-type'\nimport { noop as css } from '../../helpers/noop-template'\nimport { CallStackFrame } from './CallStackFrame'\n\nexport type RuntimeErrorProps = { error: ReadyRuntimeError }\n\nexport function RuntimeError({ error }: RuntimeErrorProps) {\n const [isIgnoredExpanded, setIsIgnoredExpanded] = React.useState(false)\n\n const frames = useFrames(error)\n const {\n firstFrame,\n allLeadingFrames,\n trailingCallStackFrames,\n displayedFramesCount,\n } = React.useMemo(() => {\n const filteredFrames = frames.filter((frame) =>\n isIgnoredExpanded ? true : !frame.ignored\n )\n\n const firstFirstPartyFrameIndex = filteredFrames.findIndex(\n (entry) =>\n !entry.ignored &&\n Boolean(entry.originalCodeFrame) &&\n Boolean(entry.originalStackFrame)\n )\n\n return {\n displayedFramesCount: filteredFrames.length,\n firstFrame: filteredFrames[firstFirstPartyFrameIndex] ?? null,\n allLeadingFrames:\n firstFirstPartyFrameIndex < 0\n ? []\n : filteredFrames.slice(0, firstFirstPartyFrameIndex),\n trailingCallStackFrames: filteredFrames.slice(\n firstFirstPartyFrameIndex < 0 ? 0 : firstFirstPartyFrameIndex\n ),\n }\n }, [frames, isIgnoredExpanded])\n\n return (\n <>\n {firstFrame ? (\n <>\n <h2>Source</h2>\n {allLeadingFrames.map((frame, frameIndex) => (\n <CallStackFrame\n key={`call-stack-leading-${frameIndex}`}\n frame={frame}\n />\n ))}\n <CodeFrame\n stackFrame={firstFrame.originalStackFrame!}\n codeFrame={firstFrame.originalCodeFrame!}\n />\n </>\n ) : undefined}\n\n {trailingCallStackFrames.map((frame, frameIndex) => (\n <CallStackFrame\n key={`call-stack-leading-${frameIndex}`}\n frame={frame}\n />\n ))}\n {\n // if the default displayed ignored frames count is equal equal to the total frames count, hide the button\n displayedFramesCount === frames.length && !isIgnoredExpanded ? null : (\n <button\n data-expand-ignore-button={isIgnoredExpanded}\n onClick={() => setIsIgnoredExpanded(!isIgnoredExpanded)}\n >\n {`${isIgnoredExpanded ? 'Hide' : 'Show'} ignored frames`}\n </button>\n )\n }\n </>\n )\n}\n\nexport const styles = css`\n [data-nextjs-call-stack-frame]:not(:last-child),\n [data-nextjs-component-stack-frame]:not(:last-child) {\n margin-bottom: var(--size-gap-double);\n }\n\n [data-expand-ignore-button]:focus:not(:focus-visible),\n [data-expand-ignore-button] {\n background: none;\n border: none;\n color: var(--color-font);\n cursor: pointer;\n font-size: var(--size-font);\n margin: var(--size-gap) 0;\n padding: 0;\n text-decoration: underline;\n outline: none;\n }\n\n [data-nextjs-data-runtime-error-copy-button],\n [data-nextjs-data-runtime-error-copy-button]:focus:not(:focus-visible) {\n position: relative;\n margin-left: var(--size-gap);\n padding: 0;\n border: none;\n background: none;\n outline: none;\n }\n [data-nextjs-data-runtime-error-copy-button] > svg {\n vertical-align: middle;\n }\n .nextjs-data-runtime-error-copy-button {\n color: inherit;\n }\n .nextjs-data-runtime-error-copy-button--initial:hover {\n cursor: pointer;\n }\n .nextjs-data-runtime-error-copy-button[aria-disabled='true'] {\n opacity: 0.3;\n cursor: not-allowed;\n }\n .nextjs-data-runtime-error-copy-button--error,\n .nextjs-data-runtime-error-copy-button--error:hover {\n color: var(--color-ansi-red);\n }\n .nextjs-data-runtime-error-copy-button--success {\n color: var(--color-ansi-green);\n }\n\n [data-nextjs-call-stack-frame] > h3,\n [data-nextjs-component-stack-frame] > h3 {\n margin-top: 0;\n margin-bottom: 0;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-font);\n }\n [data-nextjs-call-stack-frame] > h3[data-nextjs-frame-expanded='false'] {\n color: #666;\n display: inline-block;\n }\n [data-nextjs-call-stack-frame] > div,\n [data-nextjs-component-stack-frame] > div {\n display: flex;\n align-items: center;\n padding-left: calc(var(--size-gap) + var(--size-gap-half));\n font-size: var(--size-font-small);\n color: #999;\n }\n [data-nextjs-call-stack-frame] > div > svg,\n [data-nextjs-component-stack-frame] > [role='link'] > svg {\n width: auto;\n height: var(--size-font-small);\n margin-left: var(--size-gap);\n flex-shrink: 0;\n display: none;\n }\n\n [data-nextjs-call-stack-frame] > div[data-has-source],\n [data-nextjs-component-stack-frame] > [role='link'] {\n cursor: pointer;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source]:hover,\n [data-nextjs-component-stack-frame] > [role='link']:hover {\n text-decoration: underline dotted;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source] > svg,\n [data-nextjs-component-stack-frame] > [role='link'] > svg {\n display: unset;\n }\n\n [data-nextjs-call-stack-framework-icon] {\n margin-right: var(--size-gap);\n }\n [data-nextjs-call-stack-framework-icon='next'] > mask {\n mask-type: alpha;\n }\n [data-nextjs-call-stack-framework-icon='react'] {\n color: rgb(20, 158, 202);\n }\n [data-nextjs-collapsed-call-stack-details][open]\n [data-nextjs-call-stack-chevron-icon] {\n transform: rotate(90deg);\n }\n [data-nextjs-collapsed-call-stack-details] summary {\n display: flex;\n align-items: center;\n margin-bottom: var(--size-gap);\n list-style: none;\n }\n [data-nextjs-collapsed-call-stack-details] summary::-webkit-details-marker {\n display: none;\n }\n\n [data-nextjs-collapsed-call-stack-details] h3 {\n color: #666;\n }\n [data-nextjs-collapsed-call-stack-details] [data-nextjs-call-stack-frame] {\n margin-bottom: var(--size-gap-double);\n }\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { CodeFrame } from '../../components/CodeFrame'\nimport {\n useFrames,\n type ReadyRuntimeError,\n} from '../../helpers/get-error-by-type'\nimport { noop as css } from '../../helpers/noop-template'\nimport { CallStackFrame } from './CallStackFrame'\n\nexport type RuntimeErrorProps = { error: ReadyRuntimeError }\n\nexport function RuntimeError({ error }: RuntimeErrorProps) {\n const [isIgnoredExpanded, setIsIgnoredExpanded] = React.useState(false)\n\n const frames = useFrames(error)\n const {\n firstFrame,\n allLeadingFrames,\n trailingCallStackFrames,\n displayedFramesCount,\n } = React.useMemo(() => {\n const filteredFrames = frames.filter((frame) =>\n isIgnoredExpanded ? true : !frame.ignored\n )\n\n const firstFirstPartyFrameIndex = filteredFrames.findIndex(\n (entry) =>\n !entry.ignored &&\n Boolean(entry.originalCodeFrame) &&\n Boolean(entry.originalStackFrame)\n )\n\n return {\n displayedFramesCount: filteredFrames.length,\n firstFrame: filteredFrames[firstFirstPartyFrameIndex] ?? null,\n allLeadingFrames:\n firstFirstPartyFrameIndex < 0\n ? []\n : filteredFrames.slice(0, firstFirstPartyFrameIndex),\n trailingCallStackFrames: filteredFrames.slice(\n firstFirstPartyFrameIndex < 0 ? 0 : firstFirstPartyFrameIndex\n ),\n }\n }, [frames, isIgnoredExpanded])\n\n return (\n <>\n {firstFrame ? (\n <>\n <h2>Source</h2>\n {allLeadingFrames.map((frame, frameIndex) => (\n <CallStackFrame\n key={`call-stack-leading-${frameIndex}`}\n frame={frame}\n />\n ))}\n <CodeFrame\n stackFrame={firstFrame.originalStackFrame!}\n codeFrame={firstFrame.originalCodeFrame!}\n />\n </>\n ) : undefined}\n\n {trailingCallStackFrames.map((frame, frameIndex) => (\n <CallStackFrame\n key={`call-stack-leading-${frameIndex}`}\n frame={frame}\n />\n ))}\n {\n // if the default displayed ignored frames count is equal equal to the total frames count, hide the button\n displayedFramesCount === frames.length && !isIgnoredExpanded ? null : (\n <button\n data-expand-ignore-button={isIgnoredExpanded}\n onClick={() => setIsIgnoredExpanded(!isIgnoredExpanded)}\n >\n {`${isIgnoredExpanded ? 'Hide' : 'Show'} ignored frames`}\n </button>\n )\n }\n </>\n )\n}\n\nexport const styles = css`\n [data-nextjs-call-stack-frame]:not(:last-child),\n [data-nextjs-component-stack-frame]:not(:last-child) {\n margin-bottom: var(--size-gap-double);\n }\n\n [data-expand-ignore-button]:focus:not(:focus-visible),\n [data-expand-ignore-button] {\n background: none;\n border: none;\n color: var(--color-font);\n cursor: pointer;\n font-size: var(--size-font);\n margin: var(--size-gap) 0;\n padding: 0;\n text-decoration: underline;\n outline: none;\n }\n\n [data-nextjs-data-runtime-error-copy-button],\n [data-nextjs-data-runtime-error-copy-button]:focus:not(:focus-visible) {\n position: relative;\n margin-left: var(--size-gap);\n padding: 0;\n border: none;\n background: none;\n outline: none;\n }\n [data-nextjs-data-runtime-error-copy-button] > svg {\n vertical-align: middle;\n }\n .nextjs-data-runtime-error-copy-button {\n color: inherit;\n }\n .nextjs-data-runtime-error-copy-button--initial:hover {\n cursor: pointer;\n }\n .nextjs-data-runtime-error-copy-button[aria-disabled='true'] {\n opacity: 0.3;\n cursor: not-allowed;\n }\n .nextjs-data-runtime-error-copy-button--error,\n .nextjs-data-runtime-error-copy-button--error:hover {\n color: var(--color-ansi-red);\n }\n .nextjs-data-runtime-error-copy-button--success {\n color: var(--color-ansi-green);\n }\n\n [data-nextjs-call-stack-frame] > h3,\n [data-nextjs-component-stack-frame] > h3 {\n margin-top: 0;\n margin-bottom: 0;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-font);\n }\n [data-nextjs-call-stack-frame] > h3[data-nextjs-frame-expanded='false'] {\n color: #666;\n display: inline-block;\n }\n [data-nextjs-call-stack-frame] > div,\n [data-nextjs-component-stack-frame] > div {\n display: flex;\n align-items: center;\n padding-left: calc(var(--size-gap) + var(--size-gap-half));\n font-size: var(--size-font-small);\n color: #999;\n }\n [data-nextjs-call-stack-frame] > div > svg,\n [data-nextjs-component-stack-frame] > [role='link'] > svg {\n width: auto;\n height: var(--size-font-small);\n margin-left: var(--size-gap);\n flex-shrink: 0;\n display: none;\n }\n\n [data-nextjs-call-stack-frame] > div[data-has-source],\n [data-nextjs-component-stack-frame] > [role='link'] {\n cursor: pointer;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source]:hover,\n [data-nextjs-component-stack-frame] > [role='link']:hover {\n text-decoration: underline dotted;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source] > svg,\n [data-nextjs-component-stack-frame] > [role='link'] > svg {\n display: unset;\n }\n\n [data-nextjs-call-stack-framework-icon] {\n margin-right: var(--size-gap);\n }\n [data-nextjs-call-stack-framework-icon='next'] > mask {\n mask-type: alpha;\n }\n [data-nextjs-call-stack-framework-icon='react'] {\n color: rgb(20, 158, 202);\n }\n [data-nextjs-collapsed-call-stack-details][open]\n [data-nextjs-call-stack-chevron-icon] {\n transform: rotate(90deg);\n }\n [data-nextjs-collapsed-call-stack-details] summary {\n display: flex;\n align-items: center;\n margin-bottom: var(--size-gap);\n list-style: none;\n }\n [data-nextjs-collapsed-call-stack-details] summary::-webkit-details-marker {\n display: none;\n }\n\n [data-nextjs-collapsed-call-stack-details] h3 {\n color: #666;\n }\n [data-nextjs-collapsed-call-stack-details] [data-nextjs-call-stack-frame] {\n margin-bottom: var(--size-gap-double);\n }\n`\n"],"names":["RuntimeError","styles","error","isIgnoredExpanded","setIsIgnoredExpanded","React","useState","frames","useFrames","firstFrame","allLeadingFrames","trailingCallStackFrames","displayedFramesCount","useMemo","filteredFrames","filter","frame","ignored","firstFirstPartyFrameIndex","findIndex","entry","Boolean","originalCodeFrame","originalStackFrame","length","slice","h2","map","frameIndex","CallStackFrame","CodeFrame","stackFrame","codeFrame","undefined","button","data-expand-ignore-button","onClick","css"],"mappings":";;;;;;;;;;;;;;;IAWgBA,YAAY;eAAZA;;IAyEHC,MAAM;eAANA;;;;;;iEApFU;2BACG;gCAInB;8BACqB;gCACG;;;;;;;;;;AAIxB,SAASD,aAAa,KAA4B;IAA5B,IAAA,EAAEE,KAAK,EAAqB,GAA5B;IAC3B,M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C,KAAEA,CAAAA,oBAAoB,SAAS,MAAK,IAAE;;;;AAMpD;AAEO,MAAMF,aAASoC,kBAAG"}
|
|
@@ -20,6 +20,7 @@ const _VersionStalenessInfo = require("../components/VersionStalenessInfo");
|
|
|
20
20
|
const _BuildError = require("../container/BuildError");
|
|
21
21
|
const _Errors = require("../container/Errors");
|
|
22
22
|
const _RuntimeError = require("../container/RuntimeError");
|
|
23
|
+
const _componentstackpseudohtml = require("../container/RuntimeError/component-stack-pseudo-html");
|
|
23
24
|
const _nooptemplate = require("../helpers/noop-template");
|
|
24
25
|
function _templateObject() {
|
|
25
26
|
const data = _tagged_template_literal_loose._([
|
|
@@ -33,6 +34,7 @@ function _templateObject() {
|
|
|
33
34
|
"\n ",
|
|
34
35
|
"\n ",
|
|
35
36
|
"\n ",
|
|
37
|
+
"\n ",
|
|
36
38
|
"\n "
|
|
37
39
|
]);
|
|
38
40
|
_templateObject = function() {
|
|
@@ -42,7 +44,7 @@ function _templateObject() {
|
|
|
42
44
|
}
|
|
43
45
|
function ComponentStyles() {
|
|
44
46
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
|
|
45
|
-
children: (0, _nooptemplate.noop)(_templateObject(), _styles2.styles, _Toast.styles, _Dialog.styles, _styles1.styles, _styles.styles, _styles3.styles, _BuildError.styles, _Errors.styles, _RuntimeError.styles, _VersionStalenessInfo.styles)
|
|
47
|
+
children: (0, _nooptemplate.noop)(_templateObject(), _styles2.styles, _Toast.styles, _Dialog.styles, _styles1.styles, _styles.styles, _styles3.styles, _BuildError.styles, _Errors.styles, _RuntimeError.styles, _VersionStalenessInfo.styles, _componentstackpseudohtml.styles)
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/styles/ComponentStyles.tsx"],"sourcesContent":["import { styles as codeFrame } from '../components/CodeFrame/styles'\nimport { styles as dialog } from '../components/Dialog'\nimport { styles as leftRightDialogHeader } from '../components/LeftRightDialogHeader/styles'\nimport { styles as overlay } from '../components/Overlay/styles'\nimport { styles as terminal } from '../components/Terminal/styles'\nimport { styles as toast } from '../components/Toast'\nimport { styles as versionStaleness } from '../components/VersionStalenessInfo'\nimport { styles as buildErrorStyles } from '../container/BuildError'\nimport { styles as containerErrorStyles } from '../container/Errors'\nimport { styles as containerRuntimeErrorStyles } from '../container/RuntimeError'\nimport { noop as css } from '../helpers/noop-template'\n\nexport function ComponentStyles() {\n return (\n <style>\n {css`\n ${overlay}\n ${toast}\n ${dialog}\n ${leftRightDialogHeader}\n ${codeFrame}\n ${terminal}\n ${buildErrorStyles}\n ${containerErrorStyles}\n ${containerRuntimeErrorStyles}\n ${versionStaleness}\n `}\n </style>\n )\n}\n"],"names":["ComponentStyles","style","css","overlay","toast","dialog","leftRightDialogHeader","codeFrame","terminal","buildErrorStyles","containerErrorStyles","containerRuntimeErrorStyles","versionStaleness"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/styles/ComponentStyles.tsx"],"sourcesContent":["import { styles as codeFrame } from '../components/CodeFrame/styles'\nimport { styles as dialog } from '../components/Dialog'\nimport { styles as leftRightDialogHeader } from '../components/LeftRightDialogHeader/styles'\nimport { styles as overlay } from '../components/Overlay/styles'\nimport { styles as terminal } from '../components/Terminal/styles'\nimport { styles as toast } from '../components/Toast'\nimport { styles as versionStaleness } from '../components/VersionStalenessInfo'\nimport { styles as buildErrorStyles } from '../container/BuildError'\nimport { styles as containerErrorStyles } from '../container/Errors'\nimport { styles as containerRuntimeErrorStyles } from '../container/RuntimeError'\nimport { styles as pseudoHtmlStyles } from '../container/RuntimeError/component-stack-pseudo-html'\nimport { noop as css } from '../helpers/noop-template'\n\nexport function ComponentStyles() {\n return (\n <style>\n {css`\n ${overlay}\n ${toast}\n ${dialog}\n ${leftRightDialogHeader}\n ${codeFrame}\n ${terminal}\n ${buildErrorStyles}\n ${containerErrorStyles}\n ${containerRuntimeErrorStyles}\n ${versionStaleness}\n ${pseudoHtmlStyles}\n `}\n </style>\n )\n}\n"],"names":["ComponentStyles","style","css","overlay","toast","dialog","leftRightDialogHeader","codeFrame","terminal","buildErrorStyles","containerErrorStyles","containerRuntimeErrorStyles","versionStaleness","pseudoHtmlStyles"],"mappings":";;;;+BAagBA;;;eAAAA;;;;;wBAboB;wBACH;yBACe;yBACd;yBACC;uBACH;sCACW;4BACA;wBACI;8BACO;0CACX;8BACf;;;;;;;;;;;;;;;;;;;;;AAErB,SAASA;IACd,qBACE,qBAACC;sBACEC,kBAAG,qBACAC,eAAO,EACPC,aAAK,EACLC,cAAM,EACNC,eAAqB,EACrBC,cAAS,EACTC,eAAQ,EACRC,kBAAgB,EAChBC,cAAoB,EACpBC,oBAA2B,EAC3BC,4BAAgB,EAChBC,gCAAgB;;AAI1B"}
|