@kreuzberg/tree-sitter-language-pack 1.0.0-rc.8 → 1.0.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/README.md CHANGED
@@ -9,33 +9,37 @@
9
9
  <img src="https://img.shields.io/pypi/v/tree-sitter-language-pack?label=Python&color=007ec6" alt="Python">
10
10
  </a> <a href="https://www.npmjs.com/package/@kreuzberg/tree-sitter-language-pack">
11
11
  <img src="https://img.shields.io/npm/v/@kreuzberg/tree-sitter-language-pack?label=Node.js&color=007ec6" alt="Node">
12
- </a> <a href="https://github.com/kreuzberg-dev/tree-sitter-language-pack/tree/main/packages/go/v1">
13
- <img src="https://img.shields.io/github/v/tag/kreuzberg-dev/tree-sitter-language-pack?label=Go&color=007ec6" alt="Go">
14
- </a> <a href="https://central.sonatype.com/artifact/dev.kreuzberg/tree-sitter-language-pack">
15
- <img src="https://img.shields.io/maven-central/v/dev.kreuzberg/tree-sitter-language-pack?label=Java&color=007ec6" alt="Java">
16
- </a> <a href="https://hex.pm/packages/tree_sitter_language_pack">
17
- <img src="https://img.shields.io/hexpm/v/tree_sitter_language_pack?label=Elixir&color=007ec6" alt="Elixir">
18
- </a> <a href="https://rubygems.org/gems/tree_sitter_language_pack">
19
- <img src="https://img.shields.io/gem/v/tree_sitter_language_pack?label=Ruby&color=007ec6" alt="Ruby">
20
12
  </a> <a href="https://www.npmjs.com/package/@kreuzberg/tree-sitter-language-pack-wasm">
21
13
  <img src="https://img.shields.io/npm/v/@kreuzberg/tree-sitter-language-pack-wasm?label=WASM&color=007ec6" alt="Wasm">
22
- </a> <a href="https://packagist.org/packages/kreuzberg/tree-sitter-language-pack">
23
- <img src="https://img.shields.io/packagist/v/kreuzberg/tree-sitter-language-pack?label=PHP&color=007ec6" alt="Php">
14
+ </a> <a href="https://central.sonatype.com/artifact/dev.kreuzberg/tree-sitter-language-pack">
15
+ <img src="https://img.shields.io/maven-central/v/dev.kreuzberg/tree-sitter-language-pack?label=Java&color=007ec6" alt="Java">
16
+ </a> <a href="https://github.com/kreuzberg-dev/tree-sitter-language-pack/tree/main/packages/go/v1">
17
+ <img src="https://img.shields.io/github/v/tag/kreuzberg-dev/tree-sitter-language-pack?label=Go&color=007ec6" alt="Go">
24
18
  </a> <a href="https://www.nuget.org/packages/TreeSitterLanguagePack">
25
19
  <img src="https://img.shields.io/nuget/v/TreeSitterLanguagePack?label=C%23&color=007ec6" alt="Csharp">
20
+ </a> <a href="https://packagist.org/packages/kreuzberg/tree-sitter-language-pack">
21
+ <img src="https://img.shields.io/packagist/v/kreuzberg/tree-sitter-language-pack?label=PHP&color=007ec6" alt="Php">
22
+ </a> <a href="https://rubygems.org/gems/tree_sitter_language_pack">
23
+ <img src="https://img.shields.io/gem/v/tree_sitter_language_pack?label=Ruby&color=007ec6" alt="Ruby">
24
+ </a> <a href="https://hex.pm/packages/tree_sitter_language_pack">
25
+ <img src="https://img.shields.io/hexpm/v/tree_sitter_language_pack?label=Elixir&color=007ec6" alt="Elixir">
26
+ </a> <a href="https://github.com/kreuzberg-dev/tree-sitter-language-pack/pkgs/container/tree-sitter-language-pack">
27
+ <img src="https://img.shields.io/badge/Docker-007ec6?logo=docker&logoColor=white" alt="Docker">
28
+ </a> <a href="https://github.com/kreuzberg-dev/tree-sitter-language-pack/tree/main/crates/ts-pack-ffi">
29
+ <img src="https://img.shields.io/badge/C-FFI-007ec6" alt="Ffi">
26
30
  </a>
27
31
  <!-- Project Info -->
28
32
  <a href="https://github.com/kreuzberg-dev/tree-sitter-language-pack/actions">
29
33
  <img src="https://img.shields.io/github/actions/workflow/status/kreuzberg-dev/tree-sitter-language-pack/ci-rust.yaml?branch=main&label=CI" alt="CI">
30
34
  </a>
