@marko/language-tools 2.1.4 → 2.1.6
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 +33 -11
- package/dist/index.mjs +33 -11
- package/marko.internal.d.ts +4 -4
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1066,10 +1066,7 @@ function crawlProgramScope(parsed, scriptParser) {
|
|
|
1066
1066
|
case 16 /* AttrTag */: {
|
|
1067
1067
|
if (child.var) {
|
|
1068
1068
|
parentScope.bindings ??= {};
|
|
1069
|
-
const parsedFn = scriptParser.expressionAt(
|
|
1070
|
-
child.var.value.start - 6,
|
|
1071
|
-
`${read(child.var.value)}=0`
|
|
1072
|
-
);
|
|
1069
|
+
const parsedFn = scriptParser.expressionAt(child.var.value.start - 6, `${read(child.var.value)}=0`);
|
|
1073
1070
|
if (parsedFn) {
|
|
1074
1071
|
const lVal = parsedFn.left;
|
|
1075
1072
|
checkForMutations(parentScope, lVal);
|
|
@@ -1440,7 +1437,9 @@ function trackMutations(node, scope, mutations, parentBlock, parentBlockShadows,
|
|
|
1440
1437
|
}
|
|
1441
1438
|
break;
|
|
1442
1439
|
case "ClassDeclaration":
|
|
1443
|
-
|
|
1440
|
+
if (node.id) {
|
|
1441
|
+
trackShadows(node.id, scope, parentBlockShadows);
|
|
1442
|
+
}
|
|
1444
1443
|
block = node.body;
|
|
1445
1444
|
blockShadows = new Set(blockShadows);
|
|
1446
1445
|
blockMutations = [];
|
|
@@ -3168,7 +3167,7 @@ var marko_default = {
|
|
|
3168
3167
|
extension: ".marko",
|
|
3169
3168
|
create({ ts, host, configFile }) {
|
|
3170
3169
|
const currentDirectory = host.getCurrentDirectory ? host.getCurrentDirectory() : ts.sys.getCurrentDirectory();
|
|
3171
|
-
const defaultScriptLang = configFile && /tsconfig.
|
|
3170
|
+
const defaultScriptLang = configFile && /tsconfig/g.test(configFile) ? "ts" /* ts */ : "js" /* js */;
|
|
3172
3171
|
const runtimeTypes = getTypeLibs(currentDirectory, ts, host);
|
|
3173
3172
|
const rootNames = [
|
|
3174
3173
|
runtimeTypes.internalTypesFile,
|
|
@@ -3450,11 +3449,13 @@ var HTMLExtractor = class {
|
|
|
3450
3449
|
hasDynamicAttrs = true;
|
|
3451
3450
|
});
|
|
3452
3451
|
this.#extractor.write(">");
|
|
3453
|
-
(
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3452
|
+
if (!isVoidTag(node.nameText)) {
|
|
3453
|
+
(_b = node.body) == null ? void 0 : _b.forEach((child) => {
|
|
3454
|
+
if (this.#visitNode(child))
|
|
3455
|
+
hasDynamicBody = true;
|
|
3456
|
+
});
|
|
3457
|
+
this.#extractor.write(`</${node.nameText}>`);
|
|
3458
|
+
}
|
|
3458
3459
|
return { hasDynamicAttrs, hasDynamicBody };
|
|
3459
3460
|
}
|
|
3460
3461
|
#writeCustomTag(node) {
|
|
@@ -3499,6 +3500,27 @@ var HTMLExtractor = class {
|
|
|
3499
3500
|
}
|
|
3500
3501
|
}
|
|
3501
3502
|
};
|
|
3503
|
+
function isVoidTag(tagName) {
|
|
3504
|
+
switch (tagName) {
|
|
3505
|
+
case "area":
|
|
3506
|
+
case "base":
|
|
3507
|
+
case "br":
|
|
3508
|
+
case "col":
|
|
3509
|
+
case "embed":
|
|
3510
|
+
case "hr":
|
|
3511
|
+
case "img":
|
|
3512
|
+
case "input":
|
|
3513
|
+
case "link":
|
|
3514
|
+
case "meta":
|
|
3515
|
+
case "param":
|
|
3516
|
+
case "source":
|
|
3517
|
+
case "track":
|
|
3518
|
+
case "wbr":
|
|
3519
|
+
return true;
|
|
3520
|
+
default:
|
|
3521
|
+
return false;
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3502
3524
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3503
3525
|
0 && (module.exports = {
|
|
3504
3526
|
NodeType,
|
package/dist/index.mjs
CHANGED
|
@@ -1034,10 +1034,7 @@ function crawlProgramScope(parsed, scriptParser) {
|
|
|
1034
1034
|
case 16 /* AttrTag */: {
|
|
1035
1035
|
if (child.var) {
|
|
1036
1036
|
parentScope.bindings ??= {};
|
|
1037
|
-
const parsedFn = scriptParser.expressionAt(
|
|
1038
|
-
child.var.value.start - 6,
|
|
1039
|
-
`${read(child.var.value)}=0`
|
|
1040
|
-
);
|
|
1037
|
+
const parsedFn = scriptParser.expressionAt(child.var.value.start - 6, `${read(child.var.value)}=0`);
|
|
1041
1038
|
if (parsedFn) {
|
|
1042
1039
|
const lVal = parsedFn.left;
|
|
1043
1040
|
checkForMutations(parentScope, lVal);
|
|
@@ -1408,7 +1405,9 @@ function trackMutations(node, scope, mutations, parentBlock, parentBlockShadows,
|
|
|
1408
1405
|
}
|
|
1409
1406
|
break;
|
|
1410
1407
|
case "ClassDeclaration":
|
|
1411
|
-
|
|
1408
|
+
if (node.id) {
|
|
1409
|
+
trackShadows(node.id, scope, parentBlockShadows);
|
|
1410
|
+
}
|
|
1412
1411
|
block = node.body;
|
|
1413
1412
|
blockShadows = new Set(blockShadows);
|
|
1414
1413
|
blockMutations = [];
|
|
@@ -3136,7 +3135,7 @@ var marko_default = {
|
|
|
3136
3135
|
extension: ".marko",
|
|
3137
3136
|
create({ ts, host, configFile }) {
|
|
3138
3137
|
const currentDirectory = host.getCurrentDirectory ? host.getCurrentDirectory() : ts.sys.getCurrentDirectory();
|
|
3139
|
-
const defaultScriptLang = configFile && /tsconfig.
|
|
3138
|
+
const defaultScriptLang = configFile && /tsconfig/g.test(configFile) ? "ts" /* ts */ : "js" /* js */;
|
|
3140
3139
|
const runtimeTypes = getTypeLibs(currentDirectory, ts, host);
|
|
3141
3140
|
const rootNames = [
|
|
3142
3141
|
runtimeTypes.internalTypesFile,
|
|
@@ -3418,11 +3417,13 @@ var HTMLExtractor = class {
|
|
|
3418
3417
|
hasDynamicAttrs = true;
|
|
3419
3418
|
});
|
|
3420
3419
|
this.#extractor.write(">");
|
|
3421
|
-
(
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3420
|
+
if (!isVoidTag(node.nameText)) {
|
|
3421
|
+
(_b = node.body) == null ? void 0 : _b.forEach((child) => {
|
|
3422
|
+
if (this.#visitNode(child))
|
|
3423
|
+
hasDynamicBody = true;
|
|
3424
|
+
});
|
|
3425
|
+
this.#extractor.write(`</${node.nameText}>`);
|
|
3426
|
+
}
|
|
3426
3427
|
return { hasDynamicAttrs, hasDynamicBody };
|
|
3427
3428
|
}
|
|
3428
3429
|
#writeCustomTag(node) {
|
|
@@ -3467,6 +3468,27 @@ var HTMLExtractor = class {
|
|
|
3467
3468
|
}
|
|
3468
3469
|
}
|
|
3469
3470
|
};
|
|
3471
|
+
function isVoidTag(tagName) {
|
|
3472
|
+
switch (tagName) {
|
|
3473
|
+
case "area":
|
|
3474
|
+
case "base":
|
|
3475
|
+
case "br":
|
|
3476
|
+
case "col":
|
|
3477
|
+
case "embed":
|
|
3478
|
+
case "hr":
|
|
3479
|
+
case "img":
|
|
3480
|
+
case "input":
|
|
3481
|
+
case "link":
|
|
3482
|
+
case "meta":
|
|
3483
|
+
case "param":
|
|
3484
|
+
case "source":
|
|
3485
|
+
case "track":
|
|
3486
|
+
case "wbr":
|
|
3487
|
+
return true;
|
|
3488
|
+
default:
|
|
3489
|
+
return false;
|
|
3490
|
+
}
|
|
3491
|
+
}
|
|
3470
3492
|
export {
|
|
3471
3493
|
NodeType,
|
|
3472
3494
|
processors_exports as Processors,
|
package/marko.internal.d.ts
CHANGED
|
@@ -224,7 +224,7 @@ declare global {
|
|
|
224
224
|
): {
|
|
225
225
|
[Key in keyof Return]: Return[Key] extends
|
|
226
226
|
| readonly (infer Item)[]
|
|
227
|
-
| infer Item
|
|
227
|
+
| infer Item extends Record<PropertyKey, any>
|
|
228
228
|
? AttrTagByListSize<Value, Item>
|
|
229
229
|
: never;
|
|
230
230
|
};
|
|
@@ -237,7 +237,7 @@ declare global {
|
|
|
237
237
|
): {
|
|
238
238
|
[Key in keyof Return]: Return[Key] extends
|
|
239
239
|
| readonly (infer Item)[]
|
|
240
|
-
| infer Item
|
|
240
|
+
| infer Item extends Record<PropertyKey, any>
|
|
241
241
|
? AttrTagByObjectSize<Value, Item>
|
|
242
242
|
: never;
|
|
243
243
|
};
|
|
@@ -257,7 +257,7 @@ declare global {
|
|
|
257
257
|
): {
|
|
258
258
|
[Key in keyof Return]: Return[Key] extends
|
|
259
259
|
| readonly (infer Item)[]
|
|
260
|
-
| infer Item
|
|
260
|
+
| infer Item extends Record<PropertyKey, any>
|
|
261
261
|
? number extends From | To | Step
|
|
262
262
|
? MaybeRepeatable<Item>
|
|
263
263
|
: Step extends 0
|
|
@@ -285,7 +285,7 @@ declare global {
|
|
|
285
285
|
}): {
|
|
286
286
|
[Key in keyof Return]: Return[Key] extends
|
|
287
287
|
| readonly (infer Item)[]
|
|
288
|
-
| infer Item
|
|
288
|
+
| infer Item extends Record<PropertyKey, any>
|
|
289
289
|
? MaybeRepeatable<Item>
|
|
290
290
|
: never;
|
|
291
291
|
};
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/language-tools",
|
|
3
3
|
"description": "Marko Language Tools",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.6",
|
|
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"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@babel/helper-validator-identifier": "^7.22.
|
|
11
|
-
"@babel/parser": "^7.
|
|
10
|
+
"@babel/helper-validator-identifier": "^7.22.20",
|
|
11
|
+
"@babel/parser": "^7.23.0",
|
|
12
12
|
"htmljs-parser": "^5.5.0",
|
|
13
13
|
"relative-import-path": "^1.0.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@babel/code-frame": "^7.22.
|
|
17
|
-
"@marko/compiler": "^5.
|
|
18
|
-
"@marko/translator-default": "^5.
|
|
19
|
-
"@types/babel__code-frame": "^7.0.
|
|
16
|
+
"@babel/code-frame": "^7.22.13",
|
|
17
|
+
"@marko/compiler": "^5.33.2",
|
|
18
|
+
"@marko/translator-default": "^5.31.3",
|
|
19
|
+
"@types/babel__code-frame": "^7.0.4",
|
|
20
20
|
"@types/babel__helper-validator-identifier": "^7.15.0",
|
|
21
21
|
"@typescript/vfs": "^1.5.0",
|
|
22
|
-
"marko": "^5.
|
|
22
|
+
"marko": "^5.31.10",
|
|
23
23
|
"mitata": "^0.1.6",
|
|
24
|
-
"tsx": "^3.
|
|
24
|
+
"tsx": "^3.13.0"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|