@spyglassmc/core 0.4.46 → 0.4.47
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/lib/common/Dev.d.ts +1 -1
- package/lib/common/EventDispatcher.d.ts +6 -0
- package/lib/common/EventDispatcher.js +15 -0
- package/lib/common/ReadonlyProxy.js +2 -2
- package/lib/common/StateProxy.js +2 -2
- package/lib/common/externals/BrowserExternals.d.ts +1 -9
- package/lib/common/externals/BrowserExternals.js +0 -59
- package/lib/common/externals/NodeJsExternals.d.ts +0 -19
- package/lib/common/externals/NodeJsExternals.js +0 -20
- package/lib/common/externals/index.d.ts +0 -17
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.js +1 -0
- package/lib/common/util.d.ts +14 -7
- package/lib/common/util.js +50 -18
- package/lib/node/StringNode.d.ts +1 -1
- package/lib/parser/string.d.ts +2 -2
- package/lib/processor/colorizer/Colorizer.d.ts +2 -2
- package/lib/service/CacheService.js +4 -5
- package/lib/service/Config.d.ts +6 -10
- package/lib/service/Config.js +3 -15
- package/lib/service/FileService.js +5 -5
- package/lib/service/FileWatcher.d.ts +9 -12
- package/lib/service/Project.d.ts +14 -27
- package/lib/service/Project.js +6 -18
- package/lib/service/fetcher.js +1 -1
- package/lib/service/fileUtil.js +3 -3
- package/lib/symbol/Symbol.d.ts +6 -6
- package/lib/symbol/SymbolUtil.d.ts +9 -18
- package/lib/symbol/SymbolUtil.js +5 -19
- package/package.json +3 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
2
|
-
import { type DeepReadonly,
|
|
2
|
+
import { type DeepReadonly, EventDispatcher } from '../common/index.js';
|
|
3
3
|
import type { AstNode } from '../node/index.js';
|
|
4
4
|
import type { RangeLike } from '../source/index.js';
|
|
5
5
|
import type { AllCategory, Symbol, SymbolLocationBuiltInContributor, SymbolLocationMetadata, SymbolMap, SymbolMetadata, SymbolTable, SymbolUsageType } from './Symbol.js';
|
|
@@ -31,7 +31,13 @@ interface DocAndNode {
|
|
|
31
31
|
doc: TextDocument;
|
|
32
32
|
node: AstNode;
|
|
33
33
|
}
|
|
34
|
-
export declare class SymbolUtil
|
|
34
|
+
export declare class SymbolUtil extends EventDispatcher<{
|
|
35
|
+
symbolCreated: SymbolEvent;
|
|
36
|
+
symbolAmended: SymbolEvent;
|
|
37
|
+
symbolRemoved: SymbolEvent;
|
|
38
|
+
symbolLocationCreated: SymbolLocationEvent;
|
|
39
|
+
symbolLocationRemoved: SymbolLocationEvent;
|
|
40
|
+
}> {
|
|
35
41
|
#private;
|
|
36
42
|
/**
|
|
37
43
|
* @internal
|
|
@@ -42,26 +48,11 @@ export declare class SymbolUtil implements ExternalEventEmitter {
|
|
|
42
48
|
*/
|
|
43
49
|
_inDelayMode: boolean;
|
|
44
50
|
get global(): SymbolTable;
|
|
45
|
-
constructor(global: SymbolTable,
|
|
51
|
+
constructor(global: SymbolTable,
|
|
46
52
|
/** @internal */
|
|
47
53
|
_currentContributor?: string,
|
|
48
54
|
/** @internal */
|
|
49
55
|
_inDelayMode?: boolean);
|
|
50
|
-
on(event: 'symbolCreated', callbackFn: (data: SymbolEvent) => void): this;
|
|
51
|
-
on(event: 'symbolAmended', callbackFn: (data: SymbolEvent) => void): this;
|
|
52
|
-
on(event: 'symbolRemoved', callbackFn: (data: SymbolEvent) => void): this;
|
|
53
|
-
on(event: 'symbolLocationCreated', callbackFn: (data: SymbolLocationEvent) => void): this;
|
|
54
|
-
on(event: 'symbolLocationRemoved', callbackFn: (data: SymbolLocationEvent) => void): this;
|
|
55
|
-
once(event: 'symbolCreated', callbackFn: (data: SymbolEvent) => void): this;
|
|
56
|
-
once(event: 'symbolAmended', callbackFn: (data: SymbolEvent) => void): this;
|
|
57
|
-
once(event: 'symbolRemoved', callbackFn: (data: SymbolEvent) => void): this;
|
|
58
|
-
once(event: 'symbolLocationCreated', callbackFn: (data: SymbolLocationEvent) => void): this;
|
|
59
|
-
once(event: 'symbolLocationRemoved', callbackFn: (data: SymbolLocationEvent) => void): this;
|
|
60
|
-
emit(event: 'symbolCreated', data: SymbolEvent): boolean;
|
|
61
|
-
emit(event: 'symbolAmended', data: SymbolEvent): boolean;
|
|
62
|
-
emit(event: 'symbolRemoved', data: SymbolEvent): boolean;
|
|
63
|
-
emit(event: 'symbolLocationCreated', data: SymbolLocationEvent): boolean;
|
|
64
|
-
emit(event: 'symbolLocationRemoved', data: SymbolLocationEvent): boolean;
|
|
65
56
|
/**
|
|
66
57
|
* Build the internal cache of the SymbolUtil according to the current global symbol table.
|
|
67
58
|
*/
|
package/lib/symbol/SymbolUtil.js
CHANGED
|
@@ -5,13 +5,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
8
|
-
import { bigintJsonNumberReplacer, } from '../common/index.js';
|
|
8
|
+
import { bigintJsonNumberReplacer, EventDispatcher } from '../common/index.js';
|
|
9
9
|
import { Range } from '../source/index.js';
|
|
10
10
|
import { SymbolLocation, SymbolPath, SymbolUsageTypes } from './Symbol.js';
|
|
11
|
-
export class SymbolUtil {
|
|
11
|
+
export class SymbolUtil extends EventDispatcher {
|
|
12
12
|
#global;
|
|
13
|
-
#eventEmitter;
|
|
14
|
-
#eventEmitterConstructor;
|
|
15
13
|
#trimmableSymbols = new Set();
|
|
16
14
|
#cache = Object.create(null);
|
|
17
15
|
#currentContributor;
|
|
@@ -26,13 +24,12 @@ export class SymbolUtil {
|
|
|
26
24
|
get global() {
|
|
27
25
|
return this.#global;
|
|
28
26
|
}
|
|
29
|
-
constructor(global,
|
|
27
|
+
constructor(global,
|
|
30
28
|
/** @internal */
|
|
31
29
|
_currentContributor,
|
|
32
30
|
/** @internal */
|
|
33
31
|
_inDelayMode = false) {
|
|
34
|
-
|
|
35
|
-
this.#eventEmitterConstructor = eventEmitterConstructor;
|
|
32
|
+
super();
|
|
36
33
|
this.#global = global;
|
|
37
34
|
this.#currentContributor = _currentContributor;
|
|
38
35
|
this._inDelayMode = _inDelayMode;
|
|
@@ -51,17 +48,6 @@ export class SymbolUtil {
|
|
|
51
48
|
this.#trimmableSymbols.add(path);
|
|
52
49
|
});
|
|
53
50
|
}
|
|
54
|
-
on(event, callbackFn) {
|
|
55
|
-
this.#eventEmitter.on(event, callbackFn);
|
|
56
|
-
return this;
|
|
57
|
-
}
|
|
58
|
-
once(event, callbackFn) {
|
|
59
|
-
this.#eventEmitter.once(event, callbackFn);
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
emit(event, ...args) {
|
|
63
|
-
return this.#eventEmitter.emit(event, ...args);
|
|
64
|
-
}
|
|
65
51
|
/**
|
|
66
52
|
* Build the internal cache of the SymbolUtil according to the current global symbol table.
|
|
67
53
|
*/
|
|
@@ -81,7 +67,7 @@ export class SymbolUtil {
|
|
|
81
67
|
* `applyDelayedEdits` is called, the original SymbolUtil will also be modified.
|
|
82
68
|
*/
|
|
83
69
|
clone() {
|
|
84
|
-
return new SymbolUtil(this.#global, this.#
|
|
70
|
+
return new SymbolUtil(this.#global, this.#currentContributor, true);
|
|
85
71
|
}
|
|
86
72
|
/**
|
|
87
73
|
* Apply edits done during the delay mode.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.47",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"binary-search": "^1.3.6",
|
|
19
19
|
"decompress": "^4.2.1",
|
|
20
20
|
"follow-redirects": "^1.14.8",
|
|
21
|
-
"pako": "^2.0.4",
|
|
22
21
|
"picomatch": "^4.0.2",
|
|
23
22
|
"rfdc": "^1.3.0",
|
|
24
23
|
"vscode-languageserver-textdocument": "^1.0.4",
|
|
@@ -28,10 +27,10 @@
|
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"@types/decompress": "^4.2.3",
|
|
30
29
|
"@types/follow-redirects": "^1.14.1",
|
|
31
|
-
"@types/pako": "^2.0.0",
|
|
32
30
|
"@types/picomatch": "^3.0.1",
|
|
33
31
|
"@types/whatwg-url": "^11.0.4",
|
|
34
|
-
"memfs": "^4.51.1"
|
|
32
|
+
"memfs": "^4.51.1",
|
|
33
|
+
"@jsonjoy.com/fs-node-utils": "^4.57.2"
|
|
35
34
|
},
|
|
36
35
|
"publishConfig": {
|
|
37
36
|
"access": "public"
|