@absolutejs/absolute 0.19.0-beta.925 → 0.19.0-beta.926

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-V4sB2h/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-qpVFiB/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-V4sB2h/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-qpVFiB/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-V4sB2h/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-qpVFiB/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
@@ -17692,6 +17692,7 @@ var init_rewriteImports = __esm(() => {
17692
17692
  var exports_resolveOwningComponents = {};
17693
17693
  __export(exports_resolveOwningComponents, {
17694
17694
  resolveOwningComponents: () => resolveOwningComponents,
17695
+ resolveDescendantsOfParent: () => resolveDescendantsOfParent,
17695
17696
  invalidateResourceIndex: () => invalidateResourceIndex
17696
17697
  });
17697
17698
  import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
@@ -17772,11 +17773,23 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
17772
17773
  const kind = ENTITY_DECORATORS[fn2.text];
17773
17774
  if (!kind)
17774
17775
  continue;
17776
+ let extendsName = null;
17777
+ for (const heritage of node.heritageClauses ?? []) {
17778
+ if (heritage.token !== ts3.SyntaxKind.ExtendsKeyword) {
17779
+ continue;
17780
+ }
17781
+ const first = heritage.types[0];
17782
+ if (first && ts3.isIdentifier(first.expression)) {
17783
+ extendsName = first.expression.text;
17784
+ }
17785
+ break;
17786
+ }
17775
17787
  const entry = {
17776
17788
  className: node.name.text,
17777
17789
  kind,
17778
17790
  styleUrls: [],
17779
- templateUrls: []
17791
+ templateUrls: [],
17792
+ extendsName
17780
17793
  };
17781
17794
  const arg = expr.arguments[0];
17782
17795
  if (arg && ts3.isObjectLiteralExpression(arg) && kind === "component") {
@@ -17829,36 +17842,117 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
17829
17842
  out.push(...owners);
17830
17843
  }
17831
17844
  return out;
17832
- }, resourceIndexByRoot, getOrBuildResourceIndex = (userAngularRoot) => {
17833
- const cached = resourceIndexByRoot.get(userAngularRoot);
17845
+ }, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
17846
+ let source;
17847
+ try {
17848
+ source = readFileSync18(childFilePath, "utf8");
17849
+ } catch {
17850
+ return null;
17851
+ }
17852
+ const sf = ts3.createSourceFile(childFilePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
17853
+ const childDir = dirname17(childFilePath);
17854
+ for (const stmt of sf.statements) {
17855
+ if (!ts3.isImportDeclaration(stmt))
17856
+ continue;
17857
+ if (!ts3.isStringLiteral(stmt.moduleSpecifier))
17858
+ continue;
17859
+ const clause = stmt.importClause;
17860
+ if (!clause || clause.isTypeOnly)
17861
+ continue;
17862
+ let matchesName = false;
17863
+ if (clause.name && clause.name.text === parentName)
17864
+ matchesName = true;
17865
+ if (!matchesName && clause.namedBindings && ts3.isNamedImports(clause.namedBindings)) {
17866
+ for (const el of clause.namedBindings.elements) {
17867
+ if (el.isTypeOnly)
17868
+ continue;
17869
+ if (el.name.text === parentName) {
17870
+ matchesName = true;
17871
+ break;
17872
+ }
17873
+ }
17874
+ }
17875
+ if (!matchesName)
17876
+ continue;
17877
+ const spec = stmt.moduleSpecifier.text;
17878
+ if (!spec.startsWith(".") && !spec.startsWith("/")) {
17879
+ return null;
17880
+ }
17881
+ const base = resolve31(childDir, spec);
17882
+ const candidates = [
17883
+ `${base}.ts`,
17884
+ `${base}.tsx`,
17885
+ `${base}/index.ts`,
17886
+ `${base}/index.tsx`
17887
+ ];
17888
+ const angularRootNorm = safeNormalize(angularRoot);
17889
+ for (const candidate of candidates) {
17890
+ try {
17891
+ if (statSync3(candidate).isFile()) {
17892
+ const norm = safeNormalize(candidate);
17893
+ if (!norm.startsWith(angularRootNorm))
17894
+ return null;
17895
+ return norm;
17896
+ }
17897
+ } catch {}
17898
+ }
17899
+ return null;
17900
+ }
17901
+ return null;
17902
+ }, getOrBuildIndexes = (userAngularRoot) => {
17903
+ const cached = indexByRoot.get(userAngularRoot);
17834
17904
  if (cached)
17835
17905
  return cached;
17836
- const index = new Map;
17906
+ const resource = new Map;
17907
+ const parentFile = new Map;
17837
17908
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
17838
17909
  const classes = parseDecoratedClasses(tsPath);
17839
17910
  const componentDir = dirname17(tsPath);
17840
17911
  for (const cls of classes) {
17841
- if (cls.kind !== "component")
17842
- continue;
17843
- const owner = {
17912
+ const entity = {
17844
17913
  className: cls.className,
17845
17914
  componentFilePath: tsPath,
17846
- kind: "component"
17915
+ kind: cls.kind
17847
17916
  };
17848
- for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
17849
- const abs = safeNormalize(resolve31(componentDir, url));
17850
- const existing = index.get(abs);
17851
- if (existing)
17852
- existing.push(owner);
17853
- else
17854
- index.set(abs, [owner]);
17917
+ if (cls.kind === "component") {
17918
+ for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
17919
+ const abs = safeNormalize(resolve31(componentDir, url));
17920
+ const existing = resource.get(abs);
17921
+ if (existing)
17922
+ existing.push(entity);
17923
+ else
17924
+ resource.set(abs, [entity]);
17925
+ }
17926
+ }
17927
+ if (cls.extendsName !== null) {
17928
+ const parentPath = resolveParentClassFile(cls.extendsName, tsPath, userAngularRoot);
17929
+ if (parentPath !== null && parentPath !== safeNormalize(tsPath)) {
17930
+ const existing = parentFile.get(parentPath);
17931
+ if (existing)
17932
+ existing.push(entity);
17933
+ else
17934
+ parentFile.set(parentPath, [entity]);
17935
+ }
17855
17936
  }
17856
17937
  }
17857
17938
  }
17858
- resourceIndexByRoot.set(userAngularRoot, index);
17859
- return index;
17939
+ const bundle = { parentFile, resource };
17940
+ indexByRoot.set(userAngularRoot, bundle);
17941
+ return bundle;
17942
+ }, getOrBuildResourceIndex = (userAngularRoot) => getOrBuildIndexes(userAngularRoot).resource, resolveDescendantsOfParent = (params) => {
17943
+ const norm = safeNormalize(params.changedFilePath);
17944
+ let rootStat;
17945
+ try {
17946
+ rootStat = statSync3(params.userAngularRoot);
17947
+ } catch {
17948
+ return [];
17949
+ }
17950
+ if (!rootStat.isDirectory())
17951
+ return [];
17952
+ const bundle = getOrBuildIndexes(params.userAngularRoot);
17953
+ return bundle.parentFile.get(norm) ?? [];
17860
17954
  }, invalidateResourceIndex = () => {
17861
- resourceIndexByRoot.clear();
17955
+ indexByRoot.clear();
17862
17956
  };
