@spyglassmc/core 0.4.1 → 0.4.2

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.
Files changed (64) hide show
  1. package/lib/common/Dev.js +2 -2
  2. package/lib/common/ReadonlyProxy.d.ts +2 -2
  3. package/lib/common/StateProxy.d.ts +2 -2
  4. package/lib/common/externals/NodeJsExternals.js +4 -1
  5. package/lib/common/externals/downloader.d.ts +2 -2
  6. package/lib/common/externals/index.d.ts +2 -2
  7. package/lib/common/util.d.ts +7 -7
  8. package/lib/common/util.js +2 -2
  9. package/lib/node/AstNode.d.ts +1 -1
  10. package/lib/node/AstNode.js +3 -1
  11. package/lib/node/CommentNode.d.ts +2 -2
  12. package/lib/node/ResourceLocationNode.d.ts +1 -1
  13. package/lib/node/ResourceLocationNode.js +6 -8
  14. package/lib/node/StringNode.d.ts +3 -3
  15. package/lib/node/StringNode.js +4 -1
  16. package/lib/parser/Parser.d.ts +5 -5
  17. package/lib/parser/float.d.ts +1 -1
  18. package/lib/parser/integer.d.ts +1 -1
  19. package/lib/parser/long.d.ts +1 -1
  20. package/lib/parser/string.js +4 -1
  21. package/lib/parser/util.d.ts +7 -7
  22. package/lib/parser/util.js +7 -2
  23. package/lib/processor/ColorInfoProvider.d.ts +3 -3
  24. package/lib/processor/ColorInfoProvider.js +4 -2
  25. package/lib/processor/InlayHintProvider.d.ts +1 -1
  26. package/lib/processor/SignatureHelpProvider.d.ts +1 -1
  27. package/lib/processor/binder/Binder.d.ts +1 -1
  28. package/lib/processor/binder/builtin.d.ts +2 -2
  29. package/lib/processor/binder/builtin.js +3 -1
  30. package/lib/processor/binder/index.d.ts +1 -1
  31. package/lib/processor/binder/index.js +1 -1
  32. package/lib/processor/checker/Checker.d.ts +3 -3
  33. package/lib/processor/checker/builtin.d.ts +1 -1
  34. package/lib/processor/checker/builtin.js +2 -1
  35. package/lib/processor/colorizer/Colorizer.d.ts +3 -3
  36. package/lib/processor/completer/Completer.d.ts +1 -1
  37. package/lib/processor/completer/builtin.js +8 -4
  38. package/lib/processor/formatter/Formatter.d.ts +1 -1
  39. package/lib/processor/formatter/Formatter.js +3 -1
  40. package/lib/processor/linter/Linter.d.ts +1 -1
  41. package/lib/processor/util.d.ts +1 -1
  42. package/lib/service/CacheService.d.ts +1 -1
  43. package/lib/service/CacheService.js +2 -2
  44. package/lib/service/Config.d.ts +9 -9
  45. package/lib/service/Config.js +5 -2
  46. package/lib/service/Dependency.d.ts +3 -3
  47. package/lib/service/FileService.d.ts +1 -1
  48. package/lib/service/FileService.js +7 -3
  49. package/lib/service/Project.d.ts +5 -5
  50. package/lib/service/Project.js +9 -4
  51. package/lib/service/Service.js +12 -3
  52. package/lib/service/SymbolRegistrar.d.ts +1 -1
  53. package/lib/service/UriProcessor.d.ts +3 -3
  54. package/lib/service/fileUtil.d.ts +2 -2
  55. package/lib/source/IndexMap.d.ts +1 -1
  56. package/lib/source/Location.d.ts +1 -1
  57. package/lib/source/Offset.d.ts +1 -1
  58. package/lib/source/Range.d.ts +1 -1
  59. package/lib/source/Source.d.ts +4 -4
  60. package/lib/symbol/Symbol.d.ts +12 -12
  61. package/lib/symbol/Symbol.js +9 -7
  62. package/lib/symbol/SymbolUtil.d.ts +4 -4
  63. package/lib/symbol/SymbolUtil.js +4 -3
  64. package/package.json +2 -2
