@vesk/vesk-cli 0.2.50-canary.3 → 0.2.50-canary.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +282 -113
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -19480,6 +19480,10 @@ function resolveSsrModule(specifier, fromDir) {
19480
19480
  } else {
19481
19481
  const aliased = resolveAliasModule(specifier, fromDir);
19482
19482
  if (aliased) return toRealPath(aliased);
19483
+ const viaExports = resolveViaPackageExports(specifier, fromDir);
19484
+ if (viaExports) return viaExports;
19485
+ const viaModuleField = resolveViaPackageModuleField(specifier, fromDir);
19486
+ if (viaModuleField) return viaModuleField;
19483
19487
  const native = nativeResolve(specifier, fromDir);
19484
19488
  if (native) return native;
19485
19489
  let dir = fromDir;
@@ -19543,6 +19547,98 @@ function statOrNull(p) {
19543
19547
  return null;
19544
19548
  }
19545
19549
  }
19550
+ function resolveExports(exportsField, subpath) {
19551
+ const conditions = ["import", "module", "node", "default"];
19552
+ const target = (value) => {
19553
+ if (typeof value === "string") return value;
19554
+ if (!value || typeof value !== "object") return null;
19555
+ for (const cond of conditions) {
19556
+ if (cond in value) {
19557
+ const got = target(value[cond]);
19558
+ if (got) return got;
19559
+ }
19560
+ }
19561
+ return null;
19562
+ };
19563
+ if (typeof exportsField === "string") return subpath === "." ? exportsField : null;
19564
+ if (!exportsField || typeof exportsField !== "object") return null;
19565
+ const map = exportsField;
19566
+ if (subpath in map) {
19567
+ const direct = target(map[subpath]);
19568
+ if (direct) return direct;
19569
+ return null;
19570
+ }
19571
+ let best = null;
19572
+ for (const key of Object.keys(map)) {
19573
+ const star = key.indexOf("*");
19574
+ if (star === -1) continue;
19575
+ const prefix = key.slice(0, star);
19576
+ const suffix = key.slice(star + 1);
19577
+ if (!subpath.startsWith(prefix) || !subpath.endsWith(suffix)) continue;
19578
+ if (subpath.length < prefix.length + suffix.length) continue;
19579
+ if (best === null || prefix.length > best.key.length) {
19580
+ best = { key: prefix, star: subpath.slice(prefix.length, subpath.length - suffix.length) };
19581
+ }
19582
+ }
19583
+ if (!best) return null;
19584
+ const pattern2 = target(map[Object.keys(map).find((k) => k.startsWith(best.key + "*") && k.endsWith(best.key.slice(0, -1)) + "*")] ?? map[`${best.key}*`]);
19585
+ if (pattern2 === null) return null;
19586
+ return pattern2.split("*").join(best.star);
19587
+ }
19588
+ function resolveViaPackageModuleField(specifier, fromDir) {
19589
+ const firstSlash = specifier.indexOf("/");
19590
+ const splitAt = specifier.startsWith("@") ? specifier.indexOf("/", firstSlash + 1) : firstSlash;
19591
+ const pkgName = splitAt > 0 ? specifier.slice(0, splitAt) : specifier;
19592
+ if (splitAt > 0) return null;
19593
+ let dir = fromDir;
19594
+ for (let depth = 0; depth < 64; depth++) {
19595
+ const pkgPath = join2(dir, "node_modules", pkgName, "package.json");
19596
+ if (statOrNull(pkgPath) !== null) {
19597
+ try {
19598
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
19599
+ if (typeof pkg.module === "string" && pkg.module.length > 0) {
19600
+ const found = probeFile(resolve(join2(dir, "node_modules", pkgName), pkg.module));
19601
+ if (found) return toRealPath(found);
19602
+ }
19603
+ } catch {
19604
+ }
19605
+ return null;
19606
+ }
19607
+ const parent = dirname2(dir);
19608
+ if (parent === dir) break;
19609
+ dir = parent;
19610
+ }
19611
+ return null;
19612
+ }
19613
+ function resolveViaPackageExports(specifier, fromDir) {
19614
+ const firstSlash = specifier.indexOf("/");
19615
+ const splitAt = specifier.startsWith("@") ? specifier.indexOf("/", firstSlash + 1) : firstSlash;
19616
+ const pkgName = splitAt > 0 ? specifier.slice(0, splitAt) : specifier;
19617
+ const subpath = splitAt > 0 ? "." + specifier.slice(splitAt) : ".";
19618
+ let dir = fromDir;
19619
+ for (let depth = 0; depth < 64; depth++) {
19620
+ const pkgDir = join2(dir, "node_modules", pkgName);
19621
+ const pkgPath = join2(pkgDir, "package.json");
19622
+ if (statOrNull(pkgPath) !== null) {
19623
+ try {
19624
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
19625
+ if (pkg.exports !== void 0) {
19626
+ const target = resolveExports(pkg.exports, subpath);
19627
+ if (target) {
19628
+ const found = probeFile(resolve(pkgDir, target));
19629
+ if (found) return toRealPath(found);
19630
+ }
19631
+ }
19632
+ } catch {
19633
+ }
19634
+ return null;
19635
+ }
19636
+ const parent = dirname2(dir);
19637
+ if (parent === dir) break;
19638
+ dir = parent;
19639
+ }
19640
+ return null;
19641
+ }
19546
19642
  function probeFile(base) {
19547
19643
  const st = statOrNull(base);
19548
19644
  if (st && st.isFile()) return base;
@@ -19552,9 +19648,19 @@ function probeFile(base) {
19552
19648
  if (pkgSt && pkgSt.isFile()) {
19553
19649
  try {
19554
19650
  const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
19555
- if (typeof pkg.main === "string" && pkg.main.length > 0) {
19556
- const viaMain = probeFile(resolve(base, pkg.main));
19557
- if (viaMain) return viaMain;
19651
+ if (pkg.exports !== void 0) {
19652
+ const viaExports = resolveExports(pkg.exports, ".");
19653
+ if (viaExports) {
19654
+ const found = probeFile(resolve(base, viaExports));
19655
+ if (found) return found;
19656
+ }
19657
+ }
19658
+ for (const field of ["module", "main"]) {
19659
+ const value = pkg[field];
19660
+ if (typeof value === "string" && value.length > 0) {
19661
+ const found = probeFile(resolve(base, value));
19662
+ if (found) return found;
19663
+ }
19558
19664
  }
19559
19665
  } catch {
19560
19666
  }
@@ -22635,18 +22741,18 @@ function getHooks() {
22635
22741
  return globalThis.__vesk_hooks;
22636
22742
  }
22637
22743
  function defineHook(name, fn) {
22638
- const hooks = getHooks();
22639
- if (!hooks[name]) hooks[name] = [];
22640
- hooks[name].push(fn);
22744
+ const hooks2 = getHooks();
22745
+ if (!hooks2[name]) hooks2[name] = [];
22746
+ hooks2[name].push(fn);
22641
22747
  }
22642
22748
  function removeHook(name, fn) {
22643
- const hooks = getHooks();
22644
- if (!hooks[name]) return;
22645
- hooks[name] = hooks[name].filter((h) => h !== fn);
22749
+ const hooks2 = getHooks();
22750
+ if (!hooks2[name]) return;
22751
+ hooks2[name] = hooks2[name].filter((h) => h !== fn);
22646
22752
  }
22647
22753
  async function runHooks(name, ...args2) {
22648
- const hooks = getHooks()[name] || [];
22649
- for (const fn of hooks) {
22754
+ const hooks2 = getHooks()[name] || [];
22755
+ for (const fn of hooks2) {
22650
22756
  const result = await fn(...args2);
22651
22757
  if (result instanceof Response) return result;
22652
22758
  }
@@ -39227,7 +39333,7 @@ __export(typecheck_exports, {
39227
39333
  typecheckProject: () => typecheckProject
39228
39334
  });
39229
39335
  import { readFileSync as readFileSync39, readdirSync as readdirSync14, statSync as statSync22 } from "node:fs";
39230
- import { join as join26, dirname as dirname27, normalize, relative as relative8, resolve as resolve39, sep as sep7 } from "node:path";
39336
+ import { join as join27, dirname as dirname27, normalize, relative as relative8, resolve as resolve39, sep as sep7 } from "node:path";
39231
39337
  import * as ts8 from "typescript";
39232
39338
  function walkProjectFiles(projectRoot) {
39233
39339
  const code = [];
@@ -39240,7 +39346,7 @@ function walkProjectFiles(projectRoot) {
39240
39346
  return;
39241
39347
  }
39242
39348
  for (const e of entries) {
39243
- const p = join26(dir, e);
39349
+ const p = join27(dir, e);
39244
39350
  let st;
39245
39351
  try {
39246
39352
  st = statSync22(p);
@@ -39295,8 +39401,8 @@ function checkStructureFile(appDir, file) {
39295
39401
  return null;
39296
39402
  }
39297
39403
  function createTypecheckHost(projectRoot, appDir, vskFiles) {
39298
- const ambientPath = join26(appDir, "__vesk_ambient.d.ts");
39299
- const overridePath = join26(appDir, "__vesk_runtime_override.d.ts");
39404
+ const ambientPath = join27(appDir, "__vesk_ambient.d.ts");
39405
+ const overridePath = join27(appDir, "__vesk_runtime_override.d.ts");
39300
39406
  const cached = /* @__PURE__ */ new Map();
39301
39407
  const scriptKindFor = (file) => file.endsWith(".vsk") ? ts8.ScriptKind.TSX : ts8.ScriptKind.TS;
39302
39408
  const host = {
@@ -39366,7 +39472,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
39366
39472
  directoryExists: (dir) => ts8.sys.directoryExists(dir),
39367
39473
  getDirectories: (dir) => {
39368
39474
  try {
39369
- return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join26(dir, d.name));
39475
+ return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join27(dir, d.name));
39370
39476
  } catch {
39371
39477
  return [];
39372
39478
  }
@@ -39378,7 +39484,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
39378
39484
  return moduleLiterals.map(({ text }) => {
39379
39485
  if (text.endsWith(".vsk")) {
39380
39486
  const aliased = text.startsWith(".") ? null : resolveAliasModule(text, dirname27(containingFile));
39381
- const abs = normalize(aliased ?? join26(dirname27(containingFile), text));
39487
+ const abs = normalize(aliased ?? join27(dirname27(containingFile), text));
39382
39488
  return {
39383
39489
  resolvedModule: {
39384
39490
  resolvedFileName: abs + ".d.ts",
@@ -39389,7 +39495,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
39389
39495
  };
39390
39496
  }
39391
39497
  if (text.endsWith(".css")) {
39392
- const abs = normalize(join26(dirname27(containingFile), text));
39498
+ const abs = normalize(join27(dirname27(containingFile), text));
39393
39499
  return {
39394
39500
  resolvedModule: {
39395
39501
  resolvedFileName: abs + ".d.ts",
@@ -39436,7 +39542,7 @@ function sourcePosition(source, offset2) {
39436
39542
  return { line, character: bounded - lineStart + 1 };
39437
39543
  }
39438
39544
  function typecheckProject(projectRoot, opts = {}) {
39439
- const appDir = opts.appDir ?? join26(projectRoot, "app");
39545
+ const appDir = opts.appDir ?? join27(projectRoot, "app");
39440
39546
  const vskFiles = /* @__PURE__ */ new Map();
39441
39547
  const parseErrors = [];
39442
39548
  const warnings = [];
@@ -39475,8 +39581,8 @@ function typecheckProject(projectRoot, opts = {}) {
39475
39581
  }
39476
39582
  rootNames.push(f);
39477
39583
  }
39478
- const ambientPath = join26(appDir, "__vesk_ambient.d.ts");
39479
- const overridePath = join26(appDir, "__vesk_runtime_override.d.ts");
39584
+ const ambientPath = join27(appDir, "__vesk_ambient.d.ts");
39585
+ const overridePath = join27(appDir, "__vesk_runtime_override.d.ts");
39480
39586
  rootNames.push(ambientPath);
39481
39587
  rootNames.push(overridePath);
39482
39588
  const options = {
@@ -45422,7 +45528,7 @@ __export(codemods_exports, {
45422
45528
  compareCore: () => compareCore
45423
45529
  });
45424
45530
  import { readFileSync as readFileSync40, existsSync as existsSync43 } from "node:fs";
45425
- import { join as join27 } from "node:path";
45531
+ import { join as join28 } from "node:path";
45426
45532
  import { walk as walk8 } from "zimmerframe";
45427
45533
  function safeParse(source, filePath) {
45428
45534
  try {
@@ -45442,7 +45548,7 @@ function isVskFile(filePath) {
45442
45548
  }
45443
45549
  function typesPackageExports(projectDir) {
45444
45550
  const candidates = [
45445
- projectDir ? join27(projectDir, "node_modules", "@vesk", "types", "dist", "index.d.ts") : null,
45551
+ projectDir ? join28(projectDir, "node_modules", "@vesk", "types", "dist", "index.d.ts") : null,
45446
45552
  new URL("../../types/dist/index.d.ts", import.meta.url).pathname
45447
45553
  ].filter((p) => typeof p === "string" && existsSync43(p));
45448
45554
  for (const path of candidates) {
@@ -45572,10 +45678,10 @@ __export(migrate_exports, {
45572
45678
  runMigrate: () => runMigrate
45573
45679
  });
45574
45680
  import { readFileSync as readFileSync41, writeFileSync as writeFileSync21, existsSync as existsSync44, statSync as statSync23, readdirSync as readdirSync15 } from "node:fs";
45575
- import { join as join28, relative as relative9, extname as extname9 } from "node:path";
45681
+ import { join as join29, relative as relative9, extname as extname9 } from "node:path";
45576
45682
  function detectInstalledVersion(projectDir, cliVersion) {
45577
45683
  for (const pkg of ["@vesk/vesk-cli", "@vesk/adapter", "@vesk/compiler"]) {
45578
- const p = join28(projectDir, "node_modules", pkg, "package.json");
45684
+ const p = join29(projectDir, "node_modules", pkg, "package.json");
45579
45685
  if (!existsSync44(p)) continue;
45580
45686
  try {
45581
45687
  const version2 = JSON.parse(readFileSync41(p, "utf-8")).version;
@@ -45595,7 +45701,7 @@ function collectTargets(dir, root3 = dir) {
45595
45701
  }
45596
45702
  for (const entry of entries.sort()) {
45597
45703
  if (SKIP_DIRS2.has(entry)) continue;
45598
- const full = join28(dir, entry);
45704
+ const full = join29(dir, entry);
45599
45705
  let st;
45600
45706
  try {
45601
45707
  st = statSync23(full);
@@ -45630,7 +45736,7 @@ function runMigrate(options) {
45630
45736
  return report;
45631
45737
  }
45632
45738
  for (const relPath of collectTargets(options.projectDir)) {
45633
- const abs = join28(options.projectDir, relPath);
45739
+ const abs = join29(options.projectDir, relPath);
45634
45740
  const ctx2 = { filePath: abs, displayPath: relPath, projectDir: options.projectDir };
45635
45741
  if (!existsSync44(abs)) continue;
45636
45742
  let source;
@@ -45676,7 +45782,7 @@ var init_migrate = __esm({
45676
45782
 
45677
45783
  // src/index.ts
45678
45784
  import { readFileSync as readFileSync42, writeFileSync as writeFileSync22, mkdirSync as mkdirSync20, existsSync as existsSync45 } from "fs";
45679
- import { resolve as resolve40, join as join29 } from "path";
45785
+ import { resolve as resolve40, join as join30 } from "path";
45680
45786
  import { fileURLToPath as fileURLToPath9 } from "url";
45681
45787
 
45682
45788
  // ../adapter/dist/load-config.js
@@ -46255,7 +46361,7 @@ function setRuntimeModule2(mod) {
46255
46361
 
46256
46362
  // ../adapter/dist/index.js
46257
46363
  import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, existsSync as existsSync22, readFileSync as readFileSync21 } from "node:fs";
46258
- import { resolve as resolve21, dirname as dirname16, relative as relative4, basename as basename3 } from "node:path";
46364
+ import { resolve as resolve21, dirname as dirname16, relative as relative4, basename as basename3, join as join15 } from "node:path";
46259
46365
  import { fileURLToPath as fileURLToPath5 } from "node:url";
46260
46366
 
46261
46367
  // ../adapter/src/runtime-bundle.ts
@@ -47541,14 +47647,17 @@ function collectEventsFile(appDir) {
47541
47647
 
47542
47648
  // ../adapter/src/events.ts
47543
47649
  var buildId2 = 0;
47544
- function buildEntry(sourcePath2) {
47650
+ function buildEventsEntry(sourcePath2) {
47545
47651
  return [
47546
47652
  `import * as __events from ${JSON.stringify(sourcePath2)};`,
47547
47653
  "",
47548
47654
  "const __store = () => (globalThis.__vesk_server_ctx ||= {});",
47549
47655
  "",
47550
47656
  "const __handlers = {};",
47551
- "for (const __name of ['onStart', 'onRequest', 'onStop']) {",
47657
+ // `onError` joins the server events: production has no plugin objects, so
47658
+ // this is the seam an error reporter actually uses there (plugins carry
47659
+ // their own `onError` in dev, where plugin objects do exist).
47660
+ "for (const __name of ['onStart', 'onRequest', 'onStop', 'onError']) {",
47552
47661
  " const __fn = __events[__name];",
47553
47662
  " if (typeof __fn === 'function') __handlers[__name] = __fn;",
47554
47663
  "}",
@@ -47589,16 +47698,26 @@ function buildEntry(sourcePath2) {
47589
47698
  "export const onStart = __handlers.onStart;",
47590
47699
  "export const onRequest = __handlers.onRequest;",
47591
47700
  "export const onStop = __handlers.onStop;",
47701
+ "export const onError = __handlers.onError;",
47592
47702
  ""
47593
47703
  ].join("\n");
47594
47704
  }
47705
+ async function executeError(err, base, mod) {
47706
+ const fn = mod?.onError;
47707
+ if (typeof fn !== "function") return;
47708
+ try {
47709
+ await fn(err, base);
47710
+ } catch (e) {
47711
+ console.error("vesk: _events onError threw and was ignored:", e instanceof Error ? e.message : e);
47712
+ }
47713
+ }
47595
47714
  async function compileEvents(appDir, outDir) {
47596
47715
  const sourcePath2 = collectEventsFile(appDir);
47597
47716
  if (!sourcePath2) return false;
47598
47717
  const serverDir = resolve9(outDir, "server");
47599
47718
  mkdirSync2(serverDir, { recursive: true });
47600
47719
  const entryFile = resolve9(serverDir, `.events-entry-${buildId2++}.mjs`);
47601
- writeFileSync3(entryFile, buildEntry(sourcePath2), "utf-8");
47720
+ writeFileSync3(entryFile, buildEventsEntry(sourcePath2), "utf-8");
47602
47721
  try {
47603
47722
  const result = await build({
47604
47723
  entryPoints: [entryFile],
@@ -48668,6 +48787,38 @@ import { resolve as resolve13, extname as extname3, dirname as dirname10, basena
48668
48787
  import { createServer } from "node:http";
48669
48788
  import { fileURLToPath as fileURLToPath3 } from "node:url";
48670
48789
  init_server_utils();
48790
+
48791
+ // ../adapter/src/error-report.ts
48792
+ var hooks = [];
48793
+ var reported = /* @__PURE__ */ new WeakSet();
48794
+ async function reportServerError(err, options) {
48795
+ if (options.dedupe !== false && err && typeof err === "object") {
48796
+ if (reported.has(err)) return;
48797
+ reported.add(err);
48798
+ }
48799
+ const cfg = options.buildConfig || null;
48800
+ const ctx2 = {
48801
+ url: options.url,
48802
+ routePath: options.routePath,
48803
+ target: options.target,
48804
+ status: options.status ?? 500,
48805
+ durationMs: options.durationMs,
48806
+ version: typeof cfg?.veskVersion === "string" ? cfg.veskVersion : void 0,
48807
+ buildId: typeof cfg?.buildId === "string" ? cfg.buildId : void 0,
48808
+ errorName: err instanceof Error ? err.name : typeof err,
48809
+ message: err instanceof Error ? err.message : String(err),
48810
+ stack: err instanceof Error ? err.stack : void 0
48811
+ };
48812
+ for (const hook of hooks) {
48813
+ try {
48814
+ await hook(err, ctx2);
48815
+ } catch (e) {
48816
+ console.error("vesk: an onError hook threw and was ignored:", e?.message ?? e);
48817
+ }
48818
+ }
48819
+ }
48820
+
48821
+ // ../adapter/src/prod-server.ts
48671
48822
  init_paths();
48672
48823
 
48673
48824
  // ../adapter/src/load-config.ts
@@ -49191,6 +49342,16 @@ async function startProdServer(outDir, options) {
49191
49342
  return;
49192
49343
  }
49193
49344
  console.error("vesk ssr error:", err.message);
49345
+ await reportServerError(err, {
49346
+ url: url.pathname + url.search,
49347
+ routePath: route.path,
49348
+ target: "node",
49349
+ status: 500,
49350
+ buildConfig
49351
+ });
49352
+ if (eventsMod) {
49353
+ await executeError(err, { url: url.href, routePath: route.path, target: "node", status: 500 }, eventsMod);
49354
+ }
49194
49355
  const errPath = resolve13(appDir, "error.vsk");
49195
49356
  let errorHtml = null;
49196
49357
  if (existsSync15(errPath)) {
@@ -49255,6 +49416,9 @@ init_parser();
49255
49416
  init_paths();
49256
49417
 
49257
49418
  // ../adapter/dist/index.js
49419
+ function PACKAGES_DIR_SELF() {
49420
+ return resolve21(dirname16(fileURLToPath5(import.meta.url)), "..");
49421
+ }
49258
49422
  var __dirname6 = dirname16(fileURLToPath5(import.meta.url));
49259
49423
  async function resolveCompilerApi(name) {
49260
49424
  const monorepoSrc = resolve21(__dirname6, "..", "..", "compiler", "src");
@@ -49559,6 +49723,9 @@ async function build2(appDir, options) {
49559
49723
  }
49560
49724
  markPhase("ssg+images+seo");
49561
49725
  const manifest = generateManifest(routeTree, ssrRoutes, apiRoutes, prerenderedRoutes, middlewareEnabled, actionMap, pluginHeadExtra, hasEvents);
49726
+ const buildId3 = emittedAssets.map((a) => a.hash).join("-");
49727
+ manifest.buildId = buildId3.slice(0, 32);
49728
+ manifest.veskVersion = JSON.parse(readFileSync21(join15(PACKAGES_DIR_SELF(), "package.json"), "utf-8")).version;
49562
49729
  manifest.assets = {
49563
49730
  hashed,
49564
49731
  client: { file: clientFileName, url: clientUrl, hash: clientAsset.hash, bytes: clientAsset.bytes, integrity: clientAsset.integrity },
@@ -49613,7 +49780,7 @@ init_seo_audit();
49613
49780
 
49614
49781
  // src/dev-server.ts
49615
49782
  import { readFileSync as readFileSync38, watch, statSync as statSync21, existsSync as existsSync42, readdirSync as readdirSync13 } from "node:fs";
49616
- import { resolve as resolve38, extname as extname8, join as join25, dirname as dirname26 } from "node:path";
49783
+ import { resolve as resolve38, extname as extname8, join as join26, dirname as dirname26 } from "node:path";
49617
49784
  import { createServer as createServer2 } from "node:http";
49618
49785
  import { WebSocketServer as WebSocketServer2 } from "ws";
49619
49786
 
@@ -52263,7 +52430,7 @@ init_tokens();
52263
52430
  init_scan();
52264
52431
  init_strip_ts();
52265
52432
  import { readdirSync as readdirSync7, statSync as statSync12, existsSync as existsSync23, readFileSync as readFileSync22 } from "fs";
52266
- import { join as join15, relative as relative5, basename as basename4 } from "path";
52433
+ import { join as join16, relative as relative5, basename as basename4 } from "path";
52267
52434
  function collapseSlashes2(p) {
52268
52435
  let out = "";
52269
52436
  let prevSlash = false;
@@ -52366,7 +52533,7 @@ function scanComponents(componentsDir) {
52366
52533
  return;
52367
52534
  }
52368
52535
  for (const entry of entries) {
52369
- const full = join15(dir, entry);
52536
+ const full = join16(dir, entry);
52370
52537
  let stat;
52371
52538
  try {
52372
52539
  stat = statSync12(full);
@@ -52467,7 +52634,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
52467
52634
  seg = segName;
52468
52635
  }
52469
52636
  const fullPath = seg ? (parentPath === "/" ? "/" : parentPath + "/") + seg : parentPath || "/";
52470
- const isStandalone = hasLayout ? isStandaloneLayoutFile(join15(dir, "layout.vsk")) : false;
52637
+ const isStandalone = hasLayout ? isStandaloneLayoutFile(join16(dir, "layout.vsk")) : false;
52471
52638
  const node = {
52472
52639
  path: seg,
52473
52640
  fullPath: collapseSlashes2(fullPath) || "/",
@@ -52488,7 +52655,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
52488
52655
  standalone: isStandalone ? true : void 0
52489
52656
  };
52490
52657
  for (const entry of entries) {
52491
- const entryPath = join15(dir, entry);
52658
+ const entryPath = join16(dir, entry);
52492
52659
  let entryStat;
52493
52660
  try {
52494
52661
  entryStat = statSync12(entryPath);
@@ -52540,19 +52707,19 @@ function collectSources(tree) {
52540
52707
  function walk9(nodes) {
52541
52708
  for (const node of nodes) {
52542
52709
  if (node.page)
52543
- map.set(node.page, join15(node.sourceDir, "page.vsk"));
52710
+ map.set(node.page, join16(node.sourceDir, "page.vsk"));
52544
52711
  if (node.layout)
52545
- map.set(node.layout, join15(node.sourceDir, "layout.vsk"));
52712
+ map.set(node.layout, join16(node.sourceDir, "layout.vsk"));
52546
52713
  if (node.loading)
52547
- map.set(node.loading, join15(node.sourceDir, "loading.vsk"));
52714
+ map.set(node.loading, join16(node.sourceDir, "loading.vsk"));
52548
52715
  if (node.error)
52549
- map.set(node.error, join15(node.sourceDir, "error.vsk"));
52716
+ map.set(node.error, join16(node.sourceDir, "error.vsk"));
52550
52717
  if (node.notFound)
52551
- map.set(node.notFound, join15(node.sourceDir, "not-found.vsk"));
52718
+ map.set(node.notFound, join16(node.sourceDir, "not-found.vsk"));
52552
52719
  if (node.offline)
52553
- map.set(node.offline, join15(node.sourceDir, "offline.vsk"));
52720
+ map.set(node.offline, join16(node.sourceDir, "offline.vsk"));
52554
52721
  if (node.network)
52555
- map.set(node.network, join15(node.sourceDir, "network.vsk"));
52722
+ map.set(node.network, join16(node.sourceDir, "network.vsk"));
52556
52723
  walk9(node.children);
52557
52724
  }
52558
52725
  }
@@ -52654,7 +52821,7 @@ function matchUrl(tree, pathname) {
52654
52821
 
52655
52822
  // ../compiler/dist/api-routes.js
52656
52823
  import { readdirSync as readdirSync8, statSync as statSync13, existsSync as existsSync24 } from "fs";
52657
- import { join as join16 } from "path";
52824
+ import { join as join17 } from "path";
52658
52825
  init_server_utils();
52659
52826
  function basename5(p) {
52660
52827
  const idx = p.lastIndexOf("/");
@@ -52691,7 +52858,7 @@ function scanApiDir(rootDir, dir, parentPath) {
52691
52858
  return nodes;
52692
52859
  if (isRouteGroup) {
52693
52860
  for (const entry of entries) {
52694
- const entryPath = join16(dir, entry);
52861
+ const entryPath = join17(dir, entry);
52695
52862
  let entryStat;
52696
52863
  try {
52697
52864
  entryStat = statSync13(entryPath);
@@ -52721,11 +52888,11 @@ function scanApiDir(rootDir, dir, parentPath) {
52721
52888
  fullPath: collapseSlashes(fullPath) || "/",
52722
52889
  isDynamic,
52723
52890
  isCatchAll,
52724
- filePath: hasRoute && routeFileName ? join16(dir, routeFileName) : null,
52891
+ filePath: hasRoute && routeFileName ? join17(dir, routeFileName) : null,
52725
52892
  children: []
52726
52893
  };
52727
52894
  for (const entry of entries) {
52728
- const entryPath = join16(dir, entry);
52895
+ const entryPath = join17(dir, entry);
52729
52896
  let entryStat;
52730
52897
  try {
52731
52898
  entryStat = statSync13(entryPath);
@@ -53255,11 +53422,11 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
53255
53422
 
53256
53423
  // ../compiler/dist/events.js
53257
53424
  import { existsSync as existsSync26 } from "fs";
53258
- import { join as join17 } from "path";
53425
+ import { join as join18 } from "path";
53259
53426
  var EVENTS_FILE_NAMES2 = ["_events.ts", "_events.js"];
53260
53427
  function collectEventsFile2(appDir) {
53261
53428
  for (const name of EVENTS_FILE_NAMES2) {
53262
- const candidate = join17(appDir, name);
53429
+ const candidate = join18(appDir, name);
53263
53430
  if (existsSync26(candidate))
53264
53431
  return candidate;
53265
53432
  }
@@ -53291,7 +53458,7 @@ async function runEventHandlers(handlers, name, ctx2) {
53291
53458
 
53292
53459
  // ../compiler/dist/md-inline.js
53293
53460
  import { readFileSync as readFileSync23, existsSync as existsSync27 } from "node:fs";
53294
- import { dirname as dirname17, join as join18, resolve as resolve23 } from "node:path";
53461
+ import { dirname as dirname17, join as join19, resolve as resolve23 } from "node:path";
53295
53462
  var MD_EXT_MARKER2 = ".md";
53296
53463
  function looksLikeMarkdownPath2(value) {
53297
53464
  const v = value.trim();
@@ -53368,10 +53535,10 @@ function resolveMdPath2(specifier, importerDir, roots) {
53368
53535
  }
53369
53536
  if (spec.startsWith("/")) {
53370
53537
  for (const root3 of roots) {
53371
- const pub = join18(root3, "public", spec);
53538
+ const pub = join19(root3, "public", spec);
53372
53539
  if (existsSync27(pub))
53373
53540
  return pub;
53374
- const direct = join18(root3, spec);
53541
+ const direct = join19(root3, spec);
53375
53542
  if (existsSync27(direct))
53376
53543
  return direct;
53377
53544
  }
@@ -53385,7 +53552,7 @@ function guessProjectRoots2(dir) {
53385
53552
  let cur = dir;
53386
53553
  for (let i = 0; i < 6; i++) {
53387
53554
  roots.push(cur);
53388
- if (existsSync27(join18(cur, "package.json")))
53555
+ if (existsSync27(join19(cur, "package.json")))
53389
53556
  break;
53390
53557
  const parent = dirname17(cur);
53391
53558
  if (parent === cur)
@@ -53397,7 +53564,7 @@ function guessProjectRoots2(dir) {
53397
53564
 
53398
53565
  // ../adapter/dist/client-bundle.js
53399
53566
  import { readFileSync as readFileSync24, existsSync as existsSync28, writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, statSync as statSync14, rmSync as rmSync4, mkdtempSync as mkdtempSync2, mkdirSync as mkdirSync12 } from "node:fs";
53400
- import { resolve as resolve24, join as join19, dirname as dirname18, relative as relative6, sep as sep3 } from "node:path";
53567
+ import { resolve as resolve24, join as join20, dirname as dirname18, relative as relative6, sep as sep3 } from "node:path";
53401
53568
  import { fileURLToPath as fileURLToPath6 } from "node:url";
53402
53569
  import { tmpdir as tmpdir3 } from "node:os";
53403
53570
 
@@ -53480,8 +53647,8 @@ function findRuntimeSrc3(appDir) {
53480
53647
  resolve24(appDir, "node_modules", "@vesk/runtime")
53481
53648
  ];
53482
53649
  for (const base of candidates) {
53483
- for (const dir of [base, join19(base, "dist")]) {
53484
- if (existsSync28(join19(dir, "index-client.js")))
53650
+ for (const dir of [base, join20(base, "dist")]) {
53651
+ if (existsSync28(join20(dir, "index-client.js")))
53485
53652
  return dir;
53486
53653
  }
53487
53654
  }
@@ -54133,8 +54300,8 @@ ${body}
54133
54300
  continue;
54134
54301
  let finalCode;
54135
54302
  if (entry.imports) {
54136
- const tmpBase = mkdtempSync2(join19(resolve24(appDir, ".."), "tmp-vesk-chunk-"));
54137
- const tmpFile = join19(tmpBase, "entry.js");
54303
+ const tmpBase = mkdtempSync2(join20(resolve24(appDir, ".."), "tmp-vesk-chunk-"));
54304
+ const tmpFile = join20(tmpBase, "entry.js");
54138
54305
  const toBundle = `const __components = globalThis.__components || (globalThis.__components = {});
54139
54306
  const __hydrators = globalThis.__hydrators || (globalThis.__hydrators = {});
54140
54307
  ${entry.code}
@@ -54286,7 +54453,7 @@ function buildRuntimeCode2(runtimeDir) {
54286
54453
  ];
54287
54454
  let code = "";
54288
54455
  for (const f of runtimeFiles) {
54289
- const p = join19(runtimeDir, f);
54456
+ const p = join20(runtimeDir, f);
54290
54457
  if (existsSync28(p)) {
54291
54458
  let src2 = readFileSync24(p, "utf-8");
54292
54459
  src2 = stripTypes2(src2);
@@ -54300,7 +54467,7 @@ ${src2}
54300
54467
  `;
54301
54468
  }
54302
54469
  }
54303
- const indexSrc = readFileSync24(join19(runtimeDir, "index-client.js"), "utf-8");
54470
+ const indexSrc = readFileSync24(join20(runtimeDir, "index-client.js"), "utf-8");
54304
54471
  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())) || [];
54305
54472
  code += "// --- exports ---\n";
54306
54473
  for (const name of [...new Set(exportNames)]) {
@@ -54311,7 +54478,7 @@ ${src2}
54311
54478
  return code;
54312
54479
  }
54313
54480
  function runtimeExportNames2(runtimeDir) {
54314
- const indexSrc = readFileSync24(join19(runtimeDir, "index-client.js"), "utf-8");
54481
+ const indexSrc = readFileSync24(join20(runtimeDir, "index-client.js"), "utf-8");
54315
54482
  const names = /* @__PURE__ */ new Set();
54316
54483
  for (const m of indexSrc.matchAll(/export\s*\{([^}]+)\}\s*from/g)) {
54317
54484
  for (const raw2 of m[1].split(",")) {
@@ -54327,7 +54494,7 @@ function esbuildPath2(p) {
54327
54494
  return sep3 === "/" ? p : p.split(sep3).join("/");
54328
54495
  }
54329
54496
  function runtimeTreeShakeEntry2() {
54330
- return join19(tmpdir3(), "vesk-runtime-tree-shake", RUNTIME_ENTRY2);
54497
+ return join20(tmpdir3(), "vesk-runtime-tree-shake", RUNTIME_ENTRY2);
54331
54498
  }
54332
54499
  var treeShakeQueue2 = Promise.resolve();
54333
54500
  function buildTreeShakenRuntime2(runtimeDir, usedNames) {
@@ -54344,7 +54511,7 @@ async function buildTreeShakenRuntimeNow2(runtimeDir, usedNames) {
54344
54511
  return buildRuntimeCode2(runtimeDir);
54345
54512
  }
54346
54513
  const entry = runtimeTreeShakeEntry2();
54347
- const indexClient = esbuildPath2(join19(runtimeDir, "index-client.js"));
54514
+ const indexClient = esbuildPath2(join20(runtimeDir, "index-client.js"));
54348
54515
  try {
54349
54516
  try {
54350
54517
  mkdirSync12(dirname18(entry), { recursive: true });
@@ -54583,7 +54750,7 @@ import { resolve as resolve28 } from "node:path";
54583
54750
  // ../adapter/dist/plugins.js
54584
54751
  init_paths();
54585
54752
  import { readFileSync as readFileSync26, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync16 } from "node:fs";
54586
- import { resolve as resolve26, dirname as dirname19, join as join20, extname as extname7, basename as basename6 } from "node:path";
54753
+ import { resolve as resolve26, dirname as dirname19, join as join21, extname as extname7, basename as basename6 } from "node:path";
54587
54754
  import { createRequire as createRequire6 } from "node:module";
54588
54755
  import { spawn as spawn2 } from "node:child_process";
54589
54756
  var PLUGIN_STATE_FILENAME2 = "plugins.json";
@@ -54643,7 +54810,7 @@ function resolvePackage2(appDir, pkg) {
54643
54810
  const seen = /* @__PURE__ */ new Set();
54644
54811
  while (cur && cur !== dirname19(cur) && !seen.has(cur)) {
54645
54812
  seen.add(cur);
54646
- const candidate = join20(cur, "package.json");
54813
+ const candidate = join21(cur, "package.json");
54647
54814
  if (existsSync30(candidate)) {
54648
54815
  pkgJsonPath = candidate;
54649
54816
  break;
@@ -54672,7 +54839,7 @@ function resolvePackage2(appDir, pkg) {
54672
54839
  }
54673
54840
  }
54674
54841
  if (localPath) {
54675
- const localJson = join20(localPath, "package.json");
54842
+ const localJson = join21(localPath, "package.json");
54676
54843
  let json = null;
54677
54844
  if (existsSync30(localJson)) {
54678
54845
  json = readJsonFile2(localJson);
@@ -55560,7 +55727,7 @@ var __internals2 = {
55560
55727
  // ../adapter/dist/dev-config.js
55561
55728
  import { existsSync as existsSync31, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
55562
55729
  import { tmpdir as tmpdir4 } from "node:os";
55563
- import { resolve as resolve27, dirname as dirname20, join as join21 } from "node:path";
55730
+ import { resolve as resolve27, dirname as dirname20, join as join22 } from "node:path";
55564
55731
  init_parser();
55565
55732
  function findConfigFile2(projectDir) {
55566
55733
  const ts9 = resolve27(projectDir, "vesk.config.ts");
@@ -55588,9 +55755,9 @@ async function parseConfigSource(source, isTs, projectDir) {
55588
55755
  js = `const { defineConfig, definePlugin, preset } = globalThis.__vesk_inject;
55589
55756
  ` + js;
55590
55757
  }
55591
- const base = projectDir ? (mkdirSync14(join21(projectDir, ".vesk"), { recursive: true }), join21(projectDir, ".vesk")) : void 0;
55592
- const dir = base ? mkdtempSync3(join21(base, "cfg-")) : mkdtempSync3(join21(tmpdir4(), "vesk-cfg-"));
55593
- const tmpFile = join21(dir, "config.mjs");
55758
+ const base = projectDir ? (mkdirSync14(join22(projectDir, ".vesk"), { recursive: true }), join22(projectDir, ".vesk")) : void 0;
55759
+ const dir = base ? mkdtempSync3(join22(base, "cfg-")) : mkdtempSync3(join22(tmpdir4(), "vesk-cfg-"));
55760
+ const tmpFile = join22(dir, "config.mjs");
55594
55761
  try {
55595
55762
  writeFileSync15(tmpFile, js, "utf-8");
55596
55763
  globalThis.__vesk_inject = {
@@ -56900,7 +57067,7 @@ function produceDiagnostics(input) {
56900
57067
 
56901
57068
  // ../agentic/dist/checkpoints.js
56902
57069
  import { existsSync as existsSync33, mkdirSync as mkdirSync15, readFileSync as readFileSync29, writeFileSync as writeFileSync16, statSync as statSync18, unlinkSync as unlinkSync5, rmSync as rmSync6, renameSync } from "node:fs";
56903
- import { join as join22, resolve as resolve29, dirname as dirname21, sep as sep5 } from "node:path";
57070
+ import { join as join23, resolve as resolve29, dirname as dirname21, sep as sep5 } from "node:path";
56904
57071
  import { randomUUID as nodeRandomUUID } from "node:crypto";
56905
57072
  function generateId() {
56906
57073
  try {
@@ -57033,16 +57200,16 @@ var CheckpointManager = class {
57033
57200
  }
57034
57201
  };
57035
57202
  function getAgenticDir(projectDir) {
57036
- return join22(resolve29(projectDir), ".vesk", "agentic");
57203
+ return join23(resolve29(projectDir), ".vesk", "agentic");
57037
57204
  }
57038
57205
  function getHistoryPath(projectDir) {
57039
- return join22(getAgenticDir(projectDir), "history.json");
57206
+ return join23(getAgenticDir(projectDir), "history.json");
57040
57207
  }
57041
57208
  function getCheckpointDir(projectDir, id) {
57042
- return join22(getAgenticDir(projectDir), "checkpoints", id);
57209
+ return join23(getAgenticDir(projectDir), "checkpoints", id);
57043
57210
  }
57044
57211
  function getCheckpointPath(projectDir, id) {
57045
- return join22(getCheckpointDir(projectDir, id), "checkpoint.json");
57212
+ return join23(getCheckpointDir(projectDir, id), "checkpoint.json");
57046
57213
  }
57047
57214
  function ensureDir(dir) {
57048
57215
  mkdirSync15(dir, { recursive: true });
@@ -57122,7 +57289,7 @@ function createCheckpoint(projectDir, message, changes = {}, buildResult) {
57122
57289
  };
57123
57290
  const agenticDir = getAgenticDir(projectDir);
57124
57291
  ensureDir(agenticDir);
57125
- ensureDir(join22(agenticDir, "checkpoints"));
57292
+ ensureDir(join23(agenticDir, "checkpoints"));
57126
57293
  const cpDir = getCheckpointDir(projectDir, id);
57127
57294
  ensureDir(cpDir);
57128
57295
  writeJsonAtomic(getCheckpointPath(projectDir, id), checkpoint);
@@ -58627,7 +58794,7 @@ var Agent = class {
58627
58794
 
58628
58795
  // ../agentic/dist/tools/vesk.js
58629
58796
  import { existsSync as existsSync36, readFileSync as readFileSync32, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync10, statSync as statSync19 } from "node:fs";
58630
- import { resolve as resolve32, join as join23, dirname as dirname23, sep as sep6 } from "node:path";
58797
+ import { resolve as resolve32, join as join24, dirname as dirname23, sep as sep6 } from "node:path";
58631
58798
  function resolveWithin3(baseDir, relPath) {
58632
58799
  const base = resolve32(baseDir);
58633
58800
  const target = resolve32(baseDir, relPath);
@@ -58689,7 +58856,7 @@ function findConfigFile3(projectDir) {
58689
58856
  return { path: null, isTs: false };
58690
58857
  }
58691
58858
  function checkpointDir(veskDir) {
58692
- return join23(resolve32(veskDir), "checkpoints");
58859
+ return join24(resolve32(veskDir), "checkpoints");
58693
58860
  }
58694
58861
  function findMatchingBrace2(src2, openIdx) {
58695
58862
  let inStr = null;
@@ -59304,7 +59471,7 @@ function createVeskTools(deps) {
59304
59471
  const dir = checkpointDir(veskDir);
59305
59472
  mkdirSync17(dir, { recursive: true });
59306
59473
  const id = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
59307
- const file = join23(dir, `${id}.json`);
59474
+ const file = join24(dir, `${id}.json`);
59308
59475
  const check = resolveWithin3(dir, `${id}.json`);
59309
59476
  if (!check)
59310
59477
  return jsonError("path escapes project root");
@@ -59353,7 +59520,7 @@ function createVeskTools(deps) {
59353
59520
  } catch {
59354
59521
  }
59355
59522
  const dir = checkpointDir(veskDir);
59356
- const file = join23(dir, `${checkpointId}.json`);
59523
+ const file = join24(dir, `${checkpointId}.json`);
59357
59524
  const contained = resolveWithin3(dir, `${checkpointId}.json`);
59358
59525
  if (!contained)
59359
59526
  return jsonError("path escapes project root");
@@ -60076,7 +60243,7 @@ function renderDevErrorPage(payload, opts) {
60076
60243
  import { spawnSync as spawnSync2 } from "node:child_process";
60077
60244
  import { cpSync as cpSync2, existsSync as existsSync40, mkdirSync as mkdirSync18, readFileSync as readFileSync36, readdirSync as readdirSync11, statSync as statSync20, writeFileSync as writeFileSync20 } from "node:fs";
60078
60245
  import { createRequire as createRequire7 } from "node:module";
60079
- import { dirname as dirname25, join as join24, resolve as resolve36 } from "node:path";
60246
+ import { dirname as dirname25, join as join25, resolve as resolve36 } from "node:path";
60080
60247
  import { fileURLToPath as fileURLToPath8 } from "node:url";
60081
60248
  var require2 = createRequire7(import.meta.url);
60082
60249
  var __dirname9 = dirname25(fileURLToPath8(import.meta.url));
@@ -60100,12 +60267,14 @@ var PACKAGES = {
60100
60267
  // vesk.config.ts imports them, so their dist must exist for e2e/dev
60101
60268
  // servers on fresh checkouts (CI).
60102
60269
  "plugin-pwa": { name: "@vesk/plugin-pwa", entry: "index" },
60103
- "plugin-tailwind": { name: "@vesk/plugin-tailwind", entry: "index" }
60270
+ "plugin-tailwind": { name: "@vesk/plugin-tailwind", entry: "index" },
60271
+ // testing last — it depends on the compiler.
60272
+ testing: { name: "@vesk/testing", entry: "index" }
60104
60273
  };
60105
60274
  function newestSourceMtime(srcDir) {
60106
60275
  let newest = 0;
60107
60276
  for (const name of readdirSync11(srcDir)) {
60108
- const p = join24(srcDir, name);
60277
+ const p = join25(srcDir, name);
60109
60278
  const st = statSync20(p);
60110
60279
  if (st.isDirectory()) {
60111
60280
  newest = Math.max(newest, newestSourceMtime(p));
@@ -60116,11 +60285,11 @@ function newestSourceMtime(srcDir) {
60116
60285
  return newest;
60117
60286
  }
60118
60287
  function distStale(pkgDir, entry) {
60119
- const distIndex = join24(pkgDir, "dist", `${entry}.js`);
60288
+ const distIndex = join25(pkgDir, "dist", `${entry}.js`);
60120
60289
  if (!existsSync40(distIndex)) return true;
60121
- const distPkg = join24(pkgDir, "dist", "package.json");
60290
+ const distPkg = join25(pkgDir, "dist", "package.json");
60122
60291
  const distStamp = Math.max(statSync20(distIndex).mtimeMs, existsSync40(distPkg) ? statSync20(distPkg).mtimeMs : 0);
60123
- return newestSourceMtime(join24(pkgDir, "src")) > distStamp;
60292
+ return newestSourceMtime(join25(pkgDir, "src")) > distStamp;
60124
60293
  }
60125
60294
  function distPackageJson(pkgName, entry, serverEntry, version2) {
60126
60295
  const exports = {
@@ -60144,23 +60313,23 @@ function distPackageJson(pkgName, entry, serverEntry, version2) {
60144
60313
  function buildPackages(force = false) {
60145
60314
  for (const [pkg, cfg] of Object.entries(PACKAGES)) {
60146
60315
  const pkgDir = resolve36(root2, "packages", pkg);
60147
- if (!existsSync40(join24(pkgDir, "src"))) continue;
60316
+ if (!existsSync40(join25(pkgDir, "src"))) continue;
60148
60317
  if (!force && !distStale(pkgDir, cfg.entry)) continue;
60149
60318
  console.log(`[build] ${cfg.name} -> tsc`);
60150
60319
  const tscBin = require2.resolve("typescript/bin/tsc");
60151
- const result = spawnSync2(process.execPath, [tscBin, "-p", join24(pkgDir, "tsconfig.build.json")], {
60320
+ const result = spawnSync2(process.execPath, [tscBin, "-p", join25(pkgDir, "tsconfig.build.json")], {
60152
60321
  stdio: "inherit"
60153
60322
  });
60154
60323
  if (result.status !== 0) {
60155
60324
  throw new Error(`tsc failed for ${cfg.name}`);
60156
60325
  }
60157
- const distDir = join24(pkgDir, "dist");
60326
+ const distDir = join25(pkgDir, "dist");
60158
60327
  for (const c of cfg.copy || []) {
60159
- const to = join24(distDir, c.to);
60328
+ const to = join25(distDir, c.to);
60160
60329
  mkdirSync18(dirname25(to), { recursive: true });
60161
- cpSync2(join24(pkgDir, c.from), to, { recursive: true });
60330
+ cpSync2(join25(pkgDir, c.from), to, { recursive: true });
60162
60331
  }
60163
- const srcPkg = JSON.parse(readFileSync36(join24(pkgDir, "package.json"), "utf-8"));
60332
+ const srcPkg = JSON.parse(readFileSync36(join25(pkgDir, "package.json"), "utf-8"));
60164
60333
  if (pkg === "lucide-vesk") {
60165
60334
  const lucideDistPkg = {
60166
60335
  name: srcPkg.name,
@@ -60174,9 +60343,9 @@ function buildPackages(force = false) {
60174
60343
  "./package.json": "./package.json"
60175
60344
  }
60176
60345
  };
60177
- writeFileSync20(join24(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
60346
+ writeFileSync20(join25(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
60178
60347
  } else {
60179
- writeFileSync20(join24(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
60348
+ writeFileSync20(join25(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
60180
60349
  }
60181
60350
  console.log(`[build] ${cfg.name} -> dist`);
60182
60351
  }
@@ -60653,9 +60822,9 @@ function resolveRuntimeDir(projectDir) {
60653
60822
  resolve38(import.meta.dirname ?? ".", "..", "..", "runtime", "dist")
60654
60823
  ];
60655
60824
  for (const dir of candidates) {
60656
- if (existsSync42(join25(dir, "ripple-runtime.js"))) return dir;
60657
- const distDir = join25(dir, "dist");
60658
- if (existsSync42(join25(distDir, "ripple-runtime.js"))) return distDir;
60825
+ if (existsSync42(join26(dir, "ripple-runtime.js"))) return dir;
60826
+ const distDir = join26(dir, "dist");
60827
+ if (existsSync42(join26(distDir, "ripple-runtime.js"))) return distDir;
60659
60828
  }
60660
60829
  return null;
60661
60830
  }
@@ -60895,7 +61064,7 @@ function countFilesNamed(dir, name) {
60895
61064
  if (!existsSync42(dir)) return 0;
60896
61065
  let n = 0;
60897
61066
  for (const entry of readdirSync13(dir, { withFileTypes: true })) {
60898
- const p = join25(dir, entry.name);
61067
+ const p = join26(dir, entry.name);
60899
61068
  if (entry.isDirectory()) n += countFilesNamed(p, name);
60900
61069
  else if (entry.name === name) n++;
60901
61070
  }
@@ -60938,7 +61107,7 @@ async function startDevServer(port, projectDir, config, host) {
60938
61107
  process.exit(1);
60939
61108
  }
60940
61109
  const runtimeDir = runtimeDirUnchecked;
60941
- const veskStateDir = join25(projectDir, ".vesk");
61110
+ const veskStateDir = join26(projectDir, ".vesk");
60942
61111
  const configPluginsRaw = config.plugins || [];
60943
61112
  const configPluginNames = configPluginsRaw.map((p) => typeof p === "string" ? p : p?.name).filter((n) => !!n);
60944
61113
  const rawDevPlugins = config.plugins || [];
@@ -61037,10 +61206,10 @@ async function startDevServer(port, projectDir, config, host) {
61037
61206
  }
61038
61207
  let devGlobalCssContent = "";
61039
61208
  let lastServedCssGlobal = "";
61040
- const appCssPath = join25(appDirPath, "global.css");
61041
- const srcDir = join25(projectDir, "src");
61042
- const cssPath = join25(srcDir, "global.css");
61043
- const altCssPath = join25(srcDir, "app.css");
61209
+ const appCssPath = join26(appDirPath, "global.css");
61210
+ const srcDir = join26(projectDir, "src");
61211
+ const cssPath = join26(srcDir, "global.css");
61212
+ const altCssPath = join26(srcDir, "app.css");
61044
61213
  let rawCss = "";
61045
61214
  let devCssSource = "";
61046
61215
  if (existsSync42(appCssPath)) {
@@ -61327,7 +61496,7 @@ async function startDevServer(port, projectDir, config, host) {
61327
61496
  if (!filename) return;
61328
61497
  const kind = classifyHmrWatchPath(filename);
61329
61498
  if (kind === "ignored") return;
61330
- const fullPath = filename.startsWith("/") ? filename : join25(watchDir, filename);
61499
+ const fullPath = filename.startsWith("/") ? filename : join26(watchDir, filename);
61331
61500
  const fileExists = existsSync42(fullPath);
61332
61501
  const bcast = (msg) => {
61333
61502
  const f = globalThis.__vesk_broadcastHmr;
@@ -61542,8 +61711,8 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
61542
61711
  ".json": "application/json",
61543
61712
  ".webmanifest": "application/manifest+json"
61544
61713
  };
61545
- const hmrJsPath = join25(runtimeDir, "hmr-client.js");
61546
- const hmrTsPath = join25(runtimeDir, "hmr-client.ts");
61714
+ const hmrJsPath = join26(runtimeDir, "hmr-client.js");
61715
+ const hmrTsPath = join26(runtimeDir, "hmr-client.ts");
61547
61716
  const hmrClientPath = existsSync42(hmrJsPath) ? hmrJsPath : existsSync42(hmrTsPath) ? hmrTsPath : null;
61548
61717
  function extractCompName2(src2) {
61549
61718
  return resolveComponentName(src2);
@@ -61715,7 +61884,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
61715
61884
  return;
61716
61885
  }
61717
61886
  const mwChain = collectMiddlewareChain(routeTree, url.pathname, appDirPath);
61718
- const apiDirPath = join25(appDirPath, "api");
61887
+ const apiDirPath = join26(appDirPath, "api");
61719
61888
  if (url.pathname.startsWith("/api") && existsSync42(apiDirPath)) {
61720
61889
  const apiRoutes = await scanApiRoutes(apiDirPath);
61721
61890
  const apiMatch = matchApiUrl(apiRoutes, req.url || url.pathname);
@@ -62207,7 +62376,7 @@ ${prettifyHtml(body)}
62207
62376
  LOG.ok(`dev server at http://localhost:${port} (listening on ${bindHost})`);
62208
62377
  const routes = collectRoutePaths(routeTree);
62209
62378
  const pageCount = countPages(routeTree);
62210
- const apiCount = countFilesNamed(join25(appDirPath, "api"), "route.ts");
62379
+ const apiCount = countFilesNamed(join26(appDirPath, "api"), "route.ts");
62211
62380
  LOG.info(`${projectDir}`);
62212
62381
  LOG.info(`${pageCount} page${pageCount === 1 ? "" : "s"}: ${routes.join(", ") || "(none)"}`);
62213
62382
  if (apiCount > 0) LOG.info(`${apiCount} api route${apiCount === 1 ? "" : "s"} (app/api)`);
@@ -62521,8 +62690,8 @@ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
62521
62690
  }
62522
62691
  function loadEnvFiles(projectDir) {
62523
62692
  const files = [
62524
- join29(projectDir, ".env"),
62525
- join29(projectDir, ".env.local")
62693
+ join30(projectDir, ".env"),
62694
+ join30(projectDir, ".env.local")
62526
62695
  ];
62527
62696
  for (const filePath of files) {
62528
62697
  if (!existsSync45(filePath)) continue;
@@ -62693,7 +62862,7 @@ if (cmd === "start") {
62693
62862
  if (cmd === "init") {
62694
62863
  const projectDir = process.cwd();
62695
62864
  const { appDir: appDirPath } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
62696
- const target = join29(appDirPath, "global.css");
62865
+ const target = join30(appDirPath, "global.css");
62697
62866
  if (existsSync45(target)) {
62698
62867
  console.error(`vesk init: ${target} already exists \u2014 skipping`);
62699
62868
  process.exit(0);
@@ -62714,7 +62883,7 @@ if (cmd === "migrate") {
62714
62883
  const projectDir = process.cwd();
62715
62884
  const { runMigrate: runMigrate2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
62716
62885
  const { CODEMODS: CODEMODS2 } = await Promise.resolve().then(() => (init_codemods(), codemods_exports));
62717
- const { version: cliVersion } = JSON.parse(readFileSync42(join29(__dirname10, "..", "package.json"), "utf-8"));
62886
+ const { version: cliVersion } = JSON.parse(readFileSync42(join30(__dirname10, "..", "package.json"), "utf-8"));
62718
62887
  if (args.includes("--list")) {
62719
62888
  console.error("vesk migrate: available codemods");
62720
62889
  for (const c of CODEMODS2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.50-canary.3",
3
+ "version": "0.2.50-canary.4",
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.50-canary.3",
12
- "@vesk/compiler": "^0.2.50-canary.3",
13
- "@vesk/plugin-tailwind": "^0.2.50-canary.3",
14
- "@vesk/runtime": "^0.2.50-canary.3",
11
+ "@vesk/adapter": "^0.2.50-canary.4",
12
+ "@vesk/compiler": "^0.2.50-canary.4",
13
+ "@vesk/plugin-tailwind": "^0.2.50-canary.4",
14
+ "@vesk/runtime": "^0.2.50-canary.4",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",