@marko/language-tools 2.5.31 → 2.5.33
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/index.js +10 -6
- package/dist/index.mjs +10 -6
- package/marko.internal.d.ts +4 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2289,7 +2289,11 @@ constructor(_?: Return) {}
|
|
|
2289
2289
|
renderId = this.#getRenderId(child);
|
|
2290
2290
|
if (!renderId && alternates) {
|
|
2291
2291
|
for (const { node } of alternates) {
|
|
2292
|
-
if (renderId = this.#getRenderId(node))
|
|
2292
|
+
if (renderId = this.#getRenderId(node)) {
|
|
2293
|
+
this.#renderIds.set(child, renderId);
|
|
2294
|
+
this.#renderIds.delete(node);
|
|
2295
|
+
break;
|
|
2296
|
+
}
|
|
2293
2297
|
}
|
|
2294
2298
|
}
|
|
2295
2299
|
if (renderId) {
|
|
@@ -2305,8 +2309,8 @@ constructor(_?: Return) {}
|
|
|
2305
2309
|
).write(") {\n");
|
|
2306
2310
|
const ifBody = this.#processBody(child);
|
|
2307
2311
|
if (ifBody == null ? void 0 : ifBody.content) {
|
|
2308
|
-
const scopeExpr = this.#getScopeExpression(child.body);
|
|
2309
2312
|
this.#writeChildren(child, ifBody.content, true);
|
|
2313
|
+
const scopeExpr = this.#getScopeExpression(child.body);
|
|
2310
2314
|
if (scopeExpr) {
|
|
2311
2315
|
this.#extractor.write(`return {
|
|
2312
2316
|
scope: ${scopeExpr}
|
|
@@ -2328,8 +2332,8 @@ scope: ${scopeExpr}
|
|
|
2328
2332
|
}
|
|
2329
2333
|
const alternateBody = this.#processBody(node);
|
|
2330
2334
|
if (alternateBody == null ? void 0 : alternateBody.content) {
|
|
2331
|
-
const scopeExpr = this.#getScopeExpression(node.body);
|
|
2332
2335
|
this.#writeChildren(node, alternateBody.content, true);
|
|
2336
|
+
const scopeExpr = this.#getScopeExpression(node.body);
|
|
2333
2337
|
if (scopeExpr) {
|
|
2334
2338
|
this.#extractor.write(
|
|
2335
2339
|
`return {
|
|
@@ -3196,7 +3200,7 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
|
|
|
3196
3200
|
}
|
|
3197
3201
|
#getRenderId(tag) {
|
|
3198
3202
|
let renderId = this.#renderIds.get(tag);
|
|
3199
|
-
if (renderId
|
|
3203
|
+
if (!renderId && (tag.var || hasHoists(tag))) {
|
|
3200
3204
|
renderId = this.#renderId++;
|
|
3201
3205
|
this.#renderIds.set(tag, renderId);
|
|
3202
3206
|
}
|
|
@@ -3211,8 +3215,8 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
|
|
|
3211
3215
|
let hoistIds;
|
|
3212
3216
|
if (body) {
|
|
3213
3217
|
for (const child of body) {
|
|
3214
|
-
|
|
3215
|
-
|
|
3218
|
+
const renderId = child.type === 1 /* Tag */ && this.#renderIds.get(child);
|
|
3219
|
+
if (renderId && (!child.var || hasHoists(child))) {
|
|
3216
3220
|
if (hoistIds) {
|
|
3217
3221
|
hoistIds.push(renderId);
|
|
3218
3222
|
} else {
|
package/dist/index.mjs
CHANGED
|
@@ -2252,7 +2252,11 @@ constructor(_?: Return) {}
|
|
|
2252
2252
|
renderId = this.#getRenderId(child);
|
|
2253
2253
|
if (!renderId && alternates) {
|
|
2254
2254
|
for (const { node } of alternates) {
|
|
2255
|
-
if (renderId = this.#getRenderId(node))
|
|
2255
|
+
if (renderId = this.#getRenderId(node)) {
|
|
2256
|
+
this.#renderIds.set(child, renderId);
|
|
2257
|
+
this.#renderIds.delete(node);
|
|
2258
|
+
break;
|
|
2259
|
+
}
|
|
2256
2260
|
}
|
|
2257
2261
|
}
|
|
2258
2262
|
if (renderId) {
|
|
@@ -2268,8 +2272,8 @@ constructor(_?: Return) {}
|
|
|
2268
2272
|
).write(") {\n");
|
|
2269
2273
|
const ifBody = this.#processBody(child);
|
|
2270
2274
|
if (ifBody == null ? void 0 : ifBody.content) {
|
|
2271
|
-
const scopeExpr = this.#getScopeExpression(child.body);
|
|
2272
2275
|
this.#writeChildren(child, ifBody.content, true);
|
|
2276
|
+
const scopeExpr = this.#getScopeExpression(child.body);
|
|
2273
2277
|
if (scopeExpr) {
|
|
2274
2278
|
this.#extractor.write(`return {
|
|
2275
2279
|
scope: ${scopeExpr}
|
|
@@ -2291,8 +2295,8 @@ scope: ${scopeExpr}
|
|
|
2291
2295
|
}
|
|
2292
2296
|
const alternateBody = this.#processBody(node);
|
|
2293
2297
|
if (alternateBody == null ? void 0 : alternateBody.content) {
|
|
2294
|
-
const scopeExpr = this.#getScopeExpression(node.body);
|
|
2295
2298
|
this.#writeChildren(node, alternateBody.content, true);
|
|
2299
|
+
const scopeExpr = this.#getScopeExpression(node.body);
|
|
2296
2300
|
if (scopeExpr) {
|
|
2297
2301
|
this.#extractor.write(
|
|
2298
2302
|
`return {
|
|
@@ -3159,7 +3163,7 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
|
|
|
3159
3163
|
}
|
|
3160
3164
|
#getRenderId(tag) {
|
|
3161
3165
|
let renderId = this.#renderIds.get(tag);
|
|
3162
|
-
if (renderId
|
|
3166
|
+
if (!renderId && (tag.var || hasHoists(tag))) {
|
|
3163
3167
|
renderId = this.#renderId++;
|
|
3164
3168
|
this.#renderIds.set(tag, renderId);
|
|
3165
3169
|
}
|
|
@@ -3174,8 +3178,8 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
|
|
|
3174
3178
|
let hoistIds;
|
|
3175
3179
|
if (body) {
|
|
3176
3180
|
for (const child of body) {
|
|
3177
|
-
|
|
3178
|
-
|
|
3181
|
+
const renderId = child.type === 1 /* Tag */ && this.#renderIds.get(child);
|
|
3182
|
+
if (renderId && (!child.var || hasHoists(child))) {
|
|
3179
3183
|
if (hoistIds) {
|
|
3180
3184
|
hoistIds.push(renderId);
|
|
3181
3185
|
} else {
|
package/marko.internal.d.ts
CHANGED
|
@@ -170,7 +170,10 @@ declare global {
|
|
|
170
170
|
export function renderDynamicTag<Name>(tag: Name): DynamicRenderer<Name>;
|
|
171
171
|
|
|
172
172
|
export function returnTag<
|
|
173
|
-
Input extends {
|
|
173
|
+
Input extends {
|
|
174
|
+
value: unknown;
|
|
175
|
+
valueChange?: ((value: any) => void) | false | null;
|
|
176
|
+
},
|
|
174
177
|
>(input: Input): Input;
|
|
175
178
|
|
|
176
179
|
export function forOfTag<
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/language-tools",
|
|
3
3
|
"description": "Marko Language Tools",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.33",
|
|
5
5
|
"bugs": "https://github.com/marko-js/language-server/issues/new?template=Bug_report.md",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"@marko/compiler": "^5.28.4"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@marko/compiler": "^5.39.33",
|
|
18
18
|
"@types/babel__code-frame": "^7.0.6",
|
|
19
19
|
"@typescript/vfs": "^1.6.1",
|
|
20
|
-
"marko": "^5.37.
|
|
20
|
+
"marko": "^5.37.47",
|
|
21
21
|
"mitata": "^1.0.34",
|
|
22
22
|
"tsx": "^4.20.4"
|
|
23
23
|
},
|