@ast-grep/lang-javascript 0.0.3 → 0.0.4
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.js
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
const path = require('node:path')
|
|
2
|
-
const
|
|
2
|
+
const fs = require('node:fs')
|
|
3
|
+
const { resolvePrebuild } = require('@ast-grep/setup-lang')
|
|
4
|
+
|
|
5
|
+
function getLibPath() {
|
|
6
|
+
const prebuild = resolvePrebuild(__dirname)
|
|
7
|
+
if (prebuild) {
|
|
8
|
+
return prebuild
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const native = path.join(__dirname, 'parser.so')
|
|
12
|
+
if (fs.existsSync(native)) {
|
|
13
|
+
return native
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
throw new Error('No parser found. Please ensure the parser is built or a prebuild is available.')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let libPath
|
|
3
20
|
|
|
4
21
|
module.exports = {
|
|
5
|
-
libraryPath
|
|
22
|
+
get libraryPath() {
|
|
23
|
+
if (!libPath) {
|
|
24
|
+
libPath = getLibPath()
|
|
25
|
+
}
|
|
26
|
+
return libPath
|
|
27
|
+
},
|
|
6
28
|
extensions: ['cjs', 'js', 'mjs', 'jsx'],
|
|
7
29
|
languageSymbol: 'tree_sitter_javascript',
|
|
8
30
|
expandoChar: '$',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ast-grep/lang-javascript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"author": "",
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@ast-grep/setup-lang": "0.0.
|
|
21
|
+
"@ast-grep/setup-lang": "0.0.4"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"tree-sitter-cli": "0.25.
|
|
24
|
+
"tree-sitter-cli": "0.25.8"
|
|
25
25
|
},
|
|
26
26
|
"peerDependenciesMeta": {
|
|
27
27
|
"tree-sitter-cli": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ast-grep/nursery": "0.0.
|
|
33
|
-
"tree-sitter-cli": "0.25.
|
|
32
|
+
"@ast-grep/nursery": "0.0.7",
|
|
33
|
+
"tree-sitter-cli": "0.25.8",
|
|
34
34
|
"tree-sitter-javascript": "0.23.1"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
Binary file
|
|
Binary file
|