Initial boiler plate project

This commit is contained in:
2024-09-24 03:52:46 +00:00
parent 6120b2d6c3
commit 154b93e267
10034 changed files with 2079352 additions and 2 deletions

View File

@ -0,0 +1,2 @@
import type { ActionAsyncStorage } from './action-async-storage.external';
export declare const actionAsyncStorage: ActionAsyncStorage;

View File

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "actionAsyncStorage", {
enumerable: true,
get: function() {
return actionAsyncStorage;
}
});
const _asynclocalstorage = require("./async-local-storage");
const actionAsyncStorage = (0, _asynclocalstorage.createAsyncLocalStorage)();
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=action-async-storage-instance.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/action-async-storage-instance.ts"],"names":["actionAsyncStorage","createAsyncLocalStorage"],"mappings":";;;;+BAGaA;;;eAAAA;;;mCAF2B;AAEjC,MAAMA,qBAAyCC,IAAAA,0CAAuB"}

View File

@ -0,0 +1,9 @@
/// <reference types="node" />
import type { AsyncLocalStorage } from 'async_hooks';
import { actionAsyncStorage } from './action-async-storage-instance';
export interface ActionStore {
readonly isAction?: boolean;
readonly isAppRoute?: boolean;
}
export type ActionAsyncStorage = AsyncLocalStorage<ActionStore>;
export { actionAsyncStorage };

View File

@ -0,0 +1,20 @@
"TURBOPACK { transition: next-shared }";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "actionAsyncStorage", {
enumerable: true,
get: function() {
return _actionasyncstorageinstance.actionAsyncStorage;
}
});
const _actionasyncstorageinstance = require("./action-async-storage-instance");
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=action-async-storage.external.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/action-async-storage.external.ts"],"names":["actionAsyncStorage"],"mappings":"AAIE;;;;;+BASOA;;;eAAAA,8CAAkB;;;4CARQ"}

View File

@ -0,0 +1,5 @@
/// <reference types="react" />
import type { FlightRouterState } from '../../server/app-render/types';
export declare function AppRouterAnnouncer({ tree }: {
tree: FlightRouterState;
}): import("react").ReactPortal | null;

View File

@ -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)();
(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

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/app-router-announcer.tsx"],"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","currentTitle","title","pageHeader","querySelector","innerText","textContent","current","undefined","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;IAE5BP,IAAAA,gBAAS,EAAC;QACR,IAAIQ,eAAe;QACnB,IAAI7B,SAAS8B,KAAK,EAAE;YAClBD,eAAe7B,SAAS8B,KAAK;QAC/B,OAAO;YACL,MAAMC,aAAa/B,SAASgC,aAAa,CAAC;YAC1C,IAAID,YAAY;gBACdF,eAAeE,WAAWE,SAAS,IAAIF,WAAWG,WAAW,IAAI;YACnE;QACF;QAEA,4EAA4E;QAC5E,iCAAiC;QACjC,IACEP,cAAcQ,OAAO,KAAKC,aAC1BT,cAAcQ,OAAO,KAAKN,cAC1B;YACAH,qBAAqBG;QACvB;QACAF,cAAcQ,OAAO,GAAGN;IAC1B,GAAG;QAACZ;KAAK;IAET,OAAOC,2BAAamB,IAAAA,sBAAY,EAACZ,mBAAmBP,cAAc;AACpE"}

View File

@ -0,0 +1,9 @@
export declare const RSC_HEADER: "RSC";
export declare const ACTION: "Next-Action";
export declare const NEXT_ROUTER_STATE_TREE: "Next-Router-State-Tree";
export declare const NEXT_ROUTER_PREFETCH_HEADER: "Next-Router-Prefetch";
export declare const NEXT_URL: "Next-Url";
export declare const RSC_CONTENT_TYPE_HEADER: "text/x-component";
export declare const FLIGHT_PARAMETERS: readonly [readonly ["RSC"], readonly ["Next-Router-State-Tree"], readonly ["Next-Router-Prefetch"]];
export declare const NEXT_RSC_UNION_QUERY: "_rsc";
export declare const NEXT_DID_POSTPONE_HEADER: "x-nextjs-postponed";

View File

@ -0,0 +1,77 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ACTION: null,
FLIGHT_PARAMETERS: null,
NEXT_DID_POSTPONE_HEADER: null,
NEXT_ROUTER_PREFETCH_HEADER: null,
NEXT_ROUTER_STATE_TREE: 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: function() {
return ACTION;
},
FLIGHT_PARAMETERS: function() {
return FLIGHT_PARAMETERS;
},
NEXT_DID_POSTPONE_HEADER: function() {
return NEXT_DID_POSTPONE_HEADER;
},
NEXT_ROUTER_PREFETCH_HEADER: function() {
return NEXT_ROUTER_PREFETCH_HEADER;
},
NEXT_ROUTER_STATE_TREE: function() {
return NEXT_ROUTER_STATE_TREE;
},
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 = "Next-Action";
const NEXT_ROUTER_STATE_TREE = "Next-Router-State-Tree";
const NEXT_ROUTER_PREFETCH_HEADER = "Next-Router-Prefetch";
const NEXT_URL = "Next-Url";
const RSC_CONTENT_TYPE_HEADER = "text/x-component";
const FLIGHT_PARAMETERS = [
[
RSC_HEADER
],
[
NEXT_ROUTER_STATE_TREE
],
[
NEXT_ROUTER_PREFETCH_HEADER
]
];
const NEXT_RSC_UNION_QUERY = "_rsc";
const NEXT_DID_POSTPONE_HEADER = "x-nextjs-postponed";
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

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/app-router-headers.ts"],"names":["ACTION","FLIGHT_PARAMETERS","NEXT_DID_POSTPONE_HEADER","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_STATE_TREE","NEXT_RSC_UNION_QUERY","NEXT_URL","RSC_CONTENT_TYPE_HEADER","RSC_HEADER"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IACaA,MAAM;eAANA;;IAOAC,iBAAiB;eAAjBA;;IAQAC,wBAAwB;eAAxBA;;IAZAC,2BAA2B;eAA3BA;;IADAC,sBAAsB;eAAtBA;;IAWAC,oBAAoB;eAApBA;;IATAC,QAAQ;eAARA;;IACAC,uBAAuB;eAAvBA;;IANAC,UAAU;eAAVA;;;AAAN,MAAMA,aAAa;AACnB,MAAMR,SAAS;AAEf,MAAMI,yBAAyB;AAC/B,MAAMD,8BAA8B;AACpC,MAAMG,WAAW;AACjB,MAAMC,0BAA0B;AAEhC,MAAMN,oBAAoB;IAC/B;QAACO;KAAW;IACZ;QAACJ;KAAuB;IACxB;QAACD;KAA4B;CAC9B;AAEM,MAAME,uBAAuB;AAE7B,MAAMH,2BAA2B"}

View File

@ -0,0 +1,18 @@
import type { ReactNode } from 'react';
import type { CacheNode } from '../../shared/lib/app-router-context.shared-runtime';
import type { ErrorComponent } from './error-boundary';
import type { ServerActionDispatcher } from './router-reducer/router-reducer-types';
import type { InitialRouterStateParameters } from './router-reducer/create-initial-router-state';
export declare function getServerActionDispatcher(): ServerActionDispatcher | null;
export declare function urlToUrlWithoutFlightMarker(url: string): URL;
type AppRouterProps = Omit<Omit<InitialRouterStateParameters, 'isServer' | 'location'>, 'initialParallelRoutes'> & {
buildId: string;
initialHead: ReactNode;
assetPrefix: string;
missingSlots: Set<string>;
};
export declare function createEmptyCacheNode(): CacheNode;
export default function AppRouter(props: AppRouterProps & {
globalErrorComponent: ErrorComponent;
}): import("react/jsx-runtime").JSX.Element;
export {};

603
node_modules/next/dist/client/components/app-router.js generated vendored Normal file
View File

@ -0,0 +1,603 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
createEmptyCacheNode: null,
default: null,
getServerActionDispatcher: null,
urlToUrlWithoutFlightMarker: 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;
},
default: function() {
return AppRouter;
},
getServerActionDispatcher: function() {
return getServerActionDispatcher;
},
urlToUrlWithoutFlightMarker: function() {
return urlToUrlWithoutFlightMarker;
}
});
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 _usereducerwithdevtools = require("./use-reducer-with-devtools");
const _errorboundary = require("./error-boundary");
const _createinitialrouterstate = require("./router-reducer/create-initial-router-state");
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 _approuterheaders = require("./app-router-headers");
const _removebasepath = require("../remove-base-path");
const _hasbasepath = require("../has-base-path");
const _segment = require("../../shared/lib/segment");
const isServer = typeof window === "undefined";
// Ensure the initialParallelRoutes are not combined because of double-rendering in the browser with Strict Mode.
let initialParallelRoutes = isServer ? null : new Map();
let globalServerActionDispatcher = null;
function getServerActionDispatcher() {
return globalServerActionDispatcher;
}
const globalMutable = {};
function urlToUrlWithoutFlightMarker(url) {
const urlWithoutFlightParameters = new URL(url, location.origin);
urlWithoutFlightParameters.searchParams.delete(_approuterheaders.NEXT_RSC_UNION_QUERY);
if (process.env.NODE_ENV === "production") {
if (process.env.__NEXT_CONFIG_OUTPUT === "export" && urlWithoutFlightParameters.pathname.endsWith(".txt")) {
const { pathname } = urlWithoutFlightParameters;
const length = pathname.endsWith("/index.txt") ? 10 : 4;
// Slice off `/index.txt` or `.txt` from the end of the pathname
urlWithoutFlightParameters.pathname = pathname.slice(0, -length);
}
}
return urlWithoutFlightParameters;
}
// this function performs a depth-first search of the tree to find the selected
// params
function getSelectedParams(currentTree, params) {
if (params === void 0) params = {};
const parallelRoutes = currentTree[1];
for (const parallelRoute of Object.values(parallelRoutes)){
const segment = parallelRoute[0];
const isDynamicParameter = Array.isArray(segment);
const segmentValue = isDynamicParameter ? segment[1] : segment;
if (!segmentValue || segmentValue.startsWith(_segment.PAGE_SEGMENT_KEY)) continue;
// Ensure catchAll and optional catchall are turned into an array
const isCatchAll = isDynamicParameter && (segment[2] === "c" || segment[2] === "oc");
if (isCatchAll) {
params[segment[0]] = segment[1].split("/");
} else if (isDynamicParameter) {
params[segment[0]] = segment[1];
}
params = getSelectedParams(parallelRoute, params);
}
return params;
}
function isExternalURL(url) {
return url.origin !== window.location.origin;
}
function HistoryUpdater(param) {
let { appRouterState, sync } = param;
(0, _react.useInsertionEffect)(()=>{
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);
}
sync(appRouterState);
}, [
appRouterState,
sync
]);
return null;
}
function createEmptyCacheNode() {
return {
lazyData: null,
rsc: null,
prefetchRsc: null,
head: null,
prefetchHead: null,
parallelRoutes: new Map(),
lazyDataResolved: false,
loading: null
};
}
function useServerActionDispatcher(dispatch) {
const serverActionDispatcher = (0, _react.useCallback)((actionPayload)=>{
(0, _react.startTransition)(()=>{
dispatch({
...actionPayload,
type: _routerreducertypes.ACTION_SERVER_ACTION
});
});
}, [
dispatch
]);
globalServerActionDispatcher = serverActionDispatcher;
}
/**
* 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);
return dispatch({
type: _routerreducertypes.ACTION_NAVIGATE,
url,
isExternalUrl: isExternalURL(url),
locationSearch: location.search,
shouldScroll: shouldScroll != null ? shouldScroll : true,
navigateType
});
}, [
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 { buildId, initialHead, initialTree, urlParts, initialSeedData, couldBeIntercepted, assetPrefix, missingSlots } = param;
const initialState = (0, _react.useMemo)(()=>(0, _createinitialrouterstate.createInitialRouterState)({
buildId,
initialSeedData,
urlParts,
initialTree,
initialParallelRoutes,
location: !isServer ? window.location : null,
initialHead,
couldBeIntercepted
}), [
buildId,
initialSeedData,
urlParts,
initialTree,
initialHead,
couldBeIntercepted
]);
const [reducerState, dispatch, sync] = (0, _usereducerwithdevtools.useReducerWithReduxDevtools)(initialState);
(0, _react.useEffect)(()=>{
// Ensure initialParallelRoutes is cleaned up from memory once it's used.
initialParallelRoutes = null;
}, []);
const { canonicalUrl } = (0, _usereducerwithdevtools.useUnwrapState)(reducerState);
// 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);
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: (href, options)=>{
// Don't prefetch for bots as they don't navigate.
if ((0, _isbot.isBot)(window.navigator.userAgent)) {
return;
}
let url;
try {
url = new URL((0, _addbasepath.addBasePath)(href), window.location.href);
} catch (_) {
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;
}
// External urls can't be prefetched in the same way.
if (isExternalURL(url)) {
return;
}
(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
});
});
},
fastRefresh: ()=>{
if (process.env.NODE_ENV !== "development") {
throw new Error("fastRefresh can only be used in development mode. Please use refresh instead.");
} else {
(0, _react.startTransition)(()=>{
dispatch({
type: _routerreducertypes.ACTION_FAST_REFRESH,
origin: window.location.origin
});
});
}
}
};
return routerInstance;
}, [
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, _usereducerwithdevtools.useUnwrapState)(reducerState);
// 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
]);
// 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, _usereducerwithdevtools.useUnwrapState)(reducerState);
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 = (param)=>{
let { state } = param;
if (!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 (!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: 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, _usereducerwithdevtools.useUnwrapState)(reducerState);
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 getSelectedParams(tree);
}, [
tree
]);
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 DevRootNotFoundBoundary = require("./dev-root-not-found-boundary").DevRootNotFoundBoundary;
content = /*#__PURE__*/ (0, _jsxruntime.jsx)(DevRootNotFoundBoundary, {
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.MissingSlotContext.Provider, {
value: missingSlots,
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, _usereducerwithdevtools.useUnwrapState)(reducerState),
sync: sync
}),
/*#__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: {
buildId,
changeByServerResponse,
tree,
focusAndScrollRef,
nextUrl
},
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.AppRouterContext.Provider, {
value: appRouter,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.LayoutRouterContext.Provider, {
value: {
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
},
children: content
})
})
})
})
})
})
]
});
}
function AppRouter(props) {
const { globalErrorComponent, ...rest } = props;
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_errorboundary.ErrorBoundary, {
errorComponent: globalErrorComponent,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Router, {
...rest
})
});
}
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

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
/// <reference types="node" />
import type { AsyncLocalStorage } from 'async_hooks';
export declare function createAsyncLocalStorage<Store extends {}>(): AsyncLocalStorage<Store>;

View File

@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createAsyncLocalStorage", {
enumerable: true,
get: function() {
return createAsyncLocalStorage;
}
});
const sharedAsyncLocalStorageNotAvailableError = new Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");
class FakeAsyncLocalStorage {
disable() {
throw sharedAsyncLocalStorageNotAvailableError;
}
getStore() {
// This fake implementation of AsyncLocalStorage always returns `undefined`.
return undefined;
}
run() {
throw sharedAsyncLocalStorageNotAvailableError;
}
exit() {
throw sharedAsyncLocalStorageNotAvailableError;
}
enterWith() {
throw sharedAsyncLocalStorageNotAvailableError;
}
}
const maybeGlobalAsyncLocalStorage = globalThis.AsyncLocalStorage;
function createAsyncLocalStorage() {
if (maybeGlobalAsyncLocalStorage) {
return new maybeGlobalAsyncLocalStorage();
}
return new FakeAsyncLocalStorage();
}
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=async-local-storage.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/async-local-storage.ts"],"names":["createAsyncLocalStorage","sharedAsyncLocalStorageNotAvailableError","Error","FakeAsyncLocalStorage","disable","getStore","undefined","run","exit","enterWith","maybeGlobalAsyncLocalStorage","globalThis","AsyncLocalStorage"],"mappings":";;;;+BAiCgBA;;;eAAAA;;;AA/BhB,MAAMC,2CAA2C,IAAIC,MACnD;AAGF,MAAMC;IAGJC,UAAgB;QACd,MAAMH;IACR;IAEAI,WAA8B;QAC5B,4EAA4E;QAC5E,OAAOC;IACT;IAEAC,MAAY;QACV,MAAMN;IACR;IAEAO,OAAa;QACX,MAAMP;IACR;IAEAQ,YAAkB;QAChB,MAAMR;IACR;AACF;AAEA,MAAMS,+BAA+B,AAACC,WAAmBC,iBAAiB;AAEnE,SAASZ;IAGd,IAAIU,8BAA8B;QAChC,OAAO,IAAIA;IACb;IACA,OAAO,IAAIP;AACb"}

View File

@ -0,0 +1 @@
export declare function bailoutToClientRendering(reason: string): void | never;

View File

@ -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 _staticgenerationasyncstorageexternal = require("./static-generation-async-storage.external");
function bailoutToClientRendering(reason) {
const staticGenerationStore = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.getStore();
if (staticGenerationStore == null ? void 0 : staticGenerationStore.forceStatic) return;
if (staticGenerationStore == null ? void 0 : staticGenerationStore.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

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/bailout-to-client-rendering.ts"],"names":["bailoutToClientRendering","reason","staticGenerationStore","staticGenerationAsyncStorage","getStore","forceStatic","isStaticGeneration","BailoutToCSRError"],"mappings":";;;;+BAGgBA;;;eAAAA;;;8BAHkB;sDACW;AAEtC,SAASA,yBAAyBC,MAAc;IACrD,MAAMC,wBAAwBC,kEAA4B,CAACC,QAAQ;IAEnE,IAAIF,yCAAAA,sBAAuBG,WAAW,EAAE;IAExC,IAAIH,yCAAAA,sBAAuBI,kBAAkB,EAC3C,MAAM,IAAIC,+BAAiB,CAACN;AAChC"}

View File

@ -0,0 +1,7 @@
/// <reference types="react" />
export declare function ClientPageRoot({ Component, props, }: {
Component: React.ComponentType<any>;
props: {
[props: string]: any;
};
}): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,35 @@
"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 _searchparams = require("./search-params");
function ClientPageRoot(param) {
let { Component, props } = param;
// We expect to be passed searchParams but even if we aren't we can construct one from
// an empty object. We only do this if we are in a static generation as a performance
// optimization. Ideally we'd unconditionally construct the tracked params but since
// this creates a proxy which is slow and this would happen even for client navigations
// that are done entirely dynamically and we know there the dynamic tracking is a noop
// in this dynamic case we can safely elide it.
props.searchParams = (0, _searchparams.createDynamicallyTrackedSearchParams)(props.searchParams || {});
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, {
...props
});
}
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

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/client-page.tsx"],"names":["ClientPageRoot","Component","props","searchParams","createDynamicallyTrackedSearchParams"],"mappings":"AAAA;;;;;+BAGgBA;;;eAAAA;;;;8BAFqC;AAE9C,SAASA,eAAe,KAM9B;IAN8B,IAAA,EAC7BC,SAAS,EACTC,KAAK,EAIN,GAN8B;IAO7B,sFAAsF;IACtF,qFAAqF;IACrF,oFAAoF;IACpF,uFAAuF;IACvF,sFAAsF;IACtF,+CAA+C;IAC/CA,MAAMC,YAAY,GAAGC,IAAAA,kDAAoC,EACvDF,MAAMC,YAAY,IAAI,CAAC;IAEzB,qBAAO,qBAACF;QAAW,GAAGC,KAAK;;AAC7B"}

View File

@ -0,0 +1,4 @@
import React from 'react';
export default function DefaultLayout({ children, }: {
children: React.ReactNode;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -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

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/default-layout.tsx"],"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"}

View File

@ -0,0 +1,5 @@
import React from 'react';
export declare function bailOnNotFound(): void;
export declare function DevRootNotFoundBoundary({ children, }: {
children: React.ReactNode;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,50 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
DevRootNotFoundBoundary: null,
bailOnNotFound: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
DevRootNotFoundBoundary: function() {
return DevRootNotFoundBoundary;
},
bailOnNotFound: function() {
return bailOnNotFound;
}
});
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 _notfoundboundary = require("./not-found-boundary");
function bailOnNotFound() {
throw new Error("notFound() is not allowed to use in root layout");
}
function NotAllowedRootNotFoundError() {
bailOnNotFound();
return null;
}
function DevRootNotFoundBoundary(param) {
let { children } = param;
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_notfoundboundary.NotFoundBoundary, {
notFound: /*#__PURE__*/ (0, _jsxruntime.jsx)(NotAllowedRootNotFoundError, {}),
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-not-found-boundary.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/dev-root-not-found-boundary.tsx"],"names":["DevRootNotFoundBoundary","bailOnNotFound","Error","NotAllowedRootNotFoundError","children","NotFoundBoundary","notFound"],"mappings":"AAAA;;;;;;;;;;;;;;;;IAcgBA,uBAAuB;eAAvBA;;IATAC,cAAc;eAAdA;;;;;gEAHE;kCACe;AAE1B,SAASA;IACd,MAAM,IAAIC,MAAM;AAClB;AAEA,SAASC;IACPF;IACA,OAAO;AACT;AAEO,SAASD,wBAAwB,KAIvC;IAJuC,IAAA,EACtCI,QAAQ,EAGT,GAJuC;IAKtC,qBACE,qBAACC,kCAAgB;QAACC,wBAAU,qBAACH;kBAC1BC;;AAGP"}

