@xberg-io/tree-sitter-language-pack 1.11.1 → 1.12.1
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 +30 -1
- package/index.js +76 -115
- package/package.json +10 -10
- package/ts-pack-core-node.darwin-arm64.node +0 -0
- package/ts-pack-core-node.darwin-x64.node +0 -0
- package/ts-pack-core-node.linux-arm64-gnu.node +0 -0
- package/ts-pack-core-node.linux-x64-gnu.node +0 -0
- package/ts-pack-core-node.win32-arm64-msvc.node +0 -0
- package/ts-pack-core-node.win32-x64-msvc.node +0 -0
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:68133ddb5b8efbe7e41070f6721a242527361da4659243e43afbbacd5396eb50
|
|
3
3
|
// To regenerate: alef generate
|
|
4
4
|
// To verify freshness: alef verify --exit-code
|
|
5
5
|
/* eslint-disable */
|
|
@@ -152,6 +152,14 @@ export declare function downloadedLanguages(): Array<string>;
|
|
|
152
152
|
*/
|
|
153
153
|
export declare function downloadGroup(name: string): number;
|
|
154
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Get the folds query for a language, if bundled.
|
|
157
|
+
*
|
|
158
|
+
* Returns the contents of `folds.scm` (used for code folding) as a static string,
|
|
159
|
+
* or `None` if no folds query is bundled for this language.
|
|
160
|
+
*/
|
|
161
|
+
export declare function getFoldsQuery(language: string): string | null;
|
|
162
|
+
|
|
155
163
|
/**
|
|
156
164
|
* Get the highlights query for a language, if bundled.
|
|
157
165
|
*
|
|
@@ -160,6 +168,14 @@ export declare function downloadGroup(name: string): number;
|
|
|
160
168
|
*/
|
|
161
169
|
export declare function getHighlightsQuery(language: string): string | null;
|
|
162
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Get the indents query for a language, if bundled.
|
|
173
|
+
*
|
|
174
|
+
* Returns the contents of `indents.scm` (used for auto-indentation) as a static
|
|
175
|
+
* string, or `None` if no indents query is bundled for this language.
|
|
176
|
+
*/
|
|
177
|
+
export declare function getIndentsQuery(language: string): string | null;
|
|
178
|
+
|
|
163
179
|
/**
|
|
164
180
|
* Get the injections query for a language, if bundled.
|
|
165
181
|
*
|
|
@@ -1014,6 +1030,19 @@ export declare function languageCount(): number;
|
|
|
1014
1030
|
*/
|
|
1015
1031
|
export declare function manifestLanguages(): Array<string>;
|
|
1016
1032
|
|
|
1033
|
+
/**
|
|
1034
|
+
* Prefetch grammars: download any not already loadable from disk, then load every
|
|
1035
|
+
* requested language into the process registry so a subsequent hot loop only parses.
|
|
1036
|
+
*
|
|
1037
|
+
* Unlike [`download()`], this does not trust in-memory availability — it downloads
|
|
1038
|
+
* whenever a grammar is not actually loadable from disk (fixing the case where a
|
|
1039
|
+
* known-but-not-downloaded grammar is reported present), then resolves and caches
|
|
1040
|
+
* every requested language. Call it once, up front, before a parallel workload.
|
|
1041
|
+
* @throws Returns [`Error::Download`] if a required grammar cannot be fetched, or
|
|
1042
|
+
* [`Error::LanguageNotFound`] if a requested name is unknown.
|
|
1043
|
+
*/
|
|
1044
|
+
export declare function prefetch(languages: Array<string>): void;
|
|
1045
|
+
|
|
1017
1046
|
/**
|
|
1018
1047
|
* Process source code and extract file intelligence using the global registry.
|
|
1019
1048
|
*
|
package/index.js
CHANGED
|
@@ -3,139 +3,100 @@
|
|
|
3
3
|
const { platform, arch } = process;
|
|
4
4
|
const isWindows = platform === "win32";
|
|
5
5
|
const isMusl = () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
// Prefer the report-header `glibcVersion` string when present — fastest and
|
|
7
|
+
// unambiguous on Node builds that populate it. On Node 22+, certain CI
|
|
8
|
+
// environments leave `glibcVersion` undefined even on glibc systems, so the
|
|
9
|
+
// `=== undefined` branch from older napi-rs templates produces a false
|
|
10
|
+
// "is musl" positive. Fall through to the filesystem heuristic instead: on
|
|
11
|
+
// glibc systems `/lib64/ld-musl-x86_64.so.1` does not exist; on musl systems
|
|
12
|
+
// it always does. statSync errors → not musl.
|
|
13
|
+
if (
|
|
14
|
+
typeof process.report === "object" &&
|
|
15
|
+
typeof process.report.getReport === "function"
|
|
16
|
+
) {
|
|
17
|
+
const report = process.report.getReport();
|
|
18
|
+
if (
|
|
19
|
+
report &&
|
|
20
|
+
report.header &&
|
|
21
|
+
typeof report.header.glibcVersion === "string"
|
|
22
|
+
) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
require("fs").statSync("/lib64/ld-musl-x86_64.so.1");
|
|
28
|
+
return true;
|
|
29
|
+
} catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
25
32
|
};
|
|
26
33
|
|
|
27
34
|
let nativeBinding = null;
|
|
28
35
|
const loadErrors = [];
|
|
29
36
|
|
|
30
37
|
function requireOptionalDependency(name) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
try {
|
|
39
|
+
return require(name);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
loadErrors.push(`Optional dependency ${name}: ${e.message}`);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
const tryLoadBinding = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"arm64",
|
|
54
|
-
"gnu",
|
|
55
|
-
"./ts-pack-core-node.linux-arm64-gnu.node",
|
|
56
|
-
"@xberg-io/tree-sitter-language-pack-linux-arm64-gnu",
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
"linux",
|
|
60
|
-
"x64",
|
|
61
|
-
"musl",
|
|
62
|
-
"./ts-pack-core-node.linux-x64-musl.node",
|
|
63
|
-
"@xberg-io/tree-sitter-language-pack-linux-x64-musl",
|
|
64
|
-
],
|
|
65
|
-
[
|
|
66
|
-
"linux",
|
|
67
|
-
"arm64",
|
|
68
|
-
"musl",
|
|
69
|
-
"./ts-pack-core-node.linux-arm64-musl.node",
|
|
70
|
-
"@xberg-io/tree-sitter-language-pack-linux-arm64-musl",
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
"darwin",
|
|
74
|
-
"x64",
|
|
75
|
-
null,
|
|
76
|
-
"./ts-pack-core-node.darwin-x64.node",
|
|
77
|
-
"@xberg-io/tree-sitter-language-pack-darwin-x64",
|
|
78
|
-
],
|
|
79
|
-
[
|
|
80
|
-
"darwin",
|
|
81
|
-
"arm64",
|
|
82
|
-
null,
|
|
83
|
-
"./ts-pack-core-node.darwin-arm64.node",
|
|
84
|
-
"@xberg-io/tree-sitter-language-pack-darwin-arm64",
|
|
85
|
-
],
|
|
86
|
-
[
|
|
87
|
-
"win32",
|
|
88
|
-
"x64",
|
|
89
|
-
null,
|
|
90
|
-
"./ts-pack-core-node.win32-x64-msvc.node",
|
|
91
|
-
"@xberg-io/tree-sitter-language-pack-win32-x64-msvc",
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
"win32",
|
|
95
|
-
"arm64",
|
|
96
|
-
null,
|
|
97
|
-
"./ts-pack-core-node.win32-arm64-msvc.node",
|
|
98
|
-
"@xberg-io/tree-sitter-language-pack-win32-arm64-msvc",
|
|
99
|
-
],
|
|
100
|
-
];
|
|
47
|
+
// Local `.node` files are named after `napi.binaryName` (binary file name on disk).
|
|
48
|
+
// Optional-dep packages are named after `napi.packageName` (npm subpackage names),
|
|
49
|
+
// which inherits any scope prefix from the parent package.
|
|
50
|
+
const targets = [
|
|
51
|
+
["linux", "x64", "gnu", "./ts-pack-core-node.linux-x64-gnu.node", "@xberg-io/tree-sitter-language-pack-linux-x64-gnu"],
|
|
52
|
+
["linux", "arm64", "gnu", "./ts-pack-core-node.linux-arm64-gnu.node", "@xberg-io/tree-sitter-language-pack-linux-arm64-gnu"],
|
|
53
|
+
["linux", "x64", "musl", "./ts-pack-core-node.linux-x64-musl.node", "@xberg-io/tree-sitter-language-pack-linux-x64-musl"],
|
|
54
|
+
["linux", "arm64", "musl", "./ts-pack-core-node.linux-arm64-musl.node", "@xberg-io/tree-sitter-language-pack-linux-arm64-musl"],
|
|
55
|
+
["darwin", "x64", null, "./ts-pack-core-node.darwin-x64.node", "@xberg-io/tree-sitter-language-pack-darwin-x64"],
|
|
56
|
+
["darwin", "arm64", null, "./ts-pack-core-node.darwin-arm64.node", "@xberg-io/tree-sitter-language-pack-darwin-arm64"],
|
|
57
|
+
["win32", "x64", null, "./ts-pack-core-node.win32-x64-msvc.node", "@xberg-io/tree-sitter-language-pack-win32-x64-msvc"],
|
|
58
|
+
["win32", "arm64", null, "./ts-pack-core-node.win32-arm64-msvc.node", "@xberg-io/tree-sitter-language-pack-win32-arm64-msvc"],
|
|
59
|
+
];
|
|
101
60
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
61
|
+
for (const [plat, a, abi, localPath, optionalDep] of targets) {
|
|
62
|
+
if (platform !== plat || arch !== a) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
106
65
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
66
|
+
if (plat === "linux" && abi) {
|
|
67
|
+
const isCurMusl = isMusl();
|
|
68
|
+
if ((abi === "musl") !== isCurMusl) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
113
72
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
73
|
+
try {
|
|
74
|
+
nativeBinding = require(localPath);
|
|
75
|
+
if (nativeBinding) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
} catch (e) {
|
|
79
|
+
loadErrors.push(e.message);
|
|
80
|
+
}
|
|
122
81
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
82
|
+
try {
|
|
83
|
+
const optBinding = requireOptionalDependency(optionalDep);
|
|
84
|
+
if (optBinding) {
|
|
85
|
+
nativeBinding = optBinding;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
loadErrors.push(e.message);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
133
92
|
};
|
|
134
93
|
|
|
135
94
|
tryLoadBinding();
|
|
136
95
|
|
|
137
96
|
if (!nativeBinding) {
|
|
138
|
-
|
|
97
|
+
throw new Error(
|
|
98
|
+
`Failed to load native binding for ${platform}-${arch}. Errors: ${loadErrors.join(", ")}`
|
|
99
|
+
);
|
|
139
100
|
}
|
|
140
101
|
|
|
141
102
|
module.exports = nativeBinding;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xberg-io/tree-sitter-language-pack",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "Pre-compiled tree-sitter grammars for 306 programming languages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"prepublishOnly": "npx --yes -p @napi-rs/cli@^3.6.2 napi prepublish -t npm --skip-optional-publish"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@napi-rs/cli": "^3.
|
|
33
|
+
"@napi-rs/cli": "^3.7.2"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@xberg-io/tree-sitter-language-pack-darwin-arm64": "1.
|
|
37
|
-
"@xberg-io/tree-sitter-language-pack-darwin-x64": "1.
|
|
38
|
-
"@xberg-io/tree-sitter-language-pack-linux-arm64-gnu": "1.
|
|
39
|
-
"@xberg-io/tree-sitter-language-pack-linux-arm64-musl": "1.
|
|
40
|
-
"@xberg-io/tree-sitter-language-pack-linux-x64-gnu": "1.
|
|
41
|
-
"@xberg-io/tree-sitter-language-pack-linux-x64-musl": "1.
|
|
42
|
-
"@xberg-io/tree-sitter-language-pack-win32-arm64-msvc": "1.
|
|
43
|
-
"@xberg-io/tree-sitter-language-pack-win32-x64-msvc": "1.
|
|
36
|
+
"@xberg-io/tree-sitter-language-pack-darwin-arm64": "1.12.1",
|
|
37
|
+
"@xberg-io/tree-sitter-language-pack-darwin-x64": "1.12.1",
|
|
38
|
+
"@xberg-io/tree-sitter-language-pack-linux-arm64-gnu": "1.12.1",
|
|
39
|
+
"@xberg-io/tree-sitter-language-pack-linux-arm64-musl": "1.12.1",
|
|
40
|
+
"@xberg-io/tree-sitter-language-pack-linux-x64-gnu": "1.12.1",
|
|
41
|
+
"@xberg-io/tree-sitter-language-pack-linux-x64-musl": "1.12.1",
|
|
42
|
+
"@xberg-io/tree-sitter-language-pack-win32-arm64-msvc": "1.12.1",
|
|
43
|
+
"@xberg-io/tree-sitter-language-pack-win32-x64-msvc": "1.12.1"
|
|
44
44
|
},
|
|
45
45
|
"napi": {
|
|
46
46
|
"binaryName": "ts-pack-core-node",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|