@spyglassmc/core 0.1.1 → 0.3.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 (206) 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.d.ts +21 -0
  15. package/lib/common/TwoWayMap.js +69 -0
  16. package/lib/common/externals/BrowserExternals.d.ts +3 -0
  17. package/lib/common/externals/BrowserExternals.js +191 -0
  18. package/lib/common/externals/NodeJsExternals.d.ts +3 -0
  19. package/lib/common/externals/NodeJsExternals.js +152 -0
  20. package/lib/common/externals/downloader.d.ts +31 -0
  21. package/lib/common/externals/downloader.js +32 -0
  22. package/lib/common/externals/index.d.ts +96 -0
  23. package/lib/common/externals/index.js +2 -0
  24. package/lib/common/index.d.ts +8 -1
  25. package/lib/common/index.js +8 -13
  26. package/lib/common/util.d.ts +50 -39
  27. package/lib/common/util.js +73 -122
  28. package/lib/index.d.ts +7 -7
  29. package/lib/index.js +7 -19
  30. package/lib/node/AstNode.d.ts +12 -11
  31. package/lib/node/AstNode.js +10 -16
  32. package/lib/node/BooleanNode.d.ts +2 -2
  33. package/lib/node/BooleanNode.js +4 -7
  34. package/lib/node/CommentNode.d.ts +6 -5
  35. package/lib/node/CommentNode.js +4 -9
  36. package/lib/node/ErrorNode.d.ts +1 -1
  37. package/lib/node/ErrorNode.js +2 -5
  38. package/lib/node/FileNode.d.ts +8 -4
  39. package/lib/node/FileNode.js +3 -6
  40. package/lib/node/FloatNode.d.ts +3 -3
  41. package/lib/node/FloatNode.js +4 -7
  42. package/lib/node/IntegerNode.d.ts +3 -3
  43. package/lib/node/IntegerNode.js +4 -7
  44. package/lib/node/ListNode.d.ts +2 -2
  45. package/lib/node/ListNode.js +2 -5
  46. package/lib/node/LiteralNode.d.ts +5 -5
  47. package/lib/node/LiteralNode.js +5 -8
  48. package/lib/node/LongNode.d.ts +3 -3
  49. package/lib/node/LongNode.js +4 -7
  50. package/lib/node/RecordNode.d.ts +2 -2
  51. package/lib/node/RecordNode.js +2 -5
  52. package/lib/node/ResourceLocationNode.d.ts +8 -10
  53. package/lib/node/ResourceLocationNode.js +9 -12
  54. package/lib/node/Sequence.d.ts +4 -3
  55. package/lib/node/Sequence.js +4 -6
  56. package/lib/node/StringNode.d.ts +5 -5
  57. package/lib/node/StringNode.js +9 -12
  58. package/lib/node/SymbolNode.d.ts +5 -5
  59. package/lib/node/SymbolNode.js +5 -8
  60. package/lib/node/index.d.ts +15 -15
  61. package/lib/node/index.js +15 -27
  62. package/lib/nodejs.d.ts +2 -0
  63. package/lib/nodejs.js +2 -0
  64. package/lib/parser/Parser.d.ts +3 -3
  65. package/lib/parser/Parser.js +1 -4
  66. package/lib/parser/boolean.d.ts +2 -2
  67. package/lib/parser/boolean.js +3 -6
  68. package/lib/parser/comment.d.ts +2 -2
  69. package/lib/parser/comment.js +5 -9
  70. package/lib/parser/empty.d.ts +1 -1
  71. package/lib/parser/empty.js +1 -5
  72. package/lib/parser/error.d.ts +2 -2
  73. package/lib/parser/error.js +5 -9
  74. package/lib/parser/file.d.ts +3 -3
  75. package/lib/parser/file.js +9 -13
  76. package/lib/parser/float.d.ts +4 -4
  77. package/lib/parser/float.js +12 -16
  78. package/lib/parser/index.d.ts +16 -16
  79. package/lib/parser/index.js +16 -34
  80. package/lib/parser/integer.d.ts +4 -4
  81. package/lib/parser/integer.js +10 -14
  82. package/lib/parser/list.d.ts +2 -2
  83. package/lib/parser/list.js +15 -19
  84. package/lib/parser/literal.d.ts +2 -2
  85. package/lib/parser/literal.js +5 -9
  86. package/lib/parser/long.d.ts +4 -4
  87. package/lib/parser/long.js +10 -14
  88. package/lib/parser/record.d.ts +3 -3
  89. package/lib/parser/record.js +20 -24
  90. package/lib/parser/resourceLocation.d.ts +2 -2
  91. package/lib/parser/resourceLocation.js +12 -24
  92. package/lib/parser/string.d.ts +7 -7
  93. package/lib/parser/string.js +40 -44
  94. package/lib/parser/symbol.d.ts +3 -3
  95. package/lib/parser/symbol.js +4 -14
  96. package/lib/parser/util.d.ts +30 -12
  97. package/lib/parser/util.js +78 -65
  98. package/lib/processor/ColorInfoProvider.d.ts +1 -1
  99. package/lib/processor/ColorInfoProvider.js +6 -9
  100. package/lib/processor/InlayHintProvider.d.ts +4 -3
  101. package/lib/processor/InlayHintProvider.js +1 -2
  102. package/lib/processor/SignatureHelpProvider.d.ts +4 -3
  103. package/lib/processor/SignatureHelpProvider.js +1 -2
  104. package/lib/processor/binder/Binder.d.ts +26 -0
  105. package/lib/processor/binder/Binder.js +18 -0
  106. package/lib/processor/binder/builtin.d.ts +27 -0
  107. package/lib/processor/binder/builtin.js +116 -0
  108. package/lib/processor/binder/index.d.ts +3 -0
  109. package/lib/processor/binder/index.js +3 -0
  110. package/lib/processor/checker/Checker.d.ts +2 -2
  111. package/lib/processor/checker/Checker.js +1 -5
  112. package/lib/processor/checker/builtin.d.ts +4 -4
  113. package/lib/processor/checker/builtin.js +22 -33
  114. package/lib/processor/checker/index.d.ts +2 -2
  115. package/lib/processor/checker/index.js +2 -27
  116. package/lib/processor/colorizer/Colorizer.d.ts +6 -5
  117. package/lib/processor/colorizer/Colorizer.js +8 -11
  118. package/lib/processor/colorizer/builtin.d.ts +3 -3
  119. package/lib/processor/colorizer/builtin.js +33 -46
  120. package/lib/processor/colorizer/index.d.ts +2 -2
  121. package/lib/processor/colorizer/index.js +2 -27
  122. package/lib/processor/completer/Completer.d.ts +6 -5
  123. package/lib/processor/completer/Completer.js +14 -33
  124. package/lib/processor/completer/builtin.d.ts +10 -9
  125. package/lib/processor/completer/builtin.js +59 -75
  126. package/lib/processor/completer/index.d.ts +2 -2
  127. package/lib/processor/completer/index.js +2 -27
  128. package/lib/processor/formatter/Formatter.d.ts +4 -3
  129. package/lib/processor/formatter/Formatter.js +2 -7
  130. package/lib/processor/formatter/builtin.d.ts +3 -3
  131. package/lib/processor/formatter/builtin.js +22 -36
  132. package/lib/processor/formatter/index.d.ts +2 -2
  133. package/lib/processor/formatter/index.js +2 -27
  134. package/lib/processor/index.d.ts +10 -9
  135. package/lib/processor/index.js +10 -21
  136. package/lib/processor/linter/Linter.d.ts +4 -3
  137. package/lib/processor/linter/Linter.js +1 -2
  138. package/lib/processor/linter/builtin/undeclaredSymbol.d.ts +2 -2
  139. package/lib/processor/linter/builtin/undeclaredSymbol.js +23 -27
  140. package/lib/processor/linter/builtin.d.ts +4 -3
  141. package/lib/processor/linter/builtin.js +19 -26
  142. package/lib/processor/linter/index.d.ts +2 -2
  143. package/lib/processor/linter/index.js +2 -27
  144. package/lib/processor/util.d.ts +4 -14
  145. package/lib/processor/util.js +1 -16
  146. package/lib/service/CacheService.d.ts +8 -6
  147. package/lib/service/CacheService.js +35 -56
  148. package/lib/service/Config.d.ts +17 -16
  149. package/lib/service/Config.js +56 -51
  150. package/lib/service/Context.d.ts +24 -21
  151. package/lib/service/Context.js +40 -36
  152. package/lib/service/Dependency.js +2 -5
  153. package/lib/service/Downloader.d.ts +9 -39
  154. package/lib/service/Downloader.js +37 -106
  155. package/lib/service/ErrorReporter.d.ts +2 -2
  156. package/lib/service/ErrorReporter.js +11 -15
  157. package/lib/service/FileService.d.ts +40 -14
  158. package/lib/service/FileService.js +107 -81
  159. package/lib/service/Hover.d.ts +2 -2
  160. package/lib/service/Hover.js +4 -7
  161. package/lib/service/MetaRegistry.d.ts +17 -12
  162. package/lib/service/MetaRegistry.js +81 -73
  163. package/lib/service/Profiler.d.ts +3 -2
  164. package/lib/service/Profiler.js +81 -45
  165. package/lib/service/Project.d.ts +101 -73
  166. package/lib/service/Project.js +438 -367
  167. package/lib/service/Service.d.ts +19 -29
  168. package/lib/service/Service.js +57 -53
  169. package/lib/service/SymbolLocations.d.ts +3 -3
  170. package/lib/service/SymbolLocations.js +4 -7
  171. package/lib/service/SymbolRegistrar.d.ts +1 -1
  172. package/lib/service/SymbolRegistrar.js +1 -2
  173. package/lib/service/UriProcessor.d.ts +5 -0
  174. package/lib/service/UriProcessor.js +2 -0
  175. package/lib/service/fileUtil.d.ts +21 -41
  176. package/lib/service/fileUtil.js +59 -129
  177. package/lib/service/index.d.ts +16 -17
  178. package/lib/service/index.js +16 -31
  179. package/lib/source/IndexMap.d.ts +1 -1
  180. package/lib/source/IndexMap.js +7 -10
  181. package/lib/source/LanguageError.d.ts +2 -2
  182. package/lib/source/LanguageError.js +3 -6
  183. package/lib/source/Location.d.ts +3 -3
  184. package/lib/source/Location.js +6 -9
  185. package/lib/source/Offset.d.ts +1 -1
  186. package/lib/source/Offset.js +4 -7
  187. package/lib/source/Position.js +2 -5
  188. package/lib/source/PositionRange.d.ts +2 -2
  189. package/lib/source/PositionRange.js +14 -17
  190. package/lib/source/Range.d.ts +1 -1
  191. package/lib/source/Range.js +7 -10
  192. package/lib/source/Source.d.ts +9 -4
  193. package/lib/source/Source.js +58 -31
  194. package/lib/source/index.d.ts +8 -8
  195. package/lib/source/index.js +8 -20
  196. package/lib/symbol/Symbol.d.ts +15 -14
  197. package/lib/symbol/Symbol.js +53 -68
  198. package/lib/symbol/SymbolUtil.d.ts +30 -39
  199. package/lib/symbol/SymbolUtil.js +189 -168
  200. package/lib/symbol/index.d.ts +2 -3
  201. package/lib/symbol/index.js +2 -15
  202. package/package.json +7 -4
  203. package/lib/service/Operations.d.ts +0 -8
  204. package/lib/service/Operations.js +0 -26
  205. package/lib/symbol/UriBinder.d.ts +0 -3
  206. package/lib/symbol/UriBinder.js +0 -3
