@absolutejs/absolute 0.19.0-beta.867 → 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-yAuLPh/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-yAuLPh/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-yAuLPh/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
@@ -9605,12 +9605,50 @@ var ENTITY_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
9605
9605
  u.default(${className}, [core]);
9606
9606
  }
9607
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
+
9608
9643
  if (typeof globalThis !== 'undefined' &&
9609
9644
  globalThis.__angularHmr &&
9610
9645
  typeof globalThis.__angularHmr.on === 'function') {
9611
9646
  globalThis.__angularHmr.on('angular:component-update', (d) => {
9612
9647
  if (d && d.id === __ng_hmr_id) __ng_hmr_load(d.timestamp);
9613
9648
  });
9649
+ globalThis.__angularHmr.on('angular:component-remount', (d) => {
9650
+ if (d && d.id === __ng_hmr_id) __ng_hmr_remount(d.timestamp);
9651
+ });
9614
9652
  }
9615
9653
  }
9616
9654
  `, createAngularHmrInjectionPlugin = (params) => {
@@ -18832,7 +18870,12 @@ ${block}
18832
18870
  if (!moduleText) {
18833
18871
  return fail("unexpected-error", `buildSimpleEntityModule returned null for ${className}`);
18834
18872
  }
18835
- return { componentSource: sourceFile, moduleText, ok: true };
18873
+ return {
18874
+ componentSource: sourceFile,
18875
+ fingerprintChanged: false,
18876
+ moduleText,
18877
+ ok: true
18878
+ };
18836
18879
  }
18837
18880
  if (inheritsDecoratedClass(classNode)) {
18838
18881
  return fail("inherits-decorated-class");
@@ -18887,9 +18930,7 @@ ${block}
18887
18930
  const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
18888
18931
  const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
18889
18932
  const cachedFingerprint = fingerprintCache.get(fingerprintId);
18890
- if (cachedFingerprint && !fingerprintsEqual(cachedFingerprint, currentFingerprint)) {
18891
- return fail("structural-change", `fingerprint changed for ${className}; escalate to Tier 1`);
18892
- }
18933
+ const fingerprintChanged = cachedFingerprint !== undefined && !fingerprintsEqual(cachedFingerprint, currentFingerprint);
18893
18934
  const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
18894
18935
  const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
18895
18936
  const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
@@ -18994,7 +19035,12 @@ ${block}
18994
19035
  }
18995
19036
  }
18996
19037
  fingerprintCache.set(fingerprintId, currentFingerprint);
18997
- return { ok: true, moduleText, componentSource: sourceFile };
19038
+ return {
19039
+ componentSource: sourceFile,
19040
+ fingerprintChanged,
19041
+ moduleText,
19042
+ ok: true
19043
+ };
18998
19044
  } catch (err) {
18999
19045
  return fail("unexpected-error", String(err));
19000
19046
  }
@@ -19794,6 +19840,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19794
19840
  const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
19795
19841
  const queue = [];
19796
19842
  const queueIds = new Set;
19843
+ let anyFingerprintChanged = false;
19797
19844
  for (const editedFile of userEdited) {
19798
19845
  const owners = resolveOwningComponents2({
19799
19846
  changedFilePath: editedFile,
@@ -19801,6 +19848,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19801
19848
  });
19802
19849
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
19803
19850
  return {
19851
+ kind: "rebootstrap",
19804
19852
  reason: `no Angular-decorated class found in ${editedFile}`,
19805
19853
  tier: 1
19806
19854
  };
@@ -19816,14 +19864,21 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19816
19864
  });
19817
19865
  if (!result.ok) {
19818
19866
  return {
19867
+ kind: "rebootstrap",
19819
19868
  reason: `${className}: ${result.reason}${result.detail ? ` (${result.detail})` : ""}`,
19820
19869
  tier: 1
19821
19870
  };
19822
19871
  }
19872
+ if (result.fingerprintChanged) {
19873
+ anyFingerprintChanged = true;
19874
+ }
19823
19875
  queueIds.add(id);
19824
19876
  queue.push({ className, id });
19825
19877
  }
19826
19878
  }
19879
+ if (anyFingerprintChanged) {
19880
+ return { kind: "remount", queue, tier: 1 };
19881
+ }
19827
19882
  return { queue, tier: 0 };
19828
19883
  }, broadcastSurgical = (state, queue) => {
19829
19884
  const timestamp = Date.now();
@@ -19834,6 +19889,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19834
19889
  });
19835
19890
  logInfo(`[ng-hmr broadcast] ${className}`);
19836
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
+ }
19837
19901
  }, broadcastRebootstrap = async (state, reason) => {
19838
19902
  logInfo(`[ng-hmr tier-1 rebootstrap] ${reason}`);
19839
19903
  broadcastToClients(state, {
@@ -19897,7 +19961,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19897
19961
  runBundle().catch((err) => {
19898
19962
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
19899
19963
  });
19900
- } 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") {
19901
19970
  await runBundle();
19902
19971
  await broadcastRebootstrap(state, verdict.reason);
19903
19972
  }
@@ -21621,5 +21690,5 @@ export {
21621
21690
  build
21622
21691
  };
21623
21692
 
21624
- //# debugId=E0A2905363130C5764756E2164756E21
21693
+ //# debugId=35B1C966D121B3ED64756E2164756E21
21625
21694
  //# sourceMappingURL=build.js.map