@react-native/codegen 0.75.0-nightly-20240614-8b53d41a8 → 0.75.0-nightly-20240615-2f8d4f0c2

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.
@@ -247,7 +247,7 @@ export interface NativeModuleSchema {
247
247
 
248
248
  export interface NativeModuleSpec {
249
249
  readonly eventEmitters: readonly NativeModuleEventEmitterShape[];
250
- readonly properties: readonly NativeModulePropertyShape[];
250
+ readonly methods: readonly NativeModulePropertyShape[];
251
251
  }
252
252
 
253
253
  export type NativeModulePropertyShape = NamedShape<
@@ -248,7 +248,7 @@ export type NativeModuleSchema = $ReadOnly<{
248
248
 
249
249
  type NativeModuleSpec = $ReadOnly<{
250
250
  eventEmitters: $ReadOnlyArray<NativeModuleEventEmitterShape>,
251
- properties: $ReadOnlyArray<NativeModulePropertyShape>,
251
+ methods: $ReadOnlyArray<NativeModulePropertyShape>,
252
252
  }>;
253
253
 
254
254
  export type NativeModuleEventEmitterShape =
@@ -43,7 +43,7 @@ const SCHEMA_WITH_TM_AND_FC = {
43
43
  enumMap: {},
44
44
  spec: {
45
45
  eventEmitters: [],
46
- properties: [
46
+ methods: [
47
47
  {
48
48
  name: 'add',
49
49
  optional: false,
@@ -45,7 +45,7 @@ const SCHEMA_WITH_TM_AND_FC: SchemaType = {
45
45
  enumMap: {},
46
46
  spec: {
47
47
  eventEmitters: [],
48
- properties: [
48
+ methods: [
49
49
  {
50
50
  name: 'add',
51
51
  optional: false,
@@ -273,10 +273,10 @@ module.exports = {
273
273
  const nativeModule = nativeModules[hasteModuleName];
274
274
  const aliasMap = nativeModule.aliasMap,
275
275
  enumMap = nativeModule.enumMap,
276
- properties = nativeModule.spec.properties,
276
+ methods = nativeModule.spec.methods,
277
277
  moduleName = nativeModule.moduleName;
278
278
  const resolveAlias = createAliasResolver(aliasMap);
279
- const hostFunctions = properties.map(property =>
279
+ const hostFunctions = methods.map(property =>
280
280
  serializePropertyIntoHostFunction(
281
281
  moduleName,
282
282
  hasteModuleName,
@@ -289,7 +289,7 @@ module.exports = {
289
289
  hasteModuleName,
290
290
  hostFunctions,
291
291
  moduleName,
292
- methods: properties.map(
292
+ methods: methods.map(
293
293
  ({name: propertyName, typeAnnotation: nullableTypeAnnotation}) => {
294
294
  const _unwrapNullable5 = unwrapNullable(nullableTypeAnnotation),
295
295
  _unwrapNullable6 = _slicedToArray(_unwrapNullable5, 1),
@@ -249,11 +249,11 @@ module.exports = {
249
249
  const {
250
250
  aliasMap,
251
251
  enumMap,
252
- spec: {properties},
252
+ spec: {methods},
253
253
  moduleName,
254
254
  } = nativeModule;
255
255
  const resolveAlias = createAliasResolver(aliasMap);
256
- const hostFunctions = properties.map(property =>
256
+ const hostFunctions = methods.map(property =>
257
257
  serializePropertyIntoHostFunction(
258
258
  moduleName,
259
259
  hasteModuleName,
@@ -267,7 +267,7 @@ module.exports = {
267
267
  hasteModuleName,
268
268
  hostFunctions,
269
269
  moduleName,
270
- methods: properties.map(
270
+ methods: methods.map(
271
271
  ({name: propertyName, typeAnnotation: nullableTypeAnnotation}) => {
272
272
  const [{params}] = unwrapNullable(nullableTypeAnnotation);
273
273
  return {
@@ -596,7 +596,7 @@ module.exports = {
596
596
  return [
597
597
  ModuleClassDeclarationTemplate({
598
598
  hasteModuleName,
599
- moduleProperties: spec.properties.map(prop =>
599
+ moduleProperties: spec.methods.map(prop =>
600
600
  translatePropertyToCpp(
601
601
  hasteModuleName,
602
602
  prop,
@@ -619,7 +619,7 @@ module.exports = {
619
619
  enumMap,
620
620
  ),
621
621
  ),
622
- moduleProperties: spec.properties.map(prop =>
622
+ moduleProperties: spec.methods.map(prop =>
623
623
  translatePropertyToCpp(
624
624
  hasteModuleName,
625
625
  prop,
@@ -606,7 +606,7 @@ module.exports = {
606
606
  return [
607
607
  ModuleClassDeclarationTemplate({
608
608
  hasteModuleName,
609
- moduleProperties: spec.properties.map(prop =>
609
+ moduleProperties: spec.methods.map(prop =>
610
610
  translatePropertyToCpp(
611
611
  hasteModuleName,
612
612
  prop,
@@ -629,7 +629,7 @@ module.exports = {
629
629
  enumMap,
630
630
  ),
631
631
  ),
632
- moduleProperties: spec.properties.map(prop =>
632
+ moduleProperties: spec.methods.map(prop =>
633
633
  translatePropertyToCpp(
634
634
  hasteModuleName,
635
635
  prop,
@@ -472,7 +472,7 @@ module.exports = {
472
472
  aliasMap = _nativeModules$hasteM.aliasMap,
473
473
  excludedPlatforms = _nativeModules$hasteM.excludedPlatforms,
474
474
  moduleName = _nativeModules$hasteM.moduleName,
475
- properties = _nativeModules$hasteM.spec.properties;
475
+ spec = _nativeModules$hasteM.spec;
476
476
  if (excludedPlatforms != null && excludedPlatforms.includes('android')) {
477
477
  return;
478
478
  }
@@ -487,7 +487,7 @@ module.exports = {
487
487
  'com.facebook.proguard.annotations.DoNotStrip',
488
488
  'javax.annotation.Nonnull',
489
489
  ]);
490
- const methods = properties.map(method => {
490
+ const methods = spec.methods.map(method => {
491
491
  if (method.name === 'getConstants') {
492
492
  return buildGetConstantsMethod(method, imports, resolveAlias);
493
493
  }
@@ -445,12 +445,8 @@ module.exports = {
445
445
  const outputDir = `java/${normalizedPackageName.replace(/\./g, '/')}`;
446
446
 
447
447
  Object.keys(nativeModules).forEach(hasteModuleName => {
448
- const {
449
- aliasMap,
450
- excludedPlatforms,
451
- moduleName,
452
- spec: {properties},
453
- } = nativeModules[hasteModuleName];
448
+ const {aliasMap, excludedPlatforms, moduleName, spec} =
449
+ nativeModules[hasteModuleName];
454
450
  if (excludedPlatforms != null && excludedPlatforms.includes('android')) {
455
451
  return;
456
452
  }
@@ -467,7 +463,7 @@ module.exports = {
467
463
  'javax.annotation.Nonnull',
468
464
  ]);
469
465
 
470
- const methods = properties.map(method => {
466
+ const methods = spec.methods.map(method => {
471
467
  if (method.name === 'getConstants') {
472
468
  return buildGetConstantsMethod(method, imports, resolveAlias);
473
469
  }
@@ -433,9 +433,9 @@ module.exports = {
433
433
  .map(hasteModuleName => {
434
434
  const _nativeModules$hasteM = nativeModules[hasteModuleName],
435
435
  aliasMap = _nativeModules$hasteM.aliasMap,
436
- properties = _nativeModules$hasteM.spec.properties;
436
+ methods = _nativeModules$hasteM.spec.methods;
437
437
  const resolveAlias = createAliasResolver(aliasMap);
438
- const translatedMethods = properties
438
+ const translatedMethods = methods
439
439
  .map(property =>
440
440
  translateMethodForImplementation(
441
441
  hasteModuleName,
@@ -449,7 +449,7 @@ module.exports = {
449
449
  '\n\n' +
450
450
  ModuleClassConstructorTemplate({
451
451
  hasteModuleName,
452
- methods: properties
452
+ methods: methods
453
453
  .map(({name: propertyName, typeAnnotation}) => {
454
454
  const _unwrapNullable11 = unwrapNullable(typeAnnotation),
455
455
  _unwrapNullable12 = _slicedToArray(_unwrapNullable11, 1),
@@ -438,11 +438,11 @@ module.exports = {
438
438
  .map(hasteModuleName => {
439
439
  const {
440
440
  aliasMap,
441
- spec: {properties},
441
+ spec: {methods},
442
442
  } = nativeModules[hasteModuleName];
443
443
  const resolveAlias = createAliasResolver(aliasMap);
444
444
 
445
- const translatedMethods = properties
445
+ const translatedMethods = methods
446
446
  .map(property =>
447
447
  translateMethodForImplementation(
448
448
  hasteModuleName,
@@ -457,7 +457,7 @@ module.exports = {
457
457
  '\n\n' +
458
458
  ModuleClassConstructorTemplate({
459
459
  hasteModuleName,
460
- methods: properties
460
+ methods: methods
461
461
  .map(({name: propertyName, typeAnnotation}) => {
462
462
  const [{returnTypeAnnotation, params}] =
463
463
  unwrapNullable<NativeModuleFunctionTypeAnnotation>(
@@ -118,7 +118,7 @@ module.exports = {
118
118
  const _nativeModules$hasteM = nativeModules[hasteModuleName],
119
119
  aliasMap = _nativeModules$hasteM.aliasMap,
120
120
  excludedPlatforms = _nativeModules$hasteM.excludedPlatforms,
121
- properties = _nativeModules$hasteM.spec.properties;
121
+ spec = _nativeModules$hasteM.spec;
122
122
  if (excludedPlatforms != null && excludedPlatforms.includes('iOS')) {
123
123
  continue;
124
124
  }
@@ -140,10 +140,10 @@ module.exports = {
140
140
  * Note: As we serialize NativeModule methods, we insert structs into
141
141
  * StructCollector, as we encounter them.
142
142
  */
143
- properties
143
+ spec.methods
144
144
  .filter(property => property.name !== 'getConstants')
145
145
  .forEach(serializeProperty);
146
- properties
146
+ spec.methods
147
147
  .filter(property => property.name === 'getConstants')
148
148
  .forEach(serializeProperty);
149
149
  const generatedStructs = structCollector.getAllStructs();
@@ -142,11 +142,8 @@ module.exports = {
142
142
 
143
143
  const hasteModuleNames: Array<string> = Object.keys(nativeModules).sort();
144
144
  for (const hasteModuleName of hasteModuleNames) {
145
- const {
146
- aliasMap,
147
- excludedPlatforms,
148
- spec: {properties},
149
- } = nativeModules[hasteModuleName];
145
+ const {aliasMap, excludedPlatforms, spec} =
146
+ nativeModules[hasteModuleName];
150
147
  if (excludedPlatforms != null && excludedPlatforms.includes('iOS')) {
151
148
  continue;
152
149
  }
@@ -169,10 +166,10 @@ module.exports = {
169
166
  * Note: As we serialize NativeModule methods, we insert structs into
170
167
  * StructCollector, as we encounter them.
171
168
  */
172
- properties
169
+ spec.methods
173
170
  .filter(property => property.name !== 'getConstants')
174
171
  .forEach(serializeProperty);
175
- properties
172
+ spec.methods
176
173
  .filter(property => property.name === 'getConstants')
177
174
  .forEach(serializeProperty);
178
175
 
@@ -18,7 +18,7 @@ const EMPTY_NATIVE_MODULES = {
18
18
  enumMap: {},
19
19
  spec: {
20
20
  eventEmitters: [],
21
- properties: [],
21
+ methods: [],
22
22
  },
23
23
  moduleName: 'SampleTurboModule',
24
24
  },
@@ -82,7 +82,7 @@ const SIMPLE_NATIVE_MODULES = {
82
82
  },
83
83
  spec: {
84
84
  eventEmitters: [],
85
- properties: [
85
+ methods: [
86
86
  {
87
87
  name: 'getConstants',
88
88
  optional: false,
@@ -410,7 +410,7 @@ const TWO_MODULES_DIFFERENT_FILES = {
410
410
  enumMap: {},
411
411
  spec: {
412
412
  eventEmitters: [],
413
- properties: [
413
+ methods: [
414
414
  {
415
415
  name: 'voidFunc',
416
416
  optional: false,
@@ -432,7 +432,7 @@ const TWO_MODULES_DIFFERENT_FILES = {
432
432
  enumMap: {},
433
433
  spec: {
434
434
  eventEmitters: [],
435
- properties: [
435
+ methods: [
436
436
  {
437
437
  name: 'getConstants',
438
438
  optional: false,
@@ -470,7 +470,7 @@ const COMPLEX_OBJECTS = {
470
470
  enumMap: {},
471
471
  spec: {
472
472
  eventEmitters: [],
473
- properties: [
473
+ methods: [
474
474
  {
475
475
  name: 'difficult',
476
476
  optional: false,
@@ -926,7 +926,7 @@ const NATIVE_MODULES_WITH_TYPE_ALIASES = {
926
926
  enumMap: {},
927
927
  spec: {
928
928
  eventEmitters: [],
929
- properties: [
929
+ methods: [
930
930
  {
931
931
  name: 'getConstants',
932
932
  optional: false,
@@ -1211,7 +1211,7 @@ const REAL_MODULE_EXAMPLE = {
1211
1211
  enumMap: {},
1212
1212
  spec: {
1213
1213
  eventEmitters: [],
1214
- properties: [
1214
+ methods: [
1215
1215
  {
1216
1216
  name: 'getConstants',
1217
1217
  optional: false,
@@ -1408,7 +1408,7 @@ const REAL_MODULE_EXAMPLE = {
1408
1408
  enumMap: {},
1409
1409
  spec: {
1410
1410
  eventEmitters: [],
1411
- properties: [
1411
+ methods: [
1412
1412
  {
1413
1413
  name: 'reportFatalException',
1414
1414
  optional: false,
@@ -1829,7 +1829,7 @@ const CXX_ONLY_NATIVE_MODULES = {
1829
1829
  },
1830
1830
  spec: {
1831
1831
  eventEmitters: [],
1832
- properties: [
1832
+ methods: [
1833
1833
  {
1834
1834
  name: 'getArray',
1835
1835
  optional: false,
@@ -2413,7 +2413,7 @@ const SAMPLE_WITH_UPPERCASE_NAME = {
2413
2413
  aliasMap: {},
2414
2414
  spec: {
2415
2415
  eventEmitters: [],
2416
- properties: [],
2416
+ methods: [],
2417
2417
  },
2418
2418
  moduleName: 'SampleTurboModule',
2419
2419
  },
@@ -20,7 +20,7 @@ const EMPTY_NATIVE_MODULES: SchemaType = {
20
20
  enumMap: {},
21
21
  spec: {
22
22
  eventEmitters: [],
23
- properties: [],
23
+ methods: [],
24
24
  },
25
25
  moduleName: 'SampleTurboModule',
26
26
  },
@@ -85,7 +85,7 @@ const SIMPLE_NATIVE_MODULES: SchemaType = {
85
85
  },
86
86
  spec: {
87
87
  eventEmitters: [],
88
- properties: [
88
+ methods: [
89
89
  {
90
90
  name: 'getConstants',
91
91
  optional: false,
@@ -415,7 +415,7 @@ const TWO_MODULES_DIFFERENT_FILES: SchemaType = {
415
415
  enumMap: {},
416
416
  spec: {
417
417
  eventEmitters: [],
418
- properties: [
418
+ methods: [
419
419
  {
420
420
  name: 'voidFunc',
421
421
  optional: false,
@@ -437,7 +437,7 @@ const TWO_MODULES_DIFFERENT_FILES: SchemaType = {
437
437
  enumMap: {},
438
438
  spec: {
439
439
  eventEmitters: [],
440
- properties: [
440
+ methods: [
441
441
  {
442
442
  name: 'getConstants',
443
443
  optional: false,
@@ -476,7 +476,7 @@ const COMPLEX_OBJECTS: SchemaType = {
476
476
  enumMap: {},
477
477
  spec: {
478
478
  eventEmitters: [],
479
- properties: [
479
+ methods: [
480
480
  {
481
481
  name: 'difficult',
482
482
  optional: false,
@@ -933,7 +933,7 @@ const NATIVE_MODULES_WITH_TYPE_ALIASES: SchemaType = {
933
933
  enumMap: {},
934
934
  spec: {
935
935
  eventEmitters: [],
936
- properties: [
936
+ methods: [
937
937
  {
938
938
  name: 'getConstants',
939
939
  optional: false,
@@ -1219,7 +1219,7 @@ const REAL_MODULE_EXAMPLE: SchemaType = {
1219
1219
  enumMap: {},
1220
1220
  spec: {
1221
1221
  eventEmitters: [],
1222
- properties: [
1222
+ methods: [
1223
1223
  {
1224
1224
  name: 'getConstants',
1225
1225
  optional: false,
@@ -1416,7 +1416,7 @@ const REAL_MODULE_EXAMPLE: SchemaType = {
1416
1416
  enumMap: {},
1417
1417
  spec: {
1418
1418
  eventEmitters: [],
1419
- properties: [
1419
+ methods: [
1420
1420
  {
1421
1421
  name: 'reportFatalException',
1422
1422
  optional: false,
@@ -1838,7 +1838,7 @@ const CXX_ONLY_NATIVE_MODULES: SchemaType = {
1838
1838
  },
1839
1839
  spec: {
1840
1840
  eventEmitters: [],
1841
- properties: [
1841
+ methods: [
1842
1842
  {
1843
1843
  name: 'getArray',
1844
1844
  optional: false,
@@ -2424,7 +2424,7 @@ const SAMPLE_WITH_UPPERCASE_NAME: SchemaType = {
2424
2424
  aliasMap: {},
2425
2425
  spec: {
2426
2426
  eventEmitters: [],
2427
- properties: [],
2427
+ methods: [],
2428
2428
  },
2429
2429
  moduleName: 'SampleTurboModule',
2430
2430
  },
@@ -884,7 +884,7 @@ const buildModuleSchema = (
884
884
  eventEmitters: [...moduleSchema.spec.eventEmitters].concat(
885
885
  propertyShape.type === 'eventEmitter' ? [propertyShape.value] : [],
886
886
  ),
887
- properties: [...moduleSchema.spec.properties].concat(
887
+ methods: [...moduleSchema.spec.methods].concat(
888
888
  propertyShape.type === 'method' ? [propertyShape.value] : [],
889
889
  ),
890
890
  },
@@ -897,7 +897,7 @@ const buildModuleSchema = (
897
897
  enumMap: {},
898
898
  spec: {
899
899
  eventEmitters: [],
900
- properties: [],
900
+ methods: [],
901
901
  },
902
902
  moduleName,
903
903
  excludedPlatforms:
@@ -910,7 +910,7 @@ const buildModuleSchema = (
910
910
  enumMap: getSortedObject(nativeModuleSchema.enumMap),
911
911
  spec: {
912
912
  eventEmitters: nativeModuleSchema.spec.eventEmitters.sort(),
913
- properties: nativeModuleSchema.spec.properties.sort(),
913
+ methods: nativeModuleSchema.spec.methods.sort(),
914
914
  },
915
915
  moduleName,
916
916
  excludedPlatforms: nativeModuleSchema.excludedPlatforms,
@@ -844,7 +844,7 @@ const buildModuleSchema = (
844
844
  eventEmitters: [...moduleSchema.spec.eventEmitters].concat(
845
845
  propertyShape.type === 'eventEmitter' ? [propertyShape.value] : [],
846
846
  ),
847
- properties: [...moduleSchema.spec.properties].concat(
847
+ methods: [...moduleSchema.spec.methods].concat(
848
848
  propertyShape.type === 'method' ? [propertyShape.value] : [],
849
849
  ),
850
850
  },
@@ -855,7 +855,7 @@ const buildModuleSchema = (
855
855
  type: 'NativeModule',
856
856
  aliasMap: {},
857
857
  enumMap: {},
858
- spec: {eventEmitters: [], properties: []},
858
+ spec: {eventEmitters: [], methods: []},
859
859
  moduleName,
860
860
  excludedPlatforms:
861
861
  excludedPlatforms.length !== 0 ? [...excludedPlatforms] : undefined,
@@ -868,7 +868,7 @@ const buildModuleSchema = (
868
868
  enumMap: getSortedObject(nativeModuleSchema.enumMap),
869
869
  spec: {
870
870
  eventEmitters: nativeModuleSchema.spec.eventEmitters.sort(),
871
- properties: nativeModuleSchema.spec.properties.sort(),
871
+ methods: nativeModuleSchema.spec.methods.sort(),
872
872
  },
873
873
  moduleName,
874
874
  excludedPlatforms: nativeModuleSchema.excludedPlatforms,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/codegen",
3
- "version": "0.75.0-nightly-20240614-8b53d41a8",
3
+ "version": "0.75.0-nightly-20240615-2f8d4f0c2",
4
4
  "description": "Code generation tools for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {