@ast-grep/napi 0.30.1 → 0.31.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/index.d.ts +2 -0
- package/manual.d.ts +14 -0
- package/package.json +10 -10
package/index.d.ts
CHANGED
|
@@ -127,6 +127,8 @@ export declare class SgNode {
|
|
|
127
127
|
/** Returns the node's SgRoot */
|
|
128
128
|
getRoot(): SgRoot
|
|
129
129
|
children(): Array<SgNode>
|
|
130
|
+
/** Returns the node's id */
|
|
131
|
+
id(): number
|
|
130
132
|
find(matcher: string | number | NapiConfig): SgNode | null
|
|
131
133
|
findAll(matcher: string | number | NapiConfig): Array<SgNode>
|
|
132
134
|
/** Finds the child node in the `field` */
|
package/manual.d.ts
CHANGED
|
@@ -33,11 +33,25 @@ export interface NthChildObject {
|
|
|
33
33
|
*/
|
|
34
34
|
export type NthChild = number | string | NthChildObject
|
|
35
35
|
|
|
36
|
+
export interface Position {
|
|
37
|
+
/** 0-indexed row number. */
|
|
38
|
+
row: number
|
|
39
|
+
/** 0-indexed column number. */
|
|
40
|
+
column: number
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface Range {
|
|
44
|
+
start: Position
|
|
45
|
+
end: Position
|
|
46
|
+
}
|
|
47
|
+
|
|
36
48
|
export interface Rule {
|
|
37
49
|
/** A pattern string or a pattern object. */
|
|
38
50
|
pattern?: PatternStyle
|
|
39
51
|
/** The kind name of the node to match. You can look up code's kind names in playground. */
|
|
40
52
|
kind?: string
|
|
53
|
+
/** The exact range of the node in the source code. */
|
|
54
|
+
range?: Range
|
|
41
55
|
/** A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax */
|
|
42
56
|
regex?: string
|
|
43
57
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ast-grep/napi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.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",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"optionalDependencies": {
|
|
71
|
-
"@ast-grep/napi-win32-x64-msvc": "0.
|
|
72
|
-
"@ast-grep/napi-darwin-x64": "0.
|
|
73
|
-
"@ast-grep/napi-linux-x64-gnu": "0.
|
|
74
|
-
"@ast-grep/napi-win32-ia32-msvc": "0.
|
|
75
|
-
"@ast-grep/napi-darwin-arm64": "0.
|
|
76
|
-
"@ast-grep/napi-win32-arm64-msvc": "0.
|
|
77
|
-
"@ast-grep/napi-linux-arm64-gnu": "0.
|
|
78
|
-
"@ast-grep/napi-linux-arm64-musl": "0.
|
|
79
|
-
"@ast-grep/napi-linux-x64-musl": "0.
|
|
71
|
+
"@ast-grep/napi-win32-x64-msvc": "0.31.0",
|
|
72
|
+
"@ast-grep/napi-darwin-x64": "0.31.0",
|
|
73
|
+
"@ast-grep/napi-linux-x64-gnu": "0.31.0",
|
|
74
|
+
"@ast-grep/napi-win32-ia32-msvc": "0.31.0",
|
|
75
|
+
"@ast-grep/napi-darwin-arm64": "0.31.0",
|
|
76
|
+
"@ast-grep/napi-win32-arm64-msvc": "0.31.0",
|
|
77
|
+
"@ast-grep/napi-linux-arm64-gnu": "0.31.0",
|
|
78
|
+
"@ast-grep/napi-linux-arm64-musl": "0.31.0",
|
|
79
|
+
"@ast-grep/napi-linux-x64-musl": "0.31.0"
|
|
80
80
|
}
|
|
81
81
|
}
|