@ast-grep/napi 0.13.1 → 0.14.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.
Files changed (2) hide show
  1. package/index.d.ts +50 -2
  2. package/package.json +8 -9
package/index.d.ts CHANGED
@@ -11,9 +11,9 @@ export const enum FrontEndLanguage {
11
11
  TypeScript = 4
12
12
  }
13
13
  export interface Pos {
14
- /** line number starting from 1 */
14
+ /** line number starting from 0 */
15
15
  line: number
16
- /** column number starting from 1 */
16
+ /** column number starting from 0 */
17
17
  column: number
18
18
  /** byte offset of the position */
19
19
  index: number
@@ -90,6 +90,14 @@ export class SgRoot {
90
90
  export namespace html {
91
91
  /** Parse a string to an ast-grep instance */
92
92
  export function parse(src: string): SgRoot
93
+ /**
94
+ * Parse a string to an ast-grep instance asynchronously in threads.
95
+ * It utlizes multiple CPU cores when **concurrent processing sources**.
96
+ * However, spawning excessive many threads may backfire.
97
+ * Please refer to libuv doc, nodejs' underlying runtime
98
+ * for its default behavior and performance tuning tricks.
99
+ */
100
+ export function parseAsync(src: string): Promise<SgRoot>
93
101
  /** Get the `kind` number from its string name. */
94
102
  export function kind(kindName: string): number
95
103
  /** Compile a string to ast-grep Pattern. */
@@ -104,6 +112,14 @@ export namespace html {
104
112
  export namespace js {
105
113
  /** Parse a string to an ast-grep instance */
106
114
  export function parse(src: string): SgRoot
115
+ /**
116
+ * Parse a string to an ast-grep instance asynchronously in threads.
117
+ * It utlizes multiple CPU cores when **concurrent processing sources**.
118
+ * However, spawning excessive many threads may backfire.
119
+ * Please refer to libuv doc, nodejs' underlying runtime
120
+ * for its default behavior and performance tuning tricks.
121
+ */
122
+ export function parseAsync(src: string): Promise<SgRoot>
107
123
  /** Get the `kind` number from its string name. */
108
124
  export function kind(kindName: string): number
109
125
  /** Compile a string to ast-grep Pattern. */
@@ -118,6 +134,14 @@ export namespace js {
118
134
  export namespace jsx {
119
135
  /** Parse a string to an ast-grep instance */
120
136
  export function parse(src: string): SgRoot
137
+ /**
138
+ * Parse a string to an ast-grep instance asynchronously in threads.
139
+ * It utlizes multiple CPU cores when **concurrent processing sources**.
140
+ * However, spawning excessive many threads may backfire.
141
+ * Please refer to libuv doc, nodejs' underlying runtime
142
+ * for its default behavior and performance tuning tricks.
143
+ */
144
+ export function parseAsync(src: string): Promise<SgRoot>
121
145
  /** Get the `kind` number from its string name. */
122
146
  export function kind(kindName: string): number
123
147
  /** Compile a string to ast-grep Pattern. */
@@ -132,6 +156,14 @@ export namespace jsx {
132
156
  export namespace ts {
133
157
  /** Parse a string to an ast-grep instance */
134
158
  export function parse(src: string): SgRoot
159
+ /**
160
+ * Parse a string to an ast-grep instance asynchronously in threads.
161
+ * It utlizes multiple CPU cores when **concurrent processing sources**.
162
+ * However, spawning excessive many threads may backfire.
163
+ * Please refer to libuv doc, nodejs' underlying runtime
164
+ * for its default behavior and performance tuning tricks.
165
+ */
166
+ export function parseAsync(src: string): Promise<SgRoot>
135
167
  /** Get the `kind` number from its string name. */
136
168
  export function kind(kindName: string): number
137
169
  /** Compile a string to ast-grep Pattern. */
@@ -146,6 +178,14 @@ export namespace ts {
146
178
  export namespace tsx {
147
179
  /** Parse a string to an ast-grep instance */
148
180
  export function parse(src: string): SgRoot
181
+ /**
182
+ * Parse a string to an ast-grep instance asynchronously in threads.
183
+ * It utlizes multiple CPU cores when **concurrent processing sources**.
184
+ * However, spawning excessive many threads may backfire.
185
+ * Please refer to libuv doc, nodejs' underlying runtime
186
+ * for its default behavior and performance tuning tricks.
187
+ */
188
+ export function parseAsync(src: string): Promise<SgRoot>
149
189
  /** Get the `kind` number from its string name. */
150
190
  export function kind(kindName: string): number
151
191
  /** Compile a string to ast-grep Pattern. */
@@ -160,6 +200,14 @@ export namespace tsx {
160
200
  export namespace css {
161
201
  /** Parse a string to an ast-grep instance */
162
202
  export function parse(src: string): SgRoot
203
+ /**
204
+ * Parse a string to an ast-grep instance asynchronously in threads.
205
+ * It utlizes multiple CPU cores when **concurrent processing sources**.
206
+ * However, spawning excessive many threads may backfire.
207
+ * Please refer to libuv doc, nodejs' underlying runtime
208
+ * for its default behavior and performance tuning tricks.
209
+ */
210
+ export function parseAsync(src: string): Promise<SgRoot>
163
211
  /** Get the `kind` number from its string name. */
164
212
  export function kind(kindName: string): number
165
213
  /** Compile a string to ast-grep Pattern. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ast-grep/napi",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
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",
@@ -48,7 +48,7 @@
48
48
  "ava": "5.3.1",
49
49
  "chalk": "5.3.0",
50
50
  "ts-node": "10.9.1",
51
- "typescript": "5.2.2"
51
+ "typescript": "5.3.2"
52
52
  },
53
53
  "ava": {
54
54
  "require": [
@@ -63,13 +63,12 @@
63
63
  "TS_NODE_PROJECT": "./tsconfig.json"
64
64
  }
65
65
  },
66
- "packageManager": "yarn@4.0.1",
67
66
  "optionalDependencies": {
68
- "@ast-grep/napi-win32-x64-msvc": "0.13.1",
69
- "@ast-grep/napi-darwin-x64": "0.13.1",
70
- "@ast-grep/napi-linux-x64-gnu": "0.13.1",
71
- "@ast-grep/napi-win32-ia32-msvc": "0.13.1",
72
- "@ast-grep/napi-darwin-arm64": "0.13.1",
73
- "@ast-grep/napi-win32-arm64-msvc": "0.13.1"
67
+ "@ast-grep/napi-win32-x64-msvc": "0.14.1",
68
+ "@ast-grep/napi-darwin-x64": "0.14.1",
69
+ "@ast-grep/napi-linux-x64-gnu": "0.14.1",
70
+ "@ast-grep/napi-win32-ia32-msvc": "0.14.1",
71
+ "@ast-grep/napi-darwin-arm64": "0.14.1",
72
+ "@ast-grep/napi-win32-arm64-msvc": "0.14.1"
74
73
  }
75
74
  }