@react-native/codegen 0.74.0-nightly-20231204-e9b80971c → 0.74.0-nightly-20231206-eb661df2a

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.
Files changed (35) hide show
  1. package/lib/generators/components/GenerateComponentDescriptorH.js +2 -4
  2. package/lib/generators/components/GenerateComponentDescriptorH.js.flow +2 -4
  3. package/lib/generators/components/GenerateEventEmitterCpp.js +2 -4
  4. package/lib/generators/components/GenerateEventEmitterCpp.js.flow +2 -4
  5. package/lib/generators/components/GenerateEventEmitterH.js +2 -4
  6. package/lib/generators/components/GenerateEventEmitterH.js.flow +2 -4
  7. package/lib/generators/components/GeneratePropsCpp.js +2 -4
  8. package/lib/generators/components/GeneratePropsCpp.js.flow +2 -4
  9. package/lib/generators/components/GeneratePropsH.js +2 -4
  10. package/lib/generators/components/GeneratePropsH.js.flow +2 -4
  11. package/lib/generators/components/GenerateShadowNodeCpp.js +2 -4
  12. package/lib/generators/components/GenerateShadowNodeCpp.js.flow +2 -4
  13. package/lib/generators/components/GenerateShadowNodeH.js +2 -4
  14. package/lib/generators/components/GenerateShadowNodeH.js.flow +2 -4
  15. package/lib/generators/components/GenerateStateCpp.js +2 -4
  16. package/lib/generators/components/GenerateStateCpp.js.flow +2 -4
  17. package/lib/generators/components/GenerateStateH.js +2 -4
  18. package/lib/generators/components/GenerateStateH.js.flow +2 -4
  19. package/lib/generators/modules/GenerateModuleCpp.js +2 -4
  20. package/lib/generators/modules/GenerateModuleCpp.js.flow +2 -4
  21. package/lib/generators/modules/GenerateModuleH.js +2 -4
  22. package/lib/generators/modules/GenerateModuleH.js.flow +2 -4
  23. package/lib/generators/modules/GenerateModuleJniCpp.js +2 -4
  24. package/lib/generators/modules/GenerateModuleJniCpp.js.flow +2 -4
  25. package/lib/generators/modules/GenerateModuleJniH.js +2 -4
  26. package/lib/generators/modules/GenerateModuleJniH.js.flow +2 -4
  27. package/lib/generators/modules/GenerateModuleObjCpp/index.js +9 -11
  28. package/lib/generators/modules/GenerateModuleObjCpp/index.js.flow +9 -11
  29. package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +25 -27
  30. package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js.flow +25 -27
  31. package/lib/generators/modules/__test_fixtures__/fixtures.js +685 -64
  32. package/lib/generators/modules/__test_fixtures__/fixtures.js.flow +686 -64
  33. package/lib/parsers/parsers-commons.js +1 -1
  34. package/lib/parsers/parsers-commons.js.flow +1 -1
  35. package/package.json +1 -1
@@ -27,13 +27,11 @@ const FileTemplate = ({componentDescriptors, libraryName}) => `
27
27
  #include <react/renderer/components/${libraryName}/ShadowNodes.h>
28
28
  #include <react/renderer/core/ConcreteComponentDescriptor.h>
29
29
 
30
- namespace facebook {
31
- namespace react {
30
+ namespace facebook::react {
32
31
 
33
32
  ${componentDescriptors}
34
33
 
35
- } // namespace react
36
- } // namespace facebook
34
+ } // namespace facebook::react
37
35
  `;
38
36
  const ComponentTemplate = ({className}) =>
39
37
  `
@@ -36,13 +36,11 @@ const FileTemplate = ({
36
36
  #include <react/renderer/components/${libraryName}/ShadowNodes.h>
37
37
  #include <react/renderer/core/ConcreteComponentDescriptor.h>
38
38
 
39
- namespace facebook {
40
- namespace react {
39
+ namespace facebook::react {
41
40
 
42
41
  ${componentDescriptors}
43
42
 
44
- } // namespace react
45
- } // namespace facebook
43
+ } // namespace facebook::react
46
44
  `;
