@absolutejs/absolute 0.19.0-beta.885 → 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,12 +20244,18 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20244
20244
  });
20245
20245
  const { invalidateFingerprintCache: invalidateFingerprintCache2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
20246
20246
  invalidateFingerprintCache2();
20247
- }, angularBundleState, scheduleAngularBundleRebuild = (state, pageEntries, angularDir) => {
20248
- const ctx = angularBundleState.get(state) ?? {
20249
- inFlight: null,
20250
- pending: false
20251
- };
20252
- angularBundleState.set(state, ctx);
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
+ }
20253
20259
  const doOne = async () => {
20254
20260
  if (pageEntries.length === 0)
20255
20261
  return;
@@ -20268,13 +20274,38 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20268
20274
  ctx.inFlight = null;
20269
20275
  }
20270
20276
  };
20271
- return () => {
20277
+ const fire = () => {
20278
+ ctx.debounceTimer = null;
20279
+ const resolve38 = ctx.debouncedResolve;
20280
+ ctx.debouncedResolve = null;
20281
+ ctx.debouncedPromise = null;
20272
20282
  if (ctx.inFlight) {
20273
20283
  ctx.pending = true;
20274
- return ctx.inFlight;
20284
+ ctx.inFlight.finally(() => resolve38?.());
20285
+ return;
20275
20286
  }
20276
20287
  ctx.inFlight = drive();
20277
- return ctx.inFlight;
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;
20278
20309
  };
20279
20310
  }, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
20280
20311
  const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
@@ -20335,7 +20366,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20335
20366
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20336
20367
  });
20337
20368
  } else if (verdict.tier === 1 && verdict.kind === "rebootstrap") {
20338
- await runBundle();
20369
+ await runBundle({ immediate: true });
20339
20370
  await broadcastRebootstrap(state, verdict.reason);
20340
20371
  }
20341
20372
  const { manifest } = state;
@@ -30639,5 +30670,5 @@ export {
30639
30670
  ANGULAR_INIT_TIMEOUT_MS
30640
30671
  };
30641
30672
 
30642
- //# debugId=DD22867E883BBEBF64756E2164756E21
30673
+ //# debugId=59FE78EE649876C664756E2164756E21
30643
30674
  //# sourceMappingURL=index.js.map