From 24656e84fe6d98f6244ea23545aad1c57ee50363 Mon Sep 17 00:00:00 2001 From: Yesudeep Mangalapilly Date: Sat, 24 Jan 2026 17:17:55 -0800 Subject: [PATCH] feat(ide): add Monaco and CodeMirror packages and update CI config - Add `@dotprompt/monaco` package with Monarch grammar, completions, and hover - Add `@dotprompt/codemirror` package with Lezer-like stream parser and themes - Update Release Please config with new packages: - `@dotprompt/monaco` - `@dotprompt/codemirror` - `dotprompt-jetbrains` - `dotprompt-emacs` - `tree-sitter-dotprompt` - Add GitHub Actions workflows: - [web_editors.yml](cci:7://file:///Users/yesudeep/code/github.com/google/dotprompt/.github/workflows/web_editors.yml:0:0-0:0): Build/publish Monaco and CodeMirror - [ide_plugins.yml](cci:7://file:///Users/yesudeep/code/github.com/google/dotprompt/.github/workflows/ide_plugins.yml:0:0-0:0): Verify JetBrains, Vim, and Emacs plugins - [treesitter.yml](cci:7://file:///Users/yesudeep/code/github.com/google/dotprompt/.github/workflows/treesitter.yml:0:0-0:0): Generate and test Tree-sitter grammar --- .genkit/traces_idx/genkit.metadata | 1 - .github/workflows/ide_plugins.yml | 92 + .github/workflows/treesitter.yml | 78 + .github/workflows/web_editors.yml | 104 + .gitignore | 1 + .release-please-config.json | 47 + .release-please-manifest.json | 6 +- MODULE.bazel.lock | 2 +- go.MODULE.bazel | 1 + go/go.mod | 1 + go/go.sum | 2 + go/tools.go | 21 + package.json | 2 +- packages/codemirror/.gitignore | 17 + packages/codemirror/package.json | 60 + packages/codemirror/src/completions.ts | 378 +++ packages/codemirror/src/index.ts | 43 + packages/codemirror/src/language.ts | 258 ++ packages/codemirror/src/theme.ts | 115 + packages/codemirror/tsconfig.json | 19 + packages/monaco/.gitignore | 17 + packages/monaco/README.md | 197 ++ packages/monaco/package-lock.json | 1484 ++++++++++ packages/monaco/package.json | 50 + packages/monaco/src/completions.ts | 393 +++ packages/monaco/src/hover.ts | 278 ++ packages/monaco/src/index.ts | 228 ++ packages/monaco/src/language.ts | 293 ++ packages/monaco/tsconfig.json | 19 + packages/treesitter/.editorconfig | 39 + packages/treesitter/.gitattributes | 11 + packages/treesitter/.gitignore | 38 + packages/treesitter/BUILD.bazel | 23 + packages/treesitter/Cargo.toml | 39 + packages/treesitter/Makefile | 112 + packages/treesitter/Package.swift | 63 + packages/treesitter/binding.gyp | 30 + .../bindings/c/tree-sitter-dotprompt.h | 34 + .../bindings/c/tree-sitter-dotprompt.pc.in | 11 + packages/treesitter/bindings/go/BUILD.bazel | 36 + packages/treesitter/bindings/go/binding.go | 29 + .../treesitter/bindings/go/binding_test.go | 31 + packages/treesitter/bindings/go/go.mod | 5 + packages/treesitter/bindings/node/binding.cc | 36 + packages/treesitter/bindings/node/index.d.ts | 46 + packages/treesitter/bindings/node/index.js | 25 + .../python/tree_sitter_dotprompt/__init__.py | 21 + .../python/tree_sitter_dotprompt/__init__.pyi | 1 + .../python/tree_sitter_dotprompt/binding.c | 45 + .../python/tree_sitter_dotprompt/py.typed | 0 packages/treesitter/bindings/rust/build.rs | 38 + packages/treesitter/bindings/rust/lib.rs | 70 + .../swift/TreeSitterDotprompt/dotprompt.h | 34 + packages/treesitter/grammar.js | 164 +- packages/treesitter/package.json | 10 +- packages/treesitter/pyproject.toml | 45 + packages/treesitter/queries/highlights.scm | 89 +- packages/treesitter/setup.py | 76 + packages/treesitter/src/grammar.json | 587 ++++ packages/treesitter/src/node-types.json | 488 ++++ packages/treesitter/src/parser.c | 2491 +++++++++++++++++ packages/treesitter/src/tree_sitter/alloc.h | 72 + packages/treesitter/src/tree_sitter/array.h | 308 ++ packages/treesitter/src/tree_sitter/parser.h | 283 ++ packages/treesitter/test/corpus/basic.txt | 71 +- pnpm-lock.yaml | 736 ++++- pnpm-workspace.yaml | 3 + third_party/docsite/package.json | 4 +- 68 files changed, 10239 insertions(+), 212 deletions(-) delete mode 100644 .genkit/traces_idx/genkit.metadata create mode 100644 .github/workflows/ide_plugins.yml create mode 100644 .github/workflows/treesitter.yml create mode 100644 .github/workflows/web_editors.yml create mode 100644 go/tools.go create mode 100644 packages/codemirror/.gitignore create mode 100644 packages/codemirror/package.json create mode 100644 packages/codemirror/src/completions.ts create mode 100644 packages/codemirror/src/index.ts create mode 100644 packages/codemirror/src/language.ts create mode 100644 packages/codemirror/src/theme.ts create mode 100644 packages/codemirror/tsconfig.json create mode 100644 packages/monaco/.gitignore create mode 100644 packages/monaco/README.md create mode 100644 packages/monaco/package-lock.json create mode 100644 packages/monaco/package.json create mode 100644 packages/monaco/src/completions.ts create mode 100644 packages/monaco/src/hover.ts create mode 100644 packages/monaco/src/index.ts create mode 100644 packages/monaco/src/language.ts create mode 100644 packages/monaco/tsconfig.json create mode 100644 packages/treesitter/.editorconfig create mode 100644 packages/treesitter/.gitattributes create mode 100644 packages/treesitter/.gitignore create mode 100644 packages/treesitter/BUILD.bazel create mode 100644 packages/treesitter/Cargo.toml create mode 100644 packages/treesitter/Makefile create mode 100644 packages/treesitter/Package.swift create mode 100644 packages/treesitter/binding.gyp create mode 100644 packages/treesitter/bindings/c/tree-sitter-dotprompt.h create mode 100644 packages/treesitter/bindings/c/tree-sitter-dotprompt.pc.in create mode 100644 packages/treesitter/bindings/go/BUILD.bazel create mode 100644 packages/treesitter/bindings/go/binding.go create mode 100644 packages/treesitter/bindings/go/binding_test.go create mode 100644 packages/treesitter/bindings/go/go.mod create mode 100644 packages/treesitter/bindings/node/binding.cc create mode 100644 packages/treesitter/bindings/node/index.d.ts create mode 100644 packages/treesitter/bindings/node/index.js create mode 100644 packages/treesitter/bindings/python/tree_sitter_dotprompt/__init__.py create mode 100644 packages/treesitter/bindings/python/tree_sitter_dotprompt/__init__.pyi create mode 100644 packages/treesitter/bindings/python/tree_sitter_dotprompt/binding.c create mode 100644 packages/treesitter/bindings/python/tree_sitter_dotprompt/py.typed create mode 100644 packages/treesitter/bindings/rust/build.rs create mode 100644 packages/treesitter/bindings/rust/lib.rs create mode 100644 packages/treesitter/bindings/swift/TreeSitterDotprompt/dotprompt.h create mode 100644 packages/treesitter/pyproject.toml create mode 100644 packages/treesitter/setup.py create mode 100644 packages/treesitter/src/grammar.json create mode 100644 packages/treesitter/src/node-types.json create mode 100644 packages/treesitter/src/parser.c create mode 100644 packages/treesitter/src/tree_sitter/alloc.h create mode 100644 packages/treesitter/src/tree_sitter/array.h create mode 100644 packages/treesitter/src/tree_sitter/parser.h diff --git a/.genkit/traces_idx/genkit.metadata b/.genkit/traces_idx/genkit.metadata deleted file mode 100644 index d29770399..000000000 --- a/.genkit/traces_idx/genkit.metadata +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.21.0"} \ No newline at end of file diff --git a/.github/workflows/ide_plugins.yml b/.github/workflows/ide_plugins.yml new file mode 100644 index 000000000..e56ad657d --- /dev/null +++ b/.github/workflows/ide_plugins.yml @@ -0,0 +1,92 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: IDE Plugins + +on: + push: + branches: [main] + paths: + - 'packages/jetbrains/**' + - 'packages/vim/**' + - 'packages/emacs/**' + pull_request: + branches: [main] + paths: + - 'packages/jetbrains/**' + - 'packages/vim/**' + - 'packages/emacs/**' + workflow_dispatch: + +jobs: + jetbrains: + name: JetBrains Plugin + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build Plugin + working-directory: packages/jetbrains + run: ./gradlew buildPlugin + + - name: Verify Plugin + working-directory: packages/jetbrains + run: ./gradlew verifyPlugin + + - name: Publish Plugin + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.modified, 'packages/jetbrains/src/main/resources/META-INF/plugin.xml') + working-directory: packages/jetbrains + run: ./gradlew publishPlugin + env: + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_TOKEN }} + + vim: + name: Vim/Neovim + runs-on: ubuntu-latest + steps: + # Simple check for syntax validity + - uses: actions/checkout@v4 + + - name: Check Lua syntax + uses: JohnnyMorganz/stylua-action@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + args: --check packages/vim/lua/ + + emacs: + name: Emacs Mode + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Emacs + uses: purcell/setup-emacs@master + with: + version: 29.1 + + - name: Byte compile + working-directory: packages/emacs + run: emacs -Q -batch -L . -f batch-byte-compile dotprompt-mode.el diff --git a/.github/workflows/treesitter.yml b/.github/workflows/treesitter.yml new file mode 100644 index 000000000..62433b73b --- /dev/null +++ b/.github/workflows/treesitter.yml @@ -0,0 +1,78 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Tree-sitter + +on: + push: + branches: [main] + paths: + - 'packages/treesitter/**' + pull_request: + branches: [main] + paths: + - 'packages/treesitter/**' + workflow_dispatch: + +jobs: + test: + name: Test and Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + working-directory: packages/treesitter + run: npm install + + - name: Generate parser + working-directory: packages/treesitter + run: npm run generate + + - name: Run tests + working-directory: packages/treesitter + run: npm run test + + publish: + name: Publish to NPM + needs: test + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.modified, 'packages/treesitter/package.json') + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Publish + working-directory: packages/treesitter + run: | + npm install + npm run build + npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/web_editors.yml b/.github/workflows/web_editors.yml new file mode 100644 index 000000000..5424cb93c --- /dev/null +++ b/.github/workflows/web_editors.yml @@ -0,0 +1,104 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Web Editor Packages + +on: + push: + branches: [main] + paths: + - 'packages/monaco/**' + - 'packages/codemirror/**' + pull_request: + branches: [main] + paths: + - 'packages/monaco/**' + - 'packages/codemirror/**' + workflow_dispatch: + +jobs: + test: + name: Test and Build + runs-on: ubuntu-latest + strategy: + matrix: + package: [monaco, codemirror] + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + + - name: Install dependencies + working-directory: packages/${{ matrix.package }} + run: pnpm install + + - name: Typecheck + working-directory: packages/${{ matrix.package }} + run: pnpm run typecheck + + - name: Build + working-directory: packages/${{ matrix.package }} + run: pnpm run build + + publish: + name: Publish to NPM + needs: test + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + + - name: Publish Monaco + if: contains(github.event.head_commit.modified, 'packages/monaco/package.json') + working-directory: packages/monaco + run: | + pnpm install + pnpm run build + pnpm publish --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish CodeMirror + if: contains(github.event.head_commit.modified, 'packages/codemirror/package.json') + working-directory: packages/codemirror + run: | + pnpm install + pnpm run build + pnpm publish --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 9b2f0d66e..0995c4aba 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ python/.tox python/handlebarrz/target site/ target/ +.genkit/ diff --git a/.release-please-config.json b/.release-please-config.json index 28884a555..978e6726a 100644 --- a/.release-please-config.json +++ b/.release-please-config.json @@ -143,6 +143,53 @@ "draft": false, "prerelease": false, "path": "packages/emacs" + }, + "packages/monaco": { + "release-type": "node", + "package-name": "@dotprompt/monaco", + "changelog-path": "CHANGELOG.md", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "draft": false, + "prerelease": false, + "path": "packages/monaco" + }, + "packages/codemirror": { + "release-type": "node", + "package-name": "@dotprompt/codemirror", + "changelog-path": "CHANGELOG.md", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "draft": false, + "prerelease": false, + "path": "packages/codemirror" + }, + "packages/jetbrains": { + "release-type": "simple", + "package-name": "dotprompt-jetbrains", + "changelog-path": "CHANGELOG.md", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "draft": false, + "prerelease": false, + "path": "packages/jetbrains", + "extra-files": [ + { + "type": "xml", + "path": "src/main/resources/META-INF/plugin.xml", + "jsonpath": "idea-plugin.change-notes" + } + ] + }, + "packages/treesitter": { + "release-type": "node", + "package-name": "tree-sitter-dotprompt", + "changelog-path": "CHANGELOG.md", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "draft": false, + "prerelease": false, + "path": "packages/treesitter" } }, "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b578dfcc0..2e5e44d04 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -7,5 +7,9 @@ "rs": "0.1.0", "packages/vscode": "0.0.1", "packages/vim": "0.1.0", - "packages/emacs": "0.1.0" + "packages/emacs": "0.1.0", + "packages/monaco": "0.1.0", + "packages/codemirror": "0.1.0", + "packages/jetbrains": "0.2.0", + "packages/treesitter": "0.1.0" } diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 4dc220e19..5ed742adc 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -430,7 +430,7 @@ "bzlTransitiveDigest": "vNLGL9GTi8PaP46e/11lxRuFDmmGkBjize7/iPfRypI=", "usagesDigest": "DERK4k9FbVzQIB4bXDGJ1nM+IQ2xMRKyoKFkkDE1cIk=", "recordedFileInputs": { - "@@//package.json": "855b220a6c4203c1831c4a787b832c038570e3ed24782d2d3b67501b45592a87" + "@@//package.json": "7e1a5834d3f7355d90deb8d693833f2d6109385dc603b18f96d9657339cbd23c" }, "recordedDirentsInputs": {}, "envVariables": {}, diff --git a/go.MODULE.bazel b/go.MODULE.bazel index 6834d6535..3eed8c0a8 100644 --- a/go.MODULE.bazel +++ b/go.MODULE.bazel @@ -37,6 +37,7 @@ use_repo( "com_github_goccy_go_yaml", "com_github_invopop_jsonschema", "com_github_mbleigh_raymond", + "com_github_smacker_go_tree_sitter", "com_github_stretchr_testify", "com_github_wk8_go_ordered_map_v2", "org_golang_x_text", diff --git a/go/go.mod b/go/go.mod index 50848eaaa..df0614bbe 100644 --- a/go/go.mod +++ b/go/go.mod @@ -16,6 +16,7 @@ require ( require ( github.com/mbleigh/raymond v0.0.0-20250414171441-6b3a58ab9e0a + github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82 github.com/wk8/go-ordered-map/v2 v2.1.8 golang.org/x/text v0.33.0 ) diff --git a/go/go.sum b/go/go.sum index 2b581fcf9..a34086540 100644 --- a/go/go.sum +++ b/go/go.sum @@ -16,6 +16,8 @@ github.com/mbleigh/raymond v0.0.0-20250414171441-6b3a58ab9e0a h1:v2cBA3xWKv2cIOV github.com/mbleigh/raymond v0.0.0-20250414171441-6b3a58ab9e0a/go.mod h1:Y6ghKH+ZijXn5d9E7qGGZBmjitx7iitZdQiIW97EpTU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82 h1:6C8qej6f1bStuePVkLSFxoU22XBS165D3klxlzRg8F4= +github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82/go.mod h1:xe4pgH49k4SsmkQq5OT8abwhWmnzkhpgnXeekbx2efw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= diff --git a/go/tools.go b/go/tools.go new file mode 100644 index 000000000..edc08b087 --- /dev/null +++ b/go/tools.go @@ -0,0 +1,21 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +//go:build tools + +package tools + +import _ "github.com/smacker/go-tree-sitter" diff --git a/package.json b/package.json index 81810266f..38b80d935 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "packageManager": "pnpm@10.25.0", "scripts": { - "build": "pnpm -C js build", + "build": "pnpm -r run --if-present build", "format": "pnpm dlx @biomejs/biome check --formatter-enabled=true --linter-enabled=false --fix . && scripts/add_license", "format:check": "pnpm dlx @biomejs/biome ci --linter-enabled=false --formatter-enabled=true . && scripts/check_license", "lint": "pnpm dlx @biomejs/biome lint --fix . && scripts/add_license", diff --git a/packages/codemirror/.gitignore b/packages/codemirror/.gitignore new file mode 100644 index 000000000..66a838584 --- /dev/null +++ b/packages/codemirror/.gitignore @@ -0,0 +1,17 @@ +# Dependencies +node_modules/ + +# Build output +dist/ + +# Package files +*.tgz + +# IDE +.idea/ +*.iml +.vscode/ + +# OS files +.DS_Store +Thumbs.db diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json new file mode 100644 index 000000000..7a87b5fad --- /dev/null +++ b/packages/codemirror/package.json @@ -0,0 +1,60 @@ +{ + "name": "@dotprompt/codemirror", + "version": "0.1.0", + "description": "CodeMirror 6 language support for Dotprompt (.prompt) files", + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + } + }, + "files": [ + "dist" + ], + "scripts": { + "build": "tsup src/index.ts --format cjs,esm --dts", + "watch": "tsup src/index.ts --format cjs,esm --dts --watch", + "typecheck": "tsc --noEmit", + "lint": "biome check . && tsc --noEmit", + "format": "biome check --write ." + }, + "repository": { + "type": "git", + "url": "https://github.com/google/dotprompt.git", + "directory": "packages/codemirror" + }, + "keywords": [ + "codemirror", + "editor", + "dotprompt", + "prompt", + "llm", + "syntax-highlighting", + "genkit" + ], + "author": "Google", + "license": "Apache-2.0", + "peerDependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + }, + "devDependencies": { + "@codemirror/autocomplete": "^6.18.0", + "@codemirror/language": "^6.10.0", + "@codemirror/state": "^6.4.0", + "@codemirror/view": "^6.35.0", + "@lezer/highlight": "^1.2.0", + "@lezer/lr": "^1.4.0", + "tsup": "^8.0.0", + "typescript": "^5.3.0", + "@biomejs/biome": "^1.5.0" + } +} diff --git a/packages/codemirror/src/completions.ts b/packages/codemirror/src/completions.ts new file mode 100644 index 000000000..8ead386e3 --- /dev/null +++ b/packages/codemirror/src/completions.ts @@ -0,0 +1,378 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { + Completion, + CompletionContext, + CompletionResult, +} from '@codemirror/autocomplete'; + +/** + * Handlebars helper completions. + */ +const HANDLEBARS_HELPERS: Completion[] = [ + { + label: 'if', + type: 'keyword', + info: 'Conditionally renders content when the condition is truthy.', + apply: '{{#if ${condition}}}\n\t\n{{/if}}', + }, + { + label: 'unless', + type: 'keyword', + info: 'Inverse of if - renders content when the condition is falsy.', + apply: '{{#unless ${condition}}}\n\t\n{{/unless}}', + }, + { + label: 'each', + type: 'keyword', + info: 'Iterates over arrays or objects.', + apply: '{{#each ${items}}}\n\t{{this}}\n{{/each}}', + }, + { + label: 'with', + type: 'keyword', + info: 'Changes the current context for the enclosed block.', + apply: '{{#with ${context}}}\n\t\n{{/with}}', + }, + { + label: 'else', + type: 'keyword', + info: 'Else branch for if/unless blocks.', + apply: '{{else}}', + }, + { + label: 'log', + type: 'function', + info: 'Logs a value to the console for debugging.', + apply: '{{log ${value}}}', + }, + { + label: 'lookup', + type: 'function', + info: 'Dynamically looks up a value by key from an object.', + apply: '{{lookup ${object} ${key}}}', + }, +]; + +/** + * Dotprompt-specific helper completions. + */ +const DOTPROMPT_HELPERS: Completion[] = [ + { + label: 'role', + type: 'keyword', + info: 'Defines a message with a specific role (system, user, model).', + apply: '{{#role "${role}"}}\n\t\n{{/role}}', + boost: 10, + }, + { + label: 'json', + type: 'function', + info: 'Serializes a value to JSON format.', + apply: '{{ json ${value} }}', + }, + { + label: 'history', + type: 'function', + info: 'Inserts the conversation history at this point.', + apply: '{{history}}', + }, + { + label: 'section', + type: 'keyword', + info: 'Defines a named section that can be referenced elsewhere.', + apply: '{{#section "${name}"}}\n\t\n{{/section}}', + }, + { + label: 'media', + type: 'function', + info: 'Embeds media content (images, audio, video) by URL.', + apply: '{{media url=${url}}}', + }, + { + label: 'ifEquals', + type: 'keyword', + info: 'Renders content when two values are equal.', + apply: '{{#ifEquals ${value1} ${value2}}}\n\t\n{{/ifEquals}}', + }, + { + label: 'unlessEquals', + type: 'keyword', + info: 'Renders content when two values are NOT equal.', + apply: '{{#unlessEquals ${value1} ${value2}}}\n\t\n{{/unlessEquals}}', + }, +]; + +/** + * Role snippet completions. + */ +const ROLE_SNIPPETS: Completion[] = [ + { + label: 'system', + type: 'text', + info: "System role block - sets the AI's behavior and context.", + apply: '{{#role "system"}}\n\t\n{{/role}}', + boost: 5, + }, + { + label: 'user', + type: 'text', + info: 'User role block - represents user input.', + apply: '{{#role "user"}}\n\t\n{{/role}}', + boost: 5, + }, + { + label: 'model', + type: 'text', + info: 'Model role block - represents AI responses (for few-shot examples).', + apply: '{{#role "model"}}\n\t\n{{/role}}', + boost: 5, + }, +]; + +/** + * Frontmatter field completions. + */ +const FRONTMATTER_FIELDS: Completion[] = [ + { + label: 'model', + type: 'property', + info: 'The AI model to use for this prompt.', + apply: 'model: ', + }, + { + label: 'config', + type: 'property', + info: 'Model configuration options.', + apply: 'config:\n temperature: 0.7', + }, + { + label: 'input', + type: 'property', + info: 'Input schema definition.', + apply: 'input:\n schema:\n name: string', + }, + { + label: 'output', + type: 'property', + info: 'Output format and schema.', + apply: 'output:\n format: json', + }, + { + label: 'tools', + type: 'property', + info: 'Tools/functions available to the model.', + apply: 'tools:\n - ', + }, + { + label: 'temperature', + type: 'property', + info: 'Controls randomness (0.0-2.0).', + apply: 'temperature: 0.7', + }, + { + label: 'maxOutputTokens', + type: 'property', + info: 'Maximum number of tokens in the response.', + apply: 'maxOutputTokens: 1024', + }, +]; + +/** + * Model name completions. + */ +const MODEL_NAMES: Completion[] = [ + { + label: 'gemini-2.0-flash', + type: 'constant', + info: 'Fast Gemini 2.0 model', + }, + { + label: 'gemini-2.0-flash-lite', + type: 'constant', + info: 'Lightweight Gemini 2.0', + }, + { + label: 'gemini-1.5-pro', + type: 'constant', + info: 'Gemini 1.5 Pro (2M context)', + }, + { + label: 'gemini-1.5-flash', + type: 'constant', + info: 'Fast Gemini 1.5 model', + }, + { label: 'gpt-4o', type: 'constant', info: 'OpenAI GPT-4o' }, + { label: 'gpt-4o-mini', type: 'constant', info: 'OpenAI GPT-4o Mini' }, + { + label: 'claude-3-5-sonnet', + type: 'constant', + info: 'Anthropic Claude 3.5 Sonnet', + }, + { label: 'claude-3-opus', type: 'constant', info: 'Anthropic Claude 3 Opus' }, +]; + +/** + * Completion source for Dotprompt files. + */ +export function dotpromptCompletions( + context: CompletionContext +): CompletionResult | null { + const { state, pos } = context; + const doc = state.doc; + const text = doc.toString(); + const textBefore = text.slice(0, pos); + const line = doc.lineAt(pos); + const lineText = line.text; + const lineBefore = lineText.slice(0, pos - line.from); + + // Check if we're in frontmatter + const frontmatterMatches = textBefore.split('---'); + const isInFrontmatter = frontmatterMatches.length === 2; + + if (isInFrontmatter) { + // After "model: " - suggest model names + if (/model:\s*$/.test(lineBefore)) { + return { + from: pos, + options: MODEL_NAMES, + }; + } + + // At line start - suggest frontmatter fields + if (/^\s*$/.test(lineBefore)) { + return { + from: pos, + options: FRONTMATTER_FIELDS, + }; + } + + // Typing a field name + const fieldMatch = lineBefore.match(/^\s*(\w*)$/); + if (fieldMatch) { + return { + from: pos - fieldMatch[1].length, + options: FRONTMATTER_FIELDS, + }; + } + + return null; + } + + // Check if we're inside a Handlebars expression + const handlebarsMatch = lineBefore.match(/\{\{([#/]?)(\w*)$/); + if (handlebarsMatch) { + const [, prefix, word] = handlebarsMatch; + const from = pos - word.length; + + // After {{# - block helpers + if (prefix === '#') { + const blockHelpers = [ + ...HANDLEBARS_HELPERS.filter((h) => + ['if', 'unless', 'each', 'with'].includes(h.label) + ), + ...DOTPROMPT_HELPERS.filter((h) => + ['role', 'section', 'ifEquals', 'unlessEquals'].includes(h.label) + ), + ].map((h) => ({ + ...h, + apply: h.label, // Just insert the helper name after {{# + })); + + return { + from, + options: blockHelpers, + }; + } + + // After {{/ - closing block name + if (prefix === '/') { + const blockNames = [ + 'if', + 'unless', + 'each', + 'with', + 'role', + 'section', + 'ifEquals', + 'unlessEquals', + ].map((name) => ({ + label: name, + type: 'keyword' as const, + apply: name, + })); + + return { + from, + options: blockNames, + }; + } + + // After {{ - all helpers + return { + from, + options: [...HANDLEBARS_HELPERS, ...DOTPROMPT_HELPERS], + }; + } + + // Check for { - suggest starting expressions + if (lineBefore.endsWith('{')) { + return { + from: pos, + options: [ + { + label: '{{', + type: 'text', + info: 'Start a Handlebars expression', + apply: '{ }}', + }, + { + label: '{{#', + type: 'text', + info: 'Start a Handlebars block', + apply: '{# }}', + }, + { + label: '{{>', + type: 'text', + info: 'Include a partial', + apply: '{> }}', + }, + { + label: '{{!', + type: 'text', + info: 'Add a comment', + apply: '{! }}', + }, + ], + }; + } + + // General completions - role snippets + const wordMatch = lineBefore.match(/(\w+)$/); + if (wordMatch) { + const from = pos - wordMatch[1].length; + return { + from, + options: ROLE_SNIPPETS, + }; + } + + return null; +} diff --git a/packages/codemirror/src/index.ts b/packages/codemirror/src/index.ts new file mode 100644 index 000000000..d92562e2d --- /dev/null +++ b/packages/codemirror/src/index.ts @@ -0,0 +1,43 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Extension } from '@codemirror/state'; +import { dotpromptCompletions } from './completions'; +import { dotpromptLanguage } from './language'; + +export { dotpromptCompletions } from './completions'; +export { dotpromptLanguage, dotpromptStreamParser } from './language'; +export { + dotpromptDarkHighlighting, + dotpromptDarkTheme, + dotpromptLightHighlighting, + dotpromptLightTheme, +} from './theme'; + +/** + * Dotprompt language support for CodeMirror. + * Includes language definition and completion. + */ +export function dotprompt(): Extension { + return [ + dotpromptLanguage, + dotpromptLanguage.data.of({ + autocomplete: dotpromptCompletions, + }), + ]; +} diff --git a/packages/codemirror/src/language.ts b/packages/codemirror/src/language.ts new file mode 100644 index 000000000..c58e8575d --- /dev/null +++ b/packages/codemirror/src/language.ts @@ -0,0 +1,258 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { StreamLanguage, StringStream } from '@codemirror/language'; + +/** + * Token types for Dotprompt syntax. + */ +type TokenType = + | 'comment' + | 'keyword' + | 'string' + | 'number' + | 'atom' + | 'variable' + | 'variable-2' + | 'variable-3' + | 'meta' + | 'bracket' + | 'tag' + | 'attribute' + | 'property' + | 'operator' + | null; + +/** + * Parser state for the Dotprompt StreamLanguage. + */ +interface DotpromptState { + /** Current parsing context */ + context: 'root' | 'frontmatter' | 'template' | 'handlebars'; + /** Whether we're in a block comment */ + inBlockComment: boolean; + /** Depth of nested handlebars blocks */ + blockDepth: number; +} + +/** + * StreamLanguage mode for Dotprompt. + */ +export const dotpromptStreamParser = { + name: 'dotprompt', + startState(): DotpromptState { + return { + context: 'root', + inBlockComment: false, + blockDepth: 0, + }; + }, + + token(stream: StringStream, state: DotpromptState): TokenType { + // Handle block comments + if (state.inBlockComment) { + if (stream.match('--}}') || stream.match('}}')) { + state.inBlockComment = false; + return 'comment'; + } + stream.next(); + return 'comment'; + } + + // Root state - looking for frontmatter or template content + if (state.context === 'root') { + // License header comments + if (stream.sol() && stream.match(/^#.*/)) { + return 'comment'; + } + + // Frontmatter delimiter + if (stream.sol() && stream.match(/^---\s*$/)) { + state.context = 'frontmatter'; + return 'meta'; + } + + state.context = 'template'; + } + + // Frontmatter parsing (YAML-like) + if (state.context === 'frontmatter') { + // End of frontmatter + if (stream.sol() && stream.match(/^---\s*$/)) { + state.context = 'template'; + return 'meta'; + } + + // YAML comments + if (stream.match(/#.*/)) { + return 'comment'; + } + + // YAML key + if (stream.sol() && stream.match(/[a-zA-Z_][a-zA-Z0-9_-]*(?=\s*:)/)) { + return 'property'; + } + + // Colon + if (stream.match(':')) { + return 'operator'; + } + + // Strings + if (stream.match(/"([^"\\]|\\.)*"/)) { + return 'string'; + } + if (stream.match(/'([^'\\]|\\.)*'/)) { + return 'string'; + } + + // Numbers + if (stream.match(/\d+(\.\d+)?/)) { + return 'number'; + } + + // Booleans and null + if (stream.match(/\b(true|false|null)\b/)) { + return 'atom'; + } + + // Indented keys + if (stream.match(/[a-zA-Z_][a-zA-Z0-9_-]*(?=\s*:)/)) { + return 'property'; + } + + stream.next(); + return null; + } + + // Template parsing + if (state.context === 'template') { + // Block comment start {{!-- or {{! + if (stream.match('{{!--')) { + state.inBlockComment = true; + return 'comment'; + } + if (stream.match('{{!')) { + if (stream.match(/.*?\}\}/)) { + return 'comment'; + } + state.inBlockComment = true; + return 'comment'; + } + + // Dotprompt markers + if (stream.match(/<<]+>>>/)) { + return 'keyword'; + } + + // Handlebars block start {{#helper + if (stream.match(/\{\{#/)) { + state.context = 'handlebars'; + state.blockDepth++; + return 'bracket'; + } + + // Handlebars block end {{/helper}} + if (stream.match(/\{\{\//)) { + state.context = 'handlebars'; + state.blockDepth = Math.max(0, state.blockDepth - 1); + return 'bracket'; + } + + // Handlebars partials {{> + if (stream.match(/\{\{>/)) { + state.context = 'handlebars'; + return 'bracket'; + } + + // Handlebars expression start {{ + if (stream.match('{{')) { + state.context = 'handlebars'; + return 'bracket'; + } + + // Plain text + stream.next(); + return null; + } + + // Handlebars expression parsing + if (state.context === 'handlebars') { + stream.eatSpace(); + + // Close expression }} + if (stream.match('}}')) { + state.context = 'template'; + return 'bracket'; + } + + // Handlebars keywords + if (stream.match(/\b(if|unless|each|with|else|log|lookup)\b/)) { + return 'keyword'; + } + + // Dotprompt helpers + if ( + stream.match( + /\b(json|role|history|section|media|ifEquals|unlessEquals)\b/ + ) + ) { + return 'variable-2'; + } + + // @ variables + if (stream.match(/@[a-zA-Z_][a-zA-Z0-9_]*/)) { + return 'variable-3'; + } + + // Strings + if (stream.match(/"([^"\\]|\\.)*"/)) { + return 'string'; + } + if (stream.match(/'([^'\\]|\\.)*'/)) { + return 'string'; + } + + // Numbers + if (stream.match(/\d+/)) { + return 'number'; + } + + // Operators + if (stream.match(/[=]/)) { + return 'operator'; + } + + // Variable/path + if (stream.match(/[a-zA-Z_][a-zA-Z0-9_.]*/)) { + return 'variable'; + } + + stream.next(); + return null; + } + + stream.next(); + return null; + }, +}; + +/** + * CodeMirror StreamLanguage instance for Dotprompt. + */ +export const dotpromptLanguage = StreamLanguage.define(dotpromptStreamParser); diff --git a/packages/codemirror/src/theme.ts b/packages/codemirror/src/theme.ts new file mode 100644 index 000000000..5059505d2 --- /dev/null +++ b/packages/codemirror/src/theme.ts @@ -0,0 +1,115 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { HighlightStyle, syntaxHighlighting } from '@codemirror/language'; +import { tags } from '@lezer/highlight'; + +/** + * Dark theme highlighting for Dotprompt. + * Uses colors similar to VS Code's dark theme. + */ +export const dotpromptDarkHighlighting = HighlightStyle.define([ + // Comments + { tag: tags.comment, color: '#6A9955', fontStyle: 'italic' }, + + // Keywords (if, each, etc.) + { tag: tags.keyword, color: '#C586C0' }, + + // Dotprompt helpers (role, json, etc.) - variable-2 + { tag: tags.special(tags.variableName), color: '#4EC9B0' }, + + // Variables + { tag: tags.variableName, color: '#9CDCFE' }, + + // @ variables - variable-3 + { tag: tags.local(tags.variableName), color: '#4FC1FF' }, + + // Strings + { tag: tags.string, color: '#CE9178' }, + + // Numbers + { tag: tags.number, color: '#B5CEA8' }, + + // Booleans and null + { tag: tags.atom, color: '#569CD6' }, + + // Property names (YAML keys) + { tag: tags.propertyName, color: '#569CD6' }, + + // Operators + { tag: tags.operator, color: '#D4D4D4' }, + + // Brackets/delimiters + { tag: tags.bracket, color: '#DCDCAA' }, + + // Meta (frontmatter delimiters) + { tag: tags.meta, color: '#6A9955' }, +]); + +/** + * Light theme highlighting for Dotprompt. + */ +export const dotpromptLightHighlighting = HighlightStyle.define([ + // Comments + { tag: tags.comment, color: '#008000', fontStyle: 'italic' }, + + // Keywords + { tag: tags.keyword, color: '#AF00DB' }, + + // Dotprompt helpers + { tag: tags.special(tags.variableName), color: '#267F99' }, + + // Variables + { tag: tags.variableName, color: '#001080' }, + + // @ variables + { tag: tags.local(tags.variableName), color: '#0070C1' }, + + // Strings + { tag: tags.string, color: '#A31515' }, + + // Numbers + { tag: tags.number, color: '#098658' }, + + // Booleans and null + { tag: tags.atom, color: '#0000FF' }, + + // Property names + { tag: tags.propertyName, color: '#0000FF' }, + + // Operators + { tag: tags.operator, color: '#000000' }, + + // Brackets + { tag: tags.bracket, color: '#795E26' }, + + // Meta + { tag: tags.meta, color: '#008000' }, +]); + +/** + * Dark theme extension for Dotprompt. + */ +export const dotpromptDarkTheme = syntaxHighlighting(dotpromptDarkHighlighting); + +/** + * Light theme extension for Dotprompt. + */ +export const dotpromptLightTheme = syntaxHighlighting( + dotpromptLightHighlighting +); diff --git a/packages/codemirror/tsconfig.json b/packages/codemirror/tsconfig.json new file mode 100644 index 000000000..4503b3686 --- /dev/null +++ b/packages/codemirror/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "bundler", + "lib": ["ES2020", "DOM"], + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/monaco/.gitignore b/packages/monaco/.gitignore new file mode 100644 index 000000000..66a838584 --- /dev/null +++ b/packages/monaco/.gitignore @@ -0,0 +1,17 @@ +# Dependencies +node_modules/ + +# Build output +dist/ + +# Package files +*.tgz + +# IDE +.idea/ +*.iml +.vscode/ + +# OS files +.DS_Store +Thumbs.db diff --git a/packages/monaco/README.md b/packages/monaco/README.md new file mode 100644 index 000000000..ab81e777b --- /dev/null +++ b/packages/monaco/README.md @@ -0,0 +1,197 @@ +# @dotprompt/monaco + +Monaco Editor language support for Dotprompt (`.prompt`) files. + +## Features + +- **Syntax Highlighting**: YAML frontmatter, Handlebars templates, Dotprompt markers +- **Autocompletion**: Helpers, frontmatter fields, model names, role snippets +- **Hover Documentation**: Helper and frontmatter field documentation +- **Bracket Matching**: Auto-closing for `{{ }}`, `{{# }}`, etc. +- **Folding**: Collapse Handlebars blocks +- **Themes**: Dark theme rules included + +## Installation + +```bash +npm install @dotprompt/monaco monaco-editor +# or +pnpm add @dotprompt/monaco monaco-editor +``` + +## Usage + +### Basic Registration + +```typescript +import * as monaco from 'monaco-editor'; +import { registerDotpromptLanguage } from '@dotprompt/monaco'; + +// Register the Dotprompt language +registerDotpromptLanguage(monaco); + +// Create an editor +const editor = monaco.editor.create(document.getElementById('container')!, { + value: `--- +model: gemini-2.0-flash +config: + temperature: 0.7 +--- + +{{#role "system"}} +You are a helpful assistant. +{{/role}} + +{{#role "user"}} +Hello, {{ name }}! +{{/role}}`, + language: 'dotprompt', + theme: 'vs-dark', +}); +``` + +### With Custom Options + +```typescript +import { registerDotpromptLanguage, createDotpromptTheme } from '@dotprompt/monaco'; + +const disposable = registerDotpromptLanguage(monaco, { + completions: true, // Enable autocompletion (default: true) + hover: true, // Enable hover docs (default: true) + themes: { + 'dotprompt-dark': createDotpromptTheme('vs-dark'), + }, +}); + +// Use the custom theme +monaco.editor.setTheme('dotprompt-dark'); + +// Cleanup when done +disposable.dispose(); +``` + +### React Integration + +```tsx +import { Editor } from '@monaco-editor/react'; +import { registerDotpromptLanguage } from '@dotprompt/monaco'; + +function DotpromptEditor({ value, onChange }) { + const handleEditorWillMount = (monaco) => { + registerDotpromptLanguage(monaco); + }; + + return ( + + ); +} +``` + +### Angular Integration + +```typescript +import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; +import * as monaco from 'monaco-editor'; +import { registerDotpromptLanguage } from '@dotprompt/monaco'; + +@Component({ + selector: 'app-prompt-editor', + template: '
', +}) +export class PromptEditorComponent implements OnInit { + @ViewChild('editorContainer', { static: true }) + editorContainer!: ElementRef; + + ngOnInit() { + registerDotpromptLanguage(monaco); + + monaco.editor.create(this.editorContainer.nativeElement, { + value: '', + language: 'dotprompt', + theme: 'vs-dark', + }); + } +} +``` + +## API + +### `registerDotpromptLanguage(monaco, options?)` + +Registers the Dotprompt language with Monaco Editor. + +| Parameter | Type | Description | +|-----------|------|-------------| +| `monaco` | `typeof monaco` | Monaco Editor instance | +| `options.completions` | `boolean` | Enable completion provider (default: `true`) | +| `options.hover` | `boolean` | Enable hover provider (default: `true`) | +| `options.themes` | `Record` | Custom themes to register | + +Returns: `IDisposable` to unregister the language + +### `createDotpromptTheme(base?, name?)` + +Creates a theme with Dotprompt token color rules. + +| Parameter | Type | Default | Description | +|-----------|------|---------|-------------| +| `base` | `'vs' \| 'vs-dark' \| 'hc-black'` | `'vs-dark'` | Base theme | +| `name` | `string` | `'dotprompt-dark'` | Theme name | + +### `dotpromptThemeRules` + +Array of token theme rules for Dotprompt syntax. Can be merged into existing themes. + +### `LANGUAGE_ID` + +The language ID: `'dotprompt'` + +### `monarchLanguage` + +The Monarch tokenizer definition. Use for custom language registration. + +### `languageConfiguration` + +Language configuration (brackets, comments, folding). Use for custom registration. + +## Completions + +The completion provider offers: + +| Context | Completions | +|---------|-------------| +| `{{` | Handlebars helpers, Dotprompt helpers | +| `{{#` | Block helpers (if, each, role, section) | +| `{{>` | Partial template reference | +| `model:` | Model names (Gemini, GPT, Claude) | +| Frontmatter | Field names (model, config, input, output) | + +## Theming + +Token types available for theming: + +| Token | Description | +|-------|-------------| +| `delimiter.frontmatter` | `---` delimiters | +| `delimiter.handlebars` | `{{` and `}}` | +| `delimiter.handlebars.block` | `{{#` and `{{/` | +| `keyword.handlebars` | if, each, with, etc. | +| `keyword.dotprompt` | role, json, history, etc. | +| `keyword.yaml` | YAML frontmatter keys | +| `keyword.marker` | `<<>>` | +| `variable` | Template variables | +| `variable.partial` | Partial names | +| `variable.special` | @index, @first, etc. | +| `comment.block` | `{{! comment }}` | +| `comment.yaml` | `# YAML comment` | + +## License + +Apache-2.0 diff --git a/packages/monaco/package-lock.json b/packages/monaco/package-lock.json new file mode 100644 index 000000000..b2c4923e3 --- /dev/null +++ b/packages/monaco/package-lock.json @@ -0,0 +1,1484 @@ +{ + "name": "@dotprompt/monaco", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@dotprompt/monaco", + "version": "0.1.0", + "license": "Apache-2.0", + "devDependencies": { + "monaco-editor": "^0.52.2", + "tsup": "^8.5.1", + "typescript": "^5.9.3" + }, + "peerDependencies": { + "monaco-editor": ">=0.40.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz", + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.2.tgz", + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.2.tgz", + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.2.tgz", + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz", + "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.2.tgz", + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.2.tgz", + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.2.tgz", + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.2.tgz", + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.2.tgz", + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.2.tgz", + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.2.tgz", + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.2.tgz", + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.2.tgz", + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.2.tgz", + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.2.tgz", + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.2.tgz", + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.2.tgz", + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.2.tgz", + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.2.tgz", + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.2.tgz", + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.2.tgz", + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.2.tgz", + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.2.tgz", + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.2.tgz", + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.2.tgz", + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.56.0.tgz", + "integrity": "sha512-LNKIPA5k8PF1+jAFomGe3qN3bbIgJe/IlpDBwuVjrDKrJhVWywgnJvflMt/zkbVNLFtF1+94SljYQS6e99klnw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.56.0.tgz", + "integrity": "sha512-lfbVUbelYqXlYiU/HApNMJzT1E87UPGvzveGg2h0ktUNlOCxKlWuJ9jtfvs1sKHdwU4fzY7Pl8sAl49/XaEk6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.56.0.tgz", + "integrity": "sha512-EgxD1ocWfhoD6xSOeEEwyE7tDvwTgZc8Bss7wCWe+uc7wO8G34HHCUH+Q6cHqJubxIAnQzAsyUsClt0yFLu06w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.56.0.tgz", + "integrity": "sha512-1vXe1vcMOssb/hOF8iv52A7feWW2xnu+c8BV4t1F//m9QVLTfNVpEdja5ia762j/UEJe2Z1jAmEqZAK42tVW3g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.56.0.tgz", + "integrity": "sha512-bof7fbIlvqsyv/DtaXSck4VYQ9lPtoWNFCB/JY4snlFuJREXfZnm+Ej6yaCHfQvofJDXLDMTVxWscVSuQvVWUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.56.0.tgz", + "integrity": "sha512-KNa6lYHloW+7lTEkYGa37fpvPq+NKG/EHKM8+G/g9WDU7ls4sMqbVRV78J6LdNuVaeeK5WB9/9VAFbKxcbXKYg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.56.0.tgz", + "integrity": "sha512-E8jKK87uOvLrrLN28jnAAAChNq5LeCd2mGgZF+fGF5D507WlG/Noct3lP/QzQ6MrqJ5BCKNwI9ipADB6jyiq2A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.56.0.tgz", + "integrity": "sha512-jQosa5FMYF5Z6prEpTCCmzCXz6eKr/tCBssSmQGEeozA9tkRUty/5Vx06ibaOP9RCrW1Pvb8yp3gvZhHwTDsJw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.56.0.tgz", + "integrity": "sha512-uQVoKkrC1KGEV6udrdVahASIsaF8h7iLG0U0W+Xn14ucFwi6uS539PsAr24IEF9/FoDtzMeeJXJIBo5RkbNWvQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.56.0.tgz", + "integrity": "sha512-vLZ1yJKLxhQLFKTs42RwTwa6zkGln+bnXc8ueFGMYmBTLfNu58sl5/eXyxRa2RarTkJbXl8TKPgfS6V5ijNqEA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.56.0.tgz", + "integrity": "sha512-FWfHOCub564kSE3xJQLLIC/hbKqHSVxy8vY75/YHHzWvbJL7aYJkdgwD/xGfUlL5UV2SB7otapLrcCj2xnF1dg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.56.0.tgz", + "integrity": "sha512-z1EkujxIh7nbrKL1lmIpqFTc/sr0u8Uk0zK/qIEFldbt6EDKWFk/pxFq3gYj4Bjn3aa9eEhYRlL3H8ZbPT1xvA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.56.0.tgz", + "integrity": "sha512-iNFTluqgdoQC7AIE8Q34R3AuPrJGJirj5wMUErxj22deOcY7XwZRaqYmB6ZKFHoVGqRcRd0mqO+845jAibKCkw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.56.0.tgz", + "integrity": "sha512-MtMeFVlD2LIKjp2sE2xM2slq3Zxf9zwVuw0jemsxvh1QOpHSsSzfNOTH9uYW9i1MXFxUSMmLpeVeUzoNOKBaWg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.56.0.tgz", + "integrity": "sha512-in+v6wiHdzzVhYKXIk5U74dEZHdKN9KH0Q4ANHOTvyXPG41bajYRsy7a8TPKbYPl34hU7PP7hMVHRvv/5aCSew==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.56.0.tgz", + "integrity": "sha512-yni2raKHB8m9NQpI9fPVwN754mn6dHQSbDTwxdr9SE0ks38DTjLMMBjrwvB5+mXrX+C0npX0CVeCUcvvvD8CNQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.56.0.tgz", + "integrity": "sha512-zhLLJx9nQPu7wezbxt2ut+CI4YlXi68ndEve16tPc/iwoylWS9B3FxpLS2PkmfYgDQtosah07Mj9E0khc3Y+vQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.56.0.tgz", + "integrity": "sha512-MVC6UDp16ZSH7x4rtuJPAEoE1RwS8N4oK9DLHy3FTEdFoUTCFVzMfJl/BVJ330C+hx8FfprA5Wqx4FhZXkj2Kw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.56.0.tgz", + "integrity": "sha512-ZhGH1eA4Qv0lxaV00azCIS1ChedK0V32952Md3FtnxSqZTBTd6tgil4nZT5cU8B+SIw3PFYkvyR4FKo2oyZIHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.56.0.tgz", + "integrity": "sha512-O16XcmyDeFI9879pEcmtWvD/2nyxR9mF7Gs44lf1vGGx8Vg2DRNx11aVXBEqOQhWb92WN4z7fW/q4+2NYzCbBA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.56.0.tgz", + "integrity": "sha512-LhN/Reh+7F3RCgQIRbgw8ZMwUwyqJM+8pXNT6IIJAqm2IdKkzpCh/V9EdgOMBKuebIrzswqy4ATlrDgiOwbRcQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.56.0.tgz", + "integrity": "sha512-kbFsOObXp3LBULg1d3JIUQMa9Kv4UitDmpS+k0tinPBz3watcUiV2/LUDMMucA6pZO3WGE27P7DsfaN54l9ing==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.56.0.tgz", + "integrity": "sha512-vSSgny54D6P4vf2izbtFm/TcWYedw7f8eBrOiGGecyHyQB9q4Kqentjaj8hToe+995nob/Wv48pDqL5a62EWtg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.56.0.tgz", + "integrity": "sha512-FeCnkPCTHQJFbiGG49KjV5YGW/8b9rrXAM2Mz2kiIoktq2qsJxRD5giEMEOD2lPdgs72upzefaUvS+nc8E3UzQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.56.0.tgz", + "integrity": "sha512-H8AE9Ur/t0+1VXujj90w0HrSOuv0Nq9r1vSZF2t5km20NTfosQsGGUXDaKdQZzwuLts7IyL1fYT4hM95TI9c4g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/bundle-require": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz", + "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.18" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz", + "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.2", + "@esbuild/android-arm": "0.27.2", + "@esbuild/android-arm64": "0.27.2", + "@esbuild/android-x64": "0.27.2", + "@esbuild/darwin-arm64": "0.27.2", + "@esbuild/darwin-x64": "0.27.2", + "@esbuild/freebsd-arm64": "0.27.2", + "@esbuild/freebsd-x64": "0.27.2", + "@esbuild/linux-arm": "0.27.2", + "@esbuild/linux-arm64": "0.27.2", + "@esbuild/linux-ia32": "0.27.2", + "@esbuild/linux-loong64": "0.27.2", + "@esbuild/linux-mips64el": "0.27.2", + "@esbuild/linux-ppc64": "0.27.2", + "@esbuild/linux-riscv64": "0.27.2", + "@esbuild/linux-s390x": "0.27.2", + "@esbuild/linux-x64": "0.27.2", + "@esbuild/netbsd-arm64": "0.27.2", + "@esbuild/netbsd-x64": "0.27.2", + "@esbuild/openbsd-arm64": "0.27.2", + "@esbuild/openbsd-x64": "0.27.2", + "@esbuild/openharmony-arm64": "0.27.2", + "@esbuild/sunos-x64": "0.27.2", + "@esbuild/win32-arm64": "0.27.2", + "@esbuild/win32-ia32": "0.27.2", + "@esbuild/win32-x64": "0.27.2" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fix-dts-default-cjs-exports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz", + "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.17", + "mlly": "^1.7.4", + "rollup": "^4.34.8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/mlly": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.0.tgz", + "integrity": "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.15.0", + "pathe": "^2.0.3", + "pkg-types": "^1.3.1", + "ufo": "^1.6.1" + } + }, + "node_modules/monaco-editor": { + "version": "0.52.2", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.2.tgz", + "integrity": "sha512-GEQWEZmfkOGLdd3XK8ryrfWz3AIP8YymVXiPHEdewrUq7mh0qrKrfHLNCXcbB6sTnMLnOZ3ztSiKcciFUkIJwQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/rollup": { + "version": "4.56.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.56.0.tgz", + "integrity": "sha512-9FwVqlgUHzbXtDg9RCMgodF3Ua4Na6Gau+Sdt9vyCN4RhHfVKX2DCHy3BjMLTDd47ITDhYAnTwGulWTblJSDLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.56.0", + "@rollup/rollup-android-arm64": "4.56.0", + "@rollup/rollup-darwin-arm64": "4.56.0", + "@rollup/rollup-darwin-x64": "4.56.0", + "@rollup/rollup-freebsd-arm64": "4.56.0", + "@rollup/rollup-freebsd-x64": "4.56.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.56.0", + "@rollup/rollup-linux-arm-musleabihf": "4.56.0", + "@rollup/rollup-linux-arm64-gnu": "4.56.0", + "@rollup/rollup-linux-arm64-musl": "4.56.0", + "@rollup/rollup-linux-loong64-gnu": "4.56.0", + "@rollup/rollup-linux-loong64-musl": "4.56.0", + "@rollup/rollup-linux-ppc64-gnu": "4.56.0", + "@rollup/rollup-linux-ppc64-musl": "4.56.0", + "@rollup/rollup-linux-riscv64-gnu": "4.56.0", + "@rollup/rollup-linux-riscv64-musl": "4.56.0", + "@rollup/rollup-linux-s390x-gnu": "4.56.0", + "@rollup/rollup-linux-x64-gnu": "4.56.0", + "@rollup/rollup-linux-x64-musl": "4.56.0", + "@rollup/rollup-openbsd-x64": "4.56.0", + "@rollup/rollup-openharmony-arm64": "4.56.0", + "@rollup/rollup-win32-arm64-msvc": "4.56.0", + "@rollup/rollup-win32-ia32-msvc": "4.56.0", + "@rollup/rollup-win32-x64-gnu": "4.56.0", + "@rollup/rollup-win32-x64-msvc": "4.56.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tsup": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.1.tgz", + "integrity": "sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-require": "^5.1.0", + "cac": "^6.7.14", + "chokidar": "^4.0.3", + "consola": "^3.4.0", + "debug": "^4.4.0", + "esbuild": "^0.27.0", + "fix-dts-default-cjs-exports": "^1.0.0", + "joycon": "^3.1.1", + "picocolors": "^1.1.1", + "postcss-load-config": "^6.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.34.8", + "source-map": "^0.7.6", + "sucrase": "^3.35.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.11", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", + "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/packages/monaco/package.json b/packages/monaco/package.json new file mode 100644 index 000000000..a04675404 --- /dev/null +++ b/packages/monaco/package.json @@ -0,0 +1,50 @@ +{ + "name": "@dotprompt/monaco", + "version": "0.1.0", + "description": "Monaco Editor language support for Dotprompt (.prompt) files", + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + } + }, + "files": [ + "dist" + ], + "scripts": { + "build": "tsup src/index.ts --format cjs,esm --dts", + "watch": "tsup src/index.ts --format cjs,esm --dts --watch", + "typecheck": "tsc --noEmit", + "lint": "biome check . && tsc --noEmit", + "format": "biome check --write ." + }, + "repository": { + "type": "git", + "url": "https://github.com/google/dotprompt.git", + "directory": "packages/monaco" + }, + "keywords": [ + "monaco", + "editor", + "dotprompt", + "prompt", + "llm", + "syntax-highlighting", + "genkit" + ], + "author": "Google", + "license": "Apache-2.0", + "peerDependencies": { + "monaco-editor": ">=0.40.0" + }, + "devDependencies": { + "monaco-editor": "^0.52.0", + "tsup": "^8.0.0", + "typescript": "^5.3.0", + "@biomejs/biome": "^1.5.0" + } +} diff --git a/packages/monaco/src/completions.ts b/packages/monaco/src/completions.ts new file mode 100644 index 000000000..86bf7f58e --- /dev/null +++ b/packages/monaco/src/completions.ts @@ -0,0 +1,393 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import type * as monaco from 'monaco-editor'; + +/** + * Handlebars built-in helpers with documentation. + */ +const HANDLEBARS_HELPERS = [ + { + label: 'if', + kind: 1, // Function + insertText: '{{#if ${1:condition}}}\n\t$0\n{{/if}}', + insertTextRules: 4, // InsertAsSnippet + documentation: + 'Conditionally renders content when the condition is truthy.', + }, + { + label: 'unless', + kind: 1, + insertText: '{{#unless ${1:condition}}}\n\t$0\n{{/unless}}', + insertTextRules: 4, + documentation: + 'Inverse of if - renders content when the condition is falsy.', + }, + { + label: 'each', + kind: 1, + insertText: '{{#each ${1:items}}}\n\t$0\n{{/each}}', + insertTextRules: 4, + documentation: + 'Iterates over arrays or objects. Use @index, @first, @last inside.', + }, + { + label: 'with', + kind: 1, + insertText: '{{#with ${1:context}}}\n\t$0\n{{/with}}', + insertTextRules: 4, + documentation: 'Changes the current context for the enclosed block.', + }, + { + label: 'else', + kind: 14, // Keyword + insertText: '{{else}}', + documentation: 'Else branch for if/unless blocks.', + }, + { + label: 'log', + kind: 1, + insertText: '{{log ${1:value}}}', + insertTextRules: 4, + documentation: 'Logs a value to the console for debugging.', + }, + { + label: 'lookup', + kind: 1, + insertText: '{{lookup ${1:object} ${2:key}}}', + insertTextRules: 4, + documentation: 'Dynamically looks up a value by key from an object.', + }, +]; + +/** + * Dotprompt-specific helpers with documentation. + */ +const DOTPROMPT_HELPERS = [ + { + label: 'role', + kind: 1, + insertText: '{{#role "${1|system,user,model|}"}}}\n\t$0\n{{/role}}', + insertTextRules: 4, + documentation: + 'Defines a message with a specific role (system, user, or model).', + }, + { + label: 'json', + kind: 1, + insertText: '{{ json ${1:value} }}', + insertTextRules: 4, + documentation: 'Serializes a value to JSON format.', + }, + { + label: 'history', + kind: 1, + insertText: '{{history}}', + documentation: 'Inserts the conversation history at this point.', + }, + { + label: 'section', + kind: 1, + insertText: '{{#section "${1:name}"}}\n\t$0\n{{/section}}', + insertTextRules: 4, + documentation: 'Defines a named section that can be referenced elsewhere.', + }, + { + label: 'media', + kind: 1, + insertText: '{{media url=${1:url}}}', + insertTextRules: 4, + documentation: 'Embeds media content (images, audio, video) by URL.', + }, + { + label: 'ifEquals', + kind: 1, + insertText: '{{#ifEquals ${1:value1} ${2:value2}}}\n\t$0\n{{/ifEquals}}', + insertTextRules: 4, + documentation: 'Renders content when two values are equal.', + }, + { + label: 'unlessEquals', + kind: 1, + insertText: + '{{#unlessEquals ${1:value1} ${2:value2}}}\n\t$0\n{{/unlessEquals}}', + insertTextRules: 4, + documentation: 'Renders content when two values are NOT equal.', + }, +]; + +/** + * Role snippets for quick insertion. + */ +const ROLE_SNIPPETS = [ + { + label: 'system', + kind: 15, // Snippet + insertText: '{{#role "system"}}\n\t$0\n{{/role}}', + insertTextRules: 4, + documentation: "System role block - sets the AI's behavior and context.", + }, + { + label: 'user', + kind: 15, + insertText: '{{#role "user"}}\n\t$0\n{{/role}}', + insertTextRules: 4, + documentation: 'User role block - represents user input.', + }, + { + label: 'model', + kind: 15, + insertText: '{{#role "model"}}\n\t$0\n{{/role}}', + insertTextRules: 4, + documentation: + 'Model role block - represents AI responses (for few-shot examples).', + }, +]; + +/** + * Frontmatter field completions. + */ +const FRONTMATTER_FIELDS = [ + { + label: 'model', + kind: 5, // Field + insertText: 'model: ${1:gemini-2.0-flash}', + insertTextRules: 4, + documentation: 'The AI model to use for this prompt.', + }, + { + label: 'config', + kind: 5, + insertText: 'config:\n temperature: ${1:0.7}', + insertTextRules: 4, + documentation: 'Model configuration options.', + }, + { + label: 'input', + kind: 5, + insertText: 'input:\n schema:\n ${1:name}: ${2:string}', + insertTextRules: 4, + documentation: 'Input schema definition for the prompt.', + }, + { + label: 'output', + kind: 5, + insertText: 'output:\n format: ${1|json,text,media|}', + insertTextRules: 4, + documentation: 'Output format and schema.', + }, + { + label: 'tools', + kind: 5, + insertText: 'tools:\n - ${1:toolName}', + insertTextRules: 4, + documentation: 'Tools/functions available to the model.', + }, + { + label: 'temperature', + kind: 5, + insertText: 'temperature: ${1:0.7}', + insertTextRules: 4, + documentation: 'Controls randomness (0.0-2.0). Lower = more deterministic.', + }, + { + label: 'maxOutputTokens', + kind: 5, + insertText: 'maxOutputTokens: ${1:1024}', + insertTextRules: 4, + documentation: 'Maximum number of tokens in the response.', + }, +]; + +/** + * Model name completions. + */ +const MODEL_NAMES = [ + { + label: 'gemini-2.0-flash', + documentation: 'Fast Gemini 2.0 model (1M context)', + }, + { + label: 'gemini-2.0-flash-lite', + documentation: 'Lightweight Gemini 2.0 model', + }, + { label: 'gemini-1.5-pro', documentation: 'Gemini 1.5 Pro (2M context)' }, + { label: 'gemini-1.5-flash', documentation: 'Fast Gemini 1.5 model' }, + { label: 'gpt-4o', documentation: 'OpenAI GPT-4o (128K context)' }, + { label: 'gpt-4o-mini', documentation: 'OpenAI GPT-4o Mini' }, + { label: 'gpt-4-turbo', documentation: 'OpenAI GPT-4 Turbo' }, + { label: 'claude-3-5-sonnet', documentation: 'Anthropic Claude 3.5 Sonnet' }, + { label: 'claude-3-opus', documentation: 'Anthropic Claude 3 Opus' }, +].map((m) => ({ + ...m, + kind: 12, // Value + insertText: m.label, +})); + +/** + * Creates a completion provider for Dotprompt files. + */ +export function createCompletionProvider( + monacoInstance: typeof monaco +): monaco.languages.CompletionItemProvider { + return { + triggerCharacters: ['{', ':', ' ', '"'], + + provideCompletionItems( + model: monaco.editor.ITextModel, + position: monaco.Position + ): monaco.languages.ProviderResult { + const textUntilPosition = model.getValueInRange({ + startLineNumber: 1, + startColumn: 1, + endLineNumber: position.lineNumber, + endColumn: position.column, + }); + + const lineContent = model.getLineContent(position.lineNumber); + const linePrefix = lineContent.substring(0, position.column - 1); + + const range = { + startLineNumber: position.lineNumber, + startColumn: position.column, + endLineNumber: position.lineNumber, + endColumn: position.column, + }; + + // Check if we're in frontmatter + const frontmatterMatch = textUntilPosition.match(/^---\n[\s\S]*?(?!---)/); + const isInFrontmatter = + frontmatterMatch && !textUntilPosition.includes('---\n---'); + + if (isInFrontmatter) { + // Model name completion after "model:" + if (/model:\s*$/.test(linePrefix)) { + return { + suggestions: MODEL_NAMES.map((item) => ({ + ...item, + range, + })), + }; + } + + // Frontmatter field completion at line start + if (/^\s*$/.test(linePrefix) || /^\s+$/.test(linePrefix)) { + return { + suggestions: FRONTMATTER_FIELDS.map((item) => ({ + ...item, + range, + })), + }; + } + + return { suggestions: [] }; + } + + // Check if we're inside a Handlebars expression + const isInHandlebars = /\{\{[^}]*$/.test(linePrefix); + + if (isInHandlebars) { + // After {{# - block helpers + if (/\{\{#\s*$/.test(linePrefix)) { + const blockHelpers = [ + ...HANDLEBARS_HELPERS.filter((h) => + ['if', 'unless', 'each', 'with'].includes(h.label) + ), + ...DOTPROMPT_HELPERS.filter((h) => + ['role', 'section', 'ifEquals', 'unlessEquals'].includes(h.label) + ), + ].map((item) => ({ + ...item, + insertText: item.label, + range, + })); + + return { suggestions: blockHelpers }; + } + + // After {{> - partials + if (/\{\{>\s*$/.test(linePrefix)) { + return { + suggestions: [ + { + label: 'partial', + kind: 15, + insertText: '${1:partialName}', + insertTextRules: 4, + documentation: 'Reference a partial template', + range, + }, + ], + }; + } + + // General helpers after {{ or {{ + return { + suggestions: [...HANDLEBARS_HELPERS, ...DOTPROMPT_HELPERS].map( + (item) => ({ ...item, range }) + ), + }; + } + + // At start of expression - suggest opening {{ + if (linePrefix.endsWith('{')) { + return { + suggestions: [ + { + label: '{{', + kind: 15, + insertText: '{$0}}', + insertTextRules: 4, + documentation: 'Start a Handlebars expression', + range, + }, + { + label: '{{#', + kind: 15, + insertText: '{#$0}}', + insertTextRules: 4, + documentation: 'Start a Handlebars block', + range, + }, + { + label: '{{>', + kind: 15, + insertText: '{> $0}}', + insertTextRules: 4, + documentation: 'Include a partial', + range, + }, + { + label: '{{!', + kind: 15, + insertText: '{! $0 }}', + insertTextRules: 4, + documentation: 'Add a comment', + range, + }, + ], + }; + } + + // Role snippets as general completions + return { + suggestions: [...ROLE_SNIPPETS].map((item) => ({ ...item, range })), + }; + }, + }; +} diff --git a/packages/monaco/src/hover.ts b/packages/monaco/src/hover.ts new file mode 100644 index 000000000..78640c895 --- /dev/null +++ b/packages/monaco/src/hover.ts @@ -0,0 +1,278 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import type * as monaco from 'monaco-editor'; + +/** + * Documentation for Handlebars helpers. + */ +const HELPER_DOCS: Record = { + if: { + description: 'Conditionally renders content when the condition is truthy.', + example: '{{#if isLoggedIn}}\n Welcome back!\n{{/if}}', + }, + unless: { + description: + 'Inverse of `if` - renders content when the condition is falsy.', + example: '{{#unless isLoggedIn}}\n Please log in.\n{{/unless}}', + }, + each: { + description: + 'Iterates over arrays or objects. Inside the block, `this` refers to the current item. Use `@index`, `@first`, `@last`, `@key` for metadata.', + example: + '{{#each items}}\n - {{this.name}} (index: {{@index}})\n{{/each}}', + }, + with: { + description: 'Changes the current context for the enclosed block.', + example: '{{#with user}}\n Hello, {{name}}!\n{{/with}}', + }, + else: { + description: 'Provides an else branch for `if` or `unless` blocks.', + example: '{{#if condition}}\n True\n{{else}}\n False\n{{/if}}', + }, + log: { + description: 'Logs a value to the console for debugging purposes.', + example: '{{log user.name}}', + }, + lookup: { + description: 'Dynamically looks up a value by key from an object.', + example: '{{lookup user "name"}}', + }, +}; + +/** + * Documentation for Dotprompt-specific helpers. + */ +const DOTPROMPT_DOCS: Record< + string, + { description: string; example?: string } +> = { + role: { + description: + 'Defines a message with a specific role. Valid roles are `system`, `user`, and `model`.', + example: + '{{#role "system"}}\nYou are a helpful assistant.\n{{/role}}\n\n{{#role "user"}}\nHello!\n{{/role}}', + }, + json: { + description: 'Serializes a value to JSON format for structured output.', + example: 'Here is the data: {{ json userData }}', + }, + history: { + description: + 'Inserts the conversation history at this point. Used for multi-turn conversations.', + example: '{{history}}', + }, + section: { + description: + 'Defines a named section that can be extracted or referenced elsewhere.', + example: '{{#section "instructions"}}\nFollow these rules...\n{{/section}}', + }, + media: { + description: + 'Embeds media content (images, audio, video) by URL. The AI model will process this media.', + example: '{{media url=imageUrl}}', + }, + ifEquals: { + description: 'Renders content when two values are equal.', + example: + '{{#ifEquals status "active"}}\n Account is active\n{{/ifEquals}}', + }, + unlessEquals: { + description: 'Renders content when two values are NOT equal.', + example: + '{{#unlessEquals role "admin"}}\n Access denied\n{{/unlessEquals}}', + }, +}; + +/** + * Documentation for frontmatter fields. + */ +const FRONTMATTER_DOCS: Record = + { + model: { + description: 'The AI model to use for this prompt.', + type: 'string', + }, + config: { + description: 'Model configuration options.', + type: 'object', + }, + temperature: { + description: + 'Controls randomness in output generation (0.0-2.0). Lower values are more deterministic, higher values are more creative.', + type: 'number', + }, + maxOutputTokens: { + description: 'Maximum number of tokens in the response.', + type: 'number', + }, + topP: { + description: 'Nucleus sampling parameter (0.0-1.0).', + type: 'number', + }, + topK: { + description: 'Top-k sampling parameter.', + type: 'number', + }, + input: { + description: 'Input schema definition for the prompt variables.', + type: 'object', + }, + output: { + description: 'Output format and schema specification.', + type: 'object', + }, + format: { + description: 'Output format: `json`, `text`, or `media`.', + type: 'string', + }, + schema: { + description: 'Type schema for input or output.', + type: 'object', + }, + tools: { + description: + 'Tools/functions available to the model for function calling.', + type: 'array', + }, + metadata: { + description: 'Custom metadata for the prompt.', + type: 'object', + }, + default: { + description: 'Default values for input variables.', + type: 'object', + }, + }; + +/** + * Creates a hover provider for Dotprompt files. + */ +export function createHoverProvider( + monacoInstance: typeof monaco +): monaco.languages.HoverProvider { + return { + provideHover( + model: monaco.editor.ITextModel, + position: monaco.Position + ): monaco.languages.ProviderResult { + const word = model.getWordAtPosition(position); + if (!word) { + return null; + } + + const wordText = word.word; + const lineContent = model.getLineContent(position.lineNumber); + + // Check if we're in frontmatter + const textUntilPosition = model.getValueInRange({ + startLineNumber: 1, + startColumn: 1, + endLineNumber: position.lineNumber, + endColumn: position.column, + }); + + const isInFrontmatter = + textUntilPosition.split('---').length === 2 && + textUntilPosition.startsWith('---'); + + if (isInFrontmatter) { + // Check frontmatter field + const frontmatterDoc = FRONTMATTER_DOCS[wordText]; + if (frontmatterDoc) { + const contents: monaco.IMarkdownString[] = [ + { + value: `**${wordText}**${frontmatterDoc.type ? `: \`${frontmatterDoc.type}\`` : ''}`, + }, + { value: frontmatterDoc.description }, + ]; + + return { + range: { + startLineNumber: position.lineNumber, + startColumn: word.startColumn, + endLineNumber: position.lineNumber, + endColumn: word.endColumn, + }, + contents, + }; + } + } + + // Check if we're in a Handlebars expression + const isInHandlebars = + /\{\{[^}]*$/.test(lineContent.substring(0, position.column)) || + /\{\{#\w*$/.test(lineContent.substring(0, position.column)) || + /\{\{\/\w*$/.test(lineContent.substring(0, position.column)); + + if (isInHandlebars || /\{\{[#/]?\s*\w+/.test(lineContent)) { + // Check Dotprompt helper + const dotpromptDoc = DOTPROMPT_DOCS[wordText]; + if (dotpromptDoc) { + const contents: monaco.IMarkdownString[] = [ + { value: `**${wordText}** (Dotprompt helper)` }, + { value: dotpromptDoc.description }, + ]; + + if (dotpromptDoc.example) { + contents.push({ + value: `\`\`\`handlebars\n${dotpromptDoc.example}\n\`\`\``, + }); + } + + return { + range: { + startLineNumber: position.lineNumber, + startColumn: word.startColumn, + endLineNumber: position.lineNumber, + endColumn: word.endColumn, + }, + contents, + }; + } + + // Check Handlebars helper + const helperDoc = HELPER_DOCS[wordText]; + if (helperDoc) { + const contents: monaco.IMarkdownString[] = [ + { value: `**${wordText}** (Handlebars helper)` }, + { value: helperDoc.description }, + ]; + + if (helperDoc.example) { + contents.push({ + value: `\`\`\`handlebars\n${helperDoc.example}\n\`\`\``, + }); + } + + return { + range: { + startLineNumber: position.lineNumber, + startColumn: word.startColumn, + endLineNumber: position.lineNumber, + endColumn: word.endColumn, + }, + contents, + }; + } + } + + return null; + }, + }; +} diff --git a/packages/monaco/src/index.ts b/packages/monaco/src/index.ts new file mode 100644 index 000000000..3f6343552 --- /dev/null +++ b/packages/monaco/src/index.ts @@ -0,0 +1,228 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * Monaco Editor language support for Dotprompt (.prompt) files. + * + * Provides syntax highlighting, autocompletion, and hover documentation + * for Dotprompt files in Monaco-based editors. + * + * @example + * ```typescript + * import * as monaco from 'monaco-editor'; + * import { registerDotpromptLanguage } from '@dotprompt/monaco'; + * + * // Register the language + * registerDotpromptLanguage(monaco); + * + * // Create an editor with Dotprompt support + * const editor = monaco.editor.create(container, { + * value: '---\nmodel: gemini-2.0-flash\n---\nHello {{ name }}!', + * language: 'dotprompt', + * }); + * ``` + * + * @module @dotprompt/monaco + */ + +import type * as monaco from 'monaco-editor'; +import { createCompletionProvider } from './completions'; +import { createHoverProvider } from './hover'; +import { + LANGUAGE_ID, + languageConfiguration, + monarchLanguage, +} from './language'; + +export { createCompletionProvider } from './completions'; +export { createHoverProvider } from './hover'; +export { + LANGUAGE_ID, + languageConfiguration, + monarchLanguage, +} from './language'; + +/** + * Options for registering the Dotprompt language. + */ +export interface RegisterOptions { + /** + * Enable completion provider. + * @default true + */ + completions?: boolean; + + /** + * Enable hover provider. + * @default true + */ + hover?: boolean; + + /** + * Custom themes to register. + * Themes are keyed by name and contain token color rules. + */ + themes?: Record; +} + +/** + * Registers the Dotprompt language with Monaco Editor. + * + * This function: + * 1. Registers the language ID ('dotprompt') + * 2. Sets up syntax highlighting using the Monarch tokenizer + * 3. Configures language features (brackets, comments, folding) + * 4. Optionally registers completion and hover providers + * + * @param monacoInstance - The Monaco Editor instance + * @param options - Optional configuration + * @returns Disposable to unregister the language + * + * @example + * ```typescript + * import * as monaco from 'monaco-editor'; + * import { registerDotpromptLanguage } from '@dotprompt/monaco'; + * + * const disposable = registerDotpromptLanguage(monaco, { + * completions: true, + * hover: true, + * }); + * + * // Later, to unregister: + * disposable.dispose(); + * ``` + */ +export function registerDotpromptLanguage( + monacoInstance: typeof monaco, + options: RegisterOptions = {} +): monaco.IDisposable { + const { completions = true, hover = true, themes } = options; + + const disposables: monaco.IDisposable[] = []; + + // Register the language + monacoInstance.languages.register({ + id: LANGUAGE_ID, + extensions: ['.prompt'], + aliases: ['Dotprompt', 'dotprompt'], + mimetypes: ['text/x-dotprompt'], + }); + + // Register the Monarch tokenizer + monacoInstance.languages.setMonarchTokensProvider( + LANGUAGE_ID, + monarchLanguage + ); + + // Register the language configuration + monacoInstance.languages.setLanguageConfiguration( + LANGUAGE_ID, + languageConfiguration + ); + + // Register completion provider + if (completions) { + disposables.push( + monacoInstance.languages.registerCompletionItemProvider( + LANGUAGE_ID, + createCompletionProvider(monacoInstance) + ) + ); + } + + // Register hover provider + if (hover) { + disposables.push( + monacoInstance.languages.registerHoverProvider( + LANGUAGE_ID, + createHoverProvider(monacoInstance) + ) + ); + } + + // Register custom themes if provided + if (themes) { + for (const [themeName, themeData] of Object.entries(themes)) { + monacoInstance.editor.defineTheme(themeName, themeData); + } + } + + // Return a disposable that cleans up all registered providers + return { + dispose() { + for (const disposable of disposables) { + disposable.dispose(); + } + }, + }; +} + +/** + * Default theme rules for Dotprompt syntax highlighting. + * Can be merged into your existing theme or used standalone. + */ +export const dotpromptThemeRules: monaco.editor.ITokenThemeRule[] = [ + // Frontmatter + { token: 'delimiter.frontmatter', foreground: '6A9955' }, + { token: 'keyword.yaml', foreground: '569CD6' }, + { token: 'variable.yaml', foreground: '9CDCFE' }, + { token: 'source.yaml', foreground: 'D4D4D4' }, + + // Handlebars + { token: 'delimiter.handlebars', foreground: 'DCDCAA' }, + { token: 'delimiter.handlebars.block', foreground: 'DCDCAA' }, + { token: 'keyword.handlebars', foreground: 'C586C0' }, + { token: 'keyword.dotprompt', foreground: '4EC9B0' }, + { token: 'variable', foreground: '9CDCFE' }, + { token: 'variable.partial', foreground: 'CE9178' }, + { token: 'variable.special', foreground: '4FC1FF' }, + + // Markers + { token: 'keyword.marker', foreground: '569CD6', fontStyle: 'bold' }, + + // Comments + { token: 'comment.block', foreground: '6A9955', fontStyle: 'italic' }, + { token: 'comment.line', foreground: '6A9955', fontStyle: 'italic' }, + { token: 'comment.yaml', foreground: '6A9955', fontStyle: 'italic' }, + + // Literals + { token: 'string', foreground: 'CE9178' }, + { token: 'string.quote', foreground: 'CE9178' }, + { token: 'string.escape', foreground: 'D7BA7D' }, + { token: 'number', foreground: 'B5CEA8' }, + { token: 'constant.language', foreground: '569CD6' }, +]; + +/** + * Creates a complete theme with Dotprompt token rules. + * + * @param base - Base theme ('vs', 'vs-dark', or 'hc-black') + * @param name - Theme name + * @returns Theme data for use with monaco.editor.defineTheme + */ +export function createDotpromptTheme( + base: 'vs' | 'vs-dark' | 'hc-black' = 'vs-dark', + name: string = 'dotprompt-dark' +): monaco.editor.IStandaloneThemeData { + return { + base, + inherit: true, + rules: dotpromptThemeRules, + colors: {}, + }; +} diff --git a/packages/monaco/src/language.ts b/packages/monaco/src/language.ts new file mode 100644 index 000000000..cf6b1580e --- /dev/null +++ b/packages/monaco/src/language.ts @@ -0,0 +1,293 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import type * as monaco from 'monaco-editor'; + +/** + * Language ID for Dotprompt files. + */ +export const LANGUAGE_ID = 'dotprompt'; + +/** + * Monarch tokenizer for Dotprompt syntax highlighting. + * Handles YAML frontmatter, Handlebars templates, and Dotprompt markers. + */ +export const monarchLanguage: monaco.languages.IMonarchLanguage = { + defaultToken: '', + tokenPostfix: '.dotprompt', + + // Handlebars keywords + keywords: ['if', 'unless', 'each', 'with', 'else', 'log', 'lookup'], + + // Dotprompt-specific helpers + dotpromptHelpers: [ + 'json', + 'role', + 'history', + 'section', + 'media', + 'ifEquals', + 'unlessEquals', + ], + + // YAML frontmatter keys + yamlKeys: [ + 'model', + 'config', + 'input', + 'output', + 'tools', + 'metadata', + 'default', + 'schema', + 'format', + 'temperature', + 'maxOutputTokens', + 'topP', + 'topK', + ], + + // Operators and brackets + brackets: [ + { open: '{{', close: '}}', token: 'delimiter.handlebars' }, + { open: '{{#', close: '}}', token: 'delimiter.handlebars.block' }, + { open: '{{/', close: '}}', token: 'delimiter.handlebars.block' }, + { open: '{', close: '}', token: 'delimiter.curly' }, + { open: '[', close: ']', token: 'delimiter.square' }, + ], + + tokenizer: { + root: [ + // License header comments (lines starting with #) + [/^#.*$/, 'comment.line'], + + // Frontmatter delimiter + [/^---\s*$/, { token: 'delimiter.frontmatter', next: '@frontmatter' }], + + // Dotprompt markers <<>> + [/<<]+>>>/, 'keyword.marker'], + + // Include template tokens + { include: '@template' }, + ], + + frontmatter: [ + // End of frontmatter + [/^---\s*$/, { token: 'delimiter.frontmatter', next: '@root' }], + + // YAML comments + [/#.*$/, 'comment.yaml'], + + // YAML keys + [ + /([a-zA-Z_][a-zA-Z0-9_-]*)(\s*)(:)/, + [ + { + cases: { + '@yamlKeys': 'keyword.yaml', + '@default': 'variable.yaml', + }, + }, + '', + 'delimiter.colon', + ], + ], + + // YAML strings + [/"([^"\\]|\\.)*$/, 'string.invalid'], // non-terminated string + [/"/, { token: 'string.quote', next: '@yamlDoubleString' }], + [/'/, { token: 'string.quote', next: '@yamlSingleString' }], + + // YAML numbers + [/\d+(\.\d+)?/, 'number'], + + // YAML booleans + [/\b(true|false|null)\b/, 'constant.language'], + + // Everything else in frontmatter + [/./, 'source.yaml'], + ], + + yamlDoubleString: [ + [/[^\\"]+/, 'string'], + [/\\./, 'string.escape'], + [/"/, { token: 'string.quote', next: '@pop' }], + ], + + yamlSingleString: [ + [/[^\\']+/, 'string'], + [/\\./, 'string.escape'], + [/'/, { token: 'string.quote', next: '@pop' }], + ], + + template: [ + // Handlebars comments {{! ... }} + [/\{\{!--/, { token: 'comment.block', next: '@handlebarsBlockComment' }], + [/\{\{!/, { token: 'comment.block', next: '@handlebarsComment' }], + + // Handlebars block start {{#helper ...}} + [ + /(\{\{#)(\s*)(\w+)/, + [ + 'delimiter.handlebars.block', + '', + { + cases: { + '@keywords': 'keyword.handlebars', + '@dotpromptHelpers': 'keyword.dotprompt', + '@default': 'variable.handlebars', + }, + }, + ], + ], + + // Handlebars block end {{/helper}} + [ + /(\{\{\/)(\s*)(\w+)(\s*)(\}\})/, + [ + 'delimiter.handlebars.block', + '', + { + cases: { + '@keywords': 'keyword.handlebars', + '@dotpromptHelpers': 'keyword.dotprompt', + '@default': 'variable.handlebars', + }, + }, + '', + 'delimiter.handlebars.block', + ], + ], + + // Handlebars else {{else}} + [/\{\{else\}\}/, 'keyword.handlebars'], + + // Partials {{> partialName}} + [ + /(\{\{>)(\s*)([a-zA-Z_][a-zA-Z0-9_-]*)(\s*)(\}\})/, + [ + 'delimiter.handlebars', + '', + 'variable.partial', + '', + 'delimiter.handlebars', + ], + ], + + // Handlebars expressions {{ ... }} + [ + /\{\{/, + { token: 'delimiter.handlebars', next: '@handlebarsExpression' }, + ], + + // Plain text + [/[^{<]+/, ''], + [/./, ''], + ], + + handlebarsExpression: [ + // Close expression + [/\}\}/, { token: 'delimiter.handlebars', next: '@pop' }], + + // Helpers + [ + /\b(\w+)\b/, + { + cases: { + '@keywords': 'keyword.handlebars', + '@dotpromptHelpers': 'keyword.dotprompt', + '@default': 'variable', + }, + }, + ], + + // Strings in expressions + [/"([^"\\]|\\.)*"/, 'string'], + [/'([^'\\]|\\.)*'/, 'string'], + + // Numbers + [/\d+/, 'number'], + + // Operators + [/[=]/, 'operator'], + + // Dotted paths + [/\./, 'delimiter.dot'], + + // @ variables (@index, @first, etc.) + [/@\w+/, 'variable.special'], + + // Whitespace + [/\s+/, ''], + ], + + handlebarsComment: [ + [/\}\}/, { token: 'comment.block', next: '@pop' }], + [/./, 'comment.block'], + ], + + handlebarsBlockComment: [ + [/--\}\}/, { token: 'comment.block', next: '@pop' }], + [/./, 'comment.block'], + ], + }, +}; + +/** + * Language configuration for Dotprompt. + * Provides bracket matching, auto-closing, and comment toggling. + */ +export const languageConfiguration: monaco.languages.LanguageConfiguration = { + comments: { + blockComment: ['{{!', '}}'], + }, + brackets: [ + ['{{', '}}'], + ['{{#', '}}'], + ['{{/', '}}'], + ['{', '}'], + ['[', ']'], + ['(', ')'], + ], + autoClosingPairs: [ + { open: '{{', close: '}}' }, + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + ], + surroundingPairs: [ + { open: '{{', close: '}}' }, + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + ], + folding: { + markers: { + start: /^\s*\{\{#/, + end: /^\s*\{\{\//, + }, + }, + indentationRules: { + increaseIndentPattern: /^\s*\{\{#(if|unless|each|with|role|section)/, + decreaseIndentPattern: /^\s*\{\{\/(if|unless|each|with|role|section)/, + }, +}; diff --git a/packages/monaco/tsconfig.json b/packages/monaco/tsconfig.json new file mode 100644 index 000000000..4503b3686 --- /dev/null +++ b/packages/monaco/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "bundler", + "lib": ["ES2020", "DOM"], + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/treesitter/.editorconfig b/packages/treesitter/.editorconfig new file mode 100644 index 000000000..d3a8b5b69 --- /dev/null +++ b/packages/treesitter/.editorconfig @@ -0,0 +1,39 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{json,toml,yml,gyp}] +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space +indent_size = 2 + +[*.rs] +indent_style = space +indent_size = 4 + +[*.{c,cc,h}] +indent_style = space +indent_size = 4 + +[*.{py,pyi}] +indent_style = space +indent_size = 4 + +[*.swift] +indent_style = space +indent_size = 4 + +[*.go] +indent_style = tab +indent_size = 8 + +[Makefile] +indent_style = tab +indent_size = 8 diff --git a/packages/treesitter/.gitattributes b/packages/treesitter/.gitattributes new file mode 100644 index 000000000..ffb52abec --- /dev/null +++ b/packages/treesitter/.gitattributes @@ -0,0 +1,11 @@ +* text eol=lf + +src/*.json linguist-generated +src/parser.c linguist-generated +src/tree_sitter/* linguist-generated + +bindings/** linguist-generated +binding.gyp linguist-generated +setup.py linguist-generated +Makefile linguist-generated +Package.swift linguist-generated diff --git a/packages/treesitter/.gitignore b/packages/treesitter/.gitignore new file mode 100644 index 000000000..27fc43f72 --- /dev/null +++ b/packages/treesitter/.gitignore @@ -0,0 +1,38 @@ +# Rust artifacts +Cargo.lock +target/ + +# Node artifacts +build/ +prebuilds/ +node_modules/ +*.tgz + +# Swift artifacts +.build/ + +# Go artifacts +go.sum +_obj/ + +# Python artifacts +.venv/ +dist/ +*.egg-info +*.whl + +# C artifacts +*.a +*.so +*.so.* +*.dylib +*.dll +*.pc + +# Example dirs +/examples/*/ + +# Grammar volatiles +*.wasm +*.obj +*.o diff --git a/packages/treesitter/BUILD.bazel b/packages/treesitter/BUILD.bazel new file mode 100644 index 000000000..74593344c --- /dev/null +++ b/packages/treesitter/BUILD.bazel @@ -0,0 +1,23 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +cc_library( + name = "parser", + srcs = ["src/parser.c"], + hdrs = glob(["src/tree_sitter/*.h"]), + includes = ["src"], + visibility = ["//visibility:public"], +) diff --git a/packages/treesitter/Cargo.toml b/packages/treesitter/Cargo.toml new file mode 100644 index 000000000..8e74de0a2 --- /dev/null +++ b/packages/treesitter/Cargo.toml @@ -0,0 +1,39 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +[package] +autoexamples = false +categories = ["parsing", "text-editors"] +description = "Dotprompt grammar for tree-sitter" +edition = "2021" +keywords = ["incremental", "parsing", "tree-sitter", "dotprompt"] +license = "MIT" +name = "tree-sitter-dotprompt" +readme = "README.md" +repository = "https://github.com/tree-sitter/tree-sitter-dotprompt" +version = "0.0.1" + +build = "bindings/rust/build.rs" +include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] + +[lib] +path = "bindings/rust/lib.rs" + +[dependencies] +tree-sitter = ">=0.22.6" + +[build-dependencies] +cc = "1.0.87" diff --git a/packages/treesitter/Makefile b/packages/treesitter/Makefile new file mode 100644 index 000000000..65149852b --- /dev/null +++ b/packages/treesitter/Makefile @@ -0,0 +1,112 @@ +VERSION := 0.0.1 + +LANGUAGE_NAME := tree-sitter-dotprompt + +# repository +SRC_DIR := src + +PARSER_REPO_URL := $(shell git -C $(SRC_DIR) remote get-url origin 2>/dev/null) + +ifeq ($(PARSER_URL),) + PARSER_URL := $(subst .git,,$(PARSER_REPO_URL)) +ifeq ($(shell echo $(PARSER_URL) | grep '^[a-z][-+.0-9a-z]*://'),) + PARSER_URL := $(subst :,/,$(PARSER_URL)) + PARSER_URL := $(subst git@,https://,$(PARSER_URL)) +endif +endif + +TS ?= tree-sitter + +# ABI versioning +SONAME_MAJOR := $(word 1,$(subst ., ,$(VERSION))) +SONAME_MINOR := $(word 2,$(subst ., ,$(VERSION))) + +# install directory layout +PREFIX ?= /usr/local +INCLUDEDIR ?= $(PREFIX)/include +LIBDIR ?= $(PREFIX)/lib +PCLIBDIR ?= $(LIBDIR)/pkgconfig + +# source/object files +PARSER := $(SRC_DIR)/parser.c +EXTRAS := $(filter-out $(PARSER),$(wildcard $(SRC_DIR)/*.c)) +OBJS := $(patsubst %.c,%.o,$(PARSER) $(EXTRAS)) + +# flags +ARFLAGS ?= rcs +override CFLAGS += -I$(SRC_DIR) -std=c11 -fPIC + +# OS-specific bits +ifeq ($(OS),Windows_NT) + $(error "Windows is not supported") +else ifeq ($(shell uname),Darwin) + SOEXT = dylib + SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib + SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib + LINKSHARED := $(LINKSHARED)-dynamiclib -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS), + endif + LINKSHARED := $(LINKSHARED)-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SONAME_MAJOR).dylib,-rpath,@executable_path/../Frameworks +else + SOEXT = so + SOEXTVER_MAJOR = so.$(SONAME_MAJOR) + SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR) + LINKSHARED := $(LINKSHARED)-shared -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS) + endif + LINKSHARED := $(LINKSHARED)-soname,lib$(LANGUAGE_NAME).so.$(SONAME_MAJOR) +endif +ifneq ($(filter $(shell uname),FreeBSD NetBSD DragonFly),) + PCLIBDIR := $(PREFIX)/libdata/pkgconfig +endif + +all: lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(LANGUAGE_NAME).pc + +lib$(LANGUAGE_NAME).a: $(OBJS) + $(AR) $(ARFLAGS) $@ $^ + +lib$(LANGUAGE_NAME).$(SOEXT): $(OBJS) + $(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@ +ifneq ($(STRIP),) + $(STRIP) $@ +endif + +$(LANGUAGE_NAME).pc: bindings/c/$(LANGUAGE_NAME).pc.in + sed -e 's|@URL@|$(PARSER_URL)|' \ + -e 's|@VERSION@|$(VERSION)|' \ + -e 's|@LIBDIR@|$(LIBDIR)|' \ + -e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \ + -e 's|@REQUIRES@|$(REQUIRES)|' \ + -e 's|@ADDITIONAL_LIBS@|$(ADDITIONAL_LIBS)|' \ + -e 's|=$(PREFIX)|=$${prefix}|' \ + -e 's|@PREFIX@|$(PREFIX)|' $< > $@ + +$(PARSER): $(SRC_DIR)/grammar.json + $(TS) generate --no-bindings $^ + +install: all + install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)' + install -m644 bindings/c/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h + install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a + install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) + +uninstall: + $(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \ + '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \ + '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + +clean: + $(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) + +test: + $(TS) test + +.PHONY: all install uninstall clean test diff --git a/packages/treesitter/Package.swift b/packages/treesitter/Package.swift new file mode 100644 index 000000000..b729a0928 --- /dev/null +++ b/packages/treesitter/Package.swift @@ -0,0 +1,63 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +// swift-tools-version:5.3 +import PackageDescription + +let package = Package( + name: "TreeSitterDotprompt", + products: [ + .library(name: "TreeSitterDotprompt", targets: ["TreeSitterDotprompt"]), + ], + dependencies: [], + targets: [ + .target(name: "TreeSitterDotprompt", + path: ".", + exclude: [ + "Cargo.toml", + "Makefile", + "binding.gyp", + "bindings/c", + "bindings/go", + "bindings/node", + "bindings/python", + "bindings/rust", + "prebuilds", + "grammar.js", + "package.json", + "package-lock.json", + "pyproject.toml", + "setup.py", + "test", + "examples", + ".editorconfig", + ".github", + ".gitignore", + ".gitattributes", + ".gitmodules", + ], + sources: [ + "src/parser.c", + // NOTE: if your language has an external scanner, add it here. + ], + resources: [ + .copy("queries") + ], + publicHeadersPath: "bindings/swift", + cSettings: [.headerSearchPath("src")]) + ], + cLanguageStandard: .c11 +) diff --git a/packages/treesitter/binding.gyp b/packages/treesitter/binding.gyp new file mode 100644 index 000000000..3d9270077 --- /dev/null +++ b/packages/treesitter/binding.gyp @@ -0,0 +1,30 @@ +{ + "targets": [ + { + "target_name": "tree_sitter_dotprompt_binding", + "dependencies": [ + " +// extern void *tree_sitter_dotprompt(); +import "C" + +import "unsafe" + +// Get the tree-sitter Language for this grammar. +func Language() unsafe.Pointer { + return unsafe.Pointer(C.tree_sitter_dotprompt()) +} diff --git a/packages/treesitter/bindings/go/binding_test.go b/packages/treesitter/bindings/go/binding_test.go new file mode 100644 index 000000000..2b0ce84f7 --- /dev/null +++ b/packages/treesitter/bindings/go/binding_test.go @@ -0,0 +1,31 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +package tree_sitter_dotprompt_test + +import ( + "testing" + + tree_sitter_dotprompt "github.com/google/dotprompt/packages/treesitter/bindings/go" + tree_sitter "github.com/smacker/go-tree-sitter" +) + +func TestCanLoadGrammar(t *testing.T) { + language := tree_sitter.NewLanguage(tree_sitter_dotprompt.Language()) + if language == nil { + t.Errorf("Error loading Dotprompt grammar") + } +} diff --git a/packages/treesitter/bindings/go/go.mod b/packages/treesitter/bindings/go/go.mod new file mode 100644 index 000000000..9700fb85e --- /dev/null +++ b/packages/treesitter/bindings/go/go.mod @@ -0,0 +1,5 @@ +module github.com/tree-sitter/tree-sitter-dotprompt + +go 1.22 + +require github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8 diff --git a/packages/treesitter/bindings/node/binding.cc b/packages/treesitter/bindings/node/binding.cc new file mode 100644 index 000000000..e5358b162 --- /dev/null +++ b/packages/treesitter/bindings/node/binding.cc @@ -0,0 +1,36 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +typedef struct TSLanguage TSLanguage; + +extern "C" TSLanguage *tree_sitter_dotprompt(); + +// "tree-sitter", "language" hashed with BLAKE2 +const napi_type_tag LANGUAGE_TYPE_TAG = { + 0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16 +}; + +Napi::Object Init(Napi::Env env, Napi::Object exports) { + exports["name"] = Napi::String::New(env, "dotprompt"); + auto language = Napi::External::New(env, tree_sitter_dotprompt()); + language.TypeTag(&LANGUAGE_TYPE_TAG); + exports["language"] = language; + return exports; +} + +NODE_API_MODULE(tree_sitter_dotprompt_binding, Init) diff --git a/packages/treesitter/bindings/node/index.d.ts b/packages/treesitter/bindings/node/index.d.ts new file mode 100644 index 000000000..3363c283c --- /dev/null +++ b/packages/treesitter/bindings/node/index.d.ts @@ -0,0 +1,46 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +type BaseNode = { + type: string; + named: boolean; +}; + +type ChildNode = { + multiple: boolean; + required: boolean; + types: BaseNode[]; +}; + +type NodeInfo = + | (BaseNode & { + subtypes: BaseNode[]; + }) + | (BaseNode & { + fields: { [name: string]: ChildNode }; + children: ChildNode[]; + }); + +type Language = { + name: string; + language: unknown; + nodeTypeInfo: NodeInfo[]; +}; + +declare const language: Language; +export = language; diff --git a/packages/treesitter/bindings/node/index.js b/packages/treesitter/bindings/node/index.js new file mode 100644 index 000000000..31e26f1b3 --- /dev/null +++ b/packages/treesitter/bindings/node/index.js @@ -0,0 +1,25 @@ +/** + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +const root = require('path').join(__dirname, '..', '..'); + +module.exports = require('node-gyp-build')(root); + +try { + module.exports.nodeTypeInfo = require('../../src/node-types.json'); +} catch (_) {} diff --git a/packages/treesitter/bindings/python/tree_sitter_dotprompt/__init__.py b/packages/treesitter/bindings/python/tree_sitter_dotprompt/__init__.py new file mode 100644 index 000000000..c93c07161 --- /dev/null +++ b/packages/treesitter/bindings/python/tree_sitter_dotprompt/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +"Dotprompt grammar for tree-sitter" + +from ._binding import language + +__all__ = ["language"] diff --git a/packages/treesitter/bindings/python/tree_sitter_dotprompt/__init__.pyi b/packages/treesitter/bindings/python/tree_sitter_dotprompt/__init__.pyi new file mode 100644 index 000000000..5416666fc --- /dev/null +++ b/packages/treesitter/bindings/python/tree_sitter_dotprompt/__init__.pyi @@ -0,0 +1 @@ +def language() -> int: ... diff --git a/packages/treesitter/bindings/python/tree_sitter_dotprompt/binding.c b/packages/treesitter/bindings/python/tree_sitter_dotprompt/binding.c new file mode 100644 index 000000000..a266f29d3 --- /dev/null +++ b/packages/treesitter/bindings/python/tree_sitter_dotprompt/binding.c @@ -0,0 +1,45 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +typedef struct TSLanguage TSLanguage; + +TSLanguage *tree_sitter_dotprompt(void); + +static PyObject* _binding_language(PyObject *self, PyObject *args) { + return PyLong_FromVoidPtr(tree_sitter_dotprompt()); +} + +static PyMethodDef methods[] = { + {"language", _binding_language, METH_NOARGS, + "Get the tree-sitter language for this grammar."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef module = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "_binding", + .m_doc = NULL, + .m_size = -1, + .m_methods = methods +}; + +PyMODINIT_FUNC PyInit__binding(void) { + return PyModule_Create(&module); +} diff --git a/packages/treesitter/bindings/python/tree_sitter_dotprompt/py.typed b/packages/treesitter/bindings/python/tree_sitter_dotprompt/py.typed new file mode 100644 index 000000000..e69de29bb diff --git a/packages/treesitter/bindings/rust/build.rs b/packages/treesitter/bindings/rust/build.rs new file mode 100644 index 000000000..d2c9f50d2 --- /dev/null +++ b/packages/treesitter/bindings/rust/build.rs @@ -0,0 +1,38 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +fn main() { + let src_dir = std::path::Path::new("src"); + + let mut c_config = cc::Build::new(); + c_config.std("c11").include(src_dir); + + #[cfg(target_env = "msvc")] + c_config.flag("-utf-8"); + + let parser_path = src_dir.join("parser.c"); + c_config.file(&parser_path); + println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); + + // NOTE: if your language uses an external scanner, uncomment this block: + /* + let scanner_path = src_dir.join("scanner.c"); + c_config.file(&scanner_path); + println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); + */ + + c_config.compile("tree-sitter-dotprompt"); +} diff --git a/packages/treesitter/bindings/rust/lib.rs b/packages/treesitter/bindings/rust/lib.rs new file mode 100644 index 000000000..dc20ad512 --- /dev/null +++ b/packages/treesitter/bindings/rust/lib.rs @@ -0,0 +1,70 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +//! This crate provides Dotprompt language support for the [tree-sitter][] parsing library. +//! +//! Typically, you will use the [language][language func] function to add this language to a +//! tree-sitter [Parser][], and then use the parser to parse some code: +//! +//! ``` +//! let code = r#" +//! "#; +//! let mut parser = tree_sitter::Parser::new(); +//! parser.set_language(&tree_sitter_dotprompt::language()).expect("Error loading Dotprompt grammar"); +//! let tree = parser.parse(code, None).unwrap(); +//! assert!(!tree.root_node().has_error()); +//! ``` +//! +//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html +//! [language func]: fn.language.html +//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html +//! [tree-sitter]: https://tree-sitter.github.io/ + +use tree_sitter::Language; + +extern "C" { + fn tree_sitter_dotprompt() -> Language; +} + +/// Get the tree-sitter [Language][] for this grammar. +/// +/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html +pub fn language() -> Language { + unsafe { tree_sitter_dotprompt() } +} + +/// The content of the [`node-types.json`][] file for this grammar. +/// +/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types +pub const NODE_TYPES: &str = include_str!("../../src/node-types.json"); + +// Uncomment these to include any queries that this grammar contains + +// pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm"); +// pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm"); +// pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm"); +// pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm"); + +#[cfg(test)] +mod tests { + #[test] + fn test_can_load_grammar() { + let mut parser = tree_sitter::Parser::new(); + parser + .set_language(&super::language()) + .expect("Error loading Dotprompt grammar"); + } +} diff --git a/packages/treesitter/bindings/swift/TreeSitterDotprompt/dotprompt.h b/packages/treesitter/bindings/swift/TreeSitterDotprompt/dotprompt.h new file mode 100644 index 000000000..7eb205adc --- /dev/null +++ b/packages/treesitter/bindings/swift/TreeSitterDotprompt/dotprompt.h @@ -0,0 +1,34 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef TREE_SITTER_DOTPROMPT_H_ +#define TREE_SITTER_DOTPROMPT_H_ + +typedef struct TSLanguage TSLanguage; + +#ifdef __cplusplus +extern "C" { +#endif + +const TSLanguage *tree_sitter_dotprompt(void); + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_DOTPROMPT_H_ diff --git a/packages/treesitter/grammar.js b/packages/treesitter/grammar.js index 4b9fbbb32..0795fbc56 100644 --- a/packages/treesitter/grammar.js +++ b/packages/treesitter/grammar.js @@ -12,18 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file Tree-sitter grammar for Dotprompt files - * @author Google - * @license Apache-2.0 - * - * Dotprompt files consist of: - * 1. Optional YAML frontmatter (between --- delimiters) - * 2. Template body with Handlebars expressions and Dotprompt markers */ /// @@ -32,12 +20,7 @@ module.exports = grammar({ name: 'dotprompt', - extras: ($) => [/\s/], - - externals: ($) => [$._eof], - rules: { - // Document structure document: ($) => seq( optional($.license_header), @@ -45,109 +28,116 @@ module.exports = grammar({ optional($.template_body) ), - // License header (# comments before frontmatter) license_header: ($) => repeat1($.header_comment), - header_comment: ($) => seq('#', /[^\n]*/, /\n/), + header_comment: ($) => token(seq('#', /.*/)), - // YAML Frontmatter (--- ... ---) frontmatter: ($) => + prec( + 1, + seq( + $.frontmatter_delimiter, + /\r?\n/, + alias(repeat($._yaml_content), $.yaml_content), + $.frontmatter_delimiter, + /\r?\n/ + ) + ), + + frontmatter_delimiter: ($) => token(prec(10, '---')), + + _yaml_content: ($) => choice($.yaml_line, $.header_comment, /\s+/), + + yaml_line: ($) => seq( - $.frontmatter_delimiter, - optional($.yaml_content), - $.frontmatter_delimiter + field('key', alias(/[a-zA-Z_][a-zA-Z0-9_-]*/, $.yaml_key)), + ':', + optional(field('value', alias(/.+/, $.yaml_value))), + /\r?\n/ ), - frontmatter_delimiter: ($) => '---', + template_body: ($) => repeat1($._content), - yaml_content: ($) => repeat1($.yaml_line), + _content: ($) => + choice( + $.handlebars_block, + $.handlebars_expression, + $.handlebars_comment, + $.dotprompt_marker, + $.text + ), - yaml_line: ($) => seq(/[^\n]*/, /\n/), + handlebars_block: ($) => + seq( + $.block_expression, // block_start renamed + repeat($._content), + $.close_block // block_end renamed + ), - // Template body - template_body: ($) => - repeat1( - choice( - $.handlebars_expression, - $.handlebars_block, - $.dotprompt_marker, - $.handlebars_comment, - $.text - ) + block_expression: ($) => + seq( + '{{#', + field('name', alias($.path, $.block_name)), // helper_name -> block_name + repeat($.argument), // _param -> argument + '}}' ), - // Handlebars expressions: {{ ... }} - handlebars_expression: ($) => - seq('{{', optional($.expression_content), '}}'), + close_block: ($) => + seq('{{/', field('name', alias($.path, $.block_name)), '}}'), - expression_content: ($) => - choice($.helper_call, $.variable_reference, $.partial_reference), + handlebars_expression: ($) => seq('{{', $.expression_content, '}}'), - // Helper call: {{helper arg1 arg2}} - helper_call: ($) => seq($.helper_name, repeat($.argument)), + expression_content: ($) => + choice( + seq('>', alias($.path, $.partial_reference)), + 'else', + seq(alias($.path, $.helper_name), repeat1($.argument)), + alias($.variable_reference, $.variable_reference) + ), - helper_name: ($) => /[a-zA-Z_][a-zA-Z0-9_]*/, + handlebars_comment: ($) => + choice( + seq('{{!', /([^}]|}[^}])*?/, '}}'), + seq('{{!--', /([^-]|-+|-[^}])*?/, '--}}') + ), argument: ($) => choice( $.string_literal, - $.number_literal, - $.boolean_literal, + $.number, + $.boolean, $.variable_reference, - $.named_argument + $.hash_param ), - named_argument: ($) => + hash_param: ($) => seq( - $.identifier, + field('key', alias($.path, $.key)), '=', - choice( - $.string_literal, - $.number_literal, - $.boolean_literal, - $.variable_reference + field( + 'value', + choice($.string_literal, $.number, $.boolean, $.variable_reference) ) ), - // Variable reference: {{variable}} or {{object.property}} - variable_reference: ($) => /[a-zA-Z_@][a-zA-Z0-9_.]*/, - - // Partial reference: {{> partialName}} - partial_reference: ($) => - seq('>', $.identifier, optional($.variable_reference)), - - // Handlebars blocks: {{#block}} ... {{/block}} - handlebars_block: ($) => - choice($.block_expression, $.else_expression, $.close_block), - - block_expression: ($) => seq('{{#', $.block_name, repeat($.argument), '}}'), - - else_expression: ($) => '{{else}}', - - close_block: ($) => seq('{{/', $.block_name, '}}'), - - block_name: ($) => /[a-zA-Z_][a-zA-Z0-9_]*/, - - // Handlebars comments: {{! ... }} or {{!-- ... --}} - handlebars_comment: ($) => - choice(seq('{{!', /[^}]*/, '}}'), seq('{{!--', /[^-]*/, '--}}')), - - // Dotprompt markers: <<>> - dotprompt_marker: ($) => seq('<<>>'), + variable_reference: ($) => + choice( + /@[a-zA-Z_][a-zA-Z0-9_]*/, // @index, @first + $.path + ), - marker_content: ($) => /[^>]+/, + path: ($) => /[a-zA-Z_][a-zA-Z0-9_.]*/, - // Literals string_literal: ($) => - choice(seq('"', /[^"]*/, '"'), seq("'", /[^']*/, "'")), + choice(seq('"', /([^"\\]|\\.)*/, '"'), seq("'", /([^'\\]|\\.)*/, "'")), - number_literal: ($) => /\d+(\.\d+)?/, + number: ($) => /-?\d+(\.\d+)?/, - boolean_literal: ($) => choice('true', 'false'), + boolean: ($) => choice('true', 'false'), - identifier: ($) => /[a-zA-Z_][a-zA-Z0-9_-]*/, + dotprompt_marker: ($) => + seq('<<]+/, $.marker_content), '>>>'), - // Plain text - text: ($) => /[^{<]+/, + text: ($) => /[^{<#]+|\{|<|#/, }, }); diff --git a/packages/treesitter/package.json b/packages/treesitter/package.json index 805fc76c4..bc5ff4075 100644 --- a/packages/treesitter/package.json +++ b/packages/treesitter/package.json @@ -39,13 +39,19 @@ } }, "devDependencies": { - "tree-sitter-cli": "^0.22.0" + "@biomejs/biome": "^1.5.0", + "node-gyp": "^10.0.0", + "tree-sitter-cli": "^0.22.6", + "prebuildify": "^6.0.0" }, "scripts": { "generate": "tree-sitter generate", "test": "tree-sitter test", "build": "tree-sitter generate && node-gyp rebuild", - "install": "node-gyp-build" + "install": "node-gyp-build", + "lint": "biome check .", + "format": "biome check --write .", + "prebuildify": "prebuildify --napi --strip" }, "tree-sitter": [ { diff --git a/packages/treesitter/pyproject.toml b/packages/treesitter/pyproject.toml new file mode 100644 index 000000000..efbd6b9d2 --- /dev/null +++ b/packages/treesitter/pyproject.toml @@ -0,0 +1,45 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools>=42", "wheel"] + +[project] +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Compilers", + "Topic :: Text Processing :: Linguistic", + "Typing :: Typed", +] +description = "Dotprompt grammar for tree-sitter" +keywords = ["incremental", "parsing", "tree-sitter", "dotprompt"] +license.text = "MIT" +name = "tree-sitter-dotprompt" +readme = "README.md" +requires-python = ">=3.8" +version = "0.0.1" + +[project.urls] +Homepage = "https://github.com/tree-sitter/tree-sitter-dotprompt" + +[project.optional-dependencies] +core = ["tree-sitter~=0.21"] + +[tool.cibuildwheel] +build = "cp38-*" +build-frontend = "build" diff --git a/packages/treesitter/queries/highlights.scm b/packages/treesitter/queries/highlights.scm index 37eb840d4..f2a64698c 100644 --- a/packages/treesitter/queries/highlights.scm +++ b/packages/treesitter/queries/highlights.scm @@ -14,78 +14,41 @@ ;; ;; SPDX-License-Identifier: Apache-2.0 -; Highlight queries for Dotprompt Tree-sitter grammar -; For use with nvim-treesitter +; Frontmatter +(frontmatter) @meta + +(yaml_key) @property +(yaml_value) @string -; License header comments (header_comment) @comment +(handlebars_comment) @comment -; Frontmatter -(frontmatter_delimiter) @punctuation.delimiter -(yaml_content) @embedded -(yaml_line) @string +; Handlebars +(handlebars_block + (block_expression + "{{#" @punctuation.bracket + (block_name) @keyword + "}}" @punctuation.bracket + ) + (close_block + "{{/" @punctuation.bracket + (block_name) @keyword + "}}" @punctuation.bracket + ) +) -; Handlebars expressions (handlebars_expression "{{" @punctuation.bracket - "}}" @punctuation.bracket) - -; Helper names -(helper_name) @function.call - -; Block expressions -(block_expression - "{{#" @punctuation.bracket - (block_name) @keyword.control - "}}" @punctuation.bracket) - -(close_block - "{{/" @punctuation.bracket - (block_name) @keyword.control - "}}" @punctuation.bracket) - -(else_expression) @keyword.control + "}}" @punctuation.bracket +) -; Dotprompt-specific helpers -((helper_name) @keyword.control.dotprompt - (#any-of? @keyword.control.dotprompt - "role" "json" "media" "history" "section" "ifEquals" "unlessEquals")) +(helper_name) @function -; Block keywords -((block_name) @keyword.control.flow - (#any-of? @keyword.control.flow - "if" "unless" "each" "with" "role" "section")) - -; Partials -(partial_reference - ">" @punctuation.special - (identifier) @function) - -; Variables (variable_reference) @variable - -; Special variables -((variable_reference) @variable.builtin - (#any-of? @variable.builtin "@index" "@first" "@last" "@key" "this")) - -; Arguments -(named_argument - (identifier) @property - "=" @operator) - -; Literals (string_literal) @string -(number_literal) @number -(boolean_literal) @boolean - -; Comments -(handlebars_comment) @comment +(number) @number +(boolean) @constant.builtin +(key) @attribute ; Dotprompt markers -(dotprompt_marker - "<<>>" @keyword.directive) - -; Plain text -(text) @none +(dotprompt_marker) @keyword diff --git a/packages/treesitter/setup.py b/packages/treesitter/setup.py new file mode 100644 index 000000000..dc6226352 --- /dev/null +++ b/packages/treesitter/setup.py @@ -0,0 +1,76 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +from os.path import isdir, join +from platform import system + +from setuptools import Extension, find_packages, setup +from setuptools.command.build import build +from wheel.bdist_wheel import bdist_wheel + + +class Build(build): + def run(self): + if isdir("queries"): + dest = join(self.build_lib, "tree_sitter_dotprompt", "queries") + self.copy_tree("queries", dest) + super().run() + + +class BdistWheel(bdist_wheel): + def get_tag(self): + python, abi, platform = super().get_tag() + if python.startswith("cp"): + python, abi = "cp38", "abi3" + return python, abi, platform + + +setup( + packages=find_packages("bindings/python"), + package_dir={"": "bindings/python"}, + package_data={ + "tree_sitter_dotprompt": ["*.pyi", "py.typed"], + "tree_sitter_dotprompt.queries": ["*.scm"], + }, + ext_package="tree_sitter_dotprompt", + ext_modules=[ + Extension( + name="_binding", + sources=[ + "bindings/python/tree_sitter_dotprompt/binding.c", + "src/parser.c", + # NOTE: if your language uses an external scanner, add it here. + ], + extra_compile_args=[ + "-std=c11", + ] if system() != "Windows" else [ + "/std:c11", + "/utf-8", + ], + define_macros=[ + ("Py_LIMITED_API", "0x03080000"), + ("PY_SSIZE_T_CLEAN", None) + ], + include_dirs=["src"], + py_limited_api=True, + ) + ], + cmdclass={ + "build": Build, + "bdist_wheel": BdistWheel + }, + zip_safe=False +) diff --git a/packages/treesitter/src/grammar.json b/packages/treesitter/src/grammar.json new file mode 100644 index 000000000..d88877cce --- /dev/null +++ b/packages/treesitter/src/grammar.json @@ -0,0 +1,587 @@ +{ + "name": "dotprompt", + "rules": { + "document": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "license_header" + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "frontmatter" + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "template_body" + }, + { + "type": "BLANK" + } + ] + } + ] + }, + "license_header": { + "type": "REPEAT1", + "content": { + "type": "SYMBOL", + "name": "header_comment" + } + }, + "header_comment": { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "#" + }, + { + "type": "PATTERN", + "value": ".*" + } + ] + } + }, + "frontmatter": { + "type": "PREC", + "value": 1, + "content": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "frontmatter_delimiter" + }, + { + "type": "PATTERN", + "value": "\\r?\\n" + }, + { + "type": "ALIAS", + "content": { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "_yaml_content" + } + }, + "named": true, + "value": "yaml_content" + }, + { + "type": "SYMBOL", + "name": "frontmatter_delimiter" + }, + { + "type": "PATTERN", + "value": "\\r?\\n" + } + ] + } + }, + "frontmatter_delimiter": { + "type": "TOKEN", + "content": { + "type": "PREC", + "value": 10, + "content": { + "type": "STRING", + "value": "---" + } + } + }, + "_yaml_content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "yaml_line" + }, + { + "type": "SYMBOL", + "name": "header_comment" + }, + { + "type": "PATTERN", + "value": "\\s+" + } + ] + }, + "yaml_line": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "key", + "content": { + "type": "ALIAS", + "content": { + "type": "PATTERN", + "value": "[a-zA-Z_][a-zA-Z0-9_-]*" + }, + "named": true, + "value": "yaml_key" + } + }, + { + "type": "STRING", + "value": ":" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "FIELD", + "name": "value", + "content": { + "type": "ALIAS", + "content": { + "type": "PATTERN", + "value": ".+" + }, + "named": true, + "value": "yaml_value" + } + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "PATTERN", + "value": "\\r?\\n" + } + ] + }, + "template_body": { + "type": "REPEAT1", + "content": { + "type": "SYMBOL", + "name": "_content" + } + }, + "_content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "handlebars_block" + }, + { + "type": "SYMBOL", + "name": "handlebars_expression" + }, + { + "type": "SYMBOL", + "name": "handlebars_comment" + }, + { + "type": "SYMBOL", + "name": "dotprompt_marker" + }, + { + "type": "SYMBOL", + "name": "text" + } + ] + }, + "handlebars_block": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "block_expression" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "_content" + } + }, + { + "type": "SYMBOL", + "name": "close_block" + } + ] + }, + "block_expression": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "{{#" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "path" + }, + "named": true, + "value": "block_name" + } + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "argument" + } + }, + { + "type": "STRING", + "value": "}}" + } + ] + }, + "close_block": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "{{/" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "path" + }, + "named": true, + "value": "block_name" + } + }, + { + "type": "STRING", + "value": "}}" + } + ] + }, + "handlebars_expression": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "{{" + }, + { + "type": "SYMBOL", + "name": "expression_content" + }, + { + "type": "STRING", + "value": "}}" + } + ] + }, + "expression_content": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": ">" + }, + { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "path" + }, + "named": true, + "value": "partial_reference" + } + ] + }, + { + "type": "STRING", + "value": "else" + }, + { + "type": "SEQ", + "members": [ + { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "path" + }, + "named": true, + "value": "helper_name" + }, + { + "type": "REPEAT1", + "content": { + "type": "SYMBOL", + "name": "argument" + } + } + ] + }, + { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "variable_reference" + }, + "named": true, + "value": "variable_reference" + } + ] + }, + "handlebars_comment": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "{{!" + }, + { + "type": "PATTERN", + "value": "([^}]|}[^}])*?" + }, + { + "type": "STRING", + "value": "}}" + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "{{!--" + }, + { + "type": "PATTERN", + "value": "([^-]|-+|-[^}])*?" + }, + { + "type": "STRING", + "value": "--}}" + } + ] + } + ] + }, + "argument": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "string_literal" + }, + { + "type": "SYMBOL", + "name": "number" + }, + { + "type": "SYMBOL", + "name": "boolean" + }, + { + "type": "SYMBOL", + "name": "variable_reference" + }, + { + "type": "SYMBOL", + "name": "hash_param" + } + ] + }, + "hash_param": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "key", + "content": { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "path" + }, + "named": true, + "value": "key" + } + }, + { + "type": "STRING", + "value": "=" + }, + { + "type": "FIELD", + "name": "value", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "string_literal" + }, + { + "type": "SYMBOL", + "name": "number" + }, + { + "type": "SYMBOL", + "name": "boolean" + }, + { + "type": "SYMBOL", + "name": "variable_reference" + } + ] + } + } + ] + }, + "variable_reference": { + "type": "CHOICE", + "members": [ + { + "type": "PATTERN", + "value": "@[a-zA-Z_][a-zA-Z0-9_]*" + }, + { + "type": "SYMBOL", + "name": "path" + } + ] + }, + "path": { + "type": "PATTERN", + "value": "[a-zA-Z_][a-zA-Z0-9_.]*" + }, + "string_literal": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "\"" + }, + { + "type": "PATTERN", + "value": "([^\"\\\\]|\\\\.)*" + }, + { + "type": "STRING", + "value": "\"" + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "'" + }, + { + "type": "PATTERN", + "value": "([^'\\\\]|\\\\.)*" + }, + { + "type": "STRING", + "value": "'" + } + ] + } + ] + }, + "number": { + "type": "PATTERN", + "value": "-?\\d+(\\.\\d+)?" + }, + "boolean": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "true" + }, + { + "type": "STRING", + "value": "false" + } + ] + }, + "dotprompt_marker": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "<<]+" + }, + "named": true, + "value": "marker_content" + }, + { + "type": "STRING", + "value": ">>>" + } + ] + }, + "text": { + "type": "PATTERN", + "value": "[^{<#]+|\\{|<|#" + } + }, + "extras": [ + { + "type": "PATTERN", + "value": "\\s" + } + ], + "conflicts": [], + "precedences": [], + "externals": [], + "inline": [], + "supertypes": [] +} diff --git a/packages/treesitter/src/node-types.json b/packages/treesitter/src/node-types.json new file mode 100644 index 000000000..84bfcaf80 --- /dev/null +++ b/packages/treesitter/src/node-types.json @@ -0,0 +1,488 @@ +[ + { + "type": "argument", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "boolean", + "named": true + }, + { + "type": "hash_param", + "named": true + }, + { + "type": "number", + "named": true + }, + { + "type": "string_literal", + "named": true + }, + { + "type": "variable_reference", + "named": true + } + ] + } + }, + { + "type": "block_expression", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "block_name", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "argument", + "named": true + } + ] + } + }, + { + "type": "boolean", + "named": true, + "fields": {} + }, + { + "type": "close_block", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "block_name", + "named": true + } + ] + } + } + }, + { + "type": "document", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "frontmatter", + "named": true + }, + { + "type": "license_header", + "named": true + }, + { + "type": "template_body", + "named": true + } + ] + } + }, + { + "type": "dotprompt_marker", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "marker_content", + "named": true + } + ] + } + }, + { + "type": "expression_content", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "argument", + "named": true + }, + { + "type": "helper_name", + "named": true + }, + { + "type": "partial_reference", + "named": true + }, + { + "type": "variable_reference", + "named": true + } + ] + } + }, + { + "type": "frontmatter", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "frontmatter_delimiter", + "named": true + }, + { + "type": "yaml_content", + "named": true + } + ] + } + }, + { + "type": "handlebars_block", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "block_expression", + "named": true + }, + { + "type": "close_block", + "named": true + }, + { + "type": "dotprompt_marker", + "named": true + }, + { + "type": "handlebars_block", + "named": true + }, + { + "type": "handlebars_comment", + "named": true + }, + { + "type": "handlebars_expression", + "named": true + }, + { + "type": "text", + "named": true + } + ] + } + }, + { + "type": "handlebars_comment", + "named": true, + "fields": {} + }, + { + "type": "handlebars_expression", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression_content", + "named": true + } + ] + } + }, + { + "type": "hash_param", + "named": true, + "fields": { + "key": { + "multiple": false, + "required": true, + "types": [ + { + "type": "key", + "named": true + } + ] + }, + "value": { + "multiple": false, + "required": true, + "types": [ + { + "type": "boolean", + "named": true + }, + { + "type": "number", + "named": true + }, + { + "type": "string_literal", + "named": true + }, + { + "type": "variable_reference", + "named": true + } + ] + } + } + }, + { + "type": "license_header", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "header_comment", + "named": true + } + ] + } + }, + { + "type": "string_literal", + "named": true, + "fields": {} + }, + { + "type": "template_body", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "dotprompt_marker", + "named": true + }, + { + "type": "handlebars_block", + "named": true + }, + { + "type": "handlebars_comment", + "named": true + }, + { + "type": "handlebars_expression", + "named": true + }, + { + "type": "text", + "named": true + } + ] + } + }, + { + "type": "variable_reference", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": false, + "types": [ + { + "type": "path", + "named": true + } + ] + } + }, + { + "type": "yaml_content", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "header_comment", + "named": true + }, + { + "type": "yaml_line", + "named": true + } + ] + } + }, + { + "type": "yaml_line", + "named": true, + "fields": { + "key": { + "multiple": false, + "required": true, + "types": [ + { + "type": "yaml_key", + "named": true + } + ] + }, + "value": { + "multiple": false, + "required": false, + "types": [ + { + "type": "yaml_value", + "named": true + } + ] + } + } + }, + { + "type": "\"", + "named": false + }, + { + "type": "'", + "named": false + }, + { + "type": "--}}", + "named": false + }, + { + "type": ":", + "named": false + }, + { + "type": "<<", + "named": false + }, + { + "type": ">>>", + "named": false + }, + { + "type": "block_name", + "named": true + }, + { + "type": "else", + "named": false + }, + { + "type": "false", + "named": false + }, + { + "type": "frontmatter_delimiter", + "named": true + }, + { + "type": "header_comment", + "named": true + }, + { + "type": "helper_name", + "named": true + }, + { + "type": "key", + "named": true + }, + { + "type": "marker_content", + "named": true + }, + { + "type": "number", + "named": true + }, + { + "type": "partial_reference", + "named": true + }, + { + "type": "path", + "named": true + }, + { + "type": "text", + "named": true + }, + { + "type": "true", + "named": false + }, + { + "type": "yaml_key", + "named": true + }, + { + "type": "yaml_value", + "named": true + }, + { + "type": "{{", + "named": false + }, + { + "type": "{{!", + "named": false + }, + { + "type": "{{!--", + "named": false + }, + { + "type": "{{#", + "named": false + }, + { + "type": "{{/", + "named": false + }, + { + "type": "}}", + "named": false + } +] diff --git a/packages/treesitter/src/parser.c b/packages/treesitter/src/parser.c new file mode 100644 index 000000000..a27124498 --- /dev/null +++ b/packages/treesitter/src/parser.c @@ -0,0 +1,2491 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "tree_sitter/parser.h" + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#define LANGUAGE_VERSION 14 +#define STATE_COUNT 87 +#define LARGE_STATE_COUNT 2 +#define SYMBOL_COUNT 56 +#define ALIAS_COUNT 5 +#define TOKEN_COUNT 33 +#define EXTERNAL_TOKEN_COUNT 0 +#define FIELD_COUNT 3 +#define MAX_ALIAS_SEQUENCE_LENGTH 5 +#define PRODUCTION_ID_COUNT 9 + +enum ts_symbol_identifiers { + sym_header_comment = 1, + aux_sym_frontmatter_token1 = 2, + sym_frontmatter_delimiter = 3, + aux_sym__yaml_content_token1 = 4, + aux_sym_yaml_line_token1 = 5, + anon_sym_COLON = 6, + aux_sym_yaml_line_token2 = 7, + anon_sym_LBRACE_LBRACE_POUND = 8, + anon_sym_RBRACE_RBRACE = 9, + anon_sym_LBRACE_LBRACE_SLASH = 10, + anon_sym_LBRACE_LBRACE = 11, + anon_sym_GT = 12, + anon_sym_else = 13, + anon_sym_LBRACE_LBRACE_BANG = 14, + aux_sym_handlebars_comment_token1 = 15, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH = 16, + aux_sym_handlebars_comment_token2 = 17, + anon_sym_DASH_DASH_RBRACE_RBRACE = 18, + anon_sym_EQ = 19, + aux_sym_variable_reference_token1 = 20, + sym_path = 21, + anon_sym_DQUOTE = 22, + aux_sym_string_literal_token1 = 23, + anon_sym_SQUOTE = 24, + aux_sym_string_literal_token2 = 25, + sym_number = 26, + anon_sym_true = 27, + anon_sym_false = 28, + anon_sym_LT_LT_LTdotprompt_COLON = 29, + aux_sym_dotprompt_marker_token1 = 30, + anon_sym_GT_GT_GT = 31, + sym_text = 32, + sym_document = 33, + sym_license_header = 34, + sym_frontmatter = 35, + sym__yaml_content = 36, + sym_yaml_line = 37, + sym_template_body = 38, + sym__content = 39, + sym_handlebars_block = 40, + sym_block_expression = 41, + sym_close_block = 42, + sym_handlebars_expression = 43, + sym_expression_content = 44, + sym_handlebars_comment = 45, + sym_argument = 46, + sym_hash_param = 47, + sym_variable_reference = 48, + sym_string_literal = 49, + sym_boolean = 50, + sym_dotprompt_marker = 51, + aux_sym_license_header_repeat1 = 52, + aux_sym_frontmatter_repeat1 = 53, + aux_sym_template_body_repeat1 = 54, + aux_sym_block_expression_repeat1 = 55, + alias_sym_block_name = 56, + alias_sym_helper_name = 57, + alias_sym_key = 58, + alias_sym_partial_reference = 59, + alias_sym_yaml_content = 60, +}; + +static const char * const ts_symbol_names[] = { + [ts_builtin_sym_end] = "end", + [sym_header_comment] = "header_comment", + [aux_sym_frontmatter_token1] = "frontmatter_token1", + [sym_frontmatter_delimiter] = "frontmatter_delimiter", + [aux_sym__yaml_content_token1] = "_yaml_content_token1", + [aux_sym_yaml_line_token1] = "yaml_key", + [anon_sym_COLON] = ":", + [aux_sym_yaml_line_token2] = "yaml_value", + [anon_sym_LBRACE_LBRACE_POUND] = "{{#", + [anon_sym_RBRACE_RBRACE] = "}}", + [anon_sym_LBRACE_LBRACE_SLASH] = "{{/", + [anon_sym_LBRACE_LBRACE] = "{{", + [anon_sym_GT] = ">", + [anon_sym_else] = "else", + [anon_sym_LBRACE_LBRACE_BANG] = "{{!", + [aux_sym_handlebars_comment_token1] = "handlebars_comment_token1", + [anon_sym_LBRACE_LBRACE_BANG_DASH_DASH] = "{{!--", + [aux_sym_handlebars_comment_token2] = "handlebars_comment_token2", + [anon_sym_DASH_DASH_RBRACE_RBRACE] = "--}}", + [anon_sym_EQ] = "=", + [aux_sym_variable_reference_token1] = "variable_reference_token1", + [sym_path] = "path", + [anon_sym_DQUOTE] = "\"", + [aux_sym_string_literal_token1] = "string_literal_token1", + [anon_sym_SQUOTE] = "'", + [aux_sym_string_literal_token2] = "string_literal_token2", + [sym_number] = "number", + [anon_sym_true] = "true", + [anon_sym_false] = "false", + [anon_sym_LT_LT_LTdotprompt_COLON] = "<<eof(lexer); + switch (state) { + case 0: + if (eof) ADVANCE(40); + ADVANCE_MAP( + '"', 78, + '#', 41, + '\'', 81, + '-', 6, + ':', 47, + '<', 13, + '=', 65, + '>', 56, + '@', 33, + 'e', 71, + 'f', 67, + 't', 73, + '{', 26, + '}', 27, + ); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') SKIP(0); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(84); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 1: + if (lookahead == '\n') ADVANCE(42); + if (lookahead == '\r') ADVANCE(48); + if (('\t' <= lookahead && lookahead <= '\f') || + lookahead == ' ') ADVANCE(48); + if (lookahead != 0) ADVANCE(49); + END_STATE(); + case 2: + if (lookahead == '\n') ADVANCE(43); + if (lookahead == '\r') ADVANCE(2); + if (('\t' <= lookahead && lookahead <= '\f') || + lookahead == ' ') SKIP(2); + END_STATE(); + case 3: + ADVANCE_MAP( + '"', 78, + '\'', 81, + '-', 31, + '=', 65, + '>', 14, + '@', 33, + 'f', 67, + 't', 73, + '}', 27, + ); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') SKIP(3); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(84); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 4: + if (lookahead == '#') ADVANCE(41); + if (lookahead == '-') ADVANCE(10); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(45); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); + END_STATE(); + case 5: + if (lookahead == '#') ADVANCE(92); + if (lookahead == '<') ADVANCE(99); + if (lookahead == '{') ADVANCE(100); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(96); + if (lookahead != 0) ADVANCE(102); + END_STATE(); + case 6: + if (lookahead == '-') ADVANCE(8); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(84); + END_STATE(); + case 7: + if (lookahead == '-') ADVANCE(44); + END_STATE(); + case 8: + if (lookahead == '-') ADVANCE(44); + if (lookahead == '}') ADVANCE(28); + END_STATE(); + case 9: + if (lookahead == '-') ADVANCE(61); + END_STATE(); + case 10: + if (lookahead == '-') ADVANCE(7); + END_STATE(); + case 11: + if (lookahead == ':') ADVANCE(88); + END_STATE(); + case 12: + if (lookahead == '<') ADVANCE(17); + END_STATE(); + case 13: + if (lookahead == '<') ADVANCE(12); + END_STATE(); + case 14: + if (lookahead == '>') ADVANCE(15); + END_STATE(); + case 15: + if (lookahead == '>') ADVANCE(91); + END_STATE(); + case 16: + if (lookahead == '>') ADVANCE(55); + if (lookahead == '@') ADVANCE(33); + if (lookahead == 'e') ADVANCE(71); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') SKIP(16); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 17: + if (lookahead == 'd') ADVANCE(19); + END_STATE(); + case 18: + if (lookahead == 'm') ADVANCE(22); + END_STATE(); + case 19: + if (lookahead == 'o') ADVANCE(24); + END_STATE(); + case 20: + if (lookahead == 'o') ADVANCE(18); + END_STATE(); + case 21: + if (lookahead == 'p') ADVANCE(23); + END_STATE(); + case 22: + if (lookahead == 'p') ADVANCE(25); + END_STATE(); + case 23: + if (lookahead == 'r') ADVANCE(20); + END_STATE(); + case 24: + if (lookahead == 't') ADVANCE(21); + END_STATE(); + case 25: + if (lookahead == 't') ADVANCE(11); + END_STATE(); + case 26: + if (lookahead == '{') ADVANCE(54); + END_STATE(); + case 27: + if (lookahead == '}') ADVANCE(51); + END_STATE(); + case 28: + if (lookahead == '}') ADVANCE(64); + END_STATE(); + case 29: + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') SKIP(29); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 30: + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(89); + if (lookahead != 0 && + lookahead != '>') ADVANCE(90); + END_STATE(); + case 31: + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(84); + END_STATE(); + case 32: + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(85); + END_STATE(); + case 33: + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(66); + END_STATE(); + case 34: + if (lookahead != 0 && + lookahead != '\n') ADVANCE(83); + END_STATE(); + case 35: + if (lookahead != 0 && + lookahead != '\n') ADVANCE(80); + END_STATE(); + case 36: + if (lookahead != 0 && + lookahead != '}') ADVANCE(60); + END_STATE(); + case 37: + if (eof) ADVANCE(40); + if (lookahead == '#') ADVANCE(41); + if (lookahead == '-') ADVANCE(98); + if (lookahead == '<') ADVANCE(99); + if (lookahead == '{') ADVANCE(101); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(93); + if (lookahead != 0) ADVANCE(102); + END_STATE(); + case 38: + if (eof) ADVANCE(40); + if (lookahead == '#') ADVANCE(92); + if (lookahead == '-') ADVANCE(98); + if (lookahead == '<') ADVANCE(99); + if (lookahead == '{') ADVANCE(101); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(94); + if (lookahead != 0) ADVANCE(102); + END_STATE(); + case 39: + if (eof) ADVANCE(40); + if (lookahead == '#') ADVANCE(92); + if (lookahead == '<') ADVANCE(99); + if (lookahead == '{') ADVANCE(101); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(95); + if (lookahead != 0) ADVANCE(102); + END_STATE(); + case 40: + ACCEPT_TOKEN(ts_builtin_sym_end); + END_STATE(); + case 41: + ACCEPT_TOKEN(sym_header_comment); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(41); + END_STATE(); + case 42: + ACCEPT_TOKEN(aux_sym_frontmatter_token1); + if (lookahead == '\n') ADVANCE(42); + if (lookahead == '\r') ADVANCE(48); + if (('\t' <= lookahead && lookahead <= '\f') || + lookahead == ' ') ADVANCE(48); + END_STATE(); + case 43: + ACCEPT_TOKEN(aux_sym_frontmatter_token1); + if (lookahead == '\n') ADVANCE(43); + if (lookahead == '\r') ADVANCE(2); + END_STATE(); + case 44: + ACCEPT_TOKEN(sym_frontmatter_delimiter); + END_STATE(); + case 45: + ACCEPT_TOKEN(aux_sym__yaml_content_token1); + if (lookahead == '-') ADVANCE(10); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(45); + END_STATE(); + case 46: + ACCEPT_TOKEN(aux_sym_yaml_line_token1); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); + END_STATE(); + case 47: + ACCEPT_TOKEN(anon_sym_COLON); + END_STATE(); + case 48: + ACCEPT_TOKEN(aux_sym_yaml_line_token2); + if (lookahead == '\n') ADVANCE(42); + if (lookahead == '\r') ADVANCE(48); + if (('\t' <= lookahead && lookahead <= '\f') || + lookahead == ' ') ADVANCE(48); + if (lookahead != 0) ADVANCE(49); + END_STATE(); + case 49: + ACCEPT_TOKEN(aux_sym_yaml_line_token2); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(49); + END_STATE(); + case 50: + ACCEPT_TOKEN(anon_sym_LBRACE_LBRACE_POUND); + END_STATE(); + case 51: + ACCEPT_TOKEN(anon_sym_RBRACE_RBRACE); + END_STATE(); + case 52: + ACCEPT_TOKEN(anon_sym_LBRACE_LBRACE_SLASH); + END_STATE(); + case 53: + ACCEPT_TOKEN(anon_sym_LBRACE_LBRACE); + if (lookahead == '!') ADVANCE(58); + if (lookahead == '#') ADVANCE(50); + END_STATE(); + case 54: + ACCEPT_TOKEN(anon_sym_LBRACE_LBRACE); + if (lookahead == '!') ADVANCE(58); + if (lookahead == '#') ADVANCE(50); + if (lookahead == '/') ADVANCE(52); + END_STATE(); + case 55: + ACCEPT_TOKEN(anon_sym_GT); + END_STATE(); + case 56: + ACCEPT_TOKEN(anon_sym_GT); + if (lookahead == '>') ADVANCE(15); + END_STATE(); + case 57: + ACCEPT_TOKEN(anon_sym_else); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 58: + ACCEPT_TOKEN(anon_sym_LBRACE_LBRACE_BANG); + if (lookahead == '-') ADVANCE(9); + END_STATE(); + case 59: + ACCEPT_TOKEN(aux_sym_handlebars_comment_token1); + if (lookahead == '}') ADVANCE(36); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(59); + if (lookahead != 0) ADVANCE(60); + END_STATE(); + case 60: + ACCEPT_TOKEN(aux_sym_handlebars_comment_token1); + if (lookahead == '}') ADVANCE(36); + if (lookahead != 0) ADVANCE(60); + END_STATE(); + case 61: + ACCEPT_TOKEN(anon_sym_LBRACE_LBRACE_BANG_DASH_DASH); + END_STATE(); + case 62: + ACCEPT_TOKEN(aux_sym_handlebars_comment_token2); + if (lookahead == '-') ADVANCE(63); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(62); + if (lookahead != 0) ADVANCE(63); + END_STATE(); + case 63: + ACCEPT_TOKEN(aux_sym_handlebars_comment_token2); + if (lookahead == '-') ADVANCE(63); + if (lookahead != 0) ADVANCE(63); + END_STATE(); + case 64: + ACCEPT_TOKEN(anon_sym_DASH_DASH_RBRACE_RBRACE); + END_STATE(); + case 65: + ACCEPT_TOKEN(anon_sym_EQ); + END_STATE(); + case 66: + ACCEPT_TOKEN(aux_sym_variable_reference_token1); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(66); + END_STATE(); + case 67: + ACCEPT_TOKEN(sym_path); + if (lookahead == 'a') ADVANCE(72); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 68: + ACCEPT_TOKEN(sym_path); + if (lookahead == 'e') ADVANCE(57); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 69: + ACCEPT_TOKEN(sym_path); + if (lookahead == 'e') ADVANCE(86); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 70: + ACCEPT_TOKEN(sym_path); + if (lookahead == 'e') ADVANCE(87); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 71: + ACCEPT_TOKEN(sym_path); + if (lookahead == 'l') ADVANCE(74); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 72: + ACCEPT_TOKEN(sym_path); + if (lookahead == 'l') ADVANCE(75); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 73: + ACCEPT_TOKEN(sym_path); + if (lookahead == 'r') ADVANCE(76); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 74: + ACCEPT_TOKEN(sym_path); + if (lookahead == 's') ADVANCE(68); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 75: + ACCEPT_TOKEN(sym_path); + if (lookahead == 's') ADVANCE(70); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 76: + ACCEPT_TOKEN(sym_path); + if (lookahead == 'u') ADVANCE(69); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 77: + ACCEPT_TOKEN(sym_path); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 78: + ACCEPT_TOKEN(anon_sym_DQUOTE); + END_STATE(); + case 79: + ACCEPT_TOKEN(aux_sym_string_literal_token1); + if (lookahead == '\\') ADVANCE(35); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(79); + if (lookahead != 0 && + lookahead != '"') ADVANCE(80); + END_STATE(); + case 80: + ACCEPT_TOKEN(aux_sym_string_literal_token1); + if (lookahead == '\\') ADVANCE(35); + if (lookahead != 0 && + lookahead != '"') ADVANCE(80); + END_STATE(); + case 81: + ACCEPT_TOKEN(anon_sym_SQUOTE); + END_STATE(); + case 82: + ACCEPT_TOKEN(aux_sym_string_literal_token2); + if (lookahead == '\\') ADVANCE(34); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(82); + if (lookahead != 0 && + lookahead != '\'') ADVANCE(83); + END_STATE(); + case 83: + ACCEPT_TOKEN(aux_sym_string_literal_token2); + if (lookahead == '\\') ADVANCE(34); + if (lookahead != 0 && + lookahead != '\'') ADVANCE(83); + END_STATE(); + case 84: + ACCEPT_TOKEN(sym_number); + if (lookahead == '.') ADVANCE(32); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(84); + END_STATE(); + case 85: + ACCEPT_TOKEN(sym_number); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(85); + END_STATE(); + case 86: + ACCEPT_TOKEN(anon_sym_true); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 87: + ACCEPT_TOKEN(anon_sym_false); + if (lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(77); + END_STATE(); + case 88: + ACCEPT_TOKEN(anon_sym_LT_LT_LTdotprompt_COLON); + END_STATE(); + case 89: + ACCEPT_TOKEN(aux_sym_dotprompt_marker_token1); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(89); + if (lookahead != 0 && + lookahead != '>') ADVANCE(90); + END_STATE(); + case 90: + ACCEPT_TOKEN(aux_sym_dotprompt_marker_token1); + if (lookahead != 0 && + lookahead != '>') ADVANCE(90); + END_STATE(); + case 91: + ACCEPT_TOKEN(anon_sym_GT_GT_GT); + END_STATE(); + case 92: + ACCEPT_TOKEN(sym_text); + END_STATE(); + case 93: + ACCEPT_TOKEN(sym_text); + if (lookahead == '#') ADVANCE(41); + if (lookahead == '-') ADVANCE(98); + if (lookahead == '<') ADVANCE(99); + if (lookahead == '{') ADVANCE(101); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(93); + if (lookahead != 0) ADVANCE(102); + END_STATE(); + case 94: + ACCEPT_TOKEN(sym_text); + if (lookahead == '#') ADVANCE(92); + if (lookahead == '-') ADVANCE(98); + if (lookahead == '<') ADVANCE(99); + if (lookahead == '{') ADVANCE(101); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(94); + if (lookahead != 0) ADVANCE(102); + END_STATE(); + case 95: + ACCEPT_TOKEN(sym_text); + if (lookahead == '#') ADVANCE(92); + if (lookahead == '<') ADVANCE(99); + if (lookahead == '{') ADVANCE(101); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(95); + if (lookahead != 0) ADVANCE(102); + END_STATE(); + case 96: + ACCEPT_TOKEN(sym_text); + if (lookahead == '#') ADVANCE(92); + if (lookahead == '<') ADVANCE(99); + if (lookahead == '{') ADVANCE(100); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(96); + if (lookahead != 0) ADVANCE(102); + END_STATE(); + case 97: + ACCEPT_TOKEN(sym_text); + if (lookahead == '-') ADVANCE(44); + if (lookahead != 0 && + lookahead != '#' && + lookahead != '<' && + lookahead != '{') ADVANCE(102); + END_STATE(); + case 98: + ACCEPT_TOKEN(sym_text); + if (lookahead == '-') ADVANCE(97); + if (lookahead != 0 && + lookahead != '#' && + lookahead != '<' && + lookahead != '{') ADVANCE(102); + END_STATE(); + case 99: + ACCEPT_TOKEN(sym_text); + if (lookahead == '<') ADVANCE(12); + END_STATE(); + case 100: + ACCEPT_TOKEN(sym_text); + if (lookahead == '{') ADVANCE(54); + END_STATE(); + case 101: + ACCEPT_TOKEN(sym_text); + if (lookahead == '{') ADVANCE(53); + END_STATE(); + case 102: + ACCEPT_TOKEN(sym_text); + if (lookahead != 0 && + lookahead != '#' && + lookahead != '<' && + lookahead != '{') ADVANCE(102); + END_STATE(); + default: + return false; + } +} + +static const TSLexMode ts_lex_modes[STATE_COUNT] = { + [0] = {.lex_state = 0}, + [1] = {.lex_state = 37}, + [2] = {.lex_state = 38}, + [3] = {.lex_state = 39}, + [4] = {.lex_state = 5}, + [5] = {.lex_state = 5}, + [6] = {.lex_state = 5}, + [7] = {.lex_state = 39}, + [8] = {.lex_state = 5}, + [9] = {.lex_state = 5}, + [10] = {.lex_state = 39}, + [11] = {.lex_state = 39}, + [12] = {.lex_state = 3}, + [13] = {.lex_state = 3}, + [14] = {.lex_state = 3}, + [15] = {.lex_state = 3}, + [16] = {.lex_state = 3}, + [17] = {.lex_state = 3}, + [18] = {.lex_state = 37}, + [19] = {.lex_state = 37}, + [20] = {.lex_state = 3}, + [21] = {.lex_state = 3}, + [22] = {.lex_state = 3}, + [23] = {.lex_state = 3}, + [24] = {.lex_state = 3}, + [25] = {.lex_state = 3}, + [26] = {.lex_state = 5}, + [27] = {.lex_state = 39}, + [28] = {.lex_state = 39}, + [29] = {.lex_state = 39}, + [30] = {.lex_state = 5}, + [31] = {.lex_state = 5}, + [32] = {.lex_state = 5}, + [33] = {.lex_state = 4}, + [34] = {.lex_state = 4}, + [35] = {.lex_state = 4}, + [36] = {.lex_state = 5}, + [37] = {.lex_state = 39}, + [38] = {.lex_state = 39}, + [39] = {.lex_state = 39}, + [40] = {.lex_state = 5}, + [41] = {.lex_state = 5}, + [42] = {.lex_state = 5}, + [43] = {.lex_state = 39}, + [44] = {.lex_state = 39}, + [45] = {.lex_state = 16}, + [46] = {.lex_state = 16}, + [47] = {.lex_state = 4}, + [48] = {.lex_state = 4}, + [49] = {.lex_state = 4}, + [50] = {.lex_state = 1}, + [51] = {.lex_state = 0}, + [52] = {.lex_state = 0}, + [53] = {.lex_state = 2}, + [54] = {.lex_state = 82}, + [55] = {.lex_state = 2}, + [56] = {.lex_state = 79}, + [57] = {.lex_state = 0}, + [58] = {.lex_state = 0}, + [59] = {.lex_state = 0}, + [60] = {.lex_state = 2}, + [61] = {.lex_state = 29}, + [62] = {.lex_state = 0}, + [63] = {.lex_state = 2}, + [64] = {.lex_state = 3}, + [65] = {.lex_state = 0}, + [66] = {.lex_state = 0}, + [67] = {.lex_state = 0}, + [68] = {.lex_state = 0}, + [69] = {.lex_state = 3}, + [70] = {.lex_state = 0}, + [71] = {.lex_state = 29}, + [72] = {.lex_state = 0}, + [73] = {.lex_state = 0}, + [74] = {.lex_state = 30}, + [75] = {.lex_state = 62}, + [76] = {.lex_state = 0}, + [77] = {.lex_state = 0}, + [78] = {.lex_state = 0}, + [79] = {.lex_state = 0}, + [80] = {.lex_state = 59}, + [81] = {.lex_state = 0}, + [82] = {.lex_state = 29}, + [83] = {.lex_state = 59}, + [84] = {.lex_state = 62}, + [85] = {.lex_state = 30}, + [86] = {.lex_state = 29}, +}; + +static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { + [0] = { + [ts_builtin_sym_end] = ACTIONS(1), + [sym_header_comment] = ACTIONS(1), + [sym_frontmatter_delimiter] = ACTIONS(1), + [anon_sym_COLON] = ACTIONS(1), + [anon_sym_LBRACE_LBRACE_POUND] = ACTIONS(1), + [anon_sym_RBRACE_RBRACE] = ACTIONS(1), + [anon_sym_LBRACE_LBRACE_SLASH] = ACTIONS(1), + [anon_sym_LBRACE_LBRACE] = ACTIONS(1), + [anon_sym_GT] = ACTIONS(1), + [anon_sym_else] = ACTIONS(1), + [anon_sym_LBRACE_LBRACE_BANG] = ACTIONS(1), + [anon_sym_LBRACE_LBRACE_BANG_DASH_DASH] = ACTIONS(1), + [anon_sym_DASH_DASH_RBRACE_RBRACE] = ACTIONS(1), + [anon_sym_EQ] = ACTIONS(1), + [aux_sym_variable_reference_token1] = ACTIONS(1), + [sym_path] = ACTIONS(1), + [anon_sym_DQUOTE] = ACTIONS(1), + [anon_sym_SQUOTE] = ACTIONS(1), + [sym_number] = ACTIONS(1), + [anon_sym_true] = ACTIONS(1), + [anon_sym_false] = ACTIONS(1), + [anon_sym_LT_LT_LTdotprompt_COLON] = ACTIONS(1), + [anon_sym_GT_GT_GT] = ACTIONS(1), + }, + [1] = { + [sym_document] = STATE(73), + [sym_license_header] = STATE(2), + [sym_frontmatter] = STATE(7), + [sym_template_body] = STATE(72), + [sym__content] = STATE(10), + [sym_handlebars_block] = STATE(10), + [sym_block_expression] = STATE(8), + [sym_handlebars_expression] = STATE(10), + [sym_handlebars_comment] = STATE(10), + [sym_dotprompt_marker] = STATE(10), + [aux_sym_license_header_repeat1] = STATE(18), + [aux_sym_template_body_repeat1] = STATE(10), + [ts_builtin_sym_end] = ACTIONS(3), + [sym_header_comment] = ACTIONS(5), + [sym_frontmatter_delimiter] = ACTIONS(7), + [anon_sym_LBRACE_LBRACE_POUND] = ACTIONS(9), + [anon_sym_LBRACE_LBRACE] = ACTIONS(11), + [anon_sym_LBRACE_LBRACE_BANG] = ACTIONS(13), + [anon_sym_LBRACE_LBRACE_BANG_DASH_DASH] = ACTIONS(15), + [anon_sym_LT_LT_LTdotprompt_COLON] = ACTIONS(17), + [sym_text] = ACTIONS(19), + }, +}; + +static const uint16_t ts_small_parse_table[] = { + [0] = 12, + ACTIONS(7), 1, + sym_frontmatter_delimiter, + ACTIONS(9), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(11), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(13), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(15), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(17), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(19), 1, + sym_text, + ACTIONS(21), 1, + ts_builtin_sym_end, + STATE(3), 1, + sym_frontmatter, + STATE(8), 1, + sym_block_expression, + STATE(62), 1, + sym_template_body, + STATE(10), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [42] = 10, + ACTIONS(9), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(11), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(13), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(15), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(17), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(19), 1, + sym_text, + ACTIONS(23), 1, + ts_builtin_sym_end, + STATE(8), 1, + sym_block_expression, + STATE(68), 1, + sym_template_body, + STATE(10), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [78] = 10, + ACTIONS(9), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(25), 1, + anon_sym_LBRACE_LBRACE_SLASH, + ACTIONS(27), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(29), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(31), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(33), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(35), 1, + sym_text, + STATE(5), 1, + sym_block_expression, + STATE(41), 1, + sym_close_block, + STATE(9), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [114] = 10, + ACTIONS(9), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(25), 1, + anon_sym_LBRACE_LBRACE_SLASH, + ACTIONS(27), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(29), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(31), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(33), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(37), 1, + sym_text, + STATE(5), 1, + sym_block_expression, + STATE(30), 1, + sym_close_block, + STATE(4), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [150] = 10, + ACTIONS(9), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(27), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(29), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(31), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(33), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(35), 1, + sym_text, + ACTIONS(39), 1, + anon_sym_LBRACE_LBRACE_SLASH, + STATE(5), 1, + sym_block_expression, + STATE(39), 1, + sym_close_block, + STATE(9), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [186] = 10, + ACTIONS(9), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(11), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(13), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(15), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(17), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(19), 1, + sym_text, + ACTIONS(21), 1, + ts_builtin_sym_end, + STATE(8), 1, + sym_block_expression, + STATE(62), 1, + sym_template_body, + STATE(10), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [222] = 10, + ACTIONS(9), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(27), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(29), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(31), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(33), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(39), 1, + anon_sym_LBRACE_LBRACE_SLASH, + ACTIONS(41), 1, + sym_text, + STATE(5), 1, + sym_block_expression, + STATE(29), 1, + sym_close_block, + STATE(6), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [258] = 9, + ACTIONS(43), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(46), 1, + anon_sym_LBRACE_LBRACE_SLASH, + ACTIONS(48), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(51), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(54), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(57), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(60), 1, + sym_text, + STATE(5), 1, + sym_block_expression, + STATE(9), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [291] = 9, + ACTIONS(9), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(11), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(13), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(15), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(17), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(63), 1, + ts_builtin_sym_end, + ACTIONS(65), 1, + sym_text, + STATE(8), 1, + sym_block_expression, + STATE(11), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [324] = 9, + ACTIONS(43), 1, + anon_sym_LBRACE_LBRACE_POUND, + ACTIONS(67), 1, + ts_builtin_sym_end, + ACTIONS(69), 1, + anon_sym_LBRACE_LBRACE, + ACTIONS(72), 1, + anon_sym_LBRACE_LBRACE_BANG, + ACTIONS(75), 1, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + ACTIONS(78), 1, + anon_sym_LT_LT_LTdotprompt_COLON, + ACTIONS(81), 1, + sym_text, + STATE(8), 1, + sym_block_expression, + STATE(11), 6, + sym__content, + sym_handlebars_block, + sym_handlebars_expression, + sym_handlebars_comment, + sym_dotprompt_marker, + aux_sym_template_body_repeat1, + [357] = 9, + ACTIONS(84), 1, + anon_sym_RBRACE_RBRACE, + ACTIONS(86), 1, + aux_sym_variable_reference_token1, + ACTIONS(88), 1, + sym_path, + ACTIONS(90), 1, + anon_sym_DQUOTE, + ACTIONS(92), 1, + anon_sym_SQUOTE, + ACTIONS(94), 1, + sym_number, + ACTIONS(96), 2, + anon_sym_true, + anon_sym_false, + STATE(16), 2, + sym_argument, + aux_sym_block_expression_repeat1, + STATE(21), 4, + sym_hash_param, + sym_variable_reference, + sym_string_literal, + sym_boolean, + [390] = 9, + ACTIONS(98), 1, + anon_sym_RBRACE_RBRACE, + ACTIONS(100), 1, + aux_sym_variable_reference_token1, + ACTIONS(103), 1, + sym_path, + ACTIONS(106), 1, + anon_sym_DQUOTE, + ACTIONS(109), 1, + anon_sym_SQUOTE, + ACTIONS(112), 1, + sym_number, + ACTIONS(115), 2, + anon_sym_true, + anon_sym_false, + STATE(13), 2, + sym_argument, + aux_sym_block_expression_repeat1, + STATE(21), 4, + sym_hash_param, + sym_variable_reference, + sym_string_literal, + sym_boolean, + [423] = 9, + ACTIONS(86), 1, + aux_sym_variable_reference_token1, + ACTIONS(88), 1, + sym_path, + ACTIONS(90), 1, + anon_sym_DQUOTE, + ACTIONS(92), 1, + anon_sym_SQUOTE, + ACTIONS(94), 1, + sym_number, + ACTIONS(118), 1, + anon_sym_RBRACE_RBRACE, + ACTIONS(96), 2, + anon_sym_true, + anon_sym_false, + STATE(15), 2, + sym_argument, + aux_sym_block_expression_repeat1, + STATE(21), 4, + sym_hash_param, + sym_variable_reference, + sym_string_literal, + sym_boolean, + [456] = 9, + ACTIONS(86), 1, + aux_sym_variable_reference_token1, + ACTIONS(88), 1, + sym_path, + ACTIONS(90), 1, + anon_sym_DQUOTE, + ACTIONS(92), 1, + anon_sym_SQUOTE, + ACTIONS(94), 1, + sym_number, + ACTIONS(120), 1, + anon_sym_RBRACE_RBRACE, + ACTIONS(96), 2, + anon_sym_true, + anon_sym_false, + STATE(13), 2, + sym_argument, + aux_sym_block_expression_repeat1, + STATE(21), 4, + sym_hash_param, + sym_variable_reference, + sym_string_literal, + sym_boolean, + [489] = 9, + ACTIONS(86), 1, + aux_sym_variable_reference_token1, + ACTIONS(88), 1, + sym_path, + ACTIONS(90), 1, + anon_sym_DQUOTE, + ACTIONS(92), 1, + anon_sym_SQUOTE, + ACTIONS(94), 1, + sym_number, + ACTIONS(122), 1, + anon_sym_RBRACE_RBRACE, + ACTIONS(96), 2, + anon_sym_true, + anon_sym_false, + STATE(13), 2, + sym_argument, + aux_sym_block_expression_repeat1, + STATE(21), 4, + sym_hash_param, + sym_variable_reference, + sym_string_literal, + sym_boolean, + [522] = 7, + ACTIONS(86), 1, + aux_sym_variable_reference_token1, + ACTIONS(90), 1, + anon_sym_DQUOTE, + ACTIONS(92), 1, + anon_sym_SQUOTE, + ACTIONS(124), 1, + sym_path, + ACTIONS(126), 1, + sym_number, + ACTIONS(96), 2, + anon_sym_true, + anon_sym_false, + STATE(24), 3, + sym_variable_reference, + sym_string_literal, + sym_boolean, + [547] = 4, + ACTIONS(128), 1, + ts_builtin_sym_end, + ACTIONS(130), 1, + sym_header_comment, + STATE(19), 1, + aux_sym_license_header_repeat1, + ACTIONS(132), 7, + sym_frontmatter_delimiter, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [566] = 4, + ACTIONS(134), 1, + ts_builtin_sym_end, + ACTIONS(136), 1, + sym_header_comment, + STATE(19), 1, + aux_sym_license_header_repeat1, + ACTIONS(139), 7, + sym_frontmatter_delimiter, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [585] = 3, + ACTIONS(141), 1, + anon_sym_EQ, + ACTIONS(143), 3, + sym_path, + anon_sym_true, + anon_sym_false, + ACTIONS(118), 5, + anon_sym_RBRACE_RBRACE, + aux_sym_variable_reference_token1, + anon_sym_DQUOTE, + anon_sym_SQUOTE, + sym_number, + [601] = 2, + ACTIONS(147), 3, + sym_path, + anon_sym_true, + anon_sym_false, + ACTIONS(145), 5, + anon_sym_RBRACE_RBRACE, + aux_sym_variable_reference_token1, + anon_sym_DQUOTE, + anon_sym_SQUOTE, + sym_number, + [614] = 2, + ACTIONS(143), 3, + sym_path, + anon_sym_true, + anon_sym_false, + ACTIONS(118), 5, + anon_sym_RBRACE_RBRACE, + aux_sym_variable_reference_token1, + anon_sym_DQUOTE, + anon_sym_SQUOTE, + sym_number, + [627] = 2, + ACTIONS(151), 3, + sym_path, + anon_sym_true, + anon_sym_false, + ACTIONS(149), 5, + anon_sym_RBRACE_RBRACE, + aux_sym_variable_reference_token1, + anon_sym_DQUOTE, + anon_sym_SQUOTE, + sym_number, + [640] = 2, + ACTIONS(155), 3, + sym_path, + anon_sym_true, + anon_sym_false, + ACTIONS(153), 5, + anon_sym_RBRACE_RBRACE, + aux_sym_variable_reference_token1, + anon_sym_DQUOTE, + anon_sym_SQUOTE, + sym_number, + [653] = 2, + ACTIONS(159), 3, + sym_path, + anon_sym_true, + anon_sym_false, + ACTIONS(157), 5, + anon_sym_RBRACE_RBRACE, + aux_sym_variable_reference_token1, + anon_sym_DQUOTE, + anon_sym_SQUOTE, + sym_number, + [666] = 1, + ACTIONS(161), 7, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE_SLASH, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [676] = 2, + ACTIONS(163), 1, + ts_builtin_sym_end, + ACTIONS(165), 6, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [688] = 2, + ACTIONS(167), 1, + ts_builtin_sym_end, + ACTIONS(169), 6, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [700] = 2, + ACTIONS(171), 1, + ts_builtin_sym_end, + ACTIONS(173), 6, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [712] = 1, + ACTIONS(173), 7, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE_SLASH, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [722] = 1, + ACTIONS(175), 7, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE_SLASH, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [732] = 1, + ACTIONS(177), 7, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE_SLASH, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [742] = 5, + ACTIONS(181), 1, + sym_frontmatter_delimiter, + ACTIONS(183), 1, + aux_sym_yaml_line_token1, + STATE(35), 1, + aux_sym_frontmatter_repeat1, + ACTIONS(179), 2, + sym_header_comment, + aux_sym__yaml_content_token1, + STATE(49), 2, + sym__yaml_content, + sym_yaml_line, + [760] = 5, + ACTIONS(188), 1, + sym_frontmatter_delimiter, + ACTIONS(190), 1, + aux_sym_yaml_line_token1, + STATE(34), 1, + aux_sym_frontmatter_repeat1, + ACTIONS(185), 2, + sym_header_comment, + aux_sym__yaml_content_token1, + STATE(49), 2, + sym__yaml_content, + sym_yaml_line, + [778] = 5, + ACTIONS(183), 1, + aux_sym_yaml_line_token1, + ACTIONS(193), 1, + sym_frontmatter_delimiter, + STATE(34), 1, + aux_sym_frontmatter_repeat1, + ACTIONS(179), 2, + sym_header_comment, + aux_sym__yaml_content_token1, + STATE(49), 2, + sym__yaml_content, + sym_yaml_line, + [796] = 1, + ACTIONS(195), 7, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE_SLASH, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [806] = 2, + ACTIONS(197), 1, + ts_builtin_sym_end, + ACTIONS(199), 6, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [818] = 2, + ACTIONS(201), 1, + ts_builtin_sym_end, + ACTIONS(203), 6, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [830] = 2, + ACTIONS(205), 1, + ts_builtin_sym_end, + ACTIONS(207), 6, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [842] = 1, + ACTIONS(199), 7, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE_SLASH, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [852] = 1, + ACTIONS(207), 7, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE_SLASH, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [862] = 1, + ACTIONS(165), 7, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE_SLASH, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [872] = 2, + ACTIONS(209), 1, + ts_builtin_sym_end, + ACTIONS(175), 6, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [884] = 2, + ACTIONS(211), 1, + ts_builtin_sym_end, + ACTIONS(161), 6, + anon_sym_LBRACE_LBRACE_POUND, + anon_sym_LBRACE_LBRACE, + anon_sym_LBRACE_LBRACE_BANG, + anon_sym_LBRACE_LBRACE_BANG_DASH_DASH, + anon_sym_LT_LT_LTdotprompt_COLON, + sym_text, + [896] = 6, + ACTIONS(86), 1, + aux_sym_variable_reference_token1, + ACTIONS(213), 1, + anon_sym_GT, + ACTIONS(215), 1, + anon_sym_else, + ACTIONS(217), 1, + sym_path, + STATE(67), 1, + sym_variable_reference, + STATE(76), 1, + sym_expression_content, + [915] = 6, + ACTIONS(86), 1, + aux_sym_variable_reference_token1, + ACTIONS(213), 1, + anon_sym_GT, + ACTIONS(215), 1, + anon_sym_else, + ACTIONS(217), 1, + sym_path, + STATE(67), 1, + sym_variable_reference, + STATE(79), 1, + sym_expression_content, + [934] = 1, + ACTIONS(219), 4, + sym_header_comment, + sym_frontmatter_delimiter, + aux_sym__yaml_content_token1, + aux_sym_yaml_line_token1, + [941] = 1, + ACTIONS(221), 4, + sym_header_comment, + sym_frontmatter_delimiter, + aux_sym__yaml_content_token1, + aux_sym_yaml_line_token1, + [948] = 1, + ACTIONS(223), 4, + sym_header_comment, + sym_frontmatter_delimiter, + aux_sym__yaml_content_token1, + aux_sym_yaml_line_token1, + [955] = 2, + ACTIONS(225), 1, + aux_sym_frontmatter_token1, + ACTIONS(227), 1, + aux_sym_yaml_line_token2, + [962] = 1, + ACTIONS(229), 1, + anon_sym_RBRACE_RBRACE, + [966] = 1, + ACTIONS(231), 1, + anon_sym_RBRACE_RBRACE, + [970] = 1, + ACTIONS(233), 1, + aux_sym_frontmatter_token1, + [974] = 1, + ACTIONS(235), 1, + aux_sym_string_literal_token2, + [978] = 1, + ACTIONS(237), 1, + aux_sym_frontmatter_token1, + [982] = 1, + ACTIONS(239), 1, + aux_sym_string_literal_token1, + [986] = 1, + ACTIONS(241), 1, + anon_sym_DQUOTE, + [990] = 1, + ACTIONS(241), 1, + anon_sym_SQUOTE, + [994] = 1, + ACTIONS(243), 1, + anon_sym_COLON, + [998] = 1, + ACTIONS(245), 1, + aux_sym_frontmatter_token1, + [1002] = 1, + ACTIONS(247), 1, + sym_path, + [1006] = 1, + ACTIONS(23), 1, + ts_builtin_sym_end, + [1010] = 1, + ACTIONS(249), 1, + aux_sym_frontmatter_token1, + [1014] = 1, + ACTIONS(251), 1, + anon_sym_GT_GT_GT, + [1018] = 1, + ACTIONS(229), 1, + anon_sym_DASH_DASH_RBRACE_RBRACE, + [1022] = 1, + ACTIONS(253), 1, + anon_sym_RBRACE_RBRACE, + [1026] = 1, + ACTIONS(255), 1, + anon_sym_RBRACE_RBRACE, + [1030] = 1, + ACTIONS(257), 1, + ts_builtin_sym_end, + [1034] = 1, + ACTIONS(259), 1, + anon_sym_GT_GT_GT, + [1038] = 1, + ACTIONS(261), 1, + anon_sym_RBRACE_RBRACE, + [1042] = 1, + ACTIONS(263), 1, + sym_path, + [1046] = 1, + ACTIONS(21), 1, + ts_builtin_sym_end, + [1050] = 1, + ACTIONS(265), 1, + ts_builtin_sym_end, + [1054] = 1, + ACTIONS(267), 1, + aux_sym_dotprompt_marker_token1, + [1058] = 1, + ACTIONS(269), 1, + aux_sym_handlebars_comment_token2, + [1062] = 1, + ACTIONS(271), 1, + anon_sym_RBRACE_RBRACE, + [1066] = 1, + ACTIONS(273), 1, + anon_sym_RBRACE_RBRACE, + [1070] = 1, + ACTIONS(273), 1, + anon_sym_DASH_DASH_RBRACE_RBRACE, + [1074] = 1, + ACTIONS(275), 1, + anon_sym_RBRACE_RBRACE, + [1078] = 1, + ACTIONS(277), 1, + aux_sym_handlebars_comment_token1, + [1082] = 1, + ACTIONS(279), 1, + anon_sym_RBRACE_RBRACE, + [1086] = 1, + ACTIONS(281), 1, + sym_path, + [1090] = 1, + ACTIONS(283), 1, + aux_sym_handlebars_comment_token1, + [1094] = 1, + ACTIONS(285), 1, + aux_sym_handlebars_comment_token2, + [1098] = 1, + ACTIONS(287), 1, + aux_sym_dotprompt_marker_token1, + [1102] = 1, + ACTIONS(289), 1, + sym_path, +}; + +static const uint32_t ts_small_parse_table_map[] = { + [SMALL_STATE(2)] = 0, + [SMALL_STATE(3)] = 42, + [SMALL_STATE(4)] = 78, + [SMALL_STATE(5)] = 114, + [SMALL_STATE(6)] = 150, + [SMALL_STATE(7)] = 186, + [SMALL_STATE(8)] = 222, + [SMALL_STATE(9)] = 258, + [SMALL_STATE(10)] = 291, + [SMALL_STATE(11)] = 324, + [SMALL_STATE(12)] = 357, + [SMALL_STATE(13)] = 390, + [SMALL_STATE(14)] = 423, + [SMALL_STATE(15)] = 456, + [SMALL_STATE(16)] = 489, + [SMALL_STATE(17)] = 522, + [SMALL_STATE(18)] = 547, + [SMALL_STATE(19)] = 566, + [SMALL_STATE(20)] = 585, + [SMALL_STATE(21)] = 601, + [SMALL_STATE(22)] = 614, + [SMALL_STATE(23)] = 627, + [SMALL_STATE(24)] = 640, + [SMALL_STATE(25)] = 653, + [SMALL_STATE(26)] = 666, + [SMALL_STATE(27)] = 676, + [SMALL_STATE(28)] = 688, + [SMALL_STATE(29)] = 700, + [SMALL_STATE(30)] = 712, + [SMALL_STATE(31)] = 722, + [SMALL_STATE(32)] = 732, + [SMALL_STATE(33)] = 742, + [SMALL_STATE(34)] = 760, + [SMALL_STATE(35)] = 778, + [SMALL_STATE(36)] = 796, + [SMALL_STATE(37)] = 806, + [SMALL_STATE(38)] = 818, + [SMALL_STATE(39)] = 830, + [SMALL_STATE(40)] = 842, + [SMALL_STATE(41)] = 852, + [SMALL_STATE(42)] = 862, + [SMALL_STATE(43)] = 872, + [SMALL_STATE(44)] = 884, + [SMALL_STATE(45)] = 896, + [SMALL_STATE(46)] = 915, + [SMALL_STATE(47)] = 934, + [SMALL_STATE(48)] = 941, + [SMALL_STATE(49)] = 948, + [SMALL_STATE(50)] = 955, + [SMALL_STATE(51)] = 962, + [SMALL_STATE(52)] = 966, + [SMALL_STATE(53)] = 970, + [SMALL_STATE(54)] = 974, + [SMALL_STATE(55)] = 978, + [SMALL_STATE(56)] = 982, + [SMALL_STATE(57)] = 986, + [SMALL_STATE(58)] = 990, + [SMALL_STATE(59)] = 994, + [SMALL_STATE(60)] = 998, + [SMALL_STATE(61)] = 1002, + [SMALL_STATE(62)] = 1006, + [SMALL_STATE(63)] = 1010, + [SMALL_STATE(64)] = 1014, + [SMALL_STATE(65)] = 1018, + [SMALL_STATE(66)] = 1022, + [SMALL_STATE(67)] = 1026, + [SMALL_STATE(68)] = 1030, + [SMALL_STATE(69)] = 1034, + [SMALL_STATE(70)] = 1038, + [SMALL_STATE(71)] = 1042, + [SMALL_STATE(72)] = 1046, + [SMALL_STATE(73)] = 1050, + [SMALL_STATE(74)] = 1054, + [SMALL_STATE(75)] = 1058, + [SMALL_STATE(76)] = 1062, + [SMALL_STATE(77)] = 1066, + [SMALL_STATE(78)] = 1070, + [SMALL_STATE(79)] = 1074, + [SMALL_STATE(80)] = 1078, + [SMALL_STATE(81)] = 1082, + [SMALL_STATE(82)] = 1086, + [SMALL_STATE(83)] = 1090, + [SMALL_STATE(84)] = 1094, + [SMALL_STATE(85)] = 1098, + [SMALL_STATE(86)] = 1102, +}; + +static const TSParseActionEntry ts_parse_actions[] = { + [0] = {.entry = {.count = 0, .reusable = false}}, + [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), + [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 0, 0, 0), + [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18), + [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(53), + [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(82), + [11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(46), + [13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(80), + [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(75), + [17] = {.entry = {.count = 1, .reusable = false}}, SHIFT(74), + [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(10), + [21] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 1, 0, 0), + [23] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 2, 0, 0), + [25] = {.entry = {.count = 1, .reusable = false}}, SHIFT(86), + [27] = {.entry = {.count = 1, .reusable = false}}, SHIFT(45), + [29] = {.entry = {.count = 1, .reusable = false}}, SHIFT(83), + [31] = {.entry = {.count = 1, .reusable = false}}, SHIFT(84), + [33] = {.entry = {.count = 1, .reusable = false}}, SHIFT(85), + [35] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9), + [37] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4), + [39] = {.entry = {.count = 1, .reusable = false}}, SHIFT(61), + [41] = {.entry = {.count = 1, .reusable = false}}, SHIFT(6), + [43] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(82), + [46] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), + [48] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(45), + [51] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(83), + [54] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(84), + [57] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(85), + [60] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(9), + [63] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_body, 1, 0, 0), + [65] = {.entry = {.count = 1, .reusable = false}}, SHIFT(11), + [67] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), + [69] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(46), + [72] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(80), + [75] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(75), + [78] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(74), + [81] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_body_repeat1, 2, 0, 0), SHIFT_REPEAT(11), + [84] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), + [86] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), + [88] = {.entry = {.count = 1, .reusable = false}}, SHIFT(20), + [90] = {.entry = {.count = 1, .reusable = true}}, SHIFT(56), + [92] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), + [94] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), + [96] = {.entry = {.count = 1, .reusable = false}}, SHIFT(25), + [98] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_block_expression_repeat1, 2, 0, 0), + [100] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_expression_repeat1, 2, 0, 0), SHIFT_REPEAT(22), + [103] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_expression_repeat1, 2, 0, 0), SHIFT_REPEAT(20), + [106] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_expression_repeat1, 2, 0, 0), SHIFT_REPEAT(56), + [109] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_expression_repeat1, 2, 0, 0), SHIFT_REPEAT(54), + [112] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_expression_repeat1, 2, 0, 0), SHIFT_REPEAT(21), + [115] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_expression_repeat1, 2, 0, 0), SHIFT_REPEAT(25), + [118] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable_reference, 1, 0, 0), + [120] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression_content, 2, 0, 4), + [122] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [124] = {.entry = {.count = 1, .reusable = false}}, SHIFT(22), + [126] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), + [128] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_license_header, 1, 0, 0), + [130] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), + [132] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_license_header, 1, 0, 0), + [134] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_license_header_repeat1, 2, 0, 0), + [136] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_license_header_repeat1, 2, 0, 0), SHIFT_REPEAT(19), + [139] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_license_header_repeat1, 2, 0, 0), + [141] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [143] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_variable_reference, 1, 0, 0), + [145] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_argument, 1, 0, 0), + [147] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_argument, 1, 0, 0), + [149] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string_literal, 3, 0, 0), + [151] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_literal, 3, 0, 0), + [153] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_hash_param, 3, 0, 7), + [155] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_hash_param, 3, 0, 7), + [157] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1, 0, 0), + [159] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_boolean, 1, 0, 0), + [161] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_handlebars_comment, 3, 0, 0), + [163] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_close_block, 3, 0, 2), + [165] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_close_block, 3, 0, 2), + [167] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_frontmatter, 5, 0, 6), + [169] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_frontmatter, 5, 0, 6), + [171] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_handlebars_block, 2, 0, 0), + [173] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_handlebars_block, 2, 0, 0), + [175] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_handlebars_expression, 3, 0, 0), + [177] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_block_expression, 4, 0, 2), + [179] = {.entry = {.count = 1, .reusable = false}}, SHIFT(49), + [181] = {.entry = {.count = 1, .reusable = false}}, SHIFT(60), + [183] = {.entry = {.count = 1, .reusable = false}}, SHIFT(59), + [185] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_frontmatter_repeat1, 2, 0, 0), SHIFT_REPEAT(49), + [188] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_frontmatter_repeat1, 2, 0, 0), + [190] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_frontmatter_repeat1, 2, 0, 0), SHIFT_REPEAT(59), + [193] = {.entry = {.count = 1, .reusable = false}}, SHIFT(55), + [195] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_block_expression, 3, 0, 2), + [197] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_dotprompt_marker, 3, 0, 0), + [199] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_dotprompt_marker, 3, 0, 0), + [201] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_frontmatter, 4, 0, 0), + [203] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_frontmatter, 4, 0, 0), + [205] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_handlebars_block, 3, 0, 0), + [207] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_handlebars_block, 3, 0, 0), + [209] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_handlebars_expression, 3, 0, 0), + [211] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_handlebars_comment, 3, 0, 0), + [213] = {.entry = {.count = 1, .reusable = true}}, SHIFT(71), + [215] = {.entry = {.count = 1, .reusable = false}}, SHIFT(70), + [217] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), + [219] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_yaml_line, 3, 0, 5), + [221] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_yaml_line, 4, 0, 8), + [223] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_frontmatter_repeat1, 1, 0, 0), + [225] = {.entry = {.count = 1, .reusable = false}}, SHIFT(47), + [227] = {.entry = {.count = 1, .reusable = false}}, SHIFT(63), + [229] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), + [231] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), + [233] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), + [235] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), + [237] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), + [239] = {.entry = {.count = 1, .reusable = true}}, SHIFT(57), + [241] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), + [243] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), + [245] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), + [247] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), + [249] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), + [251] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), + [253] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression_content, 2, 0, 3), + [255] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression_content, 1, 0, 1), + [257] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 3, 0, 0), + [259] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), + [261] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression_content, 1, 0, 0), + [263] = {.entry = {.count = 1, .reusable = true}}, SHIFT(66), + [265] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [267] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64), + [269] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65), + [271] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), + [273] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), + [275] = {.entry = {.count = 1, .reusable = true}}, SHIFT(43), + [277] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), + [279] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), + [281] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [283] = {.entry = {.count = 1, .reusable = true}}, SHIFT(77), + [285] = {.entry = {.count = 1, .reusable = true}}, SHIFT(78), + [287] = {.entry = {.count = 1, .reusable = true}}, SHIFT(69), + [289] = {.entry = {.count = 1, .reusable = true}}, SHIFT(81), +}; + +#ifdef __cplusplus +extern "C" { +#endif +#ifdef TREE_SITTER_HIDE_SYMBOLS +#define TS_PUBLIC +#elif defined(_WIN32) +#define TS_PUBLIC __declspec(dllexport) +#else +#define TS_PUBLIC __attribute__((visibility("default"))) +#endif + +TS_PUBLIC const TSLanguage *tree_sitter_dotprompt(void) { + static const TSLanguage language = { + .version = LANGUAGE_VERSION, + .symbol_count = SYMBOL_COUNT, + .alias_count = ALIAS_COUNT, + .token_count = TOKEN_COUNT, + .external_token_count = EXTERNAL_TOKEN_COUNT, + .state_count = STATE_COUNT, + .large_state_count = LARGE_STATE_COUNT, + .production_id_count = PRODUCTION_ID_COUNT, + .field_count = FIELD_COUNT, + .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, + .parse_table = &ts_parse_table[0][0], + .small_parse_table = ts_small_parse_table, + .small_parse_table_map = ts_small_parse_table_map, + .parse_actions = ts_parse_actions, + .symbol_names = ts_symbol_names, + .field_names = ts_field_names, + .field_map_slices = ts_field_map_slices, + .field_map_entries = ts_field_map_entries, + .symbol_metadata = ts_symbol_metadata, + .public_symbol_map = ts_symbol_map, + .alias_map = ts_non_terminal_alias_map, + .alias_sequences = &ts_alias_sequences[0][0], + .lex_modes = ts_lex_modes, + .lex_fn = ts_lex, + .primary_state_ids = ts_primary_state_ids, + }; + return &language; +} +#ifdef __cplusplus +} +#endif diff --git a/packages/treesitter/src/tree_sitter/alloc.h b/packages/treesitter/src/tree_sitter/alloc.h new file mode 100644 index 000000000..e111b8d5f --- /dev/null +++ b/packages/treesitter/src/tree_sitter/alloc.h @@ -0,0 +1,72 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef TREE_SITTER_ALLOC_H_ +#define TREE_SITTER_ALLOC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR + +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); + +#ifndef ts_malloc +#define ts_malloc ts_current_malloc +#endif +#ifndef ts_calloc +#define ts_calloc ts_current_calloc +#endif +#ifndef ts_realloc +#define ts_realloc ts_current_realloc +#endif +#ifndef ts_free +#define ts_free ts_current_free +#endif + +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ALLOC_H_ diff --git a/packages/treesitter/src/tree_sitter/array.h b/packages/treesitter/src/tree_sitter/array.h new file mode 100644 index 000000000..262e0bf5b --- /dev/null +++ b/packages/treesitter/src/tree_sitter/array.h @@ -0,0 +1,308 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef TREE_SITTER_ARRAY_H_ +#define TREE_SITTER_ARRAY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "./alloc.h" + +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + +#define Array(T) \ + struct { \ + T *contents; \ + uint32_t size; \ + uint32_t capacity; \ + } + +/// Initialize an array. +#define array_init(self) \ + ((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL) + +/// Create an empty array. +#define array_new() \ + { NULL, 0, 0 } + +/// Get a pointer to the element at a given `index` in the array. +#define array_get(self, _index) \ + (assert((uint32_t)(_index) < (self)->size), &(self)->contents[_index]) + +/// Get a pointer to the first element in the array. +#define array_front(self) array_get(self, 0) + +/// Get a pointer to the last element in the array. +#define array_back(self) array_get(self, (self)->size - 1) + +/// Clear the array, setting its size to zero. Note that this does not free any +/// memory allocated for the array's contents. +#define array_clear(self) ((self)->size = 0) + +/// Reserve `new_capacity` elements of space in the array. If `new_capacity` is +/// less than the array's current capacity, this function has no effect. +#define array_reserve(self, new_capacity) \ + _array__reserve((Array *)(self), array_elem_size(self), new_capacity) + +/// Free any memory allocated for this array. Note that this does not free any +/// memory allocated for the array's contents. +#define array_delete(self) _array__delete((Array *)(self)) + +/// Push a new `element` onto the end of the array. +#define array_push(self, element) \ + (_array__grow((Array *)(self), 1, array_elem_size(self)), \ + (self)->contents[(self)->size++] = (element)) + +/// Increase the array's size by `count` elements. +/// New elements are zero-initialized. +#define array_grow_by(self, count) \ + do { \ + if ((count) == 0) break; \ + _array__grow((Array *)(self), count, array_elem_size(self)); \ + memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \ + (self)->size += (count); \ + } while (0) + +/// Append all elements from one array to the end of another. +#define array_push_all(self, other) \ + array_extend((self), (other)->size, (other)->contents) + +/// Append `count` elements to the end of the array, reading their values from the +/// `contents` pointer. +#define array_extend(self, count, contents) \ + _array__splice( \ + (Array *)(self), array_elem_size(self), (self)->size, \ + 0, count, contents \ + ) + +/// Remove `old_count` elements from the array starting at the given `index`. At +/// the same index, insert `new_count` new elements, reading their values from the +/// `new_contents` pointer. +#define array_splice(self, _index, old_count, new_count, new_contents) \ + _array__splice( \ + (Array *)(self), array_elem_size(self), _index, \ + old_count, new_count, new_contents \ + ) + +/// Insert one `element` into the array at the given `index`. +#define array_insert(self, _index, element) \ + _array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element)) + +/// Remove one element from the array at the given `index`. +#define array_erase(self, _index) \ + _array__erase((Array *)(self), array_elem_size(self), _index) + +/// Pop the last element off the array, returning the element by value. +#define array_pop(self) ((self)->contents[--(self)->size]) + +/// Assign the contents of one array to another, reallocating if necessary. +#define array_assign(self, other) \ + _array__assign((Array *)(self), (const Array *)(other), array_elem_size(self)) + +/// Swap one array with another +#define array_swap(self, other) \ + _array__swap((Array *)(self), (Array *)(other)) + +/// Get the size of the array contents +#define array_elem_size(self) (sizeof *(self)->contents) + +/// Search a sorted array for a given `needle` value, using the given `compare` +/// callback to determine the order. +/// +/// If an existing element is found to be equal to `needle`, then the `index` +/// out-parameter is set to the existing value's index, and the `exists` +/// out-parameter is set to true. Otherwise, `index` is set to an index where +/// `needle` should be inserted in order to preserve the sorting, and `exists` +/// is set to false. +#define array_search_sorted_with(self, compare, needle, _index, _exists) \ + _array__search_sorted(self, 0, compare, , needle, _index, _exists) + +/// Search a sorted array for a given `needle` value, using integer comparisons +/// of a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_with`. +#define array_search_sorted_by(self, field, needle, _index, _exists) \ + _array__search_sorted(self, 0, _compare_int, field, needle, _index, _exists) + +/// Insert a given `value` into a sorted array, using the given `compare` +/// callback to determine the order. +#define array_insert_sorted_with(self, compare, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_with(self, compare, &(value), &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +/// Insert a given `value` into a sorted array, using integer comparisons of +/// a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_by`. +#define array_insert_sorted_by(self, field, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_by(self, field, (value) field, &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +// Private + +typedef Array(void) Array; + +/// This is not what you're looking for, see `array_delete`. +static inline void _array__delete(Array *self) { + if (self->contents) { + ts_free(self->contents); + self->contents = NULL; + self->size = 0; + self->capacity = 0; + } +} + +/// This is not what you're looking for, see `array_erase`. +static inline void _array__erase(Array *self, size_t element_size, + uint32_t index) { + assert(index < self->size); + char *contents = (char *)self->contents; + memmove(contents + index * element_size, contents + (index + 1) * element_size, + (self->size - index - 1) * element_size); + self->size--; +} + +/// This is not what you're looking for, see `array_reserve`. +static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) { + if (new_capacity > self->capacity) { + if (self->contents) { + self->contents = ts_realloc(self->contents, new_capacity * element_size); + } else { + self->contents = ts_malloc(new_capacity * element_size); + } + self->capacity = new_capacity; + } +} + +/// This is not what you're looking for, see `array_assign`. +static inline void _array__assign(Array *self, const Array *other, size_t element_size) { + _array__reserve(self, element_size, other->size); + self->size = other->size; + memcpy(self->contents, other->contents, self->size * element_size); +} + +/// This is not what you're looking for, see `array_swap`. +static inline void _array__swap(Array *self, Array *other) { + Array swap = *other; + *other = *self; + *self = swap; +} + +/// This is not what you're looking for, see `array_push` or `array_grow_by`. +static inline void _array__grow(Array *self, uint32_t count, size_t element_size) { + uint32_t new_size = self->size + count; + if (new_size > self->capacity) { + uint32_t new_capacity = self->capacity * 2; + if (new_capacity < 8) new_capacity = 8; + if (new_capacity < new_size) new_capacity = new_size; + _array__reserve(self, element_size, new_capacity); + } +} + +/// This is not what you're looking for, see `array_splice`. +static inline void _array__splice(Array *self, size_t element_size, + uint32_t index, uint32_t old_count, + uint32_t new_count, const void *elements) { + uint32_t new_size = self->size + new_count - old_count; + uint32_t old_end = index + old_count; + uint32_t new_end = index + new_count; + assert(old_end <= self->size); + + _array__reserve(self, element_size, new_size); + + char *contents = (char *)self->contents; + if (self->size > old_end) { + memmove( + contents + new_end * element_size, + contents + old_end * element_size, + (self->size - old_end) * element_size + ); + } + if (new_count > 0) { + if (elements) { + memcpy( + (contents + index * element_size), + elements, + new_count * element_size + ); + } else { + memset( + (contents + index * element_size), + 0, + new_count * element_size + ); + } + } + self->size += new_count - old_count; +} + +/// A binary search routine, based on Rust's `std::slice::binary_search_by`. +/// This is not what you're looking for, see `array_search_sorted_with` or `array_search_sorted_by`. +#define _array__search_sorted(self, start, compare, suffix, needle, _index, _exists) \ + do { \ + *(_index) = start; \ + *(_exists) = false; \ + uint32_t size = (self)->size - *(_index); \ + if (size == 0) break; \ + int comparison; \ + while (size > 1) { \ + uint32_t half_size = size / 2; \ + uint32_t mid_index = *(_index) + half_size; \ + comparison = compare(&((self)->contents[mid_index] suffix), (needle)); \ + if (comparison <= 0) *(_index) = mid_index; \ + size -= half_size; \ + } \ + comparison = compare(&((self)->contents[*(_index)] suffix), (needle)); \ + if (comparison == 0) *(_exists) = true; \ + else if (comparison < 0) *(_index) += 1; \ + } while (0) + +/// Helper macro for the `_sorted_by` routines below. This takes the left (existing) +/// parameter by reference in order to work with the generic sorting function above. +#define _compare_int(a, b) ((int)*(a) - (int)(b)) + +#ifdef _MSC_VER +#pragma warning(default : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ARRAY_H_ diff --git a/packages/treesitter/src/tree_sitter/parser.h b/packages/treesitter/src/tree_sitter/parser.h new file mode 100644 index 000000000..1bc2d3543 --- /dev/null +++ b/packages/treesitter/src/tree_sitter/parser.h @@ -0,0 +1,283 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef TREE_SITTER_PARSER_H_ +#define TREE_SITTER_PARSER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define ts_builtin_sym_error ((TSSymbol)-1) +#define ts_builtin_sym_end 0 +#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 + +#ifndef TREE_SITTER_API_H_ +typedef uint16_t TSStateId; +typedef uint16_t TSSymbol; +typedef uint16_t TSFieldId; +typedef struct TSLanguage TSLanguage; +#endif + +typedef struct { + TSFieldId field_id; + uint8_t child_index; + bool inherited; +} TSFieldMapEntry; + +typedef struct { + uint16_t index; + uint16_t length; +} TSFieldMapSlice; + +typedef struct { + bool visible; + bool named; + bool supertype; +} TSSymbolMetadata; + +typedef struct TSLexer TSLexer; + +struct TSLexer { + int32_t lookahead; + TSSymbol result_symbol; + void (*advance)(TSLexer *, bool); + void (*mark_end)(TSLexer *); + uint32_t (*get_column)(TSLexer *); + bool (*is_at_included_range_start)(const TSLexer *); + bool (*eof)(const TSLexer *); +}; + +typedef enum { + TSParseActionTypeShift, + TSParseActionTypeReduce, + TSParseActionTypeAccept, + TSParseActionTypeRecover, +} TSParseActionType; + +typedef union { + struct { + uint8_t type; + TSStateId state; + bool extra; + bool repetition; + } shift; + struct { + uint8_t type; + uint8_t child_count; + TSSymbol symbol; + int16_t dynamic_precedence; + uint16_t production_id; + } reduce; + uint8_t type; +} TSParseAction; + +typedef struct { + uint16_t lex_state; + uint16_t external_lex_state; +} TSLexMode; + +typedef union { + TSParseAction action; + struct { + uint8_t count; + bool reusable; + } entry; +} TSParseActionEntry; + +typedef struct { + int32_t start; + int32_t end; +} TSCharacterRange; + +struct TSLanguage { + uint32_t version; + uint32_t symbol_count; + uint32_t alias_count; + uint32_t token_count; + uint32_t external_token_count; + uint32_t state_count; + uint32_t large_state_count; + uint32_t production_id_count; + uint32_t field_count; + uint16_t max_alias_sequence_length; + const uint16_t *parse_table; + const uint16_t *small_parse_table; + const uint32_t *small_parse_table_map; + const TSParseActionEntry *parse_actions; + const char * const *symbol_names; + const char * const *field_names; + const TSFieldMapSlice *field_map_slices; + const TSFieldMapEntry *field_map_entries; + const TSSymbolMetadata *symbol_metadata; + const TSSymbol *public_symbol_map; + const uint16_t *alias_map; + const TSSymbol *alias_sequences; + const TSLexMode *lex_modes; + bool (*lex_fn)(TSLexer *, TSStateId); + bool (*keyword_lex_fn)(TSLexer *, TSStateId); + TSSymbol keyword_capture_token; + struct { + const bool *states; + const TSSymbol *symbol_map; + void *(*create)(void); + void (*destroy)(void *); + bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); + unsigned (*serialize)(void *, char *); + void (*deserialize)(void *, const char *, unsigned); + } external_scanner; + const TSStateId *primary_state_ids; +}; + +static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t lookahead) { + uint32_t index = 0; + uint32_t size = len - index; + while (size > 1) { + uint32_t half_size = size / 2; + uint32_t mid_index = index + half_size; + TSCharacterRange *range = &ranges[mid_index]; + if (lookahead >= range->start && lookahead <= range->end) { + return true; + } else if (lookahead > range->end) { + index = mid_index; + } + size -= half_size; + } + TSCharacterRange *range = &ranges[index]; + return (lookahead >= range->start && lookahead <= range->end); +} + +/* + * Lexer Macros + */ + +#ifdef _MSC_VER +#define UNUSED __pragma(warning(suppress : 4101)) +#else +#define UNUSED __attribute__((unused)) +#endif + +#define START_LEXER() \ + bool result = false; \ + bool skip = false; \ + UNUSED \ + bool eof = false; \ + int32_t lookahead; \ + goto start; \ + next_state: \ + lexer->advance(lexer, skip); \ + start: \ + skip = false; \ + lookahead = lexer->lookahead; + +#define ADVANCE(state_value) \ + { \ + state = state_value; \ + goto next_state; \ + } + +#define ADVANCE_MAP(...) \ + { \ + static const uint16_t map[] = { __VA_ARGS__ }; \ + for (uint32_t i = 0; i < sizeof(map) / sizeof(map[0]); i += 2) { \ + if (map[i] == lookahead) { \ + state = map[i + 1]; \ + goto next_state; \ + } \ + } \ + } + +#define SKIP(state_value) \ + { \ + skip = true; \ + state = state_value; \ + goto next_state; \ + } + +#define ACCEPT_TOKEN(symbol_value) \ + result = true; \ + lexer->result_symbol = symbol_value; \ + lexer->mark_end(lexer); + +#define END_STATE() return result; + +/* + * Parse Table Macros + */ + +#define SMALL_STATE(id) ((id) - LARGE_STATE_COUNT) + +#define STATE(id) id + +#define ACTIONS(id) id + +#define SHIFT(state_value) \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .state = (state_value) \ + } \ + }} + +#define SHIFT_REPEAT(state_value) \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .state = (state_value), \ + .repetition = true \ + } \ + }} + +#define SHIFT_EXTRA() \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .extra = true \ + } \ + }} + +#define REDUCE(symbol_name, children, precedence, prod_id) \ + {{ \ + .reduce = { \ + .type = TSParseActionTypeReduce, \ + .symbol = symbol_name, \ + .child_count = children, \ + .dynamic_precedence = precedence, \ + .production_id = prod_id \ + }, \ + }} + +#define RECOVER() \ + {{ \ + .type = TSParseActionTypeRecover \ + }} + +#define ACCEPT_INPUT() \ + {{ \ + .type = TSParseActionTypeAccept \ + }} + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_PARSER_H_ diff --git a/packages/treesitter/test/corpus/basic.txt b/packages/treesitter/test/corpus/basic.txt index 1b48f16cc..9384f760d 100644 --- a/packages/treesitter/test/corpus/basic.txt +++ b/packages/treesitter/test/corpus/basic.txt @@ -13,7 +13,9 @@ Hello world! (frontmatter (frontmatter_delimiter) (yaml_content - (yaml_line)) + (yaml_line + key: (yaml_key) + value: (yaml_value))) (frontmatter_delimiter)) (template_body (text))) @@ -31,7 +33,8 @@ Hello {{ name }}! (text) (handlebars_expression (expression_content - (variable_reference))) + (variable_reference + (path)))) (text))) ================================================================================ @@ -48,13 +51,13 @@ You are helpful. (template_body (handlebars_block (block_expression - (block_name) + name: (block_name) (argument - (string_literal)))) - (text) - (handlebars_block + (string_literal))) + (text) (close_block - (block_name))))) + name: (block_name))) + (text))) ================================================================================ EACH LOOP @@ -70,17 +73,18 @@ EACH LOOP (template_body (handlebars_block (block_expression - (block_name) + name: (block_name) (argument - (variable_reference)))) - (text) - (handlebars_expression - (expression_content - (variable_reference))) - (text) - (handlebars_block + (variable_reference + (path)))) + (text) + (handlebars_expression + (expression_content + (variable_reference + (path)))) (close_block - (block_name))))) + name: (block_name))) + (text))) ================================================================================ PARTIAL @@ -94,8 +98,8 @@ PARTIAL (template_body (handlebars_expression (expression_content - (partial_reference - (identifier)))))) + (partial_reference))) + (text))) ================================================================================ COMMENT @@ -107,7 +111,8 @@ COMMENT (document (template_body - (handlebars_comment))) + (handlebars_comment) + (text))) ================================================================================ DOTPROMPT MARKER @@ -120,7 +125,8 @@ DOTPROMPT MARKER (document (template_body (dotprompt_marker - (marker_content)))) + (marker_content)) + (text))) ================================================================================ FRONTMATTER WITH CONFIG @@ -143,18 +149,25 @@ Hello {{ name }}! (frontmatter (frontmatter_delimiter) (yaml_content - (yaml_line) - (yaml_line) - (yaml_line) - (yaml_line) - (yaml_line) - (yaml_line)) + (yaml_line + key: (yaml_key) + value: (yaml_value)) + (yaml_line + key: (yaml_key) + value: (yaml_value)) + (yaml_line + key: (yaml_key) + value: (yaml_value)) + (yaml_line + key: (yaml_key) + value: (yaml_value))) (frontmatter_delimiter)) (template_body (text) (handlebars_expression (expression_content - (variable_reference))) + (variable_reference + (path)))) (text))) ================================================================================ @@ -177,7 +190,9 @@ Hello (frontmatter (frontmatter_delimiter) (yaml_content - (yaml_line)) + (yaml_line + key: (yaml_key) + value: (yaml_value))) (frontmatter_delimiter)) (template_body (text))) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 81a15841d..c17ab6b09 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,6 +75,76 @@ importers: specifier: ^4.0.18 version: 4.0.18(@types/node@25.0.10)(jiti@1.21.7)(tsx@4.21.0)(yaml@2.8.2) + packages/codemirror: + devDependencies: + '@biomejs/biome': + specifier: ^1.5.0 + version: 1.9.4 + '@codemirror/autocomplete': + specifier: ^6.18.0 + version: 6.20.0 + '@codemirror/language': + specifier: ^6.10.0 + version: 6.12.1 + '@codemirror/state': + specifier: ^6.4.0 + version: 6.5.4 + '@codemirror/view': + specifier: ^6.35.0 + version: 6.39.11 + '@lezer/highlight': + specifier: ^1.2.0 + version: 1.2.3 + '@lezer/lr': + specifier: ^1.4.0 + version: 1.4.7 + tsup: + specifier: ^8.0.0 + version: 8.5.1(jiti@1.21.7)(postcss@8.5.6)(tsx@4.21.0)(typescript@5.9.3)(yaml@2.8.2) + typescript: + specifier: ^5.3.0 + version: 5.9.3 + + packages/monaco: + devDependencies: + '@biomejs/biome': + specifier: ^1.5.0 + version: 1.9.4 + monaco-editor: + specifier: ^0.52.0 + version: 0.52.2 + tsup: + specifier: ^8.0.0 + version: 8.5.1(jiti@1.21.7)(postcss@8.5.6)(tsx@4.21.0)(typescript@5.9.3)(yaml@2.8.2) + typescript: + specifier: ^5.3.0 + version: 5.9.3 + + packages/treesitter: + dependencies: + node-addon-api: + specifier: ^7.1.0 + version: 7.1.1 + node-gyp-build: + specifier: ^4.8.0 + version: 4.8.4 + tree-sitter: + specifier: ^0.21.0 + version: 0.21.1 + devDependencies: + '@biomejs/biome': + specifier: ^1.5.0 + version: 1.9.4 + node-gyp: + specifier: ^10.0.0 + version: 10.3.1 + prebuildify: + specifier: ^6.0.0 + version: 6.0.1 + tree-sitter-cli: + specifier: ^0.22.6 + version: 0.22.6 + packages/vscode: dependencies: vscode-languageclient: @@ -109,7 +179,7 @@ importers: third_party/docsite: dependencies: '@astrojs/check': - specifier: ^0.8.2 + specifier: ^0.8.3 version: 0.8.3(prettier-plugin-astro@0.14.1)(prettier@3.8.1)(typescript@5.9.3) '@astrojs/mdx': specifier: ^3.1.3 @@ -190,7 +260,7 @@ importers: specifier: ^1.0.7 version: 1.0.7(tailwindcss@3.4.19(tsx@4.21.0)(yaml@2.8.2)) typescript: - specifier: ^5.5.3 + specifier: ^5.9.3 version: 5.9.3 devDependencies: prettier: @@ -418,59 +488,124 @@ packages: resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==} engines: {node: '>=18'} + '@biomejs/biome@1.9.4': + resolution: {integrity: sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==} + engines: {node: '>=14.21.3'} + hasBin: true + '@biomejs/biome@2.3.11': resolution: {integrity: sha512-/zt+6qazBWguPG6+eWmiELqO+9jRsMZ/DBU3lfuU2ngtIQYzymocHhKiZRyrbra4aCOoyTg/BmY+6WH5mv9xmQ==} engines: {node: '>=14.21.3'} hasBin: true + '@biomejs/cli-darwin-arm64@1.9.4': + resolution: {integrity: sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [darwin] + '@biomejs/cli-darwin-arm64@2.3.11': resolution: {integrity: sha512-/uXXkBcPKVQY7rc9Ys2CrlirBJYbpESEDme7RKiBD6MmqR2w3j0+ZZXRIL2xiaNPsIMMNhP1YnA+jRRxoOAFrA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] + '@biomejs/cli-darwin-x64@1.9.4': + resolution: {integrity: sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [darwin] + '@biomejs/cli-darwin-x64@2.3.11': resolution: {integrity: sha512-fh7nnvbweDPm2xEmFjfmq7zSUiox88plgdHF9OIW4i99WnXrAC3o2P3ag9judoUMv8FCSUnlwJCM1B64nO5Fbg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] + '@biomejs/cli-linux-arm64-musl@1.9.4': + resolution: {integrity: sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + '@biomejs/cli-linux-arm64-musl@2.3.11': resolution: {integrity: sha512-XPSQ+XIPZMLaZ6zveQdwNjbX+QdROEd1zPgMwD47zvHV+tCGB88VH+aynyGxAHdzL+Tm/+DtKST5SECs4iwCLg==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] + '@biomejs/cli-linux-arm64@1.9.4': + resolution: {integrity: sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + '@biomejs/cli-linux-arm64@2.3.11': resolution: {integrity: sha512-l4xkGa9E7Uc0/05qU2lMYfN1H+fzzkHgaJoy98wO+b/7Gl78srbCRRgwYSW+BTLixTBrM6Ede5NSBwt7rd/i6g==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] + '@biomejs/cli-linux-x64-musl@1.9.4': + resolution: {integrity: sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + '@biomejs/cli-linux-x64-musl@2.3.11': resolution: {integrity: sha512-vU7a8wLs5C9yJ4CB8a44r12aXYb8yYgBn+WeyzbMjaCMklzCv1oXr8x+VEyWodgJt9bDmhiaW/I0RHbn7rsNmw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] + '@biomejs/cli-linux-x64@1.9.4': + resolution: {integrity: sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + '@biomejs/cli-linux-x64@2.3.11': resolution: {integrity: sha512-/1s9V/H3cSe0r0Mv/Z8JryF5x9ywRxywomqZVLHAoa/uN0eY7F8gEngWKNS5vbbN/BsfpCG5yeBT5ENh50Frxg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] + '@biomejs/cli-win32-arm64@1.9.4': + resolution: {integrity: sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [win32] + '@biomejs/cli-win32-arm64@2.3.11': resolution: {integrity: sha512-PZQ6ElCOnkYapSsysiTy0+fYX+agXPlWugh6+eQ6uPKI3vKAqNp6TnMhoM3oY2NltSB89hz59o8xIfOdyhi9Iw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] + '@biomejs/cli-win32-x64@1.9.4': + resolution: {integrity: sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [win32] + '@biomejs/cli-win32-x64@2.3.11': resolution: {integrity: sha512-43VrG813EW+b5+YbDbz31uUsheX+qFKCpXeY9kfdAx+ww3naKxeVkTD9zLIWxUPfJquANMHrmW3wbe/037G0Qg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] + '@codemirror/autocomplete@6.20.0': + resolution: {integrity: sha512-bOwvTOIJcG5FVo5gUUupiwYh8MioPLQ4UcqbcRf7UQ98X90tCa9E1kZ3Z7tqwpZxYyOvh1YTYbmZE9RTfTp5hg==} + + '@codemirror/language@6.12.1': + resolution: {integrity: sha512-Fa6xkSiuGKc8XC8Cn96T+TQHYj4ZZ7RdFmXA3i9xe/3hLHfwPZdM+dqfX0Cp0zQklBKhVD8Yzc8LS45rkqcwpQ==} + + '@codemirror/state@6.5.4': + resolution: {integrity: sha512-8y7xqG/hpB53l25CIoit9/ngxdfoG+fx+V3SHBrinnhOtLvKHRyAJJuHzkWrR4YXXLX8eXBsejgAAxHUOdW1yw==} + + '@codemirror/view@6.39.11': + resolution: {integrity: sha512-bWdeR8gWM87l4DB/kYSF9A+dVackzDb/V56Tq7QVrQ7rn86W0rgZFtlL3g3pem6AeGcb9NQNoy3ao4WpW4h5tQ==} + '@emmetio/abbreviation@2.3.3': resolution: {integrity: sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA==} @@ -946,6 +1081,18 @@ packages: '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + '@lezer/common@1.5.0': + resolution: {integrity: sha512-PNGcolp9hr4PJdXR4ix7XtixDrClScvtSCYW3rQG106oVMOOI+jFb+0+J3mbeL/53g1Zd6s0kJzaw6Ri68GmAA==} + + '@lezer/highlight@1.2.3': + resolution: {integrity: sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g==} + + '@lezer/lr@1.4.7': + resolution: {integrity: sha512-wNIFWdSUfX9Jc6ePMzxSPVgTVB4EOfDIwLQLWASyiUdHKaMsiilj9bYiGkGQCKVodd0x6bgQCV207PILGFCF9Q==} + + '@marijn/find-cluster-break@1.0.2': + resolution: {integrity: sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==} + '@mdx-js/mdx@3.1.1': resolution: {integrity: sha512-f6ZO2ifpwAQIpzGWaBQT2TXxPv6z3RBzQKpVftEWN78Vl/YweF1uwussDx8ECAXVtr3Rs89fKyG9YlzUs9DyGQ==} @@ -961,9 +1108,21 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@npmcli/agent@2.2.2': + resolution: {integrity: sha512-OrcNPXdpSl9UX7qPVRWbmWMCSXrcDa2M9DvrbOTj7ao1S4PlqVFYv9/yLKMkrJKZ/V5A/kDBC690or307i26Og==} + engines: {node: ^16.14.0 || >=18.0.0} + + '@npmcli/fs@3.1.1': + resolution: {integrity: sha512-q9CRWjpHCMIh5sVyefoD1cA7PkvILqCZsnSOEUUivORLjxCO/Irmue2DprETiNgEqktDBZaM1Bi+jrarx1XdCg==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + '@oslojs/encoding@1.1.0': resolution: {integrity: sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==} + '@pkgjs/parseargs@0.11.0': + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + '@radix-ui/number@1.1.1': resolution: {integrity: sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==} @@ -1835,6 +1994,10 @@ packages: engines: {node: '>= 20'} hasBin: true + abbrev@2.0.0: + resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -1849,6 +2012,10 @@ packages: resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} engines: {node: '>= 14'} + aggregate-error@3.1.0: + resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} + engines: {node: '>=8'} + ajv-draft-04@1.0.0: resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==} peerDependencies: @@ -2022,6 +2189,10 @@ packages: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} + cacache@18.0.4: + resolution: {integrity: sha512-B+L5iIa9mgcjLbliir2th36yEwPftrzteHYujzsx3dFP/31GCHcIeS8f5MGd80odLOjaOvSpU3EEAmRQptkxLQ==} + engines: {node: ^16.14.0 || >=18.0.0} + call-bind-apply-helpers@1.0.2: resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} engines: {node: '>= 0.4'} @@ -2086,6 +2257,10 @@ packages: chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} + chownr@2.0.0: + resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} + engines: {node: '>=10'} + ci-info@4.3.1: resolution: {integrity: sha512-Wdy2Igu8OcBpI2pZePZ5oWjPC38tmDVx5WKUXKwlLYkA0ozo85sLsLvkBbBn/sZaSCMFOGZJ14fvW9t5/d7kdA==} engines: {node: '>=8'} @@ -2093,6 +2268,10 @@ packages: class-variance-authority@0.7.1: resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==} + clean-stack@2.2.0: + resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} + engines: {node: '>=6'} + cli-boxes@3.0.0: resolution: {integrity: sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==} engines: {node: '>=10'} @@ -2175,6 +2354,9 @@ packages: resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} engines: {node: '>= 0.6'} + crelt@1.0.6: + resolution: {integrity: sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -2313,6 +2495,9 @@ packages: encoding-sniffer@0.2.1: resolution: {integrity: sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==} + encoding@0.1.13: + resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} + end-of-stream@1.4.5: resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} @@ -2328,10 +2513,17 @@ packages: resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==} engines: {node: '>=0.12'} + env-paths@2.2.1: + resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} + engines: {node: '>=6'} + environment@1.1.0: resolution: {integrity: sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==} engines: {node: '>=18'} + err-code@2.0.3: + resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} + es-define-property@1.0.1: resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} engines: {node: '>= 0.4'} @@ -2415,6 +2607,9 @@ packages: resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==} engines: {node: '>=12.0.0'} + exponential-backoff@3.1.3: + resolution: {integrity: sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA==} + extend-shallow@2.0.1: resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==} engines: {node: '>=0.10.0'} @@ -2487,6 +2682,14 @@ packages: resolution: {integrity: sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==} engines: {node: '>=14.14'} + fs-minipass@2.1.0: + resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} + engines: {node: '>= 8'} + + fs-minipass@3.0.3: + resolution: {integrity: sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -2540,6 +2743,10 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} + glob@10.5.0: + resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==} + hasBin: true + glob@11.1.0: resolution: {integrity: sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==} engines: {node: 20 || >=22} @@ -2662,6 +2869,14 @@ packages: import-meta-resolve@4.2.0: resolution: {integrity: sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==} + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + indent-string@4.0.0: + resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} + engines: {node: '>=8'} + index-to-position@1.2.0: resolution: {integrity: sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==} engines: {node: '>=18'} @@ -2675,6 +2890,10 @@ packages: inline-style-parser@0.2.7: resolution: {integrity: sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==} + ip-address@10.1.0: + resolution: {integrity: sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==} + engines: {node: '>= 12'} + is-absolute-url@4.0.1: resolution: {integrity: sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -2732,6 +2951,9 @@ packages: resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} engines: {node: '>=12'} + is-lambda@1.0.1: + resolution: {integrity: sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==} + is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} @@ -2755,6 +2977,10 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + isexe@3.1.1: + resolution: {integrity: sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==} + engines: {node: '>=16'} + istanbul-lib-coverage@3.2.2: resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} engines: {node: '>=8'} @@ -2771,6 +2997,9 @@ packages: resolution: {integrity: sha512-5mbUj3SiZXCuRf9fT3ibzbSSEWiy63gFfksmGfdOzujPjW3k+z8WvIBxcJHBoQNlaZaiyB25deviif2+osLmLw==} engines: {node: '>=4'} + jackspeak@3.4.3: + resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + jackspeak@4.1.1: resolution: {integrity: sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==} engines: {node: 20 || >=22} @@ -2943,6 +3172,10 @@ packages: resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} engines: {node: '>=10'} + make-fetch-happen@13.0.1: + resolution: {integrity: sha512-cKTUFc/rbKUd/9meOvgrpJ2WrNzymt6jfRDdwg5UCnVzv9dTpEj9JS5m3wtziXVCjluIXyL8pcaukYqezIzZQA==} + engines: {node: ^16.14.0 || >=18.0.0} + markdown-extensions@2.0.0: resolution: {integrity: sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==} engines: {node: '>=16'} @@ -3164,16 +3397,56 @@ packages: minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + minipass-collect@2.0.1: + resolution: {integrity: sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==} + engines: {node: '>=16 || 14 >=14.17'} + + minipass-fetch@3.0.5: + resolution: {integrity: sha512-2N8elDQAtSnFV0Dk7gt15KHsS0Fyz6CbYZ360h0WTYV1Ty46li3rAXVOQj1THMNLdmrD9Vt5pBPtWtVkpwGBqg==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + + minipass-flush@1.0.5: + resolution: {integrity: sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==} + engines: {node: '>= 8'} + + minipass-pipeline@1.2.4: + resolution: {integrity: sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==} + engines: {node: '>=8'} + + minipass-sized@1.0.3: + resolution: {integrity: sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==} + engines: {node: '>=8'} + + minipass@3.3.6: + resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} + engines: {node: '>=8'} + + minipass@5.0.0: + resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} + engines: {node: '>=8'} + minipass@7.1.2: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} + minizlib@2.1.2: + resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} + engines: {node: '>= 8'} + mkdirp-classic@0.5.3: resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} + mkdirp@1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + mlly@1.8.0: resolution: {integrity: sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==} + monaco-editor@0.52.2: + resolution: {integrity: sha512-GEQWEZmfkOGLdd3XK8ryrfWz3AIP8YymVXiPHEdewrUq7mh0qrKrfHLNCXcbB6sTnMLnOZ3ztSiKcciFUkIJwQ==} + mrmime@2.0.1: resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} engines: {node: '>=10'} @@ -3198,6 +3471,10 @@ packages: napi-build-utils@2.0.0: resolution: {integrity: sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==} + negotiator@0.6.4: + resolution: {integrity: sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==} + engines: {node: '>= 0.6'} + neo-async@2.6.2: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} @@ -3215,6 +3492,22 @@ packages: node-addon-api@4.3.0: resolution: {integrity: sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==} + node-addon-api@7.1.1: + resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==} + + node-addon-api@8.5.0: + resolution: {integrity: sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==} + engines: {node: ^18 || ^20 || >= 21} + + node-gyp-build@4.8.4: + resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==} + hasBin: true + + node-gyp@10.3.1: + resolution: {integrity: sha512-Pp3nFHBThHzVtNY7U6JfPjvT/DTE8+o/4xKsLQtBoU+j2HLsGlhcfzflAoUreaJbNmYnX+LlLi0qjV8kpyO6xQ==} + engines: {node: ^16.14.0 || >=18.0.0} + hasBin: true + node-releases@2.0.27: resolution: {integrity: sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==} @@ -3222,6 +3515,11 @@ packages: resolution: {integrity: sha512-tGnJW6OKRii9u/b2WiUViTJS+h7Apxx17qsMUjsUeNDiMMX5ZFf8F8Fcz7PAQ6omvOxHZtvDTmOYKJQwmfpjeg==} engines: {node: '>=20'} + nopt@7.2.1: + resolution: {integrity: sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + hasBin: true + normalize-package-data@6.0.2: resolution: {integrity: sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==} engines: {node: ^16.14.0 || >=18.0.0} @@ -3230,6 +3528,10 @@ packages: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} + npm-run-path@3.1.0: + resolution: {integrity: sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==} + engines: {node: '>=8'} + nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} @@ -3278,6 +3580,10 @@ packages: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} + p-map@4.0.0: + resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} + engines: {node: '>=10'} + p-map@7.0.4: resolution: {integrity: sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==} engines: {node: '>=18'} @@ -3333,6 +3639,10 @@ packages: path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + path-scurry@2.0.1: resolution: {integrity: sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==} engines: {node: 20 || >=22} @@ -3448,6 +3758,10 @@ packages: engines: {node: '>=10'} hasBin: true + prebuildify@6.0.1: + resolution: {integrity: sha512-8Y2oOOateom/s8dNBsGIcnm6AxPmLH4/nanQzL5lQMU+sC0CMhzARZHizwr36pUPLdvBnOkCNQzxg4djuFSgIw==} + hasBin: true + preferred-pm@4.1.1: resolution: {integrity: sha512-rU+ZAv1Ur9jAUZtGPebQVQPzdGhNzaEiQ7VL9+cjsAWPHFYOccNXPNiev1CCDSOg/2j7UujM7ojNhpkuILEVNQ==} engines: {node: '>=18.12'} @@ -3465,6 +3779,14 @@ packages: resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==} engines: {node: '>=6'} + proc-log@4.2.0: + resolution: {integrity: sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + + promise-retry@2.0.1: + resolution: {integrity: sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==} + engines: {node: '>=10'} + prompts@2.4.2: resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} engines: {node: '>= 6'} @@ -3661,6 +3983,10 @@ packages: retext@9.0.0: resolution: {integrity: sha512-sbMDcpHCNjvlheSgMfEcVrZko3cDzdbe1x/e7G66dFp0Ff7Mldvi2uv6JkJQzdRcvLYE8CA8Oe8siQx8ZOgTcA==} + retry@0.12.0: + resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} + engines: {node: '>= 4'} + reusify@1.1.0: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -3786,6 +4112,18 @@ packages: resolution: {integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==} engines: {node: '>=10'} + smart-buffer@4.2.0: + resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} + engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + + socks-proxy-agent@8.0.5: + resolution: {integrity: sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==} + engines: {node: '>= 14'} + + socks@2.8.7: + resolution: {integrity: sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==} + engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -3816,6 +4154,10 @@ packages: sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + ssri@10.0.6: + resolution: {integrity: sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} @@ -3867,6 +4209,9 @@ packages: structured-source@4.0.0: resolution: {integrity: sha512-qGzRFNJDjFieQkl/sVOI2dUjHKRyL9dAJi2gCPGJLbJHBIkyOHxjuocpIEfbLioX+qSJpvbYdT49/YCdMznKxA==} + style-mod@4.1.3: + resolution: {integrity: sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==} + style-to-js@1.1.21: resolution: {integrity: sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==} @@ -3917,6 +4262,11 @@ packages: resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} engines: {node: '>=6'} + tar@6.2.1: + resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} + engines: {node: '>=10'} + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exhorbitant rates) by contacting i@izs.me + terminal-link@4.0.0: resolution: {integrity: sha512-lk+vH+MccxNqgVqSnkMVKx4VLJfnLjDBGzH16JVZjKE2DoxP57s6/vt6JmXV5I3jBcfGrxNrYtC+mPtU7WJztA==} engines: {node: '>=18'} @@ -3965,6 +4315,13 @@ packages: resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} hasBin: true + tree-sitter-cli@0.22.6: + resolution: {integrity: sha512-s7mYOJXi8sIFkt/nLJSqlYZP96VmKTc3BAwIX0rrrlRxWjWuCwixFqwzxWZBQz4R8Hx01iP7z3cT3ih58BUmZQ==} + hasBin: true + + tree-sitter@0.21.1: + resolution: {integrity: sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==} + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -4087,6 +4444,14 @@ packages: unified@11.0.5: resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} + unique-filename@3.0.0: + resolution: {integrity: sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + + unique-slug@4.0.0: + resolution: {integrity: sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + unist-util-find-after@5.0.0: resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==} @@ -4382,6 +4747,9 @@ packages: vscode-uri@3.1.0: resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==} + w3c-keyname@2.2.8: + resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==} + web-namespaces@2.0.1: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} @@ -4407,6 +4775,11 @@ packages: engines: {node: '>= 8'} hasBin: true + which@4.0.0: + resolution: {integrity: sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==} + engines: {node: ^16.13.0 || >=18.0.0} + hasBin: true + why-is-node-running@2.3.0: resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} engines: {node: '>=8'} @@ -4870,6 +5243,17 @@ snapshots: '@bcoe/v8-coverage@1.0.2': {} + '@biomejs/biome@1.9.4': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 1.9.4 + '@biomejs/cli-darwin-x64': 1.9.4 + '@biomejs/cli-linux-arm64': 1.9.4 + '@biomejs/cli-linux-arm64-musl': 1.9.4 + '@biomejs/cli-linux-x64': 1.9.4 + '@biomejs/cli-linux-x64-musl': 1.9.4 + '@biomejs/cli-win32-arm64': 1.9.4 + '@biomejs/cli-win32-x64': 1.9.4 + '@biomejs/biome@2.3.11': optionalDependencies: '@biomejs/cli-darwin-arm64': 2.3.11 @@ -4881,30 +5265,81 @@ snapshots: '@biomejs/cli-win32-arm64': 2.3.11 '@biomejs/cli-win32-x64': 2.3.11 + '@biomejs/cli-darwin-arm64@1.9.4': + optional: true + '@biomejs/cli-darwin-arm64@2.3.11': optional: true + '@biomejs/cli-darwin-x64@1.9.4': + optional: true + '@biomejs/cli-darwin-x64@2.3.11': optional: true + '@biomejs/cli-linux-arm64-musl@1.9.4': + optional: true + '@biomejs/cli-linux-arm64-musl@2.3.11': optional: true + '@biomejs/cli-linux-arm64@1.9.4': + optional: true + '@biomejs/cli-linux-arm64@2.3.11': optional: true + '@biomejs/cli-linux-x64-musl@1.9.4': + optional: true + '@biomejs/cli-linux-x64-musl@2.3.11': optional: true + '@biomejs/cli-linux-x64@1.9.4': + optional: true + '@biomejs/cli-linux-x64@2.3.11': optional: true + '@biomejs/cli-win32-arm64@1.9.4': + optional: true + '@biomejs/cli-win32-arm64@2.3.11': optional: true + '@biomejs/cli-win32-x64@1.9.4': + optional: true + '@biomejs/cli-win32-x64@2.3.11': optional: true + '@codemirror/autocomplete@6.20.0': + dependencies: + '@codemirror/language': 6.12.1 + '@codemirror/state': 6.5.4 + '@codemirror/view': 6.39.11 + '@lezer/common': 1.5.0 + + '@codemirror/language@6.12.1': + dependencies: + '@codemirror/state': 6.5.4 + '@codemirror/view': 6.39.11 + '@lezer/common': 1.5.0 + '@lezer/highlight': 1.2.3 + '@lezer/lr': 1.4.7 + style-mod: 4.1.3 + + '@codemirror/state@6.5.4': + dependencies: + '@marijn/find-cluster-break': 1.0.2 + + '@codemirror/view@6.39.11': + dependencies: + '@codemirror/state': 6.5.4 + crelt: 1.0.6 + style-mod: 4.1.3 + w3c-keyname: 2.2.8 + '@emmetio/abbreviation@2.3.3': dependencies: '@emmetio/scanner': 1.0.4 @@ -5218,6 +5653,18 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 + '@lezer/common@1.5.0': {} + + '@lezer/highlight@1.2.3': + dependencies: + '@lezer/common': 1.5.0 + + '@lezer/lr@1.4.7': + dependencies: + '@lezer/common': 1.5.0 + + '@marijn/find-cluster-break@1.0.2': {} + '@mdx-js/mdx@3.1.1': dependencies: '@types/estree': 1.0.8 @@ -5260,8 +5707,25 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.20.1 + '@npmcli/agent@2.2.2': + dependencies: + agent-base: 7.1.4 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + lru-cache: 10.4.3 + socks-proxy-agent: 8.0.5 + transitivePeerDependencies: + - supports-color + + '@npmcli/fs@3.1.1': + dependencies: + semver: 7.7.3 + '@oslojs/encoding@1.1.0': {} + '@pkgjs/parseargs@0.11.0': + optional: true + '@radix-ui/number@1.1.1': {} '@radix-ui/primitive@1.1.3': {} @@ -6214,6 +6678,8 @@ snapshots: transitivePeerDependencies: - supports-color + abbrev@2.0.0: {} + acorn-jsx@5.3.2(acorn@8.15.0): dependencies: acorn: 8.15.0 @@ -6222,6 +6688,11 @@ snapshots: agent-base@7.1.4: {} + aggregate-error@3.1.0: + dependencies: + clean-stack: 2.2.0 + indent-string: 4.0.0 + ajv-draft-04@1.0.0(ajv@8.17.1): optionalDependencies: ajv: 8.17.1 @@ -6389,8 +6860,7 @@ snapshots: base-64@1.0.0: {} - base64-js@1.5.1: - optional: true + base64-js@1.5.1: {} baseline-browser-mapping@2.9.17: {} @@ -6405,7 +6875,6 @@ snapshots: buffer: 5.7.1 inherits: 2.0.4 readable-stream: 3.6.2 - optional: true boolbase@1.0.0: {} @@ -6451,7 +6920,6 @@ snapshots: dependencies: base64-js: 1.5.1 ieee754: 1.2.1 - optional: true bundle-name@4.1.0: dependencies: @@ -6464,6 +6932,21 @@ snapshots: cac@6.7.14: {} + cacache@18.0.4: + dependencies: + '@npmcli/fs': 3.1.1 + fs-minipass: 3.0.3 + glob: 10.5.0 + lru-cache: 10.4.3 + minipass: 7.1.2 + minipass-collect: 2.0.1 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + p-map: 4.0.0 + ssri: 10.0.6 + tar: 6.2.1 + unique-filename: 3.0.0 + call-bind-apply-helpers@1.0.2: dependencies: es-errors: 1.3.0 @@ -6538,8 +7021,9 @@ snapshots: dependencies: readdirp: 4.1.2 - chownr@1.1.4: - optional: true + chownr@1.1.4: {} + + chownr@2.0.0: {} ci-info@4.3.1: {} @@ -6547,6 +7031,8 @@ snapshots: dependencies: clsx: 2.1.1 + clean-stack@2.2.0: {} + cli-boxes@3.0.0: {} cli-cursor@5.0.0: @@ -6619,6 +7105,8 @@ snapshots: cookie@0.7.2: {} + crelt@1.0.6: {} + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -6745,10 +7233,14 @@ snapshots: iconv-lite: 0.6.3 whatwg-encoding: 3.1.1 + encoding@0.1.13: + dependencies: + iconv-lite: 0.6.3 + optional: true + end-of-stream@1.4.5: dependencies: once: 1.4.0 - optional: true entities@4.5.0: {} @@ -6756,8 +7248,12 @@ snapshots: entities@7.0.1: {} + env-paths@2.2.1: {} + environment@1.1.0: {} + err-code@2.0.3: {} + es-define-property@1.0.1: {} es-errors@1.3.0: {} @@ -6892,6 +7388,8 @@ snapshots: expect-type@1.3.0: {} + exponential-backoff@3.1.3: {} + extend-shallow@2.0.1: dependencies: is-extendable: 0.1.1 @@ -6961,8 +7459,7 @@ snapshots: fraction.js@5.3.4: {} - fs-constants@1.0.0: - optional: true + fs-constants@1.0.0: {} fs-extra@11.3.3: dependencies: @@ -6970,6 +7467,14 @@ snapshots: jsonfile: 6.2.0 universalify: 2.0.1 + fs-minipass@2.1.0: + dependencies: + minipass: 3.3.6 + + fs-minipass@3.0.3: + dependencies: + minipass: 7.1.2 + fsevents@2.3.3: optional: true @@ -7020,6 +7525,15 @@ snapshots: dependencies: is-glob: 4.0.3 + glob@10.5.0: + dependencies: + foreground-child: 3.3.1 + jackspeak: 3.4.3 + minimatch: 9.0.5 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 1.11.1 + glob@11.1.0: dependencies: foreground-child: 3.3.1 @@ -7239,23 +7753,27 @@ snapshots: dependencies: safer-buffer: 2.1.2 - ieee754@1.2.1: - optional: true + ieee754@1.2.1: {} ignore@7.0.5: {} import-meta-resolve@4.2.0: {} + imurmurhash@0.1.4: {} + + indent-string@4.0.0: {} + index-to-position@1.2.0: {} - inherits@2.0.4: - optional: true + inherits@2.0.4: {} ini@1.3.8: optional: true inline-style-parser@0.2.7: {} + ip-address@10.1.0: {} + is-absolute-url@4.0.1: {} is-alphabetical@2.0.1: {} @@ -7298,6 +7816,8 @@ snapshots: is-interactive@2.0.0: {} + is-lambda@1.0.1: {} + is-number@7.0.0: {} is-plain-obj@4.1.0: {} @@ -7312,6 +7832,8 @@ snapshots: isexe@2.0.0: {} + isexe@3.1.1: {} + istanbul-lib-coverage@3.2.2: {} istanbul-lib-report@3.0.1: @@ -7331,6 +7853,12 @@ snapshots: editions: 6.22.0 textextensions: 6.11.0 + jackspeak@3.4.3: + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + jackspeak@4.1.1: dependencies: '@isaacs/cliui': 8.0.2 @@ -7494,6 +8022,23 @@ snapshots: dependencies: semver: 7.7.3 + make-fetch-happen@13.0.1: + dependencies: + '@npmcli/agent': 2.2.2 + cacache: 18.0.4 + http-cache-semantics: 4.2.0 + is-lambda: 1.0.1 + minipass: 7.1.2 + minipass-fetch: 3.0.5 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + negotiator: 0.6.4 + proc-log: 4.2.0 + promise-retry: 2.0.1 + ssri: 10.0.6 + transitivePeerDependencies: + - supports-color + markdown-extensions@2.0.0: {} markdown-it@14.1.0: @@ -7982,10 +8527,46 @@ snapshots: minimist@1.2.8: {} + minipass-collect@2.0.1: + dependencies: + minipass: 7.1.2 + + minipass-fetch@3.0.5: + dependencies: + minipass: 7.1.2 + minipass-sized: 1.0.3 + minizlib: 2.1.2 + optionalDependencies: + encoding: 0.1.13 + + minipass-flush@1.0.5: + dependencies: + minipass: 3.3.6 + + minipass-pipeline@1.2.4: + dependencies: + minipass: 3.3.6 + + minipass-sized@1.0.3: + dependencies: + minipass: 3.3.6 + + minipass@3.3.6: + dependencies: + yallist: 4.0.0 + + minipass@5.0.0: {} + minipass@7.1.2: {} - mkdirp-classic@0.5.3: - optional: true + minizlib@2.1.2: + dependencies: + minipass: 3.3.6 + yallist: 4.0.0 + + mkdirp-classic@0.5.3: {} + + mkdirp@1.0.4: {} mlly@1.8.0: dependencies: @@ -7994,6 +8575,8 @@ snapshots: pkg-types: 1.3.1 ufo: 1.6.3 + monaco-editor@0.52.2: {} + mrmime@2.0.1: {} ms@2.1.3: {} @@ -8013,6 +8596,8 @@ snapshots: napi-build-utils@2.0.0: optional: true + negotiator@0.6.4: {} + neo-async@2.6.2: {} neotraverse@0.6.18: {} @@ -8024,11 +8609,31 @@ snapshots: node-abi@3.87.0: dependencies: semver: 7.7.3 - optional: true node-addon-api@4.3.0: optional: true + node-addon-api@7.1.1: {} + + node-addon-api@8.5.0: {} + + node-gyp-build@4.8.4: {} + + node-gyp@10.3.1: + dependencies: + env-paths: 2.2.1 + exponential-backoff: 3.1.3 + glob: 10.5.0 + graceful-fs: 4.2.11 + make-fetch-happen: 13.0.1 + nopt: 7.2.1 + proc-log: 4.2.0 + semver: 7.7.3 + tar: 6.2.1 + which: 4.0.0 + transitivePeerDependencies: + - supports-color + node-releases@2.0.27: {} node-sarif-builder@3.4.0: @@ -8036,6 +8641,10 @@ snapshots: '@types/sarif': 2.1.7 fs-extra: 11.3.3 + nopt@7.2.1: + dependencies: + abbrev: 2.0.0 + normalize-package-data@6.0.2: dependencies: hosted-git-info: 7.0.2 @@ -8044,6 +8653,10 @@ snapshots: normalize-path@3.0.0: {} + npm-run-path@3.1.0: + dependencies: + path-key: 3.1.1 + nth-check@2.1.1: dependencies: boolbase: 1.0.0 @@ -8059,7 +8672,6 @@ snapshots: once@1.4.0: dependencies: wrappy: 1.0.2 - optional: true onetime@7.0.0: dependencies: @@ -8102,6 +8714,10 @@ snapshots: dependencies: p-limit: 2.3.0 + p-map@4.0.0: + dependencies: + aggregate-error: 3.1.0 + p-map@7.0.4: {} p-queue@8.1.1: @@ -8165,6 +8781,11 @@ snapshots: path-parse@1.0.7: {} + path-scurry@1.11.1: + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.2 + path-scurry@2.0.1: dependencies: lru-cache: 11.2.4 @@ -8264,6 +8885,15 @@ snapshots: tunnel-agent: 0.6.0 optional: true + prebuildify@6.0.1: + dependencies: + minimist: 1.2.8 + mkdirp-classic: 0.5.3 + node-abi: 3.87.0 + npm-run-path: 3.1.0 + pump: 3.0.3 + tar-fs: 2.1.4 + preferred-pm@4.1.1: dependencies: find-up-simple: 1.0.1 @@ -8280,6 +8910,13 @@ snapshots: prismjs@1.30.0: {} + proc-log@4.2.0: {} + + promise-retry@2.0.1: + dependencies: + err-code: 2.0.3 + retry: 0.12.0 + prompts@2.4.2: dependencies: kleur: 3.0.3 @@ -8291,7 +8928,6 @@ snapshots: dependencies: end-of-stream: 1.4.5 once: 1.4.0 - optional: true punycode.js@2.3.1: {} @@ -8378,7 +9014,6 @@ snapshots: inherits: 2.0.4 string_decoder: 1.3.0 util-deprecate: 1.0.2 - optional: true readdirp@3.6.0: dependencies: @@ -8564,6 +9199,8 @@ snapshots: retext-stringify: 4.0.0 unified: 11.0.5 + retry@0.12.0: {} + reusify@1.1.0: {} rollup@4.56.0: @@ -8760,6 +9397,21 @@ snapshots: astral-regex: 2.0.0 is-fullwidth-code-point: 3.0.0 + smart-buffer@4.2.0: {} + + socks-proxy-agent@8.0.5: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + socks: 2.8.7 + transitivePeerDependencies: + - supports-color + + socks@2.8.7: + dependencies: + ip-address: 10.1.0 + smart-buffer: 4.2.0 + source-map-js@1.2.1: {} source-map@0.6.1: {} @@ -8784,6 +9436,10 @@ snapshots: sprintf-js@1.0.3: {} + ssri@10.0.6: + dependencies: + minipass: 7.1.2 + stackback@0.0.2: {} std-env@3.10.0: {} @@ -8811,7 +9467,6 @@ snapshots: string_decoder@1.3.0: dependencies: safe-buffer: 5.2.1 - optional: true stringify-entities@4.0.4: dependencies: @@ -8837,6 +9492,8 @@ snapshots: dependencies: boundary: 2.0.0 + style-mod@4.1.3: {} + style-to-js@1.1.21: dependencies: style-to-object: 1.0.14 @@ -8918,7 +9575,6 @@ snapshots: mkdirp-classic: 0.5.3 pump: 3.0.3 tar-stream: 2.2.0 - optional: true tar-stream@2.2.0: dependencies: @@ -8927,7 +9583,15 @@ snapshots: fs-constants: 1.0.0 inherits: 2.0.4 readable-stream: 3.6.2 - optional: true + + tar@6.2.1: + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 5.0.0 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 terminal-link@4.0.0: dependencies: @@ -8969,6 +9633,13 @@ snapshots: tree-kill@1.2.2: {} + tree-sitter-cli@0.22.6: {} + + tree-sitter@0.21.1: + dependencies: + node-addon-api: 8.5.0 + node-gyp-build: 4.8.4 + trim-lines@3.0.1: {} trough@2.2.0: {} @@ -9083,6 +9754,14 @@ snapshots: trough: 2.2.0 vfile: 6.0.3 + unique-filename@3.0.0: + dependencies: + unique-slug: 4.0.0 + + unique-slug@4.0.0: + dependencies: + imurmurhash: 0.1.4 + unist-util-find-after@5.0.0: dependencies: '@types/unist': 3.0.3 @@ -9348,6 +10027,8 @@ snapshots: vscode-uri@3.1.0: {} + w3c-keyname@2.2.8: {} + web-namespaces@2.0.1: {} whatwg-encoding@3.1.1: @@ -9366,6 +10047,10 @@ snapshots: dependencies: isexe: 2.0.0 + which@4.0.0: + dependencies: + isexe: 3.1.1 + why-is-node-running@2.3.0: dependencies: siginfo: 2.0.0 @@ -9395,8 +10080,7 @@ snapshots: string-width: 7.2.0 strip-ansi: 7.1.2 - wrappy@1.0.2: - optional: true + wrappy@1.0.2: {} wsl-utils@0.1.0: dependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index f254bbcd3..b4e191a97 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -16,3 +16,6 @@ packages: - js - third_party/docsite - packages/vscode + - packages/monaco + - packages/codemirror + - packages/treesitter diff --git a/third_party/docsite/package.json b/third_party/docsite/package.json index d6639abc9..89acf9ac5 100644 --- a/third_party/docsite/package.json +++ b/third_party/docsite/package.json @@ -24,7 +24,7 @@ "withastro" ], "dependencies": { - "@astrojs/check": "^0.8.2", + "@astrojs/check": "^0.8.3", "@astrojs/mdx": "^3.1.3", "@astrojs/react": "^3.6.0", "@astrojs/tailwind": "^5.1.0", @@ -51,7 +51,7 @@ "tailwind-merge": "^2.4.0", "tailwindcss": "^3.4.6", "tailwindcss-animate": "^1.0.7", - "typescript": "^5.5.3" + "typescript": "^5.9.3" }, "devDependencies": { "prettier": "^3.3.3",