main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,385 @@
import React, { useCallback, useEffect, useReducer, useMemo, startTransition } from "react";
import stripAnsi from "next/dist/compiled/strip-ansi";
import formatWebpackMessages from "../../dev/error-overlay/format-webpack-messages";
import { useRouter } from "../navigation";
import { ACTION_VERSION_INFO, INITIAL_OVERLAY_STATE, errorOverlayReducer } from "./internal/error-overlay-reducer";
import { ACTION_BUILD_OK, ACTION_BUILD_ERROR, ACTION_BEFORE_REFRESH, ACTION_REFRESH, ACTION_UNHANDLED_ERROR, ACTION_UNHANDLED_REJECTION } from "./internal/error-overlay-reducer";
import { parseStack } from "./internal/helpers/parseStack";
import ReactDevOverlay from "./internal/ReactDevOverlay";
import { RuntimeErrorHandler, useErrorHandler } from "./internal/helpers/use-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";
let mostRecentCompilationHash = null;
let __nextDevClientId = Math.round(Math.random() * 100 + Date.now());
function onBeforeFastRefresh(dispatcher, hasUpdates) {
if (hasUpdates) {
dispatcher.onBeforeRefresh();
}
}
function onFastRefresh(dispatcher, hasUpdates) {
dispatcher.onBuildOk();
if (hasUpdates) {
dispatcher.onRefresh();
}
}
// 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?
function isUpdateAvailable() {
/* 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
}));
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("[Fast Refresh] performing full reload because your application had an unrecoverable error");
}
performFullReload(err, sendMessage);
return;
}
const hasUpdates = Boolean(updatedModules.length);
if (typeof onHotUpdateSuccess === "function") {
// Maybe we want to do something.
onHotUpdateSuccess(hasUpdates);
}
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);
});
}
function processMessage(obj, sendMessage, 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;
}
}
}
switch(obj.action){
case HMR_ACTIONS_SENT_TO_BROWSER.BUILDING:
{
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
}));
// Compilation with warnings (e.g. ESLint).
const isHotUpdate = obj.action !== HMR_ACTIONS_SENT_TO_BROWSER.SYNC;
// 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]));
}
// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates(function onBeforeHotUpdate(hasUpdates) {
onBeforeFastRefresh(dispatcher, hasUpdates);
}, function onSuccessfulHotUpdate(hasUpdates) {
// Only dismiss it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
onFastRefresh(dispatcher, hasUpdates);
}, sendMessage, dispatcher);
}
return;
}
sendMessage(JSON.stringify({
event: "client-success",
clientId: __nextDevClientId
}));
const isHotUpdate = obj.action !== HMR_ACTIONS_SENT_TO_BROWSER.SYNC && (!window.__NEXT_DATA__ || window.__NEXT_DATA__.page !== "/_error") && isUpdateAvailable();
// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates(function onBeforeHotUpdate(hasUpdates) {
onBeforeFastRefresh(dispatcher, hasUpdates);
}, function onSuccessfulHotUpdate(hasUpdates) {
// Only dismiss it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
onFastRefresh(dispatcher, hasUpdates);
}, sendMessage, dispatcher);
}
return;
}
// 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) {
return window.location.reload();
}
startTransition(()=>{
// @ts-ignore it exists, it's just hidden
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
}));
return window.location.reload();
}
case HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE:
{
// TODO-APP: potentially only refresh if the currently viewed page was removed.
// @ts-ignore it exists, it's just hidden
router.fastRefresh();
return;
}
case HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE:
{
// TODO-APP: potentially only refresh if the currently viewed page was added.
// @ts-ignore it exists, it's just hidden
router.fastRefresh();
return;
}
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:
{
throw new Error("Unexpected action " + JSON.stringify(obj));
}
}
}
export default function HotReload(param) {
let { assetPrefix, children } = param;
const [state, dispatch] = useReducer(errorOverlayReducer, INITIAL_OVERLAY_STATE);
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)=>{
// Component stack is added to the error in use-error-handler in case there was a hydration errror
const componentStack = error._componentStack;
dispatch({
type: ACTION_UNHANDLED_ERROR,
reason: error,
frames: parseStack(error.stack),
componentStackFrames: componentStack && parseComponentStack(componentStack)
});
}, []);
const handleOnUnhandledRejection = useCallback((reason)=>{
dispatch({
type: ACTION_UNHANDLED_REJECTION,
reason: reason,
frames: parseStack(reason.stack)
});
}, []);
const handleOnReactError = useCallback(()=>{
RuntimeErrorHandler.hadRuntimeError = true;
}, []);
useErrorHandler(handleOnUnhandledError, handleOnUnhandledRejection);
const webSocketRef = useWebsocket(assetPrefix);
useWebsocketPing(webSocketRef);
const sendMessage = useSendMessage(webSocketRef);
const processTurbopackMessage = useTurbopack(sendMessage);
const router = useRouter();
useEffect(()=>{
const handler = (event)=>{
try {
const obj = JSON.parse(event.data);
const handledByTurbopack = processTurbopackMessage == null ? void 0 : processTurbopackMessage(obj);
if (!handledByTurbopack) {
processMessage(obj, sendMessage, 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 : ""));
}
};
const websocket = webSocketRef.current;
if (websocket) {
websocket.addEventListener("message", handler);
}
return ()=>websocket && websocket.removeEventListener("message", handler);
}, [
sendMessage,
router,
webSocketRef,
dispatcher,
processTurbopackMessage
]);
return /*#__PURE__*/ React.createElement(ReactDevOverlay, {
onReactError: handleOnReactError,
state: state
}, children);
}
//# sourceMappingURL=hot-reloader-client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,63 @@
import * as React from "react";
import { ACTION_UNHANDLED_ERROR } from "./error-overlay-reducer";
import { ShadowPortal } from "./components/ShadowPortal";
import { BuildError } from "./container/BuildError";
import { Errors } from "./container/Errors";
import { RootLayoutError } from "./container/RootLayoutError";
import { parseStack } from "./helpers/parseStack";
import { Base } from "./styles/Base";
import { ComponentStyles } from "./styles/ComponentStyles";
import { CssReset } from "./styles/CssReset";
class ReactDevOverlay extends React.PureComponent {
static getDerivedStateFromError(error) {
const e = error;
const event = {
type: ACTION_UNHANDLED_ERROR,
reason: error,
frames: parseStack(e.stack)
};
const errorEvent = {
id: 0,
event
};
return {
reactError: errorEvent
};
}
componentDidCatch(componentErr) {
this.props.onReactError(componentErr);
}
render() {
const { state, children } = this.props;
const { reactError } = this.state;
const hasBuildError = state.buildError != null;
const hasRuntimeErrors = Boolean(state.errors.length);
const rootLayoutMissingTagsError = state.rootLayoutMissingTagsError;
const isMounted = hasBuildError || hasRuntimeErrors || reactError || rootLayoutMissingTagsError;
return /*#__PURE__*/ React.createElement(React.Fragment, null, reactError ? /*#__PURE__*/ React.createElement("html", null, /*#__PURE__*/ React.createElement("head", null), /*#__PURE__*/ React.createElement("body", null)) : children, isMounted ? /*#__PURE__*/ React.createElement(ShadowPortal, null, /*#__PURE__*/ React.createElement(CssReset, null), /*#__PURE__*/ React.createElement(Base, null), /*#__PURE__*/ React.createElement(ComponentStyles, null), rootLayoutMissingTagsError ? /*#__PURE__*/ React.createElement(RootLayoutError, {
missingTags: rootLayoutMissingTagsError.missingTags
}) : hasBuildError ? /*#__PURE__*/ React.createElement(BuildError, {
message: state.buildError,
versionInfo: state.versionInfo
}) : reactError ? /*#__PURE__*/ React.createElement(Errors, {
versionInfo: state.versionInfo,
initialDisplayState: "fullscreen",
errors: [
reactError
]
}) : hasRuntimeErrors ? /*#__PURE__*/ React.createElement(Errors, {
initialDisplayState: "minimized",
errors: state.errors,
versionInfo: state.versionInfo
}) : undefined) : undefined);
}
constructor(...args){
super(...args);
this.state = {
reactError: null
};
}
}
export default ReactDevOverlay;
//# sourceMappingURL=ReactDevOverlay.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/internal/ReactDevOverlay.tsx"],"names":["React","ACTION_UNHANDLED_ERROR","ShadowPortal","BuildError","Errors","RootLayoutError","parseStack","Base","ComponentStyles","CssReset","ReactDevOverlay","PureComponent","getDerivedStateFromError","error","e","event","type","reason","frames","stack","errorEvent","id","reactError","componentDidCatch","componentErr","props","onReactError","render","state","children","hasBuildError","buildError","hasRuntimeErrors","Boolean","errors","length","rootLayoutMissingTagsError","isMounted","html","head","body","missingTags","message","versionInfo","initialDisplayState","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAO;AAC9B,SACEC,sBAAsB,QAGjB,0BAAyB;AAEhC,SAASC,YAAY,QAAQ,4BAA2B;AACxD,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,MAAM,QAA6B,qBAAoB;AAChE,SAASC,eAAe,QAAQ,8BAA6B;AAC7D,SAASC,UAAU,QAAQ,uBAAsB;AACjD,SAASC,IAAI,QAAQ,gBAAe;AACpC,SAASC,eAAe,QAAQ,2BAA0B;AAC1D,SAASC,QAAQ,QAAQ,oBAAmB;AAK5C,MAAMC,wBAAwBV,MAAMW,aAAa;IAU/C,OAAOC,yBAAyBC,KAAY,EAAwB;QAClE,MAAMC,IAAID;QACV,MAAME,QAA8B;YAClCC,MAAMf;YACNgB,QAAQJ;YACRK,QAAQZ,WAAWQ,EAAEK,KAAK;QAC5B;QACA,MAAMC,aAAkC;YACtCC,IAAI;YACJN;QACF;QACA,OAAO;YAAEO,YAAYF;QAAW;IAClC;IAEAG,kBAAkBC,YAAmB,EAAE;QACrC,IAAI,CAACC,KAAK,CAACC,YAAY,CAACF;IAC1B;IAEAG,SAAS;QACP,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAG,IAAI,CAACJ,KAAK;QACtC,MAAM,EAAEH,UAAU,EAAE,GAAG,IAAI,CAACM,KAAK;QAEjC,MAAME,gBAAgBF,MAAMG,UAAU,IAAI;QAC1C,MAAMC,mBAAmBC,QAAQL,MAAMM,MAAM,CAACC,MAAM;QACpD,MAAMC,6BAA6BR,MAAMQ,0BAA0B;QACnE,MAAMC,YACJP,iBACAE,oBACAV,cACAc;QAEF,qBACE,0CACGd,2BACC,oBAACgB,4BACC,oBAACC,6BACD,oBAACC,iBAGHX,UAEDQ,0BACC,oBAACnC,kCACC,oBAACO,+BACD,oBAACF,2BACD,oBAACC,wBAEA4B,2CACC,oBAAC/B;YACCoC,aAAaL,2BAA2BK,WAAW;aAEnDX,8BACF,oBAAC3B;YACCuC,SAASd,MAAMG,UAAU;YACzBY,aAAaf,MAAMe,WAAW;aAE9BrB,2BACF,oBAAClB;YACCuC,aAAaf,MAAMe,WAAW;YAC9BC,qBAAoB;YACpBV,QAAQ;gBAACZ;aAAW;aAEpBU,iCACF,oBAAC5B;YACCwC,qBAAoB;YACpBV,QAAQN,MAAMM,MAAM;YACpBS,aAAaf,MAAMe,WAAW;aAE9BE,aAEJA;IAGV;;;aA3EAjB,QAAQ;YAAEN,YAAY;QAAK;;AA4E7B;AAEA,eAAeZ,gBAAe"}

View File

@@ -0,0 +1,72 @@
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";
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);
const prefixLength = 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);
if (prefixLength > 1) {
const p = " ".repeat(prefixLength);
return lines.map((line, a)=>~(a = line.indexOf("|")) ? line.substring(0, a) + line.substring(a).replace(p, "") : 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__*/ React.createElement("div", {
"data-nextjs-codeframe": true
}, /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("p", {
role: "link",
onClick: open,
tabIndex: 1,
title: "Click to open in your editor"
}, /*#__PURE__*/ React.createElement("span", null, getFrameSource(stackFrame), " @ ", stackFrame.methodName), /*#__PURE__*/ React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}, /*#__PURE__*/ React.createElement("path", {
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
}), /*#__PURE__*/ React.createElement("polyline", {
points: "15 3 21 3 21 9"
}), /*#__PURE__*/ React.createElement("line", {
x1: "10",
y1: "14",
x2: "21",
y2: "3"
})))), /*#__PURE__*/ React.createElement("pre", null, decoded.map((entry, index)=>/*#__PURE__*/ React.createElement("span", {
key: "frame-" + index,
style: {
color: entry.fg ? "var(--color-" + entry.fg + ")" : undefined,
...entry.decoration === "bold" ? {
fontWeight: 800
} : entry.decoration === "italic" ? {
fontStyle: "italic"
} : undefined
}
}, entry.content))));
};
//# 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","CodeFrame","stackFrame","codeFrame","formattedFrame","useMemo","lines","split","prefixLength","map","line","exec","filter","Boolean","v","pop","reduce","c","n","isNaN","length","Math","min","NaN","p","repeat","a","indexOf","substring","replace","join","decoded","ansiToJson","json","use_classes","remove_empty","open","file","lineNumber","column","div","data-nextjs-codeframe","role","onClick","tabIndex","title","span","methodName","svg","xmlns","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","path","d","polyline","points","x1","y1","x2","y2","pre","entry","index","key","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;AAIlE,OAAO,MAAMC,YAAsC,SAASA,UAAU,KAGrE;IAHqE,IAAA,EACpEC,UAAU,EACVC,SAAS,EACV,GAHqE;IAIpE,8CAA8C;IAC9C,MAAMC,iBAAiBP,MAAMQ,OAAO,CAAS;QAC3C,MAAMC,QAAQH,UAAUI,KAAK,CAAC;QAC9B,MAAMC,eAAeF,MAClBG,GAAG,CAAC,CAACC,OACJ,oBAAoBC,IAAI,CAACb,UAAUY,WAAW,OAC1C,OACA,oBAAoBC,IAAI,CAACb,UAAUY,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,IAAIf,eAAe,GAAG;YACpB,MAAMgB,IAAI,IAAIC,MAAM,CAACjB;YACrB,OAAOF,MACJG,GAAG,CAAC,CAACC,MAAMgB,IACV,CAAEA,CAAAA,IAAIhB,KAAKiB,OAAO,CAAC,IAAG,IAClBjB,KAAKkB,SAAS,CAAC,GAAGF,KAAKhB,KAAKkB,SAAS,CAACF,GAAGG,OAAO,CAACL,GAAG,MACpDd,MAELoB,IAAI,CAAC;QACV;QACA,OAAOxB,MAAMwB,IAAI,CAAC;IACpB,GAAG;QAAC3B;KAAU;IAEd,MAAM4B,UAAUlC,MAAMQ,OAAO,CAAC;QAC5B,OAAOT,MAAMoC,UAAU,CAAC5B,gBAAgB;YACtC6B,MAAM;YACNC,aAAa;YACbC,cAAc;QAChB;IACF,GAAG;QAAC/B;KAAe;IAEnB,MAAMgC,OAAOpC,gBAAgB;QAC3BqC,MAAMnC,WAAWmC,IAAI;QACrBC,YAAYpC,WAAWoC,UAAU;QACjCC,QAAQrC,WAAWqC,MAAM;IAC3B;IAEA,gCAAgC;IAChC,qBACE,oBAACC;QAAIC,yBAAAA;qBACH,oBAACD,2BACC,oBAAChB;QACCkB,MAAK;QACLC,SAASP;QACTQ,UAAU;QACVC,OAAM;qBAEN,oBAACC,cACE/C,eAAeG,aAAY,OAAIA,WAAW6C,UAAU,iBAEvD,oBAACC;QACCC,OAAM;QACNC,SAAQ;QACRC,MAAK;QACLC,QAAO;QACPC,aAAY;QACZC,eAAc;QACdC,gBAAe;qBAEf,oBAACC;QAAKC,GAAE;sBACR,oBAACC;QAASC,QAAO;sBACjB,oBAACjD;QAAKkD,IAAG;QAAKC,IAAG;QAAKC,IAAG;QAAKC,IAAG;yBAIvC,oBAACC,aACEjC,QAAQtB,GAAG,CAAC,CAACwD,OAAOC,sBACnB,oBAACpB;YACCqB,KAAK,AAAC,WAAQD;YACdE,OAAO;gBACLC,OAAOJ,MAAMK,EAAE,GAAG,AAAC,iBAAcL,MAAMK,EAAE,GAAC,MAAKC;gBAC/C,GAAIN,MAAMO,UAAU,KAAK,SACrB;oBAAEC,YAAY;gBAAI,IAClBR,MAAMO,UAAU,KAAK,WACrB;oBAAEE,WAAW;gBAAS,IACtBH,SAAS;YACf;WAECN,MAAMU,OAAO;AAM1B,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,62 @@
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, 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__*/ React.createElement("div", {
ref: onDialog,
"data-nextjs-dialog": true,
tabIndex: -1,
role: role,
"aria-labelledby": props["aria-labelledby"],
"aria-describedby": props["aria-describedby"],
"aria-modal": "true"
}, /*#__PURE__*/ React.createElement("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","useEffect","root","getRootNode","ShadowRoot","shadowRoot","handler","e","el","activeElement","key","HTMLElement","getAttribute","preventDefault","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,QAAQF;IAE1B,uEAAuE;IACvE,0BAA0B;IAC1BL,MAAMkB,SAAS,CAAC;QACd,IAAIX,UAAU,MAAM;YAClB;QACF;QAEA,MAAMY,OAAOZ,OAAOa,WAAW;QAC/B,8CAA8C;QAC9C,IAAI,CAAED,CAAAA,gBAAgBE,UAAS,GAAI;YACjC;QACF;QACA,MAAMC,aAAaH;QACnB,SAASI,QAAQC,CAAgB;YAC/B,MAAMC,KAAKH,WAAWI,aAAa;YACnC,IACEF,EAAEG,GAAG,KAAK,WACVF,cAAcG,eACdH,GAAGI,YAAY,CAAC,YAAY,QAC5B;gBACAL,EAAEM,cAAc;gBAChBN,EAAEO,eAAe;gBAEjBN,GAAGO,KAAK;YACV;QACF;QAEA,SAASC;YACP,2GAA2G;YAC3G,6EAA6E;YAC7EtB,QAAQC,SAASC,QAAQ,KAAK,WAAWC;QAC3C;QAEAQ,WAAWY,gBAAgB,CAAC,WAAWX;QACvCY,OAAOD,gBAAgB,CAAC,SAASD;QACjCE,OAAOD,gBAAgB,CAAC,QAAQD;QAChC,OAAO;YACLX,WAAWc,mBAAmB,CAAC,WAAWb;YAC1CY,OAAOC,mBAAmB,CAAC,SAASH;YACpCE,OAAOC,mBAAmB,CAAC,QAAQH;QACrC;IACF,GAAG;QAAC1B;KAAO;IAEX,qBACE,oBAAC8B;QACCC,KAAKvB;QACLwB,sBAAAA;QACAC,UAAU,CAAC;QACX9B,MAAMA;QACN+B,mBAAiBnC,KAAK,CAAC,kBAAkB;QACzCoC,oBAAkBpC,KAAK,CAAC,mBAAmB;QAC3CqC,cAAW;qBAEX,oBAACN;QAAIO,6BAAAA;QAA0BC,WAAW,AAAC,YAASzC;QACnDD;AAGP;AAEA,SAASD,MAAM,GAAE"}

View File

@@ -0,0 +1,11 @@
import * as React from "react";
const DialogBody = function DialogBody(param) {
let { children, className } = param;
return /*#__PURE__*/ React.createElement("div", {
"data-nextjs-dialog-body": true,
className: className
}, 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,oBAACC;QAAIC,2BAAAA;QAAwBF,WAAWA;OACrCD;AAGP;AAEA,SAASD,UAAU,GAAE"}

View File

@@ -0,0 +1,11 @@
import * as React from "react";
const DialogContent = function DialogContent(param) {
let { children, className } = param;
return /*#__PURE__*/ React.createElement("div", {
"data-nextjs-dialog-content": true,
className: className
}, 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,oBAACC;QAAIC,8BAAAA;QAA2BF,WAAWA;OACxCD;AAGP;AAEA,SAASD,aAAa,GAAE"}

View File

@@ -0,0 +1,11 @@
import * as React from "react";
const DialogHeader = function DialogHeader(param) {
let { children, className } = param;
return /*#__PURE__*/ React.createElement("div", {
"data-nextjs-dialog-header": true,
className: className
}, 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,oBAACC;QAAIC,6BAAAA;QAA0BF,WAAWA;OACvCD;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: white;\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,135 @@
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.stopPropagation();
if (buttonLeft.current) {
buttonLeft.current.focus();
}
previous && previous();
} else if (e.key === "ArrowRight") {
e.stopPropagation();
if (buttonRight.current) {
buttonRight.current.focus();
}
next && next();
} else if (e.key === "Escape") {
e.stopPropagation();
if (root instanceof ShadowRoot) {
const a = root.activeElement;
if (a && a !== buttonClose.current && a instanceof HTMLElement) {
a.blur();
return;
}
}
if (close) {
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__*/ React.createElement("div", {
"data-nextjs-dialog-left-right": true,
className: className
}, /*#__PURE__*/ React.createElement("nav", {
ref: onNav
}, /*#__PURE__*/ React.createElement("button", {
ref: buttonLeft,
type: "button",
disabled: previous == null ? true : undefined,
"aria-disabled": previous == null ? true : undefined,
onClick: previous != null ? previous : undefined
}, /*#__PURE__*/ React.createElement("svg", {
viewBox: "0 0 14 14",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/ React.createElement("title", null, "previous"), /*#__PURE__*/ React.createElement("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__*/ React.createElement("button", {
ref: buttonRight,
type: "button",
disabled: next == null ? true : undefined,
"aria-disabled": next == null ? true : undefined,
onClick: next != null ? next : undefined
}, /*#__PURE__*/ React.createElement("svg", {
viewBox: "0 0 14 14",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/ React.createElement("title", null, "next"), /*#__PURE__*/ React.createElement("path", {
d: "M6.99996 1.16666L12.8333 6.99999L6.99996 12.8333M1.16663 6.99999H12H1.16663Z",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}))), "\xa0", children), close ? /*#__PURE__*/ React.createElement("button", {
"data-nextjs-errors-dialog-left-right-close-button": true,
ref: buttonClose,
type: "button",
onClick: close,
"aria-label": "Close"
}, /*#__PURE__*/ React.createElement("span", {
"aria-hidden": "true"
}, /*#__PURE__*/ React.createElement(CloseIcon, null))) : 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","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":"AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,SAAS,QAAQ,wBAAuB;AAUjD,MAAMC,wBACJ,SAASA,sBAAsB,KAM9B;IAN8B,IAAA,EAC7BC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,KAAK,EACN,GAN8B;IAO7B,MAAMC,aAAaR,MAAMS,MAAM,CAA2B;IAC1D,MAAMC,cAAcV,MAAMS,MAAM,CAA2B;IAC3D,MAAME,cAAcX,MAAMS,MAAM,CAA2B;IAE3D,MAAM,CAACG,KAAKC,OAAO,GAAGb,MAAMc,QAAQ,CAAqB;IACzD,MAAMC,QAAQf,MAAMgB,WAAW,CAAC,CAACC;QAC/BJ,OAAOI;IACT,GAAG,EAAE;IAELjB,MAAMkB,SAAS,CAAC;QACd,IAAIN,OAAO,MAAM;YACf;QACF;QAEA,MAAMO,OAAOP,IAAIQ,WAAW;QAC5B,MAAMC,IAAIC,KAAKC,QAAQ;QAEvB,SAASC,QAAQC,CAAgB;YAC/B,IAAIA,EAAEC,GAAG,KAAK,aAAa;gBACzBD,EAAEE,eAAe;gBACjB,IAAInB,WAAWoB,OAAO,EAAE;oBACtBpB,WAAWoB,OAAO,CAACC,KAAK;gBAC1B;gBACAxB,YAAYA;YACd,OAAO,IAAIoB,EAAEC,GAAG,KAAK,cAAc;gBACjCD,EAAEE,eAAe;gBACjB,IAAIjB,YAAYkB,OAAO,EAAE;oBACvBlB,YAAYkB,OAAO,CAACC,KAAK;gBAC3B;gBACAvB,QAAQA;YACV,OAAO,IAAImB,EAAEC,GAAG,KAAK,UAAU;gBAC7BD,EAAEE,eAAe;gBACjB,IAAIR,gBAAgBW,YAAY;oBAC9B,MAAMC,IAAIZ,KAAKa,aAAa;oBAC5B,IAAID,KAAKA,MAAMpB,YAAYiB,OAAO,IAAIG,aAAaE,aAAa;wBAC9DF,EAAEG,IAAI;wBACN;oBACF;gBACF;gBAEA,IAAI3B,OAAO;oBACTA;gBACF;YACF;QACF;QAEAY,KAAKgB,gBAAgB,CAAC,WAAWX;QACjC,IAAIL,SAASE,GAAG;YACdA,EAAEc,gBAAgB,CAAC,WAAWX;QAChC;QACA,OAAO;YACLL,KAAKiB,mBAAmB,CAAC,WAAWZ;YACpC,IAAIL,SAASE,GAAG;gBACdA,EAAEe,mBAAmB,CAAC,WAAWZ;YACnC;QACF;IACF,GAAG;QAACjB;QAAOK;QAAKN;QAAMD;KAAS;IAE/B,2EAA2E;IAC3E,2CAA2C;IAC3CL,MAAMkB,SAAS,CAAC;QACd,IAAIN,OAAO,MAAM;YACf;QACF;QAEA,MAAMO,OAAOP,IAAIQ,WAAW;QAC5B,8CAA8C;QAC9C,IAAID,gBAAgBW,YAAY;YAC9B,MAAMC,IAAIZ,KAAKa,aAAa;YAE5B,IAAI3B,YAAY,MAAM;gBACpB,IAAIG,WAAWoB,OAAO,IAAIG,MAAMvB,WAAWoB,OAAO,EAAE;oBAClDpB,WAAWoB,OAAO,CAACM,IAAI;gBACzB;YACF,OAAO,IAAI5B,QAAQ,MAAM;gBACvB,IAAII,YAAYkB,OAAO,IAAIG,MAAMrB,YAAYkB,OAAO,EAAE;oBACpDlB,YAAYkB,OAAO,CAACM,IAAI;gBAC1B;YACF;QACF;IACF,GAAG;QAACtB;QAAKN;QAAMD;KAAS;IAExB,qBACE,oBAACgC;QAAIC,iCAAAA;QAA8BlC,WAAWA;qBAC5C,oBAACQ;QAAI2B,KAAKxB;qBACR,oBAACyB;QACCD,KAAK/B;QACLiC,MAAK;QACLC,UAAUrC,YAAY,OAAO,OAAOsC;QACpCC,iBAAevC,YAAY,OAAO,OAAOsC;QACzCE,SAASxC,mBAAAA,WAAYsC;qBAErB,oBAACG;QACCC,SAAQ;QACRC,MAAK;QACLC,OAAM;qBAEN,oBAACC,eAAM,2BACP,oBAACC;QACC9B,GAAE;QACF+B,QAAO;QACPC,aAAY;QACZC,eAAc;QACdC,gBAAe;wBAIrB,oBAACf;QACCD,KAAK7B;QACL+B,MAAK;QACLC,UAAUpC,QAAQ,OAAO,OAAOqC;QAChCC,iBAAetC,QAAQ,OAAO,OAAOqC;QACrCE,SAASvC,eAAAA,OAAQqC;qBAEjB,oBAACG;QACCC,SAAQ;QACRC,MAAK;QACLC,OAAM;qBAEN,oBAACC,eAAM,uBACP,oBAACC;QACC9B,GAAE;QACF+B,QAAO;QACPC,aAAY;QACZC,eAAc;QACdC,gBAAe;UAGZ,QAERpD,WAEFI,sBACC,oBAACiC;QACCgB,qDAAAA;QACAjB,KAAK5B;QACL8B,MAAK;QACLI,SAAStC;QACTkD,cAAW;qBAEX,oBAACC;QAAKC,eAAY;qBAChB,oBAAC1D,qBAGH;AAGV;AAEF,SAASC,qBAAqB,GAAE"}

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"}

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-left-right] {\n display: flex;\n flex-direction: row;\n align-content: center;\n align-items: center;\n justify-content: space-between;\n }\n [data-nextjs-dialog-left-right] > nav {\n flex: 1;\n display: flex;\n align-items: center;\n margin-right: var(--size-gap);\n }\n [data-nextjs-dialog-left-right] > nav > button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n width: calc(var(--size-gap-double) + var(--size-gap));\n height: calc(var(--size-gap-double) + var(--size-gap));\n font-size: 0;\n border: none;\n background-color: rgba(255, 85, 85, 0.1);\n color: var(--color-ansi-red);\n cursor: pointer;\n transition: background-color 0.25s ease;\n }\n [data-nextjs-dialog-left-right] > nav > button > svg {\n width: auto;\n height: calc(var(--size-gap) + var(--size-gap-half));\n }\n [data-nextjs-dialog-left-right] > nav > button:hover {\n background-color: rgba(255, 85, 85, 0.2);\n }\n [data-nextjs-dialog-left-right] > nav > button:disabled {\n background-color: rgba(255, 85, 85, 0.1);\n color: rgba(255, 85, 85, 0.4);\n cursor: not-allowed;\n }\n\n [data-nextjs-dialog-left-right] > nav > button:first-of-type {\n border-radius: var(--size-gap-half) 0 0 var(--size-gap-half);\n margin-right: 1px;\n }\n [data-nextjs-dialog-left-right] > nav > button:last-of-type {\n border-radius: 0 var(--size-gap-half) var(--size-gap-half) 0;\n }\n\n [data-nextjs-dialog-left-right] > button:last-of-type {\n border: 0;\n padding: 0;\n\n background-color: transparent;\n appearance: none;\n\n opacity: 0.4;\n transition: opacity 0.25s ease;\n }\n [data-nextjs-dialog-left-right] > button:last-of-type:hover {\n opacity: 0.7;\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/LeftRightDialogHeader/styles.ts"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;AAgEf,SAASC,MAAM,GAAE"}

View File

@@ -0,0 +1,41 @@
// @ts-ignore
import allyTrap from "./maintain--tab-focus";
import * as React from "react";
import { lock, unlock } from "./body-locker";
const Overlay = function Overlay(param) {
let { className, children, fixed } = param;
React.useEffect(()=>{
lock();
return ()=>{
unlock();
};
}, []);
const [overlay, setOverlay] = React.useState(null);
const onOverlay = React.useCallback((el)=>{
setOverlay(el);
}, []);
React.useEffect(()=>{
if (overlay == null) {
return;
}
const handle2 = allyTrap({
context: overlay
});
return ()=>{
handle2.disengage();
};
}, [
overlay
]);
return /*#__PURE__*/ React.createElement("div", {
"data-nextjs-dialog-overlay": true,
className: className,
ref: onOverlay
}, /*#__PURE__*/ React.createElement("div", {
"data-nextjs-dialog-backdrop": true,
"data-nextjs-dialog-backdrop-fixed": fixed ? true : undefined
}), children);
};
export { Overlay };
//# sourceMappingURL=Overlay.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Overlay/Overlay.tsx"],"names":["allyTrap","React","lock","unlock","Overlay","className","children","fixed","useEffect","overlay","setOverlay","useState","onOverlay","useCallback","el","handle2","context","disengage","div","data-nextjs-dialog-overlay","ref","data-nextjs-dialog-backdrop","data-nextjs-dialog-backdrop-fixed","undefined"],"mappings":"AAAA,aAAa;AACb,OAAOA,cAAc,wBAAuB;AAC5C,YAAYC,WAAW,QAAO;AAC9B,SAASC,IAAI,EAAEC,MAAM,QAAQ,gBAAe;AAQ5C,MAAMC,UAAkC,SAASA,QAAQ,KAIxD;IAJwD,IAAA,EACvDC,SAAS,EACTC,QAAQ,EACRC,KAAK,EACN,GAJwD;IAKvDN,MAAMO,SAAS,CAAC;QACdN;QACA,OAAO;YACLC;QACF;IACF,GAAG,EAAE;IAEL,MAAM,CAACM,SAASC,WAAW,GAAGT,MAAMU,QAAQ,CAAwB;IACpE,MAAMC,YAAYX,MAAMY,WAAW,CAAC,CAACC;QACnCJ,WAAWI;IACb,GAAG,EAAE;IAELb,MAAMO,SAAS,CAAC;QACd,IAAIC,WAAW,MAAM;YACnB;QACF;QAEA,MAAMM,UAAUf,SAAS;YAAEgB,SAASP;QAAQ;QAC5C,OAAO;YACLM,QAAQE,SAAS;QACnB;IACF,GAAG;QAACR;KAAQ;IAEZ,qBACE,oBAACS;QAAIC,8BAAAA;QAA2Bd,WAAWA;QAAWe,KAAKR;qBACzD,oBAACM;QACCG,+BAAAA;QACAC,qCAAmCf,QAAQ,OAAOgB;QAEnDjB;AAGP;AAEA,SAASF,OAAO,GAAE"}

View File

@@ -0,0 +1,34 @@
let previousBodyPaddingRight;
let previousBodyOverflowSetting;
let activeLocks = 0;
export function lock() {
setTimeout(()=>{
if (activeLocks++ > 0) {
return;
}
const scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
if (scrollBarGap > 0) {
previousBodyPaddingRight = document.body.style.paddingRight;
document.body.style.paddingRight = "" + scrollBarGap + "px";
}
previousBodyOverflowSetting = document.body.style.overflow;
document.body.style.overflow = "hidden";
});
}
export function unlock() {
setTimeout(()=>{
if (activeLocks === 0 || --activeLocks !== 0) {
return;
}
if (previousBodyPaddingRight !== undefined) {
document.body.style.paddingRight = previousBodyPaddingRight;
previousBodyPaddingRight = undefined;
}
if (previousBodyOverflowSetting !== undefined) {
document.body.style.overflow = previousBodyOverflowSetting;
previousBodyOverflowSetting = undefined;
}
});
}
//# sourceMappingURL=body-locker.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Overlay/body-locker.ts"],"names":["previousBodyPaddingRight","previousBodyOverflowSetting","activeLocks","lock","setTimeout","scrollBarGap","window","innerWidth","document","documentElement","clientWidth","body","style","paddingRight","overflow","unlock","undefined"],"mappings":"AAAA,IAAIA;AACJ,IAAIC;AAEJ,IAAIC,cAAc;AAElB,OAAO,SAASC;IACdC,WAAW;QACT,IAAIF,gBAAgB,GAAG;YACrB;QACF;QAEA,MAAMG,eACJC,OAAOC,UAAU,GAAGC,SAASC,eAAe,CAACC,WAAW;QAE1D,IAAIL,eAAe,GAAG;YACpBL,2BAA2BQ,SAASG,IAAI,CAACC,KAAK,CAACC,YAAY;YAC3DL,SAASG,IAAI,CAACC,KAAK,CAACC,YAAY,GAAG,AAAC,KAAER,eAAa;QACrD;QAEAJ,8BAA8BO,SAASG,IAAI,CAACC,KAAK,CAACE,QAAQ;QAC1DN,SAASG,IAAI,CAACC,KAAK,CAACE,QAAQ,GAAG;IACjC;AACF;AAEA,OAAO,SAASC;IACdX,WAAW;QACT,IAAIF,gBAAgB,KAAK,EAAEA,gBAAgB,GAAG;YAC5C;QACF;QAEA,IAAIF,6BAA6BgB,WAAW;YAC1CR,SAASG,IAAI,CAACC,KAAK,CAACC,YAAY,GAAGb;YACnCA,2BAA2BgB;QAC7B;QAEA,IAAIf,gCAAgCe,WAAW;YAC7CR,SAASG,IAAI,CAACC,KAAK,CAACE,QAAQ,GAAGb;YAC/BA,8BAA8Be;QAChC;IACF;AACF"}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Overlay/index.tsx"],"names":["Overlay"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAW"}

File diff suppressed because one or more lines are too long

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-overlay] {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n overflow: auto;\n z-index: 9000;\n\n display: flex;\n align-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10vh 15px 0;\n }\n\n @media (max-height: 812px) {\n [data-nextjs-dialog-overlay] {\n padding: 15px 15px 0;\n }\n }\n\n [data-nextjs-dialog-backdrop] {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: rgba(17, 17, 17, 0.2);\n pointer-events: all;\n z-index: -1;\n }\n\n [data-nextjs-dialog-backdrop-fixed] {\n cursor: not-allowed;\n -webkit-backdrop-filter: blur(8px);\n backdrop-filter: blur(8px);\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/Overlay/styles.tsx"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;AAyCf,SAASC,MAAM,GAAE"}

View File

@@ -0,0 +1,25 @@
import * as React from "react";
import { createPortal } from "react-dom";
export function ShadowPortal(param) {
let { children } = param;
let portalNode = React.useRef(null);
let shadowNode = React.useRef(null);
let [, forceUpdate] = React.useState();
React.useLayoutEffect(()=>{
const ownerDocument = document;
portalNode.current = ownerDocument.createElement("nextjs-portal");
shadowNode.current = portalNode.current.attachShadow({
mode: "open"
});
ownerDocument.body.appendChild(portalNode.current);
forceUpdate({});
return ()=>{
if (portalNode.current && portalNode.current.ownerDocument) {
portalNode.current.ownerDocument.body.removeChild(portalNode.current);
}
};
}, []);
return shadowNode.current ? /*#__PURE__*/ createPortal(children, shadowNode.current) : null;
}
//# sourceMappingURL=ShadowPortal.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/components/ShadowPortal.tsx"],"names":["React","createPortal","ShadowPortal","children","portalNode","useRef","shadowNode","forceUpdate","useState","useLayoutEffect","ownerDocument","document","current","createElement","attachShadow","mode","body","appendChild","removeChild"],"mappings":"AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,YAAY,QAAQ,YAAW;AAExC,OAAO,SAASC,aAAa,KAA2C;IAA3C,IAAA,EAAEC,QAAQ,EAAiC,GAA3C;IAC3B,IAAIC,aAAaJ,MAAMK,MAAM,CAAqB;IAClD,IAAIC,aAAaN,MAAMK,MAAM,CAAoB;IACjD,IAAI,GAAGE,YAAY,GAAGP,MAAMQ,QAAQ;IAEpCR,MAAMS,eAAe,CAAC;QACpB,MAAMC,gBAAgBC;QACtBP,WAAWQ,OAAO,GAAGF,cAAcG,aAAa,CAAC;QACjDP,WAAWM,OAAO,GAAGR,WAAWQ,OAAO,CAACE,YAAY,CAAC;YAAEC,MAAM;QAAO;QACpEL,cAAcM,IAAI,CAACC,WAAW,CAACb,WAAWQ,OAAO;QACjDL,YAAY,CAAC;QACb,OAAO;YACL,IAAIH,WAAWQ,OAAO,IAAIR,WAAWQ,OAAO,CAACF,aAAa,EAAE;gBAC1DN,WAAWQ,OAAO,CAACF,aAAa,CAACM,IAAI,CAACE,WAAW,CAACd,WAAWQ,OAAO;YACtE;QACF;IACF,GAAG,EAAE;IAEL,OAAON,WAAWM,OAAO,iBACrBX,aAAaE,UAAUG,WAAWM,OAAO,IACzC;AACN"}

View File

@@ -0,0 +1,39 @@
import React from "react";
import { useOpenInEditor } from "../../helpers/use-open-in-editor";
export function EditorLink(param) {
let { file, isSourceFile, location } = param;
var _location_line, _location_column;
const open = useOpenInEditor({
file,
lineNumber: (_location_line = location == null ? void 0 : location.line) != null ? _location_line : 1,
column: (_location_column = location == null ? void 0 : location.column) != null ? _location_column : 0
});
return /*#__PURE__*/ React.createElement("div", {
"data-with-open-in-editor-link": true,
"data-with-open-in-editor-link-source-file": isSourceFile ? true : undefined,
"data-with-open-in-editor-link-import-trace": isSourceFile ? undefined : true,
tabIndex: 10,
role: "link",
onClick: open,
title: "Click to open in your editor"
}, file, location ? " (" + location.line + ":" + location.column + ")" : null, /*#__PURE__*/ React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}, /*#__PURE__*/ React.createElement("path", {
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
}), /*#__PURE__*/ React.createElement("polyline", {
points: "15 3 21 3 21 9"
}), /*#__PURE__*/ React.createElement("line", {
x1: "10",
y1: "14",
x2: "21",
y2: "3"
})));
}
//# sourceMappingURL=EditorLink.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Terminal/EditorLink.tsx"],"names":["React","useOpenInEditor","EditorLink","file","isSourceFile","location","open","lineNumber","line","column","div","data-with-open-in-editor-link","data-with-open-in-editor-link-source-file","undefined","data-with-open-in-editor-link-import-trace","tabIndex","role","onClick","title","svg","xmlns","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","path","d","polyline","points","x1","y1","x2","y2"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AACzB,SAASC,eAAe,QAAQ,mCAAkC;AAUlE,OAAO,SAASC,WAAW,KAAiD;IAAjD,IAAA,EAAEC,IAAI,EAAEC,YAAY,EAAEC,QAAQ,EAAmB,GAAjD;QAGXA,gBACJA;IAHV,MAAMC,OAAOL,gBAAgB;QAC3BE;QACAI,YAAYF,CAAAA,iBAAAA,4BAAAA,SAAUG,IAAI,YAAdH,iBAAkB;QAC9BI,QAAQJ,CAAAA,mBAAAA,4BAAAA,SAAUI,MAAM,YAAhBJ,mBAAoB;IAC9B;IAEA,qBACE,oBAACK;QACCC,iCAAAA;QACAC,6CACER,eAAe,OAAOS;QAExBC,8CACEV,eAAeS,YAAY;QAE7BE,UAAU;QACVC,MAAM;QACNC,SAASX;QACTY,OAAO;OAENf,MACAE,WAAW,AAAC,OAAIA,SAASG,IAAI,GAAC,MAAGH,SAASI,MAAM,GAAC,MAAK,oBACvD,oBAACU;QACCC,OAAM;QACNC,SAAQ;QACRC,MAAK;QACLC,QAAO;QACPC,aAAY;QACZC,eAAc;QACdC,gBAAe;qBAEf,oBAACC;QAAKC,GAAE;sBACR,oBAACC;QAASC,QAAO;sBACjB,oBAACtB;QAAKuB,IAAG;QAAKC,IAAG;QAAKC,IAAG;QAAKC,IAAG;;AAIzC"}

View File

@@ -0,0 +1,82 @@
import Anser from "next/dist/compiled/anser";
import * as React from "react";
import { HotlinkedText } from "../hot-linked-text";
import { EditorLink } from "./EditorLink";
function getFile(lines) {
const contentFileName = lines.shift();
if (!contentFileName) return null;
const [fileName, line, column] = contentFileName.split(":");
const parsedLine = Number(line);
const parsedColumn = Number(column);
const hasLocation = !Number.isNaN(parsedLine) && !Number.isNaN(parsedColumn);
return {
fileName: hasLocation ? fileName : contentFileName,
location: hasLocation ? {
line: parsedLine,
column: parsedColumn
} : undefined
};
}
function getImportTraceFiles(lines) {
if (lines.some((line)=>/ReactServerComponentsError:/.test(line)) || lines.some((line)=>/Import trace for requested module:/.test(line))) {
// Grab the lines at the end containing the files
const files = [];
while(/.+\..+/.test(lines[lines.length - 1]) && !lines[lines.length - 1].includes(":")){
const file = lines.pop().trim();
files.unshift(file);
}
return files;
}
return [];
}
function getEditorLinks(content) {
const lines = content.split("\n");
const file = getFile(lines);
const importTraceFiles = getImportTraceFiles(lines);
return {
file,
source: lines.join("\n"),
importTraceFiles
};
}
export const Terminal = function Terminal(param) {
let { content } = param;
const { file, source, importTraceFiles } = React.useMemo(()=>getEditorLinks(content), [
content
]);
const decoded = React.useMemo(()=>{
return Anser.ansiToJson(source, {
json: true,
use_classes: true,
remove_empty: true
});
}, [
source
]);
return /*#__PURE__*/ React.createElement("div", {
"data-nextjs-terminal": true
}, file && /*#__PURE__*/ React.createElement(EditorLink, {
isSourceFile: true,
key: file.fileName,
file: file.fileName,
location: file.location
}), /*#__PURE__*/ React.createElement("pre", null, decoded.map((entry, index)=>/*#__PURE__*/ React.createElement("span", {
key: "terminal-entry-" + index,
style: {
color: entry.fg ? "var(--color-" + entry.fg + ")" : undefined,
...entry.decoration === "bold" ? {
fontWeight: 800
} : entry.decoration === "italic" ? {
fontStyle: "italic"
} : undefined
}
}, /*#__PURE__*/ React.createElement(HotlinkedText, {
text: entry.content
}))), importTraceFiles.map((importTraceFile)=>/*#__PURE__*/ React.createElement(EditorLink, {
isSourceFile: false,
key: importTraceFile,
file: importTraceFile
}))));
};
//# sourceMappingURL=Terminal.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Terminal/Terminal.tsx"],"names":["Anser","React","HotlinkedText","EditorLink","getFile","lines","contentFileName","shift","fileName","line","column","split","parsedLine","Number","parsedColumn","hasLocation","isNaN","location","undefined","getImportTraceFiles","some","test","files","length","includes","file","pop","trim","unshift","getEditorLinks","content","importTraceFiles","source","join","Terminal","useMemo","decoded","ansiToJson","json","use_classes","remove_empty","div","data-nextjs-terminal","isSourceFile","key","pre","map","entry","index","span","style","color","fg","decoration","fontWeight","fontStyle","text","importTraceFile"],"mappings":"AAAA,OAAOA,WAAW,2BAA0B;AAC5C,YAAYC,WAAW,QAAO;AAC9B,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,UAAU,QAAQ,eAAc;AAIzC,SAASC,QAAQC,KAAe;IAC9B,MAAMC,kBAAkBD,MAAME,KAAK;IACnC,IAAI,CAACD,iBAAiB,OAAO;IAC7B,MAAM,CAACE,UAAUC,MAAMC,OAAO,GAAGJ,gBAAgBK,KAAK,CAAC;IAEvD,MAAMC,aAAaC,OAAOJ;IAC1B,MAAMK,eAAeD,OAAOH;IAC5B,MAAMK,cAAc,CAACF,OAAOG,KAAK,CAACJ,eAAe,CAACC,OAAOG,KAAK,CAACF;IAE/D,OAAO;QACLN,UAAUO,cAAcP,WAAWF;QACnCW,UAAUF,cACN;YACEN,MAAMG;YACNF,QAAQI;QACV,IACAI;IACN;AACF;AAEA,SAASC,oBAAoBd,KAAe;IAC1C,IACEA,MAAMe,IAAI,CAAC,CAACX,OAAS,8BAA8BY,IAAI,CAACZ,UACxDJ,MAAMe,IAAI,CAAC,CAACX,OAAS,qCAAqCY,IAAI,CAACZ,QAC/D;QACA,iDAAiD;QACjD,MAAMa,QAAQ,EAAE;QAChB,MACE,SAASD,IAAI,CAAChB,KAAK,CAACA,MAAMkB,MAAM,GAAG,EAAE,KACrC,CAAClB,KAAK,CAACA,MAAMkB,MAAM,GAAG,EAAE,CAACC,QAAQ,CAAC,KAClC;YACA,MAAMC,OAAOpB,MAAMqB,GAAG,GAAIC,IAAI;YAC9BL,MAAMM,OAAO,CAACH;QAChB;QAEA,OAAOH;IACT;IAEA,OAAO,EAAE;AACX;AAEA,SAASO,eAAeC,OAAe;IACrC,MAAMzB,QAAQyB,QAAQnB,KAAK,CAAC;IAC5B,MAAMc,OAAOrB,QAAQC;IACrB,MAAM0B,mBAAmBZ,oBAAoBd;IAE7C,OAAO;QAAEoB;QAAMO,QAAQ3B,MAAM4B,IAAI,CAAC;QAAOF;IAAiB;AAC5D;AAEA,OAAO,MAAMG,WAAoC,SAASA,SAAS,KAElE;IAFkE,IAAA,EACjEJ,OAAO,EACR,GAFkE;IAGjE,MAAM,EAAEL,IAAI,EAAEO,MAAM,EAAED,gBAAgB,EAAE,GAAG9B,MAAMkC,OAAO,CACtD,IAAMN,eAAeC,UACrB;QAACA;KAAQ;IAGX,MAAMM,UAAUnC,MAAMkC,OAAO,CAAC;QAC5B,OAAOnC,MAAMqC,UAAU,CAACL,QAAQ;YAC9BM,MAAM;YACNC,aAAa;YACbC,cAAc;QAChB;IACF,GAAG;QAACR;KAAO;IAEX,qBACE,oBAACS;QAAIC,wBAAAA;OACFjB,sBACC,oBAACtB;QACCwC,cAAAA;QACAC,KAAKnB,KAAKjB,QAAQ;QAClBiB,MAAMA,KAAKjB,QAAQ;QACnBS,UAAUQ,KAAKR,QAAQ;sBAG3B,oBAAC4B,aACET,QAAQU,GAAG,CAAC,CAACC,OAAOC,sBACnB,oBAACC;YACCL,KAAK,AAAC,oBAAiBI;YACvBE,OAAO;gBACLC,OAAOJ,MAAMK,EAAE,GAAG,AAAC,iBAAcL,MAAMK,EAAE,GAAC,MAAKlC;gBAC/C,GAAI6B,MAAMM,UAAU,KAAK,SACrB;oBAAEC,YAAY;gBAAI,IAClBP,MAAMM,UAAU,KAAK,WACrB;oBAAEE,WAAW;gBAAS,IACtBrC,SAAS;YACf;yBAEA,oBAAChB;YAAcsD,MAAMT,MAAMjB,OAAO;cAGrCC,iBAAiBe,GAAG,CAAC,CAACW,gCACrB,oBAACtD;YACCwC,cAAc;YACdC,KAAKa;YACLhC,MAAMgC;;AAMlB,EAAC"}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Terminal/index.tsx"],"names":["Terminal"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,aAAY"}

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-terminal] {\n border-radius: var(--size-gap-half);\n background-color: var(--color-ansi-bg);\n color: var(--color-ansi-fg);\n }\n [data-nextjs-terminal]::selection,\n [data-nextjs-terminal] *::selection {\n background-color: var(--color-ansi-selection);\n }\n [data-nextjs-terminal] * {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n [data-nextjs-terminal] > * {\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\n [data-nextjs-terminal] pre {\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n [data-with-open-in-editor-link] svg {\n width: auto;\n height: var(--size-font-small);\n margin-left: var(--size-gap);\n }\n [data-with-open-in-editor-link] {\n cursor: pointer;\n }\n [data-with-open-in-editor-link]:hover {\n text-decoration: underline dotted;\n }\n [data-with-open-in-editor-link-source-file] {\n border-bottom: 1px solid var(--color-ansi-bright-black);\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n [data-with-open-in-editor-link-import-trace] {\n margin-left: var(--size-gap-double);\n }\n [data-nextjs-terminal] a {\n color: inherit;\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/Terminal/styles.tsx"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;AAmDf,SAASC,MAAM,GAAE"}

View File

@@ -0,0 +1,13 @@
import * as React from "react";
export const Toast = function Toast(param) {
let { onClick, children, className } = param;
return /*#__PURE__*/ React.createElement("div", {
"data-nextjs-toast": true,
onClick: onClick,
className: className
}, /*#__PURE__*/ React.createElement("div", {
"data-nextjs-toast-wrapper": true
}, children));
};
//# sourceMappingURL=Toast.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Toast/Toast.tsx"],"names":["React","Toast","onClick","children","className","div","data-nextjs-toast","data-nextjs-toast-wrapper"],"mappings":"AAAA,YAAYA,WAAW,QAAO;AAQ9B,OAAO,MAAMC,QAA8B,SAASA,MAAM,KAIzD;IAJyD,IAAA,EACxDC,OAAO,EACPC,QAAQ,EACRC,SAAS,EACV,GAJyD;IAKxD,qBACE,oBAACC;QAAIC,qBAAAA;QAAkBJ,SAASA;QAASE,WAAWA;qBAClD,oBAACC;QAAIE,6BAAAA;OAA2BJ;AAGtC,EAAC"}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Toast/index.tsx"],"names":["styles","Toast"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAU;AACjC,SAASC,KAAK,QAAQ,UAAS"}

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-toast] {\n position: fixed;\n bottom: var(--size-gap-double);\n left: var(--size-gap-double);\n max-width: 420px;\n z-index: 9000;\n }\n\n @media (max-width: 440px) {\n [data-nextjs-toast] {\n max-width: 90vw;\n left: 5vw;\n }\n }\n\n [data-nextjs-toast-wrapper] {\n padding: 16px;\n border-radius: var(--size-gap-half);\n font-weight: 500;\n color: var(--color-ansi-bright-white);\n background-color: var(--color-ansi-red);\n box-shadow: 0px var(--size-gap-double) var(--size-gap-quad)\n rgba(0, 0, 0, 0.25);\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/Toast/styles.ts"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;AA2Bf,SAASC,MAAM,GAAE"}

View File

@@ -0,0 +1,55 @@
import React from "react";
export function VersionStalenessInfo(props) {
if (!props) return null;
const { staleness, installed, expected } = props;
let text = "";
let title = "";
let indicatorClass = "";
switch(staleness){
case "fresh":
text = "Next.js is up to date";
title = "Latest available version is detected (" + installed + ").";
indicatorClass = "fresh";
break;
case "stale-patch":
case "stale-minor":
text = "Next.js (" + installed + ") out of date";
title = "There is a newer version (" + expected + ") available, upgrade recommended! ";
indicatorClass = "stale";
break;
case "stale-major":
{
text = "Next.js (" + installed + ") is outdated";
title = "An outdated version detected (latest is " + expected + "), upgrade is highly recommended!";
indicatorClass = "outdated";
break;
}
case "stale-prerelease":
{
text = "Next.js (" + installed + ") is outdated";
title = "There is a newer canary version (" + expected + ") available, please upgrade! ";
indicatorClass = "stale";
break;
}
case "newer-than-npm":
case "unknown":
break;
default:
break;
}
if (!text) return null;
return /*#__PURE__*/ React.createElement("small", {
className: "nextjs-container-build-error-version-status"
}, /*#__PURE__*/ React.createElement("span", {
className: indicatorClass
}), /*#__PURE__*/ React.createElement("small", {
className: "nextjs-container-build-error-version-status",
title: title
}, text), " ", staleness === "fresh" || staleness === "unknown" ? null : /*#__PURE__*/ React.createElement("a", {
target: "_blank",
rel: "noopener noreferrer",
href: "https://nextjs.org/docs/messages/version-staleness"
}, "(learn more)"));
}
//# sourceMappingURL=VersionStalenessInfo.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/VersionStalenessInfo/VersionStalenessInfo.tsx"],"names":["React","VersionStalenessInfo","props","staleness","installed","expected","text","title","indicatorClass","small","className","span","a","target","rel","href"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAGzB,OAAO,SAASC,qBAAqBC,KAAkB;IACrD,IAAI,CAACA,OAAO,OAAO;IACnB,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGH;IAC3C,IAAII,OAAO;IACX,IAAIC,QAAQ;IACZ,IAAIC,iBAAiB;IACrB,OAAQL;QACN,KAAK;YACHG,OAAO;YACPC,QAAQ,AAAC,2CAAwCH,YAAU;YAC3DI,iBAAiB;YACjB;QACF,KAAK;QACL,KAAK;YACHF,OAAO,AAAC,cAAWF,YAAU;YAC7BG,QAAQ,AAAC,+BAA4BF,WAAS;YAC9CG,iBAAiB;YACjB;QACF,KAAK;YAAe;gBAClBF,OAAO,AAAC,cAAWF,YAAU;gBAC7BG,QAAQ,AAAC,6CAA0CF,WAAS;gBAC5DG,iBAAiB;gBACjB;YACF;QACA,KAAK;YAAoB;gBACvBF,OAAO,AAAC,cAAWF,YAAU;gBAC7BG,QAAQ,AAAC,sCAAmCF,WAAS;gBACrDG,iBAAiB;gBACjB;YACF;QACA,KAAK;QACL,KAAK;YACH;QACF;YACE;IACJ;IAEA,IAAI,CAACF,MAAM,OAAO;IAElB,qBACE,oBAACG;QAAMC,WAAU;qBACf,oBAACC;QAAKD,WAAWF;sBACjB,oBAACC;QACCC,WAAU;QACVH,OAAOA;OAEND,OACM,KACRH,cAAc,WAAWA,cAAc,YAAY,qBAClD,oBAACS;QACCC,QAAO;QACPC,KAAI;QACJC,MAAK;OACN;AAMT"}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/VersionStalenessInfo/index.tsx"],"names":["styles","VersionStalenessInfo"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAU;AACjC,SAASC,oBAAoB,QAAQ,yBAAwB"}

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 .nextjs-container-build-error-version-status {\n flex: 1;\n text-align: right;\n }\n .nextjs-container-build-error-version-status small {\n margin-left: var(--size-gap);\n font-size: var(--size-font-small);\n }\n .nextjs-container-build-error-version-status a {\n font-size: var(--size-font-small);\n }\n .nextjs-container-build-error-version-status span {\n display: inline-block;\n width: 10px;\n height: 10px;\n border-radius: 5px;\n background: var(--color-ansi-bright-black);\n }\n .nextjs-container-build-error-version-status span.fresh {\n background: var(--color-ansi-green);\n }\n .nextjs-container-build-error-version-status span.stale {\n background: var(--color-ansi-yellow);\n }\n .nextjs-container-build-error-version-status span.outdated {\n background: var(--color-ansi-red);\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/VersionStalenessInfo/styles.ts"],"names":["noop","css","styles"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,MAAMC,SAASD;AA8Bf,SAASC,MAAM,GAAE"}

View File

@@ -0,0 +1,34 @@
// Returns true if the given character is a whitespace character, false otherwise.
function isWhitespace(char) {
return char === " " || char === "\n" || char === " " || char === "\r";
}
/**
* Get sequences of words and whitespaces from a string.
*
* e.g. "Hello world \n\n" -> ["Hello", " ", "world", " \n\n"]
*/ export function getWordsAndWhitespaces(text) {
const wordsAndWhitespaces = [];
let current = "";
let currentIsWhitespace = false;
for (const char of text){
if (current.length === 0) {
current += char;
currentIsWhitespace = isWhitespace(char);
continue;
}
const nextIsWhitespace = isWhitespace(char);
if (currentIsWhitespace === nextIsWhitespace) {
current += char;
} else {
wordsAndWhitespaces.push(current);
current = char;
currentIsWhitespace = nextIsWhitespace;
}
}
if (current.length > 0) {
wordsAndWhitespaces.push(current);
}
return wordsAndWhitespaces;
}
//# sourceMappingURL=get-words-and-whitespaces.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/hot-linked-text/get-words-and-whitespaces.ts"],"names":["isWhitespace","char","getWordsAndWhitespaces","text","wordsAndWhitespaces","current","currentIsWhitespace","length","nextIsWhitespace","push"],"mappings":"AAAA,kFAAkF;AAClF,SAASA,aAAaC,IAAY;IAChC,OAAOA,SAAS,OAAOA,SAAS,QAAQA,SAAS,OAAQA,SAAS;AACpE;AAEA;;;;CAIC,GACD,OAAO,SAASC,uBAAuBC,IAAY;IACjD,MAAMC,sBAAgC,EAAE;IAExC,IAAIC,UAAU;IACd,IAAIC,sBAAsB;IAC1B,KAAK,MAAML,QAAQE,KAAM;QACvB,IAAIE,QAAQE,MAAM,KAAK,GAAG;YACxBF,WAAWJ;YACXK,sBAAsBN,aAAaC;YACnC;QACF;QAEA,MAAMO,mBAAmBR,aAAaC;QACtC,IAAIK,wBAAwBE,kBAAkB;YAC5CH,WAAWJ;QACb,OAAO;YACLG,oBAAoBK,IAAI,CAACJ;YACzBA,UAAUJ;YACVK,sBAAsBE;QACxB;IACF;IAEA,IAAIH,QAAQE,MAAM,GAAG,GAAG;QACtBH,oBAAoBK,IAAI,CAACJ;IAC3B;IAEA,OAAOD;AACT"}

View File

@@ -0,0 +1,21 @@
import React from "react";
import { getWordsAndWhitespaces } from "./get-words-and-whitespaces";
const linkRegex = /https?:\/\/[^\s/$.?#].[^\s"]*/i;
export const HotlinkedText = function HotlinkedText(props) {
const { text } = props;
const wordsAndWhitespaces = getWordsAndWhitespaces(text);
return /*#__PURE__*/ React.createElement(React.Fragment, null, linkRegex.test(text) ? wordsAndWhitespaces.map((word, index)=>{
if (linkRegex.test(word)) {
return /*#__PURE__*/ React.createElement(React.Fragment, {
key: "link-" + index
}, /*#__PURE__*/ React.createElement("a", {
href: word
}, word));
}
return /*#__PURE__*/ React.createElement(React.Fragment, {
key: "text-" + index
}, word);
}) : text);
};
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/hot-linked-text/index.tsx"],"names":["React","getWordsAndWhitespaces","linkRegex","HotlinkedText","props","text","wordsAndWhitespaces","test","map","word","index","Fragment","key","a","href"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AACzB,SAASC,sBAAsB,QAAQ,8BAA6B;AAEpE,MAAMC,YAAY;AAElB,OAAO,MAAMC,gBAER,SAASA,cAAcC,KAAK;IAC/B,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjB,MAAME,sBAAsBL,uBAAuBI;IAEnD,qBACE,0CACGH,UAAUK,IAAI,CAACF,QACZC,oBAAoBE,GAAG,CAAC,CAACC,MAAMC;QAC7B,IAAIR,UAAUK,IAAI,CAACE,OAAO;YACxB,qBACE,oBAACT,MAAMW,QAAQ;gBAACC,KAAK,AAAC,UAAOF;6BAC3B,oBAACG;gBAAEC,MAAML;eAAOA;QAGtB;QACA,qBAAO,oBAACT,MAAMW,QAAQ;YAACC,KAAK,AAAC,UAAOF;WAAUD;IAChD,KACAJ;AAGV,EAAC"}

View File

@@ -0,0 +1,41 @@
import { _ as _tagged_template_literal_loose } from "@swc/helpers/_/_tagged_template_literal_loose";
function _templateObject() {
const data = _tagged_template_literal_loose([
"\n .nextjs-container-build-error-header {\n display: flex;\n align-items: center;\n }\n .nextjs-container-build-error-header > h4 {\n line-height: 1.5;\n margin: 0;\n padding: 0;\n }\n\n .nextjs-container-build-error-body footer {\n margin-top: var(--size-gap);\n }\n .nextjs-container-build-error-body footer p {\n margin: 0;\n }\n\n .nextjs-container-build-error-body small {\n color: #757575;\n }\n"
]);
_templateObject = function() {
return data;
};
return data;
}
import * as React from "react";
import { Dialog, DialogBody, DialogContent, DialogHeader } from "../components/Dialog";
import { Overlay } from "../components/Overlay";
import { Terminal } from "../components/Terminal";
import { VersionStalenessInfo } from "../components/VersionStalenessInfo";
import { noop as css } from "../helpers/noop-template";
export const BuildError = function BuildError(param) {
let { message, versionInfo } = param;
const noop = React.useCallback(()=>{}, []);
return /*#__PURE__*/ React.createElement(Overlay, {
fixed: true
}, /*#__PURE__*/ React.createElement(Dialog, {
type: "error",
"aria-labelledby": "nextjs__container_build_error_label",
"aria-describedby": "nextjs__container_build_error_desc",
onClose: noop
}, /*#__PURE__*/ React.createElement(DialogContent, null, /*#__PURE__*/ React.createElement(DialogHeader, {
className: "nextjs-container-build-error-header"
}, /*#__PURE__*/ React.createElement("h4", {
id: "nextjs__container_build_error_label"
}, "Failed to compile"), versionInfo ? /*#__PURE__*/ React.createElement(VersionStalenessInfo, versionInfo) : null), /*#__PURE__*/ React.createElement(DialogBody, {
className: "nextjs-container-build-error-body"
}, /*#__PURE__*/ React.createElement(Terminal, {
content: message
}), /*#__PURE__*/ React.createElement("footer", null, /*#__PURE__*/ React.createElement("p", {
id: "nextjs__container_build_error_desc"
}, /*#__PURE__*/ React.createElement("small", null, "This error occurred during the build process and can only be dismissed by fixing the error.")))))));
};
export const styles = css(_templateObject());
//# sourceMappingURL=BuildError.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/container/BuildError.tsx"],"names":["React","Dialog","DialogBody","DialogContent","DialogHeader","Overlay","Terminal","VersionStalenessInfo","noop","css","BuildError","message","versionInfo","useCallback","fixed","type","aria-labelledby","aria-describedby","onClose","className","h4","id","content","footer","p","small","styles"],"mappings":";;;;;;;;;;AAAA,YAAYA,WAAW,QAAO;AAE9B,SACEC,MAAM,EACNC,UAAU,EACVC,aAAa,EACbC,YAAY,QACP,uBAAsB;AAC7B,SAASC,OAAO,QAAQ,wBAAuB;AAC/C,SAASC,QAAQ,QAAQ,yBAAwB;AACjD,SAASC,oBAAoB,QAAQ,qCAAoC;AACzE,SAASC,QAAQC,GAAG,QAAQ,2BAA0B;AAItD,OAAO,MAAMC,aAAwC,SAASA,WAAW,KAGxE;IAHwE,IAAA,EACvEC,OAAO,EACPC,WAAW,EACZ,GAHwE;IAIvE,MAAMJ,OAAOR,MAAMa,WAAW,CAAC,KAAO,GAAG,EAAE;IAC3C,qBACE,oBAACR;QAAQS,OAAAA;qBACP,oBAACb;QACCc,MAAK;QACLC,mBAAgB;QAChBC,oBAAiB;QACjBC,SAASV;qBAET,oBAACL,mCACC,oBAACC;QAAae,WAAU;qBACtB,oBAACC;QAAGC,IAAG;OAAsC,sBAC5CT,4BAAc,oBAACL,sBAAyBK,eAAkB,qBAE7D,oBAACV;QAAWiB,WAAU;qBACpB,oBAACb;QAASgB,SAASX;sBACnB,oBAACY,8BACC,oBAACC;QAAEH,IAAG;qBACJ,oBAACI,eAAM;AAWvB,EAAC;AAED,OAAO,MAAMC,SAASjB,uBAqBrB"}

View File

@@ -0,0 +1,224 @@
import { _ as _tagged_template_literal_loose } from "@swc/helpers/_/_tagged_template_literal_loose";
function _templateObject() {
const data = _tagged_template_literal_loose([
"\n .nextjs-container-errors-header > h1 {\n font-size: var(--size-font-big);\n line-height: var(--size-font-bigger);\n font-weight: bold;\n margin: 0;\n margin-top: calc(var(--size-gap-double) + var(--size-gap-half));\n }\n .nextjs-container-errors-header small {\n font-size: var(--size-font-small);\n color: var(--color-accents-1);\n margin-left: var(--size-gap-double);\n }\n .nextjs-container-errors-header small > span {\n font-family: var(--font-stack-monospace);\n }\n .nextjs-container-errors-header > p {\n font-family: var(--font-stack-monospace);\n font-size: var(--size-font-small);\n line-height: var(--size-font-big);\n font-weight: bold;\n margin: 0;\n margin-top: var(--size-gap-half);\n color: var(--color-ansi-red);\n white-space: pre-wrap;\n }\n .nextjs-container-errors-header > div > small {\n margin: 0;\n margin-top: var(--size-gap-half);\n }\n .nextjs-container-errors-header > p > a {\n color: var(--color-ansi-red);\n }\n\n .nextjs-container-errors-body > h2:not(:first-child) {\n margin-top: calc(var(--size-gap-double) + var(--size-gap));\n }\n .nextjs-container-errors-body > h2 {\n margin-bottom: var(--size-gap);\n font-size: var(--size-font-big);\n }\n\n .nextjs-toast-errors-parent {\n cursor: pointer;\n transition: transform 0.2s ease;\n }\n .nextjs-toast-errors-parent:hover {\n transform: scale(1.1);\n }\n .nextjs-toast-errors {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n }\n .nextjs-toast-errors > svg {\n margin-right: var(--size-gap);\n }\n .nextjs-toast-errors-hide-button {\n margin-left: var(--size-gap-triple);\n border: none;\n background: none;\n color: var(--color-ansi-bright-white);\n padding: 0;\n transition: opacity 0.25s ease;\n opacity: 0.7;\n }\n .nextjs-toast-errors-hide-button:hover {\n opacity: 1;\n }\n"
]);
_templateObject = function() {
return data;
};
return data;
}
import * as React from "react";
import { ACTION_UNHANDLED_ERROR, ACTION_UNHANDLED_REJECTION } from "../error-overlay-reducer";
import { Dialog, DialogBody, DialogContent, DialogHeader } from "../components/Dialog";
import { LeftRightDialogHeader } from "../components/LeftRightDialogHeader";
import { Overlay } from "../components/Overlay";
import { Toast } from "../components/Toast";
import { getErrorByType } from "../helpers/getErrorByType";
import { getErrorSource } from "../helpers/nodeStackFrames";
import { noop as css } from "../helpers/noop-template";
import { CloseIcon } from "../icons/CloseIcon";
import { RuntimeError } from "./RuntimeError";
import { VersionStalenessInfo } from "../components/VersionStalenessInfo";
import { HotlinkedText } from "../components/hot-linked-text";
function getErrorSignature(ev) {
const { event } = ev;
switch(event.type){
case ACTION_UNHANDLED_ERROR:
case ACTION_UNHANDLED_REJECTION:
{
return event.reason.name + "::" + event.reason.message + "::" + event.reason.stack;
}
default:
{}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ = event;
return "";
}
export const Errors = function Errors(param) {
let { errors, initialDisplayState, versionInfo } = param;
const [lookups, setLookups] = React.useState({});
const [readyErrors, nextError] = React.useMemo(()=>{
let ready = [];
let next = null;
// Ensure errors are displayed in the order they occurred in:
for(let idx = 0; idx < errors.length; ++idx){
const e = errors[idx];
const { id } = e;
if (id in lookups) {
ready.push(lookups[id]);
continue;
}
// Check for duplicate errors
if (idx > 0) {
const prev = errors[idx - 1];
if (getErrorSignature(prev) === getErrorSignature(e)) {
continue;
}
}
next = e;
break;
}
return [
ready,
next
];
}, [
errors,
lookups
]);
const isLoading = React.useMemo(()=>{
return readyErrors.length < 1 && Boolean(errors.length);
}, [
errors.length,
readyErrors.length
]);
React.useEffect(()=>{
if (nextError == null) {
return;
}
let mounted = true;
getErrorByType(nextError).then((resolved)=>{
// We don't care if the desired error changed while we were resolving,
// thus we're not tracking it using a ref. Once the work has been done,
// we'll store it.
if (mounted) {
setLookups((m)=>({
...m,
[resolved.id]: resolved
}));
}
}, ()=>{
// TODO: handle this, though an edge case
});
return ()=>{
mounted = false;
};
}, [
nextError
]);
const [displayState, setDisplayState] = React.useState(initialDisplayState);
const [activeIdx, setActiveIndex] = React.useState(0);
const previous = React.useCallback((e)=>{
e == null ? void 0 : e.preventDefault();
setActiveIndex((v)=>Math.max(0, v - 1));
}, []);
const next = React.useCallback((e)=>{
e == null ? void 0 : e.preventDefault();
setActiveIndex((v)=>Math.max(0, Math.min(readyErrors.length - 1, v + 1)));
}, [
readyErrors.length
]);
var _readyErrors_activeIdx;
const activeError = React.useMemo(()=>(_readyErrors_activeIdx = readyErrors[activeIdx]) != null ? _readyErrors_activeIdx : null, [
activeIdx,
readyErrors
]);
// Reset component state when there are no errors to be displayed.
// This should never happen, but lets handle it.
React.useEffect(()=>{
if (errors.length < 1) {
setLookups({});
setDisplayState("hidden");
setActiveIndex(0);
}
}, [
errors.length
]);
const minimize = React.useCallback((e)=>{
e == null ? void 0 : e.preventDefault();
setDisplayState("minimized");
}, []);
const hide = React.useCallback((e)=>{
e == null ? void 0 : e.preventDefault();
setDisplayState("hidden");
}, []);
const fullscreen = React.useCallback((e)=>{
e == null ? void 0 : e.preventDefault();
setDisplayState("fullscreen");
}, []);
// This component shouldn't be rendered with no errors, but if it is, let's
// handle it gracefully by rendering nothing.
if (errors.length < 1 || activeError == null) {
return null;
}
if (isLoading) {
// TODO: better loading state
return /*#__PURE__*/ React.createElement(Overlay, null);
}
if (displayState === "hidden") {
return null;
}
if (displayState === "minimized") {
return /*#__PURE__*/ React.createElement(Toast, {
className: "nextjs-toast-errors-parent",
onClick: fullscreen
}, /*#__PURE__*/ React.createElement("div", {
className: "nextjs-toast-errors"
}, /*#__PURE__*/ React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
width: "24",
height: "24",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}, /*#__PURE__*/ React.createElement("circle", {
cx: "12",
cy: "12",
r: "10"
}), /*#__PURE__*/ React.createElement("line", {
x1: "12",
y1: "8",
x2: "12",
y2: "12"
}), /*#__PURE__*/ React.createElement("line", {
x1: "12",
y1: "16",
x2: "12.01",
y2: "16"
})), /*#__PURE__*/ React.createElement("span", null, readyErrors.length, " error", readyErrors.length > 1 ? "s" : ""), /*#__PURE__*/ React.createElement("button", {
"data-nextjs-toast-errors-hide-button": true,
className: "nextjs-toast-errors-hide-button",
type: "button",
onClick: (e)=>{
e.stopPropagation();
hide();
},
"aria-label": "Hide Errors"
}, /*#__PURE__*/ React.createElement(CloseIcon, null))));
}
const isServerError = [
"server",
"edge-server"
].includes(getErrorSource(activeError.error) || "");
return /*#__PURE__*/ React.createElement(Overlay, null, /*#__PURE__*/ React.createElement(Dialog, {
type: "error",
"aria-labelledby": "nextjs__container_errors_label",
"aria-describedby": "nextjs__container_errors_desc",
onClose: isServerError ? undefined : minimize
}, /*#__PURE__*/ React.createElement(DialogContent, null, /*#__PURE__*/ React.createElement(DialogHeader, {
className: "nextjs-container-errors-header"
}, /*#__PURE__*/ React.createElement(LeftRightDialogHeader, {
previous: activeIdx > 0 ? previous : null,
next: activeIdx < readyErrors.length - 1 ? next : null,
close: isServerError ? undefined : minimize
}, /*#__PURE__*/ React.createElement("small", null, /*#__PURE__*/ React.createElement("span", null, activeIdx + 1), " of", " ", /*#__PURE__*/ React.createElement("span", null, readyErrors.length), " unhandled error", readyErrors.length < 2 ? "" : "s"), versionInfo ? /*#__PURE__*/ React.createElement(VersionStalenessInfo, versionInfo) : null), /*#__PURE__*/ React.createElement("h1", {
id: "nextjs__container_errors_label"
}, isServerError ? "Server Error" : "Unhandled Runtime Error"), /*#__PURE__*/ React.createElement("p", {
id: "nextjs__container_errors_desc"
}, activeError.error.name, ":", " ", /*#__PURE__*/ React.createElement(HotlinkedText, {
text: activeError.error.message
})), isServerError ? /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("small", null, "This error happened while generating the page. Any console logs will be displayed in the terminal window.")) : undefined), /*#__PURE__*/ React.createElement(DialogBody, {
className: "nextjs-container-errors-body"
}, /*#__PURE__*/ React.createElement(RuntimeError, {
key: activeError.id.toString(),
error: activeError
})))));
};
export const styles = css(_templateObject());
//# sourceMappingURL=Errors.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,41 @@
import { _ as _tagged_template_literal_loose } from "@swc/helpers/_/_tagged_template_literal_loose";
function _templateObject() {
const data = _tagged_template_literal_loose([
"\n .nextjs-container-root-layout-error-header > h4 {\n line-height: 1.5;\n margin: 0;\n padding: 0;\n }\n\n .nextjs-container-root-layout-error-body footer {\n margin-top: var(--size-gap);\n }\n .nextjs-container-root-layout-error-body footer p {\n margin: 0;\n }\n\n .nextjs-container-root-layout-error-body small {\n color: #757575;\n }\n"
]);
_templateObject = function() {
return data;
};
return data;
}
import React from "react";
import { Dialog, DialogBody, DialogContent, DialogHeader } from "../components/Dialog";
import { Overlay } from "../components/Overlay";
import { Terminal } from "../components/Terminal";
import { noop as css } from "../helpers/noop-template";
export const RootLayoutError = function BuildError(param) {
let { missingTags } = param;
const message = "Please make sure to include the following tags in your root layout: <html>, <body>.\n\n" + ("Missing required root layout tag" + (missingTags.length === 1 ? "" : "s") + ": ") + missingTags.join(", ");
const noop = React.useCallback(()=>{}, []);
return /*#__PURE__*/ React.createElement(Overlay, {
fixed: true
}, /*#__PURE__*/ React.createElement(Dialog, {
type: "error",
"aria-labelledby": "nextjs__container_root_layout_error_label",
"aria-describedby": "nextjs__container_root_layout_error_desc",
onClose: noop
}, /*#__PURE__*/ React.createElement(DialogContent, null, /*#__PURE__*/ React.createElement(DialogHeader, {
className: "nextjs-container-root-layout-error-header"
}, /*#__PURE__*/ React.createElement("h4", {
id: "nextjs__container_root_layout_error_label"
}, "Missing required tags")), /*#__PURE__*/ React.createElement(DialogBody, {
className: "nextjs-container-root-layout-error-body"
}, /*#__PURE__*/ React.createElement(Terminal, {
content: message
}), /*#__PURE__*/ React.createElement("footer", null, /*#__PURE__*/ React.createElement("p", {
id: "nextjs__container_root_layout_error_desc"
}, /*#__PURE__*/ React.createElement("small", null, "This error and can only be dismissed by providing all required tags.")))))));
};
export const styles = css(_templateObject());
//# sourceMappingURL=RootLayoutError.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/container/RootLayoutError.tsx"],"names":["React","Dialog","DialogBody","DialogContent","DialogHeader","Overlay","Terminal","noop","css","RootLayoutError","BuildError","missingTags","message","length","join","useCallback","fixed","type","aria-labelledby","aria-describedby","onClose","className","h4","id","content","footer","p","small","styles"],"mappings":";;;;;;;;;;AAAA,OAAOA,WAAW,QAAO;AACzB,SACEC,MAAM,EACNC,UAAU,EACVC,aAAa,EACbC,YAAY,QACP,uBAAsB;AAC7B,SAASC,OAAO,QAAQ,wBAAuB;AAC/C,SAASC,QAAQ,QAAQ,yBAAwB;AACjD,SAASC,QAAQC,GAAG,QAAQ,2BAA0B;AAItD,OAAO,MAAMC,kBACX,SAASC,WAAW,KAAe;IAAf,IAAA,EAAEC,WAAW,EAAE,GAAf;IAClB,MAAMC,UACJ,4FACA,CAAA,AAAC,qCACCD,CAAAA,YAAYE,MAAM,KAAK,IAAI,KAAK,GAAE,IACnC,IAAE,IACHF,YAAYG,IAAI,CAAC;IAEnB,MAAMP,OAAOP,MAAMe,WAAW,CAAC,KAAO,GAAG,EAAE;IAC3C,qBACE,oBAACV;QAAQW,OAAAA;qBACP,oBAACf;QACCgB,MAAK;QACLC,mBAAgB;QAChBC,oBAAiB;QACjBC,SAASb;qBAET,oBAACJ,mCACC,oBAACC;QAAaiB,WAAU;qBACtB,oBAACC;QAAGC,IAAG;OAA4C,yCAIrD,oBAACrB;QAAWmB,WAAU;qBACpB,oBAACf;QAASkB,SAASZ;sBACnB,oBAACa,8BACC,oBAACC;QAAEH,IAAG;qBACJ,oBAACI,eAAM;AAWvB,EAAC;AAEH,OAAO,MAAMC,SAASpB,uBAiBrB"}

View File

@@ -0,0 +1,46 @@
import React from "react";
import { getFrameSource } from "../../helpers/stack-frame";
import { useOpenInEditor } from "../../helpers/use-open-in-editor";
export const CallStackFrame = function CallStackFrame(param) {
let { frame } = param;
var _frame_originalStackFrame;
// TODO: ability to expand resolved frames
// TODO: render error or external indicator
const f = (_frame_originalStackFrame = frame.originalStackFrame) != null ? _frame_originalStackFrame : frame.sourceStackFrame;
const hasSource = Boolean(frame.originalCodeFrame);
const open = useOpenInEditor(hasSource ? {
file: f.file,
lineNumber: f.lineNumber,
column: f.column
} : undefined);
return /*#__PURE__*/ React.createElement("div", {
"data-nextjs-call-stack-frame": true
}, /*#__PURE__*/ React.createElement("h3", {
"data-nextjs-frame-expanded": Boolean(frame.expanded)
}, f.methodName), /*#__PURE__*/ React.createElement("div", {
"data-has-source": hasSource ? "true" : undefined,
tabIndex: hasSource ? 10 : undefined,
role: hasSource ? "link" : undefined,
onClick: open,
title: hasSource ? "Click to open in your editor" : undefined
}, /*#__PURE__*/ React.createElement("span", null, getFrameSource(f)), /*#__PURE__*/ React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}, /*#__PURE__*/ React.createElement("path", {
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
}), /*#__PURE__*/ React.createElement("polyline", {
points: "15 3 21 3 21 9"
}), /*#__PURE__*/ React.createElement("line", {
x1: "10",
y1: "14",
x2: "21",
y2: "3"
}))));
};
//# sourceMappingURL=CallStackFrame.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/CallStackFrame.tsx"],"names":["React","getFrameSource","useOpenInEditor","CallStackFrame","frame","f","originalStackFrame","sourceStackFrame","hasSource","Boolean","originalCodeFrame","open","file","lineNumber","column","undefined","div","data-nextjs-call-stack-frame","h3","data-nextjs-frame-expanded","expanded","methodName","data-has-source","tabIndex","role","onClick","title","span","svg","xmlns","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","path","d","polyline","points","line","x1","y1","x2","y2"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAEzB,SACEC,cAAc,QAET,4BAA2B;AAClC,SAASC,eAAe,QAAQ,mCAAkC;AAElE,OAAO,MAAMC,iBAER,SAASA,eAAe,KAAS;IAAT,IAAA,EAAEC,KAAK,EAAE,GAAT;QAILA;IAHtB,0CAA0C;IAC1C,2CAA2C;IAE3C,MAAMC,IAAgBD,CAAAA,4BAAAA,MAAME,kBAAkB,YAAxBF,4BAA4BA,MAAMG,gBAAgB;IACxE,MAAMC,YAAYC,QAAQL,MAAMM,iBAAiB;IACjD,MAAMC,OAAOT,gBACXM,YACI;QACEI,MAAMP,EAAEO,IAAI;QACZC,YAAYR,EAAEQ,UAAU;QACxBC,QAAQT,EAAES,MAAM;IAClB,IACAC;IAGN,qBACE,oBAACC;QAAIC,gCAAAA;qBACH,oBAACC;QAAGC,8BAA4BV,QAAQL,MAAMgB,QAAQ;OACnDf,EAAEgB,UAAU,iBAEf,oBAACL;QACCM,mBAAiBd,YAAY,SAASO;QACtCQ,UAAUf,YAAY,KAAKO;QAC3BS,MAAMhB,YAAY,SAASO;QAC3BU,SAASd;QACTe,OAAOlB,YAAY,iCAAiCO;qBAEpD,oBAACY,cAAM1B,eAAeI,mBACtB,oBAACuB;QACCC,OAAM;QACNC,SAAQ;QACRC,MAAK;QACLC,QAAO;QACPC,aAAY;QACZC,eAAc;QACdC,gBAAe;qBAEf,oBAACC;QAAKC,GAAE;sBACR,oBAACC;QAASC,QAAO;sBACjB,oBAACC;QAAKC,IAAG;QAAKC,IAAG;QAAKC,IAAG;QAAKC,IAAG;;AAK3C,EAAC"}

View File

@@ -0,0 +1,37 @@
import React from "react";
import { useOpenInEditor } from "../../helpers/use-open-in-editor";
export function ComponentStackFrameRow(param) {
let { componentStackFrame: { component, file, lineNumber, column } } = param;
const open = useOpenInEditor({
file,
column,
lineNumber
});
return /*#__PURE__*/ React.createElement("div", {
"data-nextjs-component-stack-frame": true
}, /*#__PURE__*/ React.createElement("h3", null, component), file ? /*#__PURE__*/ React.createElement("div", {
tabIndex: 10,
role: "link",
onClick: open,
title: "Click to open in your editor"
}, /*#__PURE__*/ React.createElement("span", null, file, " (", lineNumber, ":", column, ")"), /*#__PURE__*/ React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}, /*#__PURE__*/ React.createElement("path", {
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
}), /*#__PURE__*/ React.createElement("polyline", {
points: "15 3 21 3 21 9"
}), /*#__PURE__*/ React.createElement("line", {
x1: "10",
y1: "14",
x2: "21",
y2: "3"
}))) : null);
}
//# sourceMappingURL=ComponentStackFrameRow.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/ComponentStackFrameRow.tsx"],"names":["React","useOpenInEditor","ComponentStackFrameRow","componentStackFrame","component","file","lineNumber","column","open","div","data-nextjs-component-stack-frame","h3","tabIndex","role","onClick","title","span","svg","xmlns","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","path","d","polyline","points","line","x1","y1","x2","y2"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAEzB,SAASC,eAAe,QAAQ,mCAAkC;AAElE,OAAO,SAASC,uBAAuB,KAItC;IAJsC,IAAA,EACrCC,qBAAqB,EAAEC,SAAS,EAAEC,IAAI,EAAEC,UAAU,EAAEC,MAAM,EAAE,EAG7D,GAJsC;IAKrC,MAAMC,OAAOP,gBAAgB;QAC3BI;QACAE;QACAD;IACF;IAEA,qBACE,oBAACG;QAAIC,qCAAAA;qBACH,oBAACC,YAAIP,YACJC,qBACC,oBAACI;QACCG,UAAU;QACVC,MAAM;QACNC,SAASN;QACTO,OAAO;qBAEP,oBAACC,cACEX,MAAK,MAAGC,YAAW,KAAEC,QAAO,oBAE/B,oBAACU;QACCC,OAAM;QACNC,SAAQ;QACRC,MAAK;QACLC,QAAO;QACPC,aAAY;QACZC,eAAc;QACdC,gBAAe;qBAEf,oBAACC;QAAKC,GAAE;sBACR,oBAACC;QAASC,QAAO;sBACjB,oBAACC;QAAKC,IAAG;QAAKC,IAAG;QAAKC,IAAG;QAAKC,IAAG;WAGnC;AAGV"}

View File

@@ -0,0 +1,91 @@
import React from "react";
export function FrameworkIcon(param) {
let { framework } = param;
if (framework === "react") {
return /*#__PURE__*/ React.createElement("svg", {
"data-nextjs-call-stack-framework-icon": "react",
xmlns: "http://www.w3.org/2000/svg",
width: "20",
height: "20",
viewBox: "0 0 410 369",
fill: "none",
shapeRendering: "geometricPrecision",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "5"
}, /*#__PURE__*/ React.createElement("path", {
d: "M204.995 224.552C226.56 224.552 244.042 207.07 244.042 185.506C244.042 163.941 226.56 146.459 204.995 146.459C183.43 146.459 165.948 163.941 165.948 185.506C165.948 207.07 183.43 224.552 204.995 224.552Z",
fill: "currentColor"
}), /*#__PURE__*/ React.createElement("path", {
d: "M409.99 184.505C409.99 153.707 381.437 126.667 335.996 108.925C343.342 60.6535 334.19 22.3878 307.492 6.98883C283.649 -6.77511 250.631 -0.0395641 214.512 25.9753C211.316 28.2692 208.143 30.7097 204.97 33.2477C201.822 30.7097 198.65 28.2692 195.477 25.9753C159.359 -0.0395641 126.34 -6.79951 102.497 6.98883C75.8237 22.3878 66.6721 60.6291 74.0422 108.852C28.5529 126.618 0 153.682 0 184.505C0 215.303 28.5528 242.342 73.9934 260.084C66.6477 308.356 75.7993 346.621 102.497 362.02C110.575 366.682 119.727 369 129.684 369C149.085 369 171.61 360.215 195.477 343.034C198.674 340.74 201.847 338.3 205.019 335.762C208.167 338.3 211.34 340.74 214.512 343.034C238.38 360.239 260.905 369 280.306 369C290.263 369 299.415 366.682 307.492 362.02C331.335 348.256 342 316.287 337.534 271.993C337.143 268.089 336.631 264.135 335.996 260.109C381.461 242.367 409.99 215.327 409.99 184.505ZM225.934 41.8136C246.238 27.1955 265.127 19.5814 280.306 19.5814C286.871 19.5814 292.728 20.9968 297.731 23.8765C315.204 33.9798 322.672 62.9475 317.327 102.433C299.756 97.0401 280.306 92.9158 259.392 90.2802C246.872 73.8074 233.597 58.9453 220.003 46.2551C221.98 44.7421 223.957 43.229 225.934 41.8136ZM112.259 23.8765C117.262 20.9968 123.119 19.5814 129.684 19.5814C144.863 19.5814 163.752 27.1711 184.056 41.8136C186.033 43.229 188.01 44.7176 189.986 46.2551C176.393 58.9453 163.142 73.783 150.622 90.2558C129.732 92.8914 110.258 97.0401 92.687 102.409C87.3424 62.9475 94.7857 33.9798 112.259 23.8765ZM19.5233 184.505C19.5233 164.322 40.9014 143.359 77.776 128.253C81.9003 146.141 88.0502 165.054 96.1768 184.456C88.0014 203.881 81.8515 222.819 77.7272 240.732C40.9014 225.626 19.5233 204.687 19.5233 184.505ZM184.056 327.196C154.966 348.134 128.805 354.675 112.259 345.133C94.7857 335.029 87.3181 306.062 92.6626 266.576C110.234 271.969 129.684 276.093 150.598 278.729C163.117 295.202 176.393 310.064 189.986 322.754C188.01 324.292 186.033 325.78 184.056 327.196ZM204.995 310.04C180.591 287.685 157.138 257.815 137.347 223.551C132.051 214.4 121.344 191.396 117 182.489C113.535 190.786 110.112 198.398 107.427 206.5C109.623 210.575 118.092 229.213 120.434 233.288C125.071 241.317 129.928 249.127 134.931 256.692C120.898 254.227 107.915 251.055 96.1035 247.321C102.815 217.011 116.213 182.064 137.347 145.458C142.545 136.453 153.838 116.346 159.5 108C150.568 109.147 143.395 108.767 135 110.5C132.56 114.453 122.777 131.645 120.434 135.721C115.749 143.823 111.454 151.925 107.427 159.978C102.546 146.581 98.8124 133.744 96.1524 121.64C125.755 112.293 162.727 106.411 204.995 106.411C215.562 106.411 237.63 106.197 247.49 106.905C242.048 99.7544 237.38 93.2819 231.694 86.888C227.082 86.7416 209.705 86.888 204.995 86.888C195.672 86.888 186.545 87.2053 177.589 87.7422C186.472 77.1752 195.672 67.5111 204.995 58.9697C229.375 81.3239 252.851 111.195 272.643 145.458C277.841 154.463 289.073 175.426 293.49 184.505C296.98 176.207 300.281 168.64 302.99 160.489C300.793 156.389 291.898 139.747 289.555 135.696C284.918 127.667 280.062 119.858 275.059 112.317C289.092 114.782 302.075 117.954 313.886 121.688C307.175 151.998 293.777 186.945 272.643 223.551C267.445 232.556 252.651 253.178 246.99 261.524C255.922 260.377 265.595 258.663 273.99 256.93C276.43 252.976 287.212 237.364 289.555 233.288C294.216 225.235 298.512 217.182 302.489 209.153C307.224 222.185 310.982 234.997 313.715 247.394C284.138 256.741 247.214 262.598 204.995 262.598C194.428 262.598 169.859 261.208 160 260.5C165.442 267.65 171.304 275.095 176.99 281.489C181.602 281.635 200.285 282.121 204.995 282.121C214.317 282.121 223.444 281.804 232.401 281.267C223.493 291.834 214.317 301.498 204.995 310.04ZM297.731 345.133C281.185 354.699 254.999 348.159 225.934 327.196C223.957 325.78 221.98 324.292 220.003 322.754C233.597 310.064 246.848 295.226 259.367 278.753C280.233 276.118 299.659 271.993 317.205 266.625C317.547 269.089 317.888 271.554 318.132 273.97C321.72 309.649 314.277 335.566 297.731 345.133ZM332.262 240.756C328.065 222.599 321.842 203.686 313.813 184.578C321.988 165.152 328.138 146.215 332.262 128.302C369.088 143.408 390.466 164.322 390.466 184.505C390.466 204.687 369.113 225.626 332.262 240.756Z",
fill: "currentColor"
}));
}
return /*#__PURE__*/ React.createElement("svg", {
"data-nextjs-call-stack-framework-icon": "next",
xmlns: "http://www.w3.org/2000/svg",
width: "20",
height: "20",
viewBox: "0 0 180 180",
fill: "none"
}, /*#__PURE__*/ React.createElement("mask", {
id: "mask0_408_139",
maskUnits: "userSpaceOnUse",
x: "0",
y: "0",
width: "180",
height: "180"
}, /*#__PURE__*/ React.createElement("circle", {
cx: "90",
cy: "90",
r: "90",
fill: "black"
})), /*#__PURE__*/ React.createElement("g", {
mask: "url(#mask0_408_139)"
}, /*#__PURE__*/ React.createElement("circle", {
cx: "90",
cy: "90",
r: "87",
fill: "black",
stroke: "white",
strokeWidth: "6"
}), /*#__PURE__*/ React.createElement("path", {
d: "M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z",
fill: "url(#paint0_linear_408_139)"
}), /*#__PURE__*/ React.createElement("rect", {
x: "115",
y: "54",
width: "12",
height: "72",
fill: "url(#paint1_linear_408_139)"
})), /*#__PURE__*/ React.createElement("defs", null, /*#__PURE__*/ React.createElement("linearGradient", {
id: "paint0_linear_408_139",
x1: "109",
y1: "116.5",
x2: "144.5",
y2: "160.5",
gradientUnits: "userSpaceOnUse"
}, /*#__PURE__*/ React.createElement("stop", {
stopColor: "white"
}), /*#__PURE__*/ React.createElement("stop", {
offset: "1",
stopColor: "white",
stopOpacity: "0"
})), /*#__PURE__*/ React.createElement("linearGradient", {
id: "paint1_linear_408_139",
x1: "121",
y1: "54",
x2: "120.799",
y2: "106.875",
gradientUnits: "userSpaceOnUse"
}, /*#__PURE__*/ React.createElement("stop", {
stopColor: "white"
}), /*#__PURE__*/ React.createElement("stop", {
offset: "1",
stopColor: "white",
stopOpacity: "0"
}))));
}
//# sourceMappingURL=FrameworkIcon.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/FrameworkIcon.tsx"],"names":["React","FrameworkIcon","framework","svg","data-nextjs-call-stack-framework-icon","xmlns","width","height","viewBox","fill","shapeRendering","stroke","strokeLinecap","strokeLinejoin","strokeWidth","path","d","mask","id","maskUnits","x","y","circle","cx","cy","r","g","rect","defs","linearGradient","x1","y1","x2","y2","gradientUnits","stop","stopColor","offset","stopOpacity"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAGzB,OAAO,SAASC,cAAc,KAI7B;IAJ6B,IAAA,EAC5BC,SAAS,EAGV,GAJ6B;IAK5B,IAAIA,cAAc,SAAS;QACzB,qBACE,oBAACC;YACCC,yCAAsC;YACtCC,OAAM;YACNC,OAAM;YACNC,QAAO;YACPC,SAAQ;YACRC,MAAK;YACLC,gBAAe;YACfC,QAAO;YACPC,eAAc;YACdC,gBAAe;YACfC,aAAY;yBAEZ,oBAACC;YACCC,GAAE;YACFP,MAAK;0BAEP,oBAACM;YACCC,GAAE;YACFP,MAAK;;IAIb;IAEA,qBACE,oBAACN;QACCC,yCAAsC;QACtCC,OAAM;QACNC,OAAM;QACNC,QAAO;QACPC,SAAQ;QACRC,MAAK;qBAEL,oBAACQ;QACCC,IAAG;QACHC,WAAU;QACVC,GAAE;QACFC,GAAE;QACFf,OAAM;QACNC,QAAO;qBAEP,oBAACe;QAAOC,IAAG;QAAKC,IAAG;QAAKC,GAAE;QAAKhB,MAAK;uBAEtC,oBAACiB;QAAET,MAAK;qBACN,oBAACK;QACCC,IAAG;QACHC,IAAG;QACHC,GAAE;QACFhB,MAAK;QACLE,QAAO;QACPG,aAAY;sBAEd,oBAACC;QACCC,GAAE;QACFP,MAAK;sBAEP,oBAACkB;QACCP,GAAE;QACFC,GAAE;QACFf,OAAM;QACNC,QAAO;QACPE,MAAK;uBAGT,oBAACmB,4BACC,oBAACC;QACCX,IAAG;QACHY,IAAG;QACHC,IAAG;QACHC,IAAG;QACHC,IAAG;QACHC,eAAc;qBAEd,oBAACC;QAAKC,WAAU;sBAChB,oBAACD;QAAKE,QAAO;QAAID,WAAU;QAAQE,aAAY;uBAEjD,oBAACT;QACCX,IAAG;QACHY,IAAG;QACHC,IAAG;QACHC,IAAG;QACHC,IAAG;QACHC,eAAc;qBAEd,oBAACC;QAAKC,WAAU;sBAChB,oBAACD;QAAKE,QAAO;QAAID,WAAU;QAAQE,aAAY;;AAKzD"}

View File

@@ -0,0 +1,50 @@
import React from "react";
import { CallStackFrame } from "./CallStackFrame";
import { FrameworkIcon } from "./FrameworkIcon";
function FrameworkGroup(param) {
let { framework, stackFrames, all } = param;
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("details", {
"data-nextjs-collapsed-call-stack-details": true
}, /*#__PURE__*/ React.createElement("summary", {
tabIndex: 10
}, /*#__PURE__*/ React.createElement("svg", {
"data-nextjs-call-stack-chevron-icon": true,
fill: "none",
height: "20",
width: "20",
shapeRendering: "geometricPrecision",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "2",
viewBox: "0 0 24 24"
}, /*#__PURE__*/ React.createElement("path", {
d: "M9 18l6-6-6-6"
})), /*#__PURE__*/ React.createElement(FrameworkIcon, {
framework: framework
}), framework === "react" ? "React" : "Next.js"), stackFrames.map((frame, index)=>/*#__PURE__*/ React.createElement(CallStackFrame, {
key: "call-stack-" + index + "-" + all,
frame: frame
}))));
}
export function GroupedStackFrames(param) {
let { groupedStackFrames, all } = param;
return /*#__PURE__*/ React.createElement(React.Fragment, null, groupedStackFrames.map((stackFramesGroup, groupIndex)=>{
// Collapse React and Next.js frames
if (stackFramesGroup.framework) {
return /*#__PURE__*/ React.createElement(FrameworkGroup, {
key: "call-stack-framework-group-" + groupIndex + "-" + all,
framework: stackFramesGroup.framework,
stackFrames: stackFramesGroup.stackFrames,
all: all
});
}
return(// Don't group non React and Next.js frames
stackFramesGroup.stackFrames.map((frame, frameIndex)=>/*#__PURE__*/ React.createElement(CallStackFrame, {
key: "call-stack-" + groupIndex + "-" + frameIndex + "-" + all,
frame: frame
})));
}));
}
//# sourceMappingURL=GroupedStackFrames.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/GroupedStackFrames.tsx"],"names":["React","CallStackFrame","FrameworkIcon","FrameworkGroup","framework","stackFrames","all","details","data-nextjs-collapsed-call-stack-details","summary","tabIndex","svg","data-nextjs-call-stack-chevron-icon","fill","height","width","shapeRendering","stroke","strokeLinecap","strokeLinejoin","strokeWidth","viewBox","path","d","map","frame","index","key","GroupedStackFrames","groupedStackFrames","stackFramesGroup","groupIndex","frameIndex"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAEzB,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SAASC,aAAa,QAAQ,kBAAiB;AAE/C,SAASC,eAAe,KAQvB;IARuB,IAAA,EACtBC,SAAS,EACTC,WAAW,EACXC,GAAG,EAKJ,GARuB;IAStB,qBACE,wDACE,oBAACC;QAAQC,4CAAAA;qBACP,oBAACC;QACCC,UAAU;qBAEV,oBAACC;QACCC,uCAAAA;QACAC,MAAK;QACLC,QAAO;QACPC,OAAM;QACNC,gBAAe;QACfC,QAAO;QACPC,eAAc;QACdC,gBAAe;QACfC,aAAY;QACZC,SAAQ;qBAER,oBAACC;QAAKC,GAAE;uBAEV,oBAACrB;QAAcE,WAAWA;QACzBA,cAAc,UAAU,UAAU,YAGpCC,YAAYmB,GAAG,CAAC,CAACC,OAAOC,sBACvB,oBAACzB;YAAe0B,KAAK,AAAC,gBAAaD,QAAM,MAAGpB;YAAOmB,OAAOA;;AAKpE;AAEA,OAAO,SAASG,mBAAmB,KAMlC;IANkC,IAAA,EACjCC,kBAAkB,EAClBvB,GAAG,EAIJ,GANkC;IAOjC,qBACE,0CACGuB,mBAAmBL,GAAG,CAAC,CAACM,kBAAkBC;QACzC,oCAAoC;QACpC,IAAID,iBAAiB1B,SAAS,EAAE;YAC9B,qBACE,oBAACD;gBACCwB,KAAK,AAAC,gCAA6BI,aAAW,MAAGzB;gBACjDF,WAAW0B,iBAAiB1B,SAAS;gBACrCC,aAAayB,iBAAiBzB,WAAW;gBACzCC,KAAKA;;QAGX;QAEA,OACE,2CAA2C;QAC3CwB,iBAAiBzB,WAAW,CAACmB,GAAG,CAAC,CAACC,OAAOO,2BACvC,oBAAC/B;gBACC0B,KAAK,AAAC,gBAAaI,aAAW,MAAGC,aAAW,MAAG1B;gBAC/CmB,OAAOA;;IAIf;AAGN"}

View File

@@ -0,0 +1,85 @@
import { _ as _tagged_template_literal_loose } from "@swc/helpers/_/_tagged_template_literal_loose";
function _templateObject() {
const data = _tagged_template_literal_loose([
"\n button[data-nextjs-data-runtime-error-collapsed-action] {\n background: none;\n border: none;\n padding: 0;\n font-size: var(--size-font-small);\n line-height: var(--size-font-bigger);\n color: var(--color-accents-3);\n }\n\n [data-nextjs-call-stack-frame]:not(:last-child),\n [data-nextjs-component-stack-frame]:not(:last-child) {\n margin-bottom: var(--size-gap-double);\n }\n\n [data-nextjs-call-stack-frame] > h3,\n [data-nextjs-component-stack-frame] > h3 {\n margin-top: 0;\n margin-bottom: var(--size-gap);\n font-family: var(--font-stack-monospace);\n font-size: var(--size-font);\n color: #222;\n }\n [data-nextjs-call-stack-frame] > h3[data-nextjs-frame-expanded='false'] {\n color: #666;\n }\n [data-nextjs-call-stack-frame] > div,\n [data-nextjs-component-stack-frame] > div {\n display: flex;\n align-items: center;\n padding-left: calc(var(--size-gap) + var(--size-gap-half));\n font-size: var(--size-font-small);\n color: #999;\n }\n [data-nextjs-call-stack-frame] > div > svg,\n [data-nextjs-component-stack-frame] > div > svg {\n width: auto;\n height: var(--size-font-small);\n margin-left: var(--size-gap);\n flex-shrink: 0;\n\n display: none;\n }\n\n [data-nextjs-call-stack-frame] > div[data-has-source],\n [data-nextjs-component-stack-frame] > div {\n cursor: pointer;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source]:hover,\n [data-nextjs-component-stack-frame] > div:hover {\n text-decoration: underline dotted;\n }\n [data-nextjs-call-stack-frame] > div[data-has-source] > svg,\n [data-nextjs-component-stack-frame] > div > svg {\n display: unset;\n }\n\n [data-nextjs-call-stack-framework-icon] {\n margin-right: var(--size-gap);\n }\n [data-nextjs-call-stack-framework-icon='next'] > mask {\n mask-type: alpha;\n }\n [data-nextjs-call-stack-framework-icon='react'] {\n color: rgb(20, 158, 202);\n }\n [data-nextjs-collapsed-call-stack-details][open]\n [data-nextjs-call-stack-chevron-icon] {\n transform: rotate(90deg);\n }\n [data-nextjs-collapsed-call-stack-details] summary {\n display: flex;\n align-items: center;\n margin: var(--size-gap-double) 0;\n list-style: none;\n }\n [data-nextjs-collapsed-call-stack-details] summary::-webkit-details-marker {\n display: none;\n }\n\n [data-nextjs-collapsed-call-stack-details] h3 {\n color: #666;\n }\n [data-nextjs-collapsed-call-stack-details] [data-nextjs-call-stack-frame] {\n margin-bottom: var(--size-gap-double);\n }\n"
]);
_templateObject = function() {
return data;
};
return data;
}
import * as React from "react";
import { CodeFrame } from "../../components/CodeFrame";
import { noop as css } from "../../helpers/noop-template";
import { groupStackFramesByFramework } from "../../helpers/group-stack-frames-by-framework";
import { CallStackFrame } from "./CallStackFrame";
import { GroupedStackFrames } from "./GroupedStackFrames";
import { ComponentStackFrameRow } from "./ComponentStackFrameRow";
const RuntimeError = function RuntimeError(param) {
let { error } = param;
const firstFirstPartyFrameIndex = React.useMemo(()=>{
return error.frames.findIndex((entry)=>entry.expanded && Boolean(entry.originalCodeFrame) && Boolean(entry.originalStackFrame));
}, [
error.frames
]);
const firstFrame = React.useMemo(()=>{
var _error_frames_firstFirstPartyFrameIndex;
return (_error_frames_firstFirstPartyFrameIndex = error.frames[firstFirstPartyFrameIndex]) != null ? _error_frames_firstFirstPartyFrameIndex : null;
}, [
error.frames,
firstFirstPartyFrameIndex
]);
const allLeadingFrames = React.useMemo(()=>firstFirstPartyFrameIndex < 0 ? [] : error.frames.slice(0, firstFirstPartyFrameIndex), [
error.frames,
firstFirstPartyFrameIndex
]);
const [all, setAll] = React.useState(firstFrame == null);
const toggleAll = React.useCallback(()=>{
setAll((v)=>!v);
}, []);
const leadingFrames = React.useMemo(()=>allLeadingFrames.filter((f)=>f.expanded || all), [
all,
allLeadingFrames
]);
const allCallStackFrames = React.useMemo(()=>error.frames.slice(firstFirstPartyFrameIndex + 1), [
error.frames,
firstFirstPartyFrameIndex
]);
const visibleCallStackFrames = React.useMemo(()=>allCallStackFrames.filter((f)=>f.expanded || all), [
all,
allCallStackFrames
]);
const canShowMore = React.useMemo(()=>{
return allCallStackFrames.length !== visibleCallStackFrames.length || all && firstFrame != null;
}, [
all,
allCallStackFrames.length,
firstFrame,
visibleCallStackFrames.length
]);
const stackFramesGroupedByFramework = React.useMemo(()=>groupStackFramesByFramework(visibleCallStackFrames), [
visibleCallStackFrames
]);
return /*#__PURE__*/ React.createElement(React.Fragment, null, firstFrame ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("h2", null, "Source"), leadingFrames.map((frame, index)=>/*#__PURE__*/ React.createElement(CallStackFrame, {
key: "leading-frame-" + index + "-" + all,
frame: frame
})), /*#__PURE__*/ React.createElement(CodeFrame, {
stackFrame: firstFrame.originalStackFrame,
codeFrame: firstFrame.originalCodeFrame
})) : undefined, error.componentStackFrames ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("h2", null, "Component Stack"), error.componentStackFrames.map((componentStackFrame, index)=>/*#__PURE__*/ React.createElement(ComponentStackFrameRow, {
key: index,
componentStackFrame: componentStackFrame
}))) : null, stackFramesGroupedByFramework.length ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("h2", null, "Call Stack"), /*#__PURE__*/ React.createElement(GroupedStackFrames, {
groupedStackFrames: stackFramesGroupedByFramework,
all: all
})) : undefined, canShowMore ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("button", {
tabIndex: 10,
"data-nextjs-data-runtime-error-collapsed-action": true,
type: "button",
onClick: toggleAll
}, all ? "Hide" : "Show", " collapsed frames")) : undefined);
};
export const styles = css(_templateObject());
export { RuntimeError };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/container/RuntimeError/index.tsx"],"names":["React","CodeFrame","noop","css","groupStackFramesByFramework","CallStackFrame","GroupedStackFrames","ComponentStackFrameRow","RuntimeError","error","firstFirstPartyFrameIndex","useMemo","frames","findIndex","entry","expanded","Boolean","originalCodeFrame","originalStackFrame","firstFrame","allLeadingFrames","slice","all","setAll","useState","toggleAll","useCallback","v","leadingFrames","filter","f","allCallStackFrames","visibleCallStackFrames","canShowMore","length","stackFramesGroupedByFramework","Fragment","h2","map","frame","index","key","stackFrame","codeFrame","undefined","componentStackFrames","componentStackFrame","groupedStackFrames","button","tabIndex","data-nextjs-data-runtime-error-collapsed-action","type","onClick","styles"],"mappings":";;;;;;;;;;AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,SAAS,QAAQ,6BAA4B;AAEtD,SAASC,QAAQC,GAAG,QAAQ,8BAA6B;AAEzD,SAASC,2BAA2B,QAAQ,gDAA+C;AAC3F,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SAASC,kBAAkB,QAAQ,uBAAsB;AACzD,SAASC,sBAAsB,QAAQ,2BAA0B;AAIjE,MAAMC,eAA4C,SAASA,aAAa,KAEvE;IAFuE,IAAA,EACtEC,KAAK,EACN,GAFuE;IAGtE,MAAMC,4BAA4BV,MAAMW,OAAO,CAAS;QACtD,OAAOF,MAAMG,MAAM,CAACC,SAAS,CAC3B,CAACC,QACCA,MAAMC,QAAQ,IACdC,QAAQF,MAAMG,iBAAiB,KAC/BD,QAAQF,MAAMI,kBAAkB;IAEtC,GAAG;QAACT,MAAMG,MAAM;KAAC;IACjB,MAAMO,aAAanB,MAAMW,OAAO,CAA4B;YACnDF;QAAP,OAAOA,CAAAA,0CAAAA,MAAMG,MAAM,CAACF,0BAA0B,YAAvCD,0CAA2C;IACpD,GAAG;QAACA,MAAMG,MAAM;QAAEF;KAA0B;IAE5C,MAAMU,mBAAmBpB,MAAMW,OAAO,CACpC,IACED,4BAA4B,IACxB,EAAE,GACFD,MAAMG,MAAM,CAACS,KAAK,CAAC,GAAGX,4BAC5B;QAACD,MAAMG,MAAM;QAAEF;KAA0B;IAG3C,MAAM,CAACY,KAAKC,OAAO,GAAGvB,MAAMwB,QAAQ,CAACL,cAAc;IACnD,MAAMM,YAAYzB,MAAM0B,WAAW,CAAC;QAClCH,OAAO,CAACI,IAAM,CAACA;IACjB,GAAG,EAAE;IAEL,MAAMC,gBAAgB5B,MAAMW,OAAO,CACjC,IAAMS,iBAAiBS,MAAM,CAAC,CAACC,IAAMA,EAAEf,QAAQ,IAAIO,MACnD;QAACA;QAAKF;KAAiB;IAEzB,MAAMW,qBAAqB/B,MAAMW,OAAO,CACtC,IAAMF,MAAMG,MAAM,CAACS,KAAK,CAACX,4BAA4B,IACrD;QAACD,MAAMG,MAAM;QAAEF;KAA0B;IAE3C,MAAMsB,yBAAyBhC,MAAMW,OAAO,CAC1C,IAAMoB,mBAAmBF,MAAM,CAAC,CAACC,IAAMA,EAAEf,QAAQ,IAAIO,MACrD;QAACA;QAAKS;KAAmB;IAG3B,MAAME,cAAcjC,MAAMW,OAAO,CAAU;QACzC,OACEoB,mBAAmBG,MAAM,KAAKF,uBAAuBE,MAAM,IAC1DZ,OAAOH,cAAc;IAE1B,GAAG;QACDG;QACAS,mBAAmBG,MAAM;QACzBf;QACAa,uBAAuBE,MAAM;KAC9B;IAED,MAAMC,gCAAgCnC,MAAMW,OAAO,CACjD,IAAMP,4BAA4B4B,yBAClC;QAACA;KAAuB;IAG1B,qBACE,oBAAChC,MAAMoC,QAAQ,QACZjB,2BACC,oBAACnB,MAAMoC,QAAQ,sBACb,oBAACC,YAAG,WACHT,cAAcU,GAAG,CAAC,CAACC,OAAOC,sBACzB,oBAACnC;YACCoC,KAAK,AAAC,mBAAgBD,QAAM,MAAGlB;YAC/BiB,OAAOA;2BAGX,oBAACtC;QACCyC,YAAYvB,WAAWD,kBAAkB;QACzCyB,WAAWxB,WAAWF,iBAAiB;UAGzC2B,WAEHnC,MAAMoC,oBAAoB,iBACzB,wDACE,oBAACR,YAAG,oBACH5B,MAAMoC,oBAAoB,CAACP,GAAG,CAAC,CAACQ,qBAAqBN,sBACpD,oBAACjC;YACCkC,KAAKD;YACLM,qBAAqBA;eAIzB,MAEHX,8BAA8BD,MAAM,iBACnC,oBAAClC,MAAMoC,QAAQ,sBACb,oBAACC,YAAG,6BACJ,oBAAC/B;QACCyC,oBAAoBZ;QACpBb,KAAKA;UAGPsB,WACHX,4BACC,oBAACjC,MAAMoC,QAAQ,sBACb,oBAACY;QACCC,UAAU;QACVC,mDAAAA;QACAC,MAAK;QACLC,SAAS3B;OAERH,MAAM,SAAS,QAAO,wBAGzBsB;AAGV;AAEA,OAAO,MAAMS,SAASlD,uBAsFrB;AAED,SAASK,YAAY,GAAE"}

View File

@@ -0,0 +1,122 @@
export const ACTION_BUILD_OK = "build-ok";
export const ACTION_BUILD_ERROR = "build-error";
export const ACTION_BEFORE_REFRESH = "before-fast-refresh";
export const ACTION_REFRESH = "fast-refresh";
export const ACTION_UNHANDLED_ERROR = "unhandled-error";
export const ACTION_UNHANDLED_REJECTION = "unhandled-rejection";
export const ACTION_VERSION_INFO = "version-info";
export const INITIAL_OVERLAY_STATE = {
nextId: 1,
buildError: null,
errors: [],
notFound: false,
refreshState: {
type: "idle"
},
versionInfo: {
installed: "0.0.0",
staleness: "unknown"
}
};
function pushErrorFilterDuplicates(errors, err) {
return [
...errors.filter((e)=>{
// Filter out duplicate errors
return e.event.reason !== err.event.reason;
}),
err
];
}
export const errorOverlayReducer = (state, action)=>{
switch(action.type){
case ACTION_BUILD_OK:
{
return {
...state,
buildError: null
};
}
case ACTION_BUILD_ERROR:
{
return {
...state,
buildError: action.message
};
}
case ACTION_BEFORE_REFRESH:
{
return {
...state,
refreshState: {
type: "pending",
errors: []
}
};
}
case ACTION_REFRESH:
{
return {
...state,
buildError: null,
errors: // Errors can come in during updates. In this case, UNHANDLED_ERROR
// and UNHANDLED_REJECTION events might be dispatched between the
// BEFORE_REFRESH and the REFRESH event. We want to keep those errors
// around until the next refresh. Otherwise we run into a race
// condition where those errors would be cleared on refresh completion
// before they can be displayed.
state.refreshState.type === "pending" ? state.refreshState.errors : [],
refreshState: {
type: "idle"
}
};
}
case ACTION_UNHANDLED_ERROR:
case ACTION_UNHANDLED_REJECTION:
{
switch(state.refreshState.type){
case "idle":
{
return {
...state,
nextId: state.nextId + 1,
errors: pushErrorFilterDuplicates(state.errors, {
id: state.nextId,
event: action
})
};
}
case "pending":
{
return {
...state,
nextId: state.nextId + 1,
refreshState: {
...state.refreshState,
errors: pushErrorFilterDuplicates(state.refreshState.errors, {
id: state.nextId,
event: action
})
}
};
}
default:
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ = state.refreshState;
return state;
}
}
case ACTION_VERSION_INFO:
{
return {
...state,
versionInfo: action.versionInfo
};
}
default:
{
return state;
}
}
};
//# sourceMappingURL=error-overlay-reducer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/internal/error-overlay-reducer.ts"],"names":["ACTION_BUILD_OK","ACTION_BUILD_ERROR","ACTION_BEFORE_REFRESH","ACTION_REFRESH","ACTION_UNHANDLED_ERROR","ACTION_UNHANDLED_REJECTION","ACTION_VERSION_INFO","INITIAL_OVERLAY_STATE","nextId","buildError","errors","notFound","refreshState","type","versionInfo","installed","staleness","pushErrorFilterDuplicates","err","filter","e","event","reason","errorOverlayReducer","state","action","message","id","_"],"mappings":"AAKA,OAAO,MAAMA,kBAAkB,WAAU;AACzC,OAAO,MAAMC,qBAAqB,cAAa;AAC/C,OAAO,MAAMC,wBAAwB,sBAAqB;AAC1D,OAAO,MAAMC,iBAAiB,eAAc;AAC5C,OAAO,MAAMC,yBAAyB,kBAAiB;AACvD,OAAO,MAAMC,6BAA6B,sBAAqB;AAC/D,OAAO,MAAMC,sBAAsB,eAAc;AACjD,OAAO,MAAMC,wBAAsC;IACjDC,QAAQ;IACRC,YAAY;IACZC,QAAQ,EAAE;IACVC,UAAU;IACVC,cAAc;QAAEC,MAAM;IAAO;IAC7BC,aAAa;QAAEC,WAAW;QAASC,WAAW;IAAU;AAC1D,EAAC;AAsDD,SAASC,0BACPP,MAA6B,EAC7BQ,GAAwB;IAExB,OAAO;WACFR,OAAOS,MAAM,CAAC,CAACC;YAChB,8BAA8B;YAC9B,OAAOA,EAAEC,KAAK,CAACC,MAAM,KAAKJ,IAAIG,KAAK,CAACC,MAAM;QAC5C;QACAJ;KACD;AACH;AAEA,OAAO,MAAMK,sBAWT,CAACC,OAAOC;IACV,OAAQA,OAAOZ,IAAI;QACjB,KAAKb;YAAiB;gBACpB,OAAO;oBAAE,GAAGwB,KAAK;oBAAEf,YAAY;gBAAK;YACtC;QACA,KAAKR;YAAoB;gBACvB,OAAO;oBAAE,GAAGuB,KAAK;oBAAEf,YAAYgB,OAAOC,OAAO;gBAAC;YAChD;QACA,KAAKxB;YAAuB;gBAC1B,OAAO;oBAAE,GAAGsB,KAAK;oBAAEZ,cAAc;wBAAEC,MAAM;wBAAWH,QAAQ,EAAE;oBAAC;gBAAE;YACnE;QACA,KAAKP;YAAgB;gBACnB,OAAO;oBACL,GAAGqB,KAAK;oBACRf,YAAY;oBACZC,QACE,mEAAmE;oBACnE,iEAAiE;oBACjE,qEAAqE;oBACrE,8DAA8D;oBAC9D,sEAAsE;oBACtE,gCAAgC;oBAChCc,MAAMZ,YAAY,CAACC,IAAI,KAAK,YACxBW,MAAMZ,YAAY,CAACF,MAAM,GACzB,EAAE;oBACRE,cAAc;wBAAEC,MAAM;oBAAO;gBAC/B;YACF;QACA,KAAKT;QACL,KAAKC;YAA4B;gBAC/B,OAAQmB,MAAMZ,YAAY,CAACC,IAAI;oBAC7B,KAAK;wBAAQ;4BACX,OAAO;gCACL,GAAGW,KAAK;gCACRhB,QAAQgB,MAAMhB,MAAM,GAAG;gCACvBE,QAAQO,0BAA0BO,MAAMd,MAAM,EAAE;oCAC9CiB,IAAIH,MAAMhB,MAAM;oCAChBa,OAAOI;gCACT;4BACF;wBACF;oBACA,KAAK;wBAAW;4BACd,OAAO;gCACL,GAAGD,KAAK;gCACRhB,QAAQgB,MAAMhB,MAAM,GAAG;gCACvBI,cAAc;oCACZ,GAAGY,MAAMZ,YAAY;oCACrBF,QAAQO,0BAA0BO,MAAMZ,YAAY,CAACF,MAAM,EAAE;wCAC3DiB,IAAIH,MAAMhB,MAAM;wCAChBa,OAAOI;oCACT;gCACF;4BACF;wBACF;oBACA;wBACE,6DAA6D;wBAC7D,MAAMG,IAAWJ,MAAMZ,YAAY;wBACnC,OAAOY;gBACX;YACF;QACA,KAAKlB;YAAqB;gBACxB,OAAO;oBAAE,GAAGkB,KAAK;oBAAEV,aAAaW,OAAOX,WAAW;gBAAC;YACrD;QACA;YAAS;gBACP,OAAOU;YACT;IACF;AACF,EAAC"}

