@absolutejs/absolute 0.19.0-beta.85 → 0.19.0-beta.87
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/dist/build.js +43 -23
- package/dist/build.js.map +3 -3
- package/dist/dev/client/handlers/rebuild.ts +11 -0
- package/dist/index.js +43 -23
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -102,6 +102,7 @@ export const handleModuleUpdate = (message: {
|
|
|
102
102
|
export const handleRebuildComplete = (message: {
|
|
103
103
|
data: {
|
|
104
104
|
affectedFrameworks?: string[];
|
|
105
|
+
fullReload?: boolean;
|
|
105
106
|
manifest?: Record<string, string>;
|
|
106
107
|
};
|
|
107
108
|
}) => {
|
|
@@ -112,6 +113,16 @@ export const handleRebuildComplete = (message: {
|
|
|
112
113
|
window.__HMR_MANIFEST__ = message.data.manifest;
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
// Subprocess builds need a full page reload to pick up fresh
|
|
117
|
+
// bundled JS (the in-process Bun.build cache was stale).
|
|
118
|
+
if (message.data.fullReload) {
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
window.location.reload();
|
|
121
|
+
}, REBUILD_RELOAD_DELAY_MS);
|
|
122
|
+
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
if (
|
|
116
127
|
message.data.affectedFrameworks &&
|
|
117
128
|
!message.data.affectedFrameworks.includes('angular') &&
|
package/dist/index.js
CHANGED
|
@@ -204212,8 +204212,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
204212
204212
|
files.filter((f) => detectFramework(f, state.resolvedPaths) === "angular").forEach((f) => handled.add(f));
|
|
204213
204213
|
}
|
|
204214
204214
|
if (config.reactDirectory && affectedFrameworks.includes("react")) {
|
|
204215
|
-
|
|
204216
|
-
|
|
204215
|
+
const reactComponentFiles = files.filter((f) => detectFramework(f, state.resolvedPaths) === "react" && (f.endsWith(".tsx") || f.endsWith(".jsx")));
|
|
204216
|
+
if (reactComponentFiles.length > 0) {
|
|
204217
|
+
await handleReactFastPath(state, config, files, startTime, onRebuildComplete);
|
|
204218
|
+
}
|
|
204219
|
+
reactComponentFiles.forEach((f) => handled.add(f));
|
|
204217
204220
|
}
|
|
204218
204221
|
if (config.svelteDirectory && affectedFrameworks.includes("svelte")) {
|
|
204219
204222
|
await handleSvelteFastPath(state, config, files, startTime, onRebuildComplete);
|
|
@@ -204329,9 +204332,21 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
204329
204332
|
return state.manifest;
|
|
204330
204333
|
}
|
|
204331
204334
|
const hasNonComponentFiles = (filesToRebuild ?? []).some((f) => f.endsWith(".ts") && !f.endsWith(".d.ts"));
|
|
204335
|
+
const subprocessConfig = hasNonComponentFiles ? {
|
|
204336
|
+
buildDirectory: config.buildDirectory,
|
|
204337
|
+
assetsDirectory: config.assetsDirectory,
|
|
204338
|
+
reactDirectory: config.reactDirectory,
|
|
204339
|
+
stylesConfig: config.stylesConfig,
|
|
204340
|
+
options: {
|
|
204341
|
+
...config.options,
|
|
204342
|
+
baseManifest: state.manifest,
|
|
204343
|
+
injectHMR: true,
|
|
204344
|
+
throwOnError: true
|
|
204345
|
+
}
|
|
204346
|
+
} : undefined;
|
|
204332
204347
|
const buildConfig = {
|
|
204333
204348
|
...config,
|
|
204334
|
-
incrementalFiles:
|
|
204349
|
+
incrementalFiles: filesToRebuild && filesToRebuild.length > 0 ? filesToRebuild : undefined,
|
|
204335
204350
|
options: {
|
|
204336
204351
|
...config.options,
|
|
204337
204352
|
baseManifest: state.manifest,
|
|
@@ -204340,21 +204355,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
204340
204355
|
}
|
|
204341
204356
|
};
|
|
204342
204357
|
let manifest;
|
|
204343
|
-
if (hasNonComponentFiles) {
|
|
204344
|
-
const
|
|
204345
|
-
const
|
|
204346
|
-
|
|
204347
|
-
|
|
204348
|
-
|
|
204349
|
-
|
|
204350
|
-
|
|
204351
|
-
'import { build } from "@absolutejs/absolute/build";',
|
|
204352
|
-
`const config = JSON.parse(await Bun.file("${escapedConfig}").text());`,
|
|
204353
|
-
"const manifest = await build(config);",
|
|
204354
|
-
'console.log("__MANIFEST__" + JSON.stringify(manifest));'
|
|
204355
|
-
].join(`
|
|
204356
|
-
`));
|
|
204357
|
-
const proc = Bun.spawn(["bun", "run", tmpScript], {
|
|
204358
|
+
if (hasNonComponentFiles && subprocessConfig) {
|
|
204359
|
+
const configJson = JSON.stringify(subprocessConfig);
|
|
204360
|
+
const proc = Bun.spawn([
|
|
204361
|
+
"bun",
|
|
204362
|
+
"-e",
|
|
204363
|
+
'import{build}from"@absolutejs/absolute/build";const m=await build(JSON.parse(process.argv[1]));console.log("__MANIFEST__"+JSON.stringify(m))',
|
|
204364
|
+
configJson
|
|
204365
|
+
], {
|
|
204358
204366
|
cwd: process.cwd(),
|
|
204359
204367
|
stderr: "pipe",
|
|
204360
204368
|
stdout: "pipe"
|
|
@@ -204363,13 +204371,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
204363
204371
|
const stderr = await new Response(proc.stderr).text();
|
|
204364
204372
|
await proc.exited;
|
|
204365
204373
|
if (proc.exitCode !== 0) {
|
|
204366
|
-
logWarn(`Fresh build
|
|
204374
|
+
logWarn(`Fresh build failed: ${stderr.slice(0, 300)}`);
|
|
204367
204375
|
manifest = await build2(buildConfig);
|
|
204368
204376
|
} else {
|
|
204369
204377
|
const manifestLine = stdout.split(`
|
|
204370
204378
|
`).find((l) => l.startsWith("__MANIFEST__"));
|
|
204371
204379
|
if (manifestLine) {
|
|
204372
|
-
|
|
204380
|
+
const freshManifest = JSON.parse(manifestLine.slice("__MANIFEST__".length));
|
|
204381
|
+
manifest = { ...state.manifest, ...freshManifest };
|
|
204373
204382
|
} else {
|
|
204374
204383
|
manifest = await build2(buildConfig);
|
|
204375
204384
|
}
|
|
@@ -204381,6 +204390,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
204381
204390
|
throw new Error("Build failed - no manifest generated");
|
|
204382
204391
|
}
|
|
204383
204392
|
const duration = Date.now() - startTime;
|
|
204393
|
+
const wasSubprocess = hasNonComponentFiles && subprocessConfig;
|
|
204394
|
+
if (wasSubprocess) {
|
|
204395
|
+
const dataFile = (filesToRebuild ?? []).find((f) => f.endsWith(".ts") && !f.endsWith(".d.ts"));
|
|
204396
|
+
if (dataFile) {
|
|
204397
|
+
state.lastHmrPath = relative9(process.cwd(), dataFile).replace(/\\/g, "/");
|
|
204398
|
+
state.lastHmrFramework = "react";
|
|
204399
|
+
logHmrUpdate(state.lastHmrPath, "react", duration);
|
|
204400
|
+
}
|
|
204401
|
+
}
|
|
204384
204402
|
sendTelemetryEvent("hmr:rebuild-complete", {
|
|
204385
204403
|
durationMs: duration,
|
|
204386
204404
|
fileCount: filesToRebuild?.length ?? 0,
|
|
@@ -204391,15 +204409,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
204391
204409
|
broadcastToClients(state, {
|
|
204392
204410
|
data: {
|
|
204393
204411
|
affectedFrameworks,
|
|
204412
|
+
fullReload: wasSubprocess,
|
|
204394
204413
|
manifest
|
|
204395
204414
|
},
|
|
204396
204415
|
message: "Rebuild completed successfully",
|
|
204397
204416
|
type: "rebuild-complete"
|
|
204398
204417
|
});
|
|
204399
|
-
if (filesToRebuild && filesToRebuild.length > 0) {
|
|
204418
|
+
if (filesToRebuild && filesToRebuild.length > 0 && !wasSubprocess) {
|
|
204400
204419
|
await handleFullBuildHMR(state, config, affectedFrameworks, filesToRebuild, manifest, duration);
|
|
204401
204420
|
}
|
|
204402
|
-
|
|
204421
|
+
if (!wasSubprocess)
|
|
204422
|
+
broadcastFrameworkUpdates(state, affectedFrameworks, filesToRebuild, manifest, startTime);
|
|
204403
204423
|
if (affectedFrameworks.includes("angular")) {
|
|
204404
204424
|
invalidateAngularSsrCache();
|
|
204405
204425
|
}
|
|
@@ -205309,5 +205329,5 @@ export {
|
|
|
205309
205329
|
ANGULAR_INIT_TIMEOUT_MS
|
|
205310
205330
|
};
|
|
205311
205331
|
|
|
205312
|
-
//# debugId=
|
|
205332
|
+
//# debugId=0765327BDBD9976664756E2164756E21
|
|
205313
205333
|
//# sourceMappingURL=index.js.map
|