View File

@ -0,0 +1,7 @@
import type { DraftModeProvider } from '../../server/async-storage/draft-mode-provider';
export declare class DraftMode {
constructor(provider: DraftModeProvider);
get isEnabled(): boolean;
enable(): void;
disable(): void;
}

46
node_modules/next/dist/client/components/draft-mode.js generated vendored Normal file
View File

@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DraftMode", {
enumerable: true,
get: function() {
return DraftMode;
}
});
const _staticgenerationasyncstorageexternal = require("./static-generation-async-storage.external");
const _dynamicrendering = require("../../server/app-render/dynamic-rendering");
class DraftMode {
get isEnabled() {
return this._provider.isEnabled;
}
enable() {
const store = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.getStore();
if (store) {
// We we have a store we want to track dynamic data access to ensure we
// don't statically generate routes that manipulate draft mode.
(0, _dynamicrendering.trackDynamicDataAccessed)(store, "draftMode().enable()");
}
return this._provider.enable();
}
disable() {
const store = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.getStore();
if (store) {
// We we have a store we want to track dynamic data access to ensure we
// don't statically generate routes that manipulate draft mode.
(0, _dynamicrendering.trackDynamicDataAccessed)(store, "draftMode().disable()");
}
return this._provider.disable();
}
constructor(provider){
this._provider = provider;
}
}
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=draft-mode.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/draft-mode.ts"],"names":["DraftMode","isEnabled","_provider","enable","store","staticGenerationAsyncStorage","getStore","trackDynamicDataAccessed","disable","constructor","provider"],"mappings":";;;;+BAKaA;;;eAAAA;;;sDAHgC;kCACJ;AAElC,MAAMA;IASX,IAAIC,YAAY;QACd,OAAO,IAAI,CAACC,SAAS,CAACD,SAAS;IACjC;IACOE,SAAS;QACd,MAAMC,QAAQC,kEAA4B,CAACC,QAAQ;QACnD,IAAIF,OAAO;YACT,uEAAuE;YACvE,+DAA+D;YAC/DG,IAAAA,0CAAwB,EAACH,OAAO;QAClC;QACA,OAAO,IAAI,CAACF,SAAS,CAACC,MAAM;IAC9B;IACOK,UAAU;QACf,MAAMJ,QAAQC,kEAA4B,CAACC,QAAQ;QACnD,IAAIF,OAAO;YACT,uEAAuE;YACvE,+DAA+D;YAC/DG,IAAAA,0CAAwB,EAACH,OAAO;QAClC;QACA,OAAO,IAAI,CAACF,SAAS,CAACM,OAAO;IAC/B;IAvBAC,YAAYC,QAA2B,CAAE;QACvC,IAAI,CAACR,SAAS,GAAGQ;IACnB;AAsBF"}

View File

@ -0,0 +1,43 @@
import React 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;
errorComponent: ErrorComponent;
}
interface ErrorBoundaryHandlerState {
error: Error | null;
previousPathname: string;
}
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;

View File

@ -0,0 +1,187 @@
"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 _navigation = require("./navigation");
const _isnextroutererror = require("./is-next-router-error");
const _staticgenerationasyncstorageexternal = require("./static-generation-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 = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.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) {
/**
* 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 the 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;
const pathname = (0, _navigation.usePathname)();
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

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/error-boundary.tsx"],"names":["ErrorBoundary","ErrorBoundaryHandler","GlobalError","styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","text","fontSize","fontWeight","lineHeight","margin","HandleISRError","store","staticGenerationAsyncStorage","getStore","isRevalidate","isStaticGeneration","console","React","Component","getDerivedStateFromError","isNextRouterError","getDerivedStateFromProps","props","state","pathname","previousPathname","render","errorStyles","errorScripts","this","errorComponent","reset","children","constructor","setState","digest","html","id","head","body","div","style","h2","p","usePathname"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;IAoKgBA,aAAa;eAAbA;;IAtGHC,oBAAoB;eAApBA;;IAiEGC,WAAW;eAAXA;;IAwBhB,gFAAgF;IAChF,2CAA2C;IAC3C,OAA0B;eAA1B;;;;;gEAvJkB;4BACU;mCACM;sDACW;AAE7C,MAAMC,SAAS;IACbC,OAAO;QACL,0FAA0F;QAC1FC,YACE;QACFC,QAAQ;QACRC,WAAW;QACXC,SAAS;QACTC,eAAe;QACfC,YAAY;QACZC,gBAAgB;IAClB;IACAC,MAAM;QACJC,UAAU;QACVC,YAAY;QACZC,YAAY;QACZC,QAAQ;IACV;AACF;AAwBA,8DAA8D;AAC9D,yDAAyD;AACzD,oCAAoC;AACpC,SAASC,eAAe,KAAyB;IAAzB,IAAA,EAAEb,KAAK,EAAkB,GAAzB;IACtB,MAAMc,QAAQC,kEAA4B,CAACC,QAAQ;IACnD,IAAIF,CAAAA,yBAAAA,MAAOG,YAAY,MAAIH,yBAAAA,MAAOI,kBAAkB,GAAE;QACpDC,QAAQnB,KAAK,CAACA;QACd,MAAMA;IACR;IAEA,OAAO;AACT;AAEO,MAAMH,6BAA6BuB,cAAK,CAACC,SAAS;IASvD,OAAOC,yBAAyBtB,KAAY,EAAE;QAC5C,IAAIuB,IAAAA,oCAAiB,EAACvB,QAAQ;YAC5B,+DAA+D;YAC/D,4GAA4G;YAC5G,MAAMA;QACR;QAEA,OAAO;YAAEA;QAAM;IACjB;IAEA,OAAOwB,yBACLC,KAAgC,EAChCC,KAAgC,EACE;QAClC;;;;;KAKC,GACD,IAAID,MAAME,QAAQ,KAAKD,MAAME,gBAAgB,IAAIF,MAAM1B,KAAK,EAAE;YAC5D,OAAO;gBACLA,OAAO;gBACP4B,kBAAkBH,MAAME,QAAQ;YAClC;QACF;QACA,OAAO;YACL3B,OAAO0B,MAAM1B,KAAK;YAClB4B,kBAAkBH,MAAME,QAAQ;QAClC;IACF;IAMA,0IAA0I;IAC1IE,SAA0B;QACxB,IAAI,IAAI,CAACH,KAAK,CAAC1B,KAAK,EAAE;YACpB,qBACE;;kCACE,qBAACa;wBAAeb,OAAO,IAAI,CAAC0B,KAAK,CAAC1B,KAAK;;oBACtC,IAAI,CAACyB,KAAK,CAACK,WAAW;oBACtB,IAAI,CAACL,KAAK,CAACM,YAAY;kCACxB,qBAACC,IAAI,CAACP,KAAK,CAACQ,cAAc;wBACxBjC,OAAO,IAAI,CAAC0B,KAAK,CAAC1B,KAAK;wBACvBkC,OAAO,IAAI,CAACA,KAAK;;;;QAIzB;QAEA,OAAO,IAAI,CAACT,KAAK,CAACU,QAAQ;IAC5B;IA1DAC,YAAYX,KAAgC,CAAE;QAC5C,KAAK,CAACA;aAoCRS,QAAQ;YACN,IAAI,CAACG,QAAQ,CAAC;gBAAErC,OAAO;YAAK;QAC9B;QArCE,IAAI,CAAC0B,KAAK,GAAG;YAAE1B,OAAO;YAAM4B,kBAAkB,IAAI,CAACH,KAAK,CAACE,QAAQ;QAAC;IACpE;AAwDF;AAEO,SAAS7B,YAAY,KAAyB;IAAzB,IAAA,EAAEE,KAAK,EAAkB,GAAzB;IAC1B,MAAMsC,SAA6BtC,yBAAAA,MAAOsC,MAAM;IAChD,qBACE,sBAACC;QAAKC,IAAG;;0BACP,qBAACC;0BACD,sBAACC;;kCACC,qBAAC7B;wBAAeb,OAAOA;;kCACvB,qBAAC2C;wBAAIC,OAAO7C,OAAOC,KAAK;kCACtB,cAAA,sBAAC2C;;8CACC,qBAACE;oCAAGD,OAAO7C,OAAOS,IAAI;8CACnB,AAAC,0BACA8B,CAAAA,SAAS,WAAW,QAAO,IAC5B,2CACCA,CAAAA,SAAS,gBAAgB,iBAAgB,IAC1C;;gCAEFA,uBAAS,qBAACQ;oCAAEF,OAAO7C,OAAOS,IAAI;8CAAG,AAAC,aAAU8B;qCAAgB;;;;;;;;AAMzE;MAIA,WAAexC;AAWR,SAASF,cAAc,KAKuB;IALvB,IAAA,EAC5BqC,cAAc,EACdH,WAAW,EACXC,YAAY,EACZI,QAAQ,EAC2C,GALvB;IAM5B,MAAMR,WAAWoB,IAAAA,uBAAW;IAC5B,IAAId,gBAAgB;QAClB,qBACE,qBAACpC;YACC8B,UAAUA;YACVM,gBAAgBA;YAChBH,aAAaA;YACbC,cAAcA;sBAEbI;;IAGP;IAEA,qBAAO;kBAAGA;;AACZ"}

14
node_modules/next/dist/client/components/headers.d.ts generated vendored Normal file
View File

@ -0,0 +1,14 @@
import { type ReadonlyRequestCookies } from '../../server/web/spec-extension/adapters/request-cookies';
import { DraftMode } from './draft-mode';
/**
* This function allows you to read the HTTP incoming request headers in
* [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),
* [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations),
* [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers) and
* [Middleware](https://nextjs.org/docs/app/building-your-application/routing/middleware).
*
* Read more: [Next.js Docs: `headers`](https://nextjs.org/docs/app/api-reference/functions/headers)
*/
export declare function headers(): import("../../server/web/spec-extension/adapters/headers").ReadonlyHeaders;
export declare function cookies(): ReadonlyRequestCookies;
export declare function draftMode(): DraftMode;

82
node_modules/next/dist/client/components/headers.js generated vendored Normal file
View File

@ -0,0 +1,82 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
cookies: null,
draftMode: null,
headers: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
cookies: function() {
return cookies;
},
draftMode: function() {
return draftMode;
},
headers: function() {
return headers;
}
});
const _requestcookies = require("../../server/web/spec-extension/adapters/request-cookies");
const _headers = require("../../server/web/spec-extension/adapters/headers");
const _cookies = require("../../server/web/spec-extension/cookies");
const _actionasyncstorageexternal = require("./action-async-storage.external");
const _draftmode = require("./draft-mode");
const _dynamicrendering = require("../../server/app-render/dynamic-rendering");
const _staticgenerationasyncstorageexternal = require("./static-generation-async-storage.external");
const _requestasyncstorageexternal = require("./request-async-storage.external");
function headers() {
const callingExpression = "headers";
const staticGenerationStore = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.getStore();
if (staticGenerationStore) {
if (staticGenerationStore.forceStatic) {
// When we are forcing static we don't mark this as a Dynamic read and we return an empty headers object
return _headers.HeadersAdapter.seal(new Headers({}));
} else {
// We will return a real headers object below so we mark this call as reading from a dynamic data source
(0, _dynamicrendering.trackDynamicDataAccessed)(staticGenerationStore, callingExpression);
}
}
return (0, _requestasyncstorageexternal.getExpectedRequestStore)(callingExpression).headers;
}
function cookies() {
const callingExpression = "cookies";
const staticGenerationStore = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.getStore();
if (staticGenerationStore) {
if (staticGenerationStore.forceStatic) {
// When we are forcing static we don't mark this as a Dynamic read and we return an empty cookies object
return _requestcookies.RequestCookiesAdapter.seal(new _cookies.RequestCookies(new Headers({})));
} else {
// We will return a real headers object below so we mark this call as reading from a dynamic data source
(0, _dynamicrendering.trackDynamicDataAccessed)(staticGenerationStore, callingExpression);
}
}
const requestStore = (0, _requestasyncstorageexternal.getExpectedRequestStore)(callingExpression);
const asyncActionStore = _actionasyncstorageexternal.actionAsyncStorage.getStore();
if ((asyncActionStore == null ? void 0 : asyncActionStore.isAction) || (asyncActionStore == null ? void 0 : asyncActionStore.isAppRoute)) {
// We can't conditionally return different types here based on the context.
// To avoid confusion, we always return the readonly type here.
return requestStore.mutableCookies;
}
return requestStore.cookies;
}
function draftMode() {
const callingExpression = "draftMode";
const requestStore = (0, _requestasyncstorageexternal.getExpectedRequestStore)(callingExpression);
return new _draftmode.DraftMode(requestStore.draftMode);
}
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=headers.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/headers.ts"],"names":["cookies","draftMode","headers","callingExpression","staticGenerationStore","staticGenerationAsyncStorage","getStore","forceStatic","HeadersAdapter","seal","Headers","trackDynamicDataAccessed","getExpectedRequestStore","RequestCookiesAdapter","RequestCookies","requestStore","asyncActionStore","actionAsyncStorage","isAction","isAppRoute","mutableCookies","DraftMode"],"mappings":";;;;;;;;;;;;;;;;IAsCgBA,OAAO;eAAPA;;IA0BAC,SAAS;eAATA;;IA3CAC,OAAO;eAAPA;;;gCAlBT;yBACwB;yBACA;4CACI;2BACT;kCACe;sDACI;6CACL;AAWjC,SAASA;IACd,MAAMC,oBAAoB;IAC1B,MAAMC,wBAAwBC,kEAA4B,CAACC,QAAQ;IAEnE,IAAIF,uBAAuB;QACzB,IAAIA,sBAAsBG,WAAW,EAAE;YACrC,wGAAwG;YACxG,OAAOC,uBAAc,CAACC,IAAI,CAAC,IAAIC,QAAQ,CAAC;QAC1C,OAAO;YACL,wGAAwG;YACxGC,IAAAA,0CAAwB,EAACP,uBAAuBD;QAClD;IACF;IAEA,OAAOS,IAAAA,oDAAuB,EAACT,mBAAmBD,OAAO;AAC3D;AAEO,SAASF;IACd,MAAMG,oBAAoB;IAC1B,MAAMC,wBAAwBC,kEAA4B,CAACC,QAAQ;IAEnE,IAAIF,uBAAuB;QACzB,IAAIA,sBAAsBG,WAAW,EAAE;YACrC,wGAAwG;YACxG,OAAOM,qCAAqB,CAACJ,IAAI,CAAC,IAAIK,uBAAc,CAAC,IAAIJ,QAAQ,CAAC;QACpE,OAAO;YACL,wGAAwG;YACxGC,IAAAA,0CAAwB,EAACP,uBAAuBD;QAClD;IACF;IAEA,MAAMY,eAAeH,IAAAA,oDAAuB,EAACT;IAE7C,MAAMa,mBAAmBC,8CAAkB,CAACX,QAAQ;IACpD,IAAIU,CAAAA,oCAAAA,iBAAkBE,QAAQ,MAAIF,oCAAAA,iBAAkBG,UAAU,GAAE;QAC9D,2EAA2E;QAC3E,+DAA+D;QAC/D,OAAOJ,aAAaK,cAAc;IACpC;IAEA,OAAOL,aAAaf,OAAO;AAC7B;AAEO,SAASC;IACd,MAAME,oBAAoB;IAC1B,MAAMY,eAAeH,IAAAA,oDAAuB,EAACT;IAE7C,OAAO,IAAIkB,oBAAS,CAACN,aAAad,SAAS;AAC7C"}

