@react-native/codegen 0.76.0-nightly-20240627-TEMP → 0.76.0-nightly-20240629-TEMP
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/GenerateModuleObjCpp/index.js +5 -0
- package/lib/generators/modules/GenerateModuleObjCpp/index.js.flow +5 -0
- package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +8 -1
- package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js.flow +9 -1
- package/lib/parsers/error-utils.js +1 -3
- package/lib/parsers/error-utils.js.flow +1 -3
- package/lib/parsers/errors.js +0 -3
- package/lib/parsers/errors.js.flow +0 -3
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js +1 -1
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js.flow +1 -1
- package/lib/parsers/parsers-commons.js +0 -1
- package/lib/parsers/parsers-commons.js.flow +0 -1
- package/lib/parsers/typescript/modules/__test_fixtures__/fixtures.js +1 -1
- package/lib/parsers/typescript/modules/__test_fixtures__/fixtures.js.flow +1 -1
- package/package.json +1 -1
|
@@ -31,6 +31,10 @@ const ModuleDeclarationTemplate = ({
|
|
|
31
31
|
${protocolMethods}
|
|
32
32
|
|
|
33
33
|
@end
|
|
34
|
+
|
|
35
|
+
@interface ${hasteModuleName}SpecBase : NSObject
|
|
36
|
+
@end
|
|
37
|
+
|
|
34
38
|
namespace facebook::react {
|
|
35
39
|
/**
|
|
36
40
|
* ObjC++ class for module '${hasteModuleName}'
|
|
@@ -170,6 +174,7 @@ module.exports = {
|
|
|
170
174
|
serializeModuleSource(
|
|
171
175
|
hasteModuleName,
|
|
172
176
|
generatedStructs,
|
|
177
|
+
hasteModuleName,
|
|
173
178
|
methodSerializations.filter(
|
|
174
179
|
({selector}) => selector !== '@selector(constantsToExport)',
|
|
175
180
|
),
|
|
@@ -35,6 +35,10 @@ const ModuleDeclarationTemplate = ({
|
|
|
35
35
|
${protocolMethods}
|
|
36
36
|
|
|
37
37
|
@end
|
|
38
|
+
|
|
39
|
+
@interface ${hasteModuleName}SpecBase : NSObject
|
|
40
|
+
@end
|
|
41
|
+
|
|
38
42
|
namespace facebook::react {
|
|
39
43
|
/**
|
|
40
44
|
* ObjC++ class for module '${hasteModuleName}'
|
|
@@ -199,6 +203,7 @@ module.exports = {
|
|
|
199
203
|
serializeModuleSource(
|
|
200
204
|
hasteModuleName,
|
|
201
205
|
generatedStructs,
|
|
206
|
+
hasteModuleName,
|
|
202
207
|
methodSerializations.filter(
|
|
203
208
|
({selector}) => selector !== '@selector(constantsToExport)',
|
|
204
209
|
),
|
|
@@ -13,8 +13,13 @@
|
|
|
13
13
|
const ModuleTemplate = ({
|
|
14
14
|
hasteModuleName,
|
|
15
15
|
structs,
|
|
16
|
+
moduleName,
|
|
16
17
|
methodSerializationOutputs,
|
|
17
|
-
}) =>
|
|
18
|
+
}) => `
|
|
19
|
+
@implementation ${hasteModuleName}SpecBase
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
${structs
|
|
18
23
|
.map(struct =>
|
|
19
24
|
RCTCxxConvertCategoryTemplate({
|
|
20
25
|
hasteModuleName,
|
|
@@ -81,11 +86,13 @@ const MethodMapEntryTemplate = ({
|
|
|
81
86
|
function serializeModuleSource(
|
|
82
87
|
hasteModuleName,
|
|
83
88
|
structs,
|
|
89
|
+
moduleName,
|
|
84
90
|
methodSerializationOutputs,
|
|
85
91
|
) {
|
|
86
92
|
return ModuleTemplate({
|
|
87
93
|
hasteModuleName,
|
|
88
94
|
structs: structs.filter(({context}) => context !== 'CONSTANTS'),
|
|
95
|
+
moduleName,
|
|
89
96
|
methodSerializationOutputs,
|
|
90
97
|
});
|
|
91
98
|
}
|
|
@@ -19,12 +19,18 @@ import type {Struct} from '../StructCollector';
|
|
|
19
19
|
const ModuleTemplate = ({
|
|
20
20
|
hasteModuleName,
|
|
21
21
|
structs,
|
|
22
|
+
moduleName,
|
|
22
23
|
methodSerializationOutputs,
|
|
23
24
|
}: $ReadOnly<{
|
|
24
25
|
hasteModuleName: string,
|
|
25
26
|
structs: $ReadOnlyArray<Struct>,
|
|
27
|
+
moduleName: string,
|
|
26
28
|
methodSerializationOutputs: $ReadOnlyArray<MethodSerializationOutput>,
|
|
27
|
-
}>) =>
|
|
29
|
+
}>) => `
|
|
30
|
+
@implementation ${hasteModuleName}SpecBase
|
|
31
|
+
@end
|
|
32
|
+
|
|
33
|
+
${structs
|
|
28
34
|
.map(struct =>
|
|
29
35
|
RCTCxxConvertCategoryTemplate({hasteModuleName, structName: struct.name}),
|
|
30
36
|
)
|
|
@@ -105,11 +111,13 @@ const MethodMapEntryTemplate = ({
|
|
|
105
111
|
function serializeModuleSource(
|
|
106
112
|
hasteModuleName: string,
|
|
107
113
|
structs: $ReadOnlyArray<Struct>,
|
|
114
|
+
moduleName: string,
|
|
108
115
|
methodSerializationOutputs: $ReadOnlyArray<MethodSerializationOutput>,
|
|
109
116
|
): string {
|
|
110
117
|
return ModuleTemplate({
|
|
111
118
|
hasteModuleName,
|
|
112
119
|
structs: structs.filter(({context}) => context !== 'CONSTANTS'),
|
|
120
|
+
moduleName,
|
|
113
121
|
methodSerializationOutputs,
|
|
114
122
|
});
|
|
115
123
|
}
|
|
@@ -163,9 +163,8 @@ function throwIfEventEmitterTypeIsUnsupported(
|
|
|
163
163
|
parser,
|
|
164
164
|
nullable,
|
|
165
165
|
untyped,
|
|
166
|
-
cxxOnly,
|
|
167
166
|
) {
|
|
168
|
-
if (nullable || untyped
|
|
167
|
+
if (nullable || untyped) {
|
|
169
168
|
throw new UnsupportedModuleEventEmitterPropertyParserError(
|
|
170
169
|
nativeModuleName,
|
|
171
170
|
propertyName,
|
|
@@ -173,7 +172,6 @@ function throwIfEventEmitterTypeIsUnsupported(
|
|
|
173
172
|
parser.language(),
|
|
174
173
|
nullable,
|
|
175
174
|
untyped,
|
|
176
|
-
cxxOnly,
|
|
177
175
|
);
|
|
178
176
|
}
|
|
179
177
|
}
|
|
@@ -164,9 +164,8 @@ function throwIfEventEmitterTypeIsUnsupported(
|
|
|
164
164
|
parser: Parser,
|
|
165
165
|
nullable: boolean,
|
|
166
166
|
untyped: boolean,
|
|
167
|
-
cxxOnly: boolean,
|
|
168
167
|
) {
|
|
169
|
-
if (nullable || untyped
|
|
168
|
+
if (nullable || untyped) {
|
|
170
169
|
throw new UnsupportedModuleEventEmitterPropertyParserError(
|
|
171
170
|
nativeModuleName,
|
|
172
171
|
propertyName,
|
|
@@ -174,7 +173,6 @@ function throwIfEventEmitterTypeIsUnsupported(
|
|
|
174
173
|
parser.language(),
|
|
175
174
|
nullable,
|
|
176
175
|
untyped,
|
|
177
|
-
cxxOnly,
|
|
178
176
|
);
|
|
179
177
|
}
|
|
180
178
|
}
|
package/lib/parsers/errors.js
CHANGED
|
@@ -79,15 +79,12 @@ class UnsupportedModuleEventEmitterPropertyParserError extends ParserError {
|
|
|
79
79
|
language,
|
|
80
80
|
nullable,
|
|
81
81
|
untyped,
|
|
82
|
-
cxxOnly,
|
|
83
82
|
) {
|
|
84
83
|
let message = `${language} interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's or non nullable 'EventEmitter's. Further the EventEmitter property `;
|
|
85
84
|
if (nullable) {
|
|
86
85
|
message += `'${propertyValue}' must non nullable.`;
|
|
87
86
|
} else if (untyped) {
|
|
88
87
|
message += `'${propertyValue}' must have a concrete or void eventType.`;
|
|
89
|
-
} else if (!cxxOnly) {
|
|
90
|
-
message += `'${propertyValue}' is only supported in C++ Turbo Modules.`;
|
|
91
88
|
}
|
|
92
89
|
super(nativeModuleName, propertyValue, message);
|
|
93
90
|
}
|
|
@@ -100,15 +100,12 @@ class UnsupportedModuleEventEmitterPropertyParserError extends ParserError {
|
|
|
100
100
|
language: ParserType,
|
|
101
101
|
nullable: boolean,
|
|
102
102
|
untyped: boolean,
|
|
103
|
-
cxxOnly: boolean,
|
|
104
103
|
) {
|
|
105
104
|
let message = `${language} interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's or non nullable 'EventEmitter's. Further the EventEmitter property `;
|
|
106
105
|
if (nullable) {
|
|
107
106
|
message += `'${propertyValue}' must non nullable.`;
|
|
108
107
|
} else if (untyped) {
|
|
109
108
|
message += `'${propertyValue}' must have a concrete or void eventType.`;
|
|
110
|
-
} else if (!cxxOnly) {
|
|
111
|
-
message += `'${propertyValue}' is only supported in C++ Turbo Modules.`;
|
|
112
109
|
}
|
|
113
110
|
super(nativeModuleName, propertyValue, message);
|
|
114
111
|
}
|
|
@@ -631,7 +631,7 @@ export interface Spec extends TurboModule {
|
|
|
631
631
|
+onEvent6: EventEmitter<ObjectStruct[]>;
|
|
632
632
|
}
|
|
633
633
|
|
|
634
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('
|
|
634
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
635
635
|
|
|
636
636
|
`;
|
|
637
637
|
const ANDROID_ONLY_NATIVE_MODULE = `
|
|
@@ -652,7 +652,7 @@ export interface Spec extends TurboModule {
|
|
|
652
652
|
+onEvent6: EventEmitter<ObjectStruct[]>;
|
|
653
653
|
}
|
|
654
654
|
|
|
655
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('
|
|
655
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
656
656
|
|
|
657
657
|
`;
|
|
658
658
|
|
|
@@ -724,7 +724,7 @@ export interface Spec extends TurboModule {
|
|
|
724
724
|
readonly onEvent6: EventEmitter<ObjectStruct[]>;
|
|
725
725
|
}
|
|
726
726
|
|
|
727
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('
|
|
727
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
728
728
|
|
|
729
729
|
`;
|
|
730
730
|
const ANDROID_ONLY_NATIVE_MODULE = `
|
|
@@ -751,7 +751,7 @@ export interface Spec extends TurboModule {
|
|
|
751
751
|
readonly onEvent6: EventEmitter<ObjectStruct[]>;
|
|
752
752
|
}
|
|
753
753
|
|
|
754
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('
|
|
754
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
755
755
|
|
|
756
756
|
`;
|
|
757
757
|
|