@konomanoasa/tree-sitter-gitattributes 0.6.0 → 0.7.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/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "konomanoasa-tree-sitter-gitattributes"
3
- version = "0.6.0"
3
+ version = "0.7.0"
4
4
  description = "Tree-sitter grammar for gitattributes."
5
5
  readme = "README.md"
6
6
  license = "MIT"
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![npm](https://img.shields.io/npm/v/@konomanoasa/tree-sitter-gitattributes)](https://www.npmjs.com/package/@konomanoasa/tree-sitter-gitattributes)
6
6
 
7
7
  [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for
8
- Git attributes files 2.55.0.
8
+ Git attributes files 2.56.0.
9
9
 
10
10
  ## Installation
11
11
 
@@ -23,8 +23,8 @@ npm test
23
23
 
24
24
  ## Specifications
25
25
 
26
- - [Git 2.55.0 gitattributes manual](https://git-scm.com/docs/gitattributes/2.55.0)
27
- - [Git 2.55.0 gitignore manual](https://git-scm.com/docs/gitignore/2.55.0)
26
+ - [Git 2.56.0 gitattributes manual](https://git-scm.com/docs/gitattributes/2.56.0)
27
+ - [Git 2.56.0 gitignore manual](https://git-scm.com/docs/gitignore/2.56.0)
28
28
 
29
29
  ## License
30
30
 
package/binding.gyp ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "targets": [
3
+ {
4
+ "target_name": "tree_sitter_gitattributes_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_gitattributes();
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_gitattributes())
17
+ );
18
+ language.TypeTag(&language_type_tag);
19
+ exports["language"] = language;
20
+ return exports;
21
+ }
22
+
23
+ }
24
+
25
+ NODE_API_MODULE(tree_sitter_gitattributes_binding, Init)
@@ -0,0 +1,7 @@
1
+ import type { Language } from "tree-sitter";
2
+
3
+ declare const binding: Language & {
4
+ HIGHLIGHTS_QUERY: string;
5
+ };
6
+
7
+ export default binding;
@@ -0,0 +1,14 @@
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
+ binding.HIGHLIGHTS_QUERY = readFileSync(
10
+ new URL("../../queries/highlights.scm", import.meta.url),
11
+ "utf8",
12
+ );
13
+
14
+ 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_gitattributes(void);
6
6
 
package/package.json CHANGED
@@ -1,12 +1,22 @@
1
1
  {
2
2
  "name": "@konomanoasa/tree-sitter-gitattributes",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Tree-sitter grammar for gitattributes.",
5
5
  "license": "MIT",
6
6
  "repository": "git+https://github.com/konomanoasa/tree-sitter-gitattributes.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",
16
+ "binding.gyp",
17
+ "bindings/node/*.cc",
18
+ "bindings/node/*.js",
19
+ "bindings/node/*.ts",
10
20
  "bindings/python/*.c",
11
21
  "bindings/python/*.py",
12
22
  "bindings/python/*.pyi",
@@ -26,23 +36,33 @@
26
36
  "access": "public"
27
37
  },
28
38
  "scripts": {
29
- "build": "npm run tree-sitter -- build-all",
39
+ "build": "node-gyp rebuild && node-gyp configure -- -f compile_commands_json && npm run tree-sitter -- build-all",
30
40
  "check": "biome check . && tsc",
31
41
  "check:queries": "npm run tree-sitter -- check-queries",
32
42
  "format": "biome format --write .",
33
43
  "generate": "npm run tree-sitter -- generate-all",
34
- "test": "npm run tree-sitter -- test-corpus --rebuild && node --test --test-concurrency=1 test/build.test.js test/cst.test.js test/highlight.test.js test/incremental.test.js test/parser.test.js && node scripts/check-c.js --test",
44
+ "install": "node-gyp-build",
45
+ "test": "npm run tree-sitter -- test-corpus --rebuild && node --test --test-concurrency=1 test/bindings.test.js test/build.test.js test/cst.test.js test/highlight.test.js test/incremental.test.js test/parser.test.js && node scripts/check-c.js --test",
35
46
  "test:fuzz": "npm run tree-sitter -- fuzz-all --iterations 100 --edits 5",
36
47
  "test:sanitize": "node scripts/check-c.js --sanitize",
37
48
  "tree-sitter": "node scripts/tree-sitter.js"
38
49
  },
50
+ "dependencies": {
51
+ "node-addon-api": "8.9.2",
52
+ "node-gyp-build": "4.8.4"
53
+ },
54
+ "peerDependencies": {
55
+ "tree-sitter": "0.25.1"
56
+ },
39
57
  "devDependencies": {
40
- "@biomejs/biome": "2.6.2",
41
- "@types/node": "26.6.5",
58
+ "@biomejs/biome": "2.6.4",
59
+ "@types/node": "26.6.6",
60
+ "node-gyp": "13.1.0",
42
61
  "tree-sitter-cli": "0.27.1",
43
62
  "typescript": "7.0.2"
44
63
  },
45
64
  "allowScripts": {
65
+ "tree-sitter": true,
46
66
  "tree-sitter-cli": true
47
67
  }
48
68
  }
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "konomanoasa-tree-sitter-gitattributes"
3
- version = "0.6.0"
3
+ version = "0.7.0"
4
4
  description = "Tree-sitter grammar for gitattributes."
5
5
  readme = "README.md"
6
6
  license = "MIT"
package/src/parser.c CHANGED
@@ -6137,7 +6137,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_gitattributes(void) {
6137
6137
  .max_reserved_word_set_size = 0,
6138
6138
  .metadata = {
6139
6139
  .major_version = 0,
6140
- .minor_version = 6,
6140
+ .minor_version = 7,
6141
6141
  .patch_version = 0,
6142
6142
  },
6143
6143
  };
package/src/scanner.c CHANGED
@@ -135,7 +135,6 @@ absent(TSLexer *lexer, enum Token missing, enum Token incomplete) {
135
135
  return lexer->eof(lexer) ? incomplete : missing;
136
136
  }
137
137
 
138
- // Include the next decoded character so edits invalidate the run.
139
138
  static bool invalid_run(Scanner *s, TSLexer *lexer, const bool *valid) {
140
139
  do advance(s, lexer);
141
140
  while (!lexer->eof(lexer) && lexer->lookahead == DECODE_ERROR);
@@ -440,7 +439,6 @@ static void hold_prefix(Scanner *s, Cursor *r, uint32_t prefix_end) {
440
439
  s->next_end = r->end;
441
440
  }
442
441
 
443
- // Consume lookahead units fully so edits inside them invalidate the decision.
444
442
  static bool prepare_glob(Scanner *s, TSLexer *lexer, const bool *valid) {
445
443
  Cursor r = cursor(s, lexer, s->content_end);
446
444
  bool separator = r.c == '/';
@@ -470,11 +468,11 @@ static bool prepare_glob(Scanner *s, TSLexer *lexer, const bool *valid) {
470
468
  s->next_end = r.end;
471
469
  step(&r);
472
470
  }
473
- const bool pair = count == 2 && s->component_start;
471
+ const bool multiple = count >= 2 && s->component_start;
474
472
  const bool tail = r.c == CURSOR_END && s->after_separator;
475
473
  if (r.c == '\\') step(&r);
476
474
  const bool slash = r.c == '/';
477
- s->next = pair && (slash || tail) ? RECURSIVE_WILDCARD : WILDCARD;
475
+ s->next = multiple && (slash || tail) ? RECURSIVE_WILDCARD : WILDCARD;
478
476
  } else if (r.kind == QUOTED_ESCAPE && r.c != '[') s->next = QUOTED_ESCAPE;
479
477
  else if (r.c == '[') {
480
478
  s->next = SET_OPEN;
package/tree-sitter.json CHANGED
@@ -12,7 +12,7 @@
12
12
  }
13
13
  ],
14
14
  "metadata": {
15
- "version": "0.6.0",
15
+ "version": "0.7.0",
16
16
  "license": "MIT",
17
17
  "description": "Tree-sitter grammar for gitattributes.",
18
18
  "links": {
@@ -22,7 +22,7 @@
22
22
  "bindings": {
23
23
  "c": false,
24
24
  "go": false,
25
- "node": false,
25
+ "node": true,
26
26
  "python": true,
27
27
  "rust": true,
28
28
  "swift": false