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

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