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

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/index.js CHANGED
@@ -16592,7 +16592,15 @@ import { existsSync as existsSync26, readFileSync as readFileSync25, promises as
16592
16592
  import { join as join38, basename as basename12, sep as sep3, dirname as dirname21, resolve as resolve29, relative as relative14 } from "path";
16593
16593
  var {Glob: Glob6 } = globalThis.Bun;
16594
16594
  import ts14 from "typescript";
16595
- var traceAngularPhase = async (name, fn2, metadata2) => {
16595
+ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) => {
16596
+ const temporaryPath = `${path}.tmp.${process.pid}.${atomicWriteSequence++}`;
16597
+ try {
16598
+ await fs5.writeFile(temporaryPath, content, "utf-8");
16599
+ await fs5.rename(temporaryPath, path);
16600
+ } finally {
16601
+ await fs5.rm(temporaryPath, { force: true });
16602
+ }
16603
+ }, traceAngularPhase = async (name, fn2, metadata2) => {
16596
16604
  const tracePhase = globalThis.__absoluteBuildTracePhase;
16597
16605
  return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata2) : await fn2();
16598
16606
  }, readTsconfigPathAliases = () => {
@@ -16858,10 +16866,10 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
16858
16866
  }
16859
16867
  }, writeResourceCacheFile = async (cachePath, source) => {
16860
16868
  await fs5.mkdir(dirname21(cachePath), { recursive: true });
16861
- await fs5.writeFile(cachePath, JSON.stringify({
16869
+ await writeTextFileAtomically(cachePath, JSON.stringify({
16862
16870
  source,
16863
16871
  version: 1
16864
- }), "utf-8");
16872
+ }));
16865
16873
  }, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
16866
16874
  const resourcePaths = collectAngularResourcePaths(source, dirname21(filePath));
16867
16875
  const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
@@ -17047,7 +17055,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
17047
17055
  });
17048
17056
  await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
17049
17057
  await fs5.mkdir(dirname21(target), { recursive: true });
17050
- await fs5.writeFile(target, content, "utf-8");
17058
+ await writeTextFileAtomically(target, content);
17051
17059
  })), { outputs: entries.length });
17052
17060
  return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
17053
17061
  }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, invalidateAngularJitCache = (filePath) => {
@@ -17512,7 +17520,7 @@ ${fields}
17512
17520
  const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
17513
17521
  const preservedInjection = await readPreservedInjection(targetPath);
17514
17522
  await fs5.mkdir(targetDir, { recursive: true });
17515
- await fs5.writeFile(targetPath, processedContent + preservedInjection, "utf-8");
17523
+ await writeTextFileAtomically(targetPath, processedContent + preservedInjection);
17516
17524
  jitContentCache.set(cacheKey2, contentHash);
17517
17525
  }
17518
17526
  allOutputs.push(targetPath);
@@ -17528,7 +17536,7 @@ ${fields}
17528
17536
  export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
17529
17537
  ` : withoutLegacyFlag;
17530
17538
  if (nextEntryOutput !== entryOutput) {
17531
- await fs5.writeFile(entryOutputPath, nextEntryOutput, "utf-8");
17539
+ await writeTextFileAtomically(entryOutputPath, nextEntryOutput);
17532
17540
  }
17533
17541
  }
17534
17542
  return allOutputs;
@@ -17698,7 +17706,7 @@ export const providers = [${fragments.join(", ")}];
17698
17706
  `;
17699
17707
  }
17700
17708
  }
