Skip to content

Commit

Permalink
feat(parsers): don't duplicate buildSchema calls and use parseString …
Browse files Browse the repository at this point in the history
…instead
  • Loading branch information
MaeIg committed Jan 6, 2023
1 parent ec1d3d3 commit f575f2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
10 changes: 1 addition & 9 deletions packages/react-native-codegen/src/parsers/flow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ const parser = new FlowParser();
function parseModuleFixture(filename: string): SchemaType {
const contents = fs.readFileSync(filename, 'utf8');

return buildSchema(
contents,
'path/NativeSampleTurboModule.js',
wrapComponentSchema,
buildComponentSchema,
buildModuleSchema,
Visitor,
parser,
);
return parseString(contents, 'path/NativeSampleTurboModule.js');
}

function parseString(contents: string, filename: ?string): SchemaType {
Expand Down
10 changes: 1 addition & 9 deletions packages/react-native-codegen/src/parsers/typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ const parser = new TypeScriptParser();
function parseModuleFixture(filename: string): SchemaType {
const contents = fs.readFileSync(filename, 'utf8');

return buildSchema(
contents,
'path/NativeSampleTurboModule.ts',
wrapComponentSchema,
buildComponentSchema,
buildModuleSchema,
Visitor,
parser,
);
return parseString(contents, 'path/NativeSampleTurboModule.ts');
}

function parseString(contents: string, filename: ?string): SchemaType {
Expand Down

0 comments on commit f575f2b

Please sign in to comment.