@ankhorage/expo-runtime 2.5.1 → 2.7.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -2
  3. package/dist/ExpoBarcodeScannerAdapter.d.ts.map +1 -1
  4. package/dist/ExpoBarcodeScannerAdapter.js +4 -16
  5. package/dist/ExpoBarcodeScannerAdapter.js.map +1 -1
  6. package/dist/barcodeScanRuntime.d.ts +4 -1
  7. package/dist/barcodeScanRuntime.d.ts.map +1 -1
  8. package/dist/barcodeScanRuntime.js +15 -1
  9. package/dist/barcodeScanRuntime.js.map +1 -1
  10. package/dist/expoRuntimePlanningMetadata.d.ts +59 -0
  11. package/dist/expoRuntimePlanningMetadata.d.ts.map +1 -0
  12. package/dist/expoRuntimePlanningMetadata.js +133 -0
  13. package/dist/expoRuntimePlanningMetadata.js.map +1 -0
  14. package/dist/mediaPicker/documentPicker.d.ts +1 -2
  15. package/dist/mediaPicker/documentPicker.d.ts.map +1 -1
  16. package/dist/mediaPicker/documentPicker.js +1 -1
  17. package/dist/mediaPicker/documentPicker.js.map +1 -1
  18. package/dist/mediaPicker/photoLibraryPicker.d.ts +1 -2
  19. package/dist/mediaPicker/photoLibraryPicker.d.ts.map +1 -1
  20. package/dist/mediaPicker/photoLibraryPicker.js +1 -1
  21. package/dist/mediaPicker/photoLibraryPicker.js.map +1 -1
  22. package/dist/mediaPicker/readSelectedBytes.d.ts +1 -4
  23. package/dist/mediaPicker/readSelectedBytes.d.ts.map +1 -1
  24. package/dist/mediaPicker/readSelectedBytes.js +7 -1
  25. package/dist/mediaPicker/readSelectedBytes.js.map +1 -1
  26. package/dist/planning.d.ts +1 -1
  27. package/dist/planning.d.ts.map +1 -1
  28. package/dist/planning.js.map +1 -1
  29. package/dist/platform.d.ts +83 -0
  30. package/dist/platform.d.ts.map +1 -0
  31. package/dist/platform.js +81 -0
  32. package/dist/platform.js.map +1 -0
  33. package/dist/resolveExpoRuntimePlan.d.ts +14 -25
  34. package/dist/resolveExpoRuntimePlan.d.ts.map +1 -1
  35. package/dist/resolveExpoRuntimePlan.js +154 -186
  36. package/dist/resolveExpoRuntimePlan.js.map +1 -1
  37. package/package.json +45 -29
  38. package/src/ExpoBarcodeScannerAdapter.test.tsx +47 -4
  39. package/src/ExpoBarcodeScannerAdapter.tsx +10 -19
  40. package/src/barcodeScanRuntime.ts +27 -2
  41. package/src/expoRuntimePlanningMetadata.ts +190 -0
  42. package/src/generatedAppOutput.test.ts +29 -7
  43. package/src/mediaPicker/documentPicker.ts +1 -6
  44. package/src/mediaPicker/photoLibraryPicker.ts +1 -6
  45. package/src/mediaPicker/readSelectedBytes.ts +12 -3
  46. package/src/oauthBrowserRuntime.test.ts +1 -1
  47. package/src/planning.ts +2 -0
  48. package/src/platform.test.ts +34 -0
  49. package/src/platform.ts +88 -0
  50. package/src/resolveExpoRuntimePlan.test.ts +154 -101
  51. package/src/resolveExpoRuntimePlan.ts +226 -246
@@ -0,0 +1,83 @@
1
+ export interface ExpoPlatformPackage {
2
+ readonly name: string;
3
+ readonly version: string;
4
+ }
5
+ /**
6
+ * The canonical Ankhorage projection of the supported Expo platform.
7
+ *
8
+ * Package versions come from Expo SDK 57's bundled native module map. Keep this
9
+ * structure as the only hand-maintained Expo compatibility authority in this
10
+ * repository; generated manifests and runtime planning derive from it.
11
+ */
12
+ export declare const EXPO_PLATFORM: {
13
+ readonly sdk: 57;
14
+ readonly architecture: "new-architecture-only";
15
+ readonly runtime: {
16
+ readonly expo: ExpoPlatformPackage;
17
+ readonly react: ExpoPlatformPackage;
18
+ readonly reactDom: ExpoPlatformPackage;
19
+ readonly reactNative: ExpoPlatformPackage;
20
+ readonly reactNativeWeb: ExpoPlatformPackage;
21
+ };
22
+ readonly tooling: {
23
+ readonly node: {
24
+ readonly lts: 24;
25
+ readonly version: "24.x";
26
+ };
27
+ readonly nodeTypes: ExpoPlatformPackage;
28
+ readonly typescript: ExpoPlatformPackage;
29
+ readonly expoDoctor: ExpoPlatformPackage;
30
+ };
31
+ readonly navigation: {
32
+ readonly expoRouter: ExpoPlatformPackage;
33
+ readonly screens: ExpoPlatformPackage;
34
+ readonly safeArea: ExpoPlatformPackage;
35
+ };
36
+ readonly animation: {
37
+ readonly reanimated: ExpoPlatformPackage;
38
+ readonly worklets: ExpoPlatformPackage;
39
+ readonly gestureHandler: ExpoPlatformPackage;
40
+ };
41
+ readonly ui: {
42
+ readonly svg: ExpoPlatformPackage;
43
+ };
44
+ readonly packages: {
45
+ readonly metroRuntime: ExpoPlatformPackage;
46
+ readonly asset: ExpoPlatformPackage;
47
+ readonly audio: ExpoPlatformPackage;
48
+ readonly authSession: ExpoPlatformPackage;
49
+ readonly camera: ExpoPlatformPackage;
50
+ readonly constants: ExpoPlatformPackage;
51
+ readonly devClient: ExpoPlatformPackage;
52
+ readonly documentPicker: ExpoPlatformPackage;
53
+ readonly fileSystem: ExpoPlatformPackage;
54
+ readonly font: ExpoPlatformPackage;
55
+ readonly imagePicker: ExpoPlatformPackage;
56
+ readonly linearGradient: ExpoPlatformPackage;
57
+ readonly linking: ExpoPlatformPackage;
58
+ readonly localization: ExpoPlatformPackage;
59
+ readonly location: ExpoPlatformPackage;
60
+ readonly mediaLibrary: ExpoPlatformPackage;
61
+ readonly notifications: ExpoPlatformPackage;
62
+ readonly secureStore: ExpoPlatformPackage;
63
+ readonly splashScreen: ExpoPlatformPackage;
64
+ readonly statusBar: ExpoPlatformPackage;
65
+ readonly updates: ExpoPlatformPackage;
66
+ readonly webBrowser: ExpoPlatformPackage;
67
+ };
68
+ readonly platforms: {
69
+ readonly android: {
70
+ readonly minimumVersion: 7;
71
+ readonly minimumApiLevel: 24;
72
+ readonly compileSdk: 36;
73
+ readonly targetSdk: 36;
74
+ readonly edgeToEdge: true;
75
+ };
76
+ readonly ios: {
77
+ readonly minimumVersion: "16.4";
78
+ readonly minimumXcodeVersion: "26.4";
79
+ };
80
+ };
81
+ };
82
+ export type ExpoPlatform = typeof EXPO_PLATFORM;
83
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,aAAa,CAAC"}
@@ -0,0 +1,81 @@
1
+ function definePackage(name, version) {
2
+ return { name, version };
3
+ }
4
+ /**
5
+ * The canonical Ankhorage projection of the supported Expo platform.
6
+ *
7
+ * Package versions come from Expo SDK 57's bundled native module map. Keep this
8
+ * structure as the only hand-maintained Expo compatibility authority in this
9
+ * repository; generated manifests and runtime planning derive from it.
10
+ */
11
+ export const EXPO_PLATFORM = {
12
+ sdk: 57,
13
+ architecture: 'new-architecture-only',
14
+ runtime: {
15
+ expo: definePackage('expo', '~57.0.15'),
16
+ react: definePackage('react', '19.2.3'),
17
+ reactDom: definePackage('react-dom', '19.2.3'),
18
+ reactNative: definePackage('react-native', '0.86.2'),
19
+ reactNativeWeb: definePackage('react-native-web', '~0.21.0'),
20
+ },
21
+ tooling: {
22
+ node: {
23
+ lts: 24,
24
+ version: '24.x',
25
+ },
26
+ nodeTypes: definePackage('@types/node', '^24.13.3'),
27
+ typescript: definePackage('typescript', '~6.0.3'),
28
+ expoDoctor: definePackage('expo-doctor', '1.20.2'),
29
+ },
30
+ navigation: {
31
+ expoRouter: definePackage('expo-router', '~57.0.15'),
32
+ screens: definePackage('react-native-screens', '~4.26.0'),
33
+ safeArea: definePackage('react-native-safe-area-context', '~5.7.0'),
34
+ },
35
+ animation: {
36
+ reanimated: definePackage('react-native-reanimated', '4.5.1'),
37
+ worklets: definePackage('react-native-worklets', '0.10.1'),
38
+ gestureHandler: definePackage('react-native-gesture-handler', '~2.32.0'),
39
+ },
40
+ ui: {
41
+ svg: definePackage('react-native-svg', '15.15.4'),
42
+ },
43
+ packages: {
44
+ metroRuntime: definePackage('@expo/metro-runtime', '~57.0.12'),
45
+ asset: definePackage('expo-asset', '~57.0.13'),
46
+ audio: definePackage('expo-audio', '~57.0.4'),
47
+ authSession: definePackage('expo-auth-session', '~57.0.8'),
48
+ camera: definePackage('expo-camera', '~57.0.4'),
49
+ constants: definePackage('expo-constants', '~57.0.13'),
50
+ devClient: definePackage('expo-dev-client', '~57.0.14'),
51
+ documentPicker: definePackage('expo-document-picker', '~57.0.1'),
52
+ fileSystem: definePackage('expo-file-system', '~57.0.5'),
53
+ font: definePackage('expo-font', '~57.0.1'),
54
+ imagePicker: definePackage('expo-image-picker', '~57.0.12'),
55
+ linearGradient: definePackage('expo-linear-gradient', '~57.0.1'),
56
+ linking: definePackage('expo-linking', '~57.0.7'),
57
+ localization: definePackage('expo-localization', '~57.0.1'),
58
+ location: definePackage('expo-location', '~57.0.12'),
59
+ mediaLibrary: definePackage('expo-media-library', '~57.0.4'),
60
+ notifications: definePackage('expo-notifications', '~57.0.13'),
61
+ secureStore: definePackage('expo-secure-store', '~57.0.1'),
62
+ splashScreen: definePackage('expo-splash-screen', '~57.0.7'),
63
+ statusBar: definePackage('expo-status-bar', '~57.0.1'),
64
+ updates: definePackage('expo-updates', '~57.0.16'),
65
+ webBrowser: definePackage('expo-web-browser', '~57.0.2'),
66
+ },
67
+ platforms: {
68
+ android: {
69
+ minimumVersion: 7,
70
+ minimumApiLevel: 24,
71
+ compileSdk: 36,
72
+ targetSdk: 36,
73
+ edgeToEdge: true,
74
+ },
75
+ ios: {
76
+ minimumVersion: '16.4',
77
+ minimumXcodeVersion: '26.4',
78
+ },
79
+ },
80
+ };
81
+ //# sourceMappingURL=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AAC;QACtD,OAAO,EAAE,aAAa,CAAC,cAAc,EAAE,UAAU,CAAC;QAClD,UAAU,EAAE,aAAa,CAAC,kBAAkB,EAAE,SAAS,CAAC;KACzD;IACD,SAAS,EAAE;QACT,OAAO,EAAE;YACP,cAAc,EAAE,CAAC;YACjB,eAAe,EAAE,EAAE;YACnB,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;SACjB;QACD,GAAG,EAAE;YACH,cAAc,EAAE,MAAM;YACtB,mBAAmB,EAAE,MAAM;SAC5B;KACF;CACO,CAAC","sourcesContent":["export interface ExpoPlatformPackage {\n readonly name: string;\n readonly version: string;\n}\n\nfunction definePackage(name: string, version: string): ExpoPlatformPackage {\n return { name, version };\n}\n\n/**\n * The canonical Ankhorage projection of the supported Expo platform.\n *\n * Package versions come from Expo SDK 57's bundled native module map. Keep this\n * structure as the only hand-maintained Expo compatibility authority in this\n * repository; generated manifests and runtime planning derive from it.\n */\nexport const EXPO_PLATFORM = {\n sdk: 57,\n architecture: 'new-architecture-only',\n runtime: {\n expo: definePackage('expo', '~57.0.15'),\n react: definePackage('react', '19.2.3'),\n reactDom: definePackage('react-dom', '19.2.3'),\n reactNative: definePackage('react-native', '0.86.2'),\n reactNativeWeb: definePackage('react-native-web', '~0.21.0'),\n },\n tooling: {\n node: {\n lts: 24,\n version: '24.x',\n },\n nodeTypes: definePackage('@types/node', '^24.13.3'),\n typescript: definePackage('typescript', '~6.0.3'),\n expoDoctor: definePackage('expo-doctor', '1.20.2'),\n },\n navigation: {\n expoRouter: definePackage('expo-router', '~57.0.15'),\n screens: definePackage('react-native-screens', '~4.26.0'),\n safeArea: definePackage('react-native-safe-area-context', '~5.7.0'),\n },\n animation: {\n reanimated: definePackage('react-native-reanimated', '4.5.1'),\n worklets: definePackage('react-native-worklets', '0.10.1'),\n gestureHandler: definePackage('react-native-gesture-handler', '~2.32.0'),\n },\n ui: {\n svg: definePackage('react-native-svg', '15.15.4'),\n },\n packages: {\n metroRuntime: definePackage('@expo/metro-runtime', '~57.0.12'),\n asset: definePackage('expo-asset', '~57.0.13'),\n audio: definePackage('expo-audio', '~57.0.4'),\n authSession: definePackage('expo-auth-session', '~57.0.8'),\n camera: definePackage('expo-camera', '~57.0.4'),\n constants: definePackage('expo-constants', '~57.0.13'),\n devClient: definePackage('expo-dev-client', '~57.0.14'),\n documentPicker: definePackage('expo-document-picker', '~57.0.1'),\n fileSystem: definePackage('expo-file-system', '~57.0.5'),\n font: definePackage('expo-font', '~57.0.1'),\n imagePicker: definePackage('expo-image-picker', '~57.0.12'),\n linearGradient: definePackage('expo-linear-gradient', '~57.0.1'),\n linking: definePackage('expo-linking', '~57.0.7'),\n localization: definePackage('expo-localization', '~57.0.1'),\n location: definePackage('expo-location', '~57.0.12'),\n mediaLibrary: definePackage('expo-media-library', '~57.0.4'),\n notifications: definePackage('expo-notifications', '~57.0.13'),\n secureStore: definePackage('expo-secure-store', '~57.0.1'),\n splashScreen: definePackage('expo-splash-screen', '~57.0.7'),\n statusBar: definePackage('expo-status-bar', '~57.0.1'),\n updates: definePackage('expo-updates', '~57.0.16'),\n webBrowser: definePackage('expo-web-browser', '~57.0.2'),\n },\n platforms: {\n android: {\n minimumVersion: 7,\n minimumApiLevel: 24,\n compileSdk: 36,\n targetSdk: 36,\n edgeToEdge: true,\n },\n ios: {\n minimumVersion: '16.4',\n minimumXcodeVersion: '26.4',\n },\n },\n} as const;\n\nexport type ExpoPlatform = typeof EXPO_PLATFORM;\n"]}
@@ -1,24 +1,22 @@
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
- import { type ExpoPermissionMetadata, type PermissionSupport } from '@ankhorage/permissions/expo/manifest';
3
+ import { type ExpoPermissionMetadata } from '@ankhorage/permissions/expo/manifest';
4
+ import { type ExpoRuntimeAdapterId, type ExpoRuntimeCapabilityMetadata, type ExpoRuntimeConfigPlugin, type ExpoRuntimeDiagnostic, type ExpoRuntimeProviderId } from './expoRuntimePlanningMetadata';
5
+ export type { ExpoRuntimeAdapterId, ExpoRuntimeProviderId };
6
+ export interface ExpoRuntimePlanningScreen {
7
+ readonly requires?: {
8
+ readonly capabilities?: readonly ScreenCapabilityRequirement[];
9
+ readonly permissions?: readonly ScreenPermissionRequirement[];
10
+ };
11
+ }
12
+ export interface ExpoRuntimePlanningManifest {
13
+ readonly screens: Readonly<Record<string, ExpoRuntimePlanningScreen>>;
14
+ }
4
15
  interface ExpoRuntimeDependency {
5
16
  readonly name: string;
6
17
  readonly version: string;
7
18
  readonly reasons: readonly string[];
8
19
  }
