postcss-normalize-charset 4.0.0-nightly.2020.9.3 → 4.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.js +34 -37
  3. package/package.json +10 -7
package/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # 4.0.0-rc.0
2
+
3
+ * Breaking: Drops support for Node 0.12, we now require at least Node 4.
4
+ * Breaking: Update PostCSS to 6.0.0.
5
+
6
+ # 1.1.1
7
+
8
+ * Performance tweaks; test that `node.parent` is equal to the AST rather than
9
+ checking its type is `root`, and use the AST directly to prepend the
10
+ `@charset` to, rather than using the superfluous `root()` method.
11
+
12
+ # 1.1.0
13
+
14
+ * Added `add` option (thanks to @ben-eb)
15
+
16
+ # 1.0.0
17
+
18
+ * Initial release.
package/dist/index.js CHANGED
@@ -1,49 +1,46 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
5
  });
6
- exports.default = void 0;
7
6
 
8
- var _postcss = _interopRequireDefault(require("postcss"));
7
+ var _postcss = require('postcss');
8
+
9
+ var _postcss2 = _interopRequireDefault(_postcss);
9
10
 
10
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
12
 
12
13
  let charset = 'charset';
13
14
 
14
- var _default = _postcss.default.plugin('postcss-normalize-' + charset, (opts = {}) => {
15
- return css => {
16
- let charsetRule;
17
- let nonAsciiNode; // eslint-disable-next-line no-control-regex
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
+ });
18
31
 
19
- let nonAscii = /[^\x00-\x7F]/;
20
- css.walk(node => {
21
- if (node.type === 'atrule' && node.name === charset) {
22
- if (!charsetRule) {
23
- charsetRule = node;
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
+ }
24
43
  }
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 = _postcss.default.atRule({
35
- name: charset,
36
- params: '"utf-8"'
37
- });
38
- }
39
-
40
- if (charsetRule) {
41
- charsetRule.source = nonAsciiNode.source;
42
- css.prepend(charsetRule);
43
- }
44
- }
45
- };
44
+ };
46
45
  });
47
-
48
- exports.default = _default;
49
- module.exports = exports.default;
46
+ module.exports = exports['default'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-normalize-charset",
3
- "version": "4.0.0-nightly.2020.9.3",
3
+ "version": "4.0.0",
4
4
  "description": "Add necessary or remove extra charset with PostCSS",
5
5
  "keywords": [
6
6
  "postcss",
@@ -19,15 +19,18 @@
19
19
  },
20
20
  "homepage": "https://github.com/cssnano/cssnano",
21
21
  "dependencies": {
22
- "postcss": "^7.0.16"
22
+ "postcss": "^6.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "babel-cli": "^6.0.0",
26
+ "cross-env": "^5.0.0",
27
+ "postcss-devtools": "^1.0.0"
23
28
  },
24
29
  "main": "dist/index.js",
25
30
  "scripts": {
26
- "prebuild": "",
27
- "build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
28
- "prepublish": ""
31
+ "prepublish": "cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/"
29
32
  },
30
33
  "engines": {
31
- "node": ">=10.13.0"
34
+ "node": ">=6.9.0"
32
35
  }
33
- }
36
+ }