31
35
  <a href="https://github.com/kreuzberg-dev/tree-sitter-language-pack/blob/main/LICENSE">
32
- <img src="https://img.shields.io/badge/License-MIT%20%7C%20Apache--2.0-blue" alt="License">
36
+ <img src="https://img.shields.io/badge/License-MIT%20%7C%20Apache--2.0-blue.svg" alt="License">
33
37
  </a>
34
38
  <a href="https://github.com/kreuzberg-dev/homebrew-tap">
35
39
  <img src="https://img.shields.io/badge/homebrew-ts--pack-FBB040?logo=homebrew" alt="Homebrew">
36
40
  </a>
37
- <a href="https://docs.rs/tree-sitter-language-pack">
38
- <img src="https://img.shields.io/badge/docs-crates.io-blue" alt="Docs">
41
+ <a href="https://docs.tree-sitter-language-pack.kreuzberg.dev">
42
+ <img src="https://img.shields.io/badge/docs-kreuzberg.dev-blue" alt="Docs">
39
43
  </a>
40
44
  </div>
41
45
 
@@ -109,7 +113,7 @@ For detailed API documentation, see the [Node.js package](https://github.com/kre
109
113
 
110
114
  ## License
111
115
 
112
- MIT OR Apache-2.0 -- see [LICENSE](https://github.com/kreuzberg-dev/tree-sitter-language-pack/blob/main/LICENSE) for details.
116
+ MIT -- see [LICENSE](https://github.com/kreuzberg-dev/tree-sitter-language-pack/blob/main/LICENSE) for details.
113
117
 
114
118
  ---
115
119
 
package/index.d.ts CHANGED
@@ -11,79 +11,25 @@ export declare class ExternalObject<T> {
11
11
  export declare function availableLanguages(): Array<string>;
12
12
 
13
13
  /**
14
- * Returns the raw TSLanguage pointer for interop with node-tree-sitter.
15
- *
16
- * Throws an error if the language is not found.
17
- */
18
- export declare function getLanguagePtr(name: string): number;
19
-
20
- /** Checks whether a language with the given name is available. */
21
- export declare function hasLanguage(name: string): boolean;
22
-
23
- /** Configuration for the `process` function. */
24
- export interface JsProcessConfig {
25
- language: string;
26
- structure?: boolean;
27
- imports?: boolean;
28
- exports?: boolean;
29
- comments?: boolean;
30
- docstrings?: boolean;
31
- symbols?: boolean;
32
- diagnostics?: boolean;
33
- chunkMaxSize?: number;
34
- }
35
-
36
- /** Returns the number of available languages. */
37
- export declare function languageCount(): number;
38
-
39
- /**
40
- * Parse a source string using the named language and return an opaque tree handle.
14
+ * Get the effective cache directory being used.
41
15
  *
42
- * Throws an error if the language is not found or parsing fails.
16
+ * Returns the path as a string. Throws an error if cache directory cannot be determined.
43
17
  */
44
- export declare function parseString(
45
- language: string,
46
- source: string,
47
- ): ExternalObject<Tree>;
48
-
49
- /** Process source code using a config and return a JavaScript object with metadata and chunks. */
50
- export declare function process(source: string, config: JsProcessConfig): any;
51
-
52
- /** Check whether any node in the tree has the given type name. */
53
- export declare function treeContainsNodeType(
54
- tree: ExternalObject<Tree>,
55
- nodeType: string,
56
- ): boolean;
57
-
58
- /** Check whether the tree contains any ERROR or MISSING nodes. */
59
- export declare function treeHasErrorNodes(tree: ExternalObject<Tree>): boolean;
60
-
61
- /** Get the number of named children of the root node. */
62
- export declare function treeRootChildCount(tree: ExternalObject<Tree>): number;
63
-
64
- /** Get the type name of the root node. */
65
- export declare function treeRootNodeType(tree: ExternalObject<Tree>): string;
66
-
67
- /** Configuration for download and cache management. */
68
- export interface JsPackConfig {
69
- cacheDir?: string;
70
- languages?: Array<string>;
71
- groups?: Array<string>;
72
- }
18
+ export declare function cacheDir(): string;
73
19
 
74
20
  /**
75
- * Initialize download system with configuration and pre-download all specified languages.
21
+ * Delete all cached parser files.
76
22
  *
77
- * Throws an error if configuration or download fails.
23
+ * Throws an error if cache deletion fails.
78
24
  */
79
- export declare function init(config?: JsPackConfig): void;
25
+ export declare function cleanCache(): void;
80
26
 
81
27
  /**
82
28
  * Configure the cache directory without downloading.
83
29
  *
84
30
  * Throws an error if configuration fails.
85
31
  */
86
- export declare function configure(config?: JsPackConfig): void;
32
+ export declare function configure(config: JsPackConfig): void;
87
33
 
88
34
  /**
89
35
  * Download specific languages by name.
@@ -102,29 +48,82 @@ export declare function download(names: Array<string>): number;
102
48
  export declare function downloadAll(): number;
103
49
 
104
50
  /**
105
- * Get all available languages from the remote manifest.
51
+ * Get all languages that have been downloaded and cached locally.
106
52
  *
107
- * Returns an array of language names. Throws an error if manifest fetch fails.
53
+ * Returns an array of language names currently in the cache.
108
54
  */
109
- export declare function manifestLanguages(): Array<string>;
55
+ export declare function downloadedLanguages(): Array<string>;
110
56
 
111
57
  /**
112
- * Get all languages that have been downloaded and cached locally.
58
+ * Returns the raw TSLanguage pointer for interop with node-tree-sitter.
113
59
  *
114
- * Returns an array of language names currently in the cache.
60
+ * Throws an error if the language is not found.
115
61
  */
116
- export declare function downloadedLanguages(): Array<string>;
62
+ export declare function getLanguagePtr(name: string): number;
63
+
64
+ /** Checks whether a language with the given name is available. */
65
+ export declare function hasLanguage(name: string): boolean;
117
66
 
118
67
  /**
119
- * Delete all cached parser files.
68
+ * Initialize download system with configuration and pre-download all specified languages.
120
69
  *
121
- * Throws an error if cache deletion fails.
70
+ * Throws an error if configuration or download fails.
122
71
  */
123
- export declare function cleanCache(): void;
72
+ export declare function init(config?: JsPackConfig | undefined | null): void;
73
+
74
+ /** Configuration for download and cache management. */
75
+ export interface JsPackConfig {
76
+ cacheDir?: string;
77
+ languages?: Array<string>;
78
+ groups?: Array<string>;
79
+ }
80
+
81
+ /** Configuration for the `process` function. */
82
+ export interface JsProcessConfig {
83
+ language: string;
84
+ structure?: boolean;
85
+ imports?: boolean;
86
+ exports?: boolean;
87
+ comments?: boolean;
88
+ docstrings?: boolean;
89
+ symbols?: boolean;
90
+ diagnostics?: boolean;
91
+ chunkMaxSize?: number;
92
+ }
93
+
94
+ /** Returns the number of available languages. */
95
+ export declare function languageCount(): number;
124
96
 
125
97
  /**
126
- * Get the effective cache directory being used.
98
+ * Get all available languages from the remote manifest.
127
99
  *
128
- * Returns the path as a string. Throws an error if cache directory cannot be determined.
100
+ * Returns an array of language names. Throws an error if manifest fetch fails.
129
101
  */
130
- export declare function cacheDir(): string;
102
+ export declare function manifestLanguages(): Array<string>;
103
+
104
+ /**
105
+ * Parse a source string using the named language and return an opaque tree handle.
106
+ *
107
+ * Throws an error if the language is not found or parsing fails.
108
+ */
109
+ export declare function parseString(language: string, source: string): ExternalObject<Tree>;
110
+
111
+ /**
112
+ * Process source code using a config and return a JavaScript object with metadata and chunks.
113
+ *
114
+ * Accepts both camelCase and snake_case config keys (auto-normalized to snake_case).
115
+ * Returns camelCase keys in the result for JavaScript convention.
116
+ */
117
+ export declare function process(source: string, config: any): any;
118
+
119
+ /** Check whether any node in the tree has the given type name. */
120
+ export declare function treeContainsNodeType(tree: ExternalObject<Tree>, nodeType: string): boolean;
121
+
122
+ /** Check whether the tree contains any ERROR or MISSING nodes. */
123
+ export declare function treeHasErrorNodes(tree: ExternalObject<Tree>): boolean;
124
+
125
+ /** Get the number of named children of the root node. */
126
+ export declare function treeRootChildCount(tree: ExternalObject<Tree>): number;
127
+
128
+ /** Get the type name of the root node. */
129
+ export declare function treeRootNodeType(tree: ExternalObject<Tree>): string;
package/index.js CHANGED
@@ -53,9 +53,7 @@ const isMuslFromReport = () => {
53
53
 
54
54
  const isMuslFromChildProcess = () => {
55
55
  try {
56
- return require("child_process")
57
- .execSync("ldd --version", { encoding: "utf8" })
58
- .includes("musl");
56
+ return require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
59
57
  } catch (e) {
60
58
  // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
61
59
  return false;
@@ -81,12 +79,12 @@ function requireNative() {
81
79
  const bindingPackageVersion =
82
80
  require("@kreuzberg/tree-sitter-language-pack-android-arm64/package.json").version;
83
81
  if (
84
- bindingPackageVersion !== "1.0.0-rc.8" &&
82
+ bindingPackageVersion !== "1.0.0" &&
85
83
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
86
84
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
87
85
  ) {
88
86
  throw new Error(
89
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
87
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
90
88
  );
91
89
  }
92
90
  return binding;
@@ -104,12 +102,12 @@ function requireNative() {
104
102
  const bindingPackageVersion =
105
103
  require("@kreuzberg/tree-sitter-language-pack-android-arm-eabi/package.json").version;
106
104
  if (
107
- bindingPackageVersion !== "1.0.0-rc.8" &&
105
+ bindingPackageVersion !== "1.0.0" &&
108
106
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
109
107
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
110
108
  ) {
111
109
  throw new Error(
112
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
110
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
113
111
  );
114
112
  }
115
113
  return binding;
@@ -117,9 +115,7 @@ function requireNative() {
117
115
  loadErrors.push(e);
118
116
  }
119
117
  } else {
120
- loadErrors.push(
121
- new Error(`Unsupported architecture on Android ${process.arch}`),
122
- );
118
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
123
119
  }
124
120
  } else if (process.platform === "win32") {
125
121
  if (process.arch === "x64") {
@@ -137,12 +133,12 @@ function requireNative() {
137
133
  const bindingPackageVersion =
138
134
  require("@kreuzberg/tree-sitter-language-pack-win32-x64-gnu/package.json").version;
139
135
  if (
140
- bindingPackageVersion !== "1.0.0-rc.8" &&
136
+ bindingPackageVersion !== "1.0.0" &&
141
137
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
142
138
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
143
139
  ) {
144
140
  throw new Error(
145
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
141
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
146
142
  );
147
143
  }
148
144
  return binding;
@@ -160,12 +156,12 @@ function requireNative() {
160
156
  const bindingPackageVersion =
161
157
  require("@kreuzberg/tree-sitter-language-pack-win32-x64-msvc/package.json").version;
162
158
  if (
163
- bindingPackageVersion !== "1.0.0-rc.8" &&
159
+ bindingPackageVersion !== "1.0.0" &&
164
160
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
165
161
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
166
162
  ) {
167
163
  throw new Error(
168
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
164
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
169
165
  );
170
166
  }
171
167
  return binding;
@@ -184,12 +180,12 @@ function requireNative() {
184
180
  const bindingPackageVersion =
185
181
  require("@kreuzberg/tree-sitter-language-pack-win32-ia32-msvc/package.json").version;
186
182
  if (
187
- bindingPackageVersion !== "1.0.0-rc.8" &&
183
+ bindingPackageVersion !== "1.0.0" &&
188
184
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
189
185
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
190
186
  ) {
191
187
  throw new Error(
192
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
188
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
193
189
  );
194
190
  }
195
191
  return binding;
@@ -207,12 +203,12 @@ function requireNative() {
207
203
  const bindingPackageVersion =
208
204
  require("@kreuzberg/tree-sitter-language-pack-win32-arm64-msvc/package.json").version;
209
205
  if (
210
- bindingPackageVersion !== "1.0.0-rc.8" &&
206
+ bindingPackageVersion !== "1.0.0" &&
211
207
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
212
208
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
213
209
  ) {
214
210
  throw new Error(
215
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
211
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
216
212
  );
217
213
  }
218
214
  return binding;
@@ -220,9 +216,7 @@ function requireNative() {
220
216
  loadErrors.push(e);
221
217
  }
222
218
  } else {
223
- loadErrors.push(
224
- new Error(`Unsupported architecture on Windows: ${process.arch}`),
225
- );
219
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
226
220
  }
227
221
  } else if (process.platform === "darwin") {
228
222
  try {
@@ -235,42 +229,19 @@ function requireNative() {
235
229
  const bindingPackageVersion =
236
230
  require("@kreuzberg/tree-sitter-language-pack-darwin-universal/package.json").version;
237
231
  if (
238
- bindingPackageVersion !== "1.0.0-rc.8" &&
232
+ bindingPackageVersion !== "1.0.0" &&
239
233
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
240
234
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
241
235
  ) {
242
236
  throw new Error(
243
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
237
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
244
238
  );
245
239
  }
246
240
  return binding;
247
241
  } catch (e) {
248
242
  loadErrors.push(e);
249
243
  }
250
- if (process.arch === "x64") {
251
- try {
252
- return require("./ts-pack-node.darwin-x64.node");
253
- } catch (e) {
254
- loadErrors.push(e);
255
- }
256
- try {
257
- const binding = require("@kreuzberg/tree-sitter-language-pack-darwin-x64");
258
- const bindingPackageVersion =
259
- require("@kreuzberg/tree-sitter-language-pack-darwin-x64/package.json").version;
260
- if (
261
- bindingPackageVersion !== "1.0.0-rc.8" &&
262
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
263
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
264
- ) {
265
- throw new Error(
266
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
267
- );
268
- }
269
- return binding;
270
- } catch (e) {
271
- loadErrors.push(e);
272
- }
273
- } else if (process.arch === "arm64") {
244
+ if (process.arch === "arm64") {
274
245
  try {
275
246
  return require("./ts-pack-node.darwin-arm64.node");
276
247
  } catch (e) {
@@ -278,15 +249,14 @@ function requireNative() {
278
249
  }
279
250
  try {
280
251
  const binding = require("@kreuzberg/tree-sitter-language-pack-darwin-arm64");
281
- const bindingPackageVersion =
282
- require("@kreuzberg/tree-sitter-language-pack-darwin-arm64/package.json").version;
252
+ const bindingPackageVersion = require("@kreuzberg/tree-sitter-language-pack-darwin-arm64/package.json").version;
283
253
  if (
284
- bindingPackageVersion !== "1.0.0-rc.8" &&
254
+ bindingPackageVersion !== "1.0.0" &&
285
255
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
286
256
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
287
257
  ) {
288
258
  throw new Error(
289
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
259
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
290
260
  );
291
261
  }
292
262
  return binding;
@@ -294,9 +264,7 @@ function requireNative() {
294
264
  loadErrors.push(e);
295
265
  }
296
266
  } else {
297
- loadErrors.push(
298
- new Error(`Unsupported architecture on macOS: ${process.arch}`),
299
- );
267
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
300
268
  }
301
269
  } else if (process.platform === "freebsd") {
302
270
  if (process.arch === "x64") {
@@ -307,15 +275,14 @@ function requireNative() {
307
275
  }
308
276
  try {
309
277
  const binding = require("@kreuzberg/tree-sitter-language-pack-freebsd-x64");
310
- const bindingPackageVersion =
311
- require("@kreuzberg/tree-sitter-language-pack-freebsd-x64/package.json").version;
278
+ const bindingPackageVersion = require("@kreuzberg/tree-sitter-language-pack-freebsd-x64/package.json").version;
312
279
  if (
313
- bindingPackageVersion !== "1.0.0-rc.8" &&
280
+ bindingPackageVersion !== "1.0.0" &&
314
281
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
315
282
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
316
283
  ) {
317
284
  throw new Error(
318
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
285
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
319
286
  );
320
287
  }
321
288
  return binding;
@@ -333,12 +300,12 @@ function requireNative() {
333
300
  const bindingPackageVersion =
334
301
  require("@kreuzberg/tree-sitter-language-pack-freebsd-arm64/package.json").version;
335
302
  if (
336
- bindingPackageVersion !== "1.0.0-rc.8" &&
303
+ bindingPackageVersion !== "1.0.0" &&
337
304
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
338
305
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
339
306
  ) {
340
307
  throw new Error(
341
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
308
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
342
309
  );
343
310
  }
344
311
  return binding;
@@ -346,9 +313,7 @@ function requireNative() {
346
313
  loadErrors.push(e);
347
314
  }
348
315
  } else {
349
- loadErrors.push(
350
- new Error(`Unsupported architecture on FreeBSD: ${process.arch}`),
351
- );
316
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
352
317
  }
353
318
  } else if (process.platform === "linux") {
354
319
  if (process.arch === "x64") {
@@ -363,12 +328,12 @@ function requireNative() {
363
328
  const bindingPackageVersion =
364
329
  require("@kreuzberg/tree-sitter-language-pack-linux-x64-musl/package.json").version;
365
330
  if (
366
- bindingPackageVersion !== "1.0.0-rc.8" &&
331
+ bindingPackageVersion !== "1.0.0" &&
367
332
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
368
333
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
369
334
  ) {
370
335
  throw new Error(
371
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
336
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
372
337
  );
373
338
  }
374
339
  return binding;
@@ -386,12 +351,12 @@ function requireNative() {
386
351
  const bindingPackageVersion =
387
352
  require("@kreuzberg/tree-sitter-language-pack-linux-x64-gnu/package.json").version;
388
353
  if (
389
- bindingPackageVersion !== "1.0.0-rc.8" &&
354
+ bindingPackageVersion !== "1.0.0" &&
390
355
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
391
356
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
392
357
  ) {
393
358
  throw new Error(
394
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
359
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
395
360
  );
396
361
  }
397
362
  return binding;
@@ -411,12 +376,12 @@ function requireNative() {
411
376
  const bindingPackageVersion =
412
377
  require("@kreuzberg/tree-sitter-language-pack-linux-arm64-musl/package.json").version;
413
378
  if (
414
- bindingPackageVersion !== "1.0.0-rc.8" &&
379
+ bindingPackageVersion !== "1.0.0" &&
415
380
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
416
381
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
417
382
  ) {
418
383
  throw new Error(
419
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
384
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
420
385
  );
421
386
  }
422
387
  return binding;
@@ -434,12 +399,12 @@ function requireNative() {
434
399
  const bindingPackageVersion =
435
400
  require("@kreuzberg/tree-sitter-language-pack-linux-arm64-gnu/package.json").version;
436
401
  if (
437
- bindingPackageVersion !== "1.0.0-rc.8" &&
402
+ bindingPackageVersion !== "1.0.0" &&
438
403
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
439
404
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
440
405
  ) {
441
406
  throw new Error(
442
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
407
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
443
408
  );
444
409
  }
445
410
  return binding;
@@ -459,12 +424,12 @@ function requireNative() {
459
424
  const bindingPackageVersion =
460
425
  require("@kreuzberg/tree-sitter-language-pack-linux-arm-musleabihf/package.json").version;
461
426
  if (
462
- bindingPackageVersion !== "1.0.0-rc.8" &&
427
+ bindingPackageVersion !== "1.0.0" &&
463
428
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
464
429
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
465
430
  ) {
466
431
  throw new Error(
467
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
432
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
468
433
  );
469
434
  }
470
435
  return binding;
@@ -482,12 +447,12 @@ function requireNative() {
482
447
  const bindingPackageVersion =
483
448
  require("@kreuzberg/tree-sitter-language-pack-linux-arm-gnueabihf/package.json").version;
484
449
  if (
485
- bindingPackageVersion !== "1.0.0-rc.8" &&
450
+ bindingPackageVersion !== "1.0.0" &&
486
451
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
487
452
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
488
453
  ) {
489
454
  throw new Error(
490
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
455
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
491
456
  );
492
457
  }
493
458
  return binding;
@@ -507,12 +472,12 @@ function requireNative() {
507
472
  const bindingPackageVersion =
508
473
  require("@kreuzberg/tree-sitter-language-pack-linux-loong64-musl/package.json").version;
509
474
  if (
510
- bindingPackageVersion !== "1.0.0-rc.8" &&
475
+ bindingPackageVersion !== "1.0.0" &&
511
476
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
512
477
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
513
478
  ) {
514
479
  throw new Error(
515
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
480
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
516
481
  );
517
482
  }
518
483
  return binding;
@@ -530,12 +495,12 @@ function requireNative() {
530
495
  const bindingPackageVersion =
531
496
  require("@kreuzberg/tree-sitter-language-pack-linux-loong64-gnu/package.json").version;
532
497
  if (
533
- bindingPackageVersion !== "1.0.0-rc.8" &&
498
+ bindingPackageVersion !== "1.0.0" &&
534
499
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
535
500
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
536
501
  ) {
537
502
  throw new Error(
538
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
503
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
539
504
  );
540
505
  }
541
506
  return binding;
@@ -555,12 +520,12 @@ function requireNative() {
555
520
  const bindingPackageVersion =
556
521
  require("@kreuzberg/tree-sitter-language-pack-linux-riscv64-musl/package.json").version;
557
522
  if (
558
- bindingPackageVersion !== "1.0.0-rc.8" &&
523
+ bindingPackageVersion !== "1.0.0" &&
559
524
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
560
525
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
561
526
  ) {
562
527
  throw new Error(
563
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
528
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
564
529
  );
565
530
  }
566
531
  return binding;
@@ -578,12 +543,12 @@ function requireNative() {
578
543
  const bindingPackageVersion =
579
544
  require("@kreuzberg/tree-sitter-language-pack-linux-riscv64-gnu/package.json").version;
580
545
  if (
581
- bindingPackageVersion !== "1.0.0-rc.8" &&
546
+ bindingPackageVersion !== "1.0.0" &&
582
547
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
583
548
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
584
549
  ) {
585
550
  throw new Error(
586
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
551
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
587
552
  );
588
553
  }
589
554
  return binding;
@@ -602,12 +567,12 @@ function requireNative() {
602
567
  const bindingPackageVersion =
603
568
  require("@kreuzberg/tree-sitter-language-pack-linux-ppc64-gnu/package.json").version;
604
569
  if (
605
- bindingPackageVersion !== "1.0.0-rc.8" &&
570
+ bindingPackageVersion !== "1.0.0" &&
606
571
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
607
572
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
608
573
  ) {
609
574
  throw new Error(
610
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
575
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
611
576
  );
612
577
  }
613
578
  return binding;
@@ -625,12 +590,12 @@ function requireNative() {
625
590
  const bindingPackageVersion =
626
591
  require("@kreuzberg/tree-sitter-language-pack-linux-s390x-gnu/package.json").version;
627
592
  if (
628
- bindingPackageVersion !== "1.0.0-rc.8" &&
593
+ bindingPackageVersion !== "1.0.0" &&
629
594
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
630
595
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
631
596
  ) {
632
597
  throw new Error(
633
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
598
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
634
599
  );
635
600
  }
636
601
  return binding;
@@ -638,9 +603,7 @@ function requireNative() {
638
603
  loadErrors.push(e);
639
604
  }
640
605
  } else {
641
- loadErrors.push(
642
- new Error(`Unsupported architecture on Linux: ${process.arch}`),
643
- );
606
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
644
607
  }
645
608
  } else if (process.platform === "openharmony") {
646
609
  if (process.arch === "arm64") {
@@ -654,12 +617,12 @@ function requireNative() {
654
617
  const bindingPackageVersion =
655
618
  require("@kreuzberg/tree-sitter-language-pack-openharmony-arm64/package.json").version;
656
619
  if (
657
- bindingPackageVersion !== "1.0.0-rc.8" &&
620
+ bindingPackageVersion !== "1.0.0" &&
658
621
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
659
622
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
660
623
  ) {
661
624
  throw new Error(
662
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
625
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
663
626
  );
664
627
  }
665
628
  return binding;
@@ -677,12 +640,12 @@ function requireNative() {
677
640
  const bindingPackageVersion =
678
641
  require("@kreuzberg/tree-sitter-language-pack-openharmony-x64/package.json").version;
679
642
  if (
680
- bindingPackageVersion !== "1.0.0-rc.8" &&
643
+ bindingPackageVersion !== "1.0.0" &&
681
644
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
682
645
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
683
646
  ) {
684
647
  throw new Error(
685
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
648
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
686
649
  );
687
650
  }
688
651
  return binding;
@@ -700,12 +663,12 @@ function requireNative() {
700
663
  const bindingPackageVersion =
701
664
  require("@kreuzberg/tree-sitter-language-pack-openharmony-arm/package.json").version;
702
665
  if (
703
- bindingPackageVersion !== "1.0.0-rc.8" &&
666
+ bindingPackageVersion !== "1.0.0" &&
704
667
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
705
668
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
706
669
  ) {
707
670
  throw new Error(
708
- `Native binding package version mismatch, expected 1.0.0-rc.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
671
+ `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
709
672
  );
710
673
  }
711
674
  return binding;
@@ -713,16 +676,10 @@ function requireNative() {
713
676
  loadErrors.push(e);
714
677
  }
715
678
  } else {
716
- loadErrors.push(
717
- new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`),
718
- );
679
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
719
680
  }
720
681
  } else {
721
- loadErrors.push(
722
- new Error(
723
- `Unsupported OS: ${process.platform}, architecture: ${process.arch}`,
724
- ),
725
- );
682
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
726
683
  }
727
684
  }
728
685
 
@@ -755,9 +712,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
755
712
  }
756
713
  }
757
714
  if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
758
- const error = new Error(
759
- "WASI binding not found and NAPI_RS_FORCE_WASI is set to error",
760
- );
715
+ const error = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
761
716
  error.cause = wasiBindingError;
762
717
  throw error;
763
718
  }
@@ -782,20 +737,20 @@ if (!nativeBinding) {
782
737
 
783
738
  module.exports = nativeBinding;
784
739
  module.exports.availableLanguages = nativeBinding.availableLanguages;
740
+ module.exports.cacheDir = nativeBinding.cacheDir;
741
+ module.exports.cleanCache = nativeBinding.cleanCache;
742
+ module.exports.configure = nativeBinding.configure;
743
+ module.exports.download = nativeBinding.download;
744
+ module.exports.downloadAll = nativeBinding.downloadAll;
745
+ module.exports.downloadedLanguages = nativeBinding.downloadedLanguages;
785
746
  module.exports.getLanguagePtr = nativeBinding.getLanguagePtr;
786
747
  module.exports.hasLanguage = nativeBinding.hasLanguage;
748
+ module.exports.init = nativeBinding.init;
787
749
  module.exports.languageCount = nativeBinding.languageCount;
750
+ module.exports.manifestLanguages = nativeBinding.manifestLanguages;
788
751
  module.exports.parseString = nativeBinding.parseString;
789
752
  module.exports.process = nativeBinding.process;
790
753
  module.exports.treeContainsNodeType = nativeBinding.treeContainsNodeType;
791
754
  module.exports.treeHasErrorNodes = nativeBinding.treeHasErrorNodes;
792
755
  module.exports.treeRootChildCount = nativeBinding.treeRootChildCount;
793
756
  module.exports.treeRootNodeType = nativeBinding.treeRootNodeType;
794
- module.exports.init = nativeBinding.init;
795
- module.exports.download = nativeBinding.download;
796
- module.exports.downloadAll = nativeBinding.downloadAll;
797
- module.exports.configure = nativeBinding.configure;
798
- module.exports.manifestLanguages = nativeBinding.manifestLanguages;
799
- module.exports.downloadedLanguages = nativeBinding.downloadedLanguages;
800
- module.exports.cleanCache = nativeBinding.cleanCache;
801
- module.exports.cacheDir = nativeBinding.cacheDir;
package/package.json CHANGED
@@ -1,57 +1,49 @@
1
1
  {
2
- "name": "@kreuzberg/tree-sitter-language-pack",
3
- "version": "1.0.0-rc.8",
4
- "description": "Tree-sitter language pack - pre-compiled parsers for 170+ languages (Node.js NAPI bindings)",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "files": [
8
- "index.js",
9
- "index.d.ts",
10
- "*.node"
11
- ],
12
- "napi": {
13
- "binaryName": "ts-pack-node",
14
- "targets": [
15
- "x86_64-apple-darwin",
16
- "aarch64-apple-darwin",
17
- "x86_64-unknown-linux-gnu",
18
- "aarch64-unknown-linux-gnu",
19
- "x86_64-pc-windows-msvc"
20
- ]
21
- },
22
- "engines": {
23
- "node": ">= 16"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "https://github.com/kreuzberg-dev/tree-sitter-language-pack"
28
- },
29
- "publishConfig": {
30
- "registry": "https://registry.npmjs.org/",
31
- "access": "public"
32
- },
33
- "scripts": {
34
- "artifacts": "napi artifacts",
35
- "build": "napi build --platform --release",
36
- "prepublishOnly": "napi prepublish -t npm --skip-optional-publish"
37
- },
38
- "keywords": [
39
- "tree-sitter",
40
- "parser",
41
- "syntax",
42
- "napi",
43
- "language-pack",
44
- "kreuzberg"
45
- ],
46
- "license": "MIT OR Apache-2.0",
47
- "devDependencies": {
48
- "@napi-rs/cli": "^3.5.0"
49
- },
50
- "optionalDependencies": {
51
- "@kreuzberg/tree-sitter-language-pack-darwin-x64": "1.0.0-rc.8",
52
- "@kreuzberg/tree-sitter-language-pack-darwin-arm64": "1.0.0-rc.8",
53
- "@kreuzberg/tree-sitter-language-pack-linux-x64-gnu": "1.0.0-rc.8",
54
- "@kreuzberg/tree-sitter-language-pack-linux-arm64-gnu": "1.0.0-rc.8",
55
- "@kreuzberg/tree-sitter-language-pack-win32-x64-msvc": "1.0.0-rc.8"
56
- }
57
- }
2
+ "name": "@kreuzberg/tree-sitter-language-pack",
3
+ "version": "1.0.0",
4
+ "description": "Tree-sitter language pack - pre-compiled parsers for 170+ languages (Node.js NAPI bindings)",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "files": [
8
+ "index.js",
9
+ "index.d.ts",
10
+ "*.node"
11
+ ],
12
+ "napi": {
13
+ "binaryName": "ts-pack-node",
14
+ "targets": [
15
+ "aarch64-apple-darwin",
16
+ "x86_64-unknown-linux-gnu",
17
+ "aarch64-unknown-linux-gnu",
18
+ "x86_64-pc-windows-msvc"
19
+ ]
20
+ },
21
+ "engines": {
22
+ "node": ">= 16"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/kreuzberg-dev/tree-sitter-language-pack"
27
+ },
28
+ "publishConfig": {
29
+ "registry": "https://registry.npmjs.org/",
30
+ "access": "public"
31
+ },
32
+ "scripts": {
33
+ "artifacts": "napi artifacts",
34
+ "build": "napi build --platform --release",
35
+ "prepublishOnly": "napi prepublish -t npm --skip-optional-publish"
36
+ },
37
+ "keywords": [
38
+ "tree-sitter",
39
+ "parser",
40
+ "syntax",
41
+ "napi",
42
+ "language-pack",
43
+ "kreuzberg"
44
+ ],
45
+ "license": "MIT",
46
+ "devDependencies": {
47
+ "@napi-rs/cli": "^3.5.1"
48
+ }
49
+ }
Binary file
Binary file
Binary file