import { AbstractCtor } from '@flowr/types'; declare const VirtualPath = "::virtual::"; declare const ManuallyRegisteredPiecesSymbol: unique symbol; type Path = string | URL; declare function resolvePath(path: Path): string; /** * Represents the root data. */ interface RootData { /** * The root directory. */ root: string; /** * The type of the module system used. * It can be either 'ESM' or 'CommonJS'. */ type: 'ESM' | 'CommonJS'; } /** * Get the {@link RootData} of the current project. * @returns The root data */ declare const getRootData: () => RootData; /** * Retrieves the root data of the project. * * This function reads the `package.json` file in the current working directory and determines the root path and type * of the project. * * - If the `package.json` file is not found or cannot be parsed, it assumes the project is using CommonJS and * the current working directory is used as the root * * - If the project `type` is specified as `"commonjs"` or `"module"` in the `package.json`, it uses the corresponding * `main` or `module` file path as the root. * * - If there is no `main` or `module` then it uses the current working directory as the root, while retaining the * matching `CommonJS` or `ESM` based on the `type` * * - If the main or module file path is not specified, it uses the current working directory as the root. * * The following table shows how different situations resolve to different root data: * * | Fields | Resolved as | * |--------------------------|-------------| * | type=commonjs && main | CommonJS | * | type=commonjs && module | CommonJS | * | type=module && main | ESM | * | type=module && module | ESM | * | type=undefined && main | CommonJS | * | type=undefined && module | ESM | * | no package.json on cwd | CommonJS | * * @returns The root data object containing the root path and the type of the project. */ declare function parseRootData(): RootData; /** * Whether or not the current environment can load TypeScript files. These * conditions are based on the most common tools and runtimes that support * loading TypeScript files directly. * * - {@linkplain https://www.npmjs.com/package/ts-node | `ts-node`} * - {@linkplain https://www.npmjs.com/package/ts-node-dev | `ts-node-dev`} * - {@linkplain https://www.npmjs.com/package/@babel/node | `@babel/node`} * - {@linkplain https://www.npmjs.com/package/vitest | `vitest`} * - {@linkplain https://www.npmjs.com/package/jest | `jest`} * - {@linkplain https://www.npmjs.com/package/@swc/cli | `swc`} * - {@linkplain https://www.npmjs.com/package/tsm | `tsm`} * - {@linkplain https://www.npmjs.com/package/esbuild | `esbuild`} * - {@linkplain https://www.npmjs.com/package/tsx | `tsx + esno`} * - {@linkplain https://deno.com | `deno`} * - {@linkplain https://bun.sh | `bun`} */ declare const CanLoadTypeScriptFiles: boolean; /** * Determines whether or not a value is a class. * @param value The piece to be checked. * @private */ declare const isClass: (value: unknown) => value is AbstractCtor; /** * Checks whether or not the value class extends the base class. * @param value The constructor to be checked against. * @param base The base constructor. * @private */ declare function classExtends(value: AbstractCtor, base: T): value is T; export { CanLoadTypeScriptFiles, ManuallyRegisteredPiecesSymbol, type Path, type RootData, VirtualPath, classExtends, getRootData, isClass, parseRootData, resolvePath };