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

8
node_modules/next/dist/esm/client/add-base-path.js generated vendored Normal file
View File

@ -0,0 +1,8 @@
import { addPathPrefix } from "../shared/lib/router/utils/add-path-prefix";
import { normalizePathTrailingSlash } from "./normalize-trailing-slash";
const basePath = process.env.__NEXT_ROUTER_BASEPATH || "";
export function addBasePath(path, required) {
return normalizePathTrailingSlash(process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !required ? path : addPathPrefix(path, basePath));
}
//# sourceMappingURL=add-base-path.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/add-base-path.ts"],"names":["addPathPrefix","normalizePathTrailingSlash","basePath","process","env","__NEXT_ROUTER_BASEPATH","addBasePath","path","required","__NEXT_MANUAL_CLIENT_BASE_PATH"],"mappings":"AAAA,SAASA,aAAa,QAAQ,6CAA4C;AAC1E,SAASC,0BAA0B,QAAQ,6BAA4B;AAEvE,MAAMC,WAAW,AAACC,QAAQC,GAAG,CAACC,sBAAsB,IAAe;AAEnE,OAAO,SAASC,YAAYC,IAAY,EAAEC,QAAkB;IAC1D,OAAOP,2BACLE,QAAQC,GAAG,CAACK,8BAA8B,IAAI,CAACD,WAC3CD,OACAP,cAAcO,MAAML;AAE5B"}

12
node_modules/next/dist/esm/client/add-locale.js generated vendored Normal file
View File

@ -0,0 +1,12 @@
import { normalizePathTrailingSlash } from "./normalize-trailing-slash";
export const addLocale = function(path) {
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
args[_key - 1] = arguments[_key];
}
if (process.env.__NEXT_I18N_SUPPORT) {
return normalizePathTrailingSlash(require("../shared/lib/router/utils/add-locale").addLocale(path, ...args));
}
return path;
};
//# sourceMappingURL=add-locale.js.map

1
node_modules/next/dist/esm/client/add-locale.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/add-locale.ts"],"names":["normalizePathTrailingSlash","addLocale","path","args","process","env","__NEXT_I18N_SUPPORT","require"],"mappings":"AACA,SAASA,0BAA0B,QAAQ,6BAA4B;AAEvE,OAAO,MAAMC,YAAuB,SAACC;qCAASC;QAAAA;;IAC5C,IAAIC,QAAQC,GAAG,CAACC,mBAAmB,EAAE;QACnC,OAAON,2BACLO,QAAQ,yCAAyCN,SAAS,CAACC,SAASC;IAExE;IACA,OAAOD;AACT,EAAC"}

51
node_modules/next/dist/esm/client/app-bootstrap.js generated vendored Normal file
View File

@ -0,0 +1,51 @@
/**
* Before starting the Next.js runtime and requiring any module, we need to make
* sure the following scripts are executed in the correct order:
* - Polyfills
* - next/script with `beforeInteractive` strategy
*/ const version = "14.2.13";
window.next = {
version,
appDir: true
};
function loadScriptsInSequence(scripts, hydrate) {
if (!scripts || !scripts.length) {
return hydrate();
}
return scripts.reduce((promise, param)=>{
let [src, props] = param;
return promise.then(()=>{
return new Promise((resolve, reject)=>{
const el = document.createElement("script");
if (props) {
for(const key in props){
if (key !== "children") {
el.setAttribute(key, props[key]);
}
}
}
if (src) {
el.src = src;
el.onload = ()=>resolve();
el.onerror = reject;
} else if (props) {
el.innerHTML = props.children;
setTimeout(resolve);
}
document.head.appendChild(el);
});
});
}, Promise.resolve()).catch((err)=>{
console.error(err);
// Still try to hydrate even if there's an error.
}).then(()=>{
hydrate();
});
}
export function appBootstrap(callback) {
loadScriptsInSequence(self.__next_s, ()=>{
callback();
});
}
//# sourceMappingURL=app-bootstrap.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/app-bootstrap.ts"],"names":["version","process","env","__NEXT_VERSION","window","next","appDir","loadScriptsInSequence","scripts","hydrate","length","reduce","promise","src","props","then","Promise","resolve","reject","el","document","createElement","key","setAttribute","onload","onerror","innerHTML","children","setTimeout","head","appendChild","catch","err","console","error","appBootstrap","callback","self","__next_s"],"mappings":"AAAA;;;;;CAKC,GAED,MAAMA,UAAUC,QAAQC,GAAG,CAACC,cAAc;AAE1CC,OAAOC,IAAI,GAAG;IACZL;IACAM,QAAQ;AACV;AAEA,SAASC,sBACPC,OAAwD,EACxDC,OAAmB;IAEnB,IAAI,CAACD,WAAW,CAACA,QAAQE,MAAM,EAAE;QAC/B,OAAOD;IACT;IAEA,OAAOD,QACJG,MAAM,CAAC,CAACC;YAAS,CAACC,KAAKC,MAAM;QAC5B,OAAOF,QAAQG,IAAI,CAAC;YAClB,OAAO,IAAIC,QAAc,CAACC,SAASC;gBACjC,MAAMC,KAAKC,SAASC,aAAa,CAAC;gBAElC,IAAIP,OAAO;oBACT,IAAK,MAAMQ,OAAOR,MAAO;wBACvB,IAAIQ,QAAQ,YAAY;4BACtBH,GAAGI,YAAY,CAACD,KAAKR,KAAK,CAACQ,IAAI;wBACjC;oBACF;gBACF;gBAEA,IAAIT,KAAK;oBACPM,GAAGN,GAAG,GAAGA;oBACTM,GAAGK,MAAM,GAAG,IAAMP;oBAClBE,GAAGM,OAAO,GAAGP;gBACf,OAAO,IAAIJ,OAAO;oBAChBK,GAAGO,SAAS,GAAGZ,MAAMa,QAAQ;oBAC7BC,WAAWX;gBACb;gBAEAG,SAASS,IAAI,CAACC,WAAW,CAACX;YAC5B;QACF;IACF,GAAGH,QAAQC,OAAO,IACjBc,KAAK,CAAC,CAACC;QACNC,QAAQC,KAAK,CAACF;IACd,iDAAiD;IACnD,GACCjB,IAAI,CAAC;QACJN;IACF;AACJ;AAEA,OAAO,SAAS0B,aAAaC,QAAoB;IAC/C7B,sBAAsB,AAAC8B,KAAaC,QAAQ,EAAE;QAC5CF;IACF;AACF"}

17
node_modules/next/dist/esm/client/app-call-server.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
import { getServerActionDispatcher } from "./components/app-router";
export async function callServer(actionId, actionArgs) {
const actionDispatcher = getServerActionDispatcher();
if (!actionDispatcher) {
throw new Error("Invariant: missing action dispatcher.");
}
return new Promise((resolve, reject)=>{
actionDispatcher({
actionId,
actionArgs,
resolve,
reject
});
});
}
//# sourceMappingURL=app-call-server.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/app-call-server.ts"],"names":["getServerActionDispatcher","callServer","actionId","actionArgs","actionDispatcher","Error","Promise","resolve","reject"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,0BAAyB;AAEnE,OAAO,eAAeC,WAAWC,QAAgB,EAAEC,UAAiB;IAClE,MAAMC,mBAAmBJ;IAEzB,IAAI,CAACI,kBAAkB;QACrB,MAAM,IAAIC,MAAM;IAClB;IAEA,OAAO,IAAIC,QAAQ,CAACC,SAASC;QAC3BJ,iBAAiB;YACfF;YACAC;YACAI;YACAC;QACF;IACF;AACF"}

210
node_modules/next/dist/esm/client/app-index.js generated vendored Normal file
View File

@ -0,0 +1,210 @@
import { jsx as _jsx } from "react/jsx-runtime";
import "../build/polyfills/polyfill-module";
// @ts-ignore react-dom/client exists when using React 18
import ReactDOMClient from "react-dom/client";
import React, { use } from "react";
// @ts-ignore
// eslint-disable-next-line import/no-extraneous-dependencies
import { createFromReadableStream } from "react-server-dom-webpack/client";
import { HeadManagerContext } from "../shared/lib/head-manager-context.shared-runtime";
import onRecoverableError from "./on-recoverable-error";
import { callServer } from "./app-call-server";
import { isNextRouterError } from "./components/is-next-router-error";
import { ActionQueueContext, createMutableActionQueue } from "../shared/lib/router/action-queue";
import { HMR_ACTIONS_SENT_TO_BROWSER } from "../server/dev/hot-reloader-types";
// Since React doesn't call onerror for errors caught in error boundaries.
const origConsoleError = window.console.error;
window.console.error = function() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
if (isNextRouterError(args[0])) {
return;
}
origConsoleError.apply(window.console, args);
};
window.addEventListener("error", (ev)=>{
if (isNextRouterError(ev.error)) {
ev.preventDefault();
return;
}
});
/// <reference types="react-dom/experimental" />
const appElement = document;
const encoder = new TextEncoder();
let initialServerDataBuffer = undefined;
let initialServerDataWriter = undefined;
let initialServerDataLoaded = false;
let initialServerDataFlushed = false;
let initialFormStateData = null;
function nextServerDataCallback(seg) {
if (seg[0] === 0) {
initialServerDataBuffer = [];
} else if (seg[0] === 1) {
if (!initialServerDataBuffer) throw new Error("Unexpected server data: missing bootstrap script.");
if (initialServerDataWriter) {
initialServerDataWriter.enqueue(encoder.encode(seg[1]));
} else {
initialServerDataBuffer.push(seg[1]);
}
} else if (seg[0] === 2) {
initialFormStateData = seg[1];
}
}
// There might be race conditions between `nextServerDataRegisterWriter` and
// `DOMContentLoaded`. The former will be called when React starts to hydrate
// the root, the latter will be called when the DOM is fully loaded.
// For streaming, the former is called first due to partial hydration.
// For non-streaming, the latter can be called first.
// Hence, we use two variables `initialServerDataLoaded` and
// `initialServerDataFlushed` to make sure the writer will be closed and
// `initialServerDataBuffer` will be cleared in the right time.
function nextServerDataRegisterWriter(ctr) {
if (initialServerDataBuffer) {
initialServerDataBuffer.forEach((val)=>{
ctr.enqueue(encoder.encode(val));
});
if (initialServerDataLoaded && !initialServerDataFlushed) {
ctr.close();
initialServerDataFlushed = true;
initialServerDataBuffer = undefined;
}
}
initialServerDataWriter = ctr;
}
// When `DOMContentLoaded`, we can close all pending writers to finish hydration.
const DOMContentLoaded = function() {
if (initialServerDataWriter && !initialServerDataFlushed) {
initialServerDataWriter.close();
initialServerDataFlushed = true;
initialServerDataBuffer = undefined;
}
initialServerDataLoaded = true;
};
// It's possible that the DOM is already loaded.
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", DOMContentLoaded, false);
} else {
DOMContentLoaded();
}
const nextServerDataLoadingGlobal = self.__next_f = self.__next_f || [];
nextServerDataLoadingGlobal.forEach(nextServerDataCallback);
nextServerDataLoadingGlobal.push = nextServerDataCallback;
const readable = new ReadableStream({
start (controller) {
nextServerDataRegisterWriter(controller);
}
});
const initialServerResponse = createFromReadableStream(readable, {
callServer
});
function ServerRoot() {
return use(initialServerResponse);
}
const StrictModeIfEnabled = process.env.__NEXT_STRICT_MODE_APP ? React.StrictMode : React.Fragment;
function Root(param) {
let { children } = param;
// TODO: remove in the next major version
if (process.env.__NEXT_ANALYTICS_ID) {
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(()=>{
require("./performance-relayer-app")();
}, []);
}
if (process.env.__NEXT_TEST_MODE) {
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(()=>{
window.__NEXT_HYDRATED = true;
window.__NEXT_HYDRATED_CB == null ? void 0 : window.__NEXT_HYDRATED_CB.call(window);
}, []);
}
return children;
}
export function hydrate() {
const actionQueue = createMutableActionQueue();
const reactEl = /*#__PURE__*/ _jsx(StrictModeIfEnabled, {
children: /*#__PURE__*/ _jsx(HeadManagerContext.Provider, {
value: {
appDir: true
},
children: /*#__PURE__*/ _jsx(ActionQueueContext.Provider, {
value: actionQueue,
children: /*#__PURE__*/ _jsx(Root, {
children: /*#__PURE__*/ _jsx(ServerRoot, {})
})
})
})
});
const rootLayoutMissingTags = window.__next_root_layout_missing_tags;
const hasMissingTags = !!(rootLayoutMissingTags == null ? void 0 : rootLayoutMissingTags.length);
const options = {
onRecoverableError
};
const isError = document.documentElement.id === "__next_error__" || hasMissingTags;
if (process.env.NODE_ENV !== "production") {
// Patch console.error to collect information about hydration errors
const patchConsoleError = require("./components/react-dev-overlay/internal/helpers/hydration-error-info").patchConsoleError;
if (!isError) {
patchConsoleError();
}
}
if (isError) {
if (process.env.NODE_ENV !== "production") {
// if an error is thrown while rendering an RSC stream, this will catch it in dev
// and show the error overlay
const ReactDevOverlay = require("./components/react-dev-overlay/app/ReactDevOverlay").default;
const INITIAL_OVERLAY_STATE = require("./components/react-dev-overlay/shared").INITIAL_OVERLAY_STATE;
const getSocketUrl = require("./components/react-dev-overlay/internal/helpers/get-socket-url").getSocketUrl;
const FallbackLayout = hasMissingTags ? (param)=>{
let { children } = param;
return /*#__PURE__*/ _jsx("html", {
id: "__next_error__",
children: /*#__PURE__*/ _jsx("body", {
children: children
})
});
} : React.Fragment;
const errorTree = /*#__PURE__*/ _jsx(FallbackLayout, {
children: /*#__PURE__*/ _jsx(ReactDevOverlay, {
state: {
...INITIAL_OVERLAY_STATE,
rootLayoutMissingTags
},
onReactError: ()=>{},
children: reactEl
})
});
const socketUrl = getSocketUrl(process.env.__NEXT_ASSET_PREFIX || "");
const socket = new window.WebSocket("" + socketUrl + "/_next/webpack-hmr");
// add minimal "hot reload" support for RSC errors
const handler = (event)=>{
let obj;
try {
obj = JSON.parse(event.data);
} catch (e) {}
if (!obj || !("action" in obj)) {
return;
}
if (obj.action === HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES) {
window.location.reload();
}
};
socket.addEventListener("message", handler);
ReactDOMClient.createRoot(appElement, options).render(errorTree);
} else {
ReactDOMClient.createRoot(appElement, options).render(reactEl);
}
} else {
React.startTransition(()=>ReactDOMClient.hydrateRoot(appElement, reactEl, {
...options,
formState: initialFormStateData
}));
}
// TODO-APP: Remove this logic when Float has GC built-in in development.
if (process.env.NODE_ENV !== "production") {
const { linkGc } = require("./app-link-gc");
linkGc();
}
}
//# sourceMappingURL=app-index.js.map

