aboutsummaryrefslogtreecommitdiff
path: root/node_modules/postcss-normalize-charset
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/postcss-normalize-charset
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/postcss-normalize-charset')
-rw-r--r--node_modules/postcss-normalize-charset/CHANGELOG.md13
-rw-r--r--node_modules/postcss-normalize-charset/LICENSE20
-rw-r--r--node_modules/postcss-normalize-charset/README.md44
-rw-r--r--node_modules/postcss-normalize-charset/index.js37
-rw-r--r--node_modules/postcss-normalize-charset/package.json32
5 files changed, 146 insertions, 0 deletions
diff --git a/node_modules/postcss-normalize-charset/CHANGELOG.md b/node_modules/postcss-normalize-charset/CHANGELOG.md
new file mode 100644
index 00000000..85927a78
--- /dev/null
+++ b/node_modules/postcss-normalize-charset/CHANGELOG.md
@@ -0,0 +1,13 @@
+# 1.1.1
+
+* 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
+
+* Added `add` option (thanks to @ben-eb)
+
+# 1.0.0
+
+* Initial release.
diff --git a/node_modules/postcss-normalize-charset/LICENSE b/node_modules/postcss-normalize-charset/LICENSE
new file mode 100644
index 00000000..066ee676
--- /dev/null
+++ b/node_modules/postcss-normalize-charset/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright 2015 Bogdan Chadkin <trysound@yandex.ru>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/postcss-normalize-charset/README.md b/node_modules/postcss-normalize-charset/README.md
new file mode 100644
index 00000000..4165e348
--- /dev/null
+++ b/node_modules/postcss-normalize-charset/README.md
@@ -0,0 +1,44 @@
+# postcss-normalize-charset [![Build Status][ci-img]][ci]
+
+Add necessary or remove extra charset with PostCSS
+
+```css
+a{
+ content: "©";
+}
+```
+
+```css
+@charset "utf-8";
+a{
+ content: "©";
+}
+```
+
+## API
+
+### normalizeCharset([options])
+
+#### options
+
+##### add
+
+Type: `boolean`
+Default: `true`
+
+Pass `false` to stop the module from adding a `@charset` declaration if it was
+missing from the file (and the file contained non-ascii characters).
+
+## Usage
+
+```js
+postcss([ require('postcss-normalize-charset') ])
+```
+
+See [PostCSS] docs for examples for your environment.
+
+MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
+
+[PostCSS]: https://github.com/postcss/postcss
+[ci-img]: https://travis-ci.org/ben-eb/postcss-normalize-charset.svg
+[ci]: https://travis-ci.org/ben-eb/postcss-normalize-charset
diff --git a/node_modules/postcss-normalize-charset/index.js b/node_modules/postcss-normalize-charset/index.js
new file mode 100644
index 00000000..1c6f610d
--- /dev/null
+++ b/node_modules/postcss-normalize-charset/index.js
@@ -0,0 +1,37 @@
+var postcss = require('postcss');
+
+var charset = 'charset';
+
+module.exports = postcss.plugin('postcss-normalize-' + charset, function (opts) {
+ opts = opts || {};
+
+ return function (css) {
+ var charsetRule;
+ var nonAsciiNode;
+ var nonAscii = /[^\x00-\x7F]/;
+
+ css.walk(function (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 (nonAsciiNode) {
+ if (!charsetRule && opts.add !== false) {
+ charsetRule = postcss.atRule({
+ name: charset,
+ params: '"utf-8"'
+ });
+ }
+ if (charsetRule) {
+ charsetRule.source = nonAsciiNode.source;
+ css.prepend(charsetRule);
+ }
+ }
+ };
+});
diff --git a/node_modules/postcss-normalize-charset/package.json b/node_modules/postcss-normalize-charset/package.json
new file mode 100644
index 00000000..208f792b
--- /dev/null
+++ b/node_modules/postcss-normalize-charset/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "postcss-normalize-charset",
+ "version": "1.1.1",
+ "description": "Add necessary or remove extra charset with PostCSS",
+ "keywords": [
+ "postcss",
+ "css",
+ "postcss-plugin",
+ "charset"
+ ],
+ "author": "Bogdan Chadkin <trysound@yandex.ru>",
+ "files": [
+ "index.js"
+ ],
+ "license": "MIT",
+ "repository": "ben-eb/postcss-charset",
+ "bugs": {
+ "url": "https://github.com/ben-eb/postcss-charset/issues"
+ },
+ "homepage": "https://github.com/ben-eb/postcss-charset",
+ "dependencies": {
+ "postcss": "^5.0.5"
+ },
+ "devDependencies": {
+ "ava": "^0.16.0",
+ "eslint": "^1.4.1",
+ "postcss-devtools": "^1.1.1"
+ },
+ "scripts": {
+ "test": "eslint index.js test && ava"
+ }
+}