New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-kensho

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-kensho

Babel preset to transpile ES2015+/JSX to ES5.

  • 7.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31
increased by55%
Maintainers
3
Weekly downloads
 
Created
Source

babel-preset-kensho

Build Status npm

This Babel 7 preset transpiles ES2018, JSX, and selected language proposals to ES5. It also includes optimizations for specific contexts.

Install

npm install -D babel-preset-kensho

Usage

You can set up Babel transpilation in several ways (e.g. via CLI, or through webpack). Choose a method, and configure Babel to include the preset, e.g. in a .babelrc:

{
  "presets": ["kensho"]
}

Options

The preset can be configured using several options. Note that some options' defaults depend on the Babel environment, which may be one of: development | production | test | cjs

lodash

true | false
Default: true

Whether to transpile Lodash imports using babel-plugin-lodash to reduce bundle size.

// false:
import {map, reduce} from 'lodash'

// true:
import map from 'lodash/map'
import reduce from 'lodash/reduce'

loose

true | false
Default: true

Whether to enable loose mode in all presets/plugins that support this option.

modules

false | 'commonjs'
Default: 'commonjs' in cjs/test env, false otherwise

Whether to compile ESM imports/exports to another module format.

// false:
import foo from './foo'

// 'commonjs' (roughly):
const foo = require('./foo')

react

true | false | options
Default: true

Whether to transpile JSX expressions. If an options object is passed, it is forwarded to the React preset.

removePropTypes

'remove' | 'wrap' | 'unsafe-wrap' | false
Default: 'remove' in production env, 'unsafe-wrap' otherwise

Whether to remove React component propTypes assignment to reduce bundle size. When set to 'remove', also removes imports of the prop-types module.

// false:
Foo.propTypes = {bar: PropTypes.string}

// 'wrap':
Foo.propTypes = process.env.NODE_ENV !== 'production' ? {bar: PropTypes.string} : {}

// 'unsafe-wrap':
process.env.NODE_ENV !== 'production' ? (Foo.propTypes = {bar: PropTypes.string}) : void 0

// 'remove':

runtime

true | false
Default: true

Whether to enable the Babel runtime transform. This is encouraged to reduce bundle size, but requires adding @babel/runtime as a dependency.

targets

See @babel/preset-env options documentation.
Default: current node version in test env, recent browsers otherwise

The transpilation targets to pass to @babel/preset-env.

typescript

true | false | options
Default: true

Whether to enable TypeScript support. If an options object is passed, it's passed to the TypeScript preset.

useBuiltIns

true | false
Default: true

Whether to assume the presence of built-in ES2015 methods (e.g. Object.assign) in transpiled output rather than using helper functions. This option assumes that you will be polyfilling a global ES2015 environment if you need to support non-ES2015 browsers.

FAQs

Package last updated on 26 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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