UNPKG

@react-native/core-cli-utils

Version:
72 lines (61 loc) 1.91 kB
/** * 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. * * @flow strict-local * @format */ import type { Task } from "./types"; import type { ExecaPromise } from "execa"; type BundlerOptions = { // Metro's config: https://metrobundler.dev/docs/configuration/ config?: string, // Typically index.{ios,android}.js entryFile: string, +platform: "ios" | "android" | string, dev: boolean, // Metro built main bundle outputJsBundle: string, minify: boolean, optimize: boolean, // Generate a source map file outputSourceMap: string, // Where to pass the final bundle. Typically this is the App's resource // folder, however this is app specific. React Native will need to know where // this is to bootstrap your application. See: // - Android: https://reactnative.dev/docs/integration-with-existing-apps?language=kotlin#creating-a-release-build-in-android-studio // - iOS: https://reactnative.dev/docs/integration-with-existing-apps?language=swift#2-event-handler outputBundle: string, cwd: string, jsvm: "hermes" | "jsc", hermes?: HermesConfig, ...Bundler, }; type HermesConfig = { // Path where hermes is is installed // iOS: Pods/hermes-engine path: string, // iOS: <hermes.path>/destroot/bin/hermesc hermesc: string, }; type BundlerWatch = { +mode: "watch", callback?: (metro: ExecaPromise) => void, }; type BundlerBuild = { +mode: "bundle", }; type Bundler = BundlerWatch | BundlerBuild; declare export const tasks: { bundle: (options: BundlerOptions, ...args: $ReadOnlyArray<string>) => Bundle, }; type Bundle = { validate?: Task<void>, javascript: Task<ExecaPromise>, sourcemap?: Task<void>, validateHermesc?: Task<ExecaPromise>, convert?: Task<ExecaPromise>, compose?: Task<ExecaPromise>, };