@vesk/vesk-cli 0.2.82 → 0.2.84

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 +196 -139
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -20425,11 +20425,9 @@ function collectModuleSpecifiers(ast) {
20425
20425
  });
20426
20426
  return specs;
20427
20427
  }
20428
- function collectModuleBundled(absPath, collector) {
20429
- const existing2 = collector.keysByAbs.get(absPath);
20428
+ function collectModuleBundled(absPath, registry) {
20429
+ const existing2 = registry.getKey(absPath);
20430
20430
  if (existing2) return existing2;
20431
- const key = `__veskMod${collector.keysByAbs.size}`;
20432
- collector.keysByAbs.set(absPath, key);
20433
20431
  const dir = dirname2(absPath);
20434
20432
  if (absPath.endsWith(".json")) {
20435
20433
  let raw2 = "";
@@ -20438,8 +20436,7 @@ function collectModuleBundled(absPath, collector) {
20438
20436
  } catch (err) {
20439
20437
  raw2 = "{}";
20440
20438
  }
20441
- collector.modules.push({ key, code: `module.exports = ${raw2};`, dir, deps: {} });
20442
- return key;
20439
+ return registry.register(absPath, { code: `module.exports = ${raw2};`, dir, deps: {} });
20443
20440
  }
20444
20441
  let mtimeMs = -1;
20445
20442
  try {
@@ -20457,8 +20454,7 @@ function collectModuleBundled(absPath, collector) {
20457
20454
  if (!src2 || !src2.ast) {
20458
20455
  if (src2?.parseError) throw src2.parseError;
20459
20456
  const raw2 = src2 ? src2.raw : "// unreadable during build\nmodule.exports = {};";
20460
- collector.modules.push({ key, code: raw2, dir, deps: {} });
20461
- return key;
20457
+ return registry.register(absPath, { code: raw2, dir, deps: {} });
20462
20458
  }
20463
20459
  let stripped = src2.ast;
20464
20460
  if (hasTsSyntax(src2.ast)) stripped = stripTsTypes(src2.ast);
@@ -20473,14 +20469,14 @@ function collectModuleBundled(absPath, collector) {
20473
20469
  if (!isRelativeSpec(spec)) continue;
20474
20470
  const depPath = resolveSsrModule(spec, dir);
20475
20471
  if (!depPath) continue;
20476
- deps[spec] = collectModuleBundled(depPath, collector);
20472
+ deps[spec] = collectModuleBundled(depPath, registry);
20477
20473
  }
20478
- collector.modules.push({ key, code, dir, deps });
20479
- return key;
20474
+ return registry.register(absPath, { code, dir, deps });
20480
20475
  }
20481
- function collectModuleBundle(importStrs, fromDir, collector) {
20476
+ function collectModuleBundle(importStrs, fromDir, registry, collector) {
20482
20477
  const bindings = [];
20483
20478
  if (!fromDir) return bindings;
20479
+ const seenKeys = /* @__PURE__ */ new Set();
20484
20480
  for (const imp of importStrs) {
20485
20481
  const target = importModuleTarget(imp);
20486
20482
  if (!target || isCompilerOwnedTarget(target) || isValueLessTarget(target)) continue;
@@ -20488,14 +20484,19 @@ function collectModuleBundle(importStrs, fromDir, collector) {
20488
20484
  if (!resolved) {
20489
20485
  continue;
20490
20486
  }
20491
- const key = collectModuleBundled(resolved, collector);
20487
+ const key = collectModuleBundled(resolved, registry);
20488
+ const mod = registry.getModule(key);
20489
+ if (mod && !seenKeys.has(key)) {
20490
+ seenKeys.add(key);
20491
+ collector.modules.push({ key, dir: mod.dir, deps: mod.deps });
20492
+ }
20492
20493
  for (const pair of importBindingPairs(imp)) {
20493
20494
  bindings.push({ local: pair.local, key, kind: pair.imported });
20494
20495
  }
20495
20496
  }
20496
20497
  return bindings;
20497
20498
  }
20498
- var RUNTIME_PREFIXES, EXTENSIONS, BUILTIN_PREFIX, BUILTIN_CACHE, MODULE_CACHE, MAX_CACHE_ENTRIES, depStack, rawSourceCache, BUILD_CACHE_MAX, BUILD_CACHE_EVICT, EVALUATING, EMPTY_ALIASES, ALIAS_CACHE, exportCounter, bundledCodeCache;
20499
+ var RUNTIME_PREFIXES, EXTENSIONS, BUILTIN_PREFIX, BUILTIN_CACHE, MODULE_CACHE, MAX_CACHE_ENTRIES, depStack, rawSourceCache, BUILD_CACHE_MAX, BUILD_CACHE_EVICT, EVALUATING, EMPTY_ALIASES, ALIAS_CACHE, exportCounter, ModuleRegistry, bundledCodeCache;
20499
20500
  var init_module_imports = __esm({
20500
20501
  "../compiler/src/module-imports.ts"() {
20501
20502
  "use strict";
@@ -20517,6 +20518,45 @@ var init_module_imports = __esm({
20517
20518
  EMPTY_ALIASES = { exact: /* @__PURE__ */ new Map(), wildcard: [] };
20518
20519
  ALIAS_CACHE = /* @__PURE__ */ new Map();
20519
20520
  exportCounter = 0;
20521
+ ModuleRegistry = class {
20522
+ keysByAbs = /* @__PURE__ */ new Map();
20523
+ data = /* @__PURE__ */ new Map();
20524
+ has(absPath) {
20525
+ return this.keysByAbs.has(absPath);
20526
+ }
20527
+ getKey(absPath) {
20528
+ return this.keysByAbs.get(absPath);
20529
+ }
20530
+ get size() {
20531
+ return this.data.size;
20532
+ }
20533
+ /** Register a module's transpiled body, returning its globally-unique key. */
20534
+ register(absPath, entry) {
20535
+ const existing2 = this.keysByAbs.get(absPath);
20536
+ if (existing2) return existing2;
20537
+ const key = `__veskMod${this.data.size}`;
20538
+ this.keysByAbs.set(absPath, key);
20539
+ this.data.set(key, entry);
20540
+ return key;
20541
+ }
20542
+ getModule(key) {
20543
+ return this.data.get(key);
20544
+ }
20545
+ /** All registered modules as a plain object keyed by synthetic key, for
20546
+ * passing to `hydratePrecompile` at SSR load time. */
20547
+ modules() {
20548
+ return Object.fromEntries(this.data.entries());
20549
+ }
20550
+ /** Emit a self-contained module registry source file. */
20551
+ toModuleSource() {
20552
+ const parts = [];
20553
+ for (const [key, { code }] of this.data) {
20554
+ parts.push(`${JSON.stringify(key)}: ${JSON.stringify(code)}`);
20555
+ }
20556
+ return `export const __veskModules = {${parts.join(",")}};
20557
+ `;
20558
+ }
20559
+ };
20520
20560
  bundledCodeCache = /* @__PURE__ */ new Map();
20521
20561
  }
20522
20562
  });
@@ -37650,15 +37690,24 @@ export const createHash = () => ({ update: () => {}, digest: () => '' });
37650
37690
  outfile,
37651
37691
  minify: false,
37652
37692
  sourcemap: false,
37653
- // Node targets run from a real deployment root: leave bare packages to the
37654
- // platform's dependency tracer instead of inlining them. Bundling CJS
37655
- // packages into the ESM handler turned their `require('events')` and
37656
- // friends into esbuild's throwing `__require` shim (slintorm's pg driver
37657
- // failed with "Dynamic require of \"events\" is not supported"), and it
37658
- // inflated the single function file to millions of lines — the cold-start
37659
- // memory spike behind the SIGKILLs. Edge targets have no node_modules, so
37660
- // they keep bundling everything.
37661
- packages: nodeBuiltins ? "external" : void 0,
37693
+ // Edge targets have no node_modules so every package is bundled. Node
37694
+ // targets bundle everything too — self-contained functions avoid the
37695
+ // "Cannot find package" failures that externalization causes on hosts that
37696
+ // don't install dependencies for Build Output API functions.
37697
+ // Bundled CJS modules (e.g. pg's internals via slintorm) call
37698
+ // require('events') etc. esbuild rewrites those into its `__require`
37699
+ // shim, which throws 'Dynamic require of "events" is not supported' in
37700
+ // ESM output. Define a real `require` anchored at the bundle URL before
37701
+ // the shim initializes so Node loads builtins and node_modules for real.
37702
+ // `node:module` stays external (platform: 'node'), so Node resolves it
37703
+ // natively at runtime. Edge targets keep the empty-node builtin stubs and
37704
+ // must not get this banner (it would collide with their stubbed
37705
+ // `createRequire`).
37706
+ ...nodeBuiltins ? {
37707
+ banner: {
37708
+ js: 'import { createRequire } from "node:module";\nconst require = createRequire(import.meta.url);\n'
37709
+ }
37710
+ } : {},
37662
37711
  logOverride: { "direct-eval": "silent" },
37663
37712
  plugins
37664
37713
  });
@@ -42405,7 +42454,7 @@ __export(typecheck_exports, {
42405
42454
  formatTypecheckWarnings: () => formatTypecheckWarnings,
42406
42455
  typecheckProject: () => typecheckProject
42407
42456
  });
42408
- import { readFileSync as readFileSync42, readdirSync as readdirSync15, statSync as statSync23 } from "node:fs";
42457
+ import { readFileSync as readFileSync43, readdirSync as readdirSync15, statSync as statSync23 } from "node:fs";
42409
42458
  import { join as join29, dirname as dirname28, normalize, relative as relative10, resolve as resolve40, sep as sep7 } from "node:path";
42410
42459
  import * as ts8 from "typescript";
42411
42460
  function walkProjectFiles(projectRoot) {
@@ -42637,7 +42686,7 @@ function typecheckProject(projectRoot, opts = {}) {
42637
42686
  }
42638
42687
  }
42639
42688
  if (f.endsWith(".vsk")) {
42640
- const src2 = readFileSync42(f, "utf-8");
42689
+ const src2 = readFileSync43(f, "utf-8");
42641
42690
  try {
42642
42691
  parse4(src2);
42643
42692
  } catch (e) {
@@ -48776,7 +48825,7 @@ __export(codemods_exports, {
48776
48825
  applicableCodemods: () => applicableCodemods,
48777
48826
  compareCore: () => compareCore
48778
48827
  });
48779
- import { readFileSync as readFileSync43, existsSync as existsSync44 } from "node:fs";
48828
+ import { readFileSync as readFileSync44, existsSync as existsSync44 } from "node:fs";
48780
48829
  import { join as join30 } from "node:path";
48781
48830
  import { walk as walk8 } from "zimmerframe";
48782
48831
  function safeParse(source, filePath) {
@@ -48802,7 +48851,7 @@ function typesPackageExports(projectDir) {
48802
48851
  ].filter((p) => typeof p === "string" && existsSync44(p));
48803
48852
  for (const path of candidates) {
48804
48853
  try {
48805
- const src2 = readFileSync43(path, "utf-8");
48854
+ const src2 = readFileSync44(path, "utf-8");
48806
48855
  const names = /* @__PURE__ */ new Set();
48807
48856
  for (const line of src2.split("\n")) {
48808
48857
  const m = /^export\s+(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|enum|const|function|let|var|namespace)\s+([A-Za-z_$][\w$]*)/.exec(line);
@@ -48926,14 +48975,14 @@ __export(migrate_exports, {
48926
48975
  detectInstalledVersion: () => detectInstalledVersion,
48927
48976
  runMigrate: () => runMigrate
48928
48977
  });
48929
- import { readFileSync as readFileSync44, writeFileSync as writeFileSync22, existsSync as existsSync45, statSync as statSync24, readdirSync as readdirSync16 } from "node:fs";
48978
+ import { readFileSync as readFileSync45, writeFileSync as writeFileSync22, existsSync as existsSync45, statSync as statSync24, readdirSync as readdirSync16 } from "node:fs";
48930
48979
  import { join as join31, relative as relative11, extname as extname8 } from "node:path";
48931
48980
  function detectInstalledVersion(projectDir, cliVersion) {
48932
48981
  for (const pkg of ["@vesk/vesk-cli", "@vesk/adapter", "@vesk/compiler"]) {
48933
48982
  const p = join31(projectDir, "node_modules", pkg, "package.json");
48934
48983
  if (!existsSync45(p)) continue;
48935
48984
  try {
48936
- const version2 = JSON.parse(readFileSync44(p, "utf-8")).version;
48985
+ const version2 = JSON.parse(readFileSync45(p, "utf-8")).version;
48937
48986
  if (typeof version2 === "string" && version2) return { version: version2, source: pkg };
48938
48987
  } catch {
48939
48988
  }
@@ -48990,7 +49039,7 @@ function runMigrate(options) {
48990
49039
  if (!existsSync45(abs)) continue;
48991
49040
  let source;
48992
49041
  try {
48993
- source = readFileSync44(abs, "utf-8");
49042
+ source = readFileSync45(abs, "utf-8");
48994
49043
  } catch (e) {
48995
49044
  report.skipped.push(`${relPath}: unreadable (${e.message})`);
48996
49045
  continue;
@@ -49030,7 +49079,7 @@ var init_migrate = __esm({
49030
49079
  });
49031
49080
 
49032
49081
  // src/index.ts
49033
- import { readFileSync as readFileSync45, writeFileSync as writeFileSync23, mkdirSync as mkdirSync20, existsSync as existsSync46 } from "fs";
49082
+ import { readFileSync as readFileSync46, writeFileSync as writeFileSync23, mkdirSync as mkdirSync20, existsSync as existsSync46 } from "fs";
49034
49083
  import { resolve as resolve41, join as join32 } from "path";
49035
49084
  import { fileURLToPath as fileURLToPath9 } from "url";
49036
49085
  import { createRequire as createRequire8 } from "module";
@@ -49611,7 +49660,7 @@ function setRuntimeModule2(mod) {
49611
49660
  }
49612
49661
 
49613
49662
  // ../adapter/dist/index.js
49614
- import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, existsSync as existsSync22, readFileSync as readFileSync23 } from "node:fs";
49663
+ import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, existsSync as existsSync22, readFileSync as readFileSync24 } from "node:fs";
49615
49664
  import { resolve as resolve21, dirname as dirname17, relative as relative4, basename as basename3, join as join16 } from "node:path";
49616
49665
  import { fileURLToPath as fileURLToPath5 } from "node:url";
49617
49666
 
@@ -49914,17 +49963,18 @@ init_md_inline();
49914
49963
  init_module_imports();
49915
49964
  import { readFileSync as readFileSync4 } from "node:fs";
49916
49965
  import { dirname as dirname6 } from "node:path";
49917
- function precompileFile(source, sourcePath2) {
49918
- if (sourcePath2 === void 0) return precompileFileInternal(source, sourcePath2, /* @__PURE__ */ new Set());
49966
+ function precompileFile(source, sourcePath2, registry) {
49967
+ const reg = registry ?? new ModuleRegistry();
49968
+ if (sourcePath2 === void 0) return precompileFileInternal(source, sourcePath2, /* @__PURE__ */ new Set(), reg);
49919
49969
  const hit = precompileCache.get(sourcePath2);
49920
49970
  if (hit !== void 0 && hit.source === source) return hit.plan;
49921
- const plan = precompileFileInternal(source, sourcePath2, /* @__PURE__ */ new Set());
49971
+ const plan = precompileFileInternal(source, sourcePath2, /* @__PURE__ */ new Set(), reg);
49922
49972
  if (precompileCache.size >= 512) precompileCache.clear();
49923
49973
  precompileCache.set(sourcePath2, { source, plan });
49924
49974
  return plan;
49925
49975
  }
49926
49976
  var precompileCache = /* @__PURE__ */ new Map();
49927
- function precompileFileInternal(source, sourcePath2, seenImportFiles) {
49977
+ function precompileFileInternal(source, sourcePath2, seenImportFiles, registry) {
49928
49978
  if (sourcePath2) {
49929
49979
  const dir = dirname6(sourcePath2);
49930
49980
  source = inlineMdImportsFrom(source, sourcePath2, guessProjectRoots(dir));
@@ -49945,8 +49995,8 @@ function precompileFileInternal(source, sourcePath2, seenImportFiles) {
49945
49995
  const topLevelCode = transformTopLevelForActions(ir.topLevelCode, "server");
49946
49996
  const metadataSource = ir.metadataSource || null;
49947
49997
  const runtimeImports = ir.imports.slice();
49948
- const collector = { keysByAbs: /* @__PURE__ */ new Map(), modules: [] };
49949
- const bindings = sourcePath2 !== void 0 ? collectModuleBundle(ir.imports, dirname6(sourcePath2), collector) : [];
49998
+ const collector = { modules: [] };
49999
+ const bindings = sourcePath2 !== void 0 ? collectModuleBundle(ir.imports, dirname6(sourcePath2), registry, collector) : [];
49950
50000
  const subFiles = [];
49951
50001
  if (sourcePath2 !== void 0) {
49952
50002
  const vskPaths = [
@@ -49958,7 +50008,7 @@ function precompileFileInternal(source, sourcePath2, seenImportFiles) {
49958
50008
  seenImportFiles.add(importPath);
49959
50009
  try {
49960
50010
  const importedSrc = readFileSync4(importPath, "utf-8");
49961
- const subPlan = precompileFileInternal(importedSrc, importPath, seenImportFiles);
50011
+ const subPlan = precompileFileInternal(importedSrc, importPath, seenImportFiles, registry);
49962
50012
  subFiles.push({ importPath, plan: subPlan });
49963
50013
  } catch {
49964
50014
  }
@@ -50009,6 +50059,7 @@ function resolveCssUrls(opts) {
50009
50059
 
50010
50060
  // ../adapter/src/ssr-function.ts
50011
50061
  init_default_pages();
50062
+ init_module_imports();
50012
50063
  function resolveBoundaryFile(sourceDir, appDir, file) {
50013
50064
  const rel = relative(appDir, sourceDir).split("/").filter(Boolean);
50014
50065
  for (let depth = rel.length; depth >= 0; depth--) {
@@ -50043,12 +50094,12 @@ function routeName(segments) {
50043
50094
  function extractCompName(src2) {
50044
50095
  return resolveComponentName(src2);
50045
50096
  }
50046
- function precompilePlan(entryPath) {
50097
+ function precompilePlan(entryPath, registry) {
50047
50098
  const src2 = readFileSync7(entryPath, "utf-8");
50048
- return JSON.stringify(precompileFile(src2, entryPath));
50099
+ return JSON.stringify(precompileFile(src2, entryPath, registry));
50049
50100
  }
50050
50101
  function hydrateInvoke(planExpr) {
50051
- return `(() => { try { return hydratePrecompile(${planExpr}); } catch { return null; } })()`;
50102
+ return `(() => { try { return hydratePrecompile(${planExpr}, __veskModules); } catch { return null; } })()`;
50052
50103
  }
50053
50104
  function buildParamExtraction(node, urlParts) {
50054
50105
  const parts = [];
@@ -50129,7 +50180,8 @@ function persistedStoreSsrCode() {
50129
50180
  ""
50130
50181
  ].join("\n");
50131
50182
  }
50132
- function generateSsrFunction(routeNode, appDir, outDir, componentMap, options) {
50183
+ function generateSsrFunction(routeNode, appDir, outDir, componentMap, options, registry) {
50184
+ const reg = registry ?? new ModuleRegistry();
50133
50185
  const ancestorLayouts = options?.ancestorLayouts || [];
50134
50186
  const middlewareCode = options?.middlewareCode || null;
50135
50187
  const headExtra = options?.headExtra || null;
@@ -50153,34 +50205,34 @@ function generateSsrFunction(routeNode, appDir, outDir, componentMap, options) {
50153
50205
  const entryPath = resolve7(appDir, entry.sourceDir, "layout.vsk");
50154
50206
  const entrySrc = readFileSync7(entryPath, "utf-8");
50155
50207
  const entryComp = extractCompName(entrySrc) || "Layout";
50156
- const plan = precompilePlan(entryPath);
50208
+ const plan = precompilePlan(entryPath, reg);
50157
50209
  layoutDecls.push({
50158
50210
  comp: JSON.stringify(entryComp),
50159
50211
  plan,
50160
50212
  compiled: hydrateInvoke(plan)
50161
50213
  });
50162
50214
  }
50163
- const pagePlan = precompilePlan(pagePath);
50215
+ const pagePlan = precompilePlan(pagePath, reg);
50164
50216
  const pageComp = extractCompName(readFileSync7(pagePath, "utf-8")) || "Page";
50165
50217
  const errorPath = resolveErrorFile(routeNode.sourceDir, appDir);
50166
50218
  const errorSrc = errorPath ? readFileSync7(errorPath, "utf-8") : null;
50167
50219
  const errorComp = errorPath ? extractCompName(errorSrc) || "Error" : null;
50168
50220
  const errorCompDecl = errorPath ? `const _errorComp = ${JSON.stringify(errorComp)};
50169
50221
  ` : "const _errorComp = null;\n";
50170
- const errorPlanExpr = errorPath ? hydrateInvoke(precompilePlan(errorPath)) : "null";
50222
+ const errorPlanExpr = errorPath ? hydrateInvoke(precompilePlan(errorPath, reg)) : "null";
50171
50223
  const notFoundPath = resolveNotFoundFile(routeNode.sourceDir, appDir);
50172
50224
  const notFoundSrc = notFoundPath ? readFileSync7(notFoundPath, "utf-8") : null;
50173
50225
  const notFoundComp = notFoundPath ? extractCompName(notFoundSrc) || "NotFound" : null;
50174
50226
  const notFoundCompDecl = notFoundPath ? `const _notFoundComp = ${JSON.stringify(notFoundComp)};
50175
50227
  ` : "const _notFoundComp = null;\n";
50176
- const notFoundPlanExpr = notFoundPath ? hydrateInvoke(precompilePlan(notFoundPath)) : "null";
50228
+ const notFoundPlanExpr = notFoundPath ? hydrateInvoke(precompilePlan(notFoundPath, reg)) : "null";
50177
50229
  let src2 = "";
50178
50230
  if (layoutDecls.length > 0) {
50179
50231
  src2 = errorCompDecl + notFoundCompDecl;
50180
50232
  src2 += `const _pageComp = ${JSON.stringify(pageComp)};
50181
50233
  `;
50182
50234
  src2 += `let _pageCompiled = null;
50183
- function __getPageCompiled() { if (!_pageCompiled) _pageCompiled = (() => { try { return hydratePrecompile(${pagePlan}); } catch { return null; } })(); return _pageCompiled; }
50235
+ function __getPageCompiled() { if (!_pageCompiled) _pageCompiled = (() => { try { return hydratePrecompile(${pagePlan}, __veskModules); } catch { return null; } })(); return _pageCompiled; }
50184
50236
  `;
50185
50237
  src2 += `const _layoutCompList = [${layoutDecls.map((d) => d.comp).join(", ")}];
50186
50238
  `;
@@ -50200,7 +50252,7 @@ function __getNotFoundCompiled() { if (!_notFoundCompiled) _notFoundCompiled = $
50200
50252
  src2 += `const _comp = ${JSON.stringify(pageComp)};
50201
50253
  `;
50202
50254
  src2 += `let _compiled = null;
50203
- function __getCompiled() { if (!_compiled) _compiled = (() => { try { return hydratePrecompile(${pagePlan}); } catch { return null; } })(); return _compiled; }
50255
+ function __getCompiled() { if (!_compiled) _compiled = (() => { try { return hydratePrecompile(${pagePlan}, __veskModules); } catch { return null; } })(); return _compiled; }
50204
50256
  `;
50205
50257
  src2 += `let _errorCompiled = null;
50206
50258
  function __getErrorCompiled() { if (!_errorCompiled) _errorCompiled = ${errorPlanExpr}; return _errorCompiled; }
@@ -50223,11 +50275,11 @@ function __getNotFoundCompiled() { if (!_notFoundCompiled) _notFoundCompiled = $
50223
50275
  const compMap = componentMap || /* @__PURE__ */ new Map();
50224
50276
  const regPlans = [];
50225
50277
  for (const [compName, compPath] of compMap) {
50226
- const plan = precompilePlan(compPath);
50278
+ const plan = precompilePlan(compPath, reg);
50227
50279
  regPlans.push(` __regPlans.set(${JSON.stringify(compName)}, ${JSON.stringify(plan)});`);
50228
50280
  compRegEntries.push(` __componentRegistry.set(${JSON.stringify(compName)}, async (props, __registry, __vesk) => {
50229
50281
  let _compiled = __regCompiled.get(${JSON.stringify(compName)});
50230
- if (!_compiled) { _compiled = hydratePrecompile(__regPlans.get(${JSON.stringify(compName)})); __regCompiled.set(${JSON.stringify(compName)}, _compiled); }
50282
+ if (!_compiled) { _compiled = hydratePrecompile(__regPlans.get(${JSON.stringify(compName)}), __veskModules); __regCompiled.set(${JSON.stringify(compName)}, _compiled); }
50231
50283
  const result = await renderPage('', ${JSON.stringify(compName)}, props, __registry, { hydrate: true, cached: _compiled });
50232
50284
  return result.body;
50233
50285
  });`);
@@ -50585,6 +50637,7 @@ function __getNotFoundCompiled() { if (!_notFoundCompiled) _notFoundCompiled = $
50585
50637
  ""
50586
50638
  ].join("\n");
50587
50639
  const funcCode = [
50640
+ "import { __veskModules } from '../__vesk-modules.mjs';",
50588
50641
  "import { renderFullPage, renderPageStream, renderPage, hydratePrecompile, parseCookies, getAction, validateActionInput, issuesToFieldMap, storeDataScriptGlobal, withSsrStore, assertSameOrigin, VeskRequest, installPersistedStoreServerHooks, persistedStoreCookieName, getPersistedStoreKeys, resetPersistedStoreKeys, buildStorePrePaintPayload, storeInitScriptGlobal, storeInitScriptTag } from '../runtime.js';",
50589
50642
  "",
50590
50643
  middlewareCode || "",
@@ -50616,6 +50669,7 @@ function __getNotFoundCompiled() { if (!_notFoundCompiled) _notFoundCompiled = $
50616
50669
 
50617
50670
  // ../adapter/dist/index.js
50618
50671
  init_actions();
50672
+ init_module_imports();
50619
50673
 
50620
50674
  // ../adapter/src/api-function.ts
50621
50675
  init_strip_ts();
@@ -54093,7 +54147,7 @@ async function build2(appDir, options) {
54093
54147
  markPhase("config+dirs");
54094
54148
  const cssSourcePath = resolveUserCssPath(appDir);
54095
54149
  if (cssSourcePath !== null) {
54096
- const cssContent = readFileSync23(cssSourcePath, "utf-8");
54150
+ const cssContent = readFileSync24(cssSourcePath, "utf-8");
54097
54151
  const cssTarget = resolve21(outDir, "static", "global.css");
54098
54152
  const tailwindActive = isTailwindPlugin(pluginsPipelines);
54099
54153
  let finalCss = cssContent;
@@ -54186,22 +54240,22 @@ async function build2(appDir, options) {
54186
54240
  const mwChain2 = collectMiddlewareChain2(routeTree, node.fullPath, appDir);
54187
54241
  let mwCode = null;
54188
54242
  if (mwChain2.length > 0) {
54189
- const mwSources = mwChain2.map((m) => readFileSync23(m.sourcePath, "utf-8"));
54243
+ const mwSources = mwChain2.map((m) => readFileSync24(m.sourcePath, "utf-8"));
54190
54244
  mwCode = compileMiddlewareCode(mwSources);
54191
54245
  }
54192
54246
  const ssrAncestorLayouts = isStandalone ? [] : ancestorLayouts;
54193
- const { funcPath, funcCode, name } = generateSsrFunction(node, appDir, outDir, componentMap, { ancestorLayouts: ssrAncestorLayouts, middlewareCode: mwCode, headExtra: pluginHeadExtra, clientScriptUrl: clientUrl, clientScriptIntegrity: clientIntegrity });
54247
+ const { funcPath, funcCode, name } = generateSsrFunction(node, appDir, outDir, componentMap, { ancestorLayouts: ssrAncestorLayouts, middlewareCode: mwCode, headExtra: pluginHeadExtra, clientScriptUrl: clientUrl, clientScriptIntegrity: clientIntegrity }, registry);
54194
54248
  writeFileSync12(funcPath, funcCode, "utf-8");
54195
54249
  const pagePath = resolve21(appDir, node.sourceDir, "page.vsk");
54196
54250
  if (existsSync22(pagePath)) {
54197
- const src2 = readFileSync23(pagePath, "utf-8");
54251
+ const src2 = readFileSync24(pagePath, "utf-8");
54198
54252
  const actionIds = collectActionIds(src2);
54199
54253
  if (node.layout) {
54200
- const layoutSrc = readFileSync23(resolve21(appDir, node.sourceDir, "layout.vsk"), "utf-8");
54254
+ const layoutSrc = readFileSync24(resolve21(appDir, node.sourceDir, "layout.vsk"), "utf-8");
54201
54255
  actionIds.push(...collectActionIds(layoutSrc));
54202
54256
  }
54203
54257
  for (const a of ssrAncestorLayouts) {
54204
- const ancestorSrc = readFileSync23(resolve21(appDir, a.sourceDir, "layout.vsk"), "utf-8");
54258
+ const ancestorSrc = readFileSync24(resolve21(appDir, a.sourceDir, "layout.vsk"), "utf-8");
54205
54259
  actionIds.push(...collectActionIds(ancestorSrc));
54206
54260
  }
54207
54261
  for (const id of actionIds) {
@@ -54222,7 +54276,9 @@ async function build2(appDir, options) {
54222
54276
  walk9(node.children || [], childAncestorLayouts);
54223
54277
  }
54224
54278
  }
54279
+ const registry = new ModuleRegistry();
54225
54280
  walk9(routeTree);
54281
+ writeFileSync12(resolve21(outDir, "server", "__vesk-modules.mjs"), registry.toModuleSource(), "utf-8");
54226
54282
  markPhase("server runtime + ssr functions");
54227
54283
  const apiRoutes = [];
54228
54284
  function walkApi(nodes) {
@@ -54294,7 +54350,7 @@ async function build2(appDir, options) {
54294
54350
  const manifest = generateManifest(routeTree, ssrRoutes, apiRoutes, prerenderedRoutes, middlewareEnabled, actionMap, pluginHeadExtra, hasEvents);
54295
54351
  const buildId3 = emittedAssets.map((a) => a.hash).join("-");
54296
54352
  manifest.buildId = buildId3.slice(0, 32);
54297
- manifest.veskVersion = JSON.parse(readFileSync23(join16(PACKAGES_DIR_SELF(), "package.json"), "utf-8")).version;
54353
+ manifest.veskVersion = JSON.parse(readFileSync24(join16(PACKAGES_DIR_SELF(), "package.json"), "utf-8")).version;
54298
54354
  manifest.assets = {
54299
54355
  hashed,
54300
54356
  client: { file: clientFileName, url: clientUrl, hash: clientAsset.hash, bytes: clientAsset.bytes, integrity: clientAsset.integrity },
@@ -54348,7 +54404,7 @@ vesk build: done (${outDir})`);
54348
54404
  init_seo_audit();
54349
54405
 
54350
54406
  // src/dev-server.ts
54351
- import { readFileSync as readFileSync41, watch, statSync as statSync22, existsSync as existsSync43, mkdirSync as mkdirSync19, readdirSync as readdirSync14, writeFileSync as writeFileSync21, renameSync as renameSync2 } from "node:fs";
54407
+ import { readFileSync as readFileSync42, watch, statSync as statSync22, existsSync as existsSync43, mkdirSync as mkdirSync19, readdirSync as readdirSync14, writeFileSync as writeFileSync21, renameSync as renameSync2 } from "node:fs";
54352
54408
  import { createHash as createHash3 } from "node:crypto";
54353
54409
  import { resolve as resolve39, extname as extname7, join as join28, dirname as dirname27, relative as relative9 } from "node:path";
54354
54410
  import { createServer as createServer2 } from "node:http";
@@ -57259,7 +57315,7 @@ init_parser();
57259
57315
  init_tokens();
57260
57316
  init_scan();
57261
57317
  init_strip_ts();
57262
- import { readdirSync as readdirSync8, statSync as statSync13, existsSync as existsSync23, readFileSync as readFileSync24 } from "fs";
57318
+ import { readdirSync as readdirSync8, statSync as statSync13, existsSync as existsSync23, readFileSync as readFileSync25 } from "fs";
57263
57319
  import { join as join17, relative as relative5, basename as basename4 } from "path";
57264
57320
  function collapseSlashes2(p) {
57265
57321
  let out = "";
@@ -57280,7 +57336,7 @@ function isStandaloneLayoutFile(layoutPath) {
57280
57336
  try {
57281
57337
  if (!existsSync23(layoutPath))
57282
57338
  return false;
57283
- const src2 = readFileSync24(layoutPath, "utf-8");
57339
+ const src2 = readFileSync25(layoutPath, "utf-8");
57284
57340
  if (!src2.includes("standalone"))
57285
57341
  return false;
57286
57342
  try {
@@ -58333,7 +58389,7 @@ async function runEventHandlers(handlers, name, ctx2) {
58333
58389
  }
58334
58390
 
58335
58391
  // ../compiler/dist/md-inline.js
58336
- import { readFileSync as readFileSync25, existsSync as existsSync27 } from "node:fs";
58392
+ import { readFileSync as readFileSync26, existsSync as existsSync27 } from "node:fs";
58337
58393
  import { dirname as dirname18, join as join20, resolve as resolve23 } from "node:path";
58338
58394
  var MD_EXT_MARKER2 = ".md";
58339
58395
  function looksLikeMarkdownPath2(value) {
@@ -58377,7 +58433,7 @@ function inlineMdContentAttrs2(source, importerDir, mdRoots = []) {
58377
58433
  if (abs !== null) {
58378
58434
  let contents;
58379
58435
  try {
58380
- contents = readFileSync25(abs, "utf-8");
58436
+ contents = readFileSync26(abs, "utf-8");
58381
58437
  } catch {
58382
58438
  out += source[i];
58383
58439
  i++;
@@ -58439,7 +58495,7 @@ function guessProjectRoots2(dir) {
58439
58495
  }
58440
58496
 
58441
58497
  // ../adapter/dist/client-bundle.js
58442
- 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";
58498
+ import { readFileSync as readFileSync27, existsSync as existsSync28, writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, statSync as statSync15, rmSync as rmSync4, mkdtempSync as mkdtempSync2, mkdirSync as mkdirSync12 } from "node:fs";
58443
58499
  import { resolve as resolve24, join as join21, dirname as dirname19, relative as relative6, sep as sep3 } from "node:path";
58444
58500
  import { fileURLToPath as fileURLToPath6 } from "node:url";
58445
58501
  import { tmpdir as tmpdir3 } from "node:os";
@@ -58716,7 +58772,7 @@ function runtimeImportsOf2(filePath, seen = /* @__PURE__ */ new Set()) {
58716
58772
  seen.add(filePath);
58717
58773
  let text;
58718
58774
  try {
58719
- text = readFileSync26(filePath, "utf8");
58775
+ text = readFileSync27(filePath, "utf8");
58720
58776
  } catch {
58721
58777
  return [];
58722
58778
  }
@@ -59067,11 +59123,11 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
59067
59123
  return removeCompiledNodes2(code, isVskImport2);
59068
59124
  }
59069
59125
  function resolveVskImports(filePath, compile) {
59070
- const src2 = readFileSync26(filePath, "utf-8");
59126
+ const src2 = readFileSync27(filePath, "utf-8");
59071
59127
  const resolved = [];
59072
59128
  for (const importPath of collectVskImportPaths(vskImportLines(src2), filePath)) {
59073
59129
  try {
59074
- readFileSync26(importPath);
59130
+ readFileSync27(importPath);
59075
59131
  } catch {
59076
59132
  continue;
59077
59133
  }
@@ -59133,7 +59189,7 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
59133
59189
  compiledFiles++;
59134
59190
  __stats.compiled++;
59135
59191
  __stats.distinct.add(filePath);
59136
- let src2 = readFileSync26(filePath, "utf-8");
59192
+ let src2 = readFileSync27(filePath, "utf-8");
59137
59193
  if (/content=["'][^"']*\.md["']/i.test(src2)) {
59138
59194
  src2 = inlineMdContentAttrs(src2, dirname19(filePath), guessProjectRoots(appDir));
59139
59195
  }
@@ -59526,7 +59582,7 @@ A module-scope statement runs the moment the browser evaluates the chunk, so a s
59526
59582
  if (seen.has(filePath))
59527
59583
  return;
59528
59584
  seen.add(filePath);
59529
- const src2 = readFileSync26(filePath, "utf-8");
59585
+ const src2 = readFileSync27(filePath, "utf-8");
59530
59586
  resolveVskImports(filePath, (p, n) => compileFileMono2(p, n || ""));
59531
59587
  for (const cn of vskComponentNames(src2, filePath))
59532
59588
  componentOwners.claim(cn, filePath);
@@ -59621,7 +59677,7 @@ function buildRuntimeCode2(runtimeDir) {
59621
59677
  for (const f of runtimeFiles) {
59622
59678
  const p = join21(runtimeDir, f);
59623
59679
  if (existsSync28(p)) {
59624
- let src2 = readFileSync26(p, "utf-8");
59680
+ let src2 = readFileSync27(p, "utf-8");
59625
59681
  src2 = stripTypes2(src2);
59626
59682
  src2 = src2.replace(/^import\s+[\s\S]*?from\s+['"](?:\.\/.*?|@vesk\/runtime\/src\/.*?)['"];?\n?/gm, "");
59627
59683
  src2 = src2.replace(/^import\s+['"](?:\.\/.*?|@vesk\/runtime\/src\/.*?)['"];?\n?/gm, "");
@@ -59633,7 +59689,7 @@ ${src2}
59633
59689
  `;
59634
59690
  }
59635
59691
  }
59636
- const indexSrc = readFileSync26(join21(runtimeDir, "index-client.js"), "utf-8");
59692
+ const indexSrc = readFileSync27(join21(runtimeDir, "index-client.js"), "utf-8");
59637
59693
  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())) || [];
59638
59694
  code += "// --- exports ---\n";
59639
59695
  for (const name of [...new Set(exportNames)]) {
@@ -59644,7 +59700,7 @@ ${src2}
59644
59700
  return code;
59645
59701
  }
59646
59702
  function runtimeExportNames2(runtimeDir) {
59647
- const indexSrc = readFileSync26(join21(runtimeDir, "index-client.js"), "utf-8");
59703
+ const indexSrc = readFileSync27(join21(runtimeDir, "index-client.js"), "utf-8");
59648
59704
  const names = /* @__PURE__ */ new Set();
59649
59705
  for (const m of indexSrc.matchAll(/export\s*\{([^}]+)\}\s*from/g)) {
59650
59706
  for (const raw2 of m[1].split(",")) {
@@ -59833,7 +59889,7 @@ if (typeof document !== 'undefined') __router.start();
59833
59889
 
59834
59890
  // ../adapter/dist/paths.js
59835
59891
  import { resolve as resolve25, sep as sep4 } from "node:path";
59836
- import { existsSync as existsSync29, statSync as statSync16, readFileSync as readFileSync27 } from "node:fs";
59892
+ import { existsSync as existsSync29, statSync as statSync16, readFileSync as readFileSync28 } from "node:fs";
59837
59893
  function resolveWithin2(baseDir, relPath) {
59838
59894
  const base = resolve25(baseDir);
59839
59895
  const target = resolve25(baseDir, relPath);
@@ -59857,7 +59913,7 @@ function installMdReadHook2(publicDirs) {
59857
59913
  if (!lower2.endsWith(".md") && !lower2.endsWith(".markdown"))
59858
59914
  continue;
59859
59915
  if (existsSync29(abs) && statSync16(abs).isFile())
59860
- return readFileSync27(abs, "utf8");
59916
+ return readFileSync28(abs, "utf8");
59861
59917
  } catch {
59862
59918
  }
59863
59919
  }
@@ -59924,12 +59980,12 @@ function urlAuthority3(url) {
59924
59980
  }
59925
59981
 
59926
59982
  // ../adapter/dist/dev-api.js
59927
- import { readFileSync as readFileSync30, statSync as statSync18, existsSync as existsSync32, readdirSync as readdirSync10 } from "node:fs";
59983
+ import { readFileSync as readFileSync31, statSync as statSync18, existsSync as existsSync32, readdirSync as readdirSync10 } from "node:fs";
59928
59984
  import { resolve as resolve28 } from "node:path";
59929
59985
 
59930
59986
  // ../adapter/dist/plugins.js
59931
59987
  init_paths();
59932
- import { readFileSync as readFileSync28, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync17 } from "node:fs";
59988
+ import { readFileSync as readFileSync29, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync17 } from "node:fs";
59933
59989
  import { resolve as resolve26, dirname as dirname20, join as join22, extname as extname6, basename as basename6 } from "node:path";
59934
59990
  import { createRequire as createRequire6 } from "node:module";
59935
59991
  import { spawn as spawn2 } from "node:child_process";
@@ -59953,7 +60009,7 @@ function readPluginState2(veskDir) {
59953
60009
  return defaultState2();
59954
60010
  let raw2;
59955
60011
  try {
59956
- raw2 = JSON.parse(readFileSync28(file, "utf-8"));
60012
+ raw2 = JSON.parse(readFileSync29(file, "utf-8"));
59957
60013
  } catch {
59958
60014
  return defaultState2();
59959
60015
  }
@@ -60045,7 +60101,7 @@ function localDir2(base, pkg) {
60045
60101
  function readJsonFile2(file) {
60046
60102
  try {
60047
60103
  if (existsSync30(file))
60048
- return JSON.parse(readFileSync28(file, "utf-8"));
60104
+ return JSON.parse(readFileSync29(file, "utf-8"));
60049
60105
  } catch {
60050
60106
  }
60051
60107
  return null;
@@ -60767,7 +60823,7 @@ function introspectPlugin2(appDir, name) {
60767
60823
  const pkgName = str2(pkgJson.name) ?? name;
60768
60824
  const exportsMap = flattenPackageExports2(pkgJson.exports);
60769
60825
  const dtsPath = resolveDtsPath2(probe, pkgJson);
60770
- const dtsExports = dtsPath ? parseDtsExports2(readFileSync28(dtsPath, "utf-8")) : [];
60826
+ const dtsExports = dtsPath ? parseDtsExports2(readFileSync29(dtsPath, "utf-8")) : [];
60771
60827
  return {
60772
60828
  ok: true,
60773
60829
  name: pkgName,
@@ -60905,7 +60961,7 @@ var __internals2 = {
60905
60961
  };
60906
60962
 
60907
60963
  // ../adapter/dist/dev-config.js
60908
- import { existsSync as existsSync31, readFileSync as readFileSync29, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
60964
+ import { existsSync as existsSync31, readFileSync as readFileSync30, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
60909
60965
  import { tmpdir as tmpdir4 } from "node:os";
60910
60966
  import { resolve as resolve27, dirname as dirname21, join as join23 } from "node:path";
60911
60967
  init_parser();
@@ -60964,7 +61020,7 @@ async function readConfig2(projectDir) {
60964
61020
  const { path, isTs } = findConfigFile2(projectDir);
60965
61021
  if (!path)
60966
61022
  return { path: null, exists: false, source: "", config: {} };
60967
- const source = readFileSync29(path, "utf-8");
61023
+ const source = readFileSync30(path, "utf-8");
60968
61024
  const config = await parseConfigSource(source, isTs, projectDir);
60969
61025
  return { path, exists: true, source, config };
60970
61026
  }
@@ -61806,7 +61862,7 @@ export default defineConfig({
61806
61862
  await writeConfigSource2(projectDir, source);
61807
61863
  return;
61808
61864
  }
61809
- source = readFileSync29(path, "utf-8");
61865
+ source = readFileSync30(path, "utf-8");
61810
61866
  const existingImport = findPluginImportAst(source, pkg);
61811
61867
  let importName;
61812
61868
  if (existingImport) {
@@ -61886,7 +61942,7 @@ async function removePluginFromConfig2(projectDir, pkg) {
61886
61942
  const { path } = findConfigFile2(projectDir);
61887
61943
  if (!path)
61888
61944
  return false;
61889
- let source = readFileSync29(path, "utf-8");
61945
+ let source = readFileSync30(path, "utf-8");
61890
61946
  const original = source;
61891
61947
  const existingImport = findPluginImportAst(source, pkg);
61892
61948
  let importName = existingImport ? existingImport.name : null;
@@ -62007,7 +62063,7 @@ function createDevApiRouter2(opts) {
62007
62063
  return badRequest2("no vesk.config file to edit");
62008
62064
  if (!isTs)
62009
62065
  return badRequest2("single-key toggle edits only apply to vesk.config.ts (use the source editor for .js)");
62010
- const patched = applyConfigToggle2(readFileSync30(path, "utf-8"), b.key, b.value);
62066
+ const patched = applyConfigToggle2(readFileSync31(path, "utf-8"), b.key, b.value);
62011
62067
  if (patched === null)
62012
62068
  return badRequest2("could not safely edit the config object; use the source editor");
62013
62069
  const cfg = await writeConfigSource2(projectDir, patched);
@@ -62053,7 +62109,7 @@ function createDevApiRouter2(opts) {
62053
62109
  return jsonStatus(200, { ok: true, path: target, directory: true, entries });
62054
62110
  }
62055
62111
  if (statSync18(resolved).isFile()) {
62056
- return jsonStatus(200, { ok: true, path: target, directory: false, content: readFileSync30(resolved, "utf-8") });
62112
+ return jsonStatus(200, { ok: true, path: target, directory: false, content: readFileSync31(resolved, "utf-8") });
62057
62113
  }
62058
62114
  return badRequest2("unsupported file type");
62059
62115
  } catch (e) {
@@ -62189,7 +62245,7 @@ function createDevApiRouter2(opts) {
62189
62245
  return {
62190
62246
  status: 200,
62191
62247
  headers: { "Content-Type": icon.mime, "Cache-Control": "private, max-age=60" },
62192
- body: readFileSync30(icon.file).toString("base64"),
62248
+ body: readFileSync31(icon.file).toString("base64"),
62193
62249
  encoding: "base64"
62194
62250
  };
62195
62251
  }
@@ -62246,7 +62302,7 @@ function produceDiagnostics(input) {
62246
62302
  }
62247
62303
 
62248
62304
  // ../agentic/dist/checkpoints.js
62249
- 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";
62305
+ import { existsSync as existsSync33, mkdirSync as mkdirSync15, readFileSync as readFileSync32, writeFileSync as writeFileSync16, statSync as statSync19, unlinkSync as unlinkSync5, rmSync as rmSync6, renameSync } from "node:fs";
62250
62306
  import { join as join24, resolve as resolve29, dirname as dirname22, sep as sep5 } from "node:path";
62251
62307
  import { randomUUID as nodeRandomUUID } from "node:crypto";
62252
62308
  function generateId() {
@@ -62398,7 +62454,7 @@ function readJson(filePath, fallback) {
62398
62454
  try {
62399
62455
  if (!existsSync33(filePath))
62400
62456
  return fallback;
62401
- const raw2 = readFileSync31(filePath, "utf-8");
62457
+ const raw2 = readFileSync32(filePath, "utf-8");
62402
62458
  if (raw2.trim() === "")
62403
62459
  return fallback;
62404
62460
  return JSON.parse(raw2);
@@ -62518,7 +62574,7 @@ function rollback(projectDir, id) {
62518
62574
  }
62519
62575
 
62520
62576
  // ../agentic/dist/config.js
62521
- import { readFileSync as readFileSync32, writeFileSync as writeFileSync17, existsSync as existsSync34, mkdirSync as mkdirSync16, chmodSync } from "node:fs";
62577
+ import { readFileSync as readFileSync33, writeFileSync as writeFileSync17, existsSync as existsSync34, mkdirSync as mkdirSync16, chmodSync } from "node:fs";
62522
62578
  import { resolve as resolve30, dirname as dirname23 } from "node:path";
62523
62579
  var DEFAULT_CONFIG = {
62524
62580
  provider: "openai",
@@ -62567,7 +62623,7 @@ function readDotenvValue(projectDir, key, def = null) {
62567
62623
  const p = dotenvPath(projectDir);
62568
62624
  if (!existsSync34(p))
62569
62625
  return def;
62570
- const content = readFileSync32(p, "utf-8");
62626
+ const content = readFileSync33(p, "utf-8");
62571
62627
  for (const rawLine of content.split("\n")) {
62572
62628
  const line = rawLine.trim();
62573
62629
  if (!line || line.startsWith("#"))
@@ -62595,7 +62651,7 @@ function writeDotenvValue(projectDir, key, value) {
62595
62651
  let out = "";
62596
62652
  let replaced = false;
62597
62653
  if (existsSync34(p)) {
62598
- const lines = readFileSync32(p, "utf-8").split("\n");
62654
+ const lines = readFileSync33(p, "utf-8").split("\n");
62599
62655
  for (const rawLine of lines) {
62600
62656
  const trimmed = rawLine.trim();
62601
62657
  const eq = trimmed.indexOf("=");
@@ -62625,7 +62681,7 @@ function loadAgenticConfig(projectDir) {
62625
62681
  let cfg = { ...DEFAULT_CONFIG };
62626
62682
  try {
62627
62683
  if (existsSync34(p))
62628
- cfg = { ...cfg, ...JSON.parse(readFileSync32(p, "utf-8")) };
62684
+ cfg = { ...cfg, ...JSON.parse(readFileSync33(p, "utf-8")) };
62629
62685
  } catch {
62630
62686
  }
62631
62687
  let hasKey = false;
@@ -62668,7 +62724,7 @@ function getProviderSpecificKey(projectDir, provider) {
62668
62724
  try {
62669
62725
  const pp2 = providerKeyPath(projectDir, prov);
62670
62726
  if (existsSync34(pp2)) {
62671
- const v = readFileSync32(pp2, "utf-8").trim();
62727
+ const v = readFileSync33(pp2, "utf-8").trim();
62672
62728
  if (v)
62673
62729
  return v;
62674
62730
  }
@@ -62716,7 +62772,7 @@ function getApiKey(projectDir, provider) {
62716
62772
  try {
62717
62773
  const pp2 = providerKeyPath(projectDir, prov);
62718
62774
  if (existsSync34(pp2)) {
62719
- const v = readFileSync32(pp2, "utf-8").trim();
62775
+ const v = readFileSync33(pp2, "utf-8").trim();
62720
62776
  if (v)
62721
62777
  return v;
62722
62778
  }
@@ -62739,7 +62795,7 @@ function getApiKey(projectDir, provider) {
62739
62795
  }
62740
62796
 
62741
62797
  // ../agentic/dist/dev-api.js
62742
- import { existsSync as existsSync35, readFileSync as readFileSync33 } from "node:fs";
62798
+ import { existsSync as existsSync35, readFileSync as readFileSync34 } from "node:fs";
62743
62799
  import { resolve as resolve31 } from "node:path";
62744
62800
 
62745
62801
  // ../agentic/dist/providers/openai.js
@@ -63112,7 +63168,7 @@ function getPerProviderKeyRaw(projectDir, provider) {
63112
63168
  try {
63113
63169
  const p = resolve31(projectDir, ".vesk", "agentic", "keys", `${sanitizeProviderName(prov)}.key`);
63114
63170
  if (existsSync35(p)) {
63115
- const v = readFileSync33(p, "utf-8").trim();
63171
+ const v = readFileSync34(p, "utf-8").trim();
63116
63172
  if (v)
63117
63173
  return v;
63118
63174
  }
@@ -63973,7 +64029,7 @@ var Agent = class {
63973
64029
  };
63974
64030
 
63975
64031
  // ../agentic/dist/tools/vesk.js
63976
- import { existsSync as existsSync36, readFileSync as readFileSync34, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync11, statSync as statSync20 } from "node:fs";
64032
+ import { existsSync as existsSync36, readFileSync as readFileSync35, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync11, statSync as statSync20 } from "node:fs";
63977
64033
  import { resolve as resolve32, join as join25, dirname as dirname24, sep as sep6 } from "node:path";
63978
64034
  function resolveWithin3(baseDir, relPath) {
63979
64035
  const base = resolve32(baseDir);
@@ -63992,7 +64048,7 @@ function readPluginState3(veskDir) {
63992
64048
  if (!existsSync36(file))
63993
64049
  return { version: 1, plugins: [] };
63994
64050
  try {
63995
- const raw2 = JSON.parse(readFileSync34(file, "utf-8"));
64051
+ const raw2 = JSON.parse(readFileSync35(file, "utf-8"));
63996
64052
  if (!raw2 || typeof raw2 !== "object")
63997
64053
  return { version: 1, plugins: [] };
63998
64054
  if (raw2.version !== 1)
@@ -64192,7 +64248,7 @@ function createVeskTools(deps) {
64192
64248
  if (cfgInfo.path && existsSync36(cfgInfo.path)) {
64193
64249
  configExists = true;
64194
64250
  try {
64195
- configSource = readFileSync34(cfgInfo.path, "utf-8").slice(0, 8e3);
64251
+ configSource = readFileSync35(cfgInfo.path, "utf-8").slice(0, 8e3);
64196
64252
  } catch {
64197
64253
  configSource = null;
64198
64254
  }
@@ -64201,7 +64257,7 @@ function createVeskTools(deps) {
64201
64257
  const pkgPath = resolve32(projectDir, "package.json");
64202
64258
  if (existsSync36(pkgPath)) {
64203
64259
  try {
64204
- packageJson = JSON.parse(readFileSync34(pkgPath, "utf-8"));
64260
+ packageJson = JSON.parse(readFileSync35(pkgPath, "utf-8"));
64205
64261
  } catch {
64206
64262
  packageJson = null;
64207
64263
  }
@@ -64289,7 +64345,7 @@ function createVeskTools(deps) {
64289
64345
  return jsonOk({ ok: true, path: rel, directory: true, entries: entries.slice(0, 200) });
64290
64346
  }
64291
64347
  if (st.isFile()) {
64292
- const content = readFileSync34(resolved, "utf-8");
64348
+ const content = readFileSync35(resolved, "utf-8");
64293
64349
  const capped = content.length > 2e4 ? content.slice(0, 2e4) + "\n/* truncated */" : content;
64294
64350
  return jsonOk({ ok: true, path: rel, directory: false, content: capped, size: content.length });
64295
64351
  }
@@ -64325,7 +64381,7 @@ function createVeskTools(deps) {
64325
64381
  if (!info.path || !existsSync36(info.path)) {
64326
64382
  return jsonOk({ ok: true, path: null, exists: false, source: "", config: {} });
64327
64383
  }
64328
- const source = readFileSync34(info.path, "utf-8");
64384
+ const source = readFileSync35(info.path, "utf-8");
64329
64385
  return jsonOk({ ok: true, path: info.path, exists: true, source, config: null });
64330
64386
  } catch (e) {
64331
64387
  return jsonError(e instanceof Error ? e.message : String(e));
@@ -64383,7 +64439,7 @@ function createVeskTools(deps) {
64383
64439
  const contained = resolveWithin3(projectDir, info.path.slice(projectDir.length + 1));
64384
64440
  if (!contained)
64385
64441
  return jsonError("path escapes project root");
64386
- const current3 = readFileSync34(info.path, "utf-8");
64442
+ const current3 = readFileSync35(info.path, "utf-8");
64387
64443
  const patched = applySimpleConfigToggle(current3, key, a.value);
64388
64444
  if (patched === null)
64389
64445
  return jsonError("could not safely edit the config object; use the source editor");
@@ -64706,7 +64762,7 @@ function createVeskTools(deps) {
64706
64762
  return jsonError("path escapes project root");
64707
64763
  if (!existsSync36(file))
64708
64764
  return jsonError(`checkpoint not found: ${checkpointId}`, { checkpointId });
64709
- const raw2 = readFileSync34(file, "utf-8");
64765
+ const raw2 = readFileSync35(file, "utf-8");
64710
64766
  let data2;
64711
64767
  try {
64712
64768
  data2 = JSON.parse(raw2);
@@ -64789,9 +64845,10 @@ function renderDefaultNotFoundPage2(opts = {}) {
64789
64845
  }
64790
64846
 
64791
64847
  // ../adapter/dist/ssr-function.js
64792
- import { readFileSync as readFileSync35, existsSync as existsSync37 } from "node:fs";
64848
+ import { readFileSync as readFileSync36, existsSync as existsSync37 } from "node:fs";
64793
64849
  import { resolve as resolve33, relative as relative7, join as join26 } from "node:path";
64794
64850
  init_default_pages();
64851
+ init_module_imports();
64795
64852
  function resolveBoundaryFileForUrl2(pathname, appDir, file) {
64796
64853
  const segments = pathname.split("/").filter(Boolean);
64797
64854
  for (let depth = segments.length; depth >= 0; depth--) {
@@ -64804,7 +64861,7 @@ function resolveBoundaryFileForUrl2(pathname, appDir, file) {
64804
64861
  }
64805
64862
 
64806
64863
  // ../adapter/dist/css.js
64807
- import { readFileSync as readFileSync36, existsSync as existsSync38 } from "node:fs";
64864
+ import { readFileSync as readFileSync37, existsSync as existsSync38 } from "node:fs";
64808
64865
  import { resolve as resolve34 } from "node:path";
64809
64866
  var GLOBAL_CSS_URL2 = "/_vesk/static/global.css";
64810
64867
  function resolveUserCssPath2(appDir) {
@@ -64831,7 +64888,7 @@ function resolveCssUrls2(opts) {
64831
64888
  // ../adapter/dist/hmr.js
64832
64889
  init_client_codegen();
64833
64890
  import { WebSocketServer } from "ws";
64834
- import { readFileSync as readFileSync37, existsSync as existsSync39, writeFileSync as writeFileSync19 } from "node:fs";
64891
+ import { readFileSync as readFileSync38, existsSync as existsSync39, writeFileSync as writeFileSync19 } from "node:fs";
64835
64892
  import { resolve as resolve35, dirname as dirname25 } from "node:path";
64836
64893
  import { fileURLToPath as fileURLToPath7 } from "node:url";
64837
64894
  init_default_pages();
@@ -65075,7 +65132,7 @@ function buildErrorPayload(error, filename, opts = {}) {
65075
65132
  for (const absPath of candidates) {
65076
65133
  try {
65077
65134
  if (existsSync39(absPath)) {
65078
- src2 = readFileSync37(absPath, "utf-8");
65135
+ src2 = readFileSync38(absPath, "utf-8");
65079
65136
  resolvedAbsPath = absPath;
65080
65137
  break;
65081
65138
  }
@@ -65123,7 +65180,7 @@ function buildErrorPayload(error, filename, opts = {}) {
65123
65180
  }
65124
65181
 
65125
65182
  // ../adapter/dist/ssr-error.js
65126
- import { existsSync as existsSync40, readFileSync as readFileSync38 } from "node:fs";
65183
+ import { existsSync as existsSync40, readFileSync as readFileSync39 } from "node:fs";
65127
65184
  import { relative as relative8, resolve as resolve36 } from "node:path";
65128
65185
 
65129
65186
  // ../adapter/dist/error-codeframe.js
@@ -65354,7 +65411,7 @@ function readIfFile(absPath) {
65354
65411
  try {
65355
65412
  if (!existsSync40(absPath))
65356
65413
  return null;
65357
- return readFileSync38(absPath, "utf-8");
65414
+ return readFileSync39(absPath, "utf-8");
65358
65415
  } catch {
65359
65416
  return null;
65360
65417
  }
@@ -65502,7 +65559,7 @@ function renderDevErrorPage(payload, opts) {
65502
65559
 
65503
65560
  // src/build-packages.ts
65504
65561
  import { spawnSync as spawnSync2 } from "node:child_process";
65505
- import { cpSync as cpSync2, existsSync as existsSync41, mkdirSync as mkdirSync18, readFileSync as readFileSync39, readdirSync as readdirSync12, statSync as statSync21, writeFileSync as writeFileSync20 } from "node:fs";
65562
+ import { cpSync as cpSync2, existsSync as existsSync41, mkdirSync as mkdirSync18, readFileSync as readFileSync40, readdirSync as readdirSync12, statSync as statSync21, writeFileSync as writeFileSync20 } from "node:fs";
65506
65563
  import { createRequire as createRequire7 } from "node:module";
65507
65564
  import { dirname as dirname26, join as join27, resolve as resolve37 } from "node:path";
65508
65565
  import { fileURLToPath as fileURLToPath8 } from "node:url";
@@ -65594,7 +65651,7 @@ function buildPackages(force = false) {
65594
65651
  mkdirSync18(dirname26(to), { recursive: true });
65595
65652
  cpSync2(join27(pkgDir, c.from), to, { recursive: true });
65596
65653
  }
65597
- const srcPkg = JSON.parse(readFileSync39(join27(pkgDir, "package.json"), "utf-8"));
65654
+ const srcPkg = JSON.parse(readFileSync40(join27(pkgDir, "package.json"), "utf-8"));
65598
65655
  if (pkg === "lucide-vesk") {
65599
65656
  const lucideDistPkg = {
65600
65657
  name: srcPkg.name,
@@ -65623,7 +65680,7 @@ if (process.argv[1] && resolve37(process.argv[1]) === fileURLToPath8(import.meta
65623
65680
  }
65624
65681
 
65625
65682
  // src/action-handler.ts
65626
- import { existsSync as existsSync42, readFileSync as readFileSync40, readdirSync as readdirSync13 } from "node:fs";
65683
+ import { existsSync as existsSync42, readFileSync as readFileSync41, readdirSync as readdirSync13 } from "node:fs";
65627
65684
  import { resolve as resolve38 } from "node:path";
65628
65685
 
65629
65686
  // ../compiler/dist/server-cookies.js
@@ -65753,7 +65810,7 @@ function candidateSources(appDirPath, routeTree) {
65753
65810
  function registerSource(sourcePath2) {
65754
65811
  if (!existsSync42(sourcePath2)) return;
65755
65812
  try {
65756
- compileFile(readFileSync40(sourcePath2, "utf-8"), { sourcePath: sourcePath2 });
65813
+ compileFile(readFileSync41(sourcePath2, "utf-8"), { sourcePath: sourcePath2 });
65757
65814
  } catch {
65758
65815
  }
65759
65816
  }
@@ -65792,14 +65849,14 @@ async function renderPageHtml(pagePathname, params, ctx2) {
65792
65849
  const pageFilePath = resolve38(ctx2.appDirPath, node.sourceDir, "page.vsk");
65793
65850
  const layoutFilePath = resolve38(ctx2.appDirPath, node.sourceDir, "layout.vsk");
65794
65851
  if (i === chain.length - 1 && node.page && existsSync42(pageFilePath)) {
65795
- const src3 = readFileSync40(pageFilePath, "utf-8");
65852
+ const src3 = readFileSync41(pageFilePath, "utf-8");
65796
65853
  const compName2 = resolveComponentName(src3) || node.page;
65797
65854
  const result = await renderPage(src3, compName2, { params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath });
65798
65855
  body = result.body;
65799
65856
  head = result.head || "";
65800
65857
  }
65801
65858
  if (node.layout && existsSync42(layoutFilePath)) {
65802
- const src3 = readFileSync40(layoutFilePath, "utf-8");
65859
+ const src3 = readFileSync41(layoutFilePath, "utf-8");
65803
65860
  const compName2 = resolveComponentName(src3) || node.layout;
65804
65861
  const result = await renderPage(src3, compName2, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath });
65805
65862
  body = result.body;
@@ -65830,7 +65887,7 @@ ${prettifyHtml(body)}
65830
65887
  }
65831
65888
  const leaf2 = chain.find((n) => n.page);
65832
65889
  if (!leaf2) return null;
65833
- const src2 = readFileSync40(resolve38(ctx2.appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
65890
+ const src2 = readFileSync41(resolve38(ctx2.appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
65834
65891
  const compName = resolveComponentName(src2) || leaf2.page;
65835
65892
  const html = await renderFullPage(src2, compName, { params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: actionCssUrls(ctx2.appDirPath), security: ctx2.security, sourcePath: resolve38(ctx2.appDirPath, leaf2.sourceDir, "page.vsk"), plugins: ctx2.plugins });
65836
65893
  return applyHtmlPlugins(html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>'), ctx2.plugins, { sourcePath: ctx2.url.pathname });
@@ -66003,7 +66060,7 @@ function buildDevErrorPayload(input) {
66003
66060
  payload.column = colMatch ? parseInt(colMatch[1], 10) : 1;
66004
66061
  if (fileExists && payload.line > 0) {
66005
66062
  try {
66006
- const src2 = readFileSync41(fullPath, "utf-8");
66063
+ const src2 = readFileSync42(fullPath, "utf-8");
66007
66064
  const cf = buildCodeframe2(src2, payload.line, payload.column);
66008
66065
  if (cf) {
66009
66066
  cf.file = payload.file || filename;
@@ -66486,13 +66543,13 @@ async function startDevServer(port, projectDir, config, host) {
66486
66543
  let devCssSource = "";
66487
66544
  if (existsSync43(appCssPath)) {
66488
66545
  devCssSource = appCssPath;
66489
- rawCss = readFileSync41(appCssPath, "utf-8");
66546
+ rawCss = readFileSync42(appCssPath, "utf-8");
66490
66547
  } else if (existsSync43(cssPath)) {
66491
66548
  devCssSource = cssPath;
66492
- rawCss = readFileSync41(cssPath, "utf-8");
66549
+ rawCss = readFileSync42(cssPath, "utf-8");
66493
66550
  } else if (existsSync43(altCssPath)) {
66494
66551
  devCssSource = altCssPath;
66495
- rawCss = readFileSync41(altCssPath, "utf-8");
66552
+ rawCss = readFileSync42(altCssPath, "utf-8");
66496
66553
  }
66497
66554
  if (rawCss) {
66498
66555
  const activeAtStart = getActiveDevPlugins();
@@ -66570,7 +66627,7 @@ async function startDevServer(port, projectDir, config, host) {
66570
66627
  };
66571
66628
  walk9(appDirPath);
66572
66629
  try {
66573
- parts.push(`compiler:${readFileSync41(join28(process.cwd(), "node_modules", "@vesk", "compiler", "package.json"), "utf8")}`);
66630
+ parts.push(`compiler:${readFileSync42(join28(process.cwd(), "node_modules", "@vesk", "compiler", "package.json"), "utf8")}`);
66574
66631
  } catch {
66575
66632
  }
66576
66633
  return createHash3("sha256").update(parts.join("\n")).digest("hex").slice(0, 32);
@@ -66578,7 +66635,7 @@ async function startDevServer(port, projectDir, config, host) {
66578
66635
  function readDevBundleCache() {
66579
66636
  try {
66580
66637
  const file = join28(devCacheDir(), "client-bundle.json");
66581
- const parsed = JSON.parse(readFileSync41(file, "utf8"));
66638
+ const parsed = JSON.parse(readFileSync42(file, "utf8"));
66582
66639
  if (parsed.key !== devCacheKey() || typeof parsed.main !== "string" || !Array.isArray(parsed.chunks)) return null;
66583
66640
  return { main: parsed.main, chunks: parsed.chunks };
66584
66641
  } catch {
@@ -66984,7 +67041,7 @@ async function startDevServer(port, projectDir, config, host) {
66984
67041
  debounceTimer = setTimeout(async () => {
66985
67042
  const t0 = Date.now();
66986
67043
  try {
66987
- const current3 = fileExists ? readFileSync41(fullPath, "utf-8") : null;
67044
+ const current3 = fileExists ? readFileSync42(fullPath, "utf-8") : null;
66988
67045
  if (eventType !== "rename" && current3 !== null && lastSeenContent.get(fullPath) === current3) {
66989
67046
  LOG.info(`skipped unchanged (${filename})`);
66990
67047
  return;
@@ -67043,7 +67100,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
67043
67100
  if (compCode.trim()) fnSources = { _raw: compCode };
67044
67101
  } else if (fileExists && !bundleError) {
67045
67102
  try {
67046
- const src2 = readFileSync41(fullPath, "utf-8");
67103
+ const src2 = readFileSync42(fullPath, "utf-8");
67047
67104
  let compCode = buildHmrEvalSnippet2(
67048
67105
  compileClient2(src2, null, { forceClient: true, sourcePath: fullPath, mdRoots: [projectDir] })
67049
67106
  );
@@ -67127,7 +67184,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
67127
67184
  cssDebounceTimer = setTimeout(async () => {
67128
67185
  try {
67129
67186
  if (fileExists) {
67130
- rawCss = readFileSync41(fullPath, "utf-8");
67187
+ rawCss = readFileSync42(fullPath, "utf-8");
67131
67188
  }
67132
67189
  const cssChanged = await rebuildTailwindCss();
67133
67190
  if (cssChanged && typeof globalThis.__vesk_broadcastHmr === "function") {
@@ -67290,7 +67347,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
67290
67347
  }
67291
67348
  if (url.pathname === "/_vesk/hmr" || url.pathname === "/_vesk/hmr.js") {
67292
67349
  if (hmrClientPath) {
67293
- let hmrContent = readFileSync41(hmrClientPath, "utf-8");
67350
+ let hmrContent = readFileSync42(hmrClientPath, "utf-8");
67294
67351
  if (hmrClientPath.endsWith(".ts")) {
67295
67352
  hmrContent = stripCodeTypes2(hmrContent);
67296
67353
  }
@@ -67341,7 +67398,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
67341
67398
  if (staticPath && existsSync43(staticPath) && statSync22(staticPath).isFile()) {
67342
67399
  const ext = extname7(staticPath);
67343
67400
  res.writeHead(200, { "Content-Type": MIME2[ext] || "application/octet-stream" });
67344
- res.end(readFileSync41(staticPath));
67401
+ res.end(readFileSync42(staticPath));
67345
67402
  return;
67346
67403
  }
67347
67404
  }
@@ -67442,7 +67499,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
67442
67499
  const nfPath = resolveBoundaryFileForUrl2(url.pathname, appDirPath, "not-found.vsk");
67443
67500
  if (nfPath) {
67444
67501
  try {
67445
- const nfSrc = readFileSync41(nfPath, "utf-8");
67502
+ const nfSrc = readFileSync42(nfPath, "utf-8");
67446
67503
  const nfCompName = extractCompName2(nfSrc) || "NotFound";
67447
67504
  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() });
67448
67505
  } catch {
@@ -67486,7 +67543,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
67486
67543
  const pageFilePath = resolve39(appDirPath, node.sourceDir, "page.vsk");
67487
67544
  const layoutFilePath = resolve39(appDirPath, node.sourceDir, "layout.vsk");
67488
67545
  if (i === chain.length - 1 && node.page && existsSync43(pageFilePath)) {
67489
- const src2 = readFileSync41(pageFilePath, "utf-8");
67546
+ const src2 = readFileSync42(pageFilePath, "utf-8");
67490
67547
  const compName = extractCompName2(src2) || node.page;
67491
67548
  const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, pageFilePath) });
67492
67549
  body = result.body;
@@ -67494,7 +67551,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
67494
67551
  props = result.props;
67495
67552
  }
67496
67553
  if (node.layout && existsSync43(layoutFilePath)) {
67497
- const src2 = readFileSync41(layoutFilePath, "utf-8");
67554
+ const src2 = readFileSync42(layoutFilePath, "utf-8");
67498
67555
  const compName = extractCompName2(src2) || node.layout;
67499
67556
  const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, layoutFilePath) });
67500
67557
  body = result.body;
@@ -67539,7 +67596,7 @@ ${prettifyHtml(body)}
67539
67596
  } else {
67540
67597
  const leaf2 = chain.find((n) => n.page);
67541
67598
  if (leaf2) {
67542
- const src2 = readFileSync41(resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
67599
+ const src2 = readFileSync42(resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
67543
67600
  const compName = extractCompName2(src2) || leaf2.page;
67544
67601
  html = await renderFullPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), cached: cachedSsrCompile(ssrCompileCache, src2, resolve39(appDirPath, leaf2.sourceDir, "page.vsk")), plugins: getActiveDevPlugins() });
67545
67602
  html = html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>');
@@ -67568,7 +67625,7 @@ ${prettifyHtml(body)}
67568
67625
  if (!hasLayout) {
67569
67626
  const leaf2 = chain.find((n) => n.page);
67570
67627
  if (leaf2) {
67571
- const src2 = readFileSync41(resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
67628
+ const src2 = readFileSync42(resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
67572
67629
  const compName = extractCompName2(src2) || leaf2.page;
67573
67630
  yield* renderPageStream(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), cached: cachedSsrCompile(ssrCompileCache, src2, resolve39(appDirPath, leaf2.sourceDir, "page.vsk")), plugins: getActiveDevPlugins() });
67574
67631
  } else {
@@ -67584,7 +67641,7 @@ ${prettifyHtml(body)}
67584
67641
  const pageFilePath = resolve39(appDirPath, node.sourceDir, "page.vsk");
67585
67642
  const layoutFilePath = resolve39(appDirPath, node.sourceDir, "layout.vsk");
67586
67643
  if (i === chain.length - 1 && node.page && existsSync43(pageFilePath)) {
67587
- const src2 = readFileSync41(pageFilePath, "utf-8");
67644
+ const src2 = readFileSync42(pageFilePath, "utf-8");
67588
67645
  const compName = extractCompName2(src2) || node.page;
67589
67646
  const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, pageFilePath) });
67590
67647
  body = result.body;
@@ -67592,7 +67649,7 @@ ${prettifyHtml(body)}
67592
67649
  props = result.props;
67593
67650
  }
67594
67651
  if (node.layout && existsSync43(layoutFilePath)) {
67595
- const src2 = readFileSync41(layoutFilePath, "utf-8");
67652
+ const src2 = readFileSync42(layoutFilePath, "utf-8");
67596
67653
  const compName = extractCompName2(src2) || node.layout;
67597
67654
  const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, layoutFilePath) });
67598
67655
  body = result.body;
@@ -67736,7 +67793,7 @@ ${prettifyHtml(body)}
67736
67793
  const nfPath = resolve39(appDirPath, node.sourceDir, "not-found.vsk");
67737
67794
  if (existsSync43(nfPath)) {
67738
67795
  try {
67739
- const nfSrc = readFileSync41(nfPath, "utf-8");
67796
+ const nfSrc = readFileSync42(nfPath, "utf-8");
67740
67797
  const nfCompName = extractCompName2(nfSrc) || node.notFound;
67741
67798
  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() });
67742
67799
  notFoundHtml = injectDevScripts(html);
@@ -67782,7 +67839,7 @@ ${prettifyHtml(body)}
67782
67839
  const errPath = resolve39(appDirPath, node.sourceDir, "error.vsk");
67783
67840
  if (existsSync43(errPath)) {
67784
67841
  try {
67785
- const errSrc = readFileSync41(errPath, "utf-8");
67842
+ const errSrc = readFileSync42(errPath, "utf-8");
67786
67843
  const errCompName = extractCompName2(errSrc) || node.error;
67787
67844
  const errProps = {
67788
67845
  error: err.message,
@@ -68187,7 +68244,7 @@ function loadEnvFiles(projectDir) {
68187
68244
  ];
68188
68245
  for (const filePath of files) {
68189
68246
  if (!existsSync46(filePath)) continue;
68190
- const content = readFileSync45(filePath, "utf-8");
68247
+ const content = readFileSync46(filePath, "utf-8");
68191
68248
  for (const line of content.split("\n")) {
68192
68249
  const trimmed = line.trim();
68193
68250
  if (!trimmed || trimmed.startsWith("#")) continue;
@@ -68401,7 +68458,7 @@ if (cmd === "migrate") {
68401
68458
  const projectDir = process.cwd();
68402
68459
  const { runMigrate: runMigrate2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
68403
68460
  const { CODEMODS: CODEMODS2 } = await Promise.resolve().then(() => (init_codemods(), codemods_exports));
68404
- const { version: cliVersion } = JSON.parse(readFileSync45(join32(__dirname10, "..", "package.json"), "utf-8"));
68461
+ const { version: cliVersion } = JSON.parse(readFileSync46(join32(__dirname10, "..", "package.json"), "utf-8"));
68405
68462
  if (args.includes("--list")) {
68406
68463
  console.error("vesk migrate: available codemods");
68407
68464
  for (const c of CODEMODS2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.82",
3
+ "version": "0.2.84",
4
4
  "type": "module",
5
5
  "description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "main": "./dist/cli.js",
10
10
  "dependencies": {
11
- "@vesk/adapter": "^0.2.82",
12
- "@vesk/compiler": "^0.2.82",
13
- "@vesk/plugin-tailwind": "^0.2.82",
14
- "@vesk/runtime": "^0.2.82",
11
+ "@vesk/adapter": "^0.2.84",
12
+ "@vesk/compiler": "^0.2.84",
13
+ "@vesk/plugin-tailwind": "^0.2.84",
14
+ "@vesk/runtime": "^0.2.84",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",