@absolutejs/absolute 0.19.0-beta.84 → 0.19.0-beta.86

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,6 +204332,18 @@ 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
204349
  incrementalFiles: filesToRebuild && filesToRebuild.length > 0 ? filesToRebuild : undefined,
@@ -204340,12 +204355,13 @@ 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");
204358
+ if (hasNonComponentFiles && subprocessConfig) {
204359
+ const absDir = resolve20(process.cwd(), ".absolutejs");
204360
+ const tmpConfig = resolve20(absDir, "build-config.json");
204361
+ const tmpScript = resolve20(absDir, "fresh-build.ts");
204346
204362
  const { mkdirSync: mkdirSync9, writeFileSync: writeFileSync5 } = await import("fs");
204347
- mkdirSync9(resolve20(process.cwd(), ".absolutejs"), { recursive: true });
204348
- writeFileSync5(tmpConfig, JSON.stringify(buildConfig));
204363
+ mkdirSync9(absDir, { recursive: true });
204364
+ writeFileSync5(tmpConfig, JSON.stringify(subprocessConfig));
204349
204365
  const escapedConfig = tmpConfig.replace(/\\/g, "\\\\");
204350
204366
  writeFileSync5(tmpScript, [
204351
204367
  'import { build } from "@absolutejs/absolute/build";',
@@ -204363,13 +204379,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
204363
204379
  const stderr = await new Response(proc.stderr).text();
204364
204380
  await proc.exited;
204365
204381
  if (proc.exitCode !== 0) {
204366
- logWarn(`Fresh build stderr: ${stderr.slice(0, 500)}`);
204382
+ logWarn(`Fresh build failed: ${stderr.slice(0, 300)}`);
204367
204383
  manifest = await build(buildConfig);
204368
204384
  } else {
204369
204385
  const manifestLine = stdout.split(`
204370
204386
  `).find((l) => l.startsWith("__MANIFEST__"));
204371
204387
  if (manifestLine) {
204372
- manifest = JSON.parse(manifestLine.slice("__MANIFEST__".length));
204388
+ const freshManifest = JSON.parse(manifestLine.slice("__MANIFEST__".length));
204389
+ manifest = { ...state.manifest, ...freshManifest };
204373
204390
  } else {
204374
204391
  manifest = await build(buildConfig);
204375
204392
  }
@@ -204381,6 +204398,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
204381
204398
  throw new Error("Build failed - no manifest generated");
204382
204399
  }
204383
204400
  const duration = Date.now() - startTime;
204401
+ const wasSubprocess = hasNonComponentFiles && subprocessConfig;
204402
+ if (wasSubprocess) {
204403
+ const dataFile = (filesToRebuild ?? []).find((f) => f.endsWith(".ts") && !f.endsWith(".d.ts"));
204404
+ if (dataFile) {
204405
+ state.lastHmrPath = relative9(process.cwd(), dataFile).replace(/\\/g, "/");
204406
+ state.lastHmrFramework = "react";
204407
+ logHmrUpdate(state.lastHmrPath, "react", duration);
204408
+ }
204409
+ }
204384
204410
  sendTelemetryEvent("hmr:rebuild-complete", {
204385
204411
  durationMs: duration,
204386
204412
  fileCount: filesToRebuild?.length ?? 0,
@@ -204391,12 +204417,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
204391
204417
  broadcastToClients(state, {
204392
204418
  data: {
204393
204419
  affectedFrameworks,
204420
+ fullReload: wasSubprocess,
204394
204421
  manifest
204395
204422
  },
204396
204423
  message: "Rebuild completed successfully",
204397
204424
  type: "rebuild-complete"
204398
204425
  });
204399
- if (filesToRebuild && filesToRebuild.length > 0) {
204426
+ if (filesToRebuild && filesToRebuild.length > 0 && !wasSubprocess) {
204400
204427
  await handleFullBuildHMR(state, config, affectedFrameworks, filesToRebuild, manifest, duration);
204401
204428
  }
204402
204429
  broadcastFrameworkUpdates(state, affectedFrameworks, filesToRebuild, manifest, startTime);
@@ -204904,5 +204931,5 @@ export {
204904
204931
  build
204905
204932
  };
204906
204933
 
204907
- //# debugId=DD746009AB39986E64756E2164756E21
204934
+ //# debugId=CFE9B3BDE37B859064756E2164756E21
204908
204935
  //# sourceMappingURL=build.js.map