@modern-js/module-tools 2.44.0 → 2.45.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/@svgr/core/dist/index.d.ts +78 -0
- package/compiled/@svgr/core/index.js +1 -0
- package/compiled/@svgr/core/license +7 -0
- package/compiled/@svgr/core/package.json +1 -0
- package/compiled/@svgr/core/prettier/index.d.ts +920 -0
- package/compiled/@svgr/core/svgo/lib/svgo.d.ts +66 -0
- package/compiled/@svgr/plugin-jsx/@svgr/core/dist/index.d.ts +78 -0
- package/compiled/@svgr/plugin-jsx/dist/index.d.ts +5 -0
- package/compiled/@svgr/plugin-jsx/index.js +11 -0
- package/compiled/@svgr/plugin-jsx/license +7 -0
- package/compiled/@svgr/plugin-jsx/package.json +1 -0
- package/compiled/@svgr/plugin-jsx/prettier/index.d.ts +920 -0
- package/compiled/@svgr/plugin-jsx/svgo/lib/svgo.d.ts +66 -0
- package/compiled/@svgr/plugin-svgo/@svgr/core/dist/index.d.ts +78 -0
- package/compiled/@svgr/plugin-svgo/dist/index.d.ts +5 -0
- package/compiled/@svgr/plugin-svgo/index.js +1 -0
- package/compiled/@svgr/plugin-svgo/license +7 -0
- package/compiled/@svgr/plugin-svgo/package.json +1 -0
- package/compiled/@svgr/plugin-svgo/prettier/index.d.ts +920 -0
- package/compiled/@svgr/plugin-svgo/svgo/lib/svgo.d.ts +66 -0
- package/dist/builder/feature/asset.d.ts +1 -1
- package/dist/builder/feature/asset.js +3 -3
- package/dist/constants/preset.d.ts +4 -4
- package/dist/types/config/index.d.ts +1 -1
- package/package.json +17 -18
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { StringifyOptions, DataUri, Plugin as PluginFn } from './types';
|
|
2
|
+
import type {
|
|
3
|
+
BuiltinsWithOptionalParams,
|
|
4
|
+
BuiltinsWithRequiredParams,
|
|
5
|
+
} from '../plugins/plugins-types';
|
|
6
|
+
|
|
7
|
+
type CustomPlugin = {
|
|
8
|
+
name: string;
|
|
9
|
+
fn: PluginFn<void>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type PluginConfig =
|
|
13
|
+
| keyof BuiltinsWithOptionalParams
|
|
14
|
+
| {
|
|
15
|
+
[Name in keyof BuiltinsWithOptionalParams]: {
|
|
16
|
+
name: Name;
|
|
17
|
+
params?: BuiltinsWithOptionalParams[Name];
|
|
18
|
+
};
|
|
19
|
+
}[keyof BuiltinsWithOptionalParams]
|
|
20
|
+
| {
|
|
21
|
+
[Name in keyof BuiltinsWithRequiredParams]: {
|
|
22
|
+
name: Name;
|
|
23
|
+
params: BuiltinsWithRequiredParams[Name];
|
|
24
|
+
};
|
|
25
|
+
}[keyof BuiltinsWithRequiredParams]
|
|
26
|
+
| CustomPlugin;
|
|
27
|
+
|
|
28
|
+
export type Config = {
|
|
29
|
+
/** Can be used by plugins, for example prefixids */
|
|
30
|
+
path?: string;
|
|
31
|
+
/** Pass over SVGs multiple times to ensure all optimizations are applied. */
|
|
32
|
+
multipass?: boolean;
|
|
33
|
+
/** Precision of floating point numbers. Will be passed to each plugin that suppors this param. */
|
|
34
|
+
floatPrecision?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Plugins configuration
|
|
37
|
+
* ['preset-default'] is default
|
|
38
|
+
* Can also specify any builtin plugin
|
|
39
|
+
* ['sortAttrs', { name: 'prefixIds', params: { prefix: 'my-prefix' } }]
|
|
40
|
+
* Or custom
|
|
41
|
+
* [{ name: 'myPlugin', fn: () => ({}) }]
|
|
42
|
+
*/
|
|
43
|
+
plugins?: PluginConfig[];
|
|
44
|
+
/** Options for rendering optimized SVG from AST. */
|
|
45
|
+
js2svg?: StringifyOptions;
|
|
46
|
+
/** Output as Data URI string. */
|
|
47
|
+
datauri?: DataUri;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type Output = {
|
|
51
|
+
data: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** The core of SVGO */
|
|
55
|
+
export declare function optimize(input: string, config?: Config): Output;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* If you write a tool on top of svgo you might need a way to load svgo config.
|
|
59
|
+
*
|
|
60
|
+
* You can also specify relative or absolute path and customize current working directory.
|
|
61
|
+
*/
|
|
62
|
+
export declare function loadConfig(
|
|
63
|
+
configFile: string,
|
|
64
|
+
cwd?: string
|
|
65
|
+
): Promise<Config>;
|
|
66
|
+
export declare function loadConfig(): Promise<Config | null>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Options } from '../../prettier';
|
|
2
|
+
import { Config as Config$1 } from '../../svgo';
|
|
3
|
+
import { Options as Options$1 } from '../../@svgr/babel-preset';
|
|
4
|
+
import { TransformOptions } from '../../@babel/core';
|
|
5
|
+
|
|
6
|
+
interface State {
|
|
7
|
+
filePath?: string;
|
|
8
|
+
componentName: string;
|
|
9
|
+
caller?: {
|
|
10
|
+
name?: string;
|
|
11
|
+
previousExport?: string | null;
|
|
12
|
+
defaultPlugins?: ConfigPlugin[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface Plugin {
|
|
17
|
+
(code: string, config: Config, state: State): string;
|
|
18
|
+
}
|
|
19
|
+
type ConfigPlugin = string | Plugin;
|
|
20
|
+
|
|
21
|
+
interface Config {
|
|
22
|
+
ref?: boolean;
|
|
23
|
+
titleProp?: boolean;
|
|
24
|
+
descProp?: boolean;
|
|
25
|
+
expandProps?: boolean | 'start' | 'end';
|
|
26
|
+
dimensions?: boolean;
|
|
27
|
+
icon?: boolean | string | number;
|
|
28
|
+
native?: boolean;
|
|
29
|
+
svgProps?: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
};
|
|
32
|
+
replaceAttrValues?: {
|
|
33
|
+
[key: string]: string;
|
|
34
|
+
};
|
|
35
|
+
runtimeConfig?: boolean;
|
|
36
|
+
typescript?: boolean;
|
|
37
|
+
prettier?: boolean;
|
|
38
|
+
prettierConfig?: Options;
|
|
39
|
+
svgo?: boolean;
|
|
40
|
+
svgoConfig?: Config$1;
|
|
41
|
+
configFile?: string;
|
|
42
|
+
template?: Options$1['template'];
|
|
43
|
+
memo?: boolean;
|
|
44
|
+
exportType?: 'named' | 'default';
|
|
45
|
+
namedExport?: string;
|
|
46
|
+
jsxRuntime?: 'classic' | 'classic-preact' | 'automatic';
|
|
47
|
+
jsxRuntimeImport?: {
|
|
48
|
+
source: string;
|
|
49
|
+
namespace?: string;
|
|
50
|
+
specifiers?: string[];
|
|
51
|
+
defaultSpecifier?: string;
|
|
52
|
+
};
|
|
53
|
+
index?: boolean;
|
|
54
|
+
plugins?: ConfigPlugin[];
|
|
55
|
+
jsx?: {
|
|
56
|
+
babelConfig?: TransformOptions;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
declare const DEFAULT_CONFIG: Config;
|
|
60
|
+
declare const resolveConfig: {
|
|
61
|
+
(searchFrom?: string, configFile?: string): Promise<Config | null>;
|
|
62
|
+
sync(searchFrom?: string, configFile?: string): Config | null;
|
|
63
|
+
};
|
|
64
|
+
declare const resolveConfigFile: {
|
|
65
|
+
(filePath: string): Promise<string | null>;
|
|
66
|
+
sync(filePath: string): string | null;
|
|
67
|
+
};
|
|
68
|
+
declare const loadConfig: {
|
|
69
|
+
({ configFile, ...baseConfig }: Config, state?: Pick<State, 'filePath'>): Promise<Config>;
|
|
70
|
+
sync({ configFile, ...baseConfig }: Config, state?: Pick<State, 'filePath'>): Config;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
declare const transform: {
|
|
74
|
+
(code: string, config?: Config, state?: Partial<State>): Promise<string>;
|
|
75
|
+
sync(code: string, config?: Config, state?: Partial<State>): string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export { Config, ConfigPlugin, DEFAULT_CONFIG, Plugin, State, loadConfig, resolveConfig, resolveConfigFile, transform };
|