@spyglassmc/core 0.1.0 → 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.
- package/README.md +7 -0
- package/lib/browser.d.ts +2 -0
- package/lib/browser.js +2 -0
- package/lib/common/TwoWayMap.d.ts +21 -0
- package/lib/common/TwoWayMap.js +69 -0
- package/lib/common/externals/BrowserExternals.d.ts +3 -0
- package/lib/common/externals/BrowserExternals.js +191 -0
- package/lib/common/externals/NodeJsExternals.d.ts +3 -0
- package/lib/common/externals/NodeJsExternals.js +151 -0
- package/lib/common/externals/downloader.d.ts +31 -0
- package/lib/common/externals/downloader.js +32 -0
- package/lib/common/externals/index.d.ts +96 -0
- package/lib/common/externals/index.js +2 -0
- package/lib/common/index.d.ts +2 -1
- package/lib/common/index.js +2 -13
- package/lib/common/util.d.ts +17 -34
- package/lib/common/util.js +32 -113
- package/lib/index.d.ts +7 -7
- package/lib/index.js +7 -19
- package/lib/node/AstNode.d.ts +3 -3
- package/lib/node/AstNode.js +10 -16
- package/lib/node/BooleanNode.d.ts +2 -2
- package/lib/node/BooleanNode.js +4 -7
- package/lib/node/CommentNode.d.ts +1 -1
- package/lib/node/CommentNode.js +2 -5
- package/lib/node/ErrorNode.d.ts +1 -1
- package/lib/node/ErrorNode.js +2 -5
- package/lib/node/FileNode.d.ts +3 -3
- package/lib/node/FileNode.js +2 -5
- package/lib/node/FloatNode.d.ts +2 -2
- package/lib/node/FloatNode.js +4 -7
- package/lib/node/IntegerNode.d.ts +2 -2
- package/lib/node/IntegerNode.js +4 -7
- package/lib/node/ListNode.d.ts +2 -2
- package/lib/node/ListNode.js +2 -5
- package/lib/node/LiteralNode.d.ts +4 -4
- package/lib/node/LiteralNode.js +5 -8
- package/lib/node/LongNode.d.ts +2 -2
- package/lib/node/LongNode.js +4 -7
- package/lib/node/RecordNode.d.ts +2 -2
- package/lib/node/RecordNode.js +2 -5
- package/lib/node/ResourceLocationNode.d.ts +6 -8
- package/lib/node/ResourceLocationNode.js +9 -12
- package/lib/node/Sequence.d.ts +4 -3
- package/lib/node/Sequence.js +4 -6
- package/lib/node/StringNode.d.ts +5 -5
- package/lib/node/StringNode.js +9 -12
- package/lib/node/SymbolNode.d.ts +4 -4
- package/lib/node/SymbolNode.js +5 -8
- package/lib/node/index.d.ts +15 -15
- package/lib/node/index.js +15 -27
- package/lib/nodejs.d.ts +2 -0
- package/lib/nodejs.js +2 -0
- package/lib/parser/Parser.d.ts +3 -3
- package/lib/parser/Parser.js +1 -4
- package/lib/parser/boolean.d.ts +2 -2
- package/lib/parser/boolean.js +3 -6
- package/lib/parser/comment.d.ts +2 -2
- package/lib/parser/comment.js +5 -9
- package/lib/parser/empty.d.ts +1 -1
- package/lib/parser/empty.js +1 -5
- package/lib/parser/error.d.ts +2 -2
- package/lib/parser/error.js +5 -9
- package/lib/parser/file.d.ts +3 -3
- package/lib/parser/file.js +9 -13
- package/lib/parser/float.d.ts +4 -4
- package/lib/parser/float.js +12 -16
- package/lib/parser/index.d.ts +16 -16
- package/lib/parser/index.js +16 -34
- package/lib/parser/integer.d.ts +4 -4
- package/lib/parser/integer.js +10 -14
- package/lib/parser/list.d.ts +2 -2
- package/lib/parser/list.js +15 -19
- package/lib/parser/literal.d.ts +2 -2
- package/lib/parser/literal.js +5 -9
- package/lib/parser/long.d.ts +4 -4
- package/lib/parser/long.js +10 -14
- package/lib/parser/record.d.ts +3 -3
- package/lib/parser/record.js +20 -24
- package/lib/parser/resourceLocation.d.ts +2 -2
- package/lib/parser/resourceLocation.js +14 -18
- package/lib/parser/string.d.ts +7 -7
- package/lib/parser/string.js +40 -44
- package/lib/parser/symbol.d.ts +3 -3
- package/lib/parser/symbol.js +3 -7
- package/lib/parser/util.d.ts +30 -12
- package/lib/parser/util.js +78 -63
- package/lib/processor/ColorInfoProvider.d.ts +1 -1
- package/lib/processor/ColorInfoProvider.js +6 -9
- package/lib/processor/InlayHintProvider.d.ts +2 -2
- package/lib/processor/InlayHintProvider.js +1 -2
- package/lib/processor/SignatureHelpProvider.d.ts +2 -2
- package/lib/processor/SignatureHelpProvider.js +1 -2
- package/lib/processor/checker/Checker.d.ts +2 -2
- package/lib/processor/checker/Checker.js +1 -5
- package/lib/processor/checker/builtin.d.ts +5 -4
- package/lib/processor/checker/builtin.js +26 -28
- package/lib/processor/checker/index.d.ts +2 -2
- package/lib/processor/checker/index.js +2 -27
- package/lib/processor/colorizer/Colorizer.d.ts +4 -4
- package/lib/processor/colorizer/Colorizer.js +8 -11
- package/lib/processor/colorizer/builtin.d.ts +3 -3
- package/lib/processor/colorizer/builtin.js +33 -46
- package/lib/processor/colorizer/index.d.ts +2 -2
- package/lib/processor/colorizer/index.js +2 -27
- package/lib/processor/completer/Completer.d.ts +4 -4
- package/lib/processor/completer/Completer.js +14 -33
- package/lib/processor/completer/builtin.d.ts +7 -7
- package/lib/processor/completer/builtin.js +58 -74
- package/lib/processor/completer/index.d.ts +2 -2
- package/lib/processor/completer/index.js +2 -27
- package/lib/processor/formatter/Formatter.d.ts +2 -2
- package/lib/processor/formatter/Formatter.js +2 -7
- package/lib/processor/formatter/builtin.d.ts +3 -3
- package/lib/processor/formatter/builtin.js +22 -36
- package/lib/processor/formatter/index.d.ts +2 -2
- package/lib/processor/formatter/index.js +2 -27
- package/lib/processor/index.d.ts +9 -9
- package/lib/processor/index.js +9 -21
- package/lib/processor/linter/Linter.d.ts +2 -2
- package/lib/processor/linter/Linter.js +1 -2
- package/lib/processor/linter/builtin/undeclaredSymbol.d.ts +2 -2
- package/lib/processor/linter/builtin/undeclaredSymbol.js +23 -27
- package/lib/processor/linter/builtin.d.ts +3 -3
- package/lib/processor/linter/builtin.js +19 -31
- package/lib/processor/linter/index.d.ts +2 -2
- package/lib/processor/linter/index.js +2 -27
- package/lib/processor/util.d.ts +2 -2
- package/lib/processor/util.js +4 -9
- package/lib/service/CacheService.d.ts +6 -6
- package/lib/service/CacheService.js +38 -48
- package/lib/service/Config.d.ts +17 -16
- package/lib/service/Config.js +56 -51
- package/lib/service/Context.d.ts +14 -14
- package/lib/service/Context.js +30 -32
- package/lib/service/Dependency.js +2 -5
- package/lib/service/Downloader.d.ts +10 -39
- package/lib/service/Downloader.js +37 -106
- package/lib/service/ErrorReporter.d.ts +2 -2
- package/lib/service/ErrorReporter.js +11 -15
- package/lib/service/FileService.d.ts +41 -14
- package/lib/service/FileService.js +107 -81
- package/lib/service/Hover.d.ts +2 -2
- package/lib/service/Hover.js +4 -7
- package/lib/service/Logger.js +2 -5
- package/lib/service/MetaRegistry.d.ts +12 -12
- package/lib/service/MetaRegistry.js +62 -73
- package/lib/service/Operations.js +3 -9
- package/lib/service/Profiler.d.ts +1 -1
- package/lib/service/Profiler.js +25 -41
- package/lib/service/Project.d.ts +50 -51
- package/lib/service/Project.js +240 -238
- package/lib/service/Service.d.ts +19 -29
- package/lib/service/Service.js +57 -53
- package/lib/service/SymbolLocations.d.ts +3 -3
- package/lib/service/SymbolLocations.js +4 -7
- package/lib/service/SymbolRegistrar.d.ts +1 -1
- package/lib/service/SymbolRegistrar.js +1 -2
- package/lib/service/fileUtil.d.ts +21 -41
- package/lib/service/fileUtil.js +59 -129
- package/lib/service/index.d.ts +17 -17
- package/lib/service/index.js +17 -31
- package/lib/source/IndexMap.d.ts +1 -1
- package/lib/source/IndexMap.js +7 -10
- package/lib/source/LanguageError.d.ts +2 -2
- package/lib/source/LanguageError.js +3 -6
- package/lib/source/Location.d.ts +3 -3
- package/lib/source/Location.js +6 -9
- package/lib/source/Offset.d.ts +1 -1
- package/lib/source/Offset.js +4 -7
- package/lib/source/Position.js +2 -5
- package/lib/source/PositionRange.d.ts +2 -2
- package/lib/source/PositionRange.js +14 -17
- package/lib/source/Range.d.ts +1 -1
- package/lib/source/Range.js +7 -10
- package/lib/source/Source.d.ts +12 -4
- package/lib/source/Source.js +84 -29
- package/lib/source/index.d.ts +8 -8
- package/lib/source/index.js +8 -20
- package/lib/symbol/Symbol.d.ts +15 -15
- package/lib/symbol/Symbol.js +53 -68
- package/lib/symbol/SymbolUtil.d.ts +23 -33
- package/lib/symbol/SymbolUtil.js +162 -163
- package/lib/symbol/UriBinder.d.ts +1 -1
- package/lib/symbol/UriBinder.js +1 -2
- package/lib/symbol/index.d.ts +3 -3
- package/lib/symbol/index.js +3 -15
- package/package.json +7 -4
- package/lib/common/Heap.d.ts +0 -1
- package/lib/common/Heap.js +0 -2
- package/lib/node/TableNode.d.ts +0 -17
- package/lib/node/TableNode.js +0 -11
- package/lib/parser/table.d.ts +0 -22
- package/lib/parser/table.js +0 -97
- package/lib/service/CommandExecutor.d.ts +0 -3
- package/lib/service/CommandExecutor.js +0 -7
package/lib/service/Config.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ConfigService = exports.VanillaConfig = exports.SymbolLinterConfig = exports.LinterConfigValue = exports.LinterSeverity = void 0;
|
|
7
|
-
const events_1 = __importDefault(require("events"));
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
const rfdc_1 = __importDefault(require("rfdc"));
|
|
10
|
-
const common_1 = require("../common");
|
|
11
|
-
const symbol_1 = require("../symbol");
|
|
12
|
-
var LinterSeverity;
|
|
1
|
+
import rfdc from 'rfdc';
|
|
2
|
+
import { Arrayable, bufferToString, TypePredicates } from '../common/index.js';
|
|
3
|
+
import { FileCategories, RegistryCategories } from '../symbol/index.js';
|
|
4
|
+
export var LinterSeverity;
|
|
13
5
|
(function (LinterSeverity) {
|
|
14
6
|
function is(value) {
|
|
15
7
|
return value === 'hint' ||
|
|
@@ -21,18 +13,18 @@ var LinterSeverity;
|
|
|
21
13
|
function toErrorSeverity(value) {
|
|
22
14
|
switch (value) {
|
|
23
15
|
case 'error':
|
|
24
|
-
return 3 /* Error */;
|
|
16
|
+
return 3 /* ErrorSeverity.Error */;
|
|
25
17
|
case 'hint':
|
|
26
|
-
return 0 /* Hint */;
|
|
18
|
+
return 0 /* ErrorSeverity.Hint */;
|
|
27
19
|
case 'information':
|
|
28
|
-
return 1 /* Information */;
|
|
20
|
+
return 1 /* ErrorSeverity.Information */;
|
|
29
21
|
case 'warning':
|
|
30
|
-
return 2 /* Warning */;
|
|
22
|
+
return 2 /* ErrorSeverity.Warning */;
|
|
31
23
|
}
|
|
32
24
|
}
|
|
33
25
|
LinterSeverity.toErrorSeverity = toErrorSeverity;
|
|
34
|
-
})(LinterSeverity
|
|
35
|
-
var LinterConfigValue;
|
|
26
|
+
})(LinterSeverity || (LinterSeverity = {}));
|
|
27
|
+
export var LinterConfigValue;
|
|
36
28
|
(function (LinterConfigValue) {
|
|
37
29
|
function destruct(value) {
|
|
38
30
|
if (value === null || value === undefined) {
|
|
@@ -51,16 +43,16 @@ var LinterConfigValue;
|
|
|
51
43
|
};
|
|
52
44
|
}
|
|
53
45
|
return {
|
|
54
|
-
ruleSeverity: 2 /* Warning */,
|
|
46
|
+
ruleSeverity: 2 /* ErrorSeverity.Warning */,
|
|
55
47
|
ruleValue: value,
|
|
56
48
|
};
|
|
57
49
|
}
|
|
58
50
|
LinterConfigValue.destruct = destruct;
|
|
59
|
-
})(LinterConfigValue
|
|
60
|
-
var SymbolLinterConfig;
|
|
51
|
+
})(LinterConfigValue || (LinterConfigValue = {}));
|
|
52
|
+
export var SymbolLinterConfig;
|
|
61
53
|
(function (SymbolLinterConfig) {
|
|
62
54
|
function is(value) {
|
|
63
|
-
return
|
|
55
|
+
return Arrayable.is(value, Complex.is) || Action.is(value);
|
|
64
56
|
}
|
|
65
57
|
SymbolLinterConfig.is = is;
|
|
66
58
|
let Complex;
|
|
@@ -70,9 +62,9 @@ var SymbolLinterConfig;
|
|
|
70
62
|
return false;
|
|
71
63
|
}
|
|
72
64
|
const value = v;
|
|
73
|
-
return ((value.if === undefined ||
|
|
65
|
+
return ((value.if === undefined || Arrayable.is(value.if, Condition.is)) &&
|
|
74
66
|
(value.then === undefined || Action.is(value.then)) &&
|
|
75
|
-
(value.override === undefined ||
|
|
67
|
+
(value.override === undefined || Arrayable.is(value.override, Complex.is)));
|
|
76
68
|
}
|
|
77
69
|
Complex.is = is;
|
|
78
70
|
})(Complex = SymbolLinterConfig.Complex || (SymbolLinterConfig.Complex = {}));
|
|
@@ -83,11 +75,11 @@ var SymbolLinterConfig;
|
|
|
83
75
|
return false;
|
|
84
76
|
}
|
|
85
77
|
const value = v;
|
|
86
|
-
return ((value.category === undefined ||
|
|
87
|
-
(value.pattern === undefined ||
|
|
88
|
-
(value.excludePattern === undefined ||
|
|
89
|
-
(value.namespace === undefined ||
|
|
90
|
-
(value.excludeNamespace === undefined ||
|
|
78
|
+
return ((value.category === undefined || Arrayable.is(value.category, TypePredicates.isString)) &&
|
|
79
|
+
(value.pattern === undefined || Arrayable.is(value.pattern, TypePredicates.isString)) &&
|
|
80
|
+
(value.excludePattern === undefined || Arrayable.is(value.excludePattern, TypePredicates.isString)) &&
|
|
81
|
+
(value.namespace === undefined || Arrayable.is(value.namespace, TypePredicates.isString)) &&
|
|
82
|
+
(value.excludeNamespace === undefined || Arrayable.is(value.excludeNamespace, TypePredicates.isString)));
|
|
91
83
|
}
|
|
92
84
|
Condition.is = is;
|
|
93
85
|
})(Condition = SymbolLinterConfig.Condition || (SymbolLinterConfig.Condition = {}));
|
|
@@ -110,15 +102,15 @@ var SymbolLinterConfig;
|
|
|
110
102
|
}
|
|
111
103
|
Action.is = is;
|
|
112
104
|
})(Action = SymbolLinterConfig.Action || (SymbolLinterConfig.Action = {}));
|
|
113
|
-
})(SymbolLinterConfig
|
|
105
|
+
})(SymbolLinterConfig || (SymbolLinterConfig = {}));
|
|
114
106
|
/**
|
|
115
107
|
* Config which simulates the default vanilla command system.
|
|
116
108
|
*/
|
|
117
|
-
|
|
109
|
+
export const VanillaConfig = {
|
|
118
110
|
env: {
|
|
119
111
|
dataSource: 'GitHub',
|
|
120
112
|
dependencies: [
|
|
121
|
-
'@
|
|
113
|
+
'@vanilla-mcdoc',
|
|
122
114
|
],
|
|
123
115
|
feature: {
|
|
124
116
|
codeActions: true,
|
|
@@ -195,8 +187,8 @@ exports.VanillaConfig = {
|
|
|
195
187
|
undeclaredSymbol: [
|
|
196
188
|
{
|
|
197
189
|
if: [
|
|
198
|
-
{ category:
|
|
199
|
-
{ category: [...
|
|
190
|
+
{ category: RegistryCategories, namespace: 'minecraft' },
|
|
191
|
+
{ category: [...FileCategories, 'bossbar', 'objective', 'team'] },
|
|
200
192
|
],
|
|
201
193
|
then: { report: 'warning' },
|
|
202
194
|
},
|
|
@@ -210,10 +202,18 @@ exports.VanillaConfig = {
|
|
|
210
202
|
summonAec: 'summon minecraft:area_effect_cloud ~ ~ ~ {Age: -2147483648, Duration: -1, WaitTime: -2147483648, Tags: ["${1:tag}"]}',
|
|
211
203
|
},
|
|
212
204
|
};
|
|
213
|
-
class ConfigService
|
|
214
|
-
|
|
215
|
-
|
|
205
|
+
export class ConfigService {
|
|
206
|
+
project;
|
|
207
|
+
defaultConfig;
|
|
208
|
+
static ConfigFileNames = Object.freeze([
|
|
209
|
+
'spyglass.json',
|
|
210
|
+
'.spyglassrc.json',
|
|
211
|
+
]);
|
|
212
|
+
#eventEmitter;
|
|
213
|
+
constructor(project, defaultConfig = VanillaConfig) {
|
|
216
214
|
this.project = project;
|
|
215
|
+
this.defaultConfig = defaultConfig;
|
|
216
|
+
this.#eventEmitter = new project.externals.event.EventEmitter();
|
|
217
217
|
const handler = async ({ uri }) => {
|
|
218
218
|
if (ConfigService.isConfigFile(uri)) {
|
|
219
219
|
this.emit('changed', { config: await this.load() });
|
|
@@ -223,31 +223,41 @@ class ConfigService extends events_1.default {
|
|
|
223
223
|
project.on('fileModified', handler);
|
|
224
224
|
project.on('fileDeleted', handler);
|
|
225
225
|
}
|
|
226
|
+
on(event, callbackFn) {
|
|
227
|
+
this.#eventEmitter.on(event, callbackFn);
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
once(event, callbackFn) {
|
|
231
|
+
this.#eventEmitter.once(event, callbackFn);
|
|
232
|
+
return this;
|
|
233
|
+
}
|
|
234
|
+
emit(event, ...args) {
|
|
235
|
+
return this.#eventEmitter.emit(event, ...args);
|
|
236
|
+
}
|
|
226
237
|
async load() {
|
|
227
|
-
let ans =
|
|
238
|
+
let ans = this.defaultConfig;
|
|
228
239
|
for (const name of ConfigService.ConfigFileNames) {
|
|
229
|
-
const
|
|
230
|
-
const uri = new common_1.Uri(uriString);
|
|
240
|
+
const uri = this.project.projectRoot + name;
|
|
231
241
|
try {
|
|
232
|
-
ans = JSON.parse(
|
|
242
|
+
ans = JSON.parse(bufferToString(await this.project.externals.fs.readFile(uri)));
|
|
233
243
|
}
|
|
234
244
|
catch (e) {
|
|
235
|
-
if ((
|
|
245
|
+
if (this.project.externals.error.isKind(e, 'ENOENT')) {
|
|
236
246
|
// File doesn't exist.
|
|
237
247
|
continue;
|
|
238
248
|
}
|
|
239
|
-
this.emit('error', { error: e, uri
|
|
249
|
+
this.emit('error', { error: e, uri });
|
|
240
250
|
}
|
|
241
251
|
break;
|
|
242
252
|
}
|
|
243
|
-
return
|
|
253
|
+
return ConfigService.merge(this.defaultConfig, ans);
|
|
244
254
|
}
|
|
245
255
|
static isConfigFile(uri) {
|
|
246
256
|
return ConfigService.ConfigFileNames.some(n => uri.endsWith(`/${n}`));
|
|
247
257
|
}
|
|
248
|
-
merge(base, ...overrides) {
|
|
258
|
+
static merge(base, ...overrides) {
|
|
249
259
|
// FIXME
|
|
250
|
-
const ans = (
|
|
260
|
+
const ans = rfdc()(base);
|
|
251
261
|
for (const override of overrides) {
|
|
252
262
|
for (const key of ['env', 'format', 'lint', 'snippet']) {
|
|
253
263
|
ans[key] = { ...ans[key], ...override[key] };
|
|
@@ -256,9 +266,4 @@ class ConfigService extends events_1.default {
|
|
|
256
266
|
return ans;
|
|
257
267
|
}
|
|
258
268
|
}
|
|
259
|
-
exports.ConfigService = ConfigService;
|
|
260
|
-
ConfigService.ConfigFileNames = Object.freeze([
|
|
261
|
-
'spyglass.json',
|
|
262
|
-
'.spyglassrc.json',
|
|
263
|
-
]);
|
|
264
269
|
//# sourceMappingURL=Config.js.map
|
package/lib/service/Context.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
2
|
-
import type { LinterErrorReporter } from '.';
|
|
3
|
-
import type { Range } from '../source';
|
|
4
|
-
import { ReadonlySource } from '../source';
|
|
5
|
-
import type { SymbolTable, SymbolUtil } from '../symbol';
|
|
6
|
-
import type { Config } from './Config';
|
|
7
|
-
import { ErrorReporter } from './ErrorReporter';
|
|
8
|
-
import type { FileService } from './FileService';
|
|
9
|
-
import type { RootUriString } from './fileUtil';
|
|
10
|
-
import type { Logger } from './Logger';
|
|
11
|
-
import type { MetaRegistry } from './MetaRegistry';
|
|
12
|
-
import { Operations } from './Operations';
|
|
13
|
-
import type {
|
|
2
|
+
import type { LinterErrorReporter } from './index.js';
|
|
3
|
+
import type { Range } from '../source/index.js';
|
|
4
|
+
import { ReadonlySource } from '../source/index.js';
|
|
5
|
+
import type { SymbolTable, SymbolUtil } from '../symbol/index.js';
|
|
6
|
+
import type { Config } from './Config.js';
|
|
7
|
+
import { ErrorReporter } from './ErrorReporter.js';
|
|
8
|
+
import type { FileService } from './FileService.js';
|
|
9
|
+
import type { RootUriString } from './fileUtil.js';
|
|
10
|
+
import type { Logger } from './Logger.js';
|
|
11
|
+
import type { MetaRegistry } from './MetaRegistry.js';
|
|
12
|
+
import { Operations } from './Operations.js';
|
|
13
|
+
import type { ProfilerFactory } from './Profiler.js';
|
|
14
|
+
import type { DocAndNode, ProjectData } from './Project.js';
|
|
14
15
|
export interface ContextBase {
|
|
15
16
|
fs: FileService;
|
|
16
17
|
getDocAndNode: (uri: string) => DocAndNode | undefined;
|
|
17
18
|
global: SymbolTable;
|
|
18
19
|
logger: Logger;
|
|
19
20
|
meta: MetaRegistry;
|
|
21
|
+
profilers: ProfilerFactory;
|
|
20
22
|
project: Record<string, string>;
|
|
21
23
|
roots: readonly RootUriString[];
|
|
22
24
|
}
|
|
@@ -27,7 +29,6 @@ export interface ParserContext extends ContextBase {
|
|
|
27
29
|
config: Config;
|
|
28
30
|
doc: TextDocument;
|
|
29
31
|
err: ErrorReporter;
|
|
30
|
-
/** @deprecated */
|
|
31
32
|
symbols: SymbolUtil;
|
|
32
33
|
}
|
|
33
34
|
interface ParserContextOptions {
|
|
@@ -41,7 +42,6 @@ export interface ProcessorContext extends ContextBase {
|
|
|
41
42
|
config: Config;
|
|
42
43
|
doc: TextDocument;
|
|
43
44
|
src: ReadonlySource;
|
|
44
|
-
/** @deprecated */
|
|
45
45
|
symbols: SymbolUtil;
|
|
46
46
|
}
|
|
47
47
|
interface ProcessorContextOptions {
|
package/lib/service/Context.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* istanbul ignore file */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const Operations_1 = require("./Operations");
|
|
9
|
-
var ContextBase;
|
|
2
|
+
import { formatterContextIndentation } from '../processor/index.js';
|
|
3
|
+
import { ReadonlySource } from '../source/index.js';
|
|
4
|
+
import { ErrorReporter } from './ErrorReporter.js';
|
|
5
|
+
import { Operations } from './Operations.js';
|
|
6
|
+
export var ContextBase;
|
|
10
7
|
(function (ContextBase) {
|
|
11
8
|
function create(project) {
|
|
12
9
|
return {
|
|
@@ -15,38 +12,39 @@ var ContextBase;
|
|
|
15
12
|
global: project.symbols.global,
|
|
16
13
|
logger: project.logger,
|
|
17
14
|
meta: project.meta,
|
|
15
|
+
profilers: project.profilers,
|
|
18
16
|
roots: project.roots,
|
|
19
17
|
project: project.ctx,
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
ContextBase.create = create;
|
|
23
|
-
})(ContextBase
|
|
24
|
-
var ParserContext;
|
|
21
|
+
})(ContextBase || (ContextBase = {}));
|
|
22
|
+
export var ParserContext;
|
|
25
23
|
(function (ParserContext) {
|
|
26
24
|
function create(project, opts) {
|
|
27
25
|
return {
|
|
28
26
|
...ContextBase.create(project),
|
|
29
27
|
config: project.config,
|
|
30
28
|
doc: opts.doc,
|
|
31
|
-
err: opts.err ?? new
|
|
29
|
+
err: opts.err ?? new ErrorReporter(),
|
|
32
30
|
symbols: project.symbols,
|
|
33
31
|
};
|
|
34
32
|
}
|
|
35
33
|
ParserContext.create = create;
|
|
36
|
-
})(ParserContext
|
|
37
|
-
var ProcessorContext;
|
|
34
|
+
})(ParserContext || (ParserContext = {}));
|
|
35
|
+
export var ProcessorContext;
|
|
38
36
|
(function (ProcessorContext) {
|
|
39
37
|
function create(project, opts) {
|
|
40
38
|
return {
|
|
41
39
|
...ContextBase.create(project),
|
|
42
40
|
config: project.config,
|
|
43
41
|
doc: opts.doc,
|
|
44
|
-
src: opts.src ?? new
|
|
42
|
+
src: opts.src ?? new ReadonlySource(opts.doc.getText()),
|
|
45
43
|
symbols: project.symbols,
|
|
46
44
|
};
|
|
47
45
|
}
|
|
48
46
|
ProcessorContext.create = create;
|
|
49
|
-
})(ProcessorContext
|
|
47
|
+
})(ProcessorContext || (ProcessorContext = {}));
|
|
50
48
|
var ProcessorWithRangeContext;
|
|
51
49
|
(function (ProcessorWithRangeContext) {
|
|
52
50
|
function create(project, opts) {
|
|
@@ -67,19 +65,19 @@ var ProcessorWithOffsetContext;
|
|
|
67
65
|
}
|
|
68
66
|
ProcessorWithOffsetContext.create = create;
|
|
69
67
|
})(ProcessorWithOffsetContext || (ProcessorWithOffsetContext = {}));
|
|
70
|
-
var CheckerContext;
|
|
68
|
+
export var CheckerContext;
|
|
71
69
|
(function (CheckerContext) {
|
|
72
70
|
function create(project, opts) {
|
|
73
71
|
return {
|
|
74
72
|
...ProcessorContext.create(project, opts),
|
|
75
|
-
err: opts.err ?? new
|
|
76
|
-
ops: opts.ops ?? new
|
|
73
|
+
err: opts.err ?? new ErrorReporter(),
|
|
74
|
+
ops: opts.ops ?? new Operations(),
|
|
77
75
|
ensureChecked: project.ensureParsedAndChecked?.bind(project),
|
|
78
76
|
};
|
|
79
77
|
}
|
|
80
78
|
CheckerContext.create = create;
|
|
81
|
-
})(CheckerContext
|
|
82
|
-
var LinterContext;
|
|
79
|
+
})(CheckerContext || (CheckerContext = {}));
|
|
80
|
+
export var LinterContext;
|
|
83
81
|
(function (LinterContext) {
|
|
84
82
|
function create(project, opts) {
|
|
85
83
|
return {
|
|
@@ -90,8 +88,8 @@ var LinterContext;
|
|
|
90
88
|
};
|
|
91
89
|
}
|
|
92
90
|
LinterContext.create = create;
|
|
93
|
-
})(LinterContext
|
|
94
|
-
var FormatterContext;
|
|
91
|
+
})(LinterContext || (LinterContext = {}));
|
|
92
|
+
export var FormatterContext;
|
|
95
93
|
(function (FormatterContext) {
|
|
96
94
|
function create(project, opts) {
|
|
97
95
|
return {
|
|
@@ -99,20 +97,20 @@ var FormatterContext;
|
|
|
99
97
|
...opts,
|
|
100
98
|
indentLevel: 0,
|
|
101
99
|
indent(additionalLevels) {
|
|
102
|
-
return
|
|
100
|
+
return formatterContextIndentation(this, additionalLevels);
|
|
103
101
|
},
|
|
104
102
|
};
|
|
105
103
|
}
|
|
106
104
|
FormatterContext.create = create;
|
|
107
|
-
})(FormatterContext
|
|
108
|
-
var ColorizerContext;
|
|
105
|
+
})(FormatterContext || (FormatterContext = {}));
|
|
106
|
+
export var ColorizerContext;
|
|
109
107
|
(function (ColorizerContext) {
|
|
110
108
|
function create(project, opts) {
|
|
111
109
|
return ProcessorWithRangeContext.create(project, opts);
|
|
112
110
|
}
|
|
113
111
|
ColorizerContext.create = create;
|
|
114
|
-
})(ColorizerContext
|
|
115
|
-
var CompleterContext;
|
|
112
|
+
})(ColorizerContext || (ColorizerContext = {}));
|
|
113
|
+
export var CompleterContext;
|
|
116
114
|
(function (CompleterContext) {
|
|
117
115
|
function create(project, opts) {
|
|
118
116
|
return {
|
|
@@ -122,15 +120,15 @@ var CompleterContext;
|
|
|
122
120
|
};
|
|
123
121
|
}
|
|
124
122
|
CompleterContext.create = create;
|
|
125
|
-
})(CompleterContext
|
|
126
|
-
var SignatureHelpProviderContext;
|
|
123
|
+
})(CompleterContext || (CompleterContext = {}));
|
|
124
|
+
export var SignatureHelpProviderContext;
|
|
127
125
|
(function (SignatureHelpProviderContext) {
|
|
128
126
|
function create(project, opts) {
|
|
129
127
|
return ProcessorWithOffsetContext.create(project, opts);
|
|
130
128
|
}
|
|
131
129
|
SignatureHelpProviderContext.create = create;
|
|
132
|
-
})(SignatureHelpProviderContext
|
|
133
|
-
var UriBinderContext;
|
|
130
|
+
})(SignatureHelpProviderContext || (SignatureHelpProviderContext = {}));
|
|
131
|
+
export var UriBinderContext;
|
|
134
132
|
(function (UriBinderContext) {
|
|
135
133
|
function create(project) {
|
|
136
134
|
return {
|
|
@@ -139,5 +137,5 @@ var UriBinderContext;
|
|
|
139
137
|
};
|
|
140
138
|
}
|
|
141
139
|
UriBinderContext.create = create;
|
|
142
|
-
})(UriBinderContext
|
|
140
|
+
})(UriBinderContext || (UriBinderContext = {}));
|
|
143
141
|
//# sourceMappingURL=Context.js.map
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DependencyKey = void 0;
|
|
4
|
-
var DependencyKey;
|
|
1
|
+
export var DependencyKey;
|
|
5
2
|
(function (DependencyKey) {
|
|
6
3
|
function is(value) {
|
|
7
4
|
return value.startsWith('@');
|
|
8
5
|
}
|
|
9
6
|
DependencyKey.is = is;
|
|
10
|
-
})(DependencyKey
|
|
7
|
+
})(DependencyKey || (DependencyKey = {}));
|
|
11
8
|
//# sourceMappingURL=Dependency.js.map
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare type RemoteUriString = `${RemoteProtocol}${string}`;
|
|
5
|
-
export declare namespace RemoteUriString {
|
|
6
|
-
function getProtocol(uri: RemoteUriString): RemoteProtocol;
|
|
7
|
-
}
|
|
1
|
+
import type { ExternalDownloaderOptions, Externals, RemoteUriString } from '../common/index.js';
|
|
2
|
+
import type { RootUriString } from './fileUtil.js';
|
|
3
|
+
import type { Logger } from './Logger.js';
|
|
8
4
|
export interface DownloaderDownloadOut {
|
|
9
|
-
|
|
5
|
+
cacheUri?: string;
|
|
10
6
|
checksum?: string;
|
|
11
7
|
}
|
|
12
8
|
export declare class Downloader {
|
|
13
9
|
#private;
|
|
14
10
|
private readonly cacheRoot;
|
|
11
|
+
private readonly externals;
|
|
15
12
|
private readonly logger;
|
|
16
|
-
|
|
17
|
-
constructor(cacheRoot: string, logger: Logger, lld?: LowLevelDownloader);
|
|
13
|
+
constructor(cacheRoot: RootUriString, externals: Externals, logger: Logger);
|
|
18
14
|
download<R>(job: Job<R>, out?: DownloaderDownloadOut): Promise<R | undefined>;
|
|
19
15
|
}
|
|
20
16
|
interface Job<R> {
|
|
@@ -31,37 +27,12 @@ interface Job<R> {
|
|
|
31
27
|
*/
|
|
32
28
|
checksumJob: Omit<Job<string>, 'cache' | 'id'>;
|
|
33
29
|
checksumExtension: `.${string}`;
|
|
34
|
-
serializer?: (data:
|
|
35
|
-
deserializer?: (cache:
|
|
30
|
+
serializer?: (data: Uint8Array) => Uint8Array;
|
|
31
|
+
deserializer?: (cache: Uint8Array) => Uint8Array;
|
|
36
32
|
};
|
|
37
|
-
transformer: (data:
|
|
38
|
-
options?:
|
|
33
|
+
transformer: (data: Uint8Array) => PromiseLike<R> | R;
|
|
34
|
+
options?: ExternalDownloaderOptions;
|
|
39
35
|
ttl?: number;
|
|
40
36
|
}
|
|
41
|
-
interface LowLevelDownloadOptions {
|
|
42
|
-
/**
|
|
43
|
-
* Use an string array to set multiple values to the header.
|
|
44
|
-
*/
|
|
45
|
-
headers?: Record<string, string | string[]>;
|
|
46
|
-
timeout?: number;
|
|
47
|
-
}
|
|
48
|
-
export interface LowLevelDownloader {
|
|
49
|
-
/**
|
|
50
|
-
* @throws
|
|
51
|
-
*/
|
|
52
|
-
get(uri: RemoteUriString, options?: LowLevelDownloadOptions): Promise<Buffer>;
|
|
53
|
-
}
|
|
54
|
-
export declare namespace LowLevelDownloader {
|
|
55
|
-
function create(): LowLevelDownloader;
|
|
56
|
-
function mock(options: LowLevelDownloaderMockOptions): LowLevelDownloader;
|
|
57
|
-
}
|
|
58
|
-
interface LowLevelDownloaderMockOptions {
|
|
59
|
-
/**
|
|
60
|
-
* A record from URIs to fixture data. The {@link LowLevelDownloader.get} only returns a {@link Buffer},
|
|
61
|
-
* therefore `string` fixtures will be turned into a `Buffer` and `object` fixtures will be transformed
|
|
62
|
-
* into JSON and then turned into a `Buffer`.
|
|
63
|
-
*/
|
|
64
|
-
fixtures: Record<RemoteUriString, string | Buffer | object>;
|
|
65
|
-
}
|
|
66
37
|
export {};
|
|
67
38
|
//# sourceMappingURL=Downloader.d.ts.map
|