@vscode/tree-sitter-wasm 0.1.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +12 -14
- package/wasm/tree-sitter-bash.wasm +0 -0
- package/wasm/tree-sitter-c-sharp.wasm +0 -0
- package/wasm/tree-sitter-cpp.wasm +0 -0
- package/wasm/tree-sitter-css.wasm +0 -0
- package/wasm/tree-sitter-go.wasm +0 -0
- package/wasm/tree-sitter-ini.wasm +0 -0
- package/wasm/tree-sitter-java.wasm +0 -0
- package/wasm/tree-sitter-javascript.wasm +0 -0
- package/wasm/tree-sitter-php.wasm +0 -0
- package/wasm/tree-sitter-powershell.wasm +0 -0
- package/wasm/tree-sitter-python.wasm +0 -0
- package/wasm/tree-sitter-regex.wasm +0 -0
- package/wasm/tree-sitter-ruby.wasm +0 -0
- package/wasm/tree-sitter-rust.wasm +0 -0
- package/wasm/tree-sitter-tsx.wasm +0 -0
- package/wasm/tree-sitter-typescript.wasm +0 -0
- package/wasm/tree-sitter.js +26 -25
- package/wasm/tree-sitter.wasm +0 -0
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio
|
|
|
20
20
|
|
|
21
21
|
> Note: If you're using Windows, you'll need to use WSL. Ensure Docker integration for WSL is enabled before attempting to build. Without this integration, the build process may encounter errors.
|
|
22
22
|
|
|
23
|
-
First, install all of the dependencies using `npm install
|
|
23
|
+
First, install all of the dependencies using `npm install`, use the `--force` flag if needed. You will also need to install [emscripten](https://emscripten.org/docs/getting_started/downloads.html).
|
|
24
24
|
|
|
25
25
|
Then, build the the wasm files using `npm run build-wasm`, which will do the following:
|
|
26
26
|
- Clone the tree-sitter repository
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/tree-sitter-wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Pre-built WASM files for Tree-Sitter and Tree-Sitter languages that VS Code uses",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build-wasm": "ts-node ./build/main.ts",
|
|
@@ -19,19 +19,17 @@
|
|
|
19
19
|
"types": "wasm/web-tree-sitter.d.ts",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.14.6",
|
|
22
|
-
"tree-sitter-
|
|
23
|
-
"tree-sitter-
|
|
24
|
-
"tree-sitter-
|
|
25
|
-
"tree-sitter-
|
|
26
|
-
"tree-sitter-
|
|
27
|
-
"tree-sitter-
|
|
28
|
-
"tree-sitter-
|
|
29
|
-
"tree-sitter-python": "^0.
|
|
30
|
-
"tree-sitter-regex": "^0.
|
|
31
|
-
"tree-sitter-ruby": "^0.23.
|
|
32
|
-
"tree-sitter-
|
|
33
|
-
"tree-sitter-typescript": "^0.23.0",
|
|
34
|
-
"tree-sitter-php": "0.23.4",
|
|
22
|
+
"tree-sitter-bash": "^0.25.0",
|
|
23
|
+
"tree-sitter-cli": "^0.25.10",
|
|
24
|
+
"tree-sitter-css": "^0.25.0",
|
|
25
|
+
"tree-sitter-go": "^0.25.0",
|
|
26
|
+
"tree-sitter-java": "^0.23.5",
|
|
27
|
+
"tree-sitter-javascript": "^0.25.0",
|
|
28
|
+
"tree-sitter-php": "0.24.2",
|
|
29
|
+
"tree-sitter-python": "^0.25.0",
|
|
30
|
+
"tree-sitter-regex": "^0.25.0",
|
|
31
|
+
"tree-sitter-ruby": "^0.23.1",
|
|
32
|
+
"tree-sitter-typescript": "^0.23.2",
|
|
35
33
|
"ts-node": "^10.9.2"
|
|
36
34
|
},
|
|
37
35
|
"repository": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/wasm/tree-sitter-go.wasm
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/wasm/tree-sitter.js
CHANGED
|
@@ -22,12 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
var __defProp = Object.defineProperty;
|
|
24
24
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
25
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
26
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
27
|
-
}) : x)(function(x) {
|
|
28
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
29
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
30
|
-
});
|
|
31
25
|
|
|
32
26
|
// src/constants.ts
|
|
33
27
|
var SIZE_OF_SHORT = 2;
|
|
@@ -255,17 +249,21 @@ var TreeCursor = class _TreeCursor {
|
|
|
255
249
|
__name(this, "TreeCursor");
|
|
256
250
|
}
|
|
257
251
|
/** @internal */
|
|
252
|
+
// @ts-expect-error: never read
|
|
258
253
|
[0] = 0;
|
|
259
|
-
// Internal handle for
|
|
254
|
+
// Internal handle for Wasm
|
|
260
255
|
/** @internal */
|
|
256
|
+
// @ts-expect-error: never read
|
|
261
257
|
[1] = 0;
|
|
262
|
-
// Internal handle for
|
|
258
|
+
// Internal handle for Wasm
|
|
263
259
|
/** @internal */
|
|
260
|
+
// @ts-expect-error: never read
|
|
264
261
|
[2] = 0;
|
|
265
|
-
// Internal handle for
|
|
262
|
+
// Internal handle for Wasm
|
|
266
263
|
/** @internal */
|
|
264
|
+
// @ts-expect-error: never read
|
|
267
265
|
[3] = 0;
|
|
268
|
-
// Internal handle for
|
|
266
|
+
// Internal handle for Wasm
|
|
269
267
|
/** @internal */
|
|
270
268
|
tree;
|
|
271
269
|
/** @internal */
|
|
@@ -538,8 +536,9 @@ var Node = class {
|
|
|
538
536
|
__name(this, "Node");
|
|
539
537
|
}
|
|
540
538
|
/** @internal */
|
|
539
|
+
// @ts-expect-error: never read
|
|
541
540
|
[0] = 0;
|
|
542
|
-
// Internal handle for
|
|
541
|
+
// Internal handle for Wasm
|
|
543
542
|
/** @internal */
|
|
544
543
|
_children;
|
|
545
544
|
/** @internal */
|
|
@@ -888,6 +887,11 @@ var Node = class {
|
|
|
888
887
|
if (!Array.isArray(types)) types = [types];
|
|
889
888
|
const symbols = [];
|
|
890
889
|
const typesBySymbol = this.tree.language.types;
|
|
890
|
+
for (const node_type of types) {
|
|
891
|
+
if (node_type == "ERROR") {
|
|
892
|
+
symbols.push(65535);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
891
895
|
for (let i2 = 0, n = typesBySymbol.length; i2 < n; i2++) {
|
|
892
896
|
if (types.includes(typesBySymbol[i2])) {
|
|
893
897
|
symbols.push(i2);
|
|
@@ -974,7 +978,7 @@ var Node = class {
|
|
|
974
978
|
*/
|
|
975
979
|
childWithDescendant(descendant) {
|
|
976
980
|
marshalNode(this);
|
|
977
|
-
marshalNode(descendant);
|
|
981
|
+
marshalNode(descendant, 1);
|
|
978
982
|
C._ts_node_child_with_descendant_wasm(this.tree[0]);
|
|
979
983
|
return unmarshalNode(this.tree);
|
|
980
984
|
}
|
|
@@ -1095,8 +1099,8 @@ function unmarshalCaptures(query, tree, address, patternIndex, result) {
|
|
|
1095
1099
|
return address;
|
|
1096
1100
|
}
|
|
1097
1101
|
__name(unmarshalCaptures, "unmarshalCaptures");
|
|
1098
|
-
function marshalNode(node) {
|
|
1099
|
-
let address = TRANSFER_BUFFER;
|
|
1102
|
+
function marshalNode(node, index = 0) {
|
|
1103
|
+
let address = TRANSFER_BUFFER + index * SIZE_OF_NODE;
|
|
1100
1104
|
C.setValue(address, node.id, "i32");
|
|
1101
1105
|
address += SIZE_OF_INT;
|
|
1102
1106
|
C.setValue(address, node.startIndex, "i32");
|
|
@@ -1195,13 +1199,10 @@ function marshalEdit(edit, address = TRANSFER_BUFFER) {
|
|
|
1195
1199
|
}
|
|
1196
1200
|
__name(marshalEdit, "marshalEdit");
|
|
1197
1201
|
function unmarshalLanguageMetadata(address) {
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
-
address += SIZE_OF_INT;
|
|
1201
|
-
|
|
1202
|
-
address += SIZE_OF_INT;
|
|
1203
|
-
result.field_count = C.getValue(address, "i32");
|
|
1204
|
-
return result;
|
|
1202
|
+
const major_version = C.getValue(address, "i32");
|
|
1203
|
+
const minor_version = C.getValue(address += SIZE_OF_INT, "i32");
|
|
1204
|
+
const patch_version = C.getValue(address += SIZE_OF_INT, "i32");
|
|
1205
|
+
return { major_version, minor_version, patch_version };
|
|
1205
1206
|
}
|
|
1206
1207
|
__name(unmarshalLanguageMetadata, "unmarshalLanguageMetadata");
|
|
1207
1208
|
|
|
@@ -2052,7 +2053,7 @@ var Language = class _Language {
|
|
|
2052
2053
|
bytes = Promise.resolve(input);
|
|
2053
2054
|
} else {
|
|
2054
2055
|
if (globalThis.process?.versions.node) {
|
|
2055
|
-
const fs2 =
|
|
2056
|
+
const fs2 = await import("fs/promises");
|
|
2056
2057
|
bytes = fs2.readFile(input);
|
|
2057
2058
|
} else {
|
|
2058
2059
|
bytes = fetch(input).then((response) => response.arrayBuffer().then((buffer) => {
|
|
@@ -2692,7 +2693,7 @@ var Module2 = (() => {
|
|
|
2692
2693
|
newDSO("__main__", 0, wasmImports);
|
|
2693
2694
|
}
|
|
2694
2695
|
};
|
|
2695
|
-
var ___heap_base =
|
|
2696
|
+
var ___heap_base = 78240;
|
|
2696
2697
|
var zeroMemory = /* @__PURE__ */ __name((address, size) => {
|
|
2697
2698
|
HEAPU8.fill(0, address, address + size);
|
|
2698
2699
|
return address;
|
|
@@ -3301,7 +3302,7 @@ var Module2 = (() => {
|
|
|
3301
3302
|
var ___stack_pointer = new WebAssembly.Global({
|
|
3302
3303
|
"value": "i32",
|
|
3303
3304
|
"mutable": true
|
|
3304
|
-
},
|
|
3305
|
+
}, 78240);
|
|
3305
3306
|
var ___table_base = new WebAssembly.Global({
|
|
3306
3307
|
"value": "i32",
|
|
3307
3308
|
"mutable": false
|
|
@@ -3590,6 +3591,7 @@ var Module2 = (() => {
|
|
|
3590
3591
|
var _calloc = Module["_calloc"] = (a0, a1) => (_calloc = Module["_calloc"] = wasmExports["calloc"])(a0, a1);
|
|
3591
3592
|
var _realloc = Module["_realloc"] = (a0, a1) => (_realloc = Module["_realloc"] = wasmExports["realloc"])(a0, a1);
|
|
3592
3593
|
var _free = Module["_free"] = (a0) => (_free = Module["_free"] = wasmExports["free"])(a0);
|
|
3594
|
+
var _memcmp = Module["_memcmp"] = (a0, a1, a2) => (_memcmp = Module["_memcmp"] = wasmExports["memcmp"])(a0, a1, a2);
|
|
3593
3595
|
var _ts_language_symbol_count = Module["_ts_language_symbol_count"] = (a0) => (_ts_language_symbol_count = Module["_ts_language_symbol_count"] = wasmExports["ts_language_symbol_count"])(a0);
|
|
3594
3596
|
var _ts_language_state_count = Module["_ts_language_state_count"] = (a0) => (_ts_language_state_count = Module["_ts_language_state_count"] = wasmExports["ts_language_state_count"])(a0);
|
|
3595
3597
|
var _ts_language_version = Module["_ts_language_version"] = (a0) => (_ts_language_version = Module["_ts_language_version"] = wasmExports["ts_language_version"])(a0);
|
|
@@ -3618,7 +3620,6 @@ var Module2 = (() => {
|
|
|
3618
3620
|
var _ts_parser_set_timeout_micros = Module["_ts_parser_set_timeout_micros"] = (a0, a1, a2) => (_ts_parser_set_timeout_micros = Module["_ts_parser_set_timeout_micros"] = wasmExports["ts_parser_set_timeout_micros"])(a0, a1, a2);
|
|
3619
3621
|
var _ts_parser_set_included_ranges = Module["_ts_parser_set_included_ranges"] = (a0, a1, a2) => (_ts_parser_set_included_ranges = Module["_ts_parser_set_included_ranges"] = wasmExports["ts_parser_set_included_ranges"])(a0, a1, a2);
|
|
3620
3622
|
var _memmove = Module["_memmove"] = (a0, a1, a2) => (_memmove = Module["_memmove"] = wasmExports["memmove"])(a0, a1, a2);
|
|
3621
|
-
var _memcmp = Module["_memcmp"] = (a0, a1, a2) => (_memcmp = Module["_memcmp"] = wasmExports["memcmp"])(a0, a1, a2);
|
|
3622
3623
|
var _ts_query_new = Module["_ts_query_new"] = (a0, a1, a2, a3, a4) => (_ts_query_new = Module["_ts_query_new"] = wasmExports["ts_query_new"])(a0, a1, a2, a3, a4);
|
|
3623
3624
|
var _ts_query_delete = Module["_ts_query_delete"] = (a0) => (_ts_query_delete = Module["_ts_query_delete"] = wasmExports["ts_query_delete"])(a0);
|
|
3624
3625
|
var _iswspace = Module["_iswspace"] = (a0) => (_iswspace = Module["_iswspace"] = wasmExports["iswspace"])(a0);
|
package/wasm/tree-sitter.wasm
CHANGED
|
Binary file
|