@konomanoasa/tree-sitter-diagnostic-sh 0.8.1 → 0.9.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/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "konomanoasa-tree-sitter-diagnostic-sh"
3
- version = "0.8.1"
3
+ version = "0.9.1"
4
4
  description = "Tree-sitter grammar for diagnostics of POSIX sh."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -31,7 +31,7 @@ path = "test/bindings.test.rs"
31
31
  tree-sitter-language = "=0.1.9"
32
32
 
33
33
  [dev-dependencies]
34
- tree-sitter = "=0.27.1"
34
+ tree-sitter = "=0.27.2"
35
35
 
36
36
  [build-dependencies]
37
- cc = "=1.10.0"
37
+ cc = "=1.11.3"
package/README.md CHANGED
@@ -22,8 +22,7 @@ npm install @konomanoasa/tree-sitter-diagnostic-sh
22
22
  ## Development
23
23
 
24
24
  ```sh
25
- npm install
26
- npm run build
25
+ npm ci
27
26
  npm test
28
27
  ```
29
28
 
package/binding.gyp ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "targets": [
3
+ {
4
+ "target_name": "tree_sitter_diagnostic_sh_binding",
5
+ "sources": [
6
+ "bindings/node/binding.cc",
7
+ "src/parser.c",
8
+ "src/scanner.c"
9
+ ],
10
+ "include_dirs": ["src"],
11
+ "dependencies": [
12
+ "<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except"
13
+ ],
14
+ "cflags_c": ["-std=c17"],
15
+ "cflags_cc": ["-std=c++17"],
16
+ "msvs_settings": {
17
+ "VCCLCompilerTool": {
18
+ "AdditionalOptions": ["/utf-8"],
19
+ "AdditionalOptions!": ["-std:c++20"],
20
+ "LanguageStandard": "stdcpp17",
21
+ "LanguageStandard_C": "stdc17"
22
+ }
23
+ },
24
+ "target_conditions": [
25
+ [
26
+ "OS==\"mac\"",
27
+ {
28
+ "xcode_settings": {
29
+ "CLANG_CXX_LANGUAGE_STANDARD": "c++17",
30
+ "GCC_C_LANGUAGE_STANDARD": "c17",
31
+ "MACOSX_DEPLOYMENT_TARGET": "14.0"
32
+ }
33
+ }
34
+ ]
35
+ ]
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,25 @@
1
+ #include <napi.h>
2
+
3
+ struct TSLanguage;
4
+ extern "C" const TSLanguage *tree_sitter_diagnostic_sh();
5
+
6
+ namespace {
7
+
8
+ constexpr napi_type_tag language_type_tag = {
9
+ 0x8AF2E5212AD58ABF,
10
+ 0xD5006CAD83ABBA16
11
+ };
12
+
13
+ Napi::Object Init(Napi::Env env, Napi::Object exports) {
14
+ auto language = Napi::External<TSLanguage>::New(
15
+ env,
16
+ const_cast<TSLanguage *>(tree_sitter_diagnostic_sh())
17
+ );
18
+ language.TypeTag(&language_type_tag);
19
+ exports["language"] = language;
20
+ return exports;
21
+ }
22
+
23
+ }
24
+
25
+ NODE_API_MODULE(tree_sitter_diagnostic_sh_binding, Init)
@@ -0,0 +1,5 @@
1
+ import type { Language } from "tree-sitter";
2
+
3
+ declare const binding: Language;
4
+
5
+ export default binding;
@@ -0,0 +1,10 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+ import load from "node-gyp-build";
4
+
5
+ const binding = load(fileURLToPath(new URL("../..", import.meta.url)));
6
+ binding.nodeTypeInfo = JSON.parse(
7
+ readFileSync(new URL("../../src/node-types.json", import.meta.url), "utf8"),
8
+ );
9
+
10
+ export default binding;
@@ -1,6 +1,6 @@
1
1
  #include <Python.h>
2
2
 
3
- #include "tree_sitter/parser.h"
3
+ #include "../../src/tree_sitter/parser.h"
4
4
 
5
5
  const TSLanguage *tree_sitter_diagnostic_sh(void);
6
6
 
@@ -6,5 +6,4 @@ unsafe extern "C" {
6
6
 
7
7
  pub const LANGUAGE: LanguageFn =
8
8
  unsafe { LanguageFn::from_raw(tree_sitter_diagnostic_sh) };
9
-
10
9
  pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");
package/grammar.js CHANGED
@@ -50,7 +50,6 @@ function issue($) {
50
50
  export default grammar({
51
51
  name: "diagnostic_sh",
52
52
  externals: ($) => tokens.map(({ name }) => $[name]),
53
- // Prevents lexer fallback from accepting EOF mid-input.
54
53
  extras: ($) => [$._unmatchable],
55
54
  rules: {
56
55
  program: ($) =>
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "@konomanoasa/tree-sitter-diagnostic-sh",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "description": "Tree-sitter grammar for diagnostics of POSIX sh.",
5
5
  "license": "MIT",
6
6
  "repository": "git+https://github.com/konomanoasa/tree-sitter-diagnostic-sh.git",
7
7
  "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./bindings/node/index.d.ts",
11
+ "default": "./bindings/node/index.js"
12
+ }
13
+ },
8
14
  "files": [
9
15
  "Cargo.toml",
10
16
  "PARSING_POLICY.md",
17
+ "binding.gyp",
18
+ "bindings/node/*.cc",
19
+ "bindings/node/*.js",
20
+ "bindings/node/*.ts",
11
21
  "bindings/python/*.c",
12
22
  "bindings/python/*.py",
13
23
  "bindings/python/*.pyi",
@@ -27,22 +37,33 @@
27
37
  "access": "public"
28
38
  },
29
39
  "scripts": {
30
- "build": "npm run tree-sitter -- build-all",
40
+ "build": "node-gyp rebuild && node-gyp configure -- -f compile_commands_json",
41
+ "build:parser": "npm run tree-sitter -- build-all",
31
42
  "check": "biome check . && tsc",
32
43
  "format": "biome format --write .",
33
44
  "generate": "npm run tree-sitter -- generate-all",
34
- "test": "node --test --test-concurrency=1 test/build.test.js test/cst.test.js test/incremental.test.js test/parser.test.js && node scripts/check-c.js --test",
45
+ "install": "node-gyp-build",
46
+ "test": "node --test --test-concurrency=1 test/bindings.test.js test/build.test.js test/cst.test.js test/incremental.test.js test/parser.test.js && node scripts/check-c.js --test",
35
47
  "test:performance": "node --test test/performance.test.js",
36
48
  "test:sanitize": "node scripts/check-c.js --sanitize",
37
49
  "tree-sitter": "node scripts/tree-sitter.js"
38
50
  },
51
+ "dependencies": {
52
+ "node-addon-api": "8.9.2",
53
+ "node-gyp-build": "4.8.4"
54
+ },
55
+ "peerDependencies": {
56
+ "tree-sitter": "0.25.1"
57
+ },
39
58
  "devDependencies": {
40
- "@biomejs/biome": "2.6.2",
41
- "@types/node": "26.6.5",
42
- "tree-sitter-cli": "0.27.1",
59
+ "@biomejs/biome": "2.6.9",
60
+ "@types/node": "26.6.11",
61
+ "node-gyp": "13.1.0",
62
+ "tree-sitter-cli": "0.27.2",
43
63
  "typescript": "7.0.2"
44
64
  },
45
65
  "allowScripts": {
66
+ "tree-sitter": true,
46
67
  "tree-sitter-cli": true
47
68
  }
48
69
  }
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "konomanoasa-tree-sitter-diagnostic-sh"
3
- version = "0.8.1"
3
+ version = "0.9.1"
4
4
  description = "Tree-sitter grammar for diagnostics of POSIX sh."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -12,11 +12,11 @@ Repository = "https://github.com/konomanoasa/tree-sitter-diagnostic-sh"
12
12
  [dependency-groups]
13
13
  dev = [
14
14
  "poethepoet==0.49.0",
15
- "ruff==0.17.3",
15
+ "ruff==0.17.6",
16
16
  "setuptools==84.2.1",
17
- "tree-sitter==0.26.0",
17
+ "tree-sitter==0.27.0",
18
18
  "twine==7.0.0",
19
- "ty==0.0.95",
19
+ "ty==0.0.112",
20
20
  ]
21
21
 
22
22
  [build-system]
package/src/parser.c CHANGED
@@ -15225,7 +15225,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_diagnostic_sh(void) {
15225
15225
  .max_reserved_word_set_size = 0,
15226
15226
  .metadata = {
15227
15227
  .major_version = 0,
15228
- .minor_version = 8,
15228
+ .minor_version = 9,
15229
15229
  .patch_version = 1,
15230
15230
  },
15231
15231
  };
package/src/scanner.c CHANGED
@@ -3010,7 +3010,6 @@ static bool here_document(
3010
3010
  ts_free(body.units);
3011
3011
  bool accepted_eof =
3012
3012
  input->end == parser->plan->source_end || parser->backquote_end != 0;
3013
- // Keep unstarted-body gaps out of outer bodies.
3014
3013
  if (!found && !accepted_eof)
3015
3014
  report(
3016
3015
  parser,
@@ -1,20 +1,18 @@
1
+ use konomanoasa_tree_sitter_diagnostic_sh as grammar;
1
2
  use tree_sitter::Parser;
2
3
 
3
4
  #[test]
4
5
  fn parses_source_and_exposes_faults() {
5
- let language = konomanoasa_tree_sitter_diagnostic_sh::LANGUAGE.into();
6
+ let source = "cat >\n";
7
+ let language = grammar::LANGUAGE.into();
6
8
  let mut parser = Parser::new();
7
9
  parser.set_language(&language).unwrap();
8
10
  assert_eq!(language.name(), Some("diagnostic_sh"));
9
- let source = "cat >\n";
10
11
  let tree = parser.parse(source, None).unwrap();
11
12
  let root = tree.root_node();
12
13
  assert_eq!(root.kind(), "program");
13
- assert!(!root.has_error());
14
14
  assert_eq!(root.byte_range(), 0..source.len());
15
+ assert!(!root.has_error());
15
16
  assert!(root.to_sexp().contains("fault: (redirection_target_gap)"));
16
- assert!(
17
- konomanoasa_tree_sitter_diagnostic_sh::NODE_TYPES
18
- .contains("\"redirection_target_gap\"")
19
- );
17
+ assert!(grammar::NODE_TYPES.contains("\"redirection_target_gap\""));
20
18
  }
package/tree-sitter.json CHANGED
@@ -6,14 +6,11 @@
6
6
  "title": "Diagnostic POSIX sh",
7
7
  "scope": "source.diagnostic-sh",
8
8
  "path": ".",
9
- "external-files": [
10
- "src/tokens.h",
11
- "src/tokens.json"
12
- ]
9
+ "external-files": ["src/tokens.h", "src/tokens.json"]
13
10
  }
14
11
  ],
15
12
  "metadata": {
16
- "version": "0.8.1",
13
+ "version": "0.9.1",
17
14
  "license": "MIT",
18
15
  "description": "Tree-sitter grammar for diagnostics of POSIX sh.",
19
16
  "links": {
@@ -23,7 +20,7 @@
23
20
  "bindings": {
24
21
  "c": false,
25
22
  "go": false,
26
- "node": false,
23
+ "node": true,
27
24
  "python": true,
28
25
  "rust": true,
29
26
  "swift": false