1
node_modules/next/dist/esm/client/app-index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

61
node_modules/next/dist/esm/client/app-link-gc.js generated vendored Normal file
View File

@ -0,0 +1,61 @@
export function linkGc() {
// TODO-APP: Remove this logic when Float has GC built-in in development.
if (process.env.NODE_ENV !== "production") {
const callback = (mutationList)=>{
for (const mutation of mutationList){
if (mutation.type === "childList") {
for (const node of mutation.addedNodes){
if ("tagName" in node && node.tagName === "LINK") {
var _link_dataset_precedence;
const link = node;
if ((_link_dataset_precedence = link.dataset.precedence) == null ? void 0 : _link_dataset_precedence.startsWith("next")) {
const href = link.getAttribute("href");
if (href) {
const [resource, version] = href.split("?v=", 2);
if (version) {
const currentOrigin = window.location.origin;
const allLinks = [
...document.querySelectorAll('link[href^="' + resource + '"]'),
// It's possible that the resource is a full URL or only pathname,
// so we need to remove the alternative href as well.
...document.querySelectorAll('link[href^="' + (resource.startsWith(currentOrigin) ? resource.slice(currentOrigin.length) : currentOrigin + resource) + '"]')
];
for (const otherLink of allLinks){
var _otherLink_dataset_precedence;
if ((_otherLink_dataset_precedence = otherLink.dataset.precedence) == null ? void 0 : _otherLink_dataset_precedence.startsWith("next")) {
const otherHref = otherLink.getAttribute("href");
if (otherHref) {
const [, otherVersion] = otherHref.split("?v=", 2);
if (!otherVersion || +otherVersion < +version) {
// Delay the removal of the stylesheet to avoid FOUC
// caused by `@font-face` rules, as they seem to be
// a couple of ticks delayed between the old and new
// styles being swapped even if the font is cached.
setTimeout(()=>{
otherLink.remove();
}, 5);
const preloadLink = document.querySelector('link[rel="preload"][as="style"][href="' + otherHref + '"]');
if (preloadLink) {
preloadLink.remove();
}
}
}
}
}
}
}
}
}
}
}
}
};
// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback);
observer.observe(document.head, {
childList: true
});
}
}
//# sourceMappingURL=app-link-gc.js.map

1
node_modules/next/dist/esm/client/app-link-gc.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/app-link-gc.ts"],"names":["linkGc","process","env","NODE_ENV","callback","mutationList","mutation","type","node","addedNodes","tagName","link","dataset","precedence","startsWith","href","getAttribute","resource","version","split","currentOrigin","window","location","origin","allLinks","document","querySelectorAll","slice","length","otherLink","otherHref","otherVersion","setTimeout","remove","preloadLink","querySelector","observer","MutationObserver","observe","head","childList"],"mappings":"AAAA,OAAO,SAASA;IACd,yEAAyE;IACzE,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAMC,WAAW,CAACC;YAChB,KAAK,MAAMC,YAAYD,aAAc;gBACnC,IAAIC,SAASC,IAAI,KAAK,aAAa;oBACjC,KAAK,MAAMC,QAAQF,SAASG,UAAU,CAAE;wBACtC,IACE,aAAaD,QACb,AAACA,KAAyBE,OAAO,KAAK,QACtC;gCAEIC;4BADJ,MAAMA,OAAOH;4BACb,KAAIG,2BAAAA,KAAKC,OAAO,CAACC,UAAU,qBAAvBF,yBAAyBG,UAAU,CAAC,SAAS;gCAC/C,MAAMC,OAAOJ,KAAKK,YAAY,CAAC;gCAC/B,IAAID,MAAM;oCACR,MAAM,CAACE,UAAUC,QAAQ,GAAGH,KAAKI,KAAK,CAAC,OAAO;oCAC9C,IAAID,SAAS;wCACX,MAAME,gBAAgBC,OAAOC,QAAQ,CAACC,MAAM;wCAC5C,MAAMC,WAAW;+CACZC,SAASC,gBAAgB,CAC1B,iBAAiBT,WAAW;4CAE9B,kEAAkE;4CAClE,qDAAqD;+CAClDQ,SAASC,gBAAgB,CAC1B,iBACGT,CAAAA,SAASH,UAAU,CAACM,iBACjBH,SAASU,KAAK,CAACP,cAAcQ,MAAM,IACnCR,gBAAgBH,QAAO,IAC3B;yCAEL;wCAED,KAAK,MAAMY,aAAaL,SAAU;gDAC5BK;4CAAJ,KAAIA,gCAAAA,UAAUjB,OAAO,CAACC,UAAU,qBAA5BgB,8BAA8Bf,UAAU,CAAC,SAAS;gDACpD,MAAMgB,YAAYD,UAAUb,YAAY,CAAC;gDACzC,IAAIc,WAAW;oDACb,MAAM,GAAGC,aAAa,GAAGD,UAAUX,KAAK,CAAC,OAAO;oDAChD,IAAI,CAACY,gBAAgB,CAACA,eAAe,CAACb,SAAS;wDAC7C,oDAAoD;wDACpD,mDAAmD;wDACnD,oDAAoD;wDACpD,mDAAmD;wDACnDc,WAAW;4DACTH,UAAUI,MAAM;wDAClB,GAAG;wDACH,MAAMC,cAAcT,SAASU,aAAa,CACxC,AAAC,2CAAwCL,YAAU;wDAErD,IAAII,aAAa;4DACfA,YAAYD,MAAM;wDACpB;oDACF;gDACF;4CACF;wCACF;oCACF;gCACF;4BACF;wBACF;oBACF;gBACF;YACF;QACF;QAEA,8DAA8D;QAC9D,MAAMG,WAAW,IAAIC,iBAAiBjC;QACtCgC,SAASE,OAAO,CAACb,SAASc,IAAI,EAAE;YAC9BC,WAAW;QACb;IACF;AACF"}

10
node_modules/next/dist/esm/client/app-next-dev.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
// TODO-APP: hydration warning
import "./app-webpack";
import { appBootstrap } from "./app-bootstrap";
appBootstrap(()=>{
const { hydrate } = require("./app-index");
hydrate();
}) // TODO-APP: build indicator
;
//# sourceMappingURL=app-next-dev.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/app-next-dev.ts"],"names":["appBootstrap","hydrate","require"],"mappings":"AAAA,8BAA8B;AAE9B,OAAO,gBAAe;AACtB,SAASA,YAAY,QAAQ,kBAAiB;AAE9CA,aAAa;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5BD;AACF,GAEA,4BAA4B"}

View File

@ -0,0 +1,11 @@
// TODO-APP: hydration warning
import { appBootstrap } from "./app-bootstrap";
window.next.version += "-turbo";
self.__webpack_hash__ = "";
appBootstrap(()=>{
const { hydrate } = require("./app-index");
hydrate();
}) // TODO-APP: build indicator
;
//# sourceMappingURL=app-next-turbopack.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/app-next-turbopack.ts"],"names":["appBootstrap","window","next","version","self","__webpack_hash__","hydrate","require"],"mappings":"AAAA,8BAA8B;AAE9B,SAASA,YAAY,QAAQ,kBAAiB;AAE9CC,OAAOC,IAAI,CAACC,OAAO,IAAI;AACrBC,KAAaC,gBAAgB,GAAG;AAElCL,aAAa;IACX,MAAM,EAAEM,OAAO,EAAE,GAAGC,QAAQ;IAC5BD;AACF,GAEA,4BAA4B"}

13
node_modules/next/dist/esm/client/app-next.js generated vendored Normal file
View File

@ -0,0 +1,13 @@
// This import must go first because it needs to patch webpack chunk loading
// before React patches chunk loading.
import "./app-webpack";
import { appBootstrap } from "./app-bootstrap";
appBootstrap(()=>{
const { hydrate } = require("./app-index");
// Include app-router and layout-router in the main chunk
require("next/dist/client/components/app-router");
require("next/dist/client/components/layout-router");
hydrate();
});
//# sourceMappingURL=app-next.js.map

1
node_modules/next/dist/esm/client/app-next.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/app-next.ts"],"names":["appBootstrap","hydrate","require"],"mappings":"AAAA,4EAA4E;AAC5E,sCAAsC;AACtC,OAAO,gBAAe;AACtB,SAASA,YAAY,QAAQ,kBAAiB;AAE9CA,aAAa;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5B,yDAAyD;IACzDA,QAAQ;IACRA,QAAQ;IACRD;AACF"}

55
node_modules/next/dist/esm/client/app-webpack.js generated vendored Normal file
View File

@ -0,0 +1,55 @@
// Override chunk URL mapping in the webpack runtime
// https://github.com/webpack/webpack/blob/2738eebc7880835d88c727d364ad37f3ec557593/lib/RuntimeGlobals.js#L204
import { getDeploymentIdQueryOrEmptyString } from "../build/deployment-id";
// If we have a deployment ID, we need to append it to the webpack chunk names
// I am keeping the process check explicit so this can be statically optimized
if (process.env.NEXT_DEPLOYMENT_ID) {
const suffix = getDeploymentIdQueryOrEmptyString();
// eslint-disable-next-line no-undef
const getChunkScriptFilename = __webpack_require__.u;
// eslint-disable-next-line no-undef
__webpack_require__.u = function() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
return(// We enode the chunk filename because our static server matches against and encoded
// filename path.
encodeURI(getChunkScriptFilename(...args) + suffix));
};
// eslint-disable-next-line no-undef
const getChunkCssFilename = __webpack_require__.k;
// eslint-disable-next-line no-undef
__webpack_require__.k = function() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
return getChunkCssFilename(...args) + suffix;
};
// eslint-disable-next-line no-undef
const getMiniCssFilename = __webpack_require__.miniCssF;
// eslint-disable-next-line no-undef
__webpack_require__.miniCssF = function() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
return getMiniCssFilename(...args) + suffix;
};
} else {
// eslint-disable-next-line no-undef
const getChunkScriptFilename = __webpack_require__.u;
// eslint-disable-next-line no-undef
__webpack_require__.u = function() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
return(// We enode the chunk filename because our static server matches against and encoded
// filename path.
encodeURI(getChunkScriptFilename(...args)));
};
// We don't need to override __webpack_require__.k because we don't modify
// the css chunk name when not using deployment id suffixes
// WE don't need to override __webpack_require__.miniCssF because we don't modify
// the mini css chunk name when not using deployment id suffixes
}
//# sourceMappingURL=app-webpack.js.map

1
node_modules/next/dist/esm/client/app-webpack.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/client/app-webpack.ts"],"names":["getDeploymentIdQueryOrEmptyString","process","env","NEXT_DEPLOYMENT_ID","suffix","getChunkScriptFilename","__webpack_require__","u","args","encodeURI","getChunkCssFilename","k","getMiniCssFilename","miniCssF"],"mappings":"AAAA,oDAAoD;AACpD,8GAA8G;AAE9G,SAASA,iCAAiC,QAAQ,yBAAwB;AAI1E,8EAA8E;AAC9E,8EAA8E;AAC9E,IAAIC,QAAQC,GAAG,CAACC,kBAAkB,EAAE;IAClC,MAAMC,SAASJ;IACf,oCAAoC;IACpC,MAAMK,yBAAyBC,oBAAoBC,CAAC;IACpD,oCAAoC;IACpCD,oBAAoBC,CAAC,GAAG;yCAAIC;YAAAA;;eAC1B,oFAAoF;QACpF,iBAAiB;QACjBC,UAAUJ,0BAA0BG,QAAQJ;;IAE9C,oCAAoC;IACpC,MAAMM,sBAAsBJ,oBAAoBK,CAAC;IACjD,oCAAoC;IACpCL,oBAAoBK,CAAC,GAAG;yCAAIH;YAAAA;;eAC1BE,uBAAuBF,QAAQJ;;IAEjC,oCAAoC;IACpC,MAAMQ,qBAAqBN,oBAAoBO,QAAQ;IACvD,oCAAoC;IACpCP,oBAAoBO,QAAQ,GAAG;yCAAIL;YAAAA;;eACjCI,sBAAsBJ,QAAQJ;;AAClC,OAAO;IACL,oCAAoC;IACpC,MAAMC,yBAAyBC,oBAAoBC,CAAC;IACpD,oCAAoC;IACpCD,oBAAoBC,CAAC,GAAG;yCAAIC;YAAAA;;eAC1B,oFAAoF;QACpF,iBAAiB;QACjBC,UAAUJ,0BAA0BG;;AAEtC,0EAA0E;AAC1E,2DAA2D;AAE3D,iFAAiF;AACjF,gEAAgE;AAClE"}

