@react-native/codegen 0.82.0-nightly-20250727-df3f0967b → 0.82.0-nightly-20250729-e17e3e3f3
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/SchemaValidator.js +1 -3
- package/lib/cli/generators/generate-all.js +1 -3
- package/lib/generators/TypeUtils/Java/index.js +1 -6
- package/lib/generators/components/CppHelpers.js +5 -19
- package/lib/generators/components/GenerateComponentHObjCpp.js +2 -6
- package/lib/generators/components/GenerateEventEmitterCpp.js +7 -47
- package/lib/generators/components/GenerateEventEmitterH.js +1 -5
- package/lib/generators/components/GeneratePropsH.js +6 -20
- package/lib/generators/components/GeneratePropsJavaDelegate.js +2 -7
- package/lib/generators/components/GeneratePropsJavaInterface.js +2 -7
- package/lib/generators/modules/GenerateModuleCpp.js +2 -14
- package/lib/generators/modules/GenerateModuleH.js +10 -28
- package/lib/generators/modules/GenerateModuleJavaSpec.js +6 -18
- package/lib/generators/modules/GenerateModuleJniH.js +1 -5
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +2 -7
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +1 -4
- package/lib/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js +3 -18
- package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js +1 -4
- package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +13 -15
- package/lib/parsers/errors.js +1 -3
- package/lib/parsers/flow/components/componentsUtils.js +4 -4
- package/lib/parsers/flow/components/events.js +2 -6
- package/lib/parsers/flow/parser.js +13 -13
- package/lib/parsers/parsers-commons.js +1 -3
- package/lib/parsers/typescript/components/componentsUtils.js +1 -8
- package/lib/parsers/typescript/components/events.js +1 -5
- package/lib/parsers/typescript/parser.js +31 -31
- package/package.json +2 -2
package/lib/SchemaValidator.js
CHANGED
|
@@ -34,9 +34,7 @@ function getErrors(schema) {
|
|
|
34
34
|
componentModules.forEach((modules, componentName) => {
|
|
35
35
|
if (modules.length > 1) {
|
|
36
36
|
errors.add(
|
|
37
|
-
`Duplicate components found with name ${componentName}. Found in modules ${modules.join(
|
|
38
|
-
', ',
|
|
39
|
-
)}`,
|
|
37
|
+
`Duplicate components found with name ${componentName}. Found in modules ${modules.join(', ')}`,
|
|
40
38
|
);
|
|
41
39
|
}
|
|
42
40
|
});
|
|
@@ -19,9 +19,7 @@ const fs = require('fs');
|
|
|
19
19
|
const args = process.argv.slice(2);
|
|
20
20
|
if (args.length < 3) {
|
|
21
21
|
throw new Error(
|
|
22
|
-
`Expected to receive path to schema, library name, output directory and module spec name. Received ${args.join(
|
|
23
|
-
', ',
|
|
24
|
-
)}`,
|
|
22
|
+
`Expected to receive path to schema, library name, output directory and module spec name. Received ${args.join(', ')}`,
|
|
25
23
|
);
|
|
26
24
|
}
|
|
27
25
|
const schemaPath = args[0];
|
|
@@ -19,12 +19,7 @@ function wrapOptional(type, isRequired) {
|
|
|
19
19
|
return isRequired
|
|
20
20
|
? type
|
|
21
21
|
: // $FlowFixMe[invalid-computed-prop]
|
|
22
|
-
`@Nullable ${
|
|
23
|
-
(_objectTypeForPrimiti = objectTypeForPrimitiveType[type]) !== null &&
|
|
24
|
-
_objectTypeForPrimiti !== void 0
|
|
25
|
-
? _objectTypeForPrimiti
|
|
26
|
-
: type
|
|
27
|
-
}`;
|
|
22
|
+
`@Nullable ${(_objectTypeForPrimiti = objectTypeForPrimitiveType[type]) !== null && _objectTypeForPrimiti !== void 0 ? _objectTypeForPrimiti : type}`;
|
|
28
23
|
}
|
|
29
24
|
module.exports = {
|
|
30
25
|
wrapOptional,
|
|
@@ -51,17 +51,10 @@ function getCppArrayTypeForAnnotation(typeElement, structParts) {
|
|
|
51
51
|
}
|
|
52
52
|
return `std::vector<${generateEventStructName(structParts)}>`;
|
|
53
53
|
case 'ArrayTypeAnnotation':
|
|
54
|
-
return `std::vector<${getCppArrayTypeForAnnotation(
|
|
55
|
-
typeElement.elementType,
|
|
56
|
-
structParts,
|
|
57
|
-
)}>`;
|
|
54
|
+
return `std::vector<${getCppArrayTypeForAnnotation(typeElement.elementType, structParts)}>`;
|
|
58
55
|
default:
|
|
59
56
|
throw new Error(
|
|
60
|
-
`Can't determine array type with typeElement: ${JSON.stringify(
|
|
61
|
-
typeElement,
|
|
62
|
-
null,
|
|
63
|
-
2,
|
|
64
|
-
)}`,
|
|
57
|
+
`Can't determine array type with typeElement: ${JSON.stringify(typeElement, null, 2)}`,
|
|
65
58
|
);
|
|
66
59
|
}
|
|
67
60
|
}
|
|
@@ -183,9 +176,7 @@ function convertDefaultTypeToString(componentName, prop, fromBuilder = false) {
|
|
|
183
176
|
}
|
|
184
177
|
const enumName = getEnumName(componentName, prop.name);
|
|
185
178
|
const enumMaskName = getEnumMaskName(enumName);
|
|
186
|
-
const defaultValue = `${enumName}::${toSafeCppString(
|
|
187
|
-
elementType.default,
|
|
188
|
-
)}`;
|
|
179
|
+
const defaultValue = `${enumName}::${toSafeCppString(elementType.default)}`;
|
|
189
180
|
if (fromBuilder) {
|
|
190
181
|
return `${enumMaskName}Wrapped{ .value = static_cast<${enumMaskName}>(${defaultValue})}`;
|
|
191
182
|
}
|
|
@@ -198,14 +189,9 @@ function convertDefaultTypeToString(componentName, prop, fromBuilder = false) {
|
|
|
198
189
|
return '';
|
|
199
190
|
}
|
|
200
191
|
case 'StringEnumTypeAnnotation':
|
|
201
|
-
return `${getEnumName(componentName, prop.name)}::${toSafeCppString(
|
|
202
|
-
typeAnnotation.default,
|
|
203
|
-
)}`;
|
|
192
|
+
return `${getEnumName(componentName, prop.name)}::${toSafeCppString(typeAnnotation.default)}`;
|
|
204
193
|
case 'Int32EnumTypeAnnotation':
|
|
205
|
-
return `${getEnumName(componentName, prop.name)}::${toIntEnumValueName(
|
|
206
|
-
prop.name,
|
|
207
|
-
typeAnnotation.default,
|
|
208
|
-
)}`;
|
|
194
|
+
return `${getEnumName(componentName, prop.name)}::${toIntEnumValueName(prop.name, typeAnnotation.default)}`;
|
|
209
195
|
case 'MixedTypeAnnotation':
|
|
210
196
|
return '';
|
|
211
197
|
default:
|
|
@@ -226,9 +226,7 @@ function generateProtocol(component, componentName) {
|
|
|
226
226
|
: params
|
|
227
227
|
.map((param, index) => {
|
|
228
228
|
const objCType = getObjCParamType(param);
|
|
229
|
-
return `${index === 0 ? '' : param.name}:(${objCType})${
|
|
230
|
-
param.name
|
|
231
|
-
}`;
|
|
229
|
+
return `${index === 0 ? '' : param.name}:(${objCType})${param.name}`;
|
|
232
230
|
})
|
|
233
231
|
.join(' ');
|
|
234
232
|
return `- (void)${command.name}${paramString};`;
|
|
@@ -244,9 +242,7 @@ function generateConvertAndValidateParam(param, index, componentName) {
|
|
|
244
242
|
const leftSideType = getObjCParamType(param);
|
|
245
243
|
const expectedKind = getObjCExpectedKindParamType(param);
|
|
246
244
|
const expectedKindString = getReadableExpectedKindParamType(param);
|
|
247
|
-
const argConversion = `${leftSideType} ${
|
|
248
|
-
param.name
|
|
249
|
-
} = ${getObjCRightHandAssignmentParamType(param, index)};`;
|
|
245
|
+
const argConversion = `${leftSideType} ${param.name} = ${getObjCRightHandAssignmentParamType(param, index)};`;
|
|
250
246
|
return CommandHandlerIfCaseConvertArgTemplate({
|
|
251
247
|
componentName,
|
|
252
248
|
argConversion,
|
|
@@ -69,9 +69,7 @@ function generateSetter(
|
|
|
69
69
|
const eventChain = usingEvent
|
|
70
70
|
? `event.${[...propertyParts, propertyName].join('.')}`
|
|
71
71
|
: [...propertyParts, propertyName].join('.');
|
|
72
|
-
return `${variableName}.setProperty(runtime, "${propertyName}", ${valueMapper(
|
|
73
|
-
eventChain,
|
|
74
|
-
)});`;
|
|
72
|
+
return `${variableName}.setProperty(runtime, "${propertyName}", ${valueMapper(eventChain)});`;
|
|
75
73
|
}
|
|
76
74
|
function generateObjectSetter(
|
|
77
75
|
variableName,
|
|
@@ -84,16 +82,7 @@ function generateObjectSetter(
|
|
|
84
82
|
return `
|
|
85
83
|
{
|
|
86
84
|
auto ${propertyName} = jsi::Object(runtime);
|
|
87
|
-
${indent(
|
|
88
|
-
generateSetters(
|
|
89
|
-
propertyName,
|
|
90
|
-
typeAnnotation.properties,
|
|
91
|
-
propertyParts.concat([propertyName]),
|
|
92
|
-
extraIncludes,
|
|
93
|
-
usingEvent,
|
|
94
|
-
),
|
|
95
|
-
2,
|
|
96
|
-
)}
|
|
85
|
+
${indent(generateSetters(propertyName, typeAnnotation.properties, propertyParts.concat([propertyName]), extraIncludes, usingEvent), 2)}
|
|
97
86
|
${variableName}.setProperty(runtime, "${propertyName}", ${propertyName});
|
|
98
87
|
}
|
|
99
88
|
`.trim();
|
|
@@ -104,9 +93,7 @@ function setValueAtIndex(
|
|
|
104
93
|
loopLocalVariable,
|
|
105
94
|
mappingFunction = value => value,
|
|
106
95
|
) {
|
|
107
|
-
return `${propertyName}.setValueAtIndex(runtime, ${indexVariable}++, ${mappingFunction(
|
|
108
|
-
loopLocalVariable,
|
|
109
|
-
)});`;
|
|
96
|
+
return `${propertyName}.setValueAtIndex(runtime, ${indexVariable}++, ${mappingFunction(loopLocalVariable)});`;
|
|
110
97
|
}
|
|
111
98
|
function generateArraySetter(
|
|
112
99
|
variableName,
|
|
@@ -125,15 +112,7 @@ function generateArraySetter(
|
|
|
125
112
|
auto ${propertyName} = jsi::Array(runtime, ${eventChain}.size());
|
|
126
113
|
size_t ${indexVar} = 0;
|
|
127
114
|
for (auto ${innerLoopVar} : ${eventChain}) {
|
|
128
|
-
${handleArrayElementType(
|
|
129
|
-
elementType,
|
|
130
|
-
propertyName,
|
|
131
|
-
indexVar,
|
|
132
|
-
innerLoopVar,
|
|
133
|
-
propertyParts,
|
|
134
|
-
extraIncludes,
|
|
135
|
-
usingEvent,
|
|
136
|
-
)}
|
|
115
|
+
${handleArrayElementType(elementType, propertyName, indexVar, innerLoopVar, propertyParts, extraIncludes, usingEvent)}
|
|
137
116
|
}
|
|
138
117
|
${variableName}.setProperty(runtime, "${propertyName}", ${propertyName});
|
|
139
118
|
`;
|
|
@@ -208,13 +187,7 @@ function convertObjectTypeArray(
|
|
|
208
187
|
extraIncludes,
|
|
209
188
|
) {
|
|
210
189
|
return `auto ${propertyName}Object = jsi::Object(runtime);
|
|
211
|
-
${generateSetters(
|
|
212
|
-
`${propertyName}Object`,
|
|
213
|
-
objectTypeAnnotation.properties,
|
|
214
|
-
[].concat([loopLocalVariable]),
|
|
215
|
-
extraIncludes,
|
|
216
|
-
false,
|
|
217
|
-
)}
|
|
190
|
+
${generateSetters(`${propertyName}Object`, objectTypeAnnotation.properties, [].concat([loopLocalVariable]), extraIncludes, false)}
|
|
218
191
|
${setValueAtIndex(propertyName, indexVariable, `${propertyName}Object`)}`;
|
|
219
192
|
}
|
|
220
193
|
function convertArrayTypeArray(
|
|
@@ -234,15 +207,7 @@ function convertArrayTypeArray(
|
|
|
234
207
|
return `auto ${propertyName}Array = jsi::Array(runtime, ${loopLocalVariable}.size());
|
|
235
208
|
size_t ${indexVariable}Internal = 0;
|
|
236
209
|
for (auto ${loopLocalVariable}Internal : ${loopLocalVariable}) {
|
|
237
|
-
${handleArrayElementType(
|
|
238
|
-
eventTypeAnnotation.elementType,
|
|
239
|
-
`${propertyName}Array`,
|
|
240
|
-
`${indexVariable}Internal`,
|
|
241
|
-
`${loopLocalVariable}Internal`,
|
|
242
|
-
propertyParts,
|
|
243
|
-
extraIncludes,
|
|
244
|
-
usingEvent,
|
|
245
|
-
)}
|
|
210
|
+
${handleArrayElementType(eventTypeAnnotation.elementType, `${propertyName}Array`, `${indexVariable}Internal`, `${loopLocalVariable}Internal`, propertyParts, extraIncludes, usingEvent)}
|
|
246
211
|
}
|
|
247
212
|
${setValueAtIndex(propertyName, indexVariable, `${propertyName}Array`)}`;
|
|
248
213
|
}
|
|
@@ -327,12 +292,7 @@ function generateEvent(componentName, event, extraIncludes) {
|
|
|
327
292
|
if (event.typeAnnotation.argument) {
|
|
328
293
|
const implementation = `
|
|
329
294
|
auto payload = jsi::Object(runtime);
|
|
330
|
-
${generateSetters(
|
|
331
|
-
'payload',
|
|
332
|
-
event.typeAnnotation.argument.properties,
|
|
333
|
-
[],
|
|
334
|
-
extraIncludes,
|
|
335
|
-
)}
|
|
295
|
+
${generateSetters('payload', event.typeAnnotation.argument.properties, [], extraIncludes)}
|
|
336
296
|
return payload;
|
|
337
297
|
`.trim();
|
|
338
298
|
if (!event.name.startsWith('on')) {
|
|
@@ -150,11 +150,7 @@ function generateStruct(structs, componentName, nameParts, properties) {
|
|
|
150
150
|
const structName = generateEventStructName(structNameParts);
|
|
151
151
|
const fields = properties
|
|
152
152
|
.map(property => {
|
|
153
|
-
return `${getNativeTypeFromAnnotation(
|
|
154
|
-
componentName,
|
|
155
|
-
property,
|
|
156
|
-
structNameParts,
|
|
157
|
-
)} ${property.name};`;
|
|
153
|
+
return `${getNativeTypeFromAnnotation(componentName, property, structNameParts)} ${property.name};`;
|
|
158
154
|
})
|
|
159
155
|
.join('\n' + ' ');
|
|
160
156
|
properties.forEach(property => {
|
|
@@ -287,17 +287,13 @@ function generateStringEnum(componentName, prop) {
|
|
|
287
287
|
const fromCases = values
|
|
288
288
|
.map(
|
|
289
289
|
value =>
|
|
290
|
-
`if (string == "${value}") { result = ${enumName}::${convertValueToEnumOption(
|
|
291
|
-
value,
|
|
292
|
-
)}; return; }`,
|
|
290
|
+
`if (string == "${value}") { result = ${enumName}::${convertValueToEnumOption(value)}; return; }`,
|
|
293
291
|
)
|
|
294
292
|
.join('\n' + ' ');
|
|
295
293
|
const toCases = values
|
|
296
294
|
.map(
|
|
297
295
|
value =>
|
|
298
|
-
`case ${enumName}::${convertValueToEnumOption(
|
|
299
|
-
value,
|
|
300
|
-
)}: return "${value}";`,
|
|
296
|
+
`case ${enumName}::${convertValueToEnumOption(value)}: return "${value}";`,
|
|
301
297
|
)
|
|
302
298
|
.join('\n' + ' ');
|
|
303
299
|
return EnumTemplate({
|
|
@@ -325,19 +321,13 @@ function generateIntEnum(componentName, prop) {
|
|
|
325
321
|
const toCases = values
|
|
326
322
|
.map(
|
|
327
323
|
value =>
|
|
328
|
-
`case ${enumName}::${toIntEnumValueName(
|
|
329
|
-
prop.name,
|
|
330
|
-
value,
|
|
331
|
-
)}: return "${value}";`,
|
|
324
|
+
`case ${enumName}::${toIntEnumValueName(prop.name, value)}: return "${value}";`,
|
|
332
325
|
)
|
|
333
326
|
.join('\n' + ' ');
|
|
334
327
|
const toDynamicCases = values
|
|
335
328
|
.map(
|
|
336
329
|
value =>
|
|
337
|
-
`case ${enumName}::${toIntEnumValueName(
|
|
338
|
-
prop.name,
|
|
339
|
-
value,
|
|
340
|
-
)}: return ${value};`,
|
|
330
|
+
`case ${enumName}::${toIntEnumValueName(prop.name, value)}: return ${value};`,
|
|
341
331
|
)
|
|
342
332
|
.join('\n' + ' ');
|
|
343
333
|
const valueVariables = values
|
|
@@ -488,9 +478,7 @@ function generateStructs(componentName, properties, nameParts) {
|
|
|
488
478
|
// Generate the conversion function for std:vector<Object>.
|
|
489
479
|
// Note: This needs to be at the end since it references the struct above.
|
|
490
480
|
structs.set(
|
|
491
|
-
`${[componentName, ...nameParts.concat([prop.name])].join(
|
|
492
|
-
'',
|
|
493
|
-
)}ArrayStruct`,
|
|
481
|
+
`${[componentName, ...nameParts.concat([prop.name])].join('')}ArrayStruct`,
|
|
494
482
|
ArrayConversionFunctionTemplate({
|
|
495
483
|
structName: generateStructName(
|
|
496
484
|
componentName,
|
|
@@ -529,9 +517,7 @@ function generateStructs(componentName, properties, nameParts) {
|
|
|
529
517
|
// Generate the conversion function for std:vector<Object>.
|
|
530
518
|
// Note: This needs to be at the end since it references the struct above.
|
|
531
519
|
structs.set(
|
|
532
|
-
`${[componentName, ...nameParts.concat([prop.name])].join(
|
|
533
|
-
'',
|
|
534
|
-
)}ArrayArrayStruct`,
|
|
520
|
+
`${[componentName, ...nameParts.concat([prop.name])].join('')}ArrayArrayStruct`,
|
|
535
521
|
DoubleArrayConversionFunctionTemplate({
|
|
536
522
|
structName: generateStructName(
|
|
537
523
|
componentName,
|
|
@@ -135,9 +135,7 @@ function generatePropCasesString(component, componentName) {
|
|
|
135
135
|
const cases = component.props
|
|
136
136
|
.map(prop => {
|
|
137
137
|
return `case "${prop.name}":
|
|
138
|
-
mViewManager.set${toSafeJavaString(
|
|
139
|
-
prop.name,
|
|
140
|
-
)}(view, ${getJavaValueForProp(prop, componentName)});
|
|
138
|
+
mViewManager.set${toSafeJavaString(prop.name)}(view, ${getJavaValueForProp(prop, componentName)});
|
|
141
139
|
break;`;
|
|
142
140
|
})
|
|
143
141
|
.join('\n' + ' ');
|
|
@@ -188,10 +186,7 @@ function generateCommandCasesString(component, componentName) {
|
|
|
188
186
|
const commandMethods = component.commands
|
|
189
187
|
.map(command => {
|
|
190
188
|
return `case "${command.name}":
|
|
191
|
-
mViewManager.${toSafeJavaString(
|
|
192
|
-
command.name,
|
|
193
|
-
false,
|
|
194
|
-
)}(${getCommandArguments(command)});
|
|
189
|
+
mViewManager.${toSafeJavaString(command.name, false)}(${getCommandArguments(command)});
|
|
195
190
|
break;`;
|
|
196
191
|
})
|
|
197
192
|
.join('\n' + ' ');
|
|
@@ -119,9 +119,7 @@ function generatePropsString(component, imports) {
|
|
|
119
119
|
}
|
|
120
120
|
return component.props
|
|
121
121
|
.map(prop => {
|
|
122
|
-
return `void set${toSafeJavaString(
|
|
123
|
-
prop.name,
|
|
124
|
-
)}(T view, ${getJavaValueForProp(prop, imports)});`;
|
|
122
|
+
return `void set${toSafeJavaString(prop.name)}(T view, ${getJavaValueForProp(prop, imports)});`;
|
|
125
123
|
})
|
|
126
124
|
.join('\n' + ' ');
|
|
127
125
|
}
|
|
@@ -166,10 +164,7 @@ function generateCommandsString(component, componentName) {
|
|
|
166
164
|
return component.commands
|
|
167
165
|
.map(command => {
|
|
168
166
|
const safeJavaName = toSafeJavaString(command.name, false);
|
|
169
|
-
return `void ${safeJavaName}(${getCommandArguments(
|
|
170
|
-
command,
|
|
171
|
-
componentName,
|
|
172
|
-
)});`;
|
|
167
|
+
return `void ${safeJavaName}(${getCommandArguments(command, componentName)});`;
|
|
173
168
|
})
|
|
174
169
|
.join('\n' + ' ');
|
|
175
170
|
}
|
|
@@ -22,20 +22,8 @@ const HostFunctionTemplate = ({
|
|
|
22
22
|
const isVoid = returnTypeAnnotation.type === 'VoidTypeAnnotation';
|
|
23
23
|
const methodCallArgs = [' rt', ...args].join(',\n ');
|
|
24
24
|
const methodCall = `static_cast<${hasteModuleName}CxxSpecJSI *>(&turboModule)->${methodName}(\n${methodCallArgs}\n )`;
|
|
25
|
-
return `static jsi::Value __hostFunction_${hasteModuleName}CxxSpecJSI_${methodName}(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {${
|
|
26
|
-
|
|
27
|
-
? `\n ${methodCall};`
|
|
28
|
-
: isNullable
|
|
29
|
-
? `\n auto result = ${methodCall};`
|
|
30
|
-
: ''
|
|
31
|
-
}
|
|
32
|
-
return ${
|
|
33
|
-
isVoid
|
|
34
|
-
? 'jsi::Value::undefined()'
|
|
35
|
-
: isNullable
|
|
36
|
-
? 'result ? jsi::Value(std::move(*result)) : jsi::Value::null()'
|
|
37
|
-
: methodCall
|
|
38
|
-
};
|
|
25
|
+
return `static jsi::Value __hostFunction_${hasteModuleName}CxxSpecJSI_${methodName}(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {${isVoid ? `\n ${methodCall};` : isNullable ? `\n auto result = ${methodCall};` : ''}
|
|
26
|
+
return ${isVoid ? 'jsi::Value::undefined()' : isNullable ? 'result ? jsi::Value(std::move(*result)) : jsi::Value::null()' : methodCall};
|
|
39
27
|
}`;
|
|
40
28
|
};
|
|
41
29
|
const ModuleTemplate = ({
|
|
@@ -234,9 +234,7 @@ function createStructsString(hasteModuleName, aliasMap, resolveAlias, enumMap) {
|
|
|
234
234
|
});
|
|
235
235
|
const debugParameterConversion = value.properties
|
|
236
236
|
.map(
|
|
237
|
-
v => ` static ${getCppType(alias, v)} ${
|
|
238
|
-
v.name
|
|
239
|
-
}ToJs(jsi::Runtime &rt, decltype(types.${v.name}) value) {
|
|
237
|
+
v => ` static ${getCppType(alias, v)} ${v.name}ToJs(jsi::Runtime &rt, decltype(types.${v.name}) value) {
|
|
240
238
|
return bridging::toJs(rt, value);
|
|
241
239
|
}`,
|
|
242
240
|
)
|
|
@@ -248,9 +246,7 @@ template <${templateParameterWithTypename}>
|
|
|
248
246
|
struct ${structName} {
|
|
249
247
|
${templateMemberTypes.map(v => ' ' + v).join(';\n')};
|
|
250
248
|
bool operator==(const ${structName} &other) const {
|
|
251
|
-
return ${value.properties
|
|
252
|
-
.map(v => `${v.name} == other.${v.name}`)
|
|
253
|
-
.join(' && ')};
|
|
249
|
+
return ${value.properties.map(v => `${v.name} == other.${v.name}`).join(' && ')};
|
|
254
250
|
}
|
|
255
251
|
};
|
|
256
252
|
|
|
@@ -469,29 +465,15 @@ function translateEventEmitterToCpp(
|
|
|
469
465
|
return {
|
|
470
466
|
isVoidTypeAnnotation: isVoidTypeAnnotation,
|
|
471
467
|
templateName: isVoidTypeAnnotation ? `/*${templateName}*/` : templateName,
|
|
472
|
-
registerEventEmitter: ` eventEmitterMap_["${
|
|
473
|
-
eventEmitter.name
|
|
474
|
-
}"] = std::make_shared<AsyncEventEmitter<${
|
|
475
|
-
isVoidTypeAnnotation ? '' : 'jsi::Value'
|
|
476
|
-
}>>();`,
|
|
468
|
+
registerEventEmitter: ` eventEmitterMap_["${eventEmitter.name}"] = std::make_shared<AsyncEventEmitter<${isVoidTypeAnnotation ? '' : 'jsi::Value'}>>();`,
|
|
477
469
|
emitFunction: `
|
|
478
|
-
${
|
|
479
|
-
isVoidTypeAnnotation
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
})
|
|
485
|
-
isVoidTypeAnnotation
|
|
486
|
-
? ''
|
|
487
|
-
: `
|
|
488
|
-
static_assert(bridging::supportsFromJs<${
|
|
489
|
-
isArray ? `std::vector<${templateName}>` : templateName
|
|
490
|
-
}, ${jsiType}>, "value cannnot be converted to ${jsiType}");`
|
|
491
|
-
}
|
|
492
|
-
static_cast<AsyncEventEmitter<${
|
|
493
|
-
isVoidTypeAnnotation ? '' : 'jsi::Value'
|
|
494
|
-
}>&>(*delegate_.eventEmitterMap_["${eventEmitter.name}"]).emit(${
|
|
470
|
+
${isVoidTypeAnnotation ? '' : `template <typename ${templateName}> `}void emit${toPascalCase(eventEmitter.name)}(${isVoidTypeAnnotation ? '' : `${isArray ? `std::vector<${templateName}>` : templateName} value`}) {${
|
|
471
|
+
isVoidTypeAnnotation
|
|
472
|
+
? ''
|
|
473
|
+
: `
|
|
474
|
+
static_assert(bridging::supportsFromJs<${isArray ? `std::vector<${templateName}>` : templateName}, ${jsiType}>, "value cannnot be converted to ${jsiType}");`
|
|
475
|
+
}
|
|
476
|
+
static_cast<AsyncEventEmitter<${isVoidTypeAnnotation ? '' : 'jsi::Value'}>&>(*delegate_.eventEmitterMap_["${eventEmitter.name}"]).emit(${
|
|
495
477
|
isVoidTypeAnnotation
|
|
496
478
|
? ''
|
|
497
479
|
: `[jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
@@ -50,16 +50,8 @@ ${eventEmitters}${eventEmitters.length > 0 ? '\n\n' : ''}${methods}
|
|
|
50
50
|
`;
|
|
51
51
|
}
|
|
52
52
|
function EventEmitterTemplate(eventEmitter, imports) {
|
|
53
|
-
return ` protected final void emit${toPascalCase(eventEmitter.name)}(${
|
|
54
|
-
eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation'
|
|
55
|
-
? `${translateEventEmitterTypeToJavaType(eventEmitter, imports)} value`
|
|
56
|
-
: ''
|
|
57
|
-
}) {
|
|
58
|
-
mEventEmitterCallback.invoke("${eventEmitter.name}"${
|
|
59
|
-
eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation'
|
|
60
|
-
? ', value'
|
|
61
|
-
: ''
|
|
62
|
-
});
|
|
53
|
+
return ` protected final void emit${toPascalCase(eventEmitter.name)}(${eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' ? `${translateEventEmitterTypeToJavaType(eventEmitter, imports)} value` : ''}) {
|
|
54
|
+
mEventEmitterCallback.invoke("${eventEmitter.name}"${eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' ? ', value' : ''});
|
|
63
55
|
}`;
|
|
64
56
|
}
|
|
65
57
|
function MethodTemplate(config) {
|
|
@@ -75,12 +67,10 @@ function MethodTemplate(config) {
|
|
|
75
67
|
const methodClosing = abstract
|
|
76
68
|
? ';'
|
|
77
69
|
: methodBody != null && methodBody.length > 0
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
? ` { ${methodBody} }`
|
|
71
|
+
: ' {}';
|
|
80
72
|
return ` ${methodJavaAnnotation}
|
|
81
|
-
public ${methodQualifier}${translatedReturnType} ${methodName}(${traversedArgs.join(
|
|
82
|
-
', ',
|
|
83
|
-
)})${methodClosing}`;
|
|
73
|
+
public ${methodQualifier}${translatedReturnType} ${methodName}(${traversedArgs.join(', ')})${methodClosing}`;
|
|
84
74
|
}
|
|
85
75
|
function translateEventEmitterTypeToJavaType(eventEmitter, imports) {
|
|
86
76
|
const type = eventEmitter.typeAnnotation.typeAnnotation.type;
|
|
@@ -512,9 +502,7 @@ module.exports = {
|
|
|
512
502
|
imports.add('com.facebook.react.bridge.Promise');
|
|
513
503
|
traversedArgs.push('Promise promise');
|
|
514
504
|
}
|
|
515
|
-
const methodJavaAnnotation = `@ReactMethod${
|
|
516
|
-
isSyncMethod ? '(isBlockingSynchronousMethod = true)' : ''
|
|
517
|
-
}\n @DoNotStrip`;
|
|
505
|
+
const methodJavaAnnotation = `@ReactMethod${isSyncMethod ? '(isBlockingSynchronousMethod = true)' : ''}\n @DoNotStrip`;
|
|
518
506
|
const methodBody = method.optional
|
|
519
507
|
? getFalsyReturnStatementFromReturnType(
|
|
520
508
|
methodTypeAnnotation.returnTypeAnnotation,
|
|
@@ -75,11 +75,7 @@ target_link_libraries(
|
|
|
75
75
|
jsi
|
|
76
76
|
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
77
77
|
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
78
|
-
${
|
|
79
|
-
targetName !== 'rncore'
|
|
80
|
-
? 'reactnative'
|
|
81
|
-
: 'folly_runtime glog react_debug react_nativemodule_core react_renderer_componentregistry react_renderer_core react_renderer_debug react_renderer_graphics react_renderer_imagemanager react_renderer_mapbuffer react_utils rrc_image rrc_view turbomodulejsijni yoga'
|
|
82
|
-
}
|
|
78
|
+
${targetName !== 'rncore' ? 'reactnative' : 'folly_runtime glog react_debug react_nativemodule_core react_renderer_componentregistry react_renderer_core react_renderer_debug react_renderer_graphics react_renderer_imagemanager react_renderer_mapbuffer react_utils rrc_image rrc_view turbomodulejsijni yoga'}
|
|
83
79
|
)
|
|
84
80
|
|
|
85
81
|
target_compile_reactnative_options(react_codegen_${targetName} PRIVATE)
|
|
@@ -112,10 +112,7 @@ function toObjCType(
|
|
|
112
112
|
return wrapObjCOptional('id<NSObject>', isRequired);
|
|
113
113
|
}
|
|
114
114
|
return wrapCxxOptional(
|
|
115
|
-
`std::vector<${toObjCType(
|
|
116
|
-
hasteModuleName,
|
|
117
|
-
typeAnnotation.elementType,
|
|
118
|
-
)}>`,
|
|
115
|
+
`std::vector<${toObjCType(hasteModuleName, typeAnnotation.elementType)}>`,
|
|
119
116
|
isRequired,
|
|
120
117
|
);
|
|
121
118
|
case 'TypeAliasTypeAnnotation':
|
|
@@ -202,9 +199,7 @@ function toObjCValue(
|
|
|
202
199
|
depth + 1,
|
|
203
200
|
);
|
|
204
201
|
const RCTConvertVecToArray = transformer => {
|
|
205
|
-
return `RCTConvert${
|
|
206
|
-
!isRequired ? 'Optional' : ''
|
|
207
|
-
}VecToArray(${value}, ${transformer})`;
|
|
202
|
+
return `RCTConvert${!isRequired ? 'Optional' : ''}VecToArray(${value}, ${transformer})`;
|
|
208
203
|
};
|
|
209
204
|
return RCTConvertVecToArray(
|
|
210
205
|
`^id(${elementObjCType} ${localVarName}) { return ${elementObjCValue}; }`,
|
|
@@ -100,10 +100,7 @@ function toObjCType(
|
|
|
100
100
|
return wrapObjCOptional('id<NSObject>', isRequired);
|
|
101
101
|
}
|
|
102
102
|
return wrapCxxOptional(
|
|
103
|
-
`facebook::react::LazyVector<${toObjCType(
|
|
104
|
-
hasteModuleName,
|
|
105
|
-
typeAnnotation.elementType,
|
|
106
|
-
)}>`,
|
|
103
|
+
`facebook::react::LazyVector<${toObjCType(hasteModuleName, typeAnnotation.elementType)}>`,
|
|
107
104
|
isRequired,
|
|
108
105
|
);
|
|
109
106
|
case 'TypeAliasTypeAnnotation':
|
|
@@ -45,27 +45,12 @@ function getEventEmitterTypeObjCType(eventEmitter) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
function EventEmitterHeaderTemplate(eventEmitter) {
|
|
48
|
-
return `- (void)emit${toPascalCase(eventEmitter.name)}${
|
|
49
|
-
eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation'
|
|
50
|
-
? `:(${getEventEmitterTypeObjCType(eventEmitter)})value`
|
|
51
|
-
: ''
|
|
52
|
-
};`;
|
|
48
|
+
return `- (void)emit${toPascalCase(eventEmitter.name)}${eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' ? `:(${getEventEmitterTypeObjCType(eventEmitter)})value` : ''};`;
|
|
53
49
|
}
|
|
54
50
|
function EventEmitterImplementationTemplate(eventEmitter) {
|
|
55
|
-
return `- (void)emit${toPascalCase(eventEmitter.name)}${
|
|
56
|
-
eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation'
|
|
57
|
-
? `:(${getEventEmitterTypeObjCType(eventEmitter)})value`
|
|
58
|
-
: ''
|
|
59
|
-
}
|
|
51
|
+
return `- (void)emit${toPascalCase(eventEmitter.name)}${eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' ? `:(${getEventEmitterTypeObjCType(eventEmitter)})value` : ''}
|
|
60
52
|
{
|
|
61
|
-
_eventEmitterCallback("${eventEmitter.name}", ${
|
|
62
|
-
eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation'
|
|
63
|
-
? eventEmitter.typeAnnotation.typeAnnotation.type !==
|
|
64
|
-
'BooleanTypeAnnotation'
|
|
65
|
-
? 'value'
|
|
66
|
-
: '[NSNumber numberWithBool:value]'
|
|
67
|
-
: 'nil'
|
|
68
|
-
});
|
|
53
|
+
_eventEmitterCallback("${eventEmitter.name}", ${eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' ? (eventEmitter.typeAnnotation.typeAnnotation.type !== 'BooleanTypeAnnotation' ? 'value' : '[NSNumber numberWithBool:value]') : 'nil'});
|
|
69
54
|
}`;
|
|
70
55
|
}
|
|
71
56
|
module.exports = {
|
|
@@ -261,10 +261,7 @@ function getReturnObjCType(methodName, nullableTypeAnnotation) {
|
|
|
261
261
|
return wrapOptional('NSArray<id<NSObject>> *', isRequired);
|
|
262
262
|
}
|
|
263
263
|
return wrapOptional(
|
|
264
|
-
`NSArray<${getReturnObjCType(
|
|
265
|
-
methodName,
|
|
266
|
-
typeAnnotation.elementType,
|
|
267
|
-
)}> *`,
|
|
264
|
+
`NSArray<${getReturnObjCType(methodName, typeAnnotation.elementType)}> *`,
|
|
268
265
|
isRequired,
|
|
269
266
|
);
|
|
270
267
|
case 'ReservedTypeAnnotation':
|
|
@@ -21,9 +21,7 @@ const ModuleTemplate = ({
|
|
|
21
21
|
methodSerializationOutputs,
|
|
22
22
|
}) => `
|
|
23
23
|
@implementation ${hasteModuleName}SpecBase
|
|
24
|
-
${eventEmitters
|
|
25
|
-
.map(eventEmitter => EventEmitterImplementationTemplate(eventEmitter))
|
|
26
|
-
.join('\n')}
|
|
24
|
+
${eventEmitters.map(eventEmitter => EventEmitterImplementationTemplate(eventEmitter)).join('\n')}
|
|
27
25
|
|
|
28
26
|
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
|
|
29
27
|
{
|
|
@@ -63,22 +61,22 @@ namespace facebook::react {
|
|
|
63
61
|
}),
|
|
64
62
|
)
|
|
65
63
|
.join('\n' + ' '.repeat(8))}${
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
eventEmitters.length > 0
|
|
65
|
+
? eventEmitters
|
|
66
|
+
.map(eventEmitter => {
|
|
67
|
+
return `
|
|
70
68
|
eventEmitterMap_["${eventEmitter.name}"] = std::make_shared<AsyncEventEmitter<id>>();`;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}${
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
})
|
|
70
|
+
.join('')
|
|
71
|
+
: ''
|
|
72
|
+
}${
|
|
73
|
+
eventEmitters.length > 0
|
|
74
|
+
? `
|
|
77
75
|
setEventEmitterCallback([&](const std::string &name, id value) {
|
|
78
76
|
static_cast<AsyncEventEmitter<id> &>(*eventEmitterMap_[name]).emit(value);
|
|
79
77
|
});`
|
|
80
|
-
|
|
81
|
-
}
|
|
78
|
+
: ''
|
|
79
|
+
}
|
|
82
80
|
}
|
|
83
81
|
} // namespace facebook::react`;
|
|
84
82
|
const RCTCxxConvertCategoryTemplate = ({
|
package/lib/parsers/errors.js
CHANGED
|
@@ -274,9 +274,7 @@ class UnsupportedUnionTypeAnnotationParserError extends ParserError {
|
|
|
274
274
|
super(
|
|
275
275
|
nativeModuleName,
|
|
276
276
|
arrayElementTypeAST,
|
|
277
|
-
`Union members must be of the same type, but multiple types were found ${types.join(
|
|
278
|
-
', ',
|
|
279
|
-
)}'.`,
|
|
277
|
+
`Union members must be of the same type, but multiple types were found ${types.join(', ')}'.`,
|
|
280
278
|
);
|
|
281
279
|
}
|
|
282
280
|
}
|
|
@@ -297,8 +297,8 @@ function getTypeAnnotation(
|
|
|
297
297
|
default: withNullDefault
|
|
298
298
|
? defaultValue
|
|
299
299
|
: defaultValue
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
? defaultValue
|
|
301
|
+
: 0,
|
|
302
302
|
};
|
|
303
303
|
case 'BooleanTypeAnnotation':
|
|
304
304
|
return {
|
|
@@ -306,8 +306,8 @@ function getTypeAnnotation(
|
|
|
306
306
|
default: withNullDefault
|
|
307
307
|
? defaultValue
|
|
308
308
|
: defaultValue == null
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
? false
|
|
310
|
+
: defaultValue,
|
|
311
311
|
};
|
|
312
312
|
case 'StringTypeAnnotation':
|
|
313
313
|
if (typeof defaultValue !== 'undefined') {
|
|
@@ -139,9 +139,7 @@ function extractArrayElementType(typeAnnotation, name, parser) {
|
|
|
139
139
|
const genericParams = typeAnnotation.typeParameters.params;
|
|
140
140
|
if (genericParams.length !== 1) {
|
|
141
141
|
throw new Error(
|
|
142
|
-
`Events only supports arrays with 1 Generic type. Found ${
|
|
143
|
-
genericParams.length
|
|
144
|
-
} types:\n${prettify(genericParams)}`,
|
|
142
|
+
`Events only supports arrays with 1 Generic type. Found ${genericParams.length} types:\n${prettify(genericParams)}`,
|
|
145
143
|
);
|
|
146
144
|
}
|
|
147
145
|
return {
|
|
@@ -150,9 +148,7 @@ function extractArrayElementType(typeAnnotation, name, parser) {
|
|
|
150
148
|
};
|
|
151
149
|
default:
|
|
152
150
|
throw new Error(
|
|
153
|
-
`Unrecognized ${type} for Array ${name} in events.\n${prettify(
|
|
154
|
-
typeAnnotation,
|
|
155
|
-
)}`,
|
|
151
|
+
`Unrecognized ${type} for Array ${name} in events.\n${prettify(typeAnnotation)}`,
|
|
156
152
|
);
|
|
157
153
|
}
|
|
158
154
|
}
|
|
@@ -179,8 +179,8 @@ class FlowParser {
|
|
|
179
179
|
typeAnnotation.type === 'EnumStringBody'
|
|
180
180
|
? 'StringTypeAnnotation'
|
|
181
181
|
: typeAnnotation.type === 'EnumNumberBody'
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
? 'NumberTypeAnnotation'
|
|
183
|
+
: null;
|
|
184
184
|
if (!enumMembersType) {
|
|
185
185
|
throw new Error(
|
|
186
186
|
`Unknown enum type annotation type. Got: ${typeAnnotation.type}. Expected: EnumStringBody or EnumNumberBody.`,
|
|
@@ -227,17 +227,17 @@ class FlowParser {
|
|
|
227
227
|
value: member.init.value,
|
|
228
228
|
}
|
|
229
229
|
: typeof ((_member$init2 = member.init) === null ||
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
230
|
+
_member$init2 === void 0
|
|
231
|
+
? void 0
|
|
232
|
+
: _member$init2.value) === 'string'
|
|
233
|
+
? {
|
|
234
|
+
type: 'StringLiteralTypeAnnotation',
|
|
235
|
+
value: member.init.value,
|
|
236
|
+
}
|
|
237
|
+
: {
|
|
238
|
+
type: 'StringLiteralTypeAnnotation',
|
|
239
|
+
value: member.id.name,
|
|
240
|
+
};
|
|
241
241
|
return {
|
|
242
242
|
name: member.id.name,
|
|
243
243
|
value: value,
|
|
@@ -1019,9 +1019,7 @@ function getCommandProperties(ast, parser) {
|
|
|
1019
1019
|
)
|
|
1020
1020
|
) {
|
|
1021
1021
|
throw new Error(
|
|
1022
|
-
`codegenNativeCommands expected the same supportedCommands specified in the ${commandTypeName} interface: ${commandPropertyNames.join(
|
|
1023
|
-
', ',
|
|
1024
|
-
)}`,
|
|
1022
|
+
`codegenNativeCommands expected the same supportedCommands specified in the ${commandTypeName} interface: ${commandPropertyNames.join(', ')}`,
|
|
1025
1023
|
);
|
|
1026
1024
|
}
|
|
1027
1025
|
return properties;
|
|
@@ -64,14 +64,7 @@ function getUnionOfLiterals(name, forArray, elementTypes, defaultValue, types) {
|
|
|
64
64
|
} else {
|
|
65
65
|
var _elementTypes$0$liter3;
|
|
66
66
|
throw new Error(
|
|
67
|
-
`Unsupported union type for "${name}", received "${
|
|
68
|
-
unionType === 'TSLiteralType'
|
|
69
|
-
? (_elementTypes$0$liter3 = elementTypes[0].literal) === null ||
|
|
70
|
-
_elementTypes$0$liter3 === void 0
|
|
71
|
-
? void 0
|
|
72
|
-
: _elementTypes$0$liter3.type
|
|
73
|
-
: unionType
|
|
74
|
-
}"`,
|
|
67
|
+
`Unsupported union type for "${name}", received "${unionType === 'TSLiteralType' ? ((_elementTypes$0$liter3 = elementTypes[0].literal) === null || _elementTypes$0$liter3 === void 0 ? void 0 : _elementTypes$0$liter3.type) : unionType}"`,
|
|
75
68
|
);
|
|
76
69
|
}
|
|
77
70
|
}
|
|
@@ -141,11 +141,7 @@ function extractArrayElementType(typeAnnotation, name, parser) {
|
|
|
141
141
|
};
|
|
142
142
|
default:
|
|
143
143
|
throw new Error(
|
|
144
|
-
`Unrecognized ${type} for Array ${name} in events.\n${JSON.stringify(
|
|
145
|
-
typeAnnotation,
|
|
146
|
-
null,
|
|
147
|
-
2,
|
|
148
|
-
)}`,
|
|
144
|
+
`Unrecognized ${type} for Array ${name} in events.\n${JSON.stringify(typeAnnotation, null, 2)}`,
|
|
149
145
|
);
|
|
150
146
|
}
|
|
151
147
|
}
|
|
@@ -224,8 +224,8 @@ class TypeScriptParser {
|
|
|
224
224
|
enumMembersType === 'StringTypeAnnotation'
|
|
225
225
|
? 'StringLiteral'
|
|
226
226
|
: enumMembersType === 'NumberTypeAnnotation'
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
? 'NumericLiteral'
|
|
228
|
+
: null;
|
|
229
229
|
typeAnnotation.members.forEach(member => {
|
|
230
230
|
var _member$initializer,
|
|
231
231
|
_member$initializer2,
|
|
@@ -248,9 +248,9 @@ class TypeScriptParser {
|
|
|
248
248
|
? void 0
|
|
249
249
|
: _member$initializer3.type
|
|
250
250
|
: (_member$initializer4 = member.initializer) === null ||
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
_member$initializer4 === void 0
|
|
252
|
+
? void 0
|
|
253
|
+
: _member$initializer4.type;
|
|
254
254
|
if (
|
|
255
255
|
(initializerType !== null && initializerType !== void 0
|
|
256
256
|
? initializerType
|
|
@@ -288,33 +288,33 @@ class TypeScriptParser {
|
|
|
288
288
|
: _member$initializer6.value),
|
|
289
289
|
}
|
|
290
290
|
: typeof ((_member$initializer7 = member.initializer) === null ||
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
? void 0
|
|
305
|
-
: _member$initializer9.value) === 'string'
|
|
306
|
-
? {
|
|
307
|
-
type: 'StringLiteralTypeAnnotation',
|
|
308
|
-
value:
|
|
309
|
-
(_member$initializer10 = member.initializer) === null ||
|
|
310
|
-
_member$initializer10 === void 0
|
|
291
|
+
_member$initializer7 === void 0
|
|
292
|
+
? void 0
|
|
293
|
+
: _member$initializer7.value) === 'number'
|
|
294
|
+
? {
|
|
295
|
+
type: 'NumberLiteralTypeAnnotation',
|
|
296
|
+
value:
|
|
297
|
+
(_member$initializer8 = member.initializer) === null ||
|
|
298
|
+
_member$initializer8 === void 0
|
|
299
|
+
? void 0
|
|
300
|
+
: _member$initializer8.value,
|
|
301
|
+
}
|
|
302
|
+
: typeof ((_member$initializer9 = member.initializer) === null ||
|
|
303
|
+
_member$initializer9 === void 0
|
|
311
304
|
? void 0
|
|
312
|
-
: _member$
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
305
|
+
: _member$initializer9.value) === 'string'
|
|
306
|
+
? {
|
|
307
|
+
type: 'StringLiteralTypeAnnotation',
|
|
308
|
+
value:
|
|
309
|
+
(_member$initializer10 = member.initializer) === null ||
|
|
310
|
+
_member$initializer10 === void 0
|
|
311
|
+
? void 0
|
|
312
|
+
: _member$initializer10.value,
|
|
313
|
+
}
|
|
314
|
+
: {
|
|
315
|
+
type: 'StringLiteralTypeAnnotation',
|
|
316
|
+
value: member.id.name,
|
|
317
|
+
};
|
|
318
318
|
return {
|
|
319
319
|
name: member.id.name,
|
|
320
320
|
value,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/codegen",
|
|
3
|
-
"version": "0.82.0-nightly-
|
|
3
|
+
"version": "0.82.0-nightly-20250729-e17e3e3f3",
|
|
4
4
|
"description": "Code generation tools for React Native",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/preset-env": "^7.25.3",
|
|
46
46
|
"hermes-estree": "0.30.0",
|
|
47
47
|
"micromatch": "^4.0.4",
|
|
48
|
-
"prettier": "
|
|
48
|
+
"prettier": "3.6.2",
|
|
49
49
|
"rimraf": "^3.0.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|