@absolutejs/absolute 0.19.0-beta.855 → 0.19.0-beta.857

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-WCxiat/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-pL6ibI/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-WCxiat/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-pL6ibI/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-WCxiat/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-pL6ibI/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
@@ -9561,7 +9561,7 @@ __export(exports_hmrInjectionPlugin, {
9561
9561
  });
9562
9562
  import { readFile as readFile5 } from "fs/promises";
9563
9563
  import { relative as relative6, resolve as resolve12 } from "path";
9564
- var COMPONENT_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
9564
+ var ENTITY_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
9565
9565
 
9566
9566
  // absolutejs HMR \u2014 auto-generated; mirrors compileHmrInitializer from
9567
9567
  // @angular/compiler with import.meta.hot adapted to globalThis.__angularHmr.
@@ -9596,7 +9596,7 @@ var COMPONENT_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
9596
9596
  const seen = new Set;
9597
9597
  const classNames = [];
9598
9598
  let match;
9599
- const re2 = new RegExp(COMPONENT_DECORATOR_RE.source, COMPONENT_DECORATOR_RE.flags);
9599
+ const re2 = new RegExp(ENTITY_DECORATOR_RE.source, ENTITY_DECORATOR_RE.flags);
9600
9600
  while ((match = re2.exec(text)) !== null) {
9601
9601
  const className = match[1];
9602
9602
  if (className && !seen.has(className)) {
@@ -9619,7 +9619,7 @@ var COMPONENT_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
9619
9619
  };
9620
9620
  };