16
node_modules/next/dist/esm/client/compat/router.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
import { useContext } from "react";
import { RouterContext } from "../../shared/lib/router-context.shared-runtime";
/**
* useRouter from `next/compat/router` is designed to assist developers
* migrating from `pages/` to `app/`. Unlike `next/router`, this hook does not
* throw when the `NextRouter` is not mounted, and instead returns `null`. The
* more concrete return type here lets developers use this hook within
* components that could be shared between both `app/` and `pages/` and handle
* to the case where the router is not mounted.
*
* @returns The `NextRouter` instance if it's available, otherwise `null`.
*/ export function useRouter() {
return useContext(RouterContext);
}
//# sourceMappingURL=router.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/compat/router.ts"],"names":["useContext","RouterContext","useRouter"],"mappings":"AAAA,SAASA,UAAU,QAAQ,QAAO;AAClC,SAASC,aAAa,QAAQ,iDAAgD;AAG9E;;;;;;;;;CASC,GACD,OAAO,SAASC;IACd,OAAOF,WAAWC;AACpB"}

View File

@ -0,0 +1,4 @@
import { createAsyncLocalStorage } from "./async-local-storage";
export const actionAsyncStorage = createAsyncLocalStorage();
//# sourceMappingURL=action-async-storage-instance.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/action-async-storage-instance.ts"],"names":["createAsyncLocalStorage","actionAsyncStorage"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,wBAAuB;AAE/D,OAAO,MAAMC,qBAAyCD,0BAAyB"}

View File

@ -0,0 +1,5 @@
"TURBOPACK { transition: next-shared }";
import { actionAsyncStorage } from "./action-async-storage-instance";
export { actionAsyncStorage };
//# 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;AACF,SAASA,kBAAkB,QAAQ,kCAAiC;AAQpE,SAASA,kBAAkB,GAAE"}

View File

@ -0,0 +1,64 @@
import { useEffect, useRef, useState } from "react";
import { createPortal } from "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;
}
}
export function AppRouterAnnouncer(param) {
let { tree } = param;
const [portalNode, setPortalNode] = useState(null);
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] = useState("");
const previousTitle = useRef();
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__*/ createPortal(routeAnnouncement, portalNode) : null;
}
//# sourceMappingURL=app-router-announcer.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/app-router-announcer.tsx"],"names":["useEffect","useRef","useState","createPortal","ANNOUNCER_TYPE","ANNOUNCER_ID","getAnnouncerNode","existingAnnouncer","document","getElementsByName","shadowRoot","childNodes","container","createElement","style","cssText","announcer","ariaLive","id","role","shadow","attachShadow","mode","appendChild","body","AppRouterAnnouncer","tree","portalNode","setPortalNode","getElementsByTagName","isConnected","removeChild","routeAnnouncement","setRouteAnnouncement","previousTitle","currentTitle","title","pageHeader","querySelector","innerText","textContent","current","undefined"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AACnD,SAASC,YAAY,QAAQ,YAAW;AAGxC,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;AAEA,OAAO,SAASS,mBAAmB,KAAqC;IAArC,IAAA,EAAEC,IAAI,EAA+B,GAArC;IACjC,MAAM,CAACC,YAAYC,cAAc,GAAG1B,SAA6B;IAEjEF,UAAU;QACR,MAAMgB,YAAYV;QAClBsB,cAAcZ;QACd,OAAO;YACL,MAAMJ,YAAYJ,SAASqB,oBAAoB,CAACzB,eAAe,CAAC,EAAE;YAClE,IAAIQ,6BAAAA,UAAWkB,WAAW,EAAE;gBAC1BtB,SAASgB,IAAI,CAACO,WAAW,CAACnB;YAC5B;QACF;IACF,GAAG,EAAE;IAEL,MAAM,CAACoB,mBAAmBC,qBAAqB,GAAG/B,SAAS;IAC3D,MAAMgC,gBAAgBjC;IAEtBD,UAAU;QACR,IAAImC,eAAe;QACnB,IAAI3B,SAAS4B,KAAK,EAAE;YAClBD,eAAe3B,SAAS4B,KAAK;QAC/B,OAAO;YACL,MAAMC,aAAa7B,SAAS8B,aAAa,CAAC;YAC1C,IAAID,YAAY;gBACdF,eAAeE,WAAWE,SAAS,IAAIF,WAAWG,WAAW,IAAI;YACnE;QACF;QAEA,4EAA4E;QAC5E,iCAAiC;QACjC,IACEN,cAAcO,OAAO,KAAKC,aAC1BR,cAAcO,OAAO,KAAKN,cAC1B;YACAF,qBAAqBE;QACvB;QACAD,cAAcO,OAAO,GAAGN;IAC1B,GAAG;QAACT;KAAK;IAET,OAAOC,2BAAaxB,aAAa6B,mBAAmBL,cAAc;AACpE"}

View File

@ -0,0 +1,21 @@
export const RSC_HEADER = "RSC";
export const ACTION = "Next-Action";
export const NEXT_ROUTER_STATE_TREE = "Next-Router-State-Tree";
export const NEXT_ROUTER_PREFETCH_HEADER = "Next-Router-Prefetch";
export const NEXT_URL = "Next-Url";
export const RSC_CONTENT_TYPE_HEADER = "text/x-component";
export const FLIGHT_PARAMETERS = [
[
RSC_HEADER
],
[
NEXT_ROUTER_STATE_TREE
],
[
NEXT_ROUTER_PREFETCH_HEADER
]
];
export const NEXT_RSC_UNION_QUERY = "_rsc";
export const NEXT_DID_POSTPONE_HEADER = "x-nextjs-postponed";
//# sourceMappingURL=app-router-headers.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/app-router-headers.ts"],"names":["RSC_HEADER","ACTION","NEXT_ROUTER_STATE_TREE","NEXT_ROUTER_PREFETCH_HEADER","NEXT_URL","RSC_CONTENT_TYPE_HEADER","FLIGHT_PARAMETERS","NEXT_RSC_UNION_QUERY","NEXT_DID_POSTPONE_HEADER"],"mappings":"AAAA,OAAO,MAAMA,aAAa,MAAc;AACxC,OAAO,MAAMC,SAAS,cAAsB;AAE5C,OAAO,MAAMC,yBAAyB,yBAAiC;AACvE,OAAO,MAAMC,8BAA8B,uBAA+B;AAC1E,OAAO,MAAMC,WAAW,WAAmB;AAC3C,OAAO,MAAMC,0BAA0B,mBAA2B;AAElE,OAAO,MAAMC,oBAAoB;IAC/B;QAACN;KAAW;IACZ;QAACE;KAAuB;IACxB;QAACC;KAA4B;CAC9B,CAAS;AAEV,OAAO,MAAMI,uBAAuB,OAAe;AAEnD,OAAO,MAAMC,2BAA2B,qBAA6B"}

View File

