@ankhorage/expo-runtime 7.4.0 → 7.4.2
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 +12 -0
- package/README.md +1 -2
- package/dist/generatedApp.d.ts +4 -0
- package/dist/generatedApp.d.ts.map +1 -0
- package/dist/generatedApp.js +303 -0
- package/dist/generatedApp.js.map +1 -0
- package/dist/generatedAppScaffold.d.ts +2 -1
- package/dist/generatedAppScaffold.d.ts.map +1 -1
- package/dist/generatedAppScaffold.js +31 -4
- package/dist/generatedAppScaffold.js.map +1 -1
- package/package.json +7 -7
- package/src/generatedApp.test.ts +11 -0
- package/src/generatedApp.ts +13 -0
- package/src/generatedAppScaffold.test.ts +25 -6
- package/src/generatedAppScaffold.ts +41 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/expo-runtime
|
|
2
2
|
|
|
3
|
+
## 7.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c62677b: Make the published generated-app subpath Node ESM importable.
|
|
8
|
+
|
|
9
|
+
## 7.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- f4f0936: Make generated Expo app scaffolds independently installable and derive their application identity from the manifest.
|
|
14
|
+
|
|
3
15
|
## 7.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# EXPO-RUNTIME
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Declarative runtime integration for Expo apps: maps app capabilities to permissions, packages, config plugins, providers, and adapters
|
|
9
9
|
|
|
@@ -59,5 +59,4 @@ export function createBasicExpoRuntimePlan() {
|
|
|
59
59
|
- [ExpoZoraIconFontProvider sequence](././paradox/diagrams/sequences/expo-zora-icon-font-provider.mmd)
|
|
60
60
|
- [getExpoBundledMediaRegistrySource sequence](././paradox/diagrams/sequences/get-expo-bundled-media-registry-source.mmd)
|
|
61
61
|
- [resolveExpoRuntimeGeneratedAppOutput sequence](././paradox/diagrams/sequences/resolve-expo-runtime-generated-app-output.mmd)
|
|
62
|
-
- [resolveExpoRuntimeGeneratedAppScaffold sequence](././paradox/diagrams/sequences/resolve-expo-runtime-generated-app-scaffold.mmd)
|
|
63
62
|
- [resolveExpoRuntimeNativeOutput sequence](././paradox/diagrams/sequences/resolve-expo-runtime-native-output.mmd)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*** Expose the complete public generated-app planning surface from one Node ESM-safe entrypoint. */
|
|
2
|
+
export { type ExpoRuntimeGeneratedAppScaffold, type ExpoRuntimeGeneratedAppScaffoldFile, resolveExpoRuntimeGeneratedAppScaffold, } from './generatedAppScaffold';
|
|
3
|
+
export { type ExpoRuntimeGeneratedAppSourceDiagnostic, type ExpoRuntimeGeneratedAppSourceFile, type ExpoRuntimeGeneratedAppSources, resolveExpoRuntimeGeneratedAppSources, type ResolveExpoRuntimeGeneratedAppSourcesOptions, } from './generatedAppSources';
|
|
4
|
+
//# sourceMappingURL=generatedApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatedApp.d.ts","sourceRoot":"","sources":["../src/generatedApp.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,mCAAmC,EACxC,sCAAsC,GACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,uCAAuC,EAC5C,KAAK,iCAAiC,EACtC,KAAK,8BAA8B,EACnC,qCAAqC,EACrC,KAAK,4CAA4C,GAClD,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// src/layoutIntegrationPlanning.ts
|
|
2
|
+
function resolveExpoRuntimeLayoutIntegration(runtimePlan) {
|
|
3
|
+
const imports = [];
|
|
4
|
+
const expoRuntimeImports = [];
|
|
5
|
+
const moduleDeclarations = [];
|
|
6
|
+
const providerStart = [];
|
|
7
|
+
const providerEnd = [];
|
|
8
|
+
if ((runtimePlan?.providers.length ?? 0) > 0) {
|
|
9
|
+
expoRuntimeImports.push("ExpoRuntimeProviders");
|
|
10
|
+
providerStart.push(`<ExpoRuntimeProviders providers={['${(runtimePlan?.providers ?? []).join("', '")}']}>`);
|
|
11
|
+
providerEnd.push("</ExpoRuntimeProviders>");
|
|
12
|
+
}
|
|
13
|
+
if (expoRuntimeImports.length > 0) {
|
|
14
|
+
imports.push(`import { ${Array.from(new Set(expoRuntimeImports)).join(", ")} } from '@ankhorage/expo-runtime/providers';`);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
imports,
|
|
18
|
+
moduleDeclarations,
|
|
19
|
+
providerStart,
|
|
20
|
+
providerEnd
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/generatedAppOutput.ts
|
|
25
|
+
function resolveExpoRuntimeDependencyMap(runtimePlan) {
|
|
26
|
+
return Object.fromEntries((runtimePlan?.dependencies ?? []).map((dependency) => [dependency.name, dependency.version]));
|
|
27
|
+
}
|
|
28
|
+
function resolveExpoRuntimeConfigPluginOutput(runtimePlan) {
|
|
29
|
+
return (runtimePlan?.nativeConfig.plugins ?? []).map((plugin) => plugin.options === undefined ? plugin.name : [plugin.name, plugin.options]);
|
|
30
|
+
}
|
|
31
|
+
function resolveExpoRuntimeNativeOutput(runtimePlan) {
|
|
32
|
+
return {
|
|
33
|
+
androidPermissions: runtimePlan?.nativeConfig.androidPermissions ?? [],
|
|
34
|
+
configPlugins: resolveExpoRuntimeConfigPluginOutput(runtimePlan)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function resolveExpoRuntimeGeneratedAppOutput(runtimePlan) {
|
|
38
|
+
return {
|
|
39
|
+
dependencies: resolveExpoRuntimeDependencyMap(runtimePlan),
|
|
40
|
+
layoutIntegration: resolveExpoRuntimeLayoutIntegration(runtimePlan),
|
|
41
|
+
native: resolveExpoRuntimeNativeOutput(runtimePlan)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/platform.ts
|
|
46
|
+
function definePackage(name, version) {
|
|
47
|
+
return { name, version };
|
|
48
|
+
}
|
|
49
|
+
var EXPO_PLATFORM = {
|
|
50
|
+
sdk: 57,
|
|
51
|
+
architecture: "new-architecture-only",
|
|
52
|
+
runtime: {
|
|
53
|
+
expo: definePackage("expo", "57.0.34"),
|
|
54
|
+
react: definePackage("react", "19.2.3"),
|
|
55
|
+
reactDom: definePackage("react-dom", "19.2.3"),
|
|
56
|
+
reactNative: definePackage("react-native", "0.86.3"),
|
|
57
|
+
reactNativeWeb: definePackage("react-native-web", "~0.21.3")
|
|
58
|
+
},
|
|
59
|
+
tooling: {
|
|
60
|
+
node: {
|
|
61
|
+
lts: 24,
|
|
62
|
+
version: "24.x"
|
|
63
|
+
},
|
|
64
|
+
nodeTypes: definePackage("@types/node", "^24.13.3"),
|
|
65
|
+
reactTypes: definePackage("@types/react", "~19.2.4"),
|
|
66
|
+
typescript: definePackage("typescript", "~6.0.3"),
|
|
67
|
+
expoDoctor: definePackage("expo-doctor", "1.20.4")
|
|
68
|
+
},
|
|
69
|
+
navigation: {
|
|
70
|
+
expoRouter: definePackage("expo-router", "~57.0.32"),
|
|
71
|
+
screens: definePackage("react-native-screens", "~4.26.0"),
|
|
72
|
+
safeArea: definePackage("react-native-safe-area-context", "~5.7.0")
|
|
73
|
+
},
|
|
74
|
+
animation: {
|
|
75
|
+
reanimated: definePackage("react-native-reanimated", "4.5.1"),
|
|
76
|
+
worklets: definePackage("react-native-worklets", "0.10.1"),
|
|
77
|
+
gestureHandler: definePackage("react-native-gesture-handler", "~2.32.0")
|
|
78
|
+
},
|
|
79
|
+
ui: {
|
|
80
|
+
svg: definePackage("react-native-svg", "15.15.4"),
|
|
81
|
+
iconProviders: {
|
|
82
|
+
Ionicons: definePackage("@react-native-vector-icons/ionicons", "^13.1.4"),
|
|
83
|
+
FontAwesome: definePackage("@react-native-vector-icons/fontawesome", "^13.1.4"),
|
|
84
|
+
FontAwesome5: definePackage("@react-native-vector-icons/fontawesome5", "^13.1.4"),
|
|
85
|
+
FontAwesome6: definePackage("@react-native-vector-icons/fontawesome6", "^13.1.4"),
|
|
86
|
+
MaterialDesignIcons: definePackage("@react-native-vector-icons/material-design-icons", "^13.1.4")
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
packages: {
|
|
90
|
+
metroRuntime: definePackage("@expo/metro-runtime", "~57.0.19"),
|
|
91
|
+
asset: definePackage("expo-asset", "~57.0.22"),
|
|
92
|
+
audio: definePackage("expo-audio", "~57.0.5"),
|
|
93
|
+
authSession: definePackage("expo-auth-session", "~57.0.17"),
|
|
94
|
+
camera: definePackage("expo-camera", "~57.0.6"),
|
|
95
|
+
constants: definePackage("expo-constants", "~57.0.25"),
|
|
96
|
+
crypto: definePackage("expo-crypto", "~57.0.4"),
|
|
97
|
+
devClient: definePackage("expo-dev-client", "~57.0.22"),
|
|
98
|
+
documentPicker: definePackage("expo-document-picker", "~57.0.3"),
|
|
99
|
+
fileSystem: definePackage("expo-file-system", "~57.0.7"),
|
|
100
|
+
font: definePackage("expo-font", "~57.0.4"),
|
|
101
|
+
imagePicker: definePackage("expo-image-picker", "~57.0.22"),
|
|
102
|
+
linearGradient: definePackage("expo-linear-gradient", "~57.0.2"),
|
|
103
|
+
linking: definePackage("expo-linking", "~57.0.14"),
|
|
104
|
+
localization: definePackage("expo-localization", "~57.0.2"),
|
|
105
|
+
location: definePackage("expo-location", "~57.0.24"),
|
|
106
|
+
mediaLibrary: definePackage("expo-media-library", "~57.0.6"),
|
|
107
|
+
notifications: definePackage("expo-notifications", "~57.0.26"),
|
|
108
|
+
secureStore: definePackage("expo-secure-store", "~57.0.4"),
|
|
109
|
+
splashScreen: definePackage("expo-splash-screen", "~57.0.12"),
|
|
110
|
+
statusBar: definePackage("expo-status-bar", "~57.0.1"),
|
|
111
|
+
updates: definePackage("expo-updates", "~57.0.29"),
|
|
112
|
+
webBrowser: definePackage("expo-web-browser", "~57.0.3")
|
|
113
|
+
},
|
|
114
|
+
platforms: {
|
|
115
|
+
android: {
|
|
116
|
+
minimumVersion: 7,
|
|
117
|
+
minimumApiLevel: 24,
|
|
118
|
+
compileSdk: 36,
|
|
119
|
+
targetSdk: 36,
|
|
120
|
+
edgeToEdge: true
|
|
121
|
+
},
|
|
122
|
+
ios: {
|
|
123
|
+
minimumVersion: "16.4",
|
|
124
|
+
minimumXcodeVersion: "26.4"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// src/generatedAppScaffold.ts
|
|
130
|
+
function resolveExpoRuntimeGeneratedAppScaffold(manifest, runtimePlan) {
|
|
131
|
+
const output = resolveExpoRuntimeGeneratedAppOutput(runtimePlan);
|
|
132
|
+
return {
|
|
133
|
+
files: [
|
|
134
|
+
{
|
|
135
|
+
relativePath: "package.json",
|
|
136
|
+
source: createPackageSource(manifest, output.dependencies)
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
relativePath: "app.config.ts",
|
|
140
|
+
source: createExpoConfigSource(manifest, output.native)
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
relativePath: "src/generated/runtimeShell.tsx",
|
|
144
|
+
source: createRuntimeShellSource(runtimePlan?.providers ?? [])
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function createPackageSource(manifest, dependencies) {
|
|
150
|
+
return `${JSON.stringify({
|
|
151
|
+
name: manifest.metadata.slug,
|
|
152
|
+
version: manifest.metadata.version,
|
|
153
|
+
private: true,
|
|
154
|
+
type: "module",
|
|
155
|
+
main: "expo-router/entry",
|
|
156
|
+
dependencies: {
|
|
157
|
+
...dependencies,
|
|
158
|
+
"@ankhorage/expo-runtime": "^7.3.0",
|
|
159
|
+
"@expo/metro-runtime": EXPO_PLATFORM.packages.metroRuntime.version,
|
|
160
|
+
expo: EXPO_PLATFORM.runtime.expo.version,
|
|
161
|
+
"expo-router": EXPO_PLATFORM.navigation.expoRouter.version,
|
|
162
|
+
react: EXPO_PLATFORM.runtime.react.version,
|
|
163
|
+
"react-dom": EXPO_PLATFORM.runtime.reactDom.version,
|
|
164
|
+
"react-native": EXPO_PLATFORM.runtime.reactNative.version,
|
|
165
|
+
"react-native-safe-area-context": EXPO_PLATFORM.navigation.safeArea.version,
|
|
166
|
+
"react-native-screens": EXPO_PLATFORM.navigation.screens.version,
|
|
167
|
+
"react-native-web": EXPO_PLATFORM.runtime.reactNativeWeb.version
|
|
168
|
+
}
|
|
169
|
+
}, null, 2)}
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
function createExpoConfigSource(manifest, native) {
|
|
173
|
+
return `export default {
|
|
174
|
+
expo: {
|
|
175
|
+
name: ${JSON.stringify(manifest.metadata.name)},
|
|
176
|
+
slug: ${JSON.stringify(manifest.metadata.slug)},
|
|
177
|
+
scheme: ${JSON.stringify(manifest.metadata.slug)},
|
|
178
|
+
android: ${JSON.stringify({ permissions: native.androidPermissions }, null, 4)},
|
|
179
|
+
plugins: ${JSON.stringify(native.configPlugins, null, 4)},
|
|
180
|
+
},
|
|
181
|
+
} as const;
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
function createRuntimeShellSource(providers) {
|
|
185
|
+
return `import type { ReactNode } from 'react';
|
|
186
|
+
import { ExpoRuntimeProviders } from '@ankhorage/expo-runtime/providers';
|
|
187
|
+
|
|
188
|
+
export function GeneratedRuntimeShell({ children }: { readonly children: ReactNode }) {
|
|
189
|
+
return <ExpoRuntimeProviders providers={${JSON.stringify(providers)}}>{children}</ExpoRuntimeProviders>;
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
// src/generatedAppSources.ts
|
|
194
|
+
function resolveExpoRuntimeGeneratedAppSources(manifest, runtimePlan, options) {
|
|
195
|
+
const output = resolveExpoRuntimeGeneratedAppOutput(runtimePlan);
|
|
196
|
+
const diagnostics = collectDiagnostics(manifest, options);
|
|
197
|
+
const screenIds = collectNavigatorScreenIds(manifest.navigator);
|
|
198
|
+
const navigatorBindings = createNavigatorBindings(screenIds, options.screenModuleSpecifier);
|
|
199
|
+
return {
|
|
200
|
+
...output,
|
|
201
|
+
diagnostics,
|
|
202
|
+
files: diagnostics.length === 0 ? [
|
|
203
|
+
{
|
|
204
|
+
relativePath: "src/generated/runtimeManifestScreens.tsx",
|
|
205
|
+
source: createRuntimeManifestScreensSource(manifest, options.manifestModuleSpecifier)
|
|
206
|
+
}
|
|
207
|
+
] : [],
|
|
208
|
+
navigatorBindings: diagnostics.length === 0 ? navigatorBindings : { guards: {}, screens: {} }
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function collectNavigatorScreenIds(navigator) {
|
|
212
|
+
return Array.from(collectNavigatorScreenIdSet(navigator)).sort();
|
|
213
|
+
}
|
|
214
|
+
function collectNavigatorScreenIdSet(navigator) {
|
|
215
|
+
const screenIds = new Set;
|
|
216
|
+
for (const route of navigator.routes) {
|
|
217
|
+
if (route.screenId !== undefined)
|
|
218
|
+
screenIds.add(route.screenId);
|
|
219
|
+
if (route.navigator !== undefined) {
|
|
220
|
+
for (const screenId of collectNavigatorScreenIdSet(route.navigator))
|
|
221
|
+
screenIds.add(screenId);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (navigator.type === "split-view") {
|
|
225
|
+
screenIds.add(navigator.columns.primary.screenId);
|
|
226
|
+
if (navigator.columns.supplementary !== undefined) {
|
|
227
|
+
screenIds.add(navigator.columns.supplementary.screenId);
|
|
228
|
+
}
|
|
229
|
+
if (navigator.inspector !== undefined)
|
|
230
|
+
screenIds.add(navigator.inspector.screenId);
|
|
231
|
+
}
|
|
232
|
+
if (navigator.type === "tabs" && navigator.implementation === "native") {
|
|
233
|
+
if (navigator.bottomAccessory !== undefined)
|
|
234
|
+
screenIds.add(navigator.bottomAccessory.screenId);
|
|
235
|
+
}
|
|
236
|
+
return screenIds;
|
|
237
|
+
}
|
|
238
|
+
function collectDiagnostics(manifest, options) {
|
|
239
|
+
const invalidSpecifierDiagnostics = [
|
|
240
|
+
["manifestModuleSpecifier", options.manifestModuleSpecifier],
|
|
241
|
+
["screenModuleSpecifier", options.screenModuleSpecifier]
|
|
242
|
+
].flatMap(([name, value]) => isStaticModuleSpecifier(value) ? [] : [
|
|
243
|
+
{
|
|
244
|
+
code: "invalid-manifest-module-specifier",
|
|
245
|
+
severity: "error",
|
|
246
|
+
message: `${name} must be a non-empty static module specifier.`
|
|
247
|
+
}
|
|
248
|
+
]);
|
|
249
|
+
const missingScreenDiagnostics = collectNavigatorScreenIds(manifest.navigator).filter((screenId) => !Object.hasOwn(manifest.screens, screenId)).map((screenId) => ({
|
|
250
|
+
code: "missing-manifest-screen",
|
|
251
|
+
severity: "error",
|
|
252
|
+
screenId,
|
|
253
|
+
message: `Navigator references manifest screen '${screenId}', but no matching manifest screen exists.`
|
|
254
|
+
}));
|
|
255
|
+
return [...invalidSpecifierDiagnostics, ...missingScreenDiagnostics].sort((left, right) => `${left.code}\x00${left.screenId ?? ""}\x00${left.message}`.localeCompare(`${right.code}\x00${right.screenId ?? ""}\x00${right.message}`));
|
|
256
|
+
}
|
|
257
|
+
function isStaticModuleSpecifier(value) {
|
|
258
|
+
return value.trim().length > 0 && Array.from(value).every((character) => character.charCodeAt(0) >= 32 && !["'", '"', "`", "\\"].includes(character));
|
|
259
|
+
}
|
|
260
|
+
function createNavigatorBindings(screenIds, screenModuleSpecifier) {
|
|
261
|
+
return {
|
|
262
|
+
guards: {},
|
|
263
|
+
screens: Object.fromEntries(screenIds.map((screenId, index) => [
|
|
264
|
+
screenId,
|
|
265
|
+
{
|
|
266
|
+
module: screenModuleSpecifier,
|
|
267
|
+
exportName: getManifestScreenExportName(index)
|
|
268
|
+
}
|
|
269
|
+
]))
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function getManifestScreenExportName(index) {
|
|
273
|
+
return `ManifestScreen${index}`;
|
|
274
|
+
}
|
|
275
|
+
function createRuntimeManifestScreensSource(manifest, manifestModuleSpecifier) {
|
|
276
|
+
const screenIds = collectNavigatorScreenIds(manifest.navigator);
|
|
277
|
+
const exports = screenIds.map((screenId, index) => `export const ${getManifestScreenExportName(index)} = createManifestScreen(${JSON.stringify(screenId)});`).join(`
|
|
278
|
+
`);
|
|
279
|
+
return `import type { AppManifest } from '@ankhorage/contracts';
|
|
280
|
+
import { RuntimeScreen } from '@ankhorage/runtime';
|
|
281
|
+
import { createZoraComponentRegistry } from '@ankhorage/zora';
|
|
282
|
+
import runtimeManifest from ${JSON.stringify(manifestModuleSpecifier)};
|
|
283
|
+
|
|
284
|
+
const manifest = runtimeManifest as AppManifest;
|
|
285
|
+
const registry = createZoraComponentRegistry();
|
|
286
|
+
|
|
287
|
+
function createManifestScreen(screenId: string) {
|
|
288
|
+
const screen = manifest.screens[screenId];
|
|
289
|
+
if (screen === undefined) {
|
|
290
|
+
throw new Error(\`Generated Runtime screen binding is missing manifest screen '\${screenId}'.\`);
|
|
291
|
+
}
|
|
292
|
+
return function ManifestScreen() {
|
|
293
|
+
return <RuntimeScreen manifest={manifest} registry={registry} screen={screen} />;
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
${exports}
|
|
298
|
+
`;
|
|
299
|
+
}
|
|
300
|
+
export {
|
|
301
|
+
resolveExpoRuntimeGeneratedAppScaffold,
|
|
302
|
+
resolveExpoRuntimeGeneratedAppSources
|
|
303
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatedApp.js","sourceRoot":"","sources":["../src/generatedApp.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAGL,sCAAsC,GACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAIL,qCAAqC,GAEtC,MAAM,uBAAuB,CAAC","sourcesContent":["/*** Expose the complete public generated-app planning surface from one Node ESM-safe entrypoint. */\nexport {\n type ExpoRuntimeGeneratedAppScaffold,\n type ExpoRuntimeGeneratedAppScaffoldFile,\n resolveExpoRuntimeGeneratedAppScaffold,\n} from './generatedAppScaffold';\nexport {\n type ExpoRuntimeGeneratedAppSourceDiagnostic,\n type ExpoRuntimeGeneratedAppSourceFile,\n type ExpoRuntimeGeneratedAppSources,\n resolveExpoRuntimeGeneratedAppSources,\n type ResolveExpoRuntimeGeneratedAppSourcesOptions,\n} from './generatedAppSources';\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AppManifest } from '@ankhorage/contracts';
|
|
1
2
|
import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';
|
|
2
3
|
export interface ExpoRuntimeGeneratedAppScaffoldFile {
|
|
3
4
|
readonly relativePath: 'package.json' | 'app.config.ts' | 'src/generated/runtimeShell.tsx';
|
|
@@ -7,5 +8,5 @@ export interface ExpoRuntimeGeneratedAppScaffold {
|
|
|
7
8
|
readonly files: readonly ExpoRuntimeGeneratedAppScaffoldFile[];
|
|
8
9
|
}
|
|
9
10
|
/*** Emit the Runtime-owned files needed to finish a generated Expo application without writing to disk. */
|
|
10
|
-
export declare function resolveExpoRuntimeGeneratedAppScaffold(runtimePlan: ExpoRuntimePlan | undefined): ExpoRuntimeGeneratedAppScaffold;
|
|
11
|
+
export declare function resolveExpoRuntimeGeneratedAppScaffold(manifest: Pick<AppManifest, 'metadata'>, runtimePlan: ExpoRuntimePlan | undefined): ExpoRuntimeGeneratedAppScaffold;
|
|
11
12
|
//# sourceMappingURL=generatedAppScaffold.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatedAppScaffold.d.ts","sourceRoot":"","sources":["../src/generatedAppScaffold.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generatedAppScaffold.d.ts","sourceRoot":"","sources":["../src/generatedAppScaffold.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,YAAY,EAAE,cAAc,GAAG,eAAe,GAAG,gCAAgC,CAAC;IAC3F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,KAAK,EAAE,SAAS,mCAAmC,EAAE,CAAC;CAChE;AAED,2GAA2G;AAC3G,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,EACvC,WAAW,EAAE,eAAe,GAAG,SAAS,GACvC,+BAA+B,CAmBjC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { resolveExpoRuntimeGeneratedAppOutput } from './generatedAppOutput';
|
|
2
|
+
import { EXPO_PLATFORM } from './platform';
|
|
2
3
|
/*** Emit the Runtime-owned files needed to finish a generated Expo application without writing to disk. */
|
|
3
|
-
export function resolveExpoRuntimeGeneratedAppScaffold(runtimePlan) {
|
|
4
|
+
export function resolveExpoRuntimeGeneratedAppScaffold(manifest, runtimePlan) {
|
|
4
5
|
const output = resolveExpoRuntimeGeneratedAppOutput(runtimePlan);
|
|
5
6
|
return {
|
|
6
7
|
files: [
|
|
7
8
|
{
|
|
8
9
|
relativePath: 'package.json',
|
|
9
|
-
source:
|
|
10
|
+
source: createPackageSource(manifest, output.dependencies),
|
|
10
11
|
},
|
|
11
12
|
{
|
|
12
13
|
relativePath: 'app.config.ts',
|
|
13
|
-
source: createExpoConfigSource(output.native),
|
|
14
|
+
source: createExpoConfigSource(manifest, output.native),
|
|
14
15
|
},
|
|
15
16
|
{
|
|
16
17
|
relativePath: 'src/generated/runtimeShell.tsx',
|
|
@@ -19,10 +20,36 @@ export function resolveExpoRuntimeGeneratedAppScaffold(runtimePlan) {
|
|
|
19
20
|
],
|
|
20
21
|
};
|
|
21
22
|
}
|
|
23
|
+
/*** Render the independently installable Expo Router package boundary for one generated application. */
|
|
24
|
+
function createPackageSource(manifest, dependencies) {
|
|
25
|
+
return `${JSON.stringify({
|
|
26
|
+
name: manifest.metadata.slug,
|
|
27
|
+
version: manifest.metadata.version,
|
|
28
|
+
private: true,
|
|
29
|
+
type: 'module',
|
|
30
|
+
main: 'expo-router/entry',
|
|
31
|
+
dependencies: {
|
|
32
|
+
...dependencies,
|
|
33
|
+
'@ankhorage/expo-runtime': '^7.3.0',
|
|
34
|
+
'@expo/metro-runtime': EXPO_PLATFORM.packages.metroRuntime.version,
|
|
35
|
+
expo: EXPO_PLATFORM.runtime.expo.version,
|
|
36
|
+
'expo-router': EXPO_PLATFORM.navigation.expoRouter.version,
|
|
37
|
+
react: EXPO_PLATFORM.runtime.react.version,
|
|
38
|
+
'react-dom': EXPO_PLATFORM.runtime.reactDom.version,
|
|
39
|
+
'react-native': EXPO_PLATFORM.runtime.reactNative.version,
|
|
40
|
+
'react-native-safe-area-context': EXPO_PLATFORM.navigation.safeArea.version,
|
|
41
|
+
'react-native-screens': EXPO_PLATFORM.navigation.screens.version,
|
|
42
|
+
'react-native-web': EXPO_PLATFORM.runtime.reactNativeWeb.version,
|
|
43
|
+
},
|
|
44
|
+
}, null, 2)}\n`;
|
|
45
|
+
}
|
|
22
46
|
/*** Render the native Expo configuration fragment from Runtime's resolved plugin and permission plan. */
|
|
23
|
-
function createExpoConfigSource(native) {
|
|
47
|
+
function createExpoConfigSource(manifest, native) {
|
|
24
48
|
return `export default {
|
|
25
49
|
expo: {
|
|
50
|
+
name: ${JSON.stringify(manifest.metadata.name)},
|
|
51
|
+
slug: ${JSON.stringify(manifest.metadata.slug)},
|
|
52
|
+
scheme: ${JSON.stringify(manifest.metadata.slug)},
|
|
26
53
|
android: ${JSON.stringify({ permissions: native.androidPermissions }, null, 4)},
|
|
27
54
|
plugins: ${JSON.stringify(native.configPlugins, null, 4)},
|
|
28
55
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatedAppScaffold.js","sourceRoot":"","sources":["../src/generatedAppScaffold.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generatedAppScaffold.js","sourceRoot":"","sources":["../src/generatedAppScaffold.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAY3C,2GAA2G;AAC3G,MAAM,UAAU,sCAAsC,CACpD,QAAuC,EACvC,WAAwC;IAExC,MAAM,MAAM,GAAG,oCAAoC,CAAC,WAAW,CAAC,CAAC;IAEjE,OAAO;QACL,KAAK,EAAE;YACL;gBACE,YAAY,EAAE,cAAc;gBAC5B,MAAM,EAAE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC;aAC3D;YACD;gBACE,YAAY,EAAE,eAAe;gBAC7B,MAAM,EAAE,sBAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;aACxD;YACD;gBACE,YAAY,EAAE,gCAAgC;gBAC9C,MAAM,EAAE,wBAAwB,CAAC,WAAW,EAAE,SAAS,IAAI,EAAE,CAAC;aAC/D;SACF;KACF,CAAC;AACJ,CAAC;AAED,wGAAwG;AACxG,SAAS,mBAAmB,CAC1B,QAAuC,EACvC,YAA8C;IAE9C,OAAO,GAAG,IAAI,CAAC,SAAS,CACtB;QACE,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;QAC5B,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO;QAClC,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,mBAAmB;QACzB,YAAY,EAAE;YACZ,GAAG,YAAY;YACf,yBAAyB,EAAE,QAAQ;YACnC,qBAAqB,EAAE,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO;YAClE,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO;YACxC,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO;YAC1D,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO;YAC1C,WAAW,EAAE,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO;YACnD,cAAc,EAAE,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO;YACzD,gCAAgC,EAAE,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO;YAC3E,sBAAsB,EAAE,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO;YAChE,kBAAkB,EAAE,aAAa,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO;SACjE;KACF,EACD,IAAI,EACJ,CAAC,CACF,IAAI,CAAC;AACR,CAAC;AAED,yGAAyG;AACzG,SAAS,sBAAsB,CAC7B,QAAuC,EACvC,MAAyE;IAEzE,OAAO;;YAEG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;YACtC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;cACpC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;eACrC,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;eACnE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;;cAE9C,CAAC;AACf,CAAC;AAED,wGAAwG;AACxG,SAAS,wBAAwB,CAAC,SAA4B;IAC5D,OAAO;;;;4CAImC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;;CAEpE,CAAC;AACF,CAAC","sourcesContent":["import type { AppManifest } from '@ankhorage/contracts';\n\nimport { resolveExpoRuntimeGeneratedAppOutput } from './generatedAppOutput';\nimport { EXPO_PLATFORM } from './platform';\nimport type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';\n\nexport interface ExpoRuntimeGeneratedAppScaffoldFile {\n readonly relativePath: 'package.json' | 'app.config.ts' | 'src/generated/runtimeShell.tsx';\n readonly source: string;\n}\n\nexport interface ExpoRuntimeGeneratedAppScaffold {\n readonly files: readonly ExpoRuntimeGeneratedAppScaffoldFile[];\n}\n\n/*** Emit the Runtime-owned files needed to finish a generated Expo application without writing to disk. */\nexport function resolveExpoRuntimeGeneratedAppScaffold(\n manifest: Pick<AppManifest, 'metadata'>,\n runtimePlan: ExpoRuntimePlan | undefined,\n): ExpoRuntimeGeneratedAppScaffold {\n const output = resolveExpoRuntimeGeneratedAppOutput(runtimePlan);\n\n return {\n files: [\n {\n relativePath: 'package.json',\n source: createPackageSource(manifest, output.dependencies),\n },\n {\n relativePath: 'app.config.ts',\n source: createExpoConfigSource(manifest, output.native),\n },\n {\n relativePath: 'src/generated/runtimeShell.tsx',\n source: createRuntimeShellSource(runtimePlan?.providers ?? []),\n },\n ],\n };\n}\n\n/*** Render the independently installable Expo Router package boundary for one generated application. */\nfunction createPackageSource(\n manifest: Pick<AppManifest, 'metadata'>,\n dependencies: Readonly<Record<string, string>>,\n): string {\n return `${JSON.stringify(\n {\n name: manifest.metadata.slug,\n version: manifest.metadata.version,\n private: true,\n type: 'module',\n main: 'expo-router/entry',\n dependencies: {\n ...dependencies,\n '@ankhorage/expo-runtime': '^7.3.0',\n '@expo/metro-runtime': EXPO_PLATFORM.packages.metroRuntime.version,\n expo: EXPO_PLATFORM.runtime.expo.version,\n 'expo-router': EXPO_PLATFORM.navigation.expoRouter.version,\n react: EXPO_PLATFORM.runtime.react.version,\n 'react-dom': EXPO_PLATFORM.runtime.reactDom.version,\n 'react-native': EXPO_PLATFORM.runtime.reactNative.version,\n 'react-native-safe-area-context': EXPO_PLATFORM.navigation.safeArea.version,\n 'react-native-screens': EXPO_PLATFORM.navigation.screens.version,\n 'react-native-web': EXPO_PLATFORM.runtime.reactNativeWeb.version,\n },\n },\n null,\n 2,\n )}\\n`;\n}\n\n/*** Render the native Expo configuration fragment from Runtime's resolved plugin and permission plan. */\nfunction createExpoConfigSource(\n manifest: Pick<AppManifest, 'metadata'>,\n native: ReturnType<typeof resolveExpoRuntimeGeneratedAppOutput>['native'],\n): string {\n return `export default {\n expo: {\n name: ${JSON.stringify(manifest.metadata.name)},\n slug: ${JSON.stringify(manifest.metadata.slug)},\n scheme: ${JSON.stringify(manifest.metadata.slug)},\n android: ${JSON.stringify({ permissions: native.androidPermissions }, null, 4)},\n plugins: ${JSON.stringify(native.configPlugins, null, 4)},\n },\n} as const;\\n`;\n}\n\n/*** Render the canonical Runtime provider shell while leaving application composition to the caller. */\nfunction createRuntimeShellSource(providers: readonly string[]): string {\n return `import type { ReactNode } from 'react';\nimport { ExpoRuntimeProviders } from '@ankhorage/expo-runtime/providers';\n\nexport function GeneratedRuntimeShell({ children }: { readonly children: ReactNode }) {\n return <ExpoRuntimeProviders providers={${JSON.stringify(providers)}}>{children}</ExpoRuntimeProviders>;\n}\n`;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/expo-runtime",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.4.
|
|
4
|
+
"version": "7.4.2",
|
|
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": {
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
"default": "./dist/routeDelivery.js"
|
|
76
76
|
},
|
|
77
77
|
"./generated-app": {
|
|
78
|
-
"react-native": "./src/
|
|
79
|
-
"browser": "./src/
|
|
80
|
-
"types": "./src/
|
|
81
|
-
"import": "./dist/
|
|
82
|
-
"default": "./dist/
|
|
78
|
+
"react-native": "./src/generatedApp.ts",
|
|
79
|
+
"browser": "./src/generatedApp.ts",
|
|
80
|
+
"types": "./src/generatedApp.ts",
|
|
81
|
+
"import": "./dist/generatedApp.js",
|
|
82
|
+
"default": "./dist/generatedApp.js"
|
|
83
83
|
},
|
|
84
84
|
"./platform": {
|
|
85
85
|
"react-native": "./src/platform.ts",
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
]
|
|
178
178
|
},
|
|
179
179
|
"scripts": {
|
|
180
|
-
"build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.json",
|
|
180
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.json && bun build src/generatedApp.ts --outdir dist --target node --format esm --external '@ankhorage/*' --silent >&2",
|
|
181
181
|
"changeset": "ankhorage-changeset",
|
|
182
182
|
"changeset:status": "ankhorage-changeset status --since=origin/main",
|
|
183
183
|
"docs": "paradox",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
resolveExpoRuntimeGeneratedAppScaffold,
|
|
5
|
+
resolveExpoRuntimeGeneratedAppSources,
|
|
6
|
+
} from './generatedApp';
|
|
7
|
+
|
|
8
|
+
test('keeps the generated-app subpath facade focused on both published generated-app APIs', () => {
|
|
9
|
+
expect(resolveExpoRuntimeGeneratedAppScaffold).toBeFunction();
|
|
10
|
+
expect(resolveExpoRuntimeGeneratedAppSources).toBeFunction();
|
|
11
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*** Expose the complete public generated-app planning surface from one Node ESM-safe entrypoint. */
|
|
2
|
+
export {
|
|
3
|
+
type ExpoRuntimeGeneratedAppScaffold,
|
|
4
|
+
type ExpoRuntimeGeneratedAppScaffoldFile,
|
|
5
|
+
resolveExpoRuntimeGeneratedAppScaffold,
|
|
6
|
+
} from './generatedAppScaffold';
|
|
7
|
+
export {
|
|
8
|
+
type ExpoRuntimeGeneratedAppSourceDiagnostic,
|
|
9
|
+
type ExpoRuntimeGeneratedAppSourceFile,
|
|
10
|
+
type ExpoRuntimeGeneratedAppSources,
|
|
11
|
+
resolveExpoRuntimeGeneratedAppSources,
|
|
12
|
+
type ResolveExpoRuntimeGeneratedAppSourcesOptions,
|
|
13
|
+
} from './generatedAppSources';
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { expect, test } from 'bun:test';
|
|
2
2
|
|
|
3
3
|
import { resolveExpoRuntimeGeneratedAppScaffold } from './generatedAppScaffold';
|
|
4
|
+
import { EXPO_PLATFORM } from './platform';
|
|
4
5
|
import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';
|
|
5
6
|
|
|
7
|
+
const MANIFEST = {
|
|
8
|
+
metadata: {
|
|
9
|
+
category: 'utilities_tools',
|
|
10
|
+
name: 'Generated App',
|
|
11
|
+
slug: 'generated-app',
|
|
12
|
+
themeId: 'default',
|
|
13
|
+
version: '1.2.3',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
6
17
|
const PLAN: ExpoRuntimePlan = {
|
|
7
18
|
capabilities: [],
|
|
8
19
|
dependencies: [{ name: 'expo-camera', version: '~57.0.6', reasons: [] }],
|
|
@@ -21,17 +32,25 @@ const PLAN: ExpoRuntimePlan = {
|
|
|
21
32
|
};
|
|
22
33
|
|
|
23
34
|
test('emits deterministic portable package, Expo config, and Runtime shell sources', () => {
|
|
24
|
-
const result = resolveExpoRuntimeGeneratedAppScaffold(PLAN);
|
|
35
|
+
const result = resolveExpoRuntimeGeneratedAppScaffold(MANIFEST, PLAN);
|
|
25
36
|
|
|
26
|
-
expect(result).toEqual(resolveExpoRuntimeGeneratedAppScaffold(PLAN));
|
|
37
|
+
expect(result).toEqual(resolveExpoRuntimeGeneratedAppScaffold(MANIFEST, PLAN));
|
|
27
38
|
expect(result.files).toEqual([
|
|
28
|
-
{
|
|
29
|
-
relativePath: 'package.json',
|
|
30
|
-
source: '{\n "dependencies": {\n "expo-camera": "~57.0.6"\n }\n}\n',
|
|
31
|
-
},
|
|
39
|
+
expect.objectContaining({ relativePath: 'package.json' }),
|
|
32
40
|
expect.objectContaining({ relativePath: 'app.config.ts' }),
|
|
33
41
|
expect.objectContaining({ relativePath: 'src/generated/runtimeShell.tsx' }),
|
|
34
42
|
]);
|
|
43
|
+
expect(result.files[0]?.source).toContain('"main": "expo-router/entry"');
|
|
44
|
+
expect(result.files[0]?.source).toContain(`"expo": "${EXPO_PLATFORM.runtime.expo.version}"`);
|
|
45
|
+
expect(result.files[0]?.source).toContain(
|
|
46
|
+
`"expo-router": "${EXPO_PLATFORM.navigation.expoRouter.version}"`,
|
|
47
|
+
);
|
|
48
|
+
expect(result.files[0]?.source).toContain(
|
|
49
|
+
`"react-native": "${EXPO_PLATFORM.runtime.reactNative.version}"`,
|
|
50
|
+
);
|
|
51
|
+
expect(result.files[0]?.source).toContain('"@ankhorage/expo-runtime": "^7.3.0"');
|
|
35
52
|
expect(result.files[1]?.source).toContain('"expo-camera"');
|
|
53
|
+
expect(result.files[1]?.source).toContain('name: "Generated App"');
|
|
54
|
+
expect(result.files[1]?.source).toContain('slug: "generated-app"');
|
|
36
55
|
expect(result.files[2]?.source).toContain('providers={["permissions"]}');
|
|
37
56
|
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { AppManifest } from '@ankhorage/contracts';
|
|
2
|
+
|
|
1
3
|
import { resolveExpoRuntimeGeneratedAppOutput } from './generatedAppOutput';
|
|
4
|
+
import { EXPO_PLATFORM } from './platform';
|
|
2
5
|
import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';
|
|
3
6
|
|
|
4
7
|
export interface ExpoRuntimeGeneratedAppScaffoldFile {
|
|
@@ -12,6 +15,7 @@ export interface ExpoRuntimeGeneratedAppScaffold {
|
|
|
12
15
|
|
|
13
16
|
/*** Emit the Runtime-owned files needed to finish a generated Expo application without writing to disk. */
|
|
14
17
|
export function resolveExpoRuntimeGeneratedAppScaffold(
|
|
18
|
+
manifest: Pick<AppManifest, 'metadata'>,
|
|
15
19
|
runtimePlan: ExpoRuntimePlan | undefined,
|
|
16
20
|
): ExpoRuntimeGeneratedAppScaffold {
|
|
17
21
|
const output = resolveExpoRuntimeGeneratedAppOutput(runtimePlan);
|
|
@@ -20,11 +24,11 @@ export function resolveExpoRuntimeGeneratedAppScaffold(
|
|
|
20
24
|
files: [
|
|
21
25
|
{
|
|
22
26
|
relativePath: 'package.json',
|
|
23
|
-
source:
|
|
27
|
+
source: createPackageSource(manifest, output.dependencies),
|
|
24
28
|
},
|
|
25
29
|
{
|
|
26
30
|
relativePath: 'app.config.ts',
|
|
27
|
-
source: createExpoConfigSource(output.native),
|
|
31
|
+
source: createExpoConfigSource(manifest, output.native),
|
|
28
32
|
},
|
|
29
33
|
{
|
|
30
34
|
relativePath: 'src/generated/runtimeShell.tsx',
|
|
@@ -34,12 +38,47 @@ export function resolveExpoRuntimeGeneratedAppScaffold(
|
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
40
|
|
|
41
|
+
/*** Render the independently installable Expo Router package boundary for one generated application. */
|
|
42
|
+
function createPackageSource(
|
|
43
|
+
manifest: Pick<AppManifest, 'metadata'>,
|
|
44
|
+
dependencies: Readonly<Record<string, string>>,
|
|
45
|
+
): string {
|
|
46
|
+
return `${JSON.stringify(
|
|
47
|
+
{
|
|
48
|
+
name: manifest.metadata.slug,
|
|
49
|
+
version: manifest.metadata.version,
|
|
50
|
+
private: true,
|
|
51
|
+
type: 'module',
|
|
52
|
+
main: 'expo-router/entry',
|
|
53
|
+
dependencies: {
|
|
54
|
+
...dependencies,
|
|
55
|
+
'@ankhorage/expo-runtime': '^7.3.0',
|
|
56
|
+
'@expo/metro-runtime': EXPO_PLATFORM.packages.metroRuntime.version,
|
|
57
|
+
expo: EXPO_PLATFORM.runtime.expo.version,
|
|
58
|
+
'expo-router': EXPO_PLATFORM.navigation.expoRouter.version,
|
|
59
|
+
react: EXPO_PLATFORM.runtime.react.version,
|
|
60
|
+
'react-dom': EXPO_PLATFORM.runtime.reactDom.version,
|
|
61
|
+
'react-native': EXPO_PLATFORM.runtime.reactNative.version,
|
|
62
|
+
'react-native-safe-area-context': EXPO_PLATFORM.navigation.safeArea.version,
|
|
63
|
+
'react-native-screens': EXPO_PLATFORM.navigation.screens.version,
|
|
64
|
+
'react-native-web': EXPO_PLATFORM.runtime.reactNativeWeb.version,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
null,
|
|
68
|
+
2,
|
|
69
|
+
)}\n`;
|
|
70
|
+
}
|
|
71
|
+
|
|
37
72
|
/*** Render the native Expo configuration fragment from Runtime's resolved plugin and permission plan. */
|
|
38
73
|
function createExpoConfigSource(
|
|
74
|
+
manifest: Pick<AppManifest, 'metadata'>,
|
|
39
75
|
native: ReturnType<typeof resolveExpoRuntimeGeneratedAppOutput>['native'],
|
|
40
76
|
): string {
|
|
41
77
|
return `export default {
|
|
42
78
|
expo: {
|
|
79
|
+
name: ${JSON.stringify(manifest.metadata.name)},
|
|
80
|
+
slug: ${JSON.stringify(manifest.metadata.slug)},
|
|
81
|
+
scheme: ${JSON.stringify(manifest.metadata.slug)},
|
|
43
82
|
android: ${JSON.stringify({ permissions: native.androidPermissions }, null, 4)},
|
|
44
83
|
plugins: ${JSON.stringify(native.configPlugins, null, 4)},
|
|
45
84
|
},
|