@absolutejs/absolute 0.19.0-beta.1065 → 0.19.0-beta.1066
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/build.js +9 -2
- package/dist/build.js.map +4 -4
- package/dist/dev/client/handlers/html.ts +53 -11
- package/dist/index.js +9 -2
- package/dist/index.js.map +4 -4
- package/dist/src/dev/clientManager.d.ts +1 -0
- package/package.json +1 -1
|
@@ -179,14 +179,19 @@ const updateHTMLBody = (
|
|
|
179
179
|
const domSnapshot = snapshotDOMChanges(container);
|
|
180
180
|
|
|
181
181
|
const existingScripts = collectScripts(container);
|
|
182
|
+
const oldInlineScripts = collectInlineScripts(container);
|
|
182
183
|
const hmrScript = container.querySelector('script[data-hmr-client]');
|
|
183
184
|
const tempDiv = document.createElement('div');
|
|
184
185
|
tempDiv.innerHTML = htmlBody;
|
|
185
186
|
const newScripts = collectScriptsFromElement(tempDiv);
|
|
187
|
+
const newInlineScripts = collectInlineScripts(tempDiv);
|
|
186
188
|
|
|
187
189
|
const htmlStructureChanged = didHTMLStructureChange(container, tempDiv);
|
|
190
|
+
const scriptsChanged =
|
|
191
|
+
didScriptsChange(existingScripts, newScripts) ||
|
|
192
|
+
didInlineScriptsChange(oldInlineScripts, newInlineScripts);
|
|
188
193
|
|
|
189
|
-
if (htmlStructureChanged ||
|
|
194
|
+
if (htmlStructureChanged || scriptsChanged) {
|
|
190
195
|
patchDOMInPlace(container, htmlBody);
|
|
191
196
|
restoreDOMChanges(container, domSnapshot, htmlBody);
|
|
192
197
|
}
|
|
@@ -198,12 +203,12 @@ const updateHTMLBody = (
|
|
|
198
203
|
restoreFormState(savedState.forms);
|
|
199
204
|
restoreScrollState(savedState.scroll);
|
|
200
205
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
) {
|
|
206
|
+
// Only touch scripts/interactive elements when a script actually
|
|
207
|
+
// changed. A pure markup edit (e.g. a heading) leaves inline-script
|
|
208
|
+
// state and `addEventListener` handlers intact.
|
|
209
|
+
if (scriptsChanged) {
|
|
205
210
|
cloneInteractiveElements(container);
|
|
206
|
-
reExecuteScripts(container, newScripts);
|
|
211
|
+
reExecuteScripts(container, newScripts, oldInlineScripts);
|
|
207
212
|
}
|
|
208
213
|
});
|
|
209
214
|
sessionStorage.removeItem('__HMR_ACTIVE__');
|
|
@@ -245,6 +250,7 @@ const updateHTMLBodyDirect = (
|
|
|
245
250
|
const savedState = saveHTMLState();
|
|
246
251
|
const domSnapshot = snapshotDOMChanges(container);
|
|
247
252
|
|
|
253
|
+
const oldInlineScripts = collectInlineScripts(container);
|
|
248
254
|
const tempDiv = document.createElement('div');
|
|
249
255
|
tempDiv.innerHTML = htmlBody;
|
|
250
256
|
const newScripts = collectScriptsFromElement(tempDiv);
|
|
@@ -271,8 +277,7 @@ const updateHTMLBodyDirect = (
|
|
|
271
277
|
container.appendChild(newScript);
|
|
272
278
|
});
|
|
273
279
|
|
|
274
|
-
|
|
275
|
-
inlineScripts.forEach(replaceInlineScript);
|
|
280
|
+
reExecuteInlineScripts(container, oldInlineScripts);
|
|
276
281
|
});
|
|
277
282
|
sessionStorage.removeItem('__HMR_ACTIVE__');
|
|
278
283
|
};
|
|
@@ -291,6 +296,21 @@ const collectScriptsFromElement = (elem: HTMLElement) =>
|
|
|
291
296
|
type: script.getAttribute('type') || 'text/javascript'
|
|
292
297
|
}));
|
|
293
298
|
|
|
299
|
+
/* Inline (non-src) scripts, excluding the HMR client. Captured by ordinal so
|
|
300
|
+
* an unchanged inline script can be skipped on re-execution — re-running it
|
|
301
|
+
* would reset its module/global state (e.g. `let count = 0`) on every edit. */
|
|
302
|
+
const collectInlineScripts = (elem: HTMLElement) =>
|
|
303
|
+
Array.from(
|
|
304
|
+
elem.querySelectorAll('script:not([src]):not([data-hmr-client])')
|
|
305
|
+
).map((script) => script.textContent || '');
|
|
306
|
+
|
|
307
|
+
const didInlineScriptsChange = (
|
|
308
|
+
oldInline: string[],
|
|
309
|
+
newInline: string[]
|
|
310
|
+
) =>
|
|
311
|
+
oldInline.length !== newInline.length ||
|
|
312
|
+
oldInline.some((content, idx) => content !== newInline[idx]);
|
|
313
|
+
|
|
294
314
|
const didScriptsChange = (oldScripts: ScriptInfo[], newScripts: ScriptInfo[]) =>
|
|
295
315
|
oldScripts.length !== newScripts.length ||
|
|
296
316
|
oldScripts.some((oldScript, idx) => {
|
|
@@ -348,7 +368,11 @@ const removeOldScripts = (container: HTMLElement) => {
|
|
|
348
368
|
});
|
|
349
369
|
};
|
|
350
370
|
|
|
351
|
-
const reExecuteScripts = (
|
|
371
|
+
const reExecuteScripts = (
|
|
372
|
+
container: HTMLElement,
|
|
373
|
+
newScripts: ScriptInfo[],
|
|
374
|
+
oldInlineScripts: string[]
|
|
375
|
+
) => {
|
|
352
376
|
removeOldScripts(container);
|
|
353
377
|
|
|
354
378
|
newScripts.forEach((scriptInfo) => {
|
|
@@ -359,6 +383,24 @@ const reExecuteScripts = (container: HTMLElement, newScripts: ScriptInfo[]) => {
|
|
|
359
383
|
container.appendChild(newScript);
|
|
360
384
|
});
|
|
361
385
|
|
|
362
|
-
|
|
363
|
-
|
|
386
|
+
reExecuteInlineScripts(container, oldInlineScripts);
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
/* Re-execute inline scripts by replacing them with fresh nodes, but skip any
|
|
390
|
+
* whose textContent is byte-identical to its previous counterpart (matched by
|
|
391
|
+
* ordinal). Skipping leaves the original execution's global bindings intact,
|
|
392
|
+
* so unrelated edits don't reset inline-script state. */
|
|
393
|
+
const reExecuteInlineScripts = (
|
|
394
|
+
container: HTMLElement,
|
|
395
|
+
oldInlineScripts: string[]
|
|
396
|
+
) => {
|
|
397
|
+
const inlineScripts = container.querySelectorAll(
|
|
398
|
+
'script:not([src]):not([data-hmr-client])'
|
|
399
|
+
);
|
|
400
|
+
inlineScripts.forEach((script, idx) => {
|
|
401
|
+
if (oldInlineScripts[idx] === (script.textContent || '')) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
replaceInlineScript(script);
|
|
405
|
+
});
|
|
364
406
|
};
|
package/dist/index.js
CHANGED
|
@@ -35465,6 +35465,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
35465
35465
|
for (const file5 of svelteFiles) {
|
|
35466
35466
|
state.fileHashes.set(resolve41(file5), computeFileHash(file5));
|
|
35467
35467
|
}
|
|
35468
|
+
const surgicallyHandled = state.svelteSurgicallyHandled ?? new Set;
|
|
35469
|
+
for (const file5 of svelteFiles) {
|
|
35470
|
+
surgicallyHandled.add(resolve41(file5));
|
|
35471
|
+
}
|
|
35472
|
+
state.svelteSurgicallyHandled = surgicallyHandled;
|
|
35468
35473
|
const serverDuration = Date.now() - startTime;
|
|
35469
35474
|
await runSequentially(svelteFiles, (changedFile) => broadcastSvelteModuleUpdate(state, changedFile, svelteFiles, serverDuration));
|
|
35470
35475
|
scheduleSvelteBundleRebuild(state, svelteFiles, config2)();
|
|
@@ -36234,7 +36239,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
36234
36239
|
if (isCssOnlyChange && svelteCssFiles.length > 0) {
|
|
36235
36240
|
handleSvelteCssOnlyUpdate(state, svelteCssFiles, manifest, duration3);
|
|
36236
36241
|
}
|
|
36237
|
-
|
|
36242
|
+
const surgicallyHandled = state.svelteSurgicallyHandled;
|
|
36243
|
+
pagesToUpdate.filter((sveltePagePath) => !surgicallyHandled?.has(resolve41(sveltePagePath))).forEach((sveltePagePath) => {
|
|
36238
36244
|
broadcastSveltePageUpdate(state, sveltePagePath, manifest, duration3);
|
|
36239
36245
|
});
|
|
36240
36246
|
}, handleAngularCssOnlyUpdate = (state, angularCssFiles, manifest, duration3) => {
|
|
@@ -36520,6 +36526,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
36520
36526
|
});
|
|
36521
36527
|
return files.every((f2) => handled.has(f2));
|
|
36522
36528
|
}, performFullRebuild = async (state, config2, affectedFrameworks, filesToRebuild, startTime, onRebuildComplete) => {
|
|
36529
|
+
state.svelteSurgicallyHandled = undefined;
|
|
36523
36530
|
const hasManifest = Object.keys(state.manifest).length > 0;
|
|
36524
36531
|
const files = filesToRebuild ?? [];
|
|
36525
36532
|
let allHandled = files.length > 0 && hasManifest;
|
|
@@ -46592,5 +46599,5 @@ export {
|
|
|
46592
46599
|
ANGULAR_INIT_TIMEOUT_MS
|
|
46593
46600
|
};
|
|
46594
46601
|
|
|
46595
|
-
//# debugId=
|
|
46602
|
+
//# debugId=6A3DA19918ED0F0164756E2164756E21
|
|
46596
46603
|
//# sourceMappingURL=index.js.map
|