Skip to content

Commit 24efebf

Browse files
Antoine Doubovetzkyfacebook-github-bot
authored andcommitted
Extracts modules/utils.js files from the flow and typescript folders in parsers-commons (#34898)
Summary: This PR is a task from #34872 _Extract the modules/utils.js from the flow and typescript folders in a shared parsers-commons.js file. Then, have the two parsers use the same wrapModuleSchema function for modules._ (`wrapModuleSchema` is a copy-paste mistake, in this case it is `wrapNullable` and `unwrapNullable`) ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Internal] [Changed] - Extracts Codegen's modules/utils.js files from the flow and typescript folders in parsers-commons Pull Request resolved: #34898 Test Plan: I ran `yarn jest react-native-codegen`: <img width="775" alt="Capture d’écran 2022-10-07 à 21 29 48" src="https://user-images.githubusercontent.com/17070498/194639515-a446c2cf-daf3-43a1-9833-cd546ca5865e.png"> Reviewed By: cipolleschi Differential Revision: D40193740 Pulled By: cipolleschi fbshipit-source-id: 02cbacc215fe5dd9bdd0839d8796587ab2821906
1 parent 0d3596a commit 24efebf

File tree

15 files changed

+44
-103
lines changed

15 files changed

+44
-103
lines changed

packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type {
2222

2323
import type {AliasResolver} from './Utils';
2424
const {createAliasResolver, getModules} = require('./Utils');
25-
const {unwrapNullable} = require('../../parsers/flow/modules/utils');
25+
const {unwrapNullable} = require('../../parsers/parsers-commons');
2626

2727
type FilesOutput = Map<string, string>;
2828

packages/react-native-codegen/src/generators/modules/GenerateModuleH.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type {
2121
import type {AliasResolver} from './Utils';
2222
const {createAliasResolver, getModules} = require('./Utils');
2323
const {indent} = require('../Utils');
24-
const {unwrapNullable} = require('../../parsers/flow/modules/utils');
24+
const {unwrapNullable} = require('../../parsers/parsers-commons');
2525

2626
type FilesOutput = Map<string, string>;
2727

packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type {
2222

2323
import type {AliasResolver} from './Utils';
2424
const {createAliasResolver, getModules} = require('./Utils');
25-
const {unwrapNullable} = require('../../parsers/flow/modules/utils');
25+
const {unwrapNullable} = require('../../parsers/parsers-commons');
2626

2727
type FilesOutput = Map<string, string>;
2828

packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type {
2222

2323
import type {AliasResolver} from './Utils';
2424
const {createAliasResolver, getModules} = require('./Utils');
25-
const {unwrapNullable} = require('../../parsers/flow/modules/utils');
25+
const {unwrapNullable} = require('../../parsers/parsers-commons');
2626

2727
type FilesOutput = Map<string, string>;
2828

packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const {capitalize} = require('../../Utils');
3232
const {
3333
unwrapNullable,
3434
wrapNullable,
35-
} = require('../../../parsers/flow/modules/utils');
35+
} = require('../../../parsers/parsers-commons');
3636

3737
type StructContext = 'CONSTANTS' | 'REGULAR';
3838

packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {Nullable} from '../../../../CodegenSchema';
1717
import type {StructTypeAnnotation, ConstantsStruct} from '../StructCollector';
1818
import type {StructSerilizationOutput} from './serializeStruct';
1919

20-
const {unwrapNullable} = require('../../../../parsers/flow/modules/utils');
20+
const {unwrapNullable} = require('../../../../parsers/parsers-commons');
2121

2222
const StructTemplate = ({
2323
hasteModuleName,

packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {Nullable} from '../../../../CodegenSchema';
1717
import type {StructTypeAnnotation, RegularStruct} from '../StructCollector';
1818
import type {StructSerilizationOutput} from './serializeStruct';
1919

20-
const {unwrapNullable} = require('../../../../parsers/flow/modules/utils');
20+
const {unwrapNullable} = require('../../../../parsers/parsers-commons');
2121

2222
const StructTemplate = ({
2323
hasteModuleName,

packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const {capitalize} = require('../../Utils');
2727
const {
2828
wrapNullable,
2929
unwrapNullable,
30-
} = require('../../../parsers/flow/modules/utils');
30+
} = require('../../../parsers/parsers-commons');
3131

3232
const ProtocolMethodTemplate = ({
3333
returnObjCType,

packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
} from '../../../../CodegenSchema';
1717

1818
const {parseString} = require('../../index.js');
19-
const {unwrapNullable} = require('../utils');
19+
const {unwrapNullable} = require('../../../parsers-commons');
2020
const {
2121
UnsupportedFlowGenericParserError,
2222
UnsupportedFlowTypeAnnotationParserError,

packages/react-native-codegen/src/parsers/flow/modules/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const {
3232
visit,
3333
isModuleRegistryCall,
3434
} = require('../utils.js');
35-
const {unwrapNullable, wrapNullable} = require('./utils');
35+
const {unwrapNullable, wrapNullable} = require('../../parsers-commons');
3636
const {
3737
IncorrectlyParameterizedFlowGenericParserError,
3838
MisnamedModuleFlowInterfaceParserError,

0 commit comments

Comments
 (0)