@marko/language-tools 2.5.49 → 2.5.51
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 +3 -1
- package/dist/index.mjs +3 -1
- package/marko.internal.d.ts +45 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2572,8 +2572,10 @@ scope: ${scopeExpr}
|
|
|
2572
2572
|
this.#extractor.write(`${varShared("renderNativeTag")}("`).copy(isEmptyRange2(tag.name) ? tagName : tag.name).write('")');
|
|
2573
2573
|
} else if (templateVar) {
|
|
2574
2574
|
this.#extractor.write(
|
|
2575
|
-
`${varShared(isTemplate ? "renderTemplate" : "renderDynamicTag")}(${templateVar}
|
|
2575
|
+
`${varShared(isTemplate ? "renderTemplate" : "renderDynamicTag")}(${templateVar}`
|
|
2576
2576
|
);
|
|
2577
|
+
this.#writeTagNameComment(tag);
|
|
2578
|
+
this.#extractor.write(")");
|
|
2577
2579
|
} else {
|
|
2578
2580
|
this.#extractor.write(varShared("missingTag"));
|
|
2579
2581
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2535,8 +2535,10 @@ scope: ${scopeExpr}
|
|
|
2535
2535
|
this.#extractor.write(`${varShared("renderNativeTag")}("`).copy(isEmptyRange2(tag.name) ? tagName : tag.name).write('")');
|
|
2536
2536
|
} else if (templateVar) {
|
|
2537
2537
|
this.#extractor.write(
|
|
2538
|
-
`${varShared(isTemplate ? "renderTemplate" : "renderDynamicTag")}(${templateVar}
|
|
2538
|
+
`${varShared(isTemplate ? "renderTemplate" : "renderDynamicTag")}(${templateVar}`
|
|
2539
2539
|
);
|
|
2540
|
+
this.#writeTagNameComment(tag);
|
|
2541
|
+
this.#extractor.write(")");
|
|
2540
2542
|
} else {
|
|
2541
2543
|
this.#extractor.write(varShared("missingTag"));
|
|
2542
2544
|
}
|
package/marko.internal.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ declare global {
|
|
|
37
37
|
|
|
38
38
|
export function attrTagNames<Tag>(
|
|
39
39
|
tag: Tag,
|
|
40
|
-
fn: (input: AttrTagNames<
|
|
40
|
+
fn: (input: AttrTagNames<InputFor<Tag>>) => void,
|
|
41
41
|
): void;
|
|
42
42
|
export function nestedAttrTagNames<Input>(
|
|
43
43
|
input: Input,
|
|
@@ -50,17 +50,7 @@ declare global {
|
|
|
50
50
|
name: Name,
|
|
51
51
|
): Marko.NativeTags[Name]["return"]["value"];
|
|
52
52
|
|
|
53
|
-
export function contentFor<Name>(
|
|
54
|
-
tag: Name,
|
|
55
|
-
): [0] extends [1 & Name]
|
|
56
|
-
? DefaultBodyContentKey
|
|
57
|
-
: Name extends { api: infer API }
|
|
58
|
-
? API extends "tags"
|
|
59
|
-
? "content"
|
|
60
|
-
: API extends "class"
|
|
61
|
-
? "renderBody"
|
|
62
|
-
: DefaultBodyContentKey
|
|
63
|
-
: DefaultBodyContentKey;
|
|
53
|
+
export function contentFor<Name>(tag: Name): ContentFor<Name>;
|
|
64
54
|
|
|
65
55
|
export const Template: new <Overrides = unknown>() => {
|
|
66
56
|
[K in Exclude<
|
|
@@ -184,7 +174,7 @@ declare global {
|
|
|
184
174
|
tag: Tag,
|
|
185
175
|
fallback: Promise<{ default: Template }>,
|
|
186
176
|
): [0] extends [1 & Tag] ? Template : Tag;
|
|
187
|
-
export function input<Name>(tag: Name):
|
|
177
|
+
export function input<Name>(tag: Name): InputFor<Name>;
|
|
188
178
|
export function renderDynamicTag<Name>(tag: Name): DynamicRenderer<Name>;
|
|
189
179
|
|
|
190
180
|
export function returnTag<
|
|
@@ -408,16 +398,16 @@ declare global {
|
|
|
408
398
|
...path: Path
|
|
409
399
|
): <
|
|
410
400
|
Name extends string,
|
|
411
|
-
AttrTags extends [0] extends [1 & Tag]
|
|
401
|
+
AttrTags extends readonly ([0] extends [1 & Tag]
|
|
412
402
|
? Record<Name, Marko.AttrTag<unknown>>
|
|
413
403
|
: Record<
|
|
414
404
|
Name,
|
|
415
|
-
Tag extends
|
|
405
|
+
Tag extends InputFor<infer Input>
|
|
416
406
|
? [0] extends [1 & Input]
|
|
417
407
|
? Marko.AttrTag<unknown>
|
|
418
408
|
: AttrTagValue<Input, Path>
|
|
419
409
|
: Marko.AttrTag<unknown>
|
|
420
|
-
>[],
|
|
410
|
+
>)[],
|
|
421
411
|
>(
|
|
422
412
|
name: Name,
|
|
423
413
|
...attrTags: AttrTags
|
|
@@ -471,8 +461,8 @@ declare global {
|
|
|
471
461
|
...args: BodyParamsWithDefault<Body> &
|
|
472
462
|
Relate<__marko_internal_input, BodyParamsWithDefault<Body>>
|
|
473
463
|
) => ReturnAndScope<
|
|
474
|
-
Scopes<__marko_internal_input>,
|
|
475
|
-
|
|
464
|
+
Scopes<__marko_internal_input extends [infer Input] ? Input : never>,
|
|
465
|
+
Body extends Marko.Body<any, infer Return> ? Return : never
|
|
476
466
|
>;
|
|
477
467
|
}
|
|
478
468
|
|
|
@@ -674,4 +664,41 @@ type DefaultBodyContentKey = keyof Exclude<
|
|
|
674
664
|
Marko.Template<any, any> | Marko.Body<any, any> | string
|
|
675
665
|
>;
|
|
676
666
|
|
|
667
|
+
type ContentFor<Name> = [0] extends [1 & Name]
|
|
668
|
+
? DefaultBodyContentKey
|
|
669
|
+
: Name extends { api: infer API }
|
|
670
|
+
? API extends "tags"
|
|
671
|
+
? "content"
|
|
672
|
+
: API extends "class"
|
|
673
|
+
? "renderBody"
|
|
674
|
+
: DefaultBodyContentKey
|
|
675
|
+
: DefaultBodyContentKey;
|
|
676
|
+
|
|
677
|
+
type InputFor<Name> = 0 extends 1 & Name
|
|
678
|
+
? any
|
|
679
|
+
: Name extends string
|
|
680
|
+
? Name extends keyof Marko.NativeTags
|
|
681
|
+
? Marko.NativeTags[Name]["input"]
|
|
682
|
+
: Record<string, unknown>
|
|
683
|
+
: Name extends
|
|
684
|
+
| Marko.Template<infer Input, any>
|
|
685
|
+
| { _(): () => (input: infer Input) => any }
|
|
686
|
+
? Input
|
|
687
|
+
: Name extends
|
|
688
|
+
| Marko.Body<infer Args, any>
|
|
689
|
+
| Record<
|
|
690
|
+
DefaultBodyContentKey,
|
|
691
|
+
undefined | null | false | Marko.Body<infer Args, any>
|
|
692
|
+
>
|
|
693
|
+
? Args extends {
|
|
694
|
+
length: infer Length;
|
|
695
|
+
}
|
|
696
|
+
? number extends Length
|
|
697
|
+
? Args[0] | undefined
|
|
698
|
+
: 0 extends Length
|
|
699
|
+
? undefined
|
|
700
|
+
: Args[0]
|
|
701
|
+
: never
|
|
702
|
+
: never;
|
|
703
|
+
|
|
677
704
|
export {};
|
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.51",
|
|
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"
|