-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add minimum necessary .d.ts files to react-native-codegen (2) (#36397)
Summary: - Add .d.ts files for generators - export each generators because `react-native-windows` need its own selection of generators. ## Changelog [GENERAL] [CHANGED] - Add minimum necessary .d.ts files to react-native-codegen (2) Pull Request resolved: #36397 Test Plan: `npm run build` in `packages/react-native-codegen` and see all .d.ts files appear in `lib`. Checked .d.ts file in typescript playground. Reviewed By: rshest Differential Revision: D43941811 Pulled By: cipolleschi fbshipit-source-id: 28f5bd56f27531ecf25223620a580358018b779d
- Loading branch information
1 parent
0a3c555
commit ac5aec3
Showing
2 changed files
with
133 additions
and
4 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
packages/react-native-codegen/src/generators/RNCodegen.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
import type { SchemaType } from '../CodegenSchema'; | ||
|
||
export type FilesOutput = Map<string, string>; | ||
export type LibraryGeneratorFunction = (libraryName: string, schema: SchemaType, packageName: string | undefined, assumeNonnull: boolean) => FilesOutput; | ||
export type SchemaGeneratorFunction = (schemas: { [key: string]: SchemaType }) => FilesOutput; | ||
export type ViewGeneratorFunction = (libraryName: string, schema: SchemaType) => FilesOutput; | ||
|
||
type LibraryGeneratorNames = | ||
| 'generateComponentDescriptorH' | ||
| 'generateComponentHObjCpp' | ||
| 'generateEventEmitterCpp' | ||
| 'generateEventEmitterH' | ||
| 'generatePropsCpp' | ||
| 'generatePropsH' | ||
| 'generateStateCpp' | ||
| 'generateStateH' | ||
| 'generateModuleH' | ||
| 'generateModuleCpp' | ||
| 'generateModuleObjCpp' | ||
| 'generateModuleJavaSpec' | ||
| 'generateModuleJniCpp' | ||
| 'generateModuleJniH' | ||
| 'generatePropsJavaInterface' | ||
| 'generatePropsJavaDelegate' | ||
| 'generateTests' | ||
| 'generateShadowNodeCpp' | ||
| 'generateShadowNodeH' | ||
; | ||
|
||
type SchemaGeneratorNames = | ||
| 'generateThirdPartyFabricComponentsProviderObjCpp' | ||
| 'generateThirdPartyFabricComponentsProviderH' | ||
; | ||
|
||
type ViewGeneratorNames = | ||
| 'generateViewConfigJs' | ||
; | ||
|
||
export type AllGenerators = | ||
& { readonly [key in LibraryGeneratorNames]: LibraryGeneratorFunction; } | ||
& { readonly [key in SchemaGeneratorNames]: SchemaGeneratorFunction; } | ||
& { readonly [key in ViewGeneratorNames]: ViewGeneratorFunction; } | ||
; | ||
|
||
export type LibraryGenerators = | ||
| 'componentsAndroid' | ||
| 'componentsIOS' | ||
| 'descriptors' | ||
| 'events' | ||
| 'props' | ||
| 'states' | ||
| 'tests' | ||
| 'shadow-nodes' | ||
| 'modulesAndroid' | ||
| 'modulesCxx' | ||
| 'modulesIOS' | ||
; | ||
|
||
export type SchemaGenerators = | ||
| 'providerIOS' | ||
; | ||
|
||
export interface LibraryOptions { | ||
libraryName: string; | ||
schema: SchemaType; | ||
outputDirectory: string; | ||
packageName?: string | undefined; | ||
assumeNonnull: boolean; | ||
} | ||
|
||
export interface LibraryConfig { | ||
generators: LibraryGenerators[]; | ||
test?: boolean | undefined; | ||
} | ||
|
||
export interface SchemasOptions { | ||
schemas: { [key: string]: SchemaType }; | ||
outputDirectory: string; | ||
} | ||
|
||
export interface SchemasConfig { | ||
generators: SchemaGenerators[]; | ||
test?: boolean | undefined; | ||
} | ||
|
||
export declare const allGenerators: AllGenerators; | ||
export declare const libraryGenerators: { readonly [key in LibraryGenerators]: LibraryGeneratorFunction }; | ||
export declare const schemaGenerators: { readonly [key in SchemaGenerators]: SchemaGeneratorFunction }; | ||
export declare function generate(options: LibraryOptions, config: LibraryConfig): boolean; | ||
export declare function generateFromSchemas(options: SchemasOptions, config: SchemasConfig): boolean; | ||
export declare function generateViewConfig(options: LibraryOptions): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters