@spyglassmc/core 0.1.2 → 0.4.0

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 (205) hide show
  1. package/README.md +7 -0
  2. package/lib/browser.d.ts +2 -0
  3. package/lib/browser.js +2 -0
  4. package/lib/common/Dev.d.ts +11 -0
  5. package/lib/common/Dev.js +90 -0
  6. package/lib/{service → common}/Logger.d.ts +0 -0
  7. package/lib/{service → common}/Logger.js +2 -5
  8. package/lib/common/Operations.d.ts +12 -0
  9. package/lib/common/Operations.js +33 -0
  10. package/lib/common/ReadonlyProxy.d.ts +9 -0
  11. package/lib/common/ReadonlyProxy.js +23 -0
  12. package/lib/common/StateProxy.d.ts +35 -0
  13. package/lib/common/StateProxy.js +69 -0
  14. package/lib/common/TwoWayMap.js +4 -10
  15. package/lib/common/externals/BrowserExternals.d.ts +3 -0
  16. package/lib/common/externals/BrowserExternals.js +191 -0
  17. package/lib/common/externals/NodeJsExternals.d.ts +3 -0
  18. package/lib/common/externals/NodeJsExternals.js +152 -0
  19. package/lib/common/externals/downloader.d.ts +31 -0
  20. package/lib/common/externals/downloader.js +32 -0
  21. package/lib/common/externals/index.d.ts +96 -0
  22. package/lib/common/externals/index.js +2 -0
  23. package/lib/common/index.d.ts +8 -1
  24. package/lib/common/index.js +8 -17
  25. package/lib/common/util.d.ts +48 -20
  26. package/lib/common/util.js +71 -86
  27. package/lib/index.d.ts +7 -7
  28. package/lib/index.js +7 -23
  29. package/lib/node/AstNode.d.ts +12 -11
  30. package/lib/node/AstNode.js +10 -16
  31. package/lib/node/BooleanNode.d.ts +2 -2
  32. package/lib/node/BooleanNode.js +4 -7
  33. package/lib/node/CommentNode.d.ts +6 -5
  34. package/lib/node/CommentNode.js +4 -9
  35. package/lib/node/ErrorNode.d.ts +1 -1
  36. package/lib/node/ErrorNode.js +2 -5
  37. package/lib/node/FileNode.d.ts +8 -4
  38. package/lib/node/FileNode.js +3 -6
  39. package/lib/node/FloatNode.d.ts +3 -3
  40. package/lib/node/FloatNode.js +4 -7
  41. package/lib/node/IntegerNode.d.ts +3 -3
  42. package/lib/node/IntegerNode.js +4 -7
  43. package/lib/node/ListNode.d.ts +2 -2
  44. package/lib/node/ListNode.js +2 -5
  45. package/lib/node/LiteralNode.d.ts +4 -4
  46. package/lib/node/LiteralNode.js +4 -7
  47. package/lib/node/LongNode.d.ts +3 -3
  48. package/lib/node/LongNode.js +4 -7
  49. package/lib/node/RecordNode.d.ts +2 -2
  50. package/lib/node/RecordNode.js +2 -5
  51. package/lib/node/ResourceLocationNode.d.ts +7 -7
  52. package/lib/node/ResourceLocationNode.js +9 -12
  53. package/lib/node/Sequence.d.ts +2 -2
  54. package/lib/node/Sequence.js +4 -7
  55. package/lib/node/StringNode.d.ts +5 -5
  56. package/lib/node/StringNode.js +9 -12
  57. package/lib/node/SymbolNode.d.ts +4 -4
  58. package/lib/node/SymbolNode.js +4 -7
  59. package/lib/node/index.d.ts +15 -15
  60. package/lib/node/index.js +15 -31
  61. package/lib/nodejs.d.ts +2 -0
  62. package/lib/nodejs.js +2 -0
  63. package/lib/parser/Parser.d.ts +3 -3
  64. package/lib/parser/Parser.js +1 -4
  65. package/lib/parser/boolean.d.ts +2 -2
  66. package/lib/parser/boolean.js +3 -6
  67. package/lib/parser/comment.d.ts +2 -2
  68. package/lib/parser/comment.js +5 -9
  69. package/lib/parser/empty.d.ts +1 -1
  70. package/lib/parser/empty.js +1 -5
  71. package/lib/parser/error.d.ts +2 -2
  72. package/lib/parser/error.js +5 -9
  73. package/lib/parser/file.d.ts +3 -3
  74. package/lib/parser/file.js +9 -13
  75. package/lib/parser/float.d.ts +4 -4
  76. package/lib/parser/float.js +12 -16
  77. package/lib/parser/index.d.ts +16 -16
  78. package/lib/parser/index.js +16 -38
  79. package/lib/parser/integer.d.ts +4 -4
  80. package/lib/parser/integer.js +10 -14
  81. package/lib/parser/list.d.ts +2 -2
  82. package/lib/parser/list.js +15 -19
  83. package/lib/parser/literal.d.ts +2 -2
  84. package/lib/parser/literal.js +5 -9
  85. package/lib/parser/long.d.ts +4 -4
  86. package/lib/parser/long.js +10 -14
  87. package/lib/parser/record.d.ts +3 -3
  88. package/lib/parser/record.js +20 -24
  89. package/lib/parser/resourceLocation.d.ts +2 -2
  90. package/lib/parser/resourceLocation.js +12 -24
  91. package/lib/parser/string.d.ts +7 -7
  92. package/lib/parser/string.js +36 -42
  93. package/lib/parser/symbol.d.ts +3 -3
  94. package/lib/parser/symbol.js +4 -14
  95. package/lib/parser/util.d.ts +6 -5
  96. package/lib/parser/util.js +40 -60
  97. package/lib/processor/ColorInfoProvider.d.ts +1 -1
  98. package/lib/processor/ColorInfoProvider.js +6 -9
  99. package/lib/processor/InlayHintProvider.d.ts +4 -3
  100. package/lib/processor/InlayHintProvider.js +1 -2
  101. package/lib/processor/SignatureHelpProvider.d.ts +4 -3
  102. package/lib/processor/SignatureHelpProvider.js +1 -2
  103. package/lib/processor/binder/Binder.d.ts +26 -0
  104. package/lib/processor/binder/Binder.js +18 -0
  105. package/lib/processor/binder/builtin.d.ts +27 -0
  106. package/lib/processor/binder/builtin.js +116 -0
  107. package/lib/processor/binder/index.d.ts +3 -0
  108. package/lib/processor/binder/index.js +3 -0
  109. package/lib/processor/checker/Checker.d.ts +2 -2
  110. package/lib/processor/checker/Checker.js +1 -5
  111. package/lib/processor/checker/builtin.d.ts +4 -4
  112. package/lib/processor/checker/builtin.js +22 -33
  113. package/lib/processor/checker/index.d.ts +2 -2
  114. package/lib/processor/checker/index.js +2 -31
  115. package/lib/processor/colorizer/Colorizer.d.ts +6 -5
  116. package/lib/processor/colorizer/Colorizer.js +8 -11
  117. package/lib/processor/colorizer/builtin.d.ts +3 -3
  118. package/lib/processor/colorizer/builtin.js +34 -46
  119. package/lib/processor/colorizer/index.d.ts +2 -2
  120. package/lib/processor/colorizer/index.js +2 -31
  121. package/lib/processor/completer/Completer.d.ts +6 -5
  122. package/lib/processor/completer/Completer.js +14 -33
  123. package/lib/processor/completer/builtin.d.ts +10 -9
  124. package/lib/processor/completer/builtin.js +47 -63
  125. package/lib/processor/completer/index.d.ts +2 -2
  126. package/lib/processor/completer/index.js +2 -31
  127. package/lib/processor/formatter/Formatter.d.ts +4 -3
  128. package/lib/processor/formatter/Formatter.js +2 -7
  129. package/lib/processor/formatter/builtin.d.ts +3 -3
  130. package/lib/processor/formatter/builtin.js +22 -36
  131. package/lib/processor/formatter/index.d.ts +2 -2
  132. package/lib/processor/formatter/index.js +2 -31
  133. package/lib/processor/index.d.ts +10 -9
  134. package/lib/processor/index.js +10 -25
  135. package/lib/processor/linter/Linter.d.ts +4 -3
  136. package/lib/processor/linter/Linter.js +1 -2
  137. package/lib/processor/linter/builtin/undeclaredSymbol.d.ts +2 -2
  138. package/lib/processor/linter/builtin/undeclaredSymbol.js +20 -24
  139. package/lib/processor/linter/builtin.d.ts +4 -3
  140. package/lib/processor/linter/builtin.js +19 -26
  141. package/lib/processor/linter/index.d.ts +2 -2
  142. package/lib/processor/linter/index.js +2 -31
  143. package/lib/processor/util.d.ts +4 -14
  144. package/lib/processor/util.js +1 -16
  145. package/lib/service/CacheService.d.ts +13 -8
  146. package/lib/service/CacheService.js +45 -57
  147. package/lib/service/Config.d.ts +11 -12
  148. package/lib/service/Config.js +50 -45
  149. package/lib/service/Context.d.ts +23 -20
  150. package/lib/service/Context.js +39 -36
  151. package/lib/service/Dependency.js +2 -5
  152. package/lib/service/Downloader.d.ts +9 -40
  153. package/lib/service/Downloader.js +37 -110
  154. package/lib/service/ErrorReporter.d.ts +2 -2
  155. package/lib/service/ErrorReporter.js +10 -14
  156. package/lib/service/FileService.d.ts +15 -14
  157. package/lib/service/FileService.js +55 -92
  158. package/lib/service/Hover.d.ts +2 -2
  159. package/lib/service/Hover.js +4 -7
  160. package/lib/service/MetaRegistry.d.ts +22 -12
  161. package/lib/service/MetaRegistry.js +81 -73
  162. package/lib/service/Profiler.d.ts +3 -2
  163. package/lib/service/Profiler.js +81 -45
  164. package/lib/service/Project.d.ts +105 -76
  165. package/lib/service/Project.js +449 -370
  166. package/lib/service/Service.d.ts +17 -27
  167. package/lib/service/Service.js +37 -43
  168. package/lib/service/SymbolLocations.d.ts +3 -3
  169. package/lib/service/SymbolLocations.js +4 -7
  170. package/lib/service/SymbolRegistrar.d.ts +1 -1
  171. package/lib/service/SymbolRegistrar.js +1 -2
  172. package/lib/service/UriProcessor.d.ts +5 -0
  173. package/lib/service/UriProcessor.js +2 -0
  174. package/lib/service/fileUtil.d.ts +15 -45
  175. package/lib/service/fileUtil.js +38 -143
  176. package/lib/service/index.d.ts +16 -17
  177. package/lib/service/index.js +16 -35
  178. package/lib/source/IndexMap.d.ts +1 -1
  179. package/lib/source/IndexMap.js +7 -10
  180. package/lib/source/LanguageError.d.ts +20 -6
  181. package/lib/source/LanguageError.js +16 -9
  182. package/lib/source/Location.d.ts +3 -3
  183. package/lib/source/Location.js +6 -9
  184. package/lib/source/Offset.d.ts +1 -1
  185. package/lib/source/Offset.js +4 -7
  186. package/lib/source/Position.js +2 -5
  187. package/lib/source/PositionRange.d.ts +3 -3
  188. package/lib/source/PositionRange.js +17 -20
  189. package/lib/source/Range.d.ts +1 -1
  190. package/lib/source/Range.js +7 -10
  191. package/lib/source/Source.d.ts +5 -3
  192. package/lib/source/Source.js +34 -29
  193. package/lib/source/index.d.ts +8 -8
  194. package/lib/source/index.js +8 -24
  195. package/lib/symbol/Symbol.d.ts +5 -4
  196. package/lib/symbol/Symbol.js +49 -65
  197. package/lib/symbol/SymbolUtil.d.ts +29 -31
  198. package/lib/symbol/SymbolUtil.js +178 -157
  199. package/lib/symbol/index.d.ts +2 -3
  200. package/lib/symbol/index.js +2 -19
  201. package/package.json +7 -4
  202. package/lib/service/Operations.d.ts +0 -8
  203. package/lib/service/Operations.js +0 -26
  204. package/lib/symbol/UriBinder.d.ts +0 -3
  205. package/lib/symbol/UriBinder.js +0 -3
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ItemNode = void 0;
4
- var ItemNode;
1
+ export var ItemNode;
5
2
  (function (ItemNode) {
6
3
  function is(node) {
7
4
  return node?.type === 'item';
8
5
  }
9
6
  ItemNode.is = is;
10
- })(ItemNode = exports.ItemNode || (exports.ItemNode = {}));
7
+ })(ItemNode || (ItemNode = {}));
11
8
  //# sourceMappingURL=ListNode.js.map
@@ -1,13 +1,13 @@
1
- import type { ColorTokenType } from '../processor';
2
- import type { RangeLike } from '../source';
3
- import type { AstNode } from './AstNode';
1
+ import type { ColorTokenType } from '../processor/index.js';
2
+ import type { RangeLike } from '../source/index.js';
3
+ import type { AstNode } from './AstNode.js';
4
4
  export interface LiteralOptions {
5
5
  pool: string[];
6
6
  colorTokenType?: ColorTokenType;
7
7
  }
8
8
  export interface LiteralBaseNode extends AstNode {
9
9
  readonly options: LiteralOptions;
10
- readonly value: string;
10
+ value: string;
11
11
  }
12
12
  export interface LiteralNode extends LiteralBaseNode {
13
13
  readonly type: 'literal';
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LiteralNode = void 0;
4
- const source_1 = require("../source");
5
- var LiteralNode;
1
+ import { Range } from '../source/index.js';
2
+ export var LiteralNode;
6
3
  (function (LiteralNode) {
7
4
  /* istanbul ignore next */
8
5
  function is(obj) {
@@ -12,11 +9,11 @@ var LiteralNode;
12
9
  function mock(range, options) {
13
10
  return {
14
11
  type: 'literal',
15
- range: source_1.Range.get(range),
12
+ range: Range.get(range),
16
13
  options,
17
14
  value: '',
18
15
  };
19
16
  }
20
17
  LiteralNode.mock = mock;
21
- })(LiteralNode = exports.LiteralNode || (exports.LiteralNode = {}));
18
+ })(LiteralNode || (LiteralNode = {}));
22
19
  //# sourceMappingURL=LiteralNode.js.map
@@ -1,7 +1,7 @@
1
- import type { RangeLike } from '../source';
2
- import type { AstNode } from './AstNode';
1
+ import type { RangeLike } from '../source/index.js';
2
+ import type { AstNode } from './AstNode.js';
3
3
  export interface LongBaseNode extends AstNode {
4
- readonly value: bigint;
4
+ value: bigint;
5
5
  }
6
6
  export interface LongNode extends LongBaseNode {
7
7
  readonly type: 'long';
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LongNode = void 0;
4
- const source_1 = require("../source");
5
- var LongNode;
1
+ import { Range } from '../source/index.js';
2
+ export var LongNode;
6
3
  (function (LongNode) {
7
4
  function is(obj) {
8
5
  return obj.type === 'long';
@@ -11,10 +8,10 @@ var LongNode;
11
8
  function mock(range) {
12
9
  return {
13
10
  type: 'long',
14
- range: source_1.Range.get(range),
11
+ range: Range.get(range),
15
12
  value: 0n,
16
13
  };
17
14
  }
18
15
  LongNode.mock = mock;
19
- })(LongNode = exports.LongNode || (exports.LongNode = {}));
16
+ })(LongNode || (LongNode = {}));
20
17
  //# sourceMappingURL=LongNode.js.map
@@ -1,5 +1,5 @@
1
- import type { Range } from '../source';
2
- import type { AstNode } from './AstNode';
1
+ import type { Range } from '../source/index.js';
2
+ import type { AstNode } from './AstNode.js';
3
3
  export interface RecordBaseNode<K extends AstNode, V extends AstNode> extends AstNode {
4
4
  readonly children: PairNode<K, V>[];
5
5
  }
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PairNode = void 0;
4
- var PairNode;
1
+ export var PairNode;
5
2
  (function (PairNode) {
6
3
  function is(node) {
7
4
  return node?.type === 'pair';
8
5
  }
9
6
  PairNode.is = is;
10
- })(PairNode = exports.PairNode || (exports.PairNode = {}));
7
+ })(PairNode || (PairNode = {}));
11
8
  //# sourceMappingURL=RecordNode.js.map
@@ -1,8 +1,8 @@
1
- import type { FullResourceLocation } from '../common';
2
- import { ResourceLocation } from '../common';
3
- import type { RangeLike } from '../source';
4
- import type { ResourceLocationCategory, SymbolAccessType, SymbolUsageType, TaggableResourceLocationCategory } from '../symbol';
5
- import type { AstNode } from './AstNode';
1
+ import type { DeepReadonly, FullResourceLocation } from '../common/index.js';
2
+ import { ResourceLocation } from '../common/index.js';
3
+ import type { RangeLike } from '../source/index.js';
4
+ import type { ResourceLocationCategory, SymbolAccessType, SymbolUsageType, TaggableResourceLocationCategory } from '../symbol/index.js';
5
+ import type { AstNode } from './AstNode.js';
6
6
  export declare type ResourceLocationOptions = {
7
7
  accessType?: SymbolAccessType;
8
8
  isPredicate?: boolean;
@@ -33,7 +33,7 @@ export interface ResourceLocationNode extends ResourceLocationBaseNode {
33
33
  export declare namespace ResourceLocationNode {
34
34
  function is(obj: AstNode | undefined): obj is ResourceLocationNode;
35
35
  function mock(range: RangeLike, options: ResourceLocationOptions): ResourceLocationNode;
36
- function toString(node: ResourceLocationBaseNode, type?: 'full'): FullResourceLocation;
37
- function toString(node: ResourceLocationBaseNode, type?: 'origin' | 'full' | 'short'): string;
36
+ function toString(node: DeepReadonly<ResourceLocationBaseNode>, type?: 'full'): FullResourceLocation;
37
+ function toString(node: DeepReadonly<ResourceLocationBaseNode>, type?: 'origin' | 'full' | 'short'): string;
38
38
  }
39
39
  //# sourceMappingURL=ResourceLocationNode.d.ts.map
@@ -1,23 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResourceLocationNode = void 0;
4
- const common_1 = require("../common");
5
- const source_1 = require("../source");
6
- var ResourceLocationNode;
1
+ import { ResourceLocation } from '../common/index.js';
2
+ import { Range } from '../source/index.js';
3
+ export var ResourceLocationNode;
7
4
  (function (ResourceLocationNode) {
8
5
  /**
9
6
  * The prefix for tags.
10
7
  */
11
- const TagPrefix = common_1.ResourceLocation.TagPrefix;
8
+ const TagPrefix = ResourceLocation.TagPrefix;
12
9
  /**
13
10
  * The seperator of namespace and path.
14
11
  */
15
- const NamespacePathSep = common_1.ResourceLocation.NamespacePathSep;
12
+ const NamespacePathSep = ResourceLocation.NamespacePathSep;
16
13
  /**
17
14
  * The seperator between different path segments.
18
15
  */
19
- const PathSep = common_1.ResourceLocation.PathSep;
20
- const DefaultNamespace = common_1.ResourceLocation.DefaultNamespace;
16
+ const PathSep = ResourceLocation.PathSep;
17
+ const DefaultNamespace = ResourceLocation.DefaultNamespace;
21
18
  /* istanbul ignore next */
22
19
  function is(obj) {
23
20
  return obj?.type === 'resource_location';
@@ -26,7 +23,7 @@ var ResourceLocationNode;
26
23
  function mock(range, options) {
27
24
  return {
28
25
  type: 'resource_location',
29
- range: source_1.Range.get(range),
26
+ range: Range.get(range),
30
27
  options,
31
28
  };
32
29
  }
@@ -61,5 +58,5 @@ var ResourceLocationNode;
61
58
  return node.isTag ? `${TagPrefix}${id}` : id;
62
59
  }
63
60
  ResourceLocationNode.toString = toString;
64
- })(ResourceLocationNode = exports.ResourceLocationNode || (exports.ResourceLocationNode = {}));
61
+ })(ResourceLocationNode || (ResourceLocationNode = {}));
65
62
  //# sourceMappingURL=ResourceLocationNode.js.map
