postcss-merge-idents 8.0.1 → 8.0.2

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/LICENSE-MIT CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
1
+ Copyright (c) Ben Briggs <beneb.info@gmail.com> (https://beneb.info)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
package/README.md CHANGED
@@ -71,7 +71,7 @@ See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTOR
71
71
 
72
72
  ## License
73
73
 
74
- MIT © [Ben Briggs](http://beneb.info)
74
+ MIT © [Ben Briggs](https://beneb.info)
75
75
 
76
76
 
77
77
  [postcss]: https://github.com/postcss/postcss
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "postcss-merge-idents",
3
- "version": "8.0.1",
3
+ "version": "8.0.2",
4
4
  "description": "Merge keyframe and counter style identifiers.",
5
- "main": "src/index.js",
6
- "types": "types/index.d.ts",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./types/index.d.ts",
8
+ "default": "./src/index.js"
9
+ },
10
+ "./src": "./src/index.js",
11
+ "./src/index": "./src/index.js",
12
+ "./src/index.js": "./src/index.js",
13
+ "./package.json": "./package.json"
14
+ },
7
15
  "files": [
8
16
  "src",
9
17
  "LICENSE-MIT",
@@ -20,12 +28,15 @@
20
28
  "author": {
21
29
  "name": "Ben Briggs",
22
30
  "email": "beneb.info@gmail.com",
23
- "url": "http://beneb.info"
31
+ "url": "https://beneb.info"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "cssnano/cssnano"
24
36
  },
25
- "repository": "cssnano/cssnano",
26
37
  "dependencies": {
27
38
  "postcss-value-parser": "^4.2.0",
28
- "cssnano-utils": "^6.0.1"
39
+ "cssnano-utils": "^6.0.2"
29
40
  },
30
41
  "bugs": {
31
42
  "url": "https://github.com/cssnano/cssnano/issues"
@@ -34,9 +45,9 @@
34
45
  "node": "^22.11.0 || ^24.11.0 || >=26.0"
35
46
  },
36
47
  "devDependencies": {
37
- "postcss": "^8.5.15"
48
+ "postcss": "^8.5.25"
38
49
  },
39
50
  "peerDependencies": {
40
- "postcss": "^8.5.15"
51
+ "postcss": "^8.5.25"
41
52
  }
42
53
  }
package/src/index.js CHANGED
@@ -2,6 +2,10 @@
2
2
  const valueParser = require('postcss-value-parser');
3
3
  const { sameParent } = require('cssnano-utils');
4
4
 
5
+ const keyframesRegex = /keyframes/i;
6
+ const animationRegex = /animation/i;
7
+ const counterStyleRegex = /counter-style/i;
8
+ const listStyleSystemRegex = /(list-style|system)/i;
5
9
  /**
6
10
  * @param {Record<string, string>} obj
7
11
  * @return {(key: string) => string}
@@ -15,11 +19,7 @@ function canonical(obj) {
15
19
  * @return {string}
16
20
  */
17
21
  return function recurse(key) {
18
- if (
19
- Object.prototype.hasOwnProperty.call(obj, key) &&
20
- obj[key] !== key &&
21
- stack
22
- ) {
22
+ if (Object.hasOwn(obj, key) && obj[key] !== key && stack) {
23
23
  stack--;
24
24
 
25
25
  return recurse(obj[key]);
@@ -38,8 +38,8 @@ function canonical(obj) {
38
38
  function mergeAtRules(css) {
39
39
  const pairs = [
40
40
  {
41
- atrule: /keyframes/i,
42
- decl: /animation/i,
41
+ atrule: keyframesRegex,
42
+ decl: animationRegex,
43
43
  /** @type {import('postcss').AtRule[]} */
44
44
  cache: [],
45
45
  replacements: {},
@@ -49,8 +49,8 @@ function mergeAtRules(css) {
49
49
  removals: [],
50
50
  },
51
51
  {
52
- atrule: /counter-style/i,
53
- decl: /(list-style|system)/i,
52
+ atrule: counterStyleRegex,
53
+ decl: listStyleSystemRegex,
54
54
  cache: [],
55
55
  replacements: {},
56
56
  decls: [],
@@ -116,7 +116,7 @@ function mergeAtRules(css) {
116
116
  });
117
117
 
118
118
  pairs.forEach((pair) => {
119
- let canon = canonical(pair.replacements);
119
+ const canon = canonical(pair.replacements);
120
120
 
121
121
  pair.decls.forEach((decl) => {
122
122
  decl.value = valueParser(decl.value)
@@ -132,13 +132,14 @@ function mergeAtRules(css) {
132
132
  }
133
133
 
134
134
  /**
135
- * @type {import('postcss').PluginCreator<void>}
136
135
  * @return {import('postcss').Plugin}
137
136
  */
138
137
  function pluginCreator() {
139
138
  return {
140
139
  postcssPlugin: 'postcss-merge-idents',
141
-
140
+ /**
141
+ * @param {import('postcss').Root} css
142
+ */
142
143
  OnceExit(css) {
143
144
  mergeAtRules(css);
144
145
  },
@@ -146,4 +147,6 @@ function pluginCreator() {
146
147
  }
147
148
 
148
149
  pluginCreator.postcss = true;
149
- module.exports = pluginCreator;
150
+ module.exports = /** @type {import('postcss').PluginCreator<void>} */ (
151
+ pluginCreator
152
+ );
package/types/index.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- export = pluginCreator;
2
- /**
3
- * @type {import('postcss').PluginCreator<void>}
4
- * @return {import('postcss').Plugin}
5
- */
6
- declare function pluginCreator(): import("postcss").Plugin;
7
- declare namespace pluginCreator {
8
- let postcss: true;
9
- }
1
+ declare const _exports: import("postcss").PluginCreator<void>;
2
+ export = _exports;
10
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAqIA;;;GAGG;AACH,kCAFY,OAAO,SAAS,EAAE,MAAM,CAUnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}