@kreuzberg/tree-sitter-language-pack 1.9.1 → 1.10.2
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/README.md +1 -7
- package/index.d.ts +2 -3
- package/index.js +115 -76
- package/package.json +9 -9
- 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/README.md
CHANGED
|
@@ -78,12 +78,6 @@
|
|
|
78
78
|
</a>
|
|
79
79
|
</div>
|
|
80
80
|
|
|
81
|
-
<div align="center" style="margin: 24px 0 0">
|
|
82
|
-
<a href="https://kreuzberg.dev">
|
|
83
|
-
<img alt="tree-sitter-language-pack" src="https://github.com/user-attachments/assets/478a83da-237b-446b-b3a8-e564c13e00a8" />
|
|
84
|
-
</a>
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
81
|
<div align="center" style="display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 28px 0 24px">
|
|
88
82
|
<a href="https://discord.gg/xt9WY3GnKR">
|
|
89
83
|
<img
|
|
@@ -126,7 +120,7 @@ console.log(tree.rootNode.toString());
|
|
|
126
120
|
- **On-demand download + cache** — parsers fetched at first use; subsequent runs hit the local cache.
|
|
127
121
|
- **Code intelligence** — extract functions, classes, imports, exports, symbols, docstrings, and diagnostics with one API.
|
|
128
122
|
- **Syntax-aware chunking** — semantic chunks for RAG/LLM pipelines.
|
|
129
|
-
- **Polyglot bindings** —
|
|
123
|
+
- **Polyglot bindings** — native APIs across 15 languages: Rust, Python, TypeScript/Node.js, Go, Java, C#, Ruby, PHP, Elixir, WebAssembly, Dart, Kotlin, Swift, Zig, and C/C++ via [alef](https://github.com/kreuzberg-dev/alef).
|
|
130
124
|
|
|
131
125
|
## Documentation
|
|
132
126
|
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:6125571a3e8d71b1bf26c8a105b8f42f97acba36088cabe6d2ac4064fef4370d
|
|
3
3
|
// To regenerate: alef generate
|
|
4
4
|
// To verify freshness: alef verify --exit-code
|
|
5
5
|
/* eslint-disable */
|
|
6
|
+
import type { Language } from "tree-sitter";
|
|
6
7
|
|
|
7
8
|
export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
|
|
8
9
|
|
|
@@ -545,8 +546,6 @@ export interface ImportInfo {
|
|
|
545
546
|
readonly span?: Span;
|
|
546
547
|
}
|
|
547
548
|
|
|
548
|
-
export declare class Language {}
|
|
549
|
-
|
|
550
549
|
/**
|
|
551
550
|
* Thread-safe registry of tree-sitter language parsers.
|
|
552
551
|
*
|
package/index.js
CHANGED
|
@@ -3,100 +3,139 @@
|
|
|
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
|
-
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
require("fs").statSync("/lib64/ld-musl-x86_64.so.1");
|
|
28
|
-
return true;
|
|
29
|
-
} catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
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 (typeof process.report === "object" && typeof process.report.getReport === "function") {
|
|
14
|
+
const report = process.report.getReport();
|
|
15
|
+
if (report && report.header && typeof report.header.glibcVersion === "string") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
require("fs").statSync("/lib64/ld-musl-x86_64.so.1");
|
|
21
|
+
return true;
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
32
25
|
};
|
|
33
26
|
|
|
34
27
|
let nativeBinding = null;
|
|
35
28
|
const loadErrors = [];
|
|
36
29
|
|
|
37
30
|
function requireOptionalDependency(name) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
try {
|
|
32
|
+
return require(name);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
loadErrors.push(`Optional dependency ${name}: ${e.message}`);
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
44
37
|
}
|
|
45
38
|
|
|
46
39
|
const tryLoadBinding = () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
// Local `.node` files are named after `napi.binaryName` (binary file name on disk).
|
|
41
|
+
// Optional-dep packages are named after `napi.packageName` (npm subpackage names),
|
|
42
|
+
// which inherits any scope prefix from the parent package.
|
|
43
|
+
const targets = [
|
|
44
|
+
[
|
|
45
|
+
"linux",
|
|
46
|
+
"x64",
|
|
47
|
+
"gnu",
|
|
48
|
+
"./ts-pack-core-node.linux-x64-gnu.node",
|
|
49
|
+
"@kreuzberg/tree-sitter-language-pack-linux-x64-gnu",
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"linux",
|
|
53
|
+
"arm64",
|
|
54
|
+
"gnu",
|
|
55
|
+
"./ts-pack-core-node.linux-arm64-gnu.node",
|
|
56
|
+
"@kreuzberg/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
|
+
"@kreuzberg/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
|
+
"@kreuzberg/tree-sitter-language-pack-linux-arm64-musl",
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
"darwin",
|
|
74
|
+
"x64",
|
|
75
|
+
null,
|
|
76
|
+
"./ts-pack-core-node.darwin-x64.node",
|
|
77
|
+
"@kreuzberg/tree-sitter-language-pack-darwin-x64",
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
"darwin",
|
|
81
|
+
"arm64",
|
|
82
|
+
null,
|
|
83
|
+
"./ts-pack-core-node.darwin-arm64.node",
|
|
84
|
+
"@kreuzberg/tree-sitter-language-pack-darwin-arm64",
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"win32",
|
|
88
|
+
"x64",
|
|
89
|
+
null,
|
|
90
|
+
"./ts-pack-core-node.win32-x64-msvc.node",
|
|
91
|
+
"@kreuzberg/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
|
+
"@kreuzberg/tree-sitter-language-pack-win32-arm64-msvc",
|
|
99
|
+
],
|
|
100
|
+
];
|
|
60
101
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
102
|
+
for (const [plat, a, abi, localPath, optionalDep] of targets) {
|
|
103
|
+
if (platform !== plat || arch !== a) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
65
106
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
107
|
+
if (plat === "linux" && abi) {
|
|
108
|
+
const isCurMusl = isMusl();
|
|
109
|
+
if ((abi === "musl") !== isCurMusl) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
72
113
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
114
|
+
try {
|
|
115
|
+
nativeBinding = require(localPath);
|
|
116
|
+
if (nativeBinding) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
} catch (e) {
|
|
120
|
+
loadErrors.push(e.message);
|
|
121
|
+
}
|
|
81
122
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
123
|
+
try {
|
|
124
|
+
const optBinding = requireOptionalDependency(optionalDep);
|
|
125
|
+
if (optBinding) {
|
|
126
|
+
nativeBinding = optBinding;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {
|
|
130
|
+
loadErrors.push(e.message);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
92
133
|
};
|
|
93
134
|
|
|
94
135
|
tryLoadBinding();
|
|
95
136
|
|
|
96
137
|
if (!nativeBinding) {
|
|
97
|
-
|
|
98
|
-
`Failed to load native binding for ${platform}-${arch}. Errors: ${loadErrors.join(", ")}`
|
|
99
|
-
);
|
|
138
|
+
throw new Error(`Failed to load native binding for ${platform}-${arch}. Errors: ${loadErrors.join(", ")}`);
|
|
100
139
|
}
|
|
101
140
|
|
|
102
141
|
module.exports = nativeBinding;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kreuzberg/tree-sitter-language-pack",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "Pre-compiled tree-sitter grammars for 306 programming languages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"@napi-rs/cli": "^3.6.2"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@kreuzberg/tree-sitter-language-pack-darwin-arm64": "1.
|
|
37
|
-
"@kreuzberg/tree-sitter-language-pack-darwin-x64": "1.
|
|
38
|
-
"@kreuzberg/tree-sitter-language-pack-linux-arm64-gnu": "1.
|
|
39
|
-
"@kreuzberg/tree-sitter-language-pack-linux-arm64-musl": "1.
|
|
40
|
-
"@kreuzberg/tree-sitter-language-pack-linux-x64-gnu": "1.
|
|
41
|
-
"@kreuzberg/tree-sitter-language-pack-linux-x64-musl": "1.
|
|
42
|
-
"@kreuzberg/tree-sitter-language-pack-win32-arm64-msvc": "1.
|
|
43
|
-
"@kreuzberg/tree-sitter-language-pack-win32-x64-msvc": "1.
|
|
36
|
+
"@kreuzberg/tree-sitter-language-pack-darwin-arm64": "1.10.2",
|
|
37
|
+
"@kreuzberg/tree-sitter-language-pack-darwin-x64": "1.10.2",
|
|
38
|
+
"@kreuzberg/tree-sitter-language-pack-linux-arm64-gnu": "1.10.2",
|
|
39
|
+
"@kreuzberg/tree-sitter-language-pack-linux-arm64-musl": "1.10.2",
|
|
40
|
+
"@kreuzberg/tree-sitter-language-pack-linux-x64-gnu": "1.10.2",
|
|
41
|
+
"@kreuzberg/tree-sitter-language-pack-linux-x64-musl": "1.10.2",
|
|
42
|
+
"@kreuzberg/tree-sitter-language-pack-win32-arm64-msvc": "1.10.2",
|
|
43
|
+
"@kreuzberg/tree-sitter-language-pack-win32-x64-msvc": "1.10.2"
|
|
44
44
|
},
|
|
45
45
|
"napi": {
|
|
46
46
|
"binaryName": "ts-pack-core-node",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|