@marko/language-server 2.1.20 → 2.1.22

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.
@@ -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, U = T>(
27
+ export function hoist<T>(
28
28
  value: () => T,
29
- ): T extends (...args: any[]) => any
30
- ? (T | (U extends undefined ? () => undefined : never)) & Iterable<T>
31
- : never;
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>(...item: Item): UnionToIntersection<
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<AttrTag>(attrTags: AttrTag[]): 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
- AttrTag extends [0] extends [1 & Tag]
401
- ? Marko.AttrTag<unknown>
402
- : Marko.Input<Tag> extends infer Input
403
- ? [0] extends [1 & Input]
404
- ? Marko.AttrTag<unknown>
405
- : AttrTagValue<Marko.Input<Tag>, Path>
406
- : Marko.AttrTag<unknown>,
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
- attrTags: AttrTag[],
409
- ) => AttrTag extends Marko.AttrTag<infer Input>
410
- ? Marko.AttrTag<Input>
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,18 +1,18 @@
1
1
  {
2
2
  "name": "@marko/language-server",
3
3
  "description": "Marko Language Server",
4
- "version": "2.1.20",
4
+ "version": "2.1.22",
5
5
  "bin": {
6
6
  "marko-language-server": "./bin.js"
7
7
  },
8
8
  "bugs": "https://github.com/marko-js/language-server/issues/new?template=Bug_report.md",
9
9
  "dependencies": {
10
10
  "@luxass/strip-json-comments": "^1.4.0",
11
- "@marko/language-tools": "^2.5.46",
12
- "@marko/compiler": "^5.39.45",
11
+ "@marko/language-tools": "^2.5.48",
12
+ "@marko/compiler": "^5.39.49",
13
13
  "htmljs-parser": "^5.7.4",
14
- "marko": "^5.38.1",
15
- "prettier": "^3.7.4",
14
+ "marko": "^5.38.18",
15
+ "prettier": "^3.8.1",
16
16
  "prettier-plugin-marko": "^3.3.2",
17
17
  "relative-import-path": "^1.0.0",
18
18
  "typescript": "^5.9.3",
@@ -20,7 +20,7 @@
20
20
  "vscode-languageserver": "^9.0.1",
21
21
  "vscode-languageserver-textdocument": "^1.0.12",
22
22
  "vscode-uri": "^3.1.0",
23
- "axe-core": "^4.11.0",
23
+ "axe-core": "^4.11.1",
24
24
  "jsdom": "^26.1.0"
25
25
  },
26
26
  "devDependencies": {