@absolutejs/absolute 0.19.0-beta.970 → 0.19.0-beta.972
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/angular/index.js +175 -7102
- package/dist/angular/index.js.map +5 -10
- package/dist/angular/server.js +115 -15979
- package/dist/angular/server.js.map +5 -233
- package/dist/build.js +883 -769
- package/dist/build.js.map +7 -6
- package/dist/index.js +925 -811
- package/dist/index.js.map +7 -6
- package/dist/src/angular/loadGlobalProviders.d.ts +7 -0
- package/dist/src/build/emitAngularProvidersFiles.d.ts +11 -1
- package/dist/src/build/parseAngularConfigImports.d.ts +9 -0
- package/dist/src/utils/loadConfig.d.ts +3 -0
- package/dist/types/build.d.ts +13 -0
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -11713,7 +11713,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11713
11713
|
}
|
|
11714
11714
|
return lines.join(`
|
|
11715
11715
|
`);
|
|
11716
|
-
}, ROUTER_FEATURES_DEFAULT, renderFile = (call, outputPath, basePath, pageRoutes) => {
|
|
11716
|
+
}, ROUTER_FEATURES_DEFAULT, renderFile = (call, outputPath, basePath, pageRoutes, providersImport) => {
|
|
11717
11717
|
const sections = [];
|
|
11718
11718
|
sections.push("/* AUTOGENERATED by AbsoluteJS \u2014 see `scanAngularHandlerCalls`. */", "/* eslint-disable */");
|
|
11719
11719
|
const groups = groupImports(call.providerImports);
|
|
@@ -11722,6 +11722,13 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11722
11722
|
sections.push(renderImportGroup(group, outputPath));
|
|
11723
11723
|
}
|
|
11724
11724
|
}
|
|
11725
|
+
if (providersImport) {
|
|
11726
|
+
const outputDir = dirname11(outputPath);
|
|
11727
|
+
const rel = relative10(outputDir, providersImport.absolutePath).replace(/\\/g, "/");
|
|
11728
|
+
const specifier = rel.startsWith(".") ? rel : `./${rel}`;
|
|
11729
|
+
const importClause = providersImport.importedName === providersImport.bindingName ? `{ ${providersImport.bindingName} as __globalProviders }` : `{ ${providersImport.importedName} as __globalProviders }`;
|
|
11730
|
+
sections.push(`import ${importClause} from "${specifier}";`);
|
|
11731
|
+
}
|
|
11725
11732
|
if (basePath !== null) {
|
|
11726
11733
|
sections.push(`import { APP_BASE_HREF } from "@angular/common";`, `const __basePathProvider = { provide: APP_BASE_HREF, useValue: ${JSON.stringify(basePath)} };`);
|
|
11727
11734
|
}
|
|
@@ -11729,13 +11736,17 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11729
11736
|
const routesImport = relativeRoutesImport(dirname11(outputPath), pageRoutes.pageFile);
|
|
11730
11737
|
sections.push(`import { ${["provideRouter", ...ROUTER_FEATURES_DEFAULT].join(", ")} } from "@angular/router";`, `import { routes as __pageRoutes } from "${routesImport}";`, `const __routerProvider = provideRouter(__pageRoutes, ${ROUTER_FEATURES_DEFAULT.map((name) => `${name}()`).join(", ")});`);
|
|
11731
11738
|
}
|
|
11732
|
-
const
|
|
11733
|
-
const
|
|
11739
|
+
const userProvidersExpr = call.providersExpr ?? "[]";
|
|
11740
|
+
const fragments = [];
|
|
11741
|
+
if (providersImport)
|
|
11742
|
+
fragments.push("...__globalProviders");
|
|
11743
|
+
if (call.providersExpr !== null)
|
|
11744
|
+
fragments.push(`...(${userProvidersExpr})`);
|
|
11734
11745
|
if (pageRoutes?.hasRoutes)
|
|
11735
|
-
|
|
11746
|
+
fragments.push("__routerProvider");
|
|
11736
11747
|
if (basePath !== null)
|
|
11737
|
-
|
|
11738
|
-
const exportExpr =
|
|
11748
|
+
fragments.push("__basePathProvider");
|
|
11749
|
+
const exportExpr = fragments.length === 0 ? "[]" : `[${fragments.join(", ")}]`;
|
|
11739
11750
|
sections.push(`export const providers = ${exportExpr};`);
|
|
11740
11751
|
return sections.join(`
|
|
11741
11752
|
|
|
@@ -11748,7 +11759,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11748
11759
|
return null;
|
|
11749
11760
|
const trimmed = mountPath.slice(0, -1);
|
|
11750
11761
|
return trimmed === "/" ? null : trimmed;
|
|
11751
|
-
}, emitAngularProvidersFiles = (projectRoot, calls, pageRoutes) => {
|
|
11762
|
+
}, emitAngularProvidersFiles = (projectRoot, calls, pageRoutes, options = {}) => {
|
|
11752
11763
|
const outputDir = getProvidersOutputDir(projectRoot);
|
|
11753
11764
|
mkdirSync8(outputDir, { recursive: true });
|
|
11754
11765
|
const pageRoutesByKey = new Map;
|
|
@@ -11760,7 +11771,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11760
11771
|
const outputPath = join23(outputDir, `${call.manifestKey}.providers.ts`);
|
|
11761
11772
|
const basePath = deriveBasePath(call.mountPath);
|
|
11762
11773
|
const pageRoute = pageRoutesByKey.get(call.manifestKey);
|
|
11763
|
-
const content = renderFile(call, outputPath, basePath, pageRoute);
|
|
11774
|
+
const content = renderFile(call, outputPath, basePath, pageRoute, options.providersImport ?? null);
|
|
11764
11775
|
writeFileSync7(outputPath, content, "utf-8");
|
|
11765
11776
|
emitted.push({
|
|
11766
11777
|
basePath,
|
|
@@ -11828,14 +11839,115 @@ var init_emitAngularRouteMounts = __esm(() => {
|
|
|
11828
11839
|
init_generatedDir();
|
|
11829
11840
|
});
|
|
11830
11841
|
|
|
11831
|
-
// src/build/
|
|
11832
|
-
import {
|
|
11833
|
-
import { dirname as dirname12, isAbsolute as isAbsolute3, join as join25
|
|
11842
|
+
// src/build/parseAngularConfigImports.ts
|
|
11843
|
+
import { existsSync as existsSync19, readFileSync as readFileSync13 } from "fs";
|
|
11844
|
+
import { dirname as dirname12, isAbsolute as isAbsolute3, join as join25 } from "path";
|
|
11834
11845
|
import ts7 from "typescript";
|
|
11846
|
+
var findDefineConfigCall = (sf) => {
|
|
11847
|
+
let result = null;
|
|
11848
|
+
const visit = (node) => {
|
|
11849
|
+
if (result)
|
|
11850
|
+
return;
|
|
11851
|
+
if (ts7.isCallExpression(node) && ts7.isIdentifier(node.expression) && node.expression.text === "defineConfig") {
|
|
11852
|
+
const [arg] = node.arguments;
|
|
11853
|
+
if (arg && ts7.isObjectLiteralExpression(arg)) {
|
|
11854
|
+
result = arg;
|
|
11855
|
+
return;
|
|
11856
|
+
}
|
|
11857
|
+
}
|
|
11858
|
+
ts7.forEachChild(node, visit);
|
|
11859
|
+
};
|
|
11860
|
+
ts7.forEachChild(sf, visit);
|
|
11861
|
+
return result;
|
|
11862
|
+
}, findPropertyInitializer = (object, name) => {
|
|
11863
|
+
for (const prop of object.properties) {
|
|
11864
|
+
if (!ts7.isPropertyAssignment(prop))
|
|
11865
|
+
continue;
|
|
11866
|
+
if (!prop.name)
|
|
11867
|
+
continue;
|
|
11868
|
+
const key = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
11869
|
+
if (key === name)
|
|
11870
|
+
return prop.initializer;
|
|
11871
|
+
}
|
|
11872
|
+
return null;
|
|
11873
|
+
}, findImportForBinding = (sf, binding) => {
|
|
11874
|
+
for (const statement of sf.statements) {
|
|
11875
|
+
if (!ts7.isImportDeclaration(statement))
|
|
11876
|
+
continue;
|
|
11877
|
+
if (!ts7.isStringLiteral(statement.moduleSpecifier))
|
|
11878
|
+
continue;
|
|
11879
|
+
if (statement.importClause?.isTypeOnly)
|
|
11880
|
+
continue;
|
|
11881
|
+
const named = statement.importClause?.namedBindings;
|
|
11882
|
+
if (!named || !ts7.isNamedImports(named))
|
|
11883
|
+
continue;
|
|
11884
|
+
for (const element of named.elements) {
|
|
11885
|
+
if (element.isTypeOnly)
|
|
11886
|
+
continue;
|
|
11887
|
+
if (element.name.text === binding) {
|
|
11888
|
+
return {
|
|
11889
|
+
importedName: element.propertyName?.text ?? element.name.text,
|
|
11890
|
+
source: statement.moduleSpecifier.text
|
|
11891
|
+
};
|
|
11892
|
+
}
|
|
11893
|
+
}
|
|
11894
|
+
}
|
|
11895
|
+
return null;
|
|
11896
|
+
}, resolveConfigPath = (projectRoot) => {
|
|
11897
|
+
const candidates = [
|
|
11898
|
+
join25(projectRoot, "absolute.config.ts"),
|
|
11899
|
+
join25(projectRoot, "absolute.config.mts"),
|
|
11900
|
+
join25(projectRoot, "absolute.config.js"),
|
|
11901
|
+
join25(projectRoot, "absolute.config.mjs")
|
|
11902
|
+
];
|
|
11903
|
+
for (const candidate of candidates) {
|
|
11904
|
+
if (existsSync19(candidate))
|
|
11905
|
+
return candidate;
|
|
11906
|
+
}
|
|
11907
|
+
return null;
|
|
11908
|
+
}, parseAngularProvidersImport = (projectRoot) => {
|
|
11909
|
+
const configPath2 = resolveConfigPath(projectRoot);
|
|
11910
|
+
if (!configPath2)
|
|
11911
|
+
return null;
|
|
11912
|
+
const source = readFileSync13(configPath2, "utf-8");
|
|
11913
|
+
if (!source.includes("angular"))
|
|
11914
|
+
return null;
|
|
11915
|
+
if (!source.includes("providers"))
|
|
11916
|
+
return null;
|
|
11917
|
+
const sf = ts7.createSourceFile(configPath2, source, ts7.ScriptTarget.Latest, true, ts7.ScriptKind.TS);
|
|
11918
|
+
const configObject = findDefineConfigCall(sf);
|
|
11919
|
+
if (!configObject)
|
|
11920
|
+
return null;
|
|
11921
|
+
const angularField = findPropertyInitializer(configObject, "angular");
|
|
11922
|
+
if (!angularField || !ts7.isObjectLiteralExpression(angularField))
|
|
11923
|
+
return null;
|
|
11924
|
+
const providersField = findPropertyInitializer(angularField, "providers");
|
|
11925
|
+
if (!providersField)
|
|
11926
|
+
return null;
|
|
11927
|
+
if (!ts7.isIdentifier(providersField))
|
|
11928
|
+
return null;
|
|
11929
|
+
const binding = providersField.text;
|
|
11930
|
+
const importInfo = findImportForBinding(sf, binding);
|
|
11931
|
+
if (!importInfo)
|
|
11932
|
+
return null;
|
|
11933
|
+
const configDir2 = dirname12(configPath2);
|
|
11934
|
+
const absolutePath = importInfo.source.startsWith(".") ? join25(configDir2, importInfo.source).replace(/\.[cm]?[tj]sx?$/, "") : isAbsolute3(importInfo.source) ? importInfo.source.replace(/\.[cm]?[tj]sx?$/, "") : importInfo.source;
|
|
11935
|
+
return {
|
|
11936
|
+
absolutePath,
|
|
11937
|
+
bindingName: binding,
|
|
11938
|
+
importedName: importInfo.importedName
|
|
11939
|
+
};
|
|
11940
|
+
};
|
|
11941
|
+
var init_parseAngularConfigImports = () => {};
|
|
11942
|
+
|
|
11943
|
+
// src/build/scanAngularHandlerCalls.ts
|
|
11944
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync14 } from "fs";
|
|
11945
|
+
import { dirname as dirname13, isAbsolute as isAbsolute4, join as join26, resolve as resolve19 } from "path";
|
|
11946
|
+
import ts8 from "typescript";
|
|
11835
11947
|
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (filePath) => {
|
|
11836
11948
|
if (filePath.endsWith(".tsx"))
|
|
11837
|
-
return
|
|
11838
|
-
return
|
|
11949
|
+
return ts8.ScriptKind.TSX;
|
|
11950
|
+
return ts8.ScriptKind.TS;
|
|
11839
11951
|
}, hasSourceExtension3 = (filePath) => {
|
|
11840
11952
|
const idx = filePath.lastIndexOf(".");
|
|
11841
11953
|
if (idx === -1)
|
|
@@ -11863,16 +11975,16 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11863
11975
|
continue;
|
|
11864
11976
|
if (entry.name.startsWith("."))
|
|
11865
11977
|
continue;
|
|
11866
|
-
stack.push(
|
|
11978
|
+
stack.push(join26(dir, entry.name));
|
|
11867
11979
|
} else if (entry.isFile() && hasSourceExtension3(entry.name)) {
|
|
11868
|
-
out.push(
|
|
11980
|
+
out.push(join26(dir, entry.name));
|
|
11869
11981
|
}
|
|
11870
11982
|
}
|
|
11871
11983
|
}
|
|
11872
11984
|
return out;
|
|
11873
11985
|
}, fileMayContainAngularHandler = (source) => source.includes("handleAngularPageRequest"), collectFileImports = (sf, filePath) => {
|
|
11874
11986
|
const map = new Map;
|
|
11875
|
-
const fileDir =
|
|
11987
|
+
const fileDir = dirname13(filePath);
|
|
11876
11988
|
const recordSpec = (localName, spec) => {
|
|
11877
11989
|
map.set(localName, spec);
|
|
11878
11990
|
};
|
|
@@ -11880,15 +11992,15 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11880
11992
|
if (specifier.startsWith(".")) {
|
|
11881
11993
|
return resolve19(fileDir, specifier);
|
|
11882
11994
|
}
|
|
11883
|
-
if (
|
|
11995
|
+
if (isAbsolute4(specifier)) {
|
|
11884
11996
|
return specifier;
|
|
11885
11997
|
}
|
|
11886
11998
|
return null;
|
|
11887
11999
|
};
|
|
11888
12000
|
for (const statement of sf.statements) {
|
|
11889
|
-
if (!
|
|
12001
|
+
if (!ts8.isImportDeclaration(statement))
|
|
11890
12002
|
continue;
|
|
11891
|
-
if (!
|
|
12003
|
+
if (!ts8.isStringLiteral(statement.moduleSpecifier))
|
|
11892
12004
|
continue;
|
|
11893
12005
|
if (statement.importClause?.isTypeOnly)
|
|
11894
12006
|
continue;
|
|
@@ -11909,7 +12021,7 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11909
12021
|
const bindings = clause.namedBindings;
|
|
11910
12022
|
if (!bindings)
|
|
11911
12023
|
continue;
|
|
11912
|
-
if (
|
|
12024
|
+
if (ts8.isNamespaceImport(bindings)) {
|
|
11913
12025
|
recordSpec(bindings.name.text, {
|
|
11914
12026
|
importedName: "*",
|
|
11915
12027
|
isDefault: false,
|
|
@@ -11937,38 +12049,38 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11937
12049
|
}, collectExpressionIdentifiers = (expr) => {
|
|
11938
12050
|
const out = new Set;
|
|
11939
12051
|
const visit = (node) => {
|
|
11940
|
-
if (
|
|
12052
|
+
if (ts8.isIdentifier(node)) {
|
|
11941
12053
|
out.add(node.text);
|
|
11942
12054
|
return;
|
|
11943
12055
|
}
|
|
11944
|
-
if (
|
|
12056
|
+
if (ts8.isPropertyAccessExpression(node)) {
|
|
11945
12057
|
visit(node.expression);
|
|
11946
12058
|
return;
|
|
11947
12059
|
}
|
|
11948
|
-
|
|
12060
|
+
ts8.forEachChild(node, visit);
|
|
11949
12061
|
};
|
|
11950
12062
|
visit(expr);
|
|
11951
12063
|
return out;
|
|
11952
12064
|
}, extractManifestKey = (pagePathValue) => {
|
|
11953
|
-
if (!
|
|
12065
|
+
if (!ts8.isCallExpression(pagePathValue))
|
|
11954
12066
|
return null;
|
|
11955
12067
|
const callee = pagePathValue.expression;
|
|
11956
|
-
if (!
|
|
12068
|
+
if (!ts8.isIdentifier(callee) || callee.text !== "asset")
|
|
11957
12069
|
return null;
|
|
11958
12070
|
const [, second] = pagePathValue.arguments;
|
|
11959
12071
|
if (!second)
|
|
11960
12072
|
return null;
|
|
11961
|
-
if (!
|
|
12073
|
+
if (!ts8.isStringLiteral(second))
|
|
11962
12074
|
return null;
|
|
11963
12075
|
return second.text;
|
|
11964
12076
|
}, findEnclosingMountPath = (node) => {
|
|
11965
12077
|
let cursor = node.parent;
|
|
11966
12078
|
while (cursor) {
|
|
11967
|
-
if (
|
|
12079
|
+
if (ts8.isCallExpression(cursor)) {
|
|
11968
12080
|
const callee = cursor.expression;
|
|
11969
|
-
if (
|
|
12081
|
+
if (ts8.isPropertyAccessExpression(callee) && ts8.isIdentifier(callee.name) && ELYSIA_ROUTE_METHODS2.has(callee.name.text)) {
|
|
11970
12082
|
const firstArg = cursor.arguments[0];
|
|
11971
|
-
if (firstArg &&
|
|
12083
|
+
if (firstArg && ts8.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
11972
12084
|
return firstArg.text;
|
|
11973
12085
|
}
|
|
11974
12086
|
}
|
|
@@ -11979,37 +12091,37 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11979
12091
|
}, extractCallsFromFile = (filePath, out) => {
|
|
11980
12092
|
let source;
|
|
11981
12093
|
try {
|
|
11982
|
-
source =
|
|
12094
|
+
source = readFileSync14(filePath, "utf-8");
|
|
11983
12095
|
} catch {
|
|
11984
12096
|
return;
|
|
11985
12097
|
}
|
|
11986
12098
|
if (!fileMayContainAngularHandler(source))
|
|
11987
12099
|
return;
|
|
11988
|
-
const sf =
|
|
12100
|
+
const sf = ts8.createSourceFile(filePath, source, ts8.ScriptTarget.Latest, true, getScriptKind2(filePath));
|
|
11989
12101
|
const imports = collectFileImports(sf, filePath);
|
|
11990
12102
|
const visit = (node) => {
|
|
11991
|
-
if (
|
|
12103
|
+
if (ts8.isCallExpression(node) && ts8.isIdentifier(node.expression) && node.expression.text === "handleAngularPageRequest") {
|
|
11992
12104
|
const [arg] = node.arguments;
|
|
11993
|
-
if (arg &&
|
|
12105
|
+
if (arg && ts8.isObjectLiteralExpression(arg)) {
|
|
11994
12106
|
let manifestKey = null;
|
|
11995
12107
|
let providersExpr = null;
|
|
11996
12108
|
for (const prop of arg.properties) {
|
|
11997
|
-
if (
|
|
12109
|
+
if (ts8.isPropertyAssignment(prop)) {
|
|
11998
12110
|
if (!prop.name)
|
|
11999
12111
|
continue;
|
|
12000
|
-
const name =
|
|
12112
|
+
const name = ts8.isIdentifier(prop.name) ? prop.name.text : ts8.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
12001
12113
|
if (name === "pagePath") {
|
|
12002
12114
|
manifestKey = extractManifestKey(prop.initializer);
|
|
12003
12115
|
} else if (name === "providers") {
|
|
12004
12116
|
providersExpr = prop.initializer;
|
|
12005
12117
|
}
|
|
12006
|
-
} else if (
|
|
12118
|
+
} else if (ts8.isSpreadAssignment(prop)) {
|
|
12007
12119
|
if (manifestKey)
|
|
12008
12120
|
continue;
|
|
12009
12121
|
const spreadExpr = prop.expression;
|
|
12010
|
-
if (
|
|
12122
|
+
if (ts8.isCallExpression(spreadExpr) && spreadExpr.arguments.length > 0) {
|
|
12011
12123
|
const [firstArg] = spreadExpr.arguments;
|
|
12012
|
-
if (firstArg &&
|
|
12124
|
+
if (firstArg && ts8.isStringLiteral(firstArg)) {
|
|
12013
12125
|
manifestKey = firstArg.text;
|
|
12014
12126
|
}
|
|
12015
12127
|
}
|
|
@@ -12037,9 +12149,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12037
12149
|
}
|
|
12038
12150
|
}
|
|
12039
12151
|
}
|
|
12040
|
-
|
|
12152
|
+
ts8.forEachChild(node, visit);
|
|
12041
12153
|
};
|
|
12042
|
-
|
|
12154
|
+
ts8.forEachChild(sf, visit);
|
|
12043
12155
|
}, scanAngularHandlerCalls = (projectRoot) => {
|
|
12044
12156
|
const files = collectSourceFiles2(projectRoot);
|
|
12045
12157
|
const collected = [];
|
|
@@ -12082,7 +12194,8 @@ __export(exports_runAngularHandlerScan, {
|
|
|
12082
12194
|
var runAngularHandlerScan = (projectRoot, angularDirectory) => {
|
|
12083
12195
|
const calls = scanAngularHandlerCalls(projectRoot);
|
|
12084
12196
|
const pageRoutes = scanAngularPageRoutes(angularDirectory);
|
|
12085
|
-
const
|
|
12197
|
+
const providersImport = parseAngularProvidersImport(projectRoot);
|
|
12198
|
+
const providersFiles = emitAngularProvidersFiles(projectRoot, calls, pageRoutes, { providersImport });
|
|
12086
12199
|
emitAngularRouteMounts(projectRoot, calls);
|
|
12087
12200
|
return {
|
|
12088
12201
|
calls,
|
|
@@ -12094,6 +12207,7 @@ var runAngularHandlerScan = (projectRoot, angularDirectory) => {
|
|
|
12094
12207
|
var init_runAngularHandlerScan = __esm(() => {
|
|
12095
12208
|
init_emitAngularProvidersFiles();
|
|
12096
12209
|
init_emitAngularRouteMounts();
|
|
12210
|
+
init_parseAngularConfigImports();
|
|
12097
12211
|
init_scanAngularHandlerCalls();
|
|
12098
12212
|
init_scanAngularPageRoutes();
|
|
12099
12213
|
});
|
|
@@ -12237,11 +12351,11 @@ __export(exports_compileSvelte, {
|
|
|
12237
12351
|
compileSvelte: () => compileSvelte,
|
|
12238
12352
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
12239
12353
|
});
|
|
12240
|
-
import { existsSync as
|
|
12354
|
+
import { existsSync as existsSync20 } from "fs";
|
|
12241
12355
|
import { mkdir as mkdir4, stat as stat2 } from "fs/promises";
|
|
12242
12356
|
import {
|
|
12243
|
-
dirname as
|
|
12244
|
-
join as
|
|
12357
|
+
dirname as dirname14,
|
|
12358
|
+
join as join27,
|
|
12245
12359
|
basename as basename6,
|
|
12246
12360
|
extname as extname5,
|
|
12247
12361
|
resolve as resolve20,
|
|
@@ -12253,11 +12367,11 @@ var {write: write2, file, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
|
12253
12367
|
var resolveDevClientDir2 = () => {
|
|
12254
12368
|
const projectRoot = process.cwd();
|
|
12255
12369
|
const fromSource = resolve20(import.meta.dir, "../dev/client");
|
|
12256
|
-
if (
|
|
12370
|
+
if (existsSync20(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
12257
12371
|
return fromSource;
|
|
12258
12372
|
}
|
|
12259
12373
|
const fromNodeModules = resolve20(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
12260
|
-
if (
|
|
12374
|
+
if (existsSync20(fromNodeModules))
|
|
12261
12375
|
return fromNodeModules;
|
|
12262
12376
|
return resolve20(import.meta.dir, "./dev/client");
|
|
12263
12377
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
@@ -12289,7 +12403,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12289
12403
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
12290
12404
|
if (!spec.startsWith("."))
|
|
12291
12405
|
return null;
|
|
12292
|
-
const basePath = resolve20(
|
|
12406
|
+
const basePath = resolve20(dirname14(from), spec);
|
|
12293
12407
|
const candidates = [
|
|
12294
12408
|
basePath,
|
|
12295
12409
|
`${basePath}.ts`,
|
|
@@ -12300,14 +12414,14 @@ var resolveDevClientDir2 = () => {
|
|
|
12300
12414
|
`${basePath}.svelte`,
|
|
12301
12415
|
`${basePath}.svelte.ts`,
|
|
12302
12416
|
`${basePath}.svelte.js`,
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12417
|
+
join27(basePath, "index.ts"),
|
|
12418
|
+
join27(basePath, "index.js"),
|
|
12419
|
+
join27(basePath, "index.mjs"),
|
|
12420
|
+
join27(basePath, "index.cjs"),
|
|
12421
|
+
join27(basePath, "index.json"),
|
|
12422
|
+
join27(basePath, "index.svelte"),
|
|
12423
|
+
join27(basePath, "index.svelte.ts"),
|
|
12424
|
+
join27(basePath, "index.svelte.js")
|
|
12311
12425
|
];
|
|
12312
12426
|
const checks = await Promise.all(candidates.map(exists));
|
|
12313
12427
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -12316,7 +12430,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12316
12430
|
const resolved = resolvePackageImport(spec);
|
|
12317
12431
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
12318
12432
|
}
|
|
12319
|
-
const basePath = resolve20(
|
|
12433
|
+
const basePath = resolve20(dirname14(from), spec);
|
|
12320
12434
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
12321
12435
|
if (!explicit) {
|
|
12322
12436
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -12346,9 +12460,9 @@ var resolveDevClientDir2 = () => {
|
|
|
12346
12460
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
12347
12461
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
12348
12462
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
12349
|
-
const clientDir =
|
|
12350
|
-
const indexDir =
|
|
12351
|
-
const serverDir =
|
|
12463
|
+
const clientDir = join27(generatedDir, "client");
|
|
12464
|
+
const indexDir = join27(generatedDir, "indexes");
|
|
12465
|
+
const serverDir = join27(generatedDir, "server");
|
|
12352
12466
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir4(dir, { recursive: true })));
|
|
12353
12467
|
const dev = env.NODE_ENV !== "production";
|
|
12354
12468
|
const build = async (src) => {
|
|
@@ -12360,7 +12474,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12360
12474
|
const contentHash = Bun.hash(raw).toString(BASE_36_RADIX);
|
|
12361
12475
|
const prevHash = sourceHashCache.get(src);
|
|
12362
12476
|
const persistent = persistentCache.get(src);
|
|
12363
|
-
if (prevHash === contentHash && persistent &&
|
|
12477
|
+
if (prevHash === contentHash && persistent && existsSync20(persistent.ssr) && existsSync20(persistent.client)) {
|
|
12364
12478
|
cache.set(src, persistent);
|
|
12365
12479
|
return persistent;
|
|
12366
12480
|
}
|
|
@@ -12376,8 +12490,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12376
12490
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
12377
12491
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
12378
12492
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
12379
|
-
const rawRel =
|
|
12380
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${relative11(process.cwd(),
|
|
12493
|
+
const rawRel = dirname14(relative11(svelteRoot, src)).replace(/\\/g, "/");
|
|
12494
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative11(process.cwd(), dirname14(src)).replace(/\\/g, "/")}` : rawRel;
|
|
12381
12495
|
const baseName = basename6(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
12382
12496
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
12383
12497
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -12386,8 +12500,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12386
12500
|
const childBuilt = await Promise.all(childSources.map((child) => build(child)));
|
|
12387
12501
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
12388
12502
|
const externalRewrites = new Map;
|
|
12389
|
-
const ssrOutputDir =
|
|
12390
|
-
const clientOutputDir =
|
|
12503
|
+
const ssrOutputDir = dirname14(join27(serverDir, relDir, `${baseName}.js`));
|
|
12504
|
+
const clientOutputDir = dirname14(join27(clientDir, relDir, `${baseName}.js`));
|
|
12391
12505
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
12392
12506
|
const rawSpec = importPaths[idx];
|
|
12393
12507
|
if (!rawSpec)
|
|
@@ -12452,11 +12566,11 @@ var resolveDevClientDir2 = () => {
|
|
|
12452
12566
|
code += islandMetadataExports;
|
|
12453
12567
|
return { code, map: compiledJs.map };
|
|
12454
12568
|
};
|
|
12455
|
-
const ssrPath =
|
|
12456
|
-
const clientPath =
|
|
12569
|
+
const ssrPath = join27(serverDir, relDir, `${baseName}.js`);
|
|
12570
|
+
const clientPath = join27(clientDir, relDir, `${baseName}.js`);
|
|
12457
12571
|
await Promise.all([
|
|
12458
|
-
mkdir4(
|
|
12459
|
-
mkdir4(
|
|
12572
|
+
mkdir4(dirname14(ssrPath), { recursive: true }),
|
|
12573
|
+
mkdir4(dirname14(clientPath), { recursive: true })
|
|
12460
12574
|
]);
|
|
12461
12575
|
const inlineMap = (map) => map ? `
|
|
12462
12576
|
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
@@ -12489,10 +12603,10 @@ var resolveDevClientDir2 = () => {
|
|
|
12489
12603
|
};
|
|
12490
12604
|
const roots = await Promise.all(entryPoints.map(build));
|
|
12491
12605
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
12492
|
-
const relClientDir =
|
|
12606
|
+
const relClientDir = dirname14(relative11(clientDir, client));
|
|
12493
12607
|
const name = basename6(client, extname5(client));
|
|
12494
|
-
const indexPath =
|
|
12495
|
-
const importRaw = relative11(
|
|
12608
|
+
const indexPath = join27(indexDir, relClientDir, `${name}.js`);
|
|
12609
|
+
const importRaw = relative11(dirname14(indexPath), client).split(sep2).join("/");
|
|
12496
12610
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
12497
12611
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
12498
12612
|
import "${hmrClientPath3}";
|
|
@@ -12563,14 +12677,14 @@ if (typeof window !== "undefined") {
|
|
|
12563
12677
|
setTimeout(releaseStreamingSlots, 0);
|
|
12564
12678
|
}
|
|
12565
12679
|
}`;
|
|
12566
|
-
await mkdir4(
|
|
12680
|
+
await mkdir4(dirname14(indexPath), { recursive: true });
|
|
12567
12681
|
return write2(indexPath, bootstrap);
|
|
12568
12682
|
}));
|
|
12569
12683
|
return {
|
|
12570
12684
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
12571
12685
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
12572
|
-
const rel =
|
|
12573
|
-
return
|
|
12686
|
+
const rel = dirname14(relative11(clientDir, client));
|
|
12687
|
+
return join27(indexDir, rel, basename6(client));
|
|
12574
12688
|
}),
|
|
12575
12689
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
12576
12690
|
};
|
|
@@ -12585,7 +12699,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
12585
12699
|
init_lowerAwaitSlotSyntax();
|
|
12586
12700
|
init_renderToReadableStream();
|
|
12587
12701
|
devClientDir2 = resolveDevClientDir2();
|
|
12588
|
-
hmrClientPath3 =
|
|
12702
|
+
hmrClientPath3 = join27(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
12589
12703
|
persistentCache = new Map;
|
|
12590
12704
|
sourceHashCache = new Map;
|
|
12591
12705
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
@@ -12600,7 +12714,7 @@ __export(exports_chainInlineSourcemaps, {
|
|
|
12600
12714
|
chainBundleInlineSourcemap: () => chainBundleInlineSourcemap,
|
|
12601
12715
|
buildLineRemap: () => buildLineRemap
|
|
12602
12716
|
});
|
|
12603
|
-
import { readFileSync as
|
|
12717
|
+
import { readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
|
|
12604
12718
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", BASE64_TO_INT, decodeVlq = (str, startPos) => {
|
|
12605
12719
|
let result = 0;
|
|
12606
12720
|
let shift = 0;
|
|
@@ -12891,7 +13005,7 @@ var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567
|
|
|
12891
13005
|
version: 3
|
|
12892
13006
|
};
|
|
12893
13007
|
}, chainBundleInlineSourcemap = (bundleFilePath) => {
|
|
12894
|
-
const text =
|
|
13008
|
+
const text = readFileSync15(bundleFilePath, "utf-8");
|
|
12895
13009
|
const outerMap = extractInlineMap(text);
|
|
12896
13010
|
if (!outerMap)
|
|
12897
13011
|
return;
|
|
@@ -12977,13 +13091,13 @@ __export(exports_compileVue, {
|
|
|
12977
13091
|
compileVue: () => compileVue,
|
|
12978
13092
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
12979
13093
|
});
|
|
12980
|
-
import { existsSync as
|
|
13094
|
+
import { existsSync as existsSync21 } from "fs";
|
|
12981
13095
|
import { mkdir as mkdir5 } from "fs/promises";
|
|
12982
13096
|
import {
|
|
12983
13097
|
basename as basename7,
|
|
12984
|
-
dirname as
|
|
12985
|
-
isAbsolute as
|
|
12986
|
-
join as
|
|
13098
|
+
dirname as dirname15,
|
|
13099
|
+
isAbsolute as isAbsolute5,
|
|
13100
|
+
join as join28,
|
|
12987
13101
|
relative as relative12,
|
|
12988
13102
|
resolve as resolve21
|
|
12989
13103
|
} from "path";
|
|
@@ -12991,11 +13105,11 @@ var {file: file2, write: write3, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
|
12991
13105
|
var resolveDevClientDir3 = () => {
|
|
12992
13106
|
const projectRoot = process.cwd();
|
|
12993
13107
|
const fromSource = resolve21(import.meta.dir, "../dev/client");
|
|
12994
|
-
if (
|
|
13108
|
+
if (existsSync21(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
12995
13109
|
return fromSource;
|
|
12996
13110
|
}
|
|
12997
13111
|
const fromNodeModules = resolve21(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
12998
|
-
if (
|
|
13112
|
+
if (existsSync21(fromNodeModules))
|
|
12999
13113
|
return fromNodeModules;
|
|
13000
13114
|
return resolve21(import.meta.dir, "./dev/client");
|
|
13001
13115
|
}, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
@@ -13079,7 +13193,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13079
13193
|
const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
|
|
13080
13194
|
const prevHash = vueSourceHashCache.get(sourceFilePath);
|
|
13081
13195
|
const persistent = persistentBuildCache.get(sourceFilePath);
|
|
13082
|
-
if (prevHash === contentHash && persistent &&
|
|
13196
|
+
if (prevHash === contentHash && persistent && existsSync21(persistent.clientPath) && existsSync21(persistent.serverPath)) {
|
|
13083
13197
|
cacheMap.set(sourceFilePath, persistent);
|
|
13084
13198
|
return persistent;
|
|
13085
13199
|
}
|
|
@@ -13107,12 +13221,12 @@ var resolveDevClientDir3 = () => {
|
|
|
13107
13221
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
13108
13222
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
13109
13223
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
13110
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") ||
|
|
13224
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute5(path)) && isStylePath(path)).map((path) => isAbsolute5(path) ? path : resolve21(dirname15(sourceFilePath), path));
|
|
13111
13225
|
for (const stylePath of stylePathsImported) {
|
|
13112
13226
|
addStyleImporter(sourceFilePath, stylePath);
|
|
13113
13227
|
}
|
|
13114
13228
|
const childBuildResults = await Promise.all([
|
|
13115
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve21(
|
|
13229
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve21(dirname15(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
13116
13230
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
13117
13231
|
]);
|
|
13118
13232
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -13122,7 +13236,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13122
13236
|
sourceMap: true
|
|
13123
13237
|
}) : { bindings: {}, content: "export default {};", map: undefined };
|
|
13124
13238
|
const strippedScript = stripExports2(compiledScript.content);
|
|
13125
|
-
const sourceDir =
|
|
13239
|
+
const sourceDir = dirname15(sourceFilePath);
|
|
13126
13240
|
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
13127
13241
|
const packageImportRewrites = new Map;
|
|
13128
13242
|
for (const [bareImport, absolutePath] of packageComponentPaths) {
|
|
@@ -13161,8 +13275,8 @@ var resolveDevClientDir3 = () => {
|
|
|
13161
13275
|
];
|
|
13162
13276
|
let cssOutputPaths = [];
|
|
13163
13277
|
if (isEntryPoint && allCss.length) {
|
|
13164
|
-
const cssOutputFile =
|
|
13165
|
-
await mkdir5(
|
|
13278
|
+
const cssOutputFile = join28(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
13279
|
+
await mkdir5(dirname15(cssOutputFile), { recursive: true });
|
|
13166
13280
|
await write3(cssOutputFile, allCss.join(`
|
|
13167
13281
|
`));
|
|
13168
13282
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -13192,9 +13306,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13192
13306
|
};
|
|
13193
13307
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
13194
13308
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
13195
|
-
const clientOutputPath =
|
|
13196
|
-
const serverOutputPath =
|
|
13197
|
-
const relDir =
|
|
13309
|
+
const clientOutputPath = join28(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
13310
|
+
const serverOutputPath = join28(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
13311
|
+
const relDir = dirname15(relativeFilePath);
|
|
13198
13312
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
13199
13313
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
13200
13314
|
const upCount = dots.split("/").length - 1;
|
|
@@ -13206,15 +13320,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13206
13320
|
let result2 = code;
|
|
13207
13321
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
13208
13322
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
13209
|
-
let rel = relative12(
|
|
13323
|
+
let rel = relative12(dirname15(outputPath), targetPath).replace(/\\/g, "/");
|
|
13210
13324
|
if (!rel.startsWith("."))
|
|
13211
13325
|
rel = `./${rel}`;
|
|
13212
13326
|
result2 = result2.replaceAll(bareImport, rel);
|
|
13213
13327
|
}
|
|
13214
13328
|
return result2;
|
|
13215
13329
|
};
|
|
13216
|
-
await mkdir5(
|
|
13217
|
-
await mkdir5(
|
|
13330
|
+
await mkdir5(dirname15(clientOutputPath), { recursive: true });
|
|
13331
|
+
await mkdir5(dirname15(serverOutputPath), { recursive: true });
|
|
13218
13332
|
const clientFinal = rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client");
|
|
13219
13333
|
const serverFinal = rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server");
|
|
13220
13334
|
const inlineSourceMapFor = (finalContent) => {
|
|
@@ -13236,7 +13350,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13236
13350
|
hmrId,
|
|
13237
13351
|
serverPath: serverOutputPath,
|
|
13238
13352
|
tsHelperPaths: [
|
|
13239
|
-
...helperModulePaths.map((helper) => resolve21(
|
|
13353
|
+
...helperModulePaths.map((helper) => resolve21(dirname15(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
13240
13354
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
13241
13355
|
]
|
|
13242
13356
|
};
|
|
@@ -13246,10 +13360,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13246
13360
|
}, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors) => {
|
|
13247
13361
|
const compiler = await import("@vue/compiler-sfc");
|
|
13248
13362
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
13249
|
-
const clientOutputDir =
|
|
13250
|
-
const indexOutputDir =
|
|
13251
|
-
const serverOutputDir =
|
|
13252
|
-
const cssOutputDir =
|
|
13363
|
+
const clientOutputDir = join28(generatedDir, "client");
|
|
13364
|
+
const indexOutputDir = join28(generatedDir, "indexes");
|
|
13365
|
+
const serverOutputDir = join28(generatedDir, "server");
|
|
13366
|
+
const cssOutputDir = join28(generatedDir, "compiled");
|
|
13253
13367
|
await Promise.all([
|
|
13254
13368
|
mkdir5(clientOutputDir, { recursive: true }),
|
|
13255
13369
|
mkdir5(indexOutputDir, { recursive: true }),
|
|
@@ -13266,16 +13380,16 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13266
13380
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
13267
13381
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
13268
13382
|
const entryBaseName = basename7(entryPath, ".vue");
|
|
13269
|
-
const indexOutputFile =
|
|
13270
|
-
const clientOutputFile =
|
|
13271
|
-
await mkdir5(
|
|
13383
|
+
const indexOutputFile = join28(indexOutputDir, `${entryBaseName}.js`);
|
|
13384
|
+
const clientOutputFile = join28(clientOutputDir, relative12(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
13385
|
+
await mkdir5(dirname15(indexOutputFile), { recursive: true });
|
|
13272
13386
|
const vueHmrImports = isDev ? [
|
|
13273
13387
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
13274
13388
|
`import "${hmrClientPath4}";`
|
|
13275
13389
|
] : [];
|
|
13276
13390
|
await write3(indexOutputFile, [
|
|
13277
13391
|
...vueHmrImports,
|
|
13278
|
-
`import Comp, * as PageModule from "${relative12(
|
|
13392
|
+
`import Comp, * as PageModule from "${relative12(dirname15(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
13279
13393
|
'import { createSSRApp, createApp } from "vue";',
|
|
13280
13394
|
"",
|
|
13281
13395
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -13420,10 +13534,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13420
13534
|
const sourceCode = await file2(tsPath).text();
|
|
13421
13535
|
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
13422
13536
|
const relativeJsPath = relative12(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
13423
|
-
const outClientPath =
|
|
13424
|
-
const outServerPath =
|
|
13425
|
-
await mkdir5(
|
|
13426
|
-
await mkdir5(
|
|
13537
|
+
const outClientPath = join28(clientOutputDir, relativeJsPath);
|
|
13538
|
+
const outServerPath = join28(serverOutputDir, relativeJsPath);
|
|
13539
|
+
await mkdir5(dirname15(outClientPath), { recursive: true });
|
|
13540
|
+
await mkdir5(dirname15(outServerPath), { recursive: true });
|
|
13427
13541
|
await write3(outClientPath, transpiledCode);
|
|
13428
13542
|
await write3(outServerPath, transpiledCode);
|
|
13429
13543
|
}));
|
|
@@ -13444,7 +13558,7 @@ var init_compileVue = __esm(() => {
|
|
|
13444
13558
|
init_vueAutoRouterTransform();
|
|
13445
13559
|
init_stylePreprocessor();
|
|
13446
13560
|
devClientDir3 = resolveDevClientDir3();
|
|
13447
|
-
hmrClientPath4 =
|
|
13561
|
+
hmrClientPath4 = join28(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
13448
13562
|
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
13449
13563
|
scriptCache = new Map;
|
|
13450
13564
|
scriptSetupCache = new Map;
|
|
@@ -13925,17 +14039,17 @@ __export(exports_compileAngular, {
|
|
|
13925
14039
|
compileAngularFile: () => compileAngularFile,
|
|
13926
14040
|
compileAngular: () => compileAngular
|
|
13927
14041
|
});
|
|
13928
|
-
import { existsSync as
|
|
13929
|
-
import { join as
|
|
14042
|
+
import { existsSync as existsSync22, readFileSync as readFileSync16, promises as fs5 } from "fs";
|
|
14043
|
+
import { join as join29, basename as basename8, sep as sep3, dirname as dirname16, resolve as resolve22, relative as relative13 } from "path";
|
|
13930
14044
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
13931
|
-
import
|
|
14045
|
+
import ts9 from "typescript";
|
|
13932
14046
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
13933
14047
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
13934
14048
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata) : await fn2();
|
|
13935
14049
|
}, readTsconfigPathAliases = () => {
|
|
13936
14050
|
try {
|
|
13937
14051
|
const configPath2 = resolve22(process.cwd(), "tsconfig.json");
|
|
13938
|
-
const config =
|
|
14052
|
+
const config = ts9.readConfigFile(configPath2, ts9.sys.readFile).config;
|
|
13939
14053
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
13940
14054
|
const baseUrl = resolve22(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
13941
14055
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
@@ -13969,12 +14083,12 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
13969
14083
|
`${candidate}.tsx`,
|
|
13970
14084
|
`${candidate}.js`,
|
|
13971
14085
|
`${candidate}.jsx`,
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
14086
|
+
join29(candidate, "index.ts"),
|
|
14087
|
+
join29(candidate, "index.tsx"),
|
|
14088
|
+
join29(candidate, "index.js"),
|
|
14089
|
+
join29(candidate, "index.jsx")
|
|
13976
14090
|
];
|
|
13977
|
-
return candidates.find((file3) =>
|
|
14091
|
+
return candidates.find((file3) => existsSync22(file3));
|
|
13978
14092
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
13979
14093
|
const baseDir = resolve22(rootDir);
|
|
13980
14094
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
@@ -14044,7 +14158,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14044
14158
|
if (scan.usesLegacyAnimations)
|
|
14045
14159
|
return true;
|
|
14046
14160
|
for (const specifier of scan.imports) {
|
|
14047
|
-
const importedPath = resolveLocalImport(specifier,
|
|
14161
|
+
const importedPath = resolveLocalImport(specifier, dirname16(resolved));
|
|
14048
14162
|
if (importedPath && await visit(importedPath, visited)) {
|
|
14049
14163
|
return true;
|
|
14050
14164
|
}
|
|
@@ -14055,16 +14169,16 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14055
14169
|
}, resolveDevClientDir4 = () => {
|
|
14056
14170
|
const projectRoot = process.cwd();
|
|
14057
14171
|
const fromSource = resolve22(import.meta.dir, "../dev/client");
|
|
14058
|
-
if (
|
|
14172
|
+
if (existsSync22(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
14059
14173
|
return fromSource;
|
|
14060
14174
|
}
|
|
14061
14175
|
const fromNodeModules = resolve22(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
14062
|
-
if (
|
|
14176
|
+
if (existsSync22(fromNodeModules))
|
|
14063
14177
|
return fromNodeModules;
|
|
14064
14178
|
return resolve22(import.meta.dir, "./dev/client");
|
|
14065
14179
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
14066
14180
|
try {
|
|
14067
|
-
return
|
|
14181
|
+
return ts9.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
14068
14182
|
`);
|
|
14069
14183
|
} catch {
|
|
14070
14184
|
return String(diagnostic.messageText || "Unknown error");
|
|
@@ -14072,7 +14186,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14072
14186
|
}, throwOnCompilationErrors = (diagnostics) => {
|
|
14073
14187
|
if (!diagnostics?.length)
|
|
14074
14188
|
return;
|
|
14075
|
-
const errors = diagnostics.filter((diag) => diag.category ===
|
|
14189
|
+
const errors = diagnostics.filter((diag) => diag.category === ts9.DiagnosticCategory.Error);
|
|
14076
14190
|
if (!errors.length)
|
|
14077
14191
|
return;
|
|
14078
14192
|
const fullMessage = errors.map(formatDiagnosticMessage).join(`
|
|
@@ -14103,51 +14217,51 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14103
14217
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
14104
14218
|
if (hasJsLikeExtension(path))
|
|
14105
14219
|
return `${path}${query}`;
|
|
14106
|
-
const importerDir =
|
|
14220
|
+
const importerDir = dirname16(importerOutputPath);
|
|
14107
14221
|
const fileCandidate = resolve22(importerDir, `${path}.js`);
|
|
14108
|
-
if (outputFiles?.has(fileCandidate) ||
|
|
14222
|
+
if (outputFiles?.has(fileCandidate) || existsSync22(fileCandidate)) {
|
|
14109
14223
|
return `${path}.js${query}`;
|
|
14110
14224
|
}
|
|
14111
14225
|
const indexCandidate = resolve22(importerDir, path, "index.js");
|
|
14112
|
-
if (outputFiles?.has(indexCandidate) ||
|
|
14226
|
+
if (outputFiles?.has(indexCandidate) || existsSync22(indexCandidate)) {
|
|
14113
14227
|
return `${path}/index.js${query}`;
|
|
14114
14228
|
}
|
|
14115
14229
|
return `${path}.js${query}`;
|
|
14116
14230
|
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
14117
|
-
const sourceFile =
|
|
14231
|
+
const sourceFile = ts9.createSourceFile(fileName, source, ts9.ScriptTarget.Latest, true, ts9.ScriptKind.TS);
|
|
14118
14232
|
const specifiers = [];
|
|
14119
14233
|
const addSpecifier = (node) => {
|
|
14120
|
-
if (!node || !
|
|
14234
|
+
if (!node || !ts9.isStringLiteralLike(node))
|
|
14121
14235
|
return;
|
|
14122
14236
|
const specifier = node.text;
|
|
14123
14237
|
if (isRelativeModuleSpecifier(specifier))
|
|
14124
14238
|
specifiers.push(specifier);
|
|
14125
14239
|
};
|
|
14126
14240
|
const visit = (node) => {
|
|
14127
|
-
if (
|
|
14241
|
+
if (ts9.isImportDeclaration(node) || ts9.isExportDeclaration(node)) {
|
|
14128
14242
|
addSpecifier(node.moduleSpecifier);
|
|
14129
|
-
} else if (
|
|
14243
|
+
} else if (ts9.isCallExpression(node) && node.expression.kind === ts9.SyntaxKind.ImportKeyword) {
|
|
14130
14244
|
addSpecifier(node.arguments[0]);
|
|
14131
14245
|
}
|
|
14132
|
-
|
|
14246
|
+
ts9.forEachChild(node, visit);
|
|
14133
14247
|
};
|
|
14134
14248
|
visit(sourceFile);
|
|
14135
14249
|
return specifiers;
|
|
14136
14250
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
14137
14251
|
if (!isRelativeModuleSpecifier(specifier))
|
|
14138
14252
|
return null;
|
|
14139
|
-
const basePath = resolve22(
|
|
14253
|
+
const basePath = resolve22(dirname16(fromFile), specifier);
|
|
14140
14254
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
14141
14255
|
`${basePath}.ts`,
|
|
14142
14256
|
`${basePath}.tsx`,
|
|
14143
14257
|
`${basePath}.mts`,
|
|
14144
14258
|
`${basePath}.cts`,
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14259
|
+
join29(basePath, "index.ts"),
|
|
14260
|
+
join29(basePath, "index.tsx"),
|
|
14261
|
+
join29(basePath, "index.mts"),
|
|
14262
|
+
join29(basePath, "index.cts")
|
|
14149
14263
|
];
|
|
14150
|
-
return candidates.map((candidate) => resolve22(candidate)).find((candidate) =>
|
|
14264
|
+
return candidates.map((candidate) => resolve22(candidate)).find((candidate) => existsSync22(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
14151
14265
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
14152
14266
|
const hostSource = readFile6?.(fileName);
|
|
14153
14267
|
if (typeof hostSource === "string")
|
|
@@ -14171,15 +14285,15 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14171
14285
|
const paths = [];
|
|
14172
14286
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14173
14287
|
if (templateUrlMatch?.[1])
|
|
14174
|
-
paths.push(
|
|
14288
|
+
paths.push(join29(fileDir, templateUrlMatch[1]));
|
|
14175
14289
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14176
14290
|
if (styleUrlMatch?.[1])
|
|
14177
|
-
paths.push(
|
|
14291
|
+
paths.push(join29(fileDir, styleUrlMatch[1]));
|
|
14178
14292
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
14179
14293
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
14180
14294
|
if (urlMatches) {
|
|
14181
14295
|
for (const urlMatch of urlMatches) {
|
|
14182
|
-
paths.push(
|
|
14296
|
+
paths.push(join29(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
14183
14297
|
}
|
|
14184
14298
|
}
|
|
14185
14299
|
return paths.map((path) => resolve22(path));
|
|
@@ -14194,13 +14308,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14194
14308
|
return null;
|
|
14195
14309
|
}
|
|
14196
14310
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
14197
|
-
await fs5.mkdir(
|
|
14311
|
+
await fs5.mkdir(dirname16(cachePath), { recursive: true });
|
|
14198
14312
|
await fs5.writeFile(cachePath, JSON.stringify({
|
|
14199
14313
|
source,
|
|
14200
14314
|
version: 1
|
|
14201
14315
|
}), "utf-8");
|
|
14202
14316
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
14203
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
14317
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname16(filePath));
|
|
14204
14318
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
14205
14319
|
const content = await fs5.readFile(resourcePath, "utf-8");
|
|
14206
14320
|
return `${resourcePath}\x00${content}`;
|
|
@@ -14213,7 +14327,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14213
14327
|
safeStableStringify(stylePreprocessors ?? null)
|
|
14214
14328
|
].join("\x00");
|
|
14215
14329
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
14216
|
-
return
|
|
14330
|
+
return join29(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
14217
14331
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
14218
14332
|
const transformedSources = new Map;
|
|
14219
14333
|
const visited = new Set;
|
|
@@ -14228,7 +14342,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14228
14342
|
if (visited.has(resolvedPath))
|
|
14229
14343
|
return;
|
|
14230
14344
|
visited.add(resolvedPath);
|
|
14231
|
-
if (!
|
|
14345
|
+
if (!existsSync22(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
14232
14346
|
return;
|
|
14233
14347
|
stats.filesVisited += 1;
|
|
14234
14348
|
const source = await readFileForAotTransform(resolvedPath, readFile6);
|
|
@@ -14240,7 +14354,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14240
14354
|
transformedSource = cached.source;
|
|
14241
14355
|
} else {
|
|
14242
14356
|
stats.cacheMisses += 1;
|
|
14243
|
-
const transformed = await inlineResources(source,
|
|
14357
|
+
const transformed = await inlineResources(source, dirname16(resolvedPath), stylePreprocessors);
|
|
14244
14358
|
transformedSource = transformed.source;
|
|
14245
14359
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
14246
14360
|
}
|
|
@@ -14259,17 +14373,17 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14259
14373
|
return { stats, transformedSources };
|
|
14260
14374
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
14261
14375
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
14262
|
-
const outputPath = resolve22(
|
|
14376
|
+
const outputPath = resolve22(join29(outDir, relative13(process.cwd(), resolve22(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
14263
14377
|
return [
|
|
14264
14378
|
outputPath,
|
|
14265
|
-
buildIslandMetadataExports(
|
|
14379
|
+
buildIslandMetadataExports(readFileSync16(inputPath, "utf-8"))
|
|
14266
14380
|
];
|
|
14267
14381
|
})), { entries: inputPaths.length });
|
|
14268
14382
|
await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
|
|
14269
14383
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
14270
14384
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
14271
14385
|
const tsPath = __require.resolve("typescript");
|
|
14272
|
-
const tsRootDir =
|
|
14386
|
+
const tsRootDir = dirname16(tsPath);
|
|
14273
14387
|
return tsRootDir.endsWith("lib") ? tsRootDir : resolve22(tsRootDir, "lib");
|
|
14274
14388
|
});
|
|
14275
14389
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
@@ -14277,25 +14391,25 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14277
14391
|
emitDecoratorMetadata: true,
|
|
14278
14392
|
esModuleInterop: true,
|
|
14279
14393
|
experimentalDecorators: true,
|
|
14280
|
-
module:
|
|
14281
|
-
moduleResolution:
|
|
14282
|
-
newLine:
|
|
14394
|
+
module: ts9.ModuleKind.ESNext,
|
|
14395
|
+
moduleResolution: ts9.ModuleResolutionKind.Bundler,
|
|
14396
|
+
newLine: ts9.NewLineKind.LineFeed,
|
|
14283
14397
|
noLib: false,
|
|
14284
14398
|
outDir,
|
|
14285
14399
|
skipLibCheck: true,
|
|
14286
|
-
target:
|
|
14400
|
+
target: ts9.ScriptTarget.ES2022,
|
|
14287
14401
|
...config.options
|
|
14288
14402
|
};
|
|
14289
|
-
options.target =
|
|
14403
|
+
options.target = ts9.ScriptTarget.ES2022;
|
|
14290
14404
|
options.experimentalDecorators = true;
|
|
14291
14405
|
options.emitDecoratorMetadata = true;
|
|
14292
|
-
options.newLine =
|
|
14406
|
+
options.newLine = ts9.NewLineKind.LineFeed;
|
|
14293
14407
|
options.outDir = outDir;
|
|
14294
14408
|
options.noEmit = false;
|
|
14295
14409
|
options.incremental = false;
|
|
14296
14410
|
options.tsBuildInfoFile = undefined;
|
|
14297
14411
|
options.rootDir = process.cwd();
|
|
14298
|
-
const host = await traceAngularPhase("aot/create-compiler-host", () =>
|
|
14412
|
+
const host = await traceAngularPhase("aot/create-compiler-host", () => ts9.createCompilerHost(options));
|
|
14299
14413
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
14300
14414
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
14301
14415
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
@@ -14306,7 +14420,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14306
14420
|
const originalGetSourceFile = host.getSourceFile;
|
|
14307
14421
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14308
14422
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
14309
|
-
const resolvedPath =
|
|
14423
|
+
const resolvedPath = join29(tsLibDir, fileName);
|
|
14310
14424
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
14311
14425
|
}
|
|
14312
14426
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
@@ -14341,7 +14455,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14341
14455
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14342
14456
|
const source = transformedSources.get(resolve22(fileName));
|
|
14343
14457
|
if (source) {
|
|
14344
|
-
return
|
|
14458
|
+
return ts9.createSourceFile(fileName, source, languageVersion, true);
|
|
14345
14459
|
}
|
|
14346
14460
|
return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError);
|
|
14347
14461
|
};
|
|
@@ -14361,7 +14475,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14361
14475
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
14362
14476
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
14363
14477
|
content,
|
|
14364
|
-
target:
|
|
14478
|
+
target: join29(outDir, fileName)
|
|
14365
14479
|
}));
|
|
14366
14480
|
const outputFiles = new Set(rawEntries.map(({ target }) => resolve22(target)));
|
|
14367
14481
|
return rawEntries.map(({ content, target }) => {
|
|
@@ -14383,7 +14497,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14383
14497
|
});
|
|
14384
14498
|
});
|
|
14385
14499
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
14386
|
-
await fs5.mkdir(
|
|
14500
|
+
await fs5.mkdir(dirname16(target), { recursive: true });
|
|
14387
14501
|
await fs5.writeFile(target, content, "utf-8");
|
|
14388
14502
|
})), { outputs: entries.length });
|
|
14389
14503
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -14402,7 +14516,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14402
14516
|
return null;
|
|
14403
14517
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
14404
14518
|
const sourceEntry = resolve22(import.meta.dir, "../angular/components/index.ts");
|
|
14405
|
-
if (
|
|
14519
|
+
if (existsSync22(sourceEntry)) {
|
|
14406
14520
|
return sourceEntry.replace(/\\/g, "/");
|
|
14407
14521
|
}
|
|
14408
14522
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -14530,7 +14644,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
14530
14644
|
${fields}
|
|
14531
14645
|
`);
|
|
14532
14646
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
14533
|
-
if (!
|
|
14647
|
+
if (!existsSync22(filePath)) {
|
|
14534
14648
|
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
14535
14649
|
}
|
|
14536
14650
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
@@ -14538,8 +14652,8 @@ ${fields}
|
|
|
14538
14652
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
14539
14653
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14540
14654
|
if (templateUrlMatch?.[1]) {
|
|
14541
|
-
const templatePath =
|
|
14542
|
-
if (!
|
|
14655
|
+
const templatePath = join29(fileDir, templateUrlMatch[1]);
|
|
14656
|
+
if (!existsSync22(templatePath)) {
|
|
14543
14657
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14544
14658
|
}
|
|
14545
14659
|
const templateRaw2 = await fs5.readFile(templatePath, "utf-8");
|
|
@@ -14569,11 +14683,11 @@ ${fields}
|
|
|
14569
14683
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
14570
14684
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14571
14685
|
if (templateUrlMatch?.[1]) {
|
|
14572
|
-
const templatePath =
|
|
14573
|
-
if (!
|
|
14686
|
+
const templatePath = join29(fileDir, templateUrlMatch[1]);
|
|
14687
|
+
if (!existsSync22(templatePath)) {
|
|
14574
14688
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14575
14689
|
}
|
|
14576
|
-
const templateRaw2 =
|
|
14690
|
+
const templateRaw2 = readFileSync16(templatePath, "utf-8");
|
|
14577
14691
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
14578
14692
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
14579
14693
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -14606,7 +14720,7 @@ ${fields}
|
|
|
14606
14720
|
return source;
|
|
14607
14721
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
14608
14722
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
14609
|
-
return readAndEscapeFile(
|
|
14723
|
+
return readAndEscapeFile(join29(fileDir, styleUrl), stylePreprocessors);
|
|
14610
14724
|
});
|
|
14611
14725
|
const results = await Promise.all(stylePromises);
|
|
14612
14726
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -14617,7 +14731,7 @@ ${fields}
|
|
|
14617
14731
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14618
14732
|
if (!styleUrlMatch?.[1])
|
|
14619
14733
|
return source;
|
|
14620
|
-
const escaped = await readAndEscapeFile(
|
|
14734
|
+
const escaped = await readAndEscapeFile(join29(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
14621
14735
|
if (!escaped)
|
|
14622
14736
|
return source;
|
|
14623
14737
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -14653,12 +14767,12 @@ ${fields}
|
|
|
14653
14767
|
`${candidate}.js`,
|
|
14654
14768
|
`${candidate}.jsx`,
|
|
14655
14769
|
`${candidate}.json`,
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14770
|
+
join29(candidate, "index.ts"),
|
|
14771
|
+
join29(candidate, "index.tsx"),
|
|
14772
|
+
join29(candidate, "index.js"),
|
|
14773
|
+
join29(candidate, "index.jsx")
|
|
14660
14774
|
];
|
|
14661
|
-
return candidates.find((file3) =>
|
|
14775
|
+
return candidates.find((file3) => existsSync22(file3));
|
|
14662
14776
|
};
|
|
14663
14777
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
14664
14778
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
@@ -14680,10 +14794,10 @@ ${fields}
|
|
|
14680
14794
|
}
|
|
14681
14795
|
};
|
|
14682
14796
|
const toOutputPath = (sourcePath) => {
|
|
14683
|
-
const inputDir =
|
|
14797
|
+
const inputDir = dirname16(sourcePath);
|
|
14684
14798
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14685
14799
|
const fileBase = basename8(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14686
|
-
return
|
|
14800
|
+
return join29(outDir, relativeDir, fileBase);
|
|
14687
14801
|
};
|
|
14688
14802
|
const withCacheBuster = (specifier) => {
|
|
14689
14803
|
if (!cacheBuster)
|
|
@@ -14730,11 +14844,11 @@ ${fields}
|
|
|
14730
14844
|
if (visited.has(resolved))
|
|
14731
14845
|
return;
|
|
14732
14846
|
visited.add(resolved);
|
|
14733
|
-
if (resolved.endsWith(".json") &&
|
|
14734
|
-
const inputDir2 =
|
|
14847
|
+
if (resolved.endsWith(".json") && existsSync22(resolved)) {
|
|
14848
|
+
const inputDir2 = dirname16(resolved);
|
|
14735
14849
|
const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
|
|
14736
|
-
const targetDir2 =
|
|
14737
|
-
const targetPath2 =
|
|
14850
|
+
const targetDir2 = join29(outDir, relativeDir2);
|
|
14851
|
+
const targetPath2 = join29(targetDir2, basename8(resolved));
|
|
14738
14852
|
await fs5.mkdir(targetDir2, { recursive: true });
|
|
14739
14853
|
await fs5.copyFile(resolved, targetPath2);
|
|
14740
14854
|
allOutputs.push(targetPath2);
|
|
@@ -14743,15 +14857,15 @@ ${fields}
|
|
|
14743
14857
|
let actualPath = resolved;
|
|
14744
14858
|
if (!actualPath.endsWith(".ts"))
|
|
14745
14859
|
actualPath += ".ts";
|
|
14746
|
-
if (!
|
|
14860
|
+
if (!existsSync22(actualPath))
|
|
14747
14861
|
return;
|
|
14748
14862
|
let sourceCode = await fs5.readFile(actualPath, "utf-8");
|
|
14749
|
-
const inlined = await inlineResources(sourceCode,
|
|
14750
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
14751
|
-
const inputDir =
|
|
14863
|
+
const inlined = await inlineResources(sourceCode, dirname16(actualPath), stylePreprocessors);
|
|
14864
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname16(actualPath)).source;
|
|
14865
|
+
const inputDir = dirname16(actualPath);
|
|
14752
14866
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14753
14867
|
const fileBase = basename8(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14754
|
-
const targetDir =
|
|
14868
|
+
const targetDir = join29(outDir, relativeDir);
|
|
14755
14869
|
const targetPath = toOutputPath(actualPath);
|
|
14756
14870
|
const localImports = [];
|
|
14757
14871
|
const importRewrites = new Map;
|
|
@@ -14781,7 +14895,7 @@ ${fields}
|
|
|
14781
14895
|
const isEntry = resolve22(actualPath) === resolve22(entryPath);
|
|
14782
14896
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
14783
14897
|
const cacheKey2 = actualPath;
|
|
14784
|
-
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !
|
|
14898
|
+
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync22(targetPath);
|
|
14785
14899
|
if (shouldWriteFile) {
|
|
14786
14900
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
14787
14901
|
await fs5.mkdir(targetDir, { recursive: true });
|
|
@@ -14793,7 +14907,7 @@ ${fields}
|
|
|
14793
14907
|
};
|
|
14794
14908
|
await transpileFile(inputPath);
|
|
14795
14909
|
const entryOutputPath = toOutputPath(entryPath);
|
|
14796
|
-
if (
|
|
14910
|
+
if (existsSync22(entryOutputPath)) {
|
|
14797
14911
|
const entryOutput = await fs5.readFile(entryOutputPath, "utf-8");
|
|
14798
14912
|
const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
|
|
14799
14913
|
`);
|
|
@@ -14812,24 +14926,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14812
14926
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
14813
14927
|
}
|
|
14814
14928
|
const compiledRoot = compiledParent;
|
|
14815
|
-
const indexesDir =
|
|
14929
|
+
const indexesDir = join29(compiledParent, "indexes");
|
|
14816
14930
|
await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
|
|
14817
14931
|
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve22(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
14818
14932
|
if (!hmr) {
|
|
14819
14933
|
await traceAngularPhase("aot/copy-json-resources", async () => {
|
|
14820
14934
|
const cwd = process.cwd();
|
|
14821
14935
|
const angularSrcDir = resolve22(outRoot);
|
|
14822
|
-
if (!
|
|
14936
|
+
if (!existsSync22(angularSrcDir))
|
|
14823
14937
|
return;
|
|
14824
14938
|
const jsonGlob = new Glob6("**/*.json");
|
|
14825
14939
|
for (const rel of jsonGlob.scanSync({
|
|
14826
14940
|
absolute: false,
|
|
14827
14941
|
cwd: angularSrcDir
|
|
14828
14942
|
})) {
|
|
14829
|
-
const sourcePath =
|
|
14943
|
+
const sourcePath = join29(angularSrcDir, rel);
|
|
14830
14944
|
const cwdRel = relative13(cwd, sourcePath);
|
|
14831
|
-
const targetPath =
|
|
14832
|
-
await fs5.mkdir(
|
|
14945
|
+
const targetPath = join29(compiledRoot, cwdRel);
|
|
14946
|
+
await fs5.mkdir(dirname16(targetPath), { recursive: true });
|
|
14833
14947
|
await fs5.copyFile(sourcePath, targetPath);
|
|
14834
14948
|
}
|
|
14835
14949
|
});
|
|
@@ -14845,24 +14959,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14845
14959
|
const fileBase = basename8(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
14846
14960
|
const jsName = `${fileBase}.js`;
|
|
14847
14961
|
const compiledFallbackPaths = [
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
|
|
14962
|
+
join29(compiledRoot, relativeEntry),
|
|
14963
|
+
join29(compiledRoot, "pages", jsName),
|
|
14964
|
+
join29(compiledRoot, jsName)
|
|
14851
14965
|
].map((file3) => resolve22(file3));
|
|
14852
14966
|
const resolveRawServerFile = (candidatePaths) => {
|
|
14853
14967
|
const normalizedCandidates = [
|
|
14854
14968
|
...candidatePaths.map((file3) => resolve22(file3)),
|
|
14855
14969
|
...compiledFallbackPaths
|
|
14856
14970
|
];
|
|
14857
|
-
let candidate = normalizedCandidates.find((file3) =>
|
|
14971
|
+
let candidate = normalizedCandidates.find((file3) => existsSync22(file3) && file3.endsWith(`${sep3}${relativeEntry}`));
|
|
14858
14972
|
if (!candidate) {
|
|
14859
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
14973
|
+
candidate = normalizedCandidates.find((file3) => existsSync22(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
14860
14974
|
}
|
|
14861
14975
|
if (!candidate) {
|
|
14862
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
14976
|
+
candidate = normalizedCandidates.find((file3) => existsSync22(file3) && file3.endsWith(`${sep3}${jsName}`));
|
|
14863
14977
|
}
|
|
14864
14978
|
if (!candidate) {
|
|
14865
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
14979
|
+
candidate = normalizedCandidates.find((file3) => existsSync22(file3));
|
|
14866
14980
|
}
|
|
14867
14981
|
return candidate;
|
|
14868
14982
|
};
|
|
@@ -14870,11 +14984,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14870
14984
|
if (!rawServerFile) {
|
|
14871
14985
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
|
|
14872
14986
|
}
|
|
14873
|
-
if (rawServerFile && !
|
|
14987
|
+
if (rawServerFile && !existsSync22(rawServerFile)) {
|
|
14874
14988
|
outputs = hmr ? await compileEntry() : aotOutputs;
|
|
14875
14989
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
|
|
14876
14990
|
}
|
|
14877
|
-
if (!rawServerFile || !
|
|
14991
|
+
if (!rawServerFile || !existsSync22(rawServerFile)) {
|
|
14878
14992
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
14879
14993
|
...outputs,
|
|
14880
14994
|
...compiledFallbackPaths
|
|
@@ -14895,8 +15009,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14895
15009
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
14896
15010
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
14897
15011
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
14898
|
-
const clientFile =
|
|
14899
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
15012
|
+
const clientFile = join29(indexesDir, jsName);
|
|
15013
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync22(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
14900
15014
|
return {
|
|
14901
15015
|
clientPath: clientFile,
|
|
14902
15016
|
indexUnchanged: true,
|
|
@@ -14924,8 +15038,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14924
15038
|
const relativePath = relative13(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
14925
15039
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
14926
15040
|
const manifestKeyForProviders = toPascal(fileBase);
|
|
14927
|
-
const providersFilePath =
|
|
14928
|
-
const hasGeneratedProviders =
|
|
15041
|
+
const providersFilePath = join29(compiledParent, "providers", `${manifestKeyForProviders}.providers.ts`);
|
|
15042
|
+
const hasGeneratedProviders = existsSync22(providersFilePath);
|
|
14929
15043
|
const providersImportPath = hasGeneratedProviders ? (() => {
|
|
14930
15044
|
const rel = relative13(indexesDir, providersFilePath.replace(/\.ts$/, "")).replace(/\\/g, "/");
|
|
14931
15045
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
@@ -15131,24 +15245,24 @@ var init_compileAngular = __esm(() => {
|
|
|
15131
15245
|
init_stylePreprocessor();
|
|
15132
15246
|
init_generatedDir();
|
|
15133
15247
|
devClientDir4 = resolveDevClientDir4();
|
|
15134
|
-
hmrClientPath5 =
|
|
15248
|
+
hmrClientPath5 = join29(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
15135
15249
|
jitContentCache = new Map;
|
|
15136
15250
|
wrapperOutputCache = new Map;
|
|
15137
15251
|
});
|
|
15138
15252
|
|
|
15139
15253
|
// src/dev/angular/hmrImportGenerator.ts
|
|
15140
|
-
import
|
|
15254
|
+
import ts10 from "typescript";
|
|
15141
15255
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
15142
15256
|
addImport(request) {
|
|
15143
15257
|
const ns = namespaceMap.get(request.exportModuleSpecifier);
|
|
15144
15258
|
if (!ns) {
|
|
15145
15259
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
15146
15260
|
}
|
|
15147
|
-
const namespaceId =
|
|
15261
|
+
const namespaceId = ts10.factory.createIdentifier(ns);
|
|
15148
15262
|
if (request.exportSymbolName === null) {
|
|
15149
15263
|
return namespaceId;
|
|
15150
15264
|
}
|
|
15151
|
-
return
|
|
15265
|
+
return ts10.factory.createPropertyAccessExpression(namespaceId, ts10.factory.createIdentifier(request.exportSymbolName));
|
|
15152
15266
|
}
|
|
15153
15267
|
});
|
|
15154
15268
|
var init_hmrImportGenerator = () => {};
|
|
@@ -15521,13 +15635,13 @@ var init_translator = __esm(() => {
|
|
|
15521
15635
|
});
|
|
15522
15636
|
|
|
15523
15637
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
15524
|
-
import
|
|
15638
|
+
import ts11 from "typescript";
|
|
15525
15639
|
function tsNumericExpression(value) {
|
|
15526
15640
|
if (value < 0) {
|
|
15527
|
-
const operand =
|
|
15528
|
-
return
|
|
15641
|
+
const operand = ts11.factory.createNumericLiteral(Math.abs(value));
|
|
15642
|
+
return ts11.factory.createPrefixUnaryExpression(ts11.SyntaxKind.MinusToken, operand);
|
|
15529
15643
|
}
|
|
15530
|
-
return
|
|
15644
|
+
return ts11.factory.createNumericLiteral(value);
|
|
15531
15645
|
}
|
|
15532
15646
|
var init_ts_util = __esm(() => {
|
|
15533
15647
|
/*!
|
|
@@ -15540,142 +15654,142 @@ var init_ts_util = __esm(() => {
|
|
|
15540
15654
|
});
|
|
15541
15655
|
|
|
15542
15656
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
15543
|
-
import
|
|
15657
|
+
import ts12 from "typescript";
|
|
15544
15658
|
|
|
15545
15659
|
class TypeScriptAstFactory {
|
|
15546
15660
|
annotateForClosureCompiler;
|
|
15547
15661
|
externalSourceFiles = new Map;
|
|
15548
15662
|
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
15549
|
-
"+":
|
|
15550
|
-
"-":
|
|
15551
|
-
"!":
|
|
15663
|
+
"+": ts12.SyntaxKind.PlusToken,
|
|
15664
|
+
"-": ts12.SyntaxKind.MinusToken,
|
|
15665
|
+
"!": ts12.SyntaxKind.ExclamationToken
|
|
15552
15666
|
}))();
|
|
15553
15667
|
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
15554
|
-
"&&":
|
|
15555
|
-
">":
|
|
15556
|
-
">=":
|
|
15557
|
-
"&":
|
|
15558
|
-
"|":
|
|
15559
|
-
"/":
|
|
15560
|
-
"==":
|
|
15561
|
-
"===":
|
|
15562
|
-
"<":
|
|
15563
|
-
"<=":
|
|
15564
|
-
"-":
|
|
15565
|
-
"%":
|
|
15566
|
-
"*":
|
|
15567
|
-
"**":
|
|
15568
|
-
"!=":
|
|
15569
|
-
"!==":
|
|
15570
|
-
"||":
|
|
15571
|
-
"+":
|
|
15572
|
-
"??":
|
|
15573
|
-
"=":
|
|
15574
|
-
"+=":
|
|
15575
|
-
"-=":
|
|
15576
|
-
"*=":
|
|
15577
|
-
"/=":
|
|
15578
|
-
"%=":
|
|
15579
|
-
"**=":
|
|
15580
|
-
"&&=":
|
|
15581
|
-
"||=":
|
|
15582
|
-
"??=":
|
|
15583
|
-
in:
|
|
15584
|
-
instanceof:
|
|
15668
|
+
"&&": ts12.SyntaxKind.AmpersandAmpersandToken,
|
|
15669
|
+
">": ts12.SyntaxKind.GreaterThanToken,
|
|
15670
|
+
">=": ts12.SyntaxKind.GreaterThanEqualsToken,
|
|
15671
|
+
"&": ts12.SyntaxKind.AmpersandToken,
|
|
15672
|
+
"|": ts12.SyntaxKind.BarToken,
|
|
15673
|
+
"/": ts12.SyntaxKind.SlashToken,
|
|
15674
|
+
"==": ts12.SyntaxKind.EqualsEqualsToken,
|
|
15675
|
+
"===": ts12.SyntaxKind.EqualsEqualsEqualsToken,
|
|
15676
|
+
"<": ts12.SyntaxKind.LessThanToken,
|
|
15677
|
+
"<=": ts12.SyntaxKind.LessThanEqualsToken,
|
|
15678
|
+
"-": ts12.SyntaxKind.MinusToken,
|
|
15679
|
+
"%": ts12.SyntaxKind.PercentToken,
|
|
15680
|
+
"*": ts12.SyntaxKind.AsteriskToken,
|
|
15681
|
+
"**": ts12.SyntaxKind.AsteriskAsteriskToken,
|
|
15682
|
+
"!=": ts12.SyntaxKind.ExclamationEqualsToken,
|
|
15683
|
+
"!==": ts12.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
15684
|
+
"||": ts12.SyntaxKind.BarBarToken,
|
|
15685
|
+
"+": ts12.SyntaxKind.PlusToken,
|
|
15686
|
+
"??": ts12.SyntaxKind.QuestionQuestionToken,
|
|
15687
|
+
"=": ts12.SyntaxKind.EqualsToken,
|
|
15688
|
+
"+=": ts12.SyntaxKind.PlusEqualsToken,
|
|
15689
|
+
"-=": ts12.SyntaxKind.MinusEqualsToken,
|
|
15690
|
+
"*=": ts12.SyntaxKind.AsteriskEqualsToken,
|
|
15691
|
+
"/=": ts12.SyntaxKind.SlashEqualsToken,
|
|
15692
|
+
"%=": ts12.SyntaxKind.PercentEqualsToken,
|
|
15693
|
+
"**=": ts12.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
15694
|
+
"&&=": ts12.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
15695
|
+
"||=": ts12.SyntaxKind.BarBarEqualsToken,
|
|
15696
|
+
"??=": ts12.SyntaxKind.QuestionQuestionEqualsToken,
|
|
15697
|
+
in: ts12.SyntaxKind.InKeyword,
|
|
15698
|
+
instanceof: ts12.SyntaxKind.InstanceOfKeyword
|
|
15585
15699
|
}))();
|
|
15586
15700
|
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
15587
|
-
const:
|
|
15588
|
-
let:
|
|
15589
|
-
var:
|
|
15701
|
+
const: ts12.NodeFlags.Const,
|
|
15702
|
+
let: ts12.NodeFlags.Let,
|
|
15703
|
+
var: ts12.NodeFlags.None
|
|
15590
15704
|
}))();
|
|
15591
15705
|
constructor(annotateForClosureCompiler) {
|
|
15592
15706
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
15593
15707
|
}
|
|
15594
15708
|
attachComments = attachComments;
|
|
15595
|
-
createArrayLiteral =
|
|
15709
|
+
createArrayLiteral = ts12.factory.createArrayLiteralExpression;
|
|
15596
15710
|
createAssignment(target, operator, value) {
|
|
15597
|
-
return
|
|
15711
|
+
return ts12.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
15598
15712
|
}
|
|
15599
15713
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
15600
|
-
return
|
|
15714
|
+
return ts12.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
15601
15715
|
}
|
|
15602
15716
|
createBlock(body) {
|
|
15603
|
-
return
|
|
15717
|
+
return ts12.factory.createBlock(body);
|
|
15604
15718
|
}
|
|
15605
15719
|
createCallExpression(callee, args, pure) {
|
|
15606
|
-
const call =
|
|
15720
|
+
const call = ts12.factory.createCallExpression(callee, undefined, args);
|
|
15607
15721
|
if (pure) {
|
|
15608
|
-
|
|
15722
|
+
ts12.addSyntheticLeadingComment(call, ts12.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
15609
15723
|
}
|
|
15610
15724
|
return call;
|
|
15611
15725
|
}
|
|
15612
15726
|
createConditional(condition, whenTrue, whenFalse) {
|
|
15613
|
-
return
|
|
15727
|
+
return ts12.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
15614
15728
|
}
|
|
15615
|
-
createElementAccess =
|
|
15616
|
-
createExpressionStatement =
|
|
15729
|
+
createElementAccess = ts12.factory.createElementAccessExpression;
|
|
15730
|
+
createExpressionStatement = ts12.factory.createExpressionStatement;
|
|
15617
15731
|
createDynamicImport(url) {
|
|
15618
|
-
return
|
|
15619
|
-
typeof url === "string" ?
|
|
15732
|
+
return ts12.factory.createCallExpression(ts12.factory.createToken(ts12.SyntaxKind.ImportKeyword), undefined, [
|
|
15733
|
+
typeof url === "string" ? ts12.factory.createStringLiteral(url) : url
|
|
15620
15734
|
]);
|
|
15621
15735
|
}
|
|
15622
15736
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
15623
|
-
if (!
|
|
15624
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
15737
|
+
if (!ts12.isBlock(body)) {
|
|
15738
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts12.SyntaxKind[body.kind]}.`);
|
|
15625
15739
|
}
|
|
15626
|
-
return
|
|
15740
|
+
return ts12.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
15627
15741
|
}
|
|
15628
15742
|
createFunctionExpression(functionName, parameters, body) {
|
|
15629
|
-
if (!
|
|
15630
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
15743
|
+
if (!ts12.isBlock(body)) {
|
|
15744
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts12.SyntaxKind[body.kind]}.`);
|
|
15631
15745
|
}
|
|
15632
|
-
return
|
|
15746
|
+
return ts12.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
15633
15747
|
}
|
|
15634
15748
|
createArrowFunctionExpression(parameters, body) {
|
|
15635
|
-
if (
|
|
15636
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
15749
|
+
if (ts12.isStatement(body) && !ts12.isBlock(body)) {
|
|
15750
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts12.SyntaxKind[body.kind]}.`);
|
|
15637
15751
|
}
|
|
15638
|
-
return
|
|
15752
|
+
return ts12.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
15639
15753
|
}
|
|
15640
15754
|
createParameter(param) {
|
|
15641
|
-
return
|
|
15755
|
+
return ts12.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
15642
15756
|
}
|
|
15643
|
-
createIdentifier =
|
|
15757
|
+
createIdentifier = ts12.factory.createIdentifier;
|
|
15644
15758
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
15645
|
-
return
|
|
15759
|
+
return ts12.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
15646
15760
|
}
|
|
15647
15761
|
createLiteral(value) {
|
|
15648
15762
|
if (value === undefined) {
|
|
15649
|
-
return
|
|
15763
|
+
return ts12.factory.createIdentifier("undefined");
|
|
15650
15764
|
} else if (value === null) {
|
|
15651
|
-
return
|
|
15765
|
+
return ts12.factory.createNull();
|
|
15652
15766
|
} else if (typeof value === "boolean") {
|
|
15653
|
-
return value ?
|
|
15767
|
+
return value ? ts12.factory.createTrue() : ts12.factory.createFalse();
|
|
15654
15768
|
} else if (typeof value === "number") {
|
|
15655
15769
|
return tsNumericExpression(value);
|
|
15656
15770
|
} else {
|
|
15657
|
-
return
|
|
15771
|
+
return ts12.factory.createStringLiteral(value);
|
|
15658
15772
|
}
|
|
15659
15773
|
}
|
|
15660
15774
|
createNewExpression(expression, args) {
|
|
15661
|
-
return
|
|
15775
|
+
return ts12.factory.createNewExpression(expression, undefined, args);
|
|
15662
15776
|
}
|
|
15663
15777
|
createObjectLiteral(properties) {
|
|
15664
|
-
return
|
|
15778
|
+
return ts12.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
15665
15779
|
if (prop.kind === "spread") {
|
|
15666
|
-
return
|
|
15780
|
+
return ts12.factory.createSpreadAssignment(prop.expression);
|
|
15667
15781
|
}
|
|
15668
|
-
return
|
|
15782
|
+
return ts12.factory.createPropertyAssignment(prop.quoted ? ts12.factory.createStringLiteral(prop.propertyName) : ts12.factory.createIdentifier(prop.propertyName), prop.value);
|
|
15669
15783
|
}));
|
|
15670
15784
|
}
|
|
15671
|
-
createParenthesizedExpression =
|
|
15672
|
-
createPropertyAccess =
|
|
15673
|
-
createSpreadElement =
|
|
15785
|
+
createParenthesizedExpression = ts12.factory.createParenthesizedExpression;
|
|
15786
|
+
createPropertyAccess = ts12.factory.createPropertyAccessExpression;
|
|
15787
|
+
createSpreadElement = ts12.factory.createSpreadElement;
|
|
15674
15788
|
createReturnStatement(expression) {
|
|
15675
|
-
return
|
|
15789
|
+
return ts12.factory.createReturnStatement(expression ?? undefined);
|
|
15676
15790
|
}
|
|
15677
15791
|
createTaggedTemplate(tag, template) {
|
|
15678
|
-
return
|
|
15792
|
+
return ts12.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
15679
15793
|
}
|
|
15680
15794
|
createTemplateLiteral(template) {
|
|
15681
15795
|
let templateLiteral;
|
|
@@ -15685,7 +15799,7 @@ class TypeScriptAstFactory {
|
|
|
15685
15799
|
throw new Error("createTemplateLiteral: template has no elements");
|
|
15686
15800
|
}
|
|
15687
15801
|
if (length === 1) {
|
|
15688
|
-
templateLiteral =
|
|
15802
|
+
templateLiteral = ts12.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
15689
15803
|
} else {
|
|
15690
15804
|
const spans = [];
|
|
15691
15805
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -15699,7 +15813,7 @@ class TypeScriptAstFactory {
|
|
|
15699
15813
|
if (range !== null) {
|
|
15700
15814
|
this.setSourceMapRange(middle, range);
|
|
15701
15815
|
}
|
|
15702
|
-
spans.push(
|
|
15816
|
+
spans.push(ts12.factory.createTemplateSpan(expression, middle));
|
|
15703
15817
|
}
|
|
15704
15818
|
const resolvedExpression = template.expressions[length - 2];
|
|
15705
15819
|
const templatePart = template.elements[length - 1];
|
|
@@ -15710,27 +15824,27 @@ class TypeScriptAstFactory {
|
|
|
15710
15824
|
if (templatePart.range !== null) {
|
|
15711
15825
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
15712
15826
|
}
|
|
15713
|
-
spans.push(
|
|
15714
|
-
templateLiteral =
|
|
15827
|
+
spans.push(ts12.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
15828
|
+
templateLiteral = ts12.factory.createTemplateExpression(ts12.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
15715
15829
|
}
|
|
15716
15830
|
if (head.range !== null) {
|
|
15717
15831
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
15718
15832
|
}
|
|
15719
15833
|
return templateLiteral;
|
|
15720
15834
|
}
|
|
15721
|
-
createThrowStatement =
|
|
15722
|
-
createTypeOfExpression =
|
|
15723
|
-
createVoidExpression =
|
|
15835
|
+
createThrowStatement = ts12.factory.createThrowStatement;
|
|
15836
|
+
createTypeOfExpression = ts12.factory.createTypeOfExpression;
|
|
15837
|
+
createVoidExpression = ts12.factory.createVoidExpression;
|
|
15724
15838
|
createUnaryExpression(operator, operand) {
|
|
15725
|
-
return
|
|
15839
|
+
return ts12.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
15726
15840
|
}
|
|
15727
15841
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
15728
|
-
return
|
|
15729
|
-
|
|
15842
|
+
return ts12.factory.createVariableStatement(undefined, ts12.factory.createVariableDeclarationList([
|
|
15843
|
+
ts12.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
15730
15844
|
], this.VAR_TYPES[variableType]));
|
|
15731
15845
|
}
|
|
15732
15846
|
createRegularExpressionLiteral(body, flags) {
|
|
15733
|
-
return
|
|
15847
|
+
return ts12.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
15734
15848
|
}
|
|
15735
15849
|
setSourceMapRange(node, sourceMapRange) {
|
|
15736
15850
|
if (sourceMapRange === null) {
|
|
@@ -15738,10 +15852,10 @@ class TypeScriptAstFactory {
|
|
|
15738
15852
|
}
|
|
15739
15853
|
const url = sourceMapRange.url;
|
|
15740
15854
|
if (!this.externalSourceFiles.has(url)) {
|
|
15741
|
-
this.externalSourceFiles.set(url,
|
|
15855
|
+
this.externalSourceFiles.set(url, ts12.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
15742
15856
|
}
|
|
15743
15857
|
const source = this.externalSourceFiles.get(url);
|
|
15744
|
-
|
|
15858
|
+
ts12.setSourceMapRange(node, {
|
|
15745
15859
|
pos: sourceMapRange.start.offset,
|
|
15746
15860
|
end: sourceMapRange.end.offset,
|
|
15747
15861
|
source
|
|
@@ -15751,77 +15865,77 @@ class TypeScriptAstFactory {
|
|
|
15751
15865
|
createBuiltInType(type) {
|
|
15752
15866
|
switch (type) {
|
|
15753
15867
|
case "any":
|
|
15754
|
-
return
|
|
15868
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.AnyKeyword);
|
|
15755
15869
|
case "boolean":
|
|
15756
|
-
return
|
|
15870
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.BooleanKeyword);
|
|
15757
15871
|
case "number":
|
|
15758
|
-
return
|
|
15872
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.NumberKeyword);
|
|
15759
15873
|
case "string":
|
|
15760
|
-
return
|
|
15874
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.StringKeyword);
|
|
15761
15875
|
case "function":
|
|
15762
|
-
return
|
|
15876
|
+
return ts12.factory.createTypeReferenceNode(ts12.factory.createIdentifier("Function"));
|
|
15763
15877
|
case "never":
|
|
15764
|
-
return
|
|
15878
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.NeverKeyword);
|
|
15765
15879
|
case "unknown":
|
|
15766
|
-
return
|
|
15880
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.UnknownKeyword);
|
|
15767
15881
|
}
|
|
15768
15882
|
}
|
|
15769
15883
|
createExpressionType(expression, typeParams) {
|
|
15770
15884
|
const typeName = getEntityTypeFromExpression(expression);
|
|
15771
|
-
return
|
|
15885
|
+
return ts12.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
15772
15886
|
}
|
|
15773
15887
|
createArrayType(elementType) {
|
|
15774
|
-
return
|
|
15888
|
+
return ts12.factory.createArrayTypeNode(elementType);
|
|
15775
15889
|
}
|
|
15776
15890
|
createMapType(valueType) {
|
|
15777
|
-
return
|
|
15778
|
-
|
|
15779
|
-
|
|
15891
|
+
return ts12.factory.createTypeLiteralNode([
|
|
15892
|
+
ts12.factory.createIndexSignature(undefined, [
|
|
15893
|
+
ts12.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.StringKeyword))
|
|
15780
15894
|
], valueType)
|
|
15781
15895
|
]);
|
|
15782
15896
|
}
|
|
15783
15897
|
transplantType(type) {
|
|
15784
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
15898
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts12.isTypeNode(type)) {
|
|
15785
15899
|
return type;
|
|
15786
15900
|
}
|
|
15787
15901
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
15788
15902
|
}
|
|
15789
15903
|
}
|
|
15790
15904
|
function createTemplateMiddle(cooked, raw) {
|
|
15791
|
-
const node =
|
|
15792
|
-
node.kind =
|
|
15905
|
+
const node = ts12.factory.createTemplateHead(cooked, raw);
|
|
15906
|
+
node.kind = ts12.SyntaxKind.TemplateMiddle;
|
|
15793
15907
|
return node;
|
|
15794
15908
|
}
|
|
15795
15909
|
function createTemplateTail(cooked, raw) {
|
|
15796
|
-
const node =
|
|
15797
|
-
node.kind =
|
|
15910
|
+
const node = ts12.factory.createTemplateHead(cooked, raw);
|
|
15911
|
+
node.kind = ts12.SyntaxKind.TemplateTail;
|
|
15798
15912
|
return node;
|
|
15799
15913
|
}
|
|
15800
15914
|
function attachComments(statement, leadingComments) {
|
|
15801
15915
|
for (const comment of leadingComments) {
|
|
15802
|
-
const commentKind = comment.multiline ?
|
|
15916
|
+
const commentKind = comment.multiline ? ts12.SyntaxKind.MultiLineCommentTrivia : ts12.SyntaxKind.SingleLineCommentTrivia;
|
|
15803
15917
|
if (comment.multiline) {
|
|
15804
|
-
|
|
15918
|
+
ts12.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
15805
15919
|
} else {
|
|
15806
15920
|
for (const line of comment.toString().split(`
|
|
15807
15921
|
`)) {
|
|
15808
|
-
|
|
15922
|
+
ts12.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
15809
15923
|
}
|
|
15810
15924
|
}
|
|
15811
15925
|
}
|
|
15812
15926
|
}
|
|
15813
15927
|
function getEntityTypeFromExpression(expression) {
|
|
15814
|
-
if (
|
|
15928
|
+
if (ts12.isIdentifier(expression)) {
|
|
15815
15929
|
return expression;
|
|
15816
15930
|
}
|
|
15817
|
-
if (
|
|
15931
|
+
if (ts12.isPropertyAccessExpression(expression)) {
|
|
15818
15932
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
15819
|
-
if (!
|
|
15933
|
+
if (!ts12.isIdentifier(expression.name)) {
|
|
15820
15934
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
15821
15935
|
}
|
|
15822
|
-
return
|
|
15936
|
+
return ts12.factory.createQualifiedName(left, expression.name);
|
|
15823
15937
|
}
|
|
15824
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
15938
|
+
throw new Error(`Unsupported expression for type reference: ${ts12.SyntaxKind[expression.kind]}`);
|
|
15825
15939
|
}
|
|
15826
15940
|
var init_typescript_ast_factory = __esm(() => {
|
|
15827
15941
|
init_ts_util();
|
|
@@ -15854,9 +15968,9 @@ __export(exports_fastHmrCompiler, {
|
|
|
15854
15968
|
primeComponentFingerprint: () => primeComponentFingerprint,
|
|
15855
15969
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
15856
15970
|
});
|
|
15857
|
-
import { existsSync as
|
|
15858
|
-
import { dirname as
|
|
15859
|
-
import
|
|
15971
|
+
import { existsSync as existsSync23, readFileSync as readFileSync17, statSync as statSync2 } from "fs";
|
|
15972
|
+
import { dirname as dirname17, extname as extname6, relative as relative14, resolve as resolve23 } from "path";
|
|
15973
|
+
import ts13 from "typescript";
|
|
15860
15974
|
var fail = (reason, detail, location) => ({
|
|
15861
15975
|
ok: false,
|
|
15862
15976
|
reason,
|
|
@@ -15940,23 +16054,23 @@ var fail = (reason, detail, location) => ({
|
|
|
15940
16054
|
}
|
|
15941
16055
|
let sourceFile;
|
|
15942
16056
|
try {
|
|
15943
|
-
sourceFile =
|
|
16057
|
+
sourceFile = ts13.createSourceFile(componentFilePath, source, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TS);
|
|
15944
16058
|
} catch {
|
|
15945
16059
|
return;
|
|
15946
16060
|
}
|
|
15947
16061
|
for (const stmt of sourceFile.statements) {
|
|
15948
|
-
if (!
|
|
16062
|
+
if (!ts13.isClassDeclaration(stmt))
|
|
15949
16063
|
continue;
|
|
15950
16064
|
const className = stmt.name?.text;
|
|
15951
16065
|
if (!className)
|
|
15952
16066
|
continue;
|
|
15953
|
-
const decorators =
|
|
16067
|
+
const decorators = ts13.getDecorators(stmt) ?? [];
|
|
15954
16068
|
const decoratorName = (() => {
|
|
15955
16069
|
for (const d2 of decorators) {
|
|
15956
|
-
if (!
|
|
16070
|
+
if (!ts13.isCallExpression(d2.expression))
|
|
15957
16071
|
continue;
|
|
15958
16072
|
const expr = d2.expression.expression;
|
|
15959
|
-
if (!
|
|
16073
|
+
if (!ts13.isIdentifier(expr))
|
|
15960
16074
|
continue;
|
|
15961
16075
|
if (expr.text === "Component" || expr.text === "Directive" || expr.text === "Pipe" || expr.text === "Injectable") {
|
|
15962
16076
|
return expr.text;
|
|
@@ -15970,20 +16084,20 @@ var fail = (reason, detail, location) => ({
|
|
|
15970
16084
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
15971
16085
|
if (decoratorName === "Component") {
|
|
15972
16086
|
const componentDecorator = decorators.find((d2) => {
|
|
15973
|
-
if (!
|
|
16087
|
+
if (!ts13.isCallExpression(d2.expression))
|
|
15974
16088
|
return false;
|
|
15975
16089
|
const expr = d2.expression.expression;
|
|
15976
|
-
return
|
|
16090
|
+
return ts13.isIdentifier(expr) && expr.text === "Component";
|
|
15977
16091
|
});
|
|
15978
16092
|
if (!componentDecorator)
|
|
15979
16093
|
continue;
|
|
15980
16094
|
const decoratorCall = componentDecorator.expression;
|
|
15981
16095
|
const args = decoratorCall.arguments[0];
|
|
15982
|
-
if (!args || !
|
|
16096
|
+
if (!args || !ts13.isObjectLiteralExpression(args))
|
|
15983
16097
|
continue;
|
|
15984
16098
|
const decoratorMeta = readDecoratorMeta(args);
|
|
15985
16099
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
15986
|
-
const componentDir =
|
|
16100
|
+
const componentDir = dirname17(componentFilePath);
|
|
15987
16101
|
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
15988
16102
|
fingerprintCache.set(id, fingerprint);
|
|
15989
16103
|
} else {
|
|
@@ -16013,11 +16127,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16013
16127
|
return false;
|
|
16014
16128
|
return true;
|
|
16015
16129
|
}, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
|
|
16016
|
-
for (const dec of
|
|
16130
|
+
for (const dec of ts13.getDecorators(cls) ?? []) {
|
|
16017
16131
|
const expr = dec.expression;
|
|
16018
|
-
if (!
|
|
16132
|
+
if (!ts13.isCallExpression(expr))
|
|
16019
16133
|
continue;
|
|
16020
|
-
if (!
|
|
16134
|
+
if (!ts13.isIdentifier(expr.expression))
|
|
16021
16135
|
continue;
|
|
16022
16136
|
if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
|
|
16023
16137
|
return dec;
|
|
@@ -16035,18 +16149,18 @@ var fail = (reason, detail, location) => ({
|
|
|
16035
16149
|
}
|
|
16036
16150
|
const ctorParamTypes = [];
|
|
16037
16151
|
for (const member of cls.members) {
|
|
16038
|
-
if (!
|
|
16152
|
+
if (!ts13.isConstructorDeclaration(member))
|
|
16039
16153
|
continue;
|
|
16040
16154
|
for (const param of member.parameters) {
|
|
16041
16155
|
const typeText = param.type ? param.type.getText() : "";
|
|
16042
|
-
const decorators =
|
|
16156
|
+
const decorators = ts13.getDecorators(param) ?? [];
|
|
16043
16157
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
16044
16158
|
const e = d2.expression;
|
|
16045
|
-
if (
|
|
16159
|
+
if (ts13.isCallExpression(e) && ts13.isIdentifier(e.expression)) {
|
|
16046
16160
|
const args = e.arguments.map((a) => a.getText()).join(",");
|
|
16047
16161
|
return `@${e.expression.text}(${args})`;
|
|
16048
16162
|
}
|
|
16049
|
-
if (
|
|
16163
|
+
if (ts13.isIdentifier(e))
|
|
16050
16164
|
return `@${e.text}`;
|
|
16051
16165
|
return "@<unknown>";
|
|
16052
16166
|
}).join("");
|
|
@@ -16068,23 +16182,23 @@ var fail = (reason, detail, location) => ({
|
|
|
16068
16182
|
const walk = (node) => {
|
|
16069
16183
|
if (found)
|
|
16070
16184
|
return;
|
|
16071
|
-
if (
|
|
16185
|
+
if (ts13.isClassDeclaration(node) && node.name?.text === className) {
|
|
16072
16186
|
found = node;
|
|
16073
16187
|
return;
|
|
16074
16188
|
}
|
|
16075
|
-
|
|
16189
|
+
ts13.forEachChild(node, walk);
|
|
16076
16190
|
};
|
|
16077
16191
|
walk(sourceFile);
|
|
16078
16192
|
return found;
|
|
16079
16193
|
}, getClassDecorators = (cls) => {
|
|
16080
|
-
const modifiers =
|
|
16194
|
+
const modifiers = ts13.getDecorators(cls) ?? [];
|
|
16081
16195
|
return [...modifiers];
|
|
16082
16196
|
}, findComponentDecorator = (cls) => {
|
|
16083
16197
|
for (const decorator of getClassDecorators(cls)) {
|
|
16084
16198
|
const expr = decorator.expression;
|
|
16085
|
-
if (
|
|
16199
|
+
if (ts13.isCallExpression(expr)) {
|
|
16086
16200
|
const fn2 = expr.expression;
|
|
16087
|
-
if (
|
|
16201
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "Component") {
|
|
16088
16202
|
return decorator;
|
|
16089
16203
|
}
|
|
16090
16204
|
}
|
|
@@ -16092,15 +16206,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16092
16206
|
return null;
|
|
16093
16207
|
}, getDecoratorArgsObject = (decorator) => {
|
|
16094
16208
|
const call = decorator.expression;
|
|
16095
|
-
if (!
|
|
16209
|
+
if (!ts13.isCallExpression(call))
|
|
16096
16210
|
return null;
|
|
16097
16211
|
const arg = call.arguments[0];
|
|
16098
|
-
if (!arg || !
|
|
16212
|
+
if (!arg || !ts13.isObjectLiteralExpression(arg))
|
|
16099
16213
|
return null;
|
|
16100
16214
|
return arg;
|
|
16101
16215
|
}, getProperty = (obj, name) => {
|
|
16102
16216
|
for (const prop of obj.properties) {
|
|
16103
|
-
if (
|
|
16217
|
+
if (ts13.isPropertyAssignment(prop) && (ts13.isIdentifier(prop.name) && prop.name.text === name || ts13.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
16104
16218
|
return prop.initializer;
|
|
16105
16219
|
}
|
|
16106
16220
|
}
|
|
@@ -16109,7 +16223,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16109
16223
|
const expr = getProperty(obj, name);
|
|
16110
16224
|
if (!expr)
|
|
16111
16225
|
return null;
|
|
16112
|
-
if (
|
|
16226
|
+
if (ts13.isStringLiteral(expr) || ts13.isNoSubstitutionTemplateLiteral(expr)) {
|
|
16113
16227
|
return expr.text;
|
|
16114
16228
|
}
|
|
16115
16229
|
return null;
|
|
@@ -16117,22 +16231,22 @@ var fail = (reason, detail, location) => ({
|
|
|
16117
16231
|
const expr = getProperty(obj, name);
|
|
16118
16232
|
if (!expr)
|
|
16119
16233
|
return null;
|
|
16120
|
-
if (expr.kind ===
|
|
16234
|
+
if (expr.kind === ts13.SyntaxKind.TrueKeyword)
|
|
16121
16235
|
return true;
|
|
16122
|
-
if (expr.kind ===
|
|
16236
|
+
if (expr.kind === ts13.SyntaxKind.FalseKeyword)
|
|
16123
16237
|
return false;
|
|
16124
16238
|
return null;
|
|
16125
16239
|
}, isAngularDecoratorIdentifier = (name) => name === "Component" || name === "Directive" || name === "Pipe" || name === "Injectable", classHasAngularDecorator = (cls) => {
|
|
16126
|
-
for (const dec of
|
|
16240
|
+
for (const dec of ts13.getDecorators(cls) ?? []) {
|
|
16127
16241
|
const expr = dec.expression;
|
|
16128
|
-
if (
|
|
16242
|
+
if (ts13.isCallExpression(expr) && ts13.isIdentifier(expr.expression) && isAngularDecoratorIdentifier(expr.expression.text)) {
|
|
16129
16243
|
return true;
|
|
16130
16244
|
}
|
|
16131
16245
|
}
|
|
16132
16246
|
return false;
|
|
16133
16247
|
}, findClassInSourceFile = (sf, className) => {
|
|
16134
16248
|
for (const stmt of sf.statements) {
|
|
16135
|
-
if (
|
|
16249
|
+
if (ts13.isClassDeclaration(stmt) && stmt.name?.text === className) {
|
|
16136
16250
|
return stmt;
|
|
16137
16251
|
}
|
|
16138
16252
|
}
|
|
@@ -16142,15 +16256,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16142
16256
|
if (sameFile)
|
|
16143
16257
|
return classHasAngularDecorator(sameFile);
|
|
16144
16258
|
for (const stmt of sourceFile.statements) {
|
|
16145
|
-
if (!
|
|
16259
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
16146
16260
|
continue;
|
|
16147
|
-
if (!
|
|
16261
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
16148
16262
|
continue;
|
|
16149
16263
|
const clause = stmt.importClause;
|
|
16150
16264
|
if (!clause || clause.isTypeOnly)
|
|
16151
16265
|
continue;
|
|
16152
16266
|
const named = clause.namedBindings;
|
|
16153
|
-
if (!named || !
|
|
16267
|
+
if (!named || !ts13.isNamedImports(named))
|
|
16154
16268
|
continue;
|
|
16155
16269
|
const found = named.elements.find((el) => el.name.text === parentClassName);
|
|
16156
16270
|
if (!found)
|
|
@@ -16167,15 +16281,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16167
16281
|
`${base}/index.tsx`
|
|
16168
16282
|
];
|
|
16169
16283
|
for (const candidate of candidates) {
|
|
16170
|
-
if (!
|
|
16284
|
+
if (!existsSync23(candidate))
|
|
16171
16285
|
continue;
|
|
16172
16286
|
let content;
|
|
16173
16287
|
try {
|
|
16174
|
-
content =
|
|
16288
|
+
content = readFileSync17(candidate, "utf-8");
|
|
16175
16289
|
} catch {
|
|
16176
16290
|
continue;
|
|
16177
16291
|
}
|
|
16178
|
-
const parentSf =
|
|
16292
|
+
const parentSf = ts13.createSourceFile(candidate, content, ts13.ScriptTarget.Latest, true);
|
|
16179
16293
|
const parentCls = findClassInSourceFile(parentSf, parentClassName);
|
|
16180
16294
|
if (!parentCls)
|
|
16181
16295
|
continue;
|
|
@@ -16187,11 +16301,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16187
16301
|
}, inheritsDecoratedClass = (cls, sourceFile, componentDir, projectRoot) => {
|
|
16188
16302
|
const heritage = cls.heritageClauses ?? [];
|
|
16189
16303
|
for (const clause of heritage) {
|
|
16190
|
-
if (clause.token !==
|
|
16304
|
+
if (clause.token !== ts13.SyntaxKind.ExtendsKeyword)
|
|
16191
16305
|
continue;
|
|
16192
16306
|
for (const typeNode of clause.types) {
|
|
16193
16307
|
const expr = typeNode.expression;
|
|
16194
|
-
if (!
|
|
16308
|
+
if (!ts13.isIdentifier(expr)) {
|
|
16195
16309
|
return true;
|
|
16196
16310
|
}
|
|
16197
16311
|
if (parentHasAngularDecoratorAcrossFiles(expr.text, sourceFile, componentDir, projectRoot)) {
|
|
@@ -16202,18 +16316,18 @@ var fail = (reason, detail, location) => ({
|
|
|
16202
16316
|
return false;
|
|
16203
16317
|
}, CONTROL_CREATE_METHOD_NAME = "\u0275ngControlCreate", extractControlCreate = (cls) => {
|
|
16204
16318
|
for (const member of cls.members) {
|
|
16205
|
-
if (!
|
|
16319
|
+
if (!ts13.isMethodDeclaration(member))
|
|
16206
16320
|
continue;
|
|
16207
|
-
if (member.modifiers?.some((m) => m.kind ===
|
|
16321
|
+
if (member.modifiers?.some((m) => m.kind === ts13.SyntaxKind.StaticKeyword))
|
|
16208
16322
|
continue;
|
|
16209
16323
|
const name = member.name;
|
|
16210
16324
|
if (name === undefined)
|
|
16211
16325
|
continue;
|
|
16212
|
-
const nameText =
|
|
16326
|
+
const nameText = ts13.isIdentifier(name) ? name.text : name.getText();
|
|
16213
16327
|
if (nameText !== CONTROL_CREATE_METHOD_NAME)
|
|
16214
16328
|
continue;
|
|
16215
16329
|
const firstParam = member.parameters[0];
|
|
16216
|
-
if (firstParam === undefined || firstParam.type === undefined || !
|
|
16330
|
+
if (firstParam === undefined || firstParam.type === undefined || !ts13.isTypeReferenceNode(firstParam.type)) {
|
|
16217
16331
|
return { passThroughInput: null };
|
|
16218
16332
|
}
|
|
16219
16333
|
const typeArgs = firstParam.type.typeArguments;
|
|
@@ -16221,16 +16335,16 @@ var fail = (reason, detail, location) => ({
|
|
|
16221
16335
|
return { passThroughInput: null };
|
|
16222
16336
|
}
|
|
16223
16337
|
const arg = typeArgs[0];
|
|
16224
|
-
if (arg === undefined || !
|
|
16338
|
+
if (arg === undefined || !ts13.isLiteralTypeNode(arg) || !ts13.isStringLiteral(arg.literal)) {
|
|
16225
16339
|
return { passThroughInput: null };
|
|
16226
16340
|
}
|
|
16227
16341
|
return { passThroughInput: arg.literal.text };
|
|
16228
16342
|
}
|
|
16229
16343
|
return null;
|
|
16230
16344
|
}, resolveEnumPropertyAccess = (expr, enumName, values) => {
|
|
16231
|
-
if (!
|
|
16345
|
+
if (!ts13.isPropertyAccessExpression(expr))
|
|
16232
16346
|
return null;
|
|
16233
|
-
if (!
|
|
16347
|
+
if (!ts13.isIdentifier(expr.expression))
|
|
16234
16348
|
return null;
|
|
16235
16349
|
if (expr.expression.text !== enumName)
|
|
16236
16350
|
return null;
|
|
@@ -16249,21 +16363,21 @@ var fail = (reason, detail, location) => ({
|
|
|
16249
16363
|
const hostExpr = getProperty(args, "host");
|
|
16250
16364
|
const schemasExpr = getProperty(args, "schemas");
|
|
16251
16365
|
const styleUrls = [];
|
|
16252
|
-
if (styleUrlsExpr &&
|
|
16366
|
+
if (styleUrlsExpr && ts13.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
16253
16367
|
for (const el of styleUrlsExpr.elements) {
|
|
16254
|
-
if (
|
|
16368
|
+
if (ts13.isStringLiteral(el))
|
|
16255
16369
|
styleUrls.push(el.text);
|
|
16256
16370
|
}
|
|
16257
16371
|
}
|
|
16258
16372
|
const styles = [];
|
|
16259
16373
|
if (stylesExpr) {
|
|
16260
|
-
if (
|
|
16374
|
+
if (ts13.isArrayLiteralExpression(stylesExpr)) {
|
|
16261
16375
|
for (const el of stylesExpr.elements) {
|
|
16262
|
-
if (
|
|
16376
|
+
if (ts13.isStringLiteral(el) || ts13.isNoSubstitutionTemplateLiteral(el)) {
|
|
16263
16377
|
styles.push(el.text);
|
|
16264
16378
|
}
|
|
16265
16379
|
}
|
|
16266
|
-
} else if (
|
|
16380
|
+
} else if (ts13.isStringLiteral(stylesExpr) || ts13.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
16267
16381
|
styles.push(stylesExpr.text);
|
|
16268
16382
|
}
|
|
16269
16383
|
}
|
|
@@ -16276,15 +16390,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16276
16390
|
encapsulation,
|
|
16277
16391
|
hasProviders: getProperty(args, "providers") !== null,
|
|
16278
16392
|
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
16279
|
-
importsExpr: importsExpr &&
|
|
16280
|
-
hostDirectivesExpr: hostDirectivesExpr &&
|
|
16281
|
-
animationsExpr: animationsExpr &&
|
|
16282
|
-
providersExpr: providersExpr &&
|
|
16283
|
-
viewProvidersExpr: viewProvidersExpr &&
|
|
16284
|
-
inputsArrayExpr: inputsArrayExpr &&
|
|
16285
|
-
outputsArrayExpr: outputsArrayExpr &&
|
|
16286
|
-
hostExpr: hostExpr &&
|
|
16287
|
-
schemasExpr: schemasExpr &&
|
|
16393
|
+
importsExpr: importsExpr && ts13.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
16394
|
+
hostDirectivesExpr: hostDirectivesExpr && ts13.isArrayLiteralExpression(hostDirectivesExpr) ? hostDirectivesExpr : null,
|
|
16395
|
+
animationsExpr: animationsExpr && ts13.isArrayLiteralExpression(animationsExpr) ? animationsExpr : null,
|
|
16396
|
+
providersExpr: providersExpr && ts13.isArrayLiteralExpression(providersExpr) ? providersExpr : null,
|
|
16397
|
+
viewProvidersExpr: viewProvidersExpr && ts13.isArrayLiteralExpression(viewProvidersExpr) ? viewProvidersExpr : null,
|
|
16398
|
+
inputsArrayExpr: inputsArrayExpr && ts13.isArrayLiteralExpression(inputsArrayExpr) ? inputsArrayExpr : null,
|
|
16399
|
+
outputsArrayExpr: outputsArrayExpr && ts13.isArrayLiteralExpression(outputsArrayExpr) ? outputsArrayExpr : null,
|
|
16400
|
+
hostExpr: hostExpr && ts13.isObjectLiteralExpression(hostExpr) ? hostExpr : null,
|
|
16401
|
+
schemasExpr: schemasExpr && ts13.isArrayLiteralExpression(schemasExpr) ? schemasExpr : null,
|
|
16288
16402
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
16289
16403
|
selector: getStringProperty(args, "selector"),
|
|
16290
16404
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
@@ -16295,13 +16409,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16295
16409
|
templateUrl: getStringProperty(args, "templateUrl")
|
|
16296
16410
|
};
|
|
16297
16411
|
}, extractDecoratorInput = (prop, compiler) => {
|
|
16298
|
-
const decorators =
|
|
16412
|
+
const decorators = ts13.getDecorators(prop) ?? [];
|
|
16299
16413
|
for (const decorator of decorators) {
|
|
16300
16414
|
const expr = decorator.expression;
|
|
16301
|
-
if (!
|
|
16415
|
+
if (!ts13.isCallExpression(expr))
|
|
16302
16416
|
continue;
|
|
16303
16417
|
const fn2 = expr.expression;
|
|
16304
|
-
if (!
|
|
16418
|
+
if (!ts13.isIdentifier(fn2) || fn2.text !== "Input")
|
|
16305
16419
|
continue;
|
|
16306
16420
|
const classPropertyName = prop.name.getText();
|
|
16307
16421
|
let bindingPropertyName = classPropertyName;
|
|
@@ -16309,9 +16423,9 @@ var fail = (reason, detail, location) => ({
|
|
|
16309
16423
|
let transformFunction = null;
|
|
16310
16424
|
const arg = expr.arguments[0];
|
|
16311
16425
|
if (arg) {
|
|
16312
|
-
if (
|
|
16426
|
+
if (ts13.isStringLiteral(arg)) {
|
|
16313
16427
|
bindingPropertyName = arg.text;
|
|
16314
|
-
} else if (
|
|
16428
|
+
} else if (ts13.isObjectLiteralExpression(arg)) {
|
|
16315
16429
|
const aliasNode = getStringProperty(arg, "alias");
|
|
16316
16430
|
if (aliasNode !== null)
|
|
16317
16431
|
bindingPropertyName = aliasNode;
|
|
@@ -16335,11 +16449,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16335
16449
|
}
|
|
16336
16450
|
return null;
|
|
16337
16451
|
}, isInputSignalCall = (init) => {
|
|
16338
|
-
if (
|
|
16452
|
+
if (ts13.isCallExpression(init)) {
|
|
16339
16453
|
const fn2 = init.expression;
|
|
16340
|
-
if (
|
|
16454
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "input")
|
|
16341
16455
|
return true;
|
|
16342
|
-
if (
|
|
16456
|
+
if (ts13.isPropertyAccessExpression(fn2) && ts13.isIdentifier(fn2.expression) && fn2.expression.text === "input") {
|
|
16343
16457
|
return true;
|
|
16344
16458
|
}
|
|
16345
16459
|
}
|
|
@@ -16350,13 +16464,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16350
16464
|
const classPropertyName = prop.name.getText();
|
|
16351
16465
|
const call = prop.initializer;
|
|
16352
16466
|
let required = false;
|
|
16353
|
-
if (
|
|
16467
|
+
if (ts13.isPropertyAccessExpression(call.expression) && ts13.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
16354
16468
|
required = true;
|
|
16355
16469
|
}
|
|
16356
16470
|
let bindingPropertyName = classPropertyName;
|
|
16357
16471
|
let transformFunction = null;
|
|
16358
16472
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
16359
|
-
if (optsArg &&
|
|
16473
|
+
if (optsArg && ts13.isObjectLiteralExpression(optsArg)) {
|
|
16360
16474
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
16361
16475
|
if (aliasNode !== null)
|
|
16362
16476
|
bindingPropertyName = aliasNode;
|
|
@@ -16376,28 +16490,28 @@ var fail = (reason, detail, location) => ({
|
|
|
16376
16490
|
}
|
|
16377
16491
|
};
|
|
16378
16492
|
}, extractDecoratorOutput = (prop) => {
|
|
16379
|
-
const decorators =
|
|
16493
|
+
const decorators = ts13.getDecorators(prop) ?? [];
|
|
16380
16494
|
for (const decorator of decorators) {
|
|
16381
16495
|
const expr = decorator.expression;
|
|
16382
|
-
if (!
|
|
16496
|
+
if (!ts13.isCallExpression(expr))
|
|
16383
16497
|
continue;
|
|
16384
16498
|
const fn2 = expr.expression;
|
|
16385
|
-
if (!
|
|
16499
|
+
if (!ts13.isIdentifier(fn2) || fn2.text !== "Output")
|
|
16386
16500
|
continue;
|
|
16387
16501
|
const classPropertyName = prop.name.getText();
|
|
16388
16502
|
let bindingName = classPropertyName;
|
|
16389
16503
|
const arg = expr.arguments[0];
|
|
16390
|
-
if (arg &&
|
|
16504
|
+
if (arg && ts13.isStringLiteral(arg))
|
|
16391
16505
|
bindingName = arg.text;
|
|
16392
16506
|
return { classPropertyName, bindingName };
|
|
16393
16507
|
}
|
|
16394
16508
|
return null;
|
|
16395
16509
|
}, isOutputSignalCall = (init) => {
|
|
16396
|
-
if (
|
|
16510
|
+
if (ts13.isCallExpression(init)) {
|
|
16397
16511
|
const fn2 = init.expression;
|
|
16398
|
-
if (
|
|
16512
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "output")
|
|
16399
16513
|
return true;
|
|
16400
|
-
if (
|
|
16514
|
+
if (ts13.isPropertyAccessExpression(fn2) && ts13.isIdentifier(fn2.expression) && fn2.expression.text === "output") {
|
|
16401
16515
|
return true;
|
|
16402
16516
|
}
|
|
16403
16517
|
}
|
|
@@ -16409,7 +16523,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16409
16523
|
const call = prop.initializer;
|
|
16410
16524
|
let bindingName = classPropertyName;
|
|
16411
16525
|
const optsArg = call.arguments[0];
|
|
16412
|
-
if (optsArg &&
|
|
16526
|
+
if (optsArg && ts13.isObjectLiteralExpression(optsArg)) {
|
|
16413
16527
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
16414
16528
|
if (aliasNode !== null)
|
|
16415
16529
|
bindingName = aliasNode;
|
|
@@ -16421,7 +16535,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16421
16535
|
let hasDecoratorIO = false;
|
|
16422
16536
|
let hasSignalIO = false;
|
|
16423
16537
|
for (const member of cls.members) {
|
|
16424
|
-
if (!
|
|
16538
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
16425
16539
|
continue;
|
|
16426
16540
|
const decoratorIn = extractDecoratorInput(member, compiler);
|
|
16427
16541
|
if (decoratorIn) {
|
|
@@ -16455,21 +16569,21 @@ var fail = (reason, detail, location) => ({
|
|
|
16455
16569
|
specialAttributes: {}
|
|
16456
16570
|
}), parseHostObjectInto = (host, args, hostExprNode, compiler) => {
|
|
16457
16571
|
const hostNode = getProperty(args, "host");
|
|
16458
|
-
if (!hostNode || !
|
|
16572
|
+
if (!hostNode || !ts13.isObjectLiteralExpression(hostNode)) {
|
|
16459
16573
|
if (!hostExprNode)
|
|
16460
16574
|
return;
|
|
16461
16575
|
}
|
|
16462
|
-
const obj = hostNode &&
|
|
16576
|
+
const obj = hostNode && ts13.isObjectLiteralExpression(hostNode) ? hostNode : hostExprNode;
|
|
16463
16577
|
if (!obj)
|
|
16464
16578
|
return;
|
|
16465
16579
|
for (const prop of obj.properties) {
|
|
16466
|
-
if (!
|
|
16580
|
+
if (!ts13.isPropertyAssignment(prop))
|
|
16467
16581
|
continue;
|
|
16468
16582
|
const keyNode = prop.name;
|
|
16469
16583
|
let key;
|
|
16470
|
-
if (
|
|
16584
|
+
if (ts13.isStringLiteral(keyNode) || ts13.isNoSubstitutionTemplateLiteral(keyNode)) {
|
|
16471
16585
|
key = keyNode.text;
|
|
16472
|
-
} else if (
|
|
16586
|
+
} else if (ts13.isIdentifier(keyNode)) {
|
|
16473
16587
|
key = keyNode.text;
|
|
16474
16588
|
} else {
|
|
16475
16589
|
continue;
|
|
@@ -16486,36 +16600,36 @@ var fail = (reason, detail, location) => ({
|
|
|
16486
16600
|
}
|
|
16487
16601
|
}, mergeMemberHostDecorators = (host, cls) => {
|
|
16488
16602
|
for (const member of cls.members) {
|
|
16489
|
-
if (!
|
|
16603
|
+
if (!ts13.canHaveDecorators(member))
|
|
16490
16604
|
continue;
|
|
16491
|
-
const decorators =
|
|
16605
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
16492
16606
|
for (const dec of decorators) {
|
|
16493
16607
|
const expr = dec.expression;
|
|
16494
|
-
if (!
|
|
16608
|
+
if (!ts13.isCallExpression(expr))
|
|
16495
16609
|
continue;
|
|
16496
16610
|
const fn2 = expr.expression;
|
|
16497
|
-
if (!
|
|
16611
|
+
if (!ts13.isIdentifier(fn2))
|
|
16498
16612
|
continue;
|
|
16499
16613
|
if (fn2.text === "HostBinding") {
|
|
16500
|
-
if (!
|
|
16614
|
+
if (!ts13.isPropertyDeclaration(member) && !ts13.isGetAccessor(member))
|
|
16501
16615
|
continue;
|
|
16502
16616
|
const propertyName = member.name.text;
|
|
16503
16617
|
const target = expr.arguments[0];
|
|
16504
|
-
const key = target &&
|
|
16618
|
+
const key = target && ts13.isStringLiteral(target) ? target.text : propertyName;
|
|
16505
16619
|
host.properties[key] = propertyName;
|
|
16506
16620
|
} else if (fn2.text === "HostListener") {
|
|
16507
|
-
if (!
|
|
16621
|
+
if (!ts13.isMethodDeclaration(member))
|
|
16508
16622
|
continue;
|
|
16509
16623
|
const methodName = member.name.text;
|
|
16510
16624
|
const eventArg = expr.arguments[0];
|
|
16511
|
-
if (!eventArg || !
|
|
16625
|
+
if (!eventArg || !ts13.isStringLiteral(eventArg))
|
|
16512
16626
|
continue;
|
|
16513
16627
|
const event = eventArg.text;
|
|
16514
16628
|
const argsArg = expr.arguments[1];
|
|
16515
16629
|
let argsList = [];
|
|
16516
|
-
if (argsArg &&
|
|
16630
|
+
if (argsArg && ts13.isArrayLiteralExpression(argsArg)) {
|
|
16517
16631
|
for (const el of argsArg.elements) {
|
|
16518
|
-
if (
|
|
16632
|
+
if (ts13.isStringLiteral(el))
|
|
16519
16633
|
argsList.push(el.text);
|
|
16520
16634
|
}
|
|
16521
16635
|
}
|
|
@@ -16528,14 +16642,14 @@ var fail = (reason, detail, location) => ({
|
|
|
16528
16642
|
let descendants = true;
|
|
16529
16643
|
let emitDistinctChangesOnly = true;
|
|
16530
16644
|
const opts = args[1];
|
|
16531
|
-
if (opts &&
|
|
16645
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16532
16646
|
static_ = getBooleanProperty(opts, "static") ?? false;
|
|
16533
16647
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
16534
16648
|
emitDistinctChangesOnly = getBooleanProperty(opts, "emitDistinctChangesOnly") ?? true;
|
|
16535
16649
|
}
|
|
16536
16650
|
return { static_, descendants, emitDistinctChangesOnly };
|
|
16537
16651
|
}, queryPredicateFromArg = (arg, compiler) => {
|
|
16538
|
-
if (
|
|
16652
|
+
if (ts13.isStringLiteral(arg)) {
|
|
16539
16653
|
return arg.text.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
16540
16654
|
}
|
|
16541
16655
|
return {
|
|
@@ -16546,15 +16660,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16546
16660
|
const contentQueries = [];
|
|
16547
16661
|
const viewQueries = [];
|
|
16548
16662
|
for (const member of cls.members) {
|
|
16549
|
-
if (!
|
|
16663
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
16550
16664
|
continue;
|
|
16551
|
-
const decorators =
|
|
16665
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
16552
16666
|
for (const dec of decorators) {
|
|
16553
16667
|
const expr = dec.expression;
|
|
16554
|
-
if (!
|
|
16668
|
+
if (!ts13.isCallExpression(expr))
|
|
16555
16669
|
continue;
|
|
16556
16670
|
const fn2 = expr.expression;
|
|
16557
|
-
if (!
|
|
16671
|
+
if (!ts13.isIdentifier(fn2) || !QUERY_DECORATORS.has(fn2.text))
|
|
16558
16672
|
continue;
|
|
16559
16673
|
const propertyName = member.name.text;
|
|
16560
16674
|
const tokenArg = expr.arguments[0];
|
|
@@ -16566,7 +16680,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16566
16680
|
const { static_, descendants, emitDistinctChangesOnly } = parseQueryDecoratorOptions(expr.arguments);
|
|
16567
16681
|
const opts = expr.arguments[1];
|
|
16568
16682
|
let read = null;
|
|
16569
|
-
if (opts &&
|
|
16683
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16570
16684
|
const readNode = getProperty(opts, "read");
|
|
16571
16685
|
if (readNode) {
|
|
16572
16686
|
read = new compiler.WrappedNodeExpr(readNode);
|
|
@@ -16594,15 +16708,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16594
16708
|
const contentQueries = [];
|
|
16595
16709
|
const viewQueries = [];
|
|
16596
16710
|
for (const member of cls.members) {
|
|
16597
|
-
if (!
|
|
16711
|
+
if (!ts13.isPropertyDeclaration(member) || !member.initializer)
|
|
16598
16712
|
continue;
|
|
16599
16713
|
let init = member.initializer;
|
|
16600
|
-
if (!
|
|
16714
|
+
if (!ts13.isCallExpression(init))
|
|
16601
16715
|
continue;
|
|
16602
16716
|
let queryName;
|
|
16603
|
-
if (
|
|
16717
|
+
if (ts13.isIdentifier(init.expression)) {
|
|
16604
16718
|
queryName = init.expression.text;
|
|
16605
|
-
} else if (
|
|
16719
|
+
} else if (ts13.isPropertyAccessExpression(init.expression) && ts13.isIdentifier(init.expression.expression) && init.expression.name.text === "required") {
|
|
16606
16720
|
queryName = init.expression.expression.text;
|
|
16607
16721
|
} else {
|
|
16608
16722
|
continue;
|
|
@@ -16620,7 +16734,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16620
16734
|
let descendants = true;
|
|
16621
16735
|
let read = null;
|
|
16622
16736
|
const opts = init.arguments[1];
|
|
16623
|
-
if (opts &&
|
|
16737
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16624
16738
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
16625
16739
|
const readNode = getProperty(opts, "read");
|
|
16626
16740
|
if (readNode)
|
|
@@ -16646,13 +16760,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16646
16760
|
const node = getProperty(args, "exportAs");
|
|
16647
16761
|
if (!node)
|
|
16648
16762
|
return null;
|
|
16649
|
-
if (
|
|
16763
|
+
if (ts13.isStringLiteral(node)) {
|
|
16650
16764
|
return node.text.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
16651
16765
|
}
|
|
16652
|
-
if (
|
|
16766
|
+
if (ts13.isArrayLiteralExpression(node)) {
|
|
16653
16767
|
const out = [];
|
|
16654
16768
|
for (const el of node.elements) {
|
|
16655
|
-
if (
|
|
16769
|
+
if (ts13.isStringLiteral(el))
|
|
16656
16770
|
out.push(el.text);
|
|
16657
16771
|
}
|
|
16658
16772
|
return out.length > 0 ? out : null;
|
|
@@ -16660,11 +16774,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16660
16774
|
return null;
|
|
16661
16775
|
}, extractHostDirectives = (args, compiler) => {
|
|
16662
16776
|
const node = getProperty(args, "hostDirectives");
|
|
16663
|
-
if (!node || !
|
|
16777
|
+
if (!node || !ts13.isArrayLiteralExpression(node))
|
|
16664
16778
|
return null;
|
|
16665
16779
|
const out = [];
|
|
16666
16780
|
for (const el of node.elements) {
|
|
16667
|
-
if (
|
|
16781
|
+
if (ts13.isIdentifier(el)) {
|
|
16668
16782
|
out.push({
|
|
16669
16783
|
directive: {
|
|
16670
16784
|
value: new compiler.WrappedNodeExpr(el),
|
|
@@ -16676,7 +16790,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16676
16790
|
});
|
|
16677
16791
|
continue;
|
|
16678
16792
|
}
|
|
16679
|
-
if (!
|
|
16793
|
+
if (!ts13.isObjectLiteralExpression(el))
|
|
16680
16794
|
continue;
|
|
16681
16795
|
const directiveNode = getProperty(el, "directive");
|
|
16682
16796
|
if (!directiveNode)
|
|
@@ -16684,11 +16798,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16684
16798
|
const inputsNode = getProperty(el, "inputs");
|
|
16685
16799
|
const outputsNode = getProperty(el, "outputs");
|
|
16686
16800
|
const collectMap = (n) => {
|
|
16687
|
-
if (!n || !
|
|
16801
|
+
if (!n || !ts13.isArrayLiteralExpression(n))
|
|
16688
16802
|
return null;
|
|
16689
16803
|
const map = {};
|
|
16690
16804
|
for (const item of n.elements) {
|
|
16691
|
-
if (!
|
|
16805
|
+
if (!ts13.isStringLiteral(item))
|
|
16692
16806
|
continue;
|
|
16693
16807
|
const [name, alias] = item.text.split(":").map((s2) => s2.trim());
|
|
16694
16808
|
if (name)
|
|
@@ -16750,7 +16864,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16750
16864
|
return cached.info;
|
|
16751
16865
|
let source;
|
|
16752
16866
|
try {
|
|
16753
|
-
source =
|
|
16867
|
+
source = readFileSync17(filePath, "utf-8");
|
|
16754
16868
|
} catch {
|
|
16755
16869
|
childComponentInfoCache.set(cacheKey2, {
|
|
16756
16870
|
info: null,
|
|
@@ -16758,10 +16872,10 @@ var fail = (reason, detail, location) => ({
|
|
|
16758
16872
|
});
|
|
16759
16873
|
return null;
|
|
16760
16874
|
}
|
|
16761
|
-
const sf =
|
|
16875
|
+
const sf = ts13.createSourceFile(filePath, source, ts13.ScriptTarget.Latest, true);
|
|
16762
16876
|
let info = null;
|
|
16763
16877
|
for (const stmt of sf.statements) {
|
|
16764
|
-
if (!
|
|
16878
|
+
if (!ts13.isClassDeclaration(stmt))
|
|
16765
16879
|
continue;
|
|
16766
16880
|
if (!stmt.name || stmt.name.text !== className)
|
|
16767
16881
|
continue;
|
|
@@ -16804,7 +16918,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16804
16918
|
return cached.info;
|
|
16805
16919
|
let content;
|
|
16806
16920
|
try {
|
|
16807
|
-
content =
|
|
16921
|
+
content = readFileSync17(dtsPath, "utf-8");
|
|
16808
16922
|
} catch {
|
|
16809
16923
|
childComponentInfoCache.set(cacheKey2, {
|
|
16810
16924
|
info: null,
|
|
@@ -16896,9 +17010,9 @@ var fail = (reason, detail, location) => ({
|
|
|
16896
17010
|
}, buildClassToSpecMap = (sourceFile) => {
|
|
16897
17011
|
const result = new Map;
|
|
16898
17012
|
for (const stmt of sourceFile.statements) {
|
|
16899
|
-
if (!
|
|
17013
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
16900
17014
|
continue;
|
|
16901
|
-
if (!
|
|
17015
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
16902
17016
|
continue;
|
|
16903
17017
|
const spec = stmt.moduleSpecifier.text;
|
|
16904
17018
|
const clause = stmt.importClause;
|
|
@@ -16907,7 +17021,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16907
17021
|
if (clause.name)
|
|
16908
17022
|
result.set(clause.name.text, spec);
|
|
16909
17023
|
const named = clause.namedBindings;
|
|
16910
|
-
if (named &&
|
|
17024
|
+
if (named && ts13.isNamedImports(named)) {
|
|
16911
17025
|
for (const el of named.elements) {
|
|
16912
17026
|
if (el.isTypeOnly)
|
|
16913
17027
|
continue;
|
|
@@ -16920,11 +17034,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16920
17034
|
if (visited.has(startDtsPath))
|
|
16921
17035
|
return null;
|
|
16922
17036
|
visited.add(startDtsPath);
|
|
16923
|
-
if (!
|
|
17037
|
+
if (!existsSync23(startDtsPath))
|
|
16924
17038
|
return null;
|
|
16925
17039
|
let content;
|
|
16926
17040
|
try {
|
|
16927
|
-
content =
|
|
17041
|
+
content = readFileSync17(startDtsPath, "utf-8");
|
|
16928
17042
|
} catch {
|
|
16929
17043
|
return null;
|
|
16930
17044
|
}
|
|
@@ -16943,7 +17057,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16943
17057
|
});
|
|
16944
17058
|
if (!names.includes(className))
|
|
16945
17059
|
continue;
|
|
16946
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17060
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname17(startDtsPath));
|
|
16947
17061
|
if (!nextDts)
|
|
16948
17062
|
continue;
|
|
16949
17063
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -16953,7 +17067,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16953
17067
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
16954
17068
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
16955
17069
|
const fromPath = m[1] || "";
|
|
16956
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17070
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname17(startDtsPath));
|
|
16957
17071
|
if (!nextDts)
|
|
16958
17072
|
continue;
|
|
16959
17073
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -16973,16 +17087,16 @@ var fail = (reason, detail, location) => ({
|
|
|
16973
17087
|
`${base}/index.d.cts`
|
|
16974
17088
|
];
|
|
16975
17089
|
for (const c of candidates) {
|
|
16976
|
-
if (
|
|
17090
|
+
if (existsSync23(c))
|
|
16977
17091
|
return c;
|
|
16978
17092
|
}
|
|
16979
17093
|
return null;
|
|
16980
17094
|
}, findPackageDtsForJs = (jsPath) => {
|
|
16981
17095
|
const sibling = jsPath.replace(/\.[mc]?js$/, ".d.ts");
|
|
16982
|
-
if (
|
|
17096
|
+
if (existsSync23(sibling))
|
|
16983
17097
|
return sibling;
|
|
16984
17098
|
const mirror = jsPath.replace(/\/dist\//, "/dist/src/").replace(/\.[mc]?js$/, ".d.ts");
|
|
16985
|
-
if (
|
|
17099
|
+
if (existsSync23(mirror))
|
|
16986
17100
|
return mirror;
|
|
16987
17101
|
return null;
|
|
16988
17102
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
@@ -16995,7 +17109,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16995
17109
|
`${base}/index.tsx`
|
|
16996
17110
|
];
|
|
16997
17111
|
for (const candidate of candidates) {
|
|
16998
|
-
if (!
|
|
17112
|
+
if (!existsSync23(candidate))
|
|
16999
17113
|
continue;
|
|
17000
17114
|
const info = getChildComponentInfoFromTsSource(candidate, className);
|
|
17001
17115
|
if (info)
|
|
@@ -17020,7 +17134,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17020
17134
|
return result;
|
|
17021
17135
|
const classToSpec = buildClassToSpecMap(sourceFile);
|
|
17022
17136
|
for (const el of importsExpr.elements) {
|
|
17023
|
-
if (!
|
|
17137
|
+
if (!ts13.isIdentifier(el))
|
|
17024
17138
|
continue;
|
|
17025
17139
|
const className = el.text;
|
|
17026
17140
|
const spec = classToSpec.get(className);
|
|
@@ -17039,35 +17153,35 @@ var fail = (reason, detail, location) => ({
|
|
|
17039
17153
|
}
|
|
17040
17154
|
return (h2 >>> 0).toString(36);
|
|
17041
17155
|
}, initializerShapeIsStructural = (node) => {
|
|
17042
|
-
if (
|
|
17156
|
+
if (ts13.isArrowFunction(node) || ts13.isFunctionExpression(node) || ts13.isCallExpression(node) || ts13.isNewExpression(node)) {
|
|
17043
17157
|
return true;
|
|
17044
17158
|
}
|
|
17045
|
-
if (
|
|
17159
|
+
if (ts13.isConditionalExpression(node)) {
|
|
17046
17160
|
return initializerShapeIsStructural(node.whenTrue) || initializerShapeIsStructural(node.whenFalse);
|
|
17047
17161
|
}
|
|
17048
|
-
if (
|
|
17162
|
+
if (ts13.isParenthesizedExpression(node)) {
|
|
17049
17163
|
return initializerShapeIsStructural(node.expression);
|
|
17050
17164
|
}
|
|
17051
|
-
if (
|
|
17165
|
+
if (ts13.isAsExpression(node) || ts13.isTypeAssertionExpression(node)) {
|
|
17052
17166
|
return initializerShapeIsStructural(node.expression);
|
|
17053
17167
|
}
|
|
17054
|
-
if (
|
|
17168
|
+
if (ts13.isNonNullExpression(node)) {
|
|
17055
17169
|
return initializerShapeIsStructural(node.expression);
|
|
17056
17170
|
}
|
|
17057
|
-
if (
|
|
17171
|
+
if (ts13.isObjectLiteralExpression(node)) {
|
|
17058
17172
|
for (const prop of node.properties) {
|
|
17059
|
-
if (
|
|
17173
|
+
if (ts13.isPropertyAssignment(prop) && initializerShapeIsStructural(prop.initializer)) {
|
|
17060
17174
|
return true;
|
|
17061
17175
|
}
|
|
17062
|
-
if (
|
|
17176
|
+
if (ts13.isShorthandPropertyAssignment(prop))
|
|
17063
17177
|
continue;
|
|
17064
|
-
if (
|
|
17178
|
+
if (ts13.isSpreadAssignment(prop) && initializerShapeIsStructural(prop.expression)) {
|
|
17065
17179
|
return true;
|
|
17066
17180
|
}
|
|
17067
17181
|
}
|
|
17068
17182
|
return false;
|
|
17069
17183
|
}
|
|
17070
|
-
if (
|
|
17184
|
+
if (ts13.isArrayLiteralExpression(node)) {
|
|
17071
17185
|
for (const el of node.elements) {
|
|
17072
17186
|
if (initializerShapeIsStructural(el))
|
|
17073
17187
|
return true;
|
|
@@ -17078,7 +17192,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17078
17192
|
}, extractArrowFieldSig = (cls) => {
|
|
17079
17193
|
const entries = [];
|
|
17080
17194
|
for (const member of cls.members) {
|
|
17081
|
-
if (!
|
|
17195
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
17082
17196
|
continue;
|
|
17083
17197
|
const init = member.initializer;
|
|
17084
17198
|
if (!init)
|
|
@@ -17088,12 +17202,12 @@ var fail = (reason, detail, location) => ({
|
|
|
17088
17202
|
const name = member.name.getText();
|
|
17089
17203
|
let bodyText;
|
|
17090
17204
|
try {
|
|
17091
|
-
const printer =
|
|
17092
|
-
newLine:
|
|
17205
|
+
const printer = ts13.createPrinter({
|
|
17206
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17093
17207
|
omitTrailingSemicolon: true,
|
|
17094
17208
|
removeComments: true
|
|
17095
17209
|
});
|
|
17096
|
-
bodyText = printer.printNode(
|
|
17210
|
+
bodyText = printer.printNode(ts13.EmitHint.Unspecified, init, cls.getSourceFile());
|
|
17097
17211
|
} catch {
|
|
17098
17212
|
bodyText = init.getText();
|
|
17099
17213
|
}
|
|
@@ -17104,9 +17218,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17104
17218
|
}, INPUT_OUTPUT_DECORATORS, extractMemberDecoratorSig = (cls) => {
|
|
17105
17219
|
const entries = [];
|
|
17106
17220
|
for (const member of cls.members) {
|
|
17107
|
-
if (!
|
|
17221
|
+
if (!ts13.canHaveDecorators(member))
|
|
17108
17222
|
continue;
|
|
17109
|
-
const decorators =
|
|
17223
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
17110
17224
|
if (decorators.length === 0)
|
|
17111
17225
|
continue;
|
|
17112
17226
|
const memberName = member.name?.getText() ?? "<anon>";
|
|
@@ -17114,14 +17228,14 @@ var fail = (reason, detail, location) => ({
|
|
|
17114
17228
|
const expr = decorator.expression;
|
|
17115
17229
|
let decName = "<unknown>";
|
|
17116
17230
|
let argText = "";
|
|
17117
|
-
if (
|
|
17118
|
-
if (
|
|
17231
|
+
if (ts13.isCallExpression(expr)) {
|
|
17232
|
+
if (ts13.isIdentifier(expr.expression)) {
|
|
17119
17233
|
decName = expr.expression.text;
|
|
17120
17234
|
}
|
|
17121
17235
|
if (expr.arguments.length > 0) {
|
|
17122
17236
|
argText = expr.arguments.map((a) => a.getText()).join(",");
|
|
17123
17237
|
}
|
|
17124
|
-
} else if (
|
|
17238
|
+
} else if (ts13.isIdentifier(expr)) {
|
|
17125
17239
|
decName = expr.text;
|
|
17126
17240
|
}
|
|
17127
17241
|
if (INPUT_OUTPUT_DECORATORS.has(decName))
|
|
@@ -17142,22 +17256,22 @@ var fail = (reason, detail, location) => ({
|
|
|
17142
17256
|
return cached.hasProviders;
|
|
17143
17257
|
let source;
|
|
17144
17258
|
try {
|
|
17145
|
-
source =
|
|
17259
|
+
source = readFileSync17(filePath, "utf8");
|
|
17146
17260
|
} catch {
|
|
17147
17261
|
return true;
|
|
17148
17262
|
}
|
|
17149
|
-
const sf =
|
|
17263
|
+
const sf = ts13.createSourceFile(filePath, source, ts13.ScriptTarget.ES2022, true, ts13.ScriptKind.TS);
|
|
17150
17264
|
let hasProviders = false;
|
|
17151
17265
|
const visit = (node) => {
|
|
17152
17266
|
if (hasProviders)
|
|
17153
17267
|
return;
|
|
17154
|
-
if (
|
|
17155
|
-
for (const decorator of
|
|
17268
|
+
if (ts13.isClassDeclaration(node)) {
|
|
17269
|
+
for (const decorator of ts13.getDecorators(node) ?? []) {
|
|
17156
17270
|
const expr = decorator.expression;
|
|
17157
|
-
if (!
|
|
17271
|
+
if (!ts13.isCallExpression(expr))
|
|
17158
17272
|
continue;
|
|
17159
17273
|
const arg = expr.arguments[0];
|
|
17160
|
-
if (!arg || !
|
|
17274
|
+
if (!arg || !ts13.isObjectLiteralExpression(arg))
|
|
17161
17275
|
continue;
|
|
17162
17276
|
if (getProperty(arg, "providers") !== null) {
|
|
17163
17277
|
hasProviders = true;
|
|
@@ -17165,7 +17279,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17165
17279
|
}
|
|
17166
17280
|
}
|
|
17167
17281
|
}
|
|
17168
|
-
|
|
17282
|
+
ts13.forEachChild(node, visit);
|
|
17169
17283
|
};
|
|
17170
17284
|
visit(sf);
|
|
17171
17285
|
providerProbeCache.set(filePath, {
|
|
@@ -17175,10 +17289,10 @@ var fail = (reason, detail, location) => ({
|
|
|
17175
17289
|
return hasProviders;
|
|
17176
17290
|
}, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
|
|
17177
17291
|
for (const stmt of sourceFile.statements) {
|
|
17178
|
-
if (!
|
|
17292
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17179
17293
|
continue;
|
|
17180
17294
|
const moduleSpec = stmt.moduleSpecifier;
|
|
17181
|
-
if (!
|
|
17295
|
+
if (!ts13.isStringLiteral(moduleSpec))
|
|
17182
17296
|
continue;
|
|
17183
17297
|
const spec = moduleSpec.text;
|
|
17184
17298
|
if (!spec.startsWith(".") && !spec.startsWith("/"))
|
|
@@ -17192,7 +17306,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17192
17306
|
}
|
|
17193
17307
|
if (importClause.namedBindings) {
|
|
17194
17308
|
const nb = importClause.namedBindings;
|
|
17195
|
-
if (
|
|
17309
|
+
if (ts13.isNamespaceImport(nb)) {
|
|
17196
17310
|
if (nb.name.text === identifierName)
|
|
17197
17311
|
matches = true;
|
|
17198
17312
|
} else {
|
|
@@ -17209,11 +17323,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17209
17323
|
const resolved = resolve23(componentDir, spec);
|
|
17210
17324
|
for (const ext of TS_EXTENSIONS) {
|
|
17211
17325
|
const candidate = resolved + ext;
|
|
17212
|
-
if (
|
|
17326
|
+
if (existsSync23(candidate))
|
|
17213
17327
|
return candidate;
|
|
17214
17328
|
}
|
|
17215
17329
|
const indexCandidate = resolve23(resolved, "index.ts");
|
|
17216
|
-
if (
|
|
17330
|
+
if (existsSync23(indexCandidate))
|
|
17217
17331
|
return indexCandidate;
|
|
17218
17332
|
}
|
|
17219
17333
|
return null;
|
|
@@ -17222,7 +17336,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17222
17336
|
return [];
|
|
17223
17337
|
const sig = [];
|
|
17224
17338
|
for (const entry of importsExpr.elements) {
|
|
17225
|
-
if (
|
|
17339
|
+
if (ts13.isIdentifier(entry)) {
|
|
17226
17340
|
const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
|
|
17227
17341
|
if (importPath) {
|
|
17228
17342
|
if (fileHasModuleProviders(importPath)) {
|
|
@@ -17241,13 +17355,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17241
17355
|
}, extractPropertyFieldNames = (cls) => {
|
|
17242
17356
|
const names = [];
|
|
17243
17357
|
for (const member of cls.members) {
|
|
17244
|
-
if (!
|
|
17358
|
+
if (!ts13.isPropertyDeclaration(member) && !ts13.isMethodDeclaration(member) && !ts13.isGetAccessorDeclaration(member) && !ts13.isSetAccessorDeclaration(member)) {
|
|
17245
17359
|
continue;
|
|
17246
17360
|
}
|
|
17247
17361
|
const name = member.name;
|
|
17248
17362
|
if (name === undefined)
|
|
17249
17363
|
continue;
|
|
17250
|
-
const text =
|
|
17364
|
+
const text = ts13.isIdentifier(name) ? name.text : ts13.isStringLiteral(name) || ts13.isNoSubstitutionTemplateLiteral(name) ? name.text : name.getText();
|
|
17251
17365
|
if (text.length > 0)
|
|
17252
17366
|
names.push(text);
|
|
17253
17367
|
}
|
|
@@ -17255,7 +17369,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17255
17369
|
}, extractTopLevelImports = (sourceFile) => {
|
|
17256
17370
|
const names = new Set;
|
|
17257
17371
|
for (const stmt of sourceFile.statements) {
|
|
17258
|
-
if (!
|
|
17372
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17259
17373
|
continue;
|
|
17260
17374
|
const clause = stmt.importClause;
|
|
17261
17375
|
if (!clause)
|
|
@@ -17267,9 +17381,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17267
17381
|
const bindings = clause.namedBindings;
|
|
17268
17382
|
if (!bindings)
|
|
17269
17383
|
continue;
|
|
17270
|
-
if (
|
|
17384
|
+
if (ts13.isNamespaceImport(bindings)) {
|
|
17271
17385
|
names.add(bindings.name.text);
|
|
17272
|
-
} else if (
|
|
17386
|
+
} else if (ts13.isNamedImports(bindings)) {
|
|
17273
17387
|
for (const el of bindings.elements) {
|
|
17274
17388
|
if (el.isTypeOnly)
|
|
17275
17389
|
continue;
|
|
@@ -17281,18 +17395,18 @@ var fail = (reason, detail, location) => ({
|
|
|
17281
17395
|
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
|
|
17282
17396
|
const ctorParamTypes = [];
|
|
17283
17397
|
for (const member of cls.members) {
|
|
17284
|
-
if (!
|
|
17398
|
+
if (!ts13.isConstructorDeclaration(member))
|
|
17285
17399
|
continue;
|
|
17286
17400
|
for (const param of member.parameters) {
|
|
17287
17401
|
const typeText = param.type ? param.type.getText() : "";
|
|
17288
|
-
const decorators =
|
|
17402
|
+
const decorators = ts13.getDecorators(param) ?? [];
|
|
17289
17403
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
17290
17404
|
const expr = d2.expression;
|
|
17291
|
-
if (
|
|
17405
|
+
if (ts13.isCallExpression(expr) && ts13.isIdentifier(expr.expression)) {
|
|
17292
17406
|
const args = expr.arguments.map((a) => a.getText()).join(",");
|
|
17293
17407
|
return `@${expr.expression.text}(${args})`;
|
|
17294
17408
|
}
|
|
17295
|
-
if (
|
|
17409
|
+
if (ts13.isIdentifier(expr)) {
|
|
17296
17410
|
return `@${expr.text}`;
|
|
17297
17411
|
}
|
|
17298
17412
|
return "@<unknown>";
|
|
@@ -17308,12 +17422,12 @@ var fail = (reason, detail, location) => ({
|
|
|
17308
17422
|
const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
|
|
17309
17423
|
const topLevelImports = extractTopLevelImports(sourceFile);
|
|
17310
17424
|
const propertyFieldNames = extractPropertyFieldNames(cls);
|
|
17311
|
-
const printer =
|
|
17312
|
-
newLine:
|
|
17425
|
+
const printer = ts13.createPrinter({
|
|
17426
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17313
17427
|
omitTrailingSemicolon: true,
|
|
17314
17428
|
removeComments: true
|
|
17315
17429
|
});
|
|
17316
|
-
const canonicalText = (node) => printer.printNode(
|
|
17430
|
+
const canonicalText = (node) => printer.printNode(ts13.EmitHint.Unspecified, node, sourceFile);
|
|
17317
17431
|
const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
|
|
17318
17432
|
const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
|
|
17319
17433
|
const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
|
|
@@ -17326,13 +17440,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17326
17440
|
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
17327
17441
|
const pageExportEntries = [];
|
|
17328
17442
|
for (const stmt of sourceFile.statements) {
|
|
17329
|
-
if (!
|
|
17443
|
+
if (!ts13.isVariableStatement(stmt))
|
|
17330
17444
|
continue;
|
|
17331
|
-
const isExported = stmt.modifiers?.some((m) => m.kind ===
|
|
17445
|
+
const isExported = stmt.modifiers?.some((m) => m.kind === ts13.SyntaxKind.ExportKeyword);
|
|
17332
17446
|
if (!isExported)
|
|
17333
17447
|
continue;
|
|
17334
17448
|
for (const decl of stmt.declarationList.declarations) {
|
|
17335
|
-
if (!
|
|
17449
|
+
if (!ts13.isIdentifier(decl.name))
|
|
17336
17450
|
continue;
|
|
17337
17451
|
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
17338
17452
|
continue;
|
|
@@ -17373,35 +17487,35 @@ var fail = (reason, detail, location) => ({
|
|
|
17373
17487
|
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
17374
17488
|
const memberSources = [];
|
|
17375
17489
|
let hasStatic = false;
|
|
17376
|
-
const printer =
|
|
17490
|
+
const printer = ts13.createPrinter({ removeComments: true });
|
|
17377
17491
|
for (const member of classNode.members) {
|
|
17378
|
-
if (
|
|
17379
|
-
const modifiers = (
|
|
17380
|
-
const cleaned =
|
|
17381
|
-
memberSources.push(printer.printNode(
|
|
17492
|
+
if (ts13.isPropertyDeclaration(member)) {
|
|
17493
|
+
const modifiers = (ts13.getModifiers(member) ?? []).filter((m) => m.kind !== ts13.SyntaxKind.PrivateKeyword && m.kind !== ts13.SyntaxKind.PublicKeyword && m.kind !== ts13.SyntaxKind.ProtectedKeyword && m.kind !== ts13.SyntaxKind.ReadonlyKeyword && m.kind !== ts13.SyntaxKind.OverrideKeyword);
|
|
17494
|
+
const cleaned = ts13.factory.createPropertyDeclaration(modifiers, member.name, undefined, undefined, member.initializer);
|
|
17495
|
+
memberSources.push(printer.printNode(ts13.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
17382
17496
|
continue;
|
|
17383
17497
|
}
|
|
17384
|
-
if (
|
|
17385
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
17386
|
-
const cleaned =
|
|
17387
|
-
memberSources.push(printer.printNode(
|
|
17498
|
+
if (ts13.isConstructorDeclaration(member)) {
|
|
17499
|
+
const cleanedParams = member.parameters.map((param) => ts13.factory.updateParameterDeclaration(param, (ts13.getModifiers(param) ?? []).filter((m) => m.kind !== ts13.SyntaxKind.PrivateKeyword && m.kind !== ts13.SyntaxKind.PublicKeyword && m.kind !== ts13.SyntaxKind.ProtectedKeyword && m.kind !== ts13.SyntaxKind.ReadonlyKeyword && m.kind !== ts13.SyntaxKind.OverrideKeyword), param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
17500
|
+
const cleaned = ts13.factory.createConstructorDeclaration([], cleanedParams, member.body);
|
|
17501
|
+
memberSources.push(printer.printNode(ts13.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
17388
17502
|
continue;
|
|
17389
17503
|
}
|
|
17390
|
-
if (
|
|
17391
|
-
const modifiers =
|
|
17392
|
-
const isStatic = modifiers.some((m) => m.kind ===
|
|
17504
|
+
if (ts13.isMethodDeclaration(member) || ts13.isGetAccessorDeclaration(member) || ts13.isSetAccessorDeclaration(member)) {
|
|
17505
|
+
const modifiers = ts13.getModifiers(member) ?? [];
|
|
17506
|
+
const isStatic = modifiers.some((m) => m.kind === ts13.SyntaxKind.StaticKeyword);
|
|
17393
17507
|
if (isStatic)
|
|
17394
17508
|
hasStatic = true;
|
|
17395
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
17509
|
+
const cleanedParams = member.parameters.map((param) => ts13.factory.updateParameterDeclaration(param, ts13.getModifiers(param) ?? [], param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
17396
17510
|
let cleaned;
|
|
17397
|
-
if (
|
|
17398
|
-
cleaned =
|
|
17399
|
-
} else if (
|
|
17400
|
-
cleaned =
|
|
17511
|
+
if (ts13.isMethodDeclaration(member)) {
|
|
17512
|
+
cleaned = ts13.factory.createMethodDeclaration(modifiers, member.asteriskToken, member.name, member.questionToken, member.typeParameters, cleanedParams, member.type, member.body);
|
|
17513
|
+
} else if (ts13.isGetAccessorDeclaration(member)) {
|
|
17514
|
+
cleaned = ts13.factory.createGetAccessorDeclaration(modifiers, member.name, cleanedParams, member.type, member.body);
|
|
17401
17515
|
} else {
|
|
17402
|
-
cleaned =
|
|
17516
|
+
cleaned = ts13.factory.createSetAccessorDeclaration(modifiers, member.name, cleanedParams, member.body);
|
|
17403
17517
|
}
|
|
17404
|
-
const printed = printer.printNode(
|
|
17518
|
+
const printed = printer.printNode(ts13.EmitHint.Unspecified, cleaned, classNode.getSourceFile());
|
|
17405
17519
|
memberSources.push(printed);
|
|
17406
17520
|
}
|
|
17407
17521
|
}
|
|
@@ -17413,10 +17527,10 @@ ${memberSources.join(`
|
|
|
17413
17527
|
}`;
|
|
17414
17528
|
let transpiled;
|
|
17415
17529
|
try {
|
|
17416
|
-
transpiled =
|
|
17530
|
+
transpiled = ts13.transpileModule(wrappedSource, {
|
|
17417
17531
|
compilerOptions: {
|
|
17418
|
-
module:
|
|
17419
|
-
target:
|
|
17532
|
+
module: ts13.ModuleKind.ES2022,
|
|
17533
|
+
target: ts13.ScriptTarget.ES2022
|
|
17420
17534
|
},
|
|
17421
17535
|
reportDiagnostics: false
|
|
17422
17536
|
}).outputText;
|
|
@@ -17446,11 +17560,11 @@ ${transpiled}
|
|
|
17446
17560
|
}${staticPatch}`;
|
|
17447
17561
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
17448
17562
|
const abs = resolve23(componentDir, url);
|
|
17449
|
-
if (!
|
|
17563
|
+
if (!existsSync23(abs))
|
|
17450
17564
|
return null;
|
|
17451
17565
|
const ext = extname6(abs).toLowerCase();
|
|
17452
17566
|
if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
|
|
17453
|
-
return
|
|
17567
|
+
return readFileSync17(abs, "utf8");
|
|
17454
17568
|
}
|
|
17455
17569
|
try {
|
|
17456
17570
|
const { compileStyleFileIfNeededSync: compileStyleFileIfNeededSync2 } = (init_stylePreprocessor(), __toCommonJS(exports_stylePreprocessor));
|
|
@@ -17487,10 +17601,10 @@ ${block}
|
|
|
17487
17601
|
return cached;
|
|
17488
17602
|
const tsconfigPath = resolve23(projectRoot, "tsconfig.json");
|
|
17489
17603
|
const opts = {};
|
|
17490
|
-
if (
|
|
17604
|
+
if (existsSync23(tsconfigPath)) {
|
|
17491
17605
|
try {
|
|
17492
|
-
const text =
|
|
17493
|
-
const parsed =
|
|
17606
|
+
const text = readFileSync17(tsconfigPath, "utf8");
|
|
17607
|
+
const parsed = ts13.parseConfigFileTextToJson(tsconfigPath, text);
|
|
17494
17608
|
if (!parsed.error && parsed.config) {
|
|
17495
17609
|
const cfg = parsed.config;
|
|
17496
17610
|
const ang = cfg.angularCompilerOptions ?? {};
|
|
@@ -17514,7 +17628,7 @@ ${block}
|
|
|
17514
17628
|
}, tryFastHmr = async (params) => {
|
|
17515
17629
|
const { componentFilePath, className } = params;
|
|
17516
17630
|
const projectRoot = params.projectRoot ?? process.cwd();
|
|
17517
|
-
if (!
|
|
17631
|
+
if (!existsSync23(componentFilePath)) {
|
|
17518
17632
|
return fail("file-not-found", componentFilePath);
|
|
17519
17633
|
}
|
|
17520
17634
|
let compiler;
|
|
@@ -17523,8 +17637,8 @@ ${block}
|
|
|
17523
17637
|
} catch (err) {
|
|
17524
17638
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
17525
17639
|
}
|
|
17526
|
-
const tsSource =
|
|
17527
|
-
const sourceFile =
|
|
17640
|
+
const tsSource = readFileSync17(componentFilePath, "utf8");
|
|
17641
|
+
const sourceFile = ts13.createSourceFile(componentFilePath, tsSource, ts13.ScriptTarget.ES2022, true, ts13.ScriptKind.TS);
|
|
17528
17642
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
17529
17643
|
if (!classNode) {
|
|
17530
17644
|
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -17550,7 +17664,7 @@ ${block}
|
|
|
17550
17664
|
rebootstrapRequired: false
|
|
17551
17665
|
};
|
|
17552
17666
|
}
|
|
17553
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
17667
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname17(componentFilePath), projectRoot)) {
|
|
17554
17668
|
return fail("inherits-decorated-class");
|
|
17555
17669
|
}
|
|
17556
17670
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -17562,7 +17676,7 @@ ${block}
|
|
|
17562
17676
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
17563
17677
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
17564
17678
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
17565
|
-
const componentDir =
|
|
17679
|
+
const componentDir = dirname17(componentFilePath);
|
|
17566
17680
|
let templateText;
|
|
17567
17681
|
let templatePath;
|
|
17568
17682
|
if (decoratorMeta.template !== null) {
|
|
@@ -17570,10 +17684,10 @@ ${block}
|
|
|
17570
17684
|
templatePath = componentFilePath;
|
|
17571
17685
|
} else if (decoratorMeta.templateUrl) {
|
|
17572
17686
|
const tplAbs = resolve23(componentDir, decoratorMeta.templateUrl);
|
|
17573
|
-
if (!
|
|
17687
|
+
if (!existsSync23(tplAbs)) {
|
|
17574
17688
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
17575
17689
|
}
|
|
17576
|
-
templateText =
|
|
17690
|
+
templateText = readFileSync17(tplAbs, "utf8");
|
|
17577
17691
|
templatePath = tplAbs;
|
|
17578
17692
|
} else {
|
|
17579
17693
|
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
@@ -17644,7 +17758,7 @@ ${block}
|
|
|
17644
17758
|
viewQueries: advancedMetadata.viewQueries,
|
|
17645
17759
|
host: advancedMetadata.host,
|
|
17646
17760
|
lifecycle: {
|
|
17647
|
-
usesOnChanges: classNode.members.some((m) =>
|
|
17761
|
+
usesOnChanges: classNode.members.some((m) => ts13.isMethodDeclaration(m) && m.name !== undefined && ts13.isIdentifier(m.name) && m.name.text === "ngOnChanges")
|
|
17648
17762
|
},
|
|
17649
17763
|
inputs,
|
|
17650
17764
|
outputs,
|
|
@@ -17700,15 +17814,15 @@ ${block}
|
|
|
17700
17814
|
}
|
|
17701
17815
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
17702
17816
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
17703
|
-
const exportedDecl =
|
|
17704
|
-
|
|
17705
|
-
|
|
17817
|
+
const exportedDecl = ts13.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
17818
|
+
ts13.factory.createToken(ts13.SyntaxKind.ExportKeyword),
|
|
17819
|
+
ts13.factory.createToken(ts13.SyntaxKind.DefaultKeyword)
|
|
17706
17820
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
17707
|
-
const printer =
|
|
17708
|
-
newLine:
|
|
17821
|
+
const printer = ts13.createPrinter({
|
|
17822
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17709
17823
|
removeComments: false
|
|
17710
17824
|
});
|
|
17711
|
-
const fnText = printer.printNode(
|
|
17825
|
+
const fnText = printer.printNode(ts13.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
17712
17826
|
const provisionalMethodsBlock = buildFreshClassMethodsBlock(classNode, className) ?? "";
|
|
17713
17827
|
const referencedNames = new Set;
|
|
17714
17828
|
const identRe = /[A-Za-z_$][A-Za-z0-9_$]*/g;
|
|
@@ -17718,33 +17832,33 @@ ${block}
|
|
|
17718
17832
|
}
|
|
17719
17833
|
const sourceScopeNames = new Set;
|
|
17720
17834
|
for (const stmt of sourceFile.statements) {
|
|
17721
|
-
if (
|
|
17722
|
-
if (!
|
|
17835
|
+
if (ts13.isImportDeclaration(stmt)) {
|
|
17836
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
17723
17837
|
continue;
|
|
17724
17838
|
const clause = stmt.importClause;
|
|
17725
17839
|
if (clause?.name)
|
|
17726
17840
|
sourceScopeNames.add(clause.name.text);
|
|
17727
|
-
if (clause?.namedBindings &&
|
|
17841
|
+
if (clause?.namedBindings && ts13.isNamedImports(clause.namedBindings)) {
|
|
17728
17842
|
for (const el of clause.namedBindings.elements) {
|
|
17729
17843
|
if (el.isTypeOnly)
|
|
17730
17844
|
continue;
|
|
17731
17845
|
sourceScopeNames.add(el.name.text);
|
|
17732
17846
|
}
|
|
17733
|
-
} else if (clause?.namedBindings &&
|
|
17847
|
+
} else if (clause?.namedBindings && ts13.isNamespaceImport(clause.namedBindings)) {
|
|
17734
17848
|
sourceScopeNames.add(clause.namedBindings.name.text);
|
|
17735
17849
|
}
|
|
17736
17850
|
continue;
|
|
17737
17851
|
}
|
|
17738
|
-
if (
|
|
17852
|
+
if (ts13.isVariableStatement(stmt) || stmt.kind === ts13.SyntaxKind.VariableStatement) {
|
|
17739
17853
|
const varStmt = stmt;
|
|
17740
17854
|
for (const decl of varStmt.declarationList.declarations) {
|
|
17741
|
-
if (
|
|
17855
|
+
if (ts13.isIdentifier(decl.name)) {
|
|
17742
17856
|
sourceScopeNames.add(decl.name.text);
|
|
17743
17857
|
}
|
|
17744
17858
|
}
|
|
17745
17859
|
continue;
|
|
17746
17860
|
}
|
|
17747
|
-
if (
|
|
17861
|
+
if (ts13.isFunctionDeclaration(stmt) || ts13.isClassDeclaration(stmt)) {
|
|
17748
17862
|
if (stmt.name)
|
|
17749
17863
|
sourceScopeNames.add(stmt.name.text);
|
|
17750
17864
|
}
|
|
@@ -17755,7 +17869,7 @@ ${block}
|
|
|
17755
17869
|
}
|
|
17756
17870
|
const allImportedNames = new Set;
|
|
17757
17871
|
for (const stmt of sourceFile.statements) {
|
|
17758
|
-
if (!
|
|
17872
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17759
17873
|
continue;
|
|
17760
17874
|
const clause = stmt.importClause;
|
|
17761
17875
|
if (!clause || clause.isTypeOnly)
|
|
@@ -17765,7 +17879,7 @@ ${block}
|
|
|
17765
17879
|
const bindings = clause.namedBindings;
|
|
17766
17880
|
if (!bindings)
|
|
17767
17881
|
continue;
|
|
17768
|
-
if (
|
|
17882
|
+
if (ts13.isNamespaceImport(bindings)) {
|
|
17769
17883
|
allImportedNames.add(bindings.name.text);
|
|
17770
17884
|
} else {
|
|
17771
17885
|
for (const el of bindings.elements) {
|
|
@@ -17777,10 +17891,10 @@ ${block}
|
|
|
17777
17891
|
}
|
|
17778
17892
|
const depsToDestructure = [...sourceScopeNames].filter((n) => referencedNames.has(n) || allImportedNames.has(n));
|
|
17779
17893
|
const tsSourceText = fnText;
|
|
17780
|
-
const transpiled =
|
|
17894
|
+
const transpiled = ts13.transpileModule(tsSourceText, {
|
|
17781
17895
|
compilerOptions: {
|
|
17782
|
-
module:
|
|
17783
|
-
target:
|
|
17896
|
+
module: ts13.ModuleKind.ES2022,
|
|
17897
|
+
target: ts13.ScriptTarget.ES2022
|
|
17784
17898
|
},
|
|
17785
17899
|
fileName: componentFilePath,
|
|
17786
17900
|
reportDiagnostics: false
|
|
@@ -18323,16 +18437,16 @@ __export(exports_compileEmber, {
|
|
|
18323
18437
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
18324
18438
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
18325
18439
|
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
18326
|
-
dirname: () =>
|
|
18440
|
+
dirname: () => dirname18,
|
|
18327
18441
|
compileEmberFileSource: () => compileEmberFileSource,
|
|
18328
18442
|
compileEmberFile: () => compileEmberFile,
|
|
18329
18443
|
compileEmber: () => compileEmber,
|
|
18330
18444
|
clearEmberCompilerCache: () => clearEmberCompilerCache,
|
|
18331
18445
|
basename: () => basename9
|
|
18332
18446
|
});
|
|
18333
|
-
import { existsSync as
|
|
18447
|
+
import { existsSync as existsSync24 } from "fs";
|
|
18334
18448
|
import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
|
|
18335
|
-
import { basename as basename9, dirname as
|
|
18449
|
+
import { basename as basename9, dirname as dirname18, extname as extname7, join as join30, resolve as resolve24 } from "path";
|
|
18336
18450
|
var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file3 } = globalThis.Bun;
|
|
18337
18451
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
18338
18452
|
if (cachedPreprocessor)
|
|
@@ -18428,11 +18542,11 @@ export const importSync = (specifier) => {
|
|
|
18428
18542
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
18429
18543
|
if (!originalImporter)
|
|
18430
18544
|
return;
|
|
18431
|
-
const candidateBase = resolve24(
|
|
18545
|
+
const candidateBase = resolve24(dirname18(originalImporter), args.path);
|
|
18432
18546
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
18433
18547
|
for (const ext of extensionsToTry) {
|
|
18434
18548
|
const candidate = candidateBase + ext;
|
|
18435
|
-
if (
|
|
18549
|
+
if (existsSync24(candidate))
|
|
18436
18550
|
return { path: candidate };
|
|
18437
18551
|
}
|
|
18438
18552
|
return;
|
|
@@ -18451,8 +18565,8 @@ export const importSync = (specifier) => {
|
|
|
18451
18565
|
build.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
18452
18566
|
if (standalonePackages.has(args.path))
|
|
18453
18567
|
return;
|
|
18454
|
-
const internal =
|
|
18455
|
-
if (
|
|
18568
|
+
const internal = join30(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
18569
|
+
if (existsSync24(internal))
|
|
18456
18570
|
return { path: internal };
|
|
18457
18571
|
return;
|
|
18458
18572
|
});
|
|
@@ -18499,16 +18613,16 @@ export default PageComponent;
|
|
|
18499
18613
|
}
|
|
18500
18614
|
const transpiled = transpiler5.transformSync(preprocessed);
|
|
18501
18615
|
const baseName = basename9(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
18502
|
-
const tmpDir =
|
|
18503
|
-
const serverDir =
|
|
18504
|
-
const clientDir =
|
|
18616
|
+
const tmpDir = join30(compiledRoot, "_tmp");
|
|
18617
|
+
const serverDir = join30(compiledRoot, "server");
|
|
18618
|
+
const clientDir = join30(compiledRoot, "client");
|
|
18505
18619
|
await Promise.all([
|
|
18506
18620
|
mkdir6(tmpDir, { recursive: true }),
|
|
18507
18621
|
mkdir6(serverDir, { recursive: true }),
|
|
18508
18622
|
mkdir6(clientDir, { recursive: true })
|
|
18509
18623
|
]);
|
|
18510
|
-
const tmpPagePath = resolve24(
|
|
18511
|
-
const tmpHarnessPath = resolve24(
|
|
18624
|
+
const tmpPagePath = resolve24(join30(tmpDir, `${baseName}.module.js`));
|
|
18625
|
+
const tmpHarnessPath = resolve24(join30(tmpDir, `${baseName}.harness.js`));
|
|
18512
18626
|
await Promise.all([
|
|
18513
18627
|
write4(tmpPagePath, transpiled),
|
|
18514
18628
|
write4(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -18516,7 +18630,7 @@ export default PageComponent;
|
|
|
18516
18630
|
const stagedSourceMap = new Map([
|
|
18517
18631
|
[tmpPagePath, resolvedEntry]
|
|
18518
18632
|
]);
|
|
18519
|
-
const serverPath =
|
|
18633
|
+
const serverPath = join30(serverDir, `${baseName}.js`);
|
|
18520
18634
|
const buildResult = await bunBuild2({
|
|
18521
18635
|
entrypoints: [tmpHarnessPath],
|
|
18522
18636
|
format: "esm",
|
|
@@ -18533,7 +18647,7 @@ export default PageComponent;
|
|
|
18533
18647
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
18534
18648
|
}
|
|
18535
18649
|
await rm4(tmpDir, { force: true, recursive: true });
|
|
18536
|
-
const clientPath =
|
|
18650
|
+
const clientPath = join30(clientDir, `${baseName}.js`);
|
|
18537
18651
|
await write4(clientPath, transpiled);
|
|
18538
18652
|
return { clientPath, serverPath };
|
|
18539
18653
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -18561,7 +18675,7 @@ export default PageComponent;
|
|
|
18561
18675
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
18562
18676
|
}
|
|
18563
18677
|
return transpiler5.transformSync(preprocessed);
|
|
18564
|
-
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) =>
|
|
18678
|
+
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join30(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join30(getEmberCompiledRoot(emberDir), "client");
|
|
18565
18679
|
var init_compileEmber = __esm(() => {
|
|
18566
18680
|
init_generatedDir();
|
|
18567
18681
|
transpiler5 = new Transpiler4({
|
|
@@ -18582,8 +18696,8 @@ __export(exports_buildReactVendor, {
|
|
|
18582
18696
|
computeVendorPaths: () => computeVendorPaths,
|
|
18583
18697
|
buildReactVendor: () => buildReactVendor
|
|
18584
18698
|
});
|
|
18585
|
-
import { existsSync as
|
|
18586
|
-
import { join as
|
|
18699
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync10 } from "fs";
|
|
18700
|
+
import { join as join31, resolve as resolve25 } from "path";
|
|
18587
18701
|
import { rm as rm5 } from "fs/promises";
|
|
18588
18702
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
18589
18703
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
@@ -18596,7 +18710,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18596
18710
|
resolve25(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
18597
18711
|
];
|
|
18598
18712
|
for (const candidate of candidates) {
|
|
18599
|
-
if (
|
|
18713
|
+
if (existsSync25(candidate)) {
|
|
18600
18714
|
return candidate.replace(/\\/g, "/");
|
|
18601
18715
|
}
|
|
18602
18716
|
}
|
|
@@ -18637,14 +18751,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18637
18751
|
`)}
|
|
18638
18752
|
`;
|
|
18639
18753
|
}, buildReactVendor = async (buildDir) => {
|
|
18640
|
-
const vendorDir =
|
|
18754
|
+
const vendorDir = join31(buildDir, "react", "vendor");
|
|
18641
18755
|
mkdirSync10(vendorDir, { recursive: true });
|
|
18642
|
-
const tmpDir =
|
|
18756
|
+
const tmpDir = join31(buildDir, "_vendor_tmp");
|
|
18643
18757
|
mkdirSync10(tmpDir, { recursive: true });
|
|
18644
18758
|
const specifiers = resolveVendorSpecifiers();
|
|
18645
18759
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18646
18760
|
const safeName = toSafeFileName(specifier);
|
|
18647
|
-
const entryPath =
|
|
18761
|
+
const entryPath = join31(tmpDir, `${safeName}.ts`);
|
|
18648
18762
|
const source = await generateEntrySource(specifier);
|
|
18649
18763
|
await Bun.write(entryPath, source);
|
|
18650
18764
|
return entryPath;
|
|
@@ -18709,7 +18823,7 @@ __export(exports_buildAngularVendor, {
|
|
|
18709
18823
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
18710
18824
|
});
|
|
18711
18825
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
18712
|
-
import { join as
|
|
18826
|
+
import { join as join32 } from "path";
|
|
18713
18827
|
import { rm as rm6 } from "fs/promises";
|
|
18714
18828
|
var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
|
|
18715
18829
|
var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable2 = (specifier) => {
|
|
@@ -18746,7 +18860,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18746
18860
|
}
|
|
18747
18861
|
return { angular, transitiveRoots };
|
|
18748
18862
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
18749
|
-
const { readFileSync:
|
|
18863
|
+
const { readFileSync: readFileSync18 } = await import("fs");
|
|
18750
18864
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
18751
18865
|
const visited = new Set;
|
|
18752
18866
|
const frontier = [];
|
|
@@ -18767,7 +18881,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18767
18881
|
}
|
|
18768
18882
|
let content;
|
|
18769
18883
|
try {
|
|
18770
|
-
content =
|
|
18884
|
+
content = readFileSync18(resolved, "utf-8");
|
|
18771
18885
|
} catch {
|
|
18772
18886
|
continue;
|
|
18773
18887
|
}
|
|
@@ -18806,14 +18920,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18806
18920
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
18807
18921
|
return Array.from(angular).filter(isResolvable2);
|
|
18808
18922
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
18809
|
-
const vendorDir =
|
|
18923
|
+
const vendorDir = join32(buildDir, "angular", "vendor");
|
|
18810
18924
|
mkdirSync11(vendorDir, { recursive: true });
|
|
18811
|
-
const tmpDir =
|
|
18925
|
+
const tmpDir = join32(buildDir, "_angular_vendor_tmp");
|
|
18812
18926
|
mkdirSync11(tmpDir, { recursive: true });
|
|
18813
18927
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
18814
18928
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18815
18929
|
const safeName = toSafeFileName2(specifier);
|
|
18816
|
-
const entryPath =
|
|
18930
|
+
const entryPath = join32(tmpDir, `${safeName}.ts`);
|
|
18817
18931
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
18818
18932
|
return entryPath;
|
|
18819
18933
|
}));
|
|
@@ -18844,9 +18958,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18844
18958
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
18845
18959
|
return computeAngularVendorPaths(specifiers);
|
|
18846
18960
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
18847
|
-
const vendorDir =
|
|
18961
|
+
const vendorDir = join32(buildDir, "angular", "vendor", "server");
|
|
18848
18962
|
mkdirSync11(vendorDir, { recursive: true });
|
|
18849
|
-
const tmpDir =
|
|
18963
|
+
const tmpDir = join32(buildDir, "_angular_server_vendor_tmp");
|
|
18850
18964
|
mkdirSync11(tmpDir, { recursive: true });
|
|
18851
18965
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
18852
18966
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -18857,7 +18971,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18857
18971
|
const specifiers = Array.from(allSpecs);
|
|
18858
18972
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18859
18973
|
const safeName = toSafeFileName2(specifier);
|
|
18860
|
-
const entryPath =
|
|
18974
|
+
const entryPath = join32(tmpDir, `${safeName}.ts`);
|
|
18861
18975
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
18862
18976
|
return entryPath;
|
|
18863
18977
|
}));
|
|
@@ -18879,9 +18993,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18879
18993
|
return specifiers;
|
|
18880
18994
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
18881
18995
|
const paths = {};
|
|
18882
|
-
const vendorDir =
|
|
18996
|
+
const vendorDir = join32(buildDir, "angular", "vendor", "server");
|
|
18883
18997
|
for (const specifier of specifiers) {
|
|
18884
|
-
paths[specifier] =
|
|
18998
|
+
paths[specifier] = join32(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
18885
18999
|
}
|
|
18886
19000
|
return paths;
|
|
18887
19001
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -18937,17 +19051,17 @@ __export(exports_buildVueVendor, {
|
|
|
18937
19051
|
buildVueVendor: () => buildVueVendor
|
|
18938
19052
|
});
|
|
18939
19053
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
18940
|
-
import { join as
|
|
19054
|
+
import { join as join33 } from "path";
|
|
18941
19055
|
import { rm as rm7 } from "fs/promises";
|
|
18942
19056
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
18943
19057
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
18944
|
-
const vendorDir =
|
|
19058
|
+
const vendorDir = join33(buildDir, "vue", "vendor");
|
|
18945
19059
|
mkdirSync12(vendorDir, { recursive: true });
|
|
18946
|
-
const tmpDir =
|
|
19060
|
+
const tmpDir = join33(buildDir, "_vue_vendor_tmp");
|
|
18947
19061
|
mkdirSync12(tmpDir, { recursive: true });
|
|
18948
19062
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
18949
19063
|
const safeName = toSafeFileName3(specifier);
|
|
18950
|
-
const entryPath =
|
|
19064
|
+
const entryPath = join33(tmpDir, `${safeName}.ts`);
|
|
18951
19065
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
18952
19066
|
`);
|
|
18953
19067
|
return entryPath;
|
|
@@ -18972,11 +19086,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
18972
19086
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
18973
19087
|
return;
|
|
18974
19088
|
}
|
|
18975
|
-
const { readFileSync:
|
|
19089
|
+
const { readFileSync: readFileSync18, writeFileSync: writeFileSync10, readdirSync: readdirSync4 } = await import("fs");
|
|
18976
19090
|
const files = readdirSync4(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
18977
19091
|
for (const file4 of files) {
|
|
18978
|
-
const filePath =
|
|
18979
|
-
const content =
|
|
19092
|
+
const filePath = join33(vendorDir, file4);
|
|
19093
|
+
const content = readFileSync18(filePath, "utf-8");
|
|
18980
19094
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
18981
19095
|
continue;
|
|
18982
19096
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -19002,7 +19116,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
19002
19116
|
buildSvelteVendor: () => buildSvelteVendor
|
|
19003
19117
|
});
|
|
19004
19118
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19005
|
-
import { join as
|
|
19119
|
+
import { join as join34 } from "path";
|
|
19006
19120
|
import { rm as rm8 } from "fs/promises";
|
|
19007
19121
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
19008
19122
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -19016,13 +19130,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
19016
19130
|
const specifiers = resolveVendorSpecifiers2();
|
|
19017
19131
|
if (specifiers.length === 0)
|
|
19018
19132
|
return;
|
|
19019
|
-
const vendorDir =
|
|
19133
|
+
const vendorDir = join34(buildDir, "svelte", "vendor");
|
|
19020
19134
|
mkdirSync13(vendorDir, { recursive: true });
|
|
19021
|
-
const tmpDir =
|
|
19135
|
+
const tmpDir = join34(buildDir, "_svelte_vendor_tmp");
|
|
19022
19136
|
mkdirSync13(tmpDir, { recursive: true });
|
|
19023
19137
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19024
19138
|
const safeName = toSafeFileName4(specifier);
|
|
19025
|
-
const entryPath =
|
|
19139
|
+
const entryPath = join34(tmpDir, `${safeName}.ts`);
|
|
19026
19140
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
19027
19141
|
`);
|
|
19028
19142
|
return entryPath;
|
|
@@ -19072,7 +19186,7 @@ __export(exports_rewriteImportsPlugin, {
|
|
|
19072
19186
|
buildWithImportRewrite: () => buildWithImportRewrite
|
|
19073
19187
|
});
|
|
19074
19188
|
import { readdir as readdir3 } from "fs/promises";
|
|
19075
|
-
import { join as
|
|
19189
|
+
import { join as join35 } from "path";
|
|
19076
19190
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
19077
19191
|
let result = content;
|
|
19078
19192
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -19201,7 +19315,7 @@ ${content}`;
|
|
|
19201
19315
|
const entries = await readdir3(dir);
|
|
19202
19316
|
for (const entry of entries) {
|
|
19203
19317
|
if (entry.endsWith(".js"))
|
|
19204
|
-
allFiles.push(
|
|
19318
|
+
allFiles.push(join35(dir, entry));
|
|
19205
19319
|
}
|
|
19206
19320
|
} catch {}
|
|
19207
19321
|
}
|
|
@@ -19243,14 +19357,14 @@ var init_rewriteImportsPlugin = __esm(() => {
|
|
|
19243
19357
|
import {
|
|
19244
19358
|
copyFileSync as copyFileSync2,
|
|
19245
19359
|
cpSync,
|
|
19246
|
-
existsSync as
|
|
19360
|
+
existsSync as existsSync26,
|
|
19247
19361
|
mkdirSync as mkdirSync14,
|
|
19248
|
-
readFileSync as
|
|
19362
|
+
readFileSync as readFileSync18,
|
|
19249
19363
|
rmSync as rmSync2,
|
|
19250
19364
|
statSync as statSync3,
|
|
19251
19365
|
writeFileSync as writeFileSync10
|
|
19252
19366
|
} from "fs";
|
|
19253
|
-
import { basename as basename10, dirname as
|
|
19367
|
+
import { basename as basename10, dirname as dirname19, extname as extname8, join as join36, relative as relative15, resolve as resolve26 } from "path";
|
|
19254
19368
|
import { cwd, env as env2, exit } from "process";
|
|
19255
19369
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
19256
19370
|
var isDev, isBuildTraceEnabled = () => {
|
|
@@ -19328,8 +19442,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19328
19442
|
mkdirSync14(htmxDestDir, { recursive: true });
|
|
19329
19443
|
const glob = new Glob8("htmx*.min.js");
|
|
19330
19444
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
19331
|
-
const src =
|
|
19332
|
-
const dest =
|
|
19445
|
+
const src = join36(htmxDir, relPath);
|
|
19446
|
+
const dest = join36(htmxDestDir, "htmx.min.js");
|
|
19333
19447
|
copyFileSync2(src, dest);
|
|
19334
19448
|
return;
|
|
19335
19449
|
}
|
|
@@ -19373,7 +19487,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19373
19487
|
addWorkerPathIfExists(file4, relPath, workerPaths);
|
|
19374
19488
|
}
|
|
19375
19489
|
}, collectWorkerPathsFromFile = (file4, patterns, workerPaths) => {
|
|
19376
|
-
const content =
|
|
19490
|
+
const content = readFileSync18(file4, "utf-8");
|
|
19377
19491
|
for (const pattern of patterns) {
|
|
19378
19492
|
collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
|
|
19379
19493
|
}
|
|
@@ -19404,7 +19518,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19404
19518
|
vuePagesPath
|
|
19405
19519
|
}) => {
|
|
19406
19520
|
const { readdirSync: readDir } = await import("fs");
|
|
19407
|
-
const devIndexDir =
|
|
19521
|
+
const devIndexDir = join36(buildPath, "_src_indexes");
|
|
19408
19522
|
mkdirSync14(devIndexDir, { recursive: true });
|
|
19409
19523
|
if (reactIndexesPath && reactPagesPath) {
|
|
19410
19524
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -19416,41 +19530,41 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19416
19530
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
19417
19531
|
}
|
|
19418
19532
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
19419
|
-
if (!
|
|
19533
|
+
if (!existsSync26(reactIndexesPath)) {
|
|
19420
19534
|
return;
|
|
19421
19535
|
}
|
|
19422
19536
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
19423
19537
|
const pagesRel = relative15(process.cwd(), resolve26(reactPagesPath)).replace(/\\/g, "/");
|
|
19424
19538
|
for (const file4 of indexFiles) {
|
|
19425
|
-
let content =
|
|
19539
|
+
let content = readFileSync18(join36(reactIndexesPath, file4), "utf-8");
|
|
19426
19540
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
19427
|
-
writeFileSync10(
|
|
19541
|
+
writeFileSync10(join36(devIndexDir, file4), content);
|
|
19428
19542
|
}
|
|
19429
19543
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
19430
|
-
const svelteIndexDir =
|
|
19544
|
+
const svelteIndexDir = join36(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
19431
19545
|
const sveltePageEntries = svelteEntries.filter((file4) => resolve26(file4).startsWith(resolve26(sveltePagesPath)));
|
|
19432
19546
|
for (const entry of sveltePageEntries) {
|
|
19433
19547
|
const name = basename10(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
19434
|
-
const indexFile =
|
|
19435
|
-
if (!
|
|
19548
|
+
const indexFile = join36(svelteIndexDir, "pages", `${name}.js`);
|
|
19549
|
+
if (!existsSync26(indexFile))
|
|
19436
19550
|
continue;
|
|
19437
|
-
let content =
|
|
19551
|
+
let content = readFileSync18(indexFile, "utf-8");
|
|
19438
19552
|
const srcRel = relative15(process.cwd(), resolve26(entry)).replace(/\\/g, "/");
|
|
19439
19553
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
19440
|
-
writeFileSync10(
|
|
19554
|
+
writeFileSync10(join36(devIndexDir, `${name}.svelte.js`), content);
|
|
19441
19555
|
}
|
|
19442
19556
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
19443
|
-
const vueIndexDir =
|
|
19557
|
+
const vueIndexDir = join36(getFrameworkGeneratedDir("vue"), "indexes");
|
|
19444
19558
|
const vuePageEntries = vueEntries.filter((file4) => resolve26(file4).startsWith(resolve26(vuePagesPath)));
|
|
19445
19559
|
for (const entry of vuePageEntries) {
|
|
19446
19560
|
const name = basename10(entry, ".vue");
|
|
19447
|
-
const indexFile =
|
|
19448
|
-
if (!
|
|
19561
|
+
const indexFile = join36(vueIndexDir, `${name}.js`);
|
|
19562
|
+
if (!existsSync26(indexFile))
|
|
19449
19563
|
continue;
|
|
19450
|
-
let content =
|
|
19564
|
+
let content = readFileSync18(indexFile, "utf-8");
|
|
19451
19565
|
const srcRel = relative15(process.cwd(), resolve26(entry)).replace(/\\/g, "/");
|
|
19452
19566
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
19453
|
-
writeFileSync10(
|
|
19567
|
+
writeFileSync10(join36(devIndexDir, `${name}.vue.js`), content);
|
|
19454
19568
|
}
|
|
19455
19569
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
19456
19570
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -19498,7 +19612,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19498
19612
|
}
|
|
19499
19613
|
return result;
|
|
19500
19614
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
19501
|
-
let content =
|
|
19615
|
+
let content = readFileSync18(outputPath, "utf-8");
|
|
19502
19616
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
19503
19617
|
const useNames = [];
|
|
19504
19618
|
let match;
|
|
@@ -19548,7 +19662,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19548
19662
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
19549
19663
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
19550
19664
|
for (const outputPath of outputPaths) {
|
|
19551
|
-
let content =
|
|
19665
|
+
let content = readFileSync18(outputPath, "utf-8");
|
|
19552
19666
|
let changed = false;
|
|
19553
19667
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
19554
19668
|
const targetName = basename10(relPath);
|
|
@@ -19673,10 +19787,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19673
19787
|
restoreTracePhase();
|
|
19674
19788
|
return;
|
|
19675
19789
|
}
|
|
19676
|
-
const traceDir =
|
|
19790
|
+
const traceDir = join36(buildPath2, ".absolute-trace");
|
|
19677
19791
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
19678
19792
|
mkdirSync14(traceDir, { recursive: true });
|
|
19679
|
-
writeFileSync10(
|
|
19793
|
+
writeFileSync10(join36(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
19680
19794
|
events: traceEvents,
|
|
19681
19795
|
frameworks: traceFrameworkNames,
|
|
19682
19796
|
generatedAt: new Date().toISOString(),
|
|
@@ -19707,15 +19821,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19707
19821
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
19708
19822
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
19709
19823
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
19710
|
-
const reactIndexesPath = reactDir &&
|
|
19711
|
-
const reactPagesPath = reactDir &&
|
|
19712
|
-
const htmlPagesPath = htmlDir &&
|
|
19713
|
-
const htmlScriptsPath = htmlDir &&
|
|
19714
|
-
const sveltePagesPath = svelteDir &&
|
|
19715
|
-
const vuePagesPath = vueDir &&
|
|
19716
|
-
const htmxPagesPath = htmxDir &&
|
|
19717
|
-
const angularPagesPath = angularDir &&
|
|
19718
|
-
const emberPagesPath = emberDir &&
|
|
19824
|
+
const reactIndexesPath = reactDir && join36(getFrameworkGeneratedDir("react"), "indexes");
|
|
19825
|
+
const reactPagesPath = reactDir && join36(reactDir, "pages");
|
|
19826
|
+
const htmlPagesPath = htmlDir && join36(htmlDir, "pages");
|
|
19827
|
+
const htmlScriptsPath = htmlDir && join36(htmlDir, "scripts");
|
|
19828
|
+
const sveltePagesPath = svelteDir && join36(svelteDir, "pages");
|
|
19829
|
+
const vuePagesPath = vueDir && join36(vueDir, "pages");
|
|
19830
|
+
const htmxPagesPath = htmxDir && join36(htmxDir, "pages");
|
|
19831
|
+
const angularPagesPath = angularDir && join36(angularDir, "pages");
|
|
19832
|
+
const emberPagesPath = emberDir && join36(emberDir, "pages");
|
|
19719
19833
|
const frontends = [
|
|
19720
19834
|
reactDir,
|
|
19721
19835
|
htmlDir,
|
|
@@ -19746,7 +19860,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19746
19860
|
const sourceClientRoots = [
|
|
19747
19861
|
htmlDir,
|
|
19748
19862
|
htmxDir,
|
|
19749
|
-
islandBootstrapPath &&
|
|
19863
|
+
islandBootstrapPath && dirname19(islandBootstrapPath)
|
|
19750
19864
|
].filter((dir) => Boolean(dir));
|
|
19751
19865
|
const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
|
|
19752
19866
|
if (usesGenerated)
|
|
@@ -19774,8 +19888,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19774
19888
|
const [firstEntry] = serverDirMap;
|
|
19775
19889
|
if (!firstEntry)
|
|
19776
19890
|
throw new Error("Expected at least one server directory entry");
|
|
19777
|
-
serverRoot =
|
|
19778
|
-
serverOutDir =
|
|
19891
|
+
serverRoot = join36(firstEntry.dir, firstEntry.subdir);
|
|
19892
|
+
serverOutDir = join36(buildPath, basename10(firstEntry.dir));
|
|
19779
19893
|
} else if (serverDirMap.length > 1) {
|
|
19780
19894
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
19781
19895
|
serverOutDir = buildPath;
|
|
@@ -19803,7 +19917,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19803
19917
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
19804
19918
|
}
|
|
19805
19919
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
19806
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
19920
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join36(buildPath, "assets"), {
|
|
19807
19921
|
force: true,
|
|
19808
19922
|
recursive: true
|
|
19809
19923
|
}));
|
|
@@ -19913,11 +20027,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19913
20027
|
}
|
|
19914
20028
|
}
|
|
19915
20029
|
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
19916
|
-
const htmlConventionsOutDir =
|
|
20030
|
+
const htmlConventionsOutDir = join36(buildPath, "conventions", "html");
|
|
19917
20031
|
mkdirSync14(htmlConventionsOutDir, { recursive: true });
|
|
19918
20032
|
const htmlPathRemap = new Map;
|
|
19919
20033
|
for (const sourcePath of htmlConventionSources) {
|
|
19920
|
-
const dest =
|
|
20034
|
+
const dest = join36(htmlConventionsOutDir, basename10(sourcePath));
|
|
19921
20035
|
cpSync(sourcePath, dest, { force: true });
|
|
19922
20036
|
htmlPathRemap.set(sourcePath, dest);
|
|
19923
20037
|
}
|
|
@@ -19960,7 +20074,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19960
20074
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
19961
20075
|
if (entry.startsWith(resolve26(reactIndexesPath))) {
|
|
19962
20076
|
const pageName = basename10(entry, ".tsx");
|
|
19963
|
-
return
|
|
20077
|
+
return join36(reactPagesPath, `${pageName}.tsx`);
|
|
19964
20078
|
}
|
|
19965
20079
|
return null;
|
|
19966
20080
|
}) : allReactEntries;
|
|
@@ -20026,14 +20140,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20026
20140
|
try {
|
|
20027
20141
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20028
20142
|
const { readdir: readdir4 } = await import("fs/promises");
|
|
20029
|
-
const { join:
|
|
20143
|
+
const { join: join37 } = await import("path");
|
|
20030
20144
|
const walk = async (dir) => {
|
|
20031
20145
|
const entries = await readdir4(dir, {
|
|
20032
20146
|
withFileTypes: true
|
|
20033
20147
|
});
|
|
20034
20148
|
const out = [];
|
|
20035
20149
|
for (const entry of entries) {
|
|
20036
|
-
const full =
|
|
20150
|
+
const full = join37(dir, entry.name);
|
|
20037
20151
|
if (entry.isDirectory()) {
|
|
20038
20152
|
out.push(...await walk(full));
|
|
20039
20153
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -20098,7 +20212,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20098
20212
|
const compileReactConventions = async () => {
|
|
20099
20213
|
if (reactConventionSources.length === 0)
|
|
20100
20214
|
return emptyStringArray;
|
|
20101
|
-
const destDir =
|
|
20215
|
+
const destDir = join36(buildPath, "conventions", "react");
|
|
20102
20216
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20103
20217
|
mkdirSync14(destDir, { recursive: true });
|
|
20104
20218
|
const destPaths = [];
|
|
@@ -20114,7 +20228,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20114
20228
|
naming: `${idx}-[name].[ext]`,
|
|
20115
20229
|
outdir: destDir,
|
|
20116
20230
|
plugins: [stylePreprocessorPlugin2],
|
|
20117
|
-
root:
|
|
20231
|
+
root: dirname19(source),
|
|
20118
20232
|
target: "bun",
|
|
20119
20233
|
throw: false,
|
|
20120
20234
|
tsconfig: "./tsconfig.json"
|
|
@@ -20142,7 +20256,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20142
20256
|
angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
|
|
20143
20257
|
]);
|
|
20144
20258
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
20145
|
-
const destDir =
|
|
20259
|
+
const destDir = join36(buildPath, "conventions", framework);
|
|
20146
20260
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20147
20261
|
mkdirSync14(destDir, { recursive: true });
|
|
20148
20262
|
const destPaths = [];
|
|
@@ -20216,7 +20330,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20216
20330
|
}
|
|
20217
20331
|
})) : {
|
|
20218
20332
|
entries: [],
|
|
20219
|
-
generatedRoot:
|
|
20333
|
+
generatedRoot: join36(buildPath, "_island_entries")
|
|
20220
20334
|
};
|
|
20221
20335
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
20222
20336
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -20252,7 +20366,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20252
20366
|
return {};
|
|
20253
20367
|
}
|
|
20254
20368
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
20255
|
-
const refreshEntry =
|
|
20369
|
+
const refreshEntry = join36(reactIndexesPath, "_refresh.tsx");
|
|
20256
20370
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
20257
20371
|
reactClientEntryPoints.push(refreshEntry);
|
|
20258
20372
|
}
|
|
@@ -20354,19 +20468,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20354
20468
|
throw: false
|
|
20355
20469
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
20356
20470
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
20357
|
-
rmSync2(
|
|
20471
|
+
rmSync2(join36(buildPath, "react", "generated", "indexes"), {
|
|
20358
20472
|
force: true,
|
|
20359
20473
|
recursive: true
|
|
20360
20474
|
});
|
|
20361
20475
|
}
|
|
20362
20476
|
if (angularDir && angularClientPaths.length > 0) {
|
|
20363
|
-
rmSync2(
|
|
20477
|
+
rmSync2(join36(buildPath, "angular", "indexes"), {
|
|
20364
20478
|
force: true,
|
|
20365
20479
|
recursive: true
|
|
20366
20480
|
});
|
|
20367
20481
|
}
|
|
20368
20482
|
if (islandClientEntryPoints.length > 0) {
|
|
20369
|
-
rmSync2(
|
|
20483
|
+
rmSync2(join36(buildPath, "islands"), {
|
|
20370
20484
|
force: true,
|
|
20371
20485
|
recursive: true
|
|
20372
20486
|
});
|
|
@@ -20455,7 +20569,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20455
20569
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20456
20570
|
entrypoints: globalCssEntries,
|
|
20457
20571
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
20458
|
-
outdir: stylesDir ?
|
|
20572
|
+
outdir: stylesDir ? join36(buildPath, basename10(stylesDir)) : buildPath,
|
|
20459
20573
|
plugins: [stylePreprocessorPlugin2],
|
|
20460
20574
|
root: stylesDir || clientRoot,
|
|
20461
20575
|
target: "browser",
|
|
@@ -20464,7 +20578,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20464
20578
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20465
20579
|
entrypoints: vueCssPaths,
|
|
20466
20580
|
naming: `[name].[hash].[ext]`,
|
|
20467
|
-
outdir:
|
|
20581
|
+
outdir: join36(buildPath, assetsPath ? basename10(assetsPath) : "assets", "css"),
|
|
20468
20582
|
target: "browser",
|
|
20469
20583
|
throw: false
|
|
20470
20584
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -20538,7 +20652,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20538
20652
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
20539
20653
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
20540
20654
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
20541
|
-
const fileDir =
|
|
20655
|
+
const fileDir = dirname19(artifact.path);
|
|
20542
20656
|
const relativePaths = {};
|
|
20543
20657
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
20544
20658
|
const rel = relative15(fileDir, absolute);
|
|
@@ -20624,7 +20738,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20624
20738
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
20625
20739
|
if (!hmrClientBundle)
|
|
20626
20740
|
return;
|
|
20627
|
-
let html =
|
|
20741
|
+
let html = readFileSync18(filePath, "utf-8");
|
|
20628
20742
|
if (html.includes("data-hmr-client"))
|
|
20629
20743
|
return;
|
|
20630
20744
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -20635,7 +20749,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20635
20749
|
const processHtmlPages = async () => {
|
|
20636
20750
|
if (!(htmlDir && htmlPagesPath))
|
|
20637
20751
|
return;
|
|
20638
|
-
const outputHtmlPages = isSingle ?
|
|
20752
|
+
const outputHtmlPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename10(htmlDir), "pages");
|
|
20639
20753
|
mkdirSync14(outputHtmlPages, { recursive: true });
|
|
20640
20754
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
20641
20755
|
force: true,
|
|
@@ -20660,14 +20774,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20660
20774
|
const processHtmxPages = async () => {
|
|
20661
20775
|
if (!(htmxDir && htmxPagesPath))
|
|
20662
20776
|
return;
|
|
20663
|
-
const outputHtmxPages = isSingle ?
|
|
20777
|
+
const outputHtmxPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename10(htmxDir), "pages");
|
|
20664
20778
|
mkdirSync14(outputHtmxPages, { recursive: true });
|
|
20665
20779
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
20666
20780
|
force: true,
|
|
20667
20781
|
recursive: true
|
|
20668
20782
|
});
|
|
20669
20783
|
if (shouldCopyHtmx) {
|
|
20670
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
20784
|
+
const htmxDestDir = isSingle ? buildPath : join36(buildPath, basename10(htmxDir));
|
|
20671
20785
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
20672
20786
|
}
|
|
20673
20787
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -20732,9 +20846,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20732
20846
|
writeBuildTrace(buildPath);
|
|
20733
20847
|
return { conventions: conventionsMap, manifest };
|
|
20734
20848
|
}
|
|
20735
|
-
writeFileSync10(
|
|
20849
|
+
writeFileSync10(join36(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
20736
20850
|
if (Object.keys(conventionsMap).length > 0) {
|
|
20737
|
-
writeFileSync10(
|
|
20851
|
+
writeFileSync10(join36(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
20738
20852
|
}
|
|
20739
20853
|
writeBuildTrace(buildPath);
|
|
20740
20854
|
if (mode === "production") {
|
|
@@ -20855,8 +20969,8 @@ var init_build = __esm(() => {
|
|
|
20855
20969
|
});
|
|
20856
20970
|
|
|
20857
20971
|
// src/build/buildEmberVendor.ts
|
|
20858
|
-
import { mkdirSync as mkdirSync15, existsSync as
|
|
20859
|
-
import { join as
|
|
20972
|
+
import { mkdirSync as mkdirSync15, existsSync as existsSync27 } from "fs";
|
|
20973
|
+
import { join as join37 } from "path";
|
|
20860
20974
|
import { rm as rm9 } from "fs/promises";
|
|
20861
20975
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
20862
20976
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -20908,8 +21022,8 @@ export const importSync = (specifier) => {
|
|
|
20908
21022
|
if (standaloneSpecifiers.has(specifier)) {
|
|
20909
21023
|
return { resolveTo: specifier, specifier };
|
|
20910
21024
|
}
|
|
20911
|
-
const emberInternalPath =
|
|
20912
|
-
if (!
|
|
21025
|
+
const emberInternalPath = join37(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
21026
|
+
if (!existsSync27(emberInternalPath)) {
|
|
20913
21027
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
20914
21028
|
}
|
|
20915
21029
|
return { resolveTo: emberInternalPath, specifier };
|
|
@@ -20940,24 +21054,24 @@ export const importSync = (specifier) => {
|
|
|
20940
21054
|
if (standalonePackages.has(args.path)) {
|
|
20941
21055
|
return;
|
|
20942
21056
|
}
|
|
20943
|
-
const internal =
|
|
20944
|
-
if (
|
|
21057
|
+
const internal = join37(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
21058
|
+
if (existsSync27(internal)) {
|
|
20945
21059
|
return { path: internal };
|
|
20946
21060
|
}
|
|
20947
21061
|
return;
|
|
20948
21062
|
});
|
|
20949
21063
|
}
|
|
20950
21064
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
20951
|
-
const vendorDir =
|
|
21065
|
+
const vendorDir = join37(buildDir, "ember", "vendor");
|
|
20952
21066
|
mkdirSync15(vendorDir, { recursive: true });
|
|
20953
|
-
const tmpDir =
|
|
21067
|
+
const tmpDir = join37(buildDir, "_ember_vendor_tmp");
|
|
20954
21068
|
mkdirSync15(tmpDir, { recursive: true });
|
|
20955
|
-
const macrosShimPath =
|
|
21069
|
+
const macrosShimPath = join37(tmpDir, "embroider_macros_shim.js");
|
|
20956
21070
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
20957
21071
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
20958
21072
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
20959
21073
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
20960
|
-
const entryPath =
|
|
21074
|
+
const entryPath = join37(tmpDir, `${safeName}.js`);
|
|
20961
21075
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
20962
21076
|
` : generateVendorEntrySource2(resolution);
|
|
20963
21077
|
await Bun.write(entryPath, source);
|
|
@@ -21010,7 +21124,7 @@ __export(exports_dependencyGraph, {
|
|
|
21010
21124
|
buildInitialDependencyGraph: () => buildInitialDependencyGraph,
|
|
21011
21125
|
addFileToGraph: () => addFileToGraph
|
|
21012
21126
|
});
|
|
21013
|
-
import { existsSync as
|
|
21127
|
+
import { existsSync as existsSync28, readFileSync as readFileSync19 } from "fs";
|
|
21014
21128
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
21015
21129
|
import { resolve as resolve27 } from "path";
|
|
21016
21130
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -21040,10 +21154,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21040
21154
|
];
|
|
21041
21155
|
for (const ext of extensions) {
|
|
21042
21156
|
const withExt = normalized + ext;
|
|
21043
|
-
if (
|
|
21157
|
+
if (existsSync28(withExt))
|
|
21044
21158
|
return withExt;
|
|
21045
21159
|
}
|
|
21046
|
-
if (
|
|
21160
|
+
if (existsSync28(normalized))
|
|
21047
21161
|
return normalized;
|
|
21048
21162
|
return null;
|
|
21049
21163
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -21058,7 +21172,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21058
21172
|
}
|
|
21059
21173
|
}, addFileToGraph = (graph, filePath) => {
|
|
21060
21174
|
const normalizedPath = resolve27(filePath);
|
|
21061
|
-
if (!
|
|
21175
|
+
if (!existsSync28(normalizedPath))
|
|
21062
21176
|
return;
|
|
21063
21177
|
const dependencies = extractDependencies(normalizedPath);
|
|
21064
21178
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -21084,7 +21198,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21084
21198
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
21085
21199
|
const processedFiles = new Set;
|
|
21086
21200
|
const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
21087
|
-
const resolvedDirs = directories.map((dir) => resolve27(dir)).filter((dir) =>
|
|
21201
|
+
const resolvedDirs = directories.map((dir) => resolve27(dir)).filter((dir) => existsSync28(dir));
|
|
21088
21202
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
21089
21203
|
for (const file4 of allFiles) {
|
|
21090
21204
|
const fullPath = resolve27(file4);
|
|
@@ -21181,15 +21295,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21181
21295
|
const lowerPath = filePath.toLowerCase();
|
|
21182
21296
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
21183
21297
|
if (loader === "html") {
|
|
21184
|
-
const content =
|
|
21298
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
21185
21299
|
return extractHtmlDependencies(filePath, content);
|
|
21186
21300
|
}
|
|
21187
21301
|
if (loader === "tsx" || loader === "js") {
|
|
21188
|
-
const content =
|
|
21302
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
21189
21303
|
return extractJsDependencies(filePath, content, loader);
|
|
21190
21304
|
}
|
|
21191
21305
|
if (isSvelteOrVue) {
|
|
21192
|
-
const content =
|
|
21306
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
21193
21307
|
return extractSvelteVueDependencies(filePath, content);
|
|
21194
21308
|
}
|
|
21195
21309
|
return [];
|
|
@@ -21332,8 +21446,8 @@ var init_clientManager = __esm(() => {
|
|
|
21332
21446
|
});
|
|
21333
21447
|
|
|
21334
21448
|
// src/dev/pathUtils.ts
|
|
21335
|
-
import { existsSync as
|
|
21336
|
-
import { dirname as
|
|
21449
|
+
import { existsSync as existsSync29, readdirSync as readdirSync4, readFileSync as readFileSync20 } from "fs";
|
|
21450
|
+
import { dirname as dirname20, resolve as resolve29 } from "path";
|
|
21337
21451
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
21338
21452
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
21339
21453
|
return "ignored";
|
|
@@ -21432,7 +21546,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21432
21546
|
}
|
|
21433
21547
|
let source;
|
|
21434
21548
|
try {
|
|
21435
|
-
source =
|
|
21549
|
+
source = readFileSync20(full, "utf8");
|
|
21436
21550
|
} catch {
|
|
21437
21551
|
continue;
|
|
21438
21552
|
}
|
|
@@ -21461,10 +21575,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21461
21575
|
refs.push(strMatch[1]);
|
|
21462
21576
|
}
|
|
21463
21577
|
}
|
|
21464
|
-
const componentDir =
|
|
21578
|
+
const componentDir = dirname20(full);
|
|
21465
21579
|
for (const ref of refs) {
|
|
21466
21580
|
const refAbs = normalizePath(resolve29(componentDir, ref));
|
|
21467
|
-
const refDir = normalizePath(
|
|
21581
|
+
const refDir = normalizePath(dirname20(refAbs));
|
|
21468
21582
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
21469
21583
|
continue;
|
|
21470
21584
|
}
|
|
@@ -21506,7 +21620,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21506
21620
|
push(cfg.stylesDir);
|
|
21507
21621
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
21508
21622
|
const abs = normalizePath(resolve29(cwd2, candidate));
|
|
21509
|
-
if (
|
|
21623
|
+
if (existsSync29(abs) && !roots.includes(abs))
|
|
21510
21624
|
roots.push(abs);
|
|
21511
21625
|
}
|
|
21512
21626
|
try {
|
|
@@ -21591,8 +21705,8 @@ var init_pathUtils = __esm(() => {
|
|
|
21591
21705
|
|
|
21592
21706
|
// src/dev/fileWatcher.ts
|
|
21593
21707
|
import { watch } from "fs";
|
|
21594
|
-
import { existsSync as
|
|
21595
|
-
import { dirname as
|
|
21708
|
+
import { existsSync as existsSync30, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
|
|
21709
|
+
import { dirname as dirname21, join as join38, resolve as resolve30 } from "path";
|
|
21596
21710
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
21597
21711
|
try {
|
|
21598
21712
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -21625,7 +21739,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21625
21739
|
for (const name of entries) {
|
|
21626
21740
|
if (shouldSkipFilename(name, isStylesDir))
|
|
21627
21741
|
continue;
|
|
21628
|
-
const child =
|
|
21742
|
+
const child = join38(eventDir, name).replace(/\\/g, "/");
|
|
21629
21743
|
let st2;
|
|
21630
21744
|
try {
|
|
21631
21745
|
st2 = statSync4(child);
|
|
@@ -21650,21 +21764,21 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21650
21764
|
return;
|
|
21651
21765
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
21652
21766
|
if (event === "rename") {
|
|
21653
|
-
const eventDir =
|
|
21767
|
+
const eventDir = dirname21(join38(absolutePath, filename)).replace(/\\/g, "/");
|
|
21654
21768
|
atomicRecoveryScan(eventDir);
|
|
21655
21769
|
}
|
|
21656
21770
|
return;
|
|
21657
21771
|
}
|
|
21658
|
-
const fullPath =
|
|
21772
|
+
const fullPath = join38(absolutePath, filename).replace(/\\/g, "/");
|
|
21659
21773
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
21660
21774
|
return;
|
|
21661
21775
|
}
|
|
21662
|
-
if (event === "rename" && !
|
|
21776
|
+
if (event === "rename" && !existsSync30(fullPath)) {
|
|
21663
21777
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
21664
21778
|
onFileChange(fullPath);
|
|
21665
21779
|
return;
|
|
21666
21780
|
}
|
|
21667
|
-
if (
|
|
21781
|
+
if (existsSync30(fullPath)) {
|
|
21668
21782
|
onFileChange(fullPath);
|
|
21669
21783
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
21670
21784
|
}
|
|
@@ -21674,7 +21788,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21674
21788
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
21675
21789
|
paths.forEach((path) => {
|
|
21676
21790
|
const absolutePath = resolve30(path).replace(/\\/g, "/");
|
|
21677
|
-
if (!
|
|
21791
|
+
if (!existsSync30(absolutePath)) {
|
|
21678
21792
|
return;
|
|
21679
21793
|
}
|
|
21680
21794
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -21685,7 +21799,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21685
21799
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
21686
21800
|
watchPaths.forEach((path) => {
|
|
21687
21801
|
const absolutePath = resolve30(path).replace(/\\/g, "/");
|
|
21688
|
-
if (!
|
|
21802
|
+
if (!existsSync30(absolutePath)) {
|
|
21689
21803
|
return;
|
|
21690
21804
|
}
|
|
21691
21805
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -21807,8 +21921,8 @@ var init_assetStore = __esm(() => {
|
|
|
21807
21921
|
});
|
|
21808
21922
|
|
|
21809
21923
|
// src/islands/pageMetadata.ts
|
|
21810
|
-
import { readFileSync as
|
|
21811
|
-
import { dirname as
|
|
21924
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
21925
|
+
import { dirname as dirname22, resolve as resolve32 } from "path";
|
|
21812
21926
|
var pagePatterns, getPageDirs = (config) => [
|
|
21813
21927
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
21814
21928
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -21828,7 +21942,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
21828
21942
|
const source = definition.buildReference?.source;
|
|
21829
21943
|
if (!source)
|
|
21830
21944
|
continue;
|
|
21831
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve32(
|
|
21945
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve32(dirname22(buildInfo.resolvedRegistryPath), source);
|
|
21832
21946
|
lookup.set(`${definition.framework}:${definition.component}`, resolve32(resolvedSource));
|
|
21833
21947
|
}
|
|
21834
21948
|
return lookup;
|
|
@@ -21850,7 +21964,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
21850
21964
|
return;
|
|
21851
21965
|
const files = await scanEntryPoints(resolve32(entry.dir), pattern);
|
|
21852
21966
|
for (const filePath of files) {
|
|
21853
|
-
const source =
|
|
21967
|
+
const source = readFileSync21(filePath, "utf-8");
|
|
21854
21968
|
const islands = extractIslandUsagesFromSource(source);
|
|
21855
21969
|
pageMetadata.set(resolve32(filePath), {
|
|
21856
21970
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
@@ -21881,10 +21995,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
21881
21995
|
});
|
|
21882
21996
|
|
|
21883
21997
|
// src/dev/fileHashTracker.ts
|
|
21884
|
-
import { readFileSync as
|
|
21998
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
21885
21999
|
var computeFileHash = (filePath) => {
|
|
21886
22000
|
try {
|
|
21887
|
-
const fileContent =
|
|
22001
|
+
const fileContent = readFileSync22(filePath);
|
|
21888
22002
|
return Number(Bun.hash(fileContent));
|
|
21889
22003
|
} catch {
|
|
21890
22004
|
return UNFOUND_INDEX;
|
|
@@ -22098,9 +22212,9 @@ __export(exports_resolveOwningComponents, {
|
|
|
22098
22212
|
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
22099
22213
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
22100
22214
|
});
|
|
22101
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
22102
|
-
import { dirname as
|
|
22103
|
-
import
|
|
22215
|
+
import { readdirSync as readdirSync6, readFileSync as readFileSync23, statSync as statSync5 } from "fs";
|
|
22216
|
+
import { dirname as dirname23, extname as extname9, join as join39, resolve as resolve35 } from "path";
|
|
22217
|
+
import ts14 from "typescript";
|
|
22104
22218
|
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
22105
22219
|
const out = [];
|
|
22106
22220
|
const visit = (dir) => {
|
|
@@ -22114,7 +22228,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22114
22228
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
22115
22229
|
continue;
|
|
22116
22230
|
}
|
|
22117
|
-
const full =
|
|
22231
|
+
const full = join39(dir, entry.name);
|
|
22118
22232
|
if (entry.isDirectory()) {
|
|
22119
22233
|
visit(full);
|
|
22120
22234
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -22126,13 +22240,13 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22126
22240
|
return out;
|
|
22127
22241
|
}, getStringPropertyValue = (obj, name) => {
|
|
22128
22242
|
for (const prop of obj.properties) {
|
|
22129
|
-
if (!
|
|
22243
|
+
if (!ts14.isPropertyAssignment(prop))
|
|
22130
22244
|
continue;
|
|
22131
|
-
const propName =
|
|
22245
|
+
const propName = ts14.isIdentifier(prop.name) ? prop.name.text : ts14.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
22132
22246
|
if (propName !== name)
|
|
22133
22247
|
continue;
|
|
22134
22248
|
const init = prop.initializer;
|
|
22135
|
-
if (
|
|
22249
|
+
if (ts14.isStringLiteral(init) || ts14.isNoSubstitutionTemplateLiteral(init)) {
|
|
22136
22250
|
return init.text;
|
|
22137
22251
|
}
|
|
22138
22252
|
}
|
|
@@ -22140,16 +22254,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22140
22254
|
}, getStringArrayProperty = (obj, name) => {
|
|
22141
22255
|
const out = [];
|
|
22142
22256
|
for (const prop of obj.properties) {
|
|
22143
|
-
if (!
|
|
22257
|
+
if (!ts14.isPropertyAssignment(prop))
|
|
22144
22258
|
continue;
|
|
22145
|
-
const propName =
|
|
22259
|
+
const propName = ts14.isIdentifier(prop.name) ? prop.name.text : ts14.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
22146
22260
|
if (propName !== name)
|
|
22147
22261
|
continue;
|
|
22148
22262
|
const init = prop.initializer;
|
|
22149
|
-
if (!
|
|
22263
|
+
if (!ts14.isArrayLiteralExpression(init))
|
|
22150
22264
|
continue;
|
|
22151
22265
|
for (const element of init.elements) {
|
|
22152
|
-
if (
|
|
22266
|
+
if (ts14.isStringLiteral(element) || ts14.isNoSubstitutionTemplateLiteral(element)) {
|
|
22153
22267
|
out.push(element.text);
|
|
22154
22268
|
}
|
|
22155
22269
|
}
|
|
@@ -22158,31 +22272,31 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22158
22272
|
}, parseDecoratedClasses = (filePath) => {
|
|
22159
22273
|
let source;
|
|
22160
22274
|
try {
|
|
22161
|
-
source =
|
|
22275
|
+
source = readFileSync23(filePath, "utf8");
|
|
22162
22276
|
} catch {
|
|
22163
22277
|
return [];
|
|
22164
22278
|
}
|
|
22165
|
-
const sourceFile =
|
|
22279
|
+
const sourceFile = ts14.createSourceFile(filePath, source, ts14.ScriptTarget.ES2022, true, ts14.ScriptKind.TS);
|
|
22166
22280
|
const out = [];
|
|
22167
22281
|
const visit = (node) => {
|
|
22168
|
-
if (
|
|
22169
|
-
for (const decorator of
|
|
22282
|
+
if (ts14.isClassDeclaration(node) && node.name) {
|
|
22283
|
+
for (const decorator of ts14.getDecorators(node) ?? []) {
|
|
22170
22284
|
const expr = decorator.expression;
|
|
22171
|
-
if (!
|
|
22285
|
+
if (!ts14.isCallExpression(expr))
|
|
22172
22286
|
continue;
|
|
22173
22287
|
const fn2 = expr.expression;
|
|
22174
|
-
if (!
|
|
22288
|
+
if (!ts14.isIdentifier(fn2))
|
|
22175
22289
|
continue;
|
|
22176
22290
|
const kind = ENTITY_DECORATORS[fn2.text];
|
|
22177
22291
|
if (!kind)
|
|
22178
22292
|
continue;
|
|
22179
22293
|
let extendsName = null;
|
|
22180
22294
|
for (const heritage of node.heritageClauses ?? []) {
|
|
22181
|
-
if (heritage.token !==
|
|
22295
|
+
if (heritage.token !== ts14.SyntaxKind.ExtendsKeyword) {
|
|
22182
22296
|
continue;
|
|
22183
22297
|
}
|
|
22184
22298
|
const first = heritage.types[0];
|
|
22185
|
-
if (first &&
|
|
22299
|
+
if (first && ts14.isIdentifier(first.expression)) {
|
|
22186
22300
|
extendsName = first.expression.text;
|
|
22187
22301
|
}
|
|
22188
22302
|
break;
|
|
@@ -22195,7 +22309,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22195
22309
|
extendsName
|
|
22196
22310
|
};
|
|
22197
22311
|
const arg = expr.arguments[0];
|
|
22198
|
-
if (arg &&
|
|
22312
|
+
if (arg && ts14.isObjectLiteralExpression(arg) && kind === "component") {
|
|
22199
22313
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
22200
22314
|
if (tplUrl)
|
|
22201
22315
|
entry.templateUrls.push(tplUrl);
|
|
@@ -22208,7 +22322,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22208
22322
|
break;
|
|
22209
22323
|
}
|
|
22210
22324
|
}
|
|
22211
|
-
|
|
22325
|
+
ts14.forEachChild(node, visit);
|
|
22212
22326
|
};
|
|
22213
22327
|
visit(sourceFile);
|
|
22214
22328
|
return out;
|
|
@@ -22248,16 +22362,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22248
22362
|
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
22249
22363
|
let source;
|
|
22250
22364
|
try {
|
|
22251
|
-
source =
|
|
22365
|
+
source = readFileSync23(childFilePath, "utf8");
|
|
22252
22366
|
} catch {
|
|
22253
22367
|
return null;
|
|
22254
22368
|
}
|
|
22255
|
-
const sf =
|
|
22256
|
-
const childDir =
|
|
22369
|
+
const sf = ts14.createSourceFile(childFilePath, source, ts14.ScriptTarget.ES2022, true, ts14.ScriptKind.TS);
|
|
22370
|
+
const childDir = dirname23(childFilePath);
|
|
22257
22371
|
for (const stmt of sf.statements) {
|
|
22258
|
-
if (!
|
|
22372
|
+
if (!ts14.isImportDeclaration(stmt))
|
|
22259
22373
|
continue;
|
|
22260
|
-
if (!
|
|
22374
|
+
if (!ts14.isStringLiteral(stmt.moduleSpecifier))
|
|
22261
22375
|
continue;
|
|
22262
22376
|
const clause = stmt.importClause;
|
|
22263
22377
|
if (!clause || clause.isTypeOnly)
|
|
@@ -22265,7 +22379,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22265
22379
|
let matchesName = false;
|
|
22266
22380
|
if (clause.name && clause.name.text === parentName)
|
|
22267
22381
|
matchesName = true;
|
|
22268
|
-
if (!matchesName && clause.namedBindings &&
|
|
22382
|
+
if (!matchesName && clause.namedBindings && ts14.isNamedImports(clause.namedBindings)) {
|
|
22269
22383
|
for (const el of clause.namedBindings.elements) {
|
|
22270
22384
|
if (el.isTypeOnly)
|
|
22271
22385
|
continue;
|
|
@@ -22310,7 +22424,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22310
22424
|
const parentFile = new Map;
|
|
22311
22425
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
22312
22426
|
const classes = parseDecoratedClasses(tsPath);
|
|
22313
|
-
const componentDir =
|
|
22427
|
+
const componentDir = dirname23(tsPath);
|
|
22314
22428
|
for (const cls of classes) {
|
|
22315
22429
|
const entity = {
|
|
22316
22430
|
className: cls.className,
|
|
@@ -22615,8 +22729,8 @@ __export(exports_moduleServer, {
|
|
|
22615
22729
|
createModuleServer: () => createModuleServer,
|
|
22616
22730
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
22617
22731
|
});
|
|
22618
|
-
import { existsSync as
|
|
22619
|
-
import { basename as basename12, dirname as
|
|
22732
|
+
import { existsSync as existsSync31, readFileSync as readFileSync24, statSync as statSync6 } from "fs";
|
|
22733
|
+
import { basename as basename12, dirname as dirname24, extname as extname10, join as join40, resolve as resolve37, relative as relative16 } from "path";
|
|
22620
22734
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
22621
22735
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
22622
22736
|
const allExports = [];
|
|
@@ -22636,7 +22750,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
22636
22750
|
${stubs}
|
|
22637
22751
|
`;
|
|
22638
22752
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
22639
|
-
const found = extensions.find((ext) =>
|
|
22753
|
+
const found = extensions.find((ext) => existsSync31(resolve37(projectRoot, srcPath + ext)));
|
|
22640
22754
|
return found ? srcPath + found : srcPath;
|
|
22641
22755
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
22642
22756
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -22688,13 +22802,13 @@ ${stubs}
|
|
|
22688
22802
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
22689
22803
|
if (!subpath) {
|
|
22690
22804
|
const pkgDir = resolve37(projectRoot, "node_modules", packageName ?? "");
|
|
22691
|
-
const pkgJsonPath =
|
|
22692
|
-
if (
|
|
22693
|
-
const pkg = JSON.parse(
|
|
22805
|
+
const pkgJsonPath = join40(pkgDir, "package.json");
|
|
22806
|
+
if (existsSync31(pkgJsonPath)) {
|
|
22807
|
+
const pkg = JSON.parse(readFileSync24(pkgJsonPath, "utf-8"));
|
|
22694
22808
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
22695
22809
|
if (esmEntry) {
|
|
22696
22810
|
const resolved = resolve37(pkgDir, esmEntry);
|
|
22697
|
-
if (
|
|
22811
|
+
if (existsSync31(resolved))
|
|
22698
22812
|
return relative16(projectRoot, resolved);
|
|
22699
22813
|
}
|
|
22700
22814
|
}
|
|
@@ -22725,7 +22839,7 @@ ${stubs}
|
|
|
22725
22839
|
};
|
|
22726
22840
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
22727
22841
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
22728
|
-
const fileDir =
|
|
22842
|
+
const fileDir = dirname24(filePath);
|
|
22729
22843
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
22730
22844
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
22731
22845
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
@@ -22791,7 +22905,7 @@ ${code}`;
|
|
|
22791
22905
|
reactFastRefreshWarningEmitted = true;
|
|
22792
22906
|
logWarn("React HMR is blocked: this Bun build ignores " + "`reactFastRefresh` on Bun.Transpiler, so component state " + "cannot be preserved across edits. Tracking " + "https://github.com/oven-sh/bun/pull/28312 \u2014 if it still has " + "not merged, leave a \uD83D\uDC4D on the PR so the Bun team knows it " + "is blocking you. Until then, React edits trigger a full " + "reload instead of a fast refresh.");
|
|
22793
22907
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
22794
|
-
const raw =
|
|
22908
|
+
const raw = readFileSync24(filePath, "utf-8");
|
|
22795
22909
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
22796
22910
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
22797
22911
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -22807,7 +22921,7 @@ ${transpiled}`;
|
|
|
22807
22921
|
transpiled += buildIslandMetadataExports(raw);
|
|
22808
22922
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
22809
22923
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
22810
|
-
const raw =
|
|
22924
|
+
const raw = readFileSync24(filePath, "utf-8");
|
|
22811
22925
|
const ext = extname10(filePath);
|
|
22812
22926
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
22813
22927
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -22973,7 +23087,7 @@ ${code}`;
|
|
|
22973
23087
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
22974
23088
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
22975
23089
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
22976
|
-
const raw =
|
|
23090
|
+
const raw = readFileSync24(filePath, "utf-8");
|
|
22977
23091
|
if (!svelteCompiler) {
|
|
22978
23092
|
svelteCompiler = await import("svelte/compiler");
|
|
22979
23093
|
}
|
|
@@ -23035,7 +23149,7 @@ export default __script__;`;
|
|
|
23035
23149
|
return `${cssInjection}
|
|
23036
23150
|
${code}`;
|
|
23037
23151
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
23038
|
-
const rawSource =
|
|
23152
|
+
const rawSource = readFileSync24(filePath, "utf-8");
|
|
23039
23153
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
23040
23154
|
if (!vueCompiler) {
|
|
23041
23155
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
@@ -23073,11 +23187,11 @@ ${code}`;
|
|
|
23073
23187
|
`);
|
|
23074
23188
|
return result;
|
|
23075
23189
|
}, resolveSvelteModulePath = (path) => {
|
|
23076
|
-
if (
|
|
23190
|
+
if (existsSync31(path))
|
|
23077
23191
|
return path;
|
|
23078
|
-
if (
|
|
23192
|
+
if (existsSync31(`${path}.ts`))
|
|
23079
23193
|
return `${path}.ts`;
|
|
23080
|
-
if (
|
|
23194
|
+
if (existsSync31(`${path}.js`))
|
|
23081
23195
|
return `${path}.js`;
|
|
23082
23196
|
return path;
|
|
23083
23197
|
}, jsResponse = (body) => {
|
|
@@ -23090,7 +23204,7 @@ ${code}`;
|
|
|
23090
23204
|
}
|
|
23091
23205
|
});
|
|
23092
23206
|
}, handleCssRequest = (filePath) => {
|
|
23093
|
-
const raw =
|
|
23207
|
+
const raw = readFileSync24(filePath, "utf-8");
|
|
23094
23208
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
23095
23209
|
return [
|
|
23096
23210
|
`const style = document.createElement('style');`,
|
|
@@ -23228,7 +23342,7 @@ export default {};
|
|
|
23228
23342
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
23229
23343
|
if (ext)
|
|
23230
23344
|
return { ext, filePath };
|
|
23231
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
23345
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync31(filePath + candidate));
|
|
23232
23346
|
if (!found)
|
|
23233
23347
|
return { ext, filePath };
|
|
23234
23348
|
const resolved = filePath + found;
|
|
@@ -23521,7 +23635,7 @@ __export(exports_hmrCompiler, {
|
|
|
23521
23635
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
23522
23636
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
23523
23637
|
});
|
|
23524
|
-
import { dirname as
|
|
23638
|
+
import { dirname as dirname25, relative as relative17, resolve as resolve38 } from "path";
|
|
23525
23639
|
import { performance as performance2 } from "perf_hooks";
|
|
23526
23640
|
var getApplyMetadataModule = async (encodedId) => {
|
|
23527
23641
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -23541,7 +23655,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
23541
23655
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
23542
23656
|
const owners = resolveOwningComponents2({
|
|
23543
23657
|
changedFilePath: componentFilePath,
|
|
23544
|
-
userAngularRoot:
|
|
23658
|
+
userAngularRoot: dirname25(componentFilePath)
|
|
23545
23659
|
});
|
|
23546
23660
|
const owner = owners.find((o3) => o3.className === className);
|
|
23547
23661
|
const kind = owner?.kind ?? "component";
|
|
@@ -23748,8 +23862,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
23748
23862
|
var init_simpleHTMXHMR = () => {};
|
|
23749
23863
|
|
|
23750
23864
|
// src/dev/rebuildTrigger.ts
|
|
23751
|
-
import { existsSync as
|
|
23752
|
-
import { basename as basename13, dirname as
|
|
23865
|
+
import { existsSync as existsSync32, rmSync as rmSync3 } from "fs";
|
|
23866
|
+
import { basename as basename13, dirname as dirname26, join as join41, relative as relative18, resolve as resolve41, sep as sep4 } from "path";
|
|
23753
23867
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
|
|
23754
23868
|
if (!config.tailwind)
|
|
23755
23869
|
return;
|
|
@@ -23848,7 +23962,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23848
23962
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
23849
23963
|
}
|
|
23850
23964
|
return { ...parsed, framework: detectedFw };
|
|
23851
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
23965
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync32(affectedFile), FRAMEWORK_DIR_KEYS_FOR_CLEANUP, removeStaleGenerated = (state, deletedFile) => {
|
|
23852
23966
|
const config = state.config;
|
|
23853
23967
|
const cwd2 = process.cwd();
|
|
23854
23968
|
const absDeleted = resolve41(deletedFile).replace(/\\/g, "/");
|
|
@@ -23866,8 +23980,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23866
23980
|
const relJs = `${rel.slice(0, -ext[0].length)}.js`;
|
|
23867
23981
|
const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
|
|
23868
23982
|
for (const candidate of [
|
|
23869
|
-
|
|
23870
|
-
`${
|
|
23983
|
+
join41(generatedDir, relJs),
|
|
23984
|
+
`${join41(generatedDir, relJs)}.map`
|
|
23871
23985
|
]) {
|
|
23872
23986
|
try {
|
|
23873
23987
|
rmSync3(candidate, { force: true });
|
|
@@ -23894,7 +24008,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23894
24008
|
if (!dependents || dependents.size === 0) {
|
|
23895
24009
|
return;
|
|
23896
24010
|
}
|
|
23897
|
-
const dependentFiles = Array.from(dependents).filter((file4) =>
|
|
24011
|
+
const dependentFiles = Array.from(dependents).filter((file4) => existsSync32(file4));
|
|
23898
24012
|
if (dependentFiles.length === 0) {
|
|
23899
24013
|
return;
|
|
23900
24014
|
}
|
|
@@ -23910,7 +24024,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23910
24024
|
try {
|
|
23911
24025
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
23912
24026
|
affectedFiles.forEach((affectedFile) => {
|
|
23913
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
24027
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync32(affectedFile)) {
|
|
23914
24028
|
validFiles.push(affectedFile);
|
|
23915
24029
|
processedFiles.add(affectedFile);
|
|
23916
24030
|
}
|
|
@@ -23935,7 +24049,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23935
24049
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
23936
24050
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
23937
24051
|
filePathSet.forEach((filePathInSet) => {
|
|
23938
|
-
if (!
|
|
24052
|
+
if (!existsSync32(filePathInSet)) {
|
|
23939
24053
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
23940
24054
|
return;
|
|
23941
24055
|
}
|
|
@@ -24072,8 +24186,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24072
24186
|
const buildDir = state.resolvedPaths.buildDir;
|
|
24073
24187
|
const destPath = resolve41(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
|
|
24074
24188
|
const { mkdir: mkdir7, copyFile, readFile: readFile6 } = await import("fs/promises");
|
|
24075
|
-
const { dirname:
|
|
24076
|
-
await mkdir7(
|
|
24189
|
+
const { dirname: dirname27 } = await import("path");
|
|
24190
|
+
await mkdir7(dirname27(destPath), { recursive: true });
|
|
24077
24191
|
await copyFile(absSource, destPath);
|
|
24078
24192
|
const bytes = await readFile6(destPath);
|
|
24079
24193
|
const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
|
|
@@ -24189,7 +24303,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24189
24303
|
return componentFile;
|
|
24190
24304
|
}
|
|
24191
24305
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
24192
|
-
if (
|
|
24306
|
+
if (existsSync32(tsCounterpart)) {
|
|
24193
24307
|
return tsCounterpart;
|
|
24194
24308
|
}
|
|
24195
24309
|
if (!graph)
|
|
@@ -24275,7 +24389,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24275
24389
|
const keepByDir = new Map;
|
|
24276
24390
|
const prefixByDir = new Map;
|
|
24277
24391
|
for (const artifact of freshOutputs) {
|
|
24278
|
-
const dir =
|
|
24392
|
+
const dir = dirname26(artifact.path);
|
|
24279
24393
|
const name = basename13(artifact.path);
|
|
24280
24394
|
const [prefix] = name.split(".");
|
|
24281
24395
|
if (!prefix)
|
|
@@ -24705,12 +24819,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24705
24819
|
try {
|
|
24706
24820
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
24707
24821
|
const { readdir: readdir5 } = await import("fs/promises");
|
|
24708
|
-
const { join:
|
|
24822
|
+
const { join: join42 } = await import("path");
|
|
24709
24823
|
const walk = async (dir) => {
|
|
24710
24824
|
const entries = await readdir5(dir, { withFileTypes: true });
|
|
24711
24825
|
const files = [];
|
|
24712
24826
|
for (const entry of entries) {
|
|
24713
|
-
const full =
|
|
24827
|
+
const full = join42(dir, entry.name);
|
|
24714
24828
|
if (entry.isDirectory()) {
|
|
24715
24829
|
files.push(...await walk(full));
|
|
24716
24830
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -25153,7 +25267,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25153
25267
|
const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
|
|
25154
25268
|
const serverEntries = [...vueServerPaths];
|
|
25155
25269
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
25156
|
-
const cssOutDir =
|
|
25270
|
+
const cssOutDir = join41(buildDir, state.resolvedPaths.assetsDir ? basename13(state.resolvedPaths.assetsDir) : "assets", "css");
|
|
25157
25271
|
const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
|
|
25158
25272
|
const [serverResult, clientResult, cssResult] = await Promise.all([
|
|
25159
25273
|
serverEntries.length > 0 ? bunBuild9({
|
|
@@ -25394,7 +25508,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25394
25508
|
if (!buildReference?.source) {
|
|
25395
25509
|
return;
|
|
25396
25510
|
}
|
|
25397
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve41(
|
|
25511
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve41(dirname26(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
25398
25512
|
islandFiles.add(resolve41(sourcePath));
|
|
25399
25513
|
}, resolveIslandSourceFiles = async (config) => {
|
|
25400
25514
|
const registryPath = config.islands?.registry;
|
|
@@ -26168,7 +26282,7 @@ __export(exports_buildDepVendor, {
|
|
|
26168
26282
|
buildDepVendor: () => buildDepVendor
|
|
26169
26283
|
});
|
|
26170
26284
|
import { mkdirSync as mkdirSync16 } from "fs";
|
|
26171
|
-
import { join as
|
|
26285
|
+
import { join as join42 } from "path";
|
|
26172
26286
|
import { rm as rm10 } from "fs/promises";
|
|
26173
26287
|
var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
|
|
26174
26288
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -26222,7 +26336,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26222
26336
|
framework: Array.from(framework).filter(isResolvable4)
|
|
26223
26337
|
};
|
|
26224
26338
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
26225
|
-
const { readFileSync:
|
|
26339
|
+
const { readFileSync: readFileSync25 } = await import("fs");
|
|
26226
26340
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
26227
26341
|
const newSpecs = new Set;
|
|
26228
26342
|
for (const spec of specs) {
|
|
@@ -26237,7 +26351,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26237
26351
|
}
|
|
26238
26352
|
let content;
|
|
26239
26353
|
try {
|
|
26240
|
-
content =
|
|
26354
|
+
content = readFileSync25(resolved, "utf-8");
|
|
26241
26355
|
} catch {
|
|
26242
26356
|
continue;
|
|
26243
26357
|
}
|
|
@@ -26279,7 +26393,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26279
26393
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
26280
26394
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
26281
26395
|
const safeName = toSafeFileName6(specifier);
|
|
26282
|
-
const entryPath =
|
|
26396
|
+
const entryPath = join42(tmpDir, `${safeName}.ts`);
|
|
26283
26397
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
26284
26398
|
return { entryPath, specifier };
|
|
26285
26399
|
}));
|
|
@@ -26340,9 +26454,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26340
26454
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
26341
26455
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
26342
26456
|
return {};
|
|
26343
|
-
const vendorDir =
|
|
26457
|
+
const vendorDir = join42(buildDir, "vendor");
|
|
26344
26458
|
mkdirSync16(vendorDir, { recursive: true });
|
|
26345
|
-
const tmpDir =
|
|
26459
|
+
const tmpDir = join42(buildDir, "_dep_vendor_tmp");
|
|
26346
26460
|
mkdirSync16(tmpDir, { recursive: true });
|
|
26347
26461
|
const allSpecs = new Set(initialSpecs);
|
|
26348
26462
|
const alreadyScanned = new Set;
|
|
@@ -26854,5 +26968,5 @@ export {
|
|
|
26854
26968
|
build
|
|
26855
26969
|
};
|
|
26856
26970
|
|
|
26857
|
-
//# debugId=
|
|
26971
|
+
//# debugId=BF022E079C29BE4864756E2164756E21
|
|
26858
26972
|
//# sourceMappingURL=build.js.map
|