@vesk/vesk-cli 0.2.61 → 0.2.62
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 +139 -4
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -30533,6 +30533,53 @@ function transformTrackedInit(init, tracked2) {
|
|
|
30533
30533
|
if (!expr) return init;
|
|
30534
30534
|
return transformTracked({ raw: init, ast: expr }, tracked2);
|
|
30535
30535
|
}
|
|
30536
|
+
function runtimeDeclaredNames(node) {
|
|
30537
|
+
if (!(node instanceof RuntimeStatement)) return [];
|
|
30538
|
+
const stmt = node.ast;
|
|
30539
|
+
if (!stmt || stmt.type !== "VariableDeclaration" || !stmt.declarations) return [];
|
|
30540
|
+
const out = [];
|
|
30541
|
+
for (const d of stmt.declarations) {
|
|
30542
|
+
if (d.id && d.id.type === "Identifier" && typeof d.id.name === "string") out.push(d.id.name);
|
|
30543
|
+
}
|
|
30544
|
+
return out;
|
|
30545
|
+
}
|
|
30546
|
+
function initReadsAnyOf(init, names) {
|
|
30547
|
+
if (!init || names.size === 0) return false;
|
|
30548
|
+
let expr = null;
|
|
30549
|
+
try {
|
|
30550
|
+
const prog = parse4(`(${init})`);
|
|
30551
|
+
expr = prog.body?.[0]?.type === "ExpressionStatement" ? prog.body[0].expression ?? null : null;
|
|
30552
|
+
} catch {
|
|
30553
|
+
return false;
|
|
30554
|
+
}
|
|
30555
|
+
if (!expr) return false;
|
|
30556
|
+
let found = false;
|
|
30557
|
+
const walk9 = (n) => {
|
|
30558
|
+
if (found || !n || typeof n !== "object") return;
|
|
30559
|
+
if (Array.isArray(n)) {
|
|
30560
|
+
for (const c of n) walk9(c);
|
|
30561
|
+
return;
|
|
30562
|
+
}
|
|
30563
|
+
const t = n.type;
|
|
30564
|
+
if (typeof t !== "string") return;
|
|
30565
|
+
if (t === "Identifier") {
|
|
30566
|
+
if (names.has(n.name)) found = true;
|
|
30567
|
+
return;
|
|
30568
|
+
}
|
|
30569
|
+
if (t === "MemberExpression") {
|
|
30570
|
+
const m = n;
|
|
30571
|
+
walk9(m.object);
|
|
30572
|
+
if (m.computed) walk9(m.property);
|
|
30573
|
+
return;
|
|
30574
|
+
}
|
|
30575
|
+
for (const key of Object.keys(n)) {
|
|
30576
|
+
if (key === "loc" || key === "range" || key === "start" || key === "end") continue;
|
|
30577
|
+
walk9(n[key]);
|
|
30578
|
+
}
|
|
30579
|
+
};
|
|
30580
|
+
walk9(expr);
|
|
30581
|
+
return found;
|
|
30582
|
+
}
|
|
30536
30583
|
function indent2(code, level = 1) {
|
|
30537
30584
|
const pad = " ".repeat(level);
|
|
30538
30585
|
return code.split("\n").map((l) => l ? pad + l : "").join("\n");
|
|
@@ -31918,8 +31965,19 @@ function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydr
|
|
|
31918
31965
|
ctx2.push(indent2(`let __pendingChild = null;`));
|
|
31919
31966
|
const paramInit = buildParamInit2(comp.paramNames, comp.propsAlias);
|
|
31920
31967
|
if (paramInit) ctx2.push(indent2(paramInit));
|
|
31968
|
+
const deferredTrackDecls = /* @__PURE__ */ new Set();
|
|
31969
|
+
{
|
|
31970
|
+
const declaredSoFar = /* @__PURE__ */ new Set();
|
|
31971
|
+
for (const node of comp.body) {
|
|
31972
|
+
if (node instanceof TrackDecl) {
|
|
31973
|
+
if (initReadsAnyOf(node.init, declaredSoFar)) deferredTrackDecls.add(node);
|
|
31974
|
+
continue;
|
|
31975
|
+
}
|
|
31976
|
+
for (const name of runtimeDeclaredNames(node)) declaredSoFar.add(name);
|
|
31977
|
+
}
|
|
31978
|
+
}
|
|
31921
31979
|
for (const node of comp.body) {
|
|
31922
|
-
if (node instanceof TrackDecl) {
|
|
31980
|
+
if (node instanceof TrackDecl && !deferredTrackDecls.has(node)) {
|
|
31923
31981
|
emitNode(ctx2, node, tracked2, null);
|
|
31924
31982
|
}
|
|
31925
31983
|
}
|
|
@@ -31946,7 +32004,10 @@ function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydr
|
|
|
31946
32004
|
}
|
|
31947
32005
|
}
|
|
31948
32006
|
for (const node of comp.body) {
|
|
31949
|
-
if (node instanceof TrackDecl)
|
|
32007
|
+
if (node instanceof TrackDecl) {
|
|
32008
|
+
if (deferredTrackDecls.has(node)) emitNode(ctx2, node, tracked2, null);
|
|
32009
|
+
continue;
|
|
32010
|
+
}
|
|
31950
32011
|
const v = emitNode(ctx2, node, tracked2, null, void 0, "__components", topPendingSkip, topBudget || void 0);
|
|
31951
32012
|
if (v) {
|
|
31952
32013
|
if (ctx2.hydrate) {
|
|
@@ -52738,6 +52799,64 @@ function transformTrackedInit2(init, tracked2) {
|
|
|
52738
52799
|
return init;
|
|
52739
52800
|
return transformTracked2({ raw: init, ast: expr }, tracked2);
|
|
52740
52801
|
}
|
|
52802
|
+
function runtimeDeclaredNames2(node) {
|
|
52803
|
+
if (!(node instanceof RuntimeStatement))
|
|
52804
|
+
return [];
|
|
52805
|
+
const stmt = node.ast;
|
|
52806
|
+
if (!stmt || stmt.type !== "VariableDeclaration" || !stmt.declarations)
|
|
52807
|
+
return [];
|
|
52808
|
+
const out = [];
|
|
52809
|
+
for (const d of stmt.declarations) {
|
|
52810
|
+
if (d.id && d.id.type === "Identifier" && typeof d.id.name === "string")
|
|
52811
|
+
out.push(d.id.name);
|
|
52812
|
+
}
|
|
52813
|
+
return out;
|
|
52814
|
+
}
|
|
52815
|
+
function initReadsAnyOf2(init, names) {
|
|
52816
|
+
if (!init || names.size === 0)
|
|
52817
|
+
return false;
|
|
52818
|
+
let expr = null;
|
|
52819
|
+
try {
|
|
52820
|
+
const prog = parse4(`(${init})`);
|
|
52821
|
+
expr = prog.body?.[0]?.type === "ExpressionStatement" ? prog.body[0].expression ?? null : null;
|
|
52822
|
+
} catch {
|
|
52823
|
+
return false;
|
|
52824
|
+
}
|
|
52825
|
+
if (!expr)
|
|
52826
|
+
return false;
|
|
52827
|
+
let found = false;
|
|
52828
|
+
const walk9 = (n) => {
|
|
52829
|
+
if (found || !n || typeof n !== "object")
|
|
52830
|
+
return;
|
|
52831
|
+
if (Array.isArray(n)) {
|
|
52832
|
+
for (const c of n)
|
|
52833
|
+
walk9(c);
|
|
52834
|
+
return;
|
|
52835
|
+
}
|
|
52836
|
+
const t = n.type;
|
|
52837
|
+
if (typeof t !== "string")
|
|
52838
|
+
return;
|
|
52839
|
+
if (t === "Identifier") {
|
|
52840
|
+
if (names.has(n.name))
|
|
52841
|
+
found = true;
|
|
52842
|
+
return;
|
|
52843
|
+
}
|
|
52844
|
+
if (t === "MemberExpression") {
|
|
52845
|
+
const m = n;
|
|
52846
|
+
walk9(m.object);
|
|
52847
|
+
if (m.computed)
|
|
52848
|
+
walk9(m.property);
|
|
52849
|
+
return;
|
|
52850
|
+
}
|
|
52851
|
+
for (const key of Object.keys(n)) {
|
|
52852
|
+
if (key === "loc" || key === "range" || key === "start" || key === "end")
|
|
52853
|
+
continue;
|
|
52854
|
+
walk9(n[key]);
|
|
52855
|
+
}
|
|
52856
|
+
};
|
|
52857
|
+
walk9(expr);
|
|
52858
|
+
return found;
|
|
52859
|
+
}
|
|
52741
52860
|
var NON_BUBBLING_EVENTS2 = /* @__PURE__ */ new Set([
|
|
52742
52861
|
"focus",
|
|
52743
52862
|
"blur",
|
|
@@ -54415,8 +54534,21 @@ function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hyd
|
|
|
54415
54534
|
const paramInit = buildParamInit3(comp.paramNames, comp.propsAlias);
|
|
54416
54535
|
if (paramInit)
|
|
54417
54536
|
ctx2.push(indent3(paramInit));
|
|
54537
|
+
const deferredTrackDecls = /* @__PURE__ */ new Set();
|
|
54538
|
+
{
|
|
54539
|
+
const declaredSoFar = /* @__PURE__ */ new Set();
|
|
54540
|
+
for (const node of comp.body) {
|
|
54541
|
+
if (node instanceof TrackDecl) {
|
|
54542
|
+
if (initReadsAnyOf2(node.init, declaredSoFar))
|
|
54543
|
+
deferredTrackDecls.add(node);
|
|
54544
|
+
continue;
|
|
54545
|
+
}
|
|
54546
|
+
for (const name of runtimeDeclaredNames2(node))
|
|
54547
|
+
declaredSoFar.add(name);
|
|
54548
|
+
}
|
|
54549
|
+
}
|
|
54418
54550
|
for (const node of comp.body) {
|
|
54419
|
-
if (node instanceof TrackDecl) {
|
|
54551
|
+
if (node instanceof TrackDecl && !deferredTrackDecls.has(node)) {
|
|
54420
54552
|
emitNode2(ctx2, node, tracked2, null);
|
|
54421
54553
|
}
|
|
54422
54554
|
}
|
|
@@ -54439,8 +54571,11 @@ function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hyd
|
|
|
54439
54571
|
}
|
|
54440
54572
|
}
|
|
54441
54573
|
for (const node of comp.body) {
|
|
54442
|
-
if (node instanceof TrackDecl)
|
|
54574
|
+
if (node instanceof TrackDecl) {
|
|
54575
|
+
if (deferredTrackDecls.has(node))
|
|
54576
|
+
emitNode2(ctx2, node, tracked2, null);
|
|
54443
54577
|
continue;
|
|
54578
|
+
}
|
|
54444
54579
|
const v = emitNode2(ctx2, node, tracked2, null, void 0, "__components", topPendingSkip, topBudget || void 0);
|
|
54445
54580
|
if (v) {
|
|
54446
54581
|
if (ctx2.hydrate) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/vesk-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.62",
|
|
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.62",
|
|
12
|
+
"@vesk/compiler": "^0.2.62",
|
|
13
|
+
"@vesk/plugin-tailwind": "^0.2.62",
|
|
14
|
+
"@vesk/runtime": "^0.2.62",
|
|
15
15
|
"esrap": "^2.3.0",
|
|
16
16
|
"typescript": "^5.8.0",
|
|
17
17
|
"ws": "^8.18.0",
|