@ankhorage/studio 0.0.21 → 0.1.1
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/README.md +1 -2
- package/dist/cli/index.d.ts +4 -4
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +81 -66
- package/dist/cli/index.js.map +1 -1
- package/dist/hooks/useProjects.js +1 -1
- package/dist/hooks/useProjects.js.map +1 -1
- package/dist/host/createStudioHost.d.ts +13 -0
- package/dist/host/createStudioHost.d.ts.map +1 -0
- package/dist/host/createStudioHost.js +16 -0
- package/dist/host/createStudioHost.js.map +1 -0
- package/dist/host/http/security.d.ts +2 -0
- package/dist/host/http/security.d.ts.map +1 -0
- package/dist/host/http/security.js +55 -0
- package/dist/host/http/security.js.map +1 -0
- package/dist/host/http/server.d.ts +16 -0
- package/dist/host/http/server.d.ts.map +1 -0
- package/dist/host/http/server.js +549 -0
- package/dist/host/http/server.js.map +1 -0
- package/dist/host/index.d.ts +10 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +10 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/layout/auth/resolveAuthLayoutPlan.d.ts +38 -0
- package/dist/host/layout/auth/resolveAuthLayoutPlan.d.ts.map +1 -0
- package/dist/host/layout/auth/resolveAuthLayoutPlan.js +262 -0
- package/dist/host/layout/auth/resolveAuthLayoutPlan.js.map +1 -0
- package/dist/host/layout/layoutGenerator.d.ts +19 -0
- package/dist/host/layout/layoutGenerator.d.ts.map +1 -0
- package/dist/host/layout/layoutGenerator.js +418 -0
- package/dist/host/layout/layoutGenerator.js.map +1 -0
- package/dist/host/layout/templates/auth/adapter.d.ts +6 -0
- package/dist/host/layout/templates/auth/adapter.d.ts.map +1 -0
- package/dist/host/layout/templates/auth/adapter.js +94 -0
- package/dist/host/layout/templates/auth/adapter.js.map +1 -0
- package/dist/host/layout/templates/auth/screen.d.ts +12 -0
- package/dist/host/layout/templates/auth/screen.d.ts.map +1 -0
- package/dist/host/layout/templates/auth/screen.js +648 -0
- package/dist/host/layout/templates/auth/screen.js.map +1 -0
- package/dist/host/layout/templates/auth/session.d.ts +2 -0
- package/dist/host/layout/templates/auth/session.d.ts.map +1 -0
- package/dist/host/layout/templates/auth/session.js +326 -0
- package/dist/host/layout/templates/auth/session.js.map +1 -0
- package/dist/host/layout/templates/auth/signOut.d.ts +2 -0
- package/dist/host/layout/templates/auth/signOut.d.ts.map +1 -0
- package/dist/host/layout/templates/auth/signOut.js +43 -0
- package/dist/host/layout/templates/auth/signOut.js.map +1 -0
- package/dist/host/layout/templates/index.d.ts +11 -0
- package/dist/host/layout/templates/index.d.ts.map +1 -0
- package/dist/host/layout/templates/index.js +10 -0
- package/dist/host/layout/templates/index.js.map +1 -0
- package/dist/host/layout/templates/navigation.d.ts +16 -0
- package/dist/host/layout/templates/navigation.d.ts.map +1 -0
- package/dist/host/layout/templates/navigation.js +332 -0
- package/dist/host/layout/templates/navigation.js.map +1 -0
- package/dist/host/layout/templates/nestedLayout.d.ts +7 -0
- package/dist/host/layout/templates/nestedLayout.d.ts.map +1 -0
- package/dist/host/layout/templates/nestedLayout.js +56 -0
- package/dist/host/layout/templates/nestedLayout.js.map +1 -0
- package/dist/host/layout/templates/redirect.d.ts +2 -0
- package/dist/host/layout/templates/redirect.d.ts.map +1 -0
- package/dist/host/layout/templates/redirect.js +10 -0
- package/dist/host/layout/templates/redirect.js.map +1 -0
- package/dist/host/layout/templates/rootLayout.d.ts +28 -0
- package/dist/host/layout/templates/rootLayout.d.ts.map +1 -0
- package/dist/host/layout/templates/rootLayout.js +507 -0
- package/dist/host/layout/templates/rootLayout.js.map +1 -0
- package/dist/host/layout/templates/screen.d.ts +6 -0
- package/dist/host/layout/templates/screen.d.ts.map +1 -0
- package/dist/host/layout/templates/screen.js +94 -0
- package/dist/host/layout/templates/screen.js.map +1 -0
- package/dist/host/layout/templates/utils/routes.d.ts +3 -0
- package/dist/host/layout/templates/utils/routes.d.ts.map +1 -0
- package/dist/host/layout/templates/utils/routes.js +15 -0
- package/dist/host/layout/templates/utils/routes.js.map +1 -0
- package/dist/host/layout/templates/utils/strings.d.ts +3 -0
- package/dist/host/layout/templates/utils/strings.d.ts.map +1 -0
- package/dist/host/layout/templates/utils/strings.js +7 -0
- package/dist/host/layout/templates/utils/strings.js.map +1 -0
- package/dist/host/layout/utils/escapeStringLiteral.d.ts +2 -0
- package/dist/host/layout/utils/escapeStringLiteral.d.ts.map +1 -0
- package/dist/host/layout/utils/escapeStringLiteral.js +8 -0
- package/dist/host/layout/utils/escapeStringLiteral.js.map +1 -0
- package/dist/host/manifestSystem/auth/index.d.ts +2 -0
- package/dist/host/manifestSystem/auth/index.d.ts.map +1 -0
- package/dist/host/manifestSystem/auth/index.js +2 -0
- package/dist/host/manifestSystem/auth/index.js.map +1 -0
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.d.ts +4 -0
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.d.ts.map +1 -0
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.js +7 -0
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.js.map +1 -0
- package/dist/host/manifestSystem/auth/shared/index.d.ts +3 -0
- package/dist/host/manifestSystem/auth/shared/index.d.ts.map +1 -0
- package/dist/host/manifestSystem/auth/shared/index.js +8 -0
- package/dist/host/manifestSystem/auth/shared/index.js.map +1 -0
- package/dist/host/manifestSystem/index.d.ts +5 -0
- package/dist/host/manifestSystem/index.d.ts.map +1 -0
- package/dist/host/manifestSystem/index.js +23 -0
- package/dist/host/manifestSystem/index.js.map +1 -0
- package/dist/host/manifestSystem/types.d.ts +8 -0
- package/dist/host/manifestSystem/types.d.ts.map +1 -0
- package/dist/host/manifestSystem/types.js +2 -0
- package/dist/host/manifestSystem/types.js.map +1 -0
- package/dist/host/modules/catalog.d.ts +40 -0
- package/dist/host/modules/catalog.d.ts.map +1 -0
- package/dist/host/modules/catalog.js +112 -0
- package/dist/host/modules/catalog.js.map +1 -0
- package/dist/host/modules/layout.d.ts +7 -0
- package/dist/host/modules/layout.d.ts.map +1 -0
- package/dist/host/modules/layout.js +2 -0
- package/dist/host/modules/layout.js.map +1 -0
- package/dist/host/modules/runtime/LocalFsTargetAdapter.d.ts +34 -0
- package/dist/host/modules/runtime/LocalFsTargetAdapter.d.ts.map +1 -0
- package/dist/host/modules/runtime/LocalFsTargetAdapter.js +85 -0
- package/dist/host/modules/runtime/LocalFsTargetAdapter.js.map +1 -0
- package/dist/host/orchestrator/generatedAppFiles.d.ts +8 -0
- package/dist/host/orchestrator/generatedAppFiles.d.ts.map +1 -0
- package/dist/host/orchestrator/generatedAppFiles.js +125 -0
- package/dist/host/orchestrator/generatedAppFiles.js.map +1 -0
- package/dist/host/orchestrator/generatedRouteCleanup.d.ts +5 -0
- package/dist/host/orchestrator/generatedRouteCleanup.d.ts.map +1 -0
- package/dist/host/orchestrator/generatedRouteCleanup.js +117 -0
- package/dist/host/orchestrator/generatedRouteCleanup.js.map +1 -0
- package/dist/host/orchestrator/infraGenerator.d.ts +35 -0
- package/dist/host/orchestrator/infraGenerator.d.ts.map +1 -0
- package/dist/host/orchestrator/infraGenerator.js +135 -0
- package/dist/host/orchestrator/infraGenerator.js.map +1 -0
- package/dist/host/orchestrator/infraRuntime.d.ts +38 -0
- package/dist/host/orchestrator/infraRuntime.d.ts.map +1 -0
- package/dist/host/orchestrator/infraRuntime.js +227 -0
- package/dist/host/orchestrator/infraRuntime.js.map +1 -0
- package/dist/host/orchestrator/infraValidation.d.ts +3 -0
- package/dist/host/orchestrator/infraValidation.d.ts.map +1 -0
- package/dist/host/orchestrator/infraValidation.js +59 -0
- package/dist/host/orchestrator/infraValidation.js.map +1 -0
- package/dist/host/orchestrator/moduleManager.d.ts +86 -0
- package/dist/host/orchestrator/moduleManager.d.ts.map +1 -0
- package/dist/host/orchestrator/moduleManager.js +312 -0
- package/dist/host/orchestrator/moduleManager.js.map +1 -0
- package/dist/host/orchestrator/projectDeletion.d.ts +27 -0
- package/dist/host/orchestrator/projectDeletion.d.ts.map +1 -0
- package/dist/host/orchestrator/projectDeletion.js +242 -0
- package/dist/host/orchestrator/projectDeletion.js.map +1 -0
- package/dist/host/orchestrator/projectManager.d.ts +87 -0
- package/dist/host/orchestrator/projectManager.d.ts.map +1 -0
- package/dist/host/orchestrator/projectManager.js +371 -0
- package/dist/host/orchestrator/projectManager.js.map +1 -0
- package/dist/host/orchestrator/projectPaths.d.ts +4 -0
- package/dist/host/orchestrator/projectPaths.d.ts.map +1 -0
- package/dist/host/orchestrator/projectPaths.js +25 -0
- package/dist/host/orchestrator/projectPaths.js.map +1 -0
- package/dist/host/orchestrator/projectStore.d.ts +24 -0
- package/dist/host/orchestrator/projectStore.d.ts.map +1 -0
- package/dist/host/orchestrator/projectStore.js +155 -0
- package/dist/host/orchestrator/projectStore.js.map +1 -0
- package/dist/host/orchestrator/resolveMutations.d.ts +3 -0
- package/dist/host/orchestrator/resolveMutations.d.ts.map +1 -0
- package/dist/host/orchestrator/resolveMutations.js +12 -0
- package/dist/host/orchestrator/resolveMutations.js.map +1 -0
- package/dist/host/orchestrator/scaffolder.d.ts +33 -0
- package/dist/host/orchestrator/scaffolder.d.ts.map +1 -0
- package/dist/host/orchestrator/scaffolder.js +246 -0
- package/dist/host/orchestrator/scaffolder.js.map +1 -0
- package/dist/host/orchestrator/templates.d.ts +83 -0
- package/dist/host/orchestrator/templates.d.ts.map +1 -0
- package/dist/host/orchestrator/templates.js +355 -0
- package/dist/host/orchestrator/templates.js.map +1 -0
- package/dist/host/orchestrator/workspaceRuntime.d.ts +2 -0
- package/dist/host/orchestrator/workspaceRuntime.d.ts.map +1 -0
- package/dist/host/orchestrator/workspaceRuntime.js +82 -0
- package/dist/host/orchestrator/workspaceRuntime.js.map +1 -0
- package/dist/host/templateRegistry/index.d.ts +16 -0
- package/dist/host/templateRegistry/index.d.ts.map +1 -0
- package/dist/host/templateRegistry/index.js +74 -0
- package/dist/host/templateRegistry/index.js.map +1 -0
- package/dist/host/utils/requirementsInference.d.ts +4 -0
- package/dist/host/utils/requirementsInference.d.ts.map +1 -0
- package/dist/host/utils/requirementsInference.js +49 -0
- package/dist/host/utils/requirementsInference.js.map +1 -0
- package/dist/host/utils/trimOutput.d.ts +7 -0
- package/dist/host/utils/trimOutput.d.ts.map +1 -0
- package/dist/host/utils/trimOutput.js +32 -0
- package/dist/host/utils/trimOutput.js.map +1 -0
- package/dist/host/utils/workspaceRoot.d.ts +2 -0
- package/dist/host/utils/workspaceRoot.d.ts.map +1 -0
- package/dist/host/utils/workspaceRoot.js +33 -0
- package/dist/host/utils/workspaceRoot.js.map +1 -0
- package/dist/host/zoraExtensions/index.d.ts +11 -0
- package/dist/host/zoraExtensions/index.d.ts.map +1 -0
- package/dist/host/zoraExtensions/index.js +54 -0
- package/dist/host/zoraExtensions/index.js.map +1 -0
- package/dist/root.d.ts +3 -0
- package/dist/root.d.ts.map +1 -0
- package/dist/root.js +3 -0
- package/dist/root.js.map +1 -0
- package/package.json +16 -3
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { resolveExpoRuntimeDependencyMap, resolveExpoRuntimeNativeOutput, } from '@ankhorage/expo-runtime/planning';
|
|
2
|
+
const EXPO_MODULES_CORE_VERSION = '~3.0.30';
|
|
3
|
+
const RESERVED_NATIVE_IDENTIFIER_SEGMENTS = new Set([
|
|
4
|
+
'abstract',
|
|
5
|
+
'annotation',
|
|
6
|
+
'as',
|
|
7
|
+
'break',
|
|
8
|
+
'byte',
|
|
9
|
+
'case',
|
|
10
|
+
'catch',
|
|
11
|
+
'char',
|
|
12
|
+
'class',
|
|
13
|
+
'companion',
|
|
14
|
+
'const',
|
|
15
|
+
'continue',
|
|
16
|
+
'data',
|
|
17
|
+
'do',
|
|
18
|
+
'double',
|
|
19
|
+
'else',
|
|
20
|
+
'enum',
|
|
21
|
+
'extends',
|
|
22
|
+
'false',
|
|
23
|
+
'final',
|
|
24
|
+
'finally',
|
|
25
|
+
'float',
|
|
26
|
+
'for',
|
|
27
|
+
'fun',
|
|
28
|
+
'if',
|
|
29
|
+
'implements',
|
|
30
|
+
'import',
|
|
31
|
+
'in',
|
|
32
|
+
'int',
|
|
33
|
+
'interface',
|
|
34
|
+
'internal',
|
|
35
|
+
'is',
|
|
36
|
+
'long',
|
|
37
|
+
'native',
|
|
38
|
+
'new',
|
|
39
|
+
'null',
|
|
40
|
+
'object',
|
|
41
|
+
'open',
|
|
42
|
+
'operator',
|
|
43
|
+
'out',
|
|
44
|
+
'override',
|
|
45
|
+
'package',
|
|
46
|
+
'private',
|
|
47
|
+
'protected',
|
|
48
|
+
'public',
|
|
49
|
+
'return',
|
|
50
|
+
'sealed',
|
|
51
|
+
'short',
|
|
52
|
+
'static',
|
|
53
|
+
'strictfp',
|
|
54
|
+
'super',
|
|
55
|
+
'suspend',
|
|
56
|
+
'switch',
|
|
57
|
+
'synchronized',
|
|
58
|
+
'this',
|
|
59
|
+
'throw',
|
|
60
|
+
'throws',
|
|
61
|
+
'transient',
|
|
62
|
+
'true',
|
|
63
|
+
'try',
|
|
64
|
+
'typealias',
|
|
65
|
+
'typeof',
|
|
66
|
+
'val',
|
|
67
|
+
'var',
|
|
68
|
+
'void',
|
|
69
|
+
'volatile',
|
|
70
|
+
'when',
|
|
71
|
+
'while',
|
|
72
|
+
].map((segment) => segment.toLowerCase()));
|
|
73
|
+
function serializeStringLiteral(value) {
|
|
74
|
+
return `'${value
|
|
75
|
+
.replaceAll('\\', '\\\\')
|
|
76
|
+
.replaceAll("'", "\\'")
|
|
77
|
+
.replaceAll('\n', '\\n')
|
|
78
|
+
.replaceAll('\r', '\\r')}'`;
|
|
79
|
+
}
|
|
80
|
+
function serializeJsValue(value, indentLevel = 0) {
|
|
81
|
+
const indent = ' '.repeat(indentLevel);
|
|
82
|
+
const nextIndent = ' '.repeat(indentLevel + 1);
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
if (value.length === 0) {
|
|
85
|
+
return '[]';
|
|
86
|
+
}
|
|
87
|
+
if (value.every((entry) => ['string', 'number', 'boolean'].includes(typeof entry)) &&
|
|
88
|
+
value.length <= 3) {
|
|
89
|
+
return `[${value.map((entry) => serializeJsValue(entry)).join(', ')}]`;
|
|
90
|
+
}
|
|
91
|
+
return `[\n${value
|
|
92
|
+
.map((entry) => `${nextIndent}${serializeJsValue(entry, indentLevel + 1)}`)
|
|
93
|
+
.join(',\n')}\n${indent}]`;
|
|
94
|
+
}
|
|
95
|
+
if (value && typeof value === 'object') {
|
|
96
|
+
const entries = Object.entries(value);
|
|
97
|
+
if (entries.length === 0) {
|
|
98
|
+
return '{}';
|
|
99
|
+
}
|
|
100
|
+
return `{\n${entries
|
|
101
|
+
.map(([key, entryValue]) => {
|
|
102
|
+
const serializedKey = /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(key) ? key : JSON.stringify(key);
|
|
103
|
+
return `${nextIndent}${serializedKey}: ${serializeJsValue(entryValue, indentLevel + 1)}`;
|
|
104
|
+
})
|
|
105
|
+
.join(',\n')},\n${indent}}`;
|
|
106
|
+
}
|
|
107
|
+
if (typeof value === 'string') {
|
|
108
|
+
return serializeStringLiteral(value);
|
|
109
|
+
}
|
|
110
|
+
return String(value);
|
|
111
|
+
}
|
|
112
|
+
function serializeSplashScreenPlugin(splashScreen) {
|
|
113
|
+
if (splashScreen == null) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
const serializedConfig = serializeJsValue(splashScreen, 3);
|
|
117
|
+
return `[
|
|
118
|
+
'expo-splash-screen',
|
|
119
|
+
${serializedConfig},
|
|
120
|
+
]`;
|
|
121
|
+
}
|
|
122
|
+
function serializeRuntimePlugin(plugin) {
|
|
123
|
+
if (typeof plugin === 'string') {
|
|
124
|
+
return serializeJsValue(plugin);
|
|
125
|
+
}
|
|
126
|
+
const [name, options] = plugin;
|
|
127
|
+
const serializedOptions = serializeJsValue(options, 3);
|
|
128
|
+
return `[
|
|
129
|
+
${serializeJsValue(name)},
|
|
130
|
+
${serializedOptions},
|
|
131
|
+
]`;
|
|
132
|
+
}
|
|
133
|
+
function serializePluginsWithRuntimePlan(args) {
|
|
134
|
+
const entries = resolveExpoRuntimeNativeOutput(args.runtimePlan).configPlugins.map(serializeRuntimePlugin);
|
|
135
|
+
const splashPlugin = serializeSplashScreenPlugin(args.splashScreen);
|
|
136
|
+
if (splashPlugin !== null) {
|
|
137
|
+
entries.push(splashPlugin);
|
|
138
|
+
}
|
|
139
|
+
if (entries.length === 0) {
|
|
140
|
+
return '[...(config.plugins ?? [])]';
|
|
141
|
+
}
|
|
142
|
+
return `[
|
|
143
|
+
...(config.plugins ?? []),
|
|
144
|
+
${entries.join(',\n ')},
|
|
145
|
+
]`;
|
|
146
|
+
}
|
|
147
|
+
function createNativeIdentifierSegment(bundleSuffix) {
|
|
148
|
+
const sanitized = bundleSuffix.replace(/[^A-Za-z0-9_]/g, '').toLowerCase();
|
|
149
|
+
const ensuredValue = sanitized.length > 0 ? sanitized : 'app';
|
|
150
|
+
const leadingLetterSegment = /^[a-z]/u.test(ensuredValue) ? ensuredValue : `app${ensuredValue}`;
|
|
151
|
+
return RESERVED_NATIVE_IDENTIFIER_SEGMENTS.has(leadingLetterSegment)
|
|
152
|
+
? `app${leadingLetterSegment}`
|
|
153
|
+
: leadingLetterSegment;
|
|
154
|
+
}
|
|
155
|
+
function createNativeApplicationId(bundleSuffix) {
|
|
156
|
+
return `com.ankh.${createNativeIdentifierSegment(bundleSuffix)}`;
|
|
157
|
+
}
|
|
158
|
+
function createExpoScheme(bundleSuffix) {
|
|
159
|
+
const identitySegment = createNativeIdentifierSegment(bundleSuffix).replaceAll('_', '') || 'app';
|
|
160
|
+
return `ankh-${identitySegment}`;
|
|
161
|
+
}
|
|
162
|
+
function serializeAndroidConfig(args) {
|
|
163
|
+
const permissions = resolveExpoRuntimeNativeOutput(args.runtimePlan).androidPermissions;
|
|
164
|
+
const extraLines = permissions.length > 0 ? `\n permissions: ${serializeJsValue(permissions, 2)},` : '';
|
|
165
|
+
return `{
|
|
166
|
+
...config.android,${extraLines}
|
|
167
|
+
package: ${serializeStringLiteral(createNativeApplicationId(args.bundleSuffix))},
|
|
168
|
+
}`;
|
|
169
|
+
}
|
|
170
|
+
export function getAppConfigTs({ name, slug, bundleSuffix, splashScreen = null, runtimePlan, }) {
|
|
171
|
+
const appConfigTs = `import type { ConfigContext, ExpoConfig } from 'expo/config';
|
|
172
|
+
|
|
173
|
+
export default ({ config }: ConfigContext): ExpoConfig => ({
|
|
174
|
+
...config,
|
|
175
|
+
name: ${serializeStringLiteral(name)},
|
|
176
|
+
slug: ${serializeStringLiteral(slug)},
|
|
177
|
+
scheme: ${serializeStringLiteral(createExpoScheme(bundleSuffix))},
|
|
178
|
+
plugins: ${serializePluginsWithRuntimePlan({ splashScreen, runtimePlan })},
|
|
179
|
+
android: ${serializeAndroidConfig({ bundleSuffix, runtimePlan })},
|
|
180
|
+
ios: {
|
|
181
|
+
...config.ios,
|
|
182
|
+
bundleIdentifier: ${serializeStringLiteral(createNativeApplicationId(bundleSuffix))},
|
|
183
|
+
},
|
|
184
|
+
web: {
|
|
185
|
+
...config.web,
|
|
186
|
+
output: 'static',
|
|
187
|
+
favicon: './assets/favicon.png',
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
`;
|
|
191
|
+
return appConfigTs;
|
|
192
|
+
}
|
|
193
|
+
export function getMetroConfigJs() {
|
|
194
|
+
const metroConfigJs = `const { getDefaultConfig } = require('expo/metro-config');
|
|
195
|
+
|
|
196
|
+
module.exports = getDefaultConfig(__dirname);
|
|
197
|
+
`;
|
|
198
|
+
return metroConfigJs;
|
|
199
|
+
}
|
|
200
|
+
export function getBabelConfigJs() {
|
|
201
|
+
return `module.exports = function (api) {
|
|
202
|
+
api.cache(true);
|
|
203
|
+
|
|
204
|
+
return {
|
|
205
|
+
presets: ['babel-preset-expo'],
|
|
206
|
+
plugins: [
|
|
207
|
+
[
|
|
208
|
+
'module-resolver',
|
|
209
|
+
{
|
|
210
|
+
root: ['./src'],
|
|
211
|
+
alias: {
|
|
212
|
+
'@': './src',
|
|
213
|
+
'@root': './',
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
'react-native-reanimated/plugin',
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
`;
|
|
222
|
+
}
|
|
223
|
+
export function getPackageJson(args) {
|
|
224
|
+
const { name, includeStudio = false, authProvider = null, storageProvider = null, runtimePlan, } = args;
|
|
225
|
+
const runtimeDependencies = resolveExpoRuntimeDependencyMap(runtimePlan);
|
|
226
|
+
const pkgJson = {
|
|
227
|
+
name,
|
|
228
|
+
main: 'index.js',
|
|
229
|
+
packageManager: 'bun@1.3.13',
|
|
230
|
+
version: '1.0.0',
|
|
231
|
+
scripts: {
|
|
232
|
+
start: 'expo start',
|
|
233
|
+
android: 'expo run:android',
|
|
234
|
+
ios: 'expo run:ios',
|
|
235
|
+
web: 'expo start --web',
|
|
236
|
+
lint: 'ankhorage-eslint . --max-warnings=0',
|
|
237
|
+
'lint:fix': 'ankhorage-eslint . --fix --max-warnings=0',
|
|
238
|
+
format: 'ankhorage-prettier --write .',
|
|
239
|
+
'format:check': 'ankhorage-prettier --check .',
|
|
240
|
+
},
|
|
241
|
+
dependencies: {
|
|
242
|
+
'@ankhorage/contracts': 'latest',
|
|
243
|
+
'@ankhorage/data-sources': 'latest',
|
|
244
|
+
'@ankhorage/runtime': '^0.2.0',
|
|
245
|
+
'@ankhorage/studio': 'latest',
|
|
246
|
+
...(authProvider === 'supabase' ? { '@ankhorage/supabase-auth': 'latest' } : {}),
|
|
247
|
+
...(storageProvider === 'supabase' ? { '@ankhorage/supabase-storage': 'latest' } : {}),
|
|
248
|
+
'@ankhorage/zora': 'latest',
|
|
249
|
+
...runtimeDependencies,
|
|
250
|
+
...(includeStudio
|
|
251
|
+
? {
|
|
252
|
+
'@expo/vector-icons': '^15.0.3',
|
|
253
|
+
'@react-native-picker/picker': '2.11.1',
|
|
254
|
+
}
|
|
255
|
+
: {}),
|
|
256
|
+
'@react-navigation/bottom-tabs': '^7.18.2',
|
|
257
|
+
'@react-navigation/drawer': '^7.5.0',
|
|
258
|
+
'babel-preset-expo': '^54.0.10',
|
|
259
|
+
expo: '~54.0.35',
|
|
260
|
+
'expo-constants': '~18.0.13',
|
|
261
|
+
'expo-font': '~14.0.12',
|
|
262
|
+
'expo-linear-gradient': '~15.0.8',
|
|
263
|
+
'expo-linking': '~8.0.12',
|
|
264
|
+
'expo-modules-core': EXPO_MODULES_CORE_VERSION,
|
|
265
|
+
'expo-router': '~6.0.24',
|
|
266
|
+
'expo-splash-screen': '~31.0.10',
|
|
267
|
+
'expo-status-bar': '^3.0.9',
|
|
268
|
+
'expo-updates': '~29.0.18',
|
|
269
|
+
react: '19.1.0',
|
|
270
|
+
'react-dom': '19.1.0',
|
|
271
|
+
'react-native': '0.81.5',
|
|
272
|
+
'react-native-gesture-handler': '~2.28.0',
|
|
273
|
+
'react-native-reanimated': '~4.1.1',
|
|
274
|
+
'react-native-safe-area-context': '~5.6.0',
|
|
275
|
+
'react-native-screens': '~4.16.0',
|
|
276
|
+
'react-native-svg': '~15.12.1',
|
|
277
|
+
'react-native-web': '^0.21.2',
|
|
278
|
+
'react-native-worklets': '0.5.1',
|
|
279
|
+
'reanimated-color-picker': '^4.2.0',
|
|
280
|
+
},
|
|
281
|
+
devDependencies: {
|
|
282
|
+
'@ankhorage/devtools': '^1.0.6',
|
|
283
|
+
'@types/node': '^25.6.0',
|
|
284
|
+
'@types/react': '~19.1.0',
|
|
285
|
+
'@types/culori': '^4.0.1',
|
|
286
|
+
'babel-plugin-module-resolver': '^5.0.0',
|
|
287
|
+
typescript: '~5.9.2',
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
return pkgJson;
|
|
291
|
+
}
|
|
292
|
+
export function getEslintConfigMjs() {
|
|
293
|
+
return `import { createConfig } from '@ankhorage/devtools/eslint';
|
|
294
|
+
|
|
295
|
+
export default createConfig({
|
|
296
|
+
tsconfigRootDir: import.meta.dirname,
|
|
297
|
+
project: ['./tsconfig.json'],
|
|
298
|
+
files: [
|
|
299
|
+
'app.config.ts',
|
|
300
|
+
'src/app/**/*.{ts,tsx}',
|
|
301
|
+
'src/auth/**/*.{ts,tsx}',
|
|
302
|
+
'src/generated/**/*.{ts,tsx}',
|
|
303
|
+
'src/modules/**/*.{ts,tsx}',
|
|
304
|
+
],
|
|
305
|
+
additionalIgnores: [
|
|
306
|
+
'**/*.js',
|
|
307
|
+
'**/*.cjs',
|
|
308
|
+
'**/*.mjs',
|
|
309
|
+
'dist/**',
|
|
310
|
+
'.expo/**',
|
|
311
|
+
],
|
|
312
|
+
});
|
|
313
|
+
`;
|
|
314
|
+
}
|
|
315
|
+
export function getPrettierRcJs() {
|
|
316
|
+
return `module.exports = require('@ankhorage/devtools/prettier');
|
|
317
|
+
`;
|
|
318
|
+
}
|
|
319
|
+
export function getIndexJs() {
|
|
320
|
+
return `import React from 'react';
|
|
321
|
+
import { registerRootComponent } from 'expo';
|
|
322
|
+
import { ExpoRoot } from 'expo-router';
|
|
323
|
+
|
|
324
|
+
function App() {
|
|
325
|
+
const ctx = require.context('./src/app');
|
|
326
|
+
|
|
327
|
+
return <ExpoRoot context={ctx} />;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
registerRootComponent(App);
|
|
331
|
+
`;
|
|
332
|
+
}
|
|
333
|
+
export function getTsConfigJson() {
|
|
334
|
+
const tsConfigJson = `{
|
|
335
|
+
"extends": "expo/tsconfig.base",
|
|
336
|
+
"compilerOptions": {
|
|
337
|
+
"forceConsistentCasingInFileNames": true,
|
|
338
|
+
"jsx": "react-native",
|
|
339
|
+
"outDir": "dist",
|
|
340
|
+
"module": "esnext",
|
|
341
|
+
"moduleResolution": "bundler",
|
|
342
|
+
"strict": true,
|
|
343
|
+
"types": ["node"],
|
|
344
|
+
"noUncheckedIndexedAccess": true,
|
|
345
|
+
"paths": {
|
|
346
|
+
"@root/*": ["./*"],
|
|
347
|
+
"@/*": ["./src/*"]
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
"include": ["**/*.ts", "**/*.tsx"]
|
|
351
|
+
}
|
|
352
|
+
`;
|
|
353
|
+
return tsConfigJson;
|
|
354
|
+
}
|
|
355
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/host/orchestrator/templates.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,kCAAkC,CAAC;AAI1C,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAE5C,MAAM,mCAAmC,GAAG,IAAI,GAAG,CACjD;IACE,UAAU;IACV,YAAY;IACZ,IAAI;IACJ,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,WAAW;IACX,OAAO;IACP,UAAU;IACV,MAAM;IACN,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACP,SAAS;IACT,OAAO;IACP,KAAK;IACL,KAAK;IACL,IAAI;IACJ,YAAY;IACZ,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,WAAW;IACX,UAAU;IACV,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,KAAK;IACL,MAAM;IACN,QAAQ;IACR,MAAM;IACN,UAAU;IACV,KAAK;IACL,UAAU;IACV,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,OAAO;IACP,SAAS;IACT,QAAQ;IACR,cAAc;IACd,MAAM;IACN,OAAO;IACP,QAAQ;IACR,WAAW;IACX,MAAM;IACN,KAAK;IACL,WAAW;IACX,QAAQ;IACR,KAAK;IACL,KAAK;IACL,MAAM;IACN,UAAU;IACV,MAAM;IACN,OAAO;CACR,CAAC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src/host/orchestrator/workspaceRuntime.ts"],"names":[],"mappings":"AAOA,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0FzE"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
const BUN_INSTALL_SPAWN_TIMEOUT_MS = 30_000;
|
|
3
|
+
const BUN_INSTALL_HARD_TIMEOUT_MS = 10 * 60_000;
|
|
4
|
+
const BUN_INSTALL_KILL_GRACE_MS = 5_000;
|
|
5
|
+
export async function runWorkspaceInstall(rootPath) {
|
|
6
|
+
const command = 'bun install';
|
|
7
|
+
await new Promise((resolve, reject) => {
|
|
8
|
+
const child = spawn('bun', ['install'], {
|
|
9
|
+
cwd: rootPath,
|
|
10
|
+
stdio: 'inherit',
|
|
11
|
+
env: process.env,
|
|
12
|
+
});
|
|
13
|
+
const spawnTimeout = setTimeout(() => {
|
|
14
|
+
rejectWithTimeout(`bun install did not start within ${BUN_INSTALL_SPAWN_TIMEOUT_MS}ms`);
|
|
15
|
+
}, BUN_INSTALL_SPAWN_TIMEOUT_MS);
|
|
16
|
+
let hardTimeout;
|
|
17
|
+
let killTimeout;
|
|
18
|
+
let settled = false;
|
|
19
|
+
const clearTimers = () => {
|
|
20
|
+
clearTimeout(spawnTimeout);
|
|
21
|
+
if (hardTimeout)
|
|
22
|
+
clearTimeout(hardTimeout);
|
|
23
|
+
if (killTimeout)
|
|
24
|
+
clearTimeout(killTimeout);
|
|
25
|
+
};
|
|
26
|
+
const rejectOnce = (error) => {
|
|
27
|
+
if (settled)
|
|
28
|
+
return;
|
|
29
|
+
settled = true;
|
|
30
|
+
clearTimers();
|
|
31
|
+
reject(error);
|
|
32
|
+
};
|
|
33
|
+
const rejectWithTimeout = (reason) => {
|
|
34
|
+
if (settled)
|
|
35
|
+
return;
|
|
36
|
+
if (child.exitCode === null) {
|
|
37
|
+
child.kill('SIGTERM');
|
|
38
|
+
killTimeout = setTimeout(() => {
|
|
39
|
+
if (child.exitCode === null) {
|
|
40
|
+
child.kill('SIGKILL');
|
|
41
|
+
}
|
|
42
|
+
}, BUN_INSTALL_KILL_GRACE_MS);
|
|
43
|
+
}
|
|
44
|
+
settled = true;
|
|
45
|
+
clearTimers();
|
|
46
|
+
reject(new Error(`${reason} (${command}) in ${rootPath}. The process was terminated after timeout safeguards.`));
|
|
47
|
+
};
|
|
48
|
+
child.once('spawn', () => {
|
|
49
|
+
if (settled)
|
|
50
|
+
return;
|
|
51
|
+
clearTimeout(spawnTimeout);
|
|
52
|
+
hardTimeout = setTimeout(() => {
|
|
53
|
+
rejectWithTimeout(`bun install exceeded ${BUN_INSTALL_HARD_TIMEOUT_MS}ms`);
|
|
54
|
+
}, BUN_INSTALL_HARD_TIMEOUT_MS);
|
|
55
|
+
});
|
|
56
|
+
child.once('error', (error) => {
|
|
57
|
+
const spawnError = error;
|
|
58
|
+
const message = spawnError.code === 'ENOENT'
|
|
59
|
+
? `bun executable was not found in PATH while running '${command}' in ${rootPath}. Install Bun and retry.`
|
|
60
|
+
: `Failed to start '${command}' in ${rootPath}: ${spawnError.message}`;
|
|
61
|
+
rejectOnce(new Error(message));
|
|
62
|
+
});
|
|
63
|
+
child.once('close', (code, signal) => {
|
|
64
|
+
if (settled) {
|
|
65
|
+
clearTimers();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
settled = true;
|
|
69
|
+
clearTimers();
|
|
70
|
+
if (code === 0) {
|
|
71
|
+
resolve();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (code !== null) {
|
|
75
|
+
reject(new Error(`bun install failed with code ${code} in ${rootPath}.`));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
reject(new Error(`bun install terminated by signal ${signal ?? 'unknown'} in ${rootPath}.`));
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=workspaceRuntime.js.map
|
|
@@ -0,0 +1 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CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,OAAO,EAAE,CAAC;gBACZ,WAAW,EAAE,CAAC;gBACd,OAAO;YACT,CAAC;YAED,OAAO,GAAG,IAAI,CAAC;YACf,WAAW,EAAE,CAAC;YAEd,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YAED,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAClB,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,IAAI,OAAO,QAAQ,GAAG,CAAC,CAAC,CAAC;gBAC1E,OAAO;YACT,CAAC;YAED,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,MAAM,IAAI,SAAS,OAAO,QAAQ,GAAG,CAAC,CAAC,CAAC;QAC/F,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AppCategory, AppManifest } from '@ankhorage/contracts';
|
|
2
|
+
export interface ProjectTemplateSelection {
|
|
3
|
+
category: AppCategory;
|
|
4
|
+
templateId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ProjectTemplateSummary {
|
|
7
|
+
id: string;
|
|
8
|
+
category: AppCategory;
|
|
9
|
+
templateId: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
version: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function getProjectTemplate(selection: ProjectTemplateSelection): AppManifest;
|
|
15
|
+
export declare function getTemplateSummaries(): ProjectTemplateSummary[];
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/host/templateRegistry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASrE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAqED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,wBAAwB,GAAG,WAAW,CAanF;AAED,wBAAgB,oBAAoB,IAAI,sBAAsB,EAAE,CAE/D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CATEGORY_PRESETS, createStarterTemplate, listStarterTemplateSummaries, } from '@ankhorage/templates';
|
|
2
|
+
function createProjectTemplateId(selection) {
|
|
3
|
+
return `${selection.category}/${selection.templateId}`;
|
|
4
|
+
}
|
|
5
|
+
function createSeed(category) {
|
|
6
|
+
const preset = CATEGORY_PRESETS[category];
|
|
7
|
+
return {
|
|
8
|
+
category,
|
|
9
|
+
categoryLabel: preset.label,
|
|
10
|
+
appName: preset.defaultName,
|
|
11
|
+
slug: preset.defaultSlug,
|
|
12
|
+
summary: preset.summary,
|
|
13
|
+
focusAreas: preset.focusAreas,
|
|
14
|
+
primaryColor: preset.primaryColor,
|
|
15
|
+
harmony: preset.harmony,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function createTemplateManifest(summary) {
|
|
19
|
+
return normalizeProjectTemplateManifest({
|
|
20
|
+
category: summary.category,
|
|
21
|
+
templateId: summary.id,
|
|
22
|
+
}, createStarterTemplate(createSeed(summary.category), {
|
|
23
|
+
templateId: summary.id,
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
function normalizeProjectTemplateManifest(selection, manifest) {
|
|
27
|
+
if (selection.category !== 'food_drink' ||
|
|
28
|
+
selection.templateId !== 'nutrition-catalog-scan' ||
|
|
29
|
+
manifest.navigator.type !== 'tabs') {
|
|
30
|
+
return manifest;
|
|
31
|
+
}
|
|
32
|
+
const normalizedRoutes = manifest.navigator.routes.filter((route) => !(route.hideInTabBar === true && route.path === '/'));
|
|
33
|
+
return {
|
|
34
|
+
...manifest,
|
|
35
|
+
navigator: {
|
|
36
|
+
...manifest.navigator,
|
|
37
|
+
routes: normalizedRoutes,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function buildProjectTemplate(selection) {
|
|
42
|
+
return normalizeProjectTemplateManifest(selection, createStarterTemplate(createSeed(selection.category), {
|
|
43
|
+
templateId: selection.templateId,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
const PROJECT_TEMPLATE_SUMMARIES = createTemplateSummaries();
|
|
47
|
+
export function getProjectTemplate(selection) {
|
|
48
|
+
const summary = PROJECT_TEMPLATE_SUMMARIES.find((template) => template.category === selection.category && template.templateId === selection.templateId);
|
|
49
|
+
if (!summary) {
|
|
50
|
+
throw new Error(`Template '${selection.category}/${selection.templateId}' not found in published templates package.`);
|
|
51
|
+
}
|
|
52
|
+
return buildProjectTemplate(selection);
|
|
53
|
+
}
|
|
54
|
+
export function getTemplateSummaries() {
|
|
55
|
+
return [...PROJECT_TEMPLATE_SUMMARIES];
|
|
56
|
+
}
|
|
57
|
+
function createTemplateSummaries() {
|
|
58
|
+
return listStarterTemplateSummaries().map((summary) => {
|
|
59
|
+
const manifest = createTemplateManifest(summary);
|
|
60
|
+
const selection = {
|
|
61
|
+
category: summary.category,
|
|
62
|
+
templateId: summary.id,
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
id: createProjectTemplateId(selection),
|
|
66
|
+
category: summary.category,
|
|
67
|
+
templateId: summary.id,
|
|
68
|
+
name: summary.label,
|
|
69
|
+
description: summary.description,
|
|
70
|
+
version: manifest.metadata.version,
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/host/templateRegistry/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,GAG7B,MAAM,sBAAsB,CAAC;AAgB9B,SAAS,uBAAuB,CAAC,SAAmC;IAClE,OAAO,GAAG,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,UAAU,CAAC,QAAqB;IACvC,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAE1C,OAAO;QACL,QAAQ;QACR,aAAa,EAAE,MAAM,CAAC,KAAK;QAC3B,OAAO,EAAE,MAAM,CAAC,WAAW;QAC3B,IAAI,EAAE,MAAM,CAAC,WAAW;QACxB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,OAA+B;IAC7D,OAAO,gCAAgC,CACrC;QACE,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,OAAO,CAAC,EAAE;KACvB,EACD,qBAAqB,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAClD,UAAU,EAAE,OAAO,CAAC,EAAE;KACvB,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,gCAAgC,CACvC,SAAmC,EACnC,QAAqB;IAErB,IACE,SAAS,CAAC,QAAQ,KAAK,YAAY;QACnC,SAAS,CAAC,UAAU,KAAK,wBAAwB;QACjD,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM,EAClC,CAAC;QACD,OAAO,QA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AAsB,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG;YAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,OAAO,CAAC,EAAE;SACY,CAAC;QAErC,OAAO;YACL,EAAE,EAAE,uBAAuB,CAAC,SAAS,CAAC;YACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,OAAO,CAAC,EAAE;YACtB,IAAI,EAAE,OAAO,CAAC,KAAK;YACnB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO;SACnC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ScreenRequirements, UiNode } from '@ankhorage/contracts';
|
|
2
|
+
export declare function inferScreenRequirementsFromUi(root: UiNode): ScreenRequirements | undefined;
|
|
3
|
+
export declare function mergeScreenRequirements(explicit?: ScreenRequirements, inferred?: ScreenRequirements): ScreenRequirements | undefined;
|
|
4
|
+
//# sourceMappingURL=requirementsInference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requirementsInference.d.ts","sourceRoot":"","sources":["../../../src/host/utils/requirementsInference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,kBAAkB,EAClB,MAAM,EACP,MAAM,sBAAsB,CAAC;AAG9B,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CA+B1F;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,CAAC,EAAE,kBAAkB,EAC7B,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,kBAAkB,GAAG,SAAS,CAyBhC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ZORA_COMPONENT_META } from '@ankhorage/zora/metadata';
|
|
2
|
+
export function inferScreenRequirementsFromUi(root) {
|
|
3
|
+
const permissions = new Map();
|
|
4
|
+
const capabilities = new Map();
|
|
5
|
+
function walk(node) {
|
|
6
|
+
const meta = ZORA_COMPONENT_META[node.type];
|
|
7
|
+
if (meta?.requirements) {
|
|
8
|
+
meta.requirements.permissions?.forEach((p) => {
|
|
9
|
+
permissions.set(p.permission, p);
|
|
10
|
+
});
|
|
11
|
+
meta.requirements.capabilities?.forEach((c) => {
|
|
12
|
+
capabilities.set(c.capability, c);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (node.children) {
|
|
16
|
+
node.children.forEach(walk);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
walk(root);
|
|
20
|
+
if (permissions.size === 0 && capabilities.size === 0) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
permissions: permissions.size > 0 ? Array.from(permissions.values()) : undefined,
|
|
25
|
+
capabilities: capabilities.size > 0 ? Array.from(capabilities.values()) : undefined,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function mergeScreenRequirements(explicit, inferred) {
|
|
29
|
+
if (!explicit && !inferred) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const permissions = new Map();
|
|
33
|
+
const capabilities = new Map();
|
|
34
|
+
// Apply inferred first, then explicit to ensure explicit overrides
|
|
35
|
+
[inferred?.permissions, explicit?.permissions].forEach((perms) => {
|
|
36
|
+
perms?.forEach((p) => permissions.set(p.permission, p));
|
|
37
|
+
});
|
|
38
|
+
[inferred?.capabilities, explicit?.capabilities].forEach((caps) => {
|
|
39
|
+
caps?.forEach((c) => capabilities.set(c.capability, c));
|
|
40
|
+
});
|
|
41
|
+
if (permissions.size === 0 && capabilities.size === 0) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
permissions: permissions.size > 0 ? Array.from(permissions.values()) : undefined,
|
|
46
|
+
capabilities: capabilities.size > 0 ? Array.from(capabilities.values()) : undefined,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=requirementsInference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requirementsInference.js","sourceRoot":"","sources":["../../../src/host/utils/requirementsInference.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,UAAU,6BAA6B,CAAC,IAAY;IACxD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAwD,CAAC;IACpF,MAAM,YAAY,GAAG,IAAI,GAAG,EAAwD,CAAC;IAErF,SAAS,IAAI,CAAC,IAAY;QACxB,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,IAAI,EAAE,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC3C,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC5C,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,CAAC;IAEX,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC,IAAI,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,WAAW,EAAE,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,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