@vesk/vesk-cli 0.2.68 → 0.2.69

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 +668 -336
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -35609,7 +35609,7 @@ var init_default_pages = __esm({
35609
35609
 
35610
35610
  // ../adapter/src/paths.ts
35611
35611
  import { resolve as resolve11, sep as sep2 } from "node:path";
35612
- import { existsSync as existsSync12, statSync as statSync4, readFileSync as readFileSync12 } from "node:fs";
35612
+ import { existsSync as existsSync12, statSync as statSync5, readFileSync as readFileSync14 } from "node:fs";
35613
35613
  function resolveWithin(baseDir, relPath) {
35614
35614
  const base = resolve11(baseDir);
35615
35615
  const target = resolve11(baseDir, relPath);
@@ -35628,7 +35628,7 @@ function installMdReadHook(publicDirs) {
35628
35628
  if (!abs) continue;
35629
35629
  const lower2 = abs.toLowerCase();
35630
35630
  if (!lower2.endsWith(".md") && !lower2.endsWith(".markdown")) continue;
35631
- if (existsSync12(abs) && statSync4(abs).isFile()) return readFileSync12(abs, "utf8");
35631
+ if (existsSync12(abs) && statSync5(abs).isFile()) return readFileSync14(abs, "utf8");
35632
35632
  } catch {
35633
35633
  }
35634
35634
  }
@@ -35645,14 +35645,14 @@ var init_paths = __esm({
35645
35645
  import {
35646
35646
  mkdirSync as mkdirSync6,
35647
35647
  copyFileSync as copyFileSync2,
35648
- readdirSync as readdirSync3,
35649
- statSync as statSync6,
35648
+ readdirSync as readdirSync4,
35649
+ statSync as statSync7,
35650
35650
  existsSync as existsSync15,
35651
35651
  writeFileSync as writeFileSync7,
35652
35652
  rmSync as rmSync2,
35653
- readFileSync as readFileSync15
35653
+ readFileSync as readFileSync17
35654
35654
  } from "node:fs";
35655
- import { resolve as resolve13, join as join10, extname as extname3, dirname as dirname10 } from "node:path";
35655
+ import { resolve as resolve13, join as join11, extname as extname3, dirname as dirname10 } from "node:path";
35656
35656
  function ensureCleanDir(dir) {
35657
35657
  rmSync2(dir, { recursive: true, force: true });
35658
35658
  mkdirSync6(dir, { recursive: true });
@@ -35660,10 +35660,10 @@ function ensureCleanDir(dir) {
35660
35660
  function copyDirContents(srcDir, destDir) {
35661
35661
  if (!existsSync15(srcDir)) return;
35662
35662
  mkdirSync6(destDir, { recursive: true });
35663
- for (const entry of readdirSync3(srcDir)) {
35664
- const srcPath = join10(srcDir, entry);
35665
- const destPath = join10(destDir, entry);
35666
- if (statSync6(srcPath).isDirectory()) {
35663
+ for (const entry of readdirSync4(srcDir)) {
35664
+ const srcPath = join11(srcDir, entry);
35665
+ const destPath = join11(destDir, entry);
35666
+ if (statSync7(srcPath).isDirectory()) {
35667
35667
  copyDirContents(srcPath, destPath);
35668
35668
  } else {
35669
35669
  mkdirSync6(dirname10(destPath), { recursive: true });
@@ -35693,7 +35693,7 @@ function writePlatformStatic(buildStaticDir, platformStaticDir) {
35693
35693
  function writePrerenderedStatic(prerenderedRoutes, platformStaticDir) {
35694
35694
  for (const route of prerenderedRoutes) {
35695
35695
  if (!existsSync15(route.html)) continue;
35696
- const content = readFileSync15(route.html);
35696
+ const content = readFileSync17(route.html);
35697
35697
  const htmlRel = route.path === "/" ? "index.html" : `${route.path.replace(/^\//, "")}.html`;
35698
35698
  const target = resolve13(platformStaticDir, "_vesk", "static", "public", htmlRel);
35699
35699
  writeFile(target, content);
@@ -35707,13 +35707,13 @@ function listStaticDir(dir) {
35707
35707
  const out = [];
35708
35708
  if (!existsSync15(dir)) return out;
35709
35709
  function walk9(d, prefix) {
35710
- for (const entry of readdirSync3(d)) {
35711
- const full = join10(d, entry);
35710
+ for (const entry of readdirSync4(d)) {
35711
+ const full = join11(d, entry);
35712
35712
  const rel = prefix ? `${prefix}/${entry}` : entry;
35713
- if (statSync6(full).isDirectory()) {
35713
+ if (statSync7(full).isDirectory()) {
35714
35714
  walk9(full, rel);
35715
35715
  } else {
35716
- out.push({ rel, buffer: readFileSync15(full) });
35716
+ out.push({ rel, buffer: readFileSync17(full) });
35717
35717
  }
35718
35718
  }
35719
35719
  }
@@ -35775,13 +35775,13 @@ __export(plugins_exports, {
35775
35775
  writePluginState: () => writePluginState
35776
35776
  });
35777
35777
  import {
35778
- readFileSync as readFileSync17,
35778
+ readFileSync as readFileSync19,
35779
35779
  writeFileSync as writeFileSync8,
35780
35780
  existsSync as existsSync17,
35781
35781
  mkdirSync as mkdirSync7,
35782
- statSync as statSync8
35782
+ statSync as statSync9
35783
35783
  } from "node:fs";
35784
- import { resolve as resolve15, dirname as dirname12, join as join11, extname as extname4, basename as basename2 } from "node:path";
35784
+ import { resolve as resolve15, dirname as dirname12, join as join12, extname as extname4, basename as basename2 } from "node:path";
35785
35785
  import { createRequire as createRequire4 } from "node:module";
35786
35786
  import { spawn } from "node:child_process";
35787
35787
  function defaultState() {
@@ -35798,7 +35798,7 @@ function readPluginState(veskDir) {
35798
35798
  if (!existsSync17(file)) return defaultState();
35799
35799
  let raw2;
35800
35800
  try {
35801
- raw2 = JSON.parse(readFileSync17(file, "utf-8"));
35801
+ raw2 = JSON.parse(readFileSync19(file, "utf-8"));
35802
35802
  } catch {
35803
35803
  return defaultState();
35804
35804
  }
@@ -35833,7 +35833,7 @@ function resolvePackage(appDir, pkg) {
35833
35833
  const seen = /* @__PURE__ */ new Set();
35834
35834
  while (cur && cur !== dirname12(cur) && !seen.has(cur)) {
35835
35835
  seen.add(cur);
35836
- const candidate = join11(cur, "package.json");
35836
+ const candidate = join12(cur, "package.json");
35837
35837
  if (existsSync17(candidate)) {
35838
35838
  pkgJsonPath = candidate;
35839
35839
  break;
@@ -35861,7 +35861,7 @@ function resolvePackage(appDir, pkg) {
35861
35861
  }
35862
35862
  }
35863
35863
  if (localPath) {
35864
- const localJson = join11(localPath, "package.json");
35864
+ const localJson = join12(localPath, "package.json");
35865
35865
  let json = null;
35866
35866
  if (existsSync17(localJson)) {
35867
35867
  json = readJsonFile(localJson);
@@ -35884,7 +35884,7 @@ function localDir(base, pkg) {
35884
35884
  }
35885
35885
  function readJsonFile(file) {
35886
35886
  try {
35887
- if (existsSync17(file)) return JSON.parse(readFileSync17(file, "utf-8"));
35887
+ if (existsSync17(file)) return JSON.parse(readFileSync19(file, "utf-8"));
35888
35888
  } catch {
35889
35889
  }
35890
35890
  return null;
@@ -36163,11 +36163,11 @@ function findIconFile(dir, meta) {
36163
36163
  const explicit = str(meta?.icon);
36164
36164
  if (explicit) {
36165
36165
  const p = resolveWithin(dir, explicit);
36166
- if (p && existsSync17(p) && statSync8(p).isFile()) return p;
36166
+ if (p && existsSync17(p) && statSync9(p).isFile()) return p;
36167
36167
  }
36168
36168
  for (const name of ["icon.png", "icon.ico"]) {
36169
36169
  const p = resolve15(dir, name);
36170
- if (existsSync17(p) && statSync8(p).isFile()) return p;
36170
+ if (existsSync17(p) && statSync9(p).isFile()) return p;
36171
36171
  }
36172
36172
  return null;
36173
36173
  }
@@ -36238,7 +36238,7 @@ function resolveDtsPath(probe, pkgJson) {
36238
36238
  for (const rel of candidates) {
36239
36239
  if (!rel) continue;
36240
36240
  const abs = resolveWithin(dir, rel);
36241
- if (abs && existsSync17(abs) && statSync8(abs).isFile()) return abs;
36241
+ if (abs && existsSync17(abs) && statSync9(abs).isFile()) return abs;
36242
36242
  }
36243
36243
  return null;
36244
36244
  }
@@ -36554,7 +36554,7 @@ function introspectPlugin(appDir, name) {
36554
36554
  const pkgName = str(pkgJson.name) ?? name;
36555
36555
  const exportsMap = flattenPackageExports(pkgJson.exports);
36556
36556
  const dtsPath = resolveDtsPath(probe, pkgJson);
36557
- const dtsExports = dtsPath ? parseDtsExports(readFileSync17(dtsPath, "utf-8")) : [];
36557
+ const dtsExports = dtsPath ? parseDtsExports(readFileSync19(dtsPath, "utf-8")) : [];
36558
36558
  return {
36559
36559
  ok: true,
36560
36560
  name: pkgName,
@@ -36695,8 +36695,8 @@ __export(static_exports, {
36695
36695
  generateSitemap: () => generateSitemap,
36696
36696
  generateSsgRoutes: () => generateSsgRoutes
36697
36697
  });
36698
- import { mkdirSync as mkdirSync8, copyFileSync as copyFileSync3, readdirSync as readdirSync4, statSync as statSync9, existsSync as existsSync18, writeFileSync as writeFileSync9, readFileSync as readFileSync18 } from "node:fs";
36699
- import { resolve as resolve16, join as join12 } from "node:path";
36698
+ import { mkdirSync as mkdirSync8, copyFileSync as copyFileSync3, readdirSync as readdirSync5, statSync as statSync10, existsSync as existsSync18, writeFileSync as writeFileSync9, readFileSync as readFileSync20 } from "node:fs";
36699
+ import { resolve as resolve16, join as join13 } from "node:path";
36700
36700
  function copyStaticAssets2(publicDir, outDir) {
36701
36701
  const targetDir = resolve16(outDir, "static", "public");
36702
36702
  mkdirSync8(targetDir, { recursive: true });
@@ -36704,11 +36704,11 @@ function copyStaticAssets2(publicDir, outDir) {
36704
36704
  return;
36705
36705
  function copyDir(src2, dest) {
36706
36706
  mkdirSync8(dest, { recursive: true });
36707
- const entries = readdirSync4(src2);
36707
+ const entries = readdirSync5(src2);
36708
36708
  for (const entry of entries) {
36709
- const srcPath = join12(src2, entry);
36710
- const destPath = join12(dest, entry);
36711
- const st = statSync9(srcPath);
36709
+ const srcPath = join13(src2, entry);
36710
+ const destPath = join13(dest, entry);
36711
+ const st = statSync10(srcPath);
36712
36712
  if (st.isDirectory()) {
36713
36713
  copyDir(srcPath, destPath);
36714
36714
  } else {
@@ -36741,7 +36741,7 @@ async function generateSsgRoutes(routeTree, appDir, outDir, plugins, headExtra,
36741
36741
  for (const node of nodes) {
36742
36742
  if (node.page) {
36743
36743
  const pagePath = resolve16(appDir, node.sourceDir, "page.vsk");
36744
- const src2 = readFileSync18(pagePath, "utf-8");
36744
+ const src2 = readFileSync20(pagePath, "utf-8");
36745
36745
  const hasStaticProps = src2.includes("getStaticProps");
36746
36746
  const hasStaticPaths = src2.includes("getStaticPaths");
36747
36747
  if (hasStaticPaths) {
@@ -36842,17 +36842,17 @@ __export(image_pipeline_exports, {
36842
36842
  collectImageRefs: () => collectImageRefs,
36843
36843
  optimizeImages: () => optimizeImages
36844
36844
  });
36845
- import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync10, readFileSync as readFileSync19, existsSync as existsSync19, readdirSync as readdirSync5, statSync as statSync10 } from "node:fs";
36845
+ import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync10, readFileSync as readFileSync21, existsSync as existsSync19, readdirSync as readdirSync6, statSync as statSync11 } from "node:fs";
36846
36846
  import { spawnSync } from "node:child_process";
36847
- import { resolve as resolve17, extname as extname5, dirname as dirname13, join as join13 } from "node:path";
36847
+ import { resolve as resolve17, extname as extname5, dirname as dirname13, join as join14 } from "node:path";
36848
36848
  import { createRequire as createRequire5 } from "node:module";
36849
36849
  import { tmpdir as tmpdir2 } from "node:os";
36850
36850
  function probeMemoPath() {
36851
36851
  try {
36852
36852
  const req = createRequire5(import.meta.url);
36853
36853
  const entry = req.resolve("sharp");
36854
- const stamp = Math.round(statSync10(entry).mtimeMs);
36855
- return join13(tmpdir2(), `vesk-sharp-probe-${process.platform}-${process.arch}-${stamp}.json`);
36854
+ const stamp = Math.round(statSync11(entry).mtimeMs);
36855
+ return join14(tmpdir2(), `vesk-sharp-probe-${process.platform}-${process.arch}-${stamp}.json`);
36856
36856
  } catch {
36857
36857
  return null;
36858
36858
  }
@@ -36862,7 +36862,7 @@ function readProbeMemo() {
36862
36862
  if (path === null)
36863
36863
  return null;
36864
36864
  try {
36865
- return JSON.parse(readFileSync19(path, "utf-8"))?.usable === true;
36865
+ return JSON.parse(readFileSync21(path, "utf-8"))?.usable === true;
36866
36866
  } catch {
36867
36867
  return null;
36868
36868
  }
@@ -36905,7 +36905,7 @@ async function ensureSharp() {
36905
36905
  async function processImage(srcPath, outDir, baseName) {
36906
36906
  const image = sharpFn ? sharpFn(srcPath) : null;
36907
36907
  if (!image) {
36908
- const original = readFileSync19(srcPath);
36908
+ const original = readFileSync21(srcPath);
36909
36909
  const ext = extname5(srcPath);
36910
36910
  const written = [];
36911
36911
  for (const w of OUTPUT_WIDTHS) {
@@ -36924,7 +36924,7 @@ async function processImage(srcPath, outDir, baseName) {
36924
36924
  if (w >= originalWidth) {
36925
36925
  const copyPath = resolve17(outDir, `${base}${extname5(srcPath)}`);
36926
36926
  mkdirSync9(dirname13(copyPath), { recursive: true });
36927
- writeFileSync10(copyPath, readFileSync19(srcPath));
36927
+ writeFileSync10(copyPath, readFileSync21(srcPath));
36928
36928
  generated.push(copyPath);
36929
36929
  continue;
36930
36930
  }
@@ -36946,19 +36946,19 @@ function collectImageRefs(appDir) {
36946
36946
  function walk9(dir) {
36947
36947
  let entries;
36948
36948
  try {
36949
- entries = readdirSync5(dir);
36949
+ entries = readdirSync6(dir);
36950
36950
  } catch {
36951
36951
  return;
36952
36952
  }
36953
36953
  for (const entry of entries) {
36954
36954
  const full = resolve17(dir, entry);
36955
- const st = statSync10(full);
36955
+ const st = statSync11(full);
36956
36956
  if (st.isDirectory()) {
36957
36957
  if (entry.startsWith("."))
36958
36958
  continue;
36959
36959
  walk9(full);
36960
36960
  } else if (entry.endsWith(".vsk")) {
36961
- const src2 = readFileSync19(full, "utf-8");
36961
+ const src2 = readFileSync21(full, "utf-8");
36962
36962
  const imgRegex = /<Image\s[^>]*src=["']([^"']+)["']/g;
36963
36963
  let m;
36964
36964
  while ((m = imgRegex.exec(src2)) !== null) {
@@ -37034,19 +37034,19 @@ var seo_audit_exports = {};
37034
37034
  __export(seo_audit_exports, {
37035
37035
  runSeoAudit: () => runSeoAudit
37036
37036
  });
37037
- import { readFileSync as readFileSync20, existsSync as existsSync20, readdirSync as readdirSync6, statSync as statSync11 } from "node:fs";
37037
+ import { readFileSync as readFileSync22, existsSync as existsSync20, readdirSync as readdirSync7, statSync as statSync12 } from "node:fs";
37038
37038
  import { resolve as resolve18 } from "node:path";
37039
37039
  function walkFiles(dir) {
37040
37040
  const results = [];
37041
37041
  let entries;
37042
37042
  try {
37043
- entries = readdirSync6(dir);
37043
+ entries = readdirSync7(dir);
37044
37044
  } catch {
37045
37045
  return results;
37046
37046
  }
37047
37047
  for (const entry of entries) {
37048
37048
  const full = resolve18(dir, entry);
37049
- const st = statSync11(full);
37049
+ const st = statSync12(full);
37050
37050
  if (st.isDirectory()) {
37051
37051
  if (!entry.startsWith("."))
37052
37052
  results.push(...walkFiles(full));
@@ -37062,8 +37062,8 @@ function collectCombinedSource(appDir) {
37062
37062
  for (const pagePath of pages) {
37063
37063
  const dir = resolve18(pagePath, "..");
37064
37064
  const layoutPath = resolve18(dir, "layout.vsk");
37065
- const pageSrc = readFileSync20(pagePath, "utf-8");
37066
- const layoutSrc = existsSync20(layoutPath) ? readFileSync20(layoutPath, "utf-8") : "";
37065
+ const pageSrc = readFileSync22(pagePath, "utf-8");
37066
+ const layoutSrc = existsSync20(layoutPath) ? readFileSync22(layoutPath, "utf-8") : "";
37067
37067
  const combinedSrc = layoutSrc ? layoutSrc + "\n" + pageSrc : pageSrc;
37068
37068
  combined.push({
37069
37069
  path: pagePath,
@@ -37259,7 +37259,7 @@ var init_platform = __esm({
37259
37259
 
37260
37260
  // ../adapter/src/platform-handler.ts
37261
37261
  import { existsSync as existsSync21 } from "node:fs";
37262
- import { resolve as resolve19, dirname as dirname14, join as join14 } from "node:path";
37262
+ import { resolve as resolve19, dirname as dirname14, join as join15 } from "node:path";
37263
37263
  import { fileURLToPath as fileURLToPath4 } from "node:url";
37264
37264
  function routeName2(segments) {
37265
37265
  const parts = segments.filter(Boolean).map((s) => {
@@ -37282,8 +37282,8 @@ function findCompilerSrc2(appDir) {
37282
37282
  resolve19(appDir, "node_modules", "@vesk/compiler")
37283
37283
  ];
37284
37284
  for (const base of candidates) {
37285
- for (const dir of [base, join14(base, "dist")]) {
37286
- if (existsSync21(join14(dir, "server-cookies.js"))) return dir;
37285
+ for (const dir of [base, join15(base, "dist")]) {
37286
+ if (existsSync21(join15(dir, "server-cookies.js"))) return dir;
37287
37287
  }
37288
37288
  }
37289
37289
  throw new Error('@vesk/compiler/dist not found \u2014 run "npm run build" first');
@@ -42307,8 +42307,8 @@ __export(typecheck_exports, {
42307
42307
  formatTypecheckWarnings: () => formatTypecheckWarnings,
42308
42308
  typecheckProject: () => typecheckProject
42309
42309
  });
42310
- import { readFileSync as readFileSync39, readdirSync as readdirSync14, statSync as statSync22 } from "node:fs";
42311
- import { join as join27, dirname as dirname27, normalize, relative as relative8, resolve as resolve39, sep as sep7 } from "node:path";
42310
+ import { readFileSync as readFileSync41, readdirSync as readdirSync15, statSync as statSync23 } from "node:fs";
42311
+ import { join as join28, dirname as dirname27, normalize, relative as relative8, resolve as resolve39, sep as sep7 } from "node:path";
42312
42312
  import * as ts8 from "typescript";
42313
42313
  function walkProjectFiles(projectRoot) {
42314
42314
  const code = [];
@@ -42316,15 +42316,15 @@ function walkProjectFiles(projectRoot) {
42316
42316
  const walk9 = (dir) => {
42317
42317
  let entries = [];
42318
42318
  try {
42319
- entries = readdirSync14(dir);
42319
+ entries = readdirSync15(dir);
42320
42320
  } catch {
42321
42321
  return;
42322
42322
  }
42323
42323
  for (const e of entries) {
42324
- const p = join27(dir, e);
42324
+ const p = join28(dir, e);
42325
42325
  let st;
42326
42326
  try {
42327
- st = statSync22(p);
42327
+ st = statSync23(p);
42328
42328
  } catch {
42329
42329
  continue;
42330
42330
  }
@@ -42376,8 +42376,8 @@ function checkStructureFile(appDir, file) {
42376
42376
  return null;
42377
42377
  }
42378
42378
  function createTypecheckHost(projectRoot, appDir, vskFiles) {
42379
- const ambientPath = join27(appDir, "__vesk_ambient.d.ts");
42380
- const overridePath = join27(appDir, "__vesk_runtime_override.d.ts");
42379
+ const ambientPath = join28(appDir, "__vesk_ambient.d.ts");
42380
+ const overridePath = join28(appDir, "__vesk_runtime_override.d.ts");
42381
42381
  const cached = /* @__PURE__ */ new Map();
42382
42382
  const scriptKindFor = (file) => file.endsWith(".vsk") ? ts8.ScriptKind.TSX : ts8.ScriptKind.TS;
42383
42383
  const host = {
@@ -42447,7 +42447,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
42447
42447
  directoryExists: (dir) => ts8.sys.directoryExists(dir),
42448
42448
  getDirectories: (dir) => {
42449
42449
  try {
42450
- return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join27(dir, d.name));
42450
+ return readdirSync15(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join28(dir, d.name));
42451
42451
  } catch {
42452
42452
  return [];
42453
42453
  }
@@ -42459,7 +42459,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
42459
42459
  return moduleLiterals.map(({ text }) => {
42460
42460
  if (text.endsWith(".vsk")) {
42461
42461
  const aliased = text.startsWith(".") ? null : resolveAliasModule(text, dirname27(containingFile));
42462
- const abs = normalize(aliased ?? join27(dirname27(containingFile), text));
42462
+ const abs = normalize(aliased ?? join28(dirname27(containingFile), text));
42463
42463
  return {
42464
42464
  resolvedModule: {
42465
42465
  resolvedFileName: abs + ".d.ts",
@@ -42470,7 +42470,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
42470
42470
  };
42471
42471
  }
42472
42472
  if (text.endsWith(".css")) {
42473
- const abs = normalize(join27(dirname27(containingFile), text));
42473
+ const abs = normalize(join28(dirname27(containingFile), text));
42474
42474
  return {
42475
42475
  resolvedModule: {
42476
42476
  resolvedFileName: abs + ".d.ts",
@@ -42517,7 +42517,7 @@ function sourcePosition(source, offset2) {
42517
42517
  return { line, character: bounded - lineStart + 1 };
42518
42518
  }
42519
42519
  function typecheckProject(projectRoot, opts = {}) {
42520
- const appDir = opts.appDir ?? join27(projectRoot, "app");
42520
+ const appDir = opts.appDir ?? join28(projectRoot, "app");
42521
42521
  const vskFiles = /* @__PURE__ */ new Map();
42522
42522
  const parseErrors = [];
42523
42523
  const warnings = [];
@@ -42539,7 +42539,7 @@ function typecheckProject(projectRoot, opts = {}) {
42539
42539
  }
42540
42540
  }
42541
42541
  if (f.endsWith(".vsk")) {
42542
- const src2 = readFileSync39(f, "utf-8");
42542
+ const src2 = readFileSync41(f, "utf-8");
42543
42543
  try {
42544
42544
  parse4(src2);
42545
42545
  } catch (e) {
@@ -42556,8 +42556,8 @@ function typecheckProject(projectRoot, opts = {}) {
42556
42556
  }
42557
42557
  rootNames.push(f);
42558
42558
  }
42559
- const ambientPath = join27(appDir, "__vesk_ambient.d.ts");
42560
- const overridePath = join27(appDir, "__vesk_runtime_override.d.ts");
42559
+ const ambientPath = join28(appDir, "__vesk_ambient.d.ts");
42560
+ const overridePath = join28(appDir, "__vesk_runtime_override.d.ts");
42561
42561
  rootNames.push(ambientPath);
42562
42562
  rootNames.push(overridePath);
42563
42563
  const options = {
@@ -48678,8 +48678,8 @@ __export(codemods_exports, {
48678
48678
  applicableCodemods: () => applicableCodemods,
48679
48679
  compareCore: () => compareCore
48680
48680
  });
48681
- import { readFileSync as readFileSync40, existsSync as existsSync43 } from "node:fs";
48682
- import { join as join28 } from "node:path";
48681
+ import { readFileSync as readFileSync42, existsSync as existsSync43 } from "node:fs";
48682
+ import { join as join29 } from "node:path";
48683
48683
  import { walk as walk8 } from "zimmerframe";
48684
48684
  function safeParse(source, filePath) {
48685
48685
  try {
@@ -48699,12 +48699,12 @@ function isVskFile(filePath) {
48699
48699
  }
48700
48700
  function typesPackageExports(projectDir) {
48701
48701
  const candidates = [
48702
- projectDir ? join28(projectDir, "node_modules", "@vesk", "types", "dist", "index.d.ts") : null,
48702
+ projectDir ? join29(projectDir, "node_modules", "@vesk", "types", "dist", "index.d.ts") : null,
48703
48703
  new URL("../../types/dist/index.d.ts", import.meta.url).pathname
48704
48704
  ].filter((p) => typeof p === "string" && existsSync43(p));
48705
48705
  for (const path of candidates) {
48706
48706
  try {
48707
- const src2 = readFileSync40(path, "utf-8");
48707
+ const src2 = readFileSync42(path, "utf-8");
48708
48708
  const names = /* @__PURE__ */ new Set();
48709
48709
  for (const line of src2.split("\n")) {
48710
48710
  const m = /^export\s+(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|enum|const|function|let|var|namespace)\s+([A-Za-z_$][\w$]*)/.exec(line);
@@ -48828,14 +48828,14 @@ __export(migrate_exports, {
48828
48828
  detectInstalledVersion: () => detectInstalledVersion,
48829
48829
  runMigrate: () => runMigrate
48830
48830
  });
48831
- import { readFileSync as readFileSync41, writeFileSync as writeFileSync22, existsSync as existsSync44, statSync as statSync23, readdirSync as readdirSync15 } from "node:fs";
48832
- import { join as join29, relative as relative9, extname as extname8 } from "node:path";
48831
+ import { readFileSync as readFileSync43, writeFileSync as writeFileSync22, existsSync as existsSync44, statSync as statSync24, readdirSync as readdirSync16 } from "node:fs";
48832
+ import { join as join30, relative as relative9, extname as extname8 } from "node:path";
48833
48833
  function detectInstalledVersion(projectDir, cliVersion) {
48834
48834
  for (const pkg of ["@vesk/vesk-cli", "@vesk/adapter", "@vesk/compiler"]) {
48835
- const p = join29(projectDir, "node_modules", pkg, "package.json");
48835
+ const p = join30(projectDir, "node_modules", pkg, "package.json");
48836
48836
  if (!existsSync44(p)) continue;
48837
48837
  try {
48838
- const version2 = JSON.parse(readFileSync41(p, "utf-8")).version;
48838
+ const version2 = JSON.parse(readFileSync43(p, "utf-8")).version;
48839
48839
  if (typeof version2 === "string" && version2) return { version: version2, source: pkg };
48840
48840
  } catch {
48841
48841
  }
@@ -48846,16 +48846,16 @@ function collectTargets(dir, root3 = dir) {
48846
48846
  const out = [];
48847
48847
  let entries;
48848
48848
  try {
48849
- entries = readdirSync15(dir);
48849
+ entries = readdirSync16(dir);
48850
48850
  } catch {
48851
48851
  return out;
48852
48852
  }
48853
48853
  for (const entry of entries.sort()) {
48854
48854
  if (SKIP_DIRS2.has(entry)) continue;
48855
- const full = join29(dir, entry);
48855
+ const full = join30(dir, entry);
48856
48856
  let st;
48857
48857
  try {
48858
- st = statSync23(full);
48858
+ st = statSync24(full);
48859
48859
  } catch {
48860
48860
  continue;
48861
48861
  }
@@ -48887,12 +48887,12 @@ function runMigrate(options) {
48887
48887
  return report;
48888
48888
  }
48889
48889
  for (const relPath of collectTargets(options.projectDir)) {
48890
- const abs = join29(options.projectDir, relPath);
48890
+ const abs = join30(options.projectDir, relPath);
48891
48891
  const ctx2 = { filePath: abs, displayPath: relPath, projectDir: options.projectDir };
48892
48892
  if (!existsSync44(abs)) continue;
48893
48893
  let source;
48894
48894
  try {
48895
- source = readFileSync41(abs, "utf-8");
48895
+ source = readFileSync43(abs, "utf-8");
48896
48896
  } catch (e) {
48897
48897
  report.skipped.push(`${relPath}: unreadable (${e.message})`);
48898
48898
  continue;
@@ -48932,8 +48932,8 @@ var init_migrate = __esm({
48932
48932
  });
48933
48933
 
48934
48934
  // src/index.ts
48935
- import { readFileSync as readFileSync42, writeFileSync as writeFileSync23, mkdirSync as mkdirSync20, existsSync as existsSync45 } from "fs";
48936
- import { resolve as resolve40, join as join30 } from "path";
48935
+ import { readFileSync as readFileSync44, writeFileSync as writeFileSync23, mkdirSync as mkdirSync20, existsSync as existsSync45 } from "fs";
48936
+ import { resolve as resolve40, join as join31 } from "path";
48937
48937
  import { fileURLToPath as fileURLToPath9 } from "url";
48938
48938
 
48939
48939
  // ../adapter/dist/load-config.js
@@ -49511,8 +49511,8 @@ function setRuntimeModule2(mod) {
49511
49511
  }
49512
49512
 
49513
49513
  // ../adapter/dist/index.js
49514
- import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, existsSync as existsSync22, readFileSync as readFileSync21 } from "node:fs";
49515
- import { resolve as resolve21, dirname as dirname16, relative as relative4, basename as basename3, join as join15 } from "node:path";
49514
+ import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, existsSync as existsSync22, readFileSync as readFileSync23 } from "node:fs";
49515
+ import { resolve as resolve21, dirname as dirname16, relative as relative4, basename as basename3, join as join16 } from "node:path";
49516
49516
  import { fileURLToPath as fileURLToPath5 } from "node:url";
49517
49517
 
49518
49518
  // ../adapter/src/runtime-bundle.ts
@@ -51013,8 +51013,8 @@ async function compileEvents(appDir, outDir) {
51013
51013
 
51014
51014
  // ../adapter/src/client-bundle.ts
51015
51015
  init_esbuild_fallback();
51016
- import { readFileSync as readFileSync11, existsSync as existsSync11, writeFileSync as writeFileSync4, unlinkSync as unlinkSync3, statSync as statSync3, rmSync, mkdtempSync, mkdirSync as mkdirSync3 } from "node:fs";
51017
- import { resolve as resolve10, join as join7, dirname as dirname8, relative as relative2, sep } from "node:path";
51016
+ import { readFileSync as readFileSync13, existsSync as existsSync11, writeFileSync as writeFileSync4, unlinkSync as unlinkSync3, statSync as statSync4, rmSync, mkdtempSync, mkdirSync as mkdirSync3 } from "node:fs";
51017
+ import { resolve as resolve10, join as join8, dirname as dirname8, relative as relative2, sep } from "node:path";
51018
51018
  import { fileURLToPath as fileURLToPath2 } from "node:url";
51019
51019
  import { tmpdir } from "node:os";
51020
51020
  init_strip_ts();
@@ -51024,6 +51024,267 @@ init_vsk_collision();
51024
51024
  init_vsk_imports();
51025
51025
  init_md_inline();
51026
51026
  init_module_imports();
51027
+
51028
+ // ../adapter/src/server-only-plugin.ts
51029
+ init_parser();
51030
+ import { readFileSync as readFileSync12 } from "node:fs";
51031
+
51032
+ // ../adapter/src/server-only.ts
51033
+ init_parser();
51034
+ import { readFileSync as readFileSync11, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
51035
+ import { join as join7 } from "node:path";
51036
+ var SERVER_ONLY_EXACT = /* @__PURE__ */ new Set([
51037
+ "slintorm",
51038
+ "@vesk/adapter"
51039
+ ]);
51040
+ var TCP_DRIVERS = /* @__PURE__ */ new Set([
51041
+ "pg",
51042
+ "mysql2",
51043
+ "mongodb",
51044
+ "node:sqlite",
51045
+ "node:net",
51046
+ "node:tls"
51047
+ ]);
51048
+ function classifySpecifier(spec) {
51049
+ if (typeof spec !== "string" || spec.length === 0) return null;
51050
+ if (TCP_DRIVERS.has(spec)) return "tcp-driver";
51051
+ if (spec.startsWith("node:")) return "tcp-driver";
51052
+ if (SERVER_ONLY_EXACT.has(spec)) return "server-only-package";
51053
+ return null;
51054
+ }
51055
+ var REMEDY = {
51056
+ "server-only-package": "import it from an API route (app/api/**/route.ts) or a server action instead of a component, or use the package's browser/edge entry point if it ships one.",
51057
+ "tcp-driver": 'this driver opens a TCP socket, which no edge runtime provides. Use the driver\'s HTTP/HTTPS transport (for SlintORM: `driver: "postgrest"`), or build for a Node target.'
51058
+ };
51059
+ function scanServerOnlyImports(files) {
51060
+ const out = [];
51061
+ for (const file of files) {
51062
+ let ast;
51063
+ try {
51064
+ ast = parse4(file.code);
51065
+ } catch {
51066
+ continue;
51067
+ }
51068
+ for (const node of ast.body ?? []) {
51069
+ if (node?.type !== "ImportDeclaration" && node?.type !== "ExportNamedDeclaration" && node?.type !== "ExportAllDeclaration") continue;
51070
+ const spec = node.source?.value;
51071
+ if (typeof spec !== "string") continue;
51072
+ const kind = classifySpecifier(spec);
51073
+ if (!kind) continue;
51074
+ out.push({
51075
+ kind,
51076
+ specifier: spec,
51077
+ file: file.path,
51078
+ line: lineOf(file.code, node.start),
51079
+ remedy: REMEDY[kind]
51080
+ });
51081
+ }
51082
+ }
51083
+ return out;
51084
+ }
51085
+ function lineOf(code, offset2) {
51086
+ if (typeof offset2 !== "number" || offset2 < 0 || offset2 > code.length) return null;
51087
+ let line = 1;
51088
+ for (let i = 0; i < offset2; i++) {
51089
+ if (code.charCodeAt(i) === 10) line++;
51090
+ }
51091
+ return line;
51092
+ }
51093
+ function edgeDriverBuildError(violations) {
51094
+ const detail = violations.map((v) => ` ${v.file}${v.line ? `:${v.line}` : ""} \u2014 import "${v.specifier}"
51095
+ ${v.remedy}`).join("\n");
51096
+ return new Error(
51097
+ `[vesk] edge-targeted build cannot include a TCP-only driver (${violations.length} found).
51098
+ ${detail}
51099
+
51100
+ This was a build error rather than a runtime one because an edge runtime has no socket: the deployed function would fail on its first query.`
51101
+ );
51102
+ }
51103
+ var SOCKETLESS_PLATFORMS = /* @__PURE__ */ new Set(["edge", "cloudflare", "deno", "coxmos"]);
51104
+ function isSocketlessTarget(platform, target) {
51105
+ if (target === "edge") return true;
51106
+ return typeof platform === "string" && SOCKETLESS_PLATFORMS.has(platform);
51107
+ }
51108
+ var SOURCE_EXTENSIONS = [".vsk", ".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
51109
+ var SKIPPED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".vesk", ".git", "dist", ".next", ".output", "coverage"]);
51110
+ function collectAppSources(dir, out = []) {
51111
+ let entries;
51112
+ try {
51113
+ entries = readdirSync2(dir);
51114
+ } catch {
51115
+ return out;
51116
+ }
51117
+ for (const entry of entries) {
51118
+ if (SKIPPED_DIRS.has(entry) || entry.startsWith(".")) continue;
51119
+ const full = join7(dir, entry);
51120
+ let st;
51121
+ try {
51122
+ st = statSync3(full);
51123
+ } catch {
51124
+ continue;
51125
+ }
51126
+ if (st.isDirectory()) collectAppSources(full, out);
51127
+ else if (st.isFile()) {
51128
+ const dot = entry.lastIndexOf(".");
51129
+ if (dot === -1) continue;
51130
+ if (SOURCE_EXTENSIONS.includes(entry.slice(dot).toLowerCase())) out.push(full);
51131
+ }
51132
+ }
51133
+ return out;
51134
+ }
51135
+ function tcpDriverViolations(appDir) {
51136
+ const files = [];
51137
+ for (const path of collectAppSources(appDir)) {
51138
+ try {
51139
+ files.push({ path, code: readFileSync11(path, "utf-8") });
51140
+ } catch {
51141
+ }
51142
+ }
51143
+ return scanServerOnlyImports(files).filter((v) => v.kind === "tcp-driver");
51144
+ }
51145
+
51146
+ // ../adapter/src/server-only-plugin.ts
51147
+ var STUB_NAMESPACE = "vesk-server-only";
51148
+ var stubCounter = 0;
51149
+ function importedNamesFor(code, specifier) {
51150
+ let ast;
51151
+ try {
51152
+ ast = parse4(code);
51153
+ } catch {
51154
+ return [];
51155
+ }
51156
+ const names = [];
51157
+ const sourceOf = (node) => {
51158
+ const src2 = node.source;
51159
+ if (typeof src2 === "string") return src2;
51160
+ const v = src2?.value;
51161
+ return typeof v === "string" ? v : null;
51162
+ };
51163
+ for (const node of ast.body ?? []) {
51164
+ if (node?.type === "ImportDeclaration") {
51165
+ if (sourceOf(node) !== specifier) continue;
51166
+ for (const spec of node.specifiers ?? []) {
51167
+ if (spec.type === "ImportNamespaceSpecifier") continue;
51168
+ const local = spec.local?.name;
51169
+ if (typeof local === "string" && !names.includes(local)) names.push(local);
51170
+ }
51171
+ continue;
51172
+ }
51173
+ if (node?.type === "ExportAllDeclaration" || node?.type === "ExportNamedDeclaration") {
51174
+ if (sourceOf(node) !== specifier) continue;
51175
+ for (const spec of node.specifiers ?? []) {
51176
+ const imported = spec.imported?.name ?? spec.imported?.value ?? spec.local?.name;
51177
+ if (typeof imported === "string" && !names.includes(imported)) names.push(imported);
51178
+ }
51179
+ }
51180
+ }
51181
+ return names;
51182
+ }
51183
+ function stubFactorySource(specifier) {
51184
+ const template2 = '"$1" comes from "$0", which is server-only. It reached the browser bundle because a component (or a module one imports) imported it \u2014 component code runs in the browser, where this module cannot work. Move the server-only work into an API route (app/api/**/route.ts) or a server action and call it over HTTP, or import the edge/browser-safe entry if the package ships one.';
51185
+ return [
51186
+ "function __vesk_stub(binding) {",
51187
+ " var message = " + JSON.stringify(template2) + ";",
51188
+ ' message = message.replace("$0", ' + JSON.stringify(specifier) + ').replace("$1", String(binding));',
51189
+ " var thrower = function () { throw Object.assign(new Error(message), { __veskServerOnly: " + JSON.stringify(specifier) + " }); };",
51190
+ " return new Proxy(function () {}, {",
51191
+ " get: thrower,",
51192
+ " apply: thrower,",
51193
+ " construct: thrower",
51194
+ " });",
51195
+ "}"
51196
+ ].join("\n");
51197
+ }
51198
+ function referencedAtTopLevel(code, name) {
51199
+ let ast;
51200
+ try {
51201
+ ast = parse4(code);
51202
+ } catch {
51203
+ return true;
51204
+ }
51205
+ let found = false;
51206
+ const FUNCTION_TYPES = /* @__PURE__ */ new Set([
51207
+ "FunctionDeclaration",
51208
+ "FunctionExpression",
51209
+ "ArrowFunctionExpression",
51210
+ "ClassMethod",
51211
+ "ObjectMethod",
51212
+ "ClassDeclaration",
51213
+ "ClassExpression"
51214
+ ]);
51215
+ const SKIP_KEYS = /* @__PURE__ */ new Set(["type", "start", "end", "loc", "range", "raw", "regex"]);
51216
+ const SKIP_EXPORT_NAMED_KEYS = /* @__PURE__ */ new Set([...SKIP_KEYS, "source", "specifiers", "exportKind", "attributes"]);
51217
+ const visit = (node, parentKey, fnDepth) => {
51218
+ if (found || node === null || typeof node !== "object") return;
51219
+ if (Array.isArray(node)) {
51220
+ for (const child of node) visit(child, parentKey, fnDepth);
51221
+ return;
51222
+ }
51223
+ const n = node;
51224
+ if (n.type === "MemberExpression" || n.type === "Property" || n.type === "PropertyDefinition" || n.type === "MethodDefinition") {
51225
+ const prop = n.property ?? n.key;
51226
+ if (prop && typeof prop === "object" && prop.name === name && n.computed !== true) return;
51227
+ }
51228
+ if (n.type === "ImportDeclaration" || n.type === "ExportAllDeclaration" || n.type === "ImportExpression") return;
51229
+ if (n.type === "Identifier" && n.name === name) {
51230
+ if (parentKey === "local" || parentKey === "id" || parentKey === "params" || parentKey === "key") return;
51231
+ if (fnDepth === 0) found = true;
51232
+ return;
51233
+ }
51234
+ const skip = n.type === "ExportNamedDeclaration" ? SKIP_EXPORT_NAMED_KEYS : SKIP_KEYS;
51235
+ const nextDepth = FUNCTION_TYPES.has(String(n.type)) ? fnDepth + 1 : fnDepth;
51236
+ for (const [key, value] of Object.entries(n)) {
51237
+ if (skip.has(key)) continue;
51238
+ visit(value, key, nextDepth);
51239
+ }
51240
+ };
51241
+ visit(ast.body, void 0, 0);
51242
+ return found;
51243
+ }
51244
+ function serverOnlyPlugin(options = {}) {
51245
+ const stubs = /* @__PURE__ */ new Map();
51246
+ return {
51247
+ name: "vesk-server-only",
51248
+ setup(build4) {
51249
+ build4.onResolve({ filter: /.*/ }, (args2) => {
51250
+ const kind = classifySpecifier(args2.path);
51251
+ if (!kind) return null;
51252
+ if (kind === "tcp-driver") {
51253
+ options.onDriver?.({ specifier: args2.path, importer: args2.importer });
51254
+ return null;
51255
+ }
51256
+ let names = [];
51257
+ let importerCode = "";
51258
+ try {
51259
+ importerCode = readFileSync12(args2.importer, "utf-8");
51260
+ names = importedNamesFor(importerCode, args2.path);
51261
+ } catch {
51262
+ }
51263
+ const eager = names.filter((n) => referencedAtTopLevel(importerCode, n));
51264
+ if (eager.length > 0) {
51265
+ options.onEager?.({ specifier: args2.path, bindings: eager, importer: args2.importer });
51266
+ return null;
51267
+ }
51268
+ const id = `vesk-stub-${stubCounter++}`;
51269
+ stubs.set(id, [
51270
+ stubFactorySource(args2.path),
51271
+ 'export default __vesk_stub("default");',
51272
+ ...names.map((n) => `export const ${n} = __vesk_stub(${JSON.stringify(n)});`)
51273
+ ].join("\n"));
51274
+ for (const binding of names) {
51275
+ options.onStub?.({ specifier: args2.path, binding, importer: args2.importer });
51276
+ }
51277
+ return { path: id, namespace: STUB_NAMESPACE };
51278
+ });
51279
+ build4.onLoad({ filter: /.*/, namespace: STUB_NAMESPACE }, (args2) => ({
51280
+ contents: stubs.get(args2.path) ?? stubFactorySource("unknown"),
51281
+ loader: "js"
51282
+ }));
51283
+ }
51284
+ };
51285
+ }
51286
+
51287
+ // ../adapter/src/client-bundle.ts
51027
51288
  import { availableParallelism } from "node:os";
51028
51289
  async function mapWithConcurrency(items, limit, fn) {
51029
51290
  const out = new Array(items.length);
@@ -51051,7 +51312,7 @@ async function mapWithConcurrency(items, limit, fn) {
51051
51312
  var __dirname3 = dirname8(fileURLToPath2(import.meta.url));
51052
51313
  function fileUnchanged(filePath, cached) {
51053
51314
  try {
51054
- const st = statSync3(filePath);
51315
+ const st = statSync4(filePath);
51055
51316
  return st.mtimeMs === cached.mtimeMs && st.size === cached.size;
51056
51317
  } catch {
51057
51318
  return false;
@@ -51072,8 +51333,8 @@ function findRuntimeSrc2(appDir) {
51072
51333
  resolve10(appDir, "node_modules", "@vesk/runtime")
51073
51334
  ];
51074
51335
  for (const base of candidates) {
51075
- for (const dir of [base, join7(base, "dist")]) {
51076
- if (existsSync11(join7(dir, "index-client.js"))) return dir;
51336
+ for (const dir of [base, join8(base, "dist")]) {
51337
+ if (existsSync11(join8(dir, "index-client.js"))) return dir;
51077
51338
  }
51078
51339
  }
51079
51340
  throw new Error('@vesk/runtime/dist not found \u2014 run "npm run build" first');
@@ -51179,6 +51440,17 @@ function nativeLibraryImportStubs(code) {
51179
51440
  });
51180
51441
  return lines.join("\n") + "\n\n";
51181
51442
  }
51443
+ function reportServerOnlyImports(chunkName, hits, strict) {
51444
+ const detail = [...new Set(hits.map((h) => `"${h.binding}" from "${h.specifier}"`))].join(", ");
51445
+ if (strict) {
51446
+ throw new Error(
51447
+ `[vesk] ${chunkName} imports a server-only package in client code: ${detail}. Move that work into an API route (app/api/**/route.ts) or a server action. Pass without --strict to allow it (the binding is replaced by a throwing stub).`
51448
+ );
51449
+ }
51450
+ console.error(
51451
+ `[vesk] ${chunkName}: removed server-only import from client code (${detail}). It is replaced by a stub that throws if the component calls it at runtime \u2014 server-only work belongs in an API route or a server action.`
51452
+ );
51453
+ }
51182
51454
  function demoteExports(code) {
51183
51455
  let ast;
51184
51456
  try {
@@ -51209,7 +51481,7 @@ function chunkHasImports(headLen, mergeAborted) {
51209
51481
  function runtimeImportsOf(filePath) {
51210
51482
  let text;
51211
51483
  try {
51212
- text = readFileSync11(filePath, "utf8");
51484
+ text = readFileSync13(filePath, "utf8");
51213
51485
  } catch {
51214
51486
  return [];
51215
51487
  }
@@ -51502,11 +51774,11 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
51502
51774
  return removeCompiledNodes(code, isVskImport);
51503
51775
  }
51504
51776
  function resolveVskImports(filePath, compile) {
51505
- const src2 = readFileSync11(filePath, "utf-8");
51777
+ const src2 = readFileSync13(filePath, "utf-8");
51506
51778
  const resolved = [];
51507
51779
  for (const importPath of collectVskImportPaths(vskImportLines(src2), filePath)) {
51508
51780
  try {
51509
- readFileSync11(importPath);
51781
+ readFileSync13(importPath);
51510
51782
  } catch {
51511
51783
  continue;
51512
51784
  }
@@ -51564,7 +51836,7 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
51564
51836
  compiledFiles++;
51565
51837
  __stats.compiled++;
51566
51838
  __stats.distinct.add(filePath);
51567
- let src2 = readFileSync11(filePath, "utf-8");
51839
+ let src2 = readFileSync13(filePath, "utf-8");
51568
51840
  if (/content=["'][^"']*\.md["']/i.test(src2)) {
51569
51841
  src2 = inlineMdContentAttrs(src2, dirname8(filePath), guessProjectRoots(appDir));
51570
51842
  }
@@ -51599,7 +51871,7 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
51599
51871
  }
51600
51872
  for (const reexportPath of reexportPaths || []) compileFile2(reexportPath, null, output, imports);
51601
51873
  if (cache2 && namesBefore) {
51602
- const st = statSync3(filePath);
51874
+ const st = statSync4(filePath);
51603
51875
  cache2.files.set(filePath, {
51604
51876
  mtimeMs: st.mtimeMs,
51605
51877
  size: st.size,
@@ -51725,9 +51997,9 @@ ${body}
51725
51997
  let sharedBundleCode = "";
51726
51998
  const sharedRuntimeNames = /* @__PURE__ */ new Set();
51727
51999
  if (sharedSources.length > 0) {
51728
- const tmpBase = mkdtempSync(join7(resolve10(appDir, ".."), "tmp-vesk-shared-"));
52000
+ const tmpBase = mkdtempSync(join8(resolve10(appDir, ".."), "tmp-vesk-shared-"));
51729
52001
  try {
51730
- const sharedEntry = join7(tmpBase, "shared-entry.js");
52002
+ const sharedEntry = join8(tmpBase, "shared-entry.js");
51731
52003
  const lines = [];
51732
52004
  const members = [];
51733
52005
  sharedSources.forEach((source, i) => {
@@ -51737,7 +52009,7 @@ ${body}
51737
52009
  lines.push(`globalThis.__veskShared = { ${members.join("\n")} };`);
51738
52010
  writeFileSync4(sharedEntry, lines.join("\n"));
51739
52011
  const appTsconfig = findTsconfigPath(appDir);
51740
- const runtimeShim = join7(tmpBase, "runtime-shim.js");
52012
+ const runtimeShim = join8(tmpBase, "runtime-shim.js");
51741
52013
  const runtimeLines = [
51742
52014
  "// ONE runtime instance: the entry bundle publishes these on globalThis,",
51743
52015
  "// and route chunks import the same functions. A second bundled copy",
@@ -51777,7 +52049,7 @@ ${body}
51777
52049
  bindings.named.forEach((n) => named.add(n));
51778
52050
  hasDefault = hasDefault || bindings.hasDefault;
51779
52051
  }
51780
- const shim = join7(tmpBase, `shim-${i}.js`);
52052
+ const shim = join8(tmpBase, `shim-${i}.js`);
51781
52053
  const shimLines = [`const m = globalThis.__veskShared[${JSON.stringify(source)}];`];
51782
52054
  if (hasDefault) shimLines.push(`export default m;`);
51783
52055
  for (const name of [...named].sort()) {
@@ -51805,13 +52077,21 @@ ${body}
51805
52077
  if (!entry.code.trim()) return null;
51806
52078
  let finalCode;
51807
52079
  if (entry.imports) {
51808
- const tmpBase = mkdtempSync(join7(resolve10(appDir, ".."), "tmp-vesk-chunk-"));
51809
- const tmpFile = join7(tmpBase, "entry.js");
52080
+ const tmpBase = mkdtempSync(join8(resolve10(appDir, ".."), "tmp-vesk-chunk-"));
52081
+ const tmpFile = join8(tmpBase, "entry.js");
51810
52082
  const toBundle = `const __components = globalThis.__components || (globalThis.__components = {});
51811
52083
  const __hydrators = globalThis.__hydrators || (globalThis.__hydrators = {});
51812
52084
  ${entry.code}
51813
52085
  `;
51814
52086
  writeFileSync4(tmpFile, toBundle);
52087
+ const serverOnlyHits = [];
52088
+ const driverHits = [];
52089
+ const eagerHits = [];
52090
+ const serverOnlyGuard = serverOnlyPlugin({
52091
+ onStub: (hit) => serverOnlyHits.push(hit),
52092
+ onDriver: (hit) => driverHits.push(hit),
52093
+ onEager: (hit) => eagerHits.push(hit)
52094
+ });
51815
52095
  try {
51816
52096
  const appTsconfig = findTsconfigPath(appDir);
51817
52097
  const result = await build({
@@ -51835,7 +52115,7 @@ ${entry.code}
51835
52115
  // shared-modules.js serves every route chunk. (esbuild's `alias`
51836
52116
  // option only accepts bare package names, so this is a resolver
51837
52117
  // rather than a map.)
51838
- ...sharedRedirectPlugin ? { plugins: [sharedRedirectPlugin] } : {},
52118
+ ...sharedRedirectPlugin ? { plugins: [sharedRedirectPlugin, serverOnlyGuard] } : { plugins: [serverOnlyGuard] },
51839
52119
  ...appTsconfig ? { tsconfig: appTsconfig } : {}
51840
52120
  });
51841
52121
  finalCode = result.outputFiles[0].text;
@@ -51857,6 +52137,24 @@ ${entry.code}
51857
52137
  } catch {
51858
52138
  }
51859
52139
  }
52140
+ if (eagerHits.length > 0) {
52141
+ const detail = eagerHits.map((h) => `${h.importer} uses ${h.bindings.map((b) => `"${b}"`).join(", ")} from "${h.specifier}" at module scope`).join("; ");
52142
+ console.error("[vesk] server-only package used at module scope in client code", entry.name + ":", detail);
52143
+ throw new Error(
52144
+ `[vesk] ${entry.name}: ${detail}.
52145
+ A module-scope statement runs the moment the browser evaluates the chunk, so a server-only package cannot be substituted there. Move that work into an API route (app/api/**/route.ts) or a server action \u2014 if the binding is only used from inside a function, this build already handles it.`
52146
+ );
52147
+ }
52148
+ if (driverHits.length > 0) {
52149
+ const detail = [...new Set(driverHits.map((h) => `${h.specifier} (from ${h.importer})`))].join(", ");
52150
+ console.error("[vesk] chunk bundle contains a TCP-only driver", entry.name + ":", detail);
52151
+ throw new Error(
52152
+ `[vesk] ${entry.name} pulls a TCP-only driver into the browser bundle: ${detail}. A browser cannot open a socket. Import the package's edge/browser-safe entry if it ships one, or keep database access in an API route (app/api/**/route.ts) or a server action.`
52153
+ );
52154
+ }
52155
+ if (serverOnlyHits.length > 0) {
52156
+ reportServerOnlyImports(entry.name, serverOnlyHits, options?.strict);
52157
+ }
51860
52158
  } else {
51861
52159
  finalCode = chunkIIFE(demoteExports(entry.code));
51862
52160
  }
@@ -51891,7 +52189,7 @@ ${entry.code}
51891
52189
  let compileFileMono2 = function(filePath, resolvedName) {
51892
52190
  if (seen.has(filePath)) return;
51893
52191
  seen.add(filePath);
51894
- const src2 = readFileSync11(filePath, "utf-8");
52192
+ const src2 = readFileSync13(filePath, "utf-8");
51895
52193
  resolveVskImports(filePath, (p, n) => compileFileMono2(p, n || ""));
51896
52194
  for (const cn of vskComponentNames(src2, filePath)) componentOwners.claim(cn, filePath);
51897
52195
  const monoAlloc = nameAllocFor(filePath);
@@ -51973,9 +52271,9 @@ function buildRuntimeCode(runtimeDir) {
51973
52271
  ];
51974
52272
  let code = "";
51975
52273
  for (const f of runtimeFiles) {
51976
- const p = join7(runtimeDir, f);
52274
+ const p = join8(runtimeDir, f);
51977
52275
  if (existsSync11(p)) {
51978
- let src2 = readFileSync11(p, "utf-8");
52276
+ let src2 = readFileSync13(p, "utf-8");
51979
52277
  src2 = stripTypes(src2);
51980
52278
  src2 = src2.replace(/^import\s+[\s\S]*?from\s+['"](?:\.\/.*?|@vesk\/runtime\/src\/.*?)['"];?\n?/gm, "");
51981
52279
  src2 = src2.replace(/^import\s+['"](?:\.\/.*?|@vesk\/runtime\/src\/.*?)['"];?\n?/gm, "");
@@ -51987,7 +52285,7 @@ ${src2}
51987
52285
  `;
51988
52286
  }
51989
52287
  }
51990
- const indexSrc = readFileSync11(join7(runtimeDir, "index-client.js"), "utf-8");
52288
+ const indexSrc = readFileSync13(join8(runtimeDir, "index-client.js"), "utf-8");
51991
52289
  const exportNames = stripTypes(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())) || [];
51992
52290
  code += "// --- exports ---\n";
51993
52291
  for (const name of [...new Set(exportNames)]) {
@@ -51997,7 +52295,7 @@ ${src2}
51997
52295
  return code;
51998
52296
  }
51999
52297
  function runtimeExportNames(runtimeDir) {
52000
- const indexSrc = readFileSync11(join7(runtimeDir, "index-client.js"), "utf-8");
52298
+ const indexSrc = readFileSync13(join8(runtimeDir, "index-client.js"), "utf-8");
52001
52299
  const names = /* @__PURE__ */ new Set();
52002
52300
  for (const m of indexSrc.matchAll(/export\s*\{([^}]+)\}\s*from/g)) {
52003
52301
  for (const raw2 of m[1].split(",")) {
@@ -52012,7 +52310,7 @@ function esbuildPath(p) {
52012
52310
  return sep === "/" ? p : p.split(sep).join("/");
52013
52311
  }
52014
52312
  function runtimeTreeShakeEntry() {
52015
- return join7(tmpdir(), "vesk-runtime-tree-shake", RUNTIME_ENTRY);
52313
+ return join8(tmpdir(), "vesk-runtime-tree-shake", RUNTIME_ENTRY);
52016
52314
  }
52017
52315
  var treeShakeQueue = Promise.resolve();
52018
52316
  function buildTreeShakenRuntime(runtimeDir, usedNames) {
@@ -52035,7 +52333,7 @@ async function buildTreeShakenRuntimeNow(runtimeDir, usedNames) {
52035
52333
  async function bundleRuntimeNames(runtimeDir, names, strict = false) {
52036
52334
  if (names.length === 0) return null;
52037
52335
  const entry = runtimeTreeShakeEntry();
52038
- const indexClient = esbuildPath(join7(runtimeDir, "index-client.js"));
52336
+ const indexClient = esbuildPath(join8(runtimeDir, "index-client.js"));
52039
52337
  const unique = [...new Set(names)];
52040
52338
  try {
52041
52339
  try {
@@ -52249,19 +52547,19 @@ function generateManifest(routes, ssrRoutes, apiRoutes, staticRoutes, middleware
52249
52547
 
52250
52548
  // ../adapter/src/static.ts
52251
52549
  init_paths();
52252
- import { mkdirSync as mkdirSync4, copyFileSync, readdirSync as readdirSync2, statSync as statSync5, existsSync as existsSync13, writeFileSync as writeFileSync5, readFileSync as readFileSync13 } from "node:fs";
52253
- import { resolve as resolve12, join as join8 } from "node:path";
52550
+ import { mkdirSync as mkdirSync4, copyFileSync, readdirSync as readdirSync3, statSync as statSync6, existsSync as existsSync13, writeFileSync as writeFileSync5, readFileSync as readFileSync15 } from "node:fs";
52551
+ import { resolve as resolve12, join as join9 } from "node:path";
52254
52552
  function copyStaticAssets(publicDir, outDir) {
52255
52553
  const targetDir = resolve12(outDir, "static", "public");
52256
52554
  mkdirSync4(targetDir, { recursive: true });
52257
52555
  if (!existsSync13(publicDir)) return;
52258
52556
  function copyDir(src2, dest) {
52259
52557
  mkdirSync4(dest, { recursive: true });
52260
- const entries = readdirSync2(src2);
52558
+ const entries = readdirSync3(src2);
52261
52559
  for (const entry of entries) {
52262
- const srcPath = join8(src2, entry);
52263
- const destPath = join8(dest, entry);
52264
- const st = statSync5(srcPath);
52560
+ const srcPath = join9(src2, entry);
52561
+ const destPath = join9(dest, entry);
52562
+ const st = statSync6(srcPath);
52265
52563
  if (st.isDirectory()) {
52266
52564
  copyDir(srcPath, destPath);
52267
52565
  } else {
@@ -52273,7 +52571,7 @@ function copyStaticAssets(publicDir, outDir) {
52273
52571
  }
52274
52572
 
52275
52573
  // ../adapter/src/prod-server.ts
52276
- import { readFileSync as readFileSync16, existsSync as existsSync16, statSync as statSync7 } from "node:fs";
52574
+ import { readFileSync as readFileSync18, existsSync as existsSync16, statSync as statSync8 } from "node:fs";
52277
52575
  import { resolve as resolve14, dirname as dirname11, basename } from "node:path";
52278
52576
  import { createServer } from "node:http";
52279
52577
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -52313,13 +52611,13 @@ async function reportServerError(err, options) {
52313
52611
  init_paths();
52314
52612
 
52315
52613
  // ../adapter/src/load-config.ts
52316
- import { existsSync as existsSync14, readFileSync as readFileSync14, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5 } from "node:fs";
52317
- import { join as join9, dirname as dirname9 } from "node:path";
52614
+ import { existsSync as existsSync14, readFileSync as readFileSync16, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5 } from "node:fs";
52615
+ import { join as join10, dirname as dirname9 } from "node:path";
52318
52616
  import { pathToFileURL as pathToFileURL2 } from "node:url";
52319
52617
  import { createRequire as createRequire3 } from "node:module";
52320
52618
  async function loadVeskConfig2(projectDir) {
52321
- const jsPath = join9(projectDir, "vesk.config.js");
52322
- const tsPath = join9(projectDir, "vesk.config.ts");
52619
+ const jsPath = join10(projectDir, "vesk.config.js");
52620
+ const tsPath = join10(projectDir, "vesk.config.ts");
52323
52621
  let configPath2 = null;
52324
52622
  if (existsSync14(jsPath)) configPath2 = jsPath;
52325
52623
  else if (existsSync14(tsPath)) configPath2 = tsPath;
@@ -52327,10 +52625,10 @@ async function loadVeskConfig2(projectDir) {
52327
52625
  let raw2;
52328
52626
  if (configPath2.endsWith(".ts")) {
52329
52627
  const { transpile } = await import("typescript");
52330
- const src2 = readFileSync14(configPath2, "utf-8");
52628
+ const src2 = readFileSync16(configPath2, "utf-8");
52331
52629
  let js = transpile(src2, { module: 99, target: 99 });
52332
52630
  const inject = { defineConfig, definePlugin, preset };
52333
- const projectRequire = createRequire3(join9(projectDir, "package.json"));
52631
+ const projectRequire = createRequire3(join10(projectDir, "package.json"));
52334
52632
  const importRe = /import\s+(?:(?:\*\s*as\s+([\w$]+))|([\w$]+(?:\s*,\s*\{[^}]*\})?)|(\{[^}]*\}))\s+from\s+['"]([^'"]+)['"]\s*;?/g;
52335
52633
  let m;
52336
52634
  while ((m = importRe.exec(js)) !== null) {
@@ -52357,7 +52655,7 @@ async function loadVeskConfig2(projectDir) {
52357
52655
  const injectKeys = Object.keys(inject);
52358
52656
  js = `const {${injectKeys.join(",")}} = globalThis.__vesk_inject;
52359
52657
  ` + js;
52360
- const tmpFile = join9(projectDir, ".vesk", "config.loader.tmp.mjs");
52658
+ const tmpFile = join10(projectDir, ".vesk", "config.loader.tmp.mjs");
52361
52659
  mkdirSync5(dirname9(tmpFile), { recursive: true });
52362
52660
  writeFileSync6(tmpFile, js, "utf-8");
52363
52661
  globalThis.__vesk_inject = inject;
@@ -52783,7 +53081,7 @@ async function startProdServer(outDir, options) {
52783
53081
  console.error('Run "vesk build" first');
52784
53082
  process.exit(1);
52785
53083
  }
52786
- const buildConfig = JSON.parse(readFileSync16(configPath2, "utf-8"));
53084
+ const buildConfig = JSON.parse(readFileSync18(configPath2, "utf-8"));
52787
53085
  const bakedHeadExtra = buildConfig.headExtra || "";
52788
53086
  console.error(`vesk start: serving from ${outDir}`);
52789
53087
  const projectDir = resolve14(outDir, "..");
@@ -52959,9 +53257,9 @@ async function startProdServer(outDir, options) {
52959
53257
  });
52960
53258
  const publicDir = resolve14(staticDir, "public");
52961
53259
  const rootFile = url.pathname.length > 1 ? resolveWithin(publicDir, url.pathname.slice(1)) : null;
52962
- if (rootFile && existsSync16(rootFile) && statSync7(rootFile).isFile()) {
53260
+ if (rootFile && existsSync16(rootFile) && statSync8(rootFile).isFile()) {
52963
53261
  res.writeHead(200, { "Content-Type": mimeFor(rootFile) });
52964
- res.end(readFileSync16(rootFile));
53262
+ res.end(readFileSync18(rootFile));
52965
53263
  return;
52966
53264
  }
52967
53265
  if (url.pathname === "/ssr-data.js") {
@@ -52993,7 +53291,7 @@ async function startProdServer(outDir, options) {
52993
53291
  "Content-Type": "application/javascript",
52994
53292
  "Cache-Control": cacheControlFor(clientFile, false)
52995
53293
  });
52996
- res.end(readFileSync16(clientPath));
53294
+ res.end(readFileSync18(clientPath));
52997
53295
  return;
52998
53296
  }
52999
53297
  }
@@ -53005,7 +53303,7 @@ async function startProdServer(outDir, options) {
53005
53303
  res.end("Forbidden");
53006
53304
  return;
53007
53305
  }
53008
- if (existsSync16(staticPath) && statSync7(staticPath).isFile()) {
53306
+ if (existsSync16(staticPath) && statSync8(staticPath).isFile()) {
53009
53307
  res.writeHead(200, {
53010
53308
  "Content-Type": mimeFor(staticPath),
53011
53309
  // A content-hashed name can never change meaning, so it is immutable
@@ -53013,7 +53311,7 @@ async function startProdServer(outDir, options) {
53013
53311
  // serve stale JS forever.
53014
53312
  "Cache-Control": cacheControlFor(basename(staticPath), false)
53015
53313
  });
53016
- res.end(readFileSync16(staticPath));
53314
+ res.end(readFileSync18(staticPath));
53017
53315
  return;
53018
53316
  }
53019
53317
  }
@@ -53023,7 +53321,7 @@ async function startProdServer(outDir, options) {
53023
53321
  const htmlPath = resolve14(outDir, prerendered.file);
53024
53322
  if (existsSync16(htmlPath)) {
53025
53323
  res.writeHead(200, { "Content-Type": "text/html" });
53026
- res.end(readFileSync16(htmlPath));
53324
+ res.end(readFileSync18(htmlPath));
53027
53325
  return;
53028
53326
  }
53029
53327
  }
@@ -53138,7 +53436,7 @@ async function startProdServer(outDir, options) {
53138
53436
  try {
53139
53437
  const runtimePath = resolve14(outDir, "server", "runtime.js");
53140
53438
  const { renderFullPage: renderFullPage2, storeDataScriptGlobal } = await import(runtimePath);
53141
- const src2 = readFileSync16(nfPath, "utf-8");
53439
+ const src2 = readFileSync18(nfPath, "utf-8");
53142
53440
  const compName = resolveComponentName(src2) || "NotFound";
53143
53441
  notFoundHtml = await renderFullPage2(src2, compName, { params: {}, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: pageCssUrls, security: securityConfig?.security || {}, externalDataScript: storeDataScriptGlobal, sourcePath: nfPath, headExtra: bakedHeadExtra });
53144
53442
  } catch {
@@ -53218,7 +53516,7 @@ async function startProdServer(outDir, options) {
53218
53516
  try {
53219
53517
  const runtimePath = resolve14(outDir, "server", "runtime.js");
53220
53518
  const { renderFullPage: renderFullPage2, storeDataScriptGlobal } = await import(runtimePath);
53221
- const src2 = readFileSync16(errPath, "utf-8");
53519
+ const src2 = readFileSync18(errPath, "utf-8");
53222
53520
  const compName = resolveComponentName(src2) || "Error";
53223
53521
  const expose = process.env.NODE_ENV !== "production";
53224
53522
  errorHtml = await renderFullPage2(src2, compName, { error: expose ? err.message : "Internal Server Error", stack: expose ? err.stack : "", statusCode: 500, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: pageCssUrls, clientScriptUrl: buildConfig?.assets?.client?.url || "/_vesk/static/client.js", clientScriptIntegrity: buildConfig?.assets?.client?.integrity, security: securityConfig?.security || {}, externalDataScript: storeDataScriptGlobal, sourcePath: errPath, headExtra: bakedHeadExtra });
@@ -53303,7 +53601,7 @@ function findRouteConflicts(routeTree, appDir) {
53303
53601
  const walk9 = (nodes) => {
53304
53602
  for (const node of nodes) {
53305
53603
  if (node.page) {
53306
- const pageFile = join15(node.sourceDir, "page.vsk");
53604
+ const pageFile = join16(node.sourceDir, "page.vsk");
53307
53605
  const files = byPath.get(node.fullPath) ?? [];
53308
53606
  files.push(relative4(projectRoot, pageFile));
53309
53607
  byPath.set(node.fullPath, files);
@@ -53412,6 +53710,11 @@ async function build2(appDir, options) {
53412
53710
  if (pluginHeadExtra)
53413
53711
  console.error("vesk build: baked plugin head \u2192 config.json + SSR functions");
53414
53712
  console.error(`vesk build: output \u2192 ${outDir}`);
53713
+ if (isSocketlessTarget(options?.platform, options?.target)) {
53714
+ const driverHits = tcpDriverViolations(appDir);
53715
+ if (driverHits.length > 0)
53716
+ throw edgeDriverBuildError(driverHits);
53717
+ }
53415
53718
  const dirs = [
53416
53719
  resolve21(outDir, "server", "functions"),
53417
53720
  resolve21(outDir, "server", "api"),
@@ -53423,7 +53726,7 @@ async function build2(appDir, options) {
53423
53726
  markPhase("config+dirs");
53424
53727
  const cssSourcePath = resolveUserCssPath(appDir);
53425
53728
  if (cssSourcePath !== null) {
53426
- const cssContent = readFileSync21(cssSourcePath, "utf-8");
53729
+ const cssContent = readFileSync23(cssSourcePath, "utf-8");
53427
53730
  const cssTarget = resolve21(outDir, "static", "global.css");
53428
53731
  const tailwindActive = isTailwindPlugin(pluginsPipelines);
53429
53732
  let finalCss = cssContent;
@@ -53516,7 +53819,7 @@ async function build2(appDir, options) {
53516
53819
  const mwChain2 = collectMiddlewareChain2(routeTree, node.fullPath, appDir);
53517
53820
  let mwCode = null;
53518
53821
  if (mwChain2.length > 0) {
53519
- const mwSources = mwChain2.map((m) => readFileSync21(m.sourcePath, "utf-8"));
53822
+ const mwSources = mwChain2.map((m) => readFileSync23(m.sourcePath, "utf-8"));
53520
53823
  mwCode = compileMiddlewareCode(mwSources);
53521
53824
  }
53522
53825
  const ssrAncestorLayouts = isStandalone ? [] : ancestorLayouts;
@@ -53524,14 +53827,14 @@ async function build2(appDir, options) {
53524
53827
  writeFileSync12(funcPath, funcCode, "utf-8");
53525
53828
  const pagePath = resolve21(appDir, node.sourceDir, "page.vsk");
53526
53829
  if (existsSync22(pagePath)) {
53527
- const src2 = readFileSync21(pagePath, "utf-8");
53830
+ const src2 = readFileSync23(pagePath, "utf-8");
53528
53831
  const actionIds = collectActionIds(src2);
53529
53832
  if (node.layout) {
53530
- const layoutSrc = readFileSync21(resolve21(appDir, node.sourceDir, "layout.vsk"), "utf-8");
53833
+ const layoutSrc = readFileSync23(resolve21(appDir, node.sourceDir, "layout.vsk"), "utf-8");
53531
53834
  actionIds.push(...collectActionIds(layoutSrc));
53532
53835
  }
53533
53836
  for (const a of ssrAncestorLayouts) {
53534
- const ancestorSrc = readFileSync21(resolve21(appDir, a.sourceDir, "layout.vsk"), "utf-8");
53837
+ const ancestorSrc = readFileSync23(resolve21(appDir, a.sourceDir, "layout.vsk"), "utf-8");
53535
53838
  actionIds.push(...collectActionIds(ancestorSrc));
53536
53839
  }
53537
53840
  for (const id of actionIds) {
@@ -53624,7 +53927,7 @@ async function build2(appDir, options) {
53624
53927
  const manifest = generateManifest(routeTree, ssrRoutes, apiRoutes, prerenderedRoutes, middlewareEnabled, actionMap, pluginHeadExtra, hasEvents);
53625
53928
  const buildId3 = emittedAssets.map((a) => a.hash).join("-");
53626
53929
  manifest.buildId = buildId3.slice(0, 32);
53627
- manifest.veskVersion = JSON.parse(readFileSync21(join15(PACKAGES_DIR_SELF(), "package.json"), "utf-8")).version;
53930
+ manifest.veskVersion = JSON.parse(readFileSync23(join16(PACKAGES_DIR_SELF(), "package.json"), "utf-8")).version;
53628
53931
  manifest.assets = {
53629
53932
  hashed,
53630
53933
  client: { file: clientFileName, url: clientUrl, hash: clientAsset.hash, bytes: clientAsset.bytes, integrity: clientAsset.integrity },
@@ -53678,9 +53981,9 @@ vesk build: done (${outDir})`);
53678
53981
  init_seo_audit();
53679
53982
 
53680
53983
  // src/dev-server.ts
53681
- import { readFileSync as readFileSync38, watch, statSync as statSync21, existsSync as existsSync42, mkdirSync as mkdirSync19, readdirSync as readdirSync13, writeFileSync as writeFileSync21, renameSync as renameSync2 } from "node:fs";
53984
+ import { readFileSync as readFileSync40, watch, statSync as statSync22, existsSync as existsSync42, mkdirSync as mkdirSync19, readdirSync as readdirSync14, writeFileSync as writeFileSync21, renameSync as renameSync2 } from "node:fs";
53682
53985
  import { createHash as createHash3 } from "node:crypto";
53683
- import { resolve as resolve38, extname as extname7, join as join26, dirname as dirname26 } from "node:path";
53986
+ import { resolve as resolve38, extname as extname7, join as join27, dirname as dirname26 } from "node:path";
53684
53987
  import { createServer as createServer2 } from "node:http";
53685
53988
  import { WebSocketServer as WebSocketServer2 } from "ws";
53686
53989
 
@@ -56569,8 +56872,8 @@ init_parser();
56569
56872
  init_tokens();
56570
56873
  init_scan();
56571
56874
  init_strip_ts();
56572
- import { readdirSync as readdirSync7, statSync as statSync12, existsSync as existsSync23, readFileSync as readFileSync22 } from "fs";
56573
- import { join as join16, relative as relative5, basename as basename4 } from "path";
56875
+ import { readdirSync as readdirSync8, statSync as statSync13, existsSync as existsSync23, readFileSync as readFileSync24 } from "fs";
56876
+ import { join as join17, relative as relative5, basename as basename4 } from "path";
56574
56877
  function collapseSlashes2(p) {
56575
56878
  let out = "";
56576
56879
  let prevSlash = false;
@@ -56590,7 +56893,7 @@ function isStandaloneLayoutFile(layoutPath) {
56590
56893
  try {
56591
56894
  if (!existsSync23(layoutPath))
56592
56895
  return false;
56593
- const src2 = readFileSync22(layoutPath, "utf-8");
56896
+ const src2 = readFileSync24(layoutPath, "utf-8");
56594
56897
  if (!src2.includes("standalone"))
56595
56898
  return false;
56596
56899
  try {
@@ -56668,15 +56971,15 @@ function scanComponents(componentsDir) {
56668
56971
  function walk9(dir, prefix) {
56669
56972
  let entries;
56670
56973
  try {
56671
- entries = readdirSync7(dir);
56974
+ entries = readdirSync8(dir);
56672
56975
  } catch {
56673
56976
  return;
56674
56977
  }
56675
56978
  for (const entry of entries) {
56676
- const full = join16(dir, entry);
56979
+ const full = join17(dir, entry);
56677
56980
  let stat;
56678
56981
  try {
56679
- stat = statSync12(full);
56982
+ stat = statSync13(full);
56680
56983
  } catch {
56681
56984
  continue;
56682
56985
  }
@@ -56699,7 +57002,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
56699
57002
  const nodes = [];
56700
57003
  let entries;
56701
57004
  try {
56702
- entries = readdirSync7(dir);
57005
+ entries = readdirSync8(dir);
56703
57006
  } catch {
56704
57007
  return nodes;
56705
57008
  }
@@ -56774,7 +57077,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
56774
57077
  seg = segName;
56775
57078
  }
56776
57079
  const fullPath = seg ? (parentPath === "/" ? "/" : parentPath + "/") + seg : parentPath || "/";
56777
- const isStandalone = hasLayout ? isStandaloneLayoutFile(join16(dir, "layout.vsk")) : false;
57080
+ const isStandalone = hasLayout ? isStandaloneLayoutFile(join17(dir, "layout.vsk")) : false;
56778
57081
  const node = {
56779
57082
  path: seg,
56780
57083
  fullPath: collapseSlashes2(fullPath) || "/",
@@ -56795,10 +57098,10 @@ function scanDirectory(rootDir, dir, parentPath, options) {
56795
57098
  standalone: isStandalone ? true : void 0
56796
57099
  };
56797
57100
  for (const entry of entries) {
56798
- const entryPath = join16(dir, entry);
57101
+ const entryPath = join17(dir, entry);
56799
57102
  let entryStat;
56800
57103
  try {
56801
- entryStat = statSync12(entryPath);
57104
+ entryStat = statSync13(entryPath);
56802
57105
  } catch {
56803
57106
  continue;
56804
57107
  }
@@ -56847,19 +57150,19 @@ function collectSources(tree) {
56847
57150
  function walk9(nodes) {
56848
57151
  for (const node of nodes) {
56849
57152
  if (node.page)
56850
- map.set(node.page, join16(node.sourceDir, "page.vsk"));
57153
+ map.set(node.page, join17(node.sourceDir, "page.vsk"));
56851
57154
  if (node.layout)
56852
- map.set(node.layout, join16(node.sourceDir, "layout.vsk"));
57155
+ map.set(node.layout, join17(node.sourceDir, "layout.vsk"));
56853
57156
  if (node.loading)
56854
- map.set(node.loading, join16(node.sourceDir, "loading.vsk"));
57157
+ map.set(node.loading, join17(node.sourceDir, "loading.vsk"));
56855
57158
  if (node.error)
56856
- map.set(node.error, join16(node.sourceDir, "error.vsk"));
57159
+ map.set(node.error, join17(node.sourceDir, "error.vsk"));
56857
57160
  if (node.notFound)
56858
- map.set(node.notFound, join16(node.sourceDir, "not-found.vsk"));
57161
+ map.set(node.notFound, join17(node.sourceDir, "not-found.vsk"));
56859
57162
  if (node.offline)
56860
- map.set(node.offline, join16(node.sourceDir, "offline.vsk"));
57163
+ map.set(node.offline, join17(node.sourceDir, "offline.vsk"));
56861
57164
  if (node.network)
56862
- map.set(node.network, join16(node.sourceDir, "network.vsk"));
57165
+ map.set(node.network, join17(node.sourceDir, "network.vsk"));
56863
57166
  walk9(node.children);
56864
57167
  }
56865
57168
  }
@@ -56979,8 +57282,8 @@ function matchUrl(tree, pathname) {
56979
57282
  }
56980
57283
 
56981
57284
  // ../compiler/dist/api-routes.js
56982
- import { readdirSync as readdirSync8, statSync as statSync13, existsSync as existsSync24 } from "fs";
56983
- import { join as join17 } from "path";
57285
+ import { readdirSync as readdirSync9, statSync as statSync14, existsSync as existsSync24 } from "fs";
57286
+ import { join as join18 } from "path";
56984
57287
  init_server_utils();
56985
57288
  function basename5(p) {
56986
57289
  const idx = p.lastIndexOf("/");
@@ -56995,7 +57298,7 @@ function scanApiDir(rootDir, dir, parentPath) {
56995
57298
  const nodes = [];
56996
57299
  let entries;
56997
57300
  try {
56998
- entries = readdirSync8(dir);
57301
+ entries = readdirSync9(dir);
56999
57302
  } catch {
57000
57303
  return nodes;
57001
57304
  }
@@ -57017,10 +57320,10 @@ function scanApiDir(rootDir, dir, parentPath) {
57017
57320
  return nodes;
57018
57321
  if (isRouteGroup) {
57019
57322
  for (const entry of entries) {
57020
- const entryPath = join17(dir, entry);
57323
+ const entryPath = join18(dir, entry);
57021
57324
  let entryStat;
57022
57325
  try {
57023
- entryStat = statSync13(entryPath);
57326
+ entryStat = statSync14(entryPath);
57024
57327
  } catch {
57025
57328
  continue;
57026
57329
  }
@@ -57047,14 +57350,14 @@ function scanApiDir(rootDir, dir, parentPath) {
57047
57350
  fullPath: collapseSlashes(fullPath) || "/",
57048
57351
  isDynamic,
57049
57352
  isCatchAll,
57050
- filePath: hasRoute && routeFileName ? join17(dir, routeFileName) : null,
57353
+ filePath: hasRoute && routeFileName ? join18(dir, routeFileName) : null,
57051
57354
  children: []
57052
57355
  };
57053
57356
  for (const entry of entries) {
57054
- const entryPath = join17(dir, entry);
57357
+ const entryPath = join18(dir, entry);
57055
57358
  let entryStat;
57056
57359
  try {
57057
- entryStat = statSync13(entryPath);
57360
+ entryStat = statSync14(entryPath);
57058
57361
  } catch {
57059
57362
  continue;
57060
57363
  }
@@ -57608,11 +57911,11 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
57608
57911
 
57609
57912
  // ../compiler/dist/events.js
57610
57913
  import { existsSync as existsSync26 } from "fs";
57611
- import { join as join18 } from "path";
57914
+ import { join as join19 } from "path";
57612
57915
  var EVENTS_FILE_NAMES2 = ["_events.ts", "_events.js"];
57613
57916
  function collectEventsFile2(appDir) {
57614
57917
  for (const name of EVENTS_FILE_NAMES2) {
57615
- const candidate = join18(appDir, name);
57918
+ const candidate = join19(appDir, name);
57616
57919
  if (existsSync26(candidate))
57617
57920
  return candidate;
57618
57921
  }
@@ -57643,8 +57946,8 @@ async function runEventHandlers(handlers, name, ctx2) {
57643
57946
  }
57644
57947
 
57645
57948
  // ../compiler/dist/md-inline.js
57646
- import { readFileSync as readFileSync23, existsSync as existsSync27 } from "node:fs";
57647
- import { dirname as dirname17, join as join19, resolve as resolve23 } from "node:path";
57949
+ import { readFileSync as readFileSync25, existsSync as existsSync27 } from "node:fs";
57950
+ import { dirname as dirname17, join as join20, resolve as resolve23 } from "node:path";
57648
57951
  var MD_EXT_MARKER2 = ".md";
57649
57952
  function looksLikeMarkdownPath2(value) {
57650
57953
  const v = value.trim();
@@ -57687,7 +57990,7 @@ function inlineMdContentAttrs2(source, importerDir, mdRoots = []) {
57687
57990
  if (abs !== null) {
57688
57991
  let contents;
57689
57992
  try {
57690
- contents = readFileSync23(abs, "utf-8");
57993
+ contents = readFileSync25(abs, "utf-8");
57691
57994
  } catch {
57692
57995
  out += source[i];
57693
57996
  i++;
@@ -57721,10 +58024,10 @@ function resolveMdPath2(specifier, importerDir, roots) {
57721
58024
  }
57722
58025
  if (spec.startsWith("/")) {
57723
58026
  for (const root3 of roots) {
57724
- const pub = join19(root3, "public", spec);
58027
+ const pub = join20(root3, "public", spec);
57725
58028
  if (existsSync27(pub))
57726
58029
  return pub;
57727
- const direct = join19(root3, spec);
58030
+ const direct = join20(root3, spec);
57728
58031
  if (existsSync27(direct))
57729
58032
  return direct;
57730
58033
  }
@@ -57738,7 +58041,7 @@ function guessProjectRoots2(dir) {
57738
58041
  let cur = dir;
57739
58042
  for (let i = 0; i < 6; i++) {
57740
58043
  roots.push(cur);
57741
- if (existsSync27(join19(cur, "package.json")))
58044
+ if (existsSync27(join20(cur, "package.json")))
57742
58045
  break;
57743
58046
  const parent = dirname17(cur);
57744
58047
  if (parent === cur)
@@ -57749,8 +58052,8 @@ function guessProjectRoots2(dir) {
57749
58052
  }
57750
58053
 
57751
58054
  // ../adapter/dist/client-bundle.js
57752
- 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";
57753
- import { resolve as resolve24, join as join20, dirname as dirname18, relative as relative6, sep as sep3 } from "node:path";
58055
+ import { readFileSync as readFileSync26, existsSync as existsSync28, writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, statSync as statSync15, rmSync as rmSync4, mkdtempSync as mkdtempSync2, mkdirSync as mkdirSync12 } from "node:fs";
58056
+ import { resolve as resolve24, join as join21, dirname as dirname18, relative as relative6, sep as sep3 } from "node:path";
57754
58057
  import { fileURLToPath as fileURLToPath6 } from "node:url";
57755
58058
  import { tmpdir as tmpdir3 } from "node:os";
57756
58059
 
@@ -57841,7 +58144,7 @@ async function mapWithConcurrency2(items, limit, fn) {
57841
58144
  var __dirname7 = dirname18(fileURLToPath6(import.meta.url));
57842
58145
  function fileUnchanged2(filePath, cached) {
57843
58146
  try {
57844
- const st = statSync14(filePath);
58147
+ const st = statSync15(filePath);
57845
58148
  return st.mtimeMs === cached.mtimeMs && st.size === cached.size;
57846
58149
  } catch {
57847
58150
  return false;
@@ -57862,8 +58165,8 @@ function findRuntimeSrc3(appDir) {
57862
58165
  resolve24(appDir, "node_modules", "@vesk/runtime")
57863
58166
  ];
57864
58167
  for (const base of candidates) {
57865
- for (const dir of [base, join20(base, "dist")]) {
57866
- if (existsSync28(join20(dir, "index-client.js")))
58168
+ for (const dir of [base, join21(base, "dist")]) {
58169
+ if (existsSync28(join21(dir, "index-client.js")))
57867
58170
  return dir;
57868
58171
  }
57869
58172
  }
@@ -57983,6 +58286,13 @@ function nativeLibraryImportStubs2(code) {
57983
58286
  });
57984
58287
  return lines.join("\n") + "\n\n";
57985
58288
  }
58289
+ function reportServerOnlyImports2(chunkName, hits, strict) {
58290
+ const detail = [...new Set(hits.map((h) => `"${h.binding}" from "${h.specifier}"`))].join(", ");
58291
+ if (strict) {
58292
+ throw new Error(`[vesk] ${chunkName} imports a server-only package in client code: ${detail}. Move that work into an API route (app/api/**/route.ts) or a server action. Pass without --strict to allow it (the binding is replaced by a throwing stub).`);
58293
+ }
58294
+ console.error(`[vesk] ${chunkName}: removed server-only import from client code (${detail}). It is replaced by a stub that throws if the component calls it at runtime \u2014 server-only work belongs in an API route or a server action.`);
58295
+ }
57986
58296
  function demoteExports2(code) {
57987
58297
  let ast;
57988
58298
  try {
@@ -58016,7 +58326,7 @@ function chunkHasImports2(headLen, mergeAborted) {
58016
58326
  function runtimeImportsOf2(filePath) {
58017
58327
  let text;
58018
58328
  try {
58019
- text = readFileSync24(filePath, "utf8");
58329
+ text = readFileSync26(filePath, "utf8");
58020
58330
  } catch {
58021
58331
  return [];
58022
58332
  }
@@ -58343,11 +58653,11 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
58343
58653
  return removeCompiledNodes2(code, isVskImport2);
58344
58654
  }
58345
58655
  function resolveVskImports(filePath, compile) {
58346
- const src2 = readFileSync24(filePath, "utf-8");
58656
+ const src2 = readFileSync26(filePath, "utf-8");
58347
58657
  const resolved = [];
58348
58658
  for (const importPath of collectVskImportPaths(vskImportLines(src2), filePath)) {
58349
58659
  try {
58350
- readFileSync24(importPath);
58660
+ readFileSync26(importPath);
58351
58661
  } catch {
58352
58662
  continue;
58353
58663
  }
@@ -58409,7 +58719,7 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
58409
58719
  compiledFiles++;
58410
58720
  __stats.compiled++;
58411
58721
  __stats.distinct.add(filePath);
58412
- let src2 = readFileSync24(filePath, "utf-8");
58722
+ let src2 = readFileSync26(filePath, "utf-8");
58413
58723
  if (/content=["'][^"']*\.md["']/i.test(src2)) {
58414
58724
  src2 = inlineMdContentAttrs(src2, dirname18(filePath), guessProjectRoots(appDir));
58415
58725
  }
@@ -58449,7 +58759,7 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
58449
58759
  for (const reexportPath of reexportPaths || [])
58450
58760
  compileFile2(reexportPath, null, output, imports);
58451
58761
  if (cache2 && namesBefore) {
58452
- const st = statSync14(filePath);
58762
+ const st = statSync15(filePath);
58453
58763
  cache2.files.set(filePath, {
58454
58764
  mtimeMs: st.mtimeMs,
58455
58765
  size: st.size,
@@ -58579,9 +58889,9 @@ ${body}
58579
58889
  let sharedBundleCode = "";
58580
58890
  const sharedRuntimeNames = /* @__PURE__ */ new Set();
58581
58891
  if (sharedSources.length > 0) {
58582
- const tmpBase = mkdtempSync2(join20(resolve24(appDir, ".."), "tmp-vesk-shared-"));
58892
+ const tmpBase = mkdtempSync2(join21(resolve24(appDir, ".."), "tmp-vesk-shared-"));
58583
58893
  try {
58584
- const sharedEntry = join20(tmpBase, "shared-entry.js");
58894
+ const sharedEntry = join21(tmpBase, "shared-entry.js");
58585
58895
  const lines = [];
58586
58896
  const members = [];
58587
58897
  sharedSources.forEach((source, i) => {
@@ -58591,7 +58901,7 @@ ${body}
58591
58901
  lines.push(`globalThis.__veskShared = { ${members.join("\n")} };`);
58592
58902
  writeFileSync13(sharedEntry, lines.join("\n"));
58593
58903
  const appTsconfig = findTsconfigPath(appDir);
58594
- const runtimeShim = join20(tmpBase, "runtime-shim.js");
58904
+ const runtimeShim = join21(tmpBase, "runtime-shim.js");
58595
58905
  const runtimeLines = [
58596
58906
  "// ONE runtime instance: the entry bundle publishes these on globalThis,",
58597
58907
  "// and route chunks import the same functions. A second bundled copy",
@@ -58632,7 +58942,7 @@ ${body}
58632
58942
  bindings.named.forEach((n) => named.add(n));
58633
58943
  hasDefault = hasDefault || bindings.hasDefault;
58634
58944
  }
58635
- const shim = join20(tmpBase, `shim-${i}.js`);
58945
+ const shim = join21(tmpBase, `shim-${i}.js`);
58636
58946
  const shimLines = [`const m = globalThis.__veskShared[${JSON.stringify(source)}];`];
58637
58947
  if (hasDefault)
58638
58948
  shimLines.push(`export default m;`);
@@ -58663,13 +58973,21 @@ ${body}
58663
58973
  return null;
58664
58974
  let finalCode;
58665
58975
  if (entry.imports) {
58666
- const tmpBase = mkdtempSync2(join20(resolve24(appDir, ".."), "tmp-vesk-chunk-"));
58667
- const tmpFile = join20(tmpBase, "entry.js");
58976
+ const tmpBase = mkdtempSync2(join21(resolve24(appDir, ".."), "tmp-vesk-chunk-"));
58977
+ const tmpFile = join21(tmpBase, "entry.js");
58668
58978
  const toBundle = `const __components = globalThis.__components || (globalThis.__components = {});
58669
58979
  const __hydrators = globalThis.__hydrators || (globalThis.__hydrators = {});
58670
58980
  ${entry.code}
58671
58981
  `;
58672
58982
  writeFileSync13(tmpFile, toBundle);
58983
+ const serverOnlyHits = [];
58984
+ const driverHits = [];
58985
+ const eagerHits = [];
58986
+ const serverOnlyGuard = serverOnlyPlugin({
58987
+ onStub: (hit) => serverOnlyHits.push(hit),
58988
+ onDriver: (hit) => driverHits.push(hit),
58989
+ onEager: (hit) => eagerHits.push(hit)
58990
+ });
58673
58991
  try {
58674
58992
  const appTsconfig = findTsconfigPath(appDir);
58675
58993
  const result = await build3({
@@ -58693,7 +59011,7 @@ ${entry.code}
58693
59011
  // shared-modules.js serves every route chunk. (esbuild's `alias`
58694
59012
  // option only accepts bare package names, so this is a resolver
58695
59013
  // rather than a map.)
58696
- ...sharedRedirectPlugin ? { plugins: [sharedRedirectPlugin] } : {},
59014
+ ...sharedRedirectPlugin ? { plugins: [sharedRedirectPlugin, serverOnlyGuard] } : { plugins: [serverOnlyGuard] },
58697
59015
  ...appTsconfig ? { tsconfig: appTsconfig } : {}
58698
59016
  });
58699
59017
  finalCode = result.outputFiles[0].text;
@@ -58715,6 +59033,20 @@ ${entry.code}
58715
59033
  } catch {
58716
59034
  }
58717
59035
  }
59036
+ if (eagerHits.length > 0) {
59037
+ const detail = eagerHits.map((h) => `${h.importer} uses ${h.bindings.map((b) => `"${b}"`).join(", ")} from "${h.specifier}" at module scope`).join("; ");
59038
+ console.error("[vesk] server-only package used at module scope in client code", entry.name + ":", detail);
59039
+ throw new Error(`[vesk] ${entry.name}: ${detail}.
59040
+ A module-scope statement runs the moment the browser evaluates the chunk, so a server-only package cannot be substituted there. Move that work into an API route (app/api/**/route.ts) or a server action \u2014 if the binding is only used from inside a function, this build already handles it.`);
59041
+ }
59042
+ if (driverHits.length > 0) {
59043
+ const detail = [...new Set(driverHits.map((h) => `${h.specifier} (from ${h.importer})`))].join(", ");
59044
+ console.error("[vesk] chunk bundle contains a TCP-only driver", entry.name + ":", detail);
59045
+ throw new Error(`[vesk] ${entry.name} pulls a TCP-only driver into the browser bundle: ${detail}. A browser cannot open a socket. Import the package's edge/browser-safe entry if it ships one, or keep database access in an API route (app/api/**/route.ts) or a server action.`);
59046
+ }
59047
+ if (serverOnlyHits.length > 0) {
59048
+ reportServerOnlyImports2(entry.name, serverOnlyHits, options?.strict);
59049
+ }
58718
59050
  } else {
58719
59051
  finalCode = chunkIIFE(demoteExports2(entry.code));
58720
59052
  }
@@ -58754,7 +59086,7 @@ ${entry.code}
58754
59086
  if (seen.has(filePath))
58755
59087
  return;
58756
59088
  seen.add(filePath);
58757
- const src2 = readFileSync24(filePath, "utf-8");
59089
+ const src2 = readFileSync26(filePath, "utf-8");
58758
59090
  resolveVskImports(filePath, (p, n) => compileFileMono2(p, n || ""));
58759
59091
  for (const cn of vskComponentNames(src2, filePath))
58760
59092
  componentOwners.claim(cn, filePath);
@@ -58847,9 +59179,9 @@ function buildRuntimeCode2(runtimeDir) {
58847
59179
  ];
58848
59180
  let code = "";
58849
59181
  for (const f of runtimeFiles) {
58850
- const p = join20(runtimeDir, f);
59182
+ const p = join21(runtimeDir, f);
58851
59183
  if (existsSync28(p)) {
58852
- let src2 = readFileSync24(p, "utf-8");
59184
+ let src2 = readFileSync26(p, "utf-8");
58853
59185
  src2 = stripTypes2(src2);
58854
59186
  src2 = src2.replace(/^import\s+[\s\S]*?from\s+['"](?:\.\/.*?|@vesk\/runtime\/src\/.*?)['"];?\n?/gm, "");
58855
59187
  src2 = src2.replace(/^import\s+['"](?:\.\/.*?|@vesk\/runtime\/src\/.*?)['"];?\n?/gm, "");
@@ -58861,7 +59193,7 @@ ${src2}
58861
59193
  `;
58862
59194
  }
58863
59195
  }
58864
- const indexSrc = readFileSync24(join20(runtimeDir, "index-client.js"), "utf-8");
59196
+ const indexSrc = readFileSync26(join21(runtimeDir, "index-client.js"), "utf-8");
58865
59197
  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())) || [];
58866
59198
  code += "// --- exports ---\n";
58867
59199
  for (const name of [...new Set(exportNames)]) {
@@ -58872,7 +59204,7 @@ ${src2}
58872
59204
  return code;
58873
59205
  }
58874
59206
  function runtimeExportNames2(runtimeDir) {
58875
- const indexSrc = readFileSync24(join20(runtimeDir, "index-client.js"), "utf-8");
59207
+ const indexSrc = readFileSync26(join21(runtimeDir, "index-client.js"), "utf-8");
58876
59208
  const names = /* @__PURE__ */ new Set();
58877
59209
  for (const m of indexSrc.matchAll(/export\s*\{([^}]+)\}\s*from/g)) {
58878
59210
  for (const raw2 of m[1].split(",")) {
@@ -58888,7 +59220,7 @@ function esbuildPath2(p) {
58888
59220
  return sep3 === "/" ? p : p.split(sep3).join("/");
58889
59221
  }
58890
59222
  function runtimeTreeShakeEntry2() {
58891
- return join20(tmpdir3(), "vesk-runtime-tree-shake", RUNTIME_ENTRY2);
59223
+ return join21(tmpdir3(), "vesk-runtime-tree-shake", RUNTIME_ENTRY2);
58892
59224
  }
58893
59225
  var treeShakeQueue2 = Promise.resolve();
58894
59226
  function buildTreeShakenRuntime2(runtimeDir, usedNames) {
@@ -58913,7 +59245,7 @@ async function bundleRuntimeNames2(runtimeDir, names, strict = false) {
58913
59245
  if (names.length === 0)
58914
59246
  return null;
58915
59247
  const entry = runtimeTreeShakeEntry2();
58916
- const indexClient = esbuildPath2(join20(runtimeDir, "index-client.js"));
59248
+ const indexClient = esbuildPath2(join21(runtimeDir, "index-client.js"));
58917
59249
  const unique = [...new Set(names)];
58918
59250
  try {
58919
59251
  try {
@@ -59061,7 +59393,7 @@ if (typeof document !== 'undefined') __router.start();
59061
59393
 
59062
59394
  // ../adapter/dist/paths.js
59063
59395
  import { resolve as resolve25, sep as sep4 } from "node:path";
59064
- import { existsSync as existsSync29, statSync as statSync15, readFileSync as readFileSync25 } from "node:fs";
59396
+ import { existsSync as existsSync29, statSync as statSync16, readFileSync as readFileSync27 } from "node:fs";
59065
59397
  function resolveWithin2(baseDir, relPath) {
59066
59398
  const base = resolve25(baseDir);
59067
59399
  const target = resolve25(baseDir, relPath);
@@ -59084,8 +59416,8 @@ function installMdReadHook2(publicDirs) {
59084
59416
  const lower2 = abs.toLowerCase();
59085
59417
  if (!lower2.endsWith(".md") && !lower2.endsWith(".markdown"))
59086
59418
  continue;
59087
- if (existsSync29(abs) && statSync15(abs).isFile())
59088
- return readFileSync25(abs, "utf8");
59419
+ if (existsSync29(abs) && statSync16(abs).isFile())
59420
+ return readFileSync27(abs, "utf8");
59089
59421
  } catch {
59090
59422
  }
59091
59423
  }
@@ -59152,13 +59484,13 @@ function urlAuthority3(url) {
59152
59484
  }
59153
59485
 
59154
59486
  // ../adapter/dist/dev-api.js
59155
- import { readFileSync as readFileSync28, statSync as statSync17, existsSync as existsSync32, readdirSync as readdirSync9 } from "node:fs";
59487
+ import { readFileSync as readFileSync30, statSync as statSync18, existsSync as existsSync32, readdirSync as readdirSync10 } from "node:fs";
59156
59488
  import { resolve as resolve28 } from "node:path";
59157
59489
 
59158
59490
  // ../adapter/dist/plugins.js
59159
59491
  init_paths();
59160
- import { readFileSync as readFileSync26, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync16 } from "node:fs";
59161
- import { resolve as resolve26, dirname as dirname19, join as join21, extname as extname6, basename as basename6 } from "node:path";
59492
+ import { readFileSync as readFileSync28, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync17 } from "node:fs";
59493
+ import { resolve as resolve26, dirname as dirname19, join as join22, extname as extname6, basename as basename6 } from "node:path";
59162
59494
  import { createRequire as createRequire6 } from "node:module";
59163
59495
  import { spawn as spawn2 } from "node:child_process";
59164
59496
  var PLUGIN_STATE_FILENAME2 = "plugins.json";
@@ -59181,7 +59513,7 @@ function readPluginState2(veskDir) {
59181
59513
  return defaultState2();
59182
59514
  let raw2;
59183
59515
  try {
59184
- raw2 = JSON.parse(readFileSync26(file, "utf-8"));
59516
+ raw2 = JSON.parse(readFileSync28(file, "utf-8"));
59185
59517
  } catch {
59186
59518
  return defaultState2();
59187
59519
  }
@@ -59218,7 +59550,7 @@ function resolvePackage2(appDir, pkg) {
59218
59550
  const seen = /* @__PURE__ */ new Set();
59219
59551
  while (cur && cur !== dirname19(cur) && !seen.has(cur)) {
59220
59552
  seen.add(cur);
59221
- const candidate = join21(cur, "package.json");
59553
+ const candidate = join22(cur, "package.json");
59222
59554
  if (existsSync30(candidate)) {
59223
59555
  pkgJsonPath = candidate;
59224
59556
  break;
@@ -59247,7 +59579,7 @@ function resolvePackage2(appDir, pkg) {
59247
59579
  }
59248
59580
  }
59249
59581
  if (localPath) {
59250
- const localJson = join21(localPath, "package.json");
59582
+ const localJson = join22(localPath, "package.json");
59251
59583
  let json = null;
59252
59584
  if (existsSync30(localJson)) {
59253
59585
  json = readJsonFile2(localJson);
@@ -59273,7 +59605,7 @@ function localDir2(base, pkg) {
59273
59605
  function readJsonFile2(file) {
59274
59606
  try {
59275
59607
  if (existsSync30(file))
59276
- return JSON.parse(readFileSync26(file, "utf-8"));
59608
+ return JSON.parse(readFileSync28(file, "utf-8"));
59277
59609
  } catch {
59278
59610
  }
59279
59611
  return null;
@@ -59556,12 +59888,12 @@ function findIconFile2(dir, meta) {
59556
59888
  const explicit = str2(meta?.icon);
59557
59889
  if (explicit) {
59558
59890
  const p = resolveWithin(dir, explicit);
59559
- if (p && existsSync30(p) && statSync16(p).isFile())
59891
+ if (p && existsSync30(p) && statSync17(p).isFile())
59560
59892
  return p;
59561
59893
  }
59562
59894
  for (const name of ["icon.png", "icon.ico"]) {
59563
59895
  const p = resolve26(dir, name);
59564
- if (existsSync30(p) && statSync16(p).isFile())
59896
+ if (existsSync30(p) && statSync17(p).isFile())
59565
59897
  return p;
59566
59898
  }
59567
59899
  return null;
@@ -59646,7 +59978,7 @@ function resolveDtsPath2(probe, pkgJson) {
59646
59978
  if (!rel)
59647
59979
  continue;
59648
59980
  const abs = resolveWithin(dir, rel);
59649
- if (abs && existsSync30(abs) && statSync16(abs).isFile())
59981
+ if (abs && existsSync30(abs) && statSync17(abs).isFile())
59650
59982
  return abs;
59651
59983
  }
59652
59984
  return null;
@@ -59995,7 +60327,7 @@ function introspectPlugin2(appDir, name) {
59995
60327
  const pkgName = str2(pkgJson.name) ?? name;
59996
60328
  const exportsMap = flattenPackageExports2(pkgJson.exports);
59997
60329
  const dtsPath = resolveDtsPath2(probe, pkgJson);
59998
- const dtsExports = dtsPath ? parseDtsExports2(readFileSync26(dtsPath, "utf-8")) : [];
60330
+ const dtsExports = dtsPath ? parseDtsExports2(readFileSync28(dtsPath, "utf-8")) : [];
59999
60331
  return {
60000
60332
  ok: true,
60001
60333
  name: pkgName,
@@ -60133,9 +60465,9 @@ var __internals2 = {
60133
60465
  };
60134
60466
 
60135
60467
  // ../adapter/dist/dev-config.js
60136
- import { existsSync as existsSync31, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
60468
+ import { existsSync as existsSync31, readFileSync as readFileSync29, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
60137
60469
  import { tmpdir as tmpdir4 } from "node:os";
60138
- import { resolve as resolve27, dirname as dirname20, join as join22 } from "node:path";
60470
+ import { resolve as resolve27, dirname as dirname20, join as join23 } from "node:path";
60139
60471
  init_parser();
60140
60472
  function findConfigFile2(projectDir) {
60141
60473
  const ts9 = resolve27(projectDir, "vesk.config.ts");
@@ -60163,9 +60495,9 @@ async function parseConfigSource(source, isTs, projectDir) {
60163
60495
  js = `const { defineConfig, definePlugin, preset } = globalThis.__vesk_inject;
60164
60496
  ` + js;
60165
60497
  }
60166
- const base = projectDir ? (mkdirSync14(join22(projectDir, ".vesk"), { recursive: true }), join22(projectDir, ".vesk")) : void 0;
60167
- const dir = base ? mkdtempSync3(join22(base, "cfg-")) : mkdtempSync3(join22(tmpdir4(), "vesk-cfg-"));
60168
- const tmpFile = join22(dir, "config.mjs");
60498
+ const base = projectDir ? (mkdirSync14(join23(projectDir, ".vesk"), { recursive: true }), join23(projectDir, ".vesk")) : void 0;
60499
+ const dir = base ? mkdtempSync3(join23(base, "cfg-")) : mkdtempSync3(join23(tmpdir4(), "vesk-cfg-"));
60500
+ const tmpFile = join23(dir, "config.mjs");
60169
60501
  try {
60170
60502
  writeFileSync15(tmpFile, js, "utf-8");
60171
60503
  globalThis.__vesk_inject = {
@@ -60192,7 +60524,7 @@ async function readConfig2(projectDir) {
60192
60524
  const { path, isTs } = findConfigFile2(projectDir);
60193
60525
  if (!path)
60194
60526
  return { path: null, exists: false, source: "", config: {} };
60195
- const source = readFileSync27(path, "utf-8");
60527
+ const source = readFileSync29(path, "utf-8");
60196
60528
  const config = await parseConfigSource(source, isTs, projectDir);
60197
60529
  return { path, exists: true, source, config };
60198
60530
  }
@@ -61034,7 +61366,7 @@ export default defineConfig({
61034
61366
  await writeConfigSource2(projectDir, source);
61035
61367
  return;
61036
61368
  }
61037
- source = readFileSync27(path, "utf-8");
61369
+ source = readFileSync29(path, "utf-8");
61038
61370
  const existingImport = findPluginImportAst(source, pkg);
61039
61371
  let importName;
61040
61372
  if (existingImport) {
@@ -61114,7 +61446,7 @@ async function removePluginFromConfig2(projectDir, pkg) {
61114
61446
  const { path } = findConfigFile2(projectDir);
61115
61447
  if (!path)
61116
61448
  return false;
61117
- let source = readFileSync27(path, "utf-8");
61449
+ let source = readFileSync29(path, "utf-8");
61118
61450
  const original = source;
61119
61451
  const existingImport = findPluginImportAst(source, pkg);
61120
61452
  let importName = existingImport ? existingImport.name : null;
@@ -61235,7 +61567,7 @@ function createDevApiRouter2(opts) {
61235
61567
  return badRequest2("no vesk.config file to edit");
61236
61568
  if (!isTs)
61237
61569
  return badRequest2("single-key toggle edits only apply to vesk.config.ts (use the source editor for .js)");
61238
- const patched = applyConfigToggle2(readFileSync28(path, "utf-8"), b.key, b.value);
61570
+ const patched = applyConfigToggle2(readFileSync30(path, "utf-8"), b.key, b.value);
61239
61571
  if (patched === null)
61240
61572
  return badRequest2("could not safely edit the config object; use the source editor");
61241
61573
  const cfg = await writeConfigSource2(projectDir, patched);
@@ -61276,12 +61608,12 @@ function createDevApiRouter2(opts) {
61276
61608
  return jsonStatus(403, { error: "path escapes project root" });
61277
61609
  if (!existsSync32(resolved))
61278
61610
  return jsonStatus(404, { error: "not found" });
61279
- if (statSync17(resolved).isDirectory()) {
61280
- const entries = readdirSync9(resolved, { withFileTypes: true }).map((e) => e.name);
61611
+ if (statSync18(resolved).isDirectory()) {
61612
+ const entries = readdirSync10(resolved, { withFileTypes: true }).map((e) => e.name);
61281
61613
  return jsonStatus(200, { ok: true, path: target, directory: true, entries });
61282
61614
  }
61283
- if (statSync17(resolved).isFile()) {
61284
- return jsonStatus(200, { ok: true, path: target, directory: false, content: readFileSync28(resolved, "utf-8") });
61615
+ if (statSync18(resolved).isFile()) {
61616
+ return jsonStatus(200, { ok: true, path: target, directory: false, content: readFileSync30(resolved, "utf-8") });
61285
61617
  }
61286
61618
  return badRequest2("unsupported file type");
61287
61619
  } catch (e) {
@@ -61417,7 +61749,7 @@ function createDevApiRouter2(opts) {
61417
61749
  return {
61418
61750
  status: 200,
61419
61751
  headers: { "Content-Type": icon.mime, "Cache-Control": "private, max-age=60" },
61420
- body: readFileSync28(icon.file).toString("base64"),
61752
+ body: readFileSync30(icon.file).toString("base64"),
61421
61753
  encoding: "base64"
61422
61754
  };
61423
61755
  }
@@ -61474,8 +61806,8 @@ function produceDiagnostics(input) {
61474
61806
  }
61475
61807
 
61476
61808
  // ../agentic/dist/checkpoints.js
61477
- 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";
61478
- import { join as join23, resolve as resolve29, dirname as dirname21, sep as sep5 } from "node:path";
61809
+ import { existsSync as existsSync33, mkdirSync as mkdirSync15, readFileSync as readFileSync31, writeFileSync as writeFileSync16, statSync as statSync19, unlinkSync as unlinkSync5, rmSync as rmSync6, renameSync } from "node:fs";
61810
+ import { join as join24, resolve as resolve29, dirname as dirname21, sep as sep5 } from "node:path";
61479
61811
  import { randomUUID as nodeRandomUUID } from "node:crypto";
61480
61812
  function generateId() {
61481
61813
  try {
@@ -61608,16 +61940,16 @@ var CheckpointManager = class {
61608
61940
  }
61609
61941
  };
61610
61942
  function getAgenticDir(projectDir) {
61611
- return join23(resolve29(projectDir), ".vesk", "agentic");
61943
+ return join24(resolve29(projectDir), ".vesk", "agentic");
61612
61944
  }
61613
61945
  function getHistoryPath(projectDir) {
61614
- return join23(getAgenticDir(projectDir), "history.json");
61946
+ return join24(getAgenticDir(projectDir), "history.json");
61615
61947
  }
61616
61948
  function getCheckpointDir(projectDir, id) {
61617
- return join23(getAgenticDir(projectDir), "checkpoints", id);
61949
+ return join24(getAgenticDir(projectDir), "checkpoints", id);
61618
61950
  }
61619
61951
  function getCheckpointPath(projectDir, id) {
61620
- return join23(getCheckpointDir(projectDir, id), "checkpoint.json");
61952
+ return join24(getCheckpointDir(projectDir, id), "checkpoint.json");
61621
61953
  }
61622
61954
  function ensureDir(dir) {
61623
61955
  mkdirSync15(dir, { recursive: true });
@@ -61626,7 +61958,7 @@ function readJson(filePath, fallback) {
61626
61958
  try {
61627
61959
  if (!existsSync33(filePath))
61628
61960
  return fallback;
61629
- const raw2 = readFileSync29(filePath, "utf-8");
61961
+ const raw2 = readFileSync31(filePath, "utf-8");
61630
61962
  if (raw2.trim() === "")
61631
61963
  return fallback;
61632
61964
  return JSON.parse(raw2);
@@ -61697,7 +62029,7 @@ function createCheckpoint(projectDir, message, changes = {}, buildResult) {
61697
62029
  };
61698
62030
  const agenticDir = getAgenticDir(projectDir);
61699
62031
  ensureDir(agenticDir);
61700
- ensureDir(join23(agenticDir, "checkpoints"));
62032
+ ensureDir(join24(agenticDir, "checkpoints"));
61701
62033
  const cpDir = getCheckpointDir(projectDir, id);
61702
62034
  ensureDir(cpDir);
61703
62035
  writeJsonAtomic(getCheckpointPath(projectDir, id), checkpoint);
@@ -61726,7 +62058,7 @@ function rollback(projectDir, id) {
61726
62058
  if (f.before === null) {
61727
62059
  try {
61728
62060
  if (existsSync33(abs)) {
61729
- const s = statSync18(abs);
62061
+ const s = statSync19(abs);
61730
62062
  if (s.isDirectory())
61731
62063
  rmSync6(abs, { recursive: true, force: true });
61732
62064
  else
@@ -61746,7 +62078,7 @@ function rollback(projectDir, id) {
61746
62078
  }
61747
62079
 
61748
62080
  // ../agentic/dist/config.js
61749
- import { readFileSync as readFileSync30, writeFileSync as writeFileSync17, existsSync as existsSync34, mkdirSync as mkdirSync16, chmodSync } from "node:fs";
62081
+ import { readFileSync as readFileSync32, writeFileSync as writeFileSync17, existsSync as existsSync34, mkdirSync as mkdirSync16, chmodSync } from "node:fs";
61750
62082
  import { resolve as resolve30, dirname as dirname22 } from "node:path";
61751
62083
  var DEFAULT_CONFIG = {
61752
62084
  provider: "openai",
@@ -61795,7 +62127,7 @@ function readDotenvValue(projectDir, key, def = null) {
61795
62127
  const p = dotenvPath(projectDir);
61796
62128
  if (!existsSync34(p))
61797
62129
  return def;
61798
- const content = readFileSync30(p, "utf-8");
62130
+ const content = readFileSync32(p, "utf-8");
61799
62131
  for (const rawLine of content.split("\n")) {
61800
62132
  const line = rawLine.trim();
61801
62133
  if (!line || line.startsWith("#"))
@@ -61823,7 +62155,7 @@ function writeDotenvValue(projectDir, key, value) {
61823
62155
  let out = "";
61824
62156
  let replaced = false;
61825
62157
  if (existsSync34(p)) {
61826
- const lines = readFileSync30(p, "utf-8").split("\n");
62158
+ const lines = readFileSync32(p, "utf-8").split("\n");
61827
62159
  for (const rawLine of lines) {
61828
62160
  const trimmed = rawLine.trim();
61829
62161
  const eq = trimmed.indexOf("=");
@@ -61853,7 +62185,7 @@ function loadAgenticConfig(projectDir) {
61853
62185
  let cfg = { ...DEFAULT_CONFIG };
61854
62186
  try {
61855
62187
  if (existsSync34(p))
61856
- cfg = { ...cfg, ...JSON.parse(readFileSync30(p, "utf-8")) };
62188
+ cfg = { ...cfg, ...JSON.parse(readFileSync32(p, "utf-8")) };
61857
62189
  } catch {
61858
62190
  }
61859
62191
  let hasKey = false;
@@ -61896,7 +62228,7 @@ function getProviderSpecificKey(projectDir, provider) {
61896
62228
  try {
61897
62229
  const pp2 = providerKeyPath(projectDir, prov);
61898
62230
  if (existsSync34(pp2)) {
61899
- const v = readFileSync30(pp2, "utf-8").trim();
62231
+ const v = readFileSync32(pp2, "utf-8").trim();
61900
62232
  if (v)
61901
62233
  return v;
61902
62234
  }
@@ -61944,7 +62276,7 @@ function getApiKey(projectDir, provider) {
61944
62276
  try {
61945
62277
  const pp2 = providerKeyPath(projectDir, prov);
61946
62278
  if (existsSync34(pp2)) {
61947
- const v = readFileSync30(pp2, "utf-8").trim();
62279
+ const v = readFileSync32(pp2, "utf-8").trim();
61948
62280
  if (v)
61949
62281
  return v;
61950
62282
  }
@@ -61967,7 +62299,7 @@ function getApiKey(projectDir, provider) {
61967
62299
  }
61968
62300
 
61969
62301
  // ../agentic/dist/dev-api.js
61970
- import { existsSync as existsSync35, readFileSync as readFileSync31 } from "node:fs";
62302
+ import { existsSync as existsSync35, readFileSync as readFileSync33 } from "node:fs";
61971
62303
  import { resolve as resolve31 } from "node:path";
61972
62304
 
61973
62305
  // ../agentic/dist/providers/openai.js
@@ -62340,7 +62672,7 @@ function getPerProviderKeyRaw(projectDir, provider) {
62340
62672
  try {
62341
62673
  const p = resolve31(projectDir, ".vesk", "agentic", "keys", `${sanitizeProviderName(prov)}.key`);
62342
62674
  if (existsSync35(p)) {
62343
- const v = readFileSync31(p, "utf-8").trim();
62675
+ const v = readFileSync33(p, "utf-8").trim();
62344
62676
  if (v)
62345
62677
  return v;
62346
62678
  }
@@ -63201,8 +63533,8 @@ var Agent = class {
63201
63533
  };
63202
63534
 
63203
63535
  // ../agentic/dist/tools/vesk.js
63204
- import { existsSync as existsSync36, readFileSync as readFileSync32, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync10, statSync as statSync19 } from "node:fs";
63205
- import { resolve as resolve32, join as join24, dirname as dirname23, sep as sep6 } from "node:path";
63536
+ import { existsSync as existsSync36, readFileSync as readFileSync34, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync11, statSync as statSync20 } from "node:fs";
63537
+ import { resolve as resolve32, join as join25, dirname as dirname23, sep as sep6 } from "node:path";
63206
63538
  function resolveWithin3(baseDir, relPath) {
63207
63539
  const base = resolve32(baseDir);
63208
63540
  const target = resolve32(baseDir, relPath);
@@ -63220,7 +63552,7 @@ function readPluginState3(veskDir) {
63220
63552
  if (!existsSync36(file))
63221
63553
  return { version: 1, plugins: [] };
63222
63554
  try {
63223
- const raw2 = JSON.parse(readFileSync32(file, "utf-8"));
63555
+ const raw2 = JSON.parse(readFileSync34(file, "utf-8"));
63224
63556
  if (!raw2 || typeof raw2 !== "object")
63225
63557
  return { version: 1, plugins: [] };
63226
63558
  if (raw2.version !== 1)
@@ -63264,7 +63596,7 @@ function findConfigFile3(projectDir) {
63264
63596
  return { path: null, isTs: false };
63265
63597
  }
63266
63598
  function checkpointDir(veskDir) {
63267
- return join24(resolve32(veskDir), "checkpoints");
63599
+ return join25(resolve32(veskDir), "checkpoints");
63268
63600
  }
63269
63601
  function findMatchingBrace2(src2, openIdx) {
63270
63602
  let inStr = null;
@@ -63409,18 +63741,18 @@ function createVeskTools(deps) {
63409
63741
  async execute(_args) {
63410
63742
  try {
63411
63743
  const projExists = existsSync36(projectDir);
63412
- const projEntries = projExists ? readdirSync10(projectDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
63744
+ const projEntries = projExists ? readdirSync11(projectDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
63413
63745
  const appExists = existsSync36(appDir);
63414
- const appEntries = appExists ? readdirSync10(appDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
63746
+ const appEntries = appExists ? readdirSync11(appDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
63415
63747
  const veskExists = existsSync36(veskDir);
63416
- const veskEntries = veskExists ? readdirSync10(veskDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
63748
+ const veskEntries = veskExists ? readdirSync11(veskDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
63417
63749
  const cfgInfo = findConfigFile3(projectDir);
63418
63750
  let configSource = null;
63419
63751
  let configExists = false;
63420
63752
  if (cfgInfo.path && existsSync36(cfgInfo.path)) {
63421
63753
  configExists = true;
63422
63754
  try {
63423
- configSource = readFileSync32(cfgInfo.path, "utf-8").slice(0, 8e3);
63755
+ configSource = readFileSync34(cfgInfo.path, "utf-8").slice(0, 8e3);
63424
63756
  } catch {
63425
63757
  configSource = null;
63426
63758
  }
@@ -63429,7 +63761,7 @@ function createVeskTools(deps) {
63429
63761
  const pkgPath = resolve32(projectDir, "package.json");
63430
63762
  if (existsSync36(pkgPath)) {
63431
63763
  try {
63432
- packageJson = JSON.parse(readFileSync32(pkgPath, "utf-8"));
63764
+ packageJson = JSON.parse(readFileSync34(pkgPath, "utf-8"));
63433
63765
  } catch {
63434
63766
  packageJson = null;
63435
63767
  }
@@ -63511,13 +63843,13 @@ function createVeskTools(deps) {
63511
63843
  return jsonError("path escapes project root", { path: rel });
63512
63844
  if (!existsSync36(resolved))
63513
63845
  return jsonError("not found", { path: rel });
63514
- const st = statSync19(resolved);
63846
+ const st = statSync20(resolved);
63515
63847
  if (st.isDirectory()) {
63516
- const entries = readdirSync10(resolved, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name);
63848
+ const entries = readdirSync11(resolved, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name);
63517
63849
  return jsonOk({ ok: true, path: rel, directory: true, entries: entries.slice(0, 200) });
63518
63850
  }
63519
63851
  if (st.isFile()) {
63520
- const content = readFileSync32(resolved, "utf-8");
63852
+ const content = readFileSync34(resolved, "utf-8");
63521
63853
  const capped = content.length > 2e4 ? content.slice(0, 2e4) + "\n/* truncated */" : content;
63522
63854
  return jsonOk({ ok: true, path: rel, directory: false, content: capped, size: content.length });
63523
63855
  }
@@ -63553,7 +63885,7 @@ function createVeskTools(deps) {
63553
63885
  if (!info.path || !existsSync36(info.path)) {
63554
63886
  return jsonOk({ ok: true, path: null, exists: false, source: "", config: {} });
63555
63887
  }
63556
- const source = readFileSync32(info.path, "utf-8");
63888
+ const source = readFileSync34(info.path, "utf-8");
63557
63889
  return jsonOk({ ok: true, path: info.path, exists: true, source, config: null });
63558
63890
  } catch (e) {
63559
63891
  return jsonError(e instanceof Error ? e.message : String(e));
@@ -63611,7 +63943,7 @@ function createVeskTools(deps) {
63611
63943
  const contained = resolveWithin3(projectDir, info.path.slice(projectDir.length + 1));
63612
63944
  if (!contained)
63613
63945
  return jsonError("path escapes project root");
63614
- const current3 = readFileSync32(info.path, "utf-8");
63946
+ const current3 = readFileSync34(info.path, "utf-8");
63615
63947
  const patched = applySimpleConfigToggle(current3, key, a.value);
63616
63948
  if (patched === null)
63617
63949
  return jsonError("could not safely edit the config object; use the source editor");
@@ -63879,7 +64211,7 @@ function createVeskTools(deps) {
63879
64211
  const dir = checkpointDir(veskDir);
63880
64212
  mkdirSync17(dir, { recursive: true });
63881
64213
  const id = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
63882
- const file = join24(dir, `${id}.json`);
64214
+ const file = join25(dir, `${id}.json`);
63883
64215
  const check = resolveWithin3(dir, `${id}.json`);
63884
64216
  if (!check)
63885
64217
  return jsonError("path escapes project root");
@@ -63928,13 +64260,13 @@ function createVeskTools(deps) {
63928
64260
  } catch {
63929
64261
  }
63930
64262
  const dir = checkpointDir(veskDir);
63931
- const file = join24(dir, `${checkpointId}.json`);
64263
+ const file = join25(dir, `${checkpointId}.json`);
63932
64264
  const contained = resolveWithin3(dir, `${checkpointId}.json`);
63933
64265
  if (!contained)
63934
64266
  return jsonError("path escapes project root");
63935
64267
  if (!existsSync36(file))
63936
64268
  return jsonError(`checkpoint not found: ${checkpointId}`, { checkpointId });
63937
- const raw2 = readFileSync32(file, "utf-8");
64269
+ const raw2 = readFileSync34(file, "utf-8");
63938
64270
  let data2;
63939
64271
  try {
63940
64272
  data2 = JSON.parse(raw2);
@@ -64017,7 +64349,7 @@ function renderDefaultNotFoundPage2(opts = {}) {
64017
64349
  }
64018
64350
 
64019
64351
  // ../adapter/dist/css.js
64020
- import { readFileSync as readFileSync33, existsSync as existsSync37 } from "node:fs";
64352
+ import { readFileSync as readFileSync35, existsSync as existsSync37 } from "node:fs";
64021
64353
  import { resolve as resolve33 } from "node:path";
64022
64354
  var GLOBAL_CSS_URL2 = "/_vesk/static/global.css";
64023
64355
  function resolveUserCssPath2(appDir) {
@@ -64044,7 +64376,7 @@ function resolveCssUrls2(opts) {
64044
64376
  // ../adapter/dist/hmr.js
64045
64377
  init_client_codegen();
64046
64378
  import { WebSocketServer } from "ws";
64047
- import { readFileSync as readFileSync34, existsSync as existsSync38, writeFileSync as writeFileSync19 } from "node:fs";
64379
+ import { readFileSync as readFileSync36, existsSync as existsSync38, writeFileSync as writeFileSync19 } from "node:fs";
64048
64380
  import { resolve as resolve34, dirname as dirname24 } from "node:path";
64049
64381
  import { fileURLToPath as fileURLToPath7 } from "node:url";
64050
64382
  init_default_pages();
@@ -64288,7 +64620,7 @@ function buildErrorPayload(error, filename, opts = {}) {
64288
64620
  for (const absPath of candidates) {
64289
64621
  try {
64290
64622
  if (existsSync38(absPath)) {
64291
- src2 = readFileSync34(absPath, "utf-8");
64623
+ src2 = readFileSync36(absPath, "utf-8");
64292
64624
  resolvedAbsPath = absPath;
64293
64625
  break;
64294
64626
  }
@@ -64336,7 +64668,7 @@ function buildErrorPayload(error, filename, opts = {}) {
64336
64668
  }
64337
64669
 
64338
64670
  // ../adapter/dist/ssr-error.js
64339
- import { existsSync as existsSync39, readFileSync as readFileSync35 } from "node:fs";
64671
+ import { existsSync as existsSync39, readFileSync as readFileSync37 } from "node:fs";
64340
64672
  import { relative as relative7, resolve as resolve35 } from "node:path";
64341
64673
 
64342
64674
  // ../adapter/dist/error-codeframe.js
@@ -64433,7 +64765,7 @@ function extractComponentNames(stack) {
64433
64765
  }
64434
64766
  return names;
64435
64767
  }
64436
- var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".cjs", ".vsk"]);
64768
+ var SOURCE_EXTENSIONS2 = /* @__PURE__ */ new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".cjs", ".vsk"]);
64437
64769
  function scanFrameLocation(seg) {
64438
64770
  if (!seg)
64439
64771
  return null;
@@ -64514,7 +64846,7 @@ function firstSourceFileFrame(stack, projectRoot) {
64514
64846
  if (!p.startsWith("/"))
64515
64847
  continue;
64516
64848
  const ext = p.slice(p.lastIndexOf(".")).split(":")[0].toLowerCase();
64517
- if (!SOURCE_EXTENSIONS.has(ext))
64849
+ if (!SOURCE_EXTENSIONS2.has(ext))
64518
64850
  continue;
64519
64851
  if (isGeneratedPath(p))
64520
64852
  continue;
@@ -64567,7 +64899,7 @@ function readIfFile(absPath) {
64567
64899
  try {
64568
64900
  if (!existsSync39(absPath))
64569
64901
  return null;
64570
- return readFileSync35(absPath, "utf-8");
64902
+ return readFileSync37(absPath, "utf-8");
64571
64903
  } catch {
64572
64904
  return null;
64573
64905
  }
@@ -64715,9 +65047,9 @@ function renderDevErrorPage(payload, opts) {
64715
65047
 
64716
65048
  // src/build-packages.ts
64717
65049
  import { spawnSync as spawnSync2 } from "node:child_process";
64718
- 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";
65050
+ import { cpSync as cpSync2, existsSync as existsSync40, mkdirSync as mkdirSync18, readFileSync as readFileSync38, readdirSync as readdirSync12, statSync as statSync21, writeFileSync as writeFileSync20 } from "node:fs";
64719
65051
  import { createRequire as createRequire7 } from "node:module";
64720
- import { dirname as dirname25, join as join25, resolve as resolve36 } from "node:path";
65052
+ import { dirname as dirname25, join as join26, resolve as resolve36 } from "node:path";
64721
65053
  import { fileURLToPath as fileURLToPath8 } from "node:url";
64722
65054
  var require2 = createRequire7(import.meta.url);
64723
65055
  var __dirname9 = dirname25(fileURLToPath8(import.meta.url));
@@ -64747,9 +65079,9 @@ var PACKAGES = {
64747
65079
  };
64748
65080
  function newestSourceMtime(srcDir) {
64749
65081
  let newest = 0;
64750
- for (const name of readdirSync11(srcDir)) {
64751
- const p = join25(srcDir, name);
64752
- const st = statSync20(p);
65082
+ for (const name of readdirSync12(srcDir)) {
65083
+ const p = join26(srcDir, name);
65084
+ const st = statSync21(p);
64753
65085
  if (st.isDirectory()) {
64754
65086
  newest = Math.max(newest, newestSourceMtime(p));
64755
65087
  } else if (st.isFile() && /\.ts$/.test(name) && !name.endsWith(".test.ts")) {
@@ -64759,11 +65091,11 @@ function newestSourceMtime(srcDir) {
64759
65091
  return newest;
64760
65092
  }
64761
65093
  function distStale(pkgDir, entry) {
64762
- const distIndex = join25(pkgDir, "dist", `${entry}.js`);
65094
+ const distIndex = join26(pkgDir, "dist", `${entry}.js`);
64763
65095
  if (!existsSync40(distIndex)) return true;
64764
- const distPkg = join25(pkgDir, "dist", "package.json");
64765
- const distStamp = Math.max(statSync20(distIndex).mtimeMs, existsSync40(distPkg) ? statSync20(distPkg).mtimeMs : 0);
64766
- return newestSourceMtime(join25(pkgDir, "src")) > distStamp;
65096
+ const distPkg = join26(pkgDir, "dist", "package.json");
65097
+ const distStamp = Math.max(statSync21(distIndex).mtimeMs, existsSync40(distPkg) ? statSync21(distPkg).mtimeMs : 0);
65098
+ return newestSourceMtime(join26(pkgDir, "src")) > distStamp;
64767
65099
  }
64768
65100
  function distPackageJson(pkgName, entry, serverEntry, version2) {
64769
65101
  const exports = {
@@ -64787,23 +65119,23 @@ function distPackageJson(pkgName, entry, serverEntry, version2) {
64787
65119
  function buildPackages(force = false) {
64788
65120
  for (const [pkg, cfg] of Object.entries(PACKAGES)) {
64789
65121
  const pkgDir = resolve36(root2, "packages", pkg);
64790
- if (!existsSync40(join25(pkgDir, "src"))) continue;
65122
+ if (!existsSync40(join26(pkgDir, "src"))) continue;
64791
65123
  if (!force && !distStale(pkgDir, cfg.entry)) continue;
64792
65124
  console.log(`[build] ${cfg.name} -> tsc`);
64793
65125
  const tscBin = require2.resolve("typescript/bin/tsc");
64794
- const result = spawnSync2(process.execPath, [tscBin, "-p", join25(pkgDir, "tsconfig.build.json")], {
65126
+ const result = spawnSync2(process.execPath, [tscBin, "-p", join26(pkgDir, "tsconfig.build.json")], {
64795
65127
  stdio: "inherit"
64796
65128
  });
64797
65129
  if (result.status !== 0) {
64798
65130
  throw new Error(`tsc failed for ${cfg.name}`);
64799
65131
  }
64800
- const distDir = join25(pkgDir, "dist");
65132
+ const distDir = join26(pkgDir, "dist");
64801
65133
  for (const c of cfg.copy || []) {
64802
- const to = join25(distDir, c.to);
65134
+ const to = join26(distDir, c.to);
64803
65135
  mkdirSync18(dirname25(to), { recursive: true });
64804
- cpSync2(join25(pkgDir, c.from), to, { recursive: true });
65136
+ cpSync2(join26(pkgDir, c.from), to, { recursive: true });
64805
65137
  }
64806
- const srcPkg = JSON.parse(readFileSync36(join25(pkgDir, "package.json"), "utf-8"));
65138
+ const srcPkg = JSON.parse(readFileSync38(join26(pkgDir, "package.json"), "utf-8"));
64807
65139
  if (pkg === "lucide-vesk") {
64808
65140
  const lucideDistPkg = {
64809
65141
  name: srcPkg.name,
@@ -64817,9 +65149,9 @@ function buildPackages(force = false) {
64817
65149
  "./package.json": "./package.json"
64818
65150
  }
64819
65151
  };
64820
- writeFileSync20(join25(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
65152
+ writeFileSync20(join26(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
64821
65153
  } else {
64822
- writeFileSync20(join25(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
65154
+ writeFileSync20(join26(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
64823
65155
  }
64824
65156
  console.log(`[build] ${cfg.name} -> dist`);
64825
65157
  }
@@ -64832,7 +65164,7 @@ if (process.argv[1] && resolve36(process.argv[1]) === fileURLToPath8(import.meta
64832
65164
  }
64833
65165
 
64834
65166
  // src/action-handler.ts
64835
- import { existsSync as existsSync41, readFileSync as readFileSync37, readdirSync as readdirSync12 } from "node:fs";
65167
+ import { existsSync as existsSync41, readFileSync as readFileSync39, readdirSync as readdirSync13 } from "node:fs";
64836
65168
  import { resolve as resolve37 } from "node:path";
64837
65169
 
64838
65170
  // ../compiler/dist/server-cookies.js
@@ -64928,7 +65260,7 @@ function walkVskFiles(dir, out, seen) {
64928
65260
  if (!existsSync41(dir)) return;
64929
65261
  let entries;
64930
65262
  try {
64931
- entries = readdirSync12(dir, { withFileTypes: true });
65263
+ entries = readdirSync13(dir, { withFileTypes: true });
64932
65264
  } catch {
64933
65265
  return;
64934
65266
  }
@@ -64962,7 +65294,7 @@ function candidateSources(appDirPath, routeTree) {
64962
65294
  function registerSource(sourcePath2) {
64963
65295
  if (!existsSync41(sourcePath2)) return;
64964
65296
  try {
64965
- compileFile(readFileSync37(sourcePath2, "utf-8"), { sourcePath: sourcePath2 });
65297
+ compileFile(readFileSync39(sourcePath2, "utf-8"), { sourcePath: sourcePath2 });
64966
65298
  } catch {
64967
65299
  }
64968
65300
  }
@@ -65001,14 +65333,14 @@ async function renderPageHtml(pagePathname, params, ctx2) {
65001
65333
  const pageFilePath = resolve37(ctx2.appDirPath, node.sourceDir, "page.vsk");
65002
65334
  const layoutFilePath = resolve37(ctx2.appDirPath, node.sourceDir, "layout.vsk");
65003
65335
  if (i === chain.length - 1 && node.page && existsSync41(pageFilePath)) {
65004
- const src3 = readFileSync37(pageFilePath, "utf-8");
65336
+ const src3 = readFileSync39(pageFilePath, "utf-8");
65005
65337
  const compName2 = resolveComponentName(src3) || node.page;
65006
65338
  const result = await renderPage(src3, compName2, { params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath });
65007
65339
  body = result.body;
65008
65340
  head = result.head || "";
65009
65341
  }
65010
65342
  if (node.layout && existsSync41(layoutFilePath)) {
65011
- const src3 = readFileSync37(layoutFilePath, "utf-8");
65343
+ const src3 = readFileSync39(layoutFilePath, "utf-8");
65012
65344
  const compName2 = resolveComponentName(src3) || node.layout;
65013
65345
  const result = await renderPage(src3, compName2, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath });
65014
65346
  body = result.body;
@@ -65039,7 +65371,7 @@ ${prettifyHtml(body)}
65039
65371
  }
65040
65372
  const leaf2 = chain.find((n) => n.page);
65041
65373
  if (!leaf2) return null;
65042
- const src2 = readFileSync37(resolve37(ctx2.appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
65374
+ const src2 = readFileSync39(resolve37(ctx2.appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
65043
65375
  const compName = resolveComponentName(src2) || leaf2.page;
65044
65376
  const html = await renderFullPage(src2, compName, { params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: actionCssUrls(ctx2.appDirPath), security: ctx2.security, sourcePath: resolve37(ctx2.appDirPath, leaf2.sourceDir, "page.vsk"), plugins: ctx2.plugins });
65045
65377
  return applyHtmlPlugins(html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>'), ctx2.plugins, { sourcePath: ctx2.url.pathname });
@@ -65206,7 +65538,7 @@ function buildDevErrorPayload(input) {
65206
65538
  payload.column = colMatch ? parseInt(colMatch[1], 10) : 1;
65207
65539
  if (fileExists && payload.line > 0) {
65208
65540
  try {
65209
- const src2 = readFileSync38(fullPath, "utf-8");
65541
+ const src2 = readFileSync40(fullPath, "utf-8");
65210
65542
  const cf = buildCodeframe2(src2, payload.line, payload.column);
65211
65543
  if (cf) {
65212
65544
  cf.file = payload.file || filename;
@@ -65296,9 +65628,9 @@ function resolveRuntimeDir(projectDir) {
65296
65628
  resolve38(import.meta.dirname ?? ".", "..", "..", "runtime", "dist")
65297
65629
  ];
65298
65630
  for (const dir of candidates) {
65299
- if (existsSync42(join26(dir, "ripple-runtime.js"))) return dir;
65300
- const distDir = join26(dir, "dist");
65301
- if (existsSync42(join26(distDir, "ripple-runtime.js"))) return distDir;
65631
+ if (existsSync42(join27(dir, "ripple-runtime.js"))) return dir;
65632
+ const distDir = join27(dir, "dist");
65633
+ if (existsSync42(join27(distDir, "ripple-runtime.js"))) return distDir;
65302
65634
  }
65303
65635
  return null;
65304
65636
  }
@@ -65537,8 +65869,8 @@ function collectRoutePaths(nodes, out = []) {
65537
65869
  function countFilesNamed(dir, name) {
65538
65870
  if (!existsSync42(dir)) return 0;
65539
65871
  let n = 0;
65540
- for (const entry of readdirSync13(dir, { withFileTypes: true })) {
65541
- const p = join26(dir, entry.name);
65872
+ for (const entry of readdirSync14(dir, { withFileTypes: true })) {
65873
+ const p = join27(dir, entry.name);
65542
65874
  if (entry.isDirectory()) n += countFilesNamed(p, name);
65543
65875
  else if (entry.name === name) n++;
65544
65876
  }
@@ -65549,7 +65881,7 @@ function cachedSsrCompile(cache2, src2, filePath) {
65549
65881
  resetVskState(true);
65550
65882
  return compileFile(source, { sourcePath: filePath });
65551
65883
  };
65552
- const st = statSync21(filePath, { throwIfNoEntry: false });
65884
+ const st = statSync22(filePath, { throwIfNoEntry: false });
65553
65885
  if (st) {
65554
65886
  const cur = cache2.get(filePath);
65555
65887
  if (cur && cur.mtimeMs === st.mtimeMs && cur.size === st.size) return cur.result;
@@ -65581,7 +65913,7 @@ async function startDevServer(port, projectDir, config, host) {
65581
65913
  process.exit(1);
65582
65914
  }
65583
65915
  const runtimeDir = runtimeDirUnchecked;
65584
- const veskStateDir = join26(projectDir, ".vesk");
65916
+ const veskStateDir = join27(projectDir, ".vesk");
65585
65917
  const configPluginsRaw = config.plugins || [];
65586
65918
  const configPluginNames = configPluginsRaw.map((p) => typeof p === "string" ? p : p?.name).filter((n) => !!n);
65587
65919
  const rawDevPlugins = config.plugins || [];
@@ -65680,21 +66012,21 @@ async function startDevServer(port, projectDir, config, host) {
65680
66012
  }
65681
66013
  let devGlobalCssContent = "";
65682
66014
  let lastServedCssGlobal = "";
65683
- const appCssPath = join26(appDirPath, "global.css");
65684
- const srcDir = join26(projectDir, "src");
65685
- const cssPath = join26(srcDir, "global.css");
65686
- const altCssPath = join26(srcDir, "app.css");
66015
+ const appCssPath = join27(appDirPath, "global.css");
66016
+ const srcDir = join27(projectDir, "src");
66017
+ const cssPath = join27(srcDir, "global.css");
66018
+ const altCssPath = join27(srcDir, "app.css");
65687
66019
  let rawCss = "";
65688
66020
  let devCssSource = "";
65689
66021
  if (existsSync42(appCssPath)) {
65690
66022
  devCssSource = appCssPath;
65691
- rawCss = readFileSync38(appCssPath, "utf-8");
66023
+ rawCss = readFileSync40(appCssPath, "utf-8");
65692
66024
  } else if (existsSync42(cssPath)) {
65693
66025
  devCssSource = cssPath;
65694
- rawCss = readFileSync38(cssPath, "utf-8");
66026
+ rawCss = readFileSync40(cssPath, "utf-8");
65695
66027
  } else if (existsSync42(altCssPath)) {
65696
66028
  devCssSource = altCssPath;
65697
- rawCss = readFileSync38(altCssPath, "utf-8");
66029
+ rawCss = readFileSync40(altCssPath, "utf-8");
65698
66030
  }
65699
66031
  if (rawCss) {
65700
66032
  const activeAtStart = getActiveDevPlugins();
@@ -65742,22 +66074,22 @@ async function startDevServer(port, projectDir, config, host) {
65742
66074
  }
65743
66075
  const routeChunksBuilt = /* @__PURE__ */ new Set();
65744
66076
  let clientGeneration = 0;
65745
- const devCacheDir = () => join26(projectDir, "node_modules", ".vesk", "dev-cache");
66077
+ const devCacheDir = () => join27(projectDir, "node_modules", ".vesk", "dev-cache");
65746
66078
  function devCacheKey() {
65747
66079
  const parts = [`flags:${!!config.routeDataCache}`];
65748
66080
  const walk9 = (dir) => {
65749
66081
  let entries = [];
65750
66082
  try {
65751
- entries = readdirSync13(dir);
66083
+ entries = readdirSync14(dir);
65752
66084
  } catch {
65753
66085
  return;
65754
66086
  }
65755
66087
  for (const name of entries.sort()) {
65756
66088
  if (name === "node_modules" || name.startsWith(".")) continue;
65757
- const p = join26(dir, name);
66089
+ const p = join27(dir, name);
65758
66090
  let st;
65759
66091
  try {
65760
- st = statSync21(p);
66092
+ st = statSync22(p);
65761
66093
  } catch {
65762
66094
  continue;
65763
66095
  }
@@ -65771,15 +66103,15 @@ async function startDevServer(port, projectDir, config, host) {
65771
66103
  };
65772
66104
  walk9(appDirPath);
65773
66105
  try {
65774
- parts.push(`compiler:${readFileSync38(join26(process.cwd(), "node_modules", "@vesk", "compiler", "package.json"), "utf8")}`);
66106
+ parts.push(`compiler:${readFileSync40(join27(process.cwd(), "node_modules", "@vesk", "compiler", "package.json"), "utf8")}`);
65775
66107
  } catch {
65776
66108
  }
65777
66109
  return createHash3("sha256").update(parts.join("\n")).digest("hex").slice(0, 32);
65778
66110
  }
65779
66111
  function readDevBundleCache() {
65780
66112
  try {
65781
- const file = join26(devCacheDir(), "client-bundle.json");
65782
- const parsed = JSON.parse(readFileSync38(file, "utf8"));
66113
+ const file = join27(devCacheDir(), "client-bundle.json");
66114
+ const parsed = JSON.parse(readFileSync40(file, "utf8"));
65783
66115
  if (parsed.key !== devCacheKey() || typeof parsed.main !== "string" || !Array.isArray(parsed.chunks)) return null;
65784
66116
  return { main: parsed.main, chunks: parsed.chunks };
65785
66117
  } catch {
@@ -65790,8 +66122,8 @@ async function startDevServer(port, projectDir, config, host) {
65790
66122
  try {
65791
66123
  const dir = devCacheDir();
65792
66124
  mkdirSync19(dir, { recursive: true });
65793
- const file = join26(dir, "client-bundle.json");
65794
- const tmp = join26(dir, `client-bundle.${process.pid}.tmp`);
66125
+ const file = join27(dir, "client-bundle.json");
66126
+ const tmp = join27(dir, `client-bundle.${process.pid}.tmp`);
65795
66127
  writeFileSync21(tmp, JSON.stringify({ key: devCacheKey(), main, chunks }), "utf8");
65796
66128
  renameSync2(tmp, file);
65797
66129
  } catch {
@@ -66084,7 +66416,7 @@ async function startDevServer(port, projectDir, config, host) {
66084
66416
  if (!filename) return;
66085
66417
  const kind = classifyHmrWatchPath(filename);
66086
66418
  if (kind === "ignored") return;
66087
- const fullPath = filename.startsWith("/") ? filename : join26(watchDir, filename);
66419
+ const fullPath = filename.startsWith("/") ? filename : join27(watchDir, filename);
66088
66420
  const fileExists = existsSync42(fullPath);
66089
66421
  const bcast = (msg) => {
66090
66422
  const f = globalThis.__vesk_broadcastHmr;
@@ -66109,7 +66441,7 @@ async function startDevServer(port, projectDir, config, host) {
66109
66441
  debounceTimer = setTimeout(async () => {
66110
66442
  const t0 = Date.now();
66111
66443
  try {
66112
- const current3 = fileExists ? readFileSync38(fullPath, "utf-8") : null;
66444
+ const current3 = fileExists ? readFileSync40(fullPath, "utf-8") : null;
66113
66445
  if (eventType !== "rename" && current3 !== null && lastSeenContent.get(fullPath) === current3) {
66114
66446
  LOG.info(`skipped unchanged (${filename})`);
66115
66447
  return;
@@ -66168,7 +66500,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66168
66500
  if (compCode.trim()) fnSources = { _raw: compCode };
66169
66501
  } else if (fileExists && !bundleError) {
66170
66502
  try {
66171
- const src2 = readFileSync38(fullPath, "utf-8");
66503
+ const src2 = readFileSync40(fullPath, "utf-8");
66172
66504
  let compCode = buildHmrEvalSnippet2(
66173
66505
  compileClient2(src2, null, { forceClient: true, sourcePath: fullPath, mdRoots: [projectDir] })
66174
66506
  );
@@ -66252,7 +66584,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66252
66584
  cssDebounceTimer = setTimeout(async () => {
66253
66585
  try {
66254
66586
  if (fileExists) {
66255
- rawCss = readFileSync38(fullPath, "utf-8");
66587
+ rawCss = readFileSync40(fullPath, "utf-8");
66256
66588
  }
66257
66589
  const cssChanged = await rebuildTailwindCss();
66258
66590
  if (cssChanged && typeof globalThis.__vesk_broadcastHmr === "function") {
@@ -66299,8 +66631,8 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66299
66631
  ".json": "application/json",
66300
66632
  ".webmanifest": "application/manifest+json"
66301
66633
  };
66302
- const hmrJsPath = join26(runtimeDir, "hmr-client.js");
66303
- const hmrTsPath = join26(runtimeDir, "hmr-client.ts");
66634
+ const hmrJsPath = join27(runtimeDir, "hmr-client.js");
66635
+ const hmrTsPath = join27(runtimeDir, "hmr-client.ts");
66304
66636
  const hmrClientPath = existsSync42(hmrJsPath) ? hmrJsPath : existsSync42(hmrTsPath) ? hmrTsPath : null;
66305
66637
  function extractCompName2(src2) {
66306
66638
  return resolveComponentName(src2);
@@ -66409,7 +66741,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66409
66741
  }
66410
66742
  if (url.pathname === "/_vesk/hmr" || url.pathname === "/_vesk/hmr.js") {
66411
66743
  if (hmrClientPath) {
66412
- let hmrContent = readFileSync38(hmrClientPath, "utf-8");
66744
+ let hmrContent = readFileSync40(hmrClientPath, "utf-8");
66413
66745
  if (hmrClientPath.endsWith(".ts")) {
66414
66746
  hmrContent = stripCodeTypes2(hmrContent);
66415
66747
  }
@@ -66457,10 +66789,10 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66457
66789
  }
66458
66790
  if (url.pathname !== "/") {
66459
66791
  const staticPath = url.pathname.length > 1 ? resolveWithin2(publicDir, url.pathname.slice(1)) : null;
66460
- if (staticPath && existsSync42(staticPath) && statSync21(staticPath).isFile()) {
66792
+ if (staticPath && existsSync42(staticPath) && statSync22(staticPath).isFile()) {
66461
66793
  const ext = extname7(staticPath);
66462
66794
  res.writeHead(200, { "Content-Type": MIME2[ext] || "application/octet-stream" });
66463
- res.end(readFileSync38(staticPath));
66795
+ res.end(readFileSync40(staticPath));
66464
66796
  return;
66465
66797
  }
66466
66798
  }
@@ -66484,7 +66816,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66484
66816
  return;
66485
66817
  }
66486
66818
  const mwChain = collectMiddlewareChain(routeTree, url.pathname, appDirPath);
66487
- const apiDirPath = join26(appDirPath, "api");
66819
+ const apiDirPath = join27(appDirPath, "api");
66488
66820
  if (url.pathname.startsWith("/api") && existsSync42(apiDirPath)) {
66489
66821
  const apiRoutes = await scanApiRoutes(apiDirPath);
66490
66822
  const apiMatch = matchApiUrl(apiRoutes, req.url || url.pathname);
@@ -66563,7 +66895,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66563
66895
  const nfPath = resolve38(appDirPath, rootNode.sourceDir, "not-found.vsk");
66564
66896
  if (existsSync42(nfPath)) {
66565
66897
  try {
66566
- const nfSrc = readFileSync38(nfPath, "utf-8");
66898
+ const nfSrc = readFileSync40(nfPath, "utf-8");
66567
66899
  const nfCompName = extractCompName2(nfSrc) || rootNode.notFound;
66568
66900
  notFoundHtml = await renderFullPage(nfSrc, nfCompName, { params: {}, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, cached: cachedSsrCompile(ssrCompileCache, nfSrc, nfPath), plugins: getActiveDevPlugins() });
66569
66901
  } catch {
@@ -66618,7 +66950,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66618
66950
  const pageFilePath = resolve38(appDirPath, node.sourceDir, "page.vsk");
66619
66951
  const layoutFilePath = resolve38(appDirPath, node.sourceDir, "layout.vsk");
66620
66952
  if (i === chain.length - 1 && node.page && existsSync42(pageFilePath)) {
66621
- const src2 = readFileSync38(pageFilePath, "utf-8");
66953
+ const src2 = readFileSync40(pageFilePath, "utf-8");
66622
66954
  const compName = extractCompName2(src2) || node.page;
66623
66955
  const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, pageFilePath) });
66624
66956
  body = result.body;
@@ -66626,7 +66958,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
66626
66958
  props = result.props;
66627
66959
  }
66628
66960
  if (node.layout && existsSync42(layoutFilePath)) {
66629
- const src2 = readFileSync38(layoutFilePath, "utf-8");
66961
+ const src2 = readFileSync40(layoutFilePath, "utf-8");
66630
66962
  const compName = extractCompName2(src2) || node.layout;
66631
66963
  const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, layoutFilePath) });
66632
66964
  body = result.body;
@@ -66671,7 +67003,7 @@ ${prettifyHtml(body)}
66671
67003
  } else {
66672
67004
  const leaf2 = chain.find((n) => n.page);
66673
67005
  if (leaf2) {
66674
- const src2 = readFileSync38(resolve38(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
67006
+ const src2 = readFileSync40(resolve38(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
66675
67007
  const compName = extractCompName2(src2) || leaf2.page;
66676
67008
  html = await renderFullPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve38(appDirPath, leaf2.sourceDir, "page.vsk"), cached: cachedSsrCompile(ssrCompileCache, src2, resolve38(appDirPath, leaf2.sourceDir, "page.vsk")), plugins: getActiveDevPlugins() });
66677
67009
  html = html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>');
@@ -66700,7 +67032,7 @@ ${prettifyHtml(body)}
66700
67032
  if (!hasLayout) {
66701
67033
  const leaf2 = chain.find((n) => n.page);
66702
67034
  if (leaf2) {
66703
- const src2 = readFileSync38(resolve38(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
67035
+ const src2 = readFileSync40(resolve38(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
66704
67036
  const compName = extractCompName2(src2) || leaf2.page;
66705
67037
  yield* renderPageStream(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve38(appDirPath, leaf2.sourceDir, "page.vsk"), cached: cachedSsrCompile(ssrCompileCache, src2, resolve38(appDirPath, leaf2.sourceDir, "page.vsk")), plugins: getActiveDevPlugins() });
66706
67038
  } else {
@@ -66716,7 +67048,7 @@ ${prettifyHtml(body)}
66716
67048
  const pageFilePath = resolve38(appDirPath, node.sourceDir, "page.vsk");
66717
67049
  const layoutFilePath = resolve38(appDirPath, node.sourceDir, "layout.vsk");
66718
67050
  if (i === chain.length - 1 && node.page && existsSync42(pageFilePath)) {
66719
- const src2 = readFileSync38(pageFilePath, "utf-8");
67051
+ const src2 = readFileSync40(pageFilePath, "utf-8");
66720
67052
  const compName = extractCompName2(src2) || node.page;
66721
67053
  const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, pageFilePath) });
66722
67054
  body = result.body;
@@ -66724,7 +67056,7 @@ ${prettifyHtml(body)}
66724
67056
  props = result.props;
66725
67057
  }
66726
67058
  if (node.layout && existsSync42(layoutFilePath)) {
66727
- const src2 = readFileSync38(layoutFilePath, "utf-8");
67059
+ const src2 = readFileSync40(layoutFilePath, "utf-8");
66728
67060
  const compName = extractCompName2(src2) || node.layout;
66729
67061
  const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, layoutFilePath) });
66730
67062
  body = result.body;
@@ -66868,7 +67200,7 @@ ${prettifyHtml(body)}
66868
67200
  const nfPath = resolve38(appDirPath, node.sourceDir, "not-found.vsk");
66869
67201
  if (existsSync42(nfPath)) {
66870
67202
  try {
66871
- const nfSrc = readFileSync38(nfPath, "utf-8");
67203
+ const nfSrc = readFileSync40(nfPath, "utf-8");
66872
67204
  const nfCompName = extractCompName2(nfSrc) || node.notFound;
66873
67205
  const html = await renderFullPage(nfSrc, nfCompName, { params: match.params, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, cached: cachedSsrCompile(ssrCompileCache, nfSrc, nfPath), plugins: getActiveDevPlugins() });
66874
67206
  notFoundHtml = injectDevScripts(html);
@@ -66914,7 +67246,7 @@ ${prettifyHtml(body)}
66914
67246
  const errPath = resolve38(appDirPath, node.sourceDir, "error.vsk");
66915
67247
  if (existsSync42(errPath)) {
66916
67248
  try {
66917
- const errSrc = readFileSync38(errPath, "utf-8");
67249
+ const errSrc = readFileSync40(errPath, "utf-8");
66918
67250
  const errCompName = extractCompName2(errSrc) || node.error;
66919
67251
  const errProps = {
66920
67252
  error: err.message,
@@ -66986,7 +67318,7 @@ ${prettifyHtml(body)}
66986
67318
  LOG.ok(`dev server at http://localhost:${port} (listening on ${bindHost})`);
66987
67319
  const routes = collectRoutePaths(routeTree);
66988
67320
  const pageCount = countPages(routeTree);
66989
- const apiCount = countFilesNamed(join26(appDirPath, "api"), "route.ts");
67321
+ const apiCount = countFilesNamed(join27(appDirPath, "api"), "route.ts");
66990
67322
  LOG.info(`${projectDir}`);
66991
67323
  LOG.info(`${pageCount} page${pageCount === 1 ? "" : "s"}: ${routes.join(", ") || "(none)"}`);
66992
67324
  if (apiCount > 0) LOG.info(`${apiCount} api route${apiCount === 1 ? "" : "s"} (app/api)`);
@@ -67313,12 +67645,12 @@ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
67313
67645
  }
67314
67646
  function loadEnvFiles(projectDir) {
67315
67647
  const files = [
67316
- join30(projectDir, ".env"),
67317
- join30(projectDir, ".env.local")
67648
+ join31(projectDir, ".env"),
67649
+ join31(projectDir, ".env.local")
67318
67650
  ];
67319
67651
  for (const filePath of files) {
67320
67652
  if (!existsSync45(filePath)) continue;
67321
- const content = readFileSync42(filePath, "utf-8");
67653
+ const content = readFileSync44(filePath, "utf-8");
67322
67654
  for (const line of content.split("\n")) {
67323
67655
  const trimmed = line.trim();
67324
67656
  if (!trimmed || trimmed.startsWith("#")) continue;
@@ -67487,7 +67819,7 @@ if (cmd === "start") {
67487
67819
  if (cmd === "init") {
67488
67820
  const projectDir = process.cwd();
67489
67821
  const { appDir: appDirPath } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
67490
- const target = join30(appDirPath, "global.css");
67822
+ const target = join31(appDirPath, "global.css");
67491
67823
  if (existsSync45(target)) {
67492
67824
  console.error(`vesk init: ${target} already exists \u2014 skipping`);
67493
67825
  process.exit(0);
@@ -67508,7 +67840,7 @@ if (cmd === "migrate") {
67508
67840
  const projectDir = process.cwd();
67509
67841
  const { runMigrate: runMigrate2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
67510
67842
  const { CODEMODS: CODEMODS2 } = await Promise.resolve().then(() => (init_codemods(), codemods_exports));
67511
- const { version: cliVersion } = JSON.parse(readFileSync42(join30(__dirname10, "..", "package.json"), "utf-8"));
67843
+ const { version: cliVersion } = JSON.parse(readFileSync44(join31(__dirname10, "..", "package.json"), "utf-8"));
67512
67844
  if (args.includes("--list")) {
67513
67845
  console.error("vesk migrate: available codemods");
67514
67846
  for (const c of CODEMODS2) {