@opentui/core 0.1.87 → 0.1.89

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 (107) hide show
  1. package/3d/ThreeRenderable.d.ts +4 -4
  2. package/3d/WGPURenderer.d.ts +4 -4
  3. package/3d/animation/ExplodingSpriteEffect.d.ts +2 -2
  4. package/3d/animation/PhysicsExplodingSpriteEffect.d.ts +3 -3
  5. package/3d/animation/SpriteAnimator.d.ts +1 -1
  6. package/3d/animation/SpriteParticleGenerator.d.ts +1 -1
  7. package/3d/canvas.d.ts +2 -2
  8. package/3d/index.d.ts +12 -12
  9. package/3d/physics/PlanckPhysicsAdapter.d.ts +1 -1
  10. package/3d/physics/RapierPhysicsAdapter.d.ts +1 -1
  11. package/3d.d.ts +1 -1
  12. package/3d.js +1 -1
  13. package/3d.js.map +12 -12
  14. package/Renderable.d.ts +7 -7
  15. package/animation/Timeline.d.ts +1 -1
  16. package/buffer.d.ts +6 -4
  17. package/console.d.ts +7 -4
  18. package/edit-buffer.d.ts +4 -4
  19. package/editor-view.d.ts +3 -3
  20. package/{index-0wbvecnk.js → index-e89anq5x.js} +864 -175
  21. package/index-e89anq5x.js.map +64 -0
  22. package/index-rs5zwr4j.js +12373 -0
  23. package/index-rs5zwr4j.js.map +43 -0
  24. package/index-tae5jwnc.js +188 -0
  25. package/index-tae5jwnc.js.map +10 -0
  26. package/index.d.ts +20 -17
  27. package/index.js +86 -11596
  28. package/index.js.map +3 -35
  29. package/lib/KeyHandler.d.ts +7 -4
  30. package/lib/ascii.font.d.ts +2 -2
  31. package/lib/border.d.ts +1 -1
  32. package/lib/clipboard.d.ts +1 -1
  33. package/lib/clock.d.ts +4 -0
  34. package/lib/extmarks-history.d.ts +1 -1
  35. package/lib/extmarks.d.ts +2 -2
  36. package/lib/hast-styled-text.d.ts +3 -3
  37. package/lib/index.d.ts +21 -20
  38. package/lib/objects-in-viewport.d.ts +1 -1
  39. package/lib/parse.keypress-kitty.d.ts +1 -1
  40. package/lib/paste.d.ts +7 -0
  41. package/lib/renderable.validations.d.ts +2 -2
  42. package/lib/selection.d.ts +2 -2
  43. package/lib/stdin-parser.d.ts +14 -2
  44. package/lib/styled-text.d.ts +2 -2
  45. package/lib/terminal-palette.d.ts +4 -2
  46. package/lib/tree-sitter/client.d.ts +1 -1
  47. package/lib/tree-sitter/index.d.ts +7 -7
  48. package/lib/tree-sitter/parsers-config.d.ts +15 -0
  49. package/lib/tree-sitter/resolve-ft.d.ts +3 -0
  50. package/lib/tree-sitter/types.d.ts +1 -0
  51. package/lib/tree-sitter-styled-text.d.ts +5 -5
  52. package/package.json +17 -7
  53. package/parser.worker.js +52 -18
  54. package/parser.worker.js.map +3 -3
  55. package/plugins/core-slot.d.ts +72 -0
  56. package/plugins/registry.d.ts +38 -0
  57. package/plugins/types.d.ts +34 -0
  58. package/post/effects.d.ts +147 -0
  59. package/post/filters.d.ts +28 -68
  60. package/post/matrices.d.ts +20 -0
  61. package/renderables/ASCIIFont.d.ts +6 -6
  62. package/renderables/Box.d.ts +5 -5
  63. package/renderables/Code.d.ts +10 -8
  64. package/renderables/Diff.d.ts +7 -7
  65. package/renderables/EditBufferRenderable.d.ts +8 -8
  66. package/renderables/FrameBuffer.d.ts +3 -3
  67. package/renderables/Input.d.ts +3 -3
  68. package/renderables/LineNumberRenderable.d.ts +4 -4
  69. package/renderables/Markdown.d.ts +17 -9
  70. package/renderables/ScrollBar.d.ts +6 -6
  71. package/renderables/ScrollBox.d.ts +9 -8
  72. package/renderables/Select.d.ts +7 -7
  73. package/renderables/Slider.d.ts +1 -1
  74. package/renderables/TabSelect.d.ts +6 -6
  75. package/renderables/Text.d.ts +7 -7
  76. package/renderables/TextBufferRenderable.d.ts +9 -9
  77. package/renderables/TextNode.d.ts +6 -6
  78. package/renderables/Textarea.d.ts +7 -7
  79. package/renderables/__tests__/renderable-test-utils.d.ts +8 -3
  80. package/renderables/composition/VRenderable.d.ts +3 -3
  81. package/renderables/composition/constructs.d.ts +14 -14
  82. package/renderables/composition/vnode.d.ts +2 -2
  83. package/renderables/index.d.ts +22 -22
  84. package/renderer.d.ts +28 -16
  85. package/runtime-plugin-support.d.ts +3 -0
  86. package/runtime-plugin-support.js +29 -0
  87. package/runtime-plugin-support.js.map +10 -0
  88. package/runtime-plugin.d.ts +11 -0
  89. package/runtime-plugin.js +16 -0
  90. package/runtime-plugin.js.map +9 -0
  91. package/syntax-style.d.ts +2 -2
  92. package/testing/manual-clock.d.ts +1 -0
  93. package/testing/mock-keys.d.ts +2 -1
  94. package/testing/mock-mouse.d.ts +1 -1
  95. package/testing/mock-tree-sitter-client.d.ts +2 -2
  96. package/testing/test-recorder.d.ts +1 -1
  97. package/testing/test-renderer.d.ts +4 -4
  98. package/testing.d.ts +6 -6
  99. package/testing.js +12 -7
  100. package/testing.js.map +7 -7
  101. package/text-buffer-view.d.ts +3 -3
  102. package/text-buffer.d.ts +5 -5
  103. package/types.d.ts +9 -4
  104. package/utils.d.ts +1 -1
  105. package/zig-structs.d.ts +1 -1
  106. package/zig.d.ts +7 -5
  107. package/index-0wbvecnk.js.map +0 -63
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter } from "events";
2
- import { type KeyEventType, type ParsedKey } from "./parse.keypress";
2
+ import { type KeyEventType, type ParsedKey } from "./parse.keypress.js";
3
+ import type { PasteMetadata } from "./paste.js";
3
4
  export declare class KeyEvent implements ParsedKey {
4
5
  name: string;
5
6
  ctrl: boolean;
@@ -27,10 +28,12 @@ export declare class KeyEvent implements ParsedKey {
27
28
  stopPropagation(): void;
28
29
  }
29
30
  export declare class PasteEvent {
30
- text: string;
31
+ type: "paste";
32
+ bytes: Uint8Array;
33
+ metadata?: PasteMetadata;
31
34
  private _defaultPrevented;
32
35
  private _propagationStopped;
33
- constructor(text: string);
36
+ constructor(bytes: Uint8Array, metadata?: PasteMetadata);
34
37
  get defaultPrevented(): boolean;
35
38
  get propagationStopped(): boolean;
36
39
  preventDefault(): void;
@@ -43,7 +46,7 @@ export type KeyHandlerEventMap = {
43
46
  };
44
47
  export declare class KeyHandler extends EventEmitter<KeyHandlerEventMap> {
45
48
  processParsedKey(parsedKey: ParsedKey): boolean;
46
- processPaste(data: string): void;
49
+ processPaste(bytes: Uint8Array, metadata?: PasteMetadata): void;
47
50
  }
48
51
  /**
49
52
  * This class is used internally by the renderer to ensure global handlers
@@ -1,5 +1,5 @@
1
- import { OptimizedBuffer } from "../buffer";
2
- import { type ColorInput } from "./RGBA";
1
+ import { OptimizedBuffer } from "../buffer.js";
2
+ import { type ColorInput } from "./RGBA.js";
3
3
  export type ASCIIFontName = "tiny" | "block" | "shade" | "slick" | "huge" | "grid" | "pallet";
4
4
  export declare const fonts: {
5
5
  tiny: {
package/lib/border.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ColorInput } from "./RGBA";
1
+ import type { ColorInput } from "./RGBA.js";
2
2
  export interface BorderCharacters {
3
3
  topLeft: string;
4
4
  topRight: string;
@@ -1,5 +1,5 @@
1
1
  import type { Pointer } from "bun:ffi";
2
- import type { RenderLib } from "../zig";
2
+ import type { RenderLib } from "../zig.js";
3
3
  export declare enum ClipboardTarget {
4
4
  Clipboard = 0,
5
5
  Primary = 1,
package/lib/clock.d.ts CHANGED
@@ -3,9 +3,13 @@ export interface Clock {
3
3
  now(): number;
4
4
  setTimeout(fn: () => void, delayMs: number): TimerHandle;
5
5
  clearTimeout(handle: TimerHandle): void;
6
+ setInterval(fn: () => void, delayMs: number): TimerHandle;
7
+ clearInterval(handle: TimerHandle): void;
6
8
  }
7
9
  export declare class SystemClock implements Clock {
8
10
  now(): number;
9
11
  setTimeout(fn: () => void, delayMs: number): TimerHandle;
10
12
  clearTimeout(handle: TimerHandle): void;
13
+ setInterval(fn: () => void, delayMs: number): TimerHandle;
14
+ clearInterval(handle: TimerHandle): void;
11
15
  }
@@ -1,4 +1,4 @@
1
- import type { Extmark } from "./extmarks";
1
+ import type { Extmark } from "./extmarks.js";
2
2
  export interface ExtmarksSnapshot {
3
3
  extmarks: Map<number, Extmark>;
4
4
  nextId: number;
package/lib/extmarks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { EditBuffer } from "../edit-buffer";
2
- import type { EditorView } from "../editor-view";
1
+ import type { EditBuffer } from "../edit-buffer.js";
2
+ import type { EditorView } from "../editor-view.js";
3
3
  export interface Extmark {
4
4
  id: number;
5
5
  start: number;
@@ -1,5 +1,5 @@
1
- import { StyledText } from "./styled-text";
2
- import { SyntaxStyle } from "../syntax-style";
1
+ import { StyledText } from "./styled-text.js";
2
+ import { SyntaxStyle } from "../syntax-style.js";
3
3
  export interface HASTText {
4
4
  type: "text";
5
5
  value: string;
@@ -13,5 +13,5 @@ export interface HASTElement {
13
13
  children: HASTNode[];
14
14
  }
15
15
  export type HASTNode = HASTText | HASTElement;
16
- export type { StyleDefinition } from "../syntax-style";
16
+ export type { StyleDefinition } from "../syntax-style.js";
17
17
  export declare function hastToStyledText(hast: HASTNode, syntaxStyle: SyntaxStyle): StyledText;
package/lib/index.d.ts CHANGED
@@ -1,20 +1,21 @@
1
- export * from "./border";
2
- export * from "./KeyHandler";
3
- export * from "./ascii.font";
4
- export * from "./hast-styled-text";
5
- export * from "./RGBA";
6
- export * from "./clock";
7
- export * from "./parse.keypress";
8
- export * from "./scroll-acceleration";
9
- export * from "./styled-text";
10
- export * from "./yoga.options";
11
- export * from "./parse.mouse";
12
- export * from "./selection";
13
- export * from "./env";
14
- export * from "./stdin-parser";
15
- export * from "./tree-sitter-styled-text";
16
- export * from "./tree-sitter";
17
- export * from "./data-paths";
18
- export * from "./extmarks";
19
- export * from "./terminal-palette";
20
- export { detectLinks } from "./detect-links";
1
+ export * from "./border.js";
2
+ export * from "./KeyHandler.js";
3
+ export * from "./ascii.font.js";
4
+ export * from "./hast-styled-text.js";
5
+ export * from "./RGBA.js";
6
+ export * from "./clock.js";
7
+ export * from "./parse.keypress.js";
8
+ export * from "./scroll-acceleration.js";
9
+ export * from "./styled-text.js";
10
+ export * from "./yoga.options.js";
11
+ export * from "./parse.mouse.js";
12
+ export * from "./selection.js";
13
+ export * from "./env.js";
14
+ export * from "./stdin-parser.js";
15
+ export * from "./tree-sitter-styled-text.js";
16
+ export * from "./tree-sitter/index.js";
17
+ export * from "./data-paths.js";
18
+ export * from "./extmarks.js";
19
+ export * from "./terminal-palette.js";
20
+ export * from "./paste.js";
21
+ export { detectLinks } from "./detect-links.js";
@@ -1,4 +1,4 @@
1
- import type { ViewportBounds } from "../types";
1
+ import type { ViewportBounds } from "../types.js";
2
2
  interface ViewportObject {
3
3
  x: number;
4
4
  y: number;
@@ -1,2 +1,2 @@
1
- import type { ParsedKey } from "./parse.keypress";
1
+ import type { ParsedKey } from "./parse.keypress.js";
2
2
  export declare function parseKittyKeyboard(sequence: string): ParsedKey | null;
package/lib/paste.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export type PasteKind = "text" | "binary" | "unknown";
2
+ export interface PasteMetadata {
3
+ mimeType?: string;
4
+ kind?: PasteKind;
5
+ }
6
+ export declare function decodePasteBytes(bytes: Uint8Array): string;
7
+ export declare function stripAnsiSequences(text: string): string;
@@ -1,5 +1,5 @@
1
- import type { RenderableOptions, Renderable } from "../Renderable";
2
- import type { PositionTypeString, OverflowString } from "./yoga.options";
1
+ import type { RenderableOptions, Renderable } from "../Renderable.js";
2
+ import type { PositionTypeString, OverflowString } from "./yoga.options.js";
3
3
  export declare function validateOptions(id: string, options: RenderableOptions<Renderable>): void;
4
4
  export declare function isValidPercentage(value: any): value is `${number}%`;
5
5
  export declare function isMarginType(value: any): value is number | "auto" | `${number}%`;
@@ -1,5 +1,5 @@
1
- import { Renderable, type ViewportBounds } from "..";
2
- import { fonts } from "./ascii.font";
1
+ import { Renderable, type ViewportBounds } from "../index.js";
2
+ import { fonts } from "./ascii.font.js";
3
3
  export declare class Selection {
4
4
  private _anchor;
5
5
  private _focus;
@@ -1,6 +1,7 @@
1
1
  import { type Clock } from "./clock";
2
2
  import { type ParsedKey } from "./parse.keypress";
3
3
  import { type RawMouseEvent } from "./parse.mouse";
4
+ import type { PasteMetadata } from "./paste";
4
5
  export { SystemClock, type Clock, type TimerHandle } from "./clock";
5
6
  export type StdinResponseProtocol = "csi" | "osc" | "dcs" | "apc" | "unknown";
6
7
  export type StdinEvent = {
@@ -14,18 +15,26 @@ export type StdinEvent = {
14
15
  event: RawMouseEvent;
15
16
  } | {
16
17
  type: "paste";
17
- text: string;
18
+ bytes: Uint8Array;
19
+ metadata?: PasteMetadata;
18
20
  } | {
19
21
  type: "response";
20
22
  protocol: StdinResponseProtocol;
21
23
  sequence: string;
22
24
  };
25
+ export interface StdinParserProtocolContext {
26
+ kittyKeyboardEnabled: boolean;
27
+ privateCapabilityRepliesActive: boolean;
28
+ pixelResolutionQueryActive: boolean;
29
+ explicitWidthCprActive: boolean;
30
+ }
23
31
  export interface StdinParserOptions {
24
32
  timeoutMs?: number;
25
33
  maxPendingBytes?: number;
26
34
  armTimeouts?: boolean;
27
35
  onTimeoutFlush?: () => void;
28
36
  useKittyKeyboard?: boolean;
37
+ protocolContext?: Partial<StdinParserProtocolContext>;
29
38
  clock?: Clock;
30
39
  }
31
40
  export declare class StdinParser {
@@ -38,6 +47,7 @@ export declare class StdinParser {
38
47
  private readonly useKittyKeyboard;
39
48
  private readonly mouseParser;
40
49
  private readonly clock;
50
+ private protocolContext;
41
51
  private timeoutId;
42
52
  private destroyed;
43
53
  private pendingSinceMs;
@@ -49,6 +59,7 @@ export declare class StdinParser {
49
59
  private paste;
50
60
  constructor(options?: StdinParserOptions);
51
61
  get bufferCapacity(): number;
62
+ updateProtocolContext(patch: Partial<StdinParserProtocolContext>): void;
52
63
  push(data: Uint8Array): void;
53
64
  read(): StdinEvent | null;
54
65
  drain(onEvent: (event: StdinEvent) => void): void;
@@ -67,7 +78,8 @@ export declare class StdinParser {
67
78
  private flushPendingOverflow;
68
79
  private markPending;
69
80
  private consumePasteBytes;
70
- private pushPasteText;
81
+ private pushPasteBytes;
82
+ private reconcileDeferredStateWithProtocolContext;
71
83
  private reconcileTimeoutState;
72
84
  private clearTimeout;
73
85
  private resetState;
@@ -1,5 +1,5 @@
1
- import type { TextChunk } from "../text-buffer";
2
- import { type ColorInput } from "./RGBA";
1
+ import type { TextChunk } from "../text-buffer.js";
2
+ import { type ColorInput } from "./RGBA.js";
3
3
  declare const BrandedStyledText: unique symbol;
4
4
  export type Color = ColorInput;
5
5
  export interface StyleAttrs {
@@ -1,3 +1,4 @@
1
+ import { type Clock } from "./clock";
1
2
  type Hex = string | null;
2
3
  export type WriteFunction = (data: string | Buffer) => boolean;
3
4
  export interface TerminalColors {
@@ -31,7 +32,8 @@ export declare class TerminalPalette implements TerminalPaletteDetector {
31
32
  private activeQuerySessions;
32
33
  private inLegacyTmux;
33
34
  private oscSource?;
34
- constructor(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction, isLegacyTmux?: boolean, oscSource?: OscSubscriptionSource);
35
+ private readonly clock;
36
+ constructor(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction, isLegacyTmux?: boolean, oscSource?: OscSubscriptionSource, clock?: Clock);
35
37
  /**
36
38
  * Write an OSC sequence, wrapping for tmux if needed
37
39
  */
@@ -44,5 +46,5 @@ export declare class TerminalPalette implements TerminalPaletteDetector {
44
46
  private querySpecialColors;
45
47
  detect(options?: GetPaletteOptions): Promise<TerminalColors>;
46
48
  }
47
- export declare function createTerminalPalette(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction, isLegacyTmux?: boolean, oscSource?: OscSubscriptionSource): TerminalPaletteDetector;
49
+ export declare function createTerminalPalette(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction, isLegacyTmux?: boolean, oscSource?: OscSubscriptionSource, clock?: Clock): TerminalPaletteDetector;
48
50
  export {};
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from "events";
2
- import type { TreeSitterClientOptions, TreeSitterClientEvents, BufferState, FiletypeParserOptions, Edit, PerformanceStats, SimpleHighlight } from "./types";
2
+ import type { TreeSitterClientOptions, TreeSitterClientEvents, BufferState, FiletypeParserOptions, Edit, PerformanceStats, SimpleHighlight } from "./types.js";
3
3
  declare global {
4
4
  const OTUI_TREE_SITTER_WORKER_PATH: string;
5
5
  }
@@ -1,8 +1,8 @@
1
- import { TreeSitterClient } from "./client";
2
- export * from "./client";
3
- export * from "../tree-sitter-styled-text";
4
- export * from "./types";
5
- export * from "./resolve-ft";
6
- export type { UpdateOptions } from "./assets/update";
7
- export { updateAssets } from "./assets/update";
1
+ import { TreeSitterClient } from "./client.js";
2
+ export * from "./client.js";
3
+ export * from "../tree-sitter-styled-text.js";
4
+ export * from "./types.js";
5
+ export * from "./resolve-ft.js";
6
+ export type { UpdateOptions } from "./assets/update.js";
7
+ export { updateAssets } from "./assets/update.js";
8
8
  export declare function getTreeSitterClient(): TreeSitterClient;
@@ -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;
@@ -26,6 +26,7 @@ export interface InjectionMapping {
26
26
  }
27
27
  export interface FiletypeParserOptions {
28
28
  filetype: string;
29
+ aliases?: string[];
29
30
  queries: {
30
31
  highlights: string[];
31
32
  injections?: string[];
@@ -1,8 +1,8 @@
1
- import type { TextChunk } from "../text-buffer";
2
- import { StyledText } from "./styled-text";
3
- import { SyntaxStyle } from "../syntax-style";
4
- import { TreeSitterClient } from "./tree-sitter/client";
5
- import type { SimpleHighlight } from "./tree-sitter/types";
1
+ import type { TextChunk } from "../text-buffer.js";
2
+ import { StyledText } from "./styled-text.js";
3
+ import { SyntaxStyle } from "../syntax-style.js";
4
+ import { TreeSitterClient } from "./tree-sitter/client.js";
5
+ import type { SimpleHighlight } from "./tree-sitter/types.js";
6
6
  interface ConcealOptions {
7
7
  enabled: boolean;
8
8
  }
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.87",
7
+ "version": "0.1.89",
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": {
@@ -28,6 +28,16 @@
28
28
  "require": "./testing.js",
29
29
  "types": "./testing.d.ts"
30
30
  },
31
+ "./runtime-plugin": {
32
+ "import": "./runtime-plugin.js",
33
+ "require": "./runtime-plugin.js",
34
+ "types": "./runtime-plugin.d.ts"
35
+ },
36
+ "./runtime-plugin-support": {
37
+ "import": "./runtime-plugin-support.js",
38
+ "require": "./runtime-plugin-support.js",
39
+ "types": "./runtime-plugin-support.d.ts"
40
+ },
31
41
  "./parser.worker": {
32
42
  "import": "./lib/tree-sitter/parser.worker.js",
33
43
  "require": "./lib/tree-sitter/parser.worker.js",
@@ -57,11 +67,11 @@
57
67
  "bun-webgpu": "0.1.5",
58
68
  "planck": "^1.4.2",
59
69
  "three": "0.177.0",
60
- "@opentui/core-darwin-x64": "0.1.87",
61
- "@opentui/core-darwin-arm64": "0.1.87",
62
- "@opentui/core-linux-x64": "0.1.87",
63
- "@opentui/core-linux-arm64": "0.1.87",
64
- "@opentui/core-win32-x64": "0.1.87",
65
- "@opentui/core-win32-arm64": "0.1.87"
70
+ "@opentui/core-darwin-x64": "0.1.89",
71
+ "@opentui/core-darwin-arm64": "0.1.89",
72
+ "@opentui/core-linux-x64": "0.1.89",
73
+ "@opentui/core-linux-arm64": "0.1.89",
74
+ "@opentui/core-win32-x64": "0.1.89",
75
+ "@opentui/core-win32-arm64": "0.1.89"
66
76
  }
67
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.set(filetypeParser.filetype, filetypeParser);
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
- if (this.filetypeParsers.has(filetype)) {
240
- return this.filetypeParsers.get(filetype);
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(filetype)) {
243
- return this.filetypeParserPromises.get(filetype);
275
+ if (this.filetypeParserPromises.has(canonicalFiletype)) {
276
+ return this.filetypeParserPromises.get(canonicalFiletype);
244
277
  }
245
- const loadingPromise = this.loadFiletypeParser(filetype);
246
- this.filetypeParserPromises.set(filetype, loadingPromise);
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(filetype, result);
283
+ this.filetypeParsers.set(canonicalFiletype, result);
251
284
  }
252
285
  return result;
253
286
  } finally {
254
- this.filetypeParserPromises.delete(filetype);
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
- if (this.reusableParsers.has(filetype)) {
283
- return this.reusableParsers.get(filetype);
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(filetype)) {
286
- return this.reusableParserPromises.get(filetype);
319
+ if (this.reusableParserPromises.has(canonicalFiletype)) {
320
+ return this.reusableParserPromises.get(canonicalFiletype);
287
321
  }
288
- const creationPromise = this.createReusableParser(filetype);
289
- this.reusableParserPromises.set(filetype, creationPromise);
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(filetype, result);
327
+ this.reusableParsers.set(canonicalFiletype, result);
294
328
  }
295
329
  return result;
296
330
  } finally {
297
- this.reusableParserPromises.delete(filetype);
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=9C8F94938CC7697764756E2164756E21
895
+ //# debugId=181702D6D7C45F4964756E2164756E21
862
896
  //# sourceMappingURL=parser.worker.js.map