@spyglassmc/core 0.1.2 → 0.2.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 (187) 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/TwoWayMap.js +4 -10
  5. package/lib/common/externals/BrowserExternals.d.ts +3 -0
  6. package/lib/common/externals/BrowserExternals.js +191 -0
  7. package/lib/common/externals/NodeJsExternals.d.ts +3 -0
  8. package/lib/common/externals/NodeJsExternals.js +151 -0
  9. package/lib/common/externals/downloader.d.ts +31 -0
  10. package/lib/common/externals/downloader.js +32 -0
  11. package/lib/common/externals/index.d.ts +96 -0
  12. package/lib/common/externals/index.js +2 -0
  13. package/lib/common/index.d.ts +2 -1
  14. package/lib/common/index.js +2 -17
  15. package/lib/common/util.d.ts +15 -15
  16. package/lib/common/util.js +30 -77
  17. package/lib/index.d.ts +7 -7
  18. package/lib/index.js +7 -23
  19. package/lib/node/AstNode.d.ts +3 -3
  20. package/lib/node/AstNode.js +10 -16
  21. package/lib/node/BooleanNode.d.ts +2 -2
  22. package/lib/node/BooleanNode.js +4 -7
  23. package/lib/node/CommentNode.d.ts +1 -1
  24. package/lib/node/CommentNode.js +2 -5
  25. package/lib/node/ErrorNode.d.ts +1 -1
  26. package/lib/node/ErrorNode.js +2 -5
  27. package/lib/node/FileNode.d.ts +3 -3
  28. package/lib/node/FileNode.js +2 -5
  29. package/lib/node/FloatNode.d.ts +2 -2
  30. package/lib/node/FloatNode.js +4 -7
  31. package/lib/node/IntegerNode.d.ts +2 -2
  32. package/lib/node/IntegerNode.js +4 -7
  33. package/lib/node/ListNode.d.ts +2 -2
  34. package/lib/node/ListNode.js +2 -5
  35. package/lib/node/LiteralNode.d.ts +3 -3
  36. package/lib/node/LiteralNode.js +4 -7
  37. package/lib/node/LongNode.d.ts +2 -2
  38. package/lib/node/LongNode.js +4 -7
  39. package/lib/node/RecordNode.d.ts +2 -2
  40. package/lib/node/RecordNode.js +2 -5
  41. package/lib/node/ResourceLocationNode.d.ts +5 -5
  42. package/lib/node/ResourceLocationNode.js +9 -12
  43. package/lib/node/Sequence.d.ts +2 -2
  44. package/lib/node/Sequence.js +4 -7
  45. package/lib/node/StringNode.d.ts +4 -4
  46. package/lib/node/StringNode.js +9 -12
  47. package/lib/node/SymbolNode.d.ts +3 -3
  48. package/lib/node/SymbolNode.js +4 -7
  49. package/lib/node/index.d.ts +15 -15
  50. package/lib/node/index.js +15 -31
  51. package/lib/nodejs.d.ts +2 -0
  52. package/lib/nodejs.js +2 -0
  53. package/lib/parser/Parser.d.ts +3 -3
  54. package/lib/parser/Parser.js +1 -4
  55. package/lib/parser/boolean.d.ts +2 -2
  56. package/lib/parser/boolean.js +3 -6
  57. package/lib/parser/comment.d.ts +2 -2
  58. package/lib/parser/comment.js +5 -9
  59. package/lib/parser/empty.d.ts +1 -1
  60. package/lib/parser/empty.js +1 -5
  61. package/lib/parser/error.d.ts +2 -2
  62. package/lib/parser/error.js +5 -9
  63. package/lib/parser/file.d.ts +3 -3
  64. package/lib/parser/file.js +9 -13
  65. package/lib/parser/float.d.ts +4 -4
  66. package/lib/parser/float.js +12 -16
  67. package/lib/parser/index.d.ts +16 -16
  68. package/lib/parser/index.js +16 -38
  69. package/lib/parser/integer.d.ts +4 -4
  70. package/lib/parser/integer.js +10 -14
  71. package/lib/parser/list.d.ts +2 -2
  72. package/lib/parser/list.js +15 -19
  73. package/lib/parser/literal.d.ts +2 -2
  74. package/lib/parser/literal.js +5 -9
  75. package/lib/parser/long.d.ts +4 -4
  76. package/lib/parser/long.js +10 -14
  77. package/lib/parser/record.d.ts +3 -3
  78. package/lib/parser/record.js +20 -24
  79. package/lib/parser/resourceLocation.d.ts +2 -2
  80. package/lib/parser/resourceLocation.js +14 -18
  81. package/lib/parser/string.d.ts +5 -5
  82. package/lib/parser/string.js +36 -42
  83. package/lib/parser/symbol.d.ts +3 -3
  84. package/lib/parser/symbol.js +3 -7
  85. package/lib/parser/util.d.ts +5 -5
  86. package/lib/parser/util.js +38 -56
  87. package/lib/processor/ColorInfoProvider.d.ts +1 -1
  88. package/lib/processor/ColorInfoProvider.js +6 -9
  89. package/lib/processor/InlayHintProvider.d.ts +2 -2
  90. package/lib/processor/InlayHintProvider.js +1 -2
  91. package/lib/processor/SignatureHelpProvider.d.ts +2 -2
  92. package/lib/processor/SignatureHelpProvider.js +1 -2
  93. package/lib/processor/checker/Checker.d.ts +2 -2
  94. package/lib/processor/checker/Checker.js +1 -5
  95. package/lib/processor/checker/builtin.d.ts +4 -4
  96. package/lib/processor/checker/builtin.js +19 -30
  97. package/lib/processor/checker/index.d.ts +2 -2
  98. package/lib/processor/checker/index.js +2 -31
  99. package/lib/processor/colorizer/Colorizer.d.ts +4 -4
  100. package/lib/processor/colorizer/Colorizer.js +8 -11
  101. package/lib/processor/colorizer/builtin.d.ts +3 -3
  102. package/lib/processor/colorizer/builtin.js +33 -46
  103. package/lib/processor/colorizer/index.d.ts +2 -2
  104. package/lib/processor/colorizer/index.js +2 -31
  105. package/lib/processor/completer/Completer.d.ts +4 -4
  106. package/lib/processor/completer/Completer.js +14 -33
  107. package/lib/processor/completer/builtin.d.ts +7 -7
  108. package/lib/processor/completer/builtin.js +46 -62
  109. package/lib/processor/completer/index.d.ts +2 -2
  110. package/lib/processor/completer/index.js +2 -31
  111. package/lib/processor/formatter/Formatter.d.ts +2 -2
  112. package/lib/processor/formatter/Formatter.js +2 -7
  113. package/lib/processor/formatter/builtin.d.ts +3 -3
  114. package/lib/processor/formatter/builtin.js +22 -36
  115. package/lib/processor/formatter/index.d.ts +2 -2
  116. package/lib/processor/formatter/index.js +2 -31
  117. package/lib/processor/index.d.ts +9 -9
  118. package/lib/processor/index.js +9 -25
  119. package/lib/processor/linter/Linter.d.ts +2 -2
  120. package/lib/processor/linter/Linter.js +1 -2
  121. package/lib/processor/linter/builtin/undeclaredSymbol.d.ts +2 -2
  122. package/lib/processor/linter/builtin/undeclaredSymbol.js +20 -24
  123. package/lib/processor/linter/builtin.d.ts +3 -3
  124. package/lib/processor/linter/builtin.js +19 -26
  125. package/lib/processor/linter/index.d.ts +2 -2
  126. package/lib/processor/linter/index.js +2 -31
  127. package/lib/processor/util.d.ts +2 -2
  128. package/lib/processor/util.js +4 -9
  129. package/lib/service/CacheService.d.ts +6 -6
  130. package/lib/service/CacheService.js +32 -56
  131. package/lib/service/Config.d.ts +11 -12
  132. package/lib/service/Config.js +50 -45
  133. package/lib/service/Context.d.ts +13 -13
  134. package/lib/service/Context.js +29 -32
  135. package/lib/service/Dependency.js +2 -5
  136. package/lib/service/Downloader.d.ts +10 -40
  137. package/lib/service/Downloader.js +37 -110
  138. package/lib/service/ErrorReporter.d.ts +2 -2
  139. package/lib/service/ErrorReporter.js +10 -14
  140. package/lib/service/FileService.d.ts +16 -14
  141. package/lib/service/FileService.js +55 -92
  142. package/lib/service/Hover.d.ts +2 -2
  143. package/lib/service/Hover.js +4 -7
  144. package/lib/service/Logger.js +2 -5
  145. package/lib/service/MetaRegistry.d.ts +12 -12
  146. package/lib/service/MetaRegistry.js +62 -73
  147. package/lib/service/Operations.js +3 -9
  148. package/lib/service/Profiler.d.ts +1 -1
  149. package/lib/service/Profiler.js +25 -41
  150. package/lib/service/Project.d.ts +47 -51
  151. package/lib/service/Project.js +199 -239
  152. package/lib/service/Service.d.ts +17 -27
  153. package/lib/service/Service.js +37 -43
  154. package/lib/service/SymbolLocations.d.ts +3 -3
  155. package/lib/service/SymbolLocations.js +4 -7
  156. package/lib/service/SymbolRegistrar.d.ts +1 -1
  157. package/lib/service/SymbolRegistrar.js +1 -2
  158. package/lib/service/fileUtil.d.ts +15 -45
  159. package/lib/service/fileUtil.js +38 -143
  160. package/lib/service/index.d.ts +17 -17
  161. package/lib/service/index.js +17 -35
  162. package/lib/source/IndexMap.d.ts +1 -1
  163. package/lib/source/IndexMap.js +7 -10
  164. package/lib/source/LanguageError.d.ts +2 -2
  165. package/lib/source/LanguageError.js +2 -5
  166. package/lib/source/Location.d.ts +3 -3
  167. package/lib/source/Location.js +6 -9
  168. package/lib/source/Offset.d.ts +1 -1
  169. package/lib/source/Offset.js +4 -7
  170. package/lib/source/Position.js +2 -5
  171. package/lib/source/PositionRange.d.ts +2 -2
  172. package/lib/source/PositionRange.js +14 -17
  173. package/lib/source/Range.d.ts +1 -1
  174. package/lib/source/Range.js +7 -10
  175. package/lib/source/Source.d.ts +3 -3
  176. package/lib/source/Source.js +28 -29
  177. package/lib/source/index.d.ts +8 -8
  178. package/lib/source/index.js +8 -24
  179. package/lib/symbol/Symbol.d.ts +2 -2
  180. package/lib/symbol/Symbol.js +49 -65
  181. package/lib/symbol/SymbolUtil.d.ts +22 -25
  182. package/lib/symbol/SymbolUtil.js +150 -151
  183. package/lib/symbol/UriBinder.d.ts +1 -1
  184. package/lib/symbol/UriBinder.js +1 -2
  185. package/lib/symbol/index.d.ts +3 -3
  186. package/lib/symbol/index.js +3 -19
  187. package/package.json +7 -4
