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

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-Md8b3A/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-Md8b3A/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-Md8b3A/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
@@ -18190,40 +18190,38 @@ __export(exports_fastHmrCompiler, {
18190
18190
  recordFingerprint: () => recordFingerprint,
18191
18191
  invalidateFingerprintCache: () => invalidateFingerprintCache
18192
18192
  });
18193
- import { existsSync as existsSync25, readFileSync as readFileSync19 } from "fs";
18193
+ import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
18194
18194
  import { dirname as dirname18, relative as relative13, resolve as resolve31 } from "path";
18195
18195
  import ts7 from "typescript";
18196
- var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, fingerprintsEqual = (a, b2) => {
18196
+ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, arraysEqual = (a, b2) => {
18197
+ if (a.length !== b2.length)
18198
+ return false;
18199
+ for (let i = 0;i < a.length; i++) {
18200
+ if (a[i] !== b2[i])
18201
+ return false;
18202
+ }
18203
+ return true;
18204
+ }, fingerprintsEqual = (a, b2) => {
18197
18205
  if (a.className !== b2.className)
18198
18206
  return false;
18199
18207
  if (a.selector !== b2.selector)
18200
18208
  return false;
18201
18209
  if (a.standalone !== b2.standalone)
18202
18210
  return false;
18203
- if (a.importsArity !== b2.importsArity)
18204
- return false;
18205
18211
  if (a.hasProviders !== b2.hasProviders)
18206
18212
  return false;
18207
18213
  if (a.hasViewProviders !== b2.hasViewProviders)
18208
18214
  return false;
18209
- if (a.ctorParamTypes.length !== b2.ctorParamTypes.length)
18215
+ if (!arraysEqual(a.ctorParamTypes, b2.ctorParamTypes))
18210
18216
  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)
18217
+ if (!arraysEqual(a.inputs, b2.inputs))
18216
18218
  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)
18219
+ if (!arraysEqual(a.outputs, b2.outputs))
18220
+ return false;
18221
+ if (!arraysEqual(a.providerImportSig, b2.providerImportSig))
18222
+ return false;
18223
+ if (!arraysEqual(a.arrowFieldSig, b2.arrowFieldSig))
18222
18224
  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
18225
  return true;
18228
18226
  }, recordFingerprint = (id, fp) => {
18229
18227
  fingerprintCache.set(id, fp);
@@ -18471,7 +18469,137 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache
18471
18469
  }
18472
18470
  }
18473
18471
  return { inputs, outputs };
