@ankhorage/expo-runtime 0.0.6 → 0.0.7

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
+ ## 0.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 7eddf62: Add generated layout helper output for Expo provider imports.
8
+
3
9
  ## 0.0.6
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { executeExpoRuntimeAction, type ExecuteExpoRuntimeActionArgs, type ExpoR
6
6
  export { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';
7
7
  export { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';
8
8
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
9
+ export { type ExpoRuntimeLayoutIntegrationPlan, resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
9
10
  export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
10
11
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,2CAA2C,EAC3C,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,2CAA2C,EAC3C,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EACL,KAAK,gCAAgC,EACrC,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -5,5 +5,6 @@ export { executeExpoRuntimeAction, resolveExpoRuntimeRoutePath, } from './expoAc
5
5
  export { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';
6
6
  export { ExpoRuntimeProviders } from './ExpoRuntimeProviders';
7
7
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
8
+ export { resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
8
9
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
9
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EAGrB,2CAA2C,EAC3C,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,wBAAwB,EAOxB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AAMrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n BARCODE_SCAN_DEDUPE_WINDOW_MS,\n BARCODE_SCANNER_TYPES,\n type BarcodeScanRecord,\n type ExpoBarcodeScanResultLike,\n mapPermissionStatusToCameraPermissionStatus,\n normalizeExpoBarcodeScanResult,\n shouldIgnoreBarcodeScan,\n} from './barcodeScanRuntime';\nexport type { ComponentRegistry } from './componentRegistry';\nexport { createComponentRegistry } from './componentRegistry';\nexport { createExpoRuntimeRegistry } from './createExpoRuntimeRegistry';\nexport {\n executeExpoRuntimeAction,\n type ExecuteExpoRuntimeActionArgs,\n type ExpoRuntimeActionHandlerArgs,\n type ExpoRuntimeActionHandlers,\n type ExpoRuntimeRouteResolution,\n type ExpoRuntimeRouterLike,\n type ExpoRuntimeThemeMode,\n resolveExpoRuntimeRoutePath,\n} from './expoActionBridge';\nexport { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';\nexport { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';\nexport { getExpoBarcodeScannerViewSource } from './generatedSources';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EAGrB,2CAA2C,EAC3C,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,wBAAwB,EAOxB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n BARCODE_SCAN_DEDUPE_WINDOW_MS,\n BARCODE_SCANNER_TYPES,\n type BarcodeScanRecord,\n type ExpoBarcodeScanResultLike,\n mapPermissionStatusToCameraPermissionStatus,\n normalizeExpoBarcodeScanResult,\n shouldIgnoreBarcodeScan,\n} from './barcodeScanRuntime';\nexport type { ComponentRegistry } from './componentRegistry';\nexport { createComponentRegistry } from './componentRegistry';\nexport { createExpoRuntimeRegistry } from './createExpoRuntimeRegistry';\nexport {\n executeExpoRuntimeAction,\n type ExecuteExpoRuntimeActionArgs,\n type ExpoRuntimeActionHandlerArgs,\n type ExpoRuntimeActionHandlers,\n type ExpoRuntimeRouteResolution,\n type ExpoRuntimeRouterLike,\n type ExpoRuntimeThemeMode,\n resolveExpoRuntimeRoutePath,\n} from './expoActionBridge';\nexport { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';\nexport { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';\nexport { getExpoBarcodeScannerViewSource } from './generatedSources';\nexport {\n type ExpoRuntimeLayoutIntegrationPlan,\n resolveExpoRuntimeLayoutIntegration,\n} from './layoutIntegrationPlanning';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
@@ -0,0 +1,9 @@
1
+ import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';
2
+ export interface ExpoRuntimeLayoutIntegrationPlan {
3
+ readonly imports: readonly string[];
4
+ readonly moduleDeclarations: readonly string[];
5
+ readonly providerStart: readonly string[];
6
+ readonly providerEnd: readonly string[];
7
+ }
8
+ export declare function resolveExpoRuntimeLayoutIntegration(runtimePlan: ExpoRuntimePlan | undefined): ExpoRuntimeLayoutIntegrationPlan;
9
+ //# sourceMappingURL=layoutIntegrationPlanning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layoutIntegrationPlanning.d.ts","sourceRoot":"","sources":["../src/layoutIntegrationPlanning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,eAAe,GAAG,SAAS,GACvC,gCAAgC,CA2BlC"}
@@ -0,0 +1,22 @@
1
+ export function resolveExpoRuntimeLayoutIntegration(runtimePlan) {
2
+ const imports = [];
3
+ const expoRuntimeImports = [];
4
+ const moduleDeclarations = [];
5
+ const providerStart = [];
6
+ const providerEnd = [];
7
+ if ((runtimePlan?.providers.length ?? 0) > 0) {
8
+ expoRuntimeImports.push('ExpoRuntimeProviders');
9
+ providerStart.push(`<ExpoRuntimeProviders providers={['${(runtimePlan?.providers ?? []).join("', '")}']}>`);
10
+ providerEnd.push('</ExpoRuntimeProviders>');
11
+ }
12
+ if (expoRuntimeImports.length > 0) {
13
+ imports.push(`import { ${Array.from(new Set(expoRuntimeImports)).join(', ')} } from '@ankhorage/expo-runtime';`);
14
+ }
15
+ return {
16
+ imports,
17
+ moduleDeclarations,
18
+ providerStart,
19
+ providerEnd,
20
+ };
21
+ }
22
+ //# sourceMappingURL=layoutIntegrationPlanning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layoutIntegrationPlanning.js","sourceRoot":"","sources":["../src/layoutIntegrationPlanning.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,mCAAmC,CACjD,WAAwC;IAExC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,kBAAkB,GAAa,EAAE,CAAC;IACxC,MAAM,kBAAkB,GAAa,EAAE,CAAC;IACxC,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,kBAAkB,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChD,aAAa,CAAC,IAAI,CAChB,sCAAsC,CAAC,WAAW,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CACxF,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CACV,YAAY,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,oCAAoC,CACnG,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO;QACP,kBAAkB;QAClB,aAAa;QACb,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';\n\nexport interface ExpoRuntimeLayoutIntegrationPlan {\n readonly imports: readonly string[];\n readonly moduleDeclarations: readonly string[];\n readonly providerStart: readonly string[];\n readonly providerEnd: readonly string[];\n}\n\nexport function resolveExpoRuntimeLayoutIntegration(\n runtimePlan: ExpoRuntimePlan | undefined,\n): ExpoRuntimeLayoutIntegrationPlan {\n const imports: string[] = [];\n const expoRuntimeImports: string[] = [];\n const moduleDeclarations: string[] = [];\n const providerStart: string[] = [];\n const providerEnd: string[] = [];\n\n if ((runtimePlan?.providers.length ?? 0) > 0) {\n expoRuntimeImports.push('ExpoRuntimeProviders');\n providerStart.push(\n `<ExpoRuntimeProviders providers={['${(runtimePlan?.providers ?? []).join(\"', '\")}']}>`,\n );\n providerEnd.push('</ExpoRuntimeProviders>');\n }\n\n if (expoRuntimeImports.length > 0) {\n imports.push(\n `import { ${Array.from(new Set(expoRuntimeImports)).join(', ')} } from '@ankhorage/expo-runtime';`,\n );\n }\n\n return {\n imports,\n moduleDeclarations,\n providerStart,\n providerEnd,\n };\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
2
+ export { type ExpoRuntimeLayoutIntegrationPlan, resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
2
3
  export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
3
4
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
4
5
  //# sourceMappingURL=planning.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,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,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EACL,KAAK,gCAAgC,EACrC,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/planning.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
2
+ export { resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
2
3
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
3
4
  //# sourceMappingURL=planning.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"planning.js","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AAMrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export { getExpoBarcodeScannerViewSource } from './generatedSources';\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,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export { getExpoBarcodeScannerViewSource } from './generatedSources';\nexport {\n type ExpoRuntimeLayoutIntegrationPlan,\n resolveExpoRuntimeLayoutIntegration,\n} from './layoutIntegrationPlanning';\nexport type {\n ExpoRuntimeAdapterId,\n ExpoRuntimePlan,\n ExpoRuntimeProviderId,\n} from './resolveExpoRuntimePlan';\nexport { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/expo-runtime",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
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/index.ts CHANGED
@@ -23,6 +23,10 @@ export {
23
23
  export { ExpoBarcodeScannerAdapter } from './ExpoBarcodeScannerAdapter';
24
24
  export { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';
25
25
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
26
+ export {
27
+ type ExpoRuntimeLayoutIntegrationPlan,
28
+ resolveExpoRuntimeLayoutIntegration,
29
+ } from './layoutIntegrationPlanning';
26
30
  export type {
27
31
  ExpoRuntimeAdapterId,
28
32
  ExpoRuntimePlan,
@@ -0,0 +1,55 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+
3
+ import { resolveExpoRuntimeLayoutIntegration } from './layoutIntegrationPlanning';
4
+ import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';
5
+
6
+ const EMPTY_PLAN: ExpoRuntimePlan = {
7
+ permissions: [],
8
+ capabilities: [],
9
+ impliedPermissions: [],
10
+ dependencies: [],
11
+ nativeConfig: {
12
+ androidPermissions: [],
13
+ configHints: [],
14
+ plugins: [],
15
+ },
16
+ providers: [],
17
+ runtimeAdapters: [],
18
+ usesExpoRuntimeRegistry: false,
19
+ needsPermissionsProvider: false,
20
+ diagnostics: [],
21
+ };
22
+
23
+ const PERMISSIONS_PROVIDER_START = "<ExpoRuntimeProviders providers={['permissions']}>";
24
+
25
+ describe('layoutIntegrationPlanning', () => {
26
+ test('returns an empty integration plan when no providers are required', () => {
27
+ expect(resolveExpoRuntimeLayoutIntegration(undefined)).toEqual({
28
+ imports: [],
29
+ moduleDeclarations: [],
30
+ providerStart: [],
31
+ providerEnd: [],
32
+ });
33
+ expect(resolveExpoRuntimeLayoutIntegration(EMPTY_PLAN)).toEqual({
34
+ imports: [],
35
+ moduleDeclarations: [],
36
+ providerStart: [],
37
+ providerEnd: [],
38
+ });
39
+ });
40
+
41
+ test('adds ExpoRuntimeProviders import and wrapper when providers are required', () => {
42
+ expect(
43
+ resolveExpoRuntimeLayoutIntegration({
44
+ ...EMPTY_PLAN,
45
+ providers: ['permissions'],
46
+ needsPermissionsProvider: true,
47
+ }),
48
+ ).toEqual({
49
+ imports: ["import { ExpoRuntimeProviders } from '@ankhorage/expo-runtime';"],
50
+ moduleDeclarations: [],
51
+ providerStart: [PERMISSIONS_PROVIDER_START],
52
+ providerEnd: ['</ExpoRuntimeProviders>'],
53
+ });
54
+ });
55
+ });
@@ -0,0 +1,39 @@
1
+ import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';
2
+
3
+ export interface ExpoRuntimeLayoutIntegrationPlan {
4
+ readonly imports: readonly string[];
5
+ readonly moduleDeclarations: readonly string[];
6
+ readonly providerStart: readonly string[];
7
+ readonly providerEnd: readonly string[];
8
+ }
9
+
10
+ export function resolveExpoRuntimeLayoutIntegration(
11
+ runtimePlan: ExpoRuntimePlan | undefined,
12
+ ): ExpoRuntimeLayoutIntegrationPlan {
13
+ const imports: string[] = [];
14
+ const expoRuntimeImports: string[] = [];
15
+ const moduleDeclarations: string[] = [];
16
+ const providerStart: string[] = [];
17
+ const providerEnd: string[] = [];
18
+
19
+ if ((runtimePlan?.providers.length ?? 0) > 0) {
20
+ expoRuntimeImports.push('ExpoRuntimeProviders');
21
+ providerStart.push(
22
+ `<ExpoRuntimeProviders providers={['${(runtimePlan?.providers ?? []).join("', '")}']}>`,
23
+ );
24
+ providerEnd.push('</ExpoRuntimeProviders>');
25
+ }
26
+
27
+ if (expoRuntimeImports.length > 0) {
28
+ imports.push(
29
+ `import { ${Array.from(new Set(expoRuntimeImports)).join(', ')} } from '@ankhorage/expo-runtime';`,
30
+ );
31
+ }
32
+
33
+ return {
34
+ imports,
35
+ moduleDeclarations,
36
+ providerStart,
37
+ providerEnd,
38
+ };
39
+ }
package/src/planning.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
2
+ export {
3
+ type ExpoRuntimeLayoutIntegrationPlan,
4
+ resolveExpoRuntimeLayoutIntegration,
5
+ } from './layoutIntegrationPlanning';
2
6
  export type {
3
7
  ExpoRuntimeAdapterId,
4
8
  ExpoRuntimePlan,