import type { AbsolutePath } from '@-xun/fs'; import type { Options as AccumulatorOptions } from 'babel-plugin-metadata-accumulator'; import type { ParametersNoFirst, SyncVersionOf } from "../../../common/src/types.js"; /** * An entry mapping an absolute file path to a single import/require specifier * present in said file. This specifier may or may not form part of a type-only * import. */ export type ImportSpecifier = [filepath: AbsolutePath, specifier: string]; /** * An entry mapping an absolute file path to two sets of import/require * specifiers present in said file: "normal" imports and "type-only" imports. * * @see {@link gatherImportEntriesFromFiles} */ export type ImportSpecifiersEntry = [filepath: AbsolutePath, specifiers: { normal: Set; typeOnly: Set; }]; /** * @see {@link gatherImportEntriesFromFiles} */ export type GatherImportEntriesFromFilesOptions = AccumulatorOptions & { /** * Use the internal cached result from a previous run, if available. * * **WARNING: the results returned by this function, while functionally * identical to each other, will _NOT_ strictly equal (`===`) each other.** * However, each {@link ImportSpecifiersEntry} tuple within the returned * results _will_ strictly equal each other, respectively. * * @see {@link cache} */ useCached: boolean; }; declare function gatherImportEntriesFromFiles_(shouldRunSynchronously: false, files: AbsolutePath[], options: GatherImportEntriesFromFilesOptions): Promise; declare function gatherImportEntriesFromFiles_(shouldRunSynchronously: true, files: AbsolutePath[], options: GatherImportEntriesFromFilesOptions): ImportSpecifiersEntry[]; /** * Accepts zero or more file paths and asynchronously returns an array of * {@link ImportSpecifiersEntry}s each mapping a given file path to an array of * import/require specifiers present in said file. * * This function relies on Babel internally and ignores all configuration files. * All paths passed to this function that cannot be parsed as TSX/TS/JS (via * extension check) will be treated as if they have 0 imports. * * **NOTE: the result of this function is memoized! This does NOT _necessarily_ * mean results will strictly equal each other. See `useCached` in this specific * function's options for details.** To fetch fresh results, set the `useCached` * option to `false` or clear the internal cache with {@link cache.clear}. */ export declare function gatherImportEntriesFromFiles(...args: ParametersNoFirst): Promise; export declare namespace gatherImportEntriesFromFiles { /** * Accepts zero or more file paths and synchronously returns an array of * {@link ImportSpecifiersEntry}s each mapping a given file path to an array * of import/require specifiers present in said file. * * This function relies on Babel internally and ignores all configuration * files. All paths passed to this function that cannot be parsed as TSX/TS/JS * (via extension check) will be treated as if they have 0 imports. * * **NOTE: the result of this function is memoized! This does NOT * _necessarily_ mean results will strictly equal each other. See `useCached` * in this specific function's options for details.** To fetch fresh results, * set the `useCached` option to `false` or clear the internal cache with * {@link cache.clear}. */ const sync: SyncVersionOf; } export {};