diff options
author | Joel Spadin <[email protected]> | 2024-10-26 02:55:09 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-26 09:55:09 +0200 |
commit | f0a3947044e82df6778b293a78c07677df4b56e1 (patch) | |
tree | 9fb6a00cbd11848bc9ee7c598615b6b2facc0006 /docs | |
parent | 7ee25c795934692df42b823f024bc846cf9c60b1 (diff) | |
download | zmk-f0a3947044e82df6778b293a78c07677df4b56e1.tar.gz zmk-f0a3947044e82df6778b293a78c07677df4b56e1.zip |
Update web-tree-sitter and tweak keymap upgrader (#2593)
* fix(docs): Fix TypeScript import diagnostics
Set the TypeScript module resolution mode to "bundler" so it correctly
resolves imports in .ts files instead of showing errors in IDEs.
* chore(docs): Update web-tree-sitter
Updated web-tree-sitter, and switched from having a copy of
tree-sitter-devicetree.wasm in the repo to using the latest version of
the tree-sitter-devicetree module, which now contains the .wasm file.
* fix(docs): Make keymap upgrader resize vertically only
Changed the textarea in the keymap ugprader to allow only vertical
resizing. This better fits the layout of the page, and it prevents you
from shrinking the box horizontally to the point where it doesn't fit
anything.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/package-lock.json | 61 | ||||
-rw-r--r-- | docs/package.json | 3 | ||||
-rw-r--r-- | docs/src/components/KeymapUpgrader/styles.module.css | 1 | ||||
-rw-r--r-- | docs/src/keymap-upgrade/parser.ts | 7 | ||||
-rw-r--r-- | docs/static/tree-sitter-devicetree.wasm | bin | 160438 -> 0 bytes | |||
-rw-r--r-- | docs/tsconfig.json | 1 |
6 files changed, 67 insertions, 6 deletions
diff --git a/docs/package-lock.json b/docs/package-lock.json index 2b0c829c57..e76c779b96 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -22,7 +22,8 @@ "react-copy-to-clipboard": "^5.0.3", "react-dom": "^18.0.0", "react-toastify": "^10.0.6", - "web-tree-sitter": "^0.23.0" + "tree-sitter-devicetree": "^0.12.1", + "web-tree-sitter": "^0.24.3" }, "devDependencies": { "@docusaurus/module-type-aliases": "^3.0.0", @@ -16672,6 +16673,15 @@ "tslib": "^2.0.3" } }, + "node_modules/node-addon-api": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.2.1.tgz", + "integrity": "sha512-vmEOvxwiH8tlOcv4SyE8RH34rI5/nWVaigUeAUPawC6f0+HoDthwI0vkMu4tbtsZrXq6QXFfrkhjofzKEs5tpA==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, "node_modules/node-emoji": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.1.3.tgz", @@ -16696,6 +16706,17 @@ "node": ">= 6.13.0" } }, + "node_modules/node-gyp-build": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", + "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/node-releases": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", @@ -20964,6 +20985,37 @@ "node": ">=6" } }, + "node_modules/tree-sitter": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.21.1.tgz", + "integrity": "sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==", + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "dependencies": { + "node-addon-api": "^8.0.0", + "node-gyp-build": "^4.8.0" + } + }, + "node_modules/tree-sitter-devicetree": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/tree-sitter-devicetree/-/tree-sitter-devicetree-0.12.1.tgz", + "integrity": "sha512-JccTH8TmgO9B4tAaCEZ8O7yOEtoixBRRnNZYO8W9tnNsv29Y+avsN6V8li2CfwooB1eqZIEbsPLKxN/e7bG+Cg==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^8.2.1", + "node-gyp-build": "^4.8.2" + }, + "peerDependencies": { + "tree-sitter": "^0.21.0" + }, + "peerDependenciesMeta": { + "tree_sitter": { + "optional": true + } + } + }, "node_modules/trim-lines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", @@ -22015,9 +22067,10 @@ } }, "node_modules/web-tree-sitter": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.23.0.tgz", - "integrity": "sha512-p1T+ju2H30fpVX2q5yr+Wv/NfdMMWMjQp9Q+4eEPrHAJpPFh9DPfI2Yr9L1f5SA5KPE+g1cNUqPbpihxUDzmVw==" + "version": "0.24.3", + "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.24.3.tgz", + "integrity": "sha512-uR9YNewr1S2EzPKE+y39nAwaTyobBaZRG/IsfkB/OT4v0lXtNj5WjtHKgn2h7eOYUWIZh5rK9Px7tI6S9CRKdA==", + "license": "MIT" }, "node_modules/web-worker": { "version": "1.3.0", diff --git a/docs/package.json b/docs/package.json index 58aa6a43fd..1a086def3b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -29,7 +29,8 @@ "react-copy-to-clipboard": "^5.0.3", "react-dom": "^18.0.0", "react-toastify": "^10.0.6", - "web-tree-sitter": "^0.23.0" + "tree-sitter-devicetree": "^0.12.1", + "web-tree-sitter": "^0.24.3" }, "browserslist": { "production": [ diff --git a/docs/src/components/KeymapUpgrader/styles.module.css b/docs/src/components/KeymapUpgrader/styles.module.css index 31e06b9799..f44cf32370 100644 --- a/docs/src/components/KeymapUpgrader/styles.module.css +++ b/docs/src/components/KeymapUpgrader/styles.module.css @@ -9,6 +9,7 @@ font-size: var(--ifm-font-size-base); line-height: var(--ifm-pre-line-height); tab-size: 4; + resize: vertical; color: var(--ifm-pre-color); background-color: var(--ifm-pre-background); diff --git a/docs/src/keymap-upgrade/parser.ts b/docs/src/keymap-upgrade/parser.ts index 52d6e98123..b496d1d5a8 100644 --- a/docs/src/keymap-upgrade/parser.ts +++ b/docs/src/keymap-upgrade/parser.ts @@ -5,6 +5,11 @@ const TREE_SITTER_WASM_URL = new URL( import.meta.url ); +const TREE_SITTER_DEVICETREE_WASM_URL = new URL( + "/node_modules/tree-sitter-devicetree/tree-sitter-devicetree.wasm", + import.meta.url +); + export let Devicetree: Parser.Language; export async function initParser() { @@ -17,7 +22,7 @@ export async function initParser() { return prefix + path; }, }); - Devicetree = await Parser.Language.load("/tree-sitter-devicetree.wasm"); + Devicetree = await Parser.Language.load(TREE_SITTER_DEVICETREE_WASM_URL.href); } export function createParser() { diff --git a/docs/static/tree-sitter-devicetree.wasm b/docs/static/tree-sitter-devicetree.wasm Binary files differdeleted file mode 100644 index 885c5274ba..0000000000 --- a/docs/static/tree-sitter-devicetree.wasm +++ /dev/null diff --git a/docs/tsconfig.json b/docs/tsconfig.json index e3f649ee40..b8e14486bb 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -3,6 +3,7 @@ "include": ["src/"], "compilerOptions": { "types": ["node", "@docusaurus/theme-classic"], + "moduleResolution": "Bundler", "esModuleInterop": true, "resolveJsonModule": true, "strict": true, |