Deprecate --no-autoprefixer flag in the CLI (#11280)
* enable `--no-autoprefixer` test * handle `--no-autoprefixer` using lightningcss * bump default chrome version for lightningcss plugin * handle `map` being nullable * add `--no-autoprefixer` test including nesting * set Chrome to version 111 as a default value * resolve the output message when resolving the promise * deprecate `--no-autoprefixer` for the CLI * update changelog
This commit is contained in:
parent
88ab01c7f8
commit
04c4de1997
7 changed files with 41 additions and 24 deletions
|
|
@ -25,6 +25,10 @@ export async function build(args) {
|
|||
process.exit(9)
|
||||
}
|
||||
|
||||
if (args['--no-autoprefixer']) {
|
||||
console.error('[deprecation] The --no-autoprefixer flag is deprecated and has no effect.')
|
||||
}
|
||||
|
||||
// TODO: Reference the @config path here if exists
|
||||
let configPath = args['--config'] ? args['--config'] : resolveDefaultConfigPath()
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,13 @@ import { validateConfig } from '../../util/validateConfig'
|
|||
import { handleImportAtRules } from '../../lib/handleImportAtRules'
|
||||
import { flagEnabled } from '../../featureFlags'
|
||||
|
||||
async function lightningcss(shouldMinify, result, options = {}) {
|
||||
// TODO: handle --no-autoprefixer option if possible
|
||||
async function lightningcss(result, { map = true, minify = true } = {}) {
|
||||
try {
|
||||
let transformed = lightning.transform({
|
||||
filename: result.opts.from || 'input.css',
|
||||
code: Buffer.from(result.css, 'utf-8'),
|
||||
minify: shouldMinify,
|
||||
sourceMap: result.map === undefined ? options.map : !!result.map,
|
||||
minify,
|
||||
sourceMap: result.map === undefined ? map : !!result.map,
|
||||
inputSourceMap: result.map ? result.map.toString() : undefined,
|
||||
targets: lightning.browserslistToTargets(browserslist(pkg.browserslist)),
|
||||
drafts: {
|
||||
|
|
@ -46,7 +45,7 @@ async function lightningcss(shouldMinify, result, options = {}) {
|
|||
map: result.map
|
||||
? Object.assign(result.map, {
|
||||
toString() {
|
||||
return transformed.map.toString()
|
||||
return transformed.map?.toString()
|
||||
},
|
||||
})
|
||||
: result.map,
|
||||
|
|
@ -342,7 +341,12 @@ export async function createProcessor(args, cliConfigPath) {
|
|||
|
||||
return readInput()
|
||||
.then((css) => processor.process(css, options))
|
||||
.then((result) => lightningcss(!!args['--minify'], result, options))
|
||||
.then((result) =>
|
||||
lightningcss(result, {
|
||||
...options,
|
||||
minify: !!args['--minify'],
|
||||
})
|
||||
)
|
||||
.then((result) => {
|
||||
if (!state.watcher) {
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ let commands = {
|
|||
description: 'Path to a custom config file',
|
||||
},
|
||||
'--no-autoprefixer': {
|
||||
deprecated: true,
|
||||
type: Boolean,
|
||||
description: 'Disable autoprefixer',
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue