@react-native-windows/codegen 0.0.0-canary.5 → 0.0.0-canary.51

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 (53) hide show
  1. package/CHANGELOG.md +448 -4
  2. package/README.md +1 -1
  3. package/bin.js +0 -0
  4. package/lib-commonjs/Cli.d.ts +7 -0
  5. package/lib-commonjs/Cli.js +74 -0
  6. package/lib-commonjs/Cli.js.map +1 -0
  7. package/lib-commonjs/generators/AliasGen.d.ts +11 -0
  8. package/lib-commonjs/generators/AliasGen.js +72 -0
  9. package/lib-commonjs/generators/AliasGen.js.map +1 -0
  10. package/lib-commonjs/generators/AliasManaging.d.ts +15 -0
  11. package/lib-commonjs/generators/AliasManaging.js +49 -0
  12. package/lib-commonjs/generators/AliasManaging.js.map +1 -0
  13. package/lib-commonjs/generators/GenerateNM2.d.ts +12 -0
  14. package/lib-commonjs/generators/GenerateNM2.js +94 -0
  15. package/lib-commonjs/generators/GenerateNM2.js.map +1 -0
  16. package/lib-commonjs/generators/GenerateTypeScript.d.ts +11 -0
  17. package/lib-commonjs/generators/GenerateTypeScript.js +166 -0
  18. package/lib-commonjs/generators/GenerateTypeScript.js.map +1 -0
  19. package/lib-commonjs/generators/ObjectTypes.d.ts +9 -0
  20. package/lib-commonjs/generators/ObjectTypes.js +73 -0
  21. package/lib-commonjs/generators/ObjectTypes.js.map +1 -0
  22. package/lib-commonjs/generators/ParamTypes.d.ts +11 -0
  23. package/lib-commonjs/generators/ParamTypes.js +135 -0
  24. package/lib-commonjs/generators/ParamTypes.js.map +1 -0
  25. package/lib-commonjs/generators/ReturnTypes.d.ts +9 -0
  26. package/lib-commonjs/generators/ReturnTypes.js +29 -0
  27. package/lib-commonjs/generators/ReturnTypes.js.map +1 -0
  28. package/lib-commonjs/generators/ValidateConstants.d.ts +8 -0
  29. package/lib-commonjs/generators/ValidateConstants.js +38 -0
  30. package/lib-commonjs/generators/ValidateConstants.js.map +1 -0
  31. package/lib-commonjs/generators/ValidateMethods.d.ts +8 -0
  32. package/lib-commonjs/generators/ValidateMethods.js +75 -0
  33. package/lib-commonjs/generators/ValidateMethods.js.map +1 -0
  34. package/lib-commonjs/index.d.ts +39 -0
  35. package/lib-commonjs/index.js +220 -0
  36. package/lib-commonjs/index.js.map +1 -0
  37. package/package.json +36 -19
  38. package/src/Cli.ts +37 -192
  39. package/src/generators/AliasGen.ts +105 -0
  40. package/src/generators/AliasManaging.ts +75 -0
  41. package/src/generators/GenerateNM2.ts +65 -291
  42. package/src/generators/GenerateTypeScript.ts +247 -0
  43. package/src/generators/ObjectTypes.ts +110 -0
  44. package/src/generators/ParamTypes.ts +262 -0
  45. package/src/generators/ReturnTypes.ts +55 -0
  46. package/src/generators/ValidateConstants.ts +50 -0
  47. package/src/generators/ValidateMethods.ts +149 -0
  48. package/src/index.ts +384 -0
  49. package/.eslintrc.js +0 -4
  50. package/.vscode/launch.json +0 -23
  51. package/CHANGELOG.json +0 -477
  52. package/jest.config.js +0 -1
  53. package/tsconfig.json +0 -5
package/CHANGELOG.md CHANGED
@@ -1,17 +1,461 @@
1
1
  # Change Log - @react-native-windows/codegen
2
2
 
3
- This log was last generated on Thu, 13 May 2021 05:11:05 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 22 Feb 2023 06:13:22 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.0.0-canary.5
7
+ ## 0.0.0-canary.51
8
8
 
9
- Thu, 13 May 2021 05:11:05 GMT
9
+ Wed, 22 Feb 2023 06:13:22 GMT
10
10
 
11
11
  ### Changes
12
12
 
13
- - Hook up view component codegen (30809111+acoates-ms@users.noreply.github.com)
13
+ - Fix code to handle newer version of @react-native/codegen (30809111+acoates-ms@users.noreply.github.com)
14
14
 
15
+ ## 0.0.0-canary.50
16
+
17
+ Fri, 10 Feb 2023 06:15:30 GMT
18
+
19
+ ### Changes
20
+
21
+ - codegen-windows --check always fails (30809111+acoates-ms@users.noreply.github.com)
22
+
23
+ ## 0.0.0-canary.49
24
+
25
+ Thu, 09 Feb 2023 06:16:42 GMT
26
+
27
+ ### Changes
28
+
29
+ - Bump typescript version (30809111+acoates-ms@users.noreply.github.com)
30
+ - Bump @react-native-windows/fs to v0.0.0-canary.14
31
+
32
+ ## 0.0.0-canary.48
33
+
34
+ Wed, 11 Jan 2023 06:15:29 GMT
35
+
36
+ ### Changes
37
+
38
+ - integrate 12/2/22 (tatianakapos@microsoft.com)
39
+ - Bump @react-native-windows/fs to v0.0.0-canary.13
40
+ - Bump @rnw-scripts/jest-unittest-config to v1.5.0
41
+ - Bump @rnw-scripts/just-task to v2.3.5
42
+
43
+ ## 0.0.0-canary.47
44
+
45
+ Wed, 21 Dec 2022 06:15:26 GMT
46
+
47
+ ### Changes
48
+
49
+ - Support enum/union and T in Promise<T> in codegen (53799235+ZihanChen-MSFT@users.noreply.github.com)
50
+
51
+ ## 0.0.0-canary.46
52
+
53
+ Tue, 13 Dec 2022 06:15:22 GMT
54
+
55
+ ### Changes
56
+
57
+ - Standardize on the repository field in package.json (dannyvv@microsoft.com)
58
+ - Bump @react-native-windows/fs to v0.0.0-canary.12
59
+ - Bump @rnw-scripts/eslint-config to v1.1.15
60
+ - Bump @rnw-scripts/jest-unittest-config to v1.4.3
61
+ - Bump @rnw-scripts/just-task to v2.3.4
62
+ - Bump @rnw-scripts/ts-config to v2.0.3
63
+
64
+ ## 0.0.0-canary.45
65
+
66
+ Fri, 02 Dec 2022 06:19:03 GMT
67
+
68
+ ### Changes
69
+
70
+ - Integrate 10/10 (34109996+chiaramooney@users.noreply.github.com)
71
+ - Bump codegen version (30809111+acoates-ms@users.noreply.github.com)
72
+ - Bump @react-native-windows/fs to v0.0.0-canary.11
73
+ - Bump @rnw-scripts/jest-unittest-config to v1.4.2
74
+ - Bump @rnw-scripts/just-task to v2.3.3
75
+
76
+ ## 0.0.0-canary.44
77
+
78
+ Mon, 21 Nov 2022 06:15:36 GMT
79
+
80
+ ### Changes
81
+
82
+ - Enable ability to codegen JSI C++ TurboModule specs (30809111+acoates-ms@users.noreply.github.com)
83
+
84
+ ## 0.0.0-canary.43
85
+
86
+ Wed, 16 Nov 2022 06:16:01 GMT
87
+
88
+ ### Changes
89
+
90
+ - Bump @react-native-windows/fs to v0.0.0-canary.10
91
+ - Bump @rnw-scripts/just-task to v2.3.2
92
+
93
+ ## 0.0.0-canary.42
94
+
95
+ Sat, 12 Nov 2022 06:17:21 GMT
96
+
97
+ ### Changes
98
+
99
+ - Integrate 10/10 (34109996+chiaramooney@users.noreply.github.com)
100
+ - Bump @react-native-windows/fs to v0.0.0-canary.9
101
+ - Bump @rnw-scripts/jest-unittest-config to v1.4.1
102
+ - Bump @rnw-scripts/just-task to v2.3.1
103
+
104
+ ## 0.0.0-canary.41
105
+
106
+ Thu, 10 Nov 2022 06:17:10 GMT
107
+
108
+ ### Changes
109
+
110
+ - integration 9/26/22 (tatianakapos@microsoft.com)
111
+ - Bump @react-native-windows/fs to v0.0.0-canary.8
112
+ - Bump @rnw-scripts/jest-unittest-config to v1.4.0
113
+ - Bump @rnw-scripts/just-task to v2.3.0
114
+
115
+ ## 0.0.0-canary.40
116
+
117
+ Tue, 18 Oct 2022 05:12:09 GMT
118
+
119
+ ### Changes
120
+
121
+ - Use newer react-native-codegen generators (30809111+acoates-ms@users.noreply.github.com)
122
+
123
+ ## 0.0.0-canary.39
124
+
125
+ Sat, 15 Oct 2022 05:12:00 GMT
126
+
127
+ ### Changes
128
+
129
+ - Bump @react-native-windows/fs to v0.0.0-canary.7
130
+
131
+ ## 0.0.0-canary.38
132
+
133
+ Fri, 07 Oct 2022 05:11:46 GMT
134
+
135
+ ### Changes
136
+
137
+ - Remove extra paren in codegen output (30809111+acoates-ms@users.noreply.github.com)
138
+
139
+ ## 0.0.0-canary.37
140
+
141
+ Wed, 05 Oct 2022 05:13:46 GMT
142
+
143
+ ### Changes
144
+
145
+ - Use react-native-codegen from rn, instead of from react-native-tscodegen (30809111+acoates-ms@users.noreply.github.com)
146
+ - integrate 7/29/22 (tatianakapos@microsoft.com)
147
+ - Bump @react-native-windows/fs to v0.0.0-canary.6
148
+ - Bump @rnw-scripts/eslint-config to v1.1.14
149
+ - Bump @rnw-scripts/jest-unittest-config to v1.3.0
150
+ - Bump @rnw-scripts/just-task to v2.2.6
151
+
152
+ ## 0.0.0-canary.36
153
+
154
+ Tue, 27 Sep 2022 05:11:30 GMT
155
+
156
+ ### Changes
157
+
158
+ - Export functionality to allow cli to use it (30809111+acoates-ms@users.noreply.github.com)
159
+
160
+ ## 0.0.0-canary.35
161
+
162
+ Sat, 04 Jun 2022 05:10:05 GMT
163
+
164
+ ### Changes
165
+
166
+ - Bump @react-native-windows/fs to v0.0.0-canary.5
167
+ - Bump @rnw-scripts/jest-unittest-config to v1.2.8
168
+ - Bump @rnw-scripts/just-task to v2.2.5
169
+
170
+ ## 0.0.0-canary.34
171
+
172
+ Thu, 12 May 2022 05:09:43 GMT
173
+
174
+ ### Changes
175
+
176
+ - Build/dependency fixes (ngerlem@microsoft.com)
177
+ - Bump @react-native-windows/fs to v0.0.0-canary.4
178
+ - Bump @rnw-scripts/eslint-config to v1.1.13
179
+ - Bump @rnw-scripts/jest-unittest-config to v1.2.7
180
+ - Bump @rnw-scripts/just-task to v2.2.4
181
+
182
+ ## 0.0.0-canary.33
183
+
184
+ Wed, 11 May 2022 05:08:51 GMT
185
+
186
+ ### Changes
187
+
188
+ - Add --methodonly to RNW/codegen (53799235+ZihanChen-MSFT@users.noreply.github.com)
189
+
190
+ ## 0.0.0-canary.32
191
+
192
+ Wed, 27 Apr 2022 05:10:23 GMT
193
+
194
+ ### Changes
195
+
196
+ - Merge (34109996+chiaramooney@users.noreply.github.com)
197
+ - Bump @react-native-windows/fs to v0.0.0-canary.3
198
+ - Bump @rnw-scripts/eslint-config to v1.1.12
199
+
200
+ ## 0.0.0-canary.31
201
+
202
+ Mon, 25 Apr 2022 22:50:30 GMT
203
+
204
+ ### Changes
205
+
206
+ - Update globby of @react-native-windows/codegen to remove glob-parent 3.x dependency (dannyvv@microsoft.com)
207
+
208
+ ## 0.0.0-canary.30
209
+
210
+ Tue, 12 Apr 2022 05:10:38 GMT
211
+
212
+ ### Changes
213
+
214
+ - Fix Overrides (34109996+chiaramooney@users.noreply.github.com)
215
+ - Bump @react-native-windows/fs to v0.0.0-canary.2
216
+
217
+ ## 0.0.0-canary.29
218
+
219
+ Fri, 01 Apr 2022 05:09:56 GMT
220
+
221
+ ### Changes
222
+
223
+ - Fix publish after promotion to preview (ngerlem@microsoft.com)
224
+ - Bump @react-native-windows/fs to v0.0.0-canary.1
225
+
226
+ ## 0.0.0-canary.28
227
+
228
+ Wed, 09 Mar 2022 06:09:07 GMT
229
+
230
+ ### Changes
231
+
232
+ - Fix turbo module codegen to generate correct import statement and registration (53799235+ZihanChen-MSFT@users.noreply.github.com)
233
+
234
+ ## 0.0.0-canary.27
235
+
236
+ Fri, 04 Mar 2022 06:09:13 GMT
237
+
238
+ ### Changes
239
+
240
+ - Generate fabric eventemitter.cpp (acoates@microsoft.com)
241
+
242
+ ## 0.0.0-canary.26
243
+
244
+ Thu, 24 Feb 2022 06:07:47 GMT
245
+
246
+ ### Changes
247
+
248
+ - Add TypeScript turbo module definition as new codegen traget (53799235+ZihanChen-MSFT@users.noreply.github.com)
249
+
250
+ ## 0.0.0-canary.25
251
+
252
+ Wed, 09 Feb 2022 06:09:36 GMT
253
+
254
+ ### Changes
255
+
256
+ - Bump minimum Node version to 14 (jthysell@microsoft.com)
257
+ - Bump @react-native-windows/fs to v1.0.2
258
+ - Bump @rnw-scripts/eslint-config to v1.1.11
259
+ - Bump @rnw-scripts/jest-unittest-config to v1.2.6
260
+ - Bump @rnw-scripts/just-task to v2.2.3
261
+ - Bump @rnw-scripts/ts-config to v2.0.2
262
+
263
+ ## 0.0.0-canary.24
264
+
265
+ Tue, 08 Feb 2022 18:21:23 GMT
266
+
267
+ ### Changes
268
+
269
+ - Fix TurboModule codegen document (53799235+ZihanChen-MSFT@users.noreply.github.com)
270
+
271
+ ## 0.0.0-canary.23
272
+
273
+ Sat, 29 Jan 2022 06:08:58 GMT
274
+
275
+ ### Changes
276
+
277
+ - Add document for turbo module codegen (53799235+ZihanChen-MSFT@users.noreply.github.com)
278
+
279
+ ## 0.0.0-canary.22
280
+
281
+ Fri, 03 Dec 2021 06:12:10 GMT
282
+
283
+ ### Changes
284
+
285
+ - Integrate 11/11 (34109996+chiaramooney@users.noreply.github.com)
286
+ - Bump @react-native-windows/fs to v1.0.1
287
+ - Bump @rnw-scripts/eslint-config to v1.1.10
288
+ - Bump @rnw-scripts/jest-unittest-config to v1.2.5
289
+ - Bump @rnw-scripts/just-task to v2.2.2
290
+
291
+ ## 0.0.0-canary.21
292
+
293
+ Thu, 18 Nov 2021 06:11:20 GMT
294
+
295
+ ### Changes
296
+
297
+ - Use '@react-native-windows/fs' (ngerlem@microsoft.com)
298
+ - Bump @react-native-windows/fs to v1.0.0
299
+ - Bump @rnw-scripts/eslint-config to v1.1.9
300
+
301
+ ## 0.0.0-canary.20
302
+
303
+ Thu, 04 Nov 2021 05:07:29 GMT
304
+
305
+ ### Changes
306
+
307
+ - Codegen prints `::React::JSValue` instead of `React::JSValue` (53799235+ZihanChen-MSFT@users.noreply.github.com)
308
+
309
+ ## 0.0.0-canary.20
310
+
311
+ Thu, 04 Nov 2021 05:07:08 GMT
312
+
313
+ ### Changes
314
+
315
+ - Codegen prints `::React::JSValue` instead of `React::JSValue` (53799235+ZihanChen-MSFT@users.noreply.github.com)
316
+
317
+ ## 0.0.0-canary.19
318
+
319
+ Sat, 23 Oct 2021 05:06:49 GMT
320
+
321
+ ### Changes
322
+
323
+ - Only generate component files if a component is specified (30809111+acoates-ms@users.noreply.github.com)
324
+
325
+ ## 0.0.0-canary.18
326
+
327
+ Fri, 22 Oct 2021 05:06:46 GMT
328
+
329
+ ### Changes
330
+
331
+ - Built files not included in published package (30809111+acoates-ms@users.noreply.github.com)
332
+
333
+ ## 0.0.0-canary.17
334
+
335
+ Thu, 21 Oct 2021 05:08:01 GMT
336
+
337
+ ### Changes
338
+
339
+ - Update to typescript 4 (30809111+acoates-ms@users.noreply.github.com)
340
+
341
+ ## 0.0.0-canary.16
342
+
343
+ Wed, 29 Sep 2021 05:06:54 GMT
344
+
345
+ ### Changes
346
+
347
+ - Check constants in generated turbo module specs (53799235+ZihanChen-MSFT@users.noreply.github.com)
348
+
349
+ ## 0.0.0-canary.15
350
+
351
+ Wed, 15 Sep 2021 05:07:04 GMT
352
+
353
+ ### Changes
354
+
355
+ - Generate anonymous objects in correct order for turbo module (53799235+ZihanChen-MSFT@users.noreply.github.com)
356
+
357
+ ## 0.0.0-canary.14
358
+
359
+ Fri, 10 Sep 2021 05:07:31 GMT
360
+
361
+ ### Changes
362
+
363
+ - Generate `std::vector<T>` for array types in turbo modules (53799235+ZihanChen-MSFT@users.noreply.github.com)
364
+
365
+ ## 0.0.0-canary.13
366
+
367
+ Thu, 09 Sep 2021 05:07:46 GMT
368
+
369
+ ### Changes
370
+
371
+ - Bump to 0.66-based react-native-tscodegen (ngerlem@microsoft.com)
372
+ - Generate nullable type for turbo module (53799235+ZihanChen-MSFT@users.noreply.github.com)
373
+
374
+ ## 0.0.0-canary.12
375
+
376
+ Wed, 08 Sep 2021 05:08:53 GMT
377
+
378
+ ### Patches
379
+
380
+ - Bump @rnw-scripts/jest-unittest-config to v1.2.4 (ngerlem@microsoft.com)
381
+ - Bump @rnw-scripts/just-task to v2.2.1 (ngerlem@microsoft.com)
382
+ - Bump @rnw-scripts/ts-config to v2.0.1 (ngerlem@microsoft.com)
383
+ - Bump @rnw-scripts/eslint-config to v1.1.8 (ngerlem@microsoft.com)
384
+
385
+ ### Changes
386
+
387
+ - Set consistent node requirements on our packages (ngerlem@microsoft.com)
388
+ - Match Alert module with NativeDialogManagerWindowsSpec.h (53799235+ZihanChen-MSFT@users.noreply.github.com)
389
+
390
+ ## 0.0.0-canary.11
391
+
392
+ Fri, 03 Sep 2021 05:06:04 GMT
393
+
394
+ ### Changes
395
+
396
+ - Generate aliased struct for turbo module (53799235+ZihanChen-MSFT@users.noreply.github.com)
397
+
398
+ ## 0.0.0-canary.10
399
+
400
+ Thu, 05 Aug 2021 05:07:20 GMT
401
+
402
+ ### Changes
403
+
404
+ - Do not write codegen files if the contents have not changed, as this breaks incremental builds (30809111+acoates-ms@users.noreply.github.com)
405
+
406
+ ## 0.0.0-canary.9
407
+
408
+ Fri, 11 Jun 2021 05:08:55 GMT
409
+
410
+ ### Patches
411
+
412
+ - Bump @rnw-scripts/just-task to v2.2.0 (ngerlem@microsoft.com)
413
+
414
+ ## 0.0.0-canary.8
415
+
416
+ Wed, 09 Jun 2021 05:10:07 GMT
417
+
418
+ ### Patches
419
+
420
+ - Bump @rnw-scripts/just-task to v2.1.3 (igklemen@microsoft.com)
421
+ - Bump @rnw-scripts/jest-unittest-config to v1.2.3 (igklemen@microsoft.com)
422
+
423
+ ## 0.0.0-canary.7
424
+
425
+ Thu, 03 Jun 2021 05:09:47 GMT
426
+
427
+ ### Patches
428
+
429
+ - Bump @rnw-scripts/just-task to v2.1.2 (ngerlem@microsoft.com)
430
+ - Bump @rnw-scripts/ts-config to v2.0.0 (ngerlem@microsoft.com)
431
+ - Bump @rnw-scripts/eslint-config to v1.1.7 (ngerlem@microsoft.com)
432
+ - Bump @rnw-scripts/jest-unittest-config to v1.2.2 (ngerlem@microsoft.com)
433
+
434
+ ### Changes
435
+
436
+ - Enable esModuleInterop Repo Wide (ngerlem@microsoft.com)
437
+
438
+ ## 0.0.0-canary.6
439
+
440
+ Fri, 21 May 2021 05:17:18 GMT
441
+
442
+ ### Patches
443
+
444
+ - Bump @rnw-scripts/just-task to v2.1.1 (ngerlem@microsoft.com)
445
+ - Bump @rnw-scripts/jest-unittest-config to v1.2.1 (ngerlem@microsoft.com)
446
+
447
+ ### Changes
448
+
449
+ - Integrate Apr 28 (base of 0.65) Nightly RN Build (ngerlem@microsoft.com)
450
+
451
+ ## 0.0.0-canary.5
452
+
453
+ Thu, 13 May 2021 05:11:48 GMT
454
+
455
+ ### Changes
456
+
457
+ - Hook up view component codegen (30809111+acoates-ms@users.noreply.github.com)
458
+
15
459
  ## 0.0.0-canary.4
