orvyn-lang 0.1.0 → 0.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/LANGUAGE.md +139 -3
- package/README.md +293 -1
- package/package.json +1 -1
- package/src/cli/orvyn.js +31 -480
- package/src/lang/codegen.js +90 -27
- package/src/lang/form.js +99 -0
- package/src/lang/native/android/OrvynRenderer.kt +5 -0
- package/src/lang/native/ios/OrvynEngine.swift +2 -0
- package/src/lang/native/ios/OrvynViews.swift +3 -0
- package/src/lang/native-runtime.js +22 -6
- package/src/lang/runtime-shared.js +28 -0
- package/src/lang/runtime.js +14 -1
- package/src/lang/validation.js +55 -0
- package/src/core/context.js +0 -19
- package/src/core/lifecycle.js +0 -8
- package/src/core/resource.js +0 -27
- package/src/core/router.js +0 -20
- package/src/core/theme.js +0 -10
- package/src/devtools/devicePreview/PreviewFrame.js +0 -214
- package/src/devtools/devicePreview/index.js +0 -6
- package/src/devtools/overlay.js +0 -105
- package/src/runtime/createRenderer.js +0 -22
- package/src/runtime/h.js +0 -93
- package/src/runtime/hydrate.js +0 -59
- package/src/runtime/jsx-dev-runtime.js +0 -7
- package/src/runtime/jsx-runtime.js +0 -13
- package/src/runtime/partialHydration.js +0 -154
- package/src/runtime/platform.js +0 -135
- package/src/runtime/renderToStream.js +0 -127
- package/src/runtime/renderToString.js +0 -121
- package/src/runtime/resume.js +0 -62
package/src/cli/orvyn.js
CHANGED
|
@@ -63,21 +63,6 @@ if (orvEntry && !hasOrvArg) {
|
|
|
63
63
|
args = platform === "web" ? args.slice(1) : args
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
const targets =
|
|
68
|
-
new Set([
|
|
69
|
-
"web",
|
|
70
|
-
"ios",
|
|
71
|
-
"android",
|
|
72
|
-
"universal"
|
|
73
|
-
])
|
|
74
|
-
|
|
75
|
-
const nativeTargets =
|
|
76
|
-
new Set([
|
|
77
|
-
"ios",
|
|
78
|
-
"android"
|
|
79
|
-
])
|
|
80
|
-
|
|
81
66
|
function log(message = "") {
|
|
82
67
|
process.stdout.write(`${message}\n`)
|
|
83
68
|
}
|
|
@@ -148,419 +133,6 @@ function viteBinary() {
|
|
|
148
133
|
: "vite"
|
|
149
134
|
}
|
|
150
135
|
|
|
151
|
-
function walk(
|
|
152
|
-
dir,
|
|
153
|
-
files = []
|
|
154
|
-
) {
|
|
155
|
-
if (!existsSync(dir)) {
|
|
156
|
-
return files
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
for (const entry of readdirSync(dir)) {
|
|
160
|
-
if (
|
|
161
|
-
entry === "node_modules" ||
|
|
162
|
-
entry === "dist"
|
|
163
|
-
) {
|
|
164
|
-
continue
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const file =
|
|
168
|
-
join(dir, entry)
|
|
169
|
-
|
|
170
|
-
const stat =
|
|
171
|
-
statSync(file)
|
|
172
|
-
|
|
173
|
-
if (stat.isDirectory()) {
|
|
174
|
-
walk(file, files)
|
|
175
|
-
} else {
|
|
176
|
-
files.push(file)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return files
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function readJson(path) {
|
|
184
|
-
if (!existsSync(path)) {
|
|
185
|
-
return null
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return JSON.parse(
|
|
189
|
-
readFileSync(path, "utf8")
|
|
190
|
-
)
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function formatBytes(bytes) {
|
|
194
|
-
if (bytes < 1024) {
|
|
195
|
-
return `${bytes} B`
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (bytes < 1024 * 1024) {
|
|
199
|
-
return `${(bytes / 1024).toFixed(2)} KB`
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return `${(bytes / 1024 / 1024).toFixed(2)} MB`
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function targetFromArgs(
|
|
206
|
-
fallback = "web"
|
|
207
|
-
) {
|
|
208
|
-
const target =
|
|
209
|
-
args[0]
|
|
210
|
-
|
|
211
|
-
if (targets.has(target)) {
|
|
212
|
-
return {
|
|
213
|
-
target,
|
|
214
|
-
rest: args.slice(1)
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return {
|
|
219
|
-
target: fallback,
|
|
220
|
-
rest: args
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function logRenderer(target) {
|
|
225
|
-
log("[Orvyn Renderer]")
|
|
226
|
-
log(`Target: ${target}`)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
function nativeTree(target) {
|
|
230
|
-
return {
|
|
231
|
-
type: target === "ios"
|
|
232
|
-
? "UIView"
|
|
233
|
-
: "View",
|
|
234
|
-
props: {},
|
|
235
|
-
children: []
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function nativeManifest(target) {
|
|
240
|
-
return {
|
|
241
|
-
framework: "orvyn",
|
|
242
|
-
target,
|
|
243
|
-
renderer: target,
|
|
244
|
-
entry: existsSync(join(cwd, "src", "main.tsx"))
|
|
245
|
-
? "src/main.tsx"
|
|
246
|
-
: "src/main.ts",
|
|
247
|
-
generatedAt: new Date().toISOString(),
|
|
248
|
-
output: "view-tree-description",
|
|
249
|
-
tree: nativeTree(target),
|
|
250
|
-
notes: [
|
|
251
|
-
"This is an Orvyn native view-tree description target.",
|
|
252
|
-
"Real IPA/APK generation is intentionally not implemented in this architecture phase."
|
|
253
|
-
]
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function ensureDir(dir) {
|
|
258
|
-
mkdirSync(dir, { recursive: true })
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function writeNativeFile(base, filePath, content) {
|
|
262
|
-
const full = join(base, filePath)
|
|
263
|
-
ensureDir(join(full, ".."))
|
|
264
|
-
writeFileSync(full, content)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
async function buildNativeProject(target) {
|
|
268
|
-
const outDir = join(cwd, "dist", target)
|
|
269
|
-
ensureDir(outDir)
|
|
270
|
-
|
|
271
|
-
logRenderer(target)
|
|
272
|
-
log("")
|
|
273
|
-
log(`[Orvyn Native Build] Target: ${target}`)
|
|
274
|
-
log("Extracting VNode tree and generating native project structure...")
|
|
275
|
-
log("")
|
|
276
|
-
|
|
277
|
-
const { createServer } = await import("vite")
|
|
278
|
-
const server = await createServer({
|
|
279
|
-
server: { middlewareMode: true },
|
|
280
|
-
appType: "custom",
|
|
281
|
-
root: cwd
|
|
282
|
-
})
|
|
283
|
-
|
|
284
|
-
try {
|
|
285
|
-
let orvynConfig = {}
|
|
286
|
-
if (existsSync(join(cwd, "orvyn.config.ts"))) {
|
|
287
|
-
const mod = await server.ssrLoadModule("/orvyn.config.ts")
|
|
288
|
-
orvynConfig = mod.default || {}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const config = {
|
|
292
|
-
appId: "com.orvyn.app",
|
|
293
|
-
appName: "OrvynApp",
|
|
294
|
-
version: "1.0.0",
|
|
295
|
-
entry: "/src/main.tsx",
|
|
296
|
-
...(orvynConfig.native || {})
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const mainMod = await server.ssrLoadModule(config.entry)
|
|
300
|
-
const rootComponent = mainMod[Object.keys(mainMod)[0]] || mainMod.default
|
|
301
|
-
if (!rootComponent) {
|
|
302
|
-
throw new Error(`Could not find exported root component in ${config.entry}`)
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const vnode = rootComponent()
|
|
306
|
-
|
|
307
|
-
const buildMod = await server.ssrLoadModule("orvyn/build")
|
|
308
|
-
|
|
309
|
-
if (target === "ios") {
|
|
310
|
-
const result = buildMod.buildIOS(vnode, config)
|
|
311
|
-
result.files.forEach(file => {
|
|
312
|
-
writeNativeFile(outDir, file.path, file.content)
|
|
313
|
-
log(` ✓ dist/ios/${file.path}`)
|
|
314
|
-
})
|
|
315
|
-
log("")
|
|
316
|
-
log(`[Orvyn] iOS project generated → dist/ios/ (${result.files.length} files)`)
|
|
317
|
-
compileIOS(outDir)
|
|
318
|
-
} else {
|
|
319
|
-
const result = buildMod.buildAndroid(vnode, config)
|
|
320
|
-
result.files.forEach(file => {
|
|
321
|
-
writeNativeFile(outDir, file.path, file.content)
|
|
322
|
-
log(` ✓ dist/android/${file.path}`)
|
|
323
|
-
})
|
|
324
|
-
log("")
|
|
325
|
-
log(`[Orvyn] Android project generated → dist/android/ (${result.files.length} files)`)
|
|
326
|
-
compileAndroid(outDir)
|
|
327
|
-
}
|
|
328
|
-
} catch (err) {
|
|
329
|
-
log(`[Orvyn Native Build Error] ${err.message}`)
|
|
330
|
-
console.error(err)
|
|
331
|
-
process.exit(1)
|
|
332
|
-
} finally {
|
|
333
|
-
await server.close()
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// Legacy generators removed in favor of proper module architecture
|
|
338
|
-
|
|
339
|
-
function compileIOS(outDir) {
|
|
340
|
-
log("\\n[Orvyn Compile] Attempting to compile iOS App...")
|
|
341
|
-
try {
|
|
342
|
-
const res = spawnSync("xcodebuild", ["-version"], { encoding: "utf-8" })
|
|
343
|
-
if (res.status !== 0 || res.error) throw new Error("xcodebuild not found")
|
|
344
|
-
spawnSync("xcodebuild", ["-project", "OrvynApp.xcodeproj", "build"], { cwd: outDir, stdio: "inherit" })
|
|
345
|
-
log("\\n[Orvyn] ✅ iOS Compilation Successful!")
|
|
346
|
-
} catch (err) {
|
|
347
|
-
log("\\n[Orvyn Warning] Automatic iOS compilation failed.")
|
|
348
|
-
log("Please ensure Xcode and iOS SDK are installed.")
|
|
349
|
-
log("To build manually, open your .xcodeproj in Xcode inside dist/ios/.")
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
function compileAndroid(outDir) {
|
|
354
|
-
log("\\n[Orvyn Compile] Attempting to compile Android APK...")
|
|
355
|
-
try {
|
|
356
|
-
const gradlewPath = join(outDir, "gradlew")
|
|
357
|
-
writeFileSync(gradlewPath, "#!/usr/bin/env sh\\nexec gradle \\\"$@\\\"\\n")
|
|
358
|
-
|
|
359
|
-
const chmodResult = spawnSync("chmod", ["+x", "gradlew"], { cwd: outDir })
|
|
360
|
-
if (chmodResult.error || chmodResult.status !== 0) {
|
|
361
|
-
throw chmodResult.error || new Error("chmod failed")
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const buildResult = spawnSync("./gradlew", ["assembleDebug"], { cwd: outDir, stdio: "inherit" })
|
|
365
|
-
if (buildResult.error || buildResult.status !== 0) {
|
|
366
|
-
throw buildResult.error || new Error(`gradlew exited with status ${buildResult.status}`)
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
log("\\n[Orvyn] ✅ Android Compilation Successful!")
|
|
370
|
-
log("Installable APK: dist/android/app/build/outputs/apk/debug/app-debug.apk")
|
|
371
|
-
} catch (err) {
|
|
372
|
-
log("\\n[Orvyn Warning] Automatic Android compilation failed.")
|
|
373
|
-
log("Please ensure Java and Gradle are installed.")
|
|
374
|
-
log("To build manually, open dist/android/ in Android Studio, or run `gradle assembleDebug` in dist/android/.")
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
function buildNative(target) {
|
|
379
|
-
buildNativeProject(target)
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function buildWeb(commandArgs = []) {
|
|
383
|
-
logRenderer("web")
|
|
384
|
-
|
|
385
|
-
runSync(
|
|
386
|
-
viteBinary(),
|
|
387
|
-
[
|
|
388
|
-
"build",
|
|
389
|
-
"--outDir",
|
|
390
|
-
"dist/web",
|
|
391
|
-
...commandArgs
|
|
392
|
-
],
|
|
393
|
-
{
|
|
394
|
-
env: {
|
|
395
|
-
ORVYN_TARGET: "web"
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
)
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
function buildTarget(
|
|
402
|
-
target,
|
|
403
|
-
commandArgs = []
|
|
404
|
-
) {
|
|
405
|
-
if (target === "universal") {
|
|
406
|
-
buildWeb(commandArgs)
|
|
407
|
-
buildNativeProject("ios")
|
|
408
|
-
buildNativeProject("android")
|
|
409
|
-
|
|
410
|
-
return
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
if (target === "web") {
|
|
414
|
-
buildWeb(commandArgs)
|
|
415
|
-
|
|
416
|
-
return
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
if (nativeTargets.has(target)) {
|
|
420
|
-
buildNativeProject(target)
|
|
421
|
-
|
|
422
|
-
return
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
log(`Unknown build target: ${target}`)
|
|
426
|
-
process.exit(1)
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
function analyze() {
|
|
430
|
-
const pkg =
|
|
431
|
-
readJson(join(cwd, "package.json"))
|
|
432
|
-
|
|
433
|
-
const sourceFiles =
|
|
434
|
-
walk(join(cwd, "src"))
|
|
435
|
-
|
|
436
|
-
const systems = [
|
|
437
|
-
["Signals", "src/core/signal.ts"],
|
|
438
|
-
["Scheduler", "src/core/scheduler.ts"],
|
|
439
|
-
["VNode runtime", "src/runtime/vnode.ts"],
|
|
440
|
-
["Mount engine", "src/runtime/mount.ts"],
|
|
441
|
-
["Patch engine", "src/runtime/patch.ts"],
|
|
442
|
-
["SSR", "src/runtime/renderToString.ts"],
|
|
443
|
-
["Streaming SSR", "src/runtime/renderToStream.ts"],
|
|
444
|
-
["Hydration", "src/runtime/hydrate.ts"],
|
|
445
|
-
["Partial hydration", "src/runtime/partialHydration.ts"],
|
|
446
|
-
["Resumability", "src/runtime/resume.ts"],
|
|
447
|
-
["Compiler optimizer", "src/compiler/optimizer.ts"],
|
|
448
|
-
["Target compiler", "src/compiler/compile.ts"],
|
|
449
|
-
["Renderer abstraction", "src/runtime/createRenderer.ts"],
|
|
450
|
-
["Platform context", "src/runtime/platform.ts"],
|
|
451
|
-
["Web renderer", "src/platforms/web/index.ts"],
|
|
452
|
-
["iOS renderer", "src/platforms/ios/index.ts"],
|
|
453
|
-
["Android renderer", "src/platforms/android/index.ts"],
|
|
454
|
-
["Device preview", "src/devtools/devicePreview/PreviewFrame.ts"],
|
|
455
|
-
["Build targets", "src/build/index.ts"],
|
|
456
|
-
["DevTools", "src/devtools/runtime.ts"],
|
|
457
|
-
["Playground", "src/playground/Playground.tsx"],
|
|
458
|
-
["Native runtime", "src/native/runtime.ts"],
|
|
459
|
-
["Native types", "src/native/types.ts"],
|
|
460
|
-
["iOS bridge", "src/native/ios/bridge.ts"],
|
|
461
|
-
["iOS native renderer", "src/native/ios/renderer.ts"],
|
|
462
|
-
["Android bridge", "src/native/android/bridge.ts"],
|
|
463
|
-
["Android native renderer", "src/native/android/renderer.ts"],
|
|
464
|
-
["Native events", "src/native/events/events.ts"],
|
|
465
|
-
["Native gestures", "src/native/events/gestures.ts"],
|
|
466
|
-
["Native styling", "src/native/styling/interpreter.ts"],
|
|
467
|
-
["iOS styles", "src/native/styling/ios-styles.ts"],
|
|
468
|
-
["Android styles", "src/native/styling/android-styles.ts"],
|
|
469
|
-
["iOS build pipeline", "src/build/ios/pipeline.ts"],
|
|
470
|
-
["iOS code generator", "src/build/ios/generator.ts"],
|
|
471
|
-
["iOS project structure", "src/build/ios/project.ts"],
|
|
472
|
-
["Android build pipeline", "src/build/android/pipeline.ts"],
|
|
473
|
-
["Android code generator", "src/build/android/generator.ts"],
|
|
474
|
-
["Android project structure", "src/build/android/project.ts"],
|
|
475
|
-
["App signing", "src/build/signing/signing.ts"]
|
|
476
|
-
]
|
|
477
|
-
|
|
478
|
-
const distFiles =
|
|
479
|
-
walk(join(cwd, "dist"))
|
|
480
|
-
|
|
481
|
-
const distSize =
|
|
482
|
-
distFiles.reduce((total, file) =>
|
|
483
|
-
total + statSync(file).size,
|
|
484
|
-
0
|
|
485
|
-
)
|
|
486
|
-
|
|
487
|
-
log("Orvyn Analyze")
|
|
488
|
-
log("=============")
|
|
489
|
-
log(`Project: ${pkg?.name || "unknown"}`)
|
|
490
|
-
log(`Version: ${pkg?.version || "unknown"}`)
|
|
491
|
-
log(`Source files: ${sourceFiles.length}`)
|
|
492
|
-
log(`Build output: ${distFiles.length > 0 ? formatBytes(distSize) : "not built"}`)
|
|
493
|
-
log("")
|
|
494
|
-
|
|
495
|
-
log("Systems")
|
|
496
|
-
log("-------")
|
|
497
|
-
|
|
498
|
-
systems.forEach(([name, path]) => {
|
|
499
|
-
log(`${existsSync(join(cwd, path)) ? "✓" : "·"} ${name} (${path})`)
|
|
500
|
-
})
|
|
501
|
-
|
|
502
|
-
log("")
|
|
503
|
-
log("Source Breakdown")
|
|
504
|
-
log("----------------")
|
|
505
|
-
|
|
506
|
-
const groups =
|
|
507
|
-
sourceFiles.reduce((counts, file) => {
|
|
508
|
-
const group =
|
|
509
|
-
relative(join(cwd, "src"), file)
|
|
510
|
-
.split(/[\\/]/)[0]
|
|
511
|
-
|
|
512
|
-
counts[group] =
|
|
513
|
-
(counts[group] || 0) + 1
|
|
514
|
-
|
|
515
|
-
return counts
|
|
516
|
-
}, {})
|
|
517
|
-
|
|
518
|
-
Object
|
|
519
|
-
.entries(groups)
|
|
520
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
521
|
-
.forEach(([group, count]) => {
|
|
522
|
-
log(`${group}: ${count}`)
|
|
523
|
-
})
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
function help() {
|
|
527
|
-
log("Orvyn — one language for web, iPhone and Android")
|
|
528
|
-
log("")
|
|
529
|
-
log("Start:")
|
|
530
|
-
log(" orvyn new my-app Create a new app (and install it)")
|
|
531
|
-
log("")
|
|
532
|
-
log("Inside your app folder:")
|
|
533
|
-
log(" orvyn dev Web, with live reload")
|
|
534
|
-
log(" orvyn ios iPhone simulator, with live reload")
|
|
535
|
-
log(" orvyn android Android emulator or phone")
|
|
536
|
-
log(" orvyn check Find mistakes in your code")
|
|
537
|
-
log(" orvyn build Website → dist/web/")
|
|
538
|
-
log(" orvyn build ios Xcode project → dist/ios/ (for real iPhones / App Store)")
|
|
539
|
-
log(" orvyn build android Android Studio project → dist/android/")
|
|
540
|
-
log("")
|
|
541
|
-
log("Advanced (JSX framework projects):")
|
|
542
|
-
log(" orvyn dev [web|ios|android] [vite args]")
|
|
543
|
-
log(" orvyn build [web|ios|android|universal] [vite args]")
|
|
544
|
-
log(" orvyn preview [web] [vite args]")
|
|
545
|
-
log(" orvyn analyze")
|
|
546
|
-
log(" orvyn help")
|
|
547
|
-
log("")
|
|
548
|
-
log("Advanced (any .orv file):")
|
|
549
|
-
log(" orvyn compile app.orv Compile .orv to JavaScript (prints it)")
|
|
550
|
-
log(" orvyn compile app.orv -o x.js Write the JavaScript to a file")
|
|
551
|
-
log(" orvyn check app.orv Check a .orv file for errors")
|
|
552
|
-
log(" orvyn build ios app.orv Build a native iPhone app (SwiftUI)")
|
|
553
|
-
log(" orvyn build android app.orv Build a native Android app")
|
|
554
|
-
log(" orvyn dev ios app.orv iPhone simulator with live reload (save = reload)")
|
|
555
|
-
log(" orvyn run ios app.orv Build and open it in the iPhone simulator")
|
|
556
|
-
log(" orvyn run android app.orv Build and install on an emulator/phone")
|
|
557
|
-
log("")
|
|
558
|
-
log("Native Build:")
|
|
559
|
-
log(" orvyn build ios Generate iOS Xcode project → dist/ios/")
|
|
560
|
-
log(" orvyn build android Generate Android Gradle project → dist/android/")
|
|
561
|
-
log(" orvyn build universal Generate web + iOS + Android")
|
|
562
|
-
}
|
|
563
|
-
|
|
564
136
|
async function compileOrv(mode, commandArgs) {
|
|
565
137
|
const file = commandArgs.find(arg => arg.endsWith(".orv"))
|
|
566
138
|
const outIndex = commandArgs.indexOf("-o")
|
|
@@ -777,6 +349,33 @@ async function nativeOrv(mode, commandArgs) {
|
|
|
777
349
|
}
|
|
778
350
|
}
|
|
779
351
|
|
|
352
|
+
function help() {
|
|
353
|
+
log("Orvyn — one language for web, iPhone and Android")
|
|
354
|
+
log("")
|
|
355
|
+
log("Start:")
|
|
356
|
+
log(" orvyn new my-app Create a new app (and install it)")
|
|
357
|
+
log("")
|
|
358
|
+
log("Inside your app folder:")
|
|
359
|
+
log(" orvyn dev Web, with live reload")
|
|
360
|
+
log(" orvyn ios iPhone simulator, with live reload")
|
|
361
|
+
log(" orvyn android Android emulator or phone")
|
|
362
|
+
log(" orvyn check Find mistakes in your code")
|
|
363
|
+
log(" orvyn build Website → dist/web/")
|
|
364
|
+
log(" orvyn build ios Xcode project → dist/ios/ (for real iPhones / App Store)")
|
|
365
|
+
log(" orvyn build android Android Studio project → dist/android/")
|
|
366
|
+
log(" orvyn preview Preview the built website")
|
|
367
|
+
log("")
|
|
368
|
+
log("Any .orv file:")
|
|
369
|
+
log(" orvyn compile app.orv Compile .orv to JavaScript (prints it)")
|
|
370
|
+
log(" orvyn compile app.orv -o x.js Write the JavaScript to a file")
|
|
371
|
+
log(" orvyn check app.orv Check a .orv file for errors")
|
|
372
|
+
log(" orvyn build ios app.orv Build a native iPhone app (SwiftUI)")
|
|
373
|
+
log(" orvyn build android app.orv Build a native Android app")
|
|
374
|
+
log(" orvyn dev ios app.orv iPhone simulator with live reload")
|
|
375
|
+
log(" orvyn run ios app.orv Build and open it in the iPhone simulator")
|
|
376
|
+
log(" orvyn run android app.orv Build and install on an emulator/phone")
|
|
377
|
+
}
|
|
378
|
+
|
|
780
379
|
if (command === "web-dev") {
|
|
781
380
|
run(viteBinary(), args)
|
|
782
381
|
} else if (command === "web-build") {
|
|
@@ -786,62 +385,14 @@ if (command === "web-dev") {
|
|
|
786
385
|
run(viteBinary(), ["preview", "--outDir", "dist/web", ...args])
|
|
787
386
|
} else if ((command === "build" || command === "run" || command === "dev") && args.some(arg => arg.endsWith(".orv"))) {
|
|
788
387
|
await nativeOrv(command, args)
|
|
789
|
-
} else if (command === "dev") {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
if (target === "universal") {
|
|
794
|
-
log("Use one dev target at a time: web, ios, or android.")
|
|
795
|
-
process.exit(1)
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
logRenderer(target)
|
|
799
|
-
|
|
800
|
-
run(
|
|
801
|
-
viteBinary(),
|
|
802
|
-
rest,
|
|
803
|
-
{
|
|
804
|
-
env: {
|
|
805
|
-
ORVYN_TARGET: target
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
)
|
|
809
|
-
} else if (command === "build") {
|
|
810
|
-
const { target, rest } =
|
|
811
|
-
targetFromArgs("web")
|
|
812
|
-
|
|
813
|
-
buildTarget(target, rest)
|
|
814
|
-
} else if (command === "preview") {
|
|
815
|
-
const { target, rest } =
|
|
816
|
-
targetFromArgs("web")
|
|
817
|
-
|
|
818
|
-
if (target !== "web") {
|
|
819
|
-
log("Preview currently serves the browser-native web target.")
|
|
820
|
-
process.exit(1)
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
logRenderer("web")
|
|
824
|
-
|
|
825
|
-
run(
|
|
826
|
-
viteBinary(),
|
|
827
|
-
[
|
|
828
|
-
"preview",
|
|
829
|
-
"--outDir",
|
|
830
|
-
"dist/web",
|
|
831
|
-
...rest
|
|
832
|
-
],
|
|
833
|
-
{
|
|
834
|
-
env: {
|
|
835
|
-
ORVYN_TARGET: "web"
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
)
|
|
388
|
+
} else if (command === "dev" || command === "build" || command === "preview" || command === "run") {
|
|
389
|
+
log("No Orvyn app here (looked for src/app.orv and app.orv).")
|
|
390
|
+
log("Go into your app folder, or create one with: orvyn new my-app")
|
|
391
|
+
process.exit(1)
|
|
839
392
|
} else if (command === "new") {
|
|
840
393
|
newOrvProject(args[0])
|
|
841
394
|
} else if (command === "compile" || command === "check") {
|
|
842
395
|
await compileOrv(command, args)
|
|
843
|
-
} else if (command === "analyze") {
|
|
844
|
-
analyze()
|
|
845
396
|
} else if (
|
|
846
397
|
command === "help" ||
|
|
847
398
|
command === "--help" ||
|