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

babel-preset-cordial

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-cordial

Babel preset for cordial, a module mastering system for gulp

  • 0.3.3
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

babel-preset-cordial

Babel preset used by @thebespokepixel/cordial

Build Status Dependency Status Code Climate Known Vulnerabilities
npm Status Project status devDependency Status Coverage Chat on Gitter

@thebespokepixel/cordial is a gulp4 and git-flow based build mastering tool that can create multi-personality npm/CommonJS/ES6+ packages from the CLI or within Tower 2 automatically up to ES2016/ES7 (stage-3). Handy for when you need to optimise against as much as is natively supported.

Includes transformers:
for node.js < v6.0.0
  • es2015: Spread operator ()
  • es2015: Parameters
  • es2015: Sticky regex
  • es2015: Unicode regex
for node.js < v6.5.0
  • es2015: Destructuring
  • es2015: Function name
for all node versions
  • es2015: Modules to CommonJS
  • es2016: Exponentiantion operator
  • es2017: Trailing function commas (stage-3)
  • es2017: Async functions-to-generator (stage-3)
Shimmed elements

Also adds corejs shims for the following 'untransformable' es2016/7 features missing in node.js v4.0.0 to v6.1.0, but only when used in sources:

for node.js < v6.0.0
  • es2015: Reflect (corejs subset)
for node.js < v6.3.0
  • es2016: Array.prototype.includes()
for all node versions
  • es2017: Object.entries()
  • es2017: Object.values()
  • es2017: Object.getOwnPropertyDescriptors() (stage-3)
  • es2017: String.prototype.padStart() (stage-3)
  • es2017: String.prototype.padEnd() (stage-3)
Unhandled es2015+ language constructs:
  • Array.prototype.values()
  • Iterator closing (Destructuring, Map, Set etc)
  • Symbol.species
  • Tail call optimisation
  • Correct prototype chains
  • SIMD
  • Proxy (node.js v6.0+ only)
  • Refer to Node.green

Based on babel-preset-modern-node by Michael Contento.

Unlike babel-preset-modern-node, the builtin Array is extended to allow Array.prototype.includes.

Installation

npm install --save-dev babel-preset-cordial

Usage

  1. Read "Configuring Babel 6" article for more information about babel@6 configuration.
  2. Decide which version of node you want to support
  3. Use ['cordial', {version: $VERSION}] (e.g. ['cordial', {version: '6.8'}]) as your preset, or ['cordial', {version: 'es2015|es2016|es2017'}] for standards based output for rollup/tree shaking.
  4. By default, import and export commands will NOT be transpiled to CommonJS' require in the output, enabling it's use with Rollup which requires es2015 module syntax. If you need CommonJS output, add {modules: 'commonjs'} to the presets array. Also supported are amd, umd and systemjs module syntaxes.

Via .babelrc

.babelrc

{
  "presets": [
    ["cordial", {
      "version": "6.8",
      "modules": "commonjs"
    }]
  ]
}

Via Node API

require('babel-core').transform('code', {
  presets: [
    ['cordial', {
      version: '6.8',
      modules: 'commonjs'
      loose: true
    }]
  ],
})

Keywords

FAQs

Package last updated on 03 Nov 2016

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