@ankhorage/expo-runtime 7.1.0 → 7.2.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,11 @@
1
1
  # @ankhorage/expo-runtime
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3a2aec5: Expose deterministic Expo Router files for published Authoring screen routes with explicit host composition ports.
8
+
3
9
  ## 7.1.0
4
10
 
5
11
  ### 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.2.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,CAAC,CAAC;IACrC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,CAAC,EAAE,+CAA+C,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K,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"]}
package/dist/index.d.ts CHANGED
@@ -14,4 +14,5 @@ export { getExpoBarcodeScannerViewSource } from './generatedSources';
14
14
  export { type ExpoRuntimeLayoutIntegrationPlan, resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
15
15
  export type { ExpoRuntimeAdapterId, ExpoRuntimePlan, ExpoRuntimeProviderId, } from './resolveExpoRuntimePlan';
16
16
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
17
+ export { type ExpoAuthoringRouteFile, type ExpoAuthoringRouteHostPort, type ExpoAuthoringRouteHostPorts, getExpoAuthoringRouteFiles, } from './routeDelivery';
17
18
  //# 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,yBAAyB,EACzB,KAAK,8BAA8B,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EACL,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL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;AACxE,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,GACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EACL,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,0BAA0B,EAC/B,6BAA6B,GAC9B,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,oCAAoC,EACpC,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EACL,KAAK,gCAAgC,EACrC,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -12,4 +12,5 @@ export { resolveExpoRuntimeConfigPluginOutput, resolveExpoRuntimeDependencyMap,
12
12
  export { getExpoBarcodeScannerViewSource } from './generatedSources';
13
13
  export { resolveExpoRuntimeLayoutIntegration, } from './layoutIntegrationPlanning';
14
14
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
15
+ export { getExpoAuthoringRouteFiles, } from './routeDelivery';
15
16
  //# 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,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 { 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.2.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,13 @@
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
+ },
70
77
  "./platform": {
71
78
  "react-native": "./src/platform.ts",
72
79
  "browser": "./src/platform.ts",
@@ -176,6 +183,7 @@
176
183
  "test": "bun test src",
177
184
  "typecheck": "bun x tsc --noEmit -p tsconfig.json && bun x tsc --noEmit -p tsconfig.scripts.json",
178
185
  "validate:action-bridge": "bun scripts/actionBridgeAcceptance.ts",
186
+ "validate:authoring-route-delivery": "bun scripts/authoringRouteDeliveryAcceptance.ts",
179
187
  "validate:expo-platform": "bun scripts/validateExpoPlatform.ts",
180
188
  "validate:headless-platform": "bun scripts/headlessPlatformAcceptance.ts",
181
189
  "validate:icon-fonts-web": "bun scripts/iconFontWebAcceptance.ts",
@@ -185,7 +193,7 @@
185
193
  },
186
194
  "peerDependencies": {
187
195
  "@ankhorage/permissions": "^0.2.63",
188
- "@ankhorage/zora": "^25.8.3",
196
+ "@ankhorage/zora": "^25.8.3 || ^27.2.0",
189
197
  "@react-native-vector-icons/fontawesome": "^13.1.4",
190
198
  "@react-native-vector-icons/fontawesome5": "^13.1.4",
191
199
  "@react-native-vector-icons/fontawesome6": "^13.1.4",
@@ -252,10 +260,10 @@
252
260
  }
253
261
  },
254
262
  "devDependencies": {
255
- "@ankhorage/devtools": "^2.3.47",
263
+ "@ankhorage/devtools": "^2.10.1",
256
264
  "@ankhorage/paradox": "^0.2.27",
257
265
  "@ankhorage/permissions": "^0.2.63",
258
- "@ankhorage/zora": "^25.8.3",
266
+ "@ankhorage/zora": "^25.8.3 || ^27.2.0",
259
267
  "@react-native-vector-icons/fontawesome": "^13.1.4",
260
268
  "@react-native-vector-icons/fontawesome5": "^13.1.4",
261
269
  "@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
+ }
package/src/index.ts CHANGED
@@ -62,3 +62,9 @@ export type {
62
62
  ExpoRuntimeProviderId,
63
63
  } from './resolveExpoRuntimePlan';
64
64
  export { resolveExpoRuntimePlan } from './resolveExpoRuntimePlan';
65
+ export {
66
+ type ExpoAuthoringRouteFile,
67
+ type ExpoAuthoringRouteHostPort,
68
+ type ExpoAuthoringRouteHostPorts,
69
+ getExpoAuthoringRouteFiles,
70
+ } 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
+ }