@absolutejs/absolute 0.19.0-beta.866 → 0.19.0-beta.868

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-hEWGDp/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-V8Evbn/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-hEWGDp/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-V8Evbn/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-hEWGDp/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-V8Evbn/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
@@ -9587,7 +9587,6 @@ var ENTITY_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
9587
9587
  ]);
9588
9588
  if (!u || typeof u.default !== 'function') return;
9589
9589
  if (${className}.\u0275cmp && typeof core.\u0275\u0275replaceMetadata === 'function') {
9590
- console.log('[abs-hmr] \u0275\u0275replaceMetadata for ${className}, def before:', !!${className}.\u0275cmp);
9591
9590
  try {
9592
9591
  core.\u0275\u0275replaceMetadata(
9593
9592
  ${className},
@@ -9597,7 +9596,6 @@ var ENTITY_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
9597
9596
  import.meta,
9598
9597
  __ng_hmr_id
9599
9598
  );
9600
- console.log('[abs-hmr] \u0275\u0275replaceMetadata returned for ${className}');
9601
9599
  } catch (err) {
9602
9600
  console.error('[abs-hmr] \u0275\u0275replaceMetadata threw for ${className}:', err);
9603
9601
  }
@@ -9607,12 +9605,50 @@ var ENTITY_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
9607
9605
  u.default(${className}, [core]);
9608
9606
  }
9609
9607
  };
9608
+ // Tier 1 remount: structural changes (new ctor params / new field
9609
+ // initializers / new providers) make a CONTEXT-preserving replace
9610
+ // unsafe \u2014 the existing instance lacks the new fields. The remount
9611
+ // path tears down the live LView and re-creates it via public
9612
+ // \`createComponent\` against the same host, so the new constructor
9613
+ // runs with fresh DI, new lifecycle hooks fire, and the splice
9614
+ // logic puts the result back in the parent's view tree. The
9615
+ // shared implementation is on \`globalThis.__absAngularRemount\` \u2014
9616
+ // installed by hmrClient.ts's import-time wiring.
9617
+ const __ng_hmr_remount = async (t) => {
9618
+ const [u, core] = await Promise.all([
9619
+ import('/@ng/component?c=' + encodeURIComponent(__ng_hmr_id) + '&t=' + t),
9620
+ import('@angular/core')
9621
+ ]);
9622
+ if (!u || typeof u.default !== 'function') return;
9623
+ if (typeof globalThis.__absAngularRemount === 'function' && ${className}.\u0275cmp) {
9624
+ try {
9625
+ await globalThis.__absAngularRemount(
9626
+ ${className},
9627
+ u.default,
9628
+ [core],
9629
+ [],
9630
+ core,
9631
+ ${JSON.stringify(className)}
9632
+ );
9633
+ } catch (err) {
9634
+ console.error('[abs-hmr] remount threw for ${className}:', err);
9635
+ }
9636
+ } else {
9637
+ // No remount helper installed (older absolutejs runtime, or
9638
+ // non-component entity). Fall back to surgical replace.
9639
+ u.default(${className}, [core]);
9640
+ }
9641
+ };
9642
+
9610
9643
  if (typeof globalThis !== 'undefined' &&
9611
9644
  globalThis.__angularHmr &&
9612
9645
  typeof globalThis.__angularHmr.on === 'function') {
9613
9646
  globalThis.__angularHmr.on('angular:component-update', (d) => {
9614
9647
  if (d && d.id === __ng_hmr_id) __ng_hmr_load(d.timestamp);
9615
9648
  });
9649
+ globalThis.__angularHmr.on('angular:component-remount', (d) => {
9650
+ if (d && d.id === __ng_hmr_id) __ng_hmr_remount(d.timestamp);
9651
+ });
9616
9652
  }
9617
9653
  }