9
- interface ExpoRuntimeConfigPlugin {
10
- readonly name: string;
11
- readonly options?: Readonly<Record<string, boolean | string>>;
12
- }
13
- export type ExpoRuntimeProviderId = 'permissions';
14
- export type ExpoRuntimeAdapterId = 'ExpoBarcodeScannerAdapter';
15
- interface ExpoRuntimeDiagnostic {
16
- readonly severity: 'error' | 'warning';
17
- readonly requirementType: 'capability' | 'configHint' | 'package' | 'permission';
18
- readonly requirement: string;
19
- readonly message: string;
20
- readonly support?: PermissionSupport;
21
- }
22
20
  export interface ExpoRuntimePlan {
23
21
  readonly permissions: readonly ScreenPermissionRequirement[];
24
22
  readonly capabilities: readonly ScreenCapabilityRequirement[];
@@ -35,19 +33,10 @@ export interface ExpoRuntimePlan {
35
33
  readonly needsPermissionsProvider: boolean;
36
34
  readonly diagnostics: readonly ExpoRuntimeDiagnostic[];
37
35
  }
38
- interface ExpoRuntimeCapabilityMetadata {
39
- readonly impliedPermissions?: readonly ScreenPermissionRequirement[];
40
- readonly requiredPackages?: readonly string[];
41
- readonly providers?: readonly ExpoRuntimeProviderId[];
42
- readonly runtimeAdapters?: readonly ExpoRuntimeAdapterId[];
43
- readonly androidPermissions?: readonly string[];
44
- readonly plugins?: readonly ExpoRuntimeConfigPlugin[];
45
- }
46
36
  interface ResolveExpoRuntimePlanOptions {
47
37
  readonly capabilityRegistry?: Readonly<Partial<Record<AnkhorageCapabilityName, ExpoRuntimeCapabilityMetadata>>>;
48
38
  readonly dependencyVersions?: Readonly<Record<string, string>>;
49
39
  readonly permissionSupport?: Readonly<Record<Permission, ExpoPermissionMetadata>>;
50
40
  }
51
- export declare function resolveExpoRuntimePlan(manifest: AppManifest, options?: ResolveExpoRuntimePlanOptions): ExpoRuntimePlan;
52
- export {};
41
+ export declare function resolveExpoRuntimePlan(manifest: ExpoRuntimePlanningManifest, options?: ResolveExpoRuntimePlanOptions): ExpoRuntimePlan;
53
42
  //# 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,o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AAC;CACxD;AAED,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;AA0BD,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,2BAA2B,EACrC,OAAO,GAAE,6BAAkC,GAC1C,eAAe,CAejB"}
@@ -1,215 +1,183 @@
1
1
  import { isPermission } from '@ankhorage/permissions';
2
2
  import { EXPO_PERMISSION_SUPPORT, } from '@ankhorage/permissions/expo/manifest';
3
- const CAMERA_ANDROID_PERMISSION = 'android.permission.CAMERA';
3
+ import { EXPO_CAPABILITY_RUNTIME_REGISTRY, EXPO_RUNTIME_PROVIDER_PACKAGES, findCapabilityMetadata, findConfigHintMetadata, GENERATED_RUNTIME_DEPENDENCY_VERSIONS, unknownCapabilityDiagnostic, unknownPermissionDiagnostic, unsupportedPermissionDiagnostic, } from './expoRuntimePlanningMetadata';
4
4
  const EXPO_RUNTIME_PACKAGE_NAME = '@ankhorage/expo-runtime';
5
- const GENERATED_EXPO_DEPENDENCY_VERSIONS = {
6
- '@ankhorage/permissions': '^0.2.0',
7
- '@ankhorage/expo-runtime': 'latest',
8
- 'expo-camera': '~17.0.10',
9
- };
10
- const EXPO_RUNTIME_PROVIDER_PACKAGES = {
11
- permissions: '@ankhorage/permissions',
12
- };
13
- const EXPO_RUNTIME_CONFIG_HINTS = {
14
- cameraPermission: {
15
- androidPermissions: [CAMERA_ANDROID_PERMISSION],
16
- plugin: {
17
- name: 'expo-camera',
18
- options: {
19
- cameraPermission: 'Allow camera access.',
20
- },
21
- },
22
- },
23
- };
24
- const EXPO_CAPABILITY_RUNTIME_REGISTRY = {
25
- barcodeScanner: {
26
- impliedPermissions: [{ permission: 'camera' }],
27
- requiredPackages: ['expo-camera'],
28
- providers: ['permissions'],
29
- runtimeAdapters: ['ExpoBarcodeScannerAdapter'],
30
- androidPermissions: [CAMERA_ANDROID_PERMISSION],
31
- plugins: [
32
- {
33
- name: 'expo-camera',
34
- options: {
35
- cameraPermission: 'Allow camera access to scan barcodes.',
36
- },
37
- },
38
- ],
39
- },
40
- };
41
5
  export function resolveExpoRuntimePlan(manifest, options = {}) {
42
- const permissionsByName = new Map();
43
- const impliedPermissionsByName = new Map();
44
- const capabilitiesByName = new Map();
45
- for (const screen of Object.values(manifest.screens)) {
46
- screen.requires?.permissions?.forEach((requirement) => {
47
- permissionsByName.set(requirement.permission, requirement);
48
- });
49
- screen.requires?.capabilities?.forEach((requirement) => {
50
- capabilitiesByName.set(requirement.capability, requirement);
51
- });
52
- }
53
- const capabilityRegistry = options.capabilityRegistry ?? EXPO_CAPABILITY_RUNTIME_REGISTRY;
54
- for (const capabilityRequirement of capabilitiesByName.values()) {
55
- capabilityRegistry[capabilityRequirement.capability]?.impliedPermissions?.forEach((permissionRequirement) => {
56
- if (!permissionsByName.has(permissionRequirement.permission)) {
57
- permissionsByName.set(permissionRequirement.permission, permissionRequirement);
58
- impliedPermissionsByName.set(permissionRequirement.permission, permissionRequirement);
59
- }
60
- });
6
+ const state = createPlanningState(manifest);
7
+ const context = {
8
+ state,
9
+ capabilityRegistry: options.capabilityRegistry ?? EXPO_CAPABILITY_RUNTIME_REGISTRY,
10
+ dependencyVersions: options.dependencyVersions ?? GENERATED_RUNTIME_DEPENDENCY_VERSIONS,
11
+ permissionSupport: options.permissionSupport ?? EXPO_PERMISSION_SUPPORT,
12
+ };
13
+ addImpliedPermissions(context);
14
+ planPermissions(context);
15
+ planCapabilities(context);
16
+ if (state.providers.size > 0 || state.runtimeAdapters.size > 0) {
17
+ addDependency(context, EXPO_RUNTIME_PACKAGE_NAME, 'runtime:expo');
61
18
  }
62
- const diagnostics = [];
63
- const dependencies = new Map();
64
- const pluginOptions = new Map();
65
- const configHints = new Set();
66
- const androidPermissions = new Set();
67
- const providers = new Set();
68
- const runtimeAdapters = new Set();
69
- const dependencyVersions = options.dependencyVersions ?? GENERATED_EXPO_DEPENDENCY_VERSIONS;
70
- const permissionSupport = options.permissionSupport ?? EXPO_PERMISSION_SUPPORT;
71
- const configHintRegistry = EXPO_RUNTIME_CONFIG_HINTS;
72
- const addDependency = (name, reason) => {
73
- const version = dependencyVersions[name];
74
- if (version === undefined) {
75
- diagnostics.push({
76
- severity: 'warning',
77
- requirementType: 'package',
78
- requirement: name,
79
- message: `No generated-app dependency version is registered for '${name}'.`,
80
- });
81
- return;
19
+ return buildPlan(state);
20
+ }
21
+ function createPlanningState(manifest) {
22
+ const permissions = new Map();
23
+ const capabilities = new Map();
24
+ for (const screen of Object.values(manifest.screens)) {
25
+ for (const requirement of screen.requires?.permissions ?? []) {
26
+ permissions.set(requirement.permission, requirement);
82
27
  }
83
- const existing = dependencies.get(name);
84
- if (existing) {
85
- dependencies.set(name, {
86
- ...existing,
87
- reasons: Array.from(new Set([...existing.reasons, reason])),
88
- });
89
- return;
28
+ for (const requirement of screen.requires?.capabilities ?? []) {
29
+ capabilities.set(requirement.capability, requirement);
90
30
  }
91
- dependencies.set(name, {
92
- name,
93
- version,
94
- reasons: [reason],
95
- });
96
- };
97
- const addProvider = (provider, reason) => {
98
- providers.add(provider);
99
- addDependency(EXPO_RUNTIME_PROVIDER_PACKAGES[provider], reason);
100
- };
101
- const addPlugin = (plugin) => {
102
- const existingOptions = pluginOptions.get(plugin.name) ?? {};
103
- pluginOptions.set(plugin.name, {
104
- ...existingOptions,
105
- ...(plugin.options ?? {}),
106
- });
31
+ }
32
+ return {
33
+ permissions,
34
+ capabilities,
35
+ impliedPermissions: new Map(),
36
+ diagnostics: [],
37
+ dependencies: new Map(),
38
+ pluginOptions: new Map(),
39
+ configHints: new Set(),
40
+ androidPermissions: new Set(),
41
+ providers: new Set(),
42
+ runtimeAdapters: new Set(),
107
43
  };
108
- for (const permissionRequirement of permissionsByName.values()) {
109
- if (!isPermission(permissionRequirement.permission)) {
110
- diagnostics.push({
111
- severity: 'error',
112
- requirementType: 'permission',
113
- requirement: permissionRequirement.permission,
114
- message: `Unknown permission '${permissionRequirement.permission}' cannot be resolved for Expo runtime generation.`,
115
- });
116
- continue;
117
- }
118
- const supportMetadata = permissionSupport[permissionRequirement.permission];
119
- if (supportMetadata.support === 'unsupported' ||
120
- supportMetadata.support === 'notImplemented' ||
121
- supportMetadata.support === 'limited') {
122
- diagnostics.push({
123
- severity: supportMetadata.support === 'limited' ? 'warning' : 'error',
124
- requirementType: 'permission',
125
- requirement: permissionRequirement.permission,
126
- message: `Expo runtime support for '${permissionRequirement.permission}' is '${supportMetadata.support}'.`,
127
- support: supportMetadata.support,
128
- });
129
- continue;
130
- }
131
- if (supportMetadata.support === 'notRequired') {
132
- continue;
133
- }
134
- addProvider('permissions', `permission:${permissionRequirement.permission}`);
135
- supportMetadata.requiredPackages.forEach((packageName) => {
136
- addDependency(packageName, `permission:${permissionRequirement.permission}`);
137
- });
138
- supportMetadata.configHints.forEach((configHint) => {
139
- configHints.add(configHint);
140
- const configHintMetadata = configHintRegistry[configHint];
141
- if (!configHintMetadata) {
142
- diagnostics.push({
143
- severity: 'warning',
144
- requirementType: 'configHint',
145
- requirement: configHint,
146
- message: `Config hint '${configHint}' is not translated into generated Expo config yet.`,
147
- });
148
- return;
149
- }
150
- configHintMetadata.androidPermissions?.forEach((permissionName) => {
151
- androidPermissions.add(permissionName);
152
- });
153
- if (configHintMetadata.plugin) {
154
- addPlugin(configHintMetadata.plugin);
44
+ }
45
+ function addImpliedPermissions(context) {
46
+ const { state } = context;
47
+ for (const capability of state.capabilities.values()) {
48
+ const metadata = findCapabilityMetadata(context.capabilityRegistry, capability);
49
+ for (const permission of metadata?.impliedPermissions ?? []) {
50
+ if (!state.permissions.has(permission.permission)) {
51
+ state.permissions.set(permission.permission, permission);
52
+ state.impliedPermissions.set(permission.permission, permission);
155
53
  }
156
- });
54
+ }
55
+ }
56
+ }
57
+ function planPermissions(context) {
58
+ for (const requirement of context.state.permissions.values()) {
59
+ planPermission(context, requirement);
60
+ }
61
+ }
62
+ function planPermission(context, requirement) {
63
+ if (!isPermission(requirement.permission)) {
64
+ context.state.diagnostics.push(unknownPermissionDiagnostic(requirement.permission));
65
+ return;
157
66
  }
158
- for (const capabilityRequirement of capabilitiesByName.values()) {
159
- const capabilityMetadata = capabilityRegistry[capabilityRequirement.capability];
160
- if (!capabilityMetadata) {
161
- diagnostics.push({
162
- severity: 'warning',
163
- requirementType: 'capability',
164
- requirement: capabilityRequirement.capability,
165
- message: `No Expo runtime metadata is registered for capability '${capabilityRequirement.capability}'.`,
166
- });
67
+ const metadata = findPermissionSupport(context.permissionSupport, requirement.permission);
68
+ if (isUnsupported(metadata.support)) {
69
+ context.state.diagnostics.push(unsupportedPermissionDiagnostic(requirement.permission, metadata.support));
70
+ return;
71
+ }
72
+ if (metadata.support === 'notRequired') {
73
+ return;
74
+ }
75
+ const reason = `permission:${requirement.permission}`;
76
+ addProvider(context, 'permissions', reason);
77
+ metadata.requiredPackages.forEach((name) => addDependency(context, name, reason));
78
+ metadata.configHints.forEach((hint) => applyConfigHint(context.state, hint));
79
+ }
80
+ function planCapabilities(context) {
81
+ for (const requirement of context.state.capabilities.values()) {
82
+ const metadata = findCapabilityMetadata(context.capabilityRegistry, requirement);
83
+ if (metadata === undefined) {
84
+ context.state.diagnostics.push(unknownCapabilityDiagnostic(requirement.capability));
167
85
  continue;
168
86
  }
169
- capabilityMetadata.requiredPackages?.forEach((packageName) => {
170
- addDependency(packageName, `capability:${capabilityRequirement.capability}`);
171
- });
172
- capabilityMetadata.providers?.forEach((provider) => {
173
- addProvider(provider, `capability:${capabilityRequirement.capability}`);
174
- });
175
- capabilityMetadata.runtimeAdapters?.forEach((runtimeAdapter) => {
176
- runtimeAdapters.add(runtimeAdapter);
87
+ const reason = `capability:${requirement.capability}`;
88
+ metadata.requiredPackages?.forEach((name) => addDependency(context, name, reason));
89
+ metadata.providers?.forEach((provider) => addProvider(context, provider, reason));
90
+ metadata.runtimeAdapters?.forEach((adapter) => context.state.runtimeAdapters.add(adapter));
91
+ metadata.androidPermissions?.forEach((permission) => context.state.androidPermissions.add(permission));
92
+ metadata.plugins?.forEach((plugin) => addPlugin(context.state, plugin));
93
+ }
94
+ }
95
+ function applyConfigHint(state, configHint) {
96
+ state.configHints.add(configHint);
97
+ const metadata = findConfigHintMetadata(configHint);
98
+ if (metadata === undefined) {
99
+ state.diagnostics.push({
100
+ severity: 'warning',
101
+ requirementType: 'configHint',
102
+ requirement: configHint,
103
+ message: `Config hint '${configHint}' is not translated into generated Expo config yet.`,
177
104
  });
178
- capabilityMetadata.androidPermissions?.forEach((permissionName) => {
179
- androidPermissions.add(permissionName);
105
+ return;
106
+ }
107
+ metadata.androidPermissions?.forEach((permission) => state.androidPermissions.add(permission));
108
+ if (metadata.plugin !== undefined) {
109
+ addPlugin(state, metadata.plugin);
110
+ }
111
+ }
112
+ function addDependency(context, name, reason) {
113
+ const version = findDependencyVersion(context.dependencyVersions, name);
114
+ if (version === undefined) {
115
+ context.state.diagnostics.push({
116
+ severity: 'warning',
117
+ requirementType: 'package',
118
+ requirement: name,
119
+ message: `No generated-app dependency version is registered for '${name}'.`,
180
120
  });
181
- capabilityMetadata.plugins?.forEach(addPlugin);
121
+ return;
182
122
  }
183
- if (providers.size > 0 || runtimeAdapters.size > 0) {
184
- addDependency(EXPO_RUNTIME_PACKAGE_NAME, 'runtime:expo');
123
+ const existing = context.state.dependencies.get(name);
124
+ context.state.dependencies.set(name, {
125
+ name,
126
+ version,
127
+ reasons: existing === undefined ? [reason] : Array.from(new Set([...existing.reasons, reason])),
128
+ });
129
+ }
130
+ function addProvider(context, provider, reason) {
131
+ context.state.providers.add(provider);
132
+ const packageName = Object.entries(EXPO_RUNTIME_PROVIDER_PACKAGES).find(([name]) => name === String(provider))?.[1];
133
+ if (packageName === undefined) {
134
+ throw new Error(`Runtime package metadata is missing for provider '${provider}'.`);
185
135
  }
186
- const plugins = Array.from(pluginOptions.entries())
187
- .map(([name, options]) => ({
136
+ addDependency(context, packageName, reason);
137
+ }
138
+ function addPlugin(state, plugin) {
139
+ const existingOptions = state.pluginOptions.get(plugin.name) ?? {};
140
+ state.pluginOptions.set(plugin.name, { ...existingOptions, ...(plugin.options ?? {}) });
141
+ }
142
+ function buildPlan(state) {
143
+ const plugins = Array.from(state.pluginOptions, ([name, options]) => ({
188
144
  name,
189
145
  options: Object.keys(options).length > 0 ? options : undefined,
190
- }))
191
- .sort((left, right) => left.name.localeCompare(right.name));
146
+ })).sort((left, right) => left.name.localeCompare(right.name));
192
147
  return {
193
- permissions: Array.from(permissionsByName.values()).sort(comparePermissionRequirements),
194
- capabilities: Array.from(capabilitiesByName.values()).sort(compareCapabilityRequirements),
195
- impliedPermissions: Array.from(impliedPermissionsByName.values()).sort(comparePermissionRequirements),
196
- dependencies: Array.from(dependencies.values()).sort((left, right) => left.name.localeCompare(right.name)),
148
+ permissions: Array.from(state.permissions.values()).sort(comparePermissions),
149
+ capabilities: Array.from(state.capabilities.values()).sort(compareCapabilities),
150
+ impliedPermissions: Array.from(state.impliedPermissions.values()).sort(comparePermissions),
151
+ dependencies: Array.from(state.dependencies.values()).sort((left, right) => left.name.localeCompare(right.name)),
197
152
  nativeConfig: {
198
- androidPermissions: Array.from(androidPermissions).sort(),
199
- configHints: Array.from(configHints).sort(),
153
+ androidPermissions: Array.from(state.androidPermissions).sort(),
154
+ configHints: Array.from(state.configHints).sort(),
200
155
  plugins,
201
156
  },
202
- providers: Array.from(providers).sort(),
203
- runtimeAdapters: Array.from(runtimeAdapters).sort(),
204
- usesExpoRuntimeRegistry: runtimeAdapters.size > 0,
205
- needsPermissionsProvider: providers.has('permissions'),
206
- diagnostics,
157
+ providers: Array.from(state.providers).sort(),
158
+ runtimeAdapters: Array.from(state.runtimeAdapters).sort(),
159
+ usesExpoRuntimeRegistry: state.runtimeAdapters.size > 0,
160
+ needsPermissionsProvider: state.providers.has('permissions'),
161
+ diagnostics: state.diagnostics,
207
162
  };
208
163
  }
209
- function compareCapabilityRequirements(left, right) {
164
+ function findPermissionSupport(registry, permission) {
165
+ const metadata = Object.entries(registry).find(([name]) => name === String(permission))?.[1];
166
+ if (metadata === undefined) {
167
+ throw new Error(`Permission metadata is missing for '${permission}'.`);
168
+ }
169
+ return metadata;
170
+ }
171
+ function findDependencyVersion(versions, name) {
172
+ return Object.entries(versions).find(([candidate]) => candidate === name)?.[1];
173
+ }
174
+ function isUnsupported(support) {
175
+ return support === 'unsupported' || support === 'notImplemented' || support === 'limited';
176
+ }
177
+ function compareCapabilities(left, right) {
210
178
  return left.capability.localeCompare(right.capability);
211
179
  }
212
- function comparePermissionRequirements(left, right) {
180
+ function comparePermissions(left, right) {
213
181
  return left.permission.localeCompare(right.permission);
214
182
  }
215
183
  //# sourceMappingURL=resolveExpoRuntimePlan.js.map