From 06823fbf1c2e763a5bf76c3990ca98fbbcd98691 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 14 May 2024 14:05:49 +0800 Subject: updated node_modules --- .../postcss-normalize-unicode/src/index.js | 30 +++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'node_modules/postcss-normalize-unicode/src') 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} + * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions + * @typedef {Pick} BrowserslistOptions + * @typedef {AutoprefixerOptions & BrowserslistOptions} Options + */ + +/** + * @type {import('postcss').PluginCreator} + * @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 { -- cgit v1.2.3