@marko/language-tools 2.5.46 → 2.5.48
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 +16 -9
- package/dist/index.mjs +16 -9
- package/marko.internal.d.ts +41 -17
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2831,18 +2831,25 @@ ${isMutatedVar(tag.parent, valueLiteral) ? varLocal(`change__${valueLiteral}.`)
|
|
|
2831
2831
|
curTag = curTag.parent;
|
|
2832
2832
|
}
|
|
2833
2833
|
this.#extractor.write(
|
|
2834
|
-
`${varShared("attrTagFor")}(${templateVar},${accessor})(
|
|
2834
|
+
`${varShared("attrTagFor")}(${templateVar},${accessor})(`
|
|
2835
2835
|
);
|
|
2836
2836
|
} else {
|
|
2837
|
-
this.#extractor.write(`${varShared("attrTag")}(
|
|
2837
|
+
this.#extractor.write(`${varShared("attrTag")}(`);
|
|
2838
|
+
}
|
|
2839
|
+
this.#extractor.write(`"${name}",`);
|
|
2840
|
+
for (const childNode of attrTag) {
|
|
2841
|
+
this.#extractor.write(`{["${name}"`);
|
|
2842
|
+
this.#writeTagNameComment(childNode);
|
|
2843
|
+
this.#extractor.write("]: ");
|
|
2844
|
+
this.#writeTagInputObject(childNode);
|
|
2845
|
+
this.#extractor.write(`}${SEP_COMMA_NEW_LINE}`);
|
|
2846
|
+
}
|
|
2847
|
+
this.#extractor.write(`)${SEP_COMMA_NEW_LINE}`);
|
|
2848
|
+
} else {
|
|
2849
|
+
for (const childNode of attrTag) {
|
|
2850
|
+
this.#writeTagInputObject(childNode);
|
|
2851
|
+
this.#extractor.write(SEP_COMMA_NEW_LINE);
|
|
2838
2852
|
}
|
|
2839
|
-
}
|
|
2840
|
-
for (const childNode of attrTag) {
|
|
2841
|
-
this.#writeTagInputObject(childNode);
|
|
2842
|
-
this.#extractor.write(SEP_COMMA_NEW_LINE);
|
|
2843
|
-
}
|
|
2844
|
-
if (isRepeated) {
|
|
2845
|
-
this.#extractor.write(`])${SEP_COMMA_NEW_LINE}`);
|
|
2846
2853
|
}
|
|
2847
2854
|
}
|
|
2848
2855
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2794,18 +2794,25 @@ ${isMutatedVar(tag.parent, valueLiteral) ? varLocal(`change__${valueLiteral}.`)
|
|
|
2794
2794
|
curTag = curTag.parent;
|
|
2795
2795
|
}
|
|
2796
2796
|
this.#extractor.write(
|
|
2797
|
-
`${varShared("attrTagFor")}(${templateVar},${accessor})(
|
|
2797
|
+
`${varShared("attrTagFor")}(${templateVar},${accessor})(`
|
|
2798
2798
|
);
|
|
2799
2799
|
} else {
|
|
2800
|
-
this.#extractor.write(`${varShared("attrTag")}(
|
|
2800
|
+
this.#extractor.write(`${varShared("attrTag")}(`);
|
|
2801
|
+
}
|
|
2802
|
+
this.#extractor.write(`"${name}",`);
|
|
2803
|
+
for (const childNode of attrTag) {
|
|
2804
|
+
this.#extractor.write(`{["${name}"`);
|
|
2805
|
+
this.#writeTagNameComment(childNode);
|
|
2806
|
+
this.#extractor.write("]: ");
|
|
2807
|
+
this.#writeTagInputObject(childNode);
|
|
2808
|
+
this.#extractor.write(`}${SEP_COMMA_NEW_LINE}`);
|
|
2809
|
+
}
|
|
2810
|
+
this.#extractor.write(`)${SEP_COMMA_NEW_LINE}`);
|
|
2811
|
+
} else {
|
|
2812
|
+
for (const childNode of attrTag) {
|
|
2813
|
+
this.#writeTagInputObject(childNode);
|
|
2814
|
+
this.#extractor.write(SEP_COMMA_NEW_LINE);
|
|
2801
2815
|
}
|
|
2802
|
-
}
|
|
2803
|
-
for (const childNode of attrTag) {
|
|
2804
|
-
this.#writeTagInputObject(childNode);
|
|
2805
|
-
this.#extractor.write(SEP_COMMA_NEW_LINE);
|
|
2806
|
-
}
|
|
2807
|
-
if (isRepeated) {
|
|
2808
|
-
this.#extractor.write(`])${SEP_COMMA_NEW_LINE}`);
|
|
2809
2816
|
}
|
|
2810
2817
|
}
|
|
2811
2818
|
}
|
package/marko.internal.d.ts
CHANGED
|
@@ -24,11 +24,16 @@ declare global {
|
|
|
24
24
|
override: Override,
|
|
25
25
|
): [0] extends [1 & Override] ? Marko.Global : Override;
|
|
26
26
|
|
|
27
|
-
export function hoist<T
|
|
27
|
+
export function hoist<T>(
|
|
28
28
|
value: () => T,
|
|
29
|
-
): T extends (
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
): T extends () => infer R ? T & Iterable<R> : never;
|
|
30
|
+
// TODO: hoist should really be the below implementation which accounts for hoisting from unknown
|
|
31
|
+
// sections causing the getter to return undefined. Right now the type says it always has a value.
|
|
32
|
+
// export function hoist<T, U = T>(
|
|
33
|
+
// value: () => T,
|
|
34
|
+
// ): T extends () => infer R
|
|
35
|
+
// ? (T | (U extends undefined ? () => undefined : never)) & Iterable<R>
|
|
36
|
+
// : never;
|
|
32
37
|
|
|
33
38
|
export function attrTagNames<Tag>(
|
|
34
39
|
tag: Tag,
|
|
@@ -126,7 +131,9 @@ declare global {
|
|
|
126
131
|
: never
|
|
127
132
|
>;
|
|
128
133
|
|
|
129
|
-
export function change<const Item>(
|
|
134
|
+
export function change<const Item extends readonly unknown[]>(
|
|
135
|
+
...item: Item
|
|
136
|
+
): UnionToIntersection<
|
|
130
137
|
Item extends
|
|
131
138
|
| readonly [infer LocalName extends string, infer Data]
|
|
132
139
|
| readonly [
|
|
@@ -392,23 +399,29 @@ declare global {
|
|
|
392
399
|
export function mergeAttrTags<Attrs extends readonly any[]>(
|
|
393
400
|
...attrs: Attrs
|
|
394
401
|
): MergeAttrTags<Attrs>;
|
|
395
|
-
export function attrTag<
|
|
402
|
+
export function attrTag<
|
|
403
|
+
Name extends string,
|
|
404
|
+
AttrTags extends readonly { [K in Name]: unknown }[],
|
|
405
|
+
>(name: Name, ...attrTags: AttrTags): AttrTagsToAttrTag<Name, AttrTags>;
|
|
396
406
|
export function attrTagFor<Tag, Path extends readonly string[]>(
|
|
397
407
|
tag: Tag,
|
|
398
408
|
...path: Path
|
|
399
409
|
): <
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
410
|
+
Name extends string,
|
|
411
|
+
AttrTags extends Record<
|
|
412
|
+
Name,
|
|
413
|
+
[0] extends [1 & Tag]
|
|
414
|
+
? Marko.AttrTag<unknown>
|
|
415
|
+
: Marko.Input<Tag> extends infer Input
|
|
416
|
+
? [0] extends [1 & Input]
|
|
417
|
+
? Marko.AttrTag<unknown>
|
|
418
|
+
: AttrTagValue<Marko.Input<Tag>, Path>
|
|
419
|
+
: Marko.AttrTag<unknown>
|
|
420
|
+
>[],
|
|
407
421
|
>(
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
: any;
|
|
422
|
+
name: Name,
|
|
423
|
+
...attrTags: AttrTags
|
|
424
|
+
) => AttrTagsToAttrTag<Name, AttrTags>;
|
|
412
425
|
|
|
413
426
|
// TODO: this could be improved.
|
|
414
427
|
// currently falls back to DefaultRenderer too eagerly.
|
|
@@ -580,6 +593,17 @@ type MergeAttrTagValue<A, B> = A extends readonly (infer AType)[]
|
|
|
580
593
|
? A
|
|
581
594
|
: A | B;
|
|
582
595
|
|
|
596
|
+
type AttrTagsToAttrTag<
|
|
597
|
+
Name extends string,
|
|
598
|
+
AttrTags extends readonly unknown[],
|
|
599
|
+
> = AttrTags[number] extends infer AttrTag
|
|
600
|
+
? AttrTag extends { [K in Name]: Marko.AttrTag<infer Input> }
|
|
601
|
+
? [0] extends [1 & Input]
|
|
602
|
+
? never
|
|
603
|
+
: Marko.AttrTag<Input>
|
|
604
|
+
: never
|
|
605
|
+
: never;
|
|
606
|
+
|
|
583
607
|
type AttrTagByListSize<T, Item> = T extends
|
|
584
608
|
| readonly [any, ...any[]]
|
|
585
609
|
| readonly [...any[], any]
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/language-tools",
|
|
3
3
|
"description": "Marko Language Tools",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.48",
|
|
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/parser": "^7.28.
|
|
10
|
+
"@babel/parser": "^7.28.6",
|
|
11
11
|
"@luxass/strip-json-comments": "^1.4.0",
|
|
12
12
|
"htmljs-parser": "^5.7.4",
|
|
13
13
|
"relative-import-path": "^1.0.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@babel/code-frame": "^7.
|
|
17
|
-
"@marko/compiler": "^5.39.
|
|
18
|
-
"@types/babel__code-frame": "^7.0
|
|
16
|
+
"@babel/code-frame": "^7.28.6",
|
|
17
|
+
"@marko/compiler": "^5.39.49",
|
|
18
|
+
"@types/babel__code-frame": "^7.27.0",
|
|
19
19
|
"@typescript/vfs": "^1.6.2",
|
|
20
|
-
"marko": "^5.38.
|
|
20
|
+
"marko": "^5.38.18",
|
|
21
21
|
"mitata": "^1.0.34",
|
|
22
22
|
"tsx": "^4.21.0"
|
|
23
23
|
},
|