postcss-unique-selectors 8.0.3 → 9.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/package.json CHANGED
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "postcss-unique-selectors",
3
- "version": "8.0.3",
3
+ "version": "9.0.0",
4
4
  "description": "Ensure CSS selectors are unique.",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./types/index.d.ts",
8
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"
9
+ }
14
10
  },
15
11
  "files": [
16
12
  "LICENSE-MIT",
@@ -31,7 +27,7 @@
31
27
  },
32
28
  "repository": {
33
29
  "type": "git",
34
- "url": "cssnano/cssnano"
30
+ "url": "git+https://github.com/cssnano/cssnano.git"
35
31
  },
36
32
  "dependencies": {
37
33
  "postcss-selector-parser": "^7.1.5"
@@ -40,7 +36,7 @@
40
36
  "url": "https://github.com/cssnano/cssnano/issues"
41
37
  },
42
38
  "engines": {
43
- "node": "^22.11.0 || ^24.11.0 || >=26.0"
39
+ "node": "^22.22.3 || ^24.15.0 || >=26.0"
44
40
  },
45
41
  "devDependencies": {
46
42
  "postcss": "^8.5.26"
@@ -48,6 +44,7 @@
48
44
  "peerDependencies": {
49
45
  "postcss": "^8.5.26"
50
46
  },
47
+ "type": "module",
51
48
  "scripts": {
52
49
  "test": "node --test"
53
50
  }
package/src/index.js CHANGED
@@ -1,5 +1,4 @@
1
- 'use strict';
2
- const selectorParser = require('postcss-selector-parser');
1
+ import selectorParser from 'postcss-selector-parser';
3
2
 
4
3
  /**
5
4
  * @param {string} selectors
@@ -15,19 +14,6 @@ function generateUniqueSelector(selectors) {
15
14
  // Without comments the node's own toString is already a usable key.
16
15
  const hasComments = selectors.includes('/*');
17
16
 
18
- /**
19
- *
20
- * @param {string[]} param0
21
- * @param {string[]} param1
22
- * @returns {number}
23
- */
24
- function sortSelectors([a], [b]) {
25
- if (a > b) {
26
- return 1;
27
- } else {
28
- return a < b ? -1 : 0;
29
- }
30
- }
31
17
  /** @type {selectorParser.SyncProcessor<void>} */
32
18
  const collectUniqueSelectors = (selNode) => {
33
19
  for (const node of selNode.nodes) {
@@ -65,7 +51,13 @@ function generateUniqueSelector(selectors) {
65
51
  selectorParser(collectUniqueSelectors).processSync(selectors);
66
52
 
67
53
  return [...uniqueSelectors.entries()]
68
- .sort(sortSelectors)
54
+ .toSorted(([a], [b]) => {
55
+ if (a > b) {
56
+ return 1;
57
+ } else {
58
+ return a < b ? -1 : 0;
59
+ }
60
+ })
69
61
  .map(([, selector]) => selector)
70
62
  .join();
71
63
  }
@@ -91,8 +83,8 @@ function pluginCreator() {
91
83
  },
92
84
  };
93
85
  }
94
-
86
+ /** @type {true} */
95
87
  pluginCreator.postcss = true;
96
- module.exports = /** @type {import('postcss').PluginCreator<void>} */ (
97
- pluginCreator
98
- );
88
+ const moduleExports = pluginCreator;
89
+
90
+ export { moduleExports as default, moduleExports as 'module.exports' };
package/types/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
- declare const _exports: import("postcss").PluginCreator<void>;
2
- export = _exports;
1
+ /**
2
+ * @return {import('postcss').Plugin}
3
+ */
4
+ declare function pluginCreator(): import('postcss').Plugin;
5
+ declare namespace pluginCreator {
6
+ var postcss: true;
7
+ }
8
+ declare const moduleExports: typeof pluginCreator;
9
+ export { moduleExports as default, moduleExports as 'module.exports' };
3
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA+DA;;GAEG;AACH,iBAAS,aAAa,IAFV,OAAO,SAAS,EAAE,MAAM,CAoBnC;kBAlBQ,aAAa;iBAmBX,IAAI;;AAEf,QAAA,MAAM,aAAa,sBAAgB,CAAC;AAEpC,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,CAAC"}