@react-native/codegen 0.73.0-nightly-20230615-2ae163a7e → 0.73.0-nightly-20230622-0201e51bb
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/lib/parsers/flow/components/componentsUtils.js +2 -7
- package/lib/parsers/flow/components/componentsUtils.js.flow +1 -11
- package/lib/parsers/parsers-commons.js +8 -0
- package/lib/parsers/parsers-commons.js.flow +12 -0
- package/lib/parsers/typescript/components/componentsUtils.js +2 -7
- package/lib/parsers/typescript/components/componentsUtils.js.flow +1 -11
- package/package.json +2 -2
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
const _require = require('../utils.js'),
|
|
14
14
|
getValueFromTypes = _require.getValueFromTypes;
|
|
15
|
+
const _require2 = require('../../parsers-commons'),
|
|
16
|
+
verifyPropNotAlreadyDefined = _require2.verifyPropNotAlreadyDefined;
|
|
15
17
|
function getTypeAnnotationForArray(
|
|
16
18
|
name,
|
|
17
19
|
typeAnnotation,
|
|
@@ -189,13 +191,6 @@ function flattenProperties(typeDefinition, types, parser) {
|
|
|
189
191
|
}, [])
|
|
190
192
|
.filter(Boolean);
|
|
191
193
|
}
|
|
192
|
-
function verifyPropNotAlreadyDefined(props, needleProp) {
|
|
193
|
-
const propName = needleProp.key.name;
|
|
194
|
-
const foundProp = props.some(prop => prop.key.name === propName);
|
|
195
|
-
if (foundProp) {
|
|
196
|
-
throw new Error(`A prop was already defined with the name ${propName}`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
194
|
function getTypeAnnotation(
|
|
200
195
|
name,
|
|
201
196
|
annotation,
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
const {getValueFromTypes} = require('../utils.js');
|
|
14
|
+
const {verifyPropNotAlreadyDefined} = require('../../parsers-commons');
|
|
14
15
|
import type {TypeDeclarationMap, PropAST, ASTNode} from '../../utils';
|
|
15
16
|
import type {BuildSchemaFN, Parser} from '../../parser';
|
|
16
17
|
|
|
@@ -206,17 +207,6 @@ function flattenProperties(
|
|
|
206
207
|
.filter(Boolean);
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
function verifyPropNotAlreadyDefined(
|
|
210
|
-
props: $ReadOnlyArray<PropAST>,
|
|
211
|
-
needleProp: PropAST,
|
|
212
|
-
) {
|
|
213
|
-
const propName = needleProp.key.name;
|
|
214
|
-
const foundProp = props.some(prop => prop.key.name === propName);
|
|
215
|
-
if (foundProp) {
|
|
216
|
-
throw new Error(`A prop was already defined with the name ${propName}`);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
210
|
function getTypeAnnotation<+T>(
|
|
221
211
|
name: string,
|
|
222
212
|
annotation: $FlowFixMe | ASTNode,
|
|
@@ -1000,6 +1000,13 @@ function buildPropertiesForEvent(property, parser, getPropertyType) {
|
|
|
1000
1000
|
const typeAnnotation = parser.getTypeAnnotationFromProperty(property);
|
|
1001
1001
|
return getPropertyType(name, optional, typeAnnotation, parser);
|
|
1002
1002
|
}
|
|
1003
|
+
function verifyPropNotAlreadyDefined(props, needleProp) {
|
|
1004
|
+
const propName = needleProp.key.name;
|
|
1005
|
+
const foundProp = props.some(prop => prop.key.name === propName);
|
|
1006
|
+
if (foundProp) {
|
|
1007
|
+
throw new Error(`A prop was already defined with the name ${propName}`);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1003
1010
|
module.exports = {
|
|
1004
1011
|
wrapModuleSchema,
|
|
1005
1012
|
unwrapNullable,
|
|
@@ -1027,4 +1034,5 @@ module.exports = {
|
|
|
1027
1034
|
handleGenericTypeAnnotation,
|
|
1028
1035
|
getTypeResolutionStatus,
|
|
1029
1036
|
buildPropertiesForEvent,
|
|
1037
|
+
verifyPropNotAlreadyDefined,
|
|
1030
1038
|
};
|
|
@@ -1072,6 +1072,17 @@ function buildPropertiesForEvent(
|
|
|
1072
1072
|
return getPropertyType(name, optional, typeAnnotation, parser);
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
|
+
function verifyPropNotAlreadyDefined(
|
|
1076
|
+
props: $ReadOnlyArray<PropAST>,
|
|
1077
|
+
needleProp: PropAST,
|
|
1078
|
+
) {
|
|
1079
|
+
const propName = needleProp.key.name;
|
|
1080
|
+
const foundProp = props.some(prop => prop.key.name === propName);
|
|
1081
|
+
if (foundProp) {
|
|
1082
|
+
throw new Error(`A prop was already defined with the name ${propName}`);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1075
1086
|
module.exports = {
|
|
1076
1087
|
wrapModuleSchema,
|
|
1077
1088
|
unwrapNullable,
|
|
@@ -1099,4 +1110,5 @@ module.exports = {
|
|
|
1099
1110
|
handleGenericTypeAnnotation,
|
|
1100
1111
|
getTypeResolutionStatus,
|
|
1101
1112
|
buildPropertiesForEvent,
|
|
1113
|
+
verifyPropNotAlreadyDefined,
|
|
1102
1114
|
};
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
const _require = require('../parseTopLevelType'),
|
|
14
14
|
parseTopLevelType = _require.parseTopLevelType,
|
|
15
15
|
flattenIntersectionType = _require.flattenIntersectionType;
|
|
16
|
+
const _require2 = require('../../parsers-commons'),
|
|
17
|
+
verifyPropNotAlreadyDefined = _require2.verifyPropNotAlreadyDefined;
|
|
16
18
|
function getUnionOfLiterals(name, forArray, elementTypes, defaultValue, types) {
|
|
17
19
|
var _elementTypes$0$liter, _elementTypes$0$liter2;
|
|
18
20
|
elementTypes.reduce((lastType, currType) => {
|
|
@@ -417,13 +419,6 @@ function getSchemaInfo(property, types) {
|
|
|
417
419
|
};
|
|
418
420
|
}
|
|
419
421
|
|
|
420
|
-
function verifyPropNotAlreadyDefined(props, needleProp) {
|
|
421
|
-
const propName = needleProp.key.name;
|
|
422
|
-
const foundProp = props.some(prop => prop.key.name === propName);
|
|
423
|
-
if (foundProp) {
|
|
424
|
-
throw new Error(`A prop was already defined with the name ${propName}`);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
422
|
function flattenProperties(typeDefinition, types, parser) {
|
|
428
423
|
return typeDefinition
|
|
429
424
|
.map(property => {
|
|
@@ -13,6 +13,7 @@ const {
|
|
|
13
13
|
parseTopLevelType,
|
|
14
14
|
flattenIntersectionType,
|
|
15
15
|
} = require('../parseTopLevelType');
|
|
16
|
+
const {verifyPropNotAlreadyDefined} = require('../../parsers-commons');
|
|
16
17
|
import type {TypeDeclarationMap, PropAST, ASTNode} from '../../utils';
|
|
17
18
|
import type {BuildSchemaFN, Parser} from '../../parser';
|
|
18
19
|
|
|
@@ -453,17 +454,6 @@ function getSchemaInfo(
|
|
|
453
454
|
};
|
|
454
455
|
}
|
|
455
456
|
|
|
456
|
-
function verifyPropNotAlreadyDefined(
|
|
457
|
-
props: $ReadOnlyArray<PropAST>,
|
|
458
|
-
needleProp: PropAST,
|
|
459
|
-
) {
|
|
460
|
-
const propName = needleProp.key.name;
|
|
461
|
-
const foundProp = props.some(prop => prop.key.name === propName);
|
|
462
|
-
if (foundProp) {
|
|
463
|
-
throw new Error(`A prop was already defined with the name ${propName}`);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
457
|
function flattenProperties(
|
|
468
458
|
typeDefinition: $ReadOnlyArray<PropAST>,
|
|
469
459
|
types: TypeDeclarationMap,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/codegen",
|
|
3
|
-
"version": "0.73.0-nightly-
|
|
3
|
+
"version": "0.73.0-nightly-20230622-0201e51bb",
|
|
4
4
|
"description": "Code generation tools for React Native",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"bugs": "https://github.com/facebook/react-native/issues",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=18"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "yarn clean && node scripts/build.js --verbose",
|