@absolutejs/absolute 0.20.0-beta.34 → 0.20.0-beta.35

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
@@ -16330,7 +16330,15 @@ import { existsSync as existsSync23, readFileSync as readFileSync21, promises as
16330
16330
  import { join as join33, basename as basename12, sep as sep3, dirname as dirname18, resolve as resolve24, relative as relative14 } from "path";
16331
16331
  var {Glob: Glob6 } = globalThis.Bun;
16332
16332
  import ts14 from "typescript";
16333
- var traceAngularPhase = async (name, fn2, metadata) => {
16333
+ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) => {
16334
+ const temporaryPath = `${path}.tmp.${process.pid}.${atomicWriteSequence++}`;
16335
+ try {
16336
+ await fs5.writeFile(temporaryPath, content, "utf-8");
16337
+ await fs5.rename(temporaryPath, path);
16338
+ } finally {
16339
+ await fs5.rm(temporaryPath, { force: true });
16340
+ }
16341
+ }, traceAngularPhase = async (name, fn2, metadata) => {
16334
16342
  const tracePhase = globalThis.__absoluteBuildTracePhase;
16335
16343
  return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata) : await fn2();
16336
16344
  }, readTsconfigPathAliases = () => {
@@ -16596,10 +16604,10 @@ var traceAngularPhase = async (name, fn2, metadata) => {
16596
16604
  }
16597
16605
  }, writeResourceCacheFile = async (cachePath, source) => {
16598
16606
  await fs5.mkdir(dirname18(cachePath), { recursive: true });
16599
- await fs5.writeFile(cachePath, JSON.stringify({
16607
+ await writeTextFileAtomically(cachePath, JSON.stringify({
16600
16608
  source,
16601
16609
  version: 1
16602
- }), "utf-8");
16610
+ }));
16603
16611
  }, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
16604
16612
  const resourcePaths = collectAngularResourcePaths(source, dirname18(filePath));
16605
16613
  const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
@@ -16785,7 +16793,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
16785
16793
  });
16786
16794
  await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
16787
16795
  await fs5.mkdir(dirname18(target), { recursive: true });
16788
- await fs5.writeFile(target, content, "utf-8");
16796
+ await writeTextFileAtomically(target, content);
16789
16797
  })), { outputs: entries.length });
16790
16798
  return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
16791
16799
  }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, invalidateAngularJitCache = (filePath) => {
@@ -17250,7 +17258,7 @@ ${fields}
17250
17258
  const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
17251
17259
  const preservedInjection = await readPreservedInjection(targetPath);
17252
17260
  await fs5.mkdir(targetDir, { recursive: true });
17253
- await fs5.writeFile(targetPath, processedContent + preservedInjection, "utf-8");
17261
+ await writeTextFileAtomically(targetPath, processedContent + preservedInjection);
17254
17262
  jitContentCache.set(cacheKey2, contentHash);
17255
17263
  }
17256
17264
  allOutputs.push(targetPath);
@@ -17266,7 +17274,7 @@ ${fields}
17266
17274
  export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
17267
17275
  ` : withoutLegacyFlag;
17268
17276
  if (nextEntryOutput !== entryOutput) {
17269
- await fs5.writeFile(entryOutputPath, nextEntryOutput, "utf-8");
17277
+ await writeTextFileAtomically(entryOutputPath, nextEntryOutput);
17270
17278
  }
17271
17279
  }
17272
17280
  return allOutputs;
@@ -17436,7 +17444,7 @@ export const providers = [${fragments.join(", ")}];
17436
17444
  `;
17437
17445
  }
17438
17446
  }
