@lunora/cli 1.0.0-alpha.10 → 1.0.0-alpha.100
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/LICENSE.md +6 -0
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +345 -320
- package/dist/index.d.ts +345 -320
- package/dist/index.mjs +8 -9
- package/dist/packem_chunks/handler.mjs +15 -5
- package/dist/packem_chunks/handler10.mjs +8 -14
- package/dist/packem_chunks/handler11.mjs +20 -189
- package/dist/packem_chunks/handler12.mjs +176 -115
- package/dist/packem_chunks/handler13.mjs +118 -52
- package/dist/packem_chunks/handler14.mjs +50 -43
- package/dist/packem_chunks/handler15.mjs +27 -6
- package/dist/packem_chunks/handler16.mjs +3 -2
- package/dist/packem_chunks/handler17.mjs +1 -1
- package/dist/packem_chunks/handler18.mjs +3 -3
- package/dist/packem_chunks/handler19.mjs +44 -5
- package/dist/packem_chunks/handler2.mjs +6 -4
- package/dist/packem_chunks/handler20.mjs +2 -2
- package/dist/packem_chunks/handler21.mjs +158 -267
- package/dist/packem_chunks/handler3.mjs +8 -4
- package/dist/packem_chunks/handler4.mjs +2 -2
- package/dist/packem_chunks/handler5.mjs +7 -4
- package/dist/packem_chunks/handler6.mjs +10 -7
- package/dist/packem_chunks/handler7.mjs +2 -2
- package/dist/packem_chunks/handler8.mjs +1 -1
- package/dist/packem_chunks/handler9.mjs +330 -12
- package/dist/packem_chunks/planDevCommand.mjs +762 -81
- package/dist/packem_chunks/runCodegenCommand.mjs +5 -4
- package/dist/packem_chunks/runDeployCommand.mjs +137 -22
- package/dist/packem_chunks/runInitCommand.mjs +1193 -98
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +94 -47
- package/dist/packem_chunks/runResetCommand.mjs +2 -2
- package/dist/packem_chunks/runRpcCommand.mjs +3 -2
- package/dist/packem_shared/{COMMANDS-D3h9Iwvl.mjs → COMMANDS-BOJIDoVY.mjs} +112 -25
- package/dist/packem_shared/{DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs → DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs} +7 -2
- package/dist/packem_shared/{api-spec-CtA6ilu4.mjs → api-spec-Bx0iKbxA.mjs} +3 -1
- package/dist/packem_shared/{buildRegistryIndex-BcYe607_.mjs → buildRegistryIndex-BS5ig822.mjs} +1 -1
- package/dist/packem_shared/codegen-error-DJG-ghs_.mjs +31 -0
- package/dist/packem_shared/{command-BC30oSBW.mjs → command-lYnl4QyF.mjs} +6 -1
- package/dist/packem_shared/{commands-DPKWlqqX.mjs → commands-D5Yxt9VY.mjs} +199 -20
- package/dist/packem_shared/{createLogger-B40gPzQo.mjs → createLogger-CIWSHrTL.mjs} +33 -6
- package/dist/packem_shared/{createRecordingSpawner-DxI3mebw.mjs → createRecordingSpawner-WuSn20kb.mjs} +23 -2
- package/dist/packem_shared/detect-package-manager-v4hHpQd0.mjs +62 -0
- package/dist/packem_shared/{insertSchemaExtension-BuzF6-t2.mjs → insertSchemaExtension-DAqbfr9Z.mjs} +15 -10
- package/dist/packem_shared/{open-url-Dfq6fAyT.mjs → open-url-4PBLY9X0.mjs} +3 -2
- package/dist/packem_shared/{output-format-wUvAN6AL.mjs → output-format-B4642rjE.mjs} +1 -1
- package/dist/packem_shared/{parseManifest--vZf2FY1.mjs → parseManifest-Dbp-Q2q3.mjs} +36 -9
- package/dist/packem_shared/prompt-cancelled-APzX1Im-.mjs +9 -0
- package/dist/packem_shared/runAddCommand-D1hgfqFQ.mjs +4 -0
- package/dist/packem_shared/{storage-2RJBhUC4.mjs → storage-BXU4ax4O.mjs} +1 -1
- package/dist/packem_shared/{tui-prompts-DEiPCKV-.mjs → tui-prompts-BjEN8XgP.mjs} +9 -12
- package/dist/packem_shared/wrangler-secrets-Coni-mER.mjs +49 -0
- package/package.json +19 -14
- package/skills/lunora-quickstart/SKILL.md +26 -5
- package/dist/packem_shared/detect-package-manager-DYp7n3mJ.mjs +0 -61
- package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
- package/dist/packem_shared/runAddCommand-CTRA_JlL.mjs +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, rmSync, mkdtempSync, cpSync, renameSync } from 'node:fs';
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, rmSync, mkdtempSync, lstatSync, cpSync, renameSync } from 'node:fs';
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { detectFramework as detectFramework$1, isInteractive, LUNA_ART, LUNA_NAME, LUNA_SIGNOFF, paintAnswer, BADGES } from '@lunora/config';
|
|
4
4
|
import { walkSync } from '@visulima/fs';
|
|
@@ -6,15 +6,16 @@ import { join as join$1, dirname as dirname$1, basename, resolve, relative } fro
|
|
|
6
6
|
import { downloadTemplate } from 'giget';
|
|
7
7
|
import { modify, applyEdits } from 'jsonc-parser';
|
|
8
8
|
import { join, dirname } from 'node:path';
|
|
9
|
-
import { d as defineHandler } from '../packem_shared/command-
|
|
10
|
-
import { a as detectInstalledManagers, i as installArgsFor } from '../packem_shared/detect-package-manager-
|
|
9
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
10
|
+
import { d as detectPackageManager, a as detectInstalledManagers, i as installArgsFor, r as runScriptCommand } from '../packem_shared/detect-package-manager-v4hHpQd0.mjs';
|
|
11
11
|
import MagicString from 'magic-string';
|
|
12
12
|
import { Project, SyntaxKind } from 'ts-morph';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
13
|
+
import { P as PromptCancelledError } from '../packem_shared/prompt-cancelled-APzX1Im-.mjs';
|
|
14
|
+
import { c as resolveTagVersions, d as resolveSourceRef, e as resolvePinnedSourceRef, f as resolveDistTag, r as runAddCommand } from '../packem_shared/commands-D5Yxt9VY.mjs';
|
|
15
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
16
|
+
import { d as tuiMascot, e as tuiStep, f as tuiMoonrise, t as tuiText, g as tuiHeadline, h as tuiInfo, a as tuiSelect, b as tuiConfirm, w as withTuiSpinner, i as tuiNextSteps, j as tuiTasks, k as tuiMultiSelect, l as withTuiBadgeProgress } from '../packem_shared/tui-prompts-BjEN8XgP.mjs';
|
|
17
|
+
import { logStep } from '../packem_shared/createLogger-CIWSHrTL.mjs';
|
|
18
|
+
import { E as EMAIL_ITEM, p as promptBucketName, w as withStorageBucketName, M as MAIL_DESTINATION_PROMPT, r as resolveTypedDestination, f as withMailDestination, e as promptAuthProvider, c as promptDatabaseName, g as withAuthDatabaseName } from '../packem_shared/storage-BXU4ax4O.mjs';
|
|
18
19
|
import dns from 'node:dns/promises';
|
|
19
20
|
|
|
20
21
|
const GITHUB_CONTENT = `name: Deploy
|
|
@@ -287,6 +288,36 @@ const patchViteConfig = (source) => {
|
|
|
287
288
|
return { changed: true, code: ms.toString() };
|
|
288
289
|
};
|
|
289
290
|
|
|
291
|
+
const NETWORK_ERROR_PATTERN = /enotfound|eai_again|econnrefused|etimedout|network|fetch failed|getaddrinfo/u;
|
|
292
|
+
const NOT_FOUND_ERROR_PATTERN = /404|not found|could not find|no such/u;
|
|
293
|
+
const describeDownloadFailure = (error, context) => {
|
|
294
|
+
const raw = error instanceof Error ? error.message : String(error);
|
|
295
|
+
const lower = raw.toLowerCase();
|
|
296
|
+
const genericMessage = `failed to download template "${context.templateType}" from ${context.remote}: ${raw}`;
|
|
297
|
+
if (NOT_FOUND_ERROR_PATTERN.test(lower)) {
|
|
298
|
+
return {
|
|
299
|
+
hints: [
|
|
300
|
+
`Check the template name "${context.templateType}" and the ref "${context.ref}".`,
|
|
301
|
+
"List/inspect available templates, or target a branch/tag with `--ref <branch>`."
|
|
302
|
+
],
|
|
303
|
+
message: `template "${context.templateType}" not found at ${context.remote}: ${raw}`
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
if (NETWORK_ERROR_PATTERN.test(lower)) {
|
|
307
|
+
return {
|
|
308
|
+
hints: [
|
|
309
|
+
"You appear to be offline or unable to reach GitHub.",
|
|
310
|
+
"To scaffold without a network, point at a local template root: `lunora init --from <dir>`."
|
|
311
|
+
],
|
|
312
|
+
message: genericMessage
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
hints: ["If this is a network/offline issue, scaffold from a local root with `lunora init --from <dir>`."],
|
|
317
|
+
message: genericMessage
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
|
|
290
321
|
const emitStep = async (type, message, answer) => {
|
|
291
322
|
if (isInteractive()) {
|
|
292
323
|
await tuiStep(BADGES[type], message, answer);
|
|
@@ -312,13 +343,20 @@ ${LUNA_NAME}: ${LUNA_SIGNOFF}`);
|
|
|
312
343
|
};
|
|
313
344
|
|
|
314
345
|
const STACK_FEATURE_OPTIONS = [
|
|
346
|
+
{ description: "LLMs via Workers AI (summarize, generate, stream)", label: "AI", value: "ai" },
|
|
315
347
|
{ description: "Sign-up / sign-in (asks which provider)", label: "Authentication", value: "auth" },
|
|
316
|
-
{ description: "
|
|
317
|
-
{ description: "
|
|
318
|
-
{ description: "
|
|
348
|
+
{ description: "Snapshot + restore your Durable Object data", label: "Backups", value: "backup" },
|
|
349
|
+
{ description: "Headless browser screenshots + PDFs", label: "Browser rendering", value: "browser" },
|
|
350
|
+
{ description: "Zero Trust identity via Cloudflare Access", label: "Cloudflare Access", value: "cloudflare-access" },
|
|
319
351
|
{ description: "Scheduled jobs via Cron Triggers (@lunora/scheduler)", label: "Cron jobs", value: "crons" },
|
|
352
|
+
{ description: "Cloudflare Email Workers + a dev mail catcher", label: "Transactional email", value: "email" },
|
|
353
|
+
{ description: "OpenFeature feature flags (ctx.flags)", label: "Feature flags", value: "flags" },
|
|
354
|
+
{ description: "External Postgres/MySQL via Hyperdrive", label: "Hyperdrive", value: "hyperdrive" },
|
|
355
|
+
{ description: "Stripe-first payments (checkout, subscription, webhooks)", label: "Payments", value: "payment" },
|
|
320
356
|
{ description: "Live presence / who's-online over hibernated WebSockets", label: "Presence", value: "presence" },
|
|
321
|
-
{ description: "
|
|
357
|
+
{ description: "Async message queues (push/pull consumers)", label: "Queues", value: "queue" },
|
|
358
|
+
{ description: "Typed R2 buckets + signed URLs (@lunora/storage)", label: "File storage", value: "storage" },
|
|
359
|
+
{ description: "Durable long-running workflows (step.do, sleep, branch)", label: "Workflows", value: "workflow" }
|
|
322
360
|
];
|
|
323
361
|
const STACK_FEATURE_VALUES = STACK_FEATURE_OPTIONS.map((option) => option.value);
|
|
324
362
|
const featureItem = (feature) => feature === "email" ? EMAIL_ITEM : feature;
|
|
@@ -370,7 +408,10 @@ const offerRegistryExtras = async (deps) => {
|
|
|
370
408
|
return;
|
|
371
409
|
}
|
|
372
410
|
if (!deps.interactive) {
|
|
373
|
-
deps.logger.info(
|
|
411
|
+
deps.logger.info(
|
|
412
|
+
// eslint-disable-next-line no-secrets/no-secrets -- the pipe-separated feature list in this tip is a UI prompt, not a credential
|
|
413
|
+
"tip: add features later with `lunora add <ai|auth|backup|browser|cloudflare-access|crons|email|flags|hyperdrive|payment|presence|queue|storage|workflow>`."
|
|
414
|
+
);
|
|
374
415
|
return;
|
|
375
416
|
}
|
|
376
417
|
const picked = await deps.multiSelect("Which features do you want to add?", STACK_FEATURE_OPTIONS, { defaults: [] });
|
|
@@ -385,6 +426,920 @@ const offerRegistryExtras = async (deps) => {
|
|
|
385
426
|
await deps.applyAll(plans);
|
|
386
427
|
};
|
|
387
428
|
|
|
429
|
+
const LOGO_PATH = "M 259.500 10.552 C 220.080 15.859, 182.424 32.566, 152.500 58.025 C 110.179 94.031, 85.380 137.183, 77.518 188.500 C 75.410 202.255, 74.569 225.677, 75.796 236.466 C 76.757 244.917, 76.683 245.692, 74.518 249.966 C 63.118 272.466, 53.141 303.876, 51.382 322.799 L 50.718 329.943 71.960 320.471 C 83.643 315.262, 93.326 311, 93.478 311 C 93.630 311, 96.547 316.063, 99.959 322.250 C 103.371 328.438, 107.249 334.850, 108.577 336.500 L 110.990 339.500 110.981 336 C 110.977 334.075, 111.499 324.991, 112.143 315.813 L 113.312 299.127 121.406 293.336 C 132.495 285.403, 149.593 271.554, 161 261.268 C 171.556 251.748, 189.116 235, 188.540 235 C 188.337 235, 183.069 238.648, 176.835 243.106 C 142.318 267.789, 68.537 314, 63.646 314 C 61.843 314, 72.791 281.179, 80.905 262.259 C 92.233 235.845, 107.473 212.389, 132.106 183.453 L 138.451 176 148.268 176 C 176.192 176, 197.512 187.154, 212.868 209.797 C 216.470 215.108, 217.035 216.595, 216.477 219.297 C 211.386 243.968, 202.359 274.496, 193.797 296 C 183.898 320.861, 167.147 352.101, 152.395 373.215 L 147.004 380.930 152.891 385.830 C 161.400 392.911, 165.563 396, 166.594 395.998 C 167.092 395.998, 168.772 391.641, 170.327 386.317 C 176.279 365.934, 188.422 338.749, 200.942 317.778 C 223.060 280.731, 256.432 244.369, 294.500 215.836 C 309.956 204.252, 313.937 201.603, 314.719 202.385 C 315.116 202.783, 315.449 213.096, 315.460 225.304 C 315.474 241.855, 315.021 250.405, 313.680 258.924 C 307.009 301.272, 291.175 336.677, 263.112 372 C 255.259 381.883, 227.182 410.673, 218.516 417.727 L 213.532 421.783 223.439 424.880 C 281.705 443.093, 349.165 436.018, 398.616 406.508 C 446.728 377.797, 483.322 331.466, 497.366 281.481 C 503.381 260.075, 504.480 250.741, 504.491 221 C 504.501 191.997, 503.598 184.047, 497.987 163.732 C 484.768 115.871, 452.505 72.708, 407.718 42.964 C 381.051 25.254, 352.818 14.828, 319.695 10.460 C 305.932 8.645, 273.298 8.695, 259.500 10.552";
|
|
430
|
+
const WELCOME_CSS = `/* The welcome page is a full-bleed starter — reset the browser's default
|
|
431
|
+
body margin/padding so it sits flush; everything else is scoped under
|
|
432
|
+
.lunora-welcome (collision-safe). */
|
|
433
|
+
body {
|
|
434
|
+
margin: 0;
|
|
435
|
+
padding: 0;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.lunora-welcome {
|
|
439
|
+
--cyan: hsl(186 84% 56%); --violet: hsl(256 72% 68%); --rose: hsl(330 80% 64%);
|
|
440
|
+
--ribbon: linear-gradient(115deg, var(--cyan), var(--violet) 52%, var(--rose));
|
|
441
|
+
--sans: "Geist Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
442
|
+
--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
|
443
|
+
/* NIGHT (default) */
|
|
444
|
+
--bg: #0e0e11; --surface: hsl(240 12% 8% / 0.72); --surface-2: hsl(240 11% 11% / 0.82);
|
|
445
|
+
--line: hsl(0 0% 100% / 0.08); --line-2: hsl(0 0% 100% / 0.14);
|
|
446
|
+
--t-display: hsl(228 30% 97%); --t-primary: hsl(228 26% 90%); --t-secondary: hsl(228 12% 62%); --t-faint: hsl(228 10% 44%);
|
|
447
|
+
--logo: hsl(228 30% 97%); --accent: var(--violet); --shot-bg: hsl(240 12% 6%);
|
|
448
|
+
--glow-1: hsl(256 80% 52% / 0.30); --glow-2: hsl(196 84% 52% / 0.13); --arc: hsl(256 60% 70% / 0.11);
|
|
449
|
+
|
|
450
|
+
position: relative; min-height: 100vh; background: var(--bg); color: var(--t-primary);
|
|
451
|
+
font-family: var(--sans); line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden;
|
|
452
|
+
transition: background .3s, color .3s;
|
|
453
|
+
}
|
|
454
|
+
.lunora-welcome[data-theme="light"] {
|
|
455
|
+
--bg: hsl(228 32% 97%); --surface: hsl(0 0% 100% / 0.82); --surface-2: hsl(0 0% 100% / 0.95);
|
|
456
|
+
--line: hsl(228 16% 88%); --line-2: hsl(228 14% 80%);
|
|
457
|
+
--t-display: hsl(240 14% 10%); --t-primary: hsl(240 12% 18%); --t-secondary: hsl(235 9% 42%); --t-faint: hsl(235 8% 58%);
|
|
458
|
+
--logo: hsl(240 16% 9%); --accent: hsl(256 58% 56%); --shot-bg: hsl(228 26% 99%);
|
|
459
|
+
--glow-1: hsl(256 80% 60% / 0.14); --glow-2: hsl(196 84% 58% / 0.08); --arc: hsl(256 40% 55% / 0.12);
|
|
460
|
+
}
|
|
461
|
+
.lunora-welcome *, .lunora-welcome *::before, .lunora-welcome *::after { box-sizing: border-box; }
|
|
462
|
+
.lunora-welcome a { color: inherit; text-decoration: none; }
|
|
463
|
+
.lunora-welcome button { font-family: inherit; cursor: pointer; }
|
|
464
|
+
.lunora-welcome ::selection { background: hsl(256 72% 68% / 0.3); }
|
|
465
|
+
.lunora-welcome code { font-family: var(--mono); }
|
|
466
|
+
|
|
467
|
+
/* glow background */
|
|
468
|
+
.lunora-welcome .lw-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
|
|
469
|
+
.lunora-welcome .lw-bg .glow { position: absolute; left: 50%; top: -4%; width: 860px; height: 720px; transform: translateX(-50%);
|
|
470
|
+
border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--glow-1), var(--glow-2) 40%, transparent 66%); }
|
|
471
|
+
.lunora-welcome .lw-bg .arc { position: absolute; left: 50%; border-radius: 50%; border: 1px solid var(--arc); transform: translateX(-50%); }
|
|
472
|
+
.lunora-welcome .lw-bg .arc.a1 { top: -340px; width: 980px; height: 980px; }
|
|
473
|
+
.lunora-welcome .lw-bg .arc.a2 { top: -240px; width: 720px; height: 720px; opacity: .7; }
|
|
474
|
+
|
|
475
|
+
/* theme toggle */
|
|
476
|
+
.lunora-welcome .lw-toggle { position: fixed; z-index: 5; top: 20px; right: clamp(16px,4vw,36px); display: inline-flex; align-items: center;
|
|
477
|
+
gap: 7px; border: 1px solid var(--line-2); background: var(--surface); backdrop-filter: blur(12px); color: var(--t-secondary);
|
|
478
|
+
font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; padding: 7px 11px; transition: .15s; }
|
|
479
|
+
.lunora-welcome .lw-toggle:hover { color: var(--t-display); border-color: var(--accent); }
|
|
480
|
+
.lunora-welcome .lw-toggle svg { width: 13px; height: 13px; }
|
|
481
|
+
|
|
482
|
+
.lunora-welcome .lw-wrap { position: relative; z-index: 2; width: 100%; max-width: 1080px; margin: 0 auto;
|
|
483
|
+
padding: clamp(44px,8vh,92px) clamp(20px,5vw,48px); display: flex; flex-direction: column; min-height: 100vh; }
|
|
484
|
+
.lunora-welcome .brand { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: clamp(38px,6vh,68px); color: var(--logo); }
|
|
485
|
+
.lunora-welcome .brand svg { width: 54px; height: auto; display: block; }
|
|
486
|
+
.lunora-welcome .brand .word { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; color: var(--t-display); }
|
|
487
|
+
|
|
488
|
+
.lunora-welcome .grid { display: grid; grid-template-columns: 1.06fr 0.94fr; gap: 16px; align-items: stretch; flex: 1; max-height: 580px; }
|
|
489
|
+
@media (max-width: 820px) { .lunora-welcome .grid { grid-template-columns: 1fr; max-height: none; } }
|
|
490
|
+
|
|
491
|
+
.lunora-welcome .card { border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(10px); transition: border-color .2s, background .2s; }
|
|
492
|
+
.lunora-welcome .card:hover { border-color: var(--line-2); background: var(--surface-2); }
|
|
493
|
+
.lunora-welcome .card:hover .arrow { color: var(--accent); transform: translateX(3px); }
|
|
494
|
+
.lunora-welcome .arrow { color: var(--t-faint); transition: color .2s, transform .2s; }
|
|
495
|
+
.lunora-welcome .arrow svg { width: 20px; height: 20px; display: block; }
|
|
496
|
+
.lunora-welcome .ic { display: grid; place-items: center; color: var(--accent);
|
|
497
|
+
border: 1px solid color-mix(in oklab, var(--accent) 36%, transparent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
|
|
498
|
+
.lunora-welcome .ic svg { display: block; }
|
|
499
|
+
|
|
500
|
+
/* left feature card — stretches to fill the box height */
|
|
501
|
+
.lunora-welcome .feature { padding: clamp(18px,2vw,24px); display: flex; flex-direction: column; }
|
|
502
|
+
.lunora-welcome .shot { border: 1px solid var(--line); overflow: hidden; background: var(--shot-bg);
|
|
503
|
+
-webkit-mask-image: linear-gradient(to bottom, #000 56%, transparent 100%); mask-image: linear-gradient(to bottom, #000 56%, transparent 100%); }
|
|
504
|
+
.lunora-welcome .shot .top { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
|
|
505
|
+
.lunora-welcome .shot .wm { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--t-primary); }
|
|
506
|
+
.lunora-welcome .shot .wm i { width: 11px; height: 11px; background: var(--ribbon); -webkit-mask: radial-gradient(circle,#000 60%,transparent 62%); mask: radial-gradient(circle,#000 60%,transparent 62%); }
|
|
507
|
+
.lunora-welcome .shot .search { flex: 1; height: 22px; border: 1px solid var(--line); border-radius: 4px; }
|
|
508
|
+
.lunora-welcome .shot .ver { font-family: var(--mono); font-size: 8px; letter-spacing: .08em; color: var(--t-faint); }
|
|
509
|
+
.lunora-welcome .shot .body { display: grid; grid-template-columns: 92px 1fr; min-height: 224px; }
|
|
510
|
+
.lunora-welcome .shot .nav { border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 11px; }
|
|
511
|
+
.lunora-welcome .shot .nav i, .lunora-welcome .shot .doc i { height: 5px; border-radius: 2px; background: var(--line); }
|
|
512
|
+
.lunora-welcome .shot .doc { padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; }
|
|
513
|
+
.lunora-welcome .shot .doc .h { height: 8px; width: 46%; border-radius: 2px; background: var(--line-2); margin-bottom: 5px; }
|
|
514
|
+
.lunora-welcome .shot .doc .accent { height: 5px; width: 26%; border-radius: 2px; background: var(--accent); }
|
|
515
|
+
.lunora-welcome .feature .info { margin-top: auto; padding-top: clamp(18px,2.4vh,28px); }
|
|
516
|
+
.lunora-welcome .feature .ic { width: 40px; height: 40px; margin-bottom: 15px; }
|
|
517
|
+
.lunora-welcome .feature .ic svg { width: 19px; height: 19px; }
|
|
518
|
+
.lunora-welcome .feature h2 { margin: 0 0 10px; font-size: 19px; font-weight: 600; letter-spacing: -0.015em; color: var(--t-display); }
|
|
519
|
+
.lunora-welcome .feature .row { display: flex; align-items: flex-end; gap: 16px; }
|
|
520
|
+
.lunora-welcome .feature p { margin: 0; color: var(--t-secondary); font-size: 14px; max-width: 50ch; }
|
|
521
|
+
.lunora-welcome .feature .row .arrow { margin-left: auto; }
|
|
522
|
+
|
|
523
|
+
/* right stack — smaller cards, spread to align bottoms with the feature */
|
|
524
|
+
.lunora-welcome .stack { display: flex; flex-direction: column; gap: 16px; height: 100%; }
|
|
525
|
+
.lunora-welcome .mini { flex: 1; padding: 15px 17px; display: flex; align-items: center; gap: 16px; min-height: 0; }
|
|
526
|
+
.lunora-welcome .mini .mc { flex: 1; }
|
|
527
|
+
.lunora-welcome .mini .ic { width: 32px; height: 32px; margin-bottom: 10px; }
|
|
528
|
+
.lunora-welcome .mini .ic svg { width: 16px; height: 16px; }
|
|
529
|
+
.lunora-welcome .mini h3 { margin: 0 0 5px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--t-display); }
|
|
530
|
+
.lunora-welcome .mini p { margin: 0; color: var(--t-secondary); font-size: 12.5px; line-height: 1.45; }
|
|
531
|
+
|
|
532
|
+
.lunora-welcome .lw-foot { text-align: center; padding-top: 26px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--t-faint); }
|
|
533
|
+
|
|
534
|
+
@media (prefers-reduced-motion: reduce) { .lunora-welcome * { transition: none !important; } }
|
|
535
|
+
`;
|
|
536
|
+
const REACT_APP = `import { useEffect, useState } from "react";
|
|
537
|
+
|
|
538
|
+
type Theme = "dark" | "light";
|
|
539
|
+
|
|
540
|
+
export default function App() {
|
|
541
|
+
// Default to "dark" for a stable first paint, then reconcile to the OS
|
|
542
|
+
// preference; the toggle takes over after that.
|
|
543
|
+
const [theme, setTheme] = useState<Theme>("dark");
|
|
544
|
+
|
|
545
|
+
useEffect(() => {
|
|
546
|
+
if (typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: light)").matches) {
|
|
547
|
+
setTheme("light");
|
|
548
|
+
}
|
|
549
|
+
}, []);
|
|
550
|
+
|
|
551
|
+
const isLight = theme === "light";
|
|
552
|
+
|
|
553
|
+
return (
|
|
554
|
+
<div className="lunora-welcome" data-theme={theme}>
|
|
555
|
+
<div className="lw-bg">
|
|
556
|
+
<div className="arc a1" />
|
|
557
|
+
<div className="arc a2" />
|
|
558
|
+
<div className="glow" />
|
|
559
|
+
</div>
|
|
560
|
+
|
|
561
|
+
<button className="lw-toggle" type="button" aria-label="Toggle color theme" onClick={() => setTheme(isLight ? "dark" : "light")}>
|
|
562
|
+
{isLight ? (
|
|
563
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8">
|
|
564
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
565
|
+
</svg>
|
|
566
|
+
) : (
|
|
567
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8">
|
|
568
|
+
<circle cx="12" cy="12" r="4" />
|
|
569
|
+
<path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" />
|
|
570
|
+
</svg>
|
|
571
|
+
)}
|
|
572
|
+
<span>{isLight ? "Ivory" : "Night"}</span>
|
|
573
|
+
</button>
|
|
574
|
+
|
|
575
|
+
<div className="lw-wrap">
|
|
576
|
+
<div className="brand">
|
|
577
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
578
|
+
<path d="${LOGO_PATH}" fill="currentColor" fillRule="evenodd" />
|
|
579
|
+
</svg>
|
|
580
|
+
<span className="word">Lunora</span>
|
|
581
|
+
</div>
|
|
582
|
+
|
|
583
|
+
<div className="grid">
|
|
584
|
+
<a className="card feature" href="https://lunora.sh/docs">
|
|
585
|
+
<div className="shot" aria-hidden="true">
|
|
586
|
+
<div className="top">
|
|
587
|
+
<span className="wm">
|
|
588
|
+
<i /> Lunora
|
|
589
|
+
</span>
|
|
590
|
+
<span className="search" />
|
|
591
|
+
<span className="ver">v0.1</span>
|
|
592
|
+
</div>
|
|
593
|
+
<div className="body">
|
|
594
|
+
<div className="nav">
|
|
595
|
+
<i style={{ width: "80%" }} />
|
|
596
|
+
<i style={{ width: "60%" }} />
|
|
597
|
+
<i style={{ width: "72%" }} />
|
|
598
|
+
<i style={{ width: "50%" }} />
|
|
599
|
+
<i style={{ width: "66%" }} />
|
|
600
|
+
<i style={{ width: "44%" }} />
|
|
601
|
+
<i style={{ width: "58%" }} />
|
|
602
|
+
</div>
|
|
603
|
+
<div className="doc">
|
|
604
|
+
<span className="h" />
|
|
605
|
+
<i style={{ width: "92%" }} />
|
|
606
|
+
<i style={{ width: "88%" }} />
|
|
607
|
+
<span className="accent" />
|
|
608
|
+
<i style={{ width: "80%" }} />
|
|
609
|
+
<i style={{ width: "90%" }} />
|
|
610
|
+
<i style={{ width: "72%" }} />
|
|
611
|
+
<i style={{ width: "84%" }} />
|
|
612
|
+
<i style={{ width: "78%" }} />
|
|
613
|
+
</div>
|
|
614
|
+
</div>
|
|
615
|
+
</div>
|
|
616
|
+
<div className="info">
|
|
617
|
+
<span className="ic">
|
|
618
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7">
|
|
619
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
620
|
+
<path d="M14 3v5h5" />
|
|
621
|
+
</svg>
|
|
622
|
+
</span>
|
|
623
|
+
<h2>Documentation</h2>
|
|
624
|
+
<div className="row">
|
|
625
|
+
<p>
|
|
626
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
627
|
+
you'll have a live app fast.
|
|
628
|
+
</p>
|
|
629
|
+
<span className="arrow">
|
|
630
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
631
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
632
|
+
</svg>
|
|
633
|
+
</span>
|
|
634
|
+
</div>
|
|
635
|
+
</div>
|
|
636
|
+
</a>
|
|
637
|
+
|
|
638
|
+
<div className="stack">
|
|
639
|
+
<a className="card mini" href="https://lunora.sh/blog">
|
|
640
|
+
<div className="mc">
|
|
641
|
+
<span className="ic">
|
|
642
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7">
|
|
643
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
644
|
+
</svg>
|
|
645
|
+
</span>
|
|
646
|
+
<h3>Blog</h3>
|
|
647
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
648
|
+
</div>
|
|
649
|
+
<span className="arrow">
|
|
650
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
651
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
652
|
+
</svg>
|
|
653
|
+
</span>
|
|
654
|
+
</a>
|
|
655
|
+
<a className="card mini" href="/_lunora">
|
|
656
|
+
<div className="mc">
|
|
657
|
+
<span className="ic">
|
|
658
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7">
|
|
659
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
660
|
+
<path d="M3 9h18M9 21V9" />
|
|
661
|
+
</svg>
|
|
662
|
+
</span>
|
|
663
|
+
<h3>Lunora Studio</h3>
|
|
664
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
665
|
+
</div>
|
|
666
|
+
<span className="arrow">
|
|
667
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
668
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
669
|
+
</svg>
|
|
670
|
+
</span>
|
|
671
|
+
</a>
|
|
672
|
+
<a className="card mini" href="https://lunora.sh/packages">
|
|
673
|
+
<div className="mc">
|
|
674
|
+
<span className="ic">
|
|
675
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7">
|
|
676
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
677
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
678
|
+
</svg>
|
|
679
|
+
</span>
|
|
680
|
+
<h3>Cloudflare ecosystem</h3>
|
|
681
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
682
|
+
</div>
|
|
683
|
+
<span className="arrow">
|
|
684
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
685
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
686
|
+
</svg>
|
|
687
|
+
</span>
|
|
688
|
+
</a>
|
|
689
|
+
</div>
|
|
690
|
+
</div>
|
|
691
|
+
|
|
692
|
+
<div className="lw-foot">Running on Lunora · Vite + React</div>
|
|
693
|
+
</div>
|
|
694
|
+
</div>
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
`;
|
|
698
|
+
const VUE_APP = `<script setup lang="ts">
|
|
699
|
+
import { onMounted, ref } from "vue";
|
|
700
|
+
|
|
701
|
+
// Default to "dark" for a stable first paint, then reconcile to the OS
|
|
702
|
+
// preference; the toggle takes over after that.
|
|
703
|
+
const theme = ref<"dark" | "light">("dark");
|
|
704
|
+
|
|
705
|
+
onMounted(() => {
|
|
706
|
+
if (window.matchMedia("(prefers-color-scheme: light)").matches) {
|
|
707
|
+
theme.value = "light";
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
const toggle = (): void => {
|
|
712
|
+
theme.value = theme.value === "light" ? "dark" : "light";
|
|
713
|
+
};
|
|
714
|
+
<\/script>
|
|
715
|
+
|
|
716
|
+
<template>
|
|
717
|
+
<div class="lunora-welcome" :data-theme="theme">
|
|
718
|
+
<div class="lw-bg">
|
|
719
|
+
<div class="arc a1" />
|
|
720
|
+
<div class="arc a2" />
|
|
721
|
+
<div class="glow" />
|
|
722
|
+
</div>
|
|
723
|
+
|
|
724
|
+
<button class="lw-toggle" type="button" aria-label="Toggle color theme" @click="toggle">
|
|
725
|
+
<svg v-if="theme === 'light'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
726
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
727
|
+
</svg>
|
|
728
|
+
<svg v-else viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
729
|
+
<circle cx="12" cy="12" r="4" />
|
|
730
|
+
<path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" />
|
|
731
|
+
</svg>
|
|
732
|
+
<span>{{ theme === "light" ? "Ivory" : "Night" }}</span>
|
|
733
|
+
</button>
|
|
734
|
+
|
|
735
|
+
<div class="lw-wrap">
|
|
736
|
+
<div class="brand">
|
|
737
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
738
|
+
<path d="${LOGO_PATH}" fill="currentColor" fill-rule="evenodd" />
|
|
739
|
+
</svg>
|
|
740
|
+
<span class="word">Lunora</span>
|
|
741
|
+
</div>
|
|
742
|
+
|
|
743
|
+
<div class="grid">
|
|
744
|
+
<a class="card feature" href="https://lunora.sh/docs">
|
|
745
|
+
<div class="shot" aria-hidden="true">
|
|
746
|
+
<div class="top">
|
|
747
|
+
<span class="wm"><i /> Lunora</span>
|
|
748
|
+
<span class="search" />
|
|
749
|
+
<span class="ver">v0.1</span>
|
|
750
|
+
</div>
|
|
751
|
+
<div class="body">
|
|
752
|
+
<div class="nav">
|
|
753
|
+
<i style="width: 80%" />
|
|
754
|
+
<i style="width: 60%" />
|
|
755
|
+
<i style="width: 72%" />
|
|
756
|
+
<i style="width: 50%" />
|
|
757
|
+
<i style="width: 66%" />
|
|
758
|
+
<i style="width: 44%" />
|
|
759
|
+
<i style="width: 58%" />
|
|
760
|
+
</div>
|
|
761
|
+
<div class="doc">
|
|
762
|
+
<span class="h" />
|
|
763
|
+
<i style="width: 92%" />
|
|
764
|
+
<i style="width: 88%" />
|
|
765
|
+
<span class="accent" />
|
|
766
|
+
<i style="width: 80%" />
|
|
767
|
+
<i style="width: 90%" />
|
|
768
|
+
<i style="width: 72%" />
|
|
769
|
+
<i style="width: 84%" />
|
|
770
|
+
<i style="width: 78%" />
|
|
771
|
+
</div>
|
|
772
|
+
</div>
|
|
773
|
+
</div>
|
|
774
|
+
<div class="info">
|
|
775
|
+
<span class="ic">
|
|
776
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
777
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
778
|
+
<path d="M14 3v5h5" />
|
|
779
|
+
</svg>
|
|
780
|
+
</span>
|
|
781
|
+
<h2>Documentation</h2>
|
|
782
|
+
<div class="row">
|
|
783
|
+
<p>
|
|
784
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
785
|
+
you'll have a live app fast.
|
|
786
|
+
</p>
|
|
787
|
+
<span class="arrow">
|
|
788
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
789
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
790
|
+
</svg>
|
|
791
|
+
</span>
|
|
792
|
+
</div>
|
|
793
|
+
</div>
|
|
794
|
+
</a>
|
|
795
|
+
|
|
796
|
+
<div class="stack">
|
|
797
|
+
<a class="card mini" href="https://lunora.sh/blog">
|
|
798
|
+
<div class="mc">
|
|
799
|
+
<span class="ic">
|
|
800
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
801
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
802
|
+
</svg>
|
|
803
|
+
</span>
|
|
804
|
+
<h3>Blog</h3>
|
|
805
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
806
|
+
</div>
|
|
807
|
+
<span class="arrow">
|
|
808
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
809
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
810
|
+
</svg>
|
|
811
|
+
</span>
|
|
812
|
+
</a>
|
|
813
|
+
<a class="card mini" href="/_lunora">
|
|
814
|
+
<div class="mc">
|
|
815
|
+
<span class="ic">
|
|
816
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
817
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
818
|
+
<path d="M3 9h18M9 21V9" />
|
|
819
|
+
</svg>
|
|
820
|
+
</span>
|
|
821
|
+
<h3>Lunora Studio</h3>
|
|
822
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
823
|
+
</div>
|
|
824
|
+
<span class="arrow">
|
|
825
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
826
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
827
|
+
</svg>
|
|
828
|
+
</span>
|
|
829
|
+
</a>
|
|
830
|
+
<a class="card mini" href="https://lunora.sh/packages">
|
|
831
|
+
<div class="mc">
|
|
832
|
+
<span class="ic">
|
|
833
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
834
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
835
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
836
|
+
</svg>
|
|
837
|
+
</span>
|
|
838
|
+
<h3>Cloudflare ecosystem</h3>
|
|
839
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
840
|
+
</div>
|
|
841
|
+
<span class="arrow">
|
|
842
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
843
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
844
|
+
</svg>
|
|
845
|
+
</span>
|
|
846
|
+
</a>
|
|
847
|
+
</div>
|
|
848
|
+
</div>
|
|
849
|
+
|
|
850
|
+
<div class="lw-foot">Running on Lunora · Vite + Vue</div>
|
|
851
|
+
</div>
|
|
852
|
+
</div>
|
|
853
|
+
</template>
|
|
854
|
+
`;
|
|
855
|
+
const SOLID_APP = `import { createSignal, onMount } from "solid-js";
|
|
856
|
+
|
|
857
|
+
export default function App() {
|
|
858
|
+
// Default to "dark" for a stable first paint, then reconcile to the OS
|
|
859
|
+
// preference; the toggle takes over after that.
|
|
860
|
+
const [theme, setTheme] = createSignal<"dark" | "light">("dark");
|
|
861
|
+
|
|
862
|
+
onMount(() => {
|
|
863
|
+
if (window.matchMedia("(prefers-color-scheme: light)").matches) {
|
|
864
|
+
setTheme("light");
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
const isLight = () => theme() === "light";
|
|
869
|
+
|
|
870
|
+
return (
|
|
871
|
+
<div class="lunora-welcome" data-theme={theme()}>
|
|
872
|
+
<div class="lw-bg">
|
|
873
|
+
<div class="arc a1" />
|
|
874
|
+
<div class="arc a2" />
|
|
875
|
+
<div class="glow" />
|
|
876
|
+
</div>
|
|
877
|
+
|
|
878
|
+
<button class="lw-toggle" type="button" aria-label="Toggle color theme" onClick={() => setTheme(isLight() ? "dark" : "light")}>
|
|
879
|
+
{isLight() ? (
|
|
880
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
881
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
882
|
+
</svg>
|
|
883
|
+
) : (
|
|
884
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
885
|
+
<circle cx="12" cy="12" r="4" />
|
|
886
|
+
<path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" />
|
|
887
|
+
</svg>
|
|
888
|
+
)}
|
|
889
|
+
<span>{isLight() ? "Ivory" : "Night"}</span>
|
|
890
|
+
</button>
|
|
891
|
+
|
|
892
|
+
<div class="lw-wrap">
|
|
893
|
+
<div class="brand">
|
|
894
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
895
|
+
<path d="${LOGO_PATH}" fill="currentColor" fill-rule="evenodd" />
|
|
896
|
+
</svg>
|
|
897
|
+
<span class="word">Lunora</span>
|
|
898
|
+
</div>
|
|
899
|
+
|
|
900
|
+
<div class="grid">
|
|
901
|
+
<a class="card feature" href="https://lunora.sh/docs">
|
|
902
|
+
<div class="shot" aria-hidden="true">
|
|
903
|
+
<div class="top">
|
|
904
|
+
<span class="wm">
|
|
905
|
+
<i /> Lunora
|
|
906
|
+
</span>
|
|
907
|
+
<span class="search" />
|
|
908
|
+
<span class="ver">v0.1</span>
|
|
909
|
+
</div>
|
|
910
|
+
<div class="body">
|
|
911
|
+
<div class="nav">
|
|
912
|
+
<i style={{ width: "80%" }} />
|
|
913
|
+
<i style={{ width: "60%" }} />
|
|
914
|
+
<i style={{ width: "72%" }} />
|
|
915
|
+
<i style={{ width: "50%" }} />
|
|
916
|
+
<i style={{ width: "66%" }} />
|
|
917
|
+
<i style={{ width: "44%" }} />
|
|
918
|
+
<i style={{ width: "58%" }} />
|
|
919
|
+
</div>
|
|
920
|
+
<div class="doc">
|
|
921
|
+
<span class="h" />
|
|
922
|
+
<i style={{ width: "92%" }} />
|
|
923
|
+
<i style={{ width: "88%" }} />
|
|
924
|
+
<span class="accent" />
|
|
925
|
+
<i style={{ width: "80%" }} />
|
|
926
|
+
<i style={{ width: "90%" }} />
|
|
927
|
+
<i style={{ width: "72%" }} />
|
|
928
|
+
<i style={{ width: "84%" }} />
|
|
929
|
+
<i style={{ width: "78%" }} />
|
|
930
|
+
</div>
|
|
931
|
+
</div>
|
|
932
|
+
</div>
|
|
933
|
+
<div class="info">
|
|
934
|
+
<span class="ic">
|
|
935
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
936
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
937
|
+
<path d="M14 3v5h5" />
|
|
938
|
+
</svg>
|
|
939
|
+
</span>
|
|
940
|
+
<h2>Documentation</h2>
|
|
941
|
+
<div class="row">
|
|
942
|
+
<p>
|
|
943
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
944
|
+
you'll have a live app fast.
|
|
945
|
+
</p>
|
|
946
|
+
<span class="arrow">
|
|
947
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
948
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
949
|
+
</svg>
|
|
950
|
+
</span>
|
|
951
|
+
</div>
|
|
952
|
+
</div>
|
|
953
|
+
</a>
|
|
954
|
+
|
|
955
|
+
<div class="stack">
|
|
956
|
+
<a class="card mini" href="https://lunora.sh/blog">
|
|
957
|
+
<div class="mc">
|
|
958
|
+
<span class="ic">
|
|
959
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
960
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
961
|
+
</svg>
|
|
962
|
+
</span>
|
|
963
|
+
<h3>Blog</h3>
|
|
964
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
965
|
+
</div>
|
|
966
|
+
<span class="arrow">
|
|
967
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
968
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
969
|
+
</svg>
|
|
970
|
+
</span>
|
|
971
|
+
</a>
|
|
972
|
+
<a class="card mini" href="/_lunora">
|
|
973
|
+
<div class="mc">
|
|
974
|
+
<span class="ic">
|
|
975
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
976
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
977
|
+
<path d="M3 9h18M9 21V9" />
|
|
978
|
+
</svg>
|
|
979
|
+
</span>
|
|
980
|
+
<h3>Lunora Studio</h3>
|
|
981
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
982
|
+
</div>
|
|
983
|
+
<span class="arrow">
|
|
984
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
985
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
986
|
+
</svg>
|
|
987
|
+
</span>
|
|
988
|
+
</a>
|
|
989
|
+
<a class="card mini" href="https://lunora.sh/packages">
|
|
990
|
+
<div class="mc">
|
|
991
|
+
<span class="ic">
|
|
992
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
993
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
994
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
995
|
+
</svg>
|
|
996
|
+
</span>
|
|
997
|
+
<h3>Cloudflare ecosystem</h3>
|
|
998
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
999
|
+
</div>
|
|
1000
|
+
<span class="arrow">
|
|
1001
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1002
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1003
|
+
</svg>
|
|
1004
|
+
</span>
|
|
1005
|
+
</a>
|
|
1006
|
+
</div>
|
|
1007
|
+
</div>
|
|
1008
|
+
|
|
1009
|
+
<div class="lw-foot">Running on Lunora · Vite + Solid</div>
|
|
1010
|
+
</div>
|
|
1011
|
+
</div>
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
`;
|
|
1015
|
+
const SVELTE_APP = `<script lang="ts">
|
|
1016
|
+
import { onMount } from "svelte";
|
|
1017
|
+
|
|
1018
|
+
// Default to "dark" for a stable first paint, then reconcile to the OS
|
|
1019
|
+
// preference; the toggle takes over after that.
|
|
1020
|
+
let theme = $state<"dark" | "light">("dark");
|
|
1021
|
+
const isLight = $derived(theme === "light");
|
|
1022
|
+
|
|
1023
|
+
onMount(() => {
|
|
1024
|
+
if (window.matchMedia("(prefers-color-scheme: light)").matches) {
|
|
1025
|
+
theme = "light";
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
const toggle = (): void => {
|
|
1030
|
+
theme = theme === "light" ? "dark" : "light";
|
|
1031
|
+
};
|
|
1032
|
+
<\/script>
|
|
1033
|
+
|
|
1034
|
+
<div class="lunora-welcome" data-theme={theme}>
|
|
1035
|
+
<div class="lw-bg">
|
|
1036
|
+
<div class="arc a1"></div>
|
|
1037
|
+
<div class="arc a2"></div>
|
|
1038
|
+
<div class="glow"></div>
|
|
1039
|
+
</div>
|
|
1040
|
+
|
|
1041
|
+
<button class="lw-toggle" type="button" aria-label="Toggle color theme" onclick={toggle}>
|
|
1042
|
+
{#if isLight}
|
|
1043
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
1044
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
1045
|
+
</svg>
|
|
1046
|
+
{:else}
|
|
1047
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
1048
|
+
<circle cx="12" cy="12" r="4" />
|
|
1049
|
+
<path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" />
|
|
1050
|
+
</svg>
|
|
1051
|
+
{/if}
|
|
1052
|
+
<span>{isLight ? "Ivory" : "Night"}</span>
|
|
1053
|
+
</button>
|
|
1054
|
+
|
|
1055
|
+
<div class="lw-wrap">
|
|
1056
|
+
<div class="brand">
|
|
1057
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
1058
|
+
<path d="${LOGO_PATH}" fill="currentColor" fill-rule="evenodd" />
|
|
1059
|
+
</svg>
|
|
1060
|
+
<span class="word">Lunora</span>
|
|
1061
|
+
</div>
|
|
1062
|
+
|
|
1063
|
+
<div class="grid">
|
|
1064
|
+
<a class="card feature" href="https://lunora.sh/docs">
|
|
1065
|
+
<div class="shot" aria-hidden="true">
|
|
1066
|
+
<div class="top">
|
|
1067
|
+
<span class="wm"><i></i> Lunora</span>
|
|
1068
|
+
<span class="search"></span>
|
|
1069
|
+
<span class="ver">v0.1</span>
|
|
1070
|
+
</div>
|
|
1071
|
+
<div class="body">
|
|
1072
|
+
<div class="nav">
|
|
1073
|
+
<i style="width: 80%"></i>
|
|
1074
|
+
<i style="width: 60%"></i>
|
|
1075
|
+
<i style="width: 72%"></i>
|
|
1076
|
+
<i style="width: 50%"></i>
|
|
1077
|
+
<i style="width: 66%"></i>
|
|
1078
|
+
<i style="width: 44%"></i>
|
|
1079
|
+
<i style="width: 58%"></i>
|
|
1080
|
+
</div>
|
|
1081
|
+
<div class="doc">
|
|
1082
|
+
<span class="h"></span>
|
|
1083
|
+
<i style="width: 92%"></i>
|
|
1084
|
+
<i style="width: 88%"></i>
|
|
1085
|
+
<span class="accent"></span>
|
|
1086
|
+
<i style="width: 80%"></i>
|
|
1087
|
+
<i style="width: 90%"></i>
|
|
1088
|
+
<i style="width: 72%"></i>
|
|
1089
|
+
<i style="width: 84%"></i>
|
|
1090
|
+
<i style="width: 78%"></i>
|
|
1091
|
+
</div>
|
|
1092
|
+
</div>
|
|
1093
|
+
</div>
|
|
1094
|
+
<div class="info">
|
|
1095
|
+
<span class="ic">
|
|
1096
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1097
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
1098
|
+
<path d="M14 3v5h5" />
|
|
1099
|
+
</svg>
|
|
1100
|
+
</span>
|
|
1101
|
+
<h2>Documentation</h2>
|
|
1102
|
+
<div class="row">
|
|
1103
|
+
<p>
|
|
1104
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
1105
|
+
you'll have a live app fast.
|
|
1106
|
+
</p>
|
|
1107
|
+
<span class="arrow">
|
|
1108
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1109
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1110
|
+
</svg>
|
|
1111
|
+
</span>
|
|
1112
|
+
</div>
|
|
1113
|
+
</div>
|
|
1114
|
+
</a>
|
|
1115
|
+
|
|
1116
|
+
<div class="stack">
|
|
1117
|
+
<a class="card mini" href="https://lunora.sh/blog">
|
|
1118
|
+
<div class="mc">
|
|
1119
|
+
<span class="ic">
|
|
1120
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1121
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
1122
|
+
</svg>
|
|
1123
|
+
</span>
|
|
1124
|
+
<h3>Blog</h3>
|
|
1125
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
1126
|
+
</div>
|
|
1127
|
+
<span class="arrow">
|
|
1128
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1129
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1130
|
+
</svg>
|
|
1131
|
+
</span>
|
|
1132
|
+
</a>
|
|
1133
|
+
<a class="card mini" href="/_lunora">
|
|
1134
|
+
<div class="mc">
|
|
1135
|
+
<span class="ic">
|
|
1136
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1137
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
1138
|
+
<path d="M3 9h18M9 21V9" />
|
|
1139
|
+
</svg>
|
|
1140
|
+
</span>
|
|
1141
|
+
<h3>Lunora Studio</h3>
|
|
1142
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
1143
|
+
</div>
|
|
1144
|
+
<span class="arrow">
|
|
1145
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1146
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1147
|
+
</svg>
|
|
1148
|
+
</span>
|
|
1149
|
+
</a>
|
|
1150
|
+
<a class="card mini" href="https://lunora.sh/packages">
|
|
1151
|
+
<div class="mc">
|
|
1152
|
+
<span class="ic">
|
|
1153
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1154
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
1155
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
1156
|
+
</svg>
|
|
1157
|
+
</span>
|
|
1158
|
+
<h3>Cloudflare ecosystem</h3>
|
|
1159
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
1160
|
+
</div>
|
|
1161
|
+
<span class="arrow">
|
|
1162
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1163
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1164
|
+
</svg>
|
|
1165
|
+
</span>
|
|
1166
|
+
</a>
|
|
1167
|
+
</div>
|
|
1168
|
+
</div>
|
|
1169
|
+
|
|
1170
|
+
<div class="lw-foot">Running on Lunora · Vite + Svelte</div>
|
|
1171
|
+
</div>
|
|
1172
|
+
</div>
|
|
1173
|
+
`;
|
|
1174
|
+
const VANILLA_MAIN = `import "./style.css";
|
|
1175
|
+
|
|
1176
|
+
import { LunoraClient } from "lunorash/client";
|
|
1177
|
+
|
|
1178
|
+
import { api } from "#lunora/_generated/api.js";
|
|
1179
|
+
|
|
1180
|
+
// \`@lunora/vite\` runs the Worker on the same origin as Vite, so default to
|
|
1181
|
+
// \`location.origin\`. Point \`VITE_LUNORA_URL\` at a deployed Worker to develop
|
|
1182
|
+
// the client against production data.
|
|
1183
|
+
const url = (import.meta.env.VITE_LUNORA_URL as string | undefined) ?? globalThis.location.origin;
|
|
1184
|
+
const client = new LunoraClient({ url });
|
|
1185
|
+
|
|
1186
|
+
const MOON_ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" /></svg>';
|
|
1187
|
+
const SUN_ICON =
|
|
1188
|
+
'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" /></svg>';
|
|
1189
|
+
|
|
1190
|
+
const welcomeHtml = \`
|
|
1191
|
+
<div class="lw-bg">
|
|
1192
|
+
<div class="arc a1"></div>
|
|
1193
|
+
<div class="arc a2"></div>
|
|
1194
|
+
<div class="glow"></div>
|
|
1195
|
+
</div>
|
|
1196
|
+
|
|
1197
|
+
<button class="lw-toggle" type="button" aria-label="Toggle color theme"></button>
|
|
1198
|
+
|
|
1199
|
+
<div class="lw-wrap">
|
|
1200
|
+
<div class="brand">
|
|
1201
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
1202
|
+
<path d="${LOGO_PATH}" fill="currentColor" fill-rule="evenodd" />
|
|
1203
|
+
</svg>
|
|
1204
|
+
<span class="word">Lunora</span>
|
|
1205
|
+
</div>
|
|
1206
|
+
|
|
1207
|
+
<div class="grid">
|
|
1208
|
+
<a class="card feature" href="https://lunora.sh/docs">
|
|
1209
|
+
<div class="shot" aria-hidden="true">
|
|
1210
|
+
<div class="top">
|
|
1211
|
+
<span class="wm"><i></i> Lunora</span>
|
|
1212
|
+
<span class="search"></span>
|
|
1213
|
+
<span class="ver">v0.1</span>
|
|
1214
|
+
</div>
|
|
1215
|
+
<div class="body">
|
|
1216
|
+
<div class="nav">
|
|
1217
|
+
<i style="width: 80%"></i>
|
|
1218
|
+
<i style="width: 60%"></i>
|
|
1219
|
+
<i style="width: 72%"></i>
|
|
1220
|
+
<i style="width: 50%"></i>
|
|
1221
|
+
<i style="width: 66%"></i>
|
|
1222
|
+
<i style="width: 44%"></i>
|
|
1223
|
+
<i style="width: 58%"></i>
|
|
1224
|
+
</div>
|
|
1225
|
+
<div class="doc">
|
|
1226
|
+
<span class="h"></span>
|
|
1227
|
+
<i style="width: 92%"></i>
|
|
1228
|
+
<i style="width: 88%"></i>
|
|
1229
|
+
<span class="accent"></span>
|
|
1230
|
+
<i style="width: 80%"></i>
|
|
1231
|
+
<i style="width: 90%"></i>
|
|
1232
|
+
<i style="width: 72%"></i>
|
|
1233
|
+
<i style="width: 84%"></i>
|
|
1234
|
+
<i style="width: 78%"></i>
|
|
1235
|
+
</div>
|
|
1236
|
+
</div>
|
|
1237
|
+
</div>
|
|
1238
|
+
<div class="info">
|
|
1239
|
+
<span class="ic">
|
|
1240
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1241
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
1242
|
+
<path d="M14 3v5h5" />
|
|
1243
|
+
</svg>
|
|
1244
|
+
</span>
|
|
1245
|
+
<h2>Documentation</h2>
|
|
1246
|
+
<div class="row">
|
|
1247
|
+
<p>
|
|
1248
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
1249
|
+
you'll have a live app fast.
|
|
1250
|
+
</p>
|
|
1251
|
+
<span class="arrow">
|
|
1252
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1253
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1254
|
+
</svg>
|
|
1255
|
+
</span>
|
|
1256
|
+
</div>
|
|
1257
|
+
</div>
|
|
1258
|
+
</a>
|
|
1259
|
+
|
|
1260
|
+
<div class="stack">
|
|
1261
|
+
<a class="card mini" href="https://lunora.sh/blog">
|
|
1262
|
+
<div class="mc">
|
|
1263
|
+
<span class="ic">
|
|
1264
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1265
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
1266
|
+
</svg>
|
|
1267
|
+
</span>
|
|
1268
|
+
<h3>Blog</h3>
|
|
1269
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
1270
|
+
</div>
|
|
1271
|
+
<span class="arrow">
|
|
1272
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1273
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1274
|
+
</svg>
|
|
1275
|
+
</span>
|
|
1276
|
+
</a>
|
|
1277
|
+
<a class="card mini" href="/_lunora">
|
|
1278
|
+
<div class="mc">
|
|
1279
|
+
<span class="ic">
|
|
1280
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1281
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
1282
|
+
<path d="M3 9h18M9 21V9" />
|
|
1283
|
+
</svg>
|
|
1284
|
+
</span>
|
|
1285
|
+
<h3>Lunora Studio</h3>
|
|
1286
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
1287
|
+
</div>
|
|
1288
|
+
<span class="arrow">
|
|
1289
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1290
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1291
|
+
</svg>
|
|
1292
|
+
</span>
|
|
1293
|
+
</a>
|
|
1294
|
+
<a class="card mini" href="https://lunora.sh/packages">
|
|
1295
|
+
<div class="mc">
|
|
1296
|
+
<span class="ic">
|
|
1297
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1298
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
1299
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
1300
|
+
</svg>
|
|
1301
|
+
</span>
|
|
1302
|
+
<h3>Cloudflare ecosystem</h3>
|
|
1303
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
1304
|
+
</div>
|
|
1305
|
+
<span class="arrow">
|
|
1306
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1307
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1308
|
+
</svg>
|
|
1309
|
+
</span>
|
|
1310
|
+
</a>
|
|
1311
|
+
</div>
|
|
1312
|
+
</div>
|
|
1313
|
+
|
|
1314
|
+
<div class="lw-foot">Running on Lunora · Vite + Vanilla · <span id="lw-count">0</span> messages</div>
|
|
1315
|
+
</div>
|
|
1316
|
+
\`;
|
|
1317
|
+
|
|
1318
|
+
const root = document.querySelector<HTMLDivElement>("#app")!;
|
|
1319
|
+
root.classList.add("lunora-welcome");
|
|
1320
|
+
root.innerHTML = welcomeHtml;
|
|
1321
|
+
|
|
1322
|
+
// Theme toggle: flip the root's data-theme + swap the button's icon/label.
|
|
1323
|
+
const toggleButton = root.querySelector<HTMLButtonElement>(".lw-toggle")!;
|
|
1324
|
+
|
|
1325
|
+
const paintToggle = (theme: "dark" | "light"): void => {
|
|
1326
|
+
root.dataset.theme = theme;
|
|
1327
|
+
toggleButton.innerHTML = \`\${theme === "light" ? MOON_ICON : SUN_ICON}<span>\${theme === "light" ? "Ivory" : "Night"}</span>\`;
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
paintToggle(window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark");
|
|
1331
|
+
toggleButton.addEventListener("click", () => {
|
|
1332
|
+
paintToggle(root.dataset.theme === "light" ? "dark" : "light");
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
// Live demo: the message count of a demo channel re-renders on every delta.
|
|
1336
|
+
const count = document.querySelector<HTMLSpanElement>("#lw-count")!;
|
|
1337
|
+
|
|
1338
|
+
client.onUpdate(api.messages.list, { channelId: "channel:demo" }, (result) => {
|
|
1339
|
+
count.textContent = String(result.messages.length);
|
|
1340
|
+
});
|
|
1341
|
+
`;
|
|
1342
|
+
|
|
388
1343
|
const READ_URL = `const url = (import.meta.env.VITE_LUNORA_URL as string | undefined) ?? globalThis.location.origin;`;
|
|
389
1344
|
const REACT_MAIN = `import "./index.css";
|
|
390
1345
|
|
|
@@ -471,51 +1426,103 @@ const app = mount(Root, { target: document.getElementById("app")! });
|
|
|
471
1426
|
|
|
472
1427
|
export default app;
|
|
473
1428
|
`;
|
|
474
|
-
const VANILLA_MAIN = `import "./style.css";
|
|
475
|
-
|
|
476
|
-
import { LunoraClient } from "lunorash/client";
|
|
477
|
-
|
|
478
|
-
import { api } from "../lunora/_generated/api";
|
|
479
|
-
|
|
480
|
-
// Vanilla starter: no framework provider — talk to Lunora through the client
|
|
481
|
-
// directly. \`@lunora/vite\` runs the Worker on the same origin as Vite.
|
|
482
|
-
${READ_URL}
|
|
483
|
-
const client = new LunoraClient({ url });
|
|
484
|
-
|
|
485
|
-
const root = document.querySelector<HTMLDivElement>("#app")!;
|
|
486
|
-
|
|
487
|
-
const heading = document.createElement("h1");
|
|
488
|
-
heading.textContent = "Vite + Lunora";
|
|
489
|
-
|
|
490
|
-
const output = document.createElement("pre");
|
|
491
|
-
root.replaceChildren(heading, output);
|
|
492
|
-
|
|
493
|
-
const render = (messages: unknown): void => {
|
|
494
|
-
// textContent (not innerHTML) — never inject server data as markup.
|
|
495
|
-
output.textContent = JSON.stringify(messages, null, 2);
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
// Live subscription: the list re-renders on every server delta.
|
|
499
|
-
client.onUpdate(api.messages.list, { channelId: "channel:demo" }, render);
|
|
500
|
-
`;
|
|
501
1429
|
const ADAPTERS = {
|
|
502
|
-
react: {
|
|
503
|
-
|
|
1430
|
+
react: {
|
|
1431
|
+
adapter: "@lunora/react",
|
|
1432
|
+
createViteTemplate: "react-ts",
|
|
1433
|
+
files: [
|
|
1434
|
+
{ contents: REACT_MAIN, path: "src/main.tsx" },
|
|
1435
|
+
{ contents: REACT_APP, path: "src/App.tsx" },
|
|
1436
|
+
{ contents: WELCOME_CSS, path: "src/index.css" }
|
|
1437
|
+
],
|
|
1438
|
+
label: "React"
|
|
1439
|
+
},
|
|
1440
|
+
solid: {
|
|
1441
|
+
adapter: "@lunora/solid",
|
|
1442
|
+
createViteTemplate: "solid-ts",
|
|
1443
|
+
files: [
|
|
1444
|
+
{ contents: SOLID_INDEX, path: "src/index.tsx" },
|
|
1445
|
+
{ contents: SOLID_APP, path: "src/App.tsx" },
|
|
1446
|
+
{ contents: WELCOME_CSS, path: "src/index.css" }
|
|
1447
|
+
],
|
|
1448
|
+
label: "Solid"
|
|
1449
|
+
},
|
|
504
1450
|
svelte: {
|
|
505
1451
|
adapter: "@lunora/svelte",
|
|
506
1452
|
createViteTemplate: "svelte-ts",
|
|
507
1453
|
files: [
|
|
508
1454
|
{ contents: SVELTE_ROOT, path: "src/Root.svelte" },
|
|
509
|
-
{ contents: SVELTE_MAIN, path: "src/main.ts" }
|
|
1455
|
+
{ contents: SVELTE_MAIN, path: "src/main.ts" },
|
|
1456
|
+
{ contents: SVELTE_APP, path: "src/App.svelte" },
|
|
1457
|
+
{ contents: WELCOME_CSS, path: "src/app.css" }
|
|
510
1458
|
],
|
|
511
1459
|
label: "Svelte"
|
|
512
1460
|
},
|
|
513
|
-
vanilla: {
|
|
514
|
-
|
|
1461
|
+
vanilla: {
|
|
1462
|
+
adapter: "lunorash/client",
|
|
1463
|
+
createViteTemplate: "vanilla-ts",
|
|
1464
|
+
files: [
|
|
1465
|
+
{ contents: VANILLA_MAIN, path: "src/main.ts" },
|
|
1466
|
+
{ contents: WELCOME_CSS, path: "src/style.css" }
|
|
1467
|
+
],
|
|
1468
|
+
label: "Vanilla"
|
|
1469
|
+
},
|
|
1470
|
+
vue: {
|
|
1471
|
+
adapter: "@lunora/vue",
|
|
1472
|
+
createViteTemplate: "vue-ts",
|
|
1473
|
+
files: [
|
|
1474
|
+
{ contents: VUE_MAIN, path: "src/main.ts" },
|
|
1475
|
+
{ contents: VUE_APP, path: "src/App.vue" },
|
|
1476
|
+
{ contents: WELCOME_CSS, path: "src/style.css" }
|
|
1477
|
+
],
|
|
1478
|
+
label: "Vue"
|
|
1479
|
+
}
|
|
515
1480
|
};
|
|
516
1481
|
const isOverlayFramework = (value) => Object.hasOwn(ADAPTERS, value);
|
|
517
1482
|
|
|
518
|
-
const
|
|
1483
|
+
const RATELIMIT_SCHEMA = `import type { Middleware } from "lunorash/server";
|
|
1484
|
+
import { defineSchemaExtension, defineTable, definePlugin, v } from "lunorash/server";
|
|
1485
|
+
import { createDbStore, RateLimiter } from "lunorash/ratelimit";
|
|
1486
|
+
import type { RateLimitConfigMap } from "lunorash/ratelimit";
|
|
1487
|
+
|
|
1488
|
+
export const limits = {
|
|
1489
|
+
default: { kind: "token bucket", period: 60_000, rate: 10 },
|
|
1490
|
+
} as const satisfies RateLimitConfigMap;
|
|
1491
|
+
|
|
1492
|
+
export type LimitName = keyof typeof limits;
|
|
1493
|
+
|
|
1494
|
+
export const makeRateLimiter = (ctx: { db: unknown }): RateLimiter<LimitName> =>
|
|
1495
|
+
new RateLimiter<LimitName>({
|
|
1496
|
+
config: limits,
|
|
1497
|
+
store: createDbStore({ db: ctx.db as never, table: "ratelimit_buckets" }),
|
|
1498
|
+
});
|
|
1499
|
+
|
|
1500
|
+
const middleware: Middleware<{ api?: Record<string, unknown>; db: unknown }, { api: Record<string, unknown>; db: unknown }> = ({ ctx, next }) =>
|
|
1501
|
+
next({
|
|
1502
|
+
ctx: {
|
|
1503
|
+
...ctx,
|
|
1504
|
+
api: { ...ctx.api, ratelimit: makeRateLimiter(ctx) },
|
|
1505
|
+
},
|
|
1506
|
+
});
|
|
1507
|
+
|
|
1508
|
+
export const ratelimit = definePlugin("ratelimit", {
|
|
1509
|
+
extension: defineSchemaExtension("ratelimit", {
|
|
1510
|
+
tables: {
|
|
1511
|
+
buckets: defineTable({
|
|
1512
|
+
key: v.string(),
|
|
1513
|
+
value: v.number(),
|
|
1514
|
+
ts: v.number(),
|
|
1515
|
+
prev: v.optional(v.number()),
|
|
1516
|
+
})
|
|
1517
|
+
.index("by_key", ["key"])
|
|
1518
|
+
.externallyManaged(),
|
|
1519
|
+
},
|
|
1520
|
+
}),
|
|
1521
|
+
middleware,
|
|
1522
|
+
});
|
|
1523
|
+
`;
|
|
1524
|
+
const LUNORA_SCHEMA = `import { ratelimit } from "./ratelimit/schema.js";
|
|
1525
|
+
import { defineSchema, defineTable, v } from "lunorash/server";
|
|
519
1526
|
|
|
520
1527
|
export default defineSchema({
|
|
521
1528
|
messages: defineTable({
|
|
@@ -524,17 +1531,36 @@ export default defineSchema({
|
|
|
524
1531
|
})
|
|
525
1532
|
.shardBy("channelId")
|
|
526
1533
|
.index("by_channel", ["channelId"]),
|
|
527
|
-
});
|
|
1534
|
+
}).extend(ratelimit.extension);
|
|
528
1535
|
`;
|
|
529
|
-
const LUNORA_MESSAGES = `import {
|
|
1536
|
+
const LUNORA_MESSAGES = `import { RateLimiter, rateLimit, createDbStore } from "lunorash/ratelimit";
|
|
1537
|
+
|
|
1538
|
+
import { mutation, query, v } from "#lunora/_generated/server.js";
|
|
530
1539
|
|
|
531
|
-
|
|
532
|
-
|
|
1540
|
+
const limiter = (ctx: { db: unknown }) => new RateLimiter({
|
|
1541
|
+
config: {
|
|
1542
|
+
send: { kind: "token bucket", period: 60_000, rate: 30 },
|
|
1543
|
+
},
|
|
1544
|
+
store: createDbStore({ db: ctx.db as never, table: "ratelimit_buckets" }),
|
|
533
1545
|
});
|
|
534
1546
|
|
|
535
|
-
export const
|
|
536
|
-
|
|
1547
|
+
export const list = query.input({ channelId: v.string().meta({ schema: { maxLength: 256 } }), limit: v.optional(v.number()) }).query(async ({ args, ctx }) => {
|
|
1548
|
+
const messages = await ctx.db
|
|
1549
|
+
.query("messages")
|
|
1550
|
+
.withIndex("by_channel", (q) => q.eq("channelId", args.channelId))
|
|
1551
|
+
.take(args.limit ?? 50);
|
|
1552
|
+
|
|
1553
|
+
return { channelId: args.channelId, messages };
|
|
537
1554
|
});
|
|
1555
|
+
|
|
1556
|
+
export const send = mutation
|
|
1557
|
+
.input({ channelId: v.string().meta({ schema: { maxLength: 256 } }), text: v.string().meta({ schema: { maxLength: 4096 } }) })
|
|
1558
|
+
.use(rateLimit(limiter, "send", { key: (ctx) => ctx.auth.userId ?? "anon" }))
|
|
1559
|
+
.mutation(async ({ args, ctx }) => {
|
|
1560
|
+
const id = await ctx.db.insert("messages", { channelId: args.channelId, text: args.text });
|
|
1561
|
+
|
|
1562
|
+
return { channelId: args.channelId, id, text: args.text };
|
|
1563
|
+
});
|
|
538
1564
|
`;
|
|
539
1565
|
const SERVER_ENTRY = `import type { ShardNamespaceLike } from "lunorash/runtime";
|
|
540
1566
|
|
|
@@ -595,15 +1621,17 @@ const ensureGitignore = (target) => {
|
|
|
595
1621
|
${missing.join("\n")}
|
|
596
1622
|
`, "utf8");
|
|
597
1623
|
};
|
|
598
|
-
const
|
|
1624
|
+
const isLunoraDep$1 = (name) => name === "lunorash" || name.startsWith("@lunora/");
|
|
1625
|
+
const stampRange = (name, range, distTag, versions) => isLunoraDep$1(name) ? versions?.get(name) ?? distTag : range;
|
|
599
1626
|
const withDependency = (map, name, range, distTag) => {
|
|
600
1627
|
return { ...map, [name]: stampRange(name, range, distTag) };
|
|
601
1628
|
};
|
|
602
|
-
const restampLunora = (map, distTag) => Object.fromEntries(Object.entries(map).map(([name, range]) => [name, stampRange(name, range, distTag)]));
|
|
603
|
-
const patchPackageJson = (target, name, adapter, distTag) => {
|
|
1629
|
+
const restampLunora = (map, distTag, versions) => Object.fromEntries(Object.entries(map).map(([name, range]) => [name, stampRange(name, range, distTag, versions)]));
|
|
1630
|
+
const patchPackageJson = async (target, name, adapter, distTag) => {
|
|
604
1631
|
const path = join$1(target, "package.json");
|
|
605
1632
|
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
606
1633
|
let dependencies = withDependency(parsed.dependencies ?? {}, "lunorash", distTag, distTag);
|
|
1634
|
+
dependencies = withDependency(dependencies, "@lunora/ratelimit", distTag, distTag);
|
|
607
1635
|
if (adapter.adapter.startsWith("@lunora/")) {
|
|
608
1636
|
dependencies = withDependency(dependencies, adapter.adapter, distTag, distTag);
|
|
609
1637
|
}
|
|
@@ -611,12 +1639,16 @@ const patchPackageJson = (target, name, adapter, distTag) => {
|
|
|
611
1639
|
dependencies = withDependency(dependencies, depName, range, distTag);
|
|
612
1640
|
}
|
|
613
1641
|
let devDependencies = withDependency(parsed.devDependencies ?? {}, "@lunora/vite", distTag, distTag);
|
|
1642
|
+
devDependencies = withDependency(devDependencies, "@lunora/studio", distTag, distTag);
|
|
614
1643
|
for (const [depName, range] of Object.entries(COMMON_DEV_DEPENDENCIES)) {
|
|
615
1644
|
devDependencies = withDependency(devDependencies, depName, range, distTag);
|
|
616
1645
|
}
|
|
1646
|
+
const lunoraNames = [...Object.keys(dependencies), ...Object.keys(devDependencies)].filter((depName) => isLunoraDep$1(depName));
|
|
1647
|
+
const versions = await resolveTagVersions(lunoraNames, distTag);
|
|
617
1648
|
parsed.name = name;
|
|
618
|
-
parsed.
|
|
619
|
-
parsed.
|
|
1649
|
+
parsed.imports = { ...parsed.imports, "#lunora/*": "./lunora/*" };
|
|
1650
|
+
parsed.dependencies = restampLunora(dependencies, distTag, versions);
|
|
1651
|
+
parsed.devDependencies = restampLunora(devDependencies, distTag, versions);
|
|
620
1652
|
parsed.scripts = { ...parsed.scripts, codegen: "lunora codegen", deploy: "vite build && lunora deploy" };
|
|
621
1653
|
writeFileSync(path, `${JSON.stringify(parsed, void 0, 4)}
|
|
622
1654
|
`, "utf8");
|
|
@@ -632,9 +1664,10 @@ const patchBaseViteConfig = (target, logger) => {
|
|
|
632
1664
|
writeFileSync(candidate, result.code, "utf8");
|
|
633
1665
|
}
|
|
634
1666
|
};
|
|
635
|
-
const applyLunoraOverlay = (options) => {
|
|
1667
|
+
const applyLunoraOverlay = async (options) => {
|
|
636
1668
|
const { adapter, distTag, logger, name, target } = options;
|
|
637
1669
|
const written = [];
|
|
1670
|
+
writeFile(target, join$1("lunora", "ratelimit", "schema.ts"), RATELIMIT_SCHEMA, written);
|
|
638
1671
|
writeFile(target, join$1("lunora", "schema.ts"), LUNORA_SCHEMA, written);
|
|
639
1672
|
writeFile(target, join$1("lunora", "messages.ts"), LUNORA_MESSAGES, written);
|
|
640
1673
|
writeFile(target, join$1("src", "server.ts"), SERVER_ENTRY, written);
|
|
@@ -644,7 +1677,7 @@ const applyLunoraOverlay = (options) => {
|
|
|
644
1677
|
writeFile(target, file.path, file.contents, written);
|
|
645
1678
|
}
|
|
646
1679
|
patchBaseViteConfig(target, logger);
|
|
647
|
-
patchPackageJson(target, name, adapter, distTag);
|
|
1680
|
+
await patchPackageJson(target, name, adapter, distTag);
|
|
648
1681
|
ensureGitignore(target);
|
|
649
1682
|
return written;
|
|
650
1683
|
};
|
|
@@ -791,7 +1824,27 @@ const isTextFile = (filePath) => {
|
|
|
791
1824
|
};
|
|
792
1825
|
const substitute = (content, name) => content.replaceAll("{{name}}", name);
|
|
793
1826
|
const isLunoraDep = (name) => name === "lunorash" || name.startsWith("@lunora/");
|
|
794
|
-
const
|
|
1827
|
+
const resolveLunoraVersions = async (files, distTag) => {
|
|
1828
|
+
const names = /* @__PURE__ */ new Set();
|
|
1829
|
+
for (const file of files) {
|
|
1830
|
+
if (basename(file) !== "package.json") {
|
|
1831
|
+
continue;
|
|
1832
|
+
}
|
|
1833
|
+
try {
|
|
1834
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
1835
|
+
for (const section of ["dependencies", "devDependencies"]) {
|
|
1836
|
+
for (const name of Object.keys(parsed[section] ?? {})) {
|
|
1837
|
+
if (isLunoraDep(name)) {
|
|
1838
|
+
names.add(name);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
} catch {
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
return resolveTagVersions(names, distTag);
|
|
1846
|
+
};
|
|
1847
|
+
const stampLunoraDeps = (packageJsonText, distTag, versions) => {
|
|
795
1848
|
let parsed;
|
|
796
1849
|
try {
|
|
797
1850
|
parsed = JSON.parse(packageJsonText);
|
|
@@ -804,23 +1857,50 @@ const stampLunoraDeps = (packageJsonText, distTag) => {
|
|
|
804
1857
|
if (!isLunoraDep(name)) {
|
|
805
1858
|
continue;
|
|
806
1859
|
}
|
|
807
|
-
const
|
|
1860
|
+
const pin = versions.get(name) ?? distTag;
|
|
1861
|
+
const edits = modify(text, [section, name], pin, { formattingOptions: { insertSpaces: true, tabSize: 4 } });
|
|
808
1862
|
text = applyEdits(text, edits);
|
|
809
1863
|
}
|
|
810
1864
|
}
|
|
811
1865
|
return text;
|
|
812
1866
|
};
|
|
1867
|
+
const PNPM_BUILT_DEPENDENCIES = [
|
|
1868
|
+
"@parcel/watcher",
|
|
1869
|
+
"esbuild",
|
|
1870
|
+
"lmdb",
|
|
1871
|
+
"msgpackr-extract",
|
|
1872
|
+
"rs-module-lexer",
|
|
1873
|
+
"sharp",
|
|
1874
|
+
"unrs-resolver",
|
|
1875
|
+
"workerd"
|
|
1876
|
+
];
|
|
1877
|
+
const PNPM_DENIED_BUILD_DEPENDENCIES = ["cpu-features", "protobufjs", "ssh2"];
|
|
1878
|
+
const PNPM_WORKSPACE_FILENAME = "pnpm-workspace.yaml";
|
|
1879
|
+
const pnpmWorkspaceYaml = () => [
|
|
1880
|
+
"# pnpm reads its settings from here (the package.json `pnpm` field is no longer read).",
|
|
1881
|
+
"# Pre-approve the toolchain's native build scripts so `pnpm install` runs them",
|
|
1882
|
+
"# without the interactive `pnpm approve-builds` step; deny the optional native",
|
|
1883
|
+
"# builds a scaffold doesn't need (so no C/C++ toolchain is required).",
|
|
1884
|
+
"allowBuilds:",
|
|
1885
|
+
...PNPM_BUILT_DEPENDENCIES.map((name) => ` '${name}': true`),
|
|
1886
|
+
...PNPM_DENIED_BUILD_DEPENDENCIES.map((name) => ` '${name}': false`),
|
|
1887
|
+
""
|
|
1888
|
+
].join("\n");
|
|
813
1889
|
const collectFiles = (directory) => {
|
|
814
1890
|
const out = [];
|
|
815
1891
|
for (const entry of walkSync(directory, { includeDirs: false, includeFiles: true })) {
|
|
1892
|
+
if (lstatSync(entry.path).isSymbolicLink()) {
|
|
1893
|
+
continue;
|
|
1894
|
+
}
|
|
816
1895
|
out.push(entry.path);
|
|
817
1896
|
}
|
|
818
1897
|
return out;
|
|
819
1898
|
};
|
|
820
|
-
const copyTemplate = (sourceDirectory, target, name) => {
|
|
1899
|
+
const copyTemplate = async (sourceDirectory, target, name) => {
|
|
821
1900
|
const files = collectFiles(sourceDirectory);
|
|
822
1901
|
const written = [];
|
|
823
1902
|
const distTag = resolveDistTag();
|
|
1903
|
+
const versions = await resolveLunoraVersions(files, distTag);
|
|
824
1904
|
for (const source of files) {
|
|
825
1905
|
const relativePath = relative(sourceDirectory, source);
|
|
826
1906
|
const destination = join$1(target, relativePath);
|
|
@@ -828,7 +1908,7 @@ const copyTemplate = (sourceDirectory, target, name) => {
|
|
|
828
1908
|
const raw = readFileSync(source);
|
|
829
1909
|
let text = isTextFile(source) ? substitute(raw.toString("utf8"), name) : void 0;
|
|
830
1910
|
if (text !== void 0 && basename(source) === "package.json") {
|
|
831
|
-
text = stampLunoraDeps(text, distTag);
|
|
1911
|
+
text = stampLunoraDeps(text, distTag, versions);
|
|
832
1912
|
}
|
|
833
1913
|
if (text === void 0) {
|
|
834
1914
|
writeFileSync(destination, raw);
|
|
@@ -860,14 +1940,9 @@ const logScaffoldSuccess = (logger, written, target) => {
|
|
|
860
1940
|
}
|
|
861
1941
|
logger.success(`scaffolded ${String(written.length)} files into ${target}`);
|
|
862
1942
|
};
|
|
863
|
-
const
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
}
|
|
867
|
-
if (manager === "bun") {
|
|
868
|
-
return `bun run ${script}`;
|
|
869
|
-
}
|
|
870
|
-
return `${manager} ${script}`;
|
|
1943
|
+
const installCommand = (manager, packages) => {
|
|
1944
|
+
const verb = manager === "npm" ? "install" : "add";
|
|
1945
|
+
return `${manager} ${verb} ${packages.join(" ")}`;
|
|
871
1946
|
};
|
|
872
1947
|
const isInsideMonorepo = (startDirectory) => {
|
|
873
1948
|
let directory = resolve(startDirectory);
|
|
@@ -925,8 +2000,7 @@ const maybeOfferGit = async (options, target) => {
|
|
|
925
2000
|
options.logger.warn("`git init` failed — initialize it yourself later with `git init`.");
|
|
926
2001
|
}
|
|
927
2002
|
};
|
|
928
|
-
const printNextSteps = async (name, installed, insideMonorepo) => {
|
|
929
|
-
const manager = installed ?? "pnpm";
|
|
2003
|
+
const printNextSteps = async (name, installed, manager, insideMonorepo) => {
|
|
930
2004
|
const steps = [{ code: `cd ./${name}`, lead: "Enter your project directory using" }];
|
|
931
2005
|
if (installed === void 0) {
|
|
932
2006
|
steps.push({ code: `${manager} install`, lead: "Install dependencies with", tail: insideMonorepo ? " from the workspace root" : void 0 });
|
|
@@ -979,9 +2053,16 @@ const maybeOfferInstall = async (options, target) => {
|
|
|
979
2053
|
logWould(options.logger, `install dependencies with ${manager}`);
|
|
980
2054
|
return void 0;
|
|
981
2055
|
}
|
|
2056
|
+
if (manager === "pnpm") {
|
|
2057
|
+
const workspacePath = join$1(target, PNPM_WORKSPACE_FILENAME);
|
|
2058
|
+
if (!existsSync(workspacePath)) {
|
|
2059
|
+
writeFileSync(workspacePath, pnpmWorkspaceYaml(), "utf8");
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
982
2062
|
const spawner = options.spawner ?? defaultSpawner;
|
|
983
2063
|
const { args, command } = installArgsFor(manager);
|
|
984
|
-
|
|
2064
|
+
await emitStep("deps", `Installing dependencies with ${manager}…`);
|
|
2065
|
+
const result = await spawner({ args, command, cwd: target });
|
|
985
2066
|
if (result.code !== 0) {
|
|
986
2067
|
options.logger.warn(`\`${command} install\` exited with code ${String(result.code)} — run it yourself in ${basename(target)}/.`);
|
|
987
2068
|
return void 0;
|
|
@@ -989,13 +2070,13 @@ const maybeOfferInstall = async (options, target) => {
|
|
|
989
2070
|
await emitStep("deps", `Dependencies installed with ${manager}.`);
|
|
990
2071
|
return manager;
|
|
991
2072
|
};
|
|
992
|
-
const scaffoldFromLocal = (fromRoot, templateType, target, name, logger) => {
|
|
2073
|
+
const scaffoldFromLocal = async (fromRoot, templateType, target, name, logger) => {
|
|
993
2074
|
const templateDirectory = join$1(fromRoot, templateType);
|
|
994
2075
|
if (!existsSync(templateDirectory)) {
|
|
995
2076
|
logger.error(`template not found in local source: ${templateDirectory}`);
|
|
996
2077
|
return { code: 1, files: [], target };
|
|
997
2078
|
}
|
|
998
|
-
const written = copyTemplate(templateDirectory, target, name);
|
|
2079
|
+
const written = await copyTemplate(templateDirectory, target, name);
|
|
999
2080
|
logScaffoldSuccess(logger, written, target);
|
|
1000
2081
|
return { code: 0, files: written, target };
|
|
1001
2082
|
};
|
|
@@ -1004,7 +2085,8 @@ const scaffoldFromRemote = async (options) => {
|
|
|
1004
2085
|
const stagingRoot = mkdtempSync(join$1(tmpdir(), "lunora-init-fetch-"));
|
|
1005
2086
|
const stagingDirectory = join$1(stagingRoot, "template");
|
|
1006
2087
|
try {
|
|
1007
|
-
const
|
|
2088
|
+
const pinnedRef = source !== void 0 && source.length > 0 ? ref : await resolvePinnedSourceRef(ref, logger);
|
|
2089
|
+
const remote = resolveTemplateSource(templateType, source, pinnedRef);
|
|
1008
2090
|
let downloaded;
|
|
1009
2091
|
let written = [];
|
|
1010
2092
|
await tuiTasks(
|
|
@@ -1023,9 +2105,8 @@ const scaffoldFromRemote = async (options) => {
|
|
|
1023
2105
|
},
|
|
1024
2106
|
{
|
|
1025
2107
|
label: `files copied into ${name}/`,
|
|
1026
|
-
run: () => {
|
|
1027
|
-
written = copyTemplate(stagingDirectory, target, name);
|
|
1028
|
-
return Promise.resolve();
|
|
2108
|
+
run: async () => {
|
|
2109
|
+
written = await copyTemplate(stagingDirectory, target, name);
|
|
1029
2110
|
}
|
|
1030
2111
|
}
|
|
1031
2112
|
],
|
|
@@ -1044,8 +2125,15 @@ const scaffoldFromRemote = async (options) => {
|
|
|
1044
2125
|
if (error instanceof PromptCancelledError) {
|
|
1045
2126
|
throw error;
|
|
1046
2127
|
}
|
|
1047
|
-
const
|
|
1048
|
-
|
|
2128
|
+
const { hints, message } = describeDownloadFailure(error, {
|
|
2129
|
+
ref: resolveSourceRef(ref),
|
|
2130
|
+
remote: resolveTemplateSource(templateType, source, ref),
|
|
2131
|
+
templateType
|
|
2132
|
+
});
|
|
2133
|
+
logger.error(message);
|
|
2134
|
+
for (const hint of hints) {
|
|
2135
|
+
logger.warn(hint);
|
|
2136
|
+
}
|
|
1049
2137
|
return { code: 1, files: [], target };
|
|
1050
2138
|
} finally {
|
|
1051
2139
|
rmSync(stagingRoot, { force: true, recursive: true });
|
|
@@ -1089,9 +2177,8 @@ const scaffoldViteOverlay = async (options) => {
|
|
|
1089
2177
|
{ label: `create-vite (${adapter.label}) base ready`, run: copyBase },
|
|
1090
2178
|
{
|
|
1091
2179
|
label: `Lunora overlay applied (${adapter.label})`,
|
|
1092
|
-
run: () => {
|
|
1093
|
-
written = applyLunoraOverlay({ adapter, distTag: resolveDistTag(), logger, name, target });
|
|
1094
|
-
return Promise.resolve();
|
|
2180
|
+
run: async () => {
|
|
2181
|
+
written = await applyLunoraOverlay({ adapter, distTag: resolveDistTag(), logger, name, target });
|
|
1095
2182
|
}
|
|
1096
2183
|
}
|
|
1097
2184
|
],
|
|
@@ -1170,12 +2257,12 @@ const scaffoldLunoraDirectory = (cwd, logger) => {
|
|
|
1170
2257
|
}
|
|
1171
2258
|
return written;
|
|
1172
2259
|
};
|
|
1173
|
-
const printFrameworkNextSteps = (detection, logger) => {
|
|
2260
|
+
const printFrameworkNextSteps = (detection, manager, logger) => {
|
|
1174
2261
|
const { adapter, class: frameworkClass, framework } = detection;
|
|
1175
2262
|
logger.info("");
|
|
1176
2263
|
logger.info(`detected framework: ${framework} (class ${frameworkClass})`);
|
|
1177
2264
|
logger.info("next steps:");
|
|
1178
|
-
logger.info(` 1. install the adapter:
|
|
2265
|
+
logger.info(` 1. install the adapter: ${installCommand(manager, [adapter, "@lunora/client", "@lunora/runtime", "@lunora/server"])}`);
|
|
1179
2266
|
logger.info(" 2. run codegen: lunora codegen");
|
|
1180
2267
|
if (frameworkClass === "A") {
|
|
1181
2268
|
logger.info(" 3. compose one worker: wrap your worker entry with");
|
|
@@ -1221,7 +2308,7 @@ const runInPlaceInit = (cwd, logger) => {
|
|
|
1221
2308
|
return viteResult;
|
|
1222
2309
|
}
|
|
1223
2310
|
const scaffolded = scaffoldLunoraDirectory(cwd, logger);
|
|
1224
|
-
printFrameworkNextSteps(detection, logger);
|
|
2311
|
+
printFrameworkNextSteps(detection, detectPackageManager(cwd), logger);
|
|
1225
2312
|
return { code: 0, files: [...viteResult.files, ...scaffolded], target: cwd };
|
|
1226
2313
|
};
|
|
1227
2314
|
const offerIsInteractive = (options) => options.yes !== true && (options.prompt !== void 0 || (options.interactive ?? isInteractive()));
|
|
@@ -1238,16 +2325,17 @@ const maybeOfferExtras = async (options, projectDirectory) => {
|
|
|
1238
2325
|
logWould(options.logger, `add ${plans.map((plan) => plan.label).join(", ")}`);
|
|
1239
2326
|
return true;
|
|
1240
2327
|
}
|
|
2328
|
+
const buffered = [];
|
|
1241
2329
|
const applyLogger = isInteractive() ? {
|
|
1242
2330
|
error: (message) => {
|
|
1243
|
-
|
|
2331
|
+
buffered.push({ level: "error", message });
|
|
1244
2332
|
},
|
|
1245
2333
|
info: () => {
|
|
1246
2334
|
},
|
|
1247
2335
|
success: () => {
|
|
1248
2336
|
},
|
|
1249
2337
|
warn: (message) => {
|
|
1250
|
-
|
|
2338
|
+
buffered.push({ level: "warn", message });
|
|
1251
2339
|
}
|
|
1252
2340
|
} : options.logger;
|
|
1253
2341
|
const steps = plans.map((plan) => {
|
|
@@ -1268,6 +2356,9 @@ const maybeOfferExtras = async (options, projectDirectory) => {
|
|
|
1268
2356
|
});
|
|
1269
2357
|
const done = `added ${plans.map((plan) => plan.label).join(", ")}`;
|
|
1270
2358
|
const results = await withTuiBadgeProgress(BADGES.add, steps, done);
|
|
2359
|
+
for (const { level, message } of buffered) {
|
|
2360
|
+
options.logger[level](message);
|
|
2361
|
+
}
|
|
1271
2362
|
return results.every((result) => result.code === 0);
|
|
1272
2363
|
};
|
|
1273
2364
|
const deps = {
|
|
@@ -1295,6 +2386,7 @@ const FRAMEWORK_CHOICES = [
|
|
|
1295
2386
|
{ description: "Vue SPA — create-vite base + Lunora", label: "Vue", value: "vue" },
|
|
1296
2387
|
{ description: "Solid SPA — create-vite base + Lunora", label: "Solid", value: "solid" },
|
|
1297
2388
|
{ description: "Svelte SPA — create-vite base + Lunora", label: "Svelte", value: "svelte" },
|
|
2389
|
+
{ description: "Next.js (App Router) — OpenNext on Cloudflare + a standalone Lunora worker", label: "Next.js", value: "next" },
|
|
1298
2390
|
{ description: "TanStack Start (React) — SSR with live-loader routes", label: "TanStack Start · React", value: "tanstack-start-react" },
|
|
1299
2391
|
{ description: "TanStack Start (Solid)", label: "TanStack Start · Solid", value: "tanstack-start-solid" },
|
|
1300
2392
|
{ description: "React Router (v7, framework mode) — SSR composed into the Lunora worker", label: "React Router", value: "react-router" },
|
|
@@ -1302,6 +2394,7 @@ const FRAMEWORK_CHOICES = [
|
|
|
1302
2394
|
{ description: "AnalogJS (Angular) — single-worker, Lunora mounted in Nitro", label: "Analog", value: "analog" },
|
|
1303
2395
|
{ description: "Nuxt (Vue) — single-worker, Lunora mounted in Nitro", label: "Nuxt", value: "nuxt" },
|
|
1304
2396
|
{ description: "SvelteKit + a standalone Lunora worker", label: "SvelteKit", value: "sveltekit" },
|
|
2397
|
+
{ description: "React Native (Expo) — an iOS/Android/web app + a Lunora worker backend", label: "React Native · Expo", value: "expo" },
|
|
1305
2398
|
{ description: "Worker only — no frontend", label: "Standalone", value: "standalone" }
|
|
1306
2399
|
];
|
|
1307
2400
|
const OVERLAY_VALUES = Object.keys(ADAPTERS).join("|");
|
|
@@ -1347,12 +2440,8 @@ const scaffoldOverlayPath = async (options, framework, name, target) => {
|
|
|
1347
2440
|
return scaffoldViteOverlay({ framework, logger: options.logger, name, overlayBaseFrom: options.overlayBaseFrom, target });
|
|
1348
2441
|
};
|
|
1349
2442
|
const scaffoldTemplatePath = async (options, templateType, name, target) => {
|
|
1350
|
-
if (templateType === "next") {
|
|
1351
|
-
options.logger.warn('template "next" is not yet available — re-run with `--vite react` or `-t standalone`.');
|
|
1352
|
-
return { code: 1, files: [], target };
|
|
1353
|
-
}
|
|
1354
2443
|
if (options.from !== void 0) {
|
|
1355
|
-
return scaffoldFromLocal(options.from, templateType, target, name, options.logger);
|
|
2444
|
+
return await scaffoldFromLocal(options.from, templateType, target, name, options.logger);
|
|
1356
2445
|
}
|
|
1357
2446
|
if (options.source !== void 0 && options.source.length > 0 && !options.allowUnsafeSource && !isSafeSource(options.source)) {
|
|
1358
2447
|
options.logger.error(
|
|
@@ -1373,8 +2462,13 @@ const scaffoldNewProject = async (options, cwd, recordTarget) => {
|
|
|
1373
2462
|
return { code: 1, files: [], target: "" };
|
|
1374
2463
|
}
|
|
1375
2464
|
const suggestedName = generateProjectName();
|
|
1376
|
-
const
|
|
2465
|
+
const rawName = options.name ?? await tuiText(COPY.name, { badge: BADGES.dir, default: suggestedName, placeholder: suggestedName });
|
|
1377
2466
|
const choice = await resolveScaffoldChoice(options);
|
|
2467
|
+
const name = rawName.trim();
|
|
2468
|
+
if (name.length === 0) {
|
|
2469
|
+
options.logger.error(`init: refusing an empty project name — pass a directory name (e.g. \`lunora init my-app\`).`);
|
|
2470
|
+
return { code: 1, files: [], target: "" };
|
|
2471
|
+
}
|
|
1378
2472
|
if (name.includes("/") || name.includes("\\") || name === ".." || name === ".") {
|
|
1379
2473
|
options.logger.error(`init: refusing project name "${name}" — must not contain path separators or be "." / "..".`);
|
|
1380
2474
|
return { code: 1, files: [], target: "" };
|
|
@@ -1425,7 +2519,8 @@ const runPostScaffold = async (options, result, cwd) => {
|
|
|
1425
2519
|
const installedManager = options.inPlace === true ? void 0 : await maybeOfferInstall(options, result.target);
|
|
1426
2520
|
if (options.inPlace !== true) {
|
|
1427
2521
|
await maybeOfferGit(options, result.target);
|
|
1428
|
-
|
|
2522
|
+
const manager = installedManager ?? detectPackageManager(result.target);
|
|
2523
|
+
await printNextSteps(basename(result.target), installedManager, manager, isInsideMonorepo(cwd));
|
|
1429
2524
|
await emitMascot(options.logger);
|
|
1430
2525
|
}
|
|
1431
2526
|
};
|
|
@@ -1463,7 +2558,7 @@ const runInitCommand = async (options) => {
|
|
|
1463
2558
|
scaffoldCiPipeline(options, result, cwd);
|
|
1464
2559
|
return result;
|
|
1465
2560
|
};
|
|
1466
|
-
const isTemplate = (value) => value === "analog" || value === "astro" || value === "next" || value === "nuxt" || value === "react-router" || value === "standalone" || value === "sveltekit" || value === "tanstack-start-react" || value === "tanstack-start-solid";
|
|
2561
|
+
const isTemplate = (value) => value === "analog" || value === "astro" || value === "expo" || value === "next" || value === "nuxt" || value === "react-router" || value === "standalone" || value === "sveltekit" || value === "tanstack-start-react" || value === "tanstack-start-solid";
|
|
1467
2562
|
const resolveCiProvider = (raw, logger) => {
|
|
1468
2563
|
if (raw === void 0) {
|
|
1469
2564
|
return void 0;
|