@ankhorage/expo-runtime 7.1.0 → 7.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ankhorage/expo-runtime
2
2
 
3
+ ## 7.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3caab93: Expose deterministic generated Runtime manifest-screen sources and Navigator bindings for standalone Expo app materializers.
8
+
9
+ ## 7.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 3a2aec5: Expose deterministic Expo Router files for published Authoring screen routes with explicit host composition ports.
14
+
3
15
  ## 7.1.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # EXPO-RUNTIME
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v7.1.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v7.3.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: configured](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Declarative runtime integration for Expo apps: maps app capabilities to permissions, packages, config plugins, providers, and adapters
9
9
 
@@ -0,0 +1,5 @@
1
+ import type { AuthoringRouteDeliveryDefinition } from '@ankhorage/studio-authoring';
2
+ import type { ExpoAuthoringRouteFile, ExpoAuthoringRouteHostPorts } from '../../types/expoAuthoringRouteDelivery';
3
+ /*** Translate available portable Authoring screens into deterministic, host-composed Expo Router files. */
4
+ export declare function getExpoAuthoringRouteFiles(routes: readonly AuthoringRouteDeliveryDefinition[], hostPorts: ExpoAuthoringRouteHostPorts): readonly ExpoAuthoringRouteFile[];
5
+ //# sourceMappingURL=getExpoAuthoringRouteFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getExpoAuthoringRouteFiles.d.ts","sourceRoot":"","sources":["../../../src/features/navigation/getExpoAuthoringRouteFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAEjC,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EACV,sBAAsB,EAEtB,2BAA2B,EAC5B,MAAM,wCAAwC,CAAC;AAEhD,2GAA2G;AAC3G,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,gCAAgC,EAAE,EACnD,SAAS,EAAE,2BAA2B,GACrC,SAAS,sBAAsB,EAAE,CAInC"}
@@ -0,0 +1,90 @@
1
+ /*** Translate available portable Authoring screens into deterministic, host-composed Expo Router files. */
2
+ export function getExpoAuthoringRouteFiles(routes, hostPorts) {
3
+ return routes
4
+ .filter(isAvailableAuthoringRoute)
5
+ .map((route) => createExpoAuthoringRouteFile(route, requireHostPort(route, hostPorts)));
6
+ }
7
+ /*** Limit delivery to routes whose owner has published a concrete screen module. */
8
+ function isAvailableAuthoringRoute(route) {
9
+ return route.screen.status === 'available';
10
+ }
11
+ /*** Refuse to synthesize a route when its host has not explicitly accepted its composition boundary. */
12
+ function requireHostPort(route, hostPorts) {
13
+ const hostPort = hostPorts[route.id];
14
+ if (!hostPort) {
15
+ throw new Error(`Authoring route '${route.id}' requires an explicit host composition port.`);
16
+ }
17
+ return hostPort;
18
+ }
19
+ /*** Render one Expo Router file from one published portable screen and one declared host props factory. */
20
+ function createExpoAuthoringRouteFile(route, hostPort) {
21
+ const relativePath = getExpoRouterRelativePath(route);
22
+ assertSafeSourceIdentifiers(route, hostPort);
23
+ const componentName = getRouteComponentName(relativePath);
24
+ return {
25
+ relativePath,
26
+ route,
27
+ source: [
28
+ `import { ${route.screen.exportName} } from ${JSON.stringify(route.screen.moduleSpecifier)};`,
29
+ `import { ${hostPort.getPropsExportName} } from ${JSON.stringify(hostPort.moduleSpecifier)};`,
30
+ '',
31
+ `export default function ${componentName}() {`,
32
+ ` return <${route.screen.exportName} {...${hostPort.getPropsExportName}()} />;`,
33
+ '}',
34
+ '',
35
+ ].join('\n'),
36
+ };
37
+ }
38
+ /*** Refuse values that would turn a published route or host port into arbitrary generated source. */
39
+ function assertSafeSourceIdentifiers(route, hostPort) {
40
+ if (!isSafeJavaScriptIdentifier(route.screen.exportName) ||
41
+ !isSafeJavaScriptIdentifier(hostPort.getPropsExportName)) {
42
+ throw new Error(`Authoring route '${route.id}' has an unsafe screen or host export name.`);
43
+ }
44
+ }
45
+ /*** Convert a published pathname template to a confined Expo Router-relative TSX path. */
46
+ function getExpoRouterRelativePath(route) {
47
+ const segments = route.pathPattern.split('/').slice(1);
48
+ const parameters = new Set(route.parameters.map(({ name }) => name));
49
+ const relativeSegments = segments.map((segment) => getExpoRouterSegment(segment, parameters));
50
+ if (relativeSegments.length === 0 || parameters.size !== 0) {
51
+ throw new Error(`Authoring route '${route.id}' has an invalid path parameter declaration.`);
52
+ }
53
+ return `${relativeSegments.join('/')}.tsx`;
54
+ }
55
+ /*** Validate one path segment before translating a declared parameter to Expo Router syntax. */
56
+ function getExpoRouterSegment(segment, parameters) {
57
+ const parameterName = segment.startsWith(':') ? segment.slice(1) : undefined;
58
+ if (parameterName) {
59
+ if (!parameters.delete(parameterName) || !isSafeRouteParameterName(parameterName)) {
60
+ throw new Error(`Authoring route contains an invalid path parameter '${segment}'.`);
61
+ }
62
+ return `[${parameterName}]`;
63
+ }
64
+ if (!isSafeRouteIdentifier(segment)) {
65
+ throw new Error(`Authoring route contains an unsafe path segment '${segment}'.`);
66
+ }
67
+ return segment;
68
+ }
69
+ /*** Accept only non-empty route identifiers that cannot escape the generated app directory. */
70
+ function isSafeRouteIdentifier(value) {
71
+ return /^[a-z][a-z0-9-]*$/u.test(value);
72
+ }
73
+ /*** Accept the published camel-case parameter names while retaining single-segment route safety. */
74
+ function isSafeRouteParameterName(value) {
75
+ return /^[a-z][A-Za-z0-9]*$/u.test(value);
76
+ }
77
+ /*** Accept a JavaScript identifier only when it can be inserted into generated import and JSX syntax. */
78
+ function isSafeJavaScriptIdentifier(value) {
79
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(value);
80
+ }
81
+ /*** Derive a stable default-export component name from the generated route filename. */
82
+ function getRouteComponentName(relativePath) {
83
+ return `${relativePath
84
+ .replace(/\.tsx$/u, '')
85
+ .split('/')
86
+ .map((segment) => segment.replace(/\[|\]|-/gu, ''))
87
+ .map((segment) => `${segment.slice(0, 1).toUpperCase()}${segment.slice(1)}`)
88
+ .join('')}Route`;
89
+ }
90
+ //# sourceMappingURL=getExpoAuthoringRouteFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getExpoAuthoringRouteFiles.js","sourceRoot":"","sources":["../../../src/features/navigation/getExpoAuthoringRouteFiles.ts"],"names":[],"mappings":"AAWA,2GAA2G;AAC3G,MAAM,UAAU,0BAA0B,CACxC,MAAmD,EACnD,SAAsC;IAEtC,OAAO,MAAM;SACV,MAAM,CAAC,yBAAyB,CAAC;SACjC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,4BAA4B,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC;AAED,oFAAoF;AACpF,SAAS,yBAAyB,CAChC,KAAuC;IAEvC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;AAC7C,CAAC;AAED,wGAAwG;AACxG,SAAS,eAAe,CACtB,KAAuC,EACvC,SAAsC;IAEtC,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAA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,CAAC;AACjB,CAAC;AAED,+FAA+F;AAC/F,SAAS,qBAAqB,CAAC,KAAa;IAC1C,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,oGAAoG;AACpG,SAAS,wBAAwB,CAAC,KAAa;IAC7C,OAAO,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,yGAAyG;AACzG,SAAS,0BAA0B,CAAC,KAAa;IAC/C,OAAO,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AAED,wFAAwF;AACxF,SAAS,qBAAqB,CAAC,YAAoB;IACjD,OAAO,GAAG,YAAY;SACnB,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;SACtB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;SAClD,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3E,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["import type {\n AuthoringRouteDeliveryDefinition,\n AvailableAuthoringRouteScreen,\n} from '@ankhorage/studio-authoring';\n\nimport type {\n ExpoAuthoringRouteFile,\n ExpoAuthoringRouteHostPort,\n ExpoAuthoringRouteHostPorts,\n} from '../../types/expoAuthoringRouteDelivery';\n\n/*** Translate available portable Authoring screens into deterministic, host-composed Expo Router files. */\nexport function getExpoAuthoringRouteFiles(\n routes: readonly AuthoringRouteDeliveryDefinition[],\n hostPorts: ExpoAuthoringRouteHostPorts,\n): readonly ExpoAuthoringRouteFile[] {\n return routes\n .filter(isAvailableAuthoringRoute)\n .map((route) => createExpoAuthoringRouteFile(route, requireHostPort(route, hostPorts)));\n}\n\n/*** Limit delivery to routes whose owner has published a concrete screen module. */\nfunction isAvailableAuthoringRoute(\n route: AuthoringRouteDeliveryDefinition,\n): route is AuthoringRouteDeliveryDefinition & { readonly screen: AvailableAuthoringRouteScreen } {\n return route.screen.status === 'available';\n}\n\n/*** Refuse to synthesize a route when its host has not explicitly accepted its composition boundary. */\nfunction requireHostPort(\n route: AuthoringRouteDeliveryDefinition,\n hostPorts: ExpoAuthoringRouteHostPorts,\n): ExpoAuthoringRouteHostPort {\n const hostPort = hostPorts[route.id];\n if (!hostPort) {\n throw new Error(`Authoring route '${route.id}' requires an explicit host composition port.`);\n }\n return hostPort;\n}\n\n/*** Render one Expo Router file from one published portable screen and one declared host props factory. */\nfunction createExpoAuthoringRouteFile(\n route: AuthoringRouteDeliveryDefinition & { readonly screen: AvailableAuthoringRouteScreen },\n hostPort: ExpoAuthoringRouteHostPort,\n): ExpoAuthoringRouteFile {\n const relativePath = getExpoRouterRelativePath(route);\n assertSafeSourceIdentifiers(route, hostPort);\n const componentName = getRouteComponentName(relativePath);\n return {\n relativePath,\n route,\n source: [\n `import { ${route.screen.exportName} } from ${JSON.stringify(route.screen.moduleSpecifier)};`,\n `import { ${hostPort.getPropsExportName} } from ${JSON.stringify(hostPort.moduleSpecifier)};`,\n '',\n `export default function ${componentName}() {`,\n ` return <${route.screen.exportName} {...${hostPort.getPropsExportName}()} />;`,\n '}',\n '',\n ].join('\\n'),\n };\n}\n\n/*** Refuse values that would turn a published route or host port into arbitrary generated source. */\nfunction assertSafeSourceIdentifiers(\n route: AuthoringRouteDeliveryDefinition & { readonly screen: AvailableAuthoringRouteScreen },\n hostPort: ExpoAuthoringRouteHostPort,\n): void {\n if (\n !isSafeJavaScriptIdentifier(route.screen.exportName) ||\n !isSafeJavaScriptIdentifier(hostPort.getPropsExportName)\n ) {\n throw new Error(`Authoring route '${route.id}' has an unsafe screen or host export name.`);\n }\n}\n\n/*** Convert a published pathname template to a confined Expo Router-relative TSX path. */\nfunction getExpoRouterRelativePath(route: AuthoringRouteDeliveryDefinition): string {\n const segments = route.pathPattern.split('/').slice(1);\n const parameters = new Set(route.parameters.map(({ name }) => name));\n const relativeSegments = segments.map((segment) => getExpoRouterSegment(segment, parameters));\n if (relativeSegments.length === 0 || parameters.size !== 0) {\n throw new Error(`Authoring route '${route.id}' has an invalid path parameter declaration.`);\n }\n return `${relativeSegments.join('/')}.tsx`;\n}\n\n/*** Validate one path segment before translating a declared parameter to Expo Router syntax. */\nfunction getExpoRouterSegment(segment: string, parameters: Set<string>): string {\n const parameterName = segment.startsWith(':') ? segment.slice(1) : undefined;\n if (parameterName) {\n if (!parameters.delete(parameterName) || !isSafeRouteParameterName(parameterName)) {\n throw new Error(`Authoring route contains an invalid path parameter '${segment}'.`);\n }\n return `[${parameterName}]`;\n }\n if (!isSafeRouteIdentifier(segment)) {\n throw new Error(`Authoring route contains an unsafe path segment '${segment}'.`);\n }\n return segment;\n}\n\n/*** Accept only non-empty route identifiers that cannot escape the generated app directory. */\nfunction isSafeRouteIdentifier(value: string): boolean {\n return /^[a-z][a-z0-9-]*$/u.test(value);\n}\n\n/*** Accept the published camel-case parameter names while retaining single-segment route safety. */\nfunction isSafeRouteParameterName(value: string): boolean {\n return /^[a-z][A-Za-z0-9]*$/u.test(value);\n}\n\n/*** Accept a JavaScript identifier only when it can be inserted into generated import and JSX syntax. */\nfunction isSafeJavaScriptIdentifier(value: string): boolean {\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(value);\n}\n\n/*** Derive a stable default-export component name from the generated route filename. */\nfunction getRouteComponentName(relativePath: string): string {\n return `${relativePath\n .replace(/\\.tsx$/u, '')\n .split('/')\n .map((segment) => segment.replace(/\\[|\\]|-/gu, ''))\n .map((segment) => `${segment.slice(0, 1).toUpperCase()}${segment.slice(1)}`)\n .join('')}Route`;\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import type { AppManifest, NavigatorGenerationBindings } from '@ankhorage/contracts';
2
+ import { type ExpoRuntimeGeneratedAppOutputPlan } from './generatedAppOutput';
3
+ import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';
4
+ export interface ExpoRuntimeGeneratedAppSourceFile {
5
+ readonly relativePath: string;
6
+ readonly source: string;
7
+ }
8
+ export interface ExpoRuntimeGeneratedAppSourceDiagnostic {
9
+ readonly code: 'invalid-manifest-module-specifier' | 'missing-manifest-screen';
10
+ readonly severity: 'error';
11
+ readonly screenId?: string;
12
+ readonly message: string;
13
+ }
14
+ export interface ExpoRuntimeGeneratedAppSources extends ExpoRuntimeGeneratedAppOutputPlan {
15
+ readonly diagnostics: readonly ExpoRuntimeGeneratedAppSourceDiagnostic[];
16
+ readonly files: readonly ExpoRuntimeGeneratedAppSourceFile[];
17
+ readonly navigatorBindings: NavigatorGenerationBindings;
18
+ }
19
+ export interface ResolveExpoRuntimeGeneratedAppSourcesOptions {
20
+ /** Static module specifier through which the caller exposes its immutable manifest. */
21
+ readonly manifestModuleSpecifier: string;
22
+ /** Static module specifier Navigator uses to import the generated manifest screen exports. */
23
+ readonly screenModuleSpecifier: string;
24
+ }
25
+ /***
26
+ * Emit the Runtime-owned, filesystem-independent source module and Navigator screen bindings for one manifest.
27
+ *
28
+ * The caller owns manifest materialization and file writes. This boundary intentionally emits no Authoring
29
+ * routes: unresolved `/ankh` routes remain the responsibility of their published owner.
30
+ */
31
+ export declare function resolveExpoRuntimeGeneratedAppSources(manifest: AppManifest, runtimePlan: ExpoRuntimePlan | undefined, options: ResolveExpoRuntimeGeneratedAppSourcesOptions): ExpoRuntimeGeneratedAppSources;
32
+ //# sourceMappingURL=generatedAppSources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generatedAppSources.d.ts","sourceRoot":"","sources":["../src/generatedAppSources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,2BAA2B,EAG5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,iCAAiC,EAEvC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,IAAI,EAAE,mCAAmC,GAAG,yBAAyB,CAAC;IAC/E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,8BAA+B,SAAQ,iCAAiC;IACvF,QAAQ,CAAC,WAAW,EAAE,SAAS,uCAAuC,EAAE,CAAC;IACzE,QAAQ,CAAC,KAAK,EAAE,SAAS,iCAAiC,EAAE,CAAC;IAC7D,QAAQ,CAAC,iBAAiB,EAAE,2BAA2B,CAAC;CACzD;AAED,MAAM,WAAW,4CAA4C;IAC3D,uFAAuF;IACvF,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,8FAA8F;IAC9F,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,WAAW,EACrB,WAAW,EAAE,eAAe,GAAG,SAAS,EACxC,OAAO,EAAE,4CAA4C,GACpD,8BAA8B,CAoBhC"}
@@ -0,0 +1,129 @@
1
+ import { resolveExpoRuntimeGeneratedAppOutput, } from './generatedAppOutput';
2
+ /***
3
+ * Emit the Runtime-owned, filesystem-independent source module and Navigator screen bindings for one manifest.
4
+ *
5
+ * The caller owns manifest materialization and file writes. This boundary intentionally emits no Authoring
6
+ * routes: unresolved `/ankh` routes remain the responsibility of their published owner.
7
+ */
8
+ export function resolveExpoRuntimeGeneratedAppSources(manifest, runtimePlan, options) {
9
+ const output = resolveExpoRuntimeGeneratedAppOutput(runtimePlan);
10
+ const diagnostics = collectDiagnostics(manifest, options);
11
+ const screenIds = collectNavigatorScreenIds(manifest.navigator);
12
+ const navigatorBindings = createNavigatorBindings(screenIds, options.screenModuleSpecifier);
13
+ return {
14
+ ...output,
15
+ diagnostics,
16
+ files: diagnostics.length === 0
17
+ ? [
18
+ {
19
+ relativePath: 'src/generated/runtimeManifestScreens.tsx',
20
+ source: createRuntimeManifestScreensSource(manifest, options.manifestModuleSpecifier),
21
+ },
22
+ ]
23
+ : [],
24
+ navigatorBindings: diagnostics.length === 0 ? navigatorBindings : { guards: {}, screens: {} },
25
+ };
26
+ }
27
+ /*** Collect every manifest screen identity that Navigator can render or reference as a native accessory. */
28
+ function collectNavigatorScreenIds(navigator) {
29
+ return Array.from(collectNavigatorScreenIdSet(navigator)).sort();
30
+ }
31
+ /*** Traverse one navigator subtree without treating unowned Authoring paths as Runtime screens. */
32
+ function collectNavigatorScreenIdSet(navigator) {
33
+ const screenIds = new Set();
34
+ for (const route of navigator.routes) {
35
+ if (route.screenId !== undefined)
36
+ screenIds.add(route.screenId);
37
+ if (route.navigator !== undefined) {
38
+ for (const screenId of collectNavigatorScreenIdSet(route.navigator))
39
+ screenIds.add(screenId);
40
+ }
41
+ }
42
+ if (navigator.type === 'split-view') {
43
+ screenIds.add(navigator.columns.primary.screenId);
44
+ if (navigator.columns.supplementary !== undefined) {
45
+ screenIds.add(navigator.columns.supplementary.screenId);
46
+ }
47
+ if (navigator.inspector !== undefined)
48
+ screenIds.add(navigator.inspector.screenId);
49
+ }
50
+ if (navigator.type === 'tabs' && navigator.implementation === 'native') {
51
+ if (navigator.bottomAccessory !== undefined)
52
+ screenIds.add(navigator.bottomAccessory.screenId);
53
+ }
54
+ return screenIds;
55
+ }
56
+ /*** Report invalid caller module bindings and every Navigator screen that the manifest does not define. */
57
+ function collectDiagnostics(manifest, options) {
58
+ const invalidSpecifierDiagnostics = [
59
+ ['manifestModuleSpecifier', options.manifestModuleSpecifier],
60
+ ['screenModuleSpecifier', options.screenModuleSpecifier],
61
+ ].flatMap(([name, value]) => isStaticModuleSpecifier(value)
62
+ ? []
63
+ : [
64
+ {
65
+ code: 'invalid-manifest-module-specifier',
66
+ severity: 'error',
67
+ message: `${name} must be a non-empty static module specifier.`,
68
+ },
69
+ ]);
70
+ const missingScreenDiagnostics = collectNavigatorScreenIds(manifest.navigator)
71
+ .filter((screenId) => !Object.hasOwn(manifest.screens, screenId))
72
+ .map((screenId) => ({
73
+ code: 'missing-manifest-screen',
74
+ severity: 'error',
75
+ screenId,
76
+ message: `Navigator references manifest screen '${screenId}', but no matching manifest screen exists.`,
77
+ }));
78
+ return [...invalidSpecifierDiagnostics, ...missingScreenDiagnostics].sort((left, right) => `${left.code}\0${left.screenId ?? ''}\0${left.message}`.localeCompare(`${right.code}\0${right.screenId ?? ''}\0${right.message}`));
79
+ }
80
+ /*** Keep generated static imports safe without imposing a filesystem layout on the caller. */
81
+ function isStaticModuleSpecifier(value) {
82
+ return (value.trim().length > 0 &&
83
+ Array.from(value).every((character) => character.charCodeAt(0) >= 32 && !["'", '"', '`', '\\'].includes(character)));
84
+ }
85
+ /*** Map each actual Navigator screen identity onto a stable named export in the generated Runtime module. */
86
+ function createNavigatorBindings(screenIds, screenModuleSpecifier) {
87
+ return {
88
+ guards: {},
89
+ screens: Object.fromEntries(screenIds.map((screenId, index) => [
90
+ screenId,
91
+ {
92
+ module: screenModuleSpecifier,
93
+ exportName: getManifestScreenExportName(index),
94
+ },
95
+ ])),
96
+ };
97
+ }
98
+ /*** Produce a safe export name independently of user-authored screen identifiers. */
99
+ function getManifestScreenExportName(index) {
100
+ return `ManifestScreen${index}`;
101
+ }
102
+ /*** Render the one Runtime-owned module whose exports bind Navigator routes to actual manifest screens. */
103
+ function createRuntimeManifestScreensSource(manifest, manifestModuleSpecifier) {
104
+ const screenIds = collectNavigatorScreenIds(manifest.navigator);
105
+ const exports = screenIds
106
+ .map((screenId, index) => `export const ${getManifestScreenExportName(index)} = createManifestScreen(${JSON.stringify(screenId)});`)
107
+ .join('\n');
108
+ return `import type { AppManifest } from '@ankhorage/contracts';
109
+ import { RuntimeScreen } from '@ankhorage/runtime';
110
+ import { createZoraComponentRegistry } from '@ankhorage/zora';
111
+ import runtimeManifest from ${JSON.stringify(manifestModuleSpecifier)};
112
+
113
+ const manifest = runtimeManifest as AppManifest;
114
+ const registry = createZoraComponentRegistry();
115
+
116
+ function createManifestScreen(screenId: string) {
117
+ const screen = manifest.screens[screenId];
118
+ if (screen === undefined) {
119
+ throw new Error(\`Generated Runtime screen binding is missing manifest screen '\${screenId}'.\`);
120
+ }
121
+ return function ManifestScreen() {
122
+ return <RuntimeScreen manifest={manifest} registry={registry} screen={screen} />;
123
+ };
124
+ }
125
+
126
+ ${exports}
127
+ `;
128
+ }
129
+ //# sourceMappingURL=generatedAppSources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generatedAppSources.js","sourceRoot":"","sources":["../src/generatedAppSources.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,oCAAoC,GACrC,MAAM,sBAAsB,CAAC;AA4B9B;;;;;GAKG;AACH,MAAM,UAAU,qCAAqC,CACnD,QAAqB,EACrB,WAAwC,EACxC,OAAqD;IAErD,MAAM,MAAM,GAAG,oCAAoC,CAAC,WAAW,CAAC,CAAC;IACjE,MAAM,WAAW,GAAG,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,yBAAyB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAChE,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,SAAS,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAE5F,OAAO;QACL,GAAG,MAAM;QACT,WAAW;QACX,KAAK,EACH,WAAW,CAAC,MAAM,KAAK,CAAC;YACtB,CAAC,CAAC;gBACE;oBACE,YAAY,EAAE,0CAA0C;oBACxD,MAAM,EAAE,kCAAk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ChE,MAAM,OAAO,GAAG,SAAS;SACtB,GAAG,CACF,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAClB,gBAAgB,2BAA2B,CAAC,KAAK,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAC5G;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO;;;8BAGqB,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC;;;;;;;;;;;;;;;EAenE,OAAO;CACR,CAAC;AACF,CAAC","sourcesContent":["import type {\n AppManifest,\n NavigatorGenerationBindings,\n NavigatorNode,\n NavigatorScreenModule,\n} from '@ankhorage/contracts';\n\nimport {\n type ExpoRuntimeGeneratedAppOutputPlan,\n resolveExpoRuntimeGeneratedAppOutput,\n} from './generatedAppOutput';\nimport type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';\n\nexport interface ExpoRuntimeGeneratedAppSourceFile {\n readonly relativePath: string;\n readonly source: string;\n}\n\nexport interface ExpoRuntimeGeneratedAppSourceDiagnostic {\n readonly code: 'invalid-manifest-module-specifier' | 'missing-manifest-screen';\n readonly severity: 'error';\n readonly screenId?: string;\n readonly message: string;\n}\n\nexport interface ExpoRuntimeGeneratedAppSources extends ExpoRuntimeGeneratedAppOutputPlan {\n readonly diagnostics: readonly ExpoRuntimeGeneratedAppSourceDiagnostic[];\n readonly files: readonly ExpoRuntimeGeneratedAppSourceFile[];\n readonly navigatorBindings: NavigatorGenerationBindings;\n}\n\nexport interface ResolveExpoRuntimeGeneratedAppSourcesOptions {\n /** Static module specifier through which the caller exposes its immutable manifest. */\n readonly manifestModuleSpecifier: string;\n /** Static module specifier Navigator uses to import the generated manifest screen exports. */\n readonly screenModuleSpecifier: string;\n}\n\n/***\n * Emit the Runtime-owned, filesystem-independent source module and Navigator screen bindings for one manifest.\n *\n * The caller owns manifest materialization and file writes. This boundary intentionally emits no Authoring\n * routes: unresolved `/ankh` routes remain the responsibility of their published owner.\n */\nexport function resolveExpoRuntimeGeneratedAppSources(\n manifest: AppManifest,\n runtimePlan: ExpoRuntimePlan | undefined,\n options: ResolveExpoRuntimeGeneratedAppSourcesOptions,\n): ExpoRuntimeGeneratedAppSources {\n const output = resolveExpoRuntimeGeneratedAppOutput(runtimePlan);\n const diagnostics = collectDiagnostics(manifest, options);\n const screenIds = collectNavigatorScreenIds(manifest.navigator);\n const navigatorBindings = createNavigatorBindings(screenIds, options.screenModuleSpecifier);\n\n return {\n ...output,\n diagnostics,\n files:\n diagnostics.length === 0\n ? [\n {\n relativePath: 'src/generated/runtimeManifestScreens.tsx',\n source: createRuntimeManifestScreensSource(manifest, options.manifestModuleSpecifier),\n },\n ]\n : [],\n navigatorBindings: diagnostics.length === 0 ? navigatorBindings : { guards: {}, screens: {} },\n };\n}\n\n/*** Collect every manifest screen identity that Navigator can render or reference as a native accessory. */\nfunction collectNavigatorScreenIds(navigator: NavigatorNode): readonly string[] {\n return Array.from(collectNavigatorScreenIdSet(navigator)).sort();\n}\n\n/*** Traverse one navigator subtree without treating unowned Authoring paths as Runtime screens. */\nfunction collectNavigatorScreenIdSet(navigator: NavigatorNode): ReadonlySet<string> {\n const screenIds = new Set<string>();\n for (const route of navigator.routes) {\n if (route.screenId !== undefined) screenIds.add(route.screenId);\n if (route.navigator !== undefined) {\n for (const screenId of collectNavigatorScreenIdSet(route.navigator)) screenIds.add(screenId);\n }\n }\n if (navigator.type === 'split-view') {\n screenIds.add(navigator.columns.primary.screenId);\n if (navigator.columns.supplementary !== undefined) {\n screenIds.add(navigator.columns.supplementary.screenId);\n }\n if (navigator.inspector !== undefined) screenIds.add(navigator.inspector.screenId);\n }\n if (navigator.type === 'tabs' && navigator.implementation === 'native') {\n if (navigator.bottomAccessory !== undefined) screenIds.add(navigator.bottomAccessory.screenId);\n }\n return screenIds;\n}\n\n/*** Report invalid caller module bindings and every Navigator screen that the manifest does not define. */\nfunction collectDiagnostics(\n manifest: AppManifest,\n options: ResolveExpoRuntimeGeneratedAppSourcesOptions,\n): readonly ExpoRuntimeGeneratedAppSourceDiagnostic[] {\n const invalidSpecifierDiagnostics: ExpoRuntimeGeneratedAppSourceDiagnostic[] = [\n ['manifestModuleSpecifier', options.manifestModuleSpecifier] as const,\n ['screenModuleSpecifier', options.screenModuleSpecifier] as const,\n ].flatMap(([name, value]) =>\n isStaticModuleSpecifier(value)\n ? []\n : [\n {\n code: 'invalid-manifest-module-specifier',\n severity: 'error',\n message: `${name} must be a non-empty static module specifier.`,\n } satisfies ExpoRuntimeGeneratedAppSourceDiagnostic,\n ],\n );\n const missingScreenDiagnostics: ExpoRuntimeGeneratedAppSourceDiagnostic[] =\n collectNavigatorScreenIds(manifest.navigator)\n .filter((screenId) => !Object.hasOwn(manifest.screens, screenId))\n .map(\n (screenId) =>\n ({\n code: 'missing-manifest-screen',\n severity: 'error',\n screenId,\n message: `Navigator references manifest screen '${screenId}', but no matching manifest screen exists.`,\n }) satisfies ExpoRuntimeGeneratedAppSourceDiagnostic,\n );\n return [...invalidSpecifierDiagnostics, ...missingScreenDiagnostics].sort((left, right) =>\n `${left.code}\\0${left.screenId ?? ''}\\0${left.message}`.localeCompare(\n `${right.code}\\0${right.screenId ?? ''}\\0${right.message}`,\n ),\n );\n}\n\n/*** Keep generated static imports safe without imposing a filesystem layout on the caller. */\nfunction isStaticModuleSpecifier(value: string): boolean {\n return (\n value.trim().length > 0 &&\n Array.from(value).every(\n (character) => character.charCodeAt(0) >= 32 && ![\"'\", '\"', '`', '\\\\'].includes(character),\n )\n );\n}\n\n/*** Map each actual Navigator screen identity onto a stable named export in the generated Runtime module. */\nfunction createNavigatorBindings(\n screenIds: readonly string[],\n screenModuleSpecifier: string,\n): NavigatorGenerationBindings {\n return {\n guards: {},\n screens: Object.fromEntries(\n screenIds.map((screenId, index) => [\n screenId,\n {\n module: screenModuleSpecifier,\n exportName: getManifestScreenExportName(index),\n } satisfies NavigatorScreenModule,\n ]),\n ),\n };\n}\n\n/*** Produce a safe export name independently of user-authored screen identifiers. */\nfunction getManifestScreenExportName(index: number): string {\n return `ManifestScreen${index}`;\n}\n\n/*** Render the one Runtime-owned module whose exports bind Navigator routes to actual manifest screens. */\nfunction createRuntimeManifestScreensSource(\n manifest: AppManifest,\n manifestModuleSpecifier: string,\n): string {\n const screenIds = collectNavigatorScreenIds(manifest.navigator);\n const exports = screenIds\n .map(\n (screenId, index) =>\n `export const ${getManifestScreenExportName(index)} = createManifestScreen(${JSON.stringify(screenId)});`,\n )\n .join('\\n');\n return `import type { AppManifest } from '@ankhorage/contracts';\nimport { RuntimeScreen } from '@ankhorage/runtime';\nimport { createZoraComponentRegistry } from '@ankhorage/zora';\nimport runtimeManifest from ${JSON.stringify(manifestModuleSpecifier)};\n\nconst manifest = runtimeManifest as AppManifest;\nconst registry = createZoraComponentRegistry();\n\nfunction createManifestScreen(screenId: string) {\n const screen = manifest.screens[screenId];\n if (screen === undefined) {\n throw new Error(\\`Generated Runtime screen binding is missing manifest screen '\\${screenId}'.\\`);\n }\n return function ManifestScreen() {\n return <RuntimeScreen manifest={manifest} registry={registry} screen={screen} />;\n };\n}\n\n${exports}\n`;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -10,8 +10,10 @@ export { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRunt
10
10
  export { ExpoZoraIconFontProvider, type ExpoZoraIconFontProviderProps, } from './ExpoZoraIconFontProvider';
11
11
  export { type ExpoAuthoringRoutePlanning, getExpoAuthoringRoutePlanning, } from './features/navigation/getExpoAuthoringRoutePlanning';
12
12
  export { type ExpoRuntimeConfigPluginOutput, type ExpoRuntimeDependencyMap, type ExpoRuntimeGeneratedAppOutputPlan, type ExpoRuntimeNativeOutputPlan, resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap, resolveExpoRuntimeGeneratedAppOutput, resolveExpoRuntimeNativeOutput, } from './generatedAppOutput';
13
+ export { type ExpoRuntimeGeneratedAppSourceDiagnostic, type ExpoRuntimeGeneratedAppSourceFile, type ExpoRuntimeGeneratedAppSources, resolveExpoRuntimeGeneratedAppSources, type ResolveExpoRuntimeGeneratedAppSourcesOptions, } from './generatedAppSources';
13
14
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
14
15
  export { type ExpoRuntimeLayoutIntegrationPlan, resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
15
16
  export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
16
17
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
18
+ export { type ExpoAuthoringRouteFile, type ExpoAuthoringRouteHostPort, type ExpoAuthoringRouteHostPorts, getExpoAuthoringRouteFiles, } from './routeDelivery';
17
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,2CAA2C,GAC5C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,mCAAmC,EACxC,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,gCAAgC,EACrC,iCAAiC,EACjC,KAAK,+BAA+B,EACpC,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EACzC,KAAK,4BAA4B,EACjC,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,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,y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9,9 @@ export { ExpoRuntimeProviders } from './ExpoRuntimeProviders';
9
9
  export { ExpoZoraIconFontProvider, } from './ExpoZoraIconFontProvider';
10
10
  export { getExpoAuthoringRoutePlanning, } from './features/navigation/getExpoAuthoringRoutePlanning';
11
11
  export { resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap, resolveExpoRuntimeGeneratedAppOutput, resolveExpoRuntimeNativeOutput, } from './generatedAppOutput';
12
+ export { resolveExpoRuntimeGeneratedAppSources, } from './generatedAppSources';
12
13
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
13
14
  export { resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
14
15
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
16
+ export { getExpoAuthoringRouteFiles, } from './routeDelivery';
15
17
  //# 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,qBAAqB,EACrB,2CAA2C,GAC5C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAK9B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,iCAAiC,EAOjC,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,yBAAyB,GAE1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EACL,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,6BAA6B,GAC9B,MAAM,qDAAqD,CAAC;AAC7D,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;AAMrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n BARCODE_SCANNER_TYPES,\n mapPermissionStatusToCameraPermissionStatus,\n} from './barcodeScanRuntime';\nexport {\n type ExpoBundledMediaRegistrySourceEntry,\n getExpoBundledMediaRegistrySource,\n} from './bundledMediaRegistrySource';\nexport {\n createExpoBundledMediaResolver,\n type ExpoBundledMediaRegistry,\n type ExpoBundledMediaResolver,\n type ExpoBundledMediaResolverArgs,\n type ExpoBundledMediaValue,\n resolveExpoBundledMediaAsset,\n} from './bundledMediaResolver';\nexport {\n type ExecuteExpoRuntimeCapabilityArgs,\n executeExpoRuntimeCapabilityAsync,\n type ExpoRuntimeCapabilityDiagnostic,\n type ExpoRuntimeCapabilityDiagnosticCode,\n type ExpoRuntimeCapabilityExecutionResult,\n type ExpoRuntimeCapabilityHandler,\n type ExpoRuntimeCapabilityHandlerArgs,\n type ExpoRuntimeRouteResolution,\n resolveExpoRuntimeRoutePath,\n} from './capabilityBridge';\nexport type { ComponentRegistry } from './componentRegistry';\nexport { createComponentRegistry } from './componentRegistry';\nexport { createExpoRuntimeRegistry } from './createExpoRuntimeRegistry';\nexport {\n ExpoBarcodeScannerAdapter,\n type ExpoBarcodeScannerAdapterProps,\n} from './ExpoBarcodeScannerAdapter';\nexport { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';\nexport {\n ExpoZoraIconFontProvider,\n type ExpoZoraIconFontProviderProps,\n} from './ExpoZoraIconFontProvider';\nexport {\n type ExpoAuthoringRoutePlanning,\n getExpoAuthoringRoutePlanning,\n} from './features/navigation/getExpoAuthoringRoutePlanning';\nexport {\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 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,qBAAqB,EACrB,2CAA2C,GAC5C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAK9B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,iCAAiC,EAOjC,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,yBAAyB,GAE1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EACL,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,6BAA6B,GAC9B,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAKL,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAIL,qCAAqC,GAEtC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAIL,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n BARCODE_SCANNER_TYPES,\n mapPermissionStatusToCameraPermissionStatus,\n} from './barcodeScanRuntime';\nexport {\n type ExpoBundledMediaRegistrySourceEntry,\n getExpoBundledMediaRegistrySource,\n} from './bundledMediaRegistrySource';\nexport {\n createExpoBundledMediaResolver,\n type ExpoBundledMediaRegistry,\n type ExpoBundledMediaResolver,\n type ExpoBundledMediaResolverArgs,\n type ExpoBundledMediaValue,\n resolveExpoBundledMediaAsset,\n} from './bundledMediaResolver';\nexport {\n type ExecuteExpoRuntimeCapabilityArgs,\n executeExpoRuntimeCapabilityAsync,\n type ExpoRuntimeCapabilityDiagnostic,\n type ExpoRuntimeCapabilityDiagnosticCode,\n type ExpoRuntimeCapabilityExecutionResult,\n type ExpoRuntimeCapabilityHandler,\n type ExpoRuntimeCapabilityHandlerArgs,\n type ExpoRuntimeRouteResolution,\n resolveExpoRuntimeRoutePath,\n} from './capabilityBridge';\nexport type { ComponentRegistry } from './componentRegistry';\nexport { createComponentRegistry } from './componentRegistry';\nexport { createExpoRuntimeRegistry } from './createExpoRuntimeRegistry';\nexport {\n ExpoBarcodeScannerAdapter,\n type ExpoBarcodeScannerAdapterProps,\n} from './ExpoBarcodeScannerAdapter';\nexport { ExpoRuntimeProviders, type ExpoRuntimeProvidersProps } from './ExpoRuntimeProviders';\nexport {\n ExpoZoraIconFontProvider,\n type ExpoZoraIconFontProviderProps,\n} from './ExpoZoraIconFontProvider';\nexport {\n type ExpoAuthoringRoutePlanning,\n getExpoAuthoringRoutePlanning,\n} from './features/navigation/getExpoAuthoringRoutePlanning';\nexport {\n type ExpoRuntimeConfigPluginOutput,\n type ExpoRuntimeDependencyMap,\n type ExpoRuntimeGeneratedAppOutputPlan,\n type ExpoRuntimeNativeOutputPlan,\n resolveExpoRuntimeConfigPluginOutput,\n resolveExpoRuntimeDependencyMap,\n resolveExpoRuntimeGeneratedAppOutput,\n resolveExpoRuntimeNativeOutput,\n} from './generatedAppOutput';\nexport {\n type ExpoRuntimeGeneratedAppSourceDiagnostic,\n type ExpoRuntimeGeneratedAppSourceFile,\n type ExpoRuntimeGeneratedAppSources,\n resolveExpoRuntimeGeneratedAppSources,\n type ResolveExpoRuntimeGeneratedAppSourcesOptions,\n} from './generatedAppSources';\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';\nexport {\n type ExpoAuthoringRouteFile,\n type ExpoAuthoringRouteHostPort,\n type ExpoAuthoringRouteHostPorts,\n getExpoAuthoringRouteFiles,\n} from './routeDelivery';\n"]}
@@ -0,0 +1,3 @@
1
+ export { getExpoAuthoringRouteFiles } from './features/navigation/getExpoAuthoringRouteFiles';
2
+ export type { ExpoAuthoringRouteFile, ExpoAuthoringRouteHostPort, ExpoAuthoringRouteHostPorts, } from './types/expoAuthoringRouteDelivery';
3
+ //# sourceMappingURL=routeDelivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routeDelivery.d.ts","sourceRoot":"","sources":["../src/routeDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,YAAY,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { getExpoAuthoringRouteFiles } from './features/navigation/getExpoAuthoringRouteFiles';
2
+ //# sourceMappingURL=routeDelivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routeDelivery.js","sourceRoot":"","sources":["../src/routeDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC","sourcesContent":["export { getExpoAuthoringRouteFiles } from './features/navigation/getExpoAuthoringRouteFiles';\nexport type {\n ExpoAuthoringRouteFile,\n ExpoAuthoringRouteHostPort,\n ExpoAuthoringRouteHostPorts,\n} from './types/expoAuthoringRouteDelivery';\n"]}
@@ -0,0 +1,15 @@
1
+ import type { AnkhRouteId, AuthoringRouteDeliveryDefinition } from '@ankhorage/studio-authoring';
2
+ /*** Describe the host-owned props factory that composes one portable Authoring screen. */
3
+ export interface ExpoAuthoringRouteHostPort {
4
+ readonly getPropsExportName: string;
5
+ readonly moduleSpecifier: string;
6
+ }
7
+ /*** Supply every host composition port needed by the available Authoring screen routes. */
8
+ export type ExpoAuthoringRouteHostPorts = Readonly<Partial<Record<AnkhRouteId, ExpoAuthoringRouteHostPort>>>;
9
+ /*** Record one deterministic Expo Router file without performing filesystem I/O. */
10
+ export interface ExpoAuthoringRouteFile {
11
+ readonly relativePath: string;
12
+ readonly route: AuthoringRouteDeliveryDefinition;
13
+ readonly source: string;
14
+ }
15
+ //# sourceMappingURL=expoAuthoringRouteDelivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expoAuthoringRouteDelivery.d.ts","sourceRoot":"","sources":["../../src/types/expoAuthoringRouteDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAEjG,0FAA0F;AAC1F,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,2FAA2F;AAC3F,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAChD,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC,CACzD,CAAC;AAEF,oFAAoF;AACpF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,gCAAgC,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=expoAuthoringRouteDelivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expoAuthoringRouteDelivery.js","sourceRoot":"","sources":["../../src/types/expoAuthoringRouteDelivery.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnkhRouteId, AuthoringRouteDeliveryDefinition } from '@ankhorage/studio-authoring';\n\n/*** Describe the host-owned props factory that composes one portable Authoring screen. */\nexport interface ExpoAuthoringRouteHostPort {\n readonly getPropsExportName: string;\n readonly moduleSpecifier: string;\n}\n\n/*** Supply every host composition port needed by the available Authoring screen routes. */\nexport type ExpoAuthoringRouteHostPorts = Readonly<\n Partial<Record<AnkhRouteId, ExpoAuthoringRouteHostPort>>\n>;\n\n/*** Record one deterministic Expo Router file without performing filesystem I/O. */\nexport interface ExpoAuthoringRouteFile {\n readonly relativePath: string;\n readonly route: AuthoringRouteDeliveryDefinition;\n readonly source: string;\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.1.0",
4
+ "version": "7.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": {
@@ -67,6 +67,20 @@
67
67
  "import": "./dist/planning.js",
68
68
  "default": "./dist/planning.js"
69
69
  },
70
+ "./route-delivery": {
71
+ "react-native": "./src/routeDelivery.ts",
72
+ "browser": "./src/routeDelivery.ts",
73
+ "types": "./src/routeDelivery.ts",
74
+ "import": "./dist/routeDelivery.js",
75
+ "default": "./dist/routeDelivery.js"
76
+ },
77
+ "./generated-app": {
78
+ "react-native": "./src/generatedAppSources.ts",
79
+ "browser": "./src/generatedAppSources.ts",
80
+ "types": "./src/generatedAppSources.ts",
81
+ "import": "./dist/generatedAppSources.js",
82
+ "default": "./dist/generatedAppSources.js"
83
+ },
70
84
  "./platform": {
71
85
  "react-native": "./src/platform.ts",
72
86
  "browser": "./src/platform.ts",
@@ -176,6 +190,7 @@
176
190
  "test": "bun test src",
177
191
  "typecheck": "bun x tsc --noEmit -p tsconfig.json && bun x tsc --noEmit -p tsconfig.scripts.json",
178
192
  "validate:action-bridge": "bun scripts/actionBridgeAcceptance.ts",
193
+ "validate:authoring-route-delivery": "bun scripts/authoringRouteDeliveryAcceptance.ts",
179
194
  "validate:expo-platform": "bun scripts/validateExpoPlatform.ts",
180
195
  "validate:headless-platform": "bun scripts/headlessPlatformAcceptance.ts",
181
196
  "validate:icon-fonts-web": "bun scripts/iconFontWebAcceptance.ts",
@@ -185,7 +200,7 @@
185
200
  },
186
201
  "peerDependencies": {
187
202
  "@ankhorage/permissions": "^0.2.63",
188
- "@ankhorage/zora": "^25.8.3",
203
+ "@ankhorage/zora": "^25.8.3 || ^27.2.0",
189
204
  "@react-native-vector-icons/fontawesome": "^13.1.4",
190
205
  "@react-native-vector-icons/fontawesome5": "^13.1.4",
191
206
  "@react-native-vector-icons/fontawesome6": "^13.1.4",
@@ -252,10 +267,10 @@
252
267
  }
253
268
  },
254
269
  "devDependencies": {
255
- "@ankhorage/devtools": "^2.3.47",
270
+ "@ankhorage/devtools": "^2.11.0",
256
271
  "@ankhorage/paradox": "^0.2.27",
257
272
  "@ankhorage/permissions": "^0.2.63",
258
- "@ankhorage/zora": "^25.8.3",
273
+ "@ankhorage/zora": "^25.8.3 || ^27.2.0",
259
274
  "@react-native-vector-icons/fontawesome": "^13.1.4",
260
275
  "@react-native-vector-icons/fontawesome5": "^13.1.4",
261
276
  "@react-native-vector-icons/fontawesome6": "^13.1.4",
@@ -0,0 +1,76 @@
1
+ import { AUTHORING_ANKH_ROUTE_DELIVERIES } from '@ankhorage/studio-authoring';
2
+ import { describe, expect, test } from 'bun:test';
3
+
4
+ import { getExpoAuthoringRouteFiles } from './getExpoAuthoringRouteFiles';
5
+
6
+ const screensHost = {
7
+ screens: {
8
+ moduleSpecifier: '../../authoring/screensHost',
9
+ getPropsExportName: 'getScreensAuthoringScreenProps',
10
+ },
11
+ } as const;
12
+
13
+ describe('getExpoAuthoringRouteFiles', () => {
14
+ test('maps only the published screen to its deterministic Expo Router file', () => {
15
+ const [file] = getExpoAuthoringRouteFiles(AUTHORING_ANKH_ROUTE_DELIVERIES, screensHost);
16
+
17
+ expect(file?.relativePath).toBe('ankh/screens.tsx');
18
+ expect(file?.route.id).toBe('screens');
19
+ expect(file?.source).toContain(
20
+ 'import { ScreensAuthoringScreen } from "@ankhorage/studio-authoring/screens";',
21
+ );
22
+ });
23
+
24
+ test('preserves the host props factory without inventing optional props', () => {
25
+ const [file] = getExpoAuthoringRouteFiles(AUTHORING_ANKH_ROUTE_DELIVERIES, screensHost);
26
+
27
+ expect(file?.source).toContain(
28
+ '<ScreensAuthoringScreen {...getScreensAuthoringScreenProps()} />',
29
+ );
30
+ });
31
+
32
+ test('encodes declared path parameters as Expo Router segments', () => {
33
+ const route = AUTHORING_ANKH_ROUTE_DELIVERIES.find(({ id }) => id === 'screen-detail');
34
+ if (!route) throw new Error('Missing screen-detail route fixture.');
35
+
36
+ expect(
37
+ getExpoAuthoringRouteFiles([{ ...route, screen: getAvailableScreenRoute().screen }], {
38
+ 'screen-detail': screensHost.screens,
39
+ })[0]?.relativePath,
40
+ ).toBe('ankh/screens/[screenId].tsx');
41
+ });
42
+
43
+ test('fails closed when the available screen has no declared host port', () => {
44
+ expect(() => getExpoAuthoringRouteFiles(AUTHORING_ANKH_ROUTE_DELIVERIES, {})).toThrow(
45
+ "Authoring route 'screens' requires an explicit host composition port.",
46
+ );
47
+ });
48
+ });
49
+
50
+ describe('getExpoAuthoringRouteFiles safety', () => {
51
+ test('rejects unsafe route segments and remains deterministic for identical inputs', () => {
52
+ const availableRoute = getAvailableScreenRoute();
53
+ expect(() =>
54
+ getExpoAuthoringRouteFiles(
55
+ [{ ...availableRoute, pathPattern: '/ankh/../screens' }],
56
+ screensHost,
57
+ ),
58
+ ).toThrow('unsafe path segment');
59
+ expect(() =>
60
+ getExpoAuthoringRouteFiles(AUTHORING_ANKH_ROUTE_DELIVERIES, {
61
+ screens: { ...screensHost.screens, getPropsExportName: 'props; throw new Error()' },
62
+ }),
63
+ ).toThrow('unsafe screen or host export name');
64
+ expect(getExpoAuthoringRouteFiles(AUTHORING_ANKH_ROUTE_DELIVERIES, screensHost)).toEqual(
65
+ getExpoAuthoringRouteFiles(AUTHORING_ANKH_ROUTE_DELIVERIES, screensHost),
66
+ );
67
+ });
68
+ });
69
+
70
+ function getAvailableScreenRoute() {
71
+ const route = AUTHORING_ANKH_ROUTE_DELIVERIES.find(({ screen }) => screen.status === 'available');
72
+ if (route?.screen.status !== 'available') {
73
+ throw new Error('Missing available Authoring screen route fixture.');
74
+ }
75
+ return route;
76
+ }
@@ -0,0 +1,126 @@
1
+ import type {
2
+ AuthoringRouteDeliveryDefinition,
3
+ AvailableAuthoringRouteScreen,
4
+ } from '@ankhorage/studio-authoring';
5
+
6
+ import type {
7
+ ExpoAuthoringRouteFile,
8
+ ExpoAuthoringRouteHostPort,
9
+ ExpoAuthoringRouteHostPorts,
10
+ } from '../../types/expoAuthoringRouteDelivery';
11
+
12
+ /*** Translate available portable Authoring screens into deterministic, host-composed Expo Router files. */
13
+ export function getExpoAuthoringRouteFiles(
14
+ routes: readonly AuthoringRouteDeliveryDefinition[],
15
+ hostPorts: ExpoAuthoringRouteHostPorts,
16
+ ): readonly ExpoAuthoringRouteFile[] {
17
+ return routes
18
+ .filter(isAvailableAuthoringRoute)
19
+ .map((route) => createExpoAuthoringRouteFile(route, requireHostPort(route, hostPorts)));
20
+ }
21
+
22
+ /*** Limit delivery to routes whose owner has published a concrete screen module. */
23
+ function isAvailableAuthoringRoute(
24
+ route: AuthoringRouteDeliveryDefinition,
25
+ ): route is AuthoringRouteDeliveryDefinition & { readonly screen: AvailableAuthoringRouteScreen } {
26
+ return route.screen.status === 'available';
27
+ }
28
+
29
+ /*** Refuse to synthesize a route when its host has not explicitly accepted its composition boundary. */
30
+ function requireHostPort(
31
+ route: AuthoringRouteDeliveryDefinition,
32
+ hostPorts: ExpoAuthoringRouteHostPorts,
33
+ ): ExpoAuthoringRouteHostPort {
34
+ const hostPort = hostPorts[route.id];
35
+ if (!hostPort) {
36
+ throw new Error(`Authoring route '${route.id}' requires an explicit host composition port.`);
37
+ }
38
+ return hostPort;
39
+ }
40
+
41
+ /*** Render one Expo Router file from one published portable screen and one declared host props factory. */
42
+ function createExpoAuthoringRouteFile(
43
+ route: AuthoringRouteDeliveryDefinition & { readonly screen: AvailableAuthoringRouteScreen },
44
+ hostPort: ExpoAuthoringRouteHostPort,
45
+ ): ExpoAuthoringRouteFile {
46
+ const relativePath = getExpoRouterRelativePath(route);
47
+ assertSafeSourceIdentifiers(route, hostPort);
48
+ const componentName = getRouteComponentName(relativePath);
49
+ return {
50
+ relativePath,
51
+ route,
52
+ source: [
53
+ `import { ${route.screen.exportName} } from ${JSON.stringify(route.screen.moduleSpecifier)};`,
54
+ `import { ${hostPort.getPropsExportName} } from ${JSON.stringify(hostPort.moduleSpecifier)};`,
55
+ '',
56
+ `export default function ${componentName}() {`,
57
+ ` return <${route.screen.exportName} {...${hostPort.getPropsExportName}()} />;`,
58
+ '}',
59
+ '',
60
+ ].join('\n'),
61
+ };
62
+ }
63
+
64
+ /*** Refuse values that would turn a published route or host port into arbitrary generated source. */
65
+ function assertSafeSourceIdentifiers(
66
+ route: AuthoringRouteDeliveryDefinition & { readonly screen: AvailableAuthoringRouteScreen },
67
+ hostPort: ExpoAuthoringRouteHostPort,
68
+ ): void {
69
+ if (
70
+ !isSafeJavaScriptIdentifier(route.screen.exportName) ||
71
+ !isSafeJavaScriptIdentifier(hostPort.getPropsExportName)
72
+ ) {
73
+ throw new Error(`Authoring route '${route.id}' has an unsafe screen or host export name.`);
74
+ }
75
+ }
76
+
77
+ /*** Convert a published pathname template to a confined Expo Router-relative TSX path. */
78
+ function getExpoRouterRelativePath(route: AuthoringRouteDeliveryDefinition): string {
79
+ const segments = route.pathPattern.split('/').slice(1);
80
+ const parameters = new Set(route.parameters.map(({ name }) => name));
81
+ const relativeSegments = segments.map((segment) => getExpoRouterSegment(segment, parameters));
82
+ if (relativeSegments.length === 0 || parameters.size !== 0) {
83
+ throw new Error(`Authoring route '${route.id}' has an invalid path parameter declaration.`);
84
+ }
85
+ return `${relativeSegments.join('/')}.tsx`;
86
+ }
87
+
88
+ /*** Validate one path segment before translating a declared parameter to Expo Router syntax. */
89
+ function getExpoRouterSegment(segment: string, parameters: Set<string>): string {
90
+ const parameterName = segment.startsWith(':') ? segment.slice(1) : undefined;
91
+ if (parameterName) {
92
+ if (!parameters.delete(parameterName) || !isSafeRouteParameterName(parameterName)) {
93
+ throw new Error(`Authoring route contains an invalid path parameter '${segment}'.`);
94
+ }
95
+ return `[${parameterName}]`;
96
+ }
97
+ if (!isSafeRouteIdentifier(segment)) {
98
+ throw new Error(`Authoring route contains an unsafe path segment '${segment}'.`);
99
+ }
100
+ return segment;
101
+ }
102
+
103
+ /*** Accept only non-empty route identifiers that cannot escape the generated app directory. */
104
+ function isSafeRouteIdentifier(value: string): boolean {
105
+ return /^[a-z][a-z0-9-]*$/u.test(value);
106
+ }
107
+
108
+ /*** Accept the published camel-case parameter names while retaining single-segment route safety. */
109
+ function isSafeRouteParameterName(value: string): boolean {
110
+ return /^[a-z][A-Za-z0-9]*$/u.test(value);
111
+ }
112
+
113
+ /*** Accept a JavaScript identifier only when it can be inserted into generated import and JSX syntax. */
114
+ function isSafeJavaScriptIdentifier(value: string): boolean {
115
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(value);
116
+ }
117
+
118
+ /*** Derive a stable default-export component name from the generated route filename. */
119
+ function getRouteComponentName(relativePath: string): string {
120
+ return `${relativePath
121
+ .replace(/\.tsx$/u, '')
122
+ .split('/')
123
+ .map((segment) => segment.replace(/\[|\]|-/gu, ''))
124
+ .map((segment) => `${segment.slice(0, 1).toUpperCase()}${segment.slice(1)}`)
125
+ .join('')}Route`;
126
+ }
@@ -0,0 +1,125 @@
1
+ import type { AppManifest } from '@ankhorage/contracts';
2
+ import { expect, test } from 'bun:test';
3
+
4
+ import { resolveExpoRuntimeGeneratedAppSources } from './generatedAppSources';
5
+
6
+ test('emits deterministic Runtime source and Navigator bindings for every referenced manifest screen', () => {
7
+ const manifest = createManifest();
8
+
9
+ const first = resolveExpoRuntimeGeneratedAppSources(manifest, undefined, {
10
+ manifestModuleSpecifier: '../ankh.config.json',
11
+ screenModuleSpecifier: '@/generated/runtimeManifestScreens',
12
+ });
13
+ const second = resolveExpoRuntimeGeneratedAppSources(manifest, undefined, {
14
+ manifestModuleSpecifier: '../ankh.config.json',
15
+ screenModuleSpecifier: '@/generated/runtimeManifestScreens',
16
+ });
17
+
18
+ expect(first).toEqual(second);
19
+ expect(first.diagnostics).toEqual([]);
20
+ expect(first.navigatorBindings).toEqual({
21
+ guards: {},
22
+ screens: {
23
+ detail: {
24
+ exportName: 'ManifestScreen0',
25
+ module: '@/generated/runtimeManifestScreens',
26
+ },
27
+ home: {
28
+ exportName: 'ManifestScreen1',
29
+ module: '@/generated/runtimeManifestScreens',
30
+ },
31
+ },
32
+ });
33
+ expect(first.files).toEqual([
34
+ expect.objectContaining({ relativePath: 'src/generated/runtimeManifestScreens.tsx' }),
35
+ ]);
36
+ expect(first.files[0]?.source).toContain("import { RuntimeScreen } from '@ankhorage/runtime';");
37
+ expect(first.files[0]?.source).toContain('createManifestScreen("detail")');
38
+ expect(first.files[0]?.source).toContain('createManifestScreen("home")');
39
+ });
40
+
41
+ test('fails closed with deterministic diagnostics when Navigator references no manifest screen', () => {
42
+ const manifest = createManifest({ navigatorScreenId: 'missing' });
43
+
44
+ const result = resolveExpoRuntimeGeneratedAppSources(manifest, undefined, {
45
+ manifestModuleSpecifier: '../ankh.config.json',
46
+ screenModuleSpecifier: '@/generated/runtimeManifestScreens',
47
+ });
48
+
49
+ expect(result.diagnostics).toEqual([
50
+ {
51
+ code: 'missing-manifest-screen',
52
+ message:
53
+ "Navigator references manifest screen 'missing', but no matching manifest screen exists.",
54
+ screenId: 'missing',
55
+ severity: 'error',
56
+ },
57
+ ]);
58
+ expect(result.files).toEqual([]);
59
+ expect(result.navigatorBindings).toEqual({ guards: {}, screens: {} });
60
+ });
61
+
62
+ test('reports an invalid caller module binding without emitting a fake Runtime screen', () => {
63
+ const result = resolveExpoRuntimeGeneratedAppSources(createManifest(), undefined, {
64
+ manifestModuleSpecifier: '',
65
+ screenModuleSpecifier: '@/generated/runtimeManifestScreens',
66
+ });
67
+
68
+ expect(result.diagnostics).toEqual([
69
+ {
70
+ code: 'invalid-manifest-module-specifier',
71
+ message: 'manifestModuleSpecifier must be a non-empty static module specifier.',
72
+ severity: 'error',
73
+ },
74
+ ]);
75
+ expect(result.files).toEqual([]);
76
+ });
77
+
78
+ /*** Create the smallest complete manifest needed to exercise generated Runtime screen ownership. */
79
+ function createManifest(options: { readonly navigatorScreenId?: string } = {}): AppManifest {
80
+ const navigatorScreenId = options.navigatorScreenId ?? 'home';
81
+ return {
82
+ activeThemeId: 'default',
83
+ infra: {
84
+ environments: {
85
+ local: {
86
+ deployment: {
87
+ compute: { provider: 'local' },
88
+ runtime: { provider: 'minikube' },
89
+ },
90
+ },
91
+ },
92
+ modules: {},
93
+ },
94
+ metadata: {
95
+ category: 'utilities_tools',
96
+ name: 'Generated app',
97
+ slug: 'generated-app',
98
+ themeId: 'default',
99
+ version: '1.0.0',
100
+ },
101
+ navigator: {
102
+ routes: [
103
+ { name: 'home', screenId: navigatorScreenId },
104
+ {
105
+ name: 'detail',
106
+ navigator: { routes: [{ name: 'detail', screenId: 'detail' }], type: 'stack' },
107
+ },
108
+ ],
109
+ type: 'stack',
110
+ },
111
+ screens: {
112
+ detail: { id: 'detail', name: 'Detail', root: { id: 'detail-root', type: 'Screen' } },
113
+ home: { id: 'home', name: 'Home', root: { id: 'home-root', type: 'Screen' } },
114
+ },
115
+ settings: { localization: { defaultLocale: 'en', locales: ['en'] } },
116
+ themes: {
117
+ default: {
118
+ dark: { harmony: 'analogous', primaryColor: '#000000' },
119
+ id: 'default',
120
+ light: { harmony: 'analogous', primaryColor: '#ffffff' },
121
+ name: 'Default',
122
+ },
123
+ },
124
+ };
125
+ }
@@ -0,0 +1,202 @@
1
+ import type {
2
+ AppManifest,
3
+ NavigatorGenerationBindings,
4
+ NavigatorNode,
5
+ NavigatorScreenModule,
6
+ } from '@ankhorage/contracts';
7
+
8
+ import {
9
+ type ExpoRuntimeGeneratedAppOutputPlan,
10
+ resolveExpoRuntimeGeneratedAppOutput,
11
+ } from './generatedAppOutput';
12
+ import type { ExpoRuntimePlan } from './resolveExpoRuntimePlan';
13
+
14
+ export interface ExpoRuntimeGeneratedAppSourceFile {
15
+ readonly relativePath: string;
16
+ readonly source: string;
17
+ }
18
+
19
+ export interface ExpoRuntimeGeneratedAppSourceDiagnostic {
20
+ readonly code: 'invalid-manifest-module-specifier' | 'missing-manifest-screen';
21
+ readonly severity: 'error';
22
+ readonly screenId?: string;
23
+ readonly message: string;
24
+ }
25
+
26
+ export interface ExpoRuntimeGeneratedAppSources extends ExpoRuntimeGeneratedAppOutputPlan {
27
+ readonly diagnostics: readonly ExpoRuntimeGeneratedAppSourceDiagnostic[];
28
+ readonly files: readonly ExpoRuntimeGeneratedAppSourceFile[];
29
+ readonly navigatorBindings: NavigatorGenerationBindings;
30
+ }
31
+
32
+ export interface ResolveExpoRuntimeGeneratedAppSourcesOptions {
33
+ /** Static module specifier through which the caller exposes its immutable manifest. */
34
+ readonly manifestModuleSpecifier: string;
35
+ /** Static module specifier Navigator uses to import the generated manifest screen exports. */
36
+ readonly screenModuleSpecifier: string;
37
+ }
38
+
39
+ /***
40
+ * Emit the Runtime-owned, filesystem-independent source module and Navigator screen bindings for one manifest.
41
+ *
42
+ * The caller owns manifest materialization and file writes. This boundary intentionally emits no Authoring
43
+ * routes: unresolved `/ankh` routes remain the responsibility of their published owner.
44
+ */
45
+ export function resolveExpoRuntimeGeneratedAppSources(
46
+ manifest: AppManifest,
47
+ runtimePlan: ExpoRuntimePlan | undefined,
48
+ options: ResolveExpoRuntimeGeneratedAppSourcesOptions,
49
+ ): ExpoRuntimeGeneratedAppSources {
50
+ const output = resolveExpoRuntimeGeneratedAppOutput(runtimePlan);
51
+ const diagnostics = collectDiagnostics(manifest, options);
52
+ const screenIds = collectNavigatorScreenIds(manifest.navigator);
53
+ const navigatorBindings = createNavigatorBindings(screenIds, options.screenModuleSpecifier);
54
+
55
+ return {
56
+ ...output,
57
+ diagnostics,
58
+ files:
59
+ diagnostics.length === 0
60
+ ? [
61
+ {
62
+ relativePath: 'src/generated/runtimeManifestScreens.tsx',
63
+ source: createRuntimeManifestScreensSource(manifest, options.manifestModuleSpecifier),
64
+ },
65
+ ]
66
+ : [],
67
+ navigatorBindings: diagnostics.length === 0 ? navigatorBindings : { guards: {}, screens: {} },
68
+ };
69
+ }
70
+
71
+ /*** Collect every manifest screen identity that Navigator can render or reference as a native accessory. */
72
+ function collectNavigatorScreenIds(navigator: NavigatorNode): readonly string[] {
73
+ return Array.from(collectNavigatorScreenIdSet(navigator)).sort();
74
+ }
75
+
76
+ /*** Traverse one navigator subtree without treating unowned Authoring paths as Runtime screens. */
77
+ function collectNavigatorScreenIdSet(navigator: NavigatorNode): ReadonlySet<string> {
78
+ const screenIds = new Set<string>();
79
+ for (const route of navigator.routes) {
80
+ if (route.screenId !== undefined) screenIds.add(route.screenId);
81
+ if (route.navigator !== undefined) {
82
+ for (const screenId of collectNavigatorScreenIdSet(route.navigator)) screenIds.add(screenId);
83
+ }
84
+ }
85
+ if (navigator.type === 'split-view') {
86
+ screenIds.add(navigator.columns.primary.screenId);
87
+ if (navigator.columns.supplementary !== undefined) {
88
+ screenIds.add(navigator.columns.supplementary.screenId);
89
+ }
90
+ if (navigator.inspector !== undefined) screenIds.add(navigator.inspector.screenId);
91
+ }
92
+ if (navigator.type === 'tabs' && navigator.implementation === 'native') {
93
+ if (navigator.bottomAccessory !== undefined) screenIds.add(navigator.bottomAccessory.screenId);
94
+ }
95
+ return screenIds;
96
+ }
97
+
98
+ /*** Report invalid caller module bindings and every Navigator screen that the manifest does not define. */
99
+ function collectDiagnostics(
100
+ manifest: AppManifest,
101
+ options: ResolveExpoRuntimeGeneratedAppSourcesOptions,
102
+ ): readonly ExpoRuntimeGeneratedAppSourceDiagnostic[] {
103
+ const invalidSpecifierDiagnostics: ExpoRuntimeGeneratedAppSourceDiagnostic[] = [
104
+ ['manifestModuleSpecifier', options.manifestModuleSpecifier] as const,
105
+ ['screenModuleSpecifier', options.screenModuleSpecifier] as const,
106
+ ].flatMap(([name, value]) =>
107
+ isStaticModuleSpecifier(value)
108
+ ? []
109
+ : [
110
+ {
111
+ code: 'invalid-manifest-module-specifier',
112
+ severity: 'error',
113
+ message: `${name} must be a non-empty static module specifier.`,
114
+ } satisfies ExpoRuntimeGeneratedAppSourceDiagnostic,
115
+ ],
116
+ );
117
+ const missingScreenDiagnostics: ExpoRuntimeGeneratedAppSourceDiagnostic[] =
118
+ collectNavigatorScreenIds(manifest.navigator)
119
+ .filter((screenId) => !Object.hasOwn(manifest.screens, screenId))
120
+ .map(
121
+ (screenId) =>
122
+ ({
123
+ code: 'missing-manifest-screen',
124
+ severity: 'error',
125
+ screenId,
126
+ message: `Navigator references manifest screen '${screenId}', but no matching manifest screen exists.`,
127
+ }) satisfies ExpoRuntimeGeneratedAppSourceDiagnostic,
128
+ );
129
+ return [...invalidSpecifierDiagnostics, ...missingScreenDiagnostics].sort((left, right) =>
130
+ `${left.code}\0${left.screenId ?? ''}\0${left.message}`.localeCompare(
131
+ `${right.code}\0${right.screenId ?? ''}\0${right.message}`,
132
+ ),
133
+ );
134
+ }
135
+
136
+ /*** Keep generated static imports safe without imposing a filesystem layout on the caller. */
137
+ function isStaticModuleSpecifier(value: string): boolean {
138
+ return (
139
+ value.trim().length > 0 &&
140
+ Array.from(value).every(
141
+ (character) => character.charCodeAt(0) >= 32 && !["'", '"', '`', '\\'].includes(character),
142
+ )
143
+ );
144
+ }
145
+
146
+ /*** Map each actual Navigator screen identity onto a stable named export in the generated Runtime module. */
147
+ function createNavigatorBindings(
148
+ screenIds: readonly string[],
149
+ screenModuleSpecifier: string,
150
+ ): NavigatorGenerationBindings {
151
+ return {
152
+ guards: {},
153
+ screens: Object.fromEntries(
154
+ screenIds.map((screenId, index) => [
155
+ screenId,
156
+ {
157
+ module: screenModuleSpecifier,
158
+ exportName: getManifestScreenExportName(index),
159
+ } satisfies NavigatorScreenModule,
160
+ ]),
161
+ ),
162
+ };
163
+ }
164
+
165
+ /*** Produce a safe export name independently of user-authored screen identifiers. */
166
+ function getManifestScreenExportName(index: number): string {
167
+ return `ManifestScreen${index}`;
168
+ }
169
+
170
+ /*** Render the one Runtime-owned module whose exports bind Navigator routes to actual manifest screens. */
171
+ function createRuntimeManifestScreensSource(
172
+ manifest: AppManifest,
173
+ manifestModuleSpecifier: string,
174
+ ): string {
175
+ const screenIds = collectNavigatorScreenIds(manifest.navigator);
176
+ const exports = screenIds
177
+ .map(
178
+ (screenId, index) =>
179
+ `export const ${getManifestScreenExportName(index)} = createManifestScreen(${JSON.stringify(screenId)});`,
180
+ )
181
+ .join('\n');
182
+ return `import type { AppManifest } from '@ankhorage/contracts';
183
+ import { RuntimeScreen } from '@ankhorage/runtime';
184
+ import { createZoraComponentRegistry } from '@ankhorage/zora';
185
+ import runtimeManifest from ${JSON.stringify(manifestModuleSpecifier)};
186
+
187
+ const manifest = runtimeManifest as AppManifest;
188
+ const registry = createZoraComponentRegistry();
189
+
190
+ function createManifestScreen(screenId: string) {
191
+ const screen = manifest.screens[screenId];
192
+ if (screen === undefined) {
193
+ throw new Error(\`Generated Runtime screen binding is missing manifest screen '\${screenId}'.\`);
194
+ }
195
+ return function ManifestScreen() {
196
+ return <RuntimeScreen manifest={manifest} registry={registry} screen={screen} />;
197
+ };
198
+ }
199
+
200
+ ${exports}
201
+ `;
202
+ }
package/src/index.ts CHANGED
@@ -51,6 +51,13 @@ export {
51
51
  resolveExpoRuntimeGeneratedAppOutput,
52
52
  resolveExpoRuntimeNativeOutput,
53
53
  } from './generatedAppOutput';
54
+ export {
55
+ type ExpoRuntimeGeneratedAppSourceDiagnostic,
56
+ type ExpoRuntimeGeneratedAppSourceFile,
57
+ type ExpoRuntimeGeneratedAppSources,
58
+ resolveExpoRuntimeGeneratedAppSources,
59
+ type ResolveExpoRuntimeGeneratedAppSourcesOptions,
60
+ } from './generatedAppSources';
54
61
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
55
62
  export {
56
63
  type ExpoRuntimeLayoutIntegrationPlan,
@@ -62,3 +69,9 @@ export type {
62
69
  ExpoRuntimeProviderId,
63
70
  } from './resolveExpoRuntimePlan';
64
71
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
72
+ export {
73
+ type ExpoAuthoringRouteFile,
74
+ type ExpoAuthoringRouteHostPort,
75
+ type ExpoAuthoringRouteHostPorts,
76
+ getExpoAuthoringRouteFiles,
77
+ } from './routeDelivery';
@@ -0,0 +1,6 @@
1
+ export { getExpoAuthoringRouteFiles } from './features/navigation/getExpoAuthoringRouteFiles';
2
+ export type {
3
+ ExpoAuthoringRouteFile,
4
+ ExpoAuthoringRouteHostPort,
5
+ ExpoAuthoringRouteHostPorts,
6
+ } from './types/expoAuthoringRouteDelivery';
@@ -0,0 +1,19 @@
1
+ import type { AnkhRouteId, AuthoringRouteDeliveryDefinition } from '@ankhorage/studio-authoring';
2
+
3
+ /*** Describe the host-owned props factory that composes one portable Authoring screen. */
4
+ export interface ExpoAuthoringRouteHostPort {
5
+ readonly getPropsExportName: string;
6
+ readonly moduleSpecifier: string;
7
+ }
8
+
9
+ /*** Supply every host composition port needed by the available Authoring screen routes. */
10
+ export type ExpoAuthoringRouteHostPorts = Readonly<
11
+ Partial<Record<AnkhRouteId, ExpoAuthoringRouteHostPort>>
12
+ >;
13
+
14
+ /*** Record one deterministic Expo Router file without performing filesystem I/O. */
15
+ export interface ExpoAuthoringRouteFile {
16
+ readonly relativePath: string;
17
+ readonly route: AuthoringRouteDeliveryDefinition;
18
+ readonly source: string;
19
+ }