@xberg-io/tree-sitter-language-pack 1.15.8 → 1.17.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
@@ -1,5 +1,5 @@
1
1
  <!-- This file is auto-generated by alef — DO NOT EDIT. -->
2
- <!-- alef:hash:ff506cf4dbdbddde18672b129772c89f0325a209924295226b1cdf5993d58bde -->
2
+ <!-- alef:hash:f02cf7eadee2e2005e0a0a46e7b2ae062a6cce92548b232119aa872449076c1a -->
3
3
  <!-- To regenerate: alef readme -->
4
4
  <!-- To verify freshness: alef verify -->
5
5
 
@@ -119,15 +119,16 @@ npm install @xberg-io/tree-sitter-language-pack
119
119
  ## Quick Start
120
120
 
121
121
  ```typescript title="TypeScript"
122
- import { process } from "@xberg-io/tree-sitter-language-pack";
122
+ import { ProcessConfig, process } from "@xberg-io/tree-sitter-language-pack";
123
123
  function main() {
124
- const result = process("# A comment\ndef greet(name):\n \"\"\"Say hello.\"\"\"\n return f'Hi {name}'\n\nimport os\n", { language: "python" });
124
+ const config: ProcessConfig = { language: "python" };
125
+ const result = process("# A comment\ndef greet(name):\n \"\"\"Say hello.\"\"\"\n return f'Hi {name}'\n\nimport os\n", config);
125
126
  console.log(result.language);
126
127
  console.log(result.structure);
127
- console.log(result.structure[0].kind);
128
+ console.log(result.structure?.[0]?.kind);
128
129
  console.log(result.imports);
129
- console.log(result.metrics.totalLines);
130
- console.log(result.metrics.errorCount);
130
+ console.log(result.metrics?.totalLines);
131
+ console.log(result.metrics?.errorCount);
131
132
  }
132
133
 
133
134
  void main();
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef — DO NOT EDIT.
2
- // alef:hash:7fbd5c415e8c992c667ae962684b697caad6ac017fb54e17fdb3d8766483a1c4
2
+ // alef:hash:350fe61d645ed79aae34ddd692ebf560b5c2e800adb5846d1e84be07051eeb5f
3
3
  // To regenerate: alef generate
4
4
  // To verify freshness: alef verify
5
5
  /* eslint-disable */
@@ -457,26 +457,13 @@ export interface DocSection {
457
457
  * variant serializes as a single-keyed object (`{"Other": "rst"}`). DO
458
458
  * NOT add `#[serde(tag = "...")]`. Covered by `tests/wire_format.rs`.
459
459
  */
460
- export declare enum DocstringFormat {
461
- /** Python triple-quoted string docstring (`"""..."""`). */
462
- PythonTripleQuote = "PythonTripleQuote",
463
- /**
464
- * JavaScript/TypeScript JSDoc block comment (opens with two stars, closes
465
- * with star-slash).
466
- */
467
- JSDoc = "JSDoc",
468
- /** Rust `///` or `//!` doc comment. */
469
- Rustdoc = "Rustdoc",
470
- /** Go doc comment (a comment block immediately preceding a declaration). */
471
- GoDoc = "GoDoc",
472
- /**
473
- * Java Javadoc block comment (opens with two stars, closes with
474
- * star-slash).
475
- */
476
- JavaDoc = "JavaDoc",
477
- /** A language-specific docstring format not covered by the standard variants. */
478
- Other = "Other",
479
- }
460
+ export type DocstringFormat =
461
+ | { type: 'PythonTripleQuote' }
462
+ | { type: 'JSDoc' }
463
+ | { type: 'Rustdoc' }
464
+ | { type: 'GoDoc' }
465
+ | { type: 'JavaDoc' }
466
+ | { type: 'Other'; other: string }
480
467
 
481
468
  /** A docstring extracted from source code. */
