@absolutejs/absolute 0.19.0-beta.835 → 0.19.0-beta.837
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/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/dev/client/errorOverlay.ts +295 -32
- package/dist/dev/client/hmrClient.ts +6 -8
- package/dist/index.js +3 -3
- package/dist/index.js.map +4 -4
- package/dist/types/client.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-7GOEb9/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-7GOEb9/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
|
48
48
|
getWarningController()?.maybeWarn(primitiveName);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// .angular-partial-tmp-
|
|
51
|
+
// .angular-partial-tmp-7GOEb9/src/core/streamingSlotRegistry.ts
|
|
52
52
|
var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
|
|
53
53
|
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
54
54
|
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -6,6 +6,16 @@ import { OVERLAY_FADE_DURATION_MS } from './constants';
|
|
|
6
6
|
|
|
7
7
|
let errorOverlayElement: HTMLDivElement | null = null;
|
|
8
8
|
let currentOverlayKind: 'compilation' | 'runtime' | null = null;
|
|
9
|
+
// Runtime errors accumulate so a second uncaught error in the same tick
|
|
10
|
+
// doesn't silently replace the first — the overlay shows nav buttons and
|
|
11
|
+
// a "N of M" badge so you can step through them.
|
|
12
|
+
const runtimeErrors: ErrorOverlayOptions[] = [];
|
|
13
|
+
let activeRuntimeIndex = 0;
|
|
14
|
+
let pendingCompilationOpts: ErrorOverlayOptions | null = null;
|
|
15
|
+
// Tracks which queue renderOverlay should pull from. Driven by
|
|
16
|
+
// showErrorOverlay BEFORE renderOverlay runs so the choice is unambiguous
|
|
17
|
+
// (currentOverlayKind reflects what's currently mounted, not what's queued).
|
|
18
|
+
let activeMode: 'runtime' | 'compilation' | null = null;
|
|
9
19
|
|
|
10
20
|
const frameworkLabels: Record<string, string> = {
|
|
11
21
|
angular: 'Angular',
|
|
@@ -39,6 +49,12 @@ const removeOverlayElement = () => {
|
|
|
39
49
|
|
|
40
50
|
export const hideErrorOverlay = () => {
|
|
41
51
|
const elm = errorOverlayElement;
|
|
52
|
+
// Clearing on dismiss — if more errors arrive after this they get a
|
|
53
|
+
// fresh overlay, otherwise stale entries accumulate forever.
|
|
54
|
+
runtimeErrors.length = 0;
|
|
55
|
+
activeRuntimeIndex = 0;
|
|
56
|
+
pendingCompilationOpts = null;
|
|
57
|
+
activeMode = null;
|
|
42
58
|
if (!elm || !elm.parentNode) {
|
|
43
59
|
removeOverlayElement();
|
|
44
60
|
|
|
@@ -55,6 +71,11 @@ export const hideErrorOverlay = () => {
|
|
|
55
71
|
|
|
56
72
|
export const isRuntimeErrorOverlay = () => currentOverlayKind === 'runtime';
|
|
57
73
|
|
|
74
|
+
const sectionLabelStyle =
|
|
75
|
+
'font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px;';
|
|
76
|
+
const codeBlockStyle =
|
|
77
|
+
'margin:0;padding:14px 18px;background:rgba(15,23,42,0.8);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:12.5px;line-height:1.55;overflow-x:auto;white-space:pre;font-family:inherit;';
|
|
78
|
+
|
|
58
79
|
const buildLocationSection = (
|
|
59
80
|
file: string | undefined,
|
|
60
81
|
line: number | undefined,
|
|
@@ -69,8 +90,7 @@ const buildLocationSection = (
|
|
|
69
90
|
locSection.style.cssText = 'margin-bottom:20px;';
|
|
70
91
|
|
|
71
92
|
const locLabel = document.createElement('div');
|
|
72
|
-
locLabel.style.cssText =
|
|
73
|
-
'font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px;';
|
|
93
|
+
locLabel.style.cssText = sectionLabelStyle;
|
|
74
94
|
locLabel.textContent = 'Where';
|
|
75
95
|
locSection.appendChild(locLabel);
|
|
76
96
|
|
|
@@ -82,14 +102,13 @@ const buildLocationSection = (
|
|
|
82
102
|
|
|
83
103
|
const locEl = document.createElement('div');
|
|
84
104
|
locEl.style.cssText =
|
|
85
|
-
'padding:12px
|
|
105
|
+
'padding:12px 18px;background:rgba(71,85,105,0.3);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:13px;word-break:break-all;';
|
|
86
106
|
locEl.textContent = loc;
|
|
87
107
|
locSection.appendChild(locEl);
|
|
88
108
|
|
|
89
109
|
if (lineText) {
|
|
90
110
|
const codeBlock = document.createElement('pre');
|
|
91
|
-
codeBlock.style.cssText =
|
|
92
|
-
'margin:8px 0 0;padding:14px 20px;background:rgba(15,23,42,0.8);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#94a3b8;font-size:13px;overflow-x:auto;white-space:pre;';
|
|
111
|
+
codeBlock.style.cssText = codeBlockStyle + 'margin-top:8px;';
|
|
93
112
|
codeBlock.textContent = lineText;
|
|
94
113
|
locSection.appendChild(codeBlock);
|
|
95
114
|
}
|
|
@@ -97,12 +116,161 @@ const buildLocationSection = (
|
|
|
97
116
|
return locSection;
|
|
98
117
|
};
|
|
99
118
|
|
|
100
|
-
|
|
119
|
+
// Strip the leading `${ErrorName}: ${message}` line from a stack if it just
|
|
120
|
+
// repeats what's already shown in the "What went wrong" panel — keeps the
|
|
121
|
+
// stack panel focused on frames.
|
|
122
|
+
const cleanStack = (message: string, stack: string) => {
|
|
123
|
+
const firstNewline = stack.indexOf('\n');
|
|
124
|
+
if (firstNewline === -1) return stack;
|
|
125
|
+
const head = stack.slice(0, firstNewline).trim();
|
|
126
|
+
if (head === message || head.endsWith(`: ${message}`)) {
|
|
127
|
+
return stack.slice(firstNewline + 1).replace(/^\n+/, '');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return stack;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const buildStackSection = (stack: string | undefined, message: string) => {
|
|
134
|
+
if (!stack) return null;
|
|
135
|
+
const cleaned = cleanStack(message, stack);
|
|
136
|
+
if (!cleaned.trim()) return null;
|
|
137
|
+
const section = document.createElement('div');
|
|
138
|
+
section.style.cssText = 'margin-bottom:20px;';
|
|
139
|
+
const label = document.createElement('div');
|
|
140
|
+
label.style.cssText = sectionLabelStyle;
|
|
141
|
+
label.textContent = 'Stack';
|
|
142
|
+
section.appendChild(label);
|
|
143
|
+
const pre = document.createElement('pre');
|
|
144
|
+
pre.style.cssText = codeBlockStyle + 'max-height:300px;overflow-y:auto;';
|
|
145
|
+
pre.textContent = cleaned;
|
|
146
|
+
section.appendChild(pre);
|
|
147
|
+
|
|
148
|
+
return section;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Reads the live document for every <script src> currently mounted.
|
|
152
|
+
// Most useful diagnostic for "I'm seeing a chunk hash that no longer
|
|
153
|
+
// exists on disk" — confirms which bundle the browser actually loaded.
|
|
154
|
+
const collectLoadedScripts = () => {
|
|
155
|
+
const scripts = Array.from(document.querySelectorAll('script[src]'));
|
|
156
|
+
const urls: string[] = [];
|
|
157
|
+
for (const script of scripts) {
|
|
158
|
+
const src = (script as HTMLScriptElement).src;
|
|
159
|
+
if (!src) continue;
|
|
160
|
+
// Filter to JS we serve — vendor chunks, generated indexes, root
|
|
161
|
+
// chunk-XXX.js outputs. Skip user-pasted CDN scripts and the like.
|
|
162
|
+
if (
|
|
163
|
+
src.includes('/vendor/') ||
|
|
164
|
+
src.includes('/generated/') ||
|
|
165
|
+
/\/chunk-[a-z0-9]+\.js(\?|$)/i.test(src) ||
|
|
166
|
+
src.includes('/_src_indexes/')
|
|
167
|
+
) {
|
|
168
|
+
urls.push(src);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return urls;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const buildDiagnosticsSection = () => {
|
|
176
|
+
const section = document.createElement('div');
|
|
177
|
+
section.style.cssText = 'margin-bottom:20px;';
|
|
178
|
+
const label = document.createElement('div');
|
|
179
|
+
label.style.cssText = sectionLabelStyle;
|
|
180
|
+
label.textContent = 'Diagnostics';
|
|
181
|
+
section.appendChild(label);
|
|
182
|
+
|
|
183
|
+
const lines: string[] = [];
|
|
184
|
+
lines.push(`Page URL: ${window.location.href}`);
|
|
185
|
+
const ua = navigator.userAgent;
|
|
186
|
+
lines.push(`User agent: ${ua}`);
|
|
187
|
+
const scripts = collectLoadedScripts();
|
|
188
|
+
if (scripts.length > 0) {
|
|
189
|
+
lines.push('');
|
|
190
|
+
lines.push(`Loaded chunks (${scripts.length}):`);
|
|
191
|
+
for (const url of scripts) {
|
|
192
|
+
// Strip origin so the chunk hash is the focal point.
|
|
193
|
+
lines.push(
|
|
194
|
+
` ${url.replace(window.location.origin, '') || url}`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const pre = document.createElement('pre');
|
|
200
|
+
pre.style.cssText = codeBlockStyle + 'max-height:200px;overflow-y:auto;';
|
|
201
|
+
pre.textContent = lines.join('\n');
|
|
202
|
+
section.appendChild(pre);
|
|
203
|
+
|
|
204
|
+
return section;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const buildErrorMessageSection = (message: string) => {
|
|
208
|
+
const errorSection = document.createElement('div');
|
|
209
|
+
errorSection.style.cssText = 'margin-bottom:20px;';
|
|
210
|
+
const errorLabel = document.createElement('div');
|
|
211
|
+
errorLabel.style.cssText = sectionLabelStyle;
|
|
212
|
+
errorLabel.textContent = 'What went wrong';
|
|
213
|
+
errorSection.appendChild(errorLabel);
|
|
214
|
+
const msgEl = document.createElement('pre');
|
|
215
|
+
msgEl.style.cssText =
|
|
216
|
+
'margin:0;padding:16px 20px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.25);border-radius:10px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;color:#fca5a5;font-size:13px;line-height:1.5;font-family:inherit;';
|
|
217
|
+
msgEl.textContent = message;
|
|
218
|
+
errorSection.appendChild(msgEl);
|
|
219
|
+
|
|
220
|
+
return errorSection;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const formatErrorForCopy = (opts: ErrorOverlayOptions) => {
|
|
224
|
+
const lines: string[] = [];
|
|
225
|
+
lines.push(`# ${opts.kind === 'runtime' ? 'Runtime' : 'Compilation'} error`);
|
|
226
|
+
if (opts.framework) lines.push(`Framework: ${opts.framework}`);
|
|
227
|
+
lines.push('');
|
|
228
|
+
lines.push('## Message');
|
|
229
|
+
lines.push(opts.message || '(no message)');
|
|
230
|
+
if (opts.file || opts.line !== undefined) {
|
|
231
|
+
lines.push('');
|
|
232
|
+
lines.push('## Where');
|
|
233
|
+
const locParts: string[] = [];
|
|
234
|
+
if (opts.file) locParts.push(opts.file);
|
|
235
|
+
if (opts.line !== undefined) locParts.push(String(opts.line));
|
|
236
|
+
if (opts.column !== undefined) locParts.push(String(opts.column));
|
|
237
|
+
lines.push(locParts.join(':'));
|
|
238
|
+
if (opts.lineText) {
|
|
239
|
+
lines.push('');
|
|
240
|
+
lines.push(opts.lineText);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (opts.stack) {
|
|
244
|
+
lines.push('');
|
|
245
|
+
lines.push('## Stack');
|
|
246
|
+
lines.push(cleanStack(opts.message || '', opts.stack));
|
|
247
|
+
}
|
|
248
|
+
lines.push('');
|
|
249
|
+
lines.push('## Diagnostics');
|
|
250
|
+
lines.push(`Page URL: ${window.location.href}`);
|
|
251
|
+
lines.push(`User agent: ${navigator.userAgent}`);
|
|
252
|
+
const scripts = collectLoadedScripts();
|
|
253
|
+
if (scripts.length > 0) {
|
|
254
|
+
lines.push('');
|
|
255
|
+
lines.push(`Loaded chunks (${scripts.length}):`);
|
|
256
|
+
for (const url of scripts) {
|
|
257
|
+
lines.push(
|
|
258
|
+
` ${url.replace(window.location.origin, '') || url}`
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return lines.join('\n');
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const renderOverlay = () => {
|
|
267
|
+
const opts =
|
|
268
|
+
activeMode === 'runtime'
|
|
269
|
+
? runtimeErrors[activeRuntimeIndex]
|
|
270
|
+
: pendingCompilationOpts;
|
|
271
|
+
if (!opts) return;
|
|
101
272
|
const message = opts.message || 'Build failed';
|
|
102
|
-
const { file } = opts;
|
|
103
|
-
const { line } = opts;
|
|
104
|
-
const { column } = opts;
|
|
105
|
-
const { lineText } = opts;
|
|
273
|
+
const { file, line, column, lineText, stack } = opts;
|
|
106
274
|
const framework = (opts.framework || 'unknown').toLowerCase();
|
|
107
275
|
const frameworkLabel = frameworkLabels[framework] || framework;
|
|
108
276
|
const accent = frameworkColors[framework] || '#94a3b8';
|
|
@@ -118,7 +286,7 @@ export const showErrorOverlay = (opts: ErrorOverlayOptions) => {
|
|
|
118
286
|
|
|
119
287
|
const card = document.createElement('div');
|
|
120
288
|
card.style.cssText =
|
|
121
|
-
'max-width:
|
|
289
|
+
'max-width:780px;width:100%;background:rgba(30,41,59,0.6);border:1px solid rgba(71,85,105,0.5);border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);overflow:hidden;';
|
|
122
290
|
|
|
123
291
|
const header = document.createElement('div');
|
|
124
292
|
header.style.cssText =
|
|
@@ -135,41 +303,109 @@ export const showErrorOverlay = (opts: ErrorOverlayOptions) => {
|
|
|
135
303
|
const content = document.createElement('div');
|
|
136
304
|
content.style.cssText = 'padding:24px;';
|
|
137
305
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
306
|
+
// Multi-error nav: visible only when more than one runtime error has
|
|
307
|
+
// fired since the last dismiss. Compilation errors always replace, so
|
|
308
|
+
// they never need this row.
|
|
309
|
+
if (activeMode === 'runtime' && runtimeErrors.length > 1) {
|
|
310
|
+
const navRow = document.createElement('div');
|
|
311
|
+
navRow.style.cssText =
|
|
312
|
+
'display:flex;align-items:center;gap:12px;margin-bottom:20px;padding:10px 14px;background:rgba(71,85,105,0.25);border-radius:10px;border:1px solid rgba(71,85,105,0.4);';
|
|
313
|
+
const prev = document.createElement('button');
|
|
314
|
+
prev.textContent = '◀';
|
|
315
|
+
prev.style.cssText =
|
|
316
|
+
'padding:4px 10px;background:rgba(15,23,42,0.6);color:#cbd5e1;border:1px solid rgba(71,85,105,0.6);border-radius:6px;font-size:13px;cursor:pointer;font-family:inherit;';
|
|
317
|
+
prev.disabled = activeRuntimeIndex === 0;
|
|
318
|
+
if (prev.disabled) prev.style.opacity = '0.4';
|
|
319
|
+
prev.onclick = () => {
|
|
320
|
+
if (activeRuntimeIndex > 0) {
|
|
321
|
+
activeRuntimeIndex -= 1;
|
|
322
|
+
renderOverlay();
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
const next = document.createElement('button');
|
|
326
|
+
next.textContent = '▶';
|
|
327
|
+
next.style.cssText = prev.style.cssText;
|
|
328
|
+
next.disabled = activeRuntimeIndex >= runtimeErrors.length - 1;
|
|
329
|
+
if (next.disabled) next.style.opacity = '0.4';
|
|
330
|
+
next.onclick = () => {
|
|
331
|
+
if (activeRuntimeIndex < runtimeErrors.length - 1) {
|
|
332
|
+
activeRuntimeIndex += 1;
|
|
333
|
+
renderOverlay();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
const counter = document.createElement('span');
|
|
337
|
+
counter.style.cssText = 'color:#cbd5e1;font-size:13px;';
|
|
338
|
+
counter.textContent = `Error ${activeRuntimeIndex + 1} of ${runtimeErrors.length}`;
|
|
339
|
+
navRow.appendChild(prev);
|
|
340
|
+
navRow.appendChild(next);
|
|
341
|
+
navRow.appendChild(counter);
|
|
342
|
+
content.appendChild(navRow);
|
|
343
|
+
}
|
|
153
344
|
|
|
345
|
+
content.appendChild(buildErrorMessageSection(message));
|
|
154
346
|
const locSection = buildLocationSection(file, line, column, lineText);
|
|
155
|
-
if (locSection)
|
|
156
|
-
|
|
347
|
+
if (locSection) content.appendChild(locSection);
|
|
348
|
+
const stackSection = buildStackSection(stack, message);
|
|
349
|
+
if (stackSection) content.appendChild(stackSection);
|
|
350
|
+
if (activeMode === 'runtime') {
|
|
351
|
+
content.appendChild(buildDiagnosticsSection());
|
|
157
352
|
}
|
|
158
353
|
|
|
159
354
|
const footer = document.createElement('div');
|
|
160
355
|
footer.style.cssText =
|
|
161
|
-
'display:flex;justify-content:flex-end;padding-top:8px;';
|
|
356
|
+
'display:flex;justify-content:flex-end;gap:10px;padding-top:8px;';
|
|
357
|
+
|
|
358
|
+
const copy = document.createElement('button');
|
|
359
|
+
copy.textContent = 'Copy';
|
|
360
|
+
copy.style.cssText =
|
|
361
|
+
'padding:10px 16px;background:rgba(71,85,105,0.4);color:#e2e8f0;border:1px solid rgba(71,85,105,0.6);border-radius:10px;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;transition:opacity 0.15s,transform 0.15s;';
|
|
362
|
+
copy.onmouseover = () => {
|
|
363
|
+
copy.style.opacity = '0.85';
|
|
364
|
+
};
|
|
365
|
+
copy.onmouseout = () => {
|
|
366
|
+
copy.style.opacity = '1';
|
|
367
|
+
};
|
|
368
|
+
copy.onclick = async () => {
|
|
369
|
+
const text = formatErrorForCopy(opts);
|
|
370
|
+
try {
|
|
371
|
+
await navigator.clipboard.writeText(text);
|
|
372
|
+
copy.textContent = 'Copied';
|
|
373
|
+
setTimeout(() => {
|
|
374
|
+
copy.textContent = 'Copy';
|
|
375
|
+
}, 1500);
|
|
376
|
+
} catch {
|
|
377
|
+
// Clipboard API requires a user gesture + permissions; fall back
|
|
378
|
+
// to a textarea + execCommand so the button still does something.
|
|
379
|
+
const ta = document.createElement('textarea');
|
|
380
|
+
ta.value = text;
|
|
381
|
+
ta.style.position = 'fixed';
|
|
382
|
+
ta.style.opacity = '0';
|
|
383
|
+
document.body.appendChild(ta);
|
|
384
|
+
ta.select();
|
|
385
|
+
try {
|
|
386
|
+
document.execCommand('copy');
|
|
387
|
+
copy.textContent = 'Copied';
|
|
388
|
+
setTimeout(() => {
|
|
389
|
+
copy.textContent = 'Copy';
|
|
390
|
+
}, 1500);
|
|
391
|
+
} catch {
|
|
392
|
+
copy.textContent = 'Copy failed';
|
|
393
|
+
}
|
|
394
|
+
document.body.removeChild(ta);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
footer.appendChild(copy);
|
|
162
398
|
|
|
163
399
|
const dismiss = document.createElement('button');
|
|
164
400
|
dismiss.textContent = 'Dismiss';
|
|
165
401
|
dismiss.style.cssText = `padding:10px 20px;background:${
|
|
166
402
|
accent
|
|
167
|
-
};color:#fff;border:none;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,0.2);transition:opacity 0.15s,transform 0.15s;`;
|
|
168
|
-
dismiss.onmouseover =
|
|
403
|
+
};color:#fff;border:none;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;box-shadow:0 2px 8px rgba(0,0,0,0.2);transition:opacity 0.15s,transform 0.15s;`;
|
|
404
|
+
dismiss.onmouseover = () => {
|
|
169
405
|
dismiss.style.opacity = '0.9';
|
|
170
406
|
dismiss.style.transform = 'translateY(-1px)';
|
|
171
407
|
};
|
|
172
|
-
dismiss.onmouseout =
|
|
408
|
+
dismiss.onmouseout = () => {
|
|
173
409
|
dismiss.style.opacity = '1';
|
|
174
410
|
dismiss.style.transform = 'translateY(0)';
|
|
175
411
|
};
|
|
@@ -182,3 +418,30 @@ export const showErrorOverlay = (opts: ErrorOverlayOptions) => {
|
|
|
182
418
|
document.body.appendChild(overlay);
|
|
183
419
|
errorOverlayElement = overlay;
|
|
184
420
|
};
|
|
421
|
+
|
|
422
|
+
export const showErrorOverlay = (opts: ErrorOverlayOptions) => {
|
|
423
|
+
const kind = opts.kind || 'compilation';
|
|
424
|
+
activeMode = kind;
|
|
425
|
+
if (kind === 'runtime') {
|
|
426
|
+
// Suppress duplicates — Angular and other frameworks often re-throw
|
|
427
|
+
// the same error from multiple async boundaries (zone, scheduler,
|
|
428
|
+
// resolver). Identifying by message+stack catches the common case
|
|
429
|
+
// without needing structured equality.
|
|
430
|
+
const sig = `${opts.message ?? ''}::${opts.stack ?? ''}`;
|
|
431
|
+
const isDup = runtimeErrors.some(
|
|
432
|
+
(prev) => `${prev.message ?? ''}::${prev.stack ?? ''}` === sig
|
|
433
|
+
);
|
|
434
|
+
if (!isDup) {
|
|
435
|
+
runtimeErrors.push(opts);
|
|
436
|
+
activeRuntimeIndex = runtimeErrors.length - 1;
|
|
437
|
+
}
|
|
438
|
+
} else {
|
|
439
|
+
pendingCompilationOpts = opts;
|
|
440
|
+
// Compilation errors are global build state — reset runtime queue
|
|
441
|
+
// since old runtime errors from before the build attempt aren't
|
|
442
|
+
// actionable anymore.
|
|
443
|
+
runtimeErrors.length = 0;
|
|
444
|
+
activeRuntimeIndex = 0;
|
|
445
|
+
}
|
|
446
|
+
renderOverlay();
|
|
447
|
+
};
|
|
@@ -47,25 +47,23 @@ if (typeof window !== 'undefined') {
|
|
|
47
47
|
// Catch uncaught runtime errors and show the error overlay
|
|
48
48
|
window.addEventListener('error', (evt) => {
|
|
49
49
|
if (!evt.error) return;
|
|
50
|
+
const isErr = evt.error instanceof Error;
|
|
50
51
|
showErrorOverlay({
|
|
51
52
|
framework: detectCurrentFramework() || undefined,
|
|
52
53
|
kind: 'runtime',
|
|
53
|
-
message:
|
|
54
|
-
|
|
55
|
-
? evt.error.stack || evt.error.message
|
|
56
|
-
: String(evt.error)
|
|
54
|
+
message: isErr ? evt.error.message : String(evt.error),
|
|
55
|
+
stack: isErr ? evt.error.stack : undefined
|
|
57
56
|
});
|
|
58
57
|
});
|
|
59
58
|
|
|
60
59
|
window.addEventListener('unhandledrejection', (evt) => {
|
|
61
60
|
if (!evt.reason) return;
|
|
61
|
+
const isErr = evt.reason instanceof Error;
|
|
62
62
|
showErrorOverlay({
|
|
63
63
|
framework: detectCurrentFramework() || undefined,
|
|
64
64
|
kind: 'runtime',
|
|
65
|
-
message:
|
|
66
|
-
|
|
67
|
-
? evt.reason.stack || evt.reason.message
|
|
68
|
-
: String(evt.reason)
|
|
65
|
+
message: isErr ? evt.reason.message : String(evt.reason),
|
|
66
|
+
stack: isErr ? evt.reason.stack : undefined
|
|
69
67
|
});
|
|
70
68
|
});
|
|
71
69
|
|
package/dist/index.js
CHANGED
|
@@ -18309,7 +18309,7 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
18309
18309
|
if (bytes) {
|
|
18310
18310
|
return new Response(new Uint8Array(bytes).buffer, {
|
|
18311
18311
|
headers: {
|
|
18312
|
-
"Cache-Control": "no-
|
|
18312
|
+
"Cache-Control": "no-store",
|
|
18313
18313
|
"Content-Type": getMimeType(pathname)
|
|
18314
18314
|
}
|
|
18315
18315
|
});
|
|
@@ -18318,7 +18318,7 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
18318
18318
|
if (aliasedTarget) {
|
|
18319
18319
|
return new Response(null, {
|
|
18320
18320
|
headers: {
|
|
18321
|
-
"Cache-Control": "no-
|
|
18321
|
+
"Cache-Control": "no-store",
|
|
18322
18322
|
Location: aliasedTarget
|
|
18323
18323
|
},
|
|
18324
18324
|
status: 302
|
|
@@ -26751,5 +26751,5 @@ export {
|
|
|
26751
26751
|
ANGULAR_INIT_TIMEOUT_MS
|
|
26752
26752
|
};
|
|
26753
26753
|
|
|
26754
|
-
//# debugId=
|
|
26754
|
+
//# debugId=37D59544622087A264756E2164756E21
|
|
26755
26755
|
//# sourceMappingURL=index.js.map
|