@ -0,0 +1,566 @@
"use client";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import React, { use, useEffect, useMemo, useCallback, startTransition, useInsertionEffect, useDeferredValue } from "react";
import { AppRouterContext, LayoutRouterContext, GlobalLayoutRouterContext, MissingSlotContext } from "../../shared/lib/app-router-context.shared-runtime";
import { ACTION_FAST_REFRESH, ACTION_NAVIGATE, ACTION_PREFETCH, ACTION_REFRESH, ACTION_RESTORE, ACTION_SERVER_ACTION, ACTION_SERVER_PATCH, PrefetchKind } from "./router-reducer/router-reducer-types";
import { createHrefFromUrl } from "./router-reducer/create-href-from-url";
import { SearchParamsContext, PathnameContext, PathParamsContext } from "../../shared/lib/hooks-client-context.shared-runtime";
import { useReducerWithReduxDevtools, useUnwrapState } from "./use-reducer-with-devtools";
import { ErrorBoundary } from "./error-boundary";
import { createInitialRouterState } from "./router-reducer/create-initial-router-state";
import { isBot } from "../../shared/lib/router/utils/is-bot";
import { addBasePath } from "../add-base-path";
import { AppRouterAnnouncer } from "./app-router-announcer";
import { RedirectBoundary } from "./redirect-boundary";
import { findHeadInCache } from "./router-reducer/reducers/find-head-in-cache";
import { unresolvedThenable } from "./unresolved-thenable";
import { NEXT_RSC_UNION_QUERY } from "./app-router-headers";
import { removeBasePath } from "../remove-base-path";
import { hasBasePath } from "../has-base-path";
import { PAGE_SEGMENT_KEY } from "../../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;
export function getServerActionDispatcher() {
return globalServerActionDispatcher;
}
const globalMutable = {};
export function urlToUrlWithoutFlightMarker(url) {
const urlWithoutFlightParameters = new URL(url, location.origin);
urlWithoutFlightParameters.searchParams.delete(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(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;
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.
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;
}
export 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 = useCallback((actionPayload)=>{
startTransition(()=>{
dispatch({
...actionPayload,
type: ACTION_SERVER_ACTION
});
});
}, [
dispatch
]);
globalServerActionDispatcher = serverActionDispatcher;
}
/**
* Server response that only patches the cache and tree.
*/ function useChangeByServerResponse(dispatch) {
return useCallback((param)=>{
let { previousTree, serverResponse } = param;
startTransition(()=>{
dispatch({
type: ACTION_SERVER_PATCH,
previousTree,
serverResponse
});
});
}, [
dispatch
]);
}
function useNavigate(dispatch) {
return useCallback((href, navigateType, shouldScroll)=>{
const url = new URL(addBasePath(href), location.href);
return dispatch({
type: 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 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 = useMemo(()=>createInitialRouterState({
buildId,
initialSeedData,
urlParts,
initialTree,
initialParallelRoutes,
location: !isServer ? window.location : null,
initialHead,
couldBeIntercepted
}), [
buildId,
initialSeedData,
urlParts,
initialTree,
initialHead,
couldBeIntercepted
]);
const [reducerState, dispatch, sync] = useReducerWithReduxDevtools(initialState);
useEffect(()=>{
// Ensure initialParallelRoutes is cleaned up from memory once it's used.
initialParallelRoutes = null;
}, []);
const { canonicalUrl } = useUnwrapState(reducerState);
// Add memoized pathname/query for useSearchParams and usePathname.
const { searchParams, pathname } = 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: hasBasePath(url.pathname) ? 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 = 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 (isBot(window.navigator.userAgent)) {
return;
}
let url;
try {
url = new URL(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;
}
startTransition(()=>{
var _options_kind;
dispatch({
type: ACTION_PREFETCH,
url,
kind: (_options_kind = options == null ? void 0 : options.kind) != null ? _options_kind : PrefetchKind.FULL
});
});
},
replace: (href, options)=>{
if (options === void 0) options = {};
startTransition(()=>{
var _options_scroll;
navigate(href, "replace", (_options_scroll = options.scroll) != null ? _options_scroll : true);
});
},
push: (href, options)=>{
if (options === void 0) options = {};
startTransition(()=>{
var _options_scroll;
navigate(href, "push", (_options_scroll = options.scroll) != null ? _options_scroll : true);
});
},
refresh: ()=>{
startTransition(()=>{
dispatch({
type: 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 {
startTransition(()=>{
dispatch({
type: ACTION_FAST_REFRESH,
origin: window.location.origin
});
});
}
}
};
return routerInstance;
}, [
dispatch,
navigate
]);
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 } = 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
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
]);
}
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: 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 } = 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?
use(unresolvedThenable);
}
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;
startTransition(()=>{
dispatch({
type: 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
startTransition(()=>{
dispatch({
type: 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 } = useUnwrapState(reducerState);
const matchingHead = useMemo(()=>{
return findHeadInCache(cache, tree[1]);
}, [
cache,
tree
]);
// Add memoized pathParams for useParams.
const pathParams = 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__*/ _jsx(Head, {
headCacheNode: headCacheNode
}, headKey);
} else {
head = null;
}
let content = /*#__PURE__*/ _jsxs(RedirectBoundary, {
children: [
head,
cache.rsc,
/*#__PURE__*/ _jsx(AppRouterAnnouncer, {
tree: tree
})
]
});
if (process.env.NODE_ENV !== "production") {
if (typeof window !== "undefined") {
const DevRootNotFoundBoundary = require("./dev-root-not-found-boundary").DevRootNotFoundBoundary;
content = /*#__PURE__*/ _jsx(DevRootNotFoundBoundary, {
children: /*#__PURE__*/ _jsx(MissingSlotContext.Provider, {
value: missingSlots,
children: content
})
});
}
const HotReloader = require("./react-dev-overlay/app/hot-reloader-client").default;
content = /*#__PURE__*/ _jsx(HotReloader, {
assetPrefix: assetPrefix,
children: content
});
}
return /*#__PURE__*/ _jsxs(_Fragment, {
children: [
/*#__PURE__*/ _jsx(HistoryUpdater, {
appRouterState: useUnwrapState(reducerState),
sync: sync
}),
/*#__PURE__*/ _jsx(PathParamsContext.Provider, {
value: pathParams,
children: /*#__PURE__*/ _jsx(PathnameContext.Provider, {
value: pathname,
children: /*#__PURE__*/ _jsx(SearchParamsContext.Provider, {
value: searchParams,
children: /*#__PURE__*/ _jsx(GlobalLayoutRouterContext.Provider, {
value: {
buildId,
changeByServerResponse,
tree,
focusAndScrollRef,
nextUrl
},
children: /*#__PURE__*/ _jsx(AppRouterContext.Provider, {
value: appRouter,
children: /*#__PURE__*/ _jsx(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
})
})
})
})
})
})
]
});
}
export default function AppRouter(props) {
const { globalErrorComponent, ...rest } = props;
return /*#__PURE__*/ _jsx(ErrorBoundary, {
errorComponent: globalErrorComponent,
children: /*#__PURE__*/ _jsx(Router, {
...rest
})
});
}
//# sourceMappingURL=app-router.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,28 @@
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;
export function createAsyncLocalStorage() {
if (maybeGlobalAsyncLocalStorage) {
return new maybeGlobalAsyncLocalStorage();
}
return new FakeAsyncLocalStorage();
}
//# sourceMappingURL=async-local-storage.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/async-local-storage.ts"],"names":["sharedAsyncLocalStorageNotAvailableError","Error","FakeAsyncLocalStorage","disable","getStore","undefined","run","exit","enterWith","maybeGlobalAsyncLocalStorage","globalThis","AsyncLocalStorage","createAsyncLocalStorage"],"mappings":"AAEA,MAAMA,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;AAE1E,OAAO,SAASC;IAGd,IAAIH,8BAA8B;QAChC,OAAO,IAAIA;IACb;IACA,OAAO,IAAIP;AACb"}

View File

@ -0,0 +1,9 @@
import { BailoutToCSRError } from "../../shared/lib/lazy-dynamic/bailout-to-csr";
import { staticGenerationAsyncStorage } from "./static-generation-async-storage.external";
export function bailoutToClientRendering(reason) {
const staticGenerationStore = staticGenerationAsyncStorage.getStore();
if (staticGenerationStore == null ? void 0 : staticGenerationStore.forceStatic) return;
if (staticGenerationStore == null ? void 0 : staticGenerationStore.isStaticGeneration) throw new BailoutToCSRError(reason);
}
//# sourceMappingURL=bailout-to-client-rendering.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/bailout-to-client-rendering.ts"],"names":["BailoutToCSRError","staticGenerationAsyncStorage","bailoutToClientRendering","reason","staticGenerationStore","getStore","forceStatic","isStaticGeneration"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,+CAA8C;AAChF,SAASC,4BAA4B,QAAQ,6CAA4C;AAEzF,OAAO,SAASC,yBAAyBC,MAAc;IACrD,MAAMC,wBAAwBH,6BAA6BI,QAAQ;IAEnE,IAAID,yCAAAA,sBAAuBE,WAAW,EAAE;IAExC,IAAIF,yCAAAA,sBAAuBG,kBAAkB,EAC3C,MAAM,IAAIP,kBAAkBG;AAChC"}

View File

@ -0,0 +1,19 @@
"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { createDynamicallyTrackedSearchParams } from "./search-params";
export 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 = createDynamicallyTrackedSearchParams(props.searchParams || {});
return /*#__PURE__*/ _jsx(Component, {
...props
});
}
//# sourceMappingURL=client-page.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/client-page.tsx"],"names":["createDynamicallyTrackedSearchParams","ClientPageRoot","Component","props","searchParams"],"mappings":"AAAA;;AACA,SAASA,oCAAoC,QAAQ,kBAAiB;AAEtE,OAAO,SAASC,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,GAAGJ,qCACnBG,MAAMC,YAAY,IAAI,CAAC;IAEzB,qBAAO,KAACF;QAAW,GAAGC,KAAK;;AAC7B"}

View File

@ -0,0 +1,12 @@
import { jsx as _jsx } from "react/jsx-runtime";
import React from "react";
export default function DefaultLayout(param) {
let { children } = param;
return /*#__PURE__*/ _jsx("html", {
children: /*#__PURE__*/ _jsx("body", {
children: children
})
});
}
//# sourceMappingURL=default-layout.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/default-layout.tsx"],"names":["React","DefaultLayout","children","html","body"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,eAAe,SAASC,cAAc,KAIrC;IAJqC,IAAA,EACpCC,QAAQ,EAGT,GAJqC;IAKpC,qBACE,KAACC;kBACC,cAAA,KAACC;sBAAMF;;;AAGb"}

View File

@ -0,0 +1,21 @@
"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import React from "react";
import { NotFoundBoundary } from "./not-found-boundary";
export function bailOnNotFound() {
throw new Error("notFound() is not allowed to use in root layout");
}
function NotAllowedRootNotFoundError() {
bailOnNotFound();
return null;
}
export function DevRootNotFoundBoundary(param) {
let { children } = param;
return /*#__PURE__*/ _jsx(NotFoundBoundary, {
notFound: /*#__PURE__*/ _jsx(NotAllowedRootNotFoundError, {}),
children: children
});
}
//# 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":["React","NotFoundBoundary","bailOnNotFound","Error","NotAllowedRootNotFoundError","DevRootNotFoundBoundary","children","notFound"],"mappings":"AAAA;;AAEA,OAAOA,WAAW,QAAO;AACzB,SAASC,gBAAgB,QAAQ,uBAAsB;AAEvD,OAAO,SAASC;IACd,MAAM,IAAIC,MAAM;AAClB;AAEA,SAASC;IACPF;IACA,OAAO;AACT;AAEA,OAAO,SAASG,wBAAwB,KAIvC;IAJuC,IAAA,EACtCC,QAAQ,EAGT,GAJuC;IAKtC,qBACE,KAACL;QAAiBM,wBAAU,KAACH;kBAC1BE;;AAGP"}

View File

@ -0,0 +1,30 @@
import { staticGenerationAsyncStorage } from "./static-generation-async-storage.external";
import { trackDynamicDataAccessed } from "../../server/app-render/dynamic-rendering";
export class DraftMode {
get isEnabled() {
return this._provider.isEnabled;
}
enable() {
const store = 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.
trackDynamicDataAccessed(store, "draftMode().enable()");
}
return this._provider.enable();
}
disable() {
const store = 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.
trackDynamicDataAccessed(store, "draftMode().disable()");
}
return this._provider.disable();
}
constructor(provider){
this._provider = provider;
}
}
//# sourceMappingURL=draft-mode.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/draft-mode.ts"],"names":["staticGenerationAsyncStorage","trackDynamicDataAccessed","DraftMode","isEnabled","_provider","enable","store","getStore","disable","constructor","provider"],"mappings":"AAEA,SAASA,4BAA4B,QAAQ,6CAA4C;AACzF,SAASC,wBAAwB,QAAQ,4CAA2C;AAEpF,OAAO,MAAMC;IASX,IAAIC,YAAY;QACd,OAAO,IAAI,CAACC,SAAS,CAACD,SAAS;IACjC;IACOE,SAAS;QACd,MAAMC,QAAQN,6BAA6BO,QAAQ;QACnD,IAAID,OAAO;YACT,uEAAuE;YACvE,+DAA+D;YAC/DL,yBAAyBK,OAAO;QAClC;QACA,OAAO,IAAI,CAACF,SAAS,CAACC,MAAM;IAC9B;IACOG,UAAU;QACf,MAAMF,QAAQN,6BAA6BO,QAAQ;QACnD,IAAID,OAAO;YACT,uEAAuE;YACvE,+DAA+D;YAC/DL,yBAAyBK,OAAO;QAClC;QACA,OAAO,IAAI,CAACF,SAAS,CAACI,OAAO;IAC/B;IAvBAC,YAAYC,QAA2B,CAAE;QACvC,IAAI,CAACN,SAAS,GAAGM;IACnB;AAsBF"}

View File

@ -0,0 +1,156 @@
"use client";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import React from "react";
import { usePathname } from "./navigation";
import { isNextRouterError } from "./is-next-router-error";
import { staticGenerationAsyncStorage } from "./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 = staticGenerationAsyncStorage.getStore();
if ((store == null ? void 0 : store.isRevalidate) || (store == null ? void 0 : store.isStaticGeneration)) {
console.error(error);
throw error;
}
return null;
}
export class ErrorBoundaryHandler extends React.Component {
static getDerivedStateFromError(error) {
if (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__*/ _jsxs(_Fragment, {
children: [
/*#__PURE__*/ _jsx(HandleISRError, {
error: this.state.error
}),
this.props.errorStyles,
this.props.errorScripts,
/*#__PURE__*/ _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
};
}
}
export function GlobalError(param) {
let { error } = param;
const digest = error == null ? void 0 : error.digest;
return /*#__PURE__*/ _jsxs("html", {
id: "__next_error__",
children: [
/*#__PURE__*/ _jsx("head", {}),
/*#__PURE__*/ _jsxs("body", {
children: [
/*#__PURE__*/ _jsx(HandleISRError, {
error: error
}),
/*#__PURE__*/ _jsx("div", {
style: styles.error,
children: /*#__PURE__*/ _jsxs("div", {
children: [
/*#__PURE__*/ _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__*/ _jsx("p", {
style: styles.text,
children: "Digest: " + digest
}) : null
]
})
})
]
})
]
});
}
// Exported so that the import signature in the loaders can be identical to user
// supplied custom global error signatures.
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 function ErrorBoundary(param) {
let { errorComponent, errorStyles, errorScripts, children } = param;
const pathname = usePathname();
if (errorComponent) {
return /*#__PURE__*/ _jsx(ErrorBoundaryHandler, {
pathname: pathname,
errorComponent: errorComponent,
errorStyles: errorStyles,
errorScripts: errorScripts,
children: children
});
}
return /*#__PURE__*/ _jsx(_Fragment, {
children: children
});
}
//# sourceMappingURL=error-boundary.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/error-boundary.tsx"],"names":["React","usePathname","isNextRouterError","staticGenerationAsyncStorage","styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","text","fontSize","fontWeight","lineHeight","margin","HandleISRError","store","getStore","isRevalidate","isStaticGeneration","console","ErrorBoundaryHandler","Component","getDerivedStateFromError","getDerivedStateFromProps","props","state","pathname","previousPathname","render","errorStyles","errorScripts","this","errorComponent","reset","children","constructor","setState","GlobalError","digest","html","id","head","body","div","style","h2","p","ErrorBoundary"],"mappings":"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"}

View File

@ -0,0 +1,58 @@
import { RequestCookiesAdapter } from "../../server/web/spec-extension/adapters/request-cookies";
import { HeadersAdapter } from "../../server/web/spec-extension/adapters/headers";
import { RequestCookies } from "../../server/web/spec-extension/cookies";
import { actionAsyncStorage } from "./action-async-storage.external";
import { DraftMode } from "./draft-mode";
import { trackDynamicDataAccessed } from "../../server/app-render/dynamic-rendering";
import { staticGenerationAsyncStorage } from "./static-generation-async-storage.external";
import { getExpectedRequestStore } from "./request-async-storage.external";
/**
* 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 function headers() {
const callingExpression = "headers";
const staticGenerationStore = 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 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
trackDynamicDataAccessed(staticGenerationStore, callingExpression);
}
}
return getExpectedRequestStore(callingExpression).headers;
}
export function cookies() {
const callingExpression = "cookies";
const staticGenerationStore = 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 RequestCookiesAdapter.seal(new RequestCookies(new Headers({})));
} else {
// We will return a real headers object below so we mark this call as reading from a dynamic data source
trackDynamicDataAccessed(staticGenerationStore, callingExpression);
}
}
const requestStore = getExpectedRequestStore(callingExpression);
const asyncActionStore = 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;
}
export function draftMode() {
const callingExpression = "draftMode";
const requestStore = getExpectedRequestStore(callingExpression);
return new DraftMode(requestStore.draftMode);
}
//# sourceMappingURL=headers.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/headers.ts"],"names":["RequestCookiesAdapter","HeadersAdapter","RequestCookies","actionAsyncStorage","DraftMode","trackDynamicDataAccessed","staticGenerationAsyncStorage","getExpectedRequestStore","headers","callingExpression","staticGenerationStore","getStore","forceStatic","seal","Headers","cookies","requestStore","asyncActionStore","isAction","isAppRoute","mutableCookies","draftMode"],"mappings":"AAAA,SAEEA,qBAAqB,QAChB,2DAA0D;AACjE,SAASC,cAAc,QAAQ,mDAAkD;AACjF,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,kBAAkB,QAAQ,kCAAiC;AACpE,SAASC,SAAS,QAAQ,eAAc;AACxC,SAASC,wBAAwB,QAAQ,4CAA2C;AACpF,SAASC,4BAA4B,QAAQ,6CAA4C;AACzF,SAASC,uBAAuB,QAAQ,mCAAkC;AAE1E;;;;;;;;CAQC,GACD,OAAO,SAASC;IACd,MAAMC,oBAAoB;IAC1B,MAAMC,wBAAwBJ,6BAA6BK,QAAQ;IAEnE,IAAID,uBAAuB;QACzB,IAAIA,sBAAsBE,WAAW,EAAE;YACrC,wGAAwG;YACxG,OAAOX,eAAeY,IAAI,CAAC,IAAIC,QAAQ,CAAC;QAC1C,OAAO;YACL,wGAAwG;YACxGT,yBAAyBK,uBAAuBD;QAClD;IACF;IAEA,OAAOF,wBAAwBE,mBAAmBD,OAAO;AAC3D;AAEA,OAAO,SAASO;IACd,MAAMN,oBAAoB;IAC1B,MAAMC,wBAAwBJ,6BAA6BK,QAAQ;IAEnE,IAAID,uBAAuB;QACzB,IAAIA,sBAAsBE,WAAW,EAAE;YACrC,wGAAwG;YACxG,OAAOZ,sBAAsBa,IAAI,CAAC,IAAIX,eAAe,IAAIY,QAAQ,CAAC;QACpE,OAAO;YACL,wGAAwG;YACxGT,yBAAyBK,uBAAuBD;QAClD;IACF;IAEA,MAAMO,eAAeT,wBAAwBE;IAE7C,MAAMQ,mBAAmBd,mBAAmBQ,QAAQ;IACpD,IAAIM,CAAAA,oCAAAA,iBAAkBC,QAAQ,MAAID,oCAAAA,iBAAkBE,UAAU,GAAE;QAC9D,2EAA2E;QAC3E,+DAA+D;QAC/D,OAAOH,aAAaI,cAAc;IACpC;IAEA,OAAOJ,aAAaD,OAAO;AAC7B;AAEA,OAAO,SAASM;IACd,MAAMZ,oBAAoB;IAC1B,MAAMO,eAAeT,wBAAwBE;IAE7C,OAAO,IAAIL,UAAUY,aAAaK,SAAS;AAC7C"}

View File

@ -0,0 +1,16 @@
const DYNAMIC_ERROR_CODE = "DYNAMIC_SERVER_USAGE";
export class DynamicServerError extends Error {
constructor(description){
super("Dynamic server usage: " + description);
this.description = description;
this.digest = DYNAMIC_ERROR_CODE;
}
}
export function isDynamicServerError(err) {
if (typeof err !== "object" || err === null || !("digest" in err) || typeof err.digest !== "string") {
return false;
}
return err.digest === DYNAMIC_ERROR_CODE;
}
//# sourceMappingURL=hooks-server-context.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/hooks-server-context.ts"],"names":["DYNAMIC_ERROR_CODE","DynamicServerError","Error","constructor","description","digest","isDynamicServerError","err"],"mappings":"AAAA,MAAMA,qBAAqB;AAE3B,OAAO,MAAMC,2BAA2BC;IAGtCC,YAAY,AAAgBC,WAAmB,CAAE;QAC/C,KAAK,CAAC,AAAC,2BAAwBA;aADLA,cAAAA;aAF5BC,SAAoCL;IAIpC;AACF;AAEA,OAAO,SAASM,qBAAqBC,GAAY;IAC/C,IACE,OAAOA,QAAQ,YACfA,QAAQ,QACR,CAAE,CAAA,YAAYA,GAAE,KAChB,OAAOA,IAAIF,MAAM,KAAK,UACtB;QACA,OAAO;IACT;IAEA,OAAOE,IAAIF,MAAM,KAAKL;AACxB"}

View File

@ -0,0 +1,7 @@
import isError from "../../lib/is-error";
const hydrationErrorRegex = /hydration failed|while hydrating|content does not match|did not match/i;
export function isHydrationError(error) {
return isError(error) && hydrationErrorRegex.test(error.message);
}
//# sourceMappingURL=is-hydration-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/is-hydration-error.ts"],"names":["isError","hydrationErrorRegex","isHydrationError","error","test","message"],"mappings":"AAAA,OAAOA,aAAa,qBAAoB;AAExC,MAAMC,sBACJ;AAEF,OAAO,SAASC,iBAAiBC,KAAc;IAC7C,OAAOH,QAAQG,UAAUF,oBAAoBG,IAAI,CAACD,MAAME,OAAO;AACjE"}

View File

@ -0,0 +1,7 @@
import { isNotFoundError } from "./not-found";
import { isRedirectError } from "./redirect";
export function isNextRouterError(error) {
return error && error.digest && (isRedirectError(error) || isNotFoundError(error));
}
//# sourceMappingURL=is-next-router-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/is-next-router-error.ts"],"names":["isNotFoundError","isRedirectError","isNextRouterError","error","digest"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAa;AAC7C,SAASC,eAAe,QAAQ,aAAY;AAE5C,OAAO,SAASC,kBAAkBC,KAAU;IAC1C,OACEA,SAASA,MAAMC,MAAM,IAAKH,CAAAA,gBAAgBE,UAAUH,gBAAgBG,MAAK;AAE7E"}

View File

@ -0,0 +1,440 @@
"use client";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import React, { useContext, use, startTransition, Suspense, useDeferredValue } from "react";
import ReactDOM from "react-dom";
import { LayoutRouterContext, GlobalLayoutRouterContext, TemplateContext } from "../../shared/lib/app-router-context.shared-runtime";
import { fetchServerResponse } from "./router-reducer/fetch-server-response";
import { unresolvedThenable } from "./unresolved-thenable";
import { ErrorBoundary } from "./error-boundary";
import { matchSegment } from "./match-segments";
import { handleSmoothScroll } from "../../shared/lib/router/utils/handle-smooth-scroll";
import { RedirectBoundary } from "./redirect-boundary";
import { NotFoundBoundary } from "./not-found-boundary";
import { getSegmentValue } from "./router-reducer/reducers/get-segment-value";
import { createRouterCacheKey } from "./router-reducer/create-router-cache-key";
import { hasInterceptionRouteInCurrentTree } from "./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 (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.findDOMNode(instance);
} finally{
console.error = originalConsoleError;
}
}
return ReactDOM.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.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)=>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 = [];
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 = useContext(GlobalLayoutRouterContext);
if (!context) {
throw new Error("invariant global layout router not mounted");
}
return /*#__PURE__*/ _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 = useContext(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 = 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" ? 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 = hasInterceptionRouteInCurrentTree(fullTree);
childNode.lazyData = lazyData = 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 = use(lazyData);
if (!childNode.lazyDataResolved) {
// setTimeout is used to start a new transition during render, this is an intentional hack around React.
setTimeout(()=>{
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.
use(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__*/ _jsx(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__*/ _jsx(Suspense, {
fallback: /*#__PURE__*/ _jsxs(_Fragment, {
children: [
loadingStyles,
loadingScripts,
loading
]
}),
children: children
});
}
return /*#__PURE__*/ _jsx(_Fragment, {
children: children
});
}
/**
* 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(param) {
let { parallelRouterKey, segmentPath, error, errorStyles, errorScripts, templateStyles, templateScripts, template, notFound, notFoundStyles } = param;
const context = useContext(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 = 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__*/ _jsx(_Fragment, {
children: preservedSegments.map((preservedSegment)=>{
const preservedSegmentValue = getSegmentValue(preservedSegment);
const cacheKey = 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__*/ _jsxs(TemplateContext.Provider, {
value: /*#__PURE__*/ _jsx(ScrollAndFocusHandler, {
segmentPath: segmentPath,
children: /*#__PURE__*/ _jsx(ErrorBoundary, {
errorComponent: error,
errorStyles: errorStyles,
errorScripts: errorScripts,
children: /*#__PURE__*/ _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__*/ _jsx(NotFoundBoundary, {
notFound: notFound,
notFoundStyles: notFoundStyles,
children: /*#__PURE__*/ _jsx(RedirectBoundary, {
children: /*#__PURE__*/ _jsx(InnerLayoutRouter, {
parallelRouterKey: parallelRouterKey,
url: url,
tree: tree,
childNodes: childNodesForParallelRouter,
segmentPath: segmentPath,
cacheKey: cacheKey,
isActive: currentChildSegmentValue === preservedSegmentValue
})
})
})
})
})
}),
children: [
templateStyles,
templateScripts,
template
]
}, createRouterCacheKey(preservedSegment, true)));
})
});
}
//# sourceMappingURL=layout-router.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,26 @@
import { getSegmentParam } from "../../server/app-render/get-segment-param";
export 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];
};
/*
* This function is used to determine if an existing segment can be overridden by the incoming segment.
*/ export const canSegmentBeOverridden = (existingSegment, segment)=>{
var _getSegmentParam;
if (Array.isArray(existingSegment) || !Array.isArray(segment)) {
return false;
}
return ((_getSegmentParam = getSegmentParam(existingSegment)) == null ? void 0 : _getSegmentParam.param) === segment[0];
};
//# sourceMappingURL=match-segments.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/match-segments.ts"],"names":["getSegmentParam","matchSegment","existingSegment","segment","canSegmentBeOverridden","Array","isArray","param"],"mappings":"AAAA,SAASA,eAAe,QAAQ,4CAA2C;AAG3E,OAAO,MAAMC,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,EAAC;AAED;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CACpCF,iBACAC;QAMOH;IAJP,IAAIK,MAAMC,OAAO,CAACJ,oBAAoB,CAACG,MAAMC,OAAO,CAACH,UAAU;QAC7D,OAAO;IACT;IAEA,OAAOH,EAAAA,mBAAAA,gBAAgBE,qCAAhBF,iBAAkCO,KAAK,MAAKJ,OAAO,CAAC,EAAE;AAC/D,EAAC"}

View File

@ -0,0 +1,200 @@
import { useContext, useMemo } from "react";
import { AppRouterContext, LayoutRouterContext } from "../../shared/lib/app-router-context.shared-runtime";
import { SearchParamsContext, PathnameContext, PathParamsContext } from "../../shared/lib/hooks-client-context.shared-runtime";
import { getSegmentValue } from "./router-reducer/reducers/get-segment-value";
import { PAGE_SEGMENT_KEY, DEFAULT_SEGMENT_KEY } from "../../shared/lib/segment";
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)
*/ function useSearchParams() {
const searchParams = useContext(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 = useMemo(()=>{
if (!searchParams) {
// When the router is not ready in pages, we won't have the search params
// available.
return null;
}
return new 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 useContext(PathnameContext);
}
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)
*/ function useRouter() {
const router = useContext(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 useContext(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 = getSegmentValue(segment);
if (!segmentValue || segmentValue.startsWith(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 = useContext(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 === DEFAULT_SEGMENT_KEY ? null : selectedLayoutSegment;
}
// Client components APIs
export { useSearchParams, usePathname, useSelectedLayoutSegment, useSelectedLayoutSegments, useParams, useRouter, useServerInsertedHTML, ServerInsertedHTMLContext, };
// Shared components APIs
export { notFound, redirect, permanentRedirect, RedirectType, ReadonlyURLSearchParams } from "./navigation.react-server";
//# sourceMappingURL=navigation.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/navigation.ts"],"names":["useContext","useMemo","AppRouterContext","LayoutRouterContext","SearchParamsContext","PathnameContext","PathParamsContext","getSegmentValue","PAGE_SEGMENT_KEY","DEFAULT_SEGMENT_KEY","ReadonlyURLSearchParams","useSearchParams","searchParams","readonlySearchParams","window","bailoutToClientRendering","require","usePathname","ServerInsertedHTMLContext","useServerInsertedHTML","useRouter","router","Error","useParams","getSelectedLayoutSegmentPath","tree","parallelRouteKey","first","segmentPath","node","parallelRoutes","children","Object","values","segment","segmentValue","startsWith","push","useSelectedLayoutSegments","context","useSelectedLayoutSegment","selectedLayoutSegments","length","selectedLayoutSegment","notFound","redirect","permanentRedirect","RedirectType"],"mappings":"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"}

View File

@ -0,0 +1,24 @@
/** @internal */ 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();
}
}
export { redirect, permanentRedirect, RedirectType } from "./redirect";
export { notFound } from "./not-found";
export { ReadonlyURLSearchParams };
//# sourceMappingURL=navigation.react-server.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/navigation.react-server.ts"],"names":["ReadonlyURLSearchParamsError","Error","constructor","ReadonlyURLSearchParams","URLSearchParams","append","delete","set","sort","redirect","permanentRedirect","RedirectType","notFound"],"mappings":"AAAA,cAAc,GACd,MAAMA,qCAAqCC;IACzCC,aAAc;QACZ,KAAK,CACH;IAEJ;AACF;AAEA,MAAMC,gCAAgCC;IACpC,wKAAwK,GACxKC,SAAS;QACP,MAAM,IAAIL;IACZ;IACA,wKAAwK,GACxKM,SAAS;QACP,MAAM,IAAIN;IACZ;IACA,wKAAwK,GACxKO,MAAM;QACJ,MAAM,IAAIP;IACZ;IACA,wKAAwK,GACxKQ,OAAO;QACL,MAAM,IAAIR;IACZ;AACF;AAEA,SAASS,QAAQ,EAAEC,iBAAiB,EAAEC,YAAY,QAAQ,aAAY;AACtE,SAASC,QAAQ,QAAQ,cAAa;AACtC,SAAST,uBAAuB,GAAE"}

View File

@ -0,0 +1,5 @@
export default function NoopHead() {
return null;
}
//# sourceMappingURL=noop-head.js.map

View File

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

View File

@ -0,0 +1,90 @@
"use client";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import React, { useContext } from "react";
import { usePathname } from "./navigation";
import { isNotFoundError } from "./not-found";
import { warnOnce } from "../../shared/lib/utils/warn-once";
import { MissingSlotContext } from "../../shared/lib/app-router-context.shared-runtime";
class NotFoundErrorBoundary extends React.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;
}
warnOnce(warningMessage);
}
}
static getDerivedStateFromError(error) {
if (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__*/ _jsxs(_Fragment, {
children: [
/*#__PURE__*/ _jsx("meta", {
name: "robots",
content: "noindex"
}),
process.env.NODE_ENV === "development" && /*#__PURE__*/ _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
};
}
}
export function NotFoundBoundary(param) {
let { notFound, notFoundStyles, asNotFound, children } = param;
const pathname = usePathname();
const missingSlots = useContext(MissingSlotContext);
return notFound ? /*#__PURE__*/ _jsx(NotFoundErrorBoundary, {
pathname: pathname,
notFound: notFound,
notFoundStyles: notFoundStyles,
asNotFound: asNotFound,
missingSlots: missingSlots,
children: children
}) : /*#__PURE__*/ _jsx(_Fragment, {
children: children
});
}
//# sourceMappingURL=not-found-boundary.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found-boundary.tsx"],"names":["React","useContext","usePathname","isNotFoundError","warnOnce","MissingSlotContext","NotFoundErrorBoundary","Component","componentDidCatch","process","env","NODE_ENV","props","missingSlots","has","warningMessage","size","formattedSlots","Array","from","sort","a","b","localeCompare","map","slot","join","getDerivedStateFromError","error","notFoundTriggered","getDerivedStateFromProps","state","pathname","previousPathname","render","meta","name","content","notFoundStyles","notFound","children","constructor","asNotFound","NotFoundBoundary"],"mappings":"AAAA;;AAEA,OAAOA,SAASC,UAAU,QAAQ,QAAO;AACzC,SAASC,WAAW,QAAQ,eAAc;AAC1C,SAASC,eAAe,QAAQ,cAAa;AAC7C,SAASC,QAAQ,QAAQ,mCAAkC;AAC3D,SAASC,kBAAkB,QAAQ,qDAAoD;AAmBvF,MAAMC,8BAA8BN,MAAMO,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;YAEAb,SAASW;QACX;IACF;IAEA,OAAOY,yBAAyBC,KAAU,EAAE;QAC1C,IAAIzB,gBAAgByB,QAAQ;YAC1B,OAAO;gBACLC,mBAAmB;YACrB;QACF;QACA,mCAAmC;QACnC,MAAMD;IACR;IAEA,OAAOE,yBACLlB,KAAiC,EACjCmB,KAAiC,EACE;QACnC;;;;;KAKC,GACD,IAAInB,MAAMoB,QAAQ,KAAKD,MAAME,gBAAgB,IAAIF,MAAMF,iBAAiB,EAAE;YACxE,OAAO;gBACLA,mBAAmB;gBACnBI,kBAAkBrB,MAAMoB,QAAQ;YAClC;QACF;QACA,OAAO;YACLH,mBAAmBE,MAAMF,iBAAiB;YAC1CI,kBAAkBrB,MAAMoB,QAAQ;QAClC;IACF;IAEAE,SAAS;QACP,IAAI,IAAI,CAACH,KAAK,CAACF,iBAAiB,EAAE;YAChC,qBACE;;kCACE,KAACM;wBAAKC,MAAK;wBAASC,SAAQ;;oBAC3B5B,QAAQC,GAAG,CAACC,QAAQ,KAAK,+BACxB,KAACwB;wBAAKC,MAAK;wBAAaC,SAAQ;;oBAEjC,IAAI,CAACzB,KAAK,CAAC0B,cAAc;oBACzB,IAAI,CAAC1B,KAAK,CAAC2B,QAAQ;;;QAG1B;QAEA,OAAO,IAAI,CAAC3B,KAAK,CAAC4B,QAAQ;IAC5B;IA9EAC,YAAY7B,KAAiC,CAAE;QAC7C,KAAK,CAACA;QACN,IAAI,CAACmB,KAAK,GAAG;YACXF,mBAAmB,CAAC,CAACjB,MAAM8B,UAAU;YACrCT,kBAAkBrB,MAAMoB,QAAQ;QAClC;IACF;AAyEF;AAEA,OAAO,SAASW,iBAAiB,KAKT;IALS,IAAA,EAC/BJ,QAAQ,EACRD,cAAc,EACdI,UAAU,EACVF,QAAQ,EACc,GALS;IAM/B,MAAMR,WAAW9B;IACjB,MAAMW,eAAeZ,WAAWI;IAChC,OAAOkC,yBACL,KAACjC;QACC0B,UAAUA;QACVO,UAAUA;QACVD,gBAAgBA;QAChBI,YAAYA;QACZ7B,cAAcA;kBAEb2B;uBAGH;kBAAGA;;AAEP"}

View File

@ -0,0 +1,79 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import React from "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
}
};
export default function NotFound() {
return /*#__PURE__*/ _jsxs(_Fragment, {
children: [
/*#__PURE__*/ _jsx("title", {
children: "404: This page could not be found."
}),
/*#__PURE__*/ _jsx("div", {
style: styles.error,
children: /*#__PURE__*/ _jsxs("div", {
children: [
/*#__PURE__*/ _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__*/ _jsx("h1", {
className: "next-error-h1",
style: styles.h1,
children: "404"
}),
/*#__PURE__*/ _jsx("div", {
style: styles.desc,
children: /*#__PURE__*/ _jsx("h2", {
style: styles.h2,
children: "This page could not be found."
})
})
]
})
})
]
});
}
//# sourceMappingURL=not-found-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found-error.tsx"],"names":["React","styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","desc","h1","margin","padding","fontSize","fontWeight","verticalAlign","lineHeight","h2","NotFound","title","div","style","dangerouslySetInnerHTML","__html","className"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,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;AAEA,eAAe,SAASO;IACtB,qBACE;;0BAEE,KAACC;0BAAM;;0BAEP,KAACC;gBAAIC,OAAOrB,OAAOC,KAAK;0BACtB,cAAA,MAACmB;;sCACC,KAACC;4BACCC,yBAAyB;gCACvB;;;;;;;;;;;;cAYA,GACAC,QAAS;4BACX;;sCAEF,KAACb;4BAAGc,WAAU;4BAAgBH,OAAOrB,OAAOU,EAAE;sCAAE;;sCAGhD,KAACU;4BAAIC,OAAOrB,OAAOS,IAAI;sCACrB,cAAA,KAACQ;gCAAGI,OAAOrB,OAAOiB,EAAE;0CAAE;;;;;;;;AAMlC"}

View File

@ -0,0 +1,34 @@
const NOT_FOUND_ERROR_CODE = "NEXT_NOT_FOUND";
/**
* 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 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;
}
/**
* 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 function isNotFoundError(error) {
if (typeof error !== "object" || error === null || !("digest" in error)) {
return false;
}
return error.digest === NOT_FOUND_ERROR_CODE;
}
//# sourceMappingURL=not-found.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found.ts"],"names":["NOT_FOUND_ERROR_CODE","notFound","error","Error","digest","isNotFoundError"],"mappings":"AAAA,MAAMA,uBAAuB;AAI7B;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC;IACd,4CAA4C;IAC5C,MAAMC,QAAQ,IAAIC,MAAMH;IACtBE,MAAwBE,MAAM,GAAGJ;IACnC,MAAME;AACR;AAEA;;;;;;CAMC,GACD,OAAO,SAASG,gBAAgBH,KAAc;IAC5C,IAAI,OAAOA,UAAU,YAAYA,UAAU,QAAQ,CAAE,CAAA,YAAYA,KAAI,GAAI;QACvE,OAAO;IACT;IAEA,OAAOA,MAAME,MAAM,KAAKJ;AAC1B"}

View File

@ -0,0 +1,7 @@
import { notFound } from "./not-found";
export const PARALLEL_ROUTE_DEFAULT_PATH = "next/dist/client/components/parallel-route-default.js";
export default function ParallelRouteDefault() {
notFound();
}
//# sourceMappingURL=parallel-route-default.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/parallel-route-default.tsx"],"names":["notFound","PARALLEL_ROUTE_DEFAULT_PATH","ParallelRouteDefault"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAa;AAEtC,OAAO,MAAMC,8BACX,wDAAuD;AAEzD,eAAe,SAASC;IACtBF;AACF"}

View File

@ -0,0 +1,75 @@
/*
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.
*/ import { _ as _class_private_field_loose_base } from "@swc/helpers/_/_class_private_field_loose_base";
import { _ as _class_private_field_loose_key } from "@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");
export 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();
}
}
//# 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;;IAEE,mFACA,+EACA,iEAmDA;AAtDF,OAAO,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,gCAAA,IAAI,EAAEC,eAAAA;gBACN,MAAMC,SAAS,MAAMT;gBACrBC,YAAYQ;YACd,EAAE,OAAOC,OAAO;gBACdR,WAAWQ;YACb,SAAU;gBACR,gCAAA,IAAI,EAAEF,eAAAA;gBACN,gCAAA,IAAI,EAAEG,cAAAA;YACR;QACF;QAEA,MAAMC,gBAAgB;YAAEZ,WAAWG;YAAaI;QAAK;QACrD,gDAAgD;QAChD,gCAAA,IAAI,EAAEM,QAAAA,QAAMC,IAAI,CAACF;QACjB,gCAAA,IAAI,EAAED,cAAAA;QAEN,OAAOR;IACT;IAEAY,KAAKf,SAAuB,EAAE;QAC5B,MAAMgB,QAAQ,gCAAA,IAAI,EAAEH,QAAAA,QAAMI,SAAS,CAAC,CAACC,OAASA,KAAKlB,SAAS,KAAKA;QAEjE,IAAIgB,QAAQ,CAAC,GAAG;YACd,MAAMG,aAAa,gCAAA,IAAI,EAAEN,QAAAA,QAAMO,MAAM,CAACJ,OAAO,EAAE,CAAC,EAAE;YAClD,gCAAA,IAAI,EAAEH,QAAAA,QAAMQ,OAAO,CAACF;YACpB,gCAAA,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,gCAAA,IAAI,EAAEA,iBAAAA,mBAAiBA;QACvB,gCAAA,IAAI,EAAEf,eAAAA,iBAAe;QACrB,gCAAA,IAAI,EAAEK,QAAAA,UAAQ,EAAE;IAClB;AAkDF;AARE,SAAA,YAAaW,MAAc;IAAdA,IAAAA,mBAAAA,SAAS;IACpB,IACE,AAAC,CAAA,gCAAA,IAAI,EAAEhB,eAAAA,iBAAe,gCAAA,IAAI,EAAEe,iBAAAA,oBAAkBC,MAAK,KACnD,gCAAA,IAAI,EAAEX,QAAAA,QAAMY,MAAM,GAAG,GACrB;YACA;SAAA,+CAAA,gCAAA,IAAI,EAAEZ,QAAAA,QAAMa,KAAK,uBAAjB,6CAAqBnB,IAAI;IAC3B;AACF"}

View File

@ -0,0 +1,84 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import * as React from "react";
import { ACTION_UNHANDLED_ERROR } from "../shared";
import { ShadowPortal } from "../internal/components/ShadowPortal";
import { BuildError } from "../internal/container/BuildError";
import { Errors } from "../internal/container/Errors";
import { parseStack } from "../internal/helpers/parseStack";
import { Base } from "../internal/styles/Base";
import { ComponentStyles } from "../internal/styles/ComponentStyles";
import { CssReset } from "../internal/styles/CssReset";
import { RootLayoutMissingTagsError } from "../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: ACTION_UNHANDLED_ERROR,
reason: error,
frames: 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__*/ _jsxs(_Fragment, {
children: [
reactError ? /*#__PURE__*/ _jsxs("html", {
children: [
/*#__PURE__*/ _jsx("head", {}),
/*#__PURE__*/ _jsx("body", {})
]
}) : children,
isMounted ? /*#__PURE__*/ _jsxs(ShadowPortal, {
children: [
/*#__PURE__*/ _jsx(CssReset, {}),
/*#__PURE__*/ _jsx(Base, {}),
/*#__PURE__*/ _jsx(ComponentStyles, {}),
((_state_rootLayoutMissingTags1 = state.rootLayoutMissingTags) == null ? void 0 : _state_rootLayoutMissingTags1.length) ? /*#__PURE__*/ _jsx(RootLayoutMissingTagsError, {
missingTags: state.rootLayoutMissingTags
}) : hasBuildError ? /*#__PURE__*/ _jsx(BuildError, {
message: state.buildError,
versionInfo: state.versionInfo
}) : reactError ? /*#__PURE__*/ _jsx(Errors, {
isAppDir: true,
versionInfo: state.versionInfo,
initialDisplayState: "fullscreen",
errors: [
reactError
]
}) : hasRuntimeErrors ? /*#__PURE__*/ _jsx(Errors, {
isAppDir: true,
initialDisplayState: "minimized",
errors: state.errors,
versionInfo: state.versionInfo
}) : undefined
]
}) : undefined
]
});
}
constructor(...args){
super(...args);
this.state = {
reactError: null
};
}
}
export { ReactDevOverlay as default };
//# sourceMappingURL=ReactDevOverlay.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/app/ReactDevOverlay.tsx"],"names":["React","ACTION_UNHANDLED_ERROR","ShadowPortal","BuildError","Errors","parseStack","Base","ComponentStyles","CssReset","RootLayoutMissingTagsError","ReactDevOverlay","PureComponent","getDerivedStateFromError","error","stack","reactError","id","event","type","reason","frames","componentDidCatch","componentErr","props","onReactError","render","state","children","hasBuildError","buildError","hasRuntimeErrors","Boolean","errors","length","hasMissingTags","rootLayoutMissingTags","isMounted","html","head","body","missingTags","message","versionInfo","isAppDir","initialDisplayState","undefined"],"mappings":";AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,sBAAsB,QAA2B,YAAW;AAErE,SAASC,YAAY,QAAQ,sCAAqC;AAClE,SAASC,UAAU,QAAQ,mCAAkC;AAC7D,SAASC,MAAM,QAAQ,+BAA8B;AAErD,SAASC,UAAU,QAAQ,iCAAgC;AAC3D,SAASC,IAAI,QAAQ,0BAAyB;AAC9C,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,QAAQ,QAAQ,8BAA6B;AACtD,SAASC,0BAA0B,QAAQ,uDAAsD;AAKlF,MAAMC,wBAAwBV,MAAMW,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,MAAMjB;oBACNkB,QAAQN;oBACRO,QAAQf,WAAWQ,MAAMC,KAAK;gBAChC;YACF;QACF;IACF;IAEAO,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,EAAER,UAAU,EAAE,GAAG,IAAI,CAACW,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,oBAAoBf,cAAcmB;QAErD,qBACE;;gBACGnB,2BACC,MAACsB;;sCACC,KAACC;sCACD,KAACC;;qBAGHZ;gBAEDS,0BACC,MAAClC;;sCACC,KAACM;sCACD,KAACF;sCACD,KAACC;wBACAmB,EAAAA,gCAAAA,MAAMS,qBAAqB,qBAA3BT,8BAA6BO,MAAM,kBAClC,KAACxB;4BACC+B,aAAad,MAAMS,qBAAqB;6BAExCP,8BACF,KAACzB;4BACCsC,SAASf,MAAMG,UAAU;4BACzBa,aAAahB,MAAMgB,WAAW;6BAE9B3B,2BACF,KAACX;4BACCuC,UAAU;4BACVD,aAAahB,MAAMgB,WAAW;4BAC9BE,qBAAoB;4BACpBZ,QAAQ;gCAACjB;6BAAW;6BAEpBe,iCACF,KAAC1B;4BACCuC,UAAU;4BACVC,qBAAoB;4BACpBZ,QAAQN,MAAMM,MAAM;4BACpBU,aAAahB,MAAMgB,WAAW;6BAE9BG;;qBAEJA;;;IAGV;;;aAzEAnB,QAAQ;YAAEX,YAAY;QAAK;;AA0E7B;AAlFA,SAAqBL,6BAkFpB"}

View File

@ -0,0 +1,428 @@
import { jsx as _jsx } from "react/jsx-runtime";
import { useCallback, useEffect, startTransition, useMemo } from "react";
import stripAnsi from "next/dist/compiled/strip-ansi";
import formatWebpackMessages from "../internal/helpers/format-webpack-messages";
import { useRouter } from "../../navigation";
import { ACTION_BEFORE_REFRESH, ACTION_BUILD_ERROR, ACTION_BUILD_OK, ACTION_REFRESH, ACTION_UNHANDLED_ERROR, ACTION_UNHANDLED_REJECTION, ACTION_VERSION_INFO, useErrorOverlayReducer } from "../shared";
import { parseStack } from "../internal/helpers/parseStack";
import ReactDevOverlay from "./ReactDevOverlay";
import { useErrorHandler } from "../internal/helpers/use-error-handler";
import { RuntimeErrorHandler } from "../internal/helpers/runtime-error-handler";
import { useSendMessage, useTurbopack, useWebsocket, useWebsocketPing } from "../internal/helpers/use-websocket";
import { parseComponentStack } from "../internal/helpers/parse-component-stack";
import { HMR_ACTIONS_SENT_TO_BROWSER } from "../../../../server/dev/hot-reloader-types";
import { extractModulesFromTurbopackMessage } from "../../../../server/dev/extract-modules-from-turbopack-message";
import { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from "../shared";
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.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.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.hadRuntimeError) {
console.warn(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 = formatWebpackMessages({
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(stripAnsi(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 HMR_ACTIONS_SENT_TO_BROWSER.BUILDING:
{
startLatency = Date.now();
console.log("[Fast Refresh] rebuilding");
break;
}
case HMR_ACTIONS_SENT_TO_BROWSER.BUILT:
case 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 = formatWebpackMessages({
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(stripAnsi(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 === HMR_ACTIONS_SENT_TO_BROWSER.BUILT) {
// Handle hot updates
handleHotUpdate();
}
return;
}
case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED:
{
processTurbopackMessage({
type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED
});
break;
}
case HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE:
{
const updatedModules = extractModulesFromTurbopackMessage(obj.data);
dispatcher.onBeforeRefresh();
processTurbopackMessage({
type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE,
data: obj.data
});
dispatcher.onRefresh();
if (RuntimeErrorHandler.hadRuntimeError) {
console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR);
performFullReload(null, sendMessage);
}
reportHmrLatency(sendMessage, updatedModules);
break;
}
// TODO-APP: make server component change more granular
case HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES:
{
sendMessage(JSON.stringify({
event: "server-component-reload-page",
clientId: __nextDevClientId
}));
if (RuntimeErrorHandler.hadRuntimeError) {
if (reloading) return;
reloading = true;
return window.location.reload();
}
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 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 HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE:
case HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE:
{
// TODO-APP: potentially only refresh if the currently viewed page was added/removed.
return router.fastRefresh();
}
case 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 HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE:
{
return;
}
default:
{}
}
}
export default function HotReload(param) {
let { assetPrefix, children } = param;
const [state, dispatch] = useErrorOverlayReducer();
const dispatcher = useMemo(()=>{
return {
onBuildOk () {
dispatch({
type: ACTION_BUILD_OK
});
},
onBuildError (message) {
dispatch({
type: ACTION_BUILD_ERROR,
message
});
},
onBeforeRefresh () {
dispatch({
type: ACTION_BEFORE_REFRESH
});
},
onRefresh () {
dispatch({
type: ACTION_REFRESH
});
},
onVersionInfo (versionInfo) {
dispatch({
type: ACTION_VERSION_INFO,
versionInfo
});
}
};
}, [
dispatch
]);
const handleOnUnhandledError = 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: ACTION_UNHANDLED_ERROR,
reason: error,
frames: parseStack(error.stack),
componentStackFrames: componentStack ? parseComponentStack(componentStack) : undefined,
warning
});
}, [
dispatch
]);
const handleOnUnhandledRejection = useCallback((reason)=>{
dispatch({
type: ACTION_UNHANDLED_REJECTION,
reason: reason,
frames: parseStack(reason.stack)
});
}, [
dispatch
]);
const handleOnReactError = useCallback(()=>{
RuntimeErrorHandler.hadRuntimeError = true;
}, []);
useErrorHandler(handleOnUnhandledError, handleOnUnhandledRejection);
const webSocketRef = useWebsocket(assetPrefix);
useWebsocketPing(webSocketRef);
const sendMessage = useSendMessage(webSocketRef);
const processTurbopackMessage = useTurbopack(sendMessage, (err)=>performFullReload(err, sendMessage));
const router = useRouter();
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__*/ _jsx(ReactDevOverlay, {
onReactError: handleOnReactError,
state: state,
children: children
});
}
//# sourceMappingURL=hot-reloader-client.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,102 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import Anser from "next/dist/compiled/anser";
import * as React from "react";
import stripAnsi from "next/dist/compiled/strip-ansi";
import { getFrameSource } from "../../helpers/stack-frame";
import { useOpenInEditor } from "../../helpers/use-open-in-editor";
import { HotlinkedText } from "../hot-linked-text";
export 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(stripAnsi(line)) === null ? null : /^>? +\d+ +\| ( *)/.exec(stripAnsi(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.ansiToJson(formattedFrame, {
json: true,
use_classes: true,
remove_empty: true
});
}, [
formattedFrame
]);
const open = useOpenInEditor({
file: stackFrame.file,
lineNumber: stackFrame.lineNumber,
column: stackFrame.column
});
// TODO: make the caret absolute
return /*#__PURE__*/ _jsxs("div", {
"data-nextjs-codeframe": true,
children: [
/*#__PURE__*/ _jsx("div", {
children: /*#__PURE__*/ _jsxs("p", {
role: "link",
onClick: open,
tabIndex: 1,
title: "Click to open in your editor",
children: [
/*#__PURE__*/ _jsxs("span", {
children: [
getFrameSource(stackFrame),
" @",
" ",
/*#__PURE__*/ _jsx(HotlinkedText, {
text: stackFrame.methodName
})
]
}),
/*#__PURE__*/ _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__*/ _jsx("path", {
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
}),
/*#__PURE__*/ _jsx("polyline", {
points: "15 3 21 3 21 9"
}),
/*#__PURE__*/ _jsx("line", {
x1: "10",
y1: "14",
x2: "21",
y2: "3"
})
]
})
]
})
}),
/*#__PURE__*/ _jsx("pre", {
children: decoded.map((entry, index)=>/*#__PURE__*/ _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))
})
]
});
};
//# sourceMappingURL=CodeFrame.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/CodeFrame/CodeFrame.tsx"],"names":["Anser","React","stripAnsi","getFrameSource","useOpenInEditor","HotlinkedText","CodeFrame","stackFrame","codeFrame","formattedFrame","useMemo","lines","split","miniLeadingSpacesLength","map","line","exec","filter","Boolean","v","pop","reduce","c","n","isNaN","length","Math","min","NaN","a","indexOf","substring","replace","join","decoded","ansiToJson","json","use_classes","remove_empty","open","file","lineNumber","column","div","data-nextjs-codeframe","p","role","onClick","tabIndex","title","span","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":";AAAA,OAAOA,WAAW,2BAA0B;AAC5C,YAAYC,WAAW,QAAO;AAE9B,OAAOC,eAAe,gCAA+B;AACrD,SAASC,cAAc,QAAQ,4BAA2B;AAC1D,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,aAAa,QAAQ,qBAAoB;AAIlD,OAAO,MAAMC,YAAsC,SAASA,UAAU,KAGrE;IAHqE,IAAA,EACpEC,UAAU,EACVC,SAAS,EACV,GAHqE;IAIpE,8CAA8C;IAC9C,MAAMC,iBAAiBR,MAAMS,OAAO,CAAS;QAC3C,MAAMC,QAAQH,UAAUI,KAAK,CAAC;QAE9B,wEAAwE;QACxE,MAAMC,0BAA0BF,MAC7BG,GAAG,CAAC,CAACC,OACJ,oBAAoBC,IAAI,CAACd,UAAUa,WAAW,OAC1C,OACA,oBAAoBC,IAAI,CAACd,UAAUa,QAExCE,MAAM,CAACC,SACPJ,GAAG,CAAC,CAACK,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,IAAIf,0BAA0B,GAAG;YAC/B,OAAOF,MACJG,GAAG,CAAC,CAACC,MAAMc,IACV,CAAEA,CAAAA,IAAId,KAAKe,OAAO,CAAC,IAAG,IAClBf,KAAKgB,SAAS,CAAC,GAAGF,KAClBd,KAAKgB,SAAS,CAACF,GAAGG,OAAO,CAAC,AAAC,UAAOnB,0BAAwB,KAAI,MAC9DE,MAELkB,IAAI,CAAC;QACV;QACA,OAAOtB,MAAMsB,IAAI,CAAC;IACpB,GAAG;QAACzB;KAAU;IAEd,MAAM0B,UAAUjC,MAAMS,OAAO,CAAC;QAC5B,OAAOV,MAAMmC,UAAU,CAAC1B,gBAAgB;YACtC2B,MAAM;YACNC,aAAa;YACbC,cAAc;QAChB;IACF,GAAG;QAAC7B;KAAe;IAEnB,MAAM8B,OAAOnC,gBAAgB;QAC3BoC,MAAMjC,WAAWiC,IAAI;QACrBC,YAAYlC,WAAWkC,UAAU;QACjCC,QAAQnC,WAAWmC,MAAM;IAC3B;IAEA,gCAAgC;IAChC,qBACE,MAACC;QAAIC,uBAAqB;;0BACxB,KAACD;0BACC,cAAA,MAACE;oBACCC,MAAK;oBACLC,SAASR;oBACTS,UAAU;oBACVC,OAAM;;sCAEN,MAACC;;gCACE/C,eAAeI;gCAAY;gCAAG;8CAC/B,KAACF;oCAAc8C,MAAM5C,WAAW6C,UAAU;;;;sCAE5C,MAACC;4BACCC,OAAM;4BACNC,SAAQ;4BACRC,MAAK;4BACLC,QAAO;4BACPC,aAAY;4BACZC,eAAc;4BACdC,gBAAe;;8CAEf,KAACC;oCAAKC,GAAE;;8CACR,KAACC;oCAASC,QAAO;;8CACjB,KAACjD;oCAAKkD,IAAG;oCAAKC,IAAG;oCAAKC,IAAG;oCAAKC,IAAG;;;;;;;0BAIvC,KAACC;0BACEnC,QAAQpB,GAAG,CAAC,CAACwD,OAAOC,sBACnB,KAACrB;wBAECsB,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,EAAC"}

