@xsrg2008/web-tree-sitter-cpp 0.0.7 → 0.1.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/index.d.ts +3 -5
- package/index.js +9 -10
- package/package.json +4 -3
- package/tree-sitter-cpp.wasm +0 -0
package/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Parser } from "web-tree-sitter";
|
|
1
|
+
import type { Parser } from "web-tree-sitter";
|
|
2
|
+
export type { Parser };
|
|
2
3
|
|
|
3
|
-
declare
|
|
4
|
-
function getCppParser(): Promise<Parser>;
|
|
5
|
-
}
|
|
6
|
-
export { Parser, getCppParser };
|
|
4
|
+
export declare function getCppParser(): Promise<Parser>;
|
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const fs = require("fs");
|
|
1
|
+
import { Parser } from 'web-tree-sitter';
|
|
2
|
+
import { Language } from 'web-tree-sitter';
|
|
3
|
+
import fs from "fs";
|
|
5
4
|
|
|
6
5
|
function getCppParser() {
|
|
7
|
-
|
|
6
|
+
const wasmPath = new URL("./tree-sitter-cpp.wasm", import.meta.url);
|
|
7
|
+
return getParser(wasmPath);
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* @param {string} wasmLangFile
|
|
10
|
+
* @param {string | URL} wasmLangFile
|
|
11
11
|
* @returns {Promise<Parser>}
|
|
12
12
|
*/
|
|
13
13
|
async function getParser(wasmLangFile) {
|
|
@@ -19,7 +19,7 @@ async function getParser(wasmLangFile) {
|
|
|
19
19
|
reject(err);
|
|
20
20
|
}
|
|
21
21
|
try {
|
|
22
|
-
const lang = await
|
|
22
|
+
const lang = await Language.load(data);
|
|
23
23
|
parser.setLanguage(lang);
|
|
24
24
|
resolve(parser);
|
|
25
25
|
} catch (err2) {
|
|
@@ -29,7 +29,6 @@ async function getParser(wasmLangFile) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
Parser,
|
|
32
|
+
export {
|
|
34
33
|
getCppParser,
|
|
35
|
-
};
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsrg2008/web-tree-sitter-cpp",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "tree-sitter-cpp WASM",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
9
|
},
|
|
10
|
+
"type": "module",
|
|
10
11
|
"files": [
|
|
11
12
|
"index.js",
|
|
12
13
|
"index.d.ts",
|
|
@@ -19,8 +20,8 @@
|
|
|
19
20
|
"wasm"
|
|
20
21
|
],
|
|
21
22
|
"author": "xsrg2008",
|
|
22
|
-
"license": "
|
|
23
|
+
"license": "MIT",
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"web-tree-sitter": "^0.
|
|
25
|
+
"web-tree-sitter": "^0.26.8"
|
|
25
26
|
}
|
|
26
27
|
}
|
package/tree-sitter-cpp.wasm
CHANGED
|
File without changes
|