@absolutejs/absolute 0.20.0-beta.172 → 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 +39 -0
- package/README.md +3 -2
- package/changelog.json +68 -0
- package/dist/angular/browser.js +12 -12
- package/dist/angular/browser.js.map +6 -7
- package/dist/angular/components/core/streamingSlotRegistrar.js +2 -6
- package/dist/angular/components/core/streamingSlotRegistry.js +3 -7
- package/dist/angular/components/defer-slot.component.js +12 -7
- package/dist/angular/components/stream-slot.component.js +3 -1
- package/dist/angular/index.js +86 -39
- package/dist/angular/index.js.map +11 -10
- package/dist/angular/server.js +85 -38
- package/dist/angular/server.js.map +10 -9
- package/dist/build/buildWorker.js +135 -57
- package/dist/build.js +1817 -1623
- package/dist/build.js.map +38 -36
- 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 +128 -77
- package/dist/cli/{dev-x49583aj.js → dev-6h1f0mzq.js} +1 -1
- package/dist/cli/{doctor-repprx92.js → doctor-m36tmx4d.js} +70 -15
- 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 +12 -12
- 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/core/streamingSlotRegistrar.js +2 -5
- package/dist/core/streamingSlotRegistrar.js.map +4 -5
- package/dist/core/streamingSlotRegistry.js +2 -5
- package/dist/core/streamingSlotRegistry.js.map +4 -5
- package/dist/dev/importCostReport.js +45 -26
- package/dist/dev/serverBootstrap.js +2 -1
- package/dist/index.js +1748 -1550
- package/dist/index.js.map +40 -38
- package/dist/islands/index.js +2 -2
- package/dist/islands/index.js.map +3 -3
- package/dist/mobile/browser.js +2 -2
- package/dist/mobile/browser.js.map +3 -3
- package/dist/mobile/index.js +116 -96
- package/dist/mobile/index.js.map +7 -6
- package/dist/mobile/remoteMacAgentEntry.js +205 -651
- package/dist/react/components/index.js +2 -5
- package/dist/react/components/index.js.map +5 -6
- package/dist/react/index.js +45 -16
- package/dist/react/index.js.map +8 -8
- package/dist/react/router/browser.js.map +2 -2
- package/dist/react/router/index.js.map +2 -2
- package/dist/react/server.js +45 -16
- package/dist/react/server.js.map +8 -8
- package/dist/src/angular/components/defer-slot.component.d.ts +1 -0
- package/dist/src/build/missingReactRouter.d.ts +8 -0
- package/dist/src/build/vueModuleOutputPath.d.ts +10 -6
- 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/cli/scripts/doctor.d.ts +10 -0
- package/dist/src/core/streamingSlotWarningScope.d.ts +3 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +2 -2
- package/dist/src/dev/angular/hmrImportGenerator.d.ts +2 -2
- package/dist/src/dev/angular/vendor/translator/ts_util.d.ts +2 -2
- package/dist/src/dev/angular/vendor/translator/typescript_ast_factory.d.ts +40 -40
- package/dist/src/dev/angular/vendor/translator/typescript_translator.d.ts +3 -3
- package/dist/src/dev/hot/reload.d.ts +5 -0
- package/dist/src/dev/hot/runtime.d.ts +2 -0
- package/dist/src/dev/srcPath.d.ts +2 -1
- package/dist/src/react/pageHandler.d.ts +5 -0
- package/dist/src/react/router/Link.d.ts +6 -1
- package/dist/src/react/serverComponents/pageHandler.d.ts +2 -0
- package/dist/src/utils/lazyTypescript.d.ts +3 -0
- package/dist/src/utils/portInUse.d.ts +16 -0
- package/dist/svelte/index.js +39 -12
- package/dist/svelte/index.js.map +6 -6
- package/dist/svelte/server.js +39 -12
- package/dist/svelte/server.js.map +6 -6
- package/dist/vue/components/index.js +2 -5
- package/dist/vue/components/index.js.map +4 -5
- package/dist/vue/index.js +39 -12
- package/dist/vue/index.js.map +6 -6
- package/dist/vue/server.js +39 -12
- package/dist/vue/server.js.map +6 -6
- package/package.json +1 -1
package/dist/mobile/index.js
CHANGED
|
@@ -1383,7 +1383,7 @@ var init_routeMatcher = __esm(() => {
|
|
|
1383
1383
|
});
|
|
1384
1384
|
|
|
1385
1385
|
// src/utils/runtimeMode.ts
|
|
1386
|
-
var ENV_VAR = "NODE_ENV",
|
|
1386
|
+
var ENV_VAR = "NODE_ENV", readEnv = () => typeof process === "undefined" ? undefined : process.env?.[ENV_VAR], getNodeEnv = () => readEnv(), isDevelopmentRuntime = () => readEnv() === "development", isProductionRuntime = () => readEnv() === "production";
|
|
1387
1387
|
|
|
1388
1388
|
// src/mobile/producerContextState.ts
|
|
1389
1389
|
var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY, frameworks3, isCompatibilityPage = (value) => typeof value === "object" && value !== null && ("bundleHash" in value) && typeof value.bundleHash === "string" && ("contract" in value) && typeof value.contract === "string" && ("framework" in value) && typeof value.framework === "string" && frameworks3.has(value.framework) && ("pageId" in value) && typeof value.pageId === "string" && ("propsSchemaHash" in value) && typeof value.propsSchemaHash === "string", getCurrentAbsoluteMobileProducerContext = () => {
|
|
@@ -1910,11 +1910,30 @@ var init_materializedBundle = __esm(() => {
|
|
|
1910
1910
|
BUNDLE_ID_PATTERN = /^amb_[a-f0-9]{64}$/;
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
+
// src/utils/lazyTypescript.ts
|
|
1914
|
+
import { createRequire } from "module";
|
|
1915
|
+
var loaded, loadTypescript = () => {
|
|
1916
|
+
if (loaded)
|
|
1917
|
+
return loaded;
|
|
1918
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
1919
|
+
const typescript = requireFromHere("typescript");
|
|
1920
|
+
loaded = typescript;
|
|
1921
|
+
return typescript;
|
|
1922
|
+
}, createLazyTypescript = () => {
|
|
1923
|
+
const target = Object.create(null);
|
|
1924
|
+
return new Proxy(target, {
|
|
1925
|
+
get: (_target, key) => Reflect.get(loadTypescript(), key),
|
|
1926
|
+
has: (_target, key) => Reflect.has(loadTypescript(), key)
|
|
1927
|
+
});
|
|
1928
|
+
}, lazyTypescript;
|
|
1929
|
+
var init_lazyTypescript = __esm(() => {
|
|
1930
|
+
lazyTypescript = createLazyTypescript();
|
|
1931
|
+
});
|
|
1932
|
+
|
|
1913
1933
|
// src/mobile/deviceCapabilities.ts
|
|
1914
1934
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
1915
1935
|
import { extname as extname3, join as join15, relative as relative12, resolve as resolve13 } from "path";
|
|
1916
1936
|
import { fileURLToPath } from "url";
|
|
1917
|
-
import ts from "typescript";
|
|
1918
1937
|
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) => {
|
|
1919
1938
|
const value = JSON.parse(readFileSync3(path, "utf8"));
|
|
1920
1939
|
if (!object(value))
|
|
@@ -2069,29 +2088,29 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABI
|
|
|
2069
2088
|
const names = new Set;
|
|
2070
2089
|
const namespaces = new Set;
|
|
2071
2090
|
const visit = (node) => {
|
|
2072
|
-
if (
|
|
2091
|
+
if (lazyTypescript.isImportDeclaration(node) && lazyTypescript.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && !node.importClause?.isTypeOnly) {
|
|
2073
2092
|
const bindings = node.importClause?.namedBindings;
|
|
2074
|
-
if (bindings &&
|
|
2093
|
+
if (bindings && lazyTypescript.isNamedImports(bindings)) {
|
|
2075
2094
|
for (const element of bindings.elements)
|
|
2076
2095
|
if (!element.isTypeOnly)
|
|
2077
2096
|
names.add((element.propertyName ?? element.name).text);
|
|
2078
2097
|
}
|
|
2079
|
-
if (bindings &&
|
|
2098
|
+
if (bindings && lazyTypescript.isNamespaceImport(bindings))
|
|
2080
2099
|
namespaces.add(bindings.name.text);
|
|
2081
2100
|
}
|
|
2082
|
-
if (
|
|
2101
|
+
if (lazyTypescript.isExportDeclaration(node) && !node.isTypeOnly && node.moduleSpecifier !== undefined && lazyTypescript.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && node.exportClause && lazyTypescript.isNamedExports(node.exportClause)) {
|
|
2083
2102
|
for (const element of node.exportClause.elements)
|
|
2084
2103
|
if (!element.isTypeOnly)
|
|
2085
2104
|
names.add((element.propertyName ?? element.name).text);
|
|
2086
2105
|
}
|
|
2087
|
-
if (
|
|
2106
|
+
if (lazyTypescript.isPropertyAccessExpression(node) && lazyTypescript.isIdentifier(node.expression) && namespaces.has(node.expression.text))
|
|
2088
2107
|
names.add(node.name.text);
|
|
2089
|
-
|
|
2108
|
+
lazyTypescript.forEachChild(node, visit);
|
|
2090
2109
|
};
|
|
2091
2110
|
const extension = extname3(file).toLowerCase();
|
|
2092
2111
|
const sources = extension === ".svelte" || extension === ".vue" ? [...source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script\s*>/giu)].map((match) => match[1]).filter((value) => value !== undefined) : [source];
|
|
2093
2112
|
for (const [index, script] of sources.entries())
|
|
2094
|
-
visit(
|
|
2113
|
+
visit(lazyTypescript.createSourceFile(`${file}#script-${index}`, script, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TSX));
|
|
2095
2114
|
return names;
|
|
2096
2115
|
}, assertAbsoluteDeviceCapabilityPackages = (projectRoot, plan) => {
|
|
2097
2116
|
const missing = missingAbsoluteDeviceCapabilityPackages(plan, directAbsoluteProjectPackages(projectRoot));
|
|
@@ -2172,6 +2191,7 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABI
|
|
|
2172
2191
|
};
|
|
2173
2192
|
};
|
|
2174
2193
|
var init_deviceCapabilities = __esm(() => {
|
|
2194
|
+
init_lazyTypescript();
|
|
2175
2195
|
ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES = [
|
|
2176
2196
|
"keyboard",
|
|
2177
2197
|
"systemBars"
|
|
@@ -20308,11 +20328,11 @@ var publishAbsoluteIosRelease = async (options) => {
|
|
|
20308
20328
|
return publication;
|
|
20309
20329
|
};
|
|
20310
20330
|
// src/mobile/routeMetadataTransform.ts
|
|
20331
|
+
init_lazyTypescript();
|
|
20311
20332
|
init_pageProtocol();
|
|
20312
20333
|
init_releaseArtifact();
|
|
20313
20334
|
import { existsSync as existsSync7, readFileSync as readFileSync8 } from "fs";
|
|
20314
20335
|
import { dirname as dirname24, extname as extname6, relative as relative22, resolve as resolve24 } from "path";
|
|
20315
|
-
import ts2 from "typescript";
|
|
20316
20336
|
var ROUTE_METHODS = new Set(["get", "head"]);
|
|
20317
20337
|
var SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
|
|
20318
20338
|
var PAGE_HANDLERS = new Map([
|
|
@@ -20362,60 +20382,60 @@ var PAGE_HANDLERS = new Map([
|
|
|
20362
20382
|
]
|
|
20363
20383
|
]);
|
|
20364
20384
|
var posixPath = (value) => value.replace(/\\/g, "/");
|
|
20365
|
-
var findTsconfig = (entry, projectRoot) =>
|
|
20385
|
+
var findTsconfig = (entry, projectRoot) => lazyTypescript.findConfigFile(dirname24(entry), existsSync7, "tsconfig.json") ?? lazyTypescript.findConfigFile(projectRoot, existsSync7, "tsconfig.json");
|
|
20366
20386
|
var createProgram = (entry, projectRoot) => {
|
|
20367
20387
|
const configPath = findTsconfig(entry, projectRoot);
|
|
20368
20388
|
if (!configPath) {
|
|
20369
|
-
return
|
|
20389
|
+
return lazyTypescript.createProgram([entry], {
|
|
20370
20390
|
allowJs: true,
|
|
20371
|
-
jsx:
|
|
20372
|
-
module:
|
|
20373
|
-
moduleResolution:
|
|
20374
|
-
target:
|
|
20391
|
+
jsx: lazyTypescript.JsxEmit.ReactJSX,
|
|
20392
|
+
module: lazyTypescript.ModuleKind.ESNext,
|
|
20393
|
+
moduleResolution: lazyTypescript.ModuleResolutionKind.Bundler,
|
|
20394
|
+
target: lazyTypescript.ScriptTarget.ESNext
|
|
20375
20395
|
});
|
|
20376
20396
|
}
|
|
20377
|
-
const parsed =
|
|
20397
|
+
const parsed = lazyTypescript.parseJsonConfigFileContent(lazyTypescript.readConfigFile(configPath, (path) => readFileSync8(path, "utf8")).config, lazyTypescript.sys, dirname24(configPath));
|
|
20378
20398
|
if (!parsed.fileNames.includes(entry))
|
|
20379
20399
|
parsed.fileNames.push(entry);
|
|
20380
|
-
return
|
|
20400
|
+
return lazyTypescript.createProgram(parsed.fileNames, parsed.options);
|
|
20381
20401
|
};
|
|
20382
20402
|
var propertyName = (property) => {
|
|
20383
20403
|
if (!("name" in property) || !property.name)
|
|
20384
20404
|
return;
|
|
20385
|
-
if (
|
|
20405
|
+
if (lazyTypescript.isIdentifier(property.name))
|
|
20386
20406
|
return property.name.text;
|
|
20387
|
-
if (
|
|
20407
|
+
if (lazyTypescript.isStringLiteralLike(property.name))
|
|
20388
20408
|
return property.name.text;
|
|
20389
20409
|
return;
|
|
20390
20410
|
};
|
|
20391
20411
|
var objectPropertyExpression = (object, name) => {
|
|
20392
20412
|
const property = object.properties.find((candidate) => propertyName(candidate) === name);
|
|
20393
|
-
if (property &&
|
|
20413
|
+
if (property && lazyTypescript.isPropertyAssignment(property)) {
|
|
20394
20414
|
return property.initializer;
|
|
20395
20415
|
}
|
|
20396
|
-
if (property &&
|
|
20416
|
+
if (property && lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
20397
20417
|
return property.name;
|
|
20398
20418
|
}
|
|
20399
20419
|
return;
|
|
20400
20420
|
};
|
|
20401
20421
|
var serializeType = (type, checker, ancestors = new Set) => {
|
|
20402
|
-
if (type.flags &
|
|
20422
|
+
if (type.flags & lazyTypescript.TypeFlags.Any)
|
|
20403
20423
|
return { type: "any" };
|
|
20404
|
-
if (type.flags &
|
|
20424
|
+
if (type.flags & lazyTypescript.TypeFlags.Unknown)
|
|
20405
20425
|
return { type: "unknown" };
|
|
20406
|
-
if (type.flags &
|
|
20426
|
+
if (type.flags & lazyTypescript.TypeFlags.Never)
|
|
20407
20427
|
return { type: "never" };
|
|
20408
|
-
if (type.flags &
|
|
20428
|
+
if (type.flags & lazyTypescript.TypeFlags.StringLike)
|
|
20409
20429
|
return { type: "string" };
|
|
20410
|
-
if (type.flags &
|
|
20430
|
+
if (type.flags & lazyTypescript.TypeFlags.NumberLike)
|
|
20411
20431
|
return { type: "number" };
|
|
20412
|
-
if (type.flags &
|
|
20432
|
+
if (type.flags & lazyTypescript.TypeFlags.BooleanLike)
|
|
20413
20433
|
return { type: "boolean" };
|
|
20414
|
-
if (type.flags &
|
|
20434
|
+
if (type.flags & lazyTypescript.TypeFlags.BigIntLike)
|
|
20415
20435
|
return { type: "bigint" };
|
|
20416
|
-
if (type.flags &
|
|
20436
|
+
if (type.flags & lazyTypescript.TypeFlags.Null)
|
|
20417
20437
|
return { type: "null" };
|
|
20418
|
-
if (type.flags &
|
|
20438
|
+
if (type.flags & lazyTypescript.TypeFlags.Undefined)
|
|
20419
20439
|
return { type: "undefined" };
|
|
20420
20440
|
if (type.isUnion()) {
|
|
20421
20441
|
return {
|
|
@@ -20429,11 +20449,11 @@ var serializeType = (type, checker, ancestors = new Set) => {
|
|
|
20429
20449
|
}
|
|
20430
20450
|
if (ancestors.has(type)) {
|
|
20431
20451
|
return {
|
|
20432
|
-
ref: checker.typeToString(type, undefined,
|
|
20452
|
+
ref: checker.typeToString(type, undefined, lazyTypescript.TypeFormatFlags.NoTruncation)
|
|
20433
20453
|
};
|
|
20434
20454
|
}
|
|
20435
20455
|
ancestors.add(type);
|
|
20436
|
-
const arrayElement = checker.getIndexTypeOfType(type,
|
|
20456
|
+
const arrayElement = checker.getIndexTypeOfType(type, lazyTypescript.IndexKind.Number);
|
|
20437
20457
|
const properties = checker.getPropertiesOfType(type);
|
|
20438
20458
|
let schema;
|
|
20439
20459
|
if (arrayElement && properties.some(({ name }) => name === "length")) {
|
|
@@ -20448,7 +20468,7 @@ var serializeType = (type, checker, ancestors = new Set) => {
|
|
|
20448
20468
|
return [
|
|
20449
20469
|
property.name,
|
|
20450
20470
|
{
|
|
20451
|
-
optional: Boolean(property.flags &
|
|
20471
|
+
optional: Boolean(property.flags & lazyTypescript.SymbolFlags.Optional),
|
|
20452
20472
|
schema: serializeType(propertyType, checker, ancestors)
|
|
20453
20473
|
}
|
|
20454
20474
|
];
|
|
@@ -20456,7 +20476,7 @@ var serializeType = (type, checker, ancestors = new Set) => {
|
|
|
20456
20476
|
schema = { properties: Object.fromEntries(entries), type: "object" };
|
|
20457
20477
|
} else {
|
|
20458
20478
|
schema = {
|
|
20459
|
-
type: checker.typeToString(type, undefined,
|
|
20479
|
+
type: checker.typeToString(type, undefined, lazyTypescript.TypeFormatFlags.NoTruncation)
|
|
20460
20480
|
};
|
|
20461
20481
|
}
|
|
20462
20482
|
ancestors.delete(type);
|
|
@@ -20474,7 +20494,7 @@ var pagePropsType = (pageExpression, propsExpression, checker) => {
|
|
|
20474
20494
|
};
|
|
20475
20495
|
var resolvePageIdentity = (expression, sourceFile, checker, projectRoot) => {
|
|
20476
20496
|
let symbol = checker.getSymbolAtLocation(expression);
|
|
20477
|
-
if (symbol?.flags && symbol.flags &
|
|
20497
|
+
if (symbol?.flags && symbol.flags & lazyTypescript.SymbolFlags.Alias) {
|
|
20478
20498
|
symbol = checker.getAliasedSymbol(symbol);
|
|
20479
20499
|
}
|
|
20480
20500
|
const declaration = symbol?.declarations?.[0];
|
|
@@ -20484,15 +20504,15 @@ var resolvePageIdentity = (expression, sourceFile, checker, projectRoot) => {
|
|
|
20484
20504
|
return `${source}#${exportedName}`;
|
|
20485
20505
|
};
|
|
20486
20506
|
var resolveAlias = (symbol, checker) => {
|
|
20487
|
-
if (!(symbol.flags &
|
|
20507
|
+
if (!(symbol.flags & lazyTypescript.SymbolFlags.Alias))
|
|
20488
20508
|
return symbol;
|
|
20489
20509
|
return checker.getAliasedSymbol(symbol);
|
|
20490
20510
|
};
|
|
20491
20511
|
var assetKey = (expression, checker, seen = new Set) => {
|
|
20492
20512
|
if (!expression)
|
|
20493
20513
|
return;
|
|
20494
|
-
if (
|
|
20495
|
-
const unresolved =
|
|
20514
|
+
if (lazyTypescript.isIdentifier(expression)) {
|
|
20515
|
+
const unresolved = lazyTypescript.isShorthandPropertyAssignment(expression.parent) ? checker.getShorthandAssignmentValueSymbol(expression.parent) : checker.getSymbolAtLocation(expression);
|
|
20496
20516
|
if (!unresolved)
|
|
20497
20517
|
return;
|
|
20498
20518
|
const symbol = resolveAlias(unresolved, checker);
|
|
@@ -20500,26 +20520,26 @@ var assetKey = (expression, checker, seen = new Set) => {
|
|
|
20500
20520
|
return;
|
|
20501
20521
|
seen.add(symbol);
|
|
20502
20522
|
const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0];
|
|
20503
|
-
if (!declaration || !
|
|
20523
|
+
if (!declaration || !lazyTypescript.isVariableDeclaration(declaration))
|
|
20504
20524
|
return;
|
|
20505
20525
|
return assetKey(declaration.initializer, checker, seen);
|
|
20506
20526
|
}
|
|
20507
|
-
if (!
|
|
20527
|
+
if (!lazyTypescript.isCallExpression(expression))
|
|
20508
20528
|
return;
|
|
20509
|
-
if (!
|
|
20529
|
+
if (!lazyTypescript.isIdentifier(expression.expression) || expression.expression.text !== "asset") {
|
|
20510
20530
|
return;
|
|
20511
20531
|
}
|
|
20512
20532
|
const [, key] = expression.arguments;
|
|
20513
|
-
return key &&
|
|
20533
|
+
return key && lazyTypescript.isStringLiteralLike(key) ? key.text : undefined;
|
|
20514
20534
|
};
|
|
20515
20535
|
var staticString = (expression, bindings) => {
|
|
20516
|
-
if (
|
|
20536
|
+
if (lazyTypescript.isStringLiteralLike(expression))
|
|
20517
20537
|
return expression.text;
|
|
20518
|
-
if (
|
|
20538
|
+
if (lazyTypescript.isIdentifier(expression))
|
|
20519
20539
|
return bindings.get(expression.text);
|
|
20520
|
-
if (
|
|
20540
|
+
if (lazyTypescript.isNoSubstitutionTemplateLiteral(expression))
|
|
20521
20541
|
return expression.text;
|
|
20522
|
-
if (!
|
|
20542
|
+
if (!lazyTypescript.isTemplateExpression(expression))
|
|
20523
20543
|
return;
|
|
20524
20544
|
let value = expression.head.text;
|
|
20525
20545
|
for (const span of expression.templateSpans) {
|
|
@@ -20533,7 +20553,7 @@ var staticString = (expression, bindings) => {
|
|
|
20533
20553
|
var assetKeyWithBindings = (expression, checker, bindings = new Map) => {
|
|
20534
20554
|
if (!expression)
|
|
20535
20555
|
return;
|
|
20536
|
-
if (
|
|
20556
|
+
if (lazyTypescript.isCallExpression(expression) && lazyTypescript.isIdentifier(expression.expression) && expression.expression.text === "asset") {
|
|
20537
20557
|
const [, key] = expression.arguments;
|
|
20538
20558
|
return key ? staticString(key, bindings) : undefined;
|
|
20539
20559
|
}
|
|
@@ -20544,16 +20564,16 @@ var callableObject = (call, checker) => {
|
|
|
20544
20564
|
const resolved = symbol ? resolveAlias(symbol, checker) : undefined;
|
|
20545
20565
|
const declaration = resolved?.valueDeclaration ?? resolved?.declarations?.[0];
|
|
20546
20566
|
let callable;
|
|
20547
|
-
if (declaration &&
|
|
20567
|
+
if (declaration && lazyTypescript.isFunctionDeclaration(declaration)) {
|
|
20548
20568
|
callable = declaration;
|
|
20549
|
-
} else if (declaration &&
|
|
20569
|
+
} else if (declaration && lazyTypescript.isVariableDeclaration(declaration) && declaration.initializer && (lazyTypescript.isArrowFunction(declaration.initializer) || lazyTypescript.isFunctionExpression(declaration.initializer))) {
|
|
20550
20570
|
callable = declaration.initializer;
|
|
20551
20571
|
}
|
|
20552
20572
|
if (!callable)
|
|
20553
20573
|
return;
|
|
20554
20574
|
const bindings = new Map;
|
|
20555
20575
|
callable.parameters.forEach((parameter, index) => {
|
|
20556
|
-
if (!
|
|
20576
|
+
if (!lazyTypescript.isIdentifier(parameter.name))
|
|
20557
20577
|
return;
|
|
20558
20578
|
const argument = call.arguments[index];
|
|
20559
20579
|
if (!argument)
|
|
@@ -20565,35 +20585,35 @@ var callableObject = (call, checker) => {
|
|
|
20565
20585
|
const { body } = callable;
|
|
20566
20586
|
if (!body)
|
|
20567
20587
|
return;
|
|
20568
|
-
const expressionBody =
|
|
20569
|
-
if (
|
|
20588
|
+
const expressionBody = lazyTypescript.isParenthesizedExpression(body) ? body.expression : body;
|
|
20589
|
+
if (lazyTypescript.isObjectLiteralExpression(expressionBody)) {
|
|
20570
20590
|
return { bindings, object: expressionBody };
|
|
20571
20591
|
}
|
|
20572
|
-
if (
|
|
20573
|
-
const returned = body.statements.find(
|
|
20574
|
-
if (returned &&
|
|
20592
|
+
if (lazyTypescript.isBlock(body)) {
|
|
20593
|
+
const returned = body.statements.find(lazyTypescript.isReturnStatement)?.expression;
|
|
20594
|
+
if (returned && lazyTypescript.isObjectLiteralExpression(returned)) {
|
|
20575
20595
|
return { bindings, object: returned };
|
|
20576
20596
|
}
|
|
20577
20597
|
}
|
|
20578
20598
|
return;
|
|
20579
20599
|
};
|
|
20580
20600
|
var spreadObject = (expression, checker, bindings) => {
|
|
20581
|
-
if (
|
|
20601
|
+
if (lazyTypescript.isObjectLiteralExpression(expression)) {
|
|
20582
20602
|
return { bindings, object: expression };
|
|
20583
20603
|
}
|
|
20584
|
-
if (!
|
|
20604
|
+
if (!lazyTypescript.isCallExpression(expression))
|
|
20585
20605
|
return;
|
|
20586
20606
|
return callableObject(expression, checker);
|
|
20587
20607
|
};
|
|
20588
20608
|
var objectAssetKey = (object, name, checker, bindings = new Map) => {
|
|
20589
20609
|
for (const property of [...object.properties].reverse()) {
|
|
20590
|
-
if (propertyName(property) === name &&
|
|
20610
|
+
if (propertyName(property) === name && lazyTypescript.isShorthandPropertyAssignment(property)) {
|
|
20591
20611
|
return assetKeyWithBindings(property.name, checker, bindings);
|
|
20592
20612
|
}
|
|
20593
|
-
if (propertyName(property) === name &&
|
|
20613
|
+
if (propertyName(property) === name && lazyTypescript.isPropertyAssignment(property)) {
|
|
20594
20614
|
return assetKeyWithBindings(property.initializer, checker, bindings);
|
|
20595
20615
|
}
|
|
20596
|
-
if (!
|
|
20616
|
+
if (!lazyTypescript.isSpreadAssignment(property))
|
|
20597
20617
|
continue;
|
|
20598
20618
|
const nestedObject = spreadObject(property.expression, checker, bindings);
|
|
20599
20619
|
if (!nestedObject)
|
|
@@ -20609,14 +20629,14 @@ var findPageCall = (nodes) => {
|
|
|
20609
20629
|
const visit = (candidate) => {
|
|
20610
20630
|
if (found)
|
|
20611
20631
|
return;
|
|
20612
|
-
if (
|
|
20632
|
+
if (lazyTypescript.isCallExpression(candidate) && lazyTypescript.isIdentifier(candidate.expression) && PAGE_HANDLERS.has(candidate.expression.text)) {
|
|
20613
20633
|
const definition = PAGE_HANDLERS.get(candidate.expression.text);
|
|
20614
20634
|
if (!definition)
|
|
20615
20635
|
return;
|
|
20616
20636
|
found = { definition, node: candidate };
|
|
20617
20637
|
return;
|
|
20618
20638
|
}
|
|
20619
|
-
|
|
20639
|
+
lazyTypescript.forEachChild(candidate, visit);
|
|
20620
20640
|
};
|
|
20621
20641
|
for (const node of nodes)
|
|
20622
20642
|
visit(node);
|
|
@@ -20625,12 +20645,12 @@ var findPageCall = (nodes) => {
|
|
|
20625
20645
|
var isProjectSource = (sourceFile, resolvedFile, projectRoot) => !sourceFile.isDeclarationFile && !resolvedFile.includes("/node_modules/") && resolvedFile.startsWith(`${projectRoot}/`);
|
|
20626
20646
|
var analyzeRouteCall = (node, sourceFile, checker, projectRoot) => {
|
|
20627
20647
|
const callee = node.expression;
|
|
20628
|
-
if (!
|
|
20648
|
+
if (!lazyTypescript.isPropertyAccessExpression(callee))
|
|
20629
20649
|
return;
|
|
20630
20650
|
if (!ROUTE_METHODS.has(callee.name.text))
|
|
20631
20651
|
return;
|
|
20632
20652
|
const [routePath] = node.arguments;
|
|
20633
|
-
if (!routePath || !
|
|
20653
|
+
if (!routePath || !lazyTypescript.isStringLiteralLike(routePath))
|
|
20634
20654
|
return;
|
|
20635
20655
|
const foundPageCall = findPageCall(node.arguments.slice(1));
|
|
20636
20656
|
const pageCall = foundPageCall?.node;
|
|
@@ -20663,7 +20683,7 @@ var analyzeRouteCall = (node, sourceFile, checker, projectRoot) => {
|
|
|
20663
20683
|
routeCallSpan: `${node.getStart(sourceFile)}:${node.end}`
|
|
20664
20684
|
};
|
|
20665
20685
|
}
|
|
20666
|
-
if (!
|
|
20686
|
+
if (!lazyTypescript.isObjectLiteralExpression(input) || !definition.bundleProperty) {
|
|
20667
20687
|
return;
|
|
20668
20688
|
}
|
|
20669
20689
|
const page = definition.pageProperty ? objectPropertyExpression(input, definition.pageProperty) : undefined;
|
|
@@ -20705,14 +20725,14 @@ var analyzeSourceFile = (sourceFile, checker, projectRoot) => {
|
|
|
20705
20725
|
byRouteCall: new Map
|
|
20706
20726
|
};
|
|
20707
20727
|
const visit = (node) => {
|
|
20708
|
-
const result =
|
|
20728
|
+
const result = lazyTypescript.isCallExpression(node) ? analyzeRouteCall(node, sourceFile, checker, projectRoot) : undefined;
|
|
20709
20729
|
if (result) {
|
|
20710
20730
|
analysis.byPageCall.set(result.pageCallStart, result);
|
|
20711
20731
|
analysis.byRouteCall.set(result.routeCallSpan, result);
|
|
20712
20732
|
}
|
|
20713
|
-
|
|
20733
|
+
lazyTypescript.forEachChild(node, visit);
|
|
20714
20734
|
};
|
|
20715
|
-
|
|
20735
|
+
lazyTypescript.forEachChild(sourceFile, visit);
|
|
20716
20736
|
return analysis;
|
|
20717
20737
|
};
|
|
20718
20738
|
var analyzeProgram = (program, projectRoot) => {
|
|
@@ -20728,21 +20748,21 @@ var analyzeProgram = (program, projectRoot) => {
|
|
|
20728
20748
|
}
|
|
20729
20749
|
return analyzed;
|
|
20730
20750
|
};
|
|
20731
|
-
var metadataExpression = (metadata) =>
|
|
20751
|
+
var metadataExpression = (metadata) => lazyTypescript.factory.createObjectLiteralExpression(Object.entries(metadata).map(([key, item]) => lazyTypescript.factory.createPropertyAssignment(lazyTypescript.factory.createStringLiteral(key), lazyTypescript.factory.createStringLiteral(item))), false);
|
|
20732
20752
|
var routeOptions = (existing, metadata) => {
|
|
20733
|
-
const detail =
|
|
20734
|
-
|
|
20753
|
+
const detail = lazyTypescript.factory.createObjectLiteralExpression([
|
|
20754
|
+
lazyTypescript.factory.createPropertyAssignment(lazyTypescript.factory.createStringLiteral(ABSOLUTE_MOBILE_ROUTE_DETAIL), metadataExpression(metadata))
|
|
20735
20755
|
]);
|
|
20736
20756
|
if (!existing) {
|
|
20737
|
-
return
|
|
20738
|
-
|
|
20757
|
+
return lazyTypescript.factory.createObjectLiteralExpression([
|
|
20758
|
+
lazyTypescript.factory.createPropertyAssignment("detail", detail)
|
|
20739
20759
|
]);
|
|
20740
20760
|
}
|
|
20741
|
-
return
|
|
20742
|
-
|
|
20743
|
-
|
|
20744
|
-
|
|
20745
|
-
|
|
20761
|
+
return lazyTypescript.factory.createObjectLiteralExpression([
|
|
20762
|
+
lazyTypescript.factory.createSpreadAssignment(existing),
|
|
20763
|
+
lazyTypescript.factory.createPropertyAssignment("detail", lazyTypescript.factory.createObjectLiteralExpression([
|
|
20764
|
+
lazyTypescript.factory.createSpreadAssignment(lazyTypescript.factory.createPropertyAccessExpression(existing, "detail")),
|
|
20765
|
+
lazyTypescript.factory.createPropertyAssignment(lazyTypescript.factory.createStringLiteral(ABSOLUTE_MOBILE_ROUTE_DETAIL), metadataExpression(metadata))
|
|
20746
20766
|
]))
|
|
20747
20767
|
]);
|
|
20748
20768
|
};
|
|
@@ -20753,19 +20773,19 @@ var transformPageCall = (node, page) => {
|
|
|
20753
20773
|
const [pagePath, existingOptions, ...rest] = node.arguments;
|
|
20754
20774
|
if (!pagePath)
|
|
20755
20775
|
return;
|
|
20756
|
-
const options =
|
|
20757
|
-
...existingOptions ? [
|
|
20758
|
-
|
|
20776
|
+
const options = lazyTypescript.factory.createObjectLiteralExpression([
|
|
20777
|
+
...existingOptions ? [lazyTypescript.factory.createSpreadAssignment(existingOptions)] : [],
|
|
20778
|
+
lazyTypescript.factory.createPropertyAssignment("__absoluteMobile", metadataExpression(page.metadata))
|
|
20759
20779
|
]);
|
|
20760
|
-
return
|
|
20780
|
+
return lazyTypescript.factory.updateCallExpression(node, node.expression, node.typeArguments, [pagePath, options, ...rest]);
|
|
20761
20781
|
}
|
|
20762
20782
|
const [input] = node.arguments;
|
|
20763
|
-
if (!input || !
|
|
20783
|
+
if (!input || !lazyTypescript.isObjectLiteralExpression(input))
|
|
20764
20784
|
return;
|
|
20765
|
-
return
|
|
20766
|
-
|
|
20785
|
+
return lazyTypescript.factory.updateCallExpression(node, node.expression, node.typeArguments, [
|
|
20786
|
+
lazyTypescript.factory.updateObjectLiteralExpression(input, [
|
|
20767
20787
|
...input.properties,
|
|
20768
|
-
|
|
20788
|
+
lazyTypescript.factory.createPropertyAssignment("__absoluteMobile", metadataExpression(page.metadata))
|
|
20769
20789
|
]),
|
|
20770
20790
|
...node.arguments.slice(1)
|
|
20771
20791
|
]);
|
|
@@ -20778,16 +20798,16 @@ var transformRouteCall = (node, route) => {
|
|
|
20778
20798
|
return;
|
|
20779
20799
|
const options = maybeHandler ? maybeOptions : undefined;
|
|
20780
20800
|
const handler = maybeHandler ?? maybeOptions;
|
|
20781
|
-
return
|
|
20801
|
+
return lazyTypescript.factory.updateCallExpression(node, node.expression, node.typeArguments, [path, routeOptions(options, route.metadata), handler, ...rest]);
|
|
20782
20802
|
};
|
|
20783
20803
|
var transformFile = (source, fileName, analysis) => {
|
|
20784
|
-
const sourceFile =
|
|
20804
|
+
const sourceFile = lazyTypescript.createSourceFile(fileName, source, lazyTypescript.ScriptTarget.Latest, true, fileName.endsWith("x") ? lazyTypescript.ScriptKind.TSX : lazyTypescript.ScriptKind.TS);
|
|
20785
20805
|
const transformer = (context) => {
|
|
20786
20806
|
const visit = (node) => {
|
|
20787
|
-
if (!
|
|
20788
|
-
return
|
|
20807
|
+
if (!lazyTypescript.isCallExpression(node)) {
|
|
20808
|
+
return lazyTypescript.visitEachChild(node, visit, context);
|
|
20789
20809
|
}
|
|
20790
|
-
const transformedChildren =
|
|
20810
|
+
const transformedChildren = lazyTypescript.visitEachChild(node, visit, context);
|
|
20791
20811
|
const page = analysis.byPageCall.get(node.getStart(sourceFile));
|
|
20792
20812
|
const transformedPage = transformPageCall(transformedChildren, page);
|
|
20793
20813
|
if (transformedPage)
|
|
@@ -20798,14 +20818,14 @@ var transformFile = (source, fileName, analysis) => {
|
|
|
20798
20818
|
return transformedRoute;
|
|
20799
20819
|
return transformedChildren;
|
|
20800
20820
|
};
|
|
20801
|
-
return (node) =>
|
|
20821
|
+
return (node) => lazyTypescript.visitNode(node, visit, lazyTypescript.isSourceFile) ?? node;
|
|
20802
20822
|
};
|
|
20803
|
-
const result =
|
|
20823
|
+
const result = lazyTypescript.transform(sourceFile, [transformer]);
|
|
20804
20824
|
try {
|
|
20805
20825
|
const [transformed] = result.transformed;
|
|
20806
20826
|
if (!transformed)
|
|
20807
20827
|
throw new TypeError("Mobile route transform failed.");
|
|
20808
|
-
return
|
|
20828
|
+
return lazyTypescript.createPrinter().printFile(transformed);
|
|
20809
20829
|
} finally {
|
|
20810
20830
|
result.dispose();
|
|
20811
20831
|
}
|
|
@@ -27659,5 +27679,5 @@ export {
|
|
|
27659
27679
|
writeAbsoluteMobileUpdateRegistry
|
|
27660
27680
|
};
|
|
27661
27681
|
|
|
27662
|
-
//# debugId=
|
|
27682
|
+
//# debugId=C21432985745295564756E2164756E21
|
|
27663
27683
|
//# sourceMappingURL=index.js.map
|