@xincli/opentui-core 0.4.6
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 +63 -0
- package/dev/keypress-debug-renderer.ts +148 -0
- package/dev/keypress-debug.ts +43 -0
- package/dev/print-env-vars.ts +32 -0
- package/dev/test-tmux-graphics-334.sh +68 -0
- package/dev/test-tmux-theme-queries.sh +151 -0
- package/dev/thai-debug-test.ts +68 -0
- package/dev/theme-mode.ts +290 -0
- package/docs/development.md +144 -0
- package/package.json +102 -0
- package/prebuilt/aarch64-android/libopentui.so +0 -0
- package/scripts/build-android.ts +226 -0
- package/scripts/build-native-termux.sh +525 -0
- package/scripts/build.ts +530 -0
- package/scripts/dist-test.ts +312 -0
- package/scripts/package-prebuilt.ts +110 -0
- package/scripts/publish.ts +60 -0
- package/scripts/test-node-hook.mjs +16 -0
- package/scripts/test-node.ts +241 -0
- package/scripts/vendor-deps.sh +73 -0
- package/src/NativeSpanFeed.ts +375 -0
- package/src/Renderable.ts +1878 -0
- package/src/__snapshots__/buffer.test.ts.snap +28 -0
- package/src/animation/Timeline.test.ts +2709 -0
- package/src/animation/Timeline.ts +598 -0
- package/src/ansi.ts +22 -0
- package/src/audio.ts +479 -0
- package/src/benchmark/attenuation-benchmark.ts +81 -0
- package/src/benchmark/audio-playback-benchmark.ts +344 -0
- package/src/benchmark/box-draw-benchmark.ts +1042 -0
- package/src/benchmark/colormatrix-benchmark.ts +123 -0
- package/src/benchmark/gain-benchmark.ts +80 -0
- package/src/benchmark/latest-all-bench-run.json +707 -0
- package/src/benchmark/latest-async-bench-run.json +336 -0
- package/src/benchmark/latest-default-bench-run.json +657 -0
- package/src/benchmark/latest-large-bench-run.json +707 -0
- package/src/benchmark/latest-quick-bench-run.json +207 -0
- package/src/benchmark/layout-benchmark.ts +2547 -0
- package/src/benchmark/markdown-benchmark.ts +1796 -0
- package/src/benchmark/native-span-feed-async-benchmark.ts +355 -0
- package/src/benchmark/native-span-feed-benchmark.md +56 -0
- package/src/benchmark/native-span-feed-benchmark.ts +596 -0
- package/src/benchmark/native-span-feed-compare.ts +280 -0
- package/src/benchmark/render-traversal-benchmark.ts +928 -0
- package/src/benchmark/text-buffer-render-benchmark.ts +874 -0
- package/src/benchmark/text-table-benchmark.ts +948 -0
- package/src/buffer.test.ts +292 -0
- package/src/buffer.ts +564 -0
- package/src/console.test.ts +629 -0
- package/src/console.ts +1253 -0
- package/src/edit-buffer.test.ts +1852 -0
- package/src/edit-buffer.ts +417 -0
- package/src/editor-view.test.ts +1056 -0
- package/src/editor-view.ts +290 -0
- package/src/index.ts +25 -0
- package/src/lib/KeyHandler.integration.test.ts +292 -0
- package/src/lib/KeyHandler.stopPropagation.test.ts +289 -0
- package/src/lib/KeyHandler.test.ts +662 -0
- package/src/lib/KeyHandler.ts +222 -0
- package/src/lib/RGBA.test.ts +60 -0
- package/src/lib/RGBA.ts +343 -0
- package/src/lib/ascii.font.ts +330 -0
- package/src/lib/border.test.ts +83 -0
- package/src/lib/border.ts +170 -0
- package/src/lib/bunfs.test.ts +27 -0
- package/src/lib/bunfs.ts +18 -0
- package/src/lib/clipboard.test.ts +63 -0
- package/src/lib/clipboard.ts +41 -0
- package/src/lib/clock.ts +35 -0
- package/src/lib/data-paths.test.ts +133 -0
- package/src/lib/data-paths.ts +109 -0
- package/src/lib/debounce.ts +106 -0
- package/src/lib/detect-links.test.ts +98 -0
- package/src/lib/detect-links.ts +56 -0
- package/src/lib/env.test.ts +228 -0
- package/src/lib/env.ts +209 -0
- package/src/lib/extmarks-history.ts +51 -0
- package/src/lib/extmarks-multiwidth.test.ts +324 -0
- package/src/lib/extmarks.test.ts +3547 -0
- package/src/lib/extmarks.ts +861 -0
- package/src/lib/fonts/block.json +405 -0
- package/src/lib/fonts/grid.json +265 -0
- package/src/lib/fonts/huge.json +741 -0
- package/src/lib/fonts/pallet.json +314 -0
- package/src/lib/fonts/shade.json +591 -0
- package/src/lib/fonts/slick.json +321 -0
- package/src/lib/fonts/tiny.json +69 -0
- package/src/lib/hast-styled-text.ts +59 -0
- package/src/lib/index.ts +22 -0
- package/src/lib/keybinding.internal.test.ts +342 -0
- package/src/lib/keybinding.internal.ts +182 -0
- package/src/lib/objects-in-viewport.test.ts +789 -0
- package/src/lib/objects-in-viewport.ts +153 -0
- package/src/lib/output.capture.ts +58 -0
- package/src/lib/parse.keypress-kitty.protocol.test.ts +347 -0
- package/src/lib/parse.keypress-kitty.test.ts +712 -0
- package/src/lib/parse.keypress-kitty.ts +470 -0
- package/src/lib/parse.keypress.test.ts +2020 -0
- package/src/lib/parse.keypress.ts +480 -0
- package/src/lib/parse.mouse.test.ts +552 -0
- package/src/lib/parse.mouse.ts +232 -0
- package/src/lib/paste.ts +18 -0
- package/src/lib/queue.ts +65 -0
- package/src/lib/render-geometry.ts +36 -0
- package/src/lib/renderable.validations.test.ts +87 -0
- package/src/lib/renderable.validations.ts +83 -0
- package/src/lib/scroll-acceleration.ts +98 -0
- package/src/lib/selection.ts +261 -0
- package/src/lib/singleton.ts +34 -0
- package/src/lib/stdin-parser.test.ts +2439 -0
- package/src/lib/stdin-parser.ts +2007 -0
- package/src/lib/styled-text.ts +178 -0
- package/src/lib/terminal-capability-detection.test.ts +226 -0
- package/src/lib/terminal-capability-detection.ts +98 -0
- package/src/lib/terminal-palette.test.ts +954 -0
- package/src/lib/terminal-palette.ts +441 -0
- package/src/lib/tree-sitter/assets/README.md +119 -0
- package/src/lib/tree-sitter/assets/javascript/highlights.scm +205 -0
- package/src/lib/tree-sitter/assets/javascript/tree-sitter-javascript.wasm +0 -0
- package/src/lib/tree-sitter/assets/markdown/highlights.scm +150 -0
- package/src/lib/tree-sitter/assets/markdown/injections.scm +27 -0
- package/src/lib/tree-sitter/assets/markdown/tree-sitter-markdown.wasm +0 -0
- package/src/lib/tree-sitter/assets/markdown_inline/highlights.scm +115 -0
- package/src/lib/tree-sitter/assets/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
- package/src/lib/tree-sitter/assets/typescript/highlights.scm +604 -0
- package/src/lib/tree-sitter/assets/typescript/tree-sitter-typescript.wasm +0 -0
- package/src/lib/tree-sitter/assets/update.ts +360 -0
- package/src/lib/tree-sitter/assets/zig/highlights.scm +284 -0
- package/src/lib/tree-sitter/assets/zig/tree-sitter-zig.wasm +0 -0
- package/src/lib/tree-sitter/assets.d.ts +9 -0
- package/src/lib/tree-sitter/cache.test.ts +291 -0
- package/src/lib/tree-sitter/client.test.ts +1434 -0
- package/src/lib/tree-sitter/client.ts +847 -0
- package/src/lib/tree-sitter/default-parsers.ts +133 -0
- package/src/lib/tree-sitter/download-utils.ts +148 -0
- package/src/lib/tree-sitter/index.ts +75 -0
- package/src/lib/tree-sitter/parser.worker.ts +1098 -0
- package/src/lib/tree-sitter/parsers-config.ts +81 -0
- package/src/lib/tree-sitter/resolve-ft.test.ts +55 -0
- package/src/lib/tree-sitter/resolve-ft.ts +189 -0
- package/src/lib/tree-sitter/types.ts +132 -0
- package/src/lib/tree-sitter/update-assets.ts +10 -0
- package/src/lib/tree-sitter-styled-text.test.ts +1253 -0
- package/src/lib/tree-sitter-styled-text.ts +314 -0
- package/src/lib/validate-dir-name.ts +55 -0
- package/src/lib/yoga.options.test.ts +628 -0
- package/src/lib/yoga.options.ts +346 -0
- package/src/native-event-worker-repro.test.ts +48 -0
- package/src/native-event-worker-repro.worker.ts +9 -0
- package/src/native-handle.test.ts +221 -0
- package/src/platform/ffi.test.ts +516 -0
- package/src/platform/ffi.ts +653 -0
- package/src/platform/runtime.test.ts +52 -0
- package/src/platform/runtime.ts +121 -0
- package/src/platform/test.ts +45 -0
- package/src/platform/worker-handler-cleanup.fixture.ts +12 -0
- package/src/platform/worker-onmessage-startup.fixture.ts +10 -0
- package/src/platform/worker-startup.fixture.ts +9 -0
- package/src/platform/worker.node-test.ts +153 -0
- package/src/platform/worker.ts +425 -0
- package/src/plugins/core-slot.ts +579 -0
- package/src/plugins/registry.ts +402 -0
- package/src/plugins/types.ts +46 -0
- package/src/post/effects.ts +948 -0
- package/src/post/filters.ts +512 -0
- package/src/post/matrices.ts +288 -0
- package/src/renderables/ASCIIFont.ts +219 -0
- package/src/renderables/Box.test.ts +474 -0
- package/src/renderables/Box.ts +353 -0
- package/src/renderables/Code.test.ts +2388 -0
- package/src/renderables/Code.ts +555 -0
- package/src/renderables/Diff.regression.test.ts +381 -0
- package/src/renderables/Diff.test.ts +3212 -0
- package/src/renderables/Diff.ts +1278 -0
- package/src/renderables/EditBufferRenderable.test.ts +288 -0
- package/src/renderables/EditBufferRenderable.ts +1152 -0
- package/src/renderables/FrameBuffer.ts +47 -0
- package/src/renderables/Input.test.ts +1310 -0
- package/src/renderables/Input.ts +273 -0
- package/src/renderables/LineNumberRenderable.ts +725 -0
- package/src/renderables/Markdown.ts +2144 -0
- package/src/renderables/ScrollBar.ts +423 -0
- package/src/renderables/ScrollBox.ts +903 -0
- package/src/renderables/Select.test.ts +1134 -0
- package/src/renderables/Select.ts +535 -0
- package/src/renderables/Slider.test.ts +456 -0
- package/src/renderables/Slider.ts +342 -0
- package/src/renderables/TabSelect.test.ts +238 -0
- package/src/renderables/TabSelect.ts +447 -0
- package/src/renderables/Text.selection-buffer.test.ts +118 -0
- package/src/renderables/Text.test.ts +2662 -0
- package/src/renderables/Text.ts +147 -0
- package/src/renderables/TextBufferRenderable.ts +504 -0
- package/src/renderables/TextNode.test.ts +1137 -0
- package/src/renderables/TextNode.ts +379 -0
- package/src/renderables/TextTable.test.ts +1411 -0
- package/src/renderables/TextTable.ts +1434 -0
- package/src/renderables/Textarea.ts +425 -0
- package/src/renderables/TimeToFirstDraw.ts +89 -0
- package/src/renderables/__snapshots__/Code.test.ts.snap +13 -0
- package/src/renderables/__snapshots__/Diff.test.ts.snap +785 -0
- package/src/renderables/__snapshots__/Text.test.ts.snap +421 -0
- package/src/renderables/__snapshots__/TextTable.test.ts.snap +215 -0
- package/src/renderables/__tests__/Code.test.ts +55 -0
- package/src/renderables/__tests__/LineNumberRenderable.scrollbox-simple.test.ts +144 -0
- package/src/renderables/__tests__/LineNumberRenderable.scrollbox.test.ts +827 -0
- package/src/renderables/__tests__/LineNumberRenderable.test.ts +1906 -0
- package/src/renderables/__tests__/LineNumberRenderable.wrapping.test.ts +85 -0
- package/src/renderables/__tests__/Markdown.code-colors.test.ts +288 -0
- package/src/renderables/__tests__/Markdown.test.ts +4175 -0
- package/src/renderables/__tests__/MultiRenderable.selection.test.ts +87 -0
- package/src/renderables/__tests__/Textarea.buffer.test.ts +683 -0
- package/src/renderables/__tests__/Textarea.destroyed-events.test.ts +675 -0
- package/src/renderables/__tests__/Textarea.editing.test.ts +2120 -0
- package/src/renderables/__tests__/Textarea.error-handling.test.ts +35 -0
- package/src/renderables/__tests__/Textarea.events.test.ts +738 -0
- package/src/renderables/__tests__/Textarea.highlights.test.ts +590 -0
- package/src/renderables/__tests__/Textarea.keybinding.test.ts +3275 -0
- package/src/renderables/__tests__/Textarea.paste.test.ts +357 -0
- package/src/renderables/__tests__/Textarea.rendering.test.ts +1927 -0
- package/src/renderables/__tests__/Textarea.scroll.test.ts +733 -0
- package/src/renderables/__tests__/Textarea.selection.test.ts +1589 -0
- package/src/renderables/__tests__/Textarea.stress.test.ts +670 -0
- package/src/renderables/__tests__/Textarea.undo-redo.test.ts +383 -0
- package/src/renderables/__tests__/Textarea.visual-lines.test.ts +310 -0
- package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.code.test.ts.snap +221 -0
- package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox-simple.test.ts.snap +89 -0
- package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox.test.ts.snap +457 -0
- package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.test.ts.snap +158 -0
- package/src/renderables/__tests__/__snapshots__/Textarea.rendering.test.ts.snap +387 -0
- package/src/renderables/__tests__/markdown-parser.test.ts +241 -0
- package/src/renderables/__tests__/renderable-test-utils.ts +60 -0
- package/src/renderables/composition/README.md +8 -0
- package/src/renderables/composition/VRenderable.ts +32 -0
- package/src/renderables/composition/constructs.ts +127 -0
- package/src/renderables/composition/vnode.ts +277 -0
- package/src/renderables/index.ts +23 -0
- package/src/renderables/markdown-parser.ts +79 -0
- package/src/renderer-theme-mode.ts +199 -0
- package/src/renderer.ts +4975 -0
- package/src/runtime-plugin-support-configure.ts +63 -0
- package/src/runtime-plugin-support.ts +13 -0
- package/src/runtime-plugin.ts +626 -0
- package/src/specs/terminal-startup.md +64 -0
- package/src/syntax-style.test.ts +841 -0
- package/src/syntax-style.ts +274 -0
- package/src/testing/README.md +219 -0
- package/src/testing/bun-test-node.ts +880 -0
- package/src/testing/capture-spans.test.ts +216 -0
- package/src/testing/integration.test.ts +276 -0
- package/src/testing/manual-clock.ts +117 -0
- package/src/testing/mock-keys.test.ts +1378 -0
- package/src/testing/mock-keys.ts +457 -0
- package/src/testing/mock-mouse.test.ts +218 -0
- package/src/testing/mock-mouse.ts +247 -0
- package/src/testing/mock-tree-sitter-client.ts +81 -0
- package/src/testing/spy.ts +13 -0
- package/src/testing/terminal-capabilities.ts +47 -0
- package/src/testing/test-recorder.test.ts +410 -0
- package/src/testing/test-recorder.ts +133 -0
- package/src/testing/test-renderer.ts +375 -0
- package/src/testing/test-renderer.wait.test.ts +278 -0
- package/src/testing/test-streams.ts +31 -0
- package/src/testing.ts +9 -0
- package/src/tests/__snapshots__/absolute-positioning.snapshot.test.ts.snap +481 -0
- package/src/tests/__snapshots__/renderable.snapshot.test.ts.snap +19 -0
- package/src/tests/__snapshots__/scrollbox.test.ts.snap +29 -0
- package/src/tests/absolute-positioning.snapshot.test.ts +638 -0
- package/src/tests/allocator-stats.test.ts +53 -0
- package/src/tests/audio.test.ts +303 -0
- package/src/tests/destroy-during-render.test.ts +200 -0
- package/src/tests/destroy-on-exit.fixture.ts +36 -0
- package/src/tests/destroy-on-exit.test.ts +62 -0
- package/src/tests/ffi-borrowed-pointer-callsites.test.ts +153 -0
- package/src/tests/hover-cursor.test.ts +98 -0
- package/src/tests/native-backed-measurement-lifecycle.test.ts +133 -0
- package/src/tests/native-backed-measurement-parity.test.ts +322 -0
- package/src/tests/native-span-feed-async.test.ts +173 -0
- package/src/tests/native-span-feed-close.test.ts +120 -0
- package/src/tests/native-span-feed-coverage.test.ts +227 -0
- package/src/tests/native-span-feed-edge-cases.test.ts +384 -0
- package/src/tests/native-span-feed-use-after-free.test.ts +45 -0
- package/src/tests/opacity.test.ts +123 -0
- package/src/tests/renderable.snapshot.test.ts +524 -0
- package/src/tests/renderable.test.ts +1851 -0
- package/src/tests/renderer.clock.test.ts +270 -0
- package/src/tests/renderer.console-startup.test.ts +2151 -0
- package/src/tests/renderer.control.test.ts +458 -0
- package/src/tests/renderer.core-slot-binding.test.ts +962 -0
- package/src/tests/renderer.cursor.test.ts +26 -0
- package/src/tests/renderer.custom-stdout.test.ts +1112 -0
- package/src/tests/renderer.destroy-during-render.test.ts +147 -0
- package/src/tests/renderer.focus-restore.test.ts +257 -0
- package/src/tests/renderer.focus.test.ts +329 -0
- package/src/tests/renderer.idle.test.ts +219 -0
- package/src/tests/renderer.input.test.ts +2615 -0
- package/src/tests/renderer.kitty-flags.test.ts +195 -0
- package/src/tests/renderer.lifecycle.test.ts +34 -0
- package/src/tests/renderer.mouse.test.ts +1315 -0
- package/src/tests/renderer.notifications.test.ts +27 -0
- package/src/tests/renderer.palette.test.ts +1199 -0
- package/src/tests/renderer.remote.test.ts +247 -0
- package/src/tests/renderer.render-stats.test.ts +146 -0
- package/src/tests/renderer.scrollback-surface.test.ts +474 -0
- package/src/tests/renderer.selection.test.ts +138 -0
- package/src/tests/renderer.slot-registry.test.ts +684 -0
- package/src/tests/renderer.tracker.test.ts +202 -0
- package/src/tests/renderer.useMouse.test.ts +83 -0
- package/src/tests/runtime-plugin-node-modules-cycle.fixture.ts +76 -0
- package/src/tests/runtime-plugin-node-modules-import-like-string.fixture.ts +48 -0
- package/src/tests/runtime-plugin-node-modules-mjs.fixture.ts +43 -0
- package/src/tests/runtime-plugin-node-modules-no-bare-rewrite.fixture.ts +67 -0
- package/src/tests/runtime-plugin-node-modules-package-type-cache.fixture.ts +72 -0
- package/src/tests/runtime-plugin-node-modules-runtime-specifier.fixture.ts +44 -0
- package/src/tests/runtime-plugin-node-modules-scoped-package-bare-rewrite.fixture.ts +85 -0
- package/src/tests/runtime-plugin-path-alias.fixture.ts +43 -0
- package/src/tests/runtime-plugin-resolve-roots.fixture.ts +65 -0
- package/src/tests/runtime-plugin-support-configure.fixture.ts +31 -0
- package/src/tests/runtime-plugin-support-late-addition.fixture.ts +17 -0
- package/src/tests/runtime-plugin-support.fixture.ts +11 -0
- package/src/tests/runtime-plugin-support.test.ts +54 -0
- package/src/tests/runtime-plugin-windows-file-url.fixture.ts +30 -0
- package/src/tests/runtime-plugin.fixture.ts +40 -0
- package/src/tests/runtime-plugin.test.ts +369 -0
- package/src/tests/scrollbox-culling-bug.test.ts +114 -0
- package/src/tests/scrollbox-hitgrid-resize.test.ts +136 -0
- package/src/tests/scrollbox-hitgrid.test.ts +909 -0
- package/src/tests/scrollbox.test.ts +1895 -0
- package/src/tests/wrap-resize-perf.test.ts +276 -0
- package/src/tests/yoga-api-coverage.test.ts +409 -0
- package/src/tests/yoga-callback-stress.test.ts +122 -0
- package/src/tests/yoga-ffi.test.ts +117 -0
- package/src/tests/yoga-setters.test.ts +921 -0
- package/src/tests/yoga-upstream/YGAlignBaselineTest.test.ts +124 -0
- package/src/tests/yoga-upstream/YGComputedBorderTest.test.ts +27 -0
- package/src/tests/yoga-upstream/YGComputedMarginTest.test.ts +27 -0
- package/src/tests/yoga-upstream/YGComputedPaddingTest.test.ts +27 -0
- package/src/tests/yoga-upstream/YGDirtiedTest.test.ts +157 -0
- package/src/tests/yoga-upstream/YGErrataTest.test.ts +40 -0
- package/src/tests/yoga-upstream/YGFlexBasisAuto.test.ts +23 -0
- package/src/tests/yoga-upstream/YGHasNewLayout.test.ts +81 -0
- package/src/tests/yoga-upstream/YGMeasureCacheTest.test.ts +31 -0
- package/src/tests/yoga-upstream/YGMeasureTest.test.ts +70 -0
- package/src/tests/yoga-upstream/generated/YGAbsolutePositionTest.test.ts +1864 -0
- package/src/tests/yoga-upstream/generated/YGAlignContentTest.test.ts +5829 -0
- package/src/tests/yoga-upstream/generated/YGAlignItemsTest.test.ts +2444 -0
- package/src/tests/yoga-upstream/generated/YGAlignSelfTest.test.ts +293 -0
- package/src/tests/yoga-upstream/generated/YGAndroidNewsFeed.test.ts +315 -0
- package/src/tests/yoga-upstream/generated/YGAspectRatioTest.test.ts +231 -0
- package/src/tests/yoga-upstream/generated/YGAutoTest.test.ts +347 -0
- package/src/tests/yoga-upstream/generated/YGBorderTest.test.ts +256 -0
- package/src/tests/yoga-upstream/generated/YGBoxSizingTest.test.ts +2747 -0
- package/src/tests/yoga-upstream/generated/YGDimensionTest.test.ts +129 -0
- package/src/tests/yoga-upstream/generated/YGDisplayContentsTest.test.ts +109 -0
- package/src/tests/yoga-upstream/generated/YGDisplayTest.test.ts +1097 -0
- package/src/tests/yoga-upstream/generated/YGFlexDirectionTest.test.ts +4562 -0
- package/src/tests/yoga-upstream/generated/YGFlexTest.test.ts +677 -0
- package/src/tests/yoga-upstream/generated/YGFlexWrapTest.test.ts +2071 -0
- package/src/tests/yoga-upstream/generated/YGGapTest.test.ts +3303 -0
- package/src/tests/yoga-upstream/generated/YGIntrinsicSizeTest.test.ts +582 -0
- package/src/tests/yoga-upstream/generated/YGJustifyContentTest.test.ts +2150 -0
- package/src/tests/yoga-upstream/generated/YGMarginTest.test.ts +1963 -0
- package/src/tests/yoga-upstream/generated/YGMinMaxDimensionTest.test.ts +1446 -0
- package/src/tests/yoga-upstream/generated/YGPaddingTest.test.ts +354 -0
- package/src/tests/yoga-upstream/generated/YGPercentageTest.test.ts +1760 -0
- package/src/tests/yoga-upstream/generated/YGRoundingTest.test.ts +1161 -0
- package/src/tests/yoga-upstream/generated/YGSizeOverflowTest.test.ts +207 -0
- package/src/tests/yoga-upstream/generated/YGStaticPositionTest.test.ts +6338 -0
- package/src/tests/yoga-upstream/tools/MeasureCounter.ts +54 -0
- package/src/tests/yoga-upstream/tools/utils.ts +81 -0
- package/src/text-buffer-view.test.ts +722 -0
- package/src/text-buffer-view.ts +193 -0
- package/src/text-buffer.test.ts +512 -0
- package/src/text-buffer.ts +250 -0
- package/src/types.ts +199 -0
- package/src/utils.ts +88 -0
- package/src/yoga.ts +1146 -0
- package/src/zig/ansi.zig +502 -0
- package/src/zig/audio.zig +1206 -0
- package/src/zig/bench/README.md +50 -0
- package/src/zig/bench/buffer-color-blending_bench.zig +350 -0
- package/src/zig/bench/buffer-draw-box_bench.zig +786 -0
- package/src/zig/bench/buffer-draw-text-buffer_bench.zig +894 -0
- package/src/zig/bench/edit-buffer_bench.zig +476 -0
- package/src/zig/bench/editor-view_bench.zig +169 -0
- package/src/zig/bench/native-span-feed_bench.zig +107 -0
- package/src/zig/bench/rope-markers_bench.zig +713 -0
- package/src/zig/bench/rope_bench.zig +514 -0
- package/src/zig/bench/styled-text_bench.zig +476 -0
- package/src/zig/bench/text-buffer-coords_bench.zig +362 -0
- package/src/zig/bench/text-buffer-view_bench.zig +459 -0
- package/src/zig/bench/text-chunk-graphemes_bench.zig +272 -0
- package/src/zig/bench/utf8_bench.zig +799 -0
- package/src/zig/bench-utils.zig +431 -0
- package/src/zig/bench.zig +223 -0
- package/src/zig/buffer-methods.zig +215 -0
- package/src/zig/buffer.zig +2515 -0
- package/src/zig/build.zig +700 -0
- package/src/zig/build.zig.zon +19 -0
- package/src/zig/edit-buffer.zig +900 -0
- package/src/zig/editor-view.zig +812 -0
- package/src/zig/event-bus.zig +28 -0
- package/src/zig/event-emitter.zig +65 -0
- package/src/zig/file-logger.zig +92 -0
- package/src/zig/grapheme.zig +838 -0
- package/src/zig/handles.zig +267 -0
- package/src/zig/lib.zig +2813 -0
- package/src/zig/link.zig +349 -0
- package/src/zig/logger.zig +43 -0
- package/src/zig/mem-registry.zig +126 -0
- package/src/zig/miniaudio_shim.c +21 -0
- package/src/zig/native-renderable.zig +112 -0
- package/src/zig/native-span-feed-bench-lib.zig +7 -0
- package/src/zig/native-span-feed.zig +747 -0
- package/src/zig/renderer-output.zig +677 -0
- package/src/zig/renderer.zig +2106 -0
- package/src/zig/rope.zig +1220 -0
- package/src/zig/split-scrollback.zig +88 -0
- package/src/zig/syntax-style.zig +174 -0
- package/src/zig/terminal.zig +1652 -0
- package/src/zig/test.zig +82 -0
- package/src/zig/tests/README.md +18 -0
- package/src/zig/tests/ansi_test.zig +18 -0
- package/src/zig/tests/audio_test.zig +439 -0
- package/src/zig/tests/buffer-methods_test.zig +1111 -0
- package/src/zig/tests/buffer_test.zig +2926 -0
- package/src/zig/tests/edit-buffer-history_test.zig +299 -0
- package/src/zig/tests/edit-buffer_test.zig +1688 -0
- package/src/zig/tests/editor-view_test.zig +3454 -0
- package/src/zig/tests/event-emitter_test.zig +249 -0
- package/src/zig/tests/grapheme_test.zig +1329 -0
- package/src/zig/tests/handles_test.zig +123 -0
- package/src/zig/tests/link_test.zig +220 -0
- package/src/zig/tests/mem-registry_test.zig +473 -0
- package/src/zig/tests/memory_leak_regression_test.zig +234 -0
- package/src/zig/tests/native-renderable_test.zig +16 -0
- package/src/zig/tests/native-span-feed_test.zig +1266 -0
- package/src/zig/tests/renderer_test.zig +2604 -0
- package/src/zig/tests/rope-nested_test.zig +712 -0
- package/src/zig/tests/rope_fuzz_test.zig +238 -0
- package/src/zig/tests/rope_test.zig +2362 -0
- package/src/zig/tests/segment-merge.test.zig +148 -0
- package/src/zig/tests/split-scrollback_test.zig +70 -0
- package/src/zig/tests/syntax-style_test.zig +558 -0
- package/src/zig/tests/terminal_test.zig +1489 -0
- package/src/zig/tests/test-renderer.zig +126 -0
- package/src/zig/tests/text-buffer-drawing_test.zig +3291 -0
- package/src/zig/tests/text-buffer-highlights_test.zig +706 -0
- package/src/zig/tests/text-buffer-iterators_test.zig +776 -0
- package/src/zig/tests/text-buffer-segment_test.zig +320 -0
- package/src/zig/tests/text-buffer-selection_test.zig +1056 -0
- package/src/zig/tests/text-buffer-selection_viewport_test.zig +358 -0
- package/src/zig/tests/text-buffer-view_test.zig +3672 -0
- package/src/zig/tests/text-buffer_test.zig +2191 -0
- package/src/zig/tests/unicode-width-map.zon +3909 -0
- package/src/zig/tests/utf8_no_zwj_test.zig +260 -0
- package/src/zig/tests/utf8_test.zig +4060 -0
- package/src/zig/tests/utf8_wcwidth_cursor_test.zig +267 -0
- package/src/zig/tests/utf8_wcwidth_test.zig +357 -0
- package/src/zig/tests/word-wrap-editing_test.zig +498 -0
- package/src/zig/tests/wrap-cache-perf_test.zig +113 -0
- package/src/zig/tests/yoga_test.zig +65 -0
- package/src/zig/text-buffer-iterators.zig +496 -0
- package/src/zig/text-buffer-segment.zig +403 -0
- package/src/zig/text-buffer-view.zig +1428 -0
- package/src/zig/text-buffer.zig +1272 -0
- package/src/zig/utf8.zig +1954 -0
- package/src/zig/utils.zig +12 -0
- package/src/zig/uucode-stub.zig +76 -0
- package/src/zig/vendor/miniaudio/miniaudio.h +93468 -0
- package/src/zig/yoga.zig +658 -0
- package/src/zig-structs.ts +381 -0
- package/src/zig.ts +5260 -0
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +27 -0
- package/tsconfig.node-test.json +138 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { readFile, writeFile, mkdir } from "fs/promises"
|
|
4
|
+
import * as path from "path"
|
|
5
|
+
import { DownloadUtils } from "../download-utils.js"
|
|
6
|
+
import { parseArgs } from "util"
|
|
7
|
+
import type { FiletypeParserOptions } from "../types.js"
|
|
8
|
+
import { readdir } from "fs/promises"
|
|
9
|
+
import { fileURLToPath } from "node:url"
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
12
|
+
const __dirname = path.dirname(__filename)
|
|
13
|
+
|
|
14
|
+
interface ParsersConfig {
|
|
15
|
+
parsers: FiletypeParserOptions[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface GeneratedParser {
|
|
19
|
+
filetype: string
|
|
20
|
+
aliases?: string[]
|
|
21
|
+
languagePath: string
|
|
22
|
+
highlightsPath: string
|
|
23
|
+
injectionsPath?: string
|
|
24
|
+
injectionMapping?: any
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface UpdateOptions {
|
|
28
|
+
/** Path to parsers-config.json */
|
|
29
|
+
configPath: string
|
|
30
|
+
/** Directory where .wasm and .scm files will be downloaded */
|
|
31
|
+
assetsDir: string
|
|
32
|
+
/** Path where the generated TypeScript file will be written */
|
|
33
|
+
outputPath: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getDefaultOptions(): UpdateOptions {
|
|
37
|
+
return {
|
|
38
|
+
configPath: path.resolve(__dirname, "../parsers-config"),
|
|
39
|
+
assetsDir: path.resolve(__dirname),
|
|
40
|
+
outputPath: path.resolve(__dirname, "../default-parsers.ts"),
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function loadConfig(configPath: string): Promise<ParsersConfig> {
|
|
45
|
+
let ext = path.extname(configPath)
|
|
46
|
+
let resolvedConfigPath = configPath
|
|
47
|
+
|
|
48
|
+
if (ext === "") {
|
|
49
|
+
const files = await readdir(path.dirname(configPath))
|
|
50
|
+
const file = files.find(
|
|
51
|
+
(file) =>
|
|
52
|
+
file.startsWith(path.basename(configPath)) &&
|
|
53
|
+
(file.endsWith(".json") || file.endsWith(".ts") || file.endsWith(".js")),
|
|
54
|
+
)
|
|
55
|
+
if (!file) {
|
|
56
|
+
throw new Error(`No config file found for ${configPath}`)
|
|
57
|
+
}
|
|
58
|
+
resolvedConfigPath = path.join(path.dirname(configPath), file)
|
|
59
|
+
ext = path.extname(resolvedConfigPath)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (ext === ".json") {
|
|
63
|
+
const configContent = await readFile(resolvedConfigPath, "utf-8")
|
|
64
|
+
return JSON.parse(configContent)
|
|
65
|
+
} else if (ext === ".ts" || ext === ".js") {
|
|
66
|
+
const { default: configContent } = await import(resolvedConfigPath)
|
|
67
|
+
return configContent
|
|
68
|
+
}
|
|
69
|
+
throw new Error(`Unsupported config file extension: ${ext}`)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function downloadLanguage(
|
|
73
|
+
filetype: string,
|
|
74
|
+
languageUrl: string,
|
|
75
|
+
assetsDir: string,
|
|
76
|
+
outputPath: string,
|
|
77
|
+
): Promise<string> {
|
|
78
|
+
const languageDir = path.join(assetsDir, filetype)
|
|
79
|
+
const languageFilename = path.basename(languageUrl)
|
|
80
|
+
const languagePath = path.join(languageDir, languageFilename)
|
|
81
|
+
|
|
82
|
+
const result = await DownloadUtils.downloadToPath(languageUrl, languagePath)
|
|
83
|
+
|
|
84
|
+
if (result.error) {
|
|
85
|
+
throw new Error(`Failed to download language for ${filetype}: ${result.error}`)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return "./" + path.relative(path.dirname(outputPath), languagePath)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function downloadAndCombineQueries(
|
|
92
|
+
filetype: string,
|
|
93
|
+
queryUrls: string[],
|
|
94
|
+
assetsDir: string,
|
|
95
|
+
outputPath: string,
|
|
96
|
+
queryType: "highlights" | "injections",
|
|
97
|
+
configPath: string,
|
|
98
|
+
): Promise<string> {
|
|
99
|
+
const queriesDir = path.join(assetsDir, filetype)
|
|
100
|
+
const queryPath = path.join(queriesDir, `${queryType}.scm`)
|
|
101
|
+
|
|
102
|
+
const queryContents: string[] = []
|
|
103
|
+
|
|
104
|
+
for (let i = 0; i < queryUrls.length; i++) {
|
|
105
|
+
const queryUrl = queryUrls[i]
|
|
106
|
+
|
|
107
|
+
if (queryUrl.startsWith("./")) {
|
|
108
|
+
console.log(` Using local query ${i + 1}/${queryUrls.length}: ${queryUrl}`)
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
const localPath = path.resolve(path.dirname(configPath), queryUrl)
|
|
112
|
+
const content = await readFile(localPath, "utf-8")
|
|
113
|
+
|
|
114
|
+
if (content.trim()) {
|
|
115
|
+
queryContents.push(content)
|
|
116
|
+
console.log(` ✓ Loaded ${content.split("\n").length} lines from local file`)
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.warn(`Failed to read local query from ${queryUrl}: ${error}`)
|
|
120
|
+
continue
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
console.log(` Downloading query ${i + 1}/${queryUrls.length}: ${queryUrl}`)
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
const response = await fetch(queryUrl)
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
console.warn(`Failed to download query from ${queryUrl}: ${response.statusText}`)
|
|
129
|
+
continue
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const content = await response.text()
|
|
133
|
+
if (content.trim()) {
|
|
134
|
+
queryContents.push(`; Query from: ${queryUrl}\n${content}`)
|
|
135
|
+
console.log(` ✓ Downloaded ${content.split("\n").length} lines`)
|
|
136
|
+
}
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.warn(`Failed to download query from ${queryUrl}: ${error}`)
|
|
139
|
+
continue
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const combinedContent = queryContents.join("\n\n")
|
|
145
|
+
await writeFile(queryPath, combinedContent, "utf-8")
|
|
146
|
+
|
|
147
|
+
console.log(` Combined ${queryContents.length} queries into ${queryPath}`)
|
|
148
|
+
|
|
149
|
+
return "./" + path.relative(path.dirname(outputPath), queryPath)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async function generateDefaultParsersFile(parsers: GeneratedParser[], outputPath: string): Promise<void> {
|
|
153
|
+
const assetPaths = parsers
|
|
154
|
+
.map((parser) => {
|
|
155
|
+
const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, "_")
|
|
156
|
+
const lines = [
|
|
157
|
+
`const ${safeFiletype}_highlights = await resolveBundledFilePath(`,
|
|
158
|
+
` () => import("${parser.highlightsPath}" as string, { with: { type: "file" } }),`,
|
|
159
|
+
` "${parser.highlightsPath}",`,
|
|
160
|
+
` import.meta.url,`,
|
|
161
|
+
`)`,
|
|
162
|
+
`const ${safeFiletype}_language = await resolveBundledFilePath(`,
|
|
163
|
+
` () => import("${parser.languagePath}" as string, { with: { type: "file" } }),`,
|
|
164
|
+
` "${parser.languagePath}",`,
|
|
165
|
+
` import.meta.url,`,
|
|
166
|
+
`)`,
|
|
167
|
+
]
|
|
168
|
+
|
|
169
|
+
if (parser.injectionsPath) {
|
|
170
|
+
lines.push(
|
|
171
|
+
`const ${safeFiletype}_injections = await resolveBundledFilePath(`,
|
|
172
|
+
` () => import("${parser.injectionsPath}" as string, { with: { type: "file" } }),`,
|
|
173
|
+
` "${parser.injectionsPath}",`,
|
|
174
|
+
` import.meta.url,`,
|
|
175
|
+
`)`,
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return lines.join("\n")
|
|
180
|
+
})
|
|
181
|
+
.join("\n")
|
|
182
|
+
|
|
183
|
+
const parserDefinitions = parsers
|
|
184
|
+
.map((parser) => {
|
|
185
|
+
const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, "_")
|
|
186
|
+
const queriesLines = [` highlights: [${safeFiletype}_highlights],`]
|
|
187
|
+
|
|
188
|
+
if (parser.injectionsPath) {
|
|
189
|
+
queriesLines.push(` injections: [${safeFiletype}_injections],`)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const injectionMappingLine = parser.injectionMapping
|
|
193
|
+
? ` injectionMapping: ${JSON.stringify(parser.injectionMapping, null, 10)},`
|
|
194
|
+
: ""
|
|
195
|
+
const aliasesLine = parser.aliases?.length ? ` aliases: ${JSON.stringify(parser.aliases)},` : ""
|
|
196
|
+
|
|
197
|
+
return ` {
|
|
198
|
+
filetype: "${parser.filetype}",
|
|
199
|
+
${aliasesLine ? aliasesLine + "\n" : ""} queries: {
|
|
200
|
+
${queriesLines.join("\n")}
|
|
201
|
+
},
|
|
202
|
+
wasm: ${safeFiletype}_language,${injectionMappingLine ? "\n" + injectionMappingLine : ""}
|
|
203
|
+
}`
|
|
204
|
+
})
|
|
205
|
+
.join(",\n")
|
|
206
|
+
|
|
207
|
+
const fileContent = `// This file is generated by assets/update.ts - DO NOT EDIT MANUALLY
|
|
208
|
+
// Run 'bun assets/update.ts' to regenerate this file
|
|
209
|
+
// Last generated: ${new Date().toISOString()}
|
|
210
|
+
|
|
211
|
+
import type { FiletypeParserOptions } from "./types.js"
|
|
212
|
+
import { resolveBundledFilePath } from "../../platform/runtime.js"
|
|
213
|
+
|
|
214
|
+
// Cached parsers to avoid re-resolving paths on every call
|
|
215
|
+
let _cachedParsers: Promise<FiletypeParserOptions[]> | undefined
|
|
216
|
+
|
|
217
|
+
export function getParsers(): Promise<FiletypeParserOptions[]> {
|
|
218
|
+
if (!_cachedParsers) {
|
|
219
|
+
_cachedParsers = loadParsers()
|
|
220
|
+
}
|
|
221
|
+
return _cachedParsers
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
async function loadParsers(): Promise<FiletypeParserOptions[]> {
|
|
225
|
+
${assetPaths}
|
|
226
|
+
|
|
227
|
+
return [
|
|
228
|
+
${parserDefinitions},
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
`
|
|
232
|
+
|
|
233
|
+
await mkdir(path.dirname(outputPath), { recursive: true })
|
|
234
|
+
await writeFile(outputPath, fileContent, "utf-8")
|
|
235
|
+
console.log(`Generated ${path.basename(outputPath)} with ${parsers.length} parsers`)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
async function main(options?: Partial<UpdateOptions>): Promise<void> {
|
|
239
|
+
const opts = { ...getDefaultOptions(), ...options }
|
|
240
|
+
|
|
241
|
+
try {
|
|
242
|
+
console.log("Loading parsers configuration...")
|
|
243
|
+
console.log(` Config: ${opts.configPath}`)
|
|
244
|
+
console.log(` Assets Dir: ${opts.assetsDir}`)
|
|
245
|
+
console.log(` Output: ${opts.outputPath}`)
|
|
246
|
+
|
|
247
|
+
const config = await loadConfig(opts.configPath)
|
|
248
|
+
|
|
249
|
+
console.log(`Found ${config.parsers.length} parsers to process`)
|
|
250
|
+
|
|
251
|
+
const generatedParsers: GeneratedParser[] = []
|
|
252
|
+
|
|
253
|
+
for (const parser of config.parsers) {
|
|
254
|
+
console.log(`Processing ${parser.filetype}...`)
|
|
255
|
+
|
|
256
|
+
console.log(` Downloading language...`)
|
|
257
|
+
const languagePath = await downloadLanguage(parser.filetype, parser.wasm, opts.assetsDir, opts.outputPath)
|
|
258
|
+
|
|
259
|
+
console.log(` Downloading ${parser.queries.highlights.length} highlight queries...`)
|
|
260
|
+
const highlightsPath = await downloadAndCombineQueries(
|
|
261
|
+
parser.filetype,
|
|
262
|
+
parser.queries.highlights,
|
|
263
|
+
opts.assetsDir,
|
|
264
|
+
opts.outputPath,
|
|
265
|
+
"highlights",
|
|
266
|
+
opts.configPath,
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
let injectionsPath: string | undefined
|
|
270
|
+
if (parser.queries.injections && parser.queries.injections.length > 0) {
|
|
271
|
+
console.log(` Downloading ${parser.queries.injections.length} injection queries...`)
|
|
272
|
+
injectionsPath = await downloadAndCombineQueries(
|
|
273
|
+
parser.filetype,
|
|
274
|
+
parser.queries.injections,
|
|
275
|
+
opts.assetsDir,
|
|
276
|
+
opts.outputPath,
|
|
277
|
+
"injections",
|
|
278
|
+
opts.configPath,
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
generatedParsers.push({
|
|
283
|
+
filetype: parser.filetype,
|
|
284
|
+
aliases: parser.aliases,
|
|
285
|
+
languagePath,
|
|
286
|
+
highlightsPath,
|
|
287
|
+
injectionsPath,
|
|
288
|
+
injectionMapping: parser.injectionMapping,
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
console.log(` ✓ Completed ${parser.filetype}`)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
console.log("Generating output file...")
|
|
295
|
+
await generateDefaultParsersFile(generatedParsers, opts.outputPath)
|
|
296
|
+
|
|
297
|
+
console.log("✅ Update completed successfully!")
|
|
298
|
+
} catch (error) {
|
|
299
|
+
console.error("❌ Update failed:", error)
|
|
300
|
+
process.exit(1)
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function parseCLIArgs(): Partial<UpdateOptions> | null {
|
|
305
|
+
try {
|
|
306
|
+
const { values } = parseArgs({
|
|
307
|
+
args: process.argv.slice(2),
|
|
308
|
+
options: {
|
|
309
|
+
config: { type: "string" },
|
|
310
|
+
assets: { type: "string" },
|
|
311
|
+
output: { type: "string" },
|
|
312
|
+
help: { type: "boolean" },
|
|
313
|
+
},
|
|
314
|
+
strict: true,
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
if (values.help) {
|
|
318
|
+
const command = path.basename(Bun.argv[1] ?? "update-assets.js")
|
|
319
|
+
|
|
320
|
+
console.log(`Usage: bun ${command} [options]
|
|
321
|
+
|
|
322
|
+
Options:
|
|
323
|
+
--config <path> Path to parsers-config.json
|
|
324
|
+
--assets <path> Directory where .wasm and .scm files will be downloaded
|
|
325
|
+
--output <path> Path where the generated TypeScript file will be written
|
|
326
|
+
--help Show this help message
|
|
327
|
+
|
|
328
|
+
Examples:
|
|
329
|
+
# Use default paths (for OpenTUI core development)
|
|
330
|
+
bun ${command}
|
|
331
|
+
|
|
332
|
+
# Use custom paths (for application integration)
|
|
333
|
+
bun ${command} --config ./my-parsers.json --assets ./src/parsers --output ./src/parsers.ts
|
|
334
|
+
`)
|
|
335
|
+
process.exit(0)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const options: Partial<UpdateOptions> = {}
|
|
339
|
+
if (values.config) options.configPath = path.resolve(values.config)
|
|
340
|
+
if (values.assets) options.assetsDir = path.resolve(values.assets)
|
|
341
|
+
if (values.output) options.outputPath = path.resolve(values.output)
|
|
342
|
+
|
|
343
|
+
return Object.keys(options).length > 0 ? options : null
|
|
344
|
+
} catch (error) {
|
|
345
|
+
console.error(`Error parsing arguments: ${error}`)
|
|
346
|
+
console.log("Run with --help for usage information")
|
|
347
|
+
process.exit(1)
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export function runUpdateAssetsCli(): Promise<void> {
|
|
352
|
+
const cliOptions = parseCLIArgs()
|
|
353
|
+
return main(cliOptions || undefined)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (import.meta.main) {
|
|
357
|
+
await runUpdateAssetsCli()
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export { main as updateAssets }
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
; Query from: https://github.com/nvim-treesitter/nvim-treesitter/raw/refs/heads/master/queries/zig/highlights.scm
|
|
2
|
+
; Variables
|
|
3
|
+
(identifier) @variable
|
|
4
|
+
|
|
5
|
+
; Parameters
|
|
6
|
+
(parameter
|
|
7
|
+
name: (identifier) @variable.parameter)
|
|
8
|
+
|
|
9
|
+
(payload
|
|
10
|
+
(identifier) @variable.parameter)
|
|
11
|
+
|
|
12
|
+
; Types
|
|
13
|
+
(parameter
|
|
14
|
+
type: (identifier) @type)
|
|
15
|
+
|
|
16
|
+
((identifier) @type
|
|
17
|
+
(#lua-match? @type "^[A-Z_][a-zA-Z0-9_]*"))
|
|
18
|
+
|
|
19
|
+
(variable_declaration
|
|
20
|
+
(identifier) @type
|
|
21
|
+
"="
|
|
22
|
+
[
|
|
23
|
+
(struct_declaration)
|
|
24
|
+
(enum_declaration)
|
|
25
|
+
(union_declaration)
|
|
26
|
+
(opaque_declaration)
|
|
27
|
+
])
|
|
28
|
+
|
|
29
|
+
[
|
|
30
|
+
(builtin_type)
|
|
31
|
+
"anyframe"
|
|
32
|
+
] @type.builtin
|
|
33
|
+
|
|
34
|
+
; Constants
|
|
35
|
+
((identifier) @constant
|
|
36
|
+
(#lua-match? @constant "^[A-Z][A-Z_0-9]+$"))
|
|
37
|
+
|
|
38
|
+
[
|
|
39
|
+
"null"
|
|
40
|
+
"unreachable"
|
|
41
|
+
"undefined"
|
|
42
|
+
] @constant.builtin
|
|
43
|
+
|
|
44
|
+
(field_expression
|
|
45
|
+
.
|
|
46
|
+
member: (identifier) @constant)
|
|
47
|
+
|
|
48
|
+
(enum_declaration
|
|
49
|
+
(container_field
|
|
50
|
+
type: (identifier) @constant))
|
|
51
|
+
|
|
52
|
+
; Labels
|
|
53
|
+
(block_label
|
|
54
|
+
(identifier) @label)
|
|
55
|
+
|
|
56
|
+
(break_label
|
|
57
|
+
(identifier) @label)
|
|
58
|
+
|
|
59
|
+
; Fields
|
|
60
|
+
(field_initializer
|
|
61
|
+
.
|
|
62
|
+
(identifier) @variable.member)
|
|
63
|
+
|
|
64
|
+
(field_expression
|
|
65
|
+
(_)
|
|
66
|
+
member: (identifier) @variable.member)
|
|
67
|
+
|
|
68
|
+
(container_field
|
|
69
|
+
name: (identifier) @variable.member)
|
|
70
|
+
|
|
71
|
+
(initializer_list
|
|
72
|
+
(assignment_expression
|
|
73
|
+
left: (field_expression
|
|
74
|
+
.
|
|
75
|
+
member: (identifier) @variable.member)))
|
|
76
|
+
|
|
77
|
+
; Functions
|
|
78
|
+
(builtin_identifier) @function.builtin
|
|
79
|
+
|
|
80
|
+
(call_expression
|
|
81
|
+
function: (identifier) @function.call)
|
|
82
|
+
|
|
83
|
+
(call_expression
|
|
84
|
+
function: (field_expression
|
|
85
|
+
member: (identifier) @function.call))
|
|
86
|
+
|
|
87
|
+
(function_declaration
|
|
88
|
+
name: (identifier) @function)
|
|
89
|
+
|
|
90
|
+
; Modules
|
|
91
|
+
(variable_declaration
|
|
92
|
+
(identifier) @module
|
|
93
|
+
(builtin_function
|
|
94
|
+
(builtin_identifier) @keyword.import
|
|
95
|
+
(#any-of? @keyword.import "@import" "@cImport")))
|
|
96
|
+
|
|
97
|
+
; Builtins
|
|
98
|
+
[
|
|
99
|
+
"c"
|
|
100
|
+
"..."
|
|
101
|
+
] @variable.builtin
|
|
102
|
+
|
|
103
|
+
((identifier) @variable.builtin
|
|
104
|
+
(#eq? @variable.builtin "_"))
|
|
105
|
+
|
|
106
|
+
(calling_convention
|
|
107
|
+
(identifier) @variable.builtin)
|
|
108
|
+
|
|
109
|
+
; Keywords
|
|
110
|
+
[
|
|
111
|
+
"asm"
|
|
112
|
+
"defer"
|
|
113
|
+
"errdefer"
|
|
114
|
+
"test"
|
|
115
|
+
"error"
|
|
116
|
+
"const"
|
|
117
|
+
"var"
|
|
118
|
+
] @keyword
|
|
119
|
+
|
|
120
|
+
[
|
|
121
|
+
"struct"
|
|
122
|
+
"union"
|
|
123
|
+
"enum"
|
|
124
|
+
"opaque"
|
|
125
|
+
] @keyword.type
|
|
126
|
+
|
|
127
|
+
[
|
|
128
|
+
"async"
|
|
129
|
+
"await"
|
|
130
|
+
"suspend"
|
|
131
|
+
"nosuspend"
|
|
132
|
+
"resume"
|
|
133
|
+
] @keyword.coroutine
|
|
134
|
+
|
|
135
|
+
"fn" @keyword.function
|
|
136
|
+
|
|
137
|
+
[
|
|
138
|
+
"and"
|
|
139
|
+
"or"
|
|
140
|
+
"orelse"
|
|
141
|
+
] @keyword.operator
|
|
142
|
+
|
|
143
|
+
"return" @keyword.return
|
|
144
|
+
|
|
145
|
+
[
|
|
146
|
+
"if"
|
|
147
|
+
"else"
|
|
148
|
+
"switch"
|
|
149
|
+
] @keyword.conditional
|
|
150
|
+
|
|
151
|
+
[
|
|
152
|
+
"for"
|
|
153
|
+
"while"
|
|
154
|
+
"break"
|
|
155
|
+
"continue"
|
|
156
|
+
] @keyword.repeat
|
|
157
|
+
|
|
158
|
+
[
|
|
159
|
+
"usingnamespace"
|
|
160
|
+
"export"
|
|
161
|
+
] @keyword.import
|
|
162
|
+
|
|
163
|
+
[
|
|
164
|
+
"try"
|
|
165
|
+
"catch"
|
|
166
|
+
] @keyword.exception
|
|
167
|
+
|
|
168
|
+
[
|
|
169
|
+
"volatile"
|
|
170
|
+
"allowzero"
|
|
171
|
+
"noalias"
|
|
172
|
+
"addrspace"
|
|
173
|
+
"align"
|
|
174
|
+
"callconv"
|
|
175
|
+
"linksection"
|
|
176
|
+
"pub"
|
|
177
|
+
"inline"
|
|
178
|
+
"noinline"
|
|
179
|
+
"extern"
|
|
180
|
+
"comptime"
|
|
181
|
+
"packed"
|
|
182
|
+
"threadlocal"
|
|
183
|
+
] @keyword.modifier
|
|
184
|
+
|
|
185
|
+
; Operator
|
|
186
|
+
[
|
|
187
|
+
"="
|
|
188
|
+
"*="
|
|
189
|
+
"*%="
|
|
190
|
+
"*|="
|
|
191
|
+
"/="
|
|
192
|
+
"%="
|
|
193
|
+
"+="
|
|
194
|
+
"+%="
|
|
195
|
+
"+|="
|
|
196
|
+
"-="
|
|
197
|
+
"-%="
|
|
198
|
+
"-|="
|
|
199
|
+
"<<="
|
|
200
|
+
"<<|="
|
|
201
|
+
">>="
|
|
202
|
+
"&="
|
|
203
|
+
"^="
|
|
204
|
+
"|="
|
|
205
|
+
"!"
|
|
206
|
+
"~"
|
|
207
|
+
"-"
|
|
208
|
+
"-%"
|
|
209
|
+
"&"
|
|
210
|
+
"=="
|
|
211
|
+
"!="
|
|
212
|
+
">"
|
|
213
|
+
">="
|
|
214
|
+
"<="
|
|
215
|
+
"<"
|
|
216
|
+
"&"
|
|
217
|
+
"^"
|
|
218
|
+
"|"
|
|
219
|
+
"<<"
|
|
220
|
+
">>"
|
|
221
|
+
"<<|"
|
|
222
|
+
"+"
|
|
223
|
+
"++"
|
|
224
|
+
"+%"
|
|
225
|
+
"-%"
|
|
226
|
+
"+|"
|
|
227
|
+
"-|"
|
|
228
|
+
"*"
|
|
229
|
+
"/"
|
|
230
|
+
"%"
|
|
231
|
+
"**"
|
|
232
|
+
"*%"
|
|
233
|
+
"*|"
|
|
234
|
+
"||"
|
|
235
|
+
".*"
|
|
236
|
+
".?"
|
|
237
|
+
"?"
|
|
238
|
+
".."
|
|
239
|
+
] @operator
|
|
240
|
+
|
|
241
|
+
; Literals
|
|
242
|
+
(character) @character
|
|
243
|
+
|
|
244
|
+
([
|
|
245
|
+
(string)
|
|
246
|
+
(multiline_string)
|
|
247
|
+
] @string
|
|
248
|
+
(#set! "priority" 95))
|
|
249
|
+
|
|
250
|
+
(integer) @number
|
|
251
|
+
|
|
252
|
+
(float) @number.float
|
|
253
|
+
|
|
254
|
+
(boolean) @boolean
|
|
255
|
+
|
|
256
|
+
(escape_sequence) @string.escape
|
|
257
|
+
|
|
258
|
+
; Punctuation
|
|
259
|
+
[
|
|
260
|
+
"["
|
|
261
|
+
"]"
|
|
262
|
+
"("
|
|
263
|
+
")"
|
|
264
|
+
"{"
|
|
265
|
+
"}"
|
|
266
|
+
] @punctuation.bracket
|
|
267
|
+
|
|
268
|
+
[
|
|
269
|
+
";"
|
|
270
|
+
"."
|
|
271
|
+
","
|
|
272
|
+
":"
|
|
273
|
+
"=>"
|
|
274
|
+
"->"
|
|
275
|
+
] @punctuation.delimiter
|
|
276
|
+
|
|
277
|
+
(payload
|
|
278
|
+
"|" @punctuation.bracket)
|
|
279
|
+
|
|
280
|
+
; Comments
|
|
281
|
+
(comment) @comment @spell
|
|
282
|
+
|
|
283
|
+
((comment) @comment.documentation
|
|
284
|
+
(#lua-match? @comment.documentation "^//!"))
|
|
Binary file
|