mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
consolidate parsers component schema to common root (#36219)
Summary: > [Codegen 85] The parses/flow/components/schema.js and parses/typescript/components/schema.js are the same. Move the schema.js from the one of the two folders to the parsers common root. Delete the other. Update the references to use the shared file. Part of the Codegen ☂️ Issue https://github.com/facebook/react-native/issues/34872 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Internal] [Changed] - Consolidated the schema.js files for parses/flow/components and parses/typescript/components to a common root. Pull Request resolved: https://github.com/facebook/react-native/pull/36219 Test Plan: Run ```yarn jest react-native-codegen``` Reviewed By: christophpurrer Differential Revision: D43444666 Pulled By: cipolleschi fbshipit-source-id: 24d791fd3a8110730d3f6054497ea3a31549a5a5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
726a40ce28
commit
8be9dbfcc1
+1
-1
@@ -23,7 +23,7 @@ import {
|
||||
import type {ParserType} from '../errors';
|
||||
|
||||
const {Visitor} = require('../flow/Visitor');
|
||||
const {wrapComponentSchema} = require('../flow/components/schema');
|
||||
const {wrapComponentSchema} = require('../schema.js');
|
||||
const {buildComponentSchema} = require('../flow/components');
|
||||
const {buildModuleSchema} = require('../flow/modules');
|
||||
const {isModuleRegistryCall} = require('../utils.js');
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
import type {TypeDeclarationMap} from '../../utils';
|
||||
import type {CommandOptions} from './options';
|
||||
import type {ComponentSchemaBuilderConfig} from './schema.js';
|
||||
import type {ComponentSchemaBuilderConfig} from '../../schema.js';
|
||||
|
||||
const {getTypes} = require('../utils');
|
||||
const {getCommands} = require('./commands');
|
||||
|
||||
@@ -28,7 +28,7 @@ const flowParser = require('flow-parser');
|
||||
const {buildSchema} = require('../parsers-commons');
|
||||
const {Visitor} = require('./Visitor');
|
||||
const {buildComponentSchema} = require('./components');
|
||||
const {wrapComponentSchema} = require('./components/schema');
|
||||
const {wrapComponentSchema} = require('../schema.js');
|
||||
const {buildModuleSchema} = require('./modules');
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -26,7 +26,7 @@ import type {
|
||||
import type {Parser} from './parser';
|
||||
import type {ParserType} from './errors';
|
||||
import type {ParserErrorCapturer, TypeDeclarationMap} from './utils';
|
||||
import type {ComponentSchemaBuilderConfig} from './flow/components/schema';
|
||||
import type {ComponentSchemaBuilderConfig} from './schema.js';
|
||||
|
||||
const {
|
||||
getConfigType,
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -18,7 +18,7 @@ import type {
|
||||
ExtendsPropsShape,
|
||||
SchemaType,
|
||||
OptionsShape,
|
||||
} from '../../../CodegenSchema.js';
|
||||
} from '../CodegenSchema.js';
|
||||
|
||||
export type ComponentSchemaBuilderConfig = $ReadOnly<{
|
||||
filename: string,
|
||||
@@ -12,7 +12,7 @@
|
||||
import type {ExtendsPropsShape} from '../../../CodegenSchema.js';
|
||||
import type {TypeDeclarationMap} from '../../utils';
|
||||
import type {CommandOptions} from './options';
|
||||
import type {ComponentSchemaBuilderConfig} from './schema.js';
|
||||
import type {ComponentSchemaBuilderConfig} from '../../schema.js';
|
||||
|
||||
const {getTypes} = require('../utils');
|
||||
const {getCommands} = require('./commands');
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {
|
||||
EventTypeShape,
|
||||
NamedShape,
|
||||
CommandTypeAnnotation,
|
||||
PropTypeAnnotation,
|
||||
ExtendsPropsShape,
|
||||
SchemaType,
|
||||
OptionsShape,
|
||||
} from '../../../CodegenSchema.js';
|
||||
|
||||
export type ComponentSchemaBuilderConfig = $ReadOnly<{
|
||||
filename: string,
|
||||
componentName: string,
|
||||
extendsProps: $ReadOnlyArray<ExtendsPropsShape>,
|
||||
events: $ReadOnlyArray<EventTypeShape>,
|
||||
props: $ReadOnlyArray<NamedShape<PropTypeAnnotation>>,
|
||||
commands: $ReadOnlyArray<NamedShape<CommandTypeAnnotation>>,
|
||||
options?: ?OptionsShape,
|
||||
}>;
|
||||
|
||||
function wrapComponentSchema({
|
||||
filename,
|
||||
componentName,
|
||||
extendsProps,
|
||||
events,
|
||||
props,
|
||||
options,
|
||||
commands,
|
||||
}: ComponentSchemaBuilderConfig): SchemaType {
|
||||
return {
|
||||
modules: {
|
||||
[filename]: {
|
||||
type: 'Component',
|
||||
components: {
|
||||
[componentName]: {
|
||||
...(options || {}),
|
||||
extendsProps,
|
||||
events,
|
||||
props,
|
||||
commands,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
wrapComponentSchema,
|
||||
};
|
||||
@@ -28,7 +28,7 @@ const babelParser = require('@babel/parser');
|
||||
const {buildSchema} = require('../parsers-commons');
|
||||
const {Visitor} = require('./Visitor');
|
||||
const {buildComponentSchema} = require('./components');
|
||||
const {wrapComponentSchema} = require('./components/schema');
|
||||
const {wrapComponentSchema} = require('../schema.js');
|
||||
const {buildModuleSchema} = require('./modules');
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
Reference in New Issue
Block a user