View File

@@ -0,0 +1,20 @@
function getSocketProtocol(assetPrefix) {
let protocol = window.location.protocol;
try {
// assetPrefix is a url
protocol = new URL(assetPrefix).protocol;
} catch (e) {}
return protocol === "http:" ? "ws" : "wss";
}
export function getSocketUrl(assetPrefix) {
const { hostname, port } = window.location;
const protocol = getSocketProtocol(assetPrefix);
const normalizedAssetPrefix = assetPrefix.replace(/^\/+/, "");
let url = protocol + "://" + hostname + ":" + port + (normalizedAssetPrefix ? "/" + normalizedAssetPrefix : "");
if (normalizedAssetPrefix.startsWith("http")) {
url = protocol + "://" + normalizedAssetPrefix.split("://")[1];
}
return url;
}
//# sourceMappingURL=get-socket-url.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/get-socket-url.ts"],"names":["getSocketProtocol","assetPrefix","protocol","window","location","URL","getSocketUrl","hostname","port","normalizedAssetPrefix","replace","url","startsWith","split"],"mappings":"AAAA,SAASA,kBAAkBC,WAAmB;IAC5C,IAAIC,WAAWC,OAAOC,QAAQ,CAACF,QAAQ;IAEvC,IAAI;QACF,uBAAuB;QACvBA,WAAW,IAAIG,IAAIJ,aAAaC,QAAQ;IAC1C,EAAE,UAAM,CAAC;IAET,OAAOA,aAAa,UAAU,OAAO;AACvC;AAEA,OAAO,SAASI,aAAaL,WAAmB;IAC9C,MAAM,EAAEM,QAAQ,EAAEC,IAAI,EAAE,GAAGL,OAAOC,QAAQ;IAC1C,MAAMF,WAAWF,kBAAkBC;IACnC,MAAMQ,wBAAwBR,YAAYS,OAAO,CAAC,QAAQ;IAE1D,IAAIC,MAAM,AAAGT,WAAS,QAAKK,WAAS,MAAGC,OACrCC,CAAAA,wBAAwB,AAAC,MAAGA,wBAA0B,EAAC;IAGzD,IAAIA,sBAAsBG,UAAU,CAAC,SAAS;QAC5CD,MAAM,AAAGT,WAAS,QAAKO,sBAAsBI,KAAK,CAAC,MAAM,CAAC,EAAE;IAC9D;IAEA,OAAOF;AACT"}

