next 15.2.0-canary.44 → 15.2.0-canary.45
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 +14 -5
- package/dist/build/index.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/utils.d.ts +1 -1
- package/dist/build/utils.js +6 -1
- package/dist/build/utils.js.map +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.js +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dialog/header.js +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dialog/header.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js +4 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.js +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/version-staleness-info/version-staleness-info.js +3 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/version-staleness-info/version-staleness-info.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/cx.d.ts +7 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/cx.js +29 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/cx.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/cx.test.d.ts +1 -0
- package/dist/client/components/react-dev-overlay/internal/helpers/stack-frame.js +10 -0
- package/dist/client/components/react-dev-overlay/internal/helpers/stack-frame.js.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +3 -3
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +3 -3
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +14 -5
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/utils.js +6 -1
- package/dist/esm/build/utils.js.map +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.js +2 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dialog/header.js +2 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dialog/header.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js +4 -3
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.js +2 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/version-staleness-info/version-staleness-info.js +3 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/version-staleness-info/version-staleness-info.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/helpers/cx.js +13 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/helpers/cx.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/internal/helpers/stack-frame.js +10 -0
- package/dist/esm/client/components/react-dev-overlay/internal/helpers/stack-frame.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/lib/verify-typescript-setup.js +1 -1
- package/dist/esm/lib/verify-typescript-setup.js.map +1 -1
- package/dist/esm/lib/worker.js +3 -2
- package/dist/esm/lib/worker.js.map +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/esm/server/next-server.js +4 -0
- package/dist/esm/server/next-server.js.map +1 -1
- package/dist/esm/server/web/sandbox/resource-managers.js +28 -2
- package/dist/esm/server/web/sandbox/resource-managers.js.map +1 -1
- package/dist/lib/verify-typescript-setup.js +1 -1
- package/dist/lib/verify-typescript-setup.js.map +1 -1
- package/dist/lib/worker.js +3 -2
- package/dist/lib/worker.js.map +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/server/next-server.js +4 -0
- package/dist/server/next-server.js.map +1 -1
- package/dist/server/web/sandbox/resource-managers.d.ts +3 -3
- package/dist/server/web/sandbox/resource-managers.js +28 -2
- package/dist/server/web/sandbox/resource-managers.js.map +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/_experimental/internal/components/copy-button/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { noop as css } from '../../helpers/noop-template'\n\nfunction useCopyLegacy(content: string) {\n type CopyState =\n | {\n state: 'initial'\n }\n | {\n state: 'error'\n error: unknown\n }\n | { state: 'success' }\n | { state: 'pending' }\n\n // This would be simpler with useActionState but we need to support React 18 here.\n // React 18 also doesn't have async transitions.\n const [copyState, dispatch] = React.useReducer(\n (\n state: CopyState,\n action:\n | { type: 'reset' | 'copied' | 'copying' }\n | { type: 'error'; error: unknown }\n ): CopyState => {\n if (action.type === 'reset') {\n return { state: 'initial' }\n }\n if (action.type === 'copied') {\n return { state: 'success' }\n }\n if (action.type === 'copying') {\n return { state: 'pending' }\n }\n if (action.type === 'error') {\n return { state: 'error', error: action.error }\n }\n return state\n },\n {\n state: 'initial',\n }\n )\n function copy() {\n if (isPending) {\n return\n }\n\n if (!navigator.clipboard) {\n dispatch({\n type: 'error',\n error: new Error('Copy to clipboard is not supported in this browser'),\n })\n } else {\n dispatch({ type: 'copying' })\n navigator.clipboard.writeText(content).then(\n () => {\n dispatch({ type: 'copied' })\n },\n (error) => {\n dispatch({ type: 'error', error })\n }\n )\n }\n }\n const reset = React.useCallback(() => {\n dispatch({ type: 'reset' })\n }, [])\n\n const isPending = copyState.state === 'pending'\n\n return [copyState, copy, reset, isPending] as const\n}\n\nfunction useCopyModern(content: string) {\n type CopyState =\n | {\n state: 'initial'\n }\n | {\n state: 'error'\n error: unknown\n }\n | { state: 'success' }\n\n const [copyState, dispatch, isPending] = React.useActionState(\n (\n state: CopyState,\n action: 'reset' | 'copy'\n ): CopyState | Promise<CopyState> => {\n if (action === 'reset') {\n return { state: 'initial' }\n }\n if (action === 'copy') {\n if (!navigator.clipboard) {\n return {\n state: 'error',\n error: new Error(\n 'Copy to clipboard is not supported in this browser'\n ),\n }\n }\n return navigator.clipboard.writeText(content).then(\n () => {\n return { state: 'success' }\n },\n (error) => {\n return { state: 'error', error }\n }\n )\n }\n return state\n },\n {\n state: 'initial',\n }\n )\n\n function copy() {\n React.startTransition(() => {\n dispatch('copy')\n })\n }\n\n const reset = React.useCallback(() => {\n dispatch('reset')\n }, [\n // TODO: `dispatch` from `useActionState` is not reactive.\n // Remove from dependencies once https://github.com/facebook/react/pull/29665 is released.\n dispatch,\n ])\n\n return [copyState, copy, reset, isPending] as const\n}\n\nconst useCopy =\n typeof React.useActionState === 'function' ? useCopyModern : useCopyLegacy\n\nexport function CopyButton({\n actionLabel,\n successLabel,\n content,\n icon,\n disabled,\n ...props\n}: React.HTMLProps<HTMLButtonElement> & {\n actionLabel: string\n successLabel: string\n content: string\n icon?: React.ReactNode\n}) {\n const [copyState, copy, reset, isPending] = useCopy(content)\n\n const error = copyState.state === 'error' ? copyState.error : null\n React.useEffect(() => {\n if (error !== null) {\n // Additional console.error to get the stack.\n console.error(error)\n }\n }, [error])\n React.useEffect(() => {\n if (copyState.state === 'success') {\n const timeoutId = setTimeout(() => {\n reset()\n }, 2000)\n\n return () => {\n clearTimeout(timeoutId)\n }\n }\n }, [isPending, copyState.state, reset])\n const isDisabled = isPending || disabled\n const label = copyState.state === 'success' ? successLabel : actionLabel\n\n // Assign default icon\n const renderedIcon =\n copyState.state === 'success' ? <CopySuccessIcon /> : icon || <CopyIcon />\n\n return (\n <button\n {...props}\n type=\"button\"\n title={label}\n aria-label={label}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-nextjs-data-runtime-error-copy-button\n className={`${props.className || ''} nextjs-data-runtime-error-copy-button nextjs-data-runtime-error-copy-button--${copyState.state}`}\n onClick={() => {\n if (!isDisabled) {\n copy()\n }\n }}\n >\n {renderedIcon}\n {copyState.state === 'error' ? ` ${copyState.error}` : null}\n </button>\n )\n}\n\nfunction CopyIcon() {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"error-overlay-toolbar-button-icon\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction CopySuccessIcon() {\n return (\n <svg\n height=\"16\"\n xlinkTitle=\"copied\"\n viewBox=\"0 0 16 16\"\n width=\"16\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n >\n <path d=\"M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z\" />\n </svg>\n )\n}\n\n// TODO(jiwon): Is not used anymore, should we decouple the styles?\nexport const COPY_BUTTON_STYLES = css`\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--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"],"names":["React","noop","css","useCopyLegacy","content","copyState","dispatch","useReducer","state","action","type","error","copy","isPending","navigator","clipboard","Error","writeText","then","reset","useCallback","useCopyModern","useActionState","startTransition","useCopy","CopyButton","actionLabel","successLabel","icon","disabled","props","useEffect","console","timeoutId","setTimeout","clearTimeout","isDisabled","label","renderedIcon","CopySuccessIcon","CopyIcon","button","title","aria-label","aria-disabled","data-nextjs-data-runtime-error-copy-button","className","onClick","svg","width","height","viewBox","fill","xmlns","path","fillRule","clipRule","d","xlinkTitle","stroke","COPY_BUTTON_STYLES"],"mappings":";;;;;;;;;;;AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,SAASC,cAAcC,OAAe;IAYpC,kFAAkF;IAClF,gDAAgD;IAChD,MAAM,CAACC,WAAWC,SAAS,GAAGN,MAAMO,UAAU,CAC5C,CACEC,OACAC;QAIA,IAAIA,OAAOC,IAAI,KAAK,SAAS;YAC3B,OAAO;gBAAEF,OAAO;YAAU;QAC5B;QACA,IAAIC,OAAOC,IAAI,KAAK,UAAU;YAC5B,OAAO;gBAAEF,OAAO;YAAU;QAC5B;QACA,IAAIC,OAAOC,IAAI,KAAK,WAAW;YAC7B,OAAO;gBAAEF,OAAO;YAAU;QAC5B;QACA,IAAIC,OAAOC,IAAI,KAAK,SAAS;YAC3B,OAAO;gBAAEF,OAAO;gBAASG,OAAOF,OAAOE,KAAK;YAAC;QAC/C;QACA,OAAOH;IACT,GACA;QACEA,OAAO;IACT;IAEF,SAASI;QACP,IAAIC,WAAW;YACb;QACF;QAEA,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,KAAK,UAAU,AAAC,MAAGH,UAAUM,KAAK,GAAK;;;AAG7D;AAEA,SAAS6B;IACP,qBACE,KAACQ;QACCC,OAAM;QACNC,QAAO;QACPC,SAAQ;QACRC,MAAK;QACLC,OAAM;QACNP,WAAU;kBAEV,cAAA,KAACQ;YACCC,UAAS;YACTC,UAAS;YACTC,GAAE;YACFL,MAAK;;;AAIb;AAEA,SAASb;IACP,qBACE,KAACS;QACCE,QAAO;QACPQ,YAAW;QACXP,SAAQ;QACRF,OAAM;QACNU,QAAO;QACPP,MAAK;kBAEL,cAAA,KAACE;YAAKG,GAAE;;;AAGd;AAEA,mEAAmE;AACnE,OAAO,MAAMG,qBAAqB1D,uBA0BjC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/copy-button/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { noop as css } from '../../helpers/noop-template'\nimport { cx } from '../../helpers/cx'\n\nfunction useCopyLegacy(content: string) {\n type CopyState =\n | {\n state: 'initial'\n }\n | {\n state: 'error'\n error: unknown\n }\n | { state: 'success' }\n | { state: 'pending' }\n\n // This would be simpler with useActionState but we need to support React 18 here.\n // React 18 also doesn't have async transitions.\n const [copyState, dispatch] = React.useReducer(\n (\n state: CopyState,\n action:\n | { type: 'reset' | 'copied' | 'copying' }\n | { type: 'error'; error: unknown }\n ): CopyState => {\n if (action.type === 'reset') {\n return { state: 'initial' }\n }\n if (action.type === 'copied') {\n return { state: 'success' }\n }\n if (action.type === 'copying') {\n return { state: 'pending' }\n }\n if (action.type === 'error') {\n return { state: 'error', error: action.error }\n }\n return state\n },\n {\n state: 'initial',\n }\n )\n function copy() {\n if (isPending) {\n return\n }\n\n if (!navigator.clipboard) {\n dispatch({\n type: 'error',\n error: new Error('Copy to clipboard is not supported in this browser'),\n })\n } else {\n dispatch({ type: 'copying' })\n navigator.clipboard.writeText(content).then(\n () => {\n dispatch({ type: 'copied' })\n },\n (error) => {\n dispatch({ type: 'error', error })\n }\n )\n }\n }\n const reset = React.useCallback(() => {\n dispatch({ type: 'reset' })\n }, [])\n\n const isPending = copyState.state === 'pending'\n\n return [copyState, copy, reset, isPending] as const\n}\n\nfunction useCopyModern(content: string) {\n type CopyState =\n | {\n state: 'initial'\n }\n | {\n state: 'error'\n error: unknown\n }\n | { state: 'success' }\n\n const [copyState, dispatch, isPending] = React.useActionState(\n (\n state: CopyState,\n action: 'reset' | 'copy'\n ): CopyState | Promise<CopyState> => {\n if (action === 'reset') {\n return { state: 'initial' }\n }\n if (action === 'copy') {\n if (!navigator.clipboard) {\n return {\n state: 'error',\n error: new Error(\n 'Copy to clipboard is not supported in this browser'\n ),\n }\n }\n return navigator.clipboard.writeText(content).then(\n () => {\n return { state: 'success' }\n },\n (error) => {\n return { state: 'error', error }\n }\n )\n }\n return state\n },\n {\n state: 'initial',\n }\n )\n\n function copy() {\n React.startTransition(() => {\n dispatch('copy')\n })\n }\n\n const reset = React.useCallback(() => {\n dispatch('reset')\n }, [\n // TODO: `dispatch` from `useActionState` is not reactive.\n // Remove from dependencies once https://github.com/facebook/react/pull/29665 is released.\n dispatch,\n ])\n\n return [copyState, copy, reset, isPending] as const\n}\n\nconst useCopy =\n typeof React.useActionState === 'function' ? useCopyModern : useCopyLegacy\n\nexport function CopyButton({\n actionLabel,\n successLabel,\n content,\n icon,\n disabled,\n ...props\n}: React.HTMLProps<HTMLButtonElement> & {\n actionLabel: string\n successLabel: string\n content: string\n icon?: React.ReactNode\n}) {\n const [copyState, copy, reset, isPending] = useCopy(content)\n\n const error = copyState.state === 'error' ? copyState.error : null\n React.useEffect(() => {\n if (error !== null) {\n // Additional console.error to get the stack.\n console.error(error)\n }\n }, [error])\n React.useEffect(() => {\n if (copyState.state === 'success') {\n const timeoutId = setTimeout(() => {\n reset()\n }, 2000)\n\n return () => {\n clearTimeout(timeoutId)\n }\n }\n }, [isPending, copyState.state, reset])\n const isDisabled = isPending || disabled\n const label = copyState.state === 'success' ? successLabel : actionLabel\n\n // Assign default icon\n const renderedIcon =\n copyState.state === 'success' ? <CopySuccessIcon /> : icon || <CopyIcon />\n\n return (\n <button\n {...props}\n type=\"button\"\n title={label}\n aria-label={label}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-nextjs-data-runtime-error-copy-button\n className={cx(\n props.className,\n 'nextjs-data-runtime-error-copy-button',\n `nextjs-data-runtime-error-copy-button--${copyState.state}`\n )}\n onClick={() => {\n if (!isDisabled) {\n copy()\n }\n }}\n >\n {renderedIcon}\n {copyState.state === 'error' ? ` ${copyState.error}` : null}\n </button>\n )\n}\n\nfunction CopyIcon() {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"error-overlay-toolbar-button-icon\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction CopySuccessIcon() {\n return (\n <svg\n height=\"16\"\n xlinkTitle=\"copied\"\n viewBox=\"0 0 16 16\"\n width=\"16\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n >\n <path d=\"M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z\" />\n </svg>\n )\n}\n\n// TODO(jiwon): Is not used anymore, should we decouple the styles?\nexport const COPY_BUTTON_STYLES = css`\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--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"],"names":["React","noop","css","cx","useCopyLegacy","content","copyState","dispatch","useReducer","state","action","type","error","copy","isPending","navigator","clipboard","Error","writeText","then","reset","useCallback","useCopyModern","useActionState","startTransition","useCopy","CopyButton","actionLabel","successLabel","icon","disabled","props","useEffect","console","timeoutId","setTimeout","clearTimeout","isDisabled","label","renderedIcon","CopySuccessIcon","CopyIcon","button","title","aria-label","aria-disabled","data-nextjs-data-runtime-error-copy-button","className","onClick","svg","width","height","viewBox","fill","xmlns","path","fillRule","clipRule","d","xlinkTitle","stroke","COPY_BUTTON_STYLES"],"mappings":";;;;;;;;;;;AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,QAAQC,GAAG,QAAQ,8BAA6B;AACzD,SAASC,EAAE,QAAQ,mBAAkB;AAErC,SAASC,cAAcC,OAAe;IAYpC,kFAAkF;IAClF,gDAAgD;IAChD,MAAM,CAACC,WAAWC,SAAS,GAAGP,MAAMQ,UAA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AagB;IAChC,MAAMQ,QAAQhC,UAAUG,KAAK,KAAK,YAAYmB,eAAeD;IAE7D,sBAAsB;IACtB,MAAMY,eACJjC,UAAUG,KAAK,KAAK,0BAAY,KAAC+B,uBAAqBX,sBAAQ,KAACY;IAEjE,qBACE,MAACC;QACE,GAAGX,KAAK;QACTpB,MAAK;QACLgC,OAAOL;QACPM,cAAYN;QACZO,iBAAeR;QACfP,UAAUO;QACVS,4CAA0C;QAC1CC,WAAW5C,GACT4B,MAAMgB,SAAS,EACf,yCACA,AAAC,4CAAyCzC,UAAUG,KAAK;QAE3DuC,SAAS;YACP,IAAI,CAACX,YAAY;gBACfxB;YACF;QACF;;YAEC0B;YACAjC,UAAUG,KAAK,KAAK,UAAU,AAAC,MAAGH,UAAUM,KAAK,GAAK;;;AAG7D;AAEA,SAAS6B;IACP,qBACE,KAACQ;QACCC,OAAM;QACNC,QAAO;QACPC,SAAQ;QACRC,MAAK;QACLC,OAAM;QACNP,WAAU;kBAEV,cAAA,KAACQ;YACCC,UAAS;YACTC,UAAS;YACTC,GAAE;YACFL,MAAK;;;AAIb;AAEA,SAASb;IACP,qBACE,KAACS;QACCE,QAAO;QACPQ,YAAW;QACXP,SAAQ;QACRF,OAAM;QACNU,QAAO;QACPP,MAAK;kBAEL,cAAA,KAACE;YAAKG,GAAE;;;AAGd;AAEA,mEAAmE;AACnE,OAAO,MAAMG,qBAAqB3D,uBA0BjC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as _tagged_template_literal_loose } from "@swc/helpers/_/_tagged_template_literal_loose";
|
|
2
2
|
function _templateObject() {
|
|
3
3
|
const data = _tagged_template_literal_loose([
|
|
4
|
-
"\n [data-nextjs-dialog-root] {\n --next-dialog-radius: var(--rounded-xl);\n --next-dialog-footer-height: 48px;\n --next-dialog-max-width: 960px;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n max-height: calc(100% - 56px);\n max-width: var(--next-dialog-max-width);\n margin-right: auto;\n margin-left: auto;\n scale: 0.98;\n opacity: 0;\n transition-property: scale, opacity;\n transition-duration: var(--transition-duration);\n transition-timing-function: var(--timing-overlay);\n\n &[data-rendered='true'] {\n opacity: 1;\n scale: 1;\n }\n }\n\n [data-nextjs-dialog] {\n outline: none;\n }\n\n /* Place overflow: hidden on this so we can break out from [data-nextjs-dialog] */\n [data-nextjs-dialog-sizer] {\n overflow: hidden;\n border-radius: inherit;\n }\n\n [data-nextjs-dialog-backdrop] {\n opacity: 0;\n transition: opacity var(--transition-duration) var(--timing-overlay);\n }\n\n [data-nextjs-dialog-overlay][data-rendered='true']\n [data-nextjs-dialog-backdrop] {\n opacity: 1;\n }\n\n [data-nextjs-dialog-content] {\n border: none;\n margin: 0;\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n\n /* Account for the footer height, when present */\n [data-nextjs-dialog-body]:has(~ [data-nextjs-dialog-footer]) {\n margin-bottom: calc(var(--next-dialog-footer-height) + 2px);\n }\n\n [data-nextjs-dialog-content] > [data-nextjs-dialog-header] {\n flex-shrink: 0;\n padding: var(--size-4);\n }\n\n [data-nextjs-dialog-content] > [data-nextjs-dialog-body] {\n position: relative;\n flex: 1 1 auto;\n }\n\n [data-nextjs-dialog-footer] {\n width: 100%;\n /* We make this element absolute to fix it to the bottom during the height transition */\n position: absolute;\n bottom: 0;\n min-height: var(--next-dialog-footer-height);\n border-radius: 0 0 var(--next-dialog-radius) var(--next-dialog-radius);\n overflow: hidden;\n\n > * {\n height: 100%;\n }\n }\n\n @media (max-height: 812px) {\n [data-nextjs-dialog-overlay] {\n max-height: calc(100% - 15px);\n }\n }\n\n @media (min-width: 576px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 540px;\n }\n }\n\n @media (min-width: 768px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 720px;\n }\n }\n\n @media (min-width: 992px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 960px;\n }\n }\n"
|
|
4
|
+
"\n [data-nextjs-dialog-root] {\n --next-dialog-radius: var(--rounded-xl);\n --next-dialog-footer-height: 48px;\n --next-dialog-max-width: 960px;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n max-height: calc(100% - 56px);\n max-width: var(--next-dialog-max-width);\n margin-right: auto;\n margin-left: auto;\n scale: 0.98;\n opacity: 0;\n transition-property: scale, opacity;\n transition-duration: var(--transition-duration);\n transition-timing-function: var(--timing-overlay);\n\n &[data-rendered='true'] {\n opacity: 1;\n scale: 1;\n }\n }\n\n [data-nextjs-dialog] {\n outline: none;\n }\n\n /* Place overflow: hidden on this so we can break out from [data-nextjs-dialog] */\n [data-nextjs-dialog-sizer] {\n overflow: hidden;\n border-radius: inherit;\n }\n\n [data-nextjs-dialog-backdrop] {\n opacity: 0;\n transition: opacity var(--transition-duration) var(--timing-overlay);\n }\n\n [data-nextjs-dialog-overlay][data-rendered='true']\n [data-nextjs-dialog-backdrop] {\n opacity: 1;\n }\n\n [data-nextjs-dialog-content] {\n border: none;\n margin: 0;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n /* Account for the footer height, when present */\n [data-nextjs-dialog-body]:has(~ [data-nextjs-dialog-footer]) {\n margin-bottom: calc(var(--next-dialog-footer-height) + 2px);\n }\n\n [data-nextjs-dialog-content] > [data-nextjs-dialog-header] {\n flex-shrink: 0;\n padding: var(--size-4);\n }\n\n [data-nextjs-dialog-content] > [data-nextjs-dialog-body] {\n position: relative;\n flex: 1 1 auto;\n }\n\n [data-nextjs-dialog-footer] {\n width: 100%;\n /* We make this element absolute to fix it to the bottom during the height transition */\n position: absolute;\n bottom: 0;\n min-height: var(--next-dialog-footer-height);\n border-radius: 0 0 var(--next-dialog-radius) var(--next-dialog-radius);\n overflow: hidden;\n\n > * {\n height: 100%;\n }\n }\n\n @media (max-height: 812px) {\n [data-nextjs-dialog-overlay] {\n max-height: calc(100% - 15px);\n }\n }\n\n @media (min-width: 576px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 540px;\n }\n }\n\n @media (min-width: 768px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 720px;\n }\n }\n\n @media (min-width: 992px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 960px;\n }\n }\n"
|
|
5
5
|
]);
|
|
6
6
|
_templateObject = function() {
|
|
7
7
|
return data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.ts"],"sourcesContent":["import { noop as css } from '../../helpers/noop-template'\n\nconst styles = css`\n [data-nextjs-dialog-root] {\n --next-dialog-radius: var(--rounded-xl);\n --next-dialog-footer-height: 48px;\n --next-dialog-max-width: 960px;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n max-height: calc(100% - 56px);\n max-width: var(--next-dialog-max-width);\n margin-right: auto;\n margin-left: auto;\n scale: 0.98;\n opacity: 0;\n transition-property: scale, opacity;\n transition-duration: var(--transition-duration);\n transition-timing-function: var(--timing-overlay);\n\n &[data-rendered='true'] {\n opacity: 1;\n scale: 1;\n }\n }\n\n [data-nextjs-dialog] {\n outline: none;\n }\n\n /* Place overflow: hidden on this so we can break out from [data-nextjs-dialog] */\n [data-nextjs-dialog-sizer] {\n overflow: hidden;\n border-radius: inherit;\n }\n\n [data-nextjs-dialog-backdrop] {\n opacity: 0;\n transition: opacity var(--transition-duration) var(--timing-overlay);\n }\n\n [data-nextjs-dialog-overlay][data-rendered='true']\n [data-nextjs-dialog-backdrop] {\n opacity: 1;\n }\n\n [data-nextjs-dialog-content] {\n border: none;\n margin: 0;\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n\n /* Account for the footer height, when present */\n [data-nextjs-dialog-body]:has(~ [data-nextjs-dialog-footer]) {\n margin-bottom: calc(var(--next-dialog-footer-height) + 2px);\n }\n\n [data-nextjs-dialog-content] > [data-nextjs-dialog-header] {\n flex-shrink: 0;\n padding: var(--size-4);\n }\n\n [data-nextjs-dialog-content] > [data-nextjs-dialog-body] {\n position: relative;\n flex: 1 1 auto;\n }\n\n [data-nextjs-dialog-footer] {\n width: 100%;\n /* We make this element absolute to fix it to the bottom during the height transition */\n position: absolute;\n bottom: 0;\n min-height: var(--next-dialog-footer-height);\n border-radius: 0 0 var(--next-dialog-radius) var(--next-dialog-radius);\n overflow: hidden;\n\n > * {\n height: 100%;\n }\n }\n\n @media (max-height: 812px) {\n [data-nextjs-dialog-overlay] {\n max-height: calc(100% - 15px);\n }\n }\n\n @media (min-width: 576px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 540px;\n }\n }\n\n @media (min-width: 768px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 720px;\n }\n }\n\n @media (min-width: 992px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 960px;\n }\n }\n`\n\nexport { styles }\n"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/dialog/styles.ts"],"sourcesContent":["import { noop as css } from '../../helpers/noop-template'\n\nconst styles = css`\n [data-nextjs-dialog-root] {\n --next-dialog-radius: var(--rounded-xl);\n --next-dialog-footer-height: 48px;\n --next-dialog-max-width: 960px;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n max-height: calc(100% - 56px);\n max-width: var(--next-dialog-max-width);\n margin-right: auto;\n margin-left: auto;\n scale: 0.98;\n opacity: 0;\n transition-property: scale, opacity;\n transition-duration: var(--transition-duration);\n transition-timing-function: var(--timing-overlay);\n\n &[data-rendered='true'] {\n opacity: 1;\n scale: 1;\n }\n }\n\n [data-nextjs-dialog] {\n outline: none;\n }\n\n /* Place overflow: hidden on this so we can break out from [data-nextjs-dialog] */\n [data-nextjs-dialog-sizer] {\n overflow: hidden;\n border-radius: inherit;\n }\n\n [data-nextjs-dialog-backdrop] {\n opacity: 0;\n transition: opacity var(--transition-duration) var(--timing-overlay);\n }\n\n [data-nextjs-dialog-overlay][data-rendered='true']\n [data-nextjs-dialog-backdrop] {\n opacity: 1;\n }\n\n [data-nextjs-dialog-content] {\n border: none;\n margin: 0;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n /* Account for the footer height, when present */\n [data-nextjs-dialog-body]:has(~ [data-nextjs-dialog-footer]) {\n margin-bottom: calc(var(--next-dialog-footer-height) + 2px);\n }\n\n [data-nextjs-dialog-content] > [data-nextjs-dialog-header] {\n flex-shrink: 0;\n padding: var(--size-4);\n }\n\n [data-nextjs-dialog-content] > [data-nextjs-dialog-body] {\n position: relative;\n flex: 1 1 auto;\n }\n\n [data-nextjs-dialog-footer] {\n width: 100%;\n /* We make this element absolute to fix it to the bottom during the height transition */\n position: absolute;\n bottom: 0;\n min-height: var(--next-dialog-footer-height);\n border-radius: 0 0 var(--next-dialog-radius) var(--next-dialog-radius);\n overflow: hidden;\n\n > * {\n height: 100%;\n }\n }\n\n @media (max-height: 812px) {\n [data-nextjs-dialog-overlay] {\n max-height: calc(100% - 15px);\n }\n }\n\n @media (min-width: 576px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 540px;\n }\n }\n\n @media (min-width: 768px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 720px;\n }\n }\n\n @media (min-width: 992px) {\n [data-nextjs-dialog-root] {\n --next-dialog-max-width: 960px;\n }\n }\n`\n\nexport { styles }\n"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;AA4Gf,SAASC,MAAM,GAAE"}
|
|
@@ -11,10 +11,11 @@ function _templateObject() {
|
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { DialogHeader } from '../../dialog/dialog-header';
|
|
13
13
|
import { noop as css } from '../../../helpers/noop-template';
|
|
14
|
+
import { cx } from '../../../helpers/cx';
|
|
14
15
|
export function ErrorOverlayDialogHeader(param) {
|
|
15
16
|
let { children, isTurbopack } = param;
|
|
16
17
|
return /*#__PURE__*/ _jsx(DialogHeader, {
|
|
17
|
-
className:
|
|
18
|
+
className: cx('nextjs-container-errors-header', isTurbopack && 'nextjs-error-overlay-dialog-header-turbopack-background'),
|
|
18
19
|
children: children
|
|
19
20
|
});
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/errors/dialog/header.tsx"],"sourcesContent":["import { DialogHeader } from '../../dialog/dialog-header'\nimport { noop as css } from '../../../helpers/noop-template'\n\ntype ErrorOverlayDialogHeaderProps = {\n children?: React.ReactNode\n isTurbopack?: boolean\n}\n\nexport function ErrorOverlayDialogHeader({\n children,\n isTurbopack,\n}: ErrorOverlayDialogHeaderProps) {\n return (\n <DialogHeader\n className={
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/errors/dialog/header.tsx"],"sourcesContent":["import { DialogHeader } from '../../dialog/dialog-header'\nimport { noop as css } from '../../../helpers/noop-template'\nimport { cx } from '../../../helpers/cx'\n\ntype ErrorOverlayDialogHeaderProps = {\n children?: React.ReactNode\n isTurbopack?: boolean\n}\n\nexport function ErrorOverlayDialogHeader({\n children,\n isTurbopack,\n}: ErrorOverlayDialogHeaderProps) {\n return (\n <DialogHeader\n className={cx(\n 'nextjs-container-errors-header',\n isTurbopack && 'nextjs-error-overlay-dialog-header-turbopack-background'\n )}\n >\n {children}\n </DialogHeader>\n )\n}\n\nexport const DIALOG_HEADER_STYLES = css`\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 > 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-header\n > .nextjs-container-build-error-version-status {\n position: absolute;\n top: var(--size-4);\n right: var(--size-4);\n }\n\n .nextjs-error-overlay-dialog-header-turbopack-background {\n background-image: linear-gradient(\n 10deg,\n var(--color-background-100) 60%,\n var(--color-turbopack-background-red) 75%,\n var(--color-turbopack-background-blue) 100%\n );\n }\n`\n"],"names":["DialogHeader","noop","css","cx","ErrorOverlayDialogHeader","children","isTurbopack","className","DIALOG_HEADER_STYLES"],"mappings":";;;;;;;;;;;AAAA,SAASA,YAAY,QAAQ,6BAA4B;AACzD,SAASC,QAAQC,GAAG,QAAQ,iCAAgC;AAC5D,SAASC,EAAE,QAAQ,sBAAqB;AAOxC,OAAO,SAASC,yBAAyB,KAGT;IAHS,IAAA,EACvCC,QAAQ,EACRC,WAAW,EACmB,GAHS;IAIvC,qBACE,KAACN;QACCO,WAAWJ,GACT,kCACAG,eAAe;kBAGhBD;;AAGP;AAEA,OAAO,MAAMG,uBAAuBN,uBA0CnC"}
|
|
@@ -13,6 +13,7 @@ import { useState, useCallback } from 'react';
|
|
|
13
13
|
import { ThumbsUp } from '../../../../icons/thumbs/thumbs-up';
|
|
14
14
|
import { ThumbsDown } from '../../../../icons/thumbs/thumbs-down';
|
|
15
15
|
import { noop as css } from '../../../../helpers/noop-template';
|
|
16
|
+
import { cx } from '../../../../helpers/cx';
|
|
16
17
|
export function ErrorFeedback(param) {
|
|
17
18
|
let { errorCode, className } = param;
|
|
18
19
|
const [votedMap, setVotedMap] = useState({});
|
|
@@ -40,7 +41,7 @@ export function ErrorFeedback(param) {
|
|
|
40
41
|
errorCode
|
|
41
42
|
]);
|
|
42
43
|
return /*#__PURE__*/ _jsx("div", {
|
|
43
|
-
className:
|
|
44
|
+
className: cx('error-feedback', className),
|
|
44
45
|
role: "region",
|
|
45
46
|
"aria-label": "Error feedback",
|
|
46
47
|
children: hasVoted ? /*#__PURE__*/ _jsx("p", {
|
|
@@ -56,7 +57,7 @@ export function ErrorFeedback(param) {
|
|
|
56
57
|
/*#__PURE__*/ _jsx("button", {
|
|
57
58
|
"aria-label": "Mark as helpful",
|
|
58
59
|
onClick: ()=>handleFeedback(true),
|
|
59
|
-
className:
|
|
60
|
+
className: cx('feedback-button', voted === true && 'voted'),
|
|
60
61
|
type: "button",
|
|
61
62
|
children: /*#__PURE__*/ _jsx(ThumbsUp, {
|
|
62
63
|
"aria-hidden": "true"
|
|
@@ -65,7 +66,7 @@ export function ErrorFeedback(param) {
|
|
|
65
66
|
/*#__PURE__*/ _jsx("button", {
|
|
66
67
|
"aria-label": "Mark as not helpful",
|
|
67
68
|
onClick: ()=>handleFeedback(false),
|
|
68
|
-
className:
|
|
69
|
+
className: cx('feedback-button', voted === false && 'voted'),
|
|
69
70
|
type: "button",
|
|
70
71
|
children: /*#__PURE__*/ _jsx(ThumbsDown, {
|
|
71
72
|
"aria-hidden": "true",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.tsx"],"sourcesContent":["import { useState, useCallback } from 'react'\nimport { ThumbsUp } from '../../../../icons/thumbs/thumbs-up'\nimport { ThumbsDown } from '../../../../icons/thumbs/thumbs-down'\nimport { noop as css } from '../../../../helpers/noop-template'\n\ninterface ErrorFeedbackProps {\n errorCode: string\n className?: string\n}\nexport function ErrorFeedback({ errorCode, className }: ErrorFeedbackProps) {\n const [votedMap, setVotedMap] = useState<Record<string, boolean>>({})\n const voted = votedMap[errorCode]\n const hasVoted = voted !== undefined\n\n const handleFeedback = useCallback(\n async (wasHelpful: boolean) => {\n // Optimistically set feedback state without loading/error states to keep implementation simple\n setVotedMap((prev) => ({\n ...prev,\n [errorCode]: wasHelpful,\n }))\n\n try {\n const response = await fetch(\n `${process.env.__NEXT_ROUTER_BASEPATH || ''}/__nextjs_error_feedback?${new URLSearchParams(\n {\n errorCode,\n wasHelpful: wasHelpful.toString(),\n }\n )}`\n )\n\n if (!response.ok) {\n // Handle non-2xx HTTP responses here if needed\n console.error('Failed to record feedback on the server.')\n }\n } catch (error) {\n console.error('Failed to record feedback:', error)\n }\n },\n [errorCode]\n )\n\n return (\n <div\n className={
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.tsx"],"sourcesContent":["import { useState, useCallback } from 'react'\nimport { ThumbsUp } from '../../../../icons/thumbs/thumbs-up'\nimport { ThumbsDown } from '../../../../icons/thumbs/thumbs-down'\nimport { noop as css } from '../../../../helpers/noop-template'\nimport { cx } from '../../../../helpers/cx'\n\ninterface ErrorFeedbackProps {\n errorCode: string\n className?: string\n}\nexport function ErrorFeedback({ errorCode, className }: ErrorFeedbackProps) {\n const [votedMap, setVotedMap] = useState<Record<string, boolean>>({})\n const voted = votedMap[errorCode]\n const hasVoted = voted !== undefined\n\n const handleFeedback = useCallback(\n async (wasHelpful: boolean) => {\n // Optimistically set feedback state without loading/error states to keep implementation simple\n setVotedMap((prev) => ({\n ...prev,\n [errorCode]: wasHelpful,\n }))\n\n try {\n const response = await fetch(\n `${process.env.__NEXT_ROUTER_BASEPATH || ''}/__nextjs_error_feedback?${new URLSearchParams(\n {\n errorCode,\n wasHelpful: wasHelpful.toString(),\n }\n )}`\n )\n\n if (!response.ok) {\n // Handle non-2xx HTTP responses here if needed\n console.error('Failed to record feedback on the server.')\n }\n } catch (error) {\n console.error('Failed to record feedback:', error)\n }\n },\n [errorCode]\n )\n\n return (\n <div\n className={cx('error-feedback', className)}\n role=\"region\"\n aria-label=\"Error feedback\"\n >\n {hasVoted ? (\n <p className=\"error-feedback-thanks\" role=\"status\" aria-live=\"polite\">\n Thanks for your feedback!\n </p>\n ) : (\n <>\n <p>Was this helpful?</p>\n <button\n aria-label=\"Mark as helpful\"\n onClick={() => handleFeedback(true)}\n className={cx('feedback-button', voted === true && 'voted')}\n type=\"button\"\n >\n <ThumbsUp aria-hidden=\"true\" />\n </button>\n <button\n aria-label=\"Mark as not helpful\"\n onClick={() => handleFeedback(false)}\n className={cx('feedback-button', voted === false && 'voted')}\n type=\"button\"\n >\n <ThumbsDown\n aria-hidden=\"true\"\n // Optical alignment\n style={{\n translate: '1px 1px',\n }}\n />\n </button>\n </>\n )}\n </div>\n )\n}\n\nexport const styles = css`\n .error-feedback {\n display: flex;\n align-items: center;\n gap: var(--size-gap);\n white-space: nowrap;\n color: var(--color-gray-900);\n }\n\n .error-feedback-thanks {\n height: 24px;\n display: flex;\n align-items: center;\n padding-right: 4px; /* To match the 4px inner padding of the thumbs up and down icons */\n }\n\n .feedback-button {\n background: none;\n border: none;\n border-radius: var(--rounded-md);\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n\n &:focus {\n outline: var(--focus-ring);\n }\n\n &:hover {\n background: var(--color-gray-alpha-100);\n }\n\n &:active {\n background: var(--color-gray-alpha-200);\n }\n }\n\n .feedback-button:disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .feedback-button.voted {\n background: var(--color-gray-alpha-200);\n }\n\n .thumbs-up-icon,\n .thumbs-down-icon {\n color: var(--color-gray-900);\n }\n`\n"],"names":["useState","useCallback","ThumbsUp","ThumbsDown","noop","css","cx","ErrorFeedback","errorCode","className","votedMap","setVotedMap","voted","hasVoted","undefined","handleFeedback","wasHelpful","prev","response","fetch","process","env","__NEXT_ROUTER_BASEPATH","URLSearchParams","toString","ok","console","error","div","role","aria-label","p","aria-live","button","onClick","type","aria-hidden","style","translate","styles"],"mappings":";;;;;;;;;;;AAAA,SAASA,QAAQ,EAAEC,WAAW,QAAQ,QAAO;AAC7C,SAASC,QAAQ,QAAQ,qCAAoC;AAC7D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uB,MAAK;8BAEL,cAAA,KAAChC;wBACCiC,eAAY;wBACZ,oBAAoB;wBACpBC,OAAO;4BACLC,WAAW;wBACb;;;;;;AAOd;AAEA,OAAO,MAAMC,SAASlC,uBAqDrB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { cx } from '../../helpers/cx';
|
|
3
4
|
export const Toast = function Toast(param) {
|
|
4
5
|
let { onClick, children, className, ...props } = param;
|
|
5
6
|
return /*#__PURE__*/ _jsx("div", {
|
|
@@ -8,7 +9,7 @@ export const Toast = function Toast(param) {
|
|
|
8
9
|
e.preventDefault();
|
|
9
10
|
return onClick == null ? void 0 : onClick();
|
|
10
11
|
},
|
|
11
|
-
className:
|
|
12
|
+
className: cx('nextjs-toast', className),
|
|
12
13
|
children: /*#__PURE__*/ _jsx("div", {
|
|
13
14
|
"data-nextjs-toast-wrapper": true,
|
|
14
15
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.tsx"],"sourcesContent":["import * as React from 'react'\
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/toast/toast.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cx } from '../../helpers/cx'\nexport type ToastProps = React.HTMLProps<HTMLDivElement> & {\n children?: React.ReactNode\n onClick?: () => void\n className?: string\n}\n\nexport const Toast: React.FC<ToastProps> = function Toast({\n onClick,\n children,\n className,\n ...props\n}) {\n return (\n <div\n {...props}\n onClick={(e) => {\n e.preventDefault()\n return onClick?.()\n }}\n className={cx('nextjs-toast', className)}\n >\n <div data-nextjs-toast-wrapper>{children}</div>\n </div>\n )\n}\n"],"names":["React","cx","Toast","onClick","children","className","props","div","e","preventDefault","data-nextjs-toast-wrapper"],"mappings":";AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,EAAE,QAAQ,mBAAkB;AAOrC,OAAO,MAAMC,QAA8B,SAASA,MAAM,KAKzD;IALyD,IAAA,EACxDC,OAAO,EACPC,QAAQ,EACRC,SAAS,EACT,GAAGC,OACJ,GALyD;IAMxD,qBACE,KAACC;QACE,GAAGD,KAAK;QACTH,SAAS,CAACK;YACRA,EAAEC,cAAc;YAChB,OAAON,2BAAAA;QACT;QACAE,WAAWJ,GAAG,gBAAgBI;kBAE9B,cAAA,KAACE;YAAIG,2BAAyB;sBAAEN;;;AAGtC,EAAC"}
|
|
@@ -9,6 +9,7 @@ function _templateObject() {
|
|
|
9
9
|
return data;
|
|
10
10
|
}
|
|
11
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { cx } from '../../helpers/cx';
|
|
12
13
|
import { noop as css } from '../../helpers/noop-template';
|
|
13
14
|
export function VersionStalenessInfo(param) {
|
|
14
15
|
let { versionInfo, isTurbopack } = param;
|
|
@@ -17,10 +18,10 @@ export function VersionStalenessInfo(param) {
|
|
|
17
18
|
let { text, indicatorClass, title } = getStaleness(versionInfo);
|
|
18
19
|
if (!text) return null;
|
|
19
20
|
return /*#__PURE__*/ _jsxs("span", {
|
|
20
|
-
className:
|
|
21
|
+
className: cx('nextjs-container-build-error-version-status', 'dialog-exclude-closing-from-outside-click', isTurbopack && 'turbopack-border'),
|
|
21
22
|
children: [
|
|
22
23
|
/*#__PURE__*/ _jsx(Eclipse, {
|
|
23
|
-
className:
|
|
24
|
+
className: cx('version-staleness-indicator', indicatorClass)
|
|
24
25
|
}),
|
|
25
26
|
/*#__PURE__*/ _jsx("span", {
|
|
26
27
|
"data-nextjs-version-checker": true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/version-staleness-info/version-staleness-info.tsx"],"sourcesContent":["import type { VersionInfo } from '../../../../../../../server/dev/parse-version-info'\nimport { noop as css } from '../../helpers/noop-template'\n\nexport function VersionStalenessInfo({\n versionInfo,\n isTurbopack,\n}: {\n versionInfo: VersionInfo | undefined\n isTurbopack?: boolean\n}) {\n if (!versionInfo) return null\n const { staleness } = versionInfo\n let { text, indicatorClass, title } = getStaleness(versionInfo)\n\n if (!text) return null\n\n return (\n <span\n className={
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/version-staleness-info/version-staleness-info.tsx"],"sourcesContent":["import type { VersionInfo } from '../../../../../../../server/dev/parse-version-info'\nimport { cx } from '../../helpers/cx'\nimport { noop as css } from '../../helpers/noop-template'\n\nexport function VersionStalenessInfo({\n versionInfo,\n isTurbopack,\n}: {\n versionInfo: VersionInfo | undefined\n isTurbopack?: boolean\n}) {\n if (!versionInfo) return null\n const { staleness } = versionInfo\n let { text, indicatorClass, title } = getStaleness(versionInfo)\n\n if (!text) return null\n\n return (\n <span\n className={cx(\n 'nextjs-container-build-error-version-status',\n 'dialog-exclude-closing-from-outside-click',\n isTurbopack && 'turbopack-border'\n )}\n >\n <Eclipse className={cx('version-staleness-indicator', indicatorClass)} />\n <span data-nextjs-version-checker title={title}>\n {text}\n </span>{' '}\n {staleness === 'fresh' ||\n staleness === 'newer-than-npm' ||\n staleness === 'unknown' ? null : (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href=\"https://nextjs.org/docs/messages/version-staleness\"\n >\n (learn more)\n </a>\n )}\n {isTurbopack && <span className=\"turbopack-text\">Turbopack</span>}\n </span>\n )\n}\n\nexport function getStaleness({ installed, staleness, expected }: VersionInfo) {\n let text = ''\n let title = ''\n let indicatorClass = ''\n const versionLabel = `Next.js ${installed}`\n switch (staleness) {\n case 'newer-than-npm':\n case 'fresh':\n text = versionLabel\n title = `Latest available version is detected (${installed}).`\n indicatorClass = 'fresh'\n break\n case 'stale-patch':\n case 'stale-minor':\n text = `${versionLabel} (stale)`\n title = `There is a newer version (${expected}) available, upgrade recommended! `\n indicatorClass = 'stale'\n break\n case 'stale-major': {\n text = `${versionLabel} (outdated)`\n title = `An outdated version detected (latest is ${expected}), upgrade is highly recommended!`\n indicatorClass = 'outdated'\n break\n }\n case 'stale-prerelease': {\n text = `${versionLabel} (stale)`\n title = `There is a newer canary version (${expected}) available, please upgrade! `\n indicatorClass = 'stale'\n break\n }\n case 'unknown':\n break\n default:\n break\n }\n return { text, indicatorClass, title }\n}\n\nexport const styles = css`\n .nextjs-container-build-error-version-status {\n -webkit-font-smoothing: antialiased;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: var(--size-1);\n\n height: 28px;\n padding: 6px 8px 6px 6px;\n background: var(--color-background-100);\n background-clip: padding-box;\n box-shadow: var(--shadow-small);\n border: 1px solid var(--color-gray-alpha-400);\n border-radius: var(--rounded-full);\n\n color: var(--color-gray-900);\n font-size: 12px;\n font-weight: 500;\n line-height: var(--size-4);\n }\n\n .version-staleness-indicator.fresh {\n fill: var(--color-green-800);\n stroke: var(--color-green-300);\n }\n .version-staleness-indicator.stale {\n fill: var(--color-amber-800);\n stroke: var(--color-amber-300);\n }\n .version-staleness-indicator.outdated {\n fill: var(--color-red-800);\n stroke: var(--color-red-300);\n }\n\n .nextjs-container-build-error-version-status.turbopack-border {\n border: 1px solid transparent;\n background:\n linear-gradient(var(--color-background-100), var(--color-background-100))\n padding-box,\n linear-gradient(\n to right,\n var(--color-turbopack-border-red) 0%,\n var(--color-turbopack-border-blue) 100%\n )\n border-box;\n border-radius: var(--rounded-full);\n }\n\n .nextjs-container-build-error-version-status > .turbopack-text {\n background: linear-gradient(\n to right,\n var(--color-turbopack-text-red) 0%,\n var(--color-turbopack-text-blue) 100%\n );\n background-clip: text;\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n }\n`\n\nfunction Eclipse({ className }: { className: string }) {\n return (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle className={className} cx=\"7\" cy=\"7\" r=\"5.5\" strokeWidth=\"3\" />\n </svg>\n )\n}\n"],"names":["cx","noop","css","VersionStalenessInfo","versionInfo","isTurbopack","staleness","text","indicatorClass","title","getStaleness","span","className","Eclipse","data-nextjs-version-checker","a","target","rel","href","installed","expected","versionLabel","styles","svg","width","height","viewBox","fill","xmlns","circle","cy","r","strokeWidth"],"mappings":";;;;;;;;;;;AACA,SAASA,EAAE,QAAQ,mBAAkB;AACrC,SAASC,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,OAAO,SAASC,qBAAqB,KAMpC;IANoC,IAAA,EACnCC,WAAW,EACXC,WAAW,EAIZ,GANoC;IAOnC,IAAI,CAACD,aAAa,OAAO;IACzB,MAAM,EAAEE,SAAS,EAAE,GAAGF;IACtB,IAAI,EAAEG,IAAI,EAAEC,cAAc,EAAEC,KAAK,EAAE,GAAGC,aAAaN;IAEnD,IAAI,CAACG,MAAM,OAAO;IAElB,qBACE,MAACI;QACCC,WAAWZ,GACT,+CACA,6CACAK,eAAe;;0BAGjB,KAACQ;gBAAQD,WAAWZ,GAAG,+BAA+BQ;;0BACtD,KAACG;gBAAKG,6BAA2B;gBAACL,OAAOA;0BACtCF;;YACK;YACPD,cAAc,WACfA,cAAc,oBACdA,cAAc,YAAY,qBACxB,KAACS;gBACCC,QAAO;gBACPC,KAAI;gBACJC,MAAK;0BACN;;YAIFb,6BAAe,KAACM;gBAAKC,WAAU;0BAAiB;;;;AAGvD;AAEA,OAAO,SAASF,aAAa,KAA+C;IAA/C,IAAA,EAAES,SAAS,EAAEb,SAAS,EAAEc,QAAQ,EAAe,GAA/C;IAC3B,IAAIb,OAAO;IACX,IAAIE,QAAQ;IACZ,IAAID,iBAAiB;IACrB,MAAMa,eAAe,AAAC,aAAUF;IAChC,OAAQb;QACN,KAAK;QACL,KAAK;YACHC,OAAOc;YACPZ,QAAQ,AAAC,2CAAwCU,YAAU;YAC3DX,iBAAiB;YACjB;QACF,KAAK;QACL,KAAK;YACHD,OAAO,AAAC,KAAEc,eAAa;YACvBZ,QAAQ,AAAC,+BAA4BW,WAAS;YAC9CZ,iBAAiB;YACjB;QACF,KAAK;YAAe;gBAClBD,OAAO,AAAC,KAAEc,eAAa;gBACvBZ,QAAQ,AAAC,6CAA0CW,WAAS;gBAC5DZ,iBAAiB;gBACjB;YACF;QACA,KAAK;YAAoB;gBACvBD,OAAO,AAAC,KAAEc,eAAa;gBACvBZ,QAAQ,AAAC,sCAAmCW,WAAS;gBACrDZ,iBAAiB;gBACjB;YACF;QACA,KAAK;YACH;QACF;YACE;IACJ;IACA,OAAO;QAAED;QAAMC;QAAgBC;IAAM;AACvC;AAEA,OAAO,MAAMa,SAASpB,uBA2DrB;AAED,SAASW,QAAQ,KAAoC;IAApC,IAAA,EAAED,SAAS,EAAyB,GAApC;IACf,qBACE,KAACW;QACCC,OAAM;QACNC,QAAO;QACPC,SAAQ;QACRC,MAAK;QACLC,OAAM;kBAEN,cAAA,KAACC;YAAOjB,WAAWA;YAAWZ,IAAG;YAAI8B,IAAG;YAAIC,GAAE;YAAMC,aAAY;;;AAGtE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge multiple args to a single string with spaces. Useful for merging class names.
|
|
3
|
+
* @example
|
|
4
|
+
* cx('foo', 'bar') // 'foo bar'
|
|
5
|
+
* cx('foo', null, 'bar', undefined, 'baz', false) // 'foo bar baz'
|
|
6
|
+
*/ export function cx() {
|
|
7
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
8
|
+
args[_key] = arguments[_key];
|
|
9
|
+
}
|
|
10
|
+
return args.filter(Boolean).join(' ');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=cx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/helpers/cx.ts"],"sourcesContent":["/**\n * Merge multiple args to a single string with spaces. Useful for merging class names.\n * @example\n * cx('foo', 'bar') // 'foo bar'\n * cx('foo', null, 'bar', undefined, 'baz', false) // 'foo bar baz'\n */\nexport function cx(...args: (string | undefined | null | false)[]): string {\n return args.filter(Boolean).join(' ')\n}\n"],"names":["cx","args","filter","Boolean","join"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA;IAAG,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGC,OAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA;QAAGA,KAAH,QAAA,SAAA,CAAA,KAA8C;;IAC/D,OAAOA,KAAKC,MAAM,CAACC,SAASC,IAAI,CAAC;AACnC"}
|
|
@@ -59,6 +59,16 @@ export async function getOriginalStackFrames(frames, type, isAppDir) {
|
|
|
59
59
|
method: 'POST',
|
|
60
60
|
body: JSON.stringify(req)
|
|
61
61
|
});
|
|
62
|
+
// When fails to fetch the original stack frames, we reject here to be
|
|
63
|
+
// caught at `_getOriginalStackFrame()` and return the stack frames so
|
|
64
|
+
// that the error overlay can render.
|
|
65
|
+
if (!res.ok || res.status === 204) {
|
|
66
|
+
const reason = await res.text();
|
|
67
|
+
return Promise.all(frames.map((frame)=>getOriginalStackFrame(frame, {
|
|
68
|
+
status: 'rejected',
|
|
69
|
+
reason: "Failed to fetch the original stack frames: " + reason
|
|
70
|
+
})));
|
|
71
|
+
}
|
|
62
72
|
const data = await res.json();
|
|
63
73
|
return Promise.all(frames.map((frame, index)=>getOriginalStackFrame(frame, data[index])));
|
|
64
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/stack-frame.ts"],"sourcesContent":["import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\nimport type {\n OriginalStackFrameResponse,\n OriginalStackFrameResponseResult,\n OriginalStackFramesRequest,\n} from '../../server/shared'\nimport {\n isWebpackInternalResource,\n formatFrameSourceFile,\n} from './webpack-module-path'\nexport interface OriginalStackFrame extends OriginalStackFrameResponse {\n error: boolean\n reason: string | null\n external: boolean\n ignored: boolean\n sourceStackFrame: StackFrame\n}\n\nfunction getOriginalStackFrame(\n source: StackFrame,\n response: OriginalStackFrameResponseResult\n): Promise<OriginalStackFrame> {\n async function _getOriginalStackFrame(): Promise<OriginalStackFrame> {\n if (response.status === 'rejected') {\n return Promise.reject(new Error(response.reason))\n }\n\n const body: OriginalStackFrameResponse = response.value\n\n return {\n error: false,\n reason: null,\n external: false,\n sourceStackFrame: source,\n originalStackFrame: body.originalStackFrame,\n originalCodeFrame: body.originalCodeFrame || null,\n sourcePackage: body.sourcePackage,\n ignored: body.originalStackFrame?.ignored || false,\n }\n }\n\n // TODO: merge this section into ignoredList handling\n if (source.file === 'file://' || source.file?.match(/https?:\\/\\//)) {\n return Promise.resolve({\n error: false,\n reason: null,\n external: true,\n sourceStackFrame: source,\n originalStackFrame: null,\n originalCodeFrame: null,\n sourcePackage: null,\n ignored: true,\n })\n }\n\n return _getOriginalStackFrame().catch((err: Error) => ({\n error: true,\n reason: err?.message ?? err?.toString() ?? 'Unknown Error',\n external: false,\n sourceStackFrame: source,\n originalStackFrame: null,\n originalCodeFrame: null,\n sourcePackage: null,\n ignored: false,\n }))\n}\n\nexport async function getOriginalStackFrames(\n frames: StackFrame[],\n type: 'server' | 'edge-server' | null,\n isAppDir: boolean\n): Promise<OriginalStackFrame[]> {\n const req: OriginalStackFramesRequest = {\n frames,\n isServer: type === 'server',\n isEdgeServer: type === 'edge-server',\n isAppDirectory: isAppDir,\n }\n const res = await fetch('/__nextjs_original-stack-frames', {\n method: 'POST',\n body: JSON.stringify(req),\n })\n const data = await res.json()\n return Promise.all(\n frames.map((frame, index) => getOriginalStackFrame(frame, data[index]))\n )\n}\n\nexport function getFrameSource(frame: StackFrame): string {\n if (!frame.file) return ''\n\n const isWebpackFrame = isWebpackInternalResource(frame.file)\n\n let str = ''\n // Skip URL parsing for webpack internal file paths.\n if (isWebpackFrame) {\n str = formatFrameSourceFile(frame.file)\n } else {\n try {\n const u = new URL(frame.file)\n\n let parsedPath = ''\n // Strip the origin for same-origin scripts.\n if (globalThis.location?.origin !== u.origin) {\n // URLs can be valid without an `origin`, so long as they have a\n // `protocol`. However, `origin` is preferred.\n if (u.origin === 'null') {\n parsedPath += u.protocol\n } else {\n parsedPath += u.origin\n }\n }\n\n // Strip query string information as it's typically too verbose to be\n // meaningful.\n parsedPath += u.pathname\n str = formatFrameSourceFile(parsedPath)\n } catch {\n str = formatFrameSourceFile(frame.file)\n }\n }\n\n if (!isWebpackInternalResource(frame.file) && frame.lineNumber != null) {\n if (str) {\n if (frame.column != null) {\n str += ` (${frame.lineNumber}:${frame.column})`\n } else {\n str += ` (${frame.lineNumber})`\n }\n }\n }\n return str\n}\n"],"names":["isWebpackInternalResource","formatFrameSourceFile","getOriginalStackFrame","source","response","_getOriginalStackFrame","body","status","Promise","reject","Error","reason","value","error","external","sourceStackFrame","originalStackFrame","originalCodeFrame","sourcePackage","ignored","file","match","resolve","catch","err","message","toString","getOriginalStackFrames","frames","type","isAppDir","req","isServer","isEdgeServer","isAppDirectory","res","fetch","method","JSON","stringify","
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/stack-frame.ts"],"sourcesContent":["import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\nimport type {\n OriginalStackFrameResponse,\n OriginalStackFrameResponseResult,\n OriginalStackFramesRequest,\n} from '../../server/shared'\nimport {\n isWebpackInternalResource,\n formatFrameSourceFile,\n} from './webpack-module-path'\nexport interface OriginalStackFrame extends OriginalStackFrameResponse {\n error: boolean\n reason: string | null\n external: boolean\n ignored: boolean\n sourceStackFrame: StackFrame\n}\n\nfunction getOriginalStackFrame(\n source: StackFrame,\n response: OriginalStackFrameResponseResult\n): Promise<OriginalStackFrame> {\n async function _getOriginalStackFrame(): Promise<OriginalStackFrame> {\n if (response.status === 'rejected') {\n return Promise.reject(new Error(response.reason))\n }\n\n const body: OriginalStackFrameResponse = response.value\n\n return {\n error: false,\n reason: null,\n external: false,\n sourceStackFrame: source,\n originalStackFrame: body.originalStackFrame,\n originalCodeFrame: body.originalCodeFrame || null,\n sourcePackage: body.sourcePackage,\n ignored: body.originalStackFrame?.ignored || false,\n }\n }\n\n // TODO: merge this section into ignoredList handling\n if (source.file === 'file://' || source.file?.match(/https?:\\/\\//)) {\n return Promise.resolve({\n error: false,\n reason: null,\n external: true,\n sourceStackFrame: source,\n originalStackFrame: null,\n originalCodeFrame: null,\n sourcePackage: null,\n ignored: true,\n })\n }\n\n return _getOriginalStackFrame().catch((err: Error) => ({\n error: true,\n reason: err?.message ?? err?.toString() ?? 'Unknown Error',\n external: false,\n sourceStackFrame: source,\n originalStackFrame: null,\n originalCodeFrame: null,\n sourcePackage: null,\n ignored: false,\n }))\n}\n\nexport async function getOriginalStackFrames(\n frames: StackFrame[],\n type: 'server' | 'edge-server' | null,\n isAppDir: boolean\n): Promise<OriginalStackFrame[]> {\n const req: OriginalStackFramesRequest = {\n frames,\n isServer: type === 'server',\n isEdgeServer: type === 'edge-server',\n isAppDirectory: isAppDir,\n }\n\n const res = await fetch('/__nextjs_original-stack-frames', {\n method: 'POST',\n body: JSON.stringify(req),\n })\n\n // When fails to fetch the original stack frames, we reject here to be\n // caught at `_getOriginalStackFrame()` and return the stack frames so\n // that the error overlay can render.\n if (!res.ok || res.status === 204) {\n const reason = await res.text()\n return Promise.all(\n frames.map((frame) =>\n getOriginalStackFrame(frame, {\n status: 'rejected',\n reason: `Failed to fetch the original stack frames: ${reason}`,\n })\n )\n )\n }\n\n const data = await res.json()\n return Promise.all(\n frames.map((frame, index) => getOriginalStackFrame(frame, data[index]))\n )\n}\n\nexport function getFrameSource(frame: StackFrame): string {\n if (!frame.file) return ''\n\n const isWebpackFrame = isWebpackInternalResource(frame.file)\n\n let str = ''\n // Skip URL parsing for webpack internal file paths.\n if (isWebpackFrame) {\n str = formatFrameSourceFile(frame.file)\n } else {\n try {\n const u = new URL(frame.file)\n\n let parsedPath = ''\n // Strip the origin for same-origin scripts.\n if (globalThis.location?.origin !== u.origin) {\n // URLs can be valid without an `origin`, so long as they have a\n // `protocol`. However, `origin` is preferred.\n if (u.origin === 'null') {\n parsedPath += u.protocol\n } else {\n parsedPath += u.origin\n }\n }\n\n // Strip query string information as it's typically too verbose to be\n // meaningful.\n parsedPath += u.pathname\n str = formatFrameSourceFile(parsedPath)\n } catch {\n str = formatFrameSourceFile(frame.file)\n }\n }\n\n if (!isWebpackInternalResource(frame.file) && frame.lineNumber != null) {\n if (str) {\n if (frame.column != null) {\n str += ` (${frame.lineNumber}:${frame.column})`\n } else {\n str += ` (${frame.lineNumber})`\n }\n }\n }\n return str\n}\n"],"names":["isWebpackInternalResource","formatFrameSourceFile","getOriginalStackFrame","source","response","_getOriginalStackFrame","body","status","Promise","reject","Error","reason","value","error","external","sourceStackFrame","originalStackFrame","originalCodeFrame","sourcePackage","ignored","file","match","resolve","catch","err","message","toString","getOriginalStackFrames","frames","type","isAppDir","req","isServer","isEdgeServer","isAppDirectory","res","fetch","method","JSON","stringify","ok","text","all","map","frame","data","json","index","getFrameSource","isWebpackFrame","str","globalThis","u","URL","parsedPath","location","origin","protocol","pathname","lineNumber","column"],"mappings":"AAMA,SACEA,yBAAyB,EACzBC,qBAAqB,QAChB,wBAAuB;AAS9B,SAASC,sBACPC,MAAkB,EAClBC,QAA0C;QAsBTD;IApBjC,eAAeE;YAeFC;QAdX,IAAIF,SAASG,MAAM,KAAK,YAAY;YAClC,OAAOC,QAAQC,MAAM,CAAC,qBAA0B,CAA1B,IAAIC,MAAMN,SAASO,MAAM,GAAzB,qBAAA;uBAAA;4BAAA;YAAyB;QACjD;QAEA,MAAML,OAAmCF,SAASQ,KAAK;QAEvD,OAAO;YACLC,OAAO;YACPF,QAAQ;YACRG,UAAU;YACVC,kBAAkBZ;YAClBa,oBAAoBV,KAAKU,kBAAkB;YAC3CC,mBAAmBX,KAAKW,iBAAiB,IAAI;YAC7CC,eAAeZ,KAAKY,aAAa;YACjCC,SAASb,EAAAA,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} from './react-client-callbacks/on-recoverable-erro
|
|
|
27
27
|
import tracer from './tracing/tracer';
|
|
28
28
|
import reportToSocket from './tracing/report-to-socket';
|
|
29
29
|
import { isNextRouterError } from './components/is-next-router-error';
|
|
30
|
-
export const version = "15.2.0-canary.
|
|
30
|
+
export const version = "15.2.0-canary.45";
|
|
31
31
|
export let router;
|
|
32
32
|
export const emitter = mitt();
|
|
33
33
|
const looseToArray = (input)=>[].slice.call(input);
|
|
@@ -93,7 +93,7 @@ export async function verifyTypeScriptSetup({ dir, distDir, cacheDir, intentDirs
|
|
|
93
93
|
* or run in a worker (during next build). In the latter case, we need to print the error message, as the
|
|
94
94
|
* parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.
|
|
95
95
|
*/ // we are in a worker, print the error message and exit the process
|
|
96
|
-
if (process.env.
|
|
96
|
+
if (process.env.IS_NEXT_WORKER) {
|
|
97
97
|
if (err instanceof Error) {
|
|
98
98
|
console.error(err.message);
|
|
99
99
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport semver from 'next/dist/compiled/semver'\nimport { CompileError } from './compile-error'\nimport * as log from '../build/output/log'\n\nimport { getTypeScriptIntent } from './typescript/getTypeScriptIntent'\nimport type { TypeCheckResult } from './typescript/runTypeCheck'\nimport { writeAppTypeDeclarations } from './typescript/writeAppTypeDeclarations'\nimport { writeConfigurationDefaults } from './typescript/writeConfigurationDefaults'\nimport { installDependencies } from './install-dependencies'\nimport { isCI } from '../server/ci-info'\nimport { missingDepsError } from './typescript/missingDependencyError'\n\nconst requiredPackages = [\n {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n },\n {\n file: '@types/react/index.d.ts',\n pkg: '@types/react',\n exportsRestrict: true,\n },\n {\n file: '@types/node/index.d.ts',\n pkg: '@types/node',\n exportsRestrict: true,\n },\n]\n\nexport async function verifyTypeScriptSetup({\n dir,\n distDir,\n cacheDir,\n intentDirs,\n tsconfigPath,\n typeCheckPreflight,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n tsconfigPath: string\n intentDirs: string[]\n typeCheckPreflight: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n}): Promise<{ result?: TypeCheckResult; version: string | null }> {\n const resolvedTsConfigPath = path.join(dir, tsconfigPath)\n\n try {\n // Check if the project uses TypeScript:\n const intent = await getTypeScriptIntent(dir, intentDirs, tsconfigPath)\n if (!intent) {\n return { version: null }\n }\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = await hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n if (deps.missing?.length > 0) {\n if (isCI) {\n // we don't attempt auto install in CI to avoid side-effects\n // and instead log the error for installing needed packages\n missingDepsError(dir, deps.missing)\n }\n console.log(\n bold(\n yellow(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n' +\n 'Installing dependencies' +\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n ) +\n '\\n'\n )\n await installDependencies(dir, deps.missing, true).catch((err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install required TypeScript dependencies, please install them manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n })\n deps = await hasNecessaryDependencies(dir, requiredPackages)\n }\n\n // Load TypeScript after we're sure it exists:\n const tsPath = deps.resolved.get('typescript')!\n const ts = (await Promise.resolve(\n require(tsPath)\n )) as typeof import('typescript')\n\n if (semver.lt(ts.version, '4.5.2')) {\n log.warn(\n `Minimum recommended TypeScript version is v4.5.2, older versions can potentially be incompatible with Next.js. Detected: ${ts.version}`\n )\n }\n\n // Reconfigure (or create) the user's `tsconfig.json` for them:\n await writeConfigurationDefaults(\n ts,\n resolvedTsConfigPath,\n intent.firstTimeSetup,\n hasAppDir,\n distDir,\n hasPagesDir\n )\n // Write out the necessary `next-env.d.ts` file to correctly register\n // Next.js' types:\n await writeAppTypeDeclarations({\n baseDir: dir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n })\n\n let result\n if (typeCheckPreflight) {\n const { runTypeCheck } = require('./typescript/runTypeCheck')\n\n // Verify the project passes type-checking before we go to webpack phase:\n result = await runTypeCheck(\n ts,\n dir,\n distDir,\n resolvedTsConfigPath,\n cacheDir,\n hasAppDir\n )\n }\n return { result, version: ts.version }\n } catch (err) {\n // These are special errors that should not show a stack trace:\n if (err instanceof CompileError) {\n console.error(red('Failed to compile.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyTypeScriptSetup can be either invoked directly in the main thread (during next dev / next lint)\n * or run in a worker (during next build). In the latter case, we need to print the error message, as the\n * parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\n\n // we are in a worker, print the error message and exit the process\n if (process.env.
|
|
1
|
+
{"version":3,"sources":["../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport semver from 'next/dist/compiled/semver'\nimport { CompileError } from './compile-error'\nimport * as log from '../build/output/log'\n\nimport { getTypeScriptIntent } from './typescript/getTypeScriptIntent'\nimport type { TypeCheckResult } from './typescript/runTypeCheck'\nimport { writeAppTypeDeclarations } from './typescript/writeAppTypeDeclarations'\nimport { writeConfigurationDefaults } from './typescript/writeConfigurationDefaults'\nimport { installDependencies } from './install-dependencies'\nimport { isCI } from '../server/ci-info'\nimport { missingDepsError } from './typescript/missingDependencyError'\n\nconst requiredPackages = [\n {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n },\n {\n file: '@types/react/index.d.ts',\n pkg: '@types/react',\n exportsRestrict: true,\n },\n {\n file: '@types/node/index.d.ts',\n pkg: '@types/node',\n exportsRestrict: true,\n },\n]\n\nexport async function verifyTypeScriptSetup({\n dir,\n distDir,\n cacheDir,\n intentDirs,\n tsconfigPath,\n typeCheckPreflight,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n tsconfigPath: string\n intentDirs: string[]\n typeCheckPreflight: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n}): Promise<{ result?: TypeCheckResult; version: string | null }> {\n const resolvedTsConfigPath = path.join(dir, tsconfigPath)\n\n try {\n // Check if the project uses TypeScript:\n const intent = await getTypeScriptIntent(dir, intentDirs, tsconfigPath)\n if (!intent) {\n return { version: null }\n }\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = await hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n if (deps.missing?.length > 0) {\n if (isCI) {\n // we don't attempt auto install in CI to avoid side-effects\n // and instead log the error for installing needed packages\n missingDepsError(dir, deps.missing)\n }\n console.log(\n bold(\n yellow(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n' +\n 'Installing dependencies' +\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n ) +\n '\\n'\n )\n await installDependencies(dir, deps.missing, true).catch((err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install required TypeScript dependencies, please install them manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n })\n deps = await hasNecessaryDependencies(dir, requiredPackages)\n }\n\n // Load TypeScript after we're sure it exists:\n const tsPath = deps.resolved.get('typescript')!\n const ts = (await Promise.resolve(\n require(tsPath)\n )) as typeof import('typescript')\n\n if (semver.lt(ts.version, '4.5.2')) {\n log.warn(\n `Minimum recommended TypeScript version is v4.5.2, older versions can potentially be incompatible with Next.js. Detected: ${ts.version}`\n )\n }\n\n // Reconfigure (or create) the user's `tsconfig.json` for them:\n await writeConfigurationDefaults(\n ts,\n resolvedTsConfigPath,\n intent.firstTimeSetup,\n hasAppDir,\n distDir,\n hasPagesDir\n )\n // Write out the necessary `next-env.d.ts` file to correctly register\n // Next.js' types:\n await writeAppTypeDeclarations({\n baseDir: dir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n })\n\n let result\n if (typeCheckPreflight) {\n const { runTypeCheck } = require('./typescript/runTypeCheck')\n\n // Verify the project passes type-checking before we go to webpack phase:\n result = await runTypeCheck(\n ts,\n dir,\n distDir,\n resolvedTsConfigPath,\n cacheDir,\n hasAppDir\n )\n }\n return { result, version: ts.version }\n } catch (err) {\n // These are special errors that should not show a stack trace:\n if (err instanceof CompileError) {\n console.error(red('Failed to compile.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyTypeScriptSetup can be either invoked directly in the main thread (during next dev / next lint)\n * or run in a worker (during next build). In the latter case, we need to print the error message, as the\n * parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\n\n // we are in a worker, print the error message and exit the process\n if (process.env.IS_NEXT_WORKER) {\n if (err instanceof Error) {\n console.error(err.message)\n } else {\n console.error(err)\n }\n process.exit(1)\n }\n // we are in the main thread, throw the error and it will be handled by the caller\n throw err\n }\n}\n"],"names":["bold","cyan","red","yellow","path","hasNecessaryDependencies","semver","CompileError","log","getTypeScriptIntent","writeAppTypeDeclarations","writeConfigurationDefaults","installDependencies","isCI","missingDepsError","requiredPackages","file","pkg","exportsRestrict","verifyTypeScriptSetup","dir","distDir","cacheDir","intentDirs","tsconfigPath","typeCheckPreflight","disableStaticImages","hasAppDir","hasPagesDir","resolvedTsConfigPath","join","deps","intent","version","missing","length","console","catch","err","error","command","tsPath","resolved","get","ts","Promise","resolve","require","lt","warn","firstTimeSetup","baseDir","imageImportsEnabled","result","runTypeCheck","message","process","exit","env","IS_NEXT_WORKER","Error"],"mappings":"AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM,QAAQ,eAAc;AACtD,OAAOC,UAAU,OAAM;AAEvB,SAASC,wBAAwB,QAAQ,+BAA8B;AAEvE,OAAOC,YAAY,4BAA2B;AAC9C,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,YAAYC,SAAS,sBAAqB;AAE1C,SAASC,mBAAmB,QAAQ,mCAAkC;AAEtE,SAASC,wBAAwB,QAAQ,wCAAuC;AAChF,SAASC,0BAA0B,QAAQ,0CAAyC;AACpF,SAASC,mBAAmB,QAAQ,yBAAwB;AAC5D,SAASC,IAAI,QAAQ,oBAAmB;AACxC,SAASC,gBAAgB,QAAQ,sCAAqC;AAEtE,MAAMC,mBAAmB;IACvB;QACEC,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;CACD;AAED,OAAO,eAAeC,sBAAsB,EAC1CC,GAAG,EACHC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,YAAY,EACZC,kBAAkB,EAClBC,mBAAmB,EACnBC,SAAS,EACTC,WAAW,EAWZ;IACC,MAAMC,uBAAuBzB,KAAK0B,IAAI,CAACV,KAAKI;IAE5C,IAAI;YAaEO;QAZJ,wCAAwC;QACxC,MAAMC,SAAS,MAAMvB,oBAAoBW,KAAKG,YAAYC;QAC1D,IAAI,CAACQ,QAAQ;YACX,OAAO;gBAAEC,SAAS;YAAK;QACzB;QAEA,4DAA4D;QAC5D,IAAIF,OAA8B,MAAM1B,yBACtCe,KACAL;QAGF,IAAIgB,EA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IACvC,EAAE,OAAOK,KAAK;QACZ,+DAA+D;QAC/D,IAAIA,eAAe/B,cAAc;YAC/B6B,QAAQG,KAAK,CAACrC,IAAI;YAClBkC,QAAQG,KAAK,CAACD,IAAIiB,OAAO;YACzBC,QAAQC,IAAI,CAAC;QACf;QAEA;;;;KAIC,GAED,mEAAmE;QACnE,IAAID,QAAQE,GAAG,CAACC,cAAc,EAAE;YAC9B,IAAIrB,eAAesB,OAAO;gBACxBxB,QAAQG,KAAK,CAACD,IAAIiB,OAAO;YAC3B,OAAO;gBACLnB,QAAQG,KAAK,CAACD;YAChB;YACAkB,QAAQC,IAAI,CAAC;QACf;QACA,kFAAkF;QAClF,MAAMnB;IACR;AACF"}
|
package/dist/esm/lib/worker.js
CHANGED
|
@@ -27,7 +27,8 @@ export class Worker {
|
|
|
27
27
|
...farmOptions.forkOptions,
|
|
28
28
|
env: {
|
|
29
29
|
...((_farmOptions_forkOptions = farmOptions.forkOptions) == null ? void 0 : _farmOptions_forkOptions.env) || {},
|
|
30
|
-
...process.env
|
|
30
|
+
...process.env,
|
|
31
|
+
IS_NEXT_WORKER: 'true'
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
maxRetries: 0
|
|
@@ -49,7 +50,7 @@ export class Worker {
|
|
|
49
50
|
_worker__child1;
|
|
50
51
|
(_worker__child = worker._child) == null ? void 0 : _worker__child.on('exit', (code, signal)=>{
|
|
51
52
|
if ((code || signal && signal !== 'SIGINT') && this._worker) {
|
|
52
|
-
logger.error(`
|
|
53
|
+
logger.error(`Next.js build worker exited with code: ${code} and signal: ${signal}`);
|
|
53
54
|
// if a child process doesn't exit gracefully, we want to bubble up the exit code to the parent process
|
|
54
55
|
process.exit(code ?? 1);
|
|
55
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/worker.ts"],"sourcesContent":["import type { ChildProcess } from 'child_process'\nimport { Worker as JestWorker } from 'next/dist/compiled/jest-worker'\nimport { Transform } from 'stream'\n\ntype FarmOptions = ConstructorParameters<typeof JestWorker>[1]\n\nconst RESTARTED = Symbol('restarted')\n\nconst cleanupWorkers = (worker: JestWorker) => {\n for (const curWorker of ((worker as any)._workerPool?._workers || []) as {\n _child?: ChildProcess\n }[]) {\n curWorker._child?.kill('SIGINT')\n }\n}\n\nexport class Worker {\n private _worker: JestWorker | undefined\n\n constructor(\n workerPath: string,\n options: FarmOptions & {\n timeout?: number\n onActivity?: () => void\n onActivityAbort?: () => void\n onRestart?: (method: string, args: any[], attempts: number) => void\n logger?: Pick<typeof console, 'error' | 'info' | 'warn'>\n exposedMethods: ReadonlyArray<string>\n enableWorkerThreads?: boolean\n }\n ) {\n let { timeout, onRestart, logger = console, ...farmOptions } = options\n\n let restartPromise: Promise<typeof RESTARTED>\n let resolveRestartPromise: (arg: typeof RESTARTED) => void\n let activeTasks = 0\n\n this._worker = undefined\n\n // ensure we end workers if they weren't before exit\n process.on('exit', () => {\n this.close()\n })\n\n const createWorker = () => {\n this._worker = new JestWorker(workerPath, {\n ...farmOptions,\n forkOptions: {\n ...farmOptions.forkOptions,\n env: {\n ...((farmOptions.forkOptions?.env || {}) as any),\n ...process.env,\n } as any,\n },\n maxRetries: 0,\n }) as JestWorker\n restartPromise = new Promise(\n (resolve) => (resolveRestartPromise = resolve)\n )\n\n /**\n * Jest Worker has two worker types, ChildProcessWorker (uses child_process) and NodeThreadWorker (uses worker_threads)\n * Next.js uses ChildProcessWorker by default, but it can be switched to NodeThreadWorker with an experimental flag\n *\n * We only want to handle ChildProcessWorker's orphan process issue, so we access the private property \"_child\":\n * https://github.com/facebook/jest/blob/b38d7d345a81d97d1dc3b68b8458b1837fbf19be/packages/jest-worker/src/workers/ChildProcessWorker.ts\n *\n * But this property is not available in NodeThreadWorker, so we need to check if we are using ChildProcessWorker\n */\n if (!farmOptions.enableWorkerThreads) {\n for (const worker of ((this._worker as any)._workerPool?._workers ||\n []) as {\n _child?: ChildProcess\n }[]) {\n worker._child?.on('exit', (code, signal) => {\n if ((code || (signal && signal !== 'SIGINT')) && this._worker) {\n logger.error(\n `Static worker exited with code: ${code} and signal: ${signal}`\n )\n\n // if a child process doesn't exit gracefully, we want to bubble up the exit code to the parent process\n process.exit(code ?? 1)\n }\n })\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n worker._child?.on('message', ([, data]: [number, unknown]) => {\n if (\n data &&\n typeof data === 'object' &&\n 'type' in data &&\n data.type === 'activity'\n ) {\n onActivity()\n }\n })\n }\n }\n\n let aborted = false\n const onActivityAbort = () => {\n if (!aborted) {\n options.onActivityAbort?.()\n aborted = true\n }\n }\n\n // Listen to the worker's stdout and stderr, if there's any thing logged, abort the activity first\n const abortActivityStreamOnLog = new Transform({\n transform(_chunk, _encoding, callback) {\n onActivityAbort()\n callback()\n },\n })\n // Stop the activity if there's any output from the worker\n this._worker.getStdout().pipe(abortActivityStreamOnLog)\n this._worker.getStderr().pipe(abortActivityStreamOnLog)\n\n // Pipe the worker's stdout and stderr to the parent process\n this._worker.getStdout().pipe(process.stdout)\n this._worker.getStderr().pipe(process.stderr)\n }\n createWorker()\n\n const onHanging = () => {\n const worker = this._worker\n if (!worker) return\n const resolve = resolveRestartPromise\n createWorker()\n logger.warn(\n `Sending SIGTERM signal to static worker due to timeout${\n timeout ? ` of ${timeout / 1000} seconds` : ''\n }. Subsequent errors may be a result of the worker exiting.`\n )\n worker.end().then(() => {\n resolve(RESTARTED)\n })\n }\n\n let hangingTimer: NodeJS.Timeout | false = false\n\n const onActivity = () => {\n if (hangingTimer) clearTimeout(hangingTimer)\n if (options.onActivity) options.onActivity()\n\n hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout)\n }\n\n for (const method of farmOptions.exposedMethods) {\n if (method.startsWith('_')) continue\n ;(this as any)[method] = timeout\n ? // eslint-disable-next-line no-loop-func\n async (...args: any[]) => {\n activeTasks++\n try {\n let attempts = 0\n for (;;) {\n onActivity()\n const result = await Promise.race([\n (this._worker as any)[method](...args),\n restartPromise,\n ])\n if (result !== RESTARTED) return result\n if (onRestart) onRestart(method, args, ++attempts)\n }\n } finally {\n activeTasks--\n onActivity()\n }\n }\n : (this._worker as any)[method].bind(this._worker)\n }\n }\n\n end(): ReturnType<JestWorker['end']> {\n const worker = this._worker\n if (!worker) {\n throw new Error('Farm is ended, no more calls can be done to it')\n }\n cleanupWorkers(worker)\n this._worker = undefined\n return worker.end()\n }\n\n /**\n * Quietly end the worker if it exists\n */\n close(): void {\n if (this._worker) {\n cleanupWorkers(this._worker)\n this._worker.end()\n }\n }\n}\n"],"names":["Worker","JestWorker","Transform","RESTARTED","Symbol","cleanupWorkers","worker","curWorker","_workerPool","_workers","_child","kill","constructor","workerPath","options","timeout","onRestart","logger","console","farmOptions","restartPromise","resolveRestartPromise","activeTasks","_worker","undefined","process","on","close","createWorker","forkOptions","env","maxRetries","Promise","resolve","enableWorkerThreads","code","signal","error","exit","data","type","onActivity","aborted","onActivityAbort","abortActivityStreamOnLog","transform","_chunk","_encoding","callback","getStdout","pipe","getStderr","stdout","stderr","onHanging","warn","end","then","hangingTimer","clearTimeout","setTimeout","method","exposedMethods","startsWith","args","attempts","result","race","bind","Error"],"mappings":"AACA,SAASA,UAAUC,UAAU,QAAQ,iCAAgC;AACrE,SAASC,SAAS,QAAQ,SAAQ;AAIlC,MAAMC,YAAYC,OAAO;AAEzB,MAAMC,iBAAiB,CAACC;QACG;IAAzB,KAAK,MAAMC,aAAc,EAAA,sBAAA,AAACD,OAAeE,WAAW,qBAA3B,oBAA6BC,QAAQ,KAAI,EAAE,CAE/D;YACHF;SAAAA,oBAAAA,UAAUG,MAAM,qBAAhBH,kBAAkBI,IAAI,CAAC;IACzB;AACF;AAEA,OAAO,MAAMX;IAGXY,YACEC,UAAkB,EAClBC,OAQC,CACD;QACA,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,SAASC,OAAO,EAAE,GAAGC,aAAa,GAAGL;QAE/D,IAAIM;QACJ,IAAIC;QACJ,IAAIC,cAAc;QAEl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oBACF,IAAI2C,WAAW;oBACf,OAAS;wBACPxB;wBACA,MAAMyB,SAAS,MAAMlC,QAAQmC,IAAI,CAAC;4BAC/B,IAAI,CAAC5C,OAAO,AAAQ,CAACsC,OAAO,IAAIG;4BACjC5C;yBACD;wBACD,IAAI8C,WAAW/D,WAAW,OAAO+D;wBACjC,IAAIlD,WAAWA,UAAU6C,QAAQG,MAAM,EAAEC;oBAC3C;gBACF,SAAU;oBACR3C;oBACAmB;gBACF;YACF,IACA,AAAC,IAAI,CAAClB,OAAO,AAAQ,CAACsC,OAAO,CAACO,IAAI,CAAC,IAAI,CAAC7C,OAAO;QACrD;IACF;IAEAiC,MAAqC;QACnC,MAAMlD,SAAS,IAAI,CAACiB,OAAO;QAC3B,IAAI,CAACjB,QAAQ;YACX,MAAM,qBAA2D,CAA3D,IAAI+D,MAAM,mDAAV,qBAAA;uBAAA;4BAAA;YAA0D;QAClE;QACAhE,eAAeC;QACf,IAAI,CAACiB,OAAO,GAAGC;QACf,OAAOlB,OAAOkD,GAAG;IACnB;IAEA;;GAEC,GACD7B,QAAc;QACZ,IAAI,IAAI,CAACJ,OAAO,EAAE;YAChBlB,eAAe,IAAI,CAACkB,OAAO;YAC3B,IAAI,CAACA,OAAO,CAACiC,GAAG;QAClB;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/worker.ts"],"sourcesContent":["import type { ChildProcess } from 'child_process'\nimport { Worker as JestWorker } from 'next/dist/compiled/jest-worker'\nimport { Transform } from 'stream'\n\ntype FarmOptions = ConstructorParameters<typeof JestWorker>[1]\n\nconst RESTARTED = Symbol('restarted')\n\nconst cleanupWorkers = (worker: JestWorker) => {\n for (const curWorker of ((worker as any)._workerPool?._workers || []) as {\n _child?: ChildProcess\n }[]) {\n curWorker._child?.kill('SIGINT')\n }\n}\n\nexport class Worker {\n private _worker: JestWorker | undefined\n\n constructor(\n workerPath: string,\n options: FarmOptions & {\n timeout?: number\n onActivity?: () => void\n onActivityAbort?: () => void\n onRestart?: (method: string, args: any[], attempts: number) => void\n logger?: Pick<typeof console, 'error' | 'info' | 'warn'>\n exposedMethods: ReadonlyArray<string>\n enableWorkerThreads?: boolean\n }\n ) {\n let { timeout, onRestart, logger = console, ...farmOptions } = options\n\n let restartPromise: Promise<typeof RESTARTED>\n let resolveRestartPromise: (arg: typeof RESTARTED) => void\n let activeTasks = 0\n\n this._worker = undefined\n\n // ensure we end workers if they weren't before exit\n process.on('exit', () => {\n this.close()\n })\n\n const createWorker = () => {\n this._worker = new JestWorker(workerPath, {\n ...farmOptions,\n forkOptions: {\n ...farmOptions.forkOptions,\n env: {\n ...((farmOptions.forkOptions?.env || {}) as any),\n ...process.env,\n IS_NEXT_WORKER: 'true',\n } as any,\n },\n maxRetries: 0,\n }) as JestWorker\n restartPromise = new Promise(\n (resolve) => (resolveRestartPromise = resolve)\n )\n\n /**\n * Jest Worker has two worker types, ChildProcessWorker (uses child_process) and NodeThreadWorker (uses worker_threads)\n * Next.js uses ChildProcessWorker by default, but it can be switched to NodeThreadWorker with an experimental flag\n *\n * We only want to handle ChildProcessWorker's orphan process issue, so we access the private property \"_child\":\n * https://github.com/facebook/jest/blob/b38d7d345a81d97d1dc3b68b8458b1837fbf19be/packages/jest-worker/src/workers/ChildProcessWorker.ts\n *\n * But this property is not available in NodeThreadWorker, so we need to check if we are using ChildProcessWorker\n */\n if (!farmOptions.enableWorkerThreads) {\n for (const worker of ((this._worker as any)._workerPool?._workers ||\n []) as {\n _child?: ChildProcess\n }[]) {\n worker._child?.on('exit', (code, signal) => {\n if ((code || (signal && signal !== 'SIGINT')) && this._worker) {\n logger.error(\n `Next.js build worker exited with code: ${code} and signal: ${signal}`\n )\n\n // if a child process doesn't exit gracefully, we want to bubble up the exit code to the parent process\n process.exit(code ?? 1)\n }\n })\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n worker._child?.on('message', ([, data]: [number, unknown]) => {\n if (\n data &&\n typeof data === 'object' &&\n 'type' in data &&\n data.type === 'activity'\n ) {\n onActivity()\n }\n })\n }\n }\n\n let aborted = false\n const onActivityAbort = () => {\n if (!aborted) {\n options.onActivityAbort?.()\n aborted = true\n }\n }\n\n // Listen to the worker's stdout and stderr, if there's any thing logged, abort the activity first\n const abortActivityStreamOnLog = new Transform({\n transform(_chunk, _encoding, callback) {\n onActivityAbort()\n callback()\n },\n })\n // Stop the activity if there's any output from the worker\n this._worker.getStdout().pipe(abortActivityStreamOnLog)\n this._worker.getStderr().pipe(abortActivityStreamOnLog)\n\n // Pipe the worker's stdout and stderr to the parent process\n this._worker.getStdout().pipe(process.stdout)\n this._worker.getStderr().pipe(process.stderr)\n }\n createWorker()\n\n const onHanging = () => {\n const worker = this._worker\n if (!worker) return\n const resolve = resolveRestartPromise\n createWorker()\n logger.warn(\n `Sending SIGTERM signal to static worker due to timeout${\n timeout ? ` of ${timeout / 1000} seconds` : ''\n }. Subsequent errors may be a result of the worker exiting.`\n )\n worker.end().then(() => {\n resolve(RESTARTED)\n })\n }\n\n let hangingTimer: NodeJS.Timeout | false = false\n\n const onActivity = () => {\n if (hangingTimer) clearTimeout(hangingTimer)\n if (options.onActivity) options.onActivity()\n\n hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout)\n }\n\n for (const method of farmOptions.exposedMethods) {\n if (method.startsWith('_')) continue\n ;(this as any)[method] = timeout\n ? // eslint-disable-next-line no-loop-func\n async (...args: any[]) => {\n activeTasks++\n try {\n let attempts = 0\n for (;;) {\n onActivity()\n const result = await Promise.race([\n (this._worker as any)[method](...args),\n restartPromise,\n ])\n if (result !== RESTARTED) return result\n if (onRestart) onRestart(method, args, ++attempts)\n }\n } finally {\n activeTasks--\n onActivity()\n }\n }\n : (this._worker as any)[method].bind(this._worker)\n }\n }\n\n end(): ReturnType<JestWorker['end']> {\n const worker = this._worker\n if (!worker) {\n throw new Error('Farm is ended, no more calls can be done to it')\n }\n cleanupWorkers(worker)\n this._worker = undefined\n return worker.end()\n }\n\n /**\n * Quietly end the worker if it exists\n */\n close(): void {\n if (this._worker) {\n cleanupWorkers(this._worker)\n this._worker.end()\n }\n }\n}\n"],"names":["Worker","JestWorker","Transform","RESTARTED","Symbol","cleanupWorkers","worker","curWorker","_workerPool","_workers","_child","kill","constructor","workerPath","options","timeout","onRestart","logger","console","farmOptions","restartPromise","resolveRestartPromise","activeTasks","_worker","undefined","process","on","close","createWorker","forkOptions","env","IS_NEXT_WORKER","maxRetries","Promise","resolve","enableWorkerThreads","code","signal","error","exit","data","type","onActivity","aborted","onActivityAbort","abortActivityStreamOnLog","transform","_chunk","_encoding","callback","getStdout","pipe","getStderr","stdout","stderr","onHanging","warn","end","then","hangingTimer","clearTimeout","setTimeout","method","exposedMethods","startsWith","args","attempts","result","race","bind","Error"],"mappings":"AACA,SAASA,UAAUC,UAAU,QAAQ,iCAAgC;AACrE,SAASC,SAAS,QAAQ,SAAQ;AAIlC,MAAMC,YAAYC,OAAO;AAEzB,MAAMC,iBAAiB,CAACC;QACG;IAAzB,KAAK,MAAMC,aAAc,EAAA,sBAAA,AAACD,OAAeE,WAAW,qBAA3B,oBAA6BC,QAAQ,KAAI,EAAE,CAE/D;YACHF;SAAAA,oBAAAA,UAAUG,MAAM,qBAAhBH,kBAAkBI,IAAI,CAAC;IACzB;AACF;AAEA,OAAO,MAAMX;IAGXY,YACEC,UAAkB,EAClBC,OAQC,CACD;QACA,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,SAASC,OAAO,EAAE,GAAGC,aAAa,GAAGL;QAE/D,IAAIM;QACJ,IAAIC;QACJ,IAAIC,cAAc;QAElB,IAAI,CAACC,OAAO,GAAGC;QAEf,oDAAoD;QACpDC,QAAQC,EAAE,CAAC,QAAQ;YACjB,IAAI,CAACC,KAAK;QACZ;QAEA,MAAMC,eAAe;gBAMRT;YALX,IAAI,CAACI,OAAO,GAAG,IAAItB,WAAWY,YAAY;gBACxC,GAAGM,WAAW;gBACdU,aAAa;oBACX,GAAGV,YAAYU,WAAW;oBAC1BC,KAAK;wB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,EAAEC;oBAC3C;gBACF,SAAU;oBACR5C;oBACAoB;gBACF;YACF,IACA,AAAC,IAAI,CAACnB,OAAO,AAAQ,CAACuC,OAAO,CAACO,IAAI,CAAC,IAAI,CAAC9C,OAAO;QACrD;IACF;IAEAkC,MAAqC;QACnC,MAAMnD,SAAS,IAAI,CAACiB,OAAO;QAC3B,IAAI,CAACjB,QAAQ;YACX,MAAM,qBAA2D,CAA3D,IAAIgE,MAAM,mDAAV,qBAAA;uBAAA;4BAAA;YAA0D;QAClE;QACAjE,eAAeC;QACf,IAAI,CAACiB,OAAO,GAAGC;QACf,OAAOlB,OAAOmD,GAAG;IACnB;IAEA;;GAEC,GACD9B,QAAc;QACZ,IAAI,IAAI,CAACJ,OAAO,EAAE;YAChBlB,eAAe,IAAI,CAACkB,OAAO;YAC3B,IAAI,CAACA,OAAO,CAACkC,GAAG;QAClB;IACF;AACF"}
|
|
@@ -177,7 +177,7 @@ function assignDefaults(dir, userConfig, silent) {
|
|
|
177
177
|
enumerable: false
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
if (!((_process_env___NEXT_VERSION = "15.2.0-canary.
|
|
180
|
+
if (!((_process_env___NEXT_VERSION = "15.2.0-canary.45") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV) {
|
|
181
181
|
var _result_experimental7, _result_experimental8, _result_experimental_turbo3, _result_experimental9;
|
|
182
182
|
// Prevents usage of certain experimental features outside of canary
|
|
183
183
|
if ((_result_experimental7 = result.experimental) == null ? void 0 : _result_experimental7.ppr) {
|
|
@@ -80,7 +80,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
|
|
|
80
80
|
}
|
|
81
81
|
const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
|
|
82
82
|
const hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
83
|
-
version: "15.2.0-canary.
|
|
83
|
+
version: "15.2.0-canary.45"
|
|
84
84
|
});
|
|
85
85
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
86
86
|
// of the current `next dev` invocation.
|
|
@@ -178,7 +178,7 @@ export default class HotReloaderWebpack {
|
|
|
178
178
|
this.previewProps = previewProps;
|
|
179
179
|
this.rewrites = rewrites;
|
|
180
180
|
this.hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
181
|
-
version: "15.2.0-canary.
|
|
181
|
+
version: "15.2.0-canary.45"
|
|
182
182
|
});
|
|
183
183
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
184
184
|
// of the current `next dev` invocation.
|
|
@@ -4,7 +4,7 @@ import { bold, purple } from '../../lib/picocolors';
|
|
|
4
4
|
import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants';
|
|
5
5
|
import loadConfig, { getConfiguredExperimentalFeatures } from '../config';
|
|
6
6
|
export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, maxExperimentalFeatures = Infinity }) {
|
|
7
|
-
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.2.0-canary.
|
|
7
|
+
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.2.0-canary.45"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
|
|
8
8
|
if (appUrl) {
|
|
9
9
|
Log.bootstrap(`- Local: ${appUrl}`);
|
|
10
10
|
}
|
|
@@ -43,7 +43,7 @@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
|
|
|
43
43
|
export async function startServer(serverOptions) {
|
|
44
44
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
|
45
45
|
let { port } = serverOptions;
|
|
46
|
-
process.title = `next-server (v${"15.2.0-canary.
|
|
46
|
+
process.title = `next-server (v${"15.2.0-canary.45"})`;
|
|
47
47
|
let handlersReady = ()=>{};
|
|
48
48
|
let handlersError = ()=>{};
|
|
49
49
|
let handlersPromise = new Promise((resolve, reject)=>{
|
|
@@ -82,6 +82,10 @@ export default class NextNodeServer extends BaseServer {
|
|
|
82
82
|
if (!parsedUrl.pathname || !parsedUrl.pathname.startsWith('/_next/image')) {
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
|
+
// Ignore if its a middleware request
|
|
86
|
+
if (getRequestMeta(req, 'middlewareInvoke')) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
85
89
|
if (this.minimalMode || this.nextConfig.output === 'export' || process.env.NEXT_MINIMAL) {
|
|
86
90
|
res.statusCode = 400;
|
|
87
91
|
res.body('Bad Request').send();
|