View File

@ -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 {};

View File

@ -0,0 +1,44 @@
"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

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/hooks-server-context.ts"],"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;aADLA,cAAAA;aAF5BC,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"}

View File

@ -0,0 +1 @@
export declare function isHydrationError(error: unknown): boolean;

View File

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isHydrationError", {
enumerable: true,
get: function() {
return isHydrationError;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _iserror = /*#__PURE__*/ _interop_require_default._(require("../../lib/is-error"));
const hydrationErrorRegex = /hydration failed|while hydrating|content does not match|did not match/i;
function isHydrationError(error) {
return (0, _iserror.default)(error) && hydrationErrorRegex.test(error.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=is-hydration-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/is-hydration-error.ts"],"names":["isHydrationError","hydrationErrorRegex","error","isError","test","message"],"mappings":";;;;+BAKgBA;;;eAAAA;;;;kEALI;AAEpB,MAAMC,sBACJ;AAEK,SAASD,iBAAiBE,KAAc;IAC7C,OAAOC,IAAAA,gBAAO,EAACD,UAAUD,oBAAoBG,IAAI,CAACF,MAAMG,OAAO;AACjE"}

View File

@ -0,0 +1 @@
export declare function isNextRouterError(error: any): boolean;

View File

@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isNextRouterError", {
enumerable: true,
get: function() {
return isNextRouterError;
}
});
const _notfound = require("./not-found");
const _redirect = require("./redirect");
function isNextRouterError(error) {
return error && error.digest && ((0, _redirect.isRedirectError)(error) || (0, _notfound.isNotFoundError)(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=is-next-router-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/is-next-router-error.ts"],"names":["isNextRouterError","error","digest","isRedirectError","isNotFoundError"],"mappings":";;;;+BAGgBA;;;eAAAA;;;0BAHgB;0BACA;AAEzB,SAASA,kBAAkBC,KAAU;IAC1C,OACEA,SAASA,MAAMC,MAAM,IAAKC,CAAAA,IAAAA,yBAAe,EAACF,UAAUG,IAAAA,yBAAe,EAACH,MAAK;AAE7E"}

View File

@ -0,0 +1,19 @@
import type { FlightSegmentPath } from '../../server/app-render/types';
import type { ErrorComponent } from './error-boundary';
import React from 'react';
/**
* OuterLayoutRouter handles the current segment as well as <Offscreen> rendering of other segments.
* It can be rendered next to each other with a different `parallelRouterKey`, allowing for Parallel routes.
*/
export default function OuterLayoutRouter({ parallelRouterKey, segmentPath, error, errorStyles, errorScripts, templateStyles, templateScripts, template, notFound, notFoundStyles, }: {
parallelRouterKey: string;
segmentPath: FlightSegmentPath;
error: ErrorComponent | undefined;
errorStyles: React.ReactNode | undefined;
errorScripts: React.ReactNode | undefined;
templateStyles: React.ReactNode | undefined;
templateScripts: React.ReactNode | undefined;
template: React.ReactNode;
notFound: React.ReactNode | undefined;
notFoundStyles: React.ReactNode | undefined;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,458 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, /**
* OuterLayoutRouter handles the current segment as well as <Offscreen> rendering of other segments.
* It can be rendered next to each other with a different `parallelRouterKey`, allowing for Parallel routes.
*/ "default", {
enumerable: true,
get: function() {
return OuterLayoutRouter;
}
});
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");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactdom = /*#__PURE__*/ _interop_require_default._(require("react-dom"));
const _approutercontextsharedruntime = require("../../shared/lib/app-router-context.shared-runtime");
const _fetchserverresponse = require("./router-reducer/fetch-server-response");
const _unresolvedthenable = require("./unresolved-thenable");
const _errorboundary = require("./error-boundary");
const _matchsegments = require("./match-segments");
const _handlesmoothscroll = require("../../shared/lib/router/utils/handle-smooth-scroll");
const _redirectboundary = require("./redirect-boundary");
const _notfoundboundary = require("./not-found-boundary");
const _getsegmentvalue = require("./router-reducer/reducers/get-segment-value");
const _createroutercachekey = require("./router-reducer/create-router-cache-key");
const _hasinterceptionrouteincurrenttree = require("./router-reducer/reducers/has-interception-route-in-current-tree");
/**
* Add refetch marker to router state at the point of the current layout segment.
* This ensures the response returned is not further down than the current layout segment.
*/ function walkAddRefetch(segmentPathToWalk, treeToRecreate) {
if (segmentPathToWalk) {
const [segment, parallelRouteKey] = segmentPathToWalk;
const isLast = segmentPathToWalk.length === 2;
if ((0, _matchsegments.matchSegment)(treeToRecreate[0], segment)) {
if (treeToRecreate[1].hasOwnProperty(parallelRouteKey)) {
if (isLast) {
const subTree = walkAddRefetch(undefined, treeToRecreate[1][parallelRouteKey]);
return [
treeToRecreate[0],
{
...treeToRecreate[1],
[parallelRouteKey]: [
subTree[0],
subTree[1],
subTree[2],
"refetch"
]
}
];
}
return [
treeToRecreate[0],
{
...treeToRecreate[1],
[parallelRouteKey]: walkAddRefetch(segmentPathToWalk.slice(2), treeToRecreate[1][parallelRouteKey])
}
];
}
}
}
return treeToRecreate;
}
// TODO-APP: Replace with new React API for finding dom nodes without a `ref` when available
/**
* Wraps ReactDOM.findDOMNode with additional logic to hide React Strict Mode warning
*/ function findDOMNode(instance) {
// Tree-shake for server bundle
if (typeof window === "undefined") return null;
// Only apply strict mode warning when not in production
if (process.env.NODE_ENV !== "production") {
const originalConsoleError = console.error;
try {
console.error = function() {
for(var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++){
messages[_key] = arguments[_key];
}
// Ignore strict mode warning for the findDomNode call below
if (!messages[0].includes("Warning: %s is deprecated in StrictMode.")) {
originalConsoleError(...messages);
}
};
return _reactdom.default.findDOMNode(instance);
} finally{
console.error = originalConsoleError;
}
}
return _reactdom.default.findDOMNode(instance);
}
const rectProperties = [
"bottom",
"height",
"left",
"right",
"top",
"width",
"x",
"y"
];
/**
* Check if a HTMLElement is hidden or fixed/sticky position
*/ function shouldSkipElement(element) {
// we ignore fixed or sticky positioned elements since they'll likely pass the "in-viewport" check
// and will result in a situation we bail on scroll because of something like a fixed nav,
// even though the actual page content is offscreen
if ([
"sticky",
"fixed"
].includes(getComputedStyle(element).position)) {
if (process.env.NODE_ENV === "development") {
console.warn("Skipping auto-scroll behavior due to `position: sticky` or `position: fixed` on element:", element);
}
return true;
}
// Uses `getBoundingClientRect` to check if the element is hidden instead of `offsetParent`
// because `offsetParent` doesn't consider document/body
const rect = element.getBoundingClientRect();
return rectProperties.every((item)=>rect[item] === 0);
}
/**
* Check if the top corner of the HTMLElement is in the viewport.
*/ function topOfElementInViewport(element, viewportHeight) {
const rect = element.getBoundingClientRect();
return rect.top >= 0 && rect.top <= viewportHeight;
}
/**
* Find the DOM node for a hash fragment.
* If `top` the page has to scroll to the top of the page. This mirrors the browser's behavior.
* If the hash fragment is an id, the page has to scroll to the element with that id.
* If the hash fragment is a name, the page has to scroll to the first element with that name.
*/ function getHashFragmentDomNode(hashFragment) {
// If the hash fragment is `top` the page has to scroll to the top of the page.
if (hashFragment === "top") {
return document.body;
}
var _document_getElementById;
// If the hash fragment is an id, the page has to scroll to the element with that id.
return (_document_getElementById = document.getElementById(hashFragment)) != null ? _document_getElementById : // If the hash fragment is a name, the page has to scroll to the first element with that name.
document.getElementsByName(hashFragment)[0];
}
class InnerScrollAndFocusHandler extends _react.default.Component {
componentDidMount() {
this.handlePotentialScroll();
}
componentDidUpdate() {
// Because this property is overwritten in handlePotentialScroll it's fine to always run it when true as it'll be set to false for subsequent renders.
if (this.props.focusAndScrollRef.apply) {
this.handlePotentialScroll();
}
}
render() {
return this.props.children;
}
constructor(...args){
super(...args);
this.handlePotentialScroll = ()=>{
// Handle scroll and focus, it's only applied once in the first useEffect that triggers that changed.
const { focusAndScrollRef, segmentPath } = this.props;
if (focusAndScrollRef.apply) {
// segmentPaths is an array of segment paths that should be scrolled to
// if the current segment path is not in the array, the scroll is not applied
// unless the array is empty, in which case the scroll is always applied
if (focusAndScrollRef.segmentPaths.length !== 0 && !focusAndScrollRef.segmentPaths.some((scrollRefSegmentPath)=>segmentPath.every((segment, index)=>(0, _matchsegments.matchSegment)(segment, scrollRefSegmentPath[index])))) {
return;
}
let domNode = null;
const hashFragment = focusAndScrollRef.hashFragment;
if (hashFragment) {
domNode = getHashFragmentDomNode(hashFragment);
}
// `findDOMNode` is tricky because it returns just the first child if the component is a fragment.
// This already caused a bug where the first child was a <link/> in head.
if (!domNode) {
domNode = findDOMNode(this);
}
// If there is no DOM node this layout-router level is skipped. It'll be handled higher-up in the tree.
if (!(domNode instanceof Element)) {
return;
}
// Verify if the element is a HTMLElement and if we want to consider it for scroll behavior.
// If the element is skipped, try to select the next sibling and try again.
while(!(domNode instanceof HTMLElement) || shouldSkipElement(domNode)){
// No siblings found that match the criteria are found, so handle scroll higher up in the tree instead.
if (domNode.nextElementSibling === null) {
return;
}
domNode = domNode.nextElementSibling;
}
// State is mutated to ensure that the focus and scroll is applied only once.
focusAndScrollRef.apply = false;
focusAndScrollRef.hashFragment = null;
focusAndScrollRef.segmentPaths = [];
(0, _handlesmoothscroll.handleSmoothScroll)(()=>{
// In case of hash scroll, we only need to scroll the element into view
if (hashFragment) {
domNode.scrollIntoView();
return;
}
// Store the current viewport height because reading `clientHeight` causes a reflow,
// and it won't change during this function.
const htmlElement = document.documentElement;
const viewportHeight = htmlElement.clientHeight;
// If the element's top edge is already in the viewport, exit early.
if (topOfElementInViewport(domNode, viewportHeight)) {
return;
}
// Otherwise, try scrolling go the top of the document to be backward compatible with pages
// scrollIntoView() called on `<html/>` element scrolls horizontally on chrome and firefox (that shouldn't happen)
// We could use it to scroll horizontally following RTL but that also seems to be broken - it will always scroll left
// scrollLeft = 0 also seems to ignore RTL and manually checking for RTL is too much hassle so we will scroll just vertically
htmlElement.scrollTop = 0;
// Scroll to domNode if domNode is not in viewport when scrolled to top of document
if (!topOfElementInViewport(domNode, viewportHeight)) {
domNode.scrollIntoView();
}
}, {
// We will force layout by querying domNode position
dontForceLayout: true,
onlyHashChange: focusAndScrollRef.onlyHashChange
});
// Mutate after scrolling so that it can be read by `handleSmoothScroll`
focusAndScrollRef.onlyHashChange = false;
// Set focus on the element
domNode.focus();
}
};
}
}
function ScrollAndFocusHandler(param) {
let { segmentPath, children } = param;
const context = (0, _react.useContext)(_approutercontextsharedruntime.GlobalLayoutRouterContext);
if (!context) {
throw new Error("invariant global layout router not mounted");
}
return /*#__PURE__*/ (0, _jsxruntime.jsx)(InnerScrollAndFocusHandler, {
segmentPath: segmentPath,
focusAndScrollRef: context.focusAndScrollRef,
children: children
});
}
/**
* InnerLayoutRouter handles rendering the provided segment based on the cache.
*/ function InnerLayoutRouter(param) {
let { parallelRouterKey, url, childNodes, segmentPath, tree, // TODO-APP: implement `<Offscreen>` when available.
// isActive,
cacheKey } = param;
const context = (0, _react.useContext)(_approutercontextsharedruntime.GlobalLayoutRouterContext);
if (!context) {
throw new Error("invariant global layout router not mounted");
}
const { buildId, changeByServerResponse, tree: fullTree } = context;
// Read segment path from the parallel router cache node.
let childNode = childNodes.get(cacheKey);
// When data is not available during rendering client-side we need to fetch
// it from the server.
if (childNode === undefined) {
const newLazyCacheNode = {
lazyData: null,
rsc: null,
prefetchRsc: null,
head: null,
prefetchHead: null,
parallelRoutes: new Map(),
lazyDataResolved: false,
loading: null
};
/**
* Flight data fetch kicked off during render and put into the cache.
*/ childNode = newLazyCacheNode;
childNodes.set(cacheKey, newLazyCacheNode);
}
// `rsc` represents the renderable node for this segment.
// If this segment has a `prefetchRsc`, it's the statically prefetched data.
// We should use that on initial render instead of `rsc`. Then we'll switch
// to `rsc` when the dynamic response streams in.
//
// If no prefetch data is available, then we go straight to rendering `rsc`.
const resolvedPrefetchRsc = childNode.prefetchRsc !== null ? childNode.prefetchRsc : childNode.rsc;
// 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 `rsc`.
const rsc = (0, _react.useDeferredValue)(childNode.rsc, resolvedPrefetchRsc);
// `rsc` is either a React node or a promise for a React node, except we
// special case `null` to represent that this segment's data is missing. If
// it's a promise, we need to unwrap it so we can determine whether or not the
// data is missing.
const resolvedRsc = typeof rsc === "object" && rsc !== null && typeof rsc.then === "function" ? (0, _react.use)(rsc) : rsc;
if (!resolvedRsc) {
// The data for this segment is not available, and there's no pending
// navigation that will be able to fulfill it. We need to fetch more from
// the server and patch the cache.
// Check if there's already a pending request.
let lazyData = childNode.lazyData;
if (lazyData === null) {
/**
* Router state with refetch marker added
*/ // TODO-APP: remove ''
const refetchTree = walkAddRefetch([
"",
...segmentPath
], fullTree);
const includeNextUrl = (0, _hasinterceptionrouteincurrenttree.hasInterceptionRouteInCurrentTree)(fullTree);
childNode.lazyData = lazyData = (0, _fetchserverresponse.fetchServerResponse)(new URL(url, location.origin), refetchTree, includeNextUrl ? context.nextUrl : null, buildId);
childNode.lazyDataResolved = false;
}
/**
* Flight response data
*/ // When the data has not resolved yet `use` will suspend here.
const serverResponse = (0, _react.use)(lazyData);
if (!childNode.lazyDataResolved) {
// setTimeout is used to start a new transition during render, this is an intentional hack around React.
setTimeout(()=>{
(0, _react.startTransition)(()=>{
changeByServerResponse({
previousTree: fullTree,
serverResponse
});
});
});
// It's important that we mark this as resolved, in case this branch is replayed, we don't want to continously re-apply
// the patch to the tree.
childNode.lazyDataResolved = true;
}
// Suspend infinitely as `changeByServerResponse` will cause a different part of the tree to be rendered.
// A falsey `resolvedRsc` indicates missing data -- we should not commit that branch, and we need to wait for the data to arrive.
(0, _react.use)(_unresolvedthenable.unresolvedThenable);
}
// If we get to this point, then we know we have something we can render.
const subtree = // The layout router context narrows down tree and childNodes at each level.
/*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.LayoutRouterContext.Provider, {
value: {
tree: tree[1][parallelRouterKey],
childNodes: childNode.parallelRoutes,
// TODO-APP: overriding of url for parallel routes
url: url,
loading: childNode.loading
},
children: resolvedRsc
});
// Ensure root layout is not wrapped in a div as the root layout renders `<html>`
return subtree;
}
/**
* Renders suspense boundary with the provided "loading" property as the fallback.
* If no loading property is provided it renders the children without a suspense boundary.
*/ function LoadingBoundary(param) {
let { children, hasLoading, loading, loadingStyles, loadingScripts } = param;
// We have an explicit prop for checking if `loading` is provided, to disambiguate between a loading
// component that returns `null` / `undefined`, vs not having a loading component at all.
if (hasLoading) {
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Suspense, {
fallback: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
loadingStyles,
loadingScripts,
loading
]
}),
children: children
});
}
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
children: children
});
}
function OuterLayoutRouter(param) {
let { parallelRouterKey, segmentPath, error, errorStyles, errorScripts, templateStyles, templateScripts, template, notFound, notFoundStyles } = param;
const context = (0, _react.useContext)(_approutercontextsharedruntime.LayoutRouterContext);
if (!context) {
throw new Error("invariant expected layout router to be mounted");
}
const { childNodes, tree, url, loading } = context;
// Get the current parallelRouter cache node
let childNodesForParallelRouter = childNodes.get(parallelRouterKey);
// If the parallel router cache node does not exist yet, create it.
// This writes to the cache when there is no item in the cache yet. It never *overwrites* existing cache items which is why it's safe in concurrent mode.
if (!childNodesForParallelRouter) {
childNodesForParallelRouter = new Map();
childNodes.set(parallelRouterKey, childNodesForParallelRouter);
}
// Get the active segment in the tree
// The reason arrays are used in the data format is that these are transferred from the server to the browser so it's optimized to save bytes.
const treeSegment = tree[1][parallelRouterKey][0];
// If segment is an array it's a dynamic route and we want to read the dynamic route value as the segment to get from the cache.
const currentChildSegmentValue = (0, _getsegmentvalue.getSegmentValue)(treeSegment);
/**
* Decides which segments to keep rendering, all segments that are not active will be wrapped in `<Offscreen>`.
*/ // TODO-APP: Add handling of `<Offscreen>` when it's available.
const preservedSegments = [
treeSegment
];
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
children: preservedSegments.map((preservedSegment)=>{
const preservedSegmentValue = (0, _getsegmentvalue.getSegmentValue)(preservedSegment);
const cacheKey = (0, _createroutercachekey.createRouterCacheKey)(preservedSegment);
return(/*
- Error boundary
- Only renders error boundary if error component is provided.
- Rendered for each segment to ensure they have their own error state.
- Loading boundary
- Only renders suspense boundary if loading components is provided.
- Rendered for each segment to ensure they have their own loading state.
- Passed to the router during rendering to ensure it can be immediately rendered when suspending on a Flight fetch.
*/ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_approutercontextsharedruntime.TemplateContext.Provider, {
value: /*#__PURE__*/ (0, _jsxruntime.jsx)(ScrollAndFocusHandler, {
segmentPath: segmentPath,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_errorboundary.ErrorBoundary, {
errorComponent: error,
errorStyles: errorStyles,
errorScripts: errorScripts,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(LoadingBoundary, {
hasLoading: Boolean(loading),
loading: loading == null ? void 0 : loading[0],
loadingStyles: loading == null ? void 0 : loading[1],
loadingScripts: loading == null ? void 0 : loading[2],
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_notfoundboundary.NotFoundBoundary, {
notFound: notFound,
notFoundStyles: notFoundStyles,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_redirectboundary.RedirectBoundary, {
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(InnerLayoutRouter, {
parallelRouterKey: parallelRouterKey,
url: url,
tree: tree,
childNodes: childNodesForParallelRouter,
segmentPath: segmentPath,
cacheKey: cacheKey,
isActive: currentChildSegmentValue === preservedSegmentValue
})
})
})
})
})
}),
children: [
templateStyles,
templateScripts,
template
]
}, (0, _createroutercachekey.createRouterCacheKey)(preservedSegment, 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=layout-router.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
import type { Segment } from '../../server/app-render/types';
export declare const matchSegment: (existingSegment: Segment, segment: Segment) => boolean;
export declare const canSegmentBeOverridden: (existingSegment: Segment, segment: Segment) => boolean;

View File

@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
canSegmentBeOverridden: null,
matchSegment: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
canSegmentBeOverridden: function() {
return canSegmentBeOverridden;
},
matchSegment: function() {
return matchSegment;
}
});
const _getsegmentparam = require("../../server/app-render/get-segment-param");
const matchSegment = (existingSegment, segment)=>{
// segment is either Array or string
if (typeof existingSegment === "string") {
if (typeof segment === "string") {
// Common case: segment is just a string
return existingSegment === segment;
}
return false;
}
if (typeof segment === "string") {
return false;
}
return existingSegment[0] === segment[0] && existingSegment[1] === segment[1];
};
const canSegmentBeOverridden = (existingSegment, segment)=>{
var _getSegmentParam;
if (Array.isArray(existingSegment) || !Array.isArray(segment)) {
return false;
}
return ((_getSegmentParam = (0, _getsegmentparam.getSegmentParam)(existingSegment)) == null ? void 0 : _getSegmentParam.param) === segment[0];
};
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=match-segments.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/match-segments.ts"],"names":["canSegmentBeOverridden","matchSegment","existingSegment","segment","getSegmentParam","Array","isArray","param"],"mappings":";;;;;;;;;;;;;;;IAyBaA,sBAAsB;eAAtBA;;IAtBAC,YAAY;eAAZA;;;iCAHmB;AAGzB,MAAMA,eAAe,CAC1BC,iBACAC;IAEA,oCAAoC;IACpC,IAAI,OAAOD,oBAAoB,UAAU;QACvC,IAAI,OAAOC,YAAY,UAAU;YAC/B,wCAAwC;YACxC,OAAOD,oBAAoBC;QAC7B;QACA,OAAO;IACT;IAEA,IAAI,OAAOA,YAAY,UAAU;QAC/B,OAAO;IACT;IACA,OAAOD,eAAe,CAAC,EAAE,KAAKC,OAAO,CAAC,EAAE,IAAID,eAAe,CAAC,EAAE,KAAKC,OAAO,CAAC,EAAE;AAC/E;AAKO,MAAMH,yBAAyB,CACpCE,iBACAC;QAMOC;IAJP,IAAIC,MAAMC,OAAO,CAACJ,oBAAoB,CAACG,MAAMC,OAAO,CAACH,UAAU;QAC7D,OAAO;IACT;IAEA,OAAOC,EAAAA,mBAAAA,IAAAA,gCAAe,EAACF,qCAAhBE,iBAAkCG,KAAK,MAAKJ,OAAO,CAAC,EAAE;AAC/D"}

