@absolutejs/absolute 0.19.0-beta.879 → 0.19.0-beta.880

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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-wj25fP/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-0pNeWY/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-wj25fP/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-0pNeWY/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-wj25fP/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-0pNeWY/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
package/dist/build.js CHANGED
@@ -9611,7 +9611,26 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9611
9611
  // patch the prototype, no view recreation needed).
9612
9612
  {
9613
9613
  const __ng_hmr_id = ${encodedIdLiteral};
9614
+ // Send a server-side ack so the dev terminal can log the
9615
+ // full HMR latency (server compile + WS hop + client apply +
9616
+ // CD pulse) rather than just the server-side compile time.
9617
+ const __ng_hmr_ack = (tier, applyMs, error) => {
9618
+ try {
9619
+ const ws = globalThis.__HMR_WS__;
9620
+ if (ws && ws.readyState === 1) {
9621
+ ws.send(JSON.stringify({
9622
+ type: 'angular:hmr-ack',
9623
+ id: __ng_hmr_id,
9624
+ className: ${JSON.stringify(className)},
9625
+ tier,
9626
+ applyMs,
9627
+ error
9628
+ }));
9629
+ }
9630
+ } catch {}
9631
+ };
9614
9632
  const __ng_hmr_load = async (t) => {
9633
+ const t0 = performance.now();
9615
9634
  const [u, core] = await Promise.all([
9616
9635
  import('/@ng/component?c=' + encodeURIComponent(__ng_hmr_id) + '&t=' + t),
9617
9636
  import('@angular/core')
@@ -9627,13 +9646,16 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9627
9646
  import.meta,
9628
9647
  __ng_hmr_id
9629
9648
  );
9649
+ __ng_hmr_ack('tier-0', performance.now() - t0);
9630
9650
  } catch (err) {
9631
9651
  console.error('[abs-hmr] \u0275\u0275replaceMetadata threw for ${className}:', err);
9652
+ __ng_hmr_ack('tier-0', performance.now() - t0, String(err && err.message || err));
9632
9653
  }
9633
9654
  } else {
9634
9655
  // Non-component entity (pipe / directive / service) \u2014 no
9635
9656
  // LView tree to walk, just apply the prototype patch.
9636
9657
  u.default(${className}, [core]);
9658
+ __ng_hmr_ack('tier-0', performance.now() - t0);
9637
9659
  }
9638
9660
  };
9639
9661
  // Tier 1 remount: structural changes (new ctor params / new field
@@ -9646,6 +9668,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9646
9668
  // shared implementation is on \`globalThis.__absAngularRemount\` \u2014
9647
9669
  // installed by hmrClient.ts's import-time wiring.
9648
9670
  const __ng_hmr_remount = async (t) => {
9671
+ const t0 = performance.now();
9649
9672
  const [u, core] = await Promise.all([
9650
9673
  import('/@ng/component?c=' + encodeURIComponent(__ng_hmr_id) + '&t=' + t),
9651
9674
  import('@angular/core')
@@ -9661,8 +9684,10 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9661
9684
  core,
9662
9685
  ${JSON.stringify(className)}
9663
9686
  );
9687
+ __ng_hmr_ack('tier-1a', performance.now() - t0);
9664
9688
  } catch (err) {
9665
9689
  console.error('[abs-hmr] remount threw for ${className}:', err);
9690
+ __ng_hmr_ack('tier-1a', performance.now() - t0, String(err && err.message || err));
9666
9691
  }
9667
9692
  } else {
9668
9693
  // No remount helper installed (older absolutejs runtime, or
@@ -16580,6 +16605,7 @@ var isValidHMRClientMessage = (data) => {
16580
16605
  case "request-rebuild":
16581
16606
  case "hydration-error":
16582
16607
  case "hmr-timing":
16608
+ case "angular:hmr-ack":
16583
16609
  return true;
16584
16610
  default:
16585
16611
  return false;
@@ -16666,6 +16692,12 @@ var trySendMessage = (client, messageStr) => {
16666
16692
  case "hmr-timing":
16667
16693
  logHmrUpdate(state.lastHmrPath ?? "", state.lastHmrFramework, data.duration);
16668
16694
  break;
16695
+ case "angular:hmr-ack": {
16696
+ const tag = data.tier === "tier-0" ? "tier-0" : "tier-1a";
16697
+ const suffix = data.error ? ` FAILED \u2014 ${data.error}` : ` applied in ${data.applyMs.toFixed(0)}ms`;
16698
+ logInfo(`[ng-hmr] ${tag} ${data.className}${suffix}`);
16699
+ break;
16700
+ }
16669
16701
  }
16670
16702
  }, handleHMRMessage = (state, client, message) => {
16671
16703
  try {
@@ -18328,13 +18360,21 @@ var init_typescript_translator = __esm(() => {
18328
18360
  var exports_fastHmrCompiler = {};
18329
18361
  __export(exports_fastHmrCompiler, {
18330
18362
  tryFastHmr: () => tryFastHmr,
18363
+ takePendingModule: () => takePendingModule,
18331
18364
  recordFingerprint: () => recordFingerprint,
18332
18365
  invalidateFingerprintCache: () => invalidateFingerprintCache
18333
18366
  });
18334
18367
  import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
18335
18368
  import { dirname as dirname18, relative as relative13, resolve as resolve31 } from "path";
18336
18369
  import ts7 from "typescript";
18337
- var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, arraysEqual = (a, b2) => {
18370
+ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, pendingModuleCache, takePendingModule = (id) => {
18371
+ const cached = pendingModuleCache.get(id);
18372
+ if (cached !== undefined)
18373
+ pendingModuleCache.delete(id);
18374
+ return cached;
18375
+ }, setPendingModule = (id, moduleText) => {
18376
+ pendingModuleCache.set(id, moduleText);
18377
+ }, arraysEqual = (a, b2) => {
18338
18378
  if (a.length !== b2.length)
18339
18379
  return false;
18340
18380
  for (let i = 0;i < a.length; i++) {
@@ -19157,6 +19197,7 @@ ${block}
19157
19197
  }
19158
19198
  }
19159
19199
  fingerprintCache.set(fingerprintId, currentFingerprint);
19200
+ setPendingModule(fingerprintId, moduleText);
19160
19201
  return {
19161
19202
  componentSource: sourceFile,
19162
19203
  fingerprintChanged,
@@ -19171,6 +19212,7 @@ var init_fastHmrCompiler = __esm(() => {
19171
19212
  init_hmrImportGenerator();
19172
19213
  init_typescript_translator();
19173
19214
  fingerprintCache = new Map;
19215
+ pendingModuleCache = new Map;
19174
19216
  INPUT_OUTPUT_DECORATORS = new Set(["Input", "Output"]);
19175
19217
  providerProbeCache = new Map;
19176
19218
  TS_EXTENSIONS = [".ts", ".tsx", ".d.ts"];
@@ -19337,6 +19379,12 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
19337
19379
  const filePathRel = decoded.slice(0, at2);
19338
19380
  const className = decoded.slice(at2 + 1);
19339
19381
  const componentFilePath = resolve32(process.cwd(), filePathRel);
19382
+ const cacheKey2 = encodeURIComponent(`${componentFilePath}@${className}`);
19383
+ const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
19384
+ const cached = takePendingModule2(cacheKey2);
19385
+ if (cached !== undefined) {
19386
+ return cached;
19387
+ }
19340
19388
  const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
19341
19389
  const owners = resolveOwningComponents2({
19342
19390
  changedFilePath: componentFilePath,
@@ -20004,21 +20052,19 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20004
20052
  return { queue, tier: 0 };
20005
20053
  }, broadcastSurgical = (state, queue) => {
20006
20054
  const timestamp = Date.now();
20007
- for (const { id, className } of queue) {
20055
+ for (const { id } of queue) {
20008
20056
  broadcastToClients(state, {
20009
20057
  data: { id, timestamp },
20010
20058
  type: "angular:component-update"
20011
20059
  });
20012
- logInfo(`[ng-hmr broadcast] ${className}`);
20013
20060
  }
20014
20061
  }, broadcastRemount = (state, queue) => {
20015
20062
  const timestamp = Date.now();
20016
- for (const { id, className } of queue) {
20063
+ for (const { id } of queue) {
20017
20064
  broadcastToClients(state, {
20018
20065
  data: { id, timestamp },
20019
20066
  type: "angular:component-remount"
20020
20067
  });
20021
- logInfo(`[ng-hmr tier-1 remount] ${className}`);
20022
20068
  }
20023
20069
  }, broadcastRebootstrap = async (state, reason) => {
20024
20070
  logInfo(`[ng-hmr tier-1 rebootstrap] ${reason}`);
@@ -20071,20 +20117,25 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20071
20117
  }
20072
20118
  const angularPagesPath = resolve35(angularDir, "pages");
20073
20119
  const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
20120
+ const tierStart = performance.now();
20074
20121
  const verdict = await decideAngularTier(state, angularDir);
20122
+ const tierMs = (performance.now() - tierStart).toFixed(0);
20075
20123
  const runBundle = async () => {
20076
20124
  if (pageEntries.length === 0)
20077
20125
  return;
20078
20126
  await compileAndBundleAngular(state, pageEntries, angularDir);
20079
20127
  markSsrCacheDirty("angular");
20080
20128
  };
20129
+ const queueDescription = (queue) => queue.map((e) => e.className).join(", ");
20081
20130
  if (verdict.tier === 0) {
20082
20131
  broadcastSurgical(state, verdict.queue);
20132
+ logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms; awaiting client apply)`);
20083
20133
  runBundle().catch((err) => {
20084
20134
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20085
20135
  });
20086
20136
  } else if (verdict.tier === 1 && verdict.kind === "remount") {
20087
20137
  broadcastRemount(state, verdict.queue);
20138
+ logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms; awaiting client apply)`);
20088
20139
  runBundle().catch((err) => {
20089
20140
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20090
20141
  });
@@ -21812,5 +21863,5 @@ export {
21812
21863
  build
21813
21864
  };
21814
21865
 
21815
- //# debugId=53ACDD84AE5243BB64756E2164756E21
21866
+ //# debugId=8A827EBBA39BF30864756E2164756E21
21816
21867
  //# sourceMappingURL=build.js.map