@marko/language-tools 2.5.47 → 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 +32 -13
- package/package.json +1 -1
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
|
@@ -131,7 +131,9 @@ declare global {
|
|
|
131
131
|
: never
|
|
132
132
|
>;
|
|
133
133
|
|
|
134
|
-
export function change<const Item>(
|
|
134
|
+
export function change<const Item extends readonly unknown[]>(
|
|
135
|
+
...item: Item
|
|
136
|
+
): UnionToIntersection<
|
|
135
137
|
Item extends
|
|
136
138
|
| readonly [infer LocalName extends string, infer Data]
|
|
137
139
|
| readonly [
|
|
@@ -397,23 +399,29 @@ declare global {
|
|
|
397
399
|
export function mergeAttrTags<Attrs extends readonly any[]>(
|
|
398
400
|
...attrs: Attrs
|
|
399
401
|
): MergeAttrTags<Attrs>;
|
|
400
|
-
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>;
|
|
401
406
|
export function attrTagFor<Tag, Path extends readonly string[]>(
|
|
402
407
|
tag: Tag,
|
|
403
408
|
...path: Path
|
|
404
409
|
): <
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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
|
+
>[],
|
|
412
421
|
>(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
: any;
|
|
422
|
+
name: Name,
|
|
423
|
+
...attrTags: AttrTags
|
|
424
|
+
) => AttrTagsToAttrTag<Name, AttrTags>;
|
|
417
425
|
|
|
418
426
|
// TODO: this could be improved.
|
|
419
427
|
// currently falls back to DefaultRenderer too eagerly.
|
|
@@ -585,6 +593,17 @@ type MergeAttrTagValue<A, B> = A extends readonly (infer AType)[]
|
|
|
585
593
|
? A
|
|
586
594
|
: A | B;
|
|
587
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
|
+
|
|
588
607
|
type AttrTagByListSize<T, Item> = T extends
|
|
589
608
|
| readonly [any, ...any[]]
|
|
590
609
|
| readonly [...any[], any]
|
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.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"
|