@opentui/core 0.1.88 → 0.1.90
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-dwq2qe5p.js +188 -0
- package/index-dwq2qe5p.js.map +10 -0
- package/{index-nkrr8a4c.js → index-e89anq5x.js} +743 -123
- package/{index-nkrr8a4c.js.map → index-e89anq5x.js.map} +13 -13
- package/{index-nyw5p3ep.js → index-k03avn41.js} +985 -328
- package/{index-nyw5p3ep.js.map → index-k03avn41.js.map} +7 -5
- 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 +7 -7
- package/parser.worker.js +52 -18
- 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-e4hzc2j2.js +0 -113
- package/index-e4hzc2j2.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-k03avn41.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-e89anq5x.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.90",
|
|
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,11 @@
|
|
|
67
67
|
"bun-webgpu": "0.1.5",
|
|
68
68
|
"planck": "^1.4.2",
|
|
69
69
|
"three": "0.177.0",
|
|
70
|
-
"@opentui/core-darwin-x64": "0.1.
|
|
71
|
-
"@opentui/core-darwin-arm64": "0.1.
|
|
72
|
-
"@opentui/core-linux-x64": "0.1.
|
|
73
|
-
"@opentui/core-linux-arm64": "0.1.
|
|
74
|
-
"@opentui/core-win32-x64": "0.1.
|
|
75
|
-
"@opentui/core-win32-arm64": "0.1.
|
|
70
|
+
"@opentui/core-darwin-x64": "0.1.90",
|
|
71
|
+
"@opentui/core-darwin-arm64": "0.1.90",
|
|
72
|
+
"@opentui/core-linux-x64": "0.1.90",
|
|
73
|
+
"@opentui/core-linux-arm64": "0.1.90",
|
|
74
|
+
"@opentui/core-win32-x64": "0.1.90",
|
|
75
|
+
"@opentui/core-win32-arm64": "0.1.90"
|
|
76
76
|
}
|
|
77
77
|
}
|
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;
|
|
@@ -188,7 +189,38 @@ class ParserWorker {
|
|
|
188
189
|
return this.initializePromise;
|
|
189
190
|
}
|
|
190
191
|
addFiletypeParser(filetypeParser) {
|
|
191
|
-
this.filetypeParserOptions.
|
|
192
|
+
const previousAliases = this.filetypeParserOptions.get(filetypeParser.filetype)?.aliases ?? [];
|
|
193
|
+
for (const alias of previousAliases) {
|
|
194
|
+
if (this.filetypeAliases.get(alias) === filetypeParser.filetype) {
|
|
195
|
+
this.filetypeAliases.delete(alias);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const aliases = [...new Set((filetypeParser.aliases ?? []).filter((alias) => alias !== filetypeParser.filetype))];
|
|
199
|
+
this.filetypeAliases.delete(filetypeParser.filetype);
|
|
200
|
+
this.filetypeParserOptions.set(filetypeParser.filetype, {
|
|
201
|
+
...filetypeParser,
|
|
202
|
+
aliases
|
|
203
|
+
});
|
|
204
|
+
for (const alias of aliases) {
|
|
205
|
+
this.filetypeAliases.set(alias, filetypeParser.filetype);
|
|
206
|
+
}
|
|
207
|
+
this.invalidateParserCaches(filetypeParser.filetype);
|
|
208
|
+
}
|
|
209
|
+
resolveCanonicalFiletype(filetype) {
|
|
210
|
+
if (this.filetypeParserOptions.has(filetype)) {
|
|
211
|
+
return filetype;
|
|
212
|
+
}
|
|
213
|
+
return this.filetypeAliases.get(filetype) ?? filetype;
|
|
214
|
+
}
|
|
215
|
+
invalidateParserCaches(filetype) {
|
|
216
|
+
this.filetypeParsers.delete(filetype);
|
|
217
|
+
this.filetypeParserPromises.delete(filetype);
|
|
218
|
+
const reusableParser = this.reusableParsers.get(filetype);
|
|
219
|
+
if (reusableParser) {
|
|
220
|
+
reusableParser.parser.delete();
|
|
221
|
+
this.reusableParsers.delete(filetype);
|
|
222
|
+
}
|
|
223
|
+
this.reusableParserPromises.delete(filetype);
|
|
192
224
|
}
|
|
193
225
|
async createQueries(filetypeParser, language) {
|
|
194
226
|
try {
|
|
@@ -236,22 +268,23 @@ class ParserWorker {
|
|
|
236
268
|
}
|
|
237
269
|
}
|
|
238
270
|
async resolveFiletypeParser(filetype) {
|
|
239
|
-
|
|
240
|
-
|
|
271
|
+
const canonicalFiletype = this.resolveCanonicalFiletype(filetype);
|
|
272
|
+
if (this.filetypeParsers.has(canonicalFiletype)) {
|
|
273
|
+
return this.filetypeParsers.get(canonicalFiletype);
|
|
241
274
|
}
|
|
242
|
-
if (this.filetypeParserPromises.has(
|
|
243
|
-
return this.filetypeParserPromises.get(
|
|
275
|
+
if (this.filetypeParserPromises.has(canonicalFiletype)) {
|
|
276
|
+
return this.filetypeParserPromises.get(canonicalFiletype);
|
|
244
277
|
}
|
|
245
|
-
const loadingPromise = this.loadFiletypeParser(
|
|
246
|
-
this.filetypeParserPromises.set(
|
|
278
|
+
const loadingPromise = this.loadFiletypeParser(canonicalFiletype);
|
|
279
|
+
this.filetypeParserPromises.set(canonicalFiletype, loadingPromise);
|
|
247
280
|
try {
|
|
248
281
|
const result = await loadingPromise;
|
|
249
282
|
if (result) {
|
|
250
|
-
this.filetypeParsers.set(
|
|
283
|
+
this.filetypeParsers.set(canonicalFiletype, result);
|
|
251
284
|
}
|
|
252
285
|
return result;
|
|
253
286
|
} finally {
|
|
254
|
-
this.filetypeParserPromises.delete(
|
|
287
|
+
this.filetypeParserPromises.delete(canonicalFiletype);
|
|
255
288
|
}
|
|
256
289
|
}
|
|
257
290
|
async loadFiletypeParser(filetype) {
|
|
@@ -279,22 +312,23 @@ class ParserWorker {
|
|
|
279
312
|
return this.resolveFiletypeParser(filetype);
|
|
280
313
|
}
|
|
281
314
|
async getReusableParser(filetype) {
|
|
282
|
-
|
|
283
|
-
|
|
315
|
+
const canonicalFiletype = this.resolveCanonicalFiletype(filetype);
|
|
316
|
+
if (this.reusableParsers.has(canonicalFiletype)) {
|
|
317
|
+
return this.reusableParsers.get(canonicalFiletype);
|
|
284
318
|
}
|
|
285
|
-
if (this.reusableParserPromises.has(
|
|
286
|
-
return this.reusableParserPromises.get(
|
|
319
|
+
if (this.reusableParserPromises.has(canonicalFiletype)) {
|
|
320
|
+
return this.reusableParserPromises.get(canonicalFiletype);
|
|
287
321
|
}
|
|
288
|
-
const creationPromise = this.createReusableParser(
|
|
289
|
-
this.reusableParserPromises.set(
|
|
322
|
+
const creationPromise = this.createReusableParser(canonicalFiletype);
|
|
323
|
+
this.reusableParserPromises.set(canonicalFiletype, creationPromise);
|
|
290
324
|
try {
|
|
291
325
|
const result = await creationPromise;
|
|
292
326
|
if (result) {
|
|
293
|
-
this.reusableParsers.set(
|
|
327
|
+
this.reusableParsers.set(canonicalFiletype, result);
|
|
294
328
|
}
|
|
295
329
|
return result;
|
|
296
330
|
} finally {
|
|
297
|
-
this.reusableParserPromises.delete(
|
|
331
|
+
this.reusableParserPromises.delete(canonicalFiletype);
|
|
298
332
|
}
|
|
299
333
|
}
|
|
300
334
|
async createReusableParser(filetype) {
|
|
@@ -858,5 +892,5 @@ if (!isMainThread) {
|
|
|
858
892
|
};
|
|
859
893
|
}
|
|
860
894
|
|
|
861
|
-
//# debugId=
|
|
895
|
+
//# debugId=181702D6D7C45F4964756E2164756E21
|
|
862
896
|
//# sourceMappingURL=parser.worker.js.map
|