postcss-normalize-string 5.0.0-rc.2 → 5.0.3
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/dist/index.js +24 -22
- package/package.json +10 -11
- package/CHANGELOG.md +0 -61
package/dist/index.js
CHANGED
|
@@ -230,11 +230,17 @@ function normalize(value, preferredQuote) {
|
|
|
230
230
|
}).toString();
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
function minify(original, cache, preferredQuote) {
|
|
234
|
+
const key = original + '|' + preferredQuote;
|
|
235
|
+
|
|
236
|
+
if (cache.has(key)) {
|
|
237
|
+
return cache.get(key);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const newValue = normalize(original, preferredQuote);
|
|
241
|
+
cache.set(key, newValue);
|
|
242
|
+
return newValue;
|
|
243
|
+
}
|
|
238
244
|
|
|
239
245
|
function pluginCreator(opts) {
|
|
240
246
|
const {
|
|
@@ -246,24 +252,20 @@ function pluginCreator(opts) {
|
|
|
246
252
|
postcssPlugin: 'postcss-normalize-string',
|
|
247
253
|
|
|
248
254
|
OnceExit(css) {
|
|
249
|
-
const cache =
|
|
255
|
+
const cache = new Map();
|
|
250
256
|
css.walk(node => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
const newValue = normalize(node[param], preferredQuote);
|
|
265
|
-
node[param] = newValue;
|
|
266
|
-
cache[key] = newValue;
|
|
257
|
+
switch (node.type) {
|
|
258
|
+
case 'rule':
|
|
259
|
+
node.selector = minify(node.selector, cache, preferredQuote);
|
|
260
|
+
break;
|
|
261
|
+
|
|
262
|
+
case 'decl':
|
|
263
|
+
node.value = minify(node.value, cache, preferredQuote);
|
|
264
|
+
break;
|
|
265
|
+
|
|
266
|
+
case 'atrule':
|
|
267
|
+
node.params = minify(node.params, cache, preferredQuote);
|
|
268
|
+
break;
|
|
267
269
|
}
|
|
268
270
|
});
|
|
269
271
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-normalize-string",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Normalize wrapping quotes for CSS string literals.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
8
|
"LICENSE-MIT"
|
|
9
9
|
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"prebuild": "del-cli dist",
|
|
12
|
-
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
|
|
13
|
-
"prepublish": "yarn build"
|
|
14
|
-
},
|
|
15
10
|
"keywords": [
|
|
16
11
|
"css",
|
|
17
12
|
"postcss",
|
|
@@ -26,7 +21,7 @@
|
|
|
26
21
|
},
|
|
27
22
|
"repository": "cssnano/cssnano",
|
|
28
23
|
"dependencies": {
|
|
29
|
-
"postcss-value-parser": "^4.
|
|
24
|
+
"postcss-value-parser": "^4.2.0"
|
|
30
25
|
},
|
|
31
26
|
"bugs": {
|
|
32
27
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
@@ -35,10 +30,14 @@
|
|
|
35
30
|
"node": "^10 || ^12 || >=14.0"
|
|
36
31
|
},
|
|
37
32
|
"devDependencies": {
|
|
38
|
-
"postcss": "^8.2.
|
|
33
|
+
"postcss": "^8.2.15"
|
|
39
34
|
},
|
|
40
35
|
"peerDependencies": {
|
|
41
|
-
"postcss": "^8.2.
|
|
36
|
+
"postcss": "^8.2.15"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"prebuild": "rimraf dist",
|
|
40
|
+
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\""
|
|
42
41
|
},
|
|
43
|
-
"
|
|
44
|
-
}
|
|
42
|
+
"readme": "# [postcss][postcss]-normalize-string\n\n> Normalize strings with PostCSS.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-normalize-string) do:\n\n```\nnpm install postcss-normalize-string --save\n```\n\n## Example\n\n### Input\n\n```css\np:after{ content: '\\\\'string\\\\' is intact' }\n```\n\n### Output\n\n```css\np:after{ content:\"'string' is intact\" }\n```\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## API\n\n### normalize([options])\n\n#### options\n\n##### preferredQuote\n\nType: `string`\nDefault: `double`\n\nSets what type of quote to prefer. Possible values are `single` and `double`.\n\n```js\nvar css = 'p:after{content:\"\"}';\nconsole.log(postcss(normalize({preferredQuote: 'single'})).process(css).css);\n//=> p:after{content:''}\n```\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[postcss]: https://github.com/postcss/postcss\n"
|
|
43
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [5.0.0-rc.2](https://github.com/cssnano/cssnano/compare/postcss-normalize-string@5.0.0-rc.1...postcss-normalize-string@5.0.0-rc.2) (2021-03-15)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package postcss-normalize-string
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [5.0.0-rc.1](https://github.com/cssnano/cssnano/compare/postcss-normalize-string@5.0.0-rc.0...postcss-normalize-string@5.0.0-rc.1) (2021-03-04)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package postcss-normalize-string
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# 5.0.0-rc.0 (2021-02-19)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Bug Fixes
|
|
26
|
-
|
|
27
|
-
* **postcss-ordered-values:** columns transform returning string instead of the AST ([#928](https://github.com/cssnano/cssnano/issues/928)) ([a5d6d36](https://github.com/cssnano/cssnano/commit/a5d6d364e0815ecb198a95de301f3554ccce4f78))
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### chore
|
|
31
|
-
|
|
32
|
-
* minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Features
|
|
36
|
-
|
|
37
|
-
* migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
### BREAKING CHANGES
|
|
41
|
-
|
|
42
|
-
* minimum supported `postcss` version is `8.2.1`
|
|
43
|
-
* minimum require version of node is 10.13
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## 4.1.9 (2019-02-12)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Performance Improvements
|
|
51
|
-
|
|
52
|
-
* **postcss-normalize-string:** increase perf ([#689](https://github.com/cssnano/cssnano/issues/689)) ([07948cb](https://github.com/cssnano/cssnano/commit/07948cb3ff433825682c499516640abeeec7383a))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## 4.1.1 (2018-09-24)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
### Bug Fixes
|
|
60
|
-
|
|
61
|
-
* **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)
|