@expo/metro-config
Version:
A Metro config for running React Native projects with the Metro bundler
41 lines (40 loc) • 1.87 kB
TypeScript
/**
* Copyright © 2022 650 Industries.
* 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.
*
* Fork with bundle splitting and better source map support.
* https://github.com/facebook/metro/blob/bbdd7d7c5e6e0feb50a9967ffae1f723c1d7c4e8/packages/metro/src/DeltaBundler/Serializers/baseJSBundle.js#L1
*/
import type { MixedOutput, Module, ReadOnlyGraph, SerializerOptions } from 'metro';
export type ModuleMap = [number, string][];
export type Bundle = {
modules: ModuleMap;
post: string;
pre: string;
paths: Record<string, Record<string, string>>;
};
export type ExpoSerializerOptions = SerializerOptions & {
serializerOptions?: {
baseUrl?: string;
skipWrapping?: boolean;
usedExports?: boolean;
splitChunks?: boolean;
output?: string;
includeSourceMaps?: boolean;
};
debugId?: string;
};
export declare function getPlatformOption(graph: Pick<ReadOnlyGraph, 'transformOptions'>, options: Pick<SerializerOptions, 'sourceUrl'>): string | null;
export declare function getBaseUrlOption(graph: Pick<ReadOnlyGraph, 'transformOptions'>, options: Pick<ExpoSerializerOptions, 'serializerOptions'>): string;
export declare function baseJSBundle(entryPoint: string, preModules: readonly Module[], graph: Pick<ReadOnlyGraph, 'dependencies' | 'transformOptions'>, options: ExpoSerializerOptions): Bundle;
export declare function baseJSBundleWithDependencies(entryPoint: string, preModules: readonly Module[], dependencies: Module<MixedOutput>[], options: ExpoSerializerOptions & {
platform: string;
baseUrl: string;
splitChunks: boolean;
skipWrapping: boolean;
computedAsyncModulePaths: Record<string, string> | null;
debugId?: string;
}): Bundle;