babel-preset-o
Advanced tools
Comparing version 0.1.3 to 0.2.0
49
index.js
const path = require('path') | ||
const isDev = process.env.NODE_ENV === 'development' | ||
module.exports = (api, options = {}) => { | ||
const nodeEnv = process.env.NODE_ENV | ||
const isDev = nodeEnv === 'development' | ||
module.exports = () => { | ||
let absoluteRuntime = null | ||
try { | ||
absoluteRuntime = path.dirname( | ||
require.resolve('@babel/runtime/package.json') | ||
) | ||
} catch (_) {} | ||
const { | ||
nodeVersion = 'current', | ||
modules = false, | ||
useBuiltIns = false, | ||
} = options | ||
return { | ||
@@ -13,7 +27,9 @@ presets: [ | ||
loose: true, | ||
useBuiltIns: isDev && 'usage', | ||
corejs: useBuiltIns ? 3 : false, | ||
modules, | ||
useBuiltIns, | ||
targets: { | ||
node: 'current', | ||
esmodules: true, | ||
node: nodeVersion, | ||
}, | ||
exclude: ['@babel/plugin-transform-typeof-symbol'], | ||
}, | ||
@@ -27,2 +43,13 @@ ], | ||
], | ||
isDev && [ | ||
require('@babel/plugin-transform-runtime').default, | ||
{ | ||
corejs: false, | ||
helpers: isDev, | ||
regenerator: true, | ||
useESModules: false, | ||
version: require('@babel/runtime/package.json').version, | ||
absoluteRuntime, | ||
} | ||
], | ||
[ | ||
@@ -33,13 +60,7 @@ require("@babel/plugin-proposal-optional-chaining").default, | ||
[ | ||
require('@babel/plugin-transform-runtime').default, | ||
{ | ||
regenerator: true, | ||
version: require('@babel/runtime/package.json').version, | ||
absoluteRuntime: path.dirname( | ||
require.resolve('@babel/runtime/package.json') | ||
), | ||
} | ||
require("@babel/plugin-proposal-nullish-coalescing-operator").default, | ||
{ loose: true }, | ||
] | ||
], | ||
].filter(Boolean), | ||
}; | ||
}; |
{ | ||
"name": "babel-preset-o", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "tiny and flexible babel preset", | ||
@@ -12,2 +12,3 @@ "main": "index.js", | ||
"@babel/plugin-proposal-class-properties": "7.12.1", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.12.1", | ||
"@babel/plugin-proposal-optional-chaining": "7.12.7", | ||
@@ -14,0 +15,0 @@ "@babel/plugin-transform-runtime": "7.12.10", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2305
59
7
+ Added@babel/plugin-proposal-nullish-coalescing-operator@7.12.1
+ Added@babel/plugin-proposal-nullish-coalescing-operator@7.12.1(transitive)
- Removed@babel/plugin-proposal-nullish-coalescing-operator@7.18.6(transitive)