@absolutejs/absolute 0.19.0-beta.856 → 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.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +114 -56
- package/dist/build.js.map +7 -7
- package/dist/index.js +114 -56
- package/dist/index.js.map +7 -7
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +2 -0
- package/dist/src/dev/angular/resolveOwningComponents.d.ts +5 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9832,7 +9832,7 @@ __export(exports_hmrInjectionPlugin, {
|
|
|
9832
9832
|
});
|
|
9833
9833
|
import { readFile as readFile5 } from "fs/promises";
|
|
9834
9834
|
import { relative as relative6, resolve as resolve15 } from "path";
|
|
9835
|
-
var
|
|
9835
|
+
var ENTITY_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
|
|
9836
9836
|
|
|
9837
9837
|
// absolutejs HMR \u2014 auto-generated; mirrors compileHmrInitializer from
|
|
9838
9838
|
// @angular/compiler with import.meta.hot adapted to globalThis.__angularHmr.
|
|
@@ -9867,7 +9867,7 @@ var COMPONENT_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
|
|
|
9867
9867
|
const seen = new Set;
|
|
9868
9868
|
const classNames = [];
|
|
9869
9869
|
let match;
|
|
9870
|
-
const re2 = new RegExp(
|
|
9870
|
+
const re2 = new RegExp(ENTITY_DECORATOR_RE.source, ENTITY_DECORATOR_RE.flags);
|
|
9871
9871
|
while ((match = re2.exec(text)) !== null) {
|
|
9872
9872
|
const className = match[1];
|
|
9873
9873
|
if (className && !seen.has(className)) {
|
|
@@ -9890,7 +9890,7 @@ var COMPONENT_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
|
|
|
9890
9890
|
};
|
|
9891
9891
|
};
|
|
9892
9892
|
var init_hmrInjectionPlugin = __esm(() => {
|
|
9893
|
-
|
|
9893
|
+
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;
|
|
9894
9894
|
});
|
|
9895
9895
|
|
|
9896
9896
|
// src/utils/cleanStaleOutputs.ts
|
|
@@ -17486,7 +17486,7 @@ __export(exports_resolveOwningComponents, {
|
|
|
17486
17486
|
import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
|
|
17487
17487
|
import { dirname as dirname18, extname as extname9, join as join29, resolve as resolve32 } from "path";
|
|
17488
17488
|
import ts3 from "typescript";
|
|
17489
|
-
var
|
|
17489
|
+
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
17490
17490
|
const out = [];
|
|
17491
17491
|
const visit = (dir) => {
|
|
17492
17492
|
let entries;
|
|
@@ -17502,7 +17502,7 @@ var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.ends
|
|
|
17502
17502
|
const full = join29(dir, entry.name);
|
|
17503
17503
|
if (entry.isDirectory()) {
|
|
17504
17504
|
visit(full);
|
|
17505
|
-
} else if (entry.isFile() &&
|
|
17505
|
+
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
17506
17506
|
out.push(full);
|
|
17507
17507
|
}
|
|
17508
17508
|
}
|
|
@@ -17540,58 +17540,67 @@ var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.ends
|
|
|
17540
17540
|
}
|
|
17541
17541
|
}
|
|
17542
17542
|
return out;
|
|
17543
|
-
},
|
|
17544
|
-
const refs = {
|
|
17545
|
-
classNames: [],
|
|
17546
|
-
templateUrls: [],
|
|
17547
|
-
styleUrls: []
|
|
17548
|
-
};
|
|
17543
|
+
}, parseDecoratedClasses = (filePath) => {
|
|
17549
17544
|
let source;
|
|
17550
17545
|
try {
|
|
17551
17546
|
source = readFileSync19(filePath, "utf8");
|
|
17552
17547
|
} catch {
|
|
17553
|
-
return
|
|
17548
|
+
return [];
|
|
17554
17549
|
}
|
|
17555
17550
|
const sourceFile = ts3.createSourceFile(filePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17551
|
+
const out = [];
|
|
17556
17552
|
const visit = (node) => {
|
|
17557
17553
|
if (ts3.isClassDeclaration(node) && node.name) {
|
|
17558
|
-
const
|
|
17559
|
-
for (const decorator of decorators) {
|
|
17554
|
+
for (const decorator of ts3.getDecorators(node) ?? []) {
|
|
17560
17555
|
const expr = decorator.expression;
|
|
17561
17556
|
if (!ts3.isCallExpression(expr))
|
|
17562
17557
|
continue;
|
|
17563
17558
|
const fn2 = expr.expression;
|
|
17564
|
-
if (!ts3.isIdentifier(fn2)
|
|
17559
|
+
if (!ts3.isIdentifier(fn2))
|
|
17565
17560
|
continue;
|
|
17566
|
-
|
|
17567
|
-
|
|
17568
|
-
if (!arg || !ts3.isObjectLiteralExpression(arg))
|
|
17561
|
+
const kind = ENTITY_DECORATORS[fn2.text];
|
|
17562
|
+
if (!kind)
|
|
17569
17563
|
continue;
|
|
17570
|
-
const
|
|
17571
|
-
|
|
17572
|
-
|
|
17573
|
-
|
|
17574
|
-
|
|
17575
|
-
|
|
17576
|
-
|
|
17564
|
+
const entry = {
|
|
17565
|
+
className: node.name.text,
|
|
17566
|
+
kind,
|
|
17567
|
+
styleUrls: [],
|
|
17568
|
+
templateUrls: []
|
|
17569
|
+
};
|
|
17570
|
+
const arg = expr.arguments[0];
|
|
17571
|
+
if (arg && ts3.isObjectLiteralExpression(arg) && kind === "component") {
|
|
17572
|
+
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
17573
|
+
if (tplUrl)
|
|
17574
|
+
entry.templateUrls.push(tplUrl);
|
|
17575
|
+
const styleUrl = getStringPropertyValue(arg, "styleUrl");
|
|
17576
|
+
if (styleUrl)
|
|
17577
|
+
entry.styleUrls.push(styleUrl);
|
|
17578
|
+
entry.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
17579
|
+
}
|
|
17580
|
+
out.push(entry);
|
|
17581
|
+
break;
|
|
17577
17582
|
}
|
|
17578
17583
|
}
|
|
17579
17584
|
ts3.forEachChild(node, visit);
|
|
17580
17585
|
};
|
|
17581
17586
|
visit(sourceFile);
|
|
17582
|
-
return
|
|
17587
|
+
return out;
|
|
17583
17588
|
}, safeNormalize = (path) => resolve32(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
17584
17589
|
const { changedFilePath, userAngularRoot } = params;
|
|
17585
17590
|
const changedAbs = safeNormalize(changedFilePath);
|
|
17586
17591
|
const out = [];
|
|
17587
|
-
|
|
17588
|
-
|
|
17589
|
-
|
|
17590
|
-
|
|
17592
|
+
const ext = extname9(changedAbs).toLowerCase();
|
|
17593
|
+
if (ext === ".ts" || ext === ".tsx") {
|
|
17594
|
+
const classes = parseDecoratedClasses(changedAbs);
|
|
17595
|
+
for (const cls of classes) {
|
|
17596
|
+
out.push({
|
|
17597
|
+
className: cls.className,
|
|
17598
|
+
componentFilePath: changedAbs,
|
|
17599
|
+
kind: cls.kind
|
|
17600
|
+
});
|
|
17591
17601
|
}
|
|
17592
17602
|
return out;
|
|
17593
17603
|
}
|
|
17594
|
-
const ext = extname9(changedAbs).toLowerCase();
|
|
17595
17604
|
if (ext !== ".html" && ext !== ".css" && ext !== ".scss" && ext !== ".sass") {
|
|
17596
17605
|
return out;
|
|
17597
17606
|
}
|
|
@@ -17603,26 +17612,36 @@ var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.ends
|
|
|
17603
17612
|
}
|
|
17604
17613
|
if (!rootStat.isDirectory())
|
|
17605
17614
|
return out;
|
|
17606
|
-
for (const
|
|
17607
|
-
const
|
|
17608
|
-
const componentDir = dirname18(
|
|
17615
|
+
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
17616
|
+
const classes = parseDecoratedClasses(tsPath);
|
|
17617
|
+
const componentDir = dirname18(tsPath);
|
|
17609
17618
|
const matchesResource = (relativeUrl) => {
|
|
17610
17619
|
const abs = safeNormalize(resolve32(componentDir, relativeUrl));
|
|
17611
17620
|
return abs === changedAbs;
|
|
17612
17621
|
};
|
|
17613
|
-
const
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17622
|
+
for (const cls of classes) {
|
|
17623
|
+
if (cls.kind !== "component")
|
|
17624
|
+
continue;
|
|
17625
|
+
const referencesChanged = cls.templateUrls.some(matchesResource) || cls.styleUrls.some(matchesResource);
|
|
17626
|
+
if (!referencesChanged)
|
|
17627
|
+
continue;
|
|
17617
17628
|
out.push({
|
|
17618
|
-
|
|
17619
|
-
|
|
17629
|
+
className: cls.className,
|
|
17630
|
+
componentFilePath: tsPath,
|
|
17631
|
+
kind: "component"
|
|
17620
17632
|
});
|
|
17621
17633
|
}
|
|
17622
17634
|
}
|
|
17623
17635
|
return out;
|
|
17624
17636
|
};
|
|
17625
|
-
var init_resolveOwningComponents = () => {
|
|
17637
|
+
var init_resolveOwningComponents = __esm(() => {
|
|
17638
|
+
ENTITY_DECORATORS = {
|
|
17639
|
+
Component: "component",
|
|
17640
|
+
Directive: "directive",
|
|
17641
|
+
Pipe: "pipe",
|
|
17642
|
+
Injectable: "service"
|
|
17643
|
+
};
|
|
17644
|
+
});
|
|
17626
17645
|
|
|
17627
17646
|
// src/dev/angular/hmrImportGenerator.ts
|
|
17628
17647
|
import ts4 from "typescript";
|
|
@@ -18724,13 +18743,14 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache
|
|
|
18724
18743
|
};
|
|
18725
18744
|
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
18726
18745
|
const methodSources = [];
|
|
18746
|
+
let hasStatic = false;
|
|
18727
18747
|
for (const member of classNode.members) {
|
|
18728
18748
|
if (ts7.isMethodDeclaration(member) || ts7.isGetAccessorDeclaration(member) || ts7.isSetAccessorDeclaration(member)) {
|
|
18729
|
-
const modifiers = ts7.getModifiers(member) ?? [];
|
|
18730
|
-
const isStatic = modifiers.some((m) => m.kind === ts7.SyntaxKind.StaticKeyword);
|
|
18731
|
-
if (isStatic)
|
|
18732
|
-
continue;
|
|
18733
18749
|
methodSources.push(member.getText());
|
|
18750
|
+
const modifiers = ts7.getModifiers(member) ?? [];
|
|
18751
|
+
if (modifiers.some((m) => m.kind === ts7.SyntaxKind.StaticKeyword)) {
|
|
18752
|
+
hasStatic = true;
|
|
18753
|
+
}
|
|
18734
18754
|
}
|
|
18735
18755
|
}
|
|
18736
18756
|
if (methodSources.length === 0)
|
|
@@ -18751,9 +18771,18 @@ ${methodSources.join(`
|
|
|
18751
18771
|
} catch {
|
|
18752
18772
|
return null;
|
|
18753
18773
|
}
|
|
18754
|
-
|
|
18755
|
-
|
|
18756
|
-
|
|
18774
|
+
const staticPatch = hasStatic ? `
|
|
18775
|
+
{
|
|
18776
|
+
for (const __name of Object.getOwnPropertyNames(_Fresh)) {
|
|
18777
|
+
if (__name === 'length' || __name === 'name' || __name === 'prototype') continue;
|
|
18778
|
+
const __desc = Object.getOwnPropertyDescriptor(_Fresh, __name);
|
|
18779
|
+
if (__desc) Object.defineProperty(${className}, __name, __desc);
|
|
18780
|
+
}
|
|
18781
|
+
}` : "";
|
|
18782
|
+
return `// SURGICAL_HMR \u2014 patch prototype + static methods so existing
|
|
18783
|
+
// instances and direct \`Class.staticMethod()\` calls pick up new
|
|
18784
|
+
// method bodies (\`compileComponentFromMetadata\` only updates
|
|
18785
|
+
// \`\u0275cmp\`, never the prototype or the class itself).
|
|
18757
18786
|
${transpiled}
|
|
18758
18787
|
{
|
|
18759
18788
|
const __fresh_proto = _Fresh.prototype;
|
|
@@ -18762,7 +18791,7 @@ ${transpiled}
|
|
|
18762
18791
|
const __desc = Object.getOwnPropertyDescriptor(__fresh_proto, __name);
|
|
18763
18792
|
if (__desc) Object.defineProperty(${className}.prototype, __name, __desc);
|
|
18764
18793
|
}
|
|
18765
|
-
}`;
|
|
18794
|
+
}${staticPatch}`;
|
|
18766
18795
|
}, resolveAndReadResource = (componentDir, url) => {
|
|
18767
18796
|
const abs = resolve33(componentDir, url);
|
|
18768
18797
|
if (!existsSync26(abs))
|
|
@@ -18781,6 +18810,16 @@ ${transpiled}
|
|
|
18781
18810
|
styles.push(css);
|
|
18782
18811
|
}
|
|
18783
18812
|
return { styles, missing: null };
|
|
18813
|
+
}, buildSimpleEntityModule = (classNode, className) => {
|
|
18814
|
+
const block = buildFreshClassMethodsBlock(classNode, className);
|
|
18815
|
+
if (!block) {
|
|
18816
|
+
return `export default function ${className}_UpdateMetadata(${className}, \u0275\u0275namespaces) { /* no method-body changes detected */ }
|
|
18817
|
+
`;
|
|
18818
|
+
}
|
|
18819
|
+
return `export default function ${className}_UpdateMetadata(${className}, \u0275\u0275namespaces) {
|
|
18820
|
+
${block}
|
|
18821
|
+
}
|
|
18822
|
+
`;
|
|
18784
18823
|
}, tryFastHmr = async (params) => {
|
|
18785
18824
|
const { componentFilePath, className } = params;
|
|
18786
18825
|
const projectRoot = params.projectRoot ?? process.cwd();
|
|
@@ -18799,6 +18838,14 @@ ${transpiled}
|
|
|
18799
18838
|
if (!classNode) {
|
|
18800
18839
|
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
18801
18840
|
}
|
|
18841
|
+
const kind = params.kind ?? "component";
|
|
18842
|
+
if (kind !== "component") {
|
|
18843
|
+
const moduleText = buildSimpleEntityModule(classNode, className);
|
|
18844
|
+
if (!moduleText) {
|
|
18845
|
+
return fail("unexpected-error", `buildSimpleEntityModule returned null for ${className}`);
|
|
18846
|
+
}
|
|
18847
|
+
return { componentSource: sourceFile, moduleText, ok: true };
|
|
18848
|
+
}
|
|
18802
18849
|
if (inheritsDecoratedClass(classNode)) {
|
|
18803
18850
|
return fail("inherits-decorated-class");
|
|
18804
18851
|
}
|
|
@@ -19147,10 +19194,17 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
|
|
|
19147
19194
|
const filePathRel = decoded.slice(0, at2);
|
|
19148
19195
|
const className = decoded.slice(at2 + 1);
|
|
19149
19196
|
const componentFilePath = resolve34(process.cwd(), filePathRel);
|
|
19197
|
+
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
19198
|
+
const owners = resolveOwningComponents2({
|
|
19199
|
+
changedFilePath: componentFilePath,
|
|
19200
|
+
userAngularRoot: dirname20(componentFilePath)
|
|
19201
|
+
});
|
|
19202
|
+
const owner = owners.find((o2) => o2.className === className);
|
|
19203
|
+
const kind = owner?.kind ?? "component";
|
|
19150
19204
|
const fastStart = performance2.now();
|
|
19151
|
-
const fast = await tryFastHmr({ componentFilePath,
|
|
19205
|
+
const fast = await tryFastHmr({ className, componentFilePath, kind });
|
|
19152
19206
|
if (fast.ok) {
|
|
19153
|
-
logInfo(`[ng-hmr fast] ${className} ${(performance2.now() - fastStart).toFixed(1)}ms`);
|
|
19207
|
+
logInfo(`[ng-hmr fast/${kind}] ${className} ${(performance2.now() - fastStart).toFixed(1)}ms`);
|
|
19154
19208
|
return fast.moduleText;
|
|
19155
19209
|
}
|
|
19156
19210
|
logWarn(`[ng-hmr slow] ${className} fast path bailed (${fast.reason}${fast.detail ? `: ${fast.detail}` : ""}), falling back to ngtsc`);
|
|
@@ -19770,17 +19824,21 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19770
19824
|
changedFilePath: editedFile,
|
|
19771
19825
|
userAngularRoot: angularDir
|
|
19772
19826
|
});
|
|
19773
|
-
if (owners.length === 0 && editedFile.endsWith(".component.ts")) {
|
|
19827
|
+
if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
|
|
19774
19828
|
return {
|
|
19775
|
-
reason: `no
|
|
19829
|
+
reason: `no Angular-decorated class found in ${editedFile}`,
|
|
19776
19830
|
tier: 1
|
|
19777
19831
|
};
|
|
19778
19832
|
}
|
|
19779
|
-
for (const { componentFilePath, className } of owners) {
|
|
19833
|
+
for (const { componentFilePath, className, kind } of owners) {
|
|
19780
19834
|
const id = encodeHmrComponentId2(componentFilePath, className);
|
|
19781
19835
|
if (queueIds.has(id))
|
|
19782
19836
|
continue;
|
|
19783
|
-
const result = await tryFastHmr2({
|
|
19837
|
+
const result = await tryFastHmr2({
|
|
19838
|
+
className,
|
|
19839
|
+
componentFilePath,
|
|
19840
|
+
kind
|
|
19841
|
+
});
|
|
19784
19842
|
if (!result.ok) {
|
|
19785
19843
|
return {
|
|
19786
19844
|
reason: `${className}: ${result.reason}${result.detail ? ` (${result.detail})` : ""}`,
|
|
@@ -30133,5 +30191,5 @@ export {
|
|
|
30133
30191
|
ANGULAR_INIT_TIMEOUT_MS
|
|
30134
30192
|
};
|
|
30135
30193
|
|
|
30136
|
-
//# debugId=
|
|
30194
|
+
//# debugId=E460962A6A20B90264756E2164756E21
|
|
30137
30195
|
//# sourceMappingURL=index.js.map
|