View File

@@ -0,0 +1,31 @@
import { ACTION_UNHANDLED_ERROR, ACTION_UNHANDLED_REJECTION } from "../error-overlay-reducer";
import { getErrorSource } from "./nodeStackFrames";
import { getOriginalStackFrames } from "./stack-frame";
export async function getErrorByType(ev) {
const { id, event } = ev;
switch(event.type){
case ACTION_UNHANDLED_ERROR:
case ACTION_UNHANDLED_REJECTION:
{
const readyRuntimeError = {
id,
runtime: true,
error: event.reason,
frames: await getOriginalStackFrames(event.frames, getErrorSource(event.reason), event.reason.toString())
};
if (event.type === ACTION_UNHANDLED_ERROR) {
readyRuntimeError.componentStackFrames = event.componentStackFrames;
}
return readyRuntimeError;
}
default:
{
break;
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ = event;
throw new Error("type system invariant violation");
}
//# sourceMappingURL=getErrorByType.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/getErrorByType.ts"],"names":["ACTION_UNHANDLED_ERROR","ACTION_UNHANDLED_REJECTION","getErrorSource","getOriginalStackFrames","getErrorByType","ev","id","event","type","readyRuntimeError","runtime","error","reason","frames","toString","componentStackFrames","_","Error"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,0BAA0B,QACrB,2BAA0B;AAEjC,SAASC,cAAc,QAAQ,oBAAmB;AAClD,SAASC,sBAAsB,QAA4B,gBAAe;AAW1E,OAAO,eAAeC,eACpBC,EAAuB;IAEvB,MAAM,EAAEC,EAAE,EAAEC,KAAK,EAAE,GAAGF;IACtB,OAAQE,MAAMC,IAAI;QAChB,KAAKR;QACL,KAAKC;YAA4B;gBAC/B,MAAMQ,oBAAuC;oBAC3CH;oBACAI,SAAS;oBACTC,OAAOJ,MAAMK,MAAM;oBACnBC,QAAQ,MAAMV,uBACZI,MAAMM,MAAM,EACZX,eAAeK,MAAMK,MAAM,GAC3BL,MAAMK,MAAM,CAACE,QAAQ;gBAEzB;gBACA,IAAIP,MAAMC,IAAI,KAAKR,wBAAwB;oBACzCS,kBAAkBM,oBAAoB,GAAGR,MAAMQ,oBAAoB;gBACrE;gBACA,OAAON;YACT;QACA;YAAS;gBACP;YACF;IACF;IACA,6DAA6D;IAC7D,MAAMO,IAAWT;IACjB,MAAM,IAAIU,MAAM;AAClB"}

View File

@@ -0,0 +1,28 @@
import dataUriToBuffer from "next/dist/compiled/data-uri-to-buffer";
import { getSourceMapUrl } from "./getSourceMapUrl";
export function getRawSourceMap(fileContents) {
const sourceUrl = getSourceMapUrl(fileContents);
if (!(sourceUrl == null ? void 0 : sourceUrl.startsWith("data:"))) {
return null;
}
let buffer;
try {
// @ts-expect-error TODO-APP: fix type.
buffer = dataUriToBuffer(sourceUrl);
} catch (err) {
console.error("Failed to parse source map URL:", err);
return null;
}
if (buffer.type !== "application/json") {
console.error("Unknown source map type: " + buffer.typeFull + ".");
return null;
}
try {
return JSON.parse(buffer.toString());
} catch (e) {
console.error("Failed to parse source map.");
return null;
}
}
//# sourceMappingURL=getRawSourceMap.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/getRawSourceMap.ts"],"names":["dataUriToBuffer","getSourceMapUrl","getRawSourceMap","fileContents","sourceUrl","startsWith","buffer","err","console","error","type","typeFull","JSON","parse","toString"],"mappings":"AAAA,OAAOA,qBAEA,wCAAuC;AAE9C,SAASC,eAAe,QAAQ,oBAAmB;AAEnD,OAAO,SAASC,gBAAgBC,YAAoB;IAClD,MAAMC,YAAYH,gBAAgBE;IAClC,IAAI,EAACC,6BAAAA,UAAWC,UAAU,CAAC,WAAU;QACnC,OAAO;IACT;IAEA,IAAIC;IACJ,IAAI;QACF,uCAAuC;QACvCA,SAASN,gBAAgBI;IAC3B,EAAE,OAAOG,KAAK;QACZC,QAAQC,KAAK,CAAC,mCAAmCF;QACjD,OAAO;IACT;IAEA,IAAID,OAAOI,IAAI,KAAK,oBAAoB;QACtCF,QAAQC,KAAK,CAAC,AAAC,8BAA2BH,OAAOK,QAAQ,GAAC;QAC1D,OAAO;IACT;IAEA,IAAI;QACF,OAAOC,KAAKC,KAAK,CAACP,OAAOQ,QAAQ;IACnC,EAAE,UAAM;QACNN,QAAQC,KAAK,CAAC;QACd,OAAO;IACT;AACF"}

View File

@@ -0,0 +1,17 @@
export function getSourceMapUrl(fileContents) {
const regex = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/gm;
let match = null;
for(;;){
let next = regex.exec(fileContents);
if (next == null) {
break;
}
match = next;
}
if (!(match && match[1])) {
return null;
}
return match[1].toString();
}
//# sourceMappingURL=getSourceMapUrl.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/getSourceMapUrl.ts"],"names":["getSourceMapUrl","fileContents","regex","match","next","exec","toString"],"mappings":"AAAA,OAAO,SAASA,gBAAgBC,YAAoB;IAClD,MAAMC,QAAQ;IACd,IAAIC,QAAQ;IACZ,OAAS;QACP,IAAIC,OAAOF,MAAMG,IAAI,CAACJ;QACtB,IAAIG,QAAQ,MAAM;YAChB;QACF;QACAD,QAAQC;IACV;IACA,IAAI,CAAED,CAAAA,SAASA,KAAK,CAAC,EAAE,AAAD,GAAI;QACxB,OAAO;IACT;IACA,OAAOA,KAAK,CAAC,EAAE,CAACG,QAAQ;AAC1B"}

View File

@@ -0,0 +1,51 @@
/**
* Get the origin framework of the stack frame by package name.
*/ function getFramework(sourcePackage) {
if (!sourcePackage) return undefined;
if (/^(react|react-dom|react-is|react-refresh|react-server-dom-webpack|scheduler)$/.test(sourcePackage)) {
return "react";
} else if (sourcePackage === "next") {
return "next";
}
return undefined;
}
/**
* Group sequences of stack frames by framework.
*
* Given the following stack frames:
* Error
* user code
* user code
* react
* react
* next
* next
* react
* react
*
* The grouped stack frames would be:
* > user code
* > react
* > next
* > react
*
*/ export function groupStackFramesByFramework(stackFrames) {
const stackFramesGroupedByFramework = [];
for (const stackFrame of stackFrames){
const currentGroup = stackFramesGroupedByFramework[stackFramesGroupedByFramework.length - 1];
const framework = getFramework(stackFrame.sourcePackage);
if (currentGroup && currentGroup.framework === framework) {
currentGroup.stackFrames.push(stackFrame);
} else {
stackFramesGroupedByFramework.push({
framework: framework,
stackFrames: [
stackFrame
]
});
}
}
return stackFramesGroupedByFramework;
}
//# sourceMappingURL=group-stack-frames-by-framework.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/group-stack-frames-by-framework.ts"],"names":["getFramework","sourcePackage","undefined","test","groupStackFramesByFramework","stackFrames","stackFramesGroupedByFramework","stackFrame","currentGroup","length","framework","push"],"mappings":"AAOA;;CAEC,GACD,SAASA,aACPC,aAAiC;IAEjC,IAAI,CAACA,eAAe,OAAOC;IAE3B,IACE,gFAAgFC,IAAI,CAClFF,gBAEF;QACA,OAAO;IACT,OAAO,IAAIA,kBAAkB,QAAQ;QACnC,OAAO;IACT;IAEA,OAAOC;AACT;AAEA;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,SAASE,4BACdC,WAAiC;IAEjC,MAAMC,gCAAoD,EAAE;IAE5D,KAAK,MAAMC,cAAcF,YAAa;QACpC,MAAMG,eACJF,6BAA6B,CAACA,8BAA8BG,MAAM,GAAG,EAAE;QACzE,MAAMC,YAAYV,aAAaO,WAAWN,aAAa;QAEvD,IAAIO,gBAAgBA,aAAaE,SAAS,KAAKA,WAAW;YACxDF,aAAaH,WAAW,CAACM,IAAI,CAACJ;QAChC,OAAO;YACLD,8BAA8BK,IAAI,CAAC;gBACjCD,WAAWA;gBACXL,aAAa;oBAACE;iBAAW;YAC3B;QACF;IACF;IAEA,OAAOD;AACT"}

View File

@@ -0,0 +1,28 @@
export let hydrationErrorWarning;
export let hydrationErrorComponentStack;
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
const knownHydrationWarnings = new Set([
'Warning: Text content did not match. Server: "%s" Client: "%s"%s',
"Warning: Expected server HTML to contain a matching <%s> in <%s>.%s",
'Warning: Expected server HTML to contain a matching text node for "%s" in <%s>.%s',
"Warning: Did not expect server HTML to contain a <%s> in <%s>.%s",
'Warning: Did not expect server HTML to contain the text node "%s" in <%s>.%s'
]);
/**
* Patch console.error to capture hydration errors.
* If any of the knownHydrationWarnings are logged, store the message and component stack.
* When the hydration runtime error is thrown, the message and component stack are added to the error.
* This results in a more helpful error message in the error overlay.
*/ export function patchConsoleError() {
const prev = console.error;
console.error = function(msg, serverContent, clientContent, componentStack) {
if (knownHydrationWarnings.has(msg)) {
hydrationErrorWarning = msg.replace("%s", serverContent).replace("%s", clientContent).replace("%s", "");
hydrationErrorComponentStack = componentStack;
}
// @ts-expect-error argument is defined
prev.apply(console, arguments);
};
}
//# sourceMappingURL=hydration-error-info.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts"],"names":["hydrationErrorWarning","hydrationErrorComponentStack","knownHydrationWarnings","Set","patchConsoleError","prev","console","error","msg","serverContent","clientContent","componentStack","has","replace","apply","arguments"],"mappings":"AAAA,OAAO,IAAIA,sBAAyC;AACpD,OAAO,IAAIC,6BAAgD;AAE3D,iIAAiI;AACjI,MAAMC,yBAAyB,IAAIC,IAAI;IACrC;IACA;IACA;IACA;IACA;CACD;AAED;;;;;CAKC,GACD,OAAO,SAASC;IACd,MAAMC,OAAOC,QAAQC,KAAK;IAC1BD,QAAQC,KAAK,GAAG,SAAUC,GAAG,EAAEC,aAAa,EAAEC,aAAa,EAAEC,cAAc;QACzE,IAAIT,uBAAuBU,GAAG,CAACJ,MAAM;YACnCR,wBAAwBQ,IACrBK,OAAO,CAAC,MAAMJ,eACdI,OAAO,CAAC,MAAMH,eACdG,OAAO,CAAC,MAAM;YACjBZ,+BAA+BU;QACjC;QAEA,uCAAuC;QACvCN,KAAKS,KAAK,CAACR,SAASS;IACtB;AACF"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,58 @@
import { parse } from "next/dist/compiled/stacktrace-parser";
export function getFilesystemFrame(frame) {
const f = {
...frame
};
if (typeof f.file === "string") {
if (// Posix:
f.file.startsWith("/") || // Win32:
/^[a-z]:\\/i.test(f.file) || // Win32 UNC:
f.file.startsWith("\\\\")) {
f.file = "file://" + f.file;
}
}
return f;
}
const symbolError = Symbol("NextjsError");
export function getErrorSource(error) {
return error[symbolError] || null;
}
export function decorateServerError(error, type) {
Object.defineProperty(error, symbolError, {
writable: false,
enumerable: false,
configurable: false,
value: type
});
}
export function getServerError(error, type) {
let n;
try {
throw new Error(error.message);
} catch (e) {
n = e;
}
n.name = error.name;
try {
n.stack = n.toString() + "\n" + parse(error.stack).map(getFilesystemFrame).map((f)=>{
let str = " at " + f.methodName;
if (f.file) {
let loc = f.file;
if (f.lineNumber) {
loc += ":" + f.lineNumber;
if (f.column) {
loc += ":" + f.column;
}
}
str += " (" + loc + ")";
}
return str;
}).join("\n");
} catch (e) {
n.stack = error.stack;
}
decorateServerError(n, type);
return n;
}
//# sourceMappingURL=nodeStackFrames.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/nodeStackFrames.ts"],"names":["parse","getFilesystemFrame","frame","f","file","startsWith","test","symbolError","Symbol","getErrorSource","error","decorateServerError","type","Object","defineProperty","writable","enumerable","configurable","value","getServerError","n","Error","message","e","name","stack","toString","map","str","methodName","loc","lineNumber","column","join"],"mappings":"AAAA,SAASA,KAAK,QAAoB,uCAAsC;AAExE,OAAO,SAASC,mBAAmBC,KAAiB;IAClD,MAAMC,IAAgB;QAAE,GAAGD,KAAK;IAAC;IAEjC,IAAI,OAAOC,EAAEC,IAAI,KAAK,UAAU;QAC9B,IACE,SAAS;QACTD,EAAEC,IAAI,CAACC,UAAU,CAAC,QAClB,SAAS;QACT,aAAaC,IAAI,CAACH,EAAEC,IAAI,KACxB,aAAa;QACbD,EAAEC,IAAI,CAACC,UAAU,CAAC,SAClB;YACAF,EAAEC,IAAI,GAAG,AAAC,YAASD,EAAEC,IAAI;QAC3B;IACF;IAEA,OAAOD;AACT;AAEA,MAAMI,cAAcC,OAAO;AAE3B,OAAO,SAASC,eAAeC,KAAY;IACzC,OAAO,AAACA,KAAa,CAACH,YAAY,IAAI;AACxC;AAIA,OAAO,SAASI,oBAAoBD,KAAY,EAAEE,IAAe;IAC/DC,OAAOC,cAAc,CAACJ,OAAOH,aAAa;QACxCQ,UAAU;QACVC,YAAY;QACZC,cAAc;QACdC,OAAON;IACT;AACF;AAEA,OAAO,SAASO,eAAeT,KAAY,EAAEE,IAAe;IAC1D,IAAIQ;IACJ,IAAI;QACF,MAAM,IAAIC,MAAMX,MAAMY,OAAO;IAC/B,EAAE,OAAOC,GAAG;QACVH,IAAIG;IACN;IAEAH,EAAEI,IAAI,GAAGd,MAAMc,IAAI;IACnB,IAAI;QACFJ,EAAEK,KAAK,GAAG,AAAGL,EAAEM,QAAQ,KAAG,OAAI1B,MAAMU,MAAMe,KAAK,EAC5CE,GAAG,CAAC1B,oBACJ0B,GAAG,CAAC,CAACxB;YACJ,IAAIyB,MAAM,AAAC,YAASzB,EAAE0B,UAAU;YAChC,IAAI1B,EAAEC,IAAI,EAAE;gBACV,IAAI0B,MAAM3B,EAAEC,IAAI;gBAChB,IAAID,EAAE4B,UAAU,EAAE;oBAChBD,OAAO,AAAC,MAAG3B,EAAE4B,UAAU;oBACvB,IAAI5B,EAAE6B,MAAM,EAAE;wBACZF,OAAO,AAAC,MAAG3B,EAAE6B,MAAM;oBACrB;gBACF;gBACAJ,OAAO,AAAC,OAAIE,MAAI;YAClB;YACA,OAAOF;QACT,GACCK,IAAI,CAAC;IACV,EAAE,UAAM;QACNb,EAAEK,KAAK,GAAGf,MAAMe,KAAK;IACvB;IAEAd,oBAAoBS,GAAGR;IACvB,OAAOQ;AACT"}

View File

@@ -0,0 +1,9 @@
export function noop(strings) {
for(var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
keys[_key - 1] = arguments[_key];
}
const lastIndex = strings.length - 1;
return strings.slice(0, lastIndex).reduce((p, s, i)=>p + s + keys[i], "") + strings[lastIndex];
}
//# sourceMappingURL=noop-template.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/helpers/noop-template.ts"],"names":["noop","strings","keys","lastIndex","length","slice","reduce","p","s","i"],"mappings":"AAAA,OAAO,SAASA,KACdC,OAA6B;IAC7B,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGC,OAAH,UAAA,OAAA,IAAA,OAAA,QAAA,OAAA,GAAA,OAAA,MAAA,OAAA;QAAGA,KAAH,OAAA,KAAA,SAAA,CAAA,KAA0B;IAAD;IAEzB,MAAMC,YAAYF,QAAQG,MAAM,GAAG;IACnC,OACEH,QAAQI,KAAK,CAAC,GAAGF,WAAWG,MAAM,CAAC,CAACC,GAAGC,GAAGC,IAAMF,IAAIC,IAAIN,IAAI,CAACO,EAAE,EAAE,MACjER,OAAO,CAACE,UAAU;AAEtB"}

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