UNPKG

kist

Version:

Package Pipeline Processor

69 lines (68 loc) 2.59 kB
import { Action } from "../../core/pipeline/Action"; import { ActionOptionsType } from "../../types/ActionOptionsType"; /** * SvgPackagerAction is responsible for optimizing and packaging SVG files. * It reads SVG files from a specified directory, optimizes them using SVGO, * and then outputs them as TypeScript files and JSON indexes. */ export declare class SvgPackagerAction extends Action { /** * Executes the SVG processing action. * @param options - The options specifying input and output directories. * @returns A Promise that resolves when the action completes successfully. */ execute(options: ActionOptionsType): Promise<void>; /** * Reads the content of an SVG file. * @param filePath The path to the SVG file. * @returns The content of the SVG file. */ private readSvgFile; /** * Sanitizes a file name to be a valid TypeScript identifier. * @param fileName The original file name. * @returns A sanitized version of the file name. */ private sanitizeFileName; /** * Optimizes SVG content using SVGO. * @param svgoConfigPath Path to the SVGO configuration file. * @param svgContent The raw SVG content. * @returns The optimized SVG content. */ private optimizeSvg; /** * Writes optimized SVG content to files (SVG & TypeScript). * @param iconName The name of the icon. * @param svgContent The optimized SVG content. * @param outputDirectory The directory for SVG output. * @param tsOutputDirectory The directory for TypeScript output. */ private writeFiles; /** * Writes the optimized SVG content to an output file. * @param iconName The name of the icon. * @param svgContent The SVG content to be written. * @param outputDirectory The directory to output the SVG file. */ private writeSvgFile; /** * Creates a TypeScript file from the optimized SVG content. * @param iconName The name of the icon. * @param svgContent The optimized SVG content. * @param tsOutputDirectory The directory for TypeScript output. */ private writeTypeScriptFile; /** * Writes a JSON file containing the names of processed icons. * @param iconNames An array of processed icon names. * @param jsonOutputDirectory The directory to output the JSON file. */ private writeIconsJson; /** * Provides a description of the action. * @returns A string description of the action. */ describe(): string; } export default SvgPackagerAction;