@ast-grep/napi 0.2.3 → 0.2.5

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 +9 -0
  2. package/package.json +9 -9
package/index.d.ts CHANGED
@@ -28,6 +28,10 @@ export interface NapiConfig {
28
28
  language?: FrontEndLanguage
29
29
  }
30
30
  export function parseFiles(paths: string[], callback: (err: null | Error, result: SgRoot) => void): Promise<number>
31
+ export interface FindConfig {
32
+ paths: Array<string>
33
+ matcher: NapiConfig
34
+ }
31
35
  export class SgNode {
32
36
  range(): Range
33
37
  isLeaf(): boolean
@@ -60,24 +64,29 @@ export namespace html {
60
64
  export function parse(src: string): SgRoot
61
65
  export function kind(kindName: string): number
62
66
  export function pattern(pattern: string): NapiConfig
67
+ export function findInFiles(config: FindConfig, callback: (err: null | Error, result: SgNode[]) => void): Promise<number>
63
68
  }
64
69
  export namespace js {
65
70
  export function parse(src: string): SgRoot
66
71
  export function kind(kindName: string): number
67
72
  export function pattern(pattern: string): NapiConfig
73
+ export function findInFiles(config: FindConfig, callback: (err: null | Error, result: SgNode[]) => void): Promise<number>
68
74
  }
69
75
  export namespace jsx {
70
76
  export function parse(src: string): SgRoot
71
77
  export function kind(kindName: string): number
72
78
  export function pattern(pattern: string): NapiConfig
79
+ export function findInFiles(config: FindConfig, callback: (err: null | Error, result: SgNode[]) => void): Promise<number>
73
80
  }
74
81
  export namespace ts {
75
82
  export function parse(src: string): SgRoot
76
83
  export function kind(kindName: string): number
77
84
  export function pattern(pattern: string): NapiConfig
85
+ export function findInFiles(config: FindConfig, callback: (err: null | Error, result: SgNode[]) => void): Promise<number>
78
86
  }
79
87
  export namespace tsx {
80
88
  export function parse(src: string): SgRoot
81
89
  export function kind(kindName: string): number
82
90
  export function pattern(pattern: string): NapiConfig
91
+ export function findInFiles(config: FindConfig, callback: (err: null | Error, result: SgNode[]) => void): Promise<number>
83
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ast-grep/napi",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Search and Rewrite code at large scale using precise AST pattern",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/ast-grep/ast-grep",
@@ -43,11 +43,11 @@
43
43
  "version": "napi version"
44
44
  },
45
45
  "devDependencies": {
46
- "@napi-rs/cli": "2.14.4",
46
+ "@napi-rs/cli": "2.14.6",
47
47
  "ava": "5.1.1",
48
48
  "chalk": "5.2.0",
49
49
  "ts-node": "10.9.1",
50
- "typescript": "4.9.4"
50
+ "typescript": "4.9.5"
51
51
  },
52
52
  "ava": {
53
53
  "require": [
@@ -64,11 +64,11 @@
64
64
  },
65
65
  "packageManager": "yarn@3.2.3",
66
66
  "optionalDependencies": {
67
- "@ast-grep/napi-win32-x64-msvc": "0.2.3",
68
- "@ast-grep/napi-darwin-x64": "0.2.3",
69
- "@ast-grep/napi-linux-x64-gnu": "0.2.3",
70
- "@ast-grep/napi-win32-ia32-msvc": "0.2.3",
71
- "@ast-grep/napi-darwin-arm64": "0.2.3",
72
- "@ast-grep/napi-win32-arm64-msvc": "0.2.3"
67
+ "@ast-grep/napi-win32-x64-msvc": "0.2.5",
68
+ "@ast-grep/napi-darwin-x64": "0.2.5",
69
+ "@ast-grep/napi-linux-x64-gnu": "0.2.5",
70
+ "@ast-grep/napi-win32-ia32-msvc": "0.2.5",
71
+ "@ast-grep/napi-darwin-arm64": "0.2.5",
72
+ "@ast-grep/napi-win32-arm64-msvc": "0.2.5"
73
73
  }
74
74
  }