/** * 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<> * * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js * Original file: packages/metro/src/lib/dynamicRoots.js * To regenerate, run: * js1 build metro-ts-defs (internal) OR * yarn run build-ts-defs (OSS) */ import type {FileMapRoot} from 'metro-file-map'; /** * The number of hex digits in a dynamic root id. A `watchFolders` index never * has this many digits (`RootUrlMap` ensures it), so a URL path segment * of this length is always an id. */ export declare const DYNAMIC_ROOT_ID_LENGTH: 8; export declare type DYNAMIC_ROOT_ID_LENGTH = typeof DYNAMIC_ROOT_ID_LENGTH; /** * A directory the file map holds that is neither `projectRoot` nor one of the * configured `watchFolders`, having been added while Metro is running. */ export type DynamicRoot = Readonly<{id: string; rootDir: string}>; /** * The id of a dynamic root is a hash of its path relative to the project * root, with `/` separators. Unlike a `watchFolders` index, it does not depend * on which other roots exist or the order they were added in, and it is the * same on any machine or OS with the same layout, so a URL containing it (and * any cache key derived from one) is portable. * * `rootRelativePath` is in metro-file-map's relative form, which reaches a * root on another Windows drive as if the drive were a top-level directory, * e.g. `..\..\D:\store`. */ export declare function getDynamicRootId(rootRelativePath: string): string; /** * The dynamic roots among all of the file map's roots. They are ordered so * that a root always precedes any root nested within it, and the order depends * only on the set of roots. * * Throws if two roots have the same id, which would otherwise make URLs in one * of them resolve to files in the other. */ export declare function getDynamicRoots(fileMapRoots: ReadonlyArray): ReadonlyArray;