@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 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 module "web-tree-sitter-cpp" {
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
- 'use strict';
2
-
3
- const Parser = require("web-tree-sitter");
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
- return getParser(__dirname + "/tree-sitter-cpp.wasm");
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 Parser.Language.load(data);
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
- module.exports = {
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.7",
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": "ISC",
23
+ "license": "MIT",
23
24
  "dependencies": {
24
- "web-tree-sitter": "^0.24.5"
25
+ "web-tree-sitter": "^0.26.8"
25
26
  }
26
27
  }
File without changes