@vesk/vesk-cli 0.2.56 → 0.2.58
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.
- package/dist/cli.js +50 -2
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -23149,6 +23149,11 @@ function resolveComponentName(source) {
|
|
|
23149
23149
|
const ir = generateIR(parse4(source), source);
|
|
23150
23150
|
const defaultComp = ir.components.find((c) => c.defaultExport);
|
|
23151
23151
|
if (defaultComp) return defaultComp.name;
|
|
23152
|
+
if (ir.components.length > 1) {
|
|
23153
|
+
console.warn(
|
|
23154
|
+
`[vesk] ${ir.components.map((c) => c.name).join(", ")}: this file declares several components and none is the default export, so which one is the route's page/layout is a guess. Add \`export default\` to the one that is.`
|
|
23155
|
+
);
|
|
23156
|
+
}
|
|
23152
23157
|
if (ir.components.length > 0) return ir.components[0].name;
|
|
23153
23158
|
const exportedComp = ir.components.find((c) => c.exported);
|
|
23154
23159
|
if (exportedComp) return exportedComp.name;
|
|
@@ -31664,6 +31669,18 @@ function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydr
|
|
|
31664
31669
|
`(typeof __hydrate.takeSkipK === 'function' ? __hydrate.takeSkipK() : 0)`
|
|
31665
31670
|
);
|
|
31666
31671
|
}
|
|
31672
|
+
if (ctx2.hydrate) {
|
|
31673
|
+
const bodyNodes = comp.body.filter((node) => !(node instanceof TrackDecl));
|
|
31674
|
+
const slotless = (node) => node instanceof StaticNode || node instanceof TextNode || node instanceof RuntimeStatement || node instanceof DynamicBinding && node.kind === "text";
|
|
31675
|
+
const claimless = bodyNodes.every((node) => slotless(node) && !claimsWalkerNode(ctx2, node));
|
|
31676
|
+
if (claimless) {
|
|
31677
|
+
const slots = bodyNodes.filter((node) => node instanceof StaticNode).length;
|
|
31678
|
+
for (let i = 0; i < slots; i++) {
|
|
31679
|
+
ctx2.push(indent2(`__hydrate.claimOnly(undefined, ${i === 0 && topBudget ? topBudget : "0"});`));
|
|
31680
|
+
if (i === 0 && topBudget) ctx2.push(indent2(`${topBudget} = 0;`));
|
|
31681
|
+
}
|
|
31682
|
+
}
|
|
31683
|
+
}
|
|
31667
31684
|
for (const node of comp.body) {
|
|
31668
31685
|
if (node instanceof TrackDecl) continue;
|
|
31669
31686
|
const v = emitNode(ctx2, node, tracked2, null, void 0, "__components", topPendingSkip, topBudget || void 0);
|
|
@@ -31688,7 +31705,16 @@ function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydr
|
|
|
31688
31705
|
ctx2.push(indent2(`if ($mount === null) $mount = document.createDocumentFragment();`));
|
|
31689
31706
|
ctx2.push(indent2(`return __pendingChild || $mount;`));
|
|
31690
31707
|
} else {
|
|
31691
|
-
|
|
31708
|
+
const hasBareSlot = comp.body.some((node) => node instanceof SlotNode);
|
|
31709
|
+
if (hasBareSlot) {
|
|
31710
|
+
ctx2.push(indent2(`if (__pendingChild !== null && __pendingChild !== undefined) {`));
|
|
31711
|
+
ctx2.push(indent2(` if (typeof __pendingChild.then === 'function') return __pendingChild.then((__c) => { $root.appendChild(toDomNode(__c)); return $root; });`));
|
|
31712
|
+
ctx2.push(indent2(` const __c = toDomNode(__pendingChild);`));
|
|
31713
|
+
ctx2.push(indent2(` if ($root.childNodes.length === 0) return __c;`));
|
|
31714
|
+
ctx2.push(indent2(` $root.appendChild(__c);`));
|
|
31715
|
+
ctx2.push(indent2(`}`));
|
|
31716
|
+
}
|
|
31717
|
+
ctx2.push(indent2(hasBareSlot ? `return $root;` : `return __pendingChild || $root;`));
|
|
31692
31718
|
}
|
|
31693
31719
|
ctx2.push(indent2(`} finally {`));
|
|
31694
31720
|
ctx2.push(indent2(` setActiveComponent(__prev);`));
|
|
@@ -53611,6 +53637,19 @@ function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hyd
|
|
|
53611
53637
|
if (ctx2.markerless && ctx2.hydrate) {
|
|
53612
53638
|
topBudget = regionBudgetVar2(ctx2, 0, void 0, `(typeof __hydrate.takeSkipK === 'function' ? __hydrate.takeSkipK() : 0)`);
|
|
53613
53639
|
}
|
|
53640
|
+
if (ctx2.hydrate) {
|
|
53641
|
+
const bodyNodes = comp.body.filter((node) => !(node instanceof TrackDecl));
|
|
53642
|
+
const slotless = (node) => node instanceof StaticNode || node instanceof TextNode || node instanceof RuntimeStatement || node instanceof DynamicBinding && node.kind === "text";
|
|
53643
|
+
const claimless = bodyNodes.every((node) => slotless(node) && !claimsWalkerNode2(ctx2, node));
|
|
53644
|
+
if (claimless) {
|
|
53645
|
+
const slots = bodyNodes.filter((node) => node instanceof StaticNode).length;
|
|
53646
|
+
for (let i = 0; i < slots; i++) {
|
|
53647
|
+
ctx2.push(indent3(`__hydrate.claimOnly(undefined, ${i === 0 && topBudget ? topBudget : "0"});`));
|
|
53648
|
+
if (i === 0 && topBudget)
|
|
53649
|
+
ctx2.push(indent3(`${topBudget} = 0;`));
|
|
53650
|
+
}
|
|
53651
|
+
}
|
|
53652
|
+
}
|
|
53614
53653
|
for (const node of comp.body) {
|
|
53615
53654
|
if (node instanceof TrackDecl)
|
|
53616
53655
|
continue;
|
|
@@ -53639,7 +53678,16 @@ function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hyd
|
|
|
53639
53678
|
ctx2.push(indent3(`if ($mount === null) $mount = document.createDocumentFragment();`));
|
|
53640
53679
|
ctx2.push(indent3(`return __pendingChild || $mount;`));
|
|
53641
53680
|
} else {
|
|
53642
|
-
|
|
53681
|
+
const hasBareSlot = comp.body.some((node) => node instanceof SlotNode);
|
|
53682
|
+
if (hasBareSlot) {
|
|
53683
|
+
ctx2.push(indent3(`if (__pendingChild !== null && __pendingChild !== undefined) {`));
|
|
53684
|
+
ctx2.push(indent3(` if (typeof __pendingChild.then === 'function') return __pendingChild.then((__c) => { $root.appendChild(toDomNode(__c)); return $root; });`));
|
|
53685
|
+
ctx2.push(indent3(` const __c = toDomNode(__pendingChild);`));
|
|
53686
|
+
ctx2.push(indent3(` if ($root.childNodes.length === 0) return __c;`));
|
|
53687
|
+
ctx2.push(indent3(` $root.appendChild(__c);`));
|
|
53688
|
+
ctx2.push(indent3(`}`));
|
|
53689
|
+
}
|
|
53690
|
+
ctx2.push(indent3(hasBareSlot ? `return $root;` : `return __pendingChild || $root;`));
|
|
53643
53691
|
}
|
|
53644
53692
|
ctx2.push(indent3(`} finally {`));
|
|
53645
53693
|
ctx2.push(indent3(` setActiveComponent(__prev);`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/vesk-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.58",
|
|
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.
|
|
12
|
-
"@vesk/compiler": "^0.2.
|
|
13
|
-
"@vesk/plugin-tailwind": "^0.2.
|
|
14
|
-
"@vesk/runtime": "^0.2.
|
|
11
|
+
"@vesk/adapter": "^0.2.58",
|
|
12
|
+
"@vesk/compiler": "^0.2.58",
|
|
13
|
+
"@vesk/plugin-tailwind": "^0.2.58",
|
|
14
|
+
"@vesk/runtime": "^0.2.58",
|
|
15
15
|
"esrap": "^2.3.0",
|
|
16
16
|
"typescript": "^5.8.0",
|
|
17
17
|
"ws": "^8.18.0",
|