@csstools/postcss-random-function 2.0.1 → 3.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 CHANGED
@@ -1,11 +1,9 @@
1
1
  # Changes to PostCSS Random Function
2
2
 
3
- ### 2.0.1
3
+ ### 3.0.1
4
4
 
5
- _May 27, 2025_
5
+ _February 21, 2026_
6
6
 
7
- - Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#304) (patch)
8
- - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.5`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#305) (patch)
9
- - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.1.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#214) (patch)
7
+ - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`3.1.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#311) (minor)
10
8
 
11
9
  [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-random-function/CHANGELOG.md)
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { PluginCreator } from 'postcss';
2
2
 
3
3
  declare const creator: PluginCreator<pluginOptions>;
4
4
  export default creator;
5
+ export { creator as 'module.exports' }
5
6
 
6
7
  /** postcss-random-function plugin options */
7
8
  export declare type pluginOptions = {
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{calc as e}from"@csstools/css-calc";const o=String.fromCodePoint(0);function randomCacheKeyFromPostcssDeclaration(e){let r="",t=e.parent;for(;t;){switch(t.type){case"rule":r+=o+"selector"+o+t.selector+o;break;case"atrule":"scope"===t.name&&(r+=o+"prelude"+o+t.params+o)}t=t.parent}return{propertyName:e.prop,propertyN:0,elementID:r,documentID:e.source?.input.css??e.root().toString()}}const r=/(?<![-\w])(?:random)\(/i,creator=o=>{const t=Object.assign({preserve:!1},o);return{postcssPlugin:"postcss-random-function",Declaration(o){if(!r.test(o.value))return;const s=e(o.value,{precision:5,toCanonicalUnits:!0,randomCaching:randomCacheKeyFromPostcssDeclaration(o)});s!==o.value&&(o.cloneBefore({value:s}),t.preserve||o.remove())}}};creator.postcss=!0;export{creator as default};
1
+ import{calc as e}from"@csstools/css-calc";const o=String.fromCodePoint(0);function randomCacheKeyFromPostcssDeclaration(e){let r="",t=e.parent;for(;t;){switch(t.type){case"rule":r+=o+"selector"+o+t.selector+o;break;case"atrule":"scope"===t.name&&(r+=o+"prelude"+o+t.params+o)}t=t.parent}return{propertyName:e.prop,propertyN:0,elementID:r,documentID:e.source?.input.css??e.root().toString()}}const r=/(?<![-\w])(?:random)\(/i,creator=o=>{const t=Object.assign({preserve:!1},o);return{postcssPlugin:"postcss-random-function",Declaration(o){if(!r.test(o.value))return;const s=e(o.value,{precision:5,toCanonicalUnits:!0,randomCaching:randomCacheKeyFromPostcssDeclaration(o)});s!==o.value&&(o.cloneBefore({value:s}),t.preserve||o.remove())}}};creator.postcss=!0;export{creator as default,creator as"module.exports"};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@csstools/postcss-random-function",
3
3
  "description": "Use the random function in CSS",
4
- "version": "2.0.1",
4
+ "version": "3.0.1",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "Antonio Laguna",
@@ -25,20 +25,13 @@
25
25
  }
26
26
  ],
27
27
  "engines": {
28
- "node": ">=18"
28
+ "node": ">=20.19.0"
29
29
  },
30
30
  "type": "module",
31
- "main": "dist/index.cjs",
32
- "module": "dist/index.mjs",
33
31
  "exports": {
34
32
  ".": {
35
- "import": {
36
- "types": "./dist/index.d.ts",
37
- "default": "./dist/index.mjs"
38
- },
39
- "require": {
40
- "default": "./dist/index.cjs"
41
- }
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.mjs"
42
35
  }
43
36
  },
44
37
  "files": [
@@ -48,9 +41,9 @@
48
41
  "dist"
49
42
  ],
50
43
  "dependencies": {
51
- "@csstools/css-calc": "^2.1.4",
52
- "@csstools/css-parser-algorithms": "^3.0.5",
53
- "@csstools/css-tokenizer": "^3.0.4"
44
+ "@csstools/css-calc": "^3.1.1",
45
+ "@csstools/css-parser-algorithms": "^4.0.0",
46
+ "@csstools/css-tokenizer": "^4.0.0"
54
47
  },
55
48
  "peerDependencies": {
56
49
  "postcss": "^8.4"
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var e=require("@csstools/css-calc");const r=String.fromCodePoint(0);function randomCacheKeyFromPostcssDeclaration(e){let o="",s=e.parent;for(;s;){switch(s.type){case"rule":o+=r+"selector"+r+s.selector+r;break;case"atrule":"scope"===s.name&&(o+=r+"prelude"+r+s.params+r)}s=s.parent}return{propertyName:e.prop,propertyN:0,elementID:o,documentID:e.source?.input.css??e.root().toString()}}const o=/(?<![-\w])(?:random)\(/i,creator=r=>{const s=Object.assign({preserve:!1},r);return{postcssPlugin:"postcss-random-function",Declaration(r){if(!o.test(r.value))return;const t=e.calc(r.value,{precision:5,toCanonicalUnits:!0,randomCaching:randomCacheKeyFromPostcssDeclaration(r)});t!==r.value&&(r.cloneBefore({value:t}),s.preserve||r.remove())}}};creator.postcss=!0,module.exports=creator;