babel-preset-kyt-core
Advanced tools
Comparing version 0.2.1-env2.beta.1 to 0.3.0-alpha.1
@@ -0,1 +1,3 @@ | ||
/* eslint-disable vars-on-top */ | ||
var babelPresetEnv = require('babel-preset-env'); | ||
@@ -6,6 +8,52 @@ var babelTransformRuntime = require('babel-plugin-transform-runtime'); | ||
module.exports = function getPresetCore(context, opts = {}) { | ||
module.exports = function getPresetCore(context, opts) { | ||
opts = opts || {}; | ||
var userEnvOptions = opts.envOptions || {}; | ||
var envOptions = {}; | ||
var clientEnvOptions = { | ||
modules: false, | ||
uglify: true, | ||
targets: { | ||
browsers: ['>1%', 'last 4 versions', 'not ie < 11'], | ||
}, | ||
}; | ||
var serverEnvOptions = { | ||
modules: false, | ||
targets: { | ||
node: true, | ||
}, | ||
}; | ||
// Derive the babel-preset-env options based on the type of environment | ||
// we are in, client or server. Give the ability to users to override | ||
// the default environments in their own configurations, for example: | ||
// | ||
// "presets": [["kyt-core", { | ||
// "envOptions": { | ||
// "client": { ... }, | ||
// "server": { ... } | ||
// } | ||
// }]] | ||
// | ||
if (process.env.KYT_ENV_TYPE === 'client') { | ||
envOptions = Object.assign( | ||
{}, | ||
clientEnvOptions, | ||
userEnvOptions.client ? userEnvOptions.client : {} | ||
); | ||
} else if (process.env.KYT_ENV_TYPE === 'server') { | ||
envOptions = Object.assign( | ||
{}, | ||
serverEnvOptions, | ||
userEnvOptions.server ? userEnvOptions.server : {} | ||
); | ||
} else { | ||
envOptions = clientEnvOptions; | ||
} | ||
return { | ||
// modules are handled by webpack, don't transform them | ||
presets: [[babelPresetEnv, { modules: false }]], | ||
presets: [[babelPresetEnv, envOptions]], | ||
@@ -20,5 +68,3 @@ // provide the ability to opt into babel-plugin-transform-runtime inclusion | ||
test: { | ||
plugins: [ | ||
[babelTransformModules, { loose: true }], | ||
], | ||
plugins: [[babelTransformModules, { loose: true }]], | ||
}, | ||
@@ -25,0 +71,0 @@ }, |
{ | ||
"name": "babel-preset-kyt-core", | ||
"version": "0.2.1-env2.beta.1", | ||
"version": "0.3.0-alpha.1", | ||
"description": "An opinionated babel preset, best used with kyt", | ||
@@ -13,14 +13,8 @@ "main": "lib/index.js", | ||
"babel-plugin-syntax-dynamic-import": "6.18.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "6.24.1", | ||
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0", | ||
"babel-plugin-transform-runtime": "6.23.0", | ||
"babel-preset-env": "1.4.0" | ||
"babel-preset-env": "1.6.0" | ||
}, | ||
"keywords": [ | ||
"babel", | ||
"babel-preset", | ||
"kyt" | ||
], | ||
"files": [ | ||
"lib" | ||
] | ||
"keywords": ["babel", "babel-preset", "kyt"], | ||
"files": ["lib"] | ||
} |
@@ -29,4 +29,62 @@ ## babel-preset-kyt-core | ||
### `0.3.0-alpha.1` - 09/13/17 | ||
- Replaces `babel-preset-latest` with `babel-preset-env`. By default, the following `client` preset-env browser targets are used: | ||
``` | ||
modules: false, | ||
targets: { | ||
browsers: ['>1%', 'last 4 versions', 'not ie < 11'] | ||
} | ||
``` | ||
Which at the timing of this release, targets the following browsers/OSs: | ||
``` | ||
{ | ||
"chrome": "49", | ||
"android": "4.2", | ||
"edge": "12", | ||
"firefox": "52", | ||
"ie": "11", | ||
"ios": "9", | ||
"safari": "9" | ||
} | ||
``` | ||
If you need to target the `server`, then you can set `process.env.KYT_ENV_TYPE` to `server`. The following preset-env server targets are used: | ||
``` | ||
modules: false, | ||
targets: { | ||
node: true | ||
} | ||
``` | ||
You can extend the default preset-env `client`/`server` targets by passing in your own options into a .babelrc configuration under a `envOptions` key. For example: | ||
``` | ||
{ | ||
"presets": [ | ||
[ | ||
"kyt-core", { | ||
"envOptions": { | ||
"client": { | ||
"debug": true, | ||
"targets": { | ||
"browsers": ["last 2 versions"] | ||
} | ||
}, | ||
"server": { | ||
"modules": true, | ||
"targets": { "node": false } | ||
}, | ||
}, | ||
}, | ||
], | ||
], | ||
} | ||
``` | ||
### `0.2.0` - 03/23/17 | ||
- Includes [`babel-plugin-syntax-dynamic-import`](https://www.npmjs.com/package/babel-plugin-syntax-dynamic-import) to allow parsing of [dynamic `import()`](https://webpack.js.org/guides/code-splitting-import/#dynamic-import). |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
7413
5
102
90
6
+ Addedbabel-plugin-transform-es2015-modules-commonjs@6.26.0(transitive)
+ Addedbabel-preset-env@1.6.0(transitive)
+ Addedbrowserslist@2.11.3(transitive)
+ Addedcaniuse-lite@1.0.30001689(transitive)
+ Addedsemver@5.7.2(transitive)
- Removedbabel-plugin-transform-es2015-modules-commonjs@6.24.1(transitive)
- Removedbabel-preset-env@1.4.0(transitive)
- Removedbrowserslist@1.7.7(transitive)
- Removedcaniuse-db@1.0.30001689(transitive)
Updatedbabel-plugin-transform-es2015-modules-commonjs@6.26.0
Updatedbabel-preset-env@1.6.0