UNPKG

@alleyinteractive/build-tool

Version:

An opinionated set of build configurations for wp-scripts

31 lines 1.78 kB
import { type PathData } from 'webpack'; type DirectorySrcName = 'name' | 'runtime'; /** * Get the entry points from a directory. * * @param entryDirName - The name of the directory to get entries from. * @returns An object of entries. */ declare function getEntries(entryDirName: string): object; /** * Process the filename and chunkFilename for Webpack output and MiniCssExtractPlugin. * This reusable function dynamically generates filenames based on the provided `pathData`, * a flag to determine whether to set the filename as 'index', the file extension (`ext`), * and a parameter to explicitly specify whether to use 'runtime' or 'name' as the dirname source. * * For non-entries entries, it returns a filename in the format '[name].[ext]'. * For entries, it constructs a filename with the directory name (stripping 'entries-') * and appends '/index' or '/[name]' (if a name is present) followed by the file extension. * * @param pathData - The path data object provided by Webpack. * @param setAsIndex - A flag to determine whether to set the filename as 'index' * when processing entries. Pass `true` to use 'index' or `false` * to use '[name]'. * @param ext - The file extension to be used for the output filename. * @param dirnameSource - The pathData.chunk prop to set the directory name. * 'runtime' or 'name'. Defaults to 'name' if not provided. * @returns The generated filename. */ declare function processFilename(pathData: PathData, setAsIndex: boolean, ext: string, dirnameSource?: DirectorySrcName): string; export { getEntries, processFilename, }; //# sourceMappingURL=webpack.d.ts.map