View File

@ -0,0 +1,129 @@
import { type AppRouterInstance } from '../../shared/lib/app-router-context.shared-runtime';
import { ReadonlyURLSearchParams } from './navigation.react-server';
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you *read* the current URL's search parameters.
*
* Learn more about [`URLSearchParams` on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams)
*
* @example
* ```ts
* "use client"
* import { useSearchParams } from 'next/navigation'
*
* export default function Page() {
* const searchParams = useSearchParams()
* searchParams.get('foo') // returns 'bar' when ?foo=bar
* // ...
* }
* ```
*
* Read more: [Next.js Docs: `useSearchParams`](https://nextjs.org/docs/app/api-reference/functions/use-search-params)
*/
declare function useSearchParams(): ReadonlyURLSearchParams;
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you read the current URL's pathname.
*
* @example
* ```ts
* "use client"
* import { usePathname } from 'next/navigation'
*
* export default function Page() {
* const pathname = usePathname() // returns "/dashboard" on /dashboard?foo=bar
* // ...
* }
* ```
*
* Read more: [Next.js Docs: `usePathname`](https://nextjs.org/docs/app/api-reference/functions/use-pathname)
*/
declare function usePathname(): string;
import { ServerInsertedHTMLContext, useServerInsertedHTML } from '../../shared/lib/server-inserted-html.shared-runtime';
/**
*
* This hook allows you to programmatically change routes inside [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components).
*
* @example
* ```ts
* "use client"
* import { useRouter } from 'next/navigation'
*
* export default function Page() {
* const router = useRouter()
* // ...
* router.push('/dashboard') // Navigate to /dashboard
* }
* ```
*
* Read more: [Next.js Docs: `useRouter`](https://nextjs.org/docs/app/api-reference/functions/use-router)
*/
declare function useRouter(): AppRouterInstance;
interface Params {
[key: string]: string | string[];
}
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you read a route's dynamic params filled in by the current URL.
*
* @example
* ```ts
* "use client"
* import { useParams } from 'next/navigation'
*
* export default function Page() {
* // on /dashboard/[team] where pathname is /dashboard/nextjs
* const { team } = useParams() // team === "nextjs"
* }
* ```
*
* Read more: [Next.js Docs: `useParams`](https://nextjs.org/docs/app/api-reference/functions/use-params)
*/
declare function useParams<T extends Params = Params>(): T;
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you read the active route segments **below** the Layout it is called from.
*
* @example
* ```ts
* 'use client'
*
* import { useSelectedLayoutSegments } from 'next/navigation'
*
* export default function ExampleClientComponent() {
* const segments = useSelectedLayoutSegments()
*
* return (
* <ul>
* {segments.map((segment, index) => (
* <li key={index}>{segment}</li>
* ))}
* </ul>
* )
* }
* ```
*
* Read more: [Next.js Docs: `useSelectedLayoutSegments`](https://nextjs.org/docs/app/api-reference/functions/use-selected-layout-segments)
*/
declare function useSelectedLayoutSegments(parallelRouteKey?: string): string[];
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you read the active route segment **one level below** the Layout it is called from.
*
* @example
* ```ts
* 'use client'
* import { useSelectedLayoutSegment } from 'next/navigation'
*
* export default function ExampleClientComponent() {
* const segment = useSelectedLayoutSegment()
*
* return <p>Active segment: {segment}</p>
* }
* ```
*
* Read more: [Next.js Docs: `useSelectedLayoutSegment`](https://nextjs.org/docs/app/api-reference/functions/use-selected-layout-segment)
*/
declare function useSelectedLayoutSegment(parallelRouteKey?: string): string | null;
export { useSearchParams, usePathname, useSelectedLayoutSegment, useSelectedLayoutSegments, useParams, useRouter, useServerInsertedHTML, ServerInsertedHTMLContext, };
export { notFound, redirect, permanentRedirect, RedirectType, ReadonlyURLSearchParams, } from './navigation.react-server';

268
node_modules/next/dist/client/components/navigation.js generated vendored Normal file
View File

@ -0,0 +1,268 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ReadonlyURLSearchParams: null,
RedirectType: null,
ServerInsertedHTMLContext: null,
notFound: null,
permanentRedirect: null,
redirect: null,
useParams: null,
usePathname: null,
useRouter: null,
useSearchParams: null,
useSelectedLayoutSegment: null,
useSelectedLayoutSegments: null,
useServerInsertedHTML: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ReadonlyURLSearchParams: function() {
return _navigationreactserver.ReadonlyURLSearchParams;
},
RedirectType: function() {
return _navigationreactserver.RedirectType;
},
ServerInsertedHTMLContext: function() {
return _serverinsertedhtmlsharedruntime.ServerInsertedHTMLContext;
},
notFound: function() {
return _navigationreactserver.notFound;
},
permanentRedirect: function() {
return _navigationreactserver.permanentRedirect;
},
redirect: function() {
return _navigationreactserver.redirect;
},
useParams: function() {
return useParams;
},
usePathname: function() {
return usePathname;
},
useRouter: function() {
return useRouter;
},
useSearchParams: function() {
return useSearchParams;
},
useSelectedLayoutSegment: function() {
return useSelectedLayoutSegment;
},
useSelectedLayoutSegments: function() {
return useSelectedLayoutSegments;
},
useServerInsertedHTML: function() {
return _serverinsertedhtmlsharedruntime.useServerInsertedHTML;
}
});
const _react = require("react");
const _approutercontextsharedruntime = require("../../shared/lib/app-router-context.shared-runtime");
const _hooksclientcontextsharedruntime = require("../../shared/lib/hooks-client-context.shared-runtime");
const _getsegmentvalue = require("./router-reducer/reducers/get-segment-value");
const _segment = require("../../shared/lib/segment");
const _navigationreactserver = require("./navigation.react-server");
const _serverinsertedhtmlsharedruntime = require("../../shared/lib/server-inserted-html.shared-runtime");
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you *read* the current URL's search parameters.
*
* Learn more about [`URLSearchParams` on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams)
*
* @example
* ```ts
* "use client"
* import { useSearchParams } from 'next/navigation'
*
* export default function Page() {
* const searchParams = useSearchParams()
* searchParams.get('foo') // returns 'bar' when ?foo=bar
* // ...
* }
* ```
*
* Read more: [Next.js Docs: `useSearchParams`](https://nextjs.org/docs/app/api-reference/functions/use-search-params)
*/ function useSearchParams() {
const searchParams = (0, _react.useContext)(_hooksclientcontextsharedruntime.SearchParamsContext);
// In the case where this is `null`, the compat types added in
// `next-env.d.ts` will add a new overload that changes the return type to
// include `null`.
const readonlySearchParams = (0, _react.useMemo)(()=>{
if (!searchParams) {
// When the router is not ready in pages, we won't have the search params
// available.
return null;
}
return new _navigationreactserver.ReadonlyURLSearchParams(searchParams);
}, [
searchParams
]);
if (typeof window === "undefined") {
// AsyncLocalStorage should not be included in the client bundle.
const { bailoutToClientRendering } = require("./bailout-to-client-rendering");
// TODO-APP: handle dynamic = 'force-static' here and on the client
bailoutToClientRendering("useSearchParams()");
}
return readonlySearchParams;
}
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you read the current URL's pathname.
*
* @example
* ```ts
* "use client"
* import { usePathname } from 'next/navigation'
*
* export default function Page() {
* const pathname = usePathname() // returns "/dashboard" on /dashboard?foo=bar
* // ...
* }
* ```
*
* Read more: [Next.js Docs: `usePathname`](https://nextjs.org/docs/app/api-reference/functions/use-pathname)
*/ function usePathname() {
// In the case where this is `null`, the compat types added in `next-env.d.ts`
// will add a new overload that changes the return type to include `null`.
return (0, _react.useContext)(_hooksclientcontextsharedruntime.PathnameContext);
}
/**
*
* This hook allows you to programmatically change routes inside [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components).
*
* @example
* ```ts
* "use client"
* import { useRouter } from 'next/navigation'
*
* export default function Page() {
* const router = useRouter()
* // ...
* router.push('/dashboard') // Navigate to /dashboard
* }
* ```
*
* Read more: [Next.js Docs: `useRouter`](https://nextjs.org/docs/app/api-reference/functions/use-router)
*/ function useRouter() {
const router = (0, _react.useContext)(_approutercontextsharedruntime.AppRouterContext);
if (router === null) {
throw new Error("invariant expected app router to be mounted");
}
return router;
}
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you read a route's dynamic params filled in by the current URL.
*
* @example
* ```ts
* "use client"
* import { useParams } from 'next/navigation'
*
* export default function Page() {
* // on /dashboard/[team] where pathname is /dashboard/nextjs
* const { team } = useParams() // team === "nextjs"
* }
* ```
*
* Read more: [Next.js Docs: `useParams`](https://nextjs.org/docs/app/api-reference/functions/use-params)
*/ function useParams() {
return (0, _react.useContext)(_hooksclientcontextsharedruntime.PathParamsContext);
}
/** Get the canonical parameters from the current level to the leaf node. */ function getSelectedLayoutSegmentPath(tree, parallelRouteKey, first, segmentPath) {
if (first === void 0) first = true;
if (segmentPath === void 0) segmentPath = [];
let node;
if (first) {
// Use the provided parallel route key on the first parallel route
node = tree[1][parallelRouteKey];
} else {
// After first parallel route prefer children, if there's no children pick the first parallel route.
const parallelRoutes = tree[1];
var _parallelRoutes_children;
node = (_parallelRoutes_children = parallelRoutes.children) != null ? _parallelRoutes_children : Object.values(parallelRoutes)[0];
}
if (!node) return segmentPath;
const segment = node[0];
const segmentValue = (0, _getsegmentvalue.getSegmentValue)(segment);
if (!segmentValue || segmentValue.startsWith(_segment.PAGE_SEGMENT_KEY)) {
return segmentPath;
}
segmentPath.push(segmentValue);
return getSelectedLayoutSegmentPath(node, parallelRouteKey, false, segmentPath);
}
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you read the active route segments **below** the Layout it is called from.
*
* @example
* ```ts
* 'use client'
*
* import { useSelectedLayoutSegments } from 'next/navigation'
*
* export default function ExampleClientComponent() {
* const segments = useSelectedLayoutSegments()
*
* return (
* <ul>
* {segments.map((segment, index) => (
* <li key={index}>{segment}</li>
* ))}
* </ul>
* )
* }
* ```
*
* Read more: [Next.js Docs: `useSelectedLayoutSegments`](https://nextjs.org/docs/app/api-reference/functions/use-selected-layout-segments)
*/ function useSelectedLayoutSegments(parallelRouteKey) {
if (parallelRouteKey === void 0) parallelRouteKey = "children";
const context = (0, _react.useContext)(_approutercontextsharedruntime.LayoutRouterContext);
// @ts-expect-error This only happens in `pages`. Type is overwritten in navigation.d.ts
if (!context) return null;
return getSelectedLayoutSegmentPath(context.tree, parallelRouteKey);
}
/**
* A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook
* that lets you read the active route segment **one level below** the Layout it is called from.
*
* @example
* ```ts
* 'use client'
* import { useSelectedLayoutSegment } from 'next/navigation'
*
* export default function ExampleClientComponent() {
* const segment = useSelectedLayoutSegment()
*
* return <p>Active segment: {segment}</p>
* }
* ```
*
* Read more: [Next.js Docs: `useSelectedLayoutSegment`](https://nextjs.org/docs/app/api-reference/functions/use-selected-layout-segment)
*/ function useSelectedLayoutSegment(parallelRouteKey) {
if (parallelRouteKey === void 0) parallelRouteKey = "children";
const selectedLayoutSegments = useSelectedLayoutSegments(parallelRouteKey);
if (!selectedLayoutSegments || selectedLayoutSegments.length === 0) {
return null;
}
const selectedLayoutSegment = parallelRouteKey === "children" ? selectedLayoutSegments[0] : selectedLayoutSegments[selectedLayoutSegments.length - 1];
// if the default slot is showing, we return null since it's not technically "selected" (it's a fallback)
// and returning an internal value like `__DEFAULT__` would be confusing.
return selectedLayoutSegment === _segment.DEFAULT_SEGMENT_KEY ? null : selectedLayoutSegment;
}
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=navigation.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/navigation.ts"],"names":["ReadonlyURLSearchParams","RedirectType","ServerInsertedHTMLContext","notFound","permanentRedirect","redirect","useParams","usePathname","useRouter","useSearchParams","useSelectedLayoutSegment","useSelectedLayoutSegments","useServerInsertedHTML","searchParams","useContext","SearchParamsContext","readonlySearchParams","useMemo","window","bailoutToClientRendering","require","PathnameContext","router","AppRouterContext","Error","PathParamsContext","getSelectedLayoutSegmentPath","tree","parallelRouteKey","first","segmentPath","node","parallelRoutes","children","Object","values","segment","segmentValue","getSegmentValue","startsWith","PAGE_SEGMENT_KEY","push","context","LayoutRouterContext","selectedLayoutSegments","length","selectedLayoutSegment","DEFAULT_SEGMENT_KEY"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IA8QEA,uBAAuB;eAAvBA,8CAAuB;;IADvBC,YAAY;eAAZA,mCAAY;;IARZC,yBAAyB;eAAzBA,0DAAyB;;IAKzBC,QAAQ;eAARA,+BAAQ;;IAERC,iBAAiB;eAAjBA,wCAAiB;;IADjBC,QAAQ;eAARA,+BAAQ;;IATRC,SAAS;eAATA;;IAHAC,WAAW;eAAXA;;IAIAC,SAAS;eAATA;;IALAC,eAAe;eAAfA;;IAEAC,wBAAwB;eAAxBA;;IACAC,yBAAyB;eAAzBA;;IAGAC,qBAAqB;eAArBA,sDAAqB;;;uBApQa;+CAM7B;iDAKA;iCACyB;yBACsB;uCACd;iDA2EjC;AAzEP;;;;;;;;;;;;;;;;;;;CAmBC,GACD,SAASH;IACP,MAAMI,eAAeC,IAAAA,iBAAU,EAACC,oDAAmB;IAEnD,8DAA8D;IAC9D,0EAA0E;IAC1E,kBAAkB;IAClB,MAAMC,uBAAuBC,IAAAA,cAAO,EAAC;QACnC,IAAI,CAACJ,cAAc;YACjB,yEAAyE;YACzE,aAAa;YACb,OAAO;QACT;QAEA,OAAO,IAAIb,8CAAuB,CAACa;IACrC,GAAG;QAACA;KAAa;IAEjB,IAAI,OAAOK,WAAW,aAAa;QACjC,iEAAiE;QACjE,MAAM,EAAEC,wBAAwB,EAAE,GAChCC,QAAQ;QACV,mEAAmE;QACnED,yBAAyB;IAC3B;IAEA,OAAOH;AACT;AAEA;;;;;;;;;;;;;;;;CAgBC,GACD,SAAST;IACP,8EAA8E;IAC9E,0EAA0E;IAC1E,OAAOO,IAAAA,iBAAU,EAACO,gDAAe;AACnC;AAOA;;;;;;;;;;;;;;;;;CAiBC,GACD,SAASb;IACP,MAAMc,SAASR,IAAAA,iBAAU,EAACS,+CAAgB;IAC1C,IAAID,WAAW,MAAM;QACnB,MAAM,IAAIE,MAAM;IAClB;IAEA,OAAOF;AACT;AAMA;;;;;;;;;;;;;;;;CAgBC,GACD,SAAShB;IACP,OAAOQ,IAAAA,iBAAU,EAACW,kDAAiB;AACrC;AAEA,0EAA0E,GAC1E,SAASC,6BACPC,IAAuB,EACvBC,gBAAwB,EACxBC,KAAY,EACZC,WAA0B;IAD1BD,IAAAA,kBAAAA,QAAQ;IACRC,IAAAA,wBAAAA,cAAwB,EAAE;IAE1B,IAAIC;IACJ,IAAIF,OAAO;QACT,kEAAkE;QAClEE,OAAOJ,IAAI,CAAC,EAAE,CAACC,iBAAiB;IAClC,OAAO;QACL,oGAAoG;QACpG,MAAMI,iBAAiBL,IAAI,CAAC,EAAE;YACvBK;QAAPD,OAAOC,CAAAA,2BAAAA,eAAeC,QAAQ,YAAvBD,2BAA2BE,OAAOC,MAAM,CAACH,eAAe,CAAC,EAAE;IACpE;IAEA,IAAI,CAACD,MAAM,OAAOD;IAClB,MAAMM,UAAUL,IAAI,CAAC,EAAE;IAEvB,MAAMM,eAAeC,IAAAA,gCAAe,EAACF;IACrC,IAAI,CAACC,gBAAgBA,aAAaE,UAAU,CAACC,yBAAgB,GAAG;QAC9D,OAAOV;IACT;IAEAA,YAAYW,IAAI,CAACJ;IAEjB,OAAOX,6BACLK,MACAH,kBACA,OACAE;AAEJ;AAEA;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GACD,SAASnB,0BACPiB,gBAAqC;IAArCA,IAAAA,6BAAAA,mBAA2B;IAE3B,MAAMc,UAAU5B,IAAAA,iBAAU,EAAC6B,kDAAmB;IAC9C,wFAAwF;IACxF,IAAI,CAACD,SAAS,OAAO;IAErB,OAAOhB,6BAA6BgB,QAAQf,IAAI,EAAEC;AACpD;AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,SAASlB,yBACPkB,gBAAqC;IAArCA,IAAAA,6BAAAA,mBAA2B;IAE3B,MAAMgB,yBAAyBjC,0BAA0BiB;IAEzD,IAAI,CAACgB,0BAA0BA,uBAAuBC,MAAM,KAAK,GAAG;QAClE,OAAO;IACT;IAEA,MAAMC,wBACJlB,qBAAqB,aACjBgB,sBAAsB,CAAC,EAAE,GACzBA,sBAAsB,CAACA,uBAAuBC,MAAM,GAAG,EAAE;IAE/D,yGAAyG;IACzG,yEAAyE;IACzE,OAAOC,0BAA0BC,4BAAmB,GAChD,OACAD;AACN"}

View File

@ -0,0 +1,13 @@
declare class ReadonlyURLSearchParams extends URLSearchParams {
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */
append(): void;
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */
delete(): void;
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */
set(): void;
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */
sort(): void;
}
export { redirect, permanentRedirect, RedirectType } from './redirect';
export { notFound } from './not-found';
export { ReadonlyURLSearchParams };

View File

@ -0,0 +1,63 @@
/** @internal */ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ReadonlyURLSearchParams: null,
RedirectType: null,
notFound: null,
permanentRedirect: null,
redirect: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ReadonlyURLSearchParams: function() {
return ReadonlyURLSearchParams;
},
RedirectType: function() {
return _redirect.RedirectType;
},
notFound: function() {
return _notfound.notFound;
},
permanentRedirect: function() {
return _redirect.permanentRedirect;
},
redirect: function() {
return _redirect.redirect;
}
});
const _redirect = require("./redirect");
const _notfound = require("./not-found");
class ReadonlyURLSearchParamsError extends Error {
constructor(){
super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams");
}
}
class ReadonlyURLSearchParams extends URLSearchParams {
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */ append() {
throw new ReadonlyURLSearchParamsError();
}
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */ delete() {
throw new ReadonlyURLSearchParamsError();
}
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */ set() {
throw new ReadonlyURLSearchParamsError();
}
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */ sort() {
throw new ReadonlyURLSearchParamsError();
}
}
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=navigation.react-server.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/navigation.react-server.ts"],"names":["ReadonlyURLSearchParams","RedirectType","notFound","permanentRedirect","redirect","ReadonlyURLSearchParamsError","Error","constructor","URLSearchParams","append","delete","set","sort"],"mappings":"AAAA,cAAc;;;;;;;;;;;;;;;;;;IA8BLA,uBAAuB;eAAvBA;;IAF6BC,YAAY;eAAZA,sBAAY;;IACzCC,QAAQ;eAARA,kBAAQ;;IADEC,iBAAiB;eAAjBA,2BAAiB;;IAA3BC,QAAQ;eAARA,kBAAQ;;;0BAAyC;0BACjC;AA5BzB,MAAMC,qCAAqCC;IACzCC,aAAc;QACZ,KAAK,CACH;IAEJ;AACF;AAEA,MAAMP,gCAAgCQ;IACpC,wKAAwK,GACxKC,SAAS;QACP,MAAM,IAAIJ;IACZ;IACA,wKAAwK,GACxKK,SAAS;QACP,MAAM,IAAIL;IACZ;IACA,wKAAwK,GACxKM,MAAM;QACJ,MAAM,IAAIN;IACZ;IACA,wKAAwK,GACxKO,OAAO;QACL,MAAM,IAAIP;IACZ;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export default function NoopHead(): null;

21
node_modules/next/dist/client/components/noop-head.js generated vendored Normal file
View File

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return NoopHead;
}
});
function NoopHead() {
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=noop-head.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/noop-head.tsx"],"names":["NoopHead"],"mappings":";;;;+BAAA;;;eAAwBA;;;AAAT,SAASA;IACtB,OAAO;AACT"}

View File

@ -0,0 +1,9 @@
import React from 'react';
interface NotFoundBoundaryProps {
notFound?: React.ReactNode;
notFoundStyles?: React.ReactNode;
asNotFound?: boolean;
children: React.ReactNode;
}
export declare function NotFoundBoundary({ notFound, notFoundStyles, asNotFound, children, }: NotFoundBoundaryProps): import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -0,0 +1,107 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NotFoundBoundary", {
enumerable: true,
get: function() {
return NotFoundBoundary;
}
});
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 _navigation = require("./navigation");
const _notfound = require("./not-found");
const _warnonce = require("../../shared/lib/utils/warn-once");
const _approutercontextsharedruntime = require("../../shared/lib/app-router-context.shared-runtime");
class NotFoundErrorBoundary extends _react.default.Component {
componentDidCatch() {
if (process.env.NODE_ENV === "development" && // 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, _notfound.isNotFoundError)(error)) {
return {
notFoundTriggered: true
};
}
// 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.notFoundTriggered) {
return {
notFoundTriggered: false,
previousPathname: props.pathname
};
}
return {
notFoundTriggered: state.notFoundTriggered,
previousPathname: props.pathname
};
}
render() {
if (this.state.notFoundTriggered) {
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: "not-found"
}),
this.props.notFoundStyles,
this.props.notFound
]
});
}
return this.props.children;
}
constructor(props){
super(props);
this.state = {
notFoundTriggered: !!props.asNotFound,
previousPathname: props.pathname
};
}
}
function NotFoundBoundary(param) {
let { notFound, notFoundStyles, asNotFound, children } = param;
const pathname = (0, _navigation.usePathname)();
const missingSlots = (0, _react.useContext)(_approutercontextsharedruntime.MissingSlotContext);
return notFound ? /*#__PURE__*/ (0, _jsxruntime.jsx)(NotFoundErrorBoundary, {
pathname: pathname,
notFound: notFound,
notFoundStyles: notFoundStyles,
asNotFound: asNotFound,
missingSlots: missingSlots,
children: children
}) : /*#__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=not-found-boundary.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found-boundary.tsx"],"names":["NotFoundBoundary","NotFoundErrorBoundary","React","Component","componentDidCatch","process","env","NODE_ENV","props","missingSlots","has","warningMessage","size","formattedSlots","Array","from","sort","a","b","localeCompare","map","slot","join","warnOnce","getDerivedStateFromError","error","isNotFoundError","notFoundTriggered","getDerivedStateFromProps","state","pathname","previousPathname","render","meta","name","content","notFoundStyles","notFound","children","constructor","asNotFound","usePathname","useContext","MissingSlotContext"],"mappings":"AAAA;;;;;+BA8GgBA;;;eAAAA;;;;;iEA5GkB;4BACN;0BACI;0BACP;+CACU;AAmBnC,MAAMC,8BAA8BC,cAAK,CAACC,SAAS;IAYjDC,oBAA0B;QACxB,IACEC,QAAQC,GAAG,CAACC,QAAQ,KAAK,iBACzB,4EAA4E;QAC5E,CAAC,IAAI,CAACC,KAAK,CAACC,YAAY,CAACC,GAAG,CAAC,aAC7B;YACA,IAAIC,iBACF,4HACA;YAEF,IAAI,IAAI,CAACH,KAAK,CAACC,YAAY,CAACG,IAAI,GAAG,GAAG;gBACpC,MAAMC,iBAAiBC,MAAMC,IAAI,CAAC,IAAI,CAACP,KAAK,CAACC,YAAY,EACtDO,IAAI,CAAC,CAACC,GAAGC,IAAMD,EAAEE,aAAa,CAACD,IAC/BE,GAAG,CAAC,CAACC,OAAS,AAAC,MAAGA,MAClBC,IAAI,CAAC;gBAERX,kBAAkB,oBAAoBE;YACxC;YAEAU,IAAAA,kBAAQ,EAACZ;QACX;IACF;IAEA,OAAOa,yBAAyBC,KAAU,EAAE;QAC1C,IAAIC,IAAAA,yBAAe,EAACD,QAAQ;YAC1B,OAAO;gBACLE,mBAAmB;YACrB;QACF;QACA,mCAAmC;QACnC,MAAMF;IACR;IAEA,OAAOG,yBACLpB,KAAiC,EACjCqB,KAAiC,EACE;QACnC;;;;;KAKC,GACD,IAAIrB,MAAMsB,QAAQ,KAAKD,MAAME,gBAAgB,IAAIF,MAAMF,iBAAiB,EAAE;YACxE,OAAO;gBACLA,mBAAmB;gBACnBI,kBAAkBvB,MAAMsB,QAAQ;YAClC;QACF;QACA,OAAO;YACLH,mBAAmBE,MAAMF,iBAAiB;YAC1CI,kBAAkBvB,MAAMsB,QAAQ;QAClC;IACF;IAEAE,SAAS;QACP,IAAI,IAAI,CAACH,KAAK,CAACF,iBAAiB,EAAE;YAChC,qBACE;;kCACE,qBAACM;wBAAKC,MAAK;wBAASC,SAAQ;;oBAC3B9B,QAAQC,GAAG,CAACC,QAAQ,KAAK,+BACxB,qBAAC0B;wBAAKC,MAAK;wBAAaC,SAAQ;;oBAEjC,IAAI,CAAC3B,KAAK,CAAC4B,cAAc;oBACzB,IAAI,CAAC5B,KAAK,CAAC6B,QAAQ;;;QAG1B;QAEA,OAAO,IAAI,CAAC7B,KAAK,CAAC8B,QAAQ;IAC5B;IA9EAC,YAAY/B,KAAiC,CAAE;QAC7C,KAAK,CAACA;QACN,IAAI,CAACqB,KAAK,GAAG;YACXF,mBAAmB,CAAC,CAACnB,MAAMgC,UAAU;YACrCT,kBAAkBvB,MAAMsB,QAAQ;QAClC;IACF;AAyEF;AAEO,SAAS9B,iBAAiB,KAKT;IALS,IAAA,EAC/BqC,QAAQ,EACRD,cAAc,EACdI,UAAU,EACVF,QAAQ,EACc,GALS;IAM/B,MAAMR,WAAWW,IAAAA,uBAAW;IAC5B,MAAMhC,eAAeiC,IAAAA,iBAAU,EAACC,iDAAkB;IAClD,OAAON,yBACL,qBAACpC;QACC6B,UAAUA;QACVO,UAAUA;QACVD,gBAAgBA;QAChBI,YAAYA;QACZ/B,cAAcA;kBAEb6B;uBAGH;kBAAGA;;AAEP"}

View File

@ -0,0 +1 @@
export default function NotFound(): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return NotFound;
}
});
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 NotFound() {
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)("title", {
children: "404: This page could not be found."
}),
/*#__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: "404"
}),
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
style: styles.desc,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("h2", {
style: styles.h2,
children: "This page could not be found."
})
})
]
})
})
]
});
}
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=not-found-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found-error.tsx"],"names":["NotFound","styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","desc","h1","margin","padding","fontSize","fontWeight","verticalAlign","lineHeight","h2","title","div","style","dangerouslySetInnerHTML","__html","className"],"mappings":";;;;+BAqCA;;;eAAwBA;;;;;gEArCN;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;AAEe,SAASZ;IACtB,qBACE;;0BAEE,qBAACmB;0BAAM;;0BAEP,qBAACC;gBAAIC,OAAOpB,OAAOC,KAAK;0BACtB,cAAA,sBAACkB;;sCACC,qBAACC;4BACCC,yBAAyB;gCACvB;;;;;;;;;;;;cAYA,GACAC,QAAS;4BACX;;sCAEF,qBAACZ;4BAAGa,WAAU;4BAAgBH,OAAOpB,OAAOU,EAAE;sCAAE;;sCAGhD,qBAACS;4BAAIC,OAAOpB,OAAOS,IAAI;sCACrB,cAAA,qBAACQ;gCAAGG,OAAOpB,OAAOiB,EAAE;0CAAE;;;;;;;;AAMlC"}

View File

@ -0,0 +1,28 @@
declare const NOT_FOUND_ERROR_CODE = "NEXT_NOT_FOUND";
type NotFoundError = Error & {
digest: typeof NOT_FOUND_ERROR_CODE;
};
/**
* This function allows you to render the [not-found.js file](https://nextjs.org/docs/app/api-reference/file-conventions/not-found)
* within a route segment as well as inject a tag.
*
* `notFound()` 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).
*
* - In a Server Component, this will insert a `<meta name="robots" content="noindex" />` meta tag and set the status code to 404.
* - In a Route Handler or Server Action, it will serve a 404 to the caller.
*
* Read more: [Next.js Docs: `notFound`](https://nextjs.org/docs/app/api-reference/functions/not-found)
*/
export declare function notFound(): never;
/**
* Checks an error to determine if it's an error generated by the `notFound()`
* helper.
*
* @param error the error that may reference a not found error
* @returns true if the error is a not found error
*/
export declare function isNotFoundError(error: unknown): error is NotFoundError;
export {};

43
node_modules/next/dist/client/components/not-found.js generated vendored Normal file
View File

@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
isNotFoundError: null,
notFound: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
isNotFoundError: function() {
return isNotFoundError;
},
notFound: function() {
return notFound;
}
});
const NOT_FOUND_ERROR_CODE = "NEXT_NOT_FOUND";
function notFound() {
// eslint-disable-next-line no-throw-literal
const error = new Error(NOT_FOUND_ERROR_CODE);
error.digest = NOT_FOUND_ERROR_CODE;
throw error;
}
function isNotFoundError(error) {
if (typeof error !== "object" || error === null || !("digest" in error)) {
return false;
}
return error.digest === NOT_FOUND_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=not-found.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found.ts"],"names":["isNotFoundError","notFound","NOT_FOUND_ERROR_CODE","error","Error","digest"],"mappings":";;;;;;;;;;;;;;;IAgCgBA,eAAe;eAAfA;;IAdAC,QAAQ;eAARA;;;AAlBhB,MAAMC,uBAAuB;AAkBtB,SAASD;IACd,4CAA4C;IAC5C,MAAME,QAAQ,IAAIC,MAAMF;IACtBC,MAAwBE,MAAM,GAAGH;IACnC,MAAMC;AACR;AASO,SAASH,gBAAgBG,KAAc;IAC5C,IAAI,OAAOA,UAAU,YAAYA,UAAU,QAAQ,CAAE,CAAA,YAAYA,KAAI,GAAI;QACvE,OAAO;IACT;IAEA,OAAOA,MAAME,MAAM,KAAKH;AAC1B"}

View File

@ -0,0 +1,2 @@
export declare const PARALLEL_ROUTE_DEFAULT_PATH = "next/dist/client/components/parallel-route-default.js";
export default function ParallelRouteDefault(): void;

View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
PARALLEL_ROUTE_DEFAULT_PATH: null,
default: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
PARALLEL_ROUTE_DEFAULT_PATH: function() {
return PARALLEL_ROUTE_DEFAULT_PATH;
},
default: function() {
return ParallelRouteDefault;
}
});
const _notfound = require("./not-found");
const PARALLEL_ROUTE_DEFAULT_PATH = "next/dist/client/components/parallel-route-default.js";
function ParallelRouteDefault() {
(0, _notfound.notFound)();
}
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=parallel-route-default.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/parallel-route-default.tsx"],"names":["PARALLEL_ROUTE_DEFAULT_PATH","ParallelRouteDefault","notFound"],"mappings":";;;;;;;;;;;;;;;IAEaA,2BAA2B;eAA3BA;;IAGb,OAEC;eAFuBC;;;0BALC;AAElB,MAAMD,8BACX;AAEa,SAASC;IACtBC,IAAAA,kBAAQ;AACV"}

