@absolutejs/absolute 0.20.0-beta.173 → 0.20.0-beta.175
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/CHANGELOG.md +30 -0
- package/changelog.json +71 -0
- package/dist/angular/browser.js +13 -2
- package/dist/angular/browser.js.map +3 -3
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +113 -34
- package/dist/angular/index.js.map +12 -9
- package/dist/angular/server.js +113 -34
- package/dist/angular/server.js.map +12 -9
- package/dist/build.js +946 -731
- package/dist/build.js.map +40 -37
- package/dist/cli/{add-ae6mg79m.js → add-ntg96znk.js} +32 -31
- package/dist/cli/{compile-ndc36zna.js → compile-w2z6c9vt.js} +16 -14
- package/dist/cli/config/server.js +85 -65
- package/dist/cli/{dev-x49583aj.js → dev-8br5mr7t.js} +17 -3
- package/dist/cli/{expoProject-h404n2r8.js → expoProject-1qtw97js.js} +2 -1
- package/dist/cli/{generate-brvjesd6.js → generate-5vyz1s44.js} +7 -6
- package/dist/cli/{htmx-5twhjz7p.js → htmx-26hs6jdm.js} +2 -1
- package/dist/cli/{index-gyjxrnnz.js → index-23hvdyxf.js} +18 -16
- package/dist/cli/index-4j1twret.js +22 -0
- package/dist/cli/{index-z794p5qg.js → index-6522t968.js} +43 -21
- package/dist/cli/{index-25e7k849.js → index-7z1hh3fg.js} +4 -4
- package/dist/cli/{index-s0r5q839.js → index-cksezef8.js} +10 -8
- package/dist/cli/{index-q3snnhyd.js → index-enbw9484.js} +34 -33
- package/dist/cli/{index-b1wht4q5.js → index-kes8he5s.js} +6 -4
- package/dist/cli/{index-vh68jb0e.js → index-pkw3jktb.js} +17 -16
- package/dist/cli/{index-rervww4p.js → index-zyd80s3h.js} +119 -119
- package/dist/cli/index.js +11 -11
- package/dist/cli/{islands-p4vgx7a2.js → islands-bx67g15t.js} +8 -7
- package/dist/cli/{mobile-nqdkk3gd.js → mobile-we5q51ey.js} +5 -4
- package/dist/cli/{remove-abaf0w6k.js → remove-4jh862qa.js} +6 -5
- package/dist/cli/{start-t3cq57wn.js → start-srs11bm8.js} +5 -4
- package/dist/cli/{typecheck-fag7djt5.js → typecheck-7fvww3b7.js} +28 -26
- package/dist/client/chunks/index-4j1snyh2.js +18 -0
- package/dist/client/chunks/index-4j1snyh2.js.map +10 -0
- package/dist/client/chunks/{index-6b66nzyf.js → index-a3rpg5kw.js} +6 -16
- package/dist/client/chunks/{index-6b66nzyf.js.map → index-a3rpg5kw.js.map} +3 -4
- package/dist/client/chunks/{islands-s2ta5ajb.js → islands-mfjmdwnb.js} +11 -4
- package/dist/client/chunks/{islands-s2ta5ajb.js.map → islands-mfjmdwnb.js.map} +3 -3
- package/dist/client/chunks/{react-dcvkaba2.js → react-sprprqzs.js} +20 -4
- package/dist/client/chunks/react-sprprqzs.js.map +10 -0
- package/dist/client/chunks/svelte-6ewphsvj.js +30 -0
- package/dist/client/chunks/svelte-6ewphsvj.js.map +10 -0
- package/dist/client/chunks/{vue-a84fzp3v.js → vue-db6ppn1f.js} +14 -4
- package/dist/client/chunks/vue-db6ppn1f.js.map +10 -0
- package/dist/client/index.js +65 -8
- package/dist/client/index.js.map +4 -4
- package/dist/client/navigation.js +5 -3
- package/dist/client/navigation.js.map +2 -2
- package/dist/client/prefetch.js +1 -1
- package/dist/dev/client/handlers/islands.ts +85 -0
- package/dist/dev/client/hmrClient.ts +6 -0
- package/dist/dev/importCostReport.js +45 -26
- package/dist/index.js +1080 -852
- package/dist/index.js.map +41 -38
- package/dist/islands/index.js +57 -10
- package/dist/islands/index.js.map +9 -7
- package/dist/mobile/index.js +115 -95
- package/dist/mobile/index.js.map +6 -5
- package/dist/mobile/remoteMacAgentEntry.js +205 -651
- package/dist/react/browser.js +15 -4
- package/dist/react/browser.js.map +5 -5
- package/dist/react/components/client.js +506 -0
- package/dist/react/components/index.js +14 -15
- package/dist/react/components/index.js.map +4 -4
- package/dist/react/components/server/index.js +728 -0
- package/dist/react/hooks/index.js +14 -15
- package/dist/react/hooks/index.js.map +4 -4
- package/dist/react/index.js +66 -6
- package/dist/react/index.js.map +11 -9
- package/dist/react/router/browser.js +7 -8
- package/dist/react/router/browser.js.map +4 -4
- package/dist/react/router/index.js +7 -8
- package/dist/react/router/index.js.map +4 -4
- package/dist/react/server.js +14 -1
- package/dist/react/server.js.map +4 -4
- package/dist/src/build/buildReactServerComponents.d.ts +4 -0
- package/dist/src/build/islandEntries.d.ts +5 -0
- package/dist/src/cli/config/absolute/resolveAbsoluteConfig.d.ts +3 -3
- package/dist/src/cli/config/auth/resolveAuthSettings.d.ts +3 -3
- package/dist/src/client/hydrators/react.d.ts +7 -0
- package/dist/src/client/hydrators/svelte.d.ts +3 -0
- package/dist/src/client/hydrators/vue.d.ts +3 -0
- package/dist/src/client/preserveIslandMarkup.d.ts +5 -0
- package/dist/src/core/islandServerGeneration.d.ts +3 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +2 -2
- package/dist/src/dev/angular/hmrImportGenerator.d.ts +2 -2
- package/dist/src/dev/angular/vendor/translator/ts_util.d.ts +2 -2
- package/dist/src/dev/angular/vendor/translator/typescript_ast_factory.d.ts +40 -40
- package/dist/src/dev/angular/vendor/translator/typescript_translator.d.ts +3 -3
- package/dist/src/react/components/client.d.ts +4 -0
- package/dist/src/react/components/server/index.d.ts +8 -0
- package/dist/src/react/serverComponents/constants.d.ts +2 -1
- package/dist/src/utils/lazyTypescript.d.ts +3 -0
- package/dist/svelte/index.js +66 -6
- package/dist/svelte/index.js.map +10 -8
- package/dist/svelte/server.js +38 -3
- package/dist/svelte/server.js.map +6 -5
- package/dist/types/build.d.ts +3 -2
- package/dist/types/globals.d.ts +15 -0
- package/dist/vue/browser.js +26 -16
- package/dist/vue/browser.js.map +5 -5
- package/dist/vue/index.js +65 -21
- package/dist/vue/index.js.map +10 -9
- package/package.json +1 -1
- package/dist/client/chunks/react-dcvkaba2.js.map +0 -10
- package/dist/client/chunks/svelte-4yfa5bxa.js +0 -17
- package/dist/client/chunks/svelte-4yfa5bxa.js.map +0 -10
- package/dist/client/chunks/vue-a84fzp3v.js.map +0 -10
package/dist/build.js
CHANGED
|
@@ -1127,6 +1127,26 @@ var init_verifyAngularCoreUniqueness = __esm(() => {
|
|
|
1127
1127
|
ANGULAR_CORE_PACKAGE_RE = /(?:(?:^|\/)@angular\/core(?:\/|$)|(?:^|\/)angular_core\.[mc]?js$)/;
|
|
1128
1128
|
});
|
|
1129
1129
|
|
|
1130
|
+
// src/utils/lazyTypescript.ts
|
|
1131
|
+
import { createRequire } from "module";
|
|
1132
|
+
var loaded, loadTypescript = () => {
|
|
1133
|
+
if (loaded)
|
|
1134
|
+
return loaded;
|
|
1135
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
1136
|
+
const typescript = requireFromHere("typescript");
|
|
1137
|
+
loaded = typescript;
|
|
1138
|
+
return typescript;
|
|
1139
|
+
}, createLazyTypescript = () => {
|
|
1140
|
+
const target = Object.create(null);
|
|
1141
|
+
return new Proxy(target, {
|
|
1142
|
+
get: (_target, key) => Reflect.get(loadTypescript(), key),
|
|
1143
|
+
has: (_target, key) => Reflect.has(loadTypescript(), key)
|
|
1144
|
+
});
|
|
1145
|
+
}, lazyTypescript;
|
|
1146
|
+
var init_lazyTypescript = __esm(() => {
|
|
1147
|
+
lazyTypescript = createLazyTypescript();
|
|
1148
|
+
});
|
|
1149
|
+
|
|
1130
1150
|
// src/core/islands.ts
|
|
1131
1151
|
function getIslandComponent(component) {
|
|
1132
1152
|
if (isIslandComponentDefinition(component)) {
|
|
@@ -1153,9 +1173,9 @@ var defineIslandComponent = (component, options) => ({
|
|
|
1153
1173
|
var init_islands = () => {};
|
|
1154
1174
|
|
|
1155
1175
|
// src/build/islandEntries.ts
|
|
1156
|
-
import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
1176
|
+
import { mkdirSync as mkdirSync2, rmSync, statSync, writeFileSync as writeFileSync2 } from "fs";
|
|
1157
1177
|
import { dirname, extname as extname3, join as join2, relative, resolve as resolve3 } from "path";
|
|
1158
|
-
import
|
|
1178
|
+
import { fileURLToPath } from "url";
|
|
1159
1179
|
var frameworks, isRecord2 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
1160
1180
|
if (isRecord2(mod.islandRegistry))
|
|
1161
1181
|
return mod.islandRegistry;
|
|
@@ -1167,11 +1187,26 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1167
1187
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
1168
1188
|
}, isIdentifier = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value), resolveIslandSourcePath = (registryPath, sourcePath) => {
|
|
1169
1189
|
if (sourcePath.startsWith("file://")) {
|
|
1170
|
-
return
|
|
1190
|
+
return fileURLToPath(sourcePath);
|
|
1171
1191
|
}
|
|
1172
1192
|
return resolve3(dirname(registryPath), sourcePath);
|
|
1193
|
+
}, isExistingFile = (path) => {
|
|
1194
|
+
try {
|
|
1195
|
+
return statSync(path).isFile();
|
|
1196
|
+
} catch {
|
|
1197
|
+
return false;
|
|
1198
|
+
}
|
|
1199
|
+
}, resolveIslandSourceFile = (registryPath, sourcePath) => {
|
|
1200
|
+
const joinedPath = resolveIslandSourcePath(registryPath, sourcePath);
|
|
1201
|
+
if (isExistingFile(joinedPath))
|
|
1202
|
+
return joinedPath;
|
|
1203
|
+
try {
|
|
1204
|
+
return Bun.resolveSync(joinedPath, dirname(registryPath));
|
|
1205
|
+
} catch {
|
|
1206
|
+
return joinedPath;
|
|
1207
|
+
}
|
|
1173
1208
|
}, getObjectPropertyName = (name) => {
|
|
1174
|
-
if (
|
|
1209
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name)) {
|
|
1175
1210
|
return name.text;
|
|
1176
1211
|
}
|
|
1177
1212
|
return null;
|
|
@@ -1184,7 +1219,7 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1184
1219
|
});
|
|
1185
1220
|
}, collectNamedImports = (imports, importClause, source) => {
|
|
1186
1221
|
const bindings = importClause.namedBindings;
|
|
1187
|
-
if (!bindings || !
|
|
1222
|
+
if (!bindings || !lazyTypescript.isNamedImports(bindings))
|
|
1188
1223
|
return;
|
|
1189
1224
|
for (const element of bindings.elements) {
|
|
1190
1225
|
imports.set(element.name.text, {
|
|
@@ -1198,7 +1233,7 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1198
1233
|
const bindings = importClause.namedBindings;
|
|
1199
1234
|
if (!bindings)
|
|
1200
1235
|
return;
|
|
1201
|
-
if (
|
|
1236
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
1202
1237
|
registryNamespaceNames.add(bindings.name.text);
|
|
1203
1238
|
return;
|
|
1204
1239
|
}
|
|
@@ -1216,13 +1251,13 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1216
1251
|
const frameworkRegistry = registry[framework] ?? {};
|
|
1217
1252
|
registry[framework] = frameworkRegistry;
|
|
1218
1253
|
for (const property of frameworkNode.properties) {
|
|
1219
|
-
if (!
|
|
1254
|
+
if (!lazyTypescript.isPropertyAssignment(property) && !lazyTypescript.isShorthandPropertyAssignment(property))
|
|
1220
1255
|
continue;
|
|
1221
1256
|
const componentName = getObjectPropertyName(property.name);
|
|
1222
1257
|
if (!componentName)
|
|
1223
1258
|
continue;
|
|
1224
|
-
const initializer =
|
|
1225
|
-
if (!
|
|
1259
|
+
const initializer = lazyTypescript.isPropertyAssignment(property) ? property.initializer : property.name;
|
|
1260
|
+
if (!lazyTypescript.isIdentifier(initializer))
|
|
1226
1261
|
continue;
|
|
1227
1262
|
const reference = imports.get(initializer.text);
|
|
1228
1263
|
if (!reference)
|
|
@@ -1236,7 +1271,7 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1236
1271
|
}
|
|
1237
1272
|
}, processDefineIslandRegistry = (node, imports, definitions, registry) => {
|
|
1238
1273
|
const [firstArg] = node.arguments;
|
|
1239
|
-
if (!firstArg || !
|
|
1274
|
+
if (!firstArg || !lazyTypescript.isObjectLiteralExpression(firstArg))
|
|
1240
1275
|
return;
|
|
1241
1276
|
const validFrameworks = [
|
|
1242
1277
|
"react",
|
|
@@ -1245,7 +1280,7 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1245
1280
|
"angular"
|
|
1246
1281
|
];
|
|
1247
1282
|
for (const property of firstArg.properties) {
|
|
1248
|
-
if (!
|
|
1283
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
1249
1284
|
continue;
|
|
1250
1285
|
const frameworkName = getObjectPropertyName(property.name);
|
|
1251
1286
|
if (!frameworkName)
|
|
@@ -1253,28 +1288,28 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1253
1288
|
const framework = validFrameworks.find((f) => f === frameworkName);
|
|
1254
1289
|
if (!framework)
|
|
1255
1290
|
continue;
|
|
1256
|
-
if (!
|
|
1291
|
+
if (!lazyTypescript.isObjectLiteralExpression(property.initializer))
|
|
1257
1292
|
continue;
|
|
1258
1293
|
addRegistryEntries(property.initializer, framework, imports, definitions, registry);
|
|
1259
1294
|
}
|
|
1260
1295
|
}, walkRegistryNode = (node, imports, registryFactoryNames, registryNamespaceNames, definitions, registry) => {
|
|
1261
|
-
if (
|
|
1296
|
+
if (lazyTypescript.isCallExpression(node) && isDefineIslandRegistryCall(node.expression, registryFactoryNames, registryNamespaceNames)) {
|
|
1262
1297
|
processDefineIslandRegistry(node, imports, definitions, registry);
|
|
1263
1298
|
}
|
|
1264
|
-
|
|
1299
|
+
lazyTypescript.forEachChild(node, (child) => walkRegistryNode(child, imports, registryFactoryNames, registryNamespaceNames, definitions, registry));
|
|
1265
1300
|
}, isDefineIslandRegistryCall = (expression, registryFactoryNames, registryNamespaceNames) => {
|
|
1266
|
-
if (
|
|
1301
|
+
if (lazyTypescript.isIdentifier(expression)) {
|
|
1267
1302
|
return registryFactoryNames.has(expression.text);
|
|
1268
1303
|
}
|
|
1269
|
-
return
|
|
1304
|
+
return lazyTypescript.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && lazyTypescript.isIdentifier(expression.expression) && registryNamespaceNames.has(expression.expression.text);
|
|
1270
1305
|
}, hasIslandRegistryNamedExport = (sourceFile) => {
|
|
1271
1306
|
for (const statement of sourceFile.statements) {
|
|
1272
|
-
if (
|
|
1307
|
+
if (lazyTypescript.isVariableStatement(statement) && statement.modifiers?.some((modifier) => modifier.kind === lazyTypescript.SyntaxKind.ExportKeyword) && statement.declarationList.declarations.some((declaration) => lazyTypescript.isIdentifier(declaration.name) && declaration.name.text === "islandRegistry")) {
|
|
1273
1308
|
return true;
|
|
1274
1309
|
}
|
|
1275
|
-
if (!
|
|
1310
|
+
if (!lazyTypescript.isExportDeclaration(statement) || !statement.exportClause)
|
|
1276
1311
|
continue;
|
|
1277
|
-
if (!
|
|
1312
|
+
if (!lazyTypescript.isNamedExports(statement.exportClause))
|
|
1278
1313
|
continue;
|
|
1279
1314
|
if (statement.exportClause.elements.some((element) => element.name.text === "islandRegistry")) {
|
|
1280
1315
|
return true;
|
|
@@ -1283,7 +1318,7 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1283
1318
|
return false;
|
|
1284
1319
|
}, collectImportDeclarations = (sourceFile, registryPath, imports, registryFactoryNames, registryNamespaceNames) => {
|
|
1285
1320
|
for (const statement of sourceFile.statements) {
|
|
1286
|
-
if (!
|
|
1321
|
+
if (!lazyTypescript.isImportDeclaration(statement) || !lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
1287
1322
|
continue;
|
|
1288
1323
|
const { importClause } = statement;
|
|
1289
1324
|
if (!importClause)
|
|
@@ -1294,7 +1329,7 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
|
|
|
1294
1329
|
collectRegistryHelperImports(importClause, statement.moduleSpecifier.text, registryFactoryNames, registryNamespaceNames);
|
|
1295
1330
|
}
|
|
1296
1331
|
}, parseIslandRegistryBuildInfo = (registrySource, registryPath) => {
|
|
1297
|
-
const sourceFile =
|
|
1332
|
+
const sourceFile = lazyTypescript.createSourceFile(registryPath, registrySource, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
1298
1333
|
const imports = new Map;
|
|
1299
1334
|
const registryFactoryNames = new Set(["defineIslandRegistry"]);
|
|
1300
1335
|
const registryNamespaceNames = new Set;
|
|
@@ -1433,6 +1468,7 @@ export default component;
|
|
|
1433
1468
|
};
|
|
1434
1469
|
};
|
|
1435
1470
|
var init_islandEntries = __esm(() => {
|
|
1471
|
+
init_lazyTypescript();
|
|
1436
1472
|
init_islands();
|
|
1437
1473
|
frameworks = ["react", "svelte", "vue", "angular"];
|
|
1438
1474
|
});
|
|
@@ -1887,9 +1923,9 @@ var PAGE_PATTERN = "*.{tsx,jsx,ts,js}", SOURCE_FILTER, USE_CLIENT_PATTERN, MANIF
|
|
|
1887
1923
|
}, clientModuleId = (projectRoot, path) => createHash2("sha256").update(relative4(projectRoot, path).replace(/\\/g, "/")).digest("hex").slice(0, MODULE_ID_LENGTH), isClientModuleSource = (source) => USE_CLIENT_PATTERN.test(source), scanExportNames = (path, source) => {
|
|
1888
1924
|
const transpiler = new Transpiler({ loader: loaderFor(path) });
|
|
1889
1925
|
return transpiler.scan(source).exports;
|
|
1890
|
-
}, clientReferenceSource = (module) => {
|
|
1926
|
+
}, clientReferenceSource = (module, flightServer) => {
|
|
1891
1927
|
const lines = [
|
|
1892
|
-
`import { registerClientReference } from
|
|
1928
|
+
`import { registerClientReference } from ${JSON.stringify(flightServer)};`,
|
|
1893
1929
|
`import { clientManifest } from ${JSON.stringify(MANIFEST_SPECIFIER)};`,
|
|
1894
1930
|
`const id = ${JSON.stringify(module.id)};`,
|
|
1895
1931
|
`clientManifest[id] = { chunks: [id, id], id, name: '' };`,
|
|
@@ -1901,7 +1937,16 @@ var PAGE_PATTERN = "*.{tsx,jsx,ts,js}", SOURCE_FILTER, USE_CLIENT_PATTERN, MANIF
|
|
|
1901
1937
|
return `${lines.join(`
|
|
1902
1938
|
`)}
|
|
1903
1939
|
`;
|
|
1940
|
+
}, REACT_COMPONENTS_SPECIFIER, resolveReactComponentsServerEntry = (importer) => {
|
|
1941
|
+
try {
|
|
1942
|
+
const regularEntry = Bun.resolveSync("@absolutejs/absolute/react/components", dirname2(importer));
|
|
1943
|
+
const serverEntry = join4(dirname2(regularEntry), "server", "index.js");
|
|
1944
|
+
return existsSync4(serverEntry) ? serverEntry : undefined;
|
|
1945
|
+
} catch {
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1904
1948
|
}, createClientReferencePlugin = (projectRoot, clientModules) => {
|
|
1949
|
+
const flightServer = Bun.resolveSync("react-server-dom-webpack/server.edge", projectRoot);
|
|
1905
1950
|
const plugin = {
|
|
1906
1951
|
name: "absolute-react-server-client-references",
|
|
1907
1952
|
setup(builder) {
|
|
@@ -1914,6 +1959,10 @@ var PAGE_PATTERN = "*.{tsx,jsx,ts,js}", SOURCE_FILTER, USE_CLIENT_PATTERN, MANIF
|
|
|
1914
1959
|
`,
|
|
1915
1960
|
loader: "js"
|
|
1916
1961
|
}));
|
|
1962
|
+
builder.onResolve({ filter: REACT_COMPONENTS_SPECIFIER }, (args) => {
|
|
1963
|
+
const path = resolveReactComponentsServerEntry(args.importer);
|
|
1964
|
+
return path ? { path } : undefined;
|
|
1965
|
+
});
|
|
1917
1966
|
builder.onLoad({ filter: SOURCE_FILTER }, (args) => {
|
|
1918
1967
|
const source = readFileSync2(args.path, "utf8");
|
|
1919
1968
|
const loader = loaderFor(args.path);
|
|
@@ -1927,7 +1976,7 @@ var PAGE_PATTERN = "*.{tsx,jsx,ts,js}", SOURCE_FILTER, USE_CLIENT_PATTERN, MANIF
|
|
|
1927
1976
|
};
|
|
1928
1977
|
clientModules.set(module.id, module);
|
|
1929
1978
|
return {
|
|
1930
|
-
contents: clientReferenceSource(module),
|
|
1979
|
+
contents: clientReferenceSource(module, flightServer),
|
|
1931
1980
|
loader: "js"
|
|
1932
1981
|
};
|
|
1933
1982
|
});
|
|
@@ -2051,7 +2100,18 @@ hydrateRoot(document, createElement(Root));
|
|
|
2051
2100
|
mkdirSync4(dirname2(path), { recursive: true });
|
|
2052
2101
|
writeFileSync3(path, contents);
|
|
2053
2102
|
return path;
|
|
2054
|
-
}, pageEntryName = (pagePath) => toPascal(basename2(pagePath, extname4(pagePath))),
|
|
2103
|
+
}, pageEntryName = (pagePath) => toPascal(basename2(pagePath, extname4(pagePath))), endsWithPageSuffix = (name) => name.length > REACT_SERVER_PAGE_MANIFEST_SUFFIX.length && name.endsWith(REACT_SERVER_PAGE_MANIFEST_SUFFIX), pageManifestKeys = (name, names) => {
|
|
2104
|
+
const doubled = `${name}${REACT_SERVER_PAGE_MANIFEST_SUFFIX}`;
|
|
2105
|
+
if (!endsWithPageSuffix(name))
|
|
2106
|
+
return { keys: [doubled] };
|
|
2107
|
+
const base = name.slice(0, -REACT_SERVER_PAGE_MANIFEST_SUFFIX.length);
|
|
2108
|
+
if (!names.has(base))
|
|
2109
|
+
return { keys: [name, doubled] };
|
|
2110
|
+
return {
|
|
2111
|
+
collision: `React Server Components pages ${base} and ${name} both map to the manifest key "${name}"; ${base} keeps it and ${name} is only reachable as "${doubled}". Rename one of them.`,
|
|
2112
|
+
keys: [doubled]
|
|
2113
|
+
};
|
|
2114
|
+
}, buildReactServerComponents = async ({
|
|
2055
2115
|
buildPath,
|
|
2056
2116
|
directory,
|
|
2057
2117
|
isDev,
|
|
@@ -2152,10 +2212,15 @@ hydrateRoot(document, createElement(Root));
|
|
|
2152
2212
|
[REACT_SERVER_CLIENT_MANIFEST_KEY]: clientUrl,
|
|
2153
2213
|
[REACT_SERVER_RENDERER_MANIFEST_KEY]: resolve6(ssrOutput.path)
|
|
2154
2214
|
};
|
|
2215
|
+
const pageKeys = reactServerPageManifestKeys(pageEntries.map((page) => page.name));
|
|
2216
|
+
for (const collision of pageKeys.collisions)
|
|
2217
|
+
logWarn(collision);
|
|
2155
2218
|
for (const page of pageEntries) {
|
|
2156
2219
|
const output = findOutput(serverResult.outputs, page.name);
|
|
2157
|
-
if (output)
|
|
2158
|
-
|
|
2220
|
+
if (!output)
|
|
2221
|
+
continue;
|
|
2222
|
+
for (const key of pageKeys.keys.get(page.name) ?? [])
|
|
2223
|
+
manifest[key] = resolve6(output.path);
|
|
2159
2224
|
}
|
|
2160
2225
|
const result = {
|
|
2161
2226
|
logs,
|
|
@@ -2185,11 +2250,24 @@ hydrateRoot(document, createElement(Root));
|
|
|
2185
2250
|
...options,
|
|
2186
2251
|
directory: absoluteDirectory
|
|
2187
2252
|
});
|
|
2253
|
+
}, reactServerPageManifestKeys = (pageNames) => {
|
|
2254
|
+
const names = new Set(pageNames);
|
|
2255
|
+
const keys = new Map;
|
|
2256
|
+
const collisions = [];
|
|
2257
|
+
for (const name of pageNames) {
|
|
2258
|
+
const page = pageManifestKeys(name, names);
|
|
2259
|
+
keys.set(name, page.keys);
|
|
2260
|
+
if (page.collision)
|
|
2261
|
+
collisions.push(page.collision);
|
|
2262
|
+
}
|
|
2263
|
+
return { collisions, keys };
|
|
2188
2264
|
};
|
|
2189
2265
|
var init_buildReactServerComponents = __esm(() => {
|
|
2266
|
+
init_logger();
|
|
2190
2267
|
init_validateSafePath();
|
|
2191
2268
|
SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
|
|
2192
2269
|
USE_CLIENT_PATTERN = /^(?:\s|\/\/[^\n]*\n|\/\*[\s\S]*?\*\/)*(['"])use client\1/;
|
|
2270
|
+
REACT_COMPONENTS_SPECIFIER = /^@absolutejs\/absolute\/react\/components$/;
|
|
2193
2271
|
});
|
|
2194
2272
|
|
|
2195
2273
|
// src/build/wrapHTMLScript.ts
|
|
@@ -3463,6 +3541,19 @@ var init_ssrRender = __esm(() => {
|
|
|
3463
3541
|
selectorCache = new Map;
|
|
3464
3542
|
});
|
|
3465
3543
|
|
|
3544
|
+
// src/dev/client/cspNonce.ts
|
|
3545
|
+
var applyPageNonce = (element) => {
|
|
3546
|
+
const nonce = readPageNonce();
|
|
3547
|
+
if (nonce)
|
|
3548
|
+
element.nonce = nonce;
|
|
3549
|
+
return element;
|
|
3550
|
+
}, readPageNonce = () => {
|
|
3551
|
+
if (typeof document === "undefined")
|
|
3552
|
+
return;
|
|
3553
|
+
const carrier = document.querySelector("script[nonce], style[nonce]");
|
|
3554
|
+
return carrier?.nonce || undefined;
|
|
3555
|
+
};
|
|
3556
|
+
|
|
3466
3557
|
// src/angular/islands.ts
|
|
3467
3558
|
var angularIslandSelector = "abs-angular-island", getAngularIslandSelector = (_islandId) => angularIslandSelector, wrapperMetadataCache, requestRenderCache, getRequestRenderCache = () => {
|
|
3468
3559
|
const requestId = getSsrContextId();
|
|
@@ -4357,7 +4448,7 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
4357
4448
|
// src/build/stylePreprocessor.ts
|
|
4358
4449
|
import { existsSync as existsSync7, readFileSync as readFileSync5 } from "fs";
|
|
4359
4450
|
import { readFile as readFile2 } from "fs/promises";
|
|
4360
|
-
import { createRequire } from "module";
|
|
4451
|
+
import { createRequire as createRequire2 } from "module";
|
|
4361
4452
|
import {
|
|
4362
4453
|
dirname as dirname4,
|
|
4363
4454
|
extname as extname5,
|
|
@@ -4366,7 +4457,7 @@ import {
|
|
|
4366
4457
|
relative as relative6,
|
|
4367
4458
|
resolve as resolve9
|
|
4368
4459
|
} from "path";
|
|
4369
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
4460
|
+
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "url";
|
|
4370
4461
|
var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
4371
4462
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
4372
4463
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -4598,12 +4689,12 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
4598
4689
|
return result.css;
|
|
4599
4690
|
}, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
|
|
4600
4691
|
canonicalize(specifier, options) {
|
|
4601
|
-
const fromDirectory = options.containingUrl ? dirname4(
|
|
4692
|
+
const fromDirectory = options.containingUrl ? dirname4(fileURLToPath2(options.containingUrl)) : dirname4(entryFile);
|
|
4602
4693
|
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
4603
4694
|
return resolved ? new URL(pathToFileURL(resolve9(resolved)).href) : null;
|
|
4604
4695
|
},
|
|
4605
4696
|
load(canonicalUrl) {
|
|
4606
|
-
const filePath =
|
|
4697
|
+
const filePath = fileURLToPath2(canonicalUrl);
|
|
4607
4698
|
deps?.add(filePath);
|
|
4608
4699
|
const fileLanguage = getStyleLanguage(filePath);
|
|
4609
4700
|
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
@@ -4715,7 +4806,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
4715
4806
|
for (const url of loadedUrls) {
|
|
4716
4807
|
if (url.protocol !== "file:")
|
|
4717
4808
|
continue;
|
|
4718
|
-
const dep =
|
|
4809
|
+
const dep = fileURLToPath2(url);
|
|
4719
4810
|
if (resolve9(dep) === resolve9(filePath))
|
|
4720
4811
|
continue;
|
|
4721
4812
|
deps.add(dep);
|
|
@@ -4901,7 +4992,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
4901
4992
|
for (const url of loadedUrls) {
|
|
4902
4993
|
if (url.protocol !== "file:")
|
|
4903
4994
|
continue;
|
|
4904
|
-
const dep =
|
|
4995
|
+
const dep = fileURLToPath2(url);
|
|
4905
4996
|
if (resolve9(dep) === resolve9(filePath))
|
|
4906
4997
|
continue;
|
|
4907
4998
|
addStyleImporter(filePath, dep);
|
|
@@ -4923,7 +5014,7 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
4923
5014
|
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
4924
5015
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
4925
5016
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
4926
|
-
requireFromCwd =
|
|
5017
|
+
requireFromCwd = createRequire2(join9(process.cwd(), "package.json"));
|
|
4927
5018
|
styleDependencyGraph = new Map;
|
|
4928
5019
|
styleOutputHashes = new Map;
|
|
4929
5020
|
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
@@ -4956,10 +5047,25 @@ var init_lazyModule = __esm(() => {
|
|
|
4956
5047
|
LAZY_RESOLVED_KEY = Symbol.for("absolutejs.svelte.lazy-resolved");
|
|
4957
5048
|
});
|
|
4958
5049
|
|
|
5050
|
+
// src/core/islandServerGeneration.ts
|
|
5051
|
+
var readGeneration = () => globalThis.__absoluteIslandServerGeneration ?? 0, bumpIslandServerGeneration = () => {
|
|
5052
|
+
globalThis.__absoluteIslandServerGeneration = readGeneration() + 1;
|
|
5053
|
+
}, createIslandGenerationGuard = (reset) => {
|
|
5054
|
+
let seen = readGeneration();
|
|
5055
|
+
return () => {
|
|
5056
|
+
const current = readGeneration();
|
|
5057
|
+
if (current === seen)
|
|
5058
|
+
return current;
|
|
5059
|
+
seen = current;
|
|
5060
|
+
reset();
|
|
5061
|
+
return current;
|
|
5062
|
+
};
|
|
5063
|
+
};
|
|
5064
|
+
|
|
4959
5065
|
// src/core/svelteServerModule.ts
|
|
4960
5066
|
import { mkdir as mkdir2, readdir as readdir3 } from "fs/promises";
|
|
4961
5067
|
import { basename as basename3, dirname as dirname5, extname as extname6, join as join10, relative as relative7, resolve as resolve10 } from "path";
|
|
4962
|
-
var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
5068
|
+
var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandGeneration, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
4963
5069
|
const importPath = relative7(dirname5(from), target).replace(/\\/g, "/");
|
|
4964
5070
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
4965
5071
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
@@ -5026,7 +5132,9 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler,
|
|
|
5026
5132
|
}, getCachedModulePath2 = (sourcePath) => {
|
|
5027
5133
|
const relativeSourcePath = relative7(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
5028
5134
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
5029
|
-
|
|
5135
|
+
const generation = syncIslandGeneration();
|
|
5136
|
+
const generationSuffix = generation > 0 ? `.g${generation}` : "";
|
|
5137
|
+
return join10(serverCacheRoot2, `${normalizedSourcePath}${generationSuffix}.server.js`);
|
|
5030
5138
|
}, resolveSvelteImport = async (spec, from) => {
|
|
5031
5139
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
5032
5140
|
const resolved = resolvePackageImport(spec);
|
|
@@ -5058,6 +5166,7 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler,
|
|
|
5058
5166
|
}
|
|
5059
5167
|
await Bun.write(path, content);
|
|
5060
5168
|
}, compileSvelteServerModule = async (sourcePath) => {
|
|
5169
|
+
syncIslandGeneration();
|
|
5061
5170
|
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
5062
5171
|
if (cachedModulePath) {
|
|
5063
5172
|
return cachedModulePath;
|
|
@@ -5140,6 +5249,10 @@ var init_svelteServerModule = __esm(() => {
|
|
|
5140
5249
|
serverCacheRoot2 = join10(process.cwd(), ".absolutejs", "islands", "svelte");
|
|
5141
5250
|
compiledModuleCache2 = new Map;
|
|
5142
5251
|
originalSourcePathCache = new Map;
|
|
5252
|
+
syncIslandGeneration = createIslandGenerationGuard(() => {
|
|
5253
|
+
compiledModuleCache2.clear();
|
|
5254
|
+
originalSourcePathCache.clear();
|
|
5255
|
+
});
|
|
5143
5256
|
transpiler = new Bun.Transpiler({
|
|
5144
5257
|
loader: "ts",
|
|
5145
5258
|
target: "browser"
|
|
@@ -5147,8 +5260,8 @@ var init_svelteServerModule = __esm(() => {
|
|
|
5147
5260
|
});
|
|
5148
5261
|
|
|
5149
5262
|
// src/utils/isFile.ts
|
|
5150
|
-
import { statSync } from "fs";
|
|
5151
|
-
var isFile = (path) =>
|
|
5263
|
+
import { statSync as statSync2 } from "fs";
|
|
5264
|
+
var isFile = (path) => statSync2(path, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
5152
5265
|
var init_isFile = () => {};
|
|
5153
5266
|
|
|
5154
5267
|
// src/utils/vueCompiler.ts
|
|
@@ -5173,13 +5286,15 @@ import { readFileSync as readFileSync6, realpathSync } from "fs";
|
|
|
5173
5286
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
5174
5287
|
import { dirname as dirname6, join as join11, relative as relative8, resolve as resolve11 } from "path";
|
|
5175
5288
|
var {Transpiler: Transpiler2 } = globalThis.Bun;
|
|
5176
|
-
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
5289
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
5177
5290
|
const importPath = relative8(dirname6(from), target).replace(/\\/g, "/");
|
|
5178
5291
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
5179
5292
|
}, getCachedModulePath3 = (sourcePath) => {
|
|
5180
5293
|
const relativeSourcePath = relative8(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
5181
5294
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
5182
|
-
|
|
5295
|
+
const generation = syncIslandGeneration2();
|
|
5296
|
+
const generationSuffix = generation > 0 ? `.g${generation}` : "";
|
|
5297
|
+
return join11(serverCacheRoot3, `${normalizedSourcePath}${generationSuffix}.server.js`);
|
|
5183
5298
|
}, writeIfChanged2 = async (path, content) => {
|
|
5184
5299
|
const targetFile = Bun.file(path);
|
|
5185
5300
|
if (await targetFile.exists()) {
|
|
@@ -5206,6 +5321,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, tran
|
|
|
5206
5321
|
`) : nonVueLines.join(`
|
|
5207
5322
|
`);
|
|
5208
5323
|
}, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
|
|
5324
|
+
syncIslandGeneration2();
|
|
5209
5325
|
const cachedModulePath = compiledModuleCache3.get(sourcePath);
|
|
5210
5326
|
if (cachedModulePath)
|
|
5211
5327
|
return cachedModulePath;
|
|
@@ -5266,6 +5382,9 @@ var init_vueServerModule = __esm(() => {
|
|
|
5266
5382
|
init_isFile();
|
|
5267
5383
|
serverCacheRoot3 = join11(process.cwd(), ".absolutejs", "islands", "vue");
|
|
5268
5384
|
compiledModuleCache3 = new Map;
|
|
5385
|
+
syncIslandGeneration2 = createIslandGenerationGuard(() => {
|
|
5386
|
+
compiledModuleCache3.clear();
|
|
5387
|
+
});
|
|
5269
5388
|
transpiler2 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
5270
5389
|
});
|
|
5271
5390
|
|
|
@@ -5283,7 +5402,7 @@ var init_islandMarkupAttributes = __esm(() => {
|
|
|
5283
5402
|
});
|
|
5284
5403
|
|
|
5285
5404
|
// src/core/renderIslandMarkup.ts
|
|
5286
|
-
var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
|
|
5405
|
+
var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, syncIslandGeneration3, nextIslandId = () => {
|
|
5287
5406
|
islandSequence += 1;
|
|
5288
5407
|
return `island-${islandSequence}`;
|
|
5289
5408
|
}, isRecord6 = (value) => typeof value === "object" && value !== null, isReactServerIslandComponent = (value) => typeof value === "function", isSvelteServerIslandComponent = (value) => typeof value === "function", isVueServerIslandComponent = (value) => typeof value === "function" || isRecord6(value), isAngularServerIslandComponent = (value) => typeof value === "function", resolveBuildReferencePath = (source, registryPath) => {
|
|
@@ -5297,6 +5416,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
5297
5416
|
const loadedModule = await import(compiledModulePath);
|
|
5298
5417
|
return "default" in loadedModule ? loadedModule.default : loadedModule;
|
|
5299
5418
|
}, loadServerBuildComponent = async (buildReferencePath) => {
|
|
5419
|
+
syncIslandGeneration3();
|
|
5300
5420
|
const cachedBuildComponent = resolvedServerBuildComponentCache.get(buildReferencePath);
|
|
5301
5421
|
if (cachedBuildComponent) {
|
|
5302
5422
|
return cachedBuildComponent;
|
|
@@ -5335,6 +5455,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
5335
5455
|
}
|
|
5336
5456
|
return loadServerImportComponent(resolvedComponent);
|
|
5337
5457
|
}, resolveServerIslandComponent = async (component) => {
|
|
5458
|
+
syncIslandGeneration3();
|
|
5338
5459
|
const cachedResolvedComponent = resolvedServerComponentCache.get(component);
|
|
5339
5460
|
if (cachedResolvedComponent) {
|
|
5340
5461
|
return cachedResolvedComponent;
|
|
@@ -5433,6 +5554,10 @@ var init_renderIslandMarkup = __esm(() => {
|
|
|
5433
5554
|
init_islands();
|
|
5434
5555
|
resolvedServerComponentCache = new Map;
|
|
5435
5556
|
resolvedServerBuildComponentCache = new Map;
|
|
5557
|
+
syncIslandGeneration3 = createIslandGenerationGuard(() => {
|
|
5558
|
+
resolvedServerComponentCache.clear();
|
|
5559
|
+
resolvedServerBuildComponentCache.clear();
|
|
5560
|
+
});
|
|
5436
5561
|
});
|
|
5437
5562
|
|
|
5438
5563
|
// src/core/currentIslandRegistry.ts
|
|
@@ -5684,14 +5809,14 @@ var init_outputLogs = __esm(() => {
|
|
|
5684
5809
|
});
|
|
5685
5810
|
|
|
5686
5811
|
// src/build/stampedFileCache.ts
|
|
5687
|
-
import { statSync as
|
|
5812
|
+
import { statSync as statSync3 } from "fs";
|
|
5688
5813
|
var STAMP_SETTLE_MS = 2000, createStampedFileCache = () => {
|
|
5689
5814
|
const entries = new Map;
|
|
5690
5815
|
const seen = new Set;
|
|
5691
5816
|
const read = (path, compute) => {
|
|
5692
5817
|
let stamp;
|
|
5693
5818
|
try {
|
|
5694
|
-
const stats =
|
|
5819
|
+
const stats = statSync3(path);
|
|
5695
5820
|
stamp = { mtimeMs: stats.mtimeMs, size: stats.size };
|
|
5696
5821
|
} catch {
|
|
5697
5822
|
return compute();
|
|
@@ -6334,15 +6459,14 @@ var init_missingReactRouter = __esm(() => {
|
|
|
6334
6459
|
// src/build/scanRouteRegistrations.ts
|
|
6335
6460
|
import { readdirSync as readdirSync2, readFileSync as readFileSync12 } from "fs";
|
|
6336
6461
|
import { join as join17 } from "path";
|
|
6337
|
-
import ts2 from "typescript";
|
|
6338
6462
|
var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePath) => {
|
|
6339
6463
|
if (filePath.endsWith(".tsx"))
|
|
6340
|
-
return
|
|
6464
|
+
return lazyTypescript.ScriptKind.TSX;
|
|
6341
6465
|
if (filePath.endsWith(".mts"))
|
|
6342
|
-
return
|
|
6466
|
+
return lazyTypescript.ScriptKind.TS;
|
|
6343
6467
|
if (filePath.endsWith(".cts"))
|
|
6344
|
-
return
|
|
6345
|
-
return
|
|
6468
|
+
return lazyTypescript.ScriptKind.TS;
|
|
6469
|
+
return lazyTypescript.ScriptKind.TS;
|
|
6346
6470
|
}, hasSourceExtension = (filePath) => {
|
|
6347
6471
|
const idx = filePath.lastIndexOf(".");
|
|
6348
6472
|
if (idx === -1)
|
|
@@ -6392,15 +6516,15 @@ var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePat
|
|
|
6392
6516
|
}
|
|
6393
6517
|
if (!fileMayContainRouteRegistrations(source))
|
|
6394
6518
|
return;
|
|
6395
|
-
const sf =
|
|
6519
|
+
const sf = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind(filePath));
|
|
6396
6520
|
const visit = (node) => {
|
|
6397
|
-
if (
|
|
6521
|
+
if (lazyTypescript.isCallExpression(node)) {
|
|
6398
6522
|
const callee = node.expression;
|
|
6399
|
-
if (
|
|
6523
|
+
if (lazyTypescript.isPropertyAccessExpression(callee) && lazyTypescript.isIdentifier(callee.name)) {
|
|
6400
6524
|
const methodName = callee.name.text;
|
|
6401
6525
|
if (ELYSIA_ROUTE_METHODS.has(methodName)) {
|
|
6402
6526
|
const firstArg = node.arguments[0];
|
|
6403
|
-
if (firstArg &&
|
|
6527
|
+
if (firstArg && lazyTypescript.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
6404
6528
|
const argTexts = [];
|
|
6405
6529
|
for (let i = 1;i < node.arguments.length; i++) {
|
|
6406
6530
|
const arg = node.arguments[i];
|
|
@@ -6417,9 +6541,9 @@ var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePat
|
|
|
6417
6541
|
}
|
|
6418
6542
|
}
|
|
6419
6543
|
}
|
|
6420
|
-
|
|
6544
|
+
lazyTypescript.forEachChild(node, visit);
|
|
6421
6545
|
};
|
|
6422
|
-
|
|
6546
|
+
lazyTypescript.forEachChild(sf, visit);
|
|
6423
6547
|
}, scanRouteRegistrations = (projectRoot) => {
|
|
6424
6548
|
const files = collectSourceFiles(projectRoot);
|
|
6425
6549
|
const collected = [];
|
|
@@ -6429,6 +6553,7 @@ var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePat
|
|
|
6429
6553
|
return collected;
|
|
6430
6554
|
};
|
|
6431
6555
|
var init_scanRouteRegistrations = __esm(() => {
|
|
6556
|
+
init_lazyTypescript();
|
|
6432
6557
|
ELYSIA_ROUTE_METHODS = new Set([
|
|
6433
6558
|
"all",
|
|
6434
6559
|
"delete",
|
|
@@ -6694,17 +6819,16 @@ var init_devRouteRegistrationCallsite = __esm(() => {
|
|
|
6694
6819
|
// src/angular/staticAnalyzeSpaRoutes.ts
|
|
6695
6820
|
import { existsSync as existsSync13, promises as fs } from "fs";
|
|
6696
6821
|
import { join as join18 } from "path";
|
|
6697
|
-
import ts3 from "typescript";
|
|
6698
6822
|
var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN.test(seg) || seg === "**"), importsSymbolFrom = (sourceFile, localName, moduleSpecifier) => {
|
|
6699
6823
|
for (const statement of sourceFile.statements) {
|
|
6700
|
-
if (!
|
|
6824
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
6701
6825
|
continue;
|
|
6702
|
-
if (!
|
|
6826
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
6703
6827
|
continue;
|
|
6704
6828
|
if (statement.moduleSpecifier.text !== moduleSpecifier)
|
|
6705
6829
|
continue;
|
|
6706
6830
|
const named = statement.importClause?.namedBindings;
|
|
6707
|
-
if (!named || !
|
|
6831
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
6708
6832
|
continue;
|
|
6709
6833
|
for (const element of named.elements) {
|
|
6710
6834
|
if (element.name.text === localName)
|
|
@@ -6713,17 +6837,17 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6713
6837
|
}
|
|
6714
6838
|
return false;
|
|
6715
6839
|
}, readStringLiteral = (expression) => {
|
|
6716
|
-
if (
|
|
6840
|
+
if (lazyTypescript.isStringLiteral(expression) || lazyTypescript.isNoSubstitutionTemplateLiteral(expression)) {
|
|
6717
6841
|
return expression.text;
|
|
6718
6842
|
}
|
|
6719
6843
|
return null;
|
|
6720
6844
|
}, readPropertyKey = (property) => {
|
|
6721
|
-
if (
|
|
6845
|
+
if (lazyTypescript.isPropertyAssignment(property)) {
|
|
6722
6846
|
const { name } = property;
|
|
6723
|
-
if (
|
|
6847
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name))
|
|
6724
6848
|
return name.text;
|
|
6725
6849
|
}
|
|
6726
|
-
if (
|
|
6850
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
6727
6851
|
return property.name.text;
|
|
6728
6852
|
}
|
|
6729
6853
|
return null;
|
|
@@ -6732,20 +6856,20 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6732
6856
|
const visit = (node) => {
|
|
6733
6857
|
if (found)
|
|
6734
6858
|
return;
|
|
6735
|
-
if (
|
|
6859
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && lazyTypescript.isArrayLiteralExpression(node.initializer)) {
|
|
6736
6860
|
found = node.initializer;
|
|
6737
6861
|
return;
|
|
6738
6862
|
}
|
|
6739
|
-
|
|
6863
|
+
lazyTypescript.forEachChild(node, visit);
|
|
6740
6864
|
};
|
|
6741
|
-
|
|
6865
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
6742
6866
|
return found;
|
|
6743
6867
|
}, extractSitemapData = (dataLiteral) => {
|
|
6744
6868
|
for (const prop of dataLiteral.properties) {
|
|
6745
6869
|
const key = readPropertyKey(prop);
|
|
6746
6870
|
if (key !== "sitemap")
|
|
6747
6871
|
continue;
|
|
6748
|
-
if (!
|
|
6872
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
6749
6873
|
continue;
|
|
6750
6874
|
const value = readStringLiteral(prop.initializer);
|
|
6751
6875
|
if (value === "exclude")
|
|
@@ -6760,7 +6884,7 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6760
6884
|
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
6761
6885
|
}, extractRoutePaths = (routeArray, parentPath, parentExcluded, routes) => {
|
|
6762
6886
|
for (const element of routeArray.elements) {
|
|
6763
|
-
if (!
|
|
6887
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
6764
6888
|
continue;
|
|
6765
6889
|
let pathSegment = null;
|
|
6766
6890
|
let redirected = false;
|
|
@@ -6770,16 +6894,16 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6770
6894
|
const key = readPropertyKey(property);
|
|
6771
6895
|
if (!key)
|
|
6772
6896
|
continue;
|
|
6773
|
-
if (!
|
|
6897
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
6774
6898
|
continue;
|
|
6775
6899
|
if (key === "path") {
|
|
6776
6900
|
pathSegment = readStringLiteral(property.initializer);
|
|
6777
6901
|
} else if (key === "redirectTo") {
|
|
6778
6902
|
redirected = true;
|
|
6779
|
-
} else if (key === "data" &&
|
|
6903
|
+
} else if (key === "data" && lazyTypescript.isObjectLiteralExpression(property.initializer)) {
|
|
6780
6904
|
if (extractSitemapData(property.initializer))
|
|
6781
6905
|
sitemapExcluded = true;
|
|
6782
|
-
} else if (key === "children" &&
|
|
6906
|
+
} else if (key === "children" && lazyTypescript.isArrayLiteralExpression(property.initializer)) {
|
|
6783
6907
|
childrenLiteral = property.initializer;
|
|
6784
6908
|
}
|
|
6785
6909
|
}
|
|
@@ -6804,29 +6928,29 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6804
6928
|
const visit = (node) => {
|
|
6805
6929
|
if (result.found)
|
|
6806
6930
|
return;
|
|
6807
|
-
if (
|
|
6931
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "provideRouter") {
|
|
6808
6932
|
result.found = node.arguments[0] ?? null;
|
|
6809
6933
|
return;
|
|
6810
6934
|
}
|
|
6811
|
-
|
|
6935
|
+
lazyTypescript.forEachChild(node, visit);
|
|
6812
6936
|
};
|
|
6813
|
-
|
|
6937
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
6814
6938
|
return result.found;
|
|
6815
6939
|
}, findAppBaseHrefValue = (sourceFile) => {
|
|
6816
6940
|
let found = null;
|
|
6817
6941
|
const visit = (node) => {
|
|
6818
6942
|
if (found)
|
|
6819
6943
|
return;
|
|
6820
|
-
if (
|
|
6944
|
+
if (lazyTypescript.isObjectLiteralExpression(node)) {
|
|
6821
6945
|
let isAppBaseHref = false;
|
|
6822
6946
|
let value = null;
|
|
6823
6947
|
for (const property of node.properties) {
|
|
6824
6948
|
const key = readPropertyKey(property);
|
|
6825
6949
|
if (!key)
|
|
6826
6950
|
continue;
|
|
6827
|
-
if (!
|
|
6951
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
6828
6952
|
continue;
|
|
6829
|
-
if (key === "provide" &&
|
|
6953
|
+
if (key === "provide" && lazyTypescript.isIdentifier(property.initializer) && property.initializer.text === "APP_BASE_HREF") {
|
|
6830
6954
|
isAppBaseHref = true;
|
|
6831
6955
|
} else if (key === "useValue") {
|
|
6832
6956
|
value = readStringLiteral(property.initializer);
|
|
@@ -6837,9 +6961,9 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6837
6961
|
return;
|
|
6838
6962
|
}
|
|
6839
6963
|
}
|
|
6840
|
-
|
|
6964
|
+
lazyTypescript.forEachChild(node, visit);
|
|
6841
6965
|
};
|
|
6842
|
-
|
|
6966
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
6843
6967
|
return found;
|
|
6844
6968
|
}, analyzeFile = async (filePath) => {
|
|
6845
6969
|
let source;
|
|
@@ -6851,7 +6975,7 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6851
6975
|
if (!source.includes("APP_BASE_HREF") || !source.includes("provideRouter")) {
|
|
6852
6976
|
return null;
|
|
6853
6977
|
}
|
|
6854
|
-
const sourceFile =
|
|
6978
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
6855
6979
|
if (!importsSymbolFrom(sourceFile, "APP_BASE_HREF", "@angular/common"))
|
|
6856
6980
|
return null;
|
|
6857
6981
|
if (!importsSymbolFrom(sourceFile, "provideRouter", "@angular/router"))
|
|
@@ -6863,9 +6987,9 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6863
6987
|
if (!firstArg)
|
|
6864
6988
|
return null;
|
|
6865
6989
|
let routesArray = null;
|
|
6866
|
-
if (
|
|
6990
|
+
if (lazyTypescript.isIdentifier(firstArg)) {
|
|
6867
6991
|
routesArray = findRoutesArrayDeclaration(sourceFile, firstArg.text);
|
|
6868
|
-
} else if (
|
|
6992
|
+
} else if (lazyTypescript.isArrayLiteralExpression(firstArg)) {
|
|
6869
6993
|
routesArray = firstArg;
|
|
6870
6994
|
}
|
|
6871
6995
|
if (!routesArray)
|
|
@@ -6916,38 +7040,38 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
6916
7040
|
return pages;
|
|
6917
7041
|
};
|
|
6918
7042
|
var init_staticAnalyzeSpaRoutes = __esm(() => {
|
|
7043
|
+
init_lazyTypescript();
|
|
6919
7044
|
DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
|
|
6920
7045
|
});
|
|
6921
7046
|
|
|
6922
7047
|
// src/react/staticAnalyzeSpaRoutes.ts
|
|
6923
7048
|
import { existsSync as existsSync14, promises as fs2 } from "fs";
|
|
6924
7049
|
import { join as join19 } from "path";
|
|
6925
|
-
import ts4 from "typescript";
|
|
6926
7050
|
var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN2.test(seg) || seg === "**"), readStringLiteral2 = (expression) => {
|
|
6927
|
-
if (
|
|
7051
|
+
if (lazyTypescript.isStringLiteral(expression) || lazyTypescript.isNoSubstitutionTemplateLiteral(expression)) {
|
|
6928
7052
|
return expression.text;
|
|
6929
7053
|
}
|
|
6930
7054
|
return null;
|
|
6931
7055
|
}, readPropertyKey2 = (property) => {
|
|
6932
|
-
if (
|
|
7056
|
+
if (lazyTypescript.isPropertyAssignment(property)) {
|
|
6933
7057
|
const { name } = property;
|
|
6934
|
-
if (
|
|
7058
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name))
|
|
6935
7059
|
return name.text;
|
|
6936
7060
|
}
|
|
6937
|
-
if (
|
|
7061
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
6938
7062
|
return property.name.text;
|
|
6939
7063
|
}
|
|
6940
7064
|
return null;
|
|
6941
7065
|
}, importsSymbolFromAny = (sourceFile, localName, moduleSpecifiers) => {
|
|
6942
7066
|
for (const statement of sourceFile.statements) {
|
|
6943
|
-
if (!
|
|
7067
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
6944
7068
|
continue;
|
|
6945
|
-
if (!
|
|
7069
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
6946
7070
|
continue;
|
|
6947
7071
|
if (!moduleSpecifiers.includes(statement.moduleSpecifier.text))
|
|
6948
7072
|
continue;
|
|
6949
7073
|
const named = statement.importClause?.namedBindings;
|
|
6950
|
-
if (!named || !
|
|
7074
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
6951
7075
|
continue;
|
|
6952
7076
|
for (const element of named.elements) {
|
|
6953
7077
|
if (element.name.text === localName)
|
|
@@ -6960,13 +7084,13 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
6960
7084
|
const visit = (node) => {
|
|
6961
7085
|
if (found)
|
|
6962
7086
|
return;
|
|
6963
|
-
if (
|
|
7087
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && lazyTypescript.isArrayLiteralExpression(node.initializer)) {
|
|
6964
7088
|
found = node.initializer;
|
|
6965
7089
|
return;
|
|
6966
7090
|
}
|
|
6967
|
-
|
|
7091
|
+
lazyTypescript.forEachChild(node, visit);
|
|
6968
7092
|
};
|
|
6969
|
-
|
|
7093
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
6970
7094
|
return found;
|
|
6971
7095
|
}, joinSegments2 = (parent, child) => {
|
|
6972
7096
|
if (!child)
|
|
@@ -6976,7 +7100,7 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
6976
7100
|
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
6977
7101
|
}, extractRouteEntries = (routeArray, parentPath, routes) => {
|
|
6978
7102
|
for (const element of routeArray.elements) {
|
|
6979
|
-
if (!
|
|
7103
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
6980
7104
|
continue;
|
|
6981
7105
|
let pathSegment = null;
|
|
6982
7106
|
let redirected = false;
|
|
@@ -6987,22 +7111,22 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
6987
7111
|
const key = readPropertyKey2(property);
|
|
6988
7112
|
if (!key)
|
|
6989
7113
|
continue;
|
|
6990
|
-
if (!
|
|
7114
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
6991
7115
|
continue;
|
|
6992
7116
|
if (key === "path") {
|
|
6993
7117
|
pathSegment = readStringLiteral2(property.initializer);
|
|
6994
7118
|
} else if (key === "index") {
|
|
6995
7119
|
isIndex = true;
|
|
6996
|
-
} else if (key === "loader" || key === "lazy") {} else if (key === "children" &&
|
|
7120
|
+
} else if (key === "loader" || key === "lazy") {} else if (key === "children" && lazyTypescript.isArrayLiteralExpression(property.initializer)) {
|
|
6997
7121
|
childrenLiteral = property.initializer;
|
|
6998
7122
|
} else if (key === "redirectTo") {
|
|
6999
7123
|
redirected = true;
|
|
7000
|
-
} else if (key === "handle" &&
|
|
7124
|
+
} else if (key === "handle" && lazyTypescript.isObjectLiteralExpression(property.initializer)) {
|
|
7001
7125
|
for (const handleProp of property.initializer.properties) {
|
|
7002
7126
|
const handleKey = readPropertyKey2(handleProp);
|
|
7003
7127
|
if (handleKey !== "sitemap")
|
|
7004
7128
|
continue;
|
|
7005
|
-
if (!
|
|
7129
|
+
if (!lazyTypescript.isPropertyAssignment(handleProp))
|
|
7006
7130
|
continue;
|
|
7007
7131
|
const value = readStringLiteral2(handleProp.initializer);
|
|
7008
7132
|
if (value === "exclude")
|
|
@@ -7032,22 +7156,22 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
7032
7156
|
const visit = (node) => {
|
|
7033
7157
|
if (result.found)
|
|
7034
7158
|
return;
|
|
7035
|
-
if (
|
|
7159
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "createBrowserRouter") {
|
|
7036
7160
|
result.found = node;
|
|
7037
7161
|
return;
|
|
7038
7162
|
}
|
|
7039
|
-
|
|
7163
|
+
lazyTypescript.forEachChild(node, visit);
|
|
7040
7164
|
};
|
|
7041
|
-
|
|
7165
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
7042
7166
|
return result.found;
|
|
7043
7167
|
}, readBasenameFromOptions = (expression) => {
|
|
7044
|
-
if (!expression || !
|
|
7168
|
+
if (!expression || !lazyTypescript.isObjectLiteralExpression(expression))
|
|
7045
7169
|
return null;
|
|
7046
7170
|
for (const property of expression.properties) {
|
|
7047
7171
|
const key = readPropertyKey2(property);
|
|
7048
7172
|
if (key !== "basename")
|
|
7049
7173
|
continue;
|
|
7050
|
-
if (!
|
|
7174
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
7051
7175
|
continue;
|
|
7052
7176
|
const value = readStringLiteral2(property.initializer);
|
|
7053
7177
|
if (value !== null)
|
|
@@ -7063,7 +7187,7 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
7063
7187
|
}
|
|
7064
7188
|
if (!source.includes("createBrowserRouter"))
|
|
7065
7189
|
return null;
|
|
7066
|
-
const sourceFile =
|
|
7190
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, filePath.endsWith(".tsx") ? lazyTypescript.ScriptKind.TSX : lazyTypescript.ScriptKind.TS);
|
|
7067
7191
|
if (!importsSymbolFromAny(sourceFile, "createBrowserRouter", [
|
|
7068
7192
|
"react-router-dom",
|
|
7069
7193
|
"react-router"
|
|
@@ -7077,9 +7201,9 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
7077
7201
|
if (!routesArg)
|
|
7078
7202
|
return null;
|
|
7079
7203
|
let routesArray = null;
|
|
7080
|
-
if (
|
|
7204
|
+
if (lazyTypescript.isArrayLiteralExpression(routesArg)) {
|
|
7081
7205
|
routesArray = routesArg;
|
|
7082
|
-
} else if (
|
|
7206
|
+
} else if (lazyTypescript.isIdentifier(routesArg)) {
|
|
7083
7207
|
routesArray = findVariableArrayDeclaration(sourceFile, routesArg.text);
|
|
7084
7208
|
}
|
|
7085
7209
|
if (!routesArray)
|
|
@@ -7126,6 +7250,7 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
7126
7250
|
return hosts;
|
|
7127
7251
|
};
|
|
7128
7252
|
var init_staticAnalyzeSpaRoutes2 = __esm(() => {
|
|
7253
|
+
init_lazyTypescript();
|
|
7129
7254
|
DYNAMIC_SEGMENT_PATTERN2 = /^[:*]/;
|
|
7130
7255
|
});
|
|
7131
7256
|
|
|
@@ -7261,32 +7386,31 @@ var init_staticAnalyzeSpaRoutes3 = __esm(() => {
|
|
|
7261
7386
|
// src/vue/staticAnalyzeSpaRoutes.ts
|
|
7262
7387
|
import { existsSync as existsSync16, promises as fs4 } from "fs";
|
|
7263
7388
|
import { join as join21 } from "path";
|
|
7264
|
-
import ts5 from "typescript";
|
|
7265
7389
|
var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN4.test(seg) || seg === "**"), readStringLiteral3 = (expression) => {
|
|
7266
|
-
if (
|
|
7390
|
+
if (lazyTypescript.isStringLiteral(expression) || lazyTypescript.isNoSubstitutionTemplateLiteral(expression)) {
|
|
7267
7391
|
return expression.text;
|
|
7268
7392
|
}
|
|
7269
7393
|
return null;
|
|
7270
7394
|
}, readPropertyKey3 = (property) => {
|
|
7271
|
-
if (
|
|
7395
|
+
if (lazyTypescript.isPropertyAssignment(property)) {
|
|
7272
7396
|
const { name } = property;
|
|
7273
|
-
if (
|
|
7397
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name))
|
|
7274
7398
|
return name.text;
|
|
7275
7399
|
}
|
|
7276
|
-
if (
|
|
7400
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
7277
7401
|
return property.name.text;
|
|
7278
7402
|
}
|
|
7279
7403
|
return null;
|
|
7280
7404
|
}, importsSymbolFrom2 = (sourceFile, localName, moduleSpecifier) => {
|
|
7281
7405
|
for (const statement of sourceFile.statements) {
|
|
7282
|
-
if (!
|
|
7406
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
7283
7407
|
continue;
|
|
7284
|
-
if (!
|
|
7408
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
7285
7409
|
continue;
|
|
7286
7410
|
if (statement.moduleSpecifier.text !== moduleSpecifier)
|
|
7287
7411
|
continue;
|
|
7288
7412
|
const named = statement.importClause?.namedBindings;
|
|
7289
|
-
if (!named || !
|
|
7413
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
7290
7414
|
continue;
|
|
7291
7415
|
for (const element of named.elements) {
|
|
7292
7416
|
if (element.name.text === localName)
|
|
@@ -7299,13 +7423,13 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7299
7423
|
const visit = (node) => {
|
|
7300
7424
|
if (found)
|
|
7301
7425
|
return;
|
|
7302
|
-
if (
|
|
7426
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && lazyTypescript.isArrayLiteralExpression(node.initializer)) {
|
|
7303
7427
|
found = node.initializer;
|
|
7304
7428
|
return;
|
|
7305
7429
|
}
|
|
7306
|
-
|
|
7430
|
+
lazyTypescript.forEachChild(node, visit);
|
|
7307
7431
|
};
|
|
7308
|
-
|
|
7432
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
7309
7433
|
return found;
|
|
7310
7434
|
}, joinSegments4 = (parent, child) => {
|
|
7311
7435
|
if (!child)
|
|
@@ -7315,7 +7439,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7315
7439
|
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
7316
7440
|
}, extractRouteEntries2 = (routeArray, parentPath, routes) => {
|
|
7317
7441
|
for (const element of routeArray.elements) {
|
|
7318
|
-
if (!
|
|
7442
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
7319
7443
|
continue;
|
|
7320
7444
|
let pathSegment = null;
|
|
7321
7445
|
let redirected = false;
|
|
@@ -7326,7 +7450,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7326
7450
|
const key = readPropertyKey3(property);
|
|
7327
7451
|
if (!key)
|
|
7328
7452
|
continue;
|
|
7329
|
-
if (!
|
|
7453
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
7330
7454
|
continue;
|
|
7331
7455
|
if (key === "path") {
|
|
7332
7456
|
pathSegment = readStringLiteral3(property.initializer);
|
|
@@ -7334,14 +7458,14 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7334
7458
|
alias = readStringLiteral3(property.initializer);
|
|
7335
7459
|
} else if (key === "redirect") {
|
|
7336
7460
|
redirected = true;
|
|
7337
|
-
} else if (key === "children" &&
|
|
7461
|
+
} else if (key === "children" && lazyTypescript.isArrayLiteralExpression(property.initializer)) {
|
|
7338
7462
|
childrenLiteral = property.initializer;
|
|
7339
|
-
} else if (key === "meta" &&
|
|
7463
|
+
} else if (key === "meta" && lazyTypescript.isObjectLiteralExpression(property.initializer)) {
|
|
7340
7464
|
for (const metaProp of property.initializer.properties) {
|
|
7341
7465
|
const metaKey = readPropertyKey3(metaProp);
|
|
7342
7466
|
if (metaKey !== "sitemap")
|
|
7343
7467
|
continue;
|
|
7344
|
-
if (!
|
|
7468
|
+
if (!lazyTypescript.isPropertyAssignment(metaProp))
|
|
7345
7469
|
continue;
|
|
7346
7470
|
const value = readStringLiteral3(metaProp.initializer);
|
|
7347
7471
|
if (value === "exclude")
|
|
@@ -7378,16 +7502,16 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7378
7502
|
const visit = (node) => {
|
|
7379
7503
|
if (found)
|
|
7380
7504
|
return;
|
|
7381
|
-
if (
|
|
7505
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "defineRoutes") {
|
|
7382
7506
|
const [routesArgument] = node.arguments;
|
|
7383
|
-
if (!routesArgument || !
|
|
7507
|
+
if (!routesArgument || !lazyTypescript.isArrayLiteralExpression(routesArgument))
|
|
7384
7508
|
return;
|
|
7385
7509
|
found = routesArgument;
|
|
7386
7510
|
return;
|
|
7387
7511
|
}
|
|
7388
|
-
|
|
7512
|
+
lazyTypescript.forEachChild(node, visit);
|
|
7389
7513
|
};
|
|
7390
|
-
|
|
7514
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
7391
7515
|
return found;
|
|
7392
7516
|
}, inferBaseHref = (routes) => {
|
|
7393
7517
|
const firstSegments = routes.map((route) => route.path.split("/").filter(Boolean)[0]).filter((segment) => Boolean(segment));
|
|
@@ -7400,20 +7524,20 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7400
7524
|
const visit = (node) => {
|
|
7401
7525
|
if (result.found)
|
|
7402
7526
|
return;
|
|
7403
|
-
if (
|
|
7527
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "createRouter") {
|
|
7404
7528
|
result.found = node;
|
|
7405
7529
|
return;
|
|
7406
7530
|
}
|
|
7407
|
-
|
|
7531
|
+
lazyTypescript.forEachChild(node, visit);
|
|
7408
7532
|
};
|
|
7409
|
-
|
|
7533
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
7410
7534
|
return result.found;
|
|
7411
7535
|
}, findCreateWebHistoryBase = (sourceFile) => {
|
|
7412
7536
|
let found = null;
|
|
7413
7537
|
const visit = (node) => {
|
|
7414
7538
|
if (found)
|
|
7415
7539
|
return;
|
|
7416
|
-
if (
|
|
7540
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && (node.expression.text === "createWebHistory" || node.expression.text === "createWebHashHistory")) {
|
|
7417
7541
|
const [baseArg] = node.arguments;
|
|
7418
7542
|
if (baseArg) {
|
|
7419
7543
|
const text = readStringLiteral3(baseArg);
|
|
@@ -7426,26 +7550,26 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7426
7550
|
return;
|
|
7427
7551
|
}
|
|
7428
7552
|
}
|
|
7429
|
-
|
|
7553
|
+
lazyTypescript.forEachChild(node, visit);
|
|
7430
7554
|
};
|
|
7431
|
-
|
|
7555
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
7432
7556
|
return found;
|
|
7433
7557
|
}, readRoutesFromCreateRouterOptions = (sourceFile, optionsExpr) => {
|
|
7434
|
-
if (!
|
|
7558
|
+
if (!lazyTypescript.isObjectLiteralExpression(optionsExpr))
|
|
7435
7559
|
return null;
|
|
7436
7560
|
for (const property of optionsExpr.properties) {
|
|
7437
7561
|
const key = readPropertyKey3(property);
|
|
7438
7562
|
if (key !== "routes")
|
|
7439
7563
|
continue;
|
|
7440
|
-
if (
|
|
7564
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
7441
7565
|
return findVariableArrayDeclaration2(sourceFile, property.name.text);
|
|
7442
7566
|
}
|
|
7443
|
-
if (!
|
|
7567
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
7444
7568
|
continue;
|
|
7445
|
-
if (
|
|
7569
|
+
if (lazyTypescript.isArrayLiteralExpression(property.initializer)) {
|
|
7446
7570
|
return property.initializer;
|
|
7447
7571
|
}
|
|
7448
|
-
if (
|
|
7572
|
+
if (lazyTypescript.isIdentifier(property.initializer)) {
|
|
7449
7573
|
return findVariableArrayDeclaration2(sourceFile, property.initializer.text);
|
|
7450
7574
|
}
|
|
7451
7575
|
}
|
|
@@ -7470,7 +7594,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7470
7594
|
}
|
|
7471
7595
|
if (!analysisSource.includes("createRouter") && !analysisSource.includes("defineRoutes"))
|
|
7472
7596
|
return null;
|
|
7473
|
-
const sourceFile =
|
|
7597
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, analysisSource, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
7474
7598
|
const defineRoutesArray = findDefineRoutesArray(sourceFile);
|
|
7475
7599
|
const call = importsSymbolFrom2(sourceFile, "createRouter", "vue-router") ? findCreateRouterCall(sourceFile) : null;
|
|
7476
7600
|
const [optionsArg] = call?.arguments ?? [];
|
|
@@ -7519,6 +7643,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
7519
7643
|
return hosts;
|
|
7520
7644
|
};
|
|
7521
7645
|
var init_staticAnalyzeSpaRoutes4 = __esm(() => {
|
|
7646
|
+
init_lazyTypescript();
|
|
7522
7647
|
DYNAMIC_SEGMENT_PATTERN4 = /^[:*]/;
|
|
7523
7648
|
});
|
|
7524
7649
|
|
|
@@ -13925,15 +14050,14 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
13925
14050
|
|
|
13926
14051
|
// src/build/bunStringRawUnicodePlugin.ts
|
|
13927
14052
|
import { extname as extname12 } from "path";
|
|
13928
|
-
import ts6 from "typescript";
|
|
13929
14053
|
var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
13930
14054
|
if (/\.[cm]?tsx$/.test(filePath))
|
|
13931
|
-
return
|
|
14055
|
+
return lazyTypescript.ScriptKind.TSX;
|
|
13932
14056
|
if (/\.[cm]?jsx$/.test(filePath))
|
|
13933
|
-
return
|
|
14057
|
+
return lazyTypescript.ScriptKind.JSX;
|
|
13934
14058
|
if (/\.[cm]?ts$/.test(filePath))
|
|
13935
|
-
return
|
|
13936
|
-
return
|
|
14059
|
+
return lazyTypescript.ScriptKind.TS;
|
|
14060
|
+
return lazyTypescript.ScriptKind.JS;
|
|
13937
14061
|
}, getLoader = (filePath) => {
|
|
13938
14062
|
const extension = extname12(filePath);
|
|
13939
14063
|
if (extension === ".tsx")
|
|
@@ -13944,19 +14068,19 @@ var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
|
13944
14068
|
return "ts";
|
|
13945
14069
|
}
|
|
13946
14070
|
return "js";
|
|
13947
|
-
}, isStringRawTag = (node) =>
|
|
14071
|
+
}, isStringRawTag = (node) => lazyTypescript.isPropertyAccessExpression(node.tag) && lazyTypescript.isIdentifier(node.tag.expression) && node.tag.expression.text === "String" && node.tag.name.text === "raw", getRawText = (node) => node.rawText ?? node.text, rewriteBunStringRawUnicode = (source, filePath = "input.ts") => {
|
|
13948
14072
|
if (!source.includes("String.raw") || !NON_ASCII.test(source))
|
|
13949
14073
|
return source;
|
|
13950
|
-
const sourceFile =
|
|
14074
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind2(filePath));
|
|
13951
14075
|
const replacements = [];
|
|
13952
14076
|
const visit = (node) => {
|
|
13953
|
-
if (
|
|
13954
|
-
const rawSegments =
|
|
14077
|
+
if (lazyTypescript.isTaggedTemplateExpression(node) && isStringRawTag(node)) {
|
|
14078
|
+
const rawSegments = lazyTypescript.isNoSubstitutionTemplateLiteral(node.template) ? [getRawText(node.template)] : [
|
|
13955
14079
|
getRawText(node.template.head),
|
|
13956
14080
|
...node.template.templateSpans.map((span) => getRawText(span.literal))
|
|
13957
14081
|
];
|
|
13958
14082
|
if (rawSegments.some((segment) => NON_ASCII.test(segment))) {
|
|
13959
|
-
const expressions =
|
|
14083
|
+
const expressions = lazyTypescript.isTemplateExpression(node.template) ? node.template.templateSpans.map((span) => {
|
|
13960
14084
|
const expression = source.slice(span.expression.getStart(sourceFile), span.expression.end);
|
|
13961
14085
|
return rewriteBunStringRawUnicode(expression, filePath);
|
|
13962
14086
|
}) : [];
|
|
@@ -13972,7 +14096,7 @@ var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
|
13972
14096
|
return;
|
|
13973
14097
|
}
|
|
13974
14098
|
}
|
|
13975
|
-
|
|
14099
|
+
lazyTypescript.forEachChild(node, visit);
|
|
13976
14100
|
};
|
|
13977
14101
|
visit(sourceFile);
|
|
13978
14102
|
let result = source;
|
|
@@ -13995,11 +14119,12 @@ var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
|
13995
14119
|
}
|
|
13996
14120
|
});
|
|
13997
14121
|
var init_bunStringRawUnicodePlugin = __esm(() => {
|
|
14122
|
+
init_lazyTypescript();
|
|
13998
14123
|
NON_ASCII = /[^\x00-\x7f]/;
|
|
13999
14124
|
});
|
|
14000
14125
|
|
|
14001
14126
|
// src/build/externalAssetPlugin.ts
|
|
14002
|
-
import { copyFileSync, existsSync as existsSync26, mkdirSync as mkdirSync10, statSync as
|
|
14127
|
+
import { copyFileSync, existsSync as existsSync26, mkdirSync as mkdirSync10, statSync as statSync4 } from "fs";
|
|
14003
14128
|
import { basename as basename9, dirname as dirname18, join as join29, resolve as resolve21 } from "path";
|
|
14004
14129
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
14005
14130
|
name: "absolute-external-asset",
|
|
@@ -14023,7 +14148,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
14023
14148
|
const assetPath = resolve21(sourceDir, relPath);
|
|
14024
14149
|
if (!existsSync26(assetPath))
|
|
14025
14150
|
continue;
|
|
14026
|
-
if (!
|
|
14151
|
+
if (!statSync4(assetPath).isFile())
|
|
14027
14152
|
continue;
|
|
14028
14153
|
const targetPath = join29(outDir, basename9(assetPath));
|
|
14029
14154
|
if (existsSync26(targetPath))
|
|
@@ -14039,25 +14164,24 @@ var init_externalAssetPlugin = () => {};
|
|
|
14039
14164
|
|
|
14040
14165
|
// src/build/islandRegistryTransform.ts
|
|
14041
14166
|
import { basename as basename10 } from "path";
|
|
14042
|
-
|
|
14043
|
-
var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name) || ts7.isStringLiteral(name) ? name.text : null, isIslandRegistryHelperImport2 = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands"), collectRegistryFactory = (sourceFile) => {
|
|
14167
|
+
var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name) ? name.text : null, isIslandRegistryHelperImport2 = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands"), collectRegistryFactory = (sourceFile) => {
|
|
14044
14168
|
const factoryNames = new Set;
|
|
14045
14169
|
const namespaceNames = new Set;
|
|
14046
14170
|
for (const statement of sourceFile.statements) {
|
|
14047
|
-
if (!
|
|
14171
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
14048
14172
|
continue;
|
|
14049
|
-
if (!
|
|
14173
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
14050
14174
|
continue;
|
|
14051
14175
|
if (!isIslandRegistryHelperImport2(statement.moduleSpecifier.text))
|
|
14052
14176
|
continue;
|
|
14053
14177
|
const bindings = statement.importClause?.namedBindings;
|
|
14054
14178
|
if (!bindings)
|
|
14055
14179
|
continue;
|
|
14056
|
-
if (
|
|
14180
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
14057
14181
|
namespaceNames.add(bindings.name.text);
|
|
14058
14182
|
continue;
|
|
14059
14183
|
}
|
|
14060
|
-
if (!
|
|
14184
|
+
if (!lazyTypescript.isNamedImports(bindings))
|
|
14061
14185
|
continue;
|
|
14062
14186
|
for (const element of bindings.elements) {
|
|
14063
14187
|
const imported = element.propertyName?.text ?? element.name.text;
|
|
@@ -14068,20 +14192,20 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name)
|
|
|
14068
14192
|
}
|
|
14069
14193
|
return { factoryNames, namespaceNames };
|
|
14070
14194
|
}, isDefineIslandRegistryCall2 = (expression, factoryNames, namespaceNames) => {
|
|
14071
|
-
if (
|
|
14195
|
+
if (lazyTypescript.isIdentifier(expression))
|
|
14072
14196
|
return factoryNames.has(expression.text);
|
|
14073
|
-
return
|
|
14197
|
+
return lazyTypescript.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && lazyTypescript.isIdentifier(expression.expression) && namespaceNames.has(expression.expression.text);
|
|
14074
14198
|
}, findDefineIslandRegistryCall = (sourceFile, factoryNames, namespaceNames) => {
|
|
14075
14199
|
let found = null;
|
|
14076
14200
|
const visit = (node) => {
|
|
14077
14201
|
if (found)
|
|
14078
14202
|
return;
|
|
14079
|
-
const [firstArg] =
|
|
14080
|
-
if (
|
|
14203
|
+
const [firstArg] = lazyTypescript.isCallExpression(node) ? node.arguments : [];
|
|
14204
|
+
if (lazyTypescript.isCallExpression(node) && isDefineIslandRegistryCall2(node.expression, factoryNames, namespaceNames) && firstArg && lazyTypescript.isObjectLiteralExpression(firstArg)) {
|
|
14081
14205
|
found = node;
|
|
14082
14206
|
return;
|
|
14083
14207
|
}
|
|
14084
|
-
|
|
14208
|
+
lazyTypescript.forEachChild(node, visit);
|
|
14085
14209
|
};
|
|
14086
14210
|
visit(sourceFile);
|
|
14087
14211
|
return found;
|
|
@@ -14091,8 +14215,8 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name)
|
|
|
14091
14215
|
}, transformIslandRegistrySource = (source, filePath, info) => {
|
|
14092
14216
|
if (!source.includes("defineIslandRegistry"))
|
|
14093
14217
|
return null;
|
|
14094
|
-
const scriptKind = filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ?
|
|
14095
|
-
const sourceFile =
|
|
14218
|
+
const scriptKind = filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ? lazyTypescript.ScriptKind.TSX : lazyTypescript.ScriptKind.TS;
|
|
14219
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, scriptKind);
|
|
14096
14220
|
const { factoryNames, namespaceNames } = collectRegistryFactory(sourceFile);
|
|
14097
14221
|
if (factoryNames.size === 0 && namespaceNames.size === 0)
|
|
14098
14222
|
return null;
|
|
@@ -14100,7 +14224,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name)
|
|
|
14100
14224
|
if (!call)
|
|
14101
14225
|
return null;
|
|
14102
14226
|
const [objectLiteral] = call.arguments;
|
|
14103
|
-
if (!objectLiteral || !
|
|
14227
|
+
if (!objectLiteral || !lazyTypescript.isObjectLiteralExpression(objectLiteral)) {
|
|
14104
14228
|
return null;
|
|
14105
14229
|
}
|
|
14106
14230
|
const definitionLookup = new Map;
|
|
@@ -14115,20 +14239,20 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name)
|
|
|
14115
14239
|
const edits = [];
|
|
14116
14240
|
const replacedLocals = new Set;
|
|
14117
14241
|
for (const frameworkProperty of objectLiteral.properties) {
|
|
14118
|
-
if (!
|
|
14242
|
+
if (!lazyTypescript.isPropertyAssignment(frameworkProperty))
|
|
14119
14243
|
continue;
|
|
14120
14244
|
const frameworkName = getObjectPropertyName2(frameworkProperty.name);
|
|
14121
14245
|
const framework = VALID_FRAMEWORKS.find((f) => f === frameworkName);
|
|
14122
14246
|
if (!framework)
|
|
14123
14247
|
continue;
|
|
14124
|
-
if (!
|
|
14248
|
+
if (!lazyTypescript.isObjectLiteralExpression(frameworkProperty.initializer))
|
|
14125
14249
|
continue;
|
|
14126
14250
|
for (const componentProperty of frameworkProperty.initializer.properties) {
|
|
14127
14251
|
let componentKey = null;
|
|
14128
14252
|
let localName = null;
|
|
14129
14253
|
let replaceNode = null;
|
|
14130
14254
|
let replacementText = "";
|
|
14131
|
-
if (
|
|
14255
|
+
if (lazyTypescript.isShorthandPropertyAssignment(componentProperty)) {
|
|
14132
14256
|
componentKey = componentProperty.name.text;
|
|
14133
14257
|
localName = componentProperty.name.text;
|
|
14134
14258
|
const reference = definitionLookup.get(`${framework}:${componentKey}`);
|
|
@@ -14136,7 +14260,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name)
|
|
|
14136
14260
|
continue;
|
|
14137
14261
|
replaceNode = componentProperty;
|
|
14138
14262
|
replacementText = `${quoteKey(componentKey)}: ${definitionLiteral(reference)}`;
|
|
14139
|
-
} else if (
|
|
14263
|
+
} else if (lazyTypescript.isPropertyAssignment(componentProperty) && lazyTypescript.isIdentifier(componentProperty.initializer)) {
|
|
14140
14264
|
componentKey = getObjectPropertyName2(componentProperty.name);
|
|
14141
14265
|
localName = componentProperty.initializer.text;
|
|
14142
14266
|
if (!componentKey)
|
|
@@ -14160,7 +14284,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name)
|
|
|
14160
14284
|
if (edits.length === 0)
|
|
14161
14285
|
return null;
|
|
14162
14286
|
for (const statement of sourceFile.statements) {
|
|
14163
|
-
if (!
|
|
14287
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
14164
14288
|
continue;
|
|
14165
14289
|
const clause = statement.importClause;
|
|
14166
14290
|
if (!clause)
|
|
@@ -14169,11 +14293,11 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name)
|
|
|
14169
14293
|
if (clause.name)
|
|
14170
14294
|
localNames.push(clause.name.text);
|
|
14171
14295
|
const bindings = clause.namedBindings;
|
|
14172
|
-
if (bindings &&
|
|
14296
|
+
if (bindings && lazyTypescript.isNamedImports(bindings)) {
|
|
14173
14297
|
for (const element of bindings.elements) {
|
|
14174
14298
|
localNames.push(element.name.text);
|
|
14175
14299
|
}
|
|
14176
|
-
} else if (bindings &&
|
|
14300
|
+
} else if (bindings && lazyTypescript.isNamespaceImport(bindings)) {
|
|
14177
14301
|
localNames.push(bindings.name.text);
|
|
14178
14302
|
}
|
|
14179
14303
|
if (localNames.length === 0)
|
|
@@ -14221,6 +14345,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts7.isIdentifier(name)
|
|
|
14221
14345
|
};
|
|
14222
14346
|
};
|
|
14223
14347
|
var init_islandRegistryTransform = __esm(() => {
|
|
14348
|
+
init_lazyTypescript();
|
|
14224
14349
|
VALID_FRAMEWORKS = [
|
|
14225
14350
|
"react",
|
|
14226
14351
|
"svelte",
|
|
@@ -15497,8 +15622,7 @@ var isTestSourcePath = (file) => {
|
|
|
15497
15622
|
// src/mobile/deviceCapabilities.ts
|
|
15498
15623
|
import { existsSync as existsSync29, readFileSync as readFileSync22 } from "fs";
|
|
15499
15624
|
import { extname as extname13, join as join35, relative as relative19, resolve as resolve26 } from "path";
|
|
15500
|
-
import { fileURLToPath as
|
|
15501
|
-
import ts8 from "typescript";
|
|
15625
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
15502
15626
|
var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES, ADAPTERS2, SOURCE_GLOB, IGNORED_DIRECTORIES, IDENTIFIER_PATTERN, providerModulePattern = (provider) => new RegExp(`^@absolutejs/devices-${provider}/[a-z][a-z0-9-]*$`, "u"), providerPackagePattern = (provider) => provider === "capacitor" ? /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u : /^(?:expo-[a-z][a-z0-9-]*|@react-native-[a-z0-9-]+\/[a-z][a-z0-9-]*)@\d+\.\d+\.\d+$/u, providerLabel = (provider) => provider === "capacitor" ? "Capacitor" : "Expo", ANDROID_PERMISSION_PATTERN, IOS_USAGE_DESCRIPTIONS, IOS_PRIVACY_ACCESSED_API_REASONS, IOS_PRIVACY_ACCESSED_APIS, object = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
|
|
15503
15627
|
const value = JSON.parse(readFileSync22(path, "utf8"));
|
|
15504
15628
|
if (!object(value))
|
|
@@ -15624,7 +15748,7 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABI
|
|
|
15624
15748
|
};
|
|
15625
15749
|
}, resolveAdapterManifest = (adapter, provider) => {
|
|
15626
15750
|
try {
|
|
15627
|
-
return
|
|
15751
|
+
return fileURLToPath3(import.meta.resolve(`${adapter}/package.json`));
|
|
15628
15752
|
} catch {
|
|
15629
15753
|
throw new TypeError(`${adapter} is not installed. Run \`absolute mobile init\` to install the ${provider === "expo" ? "Expo" : "Capacitor"} device adapters.`);
|
|
15630
15754
|
}
|
|
@@ -15653,29 +15777,29 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABI
|
|
|
15653
15777
|
const names = new Set;
|
|
15654
15778
|
const namespaces = new Set;
|
|
15655
15779
|
const visit = (node) => {
|
|
15656
|
-
if (
|
|
15780
|
+
if (lazyTypescript.isImportDeclaration(node) && lazyTypescript.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && !node.importClause?.isTypeOnly) {
|
|
15657
15781
|
const bindings = node.importClause?.namedBindings;
|
|
15658
|
-
if (bindings &&
|
|
15782
|
+
if (bindings && lazyTypescript.isNamedImports(bindings)) {
|
|
15659
15783
|
for (const element of bindings.elements)
|
|
15660
15784
|
if (!element.isTypeOnly)
|
|
15661
15785
|
names.add((element.propertyName ?? element.name).text);
|
|
15662
15786
|
}
|
|
15663
|
-
if (bindings &&
|
|
15787
|
+
if (bindings && lazyTypescript.isNamespaceImport(bindings))
|
|
15664
15788
|
namespaces.add(bindings.name.text);
|
|
15665
15789
|
}
|
|
15666
|
-
if (
|
|
15790
|
+
if (lazyTypescript.isExportDeclaration(node) && !node.isTypeOnly && node.moduleSpecifier !== undefined && lazyTypescript.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && node.exportClause && lazyTypescript.isNamedExports(node.exportClause)) {
|
|
15667
15791
|
for (const element of node.exportClause.elements)
|
|
15668
15792
|
if (!element.isTypeOnly)
|
|
15669
15793
|
names.add((element.propertyName ?? element.name).text);
|
|
15670
15794
|
}
|
|
15671
|
-
if (
|
|
15795
|
+
if (lazyTypescript.isPropertyAccessExpression(node) && lazyTypescript.isIdentifier(node.expression) && namespaces.has(node.expression.text))
|
|
15672
15796
|
names.add(node.name.text);
|
|
15673
|
-
|
|
15797
|
+
lazyTypescript.forEachChild(node, visit);
|
|
15674
15798
|
};
|
|
15675
15799
|
const extension = extname13(file).toLowerCase();
|
|
15676
15800
|
const sources = extension === ".svelte" || extension === ".vue" ? [...source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script\s*>/giu)].map((match) => match[1]).filter((value) => value !== undefined) : [source];
|
|
15677
15801
|
for (const [index, script] of sources.entries())
|
|
15678
|
-
visit(
|
|
15802
|
+
visit(lazyTypescript.createSourceFile(`${file}#script-${index}`, script, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TSX));
|
|
15679
15803
|
return names;
|
|
15680
15804
|
}, assertAbsoluteDeviceCapabilityPackages = (projectRoot, plan) => {
|
|
15681
15805
|
const missing = missingAbsoluteDeviceCapabilityPackages(plan, directAbsoluteProjectPackages(projectRoot));
|
|
@@ -15756,6 +15880,7 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABI
|
|
|
15756
15880
|
};
|
|
15757
15881
|
};
|
|
15758
15882
|
var init_deviceCapabilities = __esm(() => {
|
|
15883
|
+
init_lazyTypescript();
|
|
15759
15884
|
ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES = [
|
|
15760
15885
|
"keyboard",
|
|
15761
15886
|
"systemBars"
|
|
@@ -16601,21 +16726,22 @@ var init_precompressed = __esm(() => {
|
|
|
16601
16726
|
});
|
|
16602
16727
|
|
|
16603
16728
|
// src/dev/angular/hmrImportGenerator.ts
|
|
16604
|
-
import ts9 from "typescript";
|
|
16605
16729
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
16606
16730
|
addImport(request) {
|
|
16607
16731
|
const namespace = namespaceMap.get(request.exportModuleSpecifier);
|
|
16608
16732
|
if (!namespace) {
|
|
16609
16733
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
16610
16734
|
}
|
|
16611
|
-
const namespaceId =
|
|
16735
|
+
const namespaceId = lazyTypescript.factory.createIdentifier(namespace);
|
|
16612
16736
|
if (request.exportSymbolName === null) {
|
|
16613
16737
|
return namespaceId;
|
|
16614
16738
|
}
|
|
16615
|
-
return
|
|
16739
|
+
return lazyTypescript.factory.createPropertyAccessExpression(namespaceId, lazyTypescript.factory.createIdentifier(request.exportSymbolName));
|
|
16616
16740
|
}
|
|
16617
16741
|
});
|
|
16618
|
-
var init_hmrImportGenerator = () => {
|
|
16742
|
+
var init_hmrImportGenerator = __esm(() => {
|
|
16743
|
+
init_lazyTypescript();
|
|
16744
|
+
});
|
|
16619
16745
|
|
|
16620
16746
|
// src/dev/angular/vendor/translator/context.ts
|
|
16621
16747
|
class Context {
|
|
@@ -16978,15 +17104,15 @@ var init_translator = __esm(() => {
|
|
|
16978
17104
|
});
|
|
16979
17105
|
|
|
16980
17106
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
16981
|
-
import ts10 from "typescript";
|
|
16982
17107
|
function tsNumericExpression(value) {
|
|
16983
17108
|
if (value < 0) {
|
|
16984
|
-
const operand =
|
|
16985
|
-
return
|
|
17109
|
+
const operand = lazyTypescript.factory.createNumericLiteral(Math.abs(value));
|
|
17110
|
+
return lazyTypescript.factory.createPrefixUnaryExpression(lazyTypescript.SyntaxKind.MinusToken, operand);
|
|
16986
17111
|
}
|
|
16987
|
-
return
|
|
17112
|
+
return lazyTypescript.factory.createNumericLiteral(value);
|
|
16988
17113
|
}
|
|
16989
17114
|
var init_ts_util = __esm(() => {
|
|
17115
|
+
init_lazyTypescript();
|
|
16990
17116
|
/*!
|
|
16991
17117
|
* @license
|
|
16992
17118
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -16997,144 +17123,142 @@ var init_ts_util = __esm(() => {
|
|
|
16997
17123
|
});
|
|
16998
17124
|
|
|
16999
17125
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
17000
|
-
import ts11 from "typescript";
|
|
17001
|
-
|
|
17002
17126
|
class TypeScriptAstFactory {
|
|
17003
17127
|
constructor(annotateForClosureCompiler) {
|
|
17004
17128
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
17005
17129
|
this.externalSourceFiles = new Map;
|
|
17006
17130
|
this.UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
17007
|
-
"+":
|
|
17008
|
-
"-":
|
|
17009
|
-
"!":
|
|
17131
|
+
"+": lazyTypescript.SyntaxKind.PlusToken,
|
|
17132
|
+
"-": lazyTypescript.SyntaxKind.MinusToken,
|
|
17133
|
+
"!": lazyTypescript.SyntaxKind.ExclamationToken
|
|
17010
17134
|
}))();
|
|
17011
17135
|
this.BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
17012
|
-
"&&":
|
|
17013
|
-
">":
|
|
17014
|
-
">=":
|
|
17015
|
-
"&":
|
|
17016
|
-
"|":
|
|
17017
|
-
"/":
|
|
17018
|
-
"==":
|
|
17019
|
-
"===":
|
|
17020
|
-
"<":
|
|
17021
|
-
"<=":
|
|
17022
|
-
"-":
|
|
17023
|
-
"%":
|
|
17024
|
-
"*":
|
|
17025
|
-
"**":
|
|
17026
|
-
"!=":
|
|
17027
|
-
"!==":
|
|
17028
|
-
"||":
|
|
17029
|
-
"+":
|
|
17030
|
-
"??":
|
|
17031
|
-
"=":
|
|
17032
|
-
"+=":
|
|
17033
|
-
"-=":
|
|
17034
|
-
"*=":
|
|
17035
|
-
"/=":
|
|
17036
|
-
"%=":
|
|
17037
|
-
"**=":
|
|
17038
|
-
"&&=":
|
|
17039
|
-
"||=":
|
|
17040
|
-
"??=":
|
|
17041
|
-
in:
|
|
17042
|
-
instanceof:
|
|
17136
|
+
"&&": lazyTypescript.SyntaxKind.AmpersandAmpersandToken,
|
|
17137
|
+
">": lazyTypescript.SyntaxKind.GreaterThanToken,
|
|
17138
|
+
">=": lazyTypescript.SyntaxKind.GreaterThanEqualsToken,
|
|
17139
|
+
"&": lazyTypescript.SyntaxKind.AmpersandToken,
|
|
17140
|
+
"|": lazyTypescript.SyntaxKind.BarToken,
|
|
17141
|
+
"/": lazyTypescript.SyntaxKind.SlashToken,
|
|
17142
|
+
"==": lazyTypescript.SyntaxKind.EqualsEqualsToken,
|
|
17143
|
+
"===": lazyTypescript.SyntaxKind.EqualsEqualsEqualsToken,
|
|
17144
|
+
"<": lazyTypescript.SyntaxKind.LessThanToken,
|
|
17145
|
+
"<=": lazyTypescript.SyntaxKind.LessThanEqualsToken,
|
|
17146
|
+
"-": lazyTypescript.SyntaxKind.MinusToken,
|
|
17147
|
+
"%": lazyTypescript.SyntaxKind.PercentToken,
|
|
17148
|
+
"*": lazyTypescript.SyntaxKind.AsteriskToken,
|
|
17149
|
+
"**": lazyTypescript.SyntaxKind.AsteriskAsteriskToken,
|
|
17150
|
+
"!=": lazyTypescript.SyntaxKind.ExclamationEqualsToken,
|
|
17151
|
+
"!==": lazyTypescript.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
17152
|
+
"||": lazyTypescript.SyntaxKind.BarBarToken,
|
|
17153
|
+
"+": lazyTypescript.SyntaxKind.PlusToken,
|
|
17154
|
+
"??": lazyTypescript.SyntaxKind.QuestionQuestionToken,
|
|
17155
|
+
"=": lazyTypescript.SyntaxKind.EqualsToken,
|
|
17156
|
+
"+=": lazyTypescript.SyntaxKind.PlusEqualsToken,
|
|
17157
|
+
"-=": lazyTypescript.SyntaxKind.MinusEqualsToken,
|
|
17158
|
+
"*=": lazyTypescript.SyntaxKind.AsteriskEqualsToken,
|
|
17159
|
+
"/=": lazyTypescript.SyntaxKind.SlashEqualsToken,
|
|
17160
|
+
"%=": lazyTypescript.SyntaxKind.PercentEqualsToken,
|
|
17161
|
+
"**=": lazyTypescript.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
17162
|
+
"&&=": lazyTypescript.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
17163
|
+
"||=": lazyTypescript.SyntaxKind.BarBarEqualsToken,
|
|
17164
|
+
"??=": lazyTypescript.SyntaxKind.QuestionQuestionEqualsToken,
|
|
17165
|
+
in: lazyTypescript.SyntaxKind.InKeyword,
|
|
17166
|
+
instanceof: lazyTypescript.SyntaxKind.InstanceOfKeyword
|
|
17043
17167
|
}))();
|
|
17044
17168
|
this.VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
17045
|
-
const:
|
|
17046
|
-
let:
|
|
17047
|
-
var:
|
|
17169
|
+
const: lazyTypescript.NodeFlags.Const,
|
|
17170
|
+
let: lazyTypescript.NodeFlags.Let,
|
|
17171
|
+
var: lazyTypescript.NodeFlags.None
|
|
17048
17172
|
}))();
|
|
17049
17173
|
this.attachComments = attachComments;
|
|
17050
|
-
this.createArrayLiteral =
|
|
17051
|
-
this.createElementAccess =
|
|
17052
|
-
this.createExpressionStatement =
|
|
17053
|
-
this.createIdentifier =
|
|
17054
|
-
this.createParenthesizedExpression =
|
|
17055
|
-
this.createPropertyAccess =
|
|
17056
|
-
this.createSpreadElement =
|
|
17057
|
-
this.createThrowStatement =
|
|
17058
|
-
this.createTypeOfExpression =
|
|
17059
|
-
this.createVoidExpression =
|
|
17174
|
+
this.createArrayLiteral = lazyTypescript.factory.createArrayLiteralExpression;
|
|
17175
|
+
this.createElementAccess = lazyTypescript.factory.createElementAccessExpression;
|
|
17176
|
+
this.createExpressionStatement = lazyTypescript.factory.createExpressionStatement;
|
|
17177
|
+
this.createIdentifier = lazyTypescript.factory.createIdentifier;
|
|
17178
|
+
this.createParenthesizedExpression = lazyTypescript.factory.createParenthesizedExpression;
|
|
17179
|
+
this.createPropertyAccess = lazyTypescript.factory.createPropertyAccessExpression;
|
|
17180
|
+
this.createSpreadElement = lazyTypescript.factory.createSpreadElement;
|
|
17181
|
+
this.createThrowStatement = lazyTypescript.factory.createThrowStatement;
|
|
17182
|
+
this.createTypeOfExpression = lazyTypescript.factory.createTypeOfExpression;
|
|
17183
|
+
this.createVoidExpression = lazyTypescript.factory.createVoidExpression;
|
|
17060
17184
|
}
|
|
17061
17185
|
createAssignment(target, operator, value) {
|
|
17062
|
-
return
|
|
17186
|
+
return lazyTypescript.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
17063
17187
|
}
|
|
17064
17188
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
17065
|
-
return
|
|
17189
|
+
return lazyTypescript.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
17066
17190
|
}
|
|
17067
17191
|
createBlock(body) {
|
|
17068
|
-
return
|
|
17192
|
+
return lazyTypescript.factory.createBlock(body);
|
|
17069
17193
|
}
|
|
17070
17194
|
createCallExpression(callee, args, pure) {
|
|
17071
|
-
const call =
|
|
17195
|
+
const call = lazyTypescript.factory.createCallExpression(callee, undefined, args);
|
|
17072
17196
|
if (pure) {
|
|
17073
|
-
|
|
17197
|
+
lazyTypescript.addSyntheticLeadingComment(call, lazyTypescript.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
17074
17198
|
}
|
|
17075
17199
|
return call;
|
|
17076
17200
|
}
|
|
17077
17201
|
createConditional(condition, whenTrue, whenFalse) {
|
|
17078
|
-
return
|
|
17202
|
+
return lazyTypescript.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
17079
17203
|
}
|
|
17080
17204
|
createDynamicImport(url) {
|
|
17081
|
-
return
|
|
17082
|
-
typeof url === "string" ?
|
|
17205
|
+
return lazyTypescript.factory.createCallExpression(lazyTypescript.factory.createToken(lazyTypescript.SyntaxKind.ImportKeyword), undefined, [
|
|
17206
|
+
typeof url === "string" ? lazyTypescript.factory.createStringLiteral(url) : url
|
|
17083
17207
|
]);
|
|
17084
17208
|
}
|
|
17085
17209
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
17086
|
-
if (!
|
|
17087
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17210
|
+
if (!lazyTypescript.isBlock(body)) {
|
|
17211
|
+
throw new Error(`Invalid syntax, expected a block, but got ${lazyTypescript.SyntaxKind[body.kind]}.`);
|
|
17088
17212
|
}
|
|
17089
|
-
return
|
|
17213
|
+
return lazyTypescript.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
17090
17214
|
}
|
|
17091
17215
|
createFunctionExpression(functionName, parameters, body) {
|
|
17092
|
-
if (!
|
|
17093
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17216
|
+
if (!lazyTypescript.isBlock(body)) {
|
|
17217
|
+
throw new Error(`Invalid syntax, expected a block, but got ${lazyTypescript.SyntaxKind[body.kind]}.`);
|
|
17094
17218
|
}
|
|
17095
|
-
return
|
|
17219
|
+
return lazyTypescript.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
17096
17220
|
}
|
|
17097
17221
|
createArrowFunctionExpression(parameters, body) {
|
|
17098
|
-
if (
|
|
17099
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17222
|
+
if (lazyTypescript.isStatement(body) && !lazyTypescript.isBlock(body)) {
|
|
17223
|
+
throw new Error(`Invalid syntax, expected a block, but got ${lazyTypescript.SyntaxKind[body.kind]}.`);
|
|
17100
17224
|
}
|
|
17101
|
-
return
|
|
17225
|
+
return lazyTypescript.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
17102
17226
|
}
|
|
17103
17227
|
createParameter(param) {
|
|
17104
|
-
return
|
|
17228
|
+
return lazyTypescript.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
17105
17229
|
}
|
|
17106
17230
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
17107
|
-
return
|
|
17231
|
+
return lazyTypescript.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
17108
17232
|
}
|
|
17109
17233
|
createLiteral(value) {
|
|
17110
17234
|
if (value === undefined) {
|
|
17111
|
-
return
|
|
17235
|
+
return lazyTypescript.factory.createIdentifier("undefined");
|
|
17112
17236
|
} else if (value === null) {
|
|
17113
|
-
return
|
|
17237
|
+
return lazyTypescript.factory.createNull();
|
|
17114
17238
|
} else if (typeof value === "boolean") {
|
|
17115
|
-
return value ?
|
|
17239
|
+
return value ? lazyTypescript.factory.createTrue() : lazyTypescript.factory.createFalse();
|
|
17116
17240
|
} else if (typeof value === "number") {
|
|
17117
17241
|
return tsNumericExpression(value);
|
|
17118
17242
|
} else {
|
|
17119
|
-
return
|
|
17243
|
+
return lazyTypescript.factory.createStringLiteral(value);
|
|
17120
17244
|
}
|
|
17121
17245
|
}
|
|
17122
17246
|
createNewExpression(expression, args) {
|
|
17123
|
-
return
|
|
17247
|
+
return lazyTypescript.factory.createNewExpression(expression, undefined, args);
|
|
17124
17248
|
}
|
|
17125
17249
|
createObjectLiteral(properties) {
|
|
17126
|
-
return
|
|
17250
|
+
return lazyTypescript.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
17127
17251
|
if (prop.kind === "spread") {
|
|
17128
|
-
return
|
|
17252
|
+
return lazyTypescript.factory.createSpreadAssignment(prop.expression);
|
|
17129
17253
|
}
|
|
17130
|
-
return
|
|
17254
|
+
return lazyTypescript.factory.createPropertyAssignment(prop.quoted ? lazyTypescript.factory.createStringLiteral(prop.propertyName) : lazyTypescript.factory.createIdentifier(prop.propertyName), prop.value);
|
|
17131
17255
|
}));
|
|
17132
17256
|
}
|
|
17133
17257
|
createReturnStatement(expression) {
|
|
17134
|
-
return
|
|
17258
|
+
return lazyTypescript.factory.createReturnStatement(expression ?? undefined);
|
|
17135
17259
|
}
|
|
17136
17260
|
createTaggedTemplate(tag, template) {
|
|
17137
|
-
return
|
|
17261
|
+
return lazyTypescript.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
17138
17262
|
}
|
|
17139
17263
|
createTemplateLiteral(template) {
|
|
17140
17264
|
let templateLiteral;
|
|
@@ -17144,7 +17268,7 @@ class TypeScriptAstFactory {
|
|
|
17144
17268
|
throw new Error("createTemplateLiteral: template has no elements");
|
|
17145
17269
|
}
|
|
17146
17270
|
if (length === 1) {
|
|
17147
|
-
templateLiteral =
|
|
17271
|
+
templateLiteral = lazyTypescript.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
17148
17272
|
} else {
|
|
17149
17273
|
const spans = [];
|
|
17150
17274
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -17158,7 +17282,7 @@ class TypeScriptAstFactory {
|
|
|
17158
17282
|
if (range !== null) {
|
|
17159
17283
|
this.setSourceMapRange(middle, range);
|
|
17160
17284
|
}
|
|
17161
|
-
spans.push(
|
|
17285
|
+
spans.push(lazyTypescript.factory.createTemplateSpan(expression, middle));
|
|
17162
17286
|
}
|
|
17163
17287
|
const resolvedExpression = template.expressions[length - 2];
|
|
17164
17288
|
const templatePart = template.elements[length - 1];
|
|
@@ -17169,8 +17293,8 @@ class TypeScriptAstFactory {
|
|
|
17169
17293
|
if (templatePart.range !== null) {
|
|
17170
17294
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
17171
17295
|
}
|
|
17172
|
-
spans.push(
|
|
17173
|
-
templateLiteral =
|
|
17296
|
+
spans.push(lazyTypescript.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
17297
|
+
templateLiteral = lazyTypescript.factory.createTemplateExpression(lazyTypescript.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
17174
17298
|
}
|
|
17175
17299
|
if (head.range !== null) {
|
|
17176
17300
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
@@ -17178,15 +17302,15 @@ class TypeScriptAstFactory {
|
|
|
17178
17302
|
return templateLiteral;
|
|
17179
17303
|
}
|
|
17180
17304
|
createUnaryExpression(operator, operand) {
|
|
17181
|
-
return
|
|
17305
|
+
return lazyTypescript.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
17182
17306
|
}
|
|
17183
17307
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
17184
|
-
return
|
|
17185
|
-
|
|
17308
|
+
return lazyTypescript.factory.createVariableStatement(undefined, lazyTypescript.factory.createVariableDeclarationList([
|
|
17309
|
+
lazyTypescript.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
17186
17310
|
], this.VAR_TYPES[variableType]));
|
|
17187
17311
|
}
|
|
17188
17312
|
createRegularExpressionLiteral(body, flags) {
|
|
17189
|
-
return
|
|
17313
|
+
return lazyTypescript.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
17190
17314
|
}
|
|
17191
17315
|
setSourceMapRange(node, sourceMapRange) {
|
|
17192
17316
|
if (sourceMapRange === null) {
|
|
@@ -17194,10 +17318,10 @@ class TypeScriptAstFactory {
|
|
|
17194
17318
|
}
|
|
17195
17319
|
const url = sourceMapRange.url;
|
|
17196
17320
|
if (!this.externalSourceFiles.has(url)) {
|
|
17197
|
-
this.externalSourceFiles.set(url,
|
|
17321
|
+
this.externalSourceFiles.set(url, lazyTypescript.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
17198
17322
|
}
|
|
17199
17323
|
const source = this.externalSourceFiles.get(url);
|
|
17200
|
-
|
|
17324
|
+
lazyTypescript.setSourceMapRange(node, {
|
|
17201
17325
|
pos: sourceMapRange.start.offset,
|
|
17202
17326
|
end: sourceMapRange.end.offset,
|
|
17203
17327
|
source
|
|
@@ -17207,79 +17331,80 @@ class TypeScriptAstFactory {
|
|
|
17207
17331
|
createBuiltInType(type) {
|
|
17208
17332
|
switch (type) {
|
|
17209
17333
|
case "any":
|
|
17210
|
-
return
|
|
17334
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.AnyKeyword);
|
|
17211
17335
|
case "boolean":
|
|
17212
|
-
return
|
|
17336
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.BooleanKeyword);
|
|
17213
17337
|
case "number":
|
|
17214
|
-
return
|
|
17338
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.NumberKeyword);
|
|
17215
17339
|
case "string":
|
|
17216
|
-
return
|
|
17340
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.StringKeyword);
|
|
17217
17341
|
case "function":
|
|
17218
|
-
return
|
|
17342
|
+
return lazyTypescript.factory.createTypeReferenceNode(lazyTypescript.factory.createIdentifier("Function"));
|
|
17219
17343
|
case "never":
|
|
17220
|
-
return
|
|
17344
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.NeverKeyword);
|
|
17221
17345
|
case "unknown":
|
|
17222
|
-
return
|
|
17346
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.UnknownKeyword);
|
|
17223
17347
|
}
|
|
17224
17348
|
}
|
|
17225
17349
|
createExpressionType(expression, typeParams) {
|
|
17226
17350
|
const typeName = getEntityTypeFromExpression(expression);
|
|
17227
|
-
return
|
|
17351
|
+
return lazyTypescript.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
17228
17352
|
}
|
|
17229
17353
|
createArrayType(elementType) {
|
|
17230
|
-
return
|
|
17354
|
+
return lazyTypescript.factory.createArrayTypeNode(elementType);
|
|
17231
17355
|
}
|
|
17232
17356
|
createMapType(valueType) {
|
|
17233
|
-
return
|
|
17234
|
-
|
|
17235
|
-
|
|
17357
|
+
return lazyTypescript.factory.createTypeLiteralNode([
|
|
17358
|
+
lazyTypescript.factory.createIndexSignature(undefined, [
|
|
17359
|
+
lazyTypescript.factory.createParameterDeclaration(undefined, undefined, "key", undefined, lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.StringKeyword))
|
|
17236
17360
|
], valueType)
|
|
17237
17361
|
]);
|
|
17238
17362
|
}
|
|
17239
17363
|
transplantType(type) {
|
|
17240
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
17364
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && lazyTypescript.isTypeNode(type)) {
|
|
17241
17365
|
return type;
|
|
17242
17366
|
}
|
|
17243
17367
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
17244
17368
|
}
|
|
17245
17369
|
}
|
|
17246
17370
|
function createTemplateMiddle(cooked, raw) {
|
|
17247
|
-
const node =
|
|
17248
|
-
node.kind =
|
|
17371
|
+
const node = lazyTypescript.factory.createTemplateHead(cooked, raw);
|
|
17372
|
+
node.kind = lazyTypescript.SyntaxKind.TemplateMiddle;
|
|
17249
17373
|
return node;
|
|
17250
17374
|
}
|
|
17251
17375
|
function createTemplateTail(cooked, raw) {
|
|
17252
|
-
const node =
|
|
17253
|
-
node.kind =
|
|
17376
|
+
const node = lazyTypescript.factory.createTemplateHead(cooked, raw);
|
|
17377
|
+
node.kind = lazyTypescript.SyntaxKind.TemplateTail;
|
|
17254
17378
|
return node;
|
|
17255
17379
|
}
|
|
17256
17380
|
function attachComments(statement, leadingComments) {
|
|
17257
17381
|
for (const comment of leadingComments) {
|
|
17258
|
-
const commentKind = comment.multiline ?
|
|
17382
|
+
const commentKind = comment.multiline ? lazyTypescript.SyntaxKind.MultiLineCommentTrivia : lazyTypescript.SyntaxKind.SingleLineCommentTrivia;
|
|
17259
17383
|
if (comment.multiline) {
|
|
17260
|
-
|
|
17384
|
+
lazyTypescript.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
17261
17385
|
} else {
|
|
17262
17386
|
for (const line of comment.toString().split(`
|
|
17263
17387
|
`)) {
|
|
17264
|
-
|
|
17388
|
+
lazyTypescript.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
17265
17389
|
}
|
|
17266
17390
|
}
|
|
17267
17391
|
}
|
|
17268
17392
|
}
|
|
17269
17393
|
function getEntityTypeFromExpression(expression) {
|
|
17270
|
-
if (
|
|
17394
|
+
if (lazyTypescript.isIdentifier(expression)) {
|
|
17271
17395
|
return expression;
|
|
17272
17396
|
}
|
|
17273
|
-
if (
|
|
17397
|
+
if (lazyTypescript.isPropertyAccessExpression(expression)) {
|
|
17274
17398
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
17275
|
-
if (!
|
|
17399
|
+
if (!lazyTypescript.isIdentifier(expression.name)) {
|
|
17276
17400
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
17277
17401
|
}
|
|
17278
|
-
return
|
|
17402
|
+
return lazyTypescript.factory.createQualifiedName(left, expression.name);
|
|
17279
17403
|
}
|
|
17280
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
17404
|
+
throw new Error(`Unsupported expression for type reference: ${lazyTypescript.SyntaxKind[expression.kind]}`);
|
|
17281
17405
|
}
|
|
17282
17406
|
var init_typescript_ast_factory = __esm(() => {
|
|
17407
|
+
init_lazyTypescript();
|
|
17283
17408
|
init_ts_util();
|
|
17284
17409
|
});
|
|
17285
17410
|
|
|
@@ -17302,9 +17427,8 @@ var init_typescript_translator = __esm(() => {
|
|
|
17302
17427
|
});
|
|
17303
17428
|
|
|
17304
17429
|
// src/dev/angular/fastHmrCompiler.ts
|
|
17305
|
-
import { existsSync as existsSync30, readFileSync as readFileSync24, statSync as
|
|
17430
|
+
import { existsSync as existsSync30, readFileSync as readFileSync24, statSync as statSync5 } from "fs";
|
|
17306
17431
|
import { dirname as dirname23, extname as extname15, relative as relative21, resolve as resolve29 } from "path";
|
|
17307
|
-
import ts12 from "typescript";
|
|
17308
17432
|
var fail2 = (reason, detail, location) => ({
|
|
17309
17433
|
detail,
|
|
17310
17434
|
ok: false,
|
|
@@ -17312,10 +17436,10 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17312
17436
|
...location ?? {}
|
|
17313
17437
|
}), fingerprintCache, pendingModuleCache, ANGULAR_DECORATOR_NAMES, findAngularDecoratorName = (decorators) => {
|
|
17314
17438
|
for (const decorator of decorators) {
|
|
17315
|
-
if (!
|
|
17439
|
+
if (!lazyTypescript.isCallExpression(decorator.expression))
|
|
17316
17440
|
continue;
|
|
17317
17441
|
const { expression } = decorator.expression;
|
|
17318
|
-
if (!
|
|
17442
|
+
if (!lazyTypescript.isIdentifier(expression))
|
|
17319
17443
|
continue;
|
|
17320
17444
|
if (ANGULAR_DECORATOR_NAMES.has(expression.text)) {
|
|
17321
17445
|
return expression.text;
|
|
@@ -17401,17 +17525,17 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17401
17525
|
}
|
|
17402
17526
|
let sourceFile;
|
|
17403
17527
|
try {
|
|
17404
|
-
sourceFile =
|
|
17528
|
+
sourceFile = lazyTypescript.createSourceFile(componentFilePath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
17405
17529
|
} catch {
|
|
17406
17530
|
return;
|
|
17407
17531
|
}
|
|
17408
17532
|
for (const stmt of sourceFile.statements) {
|
|
17409
|
-
if (!
|
|
17533
|
+
if (!lazyTypescript.isClassDeclaration(stmt))
|
|
17410
17534
|
continue;
|
|
17411
17535
|
const className = stmt.name?.text;
|
|
17412
17536
|
if (!className)
|
|
17413
17537
|
continue;
|
|
17414
|
-
const decorators =
|
|
17538
|
+
const decorators = lazyTypescript.getDecorators(stmt) ?? [];
|
|
17415
17539
|
const decoratorName = findAngularDecoratorName(decorators);
|
|
17416
17540
|
if (!decoratorName)
|
|
17417
17541
|
continue;
|
|
@@ -17419,17 +17543,17 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17419
17543
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
17420
17544
|
if (decoratorName === "Component") {
|
|
17421
17545
|
const componentDecorator = decorators.find((d) => {
|
|
17422
|
-
if (!
|
|
17546
|
+
if (!lazyTypescript.isCallExpression(d.expression))
|
|
17423
17547
|
return false;
|
|
17424
17548
|
const expr = d.expression.expression;
|
|
17425
|
-
return
|
|
17549
|
+
return lazyTypescript.isIdentifier(expr) && expr.text === "Component";
|
|
17426
17550
|
});
|
|
17427
17551
|
if (!componentDecorator)
|
|
17428
17552
|
continue;
|
|
17429
|
-
if (!
|
|
17553
|
+
if (!lazyTypescript.isCallExpression(componentDecorator.expression))
|
|
17430
17554
|
continue;
|
|
17431
17555
|
const [args] = componentDecorator.expression.arguments;
|
|
17432
|
-
if (!args || !
|
|
17556
|
+
if (!args || !lazyTypescript.isObjectLiteralExpression(args))
|
|
17433
17557
|
continue;
|
|
17434
17558
|
const decoratorMeta = readDecoratorMeta(args);
|
|
17435
17559
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
@@ -17460,11 +17584,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17460
17584
|
return false;
|
|
17461
17585
|
return true;
|
|
17462
17586
|
}, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
|
|
17463
|
-
for (const dec of
|
|
17587
|
+
for (const dec of lazyTypescript.getDecorators(cls) ?? []) {
|
|
17464
17588
|
const expr = dec.expression;
|
|
17465
|
-
if (!
|
|
17589
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
17466
17590
|
continue;
|
|
17467
|
-
if (!
|
|
17591
|
+
if (!lazyTypescript.isIdentifier(expr.expression))
|
|
17468
17592
|
continue;
|
|
17469
17593
|
if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
|
|
17470
17594
|
return dec;
|
|
@@ -17474,7 +17598,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17474
17598
|
const decorator = findEntityDecorator(cls);
|
|
17475
17599
|
let decoratorArgsText = "";
|
|
17476
17600
|
if (decorator !== null) {
|
|
17477
|
-
if (!
|
|
17601
|
+
if (!lazyTypescript.isCallExpression(decorator.expression)) {
|
|
17478
17602
|
return {
|
|
17479
17603
|
arrowFieldSig: extractArrowFieldSig(cls),
|
|
17480
17604
|
className,
|
|
@@ -17492,18 +17616,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17492
17616
|
}
|
|
17493
17617
|
const ctorParamTypes = [];
|
|
17494
17618
|
for (const member of cls.members) {
|
|
17495
|
-
if (!
|
|
17619
|
+
if (!lazyTypescript.isConstructorDeclaration(member))
|
|
17496
17620
|
continue;
|
|
17497
17621
|
for (const param of member.parameters) {
|
|
17498
17622
|
const typeText = param.type ? param.type.getText() : "";
|
|
17499
|
-
const decorators =
|
|
17623
|
+
const decorators = lazyTypescript.getDecorators(param) ?? [];
|
|
17500
17624
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d) => {
|
|
17501
17625
|
const e = d.expression;
|
|
17502
|
-
if (
|
|
17626
|
+
if (lazyTypescript.isCallExpression(e) && lazyTypescript.isIdentifier(e.expression)) {
|
|
17503
17627
|
const args = e.arguments.map((a) => a.getText()).join(",");
|
|
17504
17628
|
return `@${e.expression.text}(${args})`;
|
|
17505
17629
|
}
|
|
17506
|
-
if (
|
|
17630
|
+
if (lazyTypescript.isIdentifier(e))
|
|
17507
17631
|
return `@${e.text}`;
|
|
17508
17632
|
return "@<unknown>";
|
|
17509
17633
|
}).join("");
|
|
@@ -17525,23 +17649,23 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17525
17649
|
const walk = (node) => {
|
|
17526
17650
|
if (found)
|
|
17527
17651
|
return;
|
|
17528
|
-
if (
|
|
17652
|
+
if (lazyTypescript.isClassDeclaration(node) && node.name?.text === className) {
|
|
17529
17653
|
found = node;
|
|
17530
17654
|
return;
|
|
17531
17655
|
}
|
|
17532
|
-
|
|
17656
|
+
lazyTypescript.forEachChild(node, walk);
|
|
17533
17657
|
};
|
|
17534
17658
|
walk(sourceFile);
|
|
17535
17659
|
return found;
|
|
17536
17660
|
}, getClassDecorators = (cls) => {
|
|
17537
|
-
const modifiers =
|
|
17661
|
+
const modifiers = lazyTypescript.getDecorators(cls) ?? [];
|
|
17538
17662
|
return [...modifiers];
|
|
17539
17663
|
}, findComponentDecorator = (cls) => {
|
|
17540
17664
|
for (const decorator of getClassDecorators(cls)) {
|
|
17541
17665
|
const expr = decorator.expression;
|
|
17542
|
-
if (
|
|
17666
|
+
if (lazyTypescript.isCallExpression(expr)) {
|
|
17543
17667
|
const functionNode = expr.expression;
|
|
17544
|
-
if (
|
|
17668
|
+
if (lazyTypescript.isIdentifier(functionNode) && functionNode.text === "Component") {
|
|
17545
17669
|
return decorator;
|
|
17546
17670
|
}
|
|
17547
17671
|
}
|
|
@@ -17549,15 +17673,15 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17549
17673
|
return null;
|
|
17550
17674
|
}, getDecoratorArgsObject = (decorator) => {
|
|
17551
17675
|
const call = decorator.expression;
|
|
17552
|
-
if (!
|
|
17676
|
+
if (!lazyTypescript.isCallExpression(call))
|
|
17553
17677
|
return null;
|
|
17554
17678
|
const [arg] = call.arguments;
|
|
17555
|
-
if (!arg || !
|
|
17679
|
+
if (!arg || !lazyTypescript.isObjectLiteralExpression(arg))
|
|
17556
17680
|
return null;
|
|
17557
17681
|
return arg;
|
|
17558
17682
|
}, getProperty = (obj, name) => {
|
|
17559
17683
|
for (const prop of obj.properties) {
|
|
17560
|
-
if (
|
|
17684
|
+
if (lazyTypescript.isPropertyAssignment(prop) && (lazyTypescript.isIdentifier(prop.name) && prop.name.text === name || lazyTypescript.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
17561
17685
|
return prop.initializer;
|
|
17562
17686
|
}
|
|
17563
17687
|
}
|
|
@@ -17566,7 +17690,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17566
17690
|
const expr = getProperty(obj, name);
|
|
17567
17691
|
if (!expr)
|
|
17568
17692
|
return null;
|
|
17569
|
-
if (
|
|
17693
|
+
if (lazyTypescript.isStringLiteral(expr) || lazyTypescript.isNoSubstitutionTemplateLiteral(expr)) {
|
|
17570
17694
|
return expr.text;
|
|
17571
17695
|
}
|
|
17572
17696
|
return null;
|
|
@@ -17574,22 +17698,22 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17574
17698
|
const expr = getProperty(obj, name);
|
|
17575
17699
|
if (!expr)
|
|
17576
17700
|
return null;
|
|
17577
|
-
if (expr.kind ===
|
|
17701
|
+
if (expr.kind === lazyTypescript.SyntaxKind.TrueKeyword)
|
|
17578
17702
|
return true;
|
|
17579
|
-
if (expr.kind ===
|
|
17703
|
+
if (expr.kind === lazyTypescript.SyntaxKind.FalseKeyword)
|
|
17580
17704
|
return false;
|
|
17581
17705
|
return null;
|
|
17582
17706
|
}, isAngularDecoratorIdentifier = (name) => name === "Component" || name === "Directive" || name === "Pipe" || name === "Injectable", classHasAngularDecorator = (cls) => {
|
|
17583
|
-
for (const dec of
|
|
17707
|
+
for (const dec of lazyTypescript.getDecorators(cls) ?? []) {
|
|
17584
17708
|
const expr = dec.expression;
|
|
17585
|
-
if (
|
|
17709
|
+
if (lazyTypescript.isCallExpression(expr) && lazyTypescript.isIdentifier(expr.expression) && isAngularDecoratorIdentifier(expr.expression.text)) {
|
|
17586
17710
|
return true;
|
|
17587
17711
|
}
|
|
17588
17712
|
}
|
|
17589
17713
|
return false;
|
|
17590
17714
|
}, findClassInSourceFile = (sourceFile, className) => {
|
|
17591
17715
|
for (const stmt of sourceFile.statements) {
|
|
17592
|
-
if (
|
|
17716
|
+
if (lazyTypescript.isClassDeclaration(stmt) && stmt.name?.text === className) {
|
|
17593
17717
|
return stmt;
|
|
17594
17718
|
}
|
|
17595
17719
|
}
|
|
@@ -17599,15 +17723,15 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17599
17723
|
if (sameFile)
|
|
17600
17724
|
return classHasAngularDecorator(sameFile);
|
|
17601
17725
|
for (const stmt of sourceFile.statements) {
|
|
17602
|
-
if (!
|
|
17726
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
17603
17727
|
continue;
|
|
17604
|
-
if (!
|
|
17728
|
+
if (!lazyTypescript.isStringLiteral(stmt.moduleSpecifier))
|
|
17605
17729
|
continue;
|
|
17606
17730
|
const clause = stmt.importClause;
|
|
17607
17731
|
if (!clause || clause.isTypeOnly)
|
|
17608
17732
|
continue;
|
|
17609
17733
|
const named = clause.namedBindings;
|
|
17610
|
-
if (!named || !
|
|
17734
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
17611
17735
|
continue;
|
|
17612
17736
|
const found = named.elements.find((element) => element.name.text === parentClassName);
|
|
17613
17737
|
if (!found)
|
|
@@ -17632,7 +17756,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17632
17756
|
} catch {
|
|
17633
17757
|
continue;
|
|
17634
17758
|
}
|
|
17635
|
-
const parentSf =
|
|
17759
|
+
const parentSf = lazyTypescript.createSourceFile(candidate, content, lazyTypescript.ScriptTarget.Latest, true);
|
|
17636
17760
|
const parentCls = findClassInSourceFile(parentSf, parentClassName);
|
|
17637
17761
|
if (!parentCls)
|
|
17638
17762
|
continue;
|
|
@@ -17644,11 +17768,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17644
17768
|
}, inheritsDecoratedClass = (cls, sourceFile, componentDir, projectRoot) => {
|
|
17645
17769
|
const heritage = cls.heritageClauses ?? [];
|
|
17646
17770
|
for (const clause of heritage) {
|
|
17647
|
-
if (clause.token !==
|
|
17771
|
+
if (clause.token !== lazyTypescript.SyntaxKind.ExtendsKeyword)
|
|
17648
17772
|
continue;
|
|
17649
17773
|
for (const typeNode of clause.types) {
|
|
17650
17774
|
const expr = typeNode.expression;
|
|
17651
|
-
if (!
|
|
17775
|
+
if (!lazyTypescript.isIdentifier(expr)) {
|
|
17652
17776
|
return true;
|
|
17653
17777
|
}
|
|
17654
17778
|
if (parentHasAngularDecoratorAcrossFiles(expr.text, sourceFile, componentDir, projectRoot)) {
|
|
@@ -17659,18 +17783,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17659
17783
|
return false;
|
|
17660
17784
|
}, CONTROL_CREATE_METHOD_NAME = "\u0275ngControlCreate", extractControlCreate = (cls) => {
|
|
17661
17785
|
for (const member of cls.members) {
|
|
17662
|
-
if (!
|
|
17786
|
+
if (!lazyTypescript.isMethodDeclaration(member))
|
|
17663
17787
|
continue;
|
|
17664
|
-
if (member.modifiers?.some((item) => item.kind ===
|
|
17788
|
+
if (member.modifiers?.some((item) => item.kind === lazyTypescript.SyntaxKind.StaticKeyword))
|
|
17665
17789
|
continue;
|
|
17666
17790
|
const { name } = member;
|
|
17667
17791
|
if (name === undefined)
|
|
17668
17792
|
continue;
|
|
17669
|
-
const nameText =
|
|
17793
|
+
const nameText = lazyTypescript.isIdentifier(name) ? name.text : name.getText();
|
|
17670
17794
|
if (nameText !== CONTROL_CREATE_METHOD_NAME)
|
|
17671
17795
|
continue;
|
|
17672
17796
|
const [firstParam] = member.parameters;
|
|
17673
|
-
if (firstParam === undefined || firstParam.type === undefined || !
|
|
17797
|
+
if (firstParam === undefined || firstParam.type === undefined || !lazyTypescript.isTypeReferenceNode(firstParam.type)) {
|
|
17674
17798
|
return { passThroughInput: null };
|
|
17675
17799
|
}
|
|
17676
17800
|
const typeArgs = firstParam.type.typeArguments;
|
|
@@ -17678,16 +17802,16 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17678
17802
|
return { passThroughInput: null };
|
|
17679
17803
|
}
|
|
17680
17804
|
const [arg] = typeArgs;
|
|
17681
|
-
if (arg === undefined || !
|
|
17805
|
+
if (arg === undefined || !lazyTypescript.isLiteralTypeNode(arg) || !lazyTypescript.isStringLiteral(arg.literal)) {
|
|
17682
17806
|
return { passThroughInput: null };
|
|
17683
17807
|
}
|
|
17684
17808
|
return { passThroughInput: arg.literal.text };
|
|
17685
17809
|
}
|
|
17686
17810
|
return null;
|
|
17687
17811
|
}, resolveEnumPropertyAccess = (expr, enumName, values) => {
|
|
17688
|
-
if (!
|
|
17812
|
+
if (!lazyTypescript.isPropertyAccessExpression(expr))
|
|
17689
17813
|
return null;
|
|
17690
|
-
if (!
|
|
17814
|
+
if (!lazyTypescript.isIdentifier(expr.expression))
|
|
17691
17815
|
return null;
|
|
17692
17816
|
if (expr.expression.text !== enumName)
|
|
17693
17817
|
return null;
|
|
@@ -17706,21 +17830,21 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17706
17830
|
const hostExpr = getProperty(args, "host");
|
|
17707
17831
|
const schemasExpr = getProperty(args, "schemas");
|
|
17708
17832
|
const styleUrls = [];
|
|
17709
|
-
if (styleUrlsExpr &&
|
|
17833
|
+
if (styleUrlsExpr && lazyTypescript.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
17710
17834
|
for (const element of styleUrlsExpr.elements) {
|
|
17711
|
-
if (
|
|
17835
|
+
if (lazyTypescript.isStringLiteral(element))
|
|
17712
17836
|
styleUrls.push(element.text);
|
|
17713
17837
|
}
|
|
17714
17838
|
}
|
|
17715
17839
|
const styles = [];
|
|
17716
17840
|
if (stylesExpr) {
|
|
17717
|
-
if (
|
|
17841
|
+
if (lazyTypescript.isArrayLiteralExpression(stylesExpr)) {
|
|
17718
17842
|
for (const element of stylesExpr.elements) {
|
|
17719
|
-
if (
|
|
17843
|
+
if (lazyTypescript.isStringLiteral(element) || lazyTypescript.isNoSubstitutionTemplateLiteral(element)) {
|
|
17720
17844
|
styles.push(element.text);
|
|
17721
17845
|
}
|
|
17722
17846
|
}
|
|
17723
|
-
} else if (
|
|
17847
|
+
} else if (lazyTypescript.isStringLiteral(stylesExpr) || lazyTypescript.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
17724
17848
|
styles.push(stylesExpr.text);
|
|
17725
17849
|
}
|
|
17726
17850
|
}
|
|
@@ -17729,19 +17853,19 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17729
17853
|
const changeDetectionExpr = getProperty(args, "changeDetection");
|
|
17730
17854
|
const changeDetection = changeDetectionExpr ? resolveEnumPropertyAccess(changeDetectionExpr, "ChangeDetectionStrategy", CHANGE_DETECTION_VALUES) : null;
|
|
17731
17855
|
return {
|
|
17732
|
-
animationsExpr: animationsExpr &&
|
|
17856
|
+
animationsExpr: animationsExpr && lazyTypescript.isArrayLiteralExpression(animationsExpr) ? animationsExpr : null,
|
|
17733
17857
|
changeDetection,
|
|
17734
17858
|
encapsulation,
|
|
17735
17859
|
hasProviders: getProperty(args, "providers") !== null,
|
|
17736
17860
|
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
17737
|
-
hostDirectivesExpr: hostDirectivesExpr &&
|
|
17738
|
-
hostExpr: hostExpr &&
|
|
17739
|
-
importsExpr: importsExpr &&
|
|
17740
|
-
inputsArrayExpr: inputsArrayExpr &&
|
|
17741
|
-
outputsArrayExpr: outputsArrayExpr &&
|
|
17861
|
+
hostDirectivesExpr: hostDirectivesExpr && lazyTypescript.isArrayLiteralExpression(hostDirectivesExpr) ? hostDirectivesExpr : null,
|
|
17862
|
+
hostExpr: hostExpr && lazyTypescript.isObjectLiteralExpression(hostExpr) ? hostExpr : null,
|
|
17863
|
+
importsExpr: importsExpr && lazyTypescript.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
17864
|
+
inputsArrayExpr: inputsArrayExpr && lazyTypescript.isArrayLiteralExpression(inputsArrayExpr) ? inputsArrayExpr : null,
|
|
17865
|
+
outputsArrayExpr: outputsArrayExpr && lazyTypescript.isArrayLiteralExpression(outputsArrayExpr) ? outputsArrayExpr : null,
|
|
17742
17866
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
17743
|
-
providersExpr: providersExpr &&
|
|
17744
|
-
schemasExpr: schemasExpr &&
|
|
17867
|
+
providersExpr: providersExpr && lazyTypescript.isArrayLiteralExpression(providersExpr) ? providersExpr : null,
|
|
17868
|
+
schemasExpr: schemasExpr && lazyTypescript.isArrayLiteralExpression(schemasExpr) ? schemasExpr : null,
|
|
17745
17869
|
selector: getStringProperty(args, "selector"),
|
|
17746
17870
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
17747
17871
|
styles,
|
|
@@ -17749,16 +17873,16 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17749
17873
|
styleUrls,
|
|
17750
17874
|
template: getStringProperty(args, "template"),
|
|
17751
17875
|
templateUrl: getStringProperty(args, "templateUrl"),
|
|
17752
|
-
viewProvidersExpr: viewProvidersExpr &&
|
|
17876
|
+
viewProvidersExpr: viewProvidersExpr && lazyTypescript.isArrayLiteralExpression(viewProvidersExpr) ? viewProvidersExpr : null
|
|
17753
17877
|
};
|
|
17754
17878
|
}, extractDecoratorInput = (prop, compiler) => {
|
|
17755
|
-
const decorators =
|
|
17879
|
+
const decorators = lazyTypescript.getDecorators(prop) ?? [];
|
|
17756
17880
|
for (const decorator of decorators) {
|
|
17757
17881
|
const expr = decorator.expression;
|
|
17758
|
-
if (!
|
|
17882
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
17759
17883
|
continue;
|
|
17760
17884
|
const functionNode = expr.expression;
|
|
17761
|
-
if (!
|
|
17885
|
+
if (!lazyTypescript.isIdentifier(functionNode) || functionNode.text !== "Input")
|
|
17762
17886
|
continue;
|
|
17763
17887
|
const classPropertyName = prop.name.getText();
|
|
17764
17888
|
let bindingPropertyName = classPropertyName;
|
|
@@ -17766,9 +17890,9 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17766
17890
|
let transformFunction = null;
|
|
17767
17891
|
const [arg] = expr.arguments;
|
|
17768
17892
|
if (arg) {
|
|
17769
|
-
if (
|
|
17893
|
+
if (lazyTypescript.isStringLiteral(arg)) {
|
|
17770
17894
|
bindingPropertyName = arg.text;
|
|
17771
|
-
} else if (
|
|
17895
|
+
} else if (lazyTypescript.isObjectLiteralExpression(arg)) {
|
|
17772
17896
|
const aliasNode = getStringProperty(arg, "alias");
|
|
17773
17897
|
if (aliasNode !== null)
|
|
17774
17898
|
bindingPropertyName = aliasNode;
|
|
@@ -17792,11 +17916,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17792
17916
|
}
|
|
17793
17917
|
return null;
|
|
17794
17918
|
}, isInputSignalCall = (init) => {
|
|
17795
|
-
if (
|
|
17919
|
+
if (lazyTypescript.isCallExpression(init)) {
|
|
17796
17920
|
const functionNode = init.expression;
|
|
17797
|
-
if (
|
|
17921
|
+
if (lazyTypescript.isIdentifier(functionNode) && functionNode.text === "input")
|
|
17798
17922
|
return true;
|
|
17799
|
-
if (
|
|
17923
|
+
if (lazyTypescript.isPropertyAccessExpression(functionNode) && lazyTypescript.isIdentifier(functionNode.expression) && functionNode.expression.text === "input") {
|
|
17800
17924
|
return true;
|
|
17801
17925
|
}
|
|
17802
17926
|
}
|
|
@@ -17804,18 +17928,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17804
17928
|
}, extractSignalInput = (prop, compiler) => {
|
|
17805
17929
|
if (!prop.initializer || !isInputSignalCall(prop.initializer))
|
|
17806
17930
|
return null;
|
|
17807
|
-
if (!
|
|
17931
|
+
if (!lazyTypescript.isCallExpression(prop.initializer))
|
|
17808
17932
|
return null;
|
|
17809
17933
|
const classPropertyName = prop.name.getText();
|
|
17810
17934
|
const call = prop.initializer;
|
|
17811
17935
|
let required = false;
|
|
17812
|
-
if (
|
|
17936
|
+
if (lazyTypescript.isPropertyAccessExpression(call.expression) && lazyTypescript.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
17813
17937
|
required = true;
|
|
17814
17938
|
}
|
|
17815
17939
|
let bindingPropertyName = classPropertyName;
|
|
17816
17940
|
let transformFunction = null;
|
|
17817
17941
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
17818
|
-
if (optsArg &&
|
|
17942
|
+
if (optsArg && lazyTypescript.isObjectLiteralExpression(optsArg)) {
|
|
17819
17943
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
17820
17944
|
if (aliasNode !== null)
|
|
17821
17945
|
bindingPropertyName = aliasNode;
|
|
@@ -17835,28 +17959,28 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17835
17959
|
}
|
|
17836
17960
|
};
|
|
17837
17961
|
}, extractDecoratorOutput = (prop) => {
|
|
17838
|
-
const decorators =
|
|
17962
|
+
const decorators = lazyTypescript.getDecorators(prop) ?? [];
|
|
17839
17963
|
for (const decorator of decorators) {
|
|
17840
17964
|
const expr = decorator.expression;
|
|
17841
|
-
if (!
|
|
17965
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
17842
17966
|
continue;
|
|
17843
17967
|
const functionNode = expr.expression;
|
|
17844
|
-
if (!
|
|
17968
|
+
if (!lazyTypescript.isIdentifier(functionNode) || functionNode.text !== "Output")
|
|
17845
17969
|
continue;
|
|
17846
17970
|
const classPropertyName = prop.name.getText();
|
|
17847
17971
|
let bindingName = classPropertyName;
|
|
17848
17972
|
const [arg] = expr.arguments;
|
|
17849
|
-
if (arg &&
|
|
17973
|
+
if (arg && lazyTypescript.isStringLiteral(arg))
|
|
17850
17974
|
bindingName = arg.text;
|
|
17851
17975
|
return { bindingName, classPropertyName };
|
|
17852
17976
|
}
|
|
17853
17977
|
return null;
|
|
17854
17978
|
}, isOutputSignalCall = (init) => {
|
|
17855
|
-
if (
|
|
17979
|
+
if (lazyTypescript.isCallExpression(init)) {
|
|
17856
17980
|
const functionNode = init.expression;
|
|
17857
|
-
if (
|
|
17981
|
+
if (lazyTypescript.isIdentifier(functionNode) && functionNode.text === "output")
|
|
17858
17982
|
return true;
|
|
17859
|
-
if (
|
|
17983
|
+
if (lazyTypescript.isPropertyAccessExpression(functionNode) && lazyTypescript.isIdentifier(functionNode.expression) && functionNode.expression.text === "output") {
|
|
17860
17984
|
return true;
|
|
17861
17985
|
}
|
|
17862
17986
|
}
|
|
@@ -17864,13 +17988,13 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17864
17988
|
}, extractSignalOutput = (prop) => {
|
|
17865
17989
|
if (!prop.initializer || !isOutputSignalCall(prop.initializer))
|
|
17866
17990
|
return null;
|
|
17867
|
-
if (!
|
|
17991
|
+
if (!lazyTypescript.isCallExpression(prop.initializer))
|
|
17868
17992
|
return null;
|
|
17869
17993
|
const classPropertyName = prop.name.getText();
|
|
17870
17994
|
const call = prop.initializer;
|
|
17871
17995
|
let bindingName = classPropertyName;
|
|
17872
17996
|
const [optsArg] = call.arguments;
|
|
17873
|
-
if (optsArg &&
|
|
17997
|
+
if (optsArg && lazyTypescript.isObjectLiteralExpression(optsArg)) {
|
|
17874
17998
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
17875
17999
|
if (aliasNode !== null)
|
|
17876
18000
|
bindingName = aliasNode;
|
|
@@ -17882,7 +18006,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17882
18006
|
let hasDecoratorIO = false;
|
|
17883
18007
|
let hasSignalIO = false;
|
|
17884
18008
|
for (const member of cls.members) {
|
|
17885
|
-
if (!
|
|
18009
|
+
if (!lazyTypescript.isPropertyDeclaration(member))
|
|
17886
18010
|
continue;
|
|
17887
18011
|
const decoratorIn = extractDecoratorInput(member, compiler);
|
|
17888
18012
|
if (decoratorIn) {
|
|
@@ -17916,21 +18040,21 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17916
18040
|
specialAttributes: {}
|
|
17917
18041
|
}), parseHostObjectInto = (host, args, hostExprNode, compiler) => {
|
|
17918
18042
|
const hostNode = getProperty(args, "host");
|
|
17919
|
-
if (!hostNode || !
|
|
18043
|
+
if (!hostNode || !lazyTypescript.isObjectLiteralExpression(hostNode)) {
|
|
17920
18044
|
if (!hostExprNode)
|
|
17921
18045
|
return;
|
|
17922
18046
|
}
|
|
17923
|
-
const obj = hostNode &&
|
|
18047
|
+
const obj = hostNode && lazyTypescript.isObjectLiteralExpression(hostNode) ? hostNode : hostExprNode;
|
|
17924
18048
|
if (!obj)
|
|
17925
18049
|
return;
|
|
17926
18050
|
for (const prop of obj.properties) {
|
|
17927
|
-
if (!
|
|
18051
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
17928
18052
|
continue;
|
|
17929
18053
|
const keyNode = prop.name;
|
|
17930
18054
|
let key;
|
|
17931
|
-
if (
|
|
18055
|
+
if (lazyTypescript.isStringLiteral(keyNode) || lazyTypescript.isNoSubstitutionTemplateLiteral(keyNode)) {
|
|
17932
18056
|
key = keyNode.text;
|
|
17933
|
-
} else if (
|
|
18057
|
+
} else if (lazyTypescript.isIdentifier(keyNode)) {
|
|
17934
18058
|
key = keyNode.text;
|
|
17935
18059
|
} else {
|
|
17936
18060
|
continue;
|
|
@@ -17947,39 +18071,39 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17947
18071
|
}
|
|
17948
18072
|
}, mergeMemberHostDecorators = (host, cls) => {
|
|
17949
18073
|
for (const member of cls.members) {
|
|
17950
|
-
if (!
|
|
18074
|
+
if (!lazyTypescript.canHaveDecorators(member))
|
|
17951
18075
|
continue;
|
|
17952
|
-
const decorators =
|
|
18076
|
+
const decorators = lazyTypescript.getDecorators(member) ?? [];
|
|
17953
18077
|
for (const dec of decorators) {
|
|
17954
18078
|
const expr = dec.expression;
|
|
17955
|
-
if (!
|
|
18079
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
17956
18080
|
continue;
|
|
17957
18081
|
const functionNode = expr.expression;
|
|
17958
|
-
if (!
|
|
18082
|
+
if (!lazyTypescript.isIdentifier(functionNode))
|
|
17959
18083
|
continue;
|
|
17960
18084
|
if (functionNode.text === "HostBinding") {
|
|
17961
|
-
if (!
|
|
18085
|
+
if (!lazyTypescript.isPropertyDeclaration(member) && !lazyTypescript.isGetAccessor(member))
|
|
17962
18086
|
continue;
|
|
17963
|
-
if (!
|
|
18087
|
+
if (!lazyTypescript.isIdentifier(member.name))
|
|
17964
18088
|
continue;
|
|
17965
18089
|
const propertyName = member.name.text;
|
|
17966
18090
|
const [target] = expr.arguments;
|
|
17967
|
-
const key = target &&
|
|
18091
|
+
const key = target && lazyTypescript.isStringLiteral(target) ? target.text : propertyName;
|
|
17968
18092
|
host.properties[key] = propertyName;
|
|
17969
18093
|
} else if (functionNode.text === "HostListener") {
|
|
17970
|
-
if (!
|
|
18094
|
+
if (!lazyTypescript.isMethodDeclaration(member))
|
|
17971
18095
|
continue;
|
|
17972
|
-
if (!
|
|
18096
|
+
if (!lazyTypescript.isIdentifier(member.name))
|
|
17973
18097
|
continue;
|
|
17974
18098
|
const methodName = member.name.text;
|
|
17975
18099
|
const [eventArg, argsArg] = expr.arguments;
|
|
17976
|
-
if (!eventArg || !
|
|
18100
|
+
if (!eventArg || !lazyTypescript.isStringLiteral(eventArg))
|
|
17977
18101
|
continue;
|
|
17978
18102
|
const event = eventArg.text;
|
|
17979
18103
|
const argsList = [];
|
|
17980
|
-
if (argsArg &&
|
|
18104
|
+
if (argsArg && lazyTypescript.isArrayLiteralExpression(argsArg)) {
|
|
17981
18105
|
for (const element of argsArg.elements) {
|
|
17982
|
-
if (
|
|
18106
|
+
if (lazyTypescript.isStringLiteral(element))
|
|
17983
18107
|
argsList.push(element.text);
|
|
17984
18108
|
}
|
|
17985
18109
|
}
|
|
@@ -17992,14 +18116,14 @@ var fail2 = (reason, detail, location) => ({
|
|
|
17992
18116
|
let descendants = true;
|
|
17993
18117
|
let emitDistinctChangesOnly = true;
|
|
17994
18118
|
const [, opts] = args;
|
|
17995
|
-
if (opts &&
|
|
18119
|
+
if (opts && lazyTypescript.isObjectLiteralExpression(opts)) {
|
|
17996
18120
|
static_ = getBooleanProperty(opts, "static") ?? false;
|
|
17997
18121
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
17998
18122
|
emitDistinctChangesOnly = getBooleanProperty(opts, "emitDistinctChangesOnly") ?? true;
|
|
17999
18123
|
}
|
|
18000
18124
|
return { descendants, emitDistinctChangesOnly, static_ };
|
|
18001
18125
|
}, queryPredicateFromArg = (arg, compiler) => {
|
|
18002
|
-
if (
|
|
18126
|
+
if (lazyTypescript.isStringLiteral(arg)) {
|
|
18003
18127
|
return arg.text.split(",").map((item) => item.trim()).filter(Boolean);
|
|
18004
18128
|
}
|
|
18005
18129
|
return {
|
|
@@ -18010,17 +18134,17 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18010
18134
|
const contentQueries = [];
|
|
18011
18135
|
const viewQueries = [];
|
|
18012
18136
|
for (const member of cls.members) {
|
|
18013
|
-
if (!
|
|
18137
|
+
if (!lazyTypescript.isPropertyDeclaration(member))
|
|
18014
18138
|
continue;
|
|
18015
|
-
const decorators =
|
|
18139
|
+
const decorators = lazyTypescript.getDecorators(member) ?? [];
|
|
18016
18140
|
for (const dec of decorators) {
|
|
18017
18141
|
const expr = dec.expression;
|
|
18018
|
-
if (!
|
|
18142
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
18019
18143
|
continue;
|
|
18020
18144
|
const functionNode = expr.expression;
|
|
18021
|
-
if (!
|
|
18145
|
+
if (!lazyTypescript.isIdentifier(functionNode) || !QUERY_DECORATORS.has(functionNode.text))
|
|
18022
18146
|
continue;
|
|
18023
|
-
if (!
|
|
18147
|
+
if (!lazyTypescript.isIdentifier(member.name))
|
|
18024
18148
|
continue;
|
|
18025
18149
|
const propertyName = member.name.text;
|
|
18026
18150
|
const [tokenArg, opts] = expr.arguments;
|
|
@@ -18031,7 +18155,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18031
18155
|
continue;
|
|
18032
18156
|
const { static_, descendants, emitDistinctChangesOnly } = parseQueryDecoratorOptions(expr.arguments);
|
|
18033
18157
|
let read = null;
|
|
18034
|
-
if (opts &&
|
|
18158
|
+
if (opts && lazyTypescript.isObjectLiteralExpression(opts)) {
|
|
18035
18159
|
const readNode = getProperty(opts, "read");
|
|
18036
18160
|
if (readNode) {
|
|
18037
18161
|
read = new compiler.WrappedNodeExpr(readNode);
|
|
@@ -18059,15 +18183,15 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18059
18183
|
const contentQueries = [];
|
|
18060
18184
|
const viewQueries = [];
|
|
18061
18185
|
for (const member of cls.members) {
|
|
18062
|
-
if (!
|
|
18186
|
+
if (!lazyTypescript.isPropertyDeclaration(member) || !member.initializer)
|
|
18063
18187
|
continue;
|
|
18064
18188
|
const init = member.initializer;
|
|
18065
|
-
if (!
|
|
18189
|
+
if (!lazyTypescript.isCallExpression(init))
|
|
18066
18190
|
continue;
|
|
18067
18191
|
let queryName;
|
|
18068
|
-
if (
|
|
18192
|
+
if (lazyTypescript.isIdentifier(init.expression)) {
|
|
18069
18193
|
queryName = init.expression.text;
|
|
18070
|
-
} else if (
|
|
18194
|
+
} else if (lazyTypescript.isPropertyAccessExpression(init.expression) && lazyTypescript.isIdentifier(init.expression.expression) && init.expression.name.text === "required") {
|
|
18071
18195
|
queryName = init.expression.expression.text;
|
|
18072
18196
|
} else {
|
|
18073
18197
|
continue;
|
|
@@ -18075,7 +18199,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18075
18199
|
const runtime = SIGNAL_QUERY_TO_RUNTIME[queryName];
|
|
18076
18200
|
if (!runtime)
|
|
18077
18201
|
continue;
|
|
18078
|
-
if (!
|
|
18202
|
+
if (!lazyTypescript.isIdentifier(member.name))
|
|
18079
18203
|
continue;
|
|
18080
18204
|
const propertyName = member.name.text;
|
|
18081
18205
|
const [tokenArg, opts] = init.arguments;
|
|
@@ -18086,7 +18210,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18086
18210
|
continue;
|
|
18087
18211
|
let descendants = true;
|
|
18088
18212
|
let read = null;
|
|
18089
|
-
if (opts &&
|
|
18213
|
+
if (opts && lazyTypescript.isObjectLiteralExpression(opts)) {
|
|
18090
18214
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
18091
18215
|
const readNode = getProperty(opts, "read");
|
|
18092
18216
|
if (readNode)
|
|
@@ -18112,13 +18236,13 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18112
18236
|
const node = getProperty(args, "exportAs");
|
|
18113
18237
|
if (!node)
|
|
18114
18238
|
return null;
|
|
18115
|
-
if (
|
|
18239
|
+
if (lazyTypescript.isStringLiteral(node)) {
|
|
18116
18240
|
return node.text.split(",").map((item) => item.trim()).filter(Boolean);
|
|
18117
18241
|
}
|
|
18118
|
-
if (
|
|
18242
|
+
if (lazyTypescript.isArrayLiteralExpression(node)) {
|
|
18119
18243
|
const out = [];
|
|
18120
18244
|
for (const element of node.elements) {
|
|
18121
|
-
if (
|
|
18245
|
+
if (lazyTypescript.isStringLiteral(element))
|
|
18122
18246
|
out.push(element.text);
|
|
18123
18247
|
}
|
|
18124
18248
|
return out.length > 0 ? out : null;
|
|
@@ -18126,11 +18250,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18126
18250
|
return null;
|
|
18127
18251
|
}, extractHostDirectives = (args, compiler) => {
|
|
18128
18252
|
const node = getProperty(args, "hostDirectives");
|
|
18129
|
-
if (!node || !
|
|
18253
|
+
if (!node || !lazyTypescript.isArrayLiteralExpression(node))
|
|
18130
18254
|
return null;
|
|
18131
18255
|
const out = [];
|
|
18132
18256
|
for (const element of node.elements) {
|
|
18133
|
-
if (
|
|
18257
|
+
if (lazyTypescript.isIdentifier(element)) {
|
|
18134
18258
|
out.push({
|
|
18135
18259
|
directive: {
|
|
18136
18260
|
type: new compiler.WrappedNodeExpr(element),
|
|
@@ -18142,7 +18266,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18142
18266
|
});
|
|
18143
18267
|
continue;
|
|
18144
18268
|
}
|
|
18145
|
-
if (!
|
|
18269
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
18146
18270
|
continue;
|
|
18147
18271
|
const directiveNode = getProperty(element, "directive");
|
|
18148
18272
|
if (!directiveNode)
|
|
@@ -18150,11 +18274,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18150
18274
|
const inputsNode = getProperty(element, "inputs");
|
|
18151
18275
|
const outputsNode = getProperty(element, "outputs");
|
|
18152
18276
|
const collectMap = (expression) => {
|
|
18153
|
-
if (!expression || !
|
|
18277
|
+
if (!expression || !lazyTypescript.isArrayLiteralExpression(expression))
|
|
18154
18278
|
return null;
|
|
18155
18279
|
const map = {};
|
|
18156
18280
|
for (const mappingElement of expression.elements) {
|
|
18157
|
-
if (!
|
|
18281
|
+
if (!lazyTypescript.isStringLiteral(mappingElement))
|
|
18158
18282
|
continue;
|
|
18159
18283
|
const [name, alias] = mappingElement.text.split(":").map((segment) => segment.trim());
|
|
18160
18284
|
if (name)
|
|
@@ -18207,7 +18331,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18207
18331
|
const cacheKey = `ts:${filePath}:${className}`;
|
|
18208
18332
|
let stat;
|
|
18209
18333
|
try {
|
|
18210
|
-
stat =
|
|
18334
|
+
stat = statSync5(filePath);
|
|
18211
18335
|
} catch {
|
|
18212
18336
|
return null;
|
|
18213
18337
|
}
|
|
@@ -18224,10 +18348,10 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18224
18348
|
});
|
|
18225
18349
|
return null;
|
|
18226
18350
|
}
|
|
18227
|
-
const sourceFile =
|
|
18351
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true);
|
|
18228
18352
|
let info = null;
|
|
18229
18353
|
for (const stmt of sourceFile.statements) {
|
|
18230
|
-
if (!
|
|
18354
|
+
if (!lazyTypescript.isClassDeclaration(stmt))
|
|
18231
18355
|
continue;
|
|
18232
18356
|
if (!stmt.name || stmt.name.text !== className)
|
|
18233
18357
|
continue;
|
|
@@ -18261,7 +18385,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18261
18385
|
const cacheKey = `dts:${dtsPath}:${className}`;
|
|
18262
18386
|
let stat;
|
|
18263
18387
|
try {
|
|
18264
|
-
stat =
|
|
18388
|
+
stat = statSync5(dtsPath);
|
|
18265
18389
|
} catch {
|
|
18266
18390
|
return null;
|
|
18267
18391
|
}
|
|
@@ -18365,9 +18489,9 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18365
18489
|
}, buildClassToSpecMap = (sourceFile) => {
|
|
18366
18490
|
const result = new Map;
|
|
18367
18491
|
for (const stmt of sourceFile.statements) {
|
|
18368
|
-
if (!
|
|
18492
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
18369
18493
|
continue;
|
|
18370
|
-
if (!
|
|
18494
|
+
if (!lazyTypescript.isStringLiteral(stmt.moduleSpecifier))
|
|
18371
18495
|
continue;
|
|
18372
18496
|
const spec = stmt.moduleSpecifier.text;
|
|
18373
18497
|
const clause = stmt.importClause;
|
|
@@ -18376,7 +18500,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18376
18500
|
if (clause.name)
|
|
18377
18501
|
result.set(clause.name.text, spec);
|
|
18378
18502
|
const named = clause.namedBindings;
|
|
18379
|
-
if (named &&
|
|
18503
|
+
if (named && lazyTypescript.isNamedImports(named)) {
|
|
18380
18504
|
for (const element of named.elements) {
|
|
18381
18505
|
if (element.isTypeOnly)
|
|
18382
18506
|
continue;
|
|
@@ -18489,7 +18613,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18489
18613
|
return result;
|
|
18490
18614
|
const classToSpec = buildClassToSpecMap(sourceFile);
|
|
18491
18615
|
for (const element of importsExpr.elements) {
|
|
18492
|
-
if (!
|
|
18616
|
+
if (!lazyTypescript.isIdentifier(element))
|
|
18493
18617
|
continue;
|
|
18494
18618
|
const className = element.text;
|
|
18495
18619
|
const spec = classToSpec.get(className);
|
|
@@ -18508,35 +18632,35 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18508
18632
|
}
|
|
18509
18633
|
return (hash >>> 0).toString(36);
|
|
18510
18634
|
}, initializerShapeIsStructural = (node) => {
|
|
18511
|
-
if (
|
|
18635
|
+
if (lazyTypescript.isArrowFunction(node) || lazyTypescript.isFunctionExpression(node) || lazyTypescript.isCallExpression(node) || lazyTypescript.isNewExpression(node)) {
|
|
18512
18636
|
return true;
|
|
18513
18637
|
}
|
|
18514
|
-
if (
|
|
18638
|
+
if (lazyTypescript.isConditionalExpression(node)) {
|
|
18515
18639
|
return initializerShapeIsStructural(node.whenTrue) || initializerShapeIsStructural(node.whenFalse);
|
|
18516
18640
|
}
|
|
18517
|
-
if (
|
|
18641
|
+
if (lazyTypescript.isParenthesizedExpression(node)) {
|
|
18518
18642
|
return initializerShapeIsStructural(node.expression);
|
|
18519
18643
|
}
|
|
18520
|
-
if (
|
|
18644
|
+
if (lazyTypescript.isAsExpression(node) || lazyTypescript.isTypeAssertionExpression(node)) {
|
|
18521
18645
|
return initializerShapeIsStructural(node.expression);
|
|
18522
18646
|
}
|
|
18523
|
-
if (
|
|
18647
|
+
if (lazyTypescript.isNonNullExpression(node)) {
|
|
18524
18648
|
return initializerShapeIsStructural(node.expression);
|
|
18525
18649
|
}
|
|
18526
|
-
if (
|
|
18650
|
+
if (lazyTypescript.isObjectLiteralExpression(node)) {
|
|
18527
18651
|
for (const prop of node.properties) {
|
|
18528
|
-
if (
|
|
18652
|
+
if (lazyTypescript.isPropertyAssignment(prop) && initializerShapeIsStructural(prop.initializer)) {
|
|
18529
18653
|
return true;
|
|
18530
18654
|
}
|
|
18531
|
-
if (
|
|
18655
|
+
if (lazyTypescript.isShorthandPropertyAssignment(prop))
|
|
18532
18656
|
continue;
|
|
18533
|
-
if (
|
|
18657
|
+
if (lazyTypescript.isSpreadAssignment(prop) && initializerShapeIsStructural(prop.expression)) {
|
|
18534
18658
|
return true;
|
|
18535
18659
|
}
|
|
18536
18660
|
}
|
|
18537
18661
|
return false;
|
|
18538
18662
|
}
|
|
18539
|
-
if (
|
|
18663
|
+
if (lazyTypescript.isArrayLiteralExpression(node)) {
|
|
18540
18664
|
for (const element of node.elements) {
|
|
18541
18665
|
if (initializerShapeIsStructural(element))
|
|
18542
18666
|
return true;
|
|
@@ -18547,7 +18671,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18547
18671
|
}, extractArrowFieldSig = (cls) => {
|
|
18548
18672
|
const entries = [];
|
|
18549
18673
|
for (const member of cls.members) {
|
|
18550
|
-
if (!
|
|
18674
|
+
if (!lazyTypescript.isPropertyDeclaration(member))
|
|
18551
18675
|
continue;
|
|
18552
18676
|
const init = member.initializer;
|
|
18553
18677
|
if (!init)
|
|
@@ -18557,12 +18681,12 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18557
18681
|
const name = member.name.getText();
|
|
18558
18682
|
let bodyText;
|
|
18559
18683
|
try {
|
|
18560
|
-
const printer =
|
|
18561
|
-
newLine:
|
|
18684
|
+
const printer = lazyTypescript.createPrinter({
|
|
18685
|
+
newLine: lazyTypescript.NewLineKind.LineFeed,
|
|
18562
18686
|
omitTrailingSemicolon: true,
|
|
18563
18687
|
removeComments: true
|
|
18564
18688
|
});
|
|
18565
|
-
bodyText = printer.printNode(
|
|
18689
|
+
bodyText = printer.printNode(lazyTypescript.EmitHint.Unspecified, init, cls.getSourceFile());
|
|
18566
18690
|
} catch {
|
|
18567
18691
|
bodyText = init.getText();
|
|
18568
18692
|
}
|
|
@@ -18573,9 +18697,9 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18573
18697
|
}, INPUT_OUTPUT_DECORATORS, extractMemberDecoratorSig = (cls) => {
|
|
18574
18698
|
const entries = [];
|
|
18575
18699
|
for (const member of cls.members) {
|
|
18576
|
-
if (!
|
|
18700
|
+
if (!lazyTypescript.canHaveDecorators(member))
|
|
18577
18701
|
continue;
|
|
18578
|
-
const decorators =
|
|
18702
|
+
const decorators = lazyTypescript.getDecorators(member) ?? [];
|
|
18579
18703
|
if (decorators.length === 0)
|
|
18580
18704
|
continue;
|
|
18581
18705
|
const memberName = member.name?.getText() ?? "<anon>";
|
|
@@ -18583,14 +18707,14 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18583
18707
|
const expr = decorator.expression;
|
|
18584
18708
|
let decName = "<unknown>";
|
|
18585
18709
|
let argText = "";
|
|
18586
|
-
if (
|
|
18587
|
-
if (
|
|
18710
|
+
if (lazyTypescript.isCallExpression(expr)) {
|
|
18711
|
+
if (lazyTypescript.isIdentifier(expr.expression)) {
|
|
18588
18712
|
decName = expr.expression.text;
|
|
18589
18713
|
}
|
|
18590
18714
|
if (expr.arguments.length > 0) {
|
|
18591
18715
|
argText = expr.arguments.map((leftValue) => leftValue.getText()).join(",");
|
|
18592
18716
|
}
|
|
18593
|
-
} else if (
|
|
18717
|
+
} else if (lazyTypescript.isIdentifier(expr)) {
|
|
18594
18718
|
decName = expr.text;
|
|
18595
18719
|
}
|
|
18596
18720
|
if (INPUT_OUTPUT_DECORATORS.has(decName))
|
|
@@ -18602,7 +18726,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18602
18726
|
}, providerProbeCache, fileHasModuleProviders = (filePath) => {
|
|
18603
18727
|
let stat;
|
|
18604
18728
|
try {
|
|
18605
|
-
stat =
|
|
18729
|
+
stat = statSync5(filePath);
|
|
18606
18730
|
} catch {
|
|
18607
18731
|
return true;
|
|
18608
18732
|
}
|
|
@@ -18615,18 +18739,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18615
18739
|
} catch {
|
|
18616
18740
|
return true;
|
|
18617
18741
|
}
|
|
18618
|
-
const sourceFile =
|
|
18742
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
|
|
18619
18743
|
let hasProviders = false;
|
|
18620
18744
|
const visit = (node) => {
|
|
18621
18745
|
if (hasProviders)
|
|
18622
18746
|
return;
|
|
18623
|
-
if (
|
|
18624
|
-
for (const decorator of
|
|
18747
|
+
if (lazyTypescript.isClassDeclaration(node)) {
|
|
18748
|
+
for (const decorator of lazyTypescript.getDecorators(node) ?? []) {
|
|
18625
18749
|
const expr = decorator.expression;
|
|
18626
|
-
if (!
|
|
18750
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
18627
18751
|
continue;
|
|
18628
18752
|
const [arg] = expr.arguments;
|
|
18629
|
-
if (!arg || !
|
|
18753
|
+
if (!arg || !lazyTypescript.isObjectLiteralExpression(arg))
|
|
18630
18754
|
continue;
|
|
18631
18755
|
if (getProperty(arg, "providers") !== null) {
|
|
18632
18756
|
hasProviders = true;
|
|
@@ -18634,7 +18758,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18634
18758
|
}
|
|
18635
18759
|
}
|
|
18636
18760
|
}
|
|
18637
|
-
|
|
18761
|
+
lazyTypescript.forEachChild(node, visit);
|
|
18638
18762
|
};
|
|
18639
18763
|
visit(sourceFile);
|
|
18640
18764
|
providerProbeCache.set(filePath, {
|
|
@@ -18644,10 +18768,10 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18644
18768
|
return hasProviders;
|
|
18645
18769
|
}, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
|
|
18646
18770
|
for (const stmt of sourceFile.statements) {
|
|
18647
|
-
if (!
|
|
18771
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
18648
18772
|
continue;
|
|
18649
18773
|
const moduleSpec = stmt.moduleSpecifier;
|
|
18650
|
-
if (!
|
|
18774
|
+
if (!lazyTypescript.isStringLiteral(moduleSpec))
|
|
18651
18775
|
continue;
|
|
18652
18776
|
const spec = moduleSpec.text;
|
|
18653
18777
|
if (!spec.startsWith(".") && !spec.startsWith("/"))
|
|
@@ -18661,7 +18785,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18661
18785
|
}
|
|
18662
18786
|
if (importClause.namedBindings) {
|
|
18663
18787
|
const item = importClause.namedBindings;
|
|
18664
|
-
if (
|
|
18788
|
+
if (lazyTypescript.isNamespaceImport(item)) {
|
|
18665
18789
|
if (item.name.text === identifierName)
|
|
18666
18790
|
matches = true;
|
|
18667
18791
|
} else {
|
|
@@ -18691,7 +18815,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18691
18815
|
return [];
|
|
18692
18816
|
const sig = [];
|
|
18693
18817
|
for (const entry of importsExpr.elements) {
|
|
18694
|
-
if (
|
|
18818
|
+
if (lazyTypescript.isIdentifier(entry)) {
|
|
18695
18819
|
const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
|
|
18696
18820
|
if (importPath) {
|
|
18697
18821
|
if (fileHasModuleProviders(importPath)) {
|
|
@@ -18708,14 +18832,14 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18708
18832
|
}
|
|
18709
18833
|
return sig.sort();
|
|
18710
18834
|
}, getPropertyNameText = (name) => {
|
|
18711
|
-
if (
|
|
18835
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name) || lazyTypescript.isNoSubstitutionTemplateLiteral(name)) {
|
|
18712
18836
|
return name.text;
|
|
18713
18837
|
}
|
|
18714
18838
|
return name.getText();
|
|
18715
18839
|
}, extractPropertyFieldNames = (cls) => {
|
|
18716
18840
|
const names = [];
|
|
18717
18841
|
for (const member of cls.members) {
|
|
18718
|
-
if (!
|
|
18842
|
+
if (!lazyTypescript.isPropertyDeclaration(member) && !lazyTypescript.isMethodDeclaration(member) && !lazyTypescript.isGetAccessorDeclaration(member) && !lazyTypescript.isSetAccessorDeclaration(member)) {
|
|
18719
18843
|
continue;
|
|
18720
18844
|
}
|
|
18721
18845
|
const { name } = member;
|
|
@@ -18729,7 +18853,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18729
18853
|
}, extractTopLevelImports = (sourceFile) => {
|
|
18730
18854
|
const names = new Set;
|
|
18731
18855
|
for (const stmt of sourceFile.statements) {
|
|
18732
|
-
if (!
|
|
18856
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
18733
18857
|
continue;
|
|
18734
18858
|
const clause = stmt.importClause;
|
|
18735
18859
|
if (!clause)
|
|
@@ -18741,9 +18865,9 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18741
18865
|
const bindings = clause.namedBindings;
|
|
18742
18866
|
if (!bindings)
|
|
18743
18867
|
continue;
|
|
18744
|
-
if (
|
|
18868
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
18745
18869
|
names.add(bindings.name.text);
|
|
18746
|
-
} else if (
|
|
18870
|
+
} else if (lazyTypescript.isNamedImports(bindings)) {
|
|
18747
18871
|
for (const element of bindings.elements) {
|
|
18748
18872
|
if (element.isTypeOnly)
|
|
18749
18873
|
continue;
|
|
@@ -18755,18 +18879,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18755
18879
|
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
|
|
18756
18880
|
const ctorParamTypes = [];
|
|
18757
18881
|
for (const member of cls.members) {
|
|
18758
|
-
if (!
|
|
18882
|
+
if (!lazyTypescript.isConstructorDeclaration(member))
|
|
18759
18883
|
continue;
|
|
18760
18884
|
for (const param of member.parameters) {
|
|
18761
18885
|
const typeText = param.type ? param.type.getText() : "";
|
|
18762
|
-
const decorators =
|
|
18886
|
+
const decorators = lazyTypescript.getDecorators(param) ?? [];
|
|
18763
18887
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d) => {
|
|
18764
18888
|
const expr = d.expression;
|
|
18765
|
-
if (
|
|
18889
|
+
if (lazyTypescript.isCallExpression(expr) && lazyTypescript.isIdentifier(expr.expression)) {
|
|
18766
18890
|
const args = expr.arguments.map((a) => a.getText()).join(",");
|
|
18767
18891
|
return `@${expr.expression.text}(${args})`;
|
|
18768
18892
|
}
|
|
18769
|
-
if (
|
|
18893
|
+
if (lazyTypescript.isIdentifier(expr)) {
|
|
18770
18894
|
return `@${expr.text}`;
|
|
18771
18895
|
}
|
|
18772
18896
|
return "@<unknown>";
|
|
@@ -18782,12 +18906,12 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18782
18906
|
const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
|
|
18783
18907
|
const topLevelImports = extractTopLevelImports(sourceFile);
|
|
18784
18908
|
const propertyFieldNames = extractPropertyFieldNames(cls);
|
|
18785
|
-
const printer =
|
|
18786
|
-
newLine:
|
|
18909
|
+
const printer = lazyTypescript.createPrinter({
|
|
18910
|
+
newLine: lazyTypescript.NewLineKind.LineFeed,
|
|
18787
18911
|
omitTrailingSemicolon: true,
|
|
18788
18912
|
removeComments: true
|
|
18789
18913
|
});
|
|
18790
|
-
const canonicalText = (node) => printer.printNode(
|
|
18914
|
+
const canonicalText = (node) => printer.printNode(lazyTypescript.EmitHint.Unspecified, node, sourceFile);
|
|
18791
18915
|
const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
|
|
18792
18916
|
const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
|
|
18793
18917
|
const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
|
|
@@ -18800,13 +18924,13 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18800
18924
|
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
18801
18925
|
const pageExportEntries = [];
|
|
18802
18926
|
for (const stmt of sourceFile.statements) {
|
|
18803
|
-
if (!
|
|
18927
|
+
if (!lazyTypescript.isVariableStatement(stmt))
|
|
18804
18928
|
continue;
|
|
18805
|
-
const isExported = stmt.modifiers?.some((item) => item.kind ===
|
|
18929
|
+
const isExported = stmt.modifiers?.some((item) => item.kind === lazyTypescript.SyntaxKind.ExportKeyword);
|
|
18806
18930
|
if (!isExported)
|
|
18807
18931
|
continue;
|
|
18808
18932
|
for (const decl of stmt.declarationList.declarations) {
|
|
18809
|
-
if (!
|
|
18933
|
+
if (!lazyTypescript.isIdentifier(decl.name))
|
|
18810
18934
|
continue;
|
|
18811
18935
|
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
18812
18936
|
continue;
|
|
@@ -18847,35 +18971,35 @@ var fail2 = (reason, detail, location) => ({
|
|
|
18847
18971
|
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
18848
18972
|
const memberSources = [];
|
|
18849
18973
|
let hasStatic = false;
|
|
18850
|
-
const printer =
|
|
18974
|
+
const printer = lazyTypescript.createPrinter({ removeComments: true });
|
|
18851
18975
|
for (const member of classNode.members) {
|
|
18852
|
-
if (
|
|
18853
|
-
const modifiers = (
|
|
18854
|
-
const cleaned =
|
|
18855
|
-
memberSources.push(printer.printNode(
|
|
18976
|
+
if (lazyTypescript.isPropertyDeclaration(member)) {
|
|
18977
|
+
const modifiers = (lazyTypescript.getModifiers(member) ?? []).filter((m) => m.kind !== lazyTypescript.SyntaxKind.PrivateKeyword && m.kind !== lazyTypescript.SyntaxKind.PublicKeyword && m.kind !== lazyTypescript.SyntaxKind.ProtectedKeyword && m.kind !== lazyTypescript.SyntaxKind.ReadonlyKeyword && m.kind !== lazyTypescript.SyntaxKind.OverrideKeyword);
|
|
18978
|
+
const cleaned = lazyTypescript.factory.createPropertyDeclaration(modifiers, member.name, undefined, undefined, member.initializer);
|
|
18979
|
+
memberSources.push(printer.printNode(lazyTypescript.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
18856
18980
|
continue;
|
|
18857
18981
|
}
|
|
18858
|
-
if (
|
|
18859
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
18860
|
-
const cleaned =
|
|
18861
|
-
memberSources.push(printer.printNode(
|
|
18982
|
+
if (lazyTypescript.isConstructorDeclaration(member)) {
|
|
18983
|
+
const cleanedParams = member.parameters.map((param) => lazyTypescript.factory.updateParameterDeclaration(param, (lazyTypescript.getModifiers(param) ?? []).filter((item) => item.kind !== lazyTypescript.SyntaxKind.PrivateKeyword && item.kind !== lazyTypescript.SyntaxKind.PublicKeyword && item.kind !== lazyTypescript.SyntaxKind.ProtectedKeyword && item.kind !== lazyTypescript.SyntaxKind.ReadonlyKeyword && item.kind !== lazyTypescript.SyntaxKind.OverrideKeyword), param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
18984
|
+
const cleaned = lazyTypescript.factory.createConstructorDeclaration([], cleanedParams, member.body);
|
|
18985
|
+
memberSources.push(printer.printNode(lazyTypescript.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
18862
18986
|
continue;
|
|
18863
18987
|
}
|
|
18864
|
-
if (
|
|
18865
|
-
const modifiers =
|
|
18866
|
-
const isStatic = modifiers.some((m) => m.kind ===
|
|
18988
|
+
if (lazyTypescript.isMethodDeclaration(member) || lazyTypescript.isGetAccessorDeclaration(member) || lazyTypescript.isSetAccessorDeclaration(member)) {
|
|
18989
|
+
const modifiers = lazyTypescript.getModifiers(member) ?? [];
|
|
18990
|
+
const isStatic = modifiers.some((m) => m.kind === lazyTypescript.SyntaxKind.StaticKeyword);
|
|
18867
18991
|
if (isStatic)
|
|
18868
18992
|
hasStatic = true;
|
|
18869
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
18993
|
+
const cleanedParams = member.parameters.map((param) => lazyTypescript.factory.updateParameterDeclaration(param, lazyTypescript.getModifiers(param) ?? [], param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
18870
18994
|
let cleaned;
|
|
18871
|
-
if (
|
|
18872
|
-
cleaned =
|
|
18873
|
-
} else if (
|
|
18874
|
-
cleaned =
|
|
18995
|
+
if (lazyTypescript.isMethodDeclaration(member)) {
|
|
18996
|
+
cleaned = lazyTypescript.factory.createMethodDeclaration(modifiers, member.asteriskToken, member.name, member.questionToken, member.typeParameters, cleanedParams, member.type, member.body);
|
|
18997
|
+
} else if (lazyTypescript.isGetAccessorDeclaration(member)) {
|
|
18998
|
+
cleaned = lazyTypescript.factory.createGetAccessorDeclaration(modifiers, member.name, cleanedParams, member.type, member.body);
|
|
18875
18999
|
} else {
|
|
18876
|
-
cleaned =
|
|
19000
|
+
cleaned = lazyTypescript.factory.createSetAccessorDeclaration(modifiers, member.name, cleanedParams, member.body);
|
|
18877
19001
|
}
|
|
18878
|
-
const printed = printer.printNode(
|
|
19002
|
+
const printed = printer.printNode(lazyTypescript.EmitHint.Unspecified, cleaned, classNode.getSourceFile());
|
|
18879
19003
|
memberSources.push(printed);
|
|
18880
19004
|
}
|
|
18881
19005
|
}
|
|
@@ -18887,10 +19011,10 @@ ${memberSources.join(`
|
|
|
18887
19011
|
}`;
|
|
18888
19012
|
let transpiled;
|
|
18889
19013
|
try {
|
|
18890
|
-
transpiled =
|
|
19014
|
+
transpiled = lazyTypescript.transpileModule(wrappedSource, {
|
|
18891
19015
|
compilerOptions: {
|
|
18892
|
-
module:
|
|
18893
|
-
target:
|
|
19016
|
+
module: lazyTypescript.ModuleKind.ES2022,
|
|
19017
|
+
target: lazyTypescript.ScriptTarget.ES2022
|
|
18894
19018
|
},
|
|
18895
19019
|
reportDiagnostics: false
|
|
18896
19020
|
}).outputText;
|
|
@@ -18975,7 +19099,7 @@ ${block}
|
|
|
18975
19099
|
if (existsSync30(tsconfigPath)) {
|
|
18976
19100
|
try {
|
|
18977
19101
|
const text = readFileSync24(tsconfigPath, "utf8");
|
|
18978
|
-
const parsed =
|
|
19102
|
+
const parsed = lazyTypescript.parseConfigFileTextToJson(tsconfigPath, text);
|
|
18979
19103
|
if (!parsed.error && parsed.config) {
|
|
18980
19104
|
const cfg = parsed.config;
|
|
18981
19105
|
const ang = cfg.angularCompilerOptions ?? {};
|
|
@@ -19009,7 +19133,7 @@ ${block}
|
|
|
19009
19133
|
return fail2("unexpected-error", `import @angular/compiler: ${err}`);
|
|
19010
19134
|
}
|
|
19011
19135
|
const tsSource = readFileSync24(componentFilePath, "utf8");
|
|
19012
|
-
const sourceFile =
|
|
19136
|
+
const sourceFile = lazyTypescript.createSourceFile(componentFilePath, tsSource, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
|
|
19013
19137
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
19014
19138
|
if (!classNode) {
|
|
19015
19139
|
return fail2("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -19138,7 +19262,7 @@ ${block}
|
|
|
19138
19262
|
isSignal: (hasSignalIO || advancedMetadata.contentQueries.some((item) => item.isSignal) || advancedMetadata.viewQueries.some((item) => item.isSignal)) && !hasDecoratorIO && !advancedMetadata.contentQueries.some((item) => !item.isSignal) && !advancedMetadata.viewQueries.some((item) => !item.isSignal),
|
|
19139
19263
|
isStandalone: decoratorMeta.standalone,
|
|
19140
19264
|
lifecycle: {
|
|
19141
|
-
usesOnChanges: classNode.members.some((m) =>
|
|
19265
|
+
usesOnChanges: classNode.members.some((m) => lazyTypescript.isMethodDeclaration(m) && m.name !== undefined && lazyTypescript.isIdentifier(m.name) && m.name.text === "ngOnChanges")
|
|
19142
19266
|
},
|
|
19143
19267
|
name: className,
|
|
19144
19268
|
outputs,
|
|
@@ -19187,18 +19311,18 @@ ${block}
|
|
|
19187
19311
|
}
|
|
19188
19312
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
19189
19313
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
19190
|
-
if (!
|
|
19314
|
+
if (!lazyTypescript.isFunctionDeclaration(tsFunctionDecl)) {
|
|
19191
19315
|
return fail2("unexpected-error", "Angular HMR callback did not translate to a function declaration");
|
|
19192
19316
|
}
|
|
19193
|
-
const exportedDecl =
|
|
19194
|
-
|
|
19195
|
-
|
|
19317
|
+
const exportedDecl = lazyTypescript.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
19318
|
+
lazyTypescript.factory.createToken(lazyTypescript.SyntaxKind.ExportKeyword),
|
|
19319
|
+
lazyTypescript.factory.createToken(lazyTypescript.SyntaxKind.DefaultKeyword)
|
|
19196
19320
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
19197
|
-
const printer =
|
|
19198
|
-
newLine:
|
|
19321
|
+
const printer = lazyTypescript.createPrinter({
|
|
19322
|
+
newLine: lazyTypescript.NewLineKind.LineFeed,
|
|
19199
19323
|
removeComments: false
|
|
19200
19324
|
});
|
|
19201
|
-
const fnText = printer.printNode(
|
|
19325
|
+
const fnText = printer.printNode(lazyTypescript.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
19202
19326
|
const provisionalMethodsBlock = buildFreshClassMethodsBlock(classNode, className) ?? "";
|
|
19203
19327
|
const referencedNames = new Set;
|
|
19204
19328
|
const identRe = /[A-Za-z_$][A-Za-z0-9_$]*/g;
|
|
@@ -19208,32 +19332,32 @@ ${block}
|
|
|
19208
19332
|
}
|
|
19209
19333
|
const sourceScopeNames = new Set;
|
|
19210
19334
|
for (const stmt of sourceFile.statements) {
|
|
19211
|
-
if (
|
|
19212
|
-
if (!
|
|
19335
|
+
if (lazyTypescript.isImportDeclaration(stmt)) {
|
|
19336
|
+
if (!lazyTypescript.isStringLiteral(stmt.moduleSpecifier))
|
|
19213
19337
|
continue;
|
|
19214
19338
|
const clause = stmt.importClause;
|
|
19215
19339
|
if (clause?.name)
|
|
19216
19340
|
sourceScopeNames.add(clause.name.text);
|
|
19217
|
-
if (clause?.namedBindings &&
|
|
19341
|
+
if (clause?.namedBindings && lazyTypescript.isNamedImports(clause.namedBindings)) {
|
|
19218
19342
|
for (const element of clause.namedBindings.elements) {
|
|
19219
19343
|
if (element.isTypeOnly)
|
|
19220
19344
|
continue;
|
|
19221
19345
|
sourceScopeNames.add(element.name.text);
|
|
19222
19346
|
}
|
|
19223
|
-
} else if (clause?.namedBindings &&
|
|
19347
|
+
} else if (clause?.namedBindings && lazyTypescript.isNamespaceImport(clause.namedBindings)) {
|
|
19224
19348
|
sourceScopeNames.add(clause.namedBindings.name.text);
|
|
19225
19349
|
}
|
|
19226
19350
|
continue;
|
|
19227
19351
|
}
|
|
19228
|
-
if (
|
|
19352
|
+
if (lazyTypescript.isVariableStatement(stmt)) {
|
|
19229
19353
|
for (const decl of stmt.declarationList.declarations) {
|
|
19230
|
-
if (
|
|
19354
|
+
if (lazyTypescript.isIdentifier(decl.name)) {
|
|
19231
19355
|
sourceScopeNames.add(decl.name.text);
|
|
19232
19356
|
}
|
|
19233
19357
|
}
|
|
19234
19358
|
continue;
|
|
19235
19359
|
}
|
|
19236
|
-
if (
|
|
19360
|
+
if (lazyTypescript.isFunctionDeclaration(stmt) || lazyTypescript.isClassDeclaration(stmt)) {
|
|
19237
19361
|
if (stmt.name)
|
|
19238
19362
|
sourceScopeNames.add(stmt.name.text);
|
|
19239
19363
|
}
|
|
@@ -19244,7 +19368,7 @@ ${block}
|
|
|
19244
19368
|
}
|
|
19245
19369
|
const allImportedNames = new Set;
|
|
19246
19370
|
for (const stmt of sourceFile.statements) {
|
|
19247
|
-
if (!
|
|
19371
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
19248
19372
|
continue;
|
|
19249
19373
|
const clause = stmt.importClause;
|
|
19250
19374
|
if (!clause || clause.isTypeOnly)
|
|
@@ -19254,7 +19378,7 @@ ${block}
|
|
|
19254
19378
|
const bindings = clause.namedBindings;
|
|
19255
19379
|
if (!bindings)
|
|
19256
19380
|
continue;
|
|
19257
|
-
if (
|
|
19381
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
19258
19382
|
allImportedNames.add(bindings.name.text);
|
|
19259
19383
|
} else {
|
|
19260
19384
|
for (const element of bindings.elements) {
|
|
@@ -19266,10 +19390,10 @@ ${block}
|
|
|
19266
19390
|
}
|
|
19267
19391
|
const depsToDestructure = [...sourceScopeNames].filter((n) => referencedNames.has(n) || allImportedNames.has(n));
|
|
19268
19392
|
const tsSourceText = fnText;
|
|
19269
|
-
const transpiled =
|
|
19393
|
+
const transpiled = lazyTypescript.transpileModule(tsSourceText, {
|
|
19270
19394
|
compilerOptions: {
|
|
19271
|
-
module:
|
|
19272
|
-
target:
|
|
19395
|
+
module: lazyTypescript.ModuleKind.ES2022,
|
|
19396
|
+
target: lazyTypescript.ScriptTarget.ES2022
|
|
19273
19397
|
},
|
|
19274
19398
|
fileName: componentFilePath,
|
|
19275
19399
|
reportDiagnostics: false
|
|
@@ -19326,6 +19450,7 @@ ${methodsBlock}
|
|
|
19326
19450
|
}
|
|
19327
19451
|
};
|
|
19328
19452
|
var init_fastHmrCompiler = __esm(() => {
|
|
19453
|
+
init_lazyTypescript();
|
|
19329
19454
|
init_stylePreprocessor();
|
|
19330
19455
|
init_hmrImportGenerator();
|
|
19331
19456
|
init_typescript_translator();
|
|
@@ -19382,11 +19507,10 @@ var init_fastHmrCompiler = __esm(() => {
|
|
|
19382
19507
|
// src/build/scanVueSsrOnlyPages.ts
|
|
19383
19508
|
import { readdirSync as readdirSync3, readFileSync as readFileSync25 } from "fs";
|
|
19384
19509
|
import { join as join40 } from "path";
|
|
19385
|
-
import ts13 from "typescript";
|
|
19386
19510
|
var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
19387
19511
|
if (filePath.endsWith(".tsx"))
|
|
19388
|
-
return
|
|
19389
|
-
return
|
|
19512
|
+
return lazyTypescript.ScriptKind.TSX;
|
|
19513
|
+
return lazyTypescript.ScriptKind.TS;
|
|
19390
19514
|
}, hasSourceExtension2 = (filePath) => {
|
|
19391
19515
|
const idx = filePath.lastIndexOf(".");
|
|
19392
19516
|
if (idx === -1)
|
|
@@ -19422,51 +19546,51 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
19422
19546
|
}
|
|
19423
19547
|
return out;
|
|
19424
19548
|
}, fileMayContainVueHandler = (source) => source.includes("handleVuePageRequest"), isHandleVuePageRequestCallee = (expression) => {
|
|
19425
|
-
if (
|
|
19549
|
+
if (lazyTypescript.isIdentifier(expression)) {
|
|
19426
19550
|
return expression.text === "handleVuePageRequest";
|
|
19427
19551
|
}
|
|
19428
|
-
if (
|
|
19552
|
+
if (lazyTypescript.isPropertyAccessExpression(expression) && lazyTypescript.isIdentifier(expression.name)) {
|
|
19429
19553
|
return expression.name.text === "handleVuePageRequest";
|
|
19430
19554
|
}
|
|
19431
19555
|
return false;
|
|
19432
19556
|
}, getPropertyName = (name) => {
|
|
19433
|
-
if (
|
|
19557
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name)) {
|
|
19434
19558
|
return name.text;
|
|
19435
19559
|
}
|
|
19436
19560
|
return null;
|
|
19437
19561
|
}, unwrapExpression = (node) => {
|
|
19438
|
-
if (
|
|
19562
|
+
if (lazyTypescript.isAsExpression(node) || lazyTypescript.isSatisfiesExpression(node) || lazyTypescript.isParenthesizedExpression(node) || lazyTypescript.isTypeAssertionExpression(node)) {
|
|
19439
19563
|
return unwrapExpression(node.expression);
|
|
19440
19564
|
}
|
|
19441
19565
|
return node;
|
|
19442
19566
|
}, readLiteral = (node) => {
|
|
19443
19567
|
const inner = unwrapExpression(node);
|
|
19444
|
-
if (
|
|
19568
|
+
if (lazyTypescript.isStringLiteral(inner) || lazyTypescript.isNoSubstitutionTemplateLiteral(inner)) {
|
|
19445
19569
|
return inner.text;
|
|
19446
19570
|
}
|
|
19447
19571
|
return null;
|
|
19448
|
-
}, isConstDeclaration = (declaration) =>
|
|
19572
|
+
}, isConstDeclaration = (declaration) => lazyTypescript.isVariableDeclarationList(declaration.parent) && (declaration.parent.flags & lazyTypescript.NodeFlags.Const) !== 0, collectConstStrings = (sourceFile) => {
|
|
19449
19573
|
const constants = new Map;
|
|
19450
19574
|
const visit = (node) => {
|
|
19451
|
-
if (
|
|
19575
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.initializer && isConstDeclaration(node)) {
|
|
19452
19576
|
const name = node.name.text;
|
|
19453
19577
|
const value = readLiteral(node.initializer);
|
|
19454
19578
|
const known = constants.has(name);
|
|
19455
19579
|
constants.set(name, known && constants.get(name) !== value ? null : value);
|
|
19456
19580
|
}
|
|
19457
|
-
|
|
19581
|
+
lazyTypescript.forEachChild(node, visit);
|
|
19458
19582
|
};
|
|
19459
|
-
|
|
19583
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
19460
19584
|
return constants;
|
|
19461
19585
|
}, readStringValue = (node, constants) => {
|
|
19462
19586
|
const inner = unwrapExpression(node);
|
|
19463
|
-
if (
|
|
19587
|
+
if (lazyTypescript.isIdentifier(inner))
|
|
19464
19588
|
return constants.get(inner.text) ?? null;
|
|
19465
19589
|
return readLiteral(inner);
|
|
19466
19590
|
}, isAssetCall = (node) => {
|
|
19467
|
-
if (!
|
|
19591
|
+
if (!lazyTypescript.isCallExpression(node))
|
|
19468
19592
|
return false;
|
|
19469
|
-
if (!
|
|
19593
|
+
if (!lazyTypescript.isIdentifier(node.expression))
|
|
19470
19594
|
return false;
|
|
19471
19595
|
return node.expression.text === "asset";
|
|
19472
19596
|
}, extractAssetLiteralKey = (call, constants) => {
|
|
@@ -19479,14 +19603,14 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
19479
19603
|
}, extractPagePathAssetKey = (initializer, constants) => {
|
|
19480
19604
|
if (!isAssetCall(initializer))
|
|
19481
19605
|
return null;
|
|
19482
|
-
if (!
|
|
19606
|
+
if (!lazyTypescript.isCallExpression(initializer))
|
|
19483
19607
|
return null;
|
|
19484
19608
|
return extractAssetLiteralKey(initializer, constants);
|
|
19485
19609
|
}, readProperty = (property) => {
|
|
19486
|
-
if (
|
|
19610
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
19487
19611
|
return { name: property.name.text, value: property.name };
|
|
19488
19612
|
}
|
|
19489
|
-
if (!
|
|
19613
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
19490
19614
|
return null;
|
|
19491
19615
|
const name = getPropertyName(property.name);
|
|
19492
19616
|
return name ? { name, value: property.initializer } : null;
|
|
@@ -19518,20 +19642,20 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
19518
19642
|
}
|
|
19519
19643
|
if (!fileMayContainVueHandler(source))
|
|
19520
19644
|
return [];
|
|
19521
|
-
const sourceFile =
|
|
19645
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind3(filePath));
|
|
19522
19646
|
const constants = collectConstStrings(sourceFile);
|
|
19523
19647
|
const visit = (node) => {
|
|
19524
|
-
if (
|
|
19648
|
+
if (lazyTypescript.isCallExpression(node) && isHandleVuePageRequestCallee(node.expression)) {
|
|
19525
19649
|
const firstArg = node.arguments[0];
|
|
19526
|
-
if (firstArg &&
|
|
19650
|
+
if (firstArg && lazyTypescript.isObjectLiteralExpression(firstArg)) {
|
|
19527
19651
|
const pageName = extractSsrOnlyPageName(firstArg, constants);
|
|
19528
19652
|
if (pageName)
|
|
19529
19653
|
out.add(pageName);
|
|
19530
19654
|
}
|
|
19531
19655
|
}
|
|
19532
|
-
|
|
19656
|
+
lazyTypescript.forEachChild(node, visit);
|
|
19533
19657
|
};
|
|
19534
|
-
|
|
19658
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
19535
19659
|
return [...out];
|
|
19536
19660
|
}, ssrOnlyNameCache, scanVueSsrOnlyPages = (projectRoot, memoise = false) => {
|
|
19537
19661
|
const files = collectSourceFiles2(projectRoot);
|
|
@@ -19546,6 +19670,7 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
19546
19670
|
return ssrOnlyPageNames;
|
|
19547
19671
|
};
|
|
19548
19672
|
var init_scanVueSsrOnlyPages = __esm(() => {
|
|
19673
|
+
init_lazyTypescript();
|
|
19549
19674
|
init_stampedFileCache();
|
|
19550
19675
|
SKIP_DIRS2 = new Set([
|
|
19551
19676
|
".absolutejs",
|
|
@@ -19566,11 +19691,10 @@ var init_scanVueSsrOnlyPages = __esm(() => {
|
|
|
19566
19691
|
// src/build/scanAngularHandlerCalls.ts
|
|
19567
19692
|
import { readdirSync as readdirSync4, readFileSync as readFileSync26 } from "fs";
|
|
19568
19693
|
import { join as join41 } from "path";
|
|
19569
|
-
import ts14 from "typescript";
|
|
19570
19694
|
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PREFIX = ".absolutejs-hmr-", getScriptKind4 = (filePath) => {
|
|
19571
19695
|
if (filePath.endsWith(".tsx"))
|
|
19572
|
-
return
|
|
19573
|
-
return
|
|
19696
|
+
return lazyTypescript.ScriptKind.TSX;
|
|
19697
|
+
return lazyTypescript.ScriptKind.TS;
|
|
19574
19698
|
}, hasSourceExtension3 = (filePath) => {
|
|
19575
19699
|
const idx = filePath.lastIndexOf(".");
|
|
19576
19700
|
if (idx === -1)
|
|
@@ -19606,25 +19730,25 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
19606
19730
|
}
|
|
19607
19731
|
return out;
|
|
19608
19732
|
}, fileMayContainAngularHandler = (source) => source.includes("handleAngularPageRequest"), extractManifestKey = (pagePathValue) => {
|
|
19609
|
-
if (!
|
|
19733
|
+
if (!lazyTypescript.isCallExpression(pagePathValue))
|
|
19610
19734
|
return null;
|
|
19611
19735
|
const callee = pagePathValue.expression;
|
|
19612
|
-
if (!
|
|
19736
|
+
if (!lazyTypescript.isIdentifier(callee) || callee.text !== "asset")
|
|
19613
19737
|
return null;
|
|
19614
19738
|
const [, second] = pagePathValue.arguments;
|
|
19615
19739
|
if (!second)
|
|
19616
19740
|
return null;
|
|
19617
|
-
if (!
|
|
19741
|
+
if (!lazyTypescript.isStringLiteral(second))
|
|
19618
19742
|
return null;
|
|
19619
19743
|
return second.text;
|
|
19620
19744
|
}, findEnclosingMountPath = (node) => {
|
|
19621
19745
|
let cursor = node.parent;
|
|
19622
19746
|
while (cursor) {
|
|
19623
|
-
if (
|
|
19747
|
+
if (lazyTypescript.isCallExpression(cursor)) {
|
|
19624
19748
|
const callee = cursor.expression;
|
|
19625
|
-
if (
|
|
19749
|
+
if (lazyTypescript.isPropertyAccessExpression(callee) && lazyTypescript.isIdentifier(callee.name) && ELYSIA_ROUTE_METHODS2.has(callee.name.text)) {
|
|
19626
19750
|
const firstArg = cursor.arguments[0];
|
|
19627
|
-
if (firstArg &&
|
|
19751
|
+
if (firstArg && lazyTypescript.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
19628
19752
|
return firstArg.text;
|
|
19629
19753
|
}
|
|
19630
19754
|
}
|
|
@@ -19641,27 +19765,27 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
19641
19765
|
}
|
|
19642
19766
|
if (!fileMayContainAngularHandler(source))
|
|
19643
19767
|
return;
|
|
19644
|
-
const sf =
|
|
19768
|
+
const sf = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind4(filePath));
|
|
19645
19769
|
const visit = (node) => {
|
|
19646
|
-
if (
|
|
19770
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "handleAngularPageRequest") {
|
|
19647
19771
|
const [arg] = node.arguments;
|
|
19648
|
-
if (arg &&
|
|
19772
|
+
if (arg && lazyTypescript.isObjectLiteralExpression(arg)) {
|
|
19649
19773
|
let manifestKey = null;
|
|
19650
19774
|
for (const prop of arg.properties) {
|
|
19651
|
-
if (
|
|
19775
|
+
if (lazyTypescript.isPropertyAssignment(prop)) {
|
|
19652
19776
|
if (!prop.name)
|
|
19653
19777
|
continue;
|
|
19654
|
-
const name =
|
|
19778
|
+
const name = lazyTypescript.isIdentifier(prop.name) ? prop.name.text : lazyTypescript.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
19655
19779
|
if (name === "pagePath") {
|
|
19656
19780
|
manifestKey = extractManifestKey(prop.initializer);
|
|
19657
19781
|
}
|
|
19658
|
-
} else if (
|
|
19782
|
+
} else if (lazyTypescript.isSpreadAssignment(prop)) {
|
|
19659
19783
|
if (manifestKey)
|
|
19660
19784
|
continue;
|
|
19661
19785
|
const spreadExpr = prop.expression;
|
|
19662
|
-
if (
|
|
19786
|
+
if (lazyTypescript.isCallExpression(spreadExpr) && spreadExpr.arguments.length > 0) {
|
|
19663
19787
|
const [firstArg] = spreadExpr.arguments;
|
|
19664
|
-
if (firstArg &&
|
|
19788
|
+
if (firstArg && lazyTypescript.isStringLiteral(firstArg)) {
|
|
19665
19789
|
manifestKey = firstArg.text;
|
|
19666
19790
|
}
|
|
19667
19791
|
}
|
|
@@ -19676,9 +19800,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
19676
19800
|
}
|
|
19677
19801
|
}
|
|
19678
19802
|
}
|
|
19679
|
-
|
|
19803
|
+
lazyTypescript.forEachChild(node, visit);
|
|
19680
19804
|
};
|
|
19681
|
-
|
|
19805
|
+
lazyTypescript.forEachChild(sf, visit);
|
|
19682
19806
|
}, scanAngularHandlerCalls = (projectRoot) => {
|
|
19683
19807
|
const files = collectSourceFiles3(projectRoot);
|
|
19684
19808
|
const collected = [];
|
|
@@ -19688,6 +19812,7 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
19688
19812
|
return collected;
|
|
19689
19813
|
};
|
|
19690
19814
|
var init_scanAngularHandlerCalls = __esm(() => {
|
|
19815
|
+
init_lazyTypescript();
|
|
19691
19816
|
ELYSIA_ROUTE_METHODS2 = new Set([
|
|
19692
19817
|
"all",
|
|
19693
19818
|
"delete",
|
|
@@ -19716,7 +19841,6 @@ var init_scanAngularHandlerCalls = __esm(() => {
|
|
|
19716
19841
|
// src/build/scanAngularPageRoutes.ts
|
|
19717
19842
|
import { readdirSync as readdirSync5, readFileSync as readFileSync27 } from "fs";
|
|
19718
19843
|
import { basename as basename14, join as join42 } from "path";
|
|
19719
|
-
import ts15 from "typescript";
|
|
19720
19844
|
var SOURCE_EXTENSIONS5, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
19721
19845
|
const idx = filePath.lastIndexOf(".");
|
|
19722
19846
|
if (idx === -1)
|
|
@@ -19765,15 +19889,15 @@ var SOURCE_EXTENSIONS5, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
|
19765
19889
|
}, hasTopLevelRoutesExport = (source, filePath) => {
|
|
19766
19890
|
if (!source.includes("routes"))
|
|
19767
19891
|
return false;
|
|
19768
|
-
const sf =
|
|
19892
|
+
const sf = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
19769
19893
|
for (const statement of sf.statements) {
|
|
19770
|
-
if (!
|
|
19894
|
+
if (!lazyTypescript.isVariableStatement(statement))
|
|
19771
19895
|
continue;
|
|
19772
|
-
const isExported = statement.modifiers?.some((modifier) => modifier.kind ===
|
|
19896
|
+
const isExported = statement.modifiers?.some((modifier) => modifier.kind === lazyTypescript.SyntaxKind.ExportKeyword);
|
|
19773
19897
|
if (!isExported)
|
|
19774
19898
|
continue;
|
|
19775
19899
|
for (const declaration of statement.declarationList.declarations) {
|
|
19776
|
-
if (!
|
|
19900
|
+
if (!lazyTypescript.isIdentifier(declaration.name))
|
|
19777
19901
|
continue;
|
|
19778
19902
|
if (declaration.name.text === "routes")
|
|
19779
19903
|
return true;
|
|
@@ -19802,6 +19926,7 @@ var SOURCE_EXTENSIONS5, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
|
19802
19926
|
return out;
|
|
19803
19927
|
};
|
|
19804
19928
|
var init_scanAngularPageRoutes = __esm(() => {
|
|
19929
|
+
init_lazyTypescript();
|
|
19805
19930
|
SOURCE_EXTENSIONS5 = new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
19806
19931
|
SKIP_DIRS4 = new Set([
|
|
19807
19932
|
".absolutejs",
|
|
@@ -19827,44 +19952,43 @@ var init_runAngularHandlerScan = __esm(() => {
|
|
|
19827
19952
|
// src/build/parseAngularConfigImports.ts
|
|
19828
19953
|
import { existsSync as existsSync31, readFileSync as readFileSync28 } from "fs";
|
|
19829
19954
|
import { dirname as dirname24, isAbsolute as isAbsolute8, join as join43 } from "path";
|
|
19830
|
-
import ts16 from "typescript";
|
|
19831
19955
|
var findDefineConfigCall = (sf) => {
|
|
19832
19956
|
let result = null;
|
|
19833
19957
|
const visit = (node) => {
|
|
19834
19958
|
if (result)
|
|
19835
19959
|
return;
|
|
19836
|
-
if (
|
|
19960
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "defineConfig") {
|
|
19837
19961
|
const [arg] = node.arguments;
|
|
19838
|
-
if (arg &&
|
|
19962
|
+
if (arg && lazyTypescript.isObjectLiteralExpression(arg)) {
|
|
19839
19963
|
result = arg;
|
|
19840
19964
|
return;
|
|
19841
19965
|
}
|
|
19842
19966
|
}
|
|
19843
|
-
|
|
19967
|
+
lazyTypescript.forEachChild(node, visit);
|
|
19844
19968
|
};
|
|
19845
|
-
|
|
19969
|
+
lazyTypescript.forEachChild(sf, visit);
|
|
19846
19970
|
return result;
|
|
19847
19971
|
}, findPropertyInitializer = (object, name) => {
|
|
19848
19972
|
for (const prop of object.properties) {
|
|
19849
|
-
if (!
|
|
19973
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
19850
19974
|
continue;
|
|
19851
19975
|
if (!prop.name)
|
|
19852
19976
|
continue;
|
|
19853
|
-
const key =
|
|
19977
|
+
const key = lazyTypescript.isIdentifier(prop.name) ? prop.name.text : lazyTypescript.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
19854
19978
|
if (key === name)
|
|
19855
19979
|
return prop.initializer;
|
|
19856
19980
|
}
|
|
19857
19981
|
return null;
|
|
19858
19982
|
}, findImportForBinding = (sf, binding) => {
|
|
19859
19983
|
for (const statement of sf.statements) {
|
|
19860
|
-
if (!
|
|
19984
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
19861
19985
|
continue;
|
|
19862
|
-
if (!
|
|
19986
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
19863
19987
|
continue;
|
|
19864
19988
|
if (statement.importClause?.isTypeOnly)
|
|
19865
19989
|
continue;
|
|
19866
19990
|
const named = statement.importClause?.namedBindings;
|
|
19867
|
-
if (!named || !
|
|
19991
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
19868
19992
|
continue;
|
|
19869
19993
|
for (const element of named.elements) {
|
|
19870
19994
|
if (element.isTypeOnly)
|
|
@@ -19905,17 +20029,17 @@ var findDefineConfigCall = (sf) => {
|
|
|
19905
20029
|
return null;
|
|
19906
20030
|
if (!source.includes("providers"))
|
|
19907
20031
|
return null;
|
|
19908
|
-
const sf =
|
|
20032
|
+
const sf = lazyTypescript.createSourceFile(configPath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
19909
20033
|
const configObject = findDefineConfigCall(sf);
|
|
19910
20034
|
if (!configObject)
|
|
19911
20035
|
return null;
|
|
19912
20036
|
const angularField = findPropertyInitializer(configObject, "angular");
|
|
19913
|
-
if (!angularField || !
|
|
20037
|
+
if (!angularField || !lazyTypescript.isObjectLiteralExpression(angularField))
|
|
19914
20038
|
return null;
|
|
19915
20039
|
const providersField = findPropertyInitializer(angularField, "providers");
|
|
19916
20040
|
if (!providersField)
|
|
19917
20041
|
return null;
|
|
19918
|
-
if (!
|
|
20042
|
+
if (!lazyTypescript.isIdentifier(providersField))
|
|
19919
20043
|
return null;
|
|
19920
20044
|
const binding = providersField.text;
|
|
19921
20045
|
const importInfo = findImportForBinding(sf, binding);
|
|
@@ -19929,7 +20053,9 @@ var findDefineConfigCall = (sf) => {
|
|
|
19929
20053
|
importedName: importInfo.importedName
|
|
19930
20054
|
};
|
|
19931
20055
|
};
|
|
19932
|
-
var init_parseAngularConfigImports = () => {
|
|
20056
|
+
var init_parseAngularConfigImports = __esm(() => {
|
|
20057
|
+
init_lazyTypescript();
|
|
20058
|
+
});
|
|
19933
20059
|
|
|
19934
20060
|
// src/islands/sourceMetadata.ts
|
|
19935
20061
|
var islandFrameworks2, islandHydrationModes2, isIslandFramework2 = (value) => islandFrameworks2.some((framework) => framework === value), isIslandHydrate = (value) => islandHydrationModes2.some((hydrate) => hydrate === value), parseIslandTagAttributes = (attributeString) => {
|
|
@@ -20554,27 +20680,26 @@ var dedupeCssBlocks = (blocks) => {
|
|
|
20554
20680
|
};
|
|
20555
20681
|
|
|
20556
20682
|
// src/build/parseVueSpaRoutes.ts
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
if (ts17.isCallExpression(node) && node.expression.kind === ts17.SyntaxKind.ImportKeyword) {
|
|
20683
|
+
var propertyName = (node) => lazyTypescript.isIdentifier(node) || lazyTypescript.isStringLiteralLike(node) ? node.text : null, stringValue = (node) => lazyTypescript.isStringLiteralLike(node) ? node.text : null, findVueImport = (node) => {
|
|
20684
|
+
if (lazyTypescript.isCallExpression(node) && node.expression.kind === lazyTypescript.SyntaxKind.ImportKeyword) {
|
|
20560
20685
|
const [specifier] = node.arguments;
|
|
20561
|
-
if (specifier &&
|
|
20686
|
+
if (specifier && lazyTypescript.isStringLiteralLike(specifier)) {
|
|
20562
20687
|
return specifier.text.endsWith(".vue") ? specifier.text : null;
|
|
20563
20688
|
}
|
|
20564
20689
|
}
|
|
20565
20690
|
let found = null;
|
|
20566
|
-
|
|
20691
|
+
lazyTypescript.forEachChild(node, (child) => {
|
|
20567
20692
|
if (found === null)
|
|
20568
20693
|
found = findVueImport(child);
|
|
20569
20694
|
});
|
|
20570
20695
|
return found;
|
|
20571
20696
|
}, parseRoute = (node) => {
|
|
20572
|
-
if (!
|
|
20697
|
+
if (!lazyTypescript.isObjectLiteralExpression(node))
|
|
20573
20698
|
return null;
|
|
20574
20699
|
let path = null;
|
|
20575
20700
|
let importPath = null;
|
|
20576
20701
|
for (const property of node.properties) {
|
|
20577
|
-
if (!
|
|
20702
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
20578
20703
|
continue;
|
|
20579
20704
|
const name = propertyName(property.name);
|
|
20580
20705
|
if (name === "path")
|
|
@@ -20584,12 +20709,12 @@ var propertyName = (node) => ts17.isIdentifier(node) || ts17.isStringLiteralLike
|
|
|
20584
20709
|
}
|
|
20585
20710
|
return path && importPath ? { importPath, path } : null;
|
|
20586
20711
|
}, parseVueSpaRoutes = (source) => {
|
|
20587
|
-
const sourceFile =
|
|
20712
|
+
const sourceFile = lazyTypescript.createSourceFile("absolute-vue-routes.ts", source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
20588
20713
|
const entries = [];
|
|
20589
20714
|
const visit = (node) => {
|
|
20590
|
-
if (
|
|
20715
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "defineRoutes") {
|
|
20591
20716
|
const [routes] = node.arguments;
|
|
20592
|
-
if (routes &&
|
|
20717
|
+
if (routes && lazyTypescript.isArrayLiteralExpression(routes)) {
|
|
20593
20718
|
for (const element of routes.elements) {
|
|
20594
20719
|
const route = parseRoute(element);
|
|
20595
20720
|
if (route)
|
|
@@ -20597,12 +20722,14 @@ var propertyName = (node) => ts17.isIdentifier(node) || ts17.isStringLiteralLike
|
|
|
20597
20722
|
}
|
|
20598
20723
|
}
|
|
20599
20724
|
}
|
|
20600
|
-
|
|
20725
|
+
lazyTypescript.forEachChild(node, visit);
|
|
20601
20726
|
};
|
|
20602
|
-
|
|
20727
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
20603
20728
|
return entries;
|
|
20604
20729
|
};
|
|
20605
|
-
var init_parseVueSpaRoutes = () => {
|
|
20730
|
+
var init_parseVueSpaRoutes = __esm(() => {
|
|
20731
|
+
init_lazyTypescript();
|
|
20732
|
+
});
|
|
20606
20733
|
|
|
20607
20734
|
// src/build/vueAutoRouterTransform.ts
|
|
20608
20735
|
var SCRIPT_REGEX, ROUTES_EXPORT_REGEX, SENTINEL2 = "__ABSOLUTE_AUTO_ROUTER__", SETUP_APP_DECLARATION_REGEX, SETUP_APP_FUNCTION_REGEX, addAutoRouterSetupApp = (sourceContent) => {
|
|
@@ -21125,7 +21252,7 @@ __export(exports_emitTsHelpers, {
|
|
|
21125
21252
|
emitTsHelpers: () => emitTsHelpers
|
|
21126
21253
|
});
|
|
21127
21254
|
var {file: file2, Transpiler: Transpiler4, write: write3 } = globalThis.Bun;
|
|
21128
|
-
import { copyFileSync as copyFileSync2, existsSync as existsSync34, readdirSync as readdirSync6, statSync as
|
|
21255
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync34, readdirSync as readdirSync6, statSync as statSync6 } from "fs";
|
|
21129
21256
|
import { mkdir as mkdir9, rename as rename2, writeFile as writeFile10 } from "fs/promises";
|
|
21130
21257
|
import { dirname as dirname26, join as join46, resolve as resolve32, sep as sep8 } from "path";
|
|
21131
21258
|
var CACHE_DIR_NAME2 = "vue-helpers", CACHE_FORMAT_VERSION2 = 2, HASH_LENGTH4 = 24, transpiler4, cacheDir = () => join46(process.cwd(), ".absolutejs", "compile-cache", CACHE_DIR_NAME2), cacheKey2 = (sourcePath, sourceCode) => {
|
|
@@ -21189,7 +21316,7 @@ var CACHE_DIR_NAME2 = "vue-helpers", CACHE_FORMAT_VERSION2 = 2, HASH_LENGTH4 = 2
|
|
|
21189
21316
|
copyFileSync2(cachedPath, serverOutputPath);
|
|
21190
21317
|
}, QUOTES2, MIRRORED_MODULE, IMPORT_CANDIDATE_SUFFIXES, isFilePath = (path) => {
|
|
21191
21318
|
try {
|
|
21192
|
-
return
|
|
21319
|
+
return statSync6(path).isFile();
|
|
21193
21320
|
} catch {
|
|
21194
21321
|
return false;
|
|
21195
21322
|
}
|
|
@@ -22990,22 +23117,22 @@ var init_lowerDeferSyntax = __esm(() => {
|
|
|
22990
23117
|
});
|
|
22991
23118
|
|
|
22992
23119
|
// src/build/downlevelAsyncForZone.ts
|
|
22993
|
-
import ts18 from "typescript";
|
|
22994
23120
|
var ASYNC_KEYWORD, downlevelAsyncForZone = (code, fileName) => {
|
|
22995
23121
|
if (!isAngularZoneMode() || !ASYNC_KEYWORD.test(code))
|
|
22996
23122
|
return code;
|
|
22997
|
-
return
|
|
23123
|
+
return lazyTypescript.transpileModule(code, {
|
|
22998
23124
|
compilerOptions: {
|
|
22999
23125
|
importHelpers: false,
|
|
23000
|
-
module:
|
|
23126
|
+
module: lazyTypescript.ModuleKind.ESNext,
|
|
23001
23127
|
sourceMap: false,
|
|
23002
|
-
target:
|
|
23128
|
+
target: lazyTypescript.ScriptTarget.ES2016,
|
|
23003
23129
|
useDefineForClassFields: false
|
|
23004
23130
|
},
|
|
23005
23131
|
fileName: fileName.replace(/\.[cm]?[tj]sx?$/, ".js")
|
|
23006
23132
|
}).outputText;
|
|
23007
23133
|
};
|
|
23008
23134
|
var init_downlevelAsyncForZone = __esm(() => {
|
|
23135
|
+
init_lazyTypescript();
|
|
23009
23136
|
ASYNC_KEYWORD = /\basync\b/;
|
|
23010
23137
|
});
|
|
23011
23138
|
|
|
@@ -23019,7 +23146,6 @@ __export(exports_compileAngular, {
|
|
|
23019
23146
|
import { existsSync as existsSync38, readFileSync as readFileSync34, promises as fs5 } from "fs";
|
|
23020
23147
|
import { join as join50, basename as basename17, sep as sep9, dirname as dirname31, resolve as resolve36, relative as relative25 } from "path";
|
|
23021
23148
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
23022
|
-
import ts19 from "typescript";
|
|
23023
23149
|
var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) => {
|
|
23024
23150
|
const temporaryPath = `${path}.tmp.${process.pid}.${atomicWriteSequence++}`;
|
|
23025
23151
|
try {
|
|
@@ -23034,7 +23160,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
23034
23160
|
}, readTsconfigPathAliases = () => {
|
|
23035
23161
|
try {
|
|
23036
23162
|
const configPath = resolve36(process.cwd(), "tsconfig.json");
|
|
23037
|
-
const config =
|
|
23163
|
+
const config = lazyTypescript.readConfigFile(configPath, lazyTypescript.sys.readFile).config;
|
|
23038
23164
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
23039
23165
|
const baseUrl = resolve36(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
23040
23166
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
@@ -23163,7 +23289,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
23163
23289
|
return resolve36(import.meta.dir, "./dev/client");
|
|
23164
23290
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
23165
23291
|
try {
|
|
23166
|
-
return
|
|
23292
|
+
return lazyTypescript.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
23167
23293
|
`);
|
|
23168
23294
|
} catch {
|
|
23169
23295
|
return String(diagnostic.messageText || "Unknown error");
|
|
@@ -23171,7 +23297,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
23171
23297
|
}, throwOnCompilationErrors = (diagnostics) => {
|
|
23172
23298
|
if (!diagnostics?.length)
|
|
23173
23299
|
return;
|
|
23174
|
-
const errors = diagnostics.filter((diag) => diag.category ===
|
|
23300
|
+
const errors = diagnostics.filter((diag) => diag.category === lazyTypescript.DiagnosticCategory.Error);
|
|
23175
23301
|
if (!errors.length)
|
|
23176
23302
|
return;
|
|
23177
23303
|
const fullMessage = errors.map(formatDiagnosticMessage).join(`
|
|
@@ -23213,22 +23339,22 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
23213
23339
|
}
|
|
23214
23340
|
return `${path}.js${query}`;
|
|
23215
23341
|
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
23216
|
-
const sourceFile =
|
|
23342
|
+
const sourceFile = lazyTypescript.createSourceFile(fileName, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
23217
23343
|
const specifiers = [];
|
|
23218
23344
|
const addSpecifier = (node) => {
|
|
23219
|
-
if (!node || !
|
|
23345
|
+
if (!node || !lazyTypescript.isStringLiteralLike(node))
|
|
23220
23346
|
return;
|
|
23221
23347
|
const specifier = node.text;
|
|
23222
23348
|
if (isRelativeModuleSpecifier(specifier))
|
|
23223
23349
|
specifiers.push(specifier);
|
|
23224
23350
|
};
|
|
23225
23351
|
const visit = (node) => {
|
|
23226
|
-
if (
|
|
23352
|
+
if (lazyTypescript.isImportDeclaration(node) || lazyTypescript.isExportDeclaration(node)) {
|
|
23227
23353
|
addSpecifier(node.moduleSpecifier);
|
|
23228
|
-
} else if (
|
|
23354
|
+
} else if (lazyTypescript.isCallExpression(node) && node.expression.kind === lazyTypescript.SyntaxKind.ImportKeyword) {
|
|
23229
23355
|
addSpecifier(node.arguments[0]);
|
|
23230
23356
|
}
|
|
23231
|
-
|
|
23357
|
+
lazyTypescript.forEachChild(node, visit);
|
|
23232
23358
|
};
|
|
23233
23359
|
visit(sourceFile);
|
|
23234
23360
|
return specifiers;
|
|
@@ -23376,25 +23502,25 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
23376
23502
|
emitDecoratorMetadata: true,
|
|
23377
23503
|
esModuleInterop: true,
|
|
23378
23504
|
experimentalDecorators: true,
|
|
23379
|
-
module:
|
|
23380
|
-
moduleResolution:
|
|
23381
|
-
newLine:
|
|
23505
|
+
module: lazyTypescript.ModuleKind.ESNext,
|
|
23506
|
+
moduleResolution: lazyTypescript.ModuleResolutionKind.Bundler,
|
|
23507
|
+
newLine: lazyTypescript.NewLineKind.LineFeed,
|
|
23382
23508
|
noLib: false,
|
|
23383
23509
|
outDir,
|
|
23384
23510
|
skipLibCheck: true,
|
|
23385
|
-
target:
|
|
23511
|
+
target: lazyTypescript.ScriptTarget.ES2022,
|
|
23386
23512
|
...config.options
|
|
23387
23513
|
};
|
|
23388
|
-
options.target =
|
|
23514
|
+
options.target = lazyTypescript.ScriptTarget.ES2022;
|
|
23389
23515
|
options.experimentalDecorators = true;
|
|
23390
23516
|
options.emitDecoratorMetadata = true;
|
|
23391
|
-
options.newLine =
|
|
23517
|
+
options.newLine = lazyTypescript.NewLineKind.LineFeed;
|
|
23392
23518
|
options.outDir = outDir;
|
|
23393
23519
|
options.noEmit = false;
|
|
23394
23520
|
options.incremental = false;
|
|
23395
23521
|
options.tsBuildInfoFile = undefined;
|
|
23396
23522
|
options.rootDir = process.cwd();
|
|
23397
|
-
const host = await traceAngularPhase("aot/create-compiler-host", () =>
|
|
23523
|
+
const host = await traceAngularPhase("aot/create-compiler-host", () => lazyTypescript.createCompilerHost(options));
|
|
23398
23524
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
23399
23525
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
23400
23526
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
@@ -23440,7 +23566,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
23440
23566
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
23441
23567
|
const source = transformedSources.get(resolve36(fileName));
|
|
23442
23568
|
if (source) {
|
|
23443
|
-
return
|
|
23569
|
+
return lazyTypescript.createSourceFile(fileName, source, languageVersion, true);
|
|
23444
23570
|
}
|
|
23445
23571
|
return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError);
|
|
23446
23572
|
};
|
|
@@ -23969,8 +24095,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
23969
24095
|
}
|
|
23970
24096
|
}
|
|
23971
24097
|
return allOutputs;
|
|
23972
|
-
}, ROUTER_OUTLET_PATTERN, COMPONENT_MARKER_PATTERN, isExportedClass = (statement) =>
|
|
23973
|
-
if (!
|
|
24098
|
+
}, ROUTER_OUTLET_PATTERN, COMPONENT_MARKER_PATTERN, isExportedClass = (statement) => lazyTypescript.isClassDeclaration(statement) && statement.name !== undefined && (lazyTypescript.getModifiers(statement) ?? []).some((modifier) => modifier.kind === lazyTypescript.SyntaxKind.ExportKeyword), statementReferencesClass = (statement, className, sourceFile) => {
|
|
24099
|
+
if (!lazyTypescript.isExpressionStatement(statement))
|
|
23974
24100
|
return false;
|
|
23975
24101
|
const text = statement.getText(sourceFile);
|
|
23976
24102
|
return new RegExp(`^\\s*${className}\\s*=`).test(text) || new RegExp(`\u0275setClassMetadata\\(\\s*${className}\\b`).test(text);
|
|
@@ -23978,16 +24104,16 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
23978
24104
|
const defaultMatch = source.match(/export\s+default\s+([A-Za-z_$][\w$]*)\s*;/);
|
|
23979
24105
|
if (defaultMatch)
|
|
23980
24106
|
return defaultMatch[1] ?? null;
|
|
23981
|
-
const sourceFile =
|
|
24107
|
+
const sourceFile = lazyTypescript.createSourceFile("page.js", source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.JS);
|
|
23982
24108
|
const exportedNames = new Set;
|
|
23983
24109
|
for (const statement of sourceFile.statements) {
|
|
23984
|
-
if (!
|
|
24110
|
+
if (!lazyTypescript.isExportDeclaration(statement) || statement.moduleSpecifier || !statement.exportClause || !lazyTypescript.isNamedExports(statement.exportClause))
|
|
23985
24111
|
continue;
|
|
23986
24112
|
for (const element of statement.exportClause.elements) {
|
|
23987
24113
|
exportedNames.add((element.propertyName ?? element.name).text);
|
|
23988
24114
|
}
|
|
23989
24115
|
}
|
|
23990
|
-
const candidates = sourceFile.statements.filter(
|
|
24116
|
+
const candidates = sourceFile.statements.filter(lazyTypescript.isClassDeclaration).filter((statement) => isExportedClass(statement) || exportedNames.has(statement.name?.text ?? "")).map((statement) => {
|
|
23991
24117
|
const className = statement.name?.text ?? "";
|
|
23992
24118
|
const related = sourceFile.statements.filter((other) => statementReferencesClass(other, className, sourceFile)).map((other) => other.getText(sourceFile));
|
|
23993
24119
|
const text = [statement.getText(sourceFile), ...related].join(`
|
|
@@ -24177,7 +24303,7 @@ import '@angular/compiler';
|
|
|
24177
24303
|
import { bootstrapApplication } from '@angular/platform-browser';
|
|
24178
24304
|
import { provideClientHydration } from '@angular/platform-browser';
|
|
24179
24305
|
import { withHttpTransferCacheOptions } from '@angular/platform-browser';
|
|
24180
|
-
import { ${changeDetectionImport}, REQUEST_CONTEXT } from '@angular/core';
|
|
24306
|
+
import { ${changeDetectionImport}, CSP_NONCE, REQUEST_CONTEXT } from '@angular/core';
|
|
24181
24307
|
import { APP_BASE_HREF as __abs_APP_BASE_HREF } from '@angular/common';
|
|
24182
24308
|
import { prepareBrowserTranslationHydration } from '@absolutejs/absolute/client';
|
|
24183
24309
|
import * as pageModule from '${normalizedImportPath}';
|
|
@@ -24194,6 +24320,12 @@ var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-ra
|
|
|
24194
24320
|
var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
|
|
24195
24321
|
var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
|
|
24196
24322
|
var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
|
|
24323
|
+
// Under secureHeaders() the policy only allows <style> elements that carry
|
|
24324
|
+
// the page's nonce. Angular adds one for every component it renders or
|
|
24325
|
+
// hot-updates in the browser, so hand it the nonce the server put on the
|
|
24326
|
+
// page (browsers hide the attribute's value; the property keeps it).
|
|
24327
|
+
var cspNonce = (document.querySelector('script[nonce], style[nonce]') || {}).nonce;
|
|
24328
|
+
if (cspNonce) contextProviders.push({ provide: CSP_NONCE, useValue: cspNonce });
|
|
24197
24329
|
// Page-level providers are injected directly into the page module's
|
|
24198
24330
|
// server output by \`compileAngular\`'s providers-injection step
|
|
24199
24331
|
// (\`...appProviders, provideRouter(routes), { APP_BASE_HREF }\`),
|
|
@@ -24297,7 +24429,7 @@ ${zoneImport}import '@angular/compiler';
|
|
|
24297
24429
|
import { bootstrapApplication } from '@angular/platform-browser';
|
|
24298
24430
|
import { provideClientHydration } from '@angular/platform-browser';
|
|
24299
24431
|
import { withHttpTransferCacheOptions } from '@angular/platform-browser';
|
|
24300
|
-
import { enableProdMode, ${changeDetectionImport}, REQUEST_CONTEXT } from '@angular/core';
|
|
24432
|
+
import { enableProdMode, ${changeDetectionImport}, CSP_NONCE, REQUEST_CONTEXT } from '@angular/core';
|
|
24301
24433
|
import { APP_BASE_HREF as __abs_APP_BASE_HREF } from '@angular/common';
|
|
24302
24434
|
import { prepareBrowserTranslationHydration } from '@absolutejs/absolute/client';
|
|
24303
24435
|
import * as pageModule from '${normalizedImportPath}';
|
|
@@ -24314,6 +24446,12 @@ var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-ra
|
|
|
24314
24446
|
var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
|
|
24315
24447
|
var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
|
|
24316
24448
|
var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
|
|
24449
|
+
// Under secureHeaders() the policy only allows <style> elements that carry
|
|
24450
|
+
// the page's nonce. Angular adds one for every component it renders or
|
|
24451
|
+
// hot-updates in the browser, so hand it the nonce the server put on the
|
|
24452
|
+
// page (browsers hide the attribute's value; the property keeps it).
|
|
24453
|
+
var cspNonce = (document.querySelector('script[nonce], style[nonce]') || {}).nonce;
|
|
24454
|
+
if (cspNonce) contextProviders.push({ provide: CSP_NONCE, useValue: cspNonce });
|
|
24317
24455
|
// Page-level providers are injected directly into the page module's
|
|
24318
24456
|
// server output by \`compileAngular\`'s providers-injection step
|
|
24319
24457
|
// (\`...appProviders, provideRouter(routes), { APP_BASE_HREF }\`),
|
|
@@ -24414,6 +24552,7 @@ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
|
|
|
24414
24552
|
};
|
|
24415
24553
|
};
|
|
24416
24554
|
var init_compileAngular = __esm(() => {
|
|
24555
|
+
init_lazyTypescript();
|
|
24417
24556
|
init_constants();
|
|
24418
24557
|
init_sourceMetadata();
|
|
24419
24558
|
init_lowerDeferSyntax();
|
|
@@ -25575,7 +25714,7 @@ import {
|
|
|
25575
25714
|
readFileSync as readFileSync35,
|
|
25576
25715
|
renameSync,
|
|
25577
25716
|
rmSync as rmSync2,
|
|
25578
|
-
statSync as
|
|
25717
|
+
statSync as statSync7,
|
|
25579
25718
|
writeFileSync as writeFileSync14
|
|
25580
25719
|
} from "fs";
|
|
25581
25720
|
import {
|
|
@@ -25787,7 +25926,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
25787
25926
|
}, SKIP_DIRS5, addWorkerPathIfExists = (file, relPath, workerPaths) => {
|
|
25788
25927
|
const absPath = resolve39(file, "..", relPath);
|
|
25789
25928
|
try {
|
|
25790
|
-
|
|
25929
|
+
statSync7(absPath);
|
|
25791
25930
|
workerPaths.add(absPath);
|
|
25792
25931
|
} catch {}
|
|
25793
25932
|
}, extractWorkerSpecifiers = (file, patterns) => {
|
|
@@ -25932,7 +26071,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
25932
26071
|
for (const srcPath of urlReferencedFiles) {
|
|
25933
26072
|
const rel = relative26(projectRoot, srcPath).replace(/\\/g, "/");
|
|
25934
26073
|
const name = basename19(srcPath);
|
|
25935
|
-
const mtime = Math.round(
|
|
26074
|
+
const mtime = Math.round(statSync7(srcPath).mtimeMs);
|
|
25936
26075
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
25937
26076
|
urlFileMap.set(name, url);
|
|
25938
26077
|
urlFileMap.set(name.replace(/\.tsx?$/, ".js"), url);
|
|
@@ -27392,9 +27531,18 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
27392
27531
|
recordManifestKey(basename19(htmxFile, ".html"), htmxFile, join56(htmxPagesPath, relative26(outputHtmxPages, htmxFile)));
|
|
27393
27532
|
}
|
|
27394
27533
|
};
|
|
27534
|
+
const processStaticConventions = async () => {
|
|
27535
|
+
const conventionDirs = ["html", "htmx"].filter((framework) => conventionsMap[framework]).map((framework) => join56(buildPath, "conventions", framework)).filter((dir) => existsSync41(dir));
|
|
27536
|
+
await Promise.all(conventionDirs.map(async (dir) => {
|
|
27537
|
+
await updateAssetPaths(manifest, dir);
|
|
27538
|
+
if (fonts && fonts.injectHtml !== false)
|
|
27539
|
+
await injectFontTags(dir, fontAssets(manifest));
|
|
27540
|
+
}));
|
|
27541
|
+
};
|
|
27395
27542
|
await Promise.all([
|
|
27396
27543
|
tracePhase("postprocess/html-pages", processHtmlPages),
|
|
27397
|
-
tracePhase("postprocess/htmx-pages", processHtmxPages)
|
|
27544
|
+
tracePhase("postprocess/htmx-pages", processHtmxPages),
|
|
27545
|
+
tracePhase("postprocess/static-conventions", processStaticConventions)
|
|
27398
27546
|
]);
|
|
27399
27547
|
if (manifestKeyCollisions.length > 0) {
|
|
27400
27548
|
const message = formatManifestKeyCollisions(manifestKeyCollisions, projectRoot);
|
|
@@ -28479,6 +28627,13 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
28479
28627
|
}
|
|
28480
28628
|
} catch {}
|
|
28481
28629
|
}
|
|
28630
|
+
const registryPath = config.islands?.registry;
|
|
28631
|
+
if (registryPath) {
|
|
28632
|
+
const registryDir = normalizePath(dirname34(resolve43(cwd, registryPath)));
|
|
28633
|
+
const isWatched = roots.some((root) => registryDir === root || registryDir.startsWith(`${root}/`));
|
|
28634
|
+
if (!isWatched && registryDir !== normalizePath(cwd))
|
|
28635
|
+
push(registryDir);
|
|
28636
|
+
}
|
|
28482
28637
|
const extraDirs = config.dev?.watchDirs ?? [];
|
|
28483
28638
|
for (const dir of extraDirs)
|
|
28484
28639
|
push(dir);
|
|
@@ -28657,7 +28812,7 @@ var init_editorTempFiles = __esm(() => {
|
|
|
28657
28812
|
|
|
28658
28813
|
// src/dev/fileWatcher.ts
|
|
28659
28814
|
import { watch } from "fs";
|
|
28660
|
-
import { existsSync as existsSync47, readdirSync as readdirSync10, statSync as
|
|
28815
|
+
import { existsSync as existsSync47, readdirSync as readdirSync10, statSync as statSync8 } from "fs";
|
|
28661
28816
|
import { dirname as dirname35, join as join60, resolve as resolve44 } from "path";
|
|
28662
28817
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
28663
28818
|
try {
|
|
@@ -28695,7 +28850,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
28695
28850
|
continue;
|
|
28696
28851
|
let st;
|
|
28697
28852
|
try {
|
|
28698
|
-
st =
|
|
28853
|
+
st = statSync8(child);
|
|
28699
28854
|
} catch {
|
|
28700
28855
|
continue;
|
|
28701
28856
|
}
|
|
@@ -28759,7 +28914,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
28759
28914
|
];
|
|
28760
28915
|
const fingerprint = (name) => {
|
|
28761
28916
|
try {
|
|
28762
|
-
const value =
|
|
28917
|
+
const value = statSync8(join60(root, name));
|
|
28763
28918
|
return value.isFile() ? `${value.ino}:${value.size}:${value.mtimeMs}:${value.ctimeMs}` : null;
|
|
28764
28919
|
} catch {
|
|
28765
28920
|
return null;
|
|
@@ -28826,7 +28981,7 @@ var init_fileWatcher = __esm(() => {
|
|
|
28826
28981
|
});
|
|
28827
28982
|
|
|
28828
28983
|
// src/build/svelteDeclarations.ts
|
|
28829
|
-
import { existsSync as existsSync48, readdirSync as readdirSync11, readFileSync as readFileSync39, statSync as
|
|
28984
|
+
import { existsSync as existsSync48, readdirSync as readdirSync11, readFileSync as readFileSync39, statSync as statSync9 } from "fs";
|
|
28830
28985
|
import { mkdir as mkdir13, rename as rename4, rm as rm12, writeFile as writeFile12 } from "fs/promises";
|
|
28831
28986
|
import { dirname as dirname36, join as join61, relative as relative27, resolve as resolve45 } from "path";
|
|
28832
28987
|
var SVELTE_DECLARATIONS_ROOT = ".absolutejs/types/svelte", FINGERPRINT_FILE = ".fingerprint", SKIPPED_DIRECTORIES, EMIT_SCRIPT = `
|
|
@@ -28884,7 +29039,7 @@ emitDts({
|
|
|
28884
29039
|
return SKIPPED_DIRECTORIES.has(entry.name) ? [] : collectInputs(path);
|
|
28885
29040
|
if (!DECLARATION_INPUT.test(entry.name))
|
|
28886
29041
|
return [];
|
|
28887
|
-
const { mtimeMs, size } =
|
|
29042
|
+
const { mtimeMs, size } = statSync9(path);
|
|
28888
29043
|
return [`${path}\x00${mtimeMs}\x00${size}`];
|
|
28889
29044
|
}), fingerprintOf = (svelteDir, tsconfigPath, svelte2tsxPath) => {
|
|
28890
29045
|
const svelte2tsxManifest = join61(dirname36(svelte2tsxPath), "package.json");
|
|
@@ -29173,19 +29328,25 @@ var init_assetStore = __esm(() => {
|
|
|
29173
29328
|
});
|
|
29174
29329
|
|
|
29175
29330
|
// src/dev/restartScope.ts
|
|
29176
|
-
import { realpathSync as realpathSync7 } from "fs";
|
|
29331
|
+
import { realpathSync as realpathSync7, statSync as statSync10 } from "fs";
|
|
29177
29332
|
var MODULE_FILE, DOCUMENT_FILE, realPath = (path) => {
|
|
29178
29333
|
try {
|
|
29179
29334
|
return realpathSync7(path);
|
|
29180
29335
|
} catch {
|
|
29181
29336
|
return path;
|
|
29182
29337
|
}
|
|
29338
|
+
}, isDirectory = (path) => {
|
|
29339
|
+
try {
|
|
29340
|
+
return statSync10(path).isDirectory();
|
|
29341
|
+
} catch {
|
|
29342
|
+
return false;
|
|
29343
|
+
}
|
|
29183
29344
|
}, isLoadedByThisProcess = (path) => (path in __require.cache) || (realPath(path) in __require.cache), changeNeedsRestart = (path, isLoaded = isLoadedByThisProcess) => {
|
|
29184
29345
|
if (DOCUMENT_FILE.test(path) || isTestSourcePath(path))
|
|
29185
29346
|
return false;
|
|
29186
29347
|
if (MODULE_FILE.test(path))
|
|
29187
29348
|
return isLoaded(path);
|
|
29188
|
-
return
|
|
29349
|
+
return !isDirectory(path);
|
|
29189
29350
|
};
|
|
29190
29351
|
var init_restartScope = __esm(() => {
|
|
29191
29352
|
MODULE_FILE = /\.(?:[cm]?[jt]sx?|mts|cts)$/;
|
|
@@ -29194,7 +29355,7 @@ var init_restartScope = __esm(() => {
|
|
|
29194
29355
|
|
|
29195
29356
|
// src/islands/pageMetadata.ts
|
|
29196
29357
|
import { readFileSync as readFileSync40 } from "fs";
|
|
29197
|
-
import {
|
|
29358
|
+
import { resolve as resolve48 } from "path";
|
|
29198
29359
|
var pagePatterns, getPageDirs = (config) => [
|
|
29199
29360
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
29200
29361
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -29214,17 +29375,10 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
29214
29375
|
const source = definition.buildReference?.source;
|
|
29215
29376
|
if (!source)
|
|
29216
29377
|
continue;
|
|
29217
|
-
|
|
29218
|
-
lookup.set(`${definition.framework}:${definition.component}`, resolve48(resolvedSource));
|
|
29378
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve48(resolveIslandSourceFile(buildInfo.resolvedRegistryPath, source)));
|
|
29219
29379
|
}
|
|
29220
29380
|
return lookup;
|
|
29221
|
-
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map,
|
|
29222
|
-
const candidate = usage.source;
|
|
29223
|
-
return candidate ? resolve48(candidate) === target : false;
|
|
29224
|
-
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
29225
|
-
const target = resolve48(sourcePath);
|
|
29226
|
-
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
29227
|
-
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
29381
|
+
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
29228
29382
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
29229
29383
|
return sourcePath ? {
|
|
29230
29384
|
...usage,
|
|
@@ -29267,7 +29421,7 @@ var init_pageMetadata = __esm(() => {
|
|
|
29267
29421
|
});
|
|
29268
29422
|
|
|
29269
29423
|
// src/dev/fileHashTracker.ts
|
|
29270
|
-
import { readFileSync as readFileSync41, statSync as
|
|
29424
|
+
import { readFileSync as readFileSync41, statSync as statSync11 } from "fs";
|
|
29271
29425
|
var computeFileHash = (filePath) => {
|
|
29272
29426
|
try {
|
|
29273
29427
|
const fileContent = readFileSync41(filePath);
|
|
@@ -29286,7 +29440,7 @@ var computeFileHash = (filePath) => {
|
|
|
29286
29440
|
if (previousHashes.has(normalizePath(filePath)))
|
|
29287
29441
|
return false;
|
|
29288
29442
|
try {
|
|
29289
|
-
return
|
|
29443
|
+
return statSync11(filePath).mtimeMs < processStart;
|
|
29290
29444
|
} catch {
|
|
29291
29445
|
return false;
|
|
29292
29446
|
}
|
|
@@ -29516,7 +29670,7 @@ var init_reactServerComponentsRebuild = __esm(() => {
|
|
|
29516
29670
|
|
|
29517
29671
|
// src/utils/spaRouteCss.ts
|
|
29518
29672
|
import { readFile as readFile9 } from "fs/promises";
|
|
29519
|
-
import { dirname as
|
|
29673
|
+
import { dirname as dirname37, isAbsolute as isAbsolute11, resolve as resolve52 } from "path";
|
|
29520
29674
|
var sideManifestCache, readSideManifest = async (sideManifestPath) => {
|
|
29521
29675
|
const cached = sideManifestCache.get(sideManifestPath);
|
|
29522
29676
|
if (cached !== undefined)
|
|
@@ -29554,7 +29708,7 @@ var sideManifestCache, readSideManifest = async (sideManifestPath) => {
|
|
|
29554
29708
|
}, readChildCss = async (cssPath, sideManifestPath) => {
|
|
29555
29709
|
if (!cssPath)
|
|
29556
29710
|
return "";
|
|
29557
|
-
const resolvedCssPath = isAbsolute11(cssPath) ? cssPath : resolve52(
|
|
29711
|
+
const resolvedCssPath = isAbsolute11(cssPath) ? cssPath : resolve52(dirname37(sideManifestPath), cssPath);
|
|
29558
29712
|
const cached = childCssCache.get(resolvedCssPath);
|
|
29559
29713
|
if (cached !== undefined)
|
|
29560
29714
|
return cached;
|
|
@@ -29638,9 +29792,8 @@ __export(exports_resolveOwningComponents, {
|
|
|
29638
29792
|
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
29639
29793
|
resolveOwningComponents: () => resolveOwningComponents
|
|
29640
29794
|
});
|
|
29641
|
-
import { readdirSync as readdirSync12, readFileSync as readFileSync42, statSync as
|
|
29642
|
-
import { dirname as
|
|
29643
|
-
import ts20 from "typescript";
|
|
29795
|
+
import { readdirSync as readdirSync12, readFileSync as readFileSync42, statSync as statSync12 } from "fs";
|
|
29796
|
+
import { dirname as dirname38, extname as extname19, join as join62, resolve as resolve53 } from "path";
|
|
29644
29797
|
var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || file.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
29645
29798
|
const out = [];
|
|
29646
29799
|
const visit = (dir) => {
|
|
@@ -29666,13 +29819,13 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29666
29819
|
return out;
|
|
29667
29820
|
}, getStringPropertyValue = (obj, name) => {
|
|
29668
29821
|
for (const prop of obj.properties) {
|
|
29669
|
-
if (!
|
|
29822
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
29670
29823
|
continue;
|
|
29671
|
-
const propName =
|
|
29824
|
+
const propName = lazyTypescript.isIdentifier(prop.name) || lazyTypescript.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
29672
29825
|
if (propName !== name)
|
|
29673
29826
|
continue;
|
|
29674
29827
|
const init = prop.initializer;
|
|
29675
|
-
if (
|
|
29828
|
+
if (lazyTypescript.isStringLiteral(init) || lazyTypescript.isNoSubstitutionTemplateLiteral(init)) {
|
|
29676
29829
|
return init.text;
|
|
29677
29830
|
}
|
|
29678
29831
|
}
|
|
@@ -29680,16 +29833,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29680
29833
|
}, getStringArrayProperty = (obj, name) => {
|
|
29681
29834
|
const out = [];
|
|
29682
29835
|
for (const prop of obj.properties) {
|
|
29683
|
-
if (!
|
|
29836
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
29684
29837
|
continue;
|
|
29685
|
-
const propName =
|
|
29838
|
+
const propName = lazyTypescript.isIdentifier(prop.name) || lazyTypescript.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
29686
29839
|
if (propName !== name)
|
|
29687
29840
|
continue;
|
|
29688
29841
|
const init = prop.initializer;
|
|
29689
|
-
if (!
|
|
29842
|
+
if (!lazyTypescript.isArrayLiteralExpression(init))
|
|
29690
29843
|
continue;
|
|
29691
29844
|
for (const element of init.elements) {
|
|
29692
|
-
if (
|
|
29845
|
+
if (lazyTypescript.isStringLiteral(element) || lazyTypescript.isNoSubstitutionTemplateLiteral(element)) {
|
|
29693
29846
|
out.push(element.text);
|
|
29694
29847
|
}
|
|
29695
29848
|
}
|
|
@@ -29702,27 +29855,27 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29702
29855
|
} catch {
|
|
29703
29856
|
return [];
|
|
29704
29857
|
}
|
|
29705
|
-
const sourceFile =
|
|
29858
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
|
|
29706
29859
|
const out = [];
|
|
29707
29860
|
const visit = (node) => {
|
|
29708
|
-
if (
|
|
29709
|
-
for (const decorator of
|
|
29861
|
+
if (lazyTypescript.isClassDeclaration(node) && node.name) {
|
|
29862
|
+
for (const decorator of lazyTypescript.getDecorators(node) ?? []) {
|
|
29710
29863
|
const expr = decorator.expression;
|
|
29711
|
-
if (!
|
|
29864
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
29712
29865
|
continue;
|
|
29713
29866
|
const functionNode = expr.expression;
|
|
29714
|
-
if (!
|
|
29867
|
+
if (!lazyTypescript.isIdentifier(functionNode))
|
|
29715
29868
|
continue;
|
|
29716
29869
|
const kind = ENTITY_DECORATORS[functionNode.text];
|
|
29717
29870
|
if (!kind)
|
|
29718
29871
|
continue;
|
|
29719
29872
|
let extendsName = null;
|
|
29720
29873
|
for (const heritage of node.heritageClauses ?? []) {
|
|
29721
|
-
if (heritage.token !==
|
|
29874
|
+
if (heritage.token !== lazyTypescript.SyntaxKind.ExtendsKeyword) {
|
|
29722
29875
|
continue;
|
|
29723
29876
|
}
|
|
29724
29877
|
const [first] = heritage.types;
|
|
29725
|
-
if (first &&
|
|
29878
|
+
if (first && lazyTypescript.isIdentifier(first.expression)) {
|
|
29726
29879
|
extendsName = first.expression.text;
|
|
29727
29880
|
}
|
|
29728
29881
|
break;
|
|
@@ -29735,7 +29888,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29735
29888
|
templateUrls: []
|
|
29736
29889
|
};
|
|
29737
29890
|
const [arg] = expr.arguments;
|
|
29738
|
-
if (arg &&
|
|
29891
|
+
if (arg && lazyTypescript.isObjectLiteralExpression(arg) && kind === "component") {
|
|
29739
29892
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
29740
29893
|
if (tplUrl)
|
|
29741
29894
|
entry.templateUrls.push(tplUrl);
|
|
@@ -29748,7 +29901,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29748
29901
|
break;
|
|
29749
29902
|
}
|
|
29750
29903
|
}
|
|
29751
|
-
|
|
29904
|
+
lazyTypescript.forEachChild(node, visit);
|
|
29752
29905
|
};
|
|
29753
29906
|
visit(sourceFile);
|
|
29754
29907
|
return out;
|
|
@@ -29773,7 +29926,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29773
29926
|
}
|
|
29774
29927
|
let rootStat;
|
|
29775
29928
|
try {
|
|
29776
|
-
rootStat =
|
|
29929
|
+
rootStat = statSync12(userAngularRoot);
|
|
29777
29930
|
} catch {
|
|
29778
29931
|
return out;
|
|
29779
29932
|
}
|
|
@@ -29792,12 +29945,12 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29792
29945
|
} catch {
|
|
29793
29946
|
return null;
|
|
29794
29947
|
}
|
|
29795
|
-
const sourceFile =
|
|
29796
|
-
const childDir =
|
|
29948
|
+
const sourceFile = lazyTypescript.createSourceFile(childFilePath, source, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
|
|
29949
|
+
const childDir = dirname38(childFilePath);
|
|
29797
29950
|
for (const stmt of sourceFile.statements) {
|
|
29798
|
-
if (!
|
|
29951
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
29799
29952
|
continue;
|
|
29800
|
-
if (!
|
|
29953
|
+
if (!lazyTypescript.isStringLiteral(stmt.moduleSpecifier))
|
|
29801
29954
|
continue;
|
|
29802
29955
|
const clause = stmt.importClause;
|
|
29803
29956
|
if (!clause || clause.isTypeOnly)
|
|
@@ -29805,7 +29958,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29805
29958
|
let matchesName = false;
|
|
29806
29959
|
if (clause.name && clause.name.text === parentName)
|
|
29807
29960
|
matchesName = true;
|
|
29808
|
-
if (!matchesName && clause.namedBindings &&
|
|
29961
|
+
if (!matchesName && clause.namedBindings && lazyTypescript.isNamedImports(clause.namedBindings)) {
|
|
29809
29962
|
for (const element of clause.namedBindings.elements) {
|
|
29810
29963
|
if (element.isTypeOnly)
|
|
29811
29964
|
continue;
|
|
@@ -29831,7 +29984,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29831
29984
|
const angularRootNorm = safeNormalize(angularRoot);
|
|
29832
29985
|
for (const candidate of candidates) {
|
|
29833
29986
|
try {
|
|
29834
|
-
if (
|
|
29987
|
+
if (statSync12(candidate).isFile()) {
|
|
29835
29988
|
const norm = safeNormalize(candidate);
|
|
29836
29989
|
if (!norm.startsWith(angularRootNorm))
|
|
29837
29990
|
return null;
|
|
@@ -29850,7 +30003,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29850
30003
|
const parentFile = new Map;
|
|
29851
30004
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
29852
30005
|
const classes = parseDecoratedClasses(tsPath);
|
|
29853
|
-
const componentDir =
|
|
30006
|
+
const componentDir = dirname38(tsPath);
|
|
29854
30007
|
for (const cls of classes) {
|
|
29855
30008
|
const entity = {
|
|
29856
30009
|
className: cls.className,
|
|
@@ -29888,7 +30041,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29888
30041
|
const norm = safeNormalize(params.changedFilePath);
|
|
29889
30042
|
let rootStat;
|
|
29890
30043
|
try {
|
|
29891
|
-
rootStat =
|
|
30044
|
+
rootStat = statSync12(params.userAngularRoot);
|
|
29892
30045
|
} catch {
|
|
29893
30046
|
return [];
|
|
29894
30047
|
}
|
|
@@ -29898,6 +30051,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
29898
30051
|
return bundle.parentFile.get(norm) ?? [];
|
|
29899
30052
|
};
|
|
29900
30053
|
var init_resolveOwningComponents = __esm(() => {
|
|
30054
|
+
init_lazyTypescript();
|
|
29901
30055
|
ENTITY_DECORATORS = {
|
|
29902
30056
|
Component: "component",
|
|
29903
30057
|
Directive: "directive",
|
|
@@ -32848,7 +33002,7 @@ import {
|
|
|
32848
33002
|
X509Certificate as X509Certificate3
|
|
32849
33003
|
} from "crypto";
|
|
32850
33004
|
import { access as access4, mkdir as mkdir15 } from "fs/promises";
|
|
32851
|
-
import { dirname as
|
|
33005
|
+
import { dirname as dirname39, isAbsolute as isAbsolute12, relative as relative29, resolve as resolve58, sep as sep13 } from "path";
|
|
32852
33006
|
import { pathToFileURL as pathToFileURL3 } from "url";
|
|
32853
33007
|
import { Elysia as Elysia8 } from "elysia";
|
|
32854
33008
|
var ABSOLUTE_MOBILE_UPDATE_SERVER_FORMAT = 1, DEFAULT_MOBILE_UPDATE_REGISTRY_MODULE = "mobile.update.ts", object4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), projectPath = (projectRoot, requested) => {
|
|
@@ -33073,7 +33227,7 @@ ${generated}`);
|
|
|
33073
33227
|
return;
|
|
33074
33228
|
});
|
|
33075
33229
|
}
|
|
33076
|
-
await mkdir15(
|
|
33230
|
+
await mkdir15(dirname39(path), { recursive: true });
|
|
33077
33231
|
await Bun.write(path, renderAbsoluteMobileUpdateRegistry({
|
|
33078
33232
|
...options.health ? { health: options.health } : {},
|
|
33079
33233
|
...options.rollout ? { rollout: options.rollout } : {},
|
|
@@ -33124,7 +33278,7 @@ var init_bridgeInternals = __esm(() => {
|
|
|
33124
33278
|
});
|
|
33125
33279
|
|
|
33126
33280
|
// src/dev/angular/hmrCompiler.ts
|
|
33127
|
-
import { dirname as
|
|
33281
|
+
import { dirname as dirname40, relative as relative30, resolve as resolve59 } from "path";
|
|
33128
33282
|
import { performance as performance2 } from "perf_hooks";
|
|
33129
33283
|
var encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
33130
33284
|
const projectRel = relative30(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
@@ -33147,7 +33301,7 @@ var encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
|
33147
33301
|
await Promise.resolve().then(() => init_resolveOwningComponents());
|
|
33148
33302
|
const owners = resolveOwningComponents({
|
|
33149
33303
|
changedFilePath: componentFilePath,
|
|
33150
|
-
userAngularRoot:
|
|
33304
|
+
userAngularRoot: dirname40(componentFilePath)
|
|
33151
33305
|
});
|
|
33152
33306
|
const owner = owners.find((o) => o.className === className);
|
|
33153
33307
|
const kind = owner?.kind ?? "component";
|
|
@@ -33342,7 +33496,7 @@ var init_hmr = __esm(() => {
|
|
|
33342
33496
|
|
|
33343
33497
|
// src/plugins/devtoolsJson.ts
|
|
33344
33498
|
import { existsSync as existsSync53, mkdirSync as mkdirSync19, readFileSync as readFileSync49, writeFileSync as writeFileSync16 } from "fs";
|
|
33345
|
-
import { dirname as
|
|
33499
|
+
import { dirname as dirname41, join as join69, resolve as resolve60 } from "path";
|
|
33346
33500
|
import { Elysia as Elysia10 } from "elysia";
|
|
33347
33501
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
33348
33502
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
@@ -33369,7 +33523,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
33369
33523
|
if (cachedUuid)
|
|
33370
33524
|
return setGlobalUuid(cachedUuid);
|
|
33371
33525
|
const uuid = crypto.randomUUID();
|
|
33372
|
-
mkdirSync19(
|
|
33526
|
+
mkdirSync19(dirname41(cachePath), { recursive: true });
|
|
33373
33527
|
writeFileSync16(cachePath, uuid, "utf-8");
|
|
33374
33528
|
return setGlobalUuid(uuid);
|
|
33375
33529
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
@@ -34138,7 +34292,7 @@ import {
|
|
|
34138
34292
|
rm as rm17,
|
|
34139
34293
|
writeFile as writeFile16
|
|
34140
34294
|
} from "fs/promises";
|
|
34141
|
-
import { dirname as
|
|
34295
|
+
import { dirname as dirname42, join as join71, resolve as resolvePath2 } from "path";
|
|
34142
34296
|
import { pathToFileURL as pathToFileURL5 } from "url";
|
|
34143
34297
|
var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "current.json", BUNDLES_DIRECTORY = "bundles", ARTIFACT_FILE2 = "artifact.json", BUNDLE_ID_PATTERN, isRecord13 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), errorHasCode2 = (error, code) => typeof error === "object" && error !== null && Reflect.get(error, "code") === code, bundleIdFor = (currentReleaseId, releases) => {
|
|
34144
34298
|
const identity = JSON.stringify({
|
|
@@ -34171,7 +34325,7 @@ var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "curre
|
|
|
34171
34325
|
}, writeRelease = async (root, release) => {
|
|
34172
34326
|
const directory = join71(root, release.artifact.releaseId);
|
|
34173
34327
|
const producerPath = join71(directory, release.artifact.producer.module);
|
|
34174
|
-
await mkdir17(
|
|
34328
|
+
await mkdir17(dirname42(producerPath), { recursive: true });
|
|
34175
34329
|
await Promise.all([
|
|
34176
34330
|
writeFile16(join71(directory, ARTIFACT_FILE2), `${JSON.stringify(release.artifact, null, "\t")}
|
|
34177
34331
|
`),
|
|
@@ -35364,6 +35518,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
35364
35518
|
return statusCode === undefined || statusCode === HTTP_STATUS_INTERNAL_SERVER_ERROR;
|
|
35365
35519
|
}, createStaticErrorPlugin = (owner) => {
|
|
35366
35520
|
let startedApp;
|
|
35521
|
+
const loggedErrors = new WeakSet;
|
|
35367
35522
|
return new Elysia15({ name: "absolutejs-static-error" }).onStart((app) => {
|
|
35368
35523
|
startedApp = app;
|
|
35369
35524
|
}).onError("global", async ({ error, request, set }) => {
|
|
@@ -35372,11 +35527,11 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
35372
35527
|
const app = globalThis.__absoluteLiveApp ?? startedApp;
|
|
35373
35528
|
if (hasForeignErrorHook(app, owner()))
|
|
35374
35529
|
return;
|
|
35375
|
-
|
|
35376
|
-
|
|
35377
|
-
|
|
35378
|
-
|
|
35379
|
-
return
|
|
35530
|
+
if (!loggedErrors.has(error)) {
|
|
35531
|
+
loggedErrors.add(error);
|
|
35532
|
+
console.error(`[SSR] ${request.method} ${new URL(request.url).pathname} threw:`, error);
|
|
35533
|
+
}
|
|
35534
|
+
return await renderStaticRouteError(request, error) ?? undefined;
|
|
35380
35535
|
});
|
|
35381
35536
|
}, createBuildErrorRecoveryPlugin = () => new Elysia15({ name: "absolutejs-build-error-recovery" }).onError("global", async ({ error }) => {
|
|
35382
35537
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -35638,8 +35793,8 @@ __export(exports_moduleServer, {
|
|
|
35638
35793
|
warmPage: () => warmPage,
|
|
35639
35794
|
warnIfReactFastRefreshUnsupported: () => warnIfReactFastRefreshUnsupported
|
|
35640
35795
|
});
|
|
35641
|
-
import { existsSync as existsSync57, readFileSync as readFileSync53, realpathSync as realpathSync8, statSync as
|
|
35642
|
-
import { basename as basename22, dirname as
|
|
35796
|
+
import { existsSync as existsSync57, readFileSync as readFileSync53, realpathSync as realpathSync8, statSync as statSync13 } from "fs";
|
|
35797
|
+
import { basename as basename22, dirname as dirname43, extname as extname20, join as join74, resolve as resolve62, relative as relative32 } from "path";
|
|
35643
35798
|
var SRC_PREFIX = "/@src/", BROWSER_DEFINE, jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
35644
35799
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
35645
35800
|
const allExports = [];
|
|
@@ -35696,7 +35851,7 @@ ${stubs}
|
|
|
35696
35851
|
if (cached !== undefined)
|
|
35697
35852
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
35698
35853
|
try {
|
|
35699
|
-
const mtime = Math.round(
|
|
35854
|
+
const mtime = Math.round(statSync13(absPath).mtimeMs);
|
|
35700
35855
|
mtimeCache.set(absPath, mtime);
|
|
35701
35856
|
return `${base}?v=${buildVersion(mtime, absPath)}`;
|
|
35702
35857
|
} catch {
|
|
@@ -35773,7 +35928,7 @@ ${stubs}
|
|
|
35773
35928
|
};
|
|
35774
35929
|
result = result.replace(/^((?:import\s+[^"'`;]+?\s+from|export\s+[^"'`;]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
35775
35930
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
35776
|
-
const fileDir =
|
|
35931
|
+
const fileDir = dirname43(filePath);
|
|
35777
35932
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
|
|
35778
35933
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
|
|
35779
35934
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}` : _match);
|
|
@@ -36013,7 +36168,7 @@ ${code}`;
|
|
|
36013
36168
|
if (compiled.css?.code) {
|
|
36014
36169
|
const cssPath = `${filePath}.css`;
|
|
36015
36170
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
36016
|
-
const cssUrl =
|
|
36171
|
+
const cssUrl = `${SRC_PREFIX}${encodeSrcPath(relative32(projectRoot, cssPath))}?v=${Bun.hash(compiled.css.code).toString(BASE_36_RADIX)}`;
|
|
36017
36172
|
code = `import "${cssUrl}";
|
|
36018
36173
|
${code}`;
|
|
36019
36174
|
}
|
|
@@ -36022,7 +36177,7 @@ ${code}`;
|
|
|
36022
36177
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
36023
36178
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
36024
36179
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
36025
|
-
}, svelteLazyRegistrations = (raw, filePath, projectRoot) => Array.from(raw.matchAll(/\bimport\s*\(\s*['"](\.[^'"]+\.svelte)['"]\s*\)/g)).map((match) => match[1]).filter((spec) => spec !== undefined).filter((spec) => existsSync57(resolve62(
|
|
36180
|
+
}, svelteLazyRegistrations = (raw, filePath, projectRoot) => Array.from(raw.matchAll(/\bimport\s*\(\s*['"](\.[^'"]+\.svelte)['"]\s*\)/g)).map((match) => match[1]).filter((spec) => spec !== undefined).filter((spec) => existsSync57(resolve62(dirname43(filePath), spec))).map((spec) => lazyModuleRegistration(relative32(projectRoot, resolve62(dirname43(filePath), spec)).replace(/\\/g, "/"), spec)).join(""), transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
36026
36181
|
const raw = readFileSync53(filePath, "utf-8");
|
|
36027
36182
|
if (!svelteCompiler) {
|
|
36028
36183
|
svelteCompiler = await import("svelte/compiler");
|
|
@@ -36341,7 +36496,7 @@ export default {};
|
|
|
36341
36496
|
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
36342
36497
|
if (!TRANSPILABLE.has(ext))
|
|
36343
36498
|
return;
|
|
36344
|
-
const stat =
|
|
36499
|
+
const stat = statSync13(filePath);
|
|
36345
36500
|
const resolvedVueDir = vueDir ? resolve62(vueDir) : undefined;
|
|
36346
36501
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
36347
36502
|
const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
@@ -36369,12 +36524,12 @@ export default {};
|
|
|
36369
36524
|
cachedAngularUserRoot = configuredAngularUserRoot ?? null;
|
|
36370
36525
|
return cachedAngularUserRoot;
|
|
36371
36526
|
}, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
36372
|
-
const stat =
|
|
36527
|
+
const stat = statSync13(filePath);
|
|
36373
36528
|
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
36374
36529
|
setTransformed(filePath, content, stat.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
36375
36530
|
return jsResponse(content);
|
|
36376
36531
|
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
36377
|
-
const stat =
|
|
36532
|
+
const stat = statSync13(filePath);
|
|
36378
36533
|
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
36379
36534
|
setTransformed(filePath, content, stat.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
36380
36535
|
return jsResponse(content);
|
|
@@ -36833,8 +36988,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
36833
36988
|
var init_simpleHTMXHMR = () => {};
|
|
36834
36989
|
|
|
36835
36990
|
// src/dev/backendGraph.ts
|
|
36836
|
-
import { readFileSync as readFileSync54, realpathSync as realpathSync9, statSync as
|
|
36837
|
-
import { dirname as
|
|
36991
|
+
import { readFileSync as readFileSync54, realpathSync as realpathSync9, statSync as statSync14 } from "fs";
|
|
36992
|
+
import { dirname as dirname44, extname as extname21, resolve as resolve65 } from "path";
|
|
36838
36993
|
var SOURCE_FILE, VENDORED, LOADERS, fileCache, transpilers, transpilerFor = (path) => {
|
|
36839
36994
|
const loader = LOADERS[extname21(path)] ?? "ts";
|
|
36840
36995
|
const existing = transpilers.get(loader);
|
|
@@ -36851,14 +37006,14 @@ var SOURCE_FILE, VENDORED, LOADERS, fileCache, transpilers, transpilerFor = (pat
|
|
|
36851
37006
|
}
|
|
36852
37007
|
}, isProjectModule = (path, root = process.cwd()) => SOURCE_FILE.test(path) && !VENDORED.test(path) && resolve65(path).startsWith(resolve65(root)), resolveImport = (specifier, fromFile) => {
|
|
36853
37008
|
try {
|
|
36854
|
-
return realPath2(Bun.resolveSync(specifier,
|
|
37009
|
+
return realPath2(Bun.resolveSync(specifier, dirname44(fromFile)));
|
|
36855
37010
|
} catch {
|
|
36856
37011
|
return;
|
|
36857
37012
|
}
|
|
36858
37013
|
}, readImports = (path) => {
|
|
36859
37014
|
let mtimeMs;
|
|
36860
37015
|
try {
|
|
36861
|
-
({ mtimeMs } =
|
|
37016
|
+
({ mtimeMs } = statSync14(path));
|
|
36862
37017
|
} catch {
|
|
36863
37018
|
fileCache.delete(path);
|
|
36864
37019
|
return [];
|
|
@@ -36910,7 +37065,7 @@ var init_backendGraph = __esm(() => {
|
|
|
36910
37065
|
});
|
|
36911
37066
|
|
|
36912
37067
|
// src/dev/hot/analyze.ts
|
|
36913
|
-
import { dirname as
|
|
37068
|
+
import { dirname as dirname45, extname as extname22 } from "path";
|
|
36914
37069
|
var ANALYZER_VERSION = 2, hashText = (text) => Bun.hash(text).toString(36), scriptKindFor = (tsc, path) => {
|
|
36915
37070
|
switch (extname22(path)) {
|
|
36916
37071
|
case ".tsx":
|
|
@@ -37668,7 +37823,7 @@ var ANALYZER_VERSION = 2, hashText = (text) => Bun.hash(text).toString(36), scri
|
|
|
37668
37823
|
return analysis;
|
|
37669
37824
|
}, resolveFrom2 = (fromFile, isManaged) => (specifier) => {
|
|
37670
37825
|
try {
|
|
37671
|
-
const resolved = Bun.resolveSync(specifier,
|
|
37826
|
+
const resolved = Bun.resolveSync(specifier, dirname45(fromFile));
|
|
37672
37827
|
return isManaged(resolved) ? resolved : undefined;
|
|
37673
37828
|
} catch {
|
|
37674
37829
|
return;
|
|
@@ -37756,7 +37911,7 @@ var SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, realPath3 = (path) => {
|
|
|
37756
37911
|
} catch {
|
|
37757
37912
|
return path;
|
|
37758
37913
|
}
|
|
37759
|
-
}, typescript,
|
|
37914
|
+
}, typescript, loadTypescript2 = async () => {
|
|
37760
37915
|
typescript ??= await import("typescript");
|
|
37761
37916
|
return typescript;
|
|
37762
37917
|
}, shared, analyses, isHotManaged = (path) => {
|
|
@@ -37807,7 +37962,7 @@ var SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, realPath3 = (path) => {
|
|
|
37807
37962
|
writeFileSync17(cachePath(state.cacheDir, key), JSON.stringify(analysis));
|
|
37808
37963
|
} catch {}
|
|
37809
37964
|
}, analyzeFresh = async (canonicalPath, source) => {
|
|
37810
|
-
const typescriptModule = await
|
|
37965
|
+
const typescriptModule = await loadTypescript2();
|
|
37811
37966
|
return analyzeModule(typescriptModule, canonicalPath, source, resolveFrom2(canonicalPath, isHotManaged));
|
|
37812
37967
|
}, analyzeSource = async (canonicalPath, source) => {
|
|
37813
37968
|
const memo = analyses.get(canonicalPath);
|
|
@@ -38026,10 +38181,10 @@ var init_reload = __esm(() => {
|
|
|
38026
38181
|
});
|
|
38027
38182
|
|
|
38028
38183
|
// src/dev/rebuildTrigger.ts
|
|
38029
|
-
import { existsSync as existsSync58, readdirSync as readdirSync14, rmSync as rmSync4, statSync as
|
|
38184
|
+
import { existsSync as existsSync58, readdirSync as readdirSync14, rmSync as rmSync4, statSync as statSync15 } from "fs";
|
|
38030
38185
|
import {
|
|
38031
38186
|
basename as basename23,
|
|
38032
|
-
dirname as
|
|
38187
|
+
dirname as dirname46,
|
|
38033
38188
|
isAbsolute as isAbsolute13,
|
|
38034
38189
|
join as join76,
|
|
38035
38190
|
relative as relative35,
|
|
@@ -38384,6 +38539,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
38384
38539
|
if (!hasFileChanged(filePath, currentHash, state.fileHashes)) {
|
|
38385
38540
|
return;
|
|
38386
38541
|
}
|
|
38542
|
+
if (framework === "unknown")
|
|
38543
|
+
state.fileHashes.set(normalizePath(filePath), currentHash);
|
|
38387
38544
|
const { publicDir } = state.resolvedPaths;
|
|
38388
38545
|
const { assetsDir } = state.resolvedPaths;
|
|
38389
38546
|
const handleStaticMirror = async (sourceDir, urlPrefix) => {
|
|
@@ -38398,7 +38555,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
38398
38555
|
const { buildDir } = state.resolvedPaths;
|
|
38399
38556
|
const destPath = resolvePath4(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
|
|
38400
38557
|
const { mkdir, copyFile, readFile } = await import("fs/promises");
|
|
38401
|
-
await mkdir(
|
|
38558
|
+
await mkdir(dirname46(destPath), { recursive: true });
|
|
38402
38559
|
await copyFile(absSource, destPath);
|
|
38403
38560
|
const bytes = await readFile(destPath);
|
|
38404
38561
|
const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
|
|
@@ -38597,7 +38754,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
38597
38754
|
const keepStemsByDir = new Map;
|
|
38598
38755
|
const prefixByDir = new Map;
|
|
38599
38756
|
for (const artifact of freshOutputs) {
|
|
38600
|
-
const dir =
|
|
38757
|
+
const dir = dirname46(artifact.path);
|
|
38601
38758
|
const name = basename23(artifact.path);
|
|
38602
38759
|
const [prefix] = name.split(".");
|
|
38603
38760
|
if (!prefix)
|
|
@@ -39195,7 +39352,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
39195
39352
|
return url;
|
|
39196
39353
|
}, getReactModuleUrl, isReactComponentPath = (file) => file.endsWith(".tsx") || file.endsWith(".jsx"), isReactPagePath = (file) => file.replace(/\\/g, "/").includes("/pages/"), isImportableModule = (file) => {
|
|
39197
39354
|
try {
|
|
39198
|
-
return
|
|
39355
|
+
return statSync15(file).isFile();
|
|
39199
39356
|
} catch {
|
|
39200
39357
|
return false;
|
|
39201
39358
|
}
|
|
@@ -40014,8 +40171,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
40014
40171
|
if (!buildReference?.source) {
|
|
40015
40172
|
return;
|
|
40016
40173
|
}
|
|
40017
|
-
|
|
40018
|
-
islandFiles.add(resolvePath4(sourcePath));
|
|
40174
|
+
islandFiles.add(resolvePath4(resolveIslandSourceFile(buildInfo.resolvedRegistryPath, buildReference.source)));
|
|
40019
40175
|
}, resolveIslandSourceFiles = async (config) => {
|
|
40020
40176
|
const registryPath = config.islands?.registry;
|
|
40021
40177
|
if (!registryPath) {
|
|
@@ -40035,15 +40191,33 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
40035
40191
|
return false;
|
|
40036
40192
|
}
|
|
40037
40193
|
return filesToRebuild.some((file) => islandFiles.has(resolvePath4(file)));
|
|
40038
|
-
},
|
|
40039
|
-
const
|
|
40040
|
-
if (!
|
|
40194
|
+
}, collectChangedIslands = async (config, filesToRebuild) => {
|
|
40195
|
+
const registryPath = config.islands?.registry;
|
|
40196
|
+
if (!registryPath)
|
|
40197
|
+
return [];
|
|
40198
|
+
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
40199
|
+
const changedFiles = new Set(filesToRebuild.map((file) => resolvePath4(file)));
|
|
40200
|
+
return buildInfo.definitions.filter((definition) => {
|
|
40201
|
+
const source = definition.buildReference?.source;
|
|
40202
|
+
if (!source)
|
|
40203
|
+
return false;
|
|
40204
|
+
return changedFiles.has(resolvePath4(resolveIslandSourceFile(buildInfo.resolvedRegistryPath, source)));
|
|
40205
|
+
});
|
|
40206
|
+
}, filterFilesReachingPages = async (state, config, files) => {
|
|
40207
|
+
const islandFiles = await resolveIslandSourceFiles(config);
|
|
40208
|
+
return files.filter((file) => {
|
|
40209
|
+
const resolvedFile = resolvePath4(file);
|
|
40210
|
+
const dependents = getAffectedFiles(state.dependencyGraph, resolvedFile).filter((dependent) => dependent !== resolvedFile);
|
|
40211
|
+
if (dependents.length === 0)
|
|
40212
|
+
return !islandFiles.has(resolvedFile);
|
|
40213
|
+
return dependents.some((dependent) => !islandFiles.has(dependent));
|
|
40214
|
+
});
|
|
40215
|
+
}, isRegistryEdit = (state, config) => {
|
|
40216
|
+
const registryPath = config.islands?.registry;
|
|
40217
|
+
if (!registryPath)
|
|
40041
40218
|
return false;
|
|
40042
|
-
|
|
40043
|
-
|
|
40044
|
-
const affectedPages = filesToRebuild.flatMap((file) => getPagesUsingIslandSource(file));
|
|
40045
|
-
if (affectedPages.length === 0)
|
|
40046
|
-
return true;
|
|
40219
|
+
return state.lastUserEditedFiles?.has(resolvePath4(registryPath)) === true;
|
|
40220
|
+
}, broadcastIslandFullReload = (state, affectedPages, manifest, serverDuration, sourceFile) => {
|
|
40047
40221
|
const affectedFrameworks = [
|
|
40048
40222
|
...new Set(affectedPages.map((page) => detectFramework(page, state.resolvedPaths)).filter((framework) => framework !== "ignored"))
|
|
40049
40223
|
];
|
|
@@ -40054,10 +40228,40 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
40054
40228
|
framework: "islands",
|
|
40055
40229
|
manifest,
|
|
40056
40230
|
serverDuration,
|
|
40057
|
-
sourceFile
|
|
40231
|
+
sourceFile
|
|
40058
40232
|
},
|
|
40059
40233
|
type: "full-reload"
|
|
40060
40234
|
});
|
|
40235
|
+
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest, serverDuration) => {
|
|
40236
|
+
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
40237
|
+
if (!shouldReload) {
|
|
40238
|
+
return false;
|
|
40239
|
+
}
|
|
40240
|
+
bumpIslandServerGeneration();
|
|
40241
|
+
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
40242
|
+
const [sourceFile] = filesToRebuild;
|
|
40243
|
+
if (isRegistryEdit(state, config)) {
|
|
40244
|
+
const pagesWithIslands = [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadata.islands.length > 0).map((metadata) => metadata.pagePath);
|
|
40245
|
+
if (pagesWithIslands.length > 0)
|
|
40246
|
+
broadcastIslandFullReload(state, pagesWithIslands, manifest, serverDuration, sourceFile);
|
|
40247
|
+
return true;
|
|
40248
|
+
}
|
|
40249
|
+
const changedIslands = await collectChangedIslands(config, filesToRebuild);
|
|
40250
|
+
const islands = changedIslands.flatMap(({ component, framework }) => {
|
|
40251
|
+
const modulePath = manifest[getIslandManifestKey(framework, component)];
|
|
40252
|
+
return modulePath ? [{ component, framework, modulePath }] : [];
|
|
40253
|
+
});
|
|
40254
|
+
if (islands.length === 0)
|
|
40255
|
+
return true;
|
|
40256
|
+
logHmrUpdate(relative35(process.cwd(), sourceFile ?? ""), "islands", serverDuration);
|
|
40257
|
+
broadcastToClients(state, {
|
|
40258
|
+
data: {
|
|
40259
|
+
islands,
|
|
40260
|
+
serverDuration,
|
|
40261
|
+
sourceFile
|
|
40262
|
+
},
|
|
40263
|
+
type: "island-update"
|
|
40264
|
+
});
|
|
40061
40265
|
return true;
|
|
40062
40266
|
}, handleHTMLScriptHMR = (state, filesToRebuild, manifest, duration) => {
|
|
40063
40267
|
if (!state.resolvedPaths.htmlDir) {
|
|
@@ -40078,8 +40282,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
40078
40282
|
}, resolveStaticPageTargets = async (files, sourcePagesDir) => {
|
|
40079
40283
|
const pagesDir = resolvePath4(sourcePagesDir);
|
|
40080
40284
|
const htmlFiles = files.filter((file) => file.endsWith(".html")).map((file) => resolvePath4(file));
|
|
40081
|
-
const pages = htmlFiles.filter((file) =>
|
|
40082
|
-
const partials = new Set(htmlFiles.filter((file) =>
|
|
40285
|
+
const pages = htmlFiles.filter((file) => dirname46(file) === pagesDir);
|
|
40286
|
+
const partials = new Set(htmlFiles.filter((file) => dirname46(file) !== pagesDir));
|
|
40083
40287
|
if (partials.size === 0)
|
|
40084
40288
|
return pages;
|
|
40085
40289
|
await Promise.resolve().then(() => init_htmlIncludes());
|
|
@@ -40595,14 +40799,22 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
40595
40799
|
handled.add(configPath);
|
|
40596
40800
|
}
|
|
40597
40801
|
return files.every((f) => handled.has(f));
|
|
40802
|
+
}, keepReactIndexesOnModuleServer = async (state, manifest) => {
|
|
40803
|
+
const reactIndexes = Object.fromEntries(Object.entries(manifest).filter(([key, value]) => key.endsWith("Index") && value.includes("/indexes/") && value.includes("/react/")));
|
|
40804
|
+
if (Object.keys(reactIndexes).length === 0)
|
|
40805
|
+
return;
|
|
40806
|
+
await Promise.resolve().then(() => init_prepare());
|
|
40807
|
+
await Promise.resolve().then(() => init_moduleServer());
|
|
40808
|
+
patchManifestIndexes(reactIndexes, resolvePath4(state.resolvedPaths.buildDir, "_src_indexes"), SRC_URL_PREFIX2);
|
|
40809
|
+
Object.assign(manifest, reactIndexes);
|
|
40598
40810
|
}, performFullRebuild = async (state, config, affectedFrameworks, filesToRebuild, startTime, onRebuildComplete, options) => {
|
|
40599
40811
|
state.svelteSurgicallyHandled = undefined;
|
|
40600
40812
|
const hasManifest = Object.keys(state.manifest).length > 0;
|
|
40601
40813
|
const files = filesToRebuild ?? [];
|
|
40602
40814
|
const onDemandPage = options?.onDemandPage;
|
|
40603
|
-
let allHandled = !onDemandPage && files.length > 0 && hasManifest;
|
|
40604
40815
|
const hasIslandSourceChanges = files.length > 0 ? await didStaticPagesNeedIslandRefresh(config, files) : false;
|
|
40605
|
-
|
|
40816
|
+
let allHandled = !onDemandPage && files.length > 0 && hasManifest && !hasIslandSourceChanges;
|
|
40817
|
+
if (allHandled) {
|
|
40606
40818
|
allHandled = await runFrameworkFastPaths(state, config, affectedFrameworks, files, startTime, onRebuildComplete);
|
|
40607
40819
|
}
|
|
40608
40820
|
if (allHandled && config.htmlDirectory && affectedFrameworks.includes("html")) {
|
|
@@ -40634,6 +40846,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
40634
40846
|
throw new Error("Build failed - no manifest generated");
|
|
40635
40847
|
}
|
|
40636
40848
|
const { manifest } = buildResult;
|
|
40849
|
+
await keepReactIndexesOnModuleServer(state, manifest);
|
|
40637
40850
|
if (state.lazyPages && buildResult.pageEntries) {
|
|
40638
40851
|
updateLazyPageRegistry(state.lazyPages.registry, buildResult.pageEntries);
|
|
40639
40852
|
}
|
|
@@ -40712,7 +40925,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
40712
40925
|
const hasFilesToRebuild = filesToRebuild && filesToRebuild.length > 0;
|
|
40713
40926
|
const didReloadForIslandChange = hasFilesToRebuild ? await handleIslandSourceReload(state, config, filesToRebuild, manifest, duration) : false;
|
|
40714
40927
|
if (didReloadForIslandChange) {
|
|
40715
|
-
await
|
|
40928
|
+
const pageFiles = await filterFilesReachingPages(state, config, filesToRebuild ?? []);
|
|
40929
|
+
if (pageFiles.length > 0)
|
|
40930
|
+
await runFrameworkFastPaths(state, config, affectedFrameworks, pageFiles, startTime, onRebuildComplete);
|
|
40716
40931
|
onRebuildComplete({ hmrState: state, manifest });
|
|
40717
40932
|
return manifest;
|
|
40718
40933
|
}
|
|
@@ -41312,7 +41527,7 @@ var init_vendorCache = __esm(() => {
|
|
|
41312
41527
|
|
|
41313
41528
|
// src/core/devBuild.ts
|
|
41314
41529
|
import { readdir as readdir7 } from "fs/promises";
|
|
41315
|
-
import { existsSync as existsSync60, statSync as
|
|
41530
|
+
import { existsSync as existsSync60, statSync as statSync16 } from "fs";
|
|
41316
41531
|
import { resolve as resolve68 } from "path";
|
|
41317
41532
|
var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir, collectDepVendorSourceDirs = (config) => {
|
|
41318
41533
|
const configuredDirs = [
|
|
@@ -41452,7 +41667,7 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir, collectDepVendorSourceDirs = (
|
|
|
41452
41667
|
});
|
|
41453
41668
|
}
|
|
41454
41669
|
}, handleCachedReload = async () => {
|
|
41455
|
-
const serverMtime =
|
|
41670
|
+
const serverMtime = statSync16(resolve68(Bun.main)).mtimeMs;
|
|
41456
41671
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
41457
41672
|
globalThis.__hmrServerMtime = serverMtime;
|
|
41458
41673
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -41833,7 +42048,7 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir, collectDepVendorSourceDirs = (
|
|
|
41833
42048
|
manifest
|
|
41834
42049
|
};
|
|
41835
42050
|
globalThis.__hmrDevResult = result;
|
|
41836
|
-
globalThis.__hmrServerMtime =
|
|
42051
|
+
globalThis.__hmrServerMtime = statSync16(resolve68(Bun.main)).mtimeMs;
|
|
41837
42052
|
return result;
|
|
41838
42053
|
};
|
|
41839
42054
|
var init_devBuild = __esm(() => {
|
|
@@ -41879,5 +42094,5 @@ export {
|
|
|
41879
42094
|
devBuild
|
|
41880
42095
|
};
|
|
41881
42096
|
|
|
41882
|
-
//# debugId=
|
|
42097
|
+
//# debugId=70F4989EE77A073A64756E2164756E21
|
|
41883
42098
|
//# sourceMappingURL=build.js.map
|