@absolutejs/absolute 0.19.0-beta.971 → 0.19.0-beta.973
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 +8 -2
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +8 -2
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +874 -779
- package/dist/build.js.map +7 -6
- package/dist/index.js +916 -821
- package/dist/index.js.map +7 -6
- package/dist/src/angular/loadGlobalProviders.d.ts +0 -4
- package/dist/src/build/emitAngularProvidersFiles.d.ts +8 -4
- package/dist/src/build/parseAngularConfigImports.d.ts +9 -0
- package/dist/src/build/runAngularHandlerScan.d.ts +1 -8
- package/dist/src/utils/loadConfig.d.ts +1 -1
- package/dist/types/build.d.ts +11 -9
- 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,12 +11722,12 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11722
11722
|
sections.push(renderImportGroup(group, outputPath));
|
|
11723
11723
|
}
|
|
11724
11724
|
}
|
|
11725
|
-
if (
|
|
11725
|
+
if (providersImport) {
|
|
11726
11726
|
const outputDir = dirname11(outputPath);
|
|
11727
|
-
const rel = relative10(outputDir,
|
|
11728
|
-
const
|
|
11729
|
-
const
|
|
11730
|
-
sections.push(`import {
|
|
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
11731
|
}
|
|
11732
11732
|
if (basePath !== null) {
|
|
11733
11733
|
sections.push(`import { APP_BASE_HREF } from "@angular/common";`, `const __basePathProvider = { provide: APP_BASE_HREF, useValue: ${JSON.stringify(basePath)} };`);
|
|
@@ -11738,7 +11738,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11738
11738
|
}
|
|
11739
11739
|
const userProvidersExpr = call.providersExpr ?? "[]";
|
|
11740
11740
|
const fragments = [];
|
|
11741
|
-
if (
|
|
11741
|
+
if (providersImport)
|
|
11742
11742
|
fragments.push("...__globalProviders");
|
|
11743
11743
|
if (call.providersExpr !== null)
|
|
11744
11744
|
fragments.push(`...(${userProvidersExpr})`);
|
|
@@ -11771,7 +11771,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11771
11771
|
const outputPath = join23(outputDir, `${call.manifestKey}.providers.ts`);
|
|
11772
11772
|
const basePath = deriveBasePath(call.mountPath);
|
|
11773
11773
|
const pageRoute = pageRoutesByKey.get(call.manifestKey);
|
|
11774
|
-
const content = renderFile(call, outputPath, basePath, pageRoute, options.providersImport
|
|
11774
|
+
const content = renderFile(call, outputPath, basePath, pageRoute, options.providersImport ?? null);
|
|
11775
11775
|
writeFileSync7(outputPath, content, "utf-8");
|
|
11776
11776
|
emitted.push({
|
|
11777
11777
|
basePath,
|
|
@@ -11781,11 +11781,6 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
11781
11781
|
});
|
|
11782
11782
|
}
|
|
11783
11783
|
return emitted;
|
|
11784
|
-
}, resolveProvidersImport = (projectRoot, providersImport) => {
|
|
11785
|
-
if (providersImport.startsWith(".")) {
|
|
11786
|
-
return join23(projectRoot, providersImport);
|
|
11787
|
-
}
|
|
11788
|
-
return providersImport;
|
|
11789
11784
|
}, getProvidersOutputDir = (projectRoot) => join23(getFrameworkGeneratedDir("angular", projectRoot), "providers");
|
|
11790
11785
|
var init_emitAngularProvidersFiles = __esm(() => {
|
|
11791
11786
|
init_generatedDir();
|
|
@@ -11844,14 +11839,115 @@ var init_emitAngularRouteMounts = __esm(() => {
|
|
|
11844
11839
|
init_generatedDir();
|
|
11845
11840
|
});
|
|
11846
11841
|
|
|
11847
|
-
// src/build/
|
|
11848
|
-
import {
|
|
11849
|
-
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";
|
|
11850
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";
|
|
11851
11947
|
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (filePath) => {
|
|
11852
11948
|
if (filePath.endsWith(".tsx"))
|
|
11853
|
-
return
|
|
11854
|
-
return
|
|
11949
|
+
return ts8.ScriptKind.TSX;
|
|
11950
|
+
return ts8.ScriptKind.TS;
|
|
11855
11951
|
}, hasSourceExtension3 = (filePath) => {
|
|
11856
11952
|
const idx = filePath.lastIndexOf(".");
|
|
11857
11953
|
if (idx === -1)
|
|
@@ -11879,16 +11975,16 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11879
11975
|
continue;
|
|
11880
11976
|
if (entry.name.startsWith("."))
|
|
11881
11977
|
continue;
|
|
11882
|
-
stack.push(
|
|
11978
|
+
stack.push(join26(dir, entry.name));
|
|
11883
11979
|
} else if (entry.isFile() && hasSourceExtension3(entry.name)) {
|
|
11884
|
-
out.push(
|
|
11980
|
+
out.push(join26(dir, entry.name));
|
|
11885
11981
|
}
|
|
11886
11982
|
}
|
|
11887
11983
|
}
|
|
11888
11984
|
return out;
|
|
11889
11985
|
}, fileMayContainAngularHandler = (source) => source.includes("handleAngularPageRequest"), collectFileImports = (sf, filePath) => {
|
|
11890
11986
|
const map = new Map;
|
|
11891
|
-
const fileDir =
|
|
11987
|
+
const fileDir = dirname13(filePath);
|
|
11892
11988
|
const recordSpec = (localName, spec) => {
|
|
11893
11989
|
map.set(localName, spec);
|
|
11894
11990
|
};
|
|
@@ -11896,15 +11992,15 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11896
11992
|
if (specifier.startsWith(".")) {
|
|
11897
11993
|
return resolve19(fileDir, specifier);
|
|
11898
11994
|
}
|
|
11899
|
-
if (
|
|
11995
|
+
if (isAbsolute4(specifier)) {
|
|
11900
11996
|
return specifier;
|
|
11901
11997
|
}
|
|
11902
11998
|
return null;
|
|
11903
11999
|
};
|
|
11904
12000
|
for (const statement of sf.statements) {
|
|
11905
|
-
if (!
|
|
12001
|
+
if (!ts8.isImportDeclaration(statement))
|
|
11906
12002
|
continue;
|
|
11907
|
-
if (!
|
|
12003
|
+
if (!ts8.isStringLiteral(statement.moduleSpecifier))
|
|
11908
12004
|
continue;
|
|
11909
12005
|
if (statement.importClause?.isTypeOnly)
|
|
11910
12006
|
continue;
|
|
@@ -11925,7 +12021,7 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11925
12021
|
const bindings = clause.namedBindings;
|
|
11926
12022
|
if (!bindings)
|
|
11927
12023
|
continue;
|
|
11928
|
-
if (
|
|
12024
|
+
if (ts8.isNamespaceImport(bindings)) {
|
|
11929
12025
|
recordSpec(bindings.name.text, {
|
|
11930
12026
|
importedName: "*",
|
|
11931
12027
|
isDefault: false,
|
|
@@ -11953,38 +12049,38 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11953
12049
|
}, collectExpressionIdentifiers = (expr) => {
|
|
11954
12050
|
const out = new Set;
|
|
11955
12051
|
const visit = (node) => {
|
|
11956
|
-
if (
|
|
12052
|
+
if (ts8.isIdentifier(node)) {
|
|
11957
12053
|
out.add(node.text);
|
|
11958
12054
|
return;
|
|
11959
12055
|
}
|
|
11960
|
-
if (
|
|
12056
|
+
if (ts8.isPropertyAccessExpression(node)) {
|
|
11961
12057
|
visit(node.expression);
|
|
11962
12058
|
return;
|
|
11963
12059
|
}
|
|
11964
|
-
|
|
12060
|
+
ts8.forEachChild(node, visit);
|
|
11965
12061
|
};
|
|
11966
12062
|
visit(expr);
|
|
11967
12063
|
return out;
|
|
11968
12064
|
}, extractManifestKey = (pagePathValue) => {
|
|
11969
|
-
if (!
|
|
12065
|
+
if (!ts8.isCallExpression(pagePathValue))
|
|
11970
12066
|
return null;
|
|
11971
12067
|
const callee = pagePathValue.expression;
|
|
11972
|
-
if (!
|
|
12068
|
+
if (!ts8.isIdentifier(callee) || callee.text !== "asset")
|
|
11973
12069
|
return null;
|
|
11974
12070
|
const [, second] = pagePathValue.arguments;
|
|
11975
12071
|
if (!second)
|
|
11976
12072
|
return null;
|
|
11977
|
-
if (!
|
|
12073
|
+
if (!ts8.isStringLiteral(second))
|
|
11978
12074
|
return null;
|
|
11979
12075
|
return second.text;
|
|
11980
12076
|
}, findEnclosingMountPath = (node) => {
|
|
11981
12077
|
let cursor = node.parent;
|
|
11982
12078
|
while (cursor) {
|
|
11983
|
-
if (
|
|
12079
|
+
if (ts8.isCallExpression(cursor)) {
|
|
11984
12080
|
const callee = cursor.expression;
|
|
11985
|
-
if (
|
|
12081
|
+
if (ts8.isPropertyAccessExpression(callee) && ts8.isIdentifier(callee.name) && ELYSIA_ROUTE_METHODS2.has(callee.name.text)) {
|
|
11986
12082
|
const firstArg = cursor.arguments[0];
|
|
11987
|
-
if (firstArg &&
|
|
12083
|
+
if (firstArg && ts8.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
11988
12084
|
return firstArg.text;
|
|
11989
12085
|
}
|
|
11990
12086
|
}
|
|
@@ -11995,37 +12091,37 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
11995
12091
|
}, extractCallsFromFile = (filePath, out) => {
|
|
11996
12092
|
let source;
|
|
11997
12093
|
try {
|
|
11998
|
-
source =
|
|
12094
|
+
source = readFileSync14(filePath, "utf-8");
|
|
11999
12095
|
} catch {
|
|
12000
12096
|
return;
|
|
12001
12097
|
}
|
|
12002
12098
|
if (!fileMayContainAngularHandler(source))
|
|
12003
12099
|
return;
|
|
12004
|
-
const sf =
|
|
12100
|
+
const sf = ts8.createSourceFile(filePath, source, ts8.ScriptTarget.Latest, true, getScriptKind2(filePath));
|
|
12005
12101
|
const imports = collectFileImports(sf, filePath);
|
|
12006
12102
|
const visit = (node) => {
|
|
12007
|
-
if (
|
|
12103
|
+
if (ts8.isCallExpression(node) && ts8.isIdentifier(node.expression) && node.expression.text === "handleAngularPageRequest") {
|
|
12008
12104
|
const [arg] = node.arguments;
|
|
12009
|
-
if (arg &&
|
|
12105
|
+
if (arg && ts8.isObjectLiteralExpression(arg)) {
|
|
12010
12106
|
let manifestKey = null;
|
|
12011
12107
|
let providersExpr = null;
|
|
12012
12108
|
for (const prop of arg.properties) {
|
|
12013
|
-
if (
|
|
12109
|
+
if (ts8.isPropertyAssignment(prop)) {
|
|
12014
12110
|
if (!prop.name)
|
|
12015
12111
|
continue;
|
|
12016
|
-
const name =
|
|
12112
|
+
const name = ts8.isIdentifier(prop.name) ? prop.name.text : ts8.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
12017
12113
|
if (name === "pagePath") {
|
|
12018
12114
|
manifestKey = extractManifestKey(prop.initializer);
|
|
12019
12115
|
} else if (name === "providers") {
|
|
12020
12116
|
providersExpr = prop.initializer;
|
|
12021
12117
|
}
|
|
12022
|
-
} else if (
|
|
12118
|
+
} else if (ts8.isSpreadAssignment(prop)) {
|
|
12023
12119
|
if (manifestKey)
|
|
12024
12120
|
continue;
|
|
12025
12121
|
const spreadExpr = prop.expression;
|
|
12026
|
-
if (
|
|
12122
|
+
if (ts8.isCallExpression(spreadExpr) && spreadExpr.arguments.length > 0) {
|
|
12027
12123
|
const [firstArg] = spreadExpr.arguments;
|
|
12028
|
-
if (firstArg &&
|
|
12124
|
+
if (firstArg && ts8.isStringLiteral(firstArg)) {
|
|
12029
12125
|
manifestKey = firstArg.text;
|
|
12030
12126
|
}
|
|
12031
12127
|
}
|
|
@@ -12053,9 +12149,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12053
12149
|
}
|
|
12054
12150
|
}
|
|
12055
12151
|
}
|
|
12056
|
-
|
|
12152
|
+
ts8.forEachChild(node, visit);
|
|
12057
12153
|
};
|
|
12058
|
-
|
|
12154
|
+
ts8.forEachChild(sf, visit);
|
|
12059
12155
|
}, scanAngularHandlerCalls = (projectRoot) => {
|
|
12060
12156
|
const files = collectSourceFiles2(projectRoot);
|
|
12061
12157
|
const collected = [];
|
|
@@ -12095,10 +12191,11 @@ var exports_runAngularHandlerScan = {};
|
|
|
12095
12191
|
__export(exports_runAngularHandlerScan, {
|
|
12096
12192
|
runAngularHandlerScan: () => runAngularHandlerScan
|
|
12097
12193
|
});
|
|
12098
|
-
var runAngularHandlerScan = (projectRoot, angularDirectory
|
|
12194
|
+
var runAngularHandlerScan = (projectRoot, angularDirectory) => {
|
|
12099
12195
|
const calls = scanAngularHandlerCalls(projectRoot);
|
|
12100
12196
|
const pageRoutes = scanAngularPageRoutes(angularDirectory);
|
|
12101
|
-
const
|
|
12197
|
+
const providersImport = parseAngularProvidersImport(projectRoot);
|
|
12198
|
+
const providersFiles = emitAngularProvidersFiles(projectRoot, calls, pageRoutes, { providersImport });
|
|
12102
12199
|
emitAngularRouteMounts(projectRoot, calls);
|
|
12103
12200
|
return {
|
|
12104
12201
|
calls,
|
|
@@ -12110,6 +12207,7 @@ var runAngularHandlerScan = (projectRoot, angularDirectory, options = {}) => {
|
|
|
12110
12207
|
var init_runAngularHandlerScan = __esm(() => {
|
|
12111
12208
|
init_emitAngularProvidersFiles();
|
|
12112
12209
|
init_emitAngularRouteMounts();
|
|
12210
|
+
init_parseAngularConfigImports();
|
|
12113
12211
|
init_scanAngularHandlerCalls();
|
|
12114
12212
|
init_scanAngularPageRoutes();
|
|
12115
12213
|
});
|
|
@@ -12253,11 +12351,11 @@ __export(exports_compileSvelte, {
|
|
|
12253
12351
|
compileSvelte: () => compileSvelte,
|
|
12254
12352
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
12255
12353
|
});
|
|
12256
|
-
import { existsSync as
|
|
12354
|
+
import { existsSync as existsSync20 } from "fs";
|
|
12257
12355
|
import { mkdir as mkdir4, stat as stat2 } from "fs/promises";
|
|
12258
12356
|
import {
|
|
12259
|
-
dirname as
|
|
12260
|
-
join as
|
|
12357
|
+
dirname as dirname14,
|
|
12358
|
+
join as join27,
|
|
12261
12359
|
basename as basename6,
|
|
12262
12360
|
extname as extname5,
|
|
12263
12361
|
resolve as resolve20,
|
|
@@ -12269,11 +12367,11 @@ var {write: write2, file, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
|
12269
12367
|
var resolveDevClientDir2 = () => {
|
|
12270
12368
|
const projectRoot = process.cwd();
|
|
12271
12369
|
const fromSource = resolve20(import.meta.dir, "../dev/client");
|
|
12272
|
-
if (
|
|
12370
|
+
if (existsSync20(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
12273
12371
|
return fromSource;
|
|
12274
12372
|
}
|
|
12275
12373
|
const fromNodeModules = resolve20(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
12276
|
-
if (
|
|
12374
|
+
if (existsSync20(fromNodeModules))
|
|
12277
12375
|
return fromNodeModules;
|
|
12278
12376
|
return resolve20(import.meta.dir, "./dev/client");
|
|
12279
12377
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
@@ -12305,7 +12403,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12305
12403
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
12306
12404
|
if (!spec.startsWith("."))
|
|
12307
12405
|
return null;
|
|
12308
|
-
const basePath = resolve20(
|
|
12406
|
+
const basePath = resolve20(dirname14(from), spec);
|
|
12309
12407
|
const candidates = [
|
|
12310
12408
|
basePath,
|
|
12311
12409
|
`${basePath}.ts`,
|
|
@@ -12316,14 +12414,14 @@ var resolveDevClientDir2 = () => {
|
|
|
12316
12414
|
`${basePath}.svelte`,
|
|
12317
12415
|
`${basePath}.svelte.ts`,
|
|
12318
12416
|
`${basePath}.svelte.js`,
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
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")
|
|
12327
12425
|
];
|
|
12328
12426
|
const checks = await Promise.all(candidates.map(exists));
|
|
12329
12427
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -12332,7 +12430,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12332
12430
|
const resolved = resolvePackageImport(spec);
|
|
12333
12431
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
12334
12432
|
}
|
|
12335
|
-
const basePath = resolve20(
|
|
12433
|
+
const basePath = resolve20(dirname14(from), spec);
|
|
12336
12434
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
12337
12435
|
if (!explicit) {
|
|
12338
12436
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -12362,9 +12460,9 @@ var resolveDevClientDir2 = () => {
|
|
|
12362
12460
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
12363
12461
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
12364
12462
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
12365
|
-
const clientDir =
|
|
12366
|
-
const indexDir =
|
|
12367
|
-
const serverDir =
|
|
12463
|
+
const clientDir = join27(generatedDir, "client");
|
|
12464
|
+
const indexDir = join27(generatedDir, "indexes");
|
|
12465
|
+
const serverDir = join27(generatedDir, "server");
|
|
12368
12466
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir4(dir, { recursive: true })));
|
|
12369
12467
|
const dev = env.NODE_ENV !== "production";
|
|
12370
12468
|
const build = async (src) => {
|
|
@@ -12376,7 +12474,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12376
12474
|
const contentHash = Bun.hash(raw).toString(BASE_36_RADIX);
|
|
12377
12475
|
const prevHash = sourceHashCache.get(src);
|
|
12378
12476
|
const persistent = persistentCache.get(src);
|
|
12379
|
-
if (prevHash === contentHash && persistent &&
|
|
12477
|
+
if (prevHash === contentHash && persistent && existsSync20(persistent.ssr) && existsSync20(persistent.client)) {
|
|
12380
12478
|
cache.set(src, persistent);
|
|
12381
12479
|
return persistent;
|
|
12382
12480
|
}
|
|
@@ -12392,8 +12490,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12392
12490
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
12393
12491
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
12394
12492
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
12395
|
-
const rawRel =
|
|
12396
|
-
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;
|
|
12397
12495
|
const baseName = basename6(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
12398
12496
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
12399
12497
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -12402,8 +12500,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12402
12500
|
const childBuilt = await Promise.all(childSources.map((child) => build(child)));
|
|
12403
12501
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
12404
12502
|
const externalRewrites = new Map;
|
|
12405
|
-
const ssrOutputDir =
|
|
12406
|
-
const clientOutputDir =
|
|
12503
|
+
const ssrOutputDir = dirname14(join27(serverDir, relDir, `${baseName}.js`));
|
|
12504
|
+
const clientOutputDir = dirname14(join27(clientDir, relDir, `${baseName}.js`));
|
|
12407
12505
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
12408
12506
|
const rawSpec = importPaths[idx];
|
|
12409
12507
|
if (!rawSpec)
|
|
@@ -12468,11 +12566,11 @@ var resolveDevClientDir2 = () => {
|
|
|
12468
12566
|
code += islandMetadataExports;
|
|
12469
12567
|
return { code, map: compiledJs.map };
|
|
12470
12568
|
};
|
|
12471
|
-
const ssrPath =
|
|
12472
|
-
const clientPath =
|
|
12569
|
+
const ssrPath = join27(serverDir, relDir, `${baseName}.js`);
|
|
12570
|
+
const clientPath = join27(clientDir, relDir, `${baseName}.js`);
|
|
12473
12571
|
await Promise.all([
|
|
12474
|
-
mkdir4(
|
|
12475
|
-
mkdir4(
|
|
12572
|
+
mkdir4(dirname14(ssrPath), { recursive: true }),
|
|
12573
|
+
mkdir4(dirname14(clientPath), { recursive: true })
|
|
12476
12574
|
]);
|
|
12477
12575
|
const inlineMap = (map) => map ? `
|
|
12478
12576
|
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
@@ -12505,10 +12603,10 @@ var resolveDevClientDir2 = () => {
|
|
|
12505
12603
|
};
|
|
12506
12604
|
const roots = await Promise.all(entryPoints.map(build));
|
|
12507
12605
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
12508
|
-
const relClientDir =
|
|
12606
|
+
const relClientDir = dirname14(relative11(clientDir, client));
|
|
12509
12607
|
const name = basename6(client, extname5(client));
|
|
12510
|
-
const indexPath =
|
|
12511
|
-
const importRaw = relative11(
|
|
12608
|
+
const indexPath = join27(indexDir, relClientDir, `${name}.js`);
|
|
12609
|
+
const importRaw = relative11(dirname14(indexPath), client).split(sep2).join("/");
|
|
12512
12610
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
12513
12611
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
12514
12612
|
import "${hmrClientPath3}";
|
|
@@ -12579,14 +12677,14 @@ if (typeof window !== "undefined") {
|
|
|
12579
12677
|
setTimeout(releaseStreamingSlots, 0);
|
|
12580
12678
|
}
|
|
12581
12679
|
}`;
|
|
12582
|
-
await mkdir4(
|
|
12680
|
+
await mkdir4(dirname14(indexPath), { recursive: true });
|
|
12583
12681
|
return write2(indexPath, bootstrap);
|
|
12584
12682
|
}));
|
|
12585
12683
|
return {
|
|
12586
12684
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
12587
12685
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
12588
|
-
const rel =
|
|
12589
|
-
return
|
|
12686
|
+
const rel = dirname14(relative11(clientDir, client));
|
|
12687
|
+
return join27(indexDir, rel, basename6(client));
|
|
12590
12688
|
}),
|
|
12591
12689
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
12592
12690
|
};
|
|
@@ -12601,7 +12699,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
12601
12699
|
init_lowerAwaitSlotSyntax();
|
|
12602
12700
|
init_renderToReadableStream();
|
|
12603
12701
|
devClientDir2 = resolveDevClientDir2();
|
|
12604
|
-
hmrClientPath3 =
|
|
12702
|
+
hmrClientPath3 = join27(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
12605
12703
|
persistentCache = new Map;
|
|
12606
12704
|
sourceHashCache = new Map;
|
|
12607
12705
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
@@ -12616,7 +12714,7 @@ __export(exports_chainInlineSourcemaps, {
|
|
|
12616
12714
|
chainBundleInlineSourcemap: () => chainBundleInlineSourcemap,
|
|
12617
12715
|
buildLineRemap: () => buildLineRemap
|
|
12618
12716
|
});
|
|
12619
|
-
import { readFileSync as
|
|
12717
|
+
import { readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
|
|
12620
12718
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", BASE64_TO_INT, decodeVlq = (str, startPos) => {
|
|
12621
12719
|
let result = 0;
|
|
12622
12720
|
let shift = 0;
|
|
@@ -12907,7 +13005,7 @@ var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567
|
|
|
12907
13005
|
version: 3
|
|
12908
13006
|
};
|
|
12909
13007
|
}, chainBundleInlineSourcemap = (bundleFilePath) => {
|
|
12910
|
-
const text =
|
|
13008
|
+
const text = readFileSync15(bundleFilePath, "utf-8");
|
|
12911
13009
|
const outerMap = extractInlineMap(text);
|
|
12912
13010
|
if (!outerMap)
|
|
12913
13011
|
return;
|
|
@@ -12993,13 +13091,13 @@ __export(exports_compileVue, {
|
|
|
12993
13091
|
compileVue: () => compileVue,
|
|
12994
13092
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
12995
13093
|
});
|
|
12996
|
-
import { existsSync as
|
|
13094
|
+
import { existsSync as existsSync21 } from "fs";
|
|
12997
13095
|
import { mkdir as mkdir5 } from "fs/promises";
|
|
12998
13096
|
import {
|
|
12999
13097
|
basename as basename7,
|
|
13000
|
-
dirname as
|
|
13001
|
-
isAbsolute as
|
|
13002
|
-
join as
|
|
13098
|
+
dirname as dirname15,
|
|
13099
|
+
isAbsolute as isAbsolute5,
|
|
13100
|
+
join as join28,
|
|
13003
13101
|
relative as relative12,
|
|
13004
13102
|
resolve as resolve21
|
|
13005
13103
|
} from "path";
|
|
@@ -13007,11 +13105,11 @@ var {file: file2, write: write3, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
|
13007
13105
|
var resolveDevClientDir3 = () => {
|
|
13008
13106
|
const projectRoot = process.cwd();
|
|
13009
13107
|
const fromSource = resolve21(import.meta.dir, "../dev/client");
|
|
13010
|
-
if (
|
|
13108
|
+
if (existsSync21(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
13011
13109
|
return fromSource;
|
|
13012
13110
|
}
|
|
13013
13111
|
const fromNodeModules = resolve21(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
13014
|
-
if (
|
|
13112
|
+
if (existsSync21(fromNodeModules))
|
|
13015
13113
|
return fromNodeModules;
|
|
13016
13114
|
return resolve21(import.meta.dir, "./dev/client");
|
|
13017
13115
|
}, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
@@ -13095,7 +13193,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13095
13193
|
const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
|
|
13096
13194
|
const prevHash = vueSourceHashCache.get(sourceFilePath);
|
|
13097
13195
|
const persistent = persistentBuildCache.get(sourceFilePath);
|
|
13098
|
-
if (prevHash === contentHash && persistent &&
|
|
13196
|
+
if (prevHash === contentHash && persistent && existsSync21(persistent.clientPath) && existsSync21(persistent.serverPath)) {
|
|
13099
13197
|
cacheMap.set(sourceFilePath, persistent);
|
|
13100
13198
|
return persistent;
|
|
13101
13199
|
}
|
|
@@ -13123,12 +13221,12 @@ var resolveDevClientDir3 = () => {
|
|
|
13123
13221
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
13124
13222
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
13125
13223
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
13126
|
-
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));
|
|
13127
13225
|
for (const stylePath of stylePathsImported) {
|
|
13128
13226
|
addStyleImporter(sourceFilePath, stylePath);
|
|
13129
13227
|
}
|
|
13130
13228
|
const childBuildResults = await Promise.all([
|
|
13131
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve21(
|
|
13229
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve21(dirname15(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
13132
13230
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
13133
13231
|
]);
|
|
13134
13232
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -13138,7 +13236,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13138
13236
|
sourceMap: true
|
|
13139
13237
|
}) : { bindings: {}, content: "export default {};", map: undefined };
|
|
13140
13238
|
const strippedScript = stripExports2(compiledScript.content);
|
|
13141
|
-
const sourceDir =
|
|
13239
|
+
const sourceDir = dirname15(sourceFilePath);
|
|
13142
13240
|
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
13143
13241
|
const packageImportRewrites = new Map;
|
|
13144
13242
|
for (const [bareImport, absolutePath] of packageComponentPaths) {
|
|
@@ -13177,8 +13275,8 @@ var resolveDevClientDir3 = () => {
|
|
|
13177
13275
|
];
|
|
13178
13276
|
let cssOutputPaths = [];
|
|
13179
13277
|
if (isEntryPoint && allCss.length) {
|
|
13180
|
-
const cssOutputFile =
|
|
13181
|
-
await mkdir5(
|
|
13278
|
+
const cssOutputFile = join28(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
13279
|
+
await mkdir5(dirname15(cssOutputFile), { recursive: true });
|
|
13182
13280
|
await write3(cssOutputFile, allCss.join(`
|
|
13183
13281
|
`));
|
|
13184
13282
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -13208,9 +13306,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13208
13306
|
};
|
|
13209
13307
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
13210
13308
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
13211
|
-
const clientOutputPath =
|
|
13212
|
-
const serverOutputPath =
|
|
13213
|
-
const relDir =
|
|
13309
|
+
const clientOutputPath = join28(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
13310
|
+
const serverOutputPath = join28(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
13311
|
+
const relDir = dirname15(relativeFilePath);
|
|
13214
13312
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
13215
13313
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
13216
13314
|
const upCount = dots.split("/").length - 1;
|
|
@@ -13222,15 +13320,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13222
13320
|
let result2 = code;
|
|
13223
13321
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
13224
13322
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
13225
|
-
let rel = relative12(
|
|
13323
|
+
let rel = relative12(dirname15(outputPath), targetPath).replace(/\\/g, "/");
|
|
13226
13324
|
if (!rel.startsWith("."))
|
|
13227
13325
|
rel = `./${rel}`;
|
|
13228
13326
|
result2 = result2.replaceAll(bareImport, rel);
|
|
13229
13327
|
}
|
|
13230
13328
|
return result2;
|
|
13231
13329
|
};
|
|
13232
|
-
await mkdir5(
|
|
13233
|
-
await mkdir5(
|
|
13330
|
+
await mkdir5(dirname15(clientOutputPath), { recursive: true });
|
|
13331
|
+
await mkdir5(dirname15(serverOutputPath), { recursive: true });
|
|
13234
13332
|
const clientFinal = rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client");
|
|
13235
13333
|
const serverFinal = rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server");
|
|
13236
13334
|
const inlineSourceMapFor = (finalContent) => {
|
|
@@ -13252,7 +13350,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13252
13350
|
hmrId,
|
|
13253
13351
|
serverPath: serverOutputPath,
|
|
13254
13352
|
tsHelperPaths: [
|
|
13255
|
-
...helperModulePaths.map((helper) => resolve21(
|
|
13353
|
+
...helperModulePaths.map((helper) => resolve21(dirname15(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
13256
13354
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
13257
13355
|
]
|
|
13258
13356
|
};
|
|
@@ -13262,10 +13360,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13262
13360
|
}, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors) => {
|
|
13263
13361
|
const compiler = await import("@vue/compiler-sfc");
|
|
13264
13362
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
13265
|
-
const clientOutputDir =
|
|
13266
|
-
const indexOutputDir =
|
|
13267
|
-
const serverOutputDir =
|
|
13268
|
-
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");
|
|
13269
13367
|
await Promise.all([
|
|
13270
13368
|
mkdir5(clientOutputDir, { recursive: true }),
|
|
13271
13369
|
mkdir5(indexOutputDir, { recursive: true }),
|
|
@@ -13282,16 +13380,16 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13282
13380
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
13283
13381
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
13284
13382
|
const entryBaseName = basename7(entryPath, ".vue");
|
|
13285
|
-
const indexOutputFile =
|
|
13286
|
-
const clientOutputFile =
|
|
13287
|
-
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 });
|
|
13288
13386
|
const vueHmrImports = isDev ? [
|
|
13289
13387
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
13290
13388
|
`import "${hmrClientPath4}";`
|
|
13291
13389
|
] : [];
|
|
13292
13390
|
await write3(indexOutputFile, [
|
|
13293
13391
|
...vueHmrImports,
|
|
13294
|
-
`import Comp, * as PageModule from "${relative12(
|
|
13392
|
+
`import Comp, * as PageModule from "${relative12(dirname15(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
13295
13393
|
'import { createSSRApp, createApp } from "vue";',
|
|
13296
13394
|
"",
|
|
13297
13395
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -13436,10 +13534,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13436
13534
|
const sourceCode = await file2(tsPath).text();
|
|
13437
13535
|
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
13438
13536
|
const relativeJsPath = relative12(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
13439
|
-
const outClientPath =
|
|
13440
|
-
const outServerPath =
|
|
13441
|
-
await mkdir5(
|
|
13442
|
-
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 });
|
|
13443
13541
|
await write3(outClientPath, transpiledCode);
|
|
13444
13542
|
await write3(outServerPath, transpiledCode);
|
|
13445
13543
|
}));
|
|
@@ -13460,7 +13558,7 @@ var init_compileVue = __esm(() => {
|
|
|
13460
13558
|
init_vueAutoRouterTransform();
|
|
13461
13559
|
init_stylePreprocessor();
|
|
13462
13560
|
devClientDir3 = resolveDevClientDir3();
|
|
13463
|
-
hmrClientPath4 =
|
|
13561
|
+
hmrClientPath4 = join28(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
13464
13562
|
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
13465
13563
|
scriptCache = new Map;
|
|
13466
13564
|
scriptSetupCache = new Map;
|
|
@@ -13941,17 +14039,17 @@ __export(exports_compileAngular, {
|
|
|
13941
14039
|
compileAngularFile: () => compileAngularFile,
|
|
13942
14040
|
compileAngular: () => compileAngular
|
|
13943
14041
|
});
|
|
13944
|
-
import { existsSync as
|
|
13945
|
-
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";
|
|
13946
14044
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
13947
|
-
import
|
|
14045
|
+
import ts9 from "typescript";
|
|
13948
14046
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
13949
14047
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
13950
14048
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata) : await fn2();
|
|
13951
14049
|
}, readTsconfigPathAliases = () => {
|
|
13952
14050
|
try {
|
|
13953
14051
|
const configPath2 = resolve22(process.cwd(), "tsconfig.json");
|
|
13954
|
-
const config =
|
|
14052
|
+
const config = ts9.readConfigFile(configPath2, ts9.sys.readFile).config;
|
|
13955
14053
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
13956
14054
|
const baseUrl = resolve22(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
13957
14055
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
@@ -13985,12 +14083,12 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
13985
14083
|
`${candidate}.tsx`,
|
|
13986
14084
|
`${candidate}.js`,
|
|
13987
14085
|
`${candidate}.jsx`,
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
14086
|
+
join29(candidate, "index.ts"),
|
|
14087
|
+
join29(candidate, "index.tsx"),
|
|
14088
|
+
join29(candidate, "index.js"),
|
|
14089
|
+
join29(candidate, "index.jsx")
|
|
13992
14090
|
];
|
|
13993
|
-
return candidates.find((file3) =>
|
|
14091
|
+
return candidates.find((file3) => existsSync22(file3));
|
|
13994
14092
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
13995
14093
|
const baseDir = resolve22(rootDir);
|
|
13996
14094
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
@@ -14060,7 +14158,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14060
14158
|
if (scan.usesLegacyAnimations)
|
|
14061
14159
|
return true;
|
|
14062
14160
|
for (const specifier of scan.imports) {
|
|
14063
|
-
const importedPath = resolveLocalImport(specifier,
|
|
14161
|
+
const importedPath = resolveLocalImport(specifier, dirname16(resolved));
|
|
14064
14162
|
if (importedPath && await visit(importedPath, visited)) {
|
|
14065
14163
|
return true;
|
|
14066
14164
|
}
|
|
@@ -14071,16 +14169,16 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14071
14169
|
}, resolveDevClientDir4 = () => {
|
|
14072
14170
|
const projectRoot = process.cwd();
|
|
14073
14171
|
const fromSource = resolve22(import.meta.dir, "../dev/client");
|
|
14074
|
-
if (
|
|
14172
|
+
if (existsSync22(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
14075
14173
|
return fromSource;
|
|
14076
14174
|
}
|
|
14077
14175
|
const fromNodeModules = resolve22(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
14078
|
-
if (
|
|
14176
|
+
if (existsSync22(fromNodeModules))
|
|
14079
14177
|
return fromNodeModules;
|
|
14080
14178
|
return resolve22(import.meta.dir, "./dev/client");
|
|
14081
14179
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
14082
14180
|
try {
|
|
14083
|
-
return
|
|
14181
|
+
return ts9.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
14084
14182
|
`);
|
|
14085
14183
|
} catch {
|
|
14086
14184
|
return String(diagnostic.messageText || "Unknown error");
|
|
@@ -14088,7 +14186,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14088
14186
|
}, throwOnCompilationErrors = (diagnostics) => {
|
|
14089
14187
|
if (!diagnostics?.length)
|
|
14090
14188
|
return;
|
|
14091
|
-
const errors = diagnostics.filter((diag) => diag.category ===
|
|
14189
|
+
const errors = diagnostics.filter((diag) => diag.category === ts9.DiagnosticCategory.Error);
|
|
14092
14190
|
if (!errors.length)
|
|
14093
14191
|
return;
|
|
14094
14192
|
const fullMessage = errors.map(formatDiagnosticMessage).join(`
|
|
@@ -14119,51 +14217,51 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14119
14217
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
14120
14218
|
if (hasJsLikeExtension(path))
|
|
14121
14219
|
return `${path}${query}`;
|
|
14122
|
-
const importerDir =
|
|
14220
|
+
const importerDir = dirname16(importerOutputPath);
|
|
14123
14221
|
const fileCandidate = resolve22(importerDir, `${path}.js`);
|
|
14124
|
-
if (outputFiles?.has(fileCandidate) ||
|
|
14222
|
+
if (outputFiles?.has(fileCandidate) || existsSync22(fileCandidate)) {
|
|
14125
14223
|
return `${path}.js${query}`;
|
|
14126
14224
|
}
|
|
14127
14225
|
const indexCandidate = resolve22(importerDir, path, "index.js");
|
|
14128
|
-
if (outputFiles?.has(indexCandidate) ||
|
|
14226
|
+
if (outputFiles?.has(indexCandidate) || existsSync22(indexCandidate)) {
|
|
14129
14227
|
return `${path}/index.js${query}`;
|
|
14130
14228
|
}
|
|
14131
14229
|
return `${path}.js${query}`;
|
|
14132
14230
|
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
14133
|
-
const sourceFile =
|
|
14231
|
+
const sourceFile = ts9.createSourceFile(fileName, source, ts9.ScriptTarget.Latest, true, ts9.ScriptKind.TS);
|
|
14134
14232
|
const specifiers = [];
|
|
14135
14233
|
const addSpecifier = (node) => {
|
|
14136
|
-
if (!node || !
|
|
14234
|
+
if (!node || !ts9.isStringLiteralLike(node))
|
|
14137
14235
|
return;
|
|
14138
14236
|
const specifier = node.text;
|
|
14139
14237
|
if (isRelativeModuleSpecifier(specifier))
|
|
14140
14238
|
specifiers.push(specifier);
|
|
14141
14239
|
};
|
|
14142
14240
|
const visit = (node) => {
|
|
14143
|
-
if (
|
|
14241
|
+
if (ts9.isImportDeclaration(node) || ts9.isExportDeclaration(node)) {
|
|
14144
14242
|
addSpecifier(node.moduleSpecifier);
|
|
14145
|
-
} else if (
|
|
14243
|
+
} else if (ts9.isCallExpression(node) && node.expression.kind === ts9.SyntaxKind.ImportKeyword) {
|
|
14146
14244
|
addSpecifier(node.arguments[0]);
|
|
14147
14245
|
}
|
|
14148
|
-
|
|
14246
|
+
ts9.forEachChild(node, visit);
|
|
14149
14247
|
};
|
|
14150
14248
|
visit(sourceFile);
|
|
14151
14249
|
return specifiers;
|
|
14152
14250
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
14153
14251
|
if (!isRelativeModuleSpecifier(specifier))
|
|
14154
14252
|
return null;
|
|
14155
|
-
const basePath = resolve22(
|
|
14253
|
+
const basePath = resolve22(dirname16(fromFile), specifier);
|
|
14156
14254
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
14157
14255
|
`${basePath}.ts`,
|
|
14158
14256
|
`${basePath}.tsx`,
|
|
14159
14257
|
`${basePath}.mts`,
|
|
14160
14258
|
`${basePath}.cts`,
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14259
|
+
join29(basePath, "index.ts"),
|
|
14260
|
+
join29(basePath, "index.tsx"),
|
|
14261
|
+
join29(basePath, "index.mts"),
|
|
14262
|
+
join29(basePath, "index.cts")
|
|
14165
14263
|
];
|
|
14166
|
-
return candidates.map((candidate) => resolve22(candidate)).find((candidate) =>
|
|
14264
|
+
return candidates.map((candidate) => resolve22(candidate)).find((candidate) => existsSync22(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
14167
14265
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
14168
14266
|
const hostSource = readFile6?.(fileName);
|
|
14169
14267
|
if (typeof hostSource === "string")
|
|
@@ -14187,15 +14285,15 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14187
14285
|
const paths = [];
|
|
14188
14286
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14189
14287
|
if (templateUrlMatch?.[1])
|
|
14190
|
-
paths.push(
|
|
14288
|
+
paths.push(join29(fileDir, templateUrlMatch[1]));
|
|
14191
14289
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14192
14290
|
if (styleUrlMatch?.[1])
|
|
14193
|
-
paths.push(
|
|
14291
|
+
paths.push(join29(fileDir, styleUrlMatch[1]));
|
|
14194
14292
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
14195
14293
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
14196
14294
|
if (urlMatches) {
|
|
14197
14295
|
for (const urlMatch of urlMatches) {
|
|
14198
|
-
paths.push(
|
|
14296
|
+
paths.push(join29(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
14199
14297
|
}
|
|
14200
14298
|
}
|
|
14201
14299
|
return paths.map((path) => resolve22(path));
|
|
@@ -14210,13 +14308,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14210
14308
|
return null;
|
|
14211
14309
|
}
|
|
14212
14310
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
14213
|
-
await fs5.mkdir(
|
|
14311
|
+
await fs5.mkdir(dirname16(cachePath), { recursive: true });
|
|
14214
14312
|
await fs5.writeFile(cachePath, JSON.stringify({
|
|
14215
14313
|
source,
|
|
14216
14314
|
version: 1
|
|
14217
14315
|
}), "utf-8");
|
|
14218
14316
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
14219
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
14317
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname16(filePath));
|
|
14220
14318
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
14221
14319
|
const content = await fs5.readFile(resourcePath, "utf-8");
|
|
14222
14320
|
return `${resourcePath}\x00${content}`;
|
|
@@ -14229,7 +14327,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14229
14327
|
safeStableStringify(stylePreprocessors ?? null)
|
|
14230
14328
|
].join("\x00");
|
|
14231
14329
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
14232
|
-
return
|
|
14330
|
+
return join29(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
14233
14331
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
14234
14332
|
const transformedSources = new Map;
|
|
14235
14333
|
const visited = new Set;
|
|
@@ -14244,7 +14342,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14244
14342
|
if (visited.has(resolvedPath))
|
|
14245
14343
|
return;
|
|
14246
14344
|
visited.add(resolvedPath);
|
|
14247
|
-
if (!
|
|
14345
|
+
if (!existsSync22(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
14248
14346
|
return;
|
|
14249
14347
|
stats.filesVisited += 1;
|
|
14250
14348
|
const source = await readFileForAotTransform(resolvedPath, readFile6);
|
|
@@ -14256,7 +14354,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14256
14354
|
transformedSource = cached.source;
|
|
14257
14355
|
} else {
|
|
14258
14356
|
stats.cacheMisses += 1;
|
|
14259
|
-
const transformed = await inlineResources(source,
|
|
14357
|
+
const transformed = await inlineResources(source, dirname16(resolvedPath), stylePreprocessors);
|
|
14260
14358
|
transformedSource = transformed.source;
|
|
14261
14359
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
14262
14360
|
}
|
|
@@ -14275,17 +14373,17 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14275
14373
|
return { stats, transformedSources };
|
|
14276
14374
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
14277
14375
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
14278
|
-
const outputPath = resolve22(
|
|
14376
|
+
const outputPath = resolve22(join29(outDir, relative13(process.cwd(), resolve22(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
14279
14377
|
return [
|
|
14280
14378
|
outputPath,
|
|
14281
|
-
buildIslandMetadataExports(
|
|
14379
|
+
buildIslandMetadataExports(readFileSync16(inputPath, "utf-8"))
|
|
14282
14380
|
];
|
|
14283
14381
|
})), { entries: inputPaths.length });
|
|
14284
14382
|
await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
|
|
14285
14383
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
14286
14384
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
14287
14385
|
const tsPath = __require.resolve("typescript");
|
|
14288
|
-
const tsRootDir =
|
|
14386
|
+
const tsRootDir = dirname16(tsPath);
|
|
14289
14387
|
return tsRootDir.endsWith("lib") ? tsRootDir : resolve22(tsRootDir, "lib");
|
|
14290
14388
|
});
|
|
14291
14389
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
@@ -14293,25 +14391,25 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14293
14391
|
emitDecoratorMetadata: true,
|
|
14294
14392
|
esModuleInterop: true,
|
|
14295
14393
|
experimentalDecorators: true,
|
|
14296
|
-
module:
|
|
14297
|
-
moduleResolution:
|
|
14298
|
-
newLine:
|
|
14394
|
+
module: ts9.ModuleKind.ESNext,
|
|
14395
|
+
moduleResolution: ts9.ModuleResolutionKind.Bundler,
|
|
14396
|
+
newLine: ts9.NewLineKind.LineFeed,
|
|
14299
14397
|
noLib: false,
|
|
14300
14398
|
outDir,
|
|
14301
14399
|
skipLibCheck: true,
|
|
14302
|
-
target:
|
|
14400
|
+
target: ts9.ScriptTarget.ES2022,
|
|
14303
14401
|
...config.options
|
|
14304
14402
|
};
|
|
14305
|
-
options.target =
|
|
14403
|
+
options.target = ts9.ScriptTarget.ES2022;
|
|
14306
14404
|
options.experimentalDecorators = true;
|
|
14307
14405
|
options.emitDecoratorMetadata = true;
|
|
14308
|
-
options.newLine =
|
|
14406
|
+
options.newLine = ts9.NewLineKind.LineFeed;
|
|
14309
14407
|
options.outDir = outDir;
|
|
14310
14408
|
options.noEmit = false;
|
|
14311
14409
|
options.incremental = false;
|
|
14312
14410
|
options.tsBuildInfoFile = undefined;
|
|
14313
14411
|
options.rootDir = process.cwd();
|
|
14314
|
-
const host = await traceAngularPhase("aot/create-compiler-host", () =>
|
|
14412
|
+
const host = await traceAngularPhase("aot/create-compiler-host", () => ts9.createCompilerHost(options));
|
|
14315
14413
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
14316
14414
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
14317
14415
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
@@ -14322,7 +14420,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14322
14420
|
const originalGetSourceFile = host.getSourceFile;
|
|
14323
14421
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14324
14422
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
14325
|
-
const resolvedPath =
|
|
14423
|
+
const resolvedPath = join29(tsLibDir, fileName);
|
|
14326
14424
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
14327
14425
|
}
|
|
14328
14426
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
@@ -14357,7 +14455,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14357
14455
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14358
14456
|
const source = transformedSources.get(resolve22(fileName));
|
|
14359
14457
|
if (source) {
|
|
14360
|
-
return
|
|
14458
|
+
return ts9.createSourceFile(fileName, source, languageVersion, true);
|
|
14361
14459
|
}
|
|
14362
14460
|
return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError);
|
|
14363
14461
|
};
|
|
@@ -14377,7 +14475,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14377
14475
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
14378
14476
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
14379
14477
|
content,
|
|
14380
|
-
target:
|
|
14478
|
+
target: join29(outDir, fileName)
|
|
14381
14479
|
}));
|
|
14382
14480
|
const outputFiles = new Set(rawEntries.map(({ target }) => resolve22(target)));
|
|
14383
14481
|
return rawEntries.map(({ content, target }) => {
|
|
@@ -14399,7 +14497,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14399
14497
|
});
|
|
14400
14498
|
});
|
|
14401
14499
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
14402
|
-
await fs5.mkdir(
|
|
14500
|
+
await fs5.mkdir(dirname16(target), { recursive: true });
|
|
14403
14501
|
await fs5.writeFile(target, content, "utf-8");
|
|
14404
14502
|
})), { outputs: entries.length });
|
|
14405
14503
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -14418,7 +14516,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14418
14516
|
return null;
|
|
14419
14517
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
14420
14518
|
const sourceEntry = resolve22(import.meta.dir, "../angular/components/index.ts");
|
|
14421
|
-
if (
|
|
14519
|
+
if (existsSync22(sourceEntry)) {
|
|
14422
14520
|
return sourceEntry.replace(/\\/g, "/");
|
|
14423
14521
|
}
|
|
14424
14522
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -14546,7 +14644,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
14546
14644
|
${fields}
|
|
14547
14645
|
`);
|
|
14548
14646
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
14549
|
-
if (!
|
|
14647
|
+
if (!existsSync22(filePath)) {
|
|
14550
14648
|
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
14551
14649
|
}
|
|
14552
14650
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
@@ -14554,8 +14652,8 @@ ${fields}
|
|
|
14554
14652
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
14555
14653
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14556
14654
|
if (templateUrlMatch?.[1]) {
|
|
14557
|
-
const templatePath =
|
|
14558
|
-
if (!
|
|
14655
|
+
const templatePath = join29(fileDir, templateUrlMatch[1]);
|
|
14656
|
+
if (!existsSync22(templatePath)) {
|
|
14559
14657
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14560
14658
|
}
|
|
14561
14659
|
const templateRaw2 = await fs5.readFile(templatePath, "utf-8");
|
|
@@ -14585,11 +14683,11 @@ ${fields}
|
|
|
14585
14683
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
14586
14684
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14587
14685
|
if (templateUrlMatch?.[1]) {
|
|
14588
|
-
const templatePath =
|
|
14589
|
-
if (!
|
|
14686
|
+
const templatePath = join29(fileDir, templateUrlMatch[1]);
|
|
14687
|
+
if (!existsSync22(templatePath)) {
|
|
14590
14688
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14591
14689
|
}
|
|
14592
|
-
const templateRaw2 =
|
|
14690
|
+
const templateRaw2 = readFileSync16(templatePath, "utf-8");
|
|
14593
14691
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
14594
14692
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
14595
14693
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -14622,7 +14720,7 @@ ${fields}
|
|
|
14622
14720
|
return source;
|
|
14623
14721
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
14624
14722
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
14625
|
-
return readAndEscapeFile(
|
|
14723
|
+
return readAndEscapeFile(join29(fileDir, styleUrl), stylePreprocessors);
|
|
14626
14724
|
});
|
|
14627
14725
|
const results = await Promise.all(stylePromises);
|
|
14628
14726
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -14633,7 +14731,7 @@ ${fields}
|
|
|
14633
14731
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14634
14732
|
if (!styleUrlMatch?.[1])
|
|
14635
14733
|
return source;
|
|
14636
|
-
const escaped = await readAndEscapeFile(
|
|
14734
|
+
const escaped = await readAndEscapeFile(join29(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
14637
14735
|
if (!escaped)
|
|
14638
14736
|
return source;
|
|
14639
14737
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -14669,12 +14767,12 @@ ${fields}
|
|
|
14669
14767
|
`${candidate}.js`,
|
|
14670
14768
|
`${candidate}.jsx`,
|
|
14671
14769
|
`${candidate}.json`,
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14770
|
+
join29(candidate, "index.ts"),
|
|
14771
|
+
join29(candidate, "index.tsx"),
|
|
14772
|
+
join29(candidate, "index.js"),
|
|
14773
|
+
join29(candidate, "index.jsx")
|
|
14676
14774
|
];
|
|
14677
|
-
return candidates.find((file3) =>
|
|
14775
|
+
return candidates.find((file3) => existsSync22(file3));
|
|
14678
14776
|
};
|
|
14679
14777
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
14680
14778
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
@@ -14696,10 +14794,10 @@ ${fields}
|
|
|
14696
14794
|
}
|
|
14697
14795
|
};
|
|
14698
14796
|
const toOutputPath = (sourcePath) => {
|
|
14699
|
-
const inputDir =
|
|
14797
|
+
const inputDir = dirname16(sourcePath);
|
|
14700
14798
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14701
14799
|
const fileBase = basename8(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14702
|
-
return
|
|
14800
|
+
return join29(outDir, relativeDir, fileBase);
|
|
14703
14801
|
};
|
|
14704
14802
|
const withCacheBuster = (specifier) => {
|
|
14705
14803
|
if (!cacheBuster)
|
|
@@ -14746,11 +14844,11 @@ ${fields}
|
|
|
14746
14844
|
if (visited.has(resolved))
|
|
14747
14845
|
return;
|
|
14748
14846
|
visited.add(resolved);
|
|
14749
|
-
if (resolved.endsWith(".json") &&
|
|
14750
|
-
const inputDir2 =
|
|
14847
|
+
if (resolved.endsWith(".json") && existsSync22(resolved)) {
|
|
14848
|
+
const inputDir2 = dirname16(resolved);
|
|
14751
14849
|
const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
|
|
14752
|
-
const targetDir2 =
|
|
14753
|
-
const targetPath2 =
|
|
14850
|
+
const targetDir2 = join29(outDir, relativeDir2);
|
|
14851
|
+
const targetPath2 = join29(targetDir2, basename8(resolved));
|
|
14754
14852
|
await fs5.mkdir(targetDir2, { recursive: true });
|
|
14755
14853
|
await fs5.copyFile(resolved, targetPath2);
|
|
14756
14854
|
allOutputs.push(targetPath2);
|
|
@@ -14759,15 +14857,15 @@ ${fields}
|
|
|
14759
14857
|
let actualPath = resolved;
|
|
14760
14858
|
if (!actualPath.endsWith(".ts"))
|
|
14761
14859
|
actualPath += ".ts";
|
|
14762
|
-
if (!
|
|
14860
|
+
if (!existsSync22(actualPath))
|
|
14763
14861
|
return;
|
|
14764
14862
|
let sourceCode = await fs5.readFile(actualPath, "utf-8");
|
|
14765
|
-
const inlined = await inlineResources(sourceCode,
|
|
14766
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
14767
|
-
const inputDir =
|
|
14863
|
+
const inlined = await inlineResources(sourceCode, dirname16(actualPath), stylePreprocessors);
|
|
14864
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname16(actualPath)).source;
|
|
14865
|
+
const inputDir = dirname16(actualPath);
|
|
14768
14866
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14769
14867
|
const fileBase = basename8(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14770
|
-
const targetDir =
|
|
14868
|
+
const targetDir = join29(outDir, relativeDir);
|
|
14771
14869
|
const targetPath = toOutputPath(actualPath);
|
|
14772
14870
|
const localImports = [];
|
|
14773
14871
|
const importRewrites = new Map;
|
|
@@ -14797,7 +14895,7 @@ ${fields}
|
|
|
14797
14895
|
const isEntry = resolve22(actualPath) === resolve22(entryPath);
|
|
14798
14896
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
14799
14897
|
const cacheKey2 = actualPath;
|
|
14800
|
-
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !
|
|
14898
|
+
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync22(targetPath);
|
|
14801
14899
|
if (shouldWriteFile) {
|
|
14802
14900
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
14803
14901
|
await fs5.mkdir(targetDir, { recursive: true });
|
|
@@ -14809,7 +14907,7 @@ ${fields}
|
|
|
14809
14907
|
};
|
|
14810
14908
|
await transpileFile(inputPath);
|
|
14811
14909
|
const entryOutputPath = toOutputPath(entryPath);
|
|
14812
|
-
if (
|
|
14910
|
+
if (existsSync22(entryOutputPath)) {
|
|
14813
14911
|
const entryOutput = await fs5.readFile(entryOutputPath, "utf-8");
|
|
14814
14912
|
const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
|
|
14815
14913
|
`);
|
|
@@ -14828,24 +14926,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14828
14926
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
14829
14927
|
}
|
|
14830
14928
|
const compiledRoot = compiledParent;
|
|
14831
|
-
const indexesDir =
|
|
14929
|
+
const indexesDir = join29(compiledParent, "indexes");
|
|
14832
14930
|
await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
|
|
14833
14931
|
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve22(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
14834
14932
|
if (!hmr) {
|
|
14835
14933
|
await traceAngularPhase("aot/copy-json-resources", async () => {
|
|
14836
14934
|
const cwd = process.cwd();
|
|
14837
14935
|
const angularSrcDir = resolve22(outRoot);
|
|
14838
|
-
if (!
|
|
14936
|
+
if (!existsSync22(angularSrcDir))
|
|
14839
14937
|
return;
|
|
14840
14938
|
const jsonGlob = new Glob6("**/*.json");
|
|
14841
14939
|
for (const rel of jsonGlob.scanSync({
|
|
14842
14940
|
absolute: false,
|
|
14843
14941
|
cwd: angularSrcDir
|
|
14844
14942
|
})) {
|
|
14845
|
-
const sourcePath =
|
|
14943
|
+
const sourcePath = join29(angularSrcDir, rel);
|
|
14846
14944
|
const cwdRel = relative13(cwd, sourcePath);
|
|
14847
|
-
const targetPath =
|
|
14848
|
-
await fs5.mkdir(
|
|
14945
|
+
const targetPath = join29(compiledRoot, cwdRel);
|
|
14946
|
+
await fs5.mkdir(dirname16(targetPath), { recursive: true });
|
|
14849
14947
|
await fs5.copyFile(sourcePath, targetPath);
|
|
14850
14948
|
}
|
|
14851
14949
|
});
|
|
@@ -14861,24 +14959,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14861
14959
|
const fileBase = basename8(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
14862
14960
|
const jsName = `${fileBase}.js`;
|
|
14863
14961
|
const compiledFallbackPaths = [
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14962
|
+
join29(compiledRoot, relativeEntry),
|
|
14963
|
+
join29(compiledRoot, "pages", jsName),
|
|
14964
|
+
join29(compiledRoot, jsName)
|
|
14867
14965
|
].map((file3) => resolve22(file3));
|
|
14868
14966
|
const resolveRawServerFile = (candidatePaths) => {
|
|
14869
14967
|
const normalizedCandidates = [
|
|
14870
14968
|
...candidatePaths.map((file3) => resolve22(file3)),
|
|
14871
14969
|
...compiledFallbackPaths
|
|
14872
14970
|
];
|
|
14873
|
-
let candidate = normalizedCandidates.find((file3) =>
|
|
14971
|
+
let candidate = normalizedCandidates.find((file3) => existsSync22(file3) && file3.endsWith(`${sep3}${relativeEntry}`));
|
|
14874
14972
|
if (!candidate) {
|
|
14875
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
14973
|
+
candidate = normalizedCandidates.find((file3) => existsSync22(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
14876
14974
|
}
|
|
14877
14975
|
if (!candidate) {
|
|
14878
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
14976
|
+
candidate = normalizedCandidates.find((file3) => existsSync22(file3) && file3.endsWith(`${sep3}${jsName}`));
|
|
14879
14977
|
}
|
|
14880
14978
|
if (!candidate) {
|
|
14881
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
14979
|
+
candidate = normalizedCandidates.find((file3) => existsSync22(file3));
|
|
14882
14980
|
}
|
|
14883
14981
|
return candidate;
|
|
14884
14982
|
};
|
|
@@ -14886,11 +14984,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14886
14984
|
if (!rawServerFile) {
|
|
14887
14985
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
|
|
14888
14986
|
}
|
|
14889
|
-
if (rawServerFile && !
|
|
14987
|
+
if (rawServerFile && !existsSync22(rawServerFile)) {
|
|
14890
14988
|
outputs = hmr ? await compileEntry() : aotOutputs;
|
|
14891
14989
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
|
|
14892
14990
|
}
|
|
14893
|
-
if (!rawServerFile || !
|
|
14991
|
+
if (!rawServerFile || !existsSync22(rawServerFile)) {
|
|
14894
14992
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
14895
14993
|
...outputs,
|
|
14896
14994
|
...compiledFallbackPaths
|
|
@@ -14911,8 +15009,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14911
15009
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
14912
15010
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
14913
15011
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
14914
|
-
const clientFile =
|
|
14915
|
-
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__"))) {
|
|
14916
15014
|
return {
|
|
14917
15015
|
clientPath: clientFile,
|
|
14918
15016
|
indexUnchanged: true,
|
|
@@ -14940,8 +15038,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
14940
15038
|
const relativePath = relative13(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
14941
15039
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
14942
15040
|
const manifestKeyForProviders = toPascal(fileBase);
|
|
14943
|
-
const providersFilePath =
|
|
14944
|
-
const hasGeneratedProviders =
|
|
15041
|
+
const providersFilePath = join29(compiledParent, "providers", `${manifestKeyForProviders}.providers.ts`);
|
|
15042
|
+
const hasGeneratedProviders = existsSync22(providersFilePath);
|
|
14945
15043
|
const providersImportPath = hasGeneratedProviders ? (() => {
|
|
14946
15044
|
const rel = relative13(indexesDir, providersFilePath.replace(/\.ts$/, "")).replace(/\\/g, "/");
|
|
14947
15045
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
@@ -15147,24 +15245,24 @@ var init_compileAngular = __esm(() => {
|
|
|
15147
15245
|
init_stylePreprocessor();
|
|
15148
15246
|
init_generatedDir();
|
|
15149
15247
|
devClientDir4 = resolveDevClientDir4();
|
|
15150
|
-
hmrClientPath5 =
|
|
15248
|
+
hmrClientPath5 = join29(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
15151
15249
|
jitContentCache = new Map;
|
|
15152
15250
|
wrapperOutputCache = new Map;
|
|
15153
15251
|
});
|
|
15154
15252
|
|
|
15155
15253
|
// src/dev/angular/hmrImportGenerator.ts
|
|
15156
|
-
import
|
|
15254
|
+
import ts10 from "typescript";
|
|
15157
15255
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
15158
15256
|
addImport(request) {
|
|
15159
15257
|
const ns = namespaceMap.get(request.exportModuleSpecifier);
|
|
15160
15258
|
if (!ns) {
|
|
15161
15259
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
15162
15260
|
}
|
|
15163
|
-
const namespaceId =
|
|
15261
|
+
const namespaceId = ts10.factory.createIdentifier(ns);
|
|
15164
15262
|
if (request.exportSymbolName === null) {
|
|
15165
15263
|
return namespaceId;
|
|
15166
15264
|
}
|
|
15167
|
-
return
|
|
15265
|
+
return ts10.factory.createPropertyAccessExpression(namespaceId, ts10.factory.createIdentifier(request.exportSymbolName));
|
|
15168
15266
|
}
|
|
15169
15267
|
});
|
|
15170
15268
|
var init_hmrImportGenerator = () => {};
|
|
@@ -15537,13 +15635,13 @@ var init_translator = __esm(() => {
|
|
|
15537
15635
|
});
|
|
15538
15636
|
|
|
15539
15637
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
15540
|
-
import
|
|
15638
|
+
import ts11 from "typescript";
|
|
15541
15639
|
function tsNumericExpression(value) {
|
|
15542
15640
|
if (value < 0) {
|
|
15543
|
-
const operand =
|
|
15544
|
-
return
|
|
15641
|
+
const operand = ts11.factory.createNumericLiteral(Math.abs(value));
|
|
15642
|
+
return ts11.factory.createPrefixUnaryExpression(ts11.SyntaxKind.MinusToken, operand);
|
|
15545
15643
|
}
|
|
15546
|
-
return
|
|
15644
|
+
return ts11.factory.createNumericLiteral(value);
|
|
15547
15645
|
}
|
|
15548
15646
|
var init_ts_util = __esm(() => {
|
|
15549
15647
|
/*!
|
|
@@ -15556,142 +15654,142 @@ var init_ts_util = __esm(() => {
|
|
|
15556
15654
|
});
|
|
15557
15655
|
|
|
15558
15656
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
15559
|
-
import
|
|
15657
|
+
import ts12 from "typescript";
|
|
15560
15658
|
|
|
15561
15659
|
class TypeScriptAstFactory {
|
|
15562
15660
|
annotateForClosureCompiler;
|
|
15563
15661
|
externalSourceFiles = new Map;
|
|
15564
15662
|
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
15565
|
-
"+":
|
|
15566
|
-
"-":
|
|
15567
|
-
"!":
|
|
15663
|
+
"+": ts12.SyntaxKind.PlusToken,
|
|
15664
|
+
"-": ts12.SyntaxKind.MinusToken,
|
|
15665
|
+
"!": ts12.SyntaxKind.ExclamationToken
|
|
15568
15666
|
}))();
|
|
15569
15667
|
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
15570
|
-
"&&":
|
|
15571
|
-
">":
|
|
15572
|
-
">=":
|
|
15573
|
-
"&":
|
|
15574
|
-
"|":
|
|
15575
|
-
"/":
|
|
15576
|
-
"==":
|
|
15577
|
-
"===":
|
|
15578
|
-
"<":
|
|
15579
|
-
"<=":
|
|
15580
|
-
"-":
|
|
15581
|
-
"%":
|
|
15582
|
-
"*":
|
|
15583
|
-
"**":
|
|
15584
|
-
"!=":
|
|
15585
|
-
"!==":
|
|
15586
|
-
"||":
|
|
15587
|
-
"+":
|
|
15588
|
-
"??":
|
|
15589
|
-
"=":
|
|
15590
|
-
"+=":
|
|
15591
|
-
"-=":
|
|
15592
|
-
"*=":
|
|
15593
|
-
"/=":
|
|
15594
|
-
"%=":
|
|
15595
|
-
"**=":
|
|
15596
|
-
"&&=":
|
|
15597
|
-
"||=":
|
|
15598
|
-
"??=":
|
|
15599
|
-
in:
|
|
15600
|
-
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
|
|
15601
15699
|
}))();
|
|
15602
15700
|
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
15603
|
-
const:
|
|
15604
|
-
let:
|
|
15605
|
-
var:
|
|
15701
|
+
const: ts12.NodeFlags.Const,
|
|
15702
|
+
let: ts12.NodeFlags.Let,
|
|
15703
|
+
var: ts12.NodeFlags.None
|
|
15606
15704
|
}))();
|
|
15607
15705
|
constructor(annotateForClosureCompiler) {
|
|
15608
15706
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
15609
15707
|
}
|
|
15610
15708
|
attachComments = attachComments;
|
|
15611
|
-
createArrayLiteral =
|
|
15709
|
+
createArrayLiteral = ts12.factory.createArrayLiteralExpression;
|
|
15612
15710
|
createAssignment(target, operator, value) {
|
|
15613
|
-
return
|
|
15711
|
+
return ts12.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
15614
15712
|
}
|
|
15615
15713
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
15616
|
-
return
|
|
15714
|
+
return ts12.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
15617
15715
|
}
|
|
15618
15716
|
createBlock(body) {
|
|
15619
|
-
return
|
|
15717
|
+
return ts12.factory.createBlock(body);
|
|
15620
15718
|
}
|
|
15621
15719
|
createCallExpression(callee, args, pure) {
|
|
15622
|
-
const call =
|
|
15720
|
+
const call = ts12.factory.createCallExpression(callee, undefined, args);
|
|
15623
15721
|
if (pure) {
|
|
15624
|
-
|
|
15722
|
+
ts12.addSyntheticLeadingComment(call, ts12.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
15625
15723
|
}
|
|
15626
15724
|
return call;
|
|
15627
15725
|
}
|
|
15628
15726
|
createConditional(condition, whenTrue, whenFalse) {
|
|
15629
|
-
return
|
|
15727
|
+
return ts12.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
15630
15728
|
}
|
|
15631
|
-
createElementAccess =
|
|
15632
|
-
createExpressionStatement =
|
|
15729
|
+
createElementAccess = ts12.factory.createElementAccessExpression;
|
|
15730
|
+
createExpressionStatement = ts12.factory.createExpressionStatement;
|
|
15633
15731
|
createDynamicImport(url) {
|
|
15634
|
-
return
|
|
15635
|
-
typeof url === "string" ?
|
|
15732
|
+
return ts12.factory.createCallExpression(ts12.factory.createToken(ts12.SyntaxKind.ImportKeyword), undefined, [
|
|
15733
|
+
typeof url === "string" ? ts12.factory.createStringLiteral(url) : url
|
|
15636
15734
|
]);
|
|
15637
15735
|
}
|
|
15638
15736
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
15639
|
-
if (!
|
|
15640
|
-
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]}.`);
|
|
15641
15739
|
}
|
|
15642
|
-
return
|
|
15740
|
+
return ts12.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
15643
15741
|
}
|
|
15644
15742
|
createFunctionExpression(functionName, parameters, body) {
|
|
15645
|
-
if (!
|
|
15646
|
-
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]}.`);
|
|
15647
15745
|
}
|
|
15648
|
-
return
|
|
15746
|
+
return ts12.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
15649
15747
|
}
|
|
15650
15748
|
createArrowFunctionExpression(parameters, body) {
|
|
15651
|
-
if (
|
|
15652
|
-
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]}.`);
|
|
15653
15751
|
}
|
|
15654
|
-
return
|
|
15752
|
+
return ts12.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
15655
15753
|
}
|
|
15656
15754
|
createParameter(param) {
|
|
15657
|
-
return
|
|
15755
|
+
return ts12.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
15658
15756
|
}
|
|
15659
|
-
createIdentifier =
|
|
15757
|
+
createIdentifier = ts12.factory.createIdentifier;
|
|
15660
15758
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
15661
|
-
return
|
|
15759
|
+
return ts12.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
15662
15760
|
}
|
|
15663
15761
|
createLiteral(value) {
|
|
15664
15762
|
if (value === undefined) {
|
|
15665
|
-
return
|
|
15763
|
+
return ts12.factory.createIdentifier("undefined");
|
|
15666
15764
|
} else if (value === null) {
|
|
15667
|
-
return
|
|
15765
|
+
return ts12.factory.createNull();
|
|
15668
15766
|
} else if (typeof value === "boolean") {
|
|
15669
|
-
return value ?
|
|
15767
|
+
return value ? ts12.factory.createTrue() : ts12.factory.createFalse();
|
|
15670
15768
|
} else if (typeof value === "number") {
|
|
15671
15769
|
return tsNumericExpression(value);
|
|
15672
15770
|
} else {
|
|
15673
|
-
return
|
|
15771
|
+
return ts12.factory.createStringLiteral(value);
|
|
15674
15772
|
}
|
|
15675
15773
|
}
|
|
15676
15774
|
createNewExpression(expression, args) {
|
|
15677
|
-
return
|
|
15775
|
+
return ts12.factory.createNewExpression(expression, undefined, args);
|
|
15678
15776
|
}
|
|
15679
15777
|
createObjectLiteral(properties) {
|
|
15680
|
-
return
|
|
15778
|
+
return ts12.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
15681
15779
|
if (prop.kind === "spread") {
|
|
15682
|
-
return
|
|
15780
|
+
return ts12.factory.createSpreadAssignment(prop.expression);
|
|
15683
15781
|
}
|
|
15684
|
-
return
|
|
15782
|
+
return ts12.factory.createPropertyAssignment(prop.quoted ? ts12.factory.createStringLiteral(prop.propertyName) : ts12.factory.createIdentifier(prop.propertyName), prop.value);
|
|
15685
15783
|
}));
|
|
15686
15784
|
}
|
|
15687
|
-
createParenthesizedExpression =
|
|
15688
|
-
createPropertyAccess =
|
|
15689
|
-
createSpreadElement =
|
|
15785
|
+
createParenthesizedExpression = ts12.factory.createParenthesizedExpression;
|
|
15786
|
+
createPropertyAccess = ts12.factory.createPropertyAccessExpression;
|
|
15787
|
+
createSpreadElement = ts12.factory.createSpreadElement;
|
|
15690
15788
|
createReturnStatement(expression) {
|
|
15691
|
-
return
|
|
15789
|
+
return ts12.factory.createReturnStatement(expression ?? undefined);
|
|
15692
15790
|
}
|
|
15693
15791
|
createTaggedTemplate(tag, template) {
|
|
15694
|
-
return
|
|
15792
|
+
return ts12.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
15695
15793
|
}
|
|
15696
15794
|
createTemplateLiteral(template) {
|
|
15697
15795
|
let templateLiteral;
|
|
@@ -15701,7 +15799,7 @@ class TypeScriptAstFactory {
|
|
|
15701
15799
|
throw new Error("createTemplateLiteral: template has no elements");
|
|
15702
15800
|
}
|
|
15703
15801
|
if (length === 1) {
|
|
15704
|
-
templateLiteral =
|
|
15802
|
+
templateLiteral = ts12.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
15705
15803
|
} else {
|
|
15706
15804
|
const spans = [];
|
|
15707
15805
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -15715,7 +15813,7 @@ class TypeScriptAstFactory {
|
|
|
15715
15813
|
if (range !== null) {
|
|
15716
15814
|
this.setSourceMapRange(middle, range);
|
|
15717
15815
|
}
|
|
15718
|
-
spans.push(
|
|
15816
|
+
spans.push(ts12.factory.createTemplateSpan(expression, middle));
|
|
15719
15817
|
}
|
|
15720
15818
|
const resolvedExpression = template.expressions[length - 2];
|
|
15721
15819
|
const templatePart = template.elements[length - 1];
|
|
@@ -15726,27 +15824,27 @@ class TypeScriptAstFactory {
|
|
|
15726
15824
|
if (templatePart.range !== null) {
|
|
15727
15825
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
15728
15826
|
}
|
|
15729
|
-
spans.push(
|
|
15730
|
-
templateLiteral =
|
|
15827
|
+
spans.push(ts12.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
15828
|
+
templateLiteral = ts12.factory.createTemplateExpression(ts12.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
15731
15829
|
}
|
|
15732
15830
|
if (head.range !== null) {
|
|
15733
15831
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
15734
15832
|
}
|
|
15735
15833
|
return templateLiteral;
|
|
15736
15834
|
}
|
|
15737
|
-
createThrowStatement =
|
|
15738
|
-
createTypeOfExpression =
|
|
15739
|
-
createVoidExpression =
|
|
15835
|
+
createThrowStatement = ts12.factory.createThrowStatement;
|
|
15836
|
+
createTypeOfExpression = ts12.factory.createTypeOfExpression;
|
|
15837
|
+
createVoidExpression = ts12.factory.createVoidExpression;
|
|
15740
15838
|
createUnaryExpression(operator, operand) {
|
|
15741
|
-
return
|
|
15839
|
+
return ts12.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
15742
15840
|
}
|
|
15743
15841
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
15744
|
-
return
|
|
15745
|
-
|
|
15842
|
+
return ts12.factory.createVariableStatement(undefined, ts12.factory.createVariableDeclarationList([
|
|
15843
|
+
ts12.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
15746
15844
|
], this.VAR_TYPES[variableType]));
|
|
15747
15845
|
}
|
|
15748
15846
|
createRegularExpressionLiteral(body, flags) {
|
|
15749
|
-
return
|
|
15847
|
+
return ts12.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
15750
15848
|
}
|
|
15751
15849
|
setSourceMapRange(node, sourceMapRange) {
|
|
15752
15850
|
if (sourceMapRange === null) {
|
|
@@ -15754,10 +15852,10 @@ class TypeScriptAstFactory {
|
|
|
15754
15852
|
}
|
|
15755
15853
|
const url = sourceMapRange.url;
|
|
15756
15854
|
if (!this.externalSourceFiles.has(url)) {
|
|
15757
|
-
this.externalSourceFiles.set(url,
|
|
15855
|
+
this.externalSourceFiles.set(url, ts12.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
15758
15856
|
}
|
|
15759
15857
|
const source = this.externalSourceFiles.get(url);
|
|
15760
|
-
|
|
15858
|
+
ts12.setSourceMapRange(node, {
|
|
15761
15859
|
pos: sourceMapRange.start.offset,
|
|
15762
15860
|
end: sourceMapRange.end.offset,
|
|
15763
15861
|
source
|
|
@@ -15767,77 +15865,77 @@ class TypeScriptAstFactory {
|
|
|
15767
15865
|
createBuiltInType(type) {
|
|
15768
15866
|
switch (type) {
|
|
15769
15867
|
case "any":
|
|
15770
|
-
return
|
|
15868
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.AnyKeyword);
|
|
15771
15869
|
case "boolean":
|
|
15772
|
-
return
|
|
15870
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.BooleanKeyword);
|
|
15773
15871
|
case "number":
|
|
15774
|
-
return
|
|
15872
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.NumberKeyword);
|
|
15775
15873
|
case "string":
|
|
15776
|
-
return
|
|
15874
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.StringKeyword);
|
|
15777
15875
|
case "function":
|
|
15778
|
-
return
|
|
15876
|
+
return ts12.factory.createTypeReferenceNode(ts12.factory.createIdentifier("Function"));
|
|
15779
15877
|
case "never":
|
|
15780
|
-
return
|
|
15878
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.NeverKeyword);
|
|
15781
15879
|
case "unknown":
|
|
15782
|
-
return
|
|
15880
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.UnknownKeyword);
|
|
15783
15881
|
}
|
|
15784
15882
|
}
|
|
15785
15883
|
createExpressionType(expression, typeParams) {
|
|
15786
15884
|
const typeName = getEntityTypeFromExpression(expression);
|
|
15787
|
-
return
|
|
15885
|
+
return ts12.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
15788
15886
|
}
|
|
15789
15887
|
createArrayType(elementType) {
|
|
15790
|
-
return
|
|
15888
|
+
return ts12.factory.createArrayTypeNode(elementType);
|
|
15791
15889
|
}
|
|
15792
15890
|
createMapType(valueType) {
|
|
15793
|
-
return
|
|
15794
|
-
|
|
15795
|
-
|
|
15891
|
+
return ts12.factory.createTypeLiteralNode([
|
|
15892
|
+
ts12.factory.createIndexSignature(undefined, [
|
|
15893
|
+
ts12.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.StringKeyword))
|
|
15796
15894
|
], valueType)
|
|
15797
15895
|
]);
|
|
15798
15896
|
}
|
|
15799
15897
|
transplantType(type) {
|
|
15800
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
15898
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts12.isTypeNode(type)) {
|
|
15801
15899
|
return type;
|
|
15802
15900
|
}
|
|
15803
15901
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
15804
15902
|
}
|
|
15805
15903
|
}
|
|
15806
15904
|
function createTemplateMiddle(cooked, raw) {
|
|
15807
|
-
const node =
|
|
15808
|
-
node.kind =
|
|
15905
|
+
const node = ts12.factory.createTemplateHead(cooked, raw);
|
|
15906
|
+
node.kind = ts12.SyntaxKind.TemplateMiddle;
|
|
15809
15907
|
return node;
|
|
15810
15908
|
}
|
|
15811
15909
|
function createTemplateTail(cooked, raw) {
|
|
15812
|
-
const node =
|
|
15813
|
-
node.kind =
|
|
15910
|
+
const node = ts12.factory.createTemplateHead(cooked, raw);
|
|
15911
|
+
node.kind = ts12.SyntaxKind.TemplateTail;
|
|
15814
15912
|
return node;
|
|
15815
15913
|
}
|
|
15816
15914
|
function attachComments(statement, leadingComments) {
|
|
15817
15915
|
for (const comment of leadingComments) {
|
|
15818
|
-
const commentKind = comment.multiline ?
|
|
15916
|
+
const commentKind = comment.multiline ? ts12.SyntaxKind.MultiLineCommentTrivia : ts12.SyntaxKind.SingleLineCommentTrivia;
|
|
15819
15917
|
if (comment.multiline) {
|
|
15820
|
-
|
|
15918
|
+
ts12.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
15821
15919
|
} else {
|
|
15822
15920
|
for (const line of comment.toString().split(`
|
|
15823
15921
|
`)) {
|
|
15824
|
-
|
|
15922
|
+
ts12.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
15825
15923
|
}
|
|
15826
15924
|
}
|
|
15827
15925
|
}
|
|
15828
15926
|
}
|
|
15829
15927
|
function getEntityTypeFromExpression(expression) {
|
|
15830
|
-
if (
|
|
15928
|
+
if (ts12.isIdentifier(expression)) {
|
|
15831
15929
|
return expression;
|
|
15832
15930
|
}
|
|
15833
|
-
if (
|
|
15931
|
+
if (ts12.isPropertyAccessExpression(expression)) {
|
|
15834
15932
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
15835
|
-
if (!
|
|
15933
|
+
if (!ts12.isIdentifier(expression.name)) {
|
|
15836
15934
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
15837
15935
|
}
|
|
15838
|
-
return
|
|
15936
|
+
return ts12.factory.createQualifiedName(left, expression.name);
|
|
15839
15937
|
}
|
|
15840
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
15938
|
+
throw new Error(`Unsupported expression for type reference: ${ts12.SyntaxKind[expression.kind]}`);
|
|
15841
15939
|
}
|
|
15842
15940
|
var init_typescript_ast_factory = __esm(() => {
|
|
15843
15941
|
init_ts_util();
|
|
@@ -15870,9 +15968,9 @@ __export(exports_fastHmrCompiler, {
|
|
|
15870
15968
|
primeComponentFingerprint: () => primeComponentFingerprint,
|
|
15871
15969
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
15872
15970
|
});
|
|
15873
|
-
import { existsSync as
|
|
15874
|
-
import { dirname as
|
|
15875
|
-
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";
|
|
15876
15974
|
var fail = (reason, detail, location) => ({
|
|
15877
15975
|
ok: false,
|
|
15878
15976
|
reason,
|
|
@@ -15956,23 +16054,23 @@ var fail = (reason, detail, location) => ({
|
|
|
15956
16054
|
}
|
|
15957
16055
|
let sourceFile;
|
|
15958
16056
|
try {
|
|
15959
|
-
sourceFile =
|
|
16057
|
+
sourceFile = ts13.createSourceFile(componentFilePath, source, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TS);
|
|
15960
16058
|
} catch {
|
|
15961
16059
|
return;
|
|
15962
16060
|
}
|
|
15963
16061
|
for (const stmt of sourceFile.statements) {
|
|
15964
|
-
if (!
|
|
16062
|
+
if (!ts13.isClassDeclaration(stmt))
|
|
15965
16063
|
continue;
|
|
15966
16064
|
const className = stmt.name?.text;
|
|
15967
16065
|
if (!className)
|
|
15968
16066
|
continue;
|
|
15969
|
-
const decorators =
|
|
16067
|
+
const decorators = ts13.getDecorators(stmt) ?? [];
|
|
15970
16068
|
const decoratorName = (() => {
|
|
15971
16069
|
for (const d2 of decorators) {
|
|
15972
|
-
if (!
|
|
16070
|
+
if (!ts13.isCallExpression(d2.expression))
|
|
15973
16071
|
continue;
|
|
15974
16072
|
const expr = d2.expression.expression;
|
|
15975
|
-
if (!
|
|
16073
|
+
if (!ts13.isIdentifier(expr))
|
|
15976
16074
|
continue;
|
|
15977
16075
|
if (expr.text === "Component" || expr.text === "Directive" || expr.text === "Pipe" || expr.text === "Injectable") {
|
|
15978
16076
|
return expr.text;
|
|
@@ -15986,20 +16084,20 @@ var fail = (reason, detail, location) => ({
|
|
|
15986
16084
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
15987
16085
|
if (decoratorName === "Component") {
|
|
15988
16086
|
const componentDecorator = decorators.find((d2) => {
|
|
15989
|
-
if (!
|
|
16087
|
+
if (!ts13.isCallExpression(d2.expression))
|
|
15990
16088
|
return false;
|
|
15991
16089
|
const expr = d2.expression.expression;
|
|
15992
|
-
return
|
|
16090
|
+
return ts13.isIdentifier(expr) && expr.text === "Component";
|
|
15993
16091
|
});
|
|
15994
16092
|
if (!componentDecorator)
|
|
15995
16093
|
continue;
|
|
15996
16094
|
const decoratorCall = componentDecorator.expression;
|
|
15997
16095
|
const args = decoratorCall.arguments[0];
|
|
15998
|
-
if (!args || !
|
|
16096
|
+
if (!args || !ts13.isObjectLiteralExpression(args))
|
|
15999
16097
|
continue;
|
|
16000
16098
|
const decoratorMeta = readDecoratorMeta(args);
|
|
16001
16099
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
16002
|
-
const componentDir =
|
|
16100
|
+
const componentDir = dirname17(componentFilePath);
|
|
16003
16101
|
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
16004
16102
|
fingerprintCache.set(id, fingerprint);
|
|
16005
16103
|
} else {
|
|
@@ -16029,11 +16127,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16029
16127
|
return false;
|
|
16030
16128
|
return true;
|
|
16031
16129
|
}, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
|
|
16032
|
-
for (const dec of
|
|
16130
|
+
for (const dec of ts13.getDecorators(cls) ?? []) {
|
|
16033
16131
|
const expr = dec.expression;
|
|
16034
|
-
if (!
|
|
16132
|
+
if (!ts13.isCallExpression(expr))
|
|
16035
16133
|
continue;
|
|
16036
|
-
if (!
|
|
16134
|
+
if (!ts13.isIdentifier(expr.expression))
|
|
16037
16135
|
continue;
|
|
16038
16136
|
if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
|
|
16039
16137
|
return dec;
|
|
@@ -16051,18 +16149,18 @@ var fail = (reason, detail, location) => ({
|
|
|
16051
16149
|
}
|
|
16052
16150
|
const ctorParamTypes = [];
|
|
16053
16151
|
for (const member of cls.members) {
|
|
16054
|
-
if (!
|
|
16152
|
+
if (!ts13.isConstructorDeclaration(member))
|
|
16055
16153
|
continue;
|
|
16056
16154
|
for (const param of member.parameters) {
|
|
16057
16155
|
const typeText = param.type ? param.type.getText() : "";
|
|
16058
|
-
const decorators =
|
|
16156
|
+
const decorators = ts13.getDecorators(param) ?? [];
|
|
16059
16157
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
16060
16158
|
const e = d2.expression;
|
|
16061
|
-
if (
|
|
16159
|
+
if (ts13.isCallExpression(e) && ts13.isIdentifier(e.expression)) {
|
|
16062
16160
|
const args = e.arguments.map((a) => a.getText()).join(",");
|
|
16063
16161
|
return `@${e.expression.text}(${args})`;
|
|
16064
16162
|
}
|
|
16065
|
-
if (
|
|
16163
|
+
if (ts13.isIdentifier(e))
|
|
16066
16164
|
return `@${e.text}`;
|
|
16067
16165
|
return "@<unknown>";
|
|
16068
16166
|
}).join("");
|
|
@@ -16084,23 +16182,23 @@ var fail = (reason, detail, location) => ({
|
|
|
16084
16182
|
const walk = (node) => {
|
|
16085
16183
|
if (found)
|
|
16086
16184
|
return;
|
|
16087
|
-
if (
|
|
16185
|
+
if (ts13.isClassDeclaration(node) && node.name?.text === className) {
|
|
16088
16186
|
found = node;
|
|
16089
16187
|
return;
|
|
16090
16188
|
}
|
|
16091
|
-
|
|
16189
|
+
ts13.forEachChild(node, walk);
|
|
16092
16190
|
};
|
|
16093
16191
|
walk(sourceFile);
|
|
16094
16192
|
return found;
|
|
16095
16193
|
}, getClassDecorators = (cls) => {
|
|
16096
|
-
const modifiers =
|
|
16194
|
+
const modifiers = ts13.getDecorators(cls) ?? [];
|
|
16097
16195
|
return [...modifiers];
|
|
16098
16196
|
}, findComponentDecorator = (cls) => {
|
|
16099
16197
|
for (const decorator of getClassDecorators(cls)) {
|
|
16100
16198
|
const expr = decorator.expression;
|
|
16101
|
-
if (
|
|
16199
|
+
if (ts13.isCallExpression(expr)) {
|
|
16102
16200
|
const fn2 = expr.expression;
|
|
16103
|
-
if (
|
|
16201
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "Component") {
|
|
16104
16202
|
return decorator;
|
|
16105
16203
|
}
|
|
16106
16204
|
}
|
|
@@ -16108,15 +16206,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16108
16206
|
return null;
|
|
16109
16207
|
}, getDecoratorArgsObject = (decorator) => {
|
|
16110
16208
|
const call = decorator.expression;
|
|
16111
|
-
if (!
|
|
16209
|
+
if (!ts13.isCallExpression(call))
|
|
16112
16210
|
return null;
|
|
16113
16211
|
const arg = call.arguments[0];
|
|
16114
|
-
if (!arg || !
|
|
16212
|
+
if (!arg || !ts13.isObjectLiteralExpression(arg))
|
|
16115
16213
|
return null;
|
|
16116
16214
|
return arg;
|
|
16117
16215
|
}, getProperty = (obj, name) => {
|
|
16118
16216
|
for (const prop of obj.properties) {
|
|
16119
|
-
if (
|
|
16217
|
+
if (ts13.isPropertyAssignment(prop) && (ts13.isIdentifier(prop.name) && prop.name.text === name || ts13.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
16120
16218
|
return prop.initializer;
|
|
16121
16219
|
}
|
|
16122
16220
|
}
|
|
@@ -16125,7 +16223,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16125
16223
|
const expr = getProperty(obj, name);
|
|
16126
16224
|
if (!expr)
|
|
16127
16225
|
return null;
|
|
16128
|
-
if (
|
|
16226
|
+
if (ts13.isStringLiteral(expr) || ts13.isNoSubstitutionTemplateLiteral(expr)) {
|
|
16129
16227
|
return expr.text;
|
|
16130
16228
|
}
|
|
16131
16229
|
return null;
|
|
@@ -16133,22 +16231,22 @@ var fail = (reason, detail, location) => ({
|
|
|
16133
16231
|
const expr = getProperty(obj, name);
|
|
16134
16232
|
if (!expr)
|
|
16135
16233
|
return null;
|
|
16136
|
-
if (expr.kind ===
|
|
16234
|
+
if (expr.kind === ts13.SyntaxKind.TrueKeyword)
|
|
16137
16235
|
return true;
|
|
16138
|
-
if (expr.kind ===
|
|
16236
|
+
if (expr.kind === ts13.SyntaxKind.FalseKeyword)
|
|
16139
16237
|
return false;
|
|
16140
16238
|
return null;
|
|
16141
16239
|
}, isAngularDecoratorIdentifier = (name) => name === "Component" || name === "Directive" || name === "Pipe" || name === "Injectable", classHasAngularDecorator = (cls) => {
|
|
16142
|
-
for (const dec of
|
|
16240
|
+
for (const dec of ts13.getDecorators(cls) ?? []) {
|
|
16143
16241
|
const expr = dec.expression;
|
|
16144
|
-
if (
|
|
16242
|
+
if (ts13.isCallExpression(expr) && ts13.isIdentifier(expr.expression) && isAngularDecoratorIdentifier(expr.expression.text)) {
|
|
16145
16243
|
return true;
|
|
16146
16244
|
}
|
|
16147
16245
|
}
|
|
16148
16246
|
return false;
|
|
16149
16247
|
}, findClassInSourceFile = (sf, className) => {
|
|
16150
16248
|
for (const stmt of sf.statements) {
|
|
16151
|
-
if (
|
|
16249
|
+
if (ts13.isClassDeclaration(stmt) && stmt.name?.text === className) {
|
|
16152
16250
|
return stmt;
|
|
16153
16251
|
}
|
|
16154
16252
|
}
|
|
@@ -16158,15 +16256,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16158
16256
|
if (sameFile)
|
|
16159
16257
|
return classHasAngularDecorator(sameFile);
|
|
16160
16258
|
for (const stmt of sourceFile.statements) {
|
|
16161
|
-
if (!
|
|
16259
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
16162
16260
|
continue;
|
|
16163
|
-
if (!
|
|
16261
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
16164
16262
|
continue;
|
|
16165
16263
|
const clause = stmt.importClause;
|
|
16166
16264
|
if (!clause || clause.isTypeOnly)
|
|
16167
16265
|
continue;
|
|
16168
16266
|
const named = clause.namedBindings;
|
|
16169
|
-
if (!named || !
|
|
16267
|
+
if (!named || !ts13.isNamedImports(named))
|
|
16170
16268
|
continue;
|
|
16171
16269
|
const found = named.elements.find((el) => el.name.text === parentClassName);
|
|
16172
16270
|
if (!found)
|
|
@@ -16183,15 +16281,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16183
16281
|
`${base}/index.tsx`
|
|
16184
16282
|
];
|
|
16185
16283
|
for (const candidate of candidates) {
|
|
16186
|
-
if (!
|
|
16284
|
+
if (!existsSync23(candidate))
|
|
16187
16285
|
continue;
|
|
16188
16286
|
let content;
|
|
16189
16287
|
try {
|
|
16190
|
-
content =
|
|
16288
|
+
content = readFileSync17(candidate, "utf-8");
|
|
16191
16289
|
} catch {
|
|
16192
16290
|
continue;
|
|
16193
16291
|
}
|
|
16194
|
-
const parentSf =
|
|
16292
|
+
const parentSf = ts13.createSourceFile(candidate, content, ts13.ScriptTarget.Latest, true);
|
|
16195
16293
|
const parentCls = findClassInSourceFile(parentSf, parentClassName);
|
|
16196
16294
|
if (!parentCls)
|
|
16197
16295
|
continue;
|
|
@@ -16203,11 +16301,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16203
16301
|
}, inheritsDecoratedClass = (cls, sourceFile, componentDir, projectRoot) => {
|
|
16204
16302
|
const heritage = cls.heritageClauses ?? [];
|
|
16205
16303
|
for (const clause of heritage) {
|
|
16206
|
-
if (clause.token !==
|
|
16304
|
+
if (clause.token !== ts13.SyntaxKind.ExtendsKeyword)
|
|
16207
16305
|
continue;
|
|
16208
16306
|
for (const typeNode of clause.types) {
|
|
16209
16307
|
const expr = typeNode.expression;
|
|
16210
|
-
if (!
|
|
16308
|
+
if (!ts13.isIdentifier(expr)) {
|
|
16211
16309
|
return true;
|
|
16212
16310
|
}
|
|
16213
16311
|
if (parentHasAngularDecoratorAcrossFiles(expr.text, sourceFile, componentDir, projectRoot)) {
|
|
@@ -16218,18 +16316,18 @@ var fail = (reason, detail, location) => ({
|
|
|
16218
16316
|
return false;
|
|
16219
16317
|
}, CONTROL_CREATE_METHOD_NAME = "\u0275ngControlCreate", extractControlCreate = (cls) => {
|
|
16220
16318
|
for (const member of cls.members) {
|
|
16221
|
-
if (!
|
|
16319
|
+
if (!ts13.isMethodDeclaration(member))
|
|
16222
16320
|
continue;
|
|
16223
|
-
if (member.modifiers?.some((m) => m.kind ===
|
|
16321
|
+
if (member.modifiers?.some((m) => m.kind === ts13.SyntaxKind.StaticKeyword))
|
|
16224
16322
|
continue;
|
|
16225
16323
|
const name = member.name;
|
|
16226
16324
|
if (name === undefined)
|
|
16227
16325
|
continue;
|
|
16228
|
-
const nameText =
|
|
16326
|
+
const nameText = ts13.isIdentifier(name) ? name.text : name.getText();
|
|
16229
16327
|
if (nameText !== CONTROL_CREATE_METHOD_NAME)
|
|
16230
16328
|
continue;
|
|
16231
16329
|
const firstParam = member.parameters[0];
|
|
16232
|
-
if (firstParam === undefined || firstParam.type === undefined || !
|
|
16330
|
+
if (firstParam === undefined || firstParam.type === undefined || !ts13.isTypeReferenceNode(firstParam.type)) {
|
|
16233
16331
|
return { passThroughInput: null };
|
|
16234
16332
|
}
|
|
16235
16333
|
const typeArgs = firstParam.type.typeArguments;
|
|
@@ -16237,16 +16335,16 @@ var fail = (reason, detail, location) => ({
|
|
|
16237
16335
|
return { passThroughInput: null };
|
|
16238
16336
|
}
|
|
16239
16337
|
const arg = typeArgs[0];
|
|
16240
|
-
if (arg === undefined || !
|
|
16338
|
+
if (arg === undefined || !ts13.isLiteralTypeNode(arg) || !ts13.isStringLiteral(arg.literal)) {
|
|
16241
16339
|
return { passThroughInput: null };
|
|
16242
16340
|
}
|
|
16243
16341
|
return { passThroughInput: arg.literal.text };
|
|
16244
16342
|
}
|
|
16245
16343
|
return null;
|
|
16246
16344
|
}, resolveEnumPropertyAccess = (expr, enumName, values) => {
|
|
16247
|
-
if (!
|
|
16345
|
+
if (!ts13.isPropertyAccessExpression(expr))
|
|
16248
16346
|
return null;
|
|
16249
|
-
if (!
|
|
16347
|
+
if (!ts13.isIdentifier(expr.expression))
|
|
16250
16348
|
return null;
|
|
16251
16349
|
if (expr.expression.text !== enumName)
|
|
16252
16350
|
return null;
|
|
@@ -16265,21 +16363,21 @@ var fail = (reason, detail, location) => ({
|
|
|
16265
16363
|
const hostExpr = getProperty(args, "host");
|
|
16266
16364
|
const schemasExpr = getProperty(args, "schemas");
|
|
16267
16365
|
const styleUrls = [];
|
|
16268
|
-
if (styleUrlsExpr &&
|
|
16366
|
+
if (styleUrlsExpr && ts13.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
16269
16367
|
for (const el of styleUrlsExpr.elements) {
|
|
16270
|
-
if (
|
|
16368
|
+
if (ts13.isStringLiteral(el))
|
|
16271
16369
|
styleUrls.push(el.text);
|
|
16272
16370
|
}
|
|
16273
16371
|
}
|
|
16274
16372
|
const styles = [];
|
|
16275
16373
|
if (stylesExpr) {
|
|
16276
|
-
if (
|
|
16374
|
+
if (ts13.isArrayLiteralExpression(stylesExpr)) {
|
|
16277
16375
|
for (const el of stylesExpr.elements) {
|
|
16278
|
-
if (
|
|
16376
|
+
if (ts13.isStringLiteral(el) || ts13.isNoSubstitutionTemplateLiteral(el)) {
|
|
16279
16377
|
styles.push(el.text);
|
|
16280
16378
|
}
|
|
16281
16379
|
}
|
|
16282
|
-
} else if (
|
|
16380
|
+
} else if (ts13.isStringLiteral(stylesExpr) || ts13.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
16283
16381
|
styles.push(stylesExpr.text);
|
|
16284
16382
|
}
|
|
16285
16383
|
}
|
|
@@ -16292,15 +16390,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16292
16390
|
encapsulation,
|
|
16293
16391
|
hasProviders: getProperty(args, "providers") !== null,
|
|
16294
16392
|
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
16295
|
-
importsExpr: importsExpr &&
|
|
16296
|
-
hostDirectivesExpr: hostDirectivesExpr &&
|
|
16297
|
-
animationsExpr: animationsExpr &&
|
|
16298
|
-
providersExpr: providersExpr &&
|
|
16299
|
-
viewProvidersExpr: viewProvidersExpr &&
|
|
16300
|
-
inputsArrayExpr: inputsArrayExpr &&
|
|
16301
|
-
outputsArrayExpr: outputsArrayExpr &&
|
|
16302
|
-
hostExpr: hostExpr &&
|
|
16303
|
-
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,
|
|
16304
16402
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
16305
16403
|
selector: getStringProperty(args, "selector"),
|
|
16306
16404
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
@@ -16311,13 +16409,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16311
16409
|
templateUrl: getStringProperty(args, "templateUrl")
|
|
16312
16410
|
};
|
|
16313
16411
|
}, extractDecoratorInput = (prop, compiler) => {
|
|
16314
|
-
const decorators =
|
|
16412
|
+
const decorators = ts13.getDecorators(prop) ?? [];
|
|
16315
16413
|
for (const decorator of decorators) {
|
|
16316
16414
|
const expr = decorator.expression;
|
|
16317
|
-
if (!
|
|
16415
|
+
if (!ts13.isCallExpression(expr))
|
|
16318
16416
|
continue;
|
|
16319
16417
|
const fn2 = expr.expression;
|
|
16320
|
-
if (!
|
|
16418
|
+
if (!ts13.isIdentifier(fn2) || fn2.text !== "Input")
|
|
16321
16419
|
continue;
|
|
16322
16420
|
const classPropertyName = prop.name.getText();
|
|
16323
16421
|
let bindingPropertyName = classPropertyName;
|
|
@@ -16325,9 +16423,9 @@ var fail = (reason, detail, location) => ({
|
|
|
16325
16423
|
let transformFunction = null;
|
|
16326
16424
|
const arg = expr.arguments[0];
|
|
16327
16425
|
if (arg) {
|
|
16328
|
-
if (
|
|
16426
|
+
if (ts13.isStringLiteral(arg)) {
|
|
16329
16427
|
bindingPropertyName = arg.text;
|
|
16330
|
-
} else if (
|
|
16428
|
+
} else if (ts13.isObjectLiteralExpression(arg)) {
|
|
16331
16429
|
const aliasNode = getStringProperty(arg, "alias");
|
|
16332
16430
|
if (aliasNode !== null)
|
|
16333
16431
|
bindingPropertyName = aliasNode;
|
|
@@ -16351,11 +16449,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16351
16449
|
}
|
|
16352
16450
|
return null;
|
|
16353
16451
|
}, isInputSignalCall = (init) => {
|
|
16354
|
-
if (
|
|
16452
|
+
if (ts13.isCallExpression(init)) {
|
|
16355
16453
|
const fn2 = init.expression;
|
|
16356
|
-
if (
|
|
16454
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "input")
|
|
16357
16455
|
return true;
|
|
16358
|
-
if (
|
|
16456
|
+
if (ts13.isPropertyAccessExpression(fn2) && ts13.isIdentifier(fn2.expression) && fn2.expression.text === "input") {
|
|
16359
16457
|
return true;
|
|
16360
16458
|
}
|
|
16361
16459
|
}
|
|
@@ -16366,13 +16464,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16366
16464
|
const classPropertyName = prop.name.getText();
|
|
16367
16465
|
const call = prop.initializer;
|
|
16368
16466
|
let required = false;
|
|
16369
|
-
if (
|
|
16467
|
+
if (ts13.isPropertyAccessExpression(call.expression) && ts13.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
16370
16468
|
required = true;
|
|
16371
16469
|
}
|
|
16372
16470
|
let bindingPropertyName = classPropertyName;
|
|
16373
16471
|
let transformFunction = null;
|
|
16374
16472
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
16375
|
-
if (optsArg &&
|
|
16473
|
+
if (optsArg && ts13.isObjectLiteralExpression(optsArg)) {
|
|
16376
16474
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
16377
16475
|
if (aliasNode !== null)
|
|
16378
16476
|
bindingPropertyName = aliasNode;
|
|
@@ -16392,28 +16490,28 @@ var fail = (reason, detail, location) => ({
|
|
|
16392
16490
|
}
|
|
16393
16491
|
};
|
|
16394
16492
|
}, extractDecoratorOutput = (prop) => {
|
|
16395
|
-
const decorators =
|
|
16493
|
+
const decorators = ts13.getDecorators(prop) ?? [];
|
|
16396
16494
|
for (const decorator of decorators) {
|
|
16397
16495
|
const expr = decorator.expression;
|
|
16398
|
-
if (!
|
|
16496
|
+
if (!ts13.isCallExpression(expr))
|
|
16399
16497
|
continue;
|
|
16400
16498
|
const fn2 = expr.expression;
|
|
16401
|
-
if (!
|
|
16499
|
+
if (!ts13.isIdentifier(fn2) || fn2.text !== "Output")
|
|
16402
16500
|
continue;
|
|
16403
16501
|
const classPropertyName = prop.name.getText();
|
|
16404
16502
|
let bindingName = classPropertyName;
|
|
16405
16503
|
const arg = expr.arguments[0];
|
|
16406
|
-
if (arg &&
|
|
16504
|
+
if (arg && ts13.isStringLiteral(arg))
|
|
16407
16505
|
bindingName = arg.text;
|
|
16408
16506
|
return { classPropertyName, bindingName };
|
|
16409
16507
|
}
|
|
16410
16508
|
return null;
|
|
16411
16509
|
}, isOutputSignalCall = (init) => {
|
|
16412
|
-
if (
|
|
16510
|
+
if (ts13.isCallExpression(init)) {
|
|
16413
16511
|
const fn2 = init.expression;
|
|
16414
|
-
if (
|
|
16512
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "output")
|
|
16415
16513
|
return true;
|
|
16416
|
-
if (
|
|
16514
|
+
if (ts13.isPropertyAccessExpression(fn2) && ts13.isIdentifier(fn2.expression) && fn2.expression.text === "output") {
|
|
16417
16515
|
return true;
|
|
16418
16516
|
}
|
|
16419
16517
|
}
|
|
@@ -16425,7 +16523,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16425
16523
|
const call = prop.initializer;
|
|
16426
16524
|
let bindingName = classPropertyName;
|
|
16427
16525
|
const optsArg = call.arguments[0];
|
|
16428
|
-
if (optsArg &&
|
|
16526
|
+
if (optsArg && ts13.isObjectLiteralExpression(optsArg)) {
|
|
16429
16527
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
16430
16528
|
if (aliasNode !== null)
|
|
16431
16529
|
bindingName = aliasNode;
|
|
@@ -16437,7 +16535,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16437
16535
|
let hasDecoratorIO = false;
|
|
16438
16536
|
let hasSignalIO = false;
|
|
16439
16537
|
for (const member of cls.members) {
|
|
16440
|
-
if (!
|
|
16538
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
16441
16539
|
continue;
|
|
16442
16540
|
const decoratorIn = extractDecoratorInput(member, compiler);
|
|
16443
16541
|
if (decoratorIn) {
|
|
@@ -16471,21 +16569,21 @@ var fail = (reason, detail, location) => ({
|
|
|
16471
16569
|
specialAttributes: {}
|
|
16472
16570
|
}), parseHostObjectInto = (host, args, hostExprNode, compiler) => {
|
|
16473
16571
|
const hostNode = getProperty(args, "host");
|
|
16474
|
-
if (!hostNode || !
|
|
16572
|
+
if (!hostNode || !ts13.isObjectLiteralExpression(hostNode)) {
|
|
16475
16573
|
if (!hostExprNode)
|
|
16476
16574
|
return;
|
|
16477
16575
|
}
|
|
16478
|
-
const obj = hostNode &&
|
|
16576
|
+
const obj = hostNode && ts13.isObjectLiteralExpression(hostNode) ? hostNode : hostExprNode;
|
|
16479
16577
|
if (!obj)
|
|
16480
16578
|
return;
|
|
16481
16579
|
for (const prop of obj.properties) {
|
|
16482
|
-
if (!
|
|
16580
|
+
if (!ts13.isPropertyAssignment(prop))
|
|
16483
16581
|
continue;
|
|
16484
16582
|
const keyNode = prop.name;
|
|
16485
16583
|
let key;
|
|
16486
|
-
if (
|
|
16584
|
+
if (ts13.isStringLiteral(keyNode) || ts13.isNoSubstitutionTemplateLiteral(keyNode)) {
|
|
16487
16585
|
key = keyNode.text;
|
|
16488
|
-
} else if (
|
|
16586
|
+
} else if (ts13.isIdentifier(keyNode)) {
|
|
16489
16587
|
key = keyNode.text;
|
|
16490
16588
|
} else {
|
|
16491
16589
|
continue;
|
|
@@ -16502,36 +16600,36 @@ var fail = (reason, detail, location) => ({
|
|
|
16502
16600
|
}
|
|
16503
16601
|
}, mergeMemberHostDecorators = (host, cls) => {
|
|
16504
16602
|
for (const member of cls.members) {
|
|
16505
|
-
if (!
|
|
16603
|
+
if (!ts13.canHaveDecorators(member))
|
|
16506
16604
|
continue;
|
|
16507
|
-
const decorators =
|
|
16605
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
16508
16606
|
for (const dec of decorators) {
|
|
16509
16607
|
const expr = dec.expression;
|
|
16510
|
-
if (!
|
|
16608
|
+
if (!ts13.isCallExpression(expr))
|
|
16511
16609
|
continue;
|
|
16512
16610
|
const fn2 = expr.expression;
|
|
16513
|
-
if (!
|
|
16611
|
+
if (!ts13.isIdentifier(fn2))
|
|
16514
16612
|
continue;
|
|
16515
16613
|
if (fn2.text === "HostBinding") {
|
|
16516
|
-
if (!
|
|
16614
|
+
if (!ts13.isPropertyDeclaration(member) && !ts13.isGetAccessor(member))
|
|
16517
16615
|
continue;
|
|
16518
16616
|
const propertyName = member.name.text;
|
|
16519
16617
|
const target = expr.arguments[0];
|
|
16520
|
-
const key = target &&
|
|
16618
|
+
const key = target && ts13.isStringLiteral(target) ? target.text : propertyName;
|
|
16521
16619
|
host.properties[key] = propertyName;
|
|
16522
16620
|
} else if (fn2.text === "HostListener") {
|
|
16523
|
-
if (!
|
|
16621
|
+
if (!ts13.isMethodDeclaration(member))
|
|
16524
16622
|
continue;
|
|
16525
16623
|
const methodName = member.name.text;
|
|
16526
16624
|
const eventArg = expr.arguments[0];
|
|
16527
|
-
if (!eventArg || !
|
|
16625
|
+
if (!eventArg || !ts13.isStringLiteral(eventArg))
|
|
16528
16626
|
continue;
|
|
16529
16627
|
const event = eventArg.text;
|
|
16530
16628
|
const argsArg = expr.arguments[1];
|
|
16531
16629
|
let argsList = [];
|
|
16532
|
-
if (argsArg &&
|
|
16630
|
+
if (argsArg && ts13.isArrayLiteralExpression(argsArg)) {
|
|
16533
16631
|
for (const el of argsArg.elements) {
|
|
16534
|
-
if (
|
|
16632
|
+
if (ts13.isStringLiteral(el))
|
|
16535
16633
|
argsList.push(el.text);
|
|
16536
16634
|
}
|
|
16537
16635
|
}
|
|
@@ -16544,14 +16642,14 @@ var fail = (reason, detail, location) => ({
|
|
|
16544
16642
|
let descendants = true;
|
|
16545
16643
|
let emitDistinctChangesOnly = true;
|
|
16546
16644
|
const opts = args[1];
|
|
16547
|
-
if (opts &&
|
|
16645
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16548
16646
|
static_ = getBooleanProperty(opts, "static") ?? false;
|
|
16549
16647
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
16550
16648
|
emitDistinctChangesOnly = getBooleanProperty(opts, "emitDistinctChangesOnly") ?? true;
|
|
16551
16649
|
}
|
|
16552
16650
|
return { static_, descendants, emitDistinctChangesOnly };
|
|
16553
16651
|
}, queryPredicateFromArg = (arg, compiler) => {
|
|
16554
|
-
if (
|
|
16652
|
+
if (ts13.isStringLiteral(arg)) {
|
|
16555
16653
|
return arg.text.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
16556
16654
|
}
|
|
16557
16655
|
return {
|
|
@@ -16562,15 +16660,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16562
16660
|
const contentQueries = [];
|
|
16563
16661
|
const viewQueries = [];
|
|
16564
16662
|
for (const member of cls.members) {
|
|
16565
|
-
if (!
|
|
16663
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
16566
16664
|
continue;
|
|
16567
|
-
const decorators =
|
|
16665
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
16568
16666
|
for (const dec of decorators) {
|
|
16569
16667
|
const expr = dec.expression;
|
|
16570
|
-
if (!
|
|
16668
|
+
if (!ts13.isCallExpression(expr))
|
|
16571
16669
|
continue;
|
|
16572
16670
|
const fn2 = expr.expression;
|
|
16573
|
-
if (!
|
|
16671
|
+
if (!ts13.isIdentifier(fn2) || !QUERY_DECORATORS.has(fn2.text))
|
|
16574
16672
|
continue;
|
|
16575
16673
|
const propertyName = member.name.text;
|
|
16576
16674
|
const tokenArg = expr.arguments[0];
|
|
@@ -16582,7 +16680,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16582
16680
|
const { static_, descendants, emitDistinctChangesOnly } = parseQueryDecoratorOptions(expr.arguments);
|
|
16583
16681
|
const opts = expr.arguments[1];
|
|
16584
16682
|
let read = null;
|
|
16585
|
-
if (opts &&
|
|
16683
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16586
16684
|
const readNode = getProperty(opts, "read");
|
|
16587
16685
|
if (readNode) {
|
|
16588
16686
|
read = new compiler.WrappedNodeExpr(readNode);
|
|
@@ -16610,15 +16708,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16610
16708
|
const contentQueries = [];
|
|
16611
16709
|
const viewQueries = [];
|
|
16612
16710
|
for (const member of cls.members) {
|
|
16613
|
-
if (!
|
|
16711
|
+
if (!ts13.isPropertyDeclaration(member) || !member.initializer)
|
|
16614
16712
|
continue;
|
|
16615
16713
|
let init = member.initializer;
|
|
16616
|
-
if (!
|
|
16714
|
+
if (!ts13.isCallExpression(init))
|
|
16617
16715
|
continue;
|
|
16618
16716
|
let queryName;
|
|
16619
|
-
if (
|
|
16717
|
+
if (ts13.isIdentifier(init.expression)) {
|
|
16620
16718
|
queryName = init.expression.text;
|
|
16621
|
-
} else if (
|
|
16719
|
+
} else if (ts13.isPropertyAccessExpression(init.expression) && ts13.isIdentifier(init.expression.expression) && init.expression.name.text === "required") {
|
|
16622
16720
|
queryName = init.expression.expression.text;
|
|
16623
16721
|
} else {
|
|
16624
16722
|
continue;
|
|
@@ -16636,7 +16734,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16636
16734
|
let descendants = true;
|
|
16637
16735
|
let read = null;
|
|
16638
16736
|
const opts = init.arguments[1];
|
|
16639
|
-
if (opts &&
|
|
16737
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16640
16738
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
16641
16739
|
const readNode = getProperty(opts, "read");
|
|
16642
16740
|
if (readNode)
|
|
@@ -16662,13 +16760,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16662
16760
|
const node = getProperty(args, "exportAs");
|
|
16663
16761
|
if (!node)
|
|
16664
16762
|
return null;
|
|
16665
|
-
if (
|
|
16763
|
+
if (ts13.isStringLiteral(node)) {
|
|
16666
16764
|
return node.text.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
16667
16765
|
}
|
|
16668
|
-
if (
|
|
16766
|
+
if (ts13.isArrayLiteralExpression(node)) {
|
|
16669
16767
|
const out = [];
|
|
16670
16768
|
for (const el of node.elements) {
|
|
16671
|
-
if (
|
|
16769
|
+
if (ts13.isStringLiteral(el))
|
|
16672
16770
|
out.push(el.text);
|
|
16673
16771
|
}
|
|
16674
16772
|
return out.length > 0 ? out : null;
|
|
@@ -16676,11 +16774,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16676
16774
|
return null;
|
|
16677
16775
|
}, extractHostDirectives = (args, compiler) => {
|
|
16678
16776
|
const node = getProperty(args, "hostDirectives");
|
|
16679
|
-
if (!node || !
|
|
16777
|
+
if (!node || !ts13.isArrayLiteralExpression(node))
|
|
16680
16778
|
return null;
|
|
16681
16779
|
const out = [];
|
|
16682
16780
|
for (const el of node.elements) {
|
|
16683
|
-
if (
|
|
16781
|
+
if (ts13.isIdentifier(el)) {
|
|
16684
16782
|
out.push({
|
|
16685
16783
|
directive: {
|
|
16686
16784
|
value: new compiler.WrappedNodeExpr(el),
|
|
@@ -16692,7 +16790,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16692
16790
|
});
|
|
16693
16791
|
continue;
|
|
16694
16792
|
}
|
|
16695
|
-
if (!
|
|
16793
|
+
if (!ts13.isObjectLiteralExpression(el))
|
|
16696
16794
|
continue;
|
|
16697
16795
|
const directiveNode = getProperty(el, "directive");
|
|
16698
16796
|
if (!directiveNode)
|
|
@@ -16700,11 +16798,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16700
16798
|
const inputsNode = getProperty(el, "inputs");
|
|
16701
16799
|
const outputsNode = getProperty(el, "outputs");
|
|
16702
16800
|
const collectMap = (n) => {
|
|
16703
|
-
if (!n || !
|
|
16801
|
+
if (!n || !ts13.isArrayLiteralExpression(n))
|
|
16704
16802
|
return null;
|
|
16705
16803
|
const map = {};
|
|
16706
16804
|
for (const item of n.elements) {
|
|
16707
|
-
if (!
|
|
16805
|
+
if (!ts13.isStringLiteral(item))
|
|
16708
16806
|
continue;
|
|
16709
16807
|
const [name, alias] = item.text.split(":").map((s2) => s2.trim());
|
|
16710
16808
|
if (name)
|
|
@@ -16766,7 +16864,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16766
16864
|
return cached.info;
|
|
16767
16865
|
let source;
|
|
16768
16866
|
try {
|
|
16769
|
-
source =
|
|
16867
|
+
source = readFileSync17(filePath, "utf-8");
|
|
16770
16868
|
} catch {
|
|
16771
16869
|
childComponentInfoCache.set(cacheKey2, {
|
|
16772
16870
|
info: null,
|
|
@@ -16774,10 +16872,10 @@ var fail = (reason, detail, location) => ({
|
|
|
16774
16872
|
});
|
|
16775
16873
|
return null;
|
|
16776
16874
|
}
|
|
16777
|
-
const sf =
|
|
16875
|
+
const sf = ts13.createSourceFile(filePath, source, ts13.ScriptTarget.Latest, true);
|
|
16778
16876
|
let info = null;
|
|
16779
16877
|
for (const stmt of sf.statements) {
|
|
16780
|
-
if (!
|
|
16878
|
+
if (!ts13.isClassDeclaration(stmt))
|
|
16781
16879
|
continue;
|
|
16782
16880
|
if (!stmt.name || stmt.name.text !== className)
|
|
16783
16881
|
continue;
|
|
@@ -16820,7 +16918,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16820
16918
|
return cached.info;
|
|
16821
16919
|
let content;
|
|
16822
16920
|
try {
|
|
16823
|
-
content =
|
|
16921
|
+
content = readFileSync17(dtsPath, "utf-8");
|
|
16824
16922
|
} catch {
|
|
16825
16923
|
childComponentInfoCache.set(cacheKey2, {
|
|
16826
16924
|
info: null,
|
|
@@ -16912,9 +17010,9 @@ var fail = (reason, detail, location) => ({
|
|
|
16912
17010
|
}, buildClassToSpecMap = (sourceFile) => {
|
|
16913
17011
|
const result = new Map;
|
|
16914
17012
|
for (const stmt of sourceFile.statements) {
|
|
16915
|
-
if (!
|
|
17013
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
16916
17014
|
continue;
|
|
16917
|
-
if (!
|
|
17015
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
16918
17016
|
continue;
|
|
16919
17017
|
const spec = stmt.moduleSpecifier.text;
|
|
16920
17018
|
const clause = stmt.importClause;
|
|
@@ -16923,7 +17021,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16923
17021
|
if (clause.name)
|
|
16924
17022
|
result.set(clause.name.text, spec);
|
|
16925
17023
|
const named = clause.namedBindings;
|
|
16926
|
-
if (named &&
|
|
17024
|
+
if (named && ts13.isNamedImports(named)) {
|
|
16927
17025
|
for (const el of named.elements) {
|
|
16928
17026
|
if (el.isTypeOnly)
|
|
16929
17027
|
continue;
|
|
@@ -16936,11 +17034,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16936
17034
|
if (visited.has(startDtsPath))
|
|
16937
17035
|
return null;
|
|
16938
17036
|
visited.add(startDtsPath);
|
|
16939
|
-
if (!
|
|
17037
|
+
if (!existsSync23(startDtsPath))
|
|
16940
17038
|
return null;
|
|
16941
17039
|
let content;
|
|
16942
17040
|
try {
|
|
16943
|
-
content =
|
|
17041
|
+
content = readFileSync17(startDtsPath, "utf-8");
|
|
16944
17042
|
} catch {
|
|
16945
17043
|
return null;
|
|
16946
17044
|
}
|
|
@@ -16959,7 +17057,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16959
17057
|
});
|
|
16960
17058
|
if (!names.includes(className))
|
|
16961
17059
|
continue;
|
|
16962
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17060
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname17(startDtsPath));
|
|
16963
17061
|
if (!nextDts)
|
|
16964
17062
|
continue;
|
|
16965
17063
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -16969,7 +17067,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16969
17067
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
16970
17068
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
16971
17069
|
const fromPath = m[1] || "";
|
|
16972
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17070
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname17(startDtsPath));
|
|
16973
17071
|
if (!nextDts)
|
|
16974
17072
|
continue;
|
|
16975
17073
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -16989,16 +17087,16 @@ var fail = (reason, detail, location) => ({
|
|
|
16989
17087
|
`${base}/index.d.cts`
|
|
16990
17088
|
];
|
|
16991
17089
|
for (const c of candidates) {
|
|
16992
|
-
if (
|
|
17090
|
+
if (existsSync23(c))
|
|
16993
17091
|
return c;
|
|
16994
17092
|
}
|
|
16995
17093
|
return null;
|
|
16996
17094
|
}, findPackageDtsForJs = (jsPath) => {
|
|
16997
17095
|
const sibling = jsPath.replace(/\.[mc]?js$/, ".d.ts");
|
|
16998
|
-
if (
|
|
17096
|
+
if (existsSync23(sibling))
|
|
16999
17097
|
return sibling;
|
|
17000
17098
|
const mirror = jsPath.replace(/\/dist\//, "/dist/src/").replace(/\.[mc]?js$/, ".d.ts");
|
|
17001
|
-
if (
|
|
17099
|
+
if (existsSync23(mirror))
|
|
17002
17100
|
return mirror;
|
|
17003
17101
|
return null;
|
|
17004
17102
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
@@ -17011,7 +17109,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17011
17109
|
`${base}/index.tsx`
|
|
17012
17110
|
];
|
|
17013
17111
|
for (const candidate of candidates) {
|
|
17014
|
-
if (!
|
|
17112
|
+
if (!existsSync23(candidate))
|
|
17015
17113
|
continue;
|
|
17016
17114
|
const info = getChildComponentInfoFromTsSource(candidate, className);
|
|
17017
17115
|
if (info)
|
|
@@ -17036,7 +17134,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17036
17134
|
return result;
|
|
17037
17135
|
const classToSpec = buildClassToSpecMap(sourceFile);
|
|
17038
17136
|
for (const el of importsExpr.elements) {
|
|
17039
|
-
if (!
|
|
17137
|
+
if (!ts13.isIdentifier(el))
|
|
17040
17138
|
continue;
|
|
17041
17139
|
const className = el.text;
|
|
17042
17140
|
const spec = classToSpec.get(className);
|
|
@@ -17055,35 +17153,35 @@ var fail = (reason, detail, location) => ({
|
|
|
17055
17153
|
}
|
|
17056
17154
|
return (h2 >>> 0).toString(36);
|
|
17057
17155
|
}, initializerShapeIsStructural = (node) => {
|
|
17058
|
-
if (
|
|
17156
|
+
if (ts13.isArrowFunction(node) || ts13.isFunctionExpression(node) || ts13.isCallExpression(node) || ts13.isNewExpression(node)) {
|
|
17059
17157
|
return true;
|
|
17060
17158
|
}
|
|
17061
|
-
if (
|
|
17159
|
+
if (ts13.isConditionalExpression(node)) {
|
|
17062
17160
|
return initializerShapeIsStructural(node.whenTrue) || initializerShapeIsStructural(node.whenFalse);
|
|
17063
17161
|
}
|
|
17064
|
-
if (
|
|
17162
|
+
if (ts13.isParenthesizedExpression(node)) {
|
|
17065
17163
|
return initializerShapeIsStructural(node.expression);
|
|
17066
17164
|
}
|
|
17067
|
-
if (
|
|
17165
|
+
if (ts13.isAsExpression(node) || ts13.isTypeAssertionExpression(node)) {
|
|
17068
17166
|
return initializerShapeIsStructural(node.expression);
|
|
17069
17167
|
}
|
|
17070
|
-
if (
|
|
17168
|
+
if (ts13.isNonNullExpression(node)) {
|
|
17071
17169
|
return initializerShapeIsStructural(node.expression);
|
|
17072
17170
|
}
|
|
17073
|
-
if (
|
|
17171
|
+
if (ts13.isObjectLiteralExpression(node)) {
|
|
17074
17172
|
for (const prop of node.properties) {
|
|
17075
|
-
if (
|
|
17173
|
+
if (ts13.isPropertyAssignment(prop) && initializerShapeIsStructural(prop.initializer)) {
|
|
17076
17174
|
return true;
|
|
17077
17175
|
}
|
|
17078
|
-
if (
|
|
17176
|
+
if (ts13.isShorthandPropertyAssignment(prop))
|
|
17079
17177
|
continue;
|
|
17080
|
-
if (
|
|
17178
|
+
if (ts13.isSpreadAssignment(prop) && initializerShapeIsStructural(prop.expression)) {
|
|
17081
17179
|
return true;
|
|
17082
17180
|
}
|
|
17083
17181
|
}
|
|
17084
17182
|
return false;
|
|
17085
17183
|
}
|
|
17086
|
-
if (
|
|
17184
|
+
if (ts13.isArrayLiteralExpression(node)) {
|
|
17087
17185
|
for (const el of node.elements) {
|
|
17088
17186
|
if (initializerShapeIsStructural(el))
|
|
17089
17187
|
return true;
|
|
@@ -17094,7 +17192,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17094
17192
|
}, extractArrowFieldSig = (cls) => {
|
|
17095
17193
|
const entries = [];
|
|
17096
17194
|
for (const member of cls.members) {
|
|
17097
|
-
if (!
|
|
17195
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
17098
17196
|
continue;
|
|
17099
17197
|
const init = member.initializer;
|
|
17100
17198
|
if (!init)
|
|
@@ -17104,12 +17202,12 @@ var fail = (reason, detail, location) => ({
|
|
|
17104
17202
|
const name = member.name.getText();
|
|
17105
17203
|
let bodyText;
|
|
17106
17204
|
try {
|
|
17107
|
-
const printer =
|
|
17108
|
-
newLine:
|
|
17205
|
+
const printer = ts13.createPrinter({
|
|
17206
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17109
17207
|
omitTrailingSemicolon: true,
|
|
17110
17208
|
removeComments: true
|
|
17111
17209
|
});
|
|
17112
|
-
bodyText = printer.printNode(
|
|
17210
|
+
bodyText = printer.printNode(ts13.EmitHint.Unspecified, init, cls.getSourceFile());
|
|
17113
17211
|
} catch {
|
|
17114
17212
|
bodyText = init.getText();
|
|
17115
17213
|
}
|
|
@@ -17120,9 +17218,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17120
17218
|
}, INPUT_OUTPUT_DECORATORS, extractMemberDecoratorSig = (cls) => {
|
|
17121
17219
|
const entries = [];
|
|
17122
17220
|
for (const member of cls.members) {
|
|
17123
|
-
if (!
|
|
17221
|
+
if (!ts13.canHaveDecorators(member))
|
|
17124
17222
|
continue;
|
|
17125
|
-
const decorators =
|
|
17223
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
17126
17224
|
if (decorators.length === 0)
|
|
17127
17225
|
continue;
|
|
17128
17226
|
const memberName = member.name?.getText() ?? "<anon>";
|
|
@@ -17130,14 +17228,14 @@ var fail = (reason, detail, location) => ({
|
|
|
17130
17228
|
const expr = decorator.expression;
|
|
17131
17229
|
let decName = "<unknown>";
|
|
17132
17230
|
let argText = "";
|
|
17133
|
-
if (
|
|
17134
|
-
if (
|
|
17231
|
+
if (ts13.isCallExpression(expr)) {
|
|
17232
|
+
if (ts13.isIdentifier(expr.expression)) {
|
|
17135
17233
|
decName = expr.expression.text;
|
|
17136
17234
|
}
|
|
17137
17235
|
if (expr.arguments.length > 0) {
|
|
17138
17236
|
argText = expr.arguments.map((a) => a.getText()).join(",");
|
|
17139
17237
|
}
|
|
17140
|
-
} else if (
|
|
17238
|
+
} else if (ts13.isIdentifier(expr)) {
|
|
17141
17239
|
decName = expr.text;
|
|
17142
17240
|
}
|
|
17143
17241
|
if (INPUT_OUTPUT_DECORATORS.has(decName))
|
|
@@ -17158,22 +17256,22 @@ var fail = (reason, detail, location) => ({
|
|
|
17158
17256
|
return cached.hasProviders;
|
|
17159
17257
|
let source;
|
|
17160
17258
|
try {
|
|
17161
|
-
source =
|
|
17259
|
+
source = readFileSync17(filePath, "utf8");
|
|
17162
17260
|
} catch {
|
|
17163
17261
|
return true;
|
|
17164
17262
|
}
|
|
17165
|
-
const sf =
|
|
17263
|
+
const sf = ts13.createSourceFile(filePath, source, ts13.ScriptTarget.ES2022, true, ts13.ScriptKind.TS);
|
|
17166
17264
|
let hasProviders = false;
|
|
17167
17265
|
const visit = (node) => {
|
|
17168
17266
|
if (hasProviders)
|
|
17169
17267
|
return;
|
|
17170
|
-
if (
|
|
17171
|
-
for (const decorator of
|
|
17268
|
+
if (ts13.isClassDeclaration(node)) {
|
|
17269
|
+
for (const decorator of ts13.getDecorators(node) ?? []) {
|
|
17172
17270
|
const expr = decorator.expression;
|
|
17173
|
-
if (!
|
|
17271
|
+
if (!ts13.isCallExpression(expr))
|
|
17174
17272
|
continue;
|
|
17175
17273
|
const arg = expr.arguments[0];
|
|
17176
|
-
if (!arg || !
|
|
17274
|
+
if (!arg || !ts13.isObjectLiteralExpression(arg))
|
|
17177
17275
|
continue;
|
|
17178
17276
|
if (getProperty(arg, "providers") !== null) {
|
|
17179
17277
|
hasProviders = true;
|
|
@@ -17181,7 +17279,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17181
17279
|
}
|
|
17182
17280
|
}
|
|
17183
17281
|
}
|
|
17184
|
-
|
|
17282
|
+
ts13.forEachChild(node, visit);
|
|
17185
17283
|
};
|
|
17186
17284
|
visit(sf);
|
|
17187
17285
|
providerProbeCache.set(filePath, {
|
|
@@ -17191,10 +17289,10 @@ var fail = (reason, detail, location) => ({
|
|
|
17191
17289
|
return hasProviders;
|
|
17192
17290
|
}, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
|
|
17193
17291
|
for (const stmt of sourceFile.statements) {
|
|
17194
|
-
if (!
|
|
17292
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17195
17293
|
continue;
|
|
17196
17294
|
const moduleSpec = stmt.moduleSpecifier;
|
|
17197
|
-
if (!
|
|
17295
|
+
if (!ts13.isStringLiteral(moduleSpec))
|
|
17198
17296
|
continue;
|
|
17199
17297
|
const spec = moduleSpec.text;
|
|
17200
17298
|
if (!spec.startsWith(".") && !spec.startsWith("/"))
|
|
@@ -17208,7 +17306,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17208
17306
|
}
|
|
17209
17307
|
if (importClause.namedBindings) {
|
|
17210
17308
|
const nb = importClause.namedBindings;
|
|
17211
|
-
if (
|
|
17309
|
+
if (ts13.isNamespaceImport(nb)) {
|
|
17212
17310
|
if (nb.name.text === identifierName)
|
|
17213
17311
|
matches = true;
|
|
17214
17312
|
} else {
|
|
@@ -17225,11 +17323,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17225
17323
|
const resolved = resolve23(componentDir, spec);
|
|
17226
17324
|
for (const ext of TS_EXTENSIONS) {
|
|
17227
17325
|
const candidate = resolved + ext;
|
|
17228
|
-
if (
|
|
17326
|
+
if (existsSync23(candidate))
|
|
17229
17327
|
return candidate;
|
|
17230
17328
|
}
|
|
17231
17329
|
const indexCandidate = resolve23(resolved, "index.ts");
|
|
17232
|
-
if (
|
|
17330
|
+
if (existsSync23(indexCandidate))
|
|
17233
17331
|
return indexCandidate;
|
|
17234
17332
|
}
|
|
17235
17333
|
return null;
|
|
@@ -17238,7 +17336,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17238
17336
|
return [];
|
|
17239
17337
|
const sig = [];
|
|
17240
17338
|
for (const entry of importsExpr.elements) {
|
|
17241
|
-
if (
|
|
17339
|
+
if (ts13.isIdentifier(entry)) {
|
|
17242
17340
|
const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
|
|
17243
17341
|
if (importPath) {
|
|
17244
17342
|
if (fileHasModuleProviders(importPath)) {
|
|
@@ -17257,13 +17355,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17257
17355
|
}, extractPropertyFieldNames = (cls) => {
|
|
17258
17356
|
const names = [];
|
|
17259
17357
|
for (const member of cls.members) {
|
|
17260
|
-
if (!
|
|
17358
|
+
if (!ts13.isPropertyDeclaration(member) && !ts13.isMethodDeclaration(member) && !ts13.isGetAccessorDeclaration(member) && !ts13.isSetAccessorDeclaration(member)) {
|
|
17261
17359
|
continue;
|
|
17262
17360
|
}
|
|
17263
17361
|
const name = member.name;
|
|
17264
17362
|
if (name === undefined)
|
|
17265
17363
|
continue;
|
|
17266
|
-
const text =
|
|
17364
|
+
const text = ts13.isIdentifier(name) ? name.text : ts13.isStringLiteral(name) || ts13.isNoSubstitutionTemplateLiteral(name) ? name.text : name.getText();
|
|
17267
17365
|
if (text.length > 0)
|
|
17268
17366
|
names.push(text);
|
|
17269
17367
|
}
|
|
@@ -17271,7 +17369,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17271
17369
|
}, extractTopLevelImports = (sourceFile) => {
|
|
17272
17370
|
const names = new Set;
|
|
17273
17371
|
for (const stmt of sourceFile.statements) {
|
|
17274
|
-
if (!
|
|
17372
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17275
17373
|
continue;
|
|
17276
17374
|
const clause = stmt.importClause;
|
|
17277
17375
|
if (!clause)
|
|
@@ -17283,9 +17381,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17283
17381
|
const bindings = clause.namedBindings;
|
|
17284
17382
|
if (!bindings)
|
|
17285
17383
|
continue;
|
|
17286
|
-
if (
|
|
17384
|
+
if (ts13.isNamespaceImport(bindings)) {
|
|
17287
17385
|
names.add(bindings.name.text);
|
|
17288
|
-
} else if (
|
|
17386
|
+
} else if (ts13.isNamedImports(bindings)) {
|
|
17289
17387
|
for (const el of bindings.elements) {
|
|
17290
17388
|
if (el.isTypeOnly)
|
|
17291
17389
|
continue;
|
|
@@ -17297,18 +17395,18 @@ var fail = (reason, detail, location) => ({
|
|
|
17297
17395
|
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
|
|
17298
17396
|
const ctorParamTypes = [];
|
|
17299
17397
|
for (const member of cls.members) {
|
|
17300
|
-
if (!
|
|
17398
|
+
if (!ts13.isConstructorDeclaration(member))
|
|
17301
17399
|
continue;
|
|
17302
17400
|
for (const param of member.parameters) {
|
|
17303
17401
|
const typeText = param.type ? param.type.getText() : "";
|
|
17304
|
-
const decorators =
|
|
17402
|
+
const decorators = ts13.getDecorators(param) ?? [];
|
|
17305
17403
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
17306
17404
|
const expr = d2.expression;
|
|
17307
|
-
if (
|
|
17405
|
+
if (ts13.isCallExpression(expr) && ts13.isIdentifier(expr.expression)) {
|
|
17308
17406
|
const args = expr.arguments.map((a) => a.getText()).join(",");
|
|
17309
17407
|
return `@${expr.expression.text}(${args})`;
|
|
17310
17408
|
}
|
|
17311
|
-
if (
|
|
17409
|
+
if (ts13.isIdentifier(expr)) {
|
|
17312
17410
|
return `@${expr.text}`;
|
|
17313
17411
|
}
|
|
17314
17412
|
return "@<unknown>";
|
|
@@ -17324,12 +17422,12 @@ var fail = (reason, detail, location) => ({
|
|
|
17324
17422
|
const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
|
|
17325
17423
|
const topLevelImports = extractTopLevelImports(sourceFile);
|
|
17326
17424
|
const propertyFieldNames = extractPropertyFieldNames(cls);
|
|
17327
|
-
const printer =
|
|
17328
|
-
newLine:
|
|
17425
|
+
const printer = ts13.createPrinter({
|
|
17426
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17329
17427
|
omitTrailingSemicolon: true,
|
|
17330
17428
|
removeComments: true
|
|
17331
17429
|
});
|
|
17332
|
-
const canonicalText = (node) => printer.printNode(
|
|
17430
|
+
const canonicalText = (node) => printer.printNode(ts13.EmitHint.Unspecified, node, sourceFile);
|
|
17333
17431
|
const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
|
|
17334
17432
|
const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
|
|
17335
17433
|
const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
|
|
@@ -17342,13 +17440,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17342
17440
|
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
17343
17441
|
const pageExportEntries = [];
|
|
17344
17442
|
for (const stmt of sourceFile.statements) {
|
|
17345
|
-
if (!
|
|
17443
|
+
if (!ts13.isVariableStatement(stmt))
|
|
17346
17444
|
continue;
|
|
17347
|
-
const isExported = stmt.modifiers?.some((m) => m.kind ===
|
|
17445
|
+
const isExported = stmt.modifiers?.some((m) => m.kind === ts13.SyntaxKind.ExportKeyword);
|
|
17348
17446
|
if (!isExported)
|
|
17349
17447
|
continue;
|
|
17350
17448
|
for (const decl of stmt.declarationList.declarations) {
|
|
17351
|
-
if (!
|
|
17449
|
+
if (!ts13.isIdentifier(decl.name))
|
|
17352
17450
|
continue;
|
|
17353
17451
|
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
17354
17452
|
continue;
|
|
@@ -17389,35 +17487,35 @@ var fail = (reason, detail, location) => ({
|
|
|
17389
17487
|
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
17390
17488
|
const memberSources = [];
|
|
17391
17489
|
let hasStatic = false;
|
|
17392
|
-
const printer =
|
|
17490
|
+
const printer = ts13.createPrinter({ removeComments: true });
|
|
17393
17491
|
for (const member of classNode.members) {
|
|
17394
|
-
if (
|
|
17395
|
-
const modifiers = (
|
|
17396
|
-
const cleaned =
|
|
17397
|
-
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()));
|
|
17398
17496
|
continue;
|
|
17399
17497
|
}
|
|
17400
|
-
if (
|
|
17401
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
17402
|
-
const cleaned =
|
|
17403
|
-
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()));
|
|
17404
17502
|
continue;
|
|
17405
17503
|
}
|
|
17406
|
-
if (
|
|
17407
|
-
const modifiers =
|
|
17408
|
-
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);
|
|
17409
17507
|
if (isStatic)
|
|
17410
17508
|
hasStatic = true;
|
|
17411
|
-
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));
|
|
17412
17510
|
let cleaned;
|
|
17413
|
-
if (
|
|
17414
|
-
cleaned =
|
|
17415
|
-
} else if (
|
|
17416
|
-
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);
|
|
17417
17515
|
} else {
|
|
17418
|
-
cleaned =
|
|
17516
|
+
cleaned = ts13.factory.createSetAccessorDeclaration(modifiers, member.name, cleanedParams, member.body);
|
|
17419
17517
|
}
|
|
17420
|
-
const printed = printer.printNode(
|
|
17518
|
+
const printed = printer.printNode(ts13.EmitHint.Unspecified, cleaned, classNode.getSourceFile());
|
|
17421
17519
|
memberSources.push(printed);
|
|
17422
17520
|
}
|
|
17423
17521
|
}
|
|
@@ -17429,10 +17527,10 @@ ${memberSources.join(`
|
|
|
17429
17527
|
}`;
|
|
17430
17528
|
let transpiled;
|
|
17431
17529
|
try {
|
|
17432
|
-
transpiled =
|
|
17530
|
+
transpiled = ts13.transpileModule(wrappedSource, {
|
|
17433
17531
|
compilerOptions: {
|
|
17434
|
-
module:
|
|
17435
|
-
target:
|
|
17532
|
+
module: ts13.ModuleKind.ES2022,
|
|
17533
|
+
target: ts13.ScriptTarget.ES2022
|
|
17436
17534
|
},
|
|
17437
17535
|
reportDiagnostics: false
|
|
17438
17536
|
}).outputText;
|
|
@@ -17462,11 +17560,11 @@ ${transpiled}
|
|
|
17462
17560
|
}${staticPatch}`;
|
|
17463
17561
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
17464
17562
|
const abs = resolve23(componentDir, url);
|
|
17465
|
-
if (!
|
|
17563
|
+
if (!existsSync23(abs))
|
|
17466
17564
|
return null;
|
|
17467
17565
|
const ext = extname6(abs).toLowerCase();
|
|
17468
17566
|
if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
|
|
17469
|
-
return
|
|
17567
|
+
return readFileSync17(abs, "utf8");
|
|
17470
17568
|
}
|
|
17471
17569
|
try {
|
|
17472
17570
|
const { compileStyleFileIfNeededSync: compileStyleFileIfNeededSync2 } = (init_stylePreprocessor(), __toCommonJS(exports_stylePreprocessor));
|
|
@@ -17503,10 +17601,10 @@ ${block}
|
|
|
17503
17601
|
return cached;
|
|
17504
17602
|
const tsconfigPath = resolve23(projectRoot, "tsconfig.json");
|
|
17505
17603
|
const opts = {};
|
|
17506
|
-
if (
|
|
17604
|
+
if (existsSync23(tsconfigPath)) {
|
|
17507
17605
|
try {
|
|
17508
|
-
const text =
|
|
17509
|
-
const parsed =
|
|
17606
|
+
const text = readFileSync17(tsconfigPath, "utf8");
|
|
17607
|
+
const parsed = ts13.parseConfigFileTextToJson(tsconfigPath, text);
|
|
17510
17608
|
if (!parsed.error && parsed.config) {
|
|
17511
17609
|
const cfg = parsed.config;
|
|
17512
17610
|
const ang = cfg.angularCompilerOptions ?? {};
|
|
@@ -17530,7 +17628,7 @@ ${block}
|
|
|
17530
17628
|
}, tryFastHmr = async (params) => {
|
|
17531
17629
|
const { componentFilePath, className } = params;
|
|
17532
17630
|
const projectRoot = params.projectRoot ?? process.cwd();
|
|
17533
|
-
if (!
|
|
17631
|
+
if (!existsSync23(componentFilePath)) {
|
|
17534
17632
|
return fail("file-not-found", componentFilePath);
|
|
17535
17633
|
}
|
|
17536
17634
|
let compiler;
|
|
@@ -17539,8 +17637,8 @@ ${block}
|
|
|
17539
17637
|
} catch (err) {
|
|
17540
17638
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
17541
17639
|
}
|
|
17542
|
-
const tsSource =
|
|
17543
|
-
const sourceFile =
|
|
17640
|
+
const tsSource = readFileSync17(componentFilePath, "utf8");
|
|
17641
|
+
const sourceFile = ts13.createSourceFile(componentFilePath, tsSource, ts13.ScriptTarget.ES2022, true, ts13.ScriptKind.TS);
|
|
17544
17642
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
17545
17643
|
if (!classNode) {
|
|
17546
17644
|
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -17566,7 +17664,7 @@ ${block}
|
|
|
17566
17664
|
rebootstrapRequired: false
|
|
17567
17665
|
};
|
|
17568
17666
|
}
|
|
17569
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
17667
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname17(componentFilePath), projectRoot)) {
|
|
17570
17668
|
return fail("inherits-decorated-class");
|
|
17571
17669
|
}
|
|
17572
17670
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -17578,7 +17676,7 @@ ${block}
|
|
|
17578
17676
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
17579
17677
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
17580
17678
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
17581
|
-
const componentDir =
|
|
17679
|
+
const componentDir = dirname17(componentFilePath);
|
|
17582
17680
|
let templateText;
|
|
17583
17681
|
let templatePath;
|
|
17584
17682
|
if (decoratorMeta.template !== null) {
|
|
@@ -17586,10 +17684,10 @@ ${block}
|
|
|
17586
17684
|
templatePath = componentFilePath;
|
|
17587
17685
|
} else if (decoratorMeta.templateUrl) {
|
|
17588
17686
|
const tplAbs = resolve23(componentDir, decoratorMeta.templateUrl);
|
|
17589
|
-
if (!
|
|
17687
|
+
if (!existsSync23(tplAbs)) {
|
|
17590
17688
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
17591
17689
|
}
|
|
17592
|
-
templateText =
|
|
17690
|
+
templateText = readFileSync17(tplAbs, "utf8");
|
|
17593
17691
|
templatePath = tplAbs;
|
|
17594
17692
|
} else {
|
|
17595
17693
|
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
@@ -17660,7 +17758,7 @@ ${block}
|
|
|
17660
17758
|
viewQueries: advancedMetadata.viewQueries,
|
|
17661
17759
|
host: advancedMetadata.host,
|
|
17662
17760
|
lifecycle: {
|
|
17663
|
-
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")
|
|
17664
17762
|
},
|
|
17665
17763
|
inputs,
|
|
17666
17764
|
outputs,
|
|
@@ -17716,15 +17814,15 @@ ${block}
|
|
|
17716
17814
|
}
|
|
17717
17815
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
17718
17816
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
17719
|
-
const exportedDecl =
|
|
17720
|
-
|
|
17721
|
-
|
|
17817
|
+
const exportedDecl = ts13.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
17818
|
+
ts13.factory.createToken(ts13.SyntaxKind.ExportKeyword),
|
|
17819
|
+
ts13.factory.createToken(ts13.SyntaxKind.DefaultKeyword)
|
|
17722
17820
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
17723
|
-
const printer =
|
|
17724
|
-
newLine:
|
|
17821
|
+
const printer = ts13.createPrinter({
|
|
17822
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17725
17823
|
removeComments: false
|
|
17726
17824
|
});
|
|
17727
|
-
const fnText = printer.printNode(
|
|
17825
|
+
const fnText = printer.printNode(ts13.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
17728
17826
|
const provisionalMethodsBlock = buildFreshClassMethodsBlock(classNode, className) ?? "";
|
|
17729
17827
|
const referencedNames = new Set;
|
|
17730
17828
|
const identRe = /[A-Za-z_$][A-Za-z0-9_$]*/g;
|
|
@@ -17734,33 +17832,33 @@ ${block}
|
|
|
17734
17832
|
}
|
|
17735
17833
|
const sourceScopeNames = new Set;
|
|
17736
17834
|
for (const stmt of sourceFile.statements) {
|
|
17737
|
-
if (
|
|
17738
|
-
if (!
|
|
17835
|
+
if (ts13.isImportDeclaration(stmt)) {
|
|
17836
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
17739
17837
|
continue;
|
|
17740
17838
|
const clause = stmt.importClause;
|
|
17741
17839
|
if (clause?.name)
|
|
17742
17840
|
sourceScopeNames.add(clause.name.text);
|
|
17743
|
-
if (clause?.namedBindings &&
|
|
17841
|
+
if (clause?.namedBindings && ts13.isNamedImports(clause.namedBindings)) {
|
|
17744
17842
|
for (const el of clause.namedBindings.elements) {
|
|
17745
17843
|
if (el.isTypeOnly)
|
|
17746
17844
|
continue;
|
|
17747
17845
|
sourceScopeNames.add(el.name.text);
|
|
17748
17846
|
}
|
|
17749
|
-
} else if (clause?.namedBindings &&
|
|
17847
|
+
} else if (clause?.namedBindings && ts13.isNamespaceImport(clause.namedBindings)) {
|
|
17750
17848
|
sourceScopeNames.add(clause.namedBindings.name.text);
|
|
17751
17849
|
}
|
|
17752
17850
|
continue;
|
|
17753
17851
|
}
|
|
17754
|
-
if (
|
|
17852
|
+
if (ts13.isVariableStatement(stmt) || stmt.kind === ts13.SyntaxKind.VariableStatement) {
|
|
17755
17853
|
const varStmt = stmt;
|
|
17756
17854
|
for (const decl of varStmt.declarationList.declarations) {
|
|
17757
|
-
if (
|
|
17855
|
+
if (ts13.isIdentifier(decl.name)) {
|
|
17758
17856
|
sourceScopeNames.add(decl.name.text);
|
|
17759
17857
|
}
|
|
17760
17858
|
}
|
|
17761
17859
|
continue;
|
|
17762
17860
|
}
|
|
17763
|
-
if (
|
|
17861
|
+
if (ts13.isFunctionDeclaration(stmt) || ts13.isClassDeclaration(stmt)) {
|
|
17764
17862
|
if (stmt.name)
|
|
17765
17863
|
sourceScopeNames.add(stmt.name.text);
|
|
17766
17864
|
}
|
|
@@ -17771,7 +17869,7 @@ ${block}
|
|
|
17771
17869
|
}
|
|
17772
17870
|
const allImportedNames = new Set;
|
|
17773
17871
|
for (const stmt of sourceFile.statements) {
|
|
17774
|
-
if (!
|
|
17872
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17775
17873
|
continue;
|
|
17776
17874
|
const clause = stmt.importClause;
|
|
17777
17875
|
if (!clause || clause.isTypeOnly)
|
|
@@ -17781,7 +17879,7 @@ ${block}
|
|
|
17781
17879
|
const bindings = clause.namedBindings;
|
|
17782
17880
|
if (!bindings)
|
|
17783
17881
|
continue;
|
|
17784
|
-
if (
|
|
17882
|
+
if (ts13.isNamespaceImport(bindings)) {
|
|
17785
17883
|
allImportedNames.add(bindings.name.text);
|
|
17786
17884
|
} else {
|
|
17787
17885
|
for (const el of bindings.elements) {
|
|
@@ -17793,10 +17891,10 @@ ${block}
|
|
|
17793
17891
|
}
|
|
17794
17892
|
const depsToDestructure = [...sourceScopeNames].filter((n) => referencedNames.has(n) || allImportedNames.has(n));
|
|
17795
17893
|
const tsSourceText = fnText;
|
|
17796
|
-
const transpiled =
|
|
17894
|
+
const transpiled = ts13.transpileModule(tsSourceText, {
|
|
17797
17895
|
compilerOptions: {
|
|
17798
|
-
module:
|
|
17799
|
-
target:
|
|
17896
|
+
module: ts13.ModuleKind.ES2022,
|
|
17897
|
+
target: ts13.ScriptTarget.ES2022
|
|
17800
17898
|
},
|
|
17801
17899
|
fileName: componentFilePath,
|
|
17802
17900
|
reportDiagnostics: false
|
|
@@ -18339,16 +18437,16 @@ __export(exports_compileEmber, {
|
|
|
18339
18437
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
18340
18438
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
18341
18439
|
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
18342
|
-
dirname: () =>
|
|
18440
|
+
dirname: () => dirname18,
|
|
18343
18441
|
compileEmberFileSource: () => compileEmberFileSource,
|
|
18344
18442
|
compileEmberFile: () => compileEmberFile,
|
|
18345
18443
|
compileEmber: () => compileEmber,
|
|
18346
18444
|
clearEmberCompilerCache: () => clearEmberCompilerCache,
|
|
18347
18445
|
basename: () => basename9
|
|
18348
18446
|
});
|
|
18349
|
-
import { existsSync as
|
|
18447
|
+
import { existsSync as existsSync24 } from "fs";
|
|
18350
18448
|
import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
|
|
18351
|
-
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";
|
|
18352
18450
|
var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file3 } = globalThis.Bun;
|
|
18353
18451
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
18354
18452
|
if (cachedPreprocessor)
|
|
@@ -18444,11 +18542,11 @@ export const importSync = (specifier) => {
|
|
|
18444
18542
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
18445
18543
|
if (!originalImporter)
|
|
18446
18544
|
return;
|
|
18447
|
-
const candidateBase = resolve24(
|
|
18545
|
+
const candidateBase = resolve24(dirname18(originalImporter), args.path);
|
|
18448
18546
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
18449
18547
|
for (const ext of extensionsToTry) {
|
|
18450
18548
|
const candidate = candidateBase + ext;
|
|
18451
|
-
if (
|
|
18549
|
+
if (existsSync24(candidate))
|
|
18452
18550
|
return { path: candidate };
|
|
18453
18551
|
}
|
|
18454
18552
|
return;
|
|
@@ -18467,8 +18565,8 @@ export const importSync = (specifier) => {
|
|
|
18467
18565
|
build.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
18468
18566
|
if (standalonePackages.has(args.path))
|
|
18469
18567
|
return;
|
|
18470
|
-
const internal =
|
|
18471
|
-
if (
|
|
18568
|
+
const internal = join30(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
18569
|
+
if (existsSync24(internal))
|
|
18472
18570
|
return { path: internal };
|
|
18473
18571
|
return;
|
|
18474
18572
|
});
|
|
@@ -18515,16 +18613,16 @@ export default PageComponent;
|
|
|
18515
18613
|
}
|
|
18516
18614
|
const transpiled = transpiler5.transformSync(preprocessed);
|
|
18517
18615
|
const baseName = basename9(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
18518
|
-
const tmpDir =
|
|
18519
|
-
const serverDir =
|
|
18520
|
-
const clientDir =
|
|
18616
|
+
const tmpDir = join30(compiledRoot, "_tmp");
|
|
18617
|
+
const serverDir = join30(compiledRoot, "server");
|
|
18618
|
+
const clientDir = join30(compiledRoot, "client");
|
|
18521
18619
|
await Promise.all([
|
|
18522
18620
|
mkdir6(tmpDir, { recursive: true }),
|
|
18523
18621
|
mkdir6(serverDir, { recursive: true }),
|
|
18524
18622
|
mkdir6(clientDir, { recursive: true })
|
|
18525
18623
|
]);
|
|
18526
|
-
const tmpPagePath = resolve24(
|
|
18527
|
-
const tmpHarnessPath = resolve24(
|
|
18624
|
+
const tmpPagePath = resolve24(join30(tmpDir, `${baseName}.module.js`));
|
|
18625
|
+
const tmpHarnessPath = resolve24(join30(tmpDir, `${baseName}.harness.js`));
|
|
18528
18626
|
await Promise.all([
|
|
18529
18627
|
write4(tmpPagePath, transpiled),
|
|
18530
18628
|
write4(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -18532,7 +18630,7 @@ export default PageComponent;
|
|
|
18532
18630
|
const stagedSourceMap = new Map([
|
|
18533
18631
|
[tmpPagePath, resolvedEntry]
|
|
18534
18632
|
]);
|
|
18535
|
-
const serverPath =
|
|
18633
|
+
const serverPath = join30(serverDir, `${baseName}.js`);
|
|
18536
18634
|
const buildResult = await bunBuild2({
|
|
18537
18635
|
entrypoints: [tmpHarnessPath],
|
|
18538
18636
|
format: "esm",
|
|
@@ -18549,7 +18647,7 @@ export default PageComponent;
|
|
|
18549
18647
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
18550
18648
|
}
|
|
18551
18649
|
await rm4(tmpDir, { force: true, recursive: true });
|
|
18552
|
-
const clientPath =
|
|
18650
|
+
const clientPath = join30(clientDir, `${baseName}.js`);
|
|
18553
18651
|
await write4(clientPath, transpiled);
|
|
18554
18652
|
return { clientPath, serverPath };
|
|
18555
18653
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -18577,7 +18675,7 @@ export default PageComponent;
|
|
|
18577
18675
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
18578
18676
|
}
|
|
18579
18677
|
return transpiler5.transformSync(preprocessed);
|
|
18580
|
-
}, 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");
|
|
18581
18679
|
var init_compileEmber = __esm(() => {
|
|
18582
18680
|
init_generatedDir();
|
|
18583
18681
|
transpiler5 = new Transpiler4({
|
|
@@ -18598,8 +18696,8 @@ __export(exports_buildReactVendor, {
|
|
|
18598
18696
|
computeVendorPaths: () => computeVendorPaths,
|
|
18599
18697
|
buildReactVendor: () => buildReactVendor
|
|
18600
18698
|
});
|
|
18601
|
-
import { existsSync as
|
|
18602
|
-
import { join as
|
|
18699
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync10 } from "fs";
|
|
18700
|
+
import { join as join31, resolve as resolve25 } from "path";
|
|
18603
18701
|
import { rm as rm5 } from "fs/promises";
|
|
18604
18702
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
18605
18703
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
@@ -18612,7 +18710,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18612
18710
|
resolve25(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
18613
18711
|
];
|
|
18614
18712
|
for (const candidate of candidates) {
|
|
18615
|
-
if (
|
|
18713
|
+
if (existsSync25(candidate)) {
|
|
18616
18714
|
return candidate.replace(/\\/g, "/");
|
|
18617
18715
|
}
|
|
18618
18716
|
}
|
|
@@ -18653,14 +18751,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18653
18751
|
`)}
|
|
18654
18752
|
`;
|
|
18655
18753
|
}, buildReactVendor = async (buildDir) => {
|
|
18656
|
-
const vendorDir =
|
|
18754
|
+
const vendorDir = join31(buildDir, "react", "vendor");
|
|
18657
18755
|
mkdirSync10(vendorDir, { recursive: true });
|
|
18658
|
-
const tmpDir =
|
|
18756
|
+
const tmpDir = join31(buildDir, "_vendor_tmp");
|
|
18659
18757
|
mkdirSync10(tmpDir, { recursive: true });
|
|
18660
18758
|
const specifiers = resolveVendorSpecifiers();
|
|
18661
18759
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18662
18760
|
const safeName = toSafeFileName(specifier);
|
|
18663
|
-
const entryPath =
|
|
18761
|
+
const entryPath = join31(tmpDir, `${safeName}.ts`);
|
|
18664
18762
|
const source = await generateEntrySource(specifier);
|
|
18665
18763
|
await Bun.write(entryPath, source);
|
|
18666
18764
|
return entryPath;
|
|
@@ -18725,7 +18823,7 @@ __export(exports_buildAngularVendor, {
|
|
|
18725
18823
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
18726
18824
|
});
|
|
18727
18825
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
18728
|
-
import { join as
|
|
18826
|
+
import { join as join32 } from "path";
|
|
18729
18827
|
import { rm as rm6 } from "fs/promises";
|
|
18730
18828
|
var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
|
|
18731
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) => {
|
|
@@ -18762,7 +18860,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18762
18860
|
}
|
|
18763
18861
|
return { angular, transitiveRoots };
|
|
18764
18862
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
18765
|
-
const { readFileSync:
|
|
18863
|
+
const { readFileSync: readFileSync18 } = await import("fs");
|
|
18766
18864
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
18767
18865
|
const visited = new Set;
|
|
18768
18866
|
const frontier = [];
|
|
@@ -18783,7 +18881,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18783
18881
|
}
|
|
18784
18882
|
let content;
|
|
18785
18883
|
try {
|
|
18786
|
-
content =
|
|
18884
|
+
content = readFileSync18(resolved, "utf-8");
|
|
18787
18885
|
} catch {
|
|
18788
18886
|
continue;
|
|
18789
18887
|
}
|
|
@@ -18822,14 +18920,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18822
18920
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
18823
18921
|
return Array.from(angular).filter(isResolvable2);
|
|
18824
18922
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
18825
|
-
const vendorDir =
|
|
18923
|
+
const vendorDir = join32(buildDir, "angular", "vendor");
|
|
18826
18924
|
mkdirSync11(vendorDir, { recursive: true });
|
|
18827
|
-
const tmpDir =
|
|
18925
|
+
const tmpDir = join32(buildDir, "_angular_vendor_tmp");
|
|
18828
18926
|
mkdirSync11(tmpDir, { recursive: true });
|
|
18829
18927
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
18830
18928
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18831
18929
|
const safeName = toSafeFileName2(specifier);
|
|
18832
|
-
const entryPath =
|
|
18930
|
+
const entryPath = join32(tmpDir, `${safeName}.ts`);
|
|
18833
18931
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
18834
18932
|
return entryPath;
|
|
18835
18933
|
}));
|
|
@@ -18860,9 +18958,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18860
18958
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
18861
18959
|
return computeAngularVendorPaths(specifiers);
|
|
18862
18960
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
18863
|
-
const vendorDir =
|
|
18961
|
+
const vendorDir = join32(buildDir, "angular", "vendor", "server");
|
|
18864
18962
|
mkdirSync11(vendorDir, { recursive: true });
|
|
18865
|
-
const tmpDir =
|
|
18963
|
+
const tmpDir = join32(buildDir, "_angular_server_vendor_tmp");
|
|
18866
18964
|
mkdirSync11(tmpDir, { recursive: true });
|
|
18867
18965
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
18868
18966
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -18873,7 +18971,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18873
18971
|
const specifiers = Array.from(allSpecs);
|
|
18874
18972
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18875
18973
|
const safeName = toSafeFileName2(specifier);
|
|
18876
|
-
const entryPath =
|
|
18974
|
+
const entryPath = join32(tmpDir, `${safeName}.ts`);
|
|
18877
18975
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
18878
18976
|
return entryPath;
|
|
18879
18977
|
}));
|
|
@@ -18895,9 +18993,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18895
18993
|
return specifiers;
|
|
18896
18994
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
18897
18995
|
const paths = {};
|
|
18898
|
-
const vendorDir =
|
|
18996
|
+
const vendorDir = join32(buildDir, "angular", "vendor", "server");
|
|
18899
18997
|
for (const specifier of specifiers) {
|
|
18900
|
-
paths[specifier] =
|
|
18998
|
+
paths[specifier] = join32(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
18901
18999
|
}
|
|
18902
19000
|
return paths;
|
|
18903
19001
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -18953,17 +19051,17 @@ __export(exports_buildVueVendor, {
|
|
|
18953
19051
|
buildVueVendor: () => buildVueVendor
|
|
18954
19052
|
});
|
|
18955
19053
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
18956
|
-
import { join as
|
|
19054
|
+
import { join as join33 } from "path";
|
|
18957
19055
|
import { rm as rm7 } from "fs/promises";
|
|
18958
19056
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
18959
19057
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
18960
|
-
const vendorDir =
|
|
19058
|
+
const vendorDir = join33(buildDir, "vue", "vendor");
|
|
18961
19059
|
mkdirSync12(vendorDir, { recursive: true });
|
|
18962
|
-
const tmpDir =
|
|
19060
|
+
const tmpDir = join33(buildDir, "_vue_vendor_tmp");
|
|
18963
19061
|
mkdirSync12(tmpDir, { recursive: true });
|
|
18964
19062
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
18965
19063
|
const safeName = toSafeFileName3(specifier);
|
|
18966
|
-
const entryPath =
|
|
19064
|
+
const entryPath = join33(tmpDir, `${safeName}.ts`);
|
|
18967
19065
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
18968
19066
|
`);
|
|
18969
19067
|
return entryPath;
|
|
@@ -18988,11 +19086,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
18988
19086
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
18989
19087
|
return;
|
|
18990
19088
|
}
|
|
18991
|
-
const { readFileSync:
|
|
19089
|
+
const { readFileSync: readFileSync18, writeFileSync: writeFileSync10, readdirSync: readdirSync4 } = await import("fs");
|
|
18992
19090
|
const files = readdirSync4(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
18993
19091
|
for (const file4 of files) {
|
|
18994
|
-
const filePath =
|
|
18995
|
-
const content =
|
|
19092
|
+
const filePath = join33(vendorDir, file4);
|
|
19093
|
+
const content = readFileSync18(filePath, "utf-8");
|
|
18996
19094
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
18997
19095
|
continue;
|
|
18998
19096
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -19018,7 +19116,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
19018
19116
|
buildSvelteVendor: () => buildSvelteVendor
|
|
19019
19117
|
});
|
|
19020
19118
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19021
|
-
import { join as
|
|
19119
|
+
import { join as join34 } from "path";
|
|
19022
19120
|
import { rm as rm8 } from "fs/promises";
|
|
19023
19121
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
19024
19122
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -19032,13 +19130,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
19032
19130
|
const specifiers = resolveVendorSpecifiers2();
|
|
19033
19131
|
if (specifiers.length === 0)
|
|
19034
19132
|
return;
|
|
19035
|
-
const vendorDir =
|
|
19133
|
+
const vendorDir = join34(buildDir, "svelte", "vendor");
|
|
19036
19134
|
mkdirSync13(vendorDir, { recursive: true });
|
|
19037
|
-
const tmpDir =
|
|
19135
|
+
const tmpDir = join34(buildDir, "_svelte_vendor_tmp");
|
|
19038
19136
|
mkdirSync13(tmpDir, { recursive: true });
|
|
19039
19137
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19040
19138
|
const safeName = toSafeFileName4(specifier);
|
|
19041
|
-
const entryPath =
|
|
19139
|
+
const entryPath = join34(tmpDir, `${safeName}.ts`);
|
|
19042
19140
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
19043
19141
|
`);
|
|
19044
19142
|
return entryPath;
|
|
@@ -19088,7 +19186,7 @@ __export(exports_rewriteImportsPlugin, {
|
|
|
19088
19186
|
buildWithImportRewrite: () => buildWithImportRewrite
|
|
19089
19187
|
});
|
|
19090
19188
|
import { readdir as readdir3 } from "fs/promises";
|
|
19091
|
-
import { join as
|
|
19189
|
+
import { join as join35 } from "path";
|
|
19092
19190
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
19093
19191
|
let result = content;
|
|
19094
19192
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -19217,7 +19315,7 @@ ${content}`;
|
|
|
19217
19315
|
const entries = await readdir3(dir);
|
|
19218
19316
|
for (const entry of entries) {
|
|
19219
19317
|
if (entry.endsWith(".js"))
|
|
19220
|
-
allFiles.push(
|
|
19318
|
+
allFiles.push(join35(dir, entry));
|
|
19221
19319
|
}
|
|
19222
19320
|
} catch {}
|
|
19223
19321
|
}
|
|
@@ -19259,14 +19357,14 @@ var init_rewriteImportsPlugin = __esm(() => {
|
|
|
19259
19357
|
import {
|
|
19260
19358
|
copyFileSync as copyFileSync2,
|
|
19261
19359
|
cpSync,
|
|
19262
|
-
existsSync as
|
|
19360
|
+
existsSync as existsSync26,
|
|
19263
19361
|
mkdirSync as mkdirSync14,
|
|
19264
|
-
readFileSync as
|
|
19362
|
+
readFileSync as readFileSync18,
|
|
19265
19363
|
rmSync as rmSync2,
|
|
19266
19364
|
statSync as statSync3,
|
|
19267
19365
|
writeFileSync as writeFileSync10
|
|
19268
19366
|
} from "fs";
|
|
19269
|
-
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";
|
|
19270
19368
|
import { cwd, env as env2, exit } from "process";
|
|
19271
19369
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
19272
19370
|
var isDev, isBuildTraceEnabled = () => {
|
|
@@ -19344,8 +19442,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19344
19442
|
mkdirSync14(htmxDestDir, { recursive: true });
|
|
19345
19443
|
const glob = new Glob8("htmx*.min.js");
|
|
19346
19444
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
19347
|
-
const src =
|
|
19348
|
-
const dest =
|
|
19445
|
+
const src = join36(htmxDir, relPath);
|
|
19446
|
+
const dest = join36(htmxDestDir, "htmx.min.js");
|
|
19349
19447
|
copyFileSync2(src, dest);
|
|
19350
19448
|
return;
|
|
19351
19449
|
}
|
|
@@ -19389,7 +19487,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19389
19487
|
addWorkerPathIfExists(file4, relPath, workerPaths);
|
|
19390
19488
|
}
|
|
19391
19489
|
}, collectWorkerPathsFromFile = (file4, patterns, workerPaths) => {
|
|
19392
|
-
const content =
|
|
19490
|
+
const content = readFileSync18(file4, "utf-8");
|
|
19393
19491
|
for (const pattern of patterns) {
|
|
19394
19492
|
collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
|
|
19395
19493
|
}
|
|
@@ -19420,7 +19518,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19420
19518
|
vuePagesPath
|
|
19421
19519
|
}) => {
|
|
19422
19520
|
const { readdirSync: readDir } = await import("fs");
|
|
19423
|
-
const devIndexDir =
|
|
19521
|
+
const devIndexDir = join36(buildPath, "_src_indexes");
|
|
19424
19522
|
mkdirSync14(devIndexDir, { recursive: true });
|
|
19425
19523
|
if (reactIndexesPath && reactPagesPath) {
|
|
19426
19524
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -19432,41 +19530,41 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19432
19530
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
19433
19531
|
}
|
|
19434
19532
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
19435
|
-
if (!
|
|
19533
|
+
if (!existsSync26(reactIndexesPath)) {
|
|
19436
19534
|
return;
|
|
19437
19535
|
}
|
|
19438
19536
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
19439
19537
|
const pagesRel = relative15(process.cwd(), resolve26(reactPagesPath)).replace(/\\/g, "/");
|
|
19440
19538
|
for (const file4 of indexFiles) {
|
|
19441
|
-
let content =
|
|
19539
|
+
let content = readFileSync18(join36(reactIndexesPath, file4), "utf-8");
|
|
19442
19540
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
19443
|
-
writeFileSync10(
|
|
19541
|
+
writeFileSync10(join36(devIndexDir, file4), content);
|
|
19444
19542
|
}
|
|
19445
19543
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
19446
|
-
const svelteIndexDir =
|
|
19544
|
+
const svelteIndexDir = join36(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
19447
19545
|
const sveltePageEntries = svelteEntries.filter((file4) => resolve26(file4).startsWith(resolve26(sveltePagesPath)));
|
|
19448
19546
|
for (const entry of sveltePageEntries) {
|
|
19449
19547
|
const name = basename10(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
19450
|
-
const indexFile =
|
|
19451
|
-
if (!
|
|
19548
|
+
const indexFile = join36(svelteIndexDir, "pages", `${name}.js`);
|
|
19549
|
+
if (!existsSync26(indexFile))
|
|
19452
19550
|
continue;
|
|
19453
|
-
let content =
|
|
19551
|
+
let content = readFileSync18(indexFile, "utf-8");
|
|
19454
19552
|
const srcRel = relative15(process.cwd(), resolve26(entry)).replace(/\\/g, "/");
|
|
19455
19553
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
19456
|
-
writeFileSync10(
|
|
19554
|
+
writeFileSync10(join36(devIndexDir, `${name}.svelte.js`), content);
|
|
19457
19555
|
}
|
|
19458
19556
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
19459
|
-
const vueIndexDir =
|
|
19557
|
+
const vueIndexDir = join36(getFrameworkGeneratedDir("vue"), "indexes");
|
|
19460
19558
|
const vuePageEntries = vueEntries.filter((file4) => resolve26(file4).startsWith(resolve26(vuePagesPath)));
|
|
19461
19559
|
for (const entry of vuePageEntries) {
|
|
19462
19560
|
const name = basename10(entry, ".vue");
|
|
19463
|
-
const indexFile =
|
|
19464
|
-
if (!
|
|
19561
|
+
const indexFile = join36(vueIndexDir, `${name}.js`);
|
|
19562
|
+
if (!existsSync26(indexFile))
|
|
19465
19563
|
continue;
|
|
19466
|
-
let content =
|
|
19564
|
+
let content = readFileSync18(indexFile, "utf-8");
|
|
19467
19565
|
const srcRel = relative15(process.cwd(), resolve26(entry)).replace(/\\/g, "/");
|
|
19468
19566
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
19469
|
-
writeFileSync10(
|
|
19567
|
+
writeFileSync10(join36(devIndexDir, `${name}.vue.js`), content);
|
|
19470
19568
|
}
|
|
19471
19569
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
19472
19570
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -19514,7 +19612,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19514
19612
|
}
|
|
19515
19613
|
return result;
|
|
19516
19614
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
19517
|
-
let content =
|
|
19615
|
+
let content = readFileSync18(outputPath, "utf-8");
|
|
19518
19616
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
19519
19617
|
const useNames = [];
|
|
19520
19618
|
let match;
|
|
@@ -19564,7 +19662,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19564
19662
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
19565
19663
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
19566
19664
|
for (const outputPath of outputPaths) {
|
|
19567
|
-
let content =
|
|
19665
|
+
let content = readFileSync18(outputPath, "utf-8");
|
|
19568
19666
|
let changed = false;
|
|
19569
19667
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
19570
19668
|
const targetName = basename10(relPath);
|
|
@@ -19626,7 +19724,6 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19626
19724
|
htmlDirectory,
|
|
19627
19725
|
htmxDirectory,
|
|
19628
19726
|
angularDirectory,
|
|
19629
|
-
angular,
|
|
19630
19727
|
emberDirectory,
|
|
19631
19728
|
svelteDirectory,
|
|
19632
19729
|
vueDirectory,
|
|
@@ -19690,10 +19787,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19690
19787
|
restoreTracePhase();
|
|
19691
19788
|
return;
|
|
19692
19789
|
}
|
|
19693
|
-
const traceDir =
|
|
19790
|
+
const traceDir = join36(buildPath2, ".absolute-trace");
|
|
19694
19791
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
19695
19792
|
mkdirSync14(traceDir, { recursive: true });
|
|
19696
|
-
writeFileSync10(
|
|
19793
|
+
writeFileSync10(join36(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
19697
19794
|
events: traceEvents,
|
|
19698
19795
|
frameworks: traceFrameworkNames,
|
|
19699
19796
|
generatedAt: new Date().toISOString(),
|
|
@@ -19724,15 +19821,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19724
19821
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
19725
19822
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
19726
19823
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
19727
|
-
const reactIndexesPath = reactDir &&
|
|
19728
|
-
const reactPagesPath = reactDir &&
|
|
19729
|
-
const htmlPagesPath = htmlDir &&
|
|
19730
|
-
const htmlScriptsPath = htmlDir &&
|
|
19731
|
-
const sveltePagesPath = svelteDir &&
|
|
19732
|
-
const vuePagesPath = vueDir &&
|
|
19733
|
-
const htmxPagesPath = htmxDir &&
|
|
19734
|
-
const angularPagesPath = angularDir &&
|
|
19735
|
-
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");
|
|
19736
19833
|
const frontends = [
|
|
19737
19834
|
reactDir,
|
|
19738
19835
|
htmlDir,
|
|
@@ -19763,7 +19860,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19763
19860
|
const sourceClientRoots = [
|
|
19764
19861
|
htmlDir,
|
|
19765
19862
|
htmxDir,
|
|
19766
|
-
islandBootstrapPath &&
|
|
19863
|
+
islandBootstrapPath && dirname19(islandBootstrapPath)
|
|
19767
19864
|
].filter((dir) => Boolean(dir));
|
|
19768
19865
|
const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
|
|
19769
19866
|
if (usesGenerated)
|
|
@@ -19791,8 +19888,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19791
19888
|
const [firstEntry] = serverDirMap;
|
|
19792
19889
|
if (!firstEntry)
|
|
19793
19890
|
throw new Error("Expected at least one server directory entry");
|
|
19794
|
-
serverRoot =
|
|
19795
|
-
serverOutDir =
|
|
19891
|
+
serverRoot = join36(firstEntry.dir, firstEntry.subdir);
|
|
19892
|
+
serverOutDir = join36(buildPath, basename10(firstEntry.dir));
|
|
19796
19893
|
} else if (serverDirMap.length > 1) {
|
|
19797
19894
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
19798
19895
|
serverOutDir = buildPath;
|
|
@@ -19820,7 +19917,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19820
19917
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
19821
19918
|
}
|
|
19822
19919
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
19823
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
19920
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join36(buildPath, "assets"), {
|
|
19824
19921
|
force: true,
|
|
19825
19922
|
recursive: true
|
|
19826
19923
|
}));
|
|
@@ -19930,11 +20027,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19930
20027
|
}
|
|
19931
20028
|
}
|
|
19932
20029
|
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
19933
|
-
const htmlConventionsOutDir =
|
|
20030
|
+
const htmlConventionsOutDir = join36(buildPath, "conventions", "html");
|
|
19934
20031
|
mkdirSync14(htmlConventionsOutDir, { recursive: true });
|
|
19935
20032
|
const htmlPathRemap = new Map;
|
|
19936
20033
|
for (const sourcePath of htmlConventionSources) {
|
|
19937
|
-
const dest =
|
|
20034
|
+
const dest = join36(htmlConventionsOutDir, basename10(sourcePath));
|
|
19938
20035
|
cpSync(sourcePath, dest, { force: true });
|
|
19939
20036
|
htmlPathRemap.set(sourcePath, dest);
|
|
19940
20037
|
}
|
|
@@ -19977,7 +20074,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19977
20074
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
19978
20075
|
if (entry.startsWith(resolve26(reactIndexesPath))) {
|
|
19979
20076
|
const pageName = basename10(entry, ".tsx");
|
|
19980
|
-
return
|
|
20077
|
+
return join36(reactPagesPath, `${pageName}.tsx`);
|
|
19981
20078
|
}
|
|
19982
20079
|
return null;
|
|
19983
20080
|
}) : allReactEntries;
|
|
@@ -20013,9 +20110,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20013
20110
|
if (shouldCompileAngular && angularDir) {
|
|
20014
20111
|
await tracePhase("scan/angular-handlers", async () => {
|
|
20015
20112
|
const { runAngularHandlerScan: runAngularHandlerScan2 } = await Promise.resolve().then(() => (init_runAngularHandlerScan(), exports_runAngularHandlerScan));
|
|
20016
|
-
runAngularHandlerScan2(projectRoot, angularDir
|
|
20017
|
-
providersImport: angular?.providersImport
|
|
20018
|
-
});
|
|
20113
|
+
runAngularHandlerScan2(projectRoot, angularDir);
|
|
20019
20114
|
});
|
|
20020
20115
|
}
|
|
20021
20116
|
const [
|
|
@@ -20045,14 +20140,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20045
20140
|
try {
|
|
20046
20141
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20047
20142
|
const { readdir: readdir4 } = await import("fs/promises");
|
|
20048
|
-
const { join:
|
|
20143
|
+
const { join: join37 } = await import("path");
|
|
20049
20144
|
const walk = async (dir) => {
|
|
20050
20145
|
const entries = await readdir4(dir, {
|
|
20051
20146
|
withFileTypes: true
|
|
20052
20147
|
});
|
|
20053
20148
|
const out = [];
|
|
20054
20149
|
for (const entry of entries) {
|
|
20055
|
-
const full =
|
|
20150
|
+
const full = join37(dir, entry.name);
|
|
20056
20151
|
if (entry.isDirectory()) {
|
|
20057
20152
|
out.push(...await walk(full));
|
|
20058
20153
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -20117,7 +20212,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20117
20212
|
const compileReactConventions = async () => {
|
|
20118
20213
|
if (reactConventionSources.length === 0)
|
|
20119
20214
|
return emptyStringArray;
|
|
20120
|
-
const destDir =
|
|
20215
|
+
const destDir = join36(buildPath, "conventions", "react");
|
|
20121
20216
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20122
20217
|
mkdirSync14(destDir, { recursive: true });
|
|
20123
20218
|
const destPaths = [];
|
|
@@ -20133,7 +20228,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20133
20228
|
naming: `${idx}-[name].[ext]`,
|
|
20134
20229
|
outdir: destDir,
|
|
20135
20230
|
plugins: [stylePreprocessorPlugin2],
|
|
20136
|
-
root:
|
|
20231
|
+
root: dirname19(source),
|
|
20137
20232
|
target: "bun",
|
|
20138
20233
|
throw: false,
|
|
20139
20234
|
tsconfig: "./tsconfig.json"
|
|
@@ -20161,7 +20256,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20161
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 }
|
|
20162
20257
|
]);
|
|
20163
20258
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
20164
|
-
const destDir =
|
|
20259
|
+
const destDir = join36(buildPath, "conventions", framework);
|
|
20165
20260
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20166
20261
|
mkdirSync14(destDir, { recursive: true });
|
|
20167
20262
|
const destPaths = [];
|
|
@@ -20235,7 +20330,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20235
20330
|
}
|
|
20236
20331
|
})) : {
|
|
20237
20332
|
entries: [],
|
|
20238
|
-
generatedRoot:
|
|
20333
|
+
generatedRoot: join36(buildPath, "_island_entries")
|
|
20239
20334
|
};
|
|
20240
20335
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
20241
20336
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -20271,7 +20366,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20271
20366
|
return {};
|
|
20272
20367
|
}
|
|
20273
20368
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
20274
|
-
const refreshEntry =
|
|
20369
|
+
const refreshEntry = join36(reactIndexesPath, "_refresh.tsx");
|
|
20275
20370
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
20276
20371
|
reactClientEntryPoints.push(refreshEntry);
|
|
20277
20372
|
}
|
|
@@ -20373,19 +20468,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20373
20468
|
throw: false
|
|
20374
20469
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
20375
20470
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
20376
|
-
rmSync2(
|
|
20471
|
+
rmSync2(join36(buildPath, "react", "generated", "indexes"), {
|
|
20377
20472
|
force: true,
|
|
20378
20473
|
recursive: true
|
|
20379
20474
|
});
|
|
20380
20475
|
}
|
|
20381
20476
|
if (angularDir && angularClientPaths.length > 0) {
|
|
20382
|
-
rmSync2(
|
|
20477
|
+
rmSync2(join36(buildPath, "angular", "indexes"), {
|
|
20383
20478
|
force: true,
|
|
20384
20479
|
recursive: true
|
|
20385
20480
|
});
|
|
20386
20481
|
}
|
|
20387
20482
|
if (islandClientEntryPoints.length > 0) {
|
|
20388
|
-
rmSync2(
|
|
20483
|
+
rmSync2(join36(buildPath, "islands"), {
|
|
20389
20484
|
force: true,
|
|
20390
20485
|
recursive: true
|
|
20391
20486
|
});
|
|
@@ -20474,7 +20569,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20474
20569
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20475
20570
|
entrypoints: globalCssEntries,
|
|
20476
20571
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
20477
|
-
outdir: stylesDir ?
|
|
20572
|
+
outdir: stylesDir ? join36(buildPath, basename10(stylesDir)) : buildPath,
|
|
20478
20573
|
plugins: [stylePreprocessorPlugin2],
|
|
20479
20574
|
root: stylesDir || clientRoot,
|
|
20480
20575
|
target: "browser",
|
|
@@ -20483,7 +20578,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20483
20578
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20484
20579
|
entrypoints: vueCssPaths,
|
|
20485
20580
|
naming: `[name].[hash].[ext]`,
|
|
20486
|
-
outdir:
|
|
20581
|
+
outdir: join36(buildPath, assetsPath ? basename10(assetsPath) : "assets", "css"),
|
|
20487
20582
|
target: "browser",
|
|
20488
20583
|
throw: false
|
|
20489
20584
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -20557,7 +20652,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20557
20652
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
20558
20653
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
20559
20654
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
20560
|
-
const fileDir =
|
|
20655
|
+
const fileDir = dirname19(artifact.path);
|
|
20561
20656
|
const relativePaths = {};
|
|
20562
20657
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
20563
20658
|
const rel = relative15(fileDir, absolute);
|
|
@@ -20643,7 +20738,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20643
20738
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
20644
20739
|
if (!hmrClientBundle)
|
|
20645
20740
|
return;
|
|
20646
|
-
let html =
|
|
20741
|
+
let html = readFileSync18(filePath, "utf-8");
|
|
20647
20742
|
if (html.includes("data-hmr-client"))
|
|
20648
20743
|
return;
|
|
20649
20744
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -20654,7 +20749,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20654
20749
|
const processHtmlPages = async () => {
|
|
20655
20750
|
if (!(htmlDir && htmlPagesPath))
|
|
20656
20751
|
return;
|
|
20657
|
-
const outputHtmlPages = isSingle ?
|
|
20752
|
+
const outputHtmlPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename10(htmlDir), "pages");
|
|
20658
20753
|
mkdirSync14(outputHtmlPages, { recursive: true });
|
|
20659
20754
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
20660
20755
|
force: true,
|
|
@@ -20679,14 +20774,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20679
20774
|
const processHtmxPages = async () => {
|
|
20680
20775
|
if (!(htmxDir && htmxPagesPath))
|
|
20681
20776
|
return;
|
|
20682
|
-
const outputHtmxPages = isSingle ?
|
|
20777
|
+
const outputHtmxPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename10(htmxDir), "pages");
|
|
20683
20778
|
mkdirSync14(outputHtmxPages, { recursive: true });
|
|
20684
20779
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
20685
20780
|
force: true,
|
|
20686
20781
|
recursive: true
|
|
20687
20782
|
});
|
|
20688
20783
|
if (shouldCopyHtmx) {
|
|
20689
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
20784
|
+
const htmxDestDir = isSingle ? buildPath : join36(buildPath, basename10(htmxDir));
|
|
20690
20785
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
20691
20786
|
}
|
|
20692
20787
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -20751,9 +20846,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20751
20846
|
writeBuildTrace(buildPath);
|
|
20752
20847
|
return { conventions: conventionsMap, manifest };
|
|
20753
20848
|
}
|
|
20754
|
-
writeFileSync10(
|
|
20849
|
+
writeFileSync10(join36(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
20755
20850
|
if (Object.keys(conventionsMap).length > 0) {
|
|
20756
|
-
writeFileSync10(
|
|
20851
|
+
writeFileSync10(join36(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
20757
20852
|
}
|
|
20758
20853
|
writeBuildTrace(buildPath);
|
|
20759
20854
|
if (mode === "production") {
|
|
@@ -20874,8 +20969,8 @@ var init_build = __esm(() => {
|
|
|
20874
20969
|
});
|
|
20875
20970
|
|
|
20876
20971
|
// src/build/buildEmberVendor.ts
|
|
20877
|
-
import { mkdirSync as mkdirSync15, existsSync as
|
|
20878
|
-
import { join as
|
|
20972
|
+
import { mkdirSync as mkdirSync15, existsSync as existsSync27 } from "fs";
|
|
20973
|
+
import { join as join37 } from "path";
|
|
20879
20974
|
import { rm as rm9 } from "fs/promises";
|
|
20880
20975
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
20881
20976
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -20927,8 +21022,8 @@ export const importSync = (specifier) => {
|
|
|
20927
21022
|
if (standaloneSpecifiers.has(specifier)) {
|
|
20928
21023
|
return { resolveTo: specifier, specifier };
|
|
20929
21024
|
}
|
|
20930
|
-
const emberInternalPath =
|
|
20931
|
-
if (!
|
|
21025
|
+
const emberInternalPath = join37(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
21026
|
+
if (!existsSync27(emberInternalPath)) {
|
|
20932
21027
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
20933
21028
|
}
|
|
20934
21029
|
return { resolveTo: emberInternalPath, specifier };
|
|
@@ -20959,24 +21054,24 @@ export const importSync = (specifier) => {
|
|
|
20959
21054
|
if (standalonePackages.has(args.path)) {
|
|
20960
21055
|
return;
|
|
20961
21056
|
}
|
|
20962
|
-
const internal =
|
|
20963
|
-
if (
|
|
21057
|
+
const internal = join37(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
21058
|
+
if (existsSync27(internal)) {
|
|
20964
21059
|
return { path: internal };
|
|
20965
21060
|
}
|
|
20966
21061
|
return;
|
|
20967
21062
|
});
|
|
20968
21063
|
}
|
|
20969
21064
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
20970
|
-
const vendorDir =
|
|
21065
|
+
const vendorDir = join37(buildDir, "ember", "vendor");
|
|
20971
21066
|
mkdirSync15(vendorDir, { recursive: true });
|
|
20972
|
-
const tmpDir =
|
|
21067
|
+
const tmpDir = join37(buildDir, "_ember_vendor_tmp");
|
|
20973
21068
|
mkdirSync15(tmpDir, { recursive: true });
|
|
20974
|
-
const macrosShimPath =
|
|
21069
|
+
const macrosShimPath = join37(tmpDir, "embroider_macros_shim.js");
|
|
20975
21070
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
20976
21071
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
20977
21072
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
20978
21073
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
20979
|
-
const entryPath =
|
|
21074
|
+
const entryPath = join37(tmpDir, `${safeName}.js`);
|
|
20980
21075
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
20981
21076
|
` : generateVendorEntrySource2(resolution);
|
|
20982
21077
|
await Bun.write(entryPath, source);
|
|
@@ -21029,7 +21124,7 @@ __export(exports_dependencyGraph, {
|
|
|
21029
21124
|
buildInitialDependencyGraph: () => buildInitialDependencyGraph,
|
|
21030
21125
|
addFileToGraph: () => addFileToGraph
|
|
21031
21126
|
});
|
|
21032
|
-
import { existsSync as
|
|
21127
|
+
import { existsSync as existsSync28, readFileSync as readFileSync19 } from "fs";
|
|
21033
21128
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
21034
21129
|
import { resolve as resolve27 } from "path";
|
|
21035
21130
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -21059,10 +21154,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21059
21154
|
];
|
|
21060
21155
|
for (const ext of extensions) {
|
|
21061
21156
|
const withExt = normalized + ext;
|
|
21062
|
-
if (
|
|
21157
|
+
if (existsSync28(withExt))
|
|
21063
21158
|
return withExt;
|
|
21064
21159
|
}
|
|
21065
|
-
if (
|
|
21160
|
+
if (existsSync28(normalized))
|
|
21066
21161
|
return normalized;
|
|
21067
21162
|
return null;
|
|
21068
21163
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -21077,7 +21172,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21077
21172
|
}
|
|
21078
21173
|
}, addFileToGraph = (graph, filePath) => {
|
|
21079
21174
|
const normalizedPath = resolve27(filePath);
|
|
21080
|
-
if (!
|
|
21175
|
+
if (!existsSync28(normalizedPath))
|
|
21081
21176
|
return;
|
|
21082
21177
|
const dependencies = extractDependencies(normalizedPath);
|
|
21083
21178
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -21103,7 +21198,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21103
21198
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
21104
21199
|
const processedFiles = new Set;
|
|
21105
21200
|
const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
21106
|
-
const resolvedDirs = directories.map((dir) => resolve27(dir)).filter((dir) =>
|
|
21201
|
+
const resolvedDirs = directories.map((dir) => resolve27(dir)).filter((dir) => existsSync28(dir));
|
|
21107
21202
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
21108
21203
|
for (const file4 of allFiles) {
|
|
21109
21204
|
const fullPath = resolve27(file4);
|
|
@@ -21200,15 +21295,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21200
21295
|
const lowerPath = filePath.toLowerCase();
|
|
21201
21296
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
21202
21297
|
if (loader === "html") {
|
|
21203
|
-
const content =
|
|
21298
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
21204
21299
|
return extractHtmlDependencies(filePath, content);
|
|
21205
21300
|
}
|
|
21206
21301
|
if (loader === "tsx" || loader === "js") {
|
|
21207
|
-
const content =
|
|
21302
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
21208
21303
|
return extractJsDependencies(filePath, content, loader);
|
|
21209
21304
|
}
|
|
21210
21305
|
if (isSvelteOrVue) {
|
|
21211
|
-
const content =
|
|
21306
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
21212
21307
|
return extractSvelteVueDependencies(filePath, content);
|
|
21213
21308
|
}
|
|
21214
21309
|
return [];
|
|
@@ -21351,8 +21446,8 @@ var init_clientManager = __esm(() => {
|
|
|
21351
21446
|
});
|
|
21352
21447
|
|
|
21353
21448
|
// src/dev/pathUtils.ts
|
|
21354
|
-
import { existsSync as
|
|
21355
|
-
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";
|
|
21356
21451
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
21357
21452
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
21358
21453
|
return "ignored";
|
|
@@ -21451,7 +21546,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21451
21546
|
}
|
|
21452
21547
|
let source;
|
|
21453
21548
|
try {
|
|
21454
|
-
source =
|
|
21549
|
+
source = readFileSync20(full, "utf8");
|
|
21455
21550
|
} catch {
|
|
21456
21551
|
continue;
|
|
21457
21552
|
}
|
|
@@ -21480,10 +21575,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21480
21575
|
refs.push(strMatch[1]);
|
|
21481
21576
|
}
|
|
21482
21577
|
}
|
|
21483
|
-
const componentDir =
|
|
21578
|
+
const componentDir = dirname20(full);
|
|
21484
21579
|
for (const ref of refs) {
|
|
21485
21580
|
const refAbs = normalizePath(resolve29(componentDir, ref));
|
|
21486
|
-
const refDir = normalizePath(
|
|
21581
|
+
const refDir = normalizePath(dirname20(refAbs));
|
|
21487
21582
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
21488
21583
|
continue;
|
|
21489
21584
|
}
|
|
@@ -21525,7 +21620,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21525
21620
|
push(cfg.stylesDir);
|
|
21526
21621
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
21527
21622
|
const abs = normalizePath(resolve29(cwd2, candidate));
|
|
21528
|
-
if (
|
|
21623
|
+
if (existsSync29(abs) && !roots.includes(abs))
|
|
21529
21624
|
roots.push(abs);
|
|
21530
21625
|
}
|
|
21531
21626
|
try {
|
|
@@ -21610,8 +21705,8 @@ var init_pathUtils = __esm(() => {
|
|
|
21610
21705
|
|
|
21611
21706
|
// src/dev/fileWatcher.ts
|
|
21612
21707
|
import { watch } from "fs";
|
|
21613
|
-
import { existsSync as
|
|
21614
|
-
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";
|
|
21615
21710
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
21616
21711
|
try {
|
|
21617
21712
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -21644,7 +21739,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21644
21739
|
for (const name of entries) {
|
|
21645
21740
|
if (shouldSkipFilename(name, isStylesDir))
|
|
21646
21741
|
continue;
|
|
21647
|
-
const child =
|
|
21742
|
+
const child = join38(eventDir, name).replace(/\\/g, "/");
|
|
21648
21743
|
let st2;
|
|
21649
21744
|
try {
|
|
21650
21745
|
st2 = statSync4(child);
|
|
@@ -21669,21 +21764,21 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21669
21764
|
return;
|
|
21670
21765
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
21671
21766
|
if (event === "rename") {
|
|
21672
|
-
const eventDir =
|
|
21767
|
+
const eventDir = dirname21(join38(absolutePath, filename)).replace(/\\/g, "/");
|
|
21673
21768
|
atomicRecoveryScan(eventDir);
|
|
21674
21769
|
}
|
|
21675
21770
|
return;
|
|
21676
21771
|
}
|
|
21677
|
-
const fullPath =
|
|
21772
|
+
const fullPath = join38(absolutePath, filename).replace(/\\/g, "/");
|
|
21678
21773
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
21679
21774
|
return;
|
|
21680
21775
|
}
|
|
21681
|
-
if (event === "rename" && !
|
|
21776
|
+
if (event === "rename" && !existsSync30(fullPath)) {
|
|
21682
21777
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
21683
21778
|
onFileChange(fullPath);
|
|
21684
21779
|
return;
|
|
21685
21780
|
}
|
|
21686
|
-
if (
|
|
21781
|
+
if (existsSync30(fullPath)) {
|
|
21687
21782
|
onFileChange(fullPath);
|
|
21688
21783
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
21689
21784
|
}
|
|
@@ -21693,7 +21788,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21693
21788
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
21694
21789
|
paths.forEach((path) => {
|
|
21695
21790
|
const absolutePath = resolve30(path).replace(/\\/g, "/");
|
|
21696
|
-
if (!
|
|
21791
|
+
if (!existsSync30(absolutePath)) {
|
|
21697
21792
|
return;
|
|
21698
21793
|
}
|
|
21699
21794
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -21704,7 +21799,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21704
21799
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
21705
21800
|
watchPaths.forEach((path) => {
|
|
21706
21801
|
const absolutePath = resolve30(path).replace(/\\/g, "/");
|
|
21707
|
-
if (!
|
|
21802
|
+
if (!existsSync30(absolutePath)) {
|
|
21708
21803
|
return;
|
|
21709
21804
|
}
|
|
21710
21805
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -21826,8 +21921,8 @@ var init_assetStore = __esm(() => {
|
|
|
21826
21921
|
});
|
|
21827
21922
|
|
|
21828
21923
|
// src/islands/pageMetadata.ts
|
|
21829
|
-
import { readFileSync as
|
|
21830
|
-
import { dirname as
|
|
21924
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
21925
|
+
import { dirname as dirname22, resolve as resolve32 } from "path";
|
|
21831
21926
|
var pagePatterns, getPageDirs = (config) => [
|
|
21832
21927
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
21833
21928
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -21847,7 +21942,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
21847
21942
|
const source = definition.buildReference?.source;
|
|
21848
21943
|
if (!source)
|
|
21849
21944
|
continue;
|
|
21850
|
-
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);
|
|
21851
21946
|
lookup.set(`${definition.framework}:${definition.component}`, resolve32(resolvedSource));
|
|
21852
21947
|
}
|
|
21853
21948
|
return lookup;
|
|
@@ -21869,7 +21964,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
21869
21964
|
return;
|
|
21870
21965
|
const files = await scanEntryPoints(resolve32(entry.dir), pattern);
|
|
21871
21966
|
for (const filePath of files) {
|
|
21872
|
-
const source =
|
|
21967
|
+
const source = readFileSync21(filePath, "utf-8");
|
|
21873
21968
|
const islands = extractIslandUsagesFromSource(source);
|
|
21874
21969
|
pageMetadata.set(resolve32(filePath), {
|
|
21875
21970
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
@@ -21900,10 +21995,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
21900
21995
|
});
|
|
21901
21996
|
|
|
21902
21997
|
// src/dev/fileHashTracker.ts
|
|
21903
|
-
import { readFileSync as
|
|
21998
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
21904
21999
|
var computeFileHash = (filePath) => {
|
|
21905
22000
|
try {
|
|
21906
|
-
const fileContent =
|
|
22001
|
+
const fileContent = readFileSync22(filePath);
|
|
21907
22002
|
return Number(Bun.hash(fileContent));
|
|
21908
22003
|
} catch {
|
|
21909
22004
|
return UNFOUND_INDEX;
|
|
@@ -22117,9 +22212,9 @@ __export(exports_resolveOwningComponents, {
|
|
|
22117
22212
|
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
22118
22213
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
22119
22214
|
});
|
|
22120
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
22121
|
-
import { dirname as
|
|
22122
|
-
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";
|
|
22123
22218
|
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
22124
22219
|
const out = [];
|
|
22125
22220
|
const visit = (dir) => {
|
|
@@ -22133,7 +22228,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22133
22228
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
22134
22229
|
continue;
|
|
22135
22230
|
}
|
|
22136
|
-
const full =
|
|
22231
|
+
const full = join39(dir, entry.name);
|
|
22137
22232
|
if (entry.isDirectory()) {
|
|
22138
22233
|
visit(full);
|
|
22139
22234
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -22145,13 +22240,13 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22145
22240
|
return out;
|
|
22146
22241
|
}, getStringPropertyValue = (obj, name) => {
|
|
22147
22242
|
for (const prop of obj.properties) {
|
|
22148
|
-
if (!
|
|
22243
|
+
if (!ts14.isPropertyAssignment(prop))
|
|
22149
22244
|
continue;
|
|
22150
|
-
const propName =
|
|
22245
|
+
const propName = ts14.isIdentifier(prop.name) ? prop.name.text : ts14.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
22151
22246
|
if (propName !== name)
|
|
22152
22247
|
continue;
|
|
22153
22248
|
const init = prop.initializer;
|
|
22154
|
-
if (
|
|
22249
|
+
if (ts14.isStringLiteral(init) || ts14.isNoSubstitutionTemplateLiteral(init)) {
|
|
22155
22250
|
return init.text;
|
|
22156
22251
|
}
|
|
22157
22252
|
}
|
|
@@ -22159,16 +22254,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22159
22254
|
}, getStringArrayProperty = (obj, name) => {
|
|
22160
22255
|
const out = [];
|
|
22161
22256
|
for (const prop of obj.properties) {
|
|
22162
|
-
if (!
|
|
22257
|
+
if (!ts14.isPropertyAssignment(prop))
|
|
22163
22258
|
continue;
|
|
22164
|
-
const propName =
|
|
22259
|
+
const propName = ts14.isIdentifier(prop.name) ? prop.name.text : ts14.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
22165
22260
|
if (propName !== name)
|
|
22166
22261
|
continue;
|
|
22167
22262
|
const init = prop.initializer;
|
|
22168
|
-
if (!
|
|
22263
|
+
if (!ts14.isArrayLiteralExpression(init))
|
|
22169
22264
|
continue;
|
|
22170
22265
|
for (const element of init.elements) {
|
|
22171
|
-
if (
|
|
22266
|
+
if (ts14.isStringLiteral(element) || ts14.isNoSubstitutionTemplateLiteral(element)) {
|
|
22172
22267
|
out.push(element.text);
|
|
22173
22268
|
}
|
|
22174
22269
|
}
|
|
@@ -22177,31 +22272,31 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22177
22272
|
}, parseDecoratedClasses = (filePath) => {
|
|
22178
22273
|
let source;
|
|
22179
22274
|
try {
|
|
22180
|
-
source =
|
|
22275
|
+
source = readFileSync23(filePath, "utf8");
|
|
22181
22276
|
} catch {
|
|
22182
22277
|
return [];
|
|
22183
22278
|
}
|
|
22184
|
-
const sourceFile =
|
|
22279
|
+
const sourceFile = ts14.createSourceFile(filePath, source, ts14.ScriptTarget.ES2022, true, ts14.ScriptKind.TS);
|
|
22185
22280
|
const out = [];
|
|
22186
22281
|
const visit = (node) => {
|
|
22187
|
-
if (
|
|
22188
|
-
for (const decorator of
|
|
22282
|
+
if (ts14.isClassDeclaration(node) && node.name) {
|
|
22283
|
+
for (const decorator of ts14.getDecorators(node) ?? []) {
|
|
22189
22284
|
const expr = decorator.expression;
|
|
22190
|
-
if (!
|
|
22285
|
+
if (!ts14.isCallExpression(expr))
|
|
22191
22286
|
continue;
|
|
22192
22287
|
const fn2 = expr.expression;
|
|
22193
|
-
if (!
|
|
22288
|
+
if (!ts14.isIdentifier(fn2))
|
|
22194
22289
|
continue;
|
|
22195
22290
|
const kind = ENTITY_DECORATORS[fn2.text];
|
|
22196
22291
|
if (!kind)
|
|
22197
22292
|
continue;
|
|
22198
22293
|
let extendsName = null;
|
|
22199
22294
|
for (const heritage of node.heritageClauses ?? []) {
|
|
22200
|
-
if (heritage.token !==
|
|
22295
|
+
if (heritage.token !== ts14.SyntaxKind.ExtendsKeyword) {
|
|
22201
22296
|
continue;
|
|
22202
22297
|
}
|
|
22203
22298
|
const first = heritage.types[0];
|
|
22204
|
-
if (first &&
|
|
22299
|
+
if (first && ts14.isIdentifier(first.expression)) {
|
|
22205
22300
|
extendsName = first.expression.text;
|
|
22206
22301
|
}
|
|
22207
22302
|
break;
|
|
@@ -22214,7 +22309,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22214
22309
|
extendsName
|
|
22215
22310
|
};
|
|
22216
22311
|
const arg = expr.arguments[0];
|
|
22217
|
-
if (arg &&
|
|
22312
|
+
if (arg && ts14.isObjectLiteralExpression(arg) && kind === "component") {
|
|
22218
22313
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
22219
22314
|
if (tplUrl)
|
|
22220
22315
|
entry.templateUrls.push(tplUrl);
|
|
@@ -22227,7 +22322,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22227
22322
|
break;
|
|
22228
22323
|
}
|
|
22229
22324
|
}
|
|
22230
|
-
|
|
22325
|
+
ts14.forEachChild(node, visit);
|
|
22231
22326
|
};
|
|
22232
22327
|
visit(sourceFile);
|
|
22233
22328
|
return out;
|
|
@@ -22267,16 +22362,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22267
22362
|
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
22268
22363
|
let source;
|
|
22269
22364
|
try {
|
|
22270
|
-
source =
|
|
22365
|
+
source = readFileSync23(childFilePath, "utf8");
|
|
22271
22366
|
} catch {
|
|
22272
22367
|
return null;
|
|
22273
22368
|
}
|
|
22274
|
-
const sf =
|
|
22275
|
-
const childDir =
|
|
22369
|
+
const sf = ts14.createSourceFile(childFilePath, source, ts14.ScriptTarget.ES2022, true, ts14.ScriptKind.TS);
|
|
22370
|
+
const childDir = dirname23(childFilePath);
|
|
22276
22371
|
for (const stmt of sf.statements) {
|
|
22277
|
-
if (!
|
|
22372
|
+
if (!ts14.isImportDeclaration(stmt))
|
|
22278
22373
|
continue;
|
|
22279
|
-
if (!
|
|
22374
|
+
if (!ts14.isStringLiteral(stmt.moduleSpecifier))
|
|
22280
22375
|
continue;
|
|
22281
22376
|
const clause = stmt.importClause;
|
|
22282
22377
|
if (!clause || clause.isTypeOnly)
|
|
@@ -22284,7 +22379,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22284
22379
|
let matchesName = false;
|
|
22285
22380
|
if (clause.name && clause.name.text === parentName)
|
|
22286
22381
|
matchesName = true;
|
|
22287
|
-
if (!matchesName && clause.namedBindings &&
|
|
22382
|
+
if (!matchesName && clause.namedBindings && ts14.isNamedImports(clause.namedBindings)) {
|
|
22288
22383
|
for (const el of clause.namedBindings.elements) {
|
|
22289
22384
|
if (el.isTypeOnly)
|
|
22290
22385
|
continue;
|
|
@@ -22329,7 +22424,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22329
22424
|
const parentFile = new Map;
|
|
22330
22425
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
22331
22426
|
const classes = parseDecoratedClasses(tsPath);
|
|
22332
|
-
const componentDir =
|
|
22427
|
+
const componentDir = dirname23(tsPath);
|
|
22333
22428
|
for (const cls of classes) {
|
|
22334
22429
|
const entity = {
|
|
22335
22430
|
className: cls.className,
|
|
@@ -22634,8 +22729,8 @@ __export(exports_moduleServer, {
|
|
|
22634
22729
|
createModuleServer: () => createModuleServer,
|
|
22635
22730
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
22636
22731
|
});
|
|
22637
|
-
import { existsSync as
|
|
22638
|
-
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";
|
|
22639
22734
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
22640
22735
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
22641
22736
|
const allExports = [];
|
|
@@ -22655,7 +22750,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
22655
22750
|
${stubs}
|
|
22656
22751
|
`;
|
|
22657
22752
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
22658
|
-
const found = extensions.find((ext) =>
|
|
22753
|
+
const found = extensions.find((ext) => existsSync31(resolve37(projectRoot, srcPath + ext)));
|
|
22659
22754
|
return found ? srcPath + found : srcPath;
|
|
22660
22755
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
22661
22756
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -22707,13 +22802,13 @@ ${stubs}
|
|
|
22707
22802
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
22708
22803
|
if (!subpath) {
|
|
22709
22804
|
const pkgDir = resolve37(projectRoot, "node_modules", packageName ?? "");
|
|
22710
|
-
const pkgJsonPath =
|
|
22711
|
-
if (
|
|
22712
|
-
const pkg = JSON.parse(
|
|
22805
|
+
const pkgJsonPath = join40(pkgDir, "package.json");
|
|
22806
|
+
if (existsSync31(pkgJsonPath)) {
|
|
22807
|
+
const pkg = JSON.parse(readFileSync24(pkgJsonPath, "utf-8"));
|
|
22713
22808
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
22714
22809
|
if (esmEntry) {
|
|
22715
22810
|
const resolved = resolve37(pkgDir, esmEntry);
|
|
22716
|
-
if (
|
|
22811
|
+
if (existsSync31(resolved))
|
|
22717
22812
|
return relative16(projectRoot, resolved);
|
|
22718
22813
|
}
|
|
22719
22814
|
}
|
|
@@ -22744,7 +22839,7 @@ ${stubs}
|
|
|
22744
22839
|
};
|
|
22745
22840
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
22746
22841
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
22747
|
-
const fileDir =
|
|
22842
|
+
const fileDir = dirname24(filePath);
|
|
22748
22843
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
22749
22844
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
22750
22845
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
@@ -22810,7 +22905,7 @@ ${code}`;
|
|
|
22810
22905
|
reactFastRefreshWarningEmitted = true;
|
|
22811
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.");
|
|
22812
22907
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
22813
|
-
const raw =
|
|
22908
|
+
const raw = readFileSync24(filePath, "utf-8");
|
|
22814
22909
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
22815
22910
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
22816
22911
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -22826,7 +22921,7 @@ ${transpiled}`;
|
|
|
22826
22921
|
transpiled += buildIslandMetadataExports(raw);
|
|
22827
22922
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
22828
22923
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
22829
|
-
const raw =
|
|
22924
|
+
const raw = readFileSync24(filePath, "utf-8");
|
|
22830
22925
|
const ext = extname10(filePath);
|
|
22831
22926
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
22832
22927
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -22992,7 +23087,7 @@ ${code}`;
|
|
|
22992
23087
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
22993
23088
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
22994
23089
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
22995
|
-
const raw =
|
|
23090
|
+
const raw = readFileSync24(filePath, "utf-8");
|
|
22996
23091
|
if (!svelteCompiler) {
|
|
22997
23092
|
svelteCompiler = await import("svelte/compiler");
|
|
22998
23093
|
}
|
|
@@ -23054,7 +23149,7 @@ export default __script__;`;
|
|
|
23054
23149
|
return `${cssInjection}
|
|
23055
23150
|
${code}`;
|
|
23056
23151
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
23057
|
-
const rawSource =
|
|
23152
|
+
const rawSource = readFileSync24(filePath, "utf-8");
|
|
23058
23153
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
23059
23154
|
if (!vueCompiler) {
|
|
23060
23155
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
@@ -23092,11 +23187,11 @@ ${code}`;
|
|
|
23092
23187
|
`);
|
|
23093
23188
|
return result;
|
|
23094
23189
|
}, resolveSvelteModulePath = (path) => {
|
|
23095
|
-
if (
|
|
23190
|
+
if (existsSync31(path))
|
|
23096
23191
|
return path;
|
|
23097
|
-
if (
|
|
23192
|
+
if (existsSync31(`${path}.ts`))
|
|
23098
23193
|
return `${path}.ts`;
|
|
23099
|
-
if (
|
|
23194
|
+
if (existsSync31(`${path}.js`))
|
|
23100
23195
|
return `${path}.js`;
|
|
23101
23196
|
return path;
|
|
23102
23197
|
}, jsResponse = (body) => {
|
|
@@ -23109,7 +23204,7 @@ ${code}`;
|
|
|
23109
23204
|
}
|
|
23110
23205
|
});
|
|
23111
23206
|
}, handleCssRequest = (filePath) => {
|
|
23112
|
-
const raw =
|
|
23207
|
+
const raw = readFileSync24(filePath, "utf-8");
|
|
23113
23208
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
23114
23209
|
return [
|
|
23115
23210
|
`const style = document.createElement('style');`,
|
|
@@ -23247,7 +23342,7 @@ export default {};
|
|
|
23247
23342
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
23248
23343
|
if (ext)
|
|
23249
23344
|
return { ext, filePath };
|
|
23250
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
23345
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync31(filePath + candidate));
|
|
23251
23346
|
if (!found)
|
|
23252
23347
|
return { ext, filePath };
|
|
23253
23348
|
const resolved = filePath + found;
|
|
@@ -23540,7 +23635,7 @@ __export(exports_hmrCompiler, {
|
|
|
23540
23635
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
23541
23636
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
23542
23637
|
});
|
|
23543
|
-
import { dirname as
|
|
23638
|
+
import { dirname as dirname25, relative as relative17, resolve as resolve38 } from "path";
|
|
23544
23639
|
import { performance as performance2 } from "perf_hooks";
|
|
23545
23640
|
var getApplyMetadataModule = async (encodedId) => {
|
|
23546
23641
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -23560,7 +23655,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
23560
23655
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
23561
23656
|
const owners = resolveOwningComponents2({
|
|
23562
23657
|
changedFilePath: componentFilePath,
|
|
23563
|
-
userAngularRoot:
|
|
23658
|
+
userAngularRoot: dirname25(componentFilePath)
|
|
23564
23659
|
});
|
|
23565
23660
|
const owner = owners.find((o3) => o3.className === className);
|
|
23566
23661
|
const kind = owner?.kind ?? "component";
|
|
@@ -23767,8 +23862,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
23767
23862
|
var init_simpleHTMXHMR = () => {};
|
|
23768
23863
|
|
|
23769
23864
|
// src/dev/rebuildTrigger.ts
|
|
23770
|
-
import { existsSync as
|
|
23771
|
-
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";
|
|
23772
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) => {
|
|
23773
23868
|
if (!config.tailwind)
|
|
23774
23869
|
return;
|
|
@@ -23867,7 +23962,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23867
23962
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
23868
23963
|
}
|
|
23869
23964
|
return { ...parsed, framework: detectedFw };
|
|
23870
|
-
}, 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) => {
|
|
23871
23966
|
const config = state.config;
|
|
23872
23967
|
const cwd2 = process.cwd();
|
|
23873
23968
|
const absDeleted = resolve41(deletedFile).replace(/\\/g, "/");
|
|
@@ -23885,8 +23980,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23885
23980
|
const relJs = `${rel.slice(0, -ext[0].length)}.js`;
|
|
23886
23981
|
const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
|
|
23887
23982
|
for (const candidate of [
|
|
23888
|
-
|
|
23889
|
-
`${
|
|
23983
|
+
join41(generatedDir, relJs),
|
|
23984
|
+
`${join41(generatedDir, relJs)}.map`
|
|
23890
23985
|
]) {
|
|
23891
23986
|
try {
|
|
23892
23987
|
rmSync3(candidate, { force: true });
|
|
@@ -23913,7 +24008,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23913
24008
|
if (!dependents || dependents.size === 0) {
|
|
23914
24009
|
return;
|
|
23915
24010
|
}
|
|
23916
|
-
const dependentFiles = Array.from(dependents).filter((file4) =>
|
|
24011
|
+
const dependentFiles = Array.from(dependents).filter((file4) => existsSync32(file4));
|
|
23917
24012
|
if (dependentFiles.length === 0) {
|
|
23918
24013
|
return;
|
|
23919
24014
|
}
|
|
@@ -23929,7 +24024,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23929
24024
|
try {
|
|
23930
24025
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
23931
24026
|
affectedFiles.forEach((affectedFile) => {
|
|
23932
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
24027
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync32(affectedFile)) {
|
|
23933
24028
|
validFiles.push(affectedFile);
|
|
23934
24029
|
processedFiles.add(affectedFile);
|
|
23935
24030
|
}
|
|
@@ -23954,7 +24049,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23954
24049
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
23955
24050
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
23956
24051
|
filePathSet.forEach((filePathInSet) => {
|
|
23957
|
-
if (!
|
|
24052
|
+
if (!existsSync32(filePathInSet)) {
|
|
23958
24053
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
23959
24054
|
return;
|
|
23960
24055
|
}
|
|
@@ -24091,8 +24186,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24091
24186
|
const buildDir = state.resolvedPaths.buildDir;
|
|
24092
24187
|
const destPath = resolve41(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
|
|
24093
24188
|
const { mkdir: mkdir7, copyFile, readFile: readFile6 } = await import("fs/promises");
|
|
24094
|
-
const { dirname:
|
|
24095
|
-
await mkdir7(
|
|
24189
|
+
const { dirname: dirname27 } = await import("path");
|
|
24190
|
+
await mkdir7(dirname27(destPath), { recursive: true });
|
|
24096
24191
|
await copyFile(absSource, destPath);
|
|
24097
24192
|
const bytes = await readFile6(destPath);
|
|
24098
24193
|
const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
|
|
@@ -24208,7 +24303,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24208
24303
|
return componentFile;
|
|
24209
24304
|
}
|
|
24210
24305
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
24211
|
-
if (
|
|
24306
|
+
if (existsSync32(tsCounterpart)) {
|
|
24212
24307
|
return tsCounterpart;
|
|
24213
24308
|
}
|
|
24214
24309
|
if (!graph)
|
|
@@ -24294,7 +24389,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24294
24389
|
const keepByDir = new Map;
|
|
24295
24390
|
const prefixByDir = new Map;
|
|
24296
24391
|
for (const artifact of freshOutputs) {
|
|
24297
|
-
const dir =
|
|
24392
|
+
const dir = dirname26(artifact.path);
|
|
24298
24393
|
const name = basename13(artifact.path);
|
|
24299
24394
|
const [prefix] = name.split(".");
|
|
24300
24395
|
if (!prefix)
|
|
@@ -24724,12 +24819,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24724
24819
|
try {
|
|
24725
24820
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
24726
24821
|
const { readdir: readdir5 } = await import("fs/promises");
|
|
24727
|
-
const { join:
|
|
24822
|
+
const { join: join42 } = await import("path");
|
|
24728
24823
|
const walk = async (dir) => {
|
|
24729
24824
|
const entries = await readdir5(dir, { withFileTypes: true });
|
|
24730
24825
|
const files = [];
|
|
24731
24826
|
for (const entry of entries) {
|
|
24732
|
-
const full =
|
|
24827
|
+
const full = join42(dir, entry.name);
|
|
24733
24828
|
if (entry.isDirectory()) {
|
|
24734
24829
|
files.push(...await walk(full));
|
|
24735
24830
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -25172,7 +25267,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25172
25267
|
const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
|
|
25173
25268
|
const serverEntries = [...vueServerPaths];
|
|
25174
25269
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
25175
|
-
const cssOutDir =
|
|
25270
|
+
const cssOutDir = join41(buildDir, state.resolvedPaths.assetsDir ? basename13(state.resolvedPaths.assetsDir) : "assets", "css");
|
|
25176
25271
|
const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
|
|
25177
25272
|
const [serverResult, clientResult, cssResult] = await Promise.all([
|
|
25178
25273
|
serverEntries.length > 0 ? bunBuild9({
|
|
@@ -25413,7 +25508,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25413
25508
|
if (!buildReference?.source) {
|
|
25414
25509
|
return;
|
|
25415
25510
|
}
|
|
25416
|
-
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);
|
|
25417
25512
|
islandFiles.add(resolve41(sourcePath));
|
|
25418
25513
|
}, resolveIslandSourceFiles = async (config) => {
|
|
25419
25514
|
const registryPath = config.islands?.registry;
|
|
@@ -26187,7 +26282,7 @@ __export(exports_buildDepVendor, {
|
|
|
26187
26282
|
buildDepVendor: () => buildDepVendor
|
|
26188
26283
|
});
|
|
26189
26284
|
import { mkdirSync as mkdirSync16 } from "fs";
|
|
26190
|
-
import { join as
|
|
26285
|
+
import { join as join42 } from "path";
|
|
26191
26286
|
import { rm as rm10 } from "fs/promises";
|
|
26192
26287
|
var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
|
|
26193
26288
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -26241,7 +26336,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26241
26336
|
framework: Array.from(framework).filter(isResolvable4)
|
|
26242
26337
|
};
|
|
26243
26338
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
26244
|
-
const { readFileSync:
|
|
26339
|
+
const { readFileSync: readFileSync25 } = await import("fs");
|
|
26245
26340
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
26246
26341
|
const newSpecs = new Set;
|
|
26247
26342
|
for (const spec of specs) {
|
|
@@ -26256,7 +26351,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26256
26351
|
}
|
|
26257
26352
|
let content;
|
|
26258
26353
|
try {
|
|
26259
|
-
content =
|
|
26354
|
+
content = readFileSync25(resolved, "utf-8");
|
|
26260
26355
|
} catch {
|
|
26261
26356
|
continue;
|
|
26262
26357
|
}
|
|
@@ -26298,7 +26393,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26298
26393
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
26299
26394
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
26300
26395
|
const safeName = toSafeFileName6(specifier);
|
|
26301
|
-
const entryPath =
|
|
26396
|
+
const entryPath = join42(tmpDir, `${safeName}.ts`);
|
|
26302
26397
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
26303
26398
|
return { entryPath, specifier };
|
|
26304
26399
|
}));
|
|
@@ -26359,9 +26454,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26359
26454
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
26360
26455
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
26361
26456
|
return {};
|
|
26362
|
-
const vendorDir =
|
|
26457
|
+
const vendorDir = join42(buildDir, "vendor");
|
|
26363
26458
|
mkdirSync16(vendorDir, { recursive: true });
|
|
26364
|
-
const tmpDir =
|
|
26459
|
+
const tmpDir = join42(buildDir, "_dep_vendor_tmp");
|
|
26365
26460
|
mkdirSync16(tmpDir, { recursive: true });
|
|
26366
26461
|
const allSpecs = new Set(initialSpecs);
|
|
26367
26462
|
const alreadyScanned = new Set;
|
|
@@ -26873,5 +26968,5 @@ export {
|
|
|
26873
26968
|
build
|
|
26874
26969
|
};
|
|
26875
26970
|
|
|
26876
|
-
//# debugId=
|
|
26971
|
+
//# debugId=BF022E079C29BE4864756E2164756E21
|
|
26877
26972
|
//# sourceMappingURL=build.js.map
|