@plaudit/webpack-extensions 1.0.1 → 1.0.3
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.
|
@@ -10,6 +10,7 @@ const BlockJSONStyleRemappingPlugin_1 = __importDefault(require("./BlockJSONStyl
|
|
|
10
10
|
const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
|
|
11
11
|
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
12
12
|
const webpack_remove_empty_scripts_1 = __importDefault(require("webpack-remove-empty-scripts"));
|
|
13
|
+
const cssnano_1 = __importDefault(require("cssnano"));
|
|
13
14
|
function addEntryPointWithMapper(entrypoints, entrypoint, dir, mapper = (entrypoint) => entrypoint) {
|
|
14
15
|
for (const ep of Array.isArray(entrypoint) ? entrypoint : [entrypoint]) {
|
|
15
16
|
const mapped = node_path_1.default.join(dir, mapper(ep));
|
|
@@ -25,45 +26,50 @@ function default_1(config, webpackConfig = require("@wordpress/scripts/config/we
|
|
|
25
26
|
// Nano Config
|
|
26
27
|
// http://cssnano.co/guides/optimisations/ For the value to use click on one and then
|
|
27
28
|
const nanoConfig = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
preset: [
|
|
30
|
+
'cssnano-preset-default',
|
|
31
|
+
{
|
|
32
|
+
safe: true,
|
|
33
|
+
autoprefixer: false,
|
|
34
|
+
calc: false,
|
|
35
|
+
colormin: true,
|
|
36
|
+
convertValues: false,
|
|
37
|
+
discardComments: {
|
|
38
|
+
remove(comment) {
|
|
39
|
+
const commentKeepRegexp = /^!|@cms|@preserve|@cc_on|\bMIT\b|\bMPL\b|\bGPL\b|\bBSD\b|\bISCL\b|\(c\)|\bLicense\b|\bCopyright\b/i;
|
|
40
|
+
return !commentKeepRegexp.test(comment);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
discardDuplicates: true,
|
|
44
|
+
discardEmpty: true,
|
|
45
|
+
discardOverridden: true,
|
|
46
|
+
discardUnused: false,
|
|
47
|
+
mergeIdents: false,
|
|
48
|
+
mergeLonghand: true,
|
|
49
|
+
mergeRules: false,
|
|
50
|
+
minifyFontValues: true,
|
|
51
|
+
minifyGradients: true,
|
|
52
|
+
minifyParams: true,
|
|
53
|
+
minifySelectors: true,
|
|
54
|
+
normalizeCharset: true,
|
|
55
|
+
normalizeDisplayValues: true,
|
|
56
|
+
normalizePositions: true,
|
|
57
|
+
normalizeRepeatStyle: true,
|
|
58
|
+
normalizeString: true,
|
|
59
|
+
normalizeTimingFunctions: true,
|
|
60
|
+
normalizeUnicode: true,
|
|
61
|
+
normalizeUrl: true,
|
|
62
|
+
normalizeWhitespace: true,
|
|
63
|
+
orderedValues: true,
|
|
64
|
+
reduceIdents: false,
|
|
65
|
+
reduceInitial: true,
|
|
66
|
+
reduceTransforms: true,
|
|
67
|
+
svgo: false,
|
|
68
|
+
uniqueSelectors: true,
|
|
69
|
+
zindex: false,
|
|
70
|
+
filterPlugins: false // I don't know where this one came from. It is not listed in the documentation.
|
|
37
71
|
}
|
|
38
|
-
|
|
39
|
-
discardDuplicates: true,
|
|
40
|
-
discardEmpty: true,
|
|
41
|
-
discardOverridden: true,
|
|
42
|
-
discardUnused: false,
|
|
43
|
-
mergeIdents: false,
|
|
44
|
-
mergeLonghand: true,
|
|
45
|
-
mergeRules: false,
|
|
46
|
-
minifyFontValues: true,
|
|
47
|
-
minifyGradients: true,
|
|
48
|
-
minifyParams: true,
|
|
49
|
-
minifySelectors: true,
|
|
50
|
-
normalizeCharset: true,
|
|
51
|
-
normalizeDisplayValues: true,
|
|
52
|
-
normalizePositions: true,
|
|
53
|
-
normalizeRepeatStyle: true,
|
|
54
|
-
normalizeString: true,
|
|
55
|
-
normalizeTimingFunctions: true,
|
|
56
|
-
normalizeUnicode: true,
|
|
57
|
-
normalizeUrl: true,
|
|
58
|
-
normalizeWhitespace: true,
|
|
59
|
-
orderedValues: true,
|
|
60
|
-
reduceIdents: false,
|
|
61
|
-
reduceInitial: true,
|
|
62
|
-
reduceTransforms: true,
|
|
63
|
-
svgo: false,
|
|
64
|
-
uniqueSelectors: true,
|
|
65
|
-
zindex: false,
|
|
66
|
-
filterPlugins: false // I don't know where this one came from. It is not listed in the documentation.
|
|
72
|
+
]
|
|
67
73
|
};
|
|
68
74
|
const postcssLoader = require.resolve('postcss-loader');
|
|
69
75
|
if (postcssLoader && webpackConfig.module?.rules) {
|
|
@@ -93,7 +99,7 @@ function default_1(config, webpackConfig = require("@wordpress/scripts/config/we
|
|
|
93
99
|
require("@plaudit/postcss-color-function")(),
|
|
94
100
|
require("autoprefixer")(autoprefixerOptions),
|
|
95
101
|
require("postcss-reporter")({ clearReportedMessages: true }),
|
|
96
|
-
|
|
102
|
+
(0, cssnano_1.default)(nanoConfig)
|
|
97
103
|
]
|
|
98
104
|
};
|
|
99
105
|
for (const rule of webpackConfig.module.rules) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepublishOnly": "rm -rf build && mkdir build && tsc",
|
|
6
6
|
"build": "tsc",
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"@types/node": "^18.15.13",
|
|
17
17
|
"@types/webpack": "^5.28.1",
|
|
18
18
|
"@types/webpack-sources": "^3.2.0",
|
|
19
|
+
"postcss-load-config": "^4.0.1",
|
|
20
|
+
"postcss-loader": "^7.2.4",
|
|
21
|
+
"ts-node": "^10.9.1",
|
|
19
22
|
"typescript": "^5.0.4"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
@@ -29,6 +32,7 @@
|
|
|
29
32
|
"copy-webpack-plugin": "^11.0.0",
|
|
30
33
|
"cssnano": "^6.0.0",
|
|
31
34
|
"eslint": "^8.38.0",
|
|
35
|
+
"eslint-plugin-jsdoc": "^43.0.7",
|
|
32
36
|
"fork-ts-checker-webpack-plugin": "^8.0.0",
|
|
33
37
|
"postcss": "^8.4.23",
|
|
34
38
|
"postcss-calc": "^8.2.4",
|
|
@@ -51,9 +55,6 @@
|
|
|
51
55
|
"webpack-remove-empty-scripts": "^1.0.3",
|
|
52
56
|
"webpack-sources": "^3.2.3"
|
|
53
57
|
},
|
|
54
|
-
"peerDependencies": {
|
|
55
|
-
"webpack": "^5.80.0"
|
|
56
|
-
},
|
|
57
58
|
"resolutions": {
|
|
58
59
|
"eslint-plugin-jsdoc": "^43.0.7"
|
|
59
60
|
}
|