@ankhorage/expo-runtime 2.2.1 → 2.3.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 +6 -0
- package/dist/nativeLinkingPlanning.d.ts +5 -0
- package/dist/nativeLinkingPlanning.d.ts.map +1 -0
- package/dist/nativeLinkingPlanning.js +11 -0
- package/dist/nativeLinkingPlanning.js.map +1 -0
- package/dist/planning.d.ts +1 -0
- package/dist/planning.d.ts.map +1 -1
- package/dist/planning.js +1 -0
- package/dist/planning.js.map +1 -1
- package/package.json +2 -2
- package/src/nativeLinkingPlanning.test.ts +77 -0
- package/src/nativeLinkingPlanning.ts +22 -0
- package/src/planning.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AppDeployTargets } from '@ankhorage/contracts/deploy';
|
|
2
|
+
export type ExpoRuntimeNativePlatform = 'android' | 'ios';
|
|
3
|
+
export type ExpoRuntimeNativeSchemeMap = Readonly<Partial<Record<ExpoRuntimeNativePlatform, string>>>;
|
|
4
|
+
export declare function resolveExpoRuntimeNativeSchemeMap(targets: AppDeployTargets): ExpoRuntimeNativeSchemeMap;
|
|
5
|
+
//# sourceMappingURL=nativeLinkingPlanning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeLinkingPlanning.d.ts","sourceRoot":"","sources":["../src/nativeLinkingPlanning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,KAAK,CAAC;AAE1D,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAC/C,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC,CACnD,CAAC;AAEF,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,gBAAgB,GACxB,0BAA0B,CAW5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function resolveExpoRuntimeNativeSchemeMap(targets) {
|
|
2
|
+
const schemes = {};
|
|
3
|
+
if (targets.android?.enabled && targets.android.scheme !== undefined) {
|
|
4
|
+
schemes.android = targets.android.scheme;
|
|
5
|
+
}
|
|
6
|
+
if (targets.ios?.enabled && targets.ios.scheme !== undefined) {
|
|
7
|
+
schemes.ios = targets.ios.scheme;
|
|
8
|
+
}
|
|
9
|
+
return schemes;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=nativeLinkingPlanning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeLinkingPlanning.js","sourceRoot":"","sources":["../src/nativeLinkingPlanning.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,iCAAiC,CAC/C,OAAyB;IAEzB,MAAM,OAAO,GAAuD,EAAE,CAAC;IAEvE,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACrE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;IAC3C,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,EAAE,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC7D,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { AppDeployTargets } from '@ankhorage/contracts/deploy';\n\nexport type ExpoRuntimeNativePlatform = 'android' | 'ios';\n\nexport type ExpoRuntimeNativeSchemeMap = Readonly<\n Partial<Record<ExpoRuntimeNativePlatform, string>>\n>;\n\nexport function resolveExpoRuntimeNativeSchemeMap(\n targets: AppDeployTargets,\n): ExpoRuntimeNativeSchemeMap {\n const schemes: Partial<Record<ExpoRuntimeNativePlatform, string>> = {};\n\n if (targets.android?.enabled && targets.android.scheme !== undefined) {\n schemes.android = targets.android.scheme;\n }\n if (targets.ios?.enabled && targets.ios.scheme !== undefined) {\n schemes.ios = targets.ios.scheme;\n }\n\n return schemes;\n}\n"]}
|
package/dist/planning.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { type ExpoRuntimeConfigPluginOutput, type ExpoRuntimeDependencyMap, type ExpoRuntimeGeneratedAppOutputPlan, type ExpoRuntimeNativeOutputPlan, resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap, resolveExpoRuntimeGeneratedAppOutput, resolveExpoRuntimeNativeOutput, } from './generatedAppOutput';
|
|
2
2
|
export { getExpoBarcodeScannerViewSource } from './generatedSources';
|
|
3
3
|
export { type ExpoRuntimeLayoutIntegrationPlan, resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
|
|
4
|
+
export { type ExpoRuntimeNativePlatform, type ExpoRuntimeNativeSchemeMap, resolveExpoRuntimeNativeSchemeMap, } from './nativeLinkingPlanning';
|
|
4
5
|
export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
|
|
5
6
|
export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
|
|
6
7
|
//# sourceMappingURL=planning.d.ts.map
|
package/dist/planning.d.ts.map
CHANGED
|
@@ -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,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,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/planning.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap, resolveExpoRuntimeGeneratedAppOutput, resolveExpoRuntimeNativeOutput, } from './generatedAppOutput';
|
|
2
2
|
export { getExpoBarcodeScannerViewSource } from './generatedSources';
|
|
3
3
|
export { resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
|
|
4
|
+
export { resolveExpoRuntimeNativeSchemeMap, } from './nativeLinkingPlanning';
|
|
4
5
|
export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
|
|
5
6
|
//# sourceMappingURL=planning.js.map
|
package/dist/planning.js.map
CHANGED
|
@@ -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;
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/expo-runtime",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.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": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"runtime"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ankhorage/contracts": "^7.
|
|
25
|
+
"@ankhorage/contracts": "^7.8.0",
|
|
26
26
|
"@ankhorage/permissions": "^0.2.1"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { AppDeployTargets } from '@ankhorage/contracts/deploy';
|
|
2
|
+
import { describe, expect, test } from 'bun:test';
|
|
3
|
+
|
|
4
|
+
import { resolveExpoRuntimeNativeSchemeMap } from './nativeLinkingPlanning';
|
|
5
|
+
|
|
6
|
+
const TARGET_CASES: readonly [string, AppDeployTargets, Readonly<Record<string, string>>][] = [
|
|
7
|
+
['web', { web: { enabled: true } }, {}],
|
|
8
|
+
[
|
|
9
|
+
'android',
|
|
10
|
+
{ android: { enabled: true, package: 'com.ankh.android', scheme: 'ankh-android' } },
|
|
11
|
+
{ android: 'ankh-android' },
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
'ios',
|
|
15
|
+
{ ios: { enabled: true, bundleIdentifier: 'com.ankh.ios', scheme: 'ankh-ios' } },
|
|
16
|
+
{ ios: 'ankh-ios' },
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
'web + android',
|
|
20
|
+
{
|
|
21
|
+
web: { enabled: true },
|
|
22
|
+
android: { enabled: true, package: 'com.ankh.android', scheme: 'ankh-android' },
|
|
23
|
+
},
|
|
24
|
+
{ android: 'ankh-android' },
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
'web + ios',
|
|
28
|
+
{
|
|
29
|
+
web: { enabled: true },
|
|
30
|
+
ios: { enabled: true, bundleIdentifier: 'com.ankh.ios', scheme: 'ankh-ios' },
|
|
31
|
+
},
|
|
32
|
+
{ ios: 'ankh-ios' },
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
'android + ios',
|
|
36
|
+
{
|
|
37
|
+
android: { enabled: true, package: 'com.ankh.android', scheme: 'ankh-android' },
|
|
38
|
+
ios: { enabled: true, bundleIdentifier: 'com.ankh.ios', scheme: 'ankh-ios' },
|
|
39
|
+
},
|
|
40
|
+
{ android: 'ankh-android', ios: 'ankh-ios' },
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
'web + android + ios',
|
|
44
|
+
{
|
|
45
|
+
web: { enabled: true },
|
|
46
|
+
android: { enabled: true, package: 'com.ankh.android', scheme: 'ankh-android' },
|
|
47
|
+
ios: { enabled: true, bundleIdentifier: 'com.ankh.ios', scheme: 'ankh-ios' },
|
|
48
|
+
},
|
|
49
|
+
{ android: 'ankh-android', ios: 'ankh-ios' },
|
|
50
|
+
],
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
describe('resolveExpoRuntimeNativeSchemeMap', () => {
|
|
54
|
+
for (const [name, targets, expected] of TARGET_CASES) {
|
|
55
|
+
test(`derives only enabled native schemes for ${name}`, () => {
|
|
56
|
+
expect(resolveExpoRuntimeNativeSchemeMap(targets)).toEqual(expected);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
test('does not guess schemes from native application identifiers', () => {
|
|
61
|
+
expect(
|
|
62
|
+
resolveExpoRuntimeNativeSchemeMap({
|
|
63
|
+
android: { enabled: true, package: 'com.ankh.android' },
|
|
64
|
+
ios: { enabled: true, bundleIdentifier: 'com.ankh.ios' },
|
|
65
|
+
}),
|
|
66
|
+
).toEqual({});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('omits disabled native targets even when they retain stable schemes', () => {
|
|
70
|
+
expect(
|
|
71
|
+
resolveExpoRuntimeNativeSchemeMap({
|
|
72
|
+
android: { enabled: false, package: 'com.ankh.android', scheme: 'ankh-android' },
|
|
73
|
+
ios: { enabled: false, bundleIdentifier: 'com.ankh.ios', scheme: 'ankh-ios' },
|
|
74
|
+
}),
|
|
75
|
+
).toEqual({});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AppDeployTargets } from '@ankhorage/contracts/deploy';
|
|
2
|
+
|
|
3
|
+
export type ExpoRuntimeNativePlatform = 'android' | 'ios';
|
|
4
|
+
|
|
5
|
+
export type ExpoRuntimeNativeSchemeMap = Readonly<
|
|
6
|
+
Partial<Record<ExpoRuntimeNativePlatform, string>>
|
|
7
|
+
>;
|
|
8
|
+
|
|
9
|
+
export function resolveExpoRuntimeNativeSchemeMap(
|
|
10
|
+
targets: AppDeployTargets,
|
|
11
|
+
): ExpoRuntimeNativeSchemeMap {
|
|
12
|
+
const schemes: Partial<Record<ExpoRuntimeNativePlatform, string>> = {};
|
|
13
|
+
|
|
14
|
+
if (targets.android?.enabled && targets.android.scheme !== undefined) {
|
|
15
|
+
schemes.android = targets.android.scheme;
|
|
16
|
+
}
|
|
17
|
+
if (targets.ios?.enabled && targets.ios.scheme !== undefined) {
|
|
18
|
+
schemes.ios = targets.ios.scheme;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return schemes;
|
|
22
|
+
}
|
package/src/planning.ts
CHANGED
|
@@ -13,6 +13,11 @@ export {
|
|
|
13
13
|
type ExpoRuntimeLayoutIntegrationPlan,
|
|
14
14
|
resolveExpoRuntimeLayoutIntegration,
|
|
15
15
|
} from './layoutIntegrationPlanning';
|
|
16
|
+
export {
|
|
17
|
+
type ExpoRuntimeNativePlatform,
|
|
18
|
+
type ExpoRuntimeNativeSchemeMap,
|
|
19
|
+
resolveExpoRuntimeNativeSchemeMap,
|
|
20
|
+
} from './nativeLinkingPlanning';
|
|
16
21
|
export type {
|
|
17
22
|
ExpoRuntimeAdapterId,
|
|
18
23
|
ExpoRuntimePlan,
|