@ast-grep/napi 0.41.1 → 0.42.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.
Files changed (2) hide show
  1. package/package.json +13 -13
  2. package/types/rule.d.ts +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ast-grep/napi",
3
- "version": "0.41.1",
3
+ "version": "0.42.0",
4
4
  "description": "Search and Rewrite code at large scale using precise AST pattern",
5
5
  "homepage": "https://ast-grep.github.io",
6
6
  "main": "index.js",
@@ -54,13 +54,13 @@
54
54
  "typegen": "ts-node scripts/generateTypes.ts"
55
55
  },
56
56
  "devDependencies": {
57
- "@ast-grep/napi": "0.41.0",
57
+ "@ast-grep/napi": "0.41.1",
58
58
  "@napi-rs/cli": "3.5.1",
59
59
  "@types/node": "^24.0.0",
60
- "oxlint": "1.51.0",
60
+ "oxlint": "1.55.0",
61
61
  "ava": "7.0.0",
62
62
  "chalk": "5.6.2",
63
- "dprint": "0.52.0",
63
+ "dprint": "0.53.0",
64
64
  "smol-toml": "^1.3.1",
65
65
  "ts-node": "10.9.2",
66
66
  "typescript": "5.9.3"
@@ -79,14 +79,14 @@
79
79
  }
80
80
  },
81
81
  "optionalDependencies": {
82
- "@ast-grep/napi-linux-x64-gnu": "0.41.1",
83
- "@ast-grep/napi-win32-x64-msvc": "0.41.1",
84
- "@ast-grep/napi-darwin-x64": "0.41.1",
85
- "@ast-grep/napi-win32-ia32-msvc": "0.41.1",
86
- "@ast-grep/napi-darwin-arm64": "0.41.1",
87
- "@ast-grep/napi-win32-arm64-msvc": "0.41.1",
88
- "@ast-grep/napi-linux-arm64-gnu": "0.41.1",
89
- "@ast-grep/napi-linux-arm64-musl": "0.41.1",
90
- "@ast-grep/napi-linux-x64-musl": "0.41.1"
82
+ "@ast-grep/napi-linux-x64-gnu": "0.42.0",
83
+ "@ast-grep/napi-win32-x64-msvc": "0.42.0",
84
+ "@ast-grep/napi-darwin-x64": "0.42.0",
85
+ "@ast-grep/napi-win32-ia32-msvc": "0.42.0",
86
+ "@ast-grep/napi-darwin-arm64": "0.42.0",
87
+ "@ast-grep/napi-win32-arm64-msvc": "0.42.0",
88
+ "@ast-grep/napi-linux-arm64-gnu": "0.42.0",
89
+ "@ast-grep/napi-linux-arm64-musl": "0.42.0",
90
+ "@ast-grep/napi-linux-x64-musl": "0.42.0"
91
91
  }
92
92
  }
package/types/rule.d.ts CHANGED
@@ -51,6 +51,13 @@ export interface Range {
51
51
  end: Position
52
52
  }
53
53
 
54
+ export type UtilityCall<M extends TypesMap = TypesMap> = Record<
55
+ string,
56
+ Record<string, Rule<M>>
57
+ >
58
+
59
+ export type Matches<M extends TypesMap = TypesMap> = string | UtilityCall<M>
60
+
54
61
  export interface Rule<M extends TypesMap = TypesMap> {
55
62
  /** A pattern string or a pattern object. */
56
63
  pattern?: PatternStyle<M>
@@ -93,6 +100,6 @@ export interface Rule<M extends TypesMap = TypesMap> {
93
100
  any?: Array<Rule<M>>
94
101
  /** A single sub-rule and matches a node if the sub rule does not match. */
95
102
  not?: Rule<M>
96
- /** A utility rule id and matches a node if the utility rule matches. */
97
- matches?: string
103
+ /** A utility rule id or parameterized utility call and matches a node if that utility matches. */
104
+ matches?: Matches<M>
98
105
  }