View File

@ -0,0 +1,6 @@
export declare class PromiseQueue {
#private;
constructor(maxConcurrency?: number);
enqueue<T>(promiseFn: () => Promise<T>): Promise<T>;
bump(promiseFn: Promise<any>): void;
}

View File

@ -0,0 +1,91 @@
/*
This is a simple promise queue that allows you to limit the number of concurrent promises
that are running at any given time. It's used to limit the number of concurrent
prefetch requests that are being made to the server but could be used for other
things as well.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PromiseQueue", {
enumerable: true,
get: function() {
return PromiseQueue;
}
});
const _class_private_field_loose_base = require("@swc/helpers/_/_class_private_field_loose_base");
const _class_private_field_loose_key = require("@swc/helpers/_/_class_private_field_loose_key");
var _maxConcurrency = /*#__PURE__*/ _class_private_field_loose_key._("_maxConcurrency"), _runningCount = /*#__PURE__*/ _class_private_field_loose_key._("_runningCount"), _queue = /*#__PURE__*/ _class_private_field_loose_key._("_queue"), _processNext = /*#__PURE__*/ _class_private_field_loose_key._("_processNext");
class PromiseQueue {
enqueue(promiseFn) {
let taskResolve;
let taskReject;
const taskPromise = new Promise((resolve, reject)=>{
taskResolve = resolve;
taskReject = reject;
});
const task = async ()=>{
try {
_class_private_field_loose_base._(this, _runningCount)[_runningCount]++;
const result = await promiseFn();
taskResolve(result);
} catch (error) {
taskReject(error);
} finally{
_class_private_field_loose_base._(this, _runningCount)[_runningCount]--;
_class_private_field_loose_base._(this, _processNext)[_processNext]();
}
};
const enqueueResult = {
promiseFn: taskPromise,
task
};
// wonder if we should take a LIFO approach here
_class_private_field_loose_base._(this, _queue)[_queue].push(enqueueResult);
_class_private_field_loose_base._(this, _processNext)[_processNext]();
return taskPromise;
}
bump(promiseFn) {
const index = _class_private_field_loose_base._(this, _queue)[_queue].findIndex((item)=>item.promiseFn === promiseFn);
if (index > -1) {
const bumpedItem = _class_private_field_loose_base._(this, _queue)[_queue].splice(index, 1)[0];
_class_private_field_loose_base._(this, _queue)[_queue].unshift(bumpedItem);
_class_private_field_loose_base._(this, _processNext)[_processNext](true);
}
}
constructor(maxConcurrency = 5){
Object.defineProperty(this, _processNext, {
value: processNext
});
Object.defineProperty(this, _maxConcurrency, {
writable: true,
value: void 0
});
Object.defineProperty(this, _runningCount, {
writable: true,
value: void 0
});
Object.defineProperty(this, _queue, {
writable: true,
value: void 0
});
_class_private_field_loose_base._(this, _maxConcurrency)[_maxConcurrency] = maxConcurrency;
_class_private_field_loose_base._(this, _runningCount)[_runningCount] = 0;
_class_private_field_loose_base._(this, _queue)[_queue] = [];
}
}
function processNext(forced) {
if (forced === void 0) forced = false;
if ((_class_private_field_loose_base._(this, _runningCount)[_runningCount] < _class_private_field_loose_base._(this, _maxConcurrency)[_maxConcurrency] || forced) && _class_private_field_loose_base._(this, _queue)[_queue].length > 0) {
var _class_private_field_loose_base__queue_shift;
(_class_private_field_loose_base__queue_shift = _class_private_field_loose_base._(this, _queue)[_queue].shift()) == null ? void 0 : _class_private_field_loose_base__queue_shift.task();
}
}
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=promise-queue.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/promise-queue.ts"],"names":["PromiseQueue","enqueue","promiseFn","taskResolve","taskReject","taskPromise","Promise","resolve","reject","task","runningCount","result","error","processNext","enqueueResult","queue","push","bump","index","findIndex","item","bumpedItem","splice","unshift","constructor","maxConcurrency","forced","length","shift"],"mappings":"AAAA;;;;;AAKA;;;;+BACaA;;;eAAAA;;;;;IACX,qFACA,iFACA,mEAmDA;AAtDK,MAAMA;IAcXC,QAAWC,SAA2B,EAAc;QAClD,IAAIC;QACJ,IAAIC;QAEJ,MAAMC,cAAc,IAAIC,QAAQ,CAACC,SAASC;YACxCL,cAAcI;YACdH,aAAaI;QACf;QAEA,MAAMC,OAAO;YACX,IAAI;gBACF,kCAAA,IAAI,EAAEC,eAAAA;gBACN,MAAMC,SAAS,MAAMT;gBACrBC,YAAYQ;YACd,EAAE,OAAOC,OAAO;gBACdR,WAAWQ;YACb,SAAU;gBACR,kCAAA,IAAI,EAAEF,eAAAA;gBACN,kCAAA,IAAI,EAAEG,cAAAA;YACR;QACF;QAEA,MAAMC,gBAAgB;YAAEZ,WAAWG;YAAaI;QAAK;QACrD,gDAAgD;QAChD,kCAAA,IAAI,EAAEM,QAAAA,QAAMC,IAAI,CAACF;QACjB,kCAAA,IAAI,EAAED,cAAAA;QAEN,OAAOR;IACT;IAEAY,KAAKf,SAAuB,EAAE;QAC5B,MAAMgB,QAAQ,kCAAA,IAAI,EAAEH,QAAAA,QAAMI,SAAS,CAAC,CAACC,OAASA,KAAKlB,SAAS,KAAKA;QAEjE,IAAIgB,QAAQ,CAAC,GAAG;YACd,MAAMG,aAAa,kCAAA,IAAI,EAAEN,QAAAA,QAAMO,MAAM,CAACJ,OAAO,EAAE,CAAC,EAAE;YAClD,kCAAA,IAAI,EAAEH,QAAAA,QAAMQ,OAAO,CAACF;YACpB,kCAAA,IAAI,EAAER,cAAAA,cAAY;QACpB;IACF;IA5CAW,YAAYC,iBAAiB,CAAC,CAAE;QA8ChC,4BAAA;mBAAA;;QArDA,4BAAA;;mBAAA,KAAA;;QACA,4BAAA;;mBAAA,KAAA;;QACA,4BAAA;;mBAAA,KAAA;;QAME,kCAAA,IAAI,EAAEA,iBAAAA,mBAAiBA;QACvB,kCAAA,IAAI,EAAEf,eAAAA,iBAAe;QACrB,kCAAA,IAAI,EAAEK,QAAAA,UAAQ,EAAE;IAClB;AAkDF;AARE,SAAA,YAAaW,MAAc;IAAdA,IAAAA,mBAAAA,SAAS;IACpB,IACE,AAAC,CAAA,kCAAA,IAAI,EAAEhB,eAAAA,iBAAe,kCAAA,IAAI,EAAEe,iBAAAA,oBAAkBC,MAAK,KACnD,kCAAA,IAAI,EAAEX,QAAAA,QAAMY,MAAM,GAAG,GACrB;YACA;SAAA,+CAAA,kCAAA,IAAI,EAAEZ,QAAAA,QAAMa,KAAK,uBAAjB,6CAAqBnB,IAAI;IAC3B;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,19 @@
import * as React from 'react';
import { type OverlayState } from '../shared';
import type { SupportedErrorEvent } from '../internal/container/Errors';
interface ReactDevOverlayState {
reactError: SupportedErrorEvent | null;
}
export default class ReactDevOverlay extends React.PureComponent<{
state: OverlayState;
children: React.ReactNode;
onReactError: (error: Error) => void;
}, ReactDevOverlayState> {
state: {
reactError: null;
};
static getDerivedStateFromError(error: Error): ReactDevOverlayState;
componentDidCatch(componentErr: Error): void;
render(): import("react/jsx-runtime").JSX.Element;
}
export {};

