postcss-normalize-unicode 6.0.2 → 6.1.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,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-normalize-unicode",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "description": "Normalize unicode-range descriptors, and can convert to wildcard ranges.",
5
5
  "main": "src/index.js",
6
6
  "types": "types/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "repository": "cssnano/cssnano",
25
25
  "dependencies": {
26
- "browserslist": "^4.22.2",
26
+ "browserslist": "^4.23.0",
27
27
  "postcss-value-parser": "^4.2.0"
28
28
  },
29
29
  "bugs": {
@@ -33,7 +33,7 @@
33
33
  "node": "^14 || ^16 || >=18.0"
34
34
  },
35
35
  "devDependencies": {
36
- "postcss": "^8.4.32"
36
+ "postcss": "^8.4.35"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "postcss": "^8.4.31"
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ const { dirname } = require('path');
2
3
  const browserslist = require('browserslist');
3
4
  const valueParser = require('postcss-value-parser');
4
5
 
@@ -89,21 +90,32 @@ function transform(value, isLegacy = false) {
89
90
  }
90
91
 
91
92
  /**
92
- * @type {import('postcss').PluginCreator<void>}
93
+ * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
94
+ * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions
95
+ * @typedef {AutoprefixerOptions & BrowserslistOptions} Options
96
+ */
97
+
98
+ /**
99
+ * @type {import('postcss').PluginCreator<Options>}
100
+ * @param {Options} opts
93
101
  * @return {import('postcss').Plugin}
94
102
  */
95
- function pluginCreator() {
103
+ function pluginCreator(opts = {}) {
96
104
  return {
97
105
  postcssPlugin: 'postcss-normalize-unicode',
98
- /** @param {import('postcss').Result & {opts: browserslist.Options}} result*/
106
+
107
+ /**
108
+ * @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result
109
+ */
99
110
  prepare(result) {
100
- const cache = new Map();
101
- const resultOpts = result.opts || {};
102
- const browsers = browserslist(null, {
103
- stats: resultOpts.stats,
104
- path: __dirname,
105
- env: resultOpts.env,
111
+ const { stats, env, from, file } = result.opts || {};
112
+ const browsers = browserslist(opts.overrideBrowserslist, {
113
+ stats: opts.stats || stats,
114
+ path: opts.path || dirname(from || file || __filename),
115
+ env: opts.env || env,
106
116
  });
117
+
118
+ const cache = new Map();
107
119
  const isLegacy = browsers.some(hasLowerCaseUPrefixBug);
108
120
 
109
121
  return {
package/types/index.d.ts CHANGED
@@ -1,9 +1,23 @@
1
1
  export = pluginCreator;
2
2
  /**
3
- * @type {import('postcss').PluginCreator<void>}
3
+ * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
4
+ * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions
5
+ * @typedef {AutoprefixerOptions & BrowserslistOptions} Options
6
+ */
7
+ /**
8
+ * @type {import('postcss').PluginCreator<Options>}
9
+ * @param {Options} opts
4
10
  * @return {import('postcss').Plugin}
5
11
  */
6
- declare function pluginCreator(): import('postcss').Plugin;
12
+ declare function pluginCreator(opts?: Options): import('postcss').Plugin;
7
13
  declare namespace pluginCreator {
8
- let postcss: true;
14
+ export { postcss, AutoprefixerOptions, BrowserslistOptions, Options };
9
15
  }
16
+ type Options = AutoprefixerOptions & BrowserslistOptions;
17
+ declare var postcss: true;
18
+ type AutoprefixerOptions = {
19
+ overrideBrowserslist?: string | string[];
20
+ };
21
+ type BrowserslistOptions = Pick<browserslist.Options, 'stats' | 'path' | 'env'>;
22
+ import browserslist = require("browserslist");
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AA2FA;;;;GAIG;AAEH;;;;GAIG;AACH,sCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CAwCnC;;;;eA9CY,mBAAmB,GAAG,mBAAmB;;2BAFzC;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE;2BAC5C,KAAK,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC"}