1import { ExpoModuleConfig } from './ExpoModuleConfig';
2
3export type SupportedPlatform = 'ios' | 'android' | 'web';
4
5export interface SearchOptions {
6  // Available in the CLI
7  searchPaths: string[];
8  ignorePaths?: string[] | null;
9  exclude?: string[] | null;
10  platform: SupportedPlatform;
11  silent?: boolean;
12  nativeModulesDir?: string | null;
13
14  // Scratched from project's config
15  flags?: Record<string, any>;
16}
17
18export interface ResolveOptions extends SearchOptions {
19  json?: boolean;
20}
21
22export interface GenerateOptions extends ResolveOptions {
23  target: string;
24  namespace?: string;
25  empty?: boolean;
26}
27
28export interface PatchReactImportsOptions {
29  podsRoot: string;
30  dryRun: boolean;
31}
32
33export type PackageRevision = {
34  path: string;
35  version: string;
36  config?: ExpoModuleConfig;
37  duplicates?: PackageRevision[];
38};
39
40export type SearchResults = {
41  [moduleName: string]: PackageRevision;
42};
43
44export interface ModuleAndroidProjectInfo {
45  name: string;
46  sourceDir: string;
47}
48
49export interface ModuleAndroidPluginInfo {
50  id: string;
51  sourceDir: string;
52}
53
54export interface ModuleDescriptorAndroid {
55  packageName: string;
56  projects: ModuleAndroidProjectInfo[];
57  plugins?: ModuleAndroidPluginInfo[];
58  modules: string[];
59}
60
61export interface ModuleIosPodspecInfo {
62  podName: string;
63  podspecDir: string;
64}
65export interface ModuleDescriptorIos {
66  packageName: string;
67  pods: ModuleIosPodspecInfo[];
68  flags: Record<string, any> | undefined;
69  swiftModuleNames: string[];
70  modules: string[];
71  appDelegateSubscribers: string[];
72  reactDelegateHandlers: string[];
73  debugOnly: boolean;
74}
75
76export type ModuleDescriptor = ModuleDescriptorAndroid | ModuleDescriptorIos;
77
78export interface AndroidGradlePluginDescriptor {
79  /**
80   * Gradle plugin ID
81   */
82  id: string;
83
84  /**
85   * Artifact group
86   */
87  group: string;
88
89  /**
90   * Relative path to the gradle plugin directory
91   */
92  sourceDir: string;
93}
94
95/**
96 * Represents a raw config from `expo-module.json`.
97 */
98export interface RawExpoModuleConfig {
99  /**
100   * An array of supported platforms.
101   */
102  platforms?: SupportedPlatform[];
103
104  /**
105   * iOS-specific config.
106   */
107  ios?: {
108    /**
109     * Names of Swift native modules classes to put to the generated modules provider file.
110     */
111    modules?: string[];
112
113    /**
114     * Names of Swift native modules classes to put to the generated modules provider file.
115     * @deprecated Deprecated in favor of `modules`. Might be removed in the future releases.
116     */
117    modulesClassNames?: string[];
118
119    /**
120     * Names of Swift classes that hooks into `ExpoAppDelegate` to receive AppDelegate life-cycle events.
121     */
122    appDelegateSubscribers?: string[];
123
124    /**
125     * Names of Swift classes that implement `ExpoReactDelegateHandler` to hook React instance creation.
126     */
127    reactDelegateHandlers?: string[];
128
129    /**
130     * Podspec relative path.
131     * To have multiple podspecs, string array type is also supported.
132     */
133    podspecPath?: string | string[];
134
135    /**
136     * Swift product module name. If empty, the pod name is used for Swift imports.
137     * To have multiple modules, string array is also supported.
138     */
139    swiftModuleName?: string | string[];
140
141    /**
142     * Whether this module will be added only to the debug configuration.
143     * Defaults to false.
144     */
145    debugOnly?: boolean;
146  };
147
148  /**
149   * Android-specific config.
150   */
151  android?: {
152    /**
153     * Full names (package + class name) of Kotlin native modules classes to put to the generated package provider file.
154     */
155    modules?: string[];
156
157    /**
158     * Full names (package + class name) of Kotlin native modules classes to put to the generated package provider file.
159     * @deprecated Deprecated in favor of `modules`. Might be removed in the future releases.
160     */
161    modulesClassNames?: string[];
162
163    /**
164     * build.gradle relative path.
165     * To have multiple build.gradle projects, string array type is also supported.
166     */
167    gradlePath?: string | string[];
168
169    /**
170     * Gradle plugins.
171     */
172    gradlePlugins?: AndroidGradlePluginDescriptor[];
173  };
174}
175