UNPKG

babel-preset-expo

Version:
53 lines (52 loc) 2.82 kB
import type { ConfigAPI, TransformOptions } from '@babel/core'; import type { PluginOptions as ReactCompilerOptions } from 'babel-plugin-react-compiler'; interface BabelPresetExpoPlatformOptions { /** Disable or configure the `@babel/plugin-proposal-decorators` plugin. */ decorators?: false | { legacy?: boolean; version?: number; }; /** Enable or disable adding the Reanimated plugin by default. @default `true` */ reanimated?: boolean; /** Enable or disable adding the Worklets plugin by default. Only applies when * using `react-native-worklets` or Reanimated 4. @default `true` */ worklets?: boolean; /** Enable or disable adding the `@expo/ui` Babel plugin when `@expo/ui` is * installed. The plugin rewrites `Icon.select({ ios, android })` to the * active platform's value (read from the babel caller) so per-platform * bundles only carry their own branch. @default `true` */ expoUi?: boolean; /** Change the policy for handling JSX in a file. Passed to `plugin-transform-react-jsx`. @default `'automatic'` */ jsxRuntime?: 'classic' | 'automatic'; /** Change the source module ID to use when importing an automatic JSX import. Only applied when `jsxRuntime` is `'automatic'` (default). Passed to `plugin-transform-react-jsx`. @default `'react'` */ jsxImportSource?: string; lazyImports?: boolean; disableImportExportTransform?: boolean; disableDeepImportWarnings?: boolean; enableBabelRuntime?: boolean | string; unstable_transformProfile?: 'default' | 'hermes-v0' | 'hermes-stable' | 'hermes-canary'; /** Settings to pass to `babel-plugin-react-compiler`. Set as `false` to disable the plugin. */ 'react-compiler'?: false | ReactCompilerOptions; /** Only set to `false` to disable `react-refresh/babel` forcefully, defaults to `undefined` */ enableReactFastRefresh?: boolean; /** Enable `typeof window` runtime checks. The default behavior is to minify `typeof window` on web clients to `"object"` and `"undefined"` on servers. */ minifyTypeofWindow?: boolean; /** * Enable that transform that converts `import.meta` to `globalThis.__ExpoImportMetaRegistry`. * * > **Note:** If the JavaScript engine supports `import.meta` natively, this transformation may interfere with the native implementation. * * @default `true` */ transformImportMeta?: boolean; } export interface BabelPresetExpoOptions extends BabelPresetExpoPlatformOptions { /** Web-specific settings. */ web?: BabelPresetExpoPlatformOptions; /** Native-specific settings. */ native?: BabelPresetExpoPlatformOptions; } declare function babelPresetExpo(api: ConfigAPI, options?: BabelPresetExpoOptions): TransformOptions; export default babelPresetExpo;