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

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-Xhhant/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-ttB5kz/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-Xhhant/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-ttB5kz/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-Xhhant/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-ttB5kz/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,6 +9611,15 @@ 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
+ // Per-class sequence counter. Each \`__ng_hmr_load\` /
9615
+ // \`__ng_hmr_remount\` invocation captures \`seq\` at start, then
9616
+ // checks after the async fetch + before the apply. If a NEWER
9617
+ // event has bumped the counter while we were awaiting (rapid
9618
+ // edits), this older invocation aborts so the latest payload
9619
+ // is the one that lands. Without this guard, racing
9620
+ // \`\u0275\u0275replaceMetadata\` calls can complete out of order and an
9621
+ // older edit's def stomps a newer one's.
9622
+ let __ng_hmr_seq = 0;
9614
9623
  // Send a server-side ack so the dev terminal can log the
9615
9624
  // full HMR latency (server compile + WS hop + client apply +
9616
9625
  // CD pulse) rather than just the server-side compile time.
@@ -9630,11 +9639,13 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9630
9639
  } catch {}
9631
9640
  };
9632
9641
  const __ng_hmr_load = async (t) => {
9642
+ const mySeq = ++__ng_hmr_seq;
9633
9643
  const t0 = performance.now();
9634
9644
  const [u, core] = await Promise.all([
9635
9645
  import('/@ng/component?c=' + encodeURIComponent(__ng_hmr_id) + '&t=' + t),
9636
9646
  import('@angular/core')
9637
9647
  ]);
9648
+ if (mySeq !== __ng_hmr_seq) return; // superseded by a newer event
9638
9649
  if (!u || typeof u.default !== 'function') return;
9639
9650
  if (${className}.\u0275cmp && typeof core.\u0275\u0275replaceMetadata === 'function') {
9640
9651
  try {
@@ -9668,11 +9679,13 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9668
9679
  // shared implementation is on \`globalThis.__absAngularRemount\` \u2014
9669
9680
  // installed by hmrClient.ts's import-time wiring.
9670
9681
  const __ng_hmr_remount = async (t) => {
9682
+ const mySeq = ++__ng_hmr_seq;
9671
9683
  const t0 = performance.now();
9672
9684
  const [u, core] = await Promise.all([
9673
9685
  import('/@ng/component?c=' + encodeURIComponent(__ng_hmr_id) + '&t=' + t),
9674
9686
  import('@angular/core')
9675
9687
  ]);
9688
+ if (mySeq !== __ng_hmr_seq) return; // superseded by a newer event
9676
9689
  if (!u || typeof u.default !== 'function') return;
9677
9690
  if (typeof globalThis.__absAngularRemount === 'function' && ${className}.\u0275cmp) {
9678
9691
  try {
@@ -9684,6 +9697,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9684
9697
  core,
9685
9698
  ${JSON.stringify(className)}
9686
9699
  );
9700
+ if (mySeq !== __ng_hmr_seq) return; // newer event arrived during remount
9687
9701
  __ng_hmr_ack('tier-1a', performance.now() - t0);
9688
9702
  } catch (err) {
9689
9703
  console.error('[abs-hmr] remount threw for ${className}:', err);
@@ -17526,7 +17540,8 @@ var init_rewriteImports = __esm(() => {
17526
17540
  // src/dev/angular/resolveOwningComponents.ts
17527
17541
  var exports_resolveOwningComponents = {};
17528
17542
  __export(exports_resolveOwningComponents, {
17529
- resolveOwningComponents: () => resolveOwningComponents
17543
+ resolveOwningComponents: () => resolveOwningComponents,
17544
+ invalidateResourceIndex: () => invalidateResourceIndex
17530
17545
  });
17531
17546
  import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
17532
17547
  import { dirname as dirname17, extname as extname9, join as join28, resolve as resolve30 } from "path";
@@ -17657,27 +17672,42 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
17657
17672
  }
17658
17673
  if (!rootStat.isDirectory())
17659
17674
  return out;
17675
+ const index = getOrBuildResourceIndex(userAngularRoot);
17676
+ const owners = index.get(changedAbs);
17677
+ if (owners) {
17678
+ out.push(...owners);
17679
+ }
17680
+ return out;
17681
+ }, resourceIndexByRoot, getOrBuildResourceIndex = (userAngularRoot) => {
17682
+ const cached = resourceIndexByRoot.get(userAngularRoot);
17683
+ if (cached)
17684
+ return cached;
17685
+ const index = new Map;
17660
17686
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
17661
17687
  const classes = parseDecoratedClasses(tsPath);
17662
17688
  const componentDir = dirname17(tsPath);
17663
- const matchesResource = (relativeUrl) => {
17664
- const abs = safeNormalize(resolve30(componentDir, relativeUrl));
17665
- return abs === changedAbs;
17666
- };
17667
17689
  for (const cls of classes) {
17668
17690
  if (cls.kind !== "component")
17669
17691
  continue;
17670
- const referencesChanged = cls.templateUrls.some(matchesResource) || cls.styleUrls.some(matchesResource);
17671
- if (!referencesChanged)
17672
- continue;
17673
- out.push({
17692
+ const owner = {
17674
17693
  className: cls.className,
17675
17694
  componentFilePath: tsPath,
17676
17695
  kind: "component"
17677
- });
17696
+ };
17697
+ for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
17698
+ const abs = safeNormalize(resolve30(componentDir, url));
17699
+ const existing = index.get(abs);
17700
+ if (existing)
17701
+ existing.push(owner);
17702
+ else
17703
+ index.set(abs, [owner]);
17704
+ }
17678
17705
  }
17679
17706
  }
17680
- return out;
17707
+ resourceIndexByRoot.set(userAngularRoot, index);
17708
+ return index;
17709
+ }, invalidateResourceIndex = () => {
17710
+ resourceIndexByRoot.clear();
17681
17711
  };
17682
17712
  var init_resolveOwningComponents = __esm(() => {
17683
17713
  ENTITY_DECORATORS = {
@@ -17686,6 +17716,7 @@ var init_resolveOwningComponents = __esm(() => {
17686
17716
  Pipe: "pipe",
17687
17717
  Injectable: "service"
17688
17718
  };
17719
+ resourceIndexByRoot = new Map;
17689
17720
  });
17690
17721
 
17691
17722
  // src/dev/angular/hmrImportGenerator.ts
@@ -20002,21 +20033,51 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20002
20033
  const clientManifest = generateManifest2(clientResult.outputs, buildDir);
20003
20034
  Object.assign(state.manifest, clientManifest);
20004
20035
  await populateAssetStore(state.assetStore, clientManifest, buildDir);
20036
+ }, angularDispatcherModules = null, loadAngularDispatcherModules = async () => {
20037
+ if (angularDispatcherModules)
20038
+ return angularDispatcherModules;
20039
+ const [resolveMod, hmrMod, fastMod] = await Promise.all([
20040
+ Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents)),
20041
+ Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler)),
20042
+ Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler))
20043
+ ]);
20044
+ angularDispatcherModules = {
20045
+ encodeHmrComponentId: hmrMod.encodeHmrComponentId,
20046
+ invalidateResourceIndex: resolveMod.invalidateResourceIndex,
20047
+ resolveOwningComponents: resolveMod.resolveOwningComponents,
20048
+ tryFastHmr: fastMod.tryFastHmr
20049
+ };
20050
+ return angularDispatcherModules;
20005
20051
  }, decideAngularTier = async (state, angularDir) => {
20006
20052
  const userEdited = state.lastUserEditedFiles ?? new Set;
20007
20053
  if (userEdited.size === 0)
20008
20054
  return { queue: [], tier: 0 };
20009
- const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
20010
- const { encodeHmrComponentId: encodeHmrComponentId2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
20011
- const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
20055
+ const importsStart = performance.now();
20056
+ const {
20057
+ resolveOwningComponents: resolveOwningComponents2,
20058
+ invalidateResourceIndex: invalidateResourceIndex2,
20059
+ encodeHmrComponentId: encodeHmrComponentId2,
20060
+ tryFastHmr: tryFastHmr2
20061
+ } = await loadAngularDispatcherModules();
20062
+ const importsMs = performance.now() - importsStart;
20063
+ for (const editedFile of userEdited) {
20064
+ if (editedFile.endsWith(".ts") || editedFile.endsWith(".tsx")) {
20065
+ invalidateResourceIndex2();
20066
+ break;
20067
+ }
20068
+ }
20012
20069
  const queue = [];
20013
20070
  const queueIds = new Set;
20014
20071
  let anyFingerprintChanged = false;
20072
+ let totalResolveMs = 0;
20073
+ let totalCompileMs = 0;
20015
20074
  for (const editedFile of userEdited) {
20075
+ const resolveStart = performance.now();
20016
20076
  const owners = resolveOwningComponents2({
20017
20077
  changedFilePath: editedFile,
20018
20078
  userAngularRoot: angularDir
20019
20079
  });
20080
+ totalResolveMs += performance.now() - resolveStart;
20020
20081
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
20021
20082
  return {
20022
20083
  kind: "rebootstrap",
@@ -20028,11 +20089,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20028
20089
  const id = encodeHmrComponentId2(componentFilePath, className);
20029
20090
  if (queueIds.has(id))
20030
20091
  continue;
20092
+ const compileStart = performance.now();
20031
20093
  const result = await tryFastHmr2({
20032
20094
  className,
20033
20095
  componentFilePath,
20034
20096
  kind
20035
20097
  });
20098
+ totalCompileMs += performance.now() - compileStart;
20036
20099
  if (!result.ok) {
20037
20100
  return {
20038
20101
  kind: "rebootstrap",
@@ -20047,10 +20110,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20047
20110
  queue.push({ className, id });
20048
20111
  }
20049
20112
  }
20113
+ const breakdown = {
20114
+ importsMs: Math.round(importsMs),
20115
+ resolveMs: Math.round(totalResolveMs),
20116
+ compileMs: Math.round(totalCompileMs)
20117
+ };
20050
20118
  if (anyFingerprintChanged) {
20051
- return { kind: "remount", queue, tier: 1 };
20119
+ return { breakdown, kind: "remount", queue, tier: 1 };
20052
20120
  }
20053
- return { queue, tier: 0 };
20121
+ return { breakdown, queue, tier: 0 };
20054
20122
  }, broadcastSurgical = (state, queue) => {
20055
20123
  const timestamp = Date.now();
20056
20124
  for (const { id } of queue) {
@@ -20130,13 +20198,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20130
20198
  const queueDescription = (queue) => queue.map((e) => e.className).join(", ");
20131
20199
  if (verdict.tier === 0) {
20132
20200
  broadcastSurgical(state, verdict.queue);
20133
- logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms; awaiting client apply)`);
20201
+ const b2 = verdict.breakdown;
20202
+ logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
20134
20203
  runBundle().catch((err) => {
20135
20204
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20136
20205
  });
20137
20206
  } else if (verdict.tier === 1 && verdict.kind === "remount") {
20138
20207
  broadcastRemount(state, verdict.queue);
20139
- logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms; awaiting client apply)`);
20208
+ const b2 = verdict.breakdown;
20209
+ logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
20140
20210
  runBundle().catch((err) => {
20141
20211
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20142
20212
  });
@@ -21864,5 +21934,5 @@ export {
21864
21934
  build
21865
21935
  };
21866
21936
 
21867
- //# debugId=D6B6989A00DDAE4A64756E2164756E21
21937
+ //# debugId=0E9665625D8067C864756E2164756E21
21868
21938
  //# sourceMappingURL=build.js.map