@marko/language-tools 2.4.8 → 2.5.0
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 +34 -6
- package/dist/index.mjs +34 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1185,7 +1185,22 @@ function crawlProgramScope(parsed, scriptParser) {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
|
-
|
|
1188
|
+
if (child.nameText === "script" && child.body) {
|
|
1189
|
+
checkForMutations(
|
|
1190
|
+
parentScope,
|
|
1191
|
+
scriptParser.expressionAt(
|
|
1192
|
+
child.body[0].start - "()=>{\n".length,
|
|
1193
|
+
`()=>{
|
|
1194
|
+
${read({
|
|
1195
|
+
start: child.body[0].start,
|
|
1196
|
+
end: child.body[child.body.length - 1].end
|
|
1197
|
+
})}
|
|
1198
|
+
}`
|
|
1199
|
+
)
|
|
1200
|
+
);
|
|
1201
|
+
} else {
|
|
1202
|
+
visit(child.body, bodyScope);
|
|
1203
|
+
}
|
|
1189
1204
|
Scopes.set(child.body, bodyScope);
|
|
1190
1205
|
}
|
|
1191
1206
|
if (child.attrs) {
|
|
@@ -2658,9 +2673,12 @@ const attrTags = ${varShared(
|
|
|
2658
2673
|
if (this.#writeAttrs(tag)) {
|
|
2659
2674
|
hasInput = true;
|
|
2660
2675
|
}
|
|
2661
|
-
const
|
|
2676
|
+
const isScript = tag.nameText === "script";
|
|
2677
|
+
const body = !isScript ? this.#processBody(tag) : void 0;
|
|
2662
2678
|
let hasRenderBody = false;
|
|
2663
|
-
if (
|
|
2679
|
+
if (isScript) {
|
|
2680
|
+
hasRenderBody = !!tag.body;
|
|
2681
|
+
} else if (body) {
|
|
2664
2682
|
hasInput = true;
|
|
2665
2683
|
this.#writeAttrTags(body, false, nestedTagType);
|
|
2666
2684
|
hasRenderBody = body.renderBody !== void 0;
|
|
@@ -2681,15 +2699,25 @@ const attrTags = ${varShared(
|
|
|
2681
2699
|
this.#extractor.write(`(() => {
|
|
2682
2700
|
`);
|
|
2683
2701
|
}
|
|
2684
|
-
|
|
2685
|
-
|
|
2702
|
+
let didReturn = false;
|
|
2703
|
+
if (isScript) {
|
|
2704
|
+
if (tag.body) {
|
|
2705
|
+
this.#copyWithMutationsReplaced({
|
|
2706
|
+
start: tag.body[0].start,
|
|
2707
|
+
end: tag.body[tag.body.length - 1].end
|
|
2708
|
+
});
|
|
2709
|
+
didReturn = this.#writeChildren(tag, []);
|
|
2710
|
+
}
|
|
2711
|
+
} else if (body == null ? void 0 : body.renderBody) {
|
|
2712
|
+
didReturn = this.#writeChildren(tag, body.renderBody);
|
|
2713
|
+
}
|
|
2686
2714
|
if (!tag.params) {
|
|
2687
2715
|
this.#extractor.write(`return () => {
|
|
2688
2716
|
`);
|
|
2689
2717
|
}
|
|
2690
2718
|
this.#writeReturn(
|
|
2691
2719
|
didReturn ? `${varLocal("return")}.return` : void 0,
|
|
2692
|
-
|
|
2720
|
+
getHoistSources(tag)
|
|
2693
2721
|
);
|
|
2694
2722
|
if (tag.params) {
|
|
2695
2723
|
this.#extractor.write("})");
|
package/dist/index.mjs
CHANGED
|
@@ -1146,7 +1146,22 @@ function crawlProgramScope(parsed, scriptParser) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
1148
|
}
|
|
1149
|
-
|
|
1149
|
+
if (child.nameText === "script" && child.body) {
|
|
1150
|
+
checkForMutations(
|
|
1151
|
+
parentScope,
|
|
1152
|
+
scriptParser.expressionAt(
|
|
1153
|
+
child.body[0].start - "()=>{\n".length,
|
|
1154
|
+
`()=>{
|
|
1155
|
+
${read({
|
|
1156
|
+
start: child.body[0].start,
|
|
1157
|
+
end: child.body[child.body.length - 1].end
|
|
1158
|
+
})}
|
|
1159
|
+
}`
|
|
1160
|
+
)
|
|
1161
|
+
);
|
|
1162
|
+
} else {
|
|
1163
|
+
visit(child.body, bodyScope);
|
|
1164
|
+
}
|
|
1150
1165
|
Scopes.set(child.body, bodyScope);
|
|
1151
1166
|
}
|
|
1152
1167
|
if (child.attrs) {
|
|
@@ -2622,9 +2637,12 @@ const attrTags = ${varShared(
|
|
|
2622
2637
|
if (this.#writeAttrs(tag)) {
|
|
2623
2638
|
hasInput = true;
|
|
2624
2639
|
}
|
|
2625
|
-
const
|
|
2640
|
+
const isScript = tag.nameText === "script";
|
|
2641
|
+
const body = !isScript ? this.#processBody(tag) : void 0;
|
|
2626
2642
|
let hasRenderBody = false;
|
|
2627
|
-
if (
|
|
2643
|
+
if (isScript) {
|
|
2644
|
+
hasRenderBody = !!tag.body;
|
|
2645
|
+
} else if (body) {
|
|
2628
2646
|
hasInput = true;
|
|
2629
2647
|
this.#writeAttrTags(body, false, nestedTagType);
|
|
2630
2648
|
hasRenderBody = body.renderBody !== void 0;
|
|
@@ -2645,15 +2663,25 @@ const attrTags = ${varShared(
|
|
|
2645
2663
|
this.#extractor.write(`(() => {
|
|
2646
2664
|
`);
|
|
2647
2665
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2666
|
+
let didReturn = false;
|
|
2667
|
+
if (isScript) {
|
|
2668
|
+
if (tag.body) {
|
|
2669
|
+
this.#copyWithMutationsReplaced({
|
|
2670
|
+
start: tag.body[0].start,
|
|
2671
|
+
end: tag.body[tag.body.length - 1].end
|
|
2672
|
+
});
|
|
2673
|
+
didReturn = this.#writeChildren(tag, []);
|
|
2674
|
+
}
|
|
2675
|
+
} else if (body == null ? void 0 : body.renderBody) {
|
|
2676
|
+
didReturn = this.#writeChildren(tag, body.renderBody);
|
|
2677
|
+
}
|
|
2650
2678
|
if (!tag.params) {
|
|
2651
2679
|
this.#extractor.write(`return () => {
|
|
2652
2680
|
`);
|
|
2653
2681
|
}
|
|
2654
2682
|
this.#writeReturn(
|
|
2655
2683
|
didReturn ? `${varLocal("return")}.return` : void 0,
|
|
2656
|
-
|
|
2684
|
+
getHoistSources(tag)
|
|
2657
2685
|
);
|
|
2658
2686
|
if (tag.params) {
|
|
2659
2687
|
this.#extractor.write("})");
|
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.
|
|
4
|
+
"version": "2.5.0",
|
|
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"
|