View File

@ -0,0 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return ReactDevOverlay;
}
});
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 _shared = require("../shared");
const _ShadowPortal = require("../internal/components/ShadowPortal");
const _BuildError = require("../internal/container/BuildError");
const _Errors = require("../internal/container/Errors");
const _parseStack = require("../internal/helpers/parseStack");
const _Base = require("../internal/styles/Base");
const _ComponentStyles = require("../internal/styles/ComponentStyles");
const _CssReset = require("../internal/styles/CssReset");
const _rootlayoutmissingtagserror = require("../internal/container/root-layout-missing-tags-error");
class ReactDevOverlay extends _react.PureComponent {
static getDerivedStateFromError(error) {
if (!error.stack) return {
reactError: null
};
return {
reactError: {
id: 0,
event: {
type: _shared.ACTION_UNHANDLED_ERROR,
reason: error,
frames: (0, _parseStack.parseStack)(error.stack)
}
}
};
}
componentDidCatch(componentErr) {
this.props.onReactError(componentErr);
}
render() {
var _state_rootLayoutMissingTags, _state_rootLayoutMissingTags1;
const { state, children } = this.props;
const { reactError } = this.state;
const hasBuildError = state.buildError != null;
const hasRuntimeErrors = Boolean(state.errors.length);
const hasMissingTags = Boolean((_state_rootLayoutMissingTags = state.rootLayoutMissingTags) == null ? void 0 : _state_rootLayoutMissingTags.length);
const isMounted = hasBuildError || hasRuntimeErrors || reactError || hasMissingTags;
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
children: [
reactError ? /*#__PURE__*/ (0, _jsxruntime.jsxs)("html", {
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)("head", {}),
/*#__PURE__*/ (0, _jsxruntime.jsx)("body", {})
]
}) : children,
isMounted ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_ShadowPortal.ShadowPortal, {
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)(_CssReset.CssReset, {}),
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Base.Base, {}),
/*#__PURE__*/ (0, _jsxruntime.jsx)(_ComponentStyles.ComponentStyles, {}),
((_state_rootLayoutMissingTags1 = state.rootLayoutMissingTags) == null ? void 0 : _state_rootLayoutMissingTags1.length) ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_rootlayoutmissingtagserror.RootLayoutMissingTagsError, {
missingTags: state.rootLayoutMissingTags
}) : hasBuildError ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_BuildError.BuildError, {
message: state.buildError,
versionInfo: state.versionInfo
}) : reactError ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Errors.Errors, {
isAppDir: true,
versionInfo: state.versionInfo,
initialDisplayState: "fullscreen",
errors: [
reactError
]
}) : hasRuntimeErrors ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Errors.Errors, {
isAppDir: true,
initialDisplayState: "minimized",
errors: state.errors,
versionInfo: state.versionInfo
}) : undefined
]
}) : undefined
]
});
}
constructor(...args){
super(...args);
this.state = {
reactError: 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=ReactDevOverlay.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/app/ReactDevOverlay.tsx"],"names":["ReactDevOverlay","React","PureComponent","getDerivedStateFromError","error","stack","reactError","id","event","type","ACTION_UNHANDLED_ERROR","reason","frames","parseStack","componentDidCatch","componentErr","props","onReactError","render","state","children","hasBuildError","buildError","hasRuntimeErrors","Boolean","errors","length","hasMissingTags","rootLayoutMissingTags","isMounted","html","head","body","ShadowPortal","CssReset","Base","ComponentStyles","RootLayoutMissingTagsError","missingTags","BuildError","message","versionInfo","Errors","isAppDir","initialDisplayState","undefined"],"mappings":";;;;;;;eAgBqBA;;;;;iEAhBE;wBACmC;8BAE7B;4BACF;wBACJ;4BAEI;sBACN;iCACW;0BACP;4CACkB;AAK5B,MAAMA,wBAAwBC,OAAMC,aAAa;IAU9D,OAAOC,yBAAyBC,KAAY,EAAwB;QAClE,IAAI,CAACA,MAAMC,KAAK,EAAE,OAAO;YAAEC,YAAY;QAAK;QAC5C,OAAO;YACLA,YAAY;gBACVC,IAAI;gBACJC,OAAO;oBACLC,MAAMC,8BAAsB;oBAC5BC,QAAQP;oBACRQ,QAAQC,IAAAA,sBAAU,EAACT,MAAMC,KAAK;gBAChC;YACF;QACF;IACF;IAEAS,kBAAkBC,YAAmB,EAAE;QACrC,IAAI,CAACC,KAAK,CAACC,YAAY,CAACF;IAC1B;IAEAG,SAAS;YAMwBC,8BAmBtBA;QAxBT,MAAM,EAAEA,KAAK,EAAEC,QAAQ,EAAE,GAAG,IAAI,CAACJ,KAAK;QACtC,MAAM,EAAEV,UAAU,EAAE,GAAG,IAAI,CAACa,KAAK;QAEjC,MAAME,gBAAgBF,MAAMG,UAAU,IAAI;QAC1C,MAAMC,mBAAmBC,QAAQL,MAAMM,MAAM,CAACC,MAAM;QACpD,MAAMC,iBAAiBH,SAAQL,+BAAAA,MAAMS,qBAAqB,qBAA3BT,6BAA6BO,MAAM;QAClE,MAAMG,YACJR,iBAAiBE,oBAAoBjB,cAAcqB;QAErD,qBACE;;gBACGrB,2BACC,sBAACwB;;sCACC,qBAACC;sCACD,qBAACC;;qBAGHZ;gBAEDS,0BACC,sBAACI,0BAAY;;sCACX,qBAACC,kBAAQ;sCACT,qBAACC,UAAI;sCACL,qBAACC,gCAAe;wBACfjB,EAAAA,gCAAAA,MAAMS,qBAAqB,qBAA3BT,8BAA6BO,MAAM,kBAClC,qBAACW,sDAA0B;4BACzBC,aAAanB,MAAMS,qBAAqB;6BAExCP,8BACF,qBAACkB,sBAAU;4BACTC,SAASrB,MAAMG,UAAU;4BACzBmB,aAAatB,MAAMsB,WAAW;6BAE9BnC,2BACF,qBAACoC,cAAM;4BACLC,UAAU;4BACVF,aAAatB,MAAMsB,WAAW;4BAC9BG,qBAAoB;4BACpBnB,QAAQ;gCAACnB;6BAAW;6BAEpBiB,iCACF,qBAACmB,cAAM;4BACLC,UAAU;4BACVC,qBAAoB;4BACpBnB,QAAQN,MAAMM,MAAM;4BACpBgB,aAAatB,MAAMsB,WAAW;6BAE9BI;;qBAEJA;;;IAGV;;;aAzEA1B,QAAQ;YAAEb,YAAY;QAAK;;AA0E7B"}

View File

@ -0,0 +1,5 @@
import type { ReactNode } from 'react';
export default function HotReload({ assetPrefix, children, }: {
assetPrefix: string;
children?: ReactNode;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,444 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return HotReload;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _stripansi = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/strip-ansi"));
const _formatwebpackmessages = /*#__PURE__*/ _interop_require_default._(require("../internal/helpers/format-webpack-messages"));
const _navigation = require("../../navigation");
const _shared = require("../shared");
const _parseStack = require("../internal/helpers/parseStack");
const _ReactDevOverlay = /*#__PURE__*/ _interop_require_default._(require("./ReactDevOverlay"));
const _useerrorhandler = require("../internal/helpers/use-error-handler");
const _runtimeerrorhandler = require("../internal/helpers/runtime-error-handler");
const _usewebsocket = require("../internal/helpers/use-websocket");
const _parsecomponentstack = require("../internal/helpers/parse-component-stack");
const _hotreloadertypes = require("../../../../server/dev/hot-reloader-types");
const _extractmodulesfromturbopackmessage = require("../../../../server/dev/extract-modules-from-turbopack-message");
let mostRecentCompilationHash = null;
let __nextDevClientId = Math.round(Math.random() * 100 + Date.now());
let reloading = false;
let startLatency = null;
function onBeforeFastRefresh(dispatcher, hasUpdates) {
if (hasUpdates) {
dispatcher.onBeforeRefresh();
}
}
function onFastRefresh(dispatcher, sendMessage, updatedModules) {
dispatcher.onBuildOk();
reportHmrLatency(sendMessage, updatedModules);
dispatcher.onRefresh();
}
function reportHmrLatency(sendMessage, updatedModules) {
if (!startLatency) return;
let endLatency = Date.now();
const latency = endLatency - startLatency;
console.log("[Fast Refresh] done in " + latency + "ms");
sendMessage(JSON.stringify({
event: "client-hmr-latency",
id: window.__nextDevClientId,
startTime: startLatency,
endTime: endLatency,
page: window.location.pathname,
updatedModules,
// Whether the page (tab) was hidden at the time the event occurred.
// This can impact the accuracy of the event's timing.
isPageHidden: document.visibilityState === "hidden"
}));
}
// There is a newer version of the code available.
function handleAvailableHash(hash) {
// Update last known compilation hash.
mostRecentCompilationHash = hash;
}
/**
* Is there a newer version of this code available?
* For webpack: Check if the hash changed compared to __webpack_hash__
* For Turbopack: Always true because it doesn't have __webpack_hash__
*/ function isUpdateAvailable() {
if (process.env.TURBOPACK) {
return true;
}
/* globals __webpack_hash__ */ // __webpack_hash__ is the hash of the current compilation.
// It's a global variable injected by Webpack.
return mostRecentCompilationHash !== __webpack_hash__;
}
// Webpack disallows updates in other states.
function canApplyUpdates() {
// @ts-expect-error module.hot exists
return module.hot.status() === "idle";
}
function afterApplyUpdates(fn) {
if (canApplyUpdates()) {
fn();
} else {
function handler(status) {
if (status === "idle") {
// @ts-expect-error module.hot exists
module.hot.removeStatusHandler(handler);
fn();
}
}
// @ts-expect-error module.hot exists
module.hot.addStatusHandler(handler);
}
}
function performFullReload(err, sendMessage) {
const stackTrace = err && (err.stack && err.stack.split("\n").slice(0, 5).join("\n") || err.message || err + "");
sendMessage(JSON.stringify({
event: "client-full-reload",
stackTrace,
hadRuntimeError: !!_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError,
dependencyChain: err ? err.dependencyChain : undefined
}));
if (reloading) return;
reloading = true;
window.location.reload();
}
// Attempt to update code on the fly, fall back to a hard reload.
function tryApplyUpdates(onBeforeUpdate, onHotUpdateSuccess, sendMessage, dispatcher) {
if (!isUpdateAvailable() || !canApplyUpdates()) {
dispatcher.onBuildOk();
return;
}
function handleApplyUpdates(err, updatedModules) {
if (err || _runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError || !updatedModules) {
if (err) {
console.warn("[Fast Refresh] performing full reload\n\n" + "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React rendering tree.\n" + "You might have a file which exports a React component but also exports a value that is imported by a non-React component file.\n" + "Consider migrating the non-React component export to a separate file and importing it into both files.\n\n" + "It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\n" + "Fast Refresh requires at least one parent function component in your React tree.");
} else if (_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
console.warn(_shared.REACT_REFRESH_FULL_RELOAD_FROM_ERROR);
}
performFullReload(err, sendMessage);
return;
}
const hasUpdates = Boolean(updatedModules.length);
if (typeof onHotUpdateSuccess === "function") {
// Maybe we want to do something.
onHotUpdateSuccess(updatedModules);
}
if (isUpdateAvailable()) {
// While we were updating, there was a new update! Do it again.
tryApplyUpdates(hasUpdates ? ()=>{} : onBeforeUpdate, hasUpdates ? ()=>dispatcher.onBuildOk() : onHotUpdateSuccess, sendMessage, dispatcher);
} else {
dispatcher.onBuildOk();
if (process.env.__NEXT_TEST_MODE) {
afterApplyUpdates(()=>{
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB();
self.__NEXT_HMR_CB = null;
}
});
}
}
}
// https://webpack.js.org/api/hot-module-replacement/#check
// @ts-expect-error module.hot exists
module.hot.check(/* autoApply */ false).then((updatedModules)=>{
if (!updatedModules) {
return null;
}
if (typeof onBeforeUpdate === "function") {
const hasUpdates = Boolean(updatedModules.length);
onBeforeUpdate(hasUpdates);
}
// https://webpack.js.org/api/hot-module-replacement/#apply
// @ts-expect-error module.hot exists
return module.hot.apply();
}).then((updatedModules)=>{
handleApplyUpdates(null, updatedModules);
}, (err)=>{
handleApplyUpdates(err, null);
});
}
/** Handles messages from the sevrer for the App Router. */ function processMessage(obj, sendMessage, processTurbopackMessage, router, dispatcher) {
if (!("action" in obj)) {
return;
}
function handleErrors(errors) {
// "Massage" webpack messages.
const formatted = (0, _formatwebpackmessages.default)({
errors: errors,
warnings: []
});
// Only show the first error.
dispatcher.onBuildError(formatted.errors[0]);
// Also log them to the console.
for(let i = 0; i < formatted.errors.length; i++){
console.error((0, _stripansi.default)(formatted.errors[i]));
}
// Do not attempt to reload now.
// We will reload on next success instead.
if (process.env.__NEXT_TEST_MODE) {
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB(formatted.errors[0]);
self.__NEXT_HMR_CB = null;
}
}
}
function handleHotUpdate() {
if (process.env.TURBOPACK) {
dispatcher.onBuildOk();
} else {
tryApplyUpdates(function onBeforeHotUpdate(hasUpdates) {
onBeforeFastRefresh(dispatcher, hasUpdates);
}, function onSuccessfulHotUpdate(webpackUpdatedModules) {
// Only dismiss it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
onFastRefresh(dispatcher, sendMessage, webpackUpdatedModules);
}, sendMessage, dispatcher);
}
}
switch(obj.action){
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.BUILDING:
{
startLatency = Date.now();
console.log("[Fast Refresh] rebuilding");
break;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.BUILT:
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SYNC:
{
if (obj.hash) {
handleAvailableHash(obj.hash);
}
const { errors, warnings } = obj;
// Is undefined when it's a 'built' event
if ("versionInfo" in obj) dispatcher.onVersionInfo(obj.versionInfo);
const hasErrors = Boolean(errors && errors.length);
// Compilation with errors (e.g. syntax error or missing modules).
if (hasErrors) {
sendMessage(JSON.stringify({
event: "client-error",
errorCount: errors.length,
clientId: __nextDevClientId
}));
handleErrors(errors);
return;
}
const hasWarnings = Boolean(warnings && warnings.length);
if (hasWarnings) {
sendMessage(JSON.stringify({
event: "client-warning",
warningCount: warnings.length,
clientId: __nextDevClientId
}));
// Print warnings to the console.
const formattedMessages = (0, _formatwebpackmessages.default)({
warnings: warnings,
errors: []
});
for(let i = 0; i < formattedMessages.warnings.length; i++){
if (i === 5) {
console.warn("There were more warnings in other files.\n" + "You can find a complete log in the terminal.");
break;
}
console.warn((0, _stripansi.default)(formattedMessages.warnings[i]));
}
// No early return here as we need to apply modules in the same way between warnings only and compiles without warnings
}
sendMessage(JSON.stringify({
event: "client-success",
clientId: __nextDevClientId
}));
if (obj.action === _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.BUILT) {
// Handle hot updates
handleHotUpdate();
}
return;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED:
{
processTurbopackMessage({
type: _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED
});
break;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE:
{
const updatedModules = (0, _extractmodulesfromturbopackmessage.extractModulesFromTurbopackMessage)(obj.data);
dispatcher.onBeforeRefresh();
processTurbopackMessage({
type: _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE,
data: obj.data
});
dispatcher.onRefresh();
if (_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
console.warn(_shared.REACT_REFRESH_FULL_RELOAD_FROM_ERROR);
performFullReload(null, sendMessage);
}
reportHmrLatency(sendMessage, updatedModules);
break;
}
// TODO-APP: make server component change more granular
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES:
{
sendMessage(JSON.stringify({
event: "server-component-reload-page",
clientId: __nextDevClientId
}));
if (_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
if (reloading) return;
reloading = true;
return window.location.reload();
}
(0, _react.startTransition)(()=>{
router.fastRefresh();
dispatcher.onRefresh();
});
if (process.env.__NEXT_TEST_MODE) {
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB();
self.__NEXT_HMR_CB = null;
}
}
return;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE:
{
sendMessage(JSON.stringify({
event: "client-reload-page",
clientId: __nextDevClientId
}));
if (reloading) return;
reloading = true;
return window.location.reload();
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE:
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE:
{
// TODO-APP: potentially only refresh if the currently viewed page was added/removed.
return router.fastRefresh();
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR:
{
const { errorJSON } = obj;
if (errorJSON) {
const { message, stack } = JSON.parse(errorJSON);
const error = new Error(message);
error.stack = stack;
handleErrors([
error
]);
}
return;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE:
{
return;
}
default:
{}
}
}
function HotReload(param) {
let { assetPrefix, children } = param;
const [state, dispatch] = (0, _shared.useErrorOverlayReducer)();
const dispatcher = (0, _react.useMemo)(()=>{
return {
onBuildOk () {
dispatch({
type: _shared.ACTION_BUILD_OK
});
},
onBuildError (message) {
dispatch({
type: _shared.ACTION_BUILD_ERROR,
message
});
},
onBeforeRefresh () {
dispatch({
type: _shared.ACTION_BEFORE_REFRESH
});
},
onRefresh () {
dispatch({
type: _shared.ACTION_REFRESH
});
},
onVersionInfo (versionInfo) {
dispatch({
type: _shared.ACTION_VERSION_INFO,
versionInfo
});
}
};
}, [
dispatch
]);
const handleOnUnhandledError = (0, _react.useCallback)((error)=>{
const errorDetails = error.details;
// Component stack is added to the error in use-error-handler in case there was a hydration errror
const componentStack = errorDetails == null ? void 0 : errorDetails.componentStack;
const warning = errorDetails == null ? void 0 : errorDetails.warning;
dispatch({
type: _shared.ACTION_UNHANDLED_ERROR,
reason: error,
frames: (0, _parseStack.parseStack)(error.stack),
componentStackFrames: componentStack ? (0, _parsecomponentstack.parseComponentStack)(componentStack) : undefined,
warning
});
}, [
dispatch
]);
const handleOnUnhandledRejection = (0, _react.useCallback)((reason)=>{
dispatch({
type: _shared.ACTION_UNHANDLED_REJECTION,
reason: reason,
frames: (0, _parseStack.parseStack)(reason.stack)
});
}, [
dispatch
]);
const handleOnReactError = (0, _react.useCallback)(()=>{
_runtimeerrorhandler.RuntimeErrorHandler.hadRuntimeError = true;
}, []);
(0, _useerrorhandler.useErrorHandler)(handleOnUnhandledError, handleOnUnhandledRejection);
const webSocketRef = (0, _usewebsocket.useWebsocket)(assetPrefix);
(0, _usewebsocket.useWebsocketPing)(webSocketRef);
const sendMessage = (0, _usewebsocket.useSendMessage)(webSocketRef);
const processTurbopackMessage = (0, _usewebsocket.useTurbopack)(sendMessage, (err)=>performFullReload(err, sendMessage));
const router = (0, _navigation.useRouter)();
(0, _react.useEffect)(()=>{
const websocket = webSocketRef.current;
if (!websocket) return;
const handler = (event)=>{
try {
const obj = JSON.parse(event.data);
processMessage(obj, sendMessage, processTurbopackMessage, router, dispatcher);
} catch (err) {
var _err_stack;
console.warn("[HMR] Invalid message: " + event.data + "\n" + ((_err_stack = err == null ? void 0 : err.stack) != null ? _err_stack : ""));
}
};
websocket.addEventListener("message", handler);
return ()=>websocket.removeEventListener("message", handler);
}, [
sendMessage,
router,
webSocketRef,
dispatcher,
processTurbopackMessage
]);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ReactDevOverlay.default, {
onReactError: handleOnReactError,
state: state,
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=hot-reloader-client.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
import * as React from 'react';
import type { StackFrame } from 'next/dist/compiled/stacktrace-parser';
export type CodeFrameProps = {
stackFrame: StackFrame;
codeFrame: string;
};
export declare const CodeFrame: React.FC<CodeFrameProps>;

View File

@ -0,0 +1,120 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "CodeFrame", {
enumerable: true,
get: function() {
return CodeFrame;
}
});
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");
const _anser = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/anser"));
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _stripansi = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/strip-ansi"));
const _stackframe = require("../../helpers/stack-frame");
const _useopenineditor = require("../../helpers/use-open-in-editor");
const _hotlinkedtext = require("../hot-linked-text");
const CodeFrame = function CodeFrame(param) {
let { stackFrame, codeFrame } = param;
// Strip leading spaces out of the code frame:
const formattedFrame = _react.useMemo(()=>{
const lines = codeFrame.split(/\r?\n/g);
// Find the minimum length of leading spaces after `|` in the code frame
const miniLeadingSpacesLength = lines.map((line)=>/^>? +\d+ +\| [ ]+/.exec((0, _stripansi.default)(line)) === null ? null : /^>? +\d+ +\| ( *)/.exec((0, _stripansi.default)(line))).filter(Boolean).map((v)=>v.pop()).reduce((c, n)=>isNaN(c) ? n.length : Math.min(c, n.length), NaN);
// When the minimum length of leading spaces is greater than 1, remove them
// from the code frame to help the indentation looks better when there's a lot leading spaces.
if (miniLeadingSpacesLength > 1) {
return lines.map((line, a)=>~(a = line.indexOf("|")) ? line.substring(0, a) + line.substring(a).replace("^\\ {" + miniLeadingSpacesLength + "}", "") : line).join("\n");
}
return lines.join("\n");
}, [
codeFrame
]);
const decoded = _react.useMemo(()=>{
return _anser.default.ansiToJson(formattedFrame, {
json: true,
use_classes: true,
remove_empty: true
});
}, [
formattedFrame
]);
const open = (0, _useopenineditor.useOpenInEditor)({
file: stackFrame.file,
lineNumber: stackFrame.lineNumber,
column: stackFrame.column
});
// TODO: make the caret absolute
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
"data-nextjs-codeframe": true,
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("p", {
role: "link",
onClick: open,
tabIndex: 1,
title: "Click to open in your editor",
children: [
/*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
children: [
(0, _stackframe.getFrameSource)(stackFrame),
" @",
" ",
/*#__PURE__*/ (0, _jsxruntime.jsx)(_hotlinkedtext.HotlinkedText, {
text: stackFrame.methodName
})
]
}),
/*#__PURE__*/ (0, _jsxruntime.jsxs)("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round",
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)("path", {
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
}),
/*#__PURE__*/ (0, _jsxruntime.jsx)("polyline", {
points: "15 3 21 3 21 9"
}),
/*#__PURE__*/ (0, _jsxruntime.jsx)("line", {
x1: "10",
y1: "14",
x2: "21",
y2: "3"
})
]
})
]
})
}),
/*#__PURE__*/ (0, _jsxruntime.jsx)("pre", {
children: decoded.map((entry, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
style: {
color: entry.fg ? "var(--color-" + entry.fg + ")" : undefined,
...entry.decoration === "bold" ? {
fontWeight: 800
} : entry.decoration === "italic" ? {
fontStyle: "italic"
} : undefined
},
children: entry.content
}, "frame-" + index))
})
]
});
};
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=CodeFrame.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/CodeFrame/CodeFrame.tsx"],"names":["CodeFrame","stackFrame","codeFrame","formattedFrame","React","useMemo","lines","split","miniLeadingSpacesLength","map","line","exec","stripAnsi","filter","Boolean","v","pop","reduce","c","n","isNaN","length","Math","min","NaN","a","indexOf","substring","replace","join","decoded","Anser","ansiToJson","json","use_classes","remove_empty","open","useOpenInEditor","file","lineNumber","column","div","data-nextjs-codeframe","p","role","onClick","tabIndex","title","span","getFrameSource","HotlinkedText","text","methodName","svg","xmlns","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","path","d","polyline","points","x1","y1","x2","y2","pre","entry","index","style","color","fg","undefined","decoration","fontWeight","fontStyle","content"],"mappings":";;;;+BAUaA;;;eAAAA;;;;;;gEAVK;iEACK;oEAED;4BACS;iCACC;+BACF;AAIvB,MAAMA,YAAsC,SAASA,UAAU,KAGrE;IAHqE,IAAA,EACpEC,UAAU,EACVC,SAAS,EACV,GAHqE;IAIpE,8CAA8C;IAC9C,MAAMC,iBAAiBC,OAAMC,OAAO,CAAS;QAC3C,MAAMC,QAAQJ,UAAUK,KAAK,CAAC;QAE9B,wEAAwE;QACxE,MAAMC,0BAA0BF,MAC7BG,GAAG,CAAC,CAACC,OACJ,oBAAoBC,IAAI,CAACC,IAAAA,kBAAS,EAACF,WAAW,OAC1C,OACA,oBAAoBC,IAAI,CAACC,IAAAA,kBAAS,EAACF,QAExCG,MAAM,CAACC,SACPL,GAAG,CAAC,CAACM,IAAMA,EAAGC,GAAG,IACjBC,MAAM,CAAC,CAACC,GAAGC,IAAOC,MAAMF,KAAKC,EAAEE,MAAM,GAAGC,KAAKC,GAAG,CAACL,GAAGC,EAAEE,MAAM,GAAIG;QAEnE,2EAA2E;QAC3E,8FAA8F;QAC9F,IAAIhB,0BAA0B,GAAG;YAC/B,OAAOF,MACJG,GAAG,CAAC,CAACC,MAAMe,IACV,CAAEA,CAAAA,IAAIf,KAAKgB,OAAO,CAAC,IAAG,IAClBhB,KAAKiB,SAAS,CAAC,GAAGF,KAClBf,KAAKiB,SAAS,CAACF,GAAGG,OAAO,CAAC,AAAC,UAAOpB,0BAAwB,KAAI,MAC9DE,MAELmB,IAAI,CAAC;QACV;QACA,OAAOvB,MAAMuB,IAAI,CAAC;IACpB,GAAG;QAAC3B;KAAU;IAEd,MAAM4B,UAAU1B,OAAMC,OAAO,CAAC;QAC5B,OAAO0B,cAAK,CAACC,UAAU,CAAC7B,gBAAgB;YACtC8B,MAAM;YACNC,aAAa;YACbC,cAAc;QAChB;IACF,GAAG;QAAChC;KAAe;IAEnB,MAAMiC,OAAOC,IAAAA,gCAAe,EAAC;QAC3BC,MAAMrC,WAAWqC,IAAI;QACrBC,YAAYtC,WAAWsC,UAAU;QACjCC,QAAQvC,WAAWuC,MAAM;IAC3B;IAEA,gCAAgC;IAChC,qBACE,sBAACC;QAAIC,uBAAqB;;0BACxB,qBAACD;0BACC,cAAA,sBAACE;oBACCC,MAAK;oBACLC,SAAST;oBACTU,UAAU;oBACVC,OAAM;;sCAEN,sBAACC;;gCACEC,IAAAA,0BAAc,EAAChD;gCAAY;gCAAG;8CAC/B,qBAACiD,4BAAa;oCAACC,MAAMlD,WAAWmD,UAAU;;;;sCAE5C,sBAACC;4BACCC,OAAM;4BACNC,SAAQ;4BACRC,MAAK;4BACLC,QAAO;4BACPC,aAAY;4BACZC,eAAc;4BACdC,gBAAe;;8CAEf,qBAACC;oCAAKC,GAAE;;8CACR,qBAACC;oCAASC,QAAO;;8CACjB,qBAACtD;oCAAKuD,IAAG;oCAAKC,IAAG;oCAAKC,IAAG;oCAAKC,IAAG;;;;;;;0BAIvC,qBAACC;0BACEvC,QAAQrB,GAAG,CAAC,CAAC6D,OAAOC,sBACnB,qBAACvB;wBAECwB,OAAO;4BACLC,OAAOH,MAAMI,EAAE,GAAG,AAAC,iBAAcJ,MAAMI,EAAE,GAAC,MAAKC;4BAC/C,GAAIL,MAAMM,UAAU,KAAK,SACrB;gCAAEC,YAAY;4BAAI,IAClBP,MAAMM,UAAU,KAAK,WACrB;gCAAEE,WAAW;4BAAS,IACtBH,SAAS;wBACf;kCAECL,MAAMS,OAAO;uBAVT,AAAC,WAAQR;;;;AAgB1B"}

