@react-native-windows/codegen 0.0.0-canary.4 → 0.0.0-canary.41
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/CHANGELOG.md +359 -4
- package/bin.js +0 -0
- package/lib-commonjs/Cli.d.ts +7 -0
- package/lib-commonjs/Cli.js +60 -0
- package/lib-commonjs/Cli.js.map +1 -0
- package/lib-commonjs/generators/AliasGen.d.ts +11 -0
- package/lib-commonjs/generators/AliasGen.js +72 -0
- package/lib-commonjs/generators/AliasGen.js.map +1 -0
- package/lib-commonjs/generators/AliasManaging.d.ts +15 -0
- package/lib-commonjs/generators/AliasManaging.js +49 -0
- package/lib-commonjs/generators/AliasManaging.js.map +1 -0
- package/lib-commonjs/generators/GenerateNM2.d.ts +12 -0
- package/lib-commonjs/generators/GenerateNM2.js +94 -0
- package/lib-commonjs/generators/GenerateNM2.js.map +1 -0
- package/lib-commonjs/generators/GenerateTypeScript.d.ts +11 -0
- package/lib-commonjs/generators/GenerateTypeScript.js +166 -0
- package/lib-commonjs/generators/GenerateTypeScript.js.map +1 -0
- package/lib-commonjs/generators/ObjectTypes.d.ts +8 -0
- package/lib-commonjs/generators/ObjectTypes.js +53 -0
- package/lib-commonjs/generators/ObjectTypes.js.map +1 -0
- package/lib-commonjs/generators/ParamTypes.d.ts +11 -0
- package/lib-commonjs/generators/ParamTypes.js +114 -0
- package/lib-commonjs/generators/ParamTypes.js.map +1 -0
- package/lib-commonjs/generators/ReturnTypes.d.ts +9 -0
- package/lib-commonjs/generators/ReturnTypes.js +63 -0
- package/lib-commonjs/generators/ReturnTypes.js.map +1 -0
- package/lib-commonjs/generators/ValidateConstants.d.ts +8 -0
- package/lib-commonjs/generators/ValidateConstants.js +38 -0
- package/lib-commonjs/generators/ValidateConstants.js.map +1 -0
- package/lib-commonjs/generators/ValidateMethods.d.ts +8 -0
- package/lib-commonjs/generators/ValidateMethods.js +70 -0
- package/lib-commonjs/generators/ValidateMethods.js.map +1 -0
- package/lib-commonjs/index.d.ts +35 -0
- package/lib-commonjs/index.js +190 -0
- package/lib-commonjs/index.js.map +1 -0
- package/package.json +32 -18
- package/src/Cli.ts +26 -152
- package/src/generators/AliasGen.ts +105 -0
- package/src/generators/AliasManaging.ts +75 -0
- package/src/generators/GenerateNM2.ts +69 -297
- package/src/generators/GenerateTypeScript.ts +247 -0
- package/src/generators/ObjectTypes.ts +73 -0
- package/src/generators/ParamTypes.ts +220 -0
- package/src/generators/ReturnTypes.ts +92 -0
- package/src/generators/ValidateConstants.ts +50 -0
- package/src/generators/ValidateMethods.ts +135 -0
- package/src/index.ts +321 -0
- package/.eslintrc.js +0 -4
- package/.vscode/launch.json +0 -23
- package/CHANGELOG.json +0 -462
- package/jest.config.js +0 -1
- package/tsconfig.json +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,372 @@
|
|
|
1
1
|
# Change Log - @react-native-windows/codegen
|
|
2
2
|
|
|
3
|
-
This log was last generated on Thu,
|
|
3
|
+
This log was last generated on Thu, 10 Nov 2022 06:15:53 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.0.0-canary.
|
|
7
|
+
## 0.0.0-canary.41
|
|
8
8
|
|
|
9
|
-
Thu,
|
|
9
|
+
Thu, 10 Nov 2022 06:15:53 GMT
|
|
10
10
|
|
|
11
11
|
### Changes
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- integration 9/26/22 (tatianakapos@microsoft.com)
|
|
14
|
+
- Bump @react-native-windows/fs to v0.0.0-canary.8
|
|
15
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.4.0
|
|
16
|
+
- Bump @rnw-scripts/just-task to v2.3.0
|
|
14
17
|
|
|
18
|
+
## 0.0.0-canary.40
|
|
19
|
+
|
|
20
|
+
Tue, 18 Oct 2022 05:12:09 GMT
|
|
21
|
+
|
|
22
|
+
### Changes
|
|
23
|
+
|
|
24
|
+
- Use newer react-native-codegen generators (30809111+acoates-ms@users.noreply.github.com)
|
|
25
|
+
|
|
26
|
+
## 0.0.0-canary.39
|
|
27
|
+
|
|
28
|
+
Sat, 15 Oct 2022 05:12:00 GMT
|
|
29
|
+
|
|
30
|
+
### Changes
|
|
31
|
+
|
|
32
|
+
- Bump @react-native-windows/fs to v0.0.0-canary.7
|
|
33
|
+
|
|
34
|
+
## 0.0.0-canary.38
|
|
35
|
+
|
|
36
|
+
Fri, 07 Oct 2022 05:11:46 GMT
|
|
37
|
+
|
|
38
|
+
### Changes
|
|
39
|
+
|
|
40
|
+
- Remove extra paren in codegen output (30809111+acoates-ms@users.noreply.github.com)
|
|
41
|
+
|
|
42
|
+
## 0.0.0-canary.37
|
|
43
|
+
|
|
44
|
+
Wed, 05 Oct 2022 05:13:46 GMT
|
|
45
|
+
|
|
46
|
+
### Changes
|
|
47
|
+
|
|
48
|
+
- Use react-native-codegen from rn, instead of from react-native-tscodegen (30809111+acoates-ms@users.noreply.github.com)
|
|
49
|
+
- integrate 7/29/22 (tatianakapos@microsoft.com)
|
|
50
|
+
- Bump @react-native-windows/fs to v0.0.0-canary.6
|
|
51
|
+
- Bump @rnw-scripts/eslint-config to v1.1.14
|
|
52
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.3.0
|
|
53
|
+
- Bump @rnw-scripts/just-task to v2.2.6
|
|
54
|
+
|
|
55
|
+
## 0.0.0-canary.36
|
|
56
|
+
|
|
57
|
+
Tue, 27 Sep 2022 05:11:30 GMT
|
|
58
|
+
|
|
59
|
+
### Changes
|
|
60
|
+
|
|
61
|
+
- Export functionality to allow cli to use it (30809111+acoates-ms@users.noreply.github.com)
|
|
62
|
+
|
|
63
|
+
## 0.0.0-canary.35
|
|
64
|
+
|
|
65
|
+
Sat, 04 Jun 2022 05:10:05 GMT
|
|
66
|
+
|
|
67
|
+
### Changes
|
|
68
|
+
|
|
69
|
+
- Bump @react-native-windows/fs to v0.0.0-canary.5
|
|
70
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.2.8
|
|
71
|
+
- Bump @rnw-scripts/just-task to v2.2.5
|
|
72
|
+
|
|
73
|
+
## 0.0.0-canary.34
|
|
74
|
+
|
|
75
|
+
Thu, 12 May 2022 05:09:43 GMT
|
|
76
|
+
|
|
77
|
+
### Changes
|
|
78
|
+
|
|
79
|
+
- Build/dependency fixes (ngerlem@microsoft.com)
|
|
80
|
+
- Bump @react-native-windows/fs to v0.0.0-canary.4
|
|
81
|
+
- Bump @rnw-scripts/eslint-config to v1.1.13
|
|
82
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.2.7
|
|
83
|
+
- Bump @rnw-scripts/just-task to v2.2.4
|
|
84
|
+
|
|
85
|
+
## 0.0.0-canary.33
|
|
86
|
+
|
|
87
|
+
Wed, 11 May 2022 05:08:51 GMT
|
|
88
|
+
|
|
89
|
+
### Changes
|
|
90
|
+
|
|
91
|
+
- Add --methodonly to RNW/codegen (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
92
|
+
|
|
93
|
+
## 0.0.0-canary.32
|
|
94
|
+
|
|
95
|
+
Wed, 27 Apr 2022 05:10:23 GMT
|
|
96
|
+
|
|
97
|
+
### Changes
|
|
98
|
+
|
|
99
|
+
- Merge (34109996+chiaramooney@users.noreply.github.com)
|
|
100
|
+
- Bump @react-native-windows/fs to v0.0.0-canary.3
|
|
101
|
+
- Bump @rnw-scripts/eslint-config to v1.1.12
|
|
102
|
+
|
|
103
|
+
## 0.0.0-canary.31
|
|
104
|
+
|
|
105
|
+
Mon, 25 Apr 2022 22:50:30 GMT
|
|
106
|
+
|
|
107
|
+
### Changes
|
|
108
|
+
|
|
109
|
+
- Update globby of @react-native-windows/codegen to remove glob-parent 3.x dependency (dannyvv@microsoft.com)
|
|
110
|
+
|
|
111
|
+
## 0.0.0-canary.30
|
|
112
|
+
|
|
113
|
+
Tue, 12 Apr 2022 05:10:38 GMT
|
|
114
|
+
|
|
115
|
+
### Changes
|
|
116
|
+
|
|
117
|
+
- Fix Overrides (34109996+chiaramooney@users.noreply.github.com)
|
|
118
|
+
- Bump @react-native-windows/fs to v0.0.0-canary.2
|
|
119
|
+
|
|
120
|
+
## 0.0.0-canary.29
|
|
121
|
+
|
|
122
|
+
Fri, 01 Apr 2022 05:09:56 GMT
|
|
123
|
+
|
|
124
|
+
### Changes
|
|
125
|
+
|
|
126
|
+
- Fix publish after promotion to preview (ngerlem@microsoft.com)
|
|
127
|
+
- Bump @react-native-windows/fs to v0.0.0-canary.1
|
|
128
|
+
|
|
129
|
+
## 0.0.0-canary.28
|
|
130
|
+
|
|
131
|
+
Wed, 09 Mar 2022 06:09:07 GMT
|
|
132
|
+
|
|
133
|
+
### Changes
|
|
134
|
+
|
|
135
|
+
- Fix turbo module codegen to generate correct import statement and registration (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
136
|
+
|
|
137
|
+
## 0.0.0-canary.27
|
|
138
|
+
|
|
139
|
+
Fri, 04 Mar 2022 06:09:13 GMT
|
|
140
|
+
|
|
141
|
+
### Changes
|
|
142
|
+
|
|
143
|
+
- Generate fabric eventemitter.cpp (acoates@microsoft.com)
|
|
144
|
+
|
|
145
|
+
## 0.0.0-canary.26
|
|
146
|
+
|
|
147
|
+
Thu, 24 Feb 2022 06:07:47 GMT
|
|
148
|
+
|
|
149
|
+
### Changes
|
|
150
|
+
|
|
151
|
+
- Add TypeScript turbo module definition as new codegen traget (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
152
|
+
|
|
153
|
+
## 0.0.0-canary.25
|
|
154
|
+
|
|
155
|
+
Wed, 09 Feb 2022 06:09:36 GMT
|
|
156
|
+
|
|
157
|
+
### Changes
|
|
158
|
+
|
|
159
|
+
- Bump minimum Node version to 14 (jthysell@microsoft.com)
|
|
160
|
+
- Bump @react-native-windows/fs to v1.0.2
|
|
161
|
+
- Bump @rnw-scripts/eslint-config to v1.1.11
|
|
162
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.2.6
|
|
163
|
+
- Bump @rnw-scripts/just-task to v2.2.3
|
|
164
|
+
- Bump @rnw-scripts/ts-config to v2.0.2
|
|
165
|
+
|
|
166
|
+
## 0.0.0-canary.24
|
|
167
|
+
|
|
168
|
+
Tue, 08 Feb 2022 18:21:23 GMT
|
|
169
|
+
|
|
170
|
+
### Changes
|
|
171
|
+
|
|
172
|
+
- Fix TurboModule codegen document (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
173
|
+
|
|
174
|
+
## 0.0.0-canary.23
|
|
175
|
+
|
|
176
|
+
Sat, 29 Jan 2022 06:08:58 GMT
|
|
177
|
+
|
|
178
|
+
### Changes
|
|
179
|
+
|
|
180
|
+
- Add document for turbo module codegen (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
181
|
+
|
|
182
|
+
## 0.0.0-canary.22
|
|
183
|
+
|
|
184
|
+
Fri, 03 Dec 2021 06:12:10 GMT
|
|
185
|
+
|
|
186
|
+
### Changes
|
|
187
|
+
|
|
188
|
+
- Integrate 11/11 (34109996+chiaramooney@users.noreply.github.com)
|
|
189
|
+
- Bump @react-native-windows/fs to v1.0.1
|
|
190
|
+
- Bump @rnw-scripts/eslint-config to v1.1.10
|
|
191
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.2.5
|
|
192
|
+
- Bump @rnw-scripts/just-task to v2.2.2
|
|
193
|
+
|
|
194
|
+
## 0.0.0-canary.21
|
|
195
|
+
|
|
196
|
+
Thu, 18 Nov 2021 06:11:20 GMT
|
|
197
|
+
|
|
198
|
+
### Changes
|
|
199
|
+
|
|
200
|
+
- Use '@react-native-windows/fs' (ngerlem@microsoft.com)
|
|
201
|
+
- Bump @react-native-windows/fs to v1.0.0
|
|
202
|
+
- Bump @rnw-scripts/eslint-config to v1.1.9
|
|
203
|
+
|
|
204
|
+
## 0.0.0-canary.20
|
|
205
|
+
|
|
206
|
+
Thu, 04 Nov 2021 05:07:29 GMT
|
|
207
|
+
|
|
208
|
+
### Changes
|
|
209
|
+
|
|
210
|
+
- Codegen prints `::React::JSValue` instead of `React::JSValue` (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
211
|
+
|
|
212
|
+
## 0.0.0-canary.20
|
|
213
|
+
|
|
214
|
+
Thu, 04 Nov 2021 05:07:08 GMT
|
|
215
|
+
|
|
216
|
+
### Changes
|
|
217
|
+
|
|
218
|
+
- Codegen prints `::React::JSValue` instead of `React::JSValue` (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
219
|
+
|
|
220
|
+
## 0.0.0-canary.19
|
|
221
|
+
|
|
222
|
+
Sat, 23 Oct 2021 05:06:49 GMT
|
|
223
|
+
|
|
224
|
+
### Changes
|
|
225
|
+
|
|
226
|
+
- Only generate component files if a component is specified (30809111+acoates-ms@users.noreply.github.com)
|
|
227
|
+
|
|
228
|
+
## 0.0.0-canary.18
|
|
229
|
+
|
|
230
|
+
Fri, 22 Oct 2021 05:06:46 GMT
|
|
231
|
+
|
|
232
|
+
### Changes
|
|
233
|
+
|
|
234
|
+
- Built files not included in published package (30809111+acoates-ms@users.noreply.github.com)
|
|
235
|
+
|
|
236
|
+
## 0.0.0-canary.17
|
|
237
|
+
|
|
238
|
+
Thu, 21 Oct 2021 05:08:01 GMT
|
|
239
|
+
|
|
240
|
+
### Changes
|
|
241
|
+
|
|
242
|
+
- Update to typescript 4 (30809111+acoates-ms@users.noreply.github.com)
|
|
243
|
+
|
|
244
|
+
## 0.0.0-canary.16
|
|
245
|
+
|
|
246
|
+
Wed, 29 Sep 2021 05:06:54 GMT
|
|
247
|
+
|
|
248
|
+
### Changes
|
|
249
|
+
|
|
250
|
+
- Check constants in generated turbo module specs (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
251
|
+
|
|
252
|
+
## 0.0.0-canary.15
|
|
253
|
+
|
|
254
|
+
Wed, 15 Sep 2021 05:07:04 GMT
|
|
255
|
+
|
|
256
|
+
### Changes
|
|
257
|
+
|
|
258
|
+
- Generate anonymous objects in correct order for turbo module (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
259
|
+
|
|
260
|
+
## 0.0.0-canary.14
|
|
261
|
+
|
|
262
|
+
Fri, 10 Sep 2021 05:07:31 GMT
|
|
263
|
+
|
|
264
|
+
### Changes
|
|
265
|
+
|
|
266
|
+
- Generate `std::vector<T>` for array types in turbo modules (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
267
|
+
|
|
268
|
+
## 0.0.0-canary.13
|
|
269
|
+
|
|
270
|
+
Thu, 09 Sep 2021 05:07:46 GMT
|
|
271
|
+
|
|
272
|
+
### Changes
|
|
273
|
+
|
|
274
|
+
- Bump to 0.66-based react-native-tscodegen (ngerlem@microsoft.com)
|
|
275
|
+
- Generate nullable type for turbo module (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
276
|
+
|
|
277
|
+
## 0.0.0-canary.12
|
|
278
|
+
|
|
279
|
+
Wed, 08 Sep 2021 05:08:53 GMT
|
|
280
|
+
|
|
281
|
+
### Patches
|
|
282
|
+
|
|
283
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.2.4 (ngerlem@microsoft.com)
|
|
284
|
+
- Bump @rnw-scripts/just-task to v2.2.1 (ngerlem@microsoft.com)
|
|
285
|
+
- Bump @rnw-scripts/ts-config to v2.0.1 (ngerlem@microsoft.com)
|
|
286
|
+
- Bump @rnw-scripts/eslint-config to v1.1.8 (ngerlem@microsoft.com)
|
|
287
|
+
|
|
288
|
+
### Changes
|
|
289
|
+
|
|
290
|
+
- Set consistent node requirements on our packages (ngerlem@microsoft.com)
|
|
291
|
+
- Match Alert module with NativeDialogManagerWindowsSpec.h (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
292
|
+
|
|
293
|
+
## 0.0.0-canary.11
|
|
294
|
+
|
|
295
|
+
Fri, 03 Sep 2021 05:06:04 GMT
|
|
296
|
+
|
|
297
|
+
### Changes
|
|
298
|
+
|
|
299
|
+
- Generate aliased struct for turbo module (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
300
|
+
|
|
301
|
+
## 0.0.0-canary.10
|
|
302
|
+
|
|
303
|
+
Thu, 05 Aug 2021 05:07:20 GMT
|
|
304
|
+
|
|
305
|
+
### Changes
|
|
306
|
+
|
|
307
|
+
- Do not write codegen files if the contents have not changed, as this breaks incremental builds (30809111+acoates-ms@users.noreply.github.com)
|
|
308
|
+
|
|
309
|
+
## 0.0.0-canary.9
|
|
310
|
+
|
|
311
|
+
Fri, 11 Jun 2021 05:08:55 GMT
|
|
312
|
+
|
|
313
|
+
### Patches
|
|
314
|
+
|
|
315
|
+
- Bump @rnw-scripts/just-task to v2.2.0 (ngerlem@microsoft.com)
|
|
316
|
+
|
|
317
|
+
## 0.0.0-canary.8
|
|
318
|
+
|
|
319
|
+
Wed, 09 Jun 2021 05:10:07 GMT
|
|
320
|
+
|
|
321
|
+
### Patches
|
|
322
|
+
|
|
323
|
+
- Bump @rnw-scripts/just-task to v2.1.3 (igklemen@microsoft.com)
|
|
324
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.2.3 (igklemen@microsoft.com)
|
|
325
|
+
|
|
326
|
+
## 0.0.0-canary.7
|
|
327
|
+
|
|
328
|
+
Thu, 03 Jun 2021 05:09:47 GMT
|
|
329
|
+
|
|
330
|
+
### Patches
|
|
331
|
+
|
|
332
|
+
- Bump @rnw-scripts/just-task to v2.1.2 (ngerlem@microsoft.com)
|
|
333
|
+
- Bump @rnw-scripts/ts-config to v2.0.0 (ngerlem@microsoft.com)
|
|
334
|
+
- Bump @rnw-scripts/eslint-config to v1.1.7 (ngerlem@microsoft.com)
|
|
335
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.2.2 (ngerlem@microsoft.com)
|
|
336
|
+
|
|
337
|
+
### Changes
|
|
338
|
+
|
|
339
|
+
- Enable esModuleInterop Repo Wide (ngerlem@microsoft.com)
|
|
340
|
+
|
|
341
|
+
## 0.0.0-canary.6
|
|
342
|
+
|
|
343
|
+
Fri, 21 May 2021 05:17:18 GMT
|
|
344
|
+
|
|
345
|
+
### Patches
|
|
346
|
+
|
|
347
|
+
- Bump @rnw-scripts/just-task to v2.1.1 (ngerlem@microsoft.com)
|
|
348
|
+
- Bump @rnw-scripts/jest-unittest-config to v1.2.1 (ngerlem@microsoft.com)
|
|
349
|
+
|
|
350
|
+
### Changes
|
|
351
|
+
|
|
352
|
+
- Integrate Apr 28 (base of 0.65) Nightly RN Build (ngerlem@microsoft.com)
|
|
353
|
+
|
|
354
|
+
## 0.0.0-canary.5
|
|
355
|
+
|
|
356
|
+
Thu, 13 May 2021 05:11:48 GMT
|
|
357
|
+
|
|
358
|
+
### Changes
|
|
359
|
+
|
|
360
|
+
- Hook up view component codegen (30809111+acoates-ms@users.noreply.github.com)
|
|
361
|
+
|
|
362
|
+
## 0.0.0-canary.4
|
|
363
|
+
|
|
364
|
+
Thu, 04 Mar 2021 05:05:53 GMT
|
|
365
|
+
|
|
366
|
+
### Changes
|
|
367
|
+
|
|
368
|
+
- Update yargs version used and patch y18n version 4.0.0 to 4.0.1 as used by detox of transitive dependencies to address https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7774 (dannyvv@microsoft.com)
|
|
369
|
+
|
|
15
370
|
## 0.0.0-canary.3
|
|
16
371
|
|
|
17
372
|
Thu, 11 Feb 2021 05:08:29 GMT
|
package/bin.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*
|
|
6
|
+
* @format
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
13
|
+
const index_1 = require("./index");
|
|
14
|
+
const argv = yargs_1.default.options({
|
|
15
|
+
file: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
describe: 'file which contains spec',
|
|
18
|
+
},
|
|
19
|
+
files: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
array: true,
|
|
22
|
+
describe: 'glob patterns for files which contains specs',
|
|
23
|
+
},
|
|
24
|
+
ts: {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
describe: 'generate turbo module definition files in TypeScript',
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
methodonly: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
describe: 'generate only method metadata in C++ turbo module spec',
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
outdir: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
describe: 'output directory',
|
|
37
|
+
default: 'codegen',
|
|
38
|
+
},
|
|
39
|
+
test: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
describe: 'Verify that the generated output is unchanged',
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
namespace: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
describe: 'C++/C# Namespace to put generated native modules in',
|
|
47
|
+
default: 'MyNamespace',
|
|
48
|
+
},
|
|
49
|
+
libraryName: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
required: true,
|
|
52
|
+
describe: 'Used for part of the path generated within the codegen dir',
|
|
53
|
+
},
|
|
54
|
+
}).argv;
|
|
55
|
+
if ((argv.file && argv.files) || (!argv.file && !argv.files)) {
|
|
56
|
+
console.error('You must specify either --file or --files.');
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
(0, index_1.runCodeGen)(argv);
|
|
60
|
+
//# sourceMappingURL=Cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../src/Cli.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAEH,kDAA0B;AAC1B,mCAAmC;AAEnC,MAAM,IAAI,GAAG,eAAK,CAAC,OAAO,CAAC;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,0BAA0B;KACrC;IACD,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,8CAA8C;KACzD;IACD,EAAE,EAAE;QACF,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,sDAAsD;QAChE,OAAO,EAAE,KAAK;KACf;IACD,UAAU,EAAE;QACV,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,wDAAwD;QAClE,OAAO,EAAE,KAAK;KACf;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,kBAAkB;QAC5B,OAAO,EAAE,SAAS;KACnB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,+CAA+C;QACzD,OAAO,EAAE,KAAK;KACf;IACD,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,qDAAqD;QAC/D,OAAO,EAAE,aAAa;KACvB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,4DAA4D;KACvE;CACF,CAAC,CAAC,IAAI,CAAC;AAER,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;IAC5D,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport yargs from 'yargs';\nimport {runCodeGen} from './index';\n\nconst argv = yargs.options({\n file: {\n type: 'string',\n describe: 'file which contains spec',\n },\n files: {\n type: 'string',\n array: true,\n describe: 'glob patterns for files which contains specs',\n },\n ts: {\n type: 'boolean',\n describe: 'generate turbo module definition files in TypeScript',\n default: false,\n },\n methodonly: {\n type: 'boolean',\n describe: 'generate only method metadata in C++ turbo module spec',\n default: false,\n },\n outdir: {\n type: 'string',\n describe: 'output directory',\n default: 'codegen',\n },\n test: {\n type: 'boolean',\n describe: 'Verify that the generated output is unchanged',\n default: false,\n },\n namespace: {\n type: 'string',\n describe: 'C++/C# Namespace to put generated native modules in',\n default: 'MyNamespace',\n },\n libraryName: {\n type: 'string',\n required: true,\n describe: 'Used for part of the path generated within the codegen dir',\n },\n}).argv;\n\nif ((argv.file && argv.files) || (!argv.file && !argv.files)) {\n console.error('You must specify either --file or --files.');\n process.exit(1);\n}\n\nrunCodeGen(argv);\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
import type { NativeModuleObjectTypeAnnotation } from 'react-native-tscodegen';
|
|
7
|
+
import { AliasMap } from './AliasManaging';
|
|
8
|
+
export declare function createAliasMap(nativeModuleAliases: {
|
|
9
|
+
[name: string]: NativeModuleObjectTypeAnnotation;
|
|
10
|
+
}): AliasMap;
|
|
11
|
+
export declare function generateAliases(aliases: AliasMap): string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.generateAliases = exports.createAliasMap = void 0;
|
|
9
|
+
const AliasManaging_1 = require("./AliasManaging");
|
|
10
|
+
const ObjectTypes_1 = require("./ObjectTypes");
|
|
11
|
+
function translateObjectBody(type, aliases, baseAliasName, prefix) {
|
|
12
|
+
return type.properties
|
|
13
|
+
.map((prop) => {
|
|
14
|
+
let propType = prop.typeAnnotation;
|
|
15
|
+
if (prop.optional && propType.type !== 'NullableTypeAnnotation') {
|
|
16
|
+
propType = { type: 'NullableTypeAnnotation', typeAnnotation: propType };
|
|
17
|
+
}
|
|
18
|
+
const first = `${prefix}REACT_FIELD(${prop.name})`;
|
|
19
|
+
const second = `${prefix}${(0, ObjectTypes_1.translateField)(propType, aliases, `${baseAliasName}_${prop.name}`)} ${prop.name};`;
|
|
20
|
+
return `${first}\n${second}`;
|
|
21
|
+
})
|
|
22
|
+
.join('\n');
|
|
23
|
+
}
|
|
24
|
+
function createAliasMap(nativeModuleAliases) {
|
|
25
|
+
const aliases = { types: {}, jobs: Object.keys(nativeModuleAliases) };
|
|
26
|
+
for (const aliasName of aliases.jobs) {
|
|
27
|
+
aliases.types[aliasName] = nativeModuleAliases[aliasName];
|
|
28
|
+
}
|
|
29
|
+
return aliases;
|
|
30
|
+
}
|
|
31
|
+
exports.createAliasMap = createAliasMap;
|
|
32
|
+
function generateSingleAlias(aliases, aliasName, aliasCode) {
|
|
33
|
+
const aliasType = aliases.types[aliasName];
|
|
34
|
+
aliasCode[aliasName] = `
|
|
35
|
+
REACT_STRUCT(${(0, AliasManaging_1.getAliasCppName)(aliasName)})
|
|
36
|
+
struct ${(0, AliasManaging_1.getAliasCppName)(aliasName)} {
|
|
37
|
+
${translateObjectBody(aliasType, aliases, aliasName, ' ')}
|
|
38
|
+
};
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
function generateNestedAliasesInCorrectOrder(aliases, aliasCode, aliasOrder) {
|
|
42
|
+
// retrieve and clean all ungenerated aliases
|
|
43
|
+
const jobs = aliases.jobs;
|
|
44
|
+
aliases.jobs = [];
|
|
45
|
+
// generate each one in its found order
|
|
46
|
+
for (const aliasName of jobs) {
|
|
47
|
+
// generate a new struct and all fields will be examined
|
|
48
|
+
// new anonymous objects could be found
|
|
49
|
+
// they will be stored in aliases.jobs
|
|
50
|
+
generateSingleAlias(aliases, aliasName, aliasCode);
|
|
51
|
+
// nested C++ structs must be put before the current C++ struct
|
|
52
|
+
// as they will be used in the current C++ struct
|
|
53
|
+
// the order will be perfectly and easily ensured by doing this recursively
|
|
54
|
+
generateNestedAliasesInCorrectOrder(aliases, aliasCode, aliasOrder);
|
|
55
|
+
// all referenced C++ structs are generated
|
|
56
|
+
// put the current one following them
|
|
57
|
+
aliasOrder.push(aliasName);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function generateAliases(aliases) {
|
|
61
|
+
const aliasCode = {};
|
|
62
|
+
const aliasOrder = [];
|
|
63
|
+
generateNestedAliasesInCorrectOrder(aliases, aliasCode, aliasOrder);
|
|
64
|
+
// aliasOrder now has the correct order of C++ struct code
|
|
65
|
+
let traversedAliasedStructs = '';
|
|
66
|
+
for (const aliasName of aliasOrder) {
|
|
67
|
+
traversedAliasedStructs = `${traversedAliasedStructs}${aliasCode[aliasName]}`;
|
|
68
|
+
}
|
|
69
|
+
return traversedAliasedStructs;
|
|
70
|
+
}
|
|
71
|
+
exports.generateAliases = generateAliases;
|
|
72
|
+
//# sourceMappingURL=AliasGen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AliasGen.js","sourceRoot":"","sources":["../../src/generators/AliasGen.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n'use strict';\n\nimport type {\n NativeModuleBaseTypeAnnotation,\n NativeModuleObjectTypeAnnotation,\n NamedShape,\n Nullable,\n} from 'react-native-tscodegen';\nimport {AliasMap, getAliasCppName} from './AliasManaging';\nimport {translateField} from './ObjectTypes';\n\nfunction translateObjectBody(\n type: NativeModuleObjectTypeAnnotation,\n aliases: AliasMap,\n baseAliasName: string,\n prefix: string,\n) {\n return type.properties\n .map((prop: NamedShape<Nullable<NativeModuleBaseTypeAnnotation>>) => {\n let propType = prop.typeAnnotation;\n if (prop.optional && propType.type !== 'NullableTypeAnnotation') {\n propType = {type: 'NullableTypeAnnotation', typeAnnotation: propType};\n }\n const first = `${prefix}REACT_FIELD(${prop.name})`;\n const second = `${prefix}${translateField(\n propType,\n aliases,\n `${baseAliasName}_${prop.name}`,\n )} ${prop.name};`;\n return `${first}\\n${second}`;\n })\n .join('\\n');\n}\n\nexport function createAliasMap(nativeModuleAliases: {\n [name: string]: NativeModuleObjectTypeAnnotation;\n}): AliasMap {\n const aliases: AliasMap = {types: {}, jobs: Object.keys(nativeModuleAliases)};\n for (const aliasName of aliases.jobs) {\n aliases.types[aliasName] = nativeModuleAliases[aliasName];\n }\n return aliases;\n}\n\ninterface AliasCodeMap {\n [name: string]: string;\n}\n\nfunction generateSingleAlias(\n aliases: AliasMap,\n aliasName: string,\n aliasCode: AliasCodeMap,\n): void {\n const aliasType = <NativeModuleObjectTypeAnnotation>aliases.types[aliasName];\n aliasCode[aliasName] = `\nREACT_STRUCT(${getAliasCppName(aliasName)})\nstruct ${getAliasCppName(aliasName)} {\n${translateObjectBody(aliasType, aliases, aliasName, ' ')}\n};\n`;\n}\n\nfunction generateNestedAliasesInCorrectOrder(\n aliases: AliasMap,\n aliasCode: AliasCodeMap,\n aliasOrder: string[],\n): void {\n // retrieve and clean all ungenerated aliases\n const jobs = aliases.jobs;\n aliases.jobs = [];\n\n // generate each one in its found order\n for (const aliasName of jobs) {\n // generate a new struct and all fields will be examined\n // new anonymous objects could be found\n // they will be stored in aliases.jobs\n generateSingleAlias(aliases, aliasName, aliasCode);\n // nested C++ structs must be put before the current C++ struct\n // as they will be used in the current C++ struct\n // the order will be perfectly and easily ensured by doing this recursively\n generateNestedAliasesInCorrectOrder(aliases, aliasCode, aliasOrder);\n // all referenced C++ structs are generated\n // put the current one following them\n aliasOrder.push(aliasName);\n }\n}\n\nexport function generateAliases(aliases: AliasMap): string {\n const aliasCode: AliasCodeMap = {};\n const aliasOrder: string[] = [];\n generateNestedAliasesInCorrectOrder(aliases, aliasCode, aliasOrder);\n\n // aliasOrder now has the correct order of C++ struct code\n let traversedAliasedStructs = '';\n for (const aliasName of aliasOrder) {\n traversedAliasedStructs = `${traversedAliasedStructs}${aliasCode[aliasName]}`;\n }\n return traversedAliasedStructs;\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
import type { NativeModuleObjectTypeAnnotation } from 'react-native-tscodegen';
|
|
7
|
+
export declare function setPreferredModuleName(moduleName: string): void;
|
|
8
|
+
export declare function getAliasCppName(typeName: string): string;
|
|
9
|
+
export interface AliasMap {
|
|
10
|
+
types: {
|
|
11
|
+
[name: string]: NativeModuleObjectTypeAnnotation | undefined;
|
|
12
|
+
};
|
|
13
|
+
jobs: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare function getAnonymousAliasCppName(aliases: AliasMap, baseAliasName: string, objectType: NativeModuleObjectTypeAnnotation): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getAnonymousAliasCppName = exports.getAliasCppName = exports.setPreferredModuleName = void 0;
|
|
9
|
+
let preferredModuleName = '';
|
|
10
|
+
function setPreferredModuleName(moduleName) {
|
|
11
|
+
preferredModuleName = moduleName;
|
|
12
|
+
}
|
|
13
|
+
exports.setPreferredModuleName = setPreferredModuleName;
|
|
14
|
+
function getAliasCppName(typeName) {
|
|
15
|
+
return `${preferredModuleName}Spec_${typeName}`;
|
|
16
|
+
}
|
|
17
|
+
exports.getAliasCppName = getAliasCppName;
|
|
18
|
+
const ExtendedObjectKey = '$RNW-TURBOMODULE-ALIAS';
|
|
19
|
+
function recordAnonymouseAlias(aliases, baseAliasName, extended) {
|
|
20
|
+
extended[ExtendedObjectKey] = baseAliasName;
|
|
21
|
+
aliases.types[baseAliasName] = extended;
|
|
22
|
+
aliases.jobs.push(baseAliasName);
|
|
23
|
+
return baseAliasName;
|
|
24
|
+
}
|
|
25
|
+
function getAnonymousAliasCppName(aliases, baseAliasName, objectType) {
|
|
26
|
+
// someone found an anonymous object literal type
|
|
27
|
+
// if the ExtendedObjectKey flag has been set
|
|
28
|
+
// then it is a known one
|
|
29
|
+
// this happens because method signatures are generate twice in spec and error messages
|
|
30
|
+
const extended = objectType;
|
|
31
|
+
const key = extended[ExtendedObjectKey];
|
|
32
|
+
if (key !== undefined) {
|
|
33
|
+
return getAliasCppName(key);
|
|
34
|
+
}
|
|
35
|
+
// if the ExtendedObjectKey flag has not been set
|
|
36
|
+
// it means it is a unknown one
|
|
37
|
+
// associate the name with this object literal type and return
|
|
38
|
+
if (aliases.types[baseAliasName] === undefined) {
|
|
39
|
+
return getAliasCppName(recordAnonymouseAlias(aliases, baseAliasName, extended));
|
|
40
|
+
}
|
|
41
|
+
// sometimes names could be anonymous
|
|
42
|
+
let index = 2;
|
|
43
|
+
while (aliases.types[`${baseAliasName}${index}`] !== undefined) {
|
|
44
|
+
index++;
|
|
45
|
+
}
|
|
46
|
+
return getAliasCppName(recordAnonymouseAlias(aliases, `${baseAliasName}${index}`, extended));
|
|
47
|
+
}
|
|
48
|
+
exports.getAnonymousAliasCppName = getAnonymousAliasCppName;
|
|
49
|
+
//# sourceMappingURL=AliasManaging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AliasManaging.js","sourceRoot":"","sources":["../../src/generators/AliasManaging.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;;;AAIb,IAAI,mBAAmB,GAAW,EAAE,CAAC;AAErC,SAAgB,sBAAsB,CAAC,UAAkB;IACvD,mBAAmB,GAAG,UAAU,CAAC;AACnC,CAAC;AAFD,wDAEC;AAED,SAAgB,eAAe,CAAC,QAAgB;IAC9C,OAAO,GAAG,mBAAmB,QAAQ,QAAQ,EAAE,CAAC;AAClD,CAAC;AAFD,0CAEC;AAOD,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAKnD,SAAS,qBAAqB,CAC5B,OAAiB,EACjB,aAAqB,EACrB,QAAwB;IAExB,QAAQ,CAAC,iBAAiB,CAAC,GAAG,aAAa,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACjC,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,SAAgB,wBAAwB,CACtC,OAAiB,EACjB,aAAqB,EACrB,UAA4C;IAE5C,iDAAiD;IACjD,6CAA6C;IAC7C,yBAAyB;IACzB,uFAAuF;IACvF,MAAM,QAAQ,GAAmB,UAAU,CAAC;IAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACxC,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;KAC7B;IAED,iDAAiD;IACjD,+BAA+B;IAC/B,8DAA8D;IAC9D,IAAI,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,SAAS,EAAE;QAC9C,OAAO,eAAe,CACpB,qBAAqB,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,CACxD,CAAC;KACH;IAED,qCAAqC;IACrC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,aAAa,GAAG,KAAK,EAAE,CAAC,KAAK,SAAS,EAAE;QAC9D,KAAK,EAAE,CAAC;KACT;IAED,OAAO,eAAe,CACpB,qBAAqB,CAAC,OAAO,EAAE,GAAG,aAAa,GAAG,KAAK,EAAE,EAAE,QAAQ,CAAC,CACrE,CAAC;AACJ,CAAC;AAjCD,4DAiCC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n'use strict';\n\nimport type {NativeModuleObjectTypeAnnotation} from 'react-native-tscodegen';\n\nlet preferredModuleName: string = '';\n\nexport function setPreferredModuleName(moduleName: string): void {\n preferredModuleName = moduleName;\n}\n\nexport function getAliasCppName(typeName: string): string {\n return `${preferredModuleName}Spec_${typeName}`;\n}\n\nexport interface AliasMap {\n types: {[name: string]: NativeModuleObjectTypeAnnotation | undefined};\n jobs: string[];\n}\n\nconst ExtendedObjectKey = '$RNW-TURBOMODULE-ALIAS';\ninterface ExtendedObject extends NativeModuleObjectTypeAnnotation {\n '$RNW-TURBOMODULE-ALIAS'?: string;\n}\n\nfunction recordAnonymouseAlias(\n aliases: AliasMap,\n baseAliasName: string,\n extended: ExtendedObject,\n): string {\n extended[ExtendedObjectKey] = baseAliasName;\n aliases.types[baseAliasName] = extended;\n aliases.jobs.push(baseAliasName);\n return baseAliasName;\n}\n\nexport function getAnonymousAliasCppName(\n aliases: AliasMap,\n baseAliasName: string,\n objectType: NativeModuleObjectTypeAnnotation,\n): string {\n // someone found an anonymous object literal type\n // if the ExtendedObjectKey flag has been set\n // then it is a known one\n // this happens because method signatures are generate twice in spec and error messages\n const extended = <ExtendedObject>objectType;\n const key = extended[ExtendedObjectKey];\n if (key !== undefined) {\n return getAliasCppName(key);\n }\n\n // if the ExtendedObjectKey flag has not been set\n // it means it is a unknown one\n // associate the name with this object literal type and return\n if (aliases.types[baseAliasName] === undefined) {\n return getAliasCppName(\n recordAnonymouseAlias(aliases, baseAliasName, extended),\n );\n }\n\n // sometimes names could be anonymous\n let index = 2;\n while (aliases.types[`${baseAliasName}${index}`] !== undefined) {\n index++;\n }\n\n return getAliasCppName(\n recordAnonymouseAlias(aliases, `${baseAliasName}${index}`, extended),\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
import type { SchemaType } from 'react-native-tscodegen';
|
|
7
|
+
declare type FilesOutput = Map<string, string>;
|
|
8
|
+
export declare function createNM2Generator({ namespace, methodonly, }: {
|
|
9
|
+
namespace: string;
|
|
10
|
+
methodonly: boolean;
|
|
11
|
+
}): (_libraryName: string, schema: SchemaType, _moduleSpecName: string) => FilesOutput;
|
|
12
|
+
export {};
|