@csstools/postcss-ic-unit 1.0.0 → 2.0.0

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,13 @@
1
1
  # Changes to PostCSS IC Unit
2
2
 
3
- ### 1.0.0 (Unreleased)
3
+ ### 2.0.0 (January 24, 2023)
4
+
5
+ - Updated: Support for Node v14+ (major).
6
+
7
+ ### 1.0.1 (July 8, 2022)
8
+
9
+ - Fix case insensitive matching.
10
+
11
+ ### 1.0.0 (February 15, 2022)
4
12
 
5
13
  - Initial version
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) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
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 t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e),u=t(s);const n=e=>({postcssPlugin:"postcss-ic-unit",Declaration(s){if(!s.value.includes("ic"))return;if(function(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name&&/\(font-size: \d+ic\)/.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}(s))return;const t=u.default(s.value);t.walk((e=>{if(!e.type||"word"!==e.type)return;const s=u.default.unit(e.value);s&&"ic"===s.unit&&(e.value=`${s.number}em`)}));const r=String(t);r!==s.value&&(e.preserve?s.cloneBefore({value:r}):s.value=r)}});n.postcss=!0;const o=e=>{const s=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},e);return s.enableProgressiveCustomProperties&&s.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[r.default(),n(s)]}:n(s)};o.postcss=!0,module.exports=o;
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
- declare type pluginOptions = {
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";const t=e=>({postcssPlugin:"postcss-ic-unit",Declaration(t){if(!t.value.includes("ic"))return;if(function(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name&&/\(font-size: \d+ic\)/.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}(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&&(e.value=`${t.number}em`)}));const o=String(r);o!==t.value&&(e.preserve?t.cloneBefore({value:o}):t.value=o)}});t.postcss=!0;const r=s=>{const r=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},s);return r.enableProgressiveCustomProperties&&r.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[e(),t(r)]}:t(r)};r.postcss=!0;export{r as default};
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,62 +1,73 @@
1
1
  {
2
- "name": "@csstools/postcss-ic-unit",
3
- "version": "1.0.0",
4
- "description": "Use the ic length unit",
5
- "author": "Jonathan Neal <jonathantneal@hotmail.com>",
6
- "license": "CC0-1.0",
7
- "engines": {
8
- "node": "^12 || ^14 || >=16"
9
- },
10
- "main": "dist/index.cjs",
11
- "module": "dist/index.mjs",
12
- "types": "dist/index.d.ts",
13
- "exports": {
14
- ".": {
15
- "import": "./dist/index.mjs",
16
- "require": "./dist/index.cjs",
17
- "default": "./dist/index.mjs"
18
- }
19
- },
20
- "files": [
21
- "CHANGELOG.md",
22
- "LICENSE.md",
23
- "README.md",
24
- "dist"
25
- ],
26
- "scripts": {
27
- "build": "rollup -c ../../rollup/default.js",
28
- "clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
29
- "lint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
30
- "prepublishOnly": "npm run clean && npm run build && npm run test",
31
- "stryker": "stryker run --logLevel error",
32
- "test": "node .tape.mjs && npm run test:exports",
33
- "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs",
34
- "test:exports": "node ./test/_import.mjs && node ./test/_require.cjs"
35
- },
36
- "peerDependencies": {
37
- "postcss": "^8.3"
38
- },
39
- "keywords": [
40
- "postcss-plugin",
41
- "ic",
42
- "css",
43
- "values",
44
- "length",
45
- "glyph",
46
- "CJK water ideograph"
47
- ],
48
- "repository": {
49
- "type": "git",
50
- "url": "https://github.com/csstools/postcss-plugins.git",
51
- "directory": "plugins/postcss-ic-unit"
52
- },
53
- "volta": {
54
- "extends": "../../package.json"
55
- },
56
- "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-ic-unit#readme",
57
- "bugs": "https://github.com/csstools/postcss-plugins/issues",
58
- "dependencies": {
59
- "@csstools/postcss-progressive-custom-properties": "^1.1.0",
60
- "postcss-value-parser": "^4.2.0"
61
- }
2
+ "name": "@csstools/postcss-ic-unit",
3
+ "description": "Use the ic length unit",
4
+ "version": "2.0.0",
5
+ "author": "Jonathan Neal <jonathantneal@hotmail.com>",
6
+ "license": "CC0-1.0",
7
+ "funding": {
8
+ "type": "opencollective",
9
+ "url": "https://opencollective.com/csstools"
10
+ },
11
+ "engines": {
12
+ "node": "^14 || ^16 || >=18"
13
+ },
14
+ "main": "dist/index.cjs",
15
+ "module": "dist/index.mjs",
16
+ "types": "dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/index.mjs",
20
+ "require": "./dist/index.cjs",
21
+ "default": "./dist/index.mjs"
22
+ }
23
+ },
24
+ "files": [
25
+ "CHANGELOG.md",
26
+ "LICENSE.md",
27
+ "README.md",
28
+ "dist"
29
+ ],
30
+ "dependencies": {
31
+ "@csstools/postcss-progressive-custom-properties": "^2.0.0",
32
+ "postcss-value-parser": "^4.2.0"
33
+ },
34
+ "peerDependencies": {
35
+ "postcss": "^8.4"
36
+ },
37
+ "scripts": {
38
+ "prebuild": "npm run clean",
39
+ "build": "rollup -c ../../rollup/default.mjs",
40
+ "clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
41
+ "docs": "node ../../.github/bin/generate-docs/install.mjs",
42
+ "lint": "npm run lint:eslint && npm run lint:package-json",
43
+ "lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
44
+ "lint:package-json": "node ../../.github/bin/format-package-json.mjs",
45
+ "prepublishOnly": "npm run clean && npm run build && npm run test",
46
+ "test": "node .tape.mjs && npm run test:exports",
47
+ "test:exports": "node ./test/_import.mjs && node ./test/_require.cjs",
48
+ "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
49
+ },
50
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-ic-unit#readme",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "https://github.com/csstools/postcss-plugins.git",
54
+ "directory": "plugins/postcss-ic-unit"
55
+ },
56
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
57
+ "keywords": [
58
+ "CJK water ideograph",
59
+ "css",
60
+ "glyph",
61
+ "ic",
62
+ "length",
63
+ "postcss-plugin",
64
+ "values"
65
+ ],
66
+ "csstools": {
67
+ "exportName": "postcssIcUnit",
68
+ "humanReadableName": "PostCSS IC Unit"
69
+ },
70
+ "volta": {
71
+ "extends": "../../package.json"
72
+ }
62
73
  }