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

babel-features

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-features - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0-beta

async-functions.js

120

index.js
'use strict'
var features = [
// ES3
'es3-member-expression-literals',
'es3-property-Literals',
'es3.memberExpressionLiterals',
'es3.propertyLiterals',
// ES5
'es5-property-mutators',
'es5.properties.mutators',
// ES2015
'es2015-arrow-functions',
// es2015-block-scoped-functions
'es2015-block-scoping',
'es2015-classes',
'es2015-computed-properties',
'es2015-constants',
'es2015-destructuring',
'es2015-for-of',
'es2015-function-name',
'es2015-literals',
'es2015-object-super',
'es2015-parameters',
'es2015-shorthand-properties',
'es2015-spread',
'es2015-sticky-regex',
'es2015-template-literals',
'es2015-typeof-symbol',
'es2015-unicode-regex',
'es6.arrowFunctions',
'es6.blockScoping',
'es6.classes',
'es6.constants',
'es6.destructuring',
'es6.forOf',
'es6.modules',
'es6.parameters',
'es6.properties.computed',
'es6.properties.shorthand',
'es6.spread',
// 'es6.tailCall'
'es6.templateLiterals',
'es6.regex.unicode',
// 'es6.regex.sticky'
// Stage 2
'es7.exponentiationOperator',
'es7.asyncFunctions',
'es7.objectRestSpread',
// Stage 1
'es7.decorators',
// 'es7.exportExtensions'
// 'es7.trailingFunctionCommas'
// Stage 0
// 'es7.comprehensions'
// 'es7.classProperties'
// 'es7.doExpressions'
'es7.functionBind',
// Other
// flow
// react
// reactCompat
'es6.generators',
// regenerator
// strict
'es3.functionScope',
// jscript
// Special features
'es2015-modules',
'es2015-generators',
'es3-function-scope',
]

@@ -70,3 +48,2 @@

}
return result

@@ -77,26 +54,39 @@ }

var enumerable = {}.propertyIsEnumerable
var PREFIX = 'transform-'
function options() {
var blacklist = [], optional = []
var plugins = [], optional = []
var testResult = test()
for (var f in testResult) {
if (!enumerable.call(testResult, f)) continue
if (testResult[f]) {
switch (f) {
case 'es6.generators':
blacklist.push('regenerator')
if (!testResult['es7.asyncFunctions']) optional.push('asyncToGenerator')
break
case 'es3.functionScope':
blacklist.push('jscript')
break
default:
blacklist.push(f)
}
var r = !testResult[f]
switch (f) {
case 'es2015-block-scoping':
if (r) plugins.push(PREFIX + 'es2015-block-scoped-functions', PREFIX + f)
break
case 'es2015-modules':
if (r) plugins.push(PREFIX + f + '-' + moduleFormat())
break
case 'es2015-generators':
if (r) plugins.push(PREFIX + 'regenerator')
else plugins.push(PREFIX + 'async-to-generator')
break
case 'es3-function-scope':
if (r) plugins.push('jscript')
break
default:
if (r) plugins.push(PREFIX + f)
}
}
return {blacklist: blacklist, optional: optional}
return {plugins: plugins}
}
function moduleFormat() {
if (typeof System === 'function' && typeof System.register === 'function') return 'systemjs'
if (typeof require === 'function' && typeof exports === 'object') return 'commonjs'
if (typeof define === 'function' && define.amd) return 'amd'
return 'umd'
}
exports.test = test
exports.options = options
{
"name": "babel-features",
"version": "1.0.1",
"version": "2.0.0-beta",
"description": "Test babel features, can be used to generate babel options for specific compilation targets",

@@ -17,3 +17,3 @@ "main": "index.js",

"peerDependencies": {
"babel": "5.x"
"babel-core": "6.x"
},

@@ -20,0 +20,0 @@ "author": "HE Shi-Jun <johnhax@gmail.com>",

# babel-features
Test babel features, can be used to generate babel options for specific compilation targets
NOTE: The latest version (2.x) is for babel 6.x, for babel 5.x please use version 1.x
## Install
```sh
npm install babel-features
npm install babel-features@latest
```

@@ -16,25 +19,26 @@

console.log(features)
// output on Node.js 4.1.1:
// { 'es3.memberExpressionLiterals': true,
// 'es3.propertyLiterals': true,
// 'es5.properties.mutators': true,
// 'es6.arrowFunctions': true,
// 'es6.blockScoping': true,
// 'es6.classes': true,
// 'es6.constants': true,
// 'es6.destructuring': false,
// 'es6.forOf': true,
// 'es6.modules': false,
// 'es6.parameters': false,
// 'es6.properties.computed': true,
// 'es6.properties.shorthand': true,
// 'es6.spread': false,
// 'es6.templateLiterals': true,
// 'es6.regex.unicode': false,
// 'es7.exponentiationOperator': false,
// 'es7.asyncFunctions': false,
// 'es7.objectRestSpread': false,
// 'es7.functionBind': false,
// 'es6.generators': false,
// 'es3.functionScope': true }
// output on Node.js 5.0.0:
// { 'es3-member-expression-literals': true,
// 'es3-property-Literals': true,
// 'es5-property-mutators': true,
// 'es2015-arrow-functions': true,
// 'es2015-block-scoping': true,
// 'es2015-classes': true,
// 'es2015-computed-properties': true,
// 'es2015-constants': true,
// 'es2015-destructuring': false,
// 'es2015-for-of': true,
// 'es2015-function-name': false,
// 'es2015-literals': true,
// 'es2015-object-super': true,
// 'es2015-parameters': false,
// 'es2015-shorthand-properties': true,
// 'es2015-spread': false,
// 'es2015-sticky-regex': false,
// 'es2015-template-literals': true,
// 'es2015-typeof-symbol': true,
// 'es2015-unicode-regex': false,
// 'es2015-modules': false,
// 'es2015-generators': false,
// 'es3-function-scope': true }
```

@@ -45,6 +49,3 @@

var babelOptions = require('babel-features').options()
require('babel/register')({
blacklist: babelOptions.blacklist,
optional: babelOptions.optional
})
require('babel-core/register')(babelOptions)
```

@@ -56,1 +57,2 @@

- Generate `multiform.json` for https://github.com/callumlocke/multiform
- Auto generate babel presets for some targets
'use strict'
var f = require('.')
var f = require('./')
console.log(f.test())
console.log(f.options())
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