summaryrefslogtreecommitdiff
path: root/node_modules/svgo/lib/svgo.d.ts
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:05:55 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:05:55 +0800
commitc06f7ee0a40255214c477e13d9b956a7e07c2900 (patch)
treef5982a568ef8fab865d0142e71c7494fea3e4c1b /node_modules/svgo/lib/svgo.d.ts
parent3fd9400d4dccc25aa29b5702216732e0b7542073 (diff)
postcss,(plugins): nanocss, postcss-preset-env
Diffstat (limited to 'node_modules/svgo/lib/svgo.d.ts')
-rw-r--r--node_modules/svgo/lib/svgo.d.ts66
1 files changed, 66 insertions, 0 deletions
diff --git a/node_modules/svgo/lib/svgo.d.ts b/node_modules/svgo/lib/svgo.d.ts
new file mode 100644
index 00000000..a042db6c
--- /dev/null
+++ b/node_modules/svgo/lib/svgo.d.ts
@@ -0,0 +1,66 @@
+import type { StringifyOptions, DataUri, Plugin as PluginFn } from './types';
+import type {
+ BuiltinsWithOptionalParams,
+ BuiltinsWithRequiredParams,
+} from '../plugins/plugins-types';
+
+type CustomPlugin = {
+ name: string;
+ fn: PluginFn<void>;
+};
+
+type PluginConfig =
+ | keyof BuiltinsWithOptionalParams
+ | {
+ [Name in keyof BuiltinsWithOptionalParams]: {
+ name: Name;
+ params?: BuiltinsWithOptionalParams[Name];
+ };
+ }[keyof BuiltinsWithOptionalParams]
+ | {
+ [Name in keyof BuiltinsWithRequiredParams]: {
+ name: Name;
+ params: BuiltinsWithRequiredParams[Name];
+ };
+ }[keyof BuiltinsWithRequiredParams]
+ | CustomPlugin;
+
+export type Config = {
+ /** Can be used by plugins, for example prefixids */
+ path?: string;
+ /** Pass over SVGs multiple times to ensure all optimizations are applied. */
+ multipass?: boolean;
+ /** Precision of floating point numbers. Will be passed to each plugin that suppors this param. */
+ floatPrecision?: number;
+ /**
+ * Plugins configuration
+ * ['preset-default'] is default
+ * Can also specify any builtin plugin
+ * ['sortAttrs', { name: 'prefixIds', params: { prefix: 'my-prefix' } }]
+ * Or custom
+ * [{ name: 'myPlugin', fn: () => ({}) }]
+ */
+ plugins?: PluginConfig[];
+ /** Options for rendering optimized SVG from AST. */
+ js2svg?: StringifyOptions;
+ /** Output as Data URI string. */
+ datauri?: DataUri;
+};
+
+type Output = {
+ data: string;
+};
+
+/** The core of SVGO */
+export declare function optimize(input: string, config?: Config): Output;
+
+/**
+ * If you write a tool on top of svgo you might need a way to load svgo config.
+ *
+ * You can also specify relative or absolute path and customize current working directory.
+ */
+export declare function loadConfig(
+ configFile: string,
+ cwd?: string
+): Promise<Config>;
+export declare function loadConfig(): Promise<Config | null>;