@@ -1,18 +1,18 @@
1
- export * from './CacheService';
2
- export * from './Config';
3
- export * from './Context';
4
- export * from './Dependency';
5
- export * from './Downloader';
6
- export * from './ErrorReporter';
7
- export { FileService, UriProtocolSupporter } from './FileService';
8
- export * from './fileUtil';
9
- export * from './Hover';
10
- export * from './Logger';
11
- export * from './MetaRegistry';
12
- export * from './Operations';
13
- export * from './Profiler';
14
- export * from './Project';
15
- export * from './Service';
16
- export * from './SymbolLocations';
17
- export * from './SymbolRegistrar';
1
+ export * from './CacheService.js';
2
+ export * from './Config.js';
3
+ export * from './Context.js';
4
+ export * from './Dependency.js';
5
+ export * from './Downloader.js';
6
+ export * from './ErrorReporter.js';
7
+ export { FileService, UriProtocolSupporter } from './FileService.js';
8
+ export * from './fileUtil.js';
9
+ export * from './Hover.js';
10
+ export * from './Logger.js';
11
+ export * from './MetaRegistry.js';
12
+ export * from './Operations.js';
13
+ export * from './Profiler.js';
14
+ export * from './Project.js';
15
+ export * from './Service.js';
16
+ export * from './SymbolLocations.js';
17
+ export * from './SymbolRegistrar.js';
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1,37 +1,19 @@
1
- "use strict";
2
1
  /* istanbul ignore file */
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.FileService = void 0;
19
- __exportStar(require("./CacheService"), exports);
20
- __exportStar(require("./Config"), exports);
21
- __exportStar(require("./Context"), exports);
22
- __exportStar(require("./Dependency"), exports);
23
- __exportStar(require("./Downloader"), exports);
24
- __exportStar(require("./ErrorReporter"), exports);
25
- var FileService_1 = require("./FileService");
26
- Object.defineProperty(exports, "FileService", { enumerable: true, get: function () { return FileService_1.FileService; } });
27
- __exportStar(require("./fileUtil"), exports);
28
- __exportStar(require("./Hover"), exports);
29
- __exportStar(require("./Logger"), exports);
30
- __exportStar(require("./MetaRegistry"), exports);
31
- __exportStar(require("./Operations"), exports);
32
- __exportStar(require("./Profiler"), exports);
33
- __exportStar(require("./Project"), exports);
34
- __exportStar(require("./Service"), exports);
35
- __exportStar(require("./SymbolLocations"), exports);
36
- __exportStar(require("./SymbolRegistrar"), exports);
2
+ export * from './CacheService.js';
3
+ export * from './Config.js';
4
+ export * from './Context.js';
5
+ export * from './Dependency.js';
6
+ export * from './Downloader.js';
7
+ export * from './ErrorReporter.js';
8
+ export { FileService } from './FileService.js';
9
+ export * from './fileUtil.js';
10
+ export * from './Hover.js';
11
+ export * from './Logger.js';
12
+ export * from './MetaRegistry.js';
13
+ export * from './Operations.js';
14
+ export * from './Profiler.js';
15
+ export * from './Project.js';
16
+ export * from './Service.js';
17
+ export * from './SymbolLocations.js';
18
+ export * from './SymbolRegistrar.js';
37
19
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { Range } from './Range';
1
+ import { Range } from './Range.js';
2
2
  /**
3
3
  * The pairs should be in ascending order.
4
4
  */
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IndexMap = void 0;
4
- const Range_1 = require("./Range");
5
- var IndexMap;
1
+ import { Range } from './Range.js';
2
+ export var IndexMap;
6
3
  (function (IndexMap) {
7
4
  function convertOffset(map, offset, from, to, isEndOffset) {
8
5
  let ans = offset;
9
6
  for (const pair of map) {
10
- if (Range_1.Range.contains(pair[from], offset, isEndOffset)) {
7
+ if (Range.contains(pair[from], offset, isEndOffset)) {
11
8
  return isEndOffset ? pair[to].end : pair[to].start;
12
9
  }
13
- else if (Range_1.Range.endsBefore(pair[from], offset)) {
10
+ else if (Range.endsBefore(pair[from], offset)) {
14
11
  ans = offset - pair[from].end + pair[to].end;
15
12
  }
16
13
  else {
@@ -24,7 +21,7 @@ var IndexMap;
24
21
  }
25
22
  IndexMap.toInnerOffset = toInnerOffset;
26
23
  function toInnerRange(map, outer) {
27
- return Range_1.Range.create(toInnerOffset(map, outer.start), convertOffset(map, outer.end, 'outer', 'inner', true));
24
+ return Range.create(toInnerOffset(map, outer.start), convertOffset(map, outer.end, 'outer', 'inner', true));
28
25
  }
29
26
  IndexMap.toInnerRange = toInnerRange;
30
27
  function toOuterOffset(map, offset) {
@@ -32,7 +29,7 @@ var IndexMap;
32
29
  }
33
30
  IndexMap.toOuterOffset = toOuterOffset;
34
31
  function toOuterRange(map, inner) {
35
- return Range_1.Range.create(toOuterOffset(map, inner.start), convertOffset(map, inner.end, 'inner', 'outer', true));
32
+ return Range.create(toOuterOffset(map, inner.start), convertOffset(map, inner.end, 'inner', 'outer', true));
36
33
  }
37
34
  IndexMap.toOuterRange = toOuterRange;
38
35
  function merge(outerMap, innerMap) {
@@ -42,5 +39,5 @@ var IndexMap;
42
39
  }));
43
40
  }
44
41
  IndexMap.merge = merge;
45
- })(IndexMap = exports.IndexMap || (exports.IndexMap = {}));
42
+ })(IndexMap || (IndexMap = {}));
46
43
  //# sourceMappingURL=IndexMap.js.map
@@ -1,5 +1,5 @@
1
- import type { Location } from './Location';
2
- import type { Range } from './Range';
1
+ import type { Location } from './Location.js';
2
+ import type { Range } from './Range.js';
3
3
  export interface LanguageError {
4
4
  message: string;
5
5
  range: Range;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LanguageError = void 0;
4
- var LanguageError;
1
+ export var LanguageError;
5
2
  (function (LanguageError) {
6
3
  function create(message, range, severity = 3 /* ErrorSeverity.Error */, info) {
7
4
  const ans = { range, message, severity };
@@ -11,5 +8,5 @@ var LanguageError;
11
8
  return ans;
12
9
  }
13
10
  LanguageError.create = create;
14
- })(LanguageError = exports.LanguageError || (exports.LanguageError = {}));
11
+ })(LanguageError || (LanguageError = {}));
15
12
  //# sourceMappingURL=LanguageError.js.map
@@ -1,7 +1,7 @@
1
1
  import type { TextDocument } from 'vscode-languageserver-textdocument';
2
- import { PositionRange } from './PositionRange';
3
- import type { RangeLike } from './Range';
4
- import { Range } from './Range';
2
+ import { PositionRange } from './PositionRange.js';
3
+ import type { RangeLike } from './Range.js';
4
+ import { Range } from './Range.js';
5
5
  export interface Location {
6
6
  uri: string;
7
7
  range: Range;
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Location = void 0;
4
- const PositionRange_1 = require("./PositionRange");
5
- const Range_1 = require("./Range");
6
- var Location;
1
+ import { PositionRange } from './PositionRange.js';
2
+ import { Range } from './Range.js';
3
+ export var Location;
7
4
  (function (Location) {
8
5
  function get(partial) {
9
6
  return {
10
7
  uri: partial.uri ?? '',
11
- range: Range_1.Range.get(partial.range ?? { start: 0, end: 0 }),
8
+ range: Range.get(partial.range ?? { start: 0, end: 0 }),
12
9
  posRange: partial.posRange ?? { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } },
13
10
  };
14
11
  }
@@ -17,9 +14,9 @@ var Location;
17
14
  return Location.get({
18
15
  uri: doc.uri,
19
16
  range,
20
- posRange: PositionRange_1.PositionRange.from(range, doc),
17
+ posRange: PositionRange.from(range, doc),
21
18
  });
22
19
  }
23
20
  Location.create = create;
24
- })(Location = exports.Location || (exports.Location = {}));
21
+ })(Location || (Location = {}));
25
22
  //# sourceMappingURL=Location.js.map
@@ -1,4 +1,4 @@
1
- import { ReadonlySource } from './Source';
1
+ import { ReadonlySource } from './Source.js';
2
2
  export declare type OffsetLike = number | ReadonlySource | ((this: void) => number | ReadonlySource);
3
3
  export declare namespace Offset {
4
4
  /**
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Offset = void 0;
4
- const Source_1 = require("./Source");
5
- var Offset;
1
+ import { ReadonlySource } from './Source.js';
2
+ export var Offset;
6
3
  (function (Offset) {
7
4
  /**
8
5
  * Get an offset from a `OffsetLike`.
@@ -15,11 +12,11 @@ var Offset;
15
12
  if (typeof offset === 'function') {
16
13
  offset = offset();
17
14
  }
18
- if (offset instanceof Source_1.ReadonlySource) {
15
+ if (offset instanceof ReadonlySource) {
19
16
  offset = offset.cursor;
20
17
  }
21
18
  return offset;
22
19
  }
23
20
  Offset.get = get;
24
- })(Offset = exports.Offset || (exports.Offset = {}));
21
+ })(Offset || (Offset = {}));
25
22
  //# sourceMappingURL=Offset.js.map
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Position = void 0;
4
- var Position;
1
+ export var Position;
5
2
  (function (Position) {
6
3
  function create(param1, param2) {
7
4
  if (typeof param1 === 'object') {
@@ -39,5 +36,5 @@ var Position;
39
36
  (pos1.line === pos2.line && pos1.character < pos2.character));
40
37
  }
41
38
  Position.isBefore = isBefore;
42
- })(Position = exports.Position || (exports.Position = {}));
39
+ })(Position || (Position = {}));
43
40
  //# sourceMappingURL=Position.js.map
@@ -1,6 +1,6 @@
1
1
  import type { TextDocument } from 'vscode-languageserver-textdocument';
2
- import { Position } from './Position';
3
- import type { RangeLike } from './Range';
2
+ import { Position } from './Position.js';
3
+ import type { RangeLike } from './Range.js';
4
4
  export interface PositionRange {
5
5
  start: Position;
6
6
  end: Position;
@@ -1,28 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PositionRange = void 0;
4
- const Position_1 = require("./Position");
5
- const Range_1 = require("./Range");
6
- var PositionRange;
1
+ import { Position } from './Position.js';
2
+ import { Range } from './Range.js';
3
+ export var PositionRange;
7
4
  (function (PositionRange) {
8
5
  function create(param1, param2, param3, param4) {
9
6
  if (typeof param1 === 'number') {
10
7
  return {
11
- start: Position_1.Position.create(param1, param2),
12
- end: Position_1.Position.create(param3, param4),
8
+ start: Position.create(param1, param2),
9
+ end: Position.create(param3, param4),
13
10
  };
14
11
  }
15
12
  else if (param2 !== undefined) {
16
13
  return {
17
- start: Position_1.Position.create(param1),
18
- end: Position_1.Position.create(param2),
14
+ start: Position.create(param1),
15
+ end: Position.create(param2),
19
16
  };
20
17
  }
21
18
  else {
22
19
  const partial = param1;
23
20
  return {
24
- start: Position_1.Position.create(partial.start ?? {}),
25
- end: Position_1.Position.create(partial.end ?? {}),
21
+ start: Position.create(partial.start ?? {}),
22
+ end: Position.create(partial.end ?? {}),
26
23
  };
27
24
  }
28
25
  }
@@ -31,7 +28,7 @@ var PositionRange;
31
28
  * @returns A `PositionRange` converted from a `RangeLike`.
32
29
  */
33
30
  function from(range, doc) {
34
- const _range = Range_1.Range.get(range);
31
+ const _range = Range.get(range);
35
32
  const ans = {
36
33
  start: doc.positionAt(_range.start),
37
34
  end: doc.positionAt(_range.end),
@@ -56,9 +53,9 @@ var PositionRange;
56
53
  * }
57
54
  * ```
58
55
  */
59
- PositionRange.Full = Object.freeze(PositionRange.create(Position_1.Position.Beginning, Position_1.Position.Infinity));
56
+ PositionRange.Full = Object.freeze(PositionRange.create(Position.Beginning, Position.Infinity));
60
57
  function toString(range) {
61
- return `[${Position_1.Position.toString(range.start)}, ${Position_1.Position.toString(range.end)})`;
58
+ return `[${Position.toString(range.start)}, ${Position.toString(range.end)})`;
62
59
  }
63
60
  PositionRange.toString = toString;
64
61
  function contains(range, pos) {
@@ -76,8 +73,8 @@ var PositionRange;
76
73
  }
77
74
  PositionRange.contains = contains;
78
75
  function endsBefore(range, pos) {
79
- return Position_1.Position.isBefore(Position_1.Position.create(range.end.line, range.end.character - 1), pos);
76
+ return Position.isBefore(Position.create(range.end.line, range.end.character - 1), pos);
80
77
  }
81
78
  PositionRange.endsBefore = endsBefore;
82
- })(PositionRange = exports.PositionRange || (exports.PositionRange = {}));
79
+ })(PositionRange || (PositionRange = {}));
83
80
  //# sourceMappingURL=PositionRange.js.map
@@ -1,4 +1,4 @@
1
- import type { OffsetLike } from './Offset';
1
+ import type { OffsetLike } from './Offset.js';
2
2
  export declare type RangeLike = Range | RangeContainer | OffsetLike | ((this: void) => Range | RangeContainer | OffsetLike);
3
3
  export interface Range {
4
4
  start: number;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RangeContainer = exports.Range = void 0;
4
- const Offset_1 = require("./Offset");
5
- var Range;
1
+ import { Offset } from './Offset.js';
2
+ export var Range;
6
3
  (function (Range) {
7
4
  /**
8
5
  * Gets a range from `RangeLike`.
@@ -27,10 +24,10 @@ var Range;
27
24
  * Creates a range from `OffsetLike`. If only `start` is passed in, `end` will be the same value as `start`.
28
25
  */
29
26
  function create(start, end) {
30
- start = Offset_1.Offset.get(start);
27
+ start = Offset.get(start);
31
28
  return {
32
29
  start,
33
- end: end !== undefined ? Offset_1.Offset.get(end) : start,
30
+ end: end !== undefined ? Offset.get(end) : start,
34
31
  };
35
32
  }
36
33
  Range.create = create;
@@ -143,13 +140,13 @@ var Range;
143
140
  };
144
141
  }
145
142
  Range.translate = translate;
146
- })(Range = exports.Range || (exports.Range = {}));
147
- var RangeContainer;
143
+ })(Range || (Range = {}));
144
+ export var RangeContainer;
148
145
  (function (RangeContainer) {
149
146
  function is(obj) {
150
147
  return (!!obj && typeof obj === 'object' &&
151
148
  Range.is(obj.range));
152
149
  }
153
150
  RangeContainer.is = is;
154
- })(RangeContainer = exports.RangeContainer || (exports.RangeContainer = {}));
151
+ })(RangeContainer || (RangeContainer = {}));
155
152
  //# sourceMappingURL=Range.js.map
@@ -1,6 +1,6 @@
1
- import { IndexMap } from '.';
2
- import type { RangeContainer } from './Range';
3
- import { Range } from './Range';
1
+ import { IndexMap } from './IndexMap.js';
2
+ import type { RangeContainer } from './Range.js';
3
+ import { Range } from './Range.js';
4
4
  declare type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
5
5
  declare type Space = ' ' | '\t';
6
6
  declare type Newline = '\r\n' | '\r' | '\n';
@@ -1,20 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Source = exports.ReadonlySource = exports.Whitespaces = exports.LF = exports.CR = exports.CRLF = void 0;
4
- const _1 = require(".");
5
- const Range_1 = require("./Range");
6
- exports.CRLF = '\r\n';
7
- exports.CR = '\r';
8
- exports.LF = '\n';
9
- exports.Whitespaces = Object.freeze([' ', '\n', '\r', '\t']);
10
- class ReadonlySource {
1
+ import { IndexMap } from './IndexMap.js';
2
+ import { Range } from './Range.js';
3
+ export const CRLF = '\r\n';
4
+ export const CR = '\r';
5
+ export const LF = '\n';
6
+ export const Whitespaces = Object.freeze([' ', '\n', '\r', '\t']);
7
+ export class ReadonlySource {
8
+ string;
9
+ indexMap;
10
+ innerCursor = 0;
11
11
  constructor(string, indexMap = []) {
12
12
  this.string = string;
13
13
  this.indexMap = indexMap;
14
- this.innerCursor = 0;
15
14
  }
16
15
  get cursor() {
17
- return _1.IndexMap.toOuterOffset(this.indexMap, this.innerCursor);
16
+ return IndexMap.toOuterOffset(this.indexMap, this.innerCursor);
18
17
  }
19
18
  /**
20
19
  * @param offset The index to offset from cursor. Defaults to 0.
@@ -27,7 +26,7 @@ class ReadonlySource {
27
26
  * getCharRange(1) // Returns the range of the character after cursor.
28
27
  */
29
28
  getCharRange(offset = 0) {
30
- return _1.IndexMap.toOuterRange(this.indexMap, Range_1.Range.create(this.innerCursor + offset, this.innerCursor + offset + 1));
29
+ return IndexMap.toOuterRange(this.indexMap, Range.create(this.innerCursor + offset, this.innerCursor + offset + 1));
31
30
  }
32
31
  /**
33
32
  * Peeks a substring from the current cursor.
@@ -69,12 +68,12 @@ class ReadonlySource {
69
68
  return ans;
70
69
  }
71
70
  peekLine() {
72
- return this.peekUntil(exports.CR, exports.LF);
71
+ return this.peekUntil(CR, LF);
73
72
  }
74
73
  hasNonSpaceAheadInLine() {
75
74
  for (let cursor = this.innerCursor; cursor < this.string.length; cursor++) {
76
75
  const c = this.string.charAt(cursor);
77
- if (c === exports.CR || c === exports.LF) {
76
+ if (c === CR || c === LF) {
78
77
  break;
79
78
  }
80
79
  if (!(c === ' ' || c === '\t')) {
@@ -85,20 +84,21 @@ class ReadonlySource {
85
84
  }
86
85
  slice(param0, end) {
87
86
  if (typeof param0 === 'number') {
88
- const innerStart = _1.IndexMap.toInnerOffset(this.indexMap, param0);
89
- const innerEnd = end !== undefined ? _1.IndexMap.toInnerOffset(this.indexMap, end) : undefined;
87
+ const innerStart = IndexMap.toInnerOffset(this.indexMap, param0);
88
+ const innerEnd = end !== undefined ? IndexMap.toInnerOffset(this.indexMap, end) : undefined;
90
89
  return this.string.slice(innerStart, innerEnd);
91
90
  }
92
- const range = _1.IndexMap.toInnerRange(this.indexMap, Range_1.Range.get(param0));
91
+ const range = IndexMap.toInnerRange(this.indexMap, Range.get(param0));
93
92
  return this.string.slice(range.start, range.end);
94
93
  }
95
94
  sliceToCursor(start) {
96
- const innerStart = _1.IndexMap.toInnerOffset(this.indexMap, start);
95
+ const innerStart = IndexMap.toInnerOffset(this.indexMap, start);
97
96
  return this.string.slice(innerStart, this.innerCursor);
98
97
  }
99
98
  }
100
- exports.ReadonlySource = ReadonlySource;
101
- class Source extends ReadonlySource {
99
+ export class Source extends ReadonlySource {
100
+ string;
101
+ indexMap;
102
102
  constructor(string, indexMap = []) {
103
103
  super(string, indexMap);
104
104
  this.string = string;
@@ -108,7 +108,7 @@ class Source extends ReadonlySource {
108
108
  return super.cursor;
109
109
  }
110
110
  set cursor(cursor) {
111
- this.innerCursor = _1.IndexMap.toInnerOffset(this.indexMap, cursor);
111
+ this.innerCursor = IndexMap.toInnerOffset(this.indexMap, cursor);
112
112
  }
113
113
  clone() {
114
114
  const ans = new Source(this.string, this.indexMap);
@@ -119,7 +119,7 @@ class Source extends ReadonlySource {
119
119
  return this.innerCursor + length <= this.string.length;
120
120
  }
121
121
  canReadInLine() {
122
- return this.canRead() && this.peek() !== exports.CR && this.peek() !== exports.LF;
122
+ return this.canRead() && this.peek() !== CR && this.peek() !== LF;
123
123
  }
124
124
  read() {
125
125
  return this.string.charAt(this.innerCursor++);
@@ -157,7 +157,7 @@ class Source extends ReadonlySource {
157
157
  * Reads until the end of this line.
158
158
  */
159
159
  readLine() {
160
- return this.readUntil(exports.CR, exports.LF);
160
+ return this.readUntil(CR, LF);
161
161
  }
162
162
  /**
163
163
  * Skips until the end of this line.
@@ -171,10 +171,10 @@ class Source extends ReadonlySource {
171
171
  */
172
172
  nextLine() {
173
173
  this.skipLine();
174
- if (this.peek(2) === exports.CRLF) {
174
+ if (this.peek(2) === CRLF) {
175
175
  this.skip(2);
176
176
  }
177
- else if (this.peek() === exports.CR || this.peek() === exports.LF) {
177
+ else if (this.peek() === CR || this.peek() === LF) {
178
178
  this.skip();
179
179
  }
180
180
  return this;
@@ -244,10 +244,10 @@ class Source extends ReadonlySource {
244
244
  return this;
245
245
  }
246
246
  readUntilLineEnd() {
247
- return this.readUntil(exports.CR, exports.LF);
247
+ return this.readUntil(CR, LF);
248
248
  }
249
249
  skipUntilLineEnd() {
250
- return this.skipUntilOrEnd(exports.CR, exports.LF);
250
+ return this.skipUntilOrEnd(CR, LF);
251
251
  }
252
252
  readRemaining() {
253
253
  const start = this.innerCursor;
@@ -274,5 +274,4 @@ class Source extends ReadonlySource {
274
274
  return Source.isSpace(c) || Source.isNewline(c);
275
275
  }
276
276
  }
277
- exports.Source = Source;
278
277
  //# sourceMappingURL=Source.js.map
@@ -1,9 +1,9 @@
1
- export * from './IndexMap';
2
- export * from './LanguageError';
3
- export * from './Location';
4
- export * from './Offset';
5
- export * from './Position';
6
- export * from './PositionRange';
7
- export * from './Range';
8
- export * from './Source';
1
+ export * from './IndexMap.js';
2
+ export * from './LanguageError.js';
3
+ export * from './Location.js';
4
+ export * from './Offset.js';
5
+ export * from './Position.js';
6
+ export * from './PositionRange.js';
7
+ export * from './Range.js';
8
+ export * from './Source.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1,25 +1,9 @@
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("./IndexMap"), exports);
18
- __exportStar(require("./LanguageError"), exports);
19
- __exportStar(require("./Location"), exports);
20
- __exportStar(require("./Offset"), exports);
21
- __exportStar(require("./Position"), exports);
22
- __exportStar(require("./PositionRange"), exports);
23
- __exportStar(require("./Range"), exports);
24
- __exportStar(require("./Source"), exports);
1
+ export * from './IndexMap.js';
2
+ export * from './LanguageError.js';
3
+ export * from './Location.js';
4
+ export * from './Offset.js';
5
+ export * from './Position.js';
6
+ export * from './PositionRange.js';
7
+ export * from './Range.js';
8
+ export * from './Source.js';
25
9
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import type { TextDocument } from 'vscode-languageserver-textdocument';
2
- import type { RangeLike } from '../source';
3
- import { PositionRange, Range } from '../source';
2
+ import type { RangeLike } from '../source/index.js';
3
+ import { PositionRange, Range } from '../source/index.js';
4
4
  export declare const McdocCategories: readonly ["mcdoc", "mcdoc/dispatcher"];
5
5
  export declare type McdocCategory = typeof McdocCategories[number];
6
6
  export declare const RegistryCategories: readonly ["activity", "attribute", "block", "block_entity_type", "block_predicate_type", "chunk_status", "custom_stat", "enchantment", "entity_type", "float_provider_type", "fluid", "game_event", "height_provider_type", "int_provider_type", "item", "loot_condition_type", "loot_function_type", "loot_nbt_provider_type", "loot_number_provider_type", "loot_pool_entry_type", "loot_score_provider_type", "memory_module_type", "menu", "mob_effect", "motive", "particle_type", "point_of_interest_type", "pos_rule_test", "position_source_type", "potion", "recipe_serializer", "recipe_type", "rule_test", "schedule", "sensor_type", "sound_event", "stat_type", "villager_profession", "villager_type", "worldgen/biome_source", "worldgen/block_placer_type", "worldgen/block_state_provider_type", "worldgen/carver", "worldgen/chunk_generator", "worldgen/decorator", "worldgen/feature", "worldgen/feature_size_type", "worldgen/foliage_placer_type", "worldgen/material_condition", "worldgen/material_rule", "worldgen/placement_modifier_type", "worldgen/structure_feature", "worldgen/structure_piece", "worldgen/structure_pool_element", "worldgen/structure_processor", "worldgen/surface_builder", "worldgen/tree_decorator_type", "worldgen/trunk_placer_type"];