import type { IFileSystem } from '@file-services/types'; export declare const replaceWinSlashes: (str: string) => string; export declare const formatToOSpaths: (str: string) => string; export interface AdjustRelativeImportPathArgs { importPath: string; sourceFilePath: string; targetFilePath: string; targetPackageJsonPath: string | undefined; fs: IFileSystem; } export interface CreateImportPathArgs { importedFilePath: string; targetFilePath: string; targetPackageJsonPath: string | undefined; fs: IFileSystem; } export declare function isRelativeModulePath(path: string): boolean; export declare function isRelativeModuleRequest(request: string): boolean; export declare function addRelativePrefix(path: string): string; /** * @param filePath - full posix path of the file which about to import from `modulePath` * @param modulePath - full posix path of the imported module * @returns the relative posix path from `filePath` to `modulePath` */ export declare function rebaseRelativeModulePath(filePath: string, modulePath: string): string; export declare function getRelativeModulePath(sourceAbsFilePath: string, targetAbsFilePath: string): string; /** * Creates relative import path for a file, stripping extension from JS/TS files. * * @param sourceFilePath - the file path of the component source code to be modified by new import lines * @param filePathToImport - the file path to be imported into the source file */ export declare function getRelativeImportPath(sourceFilePath: string, filePathToImport: string): string; /** * Creates bare import specifier for an absolute import path, stripping extension from JS/TS files. * * @param absoluteImportPath - an absolute import path * @param packageJsonPath - package.json file path * @param packageJsonName - package name */ export declare function getBareImportSpecifier(absoluteImportPath: string, packageJsonPath: string, packageJsonName: string): string; /** * Returns relative import path if imported and target files are in the same package, otherwise returns a bare import specifier. * * @param importedFilePath - an absolute path of imported file * @param targetFilePath - an absolute path of the file to which import will be added * @param targetPackageJsonPath - absolute file path to the target package.json * @param fs - file system */ export declare function createImportPath({ importedFilePath, targetFilePath, targetPackageJsonPath, fs, }: CreateImportPathArgs): string; /** * Checks if a path is equal to or subpath of a given base path. */ export declare function isSubPath(path: string, basePath: string, fs: IFileSystem): boolean; /** * prefix for file requests in Language server protocol */ export declare const fileRequestPrefix = "file://"; /** * @param currentPath - absolute path to yield parent directory path from */ export declare function pathChainToRoot(currentPath: string): Generator; /** * Safely checks if a path contains a directory name. * @param filePath - absolute path to a file * @param directoryName - directory to check if included as dir inside the file path * @returns boolean indicating if filePath includes directoryName */ export declare function isPathIncludesDir(filePath: string, directoryName: string): boolean; export declare function isWindowsStyleAbsolutePath(fsPath: string): boolean; /** * Returns file extension from the first occurrence of the ".", * unlike path.extname() which returns from the last occurrence. * @example * ```ts * getFullExtname('/dir/my-component.st.css') // => '.st.css' * ``` */ export declare function getFullExtname(filePath: string): string; export declare function getImportPath(filePath: string): string; export declare const isJsonFile: (filePath: string) => boolean; export declare const isTypeScriptFile: (filePath: string) => boolean; export declare const isJavaScriptFile: (filePath: string) => boolean; export declare const isDirPath: (filePath: string) => boolean; export declare const isTypeAffectingFileOrDir: (filePath: string) => boolean; export declare const isTsOrJS: (filePath: string) => boolean; export declare const getDTSPath: (filePath: string) => string; //# sourceMappingURL=filepath.d.ts.map