9621
9621
  var init_hmrInjectionPlugin = __esm(() => {
9622
- COMPONENT_DECORATOR_RE = /([A-Z][A-Za-z0-9_$]*)\s*=\s*__legacyDecorateClassTS[A-Za-z0-9_$]*\s*\(\s*\[[\s\S]*?\bComponent[A-Za-z0-9_$]*\s*\(/g;
9622
+ ENTITY_DECORATOR_RE = /([A-Z][A-Za-z0-9_$]*)\s*=\s*__legacyDecorateClassTS[A-Za-z0-9_$]*\s*\(\s*\[[\s\S]*?\b(?:Component|Directive|Pipe|Injectable)[A-Za-z0-9_$]*\s*\(/g;
9623
9623
  });
9624
9624
 
9625
9625
  // src/utils/cleanStaleOutputs.ts
@@ -17389,7 +17389,7 @@ __export(exports_resolveOwningComponents, {
17389
17389
  import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
17390
17390
  import { dirname as dirname17, extname as extname9, join as join28, resolve as resolve30 } from "path";
17391
17391
  import ts3 from "typescript";
17392
- var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.endsWith(".component.tsx"), walkComponentTsFiles = (root) => {
17392
+ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
17393
17393
  const out = [];
17394
17394
  const visit = (dir) => {
17395
17395
  let entries;
@@ -17405,7 +17405,7 @@ var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.ends
17405
17405
  const full = join28(dir, entry.name);
17406
17406
  if (entry.isDirectory()) {
17407
17407
  visit(full);
17408
- } else if (entry.isFile() && isComponentTsFile(entry.name)) {
17408
+ } else if (entry.isFile() && isAngularSourceFile(entry.name)) {
17409
17409
  out.push(full);
17410
17410
  }
17411
17411
  }
@@ -17443,58 +17443,67 @@ var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.ends
17443
17443
  }
17444
17444
  }
17445
17445
  return out;
17446
- }, parseComponentRefs = (filePath) => {
17447
- const refs = {
17448
- classNames: [],
17449
- templateUrls: [],
17450
- styleUrls: []
17451
- };
17446
+ }, parseDecoratedClasses = (filePath) => {
17452
17447
  let source;
17453
17448
  try {
17454
17449
  source = readFileSync18(filePath, "utf8");
17455
17450
  } catch {
17456
- return refs;
17451
+ return [];
17457
17452
  }
17458
17453
  const sourceFile = ts3.createSourceFile(filePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
17454
+ const out = [];
17459
17455
  const visit = (node) => {
17460
17456
  if (ts3.isClassDeclaration(node) && node.name) {
17461
- const decorators = ts3.getDecorators(node) ?? [];
17462
- for (const decorator of decorators) {
17457
+ for (const decorator of ts3.getDecorators(node) ?? []) {
17463
17458
  const expr = decorator.expression;
17464
17459
  if (!ts3.isCallExpression(expr))
17465
17460
  continue;
17466
17461
  const fn2 = expr.expression;
17467
- if (!ts3.isIdentifier(fn2) || fn2.text !== "Component")
17462
+ if (!ts3.isIdentifier(fn2))
17468
17463
  continue;
17469
- refs.classNames.push(node.name.text);
17470
- const arg = expr.arguments[0];
17471
- if (!arg || !ts3.isObjectLiteralExpression(arg))
17464
+ const kind = ENTITY_DECORATORS[fn2.text];
17465
+ if (!kind)
17472
17466
  continue;
17473
- const tplUrl = getStringPropertyValue(arg, "templateUrl");
17474
- if (tplUrl)
17475
- refs.templateUrls.push(tplUrl);
17476
- const styleUrl = getStringPropertyValue(arg, "styleUrl");
17477
- if (styleUrl)
17478
- refs.styleUrls.push(styleUrl);
17479
- refs.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
17467
+ const entry = {
17468
+ className: node.name.text,
17469
+ kind,
17470
+ styleUrls: [],
17471
+ templateUrls: []
17472
+ };
17473
+ const arg = expr.arguments[0];
17474
+ if (arg && ts3.isObjectLiteralExpression(arg) && kind === "component") {
17475
+ const tplUrl = getStringPropertyValue(arg, "templateUrl");
17476
+ if (tplUrl)
17477
+ entry.templateUrls.push(tplUrl);
17478
+ const styleUrl = getStringPropertyValue(arg, "styleUrl");
17479
+ if (styleUrl)
17480
+ entry.styleUrls.push(styleUrl);
17481
+ entry.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
17482
+ }
17483
+ out.push(entry);
17484
+ break;
17480
17485
  }
17481
17486
  }
17482
17487
  ts3.forEachChild(node, visit);
17483
17488
  };
17484
17489
  visit(sourceFile);
17485
- return refs;
17490
+ return out;
17486
17491
  }, safeNormalize = (path) => resolve30(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
17487
17492
  const { changedFilePath, userAngularRoot } = params;
17488
17493
  const changedAbs = safeNormalize(changedFilePath);
17489
17494
  const out = [];
17490
- if (changedAbs.endsWith(".component.ts")) {
17491
- const refs = parseComponentRefs(changedAbs);
17492
- for (const className of refs.classNames) {
17493
- out.push({ componentFilePath: changedAbs, className });
17495
+ const ext = extname9(changedAbs).toLowerCase();
17496
+ if (ext === ".ts" || ext === ".tsx") {
17497
+ const classes = parseDecoratedClasses(changedAbs);
17498
+ for (const cls of classes) {
17499
+ out.push({
17500
+ className: cls.className,
17501
+ componentFilePath: changedAbs,
17502
+ kind: cls.kind
17503
+ });
17494
17504
  }
17495
17505
  return out;
17496
17506
  }
17497
- const ext = extname9(changedAbs).toLowerCase();
17498
17507
  if (ext !== ".html" && ext !== ".css" && ext !== ".scss" && ext !== ".sass") {
17499
17508
  return out;
17500
17509
  }
@@ -17506,26 +17515,36 @@ var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.ends
17506
17515
  }
17507
17516
  if (!rootStat.isDirectory())
17508
17517
  return out;
17509
- for (const componentTsPath of walkComponentTsFiles(userAngularRoot)) {
17510
- const refs = parseComponentRefs(componentTsPath);
17511
- const componentDir = dirname17(componentTsPath);
17518
+ for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
17519
+ const classes = parseDecoratedClasses(tsPath);
17520
+ const componentDir = dirname17(tsPath);
17512
17521
  const matchesResource = (relativeUrl) => {
17513
17522
  const abs = safeNormalize(resolve30(componentDir, relativeUrl));
17514
17523
  return abs === changedAbs;
17515
17524
  };
17516
- const referencesChanged = refs.templateUrls.some(matchesResource) || refs.styleUrls.some(matchesResource);
17517
- if (!referencesChanged)
17518
- continue;
17519
- for (const className of refs.classNames) {
17525
+ for (const cls of classes) {
17526
+ if (cls.kind !== "component")
17527
+ continue;
17528
+ const referencesChanged = cls.templateUrls.some(matchesResource) || cls.styleUrls.some(matchesResource);
17529
+ if (!referencesChanged)
17530
+ continue;
17520
17531
  out.push({
17521
- componentFilePath: componentTsPath,
17522
- className
17532
+ className: cls.className,
17533
+ componentFilePath: tsPath,
17534
+ kind: "component"
17523
17535
  });
17524
17536
  }
17525
17537
  }
17526
17538
  return out;
17527
17539
  };
17528
- var init_resolveOwningComponents = () => {};
17540
+ var init_resolveOwningComponents = __esm(() => {
17541
+ ENTITY_DECORATORS = {
17542
+ Component: "component",
17543
+ Directive: "directive",
17544
+ Pipe: "pipe",
17545
+ Injectable: "service"
17546
+ };
17547
+ });
17529
17548
 
17530
17549
  // src/dev/angular/hmrImportGenerator.ts
17531
17550
  import ts4 from "typescript";
@@ -18190,40 +18209,38 @@ __export(exports_fastHmrCompiler, {
18190
18209
  recordFingerprint: () => recordFingerprint,
18191
18210
  invalidateFingerprintCache: () => invalidateFingerprintCache
18192
18211
  });
18193
- import { existsSync as existsSync25, readFileSync as readFileSync19 } from "fs";
18212
+ import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
18194
18213
  import { dirname as dirname18, relative as relative13, resolve as resolve31 } from "path";
18195
18214
  import ts7 from "typescript";
18196
- var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, fingerprintsEqual = (a, b2) => {
18215
+ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, arraysEqual = (a, b2) => {
18216
+ if (a.length !== b2.length)
18217
+ return false;
18218
+ for (let i = 0;i < a.length; i++) {
18219
+ if (a[i] !== b2[i])
18220
+ return false;
18221
+ }
18222
+ return true;
18223
+ }, fingerprintsEqual = (a, b2) => {
18197
18224
  if (a.className !== b2.className)
18198
18225
  return false;
18199
18226
  if (a.selector !== b2.selector)
18200
18227
  return false;
18201
18228
  if (a.standalone !== b2.standalone)
18202
18229
  return false;
18203
- if (a.importsArity !== b2.importsArity)
18204
- return false;
18205
18230
  if (a.hasProviders !== b2.hasProviders)
18206
18231
  return false;
18207
18232
  if (a.hasViewProviders !== b2.hasViewProviders)
18208
18233
  return false;
18209
- if (a.ctorParamTypes.length !== b2.ctorParamTypes.length)
18234
+ if (!arraysEqual(a.ctorParamTypes, b2.ctorParamTypes))
18210
18235
  return false;
18211
- for (let i = 0;i < a.ctorParamTypes.length; i++) {
18212
- if (a.ctorParamTypes[i] !== b2.ctorParamTypes[i])
18213
- return false;
18214
- }
18215
- if (a.inputs.length !== b2.inputs.length)
18236
+ if (!arraysEqual(a.inputs, b2.inputs))
18216
18237
  return false;
18217
- for (let i = 0;i < a.inputs.length; i++) {
18218
- if (a.inputs[i] !== b2.inputs[i])
18219
- return false;
18220
- }
18221
- if (a.outputs.length !== b2.outputs.length)
18238
+ if (!arraysEqual(a.outputs, b2.outputs))
18239
+ return false;
18240
+ if (!arraysEqual(a.providerImportSig, b2.providerImportSig))
18241
+ return false;
18242
+ if (!arraysEqual(a.arrowFieldSig, b2.arrowFieldSig))
18222
18243
  return false;
18223
- for (let i = 0;i < a.outputs.length; i++) {
18224
- if (a.outputs[i] !== b2.outputs[i])
18225
- return false;
18226
- }
18227
18244
  return true;
18228
18245
  }, recordFingerprint = (id, fp) => {
18229
18246
  fingerprintCache.set(id, fp);
@@ -18471,7 +18488,137 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache
18471
18488
  }
18472
18489
  }
18473
18490
  return { inputs, outputs };
18474
- }, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs) => {
18491
+ }, djb2Hash = (s2) => {
18492
+ let h2 = 5381;
18493
+ for (let i = 0;i < s2.length; i++) {
18494
+ h2 = h2 * 33 ^ s2.charCodeAt(i);
18495
+ }
18496
+ return (h2 >>> 0).toString(36);
18497
+ }, extractArrowFieldSig = (cls) => {
18498
+ const entries = [];
18499
+ for (const member of cls.members) {
18500
+ if (!ts7.isPropertyDeclaration(member))
18501
+ continue;
18502
+ const init = member.initializer;
18503
+ if (!init)
18504
+ continue;
18505
+ if (!ts7.isArrowFunction(init) && !ts7.isFunctionExpression(init)) {
18506
+ continue;
18507
+ }
18508
+ const name = member.name.getText();
18509
+ const bodyHash = djb2Hash(init.getText());
18510
+ entries.push(`${name}:${bodyHash}`);
18511
+ }
18512
+ return entries.sort();
18513
+ }, providerProbeCache, fileHasModuleProviders = (filePath) => {
18514
+ let stat3;
18515
+ try {
18516
+ stat3 = statSync4(filePath);
18517
+ } catch {
18518
+ return true;
18519
+ }
18520
+ const cached = providerProbeCache.get(filePath);
18521
+ if (cached && cached.mtimeMs === stat3.mtimeMs)
18522
+ return cached.hasProviders;
18523
+ let source;
18524
+ try {
18525
+ source = readFileSync19(filePath, "utf8");
18526
+ } catch {
18527
+ return true;
18528
+ }
18529
+ const sf = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
18530
+ let hasProviders = false;
18531
+ const visit = (node) => {
18532
+ if (hasProviders)
18533
+ return;
18534
+ if (ts7.isClassDeclaration(node)) {
18535
+ for (const decorator of ts7.getDecorators(node) ?? []) {
18536
+ const expr = decorator.expression;
18537
+ if (!ts7.isCallExpression(expr))
18538
+ continue;
18539
+ const arg = expr.arguments[0];
18540
+ if (!arg || !ts7.isObjectLiteralExpression(arg))
18541
+ continue;
18542
+ if (getProperty(arg, "providers") !== null) {
18543
+ hasProviders = true;
18544
+ return;
18545
+ }
18546
+ }
18547
+ }
18548
+ ts7.forEachChild(node, visit);
18549
+ };
18550
+ visit(sf);
18551
+ providerProbeCache.set(filePath, {
18552
+ hasProviders,
18553
+ mtimeMs: stat3.mtimeMs
18554
+ });
18555
+ return hasProviders;
18556
+ }, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
18557
+ for (const stmt of sourceFile.statements) {
18558
+ if (!ts7.isImportDeclaration(stmt))
18559
+ continue;
18560
+ const moduleSpec = stmt.moduleSpecifier;
18561
+ if (!ts7.isStringLiteral(moduleSpec))
18562
+ continue;
18563
+ const spec = moduleSpec.text;
18564
+ if (!spec.startsWith(".") && !spec.startsWith("/"))
18565
+ continue;
18566
+ const importClause = stmt.importClause;
18567
+ if (!importClause)
18568
+ continue;
18569
+ let matches = false;
18570
+ if (importClause.name && importClause.name.text === identifierName) {
18571
+ matches = true;
18572
+ }
18573
+ if (importClause.namedBindings) {
18574
+ const nb = importClause.namedBindings;
18575
+ if (ts7.isNamespaceImport(nb)) {
18576
+ if (nb.name.text === identifierName)
18577
+ matches = true;
18578
+ } else {
18579
+ for (const element of nb.elements) {
18580
+ if (element.name.text === identifierName) {
18581
+ matches = true;
18582
+ break;
18583
+ }
18584
+ }
18585
+ }
18586
+ }
18587
+ if (!matches)
18588
+ continue;
18589
+ const resolved = resolve31(componentDir, spec);
18590
+ for (const ext of TS_EXTENSIONS) {
18591
+ const candidate = resolved + ext;
18592
+ if (existsSync25(candidate))
18593
+ return candidate;
18594
+ }
18595
+ const indexCandidate = resolve31(resolved, "index.ts");
18596
+ if (existsSync25(indexCandidate))
18597
+ return indexCandidate;
18598
+ }
18599
+ return null;
18600
+ }, extractProviderImportSig = (importsExpr, sourceFile, componentDir) => {
18601
+ if (!importsExpr)
18602
+ return [];
18603
+ const sig = [];
18604
+ for (const entry of importsExpr.elements) {
18605
+ if (ts7.isIdentifier(entry)) {
18606
+ const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
18607
+ if (importPath) {
18608
+ if (fileHasModuleProviders(importPath)) {
18609
+ sig.push(`P:${entry.text}`);
18610
+ }
18611
+ continue;
18612
+ }
18613
+ if (/Module$/.test(entry.text)) {
18614
+ sig.push(`P:${entry.text}`);
18615
+ }
18616
+ } else {
18617
+ sig.push(`P:${entry.getText()}`);
18618
+ }
18619
+ }
18620
+ return sig.sort();
18621
+ }, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
18475
18622
  const ctorParamTypes = [];
18476
18623
  for (const member of cls.members) {
18477
18624
  if (!ts7.isConstructorDeclaration(member))
@@ -18483,29 +18630,30 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache
18483
18630
  }
18484
18631
  const inputNames = Object.keys(inputs).sort();
18485
18632
  const outputNames = Object.keys(outputs).sort();
18486
- const importsArity = decoratorMeta.importsExpr ? decoratorMeta.importsExpr.elements.length : 0;
18487
- const hasProviders = decoratorMeta.hasProviders;
18488
- const hasViewProviders = decoratorMeta.hasViewProviders;
18633
+ const arrowFieldSig = extractArrowFieldSig(cls);
18634
+ const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
18489
18635
  return {
18636
+ arrowFieldSig,
18490
18637
  className,
18491
18638
  ctorParamTypes,
18492
- hasProviders,
18493
- hasViewProviders,
18494
- importsArity,
18639
+ hasProviders: decoratorMeta.hasProviders,
18640
+ hasViewProviders: decoratorMeta.hasViewProviders,
18495
18641
  inputs: inputNames,
18496
18642
  outputs: outputNames,
18643
+ providerImportSig,
18497
18644
  selector: decoratorMeta.selector,
18498
18645
  standalone: decoratorMeta.standalone
18499
18646
  };
18500
18647
  }, buildFreshClassMethodsBlock = (classNode, className) => {
18501
18648
  const methodSources = [];
18649
+ let hasStatic = false;
18502
18650
  for (const member of classNode.members) {
18503
18651
  if (ts7.isMethodDeclaration(member) || ts7.isGetAccessorDeclaration(member) || ts7.isSetAccessorDeclaration(member)) {
18504
- const modifiers = ts7.getModifiers(member) ?? [];
18505
- const isStatic = modifiers.some((m) => m.kind === ts7.SyntaxKind.StaticKeyword);
18506
- if (isStatic)
18507
- continue;
18508
18652
  methodSources.push(member.getText());
18653
+ const modifiers = ts7.getModifiers(member) ?? [];
18654
+ if (modifiers.some((m) => m.kind === ts7.SyntaxKind.StaticKeyword)) {
18655
+ hasStatic = true;
18656
+ }
18509
18657
  }
18510
18658
  }
18511
18659
  if (methodSources.length === 0)
@@ -18526,9 +18674,18 @@ ${methodSources.join(`
18526
18674
  } catch {
18527
18675
  return null;
18528
18676
  }
18529
- return `// SURGICAL_HMR \u2014 patch prototype methods so existing instances
18530
- // pick up new method bodies (\`compileComponentFromMetadata\` only
18531
- // updates \`\u0275cmp\`, never the prototype).
18677
+ const staticPatch = hasStatic ? `
18678
+ {
18679
+ for (const __name of Object.getOwnPropertyNames(_Fresh)) {
18680
+ if (__name === 'length' || __name === 'name' || __name === 'prototype') continue;
18681
+ const __desc = Object.getOwnPropertyDescriptor(_Fresh, __name);
18682
+ if (__desc) Object.defineProperty(${className}, __name, __desc);
18683
+ }
18684
+ }` : "";
18685
+ return `// SURGICAL_HMR \u2014 patch prototype + static methods so existing
18686
+ // instances and direct \`Class.staticMethod()\` calls pick up new
18687
+ // method bodies (\`compileComponentFromMetadata\` only updates
18688
+ // \`\u0275cmp\`, never the prototype or the class itself).
18532
18689
  ${transpiled}
18533
18690
  {
18534
18691
  const __fresh_proto = _Fresh.prototype;
@@ -18537,7 +18694,7 @@ ${transpiled}
18537
18694
  const __desc = Object.getOwnPropertyDescriptor(__fresh_proto, __name);
18538
18695
  if (__desc) Object.defineProperty(${className}.prototype, __name, __desc);
18539
18696
  }
18540
- }`;
18697
+ }${staticPatch}`;
18541
18698
  }, resolveAndReadResource = (componentDir, url) => {
18542
18699
  const abs = resolve31(componentDir, url);
18543
18700
  if (!existsSync25(abs))
@@ -18556,6 +18713,16 @@ ${transpiled}
18556
18713
  styles.push(css);
18557
18714
  }
18558
18715
  return { styles, missing: null };
18716
+ }, buildSimpleEntityModule = (classNode, className) => {
18717
+ const block = buildFreshClassMethodsBlock(classNode, className);
18718
+ if (!block) {
18719
+ return `export default function ${className}_UpdateMetadata(${className}, \u0275\u0275namespaces) { /* no method-body changes detected */ }
18720
+ `;
18721
+ }
18722
+ return `export default function ${className}_UpdateMetadata(${className}, \u0275\u0275namespaces) {
18723
+ ${block}
18724
+ }
18725
+ `;
18559
18726
  }, tryFastHmr = async (params) => {
18560
18727
  const { componentFilePath, className } = params;
18561
18728
  const projectRoot = params.projectRoot ?? process.cwd();
@@ -18574,6 +18741,14 @@ ${transpiled}
18574
18741
  if (!classNode) {
18575
18742
  return fail("class-not-found", `${className} in ${componentFilePath}`);
18576
18743
  }
18744
+ const kind = params.kind ?? "component";
18745
+ if (kind !== "component") {
18746
+ const moduleText = buildSimpleEntityModule(classNode, className);
18747
+ if (!moduleText) {
18748
+ return fail("unexpected-error", `buildSimpleEntityModule returned null for ${className}`);
18749
+ }
18750
+ return { componentSource: sourceFile, moduleText, ok: true };
18751
+ }
18577
18752
  if (inheritsDecoratedClass(classNode)) {
18578
18753
  return fail("inherits-decorated-class");
18579
18754
  }
@@ -18625,7 +18800,7 @@ ${transpiled}
18625
18800
  const { inputs, outputs } = extractInputsAndOutputs(classNode);
18626
18801
  const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
18627
18802
  const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
18628
- const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs);
18803
+ const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
18629
18804
  const cachedFingerprint = fingerprintCache.get(fingerprintId);
18630
18805
  if (cachedFingerprint && !fingerprintsEqual(cachedFingerprint, currentFingerprint)) {
18631
18806
  return fail("structural-change", `fingerprint changed for ${className}; escalate to Tier 1`);
@@ -18757,6 +18932,8 @@ var init_fastHmrCompiler = __esm(() => {
18757
18932
  init_hmrImportGenerator();
18758
18933
  init_typescript_translator();
18759
18934
  fingerprintCache = new Map;
18935
+ providerProbeCache = new Map;
18936
+ TS_EXTENSIONS = [".ts", ".tsx", ".d.ts"];
18760
18937
  });
18761
18938
 
18762
18939
  // src/dev/angular/hmrCompiler.ts
@@ -18920,10 +19097,17 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
18920
19097
  const filePathRel = decoded.slice(0, at2);
18921
19098
  const className = decoded.slice(at2 + 1);
18922
19099
  const componentFilePath = resolve32(process.cwd(), filePathRel);
19100
+ const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
19101
+ const owners = resolveOwningComponents2({
19102
+ changedFilePath: componentFilePath,
19103
+ userAngularRoot: dirname19(componentFilePath)
19104
+ });
19105
+ const owner = owners.find((o2) => o2.className === className);
19106
+ const kind = owner?.kind ?? "component";
18923
19107
  const fastStart = performance2.now();
18924
- const fast = await tryFastHmr({ componentFilePath, className });
19108
+ const fast = await tryFastHmr({ className, componentFilePath, kind });
18925
19109
  if (fast.ok) {
18926
- logInfo(`[ng-hmr fast] ${className} ${(performance2.now() - fastStart).toFixed(1)}ms`);
19110
+ logInfo(`[ng-hmr fast/${kind}] ${className} ${(performance2.now() - fastStart).toFixed(1)}ms`);
18927
19111
  return fast.moduleText;
18928
19112
  }
18929
19113
  logWarn(`[ng-hmr slow] ${className} fast path bailed (${fast.reason}${fast.detail ? `: ${fast.detail}` : ""}), falling back to ngtsc`);
@@ -19543,17 +19727,21 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
19543
19727
  changedFilePath: editedFile,
19544
19728
  userAngularRoot: angularDir
19545
19729
  });
19546
- if (owners.length === 0 && editedFile.endsWith(".component.ts")) {
19730
+ if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
19547
19731
  return {
19548
- reason: `no @Component class found in ${editedFile}`,
19732
+ reason: `no Angular-decorated class found in ${editedFile}`,
19549
19733
  tier: 1
19550
19734
  };
19551
19735
  }
19552
- for (const { componentFilePath, className } of owners) {
19736
+ for (const { componentFilePath, className, kind } of owners) {
19553
19737
  const id = encodeHmrComponentId2(componentFilePath, className);
19554
19738
  if (queueIds.has(id))
19555
19739
  continue;
19556
- const result = await tryFastHmr2({ className, componentFilePath });
19740
+ const result = await tryFastHmr2({
19741
+ className,
19742
+ componentFilePath,
19743
+ kind
19744
+ });
19557
19745
  if (!result.ok) {
19558
19746
  return {
19559
19747
  reason: `${className}: ${result.reason}${result.detail ? ` (${result.detail})` : ""}`,
@@ -21001,7 +21189,7 @@ __export(exports_devBuild, {
21001
21189
  devBuild: () => devBuild
21002
21190
  });
21003
21191
  import { readdir as readdir5 } from "fs/promises";
21004
- import { statSync as statSync4 } from "fs";
21192
+ import { statSync as statSync5 } from "fs";
21005
21193
  import { resolve as resolve36 } from "path";
21006
21194
  var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
21007
21195
  const configuredDirs = [
@@ -21110,7 +21298,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
21110
21298
  state.fileChangeQueue.clear();
21111
21299
  }
21112
21300
  }, handleCachedReload = async () => {
21113
- const serverMtime = statSync4(resolve36(Bun.main)).mtimeMs;
21301
+ const serverMtime = statSync5(resolve36(Bun.main)).mtimeMs;
21114
21302
  const lastMtime = globalThis.__hmrServerMtime;
21115
21303
  globalThis.__hmrServerMtime = serverMtime;
21116
21304
  const cached = globalThis.__hmrDevResult;
@@ -21324,7 +21512,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
21324
21512
  manifest
21325
21513
  };
21326
21514
  globalThis.__hmrDevResult = result;
21327
- globalThis.__hmrServerMtime = statSync4(resolve36(Bun.main)).mtimeMs;
21515
+ globalThis.__hmrServerMtime = statSync5(resolve36(Bun.main)).mtimeMs;
21328
21516
  return result;
21329
21517
  };
21330
21518
  var init_devBuild = __esm(() => {
@@ -21361,5 +21549,5 @@ export {
21361
21549
  build
21362
21550
  };
21363
21551
 
21364
- //# debugId=3DF8C37F7F59DD5A64756E2164756E21
21552
+ //# debugId=E92A4B463882454F64756E2164756E21
21365
21553
  //# sourceMappingURL=build.js.map