@fairyhunter13/opentui-core 0.1.92 → 0.1.95
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/3d.js +1 -1
- package/buffer.d.ts +5 -3
- package/index-qrcns1gt.js +188 -0
- package/index-qrcns1gt.js.map +10 -0
- package/{index-e6ec7apq.js → index-vd9bvmyg.js} +749 -131
- package/{index-e6ec7apq.js.map → index-vd9bvmyg.js.map} +15 -15
- package/{index-h066zmrb.js → index-zvrvapx3.js} +988 -329
- package/{index-h066zmrb.js.map → index-zvrvapx3.js.map} +10 -8
- package/index.d.ts +2 -0
- package/index.js +54 -12
- package/index.js.map +1 -1
- package/lib/stdin-parser.d.ts +10 -0
- package/lib/tree-sitter/default-parsers.d.ts +1 -1
- package/lib/tree-sitter/parsers-config.d.ts +15 -0
- package/lib/tree-sitter/resolve-ft.d.ts +3 -0
- package/lib/tree-sitter/types.d.ts +1 -0
- package/package.json +11 -8
- package/parser.worker.js +74 -45
- package/parser.worker.js.map +3 -3
- package/post/effects.d.ts +147 -0
- package/post/filters.d.ts +27 -67
- package/post/matrices.d.ts +20 -0
- package/renderables/Markdown.d.ts +9 -1
- package/renderer.d.ts +12 -1
- package/runtime-plugin-support.js +3 -3
- package/runtime-plugin.js +3 -3
- package/testing/manual-clock.d.ts +1 -0
- package/testing.js +1 -1
- package/types.d.ts +5 -0
- package/zig.d.ts +3 -1
- package/index-ynzawt3n.js +0 -113
- package/index-ynzawt3n.js.map +0 -10
package/index.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export * from "./text-buffer-view.js";
|
|
|
7
7
|
export * from "./edit-buffer.js";
|
|
8
8
|
export * from "./editor-view.js";
|
|
9
9
|
export * from "./syntax-style.js";
|
|
10
|
+
export * from "./post/effects.js";
|
|
10
11
|
export * from "./post/filters.js";
|
|
12
|
+
export * from "./post/matrices.js";
|
|
11
13
|
export * from "./animation/Timeline.js";
|
|
12
14
|
export * from "./lib/index.js";
|
|
13
15
|
export * from "./renderer.js";
|
package/index.js
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
ACHROMATOPSIA_MATRIX,
|
|
3
4
|
ASCIIFont,
|
|
4
5
|
ASCIIFontRenderable,
|
|
5
6
|
ArrowRenderable,
|
|
6
7
|
BloomEffect,
|
|
7
|
-
BlurEffect,
|
|
8
8
|
Box,
|
|
9
9
|
BoxRenderable,
|
|
10
|
-
|
|
10
|
+
CRTRollingBarEffect,
|
|
11
|
+
CloudsEffect,
|
|
11
12
|
Code,
|
|
12
13
|
CodeRenderable,
|
|
14
|
+
DEUTERANOPIA_COMP_MATRIX,
|
|
15
|
+
DEUTERANOPIA_SIM_MATRIX,
|
|
13
16
|
DiffRenderable,
|
|
14
17
|
DistortionEffect,
|
|
15
18
|
EditBuffer,
|
|
16
19
|
EditorView,
|
|
20
|
+
FlamesEffect,
|
|
17
21
|
FrameBuffer,
|
|
18
22
|
FrameBufferRenderable,
|
|
23
|
+
GRAYSCALE_MATRIX,
|
|
24
|
+
GREENSCALE_MATRIX,
|
|
19
25
|
Generic,
|
|
26
|
+
INVERT_MATRIX,
|
|
20
27
|
Input,
|
|
21
28
|
InputRenderable,
|
|
22
29
|
InputRenderableEvents,
|
|
23
30
|
LineNumberRenderable,
|
|
24
31
|
MarkdownRenderable,
|
|
25
32
|
NativeSpanFeed,
|
|
33
|
+
PROTANOPIA_COMP_MATRIX,
|
|
34
|
+
PROTANOPIA_SIM_MATRIX,
|
|
35
|
+
RainbowTextEffect,
|
|
26
36
|
RootTextNodeRenderable,
|
|
37
|
+
SEPIA_MATRIX,
|
|
38
|
+
SOLARIZATION_MATRIX,
|
|
39
|
+
SYNTHWAVE_MATRIX,
|
|
27
40
|
ScrollBarRenderable,
|
|
28
41
|
ScrollBox,
|
|
29
42
|
ScrollBoxRenderable,
|
|
@@ -34,6 +47,9 @@ import {
|
|
|
34
47
|
SlotRegistry,
|
|
35
48
|
SlotRenderable,
|
|
36
49
|
SyntaxStyle,
|
|
50
|
+
TECHNICOLOR_MATRIX,
|
|
51
|
+
TRITANOPIA_COMP_MATRIX,
|
|
52
|
+
TRITANOPIA_SIM_MATRIX,
|
|
37
53
|
TabSelect,
|
|
38
54
|
TabSelectRenderable,
|
|
39
55
|
TabSelectRenderableEvents,
|
|
@@ -49,12 +65,13 @@ import {
|
|
|
49
65
|
VRenderable,
|
|
50
66
|
VignetteEffect,
|
|
51
67
|
applyAsciiArt,
|
|
68
|
+
applyBrightness,
|
|
52
69
|
applyChromaticAberration,
|
|
53
|
-
|
|
70
|
+
applyGain,
|
|
54
71
|
applyInvert,
|
|
55
72
|
applyNoise,
|
|
73
|
+
applySaturation,
|
|
56
74
|
applyScanlines,
|
|
57
|
-
applySepia,
|
|
58
75
|
convertThemeToStyles,
|
|
59
76
|
createCoreSlotRegistry,
|
|
60
77
|
createSlotRegistry,
|
|
@@ -64,7 +81,7 @@ import {
|
|
|
64
81
|
registerCorePlugin,
|
|
65
82
|
resolveCoreSlot,
|
|
66
83
|
vstyles
|
|
67
|
-
} from "./index-
|
|
84
|
+
} from "./index-zvrvapx3.js";
|
|
68
85
|
import {
|
|
69
86
|
ASCIIFontSelectionHelper,
|
|
70
87
|
ATTRIBUTE_BASE_BITS,
|
|
@@ -99,6 +116,7 @@ import {
|
|
|
99
116
|
StdinParser,
|
|
100
117
|
StyledText,
|
|
101
118
|
SystemClock,
|
|
119
|
+
TargetChannel,
|
|
102
120
|
TerminalConsole,
|
|
103
121
|
TerminalPalette,
|
|
104
122
|
TextAttributes,
|
|
@@ -106,6 +124,7 @@ import {
|
|
|
106
124
|
TreeSitterClient,
|
|
107
125
|
addDefaultParsers,
|
|
108
126
|
attributesWithLink,
|
|
127
|
+
basenameToFiletype,
|
|
109
128
|
bg,
|
|
110
129
|
bgBlack,
|
|
111
130
|
bgBlue,
|
|
@@ -146,6 +165,7 @@ import {
|
|
|
146
165
|
envRegistry,
|
|
147
166
|
exports_src,
|
|
148
167
|
extToFiletype,
|
|
168
|
+
extensionToFiletype,
|
|
149
169
|
fg,
|
|
150
170
|
fonts,
|
|
151
171
|
generateEnvColored,
|
|
@@ -162,6 +182,7 @@ import {
|
|
|
162
182
|
hastToStyledText,
|
|
163
183
|
hexToRgb,
|
|
164
184
|
hsvToRgb,
|
|
185
|
+
infoStringToFiletype,
|
|
165
186
|
instantiate,
|
|
166
187
|
isRenderable,
|
|
167
188
|
isStyledText,
|
|
@@ -212,7 +233,7 @@ import {
|
|
|
212
233
|
white,
|
|
213
234
|
wrapWithDelegates,
|
|
214
235
|
yellow
|
|
215
|
-
} from "./index-
|
|
236
|
+
} from "./index-vd9bvmyg.js";
|
|
216
237
|
export {
|
|
217
238
|
yellow,
|
|
218
239
|
wrapWithDelegates,
|
|
@@ -268,6 +289,7 @@ export {
|
|
|
268
289
|
isStyledText,
|
|
269
290
|
isRenderable,
|
|
270
291
|
instantiate,
|
|
292
|
+
infoStringToFiletype,
|
|
271
293
|
hsvToRgb,
|
|
272
294
|
hexToRgb,
|
|
273
295
|
hastToStyledText,
|
|
@@ -284,6 +306,7 @@ export {
|
|
|
284
306
|
generateEnvColored,
|
|
285
307
|
fonts,
|
|
286
308
|
fg,
|
|
309
|
+
extensionToFiletype,
|
|
287
310
|
extToFiletype,
|
|
288
311
|
envRegistry,
|
|
289
312
|
env,
|
|
@@ -328,13 +351,15 @@ export {
|
|
|
328
351
|
bgBlue,
|
|
329
352
|
bgBlack,
|
|
330
353
|
bg,
|
|
354
|
+
basenameToFiletype,
|
|
331
355
|
attributesWithLink,
|
|
332
|
-
applySepia,
|
|
333
356
|
applyScanlines,
|
|
357
|
+
applySaturation,
|
|
334
358
|
applyNoise,
|
|
335
359
|
applyInvert,
|
|
336
|
-
|
|
360
|
+
applyGain,
|
|
337
361
|
applyChromaticAberration,
|
|
362
|
+
applyBrightness,
|
|
338
363
|
applyAsciiArt,
|
|
339
364
|
addDefaultParsers,
|
|
340
365
|
exports_src as Yoga,
|
|
@@ -354,9 +379,13 @@ export {
|
|
|
354
379
|
Text,
|
|
355
380
|
TerminalPalette,
|
|
356
381
|
TerminalConsole,
|
|
382
|
+
TargetChannel,
|
|
357
383
|
TabSelectRenderableEvents,
|
|
358
384
|
TabSelectRenderable,
|
|
359
385
|
TabSelect,
|
|
386
|
+
TRITANOPIA_SIM_MATRIX,
|
|
387
|
+
TRITANOPIA_COMP_MATRIX,
|
|
388
|
+
TECHNICOLOR_MATRIX,
|
|
360
389
|
SystemClock,
|
|
361
390
|
SyntaxStyle,
|
|
362
391
|
StyledText,
|
|
@@ -371,13 +400,19 @@ export {
|
|
|
371
400
|
ScrollBoxRenderable,
|
|
372
401
|
ScrollBox,
|
|
373
402
|
ScrollBarRenderable,
|
|
403
|
+
SYNTHWAVE_MATRIX,
|
|
404
|
+
SOLARIZATION_MATRIX,
|
|
405
|
+
SEPIA_MATRIX,
|
|
374
406
|
RootTextNodeRenderable,
|
|
375
407
|
RootRenderable,
|
|
376
408
|
RendererControlState,
|
|
377
409
|
RenderableEvents,
|
|
378
410
|
Renderable,
|
|
411
|
+
RainbowTextEffect,
|
|
379
412
|
RGBA,
|
|
380
413
|
PasteEvent,
|
|
414
|
+
PROTANOPIA_SIM_MATRIX,
|
|
415
|
+
PROTANOPIA_COMP_MATRIX,
|
|
381
416
|
OptimizedBuffer,
|
|
382
417
|
NativeSpanFeed,
|
|
383
418
|
MouseParser,
|
|
@@ -395,9 +430,13 @@ export {
|
|
|
395
430
|
InputRenderableEvents,
|
|
396
431
|
InputRenderable,
|
|
397
432
|
Input,
|
|
433
|
+
INVERT_MATRIX,
|
|
398
434
|
Generic,
|
|
435
|
+
GREENSCALE_MATRIX,
|
|
436
|
+
GRAYSCALE_MATRIX,
|
|
399
437
|
FrameBufferRenderable,
|
|
400
438
|
FrameBuffer,
|
|
439
|
+
FlamesEffect,
|
|
401
440
|
ExtmarksController,
|
|
402
441
|
EditorView,
|
|
403
442
|
EditBuffer,
|
|
@@ -405,17 +444,19 @@ export {
|
|
|
405
444
|
DiffRenderable,
|
|
406
445
|
DebugOverlayCorner,
|
|
407
446
|
DataPathsManager,
|
|
447
|
+
DEUTERANOPIA_SIM_MATRIX,
|
|
448
|
+
DEUTERANOPIA_COMP_MATRIX,
|
|
408
449
|
ConsolePosition,
|
|
409
450
|
CodeRenderable,
|
|
410
451
|
Code,
|
|
452
|
+
CloudsEffect,
|
|
411
453
|
CliRenderer,
|
|
412
454
|
CliRenderEvents,
|
|
413
|
-
|
|
455
|
+
CRTRollingBarEffect,
|
|
414
456
|
BoxRenderable,
|
|
415
457
|
Box,
|
|
416
458
|
BorderChars,
|
|
417
459
|
BorderCharArrays,
|
|
418
|
-
BlurEffect,
|
|
419
460
|
BloomEffect,
|
|
420
461
|
BaseRenderable,
|
|
421
462
|
ArrowRenderable,
|
|
@@ -423,8 +464,9 @@ export {
|
|
|
423
464
|
ATTRIBUTE_BASE_BITS,
|
|
424
465
|
ASCIIFontSelectionHelper,
|
|
425
466
|
ASCIIFontRenderable,
|
|
426
|
-
ASCIIFont
|
|
467
|
+
ASCIIFont,
|
|
468
|
+
ACHROMATOPSIA_MATRIX
|
|
427
469
|
};
|
|
428
470
|
|
|
429
|
-
//# debugId=
|
|
471
|
+
//# debugId=1F6303440EC65EA264756E2164756E21
|
|
430
472
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
package/lib/stdin-parser.d.ts
CHANGED
|
@@ -22,12 +22,19 @@ export type StdinEvent = {
|
|
|
22
22
|
protocol: StdinResponseProtocol;
|
|
23
23
|
sequence: string;
|
|
24
24
|
};
|
|
25
|
+
export interface StdinParserProtocolContext {
|
|
26
|
+
kittyKeyboardEnabled: boolean;
|
|
27
|
+
privateCapabilityRepliesActive: boolean;
|
|
28
|
+
pixelResolutionQueryActive: boolean;
|
|
29
|
+
explicitWidthCprActive: boolean;
|
|
30
|
+
}
|
|
25
31
|
export interface StdinParserOptions {
|
|
26
32
|
timeoutMs?: number;
|
|
27
33
|
maxPendingBytes?: number;
|
|
28
34
|
armTimeouts?: boolean;
|
|
29
35
|
onTimeoutFlush?: () => void;
|
|
30
36
|
useKittyKeyboard?: boolean;
|
|
37
|
+
protocolContext?: Partial<StdinParserProtocolContext>;
|
|
31
38
|
clock?: Clock;
|
|
32
39
|
}
|
|
33
40
|
export declare class StdinParser {
|
|
@@ -40,6 +47,7 @@ export declare class StdinParser {
|
|
|
40
47
|
private readonly useKittyKeyboard;
|
|
41
48
|
private readonly mouseParser;
|
|
42
49
|
private readonly clock;
|
|
50
|
+
private protocolContext;
|
|
43
51
|
private timeoutId;
|
|
44
52
|
private destroyed;
|
|
45
53
|
private pendingSinceMs;
|
|
@@ -51,6 +59,7 @@ export declare class StdinParser {
|
|
|
51
59
|
private paste;
|
|
52
60
|
constructor(options?: StdinParserOptions);
|
|
53
61
|
get bufferCapacity(): number;
|
|
62
|
+
updateProtocolContext(patch: Partial<StdinParserProtocolContext>): void;
|
|
54
63
|
push(data: Uint8Array): void;
|
|
55
64
|
read(): StdinEvent | null;
|
|
56
65
|
drain(onEvent: (event: StdinEvent) => void): void;
|
|
@@ -70,6 +79,7 @@ export declare class StdinParser {
|
|
|
70
79
|
private markPending;
|
|
71
80
|
private consumePasteBytes;
|
|
72
81
|
private pushPasteBytes;
|
|
82
|
+
private reconcileDeferredStateWithProtocolContext;
|
|
73
83
|
private reconcileTimeoutState;
|
|
74
84
|
private clearTimeout;
|
|
75
85
|
private resetState;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { FiletypeParserOptions } from "./types
|
|
1
|
+
import type { FiletypeParserOptions } from "./types";
|
|
2
2
|
export declare function getParsers(): FiletypeParserOptions[];
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
declare const _default: {
|
|
7
7
|
parsers: ({
|
|
8
8
|
filetype: string;
|
|
9
|
+
aliases: string[];
|
|
9
10
|
wasm: string;
|
|
10
11
|
queries: {
|
|
11
12
|
highlights: string[];
|
|
@@ -27,12 +28,26 @@ declare const _default: {
|
|
|
27
28
|
infoStringMap: {
|
|
28
29
|
javascript: string;
|
|
29
30
|
js: string;
|
|
31
|
+
jsx: string;
|
|
32
|
+
javascriptreact: string;
|
|
30
33
|
typescript: string;
|
|
31
34
|
ts: string;
|
|
35
|
+
tsx: string;
|
|
36
|
+
typescriptreact: string;
|
|
32
37
|
markdown: string;
|
|
33
38
|
md: string;
|
|
34
39
|
};
|
|
35
40
|
};
|
|
41
|
+
aliases?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
filetype: string;
|
|
44
|
+
wasm: string;
|
|
45
|
+
queries: {
|
|
46
|
+
highlights: string[];
|
|
47
|
+
injections?: undefined;
|
|
48
|
+
};
|
|
49
|
+
aliases?: undefined;
|
|
50
|
+
injectionMapping?: undefined;
|
|
36
51
|
})[];
|
|
37
52
|
};
|
|
38
53
|
export default _default;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
export declare const extensionToFiletype: Map<string, string>;
|
|
2
|
+
export declare const basenameToFiletype: Map<string, string>;
|
|
1
3
|
export declare function extToFiletype(extension: string): string | undefined;
|
|
2
4
|
export declare function pathToFiletype(path: string): string | undefined;
|
|
5
|
+
export declare function infoStringToFiletype(infoString: string): string | undefined;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.95",
|
|
8
8
|
"description": "OpenTUI is a TypeScript library on a native Zig core for building terminal user interfaces (TUIs)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -67,11 +67,14 @@
|
|
|
67
67
|
"bun-webgpu": "0.1.5",
|
|
68
68
|
"planck": "^1.4.2",
|
|
69
69
|
"three": "0.177.0",
|
|
70
|
-
"@fairyhunter13/opentui-core-darwin-x64": "0.1.
|
|
71
|
-
"@fairyhunter13/opentui-core-darwin-arm64": "0.1.
|
|
72
|
-
"@fairyhunter13/opentui-core-linux-x64": "0.1.
|
|
73
|
-
"@fairyhunter13/opentui-core-linux-arm64": "0.1.
|
|
74
|
-
"@fairyhunter13/opentui-core-win32-x64": "0.1.
|
|
75
|
-
"@fairyhunter13/opentui-core-win32-arm64": "0.1.
|
|
70
|
+
"@fairyhunter13/opentui-core-darwin-x64": "0.1.95",
|
|
71
|
+
"@fairyhunter13/opentui-core-darwin-arm64": "0.1.95",
|
|
72
|
+
"@fairyhunter13/opentui-core-linux-x64": "0.1.95",
|
|
73
|
+
"@fairyhunter13/opentui-core-linux-arm64": "0.1.95",
|
|
74
|
+
"@fairyhunter13/opentui-core-win32-x64": "0.1.95",
|
|
75
|
+
"@fairyhunter13/opentui-core-win32-arm64": "0.1.95"
|
|
76
|
+
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public"
|
|
76
79
|
}
|
|
77
|
-
}
|
|
80
|
+
}
|
package/parser.worker.js
CHANGED
|
@@ -135,6 +135,7 @@ var self = globalThis;
|
|
|
135
135
|
class ParserWorker {
|
|
136
136
|
bufferParsers = new Map;
|
|
137
137
|
filetypeParserOptions = new Map;
|
|
138
|
+
filetypeAliases = new Map;
|
|
138
139
|
filetypeParsers = new Map;
|
|
139
140
|
filetypeParserPromises = new Map;
|
|
140
141
|
reusableParsers = new Map;
|
|
@@ -162,40 +163,66 @@ class ParserWorker {
|
|
|
162
163
|
if (this.initializePromise) {
|
|
163
164
|
return this.initializePromise;
|
|
164
165
|
}
|
|
165
|
-
this.initializePromise =
|
|
166
|
+
this.initializePromise = (async () => {
|
|
166
167
|
this.dataPath = dataPath;
|
|
167
168
|
this.tsDataPath = path2.join(dataPath, "tree-sitter");
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
treeWasm = normalizeBunfsPath(path2.parse(treeWasm).base);
|
|
183
|
-
}
|
|
184
|
-
await TreeSitter.Parser.init({
|
|
185
|
-
locateFile() {
|
|
186
|
-
return treeWasm;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
this.initialized = true;
|
|
190
|
-
resolve();
|
|
191
|
-
} catch (error) {
|
|
192
|
-
reject(error);
|
|
169
|
+
await mkdir2(path2.join(this.tsDataPath, "languages"), { recursive: true });
|
|
170
|
+
await mkdir2(path2.join(this.tsDataPath, "queries"), { recursive: true });
|
|
171
|
+
const mod = await import("web-tree-sitter");
|
|
172
|
+
const P = mod.default ?? mod;
|
|
173
|
+
TreeSitter = {
|
|
174
|
+
Parser: P,
|
|
175
|
+
Query: P.Query,
|
|
176
|
+
Language: P.Language
|
|
177
|
+
};
|
|
178
|
+
let { default: treeWasm } = await import("web-tree-sitter/tree-sitter.wasm", {
|
|
179
|
+
with: { type: "wasm" }
|
|
180
|
+
});
|
|
181
|
+
if (isBunfsPath(treeWasm)) {
|
|
182
|
+
treeWasm = normalizeBunfsPath(path2.parse(treeWasm).base);
|
|
193
183
|
}
|
|
194
|
-
|
|
184
|
+
await TreeSitter.Parser.init({
|
|
185
|
+
locateFile() {
|
|
186
|
+
return treeWasm;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
this.initialized = true;
|
|
190
|
+
})();
|
|
195
191
|
return this.initializePromise;
|
|
196
192
|
}
|
|
197
193
|
addFiletypeParser(filetypeParser) {
|
|
198
|
-
this.filetypeParserOptions.
|
|
194
|
+
const previousAliases = this.filetypeParserOptions.get(filetypeParser.filetype)?.aliases ?? [];
|
|
195
|
+
for (const alias of previousAliases) {
|
|
196
|
+
if (this.filetypeAliases.get(alias) === filetypeParser.filetype) {
|
|
197
|
+
this.filetypeAliases.delete(alias);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const aliases = [...new Set((filetypeParser.aliases ?? []).filter((alias) => alias !== filetypeParser.filetype))];
|
|
201
|
+
this.filetypeAliases.delete(filetypeParser.filetype);
|
|
202
|
+
this.filetypeParserOptions.set(filetypeParser.filetype, {
|
|
203
|
+
...filetypeParser,
|
|
204
|
+
aliases
|
|
205
|
+
});
|
|
206
|
+
for (const alias of aliases) {
|
|
207
|
+
this.filetypeAliases.set(alias, filetypeParser.filetype);
|
|
208
|
+
}
|
|
209
|
+
this.invalidateParserCaches(filetypeParser.filetype);
|
|
210
|
+
}
|
|
211
|
+
resolveCanonicalFiletype(filetype) {
|
|
212
|
+
if (this.filetypeParserOptions.has(filetype)) {
|
|
213
|
+
return filetype;
|
|
214
|
+
}
|
|
215
|
+
return this.filetypeAliases.get(filetype) ?? filetype;
|
|
216
|
+
}
|
|
217
|
+
invalidateParserCaches(filetype) {
|
|
218
|
+
this.filetypeParsers.delete(filetype);
|
|
219
|
+
this.filetypeParserPromises.delete(filetype);
|
|
220
|
+
const reusableParser = this.reusableParsers.get(filetype);
|
|
221
|
+
if (reusableParser) {
|
|
222
|
+
reusableParser.parser.delete();
|
|
223
|
+
this.reusableParsers.delete(filetype);
|
|
224
|
+
}
|
|
225
|
+
this.reusableParserPromises.delete(filetype);
|
|
199
226
|
}
|
|
200
227
|
async createQueries(filetypeParser, language) {
|
|
201
228
|
try {
|
|
@@ -243,22 +270,23 @@ class ParserWorker {
|
|
|
243
270
|
}
|
|
244
271
|
}
|
|
245
272
|
async resolveFiletypeParser(filetype) {
|
|
246
|
-
|
|
247
|
-
|
|
273
|
+
const canonicalFiletype = this.resolveCanonicalFiletype(filetype);
|
|
274
|
+
if (this.filetypeParsers.has(canonicalFiletype)) {
|
|
275
|
+
return this.filetypeParsers.get(canonicalFiletype);
|
|
248
276
|
}
|
|
249
|
-
if (this.filetypeParserPromises.has(
|
|
250
|
-
return this.filetypeParserPromises.get(
|
|
277
|
+
if (this.filetypeParserPromises.has(canonicalFiletype)) {
|
|
278
|
+
return this.filetypeParserPromises.get(canonicalFiletype);
|
|
251
279
|
}
|
|
252
|
-
const loadingPromise = this.loadFiletypeParser(
|
|
253
|
-
this.filetypeParserPromises.set(
|
|
280
|
+
const loadingPromise = this.loadFiletypeParser(canonicalFiletype);
|
|
281
|
+
this.filetypeParserPromises.set(canonicalFiletype, loadingPromise);
|
|
254
282
|
try {
|
|
255
283
|
const result = await loadingPromise;
|
|
256
284
|
if (result) {
|
|
257
|
-
this.filetypeParsers.set(
|
|
285
|
+
this.filetypeParsers.set(canonicalFiletype, result);
|
|
258
286
|
}
|
|
259
287
|
return result;
|
|
260
288
|
} finally {
|
|
261
|
-
this.filetypeParserPromises.delete(
|
|
289
|
+
this.filetypeParserPromises.delete(canonicalFiletype);
|
|
262
290
|
}
|
|
263
291
|
}
|
|
264
292
|
async loadFiletypeParser(filetype) {
|
|
@@ -286,22 +314,23 @@ class ParserWorker {
|
|
|
286
314
|
return this.resolveFiletypeParser(filetype);
|
|
287
315
|
}
|
|
288
316
|
async getReusableParser(filetype) {
|
|
289
|
-
|
|
290
|
-
|
|
317
|
+
const canonicalFiletype = this.resolveCanonicalFiletype(filetype);
|
|
318
|
+
if (this.reusableParsers.has(canonicalFiletype)) {
|
|
319
|
+
return this.reusableParsers.get(canonicalFiletype);
|
|
291
320
|
}
|
|
292
|
-
if (this.reusableParserPromises.has(
|
|
293
|
-
return this.reusableParserPromises.get(
|
|
321
|
+
if (this.reusableParserPromises.has(canonicalFiletype)) {
|
|
322
|
+
return this.reusableParserPromises.get(canonicalFiletype);
|
|
294
323
|
}
|
|
295
|
-
const creationPromise = this.createReusableParser(
|
|
296
|
-
this.reusableParserPromises.set(
|
|
324
|
+
const creationPromise = this.createReusableParser(canonicalFiletype);
|
|
325
|
+
this.reusableParserPromises.set(canonicalFiletype, creationPromise);
|
|
297
326
|
try {
|
|
298
327
|
const result = await creationPromise;
|
|
299
328
|
if (result) {
|
|
300
|
-
this.reusableParsers.set(
|
|
329
|
+
this.reusableParsers.set(canonicalFiletype, result);
|
|
301
330
|
}
|
|
302
331
|
return result;
|
|
303
332
|
} finally {
|
|
304
|
-
this.reusableParserPromises.delete(
|
|
333
|
+
this.reusableParserPromises.delete(canonicalFiletype);
|
|
305
334
|
}
|
|
306
335
|
}
|
|
307
336
|
async createReusableParser(filetype) {
|
|
@@ -865,5 +894,5 @@ if (!isMainThread) {
|
|
|
865
894
|
};
|
|
866
895
|
}
|
|
867
896
|
|
|
868
|
-
//# debugId=
|
|
897
|
+
//# debugId=C11AEA1179DE9B8764756E2164756E21
|
|
869
898
|
//# sourceMappingURL=parser.worker.js.map
|