@ankhorage/expo-runtime 2.5.1 → 2.6.0

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ankhorage/expo-runtime
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 55615bc: Narrow Expo runtime planning to the screen capability and permission requirements it actually consumes, so unrelated manifest contract changes do not couple into Expo planning.
8
+
3
9
  ## 2.5.1
4
10
 
5
11
  ### Patch Changes
@@ -2,6 +2,6 @@ export { type ExpoRuntimeConfigPluginOutput, type ExpoRuntimeDependencyMap, type
2
2
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
3
3
  export { type ExpoRuntimeLayoutIntegrationPlan, resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
4
4
  export { type ExpoRuntimeNativePlatform, type ExpoRuntimeNativeSchemeMap, resolveExpoRuntimeNativeSchemeMap, } from './nativeLinkingPlanning';
5
- export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
5
+ export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimePlanningManifest, ExpoRuntimePlanningScreen, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
6
6
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
7
7
  //# sourceMappingURL=planning.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EACL,KAAK,gCAAgC,EACrC,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EACL,KAAK,gCAAgC,EACrC,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"planning.js","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n type ExpoRuntimeConfigPluginOutput,\n type ExpoRuntimeDependencyMap,\n type ExpoRuntimeGeneratedAppOutputPlan,\n type ExpoRuntimeNativeOutputPlan,\n resolveExpoRuntimeConfigPluginOutput,\n resolveExpoRuntimeDependencyMap,\n resolveExpoRuntimeGeneratedAppOutput,\n resolveExpoRuntimeNativeOutput,\n} from './generatedAppOutput';\nexport { getExpoBarcodeScannerViewSource } from './generatedSources';\nexport {\n type ExpoRuntimeLayoutIntegrationPlan,\n resolveExpoRuntimeLayoutIntegration,\n} from './layoutIntegrationPlanning';\nexport {\n type ExpoRuntimeNativePlatform,\n type ExpoRuntimeNativeSchemeMap,\n resolveExpoRuntimeNativeSchemeMap,\n} from './nativeLinkingPlanning';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
1
+ {"version":3,"file":"planning.js","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n type ExpoRuntimeConfigPluginOutput,\n type ExpoRuntimeDependencyMap,\n type ExpoRuntimeGeneratedAppOutputPlan,\n type ExpoRuntimeNativeOutputPlan,\n resolveExpoRuntimeConfigPluginOutput,\n resolveExpoRuntimeDependencyMap,\n resolveExpoRuntimeGeneratedAppOutput,\n resolveExpoRuntimeNativeOutput,\n} from './generatedAppOutput';\nexport { getExpoBarcodeScannerViewSource } from './generatedSources';\nexport {\n type ExpoRuntimeLayoutIntegrationPlan,\n resolveExpoRuntimeLayoutIntegration,\n} from './layoutIntegrationPlanning';\nexport {\n type ExpoRuntimeNativePlatform,\n type ExpoRuntimeNativeSchemeMap,\n resolveExpoRuntimeNativeSchemeMap,\n} from './nativeLinkingPlanning';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimePlanningManifest,\n ExpoRuntimePlanningScreen,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
@@ -1,6 +1,15 @@
1
- import type { AnkhorageCapabilityName, AppManifest, ScreenCapabilityRequirement, ScreenPermissionRequirement } from '@ankhorage/contracts';
1
+ import type { AnkhorageCapabilityName, ScreenCapabilityRequirement, ScreenPermissionRequirement } from '@ankhorage/contracts';
2
2
  import type { Permission } from '@ankhorage/permissions';
3
3
  import { type ExpoPermissionMetadata, type PermissionSupport } from '@ankhorage/permissions/expo/manifest';
4
+ export interface ExpoRuntimePlanningScreen {
5
+ readonly requires?: {
6
+ readonly capabilities?: readonly ScreenCapabilityRequirement[];
7
+ readonly permissions?: readonly ScreenPermissionRequirement[];
8
+ };
9
+ }
10
+ export interface ExpoRuntimePlanningManifest {
11
+ readonly screens: Readonly<Record<string, ExpoRuntimePlanningScreen>>;
12
+ }
4
13
  interface ExpoRuntimeDependency {
5
14
  readonly name: string;
6
15
  readonly version: string;
@@ -48,6 +57,6 @@ interface ResolveExpoRuntimePlanOptions {
48
57
  readonly dependencyVersions?: Readonly<Record<string, string>>;
49
58
  readonly permissionSupport?: Readonly<Record<Permission, ExpoPermissionMetadata>>;
50
59
  }
51
- export declare function resolveExpoRuntimePlan(manifest: AppManifest, options?: ResolveExpoRuntimePlanOptions): ExpoRuntimePlan;
60
+ export declare function resolveExpoRuntimePlan(manifest: ExpoRuntimePlanningManifest, options?: ResolveExpoRuntimePlanOptions): ExpoRuntimePlan;
52
61
  export {};
53
62
  //# sourceMappingURL=resolveExpoRuntimePlan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveExpoRuntimePlan.d.ts","sourceRoot":"","sources":["../src/resolveExpoRuntimePlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,WAAW,EACX,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAC;AAE9C,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,UAAU,uBAAuB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;CAC/D;AAED,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAClD,MAAM,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAE/D,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,eAAe,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,CAAC;IACjF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,C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wB,EAAE,OAAO,CAAC;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACxD;AAED,UAAU,6BAA6B;IACrC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACrE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACtD,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC3D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;CACvD;AAOD,UAAU,6BAA6B;IACrC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,QAAQ,CACpC,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,6BAA6B,CAAC,CAAC,CACxE,CAAC;IACF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC;CACnF;AA+CD,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,2BAA2B,EACrC,OAAO,GAAE,6BAAkC,GAC1C,eAAe,CAuMjB"}
@@ -184,9 +184,9 @@ export function resolveExpoRuntimePlan(manifest, options = {}) {
184
184
  addDependency(EXPO_RUNTIME_PACKAGE_NAME, 'runtime:expo');
185
185
  }
186
186
  const plugins = Array.from(pluginOptions.entries())
187
- .map(([name, options]) => ({
187
+ .map(([name, pluginOptions]) => ({
188
188
  name,
189
- options: Object.keys(options).length > 0 ? options : undefined,
189
+ options: Object.keys(pluginOptions).length > 0 ? pluginOptions : undefined,
190
190
  }))
191
191
  .sort((left, right) => left.name.localeCompare(right.name));
192
192
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"resolveExpoRuntimePlan.js","sourceRoot":"","sources":["../src/resolveExpoRuntimePlan.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,uBAAuB,GAGxB,MAAM,sCAAsC,CAAC;AA+D9C,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAC9D,MAAM,yBAAyB,GAAG,yBAAyB,CAAC;AAE5D,MAAM,kCAAkC,GAAG;IACzC,wBAAwB,EAAE,QAAQ;IAClC,yBAAyB,EAAE,QAAQ;IACnC,aAAa,EAAE,UAAU;CACgB,CAAC;AAE5C,MAAM,8BAA8B,GAAG;IACrC,WAAW,EAAE,wBAAwB;CACmB,CAAC;AAE3D,MAAM,yBAAyB,GAAG;IAChC,gBAAgB,EAAE;QAChB,kBAAkB,EAAE,CAAC,yBAAyB,CAAC;QAC/C,MAAM,EAAE;YACN,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE;gBACP,gBAAgB,EAAE,sBAAsB;aACzC;SACF;KACF;CACmE,CAAC;AAEvE,MAAM,gCAAgC,GAAG;IACvC,cAAc,EAAE;QACd,kBAAkB,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;QAC9C,gBAAgB,EAAE,CAAC,aAAa,CAAC;QACjC,SAAS,EAAE,CAAC,aAAa,CAAC;QAC1B,eAAe,EAAE,CAAC,2BAA2B,CAAC;QAC9C,kBAAkB,EAAE,CAAC,yBAAyB,CAAC;QAC/C,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE;oBACP,gBAAgB,EAAE,uCAAuC;iBAC1D;aACF;SACF;KACF;CAGF,CAAC;AAEF,MAAM,UAAU,sBAAsB,CACpC,QAAqB,EACrB,UAAyC,EAAE;IAE3C,MAAM,iBAAiB,GAAG,IAAI,GAA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e,CAAC,CAAC,IAAI,EAAE;QACnD,uBAAuB,EAAE,eAAe,CAAC,IAAI,GAAG,CAAC;QACjD,wBAAwB,EAAE,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC;QACtD,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,SAAS,6BAA6B,CACpC,IAAiC,EACjC,KAAkC;IAElC,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,6BAA6B,CACpC,IAAiC,EACjC,KAAkC;IAElC,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC","sourcesContent":["import type {\n AnkhorageCapabilityName,\n AppManifest,\n ScreenCapabilityRequirement,\n ScreenPermissionRequirement,\n} from '@ankhorage/contracts';\nimport type { Permission } from '@ankhorage/permissions';\nimport { isPermission } from '@ankhorage/permissions';\nimport {\n EXPO_PERMISSION_SUPPORT,\n type ExpoPermissionMetadata,\n type PermissionSupport,\n} from '@ankhorage/permissions/expo/manifest';\n\ninterface ExpoRuntimeDependency {\n readonly name: string;\n readonly version: string;\n readonly reasons: readonly string[];\n}\n\ninterface ExpoRuntimeConfigPlugin {\n readonly name: string;\n readonly options?: Readonly<Record<string, boolean | string>>;\n}\n\nexport type ExpoRuntimeProviderId = 'permissions';\nexport type ExpoRuntimeAdapterId = 'ExpoBarcodeScannerAdapter';\n\ninterface ExpoRuntimeDiagnostic {\n readonly severity: 'error' | 'warning';\n readonly requirementType: 'capability' | 'configHint' | 'package' | 'permission';\n readonly requirement: string;\n readonly message: string;\n readonly support?: PermissionSupport;\n}\n\nexport interface ExpoRuntimePlan {\n readonly permissions: readonly ScreenPermissionRequirement[];\n readonly capabilities: readonly ScreenCapabilityRequirement[];\n readonly impliedPermissions: readonly ScreenPermissionRequirement[];\n readonly dependencies: readonly ExpoRuntimeDependency[];\n readonly nativeConfig: {\n readonly androidPermissions: readonly string[];\n readonly configHints: readonly string[];\n readonly plugins: readonly ExpoRuntimeConfigPlugin[];\n };\n readonly providers: readonly ExpoRuntimeProviderId[];\n readonly runtimeAdapters: readonly ExpoRuntimeAdapterId[];\n readonly usesExpoRuntimeRegistry: boolean;\n readonly needsPermissionsProvider: boolean;\n readonly diagnostics: readonly ExpoRuntimeDiagnostic[];\n}\n\ninterface ExpoRuntimeCapabilityMetadata {\n readonly impliedPermissions?: readonly ScreenPermissionRequirement[];\n readonly requiredPackages?: readonly string[];\n readonly providers?: readonly ExpoRuntimeProviderId[];\n readonly runtimeAdapters?: readonly ExpoRuntimeAdapterId[];\n readonly androidPermissions?: readonly string[];\n readonly plugins?: readonly ExpoRuntimeConfigPlugin[];\n}\n\ninterface ExpoRuntimeHintMetadata {\n readonly androidPermissions?: readonly string[];\n readonly plugin?: ExpoRuntimeConfigPlugin;\n}\n\ninterface ResolveExpoRuntimePlanOptions {\n readonly capabilityRegistry?: Readonly<\n Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>\n >;\n readonly dependencyVersions?: Readonly<Record<string, string>>;\n readonly permissionSupport?: Readonly<Record<Permission, ExpoPermissionMetadata>>;\n}\n\nconst CAMERA_ANDROID_PERMISSION = 'android.permission.CAMERA';\nconst EXPO_RUNTIME_PACKAGE_NAME = '@ankhorage/expo-runtime';\n\nconst GENERATED_EXPO_DEPENDENCY_VERSIONS = {\n '@ankhorage/permissions': '^0.2.0',\n '@ankhorage/expo-runtime': 'latest',\n 'expo-camera': '~17.0.10',\n} as const satisfies Record<string, string>;\n\nconst EXPO_RUNTIME_PROVIDER_PACKAGES = {\n permissions: '@ankhorage/permissions',\n} as const satisfies Record<ExpoRuntimeProviderId, string>;\n\nconst EXPO_RUNTIME_CONFIG_HINTS = {\n cameraPermission: {\n androidPermissions: [CAMERA_ANDROID_PERMISSION],\n plugin: {\n name: 'expo-camera',\n options: {\n cameraPermission: 'Allow camera access.',\n },\n },\n },\n} as const satisfies Readonly<Record<string, ExpoRuntimeHintMetadata>>;\n\nconst EXPO_CAPABILITY_RUNTIME_REGISTRY = {\n barcodeScanner: {\n impliedPermissions: [{ permission: 'camera' }],\n requiredPackages: ['expo-camera'],\n providers: ['permissions'],\n runtimeAdapters: ['ExpoBarcodeScannerAdapter'],\n androidPermissions: [CAMERA_ANDROID_PERMISSION],\n plugins: [\n {\n name: 'expo-camera',\n options: {\n cameraPermission: 'Allow camera access to scan barcodes.',\n },\n },\n ],\n },\n} as const satisfies Readonly<\n Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>\n>;\n\nexport function resolveExpoRuntimePlan(\n manifest: AppManifest,\n options: ResolveExpoRuntimePlanOptions = {},\n): ExpoRuntimePlan {\n const permissionsByName = new Map<string, ScreenPermissionRequirement>();\n const impliedPermissionsByName = new Map<string, ScreenPermissionRequirement>();\n const capabilitiesByName = new Map<string, ScreenCapabilityRequirement>();\n\n for (const screen of Object.values(manifest.screens)) {\n screen.requires?.permissions?.forEach((requirement) => {\n permissionsByName.set(requirement.permission, requirement);\n });\n screen.requires?.capabilities?.forEach((requirement) => {\n capabilitiesByName.set(requirement.capability, requirement);\n });\n }\n\n const capabilityRegistry: Readonly<\n Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>\n > = options.capabilityRegistry ?? EXPO_CAPABILITY_RUNTIME_REGISTRY;\n\n for (const capabilityRequirement of capabilitiesByName.values()) {\n capabilityRegistry[capabilityRequirement.capability]?.impliedPermissions?.forEach(\n (permissionRequirement: ScreenPermissionRequirement) => {\n if (!permissionsByName.has(permissionRequirement.permission)) {\n permissionsByName.set(permissionRequirement.permission, permissionRequirement);\n impliedPermissionsByName.set(permissionRequirement.permission, permissionRequirement);\n }\n },\n );\n }\n\n const diagnostics: ExpoRuntimeDiagnostic[] = [];\n const dependencies = new Map<string, ExpoRuntimeDependency>();\n const pluginOptions = new Map<string, Record<string, boolean | string>>();\n const configHints = new Set<string>();\n const androidPermissions = new Set<string>();\n const providers = new Set<ExpoRuntimeProviderId>();\n const runtimeAdapters = new Set<ExpoRuntimeAdapterId>();\n const dependencyVersions: Readonly<Record<string, string>> =\n options.dependencyVersions ?? GENERATED_EXPO_DEPENDENCY_VERSIONS;\n const permissionSupport = options.permissionSupport ?? EXPO_PERMISSION_SUPPORT;\n const configHintRegistry: Readonly<Record<string, ExpoRuntimeHintMetadata>> =\n EXPO_RUNTIME_CONFIG_HINTS;\n\n const addDependency = (name: string, reason: string) => {\n const version = dependencyVersions[name];\n if (version === undefined) {\n diagnostics.push({\n severity: 'warning',\n requirementType: 'package',\n requirement: name,\n message: `No generated-app dependency version is registered for '${name}'.`,\n });\n return;\n }\n\n const existing = dependencies.get(name);\n if (existing) {\n dependencies.set(name, {\n ...existing,\n reasons: Array.from(new Set([...existing.reasons, reason])),\n });\n return;\n }\n\n dependencies.set(name, {\n name,\n version,\n reasons: [reason],\n });\n };\n\n const addProvider = (provider: ExpoRuntimeProviderId, reason: string) => {\n providers.add(provider);\n addDependency(EXPO_RUNTIME_PROVIDER_PACKAGES[provider], reason);\n };\n\n const addPlugin = (plugin: ExpoRuntimeConfigPlugin) => {\n const existingOptions = pluginOptions.get(plugin.name) ?? {};\n pluginOptions.set(plugin.name, {\n ...existingOptions,\n ...(plugin.options ?? {}),\n });\n };\n\n for (const permissionRequirement of permissionsByName.values()) {\n if (!isPermission(permissionRequirement.permission)) {\n diagnostics.push({\n severity: 'error',\n requirementType: 'permission',\n requirement: permissionRequirement.permission,\n message: `Unknown permission '${permissionRequirement.permission}' cannot be resolved for Expo runtime generation.`,\n });\n continue;\n }\n\n const supportMetadata = permissionSupport[permissionRequirement.permission];\n if (\n supportMetadata.support === 'unsupported' ||\n supportMetadata.support === 'notImplemented' ||\n supportMetadata.support === 'limited'\n ) {\n diagnostics.push({\n severity: supportMetadata.support === 'limited' ? 'warning' : 'error',\n requirementType: 'permission',\n requirement: permissionRequirement.permission,\n message: `Expo runtime support for '${permissionRequirement.permission}' is '${supportMetadata.support}'.`,\n support: supportMetadata.support,\n });\n continue;\n }\n\n if (supportMetadata.support === 'notRequired') {\n continue;\n }\n\n addProvider('permissions', `permission:${permissionRequirement.permission}`);\n supportMetadata.requiredPackages.forEach((packageName) => {\n addDependency(packageName, `permission:${permissionRequirement.permission}`);\n });\n\n supportMetadata.configHints.forEach((configHint) => {\n configHints.add(configHint);\n const configHintMetadata = configHintRegistry[configHint];\n if (!configHintMetadata) {\n diagnostics.push({\n severity: 'warning',\n requirementType: 'configHint',\n requirement: configHint,\n message: `Config hint '${configHint}' is not translated into generated Expo config yet.`,\n });\n return;\n }\n\n configHintMetadata.androidPermissions?.forEach((permissionName) => {\n androidPermissions.add(permissionName);\n });\n if (configHintMetadata.plugin) {\n addPlugin(configHintMetadata.plugin);\n }\n });\n }\n\n for (const capabilityRequirement of capabilitiesByName.values()) {\n const capabilityMetadata = capabilityRegistry[capabilityRequirement.capability];\n if (!capabilityMetadata) {\n diagnostics.push({\n severity: 'warning',\n requirementType: 'capability',\n requirement: capabilityRequirement.capability,\n message: `No Expo runtime metadata is registered for capability '${capabilityRequirement.capability}'.`,\n });\n continue;\n }\n\n capabilityMetadata.requiredPackages?.forEach((packageName) => {\n addDependency(packageName, `capability:${capabilityRequirement.capability}`);\n });\n capabilityMetadata.providers?.forEach((provider) => {\n addProvider(provider, `capability:${capabilityRequirement.capability}`);\n });\n capabilityMetadata.runtimeAdapters?.forEach((runtimeAdapter) => {\n runtimeAdapters.add(runtimeAdapter);\n });\n capabilityMetadata.androidPermissions?.forEach((permissionName) => {\n androidPermissions.add(permissionName);\n });\n capabilityMetadata.plugins?.forEach(addPlugin);\n }\n\n if (providers.size > 0 || runtimeAdapters.size > 0) {\n addDependency(EXPO_RUNTIME_PACKAGE_NAME, 'runtime:expo');\n }\n\n const plugins = Array.from(pluginOptions.entries())\n .map(([name, options]) => ({\n name,\n options: Object.keys(options).length > 0 ? options : undefined,\n }))\n .sort((left, right) => left.name.localeCompare(right.name));\n\n return {\n permissions: Array.from(permissionsByName.values()).sort(comparePermissionRequirements),\n capabilities: Array.from(capabilitiesByName.values()).sort(compareCapabilityRequirements),\n impliedPermissions: Array.from(impliedPermissionsByName.values()).sort(\n comparePermissionRequirements,\n ),\n dependencies: Array.from(dependencies.values()).sort((left, right) =>\n left.name.localeCompare(right.name),\n ),\n nativeConfig: {\n androidPermissions: Array.from(androidPermissions).sort(),\n configHints: Array.from(configHints).sort(),\n plugins,\n },\n providers: Array.from(providers).sort(),\n runtimeAdapters: Array.from(runtimeAdapters).sort(),\n usesExpoRuntimeRegistry: runtimeAdapters.size > 0,\n needsPermissionsProvider: providers.has('permissions'),\n diagnostics,\n };\n}\n\nfunction compareCapabilityRequirements(\n left: ScreenCapabilityRequirement,\n right: ScreenCapabilityRequirement,\n): number {\n return left.capability.localeCompare(right.capability);\n}\n\nfunction comparePermissionRequirements(\n left: ScreenPermissionRequirement,\n right: ScreenPermissionRequirement,\n): number {\n return left.permission.localeCompare(right.permission);\n}\n"]}
1
+ {"version":3,"file":"resolveExpoRuntimePlan.js","sourceRoot":"","sources":["../src/resolveExpoRuntimePlan.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,uBAAuB,GAGxB,MAAM,sCAAsC,CAAC;AA0E9C,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAC9D,MAAM,yBAAyB,GAAG,yBAAyB,CAAC;AAE5D,MAAM,kCAAkC,GAAG;IACzC,wBAAwB,EAAE,QAAQ;IAClC,yBAAyB,EAAE,QAAQ;IACnC,aAAa,EAAE,UAAU;CACgB,CAAC;AAE5C,MAAM,8BAA8B,GAAG;IACrC,WAAW,EAAE,wBAAwB;CACmB,CAAC;AAE3D,MAAM,yBAAyB,GAAG;IAChC,gBAAgB,EAAE;QAChB,kBAAkB,EAAE,CAAC,yBAAyB,CAAC;QAC/C,MAAM,EAAE;YACN,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE;gBACP,gBA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AE,CAAC,CAAC,IAAI,CACpE,6BAA6B,CAC9B;QACD,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACnE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CACpC;QACD,YAAY,EAAE;YACZ,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE;YACzD,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE;YAC3C,OAAO;SACR;QACD,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE;QACvC,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE;QACnD,uBAAuB,EAAE,eAAe,CAAC,IAAI,GAAG,CAAC;QACjD,wBAAwB,EAAE,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC;QACtD,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,SAAS,6BAA6B,CACpC,IAAiC,EACjC,KAAkC;IAElC,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,6BAA6B,CACpC,IAAiC,EACjC,KAAkC;IAElC,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC","sourcesContent":["import type {\n AnkhorageCapabilityName,\n ScreenCapabilityRequirement,\n ScreenPermissionRequirement,\n} from '@ankhorage/contracts';\nimport type { Permission } from '@ankhorage/permissions';\nimport { isPermission } from '@ankhorage/permissions';\nimport {\n EXPO_PERMISSION_SUPPORT,\n type ExpoPermissionMetadata,\n type PermissionSupport,\n} from '@ankhorage/permissions/expo/manifest';\n\nexport interface ExpoRuntimePlanningScreen {\n readonly requires?: {\n readonly capabilities?: readonly ScreenCapabilityRequirement[];\n readonly permissions?: readonly ScreenPermissionRequirement[];\n };\n}\n\nexport interface ExpoRuntimePlanningManifest {\n readonly screens: Readonly<Record<string, ExpoRuntimePlanningScreen>>;\n}\n\ninterface ExpoRuntimeDependency {\n readonly name: string;\n readonly version: string;\n readonly reasons: readonly string[];\n}\n\ninterface ExpoRuntimeConfigPlugin {\n readonly name: string;\n readonly options?: Readonly<Record<string, boolean | string>>;\n}\n\nexport type ExpoRuntimeProviderId = 'permissions';\nexport type ExpoRuntimeAdapterId = 'ExpoBarcodeScannerAdapter';\n\ninterface ExpoRuntimeDiagnostic {\n readonly severity: 'error' | 'warning';\n readonly requirementType: 'capability' | 'configHint' | 'package' | 'permission';\n readonly requirement: string;\n readonly message: string;\n readonly support?: PermissionSupport;\n}\n\nexport interface ExpoRuntimePlan {\n readonly permissions: readonly ScreenPermissionRequirement[];\n readonly capabilities: readonly ScreenCapabilityRequirement[];\n readonly impliedPermissions: readonly ScreenPermissionRequirement[];\n readonly dependencies: readonly ExpoRuntimeDependency[];\n readonly nativeConfig: {\n readonly androidPermissions: readonly string[];\n readonly configHints: readonly string[];\n readonly plugins: readonly ExpoRuntimeConfigPlugin[];\n };\n readonly providers: readonly ExpoRuntimeProviderId[];\n readonly runtimeAdapters: readonly ExpoRuntimeAdapterId[];\n readonly usesExpoRuntimeRegistry: boolean;\n readonly needsPermissionsProvider: boolean;\n readonly diagnostics: readonly ExpoRuntimeDiagnostic[];\n}\n\ninterface ExpoRuntimeCapabilityMetadata {\n readonly impliedPermissions?: readonly ScreenPermissionRequirement[];\n readonly requiredPackages?: readonly string[];\n readonly providers?: readonly ExpoRuntimeProviderId[];\n readonly runtimeAdapters?: readonly ExpoRuntimeAdapterId[];\n readonly androidPermissions?: readonly string[];\n readonly plugins?: readonly ExpoRuntimeConfigPlugin[];\n}\n\ninterface ExpoRuntimeHintMetadata {\n readonly androidPermissions?: readonly string[];\n readonly plugin?: ExpoRuntimeConfigPlugin;\n}\n\ninterface ResolveExpoRuntimePlanOptions {\n readonly capabilityRegistry?: Readonly<\n Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>\n >;\n readonly dependencyVersions?: Readonly<Record<string, string>>;\n readonly permissionSupport?: Readonly<Record<Permission, ExpoPermissionMetadata>>;\n}\n\nconst CAMERA_ANDROID_PERMISSION = 'android.permission.CAMERA';\nconst EXPO_RUNTIME_PACKAGE_NAME = '@ankhorage/expo-runtime';\n\nconst GENERATED_EXPO_DEPENDENCY_VERSIONS = {\n '@ankhorage/permissions': '^0.2.0',\n '@ankhorage/expo-runtime': 'latest',\n 'expo-camera': '~17.0.10',\n} as const satisfies Record<string, string>;\n\nconst EXPO_RUNTIME_PROVIDER_PACKAGES = {\n permissions: '@ankhorage/permissions',\n} as const satisfies Record<ExpoRuntimeProviderId, string>;\n\nconst EXPO_RUNTIME_CONFIG_HINTS = {\n cameraPermission: {\n androidPermissions: [CAMERA_ANDROID_PERMISSION],\n plugin: {\n name: 'expo-camera',\n options: {\n cameraPermission: 'Allow camera access.',\n },\n },\n },\n} as const satisfies Readonly<Record<string, ExpoRuntimeHintMetadata>>;\n\nconst EXPO_CAPABILITY_RUNTIME_REGISTRY = {\n barcodeScanner: {\n impliedPermissions: [{ permission: 'camera' }],\n requiredPackages: ['expo-camera'],\n providers: ['permissions'],\n runtimeAdapters: ['ExpoBarcodeScannerAdapter'],\n androidPermissions: [CAMERA_ANDROID_PERMISSION],\n plugins: [\n {\n name: 'expo-camera',\n options: {\n cameraPermission: 'Allow camera access to scan barcodes.',\n },\n },\n ],\n },\n} as const satisfies Readonly<\n Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>\n>;\n\nexport function resolveExpoRuntimePlan(\n manifest: ExpoRuntimePlanningManifest,\n options: ResolveExpoRuntimePlanOptions = {},\n): ExpoRuntimePlan {\n const permissionsByName = new Map<string, ScreenPermissionRequirement>();\n const impliedPermissionsByName = new Map<string, ScreenPermissionRequirement>();\n const capabilitiesByName = new Map<string, ScreenCapabilityRequirement>();\n\n for (const screen of Object.values(manifest.screens)) {\n screen.requires?.permissions?.forEach((requirement) => {\n permissionsByName.set(requirement.permission, requirement);\n });\n screen.requires?.capabilities?.forEach((requirement) => {\n capabilitiesByName.set(requirement.capability, requirement);\n });\n }\n\n const capabilityRegistry: Readonly<\n Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>\n > = options.capabilityRegistry ?? EXPO_CAPABILITY_RUNTIME_REGISTRY;\n\n for (const capabilityRequirement of capabilitiesByName.values()) {\n capabilityRegistry[capabilityRequirement.capability]?.impliedPermissions?.forEach(\n (permissionRequirement: ScreenPermissionRequirement) => {\n if (!permissionsByName.has(permissionRequirement.permission)) {\n permissionsByName.set(permissionRequirement.permission, permissionRequirement);\n impliedPermissionsByName.set(permissionRequirement.permission, permissionRequirement);\n }\n },\n );\n }\n\n const diagnostics: ExpoRuntimeDiagnostic[] = [];\n const dependencies = new Map<string, ExpoRuntimeDependency>();\n const pluginOptions = new Map<string, Record<string, boolean | string>>();\n const configHints = new Set<string>();\n const androidPermissions = new Set<string>();\n const providers = new Set<ExpoRuntimeProviderId>();\n const runtimeAdapters = new Set<ExpoRuntimeAdapterId>();\n const dependencyVersions: Readonly<Record<string, string>> =\n options.dependencyVersions ?? GENERATED_EXPO_DEPENDENCY_VERSIONS;\n const permissionSupport = options.permissionSupport ?? EXPO_PERMISSION_SUPPORT;\n const configHintRegistry: Readonly<Record<string, ExpoRuntimeHintMetadata>> =\n EXPO_RUNTIME_CONFIG_HINTS;\n\n const addDependency = (name: string, reason: string) => {\n const version = dependencyVersions[name];\n if (version === undefined) {\n diagnostics.push({\n severity: 'warning',\n requirementType: 'package',\n requirement: name,\n message: `No generated-app dependency version is registered for '${name}'.`,\n });\n return;\n }\n\n const existing = dependencies.get(name);\n if (existing) {\n dependencies.set(name, {\n ...existing,\n reasons: Array.from(new Set([...existing.reasons, reason])),\n });\n return;\n }\n\n dependencies.set(name, {\n name,\n version,\n reasons: [reason],\n });\n };\n\n const addProvider = (provider: ExpoRuntimeProviderId, reason: string) => {\n providers.add(provider);\n addDependency(EXPO_RUNTIME_PROVIDER_PACKAGES[provider], reason);\n };\n\n const addPlugin = (plugin: ExpoRuntimeConfigPlugin) => {\n const existingOptions = pluginOptions.get(plugin.name) ?? {};\n pluginOptions.set(plugin.name, {\n ...existingOptions,\n ...(plugin.options ?? {}),\n });\n };\n\n for (const permissionRequirement of permissionsByName.values()) {\n if (!isPermission(permissionRequirement.permission)) {\n diagnostics.push({\n severity: 'error',\n requirementType: 'permission',\n requirement: permissionRequirement.permission,\n message: `Unknown permission '${permissionRequirement.permission}' cannot be resolved for Expo runtime generation.`,\n });\n continue;\n }\n\n const supportMetadata = permissionSupport[permissionRequirement.permission];\n if (\n supportMetadata.support === 'unsupported' ||\n supportMetadata.support === 'notImplemented' ||\n supportMetadata.support === 'limited'\n ) {\n diagnostics.push({\n severity: supportMetadata.support === 'limited' ? 'warning' : 'error',\n requirementType: 'permission',\n requirement: permissionRequirement.permission,\n message: `Expo runtime support for '${permissionRequirement.permission}' is '${supportMetadata.support}'.`,\n support: supportMetadata.support,\n });\n continue;\n }\n\n if (supportMetadata.support === 'notRequired') {\n continue;\n }\n\n addProvider('permissions', `permission:${permissionRequirement.permission}`);\n supportMetadata.requiredPackages.forEach((packageName) => {\n addDependency(packageName, `permission:${permissionRequirement.permission}`);\n });\n\n supportMetadata.configHints.forEach((configHint) => {\n configHints.add(configHint);\n const configHintMetadata = configHintRegistry[configHint];\n if (!configHintMetadata) {\n diagnostics.push({\n severity: 'warning',\n requirementType: 'configHint',\n requirement: configHint,\n message: `Config hint '${configHint}' is not translated into generated Expo config yet.`,\n });\n return;\n }\n\n configHintMetadata.androidPermissions?.forEach((permissionName) => {\n androidPermissions.add(permissionName);\n });\n if (configHintMetadata.plugin) {\n addPlugin(configHintMetadata.plugin);\n }\n });\n }\n\n for (const capabilityRequirement of capabilitiesByName.values()) {\n const capabilityMetadata = capabilityRegistry[capabilityRequirement.capability];\n if (!capabilityMetadata) {\n diagnostics.push({\n severity: 'warning',\n requirementType: 'capability',\n requirement: capabilityRequirement.capability,\n message: `No Expo runtime metadata is registered for capability '${capabilityRequirement.capability}'.`,\n });\n continue;\n }\n\n capabilityMetadata.requiredPackages?.forEach((packageName) => {\n addDependency(packageName, `capability:${capabilityRequirement.capability}`);\n });\n capabilityMetadata.providers?.forEach((provider) => {\n addProvider(provider, `capability:${capabilityRequirement.capability}`);\n });\n capabilityMetadata.runtimeAdapters?.forEach((runtimeAdapter) => {\n runtimeAdapters.add(runtimeAdapter);\n });\n capabilityMetadata.androidPermissions?.forEach((permissionName) => {\n androidPermissions.add(permissionName);\n });\n capabilityMetadata.plugins?.forEach(addPlugin);\n }\n\n if (providers.size > 0 || runtimeAdapters.size > 0) {\n addDependency(EXPO_RUNTIME_PACKAGE_NAME, 'runtime:expo');\n }\n\n const plugins = Array.from(pluginOptions.entries())\n .map(([name, pluginOptions]) => ({\n name,\n options: Object.keys(pluginOptions).length > 0 ? pluginOptions : undefined,\n }))\n .sort((left, right) => left.name.localeCompare(right.name));\n\n return {\n permissions: Array.from(permissionsByName.values()).sort(comparePermissionRequirements),\n capabilities: Array.from(capabilitiesByName.values()).sort(compareCapabilityRequirements),\n impliedPermissions: Array.from(impliedPermissionsByName.values()).sort(\n comparePermissionRequirements,\n ),\n dependencies: Array.from(dependencies.values()).sort((left, right) =>\n left.name.localeCompare(right.name),\n ),\n nativeConfig: {\n androidPermissions: Array.from(androidPermissions).sort(),\n configHints: Array.from(configHints).sort(),\n plugins,\n },\n providers: Array.from(providers).sort(),\n runtimeAdapters: Array.from(runtimeAdapters).sort(),\n usesExpoRuntimeRegistry: runtimeAdapters.size > 0,\n needsPermissionsProvider: providers.has('permissions'),\n diagnostics,\n };\n}\n\nfunction compareCapabilityRequirements(\n left: ScreenCapabilityRequirement,\n right: ScreenCapabilityRequirement,\n): number {\n return left.capability.localeCompare(right.capability);\n}\n\nfunction comparePermissionRequirements(\n left: ScreenPermissionRequirement,\n right: ScreenPermissionRequirement,\n): number {\n return left.permission.localeCompare(right.permission);\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/expo-runtime",
3
3
  "type": "module",
4
- "version": "2.5.1",
4
+ "version": "2.6.0",
5
5
  "description": "Declarative runtime integration for Expo apps: maps app capabilities to permissions, packages, config plugins, providers, and adapters",
6
6
  "homepage": "https://github.com/ankhorage/expo-runtime#readme",
7
7
  "bugs": {
package/src/planning.ts CHANGED
@@ -21,6 +21,8 @@ export {
21
21
  export type {
22
22
  ExpoRuntimeAdapterId,
23
23
  ExpoRuntimePlan,
24
+ ExpoRuntimePlanningManifest,
25
+ ExpoRuntimePlanningScreen,
24
26
  ExpoRuntimeProviderId,
25
27
  } from './resolveExpoRuntimePlan';
26
28
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
@@ -1,16 +1,25 @@
1
- import type { AppManifest } from '@ankhorage/contracts';
2
1
  import { Permission } from '@ankhorage/permissions';
3
2
  import { EXPO_PERMISSION_SUPPORT } from '@ankhorage/permissions/expo/manifest';
4
3
  import { describe, expect, test } from 'bun:test';
5
4
 
6
- import { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
5
+ import { type ExpoRuntimePlanningManifest, resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
7
6
 
8
7
  describe('resolveExpoRuntimePlan', () => {
8
+ test('accepts a minimal screens-only planning manifest', () => {
9
+ const manifest: ExpoRuntimePlanningManifest = {
10
+ screens: {
11
+ home: {
12
+ requires: { permissions: [{ permission: 'camera' }] },
13
+ },
14
+ },
15
+ };
16
+
17
+ expect(resolveExpoRuntimePlan(manifest).permissions).toEqual([{ permission: 'camera' }]);
18
+ });
19
+
9
20
  test('resolves camera permission through Expo permission metadata', () => {
10
21
  const plan = resolveExpoRuntimePlan(
11
- withFirstScreenRequirements({
12
- permissions: [{ permission: 'camera' }],
13
- }),
22
+ withFirstScreenRequirements({ permissions: [{ permission: 'camera' }] }),
14
23
  );
15
24
 
16
25
  expect(plan.dependencies.map((dependency) => dependency.name)).toEqual([
@@ -25,18 +34,14 @@ describe('resolveExpoRuntimePlan', () => {
25
34
  expect(plan.nativeConfig.plugins).toEqual([
26
35
  {
27
36
  name: 'expo-camera',
28
- options: {
29
- cameraPermission: 'Allow camera access.',
30
- },
37
+ options: { cameraPermission: 'Allow camera access.' },
31
38
  },
32
39
  ]);
33
40
  });
34
41
 
35
42
  test('resolves barcodeScanner capability with implied camera permission and adapter wiring', () => {
36
43
  const plan = resolveExpoRuntimePlan(
37
- withFirstScreenRequirements({
38
- capabilities: [{ capability: 'barcodeScanner' }],
39
- }),
44
+ withFirstScreenRequirements({ capabilities: [{ capability: 'barcodeScanner' }] }),
40
45
  );
41
46
 
42
47
  expect(plan.impliedPermissions).toEqual([{ permission: 'camera' }]);
@@ -50,9 +55,7 @@ describe('resolveExpoRuntimePlan', () => {
50
55
  expect(plan.nativeConfig.plugins).toEqual([
51
56
  {
52
57
  name: 'expo-camera',
53
- options: {
54
- cameraPermission: 'Allow camera access to scan barcodes.',
55
- },
58
+ options: { cameraPermission: 'Allow camera access to scan barcodes.' },
56
59
  },
57
60
  ]);
58
61
  });
@@ -76,9 +79,7 @@ describe('resolveExpoRuntimePlan', () => {
76
79
 
77
80
  test('surfaces unsupported permission support explicitly', () => {
78
81
  const plan = resolveExpoRuntimePlan(
79
- withFirstScreenRequirements({
80
- permissions: [{ permission: 'camera' }],
81
- }),
82
+ withFirstScreenRequirements({ permissions: [{ permission: 'camera' }] }),
82
83
  {
83
84
  permissionSupport: {
84
85
  ...EXPO_PERMISSION_SUPPORT,
@@ -103,9 +104,7 @@ describe('resolveExpoRuntimePlan', () => {
103
104
 
104
105
  test('does not add runtime packages or providers for clipboard permissions', () => {
105
106
  const plan = resolveExpoRuntimePlan(
106
- withFirstScreenRequirements({
107
- permissions: [{ permission: 'clipboard' }],
108
- }),
107
+ withFirstScreenRequirements({ permissions: [{ permission: 'clipboard' }] }),
109
108
  );
110
109
 
111
110
  expect(plan.dependencies).toEqual([]);
@@ -114,99 +113,29 @@ describe('resolveExpoRuntimePlan', () => {
114
113
  });
115
114
  });
116
115
 
117
- function withAllScreenRequirements(requirements: TestScreenRequirements): AppManifest {
116
+ interface TestScreenRequirements {
117
+ readonly capabilities?: readonly [{ readonly capability: 'barcodeScanner' }];
118
+ readonly permissions?: readonly [{ readonly permission: 'camera' | 'clipboard' }];
119
+ }
120
+
121
+ function withFirstScreenRequirements(
122
+ requirements: TestScreenRequirements,
123
+ ): ExpoRuntimePlanningManifest {
118
124
  return {
119
- ...BASE_MANIFEST,
120
125
  screens: {
121
- home: {
122
- ...BASE_MANIFEST.screens.home,
123
- requires: requirements,
124
- },
125
- settings: {
126
- ...BASE_MANIFEST.screens.settings,
127
- requires: requirements,
128
- },
126
+ home: { requires: requirements },
127
+ settings: {},
129
128
  },
130
129
  };
131
130
  }
132
131
 
133
- function withFirstScreenRequirements(requirements: TestScreenRequirements): AppManifest {
132
+ function withAllScreenRequirements(
133
+ requirements: TestScreenRequirements,
134
+ ): ExpoRuntimePlanningManifest {
134
135
  return {
135
- ...BASE_MANIFEST,
136
136
  screens: {
137
- ...BASE_MANIFEST.screens,
138
- home: {
139
- ...BASE_MANIFEST.screens.home,
140
- requires: requirements,
141
- },
137
+ home: { requires: requirements },
138
+ settings: { requires: requirements },
142
139
  },
143
140
  };
144
141
  }
145
-
146
- interface TestScreenRequirements {
147
- readonly capabilities?: readonly [{ readonly capability: 'barcodeScanner' }];
148
- readonly permissions?: readonly [{ readonly permission: 'camera' | 'clipboard' }];
149
- }
150
-
151
- const BASE_MANIFEST = {
152
- metadata: {
153
- name: 'Test App',
154
- slug: 'test-app',
155
- version: '1.0.0',
156
- themeId: 'default',
157
- created: '2026-06-10T00:00:00.000Z',
158
- updated: '2026-06-10T00:00:00.000Z',
159
- },
160
- navigator: {
161
- type: 'stack',
162
- routes: [
163
- { name: 'index', screenId: 'home' },
164
- { name: 'settings', screenId: 'settings' },
165
- ],
166
- },
167
- screens: {
168
- home: {
169
- id: 'home',
170
- name: 'Home',
171
- title: 'Home',
172
- root: { id: 'home-root', type: 'Screen' },
173
- },
174
- settings: {
175
- id: 'settings',
176
- name: 'Settings',
177
- title: 'Settings',
178
- root: { id: 'settings-root', type: 'Screen' },
179
- },
180
- },
181
- themes: [
182
- {
183
- id: 'default',
184
- name: 'Default',
185
- light: {
186
- primaryColor: '#0f172a',
187
- harmony: 'analogous',
188
- },
189
- dark: {
190
- primaryColor: '#0f172a',
191
- harmony: 'analogous',
192
- },
193
- },
194
- ],
195
- activeThemeId: 'default',
196
- activeThemeMode: 'light',
197
- infra: {
198
- modules: [],
199
- },
200
- settings: {
201
- localization: {
202
- defaultLocale: 'en',
203
- locales: ['en'],
204
- },
205
- authFlow: {
206
- signInRoute: '',
207
- signUpRoute: '/sign-up',
208
- signOutRoute: '/sign-out',
209
- postSignInRoute: '/',
210
- },
211
- },
212
- } satisfies AppManifest;
@@ -1,6 +1,5 @@
1
1
  import type {
2
2
  AnkhorageCapabilityName,
3
- AppManifest,
4
3
  ScreenCapabilityRequirement,
5
4
  ScreenPermissionRequirement,
6
5
  } from '@ankhorage/contracts';
@@ -12,6 +11,17 @@ import {
12
11
  type PermissionSupport,
13
12
  } from '@ankhorage/permissions/expo/manifest';
14
13
 
14
+ export interface ExpoRuntimePlanningScreen {
15
+ readonly requires?: {
16
+ readonly capabilities?: readonly ScreenCapabilityRequirement[];
17
+ readonly permissions?: readonly ScreenPermissionRequirement[];
18
+ };
19
+ }
20
+
21
+ export interface ExpoRuntimePlanningManifest {
22
+ readonly screens: Readonly<Record<string, ExpoRuntimePlanningScreen>>;
23
+ }
24
+
15
25
  interface ExpoRuntimeDependency {
16
26
  readonly name: string;
17
27
  readonly version: string;
@@ -119,7 +129,7 @@ const EXPO_CAPABILITY_RUNTIME_REGISTRY = {
119
129
  >;
120
130
 
121
131
  export function resolveExpoRuntimePlan(
122
- manifest: AppManifest,
132
+ manifest: ExpoRuntimePlanningManifest,
123
133
  options: ResolveExpoRuntimePlanOptions = {},
124
134
  ): ExpoRuntimePlan {
125
135
  const permissionsByName = new Map<string, ScreenPermissionRequirement>();
@@ -294,9 +304,9 @@ export function resolveExpoRuntimePlan(
294
304
  }
295
305
 
296
306
  const plugins = Array.from(pluginOptions.entries())
297
- .map(([name, options]) => ({
307
+ .map(([name, pluginOptions]) => ({
298
308
  name,
299
- options: Object.keys(options).length > 0 ? options : undefined,
309
+ options: Object.keys(pluginOptions).length > 0 ? pluginOptions : undefined,
300
310
  }))
301
311
  .sort((left, right) => left.name.localeCompare(right.name));
302
312