vinext 0.0.46 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/build/prerender.d.ts +2 -1
- package/dist/build/prerender.js +70 -14
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/report.d.ts +1 -1
- package/dist/build/route-classification-injector.d.ts +35 -0
- package/dist/build/route-classification-injector.js +61 -0
- package/dist/build/route-classification-injector.js.map +1 -0
- package/dist/build/route-classification-manifest.d.ts +1 -1
- package/dist/build/static-export.d.ts +1 -1
- package/dist/cli-args.d.ts +31 -0
- package/dist/cli-args.js +104 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli.js +2 -19
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare/kv-cache-handler.js +29 -9
- package/dist/cloudflare/kv-cache-handler.js.map +1 -1
- package/dist/config/next-config.d.ts +4 -2
- package/dist/config/next-config.js +3 -0
- package/dist/config/next-config.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +4 -3
- package/dist/entries/app-rsc-entry.js +373 -854
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.d.ts +1 -1
- package/dist/entries/app-rsc-manifest.js +2 -0
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/pages-server-entry.js +5 -2
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/index.js +28 -51
- package/dist/index.js.map +1 -1
- package/dist/plugins/fonts.js +54 -32
- package/dist/plugins/fonts.js.map +1 -1
- package/dist/plugins/rsc-client-shim-excludes.js +1 -0
- package/dist/plugins/rsc-client-shim-excludes.js.map +1 -1
- package/dist/routing/app-route-graph.d.ts +109 -0
- package/dist/routing/app-route-graph.js +819 -0
- package/dist/routing/app-route-graph.js.map +1 -0
- package/dist/routing/app-router.d.ts +2 -88
- package/dist/routing/app-router.js +6 -694
- package/dist/routing/app-router.js.map +1 -1
- package/dist/server/app-browser-entry.js +86 -252
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-error.d.ts +3 -4
- package/dist/server/app-browser-error.js +8 -4
- package/dist/server/app-browser-error.js.map +1 -1
- package/dist/server/app-browser-navigation-controller.d.ts +73 -0
- package/dist/server/app-browser-navigation-controller.js +282 -0
- package/dist/server/app-browser-navigation-controller.js.map +1 -0
- package/dist/server/app-browser-state.d.ts +1 -1
- package/dist/server/app-elements.js +1 -5
- package/dist/server/app-elements.js.map +1 -1
- package/dist/server/app-fallback-renderer.d.ts +57 -0
- package/dist/server/app-fallback-renderer.js +79 -0
- package/dist/server/app-fallback-renderer.js.map +1 -0
- package/dist/server/app-hook-warning-suppression.d.ts +7 -0
- package/dist/server/app-hook-warning-suppression.js +12 -0
- package/dist/server/app-hook-warning-suppression.js.map +1 -0
- package/dist/server/app-mounted-slots-header.d.ts +17 -0
- package/dist/server/app-mounted-slots-header.js +21 -0
- package/dist/server/app-mounted-slots-header.js.map +1 -0
- package/dist/server/app-page-boundary-render.d.ts +2 -2
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +18 -4
- package/dist/server/app-page-cache.js +53 -10
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +7 -4
- package/dist/server/app-page-dispatch.js +24 -8
- package/dist/server/app-page-dispatch.js.map +1 -1
- package/dist/server/app-page-element-builder.d.ts +61 -0
- package/dist/server/app-page-element-builder.js +139 -0
- package/dist/server/app-page-element-builder.js.map +1 -0
- package/dist/server/app-page-params.d.ts +2 -1
- package/dist/server/app-page-params.js +3 -3
- package/dist/server/app-page-params.js.map +1 -1
- package/dist/server/app-page-render.d.ts +5 -1
- package/dist/server/app-page-render.js +80 -27
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +19 -4
- package/dist/server/app-page-request.js +51 -6
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.d.ts +1 -0
- package/dist/server/app-page-response.js +3 -7
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +15 -2
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-post-middleware-context.d.ts +16 -0
- package/dist/server/app-post-middleware-context.js +28 -0
- package/dist/server/app-post-middleware-context.js.map +1 -0
- package/dist/server/app-request-context.d.ts +22 -0
- package/dist/server/app-request-context.js +30 -0
- package/dist/server/app-request-context.js.map +1 -0
- package/dist/server/app-route-handler-cache.d.ts +1 -0
- package/dist/server/app-route-handler-cache.js +5 -1
- package/dist/server/app-route-handler-cache.js.map +1 -1
- package/dist/server/app-route-handler-dispatch.d.ts +1 -0
- package/dist/server/app-route-handler-dispatch.js +2 -0
- package/dist/server/app-route-handler-dispatch.js.map +1 -1
- package/dist/server/app-route-handler-execution.d.ts +2 -1
- package/dist/server/app-route-handler-execution.js +2 -2
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-response.d.ts +4 -2
- package/dist/server/app-route-handler-response.js +8 -7
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-rsc-error-handler.d.ts +21 -0
- package/dist/server/app-rsc-error-handler.js +30 -0
- package/dist/server/app-rsc-error-handler.js.map +1 -0
- package/dist/server/app-rsc-handler.d.ts +117 -0
- package/dist/server/app-rsc-handler.js +260 -0
- package/dist/server/app-rsc-handler.js.map +1 -0
- package/dist/server/app-rsc-request-normalization.d.ts +40 -0
- package/dist/server/app-rsc-request-normalization.js +63 -0
- package/dist/server/app-rsc-request-normalization.js.map +1 -0
- package/dist/server/app-rsc-response-finalizer.d.ts +30 -0
- package/dist/server/app-rsc-response-finalizer.js +38 -0
- package/dist/server/app-rsc-response-finalizer.js.map +1 -0
- package/dist/server/app-segment-config.d.ts +33 -0
- package/dist/server/app-segment-config.js +86 -0
- package/dist/server/app-segment-config.js.map +1 -0
- package/dist/server/app-server-action-execution.d.ts +2 -0
- package/dist/server/app-server-action-execution.js +2 -0
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/cache-control.d.ts +24 -0
- package/dist/server/cache-control.js +33 -0
- package/dist/server/cache-control.js.map +1 -0
- package/dist/server/dev-error-overlay-store.d.ts +23 -0
- package/dist/server/dev-error-overlay-store.js +67 -0
- package/dist/server/dev-error-overlay-store.js.map +1 -0
- package/dist/server/dev-error-overlay.d.ts +15 -0
- package/dist/server/dev-error-overlay.js +548 -0
- package/dist/server/dev-error-overlay.js.map +1 -0
- package/dist/server/instrumentation-runtime.d.ts +44 -0
- package/dist/server/instrumentation-runtime.js +29 -0
- package/dist/server/instrumentation-runtime.js.map +1 -0
- package/dist/server/isr-cache.d.ts +2 -7
- package/dist/server/isr-cache.js +7 -10
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/pages-page-data.d.ts +2 -1
- package/dist/server/pages-page-data.js +6 -5
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +2 -1
- package/dist/server/pages-page-response.js +3 -2
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/rsc-stream-hints.d.ts +3 -1
- package/dist/server/rsc-stream-hints.js +4 -1
- package/dist/server/rsc-stream-hints.js.map +1 -1
- package/dist/server/seed-cache.js +19 -8
- package/dist/server/seed-cache.js.map +1 -1
- package/dist/shims/cache-runtime.js +28 -11
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +15 -3
- package/dist/shims/cache.js +42 -15
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +17 -1
- package/dist/shims/error-boundary.js +31 -1
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +4 -1
- package/dist/shims/fetch-cache.js +55 -13
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/image.js +93 -5
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +1 -0
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/shims/use-merged-ref.d.ts +7 -0
- package/dist/shims/use-merged-ref.js +40 -0
- package/dist/shims/use-merged-ref.js.map +1 -0
- package/dist/utils/cache-control-metadata.d.ts +6 -0
- package/dist/utils/cache-control-metadata.js +16 -0
- package/dist/utils/cache-control-metadata.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//#region src/server/dev-error-overlay-store.ts
|
|
2
|
+
const MAX_DEV_OVERLAY_ERRORS = 50;
|
|
3
|
+
let snapshot = {
|
|
4
|
+
errors: [],
|
|
5
|
+
index: 0,
|
|
6
|
+
minimized: false
|
|
7
|
+
};
|
|
8
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
9
|
+
function emit() {
|
|
10
|
+
for (const fn of listeners) fn();
|
|
11
|
+
}
|
|
12
|
+
function subscribeOverlay(fn) {
|
|
13
|
+
listeners.add(fn);
|
|
14
|
+
return () => {
|
|
15
|
+
listeners.delete(fn);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function getOverlaySnapshot() {
|
|
19
|
+
return snapshot;
|
|
20
|
+
}
|
|
21
|
+
function reportToOverlay(error) {
|
|
22
|
+
const next = [...snapshot.errors, error];
|
|
23
|
+
const dropped = next.length > MAX_DEV_OVERLAY_ERRORS ? next.length - MAX_DEV_OVERLAY_ERRORS : 0;
|
|
24
|
+
const errors = dropped > 0 ? next.slice(dropped) : next;
|
|
25
|
+
snapshot = {
|
|
26
|
+
errors,
|
|
27
|
+
index: errors.length - 1,
|
|
28
|
+
minimized: false
|
|
29
|
+
};
|
|
30
|
+
emit();
|
|
31
|
+
}
|
|
32
|
+
function dismissOverlay() {
|
|
33
|
+
snapshot = {
|
|
34
|
+
errors: [],
|
|
35
|
+
index: 0,
|
|
36
|
+
minimized: false
|
|
37
|
+
};
|
|
38
|
+
emit();
|
|
39
|
+
}
|
|
40
|
+
function setOverlayIndex(index) {
|
|
41
|
+
if (index < 0 || index >= snapshot.errors.length) return;
|
|
42
|
+
snapshot = {
|
|
43
|
+
...snapshot,
|
|
44
|
+
index
|
|
45
|
+
};
|
|
46
|
+
emit();
|
|
47
|
+
}
|
|
48
|
+
function minimizeOverlay() {
|
|
49
|
+
if (snapshot.minimized) return;
|
|
50
|
+
snapshot = {
|
|
51
|
+
...snapshot,
|
|
52
|
+
minimized: true
|
|
53
|
+
};
|
|
54
|
+
emit();
|
|
55
|
+
}
|
|
56
|
+
function expandOverlay() {
|
|
57
|
+
if (!snapshot.minimized) return;
|
|
58
|
+
snapshot = {
|
|
59
|
+
...snapshot,
|
|
60
|
+
minimized: false
|
|
61
|
+
};
|
|
62
|
+
emit();
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { dismissOverlay, expandOverlay, getOverlaySnapshot, minimizeOverlay, reportToOverlay, setOverlayIndex, subscribeOverlay };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=dev-error-overlay-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-error-overlay-store.js","names":[],"sources":["../../src/server/dev-error-overlay-store.ts"],"sourcesContent":["// Module-level store for the dev error overlay. Lives in its own file so the\n// overlay React component (dev-error-overlay.tsx) can subscribe via\n// useSyncExternalStore without circular imports.\n\nexport type Source = \"uncaught\" | \"caught\" | \"window-error\" | \"unhandledrejection\";\n\nexport type ReportedError = {\n source: Source;\n message: string;\n stack: string | undefined;\n componentStack: string | undefined;\n};\n\nexport type OverlayState = {\n errors: ReportedError[];\n index: number;\n minimized: boolean;\n};\n\n// Cap the buffer so a hot-reloading loop or an effect that throws on every\n// render can't grow the array (and its retained stack strings) without\n// bound. FIFO eviction keeps the most recent failures.\nconst MAX_DEV_OVERLAY_ERRORS = 50;\n\nlet snapshot: OverlayState = { errors: [], index: 0, minimized: false };\nconst listeners = new Set<() => void>();\n\nfunction emit(): void {\n for (const fn of listeners) fn();\n}\n\nexport function subscribeOverlay(fn: () => void): () => void {\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n}\n\nexport function getOverlaySnapshot(): OverlayState {\n return snapshot;\n}\n\nexport function reportToOverlay(error: ReportedError): void {\n // Any new error pops the dialog open, regardless of source or current\n // state. The developer can minimize once they've taken stock; subsequent\n // failures will re-expand.\n const next = [...snapshot.errors, error];\n const dropped = next.length > MAX_DEV_OVERLAY_ERRORS ? next.length - MAX_DEV_OVERLAY_ERRORS : 0;\n const errors = dropped > 0 ? next.slice(dropped) : next;\n snapshot = {\n errors,\n index: errors.length - 1,\n minimized: false,\n };\n emit();\n}\n\nexport function dismissOverlay(): void {\n snapshot = { errors: [], index: 0, minimized: false };\n emit();\n}\n\nexport function setOverlayIndex(index: number): void {\n if (index < 0 || index >= snapshot.errors.length) return;\n snapshot = { ...snapshot, index };\n emit();\n}\n\nexport function minimizeOverlay(): void {\n if (snapshot.minimized) return;\n snapshot = { ...snapshot, minimized: true };\n emit();\n}\n\nexport function expandOverlay(): void {\n if (!snapshot.minimized) return;\n snapshot = { ...snapshot, minimized: false };\n emit();\n}\n"],"mappings":";AAsBA,MAAM,yBAAyB;AAE/B,IAAI,WAAyB;CAAE,QAAQ,EAAE;CAAE,OAAO;CAAG,WAAW;CAAO;AACvE,MAAM,4BAAY,IAAI,KAAiB;AAEvC,SAAS,OAAa;AACpB,MAAK,MAAM,MAAM,UAAW,KAAI;;AAGlC,SAAgB,iBAAiB,IAA4B;AAC3D,WAAU,IAAI,GAAG;AACjB,cAAa;AACX,YAAU,OAAO,GAAG;;;AAIxB,SAAgB,qBAAmC;AACjD,QAAO;;AAGT,SAAgB,gBAAgB,OAA4B;CAI1D,MAAM,OAAO,CAAC,GAAG,SAAS,QAAQ,MAAM;CACxC,MAAM,UAAU,KAAK,SAAS,yBAAyB,KAAK,SAAS,yBAAyB;CAC9F,MAAM,SAAS,UAAU,IAAI,KAAK,MAAM,QAAQ,GAAG;AACnD,YAAW;EACT;EACA,OAAO,OAAO,SAAS;EACvB,WAAW;EACZ;AACD,OAAM;;AAGR,SAAgB,iBAAuB;AACrC,YAAW;EAAE,QAAQ,EAAE;EAAE,OAAO;EAAG,WAAW;EAAO;AACrD,OAAM;;AAGR,SAAgB,gBAAgB,OAAqB;AACnD,KAAI,QAAQ,KAAK,SAAS,SAAS,OAAO,OAAQ;AAClD,YAAW;EAAE,GAAG;EAAU;EAAO;AACjC,OAAM;;AAGR,SAAgB,kBAAwB;AACtC,KAAI,SAAS,UAAW;AACxB,YAAW;EAAE,GAAG;EAAU,WAAW;EAAM;AAC3C,OAAM;;AAGR,SAAgB,gBAAsB;AACpC,KAAI,CAAC,SAAS,UAAW;AACzB,YAAW;EAAE,GAAG;EAAU,WAAW;EAAO;AAC5C,OAAM"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { dismissOverlay } from "./dev-error-overlay-store.js";
|
|
2
|
+
|
|
3
|
+
//#region src/server/dev-error-overlay.d.ts
|
|
4
|
+
declare function installDevErrorOverlay(): void;
|
|
5
|
+
declare function devOnCaughtError(error: unknown, errorInfo: {
|
|
6
|
+
componentStack?: string;
|
|
7
|
+
errorBoundary?: unknown;
|
|
8
|
+
}): void;
|
|
9
|
+
declare function devOnUncaughtError(error: unknown, errorInfo: {
|
|
10
|
+
componentStack?: string;
|
|
11
|
+
errorBoundary?: unknown;
|
|
12
|
+
}): void;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { devOnCaughtError, devOnUncaughtError, dismissOverlay, installDevErrorOverlay };
|
|
15
|
+
//# sourceMappingURL=dev-error-overlay.d.ts.map
|
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
import { dismissOverlay, expandOverlay, getOverlaySnapshot, minimizeOverlay, reportToOverlay, setOverlayIndex, subscribeOverlay } from "./dev-error-overlay-store.js";
|
|
2
|
+
import { useEffect, useSyncExternalStore } from "react";
|
|
3
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { createRoot } from "react-dom/client";
|
|
5
|
+
//#region src/server/dev-error-overlay.tsx
|
|
6
|
+
const MOUNT_NODE_ID = "__vinext_dev_error_overlay_root";
|
|
7
|
+
let reactRoot = null;
|
|
8
|
+
let installed = false;
|
|
9
|
+
const reportedErrors = /* @__PURE__ */ new WeakSet();
|
|
10
|
+
function rememberReported(error) {
|
|
11
|
+
if (error && typeof error === "object") reportedErrors.add(error);
|
|
12
|
+
}
|
|
13
|
+
function alreadyReported(error) {
|
|
14
|
+
return !!error && typeof error === "object" && reportedErrors.has(error);
|
|
15
|
+
}
|
|
16
|
+
function installDevErrorOverlay() {
|
|
17
|
+
if (installed || typeof window === "undefined") return;
|
|
18
|
+
installed = true;
|
|
19
|
+
window.addEventListener("error", (event) => {
|
|
20
|
+
const err = event.error;
|
|
21
|
+
if (err instanceof Error) {
|
|
22
|
+
if (alreadyReported(err)) return;
|
|
23
|
+
reportDevError(err, { source: "window-error" });
|
|
24
|
+
} else if (event.message) reportDevError(new Error(event.message), { source: "window-error" });
|
|
25
|
+
});
|
|
26
|
+
window.addEventListener("unhandledrejection", (event) => {
|
|
27
|
+
const reason = event.reason;
|
|
28
|
+
if (reason instanceof Error) {
|
|
29
|
+
if (alreadyReported(reason)) return;
|
|
30
|
+
reportDevError(reason, { source: "unhandledrejection" });
|
|
31
|
+
} else reportDevError(new Error(String(reason)), { source: "unhandledrejection" });
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function reportDevError(error, options) {
|
|
35
|
+
if (typeof window === "undefined") return;
|
|
36
|
+
rememberReported(error);
|
|
37
|
+
const message = error instanceof Error ? error.message : typeof error === "string" ? error : safeStringify(error);
|
|
38
|
+
const stack = error instanceof Error ? error.stack : void 0;
|
|
39
|
+
ensureMounted();
|
|
40
|
+
reportToOverlay({
|
|
41
|
+
source: options.source,
|
|
42
|
+
message,
|
|
43
|
+
stack,
|
|
44
|
+
componentStack: options.componentStack
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function devOnCaughtError(error, errorInfo) {
|
|
48
|
+
console.error(error);
|
|
49
|
+
if (errorInfo?.componentStack) console.error("The above error occurred in a React component:\n" + errorInfo.componentStack);
|
|
50
|
+
reportDevError(error, {
|
|
51
|
+
source: "caught",
|
|
52
|
+
componentStack: errorInfo?.componentStack
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function devOnUncaughtError(error, errorInfo) {
|
|
56
|
+
console.error(error);
|
|
57
|
+
if (errorInfo?.componentStack) console.error("The above error occurred in a React component:\n" + errorInfo.componentStack);
|
|
58
|
+
reportDevError(error, {
|
|
59
|
+
source: "uncaught",
|
|
60
|
+
componentStack: errorInfo?.componentStack
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function safeStringify(value) {
|
|
64
|
+
try {
|
|
65
|
+
return JSON.stringify(value);
|
|
66
|
+
} catch {
|
|
67
|
+
return Object.prototype.toString.call(value);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function ensureMounted() {
|
|
71
|
+
if (reactRoot) return;
|
|
72
|
+
const node = document.createElement("div");
|
|
73
|
+
node.id = MOUNT_NODE_ID;
|
|
74
|
+
(document.body ?? document.documentElement).appendChild(node);
|
|
75
|
+
reactRoot = createRoot(node);
|
|
76
|
+
reactRoot.render(/* @__PURE__ */ jsx(DevErrorOverlayApp, {}));
|
|
77
|
+
}
|
|
78
|
+
const SOURCE_LABEL = {
|
|
79
|
+
uncaught: "Unhandled Runtime Error",
|
|
80
|
+
caught: "Runtime Error",
|
|
81
|
+
"window-error": "Unhandled Script Error",
|
|
82
|
+
unhandledrejection: "Unhandled Promise Rejection"
|
|
83
|
+
};
|
|
84
|
+
function DevErrorOverlayApp() {
|
|
85
|
+
const state = useSyncExternalStore(subscribeOverlay, getOverlaySnapshot, getOverlaySnapshot);
|
|
86
|
+
if (state.errors.length === 0) return null;
|
|
87
|
+
const current = state.errors[state.index] ?? state.errors[0];
|
|
88
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("style", { children: overlayStylesheet }), state.minimized ? /* @__PURE__ */ jsx(DevErrorIndicator, {
|
|
89
|
+
count: state.errors.length,
|
|
90
|
+
source: current.source,
|
|
91
|
+
onExpand: expandOverlay
|
|
92
|
+
}) : /* @__PURE__ */ jsx(DevErrorOverlay, {
|
|
93
|
+
error: current,
|
|
94
|
+
index: state.index,
|
|
95
|
+
total: state.errors.length,
|
|
96
|
+
onPrev: () => setOverlayIndex(state.index - 1),
|
|
97
|
+
onNext: () => setOverlayIndex(state.index + 1),
|
|
98
|
+
onMinimize: minimizeOverlay,
|
|
99
|
+
onDismiss: dismissOverlay
|
|
100
|
+
})] });
|
|
101
|
+
}
|
|
102
|
+
function DevErrorIndicator({ count, source, onExpand }) {
|
|
103
|
+
return /* @__PURE__ */ jsx("div", {
|
|
104
|
+
style: indicatorContainerStyle,
|
|
105
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
"data-testid": "vinext-dev-error-indicator",
|
|
108
|
+
"aria-label": `${count} runtime error${count === 1 ? "" : "s"} — click to expand`,
|
|
109
|
+
title: SOURCE_LABEL[source],
|
|
110
|
+
onClick: onExpand,
|
|
111
|
+
className: "vinext-overlay-indicator",
|
|
112
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
113
|
+
"aria-hidden": "true",
|
|
114
|
+
style: indicatorIconStyle,
|
|
115
|
+
children: "⚠"
|
|
116
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
117
|
+
"data-testid": "vinext-dev-error-indicator-count",
|
|
118
|
+
style: indicatorCountStyle,
|
|
119
|
+
children: count
|
|
120
|
+
})]
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function DevErrorOverlay({ error, index, total, onPrev, onNext, onMinimize, onDismiss }) {
|
|
125
|
+
const frames = error.stack ? parseStack(error.stack) : [];
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
const onKey = (e) => {
|
|
128
|
+
if (e.key === "Escape") onMinimize();
|
|
129
|
+
else if (e.key === "ArrowLeft" && total > 1) onPrev();
|
|
130
|
+
else if (e.key === "ArrowRight" && total > 1) onNext();
|
|
131
|
+
};
|
|
132
|
+
window.addEventListener("keydown", onKey);
|
|
133
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
134
|
+
}, [
|
|
135
|
+
onMinimize,
|
|
136
|
+
onPrev,
|
|
137
|
+
onNext,
|
|
138
|
+
total
|
|
139
|
+
]);
|
|
140
|
+
return /* @__PURE__ */ jsx("div", {
|
|
141
|
+
style: backdropStyle,
|
|
142
|
+
"data-testid": "vinext-dev-error-backdrop",
|
|
143
|
+
onClick: onMinimize,
|
|
144
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
145
|
+
role: "dialog",
|
|
146
|
+
"aria-modal": "true",
|
|
147
|
+
"aria-label": SOURCE_LABEL[error.source],
|
|
148
|
+
"data-testid": "vinext-dev-error-overlay",
|
|
149
|
+
style: dialogStyle,
|
|
150
|
+
onClick: (e) => e.stopPropagation(),
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ jsx("div", { style: accentBarStyle }),
|
|
153
|
+
/* @__PURE__ */ jsxs("header", {
|
|
154
|
+
style: headerStyle,
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsxs("div", {
|
|
157
|
+
style: headerLeftStyle,
|
|
158
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
159
|
+
"data-testid": "vinext-dev-error-title",
|
|
160
|
+
style: badgeStyle,
|
|
161
|
+
children: SOURCE_LABEL[error.source]
|
|
162
|
+
}), total > 1 ? /* @__PURE__ */ jsxs("div", {
|
|
163
|
+
"data-testid": "vinext-dev-error-pagination",
|
|
164
|
+
style: paginationStyle,
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx("button", {
|
|
167
|
+
type: "button",
|
|
168
|
+
"data-testid": "vinext-dev-error-prev",
|
|
169
|
+
onClick: onPrev,
|
|
170
|
+
disabled: index === 0,
|
|
171
|
+
className: "vinext-overlay-nav",
|
|
172
|
+
"aria-label": "Previous error",
|
|
173
|
+
children: "‹"
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ jsxs("span", {
|
|
176
|
+
"data-testid": "vinext-dev-error-counter",
|
|
177
|
+
style: counterStyle,
|
|
178
|
+
children: [
|
|
179
|
+
index + 1,
|
|
180
|
+
" of ",
|
|
181
|
+
total
|
|
182
|
+
]
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ jsx("button", {
|
|
185
|
+
type: "button",
|
|
186
|
+
"data-testid": "vinext-dev-error-next",
|
|
187
|
+
onClick: onNext,
|
|
188
|
+
disabled: index === total - 1,
|
|
189
|
+
className: "vinext-overlay-nav",
|
|
190
|
+
"aria-label": "Next error",
|
|
191
|
+
children: "›"
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
}) : null]
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ jsx("button", {
|
|
197
|
+
type: "button",
|
|
198
|
+
"data-testid": "vinext-dev-error-minimize",
|
|
199
|
+
onClick: onMinimize,
|
|
200
|
+
className: "vinext-overlay-minimize",
|
|
201
|
+
"aria-label": "Minimize",
|
|
202
|
+
title: "Minimize (Esc)",
|
|
203
|
+
children: "–"
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ jsx("button", {
|
|
206
|
+
type: "button",
|
|
207
|
+
"data-testid": "vinext-dev-error-close",
|
|
208
|
+
onClick: onDismiss,
|
|
209
|
+
className: "vinext-overlay-close",
|
|
210
|
+
"aria-label": "Dismiss",
|
|
211
|
+
title: "Dismiss all errors",
|
|
212
|
+
children: "×"
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
}),
|
|
216
|
+
/* @__PURE__ */ jsxs("div", {
|
|
217
|
+
style: bodyStyle,
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ jsx("h2", {
|
|
220
|
+
"data-testid": "vinext-dev-error-message",
|
|
221
|
+
style: messageStyle,
|
|
222
|
+
children: error.message
|
|
223
|
+
}),
|
|
224
|
+
frames.length > 0 ? /* @__PURE__ */ jsx("ol", {
|
|
225
|
+
"data-testid": "vinext-dev-error-stack",
|
|
226
|
+
style: stackListStyle,
|
|
227
|
+
children: frames.map((frame) => /* @__PURE__ */ jsxs("li", {
|
|
228
|
+
className: "vinext-overlay-frame",
|
|
229
|
+
style: stackItemStyle,
|
|
230
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
231
|
+
style: frameFnStyle,
|
|
232
|
+
children: frame.fn
|
|
233
|
+
}), frame.file ? /* @__PURE__ */ jsxs("span", {
|
|
234
|
+
style: frameLocStyle,
|
|
235
|
+
children: [
|
|
236
|
+
frame.file,
|
|
237
|
+
frame.line ? `:${frame.line}` : "",
|
|
238
|
+
frame.col ? `:${frame.col}` : ""
|
|
239
|
+
]
|
|
240
|
+
}) : null]
|
|
241
|
+
}, frame.key))
|
|
242
|
+
}) : null,
|
|
243
|
+
error.componentStack ? /* @__PURE__ */ jsxs("details", {
|
|
244
|
+
style: detailsStyle,
|
|
245
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
246
|
+
style: summaryStyle,
|
|
247
|
+
children: "Component stack"
|
|
248
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
249
|
+
"data-testid": "vinext-dev-error-component-stack",
|
|
250
|
+
style: componentStackStyle,
|
|
251
|
+
children: error.componentStack
|
|
252
|
+
})]
|
|
253
|
+
}) : null
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
]
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
const V8_PAREN_FRAME = /^(.*?)\s*\((.+):(\d+):(\d+)\)$/;
|
|
261
|
+
const V8_BARE_FRAME = /^(.+):(\d+):(\d+)$/;
|
|
262
|
+
const MOZ_FRAME = /^(.*?)@(.+):(\d+):(\d+)$/;
|
|
263
|
+
function parseStack(stack) {
|
|
264
|
+
const frames = [];
|
|
265
|
+
const seen = /* @__PURE__ */ new Map();
|
|
266
|
+
const pushFrame = (fn, file, line, col) => {
|
|
267
|
+
const base = `${fn}@${file ?? ""}:${line ?? ""}:${col ?? ""}`;
|
|
268
|
+
const count = (seen.get(base) ?? 0) + 1;
|
|
269
|
+
seen.set(base, count);
|
|
270
|
+
const key = count === 1 ? base : `${base}#${count}`;
|
|
271
|
+
frames.push({
|
|
272
|
+
key,
|
|
273
|
+
fn,
|
|
274
|
+
file,
|
|
275
|
+
line,
|
|
276
|
+
col
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
for (const raw of stack.split("\n")) {
|
|
280
|
+
const line = raw.trim();
|
|
281
|
+
if (!line) continue;
|
|
282
|
+
if (line.startsWith("at ")) {
|
|
283
|
+
const body = line.slice(3);
|
|
284
|
+
const parenMatch = body.match(V8_PAREN_FRAME);
|
|
285
|
+
if (parenMatch) {
|
|
286
|
+
pushFrame(parenMatch[1] || "<anonymous>", parenMatch[2], parenMatch[3], parenMatch[4]);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const bareMatch = body.match(V8_BARE_FRAME);
|
|
290
|
+
if (bareMatch) {
|
|
291
|
+
pushFrame("<anonymous>", bareMatch[1], bareMatch[2], bareMatch[3]);
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
pushFrame(body);
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
const mozMatch = line.match(MOZ_FRAME);
|
|
298
|
+
if (mozMatch) {
|
|
299
|
+
pushFrame(mozMatch[1] || "<anonymous>", mozMatch[2], mozMatch[3], mozMatch[4]);
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
pushFrame(line);
|
|
303
|
+
}
|
|
304
|
+
return frames;
|
|
305
|
+
}
|
|
306
|
+
const FONT_STACK = "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif";
|
|
307
|
+
const MONO_STACK = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
308
|
+
const overlayStylesheet = `
|
|
309
|
+
@keyframes vinextOverlayBackdropIn {
|
|
310
|
+
from { opacity: 0; }
|
|
311
|
+
to { opacity: 1; }
|
|
312
|
+
}
|
|
313
|
+
@keyframes vinextOverlayDialogIn {
|
|
314
|
+
from { opacity: 0; transform: translateY(8px) scale(0.98); }
|
|
315
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
316
|
+
}
|
|
317
|
+
@keyframes vinextOverlayIndicatorIn {
|
|
318
|
+
from { opacity: 0; transform: translateY(8px); }
|
|
319
|
+
to { opacity: 1; transform: translateY(0); }
|
|
320
|
+
}
|
|
321
|
+
.vinext-overlay-nav {
|
|
322
|
+
background: transparent;
|
|
323
|
+
border: none;
|
|
324
|
+
color: inherit;
|
|
325
|
+
cursor: pointer;
|
|
326
|
+
padding: 2px 8px;
|
|
327
|
+
font-size: 14px;
|
|
328
|
+
line-height: 1;
|
|
329
|
+
border-radius: 6px;
|
|
330
|
+
transition: background 0.12s ease;
|
|
331
|
+
}
|
|
332
|
+
.vinext-overlay-nav:hover:not(:disabled) {
|
|
333
|
+
background: rgba(255, 255, 255, 0.08);
|
|
334
|
+
}
|
|
335
|
+
.vinext-overlay-nav:disabled {
|
|
336
|
+
opacity: 0.35;
|
|
337
|
+
cursor: not-allowed;
|
|
338
|
+
}
|
|
339
|
+
.vinext-overlay-minimize,
|
|
340
|
+
.vinext-overlay-close {
|
|
341
|
+
background: transparent;
|
|
342
|
+
border: none;
|
|
343
|
+
color: #a1a1aa;
|
|
344
|
+
cursor: pointer;
|
|
345
|
+
font-size: 16px;
|
|
346
|
+
line-height: 1;
|
|
347
|
+
padding: 4px 8px;
|
|
348
|
+
border-radius: 6px;
|
|
349
|
+
transition: background 0.12s ease, color 0.12s ease;
|
|
350
|
+
}
|
|
351
|
+
.vinext-overlay-minimize:hover,
|
|
352
|
+
.vinext-overlay-close:hover {
|
|
353
|
+
background: rgba(255, 255, 255, 0.08);
|
|
354
|
+
color: #fafafa;
|
|
355
|
+
}
|
|
356
|
+
.vinext-overlay-close { font-size: 20px; }
|
|
357
|
+
.vinext-overlay-frame {
|
|
358
|
+
padding: 8px 12px;
|
|
359
|
+
border-radius: 6px;
|
|
360
|
+
transition: background 0.12s ease;
|
|
361
|
+
}
|
|
362
|
+
.vinext-overlay-frame:hover {
|
|
363
|
+
background: rgba(255, 255, 255, 0.04);
|
|
364
|
+
}
|
|
365
|
+
.vinext-overlay-indicator {
|
|
366
|
+
display: inline-flex;
|
|
367
|
+
align-items: center;
|
|
368
|
+
gap: 8px;
|
|
369
|
+
padding: 8px 14px;
|
|
370
|
+
border-radius: 999px;
|
|
371
|
+
background: #18181b;
|
|
372
|
+
color: #fafafa;
|
|
373
|
+
border: 1px solid rgba(239, 68, 68, 0.45);
|
|
374
|
+
font: 600 13px ${FONT_STACK};
|
|
375
|
+
cursor: pointer;
|
|
376
|
+
transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
|
|
377
|
+
animation: vinextOverlayIndicatorIn 0.18s ease-out;
|
|
378
|
+
}
|
|
379
|
+
.vinext-overlay-indicator:hover {
|
|
380
|
+
background: #1f1f23;
|
|
381
|
+
border-color: rgba(239, 68, 68, 0.7);
|
|
382
|
+
transform: translateY(-1px);
|
|
383
|
+
}
|
|
384
|
+
`;
|
|
385
|
+
const backdropStyle = {
|
|
386
|
+
position: "fixed",
|
|
387
|
+
inset: 0,
|
|
388
|
+
background: "rgba(10, 10, 12, 0.55)",
|
|
389
|
+
backdropFilter: "blur(3px)",
|
|
390
|
+
WebkitBackdropFilter: "blur(3px)",
|
|
391
|
+
display: "flex",
|
|
392
|
+
alignItems: "center",
|
|
393
|
+
justifyContent: "center",
|
|
394
|
+
padding: 24,
|
|
395
|
+
zIndex: 2147483646,
|
|
396
|
+
animation: "vinextOverlayBackdropIn 0.15s ease-out"
|
|
397
|
+
};
|
|
398
|
+
const dialogStyle = {
|
|
399
|
+
position: "relative",
|
|
400
|
+
pointerEvents: "auto",
|
|
401
|
+
width: "min(640px, 100%)",
|
|
402
|
+
maxHeight: "min(80vh, 720px)",
|
|
403
|
+
display: "flex",
|
|
404
|
+
flexDirection: "column",
|
|
405
|
+
background: "#0a0a0a",
|
|
406
|
+
color: "#fafafa",
|
|
407
|
+
border: "1px solid rgba(255, 255, 255, 0.08)",
|
|
408
|
+
borderRadius: 12,
|
|
409
|
+
fontFamily: FONT_STACK,
|
|
410
|
+
fontSize: 14,
|
|
411
|
+
lineHeight: 1.5,
|
|
412
|
+
overflow: "hidden",
|
|
413
|
+
animation: "vinextOverlayDialogIn 0.18s ease-out"
|
|
414
|
+
};
|
|
415
|
+
const indicatorContainerStyle = {
|
|
416
|
+
position: "fixed",
|
|
417
|
+
bottom: 16,
|
|
418
|
+
left: 16,
|
|
419
|
+
zIndex: 2147483646
|
|
420
|
+
};
|
|
421
|
+
const indicatorIconStyle = {
|
|
422
|
+
display: "inline-flex",
|
|
423
|
+
alignItems: "center",
|
|
424
|
+
justifyContent: "center",
|
|
425
|
+
color: "#ef4444",
|
|
426
|
+
fontSize: 14
|
|
427
|
+
};
|
|
428
|
+
const indicatorCountStyle = {
|
|
429
|
+
display: "inline-flex",
|
|
430
|
+
alignItems: "center",
|
|
431
|
+
justifyContent: "center",
|
|
432
|
+
minWidth: 18,
|
|
433
|
+
padding: "0 6px",
|
|
434
|
+
height: 18,
|
|
435
|
+
borderRadius: 999,
|
|
436
|
+
background: "rgba(239, 68, 68, 0.18)",
|
|
437
|
+
color: "#fca5a5",
|
|
438
|
+
fontSize: 11,
|
|
439
|
+
fontWeight: 600,
|
|
440
|
+
fontVariantNumeric: "tabular-nums"
|
|
441
|
+
};
|
|
442
|
+
const accentBarStyle = {
|
|
443
|
+
height: 3,
|
|
444
|
+
background: "linear-gradient(90deg, #ef4444 0%, #f97316 100%)"
|
|
445
|
+
};
|
|
446
|
+
const headerStyle = {
|
|
447
|
+
display: "flex",
|
|
448
|
+
alignItems: "center",
|
|
449
|
+
justifyContent: "space-between",
|
|
450
|
+
gap: 12,
|
|
451
|
+
padding: "14px 16px",
|
|
452
|
+
borderBottom: "1px solid rgba(255, 255, 255, 0.06)"
|
|
453
|
+
};
|
|
454
|
+
const headerLeftStyle = {
|
|
455
|
+
display: "flex",
|
|
456
|
+
alignItems: "center",
|
|
457
|
+
gap: 10,
|
|
458
|
+
minWidth: 0
|
|
459
|
+
};
|
|
460
|
+
const badgeStyle = {
|
|
461
|
+
display: "inline-flex",
|
|
462
|
+
alignItems: "center",
|
|
463
|
+
background: "rgba(239, 68, 68, 0.12)",
|
|
464
|
+
color: "#fca5a5",
|
|
465
|
+
border: "1px solid rgba(239, 68, 68, 0.25)",
|
|
466
|
+
padding: "3px 10px",
|
|
467
|
+
borderRadius: 999,
|
|
468
|
+
fontSize: 11,
|
|
469
|
+
fontWeight: 600,
|
|
470
|
+
letterSpacing: .2,
|
|
471
|
+
textTransform: "uppercase",
|
|
472
|
+
whiteSpace: "nowrap"
|
|
473
|
+
};
|
|
474
|
+
const paginationStyle = {
|
|
475
|
+
display: "flex",
|
|
476
|
+
alignItems: "center",
|
|
477
|
+
gap: 2,
|
|
478
|
+
color: "#a1a1aa",
|
|
479
|
+
fontSize: 12
|
|
480
|
+
};
|
|
481
|
+
const counterStyle = {
|
|
482
|
+
padding: "0 4px",
|
|
483
|
+
fontVariantNumeric: "tabular-nums"
|
|
484
|
+
};
|
|
485
|
+
const bodyStyle = {
|
|
486
|
+
padding: "16px 20px 20px",
|
|
487
|
+
overflow: "auto",
|
|
488
|
+
flex: 1
|
|
489
|
+
};
|
|
490
|
+
const messageStyle = {
|
|
491
|
+
margin: "0 0 16px 0",
|
|
492
|
+
fontFamily: MONO_STACK,
|
|
493
|
+
fontSize: 16,
|
|
494
|
+
fontWeight: 500,
|
|
495
|
+
lineHeight: 1.45,
|
|
496
|
+
color: "#fafafa",
|
|
497
|
+
whiteSpace: "pre-wrap",
|
|
498
|
+
wordBreak: "break-word"
|
|
499
|
+
};
|
|
500
|
+
const stackListStyle = {
|
|
501
|
+
listStyle: "none",
|
|
502
|
+
margin: 0,
|
|
503
|
+
padding: 0,
|
|
504
|
+
display: "flex",
|
|
505
|
+
flexDirection: "column",
|
|
506
|
+
gap: 2,
|
|
507
|
+
fontFamily: MONO_STACK,
|
|
508
|
+
fontSize: 12
|
|
509
|
+
};
|
|
510
|
+
const stackItemStyle = {
|
|
511
|
+
display: "flex",
|
|
512
|
+
flexDirection: "column",
|
|
513
|
+
gap: 2,
|
|
514
|
+
cursor: "default"
|
|
515
|
+
};
|
|
516
|
+
const frameFnStyle = {
|
|
517
|
+
color: "#fafafa",
|
|
518
|
+
fontWeight: 500
|
|
519
|
+
};
|
|
520
|
+
const frameLocStyle = {
|
|
521
|
+
color: "#71717a",
|
|
522
|
+
fontSize: 11
|
|
523
|
+
};
|
|
524
|
+
const detailsStyle = {
|
|
525
|
+
marginTop: 16,
|
|
526
|
+
paddingTop: 12,
|
|
527
|
+
borderTop: "1px solid rgba(255, 255, 255, 0.06)",
|
|
528
|
+
color: "#a1a1aa",
|
|
529
|
+
fontSize: 12
|
|
530
|
+
};
|
|
531
|
+
const summaryStyle = {
|
|
532
|
+
cursor: "pointer",
|
|
533
|
+
userSelect: "none",
|
|
534
|
+
padding: "4px 0",
|
|
535
|
+
color: "#a1a1aa",
|
|
536
|
+
fontWeight: 500
|
|
537
|
+
};
|
|
538
|
+
const componentStackStyle = {
|
|
539
|
+
margin: "8px 0 0 0",
|
|
540
|
+
fontFamily: MONO_STACK,
|
|
541
|
+
whiteSpace: "pre-wrap",
|
|
542
|
+
wordBreak: "break-word",
|
|
543
|
+
color: "#a1a1aa"
|
|
544
|
+
};
|
|
545
|
+
//#endregion
|
|
546
|
+
export { devOnCaughtError, devOnUncaughtError, dismissOverlay, installDevErrorOverlay };
|
|
547
|
+
|
|
548
|
+
//# sourceMappingURL=dev-error-overlay.js.map
|