feat(wise-hearted-decor): initial luxury event decor website build with 5 pillars, portfolio, and booking funnel
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
export declare function addBasePath(path: string, required?: boolean): string;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "addBasePath", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return addBasePath;
|
||||
}
|
||||
});
|
||||
const _addpathprefix = require("../shared/lib/router/utils/add-path-prefix");
|
||||
const _normalizetrailingslash = require("./normalize-trailing-slash");
|
||||
const basePath = process.env.__NEXT_ROUTER_BASEPATH || '';
|
||||
function addBasePath(path, required) {
|
||||
return (0, _normalizetrailingslash.normalizePathTrailingSlash)(process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !required ? path : (0, _addpathprefix.addPathPrefix)(path, basePath));
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=add-base-path.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/add-base-path.ts"],"sourcesContent":["import { addPathPrefix } from '../shared/lib/router/utils/add-path-prefix'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function addBasePath(path: string, required?: boolean): string {\n return normalizePathTrailingSlash(\n process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !required\n ? path\n : addPathPrefix(path, basePath)\n )\n}\n"],"names":["addBasePath","basePath","process","env","__NEXT_ROUTER_BASEPATH","path","required","normalizePathTrailingSlash","__NEXT_MANUAL_CLIENT_BASE_PATH","addPathPrefix"],"mappings":";;;;+BAKgBA;;;eAAAA;;;+BALc;wCACa;AAE3C,MAAMC,WAAW,AAACC,QAAQC,GAAG,CAACC,sBAAsB,IAAe;AAE5D,SAASJ,YAAYK,IAAY,EAAEC,QAAkB;IAC1D,OAAOC,IAAAA,kDAA0B,EAC/BL,QAAQC,GAAG,CAACK,8BAA8B,IAAI,CAACF,WAC3CD,OACAI,IAAAA,4BAAa,EAACJ,MAAMJ;AAE5B"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import type { addLocale as Fn } from '../shared/lib/router/utils/add-locale';
|
||||
export declare const addLocale: typeof Fn;
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "addLocale", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return addLocale;
|
||||
}
|
||||
});
|
||||
const _normalizetrailingslash = require("./normalize-trailing-slash");
|
||||
const addLocale = function(path) {
|
||||
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
if (process.env.__NEXT_I18N_SUPPORT) {
|
||||
return (0, _normalizetrailingslash.normalizePathTrailingSlash)(require('../shared/lib/router/utils/add-locale').addLocale(path, ...args));
|
||||
}
|
||||
return path;
|
||||
};
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=add-locale.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/add-locale.ts"],"sourcesContent":["import type { addLocale as Fn } from '../shared/lib/router/utils/add-locale'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nexport const addLocale: typeof Fn = (path, ...args) => {\n if (process.env.__NEXT_I18N_SUPPORT) {\n return normalizePathTrailingSlash(\n require('../shared/lib/router/utils/add-locale').addLocale(path, ...args)\n )\n }\n return path\n}\n"],"names":["addLocale","path","args","process","env","__NEXT_I18N_SUPPORT","normalizePathTrailingSlash","require"],"mappings":";;;;+BAGaA;;;eAAAA;;;wCAF8B;AAEpC,MAAMA,YAAuB,SAACC;qCAASC;QAAAA;;IAC5C,IAAIC,QAAQC,GAAG,CAACC,mBAAmB,EAAE;QACnC,OAAOC,IAAAA,kDAA0B,EAC/BC,QAAQ,yCAAyCP,SAAS,CAACC,SAASC;IAExE;IACA,OAAOD;AACT"}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Before starting the Next.js runtime and requiring any module, we need to make
|
||||
* sure the following scripts are executed in the correct order:
|
||||
* - Polyfills
|
||||
* - next/script with `beforeInteractive` strategy
|
||||
*/
|
||||
export declare function appBootstrap(callback: () => void): void;
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Before starting the Next.js runtime and requiring any module, we need to make
|
||||
* sure the following scripts are executed in the correct order:
|
||||
* - Polyfills
|
||||
* - next/script with `beforeInteractive` strategy
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "appBootstrap", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return appBootstrap;
|
||||
}
|
||||
});
|
||||
const version = "15.1.0";
|
||||
window.next = {
|
||||
version,
|
||||
appDir: true
|
||||
};
|
||||
function loadScriptsInSequence(scripts, hydrate) {
|
||||
if (!scripts || !scripts.length) {
|
||||
return hydrate();
|
||||
}
|
||||
return scripts.reduce((promise, param)=>{
|
||||
let [src, props] = param;
|
||||
return promise.then(()=>{
|
||||
return new Promise((resolve, reject)=>{
|
||||
const el = document.createElement('script');
|
||||
if (props) {
|
||||
for(const key in props){
|
||||
if (key !== 'children') {
|
||||
el.setAttribute(key, props[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (src) {
|
||||
el.src = src;
|
||||
el.onload = ()=>resolve();
|
||||
el.onerror = reject;
|
||||
} else if (props) {
|
||||
el.innerHTML = props.children;
|
||||
setTimeout(resolve);
|
||||
}
|
||||
document.head.appendChild(el);
|
||||
});
|
||||
});
|
||||
}, Promise.resolve()).catch((err)=>{
|
||||
console.error(err);
|
||||
// Still try to hydrate even if there's an error.
|
||||
}).then(()=>{
|
||||
hydrate();
|
||||
});
|
||||
}
|
||||
function appBootstrap(callback) {
|
||||
loadScriptsInSequence(self.__next_s, ()=>{
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-bootstrap.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/app-bootstrap.ts"],"sourcesContent":["/**\n * Before starting the Next.js runtime and requiring any module, we need to make\n * sure the following scripts are executed in the correct order:\n * - Polyfills\n * - next/script with `beforeInteractive` strategy\n */\n\nconst version = process.env.__NEXT_VERSION\n\nwindow.next = {\n version,\n appDir: true,\n}\n\nfunction loadScriptsInSequence(\n scripts: [src: string, props: { [prop: string]: any }][],\n hydrate: () => void\n) {\n if (!scripts || !scripts.length) {\n return hydrate()\n }\n\n return scripts\n .reduce((promise, [src, props]) => {\n return promise.then(() => {\n return new Promise<void>((resolve, reject) => {\n const el = document.createElement('script')\n\n if (props) {\n for (const key in props) {\n if (key !== 'children') {\n el.setAttribute(key, props[key])\n }\n }\n }\n\n if (src) {\n el.src = src\n el.onload = () => resolve()\n el.onerror = reject\n } else if (props) {\n el.innerHTML = props.children\n setTimeout(resolve)\n }\n\n document.head.appendChild(el)\n })\n })\n }, Promise.resolve())\n .catch((err: Error) => {\n console.error(err)\n // Still try to hydrate even if there's an error.\n })\n .then(() => {\n hydrate()\n })\n}\n\nexport function appBootstrap(callback: () => void) {\n loadScriptsInSequence((self as any).__next_s, () => {\n callback()\n })\n}\n"],"names":["appBootstrap","version","process","env","__NEXT_VERSION","window","next","appDir","loadScriptsInSequence","scripts","hydrate","length","reduce","promise","src","props","then","Promise","resolve","reject","el","document","createElement","key","setAttribute","onload","onerror","innerHTML","children","setTimeout","head","appendChild","catch","err","console","error","callback","self","__next_s"],"mappings":"AAAA;;;;;CAKC;;;;+BAqDeA;;;eAAAA;;;AAnDhB,MAAMC,UAAUC,QAAQC,GAAG,CAACC,cAAc;AAE1CC,OAAOC,IAAI,GAAG;IACZL;IACAM,QAAQ;AACV;AAEA,SAASC,sBACPC,OAAwD,EACxDC,OAAmB;IAEnB,IAAI,CAACD,WAAW,CAACA,QAAQE,MAAM,EAAE;QAC/B,OAAOD;IACT;IAEA,OAAOD,QACJG,MAAM,CAAC,CAACC;YAAS,CAACC,KAAKC,MAAM;QAC5B,OAAOF,QAAQG,IAAI,CAAC;YAClB,OAAO,IAAIC,QAAc,CAACC,SAASC;gBACjC,MAAMC,KAAKC,SAASC,aAAa,CAAC;gBAElC,IAAIP,OAAO;oBACT,IAAK,MAAMQ,OAAOR,MAAO;wBACvB,IAAIQ,QAAQ,YAAY;4BACtBH,GAAGI,YAAY,CAACD,KAAKR,KAAK,CAACQ,IAAI;wBACjC;oBACF;gBACF;gBAEA,IAAIT,KAAK;oBACPM,GAAGN,GAAG,GAAGA;oBACTM,GAAGK,MAAM,GAAG,IAAMP;oBAClBE,GAAGM,OAAO,GAAGP;gBACf,OAAO,IAAIJ,OAAO;oBAChBK,GAAGO,SAAS,GAAGZ,MAAMa,QAAQ;oBAC7BC,WAAWX;gBACb;gBAEAG,SAASS,IAAI,CAACC,WAAW,CAACX;YAC5B;QACF;IACF,GAAGH,QAAQC,OAAO,IACjBc,KAAK,CAAC,CAACC;QACNC,QAAQC,KAAK,CAACF;IACd,iDAAiD;IACnD,GACCjB,IAAI,CAAC;QACJN;IACF;AACJ;AAEO,SAASV,aAAaoC,QAAoB;IAC/C5B,sBAAsB,AAAC6B,KAAaC,QAAQ,EAAE;QAC5CF;IACF;AACF"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export declare function setAppBuildId(buildId: string): void;
|
||||
export declare function getAppBuildId(): string;
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// This gets assigned as a side-effect during app initialization. Because it
|
||||
// represents the build used to create the JS bundle, it should never change
|
||||
// after being set, so we store it in a global variable.
|
||||
//
|
||||
// When performing RSC requests, if the incoming data has a different build ID,
|
||||
// we perform an MPA navigation/refresh to load the updated build and ensure
|
||||
// that the client and server in sync.
|
||||
// Starts as an empty string. In practice, because setAppBuildId is called
|
||||
// during initialization before hydration starts, this will always get
|
||||
// reassigned to the actual build ID before it's ever needed by a navigation.
|
||||
// If for some reasons it didn't, due to a bug or race condition, then on
|
||||
// navigation the build comparision would fail and trigger an MPA navigation.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getAppBuildId: null,
|
||||
setAppBuildId: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getAppBuildId: function() {
|
||||
return getAppBuildId;
|
||||
},
|
||||
setAppBuildId: function() {
|
||||
return setAppBuildId;
|
||||
}
|
||||
});
|
||||
let globalBuildId = '';
|
||||
function setAppBuildId(buildId) {
|
||||
globalBuildId = buildId;
|
||||
}
|
||||
function getAppBuildId() {
|
||||
return globalBuildId;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-build-id.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/app-build-id.ts"],"sourcesContent":["// This gets assigned as a side-effect during app initialization. Because it\n// represents the build used to create the JS bundle, it should never change\n// after being set, so we store it in a global variable.\n//\n// When performing RSC requests, if the incoming data has a different build ID,\n// we perform an MPA navigation/refresh to load the updated build and ensure\n// that the client and server in sync.\n\n// Starts as an empty string. In practice, because setAppBuildId is called\n// during initialization before hydration starts, this will always get\n// reassigned to the actual build ID before it's ever needed by a navigation.\n// If for some reasons it didn't, due to a bug or race condition, then on\n// navigation the build comparision would fail and trigger an MPA navigation.\nlet globalBuildId: string = ''\n\nexport function setAppBuildId(buildId: string) {\n globalBuildId = buildId\n}\n\nexport function getAppBuildId(): string {\n return globalBuildId\n}\n"],"names":["getAppBuildId","setAppBuildId","globalBuildId","buildId"],"mappings":"AAAA,4EAA4E;AAC5E,4EAA4E;AAC5E,wDAAwD;AACxD,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,sCAAsC;AAEtC,0EAA0E;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,yEAAyE;AACzE,6EAA6E;;;;;;;;;;;;;;;;IAO7DA,aAAa;eAAbA;;IAJAC,aAAa;eAAbA;;;AAFhB,IAAIC,gBAAwB;AAErB,SAASD,cAAcE,OAAe;IAC3CD,gBAAgBC;AAClB;AAEO,SAASH;IACd,OAAOE;AACT"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import { type ReducerActions } from './components/router-reducer/router-reducer-types';
|
||||
export declare function useServerActionDispatcher(dispatch: React.Dispatch<ReducerActions>): void;
|
||||
export declare function callServer(actionId: string, actionArgs: any[]): Promise<unknown>;
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
callServer: null,
|
||||
useServerActionDispatcher: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
callServer: function() {
|
||||
return callServer;
|
||||
},
|
||||
useServerActionDispatcher: function() {
|
||||
return useServerActionDispatcher;
|
||||
}
|
||||
});
|
||||
const _react = require("react");
|
||||
const _routerreducertypes = require("./components/router-reducer/router-reducer-types");
|
||||
let globalServerActionDispatcher = null;
|
||||
function useServerActionDispatcher(dispatch) {
|
||||
const serverActionDispatcher = (0, _react.useCallback)((actionPayload)=>{
|
||||
(0, _react.startTransition)(()=>{
|
||||
dispatch({
|
||||
...actionPayload,
|
||||
type: _routerreducertypes.ACTION_SERVER_ACTION
|
||||
});
|
||||
});
|
||||
}, [
|
||||
dispatch
|
||||
]);
|
||||
globalServerActionDispatcher = serverActionDispatcher;
|
||||
}
|
||||
async function callServer(actionId, actionArgs) {
|
||||
const actionDispatcher = globalServerActionDispatcher;
|
||||
if (!actionDispatcher) {
|
||||
throw new Error('Invariant: missing action dispatcher.');
|
||||
}
|
||||
return new Promise((resolve, reject)=>{
|
||||
actionDispatcher({
|
||||
actionId,
|
||||
actionArgs,
|
||||
resolve,
|
||||
reject
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-call-server.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/app-call-server.ts"],"sourcesContent":["import { startTransition, useCallback } from 'react'\nimport {\n ACTION_SERVER_ACTION,\n type ReducerActions,\n type ServerActionDispatcher,\n} from './components/router-reducer/router-reducer-types'\n\nlet globalServerActionDispatcher = null as ServerActionDispatcher | null\n\nexport function useServerActionDispatcher(\n dispatch: React.Dispatch<ReducerActions>\n) {\n const serverActionDispatcher: ServerActionDispatcher = useCallback(\n (actionPayload) => {\n startTransition(() => {\n dispatch({\n ...actionPayload,\n type: ACTION_SERVER_ACTION,\n })\n })\n },\n [dispatch]\n )\n globalServerActionDispatcher = serverActionDispatcher\n}\n\nexport async function callServer(actionId: string, actionArgs: any[]) {\n const actionDispatcher = globalServerActionDispatcher\n\n if (!actionDispatcher) {\n throw new Error('Invariant: missing action dispatcher.')\n }\n\n return new Promise((resolve, reject) => {\n actionDispatcher({\n actionId,\n actionArgs,\n resolve,\n reject,\n })\n })\n}\n"],"names":["callServer","useServerActionDispatcher","globalServerActionDispatcher","dispatch","serverActionDispatcher","useCallback","actionPayload","startTransition","type","ACTION_SERVER_ACTION","actionId","actionArgs","actionDispatcher","Error","Promise","resolve","reject"],"mappings":";;;;;;;;;;;;;;;IA0BsBA,UAAU;eAAVA;;IAjBNC,yBAAyB;eAAzBA;;;uBAT6B;oCAKtC;AAEP,IAAIC,+BAA+B;AAE5B,SAASD,0BACdE,QAAwC;IAExC,MAAMC,yBAAiDC,IAAAA,kBAAW,EAChE,CAACC;QACCC,IAAAA,sBAAe,EAAC;YACdJ,SAAS;gBACP,GAAGG,aAAa;gBAChBE,MAAMC,wCAAoB;YAC5B;QACF;IACF,GACA;QAACN;KAAS;IAEZD,+BAA+BE;AACjC;AAEO,eAAeJ,WAAWU,QAAgB,EAAEC,UAAiB;IAClE,MAAMC,mBAAmBV;IAEzB,IAAI,CAACU,kBAAkB;QACrB,MAAM,IAAIC,MAAM;IAClB;IAEA,OAAO,IAAIC,QAAQ,CAACC,SAASC;QAC3BJ,iBAAiB;YACfF;YACAC;YACAI;YACAC;QACF;IACF;AACF"}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
import React from 'react';
|
||||
import type { UrlObject } from 'url';
|
||||
type Url = string | UrlObject;
|
||||
type InternalLinkProps = {
|
||||
/**
|
||||
* The path or URL to navigate to. It can also be an object.
|
||||
*
|
||||
* @example https://nextjs.org/docs/api-reference/next/link#with-url-object
|
||||
*/
|
||||
href: Url;
|
||||
/**
|
||||
* Optional decorator for the path that will be shown in the browser URL bar. Before Next.js 9.5.3 this was used for dynamic routes, check our [previous docs](https://github.com/vercel/next.js/blob/v9.5.2/docs/api-reference/next/link.md#dynamic-routes) to see how it worked. Note: when this path differs from the one provided in `href` the previous `href`/`as` behavior is used as shown in the [previous docs](https://github.com/vercel/next.js/blob/v9.5.2/docs/api-reference/next/link.md#dynamic-routes).
|
||||
*/
|
||||
as?: Url;
|
||||
/**
|
||||
* Replace the current `history` state instead of adding a new url into the stack.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
replace?: boolean;
|
||||
/**
|
||||
* Whether to override the default scroll behavior
|
||||
*
|
||||
* @example https://nextjs.org/docs/api-reference/next/link#disable-scrolling-to-the-top-of-the-page
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
scroll?: boolean;
|
||||
/**
|
||||
* Update the path of the current page without rerunning [`getStaticProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-props), [`getServerSideProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props) or [`getInitialProps`](/docs/pages/api-reference/functions/get-initial-props).
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Forces `Link` to send the `href` property to its child.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
passHref?: boolean;
|
||||
/**
|
||||
* Prefetch the page in the background.
|
||||
* Any `<Link />` that is in the viewport (initially or through scroll) will be prefetched.
|
||||
* Prefetch can be disabled by passing `prefetch={false}`. Prefetching is only enabled in production.
|
||||
*
|
||||
* In App Router:
|
||||
* - `null` (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.
|
||||
* - `true`: This will prefetch the full React Server Component data for all route segments, regardless of whether they contain a segment with `loading.js`.
|
||||
* - `false`: This will not prefetch any data, even on hover.
|
||||
*
|
||||
* In Pages Router:
|
||||
* - `true` (default): The full route & its data will be prefetched.
|
||||
* - `false`: Prefetching will not happen when entering the viewport, but will still happen on hover.
|
||||
* @defaultValue `true` (pages router) or `null` (app router)
|
||||
*/
|
||||
prefetch?: boolean | null;
|
||||
/**
|
||||
* The active locale is automatically prepended. `locale` allows for providing a different locale.
|
||||
* When `false` `href` has to include the locale as the default behavior is disabled.
|
||||
* Note: This is only available in the Pages Router.
|
||||
*/
|
||||
locale?: string | false;
|
||||
/**
|
||||
* Enable legacy link behavior.
|
||||
* @defaultValue `false`
|
||||
* @see https://github.com/vercel/next.js/commit/489e65ed98544e69b0afd7e0cfc3f9f6c2b803b7
|
||||
*/
|
||||
legacyBehavior?: boolean;
|
||||
/**
|
||||
* Optional event handler for when the mouse pointer is moved onto Link
|
||||
*/
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
||||
/**
|
||||
* Optional event handler for when Link is touched.
|
||||
*/
|
||||
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
||||
/**
|
||||
* Optional event handler for when Link is clicked.
|
||||
*/
|
||||
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
||||
};
|
||||
export type LinkProps<RouteInferType = any> = InternalLinkProps;
|
||||
/**
|
||||
* A React component that extends the HTML `<a>` element to provide [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)
|
||||
* and client-side navigation between routes.
|
||||
*
|
||||
* It is the primary way to navigate between routes in Next.js.
|
||||
*
|
||||
* Read more: [Next.js docs: `<Link>`](https://nextjs.org/docs/app/api-reference/components/link)
|
||||
*/
|
||||
declare const Link: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof InternalLinkProps> & InternalLinkProps & {
|
||||
children?: React.ReactNode | undefined;
|
||||
} & React.RefAttributes<HTMLAnchorElement>>;
|
||||
export default Link;
|
||||
+357
@@ -0,0 +1,357 @@
|
||||
'use client';
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _default;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
|
||||
const _formaturl = require("../../shared/lib/router/utils/format-url");
|
||||
const _approutercontextsharedruntime = require("../../shared/lib/app-router-context.shared-runtime");
|
||||
const _useintersection = require("../use-intersection");
|
||||
const _routerreducertypes = require("../components/router-reducer/router-reducer-types");
|
||||
const _usemergedref = require("../use-merged-ref");
|
||||
const _utils = require("../../shared/lib/utils");
|
||||
const _addbasepath = require("../add-base-path");
|
||||
const _warnonce = require("../../shared/lib/utils/warn-once");
|
||||
function prefetch(router, href, options) {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
const doPrefetch = async ()=>{
|
||||
// note that `appRouter.prefetch()` is currently sync,
|
||||
// so we have to wrap this call in an async function to be able to catch() errors below.
|
||||
return router.prefetch(href, options);
|
||||
};
|
||||
// Prefetch the page if asked (only in the client)
|
||||
// We need to handle a prefetch error here since we may be
|
||||
// loading with priority which can reject but we don't
|
||||
// want to force navigation since this is only a prefetch
|
||||
doPrefetch().catch((err)=>{
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// rethrow to show invalid URL errors
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
}
|
||||
function isModifiedEvent(event) {
|
||||
const eventTarget = event.currentTarget;
|
||||
const target = eventTarget.getAttribute('target');
|
||||
return target && target !== '_self' || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || // triggers resource download
|
||||
event.nativeEvent && event.nativeEvent.which === 2;
|
||||
}
|
||||
function linkClicked(e, router, href, as, replace, shallow, scroll) {
|
||||
const { nodeName } = e.currentTarget;
|
||||
// anchors inside an svg have a lowercase nodeName
|
||||
const isAnchorNodeName = nodeName.toUpperCase() === 'A';
|
||||
if (isAnchorNodeName && isModifiedEvent(e)) {
|
||||
// ignore click for browser’s default behavior
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
const navigate = ()=>{
|
||||
// If the router is an NextRouter instance it will have `beforePopState`
|
||||
const routerScroll = scroll != null ? scroll : true;
|
||||
if ('beforePopState' in router) {
|
||||
router[replace ? 'replace' : 'push'](href, as, {
|
||||
shallow,
|
||||
scroll: routerScroll
|
||||
});
|
||||
} else {
|
||||
router[replace ? 'replace' : 'push'](as || href, {
|
||||
scroll: routerScroll
|
||||
});
|
||||
}
|
||||
};
|
||||
_react.default.startTransition(navigate);
|
||||
}
|
||||
function formatStringOrUrl(urlObjOrString) {
|
||||
if (typeof urlObjOrString === 'string') {
|
||||
return urlObjOrString;
|
||||
}
|
||||
return (0, _formaturl.formatUrl)(urlObjOrString);
|
||||
}
|
||||
/**
|
||||
* A React component that extends the HTML `<a>` element to provide [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)
|
||||
* and client-side navigation between routes.
|
||||
*
|
||||
* It is the primary way to navigate between routes in Next.js.
|
||||
*
|
||||
* Read more: [Next.js docs: `<Link>`](https://nextjs.org/docs/app/api-reference/components/link)
|
||||
*/ const Link = /*#__PURE__*/ _react.default.forwardRef(function LinkComponent(props, forwardedRef) {
|
||||
let children;
|
||||
const { href: hrefProp, as: asProp, children: childrenProp, prefetch: prefetchProp = null, passHref, replace, shallow, scroll, onClick, onMouseEnter: onMouseEnterProp, onTouchStart: onTouchStartProp, legacyBehavior = false, ...restProps } = props;
|
||||
children = childrenProp;
|
||||
if (legacyBehavior && (typeof children === 'string' || typeof children === 'number')) {
|
||||
children = /*#__PURE__*/ (0, _jsxruntime.jsx)("a", {
|
||||
children: children
|
||||
});
|
||||
}
|
||||
const router = _react.default.useContext(_approutercontextsharedruntime.AppRouterContext);
|
||||
const prefetchEnabled = prefetchProp !== false;
|
||||
/**
|
||||
* The possible states for prefetch are:
|
||||
* - null: this is the default "auto" mode, where we will prefetch partially if the link is in the viewport
|
||||
* - true: we will prefetch if the link is visible and prefetch the full page, not just partially
|
||||
* - false: we will not prefetch if in the viewport at all
|
||||
*/ const appPrefetchKind = prefetchProp === null ? _routerreducertypes.PrefetchKind.AUTO : _routerreducertypes.PrefetchKind.FULL;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
function createPropError(args) {
|
||||
return new Error("Failed prop type: The prop `" + args.key + "` expects a " + args.expected + " in `<Link>`, but got `" + args.actual + "` instead." + (typeof window !== 'undefined' ? "\nOpen your browser's console to view the Component stack trace." : ''));
|
||||
}
|
||||
// TypeScript trick for type-guarding:
|
||||
const requiredPropsGuard = {
|
||||
href: true
|
||||
};
|
||||
const requiredProps = Object.keys(requiredPropsGuard);
|
||||
requiredProps.forEach((key)=>{
|
||||
if (key === 'href') {
|
||||
if (props[key] == null || typeof props[key] !== 'string' && typeof props[key] !== 'object') {
|
||||
throw createPropError({
|
||||
key,
|
||||
expected: '`string` or `object`',
|
||||
actual: props[key] === null ? 'null' : typeof props[key]
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// TypeScript trick for type-guarding:
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const _ = key;
|
||||
}
|
||||
});
|
||||
// TypeScript trick for type-guarding:
|
||||
const optionalPropsGuard = {
|
||||
as: true,
|
||||
replace: true,
|
||||
scroll: true,
|
||||
shallow: true,
|
||||
passHref: true,
|
||||
prefetch: true,
|
||||
onClick: true,
|
||||
onMouseEnter: true,
|
||||
onTouchStart: true,
|
||||
legacyBehavior: true
|
||||
};
|
||||
const optionalProps = Object.keys(optionalPropsGuard);
|
||||
optionalProps.forEach((key)=>{
|
||||
const valType = typeof props[key];
|
||||
if (key === 'as') {
|
||||
if (props[key] && valType !== 'string' && valType !== 'object') {
|
||||
throw createPropError({
|
||||
key,
|
||||
expected: '`string` or `object`',
|
||||
actual: valType
|
||||
});
|
||||
}
|
||||
} else if (key === 'onClick' || key === 'onMouseEnter' || key === 'onTouchStart') {
|
||||
if (props[key] && valType !== 'function') {
|
||||
throw createPropError({
|
||||
key,
|
||||
expected: '`function`',
|
||||
actual: valType
|
||||
});
|
||||
}
|
||||
} else if (key === 'replace' || key === 'scroll' || key === 'shallow' || key === 'passHref' || key === 'prefetch' || key === 'legacyBehavior') {
|
||||
if (props[key] != null && valType !== 'boolean') {
|
||||
throw createPropError({
|
||||
key,
|
||||
expected: '`boolean`',
|
||||
actual: valType
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// TypeScript trick for type-guarding:
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const _ = key;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (props.locale) {
|
||||
(0, _warnonce.warnOnce)('The `locale` prop is not supported in `next/link` while using the `app` router. Read more about app router internalization: https://nextjs.org/docs/app/building-your-application/routing/internationalization');
|
||||
}
|
||||
if (!asProp) {
|
||||
let href;
|
||||
if (typeof hrefProp === 'string') {
|
||||
href = hrefProp;
|
||||
} else if (typeof hrefProp === 'object' && typeof hrefProp.pathname === 'string') {
|
||||
href = hrefProp.pathname;
|
||||
}
|
||||
if (href) {
|
||||
const hasDynamicSegment = href.split('/').some((segment)=>segment.startsWith('[') && segment.endsWith(']'));
|
||||
if (hasDynamicSegment) {
|
||||
throw new Error("Dynamic href `" + href + "` found in <Link> while using the `/app` router, this is not supported. Read more: https://nextjs.org/docs/messages/app-dir-dynamic-href");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const { href, as } = _react.default.useMemo(()=>{
|
||||
const resolvedHref = formatStringOrUrl(hrefProp);
|
||||
return {
|
||||
href: resolvedHref,
|
||||
as: asProp ? formatStringOrUrl(asProp) : resolvedHref
|
||||
};
|
||||
}, [
|
||||
hrefProp,
|
||||
asProp
|
||||
]);
|
||||
const previousHref = _react.default.useRef(href);
|
||||
const previousAs = _react.default.useRef(as);
|
||||
// This will return the first child, if multiple are provided it will throw an error
|
||||
let child;
|
||||
if (legacyBehavior) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (onClick) {
|
||||
console.warn('"onClick" was passed to <Link> with `href` of `' + hrefProp + '` but "legacyBehavior" was set. The legacy behavior requires onClick be set on the child of next/link');
|
||||
}
|
||||
if (onMouseEnterProp) {
|
||||
console.warn('"onMouseEnter" was passed to <Link> with `href` of `' + hrefProp + '` but "legacyBehavior" was set. The legacy behavior requires onMouseEnter be set on the child of next/link');
|
||||
}
|
||||
try {
|
||||
child = _react.default.Children.only(children);
|
||||
} catch (err) {
|
||||
if (!children) {
|
||||
throw new Error("No children were passed to <Link> with `href` of `" + hrefProp + "` but one child is required https://nextjs.org/docs/messages/link-no-children");
|
||||
}
|
||||
throw new Error("Multiple children were passed to <Link> with `href` of `" + hrefProp + "` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children" + (typeof window !== 'undefined' ? " \nOpen your browser's console to view the Component stack trace." : ''));
|
||||
}
|
||||
} else {
|
||||
child = _react.default.Children.only(children);
|
||||
}
|
||||
} else {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if ((children == null ? void 0 : children.type) === 'a') {
|
||||
throw new Error('Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor');
|
||||
}
|
||||
}
|
||||
}
|
||||
const childRef = legacyBehavior ? child && typeof child === 'object' && child.ref : forwardedRef;
|
||||
const [setIntersectionRef, isVisible, resetVisible] = (0, _useintersection.useIntersection)({
|
||||
rootMargin: '200px'
|
||||
});
|
||||
const setIntersectionWithResetRef = _react.default.useCallback((el)=>{
|
||||
// Before the link getting observed, check if visible state need to be reset
|
||||
if (previousAs.current !== as || previousHref.current !== href) {
|
||||
resetVisible();
|
||||
previousAs.current = as;
|
||||
previousHref.current = href;
|
||||
}
|
||||
setIntersectionRef(el);
|
||||
}, [
|
||||
as,
|
||||
href,
|
||||
resetVisible,
|
||||
setIntersectionRef
|
||||
]);
|
||||
const setRef = (0, _usemergedref.useMergedRef)(setIntersectionWithResetRef, childRef);
|
||||
// Prefetch the URL if we haven't already and it's visible.
|
||||
_react.default.useEffect(()=>{
|
||||
// in dev, we only prefetch on hover to avoid wasting resources as the prefetch will trigger compiling the page.
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return;
|
||||
}
|
||||
if (!router) {
|
||||
return;
|
||||
}
|
||||
// If we don't need to prefetch the URL, don't do prefetch.
|
||||
if (!isVisible || !prefetchEnabled) {
|
||||
return;
|
||||
}
|
||||
// Prefetch the URL.
|
||||
prefetch(router, href, {
|
||||
kind: appPrefetchKind
|
||||
});
|
||||
}, [
|
||||
as,
|
||||
href,
|
||||
isVisible,
|
||||
prefetchEnabled,
|
||||
router,
|
||||
appPrefetchKind
|
||||
]);
|
||||
const childProps = {
|
||||
ref: setRef,
|
||||
onClick (e) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!e) {
|
||||
throw new Error('Component rendered inside next/link has to pass click event to "onClick" prop.');
|
||||
}
|
||||
}
|
||||
if (!legacyBehavior && typeof onClick === 'function') {
|
||||
onClick(e);
|
||||
}
|
||||
if (legacyBehavior && child.props && typeof child.props.onClick === 'function') {
|
||||
child.props.onClick(e);
|
||||
}
|
||||
if (!router) {
|
||||
return;
|
||||
}
|
||||
if (e.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
linkClicked(e, router, href, as, replace, shallow, scroll);
|
||||
},
|
||||
onMouseEnter (e) {
|
||||
if (!legacyBehavior && typeof onMouseEnterProp === 'function') {
|
||||
onMouseEnterProp(e);
|
||||
}
|
||||
if (legacyBehavior && child.props && typeof child.props.onMouseEnter === 'function') {
|
||||
child.props.onMouseEnter(e);
|
||||
}
|
||||
if (!router) {
|
||||
return;
|
||||
}
|
||||
if (!prefetchEnabled || process.env.NODE_ENV === 'development') {
|
||||
return;
|
||||
}
|
||||
prefetch(router, href, {
|
||||
kind: appPrefetchKind
|
||||
});
|
||||
},
|
||||
onTouchStart: process.env.__NEXT_LINK_NO_TOUCH_START ? undefined : function onTouchStart(e) {
|
||||
if (!legacyBehavior && typeof onTouchStartProp === 'function') {
|
||||
onTouchStartProp(e);
|
||||
}
|
||||
if (legacyBehavior && child.props && typeof child.props.onTouchStart === 'function') {
|
||||
child.props.onTouchStart(e);
|
||||
}
|
||||
if (!router) {
|
||||
return;
|
||||
}
|
||||
if (!prefetchEnabled) {
|
||||
return;
|
||||
}
|
||||
prefetch(router, href, {
|
||||
kind: appPrefetchKind
|
||||
});
|
||||
}
|
||||
};
|
||||
// If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is
|
||||
// defined, we specify the current 'href', so that repetition is not needed by the user.
|
||||
// If the url is absolute, we can bypass the logic to prepend the basePath.
|
||||
if ((0, _utils.isAbsoluteUrl)(as)) {
|
||||
childProps.href = as;
|
||||
} else if (!legacyBehavior || passHref || child.type === 'a' && !('href' in child.props)) {
|
||||
childProps.href = (0, _addbasepath.addBasePath)(as);
|
||||
}
|
||||
return legacyBehavior ? /*#__PURE__*/ _react.default.cloneElement(child, childProps) : /*#__PURE__*/ (0, _jsxruntime.jsx)("a", {
|
||||
...restProps,
|
||||
...childProps,
|
||||
children: children
|
||||
});
|
||||
});
|
||||
const _default = Link;
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=link.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
export declare const findSourceMapURL: ((filename: string) => string | null) | undefined;
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "findSourceMapURL", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return findSourceMapURL;
|
||||
}
|
||||
});
|
||||
const basePath = process.env.__NEXT_ROUTER_BASEPATH || '';
|
||||
const pathname = "" + basePath + "/__nextjs_source-map";
|
||||
const findSourceMapURL = process.env.NODE_ENV === 'development' ? function findSourceMapURL(filename) {
|
||||
if (filename === '') {
|
||||
return null;
|
||||
}
|
||||
if (filename.startsWith(document.location.origin) && filename.includes('/_next/static')) {
|
||||
// This is a request for a client chunk. This can only happen when
|
||||
// using Turbopack. In this case, since we control how those source
|
||||
// maps are generated, we can safely assume that the sourceMappingURL
|
||||
// is relative to the filename, with an added `.map` extension. The
|
||||
// browser can just request this file, and it gets served through the
|
||||
// normal dev server, without the need to route this through
|
||||
// the `/__nextjs_source-map` dev middleware.
|
||||
return "" + filename + ".map";
|
||||
}
|
||||
const url = new URL(pathname, document.location.origin);
|
||||
url.searchParams.set('filename', filename);
|
||||
return url.href;
|
||||
} : undefined;
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-find-source-map-url.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/app-find-source-map-url.ts"],"sourcesContent":["const basePath = process.env.__NEXT_ROUTER_BASEPATH || ''\nconst pathname = `${basePath}/__nextjs_source-map`\n\nexport const findSourceMapURL =\n process.env.NODE_ENV === 'development'\n ? function findSourceMapURL(filename: string): string | null {\n if (filename === '') {\n return null\n }\n\n if (\n filename.startsWith(document.location.origin) &&\n filename.includes('/_next/static')\n ) {\n // This is a request for a client chunk. This can only happen when\n // using Turbopack. In this case, since we control how those source\n // maps are generated, we can safely assume that the sourceMappingURL\n // is relative to the filename, with an added `.map` extension. The\n // browser can just request this file, and it gets served through the\n // normal dev server, without the need to route this through\n // the `/__nextjs_source-map` dev middleware.\n return `${filename}.map`\n }\n\n const url = new URL(pathname, document.location.origin)\n url.searchParams.set('filename', filename)\n\n return url.href\n }\n : undefined\n"],"names":["findSourceMapURL","basePath","process","env","__NEXT_ROUTER_BASEPATH","pathname","NODE_ENV","filename","startsWith","document","location","origin","includes","url","URL","searchParams","set","href","undefined"],"mappings":";;;;+BAGaA;;;eAAAA;;;AAHb,MAAMC,WAAWC,QAAQC,GAAG,CAACC,sBAAsB,IAAI;AACvD,MAAMC,WAAW,AAAC,KAAEJ,WAAS;AAEtB,MAAMD,mBACXE,QAAQC,GAAG,CAACG,QAAQ,KAAK,gBACrB,SAASN,iBAAiBO,QAAgB;IACxC,IAAIA,aAAa,IAAI;QACnB,OAAO;IACT;IAEA,IACEA,SAASC,UAAU,CAACC,SAASC,QAAQ,CAACC,MAAM,KAC5CJ,SAASK,QAAQ,CAAC,kBAClB;QACA,kEAAkE;QAClE,mEAAmE;QACnE,qEAAqE;QACrE,mEAAmE;QACnE,qEAAqE;QACrE,4DAA4D;QAC5D,6CAA6C;QAC7C,OAAO,AAAC,KAAEL,WAAS;IACrB;IAEA,MAAMM,MAAM,IAAIC,IAAIT,UAAUI,SAASC,QAAQ,CAACC,MAAM;IACtDE,IAAIE,YAAY,CAACC,GAAG,CAAC,YAAYT;IAEjC,OAAOM,IAAII,IAAI;AACjB,IACAC"}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import '../build/polyfills/polyfill-module';
|
||||
import './components/globals/patch-console';
|
||||
import './components/globals/handle-global-errors';
|
||||
export declare function hydrate(): void;
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
// imports polyfill from `@next/polyfill-module` after build.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "hydrate", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return hydrate;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
require("../build/polyfills/polyfill-module");
|
||||
require("./components/globals/patch-console");
|
||||
require("./components/globals/handle-global-errors");
|
||||
const _client = /*#__PURE__*/ _interop_require_default._(require("react-dom/client"));
|
||||
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
||||
const _client1 = require("react-server-dom-webpack/client");
|
||||
const _headmanagercontextsharedruntime = require("../shared/lib/head-manager-context.shared-runtime");
|
||||
const _shared = require("./react-client-callbacks/shared");
|
||||
const _approuter = require("./react-client-callbacks/app-router");
|
||||
const _appcallserver = require("./app-call-server");
|
||||
const _appfindsourcemapurl = require("./app-find-source-map-url");
|
||||
const _actionqueue = require("../shared/lib/router/action-queue");
|
||||
const _approuter1 = /*#__PURE__*/ _interop_require_default._(require("./components/app-router"));
|
||||
const _createinitialrouterstate = require("./components/router-reducer/create-initial-router-state");
|
||||
const _approutercontextsharedruntime = require("../shared/lib/app-router-context.shared-runtime");
|
||||
const _appbuildid = require("./app-build-id");
|
||||
/// <reference types="react-dom/experimental" />
|
||||
const appElement = document;
|
||||
const encoder = new TextEncoder();
|
||||
let initialServerDataBuffer = undefined;
|
||||
let initialServerDataWriter = undefined;
|
||||
let initialServerDataLoaded = false;
|
||||
let initialServerDataFlushed = false;
|
||||
let initialFormStateData = null;
|
||||
function nextServerDataCallback(seg) {
|
||||
if (seg[0] === 0) {
|
||||
initialServerDataBuffer = [];
|
||||
} else if (seg[0] === 1) {
|
||||
if (!initialServerDataBuffer) throw new Error('Unexpected server data: missing bootstrap script.');
|
||||
if (initialServerDataWriter) {
|
||||
initialServerDataWriter.enqueue(encoder.encode(seg[1]));
|
||||
} else {
|
||||
initialServerDataBuffer.push(seg[1]);
|
||||
}
|
||||
} else if (seg[0] === 2) {
|
||||
initialFormStateData = seg[1];
|
||||
} else if (seg[0] === 3) {
|
||||
if (!initialServerDataBuffer) throw new Error('Unexpected server data: missing bootstrap script.');
|
||||
// Decode the base64 string back to binary data.
|
||||
const binaryString = atob(seg[1]);
|
||||
const decodedChunk = new Uint8Array(binaryString.length);
|
||||
for(var i = 0; i < binaryString.length; i++){
|
||||
decodedChunk[i] = binaryString.charCodeAt(i);
|
||||
}
|
||||
if (initialServerDataWriter) {
|
||||
initialServerDataWriter.enqueue(decodedChunk);
|
||||
} else {
|
||||
initialServerDataBuffer.push(decodedChunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
function isStreamErrorOrUnfinished(ctr) {
|
||||
// If `desiredSize` is null, it means the stream is closed or errored. If it is lower than 0, the stream is still unfinished.
|
||||
return ctr.desiredSize === null || ctr.desiredSize < 0;
|
||||
}
|
||||
// There might be race conditions between `nextServerDataRegisterWriter` and
|
||||
// `DOMContentLoaded`. The former will be called when React starts to hydrate
|
||||
// the root, the latter will be called when the DOM is fully loaded.
|
||||
// For streaming, the former is called first due to partial hydration.
|
||||
// For non-streaming, the latter can be called first.
|
||||
// Hence, we use two variables `initialServerDataLoaded` and
|
||||
// `initialServerDataFlushed` to make sure the writer will be closed and
|
||||
// `initialServerDataBuffer` will be cleared in the right time.
|
||||
function nextServerDataRegisterWriter(ctr) {
|
||||
if (initialServerDataBuffer) {
|
||||
initialServerDataBuffer.forEach((val)=>{
|
||||
ctr.enqueue(typeof val === 'string' ? encoder.encode(val) : val);
|
||||
});
|
||||
if (initialServerDataLoaded && !initialServerDataFlushed) {
|
||||
if (isStreamErrorOrUnfinished(ctr)) {
|
||||
ctr.error(new Error('The connection to the page was unexpectedly closed, possibly due to the stop button being clicked, loss of Wi-Fi, or an unstable internet connection.'));
|
||||
} else {
|
||||
ctr.close();
|
||||
}
|
||||
initialServerDataFlushed = true;
|
||||
initialServerDataBuffer = undefined;
|
||||
}
|
||||
}
|
||||
initialServerDataWriter = ctr;
|
||||
}
|
||||
// When `DOMContentLoaded`, we can close all pending writers to finish hydration.
|
||||
const DOMContentLoaded = function() {
|
||||
if (initialServerDataWriter && !initialServerDataFlushed) {
|
||||
initialServerDataWriter.close();
|
||||
initialServerDataFlushed = true;
|
||||
initialServerDataBuffer = undefined;
|
||||
}
|
||||
initialServerDataLoaded = true;
|
||||
};
|
||||
// It's possible that the DOM is already loaded.
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', DOMContentLoaded, false);
|
||||
} else {
|
||||
// Delayed in marco task to ensure it's executed later than hydration
|
||||
setTimeout(DOMContentLoaded);
|
||||
}
|
||||
const nextServerDataLoadingGlobal = self.__next_f = self.__next_f || [];
|
||||
nextServerDataLoadingGlobal.forEach(nextServerDataCallback);
|
||||
nextServerDataLoadingGlobal.push = nextServerDataCallback;
|
||||
const readable = new ReadableStream({
|
||||
start (controller) {
|
||||
nextServerDataRegisterWriter(controller);
|
||||
}
|
||||
});
|
||||
const initialServerResponse = (0, _client1.createFromReadableStream)(readable, {
|
||||
callServer: _appcallserver.callServer,
|
||||
findSourceMapURL: _appfindsourcemapurl.findSourceMapURL
|
||||
});
|
||||
// React overrides `.then` and doesn't return a new promise chain,
|
||||
// so we wrap the action queue in a promise to ensure that its value
|
||||
// is defined when the promise resolves.
|
||||
// https://github.com/facebook/react/blob/163365a07872337e04826c4f501565d43dbd2fd4/packages/react-client/src/ReactFlightClient.js#L189-L190
|
||||
const pendingActionQueue = new Promise((resolve, reject)=>{
|
||||
initialServerResponse.then((initialRSCPayload)=>{
|
||||
// setAppBuildId should be called only once, during JS initialization
|
||||
// and before any components have hydrated.
|
||||
(0, _appbuildid.setAppBuildId)(initialRSCPayload.b);
|
||||
resolve((0, _actionqueue.createMutableActionQueue)((0, _createinitialrouterstate.createInitialRouterState)({
|
||||
initialFlightData: initialRSCPayload.f,
|
||||
initialCanonicalUrlParts: initialRSCPayload.c,
|
||||
initialParallelRoutes: new Map(),
|
||||
location: window.location,
|
||||
couldBeIntercepted: initialRSCPayload.i,
|
||||
postponed: initialRSCPayload.s,
|
||||
prerendered: initialRSCPayload.S
|
||||
})));
|
||||
}, (err)=>reject(err));
|
||||
});
|
||||
function ServerRoot() {
|
||||
const initialRSCPayload = (0, _react.use)(initialServerResponse);
|
||||
const actionQueue = (0, _react.use)(pendingActionQueue);
|
||||
const router = /*#__PURE__*/ (0, _jsxruntime.jsx)(_approuter1.default, {
|
||||
actionQueue: actionQueue,
|
||||
globalErrorComponentAndStyles: initialRSCPayload.G,
|
||||
assetPrefix: initialRSCPayload.p
|
||||
});
|
||||
if (process.env.NODE_ENV === 'development' && initialRSCPayload.m) {
|
||||
// We provide missing slot information in a context provider only during development
|
||||
// as we log some additional information about the missing slots in the console.
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.MissingSlotContext, {
|
||||
value: initialRSCPayload.m,
|
||||
children: router
|
||||
});
|
||||
}
|
||||
return router;
|
||||
}
|
||||
const StrictModeIfEnabled = process.env.__NEXT_STRICT_MODE_APP ? _react.default.StrictMode : _react.default.Fragment;
|
||||
function Root(param) {
|
||||
let { children } = param;
|
||||
if (process.env.__NEXT_TEST_MODE) {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
_react.default.useEffect(()=>{
|
||||
window.__NEXT_HYDRATED = true;
|
||||
window.__NEXT_HYDRATED_CB == null ? void 0 : window.__NEXT_HYDRATED_CB.call(window);
|
||||
}, []);
|
||||
}
|
||||
return children;
|
||||
}
|
||||
const reactRootOptions = {
|
||||
onRecoverableError: _shared.onRecoverableError,
|
||||
onCaughtError: _approuter.onCaughtError,
|
||||
onUncaughtError: _approuter.onUncaughtError
|
||||
};
|
||||
function hydrate() {
|
||||
const reactEl = /*#__PURE__*/ (0, _jsxruntime.jsx)(StrictModeIfEnabled, {
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_headmanagercontextsharedruntime.HeadManagerContext.Provider, {
|
||||
value: {
|
||||
appDir: true
|
||||
},
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Root, {
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(ServerRoot, {})
|
||||
})
|
||||
})
|
||||
});
|
||||
const rootLayoutMissingTags = window.__next_root_layout_missing_tags;
|
||||
const hasMissingTags = !!(rootLayoutMissingTags == null ? void 0 : rootLayoutMissingTags.length);
|
||||
const isError = document.documentElement.id === '__next_error__' || hasMissingTags;
|
||||
if (isError) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const createDevOverlayElement = require('./components/react-dev-overlay/client-entry').createDevOverlayElement;
|
||||
const errorTree = createDevOverlayElement(reactEl);
|
||||
_client.default.createRoot(appElement, reactRootOptions).render(errorTree);
|
||||
} else {
|
||||
_client.default.createRoot(appElement, reactRootOptions).render(reactEl);
|
||||
}
|
||||
} else {
|
||||
_react.default.startTransition(()=>_client.default.hydrateRoot(appElement, reactEl, {
|
||||
...reactRootOptions,
|
||||
formState: initialFormStateData
|
||||
}));
|
||||
}
|
||||
// TODO-APP: Remove this logic when Float has GC built-in in development.
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const { linkGc } = require('./app-link-gc');
|
||||
linkGc();
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-index.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
export declare function linkGc(): void;
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "linkGc", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return linkGc;
|
||||
}
|
||||
});
|
||||
function linkGc() {
|
||||
// TODO-APP: Remove this logic when Float has GC built-in in development.
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const callback = (mutationList)=>{
|
||||
for (const mutation of mutationList){
|
||||
if (mutation.type === 'childList') {
|
||||
for (const node of mutation.addedNodes){
|
||||
if ('tagName' in node && node.tagName === 'LINK') {
|
||||
var _link_dataset_precedence;
|
||||
const link = node;
|
||||
if ((_link_dataset_precedence = link.dataset.precedence) == null ? void 0 : _link_dataset_precedence.startsWith('next')) {
|
||||
const href = link.getAttribute('href');
|
||||
if (href) {
|
||||
const [resource, version] = href.split('?v=', 2);
|
||||
if (version) {
|
||||
const currentOrigin = window.location.origin;
|
||||
const allLinks = [
|
||||
...document.querySelectorAll('link[href^="' + resource + '"]'),
|
||||
// It's possible that the resource is a full URL or only pathname,
|
||||
// so we need to remove the alternative href as well.
|
||||
...document.querySelectorAll('link[href^="' + (resource.startsWith(currentOrigin) ? resource.slice(currentOrigin.length) : currentOrigin + resource) + '"]')
|
||||
];
|
||||
for (const otherLink of allLinks){
|
||||
var _otherLink_dataset_precedence;
|
||||
if ((_otherLink_dataset_precedence = otherLink.dataset.precedence) == null ? void 0 : _otherLink_dataset_precedence.startsWith('next')) {
|
||||
const otherHref = otherLink.getAttribute('href');
|
||||
if (otherHref) {
|
||||
const [, otherVersion] = otherHref.split('?v=', 2);
|
||||
if (!otherVersion || +otherVersion < +version) {
|
||||
// Delay the removal of the stylesheet to avoid FOUC
|
||||
// caused by `@font-face` rules, as they seem to be
|
||||
// a couple of ticks delayed between the old and new
|
||||
// styles being swapped even if the font is cached.
|
||||
setTimeout(()=>{
|
||||
otherLink.remove();
|
||||
}, 5);
|
||||
const preloadLink = document.querySelector('link[rel="preload"][as="style"][href="' + otherHref + '"]');
|
||||
if (preloadLink) {
|
||||
preloadLink.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// Create an observer instance linked to the callback function
|
||||
const observer = new MutationObserver(callback);
|
||||
observer.observe(document.head, {
|
||||
childList: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-link-gc.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
import './app-webpack';
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// TODO-APP: hydration warning
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
require("./app-webpack");
|
||||
const _appbootstrap = require("./app-bootstrap");
|
||||
(0, _appbootstrap.appBootstrap)(()=>{
|
||||
const { hydrate } = require('./app-index');
|
||||
hydrate();
|
||||
}) // TODO-APP: build indicator
|
||||
;
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-next-dev.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/app-next-dev.ts"],"sourcesContent":["// TODO-APP: hydration warning\n\nimport './app-webpack'\nimport { appBootstrap } from './app-bootstrap'\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n hydrate()\n})\n\n// TODO-APP: build indicator\n"],"names":["appBootstrap","hydrate","require"],"mappings":"AAAA,8BAA8B;;;;;QAEvB;8BACsB;AAE7BA,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5BD;AACF,GAEA,4BAA4B"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// TODO-APP: hydration warning
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const _appbootstrap = require("./app-bootstrap");
|
||||
window.next.version += '-turbo';
|
||||
self.__webpack_hash__ = '';
|
||||
(0, _appbootstrap.appBootstrap)(()=>{
|
||||
const { hydrate } = require('./app-index');
|
||||
hydrate();
|
||||
}) // TODO-APP: build indicator
|
||||
;
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-next-turbopack.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/app-next-turbopack.ts"],"sourcesContent":["// TODO-APP: hydration warning\n\nimport { appBootstrap } from './app-bootstrap'\n\nwindow.next.version += '-turbo'\n;(self as any).__webpack_hash__ = ''\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n hydrate()\n})\n\n// TODO-APP: build indicator\n"],"names":["window","next","version","self","__webpack_hash__","appBootstrap","hydrate","require"],"mappings":"AAAA,8BAA8B;;;;;8BAED;AAE7BA,OAAOC,IAAI,CAACC,OAAO,IAAI;AACrBC,KAAaC,gBAAgB,GAAG;AAElCC,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5BD;AACF,GAEA,4BAA4B"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
import './app-webpack';
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// This import must go first because it needs to patch webpack chunk loading
|
||||
// before React patches chunk loading.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
require("./app-webpack");
|
||||
const _appbootstrap = require("./app-bootstrap");
|
||||
(0, _appbootstrap.appBootstrap)(()=>{
|
||||
const { hydrate } = require('./app-index');
|
||||
// Include app-router and layout-router in the main chunk
|
||||
require('next/dist/client/components/app-router');
|
||||
require('next/dist/client/components/layout-router');
|
||||
hydrate();
|
||||
});
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-next.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/app-next.ts"],"sourcesContent":["// This import must go first because it needs to patch webpack chunk loading\n// before React patches chunk loading.\nimport './app-webpack'\nimport { appBootstrap } from './app-bootstrap'\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n // Include app-router and layout-router in the main chunk\n require('next/dist/client/components/app-router')\n require('next/dist/client/components/layout-router')\n hydrate()\n})\n"],"names":["appBootstrap","hydrate","require"],"mappings":"AAAA,4EAA4E;AAC5E,sCAAsC;;;;;QAC/B;8BACsB;AAE7BA,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5B,yDAAyD;IACzDA,QAAQ;IACRA,QAAQ;IACRD;AACF"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
// Override chunk URL mapping in the webpack runtime
|
||||
// https://github.com/webpack/webpack/blob/2738eebc7880835d88c727d364ad37f3ec557593/lib/RuntimeGlobals.js#L204
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const _deploymentid = require("../build/deployment-id");
|
||||
const _encodeuripath = require("../shared/lib/encode-uri-path");
|
||||
// If we have a deployment ID, we need to append it to the webpack chunk names
|
||||
// I am keeping the process check explicit so this can be statically optimized
|
||||
if (process.env.NEXT_DEPLOYMENT_ID) {
|
||||
const suffix = (0, _deploymentid.getDeploymentIdQueryOrEmptyString)();
|
||||
// eslint-disable-next-line no-undef
|
||||
const getChunkScriptFilename = __webpack_require__.u;
|
||||
// eslint-disable-next-line no-undef
|
||||
__webpack_require__.u = function() {
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
return(// We encode the chunk filename because our static server matches against and encoded
|
||||
// filename path.
|
||||
(0, _encodeuripath.encodeURIPath)(getChunkScriptFilename(...args)) + suffix);
|
||||
};
|
||||
// eslint-disable-next-line no-undef
|
||||
const getChunkCssFilename = __webpack_require__.k;
|
||||
// eslint-disable-next-line no-undef
|
||||
__webpack_require__.k = function() {
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
return getChunkCssFilename(...args) + suffix;
|
||||
};
|
||||
// eslint-disable-next-line no-undef
|
||||
const getMiniCssFilename = __webpack_require__.miniCssF;
|
||||
// eslint-disable-next-line no-undef
|
||||
__webpack_require__.miniCssF = function() {
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
return getMiniCssFilename(...args) + suffix;
|
||||
};
|
||||
} else {
|
||||
// eslint-disable-next-line no-undef
|
||||
const getChunkScriptFilename = __webpack_require__.u;
|
||||
// eslint-disable-next-line no-undef
|
||||
__webpack_require__.u = function() {
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
return(// We encode the chunk filename because our static server matches against and encoded
|
||||
// filename path.
|
||||
(0, _encodeuripath.encodeURIPath)(getChunkScriptFilename(...args)));
|
||||
};
|
||||
// We don't need to override __webpack_require__.k because we don't modify
|
||||
// the css chunk name when not using deployment id suffixes
|
||||
// WE don't need to override __webpack_require__.miniCssF because we don't modify
|
||||
// the mini css chunk name when not using deployment id suffixes
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-webpack.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/app-webpack.ts"],"sourcesContent":["// Override chunk URL mapping in the webpack runtime\n// https://github.com/webpack/webpack/blob/2738eebc7880835d88c727d364ad37f3ec557593/lib/RuntimeGlobals.js#L204\n\nimport { getDeploymentIdQueryOrEmptyString } from '../build/deployment-id'\nimport { encodeURIPath } from '../shared/lib/encode-uri-path'\n\ndeclare const __webpack_require__: any\n\n// If we have a deployment ID, we need to append it to the webpack chunk names\n// I am keeping the process check explicit so this can be statically optimized\nif (process.env.NEXT_DEPLOYMENT_ID) {\n const suffix = getDeploymentIdQueryOrEmptyString()\n // eslint-disable-next-line no-undef\n const getChunkScriptFilename = __webpack_require__.u\n // eslint-disable-next-line no-undef\n __webpack_require__.u = (...args: any[]) =>\n // We encode the chunk filename because our static server matches against and encoded\n // filename path.\n encodeURIPath(getChunkScriptFilename(...args)) + suffix\n\n // eslint-disable-next-line no-undef\n const getChunkCssFilename = __webpack_require__.k\n // eslint-disable-next-line no-undef\n __webpack_require__.k = (...args: any[]) =>\n getChunkCssFilename(...args) + suffix\n\n // eslint-disable-next-line no-undef\n const getMiniCssFilename = __webpack_require__.miniCssF\n // eslint-disable-next-line no-undef\n __webpack_require__.miniCssF = (...args: any[]) =>\n getMiniCssFilename(...args) + suffix\n} else {\n // eslint-disable-next-line no-undef\n const getChunkScriptFilename = __webpack_require__.u\n // eslint-disable-next-line no-undef\n __webpack_require__.u = (...args: any[]) =>\n // We encode the chunk filename because our static server matches against and encoded\n // filename path.\n encodeURIPath(getChunkScriptFilename(...args))\n\n // We don't need to override __webpack_require__.k because we don't modify\n // the css chunk name when not using deployment id suffixes\n\n // WE don't need to override __webpack_require__.miniCssF because we don't modify\n // the mini css chunk name when not using deployment id suffixes\n}\n\nexport {}\n"],"names":["process","env","NEXT_DEPLOYMENT_ID","suffix","getDeploymentIdQueryOrEmptyString","getChunkScriptFilename","__webpack_require__","u","args","encodeURIPath","getChunkCssFilename","k","getMiniCssFilename","miniCssF"],"mappings":"AAAA,oDAAoD;AACpD,8GAA8G;;;;;8BAE5D;+BACpB;AAI9B,8EAA8E;AAC9E,8EAA8E;AAC9E,IAAIA,QAAQC,GAAG,CAACC,kBAAkB,EAAE;IAClC,MAAMC,SAASC,IAAAA,+CAAiC;IAChD,oCAAoC;IACpC,MAAMC,yBAAyBC,oBAAoBC,CAAC;IACpD,oCAAoC;IACpCD,oBAAoBC,CAAC,GAAG;yCAAIC;YAAAA;;eAC1B,qFAAqF;QACrF,iBAAiB;QACjBC,IAAAA,4BAAa,EAACJ,0BAA0BG,SAASL;;IAEnD,oCAAoC;IACpC,MAAMO,sBAAsBJ,oBAAoBK,CAAC;IACjD,oCAAoC;IACpCL,oBAAoBK,CAAC,GAAG;yCAAIH;YAAAA;;eAC1BE,uBAAuBF,QAAQL;;IAEjC,oCAAoC;IACpC,MAAMS,qBAAqBN,oBAAoBO,QAAQ;IACvD,oCAAoC;IACpCP,oBAAoBO,QAAQ,GAAG;yCAAIL;YAAAA;;eACjCI,sBAAsBJ,QAAQL;;AAClC,OAAO;IACL,oCAAoC;IACpC,MAAME,yBAAyBC,oBAAoBC,CAAC;IACpD,oCAAoC;IACpCD,oBAAoBC,CAAC,GAAG;yCAAIC;YAAAA;;eAC1B,qFAAqF;QACrF,iBAAiB;QACjBC,IAAAA,4BAAa,EAACJ,0BAA0BG;;AAE1C,0EAA0E;AAC1E,2DAA2D;AAE3D,iFAAiF;AACjF,gEAAgE;AAClE"}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Function to correctly assign location to URL
|
||||
*
|
||||
* The method will add basePath, and will also correctly add location (including if it is a relative path)
|
||||
* @param location Location that should be added to the url
|
||||
* @param url Base URL to which the location should be assigned
|
||||
*/
|
||||
export declare function assignLocation(location: string, url: URL): URL;
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "assignLocation", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return assignLocation;
|
||||
}
|
||||
});
|
||||
const _addbasepath = require("./add-base-path");
|
||||
function assignLocation(location, url) {
|
||||
if (location.startsWith('.')) {
|
||||
const urlBase = url.origin + url.pathname;
|
||||
return new URL(// In order for a relative path to be added to the current url correctly, the current url must end with a slash
|
||||
// new URL('./relative', 'https://example.com/subdir').href -> 'https://example.com/relative'
|
||||
// new URL('./relative', 'https://example.com/subdir/').href -> 'https://example.com/subdir/relative'
|
||||
(urlBase.endsWith('/') ? urlBase : urlBase + '/') + location);
|
||||
}
|
||||
return new URL((0, _addbasepath.addBasePath)(location), url.href);
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=assign-location.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/client/assign-location.ts"],"sourcesContent":["import { addBasePath } from './add-base-path'\n\n/**\n * Function to correctly assign location to URL\n *\n * The method will add basePath, and will also correctly add location (including if it is a relative path)\n * @param location Location that should be added to the url\n * @param url Base URL to which the location should be assigned\n */\nexport function assignLocation(location: string, url: URL): URL {\n if (location.startsWith('.')) {\n const urlBase = url.origin + url.pathname\n return new URL(\n // In order for a relative path to be added to the current url correctly, the current url must end with a slash\n // new URL('./relative', 'https://example.com/subdir').href -> 'https://example.com/relative'\n // new URL('./relative', 'https://example.com/subdir/').href -> 'https://example.com/subdir/relative'\n (urlBase.endsWith('/') ? urlBase : urlBase + '/') + location\n )\n }\n\n return new URL(addBasePath(location), url.href)\n}\n"],"names":["assignLocation","location","url","startsWith","urlBase","origin","pathname","URL","endsWith","addBasePath","href"],"mappings":";;;;+BASgBA;;;eAAAA;;;6BATY;AASrB,SAASA,eAAeC,QAAgB,EAAEC,GAAQ;IACvD,IAAID,SAASE,UAAU,CAAC,MAAM;QAC5B,MAAMC,UAAUF,IAAIG,MAAM,GAAGH,IAAII,QAAQ;QACzC,OAAO,IAAIC,IAIT,AAHA,+GAA+G;QAC/G,6FAA6F;QAC7F,qGAAqG;QACpGH,CAAAA,QAAQI,QAAQ,CAAC,OAAOJ,UAAUA,UAAU,GAAE,IAAKH;IAExD;IAEA,OAAO,IAAIM,IAAIE,IAAAA,wBAAW,EAACR,WAAWC,IAAIQ,IAAI;AAChD"}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import type { NextRouter } from '../router';
|
||||
/**
|
||||
* useRouter from `next/compat/router` is designed to assist developers
|
||||
* migrating from `pages/` to `app/`. Unlike `next/router`, this hook does not
|
||||
* throw when the `NextRouter` is not mounted, and instead returns `null`. The
|
||||
* more concrete return type here lets developers use this hook within
|
||||
* components that could be shared between both `app/` and `pages/` and handle
|
||||
* to the case where the router is not mounted.
|
||||
*
|
||||
* @returns The `NextRouter` instance if it's available, otherwise `null`.
|
||||
*/
|
||||
export declare function useRouter(): NextRouter | null;
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "useRouter", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return useRouter;
|
||||
}
|
||||
});
|
||||
const _react = require("react");
|
||||
const _routercontextsharedruntime = require("../../shared/lib/router-context.shared-runtime");
|
||||
function useRouter() {
|
||||
return (0, _react.useContext)(_routercontextsharedruntime.RouterContext);
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=router.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/compat/router.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { RouterContext } from '../../shared/lib/router-context.shared-runtime'\nimport type { NextRouter } from '../router'\n\n/**\n * useRouter from `next/compat/router` is designed to assist developers\n * migrating from `pages/` to `app/`. Unlike `next/router`, this hook does not\n * throw when the `NextRouter` is not mounted, and instead returns `null`. The\n * more concrete return type here lets developers use this hook within\n * components that could be shared between both `app/` and `pages/` and handle\n * to the case where the router is not mounted.\n *\n * @returns The `NextRouter` instance if it's available, otherwise `null`.\n */\nexport function useRouter(): NextRouter | null {\n return useContext(RouterContext)\n}\n"],"names":["useRouter","useContext","RouterContext"],"mappings":";;;;+BAcgBA;;;eAAAA;;;uBAdW;4CACG;AAavB,SAASA;IACd,OAAOC,IAAAA,iBAAU,EAACC,yCAAa;AACjC"}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import type { FlightRouterState } from '../../server/app-render/types';
|
||||
export declare function AppRouterAnnouncer({ tree }: {
|
||||
tree: FlightRouterState;
|
||||
}): import("react").ReactPortal | null;
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AppRouterAnnouncer", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return AppRouterAnnouncer;
|
||||
}
|
||||
});
|
||||
const _react = require("react");
|
||||
const _reactdom = require("react-dom");
|
||||
const ANNOUNCER_TYPE = 'next-route-announcer';
|
||||
const ANNOUNCER_ID = '__next-route-announcer__';
|
||||
function getAnnouncerNode() {
|
||||
var _existingAnnouncer_shadowRoot;
|
||||
const existingAnnouncer = document.getElementsByName(ANNOUNCER_TYPE)[0];
|
||||
if (existingAnnouncer == null ? void 0 : (_existingAnnouncer_shadowRoot = existingAnnouncer.shadowRoot) == null ? void 0 : _existingAnnouncer_shadowRoot.childNodes[0]) {
|
||||
return existingAnnouncer.shadowRoot.childNodes[0];
|
||||
} else {
|
||||
const container = document.createElement(ANNOUNCER_TYPE);
|
||||
container.style.cssText = 'position:absolute';
|
||||
const announcer = document.createElement('div');
|
||||
announcer.ariaLive = 'assertive';
|
||||
announcer.id = ANNOUNCER_ID;
|
||||
announcer.role = 'alert';
|
||||
announcer.style.cssText = 'position:absolute;border:0;height:1px;margin:-1px;padding:0;width:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;word-wrap:normal';
|
||||
// Use shadow DOM here to avoid any potential CSS bleed
|
||||
const shadow = container.attachShadow({
|
||||
mode: 'open'
|
||||
});
|
||||
shadow.appendChild(announcer);
|
||||
document.body.appendChild(container);
|
||||
return announcer;
|
||||
}
|
||||
}
|
||||
function AppRouterAnnouncer(param) {
|
||||
let { tree } = param;
|
||||
const [portalNode, setPortalNode] = (0, _react.useState)(null);
|
||||
(0, _react.useEffect)(()=>{
|
||||
const announcer = getAnnouncerNode();
|
||||
setPortalNode(announcer);
|
||||
return ()=>{
|
||||
const container = document.getElementsByTagName(ANNOUNCER_TYPE)[0];
|
||||
if (container == null ? void 0 : container.isConnected) {
|
||||
document.body.removeChild(container);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
const [routeAnnouncement, setRouteAnnouncement] = (0, _react.useState)('');
|
||||
const previousTitle = (0, _react.useRef)(undefined);
|
||||
(0, _react.useEffect)(()=>{
|
||||
let currentTitle = '';
|
||||
if (document.title) {
|
||||
currentTitle = document.title;
|
||||
} else {
|
||||
const pageHeader = document.querySelector('h1');
|
||||
if (pageHeader) {
|
||||
currentTitle = pageHeader.innerText || pageHeader.textContent || '';
|
||||
}
|
||||
}
|
||||
// Only announce the title change, but not for the first load because screen
|
||||
// readers do that automatically.
|
||||
if (previousTitle.current !== undefined && previousTitle.current !== currentTitle) {
|
||||
setRouteAnnouncement(currentTitle);
|
||||
}
|
||||
previousTitle.current = currentTitle;
|
||||
}, [
|
||||
tree
|
||||
]);
|
||||
return portalNode ? /*#__PURE__*/ (0, _reactdom.createPortal)(routeAnnouncement, portalNode) : null;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-router-announcer.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/app-router-announcer.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport type { FlightRouterState } from '../../server/app-render/types'\n\nconst ANNOUNCER_TYPE = 'next-route-announcer'\nconst ANNOUNCER_ID = '__next-route-announcer__'\n\nfunction getAnnouncerNode() {\n const existingAnnouncer = document.getElementsByName(ANNOUNCER_TYPE)[0]\n if (existingAnnouncer?.shadowRoot?.childNodes[0]) {\n return existingAnnouncer.shadowRoot.childNodes[0] as HTMLElement\n } else {\n const container = document.createElement(ANNOUNCER_TYPE)\n container.style.cssText = 'position:absolute'\n const announcer = document.createElement('div')\n announcer.ariaLive = 'assertive'\n announcer.id = ANNOUNCER_ID\n announcer.role = 'alert'\n announcer.style.cssText =\n 'position:absolute;border:0;height:1px;margin:-1px;padding:0;width:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;word-wrap:normal'\n\n // Use shadow DOM here to avoid any potential CSS bleed\n const shadow = container.attachShadow({ mode: 'open' })\n shadow.appendChild(announcer)\n document.body.appendChild(container)\n return announcer\n }\n}\n\nexport function AppRouterAnnouncer({ tree }: { tree: FlightRouterState }) {\n const [portalNode, setPortalNode] = useState<HTMLElement | null>(null)\n\n useEffect(() => {\n const announcer = getAnnouncerNode()\n setPortalNode(announcer)\n return () => {\n const container = document.getElementsByTagName(ANNOUNCER_TYPE)[0]\n if (container?.isConnected) {\n document.body.removeChild(container)\n }\n }\n }, [])\n\n const [routeAnnouncement, setRouteAnnouncement] = useState('')\n const previousTitle = useRef<string | undefined>(undefined)\n\n useEffect(() => {\n let currentTitle = ''\n if (document.title) {\n currentTitle = document.title\n } else {\n const pageHeader = document.querySelector('h1')\n if (pageHeader) {\n currentTitle = pageHeader.innerText || pageHeader.textContent || ''\n }\n }\n\n // Only announce the title change, but not for the first load because screen\n // readers do that automatically.\n if (\n previousTitle.current !== undefined &&\n previousTitle.current !== currentTitle\n ) {\n setRouteAnnouncement(currentTitle)\n }\n previousTitle.current = currentTitle\n }, [tree])\n\n return portalNode ? createPortal(routeAnnouncement, portalNode) : null\n}\n"],"names":["AppRouterAnnouncer","ANNOUNCER_TYPE","ANNOUNCER_ID","getAnnouncerNode","existingAnnouncer","document","getElementsByName","shadowRoot","childNodes","container","createElement","style","cssText","announcer","ariaLive","id","role","shadow","attachShadow","mode","appendChild","body","tree","portalNode","setPortalNode","useState","useEffect","getElementsByTagName","isConnected","removeChild","routeAnnouncement","setRouteAnnouncement","previousTitle","useRef","undefined","currentTitle","title","pageHeader","querySelector","innerText","textContent","current","createPortal"],"mappings":";;;;+BA6BgBA;;;eAAAA;;;uBA7B4B;0BACf;AAG7B,MAAMC,iBAAiB;AACvB,MAAMC,eAAe;AAErB,SAASC;QAEHC;IADJ,MAAMA,oBAAoBC,SAASC,iBAAiB,CAACL,eAAe,CAAC,EAAE;IACvE,IAAIG,sCAAAA,gCAAAA,kBAAmBG,UAAU,qBAA7BH,8BAA+BI,UAAU,CAAC,EAAE,EAAE;QAChD,OAAOJ,kBAAkBG,UAAU,CAACC,UAAU,CAAC,EAAE;IACnD,OAAO;QACL,MAAMC,YAAYJ,SAASK,aAAa,CAACT;QACzCQ,UAAUE,KAAK,CAACC,OAAO,GAAG;QAC1B,MAAMC,YAAYR,SAASK,aAAa,CAAC;QACzCG,UAAUC,QAAQ,GAAG;QACrBD,UAAUE,EAAE,GAAGb;QACfW,UAAUG,IAAI,GAAG;QACjBH,UAAUF,KAAK,CAACC,OAAO,GACrB;QAEF,uDAAuD;QACvD,MAAMK,SAASR,UAAUS,YAAY,CAAC;YAAEC,MAAM;QAAO;QACrDF,OAAOG,WAAW,CAACP;QACnBR,SAASgB,IAAI,CAACD,WAAW,CAACX;QAC1B,OAAOI;IACT;AACF;AAEO,SAASb,mBAAmB,KAAqC;IAArC,IAAA,EAAEsB,IAAI,EAA+B,GAArC;IACjC,MAAM,CAACC,YAAYC,cAAc,GAAGC,IAAAA,eAAQ,EAAqB;IAEjEC,IAAAA,gBAAS,EAAC;QACR,MAAMb,YAAYV;QAClBqB,cAAcX;QACd,OAAO;YACL,MAAMJ,YAAYJ,SAASsB,oBAAoB,CAAC1B,eAAe,CAAC,EAAE;YAClE,IAAIQ,6BAAAA,UAAWmB,WAAW,EAAE;gBAC1BvB,SAASgB,IAAI,CAACQ,WAAW,CAACpB;YAC5B;QACF;IACF,GAAG,EAAE;IAEL,MAAM,CAACqB,mBAAmBC,qBAAqB,GAAGN,IAAAA,eAAQ,EAAC;IAC3D,MAAMO,gBAAgBC,IAAAA,aAAM,EAAqBC;IAEjDR,IAAAA,gBAAS,EAAC;QACR,IAAIS,eAAe;QACnB,IAAI9B,SAAS+B,KAAK,EAAE;YAClBD,eAAe9B,SAAS+B,KAAK;QAC/B,OAAO;YACL,MAAMC,aAAahC,SAASiC,aAAa,CAAC;YAC1C,IAAID,YAAY;gBACdF,eAAeE,WAAWE,SAAS,IAAIF,WAAWG,WAAW,IAAI;YACnE;QACF;QAEA,4EAA4E;QAC5E,iCAAiC;QACjC,IACER,cAAcS,OAAO,KAAKP,aAC1BF,cAAcS,OAAO,KAAKN,cAC1B;YACAJ,qBAAqBI;QACvB;QACAH,cAAcS,OAAO,GAAGN;IAC1B,GAAG;QAACb;KAAK;IAET,OAAOC,2BAAamB,IAAAA,sBAAY,EAACZ,mBAAmBP,cAAc;AACpE"}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
export declare const RSC_HEADER: "RSC";
|
||||
export declare const ACTION_HEADER: "Next-Action";
|
||||
export declare const NEXT_ROUTER_STATE_TREE_HEADER: "Next-Router-State-Tree";
|
||||
export declare const NEXT_ROUTER_PREFETCH_HEADER: "Next-Router-Prefetch";
|
||||
export declare const NEXT_ROUTER_SEGMENT_PREFETCH_HEADER: "Next-Router-Segment-Prefetch";
|
||||
export declare const NEXT_HMR_REFRESH_HEADER: "Next-HMR-Refresh";
|
||||
export declare const NEXT_URL: "Next-Url";
|
||||
export declare const RSC_CONTENT_TYPE_HEADER: "text/x-component";
|
||||
export declare const FLIGHT_HEADERS: readonly ["RSC", "Next-Router-State-Tree", "Next-Router-Prefetch", "Next-HMR-Refresh", "Next-Router-Segment-Prefetch"];
|
||||
export declare const NEXT_RSC_UNION_QUERY: "_rsc";
|
||||
export declare const NEXT_ROUTER_STALE_TIME_HEADER: "x-nextjs-stale-time";
|
||||
export declare const NEXT_DID_POSTPONE_HEADER: "x-nextjs-postponed";
|
||||
export declare const NEXT_IS_PRERENDER_HEADER: "x-nextjs-prerender";
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
ACTION_HEADER: null,
|
||||
FLIGHT_HEADERS: null,
|
||||
NEXT_DID_POSTPONE_HEADER: null,
|
||||
NEXT_HMR_REFRESH_HEADER: null,
|
||||
NEXT_IS_PRERENDER_HEADER: null,
|
||||
NEXT_ROUTER_PREFETCH_HEADER: null,
|
||||
NEXT_ROUTER_SEGMENT_PREFETCH_HEADER: null,
|
||||
NEXT_ROUTER_STALE_TIME_HEADER: null,
|
||||
NEXT_ROUTER_STATE_TREE_HEADER: null,
|
||||
NEXT_RSC_UNION_QUERY: null,
|
||||
NEXT_URL: null,
|
||||
RSC_CONTENT_TYPE_HEADER: null,
|
||||
RSC_HEADER: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
ACTION_HEADER: function() {
|
||||
return ACTION_HEADER;
|
||||
},
|
||||
FLIGHT_HEADERS: function() {
|
||||
return FLIGHT_HEADERS;
|
||||
},
|
||||
NEXT_DID_POSTPONE_HEADER: function() {
|
||||
return NEXT_DID_POSTPONE_HEADER;
|
||||
},
|
||||
NEXT_HMR_REFRESH_HEADER: function() {
|
||||
return NEXT_HMR_REFRESH_HEADER;
|
||||
},
|
||||
NEXT_IS_PRERENDER_HEADER: function() {
|
||||
return NEXT_IS_PRERENDER_HEADER;
|
||||
},
|
||||
NEXT_ROUTER_PREFETCH_HEADER: function() {
|
||||
return NEXT_ROUTER_PREFETCH_HEADER;
|
||||
},
|
||||
NEXT_ROUTER_SEGMENT_PREFETCH_HEADER: function() {
|
||||
return NEXT_ROUTER_SEGMENT_PREFETCH_HEADER;
|
||||
},
|
||||
NEXT_ROUTER_STALE_TIME_HEADER: function() {
|
||||
return NEXT_ROUTER_STALE_TIME_HEADER;
|
||||
},
|
||||
NEXT_ROUTER_STATE_TREE_HEADER: function() {
|
||||
return NEXT_ROUTER_STATE_TREE_HEADER;
|
||||
},
|
||||
NEXT_RSC_UNION_QUERY: function() {
|
||||
return NEXT_RSC_UNION_QUERY;
|
||||
},
|
||||
NEXT_URL: function() {
|
||||
return NEXT_URL;
|
||||
},
|
||||
RSC_CONTENT_TYPE_HEADER: function() {
|
||||
return RSC_CONTENT_TYPE_HEADER;
|
||||
},
|
||||
RSC_HEADER: function() {
|
||||
return RSC_HEADER;
|
||||
}
|
||||
});
|
||||
const RSC_HEADER = 'RSC';
|
||||
const ACTION_HEADER = 'Next-Action';
|
||||
const NEXT_ROUTER_STATE_TREE_HEADER = 'Next-Router-State-Tree';
|
||||
const NEXT_ROUTER_PREFETCH_HEADER = 'Next-Router-Prefetch';
|
||||
const NEXT_ROUTER_SEGMENT_PREFETCH_HEADER = 'Next-Router-Segment-Prefetch';
|
||||
const NEXT_HMR_REFRESH_HEADER = 'Next-HMR-Refresh';
|
||||
const NEXT_URL = 'Next-Url';
|
||||
const RSC_CONTENT_TYPE_HEADER = 'text/x-component';
|
||||
const FLIGHT_HEADERS = [
|
||||
RSC_HEADER,
|
||||
NEXT_ROUTER_STATE_TREE_HEADER,
|
||||
NEXT_ROUTER_PREFETCH_HEADER,
|
||||
NEXT_HMR_REFRESH_HEADER,
|
||||
NEXT_ROUTER_SEGMENT_PREFETCH_HEADER
|
||||
];
|
||||
const NEXT_RSC_UNION_QUERY = '_rsc';
|
||||
const NEXT_ROUTER_STALE_TIME_HEADER = 'x-nextjs-stale-time';
|
||||
const NEXT_DID_POSTPONE_HEADER = 'x-nextjs-postponed';
|
||||
const NEXT_IS_PRERENDER_HEADER = 'x-nextjs-prerender';
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-router-headers.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/app-router-headers.ts"],"sourcesContent":["export const RSC_HEADER = 'RSC' as const\nexport const ACTION_HEADER = 'Next-Action' as const\n// TODO: Instead of sending the full router state, we only need to send the\n// segment path. Saves bytes. Then we could also use this field for segment\n// prefetches, which also need to specify a particular segment.\nexport const NEXT_ROUTER_STATE_TREE_HEADER = 'Next-Router-State-Tree' as const\nexport const NEXT_ROUTER_PREFETCH_HEADER = 'Next-Router-Prefetch' as const\n// This contains the path to the segment being prefetched.\n// TODO: If we change Next-Router-State-Tree to be a segment path, we can use\n// that instead. Then Next-Router-Prefetch and Next-Router-Segment-Prefetch can\n// be merged into a single enum.\nexport const NEXT_ROUTER_SEGMENT_PREFETCH_HEADER =\n 'Next-Router-Segment-Prefetch' as const\nexport const NEXT_HMR_REFRESH_HEADER = 'Next-HMR-Refresh' as const\nexport const NEXT_URL = 'Next-Url' as const\nexport const RSC_CONTENT_TYPE_HEADER = 'text/x-component' as const\n\nexport const FLIGHT_HEADERS = [\n RSC_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_HMR_REFRESH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n] as const\n\nexport const NEXT_RSC_UNION_QUERY = '_rsc' as const\n\nexport const NEXT_ROUTER_STALE_TIME_HEADER = 'x-nextjs-stale-time' as const\nexport const NEXT_DID_POSTPONE_HEADER = 'x-nextjs-postponed' as const\nexport const NEXT_IS_PRERENDER_HEADER = 'x-nextjs-prerender' as const\n"],"names":["ACTION_HEADER","FLIGHT_HEADERS","NEXT_DID_POSTPONE_HEADER","NEXT_HMR_REFRESH_HEADER","NEXT_IS_PRERENDER_HEADER","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","NEXT_ROUTER_STALE_TIME_HEADER","NEXT_ROUTER_STATE_TREE_HEADER","NEXT_RSC_UNION_QUERY","NEXT_URL","RSC_CONTENT_TYPE_HEADER","RSC_HEADER"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IACaA,aAAa;eAAbA;;IAgBAC,cAAc;eAAdA;;IAWAC,wBAAwB;eAAxBA;;IAfAC,uBAAuB;eAAvBA;;IAgBAC,wBAAwB;eAAxBA;;IAvBAC,2BAA2B;eAA3BA;;IAKAC,mCAAmC;eAAnCA;;IAgBAC,6BAA6B;eAA7BA;;IAtBAC,6BAA6B;eAA7BA;;IAoBAC,oBAAoB;eAApBA;;IAXAC,QAAQ;eAARA;;IACAC,uBAAuB;eAAvBA;;IAfAC,UAAU;eAAVA;;;AAAN,MAAMA,aAAa;AACnB,MAAMZ,gBAAgB;AAItB,MAAMQ,gCAAgC;AACtC,MAAMH,8BAA8B;AAKpC,MAAMC,sCACX;AACK,MAAMH,0BAA0B;AAChC,MAAMO,WAAW;AACjB,MAAMC,0BAA0B;AAEhC,MAAMV,iBAAiB;IAC5BW;IACAJ;IACAH;IACAF;IACAG;CACD;AAEM,MAAMG,uBAAuB;AAE7B,MAAMF,gCAAgC;AACtC,MAAML,2BAA2B;AACjC,MAAME,2BAA2B"}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import type { CacheNode } from '../../shared/lib/app-router-context.shared-runtime';
|
||||
import { type ErrorComponent } from './error-boundary';
|
||||
import type { AppRouterActionQueue } from '../../shared/lib/router/action-queue';
|
||||
/**
|
||||
* Given a link href, constructs the URL that should be prefetched. Returns null
|
||||
* in cases where prefetching should be disabled, like external URLs, or
|
||||
* during development.
|
||||
* @param href The href passed to <Link>, router.prefetch(), or similar
|
||||
* @returns A URL object to prefetch, or null if prefetching should be disabled
|
||||
*/
|
||||
export declare function createPrefetchURL(href: string): URL | null;
|
||||
export declare function createEmptyCacheNode(): CacheNode;
|
||||
export default function AppRouter({ actionQueue, globalErrorComponentAndStyles: [globalErrorComponent, globalErrorStyles], assetPrefix, }: {
|
||||
actionQueue: AppRouterActionQueue;
|
||||
globalErrorComponentAndStyles: [ErrorComponent, React.ReactNode | undefined];
|
||||
assetPrefix: string;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
+621
@@ -0,0 +1,621 @@
|
||||
'use client';
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createEmptyCacheNode: null,
|
||||
createPrefetchURL: null,
|
||||
default: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createEmptyCacheNode: function() {
|
||||
return createEmptyCacheNode;
|
||||
},
|
||||
createPrefetchURL: function() {
|
||||
return createPrefetchURL;
|
||||
},
|
||||
default: function() {
|
||||
return AppRouter;
|
||||
}
|
||||
});
|
||||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
||||
const _approutercontextsharedruntime = require("../../shared/lib/app-router-context.shared-runtime");
|
||||
const _routerreducertypes = require("./router-reducer/router-reducer-types");
|
||||
const _createhreffromurl = require("./router-reducer/create-href-from-url");
|
||||
const _hooksclientcontextsharedruntime = require("../../shared/lib/hooks-client-context.shared-runtime");
|
||||
const _usereducer = require("./use-reducer");
|
||||
const _errorboundary = require("./error-boundary");
|
||||
const _isbot = require("../../shared/lib/router/utils/is-bot");
|
||||
const _addbasepath = require("../add-base-path");
|
||||
const _approuterannouncer = require("./app-router-announcer");
|
||||
const _redirectboundary = require("./redirect-boundary");
|
||||
const _findheadincache = require("./router-reducer/reducers/find-head-in-cache");
|
||||
const _unresolvedthenable = require("./unresolved-thenable");
|
||||
const _removebasepath = require("../remove-base-path");
|
||||
const _hasbasepath = require("../has-base-path");
|
||||
const _computechangedpath = require("./router-reducer/compute-changed-path");
|
||||
const _navfailurehandler = require("./nav-failure-handler");
|
||||
const _appcallserver = require("../app-call-server");
|
||||
const _prefetch = require("../components/segment-cache/prefetch");
|
||||
const _redirect = require("./redirect");
|
||||
const _redirecterror = require("./redirect-error");
|
||||
const globalMutable = {};
|
||||
function isExternalURL(url) {
|
||||
return url.origin !== window.location.origin;
|
||||
}
|
||||
function createPrefetchURL(href) {
|
||||
// Don't prefetch for bots as they don't navigate.
|
||||
if ((0, _isbot.isBot)(window.navigator.userAgent)) {
|
||||
return null;
|
||||
}
|
||||
let url;
|
||||
try {
|
||||
url = new URL((0, _addbasepath.addBasePath)(href), window.location.href);
|
||||
} catch (_) {
|
||||
// TODO: Does this need to throw or can we just console.error instead? Does
|
||||
// anyone rely on this throwing? (Seems unlikely.)
|
||||
throw new Error("Cannot prefetch '" + href + "' because it cannot be converted to a URL.");
|
||||
}
|
||||
// Don't prefetch during development (improves compilation performance)
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
return null;
|
||||
}
|
||||
// External urls can't be prefetched in the same way.
|
||||
if (isExternalURL(url)) {
|
||||
return null;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
function HistoryUpdater(param) {
|
||||
let { appRouterState } = param;
|
||||
(0, _react.useInsertionEffect)(()=>{
|
||||
if (process.env.__NEXT_APP_NAV_FAIL_HANDLING) {
|
||||
// clear pending URL as navigation is no longer
|
||||
// in flight
|
||||
window.next.__pendingUrl = undefined;
|
||||
}
|
||||
const { tree, pushRef, canonicalUrl } = appRouterState;
|
||||
const historyState = {
|
||||
...pushRef.preserveCustomHistoryState ? window.history.state : {},
|
||||
// Identifier is shortened intentionally.
|
||||
// __NA is used to identify if the history entry can be handled by the app-router.
|
||||
// __N is used to identify if the history entry can be handled by the old router.
|
||||
__NA: true,
|
||||
__PRIVATE_NEXTJS_INTERNALS_TREE: tree
|
||||
};
|
||||
if (pushRef.pendingPush && // Skip pushing an additional history entry if the canonicalUrl is the same as the current url.
|
||||
// This mirrors the browser behavior for normal navigation.
|
||||
(0, _createhreffromurl.createHrefFromUrl)(new URL(window.location.href)) !== canonicalUrl) {
|
||||
// This intentionally mutates React state, pushRef is overwritten to ensure additional push/replace calls do not trigger an additional history entry.
|
||||
pushRef.pendingPush = false;
|
||||
window.history.pushState(historyState, '', canonicalUrl);
|
||||
} else {
|
||||
window.history.replaceState(historyState, '', canonicalUrl);
|
||||
}
|
||||
}, [
|
||||
appRouterState
|
||||
]);
|
||||
return null;
|
||||
}
|
||||
function createEmptyCacheNode() {
|
||||
return {
|
||||
lazyData: null,
|
||||
rsc: null,
|
||||
prefetchRsc: null,
|
||||
head: null,
|
||||
prefetchHead: null,
|
||||
parallelRoutes: new Map(),
|
||||
loading: null
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Server response that only patches the cache and tree.
|
||||
*/ function useChangeByServerResponse(dispatch) {
|
||||
return (0, _react.useCallback)((param)=>{
|
||||
let { previousTree, serverResponse } = param;
|
||||
(0, _react.startTransition)(()=>{
|
||||
dispatch({
|
||||
type: _routerreducertypes.ACTION_SERVER_PATCH,
|
||||
previousTree,
|
||||
serverResponse
|
||||
});
|
||||
});
|
||||
}, [
|
||||
dispatch
|
||||
]);
|
||||
}
|
||||
function useNavigate(dispatch) {
|
||||
return (0, _react.useCallback)((href, navigateType, shouldScroll)=>{
|
||||
const url = new URL((0, _addbasepath.addBasePath)(href), location.href);
|
||||
if (process.env.__NEXT_APP_NAV_FAIL_HANDLING) {
|
||||
window.next.__pendingUrl = url;
|
||||
}
|
||||
return dispatch({
|
||||
type: _routerreducertypes.ACTION_NAVIGATE,
|
||||
url,
|
||||
isExternalUrl: isExternalURL(url),
|
||||
locationSearch: location.search,
|
||||
shouldScroll: shouldScroll != null ? shouldScroll : true,
|
||||
navigateType,
|
||||
allowAliasing: true
|
||||
});
|
||||
}, [
|
||||
dispatch
|
||||
]);
|
||||
}
|
||||
function copyNextJsInternalHistoryState(data) {
|
||||
if (data == null) data = {};
|
||||
const currentState = window.history.state;
|
||||
const __NA = currentState == null ? void 0 : currentState.__NA;
|
||||
if (__NA) {
|
||||
data.__NA = __NA;
|
||||
}
|
||||
const __PRIVATE_NEXTJS_INTERNALS_TREE = currentState == null ? void 0 : currentState.__PRIVATE_NEXTJS_INTERNALS_TREE;
|
||||
if (__PRIVATE_NEXTJS_INTERNALS_TREE) {
|
||||
data.__PRIVATE_NEXTJS_INTERNALS_TREE = __PRIVATE_NEXTJS_INTERNALS_TREE;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function Head(param) {
|
||||
let { headCacheNode } = param;
|
||||
// If this segment has a `prefetchHead`, it's the statically prefetched data.
|
||||
// We should use that on initial render instead of `head`. Then we'll switch
|
||||
// to `head` when the dynamic response streams in.
|
||||
const head = headCacheNode !== null ? headCacheNode.head : null;
|
||||
const prefetchHead = headCacheNode !== null ? headCacheNode.prefetchHead : null;
|
||||
// If no prefetch data is available, then we go straight to rendering `head`.
|
||||
const resolvedPrefetchRsc = prefetchHead !== null ? prefetchHead : head;
|
||||
// We use `useDeferredValue` to handle switching between the prefetched and
|
||||
// final values. The second argument is returned on initial render, then it
|
||||
// re-renders with the first argument.
|
||||
//
|
||||
// @ts-expect-error The second argument to `useDeferredValue` is only
|
||||
// available in the experimental builds. When its disabled, it will always
|
||||
// return `head`.
|
||||
return (0, _react.useDeferredValue)(head, resolvedPrefetchRsc);
|
||||
}
|
||||
/**
|
||||
* The global router that wraps the application components.
|
||||
*/ function Router(param) {
|
||||
let { actionQueue, assetPrefix } = param;
|
||||
const [state, dispatch] = (0, _usereducer.useReducer)(actionQueue);
|
||||
const { canonicalUrl } = (0, _usereducer.useUnwrapState)(state);
|
||||
// Add memoized pathname/query for useSearchParams and usePathname.
|
||||
const { searchParams, pathname } = (0, _react.useMemo)(()=>{
|
||||
const url = new URL(canonicalUrl, typeof window === 'undefined' ? 'http://n' : window.location.href);
|
||||
return {
|
||||
// This is turned into a readonly class in `useSearchParams`
|
||||
searchParams: url.searchParams,
|
||||
pathname: (0, _hasbasepath.hasBasePath)(url.pathname) ? (0, _removebasepath.removeBasePath)(url.pathname) : url.pathname
|
||||
};
|
||||
}, [
|
||||
canonicalUrl
|
||||
]);
|
||||
const changeByServerResponse = useChangeByServerResponse(dispatch);
|
||||
const navigate = useNavigate(dispatch);
|
||||
(0, _appcallserver.useServerActionDispatcher)(dispatch);
|
||||
/**
|
||||
* The app router that is exposed through `useRouter`. It's only concerned with dispatching actions to the reducer, does not hold state.
|
||||
*/ const appRouter = (0, _react.useMemo)(()=>{
|
||||
const routerInstance = {
|
||||
back: ()=>window.history.back(),
|
||||
forward: ()=>window.history.forward(),
|
||||
prefetch: process.env.__NEXT_PPR && process.env.__NEXT_CLIENT_SEGMENT_CACHE ? // data in the router reducer state; it writes into a global mutable
|
||||
// cache. So we don't need to dispatch an action.
|
||||
(href)=>(0, _prefetch.prefetch)(href, actionQueue.state.nextUrl) : (href, options)=>{
|
||||
// Use the old prefetch implementation.
|
||||
const url = createPrefetchURL(href);
|
||||
if (url !== null) {
|
||||
(0, _react.startTransition)(()=>{
|
||||
var _options_kind;
|
||||
dispatch({
|
||||
type: _routerreducertypes.ACTION_PREFETCH,
|
||||
url,
|
||||
kind: (_options_kind = options == null ? void 0 : options.kind) != null ? _options_kind : _routerreducertypes.PrefetchKind.FULL
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
replace: (href, options)=>{
|
||||
if (options === void 0) options = {};
|
||||
(0, _react.startTransition)(()=>{
|
||||
var _options_scroll;
|
||||
navigate(href, 'replace', (_options_scroll = options.scroll) != null ? _options_scroll : true);
|
||||
});
|
||||
},
|
||||
push: (href, options)=>{
|
||||
if (options === void 0) options = {};
|
||||
(0, _react.startTransition)(()=>{
|
||||
var _options_scroll;
|
||||
navigate(href, 'push', (_options_scroll = options.scroll) != null ? _options_scroll : true);
|
||||
});
|
||||
},
|
||||
refresh: ()=>{
|
||||
(0, _react.startTransition)(()=>{
|
||||
dispatch({
|
||||
type: _routerreducertypes.ACTION_REFRESH,
|
||||
origin: window.location.origin
|
||||
});
|
||||
});
|
||||
},
|
||||
hmrRefresh: ()=>{
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
throw new Error('hmrRefresh can only be used in development mode. Please use refresh instead.');
|
||||
} else {
|
||||
(0, _react.startTransition)(()=>{
|
||||
dispatch({
|
||||
type: _routerreducertypes.ACTION_HMR_REFRESH,
|
||||
origin: window.location.origin
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return routerInstance;
|
||||
}, [
|
||||
actionQueue,
|
||||
dispatch,
|
||||
navigate
|
||||
]);
|
||||
(0, _react.useEffect)(()=>{
|
||||
// Exists for debugging purposes. Don't use in application code.
|
||||
if (window.next) {
|
||||
window.next.router = appRouter;
|
||||
}
|
||||
}, [
|
||||
appRouter
|
||||
]);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const { cache, prefetchCache, tree } = (0, _usereducer.useUnwrapState)(state);
|
||||
// This hook is in a conditional but that is ok because `process.env.NODE_ENV` never changes
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
(0, _react.useEffect)(()=>{
|
||||
// Add `window.nd` for debugging purposes.
|
||||
// This is not meant for use in applications as concurrent rendering will affect the cache/tree/router.
|
||||
// @ts-ignore this is for debugging
|
||||
window.nd = {
|
||||
router: appRouter,
|
||||
cache,
|
||||
prefetchCache,
|
||||
tree
|
||||
};
|
||||
}, [
|
||||
appRouter,
|
||||
cache,
|
||||
prefetchCache,
|
||||
tree
|
||||
]);
|
||||
}
|
||||
(0, _react.useEffect)(()=>{
|
||||
// If the app is restored from bfcache, it's possible that
|
||||
// pushRef.mpaNavigation is true, which would mean that any re-render of this component
|
||||
// would trigger the mpa navigation logic again from the lines below.
|
||||
// This will restore the router to the initial state in the event that the app is restored from bfcache.
|
||||
function handlePageShow(event) {
|
||||
var _window_history_state;
|
||||
if (!event.persisted || !((_window_history_state = window.history.state) == null ? void 0 : _window_history_state.__PRIVATE_NEXTJS_INTERNALS_TREE)) {
|
||||
return;
|
||||
}
|
||||
// Clear the pendingMpaPath value so that a subsequent MPA navigation to the same URL can be triggered.
|
||||
// This is necessary because if the browser restored from bfcache, the pendingMpaPath would still be set to the value
|
||||
// of the last MPA navigation.
|
||||
globalMutable.pendingMpaPath = undefined;
|
||||
dispatch({
|
||||
type: _routerreducertypes.ACTION_RESTORE,
|
||||
url: new URL(window.location.href),
|
||||
tree: window.history.state.__PRIVATE_NEXTJS_INTERNALS_TREE
|
||||
});
|
||||
}
|
||||
window.addEventListener('pageshow', handlePageShow);
|
||||
return ()=>{
|
||||
window.removeEventListener('pageshow', handlePageShow);
|
||||
};
|
||||
}, [
|
||||
dispatch
|
||||
]);
|
||||
(0, _react.useEffect)(()=>{
|
||||
// Ensure that any redirect errors that bubble up outside of the RedirectBoundary
|
||||
// are caught and handled by the router.
|
||||
function handleUnhandledRedirect(event) {
|
||||
const error = 'reason' in event ? event.reason : event.error;
|
||||
if ((0, _redirecterror.isRedirectError)(error)) {
|
||||
event.preventDefault();
|
||||
const url = (0, _redirect.getURLFromRedirectError)(error);
|
||||
const redirectType = (0, _redirect.getRedirectTypeFromError)(error);
|
||||
if (redirectType === _redirecterror.RedirectType.push) {
|
||||
appRouter.push(url, {});
|
||||
} else {
|
||||
appRouter.replace(url, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
window.addEventListener('error', handleUnhandledRedirect);
|
||||
window.addEventListener('unhandledrejection', handleUnhandledRedirect);
|
||||
return ()=>{
|
||||
window.removeEventListener('error', handleUnhandledRedirect);
|
||||
window.removeEventListener('unhandledrejection', handleUnhandledRedirect);
|
||||
};
|
||||
}, [
|
||||
appRouter
|
||||
]);
|
||||
// When mpaNavigation flag is set do a hard navigation to the new url.
|
||||
// Infinitely suspend because we don't actually want to rerender any child
|
||||
// components with the new URL and any entangled state updates shouldn't
|
||||
// commit either (eg: useTransition isPending should stay true until the page
|
||||
// unloads).
|
||||
//
|
||||
// This is a side effect in render. Don't try this at home, kids. It's
|
||||
// probably safe because we know this is a singleton component and it's never
|
||||
// in <Offscreen>. At least I hope so. (It will run twice in dev strict mode,
|
||||
// but that's... fine?)
|
||||
const { pushRef } = (0, _usereducer.useUnwrapState)(state);
|
||||
if (pushRef.mpaNavigation) {
|
||||
// if there's a re-render, we don't want to trigger another redirect if one is already in flight to the same URL
|
||||
if (globalMutable.pendingMpaPath !== canonicalUrl) {
|
||||
const location1 = window.location;
|
||||
if (pushRef.pendingPush) {
|
||||
location1.assign(canonicalUrl);
|
||||
} else {
|
||||
location1.replace(canonicalUrl);
|
||||
}
|
||||
globalMutable.pendingMpaPath = canonicalUrl;
|
||||
}
|
||||
// TODO-APP: Should we listen to navigateerror here to catch failed
|
||||
// navigations somehow? And should we call window.stop() if a SPA navigation
|
||||
// should interrupt an MPA one?
|
||||
(0, _react.use)(_unresolvedthenable.unresolvedThenable);
|
||||
}
|
||||
(0, _react.useEffect)(()=>{
|
||||
const originalPushState = window.history.pushState.bind(window.history);
|
||||
const originalReplaceState = window.history.replaceState.bind(window.history);
|
||||
// Ensure the canonical URL in the Next.js Router is updated when the URL is changed so that `usePathname` and `useSearchParams` hold the pushed values.
|
||||
const applyUrlFromHistoryPushReplace = (url)=>{
|
||||
var _window_history_state;
|
||||
const href = window.location.href;
|
||||
const tree = (_window_history_state = window.history.state) == null ? void 0 : _window_history_state.__PRIVATE_NEXTJS_INTERNALS_TREE;
|
||||
(0, _react.startTransition)(()=>{
|
||||
dispatch({
|
||||
type: _routerreducertypes.ACTION_RESTORE,
|
||||
url: new URL(url != null ? url : href, href),
|
||||
tree
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Patch pushState to ensure external changes to the history are reflected in the Next.js Router.
|
||||
* Ensures Next.js internal history state is copied to the new history entry.
|
||||
* Ensures usePathname and useSearchParams hold the newly provided url.
|
||||
*/ window.history.pushState = function pushState(data, _unused, url) {
|
||||
// Avoid a loop when Next.js internals trigger pushState/replaceState
|
||||
if ((data == null ? void 0 : data.__NA) || (data == null ? void 0 : data._N)) {
|
||||
return originalPushState(data, _unused, url);
|
||||
}
|
||||
data = copyNextJsInternalHistoryState(data);
|
||||
if (url) {
|
||||
applyUrlFromHistoryPushReplace(url);
|
||||
}
|
||||
return originalPushState(data, _unused, url);
|
||||
};
|
||||
/**
|
||||
* Patch replaceState to ensure external changes to the history are reflected in the Next.js Router.
|
||||
* Ensures Next.js internal history state is copied to the new history entry.
|
||||
* Ensures usePathname and useSearchParams hold the newly provided url.
|
||||
*/ window.history.replaceState = function replaceState(data, _unused, url) {
|
||||
// Avoid a loop when Next.js internals trigger pushState/replaceState
|
||||
if ((data == null ? void 0 : data.__NA) || (data == null ? void 0 : data._N)) {
|
||||
return originalReplaceState(data, _unused, url);
|
||||
}
|
||||
data = copyNextJsInternalHistoryState(data);
|
||||
if (url) {
|
||||
applyUrlFromHistoryPushReplace(url);
|
||||
}
|
||||
return originalReplaceState(data, _unused, url);
|
||||
};
|
||||
/**
|
||||
* Handle popstate event, this is used to handle back/forward in the browser.
|
||||
* By default dispatches ACTION_RESTORE, however if the history entry was not pushed/replaced by app-router it will reload the page.
|
||||
* That case can happen when the old router injected the history entry.
|
||||
*/ const onPopState = (event)=>{
|
||||
if (!event.state) {
|
||||
// TODO-APP: this case only happens when pushState/replaceState was called outside of Next.js. It should probably reload the page in this case.
|
||||
return;
|
||||
}
|
||||
// This case happens when the history entry was pushed by the `pages` router.
|
||||
if (!event.state.__NA) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
// TODO-APP: Ideally the back button should not use startTransition as it should apply the updates synchronously
|
||||
// Without startTransition works if the cache is there for this path
|
||||
(0, _react.startTransition)(()=>{
|
||||
dispatch({
|
||||
type: _routerreducertypes.ACTION_RESTORE,
|
||||
url: new URL(window.location.href),
|
||||
tree: event.state.__PRIVATE_NEXTJS_INTERNALS_TREE
|
||||
});
|
||||
});
|
||||
};
|
||||
// Register popstate event to call onPopstate.
|
||||
window.addEventListener('popstate', onPopState);
|
||||
return ()=>{
|
||||
window.history.pushState = originalPushState;
|
||||
window.history.replaceState = originalReplaceState;
|
||||
window.removeEventListener('popstate', onPopState);
|
||||
};
|
||||
}, [
|
||||
dispatch
|
||||
]);
|
||||
const { cache, tree, nextUrl, focusAndScrollRef } = (0, _usereducer.useUnwrapState)(state);
|
||||
const matchingHead = (0, _react.useMemo)(()=>{
|
||||
return (0, _findheadincache.findHeadInCache)(cache, tree[1]);
|
||||
}, [
|
||||
cache,
|
||||
tree
|
||||
]);
|
||||
// Add memoized pathParams for useParams.
|
||||
const pathParams = (0, _react.useMemo)(()=>{
|
||||
return (0, _computechangedpath.getSelectedParams)(tree);
|
||||
}, [
|
||||
tree
|
||||
]);
|
||||
const layoutRouterContext = (0, _react.useMemo)(()=>{
|
||||
return {
|
||||
childNodes: cache.parallelRoutes,
|
||||
tree,
|
||||
// Root node always has `url`
|
||||
// Provided in AppTreeContext to ensure it can be overwritten in layout-router
|
||||
url: canonicalUrl,
|
||||
loading: cache.loading
|
||||
};
|
||||
}, [
|
||||
cache.parallelRoutes,
|
||||
tree,
|
||||
canonicalUrl,
|
||||
cache.loading
|
||||
]);
|
||||
const globalLayoutRouterContext = (0, _react.useMemo)(()=>{
|
||||
return {
|
||||
changeByServerResponse,
|
||||
tree,
|
||||
focusAndScrollRef,
|
||||
nextUrl
|
||||
};
|
||||
}, [
|
||||
changeByServerResponse,
|
||||
tree,
|
||||
focusAndScrollRef,
|
||||
nextUrl
|
||||
]);
|
||||
let head;
|
||||
if (matchingHead !== null) {
|
||||
// The head is wrapped in an extra component so we can use
|
||||
// `useDeferredValue` to swap between the prefetched and final versions of
|
||||
// the head. (This is what LayoutRouter does for segment data, too.)
|
||||
//
|
||||
// The `key` is used to remount the component whenever the head moves to
|
||||
// a different segment.
|
||||
const [headCacheNode, headKey] = matchingHead;
|
||||
head = /*#__PURE__*/ (0, _jsxruntime.jsx)(Head, {
|
||||
headCacheNode: headCacheNode
|
||||
}, headKey);
|
||||
} else {
|
||||
head = null;
|
||||
}
|
||||
let content = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_redirectboundary.RedirectBoundary, {
|
||||
children: [
|
||||
head,
|
||||
cache.rsc,
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(_approuterannouncer.AppRouterAnnouncer, {
|
||||
tree: tree
|
||||
})
|
||||
]
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof window !== 'undefined') {
|
||||
const { DevRootHTTPAccessFallbackBoundary } = require('./dev-root-http-access-fallback-boundary');
|
||||
content = /*#__PURE__*/ (0, _jsxruntime.jsx)(DevRootHTTPAccessFallbackBoundary, {
|
||||
children: content
|
||||
});
|
||||
}
|
||||
const HotReloader = require('./react-dev-overlay/app/hot-reloader-client').default;
|
||||
content = /*#__PURE__*/ (0, _jsxruntime.jsx)(HotReloader, {
|
||||
assetPrefix: assetPrefix,
|
||||
children: content
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(HistoryUpdater, {
|
||||
appRouterState: (0, _usereducer.useUnwrapState)(state)
|
||||
}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(RuntimeStyles, {}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(_hooksclientcontextsharedruntime.PathParamsContext.Provider, {
|
||||
value: pathParams,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_hooksclientcontextsharedruntime.PathnameContext.Provider, {
|
||||
value: pathname,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_hooksclientcontextsharedruntime.SearchParamsContext.Provider, {
|
||||
value: searchParams,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.GlobalLayoutRouterContext.Provider, {
|
||||
value: globalLayoutRouterContext,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.AppRouterContext.Provider, {
|
||||
value: appRouter,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.LayoutRouterContext.Provider, {
|
||||
value: layoutRouterContext,
|
||||
children: content
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
function AppRouter(param) {
|
||||
let { actionQueue, globalErrorComponentAndStyles: [globalErrorComponent, globalErrorStyles], assetPrefix } = param;
|
||||
(0, _navfailurehandler.useNavFailureHandler)();
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_errorboundary.ErrorBoundary, {
|
||||
errorComponent: globalErrorComponent,
|
||||
errorStyles: globalErrorStyles,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Router, {
|
||||
actionQueue: actionQueue,
|
||||
assetPrefix: assetPrefix
|
||||
})
|
||||
});
|
||||
}
|
||||
const runtimeStyles = new Set();
|
||||
let runtimeStyleChanged = new Set();
|
||||
globalThis._N_E_STYLE_LOAD = function(href) {
|
||||
let len = runtimeStyles.size;
|
||||
runtimeStyles.add(href);
|
||||
if (runtimeStyles.size !== len) {
|
||||
runtimeStyleChanged.forEach((cb)=>cb());
|
||||
}
|
||||
// TODO figure out how to get a promise here
|
||||
// But maybe it's not necessary as react would block rendering until it's loaded
|
||||
return Promise.resolve();
|
||||
};
|
||||
function RuntimeStyles() {
|
||||
const [, forceUpdate] = _react.default.useState(0);
|
||||
const renderedStylesSize = runtimeStyles.size;
|
||||
(0, _react.useEffect)(()=>{
|
||||
const changed = ()=>forceUpdate((c)=>c + 1);
|
||||
runtimeStyleChanged.add(changed);
|
||||
if (renderedStylesSize !== runtimeStyles.size) {
|
||||
changed();
|
||||
}
|
||||
return ()=>{
|
||||
runtimeStyleChanged.delete(changed);
|
||||
};
|
||||
}, [
|
||||
renderedStylesSize,
|
||||
forceUpdate
|
||||
]);
|
||||
const dplId = process.env.NEXT_DEPLOYMENT_ID ? "?dpl=" + process.env.NEXT_DEPLOYMENT_ID : '';
|
||||
return [
|
||||
...runtimeStyles
|
||||
].map((href, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
|
||||
rel: "stylesheet",
|
||||
href: "" + href + dplId,
|
||||
// @ts-ignore
|
||||
precedence: "next"
|
||||
}, i));
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-router.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
export declare function bailoutToClientRendering(reason: string): void | never;
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "bailoutToClientRendering", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return bailoutToClientRendering;
|
||||
}
|
||||
});
|
||||
const _bailouttocsr = require("../../shared/lib/lazy-dynamic/bailout-to-csr");
|
||||
const _workasyncstorageexternal = require("../../server/app-render/work-async-storage.external");
|
||||
function bailoutToClientRendering(reason) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
if (workStore == null ? void 0 : workStore.forceStatic) return;
|
||||
if (workStore == null ? void 0 : workStore.isStaticGeneration) throw new _bailouttocsr.BailoutToCSRError(reason);
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=bailout-to-client-rendering.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/bailout-to-client-rendering.ts"],"sourcesContent":["import { BailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { workAsyncStorage } from '../../server/app-render/work-async-storage.external'\n\nexport function bailoutToClientRendering(reason: string): void | never {\n const workStore = workAsyncStorage.getStore()\n\n if (workStore?.forceStatic) return\n\n if (workStore?.isStaticGeneration) throw new BailoutToCSRError(reason)\n}\n"],"names":["bailoutToClientRendering","reason","workStore","workAsyncStorage","getStore","forceStatic","isStaticGeneration","BailoutToCSRError"],"mappings":";;;;+BAGgBA;;;eAAAA;;;8BAHkB;0CACD;AAE1B,SAASA,yBAAyBC,MAAc;IACrD,MAAMC,YAAYC,0CAAgB,CAACC,QAAQ;IAE3C,IAAIF,6BAAAA,UAAWG,WAAW,EAAE;IAE5B,IAAIH,6BAAAA,UAAWI,kBAAkB,EAAE,MAAM,IAAIC,+BAAiB,CAACN;AACjE"}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
import type { Params } from '../../server/request/params';
|
||||
/**
|
||||
* When the Page is a client component we send the params and searchParams to this client wrapper
|
||||
* where they are turned into dynamically tracked values before being passed to the actual Page component.
|
||||
*
|
||||
* additionally we may send promises representing the params and searchParams. We don't ever use these passed
|
||||
* values but it can be necessary for the sender to send a Promise that doesn't resolve in certain situations.
|
||||
* It is up to the caller to decide if the promises are needed.
|
||||
*/
|
||||
export declare function ClientPageRoot({ Component, searchParams, params, promises, }: {
|
||||
Component: React.ComponentType<any>;
|
||||
searchParams: ParsedUrlQuery;
|
||||
params: Params;
|
||||
promises?: Array<Promise<any>>;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
'use client';
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "ClientPageRoot", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return ClientPageRoot;
|
||||
}
|
||||
});
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
function ClientPageRoot(param) {
|
||||
let { Component, searchParams, params, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
promises } = param;
|
||||
if (typeof window === 'undefined') {
|
||||
const { workAsyncStorage } = require('../../server/app-render/work-async-storage.external');
|
||||
let clientSearchParams;
|
||||
let clientParams;
|
||||
// We are going to instrument the searchParams prop with tracking for the
|
||||
// appropriate context. We wrap differently in prerendering vs rendering
|
||||
const store = workAsyncStorage.getStore();
|
||||
if (!store) {
|
||||
throw new _invarianterror.InvariantError('Expected workStore to exist when handling searchParams in a client Page.');
|
||||
}
|
||||
const { createSearchParamsFromClient } = require('../../server/request/search-params');
|
||||
clientSearchParams = createSearchParamsFromClient(searchParams, store);
|
||||
const { createParamsFromClient } = require('../../server/request/params');
|
||||
clientParams = createParamsFromClient(params, store);
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, {
|
||||
params: clientParams,
|
||||
searchParams: clientSearchParams
|
||||
});
|
||||
} else {
|
||||
const { createRenderSearchParamsFromClient } = require('../../server/request/search-params.browser');
|
||||
const clientSearchParams = createRenderSearchParamsFromClient(searchParams);
|
||||
const { createRenderParamsFromClient } = require('../../server/request/params.browser');
|
||||
const clientParams = createRenderParamsFromClient(params);
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, {
|
||||
params: clientParams,
|
||||
searchParams: clientSearchParams
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=client-page.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/client-page.tsx"],"sourcesContent":["'use client'\n\nimport type { ParsedUrlQuery } from 'querystring'\nimport { InvariantError } from '../../shared/lib/invariant-error'\n\nimport type { Params } from '../../server/request/params'\n\n/**\n * When the Page is a client component we send the params and searchParams to this client wrapper\n * where they are turned into dynamically tracked values before being passed to the actual Page component.\n *\n * additionally we may send promises representing the params and searchParams. We don't ever use these passed\n * values but it can be necessary for the sender to send a Promise that doesn't resolve in certain situations.\n * It is up to the caller to decide if the promises are needed.\n */\nexport function ClientPageRoot({\n Component,\n searchParams,\n params,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n promises,\n}: {\n Component: React.ComponentType<any>\n searchParams: ParsedUrlQuery\n params: Params\n promises?: Array<Promise<any>>\n}) {\n if (typeof window === 'undefined') {\n const { workAsyncStorage } =\n require('../../server/app-render/work-async-storage.external') as typeof import('../../server/app-render/work-async-storage.external')\n\n let clientSearchParams: Promise<ParsedUrlQuery>\n let clientParams: Promise<Params>\n // We are going to instrument the searchParams prop with tracking for the\n // appropriate context. We wrap differently in prerendering vs rendering\n const store = workAsyncStorage.getStore()\n if (!store) {\n throw new InvariantError(\n 'Expected workStore to exist when handling searchParams in a client Page.'\n )\n }\n\n const { createSearchParamsFromClient } =\n require('../../server/request/search-params') as typeof import('../../server/request/search-params')\n clientSearchParams = createSearchParamsFromClient(searchParams, store)\n\n const { createParamsFromClient } =\n require('../../server/request/params') as typeof import('../../server/request/params')\n clientParams = createParamsFromClient(params, store)\n\n return <Component params={clientParams} searchParams={clientSearchParams} />\n } else {\n const { createRenderSearchParamsFromClient } =\n require('../../server/request/search-params.browser') as typeof import('../../server/request/search-params.browser')\n const clientSearchParams = createRenderSearchParamsFromClient(searchParams)\n const { createRenderParamsFromClient } =\n require('../../server/request/params.browser') as typeof import('../../server/request/params.browser')\n const clientParams = createRenderParamsFromClient(params)\n\n return <Component params={clientParams} searchParams={clientSearchParams} />\n }\n}\n"],"names":["ClientPageRoot","Component","searchParams","params","promises","window","workAsyncStorage","require","clientSearchParams","clientParams","store","getStore","InvariantError","createSearchParamsFromClient","createParamsFromClient","createRenderSearchParamsFromClient","createRenderParamsFromClient"],"mappings":"AAAA;;;;;+BAegBA;;;eAAAA;;;;gCAZe;AAYxB,SAASA,eAAe,KAW9B;IAX8B,IAAA,EAC7BC,SAAS,EACTC,YAAY,EACZC,MAAM,EACN,6DAA6D;IAC7DC,QAAQ,EAMT,GAX8B;IAY7B,IAAI,OAAOC,WAAW,aAAa;QACjC,MAAM,EAAEC,gBAAgB,EAAE,GACxBC,QAAQ;QAEV,IAAIC;QACJ,IAAIC;QACJ,yEAAyE;QACzE,wEAAwE;QACxE,MAAMC,QAAQJ,iBAAiBK,QAAQ;QACvC,IAAI,CAACD,OAAO;YACV,MAAM,IAAIE,8BAAc,CACtB;QAEJ;QAEA,MAAM,EAAEC,4BAA4B,EAAE,GACpCN,QAAQ;QACVC,qBAAqBK,6BAA6BX,cAAcQ;QAEhE,MAAM,EAAEI,sBAAsB,EAAE,GAC9BP,QAAQ;QACVE,eAAeK,uBAAuBX,QAAQO;QAE9C,qBAAO,qBAACT;YAAUE,QAAQM;YAAcP,cAAcM;;IACxD,OAAO;QACL,MAAM,EAAEO,kCAAkC,EAAE,GAC1CR,QAAQ;QACV,MAAMC,qBAAqBO,mCAAmCb;QAC9D,MAAM,EAAEc,4BAA4B,EAAE,GACpCT,QAAQ;QACV,MAAME,eAAeO,6BAA6Bb;QAElD,qBAAO,qBAACF;YAAUE,QAAQM;YAAcP,cAAcM;;IACxD;AACF"}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import type { Params } from '../../server/request/params';
|
||||
/**
|
||||
* When the Page is a client component we send the params to this client wrapper
|
||||
* where they are turned into dynamically tracked values before being passed to the actual Segment component.
|
||||
*
|
||||
* additionally we may send a promise representing params. We don't ever use this passed
|
||||
* value but it can be necessary for the sender to send a Promise that doesn't resolve in certain situations
|
||||
* such as when dynamicIO is enabled. It is up to the caller to decide if the promises are needed.
|
||||
*/
|
||||
export declare function ClientSegmentRoot({ Component, slots, params, promise, }: {
|
||||
Component: React.ComponentType<any>;
|
||||
slots: {
|
||||
[key: string]: React.ReactNode;
|
||||
};
|
||||
params: Params;
|
||||
promise?: Promise<any>;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
'use client';
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "ClientSegmentRoot", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return ClientSegmentRoot;
|
||||
}
|
||||
});
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
function ClientSegmentRoot(param) {
|
||||
let { Component, slots, params, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
promise } = param;
|
||||
if (typeof window === 'undefined') {
|
||||
const { workAsyncStorage } = require('../../server/app-render/work-async-storage.external');
|
||||
let clientParams;
|
||||
// We are going to instrument the searchParams prop with tracking for the
|
||||
// appropriate context. We wrap differently in prerendering vs rendering
|
||||
const store = workAsyncStorage.getStore();
|
||||
if (!store) {
|
||||
throw new _invarianterror.InvariantError('Expected workStore to exist when handling params in a client segment such as a Layout or Template.');
|
||||
}
|
||||
const { createParamsFromClient } = require('../../server/request/params');
|
||||
clientParams = createParamsFromClient(params, store);
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, {
|
||||
...slots,
|
||||
params: clientParams
|
||||
});
|
||||
} else {
|
||||
const { createRenderParamsFromClient } = require('../../server/request/params.browser');
|
||||
const clientParams = createRenderParamsFromClient(params);
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, {
|
||||
...slots,
|
||||
params: clientParams
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=client-segment.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/client-segment.tsx"],"sourcesContent":["'use client'\n\nimport { InvariantError } from '../../shared/lib/invariant-error'\n\nimport type { Params } from '../../server/request/params'\n\n/**\n * When the Page is a client component we send the params to this client wrapper\n * where they are turned into dynamically tracked values before being passed to the actual Segment component.\n *\n * additionally we may send a promise representing params. We don't ever use this passed\n * value but it can be necessary for the sender to send a Promise that doesn't resolve in certain situations\n * such as when dynamicIO is enabled. It is up to the caller to decide if the promises are needed.\n */\nexport function ClientSegmentRoot({\n Component,\n slots,\n params,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n promise,\n}: {\n Component: React.ComponentType<any>\n slots: { [key: string]: React.ReactNode }\n params: Params\n promise?: Promise<any>\n}) {\n if (typeof window === 'undefined') {\n const { workAsyncStorage } =\n require('../../server/app-render/work-async-storage.external') as typeof import('../../server/app-render/work-async-storage.external')\n\n let clientParams: Promise<Params>\n // We are going to instrument the searchParams prop with tracking for the\n // appropriate context. We wrap differently in prerendering vs rendering\n const store = workAsyncStorage.getStore()\n if (!store) {\n throw new InvariantError(\n 'Expected workStore to exist when handling params in a client segment such as a Layout or Template.'\n )\n }\n\n const { createParamsFromClient } =\n require('../../server/request/params') as typeof import('../../server/request/params')\n clientParams = createParamsFromClient(params, store)\n\n return <Component {...slots} params={clientParams} />\n } else {\n const { createRenderParamsFromClient } =\n require('../../server/request/params.browser') as typeof import('../../server/request/params.browser')\n const clientParams = createRenderParamsFromClient(params)\n return <Component {...slots} params={clientParams} />\n }\n}\n"],"names":["ClientSegmentRoot","Component","slots","params","promise","window","workAsyncStorage","require","clientParams","store","getStore","InvariantError","createParamsFromClient","createRenderParamsFromClient"],"mappings":"AAAA;;;;;+BAcgBA;;;eAAAA;;;;gCAZe;AAYxB,SAASA,kBAAkB,KAWjC;IAXiC,IAAA,EAChCC,SAAS,EACTC,KAAK,EACLC,MAAM,EACN,6DAA6D;IAC7DC,OAAO,EAMR,GAXiC;IAYhC,IAAI,OAAOC,WAAW,aAAa;QACjC,MAAM,EAAEC,gBAAgB,EAAE,GACxBC,QAAQ;QAEV,IAAIC;QACJ,yEAAyE;QACzE,wEAAwE;QACxE,MAAMC,QAAQH,iBAAiBI,QAAQ;QACvC,IAAI,CAACD,OAAO;YACV,MAAM,IAAIE,8BAAc,CACtB;QAEJ;QAEA,MAAM,EAAEC,sBAAsB,EAAE,GAC9BL,QAAQ;QACVC,eAAeI,uBAAuBT,QAAQM;QAE9C,qBAAO,qBAACR;YAAW,GAAGC,KAAK;YAAEC,QAAQK;;IACvC,OAAO;QACL,MAAM,EAAEK,4BAA4B,EAAE,GACpCN,QAAQ;QACV,MAAMC,eAAeK,6BAA6BV;QAClD,qBAAO,qBAACF;YAAW,GAAGC,KAAK;YAAEC,QAAQK;;IACvC;AACF"}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import React from 'react';
|
||||
export default function DefaultLayout({ children, }: {
|
||||
children: React.ReactNode;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return DefaultLayout;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
|
||||
function DefaultLayout(param) {
|
||||
let { children } = param;
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)("html", {
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("body", {
|
||||
children: children
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=default-layout.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/default-layout.tsx"],"sourcesContent":["import React from 'react'\n\nexport default function DefaultLayout({\n children,\n}: {\n children: React.ReactNode\n}) {\n return (\n <html>\n <body>{children}</body>\n </html>\n )\n}\n"],"names":["DefaultLayout","children","html","body"],"mappings":";;;;+BAEA;;;eAAwBA;;;;;gEAFN;AAEH,SAASA,cAAc,KAIrC;IAJqC,IAAA,EACpCC,QAAQ,EAGT,GAJqC;IAKpC,qBACE,qBAACC;kBACC,cAAA,qBAACC;sBAAMF;;;AAGb"}
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
export declare function bailOnRootNotFound(): void;
|
||||
export declare function DevRootHTTPAccessFallbackBoundary({ children, }: {
|
||||
children: React.ReactNode;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
Generated
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
'use client';
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
DevRootHTTPAccessFallbackBoundary: null,
|
||||
bailOnRootNotFound: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
DevRootHTTPAccessFallbackBoundary: function() {
|
||||
return DevRootHTTPAccessFallbackBoundary;
|
||||
},
|
||||
bailOnRootNotFound: function() {
|
||||
return bailOnRootNotFound;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
|
||||
const _errorboundary = require("./http-access-fallback/error-boundary");
|
||||
function bailOnRootNotFound() {
|
||||
throw new Error('notFound() is not allowed to use in root layout');
|
||||
}
|
||||
function NotAllowedRootHTTPFallbackError() {
|
||||
bailOnRootNotFound();
|
||||
return null;
|
||||
}
|
||||
function DevRootHTTPAccessFallbackBoundary(param) {
|
||||
let { children } = param;
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_errorboundary.HTTPAccessFallbackBoundary, {
|
||||
notFound: /*#__PURE__*/ (0, _jsxruntime.jsx)(NotAllowedRootHTTPFallbackError, {}),
|
||||
children: children
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=dev-root-http-access-fallback-boundary.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/dev-root-http-access-fallback-boundary.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\nimport { HTTPAccessFallbackBoundary } from './http-access-fallback/error-boundary'\n\n// TODO: error on using forbidden and unauthorized in root layout\nexport function bailOnRootNotFound() {\n throw new Error('notFound() is not allowed to use in root layout')\n}\n\nfunction NotAllowedRootHTTPFallbackError() {\n bailOnRootNotFound()\n return null\n}\n\nexport function DevRootHTTPAccessFallbackBoundary({\n children,\n}: {\n children: React.ReactNode\n}) {\n return (\n <HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError />}>\n {children}\n </HTTPAccessFallbackBoundary>\n )\n}\n"],"names":["DevRootHTTPAccessFallbackBoundary","bailOnRootNotFound","Error","NotAllowedRootHTTPFallbackError","children","HTTPAccessFallbackBoundary","notFound"],"mappings":"AAAA;;;;;;;;;;;;;;;;IAegBA,iCAAiC;eAAjCA;;IATAC,kBAAkB;eAAlBA;;;;;gEAJE;+BACyB;AAGpC,SAASA;IACd,MAAM,IAAIC,MAAM;AAClB;AAEA,SAASC;IACPF;IACA,OAAO;AACT;AAEO,SAASD,kCAAkC,KAIjD;IAJiD,IAAA,EAChDI,QAAQ,EAGT,GAJiD;IAKhD,qBACE,qBAACC,yCAA0B;QAACC,wBAAU,qBAACH;kBACpCC;;AAGP"}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import React, { type JSX } from 'react';
|
||||
export type ErrorComponent = React.ComponentType<{
|
||||
error: Error;
|
||||
reset: () => void;
|
||||
}>;
|
||||
export interface ErrorBoundaryProps {
|
||||
children?: React.ReactNode;
|
||||
errorComponent: ErrorComponent | undefined;
|
||||
errorStyles?: React.ReactNode | undefined;
|
||||
errorScripts?: React.ReactNode | undefined;
|
||||
}
|
||||
interface ErrorBoundaryHandlerProps extends ErrorBoundaryProps {
|
||||
pathname: string | null;
|
||||
errorComponent: ErrorComponent;
|
||||
}
|
||||
interface ErrorBoundaryHandlerState {
|
||||
error: Error | null;
|
||||
previousPathname: string | null;
|
||||
}
|
||||
export declare class ErrorBoundaryHandler extends React.Component<ErrorBoundaryHandlerProps, ErrorBoundaryHandlerState> {
|
||||
constructor(props: ErrorBoundaryHandlerProps);
|
||||
static getDerivedStateFromError(error: Error): {
|
||||
error: Error;
|
||||
};
|
||||
static getDerivedStateFromProps(props: ErrorBoundaryHandlerProps, state: ErrorBoundaryHandlerState): ErrorBoundaryHandlerState | null;
|
||||
reset: () => void;
|
||||
render(): React.ReactNode;
|
||||
}
|
||||
export declare function GlobalError({ error }: {
|
||||
error: any;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
export default GlobalError;
|
||||
/**
|
||||
* Handles errors through `getDerivedStateFromError`.
|
||||
* Renders the provided error component and provides a way to `reset` the error boundary state.
|
||||
*/
|
||||
/**
|
||||
* Renders error boundary with the provided "errorComponent" property as the fallback.
|
||||
* If no "errorComponent" property is provided it renders the children without an error boundary.
|
||||
*/
|
||||
export declare function ErrorBoundary({ errorComponent, errorStyles, errorScripts, children, }: ErrorBoundaryProps & {
|
||||
children: React.ReactNode;
|
||||
}): JSX.Element;
|
||||
+204
@@ -0,0 +1,204 @@
|
||||
'use client';
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
ErrorBoundary: null,
|
||||
ErrorBoundaryHandler: null,
|
||||
GlobalError: null,
|
||||
default: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
ErrorBoundary: function() {
|
||||
return ErrorBoundary;
|
||||
},
|
||||
ErrorBoundaryHandler: function() {
|
||||
return ErrorBoundaryHandler;
|
||||
},
|
||||
GlobalError: function() {
|
||||
return GlobalError;
|
||||
},
|
||||
// Exported so that the import signature in the loaders can be identical to user
|
||||
// supplied custom global error signatures.
|
||||
default: function() {
|
||||
return _default;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
|
||||
const _navigationuntracked = require("./navigation-untracked");
|
||||
const _isnextroutererror = require("./is-next-router-error");
|
||||
const _navfailurehandler = require("./nav-failure-handler");
|
||||
const _workasyncstorageexternal = require("../../server/app-render/work-async-storage.external");
|
||||
const styles = {
|
||||
error: {
|
||||
// https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52
|
||||
fontFamily: 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
|
||||
height: '100vh',
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
text: {
|
||||
fontSize: '14px',
|
||||
fontWeight: 400,
|
||||
lineHeight: '28px',
|
||||
margin: '0 8px'
|
||||
}
|
||||
};
|
||||
// if we are revalidating we want to re-throw the error so the
|
||||
// function crashes so we can maintain our previous cache
|
||||
// instead of caching the error page
|
||||
function HandleISRError(param) {
|
||||
let { error } = param;
|
||||
const store = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
if ((store == null ? void 0 : store.isRevalidate) || (store == null ? void 0 : store.isStaticGeneration)) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
class ErrorBoundaryHandler extends _react.default.Component {
|
||||
static getDerivedStateFromError(error) {
|
||||
if ((0, _isnextroutererror.isNextRouterError)(error)) {
|
||||
// Re-throw if an expected internal Next.js router error occurs
|
||||
// this means it should be handled by a different boundary (such as a NotFound boundary in a parent segment)
|
||||
throw error;
|
||||
}
|
||||
return {
|
||||
error
|
||||
};
|
||||
}
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
const { error } = state;
|
||||
// if we encounter an error while
|
||||
// a navigation is pending we shouldn't render
|
||||
// the error boundary and instead should fallback
|
||||
// to a hard navigation to attempt recovering
|
||||
if (process.env.__NEXT_APP_NAV_FAIL_HANDLING) {
|
||||
if (error && (0, _navfailurehandler.handleHardNavError)(error)) {
|
||||
// clear error so we don't render anything
|
||||
return {
|
||||
error: null,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Handles reset of the error boundary when a navigation happens.
|
||||
* Ensures the error boundary does not stay enabled when navigating to a new page.
|
||||
* Approach of setState in render is safe as it checks the previous pathname and then overrides
|
||||
* it as outlined in https://react.dev/reference/react/useState#storing-information-from-previous-renders
|
||||
*/ if (props.pathname !== state.previousPathname && state.error) {
|
||||
return {
|
||||
error: null,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
return {
|
||||
error: state.error,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
// Explicit type is needed to avoid the generated `.d.ts` having a wide return type that could be specific to the `@types/react` version.
|
||||
render() {
|
||||
if (this.state.error) {
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(HandleISRError, {
|
||||
error: this.state.error
|
||||
}),
|
||||
this.props.errorStyles,
|
||||
this.props.errorScripts,
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(this.props.errorComponent, {
|
||||
error: this.state.error,
|
||||
reset: this.reset
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
return this.props.children;
|
||||
}
|
||||
constructor(props){
|
||||
super(props), this.reset = ()=>{
|
||||
this.setState({
|
||||
error: null
|
||||
});
|
||||
};
|
||||
this.state = {
|
||||
error: null,
|
||||
previousPathname: this.props.pathname
|
||||
};
|
||||
}
|
||||
}
|
||||
function GlobalError(param) {
|
||||
let { error } = param;
|
||||
const digest = error == null ? void 0 : error.digest;
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("html", {
|
||||
id: "__next_error__",
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("head", {}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsxs)("body", {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(HandleISRError, {
|
||||
error: error
|
||||
}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
||||
style: styles.error,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("h2", {
|
||||
style: styles.text,
|
||||
children: "Application error: a " + (digest ? 'server' : 'client') + "-side exception has occurred (see the " + (digest ? 'server logs' : 'browser console') + " for more information)."
|
||||
}),
|
||||
digest ? /*#__PURE__*/ (0, _jsxruntime.jsx)("p", {
|
||||
style: styles.text,
|
||||
children: "Digest: " + digest
|
||||
}) : null
|
||||
]
|
||||
})
|
||||
})
|
||||
]
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
const _default = GlobalError;
|
||||
function ErrorBoundary(param) {
|
||||
let { errorComponent, errorStyles, errorScripts, children } = param;
|
||||
// When we're rendering the missing params shell, this will return null. This
|
||||
// is because we won't be rendering any not found boundaries or error
|
||||
// boundaries for the missing params shell. When this runs on the client
|
||||
// (where these errors can occur), we will get the correct pathname.
|
||||
const pathname = (0, _navigationuntracked.useUntrackedPathname)();
|
||||
if (errorComponent) {
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(ErrorBoundaryHandler, {
|
||||
pathname: pathname,
|
||||
errorComponent: errorComponent,
|
||||
errorStyles: errorStyles,
|
||||
errorScripts: errorScripts,
|
||||
children: children
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
||||
children: children
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=error-boundary.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
export default function Forbidden(): import("react/jsx-runtime").JSX.Element;
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return Forbidden;
|
||||
}
|
||||
});
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _errorfallback = require("./http-access-fallback/error-fallback");
|
||||
function Forbidden() {
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_errorfallback.HTTPAccessErrorFallback, {
|
||||
status: 403,
|
||||
message: "This page could not be accessed."
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=forbidden-error.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/forbidden-error.tsx"],"sourcesContent":["import { HTTPAccessErrorFallback } from './http-access-fallback/error-fallback'\n\nexport default function Forbidden() {\n return (\n <HTTPAccessErrorFallback\n status={403}\n message=\"This page could not be accessed.\"\n />\n )\n}\n"],"names":["Forbidden","HTTPAccessErrorFallback","status","message"],"mappings":";;;;+BAEA;;;eAAwBA;;;;+BAFgB;AAEzB,SAASA;IACtB,qBACE,qBAACC,sCAAuB;QACtBC,QAAQ;QACRC,SAAQ;;AAGd"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function forbidden(): never;
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "forbidden", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return forbidden;
|
||||
}
|
||||
});
|
||||
const _httpaccessfallback = require("./http-access-fallback/http-access-fallback");
|
||||
// TODO: Add `forbidden` docs
|
||||
/**
|
||||
* @experimental
|
||||
* This function allows you to render the [forbidden.js file](https://nextjs.org/docs/app/api-reference/file-conventions/forbidden)
|
||||
* within a route segment as well as inject a tag.
|
||||
*
|
||||
* `forbidden()` can be used in
|
||||
* [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),
|
||||
* [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and
|
||||
* [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
|
||||
*
|
||||
* Read more: [Next.js Docs: `forbidden`](https://nextjs.org/docs/app/api-reference/functions/forbidden)
|
||||
*/ const DIGEST = "" + _httpaccessfallback.HTTP_ERROR_FALLBACK_ERROR_CODE + ";403";
|
||||
function forbidden() {
|
||||
if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {
|
||||
throw new Error("`forbidden()` is experimental and only allowed to be enabled when `experimental.authInterrupts` is enabled.");
|
||||
}
|
||||
// eslint-disable-next-line no-throw-literal
|
||||
const error = new Error(DIGEST);
|
||||
error.digest = DIGEST;
|
||||
throw error;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=forbidden.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/forbidden.ts"],"sourcesContent":["import {\n HTTP_ERROR_FALLBACK_ERROR_CODE,\n type HTTPAccessFallbackError,\n} from './http-access-fallback/http-access-fallback'\n\n// TODO: Add `forbidden` docs\n/**\n * @experimental\n * This function allows you to render the [forbidden.js file](https://nextjs.org/docs/app/api-reference/file-conventions/forbidden)\n * within a route segment as well as inject a tag.\n *\n * `forbidden()` can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * Read more: [Next.js Docs: `forbidden`](https://nextjs.org/docs/app/api-reference/functions/forbidden)\n */\n\nconst DIGEST = `${HTTP_ERROR_FALLBACK_ERROR_CODE};403`\n\nexport function forbidden(): never {\n if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {\n throw new Error(\n `\\`forbidden()\\` is experimental and only allowed to be enabled when \\`experimental.authInterrupts\\` is enabled.`\n )\n }\n\n // eslint-disable-next-line no-throw-literal\n const error = new Error(DIGEST) as HTTPAccessFallbackError\n ;(error as HTTPAccessFallbackError).digest = DIGEST\n throw error\n}\n"],"names":["forbidden","DIGEST","HTTP_ERROR_FALLBACK_ERROR_CODE","process","env","__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS","Error","error","digest"],"mappings":";;;;+BAqBgBA;;;eAAAA;;;oCAlBT;AAEP,6BAA6B;AAC7B;;;;;;;;;;;CAWC,GAED,MAAMC,SAAS,AAAC,KAAEC,kDAA8B,GAAC;AAE1C,SAASF;IACd,IAAI,CAACG,QAAQC,GAAG,CAACC,mCAAmC,EAAE;QACpD,MAAM,IAAIC,MACP;IAEL;IAEA,4CAA4C;IAC5C,MAAMC,QAAQ,IAAID,MAAML;IACtBM,MAAkCC,MAAM,GAAGP;IAC7C,MAAMM;AACR"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const _useerrorhandler = require("../react-dev-overlay/internal/helpers/use-error-handler");
|
||||
(0, _useerrorhandler.handleGlobalErrors)();
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=handle-global-errors.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/client/components/globals/handle-global-errors.ts"],"sourcesContent":["import { handleGlobalErrors } from '../react-dev-overlay/internal/helpers/use-error-handler'\n\nhandleGlobalErrors()\n"],"names":["handleGlobalErrors"],"mappings":";;;;iCAAmC;AAEnCA,IAAAA,mCAAkB"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
export declare const originConsoleError: {
|
||||
(...data: any[]): void;
|
||||
(message?: any, ...optionalParams: any[]): void;
|
||||
};
|
||||
export declare function patchConsoleError(): void;
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
originConsoleError: null,
|
||||
patchConsoleError: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
originConsoleError: function() {
|
||||
return originConsoleError;
|
||||
},
|
||||
patchConsoleError: function() {
|
||||
return patchConsoleError;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _iserror = /*#__PURE__*/ _interop_require_default._(require("../../../lib/is-error"));
|
||||
const _isnextroutererror = require("../is-next-router-error");
|
||||
const _useerrorhandler = require("../react-dev-overlay/internal/helpers/use-error-handler");
|
||||
const originConsoleError = window.console.error;
|
||||
function patchConsoleError() {
|
||||
// Ensure it's only patched once
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
window.console.error = function error() {
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
let maybeError;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const replayedError = matchReplayedError(...args);
|
||||
if (replayedError) {
|
||||
maybeError = replayedError;
|
||||
} else if ((0, _iserror.default)(args[0])) {
|
||||
maybeError = args[0];
|
||||
} else {
|
||||
// See https://github.com/facebook/react/blob/d50323eb845c5fde0d720cae888bf35dedd05506/packages/react-reconciler/src/ReactFiberErrorLogger.js#L78
|
||||
maybeError = args[1];
|
||||
}
|
||||
} else {
|
||||
maybeError = args[0];
|
||||
}
|
||||
if (!(0, _isnextroutererror.isNextRouterError)(maybeError)) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(0, _useerrorhandler.handleClientError)(// replayed errors have their own complex format string that should be used,
|
||||
// but if we pass the error directly, `handleClientError` will ignore it
|
||||
maybeError, args, true);
|
||||
}
|
||||
originConsoleError.apply(window.console, args);
|
||||
}
|
||||
};
|
||||
}
|
||||
function matchReplayedError() {
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
// See
|
||||
// https://github.com/facebook/react/blob/65a56d0e99261481c721334a3ec4561d173594cd/packages/react-devtools-shared/src/backend/flight/renderer.js#L88-L93
|
||||
//
|
||||
// Logs replayed from the server look like this:
|
||||
// [
|
||||
// "%c%s%c %o\n\n%s\n\n%s\n",
|
||||
// "background: #e6e6e6; ...",
|
||||
// " Server ", // can also be e.g. " Prerender "
|
||||
// "",
|
||||
// Error
|
||||
// "The above error occurred in the <Page> component."
|
||||
// ...
|
||||
// ]
|
||||
if (args.length > 3 && typeof args[0] === 'string' && args[0].startsWith('%c%s%c ') && typeof args[1] === 'string' && typeof args[2] === 'string' && typeof args[3] === 'string') {
|
||||
const maybeError = args[4];
|
||||
if ((0, _iserror.default)(maybeError)) {
|
||||
return maybeError;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=intercept-console-error.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/client/components/globals/intercept-console-error.ts"],"sourcesContent":["import isError from '../../../lib/is-error'\nimport { isNextRouterError } from '../is-next-router-error'\nimport { handleClientError } from '../react-dev-overlay/internal/helpers/use-error-handler'\n\nexport const originConsoleError = window.console.error\n\n// Patch console.error to collect information about hydration errors\nexport function patchConsoleError() {\n // Ensure it's only patched once\n if (typeof window === 'undefined') {\n return\n }\n window.console.error = function error(...args: any[]) {\n let maybeError: unknown\n if (process.env.NODE_ENV !== 'production') {\n const replayedError = matchReplayedError(...args)\n if (replayedError) {\n maybeError = replayedError\n } else if (isError(args[0])) {\n maybeError = args[0]\n } else {\n // See https://github.com/facebook/react/blob/d50323eb845c5fde0d720cae888bf35dedd05506/packages/react-reconciler/src/ReactFiberErrorLogger.js#L78\n maybeError = args[1]\n }\n } else {\n maybeError = args[0]\n }\n\n if (!isNextRouterError(maybeError)) {\n if (process.env.NODE_ENV !== 'production') {\n handleClientError(\n // replayed errors have their own complex format string that should be used,\n // but if we pass the error directly, `handleClientError` will ignore it\n maybeError,\n args,\n true\n )\n }\n\n originConsoleError.apply(window.console, args)\n }\n }\n}\n\nfunction matchReplayedError(...args: unknown[]): Error | null {\n // See\n // https://github.com/facebook/react/blob/65a56d0e99261481c721334a3ec4561d173594cd/packages/react-devtools-shared/src/backend/flight/renderer.js#L88-L93\n //\n // Logs replayed from the server look like this:\n // [\n // \"%c%s%c %o\\n\\n%s\\n\\n%s\\n\",\n // \"background: #e6e6e6; ...\",\n // \" Server \", // can also be e.g. \" Prerender \"\n // \"\",\n // Error\n // \"The above error occurred in the <Page> component.\"\n // ...\n // ]\n if (\n args.length > 3 &&\n typeof args[0] === 'string' &&\n args[0].startsWith('%c%s%c ') &&\n typeof args[1] === 'string' &&\n typeof args[2] === 'string' &&\n typeof args[3] === 'string'\n ) {\n const maybeError = args[4]\n if (isError(maybeError)) {\n return maybeError\n }\n }\n\n return null\n}\n"],"names":["originConsoleError","patchConsoleError","window","console","error","args","maybeError","process","env","NODE_ENV","replayedError","matchReplayedError","isError","isNextRouterError","handleClientError","apply","length","startsWith"],"mappings":";;;;;;;;;;;;;;;IAIaA,kBAAkB;eAAlBA;;IAGGC,iBAAiB;eAAjBA;;;;kEAPI;mCACc;iCACA;AAE3B,MAAMD,qBAAqBE,OAAOC,OAAO,CAACC,KAAK;AAG/C,SAASH;IACd,gCAAgC;IAChC,IAAI,OAAOC,WAAW,aAAa;QACjC;IACF;IACAA,OAAOC,OAAO,CAACC,KAAK,GAAG,SAASA;QAAM,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGC,OAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA;YAAGA,KAAH,QAAA,SAAA,CAAA,KAAc;;QAClD,IAAIC;QACJ,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,MAAMC,gBAAgBC,sBAAsBN;YAC5C,IAAIK,eAAe;gBACjBJ,aAAaI;YACf,OAAO,IAAIE,IAAAA,gBAAO,EAACP,IAAI,CAAC,EAAE,GAAG;gBAC3BC,aAAaD,IAAI,CAAC,EAAE;YACtB,OAAO;gBACL,iJAAiJ;gBACjJC,aAAaD,IAAI,CAAC,EAAE;YACtB;QACF,OAAO;YACLC,aAAaD,IAAI,CAAC,EAAE;QACtB;QAEA,IAAI,CAACQ,IAAAA,oCAAiB,EAACP,aAAa;YAClC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzCK,IAAAA,kCAAiB,EACf,4EAA4E;gBAC5E,wEAAwE;gBACxER,YACAD,MACA;YAEJ;YAEAL,mBAAmBe,KAAK,CAACb,OAAOC,OAAO,EAAEE;QAC3C;IACF;AACF;AAEA,SAASM;IAAmB,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGN,OAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA;QAAGA,KAAH,QAAA,SAAA,CAAA,KAAkB;;IAC5C,MAAM;IACN,wJAAwJ;IACxJ,EAAE;IACF,gDAAgD;IAChD,IAAI;IACJ,+BAA+B;IAC/B,gCAAgC;IAChC,kDAAkD;IAClD,QAAQ;IACR,UAAU;IACV,wDAAwD;IACxD,QAAQ;IACR,IAAI;IACJ,IACEA,KAAKW,MAAM,GAAG,KACd,OAAOX,IAAI,CAAC,EAAE,KAAK,YACnBA,IAAI,CAAC,EAAE,CAACY,UAAU,CAAC,cACnB,OAAOZ,IAAI,CAAC,EAAE,KAAK,YACnB,OAAOA,IAAI,CAAC,EAAE,KAAK,YACnB,OAAOA,IAAI,CAAC,EAAE,KAAK,UACnB;QACA,MAAMC,aAAaD,IAAI,CAAC,EAAE;QAC1B,IAAIO,IAAAA,gBAAO,EAACN,aAAa;YACvB,OAAOA;QACT;IACF;IAEA,OAAO;AACT"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const _interceptconsoleerror = require("./intercept-console-error");
|
||||
(0, _interceptconsoleerror.patchConsoleError)();
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=patch-console.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/client/components/globals/patch-console.ts"],"sourcesContent":["import { patchConsoleError } from './intercept-console-error'\n\npatchConsoleError()\n"],"names":["patchConsoleError"],"mappings":";;;;uCAAkC;AAElCA,IAAAA,wCAAiB"}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
declare const DYNAMIC_ERROR_CODE = "DYNAMIC_SERVER_USAGE";
|
||||
export declare class DynamicServerError extends Error {
|
||||
readonly description: string;
|
||||
digest: typeof DYNAMIC_ERROR_CODE;
|
||||
constructor(description: string);
|
||||
}
|
||||
export declare function isDynamicServerError(err: unknown): err is DynamicServerError;
|
||||
export {};
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
DynamicServerError: null,
|
||||
isDynamicServerError: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
DynamicServerError: function() {
|
||||
return DynamicServerError;
|
||||
},
|
||||
isDynamicServerError: function() {
|
||||
return isDynamicServerError;
|
||||
}
|
||||
});
|
||||
const DYNAMIC_ERROR_CODE = 'DYNAMIC_SERVER_USAGE';
|
||||
class DynamicServerError extends Error {
|
||||
constructor(description){
|
||||
super("Dynamic server usage: " + description), this.description = description, this.digest = DYNAMIC_ERROR_CODE;
|
||||
}
|
||||
}
|
||||
function isDynamicServerError(err) {
|
||||
if (typeof err !== 'object' || err === null || !('digest' in err) || typeof err.digest !== 'string') {
|
||||
return false;
|
||||
}
|
||||
return err.digest === DYNAMIC_ERROR_CODE;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=hooks-server-context.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/components/hooks-server-context.ts"],"sourcesContent":["const DYNAMIC_ERROR_CODE = 'DYNAMIC_SERVER_USAGE'\n\nexport class DynamicServerError extends Error {\n digest: typeof DYNAMIC_ERROR_CODE = DYNAMIC_ERROR_CODE\n\n constructor(public readonly description: string) {\n super(`Dynamic server usage: ${description}`)\n }\n}\n\nexport function isDynamicServerError(err: unknown): err is DynamicServerError {\n if (\n typeof err !== 'object' ||\n err === null ||\n !('digest' in err) ||\n typeof err.digest !== 'string'\n ) {\n return false\n }\n\n return err.digest === DYNAMIC_ERROR_CODE\n}\n"],"names":["DynamicServerError","isDynamicServerError","DYNAMIC_ERROR_CODE","Error","constructor","description","digest","err"],"mappings":";;;;;;;;;;;;;;;IAEaA,kBAAkB;eAAlBA;;IAQGC,oBAAoB;eAApBA;;;AAVhB,MAAMC,qBAAqB;AAEpB,MAAMF,2BAA2BG;IAGtCC,YAAY,AAAgBC,WAAmB,CAAE;QAC/C,KAAK,CAAC,AAAC,2BAAwBA,mBADLA,cAAAA,kBAF5BC,SAAoCJ;IAIpC;AACF;AAEO,SAASD,qBAAqBM,GAAY;IAC/C,IACE,OAAOA,QAAQ,YACfA,QAAQ,QACR,CAAE,CAAA,YAAYA,GAAE,KAChB,OAAOA,IAAID,MAAM,KAAK,UACtB;QACA,OAAO;IACT;IAEA,OAAOC,IAAID,MAAM,KAAKJ;AACxB"}
|
||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* HTTPAccessFallbackBoundary is a boundary that catches errors and renders a
|
||||
* fallback component for HTTP errors.
|
||||
*
|
||||
* It receives the status code, and determine if it should render fallbacks for few HTTP 4xx errors.
|
||||
*
|
||||
* e.g. 404
|
||||
* 404 represents not found, and the fallback component pair contains the component and its styles.
|
||||
*
|
||||
*/
|
||||
import React from 'react';
|
||||
interface HTTPAccessFallbackBoundaryProps {
|
||||
notFound?: React.ReactNode;
|
||||
forbidden?: React.ReactNode;
|
||||
unauthorized?: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
missingSlots?: Set<string>;
|
||||
}
|
||||
export declare function HTTPAccessFallbackBoundary({ notFound, forbidden, unauthorized, children, }: HTTPAccessFallbackBoundaryProps): import("react/jsx-runtime").JSX.Element;
|
||||
export {};
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
'use client';
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "HTTPAccessFallbackBoundary", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return HTTPAccessFallbackBoundary;
|
||||
}
|
||||
});
|
||||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
||||
const _navigationuntracked = require("../navigation-untracked");
|
||||
const _httpaccessfallback = require("./http-access-fallback");
|
||||
const _warnonce = require("../../../shared/lib/utils/warn-once");
|
||||
const _approutercontextsharedruntime = require("../../../shared/lib/app-router-context.shared-runtime");
|
||||
class HTTPAccessFallbackErrorBoundary extends _react.default.Component {
|
||||
componentDidCatch() {
|
||||
if (process.env.NODE_ENV === 'development' && this.props.missingSlots && // A missing children slot is the typical not-found case, so no need to warn
|
||||
!this.props.missingSlots.has('children')) {
|
||||
let warningMessage = 'No default component was found for a parallel route rendered on this page. Falling back to nearest NotFound boundary.\n' + 'Learn more: https://nextjs.org/docs/app/building-your-application/routing/parallel-routes#defaultjs\n\n';
|
||||
if (this.props.missingSlots.size > 0) {
|
||||
const formattedSlots = Array.from(this.props.missingSlots).sort((a, b)=>a.localeCompare(b)).map((slot)=>"@" + slot).join(', ');
|
||||
warningMessage += 'Missing slots: ' + formattedSlots;
|
||||
}
|
||||
(0, _warnonce.warnOnce)(warningMessage);
|
||||
}
|
||||
}
|
||||
static getDerivedStateFromError(error) {
|
||||
if ((0, _httpaccessfallback.isHTTPAccessFallbackError)(error)) {
|
||||
const httpStatus = (0, _httpaccessfallback.getAccessFallbackHTTPStatus)(error);
|
||||
return {
|
||||
triggeredStatus: httpStatus
|
||||
};
|
||||
}
|
||||
// Re-throw if error is not for 404
|
||||
throw error;
|
||||
}
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
/**
|
||||
* Handles reset of the error boundary when a navigation happens.
|
||||
* Ensures the error boundary does not stay enabled when navigating to a new page.
|
||||
* Approach of setState in render is safe as it checks the previous pathname and then overrides
|
||||
* it as outlined in https://react.dev/reference/react/useState#storing-information-from-previous-renders
|
||||
*/ if (props.pathname !== state.previousPathname && state.triggeredStatus) {
|
||||
return {
|
||||
triggeredStatus: undefined,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
return {
|
||||
triggeredStatus: state.triggeredStatus,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
render() {
|
||||
const { notFound, forbidden, unauthorized, children } = this.props;
|
||||
const { triggeredStatus } = this.state;
|
||||
const errorComponents = {
|
||||
[_httpaccessfallback.HTTPAccessErrorStatus.NOT_FOUND]: notFound,
|
||||
[_httpaccessfallback.HTTPAccessErrorStatus.FORBIDDEN]: forbidden,
|
||||
[_httpaccessfallback.HTTPAccessErrorStatus.UNAUTHORIZED]: unauthorized
|
||||
};
|
||||
if (triggeredStatus) {
|
||||
const isNotFound = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.NOT_FOUND && notFound;
|
||||
const isForbidden = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.FORBIDDEN && forbidden;
|
||||
const isUnauthorized = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.UNAUTHORIZED && unauthorized;
|
||||
// If there's no matched boundary in this layer, keep throwing the error by rendering the children
|
||||
if (!(isNotFound || isForbidden || isUnauthorized)) {
|
||||
return children;
|
||||
}
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
||||
name: "robots",
|
||||
content: "noindex"
|
||||
}),
|
||||
process.env.NODE_ENV === 'development' && /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
||||
name: "next-error",
|
||||
content: (0, _httpaccessfallback.getAccessFallbackErrorTypeByStatus)(triggeredStatus)
|
||||
}),
|
||||
errorComponents[triggeredStatus]
|
||||
]
|
||||
});
|
||||
}
|
||||
return children;
|
||||
}
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state = {
|
||||
triggeredStatus: undefined,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
}
|
||||
function HTTPAccessFallbackBoundary(param) {
|
||||
let { notFound, forbidden, unauthorized, children } = param;
|
||||
// When we're rendering the missing params shell, this will return null. This
|
||||
// is because we won't be rendering any not found boundaries or error
|
||||
// boundaries for the missing params shell. When this runs on the client
|
||||
// (where these error can occur), we will get the correct pathname.
|
||||
const pathname = (0, _navigationuntracked.useUntrackedPathname)();
|
||||
const missingSlots = (0, _react.useContext)(_approutercontextsharedruntime.MissingSlotContext);
|
||||
const hasErrorFallback = !!(notFound || forbidden || unauthorized);
|
||||
if (hasErrorFallback) {
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(HTTPAccessFallbackErrorBoundary, {
|
||||
pathname: pathname,
|
||||
notFound: notFound,
|
||||
forbidden: forbidden,
|
||||
unauthorized: unauthorized,
|
||||
missingSlots: missingSlots,
|
||||
children: children
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
||||
children: children
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=error-boundary.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export declare function HTTPAccessErrorFallback({ status, message, }: {
|
||||
status: number;
|
||||
message: string;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "HTTPAccessErrorFallback", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return HTTPAccessErrorFallback;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
|
||||
const styles = {
|
||||
error: {
|
||||
// https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52
|
||||
fontFamily: 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
|
||||
height: '100vh',
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
desc: {
|
||||
display: 'inline-block'
|
||||
},
|
||||
h1: {
|
||||
display: 'inline-block',
|
||||
margin: '0 20px 0 0',
|
||||
padding: '0 23px 0 0',
|
||||
fontSize: 24,
|
||||
fontWeight: 500,
|
||||
verticalAlign: 'top',
|
||||
lineHeight: '49px'
|
||||
},
|
||||
h2: {
|
||||
fontSize: 14,
|
||||
fontWeight: 400,
|
||||
lineHeight: '49px',
|
||||
margin: 0
|
||||
}
|
||||
};
|
||||
function HTTPAccessErrorFallback(param) {
|
||||
let { status, message } = param;
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("title", {
|
||||
children: status + ": " + message
|
||||
}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
||||
style: styles.error,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
|
||||
dangerouslySetInnerHTML: {
|
||||
/* Minified CSS from
|
||||
body { margin: 0; color: #000; background: #fff; }
|
||||
.next-error-h1 {
|
||||
border-right: 1px solid rgba(0, 0, 0, .3);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body { color: #fff; background: #000; }
|
||||
.next-error-h1 {
|
||||
border-right: 1px solid rgba(255, 255, 255, .3);
|
||||
}
|
||||
}
|
||||
*/ __html: "body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"
|
||||
}
|
||||
}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("h1", {
|
||||
className: "next-error-h1",
|
||||
style: styles.h1,
|
||||
children: status
|
||||
}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
||||
style: styles.desc,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("h2", {
|
||||
style: styles.h2,
|
||||
children: message
|
||||
})
|
||||
})
|
||||
]
|
||||
})
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=error-fallback.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/client/components/http-access-fallback/error-fallback.tsx"],"sourcesContent":["import React from 'react'\n\nconst styles: Record<string, React.CSSProperties> = {\n error: {\n // https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52\n fontFamily:\n 'system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"',\n height: '100vh',\n textAlign: 'center',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n\n desc: {\n display: 'inline-block',\n },\n\n h1: {\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 },\n\n h2: {\n fontSize: 14,\n fontWeight: 400,\n lineHeight: '49px',\n margin: 0,\n },\n}\n\nexport function HTTPAccessErrorFallback({\n status,\n message,\n}: {\n status: number\n message: string\n}) {\n return (\n <>\n {/* <head> */}\n <title>{`${status}: ${message}`}</title>\n {/* </head> */}\n <div style={styles.error}>\n <div>\n <style\n dangerouslySetInnerHTML={{\n /* Minified CSS from\n body { margin: 0; color: #000; background: #fff; }\n .next-error-h1 {\n border-right: 1px solid rgba(0, 0, 0, .3);\n }\n\n @media (prefers-color-scheme: dark) {\n body { color: #fff; background: #000; }\n .next-error-h1 {\n border-right: 1px solid rgba(255, 255, 255, .3);\n }\n }\n */\n __html: `body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}`,\n }}\n />\n <h1 className=\"next-error-h1\" style={styles.h1}>\n {status}\n </h1>\n <div style={styles.desc}>\n <h2 style={styles.h2}>{message}</h2>\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["HTTPAccessErrorFallback","styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","desc","h1","margin","padding","fontSize","fontWeight","verticalAlign","lineHeight","h2","status","message","title","div","style","dangerouslySetInnerHTML","__html","className"],"mappings":";;;;+BAqCgBA;;;eAAAA;;;;;gEArCE;AAElB,MAAMC,SAA8C;IAClDC,OAAO;QACL,0FAA0F;QAC1FC,YACE;QACFC,QAAQ;QACRC,WAAW;QACXC,SAAS;QACTC,eAAe;QACfC,YAAY;QACZC,gBAAgB;IAClB;IAEAC,MAAM;QACJJ,SAAS;IACX;IAEAK,IAAI;QACFL,SAAS;QACTM,QAAQ;QACRC,SAAS;QACTC,UAAU;QACVC,YAAY;QACZC,eAAe;QACfC,YAAY;IACd;IAEAC,IAAI;QACFJ,UAAU;QACVC,YAAY;QACZE,YAAY;QACZL,QAAQ;IACV;AACF;AAEO,SAASZ,wBAAwB,KAMvC;IANuC,IAAA,EACtCmB,MAAM,EACNC,OAAO,EAIR,GANuC;IAOtC,qBACE;;0BAEE,qBAACC;0BAAO,AAAGF,SAAO,OAAIC;;0BAEtB,qBAACE;gBAAIC,OAAOtB,OAAOC,KAAK;0BACtB,cAAA,sBAACoB;;sCACC,qBAACC;4BACCC,yBAAyB;gCACvB;;;;;;;;;;;;cAYA,GACAC,QAAS;4BACX;;sCAEF,qBAACd;4BAAGe,WAAU;4BAAgBH,OAAOtB,OAAOU,EAAE;sCAC3CQ;;sCAEH,qBAACG;4BAAIC,OAAOtB,OAAOS,IAAI;sCACrB,cAAA,qBAACQ;gCAAGK,OAAOtB,OAAOiB,EAAE;0CAAGE;;;;;;;;AAMnC"}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
export declare const HTTPAccessErrorStatus: {
|
||||
NOT_FOUND: number;
|
||||
FORBIDDEN: number;
|
||||
UNAUTHORIZED: number;
|
||||
};
|
||||
export declare const HTTP_ERROR_FALLBACK_ERROR_CODE = "NEXT_HTTP_ERROR_FALLBACK";
|
||||
export type HTTPAccessFallbackError = Error & {
|
||||
digest: `${typeof HTTP_ERROR_FALLBACK_ERROR_CODE};${string}`;
|
||||
};
|
||||
/**
|
||||
* Checks an error to determine if it's an error generated by
|
||||
* the HTTP navigation APIs `notFound()`, `forbidden()` or `unauthorized()`.
|
||||
*
|
||||
* @param error the error that may reference a HTTP access error
|
||||
* @returns true if the error is a HTTP access error
|
||||
*/
|
||||
export declare function isHTTPAccessFallbackError(error: unknown): error is HTTPAccessFallbackError;
|
||||
export declare function getAccessFallbackHTTPStatus(error: HTTPAccessFallbackError): number;
|
||||
export declare function getAccessFallbackErrorTypeByStatus(status: number): 'not-found' | 'forbidden' | 'unauthorized' | undefined;
|
||||
Generated
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
HTTPAccessErrorStatus: null,
|
||||
HTTP_ERROR_FALLBACK_ERROR_CODE: null,
|
||||
getAccessFallbackErrorTypeByStatus: null,
|
||||
getAccessFallbackHTTPStatus: null,
|
||||
isHTTPAccessFallbackError: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
HTTPAccessErrorStatus: function() {
|
||||
return HTTPAccessErrorStatus;
|
||||
},
|
||||
HTTP_ERROR_FALLBACK_ERROR_CODE: function() {
|
||||
return HTTP_ERROR_FALLBACK_ERROR_CODE;
|
||||
},
|
||||
getAccessFallbackErrorTypeByStatus: function() {
|
||||
return getAccessFallbackErrorTypeByStatus;
|
||||
},
|
||||
getAccessFallbackHTTPStatus: function() {
|
||||
return getAccessFallbackHTTPStatus;
|
||||
},
|
||||
isHTTPAccessFallbackError: function() {
|
||||
return isHTTPAccessFallbackError;
|
||||
}
|
||||
});
|
||||
const HTTPAccessErrorStatus = {
|
||||
NOT_FOUND: 404,
|
||||
FORBIDDEN: 403,
|
||||
UNAUTHORIZED: 401
|
||||
};
|
||||
const ALLOWED_CODES = new Set(Object.values(HTTPAccessErrorStatus));
|
||||
const HTTP_ERROR_FALLBACK_ERROR_CODE = 'NEXT_HTTP_ERROR_FALLBACK';
|
||||
function isHTTPAccessFallbackError(error) {
|
||||
if (typeof error !== 'object' || error === null || !('digest' in error) || typeof error.digest !== 'string') {
|
||||
return false;
|
||||
}
|
||||
const [prefix, httpStatus] = error.digest.split(';');
|
||||
return prefix === HTTP_ERROR_FALLBACK_ERROR_CODE && ALLOWED_CODES.has(Number(httpStatus));
|
||||
}
|
||||
function getAccessFallbackHTTPStatus(error) {
|
||||
const httpStatus = error.digest.split(';')[1];
|
||||
return Number(httpStatus);
|
||||
}
|
||||
function getAccessFallbackErrorTypeByStatus(status) {
|
||||
switch(status){
|
||||
case 401:
|
||||
return 'unauthorized';
|
||||
case 403:
|
||||
return 'forbidden';
|
||||
case 404:
|
||||
return 'not-found';
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=http-access-fallback.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/client/components/http-access-fallback/http-access-fallback.ts"],"sourcesContent":["export const HTTPAccessErrorStatus = {\n NOT_FOUND: 404,\n FORBIDDEN: 403,\n UNAUTHORIZED: 401,\n}\n\nconst ALLOWED_CODES = new Set(Object.values(HTTPAccessErrorStatus))\n\nexport const HTTP_ERROR_FALLBACK_ERROR_CODE = 'NEXT_HTTP_ERROR_FALLBACK'\n\nexport type HTTPAccessFallbackError = Error & {\n digest: `${typeof HTTP_ERROR_FALLBACK_ERROR_CODE};${string}`\n}\n\n/**\n * Checks an error to determine if it's an error generated by\n * the HTTP navigation APIs `notFound()`, `forbidden()` or `unauthorized()`.\n *\n * @param error the error that may reference a HTTP access error\n * @returns true if the error is a HTTP access error\n */\nexport function isHTTPAccessFallbackError(\n error: unknown\n): error is HTTPAccessFallbackError {\n if (\n typeof error !== 'object' ||\n error === null ||\n !('digest' in error) ||\n typeof error.digest !== 'string'\n ) {\n return false\n }\n const [prefix, httpStatus] = error.digest.split(';')\n\n return (\n prefix === HTTP_ERROR_FALLBACK_ERROR_CODE &&\n ALLOWED_CODES.has(Number(httpStatus))\n )\n}\n\nexport function getAccessFallbackHTTPStatus(\n error: HTTPAccessFallbackError\n): number {\n const httpStatus = error.digest.split(';')[1]\n return Number(httpStatus)\n}\n\nexport function getAccessFallbackErrorTypeByStatus(\n status: number\n): 'not-found' | 'forbidden' | 'unauthorized' | undefined {\n switch (status) {\n case 401:\n return 'unauthorized'\n case 403:\n return 'forbidden'\n case 404:\n return 'not-found'\n default:\n return\n }\n}\n"],"names":["HTTPAccessErrorStatus","HTTP_ERROR_FALLBACK_ERROR_CODE","getAccessFallbackErrorTypeByStatus","getAccessFallbackHTTPStatus","isHTTPAccessFallbackError","NOT_FOUND","FORBIDDEN","UNAUTHORIZED","ALLOWED_CODES","Set","Object","values","error","digest","prefix","httpStatus","split","has","Number","status"],"mappings":";;;;;;;;;;;;;;;;;;IAAaA,qBAAqB;eAArBA;;IAQAC,8BAA8B;eAA9BA;;IAuCGC,kCAAkC;eAAlCA;;IAPAC,2BAA2B;eAA3BA;;IAnBAC,yBAAyB;eAAzBA;;;AArBT,MAAMJ,wBAAwB;IACnCK,WAAW;IACXC,WAAW;IACXC,cAAc;AAChB;AAEA,MAAMC,gBAAgB,IAAIC,IAAIC,OAAOC,MAAM,CAACX;AAErC,MAAMC,iCAAiC;AAavC,SAASG,0BACdQ,KAAc;IAEd,IACE,OAAOA,UAAU,YACjBA,UAAU,QACV,CAAE,CAAA,YAAYA,KAAI,KAClB,OAAOA,MAAMC,MAAM,KAAK,UACxB;QACA,OAAO;IACT;IACA,MAAM,CAACC,QAAQC,WAAW,GAAGH,MAAMC,MAAM,CAACG,KAAK,CAAC;IAEhD,OACEF,WAAWb,kCACXO,cAAcS,GAAG,CAACC,OAAOH;AAE7B;AAEO,SAASZ,4BACdS,KAA8B;IAE9B,MAAMG,aAAaH,MAAMC,MAAM,CAACG,KAAK,CAAC,IAAI,CAAC,EAAE;IAC7C,OAAOE,OAAOH;AAChB;AAEO,SAASb,mCACdiB,MAAc;IAEd,OAAQA;QACN,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT;YACE;IACJ;AACF"}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
export declare const getDefaultHydrationErrorMessage: () => string;
|
||||
export declare function isHydrationError(error: unknown): boolean;
|
||||
export declare function isReactHydrationErrorMessage(msg: string): boolean;
|
||||
export declare function getHydrationErrorStackInfo(rawMessage: string): {
|
||||
message: string | null;
|
||||
link?: string;
|
||||
stack?: string;
|
||||
diff?: string;
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user