482
469
  export interface DocstringInfo {
@@ -1142,30 +1129,18 @@ export interface StructureItem {
1142
1129
  * any change breaks all bindings' `process()` tests simultaneously.
1143
1130
  * Covered by `tests/wire_format.rs`.
1144
1131
  */
1145
- export declare enum StructureKind {
1146
- /** A free-standing or associated function. */
1147
- Function = "Function",
1148
- /** A method defined inside a class, struct, trait, or impl block. */
1149
- Method = "Method",
1150
- /** A class definition. */
1151
- Class = "Class",
1152
- /** A struct definition. */
1153
- Struct = "Struct",
1154
- /** An interface or protocol definition. */
1155
- Interface = "Interface",
1156
- /** An enum definition. */
1157
- Enum = "Enum",
1158
- /** A module or package declaration. */
1159
- Module = "Module",
1160
- /** A trait definition. */
1161
- Trait = "Trait",
1162
- /** An impl block (Rust) or similar implementation block. */
1163
- Impl = "Impl",
1164
- /** A namespace declaration. */
1165
- Namespace = "Namespace",
1166
- /** A language-specific construct that does not fit any standard category. */
1167
- Other = "Other",
1168
- }
1132
+ export type StructureKind =
1133
+ | { type: 'Function' }
1134
+ | { type: 'Method' }
1135
+ | { type: 'Class' }
1136
+ | { type: 'Struct' }
1137
+ | { type: 'Interface' }
1138
+ | { type: 'Enum' }
1139
+ | { type: 'Module' }
1140
+ | { type: 'Trait' }
1141
+ | { type: 'Impl' }
1142
+ | { type: 'Namespace' }
1143
+ | { type: 'Other'; other: string }
1169
1144
 
1170
1145
  /** A symbol (variable, function, type, etc.) extracted from source code. */
1171
1146
  export interface SymbolInfo {
@@ -1204,26 +1179,16 @@ export interface SymbolInfo {
1204
1179
  * variant serializes as a single-keyed object (`{"Other": "macro"}`). DO
1205
1180
  * NOT add `#[serde(tag = "...")]`. Covered by `tests/wire_format.rs`.
1206
1181
  */
1207
- export declare enum SymbolKind {
1208
- /** A variable binding. */
1209
- Variable = "Variable",
1210
- /** A constant (immutable binding). */
1211
- Constant = "Constant",
1212
- /** A function definition. */
1213
- Function = "Function",
1214
- /** A class definition. */
1215
- Class = "Class",
1216
- /** A type alias or typedef. */
1217
- Type = "Type",
1218
- /** An interface definition. */
1219
- Interface = "Interface",
1220
- /** An enum definition. */
1221
- Enum = "Enum",
1222
- /** A module declaration. */
1223
- Module = "Module",
1224
- /** A symbol kind not covered by the standard variants. */
1225
- Other = "Other",
1226
- }
1182
+ export type SymbolKind =
1183
+ | { type: 'Variable' }
1184
+ | { type: 'Constant' }
1185
+ | { type: 'Function' }
1186
+ | { type: 'Class' }
1187
+ | { type: 'Type' }
1188
+ | { type: 'Interface' }
1189
+ | { type: 'Enum' }
1190
+ | { type: 'Module' }
1191
+ | { type: 'Other'; other: string }
1227
1192
 
1228
1193
  /** A parsed syntax tree. Cheap to clone (refcount bump). */
1229
1194
  export declare class Tree {
package/index.js CHANGED
@@ -9,16 +9,9 @@ const isMusl = () => {
9
9
  // "is musl" positive. Fall through to the filesystem heuristic instead: on
10
10
  // glibc systems `/lib64/ld-musl-x86_64.so.1` does not exist; on musl systems
11
11
  // it always does. statSync errors → not musl.
12
- if (
13
- typeof process.report === "object" &&
14
- typeof process.report.getReport === "function"
15
- ) {
12
+ if (typeof process.report === "object" && typeof process.report.getReport === "function") {
16
13
  const report = process.report.getReport();
17
- if (
18
- report &&
19
- report.header &&
20
- typeof report.header.glibcVersion === "string"
21
- ) {
14
+ if (report && report.header && typeof report.header.glibcVersion === "string") {
22
15
  return false;
23
16
  }
24
17
  }
@@ -47,14 +40,56 @@ const tryLoadBinding = () => {
47
40
  // Optional-dep packages are named after `napi.packageName` (npm subpackage names),
48
41
  // which inherits any scope prefix from the parent package.
49
42
  const targets = [
50
- ["linux", "x64", "gnu", "./ts-pack-core-node.linux-x64-gnu.node", "@xberg-io/tree-sitter-language-pack-linux-x64-gnu"],
51
- ["linux", "arm64", "gnu", "./ts-pack-core-node.linux-arm64-gnu.node", "@xberg-io/tree-sitter-language-pack-linux-arm64-gnu"],
52
- ["linux", "x64", "musl", "./ts-pack-core-node.linux-x64-musl.node", "@xberg-io/tree-sitter-language-pack-linux-x64-musl"],
53
- ["linux", "arm64", "musl", "./ts-pack-core-node.linux-arm64-musl.node", "@xberg-io/tree-sitter-language-pack-linux-arm64-musl"],
43
+ [
44
+ "linux",
45
+ "x64",
46
+ "gnu",
47
+ "./ts-pack-core-node.linux-x64-gnu.node",
48
+ "@xberg-io/tree-sitter-language-pack-linux-x64-gnu",
49
+ ],
50
+ [
51
+ "linux",
52
+ "arm64",
53
+ "gnu",
54
+ "./ts-pack-core-node.linux-arm64-gnu.node",
55
+ "@xberg-io/tree-sitter-language-pack-linux-arm64-gnu",
56
+ ],
57
+ [
58
+ "linux",
59
+ "x64",
60
+ "musl",
61
+ "./ts-pack-core-node.linux-x64-musl.node",
62
+ "@xberg-io/tree-sitter-language-pack-linux-x64-musl",
63
+ ],
64
+ [
65
+ "linux",
66
+ "arm64",
67
+ "musl",
68
+ "./ts-pack-core-node.linux-arm64-musl.node",
69
+ "@xberg-io/tree-sitter-language-pack-linux-arm64-musl",
70
+ ],
54
71
  ["darwin", "x64", null, "./ts-pack-core-node.darwin-x64.node", "@xberg-io/tree-sitter-language-pack-darwin-x64"],
55
- ["darwin", "arm64", null, "./ts-pack-core-node.darwin-arm64.node", "@xberg-io/tree-sitter-language-pack-darwin-arm64"],
56
- ["win32", "x64", null, "./ts-pack-core-node.win32-x64-msvc.node", "@xberg-io/tree-sitter-language-pack-win32-x64-msvc"],
57
- ["win32", "arm64", null, "./ts-pack-core-node.win32-arm64-msvc.node", "@xberg-io/tree-sitter-language-pack-win32-arm64-msvc"],
72
+ [
73
+ "darwin",
74
+ "arm64",
75
+ null,
76
+ "./ts-pack-core-node.darwin-arm64.node",
77
+ "@xberg-io/tree-sitter-language-pack-darwin-arm64",
78
+ ],
79
+ [
80
+ "win32",
81
+ "x64",
82
+ null,
83
+ "./ts-pack-core-node.win32-x64-msvc.node",
84
+ "@xberg-io/tree-sitter-language-pack-win32-x64-msvc",
85
+ ],
86
+ [
87
+ "win32",
88
+ "arm64",
89
+ null,
90
+ "./ts-pack-core-node.win32-arm64-msvc.node",
91
+ "@xberg-io/tree-sitter-language-pack-win32-arm64-msvc",
92
+ ],
58
93
  ];
59
94
 
60
95
  for (const [plat, a, abi, localPath, optionalDep] of targets) {
@@ -93,9 +128,7 @@ const tryLoadBinding = () => {
93
128
  tryLoadBinding();
94
129
 
95
130
  if (!nativeBinding) {
96
- throw new Error(
97
- `Failed to load native binding for ${platform}-${arch}. Errors: ${loadErrors.join(", ")}`
98
- );
131
+ throw new Error(`Failed to load native binding for ${platform}-${arch}. Errors: ${loadErrors.join(", ")}`);
99
132
  }
100
133
 
101
134
  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.15.8",
3
+ "version": "1.17.0",
4
4
  "description": "Pre-compiled tree-sitter grammars for 371 programming languages",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,14 +18,14 @@
18
18
  },
19
19
  "files": ["index.js", "index.d.ts", "*.node"],
20
20
  "optionalDependencies": {
21
- "@xberg-io/tree-sitter-language-pack-linux-x64-gnu": "1.15.8",
22
- "@xberg-io/tree-sitter-language-pack-linux-arm64-gnu": "1.15.8",
23
- "@xberg-io/tree-sitter-language-pack-linux-x64-musl": "1.15.8",
24
- "@xberg-io/tree-sitter-language-pack-linux-arm64-musl": "1.15.8",
25
- "@xberg-io/tree-sitter-language-pack-darwin-x64": "1.15.8",
26
- "@xberg-io/tree-sitter-language-pack-darwin-arm64": "1.15.8",
27
- "@xberg-io/tree-sitter-language-pack-win32-x64-msvc": "1.15.8",
28
- "@xberg-io/tree-sitter-language-pack-win32-arm64-msvc": "1.15.8"
21
+ "@xberg-io/tree-sitter-language-pack-darwin-arm64": "1.17.0",
22
+ "@xberg-io/tree-sitter-language-pack-darwin-x64": "1.17.0",
23
+ "@xberg-io/tree-sitter-language-pack-linux-arm64-gnu": "1.17.0",
24
+ "@xberg-io/tree-sitter-language-pack-linux-arm64-musl": "1.17.0",
25
+ "@xberg-io/tree-sitter-language-pack-linux-x64-gnu": "1.17.0",
26
+ "@xberg-io/tree-sitter-language-pack-linux-x64-musl": "1.17.0",
27
+ "@xberg-io/tree-sitter-language-pack-win32-arm64-msvc": "1.17.0",
28
+ "@xberg-io/tree-sitter-language-pack-win32-x64-msvc": "1.17.0"
29
29
  },
30
30
  "napi": {
31
31
  "packageName": "@xberg-io/tree-sitter-language-pack",
@@ -46,7 +46,13 @@
46
46
  "artifacts": "npx --yes -p @napi-rs/cli@^3.7.3 napi artifacts",
47
47
  "prepublishOnly": "npx --yes -p @napi-rs/cli@^3.7.3 napi prepublish -t npm --skip-optional-publish"
48
48
  },
49
- "engines": { "node": ">= 22" },
50
- "publishConfig": { "access": "public" },
51
- "devDependencies": { "@napi-rs/cli": "^3.7.3" }
49
+ "engines": {
50
+ "node": ">= 22"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "devDependencies": {
56
+ "@napi-rs/cli": "^3.8.6"
57
+ }
52
58
  }
Binary file
Binary file