@ast-grep/napi 0.38.7 → 0.39.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.
- package/index.d.ts +7 -14
- package/index.js +361 -280
- package/package.json +31 -28
- package/types/api.d.ts +3 -3
- package/types/config.d.ts +2 -2
- package/types/deprecated.d.ts +2 -2
- package/types/lang.d.ts +1 -1
- package/types/registerDynamicLang.d.ts +1 -1
- package/types/rule.d.ts +1 -1
- package/types/sgnode.d.ts +11 -14
- package/types/staticTypes.d.ts +6 -10
package/index.d.ts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export type {
|
|
3
|
-
export type { NapiConfig, FindConfig, FileOption } from './types/config'
|
|
1
|
+
// -----Type Only Export!-----//
|
|
2
|
+
export type { FileOption, FindConfig, NapiConfig } from './types/config'
|
|
4
3
|
export type { DynamicLangRegistrations } from './types/registerDynamicLang'
|
|
4
|
+
export type { Edit, Pos, Range } from './types/sgnode'
|
|
5
5
|
// Only Rule here. User can use Rule['pattern'], e.g., to get the type of subfield.
|
|
6
6
|
export type { Rule } from './types/rule'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
export {
|
|
8
|
+
// -----Runtime Value Export!-----//
|
|
9
|
+
export { findInFiles, kind, parse, parseAsync, parseFiles, pattern } from './types/api'
|
|
10
10
|
export { Lang } from './types/lang'
|
|
11
|
-
export {
|
|
12
|
-
parseFiles,
|
|
13
|
-
parse,
|
|
14
|
-
parseAsync,
|
|
15
|
-
kind,
|
|
16
|
-
pattern,
|
|
17
|
-
findInFiles,
|
|
18
|
-
} from './types/api'
|
|
19
11
|
export { registerDynamicLanguage } from './types/registerDynamicLang'
|
|
12
|
+
export { SgNode, SgRoot } from './types/sgnode'
|
|
20
13
|
// deprecated
|
|
21
|
-
export * from './types/deprecated'
|
|
14
|
+
export * from './types/deprecated'
|
package/index.js
CHANGED
|
@@ -1,330 +1,411 @@
|
|
|
1
|
-
|
|
1
|
+
// prettier-ignore
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// @ts-nocheck
|
|
5
4
|
/* auto-generated by NAPI-RS */
|
|
6
5
|
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { platform, arch } = process
|
|
6
|
+
const { createRequire } = require('node:module')
|
|
7
|
+
require = createRequire(__filename)
|
|
11
8
|
|
|
9
|
+
const { readFileSync } = require('node:fs')
|
|
12
10
|
let nativeBinding = null
|
|
13
|
-
|
|
14
|
-
let loadError = null
|
|
11
|
+
const loadErrors = []
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
13
|
+
const isMusl = () => {
|
|
14
|
+
let musl = false
|
|
15
|
+
if (process.platform === 'linux') {
|
|
16
|
+
musl = isMuslFromFilesystem()
|
|
17
|
+
if (musl === null) {
|
|
18
|
+
musl = isMuslFromReport()
|
|
19
|
+
}
|
|
20
|
+
if (musl === null) {
|
|
21
|
+
musl = isMuslFromChildProcess()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return musl
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
|
28
|
+
|
|
29
|
+
const isMuslFromFilesystem = () => {
|
|
30
|
+
try {
|
|
31
|
+
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
|
32
|
+
} catch {
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const isMuslFromReport = () => {
|
|
38
|
+
let report = null
|
|
39
|
+
if (typeof process.report?.getReport === 'function') {
|
|
40
|
+
process.report.excludeNetwork = true
|
|
41
|
+
report = process.report.getReport()
|
|
42
|
+
}
|
|
43
|
+
if (!report) {
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
50
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
23
51
|
return true
|
|
24
52
|
}
|
|
25
|
-
} else {
|
|
26
|
-
const { glibcVersionRuntime } = process.report.getReport().header
|
|
27
|
-
return !glibcVersionRuntime
|
|
28
53
|
}
|
|
54
|
+
return false
|
|
29
55
|
}
|
|
30
56
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
const isMuslFromChildProcess = () => {
|
|
58
|
+
try {
|
|
59
|
+
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
|
60
|
+
} catch (e) {
|
|
61
|
+
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function requireNative() {
|
|
67
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
68
|
+
try {
|
|
69
|
+
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
loadErrors.push(err)
|
|
72
|
+
}
|
|
73
|
+
} else if (process.platform === 'android') {
|
|
74
|
+
if (process.arch === 'arm64') {
|
|
75
|
+
try {
|
|
76
|
+
return require('./ast-grep-napi.android-arm64.node')
|
|
77
|
+
} catch (e) {
|
|
78
|
+
loadErrors.push(e)
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
return require('@ast-grep/napi-android-arm64')
|
|
82
|
+
} catch (e) {
|
|
83
|
+
loadErrors.push(e)
|
|
84
|
+
}
|
|
85
|
+
} else if (process.arch === 'arm') {
|
|
86
|
+
try {
|
|
87
|
+
return require('./ast-grep-napi.android-arm-eabi.node')
|
|
88
|
+
} catch (e) {
|
|
89
|
+
loadErrors.push(e)
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
return require('@ast-grep/napi-android-arm-eabi')
|
|
93
|
+
} catch (e) {
|
|
94
|
+
loadErrors.push(e)
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
98
|
+
}
|
|
99
|
+
} else if (process.platform === 'win32') {
|
|
100
|
+
if (process.arch === 'x64') {
|
|
101
|
+
try {
|
|
102
|
+
return require('./ast-grep-napi.win32-x64-msvc.node')
|
|
103
|
+
} catch (e) {
|
|
104
|
+
loadErrors.push(e)
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
return require('@ast-grep/napi-win32-x64-msvc')
|
|
108
|
+
} catch (e) {
|
|
109
|
+
loadErrors.push(e)
|
|
110
|
+
}
|
|
111
|
+
} else if (process.arch === 'ia32') {
|
|
112
|
+
try {
|
|
113
|
+
return require('./ast-grep-napi.win32-ia32-msvc.node')
|
|
114
|
+
} catch (e) {
|
|
115
|
+
loadErrors.push(e)
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
return require('@ast-grep/napi-win32-ia32-msvc')
|
|
119
|
+
} catch (e) {
|
|
120
|
+
loadErrors.push(e)
|
|
121
|
+
}
|
|
122
|
+
} else if (process.arch === 'arm64') {
|
|
123
|
+
try {
|
|
124
|
+
return require('./ast-grep-napi.win32-arm64-msvc.node')
|
|
125
|
+
} catch (e) {
|
|
126
|
+
loadErrors.push(e)
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
return require('@ast-grep/napi-win32-arm64-msvc')
|
|
130
|
+
} catch (e) {
|
|
131
|
+
loadErrors.push(e)
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
135
|
+
}
|
|
136
|
+
} else if (process.platform === 'darwin') {
|
|
137
|
+
try {
|
|
138
|
+
return require('./ast-grep-napi.darwin-universal.node')
|
|
139
|
+
} catch (e) {
|
|
140
|
+
loadErrors.push(e)
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
return require('@ast-grep/napi-darwin-universal')
|
|
144
|
+
} catch (e) {
|
|
145
|
+
loadErrors.push(e)
|
|
146
|
+
}
|
|
147
|
+
if (process.arch === 'x64') {
|
|
148
|
+
try {
|
|
149
|
+
return require('./ast-grep-napi.darwin-x64.node')
|
|
150
|
+
} catch (e) {
|
|
151
|
+
loadErrors.push(e)
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
return require('@ast-grep/napi-darwin-x64')
|
|
155
|
+
} catch (e) {
|
|
156
|
+
loadErrors.push(e)
|
|
157
|
+
}
|
|
158
|
+
} else if (process.arch === 'arm64') {
|
|
159
|
+
try {
|
|
160
|
+
return require('./ast-grep-napi.darwin-arm64.node')
|
|
161
|
+
} catch (e) {
|
|
162
|
+
loadErrors.push(e)
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
return require('@ast-grep/napi-darwin-arm64')
|
|
166
|
+
} catch (e) {
|
|
167
|
+
loadErrors.push(e)
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
171
|
+
}
|
|
172
|
+
} else if (process.platform === 'freebsd') {
|
|
173
|
+
if (process.arch === 'x64') {
|
|
174
|
+
try {
|
|
175
|
+
return require('./ast-grep-napi.freebsd-x64.node')
|
|
176
|
+
} catch (e) {
|
|
177
|
+
loadErrors.push(e)
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
return require('@ast-grep/napi-freebsd-x64')
|
|
181
|
+
} catch (e) {
|
|
182
|
+
loadErrors.push(e)
|
|
183
|
+
}
|
|
184
|
+
} else if (process.arch === 'arm64') {
|
|
185
|
+
try {
|
|
186
|
+
return require('./ast-grep-napi.freebsd-arm64.node')
|
|
187
|
+
} catch (e) {
|
|
188
|
+
loadErrors.push(e)
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
return require('@ast-grep/napi-freebsd-arm64')
|
|
192
|
+
} catch (e) {
|
|
193
|
+
loadErrors.push(e)
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
197
|
+
}
|
|
198
|
+
} else if (process.platform === 'linux') {
|
|
199
|
+
if (process.arch === 'x64') {
|
|
200
|
+
if (isMusl()) {
|
|
36
201
|
try {
|
|
37
|
-
|
|
38
|
-
nativeBinding = require('./ast-grep-napi.android-arm64.node')
|
|
39
|
-
} else {
|
|
40
|
-
nativeBinding = require('@ast-grep/napi-android-arm64')
|
|
41
|
-
}
|
|
202
|
+
return require('./ast-grep-napi.linux-x64-musl.node')
|
|
42
203
|
} catch (e) {
|
|
43
|
-
|
|
204
|
+
loadErrors.push(e)
|
|
44
205
|
}
|
|
45
|
-
break
|
|
46
|
-
case 'arm':
|
|
47
|
-
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.android-arm-eabi.node'))
|
|
48
206
|
try {
|
|
49
|
-
|
|
50
|
-
nativeBinding = require('./ast-grep-napi.android-arm-eabi.node')
|
|
51
|
-
} else {
|
|
52
|
-
nativeBinding = require('@ast-grep/napi-android-arm-eabi')
|
|
53
|
-
}
|
|
207
|
+
return require('@ast-grep/napi-linux-x64-musl')
|
|
54
208
|
} catch (e) {
|
|
55
|
-
|
|
209
|
+
loadErrors.push(e)
|
|
56
210
|
}
|
|
57
|
-
|
|
58
|
-
default:
|
|
59
|
-
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
60
|
-
}
|
|
61
|
-
break
|
|
62
|
-
case 'win32':
|
|
63
|
-
switch (arch) {
|
|
64
|
-
case 'x64':
|
|
65
|
-
localFileExisted = existsSync(
|
|
66
|
-
join(__dirname, 'ast-grep-napi.win32-x64-msvc.node')
|
|
67
|
-
)
|
|
211
|
+
} else {
|
|
68
212
|
try {
|
|
69
|
-
|
|
70
|
-
nativeBinding = require('./ast-grep-napi.win32-x64-msvc.node')
|
|
71
|
-
} else {
|
|
72
|
-
nativeBinding = require('@ast-grep/napi-win32-x64-msvc')
|
|
73
|
-
}
|
|
213
|
+
return require('./ast-grep-napi.linux-x64-gnu.node')
|
|
74
214
|
} catch (e) {
|
|
75
|
-
|
|
215
|
+
loadErrors.push(e)
|
|
76
216
|
}
|
|
77
|
-
break
|
|
78
|
-
case 'ia32':
|
|
79
|
-
localFileExisted = existsSync(
|
|
80
|
-
join(__dirname, 'ast-grep-napi.win32-ia32-msvc.node')
|
|
81
|
-
)
|
|
82
217
|
try {
|
|
83
|
-
|
|
84
|
-
nativeBinding = require('./ast-grep-napi.win32-ia32-msvc.node')
|
|
85
|
-
} else {
|
|
86
|
-
nativeBinding = require('@ast-grep/napi-win32-ia32-msvc')
|
|
87
|
-
}
|
|
218
|
+
return require('@ast-grep/napi-linux-x64-gnu')
|
|
88
219
|
} catch (e) {
|
|
89
|
-
|
|
220
|
+
loadErrors.push(e)
|
|
90
221
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
join(__dirname, 'ast-grep-napi.win32-arm64-msvc.node')
|
|
95
|
-
)
|
|
222
|
+
}
|
|
223
|
+
} else if (process.arch === 'arm64') {
|
|
224
|
+
if (isMusl()) {
|
|
96
225
|
try {
|
|
97
|
-
|
|
98
|
-
nativeBinding = require('./ast-grep-napi.win32-arm64-msvc.node')
|
|
99
|
-
} else {
|
|
100
|
-
nativeBinding = require('@ast-grep/napi-win32-arm64-msvc')
|
|
101
|
-
}
|
|
226
|
+
return require('./ast-grep-napi.linux-arm64-musl.node')
|
|
102
227
|
} catch (e) {
|
|
103
|
-
|
|
228
|
+
loadErrors.push(e)
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
return require('@ast-grep/napi-linux-arm64-musl')
|
|
232
|
+
} catch (e) {
|
|
233
|
+
loadErrors.push(e)
|
|
104
234
|
}
|
|
105
|
-
break
|
|
106
|
-
default:
|
|
107
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
108
|
-
}
|
|
109
|
-
break
|
|
110
|
-
case 'darwin':
|
|
111
|
-
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.darwin-universal.node'))
|
|
112
|
-
try {
|
|
113
|
-
if (localFileExisted) {
|
|
114
|
-
nativeBinding = require('./ast-grep-napi.darwin-universal.node')
|
|
115
235
|
} else {
|
|
116
|
-
|
|
236
|
+
try {
|
|
237
|
+
return require('./ast-grep-napi.linux-arm64-gnu.node')
|
|
238
|
+
} catch (e) {
|
|
239
|
+
loadErrors.push(e)
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
return require('@ast-grep/napi-linux-arm64-gnu')
|
|
243
|
+
} catch (e) {
|
|
244
|
+
loadErrors.push(e)
|
|
245
|
+
}
|
|
117
246
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
switch (arch) {
|
|
121
|
-
case 'x64':
|
|
122
|
-
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.darwin-x64.node'))
|
|
247
|
+
} else if (process.arch === 'arm') {
|
|
248
|
+
if (isMusl()) {
|
|
123
249
|
try {
|
|
124
|
-
|
|
125
|
-
nativeBinding = require('./ast-grep-napi.darwin-x64.node')
|
|
126
|
-
} else {
|
|
127
|
-
nativeBinding = require('@ast-grep/napi-darwin-x64')
|
|
128
|
-
}
|
|
250
|
+
return require('./ast-grep-napi.linux-arm-musleabihf.node')
|
|
129
251
|
} catch (e) {
|
|
130
|
-
|
|
252
|
+
loadErrors.push(e)
|
|
131
253
|
}
|
|
132
|
-
break
|
|
133
|
-
case 'arm64':
|
|
134
|
-
localFileExisted = existsSync(
|
|
135
|
-
join(__dirname, 'ast-grep-napi.darwin-arm64.node')
|
|
136
|
-
)
|
|
137
254
|
try {
|
|
138
|
-
|
|
139
|
-
nativeBinding = require('./ast-grep-napi.darwin-arm64.node')
|
|
140
|
-
} else {
|
|
141
|
-
nativeBinding = require('@ast-grep/napi-darwin-arm64')
|
|
142
|
-
}
|
|
255
|
+
return require('@ast-grep/napi-linux-arm-musleabihf')
|
|
143
256
|
} catch (e) {
|
|
144
|
-
|
|
257
|
+
loadErrors.push(e)
|
|
145
258
|
}
|
|
146
|
-
break
|
|
147
|
-
default:
|
|
148
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
149
|
-
}
|
|
150
|
-
break
|
|
151
|
-
case 'freebsd':
|
|
152
|
-
if (arch !== 'x64') {
|
|
153
|
-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
154
|
-
}
|
|
155
|
-
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.freebsd-x64.node'))
|
|
156
|
-
try {
|
|
157
|
-
if (localFileExisted) {
|
|
158
|
-
nativeBinding = require('./ast-grep-napi.freebsd-x64.node')
|
|
159
259
|
} else {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
break
|
|
166
|
-
case 'linux':
|
|
167
|
-
switch (arch) {
|
|
168
|
-
case 'x64':
|
|
169
|
-
if (isMusl()) {
|
|
170
|
-
localFileExisted = existsSync(
|
|
171
|
-
join(__dirname, 'ast-grep-napi.linux-x64-musl.node')
|
|
172
|
-
)
|
|
173
|
-
try {
|
|
174
|
-
if (localFileExisted) {
|
|
175
|
-
nativeBinding = require('./ast-grep-napi.linux-x64-musl.node')
|
|
176
|
-
} else {
|
|
177
|
-
nativeBinding = require('@ast-grep/napi-linux-x64-musl')
|
|
178
|
-
}
|
|
179
|
-
} catch (e) {
|
|
180
|
-
loadError = e
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
localFileExisted = existsSync(
|
|
184
|
-
join(__dirname, 'ast-grep-napi.linux-x64-gnu.node')
|
|
185
|
-
)
|
|
186
|
-
try {
|
|
187
|
-
if (localFileExisted) {
|
|
188
|
-
nativeBinding = require('./ast-grep-napi.linux-x64-gnu.node')
|
|
189
|
-
} else {
|
|
190
|
-
nativeBinding = require('@ast-grep/napi-linux-x64-gnu')
|
|
191
|
-
}
|
|
192
|
-
} catch (e) {
|
|
193
|
-
loadError = e
|
|
194
|
-
}
|
|
260
|
+
try {
|
|
261
|
+
return require('./ast-grep-napi.linux-arm-gnueabihf.node')
|
|
262
|
+
} catch (e) {
|
|
263
|
+
loadErrors.push(e)
|
|
195
264
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
join(__dirname, 'ast-grep-napi.linux-arm64-musl.node')
|
|
201
|
-
)
|
|
202
|
-
try {
|
|
203
|
-
if (localFileExisted) {
|
|
204
|
-
nativeBinding = require('./ast-grep-napi.linux-arm64-musl.node')
|
|
205
|
-
} else {
|
|
206
|
-
nativeBinding = require('@ast-grep/napi-linux-arm64-musl')
|
|
207
|
-
}
|
|
208
|
-
} catch (e) {
|
|
209
|
-
loadError = e
|
|
210
|
-
}
|
|
211
|
-
} else {
|
|
212
|
-
localFileExisted = existsSync(
|
|
213
|
-
join(__dirname, 'ast-grep-napi.linux-arm64-gnu.node')
|
|
214
|
-
)
|
|
215
|
-
try {
|
|
216
|
-
if (localFileExisted) {
|
|
217
|
-
nativeBinding = require('./ast-grep-napi.linux-arm64-gnu.node')
|
|
218
|
-
} else {
|
|
219
|
-
nativeBinding = require('@ast-grep/napi-linux-arm64-gnu')
|
|
220
|
-
}
|
|
221
|
-
} catch (e) {
|
|
222
|
-
loadError = e
|
|
223
|
-
}
|
|
265
|
+
try {
|
|
266
|
+
return require('@ast-grep/napi-linux-arm-gnueabihf')
|
|
267
|
+
} catch (e) {
|
|
268
|
+
loadErrors.push(e)
|
|
224
269
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (localFileExisted) {
|
|
233
|
-
nativeBinding = require('./ast-grep-napi.linux-arm-musleabihf.node')
|
|
234
|
-
} else {
|
|
235
|
-
nativeBinding = require('@ast-grep/napi-linux-arm-musleabihf')
|
|
236
|
-
}
|
|
237
|
-
} catch (e) {
|
|
238
|
-
loadError = e
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
|
-
localFileExisted = existsSync(
|
|
242
|
-
join(__dirname, 'ast-grep-napi.linux-arm-gnueabihf.node')
|
|
243
|
-
)
|
|
244
|
-
try {
|
|
245
|
-
if (localFileExisted) {
|
|
246
|
-
nativeBinding = require('./ast-grep-napi.linux-arm-gnueabihf.node')
|
|
247
|
-
} else {
|
|
248
|
-
nativeBinding = require('@ast-grep/napi-linux-arm-gnueabihf')
|
|
249
|
-
}
|
|
250
|
-
} catch (e) {
|
|
251
|
-
loadError = e
|
|
252
|
-
}
|
|
270
|
+
}
|
|
271
|
+
} else if (process.arch === 'riscv64') {
|
|
272
|
+
if (isMusl()) {
|
|
273
|
+
try {
|
|
274
|
+
return require('./ast-grep-napi.linux-riscv64-musl.node')
|
|
275
|
+
} catch (e) {
|
|
276
|
+
loadErrors.push(e)
|
|
253
277
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
join(__dirname, 'ast-grep-napi.linux-riscv64-musl.node')
|
|
259
|
-
)
|
|
260
|
-
try {
|
|
261
|
-
if (localFileExisted) {
|
|
262
|
-
nativeBinding = require('./ast-grep-napi.linux-riscv64-musl.node')
|
|
263
|
-
} else {
|
|
264
|
-
nativeBinding = require('@ast-grep/napi-linux-riscv64-musl')
|
|
265
|
-
}
|
|
266
|
-
} catch (e) {
|
|
267
|
-
loadError = e
|
|
268
|
-
}
|
|
269
|
-
} else {
|
|
270
|
-
localFileExisted = existsSync(
|
|
271
|
-
join(__dirname, 'ast-grep-napi.linux-riscv64-gnu.node')
|
|
272
|
-
)
|
|
273
|
-
try {
|
|
274
|
-
if (localFileExisted) {
|
|
275
|
-
nativeBinding = require('./ast-grep-napi.linux-riscv64-gnu.node')
|
|
276
|
-
} else {
|
|
277
|
-
nativeBinding = require('@ast-grep/napi-linux-riscv64-gnu')
|
|
278
|
-
}
|
|
279
|
-
} catch (e) {
|
|
280
|
-
loadError = e
|
|
281
|
-
}
|
|
278
|
+
try {
|
|
279
|
+
return require('@ast-grep/napi-linux-riscv64-musl')
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e)
|
|
282
282
|
}
|
|
283
|
-
|
|
284
|
-
case 's390x':
|
|
285
|
-
localFileExisted = existsSync(
|
|
286
|
-
join(__dirname, 'ast-grep-napi.linux-s390x-gnu.node')
|
|
287
|
-
)
|
|
283
|
+
} else {
|
|
288
284
|
try {
|
|
289
|
-
|
|
290
|
-
nativeBinding = require('./ast-grep-napi.linux-s390x-gnu.node')
|
|
291
|
-
} else {
|
|
292
|
-
nativeBinding = require('@ast-grep/napi-linux-s390x-gnu')
|
|
293
|
-
}
|
|
285
|
+
return require('./ast-grep-napi.linux-riscv64-gnu.node')
|
|
294
286
|
} catch (e) {
|
|
295
|
-
|
|
287
|
+
loadErrors.push(e)
|
|
296
288
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
289
|
+
try {
|
|
290
|
+
return require('@ast-grep/napi-linux-riscv64-gnu')
|
|
291
|
+
} catch (e) {
|
|
292
|
+
loadErrors.push(e)
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
} else if (process.arch === 'ppc64') {
|
|
296
|
+
try {
|
|
297
|
+
return require('./ast-grep-napi.linux-ppc64-gnu.node')
|
|
298
|
+
} catch (e) {
|
|
299
|
+
loadErrors.push(e)
|
|
300
|
+
}
|
|
301
|
+
try {
|
|
302
|
+
return require('@ast-grep/napi-linux-ppc64-gnu')
|
|
303
|
+
} catch (e) {
|
|
304
|
+
loadErrors.push(e)
|
|
305
|
+
}
|
|
306
|
+
} else if (process.arch === 's390x') {
|
|
307
|
+
try {
|
|
308
|
+
return require('./ast-grep-napi.linux-s390x-gnu.node')
|
|
309
|
+
} catch (e) {
|
|
310
|
+
loadErrors.push(e)
|
|
311
|
+
}
|
|
312
|
+
try {
|
|
313
|
+
return require('@ast-grep/napi-linux-s390x-gnu')
|
|
314
|
+
} catch (e) {
|
|
315
|
+
loadErrors.push(e)
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
319
|
+
}
|
|
320
|
+
} else if (process.platform === 'openharmony') {
|
|
321
|
+
if (process.arch === 'arm64') {
|
|
322
|
+
try {
|
|
323
|
+
return require('./ast-grep-napi.linux-arm64-ohos.node')
|
|
324
|
+
} catch (e) {
|
|
325
|
+
loadErrors.push(e)
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
return require('@ast-grep/napi-linux-arm64-ohos')
|
|
329
|
+
} catch (e) {
|
|
330
|
+
loadErrors.push(e)
|
|
331
|
+
}
|
|
332
|
+
} else if (process.arch === 'x64') {
|
|
333
|
+
try {
|
|
334
|
+
return require('./ast-grep-napi.linux-x64-ohos.node')
|
|
335
|
+
} catch (e) {
|
|
336
|
+
loadErrors.push(e)
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
return require('@ast-grep/napi-linux-x64-ohos')
|
|
340
|
+
} catch (e) {
|
|
341
|
+
loadErrors.push(e)
|
|
342
|
+
}
|
|
343
|
+
} else if (process.arch === 'arm') {
|
|
344
|
+
try {
|
|
345
|
+
return require('./ast-grep-napi.linux-arm-ohos.node')
|
|
346
|
+
} catch (e) {
|
|
347
|
+
loadErrors.push(e)
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
return require('@ast-grep/napi-linux-arm-ohos')
|
|
351
|
+
} catch (e) {
|
|
352
|
+
loadErrors.push(e)
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
|
300
356
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
357
|
+
} else {
|
|
358
|
+
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
nativeBinding = requireNative()
|
|
363
|
+
|
|
364
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
365
|
+
try {
|
|
366
|
+
nativeBinding = require('./ast-grep-napi.wasi.cjs')
|
|
367
|
+
} catch (err) {
|
|
368
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
369
|
+
loadErrors.push(err)
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
if (!nativeBinding) {
|
|
373
|
+
try {
|
|
374
|
+
nativeBinding = require('@ast-grep/napi-wasm32-wasi')
|
|
375
|
+
} catch (err) {
|
|
376
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
377
|
+
loadErrors.push(err)
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
304
381
|
}
|
|
305
382
|
|
|
306
383
|
if (!nativeBinding) {
|
|
307
|
-
if (
|
|
308
|
-
throw
|
|
384
|
+
if (loadErrors.length > 0) {
|
|
385
|
+
throw new Error(
|
|
386
|
+
`Cannot find native binding. ` +
|
|
387
|
+
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
388
|
+
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
389
|
+
{ cause: loadErrors }
|
|
390
|
+
)
|
|
309
391
|
}
|
|
310
392
|
throw new Error(`Failed to load native binding`)
|
|
311
393
|
}
|
|
312
394
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
module.exports.
|
|
316
|
-
module.exports.
|
|
317
|
-
module.exports.
|
|
318
|
-
module.exports.
|
|
319
|
-
module.exports.parse = parse
|
|
320
|
-
module.exports.parseAsync = parseAsync
|
|
321
|
-
module.exports.
|
|
322
|
-
module.exports.pattern = pattern
|
|
323
|
-
module.exports.
|
|
324
|
-
module.exports.
|
|
325
|
-
module.exports.html = html
|
|
326
|
-
module.exports.js = js
|
|
327
|
-
module.exports.jsx = jsx
|
|
328
|
-
module.exports.ts = ts
|
|
329
|
-
module.exports.tsx = tsx
|
|
330
|
-
module.exports.css = css
|
|
395
|
+
module.exports = nativeBinding
|
|
396
|
+
module.exports.SgNode = nativeBinding.SgNode
|
|
397
|
+
module.exports.SgRoot = nativeBinding.SgRoot
|
|
398
|
+
module.exports.findInFiles = nativeBinding.findInFiles
|
|
399
|
+
module.exports.kind = nativeBinding.kind
|
|
400
|
+
module.exports.Lang = nativeBinding.Lang
|
|
401
|
+
module.exports.parse = nativeBinding.parse
|
|
402
|
+
module.exports.parseAsync = nativeBinding.parseAsync
|
|
403
|
+
module.exports.parseFiles = nativeBinding.parseFiles
|
|
404
|
+
module.exports.pattern = nativeBinding.pattern
|
|
405
|
+
module.exports.registerDynamicLanguage = nativeBinding.registerDynamicLanguage
|
|
406
|
+
module.exports.css = nativeBinding.css
|
|
407
|
+
module.exports.html = nativeBinding.html
|
|
408
|
+
module.exports.js = nativeBinding.js
|
|
409
|
+
module.exports.jsx = nativeBinding.jsx
|
|
410
|
+
module.exports.ts = nativeBinding.ts
|
|
411
|
+
module.exports.tsx = nativeBinding.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ast-grep/napi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.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",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"lang/*.ts"
|
|
21
21
|
],
|
|
22
22
|
"napi": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
"binaryName": "ast-grep-napi",
|
|
24
|
+
"targets": [
|
|
25
|
+
"x86_64-unknown-linux-gnu",
|
|
26
|
+
"x86_64-pc-windows-msvc",
|
|
27
|
+
"x86_64-apple-darwin",
|
|
28
|
+
"i686-pc-windows-msvc",
|
|
29
|
+
"aarch64-apple-darwin",
|
|
30
|
+
"aarch64-pc-windows-msvc",
|
|
31
|
+
"aarch64-unknown-linux-gnu",
|
|
32
|
+
"aarch64-unknown-linux-musl",
|
|
33
|
+
"x64-unknown-linux-musl"
|
|
34
|
+
]
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">= 10"
|
|
@@ -44,20 +44,23 @@
|
|
|
44
44
|
"artifacts": "napi artifacts",
|
|
45
45
|
"build": "napi build --no-const-enum --dts ignore.d.ts --platform --release",
|
|
46
46
|
"build:debug": "napi build --no-const-enum --dts ignore.d.ts --platform",
|
|
47
|
-
"prepublishOnly": "napi prepublish -t npm --
|
|
47
|
+
"prepublishOnly": "napi prepublish -t npm --no-gh-release",
|
|
48
48
|
"pretest": "ts-node scripts/generateTypes.ts --test-only",
|
|
49
49
|
"test": "tsc --noEmit && ava",
|
|
50
50
|
"version": "napi version",
|
|
51
|
-
"lint": "oxlint",
|
|
51
|
+
"lint": "oxlint && dprint check",
|
|
52
|
+
"format": "dprint fmt",
|
|
53
|
+
"format:check": "dprint check",
|
|
52
54
|
"typegen": "ts-node scripts/generateTypes.ts"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
|
-
"@ast-grep/napi": "0.38.
|
|
56
|
-
"@napi-rs/cli": "
|
|
57
|
+
"@ast-grep/napi": "0.38.7",
|
|
58
|
+
"@napi-rs/cli": "3.0.0",
|
|
57
59
|
"@types/node": "^22.10.2",
|
|
58
|
-
"oxlint": "1.
|
|
59
|
-
"ava": "6.4.
|
|
60
|
+
"oxlint": "1.7.0",
|
|
61
|
+
"ava": "6.4.1",
|
|
60
62
|
"chalk": "5.4.1",
|
|
63
|
+
"dprint": "0.50.1",
|
|
61
64
|
"smol-toml": "^1.3.1",
|
|
62
65
|
"ts-node": "10.9.2",
|
|
63
66
|
"typescript": "5.8.3"
|
|
@@ -76,14 +79,14 @@
|
|
|
76
79
|
}
|
|
77
80
|
},
|
|
78
81
|
"optionalDependencies": {
|
|
79
|
-
"@ast-grep/napi-
|
|
80
|
-
"@ast-grep/napi-
|
|
81
|
-
"@ast-grep/napi-
|
|
82
|
-
"@ast-grep/napi-win32-ia32-msvc": "0.
|
|
83
|
-
"@ast-grep/napi-darwin-arm64": "0.
|
|
84
|
-
"@ast-grep/napi-win32-arm64-msvc": "0.
|
|
85
|
-
"@ast-grep/napi-linux-arm64-gnu": "0.
|
|
86
|
-
"@ast-grep/napi-linux-arm64-musl": "0.
|
|
87
|
-
"@ast-grep/napi-linux-x64-musl": "0.
|
|
82
|
+
"@ast-grep/napi-linux-x64-gnu": "0.39.1",
|
|
83
|
+
"@ast-grep/napi-win32-x64-msvc": "0.39.1",
|
|
84
|
+
"@ast-grep/napi-darwin-x64": "0.39.1",
|
|
85
|
+
"@ast-grep/napi-win32-ia32-msvc": "0.39.1",
|
|
86
|
+
"@ast-grep/napi-darwin-arm64": "0.39.1",
|
|
87
|
+
"@ast-grep/napi-win32-arm64-msvc": "0.39.1",
|
|
88
|
+
"@ast-grep/napi-linux-arm64-gnu": "0.39.1",
|
|
89
|
+
"@ast-grep/napi-linux-arm64-musl": "0.39.1",
|
|
90
|
+
"@ast-grep/napi-linux-x64-musl": "0.39.1"
|
|
88
91
|
}
|
|
89
92
|
}
|
package/types/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { NapiConfig, FindConfig, FileOption } from './config'
|
|
1
|
+
import type { FileOption, FindConfig, NapiConfig } from './config'
|
|
3
2
|
import type { NapiLang } from './lang'
|
|
3
|
+
import type { SgNode, SgRoot } from './sgnode'
|
|
4
4
|
import type { NamedKinds, TypesMap } from './staticTypes'
|
|
5
5
|
|
|
6
6
|
export declare function parseFiles<M extends TypesMap>(
|
|
@@ -43,4 +43,4 @@ export declare function findInFiles<M extends TypesMap>(
|
|
|
43
43
|
lang: NapiLang,
|
|
44
44
|
config: FindConfig<M>,
|
|
45
45
|
callback: (err: null | Error, result: SgNode<M>[]) => void,
|
|
46
|
-
): Promise<number>
|
|
46
|
+
): Promise<number>
|
package/types/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Rule } from './rule'
|
|
2
1
|
import type { NapiLang } from './lang'
|
|
2
|
+
import type { Rule } from './rule'
|
|
3
3
|
import type { TypesMap } from './staticTypes'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -36,4 +36,4 @@ export interface FindConfig<M extends TypesMap = TypesMap> {
|
|
|
36
36
|
* It is slightly different from https://ast-grep.github.io/reference/sgconfig.html#languageglobs
|
|
37
37
|
*/
|
|
38
38
|
languageGlobs?: Array<string>
|
|
39
|
-
}
|
|
39
|
+
}
|
package/types/deprecated.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { FindConfig, NapiConfig } from './config'
|
|
2
|
+
import type { SgNode, SgRoot } from './sgnode'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated language specific objects are deprecated
|
package/types/lang.d.ts
CHANGED
|
@@ -24,4 +24,4 @@ export interface DynamicLangRegistrations {
|
|
|
24
24
|
* @experimental
|
|
25
25
|
* Register dynamic languages. This function should be called exactly once in the program.
|
|
26
26
|
*/
|
|
27
|
-
export declare function registerDynamicLanguage(langs: DynamicLangRegistrations): void
|
|
27
|
+
export declare function registerDynamicLanguage(langs: DynamicLangRegistrations): void
|
package/types/rule.d.ts
CHANGED
package/types/sgnode.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import type { NapiConfig } from './config'
|
|
1
2
|
import type {
|
|
2
|
-
|
|
3
|
-
TypesInField,
|
|
4
|
-
TypesMap,
|
|
3
|
+
ChildKinds,
|
|
5
4
|
ExtractField,
|
|
5
|
+
FieldNames,
|
|
6
6
|
Kinds,
|
|
7
|
+
NamedChildKinds,
|
|
8
|
+
NamedKinds,
|
|
7
9
|
NodeFieldInfo,
|
|
8
10
|
RootKind,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
NamedChildKinds,
|
|
11
|
+
TypesInField,
|
|
12
|
+
TypesMap,
|
|
12
13
|
} from './staticTypes'
|
|
13
|
-
import type { NapiConfig } from './config'
|
|
14
14
|
|
|
15
15
|
export interface Edit {
|
|
16
16
|
/** The start position of the edit */
|
|
@@ -106,11 +106,9 @@ interface NodeMethod<M extends TypesMap, Args extends unknown[] = []> {
|
|
|
106
106
|
* if K contains string, return general SgNode. Otherwise,
|
|
107
107
|
* if K is a literal union, return a union of SgNode of each kind.
|
|
108
108
|
*/
|
|
109
|
-
type RefineNode<M extends TypesMap, K> = string extends K
|
|
110
|
-
? SgNode<M>
|
|
111
|
-
:
|
|
112
|
-
? SgNode<M, K>
|
|
113
|
-
: never
|
|
109
|
+
type RefineNode<M extends TypesMap, K> = string extends K ? SgNode<M>
|
|
110
|
+
: K extends Kinds<M> ? SgNode<M, K>
|
|
111
|
+
: never
|
|
114
112
|
|
|
115
113
|
/**
|
|
116
114
|
* return the SgNode of the field in the node.
|
|
@@ -124,6 +122,5 @@ type FieldNode<
|
|
|
124
122
|
|
|
125
123
|
type FieldNodeImpl<M extends TypesMap, I extends NodeFieldInfo> = I extends {
|
|
126
124
|
required: true
|
|
127
|
-
}
|
|
128
|
-
? RefineNode<M, TypesInField<M, I>>
|
|
125
|
+
} ? RefineNode<M, TypesInField<M, I>>
|
|
129
126
|
: RefineNode<M, TypesInField<M, I>> | null
|
package/types/staticTypes.d.ts
CHANGED
|
@@ -36,15 +36,13 @@ export interface TypesMap {
|
|
|
36
36
|
[key: string]: NodeType
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export type FieldNames<N extends NodeType> = N extends { fields: infer F }
|
|
40
|
-
? keyof F
|
|
39
|
+
export type FieldNames<N extends NodeType> = N extends { fields: infer F } ? keyof F
|
|
41
40
|
: string
|
|
42
41
|
|
|
43
42
|
export type ExtractField<
|
|
44
43
|
N extends NodeType,
|
|
45
44
|
F extends FieldNames<N>,
|
|
46
|
-
> = N['fields'] extends Record<F, NodeFieldInfo>
|
|
47
|
-
? N['fields'][F]
|
|
45
|
+
> = N['fields'] extends Record<F, NodeFieldInfo> ? N['fields'][F]
|
|
48
46
|
: NodeFieldInfo
|
|
49
47
|
|
|
50
48
|
// in case of empty types array, return string as fallback
|
|
@@ -58,8 +56,7 @@ export type TypesInField<M extends TypesMap, I extends NodeFieldInfo> = NoNever<
|
|
|
58
56
|
export type NamedChildKinds<
|
|
59
57
|
M extends TypesMap,
|
|
60
58
|
T extends Kinds<M>,
|
|
61
|
-
> = M[T] extends { children: infer C extends NodeFieldInfo }
|
|
62
|
-
? TypesInField<M, C>
|
|
59
|
+
> = M[T] extends { children: infer C extends NodeFieldInfo } ? TypesInField<M, C>
|
|
63
60
|
: NamedKinds<M>
|
|
64
61
|
export type ChildKinds<M extends TypesMap, T extends Kinds<M>> =
|
|
65
62
|
| NamedChildKinds<M, T>
|
|
@@ -70,9 +67,8 @@ export type ChildKinds<M extends TypesMap, T extends Kinds<M>> =
|
|
|
70
67
|
* e.g. like `expression` => `binary_expression` | `unary_expression` | ...
|
|
71
68
|
*/
|
|
72
69
|
type ResolveType<M extends TypesMap, K> = K extends keyof M
|
|
73
|
-
? M[K] extends { subtypes: infer S extends NodeBasicInfo[] }
|
|
74
|
-
|
|
75
|
-
: K
|
|
70
|
+
? M[K] extends { subtypes: infer S extends NodeBasicInfo[] } ? ResolveType<M, S[number]['type']>
|
|
71
|
+
: K
|
|
76
72
|
: K
|
|
77
73
|
|
|
78
74
|
/**
|
|
@@ -103,4 +99,4 @@ export type Kinds<M extends TypesMap = TypesMap> =
|
|
|
103
99
|
export type RootKind<M extends TypesMap> = NoNever<
|
|
104
100
|
Extract<M[keyof M], { root: true }>['type'],
|
|
105
101
|
Kinds<M>
|
|
106
|
-
>
|
|
102
|
+
>
|