@vesk/vesk-cli 0.2.31 → 0.2.32

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 +46 -4
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -2964,6 +2964,19 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
2964
2964
  }
2965
2965
  return null;
2966
2966
  }
2967
+ insertBeforeNextClaim(node) {
2968
+ let i = this.idx;
2969
+ while (i < this.markers.length && this.markers[i].state === "claimed") i++;
2970
+ const next = i < this.markers.length ? this.markers[i] : null;
2971
+ const host = next && next.comment.parentNode ? next.comment.parentNode : this.root;
2972
+ if (host === null || host === void 0) return false;
2973
+ try {
2974
+ host.insertBefore(node, next ? next.comment : null);
2975
+ return true;
2976
+ } catch {
2977
+ return false;
2978
+ }
2979
+ }
2967
2980
  };
2968
2981
  }
2969
2982
  });
@@ -28436,7 +28449,7 @@ function emitStatic(ctx2, node, tracked2, effectsVar) {
28436
28449
  } else {
28437
28450
  const expr = transformTracked(attr.expression, tracked2);
28438
28451
  const useProp = PROPERTY_ATTRS[node.tag]?.has(target);
28439
- const eff = useProp ? `effect(() => { ${ssrEl}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v != null && __v !== false) ${ssrEl}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
28452
+ const eff = useProp ? `effect(() => { ${ssrEl}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v == null || __v === false) ${ssrEl}.removeAttribute(${JSON.stringify(target)}); else ${ssrEl}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
28440
28453
  if (effectsVar) {
28441
28454
  ctx2.push(`${effectsVar}.push(${eff});`);
28442
28455
  } else {
@@ -28492,7 +28505,7 @@ function emitStatic(ctx2, node, tracked2, effectsVar) {
28492
28505
  } else {
28493
28506
  const expr = transformTracked(attr.expression, tracked2);
28494
28507
  const useProp = PROPERTY_ATTRS[node.tag]?.has(target);
28495
- const eff = useProp ? `effect(() => { ${el}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v != null && __v !== false) ${el}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
28508
+ const eff = useProp ? `effect(() => { ${el}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v == null || __v === false) ${el}.removeAttribute(${JSON.stringify(target)}); else ${el}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
28496
28509
  if (effectsVar) {
28497
28510
  ctx2.push(`${effectsVar}.push(${eff});`);
28498
28511
  } else {
@@ -28727,6 +28740,14 @@ function emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPref
28727
28740
  }
28728
28741
  return v;
28729
28742
  }
28743
+ function emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, rootLevel) {
28744
+ if (!ctx2.hydrate || !rootLevel) return;
28745
+ ctx2.push(`// Anchor region fences to the SSR slot so no-content regions do not fall back to $root's end.`);
28746
+ ctx2.push(`if (__hydrate && __hydrate.insertBeforeNextClaim) {`);
28747
+ ctx2.push(indent2(`__hydrate.insertBeforeNextClaim(${anchor});`));
28748
+ ctx2.push(indent2(`__hydrate.insertBeforeNextClaim(${endAnchor});`));
28749
+ ctx2.push(`}`);
28750
+ }
28730
28751
  function emitTryCatch(ctx2, node, tracked2, effectsVar, parentVar) {
28731
28752
  const anchor = ctx2.n();
28732
28753
  const endAnchor = ctx2.n();
@@ -28737,6 +28758,7 @@ function emitTryCatch(ctx2, node, tracked2, effectsVar, parentVar) {
28737
28758
  if (!ctx2.hydrate) ctx2.push(`${parent}.appendChild(${anchor});`);
28738
28759
  ctx2.push(`let ${effArr} = [];`);
28739
28760
  ctx2.push(`const ${endAnchor} = document.createComment('try-end');`);
28761
+ emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
28740
28762
  const asyncKw = ctx2.isAsyncScope ? "await " : "";
28741
28763
  function emitRenderFunc(name, isCatch, hydMode, compPrefix = "__components") {
28742
28764
  const savedHydrate = ctx2.hydrate;
@@ -28823,6 +28845,7 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
28823
28845
  ctx2.push(`const ${anchor2} = document.createComment('if');`);
28824
28846
  ctx2.push(`let ${effectsVar2} = [];`);
28825
28847
  ctx2.push(`const ${endAnchor2} = document.createComment('if-end');`);
28848
+ emitHydrateFenceAnchoring(ctx2, anchor2, endAnchor2, parent === "$root");
28826
28849
  const asyncKw2 = ctx2.isAsyncScope ? "await " : "";
28827
28850
  const fnOpen2 = ctx2.isAsyncScope ? "async () => {" : "() => {";
28828
28851
  const renderNames = [];
@@ -28905,6 +28928,7 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
28905
28928
  if (!hyd) ctx2.push(`${parent}.appendChild(${anchor});`);
28906
28929
  ctx2.push(`let ${effectsVar} = [];`);
28907
28930
  ctx2.push(`const ${endAnchor} = document.createComment('if-end');`);
28931
+ emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
28908
28932
  const asyncKw = ctx2.isAsyncScope ? "await " : "";
28909
28933
  const fnOpen = ctx2.isAsyncScope ? "async () => {" : "() => {";
28910
28934
  const conRenderName = ctx2.n();
@@ -28989,6 +29013,7 @@ function emitWhileLoop(ctx2, node, tracked2, parentVar) {
28989
29013
  if (!hyd) ctx2.push(`${parent}.appendChild(${anchor});`);
28990
29014
  ctx2.push(`let ${effectsVar} = [];`);
28991
29015
  ctx2.push(`const ${endAnchor} = document.createComment('while-end');`);
29016
+ emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
28992
29017
  const renderLoop = ctx2.n();
28993
29018
  ctx2.push(`const ${renderLoop} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
28994
29019
  if (!hyd) ctx2.push(indent2(`const __p = ${anchor}.parentNode;`));
@@ -29051,6 +29076,7 @@ function emitForLoop(ctx2, node, tracked2, parentVar) {
29051
29076
  if (!hyd) ctx2.push(`${parent}.appendChild(${anchor});`);
29052
29077
  ctx2.push(`let ${effectsVar} = [];`);
29053
29078
  ctx2.push(`const ${endAnchor} = document.createComment('for-end');`);
29079
+ emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
29054
29080
  const renderLoop = ctx2.n();
29055
29081
  ctx2.push(`const ${renderLoop} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
29056
29082
  if (!hyd) ctx2.push(indent2(`const __p = ${anchor}.parentNode;`));
@@ -29191,6 +29217,7 @@ function emitSwitchBlock(ctx2, node, tracked2, parentVar) {
29191
29217
  if (!hyd) ctx2.push(`${parent}.appendChild(${anchor});`);
29192
29218
  ctx2.push(`let ${effectsVar} = [];`);
29193
29219
  ctx2.push(`const ${endAnchor} = document.createComment('switch-end');`);
29220
+ emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
29194
29221
  const renderSwitch = ctx2.n();
29195
29222
  ctx2.push(`const ${renderSwitch} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
29196
29223
  if (hyd) {
@@ -42368,7 +42395,7 @@ function emitStatic2(ctx2, node, tracked2, effectsVar) {
42368
42395
  } else {
42369
42396
  const expr = transformTracked2(attr.expression, tracked2);
42370
42397
  const useProp = PROPERTY_ATTRS2[node.tag]?.has(target);
42371
- const eff = useProp ? `effect(() => { ${ssrEl}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v != null && __v !== false) ${ssrEl}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
42398
+ const eff = useProp ? `effect(() => { ${ssrEl}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v == null || __v === false) ${ssrEl}.removeAttribute(${JSON.stringify(target)}); else ${ssrEl}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
42372
42399
  if (effectsVar) {
42373
42400
  ctx2.push(`${effectsVar}.push(${eff});`);
42374
42401
  } else {
@@ -42424,7 +42451,7 @@ function emitStatic2(ctx2, node, tracked2, effectsVar) {
42424
42451
  } else {
42425
42452
  const expr = transformTracked2(attr.expression, tracked2);
42426
42453
  const useProp = PROPERTY_ATTRS2[node.tag]?.has(target);
42427
- const eff = useProp ? `effect(() => { ${el}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v != null && __v !== false) ${el}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
42454
+ const eff = useProp ? `effect(() => { ${el}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v == null || __v === false) ${el}.removeAttribute(${JSON.stringify(target)}); else ${el}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
42428
42455
  if (effectsVar) {
42429
42456
  ctx2.push(`${effectsVar}.push(${eff});`);
42430
42457
  } else {
@@ -42687,6 +42714,15 @@ function emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPre
42687
42714
  }
42688
42715
  return v;
42689
42716
  }
42717
+ function emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, rootLevel) {
42718
+ if (!ctx2.hydrate || !rootLevel)
42719
+ return;
42720
+ ctx2.push(`// Anchor region fences to the SSR slot so no-content regions do not fall back to $root's end.`);
42721
+ ctx2.push(`if (__hydrate && __hydrate.insertBeforeNextClaim) {`);
42722
+ ctx2.push(indent3(`__hydrate.insertBeforeNextClaim(${anchor});`));
42723
+ ctx2.push(indent3(`__hydrate.insertBeforeNextClaim(${endAnchor});`));
42724
+ ctx2.push(`}`);
42725
+ }
42690
42726
  function emitTryCatch2(ctx2, node, tracked2, effectsVar, parentVar) {
42691
42727
  const anchor = ctx2.n();
42692
42728
  const endAnchor = ctx2.n();
@@ -42698,6 +42734,7 @@ function emitTryCatch2(ctx2, node, tracked2, effectsVar, parentVar) {
42698
42734
  ctx2.push(`${parent}.appendChild(${anchor});`);
42699
42735
  ctx2.push(`let ${effArr} = [];`);
42700
42736
  ctx2.push(`const ${endAnchor} = document.createComment('try-end');`);
42737
+ emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
42701
42738
  const asyncKw = ctx2.isAsyncScope ? "await " : "";
42702
42739
  function emitRenderFunc(name, isCatch, hydMode, compPrefix = "__components") {
42703
42740
  const savedHydrate = ctx2.hydrate;
@@ -42788,6 +42825,7 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
42788
42825
  ctx2.push(`const ${anchor2} = document.createComment('if');`);
42789
42826
  ctx2.push(`let ${effectsVar2} = [];`);
42790
42827
  ctx2.push(`const ${endAnchor2} = document.createComment('if-end');`);
42828
+ emitHydrateFenceAnchoring2(ctx2, anchor2, endAnchor2, parent === "$root");
42791
42829
  const asyncKw2 = ctx2.isAsyncScope ? "await " : "";
42792
42830
  const fnOpen2 = ctx2.isAsyncScope ? "async () => {" : "() => {";
42793
42831
  const renderNames = [];
@@ -42879,6 +42917,7 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
42879
42917
  ctx2.push(`${parent}.appendChild(${anchor});`);
42880
42918
  ctx2.push(`let ${effectsVar} = [];`);
42881
42919
  ctx2.push(`const ${endAnchor} = document.createComment('if-end');`);
42920
+ emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
42882
42921
  const asyncKw = ctx2.isAsyncScope ? "await " : "";
42883
42922
  const fnOpen = ctx2.isAsyncScope ? "async () => {" : "() => {";
42884
42923
  const conRenderName = ctx2.n();
@@ -42982,6 +43021,7 @@ function emitWhileLoop2(ctx2, node, tracked2, parentVar) {
42982
43021
  ctx2.push(`${parent}.appendChild(${anchor});`);
42983
43022
  ctx2.push(`let ${effectsVar} = [];`);
42984
43023
  ctx2.push(`const ${endAnchor} = document.createComment('while-end');`);
43024
+ emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
42985
43025
  const renderLoop = ctx2.n();
42986
43026
  ctx2.push(`const ${renderLoop} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
42987
43027
  if (!hyd)
@@ -43055,6 +43095,7 @@ function emitForLoop2(ctx2, node, tracked2, parentVar) {
43055
43095
  ctx2.push(`${parent}.appendChild(${anchor});`);
43056
43096
  ctx2.push(`let ${effectsVar} = [];`);
43057
43097
  ctx2.push(`const ${endAnchor} = document.createComment('for-end');`);
43098
+ emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
43058
43099
  const renderLoop = ctx2.n();
43059
43100
  ctx2.push(`const ${renderLoop} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
43060
43101
  if (!hyd)
@@ -43210,6 +43251,7 @@ function emitSwitchBlock2(ctx2, node, tracked2, parentVar) {
43210
43251
  ctx2.push(`${parent}.appendChild(${anchor});`);
43211
43252
  ctx2.push(`let ${effectsVar} = [];`);
43212
43253
  ctx2.push(`const ${endAnchor} = document.createComment('switch-end');`);
43254
+ emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
43213
43255
  const renderSwitch = ctx2.n();
43214
43256
  ctx2.push(`const ${renderSwitch} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
43215
43257
  if (hyd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.31",
3
+ "version": "0.2.32",
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.31",
12
- "@vesk/compiler": "^0.2.31",
13
- "@vesk/plugin-tailwind": "^0.2.31",
14
- "@vesk/runtime": "^0.2.31",
11
+ "@vesk/adapter": "^0.2.32",
12
+ "@vesk/compiler": "^0.2.32",
13
+ "@vesk/plugin-tailwind": "^0.2.32",
14
+ "@vesk/runtime": "^0.2.32",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",