@atlaspack/optimizer-htmlnano 2.14.19 → 2.14.20
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/CHANGELOG.md +9 -0
- package/lib/HTMLNanoOptimizer.js +10 -1
- package/package.json +2 -2
- package/src/HTMLNanoOptimizer.js +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaspack/optimizer-htmlnano
|
|
2
2
|
|
|
3
|
+
## 2.14.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#702](https://github.com/atlassian-labs/atlaspack/pull/702) [`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa) Thanks [@alshdavid](https://github.com/alshdavid)! - Fixes to Flow types
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
|
|
10
|
+
- @atlaspack/plugin@2.14.20
|
|
11
|
+
|
|
3
12
|
## 2.14.19
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/lib/HTMLNanoOptimizer.js
CHANGED
|
@@ -59,12 +59,20 @@ var _default = exports.default = new (_plugin().Optimizer)({
|
|
|
59
59
|
if (typeof contents !== 'string') {
|
|
60
60
|
throw new Error('HTMLNanoOptimizer: Only string contents are currently supported');
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
// $FlowFixMe
|
|
62
64
|
const clonedConfig = config || {};
|
|
63
65
|
|
|
64
66
|
// $FlowFixMe
|
|
65
67
|
const presets = _htmlnano().default.presets;
|
|
66
|
-
|
|
68
|
+
// $FlowFixMe
|
|
69
|
+
const preset =
|
|
70
|
+
// $FlowFixMe
|
|
71
|
+
typeof clonedConfig.preset === 'string' ? presets[clonedConfig.preset] : {};
|
|
72
|
+
// $FlowFixMe
|
|
67
73
|
delete clonedConfig.preset;
|
|
74
|
+
|
|
75
|
+
// $FlowFixMe
|
|
68
76
|
const htmlNanoConfig = {
|
|
69
77
|
// Inline <script> and <style> elements, and style attributes are already
|
|
70
78
|
// minified before they are re-inserted by the packager.
|
|
@@ -101,6 +109,7 @@ var _default = exports.default = new (_plugin().Optimizer)({
|
|
|
101
109
|
// skipConfigLoading: true,
|
|
102
110
|
};
|
|
103
111
|
|
|
112
|
+
// $FlowFixMe
|
|
104
113
|
let plugins = [(0, _htmlnano().default)(htmlNanoConfig)];
|
|
105
114
|
|
|
106
115
|
// $FlowFixMe
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/optimizer-htmlnano",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.20",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"node": ">= 16.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@atlaspack/plugin": "2.14.
|
|
18
|
+
"@atlaspack/plugin": "2.14.20",
|
|
19
19
|
"htmlnano": "^2.0.0",
|
|
20
20
|
"nullthrows": "^1.1.1",
|
|
21
21
|
"posthtml": "^0.16.5",
|
package/src/HTMLNanoOptimizer.js
CHANGED
|
@@ -39,17 +39,22 @@ export default (new Optimizer({
|
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
// $FlowFixMe
|
|
43
|
+
const clonedConfig: {} = config || {};
|
|
43
44
|
|
|
44
45
|
// $FlowFixMe
|
|
45
46
|
const presets = htmlnano.presets;
|
|
46
|
-
|
|
47
|
+
// $FlowFixMe
|
|
48
|
+
const preset: {} =
|
|
49
|
+
// $FlowFixMe
|
|
47
50
|
typeof clonedConfig.preset === 'string'
|
|
48
51
|
? presets[clonedConfig.preset]
|
|
49
52
|
: {};
|
|
53
|
+
// $FlowFixMe
|
|
50
54
|
delete clonedConfig.preset;
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
// $FlowFixMe
|
|
57
|
+
const htmlNanoConfig: mixed = {
|
|
53
58
|
// Inline <script> and <style> elements, and style attributes are already
|
|
54
59
|
// minified before they are re-inserted by the packager.
|
|
55
60
|
minifyJs: false,
|
|
@@ -87,6 +92,7 @@ export default (new Optimizer({
|
|
|
87
92
|
// skipConfigLoading: true,
|
|
88
93
|
};
|
|
89
94
|
|
|
95
|
+
// $FlowFixMe
|
|
90
96
|
let plugins = [htmlnano(htmlNanoConfig)];
|
|
91
97
|
|
|
92
98
|
// $FlowFixMe
|
|
@@ -103,7 +109,7 @@ export default (new Optimizer({
|
|
|
103
109
|
).html,
|
|
104
110
|
};
|
|
105
111
|
},
|
|
106
|
-
}): Optimizer);
|
|
112
|
+
}): Optimizer<mixed, mixed>);
|
|
107
113
|
|
|
108
114
|
// HTML tags and attributes are case insensitive. The HTML transformer normalizes them so it can
|
|
109
115
|
// more easily process any case. But SVGO requires case sensitive tags and attributes to work correctly.
|