@absolutejs/absolute 0.20.0-beta.166 → 0.20.0-beta.168
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/CHANGELOG.md +18 -0
- package/README.md +81 -0
- package/changelog.json +35 -0
- package/dist/angular/browser.js +3 -3
- package/dist/angular/browser.js.map +3 -3
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +211 -197
- package/dist/angular/index.js.map +8 -8
- package/dist/angular/server.js +211 -197
- package/dist/angular/server.js.map +8 -8
- package/dist/build.js +1333 -1005
- package/dist/build.js.map +13 -9
- package/dist/cli/{compile-30m09382.js → compile-ckn6epbb.js} +1 -1
- package/dist/cli/config/server.js +125 -112
- package/dist/cli/{dev-sxx8zyr6.js → dev-ny2vah78.js} +1 -1
- package/dist/cli/{index-vkba3289.js → index-8ez1ccm0.js} +1 -1
- package/dist/cli/{index-1ksy2h3r.js → index-psvsmg0x.js} +1 -1
- package/dist/cli/index.js +8 -8
- package/dist/cli/{islands-rq6wx0kh.js → islands-8sgky9gh.js} +1 -1
- package/dist/cli/{mobile-41sev6v0.js → mobile-ddggpe53.js} +2 -2
- package/dist/cli/{patchedBun-r3ykvvwz.js → patchedBun-g1d7528q.js} +1 -1
- package/dist/cli/{start-0ebxkwga.js → start-qj7664zr.js} +2 -2
- package/dist/cli/{typecheck-7yhekrc0.js → typecheck-8sdrcjz8.js} +208 -42
- package/dist/client/index.js +8 -3
- package/dist/client/index.js.map +4 -4
- package/dist/dev/client/cssUtils.ts +65 -3
- package/dist/dev/client/hmrClient.ts +3 -1
- package/dist/index.js +1411 -1082
- package/dist/index.js.map +15 -11
- package/dist/islands/browser.js +3 -3
- package/dist/islands/browser.js.map +3 -3
- package/dist/islands/index.js +3 -3
- package/dist/islands/index.js.map +3 -3
- package/dist/react/browser.js +3 -3
- package/dist/react/browser.js.map +3 -3
- package/dist/react/index.js +231 -217
- package/dist/react/index.js.map +9 -9
- package/dist/react/server.js +231 -191
- package/dist/react/server.js.map +9 -8
- package/dist/src/build/islandBootstrap.d.ts +22 -0
- package/dist/src/build/missingClientFrameworks.d.ts +29 -0
- package/dist/src/build/svelteDeclarations.d.ts +27 -0
- package/dist/src/cli/patchedBun.d.ts +2 -2
- package/dist/src/client/islandResolver.d.ts +3 -1
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/core/islandManifest.d.ts +10 -0
- package/dist/src/core/islandPageContext.d.ts +2 -0
- package/dist/src/dev/svelteDeclarationRefresher.d.ts +6 -0
- package/dist/svelte/browser.js +3 -3
- package/dist/svelte/browser.js.map +3 -3
- package/dist/svelte/index.js +211 -197
- package/dist/svelte/index.js.map +8 -8
- package/dist/svelte/server.js +211 -171
- package/dist/svelte/server.js.map +8 -7
- package/dist/vue/browser.js +3 -3
- package/dist/vue/browser.js.map +3 -3
- package/dist/vue/index.js +231 -217
- package/dist/vue/index.js.map +9 -9
- package/dist/vue/server.js +231 -191
- package/dist/vue/server.js.map +9 -8
- package/package.json +6 -1
- /package/dist/cli/{index-e6ysp900.js → index-z794p5qg.js} +0 -0
|
@@ -326,14 +326,76 @@ const updateStylesheetLink = (
|
|
|
326
326
|
return replaceStylesheetLink(link, replacementHref);
|
|
327
327
|
};
|
|
328
328
|
|
|
329
|
+
/** Static asset edits must invalidate mounted image and favicon URLs too. */
|
|
330
|
+
export const refreshStaticAsset = (assetUrl: string) => {
|
|
331
|
+
const changed = new URL(assetUrl, window.location.href);
|
|
332
|
+
if (changed.origin !== window.location.origin) return;
|
|
333
|
+
for (const element of document.querySelectorAll<
|
|
334
|
+
HTMLImageElement | HTMLLinkElement
|
|
335
|
+
>('img[src], link[rel~="icon"][href]')) {
|
|
336
|
+
const attribute = element instanceof HTMLImageElement ? 'src' : 'href';
|
|
337
|
+
const current = new URL(
|
|
338
|
+
element.getAttribute(attribute) ?? '',
|
|
339
|
+
window.location.href
|
|
340
|
+
);
|
|
341
|
+
if (
|
|
342
|
+
current.origin !== changed.origin ||
|
|
343
|
+
current.pathname !== changed.pathname
|
|
344
|
+
)
|
|
345
|
+
continue;
|
|
346
|
+
current.searchParams.set(
|
|
347
|
+
'hmr',
|
|
348
|
+
`${Date.now()}-${++styleReloadSequence}`
|
|
349
|
+
);
|
|
350
|
+
element.setAttribute(attribute, current.href);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
/** Refresh CSS imported by JS as well as linked bundles. Update the original
|
|
355
|
+
* style nodes in place so overrides keep their cascade order. */
|
|
356
|
+
export const reloadImportedStylesheets = async (
|
|
357
|
+
load: (url: string) => Promise<unknown> = (url) => import(url)
|
|
358
|
+
) => {
|
|
359
|
+
const styles = Array.from(
|
|
360
|
+
document.querySelectorAll<HTMLStyleElement>('style[data-hmr-src]')
|
|
361
|
+
);
|
|
362
|
+
const results = await Promise.all(
|
|
363
|
+
styles.map(async (style) => {
|
|
364
|
+
try {
|
|
365
|
+
const source = style.dataset.hmrSrc;
|
|
366
|
+
if (!source) return false;
|
|
367
|
+
const url = new URL(source, window.location.href);
|
|
368
|
+
if (
|
|
369
|
+
url.origin !== window.location.origin ||
|
|
370
|
+
!url.pathname.startsWith('/@src/')
|
|
371
|
+
)
|
|
372
|
+
return false;
|
|
373
|
+
url.searchParams.set(
|
|
374
|
+
'hmr',
|
|
375
|
+
`${Date.now()}-${++styleReloadSequence}`
|
|
376
|
+
);
|
|
377
|
+
await load(url.href);
|
|
378
|
+
|
|
379
|
+
return true;
|
|
380
|
+
} catch {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
return results.every(Boolean);
|
|
387
|
+
};
|
|
388
|
+
let styleReloadSequence = 0;
|
|
389
|
+
|
|
329
390
|
export const reloadCSSStylesheets = (manifest: Record<string, string>) => {
|
|
330
391
|
const stylesheets = Array.from(
|
|
331
392
|
document.querySelectorAll('link[rel="stylesheet"]')
|
|
332
393
|
);
|
|
333
394
|
|
|
334
|
-
return Promise.all(
|
|
335
|
-
stylesheets.map((link) => updateStylesheetLink(link, manifest))
|
|
336
|
-
|
|
395
|
+
return Promise.all([
|
|
396
|
+
...stylesheets.map((link) => updateStylesheetLink(link, manifest)),
|
|
397
|
+
reloadImportedStylesheets()
|
|
398
|
+
]).then((results) => results.every(Boolean));
|
|
337
399
|
};
|
|
338
400
|
|
|
339
401
|
export const swapCSSStylesheet = (
|
|
@@ -32,7 +32,7 @@ import { handleHTMLUpdate, handleScriptUpdate } from './handlers/html';
|
|
|
32
32
|
import { handleHTMXUpdate } from './handlers/htmx';
|
|
33
33
|
import { handleSvelteUpdate } from './handlers/svelte';
|
|
34
34
|
import { handleVueUpdate } from './handlers/vue';
|
|
35
|
-
import { reloadCSSStylesheets } from './cssUtils';
|
|
35
|
+
import { reloadCSSStylesheets, refreshStaticAsset } from './cssUtils';
|
|
36
36
|
import {
|
|
37
37
|
handleFullReload,
|
|
38
38
|
handleManifest,
|
|
@@ -201,6 +201,7 @@ const hmrUpdateTypes = new Set([
|
|
|
201
201
|
|
|
202
202
|
type HMRMessage = {
|
|
203
203
|
data: {
|
|
204
|
+
assetUrl?: string;
|
|
204
205
|
affectedFrameworks?: string[];
|
|
205
206
|
column?: number;
|
|
206
207
|
error?: string;
|
|
@@ -230,6 +231,7 @@ type HMRMessage = {
|
|
|
230
231
|
};
|
|
231
232
|
|
|
232
233
|
const handleStylesheetUpdate = (message: HMRMessage) => {
|
|
234
|
+
if (message.data.assetUrl) refreshStaticAsset(message.data.assetUrl);
|
|
233
235
|
const clientStart = performance.now();
|
|
234
236
|
void reloadCSSStylesheets(message.data.manifest ?? {}).then((applied) =>
|
|
235
237
|
sendAbsoluteHmrTiming({
|