@absolutejs/absolute 0.20.0-beta.17 → 0.20.0-beta.18

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.
@@ -3927,7 +3927,7 @@ var parseAbsoluteMobileBuildPageMetadata = (value) => {
3927
3927
  };
3928
3928
  // src/mobile/buildPipeline.ts
3929
3929
  import { readFile as readFile13 } from "fs/promises";
3930
- import { join as join13, resolve as resolve11 } from "path";
3930
+ import { join as join14, resolve as resolve12 } from "path";
3931
3931
  import { pathToFileURL as pathToFileURL2 } from "url";
3932
3932
 
3933
3933
  // src/mobile/buildRelease.ts
@@ -4598,16 +4598,51 @@ var sourceAssetPath = (buildDirectory, bundlePath) => {
4598
4598
  }
4599
4599
  return asset;
4600
4600
  };
4601
- var buildShellBootstrap = async (staging, auth, sync) => {
4601
+ var importEntryTarget = (entry) => {
4602
+ if (typeof entry === "string")
4603
+ return entry;
4604
+ if (typeof entry === "object" && entry !== null)
4605
+ return Reflect.get(entry, "import");
4606
+ return;
4607
+ };
4608
+ var resolveProjectImport = async (projectRoot, specifier) => {
4609
+ const segments = specifier.split("/");
4610
+ const packageName = specifier.startsWith("@") ? segments.slice(0, 2).join("/") : segments[0] ?? "";
4611
+ const subpath = specifier.slice(packageName.length);
4612
+ const packageDirectory = join9(resolve9(projectRoot), "node_modules", packageName);
4613
+ const manifest = JSON.parse(await readFile11(join9(packageDirectory, "package.json"), "utf8"));
4614
+ const exports = typeof manifest === "object" && manifest !== null ? Reflect.get(manifest, "exports") : undefined;
4615
+ const entry = typeof exports === "object" && exports !== null ? Reflect.get(exports, subpath ? `.${subpath}` : ".") : undefined;
4616
+ const target = importEntryTarget(entry);
4617
+ if (typeof target !== "string" || !target.startsWith("./"))
4618
+ throw new TypeError(`${specifier} does not publish an import entry.`);
4619
+ const resolved = resolve9(packageDirectory, target);
4620
+ if (!resolved.startsWith(`${resolve9(packageDirectory)}/`))
4621
+ throw new TypeError(`${specifier} has an unsafe import entry.`);
4622
+ return resolved;
4623
+ };
4624
+ var buildShellBootstrap = async (staging, auth, sync, storagePrefix, deviceCapabilities, projectRoot) => {
4602
4625
  const modulePath = shellBootstrapModule();
4603
4626
  const authImport = auth ? `import { createAbsoluteMobileShellAuth } from ${JSON.stringify(shellAuthModule())};
4604
4627
  ` : "";
4605
4628
  const options = auth ? `{ createAuth: createAbsoluteMobileShellAuth${sync ? ", installSync: installAbsoluteMobileShellSync" : ""} }` : "";
4606
4629
  const syncImport = sync ? `import { installAbsoluteMobileShellSync } from ${JSON.stringify(shellSyncModule())};
4607
4630
  ` : "";
4631
+ const capabilityImports = (await Promise.all(deviceCapabilities.capabilities.map(async (name, index) => {
4632
+ const provider = deviceCapabilities.providers[name];
4633
+ if (!provider)
4634
+ throw new TypeError(`Missing device capability provider ${name}.`);
4635
+ return `import { ${provider.factory} as absoluteDeviceCapability${index} } from ${JSON.stringify(await resolveProjectImport(projectRoot, provider.module))};`;
4636
+ }))).join(`
4637
+ `);
4638
+ const capabilityOptions = deviceCapabilities.capabilities.map((name, index) => `${JSON.stringify(name)}: absoluteDeviceCapability${index}()`).join(", ");
4608
4639
  const entryPath = join9(staging, ".absolute-mobile-entry.ts");
4640
+ const baseAdapterModule = await resolveProjectImport(projectRoot, "@absolutejs/devices-capacitor");
4609
4641
  await writeFile10(entryPath, `import { startAbsoluteMobileShell } from ${JSON.stringify(modulePath)};
4610
- ${authImport}${syncImport}void startAbsoluteMobileShell(${options});
4642
+ import { installCapacitorDeviceAdapterIfNative } from ${JSON.stringify(baseAdapterModule)};
4643
+ ${authImport}${syncImport}${capabilityImports}
4644
+ installCapacitorDeviceAdapterIfNative({ storagePrefix: ${JSON.stringify(storagePrefix)}${capabilityOptions ? `, ${capabilityOptions}` : ""} });
4645
+ void startAbsoluteMobileShell(${options});
4611
4646
  `);
4612
4647
  const build = await Bun.build({
4613
4648
  entrypoints: [entryPath],
@@ -4745,6 +4780,7 @@ var materializeAbsoluteCapacitorWebBundle = async (options) => {
4745
4780
  appName: options.config.appName,
4746
4781
  deepLinkHosts: options.config.deepLinkHosts,
4747
4782
  deepLinkScheme: options.config.deepLinkScheme,
4783
+ deviceCapabilities: options.deviceCapabilities.capabilities,
4748
4784
  entry: options.config.entry,
4749
4785
  format: ABSOLUTE_MOBILE_CLIENT_MANIFEST_FORMAT,
4750
4786
  pages,
@@ -4770,7 +4806,7 @@ var materializeAbsoluteCapacitorWebBundle = async (options) => {
4770
4806
  writeFile10(join9(staging, MANIFEST_FILE), `${JSON.stringify(manifest, null, "\t")}
4771
4807
  `),
4772
4808
  writeFile10(join9(staging, INDEX_FILE), indexHtml(options.config.appName)),
4773
- buildShellBootstrap(staging, options.auth !== undefined, options.auth !== undefined && options.sync === true)
4809
+ buildShellBootstrap(staging, options.auth !== undefined, options.auth !== undefined && options.sync === true, `absolutejs.${options.auth?.clientId ?? options.config.appId}.`, options.deviceCapabilities, options.projectRoot)
4774
4810
  ]);
4775
4811
  await installBundle(staging, destination);
4776
4812
  return manifest;
@@ -5011,6 +5047,164 @@ var serializeAbsoluteMobileAuthEnvironment = (config, auth) => auth === undefine
5011
5047
 
5012
5048
  // src/mobile/buildPipeline.ts
5013
5049
  init_syncSchema();
5050
+
5051
+ // src/mobile/deviceCapabilities.ts
5052
+ import { readFileSync as readFileSync4 } from "fs";
5053
+ import { extname as extname3, join as join13, relative as relative9, resolve as resolve11 } from "path";
5054
+ import ts from "typescript";
5055
+ var DEVICES_PACKAGE = "@absolutejs/devices";
5056
+ var CAPACITOR_ADAPTER = "@absolutejs/devices-capacitor";
5057
+ var SOURCE_GLOB = new Bun.Glob("**/*.{js,jsx,ts,tsx,svelte,vue}");
5058
+ var IGNORED_DIRECTORIES = new Set([
5059
+ ".absolutejs",
5060
+ ".git",
5061
+ ".test-builds",
5062
+ ".test-shards",
5063
+ "build",
5064
+ "dist",
5065
+ "node_modules",
5066
+ "test",
5067
+ "tests"
5068
+ ]);
5069
+ var IDENTIFIER_PATTERN = /^[A-Za-z_$][\w$]*$/u;
5070
+ var CAPACITOR_MODULE_PATTERN = /^@absolutejs\/devices-capacitor\/[a-z][a-z0-9-]*$/u;
5071
+ var CAPACITOR_PACKAGE_PATTERN = /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u;
5072
+ var object2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5073
+ var readJson = (path) => {
5074
+ const value = JSON.parse(readFileSync4(path, "utf8"));
5075
+ if (!object2(value))
5076
+ throw new TypeError(`${path} must contain an object.`);
5077
+ return value;
5078
+ };
5079
+ var text = (value, field) => {
5080
+ if (typeof value !== "string" || value.length === 0)
5081
+ throw new TypeError(`${field} must be a non-empty string.`);
5082
+ return value;
5083
+ };
5084
+ var parseProvider = (name, value) => {
5085
+ if (!IDENTIFIER_PATTERN.test(name))
5086
+ throw new TypeError("Device capability names must be identifiers.");
5087
+ if (!object2(value))
5088
+ throw new TypeError(`Device capability ${name} must be an object.`);
5089
+ const factory = text(value.factory, `${name}.factory`);
5090
+ const module = text(value.module, `${name}.module`);
5091
+ if (!IDENTIFIER_PATTERN.test(factory))
5092
+ throw new TypeError(`${name}.factory must be a JavaScript identifier.`);
5093
+ if (!CAPACITOR_MODULE_PATTERN.test(module))
5094
+ throw new TypeError(`${name}.module must be an official devices-capacitor subpath.`);
5095
+ if (!Array.isArray(value.packages) || !value.packages.every((spec) => typeof spec === "string" && CAPACITOR_PACKAGE_PATTERN.test(spec)))
5096
+ throw new TypeError(`${name}.packages must contain exact official Capacitor package versions.`);
5097
+ return { factory, module, packages: [...value.packages] };
5098
+ };
5099
+ var loadAbsoluteDeviceCapabilityProviders = (projectRoot) => {
5100
+ const path = join13(resolve11(projectRoot), "node_modules", CAPACITOR_ADAPTER, "package.json");
5101
+ const manifest = readJson(path);
5102
+ const { absolutejs } = manifest;
5103
+ const devices = object2(absolutejs) ? absolutejs.devices : undefined;
5104
+ if (!object2(devices) || devices.format !== 1 || devices.provider !== "capacitor" || !object2(devices.capabilities))
5105
+ throw new TypeError(`${CAPACITOR_ADAPTER} does not publish supported capability metadata.`);
5106
+ const entries = Object.entries(devices.capabilities).map(([name, provider]) => ({
5107
+ name,
5108
+ provider: parseProvider(name, provider)
5109
+ }));
5110
+ return Object.fromEntries(entries.sort((left, right) => left.name.localeCompare(right.name)).map(({ name, provider }) => [name, provider]));
5111
+ };
5112
+ var isIgnored = (path) => path.split("/").some((segment) => IGNORED_DIRECTORIES.has(segment));
5113
+ var importedCapabilities = (source, file) => {
5114
+ const names = new Set;
5115
+ const namespaces = new Set;
5116
+ const visit = (node) => {
5117
+ if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && !node.importClause?.isTypeOnly) {
5118
+ const bindings = node.importClause?.namedBindings;
5119
+ if (bindings && ts.isNamedImports(bindings)) {
5120
+ for (const element of bindings.elements)
5121
+ if (!element.isTypeOnly)
5122
+ names.add((element.propertyName ?? element.name).text);
5123
+ }
5124
+ if (bindings && ts.isNamespaceImport(bindings))
5125
+ namespaces.add(bindings.name.text);
5126
+ }
5127
+ if (ts.isExportDeclaration(node) && !node.isTypeOnly && node.moduleSpecifier !== undefined && ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && node.exportClause && ts.isNamedExports(node.exportClause)) {
5128
+ for (const element of node.exportClause.elements)
5129
+ if (!element.isTypeOnly)
5130
+ names.add((element.propertyName ?? element.name).text);
5131
+ }
5132
+ if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && namespaces.has(node.expression.text))
5133
+ names.add(node.name.text);
5134
+ ts.forEachChild(node, visit);
5135
+ };
5136
+ const extension = extname3(file).toLowerCase();
5137
+ const sources = extension === ".svelte" || extension === ".vue" ? [...source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script\s*>/giu)].map((match) => match[1]).filter((value) => value !== undefined) : [source];
5138
+ for (const [index, script] of sources.entries())
5139
+ visit(ts.createSourceFile(`${file}#script-${index}`, script, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX));
5140
+ return names;
5141
+ };
5142
+ var assertAbsoluteDeviceCapabilityPackages = (projectRoot, plan) => {
5143
+ const missing = missingAbsoluteDeviceCapabilityPackages(plan, directAbsoluteProjectPackages(projectRoot));
5144
+ const mismatched = plan.requiredPackages.filter((spec) => {
5145
+ const separator = spec.lastIndexOf("@");
5146
+ const packageName = spec.slice(0, separator);
5147
+ if (missing.includes(spec))
5148
+ return false;
5149
+ try {
5150
+ return readJson(join13(resolve11(projectRoot), "node_modules", packageName, "package.json")).version !== spec.slice(separator + 1);
5151
+ } catch {
5152
+ return true;
5153
+ }
5154
+ });
5155
+ const unmet = [...missing, ...mismatched];
5156
+ if (unmet.length > 0)
5157
+ throw new TypeError(`Device capabilities ${plan.capabilities.join(", ")} require ${unmet.join(", ")}. Run absolute mobile sync and approve the detected capability plugins.`);
5158
+ };
5159
+ var directAbsoluteProjectPackages = (projectRoot) => {
5160
+ const manifest = readJson(join13(resolve11(projectRoot), "package.json"));
5161
+ const packages = new Set;
5162
+ for (const field of ["dependencies", "devDependencies"]) {
5163
+ const dependencies = manifest[field];
5164
+ if (object2(dependencies))
5165
+ for (const name of Object.keys(dependencies))
5166
+ packages.add(name);
5167
+ }
5168
+ return packages;
5169
+ };
5170
+ var discoverAbsoluteDeviceCapabilities = (projectRoot, providers = loadAbsoluteDeviceCapabilityProviders(projectRoot)) => {
5171
+ const root = resolve11(projectRoot);
5172
+ const known = new Set(Object.keys(providers));
5173
+ const capabilities = new Set;
5174
+ for (const path of SOURCE_GLOB.scanSync({ cwd: root })) {
5175
+ const portable = relative9(root, resolve11(root, path)).replaceAll("\\", "/");
5176
+ if (isIgnored(portable))
5177
+ continue;
5178
+ const source = readFileSync4(resolve11(root, portable), "utf8");
5179
+ for (const name of importedCapabilities(source, portable))
5180
+ if (known.has(name))
5181
+ capabilities.add(name);
5182
+ }
5183
+ return [...capabilities].sort();
5184
+ };
5185
+ var missingAbsoluteDeviceCapabilityPackages = (plan, directPackages) => plan.requiredPackages.filter((spec) => {
5186
+ const packageName = spec.slice(0, spec.lastIndexOf("@"));
5187
+ return !directPackages.has(packageName);
5188
+ });
5189
+ var resolveAbsoluteDeviceCapabilityPlan = (projectRoot) => {
5190
+ const allProviders = loadAbsoluteDeviceCapabilityProviders(projectRoot);
5191
+ const capabilities = discoverAbsoluteDeviceCapabilities(projectRoot, allProviders);
5192
+ const providers = {};
5193
+ for (const name of capabilities) {
5194
+ const provider = allProviders[name];
5195
+ if (provider)
5196
+ providers[name] = provider;
5197
+ }
5198
+ return {
5199
+ capabilities,
5200
+ providers,
5201
+ requiredPackages: [
5202
+ ...new Set(capabilities.flatMap((name) => providers[name]?.packages ?? []))
5203
+ ].sort()
5204
+ };
5205
+ };
5206
+
5207
+ // src/mobile/buildPipeline.ts
5014
5208
  var isElysiaApp = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "compile") === "function" && Array.isArray(Reflect.get(value, "routes"));