View File

@ -0,0 +1 @@
export { CodeFrame } from './CodeFrame';

View File

@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "CodeFrame", {
enumerable: true,
get: function() {
return _CodeFrame.CodeFrame;
}
});
const _CodeFrame = require("./CodeFrame");
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=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/CodeFrame/index.tsx"],"names":["CodeFrame"],"mappings":";;;;+BAASA;;;eAAAA,oBAAS;;;2BAAQ"}

View File

@ -0,0 +1,2 @@
declare const styles: string;
export { styles };

View File

@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "styles", {
enumerable: true,
get: function() {
return styles;
}
});
const _tagged_template_literal_loose = require("@swc/helpers/_/_tagged_template_literal_loose");
const _nooptemplate = require("../../helpers/noop-template");
function _templateObject() {
const data = _tagged_template_literal_loose._([
"\n [data-nextjs-codeframe] {\n overflow: auto;\n border-radius: var(--size-gap-half);\n background-color: var(--color-ansi-bg);\n color: var(--color-ansi-fg);\n }\n [data-nextjs-codeframe]::selection,\n [data-nextjs-codeframe] *::selection {\n background-color: var(--color-ansi-selection);\n }\n [data-nextjs-codeframe] * {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n\n [data-nextjs-codeframe] > * {\n margin: 0;\n padding: calc(var(--size-gap) + var(--size-gap-half))\n calc(var(--size-gap-double) + var(--size-gap-half));\n }\n [data-nextjs-codeframe] > div {\n display: inline-block;\n width: auto;\n min-width: 100%;\n border-bottom: 1px solid var(--color-ansi-bright-black);\n }\n [data-nextjs-codeframe] > div > p {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n margin: 0;\n }\n [data-nextjs-codeframe] > div > p:hover {\n text-decoration: underline dotted;\n }\n [data-nextjs-codeframe] div > p > svg {\n width: auto;\n height: 1em;\n margin-left: 8px;\n }\n [data-nextjs-codeframe] div > pre {\n overflow: hidden;\n display: inline-block;\n }\n"
]);
_templateObject = function() {
return data;
};
return data;
}
const styles = (0, _nooptemplate.noop)(_templateObject());
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=styles.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/CodeFrame/styles.tsx"],"names":["styles","css"],"mappings":";;;;+BAmDSA;;;eAAAA;;;;8BAnDmB;;;;;;;;;;AAE5B,MAAMA,aAASC,kBAAG"}

