@react-native/codegen 0.88.0-rc.0 → 0.88.0-rc.2
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/generators/modules/GenerateModuleH.js +1 -3
- package/lib/generators/modules/GenerateModuleH.js.flow +0 -6
- package/lib/generators/modules/GenerateModuleJavaSpec.js +4 -2
- package/lib/generators/modules/GenerateModuleJavaSpec.js.flow +5 -5
- package/lib/generators/modules/GenerateModuleObjCpp/index.js +0 -1
- package/lib/generators/modules/GenerateModuleObjCpp/index.js.flow +0 -1
- package/lib/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js +3 -7
- package/lib/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js.flow +4 -7
- package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js +2 -2
- package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js.flow +2 -2
- package/lib/generators/modules/Utils.js +0 -6
- package/lib/generators/modules/Utils.js.flow +0 -19
- package/lib/parsers/error-utils.js +0 -7
- package/lib/parsers/error-utils.js.flow +0 -21
- package/lib/parsers/errors.js +0 -6
- package/lib/parsers/errors.js.flow +0 -16
- package/lib/parsers/parsers-commons.js +0 -2
- package/lib/parsers/parsers-commons.js.flow +0 -8
- package/package.json +1 -1
|
@@ -16,8 +16,7 @@ const {
|
|
|
16
16
|
createAliasResolver,
|
|
17
17
|
getModules,
|
|
18
18
|
isArrayRecursiveMember,
|
|
19
|
-
isDirectRecursiveMember
|
|
20
|
-
throwIfUnsupportedEventEmitterPayload
|
|
19
|
+
isDirectRecursiveMember
|
|
21
20
|
} = require('./Utils');
|
|
22
21
|
function serializeArg(moduleName, arg, index, resolveAlias, enumMap) {
|
|
23
22
|
const {
|
|
@@ -411,7 +410,6 @@ function translateFunctionToCpp(hasteModuleName, prop, resolveAlias, enumMap, ar
|
|
|
411
410
|
${!isVoid ? !isNullable ? 'return ' : 'auto result = ' : ''}bridging::callFromJs<${returnType}>(rt, &T::${prop.name}, static_cast<${hasteModuleName}CxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule)${methodCallArgs});${!isVoid ? !isNullable ? '' : 'return result ? jsi::Value(std::move(*result)) : jsi::Value::null();' : 'return jsi::Value::undefined();'}\n }`;
|
|
412
411
|
}
|
|
413
412
|
function translateEventEmitterToCpp(moduleName, eventEmitter, resolveAlias, enumMap) {
|
|
414
|
-
throwIfUnsupportedEventEmitterPayload(eventEmitter.name, eventEmitter.typeAnnotation.typeAnnotation);
|
|
415
413
|
const isVoidTypeAnnotation = eventEmitter.typeAnnotation.typeAnnotation.type === 'VoidTypeAnnotation';
|
|
416
414
|
const templateName = `${toPascalCase(eventEmitter.name)}Type`;
|
|
417
415
|
const jsiType = translatePrimitiveJSTypeToCpp(moduleName, null, eventEmitter.typeAnnotation.typeAnnotation, false, typeName => `Unsupported type for eventEmitter "${eventEmitter.name}" in ${moduleName}. Found: ${typeName}`, resolveAlias, enumMap);
|
|
@@ -40,7 +40,6 @@ const {
|
|
|
40
40
|
getModules,
|
|
41
41
|
isArrayRecursiveMember,
|
|
42
42
|
isDirectRecursiveMember,
|
|
43
|
-
throwIfUnsupportedEventEmitterPayload,
|
|
44
43
|
} = require('./Utils');
|
|
45
44
|
|
|
46
45
|
type FilesOutput = Map<string, string>;
|
|
@@ -639,11 +638,6 @@ function translateEventEmitterToCpp(
|
|
|
639
638
|
resolveAlias: AliasResolver,
|
|
640
639
|
enumMap: NativeModuleEnumMap,
|
|
641
640
|
): EventEmitterCpp {
|
|
642
|
-
throwIfUnsupportedEventEmitterPayload(
|
|
643
|
-
eventEmitter.name,
|
|
644
|
-
eventEmitter.typeAnnotation.typeAnnotation,
|
|
645
|
-
);
|
|
646
|
-
|
|
647
641
|
const isVoidTypeAnnotation =
|
|
648
642
|
eventEmitter.typeAnnotation.typeAnnotation.type === 'VoidTypeAnnotation';
|
|
649
643
|
const templateName = `${toPascalCase(eventEmitter.name)}Type`;
|
|
@@ -13,7 +13,6 @@ const {
|
|
|
13
13
|
const {
|
|
14
14
|
createAliasResolver,
|
|
15
15
|
getModules,
|
|
16
|
-
throwIfUnsupportedEventEmitterPayload,
|
|
17
16
|
throwIfUnsupportedPromiseArrayBuffer
|
|
18
17
|
} = require('./Utils');
|
|
19
18
|
function FileTemplate(config) {
|
|
@@ -82,7 +81,6 @@ function MethodTemplate(config) {
|
|
|
82
81
|
}
|
|
83
82
|
function translateEventEmitterTypeToJavaType(eventEmitter, imports) {
|
|
84
83
|
const typeAnnotation = eventEmitter.typeAnnotation.typeAnnotation;
|
|
85
|
-
throwIfUnsupportedEventEmitterPayload(eventEmitter.name, typeAnnotation);
|
|
86
84
|
switch (typeAnnotation.type) {
|
|
87
85
|
case 'StringTypeAnnotation':
|
|
88
86
|
return 'String';
|
|
@@ -121,7 +119,11 @@ function translateEventEmitterTypeToJavaType(eventEmitter, imports) {
|
|
|
121
119
|
case 'ArrayTypeAnnotation':
|
|
122
120
|
imports.add('com.facebook.react.bridge.ReadableArray');
|
|
123
121
|
return 'ReadableArray';
|
|
122
|
+
case 'DoubleTypeAnnotation':
|
|
123
|
+
case 'FloatTypeAnnotation':
|
|
124
|
+
case 'Int32TypeAnnotation':
|
|
124
125
|
case 'VoidTypeAnnotation':
|
|
126
|
+
case 'ArrayBufferTypeAnnotation':
|
|
125
127
|
throw new Error(`Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`);
|
|
126
128
|
default:
|
|
127
129
|
typeAnnotation.type;
|
|
@@ -28,7 +28,6 @@ const {parseValidUnionType, toPascalCase} = require('../Utils');
|
|
|
28
28
|
const {
|
|
29
29
|
createAliasResolver,
|
|
30
30
|
getModules,
|
|
31
|
-
throwIfUnsupportedEventEmitterPayload,
|
|
32
31
|
throwIfUnsupportedPromiseArrayBuffer,
|
|
33
32
|
} = require('./Utils');
|
|
34
33
|
|
|
@@ -142,9 +141,6 @@ function translateEventEmitterTypeToJavaType(
|
|
|
142
141
|
imports: Set<string>,
|
|
143
142
|
): string {
|
|
144
143
|
const typeAnnotation = eventEmitter.typeAnnotation.typeAnnotation;
|
|
145
|
-
|
|
146
|
-
throwIfUnsupportedEventEmitterPayload(eventEmitter.name, typeAnnotation);
|
|
147
|
-
|
|
148
144
|
switch (typeAnnotation.type) {
|
|
149
145
|
case 'StringTypeAnnotation':
|
|
150
146
|
return 'String';
|
|
@@ -183,8 +179,12 @@ function translateEventEmitterTypeToJavaType(
|
|
|
183
179
|
case 'ArrayTypeAnnotation':
|
|
184
180
|
imports.add('com.facebook.react.bridge.ReadableArray');
|
|
185
181
|
return 'ReadableArray';
|
|
182
|
+
case 'DoubleTypeAnnotation':
|
|
183
|
+
case 'FloatTypeAnnotation':
|
|
184
|
+
case 'Int32TypeAnnotation':
|
|
186
185
|
case 'VoidTypeAnnotation':
|
|
187
|
-
|
|
186
|
+
case 'ArrayBufferTypeAnnotation':
|
|
187
|
+
// TODO: Add support for these types
|
|
188
188
|
throw new Error(
|
|
189
189
|
`Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`,
|
|
190
190
|
);
|
|
@@ -81,7 +81,6 @@ const HeaderFileTemplate = ({
|
|
|
81
81
|
#import <RCTRequired/RCTRequired.h>
|
|
82
82
|
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
83
83
|
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
84
|
-
#import <React/RCTArrayBuffer.h>
|
|
85
84
|
#import <React/RCTBridgeModule.h>
|
|
86
85
|
#import <React/RCTCxxConvert.h>
|
|
87
86
|
#import <React/RCTManagedPointer.h>
|
|
@@ -97,7 +97,6 @@ const HeaderFileTemplate = ({
|
|
|
97
97
|
#import <RCTRequired/RCTRequired.h>
|
|
98
98
|
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
99
99
|
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
100
|
-
#import <React/RCTArrayBuffer.h>
|
|
101
100
|
#import <React/RCTBridgeModule.h>
|
|
102
101
|
#import <React/RCTCxxConvert.h>
|
|
103
102
|
#import <React/RCTManagedPointer.h>
|
|
@@ -2,12 +2,8 @@ const {
|
|
|
2
2
|
parseValidUnionType,
|
|
3
3
|
toPascalCase
|
|
4
4
|
} = require('../../Utils');
|
|
5
|
-
const {
|
|
6
|
-
throwIfUnsupportedEventEmitterPayload
|
|
7
|
-
} = require('../Utils');
|
|
8
5
|
function getEventEmitterTypeObjCType(eventEmitter) {
|
|
9
6
|
const typeAnnotation = eventEmitter.typeAnnotation.typeAnnotation;
|
|
10
|
-
throwIfUnsupportedEventEmitterPayload(eventEmitter.name, typeAnnotation);
|
|
11
7
|
switch (typeAnnotation.type) {
|
|
12
8
|
case 'StringTypeAnnotation':
|
|
13
9
|
return 'NSString *_Nonnull';
|
|
@@ -30,9 +26,6 @@ function getEventEmitterTypeObjCType(eventEmitter) {
|
|
|
30
26
|
}
|
|
31
27
|
case 'NumberTypeAnnotation':
|
|
32
28
|
case 'NumberLiteralTypeAnnotation':
|
|
33
|
-
case 'DoubleTypeAnnotation':
|
|
34
|
-
case 'FloatTypeAnnotation':
|
|
35
|
-
case 'Int32TypeAnnotation':
|
|
36
29
|
return 'NSNumber *_Nonnull';
|
|
37
30
|
case 'BooleanTypeAnnotation':
|
|
38
31
|
case 'BooleanLiteralTypeAnnotation':
|
|
@@ -43,6 +36,9 @@ function getEventEmitterTypeObjCType(eventEmitter) {
|
|
|
43
36
|
return 'NSDictionary *';
|
|
44
37
|
case 'ArrayTypeAnnotation':
|
|
45
38
|
return 'NSArray<id<NSObject>> *';
|
|
39
|
+
case 'DoubleTypeAnnotation':
|
|
40
|
+
case 'FloatTypeAnnotation':
|
|
41
|
+
case 'Int32TypeAnnotation':
|
|
46
42
|
case 'VoidTypeAnnotation':
|
|
47
43
|
throw new Error(`Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`);
|
|
48
44
|
default:
|
|
@@ -11,15 +11,12 @@
|
|
|
11
11
|
import type {NativeModuleEventEmitterShape} from '../../../CodegenSchema';
|
|
12
12
|
|
|
13
13
|
const {parseValidUnionType, toPascalCase} = require('../../Utils');
|
|
14
|
-
const {throwIfUnsupportedEventEmitterPayload} = require('../Utils');
|
|
15
14
|
|
|
16
15
|
function getEventEmitterTypeObjCType(
|
|
17
16
|
eventEmitter: NativeModuleEventEmitterShape,
|
|
18
17
|
): string {
|
|
19
18
|
const typeAnnotation = eventEmitter.typeAnnotation.typeAnnotation;
|
|
20
19
|
|
|
21
|
-
throwIfUnsupportedEventEmitterPayload(eventEmitter.name, typeAnnotation);
|
|
22
|
-
|
|
23
20
|
switch (typeAnnotation.type) {
|
|
24
21
|
case 'StringTypeAnnotation':
|
|
25
22
|
return 'NSString *_Nonnull';
|
|
@@ -42,9 +39,6 @@ function getEventEmitterTypeObjCType(
|
|
|
42
39
|
}
|
|
43
40
|
case 'NumberTypeAnnotation':
|
|
44
41
|
case 'NumberLiteralTypeAnnotation':
|
|
45
|
-
case 'DoubleTypeAnnotation':
|
|
46
|
-
case 'FloatTypeAnnotation':
|
|
47
|
-
case 'Int32TypeAnnotation':
|
|
48
42
|
return 'NSNumber *_Nonnull';
|
|
49
43
|
case 'BooleanTypeAnnotation':
|
|
50
44
|
case 'BooleanLiteralTypeAnnotation':
|
|
@@ -55,8 +49,11 @@ function getEventEmitterTypeObjCType(
|
|
|
55
49
|
return 'NSDictionary *';
|
|
56
50
|
case 'ArrayTypeAnnotation':
|
|
57
51
|
return 'NSArray<id<NSObject>> *';
|
|
52
|
+
case 'DoubleTypeAnnotation':
|
|
53
|
+
case 'FloatTypeAnnotation':
|
|
54
|
+
case 'Int32TypeAnnotation':
|
|
58
55
|
case 'VoidTypeAnnotation':
|
|
59
|
-
//
|
|
56
|
+
// TODO: Add support for these types
|
|
60
57
|
throw new Error(
|
|
61
58
|
`Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`,
|
|
62
59
|
);
|
|
@@ -128,7 +128,7 @@ function getParamObjCType(hasteModuleName, methodName, param, structName, struct
|
|
|
128
128
|
}
|
|
129
129
|
case 'ArrayBufferTypeAnnotation':
|
|
130
130
|
{
|
|
131
|
-
return notStruct(wrapOptional('
|
|
131
|
+
return notStruct(wrapOptional('NSMutableData *', !nullable));
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
const [structTypeAnnotation] = unwrapNullable(structCollector.process(structName, 'REGULAR', resolveAlias, wrapNullable(nullable, typeAnnotation)));
|
|
@@ -252,7 +252,7 @@ function getReturnObjCType(methodName, nullableTypeAnnotation) {
|
|
|
252
252
|
case 'GenericObjectTypeAnnotation':
|
|
253
253
|
return wrapOptional('NSDictionary *', isRequired);
|
|
254
254
|
case 'ArrayBufferTypeAnnotation':
|
|
255
|
-
return wrapOptional('
|
|
255
|
+
return wrapOptional('NSMutableData *', isRequired);
|
|
256
256
|
default:
|
|
257
257
|
typeAnnotation.type;
|
|
258
258
|
throw new Error(`Unsupported return type for ${methodName}. Found: ${typeAnnotation.type}`);
|
|
@@ -227,7 +227,7 @@ function getParamObjCType(
|
|
|
227
227
|
return notStruct(wrapOptional('NSArray *', !nullable));
|
|
228
228
|
}
|
|
229
229
|
case 'ArrayBufferTypeAnnotation': {
|
|
230
|
-
return notStruct(wrapOptional('
|
|
230
|
+
return notStruct(wrapOptional('NSMutableData *', !nullable));
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
|
|
@@ -398,7 +398,7 @@ function getReturnObjCType(
|
|
|
398
398
|
case 'GenericObjectTypeAnnotation':
|
|
399
399
|
return wrapOptional('NSDictionary *', isRequired);
|
|
400
400
|
case 'ArrayBufferTypeAnnotation':
|
|
401
|
-
return wrapOptional('
|
|
401
|
+
return wrapOptional('NSMutableData *', isRequired);
|
|
402
402
|
default:
|
|
403
403
|
typeAnnotation.type as 'MixedTypeAnnotation';
|
|
404
404
|
throw new Error(
|
|
@@ -43,16 +43,10 @@ function throwIfUnsupportedPromiseArrayBuffer(methodName, nullableReturnTypeAnno
|
|
|
43
43
|
throw new Error(`Unsupported return type for method "${methodName}": Promise<ArrayBuffer> is not ` + 'supported for Android (Java/Kotlin) or iOS (ObjC) TurboModules. Use a C++ ' + '(Cxx) TurboModule, return the ArrayBuffer from a synchronous method, or resolve ' + 'the Promise with a different type. ArrayBuffer is still supported as a method ' + 'argument and as a synchronous return value on all platforms.');
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function throwIfUnsupportedEventEmitterPayload(eventEmitterName, typeAnnotation) {
|
|
47
|
-
if (typeAnnotation.type === 'ArrayBufferTypeAnnotation') {
|
|
48
|
-
throw new Error(`Unsupported eventType for ${eventEmitterName}. Found: ${typeAnnotation.type}. ` + 'ArrayBuffer is not supported as an EventEmitter payload on any platform. ' + 'Pass the ArrayBuffer through a method instead.');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
46
|
module.exports = {
|
|
52
47
|
createAliasResolver,
|
|
53
48
|
getModules,
|
|
54
49
|
isDirectRecursiveMember,
|
|
55
50
|
isArrayRecursiveMember,
|
|
56
|
-
throwIfUnsupportedEventEmitterPayload,
|
|
57
51
|
throwIfUnsupportedPromiseArrayBuffer
|
|
58
52
|
};
|
|
@@ -118,29 +118,10 @@ function throwIfUnsupportedPromiseArrayBuffer(
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
// ArrayBuffer is not emittable on any platform: Android emitters always carry a
|
|
122
|
-
// folly::dynamic payload, which cannot hold raw bytes, and neither the ObjC nor
|
|
123
|
-
// the C++ emitter contract can hand out a buffer that outlives the emit call.
|
|
124
|
-
// The parser rejects this too; the guard here also covers schemas built without
|
|
125
|
-
// going through the parser.
|
|
126
|
-
function throwIfUnsupportedEventEmitterPayload(
|
|
127
|
-
eventEmitterName: string,
|
|
128
|
-
typeAnnotation: NativeModuleTypeAnnotation,
|
|
129
|
-
): void {
|
|
130
|
-
if (typeAnnotation.type === 'ArrayBufferTypeAnnotation') {
|
|
131
|
-
throw new Error(
|
|
132
|
-
`Unsupported eventType for ${eventEmitterName}. Found: ${typeAnnotation.type}. ` +
|
|
133
|
-
'ArrayBuffer is not supported as an EventEmitter payload on any platform. ' +
|
|
134
|
-
'Pass the ArrayBuffer through a method instead.',
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
121
|
module.exports = {
|
|
140
122
|
createAliasResolver,
|
|
141
123
|
getModules,
|
|
142
124
|
isDirectRecursiveMember,
|
|
143
125
|
isArrayRecursiveMember,
|
|
144
|
-
throwIfUnsupportedEventEmitterPayload,
|
|
145
126
|
throwIfUnsupportedPromiseArrayBuffer,
|
|
146
127
|
};
|
|
@@ -12,7 +12,6 @@ const {
|
|
|
12
12
|
UnsupportedArrayElementTypeAnnotationParserError,
|
|
13
13
|
UnsupportedFunctionParamTypeAnnotationParserError,
|
|
14
14
|
UnsupportedFunctionReturnTypeAnnotationParserError,
|
|
15
|
-
UnsupportedModuleEventEmitterPayloadTypeParserError,
|
|
16
15
|
UnsupportedModuleEventEmitterPropertyParserError,
|
|
17
16
|
UnsupportedModuleEventEmitterTypePropertyParserError,
|
|
18
17
|
UnsupportedModulePropertyParserError,
|
|
@@ -73,11 +72,6 @@ function throwIfEventEmitterEventTypeIsUnsupported(nativeModuleName, propertyNam
|
|
|
73
72
|
throw new UnsupportedModuleEventEmitterTypePropertyParserError(nativeModuleName, propertyName, propertyValueType, parser.language(), nullable);
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
function throwIfEventEmitterPayloadTypeIsUnsupported(nativeModuleName, propertyValue, propertyName, payloadTypeAnnotation) {
|
|
77
|
-
if (payloadTypeAnnotation.type === 'ArrayBufferTypeAnnotation') {
|
|
78
|
-
throw new UnsupportedModuleEventEmitterPayloadTypeParserError(nativeModuleName, propertyValue, propertyName, 'ArrayBuffer');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
75
|
function throwIfModuleTypeIsUnsupported(nativeModuleName, propertyValue, propertyName, propertyValueType, parser) {
|
|
82
76
|
if (!parser.functionTypeAnnotation(propertyValueType)) {
|
|
83
77
|
throw new UnsupportedModulePropertyParserError(nativeModuleName, propertyValue, propertyName, propertyValueType, parser.language());
|
|
@@ -185,7 +179,6 @@ module.exports = {
|
|
|
185
179
|
throwIfUntypedModule,
|
|
186
180
|
throwIfEventEmitterTypeIsUnsupported,
|
|
187
181
|
throwIfEventEmitterEventTypeIsUnsupported,
|
|
188
|
-
throwIfEventEmitterPayloadTypeIsUnsupported,
|
|
189
182
|
throwIfModuleTypeIsUnsupported,
|
|
190
183
|
throwIfMoreThanOneModuleInterfaceParserError,
|
|
191
184
|
throwIfUnsupportedFunctionParamTypeAnnotationParserError,
|
|
@@ -27,7 +27,6 @@ const {
|
|
|
27
27
|
UnsupportedArrayElementTypeAnnotationParserError,
|
|
28
28
|
UnsupportedFunctionParamTypeAnnotationParserError,
|
|
29
29
|
UnsupportedFunctionReturnTypeAnnotationParserError,
|
|
30
|
-
UnsupportedModuleEventEmitterPayloadTypeParserError,
|
|
31
30
|
UnsupportedModuleEventEmitterPropertyParserError,
|
|
32
31
|
UnsupportedModuleEventEmitterTypePropertyParserError,
|
|
33
32
|
UnsupportedModulePropertyParserError,
|
|
@@ -197,25 +196,6 @@ function throwIfEventEmitterEventTypeIsUnsupported(
|
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
198
|
|
|
200
|
-
// ArrayBuffer is not emittable on any platform: Android emitters always carry a
|
|
201
|
-
// folly::dynamic payload, which cannot hold raw bytes, and neither the ObjC nor
|
|
202
|
-
// the C++ emitter contract can hand out a buffer that outlives the emit call.
|
|
203
|
-
function throwIfEventEmitterPayloadTypeIsUnsupported(
|
|
204
|
-
nativeModuleName: string,
|
|
205
|
-
propertyValue: $FlowFixMe,
|
|
206
|
-
propertyName: string,
|
|
207
|
-
payloadTypeAnnotation: NativeModuleTypeAnnotation,
|
|
208
|
-
) {
|
|
209
|
-
if (payloadTypeAnnotation.type === 'ArrayBufferTypeAnnotation') {
|
|
210
|
-
throw new UnsupportedModuleEventEmitterPayloadTypeParserError(
|
|
211
|
-
nativeModuleName,
|
|
212
|
-
propertyValue,
|
|
213
|
-
propertyName,
|
|
214
|
-
'ArrayBuffer',
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
199
|
function throwIfModuleTypeIsUnsupported(
|
|
220
200
|
nativeModuleName: string,
|
|
221
201
|
propertyValue: $FlowFixMe,
|
|
@@ -438,7 +418,6 @@ module.exports = {
|
|
|
438
418
|
throwIfUntypedModule,
|
|
439
419
|
throwIfEventEmitterTypeIsUnsupported,
|
|
440
420
|
throwIfEventEmitterEventTypeIsUnsupported,
|
|
441
|
-
throwIfEventEmitterPayloadTypeIsUnsupported,
|
|
442
421
|
throwIfModuleTypeIsUnsupported,
|
|
443
422
|
throwIfMoreThanOneModuleInterfaceParserError,
|
|
444
423
|
throwIfUnsupportedFunctionParamTypeAnnotationParserError,
|
package/lib/parsers/errors.js
CHANGED
|
@@ -43,11 +43,6 @@ class UnsupportedModuleEventEmitterPropertyParserError extends ParserError {
|
|
|
43
43
|
super(nativeModuleName, propertyValue, message);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
class UnsupportedModuleEventEmitterPayloadTypeParserError extends ParserError {
|
|
47
|
-
constructor(nativeModuleName, propertyValue, propertyName, payloadType) {
|
|
48
|
-
super(nativeModuleName, propertyValue, `EventEmitter '${propertyName}' cannot have payload type '${payloadType}'.`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
46
|
class UnsupportedModulePropertyParserError extends ParserError {
|
|
52
47
|
constructor(nativeModuleName, propertyValue, propertyName, invalidPropertyValueType, language) {
|
|
53
48
|
super(nativeModuleName, propertyValue, `${language} interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's or non nullable 'EventEmitter's. Property '${propertyName}' refers to a '${invalidPropertyValueType}'.`);
|
|
@@ -179,7 +174,6 @@ module.exports = {
|
|
|
179
174
|
UnsupportedEnumDeclarationParserError,
|
|
180
175
|
UnsupportedModuleEventEmitterTypePropertyParserError,
|
|
181
176
|
UnsupportedModuleEventEmitterPropertyParserError,
|
|
182
|
-
UnsupportedModuleEventEmitterPayloadTypeParserError,
|
|
183
177
|
UnsupportedModulePropertyParserError,
|
|
184
178
|
UnsupportedObjectPropertyTypeAnnotationParserError,
|
|
185
179
|
UnsupportedObjectPropertyWithIndexerTypeAnnotationParserError,
|
|
@@ -111,21 +111,6 @@ class UnsupportedModuleEventEmitterPropertyParserError extends ParserError {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
class UnsupportedModuleEventEmitterPayloadTypeParserError extends ParserError {
|
|
115
|
-
constructor(
|
|
116
|
-
nativeModuleName: string,
|
|
117
|
-
propertyValue: $FlowFixMe,
|
|
118
|
-
propertyName: string,
|
|
119
|
-
payloadType: string,
|
|
120
|
-
) {
|
|
121
|
-
super(
|
|
122
|
-
nativeModuleName,
|
|
123
|
-
propertyValue,
|
|
124
|
-
`EventEmitter '${propertyName}' cannot have payload type '${payloadType}'.`,
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
114
|
class UnsupportedModulePropertyParserError extends ParserError {
|
|
130
115
|
constructor(
|
|
131
116
|
nativeModuleName: string,
|
|
@@ -471,7 +456,6 @@ module.exports = {
|
|
|
471
456
|
UnsupportedEnumDeclarationParserError,
|
|
472
457
|
UnsupportedModuleEventEmitterTypePropertyParserError,
|
|
473
458
|
UnsupportedModuleEventEmitterPropertyParserError,
|
|
474
|
-
UnsupportedModuleEventEmitterPayloadTypeParserError,
|
|
475
459
|
UnsupportedModulePropertyParserError,
|
|
476
460
|
UnsupportedObjectPropertyTypeAnnotationParserError,
|
|
477
461
|
UnsupportedObjectPropertyWithIndexerTypeAnnotationParserError,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const {
|
|
4
4
|
throwIfConfigNotfound,
|
|
5
5
|
throwIfEventEmitterEventTypeIsUnsupported,
|
|
6
|
-
throwIfEventEmitterPayloadTypeIsUnsupported,
|
|
7
6
|
throwIfEventEmitterTypeIsUnsupported,
|
|
8
7
|
throwIfIncorrectModuleRegistryCallArgument,
|
|
9
8
|
throwIfIncorrectModuleRegistryCallTypeParameterParserError,
|
|
@@ -204,7 +203,6 @@ function buildEventEmitterSchema(hasteModuleName, property, types, aliasMap, enu
|
|
|
204
203
|
const eventTypeResolutionStatus = resolveTypeAnnotationFN(typeAnnotation.typeParameters.params[0], types, parser);
|
|
205
204
|
throwIfEventEmitterEventTypeIsUnsupported(hasteModuleName, key.name, eventTypeResolutionStatus.typeAnnotation, parser, eventTypeResolutionStatus.nullable);
|
|
206
205
|
const eventTypeAnnotation = translateTypeAnnotation(hasteModuleName, typeAnnotation.typeParameters.params[0], types, aliasMap, enumMap, tryParse, cxxOnly, parser);
|
|
207
|
-
throwIfEventEmitterPayloadTypeIsUnsupported(hasteModuleName, typeAnnotation.typeParameters.params[0], key.name, eventTypeAnnotation);
|
|
208
206
|
return {
|
|
209
207
|
name: eventemitterName,
|
|
210
208
|
optional: Boolean(property.optional),
|
|
@@ -42,7 +42,6 @@ import type {
|
|
|
42
42
|
const {
|
|
43
43
|
throwIfConfigNotfound,
|
|
44
44
|
throwIfEventEmitterEventTypeIsUnsupported,
|
|
45
|
-
throwIfEventEmitterPayloadTypeIsUnsupported,
|
|
46
45
|
throwIfEventEmitterTypeIsUnsupported,
|
|
47
46
|
throwIfIncorrectModuleRegistryCallArgument,
|
|
48
47
|
throwIfIncorrectModuleRegistryCallTypeParameterParserError,
|
|
@@ -552,13 +551,6 @@ function buildEventEmitterSchema(
|
|
|
552
551
|
parser,
|
|
553
552
|
);
|
|
554
553
|
|
|
555
|
-
throwIfEventEmitterPayloadTypeIsUnsupported(
|
|
556
|
-
hasteModuleName,
|
|
557
|
-
typeAnnotation.typeParameters.params[0],
|
|
558
|
-
key.name,
|
|
559
|
-
eventTypeAnnotation,
|
|
560
|
-
);
|
|
561
|
-
|
|
562
554
|
return {
|
|
563
555
|
name: eventemitterName,
|
|
564
556
|
optional: Boolean(property.optional),
|