Comparing version 0.0.19 to 0.0.20
import { Config } from 'svgo'; | ||
export { Config as SvgoConfig } from 'svgo'; | ||
interface IFileArgs { | ||
extension: string; | ||
interface IWriter { | ||
/** | ||
* The full directory path such as '/home/user/dir' or 'c:\path\dir' | ||
*/ | ||
dir: string; | ||
/** | ||
* The file name without extension (if any) such as 'index' | ||
*/ | ||
name: string; | ||
/** | ||
* The extension of the file such as '.html' if any | ||
*/ | ||
ext: string; | ||
/** | ||
* The full path to the file | ||
*/ | ||
path: string; | ||
content?: string; | ||
content: string; | ||
write: () => Promise<WriterReport>; | ||
} | ||
interface IFile extends IFileArgs { | ||
fullPath: string; | ||
fullFilePath: string; | ||
write: () => Promise<IFileWriteReport>; | ||
} | ||
interface IFileWriteReport { | ||
status: FileWriteStatus; | ||
path: string; | ||
type WriterReport<TWriter extends IWriter = IWriter> = { | ||
status: "success" | "error"; | ||
writer: TWriter; | ||
message?: string; | ||
detail?: unknown; | ||
file: IFile; | ||
} | ||
declare enum FileWriteStatus { | ||
"success" = 0, | ||
"error" = 1 | ||
} | ||
declare class File implements IFile { | ||
extension: string; | ||
name: string; | ||
path: string; | ||
content: string; | ||
constructor(args: IFileArgs); | ||
get fullPath(): string; | ||
get fullFilePath(): string; | ||
get basename(): string; | ||
relPathTo(file: File, extension?: boolean): string; | ||
write(): Promise<{ | ||
status: FileWriteStatus; | ||
path: string; | ||
file: File; | ||
message?: undefined; | ||
detail?: undefined; | ||
} | { | ||
status: FileWriteStatus; | ||
path: string; | ||
message: string; | ||
detail: unknown; | ||
file: File; | ||
}>; | ||
private prettify; | ||
} | ||
}; | ||
@@ -89,2 +68,22 @@ type UserConfig = { | ||
declare class File implements IWriter { | ||
ext: string; | ||
name: string; | ||
dir: string; | ||
content: string; | ||
path: string; | ||
constructor(args: { | ||
name: string; | ||
ext: string; | ||
dir: string; | ||
content?: string; | ||
}); | ||
get resolvedDir(): string; | ||
get resoledPath(): string; | ||
get basename(): string; | ||
relPathTo(file: File, extension?: boolean): string; | ||
write(): Promise<WriterReport<File>>; | ||
private prettify; | ||
} | ||
declare class TokenHandler implements ISvgHandler { | ||
@@ -95,3 +94,3 @@ private readonly mConfig; | ||
constructor(mConfig: ModuleConfig); | ||
onFile(file: IFile): IFile; | ||
onFile(file: IWriter): IWriter; | ||
onEnd(ctx: Context): File[]; | ||
@@ -108,3 +107,3 @@ getContent({ type }: Context): string; | ||
get values(): string; | ||
onFile(svg: IFile): IFile; | ||
onFile(svg: IWriter): IWriter; | ||
onEnd(_: Context): File[]; | ||
@@ -115,4 +114,4 @@ } | ||
config?: Config; | ||
onFile?: (svgFile: File) => IFile | void; | ||
onEnd?: (context: Context) => IFile[] | void; | ||
onFile?: (svgFile: File) => IWriter | void; | ||
onEnd?: (context: Context) => IWriter[] | void; | ||
} | ||
@@ -164,2 +163,2 @@ type Context = { | ||
export { type CreateHandler, CssMaskHandler, File, type IFile, type ModuleConfig, TokenHandler, TypeHandler, VueCssMaskHandler, VueInlineHandler, defineConfig }; | ||
export { type CreateHandler, CssMaskHandler, File, type IWriter, type ModuleConfig, TokenHandler, TypeHandler, VueCssMaskHandler, VueInlineHandler, defineConfig }; |
{ | ||
"name": "svgpipe", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "A flexible CLI tool around svgo for further postprocessing.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -113,3 +113,3 @@ # Svgpipe | ||
Will be called with the `Context` after all SVGs are processed. Return nothing or `IFile[]` with additional files that you want to write to disk. `Context` provides a type handler that creates a TypeScript type file for the module and a corresponding token handler. | ||
Will be called with the `Context` after all SVGs are processed. Return nothing or `IWriter[]` with additional files that you want to write to disk. `Context` provides a type handler that creates a TypeScript type file for the module and a corresponding token handler. | ||
@@ -116,0 +116,0 @@ ### `config` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58878
1440
1