@@ -1,5 +1,5 @@
1
- import type { AstNode } from '../node';
2
- import type { Range } from '../source';
1
+ import type { AstNode } from '../node/index.js';
2
+ import type { Range } from '../source/index.js';
3
3
  export interface SequenceNode<CN extends AstNode = AstNode> extends AstNode {
4
4
  /**
5
5
  * An array of `AstNode`s that fully make up this node.
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SequenceUtil = exports.SequenceUtilDiscriminator = void 0;
4
- exports.SequenceUtilDiscriminator = Symbol('SequenceUtilDiscriminator');
5
- var SequenceUtil;
1
+ export const SequenceUtilDiscriminator = Symbol('SequenceUtilDiscriminator');
2
+ export var SequenceUtil;
6
3
  (function (SequenceUtil) {
7
4
  function is(obj) {
8
- return !!obj && obj[exports.SequenceUtilDiscriminator];
5
+ return !!obj && obj[SequenceUtilDiscriminator];
9
6
  }
10
7
  SequenceUtil.is = is;
11
- })(SequenceUtil = exports.SequenceUtil || (exports.SequenceUtil = {}));
8
+ })(SequenceUtil || (SequenceUtil = {}));
12
9
  //# sourceMappingURL=Sequence.js.map
@@ -1,7 +1,7 @@
1
- import type { Parser } from '../parser';
2
- import type { ColorTokenType } from '../processor';
3
- import type { IndexMap, RangeLike } from '../source';
4
- import type { AstNode } from './AstNode';
1
+ import type { Parser } from '../parser/index.js';
2
+ import type { ColorTokenType } from '../processor/index.js';
3
+ import type { IndexMap, RangeLike } from '../source/index.js';
4
+ import type { AstNode } from './AstNode.js';
5
5
  export declare const EscapeChars: readonly ["\"", "'", "\\", "b", "f", "n", "r", "t"];
6
6
  export declare type EscapeChar = typeof EscapeChars[number];
7
7
  export declare namespace EscapeChar {
@@ -50,7 +50,7 @@ export interface StringOptions {
50
50
  export declare type QuoteTypeConfig = 'always double' | 'always single' | 'prefer double' | 'prefer single';
51
51
  export interface StringBaseNode extends AstNode {
52
52
  readonly options: StringOptions;
53
- readonly value: string;
53
+ value: string;
54
54
  readonly valueMap: IndexMap;
55
55
  }
56
56
  export interface StringNode extends StringBaseNode {
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StringNode = exports.EscapeTable = exports.EscapeChar = exports.EscapeChars = void 0;
4
- const source_1 = require("../source");
5
- exports.EscapeChars = ['"', "'", '\\', 'b', 'f', 'n', 'r', 't'];
6
- var EscapeChar;
1
+ import { Range } from '../source/index.js';
2
+ export const EscapeChars = ['"', "'", '\\', 'b', 'f', 'n', 'r', 't'];
3
+ export var EscapeChar;
7
4
  (function (EscapeChar) {
8
5
  /* istanbul ignore next */
9
6
  function is(expected, c) {
10
7
  return expected ? expected.includes(c) : false;
11
8
  }
12
9
  EscapeChar.is = is;
13
- })(EscapeChar = exports.EscapeChar || (exports.EscapeChar = {}));
14
- exports.EscapeTable = new Map([
10
+ })(EscapeChar || (EscapeChar = {}));
11
+ export const EscapeTable = new Map([
15
12
  ['"', '"'],
16
13
  ["'", "'"],
17
14
  ['\\', '\\'],
@@ -21,7 +18,7 @@ exports.EscapeTable = new Map([
21
18
  ['r', '\r'],
22
19
  ['t', '\t'],
23
20
  ]);
24
- var StringNode;
21
+ export var StringNode;
25
22
  (function (StringNode) {
26
23
  /* istanbul ignore next */
27
24
  function is(obj) {
@@ -29,15 +26,15 @@ var StringNode;
29
26
  }
30
27
  StringNode.is = is;
31
28
  function mock(range, options) {
32
- range = source_1.Range.get(range);
29
+ range = Range.get(range);
33
30
  return {
34
31
  type: 'string',
35
32
  range,
36
33
  options,
37
34
  value: '',
38
- valueMap: [{ inner: source_1.Range.create(0), outer: source_1.Range.create(range.start) }],
35
+ valueMap: [{ inner: Range.create(0), outer: Range.create(range.start) }],
39
36
  };
40
37
  }
41
38
  StringNode.mock = mock;
42
- })(StringNode = exports.StringNode || (exports.StringNode = {}));
39
+ })(StringNode || (StringNode = {}));
43
40
  //# sourceMappingURL=StringNode.js.map