View File

@ -0,0 +1,3 @@
export { CodeFrame } from "./CodeFrame";
//# 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":"AAAA,SAASA,SAAS,QAAQ,cAAa"}

View File

@ -0,0 +1,15 @@
import { _ as _tagged_template_literal_loose } from "@swc/helpers/_/_tagged_template_literal_loose";
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;
}
import { noop as css } from "../../helpers/noop-template";
const styles = css(_templateObject());
export { styles };
//# sourceMappingURL=styles.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/CodeFrame/styles.tsx"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;AAiDf,SAASC,MAAM,GAAE"}

View File

@ -0,0 +1,70 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from "react";
import { useOnClickOutside } from "../../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);
}, []);
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__*/ _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__*/ _jsx("div", {
"data-nextjs-dialog-banner": true,
className: "banner-" + type
}),
children
]
});
};
export { Dialog };
//# sourceMappingURL=Dialog.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/Dialog.tsx"],"names":["React","useOnClickOutside","Dialog","children","type","onClose","props","dialog","setDialog","useState","role","setRole","document","hasFocus","undefined","onDialog","useCallback","node","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":";AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,iBAAiB,QAAQ,mCAAkC;AAUpE,MAAMC,SAAgC,SAASA,OAAO,KAKrD;IALqD,IAAA,EACpDC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACP,GAAGC,OACJ,GALqD;IAMpD,MAAM,CAACC,QAAQC,UAAU,GAAGR,MAAMS,QAAQ,CAAwB;IAClE,MAAM,CAACC,MAAMC,QAAQ,GAAGX,MAAMS,QAAQ,CACpC,OAAOG,aAAa,eAAeA,SAASC,QAAQ,KAChD,WACAC;IAEN,MAAMC,WAAWf,MAAMgB,WAAW,CAAC,CAACC;QAClCT,UAAUS;IACZ,GAAG,EAAE;IACLhB,kBAAkBM,QAAQ,CAACW;QACzBA,EAAEC,cAAc;QAChB,OAAOd,2BAAAA;IACT;IAEA,uEAAuE;IACvE,0BAA0B;IAC1BL,MAAMoB,SAAS,CAAC;QACd,IAAIb,UAAU,MAAM;YAClB;QACF;QAEA,MAAMc,OAAOd,OAAOe,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;YAC7EtB,QAAQC,SAASC,QAAQ,KAAK,WAAWC;QAC3C;QAEAU,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;QAAC1B;KAAO;IAEX,qBACE,MAAC8B;QACCC,KAAKvB;QACLwB,oBAAkB;QAClBC,UAAU,CAAC;QACX9B,MAAMA;QACN+B,mBAAiBnC,KAAK,CAAC,kBAAkB;QACzCoC,oBAAkBpC,KAAK,CAAC,mBAAmB;QAC3CqC,cAAW;;0BAEX,KAACN;gBAAIO,2BAAyB;gBAACC,WAAW,AAAC,YAASzC;;YACnDD;;;AAGP;AAEA,SAASD,MAAM,GAAE"}

