UNPKG

@datadog/mobile-react-native

Version:

A client-side React Native module to interact with Datadog

87 lines 4.62 kB
import type baseJSBundle from 'metro/private/DeltaBundler/Serializers/baseJSBundle'; import type sourceMapString from 'metro/private/DeltaBundler/Serializers/sourceMapString'; import type bundleToString from 'metro/private/lib/bundleToString'; import type countLines from 'metro/private/lib/countLines'; import type CountingSet from 'metro/src/lib/CountingSet'; import type { ReadOnlyGraph, Module, MixedOutput } from 'metro'; import type { DefaultConfigOptions } from './types/expoTypes'; import type { MetroSerializerOutput, MetroBundleWithMap } from './types/metroTypes'; /** * Safely loads and returns the `baseJSBundle` function from Metro's internal modules. * Supports multiple Metro versions with different internal paths. */ export declare const getBaseJSBundleFunction: () => typeof baseJSBundle; /** * Safely loads and returns the `countLines` function from Metro's internal modules. * Supports multiple Metro versions with different internal paths. */ export declare const getCountLinesFunction: () => typeof countLines; /** * Safely loads and returns the `bundleToString` function from Metro's internal modules. * Supports multiple Metro versions with different internal paths. */ export declare const getBundleToStringFunction: () => typeof bundleToString; /** * CountingSet was added in Metro 0.71.2 - a modified `Set` that only deletes items when the * number of `delete(item)` calls matches the number of `add(item)` calls. * * https://github.com/facebook/metro/commit/fc29a1177f883144674cf85a813b58567f69d545 */ export declare const getCreateCountingSetFunction: () => () => CountingSet<string>; /** * In Metro versions prior to v0.80.10, `sourceMapString` was exported as a default export. * Starting with v0.80.10, it became a named export. * * @returns The resolved `sourceMapString` function, of type {@link sourceMapString} */ export declare const getSourceMapStringFunction: () => typeof sourceMapString; /** * This function ensures that modules in source maps are sorted in the same * order as in a plain JS bundle. * * https://github.com/facebook/metro/blob/76413561abb3757285e0cb0305f1f9f616fa2b6c/packages/metro/src/Server.js#L1086C1-L1095C7 */ export declare function getSortedModules(graph: ReadOnlyGraph, { createModuleId }: { createModuleId: (file: string) => number; }): readonly Module<MixedOutput>[]; /** * Converts the serializer result of type {@link MetroSerializerOutput} to {@link MetroBundleWithMap}. */ export declare const convertSerializerOutput: (output: MetroSerializerOutput) => Promise<MetroBundleWithMap>; /** * Gets the default Expo configuration options. */ export declare const getDefaultExpoConfig: (projectRoot: string, options: DefaultConfigOptions) => DefaultConfigOptions; /** * Safely requires a module from multiple possible paths, returning its default export if found. * Caches the result to avoid redundant requires. * Useful for supporting multiple Metro versions with different internal paths. * @param modulePaths The list of possible module paths to try. * @returns the default export of the first successfully required module. * @throws if none of the module paths could be resolved. */ export declare const lazyRequireDefaultExport: <T>(modulePaths: string[]) => T; /** * Safely requires a module from multiple possible paths, returning its default export if found. * Caches the result to avoid redundant requires. * Useful for supporting multiple Metro versions with different internal paths. * @param modulePaths The list of possible module paths to try. * @returns the default export of the first successfully required module, or `undefined` if none could be resolved. */ export declare const safeLazyRequireDefaultExport: <T>(modulePaths: string[]) => T | undefined; /** * Safely requires a module from multiple possible paths, returning its default export if found. * Useful for supporting multiple Metro versions with different internal paths. * @param modulePaths The list of possible module paths to try. * @returns the default export of the first successfully required module, or `undefined` if none could be resolved. */ export declare function safeRequireDefaultExport<T>(modulePaths: string[]): T | undefined; /** * Safely extracts the default export from a module, if it exists. * Useful for supporting both CommonJS and ESM-syntax exports. * Supports upcoming Metro v0.83.2 https://github.com/facebook/metro/commit/5d301d7177af455fc6a94a0ba464639677cdf4b4. */ export declare function getDefaultExport<T>(module: { default: T; } | T): T | undefined; //# sourceMappingURL=utils.d.ts.map