Socket
Socket
Sign inDemoInstall

postcss-normalize-charset

Package Overview
Dependencies
1
Maintainers
7
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.1 to 5.0.0-rc.0

35

CHANGELOG.md

@@ -1,18 +0,31 @@

# 4.0.0-rc.0
# Change Log
* Breaking: Drops support for Node 0.12, we now require at least Node 4.
* Breaking: Update PostCSS to 6.0.0.
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# 1.1.1
# 5.0.0-rc.0 (2021-02-19)
* Performance tweaks; test that `node.parent` is equal to the AST rather than
checking its type is `root`, and use the AST directly to prepend the
`@charset` to, rather than using the superfluous `root()` method.
# 1.1.0
### chore
* Added `add` option (thanks to @ben-eb)
* minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
# 1.0.0
* Initial release.
### Features
* migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
### BREAKING CHANGES
* minimum supported `postcss` version is `8.2.1`
* minimum require version of node is 10.13
## 4.1.2 (2018-09-25)
### Bug Fixes
* **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)

@@ -1,46 +0,53 @@

'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports.default = void 0;
const charset = 'charset'; // eslint-disable-next-line no-control-regex
var _postcss = require('postcss');
const nonAscii = /[^\x00-\x7F]/;
var _postcss2 = _interopRequireDefault(_postcss);
function pluginCreator(opts = {}) {
return {
postcssPlugin: 'postcss-normalize-' + charset,
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
OnceExit(css, {
AtRule
}) {
let charsetRule;
let nonAsciiNode;
css.walk(node => {
if (node.type === 'atrule' && node.name === charset) {
if (!charsetRule) {
charsetRule = node;
}
let charset = 'charset';
node.remove();
} else if (!nonAsciiNode && node.parent === css && nonAscii.test(node.toString())) {
nonAsciiNode = node;
}
});
exports.default = _postcss2.default.plugin('postcss-normalize-' + charset, (opts = {}) => {
return css => {
let charsetRule;
let nonAsciiNode;
let nonAscii = /[^\x00-\x7F]/;
if (nonAsciiNode) {
if (!charsetRule && opts.add !== false) {
charsetRule = new AtRule({
name: charset,
params: '"utf-8"'
});
}
css.walk(node => {
if (node.type === 'atrule' && node.name === charset) {
if (!charsetRule) {
charsetRule = node;
}
node.remove();
} else if (!nonAsciiNode && node.parent === css && nonAscii.test(node)) {
nonAsciiNode = node;
}
});
if (charsetRule) {
charsetRule.source = nonAsciiNode.source;
css.prepend(charsetRule);
}
}
}
if (nonAsciiNode) {
if (!charsetRule && opts.add !== false) {
charsetRule = _postcss2.default.atRule({
name: charset,
params: '"utf-8"'
});
}
if (charsetRule) {
charsetRule.source = nonAsciiNode.source;
css.prepend(charsetRule);
}
}
};
});
module.exports = exports['default'];
};
}
pluginCreator.postcss = true;
var _default = pluginCreator;
exports.default = _default;
module.exports = exports.default;
{
"name": "postcss-normalize-charset",
"version": "4.0.1",
"version": "5.0.0-rc.0",
"description": "Add necessary or remove extra charset with PostCSS",

@@ -21,17 +21,18 @@ "keywords": [

"homepage": "https://github.com/cssnano/cssnano",
"dependencies": {
"postcss": "^7.0.0"
"main": "dist/index.js",
"scripts": {
"prebuild": "del-cli dist",
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
"prepublish": "yarn build"
},
"engines": {
"node": "^10 || ^12 || >=14.0"
},
"devDependencies": {
"babel-cli": "^6.0.0",
"cross-env": "^5.0.0",
"postcss-devtools": "^1.0.0"
"postcss": "^8.2.1"
},
"main": "dist/index.js",
"scripts": {
"prepublish": "cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/"
"peerDependencies": {
"postcss": "^8.2.1"
},
"engines": {
"node": ">=6.9.0"
}
"gitHead": "8c16e67a4d24a13ac7e09a36d4faf504196efd0f"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc