@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/dist/build.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
- await handleReactFastPath(state, config, files, startTime, onRebuildComplete);
204216
- files.filter((f) => detectFramework(f, state.resolvedPaths) === "react" && (f.endsWith(".tsx") || f.endsWith(".jsx"))).forEach((f) => handled.add(f));
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: hasNonComponentFiles ? undefined : filesToRebuild && filesToRebuild.length > 0 ? filesToRebuild : undefined,
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 tmpConfig = resolve20(process.cwd(), ".absolutejs", "build-config.json");
204345
- const tmpScript = resolve20(process.cwd(), ".absolutejs", "fresh-build.ts");
204346
- const { mkdirSync: mkdirSync9, writeFileSync: writeFileSync5 } = await import("fs");
204347
- mkdirSync9(resolve20(process.cwd(), ".absolutejs"), { recursive: true });
204348
- writeFileSync5(tmpConfig, JSON.stringify(buildConfig));
204349
- const escapedConfig = tmpConfig.replace(/\\/g, "\\\\");
204350
- writeFileSync5(tmpScript, [
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 stderr: ${stderr.slice(0, 500)}`);
204374
+ logWarn(`Fresh build failed: ${stderr.slice(0, 300)}`);
204367
204375
  manifest = await build(buildConfig);
204368
204376
  } else {
204369
204377
  const manifestLine = stdout.split(`
204370
204378
  `).find((l) => l.startsWith("__MANIFEST__"));
204371
204379
  if (manifestLine) {
204372
- manifest = JSON.parse(manifestLine.slice("__MANIFEST__".length));
204380
+ const freshManifest = JSON.parse(manifestLine.slice("__MANIFEST__".length));
204381
+ manifest = { ...state.manifest, ...freshManifest };
204373
204382
  } else {
204374
204383
  manifest = await build(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
- broadcastFrameworkUpdates(state, affectedFrameworks, filesToRebuild, manifest, startTime);
204421
+ if (!wasSubprocess)
204422
+ broadcastFrameworkUpdates(state, affectedFrameworks, filesToRebuild, manifest, startTime);
204403
204423
  if (affectedFrameworks.includes("angular")) {
204404
204424
  invalidateAngularSsrCache();
204405
204425
  }
@@ -204904,5 +204924,5 @@ export {
204904
204924
  build
204905
204925
  };
204906
204926
 
204907
- //# debugId=D7ACB5D878E35B7E64756E2164756E21
204927
+ //# debugId=AC996619E7AE190164756E2164756E21
204908
204928
  //# sourceMappingURL=build.js.map