@ast-grep/create-lang 0.0.5 → 0.0.8
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 +3 -3
- package/package.json +2 -2
- package/template/index.js +24 -2
- package/template/package.json +4 -4
package/index.js
CHANGED
|
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const prompts_1 = __importDefault(require("prompts"));
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
6
|
const node_child_process_1 = require("node:child_process");
|
|
7
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
10
10
|
function required(s) {
|
|
11
11
|
if (s.length === 0) {
|
|
12
12
|
return 'This value is required';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ast-grep/create-lang",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"registry": "https://registry.npmjs.org/"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/node": "22.
|
|
29
|
+
"@types/node": "22.19.5",
|
|
30
30
|
"@types/prompts": "^2.4.9",
|
|
31
31
|
"typescript": "^5.7.3"
|
|
32
32
|
},
|
package/template/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: $$EXTENSIONS$$,
|
|
7
29
|
languageSymbol: 'tree_sitter_$$NAME$$',
|
|
8
30
|
expandoChar: '$$EXPANDO_CHAR$$',
|
package/template/package.json
CHANGED
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "ISC",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ast-grep/setup-lang": "0.0.
|
|
25
|
+
"@ast-grep/setup-lang": "0.0.5"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"tree-sitter-cli": "0.25.
|
|
28
|
+
"tree-sitter-cli": "0.25.8"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"tree-sitter-cli": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@ast-grep/nursery": "0.0.
|
|
37
|
-
"tree-sitter-cli": "0.25.
|
|
36
|
+
"@ast-grep/nursery": "0.0.8",
|
|
37
|
+
"tree-sitter-cli": "0.25.8"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public",
|