@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>;
|
|
@@ -14,5 +14,5 @@ export declare const asset: {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function getAssetContents(this: ICompiler, assetPath: string, rebaseFrom: string, calledOnLoad?: boolean): Promise<{
|
|
16
16
|
contents: string | Buffer;
|
|
17
|
-
loader: "copy" | "
|
|
17
|
+
loader: "copy" | "text" | "jsx";
|
|
18
18
|
}>;
|
|
@@ -35,9 +35,9 @@ module.exports = __toCommonJS(asset_exports);
|
|
|
35
35
|
var import_path = require("path");
|
|
36
36
|
var import_fs = __toESM(require("fs"));
|
|
37
37
|
var import_pluginutils = require("@rollup/pluginutils");
|
|
38
|
-
var import_core = require("
|
|
39
|
-
var import_plugin_svgo = __toESM(require("
|
|
40
|
-
var import_plugin_jsx = __toESM(require("
|
|
38
|
+
var import_core = require("../../../compiled/@svgr/core");
|
|
39
|
+
var import_plugin_svgo = __toESM(require("../../../compiled/@svgr/plugin-svgo"));
|
|
40
|
+
var import_plugin_jsx = __toESM(require("../../../compiled/@svgr/plugin-jsx"));
|
|
41
41
|
var import_file = require("../../constants/file");
|
|
42
42
|
var import_utils = require("../../utils");
|
|
43
43
|
const name = "asset";
|
|
@@ -7,19 +7,19 @@ export declare const npmComponentWithUmdPresetConfig: PartialBaseBuildConfig[];
|
|
|
7
7
|
export declare const libraryPreset: {
|
|
8
8
|
'npm-library': PartialBaseBuildConfig[];
|
|
9
9
|
};
|
|
10
|
-
export declare const libraryPresetWithTarget: Record<"npm-library-
|
|
10
|
+
export declare const libraryPresetWithTarget: Record<"npm-library-esnext" | "npm-library-es5" | "npm-library-es6" | "npm-library-es2015" | "npm-library-es2016" | "npm-library-es2017" | "npm-library-es2018" | "npm-library-es2019" | "npm-library-es2020" | "npm-library-es2021" | "npm-library-es2022", PartialBaseBuildConfig[]>;
|
|
11
11
|
export declare const libraryUmdPreset: {
|
|
12
12
|
'npm-library-with-umd': PartialBaseBuildConfig[];
|
|
13
13
|
};
|
|
14
|
-
export declare const libraryUmdPresetWithTarget: Record<"npm-library-with-umd-
|
|
14
|
+
export declare const libraryUmdPresetWithTarget: Record<"npm-library-with-umd-esnext" | "npm-library-with-umd-es5" | "npm-library-with-umd-es6" | "npm-library-with-umd-es2015" | "npm-library-with-umd-es2016" | "npm-library-with-umd-es2017" | "npm-library-with-umd-es2018" | "npm-library-with-umd-es2019" | "npm-library-with-umd-es2020" | "npm-library-with-umd-es2021" | "npm-library-with-umd-es2022", PartialBaseBuildConfig[]>;
|
|
15
15
|
export declare const componentPreset: {
|
|
16
16
|
'npm-component': PartialBaseBuildConfig[];
|
|
17
17
|
};
|
|
18
|
-
export declare const componentPresetWithTarget: Record<"npm-component-
|
|
18
|
+
export declare const componentPresetWithTarget: Record<"npm-component-esnext" | "npm-component-es5" | "npm-component-es6" | "npm-component-es2015" | "npm-component-es2016" | "npm-component-es2017" | "npm-component-es2018" | "npm-component-es2019" | "npm-component-es2020" | "npm-component-es2021" | "npm-component-es2022", PartialBaseBuildConfig[]>;
|
|
19
19
|
export declare const componentUmdPreset: {
|
|
20
20
|
'npm-component-with-umd': PartialBaseBuildConfig[];
|
|
21
21
|
};
|
|
22
|
-
export declare const componentUmdPresetWithTarget: Record<"npm-component-with-umd-
|
|
22
|
+
export declare const componentUmdPresetWithTarget: Record<"npm-component-with-umd-esnext" | "npm-component-with-umd-es5" | "npm-component-with-umd-es6" | "npm-component-with-umd-es2015" | "npm-component-with-umd-es2016" | "npm-component-with-umd-es2017" | "npm-component-with-umd-es2018" | "npm-component-with-umd-es2019" | "npm-component-with-umd-es2020" | "npm-component-with-umd-es2021" | "npm-component-with-umd-es2022", PartialBaseBuildConfig[]>;
|
|
23
23
|
export declare const nodeBuildConfig: PartialBaseBuildConfig[];
|
|
24
24
|
export declare const universalBuildConfig: PartialBaseBuildConfig[];
|
|
25
25
|
export declare const presetList: Record<string, PartialBaseBuildConfig[]>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BuildOptions } from 'esbuild';
|
|
2
2
|
import type { ImportItem } from '@modern-js/swc-plugins';
|
|
3
|
-
import type { Config } from '@svgr/core';
|
|
4
3
|
import type { CreateFilter } from '@rollup/pluginutils';
|
|
5
4
|
import type { MinifyOptions as TerserMinifyOptions } from 'terser';
|
|
6
5
|
import type { TestConfig } from '@modern-js/types';
|
|
6
|
+
import type { Config } from '../../../compiled/@svgr/core';
|
|
7
7
|
import { internalPreset, presetList } from '../../constants/preset';
|
|
8
8
|
import { ICompiler } from '../esbuild';
|
|
9
9
|
import type { CopyConfig } from './copy';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/module-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.45.0-beta.0",
|
|
4
4
|
"description": "Simple, powerful, high-performance modern npm package development solution.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modern",
|
|
@@ -47,12 +47,11 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@ampproject/remapping": "^2.2.1",
|
|
50
|
-
"@ast-grep/napi": "0.
|
|
50
|
+
"@ast-grep/napi": "0.16.0",
|
|
51
|
+
"@babel/core": "^7.23.2",
|
|
52
|
+
"@babel/types": "^7.23.2",
|
|
51
53
|
"@modern-js/swc-plugins": "0.6.6",
|
|
52
54
|
"@rollup/pluginutils": "4.1.1",
|
|
53
|
-
"@svgr/core": "8.1.0",
|
|
54
|
-
"@svgr/plugin-jsx": "8.1.0",
|
|
55
|
-
"@svgr/plugin-svgo": "8.1.0",
|
|
56
55
|
"@swc/helpers": "0.5.3",
|
|
57
56
|
"convert-source-map": "1.8.0",
|
|
58
57
|
"enhanced-resolve": "5.12.0",
|
|
@@ -67,24 +66,24 @@
|
|
|
67
66
|
"tapable": "2.2.1",
|
|
68
67
|
"terser": "5.19.2",
|
|
69
68
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
70
|
-
"@modern-js/core": "2.
|
|
71
|
-
"@modern-js/new-action": "2.
|
|
72
|
-
"@modern-js/plugin": "2.
|
|
73
|
-
"@modern-js/plugin-changeset": "2.
|
|
74
|
-
"@modern-js/plugin-i18n": "2.
|
|
75
|
-
"@modern-js/plugin-lint": "2.
|
|
76
|
-
"@modern-js/types": "2.
|
|
77
|
-
"@modern-js/upgrade": "2.
|
|
78
|
-
"@modern-js/utils": "2.
|
|
69
|
+
"@modern-js/core": "2.45.0",
|
|
70
|
+
"@modern-js/new-action": "2.45.0",
|
|
71
|
+
"@modern-js/plugin": "2.45.0",
|
|
72
|
+
"@modern-js/plugin-changeset": "2.45.0",
|
|
73
|
+
"@modern-js/plugin-i18n": "2.45.0",
|
|
74
|
+
"@modern-js/plugin-lint": "2.45.0",
|
|
75
|
+
"@modern-js/types": "2.45.0",
|
|
76
|
+
"@modern-js/upgrade": "2.45.0",
|
|
77
|
+
"@modern-js/utils": "2.45.0"
|
|
79
78
|
},
|
|
80
79
|
"devDependencies": {
|
|
81
80
|
"@types/convert-source-map": "1.5.2",
|
|
82
81
|
"@types/node": "^14",
|
|
83
82
|
"typescript": "^5",
|
|
84
|
-
"@modern-js/builder-webpack-provider": "2.
|
|
85
|
-
"@
|
|
86
|
-
"@
|
|
87
|
-
"@scripts/vitest-config": "2.
|
|
83
|
+
"@modern-js/builder-webpack-provider": "2.45.0",
|
|
84
|
+
"@modern-js/self": "npm:@modern-js/module-tools@2.45.0-beta.0",
|
|
85
|
+
"@scripts/build": "2.45.0",
|
|
86
|
+
"@scripts/vitest-config": "2.45.0"
|
|
88
87
|
},
|
|
89
88
|
"peerDependencies": {
|
|
90
89
|
"typescript": "^4 || ^5"
|