vitepress-jsdoc
Version:
A bridge between Vitepress and JSDoc-style commented codebases for hassle-free documentation.
57 lines • 1.79 kB
TypeScript
import { type DirectoryFile, type ParserConfig } from '../interfaces.js';
/**
* @file This module provides utility functions for handling file paths.
*/
/**
* Retrieves the file name. If the file name is '\_\_index\_\_', it returns 'index'.
*
* @function
*
* @param {DirectoryFile} file - The file object to retrieve the name from.
*
* @returns {string} The name of the file.
*
* @example
*
* const file = {name: '__index__'};
* const name = getFileName(file); // 'index'
*/
export declare const getFileName: (file: DirectoryFile) => string;
/**
* Retrieves the folder of the file.
*
* @function
*
* @param {DirectoryFile} file - The file object to retrieve the folder from.
*
* @returns {string} The folder of the file.
*
* @example
*
* const file = {folder: '/src/components'};
* const folder = getFileFolder(file); // '/src/components'
*/
export declare const getFileFolder: (file: DirectoryFile) => string;
/**
* Computes the relative destination path and the absolute folder path in the destination directory.
*
* @function
*
* @param {DirectoryFile} file - The file object to compute paths for.
* @param {ParserConfig} config - The configuration object containing source and documentation folders.
*
* @returns {object} An object containing:
* - relativePathDest: The relative path in the destination directory.
* - folderInDest: The absolute path of the folder in the destination directory.
*
* @example
*
* const file = {folder: '/src/components'};
* const config = {srcFolder: '/src', docsFolder: '/docs'};
* const paths = computePaths(file, config);
*/
export declare const computePaths: (file: DirectoryFile, config: ParserConfig) => {
relativePathDest: string;
folderInDest: string;
};
//# sourceMappingURL=file-path.d.ts.map