diff options
Diffstat (limited to 'node_modules/postcss-normalize-unicode')
| -rw-r--r-- | node_modules/postcss-normalize-unicode/package.json | 6 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-unicode/src/index.js | 30 | ||||
| -rw-r--r-- | node_modules/postcss-normalize-unicode/types/index.d.ts | 20 |
3 files changed, 41 insertions, 15 deletions
diff --git a/node_modules/postcss-normalize-unicode/package.json b/node_modules/postcss-normalize-unicode/package.json index 26347735..8333e018 100644 --- a/node_modules/postcss-normalize-unicode/package.json +++ b/node_modules/postcss-normalize-unicode/package.json @@ -1,6 +1,6 @@ { "name": "postcss-normalize-unicode", - "version": "6.0.2", + "version": "6.1.0", "description": "Normalize unicode-range descriptors, and can convert to wildcard ranges.", "main": "src/index.js", "types": "types/index.d.ts", @@ -23,7 +23,7 @@ }, "repository": "cssnano/cssnano", "dependencies": { - "browserslist": "^4.22.2", + "browserslist": "^4.23.0", "postcss-value-parser": "^4.2.0" }, "bugs": { @@ -33,7 +33,7 @@ "node": "^14 || ^16 || >=18.0" }, "devDependencies": { - "postcss": "^8.4.32" + "postcss": "^8.4.35" }, "peerDependencies": { "postcss": "^8.4.31" diff --git a/node_modules/postcss-normalize-unicode/src/index.js b/node_modules/postcss-normalize-unicode/src/index.js index d8a562b8..2285fc52 100644 --- a/node_modules/postcss-normalize-unicode/src/index.js +++ b/node_modules/postcss-normalize-unicode/src/index.js @@ -1,4 +1,5 @@ 'use strict'; +const { dirname } = require('path'); const browserslist = require('browserslist'); const valueParser = require('postcss-value-parser'); @@ -89,21 +90,32 @@ function transform(value, isLegacy = false) { } /** - * @type {import('postcss').PluginCreator<void>} + * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions + * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions + * @typedef {AutoprefixerOptions & BrowserslistOptions} Options + */ + +/** + * @type {import('postcss').PluginCreator<Options>} + * @param {Options} opts * @return {import('postcss').Plugin} */ -function pluginCreator() { +function pluginCreator(opts = {}) { return { postcssPlugin: 'postcss-normalize-unicode', - /** @param {import('postcss').Result & {opts: browserslist.Options}} result*/ + + /** + * @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result + */ prepare(result) { - const cache = new Map(); - const resultOpts = result.opts || {}; - const browsers = browserslist(null, { - stats: resultOpts.stats, - path: __dirname, - env: resultOpts.env, + const { stats, env, from, file } = result.opts || {}; + const browsers = browserslist(opts.overrideBrowserslist, { + stats: opts.stats || stats, + path: opts.path || dirname(from || file || __filename), + env: opts.env || env, }); + + const cache = new Map(); const isLegacy = browsers.some(hasLowerCaseUPrefixBug); return { diff --git a/node_modules/postcss-normalize-unicode/types/index.d.ts b/node_modules/postcss-normalize-unicode/types/index.d.ts index 4443a311..9d7777f9 100644 --- a/node_modules/postcss-normalize-unicode/types/index.d.ts +++ b/node_modules/postcss-normalize-unicode/types/index.d.ts @@ -1,9 +1,23 @@ export = pluginCreator; /** - * @type {import('postcss').PluginCreator<void>} + * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions + * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions + * @typedef {AutoprefixerOptions & BrowserslistOptions} Options + */ +/** + * @type {import('postcss').PluginCreator<Options>} + * @param {Options} opts * @return {import('postcss').Plugin} */ -declare function pluginCreator(): import('postcss').Plugin; +declare function pluginCreator(opts?: Options): import('postcss').Plugin; declare namespace pluginCreator { - let postcss: true; + export { postcss, AutoprefixerOptions, BrowserslistOptions, Options }; } +type Options = AutoprefixerOptions & BrowserslistOptions; +declare var postcss: true; +type AutoprefixerOptions = { + overrideBrowserslist?: string | string[]; +}; +type BrowserslistOptions = Pick<browserslist.Options, 'stats' | 'path' | 'env'>; +import browserslist = require("browserslist"); +//# sourceMappingURL=index.d.ts.map
\ No newline at end of file |