18474
- }, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs) => {
18472
+ }, djb2Hash = (s2) => {
18473
+ let h2 = 5381;
18474
+ for (let i = 0;i < s2.length; i++) {
18475
+ h2 = h2 * 33 ^ s2.charCodeAt(i);
18476
+ }
18477
+ return (h2 >>> 0).toString(36);
18478
+ }, extractArrowFieldSig = (cls) => {
18479
+ const entries = [];
18480
+ for (const member of cls.members) {
18481
+ if (!ts7.isPropertyDeclaration(member))
18482
+ continue;
18483
+ const init = member.initializer;
18484
+ if (!init)
18485
+ continue;
18486
+ if (!ts7.isArrowFunction(init) && !ts7.isFunctionExpression(init)) {
18487
+ continue;
18488
+ }
18489
+ const name = member.name.getText();
18490
+ const bodyHash = djb2Hash(init.getText());
18491
+ entries.push(`${name}:${bodyHash}`);
18492
+ }
18493
+ return entries.sort();
18494
+ }, providerProbeCache, fileHasModuleProviders = (filePath) => {
18495
+ let stat3;
18496
+ try {
18497
+ stat3 = statSync4(filePath);
18498
+ } catch {
18499
+ return true;
18500
+ }
18501
+ const cached = providerProbeCache.get(filePath);
18502
+ if (cached && cached.mtimeMs === stat3.mtimeMs)
18503
+ return cached.hasProviders;
18504
+ let source;
18505
+ try {
18506
+ source = readFileSync19(filePath, "utf8");
18507
+ } catch {
18508
+ return true;
18509
+ }
18510
+ const sf = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
18511
+ let hasProviders = false;
18512
+ const visit = (node) => {
18513
+ if (hasProviders)
18514
+ return;
18515
+ if (ts7.isClassDeclaration(node)) {
18516
+ for (const decorator of ts7.getDecorators(node) ?? []) {
18517
+ const expr = decorator.expression;
18518
+ if (!ts7.isCallExpression(expr))
18519
+ continue;
18520
+ const arg = expr.arguments[0];
18521
+ if (!arg || !ts7.isObjectLiteralExpression(arg))
18522
+ continue;
18523
+ if (getProperty(arg, "providers") !== null) {
18524
+ hasProviders = true;
18525
+ return;
18526
+ }
18527
+ }
18528
+ }
18529
+ ts7.forEachChild(node, visit);
18530
+ };
18531
+ visit(sf);
18532
+ providerProbeCache.set(filePath, {
18533
+ hasProviders,
18534
+ mtimeMs: stat3.mtimeMs
18535
+ });
18536
+ return hasProviders;
18537
+ }, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
18538
+ for (const stmt of sourceFile.statements) {
18539
+ if (!ts7.isImportDeclaration(stmt))
18540
+ continue;
18541
+ const moduleSpec = stmt.moduleSpecifier;
18542
+ if (!ts7.isStringLiteral(moduleSpec))
18543
+ continue;
18544
+ const spec = moduleSpec.text;
18545
+ if (!spec.startsWith(".") && !spec.startsWith("/"))
18546
+ continue;
18547
+ const importClause = stmt.importClause;
18548
+ if (!importClause)
18549
+ continue;
18550
+ let matches = false;
18551
+ if (importClause.name && importClause.name.text === identifierName) {
18552
+ matches = true;
18553
+ }
18554
+ if (importClause.namedBindings) {
18555
+ const nb = importClause.namedBindings;
18556
+ if (ts7.isNamespaceImport(nb)) {
18557
+ if (nb.name.text === identifierName)
18558
+ matches = true;
18559
+ } else {
18560
+ for (const element of nb.elements) {
18561
+ if (element.name.text === identifierName) {
18562
+ matches = true;
18563
+ break;
18564
+ }
18565
+ }
18566
+ }
18567
+ }
18568
+ if (!matches)
18569
+ continue;
18570
+ const resolved = resolve31(componentDir, spec);
18571
+ for (const ext of TS_EXTENSIONS) {
18572
+ const candidate = resolved + ext;
18573
+ if (existsSync25(candidate))
18574
+ return candidate;
18575
+ }
18576
+ const indexCandidate = resolve31(resolved, "index.ts");
18577
+ if (existsSync25(indexCandidate))
18578
+ return indexCandidate;
18579
+ }
18580
+ return null;
18581
+ }, extractProviderImportSig = (importsExpr, sourceFile, componentDir) => {
18582
+ if (!importsExpr)
18583
+ return [];
18584
+ const sig = [];
18585
+ for (const entry of importsExpr.elements) {
18586
+ if (ts7.isIdentifier(entry)) {
18587
+ const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
18588
+ if (importPath) {
18589
+ if (fileHasModuleProviders(importPath)) {
18590
+ sig.push(`P:${entry.text}`);
18591
+ }
18592
+ continue;
18593
+ }
18594
+ if (/Module$/.test(entry.text)) {
18595
+ sig.push(`P:${entry.text}`);
18596
+ }
18597
+ } else {
18598
+ sig.push(`P:${entry.getText()}`);
18599
+ }
18600
+ }
18601
+ return sig.sort();
18602
+ }, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
18475
18603
  const ctorParamTypes = [];
