@absolutejs/absolute 0.19.0-beta.870 → 0.19.0-beta.872

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.
@@ -15,18 +15,22 @@ import type {} from '../../../types/globals';
15
15
  * detached root.
16
16
  *
17
17
  * Caveats baked into this approach:
18
- * • The new LView starts as a "root" view (createComponent attaches
19
- * it to ApplicationRef). After splice, it's a child of the
20
- * original parent. We need to detach from ApplicationRef so it's
21
- * not double-tracked.
22
18
  * • Old @Input bindings from the parent are NOT re-applied. The
23
19
  * parent's template flow runs at parent-CD time and wires inputs
24
20
  * then; until then the new instance sees default values. In
25
21
  * practice this matches Tier 1 rebootstrap behavior — no worse.
26
22
  * • Old projection content (ng-content) doesn't transfer. If the
27
23
  * parent injected a child via ng-content, the new instance has an
28
- * empty projection slot until parent re-renders. Logged as a
29
- * known limitation in ANGULAR_PER_COMPONENT_REMOUNT_RESEARCH.md. */
24
+ * empty projection slot until parent re-renders.
25
+ * Class field initializers (e.g. `private foo = inject(Bar)`) are
26
+ * baked into the original class's compiled constructor at bundle
27
+ * time. The surgical update patches `Class.ɵcmp` and prototype
28
+ * methods, but does NOT replace the class itself — so a NEW field
29
+ * added in source after the initial bundle won't appear on the
30
+ * fresh instance. Method-body / decorator / provider / template
31
+ * changes DO take effect (they live on the def, not the
32
+ * constructor). To pick up new field initializers requires a
33
+ * class-level rewrite or escalation to Tier 1b rebootstrap. */
30
34
 
31
35
  import {
32
36
  CONTEXT,
@@ -173,20 +177,6 @@ const teardownOldLView = (oldLView: LView): void => {
173
177
  markLViewDestroyed(oldLView);
174
178
  };
175
179
 
176
- /* The fresh ComponentRef is registered as a root view on
177
- * ApplicationRef. We don't want it tracked there — its parent in the
178
- * view tree is the original parent LView. Detach it. */
179
- const detachFromApplicationRoot = (
180
- componentRef: { hostView: unknown },
181
- core: AngularCoreNamespace
182
- ): void => {
183
- if (!core.ApplicationRef) return;
184
- const w = window as unknown as {
185
- __ANGULAR_APP__?: { detachView?: (view: unknown) => void };
186
- };
187
- w.__ANGULAR_APP__?.detachView?.(componentRef.hostView);
188
- };
189
-
190
180
  export type RemountResult = {
191
181
  className: string;
192
182
  remounted: number;
@@ -246,7 +236,6 @@ export const remountComponentClass = async (
246
236
  }
247
237
 
248
238
  spliceLViewIntoParent(target, fresh.newLView);
249
- detachFromApplicationRoot(fresh.componentRef, core);
250
239
  teardownOldLView(target.oldLView);
251
240
 
252
241
  fresh.componentRef.hostView.detectChanges?.();
package/dist/index.js CHANGED
@@ -19111,6 +19111,13 @@ ${block}
19111
19111
  removeComments: false
19112
19112
  });
19113
19113
  const fnText = printer.printNode(ts7.EmitHint.Unspecified, exportedDecl, sourceFile);
19114
+ const provisionalMethodsBlock = buildFreshClassMethodsBlock(classNode, className) ?? "";
19115
+ const referencedNames = new Set;
19116
+ const identRe = /[A-Za-z_$][A-Za-z0-9_$]*/g;
19117
+ let idMatch;
19118
+ while ((idMatch = identRe.exec(provisionalMethodsBlock)) !== null) {
19119
+ referencedNames.add(idMatch[0]);
19120
+ }
19114
19121
  const importDecls = [];
19115
19122
  for (const stmt of sourceFile.statements) {
19116
19123
  if (!ts7.isImportDeclaration(stmt))
@@ -19120,6 +19127,21 @@ ${block}
19120
19127
  const spec = stmt.moduleSpecifier.text;
19121
19128
  if (spec.startsWith(".") || spec.startsWith("/"))
19122
19129
  continue;
19130
+ const importedNames = [];
19131
+ const clause = stmt.importClause;
19132
+ if (clause?.name)
19133
+ importedNames.push(clause.name.text);
19134
+ if (clause?.namedBindings && ts7.isNamedImports(clause.namedBindings)) {
19135
+ for (const el of clause.namedBindings.elements) {
19136
+ if (el.isTypeOnly)
19137
+ continue;
19138
+ importedNames.push(el.name.text);
19139
+ }
19140
+ } else if (clause?.namedBindings && ts7.isNamespaceImport(clause.namedBindings)) {
19141
+ importedNames.push(clause.namedBindings.name.text);
19142
+ }
19143
+ if (!importedNames.some((n) => referencedNames.has(n)))
19144
+ continue;
19123
19145
  importDecls.push(printer.printNode(ts7.EmitHint.Unspecified, stmt, sourceFile));
19124
19146
  }
19125
19147
  const tsSourceText = (importDecls.length > 0 ? importDecls.join(`
@@ -19129,7 +19151,8 @@ ${block}
19129
19151
  const transpiled = ts7.transpileModule(tsSourceText, {
19130
19152
  compilerOptions: {
19131
19153
  module: ts7.ModuleKind.ES2022,
19132
- target: ts7.ScriptTarget.ES2022
19154
+ target: ts7.ScriptTarget.ES2022,
19155
+ verbatimModuleSyntax: true
19133
19156
  },
19134
19157
  fileName: componentFilePath,
19135
19158
  reportDiagnostics: false
@@ -21951,9 +21974,14 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
21951
21974
  if (module === null) {
21952
21975
  return new Response(`No HMR module for id=${id}. The component may not be in the current program, or the program isn't built yet (rebuild on first save).`, { status: 404 });
21953
21976
  }
21954
- const { getDevVendorPaths: getDevVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
21977
+ const { getDevVendorPaths: getDevVendorPaths2, getAngularVendorPaths: getAngularVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
21955
21978
  const { rewriteImportsInContent: rewriteImportsInContent2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
21956
- const vendorPaths = getDevVendorPaths2() ?? {};
21979
+ const depVendorPaths = globalThis.__depVendorPaths ?? {};
21980
+ const vendorPaths = {
21981
+ ...getDevVendorPaths2() ?? {},
21982
+ ...getAngularVendorPaths2() ?? {},
21983
+ ...depVendorPaths
21984
+ };
21957
21985
  const rewritten = rewriteImportsInContent2(module, vendorPaths);
21958
21986
  return new Response(rewritten, {
21959
21987
  headers: {
@@ -30377,5 +30405,5 @@ export {
30377
30405
  ANGULAR_INIT_TIMEOUT_MS
30378
30406
  };
30379
30407
 
30380
- //# debugId=2F4963E2E464D02864756E2164756E21
30408
+ //# debugId=2A247ADD3B7452BD64756E2164756E21
30381
30409
  //# sourceMappingURL=index.js.map