Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-kyt-core

Package Overview
Dependencies
Maintainers
3
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-kyt-core - npm Package Compare versions

Comparing version 0.2.1-env2.beta.1 to 0.3.0-alpha.1

lib/__tests__/__snapshots__/index.test.js.snap

56

lib/index.js

@@ -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 @@ },

16

package.json
{
"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).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc