@absolutejs/absolute 0.20.0-beta.173 → 0.20.0-beta.174
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 +7 -0
- package/changelog.json +11 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +47 -27
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +47 -27
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +635 -613
- package/dist/build.js.map +25 -24
- package/dist/cli/{add-ae6mg79m.js → add-ntg96znk.js} +32 -31
- package/dist/cli/{compile-ndc36zna.js → compile-n6fs2vmx.js} +16 -14
- package/dist/cli/config/server.js +85 -65
- package/dist/cli/{dev-x49583aj.js → dev-6h1f0mzq.js} +1 -1
- 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-25e7k849.js → index-bhyd3ejc.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-z794p5qg.js → index-mqevg32w.js} +22 -19
- 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-vk05sj6v.js} +5 -4
- package/dist/cli/{mobile-nqdkk3gd.js → mobile-62b6j3j7.js} +5 -4
- package/dist/cli/{remove-abaf0w6k.js → remove-4jh862qa.js} +6 -5
- package/dist/cli/{start-t3cq57wn.js → start-jh6kyp92.js} +5 -4
- package/dist/cli/{typecheck-fag7djt5.js → typecheck-7fvww3b7.js} +28 -26
- package/dist/dev/importCostReport.js +45 -26
- package/dist/index.js +633 -611
- package/dist/index.js.map +25 -24
- package/dist/mobile/index.js +115 -95
- package/dist/mobile/index.js.map +6 -5
- package/dist/mobile/remoteMacAgentEntry.js +205 -651
- 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/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/utils/lazyTypescript.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9248,10 +9248,29 @@ var init_renderIslandMarkup = __esm(() => {
|
|
|
9248
9248
|
resolvedServerBuildComponentCache = new Map;
|
|
9249
9249
|
});
|
|
9250
9250
|
|
|
9251
|
+
// src/utils/lazyTypescript.ts
|
|
9252
|
+
import { createRequire as createRequire2 } from "module";
|
|
9253
|
+
var loaded, loadTypescript = () => {
|
|
9254
|
+
if (loaded)
|
|
9255
|
+
return loaded;
|
|
9256
|
+
const requireFromHere = createRequire2(import.meta.url);
|
|
9257
|
+
const typescript = requireFromHere("typescript");
|
|
9258
|
+
loaded = typescript;
|
|
9259
|
+
return typescript;
|
|
9260
|
+
}, createLazyTypescript = () => {
|
|
9261
|
+
const target = Object.create(null);
|
|
9262
|
+
return new Proxy(target, {
|
|
9263
|
+
get: (_target, key) => Reflect.get(loadTypescript(), key),
|
|
9264
|
+
has: (_target, key) => Reflect.has(loadTypescript(), key)
|
|
9265
|
+
});
|
|
9266
|
+
}, lazyTypescript;
|
|
9267
|
+
var init_lazyTypescript = __esm(() => {
|
|
9268
|
+
lazyTypescript = createLazyTypescript();
|
|
9269
|
+
});
|
|
9270
|
+
|
|
9251
9271
|
// src/build/islandEntries.ts
|
|
9252
9272
|
import { mkdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
9253
9273
|
import { dirname as dirname8, extname as extname4, join as join10, relative as relative5, resolve as resolve8 } from "path";
|
|
9254
|
-
import ts from "typescript";
|
|
9255
9274
|
var frameworks, isRecord8 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
9256
9275
|
if (isRecord8(mod.islandRegistry))
|
|
9257
9276
|
return mod.islandRegistry;
|
|
@@ -9267,7 +9286,7 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9267
9286
|
}
|
|
9268
9287
|
return resolve8(dirname8(registryPath), sourcePath);
|
|
9269
9288
|
}, getObjectPropertyName = (name) => {
|
|
9270
|
-
if (
|
|
9289
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name)) {
|
|
9271
9290
|
return name.text;
|
|
9272
9291
|
}
|
|
9273
9292
|
return null;
|
|
@@ -9280,7 +9299,7 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9280
9299
|
});
|
|
9281
9300
|
}, collectNamedImports = (imports, importClause, source) => {
|
|
9282
9301
|
const bindings = importClause.namedBindings;
|
|
9283
|
-
if (!bindings || !
|
|
9302
|
+
if (!bindings || !lazyTypescript.isNamedImports(bindings))
|
|
9284
9303
|
return;
|
|
9285
9304
|
for (const element of bindings.elements) {
|
|
9286
9305
|
imports.set(element.name.text, {
|
|
@@ -9294,7 +9313,7 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9294
9313
|
const bindings = importClause.namedBindings;
|
|
9295
9314
|
if (!bindings)
|
|
9296
9315
|
return;
|
|
9297
|
-
if (
|
|
9316
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
9298
9317
|
registryNamespaceNames.add(bindings.name.text);
|
|
9299
9318
|
return;
|
|
9300
9319
|
}
|
|
@@ -9312,13 +9331,13 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9312
9331
|
const frameworkRegistry = registry[framework] ?? {};
|
|
9313
9332
|
registry[framework] = frameworkRegistry;
|
|
9314
9333
|
for (const property of frameworkNode.properties) {
|
|
9315
|
-
if (!
|
|
9334
|
+
if (!lazyTypescript.isPropertyAssignment(property) && !lazyTypescript.isShorthandPropertyAssignment(property))
|
|
9316
9335
|
continue;
|
|
9317
9336
|
const componentName = getObjectPropertyName(property.name);
|
|
9318
9337
|
if (!componentName)
|
|
9319
9338
|
continue;
|
|
9320
|
-
const initializer =
|
|
9321
|
-
if (!
|
|
9339
|
+
const initializer = lazyTypescript.isPropertyAssignment(property) ? property.initializer : property.name;
|
|
9340
|
+
if (!lazyTypescript.isIdentifier(initializer))
|
|
9322
9341
|
continue;
|
|
9323
9342
|
const reference = imports.get(initializer.text);
|
|
9324
9343
|
if (!reference)
|
|
@@ -9332,7 +9351,7 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9332
9351
|
}
|
|
9333
9352
|
}, processDefineIslandRegistry = (node, imports, definitions, registry) => {
|
|
9334
9353
|
const [firstArg] = node.arguments;
|
|
9335
|
-
if (!firstArg || !
|
|
9354
|
+
if (!firstArg || !lazyTypescript.isObjectLiteralExpression(firstArg))
|
|
9336
9355
|
return;
|
|
9337
9356
|
const validFrameworks = [
|
|
9338
9357
|
"react",
|
|
@@ -9341,7 +9360,7 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9341
9360
|
"angular"
|
|
9342
9361
|
];
|
|
9343
9362
|
for (const property of firstArg.properties) {
|
|
9344
|
-
if (!
|
|
9363
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
9345
9364
|
continue;
|
|
9346
9365
|
const frameworkName = getObjectPropertyName(property.name);
|
|
9347
9366
|
if (!frameworkName)
|
|
@@ -9349,28 +9368,28 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9349
9368
|
const framework = validFrameworks.find((f) => f === frameworkName);
|
|
9350
9369
|
if (!framework)
|
|
9351
9370
|
continue;
|
|
9352
|
-
if (!
|
|
9371
|
+
if (!lazyTypescript.isObjectLiteralExpression(property.initializer))
|
|
9353
9372
|
continue;
|
|
9354
9373
|
addRegistryEntries(property.initializer, framework, imports, definitions, registry);
|
|
9355
9374
|
}
|
|
9356
9375
|
}, walkRegistryNode = (node, imports, registryFactoryNames, registryNamespaceNames, definitions, registry) => {
|
|
9357
|
-
if (
|
|
9376
|
+
if (lazyTypescript.isCallExpression(node) && isDefineIslandRegistryCall(node.expression, registryFactoryNames, registryNamespaceNames)) {
|
|
9358
9377
|
processDefineIslandRegistry(node, imports, definitions, registry);
|
|
9359
9378
|
}
|
|
9360
|
-
|
|
9379
|
+
lazyTypescript.forEachChild(node, (child) => walkRegistryNode(child, imports, registryFactoryNames, registryNamespaceNames, definitions, registry));
|
|
9361
9380
|
}, isDefineIslandRegistryCall = (expression, registryFactoryNames, registryNamespaceNames) => {
|
|
9362
|
-
if (
|
|
9381
|
+
if (lazyTypescript.isIdentifier(expression)) {
|
|
9363
9382
|
return registryFactoryNames.has(expression.text);
|
|
9364
9383
|
}
|
|
9365
|
-
return
|
|
9384
|
+
return lazyTypescript.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && lazyTypescript.isIdentifier(expression.expression) && registryNamespaceNames.has(expression.expression.text);
|
|
9366
9385
|
}, hasIslandRegistryNamedExport = (sourceFile) => {
|
|
9367
9386
|
for (const statement of sourceFile.statements) {
|
|
9368
|
-
if (
|
|
9387
|
+
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")) {
|
|
9369
9388
|
return true;
|
|
9370
9389
|
}
|
|
9371
|
-
if (!
|
|
9390
|
+
if (!lazyTypescript.isExportDeclaration(statement) || !statement.exportClause)
|
|
9372
9391
|
continue;
|
|
9373
|
-
if (!
|
|
9392
|
+
if (!lazyTypescript.isNamedExports(statement.exportClause))
|
|
9374
9393
|
continue;
|
|
9375
9394
|
if (statement.exportClause.elements.some((element) => element.name.text === "islandRegistry")) {
|
|
9376
9395
|
return true;
|
|
@@ -9379,7 +9398,7 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9379
9398
|
return false;
|
|
9380
9399
|
}, collectImportDeclarations = (sourceFile, registryPath, imports, registryFactoryNames, registryNamespaceNames) => {
|
|
9381
9400
|
for (const statement of sourceFile.statements) {
|
|
9382
|
-
if (!
|
|
9401
|
+
if (!lazyTypescript.isImportDeclaration(statement) || !lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
9383
9402
|
continue;
|
|
9384
9403
|
const { importClause } = statement;
|
|
9385
9404
|
if (!importClause)
|
|
@@ -9390,7 +9409,7 @@ var frameworks, isRecord8 = (value) => typeof value === "object" && value !== nu
|
|
|
9390
9409
|
collectRegistryHelperImports(importClause, statement.moduleSpecifier.text, registryFactoryNames, registryNamespaceNames);
|
|
9391
9410
|
}
|
|
9392
9411
|
}, parseIslandRegistryBuildInfo = (registrySource, registryPath) => {
|
|
9393
|
-
const sourceFile =
|
|
9412
|
+
const sourceFile = lazyTypescript.createSourceFile(registryPath, registrySource, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
9394
9413
|
const imports = new Map;
|
|
9395
9414
|
const registryFactoryNames = new Set(["defineIslandRegistry"]);
|
|
9396
9415
|
const registryNamespaceNames = new Set;
|
|
@@ -9529,6 +9548,7 @@ export default component;
|
|
|
9529
9548
|
};
|
|
9530
9549
|
};
|
|
9531
9550
|
var init_islandEntries = __esm(() => {
|
|
9551
|
+
init_lazyTypescript();
|
|
9532
9552
|
init_islands();
|
|
9533
9553
|
frameworks = ["react", "svelte", "vue", "angular"];
|
|
9534
9554
|
});
|
|
@@ -12599,7 +12619,6 @@ var init_mobilePreview = __esm(() => {
|
|
|
12599
12619
|
import { existsSync as existsSync15, readFileSync as readFileSync18 } from "fs";
|
|
12600
12620
|
import { extname as extname6, join as join18, relative as relative8, resolve as resolve15 } from "path";
|
|
12601
12621
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
12602
|
-
import ts2 from "typescript";
|
|
12603
12622
|
var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES, ADAPTERS, 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) => {
|
|
12604
12623
|
const value = JSON.parse(readFileSync18(path, "utf8"));
|
|
12605
12624
|
if (!object(value))
|
|
@@ -12754,29 +12773,29 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABI
|
|
|
12754
12773
|
const names = new Set;
|
|
12755
12774
|
const namespaces = new Set;
|
|
12756
12775
|
const visit = (node) => {
|
|
12757
|
-
if (
|
|
12776
|
+
if (lazyTypescript.isImportDeclaration(node) && lazyTypescript.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && !node.importClause?.isTypeOnly) {
|
|
12758
12777
|
const bindings = node.importClause?.namedBindings;
|
|
12759
|
-
if (bindings &&
|
|
12778
|
+
if (bindings && lazyTypescript.isNamedImports(bindings)) {
|
|
12760
12779
|
for (const element of bindings.elements)
|
|
12761
12780
|
if (!element.isTypeOnly)
|
|
12762
12781
|
names.add((element.propertyName ?? element.name).text);
|
|
12763
12782
|
}
|
|
12764
|
-
if (bindings &&
|
|
12783
|
+
if (bindings && lazyTypescript.isNamespaceImport(bindings))
|
|
12765
12784
|
namespaces.add(bindings.name.text);
|
|
12766
12785
|
}
|
|
12767
|
-
if (
|
|
12786
|
+
if (lazyTypescript.isExportDeclaration(node) && !node.isTypeOnly && node.moduleSpecifier !== undefined && lazyTypescript.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && node.exportClause && lazyTypescript.isNamedExports(node.exportClause)) {
|
|
12768
12787
|
for (const element of node.exportClause.elements)
|
|
12769
12788
|
if (!element.isTypeOnly)
|
|
12770
12789
|
names.add((element.propertyName ?? element.name).text);
|
|
12771
12790
|
}
|
|
12772
|
-
if (
|
|
12791
|
+
if (lazyTypescript.isPropertyAccessExpression(node) && lazyTypescript.isIdentifier(node.expression) && namespaces.has(node.expression.text))
|
|
12773
12792
|
names.add(node.name.text);
|
|
12774
|
-
|
|
12793
|
+
lazyTypescript.forEachChild(node, visit);
|
|
12775
12794
|
};
|
|
12776
12795
|
const extension = extname6(file).toLowerCase();
|
|
12777
12796
|
const sources = extension === ".svelte" || extension === ".vue" ? [...source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script\s*>/giu)].map((match) => match[1]).filter((value) => value !== undefined) : [source];
|
|
12778
12797
|
for (const [index, script] of sources.entries())
|
|
12779
|
-
visit(
|
|
12798
|
+
visit(lazyTypescript.createSourceFile(`${file}#script-${index}`, script, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TSX));
|
|
12780
12799
|
return names;
|
|
12781
12800
|
}, assertAbsoluteDeviceCapabilityPackages = (projectRoot, plan) => {
|
|
12782
12801
|
const missing = missingAbsoluteDeviceCapabilityPackages(plan, directAbsoluteProjectPackages(projectRoot));
|
|
@@ -12857,6 +12876,7 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABI
|
|
|
12857
12876
|
};
|
|
12858
12877
|
};
|
|
12859
12878
|
var init_deviceCapabilities = __esm(() => {
|
|
12879
|
+
init_lazyTypescript();
|
|
12860
12880
|
ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES = [
|
|
12861
12881
|
"keyboard",
|
|
12862
12882
|
"systemBars"
|
|
@@ -16574,15 +16594,14 @@ var init_missingReactRouter = __esm(() => {
|
|
|
16574
16594
|
// src/build/scanRouteRegistrations.ts
|
|
16575
16595
|
import { readdirSync as readdirSync2, readFileSync as readFileSync26 } from "fs";
|
|
16576
16596
|
import { join as join30 } from "path";
|
|
16577
|
-
import ts3 from "typescript";
|
|
16578
16597
|
var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePath) => {
|
|
16579
16598
|
if (filePath.endsWith(".tsx"))
|
|
16580
|
-
return
|
|
16599
|
+
return lazyTypescript.ScriptKind.TSX;
|
|
16581
16600
|
if (filePath.endsWith(".mts"))
|
|
16582
|
-
return
|
|
16601
|
+
return lazyTypescript.ScriptKind.TS;
|
|
16583
16602
|
if (filePath.endsWith(".cts"))
|
|
16584
|
-
return
|
|
16585
|
-
return
|
|
16603
|
+
return lazyTypescript.ScriptKind.TS;
|
|
16604
|
+
return lazyTypescript.ScriptKind.TS;
|
|
16586
16605
|
}, hasSourceExtension = (filePath) => {
|
|
16587
16606
|
const idx = filePath.lastIndexOf(".");
|
|
16588
16607
|
if (idx === -1)
|
|
@@ -16632,15 +16651,15 @@ var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePat
|
|
|
16632
16651
|
}
|
|
16633
16652
|
if (!fileMayContainRouteRegistrations(source))
|
|
16634
16653
|
return;
|
|
16635
|
-
const sf =
|
|
16654
|
+
const sf = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind(filePath));
|
|
16636
16655
|
const visit = (node) => {
|
|
16637
|
-
if (
|
|
16656
|
+
if (lazyTypescript.isCallExpression(node)) {
|
|
16638
16657
|
const callee = node.expression;
|
|
16639
|
-
if (
|
|
16658
|
+
if (lazyTypescript.isPropertyAccessExpression(callee) && lazyTypescript.isIdentifier(callee.name)) {
|
|
16640
16659
|
const methodName = callee.name.text;
|
|
16641
16660
|
if (ELYSIA_ROUTE_METHODS.has(methodName)) {
|
|
16642
16661
|
const firstArg = node.arguments[0];
|
|
16643
|
-
if (firstArg &&
|
|
16662
|
+
if (firstArg && lazyTypescript.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
16644
16663
|
const argTexts = [];
|
|
16645
16664
|
for (let i = 1;i < node.arguments.length; i++) {
|
|
16646
16665
|
const arg = node.arguments[i];
|
|
@@ -16657,9 +16676,9 @@ var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePat
|
|
|
16657
16676
|
}
|
|
16658
16677
|
}
|
|
16659
16678
|
}
|
|
16660
|
-
|
|
16679
|
+
lazyTypescript.forEachChild(node, visit);
|
|
16661
16680
|
};
|
|
16662
|
-
|
|
16681
|
+
lazyTypescript.forEachChild(sf, visit);
|
|
16663
16682
|
}, scanRouteRegistrations = (projectRoot) => {
|
|
16664
16683
|
const files = collectSourceFiles(projectRoot);
|
|
16665
16684
|
const collected = [];
|
|
@@ -16669,6 +16688,7 @@ var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePat
|
|
|
16669
16688
|
return collected;
|
|
16670
16689
|
};
|
|
16671
16690
|
var init_scanRouteRegistrations = __esm(() => {
|
|
16691
|
+
init_lazyTypescript();
|
|
16672
16692
|
ELYSIA_ROUTE_METHODS = new Set([
|
|
16673
16693
|
"all",
|
|
16674
16694
|
"delete",
|
|
@@ -16832,17 +16852,16 @@ var init_routing = __esm(() => {
|
|
|
16832
16852
|
// src/angular/staticAnalyzeSpaRoutes.ts
|
|
16833
16853
|
import { existsSync as existsSync24, promises as fs } from "fs";
|
|
16834
16854
|
import { join as join31 } from "path";
|
|
16835
|
-
import ts4 from "typescript";
|
|
16836
16855
|
var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN.test(seg) || seg === "**"), importsSymbolFrom = (sourceFile, localName, moduleSpecifier) => {
|
|
16837
16856
|
for (const statement of sourceFile.statements) {
|
|
16838
|
-
if (!
|
|
16857
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
16839
16858
|
continue;
|
|
16840
|
-
if (!
|
|
16859
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
16841
16860
|
continue;
|
|
16842
16861
|
if (statement.moduleSpecifier.text !== moduleSpecifier)
|
|
16843
16862
|
continue;
|
|
16844
16863
|
const named = statement.importClause?.namedBindings;
|
|
16845
|
-
if (!named || !
|
|
16864
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
16846
16865
|
continue;
|
|
16847
16866
|
for (const element of named.elements) {
|
|
16848
16867
|
if (element.name.text === localName)
|
|
@@ -16851,17 +16870,17 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
16851
16870
|
}
|
|
16852
16871
|
return false;
|
|
16853
16872
|
}, readStringLiteral = (expression) => {
|
|
16854
|
-
if (
|
|
16873
|
+
if (lazyTypescript.isStringLiteral(expression) || lazyTypescript.isNoSubstitutionTemplateLiteral(expression)) {
|
|
16855
16874
|
return expression.text;
|
|
16856
16875
|
}
|
|
16857
16876
|
return null;
|
|
16858
16877
|
}, readPropertyKey = (property) => {
|
|
16859
|
-
if (
|
|
16878
|
+
if (lazyTypescript.isPropertyAssignment(property)) {
|
|
16860
16879
|
const { name } = property;
|
|
16861
|
-
if (
|
|
16880
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name))
|
|
16862
16881
|
return name.text;
|
|
16863
16882
|
}
|
|
16864
|
-
if (
|
|
16883
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
16865
16884
|
return property.name.text;
|
|
16866
16885
|
}
|
|
16867
16886
|
return null;
|
|
@@ -16870,20 +16889,20 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
16870
16889
|
const visit = (node) => {
|
|
16871
16890
|
if (found)
|
|
16872
16891
|
return;
|
|
16873
|
-
if (
|
|
16892
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && lazyTypescript.isArrayLiteralExpression(node.initializer)) {
|
|
16874
16893
|
found = node.initializer;
|
|
16875
16894
|
return;
|
|
16876
16895
|
}
|
|
16877
|
-
|
|
16896
|
+
lazyTypescript.forEachChild(node, visit);
|
|
16878
16897
|
};
|
|
16879
|
-
|
|
16898
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
16880
16899
|
return found;
|
|
16881
16900
|
}, extractSitemapData = (dataLiteral) => {
|
|
16882
16901
|
for (const prop of dataLiteral.properties) {
|
|
16883
16902
|
const key = readPropertyKey(prop);
|
|
16884
16903
|
if (key !== "sitemap")
|
|
16885
16904
|
continue;
|
|
16886
|
-
if (!
|
|
16905
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
16887
16906
|
continue;
|
|
16888
16907
|
const value = readStringLiteral(prop.initializer);
|
|
16889
16908
|
if (value === "exclude")
|
|
@@ -16898,7 +16917,7 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
16898
16917
|
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
16899
16918
|
}, extractRoutePaths = (routeArray, parentPath, parentExcluded, routes) => {
|
|
16900
16919
|
for (const element of routeArray.elements) {
|
|
16901
|
-
if (!
|
|
16920
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
16902
16921
|
continue;
|
|
16903
16922
|
let pathSegment = null;
|
|
16904
16923
|
let redirected = false;
|
|
@@ -16908,16 +16927,16 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
16908
16927
|
const key = readPropertyKey(property);
|
|
16909
16928
|
if (!key)
|
|
16910
16929
|
continue;
|
|
16911
|
-
if (!
|
|
16930
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
16912
16931
|
continue;
|
|
16913
16932
|
if (key === "path") {
|
|
16914
16933
|
pathSegment = readStringLiteral(property.initializer);
|
|
16915
16934
|
} else if (key === "redirectTo") {
|
|
16916
16935
|
redirected = true;
|
|
16917
|
-
} else if (key === "data" &&
|
|
16936
|
+
} else if (key === "data" && lazyTypescript.isObjectLiteralExpression(property.initializer)) {
|
|
16918
16937
|
if (extractSitemapData(property.initializer))
|
|
16919
16938
|
sitemapExcluded = true;
|
|
16920
|
-
} else if (key === "children" &&
|
|
16939
|
+
} else if (key === "children" && lazyTypescript.isArrayLiteralExpression(property.initializer)) {
|
|
16921
16940
|
childrenLiteral = property.initializer;
|
|
16922
16941
|
}
|
|
16923
16942
|
}
|
|
@@ -16942,29 +16961,29 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
16942
16961
|
const visit = (node) => {
|
|
16943
16962
|
if (result.found)
|
|
16944
16963
|
return;
|
|
16945
|
-
if (
|
|
16964
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "provideRouter") {
|
|
16946
16965
|
result.found = node.arguments[0] ?? null;
|
|
16947
16966
|
return;
|
|
16948
16967
|
}
|
|
16949
|
-
|
|
16968
|
+
lazyTypescript.forEachChild(node, visit);
|
|
16950
16969
|
};
|
|
16951
|
-
|
|
16970
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
16952
16971
|
return result.found;
|
|
16953
16972
|
}, findAppBaseHrefValue = (sourceFile) => {
|
|
16954
16973
|
let found = null;
|
|
16955
16974
|
const visit = (node) => {
|
|
16956
16975
|
if (found)
|
|
16957
16976
|
return;
|
|
16958
|
-
if (
|
|
16977
|
+
if (lazyTypescript.isObjectLiteralExpression(node)) {
|
|
16959
16978
|
let isAppBaseHref = false;
|
|
16960
16979
|
let value = null;
|
|
16961
16980
|
for (const property of node.properties) {
|
|
16962
16981
|
const key = readPropertyKey(property);
|
|
16963
16982
|
if (!key)
|
|
16964
16983
|
continue;
|
|
16965
|
-
if (!
|
|
16984
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
16966
16985
|
continue;
|
|
16967
|
-
if (key === "provide" &&
|
|
16986
|
+
if (key === "provide" && lazyTypescript.isIdentifier(property.initializer) && property.initializer.text === "APP_BASE_HREF") {
|
|
16968
16987
|
isAppBaseHref = true;
|
|
16969
16988
|
} else if (key === "useValue") {
|
|
16970
16989
|
value = readStringLiteral(property.initializer);
|
|
@@ -16975,9 +16994,9 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
16975
16994
|
return;
|
|
16976
16995
|
}
|
|
16977
16996
|
}
|
|
16978
|
-
|
|
16997
|
+
lazyTypescript.forEachChild(node, visit);
|
|
16979
16998
|
};
|
|
16980
|
-
|
|
16999
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
16981
17000
|
return found;
|
|
16982
17001
|
}, analyzeFile = async (filePath) => {
|
|
16983
17002
|
let source;
|
|
@@ -16989,7 +17008,7 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
16989
17008
|
if (!source.includes("APP_BASE_HREF") || !source.includes("provideRouter")) {
|
|
16990
17009
|
return null;
|
|
16991
17010
|
}
|
|
16992
|
-
const sourceFile =
|
|
17011
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
16993
17012
|
if (!importsSymbolFrom(sourceFile, "APP_BASE_HREF", "@angular/common"))
|
|
16994
17013
|
return null;
|
|
16995
17014
|
if (!importsSymbolFrom(sourceFile, "provideRouter", "@angular/router"))
|
|
@@ -17001,9 +17020,9 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
17001
17020
|
if (!firstArg)
|
|
17002
17021
|
return null;
|
|
17003
17022
|
let routesArray = null;
|
|
17004
|
-
if (
|
|
17023
|
+
if (lazyTypescript.isIdentifier(firstArg)) {
|
|
17005
17024
|
routesArray = findRoutesArrayDeclaration(sourceFile, firstArg.text);
|
|
17006
|
-
} else if (
|
|
17025
|
+
} else if (lazyTypescript.isArrayLiteralExpression(firstArg)) {
|
|
17007
17026
|
routesArray = firstArg;
|
|
17008
17027
|
}
|
|
17009
17028
|
if (!routesArray)
|
|
@@ -17054,38 +17073,38 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
17054
17073
|
return pages;
|
|
17055
17074
|
};
|
|
17056
17075
|
var init_staticAnalyzeSpaRoutes = __esm(() => {
|
|
17076
|
+
init_lazyTypescript();
|
|
17057
17077
|
DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
|
|
17058
17078
|
});
|
|
17059
17079
|
|
|
17060
17080
|
// src/react/staticAnalyzeSpaRoutes.ts
|
|
17061
17081
|
import { existsSync as existsSync25, promises as fs2 } from "fs";
|
|
17062
17082
|
import { join as join32 } from "path";
|
|
17063
|
-
import ts5 from "typescript";
|
|
17064
17083
|
var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN2.test(seg) || seg === "**"), readStringLiteral2 = (expression) => {
|
|
17065
|
-
if (
|
|
17084
|
+
if (lazyTypescript.isStringLiteral(expression) || lazyTypescript.isNoSubstitutionTemplateLiteral(expression)) {
|
|
17066
17085
|
return expression.text;
|
|
17067
17086
|
}
|
|
17068
17087
|
return null;
|
|
17069
17088
|
}, readPropertyKey2 = (property) => {
|
|
17070
|
-
if (
|
|
17089
|
+
if (lazyTypescript.isPropertyAssignment(property)) {
|
|
17071
17090
|
const { name } = property;
|
|
17072
|
-
if (
|
|
17091
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name))
|
|
17073
17092
|
return name.text;
|
|
17074
17093
|
}
|
|
17075
|
-
if (
|
|
17094
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
17076
17095
|
return property.name.text;
|
|
17077
17096
|
}
|
|
17078
17097
|
return null;
|
|
17079
17098
|
}, importsSymbolFromAny = (sourceFile, localName, moduleSpecifiers) => {
|
|
17080
17099
|
for (const statement of sourceFile.statements) {
|
|
17081
|
-
if (!
|
|
17100
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
17082
17101
|
continue;
|
|
17083
|
-
if (!
|
|
17102
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
17084
17103
|
continue;
|
|
17085
17104
|
if (!moduleSpecifiers.includes(statement.moduleSpecifier.text))
|
|
17086
17105
|
continue;
|
|
17087
17106
|
const named = statement.importClause?.namedBindings;
|
|
17088
|
-
if (!named || !
|
|
17107
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
17089
17108
|
continue;
|
|
17090
17109
|
for (const element of named.elements) {
|
|
17091
17110
|
if (element.name.text === localName)
|
|
@@ -17098,13 +17117,13 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
17098
17117
|
const visit = (node) => {
|
|
17099
17118
|
if (found)
|
|
17100
17119
|
return;
|
|
17101
|
-
if (
|
|
17120
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && lazyTypescript.isArrayLiteralExpression(node.initializer)) {
|
|
17102
17121
|
found = node.initializer;
|
|
17103
17122
|
return;
|
|
17104
17123
|
}
|
|
17105
|
-
|
|
17124
|
+
lazyTypescript.forEachChild(node, visit);
|
|
17106
17125
|
};
|
|
17107
|
-
|
|
17126
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
17108
17127
|
return found;
|
|
17109
17128
|
}, joinSegments2 = (parent, child) => {
|
|
17110
17129
|
if (!child)
|
|
@@ -17114,7 +17133,7 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
17114
17133
|
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
17115
17134
|
}, extractRouteEntries = (routeArray, parentPath, routes) => {
|
|
17116
17135
|
for (const element of routeArray.elements) {
|
|
17117
|
-
if (!
|
|
17136
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
17118
17137
|
continue;
|
|
17119
17138
|
let pathSegment = null;
|
|
17120
17139
|
let redirected = false;
|
|
@@ -17125,22 +17144,22 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
17125
17144
|
const key = readPropertyKey2(property);
|
|
17126
17145
|
if (!key)
|
|
17127
17146
|
continue;
|
|
17128
|
-
if (!
|
|
17147
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
17129
17148
|
continue;
|
|
17130
17149
|
if (key === "path") {
|
|
17131
17150
|
pathSegment = readStringLiteral2(property.initializer);
|
|
17132
17151
|
} else if (key === "index") {
|
|
17133
17152
|
isIndex = true;
|
|
17134
|
-
} else if (key === "loader" || key === "lazy") {} else if (key === "children" &&
|
|
17153
|
+
} else if (key === "loader" || key === "lazy") {} else if (key === "children" && lazyTypescript.isArrayLiteralExpression(property.initializer)) {
|
|
17135
17154
|
childrenLiteral = property.initializer;
|
|
17136
17155
|
} else if (key === "redirectTo") {
|
|
17137
17156
|
redirected = true;
|
|
17138
|
-
} else if (key === "handle" &&
|
|
17157
|
+
} else if (key === "handle" && lazyTypescript.isObjectLiteralExpression(property.initializer)) {
|
|
17139
17158
|
for (const handleProp of property.initializer.properties) {
|
|
17140
17159
|
const handleKey = readPropertyKey2(handleProp);
|
|
17141
17160
|
if (handleKey !== "sitemap")
|
|
17142
17161
|
continue;
|
|
17143
|
-
if (!
|
|
17162
|
+
if (!lazyTypescript.isPropertyAssignment(handleProp))
|
|
17144
17163
|
continue;
|
|
17145
17164
|
const value = readStringLiteral2(handleProp.initializer);
|
|
17146
17165
|
if (value === "exclude")
|
|
@@ -17170,22 +17189,22 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
17170
17189
|
const visit = (node) => {
|
|
17171
17190
|
if (result.found)
|
|
17172
17191
|
return;
|
|
17173
|
-
if (
|
|
17192
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "createBrowserRouter") {
|
|
17174
17193
|
result.found = node;
|
|
17175
17194
|
return;
|
|
17176
17195
|
}
|
|
17177
|
-
|
|
17196
|
+
lazyTypescript.forEachChild(node, visit);
|
|
17178
17197
|
};
|
|
17179
|
-
|
|
17198
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
17180
17199
|
return result.found;
|
|
17181
17200
|
}, readBasenameFromOptions = (expression) => {
|
|
17182
|
-
if (!expression || !
|
|
17201
|
+
if (!expression || !lazyTypescript.isObjectLiteralExpression(expression))
|
|
17183
17202
|
return null;
|
|
17184
17203
|
for (const property of expression.properties) {
|
|
17185
17204
|
const key = readPropertyKey2(property);
|
|
17186
17205
|
if (key !== "basename")
|
|
17187
17206
|
continue;
|
|
17188
|
-
if (!
|
|
17207
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
17189
17208
|
continue;
|
|
17190
17209
|
const value = readStringLiteral2(property.initializer);
|
|
17191
17210
|
if (value !== null)
|
|
@@ -17201,7 +17220,7 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
17201
17220
|
}
|
|
17202
17221
|
if (!source.includes("createBrowserRouter"))
|
|
17203
17222
|
return null;
|
|
17204
|
-
const sourceFile =
|
|
17223
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, filePath.endsWith(".tsx") ? lazyTypescript.ScriptKind.TSX : lazyTypescript.ScriptKind.TS);
|
|
17205
17224
|
if (!importsSymbolFromAny(sourceFile, "createBrowserRouter", [
|
|
17206
17225
|
"react-router-dom",
|
|
17207
17226
|
"react-router"
|
|
@@ -17215,9 +17234,9 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
17215
17234
|
if (!routesArg)
|
|
17216
17235
|
return null;
|
|
17217
17236
|
let routesArray = null;
|
|
17218
|
-
if (
|
|
17237
|
+
if (lazyTypescript.isArrayLiteralExpression(routesArg)) {
|
|
17219
17238
|
routesArray = routesArg;
|
|
17220
|
-
} else if (
|
|
17239
|
+
} else if (lazyTypescript.isIdentifier(routesArg)) {
|
|
17221
17240
|
routesArray = findVariableArrayDeclaration(sourceFile, routesArg.text);
|
|
17222
17241
|
}
|
|
17223
17242
|
if (!routesArray)
|
|
@@ -17264,6 +17283,7 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
17264
17283
|
return hosts;
|
|
17265
17284
|
};
|
|
17266
17285
|
var init_staticAnalyzeSpaRoutes2 = __esm(() => {
|
|
17286
|
+
init_lazyTypescript();
|
|
17267
17287
|
DYNAMIC_SEGMENT_PATTERN2 = /^[:*]/;
|
|
17268
17288
|
});
|
|
17269
17289
|
|
|
@@ -17399,32 +17419,31 @@ var init_staticAnalyzeSpaRoutes3 = __esm(() => {
|
|
|
17399
17419
|
// src/vue/staticAnalyzeSpaRoutes.ts
|
|
17400
17420
|
import { existsSync as existsSync27, promises as fs4 } from "fs";
|
|
17401
17421
|
import { join as join34 } from "path";
|
|
17402
|
-
import ts6 from "typescript";
|
|
17403
17422
|
var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN4.test(seg) || seg === "**"), readStringLiteral3 = (expression) => {
|
|
17404
|
-
if (
|
|
17423
|
+
if (lazyTypescript.isStringLiteral(expression) || lazyTypescript.isNoSubstitutionTemplateLiteral(expression)) {
|
|
17405
17424
|
return expression.text;
|
|
17406
17425
|
}
|
|
17407
17426
|
return null;
|
|
17408
17427
|
}, readPropertyKey3 = (property) => {
|
|
17409
|
-
if (
|
|
17428
|
+
if (lazyTypescript.isPropertyAssignment(property)) {
|
|
17410
17429
|
const { name } = property;
|
|
17411
|
-
if (
|
|
17430
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name))
|
|
17412
17431
|
return name.text;
|
|
17413
17432
|
}
|
|
17414
|
-
if (
|
|
17433
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
17415
17434
|
return property.name.text;
|
|
17416
17435
|
}
|
|
17417
17436
|
return null;
|
|
17418
17437
|
}, importsSymbolFrom2 = (sourceFile, localName, moduleSpecifier) => {
|
|
17419
17438
|
for (const statement of sourceFile.statements) {
|
|
17420
|
-
if (!
|
|
17439
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
17421
17440
|
continue;
|
|
17422
|
-
if (!
|
|
17441
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
17423
17442
|
continue;
|
|
17424
17443
|
if (statement.moduleSpecifier.text !== moduleSpecifier)
|
|
17425
17444
|
continue;
|
|
17426
17445
|
const named = statement.importClause?.namedBindings;
|
|
17427
|
-
if (!named || !
|
|
17446
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
17428
17447
|
continue;
|
|
17429
17448
|
for (const element of named.elements) {
|
|
17430
17449
|
if (element.name.text === localName)
|
|
@@ -17437,13 +17456,13 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17437
17456
|
const visit = (node) => {
|
|
17438
17457
|
if (found)
|
|
17439
17458
|
return;
|
|
17440
|
-
if (
|
|
17459
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && lazyTypescript.isArrayLiteralExpression(node.initializer)) {
|
|
17441
17460
|
found = node.initializer;
|
|
17442
17461
|
return;
|
|
17443
17462
|
}
|
|
17444
|
-
|
|
17463
|
+
lazyTypescript.forEachChild(node, visit);
|
|
17445
17464
|
};
|
|
17446
|
-
|
|
17465
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
17447
17466
|
return found;
|
|
17448
17467
|
}, joinSegments4 = (parent, child) => {
|
|
17449
17468
|
if (!child)
|
|
@@ -17453,7 +17472,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17453
17472
|
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
17454
17473
|
}, extractRouteEntries2 = (routeArray, parentPath, routes) => {
|
|
17455
17474
|
for (const element of routeArray.elements) {
|
|
17456
|
-
if (!
|
|
17475
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
17457
17476
|
continue;
|
|
17458
17477
|
let pathSegment = null;
|
|
17459
17478
|
let redirected = false;
|
|
@@ -17464,7 +17483,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17464
17483
|
const key = readPropertyKey3(property);
|
|
17465
17484
|
if (!key)
|
|
17466
17485
|
continue;
|
|
17467
|
-
if (!
|
|
17486
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
17468
17487
|
continue;
|
|
17469
17488
|
if (key === "path") {
|
|
17470
17489
|
pathSegment = readStringLiteral3(property.initializer);
|
|
@@ -17472,14 +17491,14 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17472
17491
|
alias = readStringLiteral3(property.initializer);
|
|
17473
17492
|
} else if (key === "redirect") {
|
|
17474
17493
|
redirected = true;
|
|
17475
|
-
} else if (key === "children" &&
|
|
17494
|
+
} else if (key === "children" && lazyTypescript.isArrayLiteralExpression(property.initializer)) {
|
|
17476
17495
|
childrenLiteral = property.initializer;
|
|
17477
|
-
} else if (key === "meta" &&
|
|
17496
|
+
} else if (key === "meta" && lazyTypescript.isObjectLiteralExpression(property.initializer)) {
|
|
17478
17497
|
for (const metaProp of property.initializer.properties) {
|
|
17479
17498
|
const metaKey = readPropertyKey3(metaProp);
|
|
17480
17499
|
if (metaKey !== "sitemap")
|
|
17481
17500
|
continue;
|
|
17482
|
-
if (!
|
|
17501
|
+
if (!lazyTypescript.isPropertyAssignment(metaProp))
|
|
17483
17502
|
continue;
|
|
17484
17503
|
const value = readStringLiteral3(metaProp.initializer);
|
|
17485
17504
|
if (value === "exclude")
|
|
@@ -17516,16 +17535,16 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17516
17535
|
const visit = (node) => {
|
|
17517
17536
|
if (found)
|
|
17518
17537
|
return;
|
|
17519
|
-
if (
|
|
17538
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "defineRoutes") {
|
|
17520
17539
|
const [routesArgument] = node.arguments;
|
|
17521
|
-
if (!routesArgument || !
|
|
17540
|
+
if (!routesArgument || !lazyTypescript.isArrayLiteralExpression(routesArgument))
|
|
17522
17541
|
return;
|
|
17523
17542
|
found = routesArgument;
|
|
17524
17543
|
return;
|
|
17525
17544
|
}
|
|
17526
|
-
|
|
17545
|
+
lazyTypescript.forEachChild(node, visit);
|
|
17527
17546
|
};
|
|
17528
|
-
|
|
17547
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
17529
17548
|
return found;
|
|
17530
17549
|
}, inferBaseHref = (routes) => {
|
|
17531
17550
|
const firstSegments = routes.map((route) => route.path.split("/").filter(Boolean)[0]).filter((segment) => Boolean(segment));
|
|
@@ -17538,20 +17557,20 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17538
17557
|
const visit = (node) => {
|
|
17539
17558
|
if (result.found)
|
|
17540
17559
|
return;
|
|
17541
|
-
if (
|
|
17560
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "createRouter") {
|
|
17542
17561
|
result.found = node;
|
|
17543
17562
|
return;
|
|
17544
17563
|
}
|
|
17545
|
-
|
|
17564
|
+
lazyTypescript.forEachChild(node, visit);
|
|
17546
17565
|
};
|
|
17547
|
-
|
|
17566
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
17548
17567
|
return result.found;
|
|
17549
17568
|
}, findCreateWebHistoryBase = (sourceFile) => {
|
|
17550
17569
|
let found = null;
|
|
17551
17570
|
const visit = (node) => {
|
|
17552
17571
|
if (found)
|
|
17553
17572
|
return;
|
|
17554
|
-
if (
|
|
17573
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && (node.expression.text === "createWebHistory" || node.expression.text === "createWebHashHistory")) {
|
|
17555
17574
|
const [baseArg] = node.arguments;
|
|
17556
17575
|
if (baseArg) {
|
|
17557
17576
|
const text = readStringLiteral3(baseArg);
|
|
@@ -17564,26 +17583,26 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17564
17583
|
return;
|
|
17565
17584
|
}
|
|
17566
17585
|
}
|
|
17567
|
-
|
|
17586
|
+
lazyTypescript.forEachChild(node, visit);
|
|
17568
17587
|
};
|
|
17569
|
-
|
|
17588
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
17570
17589
|
return found;
|
|
17571
17590
|
}, readRoutesFromCreateRouterOptions = (sourceFile, optionsExpr) => {
|
|
17572
|
-
if (!
|
|
17591
|
+
if (!lazyTypescript.isObjectLiteralExpression(optionsExpr))
|
|
17573
17592
|
return null;
|
|
17574
17593
|
for (const property of optionsExpr.properties) {
|
|
17575
17594
|
const key = readPropertyKey3(property);
|
|
17576
17595
|
if (key !== "routes")
|
|
17577
17596
|
continue;
|
|
17578
|
-
if (
|
|
17597
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
17579
17598
|
return findVariableArrayDeclaration2(sourceFile, property.name.text);
|
|
17580
17599
|
}
|
|
17581
|
-
if (!
|
|
17600
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
17582
17601
|
continue;
|
|
17583
|
-
if (
|
|
17602
|
+
if (lazyTypescript.isArrayLiteralExpression(property.initializer)) {
|
|
17584
17603
|
return property.initializer;
|
|
17585
17604
|
}
|
|
17586
|
-
if (
|
|
17605
|
+
if (lazyTypescript.isIdentifier(property.initializer)) {
|
|
17587
17606
|
return findVariableArrayDeclaration2(sourceFile, property.initializer.text);
|
|
17588
17607
|
}
|
|
17589
17608
|
}
|
|
@@ -17608,7 +17627,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17608
17627
|
}
|
|
17609
17628
|
if (!analysisSource.includes("createRouter") && !analysisSource.includes("defineRoutes"))
|
|
17610
17629
|
return null;
|
|
17611
|
-
const sourceFile =
|
|
17630
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, analysisSource, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
17612
17631
|
const defineRoutesArray = findDefineRoutesArray(sourceFile);
|
|
17613
17632
|
const call = importsSymbolFrom2(sourceFile, "createRouter", "vue-router") ? findCreateRouterCall(sourceFile) : null;
|
|
17614
17633
|
const [optionsArg] = call?.arguments ?? [];
|
|
@@ -17657,6 +17676,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
17657
17676
|
return hosts;
|
|
17658
17677
|
};
|
|
17659
17678
|
var init_staticAnalyzeSpaRoutes4 = __esm(() => {
|
|
17679
|
+
init_lazyTypescript();
|
|
17660
17680
|
DYNAMIC_SEGMENT_PATTERN4 = /^[:*]/;
|
|
17661
17681
|
});
|
|
17662
17682
|
|
|
@@ -18863,15 +18883,14 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
18863
18883
|
|
|
18864
18884
|
// src/build/bunStringRawUnicodePlugin.ts
|
|
18865
18885
|
import { extname as extname14 } from "path";
|
|
18866
|
-
import ts7 from "typescript";
|
|
18867
18886
|
var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
18868
18887
|
if (/\.[cm]?tsx$/.test(filePath))
|
|
18869
|
-
return
|
|
18888
|
+
return lazyTypescript.ScriptKind.TSX;
|
|
18870
18889
|
if (/\.[cm]?jsx$/.test(filePath))
|
|
18871
|
-
return
|
|
18890
|
+
return lazyTypescript.ScriptKind.JSX;
|
|
18872
18891
|
if (/\.[cm]?ts$/.test(filePath))
|
|
18873
|
-
return
|
|
18874
|
-
return
|
|
18892
|
+
return lazyTypescript.ScriptKind.TS;
|
|
18893
|
+
return lazyTypescript.ScriptKind.JS;
|
|
18875
18894
|
}, getLoader = (filePath) => {
|
|
18876
18895
|
const extension = extname14(filePath);
|
|
18877
18896
|
if (extension === ".tsx")
|
|
@@ -18882,19 +18901,19 @@ var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
|
18882
18901
|
return "ts";
|
|
18883
18902
|
}
|
|
18884
18903
|
return "js";
|
|
18885
|
-
}, isStringRawTag = (node) =>
|
|
18904
|
+
}, 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") => {
|
|
18886
18905
|
if (!source.includes("String.raw") || !NON_ASCII.test(source))
|
|
18887
18906
|
return source;
|
|
18888
|
-
const sourceFile =
|
|
18907
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind2(filePath));
|
|
18889
18908
|
const replacements = [];
|
|
18890
18909
|
const visit = (node) => {
|
|
18891
|
-
if (
|
|
18892
|
-
const rawSegments =
|
|
18910
|
+
if (lazyTypescript.isTaggedTemplateExpression(node) && isStringRawTag(node)) {
|
|
18911
|
+
const rawSegments = lazyTypescript.isNoSubstitutionTemplateLiteral(node.template) ? [getRawText(node.template)] : [
|
|
18893
18912
|
getRawText(node.template.head),
|
|
18894
18913
|
...node.template.templateSpans.map((span) => getRawText(span.literal))
|
|
18895
18914
|
];
|
|
18896
18915
|
if (rawSegments.some((segment) => NON_ASCII.test(segment))) {
|
|
18897
|
-
const expressions =
|
|
18916
|
+
const expressions = lazyTypescript.isTemplateExpression(node.template) ? node.template.templateSpans.map((span) => {
|
|
18898
18917
|
const expression = source.slice(span.expression.getStart(sourceFile), span.expression.end);
|
|
18899
18918
|
return rewriteBunStringRawUnicode(expression, filePath);
|
|
18900
18919
|
}) : [];
|
|
@@ -18910,7 +18929,7 @@ var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
|
18910
18929
|
return;
|
|
18911
18930
|
}
|
|
18912
18931
|
}
|
|
18913
|
-
|
|
18932
|
+
lazyTypescript.forEachChild(node, visit);
|
|
18914
18933
|
};
|
|
18915
18934
|
visit(sourceFile);
|
|
18916
18935
|
let result = source;
|
|
@@ -18933,6 +18952,7 @@ var NON_ASCII, getScriptKind2 = (filePath) => {
|
|
|
18933
18952
|
}
|
|
18934
18953
|
});
|
|
18935
18954
|
var init_bunStringRawUnicodePlugin = __esm(() => {
|
|
18955
|
+
init_lazyTypescript();
|
|
18936
18956
|
NON_ASCII = /[^\x00-\x7f]/;
|
|
18937
18957
|
});
|
|
18938
18958
|
|
|
@@ -18977,25 +18997,24 @@ var init_externalAssetPlugin = () => {};
|
|
|
18977
18997
|
|
|
18978
18998
|
// src/build/islandRegistryTransform.ts
|
|
18979
18999
|
import { basename as basename12 } from "path";
|
|
18980
|
-
|
|
18981
|
-
var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name) || ts8.isStringLiteral(name) ? name.text : null, isIslandRegistryHelperImport2 = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands"), collectRegistryFactory = (sourceFile) => {
|
|
19000
|
+
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) => {
|
|
18982
19001
|
const factoryNames = new Set;
|
|
18983
19002
|
const namespaceNames = new Set;
|
|
18984
19003
|
for (const statement of sourceFile.statements) {
|
|
18985
|
-
if (!
|
|
19004
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
18986
19005
|
continue;
|
|
18987
|
-
if (!
|
|
19006
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
18988
19007
|
continue;
|
|
18989
19008
|
if (!isIslandRegistryHelperImport2(statement.moduleSpecifier.text))
|
|
18990
19009
|
continue;
|
|
18991
19010
|
const bindings = statement.importClause?.namedBindings;
|
|
18992
19011
|
if (!bindings)
|
|
18993
19012
|
continue;
|
|
18994
|
-
if (
|
|
19013
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
18995
19014
|
namespaceNames.add(bindings.name.text);
|
|
18996
19015
|
continue;
|
|
18997
19016
|
}
|
|
18998
|
-
if (!
|
|
19017
|
+
if (!lazyTypescript.isNamedImports(bindings))
|
|
18999
19018
|
continue;
|
|
19000
19019
|
for (const element of bindings.elements) {
|
|
19001
19020
|
const imported = element.propertyName?.text ?? element.name.text;
|
|
@@ -19006,20 +19025,20 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name)
|
|
|
19006
19025
|
}
|
|
19007
19026
|
return { factoryNames, namespaceNames };
|
|
19008
19027
|
}, isDefineIslandRegistryCall2 = (expression, factoryNames, namespaceNames) => {
|
|
19009
|
-
if (
|
|
19028
|
+
if (lazyTypescript.isIdentifier(expression))
|
|
19010
19029
|
return factoryNames.has(expression.text);
|
|
19011
|
-
return
|
|
19030
|
+
return lazyTypescript.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && lazyTypescript.isIdentifier(expression.expression) && namespaceNames.has(expression.expression.text);
|
|
19012
19031
|
}, findDefineIslandRegistryCall = (sourceFile, factoryNames, namespaceNames) => {
|
|
19013
19032
|
let found = null;
|
|
19014
19033
|
const visit = (node) => {
|
|
19015
19034
|
if (found)
|
|
19016
19035
|
return;
|
|
19017
|
-
const [firstArg] =
|
|
19018
|
-
if (
|
|
19036
|
+
const [firstArg] = lazyTypescript.isCallExpression(node) ? node.arguments : [];
|
|
19037
|
+
if (lazyTypescript.isCallExpression(node) && isDefineIslandRegistryCall2(node.expression, factoryNames, namespaceNames) && firstArg && lazyTypescript.isObjectLiteralExpression(firstArg)) {
|
|
19019
19038
|
found = node;
|
|
19020
19039
|
return;
|
|
19021
19040
|
}
|
|
19022
|
-
|
|
19041
|
+
lazyTypescript.forEachChild(node, visit);
|
|
19023
19042
|
};
|
|
19024
19043
|
visit(sourceFile);
|
|
19025
19044
|
return found;
|
|
@@ -19029,8 +19048,8 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name)
|
|
|
19029
19048
|
}, transformIslandRegistrySource = (source, filePath, info) => {
|
|
19030
19049
|
if (!source.includes("defineIslandRegistry"))
|
|
19031
19050
|
return null;
|
|
19032
|
-
const scriptKind = filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ?
|
|
19033
|
-
const sourceFile =
|
|
19051
|
+
const scriptKind = filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ? lazyTypescript.ScriptKind.TSX : lazyTypescript.ScriptKind.TS;
|
|
19052
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, scriptKind);
|
|
19034
19053
|
const { factoryNames, namespaceNames } = collectRegistryFactory(sourceFile);
|
|
19035
19054
|
if (factoryNames.size === 0 && namespaceNames.size === 0)
|
|
19036
19055
|
return null;
|
|
@@ -19038,7 +19057,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name)
|
|
|
19038
19057
|
if (!call)
|
|
19039
19058
|
return null;
|
|
19040
19059
|
const [objectLiteral] = call.arguments;
|
|
19041
|
-
if (!objectLiteral || !
|
|
19060
|
+
if (!objectLiteral || !lazyTypescript.isObjectLiteralExpression(objectLiteral)) {
|
|
19042
19061
|
return null;
|
|
19043
19062
|
}
|
|
19044
19063
|
const definitionLookup = new Map;
|
|
@@ -19053,20 +19072,20 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name)
|
|
|
19053
19072
|
const edits = [];
|
|
19054
19073
|
const replacedLocals = new Set;
|
|
19055
19074
|
for (const frameworkProperty of objectLiteral.properties) {
|
|
19056
|
-
if (!
|
|
19075
|
+
if (!lazyTypescript.isPropertyAssignment(frameworkProperty))
|
|
19057
19076
|
continue;
|
|
19058
19077
|
const frameworkName = getObjectPropertyName2(frameworkProperty.name);
|
|
19059
19078
|
const framework = VALID_FRAMEWORKS.find((f) => f === frameworkName);
|
|
19060
19079
|
if (!framework)
|
|
19061
19080
|
continue;
|
|
19062
|
-
if (!
|
|
19081
|
+
if (!lazyTypescript.isObjectLiteralExpression(frameworkProperty.initializer))
|
|
19063
19082
|
continue;
|
|
19064
19083
|
for (const componentProperty of frameworkProperty.initializer.properties) {
|
|
19065
19084
|
let componentKey = null;
|
|
19066
19085
|
let localName = null;
|
|
19067
19086
|
let replaceNode = null;
|
|
19068
19087
|
let replacementText = "";
|
|
19069
|
-
if (
|
|
19088
|
+
if (lazyTypescript.isShorthandPropertyAssignment(componentProperty)) {
|
|
19070
19089
|
componentKey = componentProperty.name.text;
|
|
19071
19090
|
localName = componentProperty.name.text;
|
|
19072
19091
|
const reference = definitionLookup.get(`${framework}:${componentKey}`);
|
|
@@ -19074,7 +19093,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name)
|
|
|
19074
19093
|
continue;
|
|
19075
19094
|
replaceNode = componentProperty;
|
|
19076
19095
|
replacementText = `${quoteKey(componentKey)}: ${definitionLiteral(reference)}`;
|
|
19077
|
-
} else if (
|
|
19096
|
+
} else if (lazyTypescript.isPropertyAssignment(componentProperty) && lazyTypescript.isIdentifier(componentProperty.initializer)) {
|
|
19078
19097
|
componentKey = getObjectPropertyName2(componentProperty.name);
|
|
19079
19098
|
localName = componentProperty.initializer.text;
|
|
19080
19099
|
if (!componentKey)
|
|
@@ -19098,7 +19117,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name)
|
|
|
19098
19117
|
if (edits.length === 0)
|
|
19099
19118
|
return null;
|
|
19100
19119
|
for (const statement of sourceFile.statements) {
|
|
19101
|
-
if (!
|
|
19120
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
19102
19121
|
continue;
|
|
19103
19122
|
const clause = statement.importClause;
|
|
19104
19123
|
if (!clause)
|
|
@@ -19107,11 +19126,11 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name)
|
|
|
19107
19126
|
if (clause.name)
|
|
19108
19127
|
localNames.push(clause.name.text);
|
|
19109
19128
|
const bindings = clause.namedBindings;
|
|
19110
|
-
if (bindings &&
|
|
19129
|
+
if (bindings && lazyTypescript.isNamedImports(bindings)) {
|
|
19111
19130
|
for (const element of bindings.elements) {
|
|
19112
19131
|
localNames.push(element.name.text);
|
|
19113
19132
|
}
|
|
19114
|
-
} else if (bindings &&
|
|
19133
|
+
} else if (bindings && lazyTypescript.isNamespaceImport(bindings)) {
|
|
19115
19134
|
localNames.push(bindings.name.text);
|
|
19116
19135
|
}
|
|
19117
19136
|
if (localNames.length === 0)
|
|
@@ -19159,6 +19178,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts8.isIdentifier(name)
|
|
|
19159
19178
|
};
|
|
19160
19179
|
};
|
|
19161
19180
|
var init_islandRegistryTransform = __esm(() => {
|
|
19181
|
+
init_lazyTypescript();
|
|
19162
19182
|
VALID_FRAMEWORKS = [
|
|
19163
19183
|
"react",
|
|
19164
19184
|
"svelte",
|
|
@@ -20182,21 +20202,22 @@ if (Math.random() < ${sampleRate}) {
|
|
|
20182
20202
|
var init_vitals = () => {};
|
|
20183
20203
|
|
|
20184
20204
|
// src/dev/angular/hmrImportGenerator.ts
|
|
20185
|
-
import ts9 from "typescript";
|
|
20186
20205
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
20187
20206
|
addImport(request) {
|
|
20188
20207
|
const namespace = namespaceMap.get(request.exportModuleSpecifier);
|
|
20189
20208
|
if (!namespace) {
|
|
20190
20209
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
20191
20210
|
}
|
|
20192
|
-
const namespaceId =
|
|
20211
|
+
const namespaceId = lazyTypescript.factory.createIdentifier(namespace);
|
|
20193
20212
|
if (request.exportSymbolName === null) {
|
|
20194
20213
|
return namespaceId;
|
|
20195
20214
|
}
|
|
20196
|
-
return
|
|
20215
|
+
return lazyTypescript.factory.createPropertyAccessExpression(namespaceId, lazyTypescript.factory.createIdentifier(request.exportSymbolName));
|
|
20197
20216
|
}
|
|
20198
20217
|
});
|
|
20199
|
-
var init_hmrImportGenerator = () => {
|
|
20218
|
+
var init_hmrImportGenerator = __esm(() => {
|
|
20219
|
+
init_lazyTypescript();
|
|
20220
|
+
});
|
|
20200
20221
|
|
|
20201
20222
|
// src/dev/angular/vendor/translator/context.ts
|
|
20202
20223
|
class Context {
|
|
@@ -20559,15 +20580,15 @@ var init_translator = __esm(() => {
|
|
|
20559
20580
|
});
|
|
20560
20581
|
|
|
20561
20582
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
20562
|
-
import ts10 from "typescript";
|
|
20563
20583
|
function tsNumericExpression(value) {
|
|
20564
20584
|
if (value < 0) {
|
|
20565
|
-
const operand =
|
|
20566
|
-
return
|
|
20585
|
+
const operand = lazyTypescript.factory.createNumericLiteral(Math.abs(value));
|
|
20586
|
+
return lazyTypescript.factory.createPrefixUnaryExpression(lazyTypescript.SyntaxKind.MinusToken, operand);
|
|
20567
20587
|
}
|
|
20568
|
-
return
|
|
20588
|
+
return lazyTypescript.factory.createNumericLiteral(value);
|
|
20569
20589
|
}
|
|
20570
20590
|
var init_ts_util = __esm(() => {
|
|
20591
|
+
init_lazyTypescript();
|
|
20571
20592
|
/*!
|
|
20572
20593
|
* @license
|
|
20573
20594
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -20578,144 +20599,142 @@ var init_ts_util = __esm(() => {
|
|
|
20578
20599
|
});
|
|
20579
20600
|
|
|
20580
20601
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
20581
|
-
import ts11 from "typescript";
|
|
20582
|
-
|
|
20583
20602
|
class TypeScriptAstFactory {
|
|
20584
20603
|
constructor(annotateForClosureCompiler) {
|
|
20585
20604
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
20586
20605
|
this.externalSourceFiles = new Map;
|
|
20587
20606
|
this.UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
20588
|
-
"+":
|
|
20589
|
-
"-":
|
|
20590
|
-
"!":
|
|
20607
|
+
"+": lazyTypescript.SyntaxKind.PlusToken,
|
|
20608
|
+
"-": lazyTypescript.SyntaxKind.MinusToken,
|
|
20609
|
+
"!": lazyTypescript.SyntaxKind.ExclamationToken
|
|
20591
20610
|
}))();
|
|
20592
20611
|
this.BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
20593
|
-
"&&":
|
|
20594
|
-
">":
|
|
20595
|
-
">=":
|
|
20596
|
-
"&":
|
|
20597
|
-
"|":
|
|
20598
|
-
"/":
|
|
20599
|
-
"==":
|
|
20600
|
-
"===":
|
|
20601
|
-
"<":
|
|
20602
|
-
"<=":
|
|
20603
|
-
"-":
|
|
20604
|
-
"%":
|
|
20605
|
-
"*":
|
|
20606
|
-
"**":
|
|
20607
|
-
"!=":
|
|
20608
|
-
"!==":
|
|
20609
|
-
"||":
|
|
20610
|
-
"+":
|
|
20611
|
-
"??":
|
|
20612
|
-
"=":
|
|
20613
|
-
"+=":
|
|
20614
|
-
"-=":
|
|
20615
|
-
"*=":
|
|
20616
|
-
"/=":
|
|
20617
|
-
"%=":
|
|
20618
|
-
"**=":
|
|
20619
|
-
"&&=":
|
|
20620
|
-
"||=":
|
|
20621
|
-
"??=":
|
|
20622
|
-
in:
|
|
20623
|
-
instanceof:
|
|
20612
|
+
"&&": lazyTypescript.SyntaxKind.AmpersandAmpersandToken,
|
|
20613
|
+
">": lazyTypescript.SyntaxKind.GreaterThanToken,
|
|
20614
|
+
">=": lazyTypescript.SyntaxKind.GreaterThanEqualsToken,
|
|
20615
|
+
"&": lazyTypescript.SyntaxKind.AmpersandToken,
|
|
20616
|
+
"|": lazyTypescript.SyntaxKind.BarToken,
|
|
20617
|
+
"/": lazyTypescript.SyntaxKind.SlashToken,
|
|
20618
|
+
"==": lazyTypescript.SyntaxKind.EqualsEqualsToken,
|
|
20619
|
+
"===": lazyTypescript.SyntaxKind.EqualsEqualsEqualsToken,
|
|
20620
|
+
"<": lazyTypescript.SyntaxKind.LessThanToken,
|
|
20621
|
+
"<=": lazyTypescript.SyntaxKind.LessThanEqualsToken,
|
|
20622
|
+
"-": lazyTypescript.SyntaxKind.MinusToken,
|
|
20623
|
+
"%": lazyTypescript.SyntaxKind.PercentToken,
|
|
20624
|
+
"*": lazyTypescript.SyntaxKind.AsteriskToken,
|
|
20625
|
+
"**": lazyTypescript.SyntaxKind.AsteriskAsteriskToken,
|
|
20626
|
+
"!=": lazyTypescript.SyntaxKind.ExclamationEqualsToken,
|
|
20627
|
+
"!==": lazyTypescript.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
20628
|
+
"||": lazyTypescript.SyntaxKind.BarBarToken,
|
|
20629
|
+
"+": lazyTypescript.SyntaxKind.PlusToken,
|
|
20630
|
+
"??": lazyTypescript.SyntaxKind.QuestionQuestionToken,
|
|
20631
|
+
"=": lazyTypescript.SyntaxKind.EqualsToken,
|
|
20632
|
+
"+=": lazyTypescript.SyntaxKind.PlusEqualsToken,
|
|
20633
|
+
"-=": lazyTypescript.SyntaxKind.MinusEqualsToken,
|
|
20634
|
+
"*=": lazyTypescript.SyntaxKind.AsteriskEqualsToken,
|
|
20635
|
+
"/=": lazyTypescript.SyntaxKind.SlashEqualsToken,
|
|
20636
|
+
"%=": lazyTypescript.SyntaxKind.PercentEqualsToken,
|
|
20637
|
+
"**=": lazyTypescript.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
20638
|
+
"&&=": lazyTypescript.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
20639
|
+
"||=": lazyTypescript.SyntaxKind.BarBarEqualsToken,
|
|
20640
|
+
"??=": lazyTypescript.SyntaxKind.QuestionQuestionEqualsToken,
|
|
20641
|
+
in: lazyTypescript.SyntaxKind.InKeyword,
|
|
20642
|
+
instanceof: lazyTypescript.SyntaxKind.InstanceOfKeyword
|
|
20624
20643
|
}))();
|
|
20625
20644
|
this.VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
20626
|
-
const:
|
|
20627
|
-
let:
|
|
20628
|
-
var:
|
|
20645
|
+
const: lazyTypescript.NodeFlags.Const,
|
|
20646
|
+
let: lazyTypescript.NodeFlags.Let,
|
|
20647
|
+
var: lazyTypescript.NodeFlags.None
|
|
20629
20648
|
}))();
|
|
20630
20649
|
this.attachComments = attachComments;
|
|
20631
|
-
this.createArrayLiteral =
|
|
20632
|
-
this.createElementAccess =
|
|
20633
|
-
this.createExpressionStatement =
|
|
20634
|
-
this.createIdentifier =
|
|
20635
|
-
this.createParenthesizedExpression =
|
|
20636
|
-
this.createPropertyAccess =
|
|
20637
|
-
this.createSpreadElement =
|
|
20638
|
-
this.createThrowStatement =
|
|
20639
|
-
this.createTypeOfExpression =
|
|
20640
|
-
this.createVoidExpression =
|
|
20650
|
+
this.createArrayLiteral = lazyTypescript.factory.createArrayLiteralExpression;
|
|
20651
|
+
this.createElementAccess = lazyTypescript.factory.createElementAccessExpression;
|
|
20652
|
+
this.createExpressionStatement = lazyTypescript.factory.createExpressionStatement;
|
|
20653
|
+
this.createIdentifier = lazyTypescript.factory.createIdentifier;
|
|
20654
|
+
this.createParenthesizedExpression = lazyTypescript.factory.createParenthesizedExpression;
|
|
20655
|
+
this.createPropertyAccess = lazyTypescript.factory.createPropertyAccessExpression;
|
|
20656
|
+
this.createSpreadElement = lazyTypescript.factory.createSpreadElement;
|
|
20657
|
+
this.createThrowStatement = lazyTypescript.factory.createThrowStatement;
|
|
20658
|
+
this.createTypeOfExpression = lazyTypescript.factory.createTypeOfExpression;
|
|
20659
|
+
this.createVoidExpression = lazyTypescript.factory.createVoidExpression;
|
|
20641
20660
|
}
|
|
20642
20661
|
createAssignment(target, operator, value) {
|
|
20643
|
-
return
|
|
20662
|
+
return lazyTypescript.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
20644
20663
|
}
|
|
20645
20664
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
20646
|
-
return
|
|
20665
|
+
return lazyTypescript.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
20647
20666
|
}
|
|
20648
20667
|
createBlock(body) {
|
|
20649
|
-
return
|
|
20668
|
+
return lazyTypescript.factory.createBlock(body);
|
|
20650
20669
|
}
|
|
20651
20670
|
createCallExpression(callee, args, pure) {
|
|
20652
|
-
const call =
|
|
20671
|
+
const call = lazyTypescript.factory.createCallExpression(callee, undefined, args);
|
|
20653
20672
|
if (pure) {
|
|
20654
|
-
|
|
20673
|
+
lazyTypescript.addSyntheticLeadingComment(call, lazyTypescript.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
20655
20674
|
}
|
|
20656
20675
|
return call;
|
|
20657
20676
|
}
|
|
20658
20677
|
createConditional(condition, whenTrue, whenFalse) {
|
|
20659
|
-
return
|
|
20678
|
+
return lazyTypescript.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
20660
20679
|
}
|
|
20661
20680
|
createDynamicImport(url) {
|
|
20662
|
-
return
|
|
20663
|
-
typeof url === "string" ?
|
|
20681
|
+
return lazyTypescript.factory.createCallExpression(lazyTypescript.factory.createToken(lazyTypescript.SyntaxKind.ImportKeyword), undefined, [
|
|
20682
|
+
typeof url === "string" ? lazyTypescript.factory.createStringLiteral(url) : url
|
|
20664
20683
|
]);
|
|
20665
20684
|
}
|
|
20666
20685
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
20667
|
-
if (!
|
|
20668
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
20686
|
+
if (!lazyTypescript.isBlock(body)) {
|
|
20687
|
+
throw new Error(`Invalid syntax, expected a block, but got ${lazyTypescript.SyntaxKind[body.kind]}.`);
|
|
20669
20688
|
}
|
|
20670
|
-
return
|
|
20689
|
+
return lazyTypescript.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
20671
20690
|
}
|
|
20672
20691
|
createFunctionExpression(functionName, parameters, body) {
|
|
20673
|
-
if (!
|
|
20674
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
20692
|
+
if (!lazyTypescript.isBlock(body)) {
|
|
20693
|
+
throw new Error(`Invalid syntax, expected a block, but got ${lazyTypescript.SyntaxKind[body.kind]}.`);
|
|
20675
20694
|
}
|
|
20676
|
-
return
|
|
20695
|
+
return lazyTypescript.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
20677
20696
|
}
|
|
20678
20697
|
createArrowFunctionExpression(parameters, body) {
|
|
20679
|
-
if (
|
|
20680
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
20698
|
+
if (lazyTypescript.isStatement(body) && !lazyTypescript.isBlock(body)) {
|
|
20699
|
+
throw new Error(`Invalid syntax, expected a block, but got ${lazyTypescript.SyntaxKind[body.kind]}.`);
|
|
20681
20700
|
}
|
|
20682
|
-
return
|
|
20701
|
+
return lazyTypescript.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
20683
20702
|
}
|
|
20684
20703
|
createParameter(param) {
|
|
20685
|
-
return
|
|
20704
|
+
return lazyTypescript.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
20686
20705
|
}
|
|
20687
20706
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
20688
|
-
return
|
|
20707
|
+
return lazyTypescript.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
20689
20708
|
}
|
|
20690
20709
|
createLiteral(value) {
|
|
20691
20710
|
if (value === undefined) {
|
|
20692
|
-
return
|
|
20711
|
+
return lazyTypescript.factory.createIdentifier("undefined");
|
|
20693
20712
|
} else if (value === null) {
|
|
20694
|
-
return
|
|
20713
|
+
return lazyTypescript.factory.createNull();
|
|
20695
20714
|
} else if (typeof value === "boolean") {
|
|
20696
|
-
return value ?
|
|
20715
|
+
return value ? lazyTypescript.factory.createTrue() : lazyTypescript.factory.createFalse();
|
|
20697
20716
|
} else if (typeof value === "number") {
|
|
20698
20717
|
return tsNumericExpression(value);
|
|
20699
20718
|
} else {
|
|
20700
|
-
return
|
|
20719
|
+
return lazyTypescript.factory.createStringLiteral(value);
|
|
20701
20720
|
}
|
|
20702
20721
|
}
|
|
20703
20722
|
createNewExpression(expression, args) {
|
|
20704
|
-
return
|
|
20723
|
+
return lazyTypescript.factory.createNewExpression(expression, undefined, args);
|
|
20705
20724
|
}
|
|
20706
20725
|
createObjectLiteral(properties) {
|
|
20707
|
-
return
|
|
20726
|
+
return lazyTypescript.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
20708
20727
|
if (prop.kind === "spread") {
|
|
20709
|
-
return
|
|
20728
|
+
return lazyTypescript.factory.createSpreadAssignment(prop.expression);
|
|
20710
20729
|
}
|
|
20711
|
-
return
|
|
20730
|
+
return lazyTypescript.factory.createPropertyAssignment(prop.quoted ? lazyTypescript.factory.createStringLiteral(prop.propertyName) : lazyTypescript.factory.createIdentifier(prop.propertyName), prop.value);
|
|
20712
20731
|
}));
|
|
20713
20732
|
}
|
|
20714
20733
|
createReturnStatement(expression) {
|
|
20715
|
-
return
|
|
20734
|
+
return lazyTypescript.factory.createReturnStatement(expression ?? undefined);
|
|
20716
20735
|
}
|
|
20717
20736
|
createTaggedTemplate(tag, template) {
|
|
20718
|
-
return
|
|
20737
|
+
return lazyTypescript.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
20719
20738
|
}
|
|
20720
20739
|
createTemplateLiteral(template) {
|
|
20721
20740
|
let templateLiteral;
|
|
@@ -20725,7 +20744,7 @@ class TypeScriptAstFactory {
|
|
|
20725
20744
|
throw new Error("createTemplateLiteral: template has no elements");
|
|
20726
20745
|
}
|
|
20727
20746
|
if (length === 1) {
|
|
20728
|
-
templateLiteral =
|
|
20747
|
+
templateLiteral = lazyTypescript.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
20729
20748
|
} else {
|
|
20730
20749
|
const spans = [];
|
|
20731
20750
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -20739,7 +20758,7 @@ class TypeScriptAstFactory {
|
|
|
20739
20758
|
if (range !== null) {
|
|
20740
20759
|
this.setSourceMapRange(middle, range);
|
|
20741
20760
|
}
|
|
20742
|
-
spans.push(
|
|
20761
|
+
spans.push(lazyTypescript.factory.createTemplateSpan(expression, middle));
|
|
20743
20762
|
}
|
|
20744
20763
|
const resolvedExpression = template.expressions[length - 2];
|
|
20745
20764
|
const templatePart = template.elements[length - 1];
|
|
@@ -20750,8 +20769,8 @@ class TypeScriptAstFactory {
|
|
|
20750
20769
|
if (templatePart.range !== null) {
|
|
20751
20770
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
20752
20771
|
}
|
|
20753
|
-
spans.push(
|
|
20754
|
-
templateLiteral =
|
|
20772
|
+
spans.push(lazyTypescript.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
20773
|
+
templateLiteral = lazyTypescript.factory.createTemplateExpression(lazyTypescript.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
20755
20774
|
}
|
|
20756
20775
|
if (head.range !== null) {
|
|
20757
20776
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
@@ -20759,15 +20778,15 @@ class TypeScriptAstFactory {
|
|
|
20759
20778
|
return templateLiteral;
|
|
20760
20779
|
}
|
|
20761
20780
|
createUnaryExpression(operator, operand) {
|
|
20762
|
-
return
|
|
20781
|
+
return lazyTypescript.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
20763
20782
|
}
|
|
20764
20783
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
20765
|
-
return
|
|
20766
|
-
|
|
20784
|
+
return lazyTypescript.factory.createVariableStatement(undefined, lazyTypescript.factory.createVariableDeclarationList([
|
|
20785
|
+
lazyTypescript.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
20767
20786
|
], this.VAR_TYPES[variableType]));
|
|
20768
20787
|
}
|
|
20769
20788
|
createRegularExpressionLiteral(body, flags) {
|
|
20770
|
-
return
|
|
20789
|
+
return lazyTypescript.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
20771
20790
|
}
|
|
20772
20791
|
setSourceMapRange(node, sourceMapRange) {
|
|
20773
20792
|
if (sourceMapRange === null) {
|
|
@@ -20775,10 +20794,10 @@ class TypeScriptAstFactory {
|
|
|
20775
20794
|
}
|
|
20776
20795
|
const url = sourceMapRange.url;
|
|
20777
20796
|
if (!this.externalSourceFiles.has(url)) {
|
|
20778
|
-
this.externalSourceFiles.set(url,
|
|
20797
|
+
this.externalSourceFiles.set(url, lazyTypescript.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
20779
20798
|
}
|
|
20780
20799
|
const source = this.externalSourceFiles.get(url);
|
|
20781
|
-
|
|
20800
|
+
lazyTypescript.setSourceMapRange(node, {
|
|
20782
20801
|
pos: sourceMapRange.start.offset,
|
|
20783
20802
|
end: sourceMapRange.end.offset,
|
|
20784
20803
|
source
|
|
@@ -20788,79 +20807,80 @@ class TypeScriptAstFactory {
|
|
|
20788
20807
|
createBuiltInType(type) {
|
|
20789
20808
|
switch (type) {
|
|
20790
20809
|
case "any":
|
|
20791
|
-
return
|
|
20810
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.AnyKeyword);
|
|
20792
20811
|
case "boolean":
|
|
20793
|
-
return
|
|
20812
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.BooleanKeyword);
|
|
20794
20813
|
case "number":
|
|
20795
|
-
return
|
|
20814
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.NumberKeyword);
|
|
20796
20815
|
case "string":
|
|
20797
|
-
return
|
|
20816
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.StringKeyword);
|
|
20798
20817
|
case "function":
|
|
20799
|
-
return
|
|
20818
|
+
return lazyTypescript.factory.createTypeReferenceNode(lazyTypescript.factory.createIdentifier("Function"));
|
|
20800
20819
|
case "never":
|
|
20801
|
-
return
|
|
20820
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.NeverKeyword);
|
|
20802
20821
|
case "unknown":
|
|
20803
|
-
return
|
|
20822
|
+
return lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.UnknownKeyword);
|
|
20804
20823
|
}
|
|
20805
20824
|
}
|
|
20806
20825
|
createExpressionType(expression, typeParams) {
|
|
20807
20826
|
const typeName = getEntityTypeFromExpression(expression);
|
|
20808
|
-
return
|
|
20827
|
+
return lazyTypescript.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
20809
20828
|
}
|
|
20810
20829
|
createArrayType(elementType) {
|
|
20811
|
-
return
|
|
20830
|
+
return lazyTypescript.factory.createArrayTypeNode(elementType);
|
|
20812
20831
|
}
|
|
20813
20832
|
createMapType(valueType) {
|
|
20814
|
-
return
|
|
20815
|
-
|
|
20816
|
-
|
|
20833
|
+
return lazyTypescript.factory.createTypeLiteralNode([
|
|
20834
|
+
lazyTypescript.factory.createIndexSignature(undefined, [
|
|
20835
|
+
lazyTypescript.factory.createParameterDeclaration(undefined, undefined, "key", undefined, lazyTypescript.factory.createKeywordTypeNode(lazyTypescript.SyntaxKind.StringKeyword))
|
|
20817
20836
|
], valueType)
|
|
20818
20837
|
]);
|
|
20819
20838
|
}
|
|
20820
20839
|
transplantType(type) {
|
|
20821
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
20840
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && lazyTypescript.isTypeNode(type)) {
|
|
20822
20841
|
return type;
|
|
20823
20842
|
}
|
|
20824
20843
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
20825
20844
|
}
|
|
20826
20845
|
}
|
|
20827
20846
|
function createTemplateMiddle(cooked, raw) {
|
|
20828
|
-
const node =
|
|
20829
|
-
node.kind =
|
|
20847
|
+
const node = lazyTypescript.factory.createTemplateHead(cooked, raw);
|
|
20848
|
+
node.kind = lazyTypescript.SyntaxKind.TemplateMiddle;
|
|
20830
20849
|
return node;
|
|
20831
20850
|
}
|
|
20832
20851
|
function createTemplateTail(cooked, raw) {
|
|
20833
|
-
const node =
|
|
20834
|
-
node.kind =
|
|
20852
|
+
const node = lazyTypescript.factory.createTemplateHead(cooked, raw);
|
|
20853
|
+
node.kind = lazyTypescript.SyntaxKind.TemplateTail;
|
|
20835
20854
|
return node;
|
|
20836
20855
|
}
|
|
20837
20856
|
function attachComments(statement, leadingComments) {
|
|
20838
20857
|
for (const comment of leadingComments) {
|
|
20839
|
-
const commentKind = comment.multiline ?
|
|
20858
|
+
const commentKind = comment.multiline ? lazyTypescript.SyntaxKind.MultiLineCommentTrivia : lazyTypescript.SyntaxKind.SingleLineCommentTrivia;
|
|
20840
20859
|
if (comment.multiline) {
|
|
20841
|
-
|
|
20860
|
+
lazyTypescript.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
20842
20861
|
} else {
|
|
20843
20862
|
for (const line of comment.toString().split(`
|
|
20844
20863
|
`)) {
|
|
20845
|
-
|
|
20864
|
+
lazyTypescript.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
20846
20865
|
}
|
|
20847
20866
|
}
|
|
20848
20867
|
}
|
|
20849
20868
|
}
|
|
20850
20869
|
function getEntityTypeFromExpression(expression) {
|
|
20851
|
-
if (
|
|
20870
|
+
if (lazyTypescript.isIdentifier(expression)) {
|
|
20852
20871
|
return expression;
|
|
20853
20872
|
}
|
|
20854
|
-
if (
|
|
20873
|
+
if (lazyTypescript.isPropertyAccessExpression(expression)) {
|
|
20855
20874
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
20856
|
-
if (!
|
|
20875
|
+
if (!lazyTypescript.isIdentifier(expression.name)) {
|
|
20857
20876
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
20858
20877
|
}
|
|
20859
|
-
return
|
|
20878
|
+
return lazyTypescript.factory.createQualifiedName(left, expression.name);
|
|
20860
20879
|
}
|
|
20861
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
20880
|
+
throw new Error(`Unsupported expression for type reference: ${lazyTypescript.SyntaxKind[expression.kind]}`);
|
|
20862
20881
|
}
|
|
20863
20882
|
var init_typescript_ast_factory = __esm(() => {
|
|
20883
|
+
init_lazyTypescript();
|
|
20864
20884
|
init_ts_util();
|
|
20865
20885
|
});
|
|
20866
20886
|
|
|
@@ -20885,7 +20905,6 @@ var init_typescript_translator = __esm(() => {
|
|
|
20885
20905
|
// src/dev/angular/fastHmrCompiler.ts
|
|
20886
20906
|
import { existsSync as existsSync37, readFileSync as readFileSync33, statSync as statSync4 } from "fs";
|
|
20887
20907
|
import { dirname as dirname26, extname as extname15, relative as relative22, resolve as resolve36 } from "path";
|
|
20888
|
-
import ts12 from "typescript";
|
|
20889
20908
|
var fail2 = (reason, detail, location) => ({
|
|
20890
20909
|
detail,
|
|
20891
20910
|
ok: false,
|
|
@@ -20893,10 +20912,10 @@ var fail2 = (reason, detail, location) => ({
|
|
|
20893
20912
|
...location ?? {}
|
|
20894
20913
|
}), fingerprintCache, pendingModuleCache, ANGULAR_DECORATOR_NAMES, findAngularDecoratorName = (decorators) => {
|
|
20895
20914
|
for (const decorator of decorators) {
|
|
20896
|
-
if (!
|
|
20915
|
+
if (!lazyTypescript.isCallExpression(decorator.expression))
|
|
20897
20916
|
continue;
|
|
20898
20917
|
const { expression } = decorator.expression;
|
|
20899
|
-
if (!
|
|
20918
|
+
if (!lazyTypescript.isIdentifier(expression))
|
|
20900
20919
|
continue;
|
|
20901
20920
|
if (ANGULAR_DECORATOR_NAMES.has(expression.text)) {
|
|
20902
20921
|
return expression.text;
|
|
@@ -20982,17 +21001,17 @@ var fail2 = (reason, detail, location) => ({
|
|
|
20982
21001
|
}
|
|
20983
21002
|
let sourceFile;
|
|
20984
21003
|
try {
|
|
20985
|
-
sourceFile =
|
|
21004
|
+
sourceFile = lazyTypescript.createSourceFile(componentFilePath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
20986
21005
|
} catch {
|
|
20987
21006
|
return;
|
|
20988
21007
|
}
|
|
20989
21008
|
for (const stmt of sourceFile.statements) {
|
|
20990
|
-
if (!
|
|
21009
|
+
if (!lazyTypescript.isClassDeclaration(stmt))
|
|
20991
21010
|
continue;
|
|
20992
21011
|
const className = stmt.name?.text;
|
|
20993
21012
|
if (!className)
|
|
20994
21013
|
continue;
|
|
20995
|
-
const decorators =
|
|
21014
|
+
const decorators = lazyTypescript.getDecorators(stmt) ?? [];
|
|
20996
21015
|
const decoratorName = findAngularDecoratorName(decorators);
|
|
20997
21016
|
if (!decoratorName)
|
|
20998
21017
|
continue;
|
|
@@ -21000,17 +21019,17 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21000
21019
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
21001
21020
|
if (decoratorName === "Component") {
|
|
21002
21021
|
const componentDecorator = decorators.find((d) => {
|
|
21003
|
-
if (!
|
|
21022
|
+
if (!lazyTypescript.isCallExpression(d.expression))
|
|
21004
21023
|
return false;
|
|
21005
21024
|
const expr = d.expression.expression;
|
|
21006
|
-
return
|
|
21025
|
+
return lazyTypescript.isIdentifier(expr) && expr.text === "Component";
|
|
21007
21026
|
});
|
|
21008
21027
|
if (!componentDecorator)
|
|
21009
21028
|
continue;
|
|
21010
|
-
if (!
|
|
21029
|
+
if (!lazyTypescript.isCallExpression(componentDecorator.expression))
|
|
21011
21030
|
continue;
|
|
21012
21031
|
const [args] = componentDecorator.expression.arguments;
|
|
21013
|
-
if (!args || !
|
|
21032
|
+
if (!args || !lazyTypescript.isObjectLiteralExpression(args))
|
|
21014
21033
|
continue;
|
|
21015
21034
|
const decoratorMeta = readDecoratorMeta(args);
|
|
21016
21035
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
@@ -21041,11 +21060,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21041
21060
|
return false;
|
|
21042
21061
|
return true;
|
|
21043
21062
|
}, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
|
|
21044
|
-
for (const dec of
|
|
21063
|
+
for (const dec of lazyTypescript.getDecorators(cls) ?? []) {
|
|
21045
21064
|
const expr = dec.expression;
|
|
21046
|
-
if (!
|
|
21065
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
21047
21066
|
continue;
|
|
21048
|
-
if (!
|
|
21067
|
+
if (!lazyTypescript.isIdentifier(expr.expression))
|
|
21049
21068
|
continue;
|
|
21050
21069
|
if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
|
|
21051
21070
|
return dec;
|
|
@@ -21055,7 +21074,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21055
21074
|
const decorator = findEntityDecorator(cls);
|
|
21056
21075
|
let decoratorArgsText = "";
|
|
21057
21076
|
if (decorator !== null) {
|
|
21058
|
-
if (!
|
|
21077
|
+
if (!lazyTypescript.isCallExpression(decorator.expression)) {
|
|
21059
21078
|
return {
|
|
21060
21079
|
arrowFieldSig: extractArrowFieldSig(cls),
|
|
21061
21080
|
className,
|
|
@@ -21073,18 +21092,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21073
21092
|
}
|
|
21074
21093
|
const ctorParamTypes = [];
|
|
21075
21094
|
for (const member of cls.members) {
|
|
21076
|
-
if (!
|
|
21095
|
+
if (!lazyTypescript.isConstructorDeclaration(member))
|
|
21077
21096
|
continue;
|
|
21078
21097
|
for (const param of member.parameters) {
|
|
21079
21098
|
const typeText = param.type ? param.type.getText() : "";
|
|
21080
|
-
const decorators =
|
|
21099
|
+
const decorators = lazyTypescript.getDecorators(param) ?? [];
|
|
21081
21100
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d) => {
|
|
21082
21101
|
const e = d.expression;
|
|
21083
|
-
if (
|
|
21102
|
+
if (lazyTypescript.isCallExpression(e) && lazyTypescript.isIdentifier(e.expression)) {
|
|
21084
21103
|
const args = e.arguments.map((a) => a.getText()).join(",");
|
|
21085
21104
|
return `@${e.expression.text}(${args})`;
|
|
21086
21105
|
}
|
|
21087
|
-
if (
|
|
21106
|
+
if (lazyTypescript.isIdentifier(e))
|
|
21088
21107
|
return `@${e.text}`;
|
|
21089
21108
|
return "@<unknown>";
|
|
21090
21109
|
}).join("");
|
|
@@ -21106,23 +21125,23 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21106
21125
|
const walk = (node) => {
|
|
21107
21126
|
if (found)
|
|
21108
21127
|
return;
|
|
21109
|
-
if (
|
|
21128
|
+
if (lazyTypescript.isClassDeclaration(node) && node.name?.text === className) {
|
|
21110
21129
|
found = node;
|
|
21111
21130
|
return;
|
|
21112
21131
|
}
|
|
21113
|
-
|
|
21132
|
+
lazyTypescript.forEachChild(node, walk);
|
|
21114
21133
|
};
|
|
21115
21134
|
walk(sourceFile);
|
|
21116
21135
|
return found;
|
|
21117
21136
|
}, getClassDecorators = (cls) => {
|
|
21118
|
-
const modifiers =
|
|
21137
|
+
const modifiers = lazyTypescript.getDecorators(cls) ?? [];
|
|
21119
21138
|
return [...modifiers];
|
|
21120
21139
|
}, findComponentDecorator = (cls) => {
|
|
21121
21140
|
for (const decorator of getClassDecorators(cls)) {
|
|
21122
21141
|
const expr = decorator.expression;
|
|
21123
|
-
if (
|
|
21142
|
+
if (lazyTypescript.isCallExpression(expr)) {
|
|
21124
21143
|
const functionNode = expr.expression;
|
|
21125
|
-
if (
|
|
21144
|
+
if (lazyTypescript.isIdentifier(functionNode) && functionNode.text === "Component") {
|
|
21126
21145
|
return decorator;
|
|
21127
21146
|
}
|
|
21128
21147
|
}
|
|
@@ -21130,15 +21149,15 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21130
21149
|
return null;
|
|
21131
21150
|
}, getDecoratorArgsObject = (decorator) => {
|
|
21132
21151
|
const call = decorator.expression;
|
|
21133
|
-
if (!
|
|
21152
|
+
if (!lazyTypescript.isCallExpression(call))
|
|
21134
21153
|
return null;
|
|
21135
21154
|
const [arg] = call.arguments;
|
|
21136
|
-
if (!arg || !
|
|
21155
|
+
if (!arg || !lazyTypescript.isObjectLiteralExpression(arg))
|
|
21137
21156
|
return null;
|
|
21138
21157
|
return arg;
|
|
21139
21158
|
}, getProperty = (obj, name) => {
|
|
21140
21159
|
for (const prop of obj.properties) {
|
|
21141
|
-
if (
|
|
21160
|
+
if (lazyTypescript.isPropertyAssignment(prop) && (lazyTypescript.isIdentifier(prop.name) && prop.name.text === name || lazyTypescript.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
21142
21161
|
return prop.initializer;
|
|
21143
21162
|
}
|
|
21144
21163
|
}
|
|
@@ -21147,7 +21166,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21147
21166
|
const expr = getProperty(obj, name);
|
|
21148
21167
|
if (!expr)
|
|
21149
21168
|
return null;
|
|
21150
|
-
if (
|
|
21169
|
+
if (lazyTypescript.isStringLiteral(expr) || lazyTypescript.isNoSubstitutionTemplateLiteral(expr)) {
|
|
21151
21170
|
return expr.text;
|
|
21152
21171
|
}
|
|
21153
21172
|
return null;
|
|
@@ -21155,22 +21174,22 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21155
21174
|
const expr = getProperty(obj, name);
|
|
21156
21175
|
if (!expr)
|
|
21157
21176
|
return null;
|
|
21158
|
-
if (expr.kind ===
|
|
21177
|
+
if (expr.kind === lazyTypescript.SyntaxKind.TrueKeyword)
|
|
21159
21178
|
return true;
|
|
21160
|
-
if (expr.kind ===
|
|
21179
|
+
if (expr.kind === lazyTypescript.SyntaxKind.FalseKeyword)
|
|
21161
21180
|
return false;
|
|
21162
21181
|
return null;
|
|
21163
21182
|
}, isAngularDecoratorIdentifier = (name) => name === "Component" || name === "Directive" || name === "Pipe" || name === "Injectable", classHasAngularDecorator = (cls) => {
|
|
21164
|
-
for (const dec of
|
|
21183
|
+
for (const dec of lazyTypescript.getDecorators(cls) ?? []) {
|
|
21165
21184
|
const expr = dec.expression;
|
|
21166
|
-
if (
|
|
21185
|
+
if (lazyTypescript.isCallExpression(expr) && lazyTypescript.isIdentifier(expr.expression) && isAngularDecoratorIdentifier(expr.expression.text)) {
|
|
21167
21186
|
return true;
|
|
21168
21187
|
}
|
|
21169
21188
|
}
|
|
21170
21189
|
return false;
|
|
21171
21190
|
}, findClassInSourceFile = (sourceFile, className) => {
|
|
21172
21191
|
for (const stmt of sourceFile.statements) {
|
|
21173
|
-
if (
|
|
21192
|
+
if (lazyTypescript.isClassDeclaration(stmt) && stmt.name?.text === className) {
|
|
21174
21193
|
return stmt;
|
|
21175
21194
|
}
|
|
21176
21195
|
}
|
|
@@ -21180,15 +21199,15 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21180
21199
|
if (sameFile)
|
|
21181
21200
|
return classHasAngularDecorator(sameFile);
|
|
21182
21201
|
for (const stmt of sourceFile.statements) {
|
|
21183
|
-
if (!
|
|
21202
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
21184
21203
|
continue;
|
|
21185
|
-
if (!
|
|
21204
|
+
if (!lazyTypescript.isStringLiteral(stmt.moduleSpecifier))
|
|
21186
21205
|
continue;
|
|
21187
21206
|
const clause = stmt.importClause;
|
|
21188
21207
|
if (!clause || clause.isTypeOnly)
|
|
21189
21208
|
continue;
|
|
21190
21209
|
const named = clause.namedBindings;
|
|
21191
|
-
if (!named || !
|
|
21210
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
21192
21211
|
continue;
|
|
21193
21212
|
const found = named.elements.find((element) => element.name.text === parentClassName);
|
|
21194
21213
|
if (!found)
|
|
@@ -21213,7 +21232,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21213
21232
|
} catch {
|
|
21214
21233
|
continue;
|
|
21215
21234
|
}
|
|
21216
|
-
const parentSf =
|
|
21235
|
+
const parentSf = lazyTypescript.createSourceFile(candidate, content, lazyTypescript.ScriptTarget.Latest, true);
|
|
21217
21236
|
const parentCls = findClassInSourceFile(parentSf, parentClassName);
|
|
21218
21237
|
if (!parentCls)
|
|
21219
21238
|
continue;
|
|
@@ -21225,11 +21244,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21225
21244
|
}, inheritsDecoratedClass = (cls, sourceFile, componentDir, projectRoot) => {
|
|
21226
21245
|
const heritage = cls.heritageClauses ?? [];
|
|
21227
21246
|
for (const clause of heritage) {
|
|
21228
|
-
if (clause.token !==
|
|
21247
|
+
if (clause.token !== lazyTypescript.SyntaxKind.ExtendsKeyword)
|
|
21229
21248
|
continue;
|
|
21230
21249
|
for (const typeNode of clause.types) {
|
|
21231
21250
|
const expr = typeNode.expression;
|
|
21232
|
-
if (!
|
|
21251
|
+
if (!lazyTypescript.isIdentifier(expr)) {
|
|
21233
21252
|
return true;
|
|
21234
21253
|
}
|
|
21235
21254
|
if (parentHasAngularDecoratorAcrossFiles(expr.text, sourceFile, componentDir, projectRoot)) {
|
|
@@ -21240,18 +21259,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21240
21259
|
return false;
|
|
21241
21260
|
}, CONTROL_CREATE_METHOD_NAME = "\u0275ngControlCreate", extractControlCreate = (cls) => {
|
|
21242
21261
|
for (const member of cls.members) {
|
|
21243
|
-
if (!
|
|
21262
|
+
if (!lazyTypescript.isMethodDeclaration(member))
|
|
21244
21263
|
continue;
|
|
21245
|
-
if (member.modifiers?.some((item) => item.kind ===
|
|
21264
|
+
if (member.modifiers?.some((item) => item.kind === lazyTypescript.SyntaxKind.StaticKeyword))
|
|
21246
21265
|
continue;
|
|
21247
21266
|
const { name } = member;
|
|
21248
21267
|
if (name === undefined)
|
|
21249
21268
|
continue;
|
|
21250
|
-
const nameText =
|
|
21269
|
+
const nameText = lazyTypescript.isIdentifier(name) ? name.text : name.getText();
|
|
21251
21270
|
if (nameText !== CONTROL_CREATE_METHOD_NAME)
|
|
21252
21271
|
continue;
|
|
21253
21272
|
const [firstParam] = member.parameters;
|
|
21254
|
-
if (firstParam === undefined || firstParam.type === undefined || !
|
|
21273
|
+
if (firstParam === undefined || firstParam.type === undefined || !lazyTypescript.isTypeReferenceNode(firstParam.type)) {
|
|
21255
21274
|
return { passThroughInput: null };
|
|
21256
21275
|
}
|
|
21257
21276
|
const typeArgs = firstParam.type.typeArguments;
|
|
@@ -21259,16 +21278,16 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21259
21278
|
return { passThroughInput: null };
|
|
21260
21279
|
}
|
|
21261
21280
|
const [arg] = typeArgs;
|
|
21262
|
-
if (arg === undefined || !
|
|
21281
|
+
if (arg === undefined || !lazyTypescript.isLiteralTypeNode(arg) || !lazyTypescript.isStringLiteral(arg.literal)) {
|
|
21263
21282
|
return { passThroughInput: null };
|
|
21264
21283
|
}
|
|
21265
21284
|
return { passThroughInput: arg.literal.text };
|
|
21266
21285
|
}
|
|
21267
21286
|
return null;
|
|
21268
21287
|
}, resolveEnumPropertyAccess = (expr, enumName, values) => {
|
|
21269
|
-
if (!
|
|
21288
|
+
if (!lazyTypescript.isPropertyAccessExpression(expr))
|
|
21270
21289
|
return null;
|
|
21271
|
-
if (!
|
|
21290
|
+
if (!lazyTypescript.isIdentifier(expr.expression))
|
|
21272
21291
|
return null;
|
|
21273
21292
|
if (expr.expression.text !== enumName)
|
|
21274
21293
|
return null;
|
|
@@ -21287,21 +21306,21 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21287
21306
|
const hostExpr = getProperty(args, "host");
|
|
21288
21307
|
const schemasExpr = getProperty(args, "schemas");
|
|
21289
21308
|
const styleUrls = [];
|
|
21290
|
-
if (styleUrlsExpr &&
|
|
21309
|
+
if (styleUrlsExpr && lazyTypescript.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
21291
21310
|
for (const element of styleUrlsExpr.elements) {
|
|
21292
|
-
if (
|
|
21311
|
+
if (lazyTypescript.isStringLiteral(element))
|
|
21293
21312
|
styleUrls.push(element.text);
|
|
21294
21313
|
}
|
|
21295
21314
|
}
|
|
21296
21315
|
const styles = [];
|
|
21297
21316
|
if (stylesExpr) {
|
|
21298
|
-
if (
|
|
21317
|
+
if (lazyTypescript.isArrayLiteralExpression(stylesExpr)) {
|
|
21299
21318
|
for (const element of stylesExpr.elements) {
|
|
21300
|
-
if (
|
|
21319
|
+
if (lazyTypescript.isStringLiteral(element) || lazyTypescript.isNoSubstitutionTemplateLiteral(element)) {
|
|
21301
21320
|
styles.push(element.text);
|
|
21302
21321
|
}
|
|
21303
21322
|
}
|
|
21304
|
-
} else if (
|
|
21323
|
+
} else if (lazyTypescript.isStringLiteral(stylesExpr) || lazyTypescript.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
21305
21324
|
styles.push(stylesExpr.text);
|
|
21306
21325
|
}
|
|
21307
21326
|
}
|
|
@@ -21310,19 +21329,19 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21310
21329
|
const changeDetectionExpr = getProperty(args, "changeDetection");
|
|
21311
21330
|
const changeDetection = changeDetectionExpr ? resolveEnumPropertyAccess(changeDetectionExpr, "ChangeDetectionStrategy", CHANGE_DETECTION_VALUES) : null;
|
|
21312
21331
|
return {
|
|
21313
|
-
animationsExpr: animationsExpr &&
|
|
21332
|
+
animationsExpr: animationsExpr && lazyTypescript.isArrayLiteralExpression(animationsExpr) ? animationsExpr : null,
|
|
21314
21333
|
changeDetection,
|
|
21315
21334
|
encapsulation,
|
|
21316
21335
|
hasProviders: getProperty(args, "providers") !== null,
|
|
21317
21336
|
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
21318
|
-
hostDirectivesExpr: hostDirectivesExpr &&
|
|
21319
|
-
hostExpr: hostExpr &&
|
|
21320
|
-
importsExpr: importsExpr &&
|
|
21321
|
-
inputsArrayExpr: inputsArrayExpr &&
|
|
21322
|
-
outputsArrayExpr: outputsArrayExpr &&
|
|
21337
|
+
hostDirectivesExpr: hostDirectivesExpr && lazyTypescript.isArrayLiteralExpression(hostDirectivesExpr) ? hostDirectivesExpr : null,
|
|
21338
|
+
hostExpr: hostExpr && lazyTypescript.isObjectLiteralExpression(hostExpr) ? hostExpr : null,
|
|
21339
|
+
importsExpr: importsExpr && lazyTypescript.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
21340
|
+
inputsArrayExpr: inputsArrayExpr && lazyTypescript.isArrayLiteralExpression(inputsArrayExpr) ? inputsArrayExpr : null,
|
|
21341
|
+
outputsArrayExpr: outputsArrayExpr && lazyTypescript.isArrayLiteralExpression(outputsArrayExpr) ? outputsArrayExpr : null,
|
|
21323
21342
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
21324
|
-
providersExpr: providersExpr &&
|
|
21325
|
-
schemasExpr: schemasExpr &&
|
|
21343
|
+
providersExpr: providersExpr && lazyTypescript.isArrayLiteralExpression(providersExpr) ? providersExpr : null,
|
|
21344
|
+
schemasExpr: schemasExpr && lazyTypescript.isArrayLiteralExpression(schemasExpr) ? schemasExpr : null,
|
|
21326
21345
|
selector: getStringProperty(args, "selector"),
|
|
21327
21346
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
21328
21347
|
styles,
|
|
@@ -21330,16 +21349,16 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21330
21349
|
styleUrls,
|
|
21331
21350
|
template: getStringProperty(args, "template"),
|
|
21332
21351
|
templateUrl: getStringProperty(args, "templateUrl"),
|
|
21333
|
-
viewProvidersExpr: viewProvidersExpr &&
|
|
21352
|
+
viewProvidersExpr: viewProvidersExpr && lazyTypescript.isArrayLiteralExpression(viewProvidersExpr) ? viewProvidersExpr : null
|
|
21334
21353
|
};
|
|
21335
21354
|
}, extractDecoratorInput = (prop, compiler) => {
|
|
21336
|
-
const decorators =
|
|
21355
|
+
const decorators = lazyTypescript.getDecorators(prop) ?? [];
|
|
21337
21356
|
for (const decorator of decorators) {
|
|
21338
21357
|
const expr = decorator.expression;
|
|
21339
|
-
if (!
|
|
21358
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
21340
21359
|
continue;
|
|
21341
21360
|
const functionNode = expr.expression;
|
|
21342
|
-
if (!
|
|
21361
|
+
if (!lazyTypescript.isIdentifier(functionNode) || functionNode.text !== "Input")
|
|
21343
21362
|
continue;
|
|
21344
21363
|
const classPropertyName = prop.name.getText();
|
|
21345
21364
|
let bindingPropertyName = classPropertyName;
|
|
@@ -21347,9 +21366,9 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21347
21366
|
let transformFunction = null;
|
|
21348
21367
|
const [arg] = expr.arguments;
|
|
21349
21368
|
if (arg) {
|
|
21350
|
-
if (
|
|
21369
|
+
if (lazyTypescript.isStringLiteral(arg)) {
|
|
21351
21370
|
bindingPropertyName = arg.text;
|
|
21352
|
-
} else if (
|
|
21371
|
+
} else if (lazyTypescript.isObjectLiteralExpression(arg)) {
|
|
21353
21372
|
const aliasNode = getStringProperty(arg, "alias");
|
|
21354
21373
|
if (aliasNode !== null)
|
|
21355
21374
|
bindingPropertyName = aliasNode;
|
|
@@ -21373,11 +21392,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21373
21392
|
}
|
|
21374
21393
|
return null;
|
|
21375
21394
|
}, isInputSignalCall = (init) => {
|
|
21376
|
-
if (
|
|
21395
|
+
if (lazyTypescript.isCallExpression(init)) {
|
|
21377
21396
|
const functionNode = init.expression;
|
|
21378
|
-
if (
|
|
21397
|
+
if (lazyTypescript.isIdentifier(functionNode) && functionNode.text === "input")
|
|
21379
21398
|
return true;
|
|
21380
|
-
if (
|
|
21399
|
+
if (lazyTypescript.isPropertyAccessExpression(functionNode) && lazyTypescript.isIdentifier(functionNode.expression) && functionNode.expression.text === "input") {
|
|
21381
21400
|
return true;
|
|
21382
21401
|
}
|
|
21383
21402
|
}
|
|
@@ -21385,18 +21404,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21385
21404
|
}, extractSignalInput = (prop, compiler) => {
|
|
21386
21405
|
if (!prop.initializer || !isInputSignalCall(prop.initializer))
|
|
21387
21406
|
return null;
|
|
21388
|
-
if (!
|
|
21407
|
+
if (!lazyTypescript.isCallExpression(prop.initializer))
|
|
21389
21408
|
return null;
|
|
21390
21409
|
const classPropertyName = prop.name.getText();
|
|
21391
21410
|
const call = prop.initializer;
|
|
21392
21411
|
let required = false;
|
|
21393
|
-
if (
|
|
21412
|
+
if (lazyTypescript.isPropertyAccessExpression(call.expression) && lazyTypescript.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
21394
21413
|
required = true;
|
|
21395
21414
|
}
|
|
21396
21415
|
let bindingPropertyName = classPropertyName;
|
|
21397
21416
|
let transformFunction = null;
|
|
21398
21417
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
21399
|
-
if (optsArg &&
|
|
21418
|
+
if (optsArg && lazyTypescript.isObjectLiteralExpression(optsArg)) {
|
|
21400
21419
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
21401
21420
|
if (aliasNode !== null)
|
|
21402
21421
|
bindingPropertyName = aliasNode;
|
|
@@ -21416,28 +21435,28 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21416
21435
|
}
|
|
21417
21436
|
};
|
|
21418
21437
|
}, extractDecoratorOutput = (prop) => {
|
|
21419
|
-
const decorators =
|
|
21438
|
+
const decorators = lazyTypescript.getDecorators(prop) ?? [];
|
|
21420
21439
|
for (const decorator of decorators) {
|
|
21421
21440
|
const expr = decorator.expression;
|
|
21422
|
-
if (!
|
|
21441
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
21423
21442
|
continue;
|
|
21424
21443
|
const functionNode = expr.expression;
|
|
21425
|
-
if (!
|
|
21444
|
+
if (!lazyTypescript.isIdentifier(functionNode) || functionNode.text !== "Output")
|
|
21426
21445
|
continue;
|
|
21427
21446
|
const classPropertyName = prop.name.getText();
|
|
21428
21447
|
let bindingName = classPropertyName;
|
|
21429
21448
|
const [arg] = expr.arguments;
|
|
21430
|
-
if (arg &&
|
|
21449
|
+
if (arg && lazyTypescript.isStringLiteral(arg))
|
|
21431
21450
|
bindingName = arg.text;
|
|
21432
21451
|
return { bindingName, classPropertyName };
|
|
21433
21452
|
}
|
|
21434
21453
|
return null;
|
|
21435
21454
|
}, isOutputSignalCall = (init) => {
|
|
21436
|
-
if (
|
|
21455
|
+
if (lazyTypescript.isCallExpression(init)) {
|
|
21437
21456
|
const functionNode = init.expression;
|
|
21438
|
-
if (
|
|
21457
|
+
if (lazyTypescript.isIdentifier(functionNode) && functionNode.text === "output")
|
|
21439
21458
|
return true;
|
|
21440
|
-
if (
|
|
21459
|
+
if (lazyTypescript.isPropertyAccessExpression(functionNode) && lazyTypescript.isIdentifier(functionNode.expression) && functionNode.expression.text === "output") {
|
|
21441
21460
|
return true;
|
|
21442
21461
|
}
|
|
21443
21462
|
}
|
|
@@ -21445,13 +21464,13 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21445
21464
|
}, extractSignalOutput = (prop) => {
|
|
21446
21465
|
if (!prop.initializer || !isOutputSignalCall(prop.initializer))
|
|
21447
21466
|
return null;
|
|
21448
|
-
if (!
|
|
21467
|
+
if (!lazyTypescript.isCallExpression(prop.initializer))
|
|
21449
21468
|
return null;
|
|
21450
21469
|
const classPropertyName = prop.name.getText();
|
|
21451
21470
|
const call = prop.initializer;
|
|
21452
21471
|
let bindingName = classPropertyName;
|
|
21453
21472
|
const [optsArg] = call.arguments;
|
|
21454
|
-
if (optsArg &&
|
|
21473
|
+
if (optsArg && lazyTypescript.isObjectLiteralExpression(optsArg)) {
|
|
21455
21474
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
21456
21475
|
if (aliasNode !== null)
|
|
21457
21476
|
bindingName = aliasNode;
|
|
@@ -21463,7 +21482,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21463
21482
|
let hasDecoratorIO = false;
|
|
21464
21483
|
let hasSignalIO = false;
|
|
21465
21484
|
for (const member of cls.members) {
|
|
21466
|
-
if (!
|
|
21485
|
+
if (!lazyTypescript.isPropertyDeclaration(member))
|
|
21467
21486
|
continue;
|
|
21468
21487
|
const decoratorIn = extractDecoratorInput(member, compiler);
|
|
21469
21488
|
if (decoratorIn) {
|
|
@@ -21497,21 +21516,21 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21497
21516
|
specialAttributes: {}
|
|
21498
21517
|
}), parseHostObjectInto = (host, args, hostExprNode, compiler) => {
|
|
21499
21518
|
const hostNode = getProperty(args, "host");
|
|
21500
|
-
if (!hostNode || !
|
|
21519
|
+
if (!hostNode || !lazyTypescript.isObjectLiteralExpression(hostNode)) {
|
|
21501
21520
|
if (!hostExprNode)
|
|
21502
21521
|
return;
|
|
21503
21522
|
}
|
|
21504
|
-
const obj = hostNode &&
|
|
21523
|
+
const obj = hostNode && lazyTypescript.isObjectLiteralExpression(hostNode) ? hostNode : hostExprNode;
|
|
21505
21524
|
if (!obj)
|
|
21506
21525
|
return;
|
|
21507
21526
|
for (const prop of obj.properties) {
|
|
21508
|
-
if (!
|
|
21527
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
21509
21528
|
continue;
|
|
21510
21529
|
const keyNode = prop.name;
|
|
21511
21530
|
let key;
|
|
21512
|
-
if (
|
|
21531
|
+
if (lazyTypescript.isStringLiteral(keyNode) || lazyTypescript.isNoSubstitutionTemplateLiteral(keyNode)) {
|
|
21513
21532
|
key = keyNode.text;
|
|
21514
|
-
} else if (
|
|
21533
|
+
} else if (lazyTypescript.isIdentifier(keyNode)) {
|
|
21515
21534
|
key = keyNode.text;
|
|
21516
21535
|
} else {
|
|
21517
21536
|
continue;
|
|
@@ -21528,39 +21547,39 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21528
21547
|
}
|
|
21529
21548
|
}, mergeMemberHostDecorators = (host, cls) => {
|
|
21530
21549
|
for (const member of cls.members) {
|
|
21531
|
-
if (!
|
|
21550
|
+
if (!lazyTypescript.canHaveDecorators(member))
|
|
21532
21551
|
continue;
|
|
21533
|
-
const decorators =
|
|
21552
|
+
const decorators = lazyTypescript.getDecorators(member) ?? [];
|
|
21534
21553
|
for (const dec of decorators) {
|
|
21535
21554
|
const expr = dec.expression;
|
|
21536
|
-
if (!
|
|
21555
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
21537
21556
|
continue;
|
|
21538
21557
|
const functionNode = expr.expression;
|
|
21539
|
-
if (!
|
|
21558
|
+
if (!lazyTypescript.isIdentifier(functionNode))
|
|
21540
21559
|
continue;
|
|
21541
21560
|
if (functionNode.text === "HostBinding") {
|
|
21542
|
-
if (!
|
|
21561
|
+
if (!lazyTypescript.isPropertyDeclaration(member) && !lazyTypescript.isGetAccessor(member))
|
|
21543
21562
|
continue;
|
|
21544
|
-
if (!
|
|
21563
|
+
if (!lazyTypescript.isIdentifier(member.name))
|
|
21545
21564
|
continue;
|
|
21546
21565
|
const propertyName = member.name.text;
|
|
21547
21566
|
const [target] = expr.arguments;
|
|
21548
|
-
const key = target &&
|
|
21567
|
+
const key = target && lazyTypescript.isStringLiteral(target) ? target.text : propertyName;
|
|
21549
21568
|
host.properties[key] = propertyName;
|
|
21550
21569
|
} else if (functionNode.text === "HostListener") {
|
|
21551
|
-
if (!
|
|
21570
|
+
if (!lazyTypescript.isMethodDeclaration(member))
|
|
21552
21571
|
continue;
|
|
21553
|
-
if (!
|
|
21572
|
+
if (!lazyTypescript.isIdentifier(member.name))
|
|
21554
21573
|
continue;
|
|
21555
21574
|
const methodName = member.name.text;
|
|
21556
21575
|
const [eventArg, argsArg] = expr.arguments;
|
|
21557
|
-
if (!eventArg || !
|
|
21576
|
+
if (!eventArg || !lazyTypescript.isStringLiteral(eventArg))
|
|
21558
21577
|
continue;
|
|
21559
21578
|
const event = eventArg.text;
|
|
21560
21579
|
const argsList = [];
|
|
21561
|
-
if (argsArg &&
|
|
21580
|
+
if (argsArg && lazyTypescript.isArrayLiteralExpression(argsArg)) {
|
|
21562
21581
|
for (const element of argsArg.elements) {
|
|
21563
|
-
if (
|
|
21582
|
+
if (lazyTypescript.isStringLiteral(element))
|
|
21564
21583
|
argsList.push(element.text);
|
|
21565
21584
|
}
|
|
21566
21585
|
}
|
|
@@ -21573,14 +21592,14 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21573
21592
|
let descendants = true;
|
|
21574
21593
|
let emitDistinctChangesOnly = true;
|
|
21575
21594
|
const [, opts] = args;
|
|
21576
|
-
if (opts &&
|
|
21595
|
+
if (opts && lazyTypescript.isObjectLiteralExpression(opts)) {
|
|
21577
21596
|
static_ = getBooleanProperty(opts, "static") ?? false;
|
|
21578
21597
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
21579
21598
|
emitDistinctChangesOnly = getBooleanProperty(opts, "emitDistinctChangesOnly") ?? true;
|
|
21580
21599
|
}
|
|
21581
21600
|
return { descendants, emitDistinctChangesOnly, static_ };
|
|
21582
21601
|
}, queryPredicateFromArg = (arg, compiler) => {
|
|
21583
|
-
if (
|
|
21602
|
+
if (lazyTypescript.isStringLiteral(arg)) {
|
|
21584
21603
|
return arg.text.split(",").map((item) => item.trim()).filter(Boolean);
|
|
21585
21604
|
}
|
|
21586
21605
|
return {
|
|
@@ -21591,17 +21610,17 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21591
21610
|
const contentQueries = [];
|
|
21592
21611
|
const viewQueries = [];
|
|
21593
21612
|
for (const member of cls.members) {
|
|
21594
|
-
if (!
|
|
21613
|
+
if (!lazyTypescript.isPropertyDeclaration(member))
|
|
21595
21614
|
continue;
|
|
21596
|
-
const decorators =
|
|
21615
|
+
const decorators = lazyTypescript.getDecorators(member) ?? [];
|
|
21597
21616
|
for (const dec of decorators) {
|
|
21598
21617
|
const expr = dec.expression;
|
|
21599
|
-
if (!
|
|
21618
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
21600
21619
|
continue;
|
|
21601
21620
|
const functionNode = expr.expression;
|
|
21602
|
-
if (!
|
|
21621
|
+
if (!lazyTypescript.isIdentifier(functionNode) || !QUERY_DECORATORS.has(functionNode.text))
|
|
21603
21622
|
continue;
|
|
21604
|
-
if (!
|
|
21623
|
+
if (!lazyTypescript.isIdentifier(member.name))
|
|
21605
21624
|
continue;
|
|
21606
21625
|
const propertyName = member.name.text;
|
|
21607
21626
|
const [tokenArg, opts] = expr.arguments;
|
|
@@ -21612,7 +21631,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21612
21631
|
continue;
|
|
21613
21632
|
const { static_, descendants, emitDistinctChangesOnly } = parseQueryDecoratorOptions(expr.arguments);
|
|
21614
21633
|
let read = null;
|
|
21615
|
-
if (opts &&
|
|
21634
|
+
if (opts && lazyTypescript.isObjectLiteralExpression(opts)) {
|
|
21616
21635
|
const readNode = getProperty(opts, "read");
|
|
21617
21636
|
if (readNode) {
|
|
21618
21637
|
read = new compiler.WrappedNodeExpr(readNode);
|
|
@@ -21640,15 +21659,15 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21640
21659
|
const contentQueries = [];
|
|
21641
21660
|
const viewQueries = [];
|
|
21642
21661
|
for (const member of cls.members) {
|
|
21643
|
-
if (!
|
|
21662
|
+
if (!lazyTypescript.isPropertyDeclaration(member) || !member.initializer)
|
|
21644
21663
|
continue;
|
|
21645
21664
|
const init = member.initializer;
|
|
21646
|
-
if (!
|
|
21665
|
+
if (!lazyTypescript.isCallExpression(init))
|
|
21647
21666
|
continue;
|
|
21648
21667
|
let queryName;
|
|
21649
|
-
if (
|
|
21668
|
+
if (lazyTypescript.isIdentifier(init.expression)) {
|
|
21650
21669
|
queryName = init.expression.text;
|
|
21651
|
-
} else if (
|
|
21670
|
+
} else if (lazyTypescript.isPropertyAccessExpression(init.expression) && lazyTypescript.isIdentifier(init.expression.expression) && init.expression.name.text === "required") {
|
|
21652
21671
|
queryName = init.expression.expression.text;
|
|
21653
21672
|
} else {
|
|
21654
21673
|
continue;
|
|
@@ -21656,7 +21675,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21656
21675
|
const runtime = SIGNAL_QUERY_TO_RUNTIME[queryName];
|
|
21657
21676
|
if (!runtime)
|
|
21658
21677
|
continue;
|
|
21659
|
-
if (!
|
|
21678
|
+
if (!lazyTypescript.isIdentifier(member.name))
|
|
21660
21679
|
continue;
|
|
21661
21680
|
const propertyName = member.name.text;
|
|
21662
21681
|
const [tokenArg, opts] = init.arguments;
|
|
@@ -21667,7 +21686,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21667
21686
|
continue;
|
|
21668
21687
|
let descendants = true;
|
|
21669
21688
|
let read = null;
|
|
21670
|
-
if (opts &&
|
|
21689
|
+
if (opts && lazyTypescript.isObjectLiteralExpression(opts)) {
|
|
21671
21690
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
21672
21691
|
const readNode = getProperty(opts, "read");
|
|
21673
21692
|
if (readNode)
|
|
@@ -21693,13 +21712,13 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21693
21712
|
const node = getProperty(args, "exportAs");
|
|
21694
21713
|
if (!node)
|
|
21695
21714
|
return null;
|
|
21696
|
-
if (
|
|
21715
|
+
if (lazyTypescript.isStringLiteral(node)) {
|
|
21697
21716
|
return node.text.split(",").map((item) => item.trim()).filter(Boolean);
|
|
21698
21717
|
}
|
|
21699
|
-
if (
|
|
21718
|
+
if (lazyTypescript.isArrayLiteralExpression(node)) {
|
|
21700
21719
|
const out = [];
|
|
21701
21720
|
for (const element of node.elements) {
|
|
21702
|
-
if (
|
|
21721
|
+
if (lazyTypescript.isStringLiteral(element))
|
|
21703
21722
|
out.push(element.text);
|
|
21704
21723
|
}
|
|
21705
21724
|
return out.length > 0 ? out : null;
|
|
@@ -21707,11 +21726,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21707
21726
|
return null;
|
|
21708
21727
|
}, extractHostDirectives = (args, compiler) => {
|
|
21709
21728
|
const node = getProperty(args, "hostDirectives");
|
|
21710
|
-
if (!node || !
|
|
21729
|
+
if (!node || !lazyTypescript.isArrayLiteralExpression(node))
|
|
21711
21730
|
return null;
|
|
21712
21731
|
const out = [];
|
|
21713
21732
|
for (const element of node.elements) {
|
|
21714
|
-
if (
|
|
21733
|
+
if (lazyTypescript.isIdentifier(element)) {
|
|
21715
21734
|
out.push({
|
|
21716
21735
|
directive: {
|
|
21717
21736
|
type: new compiler.WrappedNodeExpr(element),
|
|
@@ -21723,7 +21742,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21723
21742
|
});
|
|
21724
21743
|
continue;
|
|
21725
21744
|
}
|
|
21726
|
-
if (!
|
|
21745
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
21727
21746
|
continue;
|
|
21728
21747
|
const directiveNode = getProperty(element, "directive");
|
|
21729
21748
|
if (!directiveNode)
|
|
@@ -21731,11 +21750,11 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21731
21750
|
const inputsNode = getProperty(element, "inputs");
|
|
21732
21751
|
const outputsNode = getProperty(element, "outputs");
|
|
21733
21752
|
const collectMap = (expression) => {
|
|
21734
|
-
if (!expression || !
|
|
21753
|
+
if (!expression || !lazyTypescript.isArrayLiteralExpression(expression))
|
|
21735
21754
|
return null;
|
|
21736
21755
|
const map = {};
|
|
21737
21756
|
for (const mappingElement of expression.elements) {
|
|
21738
|
-
if (!
|
|
21757
|
+
if (!lazyTypescript.isStringLiteral(mappingElement))
|
|
21739
21758
|
continue;
|
|
21740
21759
|
const [name, alias] = mappingElement.text.split(":").map((segment) => segment.trim());
|
|
21741
21760
|
if (name)
|
|
@@ -21805,10 +21824,10 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21805
21824
|
});
|
|
21806
21825
|
return null;
|
|
21807
21826
|
}
|
|
21808
|
-
const sourceFile =
|
|
21827
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true);
|
|
21809
21828
|
let info = null;
|
|
21810
21829
|
for (const stmt of sourceFile.statements) {
|
|
21811
|
-
if (!
|
|
21830
|
+
if (!lazyTypescript.isClassDeclaration(stmt))
|
|
21812
21831
|
continue;
|
|
21813
21832
|
if (!stmt.name || stmt.name.text !== className)
|
|
21814
21833
|
continue;
|
|
@@ -21946,9 +21965,9 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21946
21965
|
}, buildClassToSpecMap = (sourceFile) => {
|
|
21947
21966
|
const result = new Map;
|
|
21948
21967
|
for (const stmt of sourceFile.statements) {
|
|
21949
|
-
if (!
|
|
21968
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
21950
21969
|
continue;
|
|
21951
|
-
if (!
|
|
21970
|
+
if (!lazyTypescript.isStringLiteral(stmt.moduleSpecifier))
|
|
21952
21971
|
continue;
|
|
21953
21972
|
const spec = stmt.moduleSpecifier.text;
|
|
21954
21973
|
const clause = stmt.importClause;
|
|
@@ -21957,7 +21976,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
21957
21976
|
if (clause.name)
|
|
21958
21977
|
result.set(clause.name.text, spec);
|
|
21959
21978
|
const named = clause.namedBindings;
|
|
21960
|
-
if (named &&
|
|
21979
|
+
if (named && lazyTypescript.isNamedImports(named)) {
|
|
21961
21980
|
for (const element of named.elements) {
|
|
21962
21981
|
if (element.isTypeOnly)
|
|
21963
21982
|
continue;
|
|
@@ -22070,7 +22089,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22070
22089
|
return result;
|
|
22071
22090
|
const classToSpec = buildClassToSpecMap(sourceFile);
|
|
22072
22091
|
for (const element of importsExpr.elements) {
|
|
22073
|
-
if (!
|
|
22092
|
+
if (!lazyTypescript.isIdentifier(element))
|
|
22074
22093
|
continue;
|
|
22075
22094
|
const className = element.text;
|
|
22076
22095
|
const spec = classToSpec.get(className);
|
|
@@ -22089,35 +22108,35 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22089
22108
|
}
|
|
22090
22109
|
return (hash >>> 0).toString(36);
|
|
22091
22110
|
}, initializerShapeIsStructural = (node) => {
|
|
22092
|
-
if (
|
|
22111
|
+
if (lazyTypescript.isArrowFunction(node) || lazyTypescript.isFunctionExpression(node) || lazyTypescript.isCallExpression(node) || lazyTypescript.isNewExpression(node)) {
|
|
22093
22112
|
return true;
|
|
22094
22113
|
}
|
|
22095
|
-
if (
|
|
22114
|
+
if (lazyTypescript.isConditionalExpression(node)) {
|
|
22096
22115
|
return initializerShapeIsStructural(node.whenTrue) || initializerShapeIsStructural(node.whenFalse);
|
|
22097
22116
|
}
|
|
22098
|
-
if (
|
|
22117
|
+
if (lazyTypescript.isParenthesizedExpression(node)) {
|
|
22099
22118
|
return initializerShapeIsStructural(node.expression);
|
|
22100
22119
|
}
|
|
22101
|
-
if (
|
|
22120
|
+
if (lazyTypescript.isAsExpression(node) || lazyTypescript.isTypeAssertionExpression(node)) {
|
|
22102
22121
|
return initializerShapeIsStructural(node.expression);
|
|
22103
22122
|
}
|
|
22104
|
-
if (
|
|
22123
|
+
if (lazyTypescript.isNonNullExpression(node)) {
|
|
22105
22124
|
return initializerShapeIsStructural(node.expression);
|
|
22106
22125
|
}
|
|
22107
|
-
if (
|
|
22126
|
+
if (lazyTypescript.isObjectLiteralExpression(node)) {
|
|
22108
22127
|
for (const prop of node.properties) {
|
|
22109
|
-
if (
|
|
22128
|
+
if (lazyTypescript.isPropertyAssignment(prop) && initializerShapeIsStructural(prop.initializer)) {
|
|
22110
22129
|
return true;
|
|
22111
22130
|
}
|
|
22112
|
-
if (
|
|
22131
|
+
if (lazyTypescript.isShorthandPropertyAssignment(prop))
|
|
22113
22132
|
continue;
|
|
22114
|
-
if (
|
|
22133
|
+
if (lazyTypescript.isSpreadAssignment(prop) && initializerShapeIsStructural(prop.expression)) {
|
|
22115
22134
|
return true;
|
|
22116
22135
|
}
|
|
22117
22136
|
}
|
|
22118
22137
|
return false;
|
|
22119
22138
|
}
|
|
22120
|
-
if (
|
|
22139
|
+
if (lazyTypescript.isArrayLiteralExpression(node)) {
|
|
22121
22140
|
for (const element of node.elements) {
|
|
22122
22141
|
if (initializerShapeIsStructural(element))
|
|
22123
22142
|
return true;
|
|
@@ -22128,7 +22147,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22128
22147
|
}, extractArrowFieldSig = (cls) => {
|
|
22129
22148
|
const entries = [];
|
|
22130
22149
|
for (const member of cls.members) {
|
|
22131
|
-
if (!
|
|
22150
|
+
if (!lazyTypescript.isPropertyDeclaration(member))
|
|
22132
22151
|
continue;
|
|
22133
22152
|
const init = member.initializer;
|
|
22134
22153
|
if (!init)
|
|
@@ -22138,12 +22157,12 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22138
22157
|
const name = member.name.getText();
|
|
22139
22158
|
let bodyText;
|
|
22140
22159
|
try {
|
|
22141
|
-
const printer =
|
|
22142
|
-
newLine:
|
|
22160
|
+
const printer = lazyTypescript.createPrinter({
|
|
22161
|
+
newLine: lazyTypescript.NewLineKind.LineFeed,
|
|
22143
22162
|
omitTrailingSemicolon: true,
|
|
22144
22163
|
removeComments: true
|
|
22145
22164
|
});
|
|
22146
|
-
bodyText = printer.printNode(
|
|
22165
|
+
bodyText = printer.printNode(lazyTypescript.EmitHint.Unspecified, init, cls.getSourceFile());
|
|
22147
22166
|
} catch {
|
|
22148
22167
|
bodyText = init.getText();
|
|
22149
22168
|
}
|
|
@@ -22154,9 +22173,9 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22154
22173
|
}, INPUT_OUTPUT_DECORATORS, extractMemberDecoratorSig = (cls) => {
|
|
22155
22174
|
const entries = [];
|
|
22156
22175
|
for (const member of cls.members) {
|
|
22157
|
-
if (!
|
|
22176
|
+
if (!lazyTypescript.canHaveDecorators(member))
|
|
22158
22177
|
continue;
|
|
22159
|
-
const decorators =
|
|
22178
|
+
const decorators = lazyTypescript.getDecorators(member) ?? [];
|
|
22160
22179
|
if (decorators.length === 0)
|
|
22161
22180
|
continue;
|
|
22162
22181
|
const memberName = member.name?.getText() ?? "<anon>";
|
|
@@ -22164,14 +22183,14 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22164
22183
|
const expr = decorator.expression;
|
|
22165
22184
|
let decName = "<unknown>";
|
|
22166
22185
|
let argText = "";
|
|
22167
|
-
if (
|
|
22168
|
-
if (
|
|
22186
|
+
if (lazyTypescript.isCallExpression(expr)) {
|
|
22187
|
+
if (lazyTypescript.isIdentifier(expr.expression)) {
|
|
22169
22188
|
decName = expr.expression.text;
|
|
22170
22189
|
}
|
|
22171
22190
|
if (expr.arguments.length > 0) {
|
|
22172
22191
|
argText = expr.arguments.map((leftValue) => leftValue.getText()).join(",");
|
|
22173
22192
|
}
|
|
22174
|
-
} else if (
|
|
22193
|
+
} else if (lazyTypescript.isIdentifier(expr)) {
|
|
22175
22194
|
decName = expr.text;
|
|
22176
22195
|
}
|
|
22177
22196
|
if (INPUT_OUTPUT_DECORATORS.has(decName))
|
|
@@ -22196,18 +22215,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22196
22215
|
} catch {
|
|
22197
22216
|
return true;
|
|
22198
22217
|
}
|
|
22199
|
-
const sourceFile =
|
|
22218
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
|
|
22200
22219
|
let hasProviders = false;
|
|
22201
22220
|
const visit = (node) => {
|
|
22202
22221
|
if (hasProviders)
|
|
22203
22222
|
return;
|
|
22204
|
-
if (
|
|
22205
|
-
for (const decorator of
|
|
22223
|
+
if (lazyTypescript.isClassDeclaration(node)) {
|
|
22224
|
+
for (const decorator of lazyTypescript.getDecorators(node) ?? []) {
|
|
22206
22225
|
const expr = decorator.expression;
|
|
22207
|
-
if (!
|
|
22226
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
22208
22227
|
continue;
|
|
22209
22228
|
const [arg] = expr.arguments;
|
|
22210
|
-
if (!arg || !
|
|
22229
|
+
if (!arg || !lazyTypescript.isObjectLiteralExpression(arg))
|
|
22211
22230
|
continue;
|
|
22212
22231
|
if (getProperty(arg, "providers") !== null) {
|
|
22213
22232
|
hasProviders = true;
|
|
@@ -22215,7 +22234,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22215
22234
|
}
|
|
22216
22235
|
}
|
|
22217
22236
|
}
|
|
22218
|
-
|
|
22237
|
+
lazyTypescript.forEachChild(node, visit);
|
|
22219
22238
|
};
|
|
22220
22239
|
visit(sourceFile);
|
|
22221
22240
|
providerProbeCache.set(filePath, {
|
|
@@ -22225,10 +22244,10 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22225
22244
|
return hasProviders;
|
|
22226
22245
|
}, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
|
|
22227
22246
|
for (const stmt of sourceFile.statements) {
|
|
22228
|
-
if (!
|
|
22247
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
22229
22248
|
continue;
|
|
22230
22249
|
const moduleSpec = stmt.moduleSpecifier;
|
|
22231
|
-
if (!
|
|
22250
|
+
if (!lazyTypescript.isStringLiteral(moduleSpec))
|
|
22232
22251
|
continue;
|
|
22233
22252
|
const spec = moduleSpec.text;
|
|
22234
22253
|
if (!spec.startsWith(".") && !spec.startsWith("/"))
|
|
@@ -22242,7 +22261,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22242
22261
|
}
|
|
22243
22262
|
if (importClause.namedBindings) {
|
|
22244
22263
|
const item = importClause.namedBindings;
|
|
22245
|
-
if (
|
|
22264
|
+
if (lazyTypescript.isNamespaceImport(item)) {
|
|
22246
22265
|
if (item.name.text === identifierName)
|
|
22247
22266
|
matches = true;
|
|
22248
22267
|
} else {
|
|
@@ -22272,7 +22291,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22272
22291
|
return [];
|
|
22273
22292
|
const sig = [];
|
|
22274
22293
|
for (const entry of importsExpr.elements) {
|
|
22275
|
-
if (
|
|
22294
|
+
if (lazyTypescript.isIdentifier(entry)) {
|
|
22276
22295
|
const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
|
|
22277
22296
|
if (importPath) {
|
|
22278
22297
|
if (fileHasModuleProviders(importPath)) {
|
|
@@ -22289,14 +22308,14 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22289
22308
|
}
|
|
22290
22309
|
return sig.sort();
|
|
22291
22310
|
}, getPropertyNameText = (name) => {
|
|
22292
|
-
if (
|
|
22311
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name) || lazyTypescript.isNoSubstitutionTemplateLiteral(name)) {
|
|
22293
22312
|
return name.text;
|
|
22294
22313
|
}
|
|
22295
22314
|
return name.getText();
|
|
22296
22315
|
}, extractPropertyFieldNames = (cls) => {
|
|
22297
22316
|
const names = [];
|
|
22298
22317
|
for (const member of cls.members) {
|
|
22299
|
-
if (!
|
|
22318
|
+
if (!lazyTypescript.isPropertyDeclaration(member) && !lazyTypescript.isMethodDeclaration(member) && !lazyTypescript.isGetAccessorDeclaration(member) && !lazyTypescript.isSetAccessorDeclaration(member)) {
|
|
22300
22319
|
continue;
|
|
22301
22320
|
}
|
|
22302
22321
|
const { name } = member;
|
|
@@ -22310,7 +22329,7 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22310
22329
|
}, extractTopLevelImports = (sourceFile) => {
|
|
22311
22330
|
const names = new Set;
|
|
22312
22331
|
for (const stmt of sourceFile.statements) {
|
|
22313
|
-
if (!
|
|
22332
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
22314
22333
|
continue;
|
|
22315
22334
|
const clause = stmt.importClause;
|
|
22316
22335
|
if (!clause)
|
|
@@ -22322,9 +22341,9 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22322
22341
|
const bindings = clause.namedBindings;
|
|
22323
22342
|
if (!bindings)
|
|
22324
22343
|
continue;
|
|
22325
|
-
if (
|
|
22344
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
22326
22345
|
names.add(bindings.name.text);
|
|
22327
|
-
} else if (
|
|
22346
|
+
} else if (lazyTypescript.isNamedImports(bindings)) {
|
|
22328
22347
|
for (const element of bindings.elements) {
|
|
22329
22348
|
if (element.isTypeOnly)
|
|
22330
22349
|
continue;
|
|
@@ -22336,18 +22355,18 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22336
22355
|
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
|
|
22337
22356
|
const ctorParamTypes = [];
|
|
22338
22357
|
for (const member of cls.members) {
|
|
22339
|
-
if (!
|
|
22358
|
+
if (!lazyTypescript.isConstructorDeclaration(member))
|
|
22340
22359
|
continue;
|
|
22341
22360
|
for (const param of member.parameters) {
|
|
22342
22361
|
const typeText = param.type ? param.type.getText() : "";
|
|
22343
|
-
const decorators =
|
|
22362
|
+
const decorators = lazyTypescript.getDecorators(param) ?? [];
|
|
22344
22363
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d) => {
|
|
22345
22364
|
const expr = d.expression;
|
|
22346
|
-
if (
|
|
22365
|
+
if (lazyTypescript.isCallExpression(expr) && lazyTypescript.isIdentifier(expr.expression)) {
|
|
22347
22366
|
const args = expr.arguments.map((a) => a.getText()).join(",");
|
|
22348
22367
|
return `@${expr.expression.text}(${args})`;
|
|
22349
22368
|
}
|
|
22350
|
-
if (
|
|
22369
|
+
if (lazyTypescript.isIdentifier(expr)) {
|
|
22351
22370
|
return `@${expr.text}`;
|
|
22352
22371
|
}
|
|
22353
22372
|
return "@<unknown>";
|
|
@@ -22363,12 +22382,12 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22363
22382
|
const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
|
|
22364
22383
|
const topLevelImports = extractTopLevelImports(sourceFile);
|
|
22365
22384
|
const propertyFieldNames = extractPropertyFieldNames(cls);
|
|
22366
|
-
const printer =
|
|
22367
|
-
newLine:
|
|
22385
|
+
const printer = lazyTypescript.createPrinter({
|
|
22386
|
+
newLine: lazyTypescript.NewLineKind.LineFeed,
|
|
22368
22387
|
omitTrailingSemicolon: true,
|
|
22369
22388
|
removeComments: true
|
|
22370
22389
|
});
|
|
22371
|
-
const canonicalText = (node) => printer.printNode(
|
|
22390
|
+
const canonicalText = (node) => printer.printNode(lazyTypescript.EmitHint.Unspecified, node, sourceFile);
|
|
22372
22391
|
const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
|
|
22373
22392
|
const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
|
|
22374
22393
|
const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
|
|
@@ -22381,13 +22400,13 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22381
22400
|
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
22382
22401
|
const pageExportEntries = [];
|
|
22383
22402
|
for (const stmt of sourceFile.statements) {
|
|
22384
|
-
if (!
|
|
22403
|
+
if (!lazyTypescript.isVariableStatement(stmt))
|
|
22385
22404
|
continue;
|
|
22386
|
-
const isExported = stmt.modifiers?.some((item) => item.kind ===
|
|
22405
|
+
const isExported = stmt.modifiers?.some((item) => item.kind === lazyTypescript.SyntaxKind.ExportKeyword);
|
|
22387
22406
|
if (!isExported)
|
|
22388
22407
|
continue;
|
|
22389
22408
|
for (const decl of stmt.declarationList.declarations) {
|
|
22390
|
-
if (!
|
|
22409
|
+
if (!lazyTypescript.isIdentifier(decl.name))
|
|
22391
22410
|
continue;
|
|
22392
22411
|
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
22393
22412
|
continue;
|
|
@@ -22428,35 +22447,35 @@ var fail2 = (reason, detail, location) => ({
|
|
|
22428
22447
|
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
22429
22448
|
const memberSources = [];
|
|
22430
22449
|
let hasStatic = false;
|
|
22431
|
-
const printer =
|
|
22450
|
+
const printer = lazyTypescript.createPrinter({ removeComments: true });
|
|
22432
22451
|
for (const member of classNode.members) {
|
|
22433
|
-
if (
|
|
22434
|
-
const modifiers = (
|
|
22435
|
-
const cleaned =
|
|
22436
|
-
memberSources.push(printer.printNode(
|
|
22452
|
+
if (lazyTypescript.isPropertyDeclaration(member)) {
|
|
22453
|
+
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);
|
|
22454
|
+
const cleaned = lazyTypescript.factory.createPropertyDeclaration(modifiers, member.name, undefined, undefined, member.initializer);
|
|
22455
|
+
memberSources.push(printer.printNode(lazyTypescript.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
22437
22456
|
continue;
|
|
22438
22457
|
}
|
|
22439
|
-
if (
|
|
22440
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
22441
|
-
const cleaned =
|
|
22442
|
-
memberSources.push(printer.printNode(
|
|
22458
|
+
if (lazyTypescript.isConstructorDeclaration(member)) {
|
|
22459
|
+
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));
|
|
22460
|
+
const cleaned = lazyTypescript.factory.createConstructorDeclaration([], cleanedParams, member.body);
|
|
22461
|
+
memberSources.push(printer.printNode(lazyTypescript.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
22443
22462
|
continue;
|
|
22444
22463
|
}
|
|
22445
|
-
if (
|
|
22446
|
-
const modifiers =
|
|
22447
|
-
const isStatic = modifiers.some((m) => m.kind ===
|
|
22464
|
+
if (lazyTypescript.isMethodDeclaration(member) || lazyTypescript.isGetAccessorDeclaration(member) || lazyTypescript.isSetAccessorDeclaration(member)) {
|
|
22465
|
+
const modifiers = lazyTypescript.getModifiers(member) ?? [];
|
|
22466
|
+
const isStatic = modifiers.some((m) => m.kind === lazyTypescript.SyntaxKind.StaticKeyword);
|
|
22448
22467
|
if (isStatic)
|
|
22449
22468
|
hasStatic = true;
|
|
22450
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
22469
|
+
const cleanedParams = member.parameters.map((param) => lazyTypescript.factory.updateParameterDeclaration(param, lazyTypescript.getModifiers(param) ?? [], param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
22451
22470
|
let cleaned;
|
|
22452
|
-
if (
|
|
22453
|
-
cleaned =
|
|
22454
|
-
} else if (
|
|
22455
|
-
cleaned =
|
|
22471
|
+
if (lazyTypescript.isMethodDeclaration(member)) {
|
|
22472
|
+
cleaned = lazyTypescript.factory.createMethodDeclaration(modifiers, member.asteriskToken, member.name, member.questionToken, member.typeParameters, cleanedParams, member.type, member.body);
|
|
22473
|
+
} else if (lazyTypescript.isGetAccessorDeclaration(member)) {
|
|
22474
|
+
cleaned = lazyTypescript.factory.createGetAccessorDeclaration(modifiers, member.name, cleanedParams, member.type, member.body);
|
|
22456
22475
|
} else {
|
|
22457
|
-
cleaned =
|
|
22476
|
+
cleaned = lazyTypescript.factory.createSetAccessorDeclaration(modifiers, member.name, cleanedParams, member.body);
|
|
22458
22477
|
}
|
|
22459
|
-
const printed = printer.printNode(
|
|
22478
|
+
const printed = printer.printNode(lazyTypescript.EmitHint.Unspecified, cleaned, classNode.getSourceFile());
|
|
22460
22479
|
memberSources.push(printed);
|
|
22461
22480
|
}
|
|
22462
22481
|
}
|
|
@@ -22468,10 +22487,10 @@ ${memberSources.join(`
|
|
|
22468
22487
|
}`;
|
|
22469
22488
|
let transpiled;
|
|
22470
22489
|
try {
|
|
22471
|
-
transpiled =
|
|
22490
|
+
transpiled = lazyTypescript.transpileModule(wrappedSource, {
|
|
22472
22491
|
compilerOptions: {
|
|
22473
|
-
module:
|
|
22474
|
-
target:
|
|
22492
|
+
module: lazyTypescript.ModuleKind.ES2022,
|
|
22493
|
+
target: lazyTypescript.ScriptTarget.ES2022
|
|
22475
22494
|
},
|
|
22476
22495
|
reportDiagnostics: false
|
|
22477
22496
|
}).outputText;
|
|
@@ -22556,7 +22575,7 @@ ${block}
|
|
|
22556
22575
|
if (existsSync37(tsconfigPath)) {
|
|
22557
22576
|
try {
|
|
22558
22577
|
const text = readFileSync33(tsconfigPath, "utf8");
|
|
22559
|
-
const parsed =
|
|
22578
|
+
const parsed = lazyTypescript.parseConfigFileTextToJson(tsconfigPath, text);
|
|
22560
22579
|
if (!parsed.error && parsed.config) {
|
|
22561
22580
|
const cfg = parsed.config;
|
|
22562
22581
|
const ang = cfg.angularCompilerOptions ?? {};
|
|
@@ -22590,7 +22609,7 @@ ${block}
|
|
|
22590
22609
|
return fail2("unexpected-error", `import @angular/compiler: ${err}`);
|
|
22591
22610
|
}
|
|
22592
22611
|
const tsSource = readFileSync33(componentFilePath, "utf8");
|
|
22593
|
-
const sourceFile =
|
|
22612
|
+
const sourceFile = lazyTypescript.createSourceFile(componentFilePath, tsSource, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
|
|
22594
22613
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
22595
22614
|
if (!classNode) {
|
|
22596
22615
|
return fail2("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -22719,7 +22738,7 @@ ${block}
|
|
|
22719
22738
|
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),
|
|
22720
22739
|
isStandalone: decoratorMeta.standalone,
|
|
22721
22740
|
lifecycle: {
|
|
22722
|
-
usesOnChanges: classNode.members.some((m) =>
|
|
22741
|
+
usesOnChanges: classNode.members.some((m) => lazyTypescript.isMethodDeclaration(m) && m.name !== undefined && lazyTypescript.isIdentifier(m.name) && m.name.text === "ngOnChanges")
|
|
22723
22742
|
},
|
|
22724
22743
|
name: className,
|
|
22725
22744
|
outputs,
|
|
@@ -22768,18 +22787,18 @@ ${block}
|
|
|
22768
22787
|
}
|
|
22769
22788
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
22770
22789
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
22771
|
-
if (!
|
|
22790
|
+
if (!lazyTypescript.isFunctionDeclaration(tsFunctionDecl)) {
|
|
22772
22791
|
return fail2("unexpected-error", "Angular HMR callback did not translate to a function declaration");
|
|
22773
22792
|
}
|
|
22774
|
-
const exportedDecl =
|
|
22775
|
-
|
|
22776
|
-
|
|
22793
|
+
const exportedDecl = lazyTypescript.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
22794
|
+
lazyTypescript.factory.createToken(lazyTypescript.SyntaxKind.ExportKeyword),
|
|
22795
|
+
lazyTypescript.factory.createToken(lazyTypescript.SyntaxKind.DefaultKeyword)
|
|
22777
22796
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
22778
|
-
const printer =
|
|
22779
|
-
newLine:
|
|
22797
|
+
const printer = lazyTypescript.createPrinter({
|
|
22798
|
+
newLine: lazyTypescript.NewLineKind.LineFeed,
|
|
22780
22799
|
removeComments: false
|
|
22781
22800
|
});
|
|
22782
|
-
const fnText = printer.printNode(
|
|
22801
|
+
const fnText = printer.printNode(lazyTypescript.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
22783
22802
|
const provisionalMethodsBlock = buildFreshClassMethodsBlock(classNode, className) ?? "";
|
|
22784
22803
|
const referencedNames = new Set;
|
|
22785
22804
|
const identRe = /[A-Za-z_$][A-Za-z0-9_$]*/g;
|
|
@@ -22789,32 +22808,32 @@ ${block}
|
|
|
22789
22808
|
}
|
|
22790
22809
|
const sourceScopeNames = new Set;
|
|
22791
22810
|
for (const stmt of sourceFile.statements) {
|
|
22792
|
-
if (
|
|
22793
|
-
if (!
|
|
22811
|
+
if (lazyTypescript.isImportDeclaration(stmt)) {
|
|
22812
|
+
if (!lazyTypescript.isStringLiteral(stmt.moduleSpecifier))
|
|
22794
22813
|
continue;
|
|
22795
22814
|
const clause = stmt.importClause;
|
|
22796
22815
|
if (clause?.name)
|
|
22797
22816
|
sourceScopeNames.add(clause.name.text);
|
|
22798
|
-
if (clause?.namedBindings &&
|
|
22817
|
+
if (clause?.namedBindings && lazyTypescript.isNamedImports(clause.namedBindings)) {
|
|
22799
22818
|
for (const element of clause.namedBindings.elements) {
|
|
22800
22819
|
if (element.isTypeOnly)
|
|
22801
22820
|
continue;
|
|
22802
22821
|
sourceScopeNames.add(element.name.text);
|
|
22803
22822
|
}
|
|
22804
|
-
} else if (clause?.namedBindings &&
|
|
22823
|
+
} else if (clause?.namedBindings && lazyTypescript.isNamespaceImport(clause.namedBindings)) {
|
|
22805
22824
|
sourceScopeNames.add(clause.namedBindings.name.text);
|
|
22806
22825
|
}
|
|
22807
22826
|
continue;
|
|
22808
22827
|
}
|
|
22809
|
-
if (
|
|
22828
|
+
if (lazyTypescript.isVariableStatement(stmt)) {
|
|
22810
22829
|
for (const decl of stmt.declarationList.declarations) {
|
|
22811
|
-
if (
|
|
22830
|
+
if (lazyTypescript.isIdentifier(decl.name)) {
|
|
22812
22831
|
sourceScopeNames.add(decl.name.text);
|
|
22813
22832
|
}
|
|
22814
22833
|
}
|
|
22815
22834
|
continue;
|
|
22816
22835
|
}
|
|
22817
|
-
if (
|
|
22836
|
+
if (lazyTypescript.isFunctionDeclaration(stmt) || lazyTypescript.isClassDeclaration(stmt)) {
|
|
22818
22837
|
if (stmt.name)
|
|
22819
22838
|
sourceScopeNames.add(stmt.name.text);
|
|
22820
22839
|
}
|
|
@@ -22825,7 +22844,7 @@ ${block}
|
|
|
22825
22844
|
}
|
|
22826
22845
|
const allImportedNames = new Set;
|
|
22827
22846
|
for (const stmt of sourceFile.statements) {
|
|
22828
|
-
if (!
|
|
22847
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
22829
22848
|
continue;
|
|
22830
22849
|
const clause = stmt.importClause;
|
|
22831
22850
|
if (!clause || clause.isTypeOnly)
|
|
@@ -22835,7 +22854,7 @@ ${block}
|
|
|
22835
22854
|
const bindings = clause.namedBindings;
|
|
22836
22855
|
if (!bindings)
|
|
22837
22856
|
continue;
|
|
22838
|
-
if (
|
|
22857
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
22839
22858
|
allImportedNames.add(bindings.name.text);
|
|
22840
22859
|
} else {
|
|
22841
22860
|
for (const element of bindings.elements) {
|
|
@@ -22847,10 +22866,10 @@ ${block}
|
|
|
22847
22866
|
}
|
|
22848
22867
|
const depsToDestructure = [...sourceScopeNames].filter((n) => referencedNames.has(n) || allImportedNames.has(n));
|
|
22849
22868
|
const tsSourceText = fnText;
|
|
22850
|
-
const transpiled =
|
|
22869
|
+
const transpiled = lazyTypescript.transpileModule(tsSourceText, {
|
|
22851
22870
|
compilerOptions: {
|
|
22852
|
-
module:
|
|
22853
|
-
target:
|
|
22871
|
+
module: lazyTypescript.ModuleKind.ES2022,
|
|
22872
|
+
target: lazyTypescript.ScriptTarget.ES2022
|
|
22854
22873
|
},
|
|
22855
22874
|
fileName: componentFilePath,
|
|
22856
22875
|
reportDiagnostics: false
|
|
@@ -22907,6 +22926,7 @@ ${methodsBlock}
|
|
|
22907
22926
|
}
|
|
22908
22927
|
};
|
|
22909
22928
|
var init_fastHmrCompiler = __esm(() => {
|
|
22929
|
+
init_lazyTypescript();
|
|
22910
22930
|
init_stylePreprocessor();
|
|
22911
22931
|
init_hmrImportGenerator();
|
|
22912
22932
|
init_typescript_translator();
|
|
@@ -22963,11 +22983,10 @@ var init_fastHmrCompiler = __esm(() => {
|
|
|
22963
22983
|
// src/build/scanVueSsrOnlyPages.ts
|
|
22964
22984
|
import { readdirSync as readdirSync3, readFileSync as readFileSync34 } from "fs";
|
|
22965
22985
|
import { join as join47 } from "path";
|
|
22966
|
-
import ts13 from "typescript";
|
|
22967
22986
|
var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
22968
22987
|
if (filePath.endsWith(".tsx"))
|
|
22969
|
-
return
|
|
22970
|
-
return
|
|
22988
|
+
return lazyTypescript.ScriptKind.TSX;
|
|
22989
|
+
return lazyTypescript.ScriptKind.TS;
|
|
22971
22990
|
}, hasSourceExtension2 = (filePath) => {
|
|
22972
22991
|
const idx = filePath.lastIndexOf(".");
|
|
22973
22992
|
if (idx === -1)
|
|
@@ -23003,51 +23022,51 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
23003
23022
|
}
|
|
23004
23023
|
return out;
|
|
23005
23024
|
}, fileMayContainVueHandler = (source) => source.includes("handleVuePageRequest"), isHandleVuePageRequestCallee = (expression) => {
|
|
23006
|
-
if (
|
|
23025
|
+
if (lazyTypescript.isIdentifier(expression)) {
|
|
23007
23026
|
return expression.text === "handleVuePageRequest";
|
|
23008
23027
|
}
|
|
23009
|
-
if (
|
|
23028
|
+
if (lazyTypescript.isPropertyAccessExpression(expression) && lazyTypescript.isIdentifier(expression.name)) {
|
|
23010
23029
|
return expression.name.text === "handleVuePageRequest";
|
|
23011
23030
|
}
|
|
23012
23031
|
return false;
|
|
23013
23032
|
}, getPropertyName = (name) => {
|
|
23014
|
-
if (
|
|
23033
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name)) {
|
|
23015
23034
|
return name.text;
|
|
23016
23035
|
}
|
|
23017
23036
|
return null;
|
|
23018
23037
|
}, unwrapExpression = (node) => {
|
|
23019
|
-
if (
|
|
23038
|
+
if (lazyTypescript.isAsExpression(node) || lazyTypescript.isSatisfiesExpression(node) || lazyTypescript.isParenthesizedExpression(node) || lazyTypescript.isTypeAssertionExpression(node)) {
|
|
23020
23039
|
return unwrapExpression(node.expression);
|
|
23021
23040
|
}
|
|
23022
23041
|
return node;
|
|
23023
23042
|
}, readLiteral = (node) => {
|
|
23024
23043
|
const inner = unwrapExpression(node);
|
|
23025
|
-
if (
|
|
23044
|
+
if (lazyTypescript.isStringLiteral(inner) || lazyTypescript.isNoSubstitutionTemplateLiteral(inner)) {
|
|
23026
23045
|
return inner.text;
|
|
23027
23046
|
}
|
|
23028
23047
|
return null;
|
|
23029
|
-
}, isConstDeclaration = (declaration) =>
|
|
23048
|
+
}, isConstDeclaration = (declaration) => lazyTypescript.isVariableDeclarationList(declaration.parent) && (declaration.parent.flags & lazyTypescript.NodeFlags.Const) !== 0, collectConstStrings = (sourceFile) => {
|
|
23030
23049
|
const constants = new Map;
|
|
23031
23050
|
const visit = (node) => {
|
|
23032
|
-
if (
|
|
23051
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.initializer && isConstDeclaration(node)) {
|
|
23033
23052
|
const name = node.name.text;
|
|
23034
23053
|
const value = readLiteral(node.initializer);
|
|
23035
23054
|
const known = constants.has(name);
|
|
23036
23055
|
constants.set(name, known && constants.get(name) !== value ? null : value);
|
|
23037
23056
|
}
|
|
23038
|
-
|
|
23057
|
+
lazyTypescript.forEachChild(node, visit);
|
|
23039
23058
|
};
|
|
23040
|
-
|
|
23059
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
23041
23060
|
return constants;
|
|
23042
23061
|
}, readStringValue = (node, constants) => {
|
|
23043
23062
|
const inner = unwrapExpression(node);
|
|
23044
|
-
if (
|
|
23063
|
+
if (lazyTypescript.isIdentifier(inner))
|
|
23045
23064
|
return constants.get(inner.text) ?? null;
|
|
23046
23065
|
return readLiteral(inner);
|
|
23047
23066
|
}, isAssetCall = (node) => {
|
|
23048
|
-
if (!
|
|
23067
|
+
if (!lazyTypescript.isCallExpression(node))
|
|
23049
23068
|
return false;
|
|
23050
|
-
if (!
|
|
23069
|
+
if (!lazyTypescript.isIdentifier(node.expression))
|
|
23051
23070
|
return false;
|
|
23052
23071
|
return node.expression.text === "asset";
|
|
23053
23072
|
}, extractAssetLiteralKey = (call, constants) => {
|
|
@@ -23060,14 +23079,14 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
23060
23079
|
}, extractPagePathAssetKey = (initializer, constants) => {
|
|
23061
23080
|
if (!isAssetCall(initializer))
|
|
23062
23081
|
return null;
|
|
23063
|
-
if (!
|
|
23082
|
+
if (!lazyTypescript.isCallExpression(initializer))
|
|
23064
23083
|
return null;
|
|
23065
23084
|
return extractAssetLiteralKey(initializer, constants);
|
|
23066
23085
|
}, readProperty = (property) => {
|
|
23067
|
-
if (
|
|
23086
|
+
if (lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
23068
23087
|
return { name: property.name.text, value: property.name };
|
|
23069
23088
|
}
|
|
23070
|
-
if (!
|
|
23089
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
23071
23090
|
return null;
|
|
23072
23091
|
const name = getPropertyName(property.name);
|
|
23073
23092
|
return name ? { name, value: property.initializer } : null;
|
|
@@ -23099,20 +23118,20 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
23099
23118
|
}
|
|
23100
23119
|
if (!fileMayContainVueHandler(source))
|
|
23101
23120
|
return [];
|
|
23102
|
-
const sourceFile =
|
|
23121
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind3(filePath));
|
|
23103
23122
|
const constants = collectConstStrings(sourceFile);
|
|
23104
23123
|
const visit = (node) => {
|
|
23105
|
-
if (
|
|
23124
|
+
if (lazyTypescript.isCallExpression(node) && isHandleVuePageRequestCallee(node.expression)) {
|
|
23106
23125
|
const firstArg = node.arguments[0];
|
|
23107
|
-
if (firstArg &&
|
|
23126
|
+
if (firstArg && lazyTypescript.isObjectLiteralExpression(firstArg)) {
|
|
23108
23127
|
const pageName = extractSsrOnlyPageName(firstArg, constants);
|
|
23109
23128
|
if (pageName)
|
|
23110
23129
|
out.add(pageName);
|
|
23111
23130
|
}
|
|
23112
23131
|
}
|
|
23113
|
-
|
|
23132
|
+
lazyTypescript.forEachChild(node, visit);
|
|
23114
23133
|
};
|
|
23115
|
-
|
|
23134
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
23116
23135
|
return [...out];
|
|
23117
23136
|
}, ssrOnlyNameCache, scanVueSsrOnlyPages = (projectRoot, memoise = false) => {
|
|
23118
23137
|
const files = collectSourceFiles2(projectRoot);
|
|
@@ -23127,6 +23146,7 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
23127
23146
|
return ssrOnlyPageNames;
|
|
23128
23147
|
};
|
|
23129
23148
|
var init_scanVueSsrOnlyPages = __esm(() => {
|
|
23149
|
+
init_lazyTypescript();
|
|
23130
23150
|
init_stampedFileCache();
|
|
23131
23151
|
SKIP_DIRS2 = new Set([
|
|
23132
23152
|
".absolutejs",
|
|
@@ -23147,11 +23167,10 @@ var init_scanVueSsrOnlyPages = __esm(() => {
|
|
|
23147
23167
|
// src/build/scanAngularHandlerCalls.ts
|
|
23148
23168
|
import { readdirSync as readdirSync4, readFileSync as readFileSync35 } from "fs";
|
|
23149
23169
|
import { join as join48 } from "path";
|
|
23150
|
-
import ts14 from "typescript";
|
|
23151
23170
|
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PREFIX = ".absolutejs-hmr-", getScriptKind4 = (filePath) => {
|
|
23152
23171
|
if (filePath.endsWith(".tsx"))
|
|
23153
|
-
return
|
|
23154
|
-
return
|
|
23172
|
+
return lazyTypescript.ScriptKind.TSX;
|
|
23173
|
+
return lazyTypescript.ScriptKind.TS;
|
|
23155
23174
|
}, hasSourceExtension3 = (filePath) => {
|
|
23156
23175
|
const idx = filePath.lastIndexOf(".");
|
|
23157
23176
|
if (idx === -1)
|
|
@@ -23187,25 +23206,25 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
23187
23206
|
}
|
|
23188
23207
|
return out;
|
|
23189
23208
|
}, fileMayContainAngularHandler = (source) => source.includes("handleAngularPageRequest"), extractManifestKey = (pagePathValue) => {
|
|
23190
|
-
if (!
|
|
23209
|
+
if (!lazyTypescript.isCallExpression(pagePathValue))
|
|
23191
23210
|
return null;
|
|
23192
23211
|
const callee = pagePathValue.expression;
|
|
23193
|
-
if (!
|
|
23212
|
+
if (!lazyTypescript.isIdentifier(callee) || callee.text !== "asset")
|
|
23194
23213
|
return null;
|
|
23195
23214
|
const [, second] = pagePathValue.arguments;
|
|
23196
23215
|
if (!second)
|
|
23197
23216
|
return null;
|
|
23198
|
-
if (!
|
|
23217
|
+
if (!lazyTypescript.isStringLiteral(second))
|
|
23199
23218
|
return null;
|
|
23200
23219
|
return second.text;
|
|
23201
23220
|
}, findEnclosingMountPath = (node) => {
|
|
23202
23221
|
let cursor = node.parent;
|
|
23203
23222
|
while (cursor) {
|
|
23204
|
-
if (
|
|
23223
|
+
if (lazyTypescript.isCallExpression(cursor)) {
|
|
23205
23224
|
const callee = cursor.expression;
|
|
23206
|
-
if (
|
|
23225
|
+
if (lazyTypescript.isPropertyAccessExpression(callee) && lazyTypescript.isIdentifier(callee.name) && ELYSIA_ROUTE_METHODS2.has(callee.name.text)) {
|
|
23207
23226
|
const firstArg = cursor.arguments[0];
|
|
23208
|
-
if (firstArg &&
|
|
23227
|
+
if (firstArg && lazyTypescript.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
23209
23228
|
return firstArg.text;
|
|
23210
23229
|
}
|
|
23211
23230
|
}
|
|
@@ -23222,27 +23241,27 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
23222
23241
|
}
|
|
23223
23242
|
if (!fileMayContainAngularHandler(source))
|
|
23224
23243
|
return;
|
|
23225
|
-
const sf =
|
|
23244
|
+
const sf = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind4(filePath));
|
|
23226
23245
|
const visit = (node) => {
|
|
23227
|
-
if (
|
|
23246
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "handleAngularPageRequest") {
|
|
23228
23247
|
const [arg] = node.arguments;
|
|
23229
|
-
if (arg &&
|
|
23248
|
+
if (arg && lazyTypescript.isObjectLiteralExpression(arg)) {
|
|
23230
23249
|
let manifestKey = null;
|
|
23231
23250
|
for (const prop of arg.properties) {
|
|
23232
|
-
if (
|
|
23251
|
+
if (lazyTypescript.isPropertyAssignment(prop)) {
|
|
23233
23252
|
if (!prop.name)
|
|
23234
23253
|
continue;
|
|
23235
|
-
const name =
|
|
23254
|
+
const name = lazyTypescript.isIdentifier(prop.name) ? prop.name.text : lazyTypescript.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
23236
23255
|
if (name === "pagePath") {
|
|
23237
23256
|
manifestKey = extractManifestKey(prop.initializer);
|
|
23238
23257
|
}
|
|
23239
|
-
} else if (
|
|
23258
|
+
} else if (lazyTypescript.isSpreadAssignment(prop)) {
|
|
23240
23259
|
if (manifestKey)
|
|
23241
23260
|
continue;
|
|
23242
23261
|
const spreadExpr = prop.expression;
|
|
23243
|
-
if (
|
|
23262
|
+
if (lazyTypescript.isCallExpression(spreadExpr) && spreadExpr.arguments.length > 0) {
|
|
23244
23263
|
const [firstArg] = spreadExpr.arguments;
|
|
23245
|
-
if (firstArg &&
|
|
23264
|
+
if (firstArg && lazyTypescript.isStringLiteral(firstArg)) {
|
|
23246
23265
|
manifestKey = firstArg.text;
|
|
23247
23266
|
}
|
|
23248
23267
|
}
|
|
@@ -23257,9 +23276,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
23257
23276
|
}
|
|
23258
23277
|
}
|
|
23259
23278
|
}
|
|
23260
|
-
|
|
23279
|
+
lazyTypescript.forEachChild(node, visit);
|
|
23261
23280
|
};
|
|
23262
|
-
|
|
23281
|
+
lazyTypescript.forEachChild(sf, visit);
|
|
23263
23282
|
}, scanAngularHandlerCalls = (projectRoot) => {
|
|
23264
23283
|
const files = collectSourceFiles3(projectRoot);
|
|
23265
23284
|
const collected = [];
|
|
@@ -23269,6 +23288,7 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
23269
23288
|
return collected;
|
|
23270
23289
|
};
|
|
23271
23290
|
var init_scanAngularHandlerCalls = __esm(() => {
|
|
23291
|
+
init_lazyTypescript();
|
|
23272
23292
|
ELYSIA_ROUTE_METHODS2 = new Set([
|
|
23273
23293
|
"all",
|
|
23274
23294
|
"delete",
|
|
@@ -23297,7 +23317,6 @@ var init_scanAngularHandlerCalls = __esm(() => {
|
|
|
23297
23317
|
// src/build/scanAngularPageRoutes.ts
|
|
23298
23318
|
import { readdirSync as readdirSync5, readFileSync as readFileSync36 } from "fs";
|
|
23299
23319
|
import { basename as basename14, join as join49 } from "path";
|
|
23300
|
-
import ts15 from "typescript";
|
|
23301
23320
|
var SOURCE_EXTENSIONS5, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
23302
23321
|
const idx = filePath.lastIndexOf(".");
|
|
23303
23322
|
if (idx === -1)
|
|
@@ -23346,15 +23365,15 @@ var SOURCE_EXTENSIONS5, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
|
23346
23365
|
}, hasTopLevelRoutesExport = (source, filePath) => {
|
|
23347
23366
|
if (!source.includes("routes"))
|
|
23348
23367
|
return false;
|
|
23349
|
-
const sf =
|
|
23368
|
+
const sf = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
23350
23369
|
for (const statement of sf.statements) {
|
|
23351
|
-
if (!
|
|
23370
|
+
if (!lazyTypescript.isVariableStatement(statement))
|
|
23352
23371
|
continue;
|
|
23353
|
-
const isExported = statement.modifiers?.some((modifier) => modifier.kind ===
|
|
23372
|
+
const isExported = statement.modifiers?.some((modifier) => modifier.kind === lazyTypescript.SyntaxKind.ExportKeyword);
|
|
23354
23373
|
if (!isExported)
|
|
23355
23374
|
continue;
|
|
23356
23375
|
for (const declaration of statement.declarationList.declarations) {
|
|
23357
|
-
if (!
|
|
23376
|
+
if (!lazyTypescript.isIdentifier(declaration.name))
|
|
23358
23377
|
continue;
|
|
23359
23378
|
if (declaration.name.text === "routes")
|
|
23360
23379
|
return true;
|
|
@@ -23383,6 +23402,7 @@ var SOURCE_EXTENSIONS5, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
|
23383
23402
|
return out;
|
|
23384
23403
|
};
|
|
23385
23404
|
var init_scanAngularPageRoutes = __esm(() => {
|
|
23405
|
+
init_lazyTypescript();
|
|
23386
23406
|
SOURCE_EXTENSIONS5 = new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
23387
23407
|
SKIP_DIRS4 = new Set([
|
|
23388
23408
|
".absolutejs",
|
|
@@ -23408,44 +23428,43 @@ var init_runAngularHandlerScan = __esm(() => {
|
|
|
23408
23428
|
// src/build/parseAngularConfigImports.ts
|
|
23409
23429
|
import { existsSync as existsSync38, readFileSync as readFileSync37 } from "fs";
|
|
23410
23430
|
import { dirname as dirname27, isAbsolute as isAbsolute9, join as join50 } from "path";
|
|
23411
|
-
import ts16 from "typescript";
|
|
23412
23431
|
var findDefineConfigCall = (sf) => {
|
|
23413
23432
|
let result = null;
|
|
23414
23433
|
const visit = (node) => {
|
|
23415
23434
|
if (result)
|
|
23416
23435
|
return;
|
|
23417
|
-
if (
|
|
23436
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "defineConfig") {
|
|
23418
23437
|
const [arg] = node.arguments;
|
|
23419
|
-
if (arg &&
|
|
23438
|
+
if (arg && lazyTypescript.isObjectLiteralExpression(arg)) {
|
|
23420
23439
|
result = arg;
|
|
23421
23440
|
return;
|
|
23422
23441
|
}
|
|
23423
23442
|
}
|
|
23424
|
-
|
|
23443
|
+
lazyTypescript.forEachChild(node, visit);
|
|
23425
23444
|
};
|
|
23426
|
-
|
|
23445
|
+
lazyTypescript.forEachChild(sf, visit);
|
|
23427
23446
|
return result;
|
|
23428
23447
|
}, findPropertyInitializer = (object, name) => {
|
|
23429
23448
|
for (const prop of object.properties) {
|
|
23430
|
-
if (!
|
|
23449
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
23431
23450
|
continue;
|
|
23432
23451
|
if (!prop.name)
|
|
23433
23452
|
continue;
|
|
23434
|
-
const key =
|
|
23453
|
+
const key = lazyTypescript.isIdentifier(prop.name) ? prop.name.text : lazyTypescript.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
23435
23454
|
if (key === name)
|
|
23436
23455
|
return prop.initializer;
|
|
23437
23456
|
}
|
|
23438
23457
|
return null;
|
|
23439
23458
|
}, findImportForBinding = (sf, binding) => {
|
|
23440
23459
|
for (const statement of sf.statements) {
|
|
23441
|
-
if (!
|
|
23460
|
+
if (!lazyTypescript.isImportDeclaration(statement))
|
|
23442
23461
|
continue;
|
|
23443
|
-
if (!
|
|
23462
|
+
if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
23444
23463
|
continue;
|
|
23445
23464
|
if (statement.importClause?.isTypeOnly)
|
|
23446
23465
|
continue;
|
|
23447
23466
|
const named = statement.importClause?.namedBindings;
|
|
23448
|
-
if (!named || !
|
|
23467
|
+
if (!named || !lazyTypescript.isNamedImports(named))
|
|
23449
23468
|
continue;
|
|
23450
23469
|
for (const element of named.elements) {
|
|
23451
23470
|
if (element.isTypeOnly)
|
|
@@ -23486,17 +23505,17 @@ var findDefineConfigCall = (sf) => {
|
|
|
23486
23505
|
return null;
|
|
23487
23506
|
if (!source.includes("providers"))
|
|
23488
23507
|
return null;
|
|
23489
|
-
const sf =
|
|
23508
|
+
const sf = lazyTypescript.createSourceFile(configPath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
23490
23509
|
const configObject = findDefineConfigCall(sf);
|
|
23491
23510
|
if (!configObject)
|
|
23492
23511
|
return null;
|
|
23493
23512
|
const angularField = findPropertyInitializer(configObject, "angular");
|
|
23494
|
-
if (!angularField || !
|
|
23513
|
+
if (!angularField || !lazyTypescript.isObjectLiteralExpression(angularField))
|
|
23495
23514
|
return null;
|
|
23496
23515
|
const providersField = findPropertyInitializer(angularField, "providers");
|
|
23497
23516
|
if (!providersField)
|
|
23498
23517
|
return null;
|
|
23499
|
-
if (!
|
|
23518
|
+
if (!lazyTypescript.isIdentifier(providersField))
|
|
23500
23519
|
return null;
|
|
23501
23520
|
const binding = providersField.text;
|
|
23502
23521
|
const importInfo = findImportForBinding(sf, binding);
|
|
@@ -23510,7 +23529,9 @@ var findDefineConfigCall = (sf) => {
|
|
|
23510
23529
|
importedName: importInfo.importedName
|
|
23511
23530
|
};
|
|
23512
23531
|
};
|
|
23513
|
-
var init_parseAngularConfigImports = () => {
|
|
23532
|
+
var init_parseAngularConfigImports = __esm(() => {
|
|
23533
|
+
init_lazyTypescript();
|
|
23534
|
+
});
|
|
23514
23535
|
|
|
23515
23536
|
// src/utils/localeRef.ts
|
|
23516
23537
|
var GETTER_KEY2, isRequestLocale = (value) => typeof value === "object" && value !== null && ("locale" in value) && typeof value.locale === "string" && ("dir" in value) && (value.dir === "ltr" || value.dir === "rtl"), escapeAttribute2 = (value) => value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), htmlLangAttributes = (fallback = "en") => {
|
|
@@ -24058,27 +24079,26 @@ var dedupeCssBlocks = (blocks) => {
|
|
|
24058
24079
|
};
|
|
24059
24080
|
|
|
24060
24081
|
// src/build/parseVueSpaRoutes.ts
|
|
24061
|
-
|
|
24062
|
-
|
|
24063
|
-
if (ts17.isCallExpression(node) && node.expression.kind === ts17.SyntaxKind.ImportKeyword) {
|
|
24082
|
+
var propertyName = (node) => lazyTypescript.isIdentifier(node) || lazyTypescript.isStringLiteralLike(node) ? node.text : null, stringValue = (node) => lazyTypescript.isStringLiteralLike(node) ? node.text : null, findVueImport = (node) => {
|
|
24083
|
+
if (lazyTypescript.isCallExpression(node) && node.expression.kind === lazyTypescript.SyntaxKind.ImportKeyword) {
|
|
24064
24084
|
const [specifier] = node.arguments;
|
|
24065
|
-
if (specifier &&
|
|
24085
|
+
if (specifier && lazyTypescript.isStringLiteralLike(specifier)) {
|
|
24066
24086
|
return specifier.text.endsWith(".vue") ? specifier.text : null;
|
|
24067
24087
|
}
|
|
24068
24088
|
}
|
|
24069
24089
|
let found = null;
|
|
24070
|
-
|
|
24090
|
+
lazyTypescript.forEachChild(node, (child) => {
|
|
24071
24091
|
if (found === null)
|
|
24072
24092
|
found = findVueImport(child);
|
|
24073
24093
|
});
|
|
24074
24094
|
return found;
|
|
24075
24095
|
}, parseRoute = (node) => {
|
|
24076
|
-
if (!
|
|
24096
|
+
if (!lazyTypescript.isObjectLiteralExpression(node))
|
|
24077
24097
|
return null;
|
|
24078
24098
|
let path = null;
|
|
24079
24099
|
let importPath = null;
|
|
24080
24100
|
for (const property of node.properties) {
|
|
24081
|
-
if (!
|
|
24101
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
24082
24102
|
continue;
|
|
24083
24103
|
const name = propertyName(property.name);
|
|
24084
24104
|
if (name === "path")
|
|
@@ -24088,12 +24108,12 @@ var propertyName = (node) => ts17.isIdentifier(node) || ts17.isStringLiteralLike
|
|
|
24088
24108
|
}
|
|
24089
24109
|
return path && importPath ? { importPath, path } : null;
|
|
24090
24110
|
}, parseVueSpaRoutes = (source) => {
|
|
24091
|
-
const sourceFile =
|
|
24111
|
+
const sourceFile = lazyTypescript.createSourceFile("absolute-vue-routes.ts", source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
24092
24112
|
const entries = [];
|
|
24093
24113
|
const visit = (node) => {
|
|
24094
|
-
if (
|
|
24114
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "defineRoutes") {
|
|
24095
24115
|
const [routes] = node.arguments;
|
|
24096
|
-
if (routes &&
|
|
24116
|
+
if (routes && lazyTypescript.isArrayLiteralExpression(routes)) {
|
|
24097
24117
|
for (const element of routes.elements) {
|
|
24098
24118
|
const route = parseRoute(element);
|
|
24099
24119
|
if (route)
|
|
@@ -24101,12 +24121,14 @@ var propertyName = (node) => ts17.isIdentifier(node) || ts17.isStringLiteralLike
|
|
|
24101
24121
|
}
|
|
24102
24122
|
}
|
|
24103
24123
|
}
|
|
24104
|
-
|
|
24124
|
+
lazyTypescript.forEachChild(node, visit);
|
|
24105
24125
|
};
|
|
24106
|
-
|
|
24126
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
24107
24127
|
return entries;
|
|
24108
24128
|
};
|
|
24109
|
-
var init_parseVueSpaRoutes = () => {
|
|
24129
|
+
var init_parseVueSpaRoutes = __esm(() => {
|
|
24130
|
+
init_lazyTypescript();
|
|
24131
|
+
});
|
|
24110
24132
|
|
|
24111
24133
|
// src/build/vueAutoRouterTransform.ts
|
|
24112
24134
|
var SCRIPT_REGEX, ROUTES_EXPORT_REGEX, SENTINEL2 = "__ABSOLUTE_AUTO_ROUTER__", SETUP_APP_DECLARATION_REGEX, SETUP_APP_FUNCTION_REGEX, addAutoRouterSetupApp = (sourceContent) => {
|
|
@@ -26485,22 +26507,22 @@ var init_lowerDeferSyntax = __esm(() => {
|
|
|
26485
26507
|
});
|
|
26486
26508
|
|
|
26487
26509
|
// src/build/downlevelAsyncForZone.ts
|
|
26488
|
-
import ts18 from "typescript";
|
|
26489
26510
|
var ASYNC_KEYWORD, downlevelAsyncForZone = (code, fileName) => {
|
|
26490
26511
|
if (!isAngularZoneMode() || !ASYNC_KEYWORD.test(code))
|
|
26491
26512
|
return code;
|
|
26492
|
-
return
|
|
26513
|
+
return lazyTypescript.transpileModule(code, {
|
|
26493
26514
|
compilerOptions: {
|
|
26494
26515
|
importHelpers: false,
|
|
26495
|
-
module:
|
|
26516
|
+
module: lazyTypescript.ModuleKind.ESNext,
|
|
26496
26517
|
sourceMap: false,
|
|
26497
|
-
target:
|
|
26518
|
+
target: lazyTypescript.ScriptTarget.ES2016,
|
|
26498
26519
|
useDefineForClassFields: false
|
|
26499
26520
|
},
|
|
26500
26521
|
fileName: fileName.replace(/\.[cm]?[tj]sx?$/, ".js")
|
|
26501
26522
|
}).outputText;
|
|
26502
26523
|
};
|
|
26503
26524
|
var init_downlevelAsyncForZone = __esm(() => {
|
|
26525
|
+
init_lazyTypescript();
|
|
26504
26526
|
ASYNC_KEYWORD = /\basync\b/;
|
|
26505
26527
|
});
|
|
26506
26528
|
|
|
@@ -26514,7 +26536,6 @@ __export(exports_compileAngular, {
|
|
|
26514
26536
|
import { existsSync as existsSync45, readFileSync as readFileSync43, promises as fs5 } from "fs";
|
|
26515
26537
|
import { join as join57, basename as basename17, sep as sep10, dirname as dirname34, resolve as resolve43, relative as relative26 } from "path";
|
|
26516
26538
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
26517
|
-
import ts19 from "typescript";
|
|
26518
26539
|
var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) => {
|
|
26519
26540
|
const temporaryPath = `${path}.tmp.${process.pid}.${atomicWriteSequence++}`;
|
|
26520
26541
|
try {
|
|
@@ -26529,7 +26550,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
26529
26550
|
}, readTsconfigPathAliases = () => {
|
|
26530
26551
|
try {
|
|
26531
26552
|
const configPath = resolve43(process.cwd(), "tsconfig.json");
|
|
26532
|
-
const config =
|
|
26553
|
+
const config = lazyTypescript.readConfigFile(configPath, lazyTypescript.sys.readFile).config;
|
|
26533
26554
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
26534
26555
|
const baseUrl = resolve43(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
26535
26556
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
@@ -26658,7 +26679,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
26658
26679
|
return resolve43(import.meta.dir, "./dev/client");
|
|
26659
26680
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
26660
26681
|
try {
|
|
26661
|
-
return
|
|
26682
|
+
return lazyTypescript.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
26662
26683
|
`);
|
|
26663
26684
|
} catch {
|
|
26664
26685
|
return String(diagnostic.messageText || "Unknown error");
|
|
@@ -26666,7 +26687,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
26666
26687
|
}, throwOnCompilationErrors = (diagnostics) => {
|
|
26667
26688
|
if (!diagnostics?.length)
|
|
26668
26689
|
return;
|
|
26669
|
-
const errors = diagnostics.filter((diag) => diag.category ===
|
|
26690
|
+
const errors = diagnostics.filter((diag) => diag.category === lazyTypescript.DiagnosticCategory.Error);
|
|
26670
26691
|
if (!errors.length)
|
|
26671
26692
|
return;
|
|
26672
26693
|
const fullMessage = errors.map(formatDiagnosticMessage).join(`
|
|
@@ -26708,22 +26729,22 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
26708
26729
|
}
|
|
26709
26730
|
return `${path}.js${query}`;
|
|
26710
26731
|
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
26711
|
-
const sourceFile =
|
|
26732
|
+
const sourceFile = lazyTypescript.createSourceFile(fileName, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
26712
26733
|
const specifiers = [];
|
|
26713
26734
|
const addSpecifier = (node) => {
|
|
26714
|
-
if (!node || !
|
|
26735
|
+
if (!node || !lazyTypescript.isStringLiteralLike(node))
|
|
26715
26736
|
return;
|
|
26716
26737
|
const specifier = node.text;
|
|
26717
26738
|
if (isRelativeModuleSpecifier(specifier))
|
|
26718
26739
|
specifiers.push(specifier);
|
|
26719
26740
|
};
|
|
26720
26741
|
const visit = (node) => {
|
|
26721
|
-
if (
|
|
26742
|
+
if (lazyTypescript.isImportDeclaration(node) || lazyTypescript.isExportDeclaration(node)) {
|
|
26722
26743
|
addSpecifier(node.moduleSpecifier);
|
|
26723
|
-
} else if (
|
|
26744
|
+
} else if (lazyTypescript.isCallExpression(node) && node.expression.kind === lazyTypescript.SyntaxKind.ImportKeyword) {
|
|
26724
26745
|
addSpecifier(node.arguments[0]);
|
|
26725
26746
|
}
|
|
26726
|
-
|
|
26747
|
+
lazyTypescript.forEachChild(node, visit);
|
|
26727
26748
|
};
|
|
26728
26749
|
visit(sourceFile);
|
|
26729
26750
|
return specifiers;
|
|
@@ -26871,25 +26892,25 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
26871
26892
|
emitDecoratorMetadata: true,
|
|
26872
26893
|
esModuleInterop: true,
|
|
26873
26894
|
experimentalDecorators: true,
|
|
26874
|
-
module:
|
|
26875
|
-
moduleResolution:
|
|
26876
|
-
newLine:
|
|
26895
|
+
module: lazyTypescript.ModuleKind.ESNext,
|
|
26896
|
+
moduleResolution: lazyTypescript.ModuleResolutionKind.Bundler,
|
|
26897
|
+
newLine: lazyTypescript.NewLineKind.LineFeed,
|
|
26877
26898
|
noLib: false,
|
|
26878
26899
|
outDir,
|
|
26879
26900
|
skipLibCheck: true,
|
|
26880
|
-
target:
|
|
26901
|
+
target: lazyTypescript.ScriptTarget.ES2022,
|
|
26881
26902
|
...config.options
|
|
26882
26903
|
};
|
|
26883
|
-
options.target =
|
|
26904
|
+
options.target = lazyTypescript.ScriptTarget.ES2022;
|
|
26884
26905
|
options.experimentalDecorators = true;
|
|
26885
26906
|
options.emitDecoratorMetadata = true;
|
|
26886
|
-
options.newLine =
|
|
26907
|
+
options.newLine = lazyTypescript.NewLineKind.LineFeed;
|
|
26887
26908
|
options.outDir = outDir;
|
|
26888
26909
|
options.noEmit = false;
|
|
26889
26910
|
options.incremental = false;
|
|
26890
26911
|
options.tsBuildInfoFile = undefined;
|
|
26891
26912
|
options.rootDir = process.cwd();
|
|
26892
|
-
const host = await traceAngularPhase("aot/create-compiler-host", () =>
|
|
26913
|
+
const host = await traceAngularPhase("aot/create-compiler-host", () => lazyTypescript.createCompilerHost(options));
|
|
26893
26914
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
26894
26915
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
26895
26916
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
@@ -26935,7 +26956,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
26935
26956
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
26936
26957
|
const source = transformedSources.get(resolve43(fileName));
|
|
26937
26958
|
if (source) {
|
|
26938
|
-
return
|
|
26959
|
+
return lazyTypescript.createSourceFile(fileName, source, languageVersion, true);
|
|
26939
26960
|
}
|
|
26940
26961
|
return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError);
|
|
26941
26962
|
};
|
|
@@ -27464,8 +27485,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
27464
27485
|
}
|
|
27465
27486
|
}
|
|
27466
27487
|
return allOutputs;
|
|
27467
|
-
}, ROUTER_OUTLET_PATTERN, COMPONENT_MARKER_PATTERN, isExportedClass = (statement) =>
|
|
27468
|
-
if (!
|
|
27488
|
+
}, 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) => {
|
|
27489
|
+
if (!lazyTypescript.isExpressionStatement(statement))
|
|
27469
27490
|
return false;
|
|
27470
27491
|
const text = statement.getText(sourceFile);
|
|
27471
27492
|
return new RegExp(`^\\s*${className}\\s*=`).test(text) || new RegExp(`\u0275setClassMetadata\\(\\s*${className}\\b`).test(text);
|
|
@@ -27473,16 +27494,16 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
27473
27494
|
const defaultMatch = source.match(/export\s+default\s+([A-Za-z_$][\w$]*)\s*;/);
|
|
27474
27495
|
if (defaultMatch)
|
|
27475
27496
|
return defaultMatch[1] ?? null;
|
|
27476
|
-
const sourceFile =
|
|
27497
|
+
const sourceFile = lazyTypescript.createSourceFile("page.js", source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.JS);
|
|
27477
27498
|
const exportedNames = new Set;
|
|
27478
27499
|
for (const statement of sourceFile.statements) {
|
|
27479
|
-
if (!
|
|
27500
|
+
if (!lazyTypescript.isExportDeclaration(statement) || statement.moduleSpecifier || !statement.exportClause || !lazyTypescript.isNamedExports(statement.exportClause))
|
|
27480
27501
|
continue;
|
|
27481
27502
|
for (const element of statement.exportClause.elements) {
|
|
27482
27503
|
exportedNames.add((element.propertyName ?? element.name).text);
|
|
27483
27504
|
}
|
|
27484
27505
|
}
|
|
27485
|
-
const candidates = sourceFile.statements.filter(
|
|
27506
|
+
const candidates = sourceFile.statements.filter(lazyTypescript.isClassDeclaration).filter((statement) => isExportedClass(statement) || exportedNames.has(statement.name?.text ?? "")).map((statement) => {
|
|
27486
27507
|
const className = statement.name?.text ?? "";
|
|
27487
27508
|
const related = sourceFile.statements.filter((other) => statementReferencesClass(other, className, sourceFile)).map((other) => other.getText(sourceFile));
|
|
27488
27509
|
const text = [statement.getText(sourceFile), ...related].join(`
|
|
@@ -27909,6 +27930,7 @@ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
|
|
|
27909
27930
|
};
|
|
27910
27931
|
};
|
|
27911
27932
|
var init_compileAngular = __esm(() => {
|
|
27933
|
+
init_lazyTypescript();
|
|
27912
27934
|
init_constants();
|
|
27913
27935
|
init_sourceMetadata();
|
|
27914
27936
|
init_lowerDeferSyntax();
|
|
@@ -33044,7 +33066,6 @@ __export(exports_resolveOwningComponents, {
|
|
|
33044
33066
|
});
|
|
33045
33067
|
import { readdirSync as readdirSync12, readFileSync as readFileSync50, statSync as statSync10 } from "fs";
|
|
33046
33068
|
import { dirname as dirname41, extname as extname19, join as join69, resolve as resolve58 } from "path";
|
|
33047
|
-
import ts20 from "typescript";
|
|
33048
33069
|
var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || file.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
33049
33070
|
const out = [];
|
|
33050
33071
|
const visit = (dir) => {
|
|
@@ -33070,13 +33091,13 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
33070
33091
|
return out;
|
|
33071
33092
|
}, getStringPropertyValue = (obj, name) => {
|
|
33072
33093
|
for (const prop of obj.properties) {
|
|
33073
|
-
if (!
|
|
33094
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
33074
33095
|
continue;
|
|
33075
|
-
const propName =
|
|
33096
|
+
const propName = lazyTypescript.isIdentifier(prop.name) || lazyTypescript.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
33076
33097
|
if (propName !== name)
|
|
33077
33098
|
continue;
|
|
33078
33099
|
const init = prop.initializer;
|
|
33079
|
-
if (
|
|
33100
|
+
if (lazyTypescript.isStringLiteral(init) || lazyTypescript.isNoSubstitutionTemplateLiteral(init)) {
|
|
33080
33101
|
return init.text;
|
|
33081
33102
|
}
|
|
33082
33103
|
}
|
|
@@ -33084,16 +33105,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
33084
33105
|
}, getStringArrayProperty = (obj, name) => {
|
|
33085
33106
|
const out = [];
|
|
33086
33107
|
for (const prop of obj.properties) {
|
|
33087
|
-
if (!
|
|
33108
|
+
if (!lazyTypescript.isPropertyAssignment(prop))
|
|
33088
33109
|
continue;
|
|
33089
|
-
const propName =
|
|
33110
|
+
const propName = lazyTypescript.isIdentifier(prop.name) || lazyTypescript.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
33090
33111
|
if (propName !== name)
|
|
33091
33112
|
continue;
|
|
33092
33113
|
const init = prop.initializer;
|
|
33093
|
-
if (!
|
|
33114
|
+
if (!lazyTypescript.isArrayLiteralExpression(init))
|
|
33094
33115
|
continue;
|
|
33095
33116
|
for (const element of init.elements) {
|
|
33096
|
-
if (
|
|
33117
|
+
if (lazyTypescript.isStringLiteral(element) || lazyTypescript.isNoSubstitutionTemplateLiteral(element)) {
|
|
33097
33118
|
out.push(element.text);
|
|
33098
33119
|
}
|
|
33099
33120
|
}
|
|
@@ -33106,27 +33127,27 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
33106
33127
|
} catch {
|
|
33107
33128
|
return [];
|
|
33108
33129
|
}
|
|
33109
|
-
const sourceFile =
|
|
33130
|
+
const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
|
|
33110
33131
|
const out = [];
|
|
33111
33132
|
const visit = (node) => {
|
|
33112
|
-
if (
|
|
33113
|
-
for (const decorator of
|
|
33133
|
+
if (lazyTypescript.isClassDeclaration(node) && node.name) {
|
|
33134
|
+
for (const decorator of lazyTypescript.getDecorators(node) ?? []) {
|
|
33114
33135
|
const expr = decorator.expression;
|
|
33115
|
-
if (!
|
|
33136
|
+
if (!lazyTypescript.isCallExpression(expr))
|
|
33116
33137
|
continue;
|
|
33117
33138
|
const functionNode = expr.expression;
|
|
33118
|
-
if (!
|
|
33139
|
+
if (!lazyTypescript.isIdentifier(functionNode))
|
|
33119
33140
|
continue;
|
|
33120
33141
|
const kind = ENTITY_DECORATORS[functionNode.text];
|
|
33121
33142
|
if (!kind)
|
|
33122
33143
|
continue;
|
|
33123
33144
|
let extendsName = null;
|
|
33124
33145
|
for (const heritage of node.heritageClauses ?? []) {
|
|
33125
|
-
if (heritage.token !==
|
|
33146
|
+
if (heritage.token !== lazyTypescript.SyntaxKind.ExtendsKeyword) {
|
|
33126
33147
|
continue;
|
|
33127
33148
|
}
|
|
33128
33149
|
const [first] = heritage.types;
|
|
33129
|
-
if (first &&
|
|
33150
|
+
if (first && lazyTypescript.isIdentifier(first.expression)) {
|
|
33130
33151
|
extendsName = first.expression.text;
|
|
33131
33152
|
}
|
|
33132
33153
|
break;
|
|
@@ -33139,7 +33160,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
33139
33160
|
templateUrls: []
|
|
33140
33161
|
};
|
|
33141
33162
|
const [arg] = expr.arguments;
|
|
33142
|
-
if (arg &&
|
|
33163
|
+
if (arg && lazyTypescript.isObjectLiteralExpression(arg) && kind === "component") {
|
|
33143
33164
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
33144
33165
|
if (tplUrl)
|
|
33145
33166
|
entry.templateUrls.push(tplUrl);
|
|
@@ -33152,7 +33173,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
33152
33173
|
break;
|
|
33153
33174
|
}
|
|
33154
33175
|
}
|
|
33155
|
-
|
|
33176
|
+
lazyTypescript.forEachChild(node, visit);
|
|
33156
33177
|
};
|
|
33157
33178
|
visit(sourceFile);
|
|
33158
33179
|
return out;
|
|
@@ -33196,12 +33217,12 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
33196
33217
|
} catch {
|
|
33197
33218
|
return null;
|
|
33198
33219
|
}
|
|
33199
|
-
const sourceFile =
|
|
33220
|
+
const sourceFile = lazyTypescript.createSourceFile(childFilePath, source, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
|
|
33200
33221
|
const childDir = dirname41(childFilePath);
|
|
33201
33222
|
for (const stmt of sourceFile.statements) {
|
|
33202
|
-
if (!
|
|
33223
|
+
if (!lazyTypescript.isImportDeclaration(stmt))
|
|
33203
33224
|
continue;
|
|
33204
|
-
if (!
|
|
33225
|
+
if (!lazyTypescript.isStringLiteral(stmt.moduleSpecifier))
|
|
33205
33226
|
continue;
|
|
33206
33227
|
const clause = stmt.importClause;
|
|
33207
33228
|
if (!clause || clause.isTypeOnly)
|
|
@@ -33209,7 +33230,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
33209
33230
|
let matchesName = false;
|
|
33210
33231
|
if (clause.name && clause.name.text === parentName)
|
|
33211
33232
|
matchesName = true;
|
|
33212
|
-
if (!matchesName && clause.namedBindings &&
|
|
33233
|
+
if (!matchesName && clause.namedBindings && lazyTypescript.isNamedImports(clause.namedBindings)) {
|
|
33213
33234
|
for (const element of clause.namedBindings.elements) {
|
|
33214
33235
|
if (element.isTypeOnly)
|
|
33215
33236
|
continue;
|
|
@@ -33302,6 +33323,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
33302
33323
|
return bundle.parentFile.get(norm) ?? [];
|
|
33303
33324
|
};
|
|
33304
33325
|
var init_resolveOwningComponents = __esm(() => {
|
|
33326
|
+
init_lazyTypescript();
|
|
33305
33327
|
ENTITY_DECORATORS = {
|
|
33306
33328
|
Component: "component",
|
|
33307
33329
|
Directive: "directive",
|
|
@@ -35647,7 +35669,7 @@ var SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, realPath3 = (path) => {
|
|
|
35647
35669
|
} catch {
|
|
35648
35670
|
return path;
|
|
35649
35671
|
}
|
|
35650
|
-
}, typescript,
|
|
35672
|
+
}, typescript, loadTypescript2 = async () => {
|
|
35651
35673
|
typescript ??= await import("typescript");
|
|
35652
35674
|
return typescript;
|
|
35653
35675
|
}, shared, analyses, isHotManaged = (path) => {
|
|
@@ -35698,7 +35720,7 @@ var SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, realPath3 = (path) => {
|
|
|
35698
35720
|
writeFileSync17(cachePath(state.cacheDir, key), JSON.stringify(analysis));
|
|
35699
35721
|
} catch {}
|
|
35700
35722
|
}, analyzeFresh = async (canonicalPath, source) => {
|
|
35701
|
-
const typescriptModule = await
|
|
35723
|
+
const typescriptModule = await loadTypescript2();
|
|
35702
35724
|
return analyzeModule(typescriptModule, canonicalPath, source, resolveFrom2(canonicalPath, isHotManaged));
|
|
35703
35725
|
}, analyzeSource = async (canonicalPath, source) => {
|
|
35704
35726
|
const memo = analyses.get(canonicalPath);
|
|
@@ -49205,5 +49227,5 @@ export {
|
|
|
49205
49227
|
wrapPageHandlerWithStreamingSlots
|
|
49206
49228
|
};
|
|
49207
49229
|
|
|
49208
|
-
//# debugId=
|
|
49230
|
+
//# debugId=14106FA8219E534064756E2164756E21
|
|
49209
49231
|
//# sourceMappingURL=index.js.map
|