5015
5209
  var isStringRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((entry) => typeof entry === "string");
5016
5210
  var serverExportName = (loaded, app) => {
@@ -5044,11 +5238,11 @@ var loadServerApp = async (producerPath) => {
5044
5238
  return { app, exportName };
5045
5239
  };
5046
5240
  var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
5047
- const buildDirectory = resolve11(options.buildDirectory);
5241
+ const buildDirectory = resolve12(options.buildDirectory);
5048
5242
  const mobile = normalizeAbsoluteMobileConfig(options.mobile, options.projectRoot);
5049
- const root = join13(buildDirectory, ".absolutejs", "mobile-compatibility");
5243
+ const root = join14(buildDirectory, ".absolutejs", "mobile-compatibility");
5050
5244
  const [manifestSource, previous] = await Promise.all([
5051
- readFile13(join13(buildDirectory, "manifest.json"), "utf8"),
5245
+ readFile13(join14(buildDirectory, "manifest.json"), "utf8"),
5052
5246
  readAbsoluteMobileMaterializedReleases(root)
5053
5247
  ]);
5054
5248
  const manifest = JSON.parse(manifestSource);
@@ -5061,11 +5255,11 @@ var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
5061
5255
  process.env.ABSOLUTE_BUILD_DIR = buildDirectory;
5062
5256
  process.env.ABSOLUTE_COMPILED_RUNTIME = "1";
5063
5257
  if (options.configPath) {
5064
- process.env.ABSOLUTE_CONFIG = resolve11(options.projectRoot, options.configPath);
5258
+ process.env.ABSOLUTE_CONFIG = resolve12(options.projectRoot, options.configPath);
5065
5259
  }
5066
5260
  let loaded;
5067
5261
  try {
5068
- loaded = await loadServerApp(resolve11(options.producerPath));
5262
+ loaded = await loadServerApp(resolve12(options.producerPath));
5069
5263
  } finally {
5070
5264
  restoreEnvironmentVariable("ABSOLUTE_BUILD_DIR", previousBuildDirectory);
5071
5265
  restoreEnvironmentVariable("ABSOLUTE_COMPILED_RUNTIME", previousCompiledRuntime);
@@ -5078,12 +5272,14 @@ var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
5078
5272
  manifest,
5079
5273
  previousArtifacts: previous.map(({ artifact }) => artifact),
5080
5274
  producerExport: loaded.exportName,
5081
- producerPath: resolve11(options.producerPath),
5275
+ producerPath: resolve12(options.producerPath),
5082
5276
  runtime: String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)
5083
5277
  });
