mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
refactor(babel-preset-app): use @babel/helper-compilation-targets
instead of deprecated api (#7071)
This commit is contained in:
parent
29587daf1f
commit
78bce82b2f
@ -11,6 +11,7 @@
|
||||
"main": "src/index.js",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.8.7",
|
||||
"@babel/helper-compilation-targets": "^7.8.7",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
"@babel/plugin-proposal-decorators": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.8.3",
|
||||
|
@ -4,7 +4,7 @@ const coreJsMeta = {
|
||||
es6: 'es6',
|
||||
es7: 'es7'
|
||||
},
|
||||
builtIns: '@babel/preset-env/data/built-ins.json.js'
|
||||
builtIns: '@babel/compat-data/corejs2-built-ins'
|
||||
},
|
||||
3: {
|
||||
prefixes: {
|
||||
@ -32,15 +32,20 @@ function getDefaultPolyfills (corejs) {
|
||||
}
|
||||
|
||||
function getPolyfills (targets, includes, { ignoreBrowserslistConfig, configPath, corejs }) {
|
||||
const { isPluginRequired } = require('@babel/preset-env')
|
||||
const { default: getTargets, isRequired } = require('@babel/helper-compilation-targets')
|
||||
const builtInsList = require(coreJsMeta[corejs.version].builtIns)
|
||||
const getTargets = require('@babel/preset-env/lib/targets-parser').default
|
||||
const builtInTargets = getTargets(targets, {
|
||||
ignoreBrowserslistConfig,
|
||||
configPath
|
||||
})
|
||||
|
||||
return includes.filter(item => isPluginRequired(builtInTargets, builtInsList[item]))
|
||||
return includes.filter(item => isRequired(
|
||||
'nuxt-polyfills',
|
||||
builtInTargets,
|
||||
{
|
||||
compatData: { 'nuxt-polyfills': builtInsList[item] }
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
module.exports = (api, options = {}) => {
|
||||
|
@ -255,11 +255,16 @@
|
||||
esutils "^2.0.2"
|
||||
js-tokens "^4.0.0"
|
||||
|
||||
"@babel/parser@7.7.5", "@babel/parser@^7.1.0", "@babel/parser@^7.7.0", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.8.7":
|
||||
"@babel/parser@^7.1.0", "@babel/parser@^7.7.0", "@babel/parser@^7.7.5":
|
||||
version "7.7.5"
|
||||
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71"
|
||||
integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==
|
||||
|
||||
"@babel/parser@^7.8.6", "@babel/parser@^7.8.7":
|
||||
version "7.8.7"
|
||||
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.8.7.tgz#7b8facf95d25fef9534aad51c4ffecde1a61e26a"
|
||||
integrity sha512-9JWls8WilDXFGxs0phaXAZgpxTZhSk/yOYH2hTHC0X1yC7Z78IJfvR1vJ+rmJKq3I35td2XzXzN6ZLYlna+r/A==
|
||||
|
||||
"@babel/plugin-proposal-async-generator-functions@^7.8.3":
|
||||
version "7.8.3"
|
||||
resolved "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f"
|
||||
|
Loading…
Reference in New Issue
Block a user