@vesk/vesk-cli 0.2.18 → 0.2.19

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.
Files changed (2) hide show
  1. package/dist/cli.js +114 -105
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -30676,7 +30676,7 @@ var init_platform = __esm({
30676
30676
 
30677
30677
  // ../adapter/src/platform-handler.ts
30678
30678
  import { existsSync as existsSync17 } from "node:fs";
30679
- import { resolve as resolve18, dirname as dirname10 } from "node:path";
30679
+ import { resolve as resolve18, dirname as dirname10, join as join10 } from "node:path";
30680
30680
  import { fileURLToPath as fileURLToPath4 } from "node:url";
30681
30681
  function routeName2(segments) {
30682
30682
  const parts = segments.filter(Boolean).map((s) => {
@@ -30692,13 +30692,21 @@ function apiRouteName2(fullPath) {
30692
30692
  function toId(s) {
30693
30693
  return s.replace(/[^a-zA-Z0-9_]/g, "_").replace(/^_/, "");
30694
30694
  }
30695
- function findCompilerSrc2() {
30696
- const monorepo = resolve18(__dirname5, "..", "..", "..", "packages", "compiler", "dist");
30697
- if (existsSync17(monorepo)) return monorepo;
30695
+ function findCompilerSrc2(appDir) {
30696
+ const candidates = [
30697
+ resolve18(__dirname5, "..", "..", "..", "packages", "compiler", "dist"),
30698
+ resolve18(appDir, "..", "node_modules", "@vesk/compiler"),
30699
+ resolve18(appDir, "node_modules", "@vesk/compiler")
30700
+ ];
30701
+ for (const base of candidates) {
30702
+ for (const dir of [base, join10(base, "dist")]) {
30703
+ if (existsSync17(join10(dir, "server-cookies.js"))) return dir;
30704
+ }
30705
+ }
30698
30706
  throw new Error('@vesk/compiler/dist not found \u2014 run "npm run build" first');
30699
30707
  }
30700
30708
  function generatePlatformHandlerSource(input) {
30701
- const { ssrRoutes, apiRoutes, prerenderedPaths, hasMiddleware } = input;
30709
+ const { ssrRoutes, apiRoutes, prerenderedPaths, hasMiddleware, appDir } = input;
30702
30710
  const hasEvents = !!input.hasEvents;
30703
30711
  let imports = "";
30704
30712
  const routeEntries = [];
@@ -30730,7 +30738,7 @@ function generatePlatformHandlerSource(input) {
30730
30738
  const eventsStartLine = hasEvents ? " await __eventsStart({ server: null });" : "";
30731
30739
  const eventsRequestLine = hasEvents ? " await __eventsRequest(mwCtx);" : "";
30732
30740
  const localsSeed = hasEvents ? "Object.assign({}, __serverStore)" : "{}";
30733
- const compilerSrc = findCompilerSrc2();
30741
+ const compilerSrc = findCompilerSrc2(appDir);
30734
30742
  const parseCookiesImport = hasMiddleware ? `import { parseCookies } from ${JSON.stringify(resolve18(compilerSrc, "server-cookies.js"))};` : "";
30735
30743
  return `
30736
30744
  ${imports}
@@ -30933,7 +30941,7 @@ import {
30933
30941
  rmSync as rmSync2,
30934
30942
  readFileSync as readFileSync17
30935
30943
  } from "node:fs";
30936
- import { resolve as resolve19, join as join10, extname as extname6, dirname as dirname11 } from "node:path";
30944
+ import { resolve as resolve19, join as join11, extname as extname6, dirname as dirname11 } from "node:path";
30937
30945
  function ensureCleanDir(dir) {
30938
30946
  rmSync2(dir, { recursive: true, force: true });
30939
30947
  mkdirSync6(dir, { recursive: true });
@@ -30942,8 +30950,8 @@ function copyDirContents(srcDir, destDir) {
30942
30950
  if (!existsSync18(srcDir)) return;
30943
30951
  mkdirSync6(destDir, { recursive: true });
30944
30952
  for (const entry of readdirSync6(srcDir)) {
30945
- const srcPath = join10(srcDir, entry);
30946
- const destPath = join10(destDir, entry);
30953
+ const srcPath = join11(srcDir, entry);
30954
+ const destPath = join11(destDir, entry);
30947
30955
  if (statSync11(srcPath).isDirectory()) {
30948
30956
  copyDirContents(srcPath, destPath);
30949
30957
  } else {
@@ -30989,7 +30997,7 @@ function listStaticDir(dir) {
30989
30997
  if (!existsSync18(dir)) return out;
30990
30998
  function walk6(d, prefix) {
30991
30999
  for (const entry of readdirSync6(d)) {
30992
- const full = join10(d, entry);
31000
+ const full = join11(d, entry);
30993
31001
  const rel = prefix ? `${prefix}/${entry}` : entry;
30994
31002
  if (statSync11(full).isDirectory()) {
30995
31003
  walk6(full, rel);
@@ -31051,7 +31059,8 @@ async function emitPlatformOutput(platform, ctx2) {
31051
31059
  apiRoutes: ctx2.apiRoutes,
31052
31060
  prerenderedPaths,
31053
31061
  hasMiddleware: ctx2.hasMiddleware,
31054
- hasEvents: ctx2.hasEvents
31062
+ hasEvents: ctx2.hasEvents,
31063
+ appDir: resolve20(ctx2.outDir, "..")
31055
31064
  });
31056
31065
  const shell = shellFor(platform);
31057
31066
  const projectRoot = resolve20(ctx2.outDir, "..");
@@ -35422,7 +35431,7 @@ __export(typecheck_exports, {
35422
35431
  typecheckProject: () => typecheckProject
35423
35432
  });
35424
35433
  import { readFileSync as readFileSync34, readdirSync as readdirSync14, statSync as statSync22 } from "node:fs";
35425
- import { join as join21, dirname as dirname22, normalize, relative as relative7, resolve as resolve37, sep as sep7 } from "node:path";
35434
+ import { join as join22, dirname as dirname22, normalize, relative as relative7, resolve as resolve37, sep as sep7 } from "node:path";
35426
35435
  import * as ts8 from "typescript";
35427
35436
  function walkProjectFiles(projectRoot) {
35428
35437
  const code = [];
@@ -35435,7 +35444,7 @@ function walkProjectFiles(projectRoot) {
35435
35444
  return;
35436
35445
  }
35437
35446
  for (const e of entries) {
35438
- const p = join21(dir, e);
35447
+ const p = join22(dir, e);
35439
35448
  let st;
35440
35449
  try {
35441
35450
  st = statSync22(p);
@@ -35490,8 +35499,8 @@ function checkStructureFile(appDir, file) {
35490
35499
  return null;
35491
35500
  }
35492
35501
  function createTypecheckHost(projectRoot, appDir, vskFiles) {
35493
- const ambientPath = join21(appDir, "__vesk_ambient.d.ts");
35494
- const overridePath = join21(appDir, "__vesk_runtime_override.d.ts");
35502
+ const ambientPath = join22(appDir, "__vesk_ambient.d.ts");
35503
+ const overridePath = join22(appDir, "__vesk_runtime_override.d.ts");
35495
35504
  const cached = /* @__PURE__ */ new Map();
35496
35505
  const scriptKindFor = (file) => file.endsWith(".vsk") ? ts8.ScriptKind.TSX : ts8.ScriptKind.TS;
35497
35506
  const host2 = {
@@ -35561,7 +35570,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
35561
35570
  directoryExists: (dir) => ts8.sys.directoryExists(dir),
35562
35571
  getDirectories: (dir) => {
35563
35572
  try {
35564
- return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join21(dir, d.name));
35573
+ return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join22(dir, d.name));
35565
35574
  } catch {
35566
35575
  return [];
35567
35576
  }
@@ -35572,7 +35581,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
35572
35581
  resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options2) {
35573
35582
  return moduleLiterals.map(({ text }) => {
35574
35583
  if (text.endsWith(".vsk")) {
35575
- const abs = normalize(join21(dirname22(containingFile), text));
35584
+ const abs = normalize(join22(dirname22(containingFile), text));
35576
35585
  return {
35577
35586
  resolvedModule: {
35578
35587
  resolvedFileName: abs + ".d.ts",
@@ -35583,7 +35592,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
35583
35592
  };
35584
35593
  }
35585
35594
  if (text.endsWith(".css")) {
35586
- const abs = normalize(join21(dirname22(containingFile), text));
35595
+ const abs = normalize(join22(dirname22(containingFile), text));
35587
35596
  return {
35588
35597
  resolvedModule: {
35589
35598
  resolvedFileName: abs + ".d.ts",
@@ -35601,7 +35610,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
35601
35610
  return host2;
35602
35611
  }
35603
35612
  function typecheckProject(projectRoot, opts = {}) {
35604
- const appDir = opts.appDir ?? join21(projectRoot, "app");
35613
+ const appDir = opts.appDir ?? join22(projectRoot, "app");
35605
35614
  const vskFiles = /* @__PURE__ */ new Map();
35606
35615
  const parseErrors = [];
35607
35616
  const warnings = [];
@@ -35640,8 +35649,8 @@ function typecheckProject(projectRoot, opts = {}) {
35640
35649
  }
35641
35650
  rootNames.push(f);
35642
35651
  }
35643
- const ambientPath = join21(appDir, "__vesk_ambient.d.ts");
35644
- const overridePath = join21(appDir, "__vesk_runtime_override.d.ts");
35652
+ const ambientPath = join22(appDir, "__vesk_ambient.d.ts");
35653
+ const overridePath = join22(appDir, "__vesk_runtime_override.d.ts");
35645
35654
  rootNames.push(ambientPath);
35646
35655
  rootNames.push(overridePath);
35647
35656
  const options2 = {
@@ -36206,7 +36215,7 @@ declare module '@vesk/runtime' {
36206
36215
 
36207
36216
  // src/index.ts
36208
36217
  import { readFileSync as readFileSync35, writeFileSync as writeFileSync19, mkdirSync as mkdirSync16, existsSync as existsSync38 } from "fs";
36209
- import { resolve as resolve38, join as join22, dirname as dirname23 } from "path";
36218
+ import { resolve as resolve38, join as join23, dirname as dirname23 } from "path";
36210
36219
  import { fileURLToPath as fileURLToPath9 } from "url";
36211
36220
 
36212
36221
  // ../compiler/dist/config.js
@@ -39671,7 +39680,7 @@ init_seo_audit();
39671
39680
 
39672
39681
  // src/dev-server.ts
39673
39682
  import { readFileSync as readFileSync33, watch, statSync as statSync21, existsSync as existsSync37, readdirSync as readdirSync13 } from "node:fs";
39674
- import { resolve as resolve36, extname as extname8, join as join20 } from "node:path";
39683
+ import { resolve as resolve36, extname as extname8, join as join21 } from "node:path";
39675
39684
  import { createServer as createServer2 } from "node:http";
39676
39685
  import { WebSocketServer as WebSocketServer2 } from "ws";
39677
39686
 
@@ -41455,7 +41464,7 @@ init_tokens();
41455
41464
  init_scan();
41456
41465
  init_strip_ts();
41457
41466
  import { readdirSync as readdirSync7, statSync as statSync12, existsSync as existsSync20, readFileSync as readFileSync19 } from "fs";
41458
- import { join as join11, relative as relative5, basename as basename3 } from "path";
41467
+ import { join as join12, relative as relative5, basename as basename3 } from "path";
41459
41468
  function collapseSlashes2(p) {
41460
41469
  let out = "";
41461
41470
  let prevSlash = false;
@@ -41575,7 +41584,7 @@ function scanDirectory(rootDir, dir, parentPath, options2) {
41575
41584
  segmentCount: isGroup || dir === rootDir ? 0 : 1
41576
41585
  };
41577
41586
  for (const entry of entries) {
41578
- const entryPath = join11(dir, entry);
41587
+ const entryPath = join12(dir, entry);
41579
41588
  let entryStat;
41580
41589
  try {
41581
41590
  entryStat = statSync12(entryPath);
@@ -41627,19 +41636,19 @@ function collectSources(tree) {
41627
41636
  function walk6(nodes) {
41628
41637
  for (const node of nodes) {
41629
41638
  if (node.page)
41630
- map.set(node.page, join11(node.sourceDir, "page.vsk"));
41639
+ map.set(node.page, join12(node.sourceDir, "page.vsk"));
41631
41640
  if (node.layout)
41632
- map.set(node.layout, join11(node.sourceDir, "layout.vsk"));
41641
+ map.set(node.layout, join12(node.sourceDir, "layout.vsk"));
41633
41642
  if (node.loading)
41634
- map.set(node.loading, join11(node.sourceDir, "loading.vsk"));
41643
+ map.set(node.loading, join12(node.sourceDir, "loading.vsk"));
41635
41644
  if (node.error)
41636
- map.set(node.error, join11(node.sourceDir, "error.vsk"));
41645
+ map.set(node.error, join12(node.sourceDir, "error.vsk"));
41637
41646
  if (node.notFound)
41638
- map.set(node.notFound, join11(node.sourceDir, "not-found.vsk"));
41647
+ map.set(node.notFound, join12(node.sourceDir, "not-found.vsk"));
41639
41648
  if (node.offline)
41640
- map.set(node.offline, join11(node.sourceDir, "offline.vsk"));
41649
+ map.set(node.offline, join12(node.sourceDir, "offline.vsk"));
41641
41650
  if (node.network)
41642
- map.set(node.network, join11(node.sourceDir, "network.vsk"));
41651
+ map.set(node.network, join12(node.sourceDir, "network.vsk"));
41643
41652
  walk6(node.children);
41644
41653
  }
41645
41654
  }
@@ -41726,7 +41735,7 @@ function matchUrl(tree, pathname) {
41726
41735
 
41727
41736
  // ../compiler/dist/api-routes.js
41728
41737
  import { readdirSync as readdirSync8, statSync as statSync13, existsSync as existsSync21 } from "fs";
41729
- import { join as join12 } from "path";
41738
+ import { join as join13 } from "path";
41730
41739
  init_server_utils();
41731
41740
  function basename4(p) {
41732
41741
  const idx = p.lastIndexOf("/");
@@ -41763,7 +41772,7 @@ function scanApiDir(rootDir, dir, parentPath) {
41763
41772
  return nodes;
41764
41773
  if (isRouteGroup) {
41765
41774
  for (const entry of entries) {
41766
- const entryPath = join12(dir, entry);
41775
+ const entryPath = join13(dir, entry);
41767
41776
  let entryStat;
41768
41777
  try {
41769
41778
  entryStat = statSync13(entryPath);
@@ -41793,11 +41802,11 @@ function scanApiDir(rootDir, dir, parentPath) {
41793
41802
  fullPath: collapseSlashes(fullPath) || "/",
41794
41803
  isDynamic,
41795
41804
  isCatchAll,
41796
- filePath: hasRoute && routeFileName ? join12(dir, routeFileName) : null,
41805
+ filePath: hasRoute && routeFileName ? join13(dir, routeFileName) : null,
41797
41806
  children: []
41798
41807
  };
41799
41808
  for (const entry of entries) {
41800
- const entryPath = join12(dir, entry);
41809
+ const entryPath = join13(dir, entry);
41801
41810
  let entryStat;
41802
41811
  try {
41803
41812
  entryStat = statSync13(entryPath);
@@ -42324,11 +42333,11 @@ async function executeMiddlewareChain(chain, request, params, options2 = {}) {
42324
42333
 
42325
42334
  // ../compiler/dist/events.js
42326
42335
  import { existsSync as existsSync23 } from "fs";
42327
- import { join as join13 } from "path";
42336
+ import { join as join14 } from "path";
42328
42337
  var EVENTS_FILE_NAMES2 = ["_events.ts", "_events.js"];
42329
42338
  function collectEventsFile2(appDir) {
42330
42339
  for (const name of EVENTS_FILE_NAMES2) {
42331
- const candidate = join13(appDir, name);
42340
+ const candidate = join14(appDir, name);
42332
42341
  if (existsSync23(candidate))
42333
42342
  return candidate;
42334
42343
  }
@@ -42360,7 +42369,7 @@ async function runEventHandlers(handlers, name, ctx2) {
42360
42369
 
42361
42370
  // ../adapter/dist/client-bundle.js
42362
42371
  import { readFileSync as readFileSync20, existsSync as existsSync24, writeFileSync as writeFileSync11, unlinkSync as unlinkSync4, statSync as statSync14, rmSync as rmSync4, mkdtempSync as mkdtempSync2 } from "node:fs";
42363
- import { resolve as resolve23, join as join14, dirname as dirname14, relative as relative6, sep as sep3 } from "node:path";
42372
+ import { resolve as resolve23, join as join15, dirname as dirname14, relative as relative6, sep as sep3 } from "node:path";
42364
42373
  import { fileURLToPath as fileURLToPath6 } from "node:url";
42365
42374
 
42366
42375
  // ../adapter/dist/esbuild-fallback.js
@@ -42440,8 +42449,8 @@ function findRuntimeSrc3(appDir) {
42440
42449
  resolve23(appDir, "node_modules", "@vesk/runtime")
42441
42450
  ];
42442
42451
  for (const base of candidates) {
42443
- for (const dir of [base, join14(base, "dist")]) {
42444
- if (existsSync24(join14(dir, "index-client.js")))
42452
+ for (const dir of [base, join15(base, "dist")]) {
42453
+ if (existsSync24(join15(dir, "index-client.js")))
42445
42454
  return dir;
42446
42455
  }
42447
42456
  }
@@ -42955,8 +42964,8 @@ ${body}
42955
42964
  continue;
42956
42965
  let finalCode;
42957
42966
  if (hasChunkImports2(entry.code)) {
42958
- const tmpBase = mkdtempSync2(join14(resolve23(appDir, ".."), "tmp-vesk-chunk-"));
42959
- const tmpFile = join14(tmpBase, "entry.js");
42967
+ const tmpBase = mkdtempSync2(join15(resolve23(appDir, ".."), "tmp-vesk-chunk-"));
42968
+ const tmpFile = join15(tmpBase, "entry.js");
42960
42969
  const toBundle = `const __components = globalThis.__components || (globalThis.__components = {});
42961
42970
  const __hydrators = globalThis.__hydrators || (globalThis.__hydrators = {});
42962
42971
  ${entry.code}
@@ -43099,7 +43108,7 @@ function buildRuntimeCode2(runtimeDir) {
43099
43108
  ];
43100
43109
  let code = "";
43101
43110
  for (const f of runtimeFiles) {
43102
- const p = join14(runtimeDir, f);
43111
+ const p = join15(runtimeDir, f);
43103
43112
  if (existsSync24(p)) {
43104
43113
  let src2 = readFileSync20(p, "utf-8");
43105
43114
  src2 = stripTypes2(src2);
@@ -43113,7 +43122,7 @@ ${src2}
43113
43122
  `;
43114
43123
  }
43115
43124
  }
43116
- const indexSrc = readFileSync20(join14(runtimeDir, "index-client.js"), "utf-8");
43125
+ const indexSrc = readFileSync20(join15(runtimeDir, "index-client.js"), "utf-8");
43117
43126
  const exportNames = stripTypes2(indexSrc).match(/export\s*\{\s*([^}]+)\s*\}\s*from/g)?.flatMap((m) => m.replace(/export\s*\{\s*|\s*\}\s*from/g, "").split(",").map((s) => s.trim())) || [];
43118
43127
  code += "// --- exports ---\n";
43119
43128
  for (const name of [...new Set(exportNames)]) {
@@ -43124,7 +43133,7 @@ ${src2}
43124
43133
  return code;
43125
43134
  }
43126
43135
  function runtimeExportNames2(runtimeDir) {
43127
- const indexSrc = readFileSync20(join14(runtimeDir, "index-client.js"), "utf-8");
43136
+ const indexSrc = readFileSync20(join15(runtimeDir, "index-client.js"), "utf-8");
43128
43137
  const names = /* @__PURE__ */ new Set();
43129
43138
  for (const m of indexSrc.matchAll(/export\s*\{([^}]+)\}\s*from/g)) {
43130
43139
  for (const raw2 of m[1].split(",")) {
@@ -43144,7 +43153,7 @@ async function buildTreeShakenRuntime2(runtimeDir, usedNames) {
43144
43153
  console.error(`vesk: runtime names not exported \u2014 ${missing.join(", ")}; falling back to full runtime`);
43145
43154
  return buildRuntimeCode2(runtimeDir);
43146
43155
  }
43147
- const entry = join14(runtimeDir, RUNTIME_ENTRY2);
43156
+ const entry = join15(runtimeDir, RUNTIME_ENTRY2);
43148
43157
  try {
43149
43158
  try {
43150
43159
  rmSync4(entry);
@@ -43379,7 +43388,7 @@ import { resolve as resolve27 } from "node:path";
43379
43388
  // ../adapter/dist/plugins.js
43380
43389
  init_paths();
43381
43390
  import { readFileSync as readFileSync22, writeFileSync as writeFileSync12, existsSync as existsSync26, mkdirSync as mkdirSync9, statSync as statSync16 } from "node:fs";
43382
- import { resolve as resolve25, dirname as dirname15, join as join15, extname as extname7, basename as basename5 } from "node:path";
43391
+ import { resolve as resolve25, dirname as dirname15, join as join16, extname as extname7, basename as basename5 } from "node:path";
43383
43392
  import { createRequire as createRequire4 } from "node:module";
43384
43393
  import { spawn as spawn2 } from "node:child_process";
43385
43394
  var PLUGIN_STATE_FILENAME2 = "plugins.json";
@@ -43439,7 +43448,7 @@ function resolvePackage2(appDir, pkg) {
43439
43448
  const seen = /* @__PURE__ */ new Set();
43440
43449
  while (cur && cur !== dirname15(cur) && !seen.has(cur)) {
43441
43450
  seen.add(cur);
43442
- const candidate = join15(cur, "package.json");
43451
+ const candidate = join16(cur, "package.json");
43443
43452
  if (existsSync26(candidate)) {
43444
43453
  pkgJsonPath = candidate;
43445
43454
  break;
@@ -43468,7 +43477,7 @@ function resolvePackage2(appDir, pkg) {
43468
43477
  }
43469
43478
  }
43470
43479
  if (localPath) {
43471
- const localJson = join15(localPath, "package.json");
43480
+ const localJson = join16(localPath, "package.json");
43472
43481
  let json = null;
43473
43482
  if (existsSync26(localJson)) {
43474
43483
  json = readJsonFile2(localJson);
@@ -44356,7 +44365,7 @@ var __internals2 = {
44356
44365
  // ../adapter/dist/dev-config.js
44357
44366
  import { existsSync as existsSync27, readFileSync as readFileSync23, writeFileSync as writeFileSync13, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
44358
44367
  import { tmpdir } from "node:os";
44359
- import { resolve as resolve26, dirname as dirname16, join as join16 } from "node:path";
44368
+ import { resolve as resolve26, dirname as dirname16, join as join17 } from "node:path";
44360
44369
  init_parser();
44361
44370
  function findConfigFile2(projectDir2) {
44362
44371
  const ts9 = resolve26(projectDir2, "vesk.config.ts");
@@ -44384,9 +44393,9 @@ async function parseConfigSource(source, isTs, projectDir2) {
44384
44393
  js = `const { defineConfig, definePlugin, preset } = globalThis.__vesk_inject;
44385
44394
  ` + js;
44386
44395
  }
44387
- const base = projectDir2 ? (mkdirSync10(join16(projectDir2, ".vesk"), { recursive: true }), join16(projectDir2, ".vesk")) : void 0;
44388
- const dir = base ? mkdtempSync3(join16(base, "cfg-")) : mkdtempSync3(join16(tmpdir(), "vesk-cfg-"));
44389
- const tmpFile = join16(dir, "config.mjs");
44396
+ const base = projectDir2 ? (mkdirSync10(join17(projectDir2, ".vesk"), { recursive: true }), join17(projectDir2, ".vesk")) : void 0;
44397
+ const dir = base ? mkdtempSync3(join17(base, "cfg-")) : mkdtempSync3(join17(tmpdir(), "vesk-cfg-"));
44398
+ const tmpFile = join17(dir, "config.mjs");
44390
44399
  try {
44391
44400
  writeFileSync13(tmpFile, js, "utf-8");
44392
44401
  globalThis.__vesk_inject = {
@@ -45696,7 +45705,7 @@ function produceDiagnostics(input) {
45696
45705
 
45697
45706
  // ../agentic/dist/checkpoints.js
45698
45707
  import { existsSync as existsSync29, mkdirSync as mkdirSync11, readFileSync as readFileSync25, writeFileSync as writeFileSync14, statSync as statSync18, unlinkSync as unlinkSync5, rmSync as rmSync6, renameSync } from "node:fs";
45699
- import { join as join17, resolve as resolve28, dirname as dirname17, sep as sep5 } from "node:path";
45708
+ import { join as join18, resolve as resolve28, dirname as dirname17, sep as sep5 } from "node:path";
45700
45709
  import { randomUUID as nodeRandomUUID } from "node:crypto";
45701
45710
  function generateId() {
45702
45711
  try {
@@ -45829,16 +45838,16 @@ var CheckpointManager = class {
45829
45838
  }
45830
45839
  };
45831
45840
  function getAgenticDir(projectDir2) {
45832
- return join17(resolve28(projectDir2), ".vesk", "agentic");
45841
+ return join18(resolve28(projectDir2), ".vesk", "agentic");
45833
45842
  }
45834
45843
  function getHistoryPath(projectDir2) {
45835
- return join17(getAgenticDir(projectDir2), "history.json");
45844
+ return join18(getAgenticDir(projectDir2), "history.json");
45836
45845
  }
45837
45846
  function getCheckpointDir(projectDir2, id) {
45838
- return join17(getAgenticDir(projectDir2), "checkpoints", id);
45847
+ return join18(getAgenticDir(projectDir2), "checkpoints", id);
45839
45848
  }
45840
45849
  function getCheckpointPath(projectDir2, id) {
45841
- return join17(getCheckpointDir(projectDir2, id), "checkpoint.json");
45850
+ return join18(getCheckpointDir(projectDir2, id), "checkpoint.json");
45842
45851
  }
45843
45852
  function ensureDir(dir) {
45844
45853
  mkdirSync11(dir, { recursive: true });
@@ -45918,7 +45927,7 @@ function createCheckpoint(projectDir2, message, changes = {}, buildResult) {
45918
45927
  };
45919
45928
  const agenticDir = getAgenticDir(projectDir2);
45920
45929
  ensureDir(agenticDir);
45921
- ensureDir(join17(agenticDir, "checkpoints"));
45930
+ ensureDir(join18(agenticDir, "checkpoints"));
45922
45931
  const cpDir = getCheckpointDir(projectDir2, id);
45923
45932
  ensureDir(cpDir);
45924
45933
  writeJsonAtomic(getCheckpointPath(projectDir2, id), checkpoint);
@@ -47423,7 +47432,7 @@ var Agent = class {
47423
47432
 
47424
47433
  // ../agentic/dist/tools/vesk.js
47425
47434
  import { existsSync as existsSync32, readFileSync as readFileSync28, writeFileSync as writeFileSync16, mkdirSync as mkdirSync13, readdirSync as readdirSync10, statSync as statSync19 } from "node:fs";
47426
- import { resolve as resolve31, join as join18, dirname as dirname19, sep as sep6 } from "node:path";
47435
+ import { resolve as resolve31, join as join19, dirname as dirname19, sep as sep6 } from "node:path";
47427
47436
  function resolveWithin3(baseDir, relPath) {
47428
47437
  const base = resolve31(baseDir);
47429
47438
  const target = resolve31(baseDir, relPath);
@@ -47485,7 +47494,7 @@ function findConfigFile3(projectDir2) {
47485
47494
  return { path: null, isTs: false };
47486
47495
  }
47487
47496
  function checkpointDir(veskDir) {
47488
- return join18(resolve31(veskDir), "checkpoints");
47497
+ return join19(resolve31(veskDir), "checkpoints");
47489
47498
  }
47490
47499
  function findMatchingBrace2(src2, openIdx) {
47491
47500
  let inStr = null;
@@ -48100,7 +48109,7 @@ function createVeskTools(deps) {
48100
48109
  const dir = checkpointDir(veskDir);
48101
48110
  mkdirSync13(dir, { recursive: true });
48102
48111
  const id = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
48103
- const file = join18(dir, `${id}.json`);
48112
+ const file = join19(dir, `${id}.json`);
48104
48113
  const check = resolveWithin3(dir, `${id}.json`);
48105
48114
  if (!check)
48106
48115
  return jsonError("path escapes project root");
@@ -48149,7 +48158,7 @@ function createVeskTools(deps) {
48149
48158
  } catch {
48150
48159
  }
48151
48160
  const dir = checkpointDir(veskDir);
48152
- const file = join18(dir, `${checkpointId}.json`);
48161
+ const file = join19(dir, `${checkpointId}.json`);
48153
48162
  const contained = resolveWithin3(dir, `${checkpointId}.json`);
48154
48163
  if (!contained)
48155
48164
  return jsonError("path escapes project root");
@@ -48488,7 +48497,7 @@ function buildCodeframe2(src2, line, column, context = 5) {
48488
48497
  import { spawnSync } from "node:child_process";
48489
48498
  import { cpSync, existsSync as existsSync35, mkdirSync as mkdirSync14, readFileSync as readFileSync31, readdirSync as readdirSync11, statSync as statSync20, writeFileSync as writeFileSync18 } from "node:fs";
48490
48499
  import { createRequire as createRequire5 } from "node:module";
48491
- import { dirname as dirname21, join as join19, resolve as resolve34 } from "node:path";
48500
+ import { dirname as dirname21, join as join20, resolve as resolve34 } from "node:path";
48492
48501
  import { fileURLToPath as fileURLToPath8 } from "node:url";
48493
48502
  var require2 = createRequire5(import.meta.url);
48494
48503
  var __dirname9 = dirname21(fileURLToPath8(import.meta.url));
@@ -48512,7 +48521,7 @@ var PACKAGES = {
48512
48521
  function newestSourceMtime(srcDir) {
48513
48522
  let newest = 0;
48514
48523
  for (const name of readdirSync11(srcDir)) {
48515
- const p = join19(srcDir, name);
48524
+ const p = join20(srcDir, name);
48516
48525
  const st = statSync20(p);
48517
48526
  if (st.isDirectory()) {
48518
48527
  newest = Math.max(newest, newestSourceMtime(p));
@@ -48523,11 +48532,11 @@ function newestSourceMtime(srcDir) {
48523
48532
  return newest;
48524
48533
  }
48525
48534
  function distStale(pkgDir, entry) {
48526
- const distIndex = join19(pkgDir, "dist", `${entry}.js`);
48535
+ const distIndex = join20(pkgDir, "dist", `${entry}.js`);
48527
48536
  if (!existsSync35(distIndex)) return true;
48528
- const distPkg = join19(pkgDir, "dist", "package.json");
48537
+ const distPkg = join20(pkgDir, "dist", "package.json");
48529
48538
  const distStamp = Math.max(statSync20(distIndex).mtimeMs, existsSync35(distPkg) ? statSync20(distPkg).mtimeMs : 0);
48530
- return newestSourceMtime(join19(pkgDir, "src")) > distStamp;
48539
+ return newestSourceMtime(join20(pkgDir, "src")) > distStamp;
48531
48540
  }
48532
48541
  function distPackageJson(pkgName, entry, serverEntry, version2) {
48533
48542
  const exports = {
@@ -48551,23 +48560,23 @@ function distPackageJson(pkgName, entry, serverEntry, version2) {
48551
48560
  function buildPackages(force = false) {
48552
48561
  for (const [pkg, cfg] of Object.entries(PACKAGES)) {
48553
48562
  const pkgDir = resolve34(root2, "packages", pkg);
48554
- if (!existsSync35(join19(pkgDir, "src"))) continue;
48563
+ if (!existsSync35(join20(pkgDir, "src"))) continue;
48555
48564
  if (!force && !distStale(pkgDir, cfg.entry)) continue;
48556
48565
  console.log(`[build] ${cfg.name} -> tsc`);
48557
48566
  const tscBin = require2.resolve("typescript/bin/tsc");
48558
- const result2 = spawnSync(process.execPath, [tscBin, "-p", join19(pkgDir, "tsconfig.build.json")], {
48567
+ const result2 = spawnSync(process.execPath, [tscBin, "-p", join20(pkgDir, "tsconfig.build.json")], {
48559
48568
  stdio: "inherit"
48560
48569
  });
48561
48570
  if (result2.status !== 0) {
48562
48571
  throw new Error(`tsc failed for ${cfg.name}`);
48563
48572
  }
48564
- const distDir = join19(pkgDir, "dist");
48573
+ const distDir = join20(pkgDir, "dist");
48565
48574
  for (const c of cfg.copy || []) {
48566
- const to = join19(distDir, c.to);
48575
+ const to = join20(distDir, c.to);
48567
48576
  mkdirSync14(dirname21(to), { recursive: true });
48568
- cpSync(join19(pkgDir, c.from), to, { recursive: true });
48577
+ cpSync(join20(pkgDir, c.from), to, { recursive: true });
48569
48578
  }
48570
- const srcPkg = JSON.parse(readFileSync31(join19(pkgDir, "package.json"), "utf-8"));
48579
+ const srcPkg = JSON.parse(readFileSync31(join20(pkgDir, "package.json"), "utf-8"));
48571
48580
  if (pkg === "lucide-vesk") {
48572
48581
  const lucideDistPkg = {
48573
48582
  name: srcPkg.name,
@@ -48581,9 +48590,9 @@ function buildPackages(force = false) {
48581
48590
  "./package.json": "./package.json"
48582
48591
  }
48583
48592
  };
48584
- writeFileSync18(join19(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
48593
+ writeFileSync18(join20(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
48585
48594
  } else {
48586
- writeFileSync18(join19(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
48595
+ writeFileSync18(join20(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
48587
48596
  }
48588
48597
  console.log(`[build] ${cfg.name} -> dist`);
48589
48598
  }
@@ -48992,9 +49001,9 @@ function resolveRuntimeDir(projectDir2) {
48992
49001
  resolve36(import.meta.dirname ?? ".", "..", "..", "runtime", "dist")
48993
49002
  ];
48994
49003
  for (const dir of candidates) {
48995
- if (existsSync37(join20(dir, "ripple-runtime.js"))) return dir;
48996
- const distDir = join20(dir, "dist");
48997
- if (existsSync37(join20(distDir, "ripple-runtime.js"))) return distDir;
49004
+ if (existsSync37(join21(dir, "ripple-runtime.js"))) return dir;
49005
+ const distDir = join21(dir, "dist");
49006
+ if (existsSync37(join21(distDir, "ripple-runtime.js"))) return distDir;
48998
49007
  }
48999
49008
  return null;
49000
49009
  }
@@ -49150,7 +49159,7 @@ function countFilesNamed(dir, name) {
49150
49159
  if (!existsSync37(dir)) return 0;
49151
49160
  let n = 0;
49152
49161
  for (const entry of readdirSync13(dir, { withFileTypes: true })) {
49153
- const p = join20(dir, entry.name);
49162
+ const p = join21(dir, entry.name);
49154
49163
  if (entry.isDirectory()) n += countFilesNamed(p, name);
49155
49164
  else if (entry.name === name) n++;
49156
49165
  }
@@ -49161,8 +49170,8 @@ async function startDevServer(port2, projectDir2, config, host2) {
49161
49170
  if (!process.env.NODE_ENV) process.env.NODE_ENV = "development";
49162
49171
  const secCfg = config.security || {};
49163
49172
  const maxBodyBytes2 = (typeof secCfg.maxBodyBytes === "number" ? secCfg.maxBodyBytes : void 0) || DEFAULT_MAX_BODY_BYTES;
49164
- const appDirPath = join20(projectDir2, "app");
49165
- const publicDir = join20(projectDir2, "public");
49173
+ const appDirPath = join21(projectDir2, "app");
49174
+ const publicDir = join21(projectDir2, "public");
49166
49175
  installMdReadHook2([publicDir]);
49167
49176
  try {
49168
49177
  ensurePackagesBuilt();
@@ -49175,7 +49184,7 @@ async function startDevServer(port2, projectDir2, config, host2) {
49175
49184
  process.exit(1);
49176
49185
  }
49177
49186
  const runtimeDir = runtimeDirUnchecked;
49178
- const veskStateDir = join20(projectDir2, ".vesk");
49187
+ const veskStateDir = join21(projectDir2, ".vesk");
49179
49188
  const configPluginsRaw = config.plugins || [];
49180
49189
  const configPluginNames = configPluginsRaw.map((p) => typeof p === "string" ? p : p?.name).filter((n) => !!n);
49181
49190
  const rawDevPlugins = config.plugins || [];
@@ -49274,9 +49283,9 @@ async function startDevServer(port2, projectDir2, config, host2) {
49274
49283
  }
49275
49284
  let devGlobalCssContent = "";
49276
49285
  let lastServedCssGlobal = "";
49277
- const srcDir = join20(projectDir2, "src");
49278
- const cssPath = join20(srcDir, "global.css");
49279
- const altCssPath = join20(srcDir, "app.css");
49286
+ const srcDir = join21(projectDir2, "src");
49287
+ const cssPath = join21(srcDir, "global.css");
49288
+ const altCssPath = join21(srcDir, "app.css");
49280
49289
  let rawCss = "";
49281
49290
  if (existsSync37(cssPath)) {
49282
49291
  rawCss = readFileSync33(cssPath, "utf-8");
@@ -49525,7 +49534,7 @@ async function startDevServer(port2, projectDir2, config, host2) {
49525
49534
  const isApiRoute = filename.endsWith(".ts") || filename.endsWith(".js") || filename.endsWith(".tsx");
49526
49535
  const isEvents = filename === "_events.ts" || filename === "_events.js";
49527
49536
  if (!isVsk && !isCss && !isApiRoute && !isEvents) return;
49528
- const fullPath = filename.startsWith("/") ? filename : join20(watchDir, filename);
49537
+ const fullPath = filename.startsWith("/") ? filename : join21(watchDir, filename);
49529
49538
  const fileExists = existsSync37(fullPath);
49530
49539
  if (isEvents) {
49531
49540
  if (debounceTimer) clearTimeout(debounceTimer);
@@ -49706,8 +49715,8 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
49706
49715
  ".json": "application/json",
49707
49716
  ".webmanifest": "application/manifest+json"
49708
49717
  };
49709
- const hmrJsPath = join20(runtimeDir, "hmr-client.js");
49710
- const hmrTsPath = join20(runtimeDir, "hmr-client.ts");
49718
+ const hmrJsPath = join21(runtimeDir, "hmr-client.js");
49719
+ const hmrTsPath = join21(runtimeDir, "hmr-client.ts");
49711
49720
  const hmrClientPath = existsSync37(hmrJsPath) ? hmrJsPath : existsSync37(hmrTsPath) ? hmrTsPath : null;
49712
49721
  function extractCompName2(src2) {
49713
49722
  return resolveComponentName(src2);
@@ -49867,7 +49876,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
49867
49876
  return;
49868
49877
  }
49869
49878
  const mwChain = collectMiddlewareChain(routeTree, url.pathname, appDirPath);
49870
- const apiDirPath = join20(appDirPath, "api");
49879
+ const apiDirPath = join21(appDirPath, "api");
49871
49880
  if (url.pathname.startsWith("/api") && existsSync37(apiDirPath)) {
49872
49881
  const apiRoutes = await scanApiRoutes(apiDirPath);
49873
49882
  const apiMatch = matchApiUrl(apiRoutes, req.url || url.pathname);
@@ -50278,7 +50287,7 @@ ${err.stack}</pre></body></html>`);
50278
50287
  LOG.ok(`dev server at http://localhost:${port2} (listening on ${bindHost})`);
50279
50288
  const routes = collectRoutePaths(routeTree);
50280
50289
  const pageCount = countPages(routeTree);
50281
- const apiCount = countFilesNamed(join20(appDirPath, "api"), "route.ts");
50290
+ const apiCount = countFilesNamed(join21(appDirPath, "api"), "route.ts");
50282
50291
  LOG.info(`${projectDir2}`);
50283
50292
  LOG.info(`${pageCount} page${pageCount === 1 ? "" : "s"}: ${routes.join(", ") || "(none)"}`);
50284
50293
  if (apiCount > 0) LOG.info(`${apiCount} api route${apiCount === 1 ? "" : "s"} (app/api)`);
@@ -50577,8 +50586,8 @@ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
50577
50586
  }
50578
50587
  function loadEnvFiles(projectDir2) {
50579
50588
  const files = [
50580
- join22(projectDir2, ".env"),
50581
- join22(projectDir2, ".env.local")
50589
+ join23(projectDir2, ".env"),
50590
+ join23(projectDir2, ".env.local")
50582
50591
  ];
50583
50592
  for (const filePath of files) {
50584
50593
  if (!existsSync38(filePath)) continue;
@@ -50601,8 +50610,8 @@ function loadEnvFiles(projectDir2) {
50601
50610
  }
50602
50611
  async function loadConfig(projectDir2) {
50603
50612
  loadEnvFiles(projectDir2);
50604
- const jsPath = join22(projectDir2, "vesk.config.js");
50605
- const tsPath = join22(projectDir2, "vesk.config.ts");
50613
+ const jsPath = join23(projectDir2, "vesk.config.js");
50614
+ const tsPath = join23(projectDir2, "vesk.config.ts");
50606
50615
  let configPath3 = null;
50607
50616
  if (existsSync38(jsPath)) configPath3 = jsPath;
50608
50617
  else if (existsSync38(tsPath)) configPath3 = tsPath;
@@ -50615,7 +50624,7 @@ async function loadConfig(projectDir2) {
50615
50624
  js = js.replace(/import\s+\{[^}]*\}\s*from\s+['"]@vesk\/compiler['"]\s*;?\s*/g, "");
50616
50625
  js = `const { defineConfig, definePlugin, preset } = globalThis.__vesk_inject;
50617
50626
  ` + js;
50618
- const tmpFile = join22(projectDir2, ".vesk", "config.tmp.js");
50627
+ const tmpFile = join23(projectDir2, ".vesk", "config.tmp.js");
50619
50628
  mkdirSync16(dirname23(tmpFile), { recursive: true });
50620
50629
  writeFileSync19(tmpFile, js, "utf-8");
50621
50630
  globalThis.__vesk_inject = { defineConfig, definePlugin, preset };
@@ -50637,8 +50646,8 @@ async function loadConfig(projectDir2) {
50637
50646
  }
50638
50647
  if (cmd === "build") {
50639
50648
  const projectDir2 = process.cwd();
50640
- const appDirPath = join22(projectDir2, "app");
50641
- const publicDir = join22(projectDir2, "public");
50649
+ const appDirPath = join23(projectDir2, "app");
50650
+ const publicDir = join23(projectDir2, "public");
50642
50651
  if (!existsSync38(appDirPath)) {
50643
50652
  console.error(`vesk build: no app/ directory found in ${projectDir2}`);
50644
50653
  process.exit(1);
@@ -50709,7 +50718,7 @@ ${code}`;
50709
50718
  }
50710
50719
  if (cmd === "seo") {
50711
50720
  const projectDir2 = process.cwd();
50712
- const appDirPath = join22(projectDir2, "app");
50721
+ const appDirPath = join23(projectDir2, "app");
50713
50722
  if (!existsSync38(appDirPath)) {
50714
50723
  console.error(`vesk seo: no app/ directory found in ${projectDir2}`);
50715
50724
  process.exit(1);
@@ -50724,7 +50733,7 @@ if (cmd === "seo") {
50724
50733
  }
50725
50734
  if (cmd === "typecheck") {
50726
50735
  const projectDir2 = process.cwd();
50727
- const appDirPath = join22(projectDir2, "app");
50736
+ const appDirPath = join23(projectDir2, "app");
50728
50737
  if (!existsSync38(appDirPath)) {
50729
50738
  console.error(`vesk typecheck: no app/ directory found in ${projectDir2}`);
50730
50739
  process.exit(1);
@@ -50749,7 +50758,7 @@ if (cmd === "typecheck") {
50749
50758
  }
50750
50759
  if (cmd === "start") {
50751
50760
  const projectDir2 = process.cwd();
50752
- const outDir2 = join22(projectDir2, ".vesk");
50761
+ const outDir2 = join23(projectDir2, ".vesk");
50753
50762
  const port2 = parsePortArg(args);
50754
50763
  const host2 = parseHostArg(args);
50755
50764
  startProdServer(outDir2, { port: port2, host: host2 });
@@ -50758,8 +50767,8 @@ if (cmd === "start") {
50758
50767
  }
50759
50768
  if (cmd === "init") {
50760
50769
  const projectDir2 = process.cwd();
50761
- const srcDir = join22(projectDir2, "src");
50762
- const target = join22(srcDir, "global.css");
50770
+ const srcDir = join23(projectDir2, "src");
50771
+ const target = join23(srcDir, "global.css");
50763
50772
  if (existsSync38(target)) {
50764
50773
  console.error(`vesk init: ${target} already exists \u2014 skipping`);
50765
50774
  process.exit(0);
@@ -50778,7 +50787,7 @@ if (cmd === "init") {
50778
50787
  }
50779
50788
  if (cmd === "dev") {
50780
50789
  const projectDir2 = process.cwd();
50781
- const appDirPath = join22(projectDir2, "app");
50790
+ const appDirPath = join23(projectDir2, "app");
50782
50791
  const port2 = parsePortArg(args);
50783
50792
  const host2 = parseHostArg(args);
50784
50793
  if (!existsSync38(appDirPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "type": "module",
5
5
  "description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "main": "./dist/cli.js",
10
10
  "dependencies": {
11
- "@vesk/adapter": "^0.2.18",
12
- "@vesk/compiler": "^0.2.18",
13
- "@vesk/plugin-tailwind": "^0.2.18",
14
- "@vesk/runtime": "^0.2.18",
11
+ "@vesk/adapter": "^0.2.19",
12
+ "@vesk/compiler": "^0.2.19",
13
+ "@vesk/plugin-tailwind": "^0.2.19",
14
+ "@vesk/runtime": "^0.2.19",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",