5084
5278
  const auth = resolveAbsoluteMobileAuthManifest(options.projectRoot, mobile);
5085
5279
  const sync = auth !== undefined && projectUsesAbsoluteSync(options.projectRoot);
5086
5280
  const syncSchema = sync ? discoverAbsoluteSyncSchema(options.projectRoot) : undefined;
5281
+ const deviceCapabilities = resolveAbsoluteDeviceCapabilityPlan(options.projectRoot);
5282
+ assertAbsoluteDeviceCapabilityPackages(options.projectRoot, deviceCapabilities);
5087
5283
  if (auth && !loaded.app.routes.some((route) => route.path === "/.well-known/openid-configuration")) {
5088
5284
  throw new TypeError("@absolutejs/auth is installed, but its OIDC provider is not mounted. Native authentication requires the auth oidc configuration so AbsoluteJS can provision a public PKCE client.");
5089
5285
  }
@@ -5102,6 +5298,8 @@ var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
5102
5298
  ...auth ? { auth } : {},
5103
5299
  buildDirectory,
5104
5300
  config: mobile,
5301
+ deviceCapabilities,
5302
+ projectRoot: options.projectRoot,
5105
5303
  ...sync ? { sync: true } : {},
5106
5304
  ...syncSchema ? { syncSchema: { components: syncSchema.components } } : {}
5107
5305
  });
@@ -5359,7 +5557,7 @@ var createAbsoluteMobileCompatibilityDispatcher = (options) => {
5359
5557
  };
5360
5558
  // src/mobile/nativeDeepLinks.ts
5361
5559
  import { readFile as readFile14, rename as rename11, writeFile as writeFile12 } from "fs/promises";
5362
- import { join as join14 } from "path";
5560
+ import { join as join15 } from "path";
5363
5561
  var START_MARKER = "<!-- absolutejs:deep-links:start -->";
5364
5562
  var END_MARKER = "<!-- absolutejs:deep-links:end -->";
5365
5563
  var IOS_ENTITLEMENTS = "App/AbsoluteJS.entitlements";
@@ -5416,7 +5614,7 @@ ${hosts}
5416
5614
  `;
5417
5615
  };
5418
5616
  var configureAndroid = async (config) => {
5419
- const path = join14(config.nativeProjectDirectory, "android/app/src/main/AndroidManifest.xml");
5617
+ const path = join15(config.nativeProjectDirectory, "android/app/src/main/AndroidManifest.xml");
5420
5618
  const source = await readFile14(path, "utf8");
5421
5619
  const mainActivity = source.indexOf('android:name=".MainActivity"');
5422
5620
  if (mainActivity === NOT_FOUND) {
@@ -5442,7 +5640,7 @@ var iosSchemeRegion = (scheme) => ` ${START_MARKER}
5442
5640
  ${END_MARKER}
5443
5641
  `;
5444
5642
  var configureIosInfo = async (config) => {
5445
- const path = join14(config.nativeProjectDirectory, "ios/App/App/Info.plist");
5643
+ const path = join15(config.nativeProjectDirectory, "ios/App/App/Info.plist");
5446
5644
  const source = await readFile14(path, "utf8");
5447
5645
  const region = config.deepLinkScheme ? iosSchemeRegion(config.deepLinkScheme) : ` ${START_MARKER}
5448
5646
  ${END_MARKER}
