Skip to content

Commit 04a0679

Browse files
authored
Stop vendoring web-tree-sitter (#68)
1 parent 1a0ce32 commit 04a0679

File tree

5 files changed

+6
-79
lines changed

5 files changed

+6
-79
lines changed

Makefile

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
# See https://www.npmjs.com/package/web-tree-sitter
33
LANGUAGES = agda bash c c-sharp clojure cpp css elm elixir go haskell html java javascript json julia kotlin latex markdown perl php python query ruby rust scala scss sparql talon tsx typescript yaml
44

5-
6-
# NOTE: Update the version number in the filepath for web-tree-sitter in package.json,
7-
# when you change this version number.
8-
TREE_SITTER_VERSION := 0.20.4
9-
10-
115
# Build web-tree-sitter parsers for $(LANGUAGES)
126

137
.PHONY: parsers
@@ -42,32 +36,3 @@ parsers/tree-sitter-c-sharp.wasm: node_modules/tree-sitter-c-sharp/package.json
4236
mkdir -p $(dir $@)
4337
npx tree-sitter build-wasm $(dir $^)
4438
mv tree-sitter-c_sharp.wasm $@
45-
46-
47-
# Build web-tree-sitter
48-
49-
WEB_TREE_SITTER_FILES := README.md package.json tree-sitter-web.d.ts tree-sitter.js tree-sitter.wasm
50-
WEB_TREE_SITTER_DIR := vendor/web-tree-sitter/$(TREE_SITTER_VERSION)
51-
WEB_TREE_SITTER_PATCH := patches/tree-sitter+$(TREE_SITTER_VERSION).patch
52-
53-
MAKE_CACHE_DIR := .make-work
54-
55-
.PHONY: web-tree-sitter
56-
web-tree-sitter: $(addprefix $(WEB_TREE_SITTER_DIR)/,$(WEB_TREE_SITTER_FILES)) \
57-
58-
$(addprefix $(WEB_TREE_SITTER_DIR)/,$(WEB_TREE_SITTER_FILES)):
59-
@rm -rf $(MAKE_CACHE_DIR)/tree-sitter
60-
@git clone \
61-
-c advice.detachedHead=false --quiet \
62-
--depth=1 --branch=v$(TREE_SITTER_VERSION) \
63-
https://github.com/tree-sitter/tree-sitter.git \
64-
$(MAKE_CACHE_DIR)/tree-sitter
65-
ifneq (,$(wildcard $(WEB_TREE_SITTER_PATCH)))
66-
@(cp $(WEB_TREE_SITTER_PATCH) $(MAKE_CACHE_DIR)/tree-sitter)
67-
@(cd $(MAKE_CACHE_DIR)/tree-sitter && git apply $(notdir $(WEB_TREE_SITTER_PATCH)))
68-
endif
69-
@(cd $(MAKE_CACHE_DIR)/tree-sitter && ./script/build-wasm)
70-
@mkdir -p $(WEB_TREE_SITTER_DIR)
71-
@cp $(MAKE_CACHE_DIR)/tree-sitter/LICENSE $(WEB_TREE_SITTER_DIR)
72-
@cp $(addprefix $(MAKE_CACHE_DIR)/tree-sitter/lib/binding_web/,$(WEB_TREE_SITTER_FILES)) $(WEB_TREE_SITTER_DIR)
73-
@rm -rf $(MAKE_CACHE_DIR)/tree-sitter

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,6 @@ When working with WSL, the host vscode instance connects to a vscode server on t
5959
- If you're adding language support to `vscode-parse-tree`, you need to clone that as well, build it, and link it into the `vscode-server` extension folder: `ln -s ~/your/code/vscode-parse-tree ~/.vscode-server/extensions/parse-tree` for instance.
6060
- If you get errors about needing to install the `Remote-WSL` extension, you might need to manually delete the extension from the host side and try again.
6161

62-
### Updating `web-tree-sitter`
63-
64-
We build a custom version of `web-tree-sitter` to ensure that we can always use the latest version and fix any problems as they come up.
65-
To update `web-tree-sitter`:
66-
67-
1. Update the variable `TREE_SITTER_VERSION` in the [`Makefile`](Makefile#L8);
68-
2. Update the path to `web-tree-sitter` in [`package.json`](package.json#103);
69-
3. (Optional) Create a new patch in `patches/tree-sitter+$TREE_SITTER_VERSION.patch`.
70-
71-
The script which builds our custom version is in the [`Makefile`](Makefile#L37-63).
72-
7362
## Change Log
7463

7564
See [CHANGELOG.md](CHANGELOG.md).

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"vscode:prepublish": "npm run compile",
7171
"compile": "tsc -p ./ && make parsers",
7272
"watch": "tsc -watch -p ./",
73-
"preinstall": "make web-tree-sitter",
7473
"test": "npm run compile && node ./out/test",
7574
"benchmark": "npm run compile && node ./out/benchmark",
7675
"debug": "npm run compile && node --nolazy --inspect-brk=9229 ./out/test",
@@ -126,9 +125,6 @@
126125
"dependencies": {
127126
"jsonc-parser": "^2.1.0",
128127
"tar": ">=4.4.2",
129-
"web-tree-sitter": "file:vendor/web-tree-sitter/0.20.4"
130-
},
131-
"bundledDependencies": [
132-
"web-tree-sitter"
133-
]
128+
"web-tree-sitter": "^0.20.8"
129+
}
134130
}

patches/tree-sitter+0.20.4.patch

Lines changed: 0 additions & 25 deletions
This file was deleted.

yarn.lock

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,8 +2716,10 @@ wcwidth@^1.0.1:
27162716
dependencies:
27172717
defaults "^1.0.3"
27182718

2719-
"web-tree-sitter@file:vendor/web-tree-sitter/0.20.4":
2720-
version "0.20.4"
2719+
web-tree-sitter@^0.20.8:
2720+
version "0.20.8"
2721+
resolved "https://registry.yarnpkg.com/web-tree-sitter/-/web-tree-sitter-0.20.8.tgz#1e371cb577584789cadd75cb49c7ddfbc99d04c8"
2722+
integrity sha512-weOVgZ3aAARgdnb220GqYuh7+rZU0Ka9k9yfKtGAzEYMa6GgiCzW9JjQRJyCJakvibQW+dfjJdihjInKuuCAUQ==
27212723

27222724
webidl-conversions@^3.0.0:
27232725
version "3.0.1"

0 commit comments

Comments
 (0)