@modern-js/module-tools 0.0.0-nightly-20240127170626 → 0.0.0-nightly-20240129170639
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.
|
@@ -34,6 +34,7 @@ __export(asset_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(asset_exports);
|
|
35
35
|
var import_path = require("path");
|
|
36
36
|
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_lodash = __toESM(require("@modern-js/utils/lodash"));
|
|
37
38
|
var import_pluginutils = require("@rollup/pluginutils");
|
|
38
39
|
var import_core = require("../../../compiled/@svgr/core");
|
|
39
40
|
var import_plugin_svgo = __toESM(require("../../../compiled/@svgr/plugin-svgo"));
|
|
@@ -67,6 +68,24 @@ const asset = {
|
|
|
67
68
|
function encodeSVG(buffer) {
|
|
68
69
|
return encodeURIComponent(buffer.toString("utf-8").replace(/[\n\r]/gim, "").replace(/\t/gim, " ").replace(/<!--(.*(?=-->))-->/gim, "").replace(/'/gim, "\\i")).replace(/\(/g, "%28").replace(/\)/g, "%29");
|
|
69
70
|
}
|
|
71
|
+
const getDefaultSVGRConfig = () => ({
|
|
72
|
+
svgo: true,
|
|
73
|
+
svgoConfig: {
|
|
74
|
+
plugins: [
|
|
75
|
+
{
|
|
76
|
+
name: "preset-default",
|
|
77
|
+
params: {
|
|
78
|
+
overrides: {
|
|
79
|
+
// viewBox is required to resize SVGs with CSS.
|
|
80
|
+
// @see https://github.com/svg/svgo/issues/1128
|
|
81
|
+
removeViewBox: false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"prefixIds"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
});
|
|
70
89
|
async function getAssetContents(assetPath, rebaseFrom, calledOnLoad) {
|
|
71
90
|
const fileContent = await import_fs.default.promises.readFile(assetPath);
|
|
72
91
|
const { buildType, format, outDir } = this.config;
|
|
@@ -80,7 +99,8 @@ async function getAssetContents(assetPath, rebaseFrom, calledOnLoad) {
|
|
|
80
99
|
let emitAsset = true;
|
|
81
100
|
let contents = normalizedPublicPath;
|
|
82
101
|
let loader = "text";
|
|
83
|
-
const
|
|
102
|
+
const defaultConfig = getDefaultSVGRConfig();
|
|
103
|
+
const config = typeof svgr === "boolean" ? defaultConfig : import_lodash.default.merge(defaultConfig, svgr);
|
|
84
104
|
const filter = (0, import_pluginutils.createFilter)(config.include || SVG_REGEXP, config.exclude);
|
|
85
105
|
if (svgr && filter(assetPath)) {
|
|
86
106
|
const previousExport = config.exportType === "named" ? `export default "${normalizedPublicPath}"` : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/module-tools",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20240129170639",
|
|
4
4
|
"description": "Simple, powerful, high-performance modern npm package development solution.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modern",
|
|
@@ -66,24 +66,24 @@
|
|
|
66
66
|
"tapable": "2.2.1",
|
|
67
67
|
"terser": "5.19.2",
|
|
68
68
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
69
|
-
"@modern-js/core": "0.0.0-nightly-
|
|
70
|
-
"@modern-js/
|
|
71
|
-
"@modern-js/
|
|
72
|
-
"@modern-js/plugin-changeset": "0.0.0-nightly-
|
|
73
|
-
"@modern-js/plugin-i18n": "0.0.0-nightly-
|
|
74
|
-
"@modern-js/
|
|
75
|
-
"@modern-js/
|
|
76
|
-
"@modern-js/upgrade": "0.0.0-nightly-
|
|
77
|
-
"@modern-js/utils": "0.0.0-nightly-
|
|
69
|
+
"@modern-js/core": "0.0.0-nightly-20240129170639",
|
|
70
|
+
"@modern-js/plugin": "0.0.0-nightly-20240129170639",
|
|
71
|
+
"@modern-js/new-action": "0.0.0-nightly-20240129170639",
|
|
72
|
+
"@modern-js/plugin-changeset": "0.0.0-nightly-20240129170639",
|
|
73
|
+
"@modern-js/plugin-i18n": "0.0.0-nightly-20240129170639",
|
|
74
|
+
"@modern-js/plugin-lint": "0.0.0-nightly-20240129170639",
|
|
75
|
+
"@modern-js/types": "0.0.0-nightly-20240129170639",
|
|
76
|
+
"@modern-js/upgrade": "0.0.0-nightly-20240129170639",
|
|
77
|
+
"@modern-js/utils": "0.0.0-nightly-20240129170639"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/convert-source-map": "1.5.2",
|
|
81
81
|
"@types/node": "^14",
|
|
82
82
|
"typescript": "^5",
|
|
83
|
-
"@modern-js/builder-webpack-provider": "0.0.0-nightly-
|
|
84
|
-
"@modern-js/self": "npm:@modern-js/module-tools@0.0.0-nightly-
|
|
85
|
-
"@scripts/build": "0.0.0-nightly-
|
|
86
|
-
"@scripts/vitest-config": "0.0.0-nightly-
|
|
83
|
+
"@modern-js/builder-webpack-provider": "0.0.0-nightly-20240129170639",
|
|
84
|
+
"@modern-js/self": "npm:@modern-js/module-tools@0.0.0-nightly-20240129170639",
|
|
85
|
+
"@scripts/build": "0.0.0-nightly-20240129170639",
|
|
86
|
+
"@scripts/vitest-config": "0.0.0-nightly-20240129170639"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"typescript": "^4 || ^5"
|