package/lib/common/Dev.js CHANGED
@@ -26,8 +26,8 @@ export const Dev = Object.freeze({
26
26
  switch (typeof current) {
27
27
  case 'bigint': {
28
28
  const bits = Math.ceil(Math.log2(Number(current)));
29
- ans +=
30
- (2 + Math.ceil(bits / (ByteToBits * PointerSize))) * PointerSize; // https://stackoverflow.com/a/54298760
29
+ ans += (2 + Math.ceil(bits / (ByteToBits * PointerSize))) *
30
+ PointerSize; // https://stackoverflow.com/a/54298760
31
31
  break;
32
32
  }
33
33
  case 'boolean':
@@ -1,5 +1,5 @@
1
- declare type Wrap<T> = T extends object ? DeepReadonly<T> : T;
2
- export declare type DeepReadonly<T extends object> = {
1
+ type Wrap<T> = T extends object ? DeepReadonly<T> : T;
2
+ export type DeepReadonly<T extends object> = {
3
3
  readonly [K in keyof T]: Wrap<T[K]>;
4
4
  };
5
5
  export declare const ReadonlyProxy: Readonly<{
@@ -3,7 +3,7 @@ declare const Is: unique symbol;
3
3
  declare const Origin: unique symbol;
4
4
  declare const Redo: unique symbol;
5
5
  declare const Undo: unique symbol;
6
- declare type Wrap<T> = T extends object ? StateProxy<T> : T;
6
+ type Wrap<T> = T extends object ? StateProxy<T> : T;
7
7
  /**
8
8
  * A proxy wrapped around an arbitrary object value.
9
9
  * You can access and mutate the value as normal, but you also have the ability to revert all changes ever since the
@@ -12,7 +12,7 @@ declare type Wrap<T> = T extends object ? StateProxy<T> : T;
12
12
  * A new proxy can be branched off of an existing proxy using {@link StateProxy.branchOff} to have finer control
13
13
  * over what changes to be reverted.
14
14
  */
15
- export declare type StateProxy<T extends object> = {
15
+ export type StateProxy<T extends object> = {
16
16
  [K in keyof T]: Wrap<T[K]>;
17
17
  } & {
18
18
  [BranchOff]: () => StateProxy<T>;
@@ -68,7 +68,10 @@ export const NodeJsExternals = {
68
68
  return fsp.chmod(toFsPathLike(location), mode);
69
69
  },
70
70
  async getAllFiles(location) {
71
- return (await globby(toPath(location) + '**/*', { absolute: true, dot: true })).map(uriFromPath);
71
+ return (await globby(toPath(location) + '**/*', {
72
+ absolute: true,
73
+ dot: true,
74
+ })).map(uriFromPath);
72
75
  },
73
76
  async mkdir(location, options) {
74
77
  return void (await fsp.mkdir(toFsPathLike(location), options));
@@ -1,5 +1,5 @@
1
- declare type RemoteUriProtocol = 'http:' | 'https:';
2
- export declare type RemoteUriString = `${RemoteUriProtocol}${string}`;
1
+ type RemoteUriProtocol = 'http:' | 'https:';
2
+ export type RemoteUriString = `${RemoteUriProtocol}${string}`;
3
3
  export declare const RemoteUriString: Readonly<{
4
4
  is(value: string): value is `http:${string}` | `https:${string}`;
5
5
  }>;
@@ -31,7 +31,7 @@ export interface DecompressedFile {
31
31
  path: string;
32
32
  type: string;
33
33
  }
34
- export declare type ExternalErrorKind = 'EEXIST' | 'EISDIR' | 'ENOENT';
34
+ export type ExternalErrorKind = 'EEXIST' | 'EISDIR' | 'ENOENT';
35
35
  export interface ExternalEventEmitter {
36
36
  emit(eventName: string, ...args: unknown[]): boolean;
37
37
  on(eventName: string, listener: (...args: unknown[]) => unknown): this;
@@ -76,7 +76,7 @@ export interface ExternalFileSystem {
76
76
  /**
77
77
  * A file file URI string or a URI object.
78
78
  */
79
- export declare type FsLocation = string | Uri;
79
+ export type FsLocation = string | Uri;
80
80
  export interface FsWatcher {
81
81
  on(eventName: 'ready', listener: () => unknown): this;
82
82
  once(eventName: 'ready', listener: () => unknown): this;
@@ -9,11 +9,11 @@ export declare const Uri: {
9
9
  createObjectURL(obj: Blob | MediaSource): string;
10
10
  revokeObjectURL(url: string): void;
11
11
  };
12
- export declare type Uri = URL;
12
+ export type Uri = URL;
13
13
  /**
14
14
  * `NodeJS.Timeout` on Node.js and `number` on browser.
15
15
  */
16
- export declare type IntervalId = any;
16
+ export type IntervalId = any;
17
17
  /**
18
18
  * @param getKey A function that takes the actual arguments being passed into the decorated method, and returns anything.
19
19
  * The result of this function will be used as the key to identify the `Promise`. By default the first element in the argument
@@ -35,7 +35,7 @@ export declare const Singleton: MethodDecorator;
35
35
  * Decorated methods will be scheduled to run after `ms` milliseconds. The timer will reset when the method is called again.
36
36
  */
37
37
  export declare function Delay(ms: number, getKey?: (args: any[]) => any): MethodDecorator;
38
- export declare type FullResourceLocation = `${string}:${string}`;
38
+ export type FullResourceLocation = `${string}:${string}`;
39
39
  export interface ResourceLocation {
40
40
  isTag: boolean;
41
41
  namespace: string | undefined;
@@ -63,7 +63,7 @@ export declare namespace ResourceLocation {
63
63
  * Byte order mark is correctly removed.
64
64
  */
65
65
  export declare function bufferToString(buffer: Uint8Array): string;
66
- export declare type Arrayable<T> = T | readonly T[];
66
+ export type Arrayable<T> = T | readonly T[];
67
67
  export declare namespace Arrayable {
68
68
  function is<T>(value: unknown, isT: (value: unknown) => value is T): value is Arrayable<T>;
69
69
  function toArray<T>(value: Arrayable<T>): T[];
@@ -78,7 +78,7 @@ export declare function parseGzippedJson(externals: Externals, buffer: Uint8Arra
78
78
  */
79
79
  export declare function isPojo(value: unknown): value is Record<string, unknown>;
80
80
  export declare function merge<T extends Record<string, any>>(a: T, b: Record<string, any>): T;
81
- export declare type Lazy<T> = T | Lazy.ComplexLazy<T>;
81
+ export type Lazy<T> = T | Lazy.ComplexLazy<T>;
82
82
  export declare namespace Lazy {
83
83
  const LazyDiscriminator: unique symbol;
84
84
  export type UnresolvedLazy<T> = {
@@ -121,12 +121,12 @@ export declare function normalizeUri(uri: string): string;
121
121
  * function isCommentNode<T extends DeepReadonly<AstNode> | undefined>(node: T): node is IsHelper<AstNode, CommentNode, T>
122
122
  * ```
123
123
  */
124
- export declare type IsHelper<ROOT extends object, TARGET extends ROOT, INPUT extends DeepReadonly<ROOT> | undefined> = INPUT extends DeepReadonly<ROOT> ? INPUT & DeepReadonly<TARGET> : INPUT & TARGET;
124
+ export type IsHelper<ROOT extends object, TARGET extends ROOT, INPUT extends DeepReadonly<ROOT> | undefined> = INPUT extends DeepReadonly<ROOT> ? INPUT & DeepReadonly<TARGET> : INPUT & TARGET;
125
125
  /**
126
126
  * @example
127
127
  * ```ts
128
128
  * function isCommentNode<T extends DeepReadonly<AstNode> | undefined>(node: T): node is NodeIsHelper<CommentNode, T>
129
129
  * ```
130
130
  */
131
- export declare type NodeIsHelper<TARGET extends AstNode, INPUT extends DeepReadonly<AstNode> | undefined> = IsHelper<AstNode, TARGET, INPUT>;
131
+ export type NodeIsHelper<TARGET extends AstNode, INPUT extends DeepReadonly<AstNode> | undefined> = IsHelper<AstNode, TARGET, INPUT>;
132
132
  //# sourceMappingURL=util.d.ts.map
@@ -210,7 +210,7 @@ export const binarySearch = externalBinarySearch;
210
210
  export function isIterable(value) {
211
211
  return !!value[Symbol.iterator];
212
212
  }
213
- //#region ESNext functions polyfill
213
+ // #region ESNext functions polyfill
214
214
  export function atArray(array, index) {
215
215
  return index >= 0 ? array?.[index] : array?.[array.length + index];
216
216
  }
@@ -232,7 +232,7 @@ export function emplaceMap(map, key, handler) {
232
232
  throw new Error(`No key ${key} in map and no insert handler provided`);
233
233
  }
234
234
  }
235
- //#endregion
235
+ // #endregion
236
236
  /**
237
237
  * @returns If `val` is an non-null object or a callable object (i.e. function).
238
238
  */
@@ -59,7 +59,7 @@ export declare namespace AstNode {
59
59
  export function getLocalsToLeaves(node: AstNode): Generator<SymbolTable>;
60
60
  export {};
61
61
  }
62
- export declare type Mutable<N> = N extends AstNode ? {
62
+ export type Mutable<N> = N extends AstNode ? {
63
63
  -readonly [K in keyof N]: Mutable<N[K]>;
64
64
  } : N;
65
65
  //# sourceMappingURL=AstNode.d.ts.map
@@ -24,7 +24,9 @@ export var AstNode;
24
24
  if (!node.children) {
25
25
  return -1;
26
26
  }
27
- const comparator = typeof needle === 'number' ? Range.compareOffset : Range.compare;
27
+ const comparator = typeof needle === 'number'
28
+ ? Range.compareOffset
29
+ : Range.compare;
28
30
  return binarySearch(node.children, needle, (a, b) => comparator(a.range, b, endInclusive));
29
31
  }
30
32
  AstNode.findChildIndex = findChildIndex;
@@ -1,4 +1,4 @@
1
- import type { DeepReadonly } from '../common/index.js';
1
+ import type { DeepReadonly, NodeIsHelper } from '../common/index.js';
2
2
  import type { AstNode } from './AstNode.js';
3
3
  export interface CommentNode extends AstNode {
4
4
  readonly type: 'comment';
@@ -8,6 +8,6 @@ export interface CommentNode extends AstNode {
8
8
  comment: string;
9
9
  }
10
10
  export declare const CommentNode: Readonly<{
11
- is<T extends DeepReadonly<AstNode> | undefined>(obj: T): obj is import("../common/util.js").IsHelper<AstNode, CommentNode, T>;
11
+ is<T extends DeepReadonly<AstNode> | undefined>(obj: T): obj is NodeIsHelper<CommentNode, T>;
12
12
  }>;
13
13
  //# sourceMappingURL=CommentNode.d.ts.map
@@ -3,7 +3,7 @@ import { ResourceLocation } from '../common/index.js';
3
3
  import type { RangeLike } from '../source/index.js';
4
4
  import type { ResourceLocationCategory, SymbolAccessType, SymbolUsageType, TaggableResourceLocationCategory } from '../symbol/index.js';
5
5
  import type { AstNode } from './AstNode.js';
6
- export declare type ResourceLocationOptions = {
6
+ export type ResourceLocationOptions = {
7
7
  accessType?: SymbolAccessType;
8
8
  isPredicate?: boolean;
9
9
  usageType?: SymbolUsageType;
@@ -43,10 +43,9 @@ export var ResourceLocationNode;
43
43
  switch (type) {
44
44
  case 'origin':
45
45
  // Use `node.namespace !== undefined`, so that empty namespaces can be correctly restored to string.
46
- id =
47
- node.namespace !== undefined
48
- ? `${node.namespace}${NamespacePathSep}${path}`
49
- : path;
46
+ id = node.namespace !== undefined
47
+ ? `${node.namespace}${NamespacePathSep}${path}`
48
+ : path;
50
49
  break;
51
50
  case 'full':
52
51
  // Use `node.namespace` before `||`, so that both undefined and empty value can result in the default namespace.
@@ -55,10 +54,9 @@ export var ResourceLocationNode;
55
54
  break;
56
55
  case 'short':
57
56
  // Use `node.namespace` before `&&` for the same reason stated above.
58
- id =
59
- node.namespace && node.namespace !== DefaultNamespace
60
- ? `${node.namespace}${NamespacePathSep}${path}`
61
- : path;
57
+ id = node.namespace && node.namespace !== DefaultNamespace
58
+ ? `${node.namespace}${NamespacePathSep}${path}`
59
+ : path;
62
60
  break;
63
61
  }
64
62
  return includesTagPrefix && node.isTag ? `${TagPrefix}${id}` : id;
@@ -3,12 +3,12 @@ import type { ColorTokenType } from '../processor/index.js';
3
3
  import type { IndexMap, RangeLike } from '../source/index.js';
4
4
  import type { AstNode } from './AstNode.js';
5
5
  export declare const EscapeChars: readonly ["\"", "'", "\\", "b", "f", "n", "r", "t"];
6
- export declare type EscapeChar = typeof EscapeChars[number];
6
+ export type EscapeChar = (typeof EscapeChars)[number];
7
7
  export declare namespace EscapeChar {
8
8
  function is(expected: EscapeChar[] | undefined, c: string): c is EscapeChar;
9
9
  }
10
10
  export declare const EscapeTable: Map<"\"" | "'" | "b" | "f" | "n" | "r" | "t" | "\\", string>;
11
- export declare type Quote = "'" | '"';
11
+ export type Quote = "'" | '"';
12
12
  export interface StringOptions {
13
13
  colorTokenType?: ColorTokenType;
14
14
  escapable?: {
@@ -47,7 +47,7 @@ export interface StringOptions {
47
47
  type: AstNode['type'];
48
48
  };
49
49
  }
50
- export declare type QuoteTypeConfig = 'always double' | 'always single' | 'prefer double' | 'prefer single';
50
+ export type QuoteTypeConfig = 'always double' | 'always single' | 'prefer double' | 'prefer single';
51
51
  export interface StringBaseNode extends AstNode {
52
52
  readonly options: StringOptions;
53
53
  value: string;
@@ -32,7 +32,10 @@ export var StringNode;
32
32
  range,
33
33
  options,
34
34
  value: '',
35
- valueMap: [{ inner: Range.create(0), outer: Range.create(range.start) }],
35
+ valueMap: [{
36
+ inner: Range.create(0),
37
+ outer: Range.create(range.start),
38
+ }],
36
39
  };
37
40
  }
38
41
  StringNode.mock = mock;
@@ -4,13 +4,13 @@ import type { Source } from '../source/index.js';
4
4
  /**
5
5
  * A parser.
6
6
  */
7
- export declare type Parser<N extends Returnable = AstNode> = (this: void, src: Source, ctx: ParserContext) => Result<N>;
7
+ export type Parser<N extends Returnable = AstNode> = (this: void, src: Source, ctx: ParserContext) => Result<N>;
8
8
  /**
9
9
  * A parser that always succeeds.
10
10
  */
11
- export declare type InfallibleParser<N extends Returnable = AstNode> = (this: void, src: Source, ctx: ParserContext) => Success<N>;
12
- export declare type Result<T extends Returnable> = Success<T> | typeof Failure;
13
- export declare type Success<T extends Returnable> = T;
11
+ export type InfallibleParser<N extends Returnable = AstNode> = (this: void, src: Source, ctx: ParserContext) => Success<N>;
12
+ export type Result<T extends Returnable> = Success<T> | typeof Failure;
13
+ export type Success<T extends Returnable> = T;
14
14
  export declare const Failure: unique symbol;
15
- export declare type Returnable = object | string | number | bigint | boolean | undefined;
15
+ export type Returnable = object | string | number | bigint | boolean | undefined;
16
16
  //# sourceMappingURL=Parser.d.ts.map
@@ -26,7 +26,7 @@ interface InfallibleOptions extends OptionsBase {
26
26
  failsOnEmpty?: false;
27
27
  }
28
28
  /** @internal For test only */
29
- export declare type Options = FallibleOptions | InfallibleOptions;
29
+ export type Options = FallibleOptions | InfallibleOptions;
30
30
  export declare function float(options: InfallibleOptions): InfallibleParser<FloatNode>;
31
31
  export declare function float(options: FallibleOptions): Parser<FloatNode>;
32
32
  export {};
@@ -26,7 +26,7 @@ interface InfallibleOptions extends OptionsBase {
26
26
  failsOnEmpty?: false;
27
27
  }
28
28
  /** @internal For test only */
29
- export declare type Options = FallibleOptions | InfallibleOptions;
29
+ export type Options = FallibleOptions | InfallibleOptions;
30
30
  export declare function integer(options: InfallibleOptions): InfallibleParser<IntegerNode>;
31
31
  export declare function integer(options: FallibleOptions): Parser<IntegerNode>;
32
32
  export {};
@@ -26,7 +26,7 @@ interface InfallibleOptions extends OptionsBase {
26
26
  failsOnEmpty?: false;
27
27
  }
28
28
  /** @internal For test only */
29
- export declare type Options = FallibleOptions | InfallibleOptions;
29
+ export type Options = FallibleOptions | InfallibleOptions;
30
30
  export declare function long(options: InfallibleOptions): InfallibleParser<LongNode>;
31
31
  export declare function long(options: FallibleOptions): Parser<LongNode>;
32
32
  export {};
@@ -86,7 +86,10 @@ export function string(options) {
86
86
  else {
87
87
  ctx.err.report(localize('expected', options.quotes), src);
88
88
  }
89
- ans.valueMap.unshift({ inner: Range.create(0), outer: Range.create(start) });
89
+ ans.valueMap.unshift({
90
+ inner: Range.create(0),
91
+ outer: Range.create(start),
92
+ });
90
93
  if (options.value?.parser) {
91
94
  const valueResult = parseStringValue(options.value.parser, ans.value, ans.valueMap, ctx);
92
95
  /* istanbul ignore else */
@@ -3,11 +3,11 @@ import { SequenceUtil } from '../node/index.js';
3
3
  import type { ParserContext } from '../service/index.js';
4
4
  import type { ErrorSeverity, ReadonlySource, Source } from '../source/index.js';
5
5
  import type { InfallibleParser, Parser, Result, Returnable } from './Parser.js';
6
- declare type ExtractNodeType<P extends Parser<Returnable>> = P extends Parser<infer V> ? V : never;
6
+ type ExtractNodeType<P extends Parser<Returnable>> = P extends Parser<infer V> ? V : never;
7
7
  /**
8
8
  * @template PA Parser array.
9
9
  */
10
- declare type ExtractNodeTypes<PA extends Parser<Returnable>[]> = ExtractNodeType<PA[number]>;
10
+ type ExtractNodeTypes<PA extends Parser<Returnable>[]> = ExtractNodeType<PA[number]>;
11
11
  export interface AttemptResult<N extends Returnable = AstNode> {
12
12
  result: Result<N>;
13
13
  updateSrcAndCtx: () => void;
@@ -27,10 +27,10 @@ interface InfallibleAttemptResult<N extends Returnable = AstNode> extends Attemp
27
27
  */
28
28
  export declare function attempt<N extends Returnable = AstNode>(parser: InfallibleParser<N>, src: Source, ctx: ParserContext): InfallibleAttemptResult<N>;
29
29
  export declare function attempt<N extends Returnable = AstNode>(parser: Parser<N>, src: Source, ctx: ParserContext): AttemptResult<N>;
30
- declare type SP<CN extends AstNode> = SIP<CN> | Parser<CN | SequenceUtil<CN> | undefined> | {
30
+ type SP<CN extends AstNode> = SIP<CN> | Parser<CN | SequenceUtil<CN> | undefined> | {
31
31
  get: (result: SequenceUtil<CN>) => Parser<CN | SequenceUtil<CN> | undefined> | undefined;
32
32
  };
33
- declare type SIP<CN extends AstNode> = InfallibleParser<CN | SequenceUtil<CN> | undefined> | {
33
+ type SIP<CN extends AstNode> = InfallibleParser<CN | SequenceUtil<CN> | undefined> | {
34
34
  get: (result: SequenceUtil<CN>) => InfallibleParser<CN | SequenceUtil<CN> | undefined> | undefined;
35
35
  };
36
36
  /**
@@ -102,13 +102,13 @@ export declare function recover<N extends Returnable>(parser: InfallibleParser<N
102
102
  _inputParserIsInfallible: never;
103
103
  } & void;
104
104
  export declare function recover<N extends Returnable>(parser: Parser<N>, defaultValue: (src: Source, ctx: ParserContext) => N): InfallibleParser<N>;
105
- declare type GettableParser = Parser<Returnable> | {
105
+ type GettableParser = Parser<Returnable> | {
106
106
  get: () => Parser<Returnable>;
107
107
  };
108
- declare type ExtractFromGettableParser<T extends GettableParser> = T extends {
108
+ type ExtractFromGettableParser<T extends GettableParser> = T extends {
109
109
  get: () => infer V;
110
110
  } ? V : T extends Parser<Returnable> ? T : never;
111
- declare type Case = {
111
+ type Case = {
112
112
  predicate?: (this: void, src: ReadonlySource) => boolean;
113
113
  prefix?: string;
114
114
  regex?: RegExp;
@@ -82,7 +82,10 @@ export function repeat(parser, parseGap) {
82
82
  export function any(parsers, out) {
83
83
  return (src, ctx) => {
84
84
  const results = parsers
85
- .map((parser, i) => ({ attempt: attempt(parser, src, ctx), index: i }))
85
+ .map((parser, i) => ({
86
+ attempt: attempt(parser, src, ctx),
87
+ index: i,
88
+ }))
86
89
  .filter(({ attempt }) => attempt.result !== Failure)
87
90
  .sort((a, b) => b.attempt.endCursor - a.attempt.endCursor ||
88
91
  a.attempt.errorAmount - b.attempt.errorAmount);
@@ -156,7 +159,9 @@ export function select(cases) {
156
159
  (prefix !== undefined ? src.tryPeek(prefix) : undefined) ??
157
160
  (regex && src.matchPattern(regex)) ??
158
161
  true) {
159
- const callableParser = typeof parser === 'object' ? parser.get() : parser;
162
+ const callableParser = typeof parser === 'object'
163
+ ? parser.get()
164
+ : parser;
160
165
  return callableParser(src, ctx);
161
166
  }
162
167
  }
@@ -6,7 +6,7 @@ export interface ColorInfo {
6
6
  /**
7
7
  * An array of four decimal numbers within the interval [0, 1] that represent R, G, B, and A respectively.
8
8
  */
9
- export declare type Color = [number, number, number, number];
9
+ export type Color = [number, number, number, number];
10
10
  export declare namespace Color {
11
11
  const NamedColors: Map<string, number>;
12
12
  const ColorNames: string[];
@@ -71,12 +71,12 @@ export declare enum ColorFormat {
71
71
  */
72
72
  CompositeInt = 6
73
73
  }
74
- export declare type FormattableColor = {
74
+ export type FormattableColor = {
75
75
  value: Color;
76
76
  format: ColorFormat[];
77
77
  range?: Range;
78
78
  };
79
- export declare type ColorPresentation = {
79
+ export type ColorPresentation = {
80
80
  label: string;
81
81
  text: string;
82
82
  range: Range;
@@ -140,11 +140,13 @@ export var ColorPresentation;
140
140
  .toString(16)
141
141
  .padStart(8, '0')}`;
142
142
  case ColorFormat.HexRGB:
143
- return `#${Math.round(((color[0] * 255) << 16) + ((color[1] * 255) << 8) + color[2] * 255)
143
+ return `#${Math.round(((color[0] * 255) << 16) + ((color[1] * 255) << 8) +
144
+ color[2] * 255)
144
145
  .toString(16)
145
146
  .padStart(6, '0')}`;
146
147
  case ColorFormat.CompositeInt:
147
- return `${Math.round(((color[0] * 255) << 16) + ((color[1] * 255) << 8) + color[2] * 255)}`;
148
+ return `${Math.round(((color[0] * 255) << 16) + ((color[1] * 255) << 8) +
149
+ color[2] * 255)}`;
148
150
  }
149
151
  }
150
152
  })(ColorPresentation || (ColorPresentation = {}));
@@ -5,5 +5,5 @@ export interface InlayHint {
5
5
  offset: number;
6
6
  text: string;
7
7
  }
8
- export declare type InlayHintProvider<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: ProcessorContext) => readonly InlayHint[];
8
+ export type InlayHintProvider<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: ProcessorContext) => readonly InlayHint[];
9
9
  //# sourceMappingURL=InlayHintProvider.d.ts.map
@@ -15,5 +15,5 @@ export interface ParameterInfo {
15
15
  label: [number, number];
16
16
  documentation?: string;
17
17
  }
18
- export declare type SignatureHelpProvider<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: SignatureHelpProviderContext) => SignatureHelp | undefined;
18
+ export type SignatureHelpProvider<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: SignatureHelpProviderContext) => SignatureHelp | undefined;
19
19
  //# sourceMappingURL=SignatureHelpProvider.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { AstNode } from '../../node/index.js';
2
2
  import type { BinderContext } from '../../service/index.js';
3
3
  declare const IsAsync: unique symbol;
4
- export declare type Binder<N extends AstNode> = SyncBinder<N> | AsyncBinder<N>;
4
+ export type Binder<N extends AstNode> = SyncBinder<N> | AsyncBinder<N>;
5
5
  export interface SyncBinderInitializer<N extends AstNode> {
6
6
  (node: N, ctx: BinderContext): void;
7
7
  }
@@ -3,13 +3,13 @@ import { ResourceLocationNode } from '../../node/index.js';
3
3
  import type { BinderContext, MetaRegistry } from '../../service/index.js';
4
4
  import type { Binder } from './Binder.js';
5
5
  import { AsyncBinder, SyncBinder } from './Binder.js';
6
- export declare type AttemptResult = {
6
+ export type AttemptResult = {
7
7
  errorAmount: number;
8
8
  totalErrorSpan: number;
9
9
  updateNodeAndCtx: () => void;
10
10
  };
11
11
  export declare function attempt<B extends Binder<never>>(binder: B, node: B extends Binder<infer N extends AstNode> ? N : never, ctx: BinderContext): B extends SyncBinder<any> ? AttemptResult : Promise<AttemptResult>;
12
- declare type ExtractBinder<B extends Binder<never>> = B extends Binder<infer N extends AstNode> ? N : never;
12
+ type ExtractBinder<B extends Binder<never>> = B extends Binder<infer N extends AstNode> ? N : never;
13
13
  export declare function any<Binders extends Binder<never>[]>(binders: Binders): Binders extends SyncBinder<never>[] ? SyncBinder<ExtractBinder<Binders[number]>> : AsyncBinder<ExtractBinder<Binders[number]>>;
14
14
  /**
15
15
  * No operation.
@@ -89,7 +89,9 @@ export const resourceLocation = SyncBinder.create((node, ctx) => {
89
89
  : raw);
90
90
  if (node.options.category) {
91
91
  ctx.symbols
92
- .query(ctx.doc, node.isTag ? `tag/${node.options.category}` : node.options.category, sanitizedRaw)
92
+ .query(ctx.doc, node.isTag
93
+ ? `tag/${node.options.category}`
94
+ : node.options.category, sanitizedRaw)
93
95
  .enter({
94
96
  usage: {
95
97
  type: node.options.usageType,
@@ -1,3 +1,3 @@
1
- export * as binder from './builtin.js';
2
1
  export * from './Binder.js';
2
+ export * as binder from './builtin.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * as binder from './builtin.js';
2
1
  export * from './Binder.js';
2
+ export * as binder from './builtin.js';
3
3
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import type { AstNode } from '../../node/index.js';
2
2
  import type { CheckerContext } from '../../service/index.js';
3
- export declare type Checker<N extends AstNode> = (node: N, ctx: CheckerContext) => PromiseLike<void> | void;
4
- export declare type SyncChecker<N extends AstNode> = (node: N, ctx: CheckerContext) => void;
5
- export declare type AsyncChecker<N extends AstNode> = (node: N, ctx: CheckerContext) => PromiseLike<void>;
3
+ export type Checker<N extends AstNode> = (node: N, ctx: CheckerContext) => PromiseLike<void> | void;
4
+ export type SyncChecker<N extends AstNode> = (node: N, ctx: CheckerContext) => void;
5
+ export type AsyncChecker<N extends AstNode> = (node: N, ctx: CheckerContext) => PromiseLike<void>;
6
6
  export declare const FallbackChecker: Checker<any>;
7
7
  //# sourceMappingURL=Checker.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { AstNode, ResourceLocationNode, SymbolBaseNode } from '../../node/index.js';
2
2
  import type { CheckerContext, MetaRegistry } from '../../service/index.js';
3
3
  import type { Checker, SyncChecker } from './Checker.js';
4
- export declare type AttemptResult = {
4
+ export type AttemptResult = {
5
5
  errorAmount: number;
6
6
  totalErrorSpan: number;
7
7
  updateNodeAndCtx: () => void;
@@ -30,7 +30,8 @@ export function any(checkers) {
30
30
  return (node, ctx) => {
31
31
  const attempts = checkers
32
32
  .map((checker) => attempt(checker, node, ctx))
33
- .sort((a, b) => a.errorAmount - b.errorAmount || a.totalErrorSpan - b.totalErrorSpan);
33
+ .sort((a, b) => a.errorAmount - b.errorAmount ||
34
+ a.totalErrorSpan - b.totalErrorSpan);
34
35
  attempts[0].updateNodeAndCtx();
35
36
  };
36
37
  }
@@ -3,7 +3,7 @@ import type { AstNode } from '../../node/index.js';
3
3
  import type { ColorizerContext } from '../../service/index.js';
4
4
  import type { RangeLike } from '../../source/index.js';
5
5
  import { Range } from '../../source/index.js';
6
- export declare type Colorizer<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: ColorizerContext) => readonly ColorToken[];
6
+ export type Colorizer<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: ColorizerContext) => readonly ColorToken[];
7
7
  export interface ColorToken {
8
8
  range: Range;
9
9
  type: ColorTokenType;
@@ -18,7 +18,7 @@ export declare namespace ColorToken {
18
18
  function fillGap(tokens: readonly ColorToken[], targetRange: Range, type: ColorTokenType, modifiers?: ColorTokenModifier[]): ColorToken[];
19
19
  }
20
20
  export declare const ColorTokenTypes: readonly ["comment", "enum", "enumMember", "function", "keyword", "modifier", "number", "operator", "property", "string", "struct", "type", "type", "variable", "error", "literal", "operator", "resourceLocation", "vector"];
21
- export declare type ColorTokenType = typeof ColorTokenTypes[number];
21
+ export type ColorTokenType = typeof ColorTokenTypes[number];
22
22
  export declare const ColorTokenModifiers: readonly ["declaration", "defaultLibrary", "definition", "deprecated", "documentation", "modification", "readonly"];
23
- export declare type ColorTokenModifier = typeof ColorTokenModifiers[number];
23
+ export type ColorTokenModifier = typeof ColorTokenModifiers[number];
24
24
  //# sourceMappingURL=Colorizer.d.ts.map
@@ -3,7 +3,7 @@ import type { AstNode } from '../../node/index.js';
3
3
  import type { CompleterContext } from '../../service/index.js';
4
4
  import type { RangeLike } from '../../source/index.js';
5
5
  import { Range } from '../../source/index.js';
6
- export declare type Completer<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: CompleterContext) => CompletionItem[];
6
+ export type Completer<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: CompleterContext) => CompletionItem[];
7
7
  export declare const enum CompletionKind {
8
8
  Text = 1,
9
9
  Method = 2,
@@ -43,7 +43,8 @@ export const literal = (node) => {
43
43
  ['resourceLocation', 17 /* CompletionKind.File */],
44
44
  ['variable', 6 /* CompletionKind.Variable */],
45
45
  ]).get(node.options.colorTokenType ?? 'keyword') ?? 14 /* CompletionKind.Keyword */;
46
- return (node.options.pool.map((v) => CompletionItem.create(v, node, { kind })) ?? []);
46
+ return (node.options.pool.map((v) => CompletionItem.create(v, node, { kind })) ??
47
+ []);
47
48
  };
48
49
  export const noop = () => [];
49
50
  export function record(o) {
@@ -88,9 +89,12 @@ export function record(o) {
88
89
  }
89
90
  export const resourceLocation = (node, ctx) => {
90
91
  const config = LinterConfigValue.destruct(ctx.config.lint.idOmitDefaultNamespace);
91
- const includeEmptyNamespace = !node.options.isPredicate && node.namespace === '';
92
- const includeDefaultNamespace = node.options.isPredicate || config?.ruleValue !== true;
93
- const excludeDefaultNamespace = !node.options.isPredicate && config?.ruleValue !== false;
92
+ const includeEmptyNamespace = !node.options.isPredicate &&
93
+ node.namespace === '';
94
+ const includeDefaultNamespace = node.options.isPredicate ||
95
+ config?.ruleValue !== true;
96
+ const excludeDefaultNamespace = !node.options.isPredicate &&
97
+ config?.ruleValue !== false;
94
98
  const getPool = (category) => optimizePool(Object.keys(ctx.symbols.getVisibleSymbols(category, ctx.doc.uri)));
95
99
  const optimizePool = (pool) => {
96
100
  const defaultNsPrefix = `${ResourceLocation.DefaultNamespace}${ResourceLocation.NamespacePathSep}`;
@@ -1,7 +1,7 @@
1
1
  import type { DeepReadonly } from '../../common/index.js';
2
2
  import type { AstNode } from '../../node/index.js';
3
3
  import type { FormatterContext } from '../../service/index.js';
4
- export declare type Formatter<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: FormatterContext) => string;
4
+ export type Formatter<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: FormatterContext) => string;
5
5
  export declare function formatterContextIndentation(ctx: FormatterContext, additionalLevels?: number): string;
6
6
  export declare function indentFormatter(ctx: FormatterContext, additionalLevels?: number): FormatterContext;
7
7
  //# sourceMappingURL=Formatter.d.ts.map
@@ -1,6 +1,8 @@
1
1
  export function formatterContextIndentation(ctx, additionalLevels = 0) {
2
2
  const total = ctx.indentLevel + additionalLevels;
3
- return ctx.insertSpaces ? ' '.repeat(total * ctx.tabSize) : '\t'.repeat(total);
3
+ return ctx.insertSpaces
4
+ ? ' '.repeat(total * ctx.tabSize)
5
+ : '\t'.repeat(total);
4
6
  }
5
7
  export function indentFormatter(ctx, additionalLevels = 1) {
6
8
  return {