16
460
 
17
461
  Thu, 04 Mar 2021 05:05:53 GMT
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @react-native-windows/codegen
2
2
 
3
- Generators for react-native-codegen targeting react-native-windows
3
+ Generators for @react-native/codegen targeting react-native-windows
4
4
 
5
5
  ## Usage
6
6
 
package/bin.js CHANGED
File without changes
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ */
7
+ export {};
@@ -0,0 +1,74 @@
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
+ modulesTypeScriptTypes: {
25
+ type: 'boolean',
26
+ describe: 'generate turbo module definition files in TypeScript',
27
+ default: false,
28
+ },
29
+ modulesCxx: {
30
+ type: 'boolean',
31
+ describe: 'generate C++ JSI turbo module spec files',
32
+ default: false,
33
+ },
34
+ modulesWindows: {
35
+ type: 'boolean',
36
+ describe: 'generate turbo module spec files for REACT_MODULE',
37
+ default: false,
38
+ },
39
+ methodOnly: {
40
+ type: 'boolean',
41
+ describe: 'generate only method metadata in C++ turbo module spec',
42
+ default: false,
43
+ },
44
+ outputDirectory: {
45
+ type: 'string',
46
+ describe: 'output directory',
47
+ default: 'codegen',
48
+ },
49
+ test: {
50
+ type: 'boolean',
51
+ describe: 'Verify that the generated output is unchanged',
52
+ default: false,
53
+ },
54
+ namespace: {
55
+ type: 'string',
56
+ describe: 'C++/C# Namespace to put generated native modules in',
57
+ default: 'MyNamespace',
58
+ },
59
+ libraryName: {
60
+ type: 'string',
61
+ required: true,
62
+ describe: 'Used for part of the path generated within the codegen dir',
63
+ },
64
+ }).argv;
65
+ if ((argv.file && argv.files) || (!argv.file && !argv.files)) {
66
+ console.error('You must specify either --file or --files.');
67
+ process.exit(1);
68
+ }
69
+ const changesNecessary = (0, index_1.runCodeGen)(argv);
70
+ if (argv.test && changesNecessary) {
71
+ console.error('There is a change in the output of codegen. Rerun "react-native codegen-windows" to regenerate.');
72
+ process.exit(2);
73
+ }
74
+ //# 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,sBAAsB,EAAE;QACtB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,sDAAsD;QAChE,OAAO,EAAE,KAAK;KACf;IACD,UAAU,EAAE;QACV,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,0CAA0C;QACpD,OAAO,EAAE,KAAK;KACf;IACD,cAAc,EAAE;QACd,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,mDAAmD;QAC7D,OAAO,EAAE,KAAK;KACf;IACD,UAAU,EAAE;QACV,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,wDAAwD;QAClE,OAAO,EAAE,KAAK;KACf;IACD,eAAe,EAAE;QACf,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,MAAM,gBAAgB,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC;AAE1C,IAAI,IAAI,CAAC,IAAI,IAAI,gBAAgB,EAAE;IACjC,OAAO,CAAC,KAAK,CACX,kGAAkG,CACnG,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB","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 modulesTypeScriptTypes: {\n type: 'boolean',\n describe: 'generate turbo module definition files in TypeScript',\n default: false,\n },\n modulesCxx: {\n type: 'boolean',\n describe: 'generate C++ JSI turbo module spec files',\n default: false,\n },\n modulesWindows: {\n type: 'boolean',\n describe: 'generate turbo module spec files for REACT_MODULE',\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 outputDirectory: {\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\nconst changesNecessary = runCodeGen(argv);\n\nif (argv.test && changesNecessary) {\n console.error(\n 'There is a change in the output of codegen. Rerun \"react-native codegen-windows\" to regenerate.',\n );\n process.exit(2);\n}\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/codegen/lib/CodegenSchema';
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/codegen/lib/CodegenSchema';\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/codegen/lib/CodegenSchema';
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;