vinext 0.0.53 → 0.0.55
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.
- package/README.md +1 -0
- package/dist/build/inline-css.d.ts +7 -0
- package/dist/build/inline-css.js +50 -0
- package/dist/build/inline-css.js.map +1 -0
- package/dist/build/prerender.js +2 -1
- package/dist/build/prerender.js.map +1 -1
- package/dist/check.js +19 -3
- package/dist/check.js.map +1 -1
- package/dist/client/navigation-runtime.d.ts +3 -1
- package/dist/client/navigation-runtime.js +1 -1
- package/dist/client/navigation-runtime.js.map +1 -1
- package/dist/client/window-next.d.ts +7 -0
- package/dist/client/window-next.js.map +1 -1
- package/dist/config/next-config.d.ts +97 -2
- package/dist/config/next-config.js +155 -6
- package/dist/config/next-config.js.map +1 -1
- package/dist/config/tsconfig-paths.d.ts +12 -3
- package/dist/config/tsconfig-paths.js +55 -24
- package/dist/config/tsconfig-paths.js.map +1 -1
- package/dist/deploy.js +13 -0
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-browser-entry.d.ts +11 -1
- package/dist/entries/app-browser-entry.js +16 -6
- package/dist/entries/app-browser-entry.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +9 -1
- package/dist/entries/app-rsc-entry.js +30 -5
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.d.ts +21 -1
- package/dist/entries/app-rsc-manifest.js +28 -9
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/pages-client-entry.d.ts +4 -1
- package/dist/entries/pages-client-entry.js +18 -2
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-server-entry.js +123 -8
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/entries/runtime-entry-module.d.ts +1 -10
- package/dist/entries/runtime-entry-module.js +2 -12
- package/dist/entries/runtime-entry-module.js.map +1 -1
- package/dist/index.js +144 -44
- package/dist/index.js.map +1 -1
- package/dist/plugins/import-meta-url.d.ts +16 -0
- package/dist/plugins/import-meta-url.js +193 -0
- package/dist/plugins/import-meta-url.js.map +1 -0
- package/dist/plugins/remove-console.d.ts +16 -0
- package/dist/plugins/remove-console.js +176 -0
- package/dist/plugins/remove-console.js.map +1 -0
- package/dist/routing/app-route-graph.d.ts +24 -1
- package/dist/routing/app-route-graph.js +52 -4
- package/dist/routing/app-route-graph.js.map +1 -1
- package/dist/routing/app-router.d.ts +2 -2
- package/dist/routing/app-router.js +2 -2
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/file-matcher.d.ts +21 -1
- package/dist/routing/file-matcher.js +39 -1
- package/dist/routing/file-matcher.js.map +1 -1
- package/dist/routing/pages-router.d.ts +1 -1
- package/dist/routing/pages-router.js +10 -3
- package/dist/routing/pages-router.js.map +1 -1
- package/dist/server/api-handler.js +1 -1
- package/dist/server/app-browser-action-result.d.ts +9 -16
- package/dist/server/app-browser-action-result.js +25 -14
- package/dist/server/app-browser-action-result.js.map +1 -1
- package/dist/server/app-browser-entry.js +195 -60
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-mpa-navigation.d.ts +16 -0
- package/dist/server/app-browser-mpa-navigation.js +36 -0
- package/dist/server/app-browser-mpa-navigation.js.map +1 -0
- package/dist/server/app-browser-navigation-controller.d.ts +2 -0
- package/dist/server/app-browser-navigation-controller.js +4 -0
- package/dist/server/app-browser-navigation-controller.js.map +1 -1
- package/dist/server/app-browser-popstate.d.ts +3 -1
- package/dist/server/app-browser-popstate.js +15 -1
- package/dist/server/app-browser-popstate.js.map +1 -1
- package/dist/server/app-browser-state.js +2 -1
- package/dist/server/app-browser-state.js.map +1 -1
- package/dist/server/app-elements-wire.d.ts +13 -4
- package/dist/server/app-elements-wire.js +10 -1
- package/dist/server/app-elements-wire.js.map +1 -1
- package/dist/server/app-elements.d.ts +2 -2
- package/dist/server/app-elements.js +2 -2
- package/dist/server/app-elements.js.map +1 -1
- package/dist/server/app-fallback-renderer.d.ts +15 -5
- package/dist/server/app-fallback-renderer.js +10 -4
- package/dist/server/app-fallback-renderer.js.map +1 -1
- package/dist/server/app-inline-css-client.d.ts +7 -0
- package/dist/server/app-inline-css-client.js +37 -0
- package/dist/server/app-inline-css-client.js.map +1 -0
- package/dist/server/app-layout-param-observation.d.ts +30 -0
- package/dist/server/app-layout-param-observation.js +130 -0
- package/dist/server/app-layout-param-observation.js.map +1 -0
- package/dist/server/app-page-boundary-render.js +2 -2
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-boundary.d.ts +21 -1
- package/dist/server/app-page-boundary.js +28 -3
- package/dist/server/app-page-boundary.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +7 -3
- package/dist/server/app-page-cache.js +7 -7
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +10 -1
- package/dist/server/app-page-dispatch.js +126 -79
- package/dist/server/app-page-dispatch.js.map +1 -1
- package/dist/server/app-page-element-builder.js +12 -28
- package/dist/server/app-page-element-builder.js.map +1 -1
- package/dist/server/app-page-params.d.ts +2 -1
- package/dist/server/app-page-params.js +14 -1
- package/dist/server/app-page-params.js.map +1 -1
- package/dist/server/app-page-probe.d.ts +12 -1
- package/dist/server/app-page-probe.js +116 -1
- package/dist/server/app-page-probe.js.map +1 -1
- package/dist/server/app-page-render-identity.d.ts +22 -0
- package/dist/server/app-page-render-identity.js +42 -0
- package/dist/server/app-page-render-identity.js.map +1 -0
- package/dist/server/app-page-render.d.ts +8 -1
- package/dist/server/app-page-render.js +4 -1
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +6 -3
- package/dist/server/app-page-request.js +5 -2
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.js +2 -2
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +15 -0
- package/dist/server/app-page-route-wiring.js +7 -5
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +11 -0
- package/dist/server/app-page-stream.js +1 -0
- package/dist/server/app-page-stream.js.map +1 -1
- package/dist/server/app-route-handler-response.js +37 -5
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +3 -2
- package/dist/server/app-rsc-cache-busting.js +9 -7
- package/dist/server/app-rsc-cache-busting.js.map +1 -1
- package/dist/server/app-rsc-handler.d.ts +14 -3
- package/dist/server/app-rsc-handler.js +56 -6
- package/dist/server/app-rsc-handler.js.map +1 -1
- package/dist/server/app-rsc-request-normalization.d.ts +2 -1
- package/dist/server/app-rsc-request-normalization.js +3 -2
- package/dist/server/app-rsc-request-normalization.js.map +1 -1
- package/dist/server/app-segment-config.d.ts +1 -1
- package/dist/server/app-segment-config.js +4 -1
- package/dist/server/app-segment-config.js.map +1 -1
- package/dist/server/app-server-action-execution.d.ts +26 -3
- package/dist/server/app-server-action-execution.js +240 -29
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/app-ssr-entry.d.ts +6 -0
- package/dist/server/app-ssr-entry.js +22 -7
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/app-ssr-error-meta.js +3 -3
- package/dist/server/app-ssr-error-meta.js.map +1 -1
- package/dist/server/app-ssr-stream.d.ts +2 -1
- package/dist/server/app-ssr-stream.js +176 -31
- package/dist/server/app-ssr-stream.js.map +1 -1
- package/dist/server/artifact-compatibility.d.ts +2 -1
- package/dist/server/artifact-compatibility.js +10 -1
- package/dist/server/artifact-compatibility.js.map +1 -1
- package/dist/server/client-reuse-manifest.d.ts +9 -4
- package/dist/server/client-reuse-manifest.js +2 -1
- package/dist/server/client-reuse-manifest.js.map +1 -1
- package/dist/server/client-trace-metadata.d.ts +31 -0
- package/dist/server/client-trace-metadata.js +83 -0
- package/dist/server/client-trace-metadata.js.map +1 -0
- package/dist/server/cookie-utils.d.ts +13 -0
- package/dist/server/cookie-utils.js +20 -0
- package/dist/server/cookie-utils.js.map +1 -0
- package/dist/server/dev-server.d.ts +8 -1
- package/dist/server/dev-server.js +83 -12
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/document-initial-head.d.ts +7 -0
- package/dist/server/document-initial-head.js +35 -0
- package/dist/server/document-initial-head.js.map +1 -0
- package/dist/server/html.d.ts +2 -1
- package/dist/server/html.js +6 -1
- package/dist/server/html.js.map +1 -1
- package/dist/server/isr-cache.d.ts +7 -5
- package/dist/server/isr-cache.js +17 -6
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/middleware-runtime.js +1 -2
- package/dist/server/middleware-runtime.js.map +1 -1
- package/dist/server/pages-document-initial-props.d.ts +89 -0
- package/dist/server/pages-document-initial-props.js +140 -0
- package/dist/server/pages-document-initial-props.js.map +1 -0
- package/dist/server/pages-node-compat.js +1 -1
- package/dist/server/pages-page-data.js +3 -0
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-method.d.ts +48 -0
- package/dist/server/pages-page-method.js +19 -0
- package/dist/server/pages-page-method.js.map +1 -0
- package/dist/server/pages-page-response.d.ts +20 -0
- package/dist/server/pages-page-response.js +37 -7
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/pages-serializable-props.d.ts +25 -0
- package/dist/server/pages-serializable-props.js +69 -0
- package/dist/server/pages-serializable-props.js.map +1 -0
- package/dist/server/prod-server.js +16 -6
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/server-action-not-found.js +3 -2
- package/dist/server/server-action-not-found.js.map +1 -1
- package/dist/server/skip-cache-proof.d.ts +23 -2
- package/dist/server/skip-cache-proof.js +81 -12
- package/dist/server/skip-cache-proof.js.map +1 -1
- package/dist/server/static-file-cache.js +2 -1
- package/dist/server/static-file-cache.js.map +1 -1
- package/dist/server/static-layout-client-reuse-proof.d.ts +16 -0
- package/dist/server/static-layout-client-reuse-proof.js +35 -0
- package/dist/server/static-layout-client-reuse-proof.js.map +1 -0
- package/dist/shims/app-router-scroll-state.d.ts +4 -2
- package/dist/shims/app-router-scroll-state.js +16 -3
- package/dist/shims/app-router-scroll-state.js.map +1 -1
- package/dist/shims/app-router-scroll.d.ts +16 -2
- package/dist/shims/app-router-scroll.js +18 -3
- package/dist/shims/app-router-scroll.js.map +1 -1
- package/dist/shims/cache.d.ts +27 -1
- package/dist/shims/cache.js +108 -6
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/document.d.ts +6 -0
- package/dist/shims/document.js +7 -8
- package/dist/shims/document.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +4 -4
- package/dist/shims/error-boundary.js +27 -28
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/error.js +3 -0
- package/dist/shims/error.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +3 -1
- package/dist/shims/fetch-cache.js +16 -5
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/hash-scroll.d.ts +4 -1
- package/dist/shims/hash-scroll.js +13 -1
- package/dist/shims/hash-scroll.js.map +1 -1
- package/dist/shims/head-state.d.ts +1 -0
- package/dist/shims/head-state.js +18 -3
- package/dist/shims/head-state.js.map +1 -1
- package/dist/shims/head.d.ts +35 -1
- package/dist/shims/head.js +113 -14
- package/dist/shims/head.js.map +1 -1
- package/dist/shims/headers.d.ts +7 -0
- package/dist/shims/headers.js +9 -1
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/internal/app-route-detection.d.ts +37 -0
- package/dist/shims/internal/app-route-detection.js +69 -0
- package/dist/shims/internal/app-route-detection.js.map +1 -0
- package/dist/shims/internal/pages-data-fetch-dedup.d.ts +56 -0
- package/dist/shims/internal/pages-data-fetch-dedup.js +70 -0
- package/dist/shims/internal/pages-data-fetch-dedup.js.map +1 -0
- package/dist/shims/link.d.ts +18 -2
- package/dist/shims/link.js +98 -8
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +7 -6
- package/dist/shims/metadata.js +9 -5
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation.d.ts +40 -3
- package/dist/shims/navigation.js +124 -25
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/router.d.ts +5 -0
- package/dist/shims/router.js +51 -21
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/script.d.ts +11 -1
- package/dist/shims/script.js +75 -6
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/thenable-params.d.ts +5 -2
- package/dist/shims/thenable-params.js +25 -1
- package/dist/shims/thenable-params.js.map +1 -1
- package/dist/shims/unified-request-context.js +3 -0
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/utils/client-build-manifest.d.ts +15 -0
- package/dist/utils/client-build-manifest.js +54 -0
- package/dist/utils/client-build-manifest.js.map +1 -0
- package/dist/utils/hash.js +1 -1
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/lazy-chunks.d.ts +1 -1
- package/dist/utils/lazy-chunks.js.map +1 -1
- package/dist/utils/path.d.ts +13 -0
- package/dist/utils/path.js +16 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/vite-version.d.ts +11 -0
- package/dist/utils/vite-version.js +36 -0
- package/dist/utils/vite-version.js.map +1 -0
- package/package.json +2 -2
package/dist/shims/document.js
CHANGED
|
@@ -18,16 +18,15 @@ function Html({ children, lang, ...props }) {
|
|
|
18
18
|
/**
|
|
19
19
|
* Document Head - renders <head> with children.
|
|
20
20
|
* The dev server injects meta tags, styles, etc.
|
|
21
|
+
*
|
|
22
|
+
* Note: charset and viewport are intentionally NOT hardcoded here. Those
|
|
23
|
+
* defaults are seeded by `next/head`'s `defaultHead()` and emitted alongside
|
|
24
|
+
* user `<Head>` tags via `getSSRHeadHTML()`, matching Next.js's canonical
|
|
25
|
+
* ordering (`<meta charset>` first, then `<meta viewport>`, then user tags,
|
|
26
|
+
* all with `data-next-head=""`). See `test/e2e/next-head/index.test.ts`.
|
|
21
27
|
*/
|
|
22
28
|
function Head({ children }) {
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */ jsx("meta", { charSet: "utf-8" }),
|
|
25
|
-
/* @__PURE__ */ jsx("meta", {
|
|
26
|
-
name: "viewport",
|
|
27
|
-
content: "width=device-width, initial-scale=1"
|
|
28
|
-
}),
|
|
29
|
-
children
|
|
30
|
-
] });
|
|
29
|
+
return /* @__PURE__ */ jsx("head", { children });
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
32
|
* Main - renders the page content container.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","names":[],"sources":["../../src/shims/document.tsx"],"sourcesContent":["/**\n * next/document shim\n *\n * Provides Html, Head, Main, NextScript components for custom _document.tsx.\n * During SSR these render placeholder markers that the dev server replaces\n * with actual content.\n */\nimport React from \"react\";\n\nexport function Html({\n children,\n lang,\n ...props\n}: React.HTMLAttributes<HTMLHtmlElement> & { children?: React.ReactNode }) {\n return (\n <html lang={lang} {...props}>\n {children}\n </html>\n );\n}\n\n/**\n * Document Head - renders <head> with children.\n * The dev server injects meta tags, styles, etc.\n */\nexport function Head({ children }: { children?: React.ReactNode }) {\n return
|
|
1
|
+
{"version":3,"file":"document.js","names":[],"sources":["../../src/shims/document.tsx"],"sourcesContent":["/**\n * next/document shim\n *\n * Provides Html, Head, Main, NextScript components for custom _document.tsx.\n * During SSR these render placeholder markers that the dev server replaces\n * with actual content.\n */\nimport React from \"react\";\n\nexport function Html({\n children,\n lang,\n ...props\n}: React.HTMLAttributes<HTMLHtmlElement> & { children?: React.ReactNode }) {\n return (\n <html lang={lang} {...props}>\n {children}\n </html>\n );\n}\n\n/**\n * Document Head - renders <head> with children.\n * The dev server injects meta tags, styles, etc.\n *\n * Note: charset and viewport are intentionally NOT hardcoded here. Those\n * defaults are seeded by `next/head`'s `defaultHead()` and emitted alongside\n * user `<Head>` tags via `getSSRHeadHTML()`, matching Next.js's canonical\n * ordering (`<meta charset>` first, then `<meta viewport>`, then user tags,\n * all with `data-next-head=\"\"`). See `test/e2e/next-head/index.test.ts`.\n */\nexport function Head({ children }: { children?: React.ReactNode }) {\n return <head>{children}</head>;\n}\n\n/**\n * Main - renders the page content container.\n */\nexport function Main() {\n return <div id=\"__next\" dangerouslySetInnerHTML={{ __html: \"__NEXT_MAIN__\" }} />;\n}\n\n/**\n * NextScript - renders a placeholder that the dev-server replaces with\n * actual hydration scripts (__NEXT_DATA__ + entry module).\n * Uses dangerouslySetInnerHTML so the HTML comment survives renderToString.\n */\nexport function NextScript() {\n return <span dangerouslySetInnerHTML={{ __html: \"<!-- __NEXT_SCRIPTS__ -->\" }} />;\n}\n\n/**\n * Loose stand-ins for Next.js's `DocumentContext` / `DocumentInitialProps`.\n * The shim doesn't currently invoke `getInitialProps` on user `_document.tsx`\n * files (separate gap), but the signatures here match Next.js's so subclasses\n * that delegate via `await Document.getInitialProps(ctx)` typecheck against\n * the same shape they'd see under real Next.js.\n *\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/utils.ts\n */\nexport type DocumentContext = {\n // The full `DocumentContext` includes `renderPage`, `defaultGetInitialProps`,\n // and the inherited `NextPageContext` (`pathname`, `query`, `req`, `res`,\n // `err`, `asPath`, ...). They're declared as optional here because vinext\n // does not yet plumb them through; widening to optional avoids forcing user\n // code to assert their presence.\n renderPage?: (options?: {\n enhanceApp?: (App: React.ComponentType<{ children?: React.ReactNode }>) => unknown;\n enhanceComponent?: (Comp: React.ComponentType<unknown>) => unknown;\n }) => { html: string; head?: ReadonlyArray<React.ReactElement> };\n defaultGetInitialProps?: (\n ctx: DocumentContext,\n options?: { nonce?: string },\n ) => Promise<DocumentInitialProps>;\n pathname?: string;\n query?: Record<string, string | string[] | undefined>;\n asPath?: string;\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n err?: any;\n};\n\nexport type DocumentInitialProps = {\n html: string;\n head?: ReadonlyArray<React.ReactElement>;\n styles?: React.ReactElement[] | Iterable<React.ReactNode> | React.ReactElement;\n};\n\n/**\n * Default Document component — also the base class user `_document.tsx` files\n * `extend`. Must be a class (not a function) to match Next.js's `next/document`\n * default export so `class MyDocument extends Document` produces a constructible\n * class that React can instantiate during SSR. Returning a function here breaks\n * any user `_document.tsx` that uses the class-based form because `extends`\n * against a non-constructor produces a class that can only be called without\n * `new`, which React refuses to do.\n *\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/pages/_document.tsx\n * Ported behavior: Next.js's default `Document` is a `class Document extends\n * React.Component`. Custom documents extend it and override `getInitialProps`\n * and `render`. Generic default matches Next.js (`P = {}`).\n */\n// oxlint-disable-next-line @typescript-eslint/no-empty-object-type\nexport default class Document<P = {}> extends React.Component<P & { children?: React.ReactNode }> {\n /**\n * `getInitialProps` is invoked by the SSR pipeline. The default implementation\n * is a stub: vinext does not yet plumb the Pages Router `renderPage` /\n * `defaultGetInitialProps` chain into the SSR entry, so subclasses that\n * delegate via `await Document.getInitialProps(ctx)` receive an empty shell\n * (`html: \"\"`). This matches the runtime contract user code expects without\n * pretending the chain is wired up.\n */\n static async getInitialProps(_ctx: DocumentContext): Promise<DocumentInitialProps> {\n return { html: \"\" };\n }\n\n render(): React.ReactNode {\n return (\n <Html>\n <Head />\n <body>\n <Main />\n <NextScript />\n </body>\n </Html>\n );\n }\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,KAAK,EACnB,UACA,MACA,GAAG,SACsE;CACzE,OACE,oBAAC,QAAD;EAAY;EAAM,GAAI;EACnB;EACI,CAAA;;;;;;;;;;;;AAcX,SAAgB,KAAK,EAAE,YAA4C;CACjE,OAAO,oBAAC,QAAD,EAAO,UAAgB,CAAA;;;;;AAMhC,SAAgB,OAAO;CACrB,OAAO,oBAAC,OAAD;EAAK,IAAG;EAAS,yBAAyB,EAAE,QAAQ,iBAAiB;EAAI,CAAA;;;;;;;AAQlF,SAAgB,aAAa;CAC3B,OAAO,oBAAC,QAAD,EAAM,yBAAyB,EAAE,QAAQ,6BAA6B,EAAI,CAAA;;;;;;;;;;;;;;;;AAsDnF,IAAqB,WAArB,cAA8C,MAAM,UAA8C;;;;;;;;;CAShG,aAAa,gBAAgB,MAAsD;EACjF,OAAO,EAAE,MAAM,IAAI;;CAGrB,SAA0B;EACxB,OACE,qBAAC,MAAD,EAAA,UAAA,CACE,oBAAC,MAAD,EAAQ,CAAA,EACR,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,MAAD,EAAQ,CAAA,EACR,oBAAC,YAAD,EAAc,CAAA,CACT,EAAA,CAAA,CACF,EAAA,CAAA"}
|
|
@@ -32,7 +32,7 @@ declare class RedirectErrorBoundary extends React.Component<{
|
|
|
32
32
|
children?: React.ReactNode;
|
|
33
33
|
});
|
|
34
34
|
static getDerivedStateFromError(error: unknown): RedirectBoundaryState;
|
|
35
|
-
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> |
|
|
35
|
+
render(): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
36
36
|
}
|
|
37
37
|
declare function RedirectBoundary({
|
|
38
38
|
children
|
|
@@ -49,7 +49,7 @@ declare class ErrorBoundaryInner extends React.Component<ErrorBoundaryInnerProps
|
|
|
49
49
|
static getDerivedStateFromProps(props: ErrorBoundaryInnerProps, state: ErrorBoundaryState): ErrorBoundaryState | null;
|
|
50
50
|
static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState>;
|
|
51
51
|
reset: () => void;
|
|
52
|
-
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> |
|
|
52
|
+
render(): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
53
53
|
}
|
|
54
54
|
declare function ErrorBoundary({
|
|
55
55
|
fallback,
|
|
@@ -87,7 +87,7 @@ declare class ForbiddenBoundaryInner extends React.Component<ForbiddenBoundaryIn
|
|
|
87
87
|
constructor(props: ForbiddenBoundaryInnerProps);
|
|
88
88
|
static getDerivedStateFromProps(props: ForbiddenBoundaryInnerProps, state: ForbiddenBoundaryState): ForbiddenBoundaryState | null;
|
|
89
89
|
static getDerivedStateFromError(error: unknown): Partial<ForbiddenBoundaryState>;
|
|
90
|
-
render(): React.ReactNode;
|
|
90
|
+
render(): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
91
91
|
}
|
|
92
92
|
declare function ForbiddenBoundary({
|
|
93
93
|
fallback,
|
|
@@ -111,7 +111,7 @@ declare class UnauthorizedBoundaryInner extends React.Component<UnauthorizedBoun
|
|
|
111
111
|
constructor(props: UnauthorizedBoundaryInnerProps);
|
|
112
112
|
static getDerivedStateFromProps(props: UnauthorizedBoundaryInnerProps, state: UnauthorizedBoundaryState): UnauthorizedBoundaryState | null;
|
|
113
113
|
static getDerivedStateFromError(error: unknown): Partial<UnauthorizedBoundaryState>;
|
|
114
|
-
render(): React.ReactNode;
|
|
114
|
+
render(): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
115
115
|
}
|
|
116
116
|
declare function UnauthorizedBoundary({
|
|
117
117
|
fallback,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { isRedirectError, usePathname, useRouter } from "./navigation.js";
|
|
2
|
+
import { decodeRedirectError, isRedirectError, usePathname, useRouter } from "./navigation.js";
|
|
3
3
|
import { isNavigationSignalError } from "../utils/navigation-signal.js";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/shims/error-boundary.tsx
|
|
7
7
|
function normalizeBoundaryResetKey(resetKey) {
|
|
8
8
|
return resetKey === void 0 || resetKey === null || resetKey === "" ? null : resetKey;
|
|
@@ -19,31 +19,18 @@ function shouldResetBoundary(nextResetState, previousResetState) {
|
|
|
19
19
|
if (nextResetKey !== null || previousResetKey !== null) return nextResetKey !== previousResetKey;
|
|
20
20
|
return nextResetState.previousPathname !== previousResetState.previousPathname;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
try {
|
|
24
|
-
return decodeURIComponent(target);
|
|
25
|
-
} catch {
|
|
26
|
-
return target;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function getURLFromRedirectError(error) {
|
|
30
|
-
const parts = error.digest.split(";");
|
|
31
|
-
const encodedTarget = parts.length >= 5 ? parts.slice(2, -2).join(";") : parts[2];
|
|
32
|
-
return encodedTarget ? decodeRedirectTarget(encodedTarget) : null;
|
|
33
|
-
}
|
|
34
|
-
function getRedirectTypeFromError(error) {
|
|
35
|
-
return error.digest.split(";", 2)[1] === "push" ? "push" : "replace";
|
|
36
|
-
}
|
|
37
|
-
function HandleRedirect({ redirect, redirectType }) {
|
|
22
|
+
function HandleRedirect({ redirect, redirectType, reset }) {
|
|
38
23
|
const router = useRouter();
|
|
39
24
|
React.useEffect(() => {
|
|
40
25
|
React.startTransition(() => {
|
|
41
26
|
if (redirectType === "push") router.push(redirect);
|
|
42
27
|
else router.replace(redirect);
|
|
28
|
+
reset();
|
|
43
29
|
});
|
|
44
30
|
}, [
|
|
45
31
|
redirect,
|
|
46
32
|
redirectType,
|
|
33
|
+
reset,
|
|
47
34
|
router
|
|
48
35
|
]);
|
|
49
36
|
return null;
|
|
@@ -58,16 +45,15 @@ var RedirectErrorBoundary = class extends React.Component {
|
|
|
58
45
|
}
|
|
59
46
|
static getDerivedStateFromError(error) {
|
|
60
47
|
if (isRedirectError(error)) {
|
|
61
|
-
|
|
62
|
-
if (redirectError.handled) return {
|
|
48
|
+
if ("handled" in error && error.handled) return {
|
|
63
49
|
redirect: null,
|
|
64
50
|
redirectType: null
|
|
65
51
|
};
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
52
|
+
const result = decodeRedirectError(error.digest);
|
|
53
|
+
if (!result) throw error;
|
|
68
54
|
return {
|
|
69
|
-
redirect: url,
|
|
70
|
-
redirectType:
|
|
55
|
+
redirect: result.url,
|
|
56
|
+
redirectType: result.type
|
|
71
57
|
};
|
|
72
58
|
}
|
|
73
59
|
throw error;
|
|
@@ -76,7 +62,11 @@ var RedirectErrorBoundary = class extends React.Component {
|
|
|
76
62
|
const { redirect, redirectType } = this.state;
|
|
77
63
|
if (redirect !== null && redirectType !== null) return /* @__PURE__ */ jsx(HandleRedirect, {
|
|
78
64
|
redirect,
|
|
79
|
-
redirectType
|
|
65
|
+
redirectType,
|
|
66
|
+
reset: () => this.setState({
|
|
67
|
+
redirect: null,
|
|
68
|
+
redirectType: null
|
|
69
|
+
})
|
|
80
70
|
});
|
|
81
71
|
return this.props.children;
|
|
82
72
|
}
|
|
@@ -169,7 +159,10 @@ var NotFoundBoundaryInner = class extends React.Component {
|
|
|
169
159
|
throw error;
|
|
170
160
|
}
|
|
171
161
|
render() {
|
|
172
|
-
if (this.state.notFound) return
|
|
162
|
+
if (this.state.notFound) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("meta", {
|
|
163
|
+
name: "robots",
|
|
164
|
+
content: "noindex"
|
|
165
|
+
}), this.props.fallback] });
|
|
173
166
|
return this.props.children;
|
|
174
167
|
}
|
|
175
168
|
};
|
|
@@ -211,7 +204,10 @@ var ForbiddenBoundaryInner = class extends React.Component {
|
|
|
211
204
|
throw error;
|
|
212
205
|
}
|
|
213
206
|
render() {
|
|
214
|
-
if (this.state.forbidden) return
|
|
207
|
+
if (this.state.forbidden) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("meta", {
|
|
208
|
+
name: "robots",
|
|
209
|
+
content: "noindex"
|
|
210
|
+
}), this.props.fallback] });
|
|
215
211
|
return this.props.children;
|
|
216
212
|
}
|
|
217
213
|
};
|
|
@@ -249,7 +245,10 @@ var UnauthorizedBoundaryInner = class extends React.Component {
|
|
|
249
245
|
throw error;
|
|
250
246
|
}
|
|
251
247
|
render() {
|
|
252
|
-
if (this.state.unauthorized) return
|
|
248
|
+
if (this.state.unauthorized) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("meta", {
|
|
249
|
+
name: "robots",
|
|
250
|
+
content: "noindex"
|
|
251
|
+
}), this.props.fallback] });
|
|
253
252
|
return this.props.children;
|
|
254
253
|
}
|
|
255
254
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-boundary.js","names":[],"sources":["../../src/shims/error-boundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n// Import the local shim, not the public next/navigation alias. The built\n// package may execute this file before the plugin's resolveId hook is active.\nimport { isRedirectError, usePathname, useRouter } from \"./navigation.js\";\nimport { isNavigationSignalError } from \"../utils/navigation-signal.js\";\n\nexport type ErrorBoundaryProps = {\n fallback: React.ComponentType<{ error: unknown; reset: () => void }>;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype CapturedError = {\n thrownValue: unknown;\n};\n\ntype RedirectBoundaryState = {\n redirect: string | null;\n redirectType: \"push\" | \"replace\" | null;\n};\n\ntype RedirectError = Error & {\n digest: string;\n handled?: boolean;\n};\n\ntype ErrorBoundaryInnerProps = {\n pathname: string;\n} & ErrorBoundaryProps;\n\nexport type ErrorBoundaryState = {\n error: CapturedError | null;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\ntype BoundaryResetProps = {\n pathname: string;\n resetKey?: string | null;\n};\n\ntype BoundaryResetState = {\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nfunction normalizeBoundaryResetKey(resetKey: string | null | undefined): string | null {\n return resetKey === undefined || resetKey === null || resetKey === \"\" ? null : resetKey;\n}\n\nfunction readBoundaryResetState(props: BoundaryResetProps): BoundaryResetState {\n return {\n previousPathname: props.pathname,\n previousResetKey: normalizeBoundaryResetKey(props.resetKey),\n };\n}\n\nfunction shouldResetBoundary(\n nextResetState: BoundaryResetState,\n previousResetState: BoundaryResetState,\n): boolean {\n const nextResetKey = normalizeBoundaryResetKey(nextResetState.previousResetKey);\n const previousResetKey = normalizeBoundaryResetKey(previousResetState.previousResetKey);\n\n if (nextResetKey !== null || previousResetKey !== null) {\n return nextResetKey !== previousResetKey;\n }\n\n return nextResetState.previousPathname !== previousResetState.previousPathname;\n}\n\nfunction decodeRedirectTarget(target: string): string {\n try {\n return decodeURIComponent(target);\n } catch {\n return target;\n }\n}\n\nfunction getURLFromRedirectError(error: RedirectError): string | null {\n const parts = error.digest.split(\";\");\n // vinext emits 3-part (redirect: `NEXT_REDIRECT;;<encoded>`) or 4-part\n // (permanentRedirect: `NEXT_REDIRECT;<type>;<encoded>;308`) digests;\n // Next.js emits 5-part digests (`NEXT_REDIRECT;<type>;<url>;<status>;<isClient>`).\n // vinext's `isRedirectError` is more permissive (just `startsWith(\"NEXT_REDIRECT;\")`)\n // so we branch on length rather than always using `slice(2, -2)`.\n const encodedTarget = parts.length >= 5 ? parts.slice(2, -2).join(\";\") : parts[2];\n return encodedTarget ? decodeRedirectTarget(encodedTarget) : null;\n}\n\nfunction getRedirectTypeFromError(error: RedirectError): \"push\" | \"replace\" {\n const type = error.digest.split(\";\", 2)[1];\n return type === \"push\" ? \"push\" : \"replace\";\n}\n\nfunction HandleRedirect({\n redirect,\n redirectType,\n}: {\n redirect: string;\n redirectType: \"push\" | \"replace\";\n}) {\n const router = useRouter();\n\n React.useEffect(() => {\n React.startTransition(() => {\n if (redirectType === \"push\") {\n router.push(redirect);\n } else {\n router.replace(redirect);\n }\n // Intentionally no reset() here. The boundary stays in its \"redirect\n // caught\" state (rendering this component, which returns null) until\n // router.push()/replace() triggers a new render at the destination\n // route. That naturally unmounts this boundary and mounts a fresh one.\n // Calling reset() would clear the boundary state, causing React to\n // re-render children — which re-mounts the page component that threw\n // redirect() in the first place. For deterministic redirects (e.g.\n // auth guards), that creates an infinite redirect loop.\n // Matches Next.js's HandleRedirect in redirect-boundary.tsx.\n });\n }, [redirect, redirectType, router]);\n\n return null;\n}\n\nexport class RedirectErrorBoundary extends React.Component<\n { children?: React.ReactNode },\n RedirectBoundaryState\n> {\n constructor(props: { children?: React.ReactNode }) {\n super(props);\n this.state = {\n redirect: null,\n redirectType: null,\n };\n }\n\n static getDerivedStateFromError(error: unknown): RedirectBoundaryState {\n if (isRedirectError(error)) {\n // The public `isRedirectError` narrows to `Error & { digest: string }`.\n // Cast to the local `RedirectError` (which also carries the optional\n // `handled` field) so the parity logic below compiles. The cast is\n // safe because every error that matches the prefix predicate is — by\n // construction — produced by vinext's `redirect()` /\n // `permanentRedirect()` helpers, which yield `Error` instances.\n const redirectError = error as RedirectError;\n // Next.js parity: an outer RedirectBoundary that has already started\n // handling a redirect marks the error as `handled` so that, if React\n // re-throws the same error during a retry render, an inner boundary\n // doesn't re-dispatch the same `router.replace()`. Vinext doesn't\n // currently emit `handled` itself (we never assign it on the error\n // object), but we keep the branch so behavior matches Next.js if a\n // host or future change ever does.\n if (redirectError.handled) {\n return {\n redirect: null,\n redirectType: null,\n };\n }\n\n const url = getURLFromRedirectError(redirectError);\n if (url === null) {\n // Malformed digest (e.g. `NEXT_REDIRECT;push;` with an empty URL\n // segment). The server-side parser at next-error-digest.ts:51 also\n // rejects this. Re-throw so the error reaches a regular error\n // boundary instead of being silently swallowed.\n throw error;\n }\n\n return {\n redirect: url,\n redirectType: getRedirectTypeFromError(redirectError),\n };\n }\n\n throw error;\n }\n\n render() {\n const { redirect, redirectType } = this.state;\n if (redirect !== null && redirectType !== null) {\n return <HandleRedirect redirect={redirect} redirectType={redirectType} />;\n }\n\n return this.props.children;\n }\n}\n\nexport function RedirectBoundary({ children }: { children?: React.ReactNode }) {\n return <RedirectErrorBoundary>{children}</RedirectErrorBoundary>;\n}\n\n/**\n * Generic ErrorBoundary used to wrap route segments with error.tsx.\n * This must be a client component since error boundaries use\n * componentDidCatch / getDerivedStateFromError.\n */\nexport class ErrorBoundaryInner extends React.Component<\n ErrorBoundaryInnerProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryInnerProps) {\n super(props);\n this.state = { error: null, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ErrorBoundaryInnerProps,\n state: ErrorBoundaryState,\n ): ErrorBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.error && shouldResetBoundary(nextResetState, state)) {\n return { error: null, ...nextResetState };\n }\n return { error: state.error, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {\n // notFound(), forbidden(), unauthorized(), and redirect() must propagate\n // past error boundaries. Re-throw them so they bubble up to the\n // framework's HTTP access fallback / redirect handler.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n reset = () => {\n this.setState({ error: null });\n };\n\n render() {\n if (this.state.error) {\n const FallbackComponent = this.props.fallback;\n return <FallbackComponent error={this.state.error.thrownValue} reset={this.reset} />;\n }\n return this.props.children;\n }\n}\n\nexport function ErrorBoundary({ fallback, children, resetKey }: ErrorBoundaryProps) {\n const pathname = usePathname();\n return (\n <ErrorBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ErrorBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// NotFoundBoundary — catches notFound() on the client and renders not-found.tsx\n// ---------------------------------------------------------------------------\n\ntype NotFoundBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype NotFoundBoundaryInnerProps = {\n pathname: string;\n} & NotFoundBoundaryProps;\n\ntype NotFoundBoundaryState = {\n notFound: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\n/**\n * Inner class component that catches notFound() errors and renders the\n * not-found.tsx fallback. Resets on the caller's segment reset key when one is\n * provided, otherwise falls back to pathname changes for legacy callers.\n *\n * The ErrorBoundary above re-throws notFound errors so they propagate up to this\n * boundary. This must be placed above the ErrorBoundary in the component tree.\n */\nclass NotFoundBoundaryInner extends React.Component<\n NotFoundBoundaryInnerProps,\n NotFoundBoundaryState\n> {\n constructor(props: NotFoundBoundaryInnerProps) {\n super(props);\n this.state = { notFound: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: NotFoundBoundaryInnerProps,\n state: NotFoundBoundaryState,\n ): NotFoundBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.notFound && shouldResetBoundary(nextResetState, state)) {\n return { notFound: false, ...nextResetState };\n }\n return { notFound: state.notFound, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<NotFoundBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_NOT_FOUND\" || digest === \"NEXT_HTTP_ERROR_FALLBACK;404\") {\n return { notFound: true };\n }\n }\n // Not a notFound error — re-throw so it reaches an ErrorBoundary or propagates\n throw error;\n }\n\n render() {\n if (this.state.notFound) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrapper that reads the current pathname and passes it to the inner class\n * component. Segment reset keys own App Router remount semantics when present.\n */\nexport function NotFoundBoundary({ fallback, children, resetKey }: NotFoundBoundaryProps) {\n const pathname = usePathname();\n return (\n <NotFoundBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </NotFoundBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// ForbiddenBoundary — catches forbidden() on the client and renders forbidden.tsx\n// ---------------------------------------------------------------------------\n\ntype ForbiddenBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype ForbiddenBoundaryInnerProps = {\n pathname: string;\n} & ForbiddenBoundaryProps;\n\ntype ForbiddenBoundaryState = {\n forbidden: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class ForbiddenBoundaryInner extends React.Component<\n ForbiddenBoundaryInnerProps,\n ForbiddenBoundaryState\n> {\n constructor(props: ForbiddenBoundaryInnerProps) {\n super(props);\n this.state = { forbidden: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ForbiddenBoundaryInnerProps,\n state: ForbiddenBoundaryState,\n ): ForbiddenBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.forbidden && shouldResetBoundary(nextResetState, state)) {\n return { forbidden: false, ...nextResetState };\n }\n return { forbidden: state.forbidden, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ForbiddenBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;403\") {\n return { forbidden: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.forbidden) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function ForbiddenBoundary({ fallback, children, resetKey }: ForbiddenBoundaryProps) {\n const pathname = usePathname();\n return (\n <ForbiddenBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ForbiddenBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// UnauthorizedBoundary — catches unauthorized() on the client and renders unauthorized.tsx\n// ---------------------------------------------------------------------------\n\ntype UnauthorizedBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype UnauthorizedBoundaryInnerProps = {\n pathname: string;\n} & UnauthorizedBoundaryProps;\n\ntype UnauthorizedBoundaryState = {\n unauthorized: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class UnauthorizedBoundaryInner extends React.Component<\n UnauthorizedBoundaryInnerProps,\n UnauthorizedBoundaryState\n> {\n constructor(props: UnauthorizedBoundaryInnerProps) {\n super(props);\n this.state = { unauthorized: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: UnauthorizedBoundaryInnerProps,\n state: UnauthorizedBoundaryState,\n ): UnauthorizedBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.unauthorized && shouldResetBoundary(nextResetState, state)) {\n return { unauthorized: false, ...nextResetState };\n }\n return { unauthorized: state.unauthorized, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<UnauthorizedBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;401\") {\n return { unauthorized: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.unauthorized) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function UnauthorizedBoundary({ fallback, children, resetKey }: UnauthorizedBoundaryProps) {\n const pathname = usePathname();\n return (\n <UnauthorizedBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </UnauthorizedBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// DevRecoveryBoundary — dev-only top-level boundary inside BrowserRoot.\n// Catches any render error that isn't already handled by a user-defined\n// error.tsx (or the access-fallback boundaries above), renders nothing, and\n// keeps BrowserRoot mounted so HMR can dispatch a new RSC payload without a\n// full page reload. Resets on resetKey change — the caller bumps that key\n// (e.g. via treeState.renderId) when a fresh tree is dispatched.\n//\n// Routing sentinels are re-thrown so notFound()/redirect()/forbidden()/\n// unauthorized() still reach their dedicated boundaries above.\n// ---------------------------------------------------------------------------\n\nexport type DevRecoveryBoundaryProps = {\n resetKey: number;\n // Called from componentDidCatch with the current resetKey so the host can\n // run any pending side effects that NavigationCommitSignal would normally\n // drive on commit — most importantly the URL update for the in-flight\n // soft-nav. Without this, a navigation that fails mid-render leaves the\n // browser on the previous URL even though the boundary recovered.\n //\n // The error itself is intentionally not passed: React's onCaughtError option\n // already routes the error to the dev overlay, so this callback is only for\n // commit-side effects keyed by resetKey.\n onCatch?: (resetKey: number) => void;\n // Children come through React.Component's PropsWithChildren default; declared\n // optional so callers can pass them positionally to createElement without\n // tripping the eslint no-children-prop rule.\n children?: React.ReactNode;\n};\n\ntype DevRecoveryBoundaryState = {\n error: CapturedError | null;\n previousResetKey: number;\n};\n\nexport class DevRecoveryBoundary extends React.Component<\n DevRecoveryBoundaryProps,\n DevRecoveryBoundaryState\n> {\n constructor(props: DevRecoveryBoundaryProps) {\n super(props);\n this.state = { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromProps(\n props: DevRecoveryBoundaryProps,\n state: DevRecoveryBoundaryState,\n ): DevRecoveryBoundaryState | null {\n if (props.resetKey === state.previousResetKey) {\n return null;\n }\n return { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<DevRecoveryBoundaryState> {\n // Re-throw routing sentinels so they still reach NotFoundBoundary /\n // RedirectBoundary / Forbidden / Unauthorized above.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n componentDidCatch(): void {\n this.props.onCatch?.(this.props.resetKey);\n }\n\n render() {\n if (this.state.error) {\n // Render nothing — the dev overlay (mounted in a separate React root)\n // shows the actual error to the developer. HMR pushing a new payload\n // bumps resetKey above, clearing this state and letting the children\n // re-render with the fixed code.\n return null;\n }\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;AAgDA,SAAS,0BAA0B,UAAoD;CACrF,OAAO,aAAa,KAAA,KAAa,aAAa,QAAQ,aAAa,KAAK,OAAO;;AAGjF,SAAS,uBAAuB,OAA+C;CAC7E,OAAO;EACL,kBAAkB,MAA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EAAE,aAAa,OAAO,EAAE;;CAG1C,oBAA0B;EACxB,KAAK,MAAM,UAAU,KAAK,MAAM,SAAS;;CAG3C,SAAS;EACP,IAAI,KAAK,MAAM,OAKb,OAAO;EAET,OAAO,KAAK,MAAM"}
|
|
1
|
+
{"version":3,"file":"error-boundary.js","names":[],"sources":["../../src/shims/error-boundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n// Import the local shim, not the public next/navigation alias. The built\n// package may execute this file before the plugin's resolveId hook is active.\nimport { decodeRedirectError, isRedirectError, usePathname, useRouter } from \"./navigation.js\";\nimport { isNavigationSignalError } from \"../utils/navigation-signal.js\";\n\nexport type ErrorBoundaryProps = {\n fallback: React.ComponentType<{ error: unknown; reset: () => void }>;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype CapturedError = {\n thrownValue: unknown;\n};\n\ntype RedirectBoundaryState = {\n redirect: string | null;\n redirectType: \"push\" | \"replace\" | null;\n};\n\ntype ErrorBoundaryInnerProps = {\n pathname: string;\n} & ErrorBoundaryProps;\n\nexport type ErrorBoundaryState = {\n error: CapturedError | null;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\ntype BoundaryResetProps = {\n pathname: string;\n resetKey?: string | null;\n};\n\ntype BoundaryResetState = {\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nfunction normalizeBoundaryResetKey(resetKey: string | null | undefined): string | null {\n return resetKey === undefined || resetKey === null || resetKey === \"\" ? null : resetKey;\n}\n\nfunction readBoundaryResetState(props: BoundaryResetProps): BoundaryResetState {\n return {\n previousPathname: props.pathname,\n previousResetKey: normalizeBoundaryResetKey(props.resetKey),\n };\n}\n\nfunction shouldResetBoundary(\n nextResetState: BoundaryResetState,\n previousResetState: BoundaryResetState,\n): boolean {\n const nextResetKey = normalizeBoundaryResetKey(nextResetState.previousResetKey);\n const previousResetKey = normalizeBoundaryResetKey(previousResetState.previousResetKey);\n\n if (nextResetKey !== null || previousResetKey !== null) {\n return nextResetKey !== previousResetKey;\n }\n\n return nextResetState.previousPathname !== previousResetState.previousPathname;\n}\n\nfunction HandleRedirect({\n redirect,\n redirectType,\n reset,\n}: {\n redirect: string;\n redirectType: \"push\" | \"replace\";\n reset: () => void;\n}) {\n const router = useRouter();\n\n React.useEffect(() => {\n React.startTransition(() => {\n if (redirectType === \"push\") {\n router.push(redirect);\n } else {\n router.replace(redirect);\n }\n reset();\n });\n }, [redirect, redirectType, reset, router]);\n\n return null;\n}\n\nexport class RedirectErrorBoundary extends React.Component<\n { children?: React.ReactNode },\n RedirectBoundaryState\n> {\n constructor(props: { children?: React.ReactNode }) {\n super(props);\n this.state = {\n redirect: null,\n redirectType: null,\n };\n }\n\n static getDerivedStateFromError(error: unknown): RedirectBoundaryState {\n if (isRedirectError(error)) {\n // Next.js parity: an outer RedirectBoundary that has already started\n // handling a redirect marks the error as `handled` so that, if React\n // re-throws the same error during a retry render, an inner boundary\n // doesn't re-dispatch the same `router.replace()`. Vinext doesn't\n // currently emit `handled` itself (we never assign it on the error\n // object), but we keep the branch so behavior matches Next.js if a\n // host or future change ever does.\n if (\"handled\" in error && error.handled) {\n return {\n redirect: null,\n redirectType: null,\n };\n }\n\n const result = decodeRedirectError(error.digest);\n if (!result) {\n // Malformed digest (e.g. `NEXT_REDIRECT;push;` with an empty URL\n // segment). The server-side parser at next-error-digest.ts:51 also\n // rejects this. Re-throw so the error reaches a regular error\n // boundary instead of being silently swallowed.\n throw error;\n }\n\n return {\n redirect: result.url,\n redirectType: result.type,\n };\n }\n\n throw error;\n }\n\n render() {\n const { redirect, redirectType } = this.state;\n if (redirect !== null && redirectType !== null) {\n return (\n <HandleRedirect\n redirect={redirect}\n redirectType={redirectType}\n reset={() => this.setState({ redirect: null, redirectType: null })}\n />\n );\n }\n\n return this.props.children;\n }\n}\n\nexport function RedirectBoundary({ children }: { children?: React.ReactNode }) {\n return <RedirectErrorBoundary>{children}</RedirectErrorBoundary>;\n}\n\n/**\n * Generic ErrorBoundary used to wrap route segments with error.tsx.\n * This must be a client component since error boundaries use\n * componentDidCatch / getDerivedStateFromError.\n */\nexport class ErrorBoundaryInner extends React.Component<\n ErrorBoundaryInnerProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryInnerProps) {\n super(props);\n this.state = {\n error: null,\n ...readBoundaryResetState(props),\n };\n }\n\n static getDerivedStateFromProps(\n props: ErrorBoundaryInnerProps,\n state: ErrorBoundaryState,\n ): ErrorBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.error && shouldResetBoundary(nextResetState, state)) {\n return { error: null, ...nextResetState };\n }\n return {\n error: state.error,\n ...nextResetState,\n };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {\n // notFound(), forbidden(), unauthorized(), and redirect() must propagate\n // past error boundaries. Re-throw them so they bubble up to the\n // framework's HTTP access fallback / redirect handler.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n reset = () => {\n this.setState({ error: null });\n };\n\n render() {\n if (this.state.error) {\n const FallbackComponent = this.props.fallback;\n return <FallbackComponent error={this.state.error.thrownValue} reset={this.reset} />;\n }\n return this.props.children;\n }\n}\n\nexport function ErrorBoundary({ fallback, children, resetKey }: ErrorBoundaryProps) {\n const pathname = usePathname();\n return (\n <ErrorBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ErrorBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// NotFoundBoundary — catches notFound() on the client and renders not-found.tsx\n// ---------------------------------------------------------------------------\n\ntype NotFoundBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype NotFoundBoundaryInnerProps = {\n pathname: string;\n} & NotFoundBoundaryProps;\n\ntype NotFoundBoundaryState = {\n notFound: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\n/**\n * Inner class component that catches notFound() errors and renders the\n * not-found.tsx fallback. Resets on the caller's segment reset key when one is\n * provided, otherwise falls back to pathname changes for legacy callers.\n *\n * The ErrorBoundary above re-throws notFound errors so they propagate up to this\n * boundary. This must be placed above the ErrorBoundary in the component tree.\n */\nclass NotFoundBoundaryInner extends React.Component<\n NotFoundBoundaryInnerProps,\n NotFoundBoundaryState\n> {\n constructor(props: NotFoundBoundaryInnerProps) {\n super(props);\n this.state = { notFound: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: NotFoundBoundaryInnerProps,\n state: NotFoundBoundaryState,\n ): NotFoundBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.notFound && shouldResetBoundary(nextResetState, state)) {\n return { notFound: false, ...nextResetState };\n }\n return { notFound: state.notFound, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<NotFoundBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_NOT_FOUND\" || digest === \"NEXT_HTTP_ERROR_FALLBACK;404\") {\n return { notFound: true };\n }\n }\n // Not a notFound error — re-throw so it reaches an ErrorBoundary or propagates\n throw error;\n }\n\n render() {\n if (this.state.notFound) {\n return (\n <>\n <meta name=\"robots\" content=\"noindex\" />\n {this.props.fallback}\n </>\n );\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrapper that reads the current pathname and passes it to the inner class\n * component. Segment reset keys own App Router remount semantics when present.\n */\nexport function NotFoundBoundary({ fallback, children, resetKey }: NotFoundBoundaryProps) {\n const pathname = usePathname();\n return (\n <NotFoundBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </NotFoundBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// ForbiddenBoundary — catches forbidden() on the client and renders forbidden.tsx\n// ---------------------------------------------------------------------------\n\ntype ForbiddenBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype ForbiddenBoundaryInnerProps = {\n pathname: string;\n} & ForbiddenBoundaryProps;\n\ntype ForbiddenBoundaryState = {\n forbidden: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class ForbiddenBoundaryInner extends React.Component<\n ForbiddenBoundaryInnerProps,\n ForbiddenBoundaryState\n> {\n constructor(props: ForbiddenBoundaryInnerProps) {\n super(props);\n this.state = { forbidden: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ForbiddenBoundaryInnerProps,\n state: ForbiddenBoundaryState,\n ): ForbiddenBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.forbidden && shouldResetBoundary(nextResetState, state)) {\n return { forbidden: false, ...nextResetState };\n }\n return { forbidden: state.forbidden, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ForbiddenBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;403\") {\n return { forbidden: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.forbidden) {\n return (\n <>\n <meta name=\"robots\" content=\"noindex\" />\n {this.props.fallback}\n </>\n );\n }\n return this.props.children;\n }\n}\n\nexport function ForbiddenBoundary({ fallback, children, resetKey }: ForbiddenBoundaryProps) {\n const pathname = usePathname();\n return (\n <ForbiddenBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ForbiddenBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// UnauthorizedBoundary — catches unauthorized() on the client and renders unauthorized.tsx\n// ---------------------------------------------------------------------------\n\ntype UnauthorizedBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype UnauthorizedBoundaryInnerProps = {\n pathname: string;\n} & UnauthorizedBoundaryProps;\n\ntype UnauthorizedBoundaryState = {\n unauthorized: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class UnauthorizedBoundaryInner extends React.Component<\n UnauthorizedBoundaryInnerProps,\n UnauthorizedBoundaryState\n> {\n constructor(props: UnauthorizedBoundaryInnerProps) {\n super(props);\n this.state = { unauthorized: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: UnauthorizedBoundaryInnerProps,\n state: UnauthorizedBoundaryState,\n ): UnauthorizedBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.unauthorized && shouldResetBoundary(nextResetState, state)) {\n return { unauthorized: false, ...nextResetState };\n }\n return { unauthorized: state.unauthorized, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<UnauthorizedBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;401\") {\n return { unauthorized: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.unauthorized) {\n return (\n <>\n <meta name=\"robots\" content=\"noindex\" />\n {this.props.fallback}\n </>\n );\n }\n return this.props.children;\n }\n}\n\nexport function UnauthorizedBoundary({ fallback, children, resetKey }: UnauthorizedBoundaryProps) {\n const pathname = usePathname();\n return (\n <UnauthorizedBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </UnauthorizedBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// DevRecoveryBoundary — dev-only top-level boundary inside BrowserRoot.\n// Catches any render error that isn't already handled by a user-defined\n// error.tsx (or the access-fallback boundaries above), renders nothing, and\n// keeps BrowserRoot mounted so HMR can dispatch a new RSC payload without a\n// full page reload. Resets on resetKey change — the caller bumps that key\n// (e.g. via treeState.renderId) when a fresh tree is dispatched.\n//\n// Routing sentinels are re-thrown so notFound()/redirect()/forbidden()/\n// unauthorized() still reach their dedicated boundaries above.\n// ---------------------------------------------------------------------------\n\nexport type DevRecoveryBoundaryProps = {\n resetKey: number;\n // Called from componentDidCatch with the current resetKey so the host can\n // run any pending side effects that NavigationCommitSignal would normally\n // drive on commit — most importantly the URL update for the in-flight\n // soft-nav. Without this, a navigation that fails mid-render leaves the\n // browser on the previous URL even though the boundary recovered.\n //\n // The error itself is intentionally not passed: React's onCaughtError option\n // already routes the error to the dev overlay, so this callback is only for\n // commit-side effects keyed by resetKey.\n onCatch?: (resetKey: number) => void;\n // Children come through React.Component's PropsWithChildren default; declared\n // optional so callers can pass them positionally to createElement without\n // tripping the eslint no-children-prop rule.\n children?: React.ReactNode;\n};\n\ntype DevRecoveryBoundaryState = {\n error: CapturedError | null;\n previousResetKey: number;\n};\n\nexport class DevRecoveryBoundary extends React.Component<\n DevRecoveryBoundaryProps,\n DevRecoveryBoundaryState\n> {\n constructor(props: DevRecoveryBoundaryProps) {\n super(props);\n this.state = { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromProps(\n props: DevRecoveryBoundaryProps,\n state: DevRecoveryBoundaryState,\n ): DevRecoveryBoundaryState | null {\n if (props.resetKey === state.previousResetKey) {\n return null;\n }\n return { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<DevRecoveryBoundaryState> {\n // Re-throw routing sentinels so they still reach NotFoundBoundary /\n // RedirectBoundary / Forbidden / Unauthorized above.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n componentDidCatch(): void {\n this.props.onCatch?.(this.props.resetKey);\n }\n\n render() {\n if (this.state.error) {\n // Render nothing — the dev overlay (mounted in a separate React root)\n // shows the actual error to the developer. HMR pushing a new payload\n // bumps resetKey above, clearing this state and letting the children\n // re-render with the fixed code.\n return null;\n }\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;AA2CA,SAAS,0BAA0B,UAAoD;CACrF,OAAO,aAAa,KAAA,KAAa,aAAa,QAAQ,aAAa,KAAK,OAAO;;AAGjF,SAAS,uBAAuB,OAA+C;CAC7E,OAAO;EACL,kBAAkB,MAAM;EACxB,kBAAkB,0BAA0B,MAAM,SAAS;EAC5D;;AAGH,SAAS,oBACP,gBACA,oBACS;CACT,MAAM,eAAe,0BAA0B,eAAe,iBAAiB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KAAK,MAAM"}
|
package/dist/shims/error.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RouterContext } from "./internal/router-context.js";
|
|
1
2
|
import { appRouterInstance, isNextRouterError } from "./navigation.js";
|
|
2
3
|
import React from "react";
|
|
3
4
|
//#region src/shims/error.tsx
|
|
@@ -39,6 +40,7 @@ function ErrorComponent({ statusCode, title }) {
|
|
|
39
40
|
} }, displayTitle + "."))));
|
|
40
41
|
}
|
|
41
42
|
var _CatchError = class extends React.Component {
|
|
43
|
+
static contextType = RouterContext;
|
|
42
44
|
static displayName = "unstable_catchError(Next.CatchError)";
|
|
43
45
|
state = { error: null };
|
|
44
46
|
static getDerivedStateFromError(thrownValue) {
|
|
@@ -49,6 +51,7 @@ var _CatchError = class extends React.Component {
|
|
|
49
51
|
this.setState({ error: null });
|
|
50
52
|
};
|
|
51
53
|
unstable_retry = () => {
|
|
54
|
+
if (this.context !== null) throw new Error("`unstable_retry()` can only be used in the App Router. Use `reset()` in the Pages Router.");
|
|
52
55
|
if (typeof window === "undefined") throw new Error("`unstable_retry()` can only be used on the client. Call it from a user interaction handler inside the error fallback.");
|
|
53
56
|
React.startTransition(() => {
|
|
54
57
|
appRouterInstance.refresh();
|
package/dist/shims/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","names":[],"sources":["../../src/shims/error.tsx"],"sourcesContent":["/**\n * next/error shim\n *\n * Provides the default Next.js error page component.\n * Used by apps that import `import Error from 'next/error'` for\n * custom error handling in getServerSideProps or API routes.\n *\n * Also re-exports the unstable App Router error-boundary HOC\n * (`unstable_catchError`) and its `ErrorInfo` type, mirroring\n * `next/error`'s public surface.\n */\nimport React from \"react\";\nimport { appRouterInstance, isNextRouterError } from \"./navigation.js\";\n\ntype ErrorProps = {\n statusCode: number;\n title?: string;\n withDarkMode?: boolean;\n};\n\nfunction ErrorComponent({ statusCode, title }: ErrorProps): React.ReactElement {\n const defaultTitle =\n statusCode === 404 ? \"This page could not be found\" : \"Internal Server Error\";\n\n const displayTitle = title ?? defaultTitle;\n\n return React.createElement(\n \"div\",\n {\n style: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n height: \"100vh\",\n textAlign: \"center\" as const,\n display: \"flex\",\n flexDirection: \"column\" as const,\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n },\n React.createElement(\n \"div\",\n null,\n React.createElement(\n \"h1\",\n {\n style: {\n display: \"inline-block\",\n margin: \"0 20px 0 0\",\n padding: \"0 23px 0 0\",\n fontSize: 24,\n fontWeight: 500,\n verticalAlign: \"top\",\n lineHeight: \"49px\",\n borderRight: \"1px solid rgba(0, 0, 0, .3)\",\n },\n },\n statusCode,\n ),\n React.createElement(\n \"div\",\n { style: { display: \"inline-block\" } },\n React.createElement(\n \"h2\",\n {\n style: {\n fontSize: 14,\n fontWeight: 400,\n lineHeight: \"49px\",\n margin: 0,\n },\n },\n displayTitle + \".\",\n ),\n ),\n ),\n );\n}\n\nexport default ErrorComponent;\n\n// ---------------------------------------------------------------------------\n// unstable_catchError — App Router error-boundary HOC\n//\n// `unstable_catchError(fallback)` returns a Component that renders `children`\n// and, if the children throw, renders the user-supplied fallback with an\n// `ErrorInfo` object. Internal Next.js navigation signals (redirect /\n// notFound / forbidden / unauthorized) are rethrown so they reach the outer\n// framework boundaries.\n//\n// Ported from Next.js:\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/api/error.ts\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/api/error.react-server.ts\n//\n// Differences from Next.js:\n// - `unstable_retry()` matches Next.js's App Router behavior on the\n// client — it calls `appRouterInstance.refresh()` inside a\n// React.startTransition and then resets the boundary. On the server it\n// throws (consistent with React class components only running on the\n// server during SSR setup, where retry isn't meaningful). The\n// Pages-Router-only error message Next.js throws\n// (`unstable_retry()` can only be used in the App Router. Use\n// `reset()` in the Pages Router.) is not currently dispatched because\n// vinext's boundary doesn't read `PagesRouterContext`. Calling retry\n// under Pages Router will trigger an App Router refresh, which is a\n// no-op in that environment — the error remains visible until\n// `reset()` is called. Tracked as a parity follow-up.\n// - Bot-user-agent graceful-degradation, `handleHardNavError`, and\n// `handleISRError` are not yet supported. Errors always render the\n// fallback in non-bot contexts.\n// - The single implementation runs in both react-server and client\n// conditions. In Next.js, the react-server build exports a throwing stub\n// because the API is documented as client-only. Here we let module\n// evaluation succeed everywhere so `import { unstable_catchError } from\n// 'next/error'` does not break SSR-only bundles; misuse in a Server\n// Component still fails at render time because React class components\n// are unavailable in the react-server condition for this code path.\n// ---------------------------------------------------------------------------\n\nexport type ErrorInfo = {\n error: unknown;\n reset: () => void;\n unstable_retry: () => void;\n};\n\ntype _UserProps = Record<string, unknown>;\n\ntype _CatchErrorState = { thrownValue: unknown } | null;\n\nclass _CatchError<P extends _UserProps> extends React.Component<\n {\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode;\n forwardedProps: P;\n children?: React.ReactNode;\n },\n { error: _CatchErrorState }\n> {\n // Match Next.js's DevTools label so userland tooling/snapshots align.\n // https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n static displayName = \"unstable_catchError(Next.CatchError)\";\n\n state = { error: null as _CatchErrorState };\n\n static getDerivedStateFromError(thrownValue: unknown): { error: _CatchErrorState } {\n if (isNextRouterError(thrownValue)) {\n // Re-throw redirect/notFound/etc. so an outer framework boundary handles\n // them. Matches Next.js's CatchError.getDerivedStateFromError().\n throw thrownValue;\n }\n return { error: { thrownValue } };\n }\n\n reset = (): void => {\n this.setState({ error: null });\n };\n\n unstable_retry = (): void => {\n // Matches Next.js's App Router branch in\n // packages/next/src/client/components/catch-error.tsx — refresh the\n // current route, then clear the error so children re-render. Wrapped in\n // startTransition so the in-flight refresh and the reset commit\n // together (no flash of the children rendering with stale data).\n //\n // On the server, refresh is meaningless and `appRouterInstance.refresh`\n // is a no-op; throw a clear error so callers don't silently swallow a\n // retry attempt during SSR setup. Matches the spirit of Next.js's\n // server-side throw (which lives in error-boundary.tsx, not here).\n if (typeof window === \"undefined\") {\n throw new Error(\n \"`unstable_retry()` can only be used on the client. Call it from a user \" +\n \"interaction handler inside the error fallback.\",\n );\n }\n React.startTransition(() => {\n appRouterInstance.refresh();\n this.reset();\n });\n };\n\n render(): React.ReactNode {\n if (this.state.error) {\n const errorInfo: ErrorInfo = {\n error: this.state.error.thrownValue,\n reset: this.reset,\n unstable_retry: this.unstable_retry,\n };\n return this.props.fallback(this.props.forwardedProps, errorInfo);\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrap a fallback render function in a Component-level error boundary.\n * Returns a Component that renders `children` and, on error, renders the\n * supplied fallback with an `ErrorInfo` value.\n *\n * Ported from Next.js:\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n */\nexport function unstable_catchError<P extends _UserProps>(\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode,\n): React.ComponentType<P & { children?: React.ReactNode }> {\n // The inner class is generic in P, but createElement loses that generic at\n // the call site. Cast it to a non-generic constructor for the specific P\n // we close over here so TypeScript can pick the JSX-style createElement\n // overload without complaining about missing generic instantiation.\n const TypedCatchError = _CatchError as unknown as React.ComponentType<{\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode;\n forwardedProps: P;\n children?: React.ReactNode;\n }>;\n\n function CatchErrorBoundary(allProps: P & { children?: React.ReactNode }): React.ReactElement {\n const { children, ...rest } = allProps;\n const forwardedProps = rest as unknown as P;\n return React.createElement(\n TypedCatchError,\n { fallback, forwardedProps },\n children as React.ReactNode,\n );\n }\n CatchErrorBoundary.displayName = `unstable_catchError(${fallback.name || \"CatchErrorFallback\"})`;\n return CatchErrorBoundary;\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,SAAS,eAAe,EAAE,YAAY,SAAyC;CAI7E,MAAM,eAAe,UAFnB,eAAe,MAA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AC9B,MAAM,iBAAiB;EACvB,OAAO,MAAM,cACX,iBACA;GAAE;GAAU;GAAgB,EAC5B,SACD;;CAEH,mBAAmB,cAAc,uBAAuB,SAAS,QAAQ,qBAAqB;CAC9F,OAAO"}
|
|
1
|
+
{"version":3,"file":"error.js","names":[],"sources":["../../src/shims/error.tsx"],"sourcesContent":["/**\n * next/error shim\n *\n * Provides the default Next.js error page component.\n * Used by apps that import `import Error from 'next/error'` for\n * custom error handling in getServerSideProps or API routes.\n *\n * Also re-exports the unstable App Router error-boundary HOC\n * (`unstable_catchError`) and its `ErrorInfo` type, mirroring\n * `next/error`'s public surface.\n */\nimport React from \"react\";\nimport { appRouterInstance, isNextRouterError } from \"./navigation.js\";\nimport { RouterContext } from \"./internal/router-context.js\";\n\ntype ErrorProps = {\n statusCode: number;\n title?: string;\n withDarkMode?: boolean;\n};\n\nfunction ErrorComponent({ statusCode, title }: ErrorProps): React.ReactElement {\n const defaultTitle =\n statusCode === 404 ? \"This page could not be found\" : \"Internal Server Error\";\n\n const displayTitle = title ?? defaultTitle;\n\n return React.createElement(\n \"div\",\n {\n style: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n height: \"100vh\",\n textAlign: \"center\" as const,\n display: \"flex\",\n flexDirection: \"column\" as const,\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n },\n React.createElement(\n \"div\",\n null,\n React.createElement(\n \"h1\",\n {\n style: {\n display: \"inline-block\",\n margin: \"0 20px 0 0\",\n padding: \"0 23px 0 0\",\n fontSize: 24,\n fontWeight: 500,\n verticalAlign: \"top\",\n lineHeight: \"49px\",\n borderRight: \"1px solid rgba(0, 0, 0, .3)\",\n },\n },\n statusCode,\n ),\n React.createElement(\n \"div\",\n { style: { display: \"inline-block\" } },\n React.createElement(\n \"h2\",\n {\n style: {\n fontSize: 14,\n fontWeight: 400,\n lineHeight: \"49px\",\n margin: 0,\n },\n },\n displayTitle + \".\",\n ),\n ),\n ),\n );\n}\n\nexport default ErrorComponent;\n\n// ---------------------------------------------------------------------------\n// unstable_catchError — App Router error-boundary HOC\n//\n// `unstable_catchError(fallback)` returns a Component that renders `children`\n// and, if the children throw, renders the user-supplied fallback with an\n// `ErrorInfo` object. Internal Next.js navigation signals (redirect /\n// notFound / forbidden / unauthorized) are rethrown so they reach the outer\n// framework boundaries.\n//\n// Ported from Next.js:\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/api/error.ts\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/api/error.react-server.ts\n//\n// Differences from Next.js:\n// - `unstable_retry()` matches Next.js's App Router behavior on the\n// client — it calls `appRouterInstance.refresh()` inside a\n// React.startTransition and then resets the boundary. On the server it\n// throws (consistent with React class components only running on the\n// server during SSR setup, where retry isn't meaningful). When the\n// boundary is rendered under the Pages Router (detected via\n// `RouterContext` in the wrapper), `unstable_retry()` throws Next.js's\n// verbatim error message (`unstable_retry() can only be used in the\n// App Router. Use reset() in the Pages Router.`) — matching\n// `client/components/catch-error.tsx` in the Next.js source and the\n// `should throw when unstable_retry is called on Pages Router` test in\n// `test/e2e/app-dir/catch-error/catch-error.test.ts`.\n// - Bot-user-agent graceful-degradation, `handleHardNavError`, and\n// `handleISRError` are not yet supported. Errors always render the\n// fallback in non-bot contexts.\n// - The single implementation runs in both react-server and client\n// conditions. In Next.js, the react-server build exports a throwing stub\n// because the API is documented as client-only. Here we let module\n// evaluation succeed everywhere so `import { unstable_catchError } from\n// 'next/error'` does not break SSR-only bundles; misuse in a Server\n// Component still fails at render time because React class components\n// are unavailable in the react-server condition for this code path.\n// ---------------------------------------------------------------------------\n\nexport type ErrorInfo = {\n error: unknown;\n reset: () => void;\n unstable_retry: () => void;\n};\n\ntype _UserProps = Record<string, unknown>;\n\ntype _CatchErrorState = { thrownValue: unknown } | null;\n\nclass _CatchError<P extends _UserProps> extends React.Component<\n {\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode;\n forwardedProps: P;\n children?: React.ReactNode;\n },\n { error: _CatchErrorState }\n> {\n // Read the Pages Router context via class `contextType` (matching Next.js's\n // pattern in `client/components/catch-error.tsx` which uses\n // `static contextType = AppRouterContext`). When `this.context` is non-null\n // we're rendered under a Pages Router page; `unstable_retry()` then throws\n // the Next.js parity error message. Using `contextType` rather than\n // `useContext` in the wrapper keeps the wrapper a pure JSX factory so\n // existing introspection-style unit tests (which invoke the wrapper as a\n // bare function to extract the inner class) continue to work without\n // React's render lifecycle.\n static contextType = RouterContext;\n declare context: React.ContextType<typeof RouterContext>;\n\n // Match Next.js's DevTools label so userland tooling/snapshots align.\n // https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n static displayName = \"unstable_catchError(Next.CatchError)\";\n\n state = { error: null as _CatchErrorState };\n\n static getDerivedStateFromError(thrownValue: unknown): { error: _CatchErrorState } {\n if (isNextRouterError(thrownValue)) {\n // Re-throw redirect/notFound/etc. so an outer framework boundary handles\n // them. Matches Next.js's CatchError.getDerivedStateFromError().\n throw thrownValue;\n }\n return { error: { thrownValue } };\n }\n\n reset = (): void => {\n this.setState({ error: null });\n };\n\n unstable_retry = (): void => {\n // Pages Router has no segment-refresh primitive — Next.js documents\n // `unstable_retry` as App Router only and throws this exact message\n // from the boundary itself. Mirrors\n // packages/next/src/client/components/catch-error.tsx and is asserted\n // by `should throw when unstable_retry is called on Pages Router` in\n // test/e2e/app-dir/catch-error/catch-error.test.ts.\n //\n // `RouterContext` is populated for every page rendered by the vinext\n // Pages Router runtime (see `shims/router.ts` wrapWithRouterContext); a\n // non-null value here means we're under Pages Router. Under App Router\n // the context default is `null` and we fall through to the refresh\n // branch below.\n if (this.context !== null) {\n throw new Error(\n \"`unstable_retry()` can only be used in the App Router. Use `reset()` in the Pages Router.\",\n );\n }\n // Matches Next.js's App Router branch in\n // packages/next/src/client/components/catch-error.tsx — refresh the\n // current route, then clear the error so children re-render. Wrapped in\n // startTransition so the in-flight refresh and the reset commit\n // together (no flash of the children rendering with stale data).\n //\n // On the server, refresh is meaningless and `appRouterInstance.refresh`\n // is a no-op; throw a clear error so callers don't silently swallow a\n // retry attempt during SSR setup. Matches the spirit of Next.js's\n // server-side throw (which lives in error-boundary.tsx, not here).\n if (typeof window === \"undefined\") {\n throw new Error(\n \"`unstable_retry()` can only be used on the client. Call it from a user \" +\n \"interaction handler inside the error fallback.\",\n );\n }\n React.startTransition(() => {\n appRouterInstance.refresh();\n this.reset();\n });\n };\n\n render(): React.ReactNode {\n if (this.state.error) {\n const errorInfo: ErrorInfo = {\n error: this.state.error.thrownValue,\n reset: this.reset,\n unstable_retry: this.unstable_retry,\n };\n return this.props.fallback(this.props.forwardedProps, errorInfo);\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrap a fallback render function in a Component-level error boundary.\n * Returns a Component that renders `children` and, on error, renders the\n * supplied fallback with an `ErrorInfo` value.\n *\n * Ported from Next.js:\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n */\nexport function unstable_catchError<P extends _UserProps>(\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode,\n): React.ComponentType<P & { children?: React.ReactNode }> {\n // The inner class is generic in P, but createElement loses that generic at\n // the call site. Cast it to a non-generic constructor for the specific P\n // we close over here so TypeScript can pick the JSX-style createElement\n // overload without complaining about missing generic instantiation.\n const TypedCatchError = _CatchError as unknown as React.ComponentType<{\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode;\n forwardedProps: P;\n children?: React.ReactNode;\n }>;\n\n function CatchErrorBoundary(allProps: P & { children?: React.ReactNode }): React.ReactElement {\n const { children, ...rest } = allProps;\n const forwardedProps = rest as unknown as P;\n return React.createElement(\n TypedCatchError,\n { fallback, forwardedProps },\n children as React.ReactNode,\n );\n }\n CatchErrorBoundary.displayName = `unstable_catchError(${fallback.name || \"CatchErrorFallback\"})`;\n return CatchErrorBoundary;\n}\n"],"mappings":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AAgB,UAAU;;EAElE,OAAO,KAAK,MAAM;;;;;;;;;;;AAYtB,SAAgB,oBACd,UACyD;CAKzD,MAAM,kBAAkB;CAMxB,SAAS,mBAAmB,UAAkE;EAC5F,MAAM,EAAE,UAAU,GAAG,SAAS;EAC9B,MAAM,iBAAiB;EACvB,OAAO,MAAM,cACX,iBACA;GAAE;GAAU;GAAgB,EAC5B,SACD;;CAEH,mBAAmB,cAAc,uBAAuB,SAAS,QAAQ,qBAAqB;CAC9F,OAAO"}
|
|
@@ -36,6 +36,7 @@ declare global {
|
|
|
36
36
|
/** @internal Reset dedup state — exposed for test isolation only. */
|
|
37
37
|
declare function _resetPendingRefetches(): void;
|
|
38
38
|
type FetchCacheState = {
|
|
39
|
+
cacheableFetchUrls: Set<string>;
|
|
39
40
|
currentRequestTags: string[];
|
|
40
41
|
currentFetchSoftTags: string[];
|
|
41
42
|
currentFetchCacheMode: FetchCacheMode | null;
|
|
@@ -44,6 +45,7 @@ type FetchCacheState = {
|
|
|
44
45
|
currentFetchDedupeEntries: Map<string, FetchDedupeEntry[]>;
|
|
45
46
|
};
|
|
46
47
|
type FetchCacheMode = "auto" | "default-cache" | "default-no-store" | "force-cache" | "force-no-store" | "only-cache" | "only-no-store";
|
|
48
|
+
declare function peekCacheableFetchObservations(): string[];
|
|
47
49
|
declare function peekDynamicFetchObservations(): string[];
|
|
48
50
|
declare function consumeDynamicFetchObservations(): string[];
|
|
49
51
|
/**
|
|
@@ -108,5 +110,5 @@ declare function ensureFetchPatch(): void;
|
|
|
108
110
|
*/
|
|
109
111
|
declare function getOriginalFetch(): typeof globalThis.fetch;
|
|
110
112
|
//#endregion
|
|
111
|
-
export { FetchCacheMode, FetchCacheState, _resetPendingRefetches, consumeDynamicFetchObservations, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, peekDynamicFetchObservations, runWithFetchCache, runWithFetchDedupe, setCurrentFetchCacheMode, setCurrentFetchSoftTags, withFetchCache };
|
|
113
|
+
export { FetchCacheMode, FetchCacheState, _resetPendingRefetches, consumeDynamicFetchObservations, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, peekCacheableFetchObservations, peekDynamicFetchObservations, runWithFetchCache, runWithFetchDedupe, setCurrentFetchCacheMode, setCurrentFetchSoftTags, withFetchCache };
|
|
112
114
|
//# sourceMappingURL=fetch-cache.d.ts.map
|
|
@@ -288,6 +288,7 @@ if (globalThis.FinalizationRegistry) _responseBodyRegistry = new FinalizationReg
|
|
|
288
288
|
if (stream && !stream.locked) stream.cancel("Response object has been garbage collected").then(_noop, _noop);
|
|
289
289
|
});
|
|
290
290
|
const _fallbackState = _g[_FALLBACK_KEY] ??= {
|
|
291
|
+
cacheableFetchUrls: /* @__PURE__ */ new Set(),
|
|
291
292
|
currentRequestTags: [],
|
|
292
293
|
currentFetchSoftTags: [],
|
|
293
294
|
currentFetchCacheMode: null,
|
|
@@ -304,6 +305,7 @@ function _getState() {
|
|
|
304
305
|
* in single-threaded contexts where ALS.run() isn't used.
|
|
305
306
|
*/
|
|
306
307
|
function _resetFallbackState(isFetchDedupeActive) {
|
|
308
|
+
_fallbackState.cacheableFetchUrls = /* @__PURE__ */ new Set();
|
|
307
309
|
_fallbackState.currentRequestTags = [];
|
|
308
310
|
_fallbackState.currentFetchSoftTags = [];
|
|
309
311
|
_fallbackState.currentFetchCacheMode = null;
|
|
@@ -317,6 +319,12 @@ function getFetchObservationUrl(input) {
|
|
|
317
319
|
function recordDynamicFetchObservation(input) {
|
|
318
320
|
_getState().dynamicFetchUrls.add(getFetchObservationUrl(input));
|
|
319
321
|
}
|
|
322
|
+
function recordCacheableFetchObservation(input) {
|
|
323
|
+
_getState().cacheableFetchUrls.add(getFetchObservationUrl(input));
|
|
324
|
+
}
|
|
325
|
+
function peekCacheableFetchObservations() {
|
|
326
|
+
return [..._getState().cacheableFetchUrls].sort();
|
|
327
|
+
}
|
|
320
328
|
function peekDynamicFetchObservations() {
|
|
321
329
|
return [..._getState().dynamicFetchUrls].sort();
|
|
322
330
|
}
|
|
@@ -496,7 +504,12 @@ function createPatchedFetch() {
|
|
|
496
504
|
recordDynamicFetchObservation(input);
|
|
497
505
|
return dedupeFetch(input, cleanInit);
|
|
498
506
|
}
|
|
507
|
+
recordCacheableFetchObservation(input);
|
|
508
|
+
const reqTags = _getState().currentRequestTags;
|
|
499
509
|
const tags = encodeCacheTags(nextOpts?.tags ?? []);
|
|
510
|
+
if (tags.length > 0) {
|
|
511
|
+
for (const tag of tags) if (!reqTags.includes(tag)) reqTags.push(tag);
|
|
512
|
+
}
|
|
500
513
|
const softTags = _getState().currentFetchSoftTags;
|
|
501
514
|
let fetchInit = stripNextFromInit(init, cacheDirective);
|
|
502
515
|
let cacheKey;
|
|
@@ -512,10 +525,6 @@ function createPatchedFetch() {
|
|
|
512
525
|
throw err;
|
|
513
526
|
}
|
|
514
527
|
const handler = getCacheHandler();
|
|
515
|
-
const reqTags = _getState().currentRequestTags;
|
|
516
|
-
if (tags.length > 0) {
|
|
517
|
-
for (const tag of tags) if (!reqTags.includes(tag)) reqTags.push(tag);
|
|
518
|
-
}
|
|
519
528
|
try {
|
|
520
529
|
const cached = await handler.get(cacheKey, {
|
|
521
530
|
kind: "FETCH",
|
|
@@ -652,6 +661,7 @@ function withFetchCache() {
|
|
|
652
661
|
async function runWithFetchCache(fn) {
|
|
653
662
|
_ensurePatchInstalled();
|
|
654
663
|
if (isInsideUnifiedScope()) return await runWithUnifiedStateMutation((uCtx) => {
|
|
664
|
+
uCtx.cacheableFetchUrls = /* @__PURE__ */ new Set();
|
|
655
665
|
uCtx.currentRequestTags = [];
|
|
656
666
|
uCtx.currentFetchSoftTags = [];
|
|
657
667
|
uCtx.dynamicFetchUrls = /* @__PURE__ */ new Set();
|
|
@@ -659,6 +669,7 @@ async function runWithFetchCache(fn) {
|
|
|
659
669
|
uCtx.currentFetchDedupeEntries = /* @__PURE__ */ new Map();
|
|
660
670
|
}, fn);
|
|
661
671
|
return _als.run({
|
|
672
|
+
cacheableFetchUrls: /* @__PURE__ */ new Set(),
|
|
662
673
|
currentRequestTags: [],
|
|
663
674
|
currentFetchSoftTags: [],
|
|
664
675
|
currentFetchCacheMode: null,
|
|
@@ -700,6 +711,6 @@ function getOriginalFetch() {
|
|
|
700
711
|
return originalFetch;
|
|
701
712
|
}
|
|
702
713
|
//#endregion
|
|
703
|
-
export { _resetPendingRefetches, consumeDynamicFetchObservations, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, peekDynamicFetchObservations, runWithFetchCache, runWithFetchDedupe, setCurrentFetchCacheMode, setCurrentFetchSoftTags, withFetchCache };
|
|
714
|
+
export { _resetPendingRefetches, consumeDynamicFetchObservations, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, peekCacheableFetchObservations, peekDynamicFetchObservations, runWithFetchCache, runWithFetchDedupe, setCurrentFetchCacheMode, setCurrentFetchSoftTags, withFetchCache };
|
|
704
715
|
|
|
705
716
|
//# sourceMappingURL=fetch-cache.js.map
|