@react-native/codegen 0.90.0-nightly-20261106-cd45f309e → 0.90.0-nightly-20261107-3aed1720f

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.
@@ -77,7 +77,7 @@ export type GenerateFunction = (
77
77
  ) => FilesOutput;
78
78
 
79
79
  export type LibraryGeneratorsFunctions = Readonly<{
80
- [string]: Array<GenerateFunction>,
80
+ [key: string]: Array<GenerateFunction>,
81
81
  }>;
82
82
 
83
83
  export type LibraryOptions = Readonly<{
@@ -92,9 +92,9 @@ export type LibraryOptions = Readonly<{
92
92
  }>;
93
93
 
94
94
  export type SchemasOptions = Readonly<{
95
- schemas: {[string]: SchemaType},
95
+ schemas: {[key: string]: SchemaType},
96
96
  outputDirectory: string,
97
- supportedApplePlatforms?: {[string]: {[string]: boolean}},
97
+ supportedApplePlatforms?: {[key: string]: {[key: string]: boolean}},
98
98
  }>;
99
99
 
100
100
  export type LibraryGenerators =
@@ -43,83 +43,82 @@ type ReservedTypeMapping = {
43
43
  readonly java: JavaImportInfo,
44
44
  };
45
45
 
46
- const RESERVED_TYPES: {readonly [ReservedPrimitiveName]: ReservedTypeMapping} =
47
- {
48
- ColorPrimitive: {
49
- cpp: {
50
- typeName: 'SharedColor',
51
- localIncludes: ['#include <React/Graphics.h>'],
52
- conversionIncludes: [],
53
- },
54
- java: {
55
- interfaceImports: [],
56
- delegateImports: [
57
- 'import com.facebook.react.bridge.ColorPropConverter;',
58
- ],
59
- },
46
+ const RESERVED_TYPES: {
47
+ readonly [key: ReservedPrimitiveName]: ReservedTypeMapping,
48
+ } = {
49
+ ColorPrimitive: {
50
+ cpp: {
51
+ typeName: 'SharedColor',
52
+ localIncludes: ['#include <React/Graphics.h>'],
53
+ conversionIncludes: [],
60
54
  },
61
- ImageSourcePrimitive: {
62
- cpp: {
63
- typeName: 'ImageSource',
64
- localIncludes: ['#include <React/ImageManager.h>'],
65
- conversionIncludes: ['#include <React/Image.h>'],
66
- },
67
- java: {
68
- interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
69
- delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
70
- },
55
+ java: {
56
+ interfaceImports: [],
57
+ delegateImports: ['import com.facebook.react.bridge.ColorPropConverter;'],
71
58
  },
72
- ImageRequestPrimitive: {
73
- cpp: {
74
- typeName: 'ImageRequest',
75
- localIncludes: ['#include <React/ImageManager.h>'],
76
- conversionIncludes: [],
77
- },
78
- java: {
79
- // ImageRequestPrimitive is not used in Java component props
80
- interfaceImports: [],
81
- delegateImports: [],
82
- },
59
+ },
60
+ ImageSourcePrimitive: {
61
+ cpp: {
62
+ typeName: 'ImageSource',
63
+ localIncludes: ['#include <React/ImageManager.h>'],
64
+ conversionIncludes: ['#include <React/Image.h>'],
83
65
  },
84
- PointPrimitive: {
85
- cpp: {
86
- typeName: 'Point',
87
- localIncludes: ['#include <React/Graphics.h>'],
88
- conversionIncludes: [],
89
- },
90
- java: {
91
- interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
92
- delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
93
- },
66
+ java: {
67
+ interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
68
+ delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
94
69
  },
95
- EdgeInsetsPrimitive: {
96
- cpp: {
97
- typeName: 'EdgeInsets',
98
- localIncludes: ['#include <React/Graphics.h>'],
99
- conversionIncludes: [],
100
- },
101
- java: {
102
- interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
103
- delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
104
- },
70
+ },
71
+ ImageRequestPrimitive: {
72
+ cpp: {
73
+ typeName: 'ImageRequest',
74
+ localIncludes: ['#include <React/ImageManager.h>'],
75
+ conversionIncludes: [],
105
76
  },
106
- DimensionPrimitive: {
107
- cpp: {
108
- typeName: 'YGValue',
109
- localIncludes: [
110
- '#include <yoga/Yoga.h>',
111
- '#include <React/RendererCore.h>',
112
- ],
113
- conversionIncludes: ['#include <React/View.h>'],
114
- },
115
- java: {
116
- interfaceImports: ['import com.facebook.yoga.YogaValue;'],
117
- delegateImports: [
118
- 'import com.facebook.react.bridge.DimensionPropConverter;',
119
- ],
120
- },
77
+ java: {
78
+ // ImageRequestPrimitive is not used in Java component props
79
+ interfaceImports: [],
80
+ delegateImports: [],
121
81
  },
122
- };
82
+ },
83
+ PointPrimitive: {
84
+ cpp: {
85
+ typeName: 'Point',
86
+ localIncludes: ['#include <React/Graphics.h>'],
87
+ conversionIncludes: [],
88
+ },
89
+ java: {
90
+ interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
91
+ delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
92
+ },
93
+ },
94
+ EdgeInsetsPrimitive: {
95
+ cpp: {
96
+ typeName: 'EdgeInsets',
97
+ localIncludes: ['#include <React/Graphics.h>'],
98
+ conversionIncludes: [],
99
+ },
100
+ java: {
101
+ interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
102
+ delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
103
+ },
104
+ },
105
+ DimensionPrimitive: {
106
+ cpp: {
107
+ typeName: 'YGValue',
108
+ localIncludes: [
109
+ '#include <yoga/Yoga.h>',
110
+ '#include <React/RendererCore.h>',
111
+ ],
112
+ conversionIncludes: ['#include <React/View.h>'],
113
+ },
114
+ java: {
115
+ interfaceImports: ['import com.facebook.yoga.YogaValue;'],
116
+ delegateImports: [
117
+ 'import com.facebook.react.bridge.DimensionPropConverter;',
118
+ ],
119
+ },
120
+ },
121
+ };
123
122
 
124
123
  function getCppTypeForReservedPrimitive(name: ReservedPrimitiveName): string {
125
124
  return RESERVED_TYPES[name].cpp.typeName;
@@ -20,7 +20,7 @@ const APPLE_PLATFORMS_MACRO_MAP = {
20
20
  */
21
21
  function generateSupportedApplePlatformsMacro(
22
22
  fileTemplate: string,
23
- supportedPlatformsMap: ?{[string]: boolean},
23
+ supportedPlatformsMap: ?{[key: string]: boolean},
24
24
  ): string {
25
25
  if (!supportedPlatformsMap) {
26
26
  return fileTemplate;
@@ -68,8 +68,8 @@ Class<RCTComponentViewProtocol> ${className}Cls(void) __attribute__((used)); //
68
68
 
69
69
  module.exports = {
70
70
  generate(
71
- schemas: {[string]: SchemaType},
72
- supportedApplePlatforms?: {[string]: {[string]: boolean}},
71
+ schemas: {[key: string]: SchemaType},
72
+ supportedApplePlatforms?: {[key: string]: {[key: string]: boolean}},
73
73
  ): FilesOutput {
74
74
  const fileName = 'RCTThirdPartyFabricComponentsProvider.h';
75
75
 
@@ -65,8 +65,8 @@ const LookupMapTemplate = ({
65
65
 
66
66
  module.exports = {
67
67
  generate(
68
- schemas: {[string]: SchemaType},
69
- supportedApplePlatforms?: {[string]: {[string]: boolean}},
68
+ schemas: {[key: string]: SchemaType},
69
+ supportedApplePlatforms?: {[key: string]: {[key: string]: boolean}},
70
70
  ): FilesOutput {
71
71
  const fileName = 'RCTThirdPartyFabricComponentsProvider.mm';
72
72
 
@@ -38,17 +38,16 @@ function createAliasResolver(aliasMap: NativeModuleAliasMap): AliasResolver {
38
38
  function getModules(
39
39
  schema: SchemaType,
40
40
  ): Readonly<{[hasteModuleName: string]: NativeModuleSchema}> {
41
- return Object.keys(schema.modules).reduce<{[string]: NativeModuleSchema}>(
42
- (modules, hasteModuleName: string) => {
43
- const module = schema.modules[hasteModuleName];
44
- if (module == null || module.type === 'Component') {
45
- return modules;
46
- }
47
- modules[hasteModuleName] = module;
41
+ return Object.keys(schema.modules).reduce<{
42
+ [key: string]: NativeModuleSchema,
43
+ }>((modules, hasteModuleName: string) => {
44
+ const module = schema.modules[hasteModuleName];
45
+ if (module == null || module.type === 'Component') {
48
46
  return modules;
49
- },
50
- {},
51
- );
47
+ }
48
+ modules[hasteModuleName] = module;
49
+ return modules;
50
+ }, {});
52
51
  }
53
52
 
54
53
  function isDirectRecursiveMember(
@@ -11,11 +11,11 @@
11
11
  'use strict';
12
12
 
13
13
  function compareSnaps(
14
- flowFixtures /*: Readonly<{[string]: string}> */,
15
- flowSnaps /*: Readonly<{[string]: string}> */,
14
+ flowFixtures /*: Readonly<{[key: string]: string}> */,
15
+ flowSnaps /*: Readonly<{[key: string]: string}> */,
16
16
  flowExtraCases /*: ReadonlyArray<string> */,
17
- tsFixtures /*: Readonly<{[string]: string}> */,
18
- tsSnaps /*: Readonly<{[string]: string}> */,
17
+ tsFixtures /*: Readonly<{[key: string]: string}> */,
18
+ tsSnaps /*: Readonly<{[key: string]: string}> */,
19
19
  tsExtraCases /*: ReadonlyArray<string> */,
20
20
  ignoredCases /*: ReadonlyArray<string> */,
21
21
  ) {
@@ -68,7 +68,7 @@ function compareSnaps(
68
68
  }
69
69
 
70
70
  function compareTsArraySnaps(
71
- tsSnaps /*: Readonly<{[string]: string}> */,
71
+ tsSnaps /*: Readonly<{[key: string]: string}> */,
72
72
  tsExtraCases /*: ReadonlyArray<string> */,
73
73
  ) {
74
74
  for (const array2Case of tsExtraCases.filter(
@@ -373,13 +373,15 @@ function throwIfMoreThanOneCodegenNativecommands(
373
373
  }
374
374
  }
375
375
 
376
- function throwIfConfigNotfound(foundConfigs: Array<{[string]: string}>) {
376
+ function throwIfConfigNotfound(foundConfigs: Array<{[key: string]: string}>) {
377
377
  if (foundConfigs.length === 0) {
378
378
  throw new Error('Could not find component config for native component');
379
379
  }
380
380
  }
381
381
 
382
- function throwIfMoreThanOneConfig(foundConfigs: Array<{[string]: string}>) {
382
+ function throwIfMoreThanOneConfig(
383
+ foundConfigs: Array<{[key: string]: string}>,
384
+ ) {
383
385
  if (foundConfigs.length > 1) {
384
386
  throw new Error('Only one component is supported per file');
385
387
  }
@@ -270,7 +270,7 @@ type EventTypeAST = any;
270
270
 
271
271
  type TypeMap = {
272
272
  // $FlowFixMe[unclear-type] there's no flowtype for ASTs
273
- [string]: any,
273
+ [key: string]: any,
274
274
  ...
275
275
  };
276
276
 
@@ -352,7 +352,7 @@ class FlowParser implements Parser {
352
352
  getNativeComponentType(
353
353
  typeArgumentParams: $FlowFixMe,
354
354
  funcArgumentParams: $FlowFixMe,
355
- ): {[string]: string} {
355
+ ): {[key: string]: string} {
356
356
  return {
357
357
  propsTypeName: typeArgumentParams[0].id.name,
358
358
  componentName: funcArgumentParams[0].value,
@@ -314,7 +314,7 @@ export interface Parser {
314
314
  getNativeComponentType(
315
315
  typeArgumentParams: $FlowFixMe,
316
316
  funcArgumentParams: $FlowFixMe,
317
- ): {[string]: string};
317
+ ): {[key: string]: string};
318
318
 
319
319
  /**
320
320
  * Given a annotatedElement, it returns the properties of annotated element.
@@ -268,7 +268,7 @@ export class MockedParser implements Parser {
268
268
  getNativeComponentType(
269
269
  typeArgumentParams: $FlowFixMe,
270
270
  funcArgumentParams: $FlowFixMe,
271
- ): {[string]: string} {
271
+ ): {[key: string]: string} {
272
272
  return {
273
273
  propsTypeName: typeArgumentParams[0].id.name,
274
274
  componentName: funcArgumentParams[0].value,
@@ -928,7 +928,7 @@ const buildModuleSchema = (
928
928
  */
929
929
  function findNativeComponentType(
930
930
  statement: $FlowFixMe,
931
- foundConfigs: Array<{[string]: string}>,
931
+ foundConfigs: Array<{[key: string]: string}>,
932
932
  parser: Parser,
933
933
  ): void {
934
934
  let declaration = statement.declaration;
@@ -949,7 +949,7 @@ function findNativeComponentType(
949
949
  parser.getTypeArgumentParamsFromDeclaration(declaration);
950
950
  const funcArgumentParams = declaration.arguments;
951
951
 
952
- const nativeComponentType: {[string]: string} =
952
+ const nativeComponentType: {[key: string]: string} =
953
953
  parser.getNativeComponentType(typeArgumentParams, funcArgumentParams);
954
954
  if (funcArgumentParams.length > 1) {
955
955
  nativeComponentType.optionsExpression = funcArgumentParams[1];
@@ -1153,7 +1153,7 @@ function getEventArgument(
1153
1153
  /* $FlowFixMe[signature-verification-failure] there's no flowtype for AST.
1154
1154
  * TODO(T108222691): Use flow-types for @babel/parser */
1155
1155
  function findComponentConfig(ast: $FlowFixMe, parser: Parser) {
1156
- const foundConfigs: Array<{[string]: string}> = [];
1156
+ const foundConfigs: Array<{[key: string]: string}> = [];
1157
1157
 
1158
1158
  const defaultExports = ast.body.filter(
1159
1159
  node => node.type === 'ExportDefaultDeclaration',
@@ -372,7 +372,7 @@ class TypeScriptParser implements Parser {
372
372
  getNativeComponentType(
373
373
  typeArgumentParams: $FlowFixMe,
374
374
  funcArgumentParams: $FlowFixMe,
375
- ): {[string]: string} {
375
+ ): {[key: string]: string} {
376
376
  return {
377
377
  propsTypeName: typeArgumentParams[0].typeName.name,
378
378
  componentName: funcArgumentParams[0].value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/codegen",
3
- "version": "0.90.0-nightly-20261106-cd45f309e",
3
+ "version": "0.90.0-nightly-20261107-3aed1720f",
4
4
  "description": "Code generation tools for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {