summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/package-lock.json31
-rw-r--r--docs/package.json4
-rw-r--r--docs/src/docusaurus-tree-sitter-plugin/index.js28
-rw-r--r--docs/static/tree-sitter-devicetree.wasmbin43042 -> 34601 bytes
-rw-r--r--docs/static/tree-sitter.wasmbin202338 -> 0 bytes
5 files changed, 41 insertions, 22 deletions
diff --git a/docs/package-lock.json b/docs/package-lock.json
index d9f486f..6fd81ea 100644
--- a/docs/package-lock.json
+++ b/docs/package-lock.json
@@ -18,7 +18,7 @@
"react-copy-to-clipboard": "^5.0.3",
"react-dom": "^17.0.2",
"react-toastify": "^7.0.4",
- "web-tree-sitter": "^0.17.1"
+ "web-tree-sitter": "^0.19.4"
},
"devDependencies": {
"eslint": "^7.29.0",
@@ -27,7 +27,7 @@
"eslint-plugin-react": "^7.23.2",
"null-loader": "^4.0.0",
"prettier": "2.3.1",
- "string-replace-loader": "^3.0.0"
+ "string-replace-loader": "^3.0.3"
}
},
"node_modules/@algolia/autocomplete-core": {
@@ -15531,13 +15531,16 @@
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
},
"node_modules/string-replace-loader": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/string-replace-loader/-/string-replace-loader-3.0.2.tgz",
- "integrity": "sha512-MY2VpW7p2V4yLBybj6BcFhmJGU1GjXSDfSz4NrK9BiLK3ttyKXO/WIyOD4UP/b77QUVPG+AKZ7vvpTCNYRAgWg==",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/string-replace-loader/-/string-replace-loader-3.0.3.tgz",
+ "integrity": "sha512-8c26Dl6H9XmKNj3mFBvaUYR7ImOxQ4YRBFuUju78wXpa1cDpyDYvKmqGg8mfkxdYexQ/BBogB7PELlLnmR08nw==",
"dev": true,
"dependencies": {
"loader-utils": "^2.0.0",
"schema-utils": "^3.0.0"
+ },
+ "peerDependencies": {
+ "webpack": "^5"
}
},
"node_modules/string-replace-loader/node_modules/schema-utils": {
@@ -16555,9 +16558,9 @@
"integrity": "sha512-wYxSGajtmoP4WxfejAPIr4l0fVh+jeMXZb08wNc0tMg6xsfZXj3cECqIK0G7ZAqUq0PP8WlMDtaOGVBTAWztNw=="
},
"node_modules/web-tree-sitter": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.17.1.tgz",
- "integrity": "sha512-QgaeV+wmlB1Qaw9rS5a0ZDBt8GRcKkF+hGNSVxQ/HLm1lPCow3BKOhoILaXkYm7YozCcL7TjppRADBwFJugbuA=="
+ "version": "0.19.4",
+ "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.19.4.tgz",
+ "integrity": "sha512-8G0xBj05hqZybCqBtW7RPZ/hWEtP3DiLTauQzGJZuZYfVRgw7qj7iaZ+8djNqJ4VPrdOO+pS2dR1JsTbsLxdYg=="
},
"node_modules/webpack": {
"version": "5.45.1",
@@ -30205,9 +30208,9 @@
}
},
"string-replace-loader": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/string-replace-loader/-/string-replace-loader-3.0.2.tgz",
- "integrity": "sha512-MY2VpW7p2V4yLBybj6BcFhmJGU1GjXSDfSz4NrK9BiLK3ttyKXO/WIyOD4UP/b77QUVPG+AKZ7vvpTCNYRAgWg==",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/string-replace-loader/-/string-replace-loader-3.0.3.tgz",
+ "integrity": "sha512-8c26Dl6H9XmKNj3mFBvaUYR7ImOxQ4YRBFuUju78wXpa1cDpyDYvKmqGg8mfkxdYexQ/BBogB7PELlLnmR08nw==",
"dev": true,
"requires": {
"loader-utils": "^2.0.0",
@@ -31069,9 +31072,9 @@
"integrity": "sha512-wYxSGajtmoP4WxfejAPIr4l0fVh+jeMXZb08wNc0tMg6xsfZXj3cECqIK0G7ZAqUq0PP8WlMDtaOGVBTAWztNw=="
},
"web-tree-sitter": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.17.1.tgz",
- "integrity": "sha512-QgaeV+wmlB1Qaw9rS5a0ZDBt8GRcKkF+hGNSVxQ/HLm1lPCow3BKOhoILaXkYm7YozCcL7TjppRADBwFJugbuA=="
+ "version": "0.19.4",
+ "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.19.4.tgz",
+ "integrity": "sha512-8G0xBj05hqZybCqBtW7RPZ/hWEtP3DiLTauQzGJZuZYfVRgw7qj7iaZ+8djNqJ4VPrdOO+pS2dR1JsTbsLxdYg=="
},
"webpack": {
"version": "5.45.1",
diff --git a/docs/package.json b/docs/package.json
index 94ed951..ff5bb82 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -25,7 +25,7 @@
"react-copy-to-clipboard": "^5.0.3",
"react-dom": "^17.0.2",
"react-toastify": "^7.0.4",
- "web-tree-sitter": "^0.17.1"
+ "web-tree-sitter": "^0.19.4"
},
"browserslist": {
"production": [
@@ -46,6 +46,6 @@
"eslint-plugin-react": "^7.23.2",
"null-loader": "^4.0.0",
"prettier": "2.3.1",
- "string-replace-loader": "^3.0.0"
+ "string-replace-loader": "^3.0.3"
}
}
diff --git a/docs/src/docusaurus-tree-sitter-plugin/index.js b/docs/src/docusaurus-tree-sitter-plugin/index.js
index da9809d..c8a9500 100644
--- a/docs/src/docusaurus-tree-sitter-plugin/index.js
+++ b/docs/src/docusaurus-tree-sitter-plugin/index.js
@@ -11,17 +11,33 @@ module.exports = function () {
loader: "null-loader",
});
} else {
- // web-tree-sitter has a hard-coded path to tree-sitter.wasm,
+ // The way web-tree-sitter loads tree-sitter.wasm isn't something that
+ // Docusaurus/Webpack identify as an asset. There is currently no way to
+ // set location of the file other than patching web-tree-sitter.
// (see https://github.com/tree-sitter/tree-sitter/issues/559)
- // which some browsers treat as absolute and others as relative.
- // This breaks everything. Rewrite it to always use an absolute path.
rules.push({
test: /tree-sitter\.js$/,
loader: "string-replace-loader",
options: {
- search: '"tree-sitter.wasm"',
- replace: '"/tree-sitter.wasm"',
- strict: true,
+ multiple: [
+ // Replace the path to tree-sitter.wasm with a "new URL()" to clue
+ // Webpack in that it is an asset.
+ {
+ search: '"tree-sitter.wasm"',
+ replace: '(new URL("tree-sitter.wasm", import.meta.url)).href',
+ strict: true,
+ },
+ // Webpack replaces "new URL()" with the full URL to the asset, but
+ // web-tree-sitter will still add a prefix to it unless there is a
+ // Module.locateFile() function.
+ {
+ search: "var Module=void 0!==Module?Module:{};",
+ replace: `var Module = {
+ locateFile: (path, prefix) => path.startsWith('http') ? path : prefix + path,
+ };`,
+ strict: true,
+ },
+ ],
},
});
}
diff --git a/docs/static/tree-sitter-devicetree.wasm b/docs/static/tree-sitter-devicetree.wasm
index b0729e4..fbcb0f1 100644
--- a/docs/static/tree-sitter-devicetree.wasm
+++ b/docs/static/tree-sitter-devicetree.wasm
Binary files differ
diff --git a/docs/static/tree-sitter.wasm b/docs/static/tree-sitter.wasm
deleted file mode 100644
index 029b7ca..0000000
--- a/docs/static/tree-sitter.wasm
+++ /dev/null
Binary files differ