From a0c7ddfe341d0c332150ef6df89c4dd537f52a39 Mon Sep 17 00:00:00 2001 From: sunnylost Date: Thu, 24 Aug 2017 11:46:03 +0800 Subject: [PATCH] support postcss --- package.json | 2 + src/options.js | 3 + src/style/css.js | 135 +++++++++++----------- src/style/postcss.js | 25 ++++ test/expects/postcss.css | 6 + test/expects/postcss.js | 3 + test/expects/scoped-css-with-deep-tag.css | 17 ++- test/fixtures/postcss.vue | 8 ++ test/test.js | 38 +++--- yarn.lock | 134 +++++++++++++++++++++ 10 files changed, 281 insertions(+), 90 deletions(-) create mode 100644 src/style/postcss.js create mode 100644 test/expects/postcss.css create mode 100644 test/expects/postcss.js create mode 100644 test/fixtures/postcss.vue diff --git a/package.json b/package.json index 75c449e..22000a9 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "merge-options": "0.0.64", "parse5": "^2.1.0", "postcss": "^5.2.11", + "postcss-load-config": "^1.2.0", "postcss-modules": "^0.6.4", "postcss-selector-parser": "^2.2.3", "posthtml": "^0.9.2", @@ -55,6 +56,7 @@ "vue-template-validator": "^1.1.5" }, "devDependencies": { + "autoprefixer": "^7.1.2", "babel-eslint": "^7.1.1", "babel-plugin-transform-runtime": "^6.22.0", "babel-preset-es2015": "^6.22.0", diff --git a/src/options.js b/src/options.js index 0465531..a02d3a4 100644 --- a/src/options.js +++ b/src/options.js @@ -66,6 +66,9 @@ export default { // Config for stylus. stylus: {}, + // Config for postcss. + postcss: {}, + // Config for pug compiler. pug: {}, diff --git a/src/style/css.js b/src/style/css.js index 5053659..1dc9f84 100644 --- a/src/style/css.js +++ b/src/style/css.js @@ -1,4 +1,5 @@ import postcss from 'postcss' +import postcssLoadConfig from './postcss' import modules from 'postcss-modules' import selectorParser from 'postcss-selector-parser' import camelcase from 'camelcase' @@ -21,7 +22,7 @@ function isInvalidTag (tag) { } } -const addScopeID = postcss.plugin('add-scope-id', options => { +const addScopeID = postcss.plugin('add-scope-id', ({ scopeID }) => { const selectorTransformer = selectorParser(selectors => { selectors.each(selector => { let target = null @@ -55,7 +56,7 @@ const addScopeID = postcss.plugin('add-scope-id', options => { /* eslint-enable complexity */ target && selector.insertAfter(target, selectorParser.attribute({ - attribute: options.scopeID + attribute: scopeID })) }) }) @@ -78,25 +79,9 @@ function compileModule (code, map, source, options) { }, ...options.cssModules }) - ]).process(code, { map: { inline: false, prev: map }, from: source.id, to: source.id }) - .then( - result => ({ code: result.css, map: result.map.toString(), module: style }), - error => { - throw error - } - ) -} - -function compileScopedCSS (code, map, source, options) { - debug(`Scoped CSS: ${source.id}`) - - return postcss([ - addScopeID({ - scopeID: genScopeID(source.id) - }) ]).process(code, { map: { inline: false, prev: map }, from: source.id, to: source.id }) .then( - result => ({ code: result.css, map: result.map.toString() }), + result => ({ code: result.css, map: result.map.toString(), module: style }), error => { throw error } @@ -110,62 +95,72 @@ function escapeRegExp (str) { export default async function (promise, options) { const style = await promise debug(`CSS: ${style.id}`) - const { code, map } = ('$compiled' in style) ? style.$compiled : style - - if (style.module === true) { - return compileModule(code, map, style, options).then(compiled => { - if (style.$compiled) { - compiled.$prev = style.$compiled - - const classes = Object.keys(compiled.module) - const cssModule = {} - - if (classes.length) { - // Apply CSS modules to actual source. - // TODO: Update source map. - // const original = style.code - - style.code = classes.reduce( - (result, original) => { - const transformed = compiled.module[original] - cssModule[camelcase(original)] = transformed - cssModule[original] = transformed - - return result.replace(new RegExp(escapeRegExp(`.${original}`), 'g'), `.${transformed}`) - }, - style.code - ) - // style.map = (new MagicString(original)) - - compiled.module = ( - typeof (style.module) === 'string' && style.attrs.module.length - ) ? { [style.module]: cssModule } : cssModule - } - } - - style.$compiled = compiled - - return style - }).catch(error => debug(error)) + const {code, map} = ('$compiled' in style) ? style.$compiled : style + const initPostcssOptions = {map: {inline: false, prev: map}, from: style.id, to: style.id} + const hasModule = style.module === true + const hasScope = style.scoped === true + const postcssConfig = await postcssLoadConfig(options.postcss) + const plugins = postcssConfig.plugins || [] + let processPromise = Promise.resolve() + + if (hasScope) { + debug(`Scoped CSS: ${style.id}`) + plugins.push(addScopeID({ + scopeID: genScopeID(style.id) + })) } - if (style.scoped === true) { - return compileScopedCSS(code, map, style, options).then(compiled => { - if (style.$compiled) { - compiled.$prev = style.$compiled - } - - style.$compiled = compiled - - return style - }) + if (hasModule) { + // TODO: I found this plugin makes all postcss plugin run twice. + processPromise = compileModule(code, map, style, options) } - const output = { code, map, lang: 'css' } + const curOptions = Object.assign({}, postcssConfig.options, initPostcssOptions) - if (style.$compiled) output.$prev = style.$compiled + return processPromise.then(firstResult => { + const moduleNames = firstResult && firstResult.module + return postcss(plugins) + .process(firstResult ? firstResult.code : code, curOptions) + .then(result => { + const compiled = { + code: result.css, + map: result.map.toString() + } + if (style.$compiled) { + compiled.$prev = style.$compiled + } - style.$compiled = output + if (hasModule) { + const classes = Object.keys(moduleNames) + const cssModule = {} + + if (classes.length) { + // Apply CSS modules to actual source. + // TODO: Update source map. + // const original = style.code + + style.code = classes.reduce( + (result, original) => { + const transformed = moduleNames[original] + cssModule[camelcase(original)] = transformed + cssModule[original] = transformed + + return result.replace(new RegExp(escapeRegExp(`.${original}`), 'g'), `.${transformed}`) + }, + style.code + ) + // style.map = (new MagicString(original)) + + compiled.module = ( + typeof (style.module) === 'string' && style.attrs.module.length + ) ? {[style.module]: cssModule} : cssModule + } + } + + style.$compiled = compiled - return style + return style + }) + .catch(error => debug(error)) + }) } diff --git a/src/style/postcss.js b/src/style/postcss.js new file mode 100644 index 0000000..2e81e36 --- /dev/null +++ b/src/style/postcss.js @@ -0,0 +1,25 @@ +import postcssrc from 'postcss-load-config' + +export default async function (postcssOpt) { + let options = {} + let plugins = [] + + if (typeof postcssOpt === 'function') { + plugins = postcssOpt.call(this) + } else if (Array.isArray(postcssOpt)) { + plugins = plugins.concat(postcssOpt) + } else if (typeof postcssOpt === 'object') { + options = Object.assign({}, options, postcssOpt) + } + + return postcssrc().then((config) => { + if (config.plugins) { + plugins = plugins.concat(config.plugins) + } + + if (config.options) { + options = Object.assign(options, config.options) + } + return {plugins, options} + }).catch(() => { return {plugins, options} }) +} diff --git a/test/expects/postcss.css b/test/expects/postcss.css new file mode 100644 index 0000000..5df75be --- /dev/null +++ b/test/expects/postcss.css @@ -0,0 +1,6 @@ + +body { + display: -webkit-box; + display: -ms-flexbox; + display: flex; +} \ No newline at end of file diff --git a/test/expects/postcss.js b/test/expects/postcss.js new file mode 100644 index 0000000..2d3638f --- /dev/null +++ b/test/expects/postcss.js @@ -0,0 +1,3 @@ +var postcss = {}; + +export default postcss; \ No newline at end of file diff --git a/test/expects/scoped-css-with-deep-tag.css b/test/expects/scoped-css-with-deep-tag.css index bffe2ce..0d3fd81 100644 --- a/test/expects/scoped-css-with-deep-tag.css +++ b/test/expects/scoped-css-with-deep-tag.css @@ -6,7 +6,7 @@ background-color: red; } -@keyframes test { +@-webkit-keyframes test { 0% { color: red; } @@ -19,4 +19,17 @@ color: yellow; } } - + +@keyframes test { + 0% { + color: red; + } + + 50% { + color: green; + } + + 100% { + color: yellow; + } +} \ No newline at end of file diff --git a/test/fixtures/postcss.vue b/test/fixtures/postcss.vue new file mode 100644 index 0000000..2a63f09 --- /dev/null +++ b/test/fixtures/postcss.vue @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/test/test.js b/test/test.js index ca76a6c..d0bbcc6 100644 --- a/test/test.js +++ b/test/test.js @@ -5,6 +5,7 @@ var assert = require('assert') var fs = require('fs') var rollup = require('rollup') var path = require('path') +var autoprefixer = require('autoprefixer') process.chdir(__dirname) @@ -33,6 +34,7 @@ function test(name) { modules: { generateScopedName: '[name]__[local]' }, + postcss: [autoprefixer()], compileTemplate: [ 'compileTemplate', 'compileTemplateLocalComponent', @@ -49,23 +51,24 @@ function test(name) { // Check css output if ([ - 'css-modules', - 'css-modules-static', - 'import-scss', - 'import-less', - 'less', - 'pug', - 'scoped-css', - 'scoped-css-with-no-auto-style', - 'scoped-css-with-deep-tag', - 'scss', - 'sass', - 'pug', - 'less', - 'style', - 'stylus', - 'external-script' - ].indexOf(name) > -1) { + 'css-modules', + 'css-modules-static', + 'import-scss', + 'import-less', + 'less', + 'pug', + 'scoped-css', + 'scoped-css-with-no-auto-style', + 'scoped-css-with-deep-tag', + 'scss', + 'sass', + 'pug', + 'less', + 'style', + 'stylus', + 'external-script', + 'postcss' + ].indexOf(name) > -1) { var css = read('expects/' + name + '.css') assert.equal(css.trim(), actualCss.trim(), 'should output style tag content') } else if (['no-css-extract'].indexOf(name) > -1) { @@ -114,4 +117,3 @@ describe('styleToImports', function () { }) }) }) - diff --git a/yarn.lock b/yarn.lock index fda696f..e09ecf6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -67,6 +67,12 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.1.0: + version "3.2.0" + resolved "http://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + aproba@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.0.4.tgz#2713680775e7614c8ba186c065d4e2e52d1072c0" @@ -148,6 +154,17 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" +autoprefixer@^7.1.2: + version "7.1.2" + resolved "http://registry.npm.taobao.org/autoprefixer/download/autoprefixer-7.1.2.tgz#fbeaf07d48fd878e0682bf7cbeeade728adb2b18" + dependencies: + browserslist "^2.1.5" + caniuse-lite "^1.0.30000697" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + postcss "^6.0.6" + postcss-value-parser "^3.2.3" + aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" @@ -758,6 +775,13 @@ browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" +browserslist@^2.1.5: + version "2.3.3" + resolved "http://registry.npm.taobao.org/browserslist/download/browserslist-2.3.3.tgz#2b0cabc4d28489f682598605858a0782f14b154c" + dependencies: + caniuse-lite "^1.0.30000715" + electron-to-chromium "^1.3.18" + buble@^0.15.0: version "0.15.2" resolved "https://registry.yarnpkg.com/buble/-/buble-0.15.2.tgz#547fc47483f8e5e8176d82aa5ebccb183b02d613" @@ -818,6 +842,10 @@ camelcase@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.0.0.tgz#8b0f90d44be5e281b903b9887349b92595ef07f2" +caniuse-lite@^1.0.30000697, caniuse-lite@^1.0.30000715: + version "1.0.30000717" + resolved "http://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30000717.tgz#4539b126af787c1d4851944de22b2bd8780d3612" + caseless@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" @@ -839,6 +867,14 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^2.1.0: + version "2.1.0" + resolved "http://registry.npm.taobao.org/chalk/download/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + character-parser@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/character-parser/-/character-parser-2.2.0.tgz#c7ce28f36d4bcd9744e5ffc2c5fcde1c73261fc0" @@ -904,6 +940,16 @@ coffeescript-compiler@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/coffeescript-compiler/-/coffeescript-compiler-0.1.1.tgz#81a8bd44a78bda421f7e0b51f28d13c853beb805" +color-convert@^1.9.0: + version "1.9.0" + resolved "http://registry.npm.taobao.org/color-convert/download/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "http://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" @@ -957,6 +1003,18 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +cosmiconfig@^2.1.0, cosmiconfig@^2.1.1: + version "2.2.2" + resolved "http://registry.npm.taobao.org/cosmiconfig/download/cosmiconfig-2.2.2.tgz#6173cebd56fac042c1f4390edf7af6c07c7cb892" + dependencies: + is-directory "^0.3.1" + js-yaml "^3.4.3" + minimist "^1.2.0" + object-assign "^4.1.0" + os-homedir "^1.0.1" + parse-json "^2.2.0" + require-from-string "^1.1.0" + coveralls@^2.11.15: version "2.11.16" resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-2.11.16.tgz#da9061265142ddee954f68379122be97be8ab4b1" @@ -1124,6 +1182,10 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" +electron-to-chromium@^1.3.18: + version "1.3.18" + resolved "http://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.18.tgz#3dcc99da3e6b665f6abbc71c28ad51a2cd731a9c" + emojis-list@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" @@ -1288,6 +1350,10 @@ esprima@2.7.x, esprima@^2.6.0, esprima@^2.7.1: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" +esprima@^4.0.0: + version "4.0.0" + resolved "http://registry.npm.taobao.org/esprima/download/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + esrecurse@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" @@ -1606,6 +1672,10 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +has-flag@^2.0.0: + version "2.0.0" + resolved "http://registry.npm.taobao.org/has-flag/download/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -1761,6 +1831,10 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" +is-directory@^0.3.1: + version "0.3.1" + resolved "http://registry.npm.taobao.org/is-directory/download/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + is-dotfile@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.2.tgz#2c132383f39199f8edc268ca01b9b007d205cc4d" @@ -1946,6 +2020,13 @@ js-yaml@3.6.1, js-yaml@3.x, js-yaml@^3.5.1: argparse "^1.0.7" esprima "^2.6.0" +js-yaml@^3.4.3: + version "3.9.1" + resolved "http://registry.npm.taobao.org/js-yaml/download/js-yaml-3.9.1.tgz#08775cebdfdd359209f0d2acd383c8f86a6904a0" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd" @@ -2368,6 +2449,10 @@ normalize-path@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a" +normalize-range@^0.1.2: + version "0.1.2" + resolved "http://registry.npm.taobao.org/normalize-range/download/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" + "npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f" @@ -2377,6 +2462,10 @@ normalize-path@^2.0.1: gauge "~2.7.1" set-blocking "~2.0.0" +num2fraction@^1.2.2: + version "1.2.2" + resolved "http://registry.npm.taobao.org/num2fraction/download/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" + number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -2510,6 +2599,29 @@ pluralize@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" +postcss-load-config@^1.2.0: + version "1.2.0" + resolved "http://registry.npm.taobao.org/postcss-load-config/download/postcss-load-config-1.2.0.tgz#539e9afc9ddc8620121ebf9d8c3673e0ce50d28a" + dependencies: + cosmiconfig "^2.1.0" + object-assign "^4.1.0" + postcss-load-options "^1.2.0" + postcss-load-plugins "^2.3.0" + +postcss-load-options@^1.2.0: + version "1.2.0" + resolved "http://registry.npm.taobao.org/postcss-load-options/download/postcss-load-options-1.2.0.tgz#b098b1559ddac2df04bc0bb375f99a5cfe2b6d8c" + dependencies: + cosmiconfig "^2.1.0" + object-assign "^4.1.0" + +postcss-load-plugins@^2.3.0: + version "2.3.0" + resolved "http://registry.npm.taobao.org/postcss-load-plugins/download/postcss-load-plugins-2.3.0.tgz#745768116599aca2f009fad426b00175049d8d92" + dependencies: + cosmiconfig "^2.1.1" + object-assign "^4.1.0" + postcss-modules-extract-imports@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.0.0.tgz#5b07f368e350cda6fd5c8844b79123a7bd3e37be" @@ -2554,6 +2666,10 @@ postcss-selector-parser@^2.2.3: indexes-of "^1.0.1" uniq "^1.0.1" +postcss-value-parser@^3.2.3: + version "3.3.0" + resolved "http://registry.npm.taobao.org/postcss-value-parser/download/postcss-value-parser-3.3.0.tgz#87f38f9f18f774a4ab4c8a232f5c5ce8872a9d15" + postcss@5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.1.2.tgz#bd84886a66bcad489afaf7c673eed5ef639551e2" @@ -2571,6 +2687,14 @@ postcss@^5.0.14, postcss@^5.0.4, postcss@^5.2.11, postcss@^5.2.8: source-map "^0.5.6" supports-color "^3.2.3" +postcss@^6.0.6: + version "6.0.9" + resolved "http://registry.npm.taobao.org/postcss/download/postcss-6.0.9.tgz#54819766784a51c65b1ec4d54c2f93765438c35a" + dependencies: + chalk "^2.1.0" + source-map "^0.5.6" + supports-color "^4.2.1" + posthtml-attrs-parser@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/posthtml-attrs-parser/-/posthtml-attrs-parser-0.1.1.tgz#cc33e00155fb99ba96f67e25e330461f05742ac8" @@ -2881,6 +3005,10 @@ require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" +require-from-string@^1.1.0: + version "1.2.1" + resolved "http://registry.npm.taobao.org/require-from-string/download/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" + require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" @@ -3176,6 +3304,12 @@ supports-color@^3.1.0, supports-color@^3.1.2, supports-color@^3.2.3: dependencies: has-flag "^1.0.0" +supports-color@^4.0.0, supports-color@^4.2.1: + version "4.2.1" + resolved "http://registry.npm.taobao.org/supports-color/download/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836" + dependencies: + has-flag "^2.0.0" + table@^3.7.8: version "3.8.3" resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f"