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 1.0.0-alpha.a38d57b8 to 1.0.0-alpha.acd59c56

31

lib/__tests__/index.test.js
/* eslint-disable global-require */
jest.setMock('babel-preset-env', 'env');
jest.setMock('babel-plugin-transform-runtime', 'runtime');
jest.setMock('babel-plugin-transform-es2015-modules-commonjs', 'commonjs');
jest.setMock('babel-plugin-syntax-dynamic-import', 'import');
jest.setMock('@babel/preset-env', 'env');
jest.setMock('@babel/plugin-transform-runtime', 'runtime');
jest.setMock('@babel/plugin-syntax-dynamic-import', 'import');
jest.setMock('babel-plugin-dynamic-import-node', 'import-node');
describe('babel-preset-kyt-core', () => {
it('should load default presets and plugins', () => {
const presetKytCore = require('../index.js');
const presetKytCore = require('..');
expect(presetKytCore()).toMatchSnapshot();

@@ -16,3 +16,3 @@ });

process.env.KYT_ENV_TYPE = 'server';
const presetKytCore = require('../index.js');
const presetKytCore = require('..');
const config = presetKytCore();

@@ -24,3 +24,3 @@ expect(config.presets[0][1].targets.node).toEqual('current');

process.env.KYT_ENV_TYPE = 'client';
const presetKytCore = require('../index.js');
const presetKytCore = require('..');
const config = presetKytCore(

@@ -37,3 +37,3 @@ {},

process.env.KYT_ENV_TYPE = 'server';
const presetKytCore = require('../index.js');
const presetKytCore = require('..');
const config = presetKytCore({}, { envOptions: { server: { targets: { node: false } } } });

@@ -44,6 +44,19 @@ expect(config.presets[0][1].targets.node).toEqual(false);

it('should support an `includeRuntime` option', () => {
const presetKytCore = require('../index.js');
const presetKytCore = require('..');
const config = presetKytCore({}, { includeRuntime: true });
expect(config.plugins[0]).toEqual('runtime');
});
it('should include a dynamic import plugin', () => {
const presetKytCore = require('..');
const config = presetKytCore();
expect(config.plugins[0]).toEqual('import');
});
it('should include a import node plugin when KYT_ENV_TYPE=test', () => {
process.env.KYT_ENV_TYPE = 'test';
const presetKytCore = require('..');
const config = presetKytCore();
expect(config.plugins[1]).toEqual('import-node');
});
});
/* eslint-disable vars-on-top */
var babelPresetEnv = require('babel-preset-env');
var babelTransformRuntime = require('babel-plugin-transform-runtime');
var babelSyntaxDynamicImport = require('babel-plugin-syntax-dynamic-import');
var babelTransformModules = require('babel-plugin-transform-es2015-modules-commonjs');
var babelPresetEnv = require('@babel/preset-env');
var babelTransformRuntime = require('@babel/plugin-transform-runtime');
var babelSyntaxDynamicImport = require('@babel/plugin-syntax-dynamic-import');
var babelDynamicImportNode = require('babel-plugin-dynamic-import-node');
var merge = require('lodash.merge');

@@ -15,6 +15,5 @@

var clientEnvOptions = {
modules: false,
useBuiltIns: true,
useBuiltIns: 'entry',
forceAllTransforms: true,
targets: {
uglify: true,
browsers: ['>1%', 'last 4 versions', 'not ie < 11'],

@@ -25,4 +24,3 @@ },

var serverEnvOptions = {
modules: false,
useBuiltIns: true,
useBuiltIns: 'entry',
targets: {

@@ -65,11 +63,5 @@ node: 'current',

opts.includeRuntime === true && babelTransformRuntime,
babelSyntaxDynamicImport,
process.env.KYT_ENV_TYPE === 'test' ? babelDynamicImportNode : babelSyntaxDynamicImport,
].filter(Boolean),
env: {
test: {
plugins: [[babelTransformModules, { loose: true }]],
},
},
};
};
{
"name": "babel-preset-kyt-core",
"version": "1.0.0-alpha.a38d57b8",
"version": "1.0.0-alpha.acd59c56",
"description": "An opinionated babel preset, best used with kyt",

@@ -12,6 +12,6 @@ "main": "lib/index.js",

"dependencies": {
"babel-plugin-syntax-dynamic-import": "6.18.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.6.0"
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-transform-runtime": "7.2.0",
"@babel/preset-env": "7.2.3",
"babel-plugin-dynamic-import-node": "2.2.0"
},

@@ -18,0 +18,0 @@ "keywords": [

@@ -11,15 +11,16 @@ ## babel-preset-kyt-core

To install:
1. `npm install babel-preset-kyt-core --save`
2. In babelrc:
```
{
presets: [
"babel-preset-kyt-core"
]
}
```
```
{
presets: [
"babel-preset-kyt-core"
]
}
```
## Options
*(see [documentation](https://babeljs.io/docs/plugins/#plugin-preset-options) for Babel preset options)*
_(see [documentation](https://babeljs.io/docs/plugins/#plugin-preset-options) for Babel preset options)_

@@ -31,5 +32,5 @@ - `envOptions` (`Object`) - extend the default babel-preset-env options. The type of options, `client`, `server`, and `test`, are dependent on the value of `process.env.KYT_ENV_TYPE` which, when undefined, defaults to `client`. kyt will automatically set the `KYT_ENV_TYPE` when it runs commands. For debugging purposes, use `"debug": true` to see what the plugin is targeting. The following are the default babel-preset-env configurations used by kyt-core:

modules: false,
useBuiltIns: true,
useBuiltIns: 'entry',
forceAllTransforms: true,
targets: {
uglify: true,
browsers: ['>1%', 'last 4 versions', 'not ie < 11'],

@@ -41,3 +42,3 @@ },

modules: false,
useBuiltIns: true,
useBuiltIns: 'entry',
targets: {

@@ -72,2 +73,3 @@ node: 'current'

```
You can find additional options to configure babel-preset-env [here](https://github.com/babel/babel/tree/master/experimental/babel-preset-env#options).

@@ -74,0 +76,0 @@

Sorry, the diff of this file is not supported yet

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