@@ -1,6 +1,6 @@
1
- import type { RangeLike } from '../source';
2
- import type { SymbolAccessType, SymbolUsageType } from '../symbol';
3
- import type { AstNode } from './AstNode';
1
+ import type { RangeLike } from '../source/index.js';
2
+ import type { SymbolAccessType, SymbolUsageType } from '../symbol/index.js';
3
+ import type { AstNode } from './AstNode.js';
4
4
  export interface SymbolOptions {
5
5
  category: string;
6
6
  parentPath?: string[];
@@ -9,7 +9,7 @@ export interface SymbolOptions {
9
9
  }
10
10
  export interface SymbolBaseNode extends AstNode {
11
11
  readonly options: SymbolOptions;
12
- readonly value: string;
12
+ value: string;
13
13
  }
14
14
  export interface SymbolNode extends SymbolBaseNode {
15
15
  readonly type: 'symbol';
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SymbolNode = void 0;
4
- const source_1 = require("../source");
5
- var SymbolNode;
1
+ import { Range } from '../source/index.js';
2
+ export var SymbolNode;
6
3
  (function (SymbolNode) {
7
4
  /* istanbul ignore next */
8
5
  function is(obj) {
@@ -12,11 +9,11 @@ var SymbolNode;
12
9
  function mock(range, options) {
13
10
  return {
14
11
  type: 'symbol',
15
- range: source_1.Range.get(range),
12
+ range: Range.get(range),
16
13
  options,
17
14
  value: '',
18
15
  };
19
16
  }
20
17
  SymbolNode.mock = mock;
21
- })(SymbolNode = exports.SymbolNode || (exports.SymbolNode = {}));
18
+ })(SymbolNode || (SymbolNode = {}));
22
19
  //# sourceMappingURL=SymbolNode.js.map
@@ -1,16 +1,16 @@
1
- export * from './AstNode';
2
- export * from './BooleanNode';
3
- export * from './CommentNode';
4
- export * from './ErrorNode';
5
- export * from './FileNode';
6
- export * from './FloatNode';
7
- export * from './IntegerNode';
8
- export * from './ListNode';
9
- export * from './LiteralNode';
10
- export * from './LongNode';
11
- export * from './RecordNode';
12
- export * from './ResourceLocationNode';
13
- export * from './Sequence';
14
- export * from './StringNode';
15
- export * from './SymbolNode';
1
+ export * from './AstNode.js';
2
+ export * from './BooleanNode.js';
3
+ export * from './CommentNode.js';
4
+ export * from './ErrorNode.js';
5
+ export * from './FileNode.js';
6
+ export * from './FloatNode.js';
7
+ export * from './IntegerNode.js';
8
+ export * from './ListNode.js';
9
+ export * from './LiteralNode.js';
10
+ export * from './LongNode.js';
11
+ export * from './RecordNode.js';
12
+ export * from './ResourceLocationNode.js';
13
+ export * from './Sequence.js';
14
+ export * from './StringNode.js';
15
+ export * from './SymbolNode.js';
16
16
  //# sourceMappingURL=index.d.ts.map
package/lib/node/index.js CHANGED
@@ -1,32 +1,16 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./AstNode"), exports);
18
- __exportStar(require("./BooleanNode"), exports);
19
- __exportStar(require("./CommentNode"), exports);
20
- __exportStar(require("./ErrorNode"), exports);
21
- __exportStar(require("./FileNode"), exports);
22
- __exportStar(require("./FloatNode"), exports);
23
- __exportStar(require("./IntegerNode"), exports);
24
- __exportStar(require("./ListNode"), exports);
25
- __exportStar(require("./LiteralNode"), exports);
26
- __exportStar(require("./LongNode"), exports);
27
- __exportStar(require("./RecordNode"), exports);
28
- __exportStar(require("./ResourceLocationNode"), exports);
29
- __exportStar(require("./Sequence"), exports);
30
- __exportStar(require("./StringNode"), exports);
31
- __exportStar(require("./SymbolNode"), exports);
1
+ export * from './AstNode.js';
2
+ export * from './BooleanNode.js';
3
+ export * from './CommentNode.js';
4
+ export * from './ErrorNode.js';
5
+ export * from './FileNode.js';
6
+ export * from './FloatNode.js';
7
+ export * from './IntegerNode.js';
8
+ export * from './ListNode.js';
9
+ export * from './LiteralNode.js';
10
+ export * from './LongNode.js';
11
+ export * from './RecordNode.js';
12
+ export * from './ResourceLocationNode.js';
13
+ export * from './Sequence.js';
14
+ export * from './StringNode.js';
15
+ export * from './SymbolNode.js';
32
16
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export * from './common/externals/NodeJsExternals.js';
2
+ //# sourceMappingURL=nodejs.d.ts.map
package/lib/nodejs.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './common/externals/NodeJsExternals.js';
2
+ //# sourceMappingURL=nodejs.js.map
@@ -1,6 +1,6 @@
1
- import type { AstNode } from '../node';
2
- import type { ParserContext } from '../service';
3
- import type { Source } from '../source';
1
+ import type { AstNode } from '../node/index.js';
2
+ import type { ParserContext } from '../service/index.js';
3
+ import type { Source } from '../source/index.js';
4
4
  /**
5
5
  * A parser.
6
6
  */
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Failure = void 0;
4
- exports.Failure = Symbol('Failure');
1
+ export const Failure = Symbol('Failure');
5
2
  //# sourceMappingURL=Parser.js.map
@@ -1,4 +1,4 @@
1
- import type { BooleanNode } from '../node/BooleanNode';
2
- import type { InfallibleParser } from './Parser';
1
+ import type { BooleanNode } from '../node/BooleanNode.js';
2
+ import type { InfallibleParser } from './Parser.js';
3
3
  export declare const boolean: InfallibleParser<BooleanNode>;
4
4
  //# sourceMappingURL=boolean.d.ts.map
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.boolean = void 0;
4
- const literal_1 = require("./literal");
5
- const util_1 = require("./util");
6
- exports.boolean = (0, util_1.map)((0, literal_1.literal)('false', 'true'), res => ({
1
+ import { literal } from './literal.js';
2
+ import { map } from './util.js';
3
+ export const boolean = map(literal('false', 'true'), res => ({
7
4
  type: 'boolean',
8
5
  range: res.range,
9
6
  value: res.value === '' ? undefined : res.value === 'true',
@@ -1,5 +1,5 @@
1
- import type { CommentNode } from '../node';
2
- import type { Parser } from './Parser';
1
+ import type { CommentNode } from '../node/index.js';
2
+ import type { Parser } from './Parser.js';
3
3
  interface Options {
4
4
  singleLinePrefixes: Set<string>;
5
5
  includesEol?: boolean;
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.comment = void 0;
4
- const source_1 = require("../source");
5
- const Parser_1 = require("./Parser");
1
+ import { Range } from '../source/index.js';
2
+ import { Failure } from './Parser.js';
6
3
  /**
7
4
  * `Failure` when three isn't a comment.
8
5
  */
9
- function comment({ singleLinePrefixes, includesEol }) {
6
+ export function comment({ singleLinePrefixes, includesEol }) {
10
7
  return (src, _ctx) => {
11
8
  const start = src.cursor;
12
9
  const ans = {
13
10
  type: 'comment',
14
- range: source_1.Range.create(start),
11
+ range: Range.create(start),
15
12
  comment: '',
16
13
  };
17
14
  for (const prefix of singleLinePrefixes) {
@@ -27,8 +24,7 @@ function comment({ singleLinePrefixes, includesEol }) {
27
24
  return ans;
28
25
  }
29
26
  }
30
- return Parser_1.Failure;
27
+ return Failure;
31
28
  };
32
29
  }
33
- exports.comment = comment;
34
30
  //# sourceMappingURL=comment.js.map
@@ -1,3 +1,3 @@
1
- import type { InfallibleParser } from './Parser';
1
+ import type { InfallibleParser } from './Parser.js';
2
2
  export declare const empty: InfallibleParser<undefined>;
3
3
  //# sourceMappingURL=empty.d.ts.map
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.empty = void 0;
4
1
  /* istanbul ignore next */
5
- const empty = () => undefined;
6
- exports.empty = empty;
2
+ export const empty = () => undefined;
7
3
  //# sourceMappingURL=empty.js.map
@@ -1,5 +1,5 @@
1
- import type { ErrorNode } from '../node';
2
- import type { InfallibleParser } from './Parser';
1
+ import type { ErrorNode } from '../node/index.js';
2
+ import type { InfallibleParser } from './Parser.js';
3
3
  /**
4
4
  * Returns an error node containing all the remaining text (including whitespace),
5
5
  * or returns `undefined` if the `Source` has already reached its end.
@@ -1,22 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.error = void 0;
4
- const locales_1 = require("@spyglassmc/locales");
5
- const source_1 = require("../source");
1
+ import { localize } from '@spyglassmc/locales';
2
+ import { Range } from '../source/index.js';
6
3
  /**
7
4
  * Returns an error node containing all the remaining text (including whitespace),
8
5
  * or returns `undefined` if the `Source` has already reached its end.
9
6
  */
10
- const error = (src, ctx) => {
7
+ export const error = (src, ctx) => {
11
8
  if (!src.canRead()) {
12
9
  return undefined;
13
10
  }
14
11
  const ans = {
15
12
  type: 'error',
16
- range: source_1.Range.create(src, () => src.skipRemaining()),
13
+ range: Range.create(src, () => src.skipRemaining()),
17
14
  };
18
- ctx.err.report((0, locales_1.localize)('error.unparseable-content'), ans);
15
+ ctx.err.report(localize('error.unparseable-content'), ans);
19
16
  return ans;
20
17
  };
21
- exports.error = error;
22
18
  //# sourceMappingURL=error.js.map
@@ -1,6 +1,6 @@
1
- import type { FileNode } from '../node';
2
- import { AstNode } from '../node';
3
- import type { InfallibleParser } from './Parser';
1
+ import type { FileNode } from '../node/index.js';
2
+ import { AstNode } from '../node/index.js';
3
+ import type { InfallibleParser } from './Parser.js';
4
4
  /**
5
5
  * Dispatches to the corresponding parser for the language.
6
6
  * @throws If there's no parser registered for this language ID.
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.file = void 0;
4
- const node_1 = require("../node");
5
- const source_1 = require("../source");
6
- const error_1 = require("./error");
7
- const Parser_1 = require("./Parser");
1
+ import { AstNode } from '../node/index.js';
2
+ import { Range } from '../source/index.js';
3
+ import { error } from './error.js';
4
+ import { Failure } from './Parser.js';
8
5
  /**
9
6
  * Dispatches to the corresponding parser for the language.
10
7
  * @throws If there's no parser registered for this language ID.
11
8
  */
12
- function file() {
9
+ export function file() {
13
10
  return (src, ctx) => {
14
- const fullRange = source_1.Range.create(src, src.string.length);
11
+ const fullRange = Range.create(src, src.string.length);
15
12
  const ans = {
16
13
  type: 'file',
17
14
  range: fullRange,
@@ -22,16 +19,15 @@ function file() {
22
19
  src.skipWhitespace();
23
20
  const parser = ctx.meta.getParserForLanguageId(ctx.doc.languageId);
24
21
  const result = parser(src, ctx);
25
- if (result && result !== Parser_1.Failure) {
22
+ if (result && result !== Failure) {
26
23
  ans.children.push(result);
27
24
  }
28
25
  if (src.skipWhitespace().canRead()) {
29
- ans.children.push((0, error_1.error)(src, ctx));
26
+ ans.children.push(error(src, ctx));
30
27
  }
31
- node_1.AstNode.setParents(ans);
28
+ AstNode.setParents(ans);
32
29
  ans.parserErrors = ctx.err.dump();
33
30
  return ans;
34
31
  };
35
32
  }
36
- exports.file = file;
37
33
  //# sourceMappingURL=file.js.map
@@ -1,7 +1,7 @@
1
- import type { FloatNode } from '../node';
2
- import type { ParserContext } from '../service';
3
- import { Source } from '../source';
4
- import type { InfallibleParser, Parser } from './Parser';
1
+ import type { FloatNode } from '../node/index.js';
2
+ import type { ParserContext } from '../service/index.js';
3
+ import { Source } from '../source/index.js';
4
+ import type { InfallibleParser, Parser } from './Parser.js';
5
5
  interface OptionsBase {
6
6
  pattern: RegExp;
7
7
  /**