@@ -5466,7 +5664,7 @@ ${domains}
5466
5664
  `;
5467
5665
  };
5468
5666
  var configureIosEntitlements = async (config) => {
5469
- const path = join14(config.nativeProjectDirectory, "ios/App/AbsoluteJS.entitlements");
5667
+ const path = join15(config.nativeProjectDirectory, "ios/App/AbsoluteJS.entitlements");
5470
5668
  let current = "";
5471
5669
  try {
5472
5670
  current = await readFile14(path, "utf8");
@@ -5484,7 +5682,7 @@ var configureIosEntitlements = async (config) => {
5484
5682
  return true;
5485
5683
  };
5486
5684
  var configureIosProject = async (config) => {
5487
- const path = join14(config.nativeProjectDirectory, "ios/App/App.xcodeproj/project.pbxproj");
5685
+ const path = join15(config.nativeProjectDirectory, "ios/App/App.xcodeproj/project.pbxproj");
5488
5686
  const source = await readFile14(path, "utf8");
5489
5687
  const declarations = [
5490
5688
  ...source.matchAll(/CODE_SIGN_ENTITLEMENTS = ([^;]+);/g)
@@ -5524,7 +5722,7 @@ var applyAbsoluteNativeDeepLinks = async (config, platforms = config.platforms)
5524
5722
  };
5525
5723
  // src/mobile/releasePublisher.ts
5526
5724
  import { access as access9 } from "fs/promises";
5527
- import { isAbsolute as isAbsolute6, relative as relative9, resolve as resolve12, sep as sep6 } from "path";
5725
+ import { isAbsolute as isAbsolute6, relative as relative10, resolve as resolve13, sep as sep6 } from "path";
5528
5726
  import { pathToFileURL as pathToFileURL3 } from "url";
5529
5727
  var prepareAbsoluteIosRelease = async (publisher, options) => {
5530
5728
  if (typeof publisher.prepareIosRelease !== "function") {
@@ -5550,9 +5748,9 @@ var prepareAbsoluteAndroidRelease = async (publisher, options) => {
5550
5748
  var isRecord8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5551
5749
  var isPublisher = (value) => isRecord8(value) && typeof value.publish === "function";
5552
5750
  var publisherModulePath = (projectRoot, requested) => {
5553
- const root = resolve12(projectRoot);
5554
- const path = resolve12(root, requested);
5555
- const projectRelative = relative9(root, path);
5751
+ const root = resolve13(projectRoot);
5752
+ const path = resolve13(root, requested);
5753
+ const projectRelative = relative10(root, path);
5556
5754
  if (projectRelative === ".." || projectRelative.startsWith(`..${sep6}`) || isAbsolute6(projectRelative)) {
5557
5755
  throw new TypeError("mobile publish --registry must remain inside the project.");
5558
5756
  }
@@ -5621,9 +5819,9 @@ var publishAbsoluteIosRelease = async (options) => {
5621
5819
  return publication;
5622
5820
  };
5623
5821
  // src/mobile/routeMetadataTransform.ts
5624
- import { existsSync as existsSync3, readFileSync as readFileSync4 } from "fs";
5625
- import { dirname as dirname10, extname as extname3, relative as relative10, resolve as resolve13 } from "path";
5626
- import ts from "typescript";
5822
+ import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
5823
+ import { dirname as dirname10, extname as extname4, relative as relative11, resolve as resolve14 } from "path";
5824
+ import ts2 from "typescript";
5627
5825
  var ROUTE_METHODS = new Set(["get", "head"]);
5628
5826
  var SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
5629
5827
  var PAGE_HANDLERS = new Map([
@@ -5673,60 +5871,60 @@ var PAGE_HANDLERS = new Map([
5673
5871
  ]
5674
5872
  ]);
5675
5873
  var posixPath = (value) => value.replace(/\\/g, "/");
5676
- var findTsconfig = (entry, projectRoot) => ts.findConfigFile(dirname10(entry), existsSync3, "tsconfig.json") ?? ts.findConfigFile(projectRoot, existsSync3, "tsconfig.json");
5874
+ var findTsconfig = (entry, projectRoot) => ts2.findConfigFile(dirname10(entry), existsSync3, "tsconfig.json") ?? ts2.findConfigFile(projectRoot, existsSync3, "tsconfig.json");
5677
5875
  var createProgram = (entry, projectRoot) => {
5678
5876
  const configPath = findTsconfig(entry, projectRoot);
5679
5877
  if (!configPath) {
5680
- return ts.createProgram([entry], {
5878
+ return ts2.createProgram([entry], {
5681
5879
  allowJs: true,
5682
- jsx: ts.JsxEmit.ReactJSX,
5683
- module: ts.ModuleKind.ESNext,
5684
- moduleResolution: ts.ModuleResolutionKind.Bundler,
5685
- target: ts.ScriptTarget.ESNext
5880
+ jsx: ts2.JsxEmit.ReactJSX,
5881
+ module: ts2.ModuleKind.ESNext,
5882
+ moduleResolution: ts2.ModuleResolutionKind.Bundler,
5883
+ target: ts2.ScriptTarget.ESNext
5686
5884
  });
5687
5885
  }
5688
- const parsed = ts.parseJsonConfigFileContent(ts.readConfigFile(configPath, (path) => readFileSync4(path, "utf8")).config, ts.sys, dirname10(configPath));
5886
+ const parsed = ts2.parseJsonConfigFileContent(ts2.readConfigFile(configPath, (path) => readFileSync5(path, "utf8")).config, ts2.sys, dirname10(configPath));
5689
5887
  if (!parsed.fileNames.includes(entry))
5690
5888
  parsed.fileNames.push(entry);
5691
- return ts.createProgram(parsed.fileNames, parsed.options);
5889
+ return ts2.createProgram(parsed.fileNames, parsed.options);
5692
5890
  };
5693
5891
  var propertyName = (property) => {
5694
5892
  if (!("name" in property) || !property.name)
5695
5893
  return;
5696
- if (ts.isIdentifier(property.name))
5894
+ if (ts2.isIdentifier(property.name))
5697
5895
  return property.name.text;
5698
- if (ts.isStringLiteralLike(property.name))
5896
+ if (ts2.isStringLiteralLike(property.name))
5699
5897
  return property.name.text;
5700
5898
  return;
5701
5899
  };
5702
- var objectPropertyExpression = (object2, name) => {
5703
- const property = object2.properties.find((candidate) => propertyName(candidate) === name);
5704
- if (property && ts.isPropertyAssignment(property)) {
5900
+ var objectPropertyExpression = (object3, name) => {
5901
+ const property = object3.properties.find((candidate) => propertyName(candidate) === name);
5902
+ if (property && ts2.isPropertyAssignment(property)) {
5705
5903
  return property.initializer;
5706
5904
  }
5707
- if (property && ts.isShorthandPropertyAssignment(property)) {
5905
+ if (property && ts2.isShorthandPropertyAssignment(property)) {
5708
5906
  return property.name;
5709
5907
  }
5710
5908
  return;
5711
5909
  };
5712
5910
  var serializeType = (type, checker, ancestors = new Set) => {
5713
- if (type.flags & ts.TypeFlags.Any)
5911
+ if (type.flags & ts2.TypeFlags.Any)
5714
5912
  return { type: "any" };
5715
- if (type.flags & ts.TypeFlags.Unknown)
5913
+ if (type.flags & ts2.TypeFlags.Unknown)
5716
5914
  return { type: "unknown" };
5717
- if (type.flags & ts.TypeFlags.Never)
5915
+ if (type.flags & ts2.TypeFlags.Never)
5718
5916
  return { type: "never" };
5719
- if (type.flags & ts.TypeFlags.StringLike)
5917
+ if (type.flags & ts2.TypeFlags.StringLike)
5720
5918
  return { type: "string" };
5721
- if (type.flags & ts.TypeFlags.NumberLike)
5919
+ if (type.flags & ts2.TypeFlags.NumberLike)
5722
5920
  return { type: "number" };
5723
- if (type.flags & ts.TypeFlags.BooleanLike)
5921
+ if (type.flags & ts2.TypeFlags.BooleanLike)
5724
5922
  return { type: "boolean" };
5725
- if (type.flags & ts.TypeFlags.BigIntLike)
5923
+ if (type.flags & ts2.TypeFlags.BigIntLike)
5726
5924
  return { type: "bigint" };
5727
- if (type.flags & ts.TypeFlags.Null)
5925
+ if (type.flags & ts2.TypeFlags.Null)
5728
5926
  return { type: "null" };
5729
- if (type.flags & ts.TypeFlags.Undefined)
5927
+ if (type.flags & ts2.TypeFlags.Undefined)
5730
5928
  return { type: "undefined" };
5731
5929
  if (type.isUnion()) {
5732
5930
  return {
@@ -5740,11 +5938,11 @@ var serializeType = (type, checker, ancestors = new Set) => {
5740
5938
  }
5741
5939
  if (ancestors.has(type)) {
5742
5940
  return {
5743
- ref: checker.typeToString(type, undefined, ts.TypeFormatFlags.NoTruncation)
5941
+ ref: checker.typeToString(type, undefined, ts2.TypeFormatFlags.NoTruncation)
5744
5942
  };
5745
5943
  }
5746
5944
  ancestors.add(type);
5747
- const arrayElement = checker.getIndexTypeOfType(type, ts.IndexKind.Number);
5945
+ const arrayElement = checker.getIndexTypeOfType(type, ts2.IndexKind.Number);
5748
5946
  const properties = checker.getPropertiesOfType(type);
5749
5947
  let schema;
5750
5948
  if (arrayElement && properties.some(({ name }) => name === "length")) {
@@ -5759,7 +5957,7 @@ var serializeType = (type, checker, ancestors = new Set) => {
5759
5957
  return [
5760
5958
  property.name,
5761
5959
  {
5762
- optional: Boolean(property.flags & ts.SymbolFlags.Optional),
5960
+ optional: Boolean(property.flags & ts2.SymbolFlags.Optional),
5763
5961
  schema: serializeType(propertyType, checker, ancestors)
5764
5962
  }
5765
5963
  ];
@@ -5767,7 +5965,7 @@ var serializeType = (type, checker, ancestors = new Set) => {
5767
5965
  schema = { properties: Object.fromEntries(entries), type: "object" };
5768
5966
  } else {
5769
5967
  schema = {
5770
- type: checker.typeToString(type, undefined, ts.TypeFormatFlags.NoTruncation)
5968
+ type: checker.typeToString(type, undefined, ts2.TypeFormatFlags.NoTruncation)
5771
5969
  };
5772
5970
  }
5773
5971
  ancestors.delete(type);
@@ -5785,25 +5983,25 @@ var pagePropsType = (pageExpression, propsExpression, checker) => {
5785
5983
  };
5786
5984
  var resolvePageIdentity = (expression, sourceFile, checker, projectRoot) => {
5787
5985
  let symbol = checker.getSymbolAtLocation(expression);
5788
- if (symbol?.flags && symbol.flags & ts.SymbolFlags.Alias) {
5986
+ if (symbol?.flags && symbol.flags & ts2.SymbolFlags.Alias) {
5789
5987
  symbol = checker.getAliasedSymbol(symbol);
5790
5988
  }
5791
5989
  const declaration = symbol?.declarations?.[0];
5792
5990
  const file = declaration?.getSourceFile().fileName ?? sourceFile.fileName;
5793
5991
  const exportedName = symbol?.name ?? expression.getText(sourceFile);
5794
- const source = posixPath(relative10(projectRoot, file));
5992
+ const source = posixPath(relative11(projectRoot, file));
5795
5993
  return `${source}#${exportedName}`;
