postcss-normalize-charset 4.0.1 → 5.0.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/CHANGELOG.md +48 -11
- package/dist/index.js +48 -41
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Change Log
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# [5.0.0](https://github.com/cssnano/cssnano/compare/postcss-normalize-charset@5.0.0-rc.2...postcss-normalize-charset@5.0.0) (2021-04-06)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
checking its type is `root`, and use the AST directly to prepend the
|
|
10
|
-
`@charset` to, rather than using the superfluous `root()` method.
|
|
8
|
+
**Note:** Version bump only for package postcss-normalize-charset
|
|
11
9
|
|
|
12
|
-
# 1.1.0
|
|
13
10
|
|
|
14
|
-
* Added `add` option (thanks to @ben-eb)
|
|
15
11
|
|
|
16
|
-
# 1.0.0
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
|
|
14
|
+
# [5.0.0-rc.2](https://github.com/cssnano/cssnano/compare/postcss-normalize-charset@5.0.0-rc.1...postcss-normalize-charset@5.0.0-rc.2) (2021-03-15)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package postcss-normalize-charset
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [5.0.0-rc.1](https://github.com/cssnano/cssnano/compare/postcss-normalize-charset@5.0.0-rc.0...postcss-normalize-charset@5.0.0-rc.1) (2021-03-04)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package postcss-normalize-charset
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# 5.0.0-rc.0 (2021-02-19)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### chore
|
|
34
|
+
|
|
35
|
+
* minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
* migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### BREAKING CHANGES
|
|
44
|
+
|
|
45
|
+
* minimum supported `postcss` version is `8.2.1`
|
|
46
|
+
* minimum require version of node is 10.13
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 4.1.2 (2018-09-25)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* **postcss-merge-longhand:** not mangle border output ([#555](https://github.com/cssnano/cssnano/issues/555)) ([9a70605](https://github.com/cssnano/cssnano/commit/9a706050b621e7795a9bf74eb7110b5c81804ffe)), closes [#553](https://github.com/cssnano/cssnano/issues/553) [#554](https://github.com/cssnano/cssnano/issues/554)
|
package/dist/index.js
CHANGED
|
@@ -1,46 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const charset = 'charset'; // eslint-disable-next-line no-control-regex
|
|
8
|
+
|
|
9
|
+
const nonAscii = /[^\x00-\x7F]/;
|
|
10
|
+
|
|
11
|
+
function pluginCreator(opts = {}) {
|
|
12
|
+
return {
|
|
13
|
+
postcssPlugin: 'postcss-normalize-' + charset,
|
|
14
|
+
|
|
15
|
+
OnceExit(css, {
|
|
16
|
+
AtRule
|
|
17
|
+
}) {
|
|
18
|
+
let charsetRule;
|
|
19
|
+
let nonAsciiNode;
|
|
20
|
+
css.walk(node => {
|
|
21
|
+
if (node.type === 'atrule' && node.name === charset) {
|
|
22
|
+
if (!charsetRule) {
|
|
23
|
+
charsetRule = node;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
node.remove();
|
|
27
|
+
} else if (!nonAsciiNode && node.parent === css && nonAscii.test(node.toString())) {
|
|
28
|
+
nonAsciiNode = node;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (nonAsciiNode) {
|
|
33
|
+
if (!charsetRule && opts.add !== false) {
|
|
34
|
+
charsetRule = new AtRule({
|
|
35
|
+
name: charset,
|
|
36
|
+
params: '"utf-8"'
|
|
37
|
+
});
|
|
38
|
+
}
|
|
6
39
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
let charset = 'charset';
|
|
14
|
-
|
|
15
|
-
exports.default = _postcss2.default.plugin('postcss-normalize-' + charset, (opts = {}) => {
|
|
16
|
-
return css => {
|
|
17
|
-
let charsetRule;
|
|
18
|
-
let nonAsciiNode;
|
|
19
|
-
let nonAscii = /[^\x00-\x7F]/;
|
|
20
|
-
|
|
21
|
-
css.walk(node => {
|
|
22
|
-
if (node.type === 'atrule' && node.name === charset) {
|
|
23
|
-
if (!charsetRule) {
|
|
24
|
-
charsetRule = node;
|
|
25
|
-
}
|
|
26
|
-
node.remove();
|
|
27
|
-
} else if (!nonAsciiNode && node.parent === css && nonAscii.test(node)) {
|
|
28
|
-
nonAsciiNode = node;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if (nonAsciiNode) {
|
|
33
|
-
if (!charsetRule && opts.add !== false) {
|
|
34
|
-
charsetRule = _postcss2.default.atRule({
|
|
35
|
-
name: charset,
|
|
36
|
-
params: '"utf-8"'
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (charsetRule) {
|
|
40
|
-
charsetRule.source = nonAsciiNode.source;
|
|
41
|
-
css.prepend(charsetRule);
|
|
42
|
-
}
|
|
40
|
+
if (charsetRule) {
|
|
41
|
+
charsetRule.source = nonAsciiNode.source;
|
|
42
|
+
css.prepend(charsetRule);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pluginCreator.postcss = true;
|
|
51
|
+
var _default = pluginCreator;
|
|
52
|
+
exports.default = _default;
|
|
53
|
+
module.exports = exports.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-normalize-charset",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Add necessary or remove extra charset with PostCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"postcss",
|
|
@@ -18,19 +18,20 @@
|
|
|
18
18
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/cssnano/cssnano",
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"postcss": "^7.0.0"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"babel-cli": "^6.0.0",
|
|
26
|
-
"cross-env": "^5.0.0",
|
|
27
|
-
"postcss-devtools": "^1.0.0"
|
|
28
|
-
},
|
|
29
21
|
"main": "dist/index.js",
|
|
30
22
|
"scripts": {
|
|
31
|
-
"
|
|
23
|
+
"prebuild": "del-cli dist",
|
|
24
|
+
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
|
|
25
|
+
"prepublish": "yarn build"
|
|
32
26
|
},
|
|
33
27
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
35
|
-
}
|
|
28
|
+
"node": "^10 || ^12 || >=14.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"postcss": "^8.2.1"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"postcss": "^8.2.1"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "0e2c3bf5835bafcdc8783bef66f730a24194c8f3"
|
|
36
37
|
}
|