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

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-Z1uJ5x/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-WCxiat/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-Z1uJ5x/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-WCxiat/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-Z1uJ5x/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-WCxiat/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
@@ -18497,6 +18497,47 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache
18497
18497
  selector: decoratorMeta.selector,
18498
18498
  standalone: decoratorMeta.standalone
18499
18499
  };
18500
+ }, buildFreshClassMethodsBlock = (classNode, className) => {
18501
+ const methodSources = [];
18502
+ for (const member of classNode.members) {
18503
+ 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
+ methodSources.push(member.getText());
18509
+ }
18510
+ }
18511
+ if (methodSources.length === 0)
18512
+ return null;
18513
+ const wrappedSource = `class _Fresh {
18514
+ ${methodSources.join(`
18515
+ `)}
18516
+ }`;
18517
+ let transpiled;
18518
+ try {
18519
+ transpiled = ts7.transpileModule(wrappedSource, {
18520
+ compilerOptions: {
18521
+ module: ts7.ModuleKind.ES2022,
18522
+ target: ts7.ScriptTarget.ES2022
18523
+ },
18524
+ reportDiagnostics: false
18525
+ }).outputText;
18526
+ } catch {
18527
+ return null;
18528
+ }
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).
18532
+ ${transpiled}
18533
+ {
18534
+ const __fresh_proto = _Fresh.prototype;
18535
+ for (const __name of Object.getOwnPropertyNames(__fresh_proto)) {
18536
+ if (__name === 'constructor') continue;
18537
+ const __desc = Object.getOwnPropertyDescriptor(__fresh_proto, __name);
18538
+ if (__desc) Object.defineProperty(${className}.prototype, __name, __desc);
18539
+ }
18540
+ }`;
18500
18541
  }, resolveAndReadResource = (componentDir, url) => {
18501
18542
  const abs = resolve31(componentDir, url);
18502
18543
  if (!existsSync25(abs))
@@ -18686,7 +18727,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache
18686
18727
  removeComments: false
18687
18728
  });
18688
18729
  const tsSourceText = printer.printNode(ts7.EmitHint.Unspecified, exportedDecl, sourceFile);
18689
- const moduleText = ts7.transpileModule(tsSourceText, {
18730
+ const transpiled = ts7.transpileModule(tsSourceText, {
18690
18731
  compilerOptions: {
18691
18732
  module: ts7.ModuleKind.ES2022,
18692
18733
  target: ts7.ScriptTarget.ES2022
@@ -18694,6 +18735,18 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache
18694
18735
  fileName: componentFilePath,
18695
18736
  reportDiagnostics: false
18696
18737
  }).outputText;
18738
+ const methodsBlock = buildFreshClassMethodsBlock(classNode, className);
18739
+ let moduleText = transpiled;
18740
+ if (methodsBlock) {
18741
+ const fnOpening = `function ${className}_UpdateMetadata(${className}, \u0275\u0275namespaces) {`;
18742
+ const idx = moduleText.indexOf(fnOpening);
18743
+ if (idx >= 0) {
18744
+ const insertAt = idx + fnOpening.length;
18745
+ moduleText = moduleText.slice(0, insertAt) + `
18746
+ ` + methodsBlock + `
18747
+ ` + moduleText.slice(insertAt);
18748
+ }
18749
+ }
18697
18750
  fingerprintCache.set(fingerprintId, currentFingerprint);
18698
18751
  return { ok: true, moduleText, componentSource: sourceFile };
18699
18752
  } catch (err) {
@@ -21308,5 +21361,5 @@ export {
21308
21361
  build
21309
21362
  };
21310
21363
 
21311
- //# debugId=A6EDFBBC6FF9BB9264756E2164756E21
21364
+ //# debugId=3DF8C37F7F59DD5A64756E2164756E21
21312
21365
  //# sourceMappingURL=build.js.map