@vesk/vesk-cli 0.2.96 → 0.2.97

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 +93 -20
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -2660,6 +2660,12 @@ var init_portal = __esm({
2660
2660
  });
2661
2661
 
2662
2662
  // ../runtime/src/hydrate.ts
2663
+ function createFreshElement(tag) {
2664
+ if (SVG_ONLY_TAGS.has(tag.toLowerCase())) {
2665
+ return document.createElementNS(SVG_NAMESPACE, tag);
2666
+ }
2667
+ return document.createElement(tag);
2668
+ }
2663
2669
  function runInHydrateBlock(fn) {
2664
2670
  const previous = scope();
2665
2671
  const block2 = root(() => {
@@ -3228,12 +3234,75 @@ function hydrateOnInteraction(container, componentFn, props, options = {}) {
3228
3234
  }
3229
3235
  };
3230
3236
  }
3231
- var __hydrateDevMode, claimRegistry, walkerClaimRecords, __hydrateStrict, __mismatchHandler, _SHOW_COMMENT, _FILTER_ACCEPT, _FILTER_SKIP, WalkerEngine, StructuralWalker;
3237
+ var SVG_NAMESPACE, SVG_ONLY_TAGS, __hydrateDevMode, claimRegistry, walkerClaimRecords, __hydrateStrict, __mismatchHandler, _SHOW_COMMENT, _FILTER_ACCEPT, _FILTER_SKIP, WalkerEngine, StructuralWalker;
3232
3238
  var init_hydrate = __esm({
3233
3239
  "../runtime/src/hydrate.ts"() {
3234
3240
  "use strict";
3235
3241
  init_ripple_runtime();
3236
3242
  init_ripple_blocks();
3243
+ SVG_NAMESPACE = "http://www.w3.org/2000/svg";
3244
+ SVG_ONLY_TAGS = new Set(
3245
+ [
3246
+ "svg",
3247
+ "animate",
3248
+ "animateMotion",
3249
+ "animateTransform",
3250
+ "circle",
3251
+ "clipPath",
3252
+ "defs",
3253
+ "desc",
3254
+ "ellipse",
3255
+ "feBlend",
3256
+ "feColorMatrix",
3257
+ "feComponentTransfer",
3258
+ "feComposite",
3259
+ "feConvolveMatrix",
3260
+ "feDiffuseLighting",
3261
+ "feDisplacementMap",
3262
+ "feDistantLight",
3263
+ "feDropShadow",
3264
+ "feFlood",
3265
+ "feFuncA",
3266
+ "feFuncB",
3267
+ "feFuncG",
3268
+ "feFuncR",
3269
+ "feGaussianBlur",
3270
+ "feImage",
3271
+ "feMerge",
3272
+ "feMergeNode",
3273
+ "feMorphology",
3274
+ "feOffset",
3275
+ "fePointLight",
3276
+ "feSpecularLighting",
3277
+ "feSpotLight",
3278
+ "feTile",
3279
+ "feTurbulence",
3280
+ "filter",
3281
+ "foreignObject",
3282
+ "g",
3283
+ "line",
3284
+ "linearGradient",
3285
+ "marker",
3286
+ "mask",
3287
+ "metadata",
3288
+ "mpath",
3289
+ "path",
3290
+ "pattern",
3291
+ "polygon",
3292
+ "polyline",
3293
+ "radialGradient",
3294
+ "rect",
3295
+ "set",
3296
+ "stop",
3297
+ "switch",
3298
+ "symbol",
3299
+ "text",
3300
+ "textPath",
3301
+ "tspan",
3302
+ "use",
3303
+ "view"
3304
+ ].map((tag) => tag.toLowerCase())
3305
+ );
3237
3306
  __hydrateDevMode = true;
3238
3307
  claimRegistry = /* @__PURE__ */ new WeakMap();
3239
3308
  walkerClaimRecords = /* @__PURE__ */ new WeakMap();
@@ -3347,7 +3416,7 @@ var init_hydrate = __esm({
3347
3416
  ${String(this.root.outerHTML).slice(0, 800)}` : ""),
3348
3417
  hasUnconsumed && __hydrateDevMode
3349
3418
  );
3350
- return document.createElement(tag || "div");
3419
+ return createFreshElement(tag || "div");
3351
3420
  }
3352
3421
  claimOnly(tag) {
3353
3422
  while (this.idx < this.markers.length) {
@@ -3390,7 +3459,7 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
3390
3459
  `hydration static claim missed <${tag || "element"}> (${this.markers.length - this.idx} markers unconsumed); the client rendered more or different content than SSR.`,
3391
3460
  hasUnconsumed && __hydrateDevMode
3392
3461
  );
3393
- return document.createElement(tag || "div");
3462
+ return createFreshElement(tag || "div");
3394
3463
  }
3395
3464
  retireDetached() {
3396
3465
  while (this.idx < this.markers.length) {
@@ -3672,7 +3741,7 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
3672
3741
  } catch {
3673
3742
  }
3674
3743
  }
3675
- const fresh2 = document.createElement(expectedTag);
3744
+ const fresh2 = createFreshElement(expectedTag);
3676
3745
  recordClaim(this.root, {
3677
3746
  state: "fresh",
3678
3747
  el: fresh2,
@@ -3698,7 +3767,7 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
3698
3767
  return el;
3699
3768
  }
3700
3769
  this.idx = this.els.length;
3701
- const fresh = document.createElement(tag || "div");
3770
+ const fresh = createFreshElement(tag || "div");
3702
3771
  recordClaim(this.root, {
3703
3772
  state: "fresh",
3704
3773
  el: fresh,
@@ -19161,7 +19230,7 @@ function offsetToLineCol(source, offset2) {
19161
19230
  }
19162
19231
  return { line, column };
19163
19232
  }
19164
- function preprocessForClauses(source, delimiters) {
19233
+ function preprocessForClauses(source, delimiters, filename = "") {
19165
19234
  const annotations = [];
19166
19235
  const chars = source.split("");
19167
19236
  const isString = (ch) => ch === '"' || ch === "'" || ch === "`";
@@ -19312,9 +19381,11 @@ function preprocessForClauses(source, delimiters) {
19312
19381
  throw new VeskError(
19313
19382
  `Invalid \`; key\` clause \u2014 write the key expression after \`key\` without a colon: \`key ${expr.slice(1).trim()}\`.`,
19314
19383
  {
19384
+ file: filename || "",
19315
19385
  line,
19316
19386
  column,
19317
- code: codeFrame(source, line, column),
19387
+ code: "V0411",
19388
+ frame: codeFrame(source, line, column),
19318
19389
  nextSteps: [
19319
19390
  "Use `; key <expr>` (no colon), e.g. `for (const item of items; key item.id)`.",
19320
19391
  "For the iteration index use `; index <name>`, e.g. `for (const item of items; key item.id; index i)`."
@@ -19529,7 +19600,8 @@ function parse4(source, options = {}) {
19529
19600
  const ParserClass = createBaseParser();
19530
19601
  const sourceTokens = tokenizeCode(source);
19531
19602
  const delimiters = sourceTokens === null ? null : collectStringDelimiters(source, sourceTokens);
19532
- const { code, annotations } = preprocessForClauses(blankGenericArrowTypeParams(blankComments(source)), delimiters);
19603
+ const filename = options.filename || "";
19604
+ const { code, annotations } = preprocessForClauses(blankGenericArrowTypeParams(blankComments(source)), delimiters, filename);
19533
19605
  const vskSource = !options.filename || String(options.filename).endsWith(".vsk");
19534
19606
  const specifierExports = vskSource && sourceTokens !== null ? findSpecifierExports(code, sourceTokens).filter((e) => !hasTopLevelValueDeclaration(code, e.local, sourceTokens)) : [];
19535
19607
  let parseable = code;
@@ -19579,7 +19651,6 @@ function parse4(source, options = {}) {
19579
19651
  }
19580
19652
  }
19581
19653
  }
19582
- const filename = options.filename || "";
19583
19654
  let cleanMessage = err.message;
19584
19655
  const lastParen = cleanMessage.lastIndexOf("(");
19585
19656
  if (lastParen >= 0) {
@@ -21825,7 +21896,7 @@ function assertNoVskNamespaceValue(source, expr) {
21825
21896
  const hit = findNamespaceValueUse(expr, currentVskNamespaceLocals);
21826
21897
  if (!hit) return;
21827
21898
  const { line, column } = offsetToLineCol2(source, hit.start ?? 0);
21828
- throw VeskError.vskNamespaceMember({ file: currentSourceFile, line, column, code: codeFrame(source, line, column), form: "value" });
21899
+ throw VeskError.vskNamespaceMember({ file: currentSourceFile, line, column, frame: codeFrame(source, line, column), form: "value" });
21829
21900
  }
21830
21901
  function findNamespaceValueUse(node, locals2) {
21831
21902
  if (!node || typeof node !== "object") return null;
@@ -22398,7 +22469,7 @@ function processJSXElement(source, element) {
22398
22469
  const isVskNamespace = !!currentVskNamespaceLocals && currentVskNamespaceLocals.has(root3);
22399
22470
  if (isVskNamespace && jsxTagDepth(nameNode) > 1) {
22400
22471
  const { line, column } = offsetToLineCol2(source, nameNode.start ?? 0);
22401
- throw VeskError.vskNamespaceMember({ file: currentSourceFile, line, column, code: codeFrame(source, line, column), form: "nested" });
22472
+ throw VeskError.vskNamespaceMember({ file: currentSourceFile, line, column, frame: codeFrame(source, line, column), form: "nested" });
22402
22473
  }
22403
22474
  const { props, spreadProps, slots } = extractProps(source, element);
22404
22475
  const children2 = selfClosing ? [] : processJSXChildren(source, element.children || []);
@@ -22724,7 +22795,7 @@ function processStatementModeBody(source, bodyStmts, filename) {
22724
22795
  file: filename || "",
22725
22796
  line,
22726
22797
  column,
22727
- code: codeFrame(source, line, column)
22798
+ frame: codeFrame(source, line, column)
22728
22799
  });
22729
22800
  }
22730
22801
  for (const child of innerStmts) {
@@ -22793,7 +22864,7 @@ function processStatementModeBody(source, bodyStmts, filename) {
22793
22864
  }
22794
22865
  } else if (stmt.type === "ClassDeclaration") {
22795
22866
  const { line, column } = offsetToLineCol2(source, stmt.start ?? 0);
22796
- throw VeskError.classDecl({ file: filename || "", line, column, code: codeFrame(source, line, column) });
22867
+ throw VeskError.classDecl({ file: filename || "", line, column, frame: codeFrame(source, line, column) });
22797
22868
  } else if (stmt.type === "ContinueStatement") {
22798
22869
  break;
22799
22870
  } else if (stmt.type === "BreakStatement") {
@@ -23128,7 +23199,7 @@ function generateIR(ast, source, filename) {
23128
23199
  if (inner.type === "ComponentDeclaration") {
23129
23200
  } else if (inner.type === "ClassDeclaration") {
23130
23201
  const { line, column } = offsetToLineCol2(source, inner.start ?? 0);
23131
- throw VeskError.classDecl({ file, line, column, code: codeFrame(source, line, column) });
23202
+ throw VeskError.classDecl({ file, line, column, frame: codeFrame(source, line, column) });
23132
23203
  } else if (inner.type === "TSEnumDeclaration") {
23133
23204
  const code = processEnum(inner, source, exported);
23134
23205
  topLevelCode.push(code);
@@ -23185,7 +23256,7 @@ function generateIR(ast, source, filename) {
23185
23256
  guardClauses.push(stmt);
23186
23257
  } else if (stmt.type === "ClassDeclaration") {
23187
23258
  const { line, column } = offsetToLineCol2(source, stmt.start ?? 0);
23188
- throw VeskError.classDecl({ file, line, column, code: codeFrame(source, line, column) });
23259
+ throw VeskError.classDecl({ file, line, column, frame: codeFrame(source, line, column) });
23189
23260
  } else {
23190
23261
  const raw2 = getSource(source, stmt);
23191
23262
  if (raw2) preamble.push(new RuntimeStatement(raw2, stmt, source));
@@ -23211,7 +23282,7 @@ function generateIR(ast, source, filename) {
23211
23282
  for (const [childName, start] of called2) {
23212
23283
  if (!asyncNames.has(childName)) continue;
23213
23284
  const { line, column } = offsetToLineCol2(source, start >= 0 ? start : 0);
23214
- throw VeskError.asyncChildInSyncParent(comp.name, childName, { file, line, column, code: codeFrame(source, line, column) });
23285
+ throw VeskError.asyncChildInSyncParent(comp.name, childName, { file, line, column, frame: codeFrame(source, line, column) });
23215
23286
  }
23216
23287
  }
23217
23288
  const autoImportable = [
@@ -44240,7 +44311,7 @@ function offsetToLineCol3(source, offset2) {
44240
44311
  }
44241
44312
  return { line, column };
44242
44313
  }
44243
- function preprocessForClauses2(source, delimiters) {
44314
+ function preprocessForClauses2(source, delimiters, filename = "") {
44244
44315
  const annotations = [];
44245
44316
  const chars = source.split("");
44246
44317
  const isString = (ch) => ch === '"' || ch === "'" || ch === "`";
@@ -44403,9 +44474,11 @@ function preprocessForClauses2(source, delimiters) {
44403
44474
  if (expr[0] === ":") {
44404
44475
  const { line, column } = offsetToLineCol3(source, start);
44405
44476
  throw new VeskError(`Invalid \`; key\` clause \u2014 write the key expression after \`key\` without a colon: \`key ${expr.slice(1).trim()}\`.`, {
44477
+ file: filename || "",
44406
44478
  line,
44407
44479
  column,
44408
- code: codeFrame(source, line, column),
44480
+ code: "V0411",
44481
+ frame: codeFrame(source, line, column),
44409
44482
  nextSteps: [
44410
44483
  "Use `; key <expr>` (no colon), e.g. `for (const item of items; key item.id)`.",
44411
44484
  "For the iteration index use `; index <name>`, e.g. `for (const item of items; key item.id; index i)`."
@@ -44630,7 +44703,8 @@ function parse5(source, options = {}) {
44630
44703
  const ParserClass = createBaseParser2();
44631
44704
  const sourceTokens = tokenizeCode(source);
44632
44705
  const delimiters = sourceTokens === null ? null : collectStringDelimiters(source, sourceTokens);
44633
- const { code, annotations } = preprocessForClauses2(blankGenericArrowTypeParams2(blankComments(source)), delimiters);
44706
+ const filename = options.filename || "";
44707
+ const { code, annotations } = preprocessForClauses2(blankGenericArrowTypeParams2(blankComments(source)), delimiters, filename);
44634
44708
  const vskSource = !options.filename || String(options.filename).endsWith(".vsk");
44635
44709
  const specifierExports = vskSource && sourceTokens !== null ? findSpecifierExports(code, sourceTokens).filter((e) => !hasTopLevelValueDeclaration(code, e.local, sourceTokens)) : [];
44636
44710
  let parseable = code;
@@ -44678,7 +44752,6 @@ function parse5(source, options = {}) {
44678
44752
  }
44679
44753
  }
44680
44754
  }
44681
- const filename = options.filename || "";
44682
44755
  let cleanMessage = err.message;
44683
44756
  const lastParen = cleanMessage.lastIndexOf("(");
44684
44757
  if (lastParen >= 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.96",
3
+ "version": "0.2.97",
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.96",
12
- "@vesk/compiler": "^0.2.96",
13
- "@vesk/plugin-tailwind": "^0.2.96",
14
- "@vesk/runtime": "^0.2.96",
11
+ "@vesk/adapter": "^0.2.97",
12
+ "@vesk/compiler": "^0.2.97",
13
+ "@vesk/plugin-tailwind": "^0.2.97",
14
+ "@vesk/runtime": "^0.2.97",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",