47
45
 
48
46
  const ComponentTemplate = ({className}: {className: string}) =>
@@ -30,11 +30,9 @@ const FileTemplate = ({events, libraryName, extraIncludes}) => `
30
30
  #include <react/renderer/components/${libraryName}/EventEmitters.h>
31
31
  ${[...extraIncludes].join('\n')}
32
32
 
33
- namespace facebook {
34
- namespace react {
33
+ namespace facebook::react {
35
34
  ${events}
36
- } // namespace react
37
- } // namespace facebook
35
+ } // namespace facebook::react
38
36
  `;
39
37
  const ComponentTemplate = ({
40
38
  className,
@@ -50,11 +50,9 @@ const FileTemplate = ({
50
50
  #include <react/renderer/components/${libraryName}/EventEmitters.h>
51
51
  ${[...extraIncludes].join('\n')}
52
52
 
53
- namespace facebook {
54
- namespace react {
53
+ namespace facebook::react {
55
54
  ${events}
56
- } // namespace react
57
- } // namespace facebook
55
+ } // namespace facebook::react
58
56
  `;
59
57
 
60
58
  const ComponentTemplate = ({
@@ -36,11 +36,9 @@ const FileTemplate = ({componentEmitters, extraIncludes}) => `
36
36
  #include <react/renderer/components/view/ViewEventEmitter.h>
37
37
  ${[...extraIncludes].join('\n')}
38
38
 
39
- namespace facebook {
40
- namespace react {
39
+ namespace facebook::react {
41
40
  ${componentEmitters}
42
- } // namespace react
43
- } // namespace facebook
41
+ } // namespace facebook::react
44
42
  `;
45
43
  const ComponentTemplate = ({className, structs, events}) =>
46
44
  `
@@ -56,11 +56,9 @@ const FileTemplate = ({
56
56
  #include <react/renderer/components/view/ViewEventEmitter.h>
57
57
  ${[...extraIncludes].join('\n')}
58
58
 
59
- namespace facebook {
60
- namespace react {
59
+ namespace facebook::react {
61
60
  ${componentEmitters}
62
- } // namespace react
63
- } // namespace facebook
61
+ } // namespace facebook::react
64
62
  `;
65
63
 
66
64
  const ComponentTemplate = ({
@@ -29,13 +29,11 @@ const FileTemplate = ({libraryName, imports, componentClasses}) => `
29
29
  #include <react/renderer/components/${libraryName}/Props.h>
30
30
  ${imports}
31
31
 
32
- namespace facebook {
33
- namespace react {
32
+ namespace facebook::react {
34
33
 
35
34
  ${componentClasses}
36
35
 
37
- } // namespace react
38
- } // namespace facebook
36
+ } // namespace facebook::react
39
37
  `;
40
38
  const ComponentTemplate = ({className, extendClasses, props}) =>
41
39
  `
@@ -38,13 +38,11 @@ const FileTemplate = ({
38
38
  #include <react/renderer/components/${libraryName}/Props.h>
39
39
  ${imports}
40
40
 
41
- namespace facebook {
42
- namespace react {
41
+ namespace facebook::react {
43
42
 
44
43
  ${componentClasses}
45
44
 
46
- } // namespace react
47
- } // namespace facebook
45
+ } // namespace facebook::react
48
46
  `;
49
47
 
50
48
  const ComponentTemplate = ({
@@ -37,13 +37,11 @@ const FileTemplate = ({imports, componentClasses}) => `
37
37
 
38
38
  ${imports}
39
39
 
40
- namespace facebook {
41
- namespace react {
40
+ namespace facebook::react {
42
41
 
43
42
  ${componentClasses}
44
43
 
45
- } // namespace react
46
- } // namespace facebook
44
+ } // namespace facebook::react
47
45
  `;
48
46
  const ClassTemplate = ({enums, structs, className, props, extendClasses}) =>
49
47
  `
@@ -52,13 +52,11 @@ const FileTemplate = ({
52
52
 
53
53
  ${imports}
54
54
 
55
- namespace facebook {
56
- namespace react {
55
+ namespace facebook::react {
57
56
 
58
57
  ${componentClasses}
59
58
 
60
- } // namespace react
61
- } // namespace facebook
59
+ } // namespace facebook::react
62
60
  `;
63
61
 
64
62
  const ClassTemplate = ({
@@ -24,13 +24,11 @@ const FileTemplate = ({libraryName, componentNames}) => `
24
24
 
25
25
  #include <react/renderer/components/${libraryName}/ShadowNodes.h>
26
26
 
27
- namespace facebook {
28
- namespace react {
27
+ namespace facebook::react {
29
28
 
30
29
  ${componentNames}
31
30
 
32
- } // namespace react
33
- } // namespace facebook
31
+ } // namespace facebook::react
34
32
  `;
35
33
  const ComponentTemplate = ({className}) =>
36
34
  `
@@ -33,13 +33,11 @@ const FileTemplate = ({
33
33
 
34
34
  #include <react/renderer/components/${libraryName}/ShadowNodes.h>
35
35
 
36
- namespace facebook {
37
- namespace react {
36
+ namespace facebook::react {
38
37
 
39
38
  ${componentNames}
40
39
 
41
- } // namespace react
42
- } // namespace facebook
40
+ } // namespace facebook::react
43
41
  `;
44
42
 
45
43
  const ComponentTemplate = ({className}: {className: string}) =>
@@ -29,13 +29,11 @@ ${imports}#include <react/renderer/components/${libraryName}/Props.h>
29
29
  #include <react/renderer/components/view/ConcreteViewShadowNode.h>
30
30
  #include <jsi/jsi.h>
31
31
 
32
- namespace facebook {
33
- namespace react {
32
+ namespace facebook::react {
34
33
 
35
34
  ${componentClasses}
36
35
 
37
- } // namespace react
38
- } // namespace facebook
36
+ } // namespace facebook::react
39
37
  `;
40
38
  const ComponentTemplate = ({className, eventEmitter}) =>
41
39
  `
@@ -40,13 +40,11 @@ ${imports}#include <react/renderer/components/${libraryName}/Props.h>
40
40
  #include <react/renderer/components/view/ConcreteViewShadowNode.h>
41
41
  #include <jsi/jsi.h>
42
42
 
43
- namespace facebook {
44
- namespace react {
43
+ namespace facebook::react {
45
44
 
46
45
  ${componentClasses}
47
46
 
48
- } // namespace react
49
- } // namespace facebook
47
+ } // namespace facebook::react
50
48
  `;
51
49
 
52
50
  const ComponentTemplate = ({
@@ -23,13 +23,11 @@ const FileTemplate = ({libraryName, stateClasses}) => `
23
23
  */
24
24
  #include <react/renderer/components/${libraryName}/States.h>
25
25
 
26
- namespace facebook {
27
- namespace react {
26
+ namespace facebook::react {
28
27
 
29
28
  ${stateClasses}
30
29
 
31
- } // namespace react
32
- } // namespace facebook
30
+ } // namespace facebook::react
33
31
  `;
34
32
  const StateTemplate = ({stateName}) => '';
35
33
  module.exports = {
@@ -32,13 +32,11 @@ const FileTemplate = ({
32
32
  */
33
33
  #include <react/renderer/components/${libraryName}/States.h>
34
34
 
35
- namespace facebook {
36
- namespace react {
35
+ namespace facebook::react {
37
36
 
38
37
  ${stateClasses}
39
38
 
40
- } // namespace react
41
- } // namespace facebook
39
+ } // namespace facebook::react
42
40
  `;
43
41
 
44
42
  const StateTemplate = ({stateName}: {stateName: string}) => '';
@@ -30,13 +30,11 @@ const FileTemplate = ({libraryName, stateClasses}) =>
30
30
  #include <react/renderer/mapbuffer/MapBufferBuilder.h>
31
31
  #endif
32
32
 
33
- namespace facebook {
34
- namespace react {
33
+ namespace facebook::react {
35
34
 
36
35
  ${stateClasses}
37
36
 
38
- } // namespace react
39
- } // namespace facebook
37
+ } // namespace facebook::react
40
38
  `.trim();
41
39
  const StateTemplate = ({stateName}) =>
42
40
  `
@@ -39,13 +39,11 @@ const FileTemplate = ({
39
39
  #include <react/renderer/mapbuffer/MapBufferBuilder.h>
40
40
  #endif
41
41
 
42
- namespace facebook {
43
- namespace react {
42
+ namespace facebook::react {
44
43
 
45
44
  ${stateClasses}
46
45
 
47
- } // namespace react
48
- } // namespace facebook
46
+ } // namespace facebook::react
49
47
  `.trim();
50
48
 
51
49
  const StateTemplate = ({stateName}: {stateName: string}) =>
@@ -138,14 +138,12 @@ const FileTemplate = ({libraryName, modules}) => {
138
138
 
139
139
  #include "${libraryName}JSI.h"
140
140
 
141
- namespace facebook {
142
- namespace react {
141
+ namespace facebook::react {
143
142
 
144
143
  ${modules}
145
144
 
146
145
 
147
- } // namespace react
148
- } // namespace facebook
146
+ } // namespace facebook::react
149
147
  `;
150
148
  };
151
149
  function serializeArg(moduleName, arg, index, resolveAlias, enumMap) {
@@ -101,14 +101,12 @@ const FileTemplate = ({
101
101
 
102
102
  #include "${libraryName}JSI.h"
103
103
 
104
- namespace facebook {
105
- namespace react {
104
+ namespace facebook::react {
106
105
 
107
106
  ${modules}
108
107
 
109
108
 
110
- } // namespace react
111
- } // namespace facebook
109
+ } // namespace facebook::react
112
110
  `;
113
111
  };
114
112
 
@@ -156,13 +156,11 @@ const FileTemplate = ({modules}) => {
156
156
  #include <ReactCommon/TurboModule.h>
157
157
  #include <react/bridging/Bridging.h>
158
158
 
159
- namespace facebook {
160
- namespace react {
159
+ namespace facebook::react {
161
160
 
162
161
  ${modules.join('\n\n')}
163
162
 
164
- } // namespace react
165
- } // namespace facebook
163
+ } // namespace facebook::react
166
164
  `;
167
165
  };
168
166
  function translatePrimitiveJSTypeToCpp(
@@ -119,13 +119,11 @@ const FileTemplate = ({
119
119
  #include <ReactCommon/TurboModule.h>
120
120
  #include <react/bridging/Bridging.h>
121
121
 
122
- namespace facebook {
123
- namespace react {
122
+ namespace facebook::react {
124
123
 
125
124
  ${modules.join('\n\n')}
126
125
 
127
- } // namespace react
128
- } // namespace facebook
126
+ } // namespace facebook::react
129
127
  `;
130
128
  };
131
129
 
@@ -123,8 +123,7 @@ const FileTemplate = ({libraryName, include, modules, moduleLookups}) => {
123
123
 
124
124
  #include ${include}
125
125
 
126
- namespace facebook {
127
- namespace react {
126
+ namespace facebook::react {
128
127
 
129
128
  ${modules}
130
129
 
@@ -133,8 +132,7 @@ ${moduleLookups.map(ModuleLookupTemplate).join('\n')}
133
132
  return nullptr;
134
133
  }
135
134
 
136
- } // namespace react
137
- } // namespace facebook
135
+ } // namespace facebook::react
138
136
  `;
139
137
  };
140
138
  function translateReturnTypeToKind(nullableTypeAnnotation, resolveAlias) {
@@ -108,8 +108,7 @@ const FileTemplate = ({
108
108
 
109
109
  #include ${include}
110
110
 
111
- namespace facebook {
112
- namespace react {
111
+ namespace facebook::react {
113
112
 
114
113
  ${modules}
115
114
 
@@ -118,8 +117,7 @@ ${moduleLookups.map(ModuleLookupTemplate).join('\n')}
118
117
  return nullptr;
119
118
  }
120
119
 
121
- } // namespace react
122
- } // namespace facebook
120
+ } // namespace facebook::react
123
121
  `;
124
122
  };
125
123
 
@@ -39,16 +39,14 @@ const HeaderFileTemplate = ({modules, libraryName}) => {
39
39
  #include <ReactCommon/TurboModule.h>
40
40
  #include <jsi/jsi.h>
41
41
 
42
- namespace facebook {
43
- namespace react {
42
+ namespace facebook::react {
44
43
 
45
44
  ${modules}
46
45
 
47
46
  JSI_EXPORT
48
47
  std::shared_ptr<TurboModule> ${libraryName}_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
49
48
 
50
- } // namespace react
51
- } // namespace facebook
49
+ } // namespace facebook::react
52
50
  `;
53
51
  };
54
52
 
@@ -49,16 +49,14 @@ const HeaderFileTemplate = ({
49
49
  #include <ReactCommon/TurboModule.h>
50
50
  #include <jsi/jsi.h>
51
51
 
52
- namespace facebook {
53
- namespace react {
52
+ namespace facebook::react {
54
53
 
55
54
  ${modules}
56
55
 
57
56
  JSI_EXPORT
58
57
  std::shared_ptr<TurboModule> ${libraryName}_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
59
58
 
60
- } // namespace react
61
- } // namespace facebook
59
+ } // namespace facebook::react
62
60
  `;
63
61
  };
64
62
 
@@ -31,17 +31,15 @@ const ModuleDeclarationTemplate = ({
31
31
  ${protocolMethods}
32
32
 
33
33
  @end
34
- namespace facebook {
35
- namespace react {
36
- /**
37
- * ObjC++ class for module '${hasteModuleName}'
38
- */
39
- class JSI_EXPORT ${hasteModuleName}SpecJSI : public ObjCTurboModule {
40
- public:
41
- ${hasteModuleName}SpecJSI(const ObjCTurboModule::InitParams &params);
42
- };
43
- } // namespace react
44
- } // namespace facebook`;
34
+ namespace facebook::react {
35
+ /**
36
+ * ObjC++ class for module '${hasteModuleName}'
37
+ */
38
+ class JSI_EXPORT ${hasteModuleName}SpecJSI : public ObjCTurboModule {
39
+ public:
40
+ ${hasteModuleName}SpecJSI(const ObjCTurboModule::InitParams &params);
41
+ };
42
+ } // namespace facebook::react`;
45
43
  const HeaderFileTemplate = ({
46
44
  moduleDeclarations,
47
45
  structInlineMethods,
@@ -35,17 +35,15 @@ const ModuleDeclarationTemplate = ({
35
35
  ${protocolMethods}
36
36
 
37
37
  @end
38
- namespace facebook {
39
- namespace react {
40
- /**
41
- * ObjC++ class for module '${hasteModuleName}'
42
- */
43
- class JSI_EXPORT ${hasteModuleName}SpecJSI : public ObjCTurboModule {
44
- public:
45
- ${hasteModuleName}SpecJSI(const ObjCTurboModule::InitParams &params);
46
- };
47
- } // namespace react
48
- } // namespace facebook`;
38
+ namespace facebook::react {
39
+ /**
40
+ * ObjC++ class for module '${hasteModuleName}'
41
+ */
42
+ class JSI_EXPORT ${hasteModuleName}SpecJSI : public ObjCTurboModule {
43
+ public:
44
+ ${hasteModuleName}SpecJSI(const ObjCTurboModule::InitParams &params);
45
+ };
46
+ } // namespace facebook::react`;
49
47
 
50
48
  const HeaderFileTemplate = ({
51
49
  moduleDeclarations,
@@ -22,34 +22,32 @@ const ModuleTemplate = ({
22
22
  }),
23
23
  )
24
24
  .join('\n')}
25
- namespace facebook {
26
- namespace react {
27
- ${methodSerializationOutputs
28
- .map(serializedMethodParts =>
29
- InlineHostFunctionTemplate({
30
- hasteModuleName,
31
- methodName: serializedMethodParts.methodName,
32
- returnJSType: serializedMethodParts.returnJSType,
33
- selector: serializedMethodParts.selector,
34
- }),
35
- )
36
- .join('\n')}
25
+ namespace facebook::react {
26
+ ${methodSerializationOutputs
27
+ .map(serializedMethodParts =>
28
+ InlineHostFunctionTemplate({
29
+ hasteModuleName,
30
+ methodName: serializedMethodParts.methodName,
31
+ returnJSType: serializedMethodParts.returnJSType,
32
+ selector: serializedMethodParts.selector,
33
+ }),
34
+ )
35
+ .join('\n')}
37
36
 
38
- ${hasteModuleName}SpecJSI::${hasteModuleName}SpecJSI(const ObjCTurboModule::InitParams &params)
39
- : ObjCTurboModule(params) {
40
- ${methodSerializationOutputs
41
- .map(({methodName, structParamRecords, argCount}) =>
42
- MethodMapEntryTemplate({
43
- hasteModuleName,
44
- methodName,
45
- structParamRecords,
46
- argCount,
47
- }),
48
- )
49
- .join('\n' + ' '.repeat(8))}
50
- }
51
- } // namespace react
52
- } // namespace facebook`;
37
+ ${hasteModuleName}SpecJSI::${hasteModuleName}SpecJSI(const ObjCTurboModule::InitParams &params)
38
+ : ObjCTurboModule(params) {
39
+ ${methodSerializationOutputs
40
+ .map(({methodName, structParamRecords, argCount}) =>
41
+ MethodMapEntryTemplate({
42
+ hasteModuleName,
43
+ methodName,
44
+ structParamRecords,
45
+ argCount,
46
+ }),
47
+ )
48
+ .join('\n' + ' '.repeat(8))}
49
+ }
50
+ } // namespace facebook::react`;
53
51
  const RCTCxxConvertCategoryTemplate = ({
54
52
  hasteModuleName,
55
53
  structName,
@@ -29,34 +29,32 @@ const ModuleTemplate = ({
29
29
  RCTCxxConvertCategoryTemplate({hasteModuleName, structName: struct.name}),
30
30
  )
31
31
  .join('\n')}
32
- namespace facebook {
33
- namespace react {
34
- ${methodSerializationOutputs
35
- .map(serializedMethodParts =>
36
- InlineHostFunctionTemplate({
37
- hasteModuleName,
38
- methodName: serializedMethodParts.methodName,
39
- returnJSType: serializedMethodParts.returnJSType,
40
- selector: serializedMethodParts.selector,
41
- }),
42
- )
43
- .join('\n')}
32
+ namespace facebook::react {
33
+ ${methodSerializationOutputs
34
+ .map(serializedMethodParts =>
35
+ InlineHostFunctionTemplate({
36
+ hasteModuleName,
37
+ methodName: serializedMethodParts.methodName,
38
+ returnJSType: serializedMethodParts.returnJSType,
39
+ selector: serializedMethodParts.selector,
40
+ }),
41
+ )
42
+ .join('\n')}
44
43
 
45
- ${hasteModuleName}SpecJSI::${hasteModuleName}SpecJSI(const ObjCTurboModule::InitParams &params)
46
- : ObjCTurboModule(params) {
47
- ${methodSerializationOutputs
48
- .map(({methodName, structParamRecords, argCount}) =>
49
- MethodMapEntryTemplate({
50
- hasteModuleName,
51
- methodName,
52
- structParamRecords,
53
- argCount,
54
- }),
55
- )
56
- .join('\n' + ' '.repeat(8))}
57
- }
58
- } // namespace react
59
- } // namespace facebook`;
44
+ ${hasteModuleName}SpecJSI::${hasteModuleName}SpecJSI(const ObjCTurboModule::InitParams &params)
45
+ : ObjCTurboModule(params) {
46
+ ${methodSerializationOutputs
47
+ .map(({methodName, structParamRecords, argCount}) =>
48
+ MethodMapEntryTemplate({
49
+ hasteModuleName,
50
+ methodName,
51
+ structParamRecords,
52
+ argCount,
53
+ }),
54
+ )
55
+ .join('\n' + ' '.repeat(8))}
56
+ }
57
+ } // namespace facebook::react`;
60
58
 
61
59
  const RCTCxxConvertCategoryTemplate = ({
62
60
  hasteModuleName,