diff options
Diffstat (limited to 'node_modules/postcss-reduce-initial/src')
| -rw-r--r-- | node_modules/postcss-reduce-initial/src/data/fromInitial.json | 7 | ||||
| -rw-r--r-- | node_modules/postcss-reduce-initial/src/index.js | 26 |
2 files changed, 20 insertions, 13 deletions
diff --git a/node_modules/postcss-reduce-initial/src/data/fromInitial.json b/node_modules/postcss-reduce-initial/src/data/fromInitial.json index 459c965c..0bc22813 100644 --- a/node_modules/postcss-reduce-initial/src/data/fromInitial.json +++ b/node_modules/postcss-reduce-initial/src/data/fromInitial.json @@ -1,5 +1,4 @@ { - "-webkit-line-clamp": "none", "accent-color": "auto", "align-content": "normal", "align-items": "normal", @@ -26,7 +25,6 @@ "background-position-x": "0%", "background-position-y": "0%", "background-repeat": "repeat", - "block-overflow": "clip", "block-size": "auto", "border-block-style": "none", "border-block-width": "medium", @@ -182,7 +180,7 @@ "mask-border-width": "auto", "mask-composite": "add", "mask-image": "none", - "mask-position": "center", + "mask-position": "0% 0%", "mask-repeat": "repeat", "mask-size": "auto", "masonry-auto-flow": "pack", @@ -203,7 +201,7 @@ "offset-anchor": "auto", "offset-distance": "0", "offset-path": "none", - "offset-position": "auto", + "offset-position": "normal", "offset-rotate": "auto", "opacity": "1", "order": "0", @@ -313,7 +311,6 @@ "view-timeline-name": "none", "view-transition-name": "none", "white-space": "normal", - "white-space-trim": "none", "widows": "2", "width": "auto", "will-change": "auto", diff --git a/node_modules/postcss-reduce-initial/src/index.js b/node_modules/postcss-reduce-initial/src/index.js index 5432f7fe..90d18a71 100644 --- a/node_modules/postcss-reduce-initial/src/index.js +++ b/node_modules/postcss-reduce-initial/src/index.js @@ -1,14 +1,21 @@ 'use strict'; +const { dirname } = require('path'); const browserslist = require('browserslist'); const { isSupported } = require('caniuse-api'); const fromInitial = require('./data/fromInitial.json'); const toInitial = require('./data/toInitial.json'); +const ignoreProps = require('./lib/ignoreProps.js'); const initial = 'initial'; // In most of the browser including chrome the initial for `writing-mode` is not `horizontal-tb`. Ref https://github.com/cssnano/cssnano/pull/905 -const defaultIgnoreProps = ['writing-mode', 'transform-box']; -/** @typedef {{ignore?: string[]}} Options */ +const defaultIgnoreProps = ignoreProps; + +/** + * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions + * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions + * @typedef {{ignore?: string[]} & AutoprefixerOptions & BrowserslistOptions} Options + */ /** * @type {import('postcss').PluginCreator<Options>} @@ -18,13 +25,16 @@ const defaultIgnoreProps = ['writing-mode', 'transform-box']; function pluginCreator(options = {}) { return { postcssPlugin: 'postcss-reduce-initial', - /** @param {import('postcss').Result & {opts: browserslist.Options & {ignore?: string[]}}} result */ + + /** + * @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result + */ prepare(result) { - 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(options.overrideBrowserslist, { + stats: options.stats || stats, + path: options.path || dirname(from || file || __filename), + env: options.env || env, }); const initialSupport = isSupported('css-initial-value', browsers); |