View File

@ -0,0 +1,10 @@
import * as React from 'react';
export type DialogProps = {
children?: React.ReactNode;
type: 'error' | 'warning';
'aria-labelledby': string;
'aria-describedby': string;
onClose?: () => void;
};
declare const Dialog: React.FC<DialogProps>;
export { Dialog };

View File

@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Dialog", {
enumerable: true,
get: function() {
return Dialog;
}
});
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 _useonclickoutside = require("../../hooks/use-on-click-outside");
const Dialog = function Dialog(param) {
let { children, type, onClose, ...props } = param;
const [dialog, setDialog] = _react.useState(null);
const [role, setRole] = _react.useState(typeof document !== "undefined" && document.hasFocus() ? "dialog" : undefined);
const onDialog = _react.useCallback((node)=>{
setDialog(node);
}, []);
(0, _useonclickoutside.useOnClickOutside)(dialog, (e)=>{
e.preventDefault();
return onClose == null ? void 0 : onClose();
});
// Make HTMLElements with `role=link` accessible to be triggered by the
// keyboard, i.e. [Enter].
_react.useEffect(()=>{
if (dialog == null) {
return;
}
const root = dialog.getRootNode();
// Always true, but we do this for TypeScript:
if (!(root instanceof ShadowRoot)) {
return;
}
const shadowRoot = root;
function handler(e) {
const el = shadowRoot.activeElement;
if (e.key === "Enter" && el instanceof HTMLElement && el.getAttribute("role") === "link") {
e.preventDefault();
e.stopPropagation();
el.click();
}
}
function handleFocus() {
// safari will force itself as the active application when a background page triggers any sort of autofocus
// this is a workaround to only set the dialog role if the document has focus
setRole(document.hasFocus() ? "dialog" : undefined);
}
shadowRoot.addEventListener("keydown", handler);
window.addEventListener("focus", handleFocus);
window.addEventListener("blur", handleFocus);
return ()=>{
shadowRoot.removeEventListener("keydown", handler);
window.removeEventListener("focus", handleFocus);
window.removeEventListener("blur", handleFocus);
};
}, [
dialog
]);
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
ref: onDialog,
"data-nextjs-dialog": true,
tabIndex: -1,
role: role,
"aria-labelledby": props["aria-labelledby"],
"aria-describedby": props["aria-describedby"],
"aria-modal": "true",
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
"data-nextjs-dialog-banner": true,
className: "banner-" + type
}),
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=Dialog.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/Dialog.tsx"],"names":["Dialog","children","type","onClose","props","dialog","setDialog","React","useState","role","setRole","document","hasFocus","undefined","onDialog","useCallback","node","useOnClickOutside","e","preventDefault","useEffect","root","getRootNode","ShadowRoot","shadowRoot","handler","el","activeElement","key","HTMLElement","getAttribute","stopPropagation","click","handleFocus","addEventListener","window","removeEventListener","div","ref","data-nextjs-dialog","tabIndex","aria-labelledby","aria-describedby","aria-modal","data-nextjs-dialog-banner","className"],"mappings":";;;;+BA0FSA;;;eAAAA;;;;;iEA1Fc;mCACW;AAUlC,MAAMA,SAAgC,SAASA,OAAO,KAKrD;IALqD,IAAA,EACpDC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACP,GAAGC,OACJ,GALqD;IAMpD,MAAM,CAACC,QAAQC,UAAU,GAAGC,OAAMC,QAAQ,CAAwB;IAClE,MAAM,CAACC,MAAMC,QAAQ,GAAGH,OAAMC,QAAQ,CACpC,OAAOG,aAAa,eAAeA,SAASC,QAAQ,KAChD,WACAC;IAEN,MAAMC,WAAWP,OAAMQ,WAAW,CAAC,CAACC;QAClCV,UAAUU;IACZ,GAAG,EAAE;IACLC,IAAAA,oCAAiB,EAACZ,QAAQ,CAACa;QACzBA,EAAEC,cAAc;QAChB,OAAOhB,2BAAAA;IACT;IAEA,uEAAuE;IACvE,0BAA0B;IAC1BI,OAAMa,SAAS,CAAC;QACd,IAAIf,UAAU,MAAM;YAClB;QACF;QAEA,MAAMgB,OAAOhB,OAAOiB,WAAW;QAC/B,8CAA8C;QAC9C,IAAI,CAAED,CAAAA,gBAAgBE,UAAS,GAAI;YACjC;QACF;QACA,MAAMC,aAAaH;QACnB,SAASI,QAAQP,CAAgB;YAC/B,MAAMQ,KAAKF,WAAWG,aAAa;YACnC,IACET,EAAEU,GAAG,KAAK,WACVF,cAAcG,eACdH,GAAGI,YAAY,CAAC,YAAY,QAC5B;gBACAZ,EAAEC,cAAc;gBAChBD,EAAEa,eAAe;gBAEjBL,GAAGM,KAAK;YACV;QACF;QAEA,SAASC;YACP,2GAA2G;YAC3G,6EAA6E;YAC7EvB,QAAQC,SAASC,QAAQ,KAAK,WAAWC;QAC3C;QAEAW,WAAWU,gBAAgB,CAAC,WAAWT;QACvCU,OAAOD,gBAAgB,CAAC,SAASD;QACjCE,OAAOD,gBAAgB,CAAC,QAAQD;QAChC,OAAO;YACLT,WAAWY,mBAAmB,CAAC,WAAWX;YAC1CU,OAAOC,mBAAmB,CAAC,SAASH;YACpCE,OAAOC,mBAAmB,CAAC,QAAQH;QACrC;IACF,GAAG;QAAC5B;KAAO;IAEX,qBACE,sBAACgC;QACCC,KAAKxB;QACLyB,oBAAkB;QAClBC,UAAU,CAAC;QACX/B,MAAMA;QACNgC,mBAAiBrC,KAAK,CAAC,kBAAkB;QACzCsC,oBAAkBtC,KAAK,CAAC,mBAAmB;QAC3CuC,cAAW;;0BAEX,qBAACN;gBAAIO,2BAAyB;gBAACC,WAAW,AAAC,YAAS3C;;YACnDD;;;AAGP"}

View File

@ -0,0 +1,7 @@
import * as React from 'react';
export type DialogBodyProps = {
children?: React.ReactNode;
className?: string;
};
declare const DialogBody: React.FC<DialogBodyProps>;
export { DialogBody };

View File

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DialogBody", {
enumerable: true,
get: function() {
return DialogBody;
}
});
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 DialogBody = function DialogBody(param) {
let { children, className } = param;
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
"data-nextjs-dialog-body": true,
className: className,
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=DialogBody.js.map

Some files were not shown because too many files have changed in this diff Show More