@react-native-windows/codegen 0.72.1 → 0.73.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +157 -19
- package/lib-commonjs/Cli.js +5 -0
- package/lib-commonjs/Cli.js.map +1 -1
- package/lib-commonjs/generators/AliasGen.d.ts +1 -1
- package/lib-commonjs/generators/AliasGen.js +27 -11
- package/lib-commonjs/generators/AliasGen.js.map +1 -1
- package/lib-commonjs/generators/AliasManaging.js +3 -3
- package/lib-commonjs/generators/AliasManaging.js.map +1 -1
- package/lib-commonjs/generators/GenerateNM2.d.ts +2 -1
- package/lib-commonjs/generators/GenerateNM2.js +63 -19
- package/lib-commonjs/generators/GenerateNM2.js.map +1 -1
- package/lib-commonjs/generators/ObjectTypes.d.ts +2 -2
- package/lib-commonjs/generators/ObjectTypes.js +2 -0
- package/lib-commonjs/generators/ObjectTypes.js.map +1 -1
- package/lib-commonjs/generators/ParamTypes.js +2 -0
- package/lib-commonjs/generators/ParamTypes.js.map +1 -1
- package/lib-commonjs/generators/ValidateMethods.js +1 -1
- package/lib-commonjs/generators/ValidateMethods.js.map +1 -1
- package/lib-commonjs/index.d.ts +2 -1
- package/lib-commonjs/index.js +6 -4
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +11 -11
- package/src/Cli.ts +5 -0
- package/src/generators/AliasGen.ts +45 -13
- package/src/generators/AliasManaging.ts +3 -3
- package/src/generators/GenerateNM2.ts +76 -16
- package/src/generators/ObjectTypes.ts +9 -1
- package/src/generators/ParamTypes.ts +2 -0
- package/src/generators/ValidateMethods.ts +1 -1
- package/src/index.ts +7 -2
|
@@ -10,6 +10,8 @@ import type {
|
|
|
10
10
|
NativeModuleEnumDeclaration,
|
|
11
11
|
NativeModuleBaseTypeAnnotation,
|
|
12
12
|
NativeModuleUnionTypeAnnotation,
|
|
13
|
+
NativeModuleStringTypeAnnotation,
|
|
14
|
+
NativeModuleFunctionTypeAnnotation,
|
|
13
15
|
Nullable,
|
|
14
16
|
} from '@react-native/codegen/lib/CodegenSchema';
|
|
15
17
|
import {
|
|
@@ -44,7 +46,11 @@ function translateUnionReturnType(
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export function translateFieldOrReturnType(
|
|
47
|
-
type: Nullable<
|
|
49
|
+
type: Nullable<
|
|
50
|
+
| NativeModuleBaseTypeAnnotation
|
|
51
|
+
| NativeModuleStringTypeAnnotation
|
|
52
|
+
| NativeModuleFunctionTypeAnnotation
|
|
53
|
+
>,
|
|
48
54
|
aliases: AliasMap,
|
|
49
55
|
baseAliasName: string,
|
|
50
56
|
callerName: 'translateField' | 'translateReturnType',
|
|
@@ -98,6 +104,8 @@ export function translateFieldOrReturnType(
|
|
|
98
104
|
callerName,
|
|
99
105
|
options,
|
|
100
106
|
)}>`;
|
|
107
|
+
case 'MixedTypeAnnotation':
|
|
108
|
+
return '';
|
|
101
109
|
case 'EnumDeclaration':
|
|
102
110
|
case 'UnionTypeAnnotation':
|
|
103
111
|
return translateUnionReturnType(type, options);
|
|
@@ -183,6 +183,8 @@ function translateParam(
|
|
|
183
183
|
}
|
|
184
184
|
case 'TypeAliasTypeAnnotation':
|
|
185
185
|
return decorateType(getAliasCppName(param.name), target);
|
|
186
|
+
case 'MixedTypeAnnotation':
|
|
187
|
+
return '';
|
|
186
188
|
case 'EnumDeclaration':
|
|
187
189
|
case 'UnionTypeAnnotation':
|
|
188
190
|
return translateUnionReturnType(param, target, options);
|
|
@@ -46,7 +46,7 @@ function getPossibleMethodSignatures(
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// TODO: be much more
|
|
49
|
+
// TODO: be much more exhaustive on the possible method signatures that can be used..
|
|
50
50
|
const sig = `REACT_${isMethodSync(funcType) ? 'SYNC_' : ''}METHOD(${
|
|
51
51
|
prop.name
|
|
52
52
|
}) ${translateImplReturnType(
|
package/src/index.ts
CHANGED
|
@@ -52,6 +52,7 @@ export interface SharedOptions {
|
|
|
52
52
|
namespace: string;
|
|
53
53
|
outputDirectory: string;
|
|
54
54
|
cppStringType: CppStringTypes;
|
|
55
|
+
separateDataTypes: boolean;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
interface Options extends SharedOptions {
|
|
@@ -216,6 +217,7 @@ export function generate(
|
|
|
216
217
|
namespace,
|
|
217
218
|
outputDirectory,
|
|
218
219
|
cppStringType,
|
|
220
|
+
separateDataTypes,
|
|
219
221
|
moduleSpecName,
|
|
220
222
|
schema,
|
|
221
223
|
}: Options,
|
|
@@ -240,6 +242,7 @@ export function generate(
|
|
|
240
242
|
methodOnly,
|
|
241
243
|
namespace,
|
|
242
244
|
cppStringType,
|
|
245
|
+
separateDataTypes,
|
|
243
246
|
});
|
|
244
247
|
|
|
245
248
|
const generateJsiModuleH = require(path.resolve(
|
|
@@ -256,7 +259,7 @@ export function generate(
|
|
|
256
259
|
)).generate;
|
|
257
260
|
const generatorPropsCPP = require(path.resolve(
|
|
258
261
|
rncodegenPath,
|
|
259
|
-
'lib/generators/components/
|
|
262
|
+
'lib/generators/components/GeneratePropsCpp',
|
|
260
263
|
)).generate;
|
|
261
264
|
const generatorShadowNodeH = require(path.resolve(
|
|
262
265
|
rncodegenPath,
|
|
@@ -264,7 +267,7 @@ export function generate(
|
|
|
264
267
|
)).generate;
|
|
265
268
|
const generatorShadowNodeCPP = require(path.resolve(
|
|
266
269
|
rncodegenPath,
|
|
267
|
-
'lib/generators/components/
|
|
270
|
+
'lib/generators/components/GenerateShadowNodeCpp',
|
|
268
271
|
)).generate;
|
|
269
272
|
const generatorComponentDescriptorH = require(path.resolve(
|
|
270
273
|
rncodegenPath,
|
|
@@ -369,6 +372,7 @@ export function runCodeGen(options: CodeGenOptions): boolean {
|
|
|
369
372
|
namespace,
|
|
370
373
|
outputDirectory,
|
|
371
374
|
cppStringType,
|
|
375
|
+
separateDataTypes,
|
|
372
376
|
} = options;
|
|
373
377
|
return generate(
|
|
374
378
|
{
|
|
@@ -380,6 +384,7 @@ export function runCodeGen(options: CodeGenOptions): boolean {
|
|
|
380
384
|
namespace,
|
|
381
385
|
outputDirectory,
|
|
382
386
|
cppStringType,
|
|
387
|
+
separateDataTypes,
|
|
383
388
|
moduleSpecName,
|
|
384
389
|
schema,
|
|
385
390
|
},
|