17439
- await traceAngularPhase("wrapper/write-server-output", () => fs5.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
17447
+ await traceAngularPhase("wrapper/write-server-output", () => writeTextFileAtomically(rawServerFile, rewritten), { entry: resolvedEntry });
17440
17448
  const relativePath = relative14(indexesDir, rawServerFile).replace(/\\/g, "/");
17441
17449
  const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
17442
17450
  const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
@@ -17635,7 +17643,7 @@ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
17635
17643
  `.trim();
17636
17644
  const indexHash = Bun.hash(hydration).toString(BASE_36_RADIX);
17637
17645
  const indexUnchanged = cachedWrapper?.indexHash === indexHash;
17638
- await traceAngularPhase("wrapper/write-client-index", () => fs5.writeFile(clientFile, hydration, "utf-8"), { entry: resolvedEntry });
17646
+ await traceAngularPhase("wrapper/write-client-index", () => writeTextFileAtomically(clientFile, hydration), { entry: resolvedEntry });
17639
17647
  wrapperOutputCache.set(resolvedEntry, {
17640
17648
  indexHash,
17641
17649
  serverHash: serverContentHash
@@ -24127,6 +24135,7 @@ var createHMRState = (config) => ({
24127
24135
  lastBroadcastTimestamp: 0,
24128
24136
  manifest: {},
24129
24137
  moduleVersions: createModuleVersionTracker(),
24138
+ pendingBundleRebuilds: new Set,
24130
24139
  rebuildCount: 0,
24131
24140
  rebuildQueue: new Set,
24132
24141
  rebuildTimeout: null,
@@ -24438,7 +24447,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
24438
24447
  });
24439
24448
  }
24440
24449
  }, ATOMIC_WRITE_TEMP_PATTERNS, shouldSkipFilename = (filename, isStylesDir) => !isStylesDir && (filename === "compiled" || filename === "generated" || filename === "build" || filename === "indexes" || filename === "server" || filename === "client" || filename.includes("/compiled/") || filename.includes("/generated/") || filename.includes("/build/") || filename.includes("/indexes/") || filename.includes("/server/") || filename.includes("/client/") || filename.startsWith("compiled/") || filename.startsWith("generated/") || filename.startsWith("build/") || filename.startsWith("indexes/") || filename.startsWith("server/") || filename.startsWith("client/")) || filename.endsWith("/") || filename.includes(".tmp.") || filename.endsWith(".tmp") || filename.endsWith("~") || filename.startsWith(".#") || filename.startsWith(".absolutejs-hmr-") || ATOMIC_WRITE_TEMP_PATTERNS.some((pattern) => pattern.test(filename)), setupWatcher = (absolutePath, isStylesDir, state, onFileChange) => {
24441
- const ATOMIC_RECOVERY_WINDOW_MS = 5000;
24450
+ const ATOMIC_RECOVERY_WINDOW_MS = 60000;
24442
24451
  const atomicRecoveryScan = (eventDir) => {
24443
24452
  let entries;
24444
24453
  try {
@@ -27332,6 +27341,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27332
27341
  }
27333
27342
  const DEBOUNCE_MS = config.options?.hmr?.debounceMs ?? DEFAULT_DEBOUNCE_MS;
27334
27343
  state.rebuildTimeout = setTimeout(() => {
27344
+ state.rebuildTimeout = null;
27335
27345
  drainQueueAndRebuild(state, config, onRebuildComplete);
27336
27346
  }, DEBOUNCE_MS);
27337
27347
  }, resolveComponentLookupFile = (componentFile, graph) => {
@@ -27735,6 +27745,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27735
27745
  const { invalidateFingerprintCache: invalidateFingerprintCache2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
27736
27746
  invalidateFingerprintCache2();
27737
27747
  }, ANGULAR_BUNDLE_DEBOUNCE_MS = 2000, angularBundleState, scheduleAngularBundleRebuild = (state, pageEntries, angularDir) => {
27748
+ state.pendingBundleRebuilds.add("angular");
27738
27749
  let ctx = angularBundleState.get(state);
27739
27750
  if (!ctx) {
27740
27751
  ctx = {
@@ -27769,6 +27780,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27769
27780
  }
27770
27781
  } finally {
27771
27782
  ctx.inFlight = null;
27783
+ if (!ctx.debounceTimer && !ctx.debouncedPromise && !ctx.pending)
27784
+ state.pendingBundleRebuilds.delete("angular");
27772
27785
  }
27773
27786
  };
27774
27787
  const fire = () => {
@@ -28276,6 +28289,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28276
28289
  type: "svelte-tier-zero-ssr-rebuild-complete"
28277
28290
  });
28278
28291
  }, scheduleSvelteBundleRebuild = (state, svelteFiles, config) => {
28292
+ state.pendingBundleRebuilds.add("svelte");
28279
28293
  const ctx = getOrCreateBundleCtx(svelteBundleState, state);
28280
28294
  for (const file4 of svelteFiles)
28281
28295
  ctx.pendingFiles.add(file4);
@@ -28302,6 +28316,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28302
28316
  }
28303
28317
  } finally {
28304
28318
  ctx.inFlight = null;
28319
+ if (!ctx.debounceTimer && !ctx.debouncedPromise && !ctx.pending && ctx.pendingFiles.size === 0)
28320
+ state.pendingBundleRebuilds.delete("svelte");
28305
28321
  }
28306
28322
  };
28307
28323
  const fire = () => {
@@ -28551,6 +28567,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28551
28567
  type: "vue-tier-zero-ssr-rebuild-complete"
28552
28568
  });
28553
28569
  }, scheduleVueBundleRebuild = (state, vueFiles, config) => {
28570
+ state.pendingBundleRebuilds.add("vue");
28554
28571
  const ctx = getOrCreateBundleCtx(vueBundleState, state);
28555
28572
  for (const file4 of vueFiles)
28556
28573
  ctx.pendingFiles.add(file4);
@@ -28577,6 +28594,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28577
28594
  }
28578
28595
  } finally {
28579
28596
  ctx.inFlight = null;
28597
+ if (!ctx.debounceTimer && !ctx.debouncedPromise && !ctx.pending && ctx.pendingFiles.size === 0)
28598
+ state.pendingBundleRebuilds.delete("vue");
28580
28599
  }
28581
28600
  };
28582
28601
  const fire = () => {
@@ -29439,6 +29458,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
29439
29458
  if (state.rebuildTimeout)
29440
29459
  clearTimeout(state.rebuildTimeout);
29441
29460
  state.rebuildTimeout = setTimeout(() => {
29461
+ state.rebuildTimeout = null;
29442
29462
  drainQueueAndRebuild(state, config, onRebuildComplete);
29443
29463
  }, REBUILD_BATCH_DELAY_MS);
29444
29464
  }, STYLE_FILE_EXT_RE, hasAngularOwnedStyleEdit = async (state, angularDir) => {
@@ -30362,5 +30382,5 @@ export {
30362
30382
  build
30363
30383
  };
30364
30384
 
30365
- //# debugId=51B9E6C20DB6CB0C64756E2164756E21
30385
+ //# debugId=3D972B737CCF1B5764756E2164756E21
30366
30386
  //# sourceMappingURL=build.js.map