@@ -1,37 +1,5 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.fileUtil = void 0;
26
- const child_process_1 = __importDefault(require("child_process"));
27
- const fs_1 = require("fs");
28
- const path_1 = require("path");
29
- const process_1 = __importDefault(require("process"));
30
- const url_1 = __importStar(require("url"));
31
- const util_1 = require("util");
32
- const zlib_1 = __importDefault(require("zlib"));
33
- const common_1 = require("../common");
34
- var fileUtil;
1
+ import { bufferToString, Uri } from '../common/index.js';
2
+ export var fileUtil;
35
3
  (function (fileUtil) {
36
4
  /**
37
5
  * @param rootUris The root URIs. Each URI in this array must end with a slash (`/`).
@@ -93,54 +61,17 @@ var fileUtil;
93
61
  return i >= 0 ? value.slice(i) : undefined;
94
62
  }
95
63
  fileUtil.extname = extname;
96
- /* istanbul ignore next */
97
- /**
98
- * @param fileUri A file URI.
99
- * @returns The corresponding file path of the `fileUri` in platform-specific format.
100
- * @throws If the URI is not a file schema URI.
101
- */
102
- function fileUriToPath(fileUri) {
103
- return url_1.default.fileURLToPath(new url_1.URL(fileUri));
104
- }
105
- fileUtil.fileUriToPath = fileUriToPath;
106
- /* istanbul ignore next */
107
64
  /**
108
- * @param path A file path.
109
- * @returns The corresponding file URI of the `path`.
65
+ * @returns The part from the last `/` to the end of the URI.
110
66
  */
111
- function pathToFileUri(path) {
112
- return url_1.default.pathToFileURL(path).toString();
67
+ function basename(uri) {
68
+ const i = uri.lastIndexOf('/');
69
+ return i >= 0 ? uri.slice(i + 1) : uri;
113
70
  }
114
- fileUtil.pathToFileUri = pathToFileUri;
71
+ fileUtil.basename = basename;
115
72
  /* istanbul ignore next */
116
- function normalize(uri) {
117
- try {
118
- return isFileUri(uri) ? pathToFileUri(fileUriToPath(uri)) : new url_1.URL(uri).toString();
119
- }
120
- catch {
121
- return uri;
122
- }
123
- }
124
- fileUtil.normalize = normalize;
125
- /**
126
- * @param path A string file path, string file URI, or a file URI object.
127
- *
128
- * @returns A {@link fs.PathLike}.
129
- */
130
- function toFsPathLike(path) {
131
- if (typeof path === 'string' && isFileUri(path)) {
132
- return new url_1.URL(path);
133
- }
134
- return path;
135
- }
136
- /* istanbul ignore next */
137
- function getParentOfFile(path) {
138
- if (path instanceof url_1.URL || isFileUri(path)) {
139
- return new url_1.URL('.', path);
140
- }
141
- else {
142
- return (0, path_1.resolve)(path, '..');
143
- }
73
+ function getParentOfFile(externals, path) {
74
+ return new Uri('.', path);
144
75
  }
145
76
  fileUtil.getParentOfFile = getParentOfFile;
146
77
  /* istanbul ignore next */
@@ -149,12 +80,12 @@ var fileUtil;
149
80
  *
150
81
  * @param mode Default to `0o777` (`rwxrwxrwx`)
151
82
  */
152
- async function ensureDir(path, mode = 0o777) {
83
+ async function ensureDir(externals, path, mode = 0o777) {
153
84
  try {
154
- await fs_1.promises.mkdir(toFsPathLike(path), { mode, recursive: true });
85
+ await externals.fs.mkdir(path, { mode, recursive: true });
155
86
  }
156
87
  catch (e) {
157
- if (!(0, common_1.isErrorCode)(e, 'EEXIST')) {
88
+ if (!externals.error.isKind(e, 'EEXIST')) {
158
89
  throw e;
159
90
  }
160
91
  }
@@ -168,35 +99,58 @@ var fileUtil;
168
99
  *
169
100
  * @param mode Default to `0o777` (`rwxrwxrwx`)
170
101
  */
171
- async function ensureParentOfFile(path, mode = 0o777) {
172
- return ensureDir(getParentOfFile(path), mode);
102
+ async function ensureParentOfFile(externals, path, mode = 0o777) {
103
+ return ensureDir(externals, getParentOfFile(externals, path), mode);
173
104
  }
174
105
  fileUtil.ensureParentOfFile = ensureParentOfFile;
175
- async function readFile(path) {
176
- return fs_1.promises.readFile(toFsPathLike(path));
106
+ async function chmod(externals, path, mode) {
107
+ return externals.fs.chmod(path, mode);
108
+ }
109
+ fileUtil.chmod = chmod;
110
+ async function ensureWritable(externals, path) {
111
+ try {
112
+ await chmod(externals, path, 0o666);
113
+ }
114
+ catch (e) {
115
+ if (!externals.error.isKind(e, 'ENOENT')) {
116
+ throw e;
117
+ }
118
+ }
119
+ }
120
+ fileUtil.ensureWritable = ensureWritable;
121
+ async function markReadOnly(externals, path) {
122
+ return chmod(externals, path, 0o444);
123
+ }
124
+ fileUtil.markReadOnly = markReadOnly;
125
+ async function readFile(externals, path) {
126
+ return externals.fs.readFile(path);
177
127
  }
178
128
  fileUtil.readFile = readFile;
179
129
  /* istanbul ignore next */
180
130
  /**
181
131
  * @throws
182
132
  *
183
- * The directory of the file will be created recursively if it doesn'texist.
133
+ * The directory of the file will be created recursively if it doesn't exist.
134
+ *
135
+ * The target file will be given permission `0o666` (`rw-rw-rw-`) before being written into, and changed back to the
136
+ * specified `mode`.
184
137
  *
185
138
  * * Encoding: `utf-8`
186
139
  * * Mode: `0o666` (`rw-rw-rw-`)
187
140
  * * Flag: `w`
188
141
  */
189
- async function writeFile(path, data) {
190
- await ensureParentOfFile(path);
191
- return fs_1.promises.writeFile(toFsPathLike(path), data);
142
+ async function writeFile(externals, path, data, mode = 0o666) {
143
+ await ensureParentOfFile(externals, path);
144
+ await ensureWritable(externals, path);
145
+ return externals.fs.writeFile(path, data, { mode });
192
146
  }
193
147
  fileUtil.writeFile = writeFile;
194
148
  /* istanbul ignore next */
195
149
  /**
196
150
  * @throws
197
151
  */
198
- async function readJson(path) {
199
- return JSON.parse((0, common_1.bufferToString)(await readFile(path)));
152
+ async function readJson(externals, path) {
153
+ return JSON.parse(bufferToString(await readFile(externals, path)));
200
154
  }
201
155
  fileUtil.readJson = readJson;
202
156
  /* istanbul ignore next */
@@ -205,64 +159,40 @@ var fileUtil;
205
159
  *
206
160
  * @see {@link writeFile}
207
161
  */
208
- async function writeJson(path, data) {
209
- return writeFile(path, JSON.stringify(data));
162
+ async function writeJson(externals, path, data) {
163
+ return writeFile(externals, path, JSON.stringify(data));
210
164
  }
211
165
  fileUtil.writeJson = writeJson;
212
166
  /**
213
167
  * @throws
214
168
  */
215
- async function readGzippedFile(path) {
216
- const unzip = (0, util_1.promisify)(zlib_1.default.gunzip);
217
- return unzip(await readFile(path));
169
+ async function readGzippedFile(externals, path) {
170
+ return externals.archive.gunzip(await readFile(externals, path));
218
171
  }
219
172
  fileUtil.readGzippedFile = readGzippedFile;
220
173
  /**
221
174
  * @throws
222
175
  */
223
- async function writeGzippedFile(path, buffer) {
224
- const zip = (0, util_1.promisify)(zlib_1.default.gzip);
225
- return writeFile(path, await zip(buffer));
176
+ async function writeGzippedFile(externals, path, buffer) {
177
+ if (typeof buffer === 'string') {
178
+ buffer = new TextEncoder().encode(buffer);
179
+ }
180
+ return writeFile(externals, path, await externals.archive.gzip(buffer));
226
181
  }
227
182
  fileUtil.writeGzippedFile = writeGzippedFile;
228
183
  /**
229
184
  * @throws
230
185
  */
231
- async function readGzippedJson(path) {
232
- return JSON.parse((0, common_1.bufferToString)(await readGzippedFile(path)));
186
+ async function readGzippedJson(externals, path) {
187
+ return JSON.parse(bufferToString(await readGzippedFile(externals, path)));
233
188
  }
234
189
  fileUtil.readGzippedJson = readGzippedJson;
235
190
  /**
236
191
  * @throws
237
192
  */
238
- async function writeGzippedJson(path, data) {
239
- return writeGzippedFile(path, JSON.stringify(data));
193
+ async function writeGzippedJson(externals, path, data) {
194
+ return writeGzippedFile(externals, path, JSON.stringify(data));
240
195
  }
241
196
  fileUtil.writeGzippedJson = writeGzippedJson;
242
- /**
243
- * Show the file/directory in the platform-specific explorer program.
244
- *
245
- * Should not be called with unsanitized user-input path due to the possibility of
246
- * arbitrary code execution.
247
- *
248
- * @returns The `stdout` from the spawned child process.
249
- */
250
- async function showFile(path) {
251
- const execFile = (0, util_1.promisify)(child_process_1.default.execFile);
252
- let command;
253
- switch (process_1.default.platform) {
254
- case 'darwin':
255
- command = 'open';
256
- break;
257
- case 'win32':
258
- command = 'explorer';
259
- break;
260
- default:
261
- command = 'xdg-open';
262
- break;
263
- }
264
- return execFile(command, [path]);
265
- }
266
- fileUtil.showFile = showFile;
267
- })(fileUtil = exports.fileUtil || (exports.fileUtil = {}));
197
+ })(fileUtil || (fileUtil = {}));
268
198
  //# sourceMappingURL=fileUtil.js.map
@@ -1,18 +1,17 @@
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 './MetaRegistry.js';
11
+ export * from './Profiler.js';
12
+ export * from './Project.js';
13
+ export * from './Service.js';
14
+ export * from './SymbolLocations.js';
15
+ export * from './SymbolRegistrar.js';
16
+ export * from './UriProcessor.js';
18
17
  //# sourceMappingURL=index.d.ts.map
@@ -1,33 +1,18 @@
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
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
6
- }) : (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- o[k2] = m[k];
9
- }));
10
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.FileService = void 0;
15
- __exportStar(require("./CacheService"), exports);
16
- __exportStar(require("./Config"), exports);
17
- __exportStar(require("./Context"), exports);
18
- __exportStar(require("./Dependency"), exports);
19
- __exportStar(require("./Downloader"), exports);
20
- __exportStar(require("./ErrorReporter"), exports);
21
- var FileService_1 = require("./FileService");
22
- Object.defineProperty(exports, "FileService", { enumerable: true, get: function () { return FileService_1.FileService; } });
23
- __exportStar(require("./fileUtil"), exports);
24
- __exportStar(require("./Hover"), exports);
25
- __exportStar(require("./Logger"), exports);
26
- __exportStar(require("./MetaRegistry"), exports);
27
- __exportStar(require("./Operations"), exports);
28
- __exportStar(require("./Profiler"), exports);
29
- __exportStar(require("./Project"), exports);
30
- __exportStar(require("./Service"), exports);
31
- __exportStar(require("./SymbolLocations"), exports);
32
- __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 './MetaRegistry.js';
12
+ export * from './Profiler.js';
13
+ export * from './Project.js';
14
+ export * from './Service.js';
15
+ export * from './SymbolLocations.js';
16
+ export * from './SymbolRegistrar.js';
17
+ export * from './UriProcessor.js';
33
18
  //# 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,9 +1,6 @@
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
- function create(message, range, severity = 3 /* Error */, info) {
3
+ function create(message, range, severity = 3 /* ErrorSeverity.Error */, info) {
7
4
  const ans = { range, message, severity };
8
5
  if (info) {
9
6
  ans.info = info;
@@ -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