@absolutejs/absolute 0.19.0-beta.884 → 0.19.0-beta.886

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
@@ -20244,6 +20244,69 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20244
20244
  });
20245
20245
  const { invalidateFingerprintCache: invalidateFingerprintCache2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
20246
20246
  invalidateFingerprintCache2();
20247
+ }, ANGULAR_BUNDLE_DEBOUNCE_MS = 2000, angularBundleState, scheduleAngularBundleRebuild = (state, pageEntries, angularDir) => {
20248
+ let ctx = angularBundleState.get(state);
20249
+ if (!ctx) {
20250
+ ctx = {
20251
+ debouncedPromise: null,
20252
+ debouncedResolve: null,
20253
+ debounceTimer: null,
20254
+ inFlight: null,
20255
+ pending: false
20256
+ };
20257
+ angularBundleState.set(state, ctx);
20258
+ }
20259
+ const doOne = async () => {
20260
+ if (pageEntries.length === 0)
20261
+ return;
20262
+ await compileAndBundleAngular(state, pageEntries, angularDir);
20263
+ markSsrCacheDirty("angular");
20264
+ };
20265
+ const drive = async () => {
20266
+ try {
20267
+ while (true) {
20268
+ ctx.pending = false;
20269
+ await doOne();
20270
+ if (!ctx.pending)
20271
+ break;
20272
+ }
20273
+ } finally {
20274
+ ctx.inFlight = null;
20275
+ }
20276
+ };
20277
+ const fire = () => {
20278
+ ctx.debounceTimer = null;
20279
+ const resolve38 = ctx.debouncedResolve;
20280
+ ctx.debouncedResolve = null;
20281
+ ctx.debouncedPromise = null;
20282
+ if (ctx.inFlight) {
20283
+ ctx.pending = true;
20284
+ ctx.inFlight.finally(() => resolve38?.());
20285
+ return;
20286
+ }
20287
+ ctx.inFlight = drive();
20288
+ ctx.inFlight.finally(() => resolve38?.());
20289
+ };
20290
+ return ({ immediate = false } = {}) => {
20291
+ if (!ctx.debouncedPromise) {
20292
+ ctx.debouncedPromise = new Promise((res) => {
20293
+ ctx.debouncedResolve = res;
20294
+ });
20295
+ }
20296
+ if (immediate) {
20297
+ if (ctx.debounceTimer) {
20298
+ clearTimeout(ctx.debounceTimer);
20299
+ ctx.debounceTimer = null;
20300
+ }
20301
+ fire();
20302
+ } else if (!ctx.debounceTimer) {
20303
+ ctx.debounceTimer = setTimeout(fire, ANGULAR_BUNDLE_DEBOUNCE_MS);
20304
+ } else {
20305
+ clearTimeout(ctx.debounceTimer);
20306
+ ctx.debounceTimer = setTimeout(fire, ANGULAR_BUNDLE_DEBOUNCE_MS);
20307
+ }
20308
+ return ctx.debouncedPromise;
20309
+ };
20247
20310
  }, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
20248
20311
  const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
20249
20312
  const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, getStyleTransformConfig(state.config));
@@ -20286,12 +20349,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20286
20349
  const tierStart = performance.now();
20287
20350
  const verdict = await decideAngularTier(state, angularDir);
20288
20351
  const tierMs = (performance.now() - tierStart).toFixed(0);
20289
- const runBundle = async () => {
20290
- if (pageEntries.length === 0)
20291
- return;
20292
- await compileAndBundleAngular(state, pageEntries, angularDir);
20293
- markSsrCacheDirty("angular");
20294
- };
20352
+ const runBundle = scheduleAngularBundleRebuild(state, pageEntries, angularDir);
20295
20353
  const queueDescription = (queue) => queue.map((e) => e.className).join(", ");
20296
20354
  if (verdict.tier === 0) {
20297
20355
  broadcastSurgical(state, verdict.queue);
@@ -20308,7 +20366,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20308
20366
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20309
20367
  });
20310
20368
  } else if (verdict.tier === 1 && verdict.kind === "rebootstrap") {
20311
- await runBundle();
20369
+ await runBundle({ immediate: true });
20312
20370
  await broadcastRebootstrap(state, verdict.reason);
20313
20371
  }
20314
20372
  const { manifest } = state;
@@ -21383,6 +21441,7 @@ var init_rebuildTrigger = __esm(() => {
21383
21441
  init_tailwindCompiler();
21384
21442
  init_ssrCache();
21385
21443
  moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
21444
+ angularBundleState = new WeakMap;
21386
21445
  getReactModuleUrl = getModuleUrl;
21387
21446
  EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
21388
21447
  HMR_SCRIPT_PATTERN = /<script>window\.__HMR_FRAMEWORK__[\s\S]*?<\/script>\s*<script data-hmr-client>[\s\S]*?<\/script>/;
@@ -30611,5 +30670,5 @@ export {
30611
30670
  ANGULAR_INIT_TIMEOUT_MS
30612
30671
  };
30613
30672
 
30614
- //# debugId=8DCA359899760D3964756E2164756E21
30673
+ //# debugId=59FE78EE649876C664756E2164756E21
30615
30674
  //# sourceMappingURL=index.js.map