9618
9654
  `, createAngularHmrInjectionPlugin = (params) => {
@@ -18834,7 +18870,12 @@ ${block}
18834
18870
  if (!moduleText) {
18835
18871
  return fail("unexpected-error", `buildSimpleEntityModule returned null for ${className}`);
18836
18872
  }
18837
- return { componentSource: sourceFile, moduleText, ok: true };
18873
+ return {
18874
+ componentSource: sourceFile,
18875
+ fingerprintChanged: false,
18876
+ moduleText,
18877
+ ok: true
18878
+ };
18838
18879
  }
18839
18880
  if (inheritsDecoratedClass(classNode)) {
18840
18881
  return fail("inherits-decorated-class");
@@ -18889,9 +18930,7 @@ ${block}
18889
18930
  const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
18890
18931
  const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
18891
18932
  const cachedFingerprint = fingerprintCache.get(fingerprintId);
18892
- if (cachedFingerprint && !fingerprintsEqual(cachedFingerprint, currentFingerprint)) {
18893
- return fail("structural-change", `fingerprint changed for ${className}; escalate to Tier 1`);
18894
- }
18933
+ const fingerprintChanged = cachedFingerprint !== undefined && !fingerprintsEqual(cachedFingerprint, currentFingerprint);
18895
18934
  const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
18896
18935
  const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
18897
18936
  const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
@@ -18996,7 +19035,12 @@ ${block}
18996
19035
  }
18997
19036
  }
18998
19037
  fingerprintCache.set(fingerprintId, currentFingerprint);
18999
- return { ok: true, moduleText, componentSource: sourceFile };
19038
+ return {
19039
+ componentSource: sourceFile,
19040
+ fingerprintChanged,
19041
+ moduleText,
19042
+ ok: true
19043
+ };
19000
19044
  } catch (err) {
19001
19045
  return fail("unexpected-error", String(err));
19002
19046
  }
@@ -19796,6 +19840,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19796
19840
  const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
19797
19841
  const queue = [];
19798
19842
  const queueIds = new Set;
19843
+ let anyFingerprintChanged = false;
19799
19844
  for (const editedFile of userEdited) {
19800
19845
  const owners = resolveOwningComponents2({
19801
19846
  changedFilePath: editedFile,
@@ -19803,6 +19848,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19803
19848
  });
19804
19849
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
19805
19850
  return {
19851
+ kind: "rebootstrap",
19806
19852
  reason: `no Angular-decorated class found in ${editedFile}`,
19807
19853
  tier: 1
19808
19854
  };
@@ -19818,14 +19864,21 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19818
19864
  });
19819
19865
  if (!result.ok) {
19820
19866
  return {
19867
+ kind: "rebootstrap",
19821
19868
  reason: `${className}: ${result.reason}${result.detail ? ` (${result.detail})` : ""}`,
19822
19869
  tier: 1
19823
19870
  };
19824
19871
  }
19872
+ if (result.fingerprintChanged) {
19873
+ anyFingerprintChanged = true;
19874
+ }
19825
19875
  queueIds.add(id);
19826
19876
  queue.push({ className, id });
19827
19877
  }
19828
19878
  }
19879
+ if (anyFingerprintChanged) {
19880
+ return { kind: "remount", queue, tier: 1 };
19881
+ }
19829
19882
  return { queue, tier: 0 };
19830
19883
  }, broadcastSurgical = (state, queue) => {
19831
19884
  const timestamp = Date.now();
@@ -19836,6 +19889,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19836
19889
  });
19837
19890
  logInfo(`[ng-hmr broadcast] ${className}`);
19838
19891
  }
19892
+ }, broadcastRemount = (state, queue) => {
19893
+ const timestamp = Date.now();
19894
+ for (const { id, className } of queue) {
19895
+ broadcastToClients(state, {
19896
+ data: { id, timestamp },
19897
+ type: "angular:component-remount"
19898
+ });
19899
+ logInfo(`[ng-hmr tier-1 remount] ${className}`);
19900
+ }
19839
19901
  }, broadcastRebootstrap = async (state, reason) => {
19840
19902
  logInfo(`[ng-hmr tier-1 rebootstrap] ${reason}`);
19841
19903
  broadcastToClients(state, {
@@ -19899,7 +19961,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19899
19961
  runBundle().catch((err) => {
19900
19962
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
19901
19963
  });
19902
- } else {
19964
+ } else if (verdict.tier === 1 && verdict.kind === "remount") {
19965
+ broadcastRemount(state, verdict.queue);
19966
+ runBundle().catch((err) => {
19967
+ logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
19968
+ });
19969
+ } else if (verdict.tier === 1 && verdict.kind === "rebootstrap") {
19903
19970
  await runBundle();
19904
19971
  await broadcastRebootstrap(state, verdict.reason);
19905
19972
  }
@@ -21623,5 +21690,5 @@ export {
21623
21690
  build
21624
21691
  };
21625
21692
 
21626
- //# debugId=8553496840CE9FD764756E2164756E21
21693
+ //# debugId=35B1C966D121B3ED64756E2164756E21
21627
21694
  //# sourceMappingURL=build.js.map