5796
5994
  };
5797
5995
  var resolveAlias = (symbol, checker) => {
5798
- if (!(symbol.flags & ts.SymbolFlags.Alias))
5996
+ if (!(symbol.flags & ts2.SymbolFlags.Alias))
5799
5997
  return symbol;
5800
5998
  return checker.getAliasedSymbol(symbol);
5801
5999
  };
5802
6000
  var assetKey = (expression, checker, seen = new Set) => {
5803
6001
  if (!expression)
5804
6002
  return;
5805
- if (ts.isIdentifier(expression)) {
5806
- const unresolved = ts.isShorthandPropertyAssignment(expression.parent) ? checker.getShorthandAssignmentValueSymbol(expression.parent) : checker.getSymbolAtLocation(expression);
6003
+ if (ts2.isIdentifier(expression)) {
6004
+ const unresolved = ts2.isShorthandPropertyAssignment(expression.parent) ? checker.getShorthandAssignmentValueSymbol(expression.parent) : checker.getSymbolAtLocation(expression);
5807
6005
  if (!unresolved)
5808
6006
  return;
5809
6007
  const symbol = resolveAlias(unresolved, checker);
@@ -5811,26 +6009,26 @@ var assetKey = (expression, checker, seen = new Set) => {
5811
6009
  return;
5812
6010
  seen.add(symbol);
5813
6011
  const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0];
5814
- if (!declaration || !ts.isVariableDeclaration(declaration))
6012
+ if (!declaration || !ts2.isVariableDeclaration(declaration))
5815
6013
  return;
5816
6014
  return assetKey(declaration.initializer, checker, seen);
5817
6015
  }
5818
- if (!ts.isCallExpression(expression))
6016
+ if (!ts2.isCallExpression(expression))
5819
6017
  return;
5820
- if (!ts.isIdentifier(expression.expression) || expression.expression.text !== "asset") {
6018
+ if (!ts2.isIdentifier(expression.expression) || expression.expression.text !== "asset") {
5821
6019
  return;
5822
6020
  }
5823
6021
  const [, key] = expression.arguments;
5824
- return key && ts.isStringLiteralLike(key) ? key.text : undefined;
6022
+ return key && ts2.isStringLiteralLike(key) ? key.text : undefined;
5825
6023
  };
5826
6024
  var staticString = (expression, bindings) => {
5827
- if (ts.isStringLiteralLike(expression))
6025
+ if (ts2.isStringLiteralLike(expression))
5828
6026
  return expression.text;
5829
- if (ts.isIdentifier(expression))
6027
+ if (ts2.isIdentifier(expression))
5830
6028
  return bindings.get(expression.text);
5831
- if (ts.isNoSubstitutionTemplateLiteral(expression))
6029
+ if (ts2.isNoSubstitutionTemplateLiteral(expression))
5832
6030
  return expression.text;
5833
- if (!ts.isTemplateExpression(expression))
6031
+ if (!ts2.isTemplateExpression(expression))
5834
6032
  return;
5835
6033
  let value = expression.head.text;
5836
6034
  for (const span of expression.templateSpans) {
@@ -5844,7 +6042,7 @@ var staticString = (expression, bindings) => {
5844
6042
  var assetKeyWithBindings = (expression, checker, bindings = new Map) => {
5845
6043
  if (!expression)
5846
6044
  return;
5847
- if (ts.isCallExpression(expression) && ts.isIdentifier(expression.expression) && expression.expression.text === "asset") {
6045
+ if (ts2.isCallExpression(expression) && ts2.isIdentifier(expression.expression) && expression.expression.text === "asset") {
5848
6046
  const [, key] = expression.arguments;
5849
6047
  return key ? staticString(key, bindings) : undefined;
5850
6048
  }
@@ -5855,16 +6053,16 @@ var callableObject = (call, checker) => {
5855
6053
  const resolved = symbol ? resolveAlias(symbol, checker) : undefined;
5856
6054
  const declaration = resolved?.valueDeclaration ?? resolved?.declarations?.[0];
5857
6055
  let callable;
5858
- if (declaration && ts.isFunctionDeclaration(declaration)) {
6056
+ if (declaration && ts2.isFunctionDeclaration(declaration)) {
5859
6057
  callable = declaration;
5860
- } else if (declaration && ts.isVariableDeclaration(declaration) && declaration.initializer && (ts.isArrowFunction(declaration.initializer) || ts.isFunctionExpression(declaration.initializer))) {
6058
+ } else if (declaration && ts2.isVariableDeclaration(declaration) && declaration.initializer && (ts2.isArrowFunction(declaration.initializer) || ts2.isFunctionExpression(declaration.initializer))) {
5861
6059
  callable = declaration.initializer;
5862
6060
  }
5863
6061
  if (!callable)
5864
6062
  return;
5865
6063
  const bindings = new Map;
5866
6064
  callable.parameters.forEach((parameter, index) => {
5867
- if (!ts.isIdentifier(parameter.name))
6065
+ if (!ts2.isIdentifier(parameter.name))
5868
6066
  return;
5869
6067
  const argument = call.arguments[index];
5870
6068
  if (!argument)
@@ -5876,35 +6074,35 @@ var callableObject = (call, checker) => {
5876
6074
  const { body } = callable;
5877
6075
  if (!body)
5878
6076
  return;
5879
- const expressionBody = ts.isParenthesizedExpression(body) ? body.expression : body;
5880
- if (ts.isObjectLiteralExpression(expressionBody)) {
6077
+ const expressionBody = ts2.isParenthesizedExpression(body) ? body.expression : body;
6078
+ if (ts2.isObjectLiteralExpression(expressionBody)) {
5881
6079
  return { bindings, object: expressionBody };
5882
6080
  }
5883
- if (ts.isBlock(body)) {
5884
- const returned = body.statements.find(ts.isReturnStatement)?.expression;
5885
- if (returned && ts.isObjectLiteralExpression(returned)) {
6081
+ if (ts2.isBlock(body)) {
6082
+ const returned = body.statements.find(ts2.isReturnStatement)?.expression;
6083
+ if (returned && ts2.isObjectLiteralExpression(returned)) {
5886
6084
  return { bindings, object: returned };
5887
6085
  }
5888
6086
  }
5889
6087
  return;
5890
6088
  };
5891
6089
  var spreadObject = (expression, checker, bindings) => {
5892
- if (ts.isObjectLiteralExpression(expression)) {
6090
+ if (ts2.isObjectLiteralExpression(expression)) {
5893
6091
  return { bindings, object: expression };
5894
6092
  }
5895
- if (!ts.isCallExpression(expression))
6093
+ if (!ts2.isCallExpression(expression))
5896
6094
  return;
5897
6095
  return callableObject(expression, checker);
5898
6096
  };
5899
- var objectAssetKey = (object2, name, checker, bindings = new Map) => {
5900
- for (const property of [...object2.properties].reverse()) {
5901
- if (propertyName(property) === name && ts.isShorthandPropertyAssignment(property)) {
6097
+ var objectAssetKey = (object3, name, checker, bindings = new Map) => {
6098
+ for (const property of [...object3.properties].reverse()) {
6099
+ if (propertyName(property) === name && ts2.isShorthandPropertyAssignment(property)) {
5902
6100
  return assetKeyWithBindings(property.name, checker, bindings);
5903
6101
  }
5904
- if (propertyName(property) === name && ts.isPropertyAssignment(property)) {
6102
+ if (propertyName(property) === name && ts2.isPropertyAssignment(property)) {
5905
6103
  return assetKeyWithBindings(property.initializer, checker, bindings);
5906
6104
  }
5907
- if (!ts.isSpreadAssignment(property))
6105
+ if (!ts2.isSpreadAssignment(property))
5908
6106
  continue;
5909
6107
  const nestedObject = spreadObject(property.expression, checker, bindings);
5910
6108
  if (!nestedObject)
@@ -5920,14 +6118,14 @@ var findPageCall = (nodes) => {
5920
6118
  const visit = (candidate) => {
5921
6119
  if (found)
5922
6120
  return;
5923
- if (ts.isCallExpression(candidate) && ts.isIdentifier(candidate.expression) && PAGE_HANDLERS.has(candidate.expression.text)) {
6121
+ if (ts2.isCallExpression(candidate) && ts2.isIdentifier(candidate.expression) && PAGE_HANDLERS.has(candidate.expression.text)) {
5924
6122
  const definition = PAGE_HANDLERS.get(candidate.expression.text);
5925
6123
  if (!definition)
5926
6124
  return;
5927
6125
  found = { definition, node: candidate };
5928
6126
  return;
5929
6127
  }
5930
- ts.forEachChild(candidate, visit);
6128
+ ts2.forEachChild(candidate, visit);
5931
6129
  };
5932
6130
  for (const node of nodes)
5933
6131
  visit(node);
@@ -5936,12 +6134,12 @@ var findPageCall = (nodes) => {
5936
6134
  var isProjectSource = (sourceFile, resolvedFile, projectRoot) => !sourceFile.isDeclarationFile && !resolvedFile.includes("/node_modules/") && resolvedFile.startsWith(`${projectRoot}/`);
5937
6135
  var analyzeRouteCall = (node, sourceFile, checker, projectRoot) => {
5938
6136
  const callee = node.expression;
5939
- if (!ts.isPropertyAccessExpression(callee))
6137
+ if (!ts2.isPropertyAccessExpression(callee))
5940
6138
  return;
5941
6139
  if (!ROUTE_METHODS.has(callee.name.text))
5942
6140
  return;
5943
6141
  const [routePath] = node.arguments;
5944
- if (!routePath || !ts.isStringLiteralLike(routePath))
6142
+ if (!routePath || !ts2.isStringLiteralLike(routePath))
5945
6143
  return;
5946
6144
  const foundPageCall = findPageCall(node.arguments.slice(1));
5947
6145
  const pageCall = foundPageCall?.node;
@@ -5974,7 +6172,7 @@ var analyzeRouteCall = (node, sourceFile, checker, projectRoot) => {
5974
6172
  routeCallSpan: `${node.getStart(sourceFile)}:${node.end}`
5975
6173
  };
5976
6174
  }
5977
- if (!ts.isObjectLiteralExpression(input) || !definition.bundleProperty) {
6175
+ if (!ts2.isObjectLiteralExpression(input) || !definition.bundleProperty) {
5978
6176
  return;
5979
6177
  }
5980
6178
  const page = definition.pageProperty ? objectPropertyExpression(input, definition.pageProperty) : undefined;
@@ -6016,21 +6214,21 @@ var analyzeSourceFile = (sourceFile, checker, projectRoot) => {
6016
6214
  byRouteCall: new Map
6017
6215
  };
6018
6216
  const visit = (node) => {
6019
- const result = ts.isCallExpression(node) ? analyzeRouteCall(node, sourceFile, checker, projectRoot) : undefined;
6217
+ const result = ts2.isCallExpression(node) ? analyzeRouteCall(node, sourceFile, checker, projectRoot) : undefined;
6020
6218
  if (result) {
6021
6219
  analysis.byPageCall.set(result.pageCallStart, result);
6022
6220
  analysis.byRouteCall.set(result.routeCallSpan, result);
6023
6221
  }
6024
- ts.forEachChild(node, visit);
6222
+ ts2.forEachChild(node, visit);
6025
6223
  };
6026
- ts.forEachChild(sourceFile, visit);
6224
+ ts2.forEachChild(sourceFile, visit);
6027
6225
  return analysis;
6028
6226
  };
6029
6227
  var analyzeProgram = (program, projectRoot) => {
6030
6228
  const checker = program.getTypeChecker();
6031
6229
  const analyzed = new Map;
6032
6230
  for (const sourceFile of program.getSourceFiles()) {
6033
- const resolvedFile = resolve13(sourceFile.fileName);
6231
+ const resolvedFile = resolve14(sourceFile.fileName);
6034
6232
  if (!isProjectSource(sourceFile, resolvedFile, projectRoot))
6035
6233
  continue;
6036
6234
  const analysis = analyzeSourceFile(sourceFile, checker, projectRoot);
@@ -6039,21 +6237,21 @@ var analyzeProgram = (program, projectRoot) => {
6039
6237
  }
6040
6238
  return analyzed;
6041
6239
  };
6042
- var metadataExpression = (metadata) => ts.factory.createObjectLiteralExpression(Object.entries(metadata).map(([key, item]) => ts.factory.createPropertyAssignment(ts.factory.createStringLiteral(key), ts.factory.createStringLiteral(item))), false);
6240
+ var metadataExpression = (metadata) => ts2.factory.createObjectLiteralExpression(Object.entries(metadata).map(([key, item]) => ts2.factory.createPropertyAssignment(ts2.factory.createStringLiteral(key), ts2.factory.createStringLiteral(item))), false);
6043
6241
  var routeOptions = (existing, metadata) => {
6044
- const detail = ts.factory.createObjectLiteralExpression([
6045
- ts.factory.createPropertyAssignment(ts.factory.createStringLiteral(ABSOLUTE_MOBILE_ROUTE_DETAIL), metadataExpression(metadata))
6242
+ const detail = ts2.factory.createObjectLiteralExpression([
6243
+ ts2.factory.createPropertyAssignment(ts2.factory.createStringLiteral(ABSOLUTE_MOBILE_ROUTE_DETAIL), metadataExpression(metadata))
6046
6244
  ]);
6047
6245
  if (!existing) {
6048
- return ts.factory.createObjectLiteralExpression([
6049
- ts.factory.createPropertyAssignment("detail", detail)
6246
+ return ts2.factory.createObjectLiteralExpression([
6247
+ ts2.factory.createPropertyAssignment("detail", detail)
6050
6248
  ]);
6051
6249
  }
6052
- return ts.factory.createObjectLiteralExpression([
6053
- ts.factory.createSpreadAssignment(existing),
6054
- ts.factory.createPropertyAssignment("detail", ts.factory.createObjectLiteralExpression([
6055
- ts.factory.createSpreadAssignment(ts.factory.createPropertyAccessExpression(existing, "detail")),
6056
- ts.factory.createPropertyAssignment(ts.factory.createStringLiteral(ABSOLUTE_MOBILE_ROUTE_DETAIL), metadataExpression(metadata))
6250
+ return ts2.factory.createObjectLiteralExpression([
6251
+ ts2.factory.createSpreadAssignment(existing),
6252
+ ts2.factory.createPropertyAssignment("detail", ts2.factory.createObjectLiteralExpression([
6253
+ ts2.factory.createSpreadAssignment(ts2.factory.createPropertyAccessExpression(existing, "detail")),
6254
+ ts2.factory.createPropertyAssignment(ts2.factory.createStringLiteral(ABSOLUTE_MOBILE_ROUTE_DETAIL), metadataExpression(metadata))
6057
6255
  ]))
6058
6256
  ]);
6059
6257
  };
@@ -6064,19 +6262,19 @@ var transformPageCall = (node, page) => {
6064
6262
  const [pagePath, existingOptions, ...rest] = node.arguments;
6065
6263
  if (!pagePath)
6066
6264
  return;
6067
- const options = ts.factory.createObjectLiteralExpression([
6068
- ...existingOptions ? [ts.factory.createSpreadAssignment(existingOptions)] : [],
6069
- ts.factory.createPropertyAssignment("__absoluteMobile", metadataExpression(page.metadata))
6265
+ const options = ts2.factory.createObjectLiteralExpression([
6266
+ ...existingOptions ? [ts2.factory.createSpreadAssignment(existingOptions)] : [],
6267
+ ts2.factory.createPropertyAssignment("__absoluteMobile", metadataExpression(page.metadata))
6070
6268
  ]);
6071
- return ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [pagePath, options, ...rest]);
6269
+ return ts2.factory.updateCallExpression(node, node.expression, node.typeArguments, [pagePath, options, ...rest]);
6072
6270
  }
6073
6271
  const [input] = node.arguments;
6074
- if (!input || !ts.isObjectLiteralExpression(input))
6272
+ if (!input || !ts2.isObjectLiteralExpression(input))
6075
6273
  return;
6076
- return ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [
6077
- ts.factory.updateObjectLiteralExpression(input, [
6274
+ return ts2.factory.updateCallExpression(node, node.expression, node.typeArguments, [
6275
+ ts2.factory.updateObjectLiteralExpression(input, [
6078
6276
  ...input.properties,
6079
- ts.factory.createPropertyAssignment("__absoluteMobile", metadataExpression(page.metadata))
6277
+ ts2.factory.createPropertyAssignment("__absoluteMobile", metadataExpression(page.metadata))
6080
6278
  ]),
6081
6279
  ...node.arguments.slice(1)
6082
6280
  ]);
@@ -6089,16 +6287,16 @@ var transformRouteCall = (node, route) => {
6089
6287
  return;
6090
6288
  const options = maybeHandler ? maybeOptions : undefined;
6091
6289
  const handler = maybeHandler ?? maybeOptions;
6092
- return ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [path, routeOptions(options, route.metadata), handler, ...rest]);
6290
+ return ts2.factory.updateCallExpression(node, node.expression, node.typeArguments, [path, routeOptions(options, route.metadata), handler, ...rest]);
6093
6291
  };
6094
6292
  var transformFile = (source, fileName, analysis) => {
6095
- const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, fileName.endsWith("x") ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
6293
+ const sourceFile = ts2.createSourceFile(fileName, source, ts2.ScriptTarget.Latest, true, fileName.endsWith("x") ? ts2.ScriptKind.TSX : ts2.ScriptKind.TS);
6096
6294
  const transformer = (context) => {
6097
6295
  const visit = (node) => {
6098
- if (!ts.isCallExpression(node)) {
6099
- return ts.visitEachChild(node, visit, context);
6296
+ if (!ts2.isCallExpression(node)) {
6297
+ return ts2.visitEachChild(node, visit, context);
6100
6298
  }
6101
- const transformedChildren = ts.visitEachChild(node, visit, context);
6299
+ const transformedChildren = ts2.visitEachChild(node, visit, context);
6102
6300
  const page = analysis.byPageCall.get(node.getStart(sourceFile));
6103
6301
  const transformedPage = transformPageCall(transformedChildren, page);
6104
6302
  if (transformedPage)
@@ -6109,45 +6307,45 @@ var transformFile = (source, fileName, analysis) => {
6109
6307
  return transformedRoute;
6110
6308
  return transformedChildren;
6111
6309
  };
6112
- return (node) => ts.visitNode(node, visit, ts.isSourceFile) ?? node;
6310
+ return (node) => ts2.visitNode(node, visit, ts2.isSourceFile) ?? node;
6113
6311
  };
6114
- const result = ts.transform(sourceFile, [transformer]);
6312
+ const result = ts2.transform(sourceFile, [transformer]);
6115
6313
  try {
6116
6314
  const [transformed] = result.transformed;
6117
6315
  if (!transformed)
6118
6316
  throw new TypeError("Mobile route transform failed.");
6119
- return ts.createPrinter().printFile(transformed);
6317
+ return ts2.createPrinter().printFile(transformed);
6120
6318
  } finally {
6121
6319
  result.dispose();
6122
6320
  }
6123
6321
  };
6124
6322
  var ABSOLUTE_MOBILE_TRANSFORM_PROTOCOL = ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION;
6125
6323
  var createAbsoluteMobileRouteMetadataPlugin = (options) => {
6126
- const projectRoot = resolve13(options.projectRoot ?? process.cwd());
6127
- const entry = resolve13(options.entry);
6324
+ const projectRoot = resolve14(options.projectRoot ?? process.cwd());
6325
+ const entry = resolve14(options.entry);
6128
6326
  const analyzed = analyzeProgram(createProgram(entry, projectRoot), projectRoot);
6129
6327
  return {
6130
6328
  name: "absolute-mobile-route-metadata",
6131
6329
  setup(build) {
6132
6330
  build.onLoad({ filter: SOURCE_FILTER }, async ({ path }) => {
6133
- const analysis = analyzed.get(resolve13(path));
6331
+ const analysis = analyzed.get(resolve14(path));
6134
6332
  if (!analysis)
6135
6333
  return;
6136
6334
  const source = await Bun.file(path).text();
6137
6335
  return {
6138
6336
  contents: transformFile(source, path, analysis),
6139
- loader: extname3(path).endsWith("x") ? "tsx" : "ts"
6337
+ loader: extname4(path).endsWith("x") ? "tsx" : "ts"
6140
6338
  };
6141
6339
  });
6142
6340
  }
6143
6341
  };
6144
6342
  };
6145
6343
  var inspectAbsoluteMobileRouteMetadata = (options) => {
6146
- const projectRoot = resolve13(options.projectRoot ?? process.cwd());
6147
- const entry = resolve13(options.entry);
6344
+ const projectRoot = resolve14(options.projectRoot ?? process.cwd());
6345
+ const entry = resolve14(options.entry);
6148
6346
  const analyzed = analyzeProgram(createProgram(entry, projectRoot), projectRoot);
6149
6347
  return [...analyzed.entries()].flatMap(([file, analysis]) => [...analysis.byRouteCall.values()].map(({ metadata }) => ({
6150
- file: posixPath(relative10(projectRoot, file)),
6348
+ file: posixPath(relative11(projectRoot, file)),
6151
6349
  metadata
6152
6350
  })));
6153
6351
  };
@@ -6169,6 +6367,7 @@ export {
6169
6367
  resolveAbsoluteMobileDeepLink,
6170
6368
  resolveAbsoluteMobileCompatibilityRelease,
6171
6369
  resolveAbsoluteMobileAuthManifest,
6370
+ resolveAbsoluteDeviceCapabilityPlan,
6172
6371
  repairAbsoluteIosDevSession,
6173
6372
  removeAbsoluteRemoteMacProfile,
6174
6373
  redactAbsoluteIosLog,
@@ -6192,6 +6391,7 @@ export {
6192
6391
  pairAbsoluteRemoteMac,
6193
6392
  normalizeAbsoluteMobileConfig,
6194
6393
  navigateAbsoluteMobilePage,
6394
+ missingAbsoluteDeviceCapabilityPackages,
6195
6395
  materializeAbsoluteRemoteMacAgent,
6196
6396
  materializeAbsoluteMobileCompatibilityBundle,
6197
6397
  materializeAbsoluteMobileAssociationFiles,
@@ -6199,6 +6399,7 @@ export {
6199
6399
  matchesAbsoluteMobileRoutePattern,
6200
6400
  loadAbsoluteNativeReleasePublisher,
6201
6401
  loadAbsoluteMobileMaterializedBundle,
6402
+ loadAbsoluteDeviceCapabilityProviders,
6202
6403
  listAbsoluteRemoteMacProfiles,
6203
6404
  isAbsoluteIosNativeRootInput,
6204
6405
  installAbsoluteRemoteMacAgent,
@@ -6217,6 +6418,8 @@ export {
6217
6418
  fetchAbsoluteMobilePage,
6218
6419
  disposeAbsoluteMobilePage,
6219
6420
  discoverAbsoluteSyncSchema,
6421
+ discoverAbsoluteDeviceCapabilities,
6422
+ directAbsoluteProjectPackages,
6220
6423
  createAbsoluteRemoteIosDevProject,
6221
6424
  createAbsoluteMobileUpgradeResponse,
6222
6425
  createAbsoluteMobileRouteMetadataPlugin,
@@ -6236,6 +6439,7 @@ export {
6236
6439
  buildAbsoluteMobileCompatibilityRelease,
6237
6440
  buildAbsoluteIosRelease,
6238
6441
  buildAbsoluteAndroidRelease,
6442
+ assertAbsoluteDeviceCapabilityPackages,
6239
6443
  applyAbsoluteNativeDeepLinks,
6240
6444
  activateAbsoluteMobilePage,
6241
6445
  acceptsAbsoluteMobilePage,
@@ -6264,5 +6468,5 @@ export {
6264
6468
  ABSOLUTE_ANDROID_RELEASE_FORMAT
6265
6469
  };
6266
6470
 
6267
- //# debugId=1458CD3F41FC684D64756E2164756E21
6471
+ //# debugId=09531F7676B08D9D64756E2164756E21
6268
6472
  //# sourceMappingURL=index.js.map