@absolutejs/absolute 0.19.0-beta.1120 → 0.19.0-beta.1122
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 +571 -483
- package/dist/build.js.map +7 -6
- package/dist/cli/index.js +184 -101
- package/dist/index.js +571 -483
- package/dist/index.js.map +7 -6
- package/dist/src/build/bunStringRawUnicodePlugin.d.ts +12 -0
- package/dist/src/utils/cleanup.d.ts +1 -0
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -11653,6 +11653,81 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
11653
11653
|
angularLinkerPlugin = createAngularLinkerPlugin(false);
|
|
11654
11654
|
});
|
|
11655
11655
|
|
|
11656
|
+
// src/build/bunStringRawUnicodePlugin.ts
|
|
11657
|
+
import { extname as extname6 } from "path";
|
|
11658
|
+
import ts6 from "typescript";
|
|
11659
|
+
var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
11660
|
+
if (/\.[cm]?tsx$/.test(filePath))
|
|
11661
|
+
return ts6.ScriptKind.TSX;
|
|
11662
|
+
if (/\.[cm]?jsx$/.test(filePath))
|
|
11663
|
+
return ts6.ScriptKind.JSX;
|
|
11664
|
+
if (/\.[cm]?ts$/.test(filePath))
|
|
11665
|
+
return ts6.ScriptKind.TS;
|
|
11666
|
+
return ts6.ScriptKind.JS;
|
|
11667
|
+
}, getLoader = (filePath) => {
|
|
11668
|
+
const extension = extname6(filePath);
|
|
11669
|
+
if (extension === ".tsx")
|
|
11670
|
+
return "tsx";
|
|
11671
|
+
if (extension === ".jsx")
|
|
11672
|
+
return "jsx";
|
|
11673
|
+
if (extension === ".ts" || extension === ".mts" || extension === ".cts") {
|
|
11674
|
+
return "ts";
|
|
11675
|
+
}
|
|
11676
|
+
return "js";
|
|
11677
|
+
}, isStringRawTag = (node) => ts6.isPropertyAccessExpression(node.tag) && ts6.isIdentifier(node.tag.expression) && node.tag.expression.text === "String" && node.tag.name.text === "raw", getRawText = (node) => node.rawText ?? node.text, rewriteBunStringRawUnicode = (source, filePath = "input.ts") => {
|
|
11678
|
+
if (!source.includes("String.raw") || !NON_ASCII.test(source))
|
|
11679
|
+
return source;
|
|
11680
|
+
const sourceFile = ts6.createSourceFile(filePath, source, ts6.ScriptTarget.Latest, true, getScriptKind2(filePath));
|
|
11681
|
+
const replacements = [];
|
|
11682
|
+
const visit = (node) => {
|
|
11683
|
+
if (ts6.isTaggedTemplateExpression(node) && isStringRawTag(node)) {
|
|
11684
|
+
const rawSegments = ts6.isNoSubstitutionTemplateLiteral(node.template) ? [getRawText(node.template)] : [
|
|
11685
|
+
getRawText(node.template.head),
|
|
11686
|
+
...node.template.templateSpans.map((span) => getRawText(span.literal))
|
|
11687
|
+
];
|
|
11688
|
+
if (rawSegments.some((segment) => NON_ASCII.test(segment))) {
|
|
11689
|
+
const expressions = ts6.isTemplateExpression(node.template) ? node.template.templateSpans.map((span) => {
|
|
11690
|
+
const expression = source.slice(span.expression.getStart(sourceFile), span.expression.end);
|
|
11691
|
+
return rewriteBunStringRawUnicode(expression, filePath);
|
|
11692
|
+
}) : [];
|
|
11693
|
+
const args = [
|
|
11694
|
+
`{ raw: [${rawSegments.map((text) => JSON.stringify(text)).join(", ")}] }`,
|
|
11695
|
+
...expressions
|
|
11696
|
+
];
|
|
11697
|
+
replacements.push({
|
|
11698
|
+
end: node.end,
|
|
11699
|
+
start: node.getStart(sourceFile),
|
|
11700
|
+
value: `String.raw(${args.join(", ")})`
|
|
11701
|
+
});
|
|
11702
|
+
return;
|
|
11703
|
+
}
|
|
11704
|
+
}
|
|
11705
|
+
ts6.forEachChild(node, visit);
|
|
11706
|
+
};
|
|
11707
|
+
visit(sourceFile);
|
|
11708
|
+
let result = source;
|
|
11709
|
+
for (const replacement of replacements.sort((a, b2) => b2.start - a.start)) {
|
|
11710
|
+
result = result.slice(0, replacement.start) + replacement.value + result.slice(replacement.end);
|
|
11711
|
+
}
|
|
11712
|
+
return result;
|
|
11713
|
+
}, createBunStringRawUnicodePlugin = () => ({
|
|
11714
|
+
name: "absolute-bun-string-raw-unicode",
|
|
11715
|
+
setup(build) {
|
|
11716
|
+
build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
|
|
11717
|
+
if (args.path.includes("/node_modules/"))
|
|
11718
|
+
return;
|
|
11719
|
+
const source = await Bun.file(args.path).text();
|
|
11720
|
+
const contents = rewriteBunStringRawUnicode(source, args.path);
|
|
11721
|
+
if (contents === source)
|
|
11722
|
+
return;
|
|
11723
|
+
return { contents, loader: getLoader(args.path) };
|
|
11724
|
+
});
|
|
11725
|
+
}
|
|
11726
|
+
});
|
|
11727
|
+
var init_bunStringRawUnicodePlugin = __esm(() => {
|
|
11728
|
+
NON_ASCII = /[^\x00-\x7f]/;
|
|
11729
|
+
});
|
|
11730
|
+
|
|
11656
11731
|
// src/build/externalAssetPlugin.ts
|
|
11657
11732
|
import { copyFileSync, existsSync as existsSync19, mkdirSync as mkdirSync6, statSync } from "fs";
|
|
11658
11733
|
import { basename as basename5, dirname as dirname11, join as join20, resolve as resolve16 } from "path";
|
|
@@ -11694,25 +11769,25 @@ var init_externalAssetPlugin = () => {};
|
|
|
11694
11769
|
|
|
11695
11770
|
// src/build/islandRegistryTransform.ts
|
|
11696
11771
|
import { basename as basename6 } from "path";
|
|
11697
|
-
import
|
|
11698
|
-
var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) =>
|
|
11772
|
+
import ts7 from "typescript";
|
|
11773
|
+
var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name) || ts7.isStringLiteral(name) ? name.text : null, isIslandRegistryHelperImport2 = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands"), collectRegistryFactory = (sourceFile) => {
|
|
11699
11774
|
const factoryNames = new Set;
|
|
11700
11775
|
const namespaceNames = new Set;
|
|
11701
11776
|
for (const statement of sourceFile.statements) {
|
|
11702
|
-
if (!
|
|
11777
|
+
if (!ts7.isImportDeclaration(statement))
|
|
11703
11778
|
continue;
|
|
11704
|
-
if (!
|
|
11779
|
+
if (!ts7.isStringLiteral(statement.moduleSpecifier))
|
|
11705
11780
|
continue;
|
|
11706
11781
|
if (!isIslandRegistryHelperImport2(statement.moduleSpecifier.text))
|
|
11707
11782
|
continue;
|
|
11708
11783
|
const bindings = statement.importClause?.namedBindings;
|
|
11709
11784
|
if (!bindings)
|
|
11710
11785
|
continue;
|
|
11711
|
-
if (
|
|
11786
|
+
if (ts7.isNamespaceImport(bindings)) {
|
|
11712
11787
|
namespaceNames.add(bindings.name.text);
|
|
11713
11788
|
continue;
|
|
11714
11789
|
}
|
|
11715
|
-
if (!
|
|
11790
|
+
if (!ts7.isNamedImports(bindings))
|
|
11716
11791
|
continue;
|
|
11717
11792
|
for (const element of bindings.elements) {
|
|
11718
11793
|
const imported = element.propertyName?.text ?? element.name.text;
|
|
@@ -11723,20 +11798,20 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name)
|
|
|
11723
11798
|
}
|
|
11724
11799
|
return { factoryNames, namespaceNames };
|
|
11725
11800
|
}, isDefineIslandRegistryCall2 = (expression, factoryNames, namespaceNames) => {
|
|
11726
|
-
if (
|
|
11801
|
+
if (ts7.isIdentifier(expression))
|
|
11727
11802
|
return factoryNames.has(expression.text);
|
|
11728
|
-
return
|
|
11803
|
+
return ts7.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && ts7.isIdentifier(expression.expression) && namespaceNames.has(expression.expression.text);
|
|
11729
11804
|
}, findDefineIslandRegistryCall = (sourceFile, factoryNames, namespaceNames) => {
|
|
11730
11805
|
let found = null;
|
|
11731
11806
|
const visit = (node) => {
|
|
11732
11807
|
if (found)
|
|
11733
11808
|
return;
|
|
11734
|
-
const [firstArg] =
|
|
11735
|
-
if (
|
|
11809
|
+
const [firstArg] = ts7.isCallExpression(node) ? node.arguments : [];
|
|
11810
|
+
if (ts7.isCallExpression(node) && isDefineIslandRegistryCall2(node.expression, factoryNames, namespaceNames) && firstArg && ts7.isObjectLiteralExpression(firstArg)) {
|
|
11736
11811
|
found = node;
|
|
11737
11812
|
return;
|
|
11738
11813
|
}
|
|
11739
|
-
|
|
11814
|
+
ts7.forEachChild(node, visit);
|
|
11740
11815
|
};
|
|
11741
11816
|
visit(sourceFile);
|
|
11742
11817
|
return found;
|
|
@@ -11746,8 +11821,8 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name)
|
|
|
11746
11821
|
}, transformIslandRegistrySource = (source, filePath, info) => {
|
|
11747
11822
|
if (!source.includes("defineIslandRegistry"))
|
|
11748
11823
|
return null;
|
|
11749
|
-
const scriptKind = filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ?
|
|
11750
|
-
const sourceFile =
|
|
11824
|
+
const scriptKind = filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ? ts7.ScriptKind.TSX : ts7.ScriptKind.TS;
|
|
11825
|
+
const sourceFile = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.Latest, true, scriptKind);
|
|
11751
11826
|
const { factoryNames, namespaceNames } = collectRegistryFactory(sourceFile);
|
|
11752
11827
|
if (factoryNames.size === 0 && namespaceNames.size === 0)
|
|
11753
11828
|
return null;
|
|
@@ -11755,7 +11830,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name)
|
|
|
11755
11830
|
if (!call)
|
|
11756
11831
|
return null;
|
|
11757
11832
|
const [objectLiteral] = call.arguments;
|
|
11758
|
-
if (!objectLiteral || !
|
|
11833
|
+
if (!objectLiteral || !ts7.isObjectLiteralExpression(objectLiteral)) {
|
|
11759
11834
|
return null;
|
|
11760
11835
|
}
|
|
11761
11836
|
const definitionLookup = new Map;
|
|
@@ -11770,20 +11845,20 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name)
|
|
|
11770
11845
|
const edits = [];
|
|
11771
11846
|
const replacedLocals = new Set;
|
|
11772
11847
|
for (const frameworkProperty of objectLiteral.properties) {
|
|
11773
|
-
if (!
|
|
11848
|
+
if (!ts7.isPropertyAssignment(frameworkProperty))
|
|
11774
11849
|
continue;
|
|
11775
11850
|
const frameworkName = getObjectPropertyName2(frameworkProperty.name);
|
|
11776
11851
|
const framework = VALID_FRAMEWORKS.find((f2) => f2 === frameworkName);
|
|
11777
11852
|
if (!framework)
|
|
11778
11853
|
continue;
|
|
11779
|
-
if (!
|
|
11854
|
+
if (!ts7.isObjectLiteralExpression(frameworkProperty.initializer))
|
|
11780
11855
|
continue;
|
|
11781
11856
|
for (const componentProperty of frameworkProperty.initializer.properties) {
|
|
11782
11857
|
let componentKey = null;
|
|
11783
11858
|
let localName = null;
|
|
11784
11859
|
let replaceNode = null;
|
|
11785
11860
|
let replacementText = "";
|
|
11786
|
-
if (
|
|
11861
|
+
if (ts7.isShorthandPropertyAssignment(componentProperty)) {
|
|
11787
11862
|
componentKey = componentProperty.name.text;
|
|
11788
11863
|
localName = componentProperty.name.text;
|
|
11789
11864
|
const reference = definitionLookup.get(`${framework}:${componentKey}`);
|
|
@@ -11791,7 +11866,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name)
|
|
|
11791
11866
|
continue;
|
|
11792
11867
|
replaceNode = componentProperty;
|
|
11793
11868
|
replacementText = `${quoteKey(componentKey)}: ${definitionLiteral(reference)}`;
|
|
11794
|
-
} else if (
|
|
11869
|
+
} else if (ts7.isPropertyAssignment(componentProperty) && ts7.isIdentifier(componentProperty.initializer)) {
|
|
11795
11870
|
componentKey = getObjectPropertyName2(componentProperty.name);
|
|
11796
11871
|
localName = componentProperty.initializer.text;
|
|
11797
11872
|
if (!componentKey)
|
|
@@ -11815,7 +11890,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name)
|
|
|
11815
11890
|
if (edits.length === 0)
|
|
11816
11891
|
return null;
|
|
11817
11892
|
for (const statement of sourceFile.statements) {
|
|
11818
|
-
if (!
|
|
11893
|
+
if (!ts7.isImportDeclaration(statement))
|
|
11819
11894
|
continue;
|
|
11820
11895
|
const clause = statement.importClause;
|
|
11821
11896
|
if (!clause)
|
|
@@ -11824,11 +11899,11 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name)
|
|
|
11824
11899
|
if (clause.name)
|
|
11825
11900
|
localNames.push(clause.name.text);
|
|
11826
11901
|
const bindings = clause.namedBindings;
|
|
11827
|
-
if (bindings &&
|
|
11902
|
+
if (bindings && ts7.isNamedImports(bindings)) {
|
|
11828
11903
|
for (const element of bindings.elements) {
|
|
11829
11904
|
localNames.push(element.name.text);
|
|
11830
11905
|
}
|
|
11831
|
-
} else if (bindings &&
|
|
11906
|
+
} else if (bindings && ts7.isNamespaceImport(bindings)) {
|
|
11832
11907
|
localNames.push(bindings.name.text);
|
|
11833
11908
|
}
|
|
11834
11909
|
if (localNames.length === 0)
|
|
@@ -12138,9 +12213,18 @@ var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", g
|
|
|
12138
12213
|
var init_generatedDir = () => {};
|
|
12139
12214
|
|
|
12140
12215
|
// src/utils/cleanup.ts
|
|
12141
|
-
import { rm as rm3 } from "fs/promises";
|
|
12216
|
+
import { lstat, rm as rm3 } from "fs/promises";
|
|
12142
12217
|
import { join as join22 } from "path";
|
|
12143
|
-
var
|
|
12218
|
+
var isNotFoundError = (error) => error instanceof Error && ("code" in error) && Reflect.get(error, "code") === "ENOENT", removeIfExists = async (path) => {
|
|
12219
|
+
try {
|
|
12220
|
+
await lstat(path);
|
|
12221
|
+
} catch (error) {
|
|
12222
|
+
if (isNotFoundError(error))
|
|
12223
|
+
return;
|
|
12224
|
+
throw error;
|
|
12225
|
+
}
|
|
12226
|
+
await rm3(path, { force: true, recursive: true });
|
|
12227
|
+
}, cleanFramework = (framework, frameworkDir, skipGenerated = false) => {
|
|
12144
12228
|
const tasks = [];
|
|
12145
12229
|
if (!skipGenerated) {
|
|
12146
12230
|
tasks.push(removeIfExists(getFrameworkGeneratedDir(framework)));
|
|
@@ -12714,11 +12798,11 @@ __export(exports_scanVueSsrOnlyPages, {
|
|
|
12714
12798
|
});
|
|
12715
12799
|
import { readdirSync as readdirSync2, readFileSync as readFileSync13 } from "fs";
|
|
12716
12800
|
import { join as join24 } from "path";
|
|
12717
|
-
import
|
|
12718
|
-
var SKIP_DIRS2, SOURCE_EXTENSIONS2,
|
|
12801
|
+
import ts8 from "typescript";
|
|
12802
|
+
var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind3 = (filePath) => {
|
|
12719
12803
|
if (filePath.endsWith(".tsx"))
|
|
12720
|
-
return
|
|
12721
|
-
return
|
|
12804
|
+
return ts8.ScriptKind.TSX;
|
|
12805
|
+
return ts8.ScriptKind.TS;
|
|
12722
12806
|
}, hasSourceExtension2 = (filePath) => {
|
|
12723
12807
|
const idx = filePath.lastIndexOf(".");
|
|
12724
12808
|
if (idx === -1)
|
|
@@ -12754,27 +12838,27 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind2 = (filePath) => {
|
|
|
12754
12838
|
}
|
|
12755
12839
|
return out;
|
|
12756
12840
|
}, fileMayContainVueHandler = (source) => source.includes("handleVuePageRequest"), isHandleVuePageRequestCallee = (expression) => {
|
|
12757
|
-
if (
|
|
12841
|
+
if (ts8.isIdentifier(expression)) {
|
|
12758
12842
|
return expression.text === "handleVuePageRequest";
|
|
12759
12843
|
}
|
|
12760
|
-
if (
|
|
12844
|
+
if (ts8.isPropertyAccessExpression(expression) && ts8.isIdentifier(expression.name)) {
|
|
12761
12845
|
return expression.name.text === "handleVuePageRequest";
|
|
12762
12846
|
}
|
|
12763
12847
|
return false;
|
|
12764
12848
|
}, getPropertyName = (name) => {
|
|
12765
|
-
if (
|
|
12849
|
+
if (ts8.isIdentifier(name) || ts8.isStringLiteral(name)) {
|
|
12766
12850
|
return name.text;
|
|
12767
12851
|
}
|
|
12768
12852
|
return null;
|
|
12769
12853
|
}, readStringLiteralValue = (node) => {
|
|
12770
|
-
if (
|
|
12854
|
+
if (ts8.isStringLiteral(node) || ts8.isNoSubstitutionTemplateLiteral(node)) {
|
|
12771
12855
|
return node.text;
|
|
12772
12856
|
}
|
|
12773
12857
|
return null;
|
|
12774
12858
|
}, isAssetCall = (node) => {
|
|
12775
|
-
if (!
|
|
12859
|
+
if (!ts8.isCallExpression(node))
|
|
12776
12860
|
return false;
|
|
12777
|
-
if (!
|
|
12861
|
+
if (!ts8.isIdentifier(node.expression))
|
|
12778
12862
|
return false;
|
|
12779
12863
|
return node.expression.text === "asset";
|
|
12780
12864
|
}, extractAssetLiteralKey = (call) => {
|
|
@@ -12787,14 +12871,14 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind2 = (filePath) => {
|
|
|
12787
12871
|
}, extractPagePathAssetKey = (initializer) => {
|
|
12788
12872
|
if (!isAssetCall(initializer))
|
|
12789
12873
|
return null;
|
|
12790
|
-
if (!
|
|
12874
|
+
if (!ts8.isCallExpression(initializer))
|
|
12791
12875
|
return null;
|
|
12792
12876
|
return extractAssetLiteralKey(initializer);
|
|
12793
12877
|
}, extractSsrOnlyPageName = (objectLiteral) => {
|
|
12794
12878
|
let hasClientNone = false;
|
|
12795
12879
|
let pageAssetKey = null;
|
|
12796
12880
|
for (const property of objectLiteral.properties) {
|
|
12797
|
-
if (!
|
|
12881
|
+
if (!ts8.isPropertyAssignment(property))
|
|
12798
12882
|
continue;
|
|
12799
12883
|
const name = getPropertyName(property.name);
|
|
12800
12884
|
if (!name)
|
|
@@ -12821,19 +12905,19 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind2 = (filePath) => {
|
|
|
12821
12905
|
}
|
|
12822
12906
|
if (!fileMayContainVueHandler(source))
|
|
12823
12907
|
return;
|
|
12824
|
-
const sourceFile =
|
|
12908
|
+
const sourceFile = ts8.createSourceFile(filePath, source, ts8.ScriptTarget.Latest, true, getScriptKind3(filePath));
|
|
12825
12909
|
const visit = (node) => {
|
|
12826
|
-
if (
|
|
12910
|
+
if (ts8.isCallExpression(node) && isHandleVuePageRequestCallee(node.expression)) {
|
|
12827
12911
|
const firstArg = node.arguments[0];
|
|
12828
|
-
if (firstArg &&
|
|
12912
|
+
if (firstArg && ts8.isObjectLiteralExpression(firstArg)) {
|
|
12829
12913
|
const pageName = extractSsrOnlyPageName(firstArg);
|
|
12830
12914
|
if (pageName)
|
|
12831
12915
|
out.add(pageName);
|
|
12832
12916
|
}
|
|
12833
12917
|
}
|
|
12834
|
-
|
|
12918
|
+
ts8.forEachChild(node, visit);
|
|
12835
12919
|
};
|
|
12836
|
-
|
|
12920
|
+
ts8.forEachChild(sourceFile, visit);
|
|
12837
12921
|
}, scanVueSsrOnlyPages = (projectRoot) => {
|
|
12838
12922
|
const files = collectSourceFiles2(projectRoot);
|
|
12839
12923
|
const ssrOnlyPageNames = new Set;
|
|
@@ -12861,11 +12945,11 @@ var init_scanVueSsrOnlyPages = __esm(() => {
|
|
|
12861
12945
|
// src/build/scanAngularHandlerCalls.ts
|
|
12862
12946
|
import { readdirSync as readdirSync3, readFileSync as readFileSync14 } from "fs";
|
|
12863
12947
|
import { join as join25 } from "path";
|
|
12864
|
-
import
|
|
12865
|
-
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PREFIX = ".absolutejs-hmr-",
|
|
12948
|
+
import ts9 from "typescript";
|
|
12949
|
+
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PREFIX = ".absolutejs-hmr-", getScriptKind4 = (filePath) => {
|
|
12866
12950
|
if (filePath.endsWith(".tsx"))
|
|
12867
|
-
return
|
|
12868
|
-
return
|
|
12951
|
+
return ts9.ScriptKind.TSX;
|
|
12952
|
+
return ts9.ScriptKind.TS;
|
|
12869
12953
|
}, hasSourceExtension3 = (filePath) => {
|
|
12870
12954
|
const idx = filePath.lastIndexOf(".");
|
|
12871
12955
|
if (idx === -1)
|
|
@@ -12901,25 +12985,25 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PRE
|
|
|
12901
12985
|
}
|
|
12902
12986
|
return out;
|
|
12903
12987
|
}, fileMayContainAngularHandler = (source) => source.includes("handleAngularPageRequest"), extractManifestKey = (pagePathValue) => {
|
|
12904
|
-
if (!
|
|
12988
|
+
if (!ts9.isCallExpression(pagePathValue))
|
|
12905
12989
|
return null;
|
|
12906
12990
|
const callee = pagePathValue.expression;
|
|
12907
|
-
if (!
|
|
12991
|
+
if (!ts9.isIdentifier(callee) || callee.text !== "asset")
|
|
12908
12992
|
return null;
|
|
12909
12993
|
const [, second] = pagePathValue.arguments;
|
|
12910
12994
|
if (!second)
|
|
12911
12995
|
return null;
|
|
12912
|
-
if (!
|
|
12996
|
+
if (!ts9.isStringLiteral(second))
|
|
12913
12997
|
return null;
|
|
12914
12998
|
return second.text;
|
|
12915
12999
|
}, findEnclosingMountPath = (node) => {
|
|
12916
13000
|
let cursor = node.parent;
|
|
12917
13001
|
while (cursor) {
|
|
12918
|
-
if (
|
|
13002
|
+
if (ts9.isCallExpression(cursor)) {
|
|
12919
13003
|
const callee = cursor.expression;
|
|
12920
|
-
if (
|
|
13004
|
+
if (ts9.isPropertyAccessExpression(callee) && ts9.isIdentifier(callee.name) && ELYSIA_ROUTE_METHODS2.has(callee.name.text)) {
|
|
12921
13005
|
const firstArg = cursor.arguments[0];
|
|
12922
|
-
if (firstArg &&
|
|
13006
|
+
if (firstArg && ts9.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
12923
13007
|
return firstArg.text;
|
|
12924
13008
|
}
|
|
12925
13009
|
}
|
|
@@ -12936,27 +13020,27 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PRE
|
|
|
12936
13020
|
}
|
|
12937
13021
|
if (!fileMayContainAngularHandler(source))
|
|
12938
13022
|
return;
|
|
12939
|
-
const sf =
|
|
13023
|
+
const sf = ts9.createSourceFile(filePath, source, ts9.ScriptTarget.Latest, true, getScriptKind4(filePath));
|
|
12940
13024
|
const visit = (node) => {
|
|
12941
|
-
if (
|
|
13025
|
+
if (ts9.isCallExpression(node) && ts9.isIdentifier(node.expression) && node.expression.text === "handleAngularPageRequest") {
|
|
12942
13026
|
const [arg] = node.arguments;
|
|
12943
|
-
if (arg &&
|
|
13027
|
+
if (arg && ts9.isObjectLiteralExpression(arg)) {
|
|
12944
13028
|
let manifestKey = null;
|
|
12945
13029
|
for (const prop of arg.properties) {
|
|
12946
|
-
if (
|
|
13030
|
+
if (ts9.isPropertyAssignment(prop)) {
|
|
12947
13031
|
if (!prop.name)
|
|
12948
13032
|
continue;
|
|
12949
|
-
const name =
|
|
13033
|
+
const name = ts9.isIdentifier(prop.name) ? prop.name.text : ts9.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
12950
13034
|
if (name === "pagePath") {
|
|
12951
13035
|
manifestKey = extractManifestKey(prop.initializer);
|
|
12952
13036
|
}
|
|
12953
|
-
} else if (
|
|
13037
|
+
} else if (ts9.isSpreadAssignment(prop)) {
|
|
12954
13038
|
if (manifestKey)
|
|
12955
13039
|
continue;
|
|
12956
13040
|
const spreadExpr = prop.expression;
|
|
12957
|
-
if (
|
|
13041
|
+
if (ts9.isCallExpression(spreadExpr) && spreadExpr.arguments.length > 0) {
|
|
12958
13042
|
const [firstArg] = spreadExpr.arguments;
|
|
12959
|
-
if (firstArg &&
|
|
13043
|
+
if (firstArg && ts9.isStringLiteral(firstArg)) {
|
|
12960
13044
|
manifestKey = firstArg.text;
|
|
12961
13045
|
}
|
|
12962
13046
|
}
|
|
@@ -12971,9 +13055,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PRE
|
|
|
12971
13055
|
}
|
|
12972
13056
|
}
|
|
12973
13057
|
}
|
|
12974
|
-
|
|
13058
|
+
ts9.forEachChild(node, visit);
|
|
12975
13059
|
};
|
|
12976
|
-
|
|
13060
|
+
ts9.forEachChild(sf, visit);
|
|
12977
13061
|
}, scanAngularHandlerCalls = (projectRoot) => {
|
|
12978
13062
|
const files = collectSourceFiles3(projectRoot);
|
|
12979
13063
|
const collected = [];
|
|
@@ -13011,7 +13095,7 @@ var init_scanAngularHandlerCalls = __esm(() => {
|
|
|
13011
13095
|
// src/build/scanAngularPageRoutes.ts
|
|
13012
13096
|
import { readdirSync as readdirSync4, readFileSync as readFileSync15 } from "fs";
|
|
13013
13097
|
import { basename as basename9, join as join26 } from "path";
|
|
13014
|
-
import
|
|
13098
|
+
import ts10 from "typescript";
|
|
13015
13099
|
var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
13016
13100
|
const idx = filePath.lastIndexOf(".");
|
|
13017
13101
|
if (idx === -1)
|
|
@@ -13060,15 +13144,15 @@ var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
|
13060
13144
|
}, hasTopLevelRoutesExport = (source, filePath) => {
|
|
13061
13145
|
if (!source.includes("routes"))
|
|
13062
13146
|
return false;
|
|
13063
|
-
const sf =
|
|
13147
|
+
const sf = ts10.createSourceFile(filePath, source, ts10.ScriptTarget.Latest, true, ts10.ScriptKind.TS);
|
|
13064
13148
|
for (const statement of sf.statements) {
|
|
13065
|
-
if (!
|
|
13149
|
+
if (!ts10.isVariableStatement(statement))
|
|
13066
13150
|
continue;
|
|
13067
|
-
const isExported = statement.modifiers?.some((modifier) => modifier.kind ===
|
|
13151
|
+
const isExported = statement.modifiers?.some((modifier) => modifier.kind === ts10.SyntaxKind.ExportKeyword);
|
|
13068
13152
|
if (!isExported)
|
|
13069
13153
|
continue;
|
|
13070
13154
|
for (const declaration of statement.declarationList.declarations) {
|
|
13071
|
-
if (!
|
|
13155
|
+
if (!ts10.isIdentifier(declaration.name))
|
|
13072
13156
|
continue;
|
|
13073
13157
|
if (declaration.name.text === "routes")
|
|
13074
13158
|
return true;
|
|
@@ -13130,44 +13214,44 @@ __export(exports_parseAngularConfigImports, {
|
|
|
13130
13214
|
});
|
|
13131
13215
|
import { existsSync as existsSync20, readFileSync as readFileSync16 } from "fs";
|
|
13132
13216
|
import { dirname as dirname13, isAbsolute as isAbsolute3, join as join27 } from "path";
|
|
13133
|
-
import
|
|
13217
|
+
import ts11 from "typescript";
|
|
13134
13218
|
var findDefineConfigCall = (sf) => {
|
|
13135
13219
|
let result = null;
|
|
13136
13220
|
const visit = (node) => {
|
|
13137
13221
|
if (result)
|
|
13138
13222
|
return;
|
|
13139
|
-
if (
|
|
13223
|
+
if (ts11.isCallExpression(node) && ts11.isIdentifier(node.expression) && node.expression.text === "defineConfig") {
|
|
13140
13224
|
const [arg] = node.arguments;
|
|
13141
|
-
if (arg &&
|
|
13225
|
+
if (arg && ts11.isObjectLiteralExpression(arg)) {
|
|
13142
13226
|
result = arg;
|
|
13143
13227
|
return;
|
|
13144
13228
|
}
|
|
13145
13229
|
}
|
|
13146
|
-
|
|
13230
|
+
ts11.forEachChild(node, visit);
|
|
13147
13231
|
};
|
|
13148
|
-
|
|
13232
|
+
ts11.forEachChild(sf, visit);
|
|
13149
13233
|
return result;
|
|
13150
13234
|
}, findPropertyInitializer = (object, name) => {
|
|
13151
13235
|
for (const prop of object.properties) {
|
|
13152
|
-
if (!
|
|
13236
|
+
if (!ts11.isPropertyAssignment(prop))
|
|
13153
13237
|
continue;
|
|
13154
13238
|
if (!prop.name)
|
|
13155
13239
|
continue;
|
|
13156
|
-
const key =
|
|
13240
|
+
const key = ts11.isIdentifier(prop.name) ? prop.name.text : ts11.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
13157
13241
|
if (key === name)
|
|
13158
13242
|
return prop.initializer;
|
|
13159
13243
|
}
|
|
13160
13244
|
return null;
|
|
13161
13245
|
}, findImportForBinding = (sf, binding) => {
|
|
13162
13246
|
for (const statement of sf.statements) {
|
|
13163
|
-
if (!
|
|
13247
|
+
if (!ts11.isImportDeclaration(statement))
|
|
13164
13248
|
continue;
|
|
13165
|
-
if (!
|
|
13249
|
+
if (!ts11.isStringLiteral(statement.moduleSpecifier))
|
|
13166
13250
|
continue;
|
|
13167
13251
|
if (statement.importClause?.isTypeOnly)
|
|
13168
13252
|
continue;
|
|
13169
13253
|
const named = statement.importClause?.namedBindings;
|
|
13170
|
-
if (!named || !
|
|
13254
|
+
if (!named || !ts11.isNamedImports(named))
|
|
13171
13255
|
continue;
|
|
13172
13256
|
for (const element of named.elements) {
|
|
13173
13257
|
if (element.isTypeOnly)
|
|
@@ -13208,17 +13292,17 @@ var findDefineConfigCall = (sf) => {
|
|
|
13208
13292
|
return null;
|
|
13209
13293
|
if (!source.includes("providers"))
|
|
13210
13294
|
return null;
|
|
13211
|
-
const sf =
|
|
13295
|
+
const sf = ts11.createSourceFile(configPath2, source, ts11.ScriptTarget.Latest, true, ts11.ScriptKind.TS);
|
|
13212
13296
|
const configObject = findDefineConfigCall(sf);
|
|
13213
13297
|
if (!configObject)
|
|
13214
13298
|
return null;
|
|
13215
13299
|
const angularField = findPropertyInitializer(configObject, "angular");
|
|
13216
|
-
if (!angularField || !
|
|
13300
|
+
if (!angularField || !ts11.isObjectLiteralExpression(angularField))
|
|
13217
13301
|
return null;
|
|
13218
13302
|
const providersField = findPropertyInitializer(angularField, "providers");
|
|
13219
13303
|
if (!providersField)
|
|
13220
13304
|
return null;
|
|
13221
|
-
if (!
|
|
13305
|
+
if (!ts11.isIdentifier(providersField))
|
|
13222
13306
|
return null;
|
|
13223
13307
|
const binding = providersField.text;
|
|
13224
13308
|
const importInfo = findImportForBinding(sf, binding);
|
|
@@ -13379,7 +13463,7 @@ import {
|
|
|
13379
13463
|
dirname as dirname14,
|
|
13380
13464
|
join as join28,
|
|
13381
13465
|
basename as basename10,
|
|
13382
|
-
extname as
|
|
13466
|
+
extname as extname7,
|
|
13383
13467
|
resolve as resolve20,
|
|
13384
13468
|
relative as relative11,
|
|
13385
13469
|
sep as sep2
|
|
@@ -13628,7 +13712,7 @@ var resolveDevClientDir2 = () => {
|
|
|
13628
13712
|
const componentRoots = roots.filter((root) => !root.isModule);
|
|
13629
13713
|
await Promise.all(componentRoots.map(async ({ client, hasAwaitSlot }) => {
|
|
13630
13714
|
const relClientDir = dirname14(relative11(clientDir, client));
|
|
13631
|
-
const name = basename10(client,
|
|
13715
|
+
const name = basename10(client, extname7(client));
|
|
13632
13716
|
const indexPath = join28(indexDir, relClientDir, `${name}.js`);
|
|
13633
13717
|
const importRaw = relative11(dirname14(indexPath), client).split(sep2).join("/");
|
|
13634
13718
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
@@ -13738,27 +13822,27 @@ var init_compileSvelte = __esm(() => {
|
|
|
13738
13822
|
});
|
|
13739
13823
|
|
|
13740
13824
|
// src/build/parseVueSpaRoutes.ts
|
|
13741
|
-
import
|
|
13742
|
-
var propertyName = (node) =>
|
|
13743
|
-
if (
|
|
13825
|
+
import ts12 from "typescript";
|
|
13826
|
+
var propertyName = (node) => ts12.isIdentifier(node) || ts12.isStringLiteralLike(node) ? node.text : null, stringValue = (node) => ts12.isStringLiteralLike(node) ? node.text : null, findVueImport = (node) => {
|
|
13827
|
+
if (ts12.isCallExpression(node) && node.expression.kind === ts12.SyntaxKind.ImportKeyword) {
|
|
13744
13828
|
const [specifier] = node.arguments;
|
|
13745
|
-
if (specifier &&
|
|
13829
|
+
if (specifier && ts12.isStringLiteralLike(specifier)) {
|
|
13746
13830
|
return specifier.text.endsWith(".vue") ? specifier.text : null;
|
|
13747
13831
|
}
|
|
13748
13832
|
}
|
|
13749
13833
|
let found = null;
|
|
13750
|
-
|
|
13834
|
+
ts12.forEachChild(node, (child) => {
|
|
13751
13835
|
if (found === null)
|
|
13752
13836
|
found = findVueImport(child);
|
|
13753
13837
|
});
|
|
13754
13838
|
return found;
|
|
13755
13839
|
}, parseRoute = (node) => {
|
|
13756
|
-
if (!
|
|
13840
|
+
if (!ts12.isObjectLiteralExpression(node))
|
|
13757
13841
|
return null;
|
|
13758
13842
|
let path = null;
|
|
13759
13843
|
let importPath = null;
|
|
13760
13844
|
for (const property of node.properties) {
|
|
13761
|
-
if (!
|
|
13845
|
+
if (!ts12.isPropertyAssignment(property))
|
|
13762
13846
|
continue;
|
|
13763
13847
|
const name = propertyName(property.name);
|
|
13764
13848
|
if (name === "path")
|
|
@@ -13768,12 +13852,12 @@ var propertyName = (node) => ts11.isIdentifier(node) || ts11.isStringLiteralLike
|
|
|
13768
13852
|
}
|
|
13769
13853
|
return path && importPath ? { importPath, path } : null;
|
|
13770
13854
|
}, parseVueSpaRoutes = (source) => {
|
|
13771
|
-
const sourceFile =
|
|
13855
|
+
const sourceFile = ts12.createSourceFile("absolute-vue-routes.ts", source, ts12.ScriptTarget.Latest, true, ts12.ScriptKind.TS);
|
|
13772
13856
|
const entries = [];
|
|
13773
13857
|
const visit = (node) => {
|
|
13774
|
-
if (
|
|
13858
|
+
if (ts12.isCallExpression(node) && ts12.isIdentifier(node.expression) && node.expression.text === "defineRoutes") {
|
|
13775
13859
|
const [routes] = node.arguments;
|
|
13776
|
-
if (routes &&
|
|
13860
|
+
if (routes && ts12.isArrayLiteralExpression(routes)) {
|
|
13777
13861
|
for (const element of routes.elements) {
|
|
13778
13862
|
const route = parseRoute(element);
|
|
13779
13863
|
if (route)
|
|
@@ -13781,9 +13865,9 @@ var propertyName = (node) => ts11.isIdentifier(node) || ts11.isStringLiteralLike
|
|
|
13781
13865
|
}
|
|
13782
13866
|
}
|
|
13783
13867
|
}
|
|
13784
|
-
|
|
13868
|
+
ts12.forEachChild(node, visit);
|
|
13785
13869
|
};
|
|
13786
|
-
|
|
13870
|
+
ts12.forEachChild(sourceFile, visit);
|
|
13787
13871
|
return entries;
|
|
13788
13872
|
};
|
|
13789
13873
|
var init_parseVueSpaRoutes = () => {};
|
|
@@ -15273,14 +15357,14 @@ __export(exports_compileAngular, {
|
|
|
15273
15357
|
import { existsSync as existsSync23, readFileSync as readFileSync19, promises as fs5 } from "fs";
|
|
15274
15358
|
import { join as join30, basename as basename12, sep as sep3, dirname as dirname16, resolve as resolve22, relative as relative13 } from "path";
|
|
15275
15359
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
15276
|
-
import
|
|
15360
|
+
import ts13 from "typescript";
|
|
15277
15361
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
15278
15362
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
15279
15363
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata) : await fn2();
|
|
15280
15364
|
}, readTsconfigPathAliases = () => {
|
|
15281
15365
|
try {
|
|
15282
15366
|
const configPath2 = resolve22(process.cwd(), "tsconfig.json");
|
|
15283
|
-
const config =
|
|
15367
|
+
const config = ts13.readConfigFile(configPath2, ts13.sys.readFile).config;
|
|
15284
15368
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
15285
15369
|
const baseUrl = resolve22(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
15286
15370
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
@@ -15409,7 +15493,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
15409
15493
|
return resolve22(import.meta.dir, "./dev/client");
|
|
15410
15494
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
15411
15495
|
try {
|
|
15412
|
-
return
|
|
15496
|
+
return ts13.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
15413
15497
|
`);
|
|
15414
15498
|
} catch {
|
|
15415
15499
|
return String(diagnostic.messageText || "Unknown error");
|
|
@@ -15417,7 +15501,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
15417
15501
|
}, throwOnCompilationErrors = (diagnostics) => {
|
|
15418
15502
|
if (!diagnostics?.length)
|
|
15419
15503
|
return;
|
|
15420
|
-
const errors = diagnostics.filter((diag) => diag.category ===
|
|
15504
|
+
const errors = diagnostics.filter((diag) => diag.category === ts13.DiagnosticCategory.Error);
|
|
15421
15505
|
if (!errors.length)
|
|
15422
15506
|
return;
|
|
15423
15507
|
const fullMessage = errors.map(formatDiagnosticMessage).join(`
|
|
@@ -15459,22 +15543,22 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
15459
15543
|
}
|
|
15460
15544
|
return `${path}.js${query}`;
|
|
15461
15545
|
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
15462
|
-
const sourceFile =
|
|
15546
|
+
const sourceFile = ts13.createSourceFile(fileName, source, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TS);
|
|
15463
15547
|
const specifiers = [];
|
|
15464
15548
|
const addSpecifier = (node) => {
|
|
15465
|
-
if (!node || !
|
|
15549
|
+
if (!node || !ts13.isStringLiteralLike(node))
|
|
15466
15550
|
return;
|
|
15467
15551
|
const specifier = node.text;
|
|
15468
15552
|
if (isRelativeModuleSpecifier(specifier))
|
|
15469
15553
|
specifiers.push(specifier);
|
|
15470
15554
|
};
|
|
15471
15555
|
const visit = (node) => {
|
|
15472
|
-
if (
|
|
15556
|
+
if (ts13.isImportDeclaration(node) || ts13.isExportDeclaration(node)) {
|
|
15473
15557
|
addSpecifier(node.moduleSpecifier);
|
|
15474
|
-
} else if (
|
|
15558
|
+
} else if (ts13.isCallExpression(node) && node.expression.kind === ts13.SyntaxKind.ImportKeyword) {
|
|
15475
15559
|
addSpecifier(node.arguments[0]);
|
|
15476
15560
|
}
|
|
15477
|
-
|
|
15561
|
+
ts13.forEachChild(node, visit);
|
|
15478
15562
|
};
|
|
15479
15563
|
visit(sourceFile);
|
|
15480
15564
|
return specifiers;
|
|
@@ -15622,25 +15706,25 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
15622
15706
|
emitDecoratorMetadata: true,
|
|
15623
15707
|
esModuleInterop: true,
|
|
15624
15708
|
experimentalDecorators: true,
|
|
15625
|
-
module:
|
|
15626
|
-
moduleResolution:
|
|
15627
|
-
newLine:
|
|
15709
|
+
module: ts13.ModuleKind.ESNext,
|
|
15710
|
+
moduleResolution: ts13.ModuleResolutionKind.Bundler,
|
|
15711
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
15628
15712
|
noLib: false,
|
|
15629
15713
|
outDir,
|
|
15630
15714
|
skipLibCheck: true,
|
|
15631
|
-
target:
|
|
15715
|
+
target: ts13.ScriptTarget.ES2022,
|
|
15632
15716
|
...config.options
|
|
15633
15717
|
};
|
|
15634
|
-
options.target =
|
|
15718
|
+
options.target = ts13.ScriptTarget.ES2022;
|
|
15635
15719
|
options.experimentalDecorators = true;
|
|
15636
15720
|
options.emitDecoratorMetadata = true;
|
|
15637
|
-
options.newLine =
|
|
15721
|
+
options.newLine = ts13.NewLineKind.LineFeed;
|
|
15638
15722
|
options.outDir = outDir;
|
|
15639
15723
|
options.noEmit = false;
|
|
15640
15724
|
options.incremental = false;
|
|
15641
15725
|
options.tsBuildInfoFile = undefined;
|
|
15642
15726
|
options.rootDir = process.cwd();
|
|
15643
|
-
const host = await traceAngularPhase("aot/create-compiler-host", () =>
|
|
15727
|
+
const host = await traceAngularPhase("aot/create-compiler-host", () => ts13.createCompilerHost(options));
|
|
15644
15728
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
15645
15729
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
15646
15730
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
@@ -15686,7 +15770,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
15686
15770
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
15687
15771
|
const source = transformedSources.get(resolve22(fileName));
|
|
15688
15772
|
if (source) {
|
|
15689
|
-
return
|
|
15773
|
+
return ts13.createSourceFile(fileName, source, languageVersion, true);
|
|
15690
15774
|
}
|
|
15691
15775
|
return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError);
|
|
15692
15776
|
};
|
|
@@ -16584,18 +16668,18 @@ var init_compileAngular = __esm(() => {
|
|
|
16584
16668
|
});
|
|
16585
16669
|
|
|
16586
16670
|
// src/dev/angular/hmrImportGenerator.ts
|
|
16587
|
-
import
|
|
16671
|
+
import ts14 from "typescript";
|
|
16588
16672
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
16589
16673
|
addImport(request) {
|
|
16590
16674
|
const namespace = namespaceMap.get(request.exportModuleSpecifier);
|
|
16591
16675
|
if (!namespace) {
|
|
16592
16676
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
16593
16677
|
}
|
|
16594
|
-
const namespaceId =
|
|
16678
|
+
const namespaceId = ts14.factory.createIdentifier(namespace);
|
|
16595
16679
|
if (request.exportSymbolName === null) {
|
|
16596
16680
|
return namespaceId;
|
|
16597
16681
|
}
|
|
16598
|
-
return
|
|
16682
|
+
return ts14.factory.createPropertyAccessExpression(namespaceId, ts14.factory.createIdentifier(request.exportSymbolName));
|
|
16599
16683
|
}
|
|
16600
16684
|
});
|
|
16601
16685
|
var init_hmrImportGenerator = () => {};
|
|
@@ -16968,13 +17052,13 @@ var init_translator = __esm(() => {
|
|
|
16968
17052
|
});
|
|
16969
17053
|
|
|
16970
17054
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
16971
|
-
import
|
|
17055
|
+
import ts15 from "typescript";
|
|
16972
17056
|
function tsNumericExpression(value) {
|
|
16973
17057
|
if (value < 0) {
|
|
16974
|
-
const operand =
|
|
16975
|
-
return
|
|
17058
|
+
const operand = ts15.factory.createNumericLiteral(Math.abs(value));
|
|
17059
|
+
return ts15.factory.createPrefixUnaryExpression(ts15.SyntaxKind.MinusToken, operand);
|
|
16976
17060
|
}
|
|
16977
|
-
return
|
|
17061
|
+
return ts15.factory.createNumericLiteral(value);
|
|
16978
17062
|
}
|
|
16979
17063
|
var init_ts_util = __esm(() => {
|
|
16980
17064
|
/*!
|
|
@@ -16987,142 +17071,142 @@ var init_ts_util = __esm(() => {
|
|
|
16987
17071
|
});
|
|
16988
17072
|
|
|
16989
17073
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
16990
|
-
import
|
|
17074
|
+
import ts16 from "typescript";
|
|
16991
17075
|
|
|
16992
17076
|
class TypeScriptAstFactory {
|
|
16993
17077
|
annotateForClosureCompiler;
|
|
16994
17078
|
externalSourceFiles = new Map;
|
|
16995
17079
|
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
16996
|
-
"+":
|
|
16997
|
-
"-":
|
|
16998
|
-
"!":
|
|
17080
|
+
"+": ts16.SyntaxKind.PlusToken,
|
|
17081
|
+
"-": ts16.SyntaxKind.MinusToken,
|
|
17082
|
+
"!": ts16.SyntaxKind.ExclamationToken
|
|
16999
17083
|
}))();
|
|
17000
17084
|
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
17001
|
-
"&&":
|
|
17002
|
-
">":
|
|
17003
|
-
">=":
|
|
17004
|
-
"&":
|
|
17005
|
-
"|":
|
|
17006
|
-
"/":
|
|
17007
|
-
"==":
|
|
17008
|
-
"===":
|
|
17009
|
-
"<":
|
|
17010
|
-
"<=":
|
|
17011
|
-
"-":
|
|
17012
|
-
"%":
|
|
17013
|
-
"*":
|
|
17014
|
-
"**":
|
|
17015
|
-
"!=":
|
|
17016
|
-
"!==":
|
|
17017
|
-
"||":
|
|
17018
|
-
"+":
|
|
17019
|
-
"??":
|
|
17020
|
-
"=":
|
|
17021
|
-
"+=":
|
|
17022
|
-
"-=":
|
|
17023
|
-
"*=":
|
|
17024
|
-
"/=":
|
|
17025
|
-
"%=":
|
|
17026
|
-
"**=":
|
|
17027
|
-
"&&=":
|
|
17028
|
-
"||=":
|
|
17029
|
-
"??=":
|
|
17030
|
-
in:
|
|
17031
|
-
instanceof:
|
|
17085
|
+
"&&": ts16.SyntaxKind.AmpersandAmpersandToken,
|
|
17086
|
+
">": ts16.SyntaxKind.GreaterThanToken,
|
|
17087
|
+
">=": ts16.SyntaxKind.GreaterThanEqualsToken,
|
|
17088
|
+
"&": ts16.SyntaxKind.AmpersandToken,
|
|
17089
|
+
"|": ts16.SyntaxKind.BarToken,
|
|
17090
|
+
"/": ts16.SyntaxKind.SlashToken,
|
|
17091
|
+
"==": ts16.SyntaxKind.EqualsEqualsToken,
|
|
17092
|
+
"===": ts16.SyntaxKind.EqualsEqualsEqualsToken,
|
|
17093
|
+
"<": ts16.SyntaxKind.LessThanToken,
|
|
17094
|
+
"<=": ts16.SyntaxKind.LessThanEqualsToken,
|
|
17095
|
+
"-": ts16.SyntaxKind.MinusToken,
|
|
17096
|
+
"%": ts16.SyntaxKind.PercentToken,
|
|
17097
|
+
"*": ts16.SyntaxKind.AsteriskToken,
|
|
17098
|
+
"**": ts16.SyntaxKind.AsteriskAsteriskToken,
|
|
17099
|
+
"!=": ts16.SyntaxKind.ExclamationEqualsToken,
|
|
17100
|
+
"!==": ts16.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
17101
|
+
"||": ts16.SyntaxKind.BarBarToken,
|
|
17102
|
+
"+": ts16.SyntaxKind.PlusToken,
|
|
17103
|
+
"??": ts16.SyntaxKind.QuestionQuestionToken,
|
|
17104
|
+
"=": ts16.SyntaxKind.EqualsToken,
|
|
17105
|
+
"+=": ts16.SyntaxKind.PlusEqualsToken,
|
|
17106
|
+
"-=": ts16.SyntaxKind.MinusEqualsToken,
|
|
17107
|
+
"*=": ts16.SyntaxKind.AsteriskEqualsToken,
|
|
17108
|
+
"/=": ts16.SyntaxKind.SlashEqualsToken,
|
|
17109
|
+
"%=": ts16.SyntaxKind.PercentEqualsToken,
|
|
17110
|
+
"**=": ts16.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
17111
|
+
"&&=": ts16.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
17112
|
+
"||=": ts16.SyntaxKind.BarBarEqualsToken,
|
|
17113
|
+
"??=": ts16.SyntaxKind.QuestionQuestionEqualsToken,
|
|
17114
|
+
in: ts16.SyntaxKind.InKeyword,
|
|
17115
|
+
instanceof: ts16.SyntaxKind.InstanceOfKeyword
|
|
17032
17116
|
}))();
|
|
17033
17117
|
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
17034
|
-
const:
|
|
17035
|
-
let:
|
|
17036
|
-
var:
|
|
17118
|
+
const: ts16.NodeFlags.Const,
|
|
17119
|
+
let: ts16.NodeFlags.Let,
|
|
17120
|
+
var: ts16.NodeFlags.None
|
|
17037
17121
|
}))();
|
|
17038
17122
|
constructor(annotateForClosureCompiler) {
|
|
17039
17123
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
17040
17124
|
}
|
|
17041
17125
|
attachComments = attachComments;
|
|
17042
|
-
createArrayLiteral =
|
|
17126
|
+
createArrayLiteral = ts16.factory.createArrayLiteralExpression;
|
|
17043
17127
|
createAssignment(target, operator, value) {
|
|
17044
|
-
return
|
|
17128
|
+
return ts16.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
17045
17129
|
}
|
|
17046
17130
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
17047
|
-
return
|
|
17131
|
+
return ts16.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
17048
17132
|
}
|
|
17049
17133
|
createBlock(body) {
|
|
17050
|
-
return
|
|
17134
|
+
return ts16.factory.createBlock(body);
|
|
17051
17135
|
}
|
|
17052
17136
|
createCallExpression(callee, args, pure) {
|
|
17053
|
-
const call =
|
|
17137
|
+
const call = ts16.factory.createCallExpression(callee, undefined, args);
|
|
17054
17138
|
if (pure) {
|
|
17055
|
-
|
|
17139
|
+
ts16.addSyntheticLeadingComment(call, ts16.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
17056
17140
|
}
|
|
17057
17141
|
return call;
|
|
17058
17142
|
}
|
|
17059
17143
|
createConditional(condition, whenTrue, whenFalse) {
|
|
17060
|
-
return
|
|
17144
|
+
return ts16.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
17061
17145
|
}
|
|
17062
|
-
createElementAccess =
|
|
17063
|
-
createExpressionStatement =
|
|
17146
|
+
createElementAccess = ts16.factory.createElementAccessExpression;
|
|
17147
|
+
createExpressionStatement = ts16.factory.createExpressionStatement;
|
|
17064
17148
|
createDynamicImport(url) {
|
|
17065
|
-
return
|
|
17066
|
-
typeof url === "string" ?
|
|
17149
|
+
return ts16.factory.createCallExpression(ts16.factory.createToken(ts16.SyntaxKind.ImportKeyword), undefined, [
|
|
17150
|
+
typeof url === "string" ? ts16.factory.createStringLiteral(url) : url
|
|
17067
17151
|
]);
|
|
17068
17152
|
}
|
|
17069
17153
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
17070
|
-
if (!
|
|
17071
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17154
|
+
if (!ts16.isBlock(body)) {
|
|
17155
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts16.SyntaxKind[body.kind]}.`);
|
|
17072
17156
|
}
|
|
17073
|
-
return
|
|
17157
|
+
return ts16.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
17074
17158
|
}
|
|
17075
17159
|
createFunctionExpression(functionName, parameters, body) {
|
|
17076
|
-
if (!
|
|
17077
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17160
|
+
if (!ts16.isBlock(body)) {
|
|
17161
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts16.SyntaxKind[body.kind]}.`);
|
|
17078
17162
|
}
|
|
17079
|
-
return
|
|
17163
|
+
return ts16.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
17080
17164
|
}
|
|
17081
17165
|
createArrowFunctionExpression(parameters, body) {
|
|
17082
|
-
if (
|
|
17083
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17166
|
+
if (ts16.isStatement(body) && !ts16.isBlock(body)) {
|
|
17167
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts16.SyntaxKind[body.kind]}.`);
|
|
17084
17168
|
}
|
|
17085
|
-
return
|
|
17169
|
+
return ts16.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
17086
17170
|
}
|
|
17087
17171
|
createParameter(param) {
|
|
17088
|
-
return
|
|
17172
|
+
return ts16.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
17089
17173
|
}
|
|
17090
|
-
createIdentifier =
|
|
17174
|
+
createIdentifier = ts16.factory.createIdentifier;
|
|
17091
17175
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
17092
|
-
return
|
|
17176
|
+
return ts16.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
17093
17177
|
}
|
|
17094
17178
|
createLiteral(value) {
|
|
17095
17179
|
if (value === undefined) {
|
|
17096
|
-
return
|
|
17180
|
+
return ts16.factory.createIdentifier("undefined");
|
|
17097
17181
|
} else if (value === null) {
|
|
17098
|
-
return
|
|
17182
|
+
return ts16.factory.createNull();
|
|
17099
17183
|
} else if (typeof value === "boolean") {
|
|
17100
|
-
return value ?
|
|
17184
|
+
return value ? ts16.factory.createTrue() : ts16.factory.createFalse();
|
|
17101
17185
|
} else if (typeof value === "number") {
|
|
17102
17186
|
return tsNumericExpression(value);
|
|
17103
17187
|
} else {
|
|
17104
|
-
return
|
|
17188
|
+
return ts16.factory.createStringLiteral(value);
|
|
17105
17189
|
}
|
|
17106
17190
|
}
|
|
17107
17191
|
createNewExpression(expression, args) {
|
|
17108
|
-
return
|
|
17192
|
+
return ts16.factory.createNewExpression(expression, undefined, args);
|
|
17109
17193
|
}
|
|
17110
17194
|
createObjectLiteral(properties) {
|
|
17111
|
-
return
|
|
17195
|
+
return ts16.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
17112
17196
|
if (prop.kind === "spread") {
|
|
17113
|
-
return
|
|
17197
|
+
return ts16.factory.createSpreadAssignment(prop.expression);
|
|
17114
17198
|
}
|
|
17115
|
-
return
|
|
17199
|
+
return ts16.factory.createPropertyAssignment(prop.quoted ? ts16.factory.createStringLiteral(prop.propertyName) : ts16.factory.createIdentifier(prop.propertyName), prop.value);
|
|
17116
17200
|
}));
|
|
17117
17201
|
}
|
|
17118
|
-
createParenthesizedExpression =
|
|
17119
|
-
createPropertyAccess =
|
|
17120
|
-
createSpreadElement =
|
|
17202
|
+
createParenthesizedExpression = ts16.factory.createParenthesizedExpression;
|
|
17203
|
+
createPropertyAccess = ts16.factory.createPropertyAccessExpression;
|
|
17204
|
+
createSpreadElement = ts16.factory.createSpreadElement;
|
|
17121
17205
|
createReturnStatement(expression) {
|
|
17122
|
-
return
|
|
17206
|
+
return ts16.factory.createReturnStatement(expression ?? undefined);
|
|
17123
17207
|
}
|
|
17124
17208
|
createTaggedTemplate(tag, template) {
|
|
17125
|
-
return
|
|
17209
|
+
return ts16.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
17126
17210
|
}
|
|
17127
17211
|
createTemplateLiteral(template) {
|
|
17128
17212
|
let templateLiteral;
|
|
@@ -17132,7 +17216,7 @@ class TypeScriptAstFactory {
|
|
|
17132
17216
|
throw new Error("createTemplateLiteral: template has no elements");
|
|
17133
17217
|
}
|
|
17134
17218
|
if (length === 1) {
|
|
17135
|
-
templateLiteral =
|
|
17219
|
+
templateLiteral = ts16.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
17136
17220
|
} else {
|
|
17137
17221
|
const spans = [];
|
|
17138
17222
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -17146,7 +17230,7 @@ class TypeScriptAstFactory {
|
|
|
17146
17230
|
if (range !== null) {
|
|
17147
17231
|
this.setSourceMapRange(middle, range);
|
|
17148
17232
|
}
|
|
17149
|
-
spans.push(
|
|
17233
|
+
spans.push(ts16.factory.createTemplateSpan(expression, middle));
|
|
17150
17234
|
}
|
|
17151
17235
|
const resolvedExpression = template.expressions[length - 2];
|
|
17152
17236
|
const templatePart = template.elements[length - 1];
|
|
@@ -17157,27 +17241,27 @@ class TypeScriptAstFactory {
|
|
|
17157
17241
|
if (templatePart.range !== null) {
|
|
17158
17242
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
17159
17243
|
}
|
|
17160
|
-
spans.push(
|
|
17161
|
-
templateLiteral =
|
|
17244
|
+
spans.push(ts16.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
17245
|
+
templateLiteral = ts16.factory.createTemplateExpression(ts16.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
17162
17246
|
}
|
|
17163
17247
|
if (head.range !== null) {
|
|
17164
17248
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
17165
17249
|
}
|
|
17166
17250
|
return templateLiteral;
|
|
17167
17251
|
}
|
|
17168
|
-
createThrowStatement =
|
|
17169
|
-
createTypeOfExpression =
|
|
17170
|
-
createVoidExpression =
|
|
17252
|
+
createThrowStatement = ts16.factory.createThrowStatement;
|
|
17253
|
+
createTypeOfExpression = ts16.factory.createTypeOfExpression;
|
|
17254
|
+
createVoidExpression = ts16.factory.createVoidExpression;
|
|
17171
17255
|
createUnaryExpression(operator, operand) {
|
|
17172
|
-
return
|
|
17256
|
+
return ts16.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
17173
17257
|
}
|
|
17174
17258
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
17175
|
-
return
|
|
17176
|
-
|
|
17259
|
+
return ts16.factory.createVariableStatement(undefined, ts16.factory.createVariableDeclarationList([
|
|
17260
|
+
ts16.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
17177
17261
|
], this.VAR_TYPES[variableType]));
|
|
17178
17262
|
}
|
|
17179
17263
|
createRegularExpressionLiteral(body, flags) {
|
|
17180
|
-
return
|
|
17264
|
+
return ts16.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
17181
17265
|
}
|
|
17182
17266
|
setSourceMapRange(node, sourceMapRange) {
|
|
17183
17267
|
if (sourceMapRange === null) {
|
|
@@ -17185,10 +17269,10 @@ class TypeScriptAstFactory {
|
|
|
17185
17269
|
}
|
|
17186
17270
|
const url = sourceMapRange.url;
|
|
17187
17271
|
if (!this.externalSourceFiles.has(url)) {
|
|
17188
|
-
this.externalSourceFiles.set(url,
|
|
17272
|
+
this.externalSourceFiles.set(url, ts16.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
17189
17273
|
}
|
|
17190
17274
|
const source = this.externalSourceFiles.get(url);
|
|
17191
|
-
|
|
17275
|
+
ts16.setSourceMapRange(node, {
|
|
17192
17276
|
pos: sourceMapRange.start.offset,
|
|
17193
17277
|
end: sourceMapRange.end.offset,
|
|
17194
17278
|
source
|
|
@@ -17198,77 +17282,77 @@ class TypeScriptAstFactory {
|
|
|
17198
17282
|
createBuiltInType(type) {
|
|
17199
17283
|
switch (type) {
|
|
17200
17284
|
case "any":
|
|
17201
|
-
return
|
|
17285
|
+
return ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.AnyKeyword);
|
|
17202
17286
|
case "boolean":
|
|
17203
|
-
return
|
|
17287
|
+
return ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.BooleanKeyword);
|
|
17204
17288
|
case "number":
|
|
17205
|
-
return
|
|
17289
|
+
return ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.NumberKeyword);
|
|
17206
17290
|
case "string":
|
|
17207
|
-
return
|
|
17291
|
+
return ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.StringKeyword);
|
|
17208
17292
|
case "function":
|
|
17209
|
-
return
|
|
17293
|
+
return ts16.factory.createTypeReferenceNode(ts16.factory.createIdentifier("Function"));
|
|
17210
17294
|
case "never":
|
|
17211
|
-
return
|
|
17295
|
+
return ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.NeverKeyword);
|
|
17212
17296
|
case "unknown":
|
|
17213
|
-
return
|
|
17297
|
+
return ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.UnknownKeyword);
|
|
17214
17298
|
}
|
|
17215
17299
|
}
|
|
17216
17300
|
createExpressionType(expression, typeParams) {
|
|
17217
17301
|
const typeName = getEntityTypeFromExpression(expression);
|
|
17218
|
-
return
|
|
17302
|
+
return ts16.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
17219
17303
|
}
|
|
17220
17304
|
createArrayType(elementType) {
|
|
17221
|
-
return
|
|
17305
|
+
return ts16.factory.createArrayTypeNode(elementType);
|
|
17222
17306
|
}
|
|
17223
17307
|
createMapType(valueType) {
|
|
17224
|
-
return
|
|
17225
|
-
|
|
17226
|
-
|
|
17308
|
+
return ts16.factory.createTypeLiteralNode([
|
|
17309
|
+
ts16.factory.createIndexSignature(undefined, [
|
|
17310
|
+
ts16.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.StringKeyword))
|
|
17227
17311
|
], valueType)
|
|
17228
17312
|
]);
|
|
17229
17313
|
}
|
|
17230
17314
|
transplantType(type) {
|
|
17231
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
17315
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts16.isTypeNode(type)) {
|
|
17232
17316
|
return type;
|
|
17233
17317
|
}
|
|
17234
17318
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
17235
17319
|
}
|
|
17236
17320
|
}
|
|
17237
17321
|
function createTemplateMiddle(cooked, raw) {
|
|
17238
|
-
const node =
|
|
17239
|
-
node.kind =
|
|
17322
|
+
const node = ts16.factory.createTemplateHead(cooked, raw);
|
|
17323
|
+
node.kind = ts16.SyntaxKind.TemplateMiddle;
|
|
17240
17324
|
return node;
|
|
17241
17325
|
}
|
|
17242
17326
|
function createTemplateTail(cooked, raw) {
|
|
17243
|
-
const node =
|
|
17244
|
-
node.kind =
|
|
17327
|
+
const node = ts16.factory.createTemplateHead(cooked, raw);
|
|
17328
|
+
node.kind = ts16.SyntaxKind.TemplateTail;
|
|
17245
17329
|
return node;
|
|
17246
17330
|
}
|
|
17247
17331
|
function attachComments(statement, leadingComments) {
|
|
17248
17332
|
for (const comment of leadingComments) {
|
|
17249
|
-
const commentKind = comment.multiline ?
|
|
17333
|
+
const commentKind = comment.multiline ? ts16.SyntaxKind.MultiLineCommentTrivia : ts16.SyntaxKind.SingleLineCommentTrivia;
|
|
17250
17334
|
if (comment.multiline) {
|
|
17251
|
-
|
|
17335
|
+
ts16.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
17252
17336
|
} else {
|
|
17253
17337
|
for (const line of comment.toString().split(`
|
|
17254
17338
|
`)) {
|
|
17255
|
-
|
|
17339
|
+
ts16.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
17256
17340
|
}
|
|
17257
17341
|
}
|
|
17258
17342
|
}
|
|
17259
17343
|
}
|
|
17260
17344
|
function getEntityTypeFromExpression(expression) {
|
|
17261
|
-
if (
|
|
17345
|
+
if (ts16.isIdentifier(expression)) {
|
|
17262
17346
|
return expression;
|
|
17263
17347
|
}
|
|
17264
|
-
if (
|
|
17348
|
+
if (ts16.isPropertyAccessExpression(expression)) {
|
|
17265
17349
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
17266
|
-
if (!
|
|
17350
|
+
if (!ts16.isIdentifier(expression.name)) {
|
|
17267
17351
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
17268
17352
|
}
|
|
17269
|
-
return
|
|
17353
|
+
return ts16.factory.createQualifiedName(left, expression.name);
|
|
17270
17354
|
}
|
|
17271
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
17355
|
+
throw new Error(`Unsupported expression for type reference: ${ts16.SyntaxKind[expression.kind]}`);
|
|
17272
17356
|
}
|
|
17273
17357
|
var init_typescript_ast_factory = __esm(() => {
|
|
17274
17358
|
init_ts_util();
|
|
@@ -17302,8 +17386,8 @@ __export(exports_fastHmrCompiler, {
|
|
|
17302
17386
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
17303
17387
|
});
|
|
17304
17388
|
import { existsSync as existsSync24, readFileSync as readFileSync20, statSync as statSync2 } from "fs";
|
|
17305
|
-
import { dirname as dirname17, extname as
|
|
17306
|
-
import
|
|
17389
|
+
import { dirname as dirname17, extname as extname8, relative as relative14, resolve as resolve23 } from "path";
|
|
17390
|
+
import ts17 from "typescript";
|
|
17307
17391
|
var fail = (reason, detail, location) => ({
|
|
17308
17392
|
detail,
|
|
17309
17393
|
ok: false,
|
|
@@ -17311,10 +17395,10 @@ var fail = (reason, detail, location) => ({
|
|
|
17311
17395
|
...location ?? {}
|
|
17312
17396
|
}), fingerprintCache, pendingModuleCache, ANGULAR_DECORATOR_NAMES, findAngularDecoratorName = (decorators) => {
|
|
17313
17397
|
for (const decorator of decorators) {
|
|
17314
|
-
if (!
|
|
17398
|
+
if (!ts17.isCallExpression(decorator.expression))
|
|
17315
17399
|
continue;
|
|
17316
17400
|
const { expression } = decorator.expression;
|
|
17317
|
-
if (!
|
|
17401
|
+
if (!ts17.isIdentifier(expression))
|
|
17318
17402
|
continue;
|
|
17319
17403
|
if (ANGULAR_DECORATOR_NAMES.has(expression.text)) {
|
|
17320
17404
|
return expression.text;
|
|
@@ -17400,17 +17484,17 @@ var fail = (reason, detail, location) => ({
|
|
|
17400
17484
|
}
|
|
17401
17485
|
let sourceFile;
|
|
17402
17486
|
try {
|
|
17403
|
-
sourceFile =
|
|
17487
|
+
sourceFile = ts17.createSourceFile(componentFilePath, source, ts17.ScriptTarget.Latest, true, ts17.ScriptKind.TS);
|
|
17404
17488
|
} catch {
|
|
17405
17489
|
return;
|
|
17406
17490
|
}
|
|
17407
17491
|
for (const stmt of sourceFile.statements) {
|
|
17408
|
-
if (!
|
|
17492
|
+
if (!ts17.isClassDeclaration(stmt))
|
|
17409
17493
|
continue;
|
|
17410
17494
|
const className = stmt.name?.text;
|
|
17411
17495
|
if (!className)
|
|
17412
17496
|
continue;
|
|
17413
|
-
const decorators =
|
|
17497
|
+
const decorators = ts17.getDecorators(stmt) ?? [];
|
|
17414
17498
|
const decoratorName = findAngularDecoratorName(decorators);
|
|
17415
17499
|
if (!decoratorName)
|
|
17416
17500
|
continue;
|
|
@@ -17418,17 +17502,17 @@ var fail = (reason, detail, location) => ({
|
|
|
17418
17502
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
17419
17503
|
if (decoratorName === "Component") {
|
|
17420
17504
|
const componentDecorator = decorators.find((d2) => {
|
|
17421
|
-
if (!
|
|
17505
|
+
if (!ts17.isCallExpression(d2.expression))
|
|
17422
17506
|
return false;
|
|
17423
17507
|
const expr = d2.expression.expression;
|
|
17424
|
-
return
|
|
17508
|
+
return ts17.isIdentifier(expr) && expr.text === "Component";
|
|
17425
17509
|
});
|
|
17426
17510
|
if (!componentDecorator)
|
|
17427
17511
|
continue;
|
|
17428
|
-
if (!
|
|
17512
|
+
if (!ts17.isCallExpression(componentDecorator.expression))
|
|
17429
17513
|
continue;
|
|
17430
17514
|
const [args] = componentDecorator.expression.arguments;
|
|
17431
|
-
if (!args || !
|
|
17515
|
+
if (!args || !ts17.isObjectLiteralExpression(args))
|
|
17432
17516
|
continue;
|
|
17433
17517
|
const decoratorMeta = readDecoratorMeta(args);
|
|
17434
17518
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
@@ -17461,11 +17545,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17461
17545
|
return false;
|
|
17462
17546
|
return true;
|
|
17463
17547
|
}, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
|
|
17464
|
-
for (const dec of
|
|
17548
|
+
for (const dec of ts17.getDecorators(cls) ?? []) {
|
|
17465
17549
|
const expr = dec.expression;
|
|
17466
|
-
if (!
|
|
17550
|
+
if (!ts17.isCallExpression(expr))
|
|
17467
17551
|
continue;
|
|
17468
|
-
if (!
|
|
17552
|
+
if (!ts17.isIdentifier(expr.expression))
|
|
17469
17553
|
continue;
|
|
17470
17554
|
if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
|
|
17471
17555
|
return dec;
|
|
@@ -17475,7 +17559,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17475
17559
|
const decorator = findEntityDecorator(cls);
|
|
17476
17560
|
let decoratorArgsText = "";
|
|
17477
17561
|
if (decorator !== null) {
|
|
17478
|
-
if (!
|
|
17562
|
+
if (!ts17.isCallExpression(decorator.expression)) {
|
|
17479
17563
|
return {
|
|
17480
17564
|
arrowFieldSig: extractArrowFieldSig(cls),
|
|
17481
17565
|
className,
|
|
@@ -17493,18 +17577,18 @@ var fail = (reason, detail, location) => ({
|
|
|
17493
17577
|
}
|
|
17494
17578
|
const ctorParamTypes = [];
|
|
17495
17579
|
for (const member of cls.members) {
|
|
17496
|
-
if (!
|
|
17580
|
+
if (!ts17.isConstructorDeclaration(member))
|
|
17497
17581
|
continue;
|
|
17498
17582
|
for (const param of member.parameters) {
|
|
17499
17583
|
const typeText = param.type ? param.type.getText() : "";
|
|
17500
|
-
const decorators =
|
|
17584
|
+
const decorators = ts17.getDecorators(param) ?? [];
|
|
17501
17585
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
17502
17586
|
const e = d2.expression;
|
|
17503
|
-
if (
|
|
17587
|
+
if (ts17.isCallExpression(e) && ts17.isIdentifier(e.expression)) {
|
|
17504
17588
|
const args = e.arguments.map((a) => a.getText()).join(",");
|
|
17505
17589
|
return `@${e.expression.text}(${args})`;
|
|
17506
17590
|
}
|
|
17507
|
-
if (
|
|
17591
|
+
if (ts17.isIdentifier(e))
|
|
17508
17592
|
return `@${e.text}`;
|
|
17509
17593
|
return "@<unknown>";
|
|
17510
17594
|
}).join("");
|
|
@@ -17526,23 +17610,23 @@ var fail = (reason, detail, location) => ({
|
|
|
17526
17610
|
const walk = (node) => {
|
|
17527
17611
|
if (found)
|
|
17528
17612
|
return;
|
|
17529
|
-
if (
|
|
17613
|
+
if (ts17.isClassDeclaration(node) && node.name?.text === className) {
|
|
17530
17614
|
found = node;
|
|
17531
17615
|
return;
|
|
17532
17616
|
}
|
|
17533
|
-
|
|
17617
|
+
ts17.forEachChild(node, walk);
|
|
17534
17618
|
};
|
|
17535
17619
|
walk(sourceFile);
|
|
17536
17620
|
return found;
|
|
17537
17621
|
}, getClassDecorators = (cls) => {
|
|
17538
|
-
const modifiers =
|
|
17622
|
+
const modifiers = ts17.getDecorators(cls) ?? [];
|
|
17539
17623
|
return [...modifiers];
|
|
17540
17624
|
}, findComponentDecorator = (cls) => {
|
|
17541
17625
|
for (const decorator of getClassDecorators(cls)) {
|
|
17542
17626
|
const expr = decorator.expression;
|
|
17543
|
-
if (
|
|
17627
|
+
if (ts17.isCallExpression(expr)) {
|
|
17544
17628
|
const functionNode = expr.expression;
|
|
17545
|
-
if (
|
|
17629
|
+
if (ts17.isIdentifier(functionNode) && functionNode.text === "Component") {
|
|
17546
17630
|
return decorator;
|
|
17547
17631
|
}
|
|
17548
17632
|
}
|
|
@@ -17550,15 +17634,15 @@ var fail = (reason, detail, location) => ({
|
|
|
17550
17634
|
return null;
|
|
17551
17635
|
}, getDecoratorArgsObject = (decorator) => {
|
|
17552
17636
|
const call = decorator.expression;
|
|
17553
|
-
if (!
|
|
17637
|
+
if (!ts17.isCallExpression(call))
|
|
17554
17638
|
return null;
|
|
17555
17639
|
const [arg] = call.arguments;
|
|
17556
|
-
if (!arg || !
|
|
17640
|
+
if (!arg || !ts17.isObjectLiteralExpression(arg))
|
|
17557
17641
|
return null;
|
|
17558
17642
|
return arg;
|
|
17559
17643
|
}, getProperty = (obj, name) => {
|
|
17560
17644
|
for (const prop of obj.properties) {
|
|
17561
|
-
if (
|
|
17645
|
+
if (ts17.isPropertyAssignment(prop) && (ts17.isIdentifier(prop.name) && prop.name.text === name || ts17.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
17562
17646
|
return prop.initializer;
|
|
17563
17647
|
}
|
|
17564
17648
|
}
|
|
@@ -17567,7 +17651,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17567
17651
|
const expr = getProperty(obj, name);
|
|
17568
17652
|
if (!expr)
|
|
17569
17653
|
return null;
|
|
17570
|
-
if (
|
|
17654
|
+
if (ts17.isStringLiteral(expr) || ts17.isNoSubstitutionTemplateLiteral(expr)) {
|
|
17571
17655
|
return expr.text;
|
|
17572
17656
|
}
|
|
17573
17657
|
return null;
|
|
@@ -17575,22 +17659,22 @@ var fail = (reason, detail, location) => ({
|
|
|
17575
17659
|
const expr = getProperty(obj, name);
|
|
17576
17660
|
if (!expr)
|
|
17577
17661
|
return null;
|
|
17578
|
-
if (expr.kind ===
|
|
17662
|
+
if (expr.kind === ts17.SyntaxKind.TrueKeyword)
|
|
17579
17663
|
return true;
|
|
17580
|
-
if (expr.kind ===
|
|
17664
|
+
if (expr.kind === ts17.SyntaxKind.FalseKeyword)
|
|
17581
17665
|
return false;
|
|
17582
17666
|
return null;
|
|
17583
17667
|
}, isAngularDecoratorIdentifier = (name) => name === "Component" || name === "Directive" || name === "Pipe" || name === "Injectable", classHasAngularDecorator = (cls) => {
|
|
17584
|
-
for (const dec of
|
|
17668
|
+
for (const dec of ts17.getDecorators(cls) ?? []) {
|
|
17585
17669
|
const expr = dec.expression;
|
|
17586
|
-
if (
|
|
17670
|
+
if (ts17.isCallExpression(expr) && ts17.isIdentifier(expr.expression) && isAngularDecoratorIdentifier(expr.expression.text)) {
|
|
17587
17671
|
return true;
|
|
17588
17672
|
}
|
|
17589
17673
|
}
|
|
17590
17674
|
return false;
|
|
17591
17675
|
}, findClassInSourceFile = (sourceFile, className) => {
|
|
17592
17676
|
for (const stmt of sourceFile.statements) {
|
|
17593
|
-
if (
|
|
17677
|
+
if (ts17.isClassDeclaration(stmt) && stmt.name?.text === className) {
|
|
17594
17678
|
return stmt;
|
|
17595
17679
|
}
|
|
17596
17680
|
}
|
|
@@ -17600,15 +17684,15 @@ var fail = (reason, detail, location) => ({
|
|
|
17600
17684
|
if (sameFile)
|
|
17601
17685
|
return classHasAngularDecorator(sameFile);
|
|
17602
17686
|
for (const stmt of sourceFile.statements) {
|
|
17603
|
-
if (!
|
|
17687
|
+
if (!ts17.isImportDeclaration(stmt))
|
|
17604
17688
|
continue;
|
|
17605
|
-
if (!
|
|
17689
|
+
if (!ts17.isStringLiteral(stmt.moduleSpecifier))
|
|
17606
17690
|
continue;
|
|
17607
17691
|
const clause = stmt.importClause;
|
|
17608
17692
|
if (!clause || clause.isTypeOnly)
|
|
17609
17693
|
continue;
|
|
17610
17694
|
const named = clause.namedBindings;
|
|
17611
|
-
if (!named || !
|
|
17695
|
+
if (!named || !ts17.isNamedImports(named))
|
|
17612
17696
|
continue;
|
|
17613
17697
|
const found = named.elements.find((element) => element.name.text === parentClassName);
|
|
17614
17698
|
if (!found)
|
|
@@ -17633,7 +17717,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17633
17717
|
} catch {
|
|
17634
17718
|
continue;
|
|
17635
17719
|
}
|
|
17636
|
-
const parentSf =
|
|
17720
|
+
const parentSf = ts17.createSourceFile(candidate, content, ts17.ScriptTarget.Latest, true);
|
|
17637
17721
|
const parentCls = findClassInSourceFile(parentSf, parentClassName);
|
|
17638
17722
|
if (!parentCls)
|
|
17639
17723
|
continue;
|
|
@@ -17645,11 +17729,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17645
17729
|
}, inheritsDecoratedClass = (cls, sourceFile, componentDir, projectRoot) => {
|
|
17646
17730
|
const heritage = cls.heritageClauses ?? [];
|
|
17647
17731
|
for (const clause of heritage) {
|
|
17648
|
-
if (clause.token !==
|
|
17732
|
+
if (clause.token !== ts17.SyntaxKind.ExtendsKeyword)
|
|
17649
17733
|
continue;
|
|
17650
17734
|
for (const typeNode of clause.types) {
|
|
17651
17735
|
const expr = typeNode.expression;
|
|
17652
|
-
if (!
|
|
17736
|
+
if (!ts17.isIdentifier(expr)) {
|
|
17653
17737
|
return true;
|
|
17654
17738
|
}
|
|
17655
17739
|
if (parentHasAngularDecoratorAcrossFiles(expr.text, sourceFile, componentDir, projectRoot)) {
|
|
@@ -17660,18 +17744,18 @@ var fail = (reason, detail, location) => ({
|
|
|
17660
17744
|
return false;
|
|
17661
17745
|
}, CONTROL_CREATE_METHOD_NAME = "\u0275ngControlCreate", extractControlCreate = (cls) => {
|
|
17662
17746
|
for (const member of cls.members) {
|
|
17663
|
-
if (!
|
|
17747
|
+
if (!ts17.isMethodDeclaration(member))
|
|
17664
17748
|
continue;
|
|
17665
|
-
if (member.modifiers?.some((item) => item.kind ===
|
|
17749
|
+
if (member.modifiers?.some((item) => item.kind === ts17.SyntaxKind.StaticKeyword))
|
|
17666
17750
|
continue;
|
|
17667
17751
|
const { name } = member;
|
|
17668
17752
|
if (name === undefined)
|
|
17669
17753
|
continue;
|
|
17670
|
-
const nameText =
|
|
17754
|
+
const nameText = ts17.isIdentifier(name) ? name.text : name.getText();
|
|
17671
17755
|
if (nameText !== CONTROL_CREATE_METHOD_NAME)
|
|
17672
17756
|
continue;
|
|
17673
17757
|
const [firstParam] = member.parameters;
|
|
17674
|
-
if (firstParam === undefined || firstParam.type === undefined || !
|
|
17758
|
+
if (firstParam === undefined || firstParam.type === undefined || !ts17.isTypeReferenceNode(firstParam.type)) {
|
|
17675
17759
|
return { passThroughInput: null };
|
|
17676
17760
|
}
|
|
17677
17761
|
const typeArgs = firstParam.type.typeArguments;
|
|
@@ -17679,16 +17763,16 @@ var fail = (reason, detail, location) => ({
|
|
|
17679
17763
|
return { passThroughInput: null };
|
|
17680
17764
|
}
|
|
17681
17765
|
const [arg] = typeArgs;
|
|
17682
|
-
if (arg === undefined || !
|
|
17766
|
+
if (arg === undefined || !ts17.isLiteralTypeNode(arg) || !ts17.isStringLiteral(arg.literal)) {
|
|
17683
17767
|
return { passThroughInput: null };
|
|
17684
17768
|
}
|
|
17685
17769
|
return { passThroughInput: arg.literal.text };
|
|
17686
17770
|
}
|
|
17687
17771
|
return null;
|
|
17688
17772
|
}, resolveEnumPropertyAccess = (expr, enumName, values) => {
|
|
17689
|
-
if (!
|
|
17773
|
+
if (!ts17.isPropertyAccessExpression(expr))
|
|
17690
17774
|
return null;
|
|
17691
|
-
if (!
|
|
17775
|
+
if (!ts17.isIdentifier(expr.expression))
|
|
17692
17776
|
return null;
|
|
17693
17777
|
if (expr.expression.text !== enumName)
|
|
17694
17778
|
return null;
|
|
@@ -17707,21 +17791,21 @@ var fail = (reason, detail, location) => ({
|
|
|
17707
17791
|
const hostExpr = getProperty(args, "host");
|
|
17708
17792
|
const schemasExpr = getProperty(args, "schemas");
|
|
17709
17793
|
const styleUrls = [];
|
|
17710
|
-
if (styleUrlsExpr &&
|
|
17794
|
+
if (styleUrlsExpr && ts17.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
17711
17795
|
for (const element of styleUrlsExpr.elements) {
|
|
17712
|
-
if (
|
|
17796
|
+
if (ts17.isStringLiteral(element))
|
|
17713
17797
|
styleUrls.push(element.text);
|
|
17714
17798
|
}
|
|
17715
17799
|
}
|
|
17716
17800
|
const styles = [];
|
|
17717
17801
|
if (stylesExpr) {
|
|
17718
|
-
if (
|
|
17802
|
+
if (ts17.isArrayLiteralExpression(stylesExpr)) {
|
|
17719
17803
|
for (const element of stylesExpr.elements) {
|
|
17720
|
-
if (
|
|
17804
|
+
if (ts17.isStringLiteral(element) || ts17.isNoSubstitutionTemplateLiteral(element)) {
|
|
17721
17805
|
styles.push(element.text);
|
|
17722
17806
|
}
|
|
17723
17807
|
}
|
|
17724
|
-
} else if (
|
|
17808
|
+
} else if (ts17.isStringLiteral(stylesExpr) || ts17.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
17725
17809
|
styles.push(stylesExpr.text);
|
|
17726
17810
|
}
|
|
17727
17811
|
}
|
|
@@ -17730,19 +17814,19 @@ var fail = (reason, detail, location) => ({
|
|
|
17730
17814
|
const changeDetectionExpr = getProperty(args, "changeDetection");
|
|
17731
17815
|
const changeDetection = changeDetectionExpr ? resolveEnumPropertyAccess(changeDetectionExpr, "ChangeDetectionStrategy", CHANGE_DETECTION_VALUES) : null;
|
|
17732
17816
|
return {
|
|
17733
|
-
animationsExpr: animationsExpr &&
|
|
17817
|
+
animationsExpr: animationsExpr && ts17.isArrayLiteralExpression(animationsExpr) ? animationsExpr : null,
|
|
17734
17818
|
changeDetection,
|
|
17735
17819
|
encapsulation,
|
|
17736
17820
|
hasProviders: getProperty(args, "providers") !== null,
|
|
17737
17821
|
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
17738
|
-
hostDirectivesExpr: hostDirectivesExpr &&
|
|
17739
|
-
hostExpr: hostExpr &&
|
|
17740
|
-
importsExpr: importsExpr &&
|
|
17741
|
-
inputsArrayExpr: inputsArrayExpr &&
|
|
17742
|
-
outputsArrayExpr: outputsArrayExpr &&
|
|
17822
|
+
hostDirectivesExpr: hostDirectivesExpr && ts17.isArrayLiteralExpression(hostDirectivesExpr) ? hostDirectivesExpr : null,
|
|
17823
|
+
hostExpr: hostExpr && ts17.isObjectLiteralExpression(hostExpr) ? hostExpr : null,
|
|
17824
|
+
importsExpr: importsExpr && ts17.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
17825
|
+
inputsArrayExpr: inputsArrayExpr && ts17.isArrayLiteralExpression(inputsArrayExpr) ? inputsArrayExpr : null,
|
|
17826
|
+
outputsArrayExpr: outputsArrayExpr && ts17.isArrayLiteralExpression(outputsArrayExpr) ? outputsArrayExpr : null,
|
|
17743
17827
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
17744
|
-
providersExpr: providersExpr &&
|
|
17745
|
-
schemasExpr: schemasExpr &&
|
|
17828
|
+
providersExpr: providersExpr && ts17.isArrayLiteralExpression(providersExpr) ? providersExpr : null,
|
|
17829
|
+
schemasExpr: schemasExpr && ts17.isArrayLiteralExpression(schemasExpr) ? schemasExpr : null,
|
|
17746
17830
|
selector: getStringProperty(args, "selector"),
|
|
17747
17831
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
17748
17832
|
styles,
|
|
@@ -17750,16 +17834,16 @@ var fail = (reason, detail, location) => ({
|
|
|
17750
17834
|
styleUrls,
|
|
17751
17835
|
template: getStringProperty(args, "template"),
|
|
17752
17836
|
templateUrl: getStringProperty(args, "templateUrl"),
|
|
17753
|
-
viewProvidersExpr: viewProvidersExpr &&
|
|
17837
|
+
viewProvidersExpr: viewProvidersExpr && ts17.isArrayLiteralExpression(viewProvidersExpr) ? viewProvidersExpr : null
|
|
17754
17838
|
};
|
|
17755
17839
|
}, extractDecoratorInput = (prop, compiler) => {
|
|
17756
|
-
const decorators =
|
|
17840
|
+
const decorators = ts17.getDecorators(prop) ?? [];
|
|
17757
17841
|
for (const decorator of decorators) {
|
|
17758
17842
|
const expr = decorator.expression;
|
|
17759
|
-
if (!
|
|
17843
|
+
if (!ts17.isCallExpression(expr))
|
|
17760
17844
|
continue;
|
|
17761
17845
|
const functionNode = expr.expression;
|
|
17762
|
-
if (!
|
|
17846
|
+
if (!ts17.isIdentifier(functionNode) || functionNode.text !== "Input")
|
|
17763
17847
|
continue;
|
|
17764
17848
|
const classPropertyName = prop.name.getText();
|
|
17765
17849
|
let bindingPropertyName = classPropertyName;
|
|
@@ -17767,9 +17851,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17767
17851
|
let transformFunction = null;
|
|
17768
17852
|
const [arg] = expr.arguments;
|
|
17769
17853
|
if (arg) {
|
|
17770
|
-
if (
|
|
17854
|
+
if (ts17.isStringLiteral(arg)) {
|
|
17771
17855
|
bindingPropertyName = arg.text;
|
|
17772
|
-
} else if (
|
|
17856
|
+
} else if (ts17.isObjectLiteralExpression(arg)) {
|
|
17773
17857
|
const aliasNode = getStringProperty(arg, "alias");
|
|
17774
17858
|
if (aliasNode !== null)
|
|
17775
17859
|
bindingPropertyName = aliasNode;
|
|
@@ -17793,11 +17877,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17793
17877
|
}
|
|
17794
17878
|
return null;
|
|
17795
17879
|
}, isInputSignalCall = (init) => {
|
|
17796
|
-
if (
|
|
17880
|
+
if (ts17.isCallExpression(init)) {
|
|
17797
17881
|
const functionNode = init.expression;
|
|
17798
|
-
if (
|
|
17882
|
+
if (ts17.isIdentifier(functionNode) && functionNode.text === "input")
|
|
17799
17883
|
return true;
|
|
17800
|
-
if (
|
|
17884
|
+
if (ts17.isPropertyAccessExpression(functionNode) && ts17.isIdentifier(functionNode.expression) && functionNode.expression.text === "input") {
|
|
17801
17885
|
return true;
|
|
17802
17886
|
}
|
|
17803
17887
|
}
|
|
@@ -17805,18 +17889,18 @@ var fail = (reason, detail, location) => ({
|
|
|
17805
17889
|
}, extractSignalInput = (prop, compiler) => {
|
|
17806
17890
|
if (!prop.initializer || !isInputSignalCall(prop.initializer))
|
|
17807
17891
|
return null;
|
|
17808
|
-
if (!
|
|
17892
|
+
if (!ts17.isCallExpression(prop.initializer))
|
|
17809
17893
|
return null;
|
|
17810
17894
|
const classPropertyName = prop.name.getText();
|
|
17811
17895
|
const call = prop.initializer;
|
|
17812
17896
|
let required = false;
|
|
17813
|
-
if (
|
|
17897
|
+
if (ts17.isPropertyAccessExpression(call.expression) && ts17.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
17814
17898
|
required = true;
|
|
17815
17899
|
}
|
|
17816
17900
|
let bindingPropertyName = classPropertyName;
|
|
17817
17901
|
let transformFunction = null;
|
|
17818
17902
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
17819
|
-
if (optsArg &&
|
|
17903
|
+
if (optsArg && ts17.isObjectLiteralExpression(optsArg)) {
|
|
17820
17904
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
17821
17905
|
if (aliasNode !== null)
|
|
17822
17906
|
bindingPropertyName = aliasNode;
|
|
@@ -17836,28 +17920,28 @@ var fail = (reason, detail, location) => ({
|
|
|
17836
17920
|
}
|
|
17837
17921
|
};
|
|
17838
17922
|
}, extractDecoratorOutput = (prop) => {
|
|
17839
|
-
const decorators =
|
|
17923
|
+
const decorators = ts17.getDecorators(prop) ?? [];
|
|
17840
17924
|
for (const decorator of decorators) {
|
|
17841
17925
|
const expr = decorator.expression;
|
|
17842
|
-
if (!
|
|
17926
|
+
if (!ts17.isCallExpression(expr))
|
|
17843
17927
|
continue;
|
|
17844
17928
|
const functionNode = expr.expression;
|
|
17845
|
-
if (!
|
|
17929
|
+
if (!ts17.isIdentifier(functionNode) || functionNode.text !== "Output")
|
|
17846
17930
|
continue;
|
|
17847
17931
|
const classPropertyName = prop.name.getText();
|
|
17848
17932
|
let bindingName = classPropertyName;
|
|
17849
17933
|
const [arg] = expr.arguments;
|
|
17850
|
-
if (arg &&
|
|
17934
|
+
if (arg && ts17.isStringLiteral(arg))
|
|
17851
17935
|
bindingName = arg.text;
|
|
17852
17936
|
return { bindingName, classPropertyName };
|
|
17853
17937
|
}
|
|
17854
17938
|
return null;
|
|
17855
17939
|
}, isOutputSignalCall = (init) => {
|
|
17856
|
-
if (
|
|
17940
|
+
if (ts17.isCallExpression(init)) {
|
|
17857
17941
|
const functionNode = init.expression;
|
|
17858
|
-
if (
|
|
17942
|
+
if (ts17.isIdentifier(functionNode) && functionNode.text === "output")
|
|
17859
17943
|
return true;
|
|
17860
|
-
if (
|
|
17944
|
+
if (ts17.isPropertyAccessExpression(functionNode) && ts17.isIdentifier(functionNode.expression) && functionNode.expression.text === "output") {
|
|
17861
17945
|
return true;
|
|
17862
17946
|
}
|
|
17863
17947
|
}
|
|
@@ -17865,13 +17949,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17865
17949
|
}, extractSignalOutput = (prop) => {
|
|
17866
17950
|
if (!prop.initializer || !isOutputSignalCall(prop.initializer))
|
|
17867
17951
|
return null;
|
|
17868
|
-
if (!
|
|
17952
|
+
if (!ts17.isCallExpression(prop.initializer))
|
|
17869
17953
|
return null;
|
|
17870
17954
|
const classPropertyName = prop.name.getText();
|
|
17871
17955
|
const call = prop.initializer;
|
|
17872
17956
|
let bindingName = classPropertyName;
|
|
17873
17957
|
const [optsArg] = call.arguments;
|
|
17874
|
-
if (optsArg &&
|
|
17958
|
+
if (optsArg && ts17.isObjectLiteralExpression(optsArg)) {
|
|
17875
17959
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
17876
17960
|
if (aliasNode !== null)
|
|
17877
17961
|
bindingName = aliasNode;
|
|
@@ -17883,7 +17967,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17883
17967
|
let hasDecoratorIO = false;
|
|
17884
17968
|
let hasSignalIO = false;
|
|
17885
17969
|
for (const member of cls.members) {
|
|
17886
|
-
if (!
|
|
17970
|
+
if (!ts17.isPropertyDeclaration(member))
|
|
17887
17971
|
continue;
|
|
17888
17972
|
const decoratorIn = extractDecoratorInput(member, compiler);
|
|
17889
17973
|
if (decoratorIn) {
|
|
@@ -17917,21 +18001,21 @@ var fail = (reason, detail, location) => ({
|
|
|
17917
18001
|
specialAttributes: {}
|
|
17918
18002
|
}), parseHostObjectInto = (host, args, hostExprNode, compiler) => {
|
|
17919
18003
|
const hostNode = getProperty(args, "host");
|
|
17920
|
-
if (!hostNode || !
|
|
18004
|
+
if (!hostNode || !ts17.isObjectLiteralExpression(hostNode)) {
|
|
17921
18005
|
if (!hostExprNode)
|
|
17922
18006
|
return;
|
|
17923
18007
|
}
|
|
17924
|
-
const obj = hostNode &&
|
|
18008
|
+
const obj = hostNode && ts17.isObjectLiteralExpression(hostNode) ? hostNode : hostExprNode;
|
|
17925
18009
|
if (!obj)
|
|
17926
18010
|
return;
|
|
17927
18011
|
for (const prop of obj.properties) {
|
|
17928
|
-
if (!
|
|
18012
|
+
if (!ts17.isPropertyAssignment(prop))
|
|
17929
18013
|
continue;
|
|
17930
18014
|
const keyNode = prop.name;
|
|
17931
18015
|
let key;
|
|
17932
|
-
if (
|
|
18016
|
+
if (ts17.isStringLiteral(keyNode) || ts17.isNoSubstitutionTemplateLiteral(keyNode)) {
|
|
17933
18017
|
key = keyNode.text;
|
|
17934
|
-
} else if (
|
|
18018
|
+
} else if (ts17.isIdentifier(keyNode)) {
|
|
17935
18019
|
key = keyNode.text;
|
|
17936
18020
|
} else {
|
|
17937
18021
|
continue;
|
|
@@ -17948,39 +18032,39 @@ var fail = (reason, detail, location) => ({
|
|
|
17948
18032
|
}
|
|
17949
18033
|
}, mergeMemberHostDecorators = (host, cls) => {
|
|
17950
18034
|
for (const member of cls.members) {
|
|
17951
|
-
if (!
|
|
18035
|
+
if (!ts17.canHaveDecorators(member))
|
|
17952
18036
|
continue;
|
|
17953
|
-
const decorators =
|
|
18037
|
+
const decorators = ts17.getDecorators(member) ?? [];
|
|
17954
18038
|
for (const dec of decorators) {
|
|
17955
18039
|
const expr = dec.expression;
|
|
17956
|
-
if (!
|
|
18040
|
+
if (!ts17.isCallExpression(expr))
|
|
17957
18041
|
continue;
|
|
17958
18042
|
const functionNode = expr.expression;
|
|
17959
|
-
if (!
|
|
18043
|
+
if (!ts17.isIdentifier(functionNode))
|
|
17960
18044
|
continue;
|
|
17961
18045
|
if (functionNode.text === "HostBinding") {
|
|
17962
|
-
if (!
|
|
18046
|
+
if (!ts17.isPropertyDeclaration(member) && !ts17.isGetAccessor(member))
|
|
17963
18047
|
continue;
|
|
17964
|
-
if (!
|
|
18048
|
+
if (!ts17.isIdentifier(member.name))
|
|
17965
18049
|
continue;
|
|
17966
18050
|
const propertyName2 = member.name.text;
|
|
17967
18051
|
const [target] = expr.arguments;
|
|
17968
|
-
const key = target &&
|
|
18052
|
+
const key = target && ts17.isStringLiteral(target) ? target.text : propertyName2;
|
|
17969
18053
|
host.properties[key] = propertyName2;
|
|
17970
18054
|
} else if (functionNode.text === "HostListener") {
|
|
17971
|
-
if (!
|
|
18055
|
+
if (!ts17.isMethodDeclaration(member))
|
|
17972
18056
|
continue;
|
|
17973
|
-
if (!
|
|
18057
|
+
if (!ts17.isIdentifier(member.name))
|
|
17974
18058
|
continue;
|
|
17975
18059
|
const methodName = member.name.text;
|
|
17976
18060
|
const [eventArg, argsArg] = expr.arguments;
|
|
17977
|
-
if (!eventArg || !
|
|
18061
|
+
if (!eventArg || !ts17.isStringLiteral(eventArg))
|
|
17978
18062
|
continue;
|
|
17979
18063
|
const event = eventArg.text;
|
|
17980
18064
|
const argsList = [];
|
|
17981
|
-
if (argsArg &&
|
|
18065
|
+
if (argsArg && ts17.isArrayLiteralExpression(argsArg)) {
|
|
17982
18066
|
for (const element of argsArg.elements) {
|
|
17983
|
-
if (
|
|
18067
|
+
if (ts17.isStringLiteral(element))
|
|
17984
18068
|
argsList.push(element.text);
|
|
17985
18069
|
}
|
|
17986
18070
|
}
|
|
@@ -17993,14 +18077,14 @@ var fail = (reason, detail, location) => ({
|
|
|
17993
18077
|
let descendants = true;
|
|
17994
18078
|
let emitDistinctChangesOnly = true;
|
|
17995
18079
|
const [, opts] = args;
|
|
17996
|
-
if (opts &&
|
|
18080
|
+
if (opts && ts17.isObjectLiteralExpression(opts)) {
|
|
17997
18081
|
static_ = getBooleanProperty(opts, "static") ?? false;
|
|
17998
18082
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
17999
18083
|
emitDistinctChangesOnly = getBooleanProperty(opts, "emitDistinctChangesOnly") ?? true;
|
|
18000
18084
|
}
|
|
18001
18085
|
return { descendants, emitDistinctChangesOnly, static_ };
|
|
18002
18086
|
}, queryPredicateFromArg = (arg, compiler) => {
|
|
18003
|
-
if (
|
|
18087
|
+
if (ts17.isStringLiteral(arg)) {
|
|
18004
18088
|
return arg.text.split(",").map((item) => item.trim()).filter(Boolean);
|
|
18005
18089
|
}
|
|
18006
18090
|
return {
|
|
@@ -18011,17 +18095,17 @@ var fail = (reason, detail, location) => ({
|
|
|
18011
18095
|
const contentQueries = [];
|
|
18012
18096
|
const viewQueries = [];
|
|
18013
18097
|
for (const member of cls.members) {
|
|
18014
|
-
if (!
|
|
18098
|
+
if (!ts17.isPropertyDeclaration(member))
|
|
18015
18099
|
continue;
|
|
18016
|
-
const decorators =
|
|
18100
|
+
const decorators = ts17.getDecorators(member) ?? [];
|
|
18017
18101
|
for (const dec of decorators) {
|
|
18018
18102
|
const expr = dec.expression;
|
|
18019
|
-
if (!
|
|
18103
|
+
if (!ts17.isCallExpression(expr))
|
|
18020
18104
|
continue;
|
|
18021
18105
|
const functionNode = expr.expression;
|
|
18022
|
-
if (!
|
|
18106
|
+
if (!ts17.isIdentifier(functionNode) || !QUERY_DECORATORS.has(functionNode.text))
|
|
18023
18107
|
continue;
|
|
18024
|
-
if (!
|
|
18108
|
+
if (!ts17.isIdentifier(member.name))
|
|
18025
18109
|
continue;
|
|
18026
18110
|
const propertyName2 = member.name.text;
|
|
18027
18111
|
const [tokenArg, opts] = expr.arguments;
|
|
@@ -18032,7 +18116,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18032
18116
|
continue;
|
|
18033
18117
|
const { static_, descendants, emitDistinctChangesOnly } = parseQueryDecoratorOptions(expr.arguments);
|
|
18034
18118
|
let read = null;
|
|
18035
|
-
if (opts &&
|
|
18119
|
+
if (opts && ts17.isObjectLiteralExpression(opts)) {
|
|
18036
18120
|
const readNode = getProperty(opts, "read");
|
|
18037
18121
|
if (readNode) {
|
|
18038
18122
|
read = new compiler.WrappedNodeExpr(readNode);
|
|
@@ -18060,15 +18144,15 @@ var fail = (reason, detail, location) => ({
|
|
|
18060
18144
|
const contentQueries = [];
|
|
18061
18145
|
const viewQueries = [];
|
|
18062
18146
|
for (const member of cls.members) {
|
|
18063
|
-
if (!
|
|
18147
|
+
if (!ts17.isPropertyDeclaration(member) || !member.initializer)
|
|
18064
18148
|
continue;
|
|
18065
18149
|
const init = member.initializer;
|
|
18066
|
-
if (!
|
|
18150
|
+
if (!ts17.isCallExpression(init))
|
|
18067
18151
|
continue;
|
|
18068
18152
|
let queryName;
|
|
18069
|
-
if (
|
|
18153
|
+
if (ts17.isIdentifier(init.expression)) {
|
|
18070
18154
|
queryName = init.expression.text;
|
|
18071
|
-
} else if (
|
|
18155
|
+
} else if (ts17.isPropertyAccessExpression(init.expression) && ts17.isIdentifier(init.expression.expression) && init.expression.name.text === "required") {
|
|
18072
18156
|
queryName = init.expression.expression.text;
|
|
18073
18157
|
} else {
|
|
18074
18158
|
continue;
|
|
@@ -18076,7 +18160,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18076
18160
|
const runtime = SIGNAL_QUERY_TO_RUNTIME[queryName];
|
|
18077
18161
|
if (!runtime)
|
|
18078
18162
|
continue;
|
|
18079
|
-
if (!
|
|
18163
|
+
if (!ts17.isIdentifier(member.name))
|
|
18080
18164
|
continue;
|
|
18081
18165
|
const propertyName2 = member.name.text;
|
|
18082
18166
|
const [tokenArg, opts] = init.arguments;
|
|
@@ -18087,7 +18171,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18087
18171
|
continue;
|
|
18088
18172
|
let descendants = true;
|
|
18089
18173
|
let read = null;
|
|
18090
|
-
if (opts &&
|
|
18174
|
+
if (opts && ts17.isObjectLiteralExpression(opts)) {
|
|
18091
18175
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
18092
18176
|
const readNode = getProperty(opts, "read");
|
|
18093
18177
|
if (readNode)
|
|
@@ -18113,13 +18197,13 @@ var fail = (reason, detail, location) => ({
|
|
|
18113
18197
|
const node = getProperty(args, "exportAs");
|
|
18114
18198
|
if (!node)
|
|
18115
18199
|
return null;
|
|
18116
|
-
if (
|
|
18200
|
+
if (ts17.isStringLiteral(node)) {
|
|
18117
18201
|
return node.text.split(",").map((item) => item.trim()).filter(Boolean);
|
|
18118
18202
|
}
|
|
18119
|
-
if (
|
|
18203
|
+
if (ts17.isArrayLiteralExpression(node)) {
|
|
18120
18204
|
const out = [];
|
|
18121
18205
|
for (const element of node.elements) {
|
|
18122
|
-
if (
|
|
18206
|
+
if (ts17.isStringLiteral(element))
|
|
18123
18207
|
out.push(element.text);
|
|
18124
18208
|
}
|
|
18125
18209
|
return out.length > 0 ? out : null;
|
|
@@ -18127,11 +18211,11 @@ var fail = (reason, detail, location) => ({
|
|
|
18127
18211
|
return null;
|
|
18128
18212
|
}, extractHostDirectives = (args, compiler) => {
|
|
18129
18213
|
const node = getProperty(args, "hostDirectives");
|
|
18130
|
-
if (!node || !
|
|
18214
|
+
if (!node || !ts17.isArrayLiteralExpression(node))
|
|
18131
18215
|
return null;
|
|
18132
18216
|
const out = [];
|
|
18133
18217
|
for (const element of node.elements) {
|
|
18134
|
-
if (
|
|
18218
|
+
if (ts17.isIdentifier(element)) {
|
|
18135
18219
|
out.push({
|
|
18136
18220
|
directive: {
|
|
18137
18221
|
type: new compiler.WrappedNodeExpr(element),
|
|
@@ -18143,7 +18227,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18143
18227
|
});
|
|
18144
18228
|
continue;
|
|
18145
18229
|
}
|
|
18146
|
-
if (!
|
|
18230
|
+
if (!ts17.isObjectLiteralExpression(element))
|
|
18147
18231
|
continue;
|
|
18148
18232
|
const directiveNode = getProperty(element, "directive");
|
|
18149
18233
|
if (!directiveNode)
|
|
@@ -18151,11 +18235,11 @@ var fail = (reason, detail, location) => ({
|
|
|
18151
18235
|
const inputsNode = getProperty(element, "inputs");
|
|
18152
18236
|
const outputsNode = getProperty(element, "outputs");
|
|
18153
18237
|
const collectMap = (expression) => {
|
|
18154
|
-
if (!expression || !
|
|
18238
|
+
if (!expression || !ts17.isArrayLiteralExpression(expression))
|
|
18155
18239
|
return null;
|
|
18156
18240
|
const map = {};
|
|
18157
18241
|
for (const mappingElement of expression.elements) {
|
|
18158
|
-
if (!
|
|
18242
|
+
if (!ts17.isStringLiteral(mappingElement))
|
|
18159
18243
|
continue;
|
|
18160
18244
|
const [name, alias] = mappingElement.text.split(":").map((segment) => segment.trim());
|
|
18161
18245
|
if (name)
|
|
@@ -18225,10 +18309,10 @@ var fail = (reason, detail, location) => ({
|
|
|
18225
18309
|
});
|
|
18226
18310
|
return null;
|
|
18227
18311
|
}
|
|
18228
|
-
const sourceFile =
|
|
18312
|
+
const sourceFile = ts17.createSourceFile(filePath, source, ts17.ScriptTarget.Latest, true);
|
|
18229
18313
|
let info = null;
|
|
18230
18314
|
for (const stmt of sourceFile.statements) {
|
|
18231
|
-
if (!
|
|
18315
|
+
if (!ts17.isClassDeclaration(stmt))
|
|
18232
18316
|
continue;
|
|
18233
18317
|
if (!stmt.name || stmt.name.text !== className)
|
|
18234
18318
|
continue;
|
|
@@ -18366,9 +18450,9 @@ var fail = (reason, detail, location) => ({
|
|
|
18366
18450
|
}, buildClassToSpecMap = (sourceFile) => {
|
|
18367
18451
|
const result = new Map;
|
|
18368
18452
|
for (const stmt of sourceFile.statements) {
|
|
18369
|
-
if (!
|
|
18453
|
+
if (!ts17.isImportDeclaration(stmt))
|
|
18370
18454
|
continue;
|
|
18371
|
-
if (!
|
|
18455
|
+
if (!ts17.isStringLiteral(stmt.moduleSpecifier))
|
|
18372
18456
|
continue;
|
|
18373
18457
|
const spec = stmt.moduleSpecifier.text;
|
|
18374
18458
|
const clause = stmt.importClause;
|
|
@@ -18377,7 +18461,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18377
18461
|
if (clause.name)
|
|
18378
18462
|
result.set(clause.name.text, spec);
|
|
18379
18463
|
const named = clause.namedBindings;
|
|
18380
|
-
if (named &&
|
|
18464
|
+
if (named && ts17.isNamedImports(named)) {
|
|
18381
18465
|
for (const element of named.elements) {
|
|
18382
18466
|
if (element.isTypeOnly)
|
|
18383
18467
|
continue;
|
|
@@ -18490,7 +18574,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18490
18574
|
return result;
|
|
18491
18575
|
const classToSpec = buildClassToSpecMap(sourceFile);
|
|
18492
18576
|
for (const element of importsExpr.elements) {
|
|
18493
|
-
if (!
|
|
18577
|
+
if (!ts17.isIdentifier(element))
|
|
18494
18578
|
continue;
|
|
18495
18579
|
const className = element.text;
|
|
18496
18580
|
const spec = classToSpec.get(className);
|
|
@@ -18509,35 +18593,35 @@ var fail = (reason, detail, location) => ({
|
|
|
18509
18593
|
}
|
|
18510
18594
|
return (hash >>> 0).toString(36);
|
|
18511
18595
|
}, initializerShapeIsStructural = (node) => {
|
|
18512
|
-
if (
|
|
18596
|
+
if (ts17.isArrowFunction(node) || ts17.isFunctionExpression(node) || ts17.isCallExpression(node) || ts17.isNewExpression(node)) {
|
|
18513
18597
|
return true;
|
|
18514
18598
|
}
|
|
18515
|
-
if (
|
|
18599
|
+
if (ts17.isConditionalExpression(node)) {
|
|
18516
18600
|
return initializerShapeIsStructural(node.whenTrue) || initializerShapeIsStructural(node.whenFalse);
|
|
18517
18601
|
}
|
|
18518
|
-
if (
|
|
18602
|
+
if (ts17.isParenthesizedExpression(node)) {
|
|
18519
18603
|
return initializerShapeIsStructural(node.expression);
|
|
18520
18604
|
}
|
|
18521
|
-
if (
|
|
18605
|
+
if (ts17.isAsExpression(node) || ts17.isTypeAssertionExpression(node)) {
|
|
18522
18606
|
return initializerShapeIsStructural(node.expression);
|
|
18523
18607
|
}
|
|
18524
|
-
if (
|
|
18608
|
+
if (ts17.isNonNullExpression(node)) {
|
|
18525
18609
|
return initializerShapeIsStructural(node.expression);
|
|
18526
18610
|
}
|
|
18527
|
-
if (
|
|
18611
|
+
if (ts17.isObjectLiteralExpression(node)) {
|
|
18528
18612
|
for (const prop of node.properties) {
|
|
18529
|
-
if (
|
|
18613
|
+
if (ts17.isPropertyAssignment(prop) && initializerShapeIsStructural(prop.initializer)) {
|
|
18530
18614
|
return true;
|
|
18531
18615
|
}
|
|
18532
|
-
if (
|
|
18616
|
+
if (ts17.isShorthandPropertyAssignment(prop))
|
|
18533
18617
|
continue;
|
|
18534
|
-
if (
|
|
18618
|
+
if (ts17.isSpreadAssignment(prop) && initializerShapeIsStructural(prop.expression)) {
|
|
18535
18619
|
return true;
|
|
18536
18620
|
}
|
|
18537
18621
|
}
|
|
18538
18622
|
return false;
|
|
18539
18623
|
}
|
|
18540
|
-
if (
|
|
18624
|
+
if (ts17.isArrayLiteralExpression(node)) {
|
|
18541
18625
|
for (const element of node.elements) {
|
|
18542
18626
|
if (initializerShapeIsStructural(element))
|
|
18543
18627
|
return true;
|
|
@@ -18548,7 +18632,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18548
18632
|
}, extractArrowFieldSig = (cls) => {
|
|
18549
18633
|
const entries = [];
|
|
18550
18634
|
for (const member of cls.members) {
|
|
18551
|
-
if (!
|
|
18635
|
+
if (!ts17.isPropertyDeclaration(member))
|
|
18552
18636
|
continue;
|
|
18553
18637
|
const init = member.initializer;
|
|
18554
18638
|
if (!init)
|
|
@@ -18558,12 +18642,12 @@ var fail = (reason, detail, location) => ({
|
|
|
18558
18642
|
const name = member.name.getText();
|
|
18559
18643
|
let bodyText;
|
|
18560
18644
|
try {
|
|
18561
|
-
const printer =
|
|
18562
|
-
newLine:
|
|
18645
|
+
const printer = ts17.createPrinter({
|
|
18646
|
+
newLine: ts17.NewLineKind.LineFeed,
|
|
18563
18647
|
omitTrailingSemicolon: true,
|
|
18564
18648
|
removeComments: true
|
|
18565
18649
|
});
|
|
18566
|
-
bodyText = printer.printNode(
|
|
18650
|
+
bodyText = printer.printNode(ts17.EmitHint.Unspecified, init, cls.getSourceFile());
|
|
18567
18651
|
} catch {
|
|
18568
18652
|
bodyText = init.getText();
|
|
18569
18653
|
}
|
|
@@ -18574,9 +18658,9 @@ var fail = (reason, detail, location) => ({
|
|
|
18574
18658
|
}, INPUT_OUTPUT_DECORATORS, extractMemberDecoratorSig = (cls) => {
|
|
18575
18659
|
const entries = [];
|
|
18576
18660
|
for (const member of cls.members) {
|
|
18577
|
-
if (!
|
|
18661
|
+
if (!ts17.canHaveDecorators(member))
|
|
18578
18662
|
continue;
|
|
18579
|
-
const decorators =
|
|
18663
|
+
const decorators = ts17.getDecorators(member) ?? [];
|
|
18580
18664
|
if (decorators.length === 0)
|
|
18581
18665
|
continue;
|
|
18582
18666
|
const memberName = member.name?.getText() ?? "<anon>";
|
|
@@ -18584,14 +18668,14 @@ var fail = (reason, detail, location) => ({
|
|
|
18584
18668
|
const expr = decorator.expression;
|
|
18585
18669
|
let decName = "<unknown>";
|
|
18586
18670
|
let argText = "";
|
|
18587
|
-
if (
|
|
18588
|
-
if (
|
|
18671
|
+
if (ts17.isCallExpression(expr)) {
|
|
18672
|
+
if (ts17.isIdentifier(expr.expression)) {
|
|
18589
18673
|
decName = expr.expression.text;
|
|
18590
18674
|
}
|
|
18591
18675
|
if (expr.arguments.length > 0) {
|
|
18592
18676
|
argText = expr.arguments.map((leftValue) => leftValue.getText()).join(",");
|
|
18593
18677
|
}
|
|
18594
|
-
} else if (
|
|
18678
|
+
} else if (ts17.isIdentifier(expr)) {
|
|
18595
18679
|
decName = expr.text;
|
|
18596
18680
|
}
|
|
18597
18681
|
if (INPUT_OUTPUT_DECORATORS.has(decName))
|
|
@@ -18616,18 +18700,18 @@ var fail = (reason, detail, location) => ({
|
|
|
18616
18700
|
} catch {
|
|
18617
18701
|
return true;
|
|
18618
18702
|
}
|
|
18619
|
-
const sourceFile =
|
|
18703
|
+
const sourceFile = ts17.createSourceFile(filePath, source, ts17.ScriptTarget.ES2022, true, ts17.ScriptKind.TS);
|
|
18620
18704
|
let hasProviders = false;
|
|
18621
18705
|
const visit = (node) => {
|
|
18622
18706
|
if (hasProviders)
|
|
18623
18707
|
return;
|
|
18624
|
-
if (
|
|
18625
|
-
for (const decorator of
|
|
18708
|
+
if (ts17.isClassDeclaration(node)) {
|
|
18709
|
+
for (const decorator of ts17.getDecorators(node) ?? []) {
|
|
18626
18710
|
const expr = decorator.expression;
|
|
18627
|
-
if (!
|
|
18711
|
+
if (!ts17.isCallExpression(expr))
|
|
18628
18712
|
continue;
|
|
18629
18713
|
const [arg] = expr.arguments;
|
|
18630
|
-
if (!arg || !
|
|
18714
|
+
if (!arg || !ts17.isObjectLiteralExpression(arg))
|
|
18631
18715
|
continue;
|
|
18632
18716
|
if (getProperty(arg, "providers") !== null) {
|
|
18633
18717
|
hasProviders = true;
|
|
@@ -18635,7 +18719,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18635
18719
|
}
|
|
18636
18720
|
}
|
|
18637
18721
|
}
|
|
18638
|
-
|
|
18722
|
+
ts17.forEachChild(node, visit);
|
|
18639
18723
|
};
|
|
18640
18724
|
visit(sourceFile);
|
|
18641
18725
|
providerProbeCache.set(filePath, {
|
|
@@ -18645,10 +18729,10 @@ var fail = (reason, detail, location) => ({
|
|
|
18645
18729
|
return hasProviders;
|
|
18646
18730
|
}, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
|
|
18647
18731
|
for (const stmt of sourceFile.statements) {
|
|
18648
|
-
if (!
|
|
18732
|
+
if (!ts17.isImportDeclaration(stmt))
|
|
18649
18733
|
continue;
|
|
18650
18734
|
const moduleSpec = stmt.moduleSpecifier;
|
|
18651
|
-
if (!
|
|
18735
|
+
if (!ts17.isStringLiteral(moduleSpec))
|
|
18652
18736
|
continue;
|
|
18653
18737
|
const spec = moduleSpec.text;
|
|
18654
18738
|
if (!spec.startsWith(".") && !spec.startsWith("/"))
|
|
@@ -18662,7 +18746,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18662
18746
|
}
|
|
18663
18747
|
if (importClause.namedBindings) {
|
|
18664
18748
|
const item = importClause.namedBindings;
|
|
18665
|
-
if (
|
|
18749
|
+
if (ts17.isNamespaceImport(item)) {
|
|
18666
18750
|
if (item.name.text === identifierName)
|
|
18667
18751
|
matches = true;
|
|
18668
18752
|
} else {
|
|
@@ -18692,7 +18776,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18692
18776
|
return [];
|
|
18693
18777
|
const sig = [];
|
|
18694
18778
|
for (const entry of importsExpr.elements) {
|
|
18695
|
-
if (
|
|
18779
|
+
if (ts17.isIdentifier(entry)) {
|
|
18696
18780
|
const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
|
|
18697
18781
|
if (importPath) {
|
|
18698
18782
|
if (fileHasModuleProviders(importPath)) {
|
|
@@ -18709,14 +18793,14 @@ var fail = (reason, detail, location) => ({
|
|
|
18709
18793
|
}
|
|
18710
18794
|
return sig.sort();
|
|
18711
18795
|
}, getPropertyNameText = (name) => {
|
|
18712
|
-
if (
|
|
18796
|
+
if (ts17.isIdentifier(name) || ts17.isStringLiteral(name) || ts17.isNoSubstitutionTemplateLiteral(name)) {
|
|
18713
18797
|
return name.text;
|
|
18714
18798
|
}
|
|
18715
18799
|
return name.getText();
|
|
18716
18800
|
}, extractPropertyFieldNames = (cls) => {
|
|
18717
18801
|
const names = [];
|
|
18718
18802
|
for (const member of cls.members) {
|
|
18719
|
-
if (!
|
|
18803
|
+
if (!ts17.isPropertyDeclaration(member) && !ts17.isMethodDeclaration(member) && !ts17.isGetAccessorDeclaration(member) && !ts17.isSetAccessorDeclaration(member)) {
|
|
18720
18804
|
continue;
|
|
18721
18805
|
}
|
|
18722
18806
|
const { name } = member;
|
|
@@ -18730,7 +18814,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18730
18814
|
}, extractTopLevelImports = (sourceFile) => {
|
|
18731
18815
|
const names = new Set;
|
|
18732
18816
|
for (const stmt of sourceFile.statements) {
|
|
18733
|
-
if (!
|
|
18817
|
+
if (!ts17.isImportDeclaration(stmt))
|
|
18734
18818
|
continue;
|
|
18735
18819
|
const clause = stmt.importClause;
|
|
18736
18820
|
if (!clause)
|
|
@@ -18742,9 +18826,9 @@ var fail = (reason, detail, location) => ({
|
|
|
18742
18826
|
const bindings = clause.namedBindings;
|
|
18743
18827
|
if (!bindings)
|
|
18744
18828
|
continue;
|
|
18745
|
-
if (
|
|
18829
|
+
if (ts17.isNamespaceImport(bindings)) {
|
|
18746
18830
|
names.add(bindings.name.text);
|
|
18747
|
-
} else if (
|
|
18831
|
+
} else if (ts17.isNamedImports(bindings)) {
|
|
18748
18832
|
for (const element of bindings.elements) {
|
|
18749
18833
|
if (element.isTypeOnly)
|
|
18750
18834
|
continue;
|
|
@@ -18756,18 +18840,18 @@ var fail = (reason, detail, location) => ({
|
|
|
18756
18840
|
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
|
|
18757
18841
|
const ctorParamTypes = [];
|
|
18758
18842
|
for (const member of cls.members) {
|
|
18759
|
-
if (!
|
|
18843
|
+
if (!ts17.isConstructorDeclaration(member))
|
|
18760
18844
|
continue;
|
|
18761
18845
|
for (const param of member.parameters) {
|
|
18762
18846
|
const typeText = param.type ? param.type.getText() : "";
|
|
18763
|
-
const decorators =
|
|
18847
|
+
const decorators = ts17.getDecorators(param) ?? [];
|
|
18764
18848
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
18765
18849
|
const expr = d2.expression;
|
|
18766
|
-
if (
|
|
18850
|
+
if (ts17.isCallExpression(expr) && ts17.isIdentifier(expr.expression)) {
|
|
18767
18851
|
const args = expr.arguments.map((a) => a.getText()).join(",");
|
|
18768
18852
|
return `@${expr.expression.text}(${args})`;
|
|
18769
18853
|
}
|
|
18770
|
-
if (
|
|
18854
|
+
if (ts17.isIdentifier(expr)) {
|
|
18771
18855
|
return `@${expr.text}`;
|
|
18772
18856
|
}
|
|
18773
18857
|
return "@<unknown>";
|
|
@@ -18783,12 +18867,12 @@ var fail = (reason, detail, location) => ({
|
|
|
18783
18867
|
const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
|
|
18784
18868
|
const topLevelImports = extractTopLevelImports(sourceFile);
|
|
18785
18869
|
const propertyFieldNames = extractPropertyFieldNames(cls);
|
|
18786
|
-
const printer =
|
|
18787
|
-
newLine:
|
|
18870
|
+
const printer = ts17.createPrinter({
|
|
18871
|
+
newLine: ts17.NewLineKind.LineFeed,
|
|
18788
18872
|
omitTrailingSemicolon: true,
|
|
18789
18873
|
removeComments: true
|
|
18790
18874
|
});
|
|
18791
|
-
const canonicalText = (node) => printer.printNode(
|
|
18875
|
+
const canonicalText = (node) => printer.printNode(ts17.EmitHint.Unspecified, node, sourceFile);
|
|
18792
18876
|
const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
|
|
18793
18877
|
const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
|
|
18794
18878
|
const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
|
|
@@ -18801,13 +18885,13 @@ var fail = (reason, detail, location) => ({
|
|
|
18801
18885
|
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
18802
18886
|
const pageExportEntries = [];
|
|
18803
18887
|
for (const stmt of sourceFile.statements) {
|
|
18804
|
-
if (!
|
|
18888
|
+
if (!ts17.isVariableStatement(stmt))
|
|
18805
18889
|
continue;
|
|
18806
|
-
const isExported = stmt.modifiers?.some((item) => item.kind ===
|
|
18890
|
+
const isExported = stmt.modifiers?.some((item) => item.kind === ts17.SyntaxKind.ExportKeyword);
|
|
18807
18891
|
if (!isExported)
|
|
18808
18892
|
continue;
|
|
18809
18893
|
for (const decl of stmt.declarationList.declarations) {
|
|
18810
|
-
if (!
|
|
18894
|
+
if (!ts17.isIdentifier(decl.name))
|
|
18811
18895
|
continue;
|
|
18812
18896
|
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
18813
18897
|
continue;
|
|
@@ -18848,35 +18932,35 @@ var fail = (reason, detail, location) => ({
|
|
|
18848
18932
|
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
18849
18933
|
const memberSources = [];
|
|
18850
18934
|
let hasStatic = false;
|
|
18851
|
-
const printer =
|
|
18935
|
+
const printer = ts17.createPrinter({ removeComments: true });
|
|
18852
18936
|
for (const member of classNode.members) {
|
|
18853
|
-
if (
|
|
18854
|
-
const modifiers = (
|
|
18855
|
-
const cleaned =
|
|
18856
|
-
memberSources.push(printer.printNode(
|
|
18937
|
+
if (ts17.isPropertyDeclaration(member)) {
|
|
18938
|
+
const modifiers = (ts17.getModifiers(member) ?? []).filter((m) => m.kind !== ts17.SyntaxKind.PrivateKeyword && m.kind !== ts17.SyntaxKind.PublicKeyword && m.kind !== ts17.SyntaxKind.ProtectedKeyword && m.kind !== ts17.SyntaxKind.ReadonlyKeyword && m.kind !== ts17.SyntaxKind.OverrideKeyword);
|
|
18939
|
+
const cleaned = ts17.factory.createPropertyDeclaration(modifiers, member.name, undefined, undefined, member.initializer);
|
|
18940
|
+
memberSources.push(printer.printNode(ts17.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
18857
18941
|
continue;
|
|
18858
18942
|
}
|
|
18859
|
-
if (
|
|
18860
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
18861
|
-
const cleaned =
|
|
18862
|
-
memberSources.push(printer.printNode(
|
|
18943
|
+
if (ts17.isConstructorDeclaration(member)) {
|
|
18944
|
+
const cleanedParams = member.parameters.map((param) => ts17.factory.updateParameterDeclaration(param, (ts17.getModifiers(param) ?? []).filter((item) => item.kind !== ts17.SyntaxKind.PrivateKeyword && item.kind !== ts17.SyntaxKind.PublicKeyword && item.kind !== ts17.SyntaxKind.ProtectedKeyword && item.kind !== ts17.SyntaxKind.ReadonlyKeyword && item.kind !== ts17.SyntaxKind.OverrideKeyword), param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
18945
|
+
const cleaned = ts17.factory.createConstructorDeclaration([], cleanedParams, member.body);
|
|
18946
|
+
memberSources.push(printer.printNode(ts17.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
18863
18947
|
continue;
|
|
18864
18948
|
}
|
|
18865
|
-
if (
|
|
18866
|
-
const modifiers =
|
|
18867
|
-
const isStatic = modifiers.some((m) => m.kind ===
|
|
18949
|
+
if (ts17.isMethodDeclaration(member) || ts17.isGetAccessorDeclaration(member) || ts17.isSetAccessorDeclaration(member)) {
|
|
18950
|
+
const modifiers = ts17.getModifiers(member) ?? [];
|
|
18951
|
+
const isStatic = modifiers.some((m) => m.kind === ts17.SyntaxKind.StaticKeyword);
|
|
18868
18952
|
if (isStatic)
|
|
18869
18953
|
hasStatic = true;
|
|
18870
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
18954
|
+
const cleanedParams = member.parameters.map((param) => ts17.factory.updateParameterDeclaration(param, ts17.getModifiers(param) ?? [], param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
18871
18955
|
let cleaned;
|
|
18872
|
-
if (
|
|
18873
|
-
cleaned =
|
|
18874
|
-
} else if (
|
|
18875
|
-
cleaned =
|
|
18956
|
+
if (ts17.isMethodDeclaration(member)) {
|
|
18957
|
+
cleaned = ts17.factory.createMethodDeclaration(modifiers, member.asteriskToken, member.name, member.questionToken, member.typeParameters, cleanedParams, member.type, member.body);
|
|
18958
|
+
} else if (ts17.isGetAccessorDeclaration(member)) {
|
|
18959
|
+
cleaned = ts17.factory.createGetAccessorDeclaration(modifiers, member.name, cleanedParams, member.type, member.body);
|
|
18876
18960
|
} else {
|
|
18877
|
-
cleaned =
|
|
18961
|
+
cleaned = ts17.factory.createSetAccessorDeclaration(modifiers, member.name, cleanedParams, member.body);
|
|
18878
18962
|
}
|
|
18879
|
-
const printed = printer.printNode(
|
|
18963
|
+
const printed = printer.printNode(ts17.EmitHint.Unspecified, cleaned, classNode.getSourceFile());
|
|
18880
18964
|
memberSources.push(printed);
|
|
18881
18965
|
}
|
|
18882
18966
|
}
|
|
@@ -18888,10 +18972,10 @@ ${memberSources.join(`
|
|
|
18888
18972
|
}`;
|
|
18889
18973
|
let transpiled;
|
|
18890
18974
|
try {
|
|
18891
|
-
transpiled =
|
|
18975
|
+
transpiled = ts17.transpileModule(wrappedSource, {
|
|
18892
18976
|
compilerOptions: {
|
|
18893
|
-
module:
|
|
18894
|
-
target:
|
|
18977
|
+
module: ts17.ModuleKind.ES2022,
|
|
18978
|
+
target: ts17.ScriptTarget.ES2022
|
|
18895
18979
|
},
|
|
18896
18980
|
reportDiagnostics: false
|
|
18897
18981
|
}).outputText;
|
|
@@ -18923,7 +19007,7 @@ ${transpiled}
|
|
|
18923
19007
|
const abs = resolve23(componentDir, url);
|
|
18924
19008
|
if (!existsSync24(abs))
|
|
18925
19009
|
return null;
|
|
18926
|
-
const ext =
|
|
19010
|
+
const ext = extname8(abs).toLowerCase();
|
|
18927
19011
|
if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
|
|
18928
19012
|
return readFileSync20(abs, "utf8");
|
|
18929
19013
|
}
|
|
@@ -18964,7 +19048,7 @@ ${block}
|
|
|
18964
19048
|
if (existsSync24(tsconfigPath)) {
|
|
18965
19049
|
try {
|
|
18966
19050
|
const text = readFileSync20(tsconfigPath, "utf8");
|
|
18967
|
-
const parsed =
|
|
19051
|
+
const parsed = ts17.parseConfigFileTextToJson(tsconfigPath, text);
|
|
18968
19052
|
if (!parsed.error && parsed.config) {
|
|
18969
19053
|
const cfg = parsed.config;
|
|
18970
19054
|
const ang = cfg.angularCompilerOptions ?? {};
|
|
@@ -18998,7 +19082,7 @@ ${block}
|
|
|
18998
19082
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
18999
19083
|
}
|
|
19000
19084
|
const tsSource = readFileSync20(componentFilePath, "utf8");
|
|
19001
|
-
const sourceFile =
|
|
19085
|
+
const sourceFile = ts17.createSourceFile(componentFilePath, tsSource, ts17.ScriptTarget.ES2022, true, ts17.ScriptKind.TS);
|
|
19002
19086
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
19003
19087
|
if (!classNode) {
|
|
19004
19088
|
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -19125,7 +19209,7 @@ ${block}
|
|
|
19125
19209
|
isSignal: (hasSignalIO || advancedMetadata.contentQueries.some((item) => item.isSignal) || advancedMetadata.viewQueries.some((item) => item.isSignal)) && !hasDecoratorIO && !advancedMetadata.contentQueries.some((item) => !item.isSignal) && !advancedMetadata.viewQueries.some((item) => !item.isSignal),
|
|
19126
19210
|
isStandalone: decoratorMeta.standalone,
|
|
19127
19211
|
lifecycle: {
|
|
19128
|
-
usesOnChanges: classNode.members.some((m) =>
|
|
19212
|
+
usesOnChanges: classNode.members.some((m) => ts17.isMethodDeclaration(m) && m.name !== undefined && ts17.isIdentifier(m.name) && m.name.text === "ngOnChanges")
|
|
19129
19213
|
},
|
|
19130
19214
|
name: className,
|
|
19131
19215
|
outputs,
|
|
@@ -19174,18 +19258,18 @@ ${block}
|
|
|
19174
19258
|
}
|
|
19175
19259
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
19176
19260
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
19177
|
-
if (!
|
|
19261
|
+
if (!ts17.isFunctionDeclaration(tsFunctionDecl)) {
|
|
19178
19262
|
return fail("unexpected-error", "Angular HMR callback did not translate to a function declaration");
|
|
19179
19263
|
}
|
|
19180
|
-
const exportedDecl =
|
|
19181
|
-
|
|
19182
|
-
|
|
19264
|
+
const exportedDecl = ts17.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
19265
|
+
ts17.factory.createToken(ts17.SyntaxKind.ExportKeyword),
|
|
19266
|
+
ts17.factory.createToken(ts17.SyntaxKind.DefaultKeyword)
|
|
19183
19267
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
19184
|
-
const printer =
|
|
19185
|
-
newLine:
|
|
19268
|
+
const printer = ts17.createPrinter({
|
|
19269
|
+
newLine: ts17.NewLineKind.LineFeed,
|
|
19186
19270
|
removeComments: false
|
|
19187
19271
|
});
|
|
19188
|
-
const fnText = printer.printNode(
|
|
19272
|
+
const fnText = printer.printNode(ts17.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
19189
19273
|
const provisionalMethodsBlock = buildFreshClassMethodsBlock(classNode, className) ?? "";
|
|
19190
19274
|
const referencedNames = new Set;
|
|
19191
19275
|
const identRe = /[A-Za-z_$][A-Za-z0-9_$]*/g;
|
|
@@ -19195,32 +19279,32 @@ ${block}
|
|
|
19195
19279
|
}
|
|
19196
19280
|
const sourceScopeNames = new Set;
|
|
19197
19281
|
for (const stmt of sourceFile.statements) {
|
|
19198
|
-
if (
|
|
19199
|
-
if (!
|
|
19282
|
+
if (ts17.isImportDeclaration(stmt)) {
|
|
19283
|
+
if (!ts17.isStringLiteral(stmt.moduleSpecifier))
|
|
19200
19284
|
continue;
|
|
19201
19285
|
const clause = stmt.importClause;
|
|
19202
19286
|
if (clause?.name)
|
|
19203
19287
|
sourceScopeNames.add(clause.name.text);
|
|
19204
|
-
if (clause?.namedBindings &&
|
|
19288
|
+
if (clause?.namedBindings && ts17.isNamedImports(clause.namedBindings)) {
|
|
19205
19289
|
for (const element of clause.namedBindings.elements) {
|
|
19206
19290
|
if (element.isTypeOnly)
|
|
19207
19291
|
continue;
|
|
19208
19292
|
sourceScopeNames.add(element.name.text);
|
|
19209
19293
|
}
|
|
19210
|
-
} else if (clause?.namedBindings &&
|
|
19294
|
+
} else if (clause?.namedBindings && ts17.isNamespaceImport(clause.namedBindings)) {
|
|
19211
19295
|
sourceScopeNames.add(clause.namedBindings.name.text);
|
|
19212
19296
|
}
|
|
19213
19297
|
continue;
|
|
19214
19298
|
}
|
|
19215
|
-
if (
|
|
19299
|
+
if (ts17.isVariableStatement(stmt)) {
|
|
19216
19300
|
for (const decl of stmt.declarationList.declarations) {
|
|
19217
|
-
if (
|
|
19301
|
+
if (ts17.isIdentifier(decl.name)) {
|
|
19218
19302
|
sourceScopeNames.add(decl.name.text);
|
|
19219
19303
|
}
|
|
19220
19304
|
}
|
|
19221
19305
|
continue;
|
|
19222
19306
|
}
|
|
19223
|
-
if (
|
|
19307
|
+
if (ts17.isFunctionDeclaration(stmt) || ts17.isClassDeclaration(stmt)) {
|
|
19224
19308
|
if (stmt.name)
|
|
19225
19309
|
sourceScopeNames.add(stmt.name.text);
|
|
19226
19310
|
}
|
|
@@ -19231,7 +19315,7 @@ ${block}
|
|
|
19231
19315
|
}
|
|
19232
19316
|
const allImportedNames = new Set;
|
|
19233
19317
|
for (const stmt of sourceFile.statements) {
|
|
19234
|
-
if (!
|
|
19318
|
+
if (!ts17.isImportDeclaration(stmt))
|
|
19235
19319
|
continue;
|
|
19236
19320
|
const clause = stmt.importClause;
|
|
19237
19321
|
if (!clause || clause.isTypeOnly)
|
|
@@ -19241,7 +19325,7 @@ ${block}
|
|
|
19241
19325
|
const bindings = clause.namedBindings;
|
|
19242
19326
|
if (!bindings)
|
|
19243
19327
|
continue;
|
|
19244
|
-
if (
|
|
19328
|
+
if (ts17.isNamespaceImport(bindings)) {
|
|
19245
19329
|
allImportedNames.add(bindings.name.text);
|
|
19246
19330
|
} else {
|
|
19247
19331
|
for (const element of bindings.elements) {
|
|
@@ -19253,10 +19337,10 @@ ${block}
|
|
|
19253
19337
|
}
|
|
19254
19338
|
const depsToDestructure = [...sourceScopeNames].filter((n) => referencedNames.has(n) || allImportedNames.has(n));
|
|
19255
19339
|
const tsSourceText = fnText;
|
|
19256
|
-
const transpiled =
|
|
19340
|
+
const transpiled = ts17.transpileModule(tsSourceText, {
|
|
19257
19341
|
compilerOptions: {
|
|
19258
|
-
module:
|
|
19259
|
-
target:
|
|
19342
|
+
module: ts17.ModuleKind.ES2022,
|
|
19343
|
+
target: ts17.ScriptTarget.ES2022
|
|
19260
19344
|
},
|
|
19261
19345
|
fileName: componentFilePath,
|
|
19262
19346
|
reportDiagnostics: false
|
|
@@ -19815,7 +19899,7 @@ __export(exports_compileEmber, {
|
|
|
19815
19899
|
});
|
|
19816
19900
|
import { existsSync as existsSync25 } from "fs";
|
|
19817
19901
|
import { mkdir as mkdir7, rm as rm4 } from "fs/promises";
|
|
19818
|
-
import { basename as basename13, dirname as dirname18, extname as
|
|
19902
|
+
import { basename as basename13, dirname as dirname18, extname as extname9, join as join31, resolve as resolve24 } from "path";
|
|
19819
19903
|
var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file3 } = globalThis.Bun;
|
|
19820
19904
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
19821
19905
|
if (cachedPreprocessor)
|
|
@@ -19824,7 +19908,7 @@ var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
|
19824
19908
|
cachedPreprocessor = new module.Preprocessor;
|
|
19825
19909
|
return cachedPreprocessor;
|
|
19826
19910
|
}, transpiler5, isTemplateTagFile = (entry) => {
|
|
19827
|
-
const ext =
|
|
19911
|
+
const ext = extname9(entry);
|
|
19828
19912
|
return ext === ".gjs" || ext === ".gts";
|
|
19829
19913
|
}, rewriteTemplateEvalToScope = (source) => {
|
|
19830
19914
|
const importedNames = new Set;
|
|
@@ -20550,7 +20634,7 @@ import {
|
|
|
20550
20634
|
statSync as statSync3,
|
|
20551
20635
|
writeFileSync as writeFileSync8
|
|
20552
20636
|
} from "fs";
|
|
20553
|
-
import { basename as basename14, dirname as dirname19, extname as
|
|
20637
|
+
import { basename as basename14, dirname as dirname19, extname as extname10, join as join36, relative as relative15, resolve as resolve26 } from "path";
|
|
20554
20638
|
import { cwd, env as env2, exit } from "process";
|
|
20555
20639
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
20556
20640
|
var isDev2, isBuildTraceEnabled = () => {
|
|
@@ -21540,7 +21624,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
21540
21624
|
minify: !isDev2,
|
|
21541
21625
|
naming: `${idx}-[name].[ext]`,
|
|
21542
21626
|
outdir: destDir,
|
|
21543
|
-
plugins: [
|
|
21627
|
+
plugins: [
|
|
21628
|
+
stylePreprocessorPlugin2,
|
|
21629
|
+
createBunStringRawUnicodePlugin()
|
|
21630
|
+
],
|
|
21544
21631
|
root: dirname19(source),
|
|
21545
21632
|
target: "bun",
|
|
21546
21633
|
throw: false,
|
|
@@ -21580,6 +21667,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
21580
21667
|
minify: !isDev2,
|
|
21581
21668
|
naming: `${idx}-${name}.[ext]`,
|
|
21582
21669
|
outdir: destDir,
|
|
21670
|
+
plugins: [createBunStringRawUnicodePlugin()],
|
|
21583
21671
|
splitting: false,
|
|
21584
21672
|
target: "bun",
|
|
21585
21673
|
throw: false
|
|
@@ -21822,7 +21910,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
21822
21910
|
...islandRegistryPlugins,
|
|
21823
21911
|
...serverOutDir ? [
|
|
21824
21912
|
createExternalAssetPlugin(serverOutDir, allFrameworkDirs)
|
|
21825
|
-
] : []
|
|
21913
|
+
] : [],
|
|
21914
|
+
createBunStringRawUnicodePlugin()
|
|
21826
21915
|
],
|
|
21827
21916
|
root: serverRoot,
|
|
21828
21917
|
sourcemap: isDev2 ? "inline" : "none",
|
|
@@ -22074,7 +22163,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22074
22163
|
], buildPath)
|
|
22075
22164
|
};
|
|
22076
22165
|
for (const artifact of serverOutputs) {
|
|
22077
|
-
if (
|
|
22166
|
+
if (extname10(artifact.path) !== ".js")
|
|
22078
22167
|
continue;
|
|
22079
22168
|
const fileWithHash = basename14(artifact.path);
|
|
22080
22169
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
@@ -22094,7 +22183,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22094
22183
|
};
|
|
22095
22184
|
const cssByName = new Map;
|
|
22096
22185
|
for (const artifact of cssOutputs) {
|
|
22097
|
-
if (
|
|
22186
|
+
if (extname10(artifact.path) !== ".css")
|
|
22098
22187
|
continue;
|
|
22099
22188
|
const cssName = stripHash(basename14(artifact.path), artifact.hash);
|
|
22100
22189
|
if (cssName)
|
|
@@ -22104,7 +22193,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22104
22193
|
const siblingCssPaths = [];
|
|
22105
22194
|
const serverJsByPascalName = new Map;
|
|
22106
22195
|
await Promise.all(serverOutputs.map(async (artifact) => {
|
|
22107
|
-
if (
|
|
22196
|
+
if (extname10(artifact.path) !== ".js")
|
|
22108
22197
|
return;
|
|
22109
22198
|
const pascalName = stripHash(basename14(artifact.path), artifact.hash);
|
|
22110
22199
|
if (!pascalName)
|
|
@@ -22343,6 +22432,7 @@ var init_build = __esm(() => {
|
|
|
22343
22432
|
init_maskLiterals();
|
|
22344
22433
|
init_telemetryEvent();
|
|
22345
22434
|
init_angularLinkerPlugin();
|
|
22435
|
+
init_bunStringRawUnicodePlugin();
|
|
22346
22436
|
init_externalAssetPlugin();
|
|
22347
22437
|
init_islandRegistryTransform();
|
|
22348
22438
|
init_hmrInjectionPlugin();
|
|
@@ -23897,8 +23987,8 @@ __export(exports_resolveOwningComponents, {
|
|
|
23897
23987
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
23898
23988
|
});
|
|
23899
23989
|
import { readdirSync as readdirSync8, readFileSync as readFileSync26, statSync as statSync5 } from "fs";
|
|
23900
|
-
import { dirname as dirname24, extname as
|
|
23901
|
-
import
|
|
23990
|
+
import { dirname as dirname24, extname as extname11, join as join39, resolve as resolve36 } from "path";
|
|
23991
|
+
import ts18 from "typescript";
|
|
23902
23992
|
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
23903
23993
|
const out = [];
|
|
23904
23994
|
const visit = (dir) => {
|
|
@@ -23924,13 +24014,13 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
23924
24014
|
return out;
|
|
23925
24015
|
}, getStringPropertyValue = (obj, name) => {
|
|
23926
24016
|
for (const prop of obj.properties) {
|
|
23927
|
-
if (!
|
|
24017
|
+
if (!ts18.isPropertyAssignment(prop))
|
|
23928
24018
|
continue;
|
|
23929
|
-
const propName =
|
|
24019
|
+
const propName = ts18.isIdentifier(prop.name) || ts18.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
23930
24020
|
if (propName !== name)
|
|
23931
24021
|
continue;
|
|
23932
24022
|
const init = prop.initializer;
|
|
23933
|
-
if (
|
|
24023
|
+
if (ts18.isStringLiteral(init) || ts18.isNoSubstitutionTemplateLiteral(init)) {
|
|
23934
24024
|
return init.text;
|
|
23935
24025
|
}
|
|
23936
24026
|
}
|
|
@@ -23938,16 +24028,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
23938
24028
|
}, getStringArrayProperty = (obj, name) => {
|
|
23939
24029
|
const out = [];
|
|
23940
24030
|
for (const prop of obj.properties) {
|
|
23941
|
-
if (!
|
|
24031
|
+
if (!ts18.isPropertyAssignment(prop))
|
|
23942
24032
|
continue;
|
|
23943
|
-
const propName =
|
|
24033
|
+
const propName = ts18.isIdentifier(prop.name) || ts18.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
23944
24034
|
if (propName !== name)
|
|
23945
24035
|
continue;
|
|
23946
24036
|
const init = prop.initializer;
|
|
23947
|
-
if (!
|
|
24037
|
+
if (!ts18.isArrayLiteralExpression(init))
|
|
23948
24038
|
continue;
|
|
23949
24039
|
for (const element of init.elements) {
|
|
23950
|
-
if (
|
|
24040
|
+
if (ts18.isStringLiteral(element) || ts18.isNoSubstitutionTemplateLiteral(element)) {
|
|
23951
24041
|
out.push(element.text);
|
|
23952
24042
|
}
|
|
23953
24043
|
}
|
|
@@ -23960,27 +24050,27 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
23960
24050
|
} catch {
|
|
23961
24051
|
return [];
|
|
23962
24052
|
}
|
|
23963
|
-
const sourceFile =
|
|
24053
|
+
const sourceFile = ts18.createSourceFile(filePath, source, ts18.ScriptTarget.ES2022, true, ts18.ScriptKind.TS);
|
|
23964
24054
|
const out = [];
|
|
23965
24055
|
const visit = (node) => {
|
|
23966
|
-
if (
|
|
23967
|
-
for (const decorator of
|
|
24056
|
+
if (ts18.isClassDeclaration(node) && node.name) {
|
|
24057
|
+
for (const decorator of ts18.getDecorators(node) ?? []) {
|
|
23968
24058
|
const expr = decorator.expression;
|
|
23969
|
-
if (!
|
|
24059
|
+
if (!ts18.isCallExpression(expr))
|
|
23970
24060
|
continue;
|
|
23971
24061
|
const functionNode = expr.expression;
|
|
23972
|
-
if (!
|
|
24062
|
+
if (!ts18.isIdentifier(functionNode))
|
|
23973
24063
|
continue;
|
|
23974
24064
|
const kind = ENTITY_DECORATORS[functionNode.text];
|
|
23975
24065
|
if (!kind)
|
|
23976
24066
|
continue;
|
|
23977
24067
|
let extendsName = null;
|
|
23978
24068
|
for (const heritage of node.heritageClauses ?? []) {
|
|
23979
|
-
if (heritage.token !==
|
|
24069
|
+
if (heritage.token !== ts18.SyntaxKind.ExtendsKeyword) {
|
|
23980
24070
|
continue;
|
|
23981
24071
|
}
|
|
23982
24072
|
const [first] = heritage.types;
|
|
23983
|
-
if (first &&
|
|
24073
|
+
if (first && ts18.isIdentifier(first.expression)) {
|
|
23984
24074
|
extendsName = first.expression.text;
|
|
23985
24075
|
}
|
|
23986
24076
|
break;
|
|
@@ -23993,7 +24083,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
23993
24083
|
templateUrls: []
|
|
23994
24084
|
};
|
|
23995
24085
|
const [arg] = expr.arguments;
|
|
23996
|
-
if (arg &&
|
|
24086
|
+
if (arg && ts18.isObjectLiteralExpression(arg) && kind === "component") {
|
|
23997
24087
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
23998
24088
|
if (tplUrl)
|
|
23999
24089
|
entry.templateUrls.push(tplUrl);
|
|
@@ -24006,7 +24096,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
24006
24096
|
break;
|
|
24007
24097
|
}
|
|
24008
24098
|
}
|
|
24009
|
-
|
|
24099
|
+
ts18.forEachChild(node, visit);
|
|
24010
24100
|
};
|
|
24011
24101
|
visit(sourceFile);
|
|
24012
24102
|
return out;
|
|
@@ -24014,7 +24104,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
24014
24104
|
const { changedFilePath, userAngularRoot } = params;
|
|
24015
24105
|
const changedAbs = safeNormalize(changedFilePath);
|
|
24016
24106
|
const out = [];
|
|
24017
|
-
const ext =
|
|
24107
|
+
const ext = extname11(changedAbs).toLowerCase();
|
|
24018
24108
|
if (ext === ".ts" || ext === ".tsx") {
|
|
24019
24109
|
const classes = parseDecoratedClasses(changedAbs);
|
|
24020
24110
|
for (const cls of classes) {
|
|
@@ -24050,12 +24140,12 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
24050
24140
|
} catch {
|
|
24051
24141
|
return null;
|
|
24052
24142
|
}
|
|
24053
|
-
const sourceFile =
|
|
24143
|
+
const sourceFile = ts18.createSourceFile(childFilePath, source, ts18.ScriptTarget.ES2022, true, ts18.ScriptKind.TS);
|
|
24054
24144
|
const childDir = dirname24(childFilePath);
|
|
24055
24145
|
for (const stmt of sourceFile.statements) {
|
|
24056
|
-
if (!
|
|
24146
|
+
if (!ts18.isImportDeclaration(stmt))
|
|
24057
24147
|
continue;
|
|
24058
|
-
if (!
|
|
24148
|
+
if (!ts18.isStringLiteral(stmt.moduleSpecifier))
|
|
24059
24149
|
continue;
|
|
24060
24150
|
const clause = stmt.importClause;
|
|
24061
24151
|
if (!clause || clause.isTypeOnly)
|
|
@@ -24063,7 +24153,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
24063
24153
|
let matchesName = false;
|
|
24064
24154
|
if (clause.name && clause.name.text === parentName)
|
|
24065
24155
|
matchesName = true;
|
|
24066
|
-
if (!matchesName && clause.namedBindings &&
|
|
24156
|
+
if (!matchesName && clause.namedBindings && ts18.isNamedImports(clause.namedBindings)) {
|
|
24067
24157
|
for (const element of clause.namedBindings.elements) {
|
|
24068
24158
|
if (element.isTypeOnly)
|
|
24069
24159
|
continue;
|
|
@@ -24433,7 +24523,7 @@ __export(exports_moduleServer, {
|
|
|
24433
24523
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
24434
24524
|
});
|
|
24435
24525
|
import { existsSync as existsSync32, readFileSync as readFileSync27, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
|
|
24436
|
-
import { basename as basename16, dirname as dirname25, extname as
|
|
24526
|
+
import { basename as basename16, dirname as dirname25, extname as extname12, join as join40, resolve as resolve38, relative as relative16 } from "path";
|
|
24437
24527
|
var SRC_PREFIX = "/@src/", jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
24438
24528
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
24439
24529
|
const allExports = [];
|
|
@@ -24487,9 +24577,9 @@ ${stubs}
|
|
|
24487
24577
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
24488
24578
|
const absPath = resolve38(fileDir, relPath);
|
|
24489
24579
|
const rel = relative16(projectRoot, absPath);
|
|
24490
|
-
const extension =
|
|
24580
|
+
const extension = extname12(rel);
|
|
24491
24581
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
24492
|
-
if (
|
|
24582
|
+
if (extname12(srcPath) === ".svelte") {
|
|
24493
24583
|
srcPath = relative16(projectRoot, resolveSvelteModulePath(resolve38(projectRoot, srcPath)));
|
|
24494
24584
|
}
|
|
24495
24585
|
return srcUrl(srcPath, projectRoot);
|
|
@@ -24630,7 +24720,7 @@ ${transpiled}`;
|
|
|
24630
24720
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
24631
24721
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
24632
24722
|
const raw = readFileSync27(filePath, "utf-8");
|
|
24633
|
-
const ext =
|
|
24723
|
+
const ext = extname12(filePath);
|
|
24634
24724
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
24635
24725
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
24636
24726
|
let transpiler6 = jsTranspiler2;
|
|
@@ -25054,7 +25144,7 @@ export default {};
|
|
|
25054
25144
|
return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
|
|
25055
25145
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
25056
25146
|
const filePath = resolve38(projectRoot, relPath);
|
|
25057
|
-
const ext =
|
|
25147
|
+
const ext = extname12(filePath);
|
|
25058
25148
|
if (ext === ".svelte")
|
|
25059
25149
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
25060
25150
|
if (ext)
|
|
@@ -28429,10 +28519,8 @@ var toSafeFileName6 = (specifier) => {
|
|
|
28429
28519
|
setup(bld) {
|
|
28430
28520
|
bld.onLoad({ filter: /\.(?:m?js|cjs)$/ }, async (args) => {
|
|
28431
28521
|
const source = await Bun.file(args.path).text();
|
|
28432
|
-
if (!source.includes("@__PURE__"))
|
|
28433
|
-
return;
|
|
28434
28522
|
return {
|
|
28435
|
-
contents: source.replace(PURE_ANNOTATION, ""),
|
|
28523
|
+
contents: source.includes("@__PURE__") ? source.replace(PURE_ANNOTATION, "") : source,
|
|
28436
28524
|
loader: args.path.endsWith(".cjs") ? "js" : "js"
|
|
28437
28525
|
};
|
|
28438
28526
|
});
|
|
@@ -29073,5 +29161,5 @@ export {
|
|
|
29073
29161
|
build
|
|
29074
29162
|
};
|
|
29075
29163
|
|
|
29076
|
-
//# debugId=
|
|
29164
|
+
//# debugId=8128BC45E4AD897064756E2164756E21
|
|
29077
29165
|
//# sourceMappingURL=build.js.map
|