@vesk/compiler 0.2.58 → 0.2.59
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-codegen.d.ts","sourceRoot":"","sources":["../src/client-codegen.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAGL,cAAc,EAQd,gBAAgB,EASjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAkGxD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;CAC1B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI1D;AAiDD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAgJlI;AAID,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAU5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,EAAE,CAuB9F;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAY5F;AAoBD,qDAAqD;AACrD,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAA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
|
package/dist/client-codegen.js
CHANGED
|
@@ -989,12 +989,34 @@ function emitClientHead(ctx, node, tracked) {
|
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
|
+
/**
|
|
993
|
+
* Whether an expression can change after first render.
|
|
994
|
+
*
|
|
995
|
+
* Two ways it can:
|
|
996
|
+
* 1. it reads `props` or a locally declared `track()` binding — visible
|
|
997
|
+
* statically; or
|
|
998
|
+
* 2. it CALLS something. A call is the only way to hide a cell read behind a
|
|
999
|
+
* function boundary, and hiding one is not exotic — it is the documented
|
|
1000
|
+
* store pattern: a module-scope `track()` cell published as an accessor
|
|
1001
|
+
* (`notificationDrawerCell.get()`, `isAuthenticated()`,
|
|
1002
|
+
* `unreadNotificationCount()`). The compiler cannot see inside those calls,
|
|
1003
|
+
* so it must assume they subscribe; the runtime's `get()` records the
|
|
1004
|
+
* dependency when the expression is evaluated inside the emitted effect,
|
|
1005
|
+
* which is exactly where these conditions are re-evaluated.
|
|
1006
|
+
*
|
|
1007
|
+
* Treating a call as reactive costs one never-firing effect for a genuinely
|
|
1008
|
+
* static condition. The opposite mistake — treating a store-backed condition as
|
|
1009
|
+
* static — is a component that renders once and never updates again.
|
|
1010
|
+
*/
|
|
992
1011
|
function isReactiveExpression(node, tracked) {
|
|
993
1012
|
const ast = node && (node.ast || node);
|
|
994
1013
|
if (!ast)
|
|
995
1014
|
return false;
|
|
996
1015
|
let reactive = false;
|
|
997
1016
|
walk(ast, tracked, {
|
|
1017
|
+
CallExpression() {
|
|
1018
|
+
reactive = true;
|
|
1019
|
+
},
|
|
998
1020
|
Identifier(n, context) {
|
|
999
1021
|
if (reactive)
|
|
1000
1022
|
return;
|
|
@@ -1236,10 +1258,20 @@ function emitComponentCall(ctx, node, tracked, effectsVar, parentVar, compPrefix
|
|
|
1236
1258
|
ctx.push(`return $f; })();`);
|
|
1237
1259
|
propsEntries.push(`children: ${frag}`);
|
|
1238
1260
|
}
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1261
|
+
// Deposit the residue for the child's first top-level claim (it runs on
|
|
1262
|
+
// this same walker with its own zero `topPendingSkip`). A region budget is
|
|
1263
|
+
// spent by THIS call, so sibling claims in the branch stay positional.
|
|
1264
|
+
//
|
|
1265
|
+
// The deposit goes down for PLAIN targets too: "imported value" does not mean
|
|
1266
|
+
// "cannot claim". lucide-vesk icons are imported functions that follow the
|
|
1267
|
+
// framework component protocol `(props, registry, walker)` and claim their own
|
|
1268
|
+
// SSR root through it, so without the deposit they claimed the slot holding the
|
|
1269
|
+
// STATIC residue in front of them (`<button><span>Apply Now</span><svg/></button>`)
|
|
1270
|
+
// — the descriptor missed on `<span>` and the walker detached real
|
|
1271
|
+
// server-rendered content. A plain target that does NOT claim simply leaves the
|
|
1272
|
+
// deposit for the post-call adoption claim below, which carries an explicit
|
|
1273
|
+
// offset and therefore consumes/clears it.
|
|
1274
|
+
if (ctx.markerless && promptExpr) {
|
|
1243
1275
|
ctx.push(`${walkerArg}.injectSkipK(${promptExpr});`);
|
|
1244
1276
|
}
|
|
1245
1277
|
ctx.push(`let ${v} = undefined;`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ir-generator.d.ts","sourceRoot":"","sources":["../src/ir-generator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAsBP,MAAM,uBAAuB,CAAC;AA2T/B,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkCnL;
|
|
1
|
+
{"version":3,"file":"ir-generator.d.ts","sourceRoot":"","sources":["../src/ir-generator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAsBP,MAAM,uBAAuB,CAAC;AA2T/B,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkCnL;AAgmDD,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAqV9E"}
|
package/dist/ir-generator.js
CHANGED
|
@@ -2033,6 +2033,11 @@ function warnStaleConstBindings(comp, file) {
|
|
|
2033
2033
|
continue;
|
|
2034
2034
|
if (reactive.has(d.id.name))
|
|
2035
2035
|
continue;
|
|
2036
|
+
// A FUNCTION initializer is not a snapshot: the body runs whenever the
|
|
2037
|
+
// binding is evaluated, so the tracked read happens there. Reporting it
|
|
2038
|
+
// pushed authors to inline helpers that were already correct.
|
|
2039
|
+
if (d.init.type === 'ArrowFunctionExpression' || d.init.type === 'FunctionExpression')
|
|
2040
|
+
continue;
|
|
2036
2041
|
// A bare identifier initializer is an ALIAS, not a read: `const copy =
|
|
2037
2042
|
// selCell` re-binds the cell and stays live. Only a read snapshots.
|
|
2038
2043
|
if (d.init.type === 'Identifier' && reactive.has(d.init.name))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/compiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.59",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk compiler — lexer, parser, semantic analysis, IR, codegen",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@sveltejs/acorn-typescript": "^1.0.0",
|
|
23
|
-
"@vesk/types": "^0.2.
|
|
23
|
+
"@vesk/types": "^0.2.59",
|
|
24
24
|
"acorn": "^8.15.0",
|
|
25
25
|
"esrap": "^2.3.0",
|
|
26
26
|
"is-reference": "^3.0.0",
|