@csstools/postcss-ic-unit 1.0.1 → 2.0.1
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 +8 -0
- package/README.md +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +1 -1
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changes to PostCSS IC Unit
|
|
2
2
|
|
|
3
|
+
### 2.0.1 (January 28, 2023)
|
|
4
|
+
|
|
5
|
+
- Improve `types` declaration in `package.json`
|
|
6
|
+
|
|
7
|
+
### 2.0.0 (January 24, 2023)
|
|
8
|
+
|
|
9
|
+
- Updated: Support for Node v14+ (major).
|
|
10
|
+
|
|
3
11
|
### 1.0.1 (July 8, 2022)
|
|
4
12
|
|
|
5
13
|
- Fix case insensitive matching.
|
package/README.md
CHANGED
|
@@ -52,8 +52,8 @@ postcss([
|
|
|
52
52
|
[PostCSS IC Unit] runs in all Node environments, with special
|
|
53
53
|
instructions for:
|
|
54
54
|
|
|
55
|
-
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [
|
|
56
|
-
| --- | --- | --- | --- | --- |
|
|
55
|
+
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
|
|
56
|
+
| --- | --- | --- | --- | --- |
|
|
57
57
|
|
|
58
58
|
## Options
|
|
59
59
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("postcss-value-parser");function
|
|
1
|
+
"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("postcss-value-parser");function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/.test(s.params.toLowerCase()))return!0;s=s.parent}else s=s.parent;return!1}const basePlugin=e=>({postcssPlugin:"postcss-ic-unit",Declaration(r){if(!r.value.toLowerCase().includes("ic"))return;if(hasSupportsAtRuleAncestor(r))return;const t=s(r.value);t.walk((e=>{if(!e.type||"word"!==e.type)return;const r=s.unit(e.value);r&&"ic"===r.unit.toLowerCase()&&(e.value=`${r.number}em`)}));const o=String(t);o!==r.value&&(r.cloneBefore({value:o}),e.preserve||r.remove())}});basePlugin.postcss=!0;const postcssPlugin=s=>{const r=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},s);return r.enableProgressiveCustomProperties&&r.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[e(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0,module.exports=postcssPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PluginCreator } from 'postcss';
|
|
2
|
-
|
|
2
|
+
/** postcss-ic-unit plugin options */
|
|
3
|
+
export type pluginOptions = {
|
|
4
|
+
/** Preserve the original notation. default: false */
|
|
3
5
|
preserve?: boolean;
|
|
6
|
+
/** Enable "@csstools/postcss-progressive-custom-properties". default: true */
|
|
4
7
|
enableProgressiveCustomProperties?: boolean;
|
|
5
8
|
};
|
|
6
9
|
declare const postcssPlugin: PluginCreator<pluginOptions>;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@csstools/postcss-progressive-custom-properties";import s from"postcss-value-parser";
|
|
1
|
+
import e from"@csstools/postcss-progressive-custom-properties";import s from"postcss-value-parser";function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/.test(s.params.toLowerCase()))return!0;s=s.parent}else s=s.parent;return!1}const basePlugin=e=>({postcssPlugin:"postcss-ic-unit",Declaration(t){if(!t.value.toLowerCase().includes("ic"))return;if(hasSupportsAtRuleAncestor(t))return;const r=s(t.value);r.walk((e=>{if(!e.type||"word"!==e.type)return;const t=s.unit(e.value);t&&"ic"===t.unit.toLowerCase()&&(e.value=`${t.number}em`)}));const o=String(r);o!==t.value&&(t.cloneBefore({value:o}),e.preserve||t.remove())}});basePlugin.postcss=!0;const postcssPlugin=s=>{const t=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},s);return t.enableProgressiveCustomProperties&&t.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[e(),basePlugin(t)]}:basePlugin(t)};postcssPlugin.postcss=!0;export{postcssPlugin as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csstools/postcss-ic-unit",
|
|
3
3
|
"description": "Use the ic length unit",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
|
6
6
|
"license": "CC0-1.0",
|
|
7
7
|
"funding": {
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
"url": "https://opencollective.com/csstools"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": "^
|
|
12
|
+
"node": "^14 || ^16 || >=18"
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/index.cjs",
|
|
15
15
|
"module": "dist/index.mjs",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
19
20
|
"import": "./dist/index.mjs",
|
|
20
21
|
"require": "./dist/index.cjs",
|
|
21
22
|
"default": "./dist/index.mjs"
|
|
@@ -28,15 +29,16 @@
|
|
|
28
29
|
"dist"
|
|
29
30
|
],
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@csstools/postcss-progressive-custom-properties": "^
|
|
32
|
+
"@csstools/postcss-progressive-custom-properties": "^2.0.0",
|
|
32
33
|
"postcss-value-parser": "^4.2.0"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
|
-
"postcss": "^8.
|
|
36
|
+
"postcss": "^8.4"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
39
|
+
"prebuild": "npm run clean",
|
|
40
|
+
"build": "rollup -c ../../rollup/default.mjs",
|
|
41
|
+
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
|
|
40
42
|
"docs": "node ../../.github/bin/generate-docs/install.mjs",
|
|
41
43
|
"lint": "npm run lint:eslint && npm run lint:package-json",
|
|
42
44
|
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
|