@absolutejs/absolute 0.20.0-beta.166 → 0.20.0-beta.167
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 +7 -0
- package/changelog.json +11 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +10 -8
- package/dist/build.js.map +5 -5
- package/dist/cli/{dev-sxx8zyr6.js → dev-ny2vah78.js} +1 -1
- package/dist/cli/{index-1ksy2h3r.js → index-psvsmg0x.js} +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli/{patchedBun-r3ykvvwz.js → patchedBun-g1d7528q.js} +1 -1
- package/dist/dev/client/cssUtils.ts +65 -3
- package/dist/dev/client/hmrClient.ts +3 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +5 -5
- package/dist/src/cli/patchedBun.d.ts +2 -2
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ var PATCHED_BUN_RELEASE = {
|
|
|
15
15
|
bunVersion: "1.4.4",
|
|
16
16
|
issue: "https://github.com/oven-sh/bun/issues/32919",
|
|
17
17
|
repo: "absolutejs/patched-bun",
|
|
18
|
-
version: "1.4.4+absolute.
|
|
18
|
+
version: "1.4.4+absolute.2"
|
|
19
19
|
};
|
|
20
20
|
var HOURS_PER_DAY = 24;
|
|
21
21
|
var MS_PER_HOUR = 3600000;
|
package/dist/cli/index.js
CHANGED
|
@@ -54,7 +54,7 @@ if (command === "dev") {
|
|
|
54
54
|
}
|
|
55
55
|
const positionalArgs = stripNamedArgs("--config", "--android-device", "--ios-device").filter((arg) => arg !== "--no-mobile" && arg !== "--eager");
|
|
56
56
|
const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
|
|
57
|
-
const { dev } = await import("./dev-
|
|
57
|
+
const { dev } = await import("./dev-ny2vah78.js");
|
|
58
58
|
await dev(serverEntry, configPath, {
|
|
59
59
|
androidDevice,
|
|
60
60
|
eager: args.includes("--eager"),
|
|
@@ -62,7 +62,7 @@ if (command === "dev") {
|
|
|
62
62
|
mobile: !args.includes("--no-mobile")
|
|
63
63
|
});
|
|
64
64
|
} else if (command === "bun-patch") {
|
|
65
|
-
const { bunPatch } = await import("./patchedBun-
|
|
65
|
+
const { bunPatch } = await import("./patchedBun-g1d7528q.js");
|
|
66
66
|
bunPatch(args);
|
|
67
67
|
} else if (command === "start") {
|
|
68
68
|
sendTelemetryEvent("cli:command", { command });
|
|
@@ -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({
|
package/dist/index.js
CHANGED
|
@@ -26799,7 +26799,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
26799
26799
|
...allAngularEntries.map((source) => toDevPageEntry("angular", source)),
|
|
26800
26800
|
...allEmberEntries.map((source) => toDevPageEntry("ember", source))
|
|
26801
26801
|
] : [];
|
|
26802
|
-
const globalCssEntries = isIncremental ? filterToIncrementalEntries(allGlobalCssEntries, (entry) => entry)
|
|
26802
|
+
const globalCssEntries = !isIncremental || incrementalFiles?.some(isStylePath) ? allGlobalCssEntries : filterToIncrementalEntries(allGlobalCssEntries, (entry) => entry);
|
|
26803
26803
|
const hmrClientBundlePromise = hmr && (htmlDir || htmxDir) ? buildHMRClient() : undefined;
|
|
26804
26804
|
const allFrameworkDirs = [
|
|
26805
26805
|
reactDir,
|
|
@@ -27084,7 +27084,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
27084
27084
|
generatedRoot: join53(buildPath, "_island_entries")
|
|
27085
27085
|
};
|
|
27086
27086
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
27087
|
-
if (!deferPageEntries && serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && urlReferencedFiles.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
27087
|
+
if (!deferPageEntries && serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && urlReferencedFiles.length === 0 && islandClientEntryPoints.length === 0 && globalCssEntries.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
27088
27088
|
logWarn("No entry points found, manifest will be empty");
|
|
27089
27089
|
sendTelemetryEvent("build:empty", {
|
|
27090
27090
|
configuredDirs: {
|
|
@@ -30498,12 +30498,13 @@ ${code}`;
|
|
|
30498
30498
|
const raw = readFileSync41(filePath, "utf-8");
|
|
30499
30499
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
30500
30500
|
return [
|
|
30501
|
-
`const
|
|
30501
|
+
`const id = ${JSON.stringify(filePath)};`,
|
|
30502
|
+
`const existing = Array.from(document.querySelectorAll('style[data-hmr-id]')).find(el => el.dataset.hmrId === id);`,
|
|
30503
|
+
`const style = existing || document.createElement('style');`,
|
|
30502
30504
|
`style.textContent = \`${escaped}\`;`,
|
|
30503
|
-
`style.dataset.hmrId =
|
|
30504
|
-
`
|
|
30505
|
-
`if (existing)
|
|
30506
|
-
`document.head.appendChild(style);`
|
|
30505
|
+
`style.dataset.hmrId = id;`,
|
|
30506
|
+
`style.dataset.hmrSrc = import.meta.url;`,
|
|
30507
|
+
`if (!existing) document.head.appendChild(style);`
|
|
30507
30508
|
].join(`
|
|
30508
30509
|
`);
|
|
30509
30510
|
}, generateSvelteHmrBootstrap = (moduleUrl, vendorPaths, timestamp) => {
|
|
@@ -32663,6 +32664,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
32663
32664
|
logHmrUpdate(relative26(process.cwd(), filePath));
|
|
32664
32665
|
broadcastToClients(state, {
|
|
32665
32666
|
data: {
|
|
32667
|
+
assetUrl: webPath,
|
|
32666
32668
|
framework: urlPrefix || "public",
|
|
32667
32669
|
manifest: state.manifest,
|
|
32668
32670
|
serverDuration: Math.round(performance.now() - startedAt),
|
|
@@ -44204,5 +44206,5 @@ export {
|
|
|
44204
44206
|
wrapPageHandlerWithStreamingSlots
|
|
44205
44207
|
};
|
|
44206
44208
|
|
|
44207
|
-
//# debugId=
|
|
44209
|
+
//# debugId=66B00122B036B41064756E2164756E21
|
|
44208
44210
|
//# sourceMappingURL=index.js.map
|