18476
18604
  for (const member of cls.members) {
18477
18605
  if (!ts7.isConstructorDeclaration(member))
@@ -18483,17 +18611,17 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache
18483
18611
  }
18484
18612
  const inputNames = Object.keys(inputs).sort();
18485
18613
  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;
18614
+ const arrowFieldSig = extractArrowFieldSig(cls);
18615
+ const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
18489
18616
  return {
18617
+ arrowFieldSig,
18490
18618
  className,
18491
18619
  ctorParamTypes,
18492
- hasProviders,
18493
- hasViewProviders,
18494
- importsArity,
18620
+ hasProviders: decoratorMeta.hasProviders,
18621
+ hasViewProviders: decoratorMeta.hasViewProviders,
18495
18622
  inputs: inputNames,
18496
18623
  outputs: outputNames,
18624
+ providerImportSig,
18497
18625
  selector: decoratorMeta.selector,
18498
18626
  standalone: decoratorMeta.standalone
18499
18627
  };
@@ -18625,7 +18753,7 @@ ${transpiled}
18625
18753
  const { inputs, outputs } = extractInputsAndOutputs(classNode);
18626
18754
  const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
18627
18755
  const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
18628
- const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs);
18756
+ const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
18629
18757
  const cachedFingerprint = fingerprintCache.get(fingerprintId);
18630
18758
  if (cachedFingerprint && !fingerprintsEqual(cachedFingerprint, currentFingerprint)) {
18631
18759
  return fail("structural-change", `fingerprint changed for ${className}; escalate to Tier 1`);
@@ -18757,6 +18885,8 @@ var init_fastHmrCompiler = __esm(() => {
18757
18885
  init_hmrImportGenerator();
18758
18886
  init_typescript_translator();
18759
18887
  fingerprintCache = new Map;
18888
+ providerProbeCache = new Map;
18889
+ TS_EXTENSIONS = [".ts", ".tsx", ".d.ts"];
18760
18890
  });
18761
18891
 
18762
18892
  // src/dev/angular/hmrCompiler.ts
@@ -21001,7 +21131,7 @@ __export(exports_devBuild, {
21001
21131
  devBuild: () => devBuild
21002
21132
  });
21003
21133
  import { readdir as readdir5 } from "fs/promises";
21004
- import { statSync as statSync4 } from "fs";
21134
+ import { statSync as statSync5 } from "fs";
21005
21135
  import { resolve as resolve36 } from "path";
21006
21136
  var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
21007
21137
  const configuredDirs = [
@@ -21110,7 +21240,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
21110
21240
  state.fileChangeQueue.clear();
21111
21241
  }
21112
21242
  }, handleCachedReload = async () => {
21113
- const serverMtime = statSync4(resolve36(Bun.main)).mtimeMs;
21243
+ const serverMtime = statSync5(resolve36(Bun.main)).mtimeMs;
21114
21244
  const lastMtime = globalThis.__hmrServerMtime;
21115
21245
  globalThis.__hmrServerMtime = serverMtime;
21116
21246
  const cached = globalThis.__hmrDevResult;
@@ -21324,7 +21454,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
21324
21454
  manifest
21325
21455
  };
21326
21456
  globalThis.__hmrDevResult = result;
21327
- globalThis.__hmrServerMtime = statSync4(resolve36(Bun.main)).mtimeMs;
21457
+ globalThis.__hmrServerMtime = statSync5(resolve36(Bun.main)).mtimeMs;
21328
21458
  return result;
21329
21459
  };
21330
21460
  var init_devBuild = __esm(() => {
@@ -21361,5 +21491,5 @@ export {
21361
21491
  build
21362
21492
  };
21363
21493
 
21364
- //# debugId=3DF8C37F7F59DD5A64756E2164756E21
21494
+ //# debugId=0DF8D7C94DA9EB2864756E2164756E21
21365
21495
  //# sourceMappingURL=build.js.map