View File

@ -0,0 +1,13 @@
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from "react";
const DialogBody = function DialogBody(param) {
let { children, className } = param;
return /*#__PURE__*/ _jsx("div", {
"data-nextjs-dialog-body": true,
className: className,
children: children
});
};
export { DialogBody };
//# sourceMappingURL=DialogBody.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/DialogBody.tsx"],"names":["React","DialogBody","children","className","div","data-nextjs-dialog-body"],"mappings":";AAAA,YAAYA,WAAW,QAAO;AAO9B,MAAMC,aAAwC,SAASA,WAAW,KAGjE;IAHiE,IAAA,EAChEC,QAAQ,EACRC,SAAS,EACV,GAHiE;IAIhE,qBACE,KAACC;QAAIC,yBAAuB;QAACF,WAAWA;kBACrCD;;AAGP;AAEA,SAASD,UAAU,GAAE"}

View File

@ -0,0 +1,13 @@
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from "react";
const DialogContent = function DialogContent(param) {
let { children, className } = param;
return /*#__PURE__*/ _jsx("div", {
"data-nextjs-dialog-content": true,
className: className,
children: children
});
};
export { DialogContent };
//# sourceMappingURL=DialogContent.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/DialogContent.tsx"],"names":["React","DialogContent","children","className","div","data-nextjs-dialog-content"],"mappings":";AAAA,YAAYA,WAAW,QAAO;AAO9B,MAAMC,gBAA8C,SAASA,cAAc,KAG1E;IAH0E,IAAA,EACzEC,QAAQ,EACRC,SAAS,EACV,GAH0E;IAIzE,qBACE,KAACC;QAAIC,4BAA0B;QAACF,WAAWA;kBACxCD;;AAGP;AAEA,SAASD,aAAa,GAAE"}

View File

@ -0,0 +1,13 @@
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from "react";
const DialogHeader = function DialogHeader(param) {
let { children, className } = param;
return /*#__PURE__*/ _jsx("div", {
"data-nextjs-dialog-header": true,
className: className,
children: children
});
};
export { DialogHeader };
//# sourceMappingURL=DialogHeader.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/DialogHeader.tsx"],"names":["React","DialogHeader","children","className","div","data-nextjs-dialog-header"],"mappings":";AAAA,YAAYA,WAAW,QAAO;AAO9B,MAAMC,eAA4C,SAASA,aAAa,KAGvE;IAHuE,IAAA,EACtEC,QAAQ,EACRC,SAAS,EACV,GAHuE;IAItE,qBACE,KAACC;QAAIC,2BAAyB;QAACF,WAAWA;kBACvCD;;AAGP;AAEA,SAASD,YAAY,GAAE"}

View File

@ -0,0 +1,7 @@
export { Dialog } from "./Dialog";
export { DialogBody } from "./DialogBody";
export { DialogContent } from "./DialogContent";
export { DialogHeader } from "./DialogHeader";
export { styles } from "./styles";
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/index.ts"],"names":["Dialog","DialogBody","DialogContent","DialogHeader","styles"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAU;AACjC,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,aAAa,QAAQ,kBAAiB;AAC/C,SAASC,YAAY,QAAQ,iBAAgB;AAC7C,SAASC,MAAM,QAAQ,WAAU"}

View File

@ -0,0 +1,15 @@
import { _ as _tagged_template_literal_loose } from "@swc/helpers/_/_tagged_template_literal_loose";
function _templateObject() {
const data = _tagged_template_literal_loose([
"\n [data-nextjs-dialog] {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-right: auto;\n margin-left: auto;\n outline: none;\n background: var(--color-background);\n border-radius: var(--size-gap);\n box-shadow: 0 var(--size-gap-half) var(--size-gap-double)\n rgba(0, 0, 0, 0.25);\n max-height: calc(100% - 56px);\n overflow-y: hidden;\n }\n\n @media (max-height: 812px) {\n [data-nextjs-dialog-overlay] {\n max-height: calc(100% - 15px);\n }\n }\n\n @media (min-width: 576px) {\n [data-nextjs-dialog] {\n max-width: 540px;\n box-shadow: 0 var(--size-gap) var(--size-gap-quad) rgba(0, 0, 0, 0.25);\n }\n }\n\n @media (min-width: 768px) {\n [data-nextjs-dialog] {\n max-width: 720px;\n }\n }\n\n @media (min-width: 992px) {\n [data-nextjs-dialog] {\n max-width: 960px;\n }\n }\n\n [data-nextjs-dialog-banner] {\n position: relative;\n }\n [data-nextjs-dialog-banner].banner-warning {\n border-color: var(--color-ansi-yellow);\n }\n [data-nextjs-dialog-banner].banner-error {\n border-color: var(--color-ansi-red);\n }\n\n [data-nextjs-dialog-banner]::after {\n z-index: 2;\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n width: 100%;\n /* banner width: */\n border-top-width: var(--size-gap-half);\n border-bottom-width: 0;\n border-top-style: solid;\n border-bottom-style: solid;\n border-top-color: inherit;\n border-bottom-color: transparent;\n }\n\n [data-nextjs-dialog-content] {\n overflow-y: auto;\n border: none;\n margin: 0;\n /* calc(padding + banner width offset) */\n padding: calc(var(--size-gap-double) + var(--size-gap-half))\n var(--size-gap-double);\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n [data-nextjs-dialog-content] > [data-nextjs-dialog-header] {\n flex-shrink: 0;\n margin-bottom: var(--size-gap-double);\n }\n [data-nextjs-dialog-content] > [data-nextjs-dialog-body] {\n position: relative;\n flex: 1 1 auto;\n }\n"
]);
_templateObject = function() {
return data;
};
return data;
}
import { noop as css } from "../../helpers/noop-template";
const styles = css(_templateObject());
export { styles };
//# sourceMappingURL=styles.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/styles.ts"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;AAwFf,SAASC,MAAM,GAAE"}

View File

@ -0,0 +1,162 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from "react";
import { CloseIcon } from "../../icons/CloseIcon";
const LeftRightDialogHeader = function LeftRightDialogHeader(param) {
let { children, className, previous, next, close } = param;
const buttonLeft = React.useRef(null);
const buttonRight = React.useRef(null);
const buttonClose = React.useRef(null);
const [nav, setNav] = React.useState(null);
const onNav = React.useCallback((el)=>{
setNav(el);
}, []);
React.useEffect(()=>{
if (nav == null) {
return;
}
const root = nav.getRootNode();
const d = self.document;
function handler(e) {
if (e.key === "ArrowLeft") {
e.preventDefault();
e.stopPropagation();
if (buttonLeft.current) {
buttonLeft.current.focus();
}
previous && previous();
} else if (e.key === "ArrowRight") {
e.preventDefault();
e.stopPropagation();
if (buttonRight.current) {
buttonRight.current.focus();
}
next && next();
} else if (e.key === "Escape") {
e.preventDefault();
e.stopPropagation();
if (root instanceof ShadowRoot) {
const a = root.activeElement;
if (a && a !== buttonClose.current && a instanceof HTMLElement) {
a.blur();
return;
}
}
close == null ? void 0 : close();
}
}
root.addEventListener("keydown", handler);
if (root !== d) {
d.addEventListener("keydown", handler);
}
return function() {
root.removeEventListener("keydown", handler);
if (root !== d) {
d.removeEventListener("keydown", handler);
}
};
}, [
close,
nav,
next,
previous
]);
// Unlock focus for browsers like Firefox, that break all user focus if the
// currently focused item becomes disabled.
React.useEffect(()=>{
if (nav == null) {
return;
}
const root = nav.getRootNode();
// Always true, but we do this for TypeScript:
if (root instanceof ShadowRoot) {
const a = root.activeElement;
if (previous == null) {
if (buttonLeft.current && a === buttonLeft.current) {
buttonLeft.current.blur();
}
} else if (next == null) {
if (buttonRight.current && a === buttonRight.current) {
buttonRight.current.blur();
}
}
}
}, [
nav,
next,
previous
]);
return /*#__PURE__*/ _jsxs("div", {
"data-nextjs-dialog-left-right": true,
className: className,
children: [
/*#__PURE__*/ _jsxs("nav", {
ref: onNav,
children: [
/*#__PURE__*/ _jsx("button", {
ref: buttonLeft,
type: "button",
disabled: previous == null ? true : undefined,
"aria-disabled": previous == null ? true : undefined,
onClick: previous != null ? previous : undefined,
children: /*#__PURE__*/ _jsxs("svg", {
viewBox: "0 0 14 14",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [
/*#__PURE__*/ _jsx("title", {
children: "previous"
}),
/*#__PURE__*/ _jsx("path", {
d: "M6.99996 1.16666L1.16663 6.99999L6.99996 12.8333M12.8333 6.99999H1.99996H12.8333Z",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
})
]
})
}),
/*#__PURE__*/ _jsx("button", {
ref: buttonRight,
type: "button",
disabled: next == null ? true : undefined,
"aria-disabled": next == null ? true : undefined,
onClick: next != null ? next : undefined,
children: /*#__PURE__*/ _jsxs("svg", {
viewBox: "0 0 14 14",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [
/*#__PURE__*/ _jsx("title", {
children: "next"
}),
/*#__PURE__*/ _jsx("path", {
d: "M6.99996 1.16666L12.8333 6.99999L6.99996 12.8333M1.16663 6.99999H12H1.16663Z",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
})
]
})
}),
children
]
}),
close ? /*#__PURE__*/ _jsx("button", {
"data-nextjs-errors-dialog-left-right-close-button": true,
ref: buttonClose,
type: "button",
onClick: close,
"aria-label": "Close",
children: /*#__PURE__*/ _jsx("span", {
"aria-hidden": "true",
children: /*#__PURE__*/ _jsx(CloseIcon, {})
})
}) : null
]
});
};
export { LeftRightDialogHeader };
//# sourceMappingURL=LeftRightDialogHeader.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/LeftRightDialogHeader/LeftRightDialogHeader.tsx"],"names":["React","CloseIcon","LeftRightDialogHeader","children","className","previous","next","close","buttonLeft","useRef","buttonRight","buttonClose","nav","setNav","useState","onNav","useCallback","el","useEffect","root","getRootNode","d","self","document","handler","e","key","preventDefault","stopPropagation","current","focus","ShadowRoot","a","activeElement","HTMLElement","blur","addEventListener","removeEventListener","div","data-nextjs-dialog-left-right","ref","button","type","disabled","undefined","aria-disabled","onClick","svg","viewBox","fill","xmlns","title","path","stroke","strokeWidth","strokeLinecap","strokeLinejoin","data-nextjs-errors-dialog-left-right-close-button","aria-label","span","aria-hidden"],"mappings":"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"}

View File

@ -0,0 +1,4 @@
export { LeftRightDialogHeader } from "./LeftRightDialogHeader";
export { styles } from "./styles";
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/LeftRightDialogHeader/index.ts"],"names":["LeftRightDialogHeader","styles"],"mappings":"AAAA,SAASA,qBAAqB,QAAQ,0BAAyB;AAC/D,SAASC,MAAM,QAAQ,WAAU"}

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