zelune 1.6.2 → 1.6.4
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 +16 -0
- package/bin/cli.mjs +13 -54
- package/dist/assets/CheckoutScreen-6IdrpKgm.js +229 -0
- package/dist/assets/HomeScreen-Dxe9L4I2.js +316 -0
- package/dist/assets/LoginScreen-Dp1awI4F.js +189 -0
- package/dist/assets/ProductDetailScreen-Wa5_nlRP.js +196 -0
- package/dist/assets/ProfileScreen-riAU6vVh.js +185 -0
- package/dist/assets/index-hEzd4JVy.js +44697 -0
- package/{index.html → dist/index.html} +3 -7
- package/mcp/server.mjs +1370 -34
- package/package.json +10 -17
- package/plugin.json +1 -1
- package/socket.yml +11 -0
- package/mcp/server.ts +0 -446
- package/plugins/viteReactNativeFallbackPlugin.ts +0 -519
- package/plugins/viteRnSourceInject.ts +0 -117
- package/plugins/viteVirtualScreensPlugin.ts +0 -216
- package/src/canvas/CanvasApp.tsx +0 -1655
- package/src/canvas/FlowArrowsLayer.tsx +0 -239
- package/src/canvas/InspectorPanel.tsx +0 -1494
- package/src/canvas/ScreenArtboard.tsx +0 -1491
- package/src/canvas/types.ts +0 -23
- package/src/main.tsx +0 -80
- package/src/runtime/MockNavigationContext.tsx +0 -1795
- package/src/runtime/ScreenErrorBoundary.tsx +0 -86
- package/src/runtime/nativewindShim.ts +0 -997
- package/src/runtime/reactNativeShim.ts +0 -240
- package/src/screens/CheckoutScreen.tsx +0 -229
- package/src/screens/HomeScreen.tsx +0 -288
- package/src/screens/LoginScreen.tsx +0 -176
- package/src/screens/ProductDetailScreen.tsx +0 -207
- package/src/screens/ProfileScreen.tsx +0 -172
- package/src/screens/index.ts +0 -1
- package/src/server/apiMiddleware.ts +0 -375
- package/src/server/astEngine.ts +0 -2553
- package/src/vite-env.d.ts +0 -7
- package/tsconfig.json +0 -23
- package/vite.config.ts +0 -340
- /package/{src/styles.css → dist/assets/index-C7nrS82N.css} +0 -0
package/src/vite-env.d.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"moduleResolution": "bundler",
|
|
9
|
-
"allowImportingTsExtensions": true,
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"jsx": "react-jsx",
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noUnusedLocals": false,
|
|
16
|
-
"noUnusedParameters": false,
|
|
17
|
-
"noFallthroughCasesInSwitch": true,
|
|
18
|
-
"paths": {
|
|
19
|
-
"react-native": ["./node_modules/react-native-web"]
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"include": ["src", "plugins", "mcp", "tests", "vite.config.ts"]
|
|
23
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
import { parse } from '@babel/parser';
|
|
2
|
-
import { build, defineConfig, loadEnv } from 'vite';
|
|
3
|
-
import react from '@vitejs/plugin-react';
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { viteRnSourceInject } from './plugins/viteRnSourceInject';
|
|
8
|
-
import { viteVirtualScreensPlugin } from './plugins/viteVirtualScreensPlugin';
|
|
9
|
-
import { viteReactNativeFallbackPlugin } from './plugins/viteReactNativeFallbackPlugin';
|
|
10
|
-
import { viteCanvasApiMiddleware } from './src/server/apiMiddleware';
|
|
11
|
-
import { findMobileAppRoot } from './src/server/astEngine';
|
|
12
|
-
|
|
13
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
|
|
15
|
-
const rawTargetRoot = process.env.ANTIGRAVITY_TARGET_PROJECT
|
|
16
|
-
? path.resolve(process.env.ANTIGRAVITY_TARGET_PROJECT)
|
|
17
|
-
: __dirname;
|
|
18
|
-
|
|
19
|
-
const workspaceRoot = process.env.ANTIGRAVITY_WORKSPACE_ROOT
|
|
20
|
-
? path.resolve(process.env.ANTIGRAVITY_WORKSPACE_ROOT)
|
|
21
|
-
: rawTargetRoot;
|
|
22
|
-
|
|
23
|
-
const targetProjectRoot = findMobileAppRoot(rawTargetRoot);
|
|
24
|
-
const mockNavShimPath = path.resolve(__dirname, 'src/runtime/MockNavigationContext.tsx');
|
|
25
|
-
|
|
26
|
-
function safeRealpath(targetPath: string): string {
|
|
27
|
-
try {
|
|
28
|
-
return fs.realpathSync(targetPath);
|
|
29
|
-
} catch {
|
|
30
|
-
return path.resolve(targetPath);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function resolvePackageRootDir(pkgName: string): string {
|
|
35
|
-
try {
|
|
36
|
-
const pkgJsonUrl = import.meta.resolve(`${pkgName}/package.json`);
|
|
37
|
-
return path.dirname(fileURLToPath(pkgJsonUrl));
|
|
38
|
-
} catch {
|
|
39
|
-
return pkgName;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const resolvedReactDir = resolvePackageRootDir('react');
|
|
44
|
-
const resolvedReactDomDir = resolvePackageRootDir('react-dom');
|
|
45
|
-
const resolvedRnWebDir = resolvePackageRootDir('react-native-web');
|
|
46
|
-
const resolvedLucideDir = resolvePackageRootDir('lucide-react');
|
|
47
|
-
|
|
48
|
-
function loadPublicProjectEnv(roots: string[]): Record<string, string> {
|
|
49
|
-
const publicEnv: Record<string, string> = {
|
|
50
|
-
NODE_ENV: 'development',
|
|
51
|
-
EXPO_PUBLIC_PLATFORM: 'web',
|
|
52
|
-
};
|
|
53
|
-
const uniqueRoots = Array.from(new Set(roots.map((r) => path.resolve(r))));
|
|
54
|
-
|
|
55
|
-
for (const rootDir of uniqueRoots) {
|
|
56
|
-
try {
|
|
57
|
-
const loaded = loadEnv('development', rootDir, ['EXPO_PUBLIC_', 'NEXT_PUBLIC_', 'VITE_']);
|
|
58
|
-
Object.assign(publicEnv, loaded);
|
|
59
|
-
} catch {
|
|
60
|
-
// Ignore unreadable env directories
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return publicEnv;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const publicProjectEnv = loadPublicProjectEnv([workspaceRoot, rawTargetRoot, targetProjectRoot]);
|
|
67
|
-
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
-
function extractStaticAstValue(node: any, scope: Map<string, unknown>, depth = 0): unknown {
|
|
70
|
-
if (!node || depth > 12) return undefined;
|
|
71
|
-
|
|
72
|
-
switch (node.type) {
|
|
73
|
-
case 'StringLiteral':
|
|
74
|
-
case 'NumericLiteral':
|
|
75
|
-
case 'BooleanLiteral':
|
|
76
|
-
return node.value;
|
|
77
|
-
case 'NullLiteral':
|
|
78
|
-
return null;
|
|
79
|
-
case 'UnaryExpression': {
|
|
80
|
-
const arg = extractStaticAstValue(node.argument, scope, depth + 1);
|
|
81
|
-
if (typeof arg === 'number') {
|
|
82
|
-
if (node.operator === '-') return -arg;
|
|
83
|
-
if (node.operator === '+') return +arg;
|
|
84
|
-
}
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
case 'TemplateLiteral': {
|
|
88
|
-
if (Array.isArray(node.expressions) && node.expressions.length === 0) {
|
|
89
|
-
return node.quasis?.[0]?.value?.cooked ?? node.quasis?.[0]?.value?.raw ?? '';
|
|
90
|
-
}
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
case 'ArrayExpression': {
|
|
94
|
-
const items: unknown[] = [];
|
|
95
|
-
for (const el of node.elements ?? []) {
|
|
96
|
-
if (!el) continue;
|
|
97
|
-
if (el.type === 'SpreadElement') {
|
|
98
|
-
const spreadVal = extractStaticAstValue(el.argument, scope, depth + 1);
|
|
99
|
-
if (Array.isArray(spreadVal)) items.push(...spreadVal);
|
|
100
|
-
} else {
|
|
101
|
-
const val = extractStaticAstValue(el, scope, depth + 1);
|
|
102
|
-
if (val !== undefined) items.push(val);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return items;
|
|
106
|
-
}
|
|
107
|
-
case 'ObjectExpression': {
|
|
108
|
-
const result: Record<string, unknown> = {};
|
|
109
|
-
for (const prop of node.properties ?? []) {
|
|
110
|
-
if (prop.type === 'SpreadElement') {
|
|
111
|
-
const spreadObj = extractStaticAstValue(prop.argument, scope, depth + 1);
|
|
112
|
-
if (spreadObj && typeof spreadObj === 'object' && !Array.isArray(spreadObj)) {
|
|
113
|
-
Object.assign(result, spreadObj);
|
|
114
|
-
}
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (prop.type !== 'ObjectProperty' || prop.computed) continue;
|
|
118
|
-
const key =
|
|
119
|
-
prop.key?.type === 'Identifier'
|
|
120
|
-
? prop.key.name
|
|
121
|
-
: prop.key?.type === 'StringLiteral' || prop.key?.type === 'NumericLiteral'
|
|
122
|
-
? String(prop.key.value)
|
|
123
|
-
: null;
|
|
124
|
-
if (!key) continue;
|
|
125
|
-
const val = extractStaticAstValue(prop.value, scope, depth + 1);
|
|
126
|
-
if (val !== undefined) {
|
|
127
|
-
result[key] = val;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
|
-
case 'TSAsExpression':
|
|
133
|
-
case 'TSSatisfiesExpression':
|
|
134
|
-
case 'TSTypeAssertion':
|
|
135
|
-
case 'ParenthesizedExpression':
|
|
136
|
-
return extractStaticAstValue(node.expression, scope, depth + 1);
|
|
137
|
-
case 'Identifier':
|
|
138
|
-
return scope.get(node.name);
|
|
139
|
-
default:
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function parseTailwindConfigSource(raw: string): Record<string, unknown> {
|
|
145
|
-
try {
|
|
146
|
-
const ast = parse(raw, {
|
|
147
|
-
sourceType: 'unambiguous',
|
|
148
|
-
plugins: ['typescript', 'jsx'],
|
|
149
|
-
errorRecovery: true,
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
const scope = new Map<string, unknown>();
|
|
153
|
-
let exportedConfig: unknown;
|
|
154
|
-
|
|
155
|
-
for (const stmt of ast.program.body) {
|
|
156
|
-
if (stmt.type === 'VariableDeclaration') {
|
|
157
|
-
for (const decl of stmt.declarations) {
|
|
158
|
-
if (decl.id.type === 'Identifier' && decl.init) {
|
|
159
|
-
const val = extractStaticAstValue(decl.init, scope);
|
|
160
|
-
if (val !== undefined) {
|
|
161
|
-
scope.set(decl.id.name, val);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
} else if (stmt.type === 'ExportDefaultDeclaration') {
|
|
166
|
-
exportedConfig = extractStaticAstValue(stmt.declaration, scope);
|
|
167
|
-
} else if (
|
|
168
|
-
stmt.type === 'ExpressionStatement' &&
|
|
169
|
-
stmt.expression.type === 'AssignmentExpression'
|
|
170
|
-
) {
|
|
171
|
-
const left = stmt.expression.left;
|
|
172
|
-
if (
|
|
173
|
-
left.type === 'MemberExpression' &&
|
|
174
|
-
left.object.type === 'Identifier' &&
|
|
175
|
-
left.property.type === 'Identifier' &&
|
|
176
|
-
((left.object.name === 'module' && left.property.name === 'exports') ||
|
|
177
|
-
(left.object.name === 'exports' && left.property.name === 'default'))
|
|
178
|
-
) {
|
|
179
|
-
exportedConfig = extractStaticAstValue(stmt.expression.right, scope);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const cfg = exportedConfig as
|
|
185
|
-
| { theme?: Record<string, unknown> & { extend?: Record<string, unknown> } }
|
|
186
|
-
| undefined;
|
|
187
|
-
|
|
188
|
-
if (cfg?.theme && typeof cfg.theme === 'object') {
|
|
189
|
-
const baseTheme = { ...cfg.theme };
|
|
190
|
-
const extendTheme =
|
|
191
|
-
cfg.theme.extend && typeof cfg.theme.extend === 'object' ? cfg.theme.extend : {};
|
|
192
|
-
delete baseTheme.extend;
|
|
193
|
-
const merged: Record<string, unknown> = { ...baseTheme };
|
|
194
|
-
for (const [k, v] of Object.entries(extendTheme)) {
|
|
195
|
-
if (v && typeof v === 'object' && !Array.isArray(v)) {
|
|
196
|
-
merged[k] = {
|
|
197
|
-
...((baseTheme[k] as Record<string, unknown>) ?? {}),
|
|
198
|
-
...(v as Record<string, unknown>),
|
|
199
|
-
};
|
|
200
|
-
} else {
|
|
201
|
-
merged[k] = v;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return merged;
|
|
205
|
-
}
|
|
206
|
-
} catch {
|
|
207
|
-
// Ignore tailwind config parse errors
|
|
208
|
-
}
|
|
209
|
-
return {};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function loadProjectTailwindTheme(roots: string[]): Record<string, unknown> {
|
|
213
|
-
const candidates = [
|
|
214
|
-
'tailwind.config.js',
|
|
215
|
-
'tailwind.config.cjs',
|
|
216
|
-
'tailwind.config.mjs',
|
|
217
|
-
'tailwind.config.ts',
|
|
218
|
-
];
|
|
219
|
-
const uniqueRoots = Array.from(new Set(roots.map((r) => path.resolve(r))));
|
|
220
|
-
for (const rootDir of uniqueRoots) {
|
|
221
|
-
for (const fileName of candidates) {
|
|
222
|
-
const fullPath = path.join(rootDir, fileName);
|
|
223
|
-
try {
|
|
224
|
-
if (!fs.existsSync(fullPath)) continue;
|
|
225
|
-
const raw = fs.readFileSync(fullPath, 'utf-8');
|
|
226
|
-
const parsedTheme = parseTailwindConfigSource(raw);
|
|
227
|
-
if (Object.keys(parsedTheme).length > 0) {
|
|
228
|
-
return parsedTheme;
|
|
229
|
-
}
|
|
230
|
-
} catch {
|
|
231
|
-
// Ignore unreadable tailwind config files
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return {};
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const projectTailwindTheme = loadProjectTailwindTheme([
|
|
239
|
-
targetProjectRoot,
|
|
240
|
-
rawTargetRoot,
|
|
241
|
-
workspaceRoot,
|
|
242
|
-
]);
|
|
243
|
-
|
|
244
|
-
const allowedFsRoots = Array.from(
|
|
245
|
-
new Set([
|
|
246
|
-
__dirname,
|
|
247
|
-
safeRealpath(__dirname),
|
|
248
|
-
workspaceRoot,
|
|
249
|
-
safeRealpath(workspaceRoot),
|
|
250
|
-
rawTargetRoot,
|
|
251
|
-
safeRealpath(rawTargetRoot),
|
|
252
|
-
targetProjectRoot,
|
|
253
|
-
safeRealpath(targetProjectRoot),
|
|
254
|
-
])
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
export default defineConfig({
|
|
258
|
-
plugins: [
|
|
259
|
-
{
|
|
260
|
-
name: 'vite-zelune-process-env-shim',
|
|
261
|
-
transformIndexHtml(html) {
|
|
262
|
-
const serializedEnv = JSON.stringify(publicProjectEnv);
|
|
263
|
-
const serializedTailwindTheme = JSON.stringify(projectTailwindTheme);
|
|
264
|
-
const envScript = `<script>window.__ZELUNE_TAILWIND_THEME__ = ${serializedTailwindTheme}; window.__ZELUNE_PUBLIC_ENV__ = ${serializedEnv};</script>`;
|
|
265
|
-
return html.replace('<head>', `<head>\n ${envScript}`);
|
|
266
|
-
},
|
|
267
|
-
async closeBundle() {
|
|
268
|
-
await build({
|
|
269
|
-
configFile: false,
|
|
270
|
-
css: { postcss: {} },
|
|
271
|
-
logLevel: 'silent',
|
|
272
|
-
build: {
|
|
273
|
-
ssr: path.resolve(__dirname, 'mcp/server.ts'),
|
|
274
|
-
outDir: path.resolve(__dirname, 'mcp'),
|
|
275
|
-
emptyOutDir: false,
|
|
276
|
-
minify: false,
|
|
277
|
-
rollupOptions: {
|
|
278
|
-
external: [/^node:/, /^@babel\//],
|
|
279
|
-
output: {
|
|
280
|
-
format: 'es',
|
|
281
|
-
entryFileNames: 'server.mjs',
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
});
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
viteReactNativeFallbackPlugin(targetProjectRoot, mockNavShimPath, workspaceRoot),
|
|
289
|
-
viteVirtualScreensPlugin(targetProjectRoot),
|
|
290
|
-
viteRnSourceInject(targetProjectRoot),
|
|
291
|
-
react(),
|
|
292
|
-
viteCanvasApiMiddleware(targetProjectRoot),
|
|
293
|
-
],
|
|
294
|
-
optimizeDeps: {
|
|
295
|
-
noDiscovery: true,
|
|
296
|
-
include: [
|
|
297
|
-
'react',
|
|
298
|
-
'react/jsx-runtime',
|
|
299
|
-
'react/jsx-dev-runtime',
|
|
300
|
-
'react-dom',
|
|
301
|
-
'react-dom/client',
|
|
302
|
-
'react-native-web',
|
|
303
|
-
'lucide-react',
|
|
304
|
-
],
|
|
305
|
-
},
|
|
306
|
-
esbuild: {
|
|
307
|
-
// Ensure .tsx/.ts/.jsx/.js files (including RN .js files with JSX) are transpiled cleanly
|
|
308
|
-
include: /\.(tsx|ts|jsx|js)$/,
|
|
309
|
-
exclude: [],
|
|
310
|
-
loader: 'tsx',
|
|
311
|
-
},
|
|
312
|
-
resolve: {
|
|
313
|
-
dedupe: ['react', 'react-dom', 'react-native-web'],
|
|
314
|
-
alias: {
|
|
315
|
-
react: resolvedReactDir,
|
|
316
|
-
'react-dom': resolvedReactDomDir,
|
|
317
|
-
'react-native-web': resolvedRnWebDir,
|
|
318
|
-
'lucide-react': resolvedLucideDir,
|
|
319
|
-
},
|
|
320
|
-
extensions: ['.web.tsx', '.web.ts', '.web.js', '.tsx', '.ts', '.jsx', '.js'],
|
|
321
|
-
},
|
|
322
|
-
define: {
|
|
323
|
-
__DEV__: JSON.stringify(true),
|
|
324
|
-
global: 'window',
|
|
325
|
-
},
|
|
326
|
-
css: {
|
|
327
|
-
postcss: {},
|
|
328
|
-
},
|
|
329
|
-
server: {
|
|
330
|
-
host: '127.0.0.1',
|
|
331
|
-
port: 5173,
|
|
332
|
-
strictPort: false,
|
|
333
|
-
cors: false,
|
|
334
|
-
allowedHosts: ['127.0.0.1', 'localhost', '::1'],
|
|
335
|
-
fs: {
|
|
336
|
-
strict: false,
|
|
337
|
-
allow: allowedFsRoots,
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
});
|
|
File without changes
|