@vorra/cli 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,26 +1,32 @@
1
- ## 0.3.0 (2026-04-12)
2
-
3
- ### 🧱 Updated Dependencies
4
-
5
- - Updated compiler to 0.3.0
6
-
7
- ## 0.2.0 (2026-04-12)
8
-
9
- ### 🚀 Features
10
-
11
- - add sourcemap config option to forge build ([#7](https://github.com/ubergeoff/forge/pull/7))
12
-
13
- ### 🩹 Fixes
14
-
15
- - revert workspace:* to * for npm workspace compatibility ([e9aa6a6](https://github.com/ubergeoff/forge/commit/e9aa6a6))
16
-
17
- ### 🧱 Updated Dependencies
18
-
19
- - Updated compiler to 0.2.0
20
-
21
- ### ❤️ Thank You
22
-
23
- - Claude
24
- - Claude Sonnet 4.6
25
- - Geoffrey Le Roux
1
+ ## 0.4.0 (2026-04-13)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated compiler to 0.4.0
6
+
7
+ ## 0.3.0 (2026-04-12)
8
+
9
+ ### 🧱 Updated Dependencies
10
+
11
+ - Updated compiler to 0.3.0
12
+
13
+ ## 0.2.0 (2026-04-12)
14
+
15
+ ### 🚀 Features
16
+
17
+ - add sourcemap config option to forge build ([#7](https://github.com/ubergeoff/forge/pull/7))
18
+
19
+ ### 🩹 Fixes
20
+
21
+ - revert workspace:* to * for npm workspace compatibility ([e9aa6a6](https://github.com/ubergeoff/forge/commit/e9aa6a6))
22
+
23
+ ### 🧱 Updated Dependencies
24
+
25
+ - Updated compiler to 0.2.0
26
+
27
+ ### ❤️ Thank You
28
+
29
+ - Claude
30
+ - Claude Sonnet 4.6
31
+ - Geoffrey Le Roux
26
32
  - ubergeoff @ubergeoff
package/dist/bin.js CHANGED
@@ -4,7 +4,7 @@ import * as path from "node:path";
4
4
  import { build, rolldown } from "rolldown";
5
5
  import { generateScopeId, vorraPlugin } from "@vorra/compiler";
6
6
  import * as url from "node:url";
7
- import { createRequire } from "node:module";
7
+ import { fileURLToPath } from "node:url";
8
8
  import * as http from "node:http";
9
9
  import { spawnSync } from "node:child_process";
10
10
  //#region src/utils/config.ts
@@ -36,21 +36,21 @@ async function loadConfig(cwd) {
36
36
  }
37
37
  //#endregion
38
38
  //#region src/utils/vorra-dedupe-plugin.ts
39
- const _require = createRequire(import.meta.url);
39
+ let _metaResolve = (id) => import.meta.resolve(id);
40
40
  /**
41
41
  * Resolves an `@vorra/*` package to an absolute path inside its `dist/`
42
- * directory. Uses the CJS main entry as an anchor so we never need to access
43
- * `pkg/package.json` directly (which would require the package's `exports`
44
- * field to allow that subpath).
42
+ * directory. Uses import.meta.resolve() (stable since Node 20) to locate
43
+ * the package's ESM main entry, then walks up to the package root.
45
44
  */
46
45
  function resolveVorraPackage(name, subpath = "dist/index.js") {
47
- const mainCjs = _require.resolve(name);
48
- const pkgRoot = path.dirname(path.dirname(mainCjs));
46
+ const resolved = _metaResolve(name);
47
+ const mainPath = resolved.startsWith("file://") ? fileURLToPath(resolved) : resolved;
48
+ const pkgRoot = path.dirname(path.dirname(mainPath));
49
49
  return path.join(pkgRoot, subpath);
50
50
  }
51
51
  /**
52
52
  * Lazily-built alias map. Populated on first use inside `resolveId` so that
53
- * importing this module never triggers `_require.resolve()` at load time.
53
+ * importing this module never triggers resolution at load time.
54
54
  * This keeps the module safe to import in test environments where `dist/`
55
55
  * files may not exist yet.
56
56
  */
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","names":[],"sources":["../src/utils/config.ts","../src/utils/vorra-dedupe-plugin.ts","../src/commands/build.ts","../src/commands/dev.ts","../src/commands/new.ts","../src/commands/typecheck.ts","../src/bin.ts"],"sourcesContent":["// =============================================================================\r\n// @vorra/cli — Config loader\r\n// Loads vorra.config.js / .mjs / .cjs from the project root.\r\n// TypeScript configs require a TS loader (tsx, ts-node) to be active.\r\n// =============================================================================\r\n\r\nimport * as fs from 'node:fs';\r\nimport * as path from 'node:path';\r\nimport * as url from 'node:url';\r\nimport type { VorraConfig } from '../index.js';\r\n\r\nconst CONFIG_CANDIDATES = [\r\n 'vorra.config.js',\r\n 'vorra.config.mjs',\r\n 'vorra.config.cjs',\r\n];\r\n\r\n/**\r\n * Loads vorra.config.{js,mjs,cjs} from `cwd` and returns the config object.\r\n * Returns an empty object if no config file is found.\r\n *\r\n * Note: `.ts` configs are not supported at CLI runtime without a TS loader.\r\n * Compile `vorra.config.ts` to `.js` first, or run with `tsx`:\r\n * npx tsx node_modules/.bin/forge dev\r\n */\r\nexport async function loadConfig(cwd: string): Promise<VorraConfig> {\r\n for (const candidate of CONFIG_CANDIDATES) {\r\n const configPath = path.join(cwd, candidate);\r\n if (fs.existsSync(configPath)) {\r\n const fileUrl = url.pathToFileURL(configPath).href;\r\n // Dynamic import — works for ESM and CJS configs alike.\r\n const mod = (await import(fileUrl)) as { default?: unknown };\r\n if (mod.default !== null && mod.default !== undefined && typeof mod.default === 'object') {\r\n return mod.default as VorraConfig;\r\n }\r\n return {};\r\n }\r\n }\r\n\r\n // Warn if a TS config exists but cannot be loaded.\r\n const tsConfigPath = path.join(cwd, 'vorra.config.ts');\r\n if (fs.existsSync(tsConfigPath)) {\r\n console.warn(\r\n '[Vorra CLI] vorra.config.ts found but cannot be loaded without a TS loader.\\n' +\r\n ' Tip: Compile it first (tsc vorra.config.ts) or run via: npx tsx .../bin.js dev',\r\n );\r\n }\r\n\r\n return {};\r\n}\r\n","// =============================================================================\r\n// vorra-dedupe-plugin\r\n// Forces all @vorra/* imports to their canonical dist entry points so that\r\n// Rolldown always bundles a single module instance, regardless of whether the\r\n// import comes from TypeScript source (resolved via tsconfig paths → src/) or\r\n// from a pre-built dist file (node_modules resolution → dist/).\r\n//\r\n// Dual-instance @vorra/core is the most critical failure mode: two copies of\r\n// the reactivity module produce two independent `activeContext` globals, so\r\n// signals created by one instance are invisible to effects created by the\r\n// other (e.g. form control signals never connecting to template effects).\r\n// =============================================================================\r\n\r\nimport * as path from 'node:path';\r\nimport { createRequire } from 'node:module';\r\nimport type { RolldownPlugin } from 'rolldown';\r\n\r\nconst _require = createRequire(import.meta.url);\r\n\r\n/**\r\n * Resolves an `@vorra/*` package to an absolute path inside its `dist/`\r\n * directory. Uses the CJS main entry as an anchor so we never need to access\r\n * `pkg/package.json` directly (which would require the package's `exports`\r\n * field to allow that subpath).\r\n */\r\nexport function resolveVorraPackage(name: string, subpath = 'dist/index.js'): string {\r\n const mainCjs = _require.resolve(name); // → packages/*/dist/index.cjs\r\n const pkgRoot = path.dirname(path.dirname(mainCjs)); // strip dist/index.cjs\r\n return path.join(pkgRoot, subpath);\r\n}\r\n\r\n/**\r\n * Lazily-built alias map. Populated on first use inside `resolveId` so that\r\n * importing this module never triggers `_require.resolve()` at load time.\r\n * This keeps the module safe to import in test environments where `dist/`\r\n * files may not exist yet.\r\n */\r\nlet _aliases: Record<string, string> | undefined;\r\n\r\nexport function getVorraAliases(): Record<string, string> {\r\n if (_aliases === undefined) {\r\n _aliases = {\r\n '@vorra/core': resolveVorraPackage('@vorra/core'),\r\n '@vorra/core/dom': resolveVorraPackage('@vorra/core', 'dist/dom.js'),\r\n '@vorra/core/reactivity': resolveVorraPackage('@vorra/core', 'dist/reactivity.js'),\r\n '@vorra/core/di': resolveVorraPackage('@vorra/core', 'dist/di.js'),\r\n '@vorra/forms': resolveVorraPackage('@vorra/forms'),\r\n '@vorra/router': resolveVorraPackage('@vorra/router'),\r\n };\r\n }\r\n return _aliases;\r\n}\r\n\r\n/**\r\n * Rolldown plugin that forces all `@vorra/*` imports to their canonical dist\r\n * entry points. A `resolveId` hook applies unconditionally to every import —\r\n * including those inside pre-built dist files — unlike `resolve.alias` which\r\n * Rolldown skips for files it considers already-resolved.\r\n */\r\nexport const vorraDedupePlugin: RolldownPlugin = {\r\n name: 'vorra-dedupe',\r\n resolveId(id: string) {\r\n const resolved = getVorraAliases()[id];\r\n if (resolved !== undefined) {\r\n return { id: resolved, external: false };\r\n }\r\n return undefined;\r\n },\r\n};\r\n","// =============================================================================\r\n// @vorra/cli — vorra build\r\n// Runs a one-shot Rolldown production build with the Vorra plugin.\r\n// =============================================================================\r\n\r\nimport * as fs from 'node:fs';\r\nimport * as path from 'node:path';\r\nimport { rolldown } from 'rolldown';\r\nimport type { RolldownPlugin } from 'rolldown';\r\nimport { vorraPlugin } from '@vorra/compiler';\r\nimport { loadConfig } from '../utils/config.js';\r\nimport { vorraDedupePlugin } from '../utils/vorra-dedupe-plugin.js';\r\n\r\n/**\r\n * Runs a production build.\r\n *\r\n * CLI flags (override vorra.config.js):\r\n * --entry <path> Entry file (default: src/main.ts)\r\n * --outDir <path> Output directory (default: dist)\r\n */\r\nexport async function runBuild(args: string[]): Promise<void> {\r\n const cwd = process.cwd();\r\n const config = await loadConfig(cwd);\r\n\r\n // Parse CLI flags — these override vorra.config values.\r\n const entryIdx = args.indexOf('--entry');\r\n const outDirIdx = args.indexOf('--outDir');\r\n\r\n const entry =\r\n (entryIdx !== -1 ? args[entryIdx + 1] : undefined) ?? config.entry ?? 'src/main.ts';\r\n const outDir =\r\n (outDirIdx !== -1 ? args[outDirIdx + 1] : undefined) ?? config.outDir ?? 'dist';\r\n\r\n const entryAbs = path.join(cwd, entry);\r\n const outDirAbs = path.join(cwd, outDir);\r\n const entryName = path.basename(entry, path.extname(entry));\r\n const userPlugins = (config.plugins ?? []) as RolldownPlugin[];\r\n const plugins: RolldownPlugin[] = [\r\n vorraDedupePlugin as RolldownPlugin,\r\n vorraPlugin({\r\n ...(config.css ? { css: path.join(cwd, config.css) } : {}),\r\n ...(config.postcss ? { postcss: config.postcss } : {}),\r\n }) as RolldownPlugin,\r\n ...userPlugins,\r\n ];\r\n\r\n console.log(`[vorra build] ${entry} → ${outDir}/`);\r\n\r\n const build = await rolldown({\r\n input: entryAbs,\r\n plugins,\r\n });\r\n\r\n const sourcemap = config.sourcemap ?? false;\r\n\r\n await build.write({\r\n dir: outDirAbs,\r\n format: 'es',\r\n sourcemap,\r\n entryFileNames: '[name].js',\r\n chunkFileNames: '[name]-[hash].js',\r\n });\r\n\r\n // -------------------------------------------------------------------------\r\n // Copy index.html into dist/, rewriting script/link src paths that reference\r\n // the output directory so the dist/ folder is fully self-contained.\r\n // -------------------------------------------------------------------------\r\n const htmlSrc = path.join(cwd, 'index.html');\r\n if (fs.existsSync(htmlSrc)) {\r\n const outDirRel = path.relative(cwd, outDirAbs).replace(/\\\\/g, '/');\r\n // Match src/href attribute values that start with the outDir prefix\r\n // (with or without a leading ./), e.g. \"./dist/main.js\" or \"dist/main.js\".\r\n const outDirPattern = new RegExp(\r\n `((?:src|href)=[\"'])(?:\\\\./)?(${escapeRegExp(outDirRel)}/)`,\r\n 'g',\r\n );\r\n let html = fs.readFileSync(htmlSrc, 'utf8');\r\n // Rewrite any existing script/link paths that reference the outDir prefix.\r\n html = html.replace(outDirPattern, '$1');\r\n // Auto-inject the entry module script if the HTML has no module script tag.\r\n if (!/<script\\s[^>]*type=[\"']module[\"']/i.test(html)) {\r\n const tag = ` <script type=\"module\" src=\"./${entryName}.js\"></script>`;\r\n html = html.includes('</body>') ? html.replace('</body>', `${tag}\\n</body>`) : html + tag;\r\n }\r\n fs.writeFileSync(path.join(outDirAbs, 'index.html'), html, 'utf8');\r\n console.log(`[vorra build] Copied index.html → ${outDir}/index.html`);\r\n } else {\r\n console.warn('[vorra build] No index.html found in project root — skipping HTML copy.');\r\n }\r\n\r\n console.log('[vorra build] Done.');\r\n}\r\n\r\n/** Escapes special regex characters in a literal string. */\r\nfunction escapeRegExp(str: string): string {\r\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n}\r\n","// =============================================================================\r\n// @vorra/cli — vorra dev\r\n// Development server: Rolldown one-shot builds + fs.watch for source changes +\r\n// Server-Sent Events (SSE) for component-level HMR.\r\n//\r\n// We intentionally do NOT use Rolldown's watch() API because its native\r\n// file-watcher does not reliably exclude the output directory on Windows,\r\n// causing every build write to trigger another rebuild (infinite loop).\r\n// Instead we use Node's built-in fs.watch() restricted to source files only.\r\n//\r\n// HMR strategy:\r\n// - Each .vorra file is split into its own output chunk (stable name).\r\n// - fs.watch tracks which .vorra files changed during a quiet period.\r\n// - If ONLY .vorra files changed, an 'hmr-update' SSE event is sent so the\r\n// browser can hot-swap individual components without a full page reload.\r\n// - If any non-.vorra source file also changed, a full 'reload' is sent\r\n// (e.g. a service dependency changed — the whole app must restart).\r\n// =============================================================================\r\n\r\nimport * as http from 'node:http';\r\nimport * as fs from 'node:fs';\r\nimport * as path from 'node:path';\r\nimport { build } from 'rolldown';\r\nimport type { RolldownPlugin, OutputOptions } from 'rolldown';\r\nimport { vorraPlugin, generateScopeId } from '@vorra/compiler';\r\nimport { loadConfig } from '../utils/config.js';\r\nimport { vorraDedupePlugin } from '../utils/vorra-dedupe-plugin.js';\r\n\r\n// ---------------------------------------------------------------------------\r\n// Constants\r\n// ---------------------------------------------------------------------------\r\n\r\nconst HMR_ENDPOINT = '/__vorra_hmr';\r\n\r\n/**\r\n * Injected before </body> in every HTML response.\r\n *\r\n * Sets up window.__vorra_hmr with an instance registry, then opens an SSE\r\n * connection to receive either component-level HMR updates or full reloads.\r\n *\r\n * 'hmr-update' — one or more .vorra chunks changed; each is re-imported with\r\n * a cache-busting timestamp. The new chunk calls window.__vorra_hmr.accept()\r\n * which triggers the in-place component swap implemented in @vorra/core.\r\n *\r\n * 'reload' — a non-component file changed; fall back to a full page reload.\r\n */\r\nconst HMR_CLIENT_SCRIPT = `<script type=\"module\">\r\n(function () {\r\n if (!window.__vorra_hmr) window.__vorra_hmr = {};\r\n var hmr = window.__vorra_hmr;\r\n if (!hmr.instances) hmr.instances = new Map();\r\n\r\n var es = new EventSource('${HMR_ENDPOINT}');\r\n\r\n es.addEventListener('hmr-update', function (e) {\r\n var data = JSON.parse(e.data);\r\n data.updates.forEach(function (update) {\r\n console.log('[vorra hmr] updating component ' + update.id);\r\n import(update.url + '?t=' + Date.now()).catch(function (err) {\r\n console.error('[vorra hmr] failed to load update, falling back to reload', err);\r\n location.reload();\r\n });\r\n });\r\n });\r\n\r\n es.addEventListener('reload', function () {\r\n console.log('[vorra hmr] full reload');\r\n location.reload();\r\n });\r\n\r\n es.addEventListener('error', function () { es.close(); });\r\n})();\r\n</script>`;\r\n\r\nconst MIME: Record<string, string> = {\r\n '.html': 'text/html; charset=utf-8',\r\n '.js': 'application/javascript; charset=utf-8',\r\n '.mjs': 'application/javascript; charset=utf-8',\r\n '.css': 'text/css; charset=utf-8',\r\n '.json': 'application/json; charset=utf-8',\r\n '.svg': 'image/svg+xml',\r\n '.png': 'image/png',\r\n '.jpg': 'image/jpeg',\r\n '.jpeg': 'image/jpeg',\r\n '.ico': 'image/x-icon',\r\n '.woff': 'font/woff',\r\n '.woff2': 'font/woff2',\r\n '.ttf': 'font/ttf',\r\n};\r\n\r\n// ---------------------------------------------------------------------------\r\n// Main\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Starts the vorra development server.\r\n *\r\n * CLI flags (override vorra.config.js):\r\n * --port <number> Dev server port (default: 3000)\r\n * --entry <path> Entry file (default: src/main.ts)\r\n * --outDir <path> Output directory (default: dist)\r\n */\r\nexport async function runDev(args: string[]): Promise<void> {\r\n const cwd = process.cwd();\r\n const config = await loadConfig(cwd);\r\n\r\n // Parse CLI flags.\r\n const portIdx = args.indexOf('--port');\r\n const entryIdx = args.indexOf('--entry');\r\n const outDirIdx = args.indexOf('--outDir');\r\n\r\n const port =\r\n portIdx !== -1\r\n ? parseInt(args[portIdx + 1] ?? '3000', 10)\r\n : (config.port ?? 3000);\r\n const entry =\r\n (entryIdx !== -1 ? args[entryIdx + 1] : undefined) ?? config.entry ?? 'src/main.ts';\r\n const outDir =\r\n (outDirIdx !== -1 ? args[outDirIdx + 1] : undefined) ?? config.devOutDir ?? '.vorra';\r\n\r\n const entryAbs = path.join(cwd, entry);\r\n const outDirAbs = path.join(cwd, outDir);\r\n // Normalise to forward-slash for reliable prefix checks on Windows.\r\n const outDirNorm = outDirAbs.replace(/\\\\/g, '/') + '/';\r\n const outDirRel = path.relative(cwd, outDirAbs).replace(/\\\\/g, '/');\r\n\r\n const userPlugins = (config.plugins ?? []) as RolldownPlugin[];\r\n // Replace the __vorra_dev compile-time constant with `true` so the HMR\r\n // runtime block in @vorra/core/dom.ts is included (and dead code in\r\n // production builds is tree-shaken when the constant is `false`).\r\n // Rolldown's programmatic build() API does not accept a top-level `define`\r\n // option, so we use a minimal transform plugin instead.\r\n const devDefinePlugin: RolldownPlugin = {\r\n name: 'vorra-dev-define',\r\n transform(code: string) {\r\n if (!code.includes('__vorra_dev')) return null;\r\n // Strip TypeScript `declare const __vorra_dev` ambient declarations so that\r\n // Rolldown resolving workspace packages to their TypeScript source (via root\r\n // tsconfig `paths`) doesn't produce invalid syntax like `declare const true`.\r\n let result = code.replace(/declare\\s+const\\s+__vorra_dev\\b[^\\n]*\\n?/g, '');\r\n result = result.replaceAll('__vorra_dev', 'true');\r\n return { code: result };\r\n },\r\n };\r\n const plugins: RolldownPlugin[] = [\r\n vorraDedupePlugin,\r\n vorraPlugin({\r\n hmr: true,\r\n ...(config.css ? { css: path.join(cwd, config.css) } : {}),\r\n ...(config.postcss ? { postcss: config.postcss } : {}),\r\n }) as RolldownPlugin,\r\n devDefinePlugin,\r\n ...userPlugins,\r\n ];\r\n\r\n // Ensure output directory exists before the first build.\r\n fs.mkdirSync(outDirAbs, { recursive: true });\r\n\r\n // -------------------------------------------------------------------------\r\n // SSE clients\r\n // -------------------------------------------------------------------------\r\n\r\n const clients = new Set<http.ServerResponse>();\r\n\r\n /** Broadcasts an SSE event to all connected browser clients. */\r\n function broadcast(event: string, data: string): void {\r\n for (const client of clients) {\r\n try {\r\n client.write(`event: ${event}\\ndata: ${data}\\n\\n`);\r\n } catch {\r\n // Dead connection — remove it.\r\n clients.delete(client);\r\n }\r\n }\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // HMR change tracking\r\n //\r\n // The fs.watch callback populates these sets as files change. runBuild()\r\n // drains them at the start of each build to decide whether to send a\r\n // component-level HMR update or a full page reload.\r\n // -------------------------------------------------------------------------\r\n\r\n /** Absolute paths of .vorra files that changed since the last build. */\r\n const changedVorraFiles = new Set<string>();\r\n /** True if any non-.vorra source file changed since the last build. */\r\n let hasNonVorraChanges = false;\r\n\r\n // -------------------------------------------------------------------------\r\n // One-shot Rolldown build\r\n // -------------------------------------------------------------------------\r\n\r\n let isBuilding = false;\r\n let pendingRebuild = false;\r\n\r\n // Each .vorra component gets its own output chunk (stable name so the\r\n // browser can cache-bust with ?t=timestamp on HMR update).\r\n // manualChunks is part of Rolldown's Rollup-compatible surface but is not\r\n // in its native OutputOptions type yet; cast through unknown to suppress.\r\n const devOutput: OutputOptions = {\r\n dir: outDirAbs,\r\n format: 'es',\r\n sourcemap: true,\r\n entryFileNames: '[name].js',\r\n // Stable chunk names (no content hash) so the browser can predict the URL.\r\n chunkFileNames: '[name].js',\r\n ...(({\r\n manualChunks(id: string): string | undefined {\r\n // Each .vorra component becomes its own chunk so only the changed\r\n // component needs to be re-fetched on HMR update.\r\n if (id.endsWith('.vorra')) {\r\n return path.relative(cwd, id).replace(/\\\\/g, '/').replace('.vorra', '');\r\n }\r\n // Bundle all @vorra/* runtime into a single stable shared chunk.\r\n if (id.includes(path.join('node_modules', '@vorra'))) {\r\n return 'vorra-runtime';\r\n }\r\n return undefined;\r\n },\r\n }) as unknown as Partial<OutputOptions>),\r\n };\r\n\r\n async function runBuild(): Promise<void> {\r\n if (isBuilding) {\r\n // A build is already in flight; schedule a follow-up instead of stacking.\r\n pendingRebuild = true;\r\n return;\r\n }\r\n isBuilding = true;\r\n pendingRebuild = false;\r\n\r\n // Snapshot and clear the change sets before the async build starts so\r\n // any edits made during the build are captured in the next cycle.\r\n const currentVorraChanges = new Set(changedVorraFiles);\r\n const currentHasNonVorra = hasNonVorraChanges;\r\n changedVorraFiles.clear();\r\n hasNonVorraChanges = false;\r\n\r\n try {\r\n await build({\r\n input: entryAbs,\r\n plugins,\r\n output: devOutput,\r\n });\r\n\r\n if (currentVorraChanges.size > 0 && !currentHasNonVorra) {\r\n // Only .vorra files changed — perform component-level HMR.\r\n const updates = Array.from(currentVorraChanges).map((filePath) => {\r\n const id = generateScopeId(filePath);\r\n const rel = path.relative(cwd, filePath).replace(/\\\\/g, '/').replace('.vorra', '');\r\n // URL the browser will request; the static server resolves it from outDirAbs.\r\n const url = `/${path.join(outDir, rel).replace(/\\\\/g, '/')}.js`;\r\n return { id, url };\r\n });\r\n console.log(`[vorra hmr] Hot-updating ${updates.length} component(s)...`);\r\n broadcast('hmr-update', JSON.stringify({ updates }));\r\n } else {\r\n // Non-.vorra source changed (service, utility, config, etc.) — full reload.\r\n console.log('[vorra dev] Rebuilt — notifying clients...');\r\n broadcast('reload', '{}');\r\n }\r\n } catch {\r\n console.error('[vorra dev] Build error — check the terminal above for details.');\r\n } finally {\r\n isBuilding = false;\r\n if (pendingRebuild) {\r\n void runBuild();\r\n }\r\n }\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // Source file watcher (fs.watch, source files only)\r\n // -------------------------------------------------------------------------\r\n //\r\n // We watch the entire project root but skip anything inside the output\r\n // directory and node_modules. This avoids the Rolldown-watcher bug where\r\n // the native exclude option does not reliably prevent dist/ writes from\r\n // re-triggering a rebuild on Windows.\r\n\r\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\n const fsWatcher = fs.watch(cwd, { recursive: true }, (_event, filename) => {\r\n if (!filename) return;\r\n\r\n // Normalise to forward slashes for consistent prefix matching.\r\n const rel = filename.replace(/\\\\/g, '/');\r\n\r\n // Ignore output directory and node_modules.\r\n if (rel.startsWith(outDirRel + '/')) return;\r\n if (rel.startsWith('node_modules/')) return;\r\n\r\n // Also guard against absolute paths that lie inside outDir (Windows edge case).\r\n const abs = path.resolve(cwd, filename).replace(/\\\\/g, '/') + '/';\r\n if (abs.startsWith(outDirNorm)) return;\r\n\r\n // Track file type for HMR decision.\r\n // Only recognised source extensions should trigger a rebuild — everything\r\n // else (editor temp files, OS metadata, TypeScript build-info, etc.) is\r\n // ignored entirely, including the debounce, so it cannot cause a spurious\r\n // empty rebuild that falls to the full-reload branch.\r\n const SOURCE_EXTENSIONS = ['.ts', '.tsx', '.js', '.mjs', '.cjs', '.json', '.html', '.css'];\r\n if (filename.endsWith('.vorra')) {\r\n changedVorraFiles.add(path.resolve(cwd, filename));\r\n } else if (SOURCE_EXTENSIONS.some((ext) => filename.endsWith(ext))) {\r\n hasNonVorraChanges = true;\r\n } else {\r\n // Not a source file we care about — skip debounce entirely.\r\n return;\r\n }\r\n\r\n if (debounceTimer) clearTimeout(debounceTimer);\r\n debounceTimer = setTimeout(() => {\r\n debounceTimer = null;\r\n void runBuild();\r\n }, 80);\r\n });\r\n\r\n // Derive the entry script URL so we can auto-inject it into HTML responses\r\n // when the user's index.html has no <script type=\"module\"> tag.\r\n const entryName = path.basename(entry, path.extname(entry));\r\n const devScriptSrc = `/${outDir}/${entryName}.js`;\r\n\r\n // Initial build on startup.\r\n console.log(`[vorra dev] Server: http://localhost:${port}`);\r\n console.log(`[vorra dev] Entry: ${entry}`);\r\n console.log(`[vorra dev] Output: ${outDir}/`);\r\n console.log('[vorra dev] HMR: enabled');\r\n console.log('[vorra dev] Building...');\r\n await runBuild();\r\n console.log('[vorra dev] Watching for changes...\\n');\r\n\r\n // -------------------------------------------------------------------------\r\n // HTTP server\r\n // -------------------------------------------------------------------------\r\n\r\n const server = http.createServer((req, res) => {\r\n const rawUrl = req.url ?? '/';\r\n\r\n // SSE endpoint — browsers connect here to receive HMR / reload events.\r\n if (rawUrl === HMR_ENDPOINT) {\r\n res.writeHead(200, {\r\n 'Content-Type': 'text/event-stream',\r\n 'Cache-Control': 'no-cache',\r\n Connection: 'keep-alive',\r\n 'Access-Control-Allow-Origin': '*',\r\n });\r\n // Initial comment keeps the connection alive in some browsers.\r\n res.write(':\\n\\n');\r\n clients.add(res);\r\n // res.on('close') is more reliable than req.on('close') for detecting\r\n // client disconnection on a streaming (never-ended) response.\r\n res.on('close', () => {\r\n clients.delete(res);\r\n });\r\n return;\r\n }\r\n\r\n // Strip query string (allows cache-busting via ?t=timestamp).\r\n const urlPath = rawUrl.split('?')[0] ?? '/';\r\n\r\n // Resolve to a file on disk.\r\n const filePath = resolveFilePath(urlPath, cwd, outDirAbs);\r\n\r\n if (filePath === null) {\r\n res.writeHead(404, { 'Content-Type': 'text/plain' });\r\n res.end(`Not found: ${urlPath}`);\r\n return;\r\n }\r\n\r\n serveFile(filePath, res, devScriptSrc);\r\n });\r\n\r\n server.listen(port);\r\n\r\n // -------------------------------------------------------------------------\r\n // Graceful shutdown\r\n // -------------------------------------------------------------------------\r\n\r\n process.on('SIGINT', () => {\r\n console.log('\\n[vorra dev] Stopping...');\r\n fsWatcher.close();\r\n // Close all open SSE connections so server.close() callback fires immediately.\r\n for (const client of clients) {\r\n try { client.destroy(); } catch { /* ignore */ }\r\n }\r\n clients.clear();\r\n server.closeAllConnections();\r\n server.close(() => process.exit(0));\r\n });\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Helpers\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Resolves a URL path to a file on disk.\r\n *\r\n * Search order:\r\n * 1. `<cwd>/<urlPath>` — public assets, index.html in project root\r\n * 2. `<outDir>/<urlPath>` — compiled JS / CSS output\r\n * 3. `<cwd>/index.html` — SPA fallback for unknown paths\r\n *\r\n * Returns null if no file is found anywhere.\r\n */\r\nfunction resolveFilePath(\r\n urlPath: string,\r\n cwd: string,\r\n outDirAbs: string,\r\n): string | null {\r\n const normalized = urlPath === '/' ? '/index.html' : urlPath;\r\n\r\n const fromCwd = path.join(cwd, normalized);\r\n if (fs.existsSync(fromCwd) && fs.statSync(fromCwd).isFile()) return fromCwd;\r\n\r\n const fromDist = path.join(outDirAbs, normalized);\r\n if (fs.existsSync(fromDist) && fs.statSync(fromDist).isFile()) return fromDist;\r\n\r\n // SPA fallback — serve index.html so client-side routing works.\r\n const indexHtml = path.join(cwd, 'index.html');\r\n if (fs.existsSync(indexHtml)) return indexHtml;\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Reads a file from disk and writes it to the HTTP response.\r\n *\r\n * For HTML files, two scripts are injected before </body>:\r\n * 1. The compiled entry module — only when no <script type=\"module\"> is\r\n * already present in the file, so users don't need to add the tag\r\n * manually; the framework adds it for them.\r\n * 2. The HMR client — always present in dev mode.\r\n */\r\nfunction serveFile(filePath: string, res: http.ServerResponse, entryScript?: string): void {\r\n const ext = path.extname(filePath).toLowerCase();\r\n const contentType = MIME[ext] ?? 'application/octet-stream';\r\n\r\n let body: Buffer;\r\n try {\r\n body = fs.readFileSync(filePath);\r\n } catch {\r\n res.writeHead(500, { 'Content-Type': 'text/plain' });\r\n res.end('Internal server error');\r\n return;\r\n }\r\n\r\n // Inject entry script + HMR client into HTML responses.\r\n if (ext === '.html') {\r\n let html = body.toString('utf8');\r\n\r\n // Auto-inject the entry module script if the HTML has no module script tag.\r\n if (entryScript && !/<script\\s[^>]*type=[\"']module[\"']/i.test(html)) {\r\n const tag = `<script type=\"module\" src=\"${entryScript}\"></script>`;\r\n html = html.includes('</body>') ? html.replace('</body>', `${tag}\\n</body>`) : html + tag;\r\n }\r\n\r\n const injected = html.includes('</body>')\r\n ? html.replace('</body>', `${HMR_CLIENT_SCRIPT}\\n</body>`)\r\n : html + HMR_CLIENT_SCRIPT;\r\n const injectedBuf = Buffer.from(injected, 'utf8');\r\n res.writeHead(200, {\r\n 'Content-Type': contentType,\r\n 'Content-Length': injectedBuf.length,\r\n });\r\n res.end(injectedBuf);\r\n return;\r\n }\r\n\r\n res.writeHead(200, {\r\n 'Content-Type': contentType,\r\n 'Content-Length': body.length,\r\n });\r\n res.end(body);\r\n}\r\n","// =============================================================================\r\n// @vorra/cli — vorra new\r\n// Scaffolds a new Vorra application in a subdirectory of cwd.\r\n// =============================================================================\r\n\r\nimport * as fs from 'node:fs';\r\nimport * as path from 'node:path';\r\n\r\n/**\r\n * Scaffolds a new project.\r\n *\r\n * Usage: vorra new <project-name>\r\n *\r\n * Creates the following structure:\r\n * <name>/\r\n * .gitignore\r\n * index.html\r\n * vorra.config.js\r\n * package.json\r\n * tsconfig.json\r\n * src/\r\n * env.d.ts\r\n * main.ts\r\n * App.vorra\r\n */\r\nexport function runNew(args: string[]): void {\r\n const name = args[0];\r\n\r\n if (!name) {\r\n console.error('[Vorra CLI] Usage: vorra new <project-name>');\r\n process.exit(1);\r\n return;\r\n }\r\n\r\n if (!/^[a-z][a-z0-9-]*$/.test(name)) {\r\n console.error(\r\n '[Vorra CLI] Project name must be lowercase letters/digits/hyphens, starting with a letter.',\r\n );\r\n process.exit(1);\r\n return;\r\n }\r\n\r\n const projectDir = path.join(process.cwd(), name);\r\n\r\n if (fs.existsSync(projectDir)) {\r\n console.error(`[Vorra CLI] Directory \"${name}\" already exists.`);\r\n process.exit(1);\r\n return;\r\n }\r\n\r\n console.log(`\\n Scaffolding Vorra app: ${name}\\n`);\r\n\r\n // Create directory tree.\r\n fs.mkdirSync(path.join(projectDir, 'src'), { recursive: true });\r\n\r\n // Write each template file.\r\n write(projectDir, 'package.json', tplPackageJson(name));\r\n write(projectDir, 'tsconfig.json', tplTsconfig());\r\n write(projectDir, 'vorra.config.js', tplVorraConfig());\r\n write(projectDir, 'index.html', tplIndexHtml(name));\r\n write(projectDir, '.gitignore', tplGitignore());\r\n write(projectDir, 'src/env.d.ts', tplEnvDts());\r\n write(projectDir, 'src/main.ts', tplMainTs());\r\n write(projectDir, 'src/App.vorra', tplAppVorra());\r\n\r\n const files = [\r\n 'package.json',\r\n 'tsconfig.json',\r\n 'vorra.config.js',\r\n 'index.html',\r\n '.gitignore',\r\n 'src/env.d.ts',\r\n 'src/main.ts',\r\n 'src/App.vorra',\r\n ];\r\n\r\n for (const f of files) {\r\n console.log(` \\u2713 ${name}/${f}`);\r\n }\r\n\r\n console.log(`\r\n Done! Next steps:\r\n\r\n cd ${name}\r\n npm install\r\n npm run dev\r\n`);\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Helpers\r\n// ---------------------------------------------------------------------------\r\n\r\nfunction write(dir: string, filename: string, content: string): void {\r\n fs.writeFileSync(path.join(dir, filename), content, 'utf8');\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Templates\r\n// ---------------------------------------------------------------------------\r\n\r\nfunction tplPackageJson(name: string): string {\r\n return JSON.stringify(\r\n {\r\n name,\r\n version: '0.1.0',\r\n private: true,\r\n type: 'module',\r\n scripts: {\r\n dev: 'vorra dev',\r\n build: 'vorra build',\r\n typecheck: 'vorra typecheck',\r\n },\r\n dependencies: {\r\n '@vorra/core': '^0.1.0',\r\n },\r\n devDependencies: {\r\n '@vorra/cli': '^0.1.0',\r\n '@vorra/compiler': '^0.1.0',\r\n rolldown: '^0.14.0',\r\n typescript: '^5.4.0',\r\n },\r\n engines: {\r\n node: '>=20.0.0',\r\n },\r\n },\r\n null,\r\n 2,\r\n );\r\n}\r\n\r\nfunction tplTsconfig(): string {\r\n return JSON.stringify(\r\n {\r\n compilerOptions: {\r\n target: 'ES2022',\r\n module: 'ESNext',\r\n moduleResolution: 'Bundler',\r\n strict: true,\r\n exactOptionalPropertyTypes: true,\r\n noUncheckedIndexedAccess: true,\r\n experimentalDecorators: true,\r\n useDefineForClassFields: false,\r\n skipLibCheck: true,\r\n noEmit: true,\r\n },\r\n include: ['src'],\r\n },\r\n null,\r\n 2,\r\n );\r\n}\r\n\r\nfunction tplVorraConfig(): string {\r\n return `// vorra.config.js\r\nimport { defineConfig } from '@vorra/cli';\r\n\r\nexport default defineConfig({\r\n entry: 'src/main.ts',\r\n outDir: 'dist',\r\n port: 3000,\r\n});\r\n`;\r\n}\r\n\r\nfunction tplIndexHtml(name: string): string {\r\n return `<!DOCTYPE html>\r\n<html lang=\"en\">\r\n <head>\r\n <meta charset=\"UTF-8\" />\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\r\n <title>${name}</title>\r\n </head>\r\n <body>\r\n <div id=\"app\"></div>\r\n <!-- entry script injected automatically by vorra dev / vorra build -->\r\n </body>\r\n</html>\r\n`;\r\n}\r\n\r\nfunction tplGitignore(): string {\r\n return `node_modules/\r\ndist/\r\n.vorra/\r\n*.tsbuildinfo\r\n`;\r\n}\r\n\r\nfunction tplEnvDts(): string {\r\n return `// Type declarations for .vorra single-file components.\r\nimport type { ComponentContext } from '@vorra/core';\r\n\r\ndeclare module '*.vorra' {\r\n const component: (ctx: ComponentContext) => Node;\r\n export default component;\r\n}\r\n`;\r\n}\r\n\r\nfunction tplMainTs(): string {\r\n return `import { bootstrapApp } from '@vorra/core';\r\nimport { createComponent, mountComponent } from '@vorra/core';\r\nimport App from './App.vorra';\r\n\r\nconst appEl = document.getElementById('app');\r\nif (appEl === null) throw new Error('[App] #app element not found in index.html');\r\n\r\nconst root = bootstrapApp();\r\nconst ctx = createComponent(root);\r\nmountComponent(App, appEl, ctx);\r\n`;\r\n}\r\n\r\nfunction tplAppVorra(): string {\r\n return `<script>\r\nimport { signal } from '@vorra/core';\r\n\r\nconst count = signal(0);\r\n\r\nfunction increment(): void {\r\n count.update((n) => n + 1);\r\n}\r\n</script>\r\n\r\n<template>\r\n <div class=\"app\">\r\n <h1>Welcome to Vorra ⚡</h1>\r\n <p class=\"counter\">Count: {count()}</p>\r\n <button @click=\"increment\">Increment</button>\r\n </div>\r\n</template>\r\n\r\n<style scoped>\r\n.app {\r\n font-family: system-ui, sans-serif;\r\n max-width: 480px;\r\n margin: 4rem auto;\r\n padding: 0 1rem;\r\n text-align: center;\r\n}\r\n\r\nh1 {\r\n font-size: 2rem;\r\n margin-bottom: 1rem;\r\n}\r\n\r\n.counter {\r\n font-size: 1.25rem;\r\n margin-bottom: 1.5rem;\r\n}\r\n\r\nbutton {\r\n padding: 0.5rem 1.5rem;\r\n font-size: 1rem;\r\n cursor: pointer;\r\n border: 2px solid currentColor;\r\n border-radius: 6px;\r\n background: transparent;\r\n transition: background 0.2s;\r\n}\r\n\r\nbutton:hover {\r\n background: #f0f0f0;\r\n}\r\n</style>\r\n`;\r\n}\r\n","// =============================================================================\r\n// @vorra/cli — vorra typecheck\r\n// Delegates to `tsc --build` in the project root.\r\n// =============================================================================\r\n\r\nimport { spawnSync } from 'node:child_process';\r\n\r\n/**\r\n * Runs TypeScript type checking via `tsc --build`.\r\n * Passes `--noEmit` unless the project tsconfig already disables emit.\r\n * Exits with the same code as tsc.\r\n */\r\nexport function runTypecheck(args: string[]): void {\r\n const noEmit = args.includes('--emit') ? [] : ['--noEmit'];\r\n\r\n console.log('[vorra typecheck] Running tsc --build...');\r\n\r\n const result = spawnSync('tsc', ['--build', ...noEmit], {\r\n stdio: 'inherit',\r\n shell: true,\r\n cwd: process.cwd(),\r\n });\r\n\r\n if (result.error !== undefined) {\r\n console.error('[Vorra CLI] Failed to run tsc:', result.error.message);\r\n process.exit(1);\r\n return;\r\n }\r\n\r\n process.exit(result.status ?? 0);\r\n}\r\n","#!/usr/bin/env node\r\n// =============================================================================\r\n// vorra CLI — bin entrypoint\r\n// Usage: vorra <command> [options]\r\n// =============================================================================\r\n\r\nimport { runBuild } from './commands/build.js';\r\nimport { runDev } from './commands/dev.js';\r\nimport { runNew } from './commands/new.js';\r\nimport { runTypecheck } from './commands/typecheck.js';\r\n\r\nconst args = process.argv.slice(2);\r\nconst command = args[0];\r\nconst commandArgs = args.slice(1);\r\n\r\nconst VERSION = '0.1.0';\r\n\r\nconst HELP = `\r\n ⚡ Vorra — compiled signal-first framework for enterprise apps\r\n\r\n Usage: vorra <command> [options]\r\n\r\n Commands:\r\n new <name> Scaffold a new Vorra application\r\n dev Start the development server (with live reload)\r\n build Build for production\r\n typecheck Run TypeScript type checking\r\n\r\n Options:\r\n --help, -h Show this help message\r\n --version, -v Show the Vorra version\r\n\r\n Flags per command:\r\n dev --port <n> Dev server port (default: 3000)\r\n --entry <p> Entry file (default: src/main.ts)\r\n --outDir <p> Output dir (default: dist)\r\n build --entry <p> Entry file (default: src/main.ts)\r\n --outDir <p> Output dir (default: dist)\r\n\r\n Examples:\r\n vorra new my-app\r\n vorra dev --port 4000\r\n vorra build --outDir dist\r\n`;\r\n\r\nswitch (command) {\r\n case 'new':\r\n runNew(commandArgs);\r\n break;\r\n\r\n case 'dev':\r\n runDev(commandArgs).catch((err: unknown) => {\r\n const msg = err instanceof Error ? err.message : String(err);\r\n console.error('[Vorra CLI] dev error:', msg);\r\n process.exit(1);\r\n });\r\n break;\r\n\r\n case 'build':\r\n runBuild(commandArgs).catch((err: unknown) => {\r\n const msg = err instanceof Error ? err.message : String(err);\r\n console.error('[Vorra CLI] build error:', msg);\r\n process.exit(1);\r\n });\r\n break;\r\n\r\n case 'typecheck':\r\n runTypecheck(commandArgs);\r\n break;\r\n\r\n case '--version':\r\n case '-v':\r\n console.log(VERSION);\r\n break;\r\n\r\n case '--help':\r\n case '-h':\r\n case undefined:\r\n console.log(HELP);\r\n break;\r\n\r\n default:\r\n console.error(\r\n `[Vorra CLI] Unknown command: \"${command}\". Run \"vorra --help\" for usage.`,\r\n );\r\n process.exit(1);\r\n}\r\n"],"mappings":";;;;;;;;;;AAWA,MAAM,oBAAoB;CACxB;CACA;CACA;CACD;;;;;;;;;AAUD,eAAsB,WAAW,KAAmC;AAClE,MAAK,MAAM,aAAa,mBAAmB;EACzC,MAAM,aAAa,KAAK,KAAK,KAAK,UAAU;AAC5C,MAAI,GAAG,WAAW,WAAW,EAAE;GAG7B,MAAM,MAAO,MAAM,OAFH,IAAI,cAAc,WAAW,CAAC;AAG9C,OAAI,IAAI,YAAY,QAAQ,IAAI,YAAY,KAAA,KAAa,OAAO,IAAI,YAAY,SAC9E,QAAO,IAAI;AAEb,UAAO,EAAE;;;CAKb,MAAM,eAAe,KAAK,KAAK,KAAK,kBAAkB;AACtD,KAAI,GAAG,WAAW,aAAa,CAC7B,SAAQ,KACN,gKAED;AAGH,QAAO,EAAE;;;;AC/BX,MAAM,WAAW,cAAc,OAAO,KAAK,IAAI;;;;;;;AAQ/C,SAAgB,oBAA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,KAAK,EAAE;IACf;AACF;CAEF,KAAK;AACH,eAAa,YAAY;AACzB;CAEF,KAAK;CACL,KAAK;AACH,UAAQ,IAAI,QAAQ;AACpB;CAEF,KAAK;CACL,KAAK;CACL,KAAK,KAAA;AACH,UAAQ,IAAI,KAAK;AACjB;CAEF;AACE,UAAQ,MACN,iCAAiC,QAAQ,kCAC1C;AACD,UAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"bin.js","names":[],"sources":["../src/utils/config.ts","../src/utils/vorra-dedupe-plugin.ts","../src/commands/build.ts","../src/commands/dev.ts","../src/commands/new.ts","../src/commands/typecheck.ts","../src/bin.ts"],"sourcesContent":["// =============================================================================\r\n// @vorra/cli — Config loader\r\n// Loads vorra.config.js / .mjs / .cjs from the project root.\r\n// TypeScript configs require a TS loader (tsx, ts-node) to be active.\r\n// =============================================================================\r\n\r\nimport * as fs from 'node:fs';\r\nimport * as path from 'node:path';\r\nimport * as url from 'node:url';\r\nimport type { VorraConfig } from '../index.js';\r\n\r\nconst CONFIG_CANDIDATES = [\r\n 'vorra.config.js',\r\n 'vorra.config.mjs',\r\n 'vorra.config.cjs',\r\n];\r\n\r\n/**\r\n * Loads vorra.config.{js,mjs,cjs} from `cwd` and returns the config object.\r\n * Returns an empty object if no config file is found.\r\n *\r\n * Note: `.ts` configs are not supported at CLI runtime without a TS loader.\r\n * Compile `vorra.config.ts` to `.js` first, or run with `tsx`:\r\n * npx tsx node_modules/.bin/forge dev\r\n */\r\nexport async function loadConfig(cwd: string): Promise<VorraConfig> {\r\n for (const candidate of CONFIG_CANDIDATES) {\r\n const configPath = path.join(cwd, candidate);\r\n if (fs.existsSync(configPath)) {\r\n const fileUrl = url.pathToFileURL(configPath).href;\r\n // Dynamic import — works for ESM and CJS configs alike.\r\n const mod = (await import(fileUrl)) as { default?: unknown };\r\n if (mod.default !== null && mod.default !== undefined && typeof mod.default === 'object') {\r\n return mod.default as VorraConfig;\r\n }\r\n return {};\r\n }\r\n }\r\n\r\n // Warn if a TS config exists but cannot be loaded.\r\n const tsConfigPath = path.join(cwd, 'vorra.config.ts');\r\n if (fs.existsSync(tsConfigPath)) {\r\n console.warn(\r\n '[Vorra CLI] vorra.config.ts found but cannot be loaded without a TS loader.\\n' +\r\n ' Tip: Compile it first (tsc vorra.config.ts) or run via: npx tsx .../bin.js dev',\r\n );\r\n }\r\n\r\n return {};\r\n}\r\n","// =============================================================================\n// vorra-dedupe-plugin\n// Forces all @vorra/* imports to their canonical dist entry points so that\n// Rolldown always bundles a single module instance, regardless of whether the\n// import comes from TypeScript source (resolved via tsconfig paths → src/) or\n// from a pre-built dist file (node_modules resolution → dist/).\n//\n// Dual-instance @vorra/core is the most critical failure mode: two copies of\n// the reactivity module produce two independent `activeContext` globals, so\n// signals created by one instance are invisible to effects created by the\n// other (e.g. form control signals never connecting to template effects).\n// =============================================================================\n\nimport * as path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { RolldownPlugin } from 'rolldown';\n\n// The resolver defaults to import.meta.resolve (stable since Node 20).\n// Tests can swap this out via setResolverForTesting() before importing\n// the module under test.\nlet _metaResolve: (id: string) => string = (id) => import.meta.resolve(id);\n\n/** @internal — for test use only */\nexport function setResolverForTesting(r: (id: string) => string): void {\n _metaResolve = r;\n _aliases = undefined; // bust the alias cache so new paths are computed\n}\n\n/**\n * Resolves an `@vorra/*` package to an absolute path inside its `dist/`\n * directory. Uses import.meta.resolve() (stable since Node 20) to locate\n * the package's ESM main entry, then walks up to the package root.\n */\nexport function resolveVorraPackage(name: string, subpath = 'dist/index.js'): string {\n const resolved = _metaResolve(name); // → file:///…/dist/index.js (or plain path in tests)\n const mainPath = resolved.startsWith('file://') ? fileURLToPath(resolved) : resolved;\n const pkgRoot = path.dirname(path.dirname(mainPath)); // strip dist/index.js\n return path.join(pkgRoot, subpath);\n}\n\n/**\n * Lazily-built alias map. Populated on first use inside `resolveId` so that\n * importing this module never triggers resolution at load time.\n * This keeps the module safe to import in test environments where `dist/`\n * files may not exist yet.\n */\nlet _aliases: Record<string, string> | undefined;\n\nexport function getVorraAliases(): Record<string, string> {\n if (_aliases === undefined) {\n _aliases = {\n '@vorra/core': resolveVorraPackage('@vorra/core'),\n '@vorra/core/dom': resolveVorraPackage('@vorra/core', 'dist/dom.js'),\n '@vorra/core/reactivity': resolveVorraPackage('@vorra/core', 'dist/reactivity.js'),\n '@vorra/core/di': resolveVorraPackage('@vorra/core', 'dist/di.js'),\n '@vorra/forms': resolveVorraPackage('@vorra/forms'),\n '@vorra/router': resolveVorraPackage('@vorra/router'),\n };\n }\n return _aliases;\n}\n\n/**\n * Rolldown plugin that forces all `@vorra/*` imports to their canonical dist\n * entry points. A `resolveId` hook applies unconditionally to every import —\n * including those inside pre-built dist files — unlike `resolve.alias` which\n * Rolldown skips for files it considers already-resolved.\n */\nexport const vorraDedupePlugin: RolldownPlugin = {\n name: 'vorra-dedupe',\n resolveId(id: string) {\n const resolved = getVorraAliases()[id];\n if (resolved !== undefined) {\n return { id: resolved, external: false };\n }\n return undefined;\n },\n};\n","// =============================================================================\r\n// @vorra/cli — vorra build\r\n// Runs a one-shot Rolldown production build with the Vorra plugin.\r\n// =============================================================================\r\n\r\nimport * as fs from 'node:fs';\r\nimport * as path from 'node:path';\r\nimport { rolldown } from 'rolldown';\r\nimport type { RolldownPlugin } from 'rolldown';\r\nimport { vorraPlugin } from '@vorra/compiler';\r\nimport { loadConfig } from '../utils/config.js';\r\nimport { vorraDedupePlugin } from '../utils/vorra-dedupe-plugin.js';\r\n\r\n/**\r\n * Runs a production build.\r\n *\r\n * CLI flags (override vorra.config.js):\r\n * --entry <path> Entry file (default: src/main.ts)\r\n * --outDir <path> Output directory (default: dist)\r\n */\r\nexport async function runBuild(args: string[]): Promise<void> {\r\n const cwd = process.cwd();\r\n const config = await loadConfig(cwd);\r\n\r\n // Parse CLI flags — these override vorra.config values.\r\n const entryIdx = args.indexOf('--entry');\r\n const outDirIdx = args.indexOf('--outDir');\r\n\r\n const entry =\r\n (entryIdx !== -1 ? args[entryIdx + 1] : undefined) ?? config.entry ?? 'src/main.ts';\r\n const outDir =\r\n (outDirIdx !== -1 ? args[outDirIdx + 1] : undefined) ?? config.outDir ?? 'dist';\r\n\r\n const entryAbs = path.join(cwd, entry);\r\n const outDirAbs = path.join(cwd, outDir);\r\n const entryName = path.basename(entry, path.extname(entry));\r\n const userPlugins = (config.plugins ?? []) as RolldownPlugin[];\r\n const plugins: RolldownPlugin[] = [\r\n vorraDedupePlugin as RolldownPlugin,\r\n vorraPlugin({\r\n ...(config.css ? { css: path.join(cwd, config.css) } : {}),\r\n ...(config.postcss ? { postcss: config.postcss } : {}),\r\n }) as RolldownPlugin,\r\n ...userPlugins,\r\n ];\r\n\r\n console.log(`[vorra build] ${entry} → ${outDir}/`);\r\n\r\n const build = await rolldown({\r\n input: entryAbs,\r\n plugins,\r\n });\r\n\r\n const sourcemap = config.sourcemap ?? false;\r\n\r\n await build.write({\r\n dir: outDirAbs,\r\n format: 'es',\r\n sourcemap,\r\n entryFileNames: '[name].js',\r\n chunkFileNames: '[name]-[hash].js',\r\n });\r\n\r\n // -------------------------------------------------------------------------\r\n // Copy index.html into dist/, rewriting script/link src paths that reference\r\n // the output directory so the dist/ folder is fully self-contained.\r\n // -------------------------------------------------------------------------\r\n const htmlSrc = path.join(cwd, 'index.html');\r\n if (fs.existsSync(htmlSrc)) {\r\n const outDirRel = path.relative(cwd, outDirAbs).replace(/\\\\/g, '/');\r\n // Match src/href attribute values that start with the outDir prefix\r\n // (with or without a leading ./), e.g. \"./dist/main.js\" or \"dist/main.js\".\r\n const outDirPattern = new RegExp(\r\n `((?:src|href)=[\"'])(?:\\\\./)?(${escapeRegExp(outDirRel)}/)`,\r\n 'g',\r\n );\r\n let html = fs.readFileSync(htmlSrc, 'utf8');\r\n // Rewrite any existing script/link paths that reference the outDir prefix.\r\n html = html.replace(outDirPattern, '$1');\r\n // Auto-inject the entry module script if the HTML has no module script tag.\r\n if (!/<script\\s[^>]*type=[\"']module[\"']/i.test(html)) {\r\n const tag = ` <script type=\"module\" src=\"./${entryName}.js\"></script>`;\r\n html = html.includes('</body>') ? html.replace('</body>', `${tag}\\n</body>`) : html + tag;\r\n }\r\n fs.writeFileSync(path.join(outDirAbs, 'index.html'), html, 'utf8');\r\n console.log(`[vorra build] Copied index.html → ${outDir}/index.html`);\r\n } else {\r\n console.warn('[vorra build] No index.html found in project root — skipping HTML copy.');\r\n }\r\n\r\n console.log('[vorra build] Done.');\r\n}\r\n\r\n/** Escapes special regex characters in a literal string. */\r\nfunction escapeRegExp(str: string): string {\r\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n}\r\n","// =============================================================================\r\n// @vorra/cli — vorra dev\r\n// Development server: Rolldown one-shot builds + fs.watch for source changes +\r\n// Server-Sent Events (SSE) for component-level HMR.\r\n//\r\n// We intentionally do NOT use Rolldown's watch() API because its native\r\n// file-watcher does not reliably exclude the output directory on Windows,\r\n// causing every build write to trigger another rebuild (infinite loop).\r\n// Instead we use Node's built-in fs.watch() restricted to source files only.\r\n//\r\n// HMR strategy:\r\n// - Each .vorra file is split into its own output chunk (stable name).\r\n// - fs.watch tracks which .vorra files changed during a quiet period.\r\n// - If ONLY .vorra files changed, an 'hmr-update' SSE event is sent so the\r\n// browser can hot-swap individual components without a full page reload.\r\n// - If any non-.vorra source file also changed, a full 'reload' is sent\r\n// (e.g. a service dependency changed — the whole app must restart).\r\n// =============================================================================\r\n\r\nimport * as http from 'node:http';\r\nimport * as fs from 'node:fs';\r\nimport * as path from 'node:path';\r\nimport { build } from 'rolldown';\r\nimport type { RolldownPlugin, OutputOptions } from 'rolldown';\r\nimport { vorraPlugin, generateScopeId } from '@vorra/compiler';\r\nimport { loadConfig } from '../utils/config.js';\r\nimport { vorraDedupePlugin } from '../utils/vorra-dedupe-plugin.js';\r\n\r\n// ---------------------------------------------------------------------------\r\n// Constants\r\n// ---------------------------------------------------------------------------\r\n\r\nconst HMR_ENDPOINT = '/__vorra_hmr';\r\n\r\n/**\r\n * Injected before </body> in every HTML response.\r\n *\r\n * Sets up window.__vorra_hmr with an instance registry, then opens an SSE\r\n * connection to receive either component-level HMR updates or full reloads.\r\n *\r\n * 'hmr-update' — one or more .vorra chunks changed; each is re-imported with\r\n * a cache-busting timestamp. The new chunk calls window.__vorra_hmr.accept()\r\n * which triggers the in-place component swap implemented in @vorra/core.\r\n *\r\n * 'reload' — a non-component file changed; fall back to a full page reload.\r\n */\r\nconst HMR_CLIENT_SCRIPT = `<script type=\"module\">\r\n(function () {\r\n if (!window.__vorra_hmr) window.__vorra_hmr = {};\r\n var hmr = window.__vorra_hmr;\r\n if (!hmr.instances) hmr.instances = new Map();\r\n\r\n var es = new EventSource('${HMR_ENDPOINT}');\r\n\r\n es.addEventListener('hmr-update', function (e) {\r\n var data = JSON.parse(e.data);\r\n data.updates.forEach(function (update) {\r\n console.log('[vorra hmr] updating component ' + update.id);\r\n import(update.url + '?t=' + Date.now()).catch(function (err) {\r\n console.error('[vorra hmr] failed to load update, falling back to reload', err);\r\n location.reload();\r\n });\r\n });\r\n });\r\n\r\n es.addEventListener('reload', function () {\r\n console.log('[vorra hmr] full reload');\r\n location.reload();\r\n });\r\n\r\n es.addEventListener('error', function () { es.close(); });\r\n})();\r\n</script>`;\r\n\r\nconst MIME: Record<string, string> = {\r\n '.html': 'text/html; charset=utf-8',\r\n '.js': 'application/javascript; charset=utf-8',\r\n '.mjs': 'application/javascript; charset=utf-8',\r\n '.css': 'text/css; charset=utf-8',\r\n '.json': 'application/json; charset=utf-8',\r\n '.svg': 'image/svg+xml',\r\n '.png': 'image/png',\r\n '.jpg': 'image/jpeg',\r\n '.jpeg': 'image/jpeg',\r\n '.ico': 'image/x-icon',\r\n '.woff': 'font/woff',\r\n '.woff2': 'font/woff2',\r\n '.ttf': 'font/ttf',\r\n};\r\n\r\n// ---------------------------------------------------------------------------\r\n// Main\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Starts the vorra development server.\r\n *\r\n * CLI flags (override vorra.config.js):\r\n * --port <number> Dev server port (default: 3000)\r\n * --entry <path> Entry file (default: src/main.ts)\r\n * --outDir <path> Output directory (default: dist)\r\n */\r\nexport async function runDev(args: string[]): Promise<void> {\r\n const cwd = process.cwd();\r\n const config = await loadConfig(cwd);\r\n\r\n // Parse CLI flags.\r\n const portIdx = args.indexOf('--port');\r\n const entryIdx = args.indexOf('--entry');\r\n const outDirIdx = args.indexOf('--outDir');\r\n\r\n const port =\r\n portIdx !== -1\r\n ? parseInt(args[portIdx + 1] ?? '3000', 10)\r\n : (config.port ?? 3000);\r\n const entry =\r\n (entryIdx !== -1 ? args[entryIdx + 1] : undefined) ?? config.entry ?? 'src/main.ts';\r\n const outDir =\r\n (outDirIdx !== -1 ? args[outDirIdx + 1] : undefined) ?? config.devOutDir ?? '.vorra';\r\n\r\n const entryAbs = path.join(cwd, entry);\r\n const outDirAbs = path.join(cwd, outDir);\r\n // Normalise to forward-slash for reliable prefix checks on Windows.\r\n const outDirNorm = outDirAbs.replace(/\\\\/g, '/') + '/';\r\n const outDirRel = path.relative(cwd, outDirAbs).replace(/\\\\/g, '/');\r\n\r\n const userPlugins = (config.plugins ?? []) as RolldownPlugin[];\r\n // Replace the __vorra_dev compile-time constant with `true` so the HMR\r\n // runtime block in @vorra/core/dom.ts is included (and dead code in\r\n // production builds is tree-shaken when the constant is `false`).\r\n // Rolldown's programmatic build() API does not accept a top-level `define`\r\n // option, so we use a minimal transform plugin instead.\r\n const devDefinePlugin: RolldownPlugin = {\r\n name: 'vorra-dev-define',\r\n transform(code: string) {\r\n if (!code.includes('__vorra_dev')) return null;\r\n // Strip TypeScript `declare const __vorra_dev` ambient declarations so that\r\n // Rolldown resolving workspace packages to their TypeScript source (via root\r\n // tsconfig `paths`) doesn't produce invalid syntax like `declare const true`.\r\n let result = code.replace(/declare\\s+const\\s+__vorra_dev\\b[^\\n]*\\n?/g, '');\r\n result = result.replaceAll('__vorra_dev', 'true');\r\n return { code: result };\r\n },\r\n };\r\n const plugins: RolldownPlugin[] = [\r\n vorraDedupePlugin,\r\n vorraPlugin({\r\n hmr: true,\r\n ...(config.css ? { css: path.join(cwd, config.css) } : {}),\r\n ...(config.postcss ? { postcss: config.postcss } : {}),\r\n }) as RolldownPlugin,\r\n devDefinePlugin,\r\n ...userPlugins,\r\n ];\r\n\r\n // Ensure output directory exists before the first build.\r\n fs.mkdirSync(outDirAbs, { recursive: true });\r\n\r\n // -------------------------------------------------------------------------\r\n // SSE clients\r\n // -------------------------------------------------------------------------\r\n\r\n const clients = new Set<http.ServerResponse>();\r\n\r\n /** Broadcasts an SSE event to all connected browser clients. */\r\n function broadcast(event: string, data: string): void {\r\n for (const client of clients) {\r\n try {\r\n client.write(`event: ${event}\\ndata: ${data}\\n\\n`);\r\n } catch {\r\n // Dead connection — remove it.\r\n clients.delete(client);\r\n }\r\n }\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // HMR change tracking\r\n //\r\n // The fs.watch callback populates these sets as files change. runBuild()\r\n // drains them at the start of each build to decide whether to send a\r\n // component-level HMR update or a full page reload.\r\n // -------------------------------------------------------------------------\r\n\r\n /** Absolute paths of .vorra files that changed since the last build. */\r\n const changedVorraFiles = new Set<string>();\r\n /** True if any non-.vorra source file changed since the last build. */\r\n let hasNonVorraChanges = false;\r\n\r\n // -------------------------------------------------------------------------\r\n // One-shot Rolldown build\r\n // -------------------------------------------------------------------------\r\n\r\n let isBuilding = false;\r\n let pendingRebuild = false;\r\n\r\n // Each .vorra component gets its own output chunk (stable name so the\r\n // browser can cache-bust with ?t=timestamp on HMR update).\r\n // manualChunks is part of Rolldown's Rollup-compatible surface but is not\r\n // in its native OutputOptions type yet; cast through unknown to suppress.\r\n const devOutput: OutputOptions = {\r\n dir: outDirAbs,\r\n format: 'es',\r\n sourcemap: true,\r\n entryFileNames: '[name].js',\r\n // Stable chunk names (no content hash) so the browser can predict the URL.\r\n chunkFileNames: '[name].js',\r\n ...(({\r\n manualChunks(id: string): string | undefined {\r\n // Each .vorra component becomes its own chunk so only the changed\r\n // component needs to be re-fetched on HMR update.\r\n if (id.endsWith('.vorra')) {\r\n return path.relative(cwd, id).replace(/\\\\/g, '/').replace('.vorra', '');\r\n }\r\n // Bundle all @vorra/* runtime into a single stable shared chunk.\r\n if (id.includes(path.join('node_modules', '@vorra'))) {\r\n return 'vorra-runtime';\r\n }\r\n return undefined;\r\n },\r\n }) as unknown as Partial<OutputOptions>),\r\n };\r\n\r\n async function runBuild(): Promise<void> {\r\n if (isBuilding) {\r\n // A build is already in flight; schedule a follow-up instead of stacking.\r\n pendingRebuild = true;\r\n return;\r\n }\r\n isBuilding = true;\r\n pendingRebuild = false;\r\n\r\n // Snapshot and clear the change sets before the async build starts so\r\n // any edits made during the build are captured in the next cycle.\r\n const currentVorraChanges = new Set(changedVorraFiles);\r\n const currentHasNonVorra = hasNonVorraChanges;\r\n changedVorraFiles.clear();\r\n hasNonVorraChanges = false;\r\n\r\n try {\r\n await build({\r\n input: entryAbs,\r\n plugins,\r\n output: devOutput,\r\n });\r\n\r\n if (currentVorraChanges.size > 0 && !currentHasNonVorra) {\r\n // Only .vorra files changed — perform component-level HMR.\r\n const updates = Array.from(currentVorraChanges).map((filePath) => {\r\n const id = generateScopeId(filePath);\r\n const rel = path.relative(cwd, filePath).replace(/\\\\/g, '/').replace('.vorra', '');\r\n // URL the browser will request; the static server resolves it from outDirAbs.\r\n const url = `/${path.join(outDir, rel).replace(/\\\\/g, '/')}.js`;\r\n return { id, url };\r\n });\r\n console.log(`[vorra hmr] Hot-updating ${updates.length} component(s)...`);\r\n broadcast('hmr-update', JSON.stringify({ updates }));\r\n } else {\r\n // Non-.vorra source changed (service, utility, config, etc.) — full reload.\r\n console.log('[vorra dev] Rebuilt — notifying clients...');\r\n broadcast('reload', '{}');\r\n }\r\n } catch {\r\n console.error('[vorra dev] Build error — check the terminal above for details.');\r\n } finally {\r\n isBuilding = false;\r\n if (pendingRebuild) {\r\n void runBuild();\r\n }\r\n }\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // Source file watcher (fs.watch, source files only)\r\n // -------------------------------------------------------------------------\r\n //\r\n // We watch the entire project root but skip anything inside the output\r\n // directory and node_modules. This avoids the Rolldown-watcher bug where\r\n // the native exclude option does not reliably prevent dist/ writes from\r\n // re-triggering a rebuild on Windows.\r\n\r\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\n const fsWatcher = fs.watch(cwd, { recursive: true }, (_event, filename) => {\r\n if (!filename) return;\r\n\r\n // Normalise to forward slashes for consistent prefix matching.\r\n const rel = filename.replace(/\\\\/g, '/');\r\n\r\n // Ignore output directory and node_modules.\r\n if (rel.startsWith(outDirRel + '/')) return;\r\n if (rel.startsWith('node_modules/')) return;\r\n\r\n // Also guard against absolute paths that lie inside outDir (Windows edge case).\r\n const abs = path.resolve(cwd, filename).replace(/\\\\/g, '/') + '/';\r\n if (abs.startsWith(outDirNorm)) return;\r\n\r\n // Track file type for HMR decision.\r\n // Only recognised source extensions should trigger a rebuild — everything\r\n // else (editor temp files, OS metadata, TypeScript build-info, etc.) is\r\n // ignored entirely, including the debounce, so it cannot cause a spurious\r\n // empty rebuild that falls to the full-reload branch.\r\n const SOURCE_EXTENSIONS = ['.ts', '.tsx', '.js', '.mjs', '.cjs', '.json', '.html', '.css'];\r\n if (filename.endsWith('.vorra')) {\r\n changedVorraFiles.add(path.resolve(cwd, filename));\r\n } else if (SOURCE_EXTENSIONS.some((ext) => filename.endsWith(ext))) {\r\n hasNonVorraChanges = true;\r\n } else {\r\n // Not a source file we care about — skip debounce entirely.\r\n return;\r\n }\r\n\r\n if (debounceTimer) clearTimeout(debounceTimer);\r\n debounceTimer = setTimeout(() => {\r\n debounceTimer = null;\r\n void runBuild();\r\n }, 80);\r\n });\r\n\r\n // Derive the entry script URL so we can auto-inject it into HTML responses\r\n // when the user's index.html has no <script type=\"module\"> tag.\r\n const entryName = path.basename(entry, path.extname(entry));\r\n const devScriptSrc = `/${outDir}/${entryName}.js`;\r\n\r\n // Initial build on startup.\r\n console.log(`[vorra dev] Server: http://localhost:${port}`);\r\n console.log(`[vorra dev] Entry: ${entry}`);\r\n console.log(`[vorra dev] Output: ${outDir}/`);\r\n console.log('[vorra dev] HMR: enabled');\r\n console.log('[vorra dev] Building...');\r\n await runBuild();\r\n console.log('[vorra dev] Watching for changes...\\n');\r\n\r\n // -------------------------------------------------------------------------\r\n // HTTP server\r\n // -------------------------------------------------------------------------\r\n\r\n const server = http.createServer((req, res) => {\r\n const rawUrl = req.url ?? '/';\r\n\r\n // SSE endpoint — browsers connect here to receive HMR / reload events.\r\n if (rawUrl === HMR_ENDPOINT) {\r\n res.writeHead(200, {\r\n 'Content-Type': 'text/event-stream',\r\n 'Cache-Control': 'no-cache',\r\n Connection: 'keep-alive',\r\n 'Access-Control-Allow-Origin': '*',\r\n });\r\n // Initial comment keeps the connection alive in some browsers.\r\n res.write(':\\n\\n');\r\n clients.add(res);\r\n // res.on('close') is more reliable than req.on('close') for detecting\r\n // client disconnection on a streaming (never-ended) response.\r\n res.on('close', () => {\r\n clients.delete(res);\r\n });\r\n return;\r\n }\r\n\r\n // Strip query string (allows cache-busting via ?t=timestamp).\r\n const urlPath = rawUrl.split('?')[0] ?? '/';\r\n\r\n // Resolve to a file on disk.\r\n const filePath = resolveFilePath(urlPath, cwd, outDirAbs);\r\n\r\n if (filePath === null) {\r\n res.writeHead(404, { 'Content-Type': 'text/plain' });\r\n res.end(`Not found: ${urlPath}`);\r\n return;\r\n }\r\n\r\n serveFile(filePath, res, devScriptSrc);\r\n });\r\n\r\n server.listen(port);\r\n\r\n // -------------------------------------------------------------------------\r\n // Graceful shutdown\r\n // -------------------------------------------------------------------------\r\n\r\n process.on('SIGINT', () => {\r\n console.log('\\n[vorra dev] Stopping...');\r\n fsWatcher.close();\r\n // Close all open SSE connections so server.close() callback fires immediately.\r\n for (const client of clients) {\r\n try { client.destroy(); } catch { /* ignore */ }\r\n }\r\n clients.clear();\r\n server.closeAllConnections();\r\n server.close(() => process.exit(0));\r\n });\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Helpers\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Resolves a URL path to a file on disk.\r\n *\r\n * Search order:\r\n * 1. `<cwd>/<urlPath>` — public assets, index.html in project root\r\n * 2. `<outDir>/<urlPath>` — compiled JS / CSS output\r\n * 3. `<cwd>/index.html` — SPA fallback for unknown paths\r\n *\r\n * Returns null if no file is found anywhere.\r\n */\r\nfunction resolveFilePath(\r\n urlPath: string,\r\n cwd: string,\r\n outDirAbs: string,\r\n): string | null {\r\n const normalized = urlPath === '/' ? '/index.html' : urlPath;\r\n\r\n const fromCwd = path.join(cwd, normalized);\r\n if (fs.existsSync(fromCwd) && fs.statSync(fromCwd).isFile()) return fromCwd;\r\n\r\n const fromDist = path.join(outDirAbs, normalized);\r\n if (fs.existsSync(fromDist) && fs.statSync(fromDist).isFile()) return fromDist;\r\n\r\n // SPA fallback — serve index.html so client-side routing works.\r\n const indexHtml = path.join(cwd, 'index.html');\r\n if (fs.existsSync(indexHtml)) return indexHtml;\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Reads a file from disk and writes it to the HTTP response.\r\n *\r\n * For HTML files, two scripts are injected before </body>:\r\n * 1. The compiled entry module — only when no <script type=\"module\"> is\r\n * already present in the file, so users don't need to add the tag\r\n * manually; the framework adds it for them.\r\n * 2. The HMR client — always present in dev mode.\r\n */\r\nfunction serveFile(filePath: string, res: http.ServerResponse, entryScript?: string): void {\r\n const ext = path.extname(filePath).toLowerCase();\r\n const contentType = MIME[ext] ?? 'application/octet-stream';\r\n\r\n let body: Buffer;\r\n try {\r\n body = fs.readFileSync(filePath);\r\n } catch {\r\n res.writeHead(500, { 'Content-Type': 'text/plain' });\r\n res.end('Internal server error');\r\n return;\r\n }\r\n\r\n // Inject entry script + HMR client into HTML responses.\r\n if (ext === '.html') {\r\n let html = body.toString('utf8');\r\n\r\n // Auto-inject the entry module script if the HTML has no module script tag.\r\n if (entryScript && !/<script\\s[^>]*type=[\"']module[\"']/i.test(html)) {\r\n const tag = `<script type=\"module\" src=\"${entryScript}\"></script>`;\r\n html = html.includes('</body>') ? html.replace('</body>', `${tag}\\n</body>`) : html + tag;\r\n }\r\n\r\n const injected = html.includes('</body>')\r\n ? html.replace('</body>', `${HMR_CLIENT_SCRIPT}\\n</body>`)\r\n : html + HMR_CLIENT_SCRIPT;\r\n const injectedBuf = Buffer.from(injected, 'utf8');\r\n res.writeHead(200, {\r\n 'Content-Type': contentType,\r\n 'Content-Length': injectedBuf.length,\r\n });\r\n res.end(injectedBuf);\r\n return;\r\n }\r\n\r\n res.writeHead(200, {\r\n 'Content-Type': contentType,\r\n 'Content-Length': body.length,\r\n });\r\n res.end(body);\r\n}\r\n","// =============================================================================\r\n// @vorra/cli — vorra new\r\n// Scaffolds a new Vorra application in a subdirectory of cwd.\r\n// =============================================================================\r\n\r\nimport * as fs from 'node:fs';\r\nimport * as path from 'node:path';\r\n\r\n/**\r\n * Scaffolds a new project.\r\n *\r\n * Usage: vorra new <project-name>\r\n *\r\n * Creates the following structure:\r\n * <name>/\r\n * .gitignore\r\n * index.html\r\n * vorra.config.js\r\n * package.json\r\n * tsconfig.json\r\n * src/\r\n * env.d.ts\r\n * main.ts\r\n * App.vorra\r\n */\r\nexport function runNew(args: string[]): void {\r\n const name = args[0];\r\n\r\n if (!name) {\r\n console.error('[Vorra CLI] Usage: vorra new <project-name>');\r\n process.exit(1);\r\n return;\r\n }\r\n\r\n if (!/^[a-z][a-z0-9-]*$/.test(name)) {\r\n console.error(\r\n '[Vorra CLI] Project name must be lowercase letters/digits/hyphens, starting with a letter.',\r\n );\r\n process.exit(1);\r\n return;\r\n }\r\n\r\n const projectDir = path.join(process.cwd(), name);\r\n\r\n if (fs.existsSync(projectDir)) {\r\n console.error(`[Vorra CLI] Directory \"${name}\" already exists.`);\r\n process.exit(1);\r\n return;\r\n }\r\n\r\n console.log(`\\n Scaffolding Vorra app: ${name}\\n`);\r\n\r\n // Create directory tree.\r\n fs.mkdirSync(path.join(projectDir, 'src'), { recursive: true });\r\n\r\n // Write each template file.\r\n write(projectDir, 'package.json', tplPackageJson(name));\r\n write(projectDir, 'tsconfig.json', tplTsconfig());\r\n write(projectDir, 'vorra.config.js', tplVorraConfig());\r\n write(projectDir, 'index.html', tplIndexHtml(name));\r\n write(projectDir, '.gitignore', tplGitignore());\r\n write(projectDir, 'src/env.d.ts', tplEnvDts());\r\n write(projectDir, 'src/main.ts', tplMainTs());\r\n write(projectDir, 'src/App.vorra', tplAppVorra());\r\n\r\n const files = [\r\n 'package.json',\r\n 'tsconfig.json',\r\n 'vorra.config.js',\r\n 'index.html',\r\n '.gitignore',\r\n 'src/env.d.ts',\r\n 'src/main.ts',\r\n 'src/App.vorra',\r\n ];\r\n\r\n for (const f of files) {\r\n console.log(` \\u2713 ${name}/${f}`);\r\n }\r\n\r\n console.log(`\r\n Done! Next steps:\r\n\r\n cd ${name}\r\n npm install\r\n npm run dev\r\n`);\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Helpers\r\n// ---------------------------------------------------------------------------\r\n\r\nfunction write(dir: string, filename: string, content: string): void {\r\n fs.writeFileSync(path.join(dir, filename), content, 'utf8');\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Templates\r\n// ---------------------------------------------------------------------------\r\n\r\nfunction tplPackageJson(name: string): string {\r\n return JSON.stringify(\r\n {\r\n name,\r\n version: '0.1.0',\r\n private: true,\r\n type: 'module',\r\n scripts: {\r\n dev: 'vorra dev',\r\n build: 'vorra build',\r\n typecheck: 'vorra typecheck',\r\n },\r\n dependencies: {\r\n '@vorra/core': '^0.1.0',\r\n },\r\n devDependencies: {\r\n '@vorra/cli': '^0.1.0',\r\n '@vorra/compiler': '^0.1.0',\r\n rolldown: '^0.14.0',\r\n typescript: '^5.4.0',\r\n },\r\n engines: {\r\n node: '>=20.0.0',\r\n },\r\n },\r\n null,\r\n 2,\r\n );\r\n}\r\n\r\nfunction tplTsconfig(): string {\r\n return JSON.stringify(\r\n {\r\n compilerOptions: {\r\n target: 'ES2022',\r\n module: 'ESNext',\r\n moduleResolution: 'Bundler',\r\n strict: true,\r\n exactOptionalPropertyTypes: true,\r\n noUncheckedIndexedAccess: true,\r\n experimentalDecorators: true,\r\n useDefineForClassFields: false,\r\n skipLibCheck: true,\r\n noEmit: true,\r\n },\r\n include: ['src'],\r\n },\r\n null,\r\n 2,\r\n );\r\n}\r\n\r\nfunction tplVorraConfig(): string {\r\n return `// vorra.config.js\r\nimport { defineConfig } from '@vorra/cli';\r\n\r\nexport default defineConfig({\r\n entry: 'src/main.ts',\r\n outDir: 'dist',\r\n port: 3000,\r\n});\r\n`;\r\n}\r\n\r\nfunction tplIndexHtml(name: string): string {\r\n return `<!DOCTYPE html>\r\n<html lang=\"en\">\r\n <head>\r\n <meta charset=\"UTF-8\" />\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\r\n <title>${name}</title>\r\n </head>\r\n <body>\r\n <div id=\"app\"></div>\r\n <!-- entry script injected automatically by vorra dev / vorra build -->\r\n </body>\r\n</html>\r\n`;\r\n}\r\n\r\nfunction tplGitignore(): string {\r\n return `node_modules/\r\ndist/\r\n.vorra/\r\n*.tsbuildinfo\r\n`;\r\n}\r\n\r\nfunction tplEnvDts(): string {\r\n return `// Type declarations for .vorra single-file components.\r\nimport type { ComponentContext } from '@vorra/core';\r\n\r\ndeclare module '*.vorra' {\r\n const component: (ctx: ComponentContext) => Node;\r\n export default component;\r\n}\r\n`;\r\n}\r\n\r\nfunction tplMainTs(): string {\r\n return `import { bootstrapApp } from '@vorra/core';\r\nimport { createComponent, mountComponent } from '@vorra/core';\r\nimport App from './App.vorra';\r\n\r\nconst appEl = document.getElementById('app');\r\nif (appEl === null) throw new Error('[App] #app element not found in index.html');\r\n\r\nconst root = bootstrapApp();\r\nconst ctx = createComponent(root);\r\nmountComponent(App, appEl, ctx);\r\n`;\r\n}\r\n\r\nfunction tplAppVorra(): string {\r\n return `<script>\r\nimport { signal } from '@vorra/core';\r\n\r\nconst count = signal(0);\r\n\r\nfunction increment(): void {\r\n count.update((n) => n + 1);\r\n}\r\n</script>\r\n\r\n<template>\r\n <div class=\"app\">\r\n <h1>Welcome to Vorra ⚡</h1>\r\n <p class=\"counter\">Count: {count()}</p>\r\n <button @click=\"increment\">Increment</button>\r\n </div>\r\n</template>\r\n\r\n<style scoped>\r\n.app {\r\n font-family: system-ui, sans-serif;\r\n max-width: 480px;\r\n margin: 4rem auto;\r\n padding: 0 1rem;\r\n text-align: center;\r\n}\r\n\r\nh1 {\r\n font-size: 2rem;\r\n margin-bottom: 1rem;\r\n}\r\n\r\n.counter {\r\n font-size: 1.25rem;\r\n margin-bottom: 1.5rem;\r\n}\r\n\r\nbutton {\r\n padding: 0.5rem 1.5rem;\r\n font-size: 1rem;\r\n cursor: pointer;\r\n border: 2px solid currentColor;\r\n border-radius: 6px;\r\n background: transparent;\r\n transition: background 0.2s;\r\n}\r\n\r\nbutton:hover {\r\n background: #f0f0f0;\r\n}\r\n</style>\r\n`;\r\n}\r\n","// =============================================================================\r\n// @vorra/cli — vorra typecheck\r\n// Delegates to `tsc --build` in the project root.\r\n// =============================================================================\r\n\r\nimport { spawnSync } from 'node:child_process';\r\n\r\n/**\r\n * Runs TypeScript type checking via `tsc --build`.\r\n * Passes `--noEmit` unless the project tsconfig already disables emit.\r\n * Exits with the same code as tsc.\r\n */\r\nexport function runTypecheck(args: string[]): void {\r\n const noEmit = args.includes('--emit') ? [] : ['--noEmit'];\r\n\r\n console.log('[vorra typecheck] Running tsc --build...');\r\n\r\n const result = spawnSync('tsc', ['--build', ...noEmit], {\r\n stdio: 'inherit',\r\n shell: true,\r\n cwd: process.cwd(),\r\n });\r\n\r\n if (result.error !== undefined) {\r\n console.error('[Vorra CLI] Failed to run tsc:', result.error.message);\r\n process.exit(1);\r\n return;\r\n }\r\n\r\n process.exit(result.status ?? 0);\r\n}\r\n","#!/usr/bin/env node\r\n// =============================================================================\r\n// vorra CLI — bin entrypoint\r\n// Usage: vorra <command> [options]\r\n// =============================================================================\r\n\r\nimport { runBuild } from './commands/build.js';\r\nimport { runDev } from './commands/dev.js';\r\nimport { runNew } from './commands/new.js';\r\nimport { runTypecheck } from './commands/typecheck.js';\r\n\r\nconst args = process.argv.slice(2);\r\nconst command = args[0];\r\nconst commandArgs = args.slice(1);\r\n\r\nconst VERSION = '0.1.0';\r\n\r\nconst HELP = `\r\n ⚡ Vorra — compiled signal-first framework for enterprise apps\r\n\r\n Usage: vorra <command> [options]\r\n\r\n Commands:\r\n new <name> Scaffold a new Vorra application\r\n dev Start the development server (with live reload)\r\n build Build for production\r\n typecheck Run TypeScript type checking\r\n\r\n Options:\r\n --help, -h Show this help message\r\n --version, -v Show the Vorra version\r\n\r\n Flags per command:\r\n dev --port <n> Dev server port (default: 3000)\r\n --entry <p> Entry file (default: src/main.ts)\r\n --outDir <p> Output dir (default: dist)\r\n build --entry <p> Entry file (default: src/main.ts)\r\n --outDir <p> Output dir (default: dist)\r\n\r\n Examples:\r\n vorra new my-app\r\n vorra dev --port 4000\r\n vorra build --outDir dist\r\n`;\r\n\r\nswitch (command) {\r\n case 'new':\r\n runNew(commandArgs);\r\n break;\r\n\r\n case 'dev':\r\n runDev(commandArgs).catch((err: unknown) => {\r\n const msg = err instanceof Error ? err.message : String(err);\r\n console.error('[Vorra CLI] dev error:', msg);\r\n process.exit(1);\r\n });\r\n break;\r\n\r\n case 'build':\r\n runBuild(commandArgs).catch((err: unknown) => {\r\n const msg = err instanceof Error ? err.message : String(err);\r\n console.error('[Vorra CLI] build error:', msg);\r\n process.exit(1);\r\n });\r\n break;\r\n\r\n case 'typecheck':\r\n runTypecheck(commandArgs);\r\n break;\r\n\r\n case '--version':\r\n case '-v':\r\n console.log(VERSION);\r\n break;\r\n\r\n case '--help':\r\n case '-h':\r\n case undefined:\r\n console.log(HELP);\r\n break;\r\n\r\n default:\r\n console.error(\r\n `[Vorra CLI] Unknown command: \"${command}\". Run \"vorra --help\" for usage.`,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MAAM,kCAAkC,OAAO,MAAM,QAAQ;AACrE,UAAQ,KAAK,EAAE;AACf;;AAGF,SAAQ,KAAK,OAAO,UAAU,EAAE;;;;AClBlC,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;AAClC,MAAM,UAAU,KAAK;AACrB,MAAM,cAAc,KAAK,MAAM,EAAE;AAEjC,MAAM,UAAU;AAEhB,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4Bb,QAAQ,SAAR;CACE,KAAK;AACH,SAAO,YAAY;AACnB;CAEF,KAAK;AACH,SAAO,YAAY,CAAC,OAAO,QAAiB;GAC1C,MAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;AAC5D,WAAQ,MAAM,0BAA0B,IAAI;AAC5C,WAAQ,KAAK,EAAE;IACf;AACF;CAEF,KAAK;AACH,WAAS,YAAY,CAAC,OAAO,QAAiB;GAC5C,MAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;AAC5D,WAAQ,MAAM,4BAA4B,IAAI;AAC9C,WAAQ,KAAK,EAAE;IACf;AACF;CAEF,KAAK;AACH,eAAa,YAAY;AACzB;CAEF,KAAK;CACL,KAAK;AACH,UAAQ,IAAI,QAAQ;AACpB;CAEF,KAAK;CACL,KAAK;CACL,KAAK,KAAA;AACH,UAAQ,IAAI,KAAK;AACjB;CAEF;AACE,UAAQ,MACN,iCAAiC,QAAQ,kCAC1C;AACD,UAAQ,KAAK,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vorra/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Vorra CLI — vorra new / vorra dev / vorra build",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,13 +28,10 @@
28
28
  "bin": {
29
29
  "vorra": "./dist/bin.js"
30
30
  },
31
- "main": "./dist/index.cjs",
32
- "module": "./dist/index.js",
33
31
  "types": "./dist/index.d.ts",
34
32
  "exports": {
35
33
  ".": {
36
34
  "import": "./dist/index.js",
37
- "require": "./dist/index.cjs",
38
35
  "types": "./dist/index.d.ts"
39
36
  }
40
37
  },