17863
17957
  var init_resolveOwningComponents = __esm(() => {
17864
17958
  ENTITY_DECORATORS = {
@@ -17867,7 +17961,7 @@ var init_resolveOwningComponents = __esm(() => {
17867
17961
  Pipe: "pipe",
17868
17962
  Injectable: "service"
17869
17963
  };
17870
- resourceIndexByRoot = new Map;
17964
+ indexByRoot = new Map;
17871
17965
  });
17872
17966
 
17873
17967
  // src/dev/angular/hmrImportGenerator.ts
@@ -18605,6 +18699,74 @@ var fail = (reason, detail, location) => ({
18605
18699
  fingerprintCache.set(id, fp);
18606
18700
  }, invalidateFingerprintCache = () => {
18607
18701
  fingerprintCache.clear();
18702
+ entityFingerprintCache.clear();
18703
+ }, entityFingerprintCache, entityFingerprintsEqual = (a, b2) => {
18704
+ if (a.className !== b2.className)
18705
+ return false;
18706
+ if (a.decoratorArgsText !== b2.decoratorArgsText)
18707
+ return false;
18708
+ if (!arraysEqual(a.ctorParamTypes, b2.ctorParamTypes))
18709
+ return false;
18710
+ if (!arraysEqual(a.topLevelImports, b2.topLevelImports))
18711
+ return false;
18712
+ if (!arraysEqual(a.memberDecoratorSig, b2.memberDecoratorSig))
18713
+ return false;
18714
+ if (!arraysEqual(a.arrowFieldSig, b2.arrowFieldSig))
18715
+ return false;
18716
+ if (!arraysEqual(a.propertyFieldNames, b2.propertyFieldNames))
18717
+ return false;
18718
+ return true;
18719
+ }, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
18720
+ for (const dec of ts7.getDecorators(cls) ?? []) {
18721
+ const expr = dec.expression;
18722
+ if (!ts7.isCallExpression(expr))
18723
+ continue;
18724
+ if (!ts7.isIdentifier(expr.expression))
18725
+ continue;
18726
+ if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
18727
+ return dec;
18728
+ }
18729
+ return null;
18730
+ }, extractEntityFingerprint = (cls, className, sourceFile) => {
18731
+ const decorator = findEntityDecorator(cls);
18732
+ let decoratorArgsText = "";
18733
+ if (decorator !== null) {
18734
+ const expr = decorator.expression;
18735
+ const arg = expr.arguments[0];
18736
+ if (arg !== undefined) {
18737
+ decoratorArgsText = arg.getText().replace(/\s+/g, " ").trim();
18738
+ }
18739
+ }
18740
+ const ctorParamTypes = [];
18741
+ for (const member of cls.members) {
18742
+ if (!ts7.isConstructorDeclaration(member))
18743
+ continue;
18744
+ for (const param of member.parameters) {
18745
+ const typeText = param.type ? param.type.getText() : "";
18746
+ const decorators = ts7.getDecorators(param) ?? [];
18747
+ const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
18748
+ const e = d2.expression;
18749
+ if (ts7.isCallExpression(e) && ts7.isIdentifier(e.expression)) {
18750
+ const args = e.arguments.map((a) => a.getText()).join(",");
18751
+ return `@${e.expression.text}(${args})`;
18752
+ }
18753
+ if (ts7.isIdentifier(e))
18754
+ return `@${e.text}`;
18755
+ return "@<unknown>";
18756
+ }).join("");
18757
+ ctorParamTypes.push(`${typeText}${decoratorSig}`);
18758
+ }
18759
+ break;
18760
+ }
18761
+ return {
18762
+ className,
18763
+ decoratorArgsText,
18764
+ ctorParamTypes,
18765
+ topLevelImports: extractTopLevelImports(sourceFile),
18766
+ memberDecoratorSig: extractMemberDecoratorSig(cls),
18767
+ arrowFieldSig: extractArrowFieldSig(cls),
18768
+ propertyFieldNames: extractPropertyFieldNames(cls)
18769
+ };
18608
18770
  }, findClassDeclaration = (sourceFile, className) => {
18609
18771
  let found = null;
18610
18772
  const walk = (node) => {
@@ -19948,10 +20110,17 @@ ${block}
19948
20110
  }
19949
20111
  const kind = params.kind ?? "component";
19950
20112
  if (kind !== "component") {
20113
+ const entityId = encodeURIComponent(`${relative13(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
20114
+ const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
20115
+ const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
20116
+ if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
20117
+ return fail("structural-change", `${kind} ${className} decorator-args or structural surface changed`);
20118
+ }
19951
20119
  const moduleText = buildSimpleEntityModule(classNode, className);
19952
20120
  if (!moduleText) {
19953
20121
  return fail("unexpected-error", `buildSimpleEntityModule returned null for ${className}`);
19954
20122
  }
20123
+ entityFingerprintCache.set(entityId, currentEntityFingerprint);
19955
20124
  return {
19956
20125
  componentSource: sourceFile,
19957
20126
  fingerprintChanged: false,
@@ -20231,6 +20400,12 @@ var init_fastHmrCompiler = __esm(() => {
20231
20400
  init_typescript_translator();
20232
20401
  fingerprintCache = new Map;
20233
20402
  pendingModuleCache = new Map;
20403
+ entityFingerprintCache = new Map;
20404
+ ENTITY_DECORATOR_NAMES = new Set([
20405
+ "Pipe",
20406
+ "Directive",
20407
+ "Injectable"
20408
+ ]);
20234
20409
  VIEW_ENCAPSULATION_VALUES = {
20235
20410
  Emulated: 0,
20236
20411
  ExperimentalIsolatedShadowDom: 4,
@@ -20929,6 +21104,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20929
21104
  let anyFingerprintChanged = false;
20930
21105
  let totalResolveMs = 0;
20931
21106
  let totalCompileMs = 0;
21107
+ const { resolveDescendantsOfParent: resolveDescendantsOfParent2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
20932
21108
  for (const editedFile of userEdited) {
20933
21109
  const resolveStart = performance.now();
20934
21110
  const owners = resolveOwningComponents2({
@@ -20936,6 +21112,20 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20936
21112
  userAngularRoot: angularDir
20937
21113
  });
20938
21114
  totalResolveMs += performance.now() - resolveStart;
21115
+ if (owners.length === 0) {
21116
+ const descendants = resolveDescendantsOfParent2({
21117
+ changedFilePath: editedFile,
21118
+ userAngularRoot: angularDir
21119
+ });
21120
+ if (descendants.length > 0) {
21121
+ const names = descendants.map((d2) => d2.className).slice(0, 3).join(", ");
21122
+ return {
21123
+ kind: "rebootstrap",
21124
+ reason: `parent class file edited; descendant Angular entities (${names}${descendants.length > 3 ? ", ..." : ""}) need to pick up new prototype`,
21125
+ tier: 1
21126
+ };
21127
+ }
21128
+ }
20939
21129
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
20940
21130
  return {
20941
21131
  kind: "rebootstrap",
@@ -22963,5 +23153,5 @@ export {
22963
23153
  build
22964
23154
  };
22965
23155
 
22966
- //# debugId=9A589DD8147B77D664756E2164756E21
23156
+ //# debugId=01705AE33247F9FA64756E2164756E21
22967
23157
  //# sourceMappingURL=build.js.map