@csstools/postcss-ic-unit 3.0.2 → 3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changes to PostCSS IC Unit
2
2
 
3
+ ### 3.0.3
4
+
5
+ _December 15, 2023_
6
+
7
+ - Fix type definitions
8
+ - Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.3`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#303) (patch)
9
+
3
10
  ### 3.0.2
4
11
 
5
12
  _October 9, 2023_
@@ -13,53 +20,4 @@ _September 18, 2023_
13
20
  - Improve performance
14
21
  - Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#301) (patch)
15
22
 
16
- ### 3.0.0
17
-
18
- _July 3, 2023_
19
-
20
- - Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/))
21
- - Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#300) (major)
22
-
23
- ### 2.0.4
24
-
25
- _June 1, 2023_
26
-
27
- - Updated `@csstools/postcss-progressive-custom-properties` to `2.3.0` (minor)
28
-
29
-
30
- ### 2.0.3
31
-
32
- _May 19, 2023_
33
-
34
- - Updated `@csstools/postcss-progressive-custom-properties` to `2.2.0` (minor)
35
-
36
-
37
- ### 2.0.2
38
-
39
- _February 8, 2023_
40
-
41
- - Reduce the amount of duplicate fallback CSS.
42
-
43
- ### 2.0.1
44
-
45
- _January 28, 2023_
46
-
47
- - Improve `types` declaration in `package.json`
48
-
49
- ### 2.0.0
50
-
51
- _January 24, 2023_
52
-
53
- - Updated: Support for Node v14+ (major).
54
-
55
- ### 1.0.1
56
-
57
- _July 8, 2022_
58
-
59
- - Fix case insensitive matching.
60
-
61
- ### 1.0.0
62
-
63
- _February 15, 2022_
64
-
65
- - Initial version
23
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-ic-unit/CHANGELOG.md)
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("postcss-value-parser");function hasFallback(e){const s=e.parent;if(!s)return!1;const t=e.prop.toLowerCase(),r=s.index(e);for(let e=0;e<r;e++){const r=s.nodes[e];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/i.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}const t=/ic\b/i,basePlugin=e=>({postcssPlugin:"postcss-ic-unit",Declaration(r){if(!t.test(r.value))return;if(hasFallback(r))return;if(hasSupportsAtRuleAncestor(r))return;const o=s(r.value);o.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 n=String(o);n!==r.value&&(r.cloneBefore({value:n}),null!=e&&e.preserve||r.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,module.exports=postcssPlugin;
1
+ "use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("postcss-value-parser");function hasFallback(e){const s=e.parent;if(!s)return!1;const t=e.prop.toLowerCase(),r=s.index(e);for(let e=0;e<r;e++){const r=s.nodes[e];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/i.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}const t=/ic\b/i,basePlugin=e=>({postcssPlugin:"postcss-ic-unit",Declaration(r){if(!t.test(r.value))return;if(hasFallback(r))return;if(hasSupportsAtRuleAncestor(r))return;const o=s(r.value);o.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 n=String(o);n!==r.value&&(r.cloneBefore({value:n}),e?.preserve||r.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,module.exports=postcssPlugin;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  import type { PluginCreator } from 'postcss';
2
+
2
3
  /** postcss-ic-unit plugin options */
3
- export type pluginOptions = {
4
+ export declare type pluginOptions = {
4
5
  /** Preserve the original notation. default: false */
5
6
  preserve?: boolean;
6
7
  /** Enable "@csstools/postcss-progressive-custom-properties". default: true */
7
8
  enableProgressiveCustomProperties?: boolean;
8
9
  };
10
+
9
11
  declare const postcssPlugin: PluginCreator<pluginOptions>;
10
12
  export default postcssPlugin;
13
+
14
+ export { }
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import e from"@csstools/postcss-progressive-custom-properties";import s from"postcss-value-parser";function hasFallback(e){const s=e.parent;if(!s)return!1;const t=e.prop.toLowerCase(),r=s.index(e);for(let e=0;e<r;e++){const r=s.nodes[e];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/i.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}const t=/ic\b/i,basePlugin=e=>({postcssPlugin:"postcss-ic-unit",Declaration(r){if(!t.test(r.value))return;if(hasFallback(r))return;if(hasSupportsAtRuleAncestor(r))return;const o=s(r.value);o.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 n=String(o);n!==r.value&&(r.cloneBefore({value:n}),null!=e&&e.preserve||r.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};
1
+ import e from"@csstools/postcss-progressive-custom-properties";import s from"postcss-value-parser";function hasFallback(e){const s=e.parent;if(!s)return!1;const t=e.prop.toLowerCase(),r=s.index(e);for(let e=0;e<r;e++){const r=s.nodes[e];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/i.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}const t=/ic\b/i,basePlugin=e=>({postcssPlugin:"postcss-ic-unit",Declaration(r){if(!t.test(r.value))return;if(hasFallback(r))return;if(hasSupportsAtRuleAncestor(r))return;const o=s(r.value);o.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 n=String(o);n!==r.value&&(r.cloneBefore({value:n}),e?.preserve||r.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": "3.0.2",
4
+ "version": "3.0.3",
5
5
  "author": "Jonathan Neal <jonathantneal@hotmail.com>",
6
6
  "license": "MIT-0",
7
7
  "funding": [
@@ -17,15 +17,18 @@
17
17
  "engines": {
18
18
  "node": "^14 || ^16 || >=18"
19
19
  },
20
+ "type": "module",
20
21
  "main": "dist/index.cjs",
21
22
  "module": "dist/index.mjs",
22
- "types": "dist/index.d.ts",
23
23
  "exports": {
24
24
  ".": {
25
- "types": "./dist/index.d.ts",
26
- "import": "./dist/index.mjs",
27
- "require": "./dist/index.cjs",
28
- "default": "./dist/index.mjs"
25
+ "import": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.mjs"
28
+ },
29
+ "require": {
30
+ "default": "./dist/index.cjs"
31
+ }
29
32
  }
30
33
  },
31
34
  "files": [
@@ -35,23 +38,12 @@
35
38
  "dist"
36
39
  ],
37
40
  "dependencies": {
38
- "@csstools/postcss-progressive-custom-properties": "^3.0.2",
41
+ "@csstools/postcss-progressive-custom-properties": "^3.0.3",
39
42
  "postcss-value-parser": "^4.2.0"
40
43
  },
41
44
  "peerDependencies": {
42
45
  "postcss": "^8.4"
43
46
  },
44
- "devDependencies": {
45
- "@csstools/postcss-tape": "*"
46
- },
47
- "scripts": {
48
- "build": "rollup -c ../../rollup/default.mjs",
49
- "docs": "node ../../.github/bin/generate-docs/install.mjs",
50
- "lint": "node ../../.github/bin/format-package-json.mjs",
51
- "prepublishOnly": "npm run build && npm run test",
52
- "test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
53
- "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
54
- },
55
47
  "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-ic-unit#readme",
56
48
  "repository": {
57
49
  "type": "git",
@@ -67,12 +59,5 @@
67
59
  "length",
68
60
  "postcss-plugin",
69
61
  "values"
70
- ],
71
- "csstools": {
72
- "exportName": "postcssIcUnit",
73
- "humanReadableName": "PostCSS IC Unit"
74
- },
75
- "volta": {
76
- "extends": "../../package.json"
77
- }
62
+ ]
78
63
  }
@@ -1,2 +0,0 @@
1
- import type { Declaration } from 'postcss';
2
- export declare function hasFallback(node: Declaration): boolean;
@@ -1,2 +0,0 @@
1
- import type { Node } from 'postcss';
2
- export declare function hasSupportsAtRuleAncestor(node: Node): boolean;