17701
- await traceAngularPhase("wrapper/write-server-output", () => fs5.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
17709
+ await traceAngularPhase("wrapper/write-server-output", () => writeTextFileAtomically(rawServerFile, rewritten), { entry: resolvedEntry });
17702
17710
  const relativePath = relative14(indexesDir, rawServerFile).replace(/\\/g, "/");
17703
17711
  const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
17704
17712
  const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
@@ -17897,7 +17905,7 @@ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
17897
17905
  `.trim();
17898
17906
  const indexHash = Bun.hash(hydration).toString(BASE_36_RADIX);
17899
17907
  const indexUnchanged = cachedWrapper?.indexHash === indexHash;
17900
- await traceAngularPhase("wrapper/write-client-index", () => fs5.writeFile(clientFile, hydration, "utf-8"), { entry: resolvedEntry });
17908
+ await traceAngularPhase("wrapper/write-client-index", () => writeTextFileAtomically(clientFile, hydration), { entry: resolvedEntry });
17901
17909
  wrapperOutputCache.set(resolvedEntry, {
17902
17910
  indexHash,
17903
17911
  serverHash: serverContentHash
@@ -24389,6 +24397,7 @@ var createHMRState = (config) => ({
24389
24397
  lastBroadcastTimestamp: 0,
24390
24398
  manifest: {},
24391
24399
  moduleVersions: createModuleVersionTracker(),
24400
+ pendingBundleRebuilds: new Set,
24392
24401
  rebuildCount: 0,
24393
24402
  rebuildQueue: new Set,
24394
24403
  rebuildTimeout: null,
@@ -24700,7 +24709,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
24700
24709
  });
24701
24710
  }
24702
24711
  }, 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) => {
24703
- const ATOMIC_RECOVERY_WINDOW_MS = 5000;
24712
+ const ATOMIC_RECOVERY_WINDOW_MS = 60000;
24704
24713
  const atomicRecoveryScan = (eventDir) => {
24705
24714
  let entries;
24706
24715
  try {
@@ -27352,6 +27361,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27352
27361
  }
27353
27362
  const DEBOUNCE_MS = config.options?.hmr?.debounceMs ?? DEFAULT_DEBOUNCE_MS;
27354
27363
  state.rebuildTimeout = setTimeout(() => {
27364
+ state.rebuildTimeout = null;
27355
27365
  drainQueueAndRebuild(state, config, onRebuildComplete);
27356
27366
  }, DEBOUNCE_MS);
27357
27367
  }, resolveComponentLookupFile = (componentFile, graph) => {
@@ -27755,6 +27765,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27755
27765
  const { invalidateFingerprintCache: invalidateFingerprintCache2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
27756
27766
  invalidateFingerprintCache2();
27757
27767
  }, ANGULAR_BUNDLE_DEBOUNCE_MS = 2000, angularBundleState, scheduleAngularBundleRebuild = (state, pageEntries, angularDir) => {
27768
+ state.pendingBundleRebuilds.add("angular");
27758
27769
  let ctx = angularBundleState.get(state);
27759
27770
  if (!ctx) {
27760
27771
  ctx = {
@@ -27789,6 +27800,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27789
27800
  }
27790
27801
  } finally {
27791
27802
  ctx.inFlight = null;
27803
+ if (!ctx.debounceTimer && !ctx.debouncedPromise && !ctx.pending)
27804
+ state.pendingBundleRebuilds.delete("angular");
27792
27805
  }
27793
27806
  };
27794
27807
  const fire = () => {
@@ -28296,6 +28309,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28296
28309
  type: "svelte-tier-zero-ssr-rebuild-complete"
28297
28310
  });
28298
28311
  }, scheduleSvelteBundleRebuild = (state, svelteFiles, config) => {
28312
+ state.pendingBundleRebuilds.add("svelte");
28299
28313
  const ctx = getOrCreateBundleCtx(svelteBundleState, state);
28300
28314
  for (const file5 of svelteFiles)
28301
28315
  ctx.pendingFiles.add(file5);
@@ -28322,6 +28336,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28322
28336
  }
28323
28337
  } finally {
28324
28338
  ctx.inFlight = null;
28339
+ if (!ctx.debounceTimer && !ctx.debouncedPromise && !ctx.pending && ctx.pendingFiles.size === 0)
28340
+ state.pendingBundleRebuilds.delete("svelte");
28325
28341
  }
28326
28342
  };
28327
28343
  const fire = () => {
@@ -28571,6 +28587,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28571
28587
  type: "vue-tier-zero-ssr-rebuild-complete"
28572
28588
  });
28573
28589
  }, scheduleVueBundleRebuild = (state, vueFiles, config) => {
28590
+ state.pendingBundleRebuilds.add("vue");
28574
28591
  const ctx = getOrCreateBundleCtx(vueBundleState, state);
28575
28592
  for (const file5 of vueFiles)
28576
28593
  ctx.pendingFiles.add(file5);
@@ -28597,6 +28614,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28597
28614
  }
28598
28615
  } finally {
28599
28616
  ctx.inFlight = null;
28617
+ if (!ctx.debounceTimer && !ctx.debouncedPromise && !ctx.pending && ctx.pendingFiles.size === 0)
28618
+ state.pendingBundleRebuilds.delete("vue");
28600
28619
  }
28601
28620
  };
28602
28621
  const fire = () => {
@@ -29459,6 +29478,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
29459
29478
  if (state.rebuildTimeout)
29460
29479
  clearTimeout(state.rebuildTimeout);
29461
29480
  state.rebuildTimeout = setTimeout(() => {
29481
+ state.rebuildTimeout = null;
29462
29482
  drainQueueAndRebuild(state, config, onRebuildComplete);
29463
29483
  }, REBUILD_BATCH_DELAY_MS);
29464
29484
  }, STYLE_FILE_EXT_RE, hasAngularOwnedStyleEdit = async (state, angularDir) => {
@@ -30551,8 +30571,11 @@ var STORE_KEY = "__elysiaStore", restoredStores, getGlobalValue = (key) => Refle
30551
30571
  entryWatcherReady: globalThis.__absoluteEntryWatcherReady === true,
30552
30572
  isRebuilding: hmrState2.isRebuilding,
30553
30573
  manifestKeys: Object.keys(manifest),
30574
+ pendingBundleRebuilds: Array.from(hmrState2.pendingBundleRebuilds),
30575
+ pendingFileChanges: Array.from(hmrState2.fileChangeQueue.values()).reduce((total, files) => total + files.length, 0),
30554
30576
  rebuildCount: hmrState2.rebuildCount,
30555
30577
  rebuildQueue: Array.from(hmrState2.rebuildQueue),
30578
+ rebuildScheduled: hmrState2.rebuildTimeout !== null,
30556
30579
  timestamp: Date.now()
30557
30580
  }));
30558
30581
  var init_hmr = __esm(() => {
@@ -40877,5 +40900,5 @@ export {
40877
40900
  ANGULAR_INIT_TIMEOUT_MS
40878
40901
  };
40879
40902
 
40880
- //# debugId=D2060DE03921305264756E2164756E21
40903
+ //# debugId=B33205E04E972F4064756E2164756E21
40881
40904
  //# sourceMappingURL=index.js.map