@vesk/vesk-cli 0.2.34 → 0.2.36

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 +183 -140
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -2762,6 +2762,12 @@ var init_hydrate = __esm({
2762
2762
  }
2763
2763
  const el = tm.comment.nextElementSibling;
2764
2764
  if (this.isAlreadyAdopted(tm, el)) continue;
2765
+ if (el === null && tm.identity !== null && tm.identity.charAt(0) === "c") {
2766
+ tm.state = "claimed";
2767
+ tm.comment.remove();
2768
+ this.idx++;
2769
+ continue;
2770
+ }
2765
2771
  if (tag && el && el.tagName.toLowerCase() !== tag) {
2766
2772
  reportMiss(
2767
2773
  "tag-mismatch",
@@ -2778,6 +2784,7 @@ var init_hydrate = __esm({
2778
2784
  }
2779
2785
  this.recordAdopted(adopted);
2780
2786
  this.retireAliases(adopted);
2787
+ this.retireAliasesOf(adopted);
2781
2788
  tm.state = "claimed";
2782
2789
  return adopted;
2783
2790
  }
@@ -2807,6 +2814,12 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
2807
2814
  }
2808
2815
  const el = tm.comment.nextElementSibling;
2809
2816
  if (this.isAlreadyAdopted(tm, el)) continue;
2817
+ if (el === null && tm.identity !== null && tm.identity.charAt(0) === "c") {
2818
+ tm.state = "claimed";
2819
+ tm.comment.remove();
2820
+ this.idx++;
2821
+ continue;
2822
+ }
2810
2823
  if (tag && el && el.tagName.toLowerCase() !== tag) {
2811
2824
  reportMiss(
2812
2825
  "tag-mismatch",
@@ -2823,6 +2836,7 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
2823
2836
  }
2824
2837
  this.recordAdopted(adopted);
2825
2838
  this.retireAliases(adopted);
2839
+ this.retireAliasesOf(adopted);
2826
2840
  tm.state = "claimed";
2827
2841
  return adopted;
2828
2842
  }
@@ -18216,115 +18230,12 @@ var init_tokens = __esm({
18216
18230
  }
18217
18231
  });
18218
18232
 
18219
- // ../compiler/src/vsk-imports.ts
18220
- import { dirname as dirname2, resolve } from "node:path";
18221
- import { existsSync as existsSync2 } from "node:fs";
18222
- import { print as print2 } from "esrap";
18223
- import ts2 from "esrap/languages/ts";
18224
- function vskImportTarget(importText) {
18225
- const spec = importModuleTarget(importText);
18226
- if (spec === null || !spec.endsWith(".vsk")) return null;
18227
- const tokens = tokenizeCode(importText);
18228
- if (tokens === null) return null;
18229
- const hasFrom = tokens.some((t) => t.label === "name" && t.value === "from");
18230
- if (!hasFrom) return null;
18231
- return spec;
18232
- }
18233
- function extractImportStatements(source) {
18234
- try {
18235
- const ast = parse4(source, { filename: "imports.vsk" });
18236
- const out = [];
18237
- for (const stmt of ast.body) {
18238
- if (stmt.type === "ImportDeclaration") {
18239
- out.push(source.slice(stmt.start, stmt.end));
18240
- }
18241
- }
18242
- return out;
18243
- } catch {
18244
- return tokenExtractImportStatements(source);
18245
- }
18246
- }
18247
- function tokenExtractImportStatements(source) {
18248
- const tokens = tokenizeCode(source);
18249
- if (tokens === null) return [];
18250
- const out = [];
18251
- for (let i = 0; i < tokens.length; i++) {
18252
- if (tokens[i].label !== "import") continue;
18253
- const start = tokens[i].start;
18254
- let lastStringEnd = -1;
18255
- let end = -1;
18256
- let j = i + 1;
18257
- while (j < tokens.length) {
18258
- if (tokens[j].label === ";") {
18259
- end = tokens[j].end;
18260
- break;
18261
- }
18262
- if (tokens[j].label === "import") break;
18263
- if (tokens[j].label === "string") lastStringEnd = tokens[j].end;
18264
- j++;
18265
- }
18266
- if (end === -1) end = lastStringEnd !== -1 ? lastStringEnd : tokens[i].end;
18267
- const stmt = source.slice(start, end).trim();
18268
- if (stmt) out.push(stmt);
18269
- if (tokens[j] && tokens[j].label === ";") i = j;
18270
- }
18271
- return out;
18272
- }
18273
- function collectVskImportPaths(imports, sourcePath2) {
18274
- const out = [];
18275
- for (const imp of imports) {
18276
- if (stripTypeImport(imp) === null) continue;
18277
- const target = vskImportTarget(imp);
18278
- if (!target || !target.startsWith(".")) continue;
18279
- const full = resolve(dirname2(sourcePath2), target);
18280
- if (existsSync2(full)) out.push(full);
18281
- }
18282
- return out;
18283
- }
18284
- function vskImportLines(source) {
18285
- return extractImportStatements(source).filter((imp) => vskImportTarget(imp) !== null && stripTypeImport(imp) !== null);
18286
- }
18287
- function isTypeOnlyImport(stmt) {
18288
- if (!stmt || stmt.type !== "ImportDeclaration") return false;
18289
- if (stmt.importKind === "type") return true;
18290
- const specs = stmt.specifiers || [];
18291
- return specs.length > 0 && specs.every((s) => s.importKind === "type");
18292
- }
18293
- function stripTypeImport(importSrc) {
18294
- let ast;
18295
- try {
18296
- ast = parse4(importSrc, { filename: "import.mjs" });
18297
- } catch {
18298
- return importSrc;
18299
- }
18300
- const stmt = (ast.body || []).find((n) => n.type === "ImportDeclaration");
18301
- if (!stmt) return importSrc;
18302
- if (isTypeOnlyImport(stmt)) return null;
18303
- const specs = stmt.specifiers || [];
18304
- const kept = specs.filter((s) => s.importKind !== "type");
18305
- if (specs.length > 0 && kept.length === 0) return null;
18306
- if (kept.length === specs.length) return importSrc;
18307
- try {
18308
- const rewritten = { ...stmt, specifiers: kept };
18309
- return print2({ type: "Program", body: [rewritten], sourceType: "module" }, ts2()).code.trim();
18310
- } catch {
18311
- return importSrc;
18312
- }
18313
- }
18314
- var init_vsk_imports = __esm({
18315
- "../compiler/src/vsk-imports.ts"() {
18316
- "use strict";
18317
- init_parser();
18318
- init_tokens();
18319
- }
18320
- });
18321
-
18322
18233
  // ../compiler/src/module-imports.ts
18323
- import { readFileSync as readFileSync2, existsSync as existsSync3, realpathSync, statSync } from "node:fs";
18234
+ import { readFileSync as readFileSync2, existsSync as existsSync2, realpathSync, statSync } from "node:fs";
18324
18235
  import { createRequire as createRequire2 } from "node:module";
18325
- import { dirname as dirname3, extname, isAbsolute, join as join2, resolve as resolve2 } from "node:path";
18326
- import { print as print3 } from "esrap";
18327
- import ts3 from "esrap/languages/ts";
18236
+ import { dirname as dirname2, extname, isAbsolute, join as join2, resolve } from "node:path";
18237
+ import { print as print2 } from "esrap";
18238
+ import ts2 from "esrap/languages/ts";
18328
18239
  import { walk as walk2 } from "zimmerframe";
18329
18240
  function cacheModule(p, val) {
18330
18241
  MODULE_CACHE.delete(p);
@@ -18382,7 +18293,7 @@ function localValueImportNames(importStrs) {
18382
18293
  }
18383
18294
  function applyLocalModuleImports(__vesk, importStrs, sourcePath2) {
18384
18295
  if (!sourcePath2) return;
18385
- const fromDir = dirname3(sourcePath2);
18296
+ const fromDir = dirname2(sourcePath2);
18386
18297
  for (const imp of importStrs) {
18387
18298
  const target = importModuleTarget(imp);
18388
18299
  if (!target || isCompilerOwnedTarget(target) || isValueLessTarget(target)) continue;
@@ -18444,7 +18355,7 @@ function loadSsrModule(absPath) {
18444
18355
  const src2 = readSsrSource(absPath);
18445
18356
  const body = src2?.ast?.body || [];
18446
18357
  if (src2 && isPureReexportBarrel(body)) {
18447
- exportsObj = createLazyBarrelExports(buildBarrelSpec(body), dirname3(absPath));
18358
+ exportsObj = createLazyBarrelExports(buildBarrelSpec(body), dirname2(absPath));
18448
18359
  } else {
18449
18360
  exportsObj = {};
18450
18361
  EVALUATING.set(absPath, exportsObj);
@@ -18659,7 +18570,7 @@ function evaluateModuleFile(absPath, exportsObj, src2) {
18659
18570
  if (!ast) {
18660
18571
  try {
18661
18572
  const fn = new Function("require", "module", "exports", "__dirname", "__filename", raw2);
18662
- fn(createModuleRequire(dirname3(absPath)), { exports: exportsObj }, exportsObj, dirname3(absPath), absPath);
18573
+ fn(createModuleRequire(dirname2(absPath)), { exports: exportsObj }, exportsObj, dirname2(absPath), absPath);
18663
18574
  } catch (err) {
18664
18575
  console.warn(`[vesk] SSR: failed to load ${absPath}: ${err?.message ?? String(err)}`);
18665
18576
  return false;
@@ -18681,7 +18592,7 @@ function evaluateModuleFile(absPath, exportsObj, src2) {
18681
18592
  const body = esmToCjs(stripped.body);
18682
18593
  try {
18683
18594
  const fn = new Function("require", "module", "exports", "__dirname", "__filename", "'use strict';\n" + body);
18684
- fn(createModuleRequire(dirname3(absPath)), { exports: exportsObj }, exportsObj, dirname3(absPath), absPath);
18595
+ fn(createModuleRequire(dirname2(absPath)), { exports: exportsObj }, exportsObj, dirname2(absPath), absPath);
18685
18596
  } catch (err) {
18686
18597
  console.warn(`[vesk] SSR: failed to load ${absPath}: ${err?.message ?? String(err)}`);
18687
18598
  return false;
@@ -18775,7 +18686,7 @@ function findTsconfigPath(fromDir) {
18775
18686
  for (let depth = 0; depth < 64; depth++) {
18776
18687
  const st = statOrNull(join2(dir, "tsconfig.json"));
18777
18688
  if (st && st.isFile()) return join2(dir, "tsconfig.json");
18778
- const parent = dirname3(dir);
18689
+ const parent = dirname2(dir);
18779
18690
  if (parent === dir) break;
18780
18691
  dir = parent;
18781
18692
  }
@@ -18796,13 +18707,13 @@ function buildAliases(tsconfig) {
18796
18707
  }
18797
18708
  const co = parsed?.compilerOptions;
18798
18709
  if (!co || typeof co.paths !== "object" || co.paths === null) return EMPTY_ALIASES;
18799
- const configDir = dirname3(tsconfig);
18800
- const baseUrl = typeof co.baseUrl === "string" && co.baseUrl.length > 0 ? resolve2(configDir, co.baseUrl) : configDir;
18710
+ const configDir = dirname2(tsconfig);
18711
+ const baseUrl = typeof co.baseUrl === "string" && co.baseUrl.length > 0 ? resolve(configDir, co.baseUrl) : configDir;
18801
18712
  const exact = /* @__PURE__ */ new Map();
18802
18713
  const wildcard = [];
18803
18714
  for (const [key, value] of Object.entries(co.paths)) {
18804
18715
  if (!Array.isArray(value)) continue;
18805
- const targets = value.filter((t) => typeof t === "string").map((t) => resolve2(baseUrl, t));
18716
+ const targets = value.filter((t) => typeof t === "string").map((t) => resolve(baseUrl, t));
18806
18717
  if (targets.length === 0) continue;
18807
18718
  const star = key.indexOf("*");
18808
18719
  if (star === -1) exact.set(key, targets);
@@ -18843,12 +18754,12 @@ function resolveAliasModule(spec, fromDir) {
18843
18754
  }
18844
18755
  function resolveImportPath(spec, fromDir) {
18845
18756
  if (spec.startsWith("./") || spec.startsWith("../")) {
18846
- const base = resolve2(fromDir, spec);
18757
+ const base = resolve(fromDir, spec);
18847
18758
  if (extname(base)) return base;
18848
18759
  for (const suffix of EXTENSIONS) {
18849
- if (existsSync3(base + suffix)) return base + suffix;
18760
+ if (existsSync2(base + suffix)) return base + suffix;
18850
18761
  }
18851
- if (existsSync3(`${base}.vsk`)) return `${base}.vsk`;
18762
+ if (existsSync2(`${base}.vsk`)) return `${base}.vsk`;
18852
18763
  return `${base}.ts`;
18853
18764
  }
18854
18765
  if (!isAbsolute(spec)) {
@@ -18860,11 +18771,11 @@ function resolveImportPath(spec, fromDir) {
18860
18771
  function resolveSsrModule(specifier, fromDir) {
18861
18772
  let resolved = null;
18862
18773
  if (specifier === "." || specifier === "..") {
18863
- resolved = probeFile(resolve2(fromDir, specifier));
18774
+ resolved = probeFile(resolve(fromDir, specifier));
18864
18775
  } else if (isAbsolute(specifier)) {
18865
- resolved = probeFile(resolve2(specifier));
18776
+ resolved = probeFile(resolve(specifier));
18866
18777
  } else if (specifier.startsWith("./") || specifier.startsWith("../")) {
18867
- resolved = probeFile(resolve2(fromDir, specifier));
18778
+ resolved = probeFile(resolve(fromDir, specifier));
18868
18779
  } else {
18869
18780
  const aliased = resolveAliasModule(specifier, fromDir);
18870
18781
  if (aliased) return toRealPath(aliased);
@@ -18878,7 +18789,7 @@ function resolveSsrModule(specifier, fromDir) {
18878
18789
  resolved = found;
18879
18790
  break;
18880
18791
  }
18881
- const parent = dirname3(dir);
18792
+ const parent = dirname2(dir);
18882
18793
  if (parent === dir) break;
18883
18794
  dir = parent;
18884
18795
  }
@@ -18941,7 +18852,7 @@ function probeFile(base) {
18941
18852
  try {
18942
18853
  const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
18943
18854
  if (typeof pkg.main === "string" && pkg.main.length > 0) {
18944
- const viaMain = probeFile(resolve2(base, pkg.main));
18855
+ const viaMain = probeFile(resolve(base, pkg.main));
18945
18856
  if (viaMain) return viaMain;
18946
18857
  }
18947
18858
  } catch {
@@ -18966,7 +18877,7 @@ function astName(node) {
18966
18877
  }
18967
18878
  function printNode(node) {
18968
18879
  try {
18969
- return print3(node, ts3()).code.trim();
18880
+ return print2(node, ts2()).code.trim();
18970
18881
  } catch {
18971
18882
  return "";
18972
18883
  }
@@ -19140,7 +19051,7 @@ function collectModuleBundled(absPath, collector) {
19140
19051
  if (existing) return existing;
19141
19052
  const key = `__veskMod${collector.keysByAbs.size}`;
19142
19053
  collector.keysByAbs.set(absPath, key);
19143
- const dir = dirname3(absPath);
19054
+ const dir = dirname2(absPath);
19144
19055
  if (absPath.endsWith(".json")) {
19145
19056
  let raw2 = "";
19146
19057
  try {
@@ -19208,6 +19119,115 @@ var init_module_imports = __esm({
19208
19119
  }
19209
19120
  });
19210
19121
 
19122
+ // ../compiler/src/vsk-imports.ts
19123
+ import { dirname as dirname3, resolve as resolve2 } from "node:path";
19124
+ import { existsSync as existsSync3 } from "node:fs";
19125
+ import { print as print3 } from "esrap";
19126
+ import ts3 from "esrap/languages/ts";
19127
+ function vskImportTarget(importText) {
19128
+ const spec = importModuleTarget(importText);
19129
+ if (spec === null || !spec.endsWith(".vsk")) return null;
19130
+ const tokens = tokenizeCode(importText);
19131
+ if (tokens === null) return null;
19132
+ const hasFrom = tokens.some((t) => t.label === "name" && t.value === "from");
19133
+ if (!hasFrom) return null;
19134
+ return spec;
19135
+ }
19136
+ function extractImportStatements(source) {
19137
+ try {
19138
+ const ast = parse4(source, { filename: "imports.vsk" });
19139
+ const out = [];
19140
+ for (const stmt of ast.body) {
19141
+ if (stmt.type === "ImportDeclaration") {
19142
+ out.push(source.slice(stmt.start, stmt.end));
19143
+ }
19144
+ }
19145
+ return out;
19146
+ } catch {
19147
+ return tokenExtractImportStatements(source);
19148
+ }
19149
+ }
19150
+ function tokenExtractImportStatements(source) {
19151
+ const tokens = tokenizeCode(source);
19152
+ if (tokens === null) return [];
19153
+ const out = [];
19154
+ for (let i = 0; i < tokens.length; i++) {
19155
+ if (tokens[i].label !== "import") continue;
19156
+ const start = tokens[i].start;
19157
+ let lastStringEnd = -1;
19158
+ let end = -1;
19159
+ let j = i + 1;
19160
+ while (j < tokens.length) {
19161
+ if (tokens[j].label === ";") {
19162
+ end = tokens[j].end;
19163
+ break;
19164
+ }
19165
+ if (tokens[j].label === "import") break;
19166
+ if (tokens[j].label === "string") lastStringEnd = tokens[j].end;
19167
+ j++;
19168
+ }
19169
+ if (end === -1) end = lastStringEnd !== -1 ? lastStringEnd : tokens[i].end;
19170
+ const stmt = source.slice(start, end).trim();
19171
+ if (stmt) out.push(stmt);
19172
+ if (tokens[j] && tokens[j].label === ";") i = j;
19173
+ }
19174
+ return out;
19175
+ }
19176
+ function collectVskImportPaths(imports, sourcePath2) {
19177
+ const out = [];
19178
+ for (const imp of imports) {
19179
+ if (stripTypeImport(imp) === null) continue;
19180
+ const target = vskImportTarget(imp);
19181
+ if (!target) continue;
19182
+ if (target.startsWith(".")) {
19183
+ const full = resolve2(dirname3(sourcePath2), target);
19184
+ if (existsSync3(full)) out.push(full);
19185
+ continue;
19186
+ }
19187
+ const aliased = resolveImportPath(target, dirname3(sourcePath2));
19188
+ if (aliased !== target && existsSync3(aliased)) out.push(aliased);
19189
+ }
19190
+ return out;
19191
+ }
19192
+ function vskImportLines(source) {
19193
+ return extractImportStatements(source).filter((imp) => vskImportTarget(imp) !== null && stripTypeImport(imp) !== null);
19194
+ }
19195
+ function isTypeOnlyImport(stmt) {
19196
+ if (!stmt || stmt.type !== "ImportDeclaration") return false;
19197
+ if (stmt.importKind === "type") return true;
19198
+ const specs = stmt.specifiers || [];
19199
+ return specs.length > 0 && specs.every((s) => s.importKind === "type");
19200
+ }
19201
+ function stripTypeImport(importSrc) {
19202
+ let ast;
19203
+ try {
19204
+ ast = parse4(importSrc, { filename: "import.mjs" });
19205
+ } catch {
19206
+ return importSrc;
19207
+ }
19208
+ const stmt = (ast.body || []).find((n) => n.type === "ImportDeclaration");
19209
+ if (!stmt) return importSrc;
19210
+ if (isTypeOnlyImport(stmt)) return null;
19211
+ const specs = stmt.specifiers || [];
19212
+ const kept = specs.filter((s) => s.importKind !== "type");
19213
+ if (specs.length > 0 && kept.length === 0) return null;
19214
+ if (kept.length === specs.length) return importSrc;
19215
+ try {
19216
+ const rewritten = { ...stmt, specifiers: kept };
19217
+ return print3({ type: "Program", body: [rewritten], sourceType: "module" }, ts3()).code.trim();
19218
+ } catch {
19219
+ return importSrc;
19220
+ }
19221
+ }
19222
+ var init_vsk_imports = __esm({
19223
+ "../compiler/src/vsk-imports.ts"() {
19224
+ "use strict";
19225
+ init_parser();
19226
+ init_module_imports();
19227
+ init_tokens();
19228
+ }
19229
+ });
19230
+
19211
19231
  // ../compiler/src/ir-generator.ts
19212
19232
  function parseExprNode(text) {
19213
19233
  try {
@@ -19976,6 +19996,13 @@ function getReturnArgument(node) {
19976
19996
  }
19977
19997
  return null;
19978
19998
  }
19999
+ function getReturnStatement(node) {
20000
+ if (node.type === "ReturnStatement") return node;
20001
+ if (node.type === "BlockStatement" && node.body.length === 1 && node.body[0].type === "ReturnStatement") {
20002
+ return node.body[0];
20003
+ }
20004
+ return null;
20005
+ }
19979
20006
  function isStatementMode(bodyStmts) {
19980
20007
  if (bodyStmts.some((s) => s.type === "JSXElement" || s.type === "JSXExpressionContainer" || s.type === "JSXFragment")) return true;
19981
20008
  for (const stmt of bodyStmts) {
@@ -20105,9 +20132,9 @@ function processStatementModeBody(source, bodyStmts, filename) {
20105
20132
  const refName = getComponentRefName(stmt);
20106
20133
  if (refName) nodes.push(new ComponentRef(refName));
20107
20134
  } else if (stmt.type === "IfStatement") {
20108
- const guardArg = !stmt.alternate ? getReturnArgument(stmt.consequent) : null;
20109
- if (guardArg) {
20110
- const consequent = exprToIR(source, guardArg);
20135
+ const guardReturn = !stmt.alternate ? getReturnStatement(stmt.consequent) : null;
20136
+ if (guardReturn) {
20137
+ const consequent = guardReturn.argument ? exprToIR(source, guardReturn.argument) : [];
20111
20138
  const alternate = processStatementModeBody(source, bodyStmts.slice(i + 1), filename);
20112
20139
  nodes.push(new OpaqueDynamicRegion(toExpression(source, stmt.test), consequent, alternate));
20113
20140
  break;
@@ -28719,7 +28746,9 @@ function emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPref
28719
28746
  ctx2.push(`return $f; })();`);
28720
28747
  propsEntries.push(`children: ${frag}`);
28721
28748
  }
28722
- ctx2.push(`const ${v} = ${awaitKw}${access}(${callArgs()}, __registry, ${walkerArg});`);
28749
+ ctx2.push(`let ${v} = undefined;`);
28750
+ ctx2.push(`if (__hydrate) __hydrate.childFrame = (__hydrate.childFrame || 0) + 1;`);
28751
+ ctx2.push(`try { ${v} = ${awaitKw}${access}(${callArgs()}, __registry, ${walkerArg}); } finally { if (__hydrate) __hydrate.childFrame--; }`);
28723
28752
  maybeReplace(v);
28724
28753
  maybeRetire();
28725
28754
  return v;
@@ -38990,6 +39019,8 @@ import { readFileSync as readFileSync6, existsSync as existsSync7 } from "node:f
38990
39019
  import { resolve as resolve6 } from "node:path";
38991
39020
  var GLOBAL_CSS_URL = "/_vesk/static/global.css";
38992
39021
  function resolveUserCssPath(appDir) {
39022
+ const appCssSrc = resolve6(appDir, "global.css");
39023
+ if (existsSync7(appCssSrc)) return appCssSrc;
38993
39024
  const cssSrc = resolve6(appDir, "..", "src", "global.css");
38994
39025
  if (existsSync7(cssSrc)) return cssSrc;
38995
39026
  const altCssSrc = resolve6(appDir, "..", "src", "app.css");
@@ -39144,7 +39175,7 @@ ${layoutDecls.map((d) => " " + d.compiled + ",").join("\n")}
39144
39175
  const plan = precompilePlan(compPath);
39145
39176
  compRegEntries.push(` (() => {
39146
39177
  const _compiled = (() => { try { return hydratePrecompile(${plan}); } catch { return null; } })();
39147
- registry.set(${JSON.stringify(compName)}, async (props, __registry, __vesk) => {
39178
+ __componentRegistry.set(${JSON.stringify(compName)}, async (props, __registry, __vesk) => {
39148
39179
  const result = await renderPage('', ${JSON.stringify(compName)}, props, __registry, { hydrate: true, cached: _compiled });
39149
39180
  return result.body;
39150
39181
  });
@@ -42825,7 +42856,9 @@ function emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPre
42825
42856
  ctx2.push(`return $f; })();`);
42826
42857
  propsEntries.push(`children: ${frag}`);
42827
42858
  }
42828
- ctx2.push(`const ${v} = ${awaitKw}${access}(${callArgs()}, __registry, ${walkerArg});`);
42859
+ ctx2.push(`let ${v} = undefined;`);
42860
+ ctx2.push(`if (__hydrate) __hydrate.childFrame = (__hydrate.childFrame || 0) + 1;`);
42861
+ ctx2.push(`try { ${v} = ${awaitKw}${access}(${callArgs()}, __registry, ${walkerArg}); } finally { if (__hydrate) __hydrate.childFrame--; }`);
42829
42862
  maybeReplace(v);
42830
42863
  maybeRetire();
42831
42864
  return v;
@@ -48217,7 +48250,7 @@ async function addPluginToConfig2(projectDir, pkg) {
48217
48250
  let source;
48218
48251
  if (!path) {
48219
48252
  const importName2 = importNameForPackage(pkg);
48220
- const entry2 = pkg === "@vesk/plugin-tailwind" ? `${importName2}({ entry: 'src/global.css', appDir: 'app' })` : `${importName2}()`;
48253
+ const entry2 = pkg === "@vesk/plugin-tailwind" ? `${importName2}({ entry: 'app/global.css', appDir: 'app' })` : `${importName2}()`;
48221
48254
  source = `import { defineConfig } from '@vesk/compiler'
48222
48255
  import ${importName2} from '${pkg}'
48223
48256
 
@@ -48301,7 +48334,7 @@ export default defineConfig({
48301
48334
  source = importLine + source;
48302
48335
  }
48303
48336
  }
48304
- const entry = pkg === "@vesk/plugin-tailwind" ? `${importName}({ entry: 'src/global.css', appDir: 'app' })` : `${importName}()`;
48337
+ const entry = pkg === "@vesk/plugin-tailwind" ? `${importName}({ entry: 'app/global.css', appDir: 'app' })` : `${importName}()`;
48305
48338
  const newSource = insertIntoPluginsArray(source, entry);
48306
48339
  if (newSource === source)
48307
48340
  return;
@@ -51153,6 +51186,9 @@ import { readFileSync as readFileSync33, existsSync as existsSync37 } from "node
51153
51186
  import { resolve as resolve33 } from "node:path";
51154
51187
  var GLOBAL_CSS_URL2 = "/_vesk/static/global.css";
51155
51188
  function resolveUserCssPath2(appDir) {
51189
+ const appCssSrc = resolve33(appDir, "global.css");
51190
+ if (existsSync37(appCssSrc))
51191
+ return appCssSrc;
51156
51192
  const cssSrc = resolve33(appDir, "..", "src", "global.css");
51157
51193
  if (existsSync37(cssSrc))
51158
51194
  return cssSrc;
@@ -52768,13 +52804,20 @@ async function startDevServer(port, projectDir, config, host) {
52768
52804
  }
52769
52805
  let devGlobalCssContent = "";
52770
52806
  let lastServedCssGlobal = "";
52807
+ const appCssPath = join24(appDirPath, "global.css");
52771
52808
  const srcDir = join24(projectDir, "src");
52772
52809
  const cssPath = join24(srcDir, "global.css");
52773
52810
  const altCssPath = join24(srcDir, "app.css");
52774
52811
  let rawCss = "";
52775
- if (existsSync42(cssPath)) {
52812
+ let devCssSource = "";
52813
+ if (existsSync42(appCssPath)) {
52814
+ devCssSource = appCssPath;
52815
+ rawCss = readFileSync38(appCssPath, "utf-8");
52816
+ } else if (existsSync42(cssPath)) {
52817
+ devCssSource = cssPath;
52776
52818
  rawCss = readFileSync38(cssPath, "utf-8");
52777
52819
  } else if (existsSync42(altCssPath)) {
52820
+ devCssSource = altCssPath;
52778
52821
  rawCss = readFileSync38(altCssPath, "utf-8");
52779
52822
  }
52780
52823
  if (rawCss) {
@@ -52787,7 +52830,7 @@ async function startDevServer(port, projectDir, config, host) {
52787
52830
  devGlobalCssContent = rawCss;
52788
52831
  for (const plugin of activeAtStart) {
52789
52832
  if (typeof plugin.onCSS === "function") {
52790
- const result = await plugin.onCSS(rawCss, cssPath);
52833
+ const result = await plugin.onCSS(rawCss, devCssSource);
52791
52834
  if (result !== null && typeof result === "string") {
52792
52835
  devGlobalCssContent = result;
52793
52836
  }
@@ -52991,7 +53034,7 @@ async function startDevServer(port, projectDir, config, host) {
52991
53034
  const active = getActiveDevPlugins();
52992
53035
  for (const plugin of active) {
52993
53036
  if (typeof plugin.onCSS === "function") {
52994
- const result = await plugin.onCSS(rawCss, cssPath);
53037
+ const result = await plugin.onCSS(rawCss, devCssSource);
52995
53038
  if (result !== null && typeof result === "string") {
52996
53039
  nextGlobal = result;
52997
53040
  }
@@ -54195,7 +54238,7 @@ function usage(code = 0) {
54195
54238
  console.error(" vesk typecheck [--no-strict] Typecheck .vsk/.ts files via tsc-in-.vsk (strict by default)");
54196
54239
  console.error(" vesk start [-p 3000] Start production server");
54197
54240
  console.error(" vesk dev [-p 3000] Start dev server with HMR");
54198
- console.error(" vesk init Create src/global.css (Tailwind entrypoint) if missing");
54241
+ console.error(" vesk init Create app/global.css (Tailwind entrypoint) if missing");
54199
54242
  console.error(" vesk --help Show this help");
54200
54243
  console.error("");
54201
54244
  console.error("Scaffolding: npx create-vesk@latest <project-name>");
@@ -54383,13 +54426,13 @@ if (cmd === "start") {
54383
54426
  }
54384
54427
  if (cmd === "init") {
54385
54428
  const projectDir = process.cwd();
54386
- const srcDir = join26(projectDir, "src");
54387
- const target = join26(srcDir, "global.css");
54429
+ const appDirPath = join26(projectDir, "app");
54430
+ const target = join26(appDirPath, "global.css");
54388
54431
  if (existsSync43(target)) {
54389
54432
  console.error(`vesk init: ${target} already exists \u2014 skipping`);
54390
54433
  process.exit(0);
54391
54434
  }
54392
- mkdirSync18(srcDir, { recursive: true });
54435
+ mkdirSync18(appDirPath, { recursive: true });
54393
54436
  writeFileSync21(target, [
54394
54437
  `@import 'tailwindcss';`,
54395
54438
  ``,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
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.34",
12
- "@vesk/compiler": "^0.2.34",
13
- "@vesk/plugin-tailwind": "^0.2.34",
14
- "@vesk/runtime": "^0.2.34",
11
+ "@vesk/adapter": "^0.2.36",
12
+ "@vesk/compiler": "^0.2.36",
13
+ "@vesk/plugin-tailwind": "^0.2.36",
14
+ "@vesk/runtime": "^0.2.36",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",