/** * 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. * * @noformat * @oncall react_native * @generated SignedSource<<5abe6b1de7915ae7da7b88255ba04adc>> * * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js * Original file: packages/metro/src/DeltaBundler/types.js * To regenerate, run: * js1 build metro-ts-defs (internal) OR * yarn run build-ts-defs (OSS) */ import type {RequireContext} from '../lib/contextModule'; import type {RequireContextParams} from '../ModuleGraph/worker/collectDependencies'; import type {ReadonlySourceLocation} from '../shared/types'; import type {Graph} from './Graph'; import type {JsTransformOptions} from 'metro-transform-worker'; import CountingSet from '../lib/CountingSet'; export type ReadonlyJsonData = null | boolean | number | string | ReadonlyArray | Readonly<{[$$Key$$: string]: null | undefined | ReadonlyJsonData}>; export type MixedOutput = {readonly data: unknown; readonly type: string}; export type AsyncDependencyType = 'async' | 'maybeSync' | 'prefetch' | 'weak'; export type TransformResultDependency = Readonly<{ /** * The literal name provided to a require or import call. For example 'foo' in * case of `require('foo')`. */ name: string; /** * Extra data returned by the dependency extractor. */ data: Readonly<{ /** * A locally unique key for this dependency within the current module. */ key: string; /** * If not null, this dependency is due to a dynamic `import()` or `__prefetchImport()` call. */ asyncType: AsyncDependencyType | null; /** * True if the dependency is declared with a static "import x from 'y'" or * an import() call. */ isESMImport: boolean; /** * The dependency is enclosed in a try/catch block. */ isOptional?: boolean | undefined; locs: ReadonlyArray; /** Context for requiring a collection of modules. */ contextParams?: RequireContextParams | undefined; }>; }>; export type ResolvedDependency = Readonly<{ absolutePath: string; data: TransformResultDependency; }>; export type Dependency = ResolvedDependency | Readonly<{data: TransformResultDependency}>; export type Module = Readonly<{ dependencies: Map; inverseDependencies: CountingSet; output: ReadonlyArray; path: string; getSource: () => Buffer; unstable_transformResultKey?: null | undefined | string; }>; export type ModuleData = Readonly<{ dependencies: ReadonlyMap; resolvedContexts: ReadonlyMap; output: ReadonlyArray; getSource: () => Buffer; unstable_transformResultKey?: null | undefined | string; }>; export type Dependencies = Map>; export type ReadOnlyDependencies = ReadonlyMap>; export type TransformInputOptions = Omit; export type GraphInputOptions = Readonly<{ entryPoints: ReadonlySet; transformOptions: TransformInputOptions; }>; export interface ReadOnlyGraph { readonly entryPoints: ReadonlySet; readonly transformOptions: Readonly; readonly dependencies: ReadOnlyDependencies; } export type {Graph}; export type TransformResult = Readonly<{ dependencies: ReadonlyArray; output: ReadonlyArray; unstable_transformResultKey?: null | undefined | string; }>; export type TransformResultWithSource = Readonly, 'getSource'> & {getSource: () => Buffer}>; export type TransformFn = ($$PARAM_0$$: string, $$PARAM_1$$: null | undefined | RequireContext) => Promise>; export type ResolveFn = (from: string, dependency: TransformResultDependency) => BundlerResolution; export type AllowOptionalDependenciesWithOptions = { readonly exclude: Array; }; export type AllowOptionalDependencies = boolean | AllowOptionalDependenciesWithOptions; export type BundlerResolution = Readonly<{ type: 'sourceFile'; filePath: string; }>; export type Options = Readonly<{ resolve: ResolveFn; transform: TransformFn; transformOptions: TransformInputOptions; onProgress: null | undefined | ((numProcessed: number, total: number) => unknown); lazy: boolean; unstable_allowRequireContext: boolean; unstable_enablePackageExports: boolean; unstable_incrementalResolution: boolean; shallow: boolean; }>; export type DeltaResult = { readonly added: Map>; readonly modified: Map>; readonly deleted: Set; readonly reset: boolean; }; export type SerializerOptions = Readonly<{ asyncRequireModulePath: string; createModuleId: (absolutePath: string) => number; dependencyMapReservedName?: null | undefined | string; dev: boolean; getRunModuleStatement: (moduleId: number | string, globalPrefix: string) => string; globalPrefix: string; includeAsyncPaths: boolean; inlineSourceMap?: null | undefined | boolean; modulesOnly: boolean; processModuleFilter: (module: Module) => boolean; projectRoot: string; runBeforeMainModule: ReadonlyArray; runModule: boolean; serverRoot: string; shouldAddToIgnoreList: (module: Module) => boolean; sourceMapUrl?: null | undefined | string; sourceUrl?: null | undefined | string; getSourceUrl?: null | undefined | ((module: Module) => string); unstable_inlineDependencyMap?: boolean | undefined; unstable_getAsyncDependencyPath?: ((dependency: ResolvedDependency, options: unknown) => null | undefined | ReadonlyJsonData) | undefined; }>;