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

babel-preset-nodely

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-nodely - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

8

CHANGELOG.md

@@ -0,1 +1,9 @@

# 0.4.0 (2018-09-17)
* **Added** documentation for usage and options
* **Added** `loose` option for disabling loose mode
* **Added** support for dynamic import syntax
* **Changed** builds to enable loose mode by default
# 0.3.0 (2018-09-02)

@@ -2,0 +10,0 @@

23

lib/index.js

@@ -5,11 +5,15 @@ "use strict";

function getPlugins() {
return ['@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-optional-chaining', '@babel/plugin-syntax-object-rest-spread'];
} // eslint-disable-next-line
return ['@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-optional-chaining', '@babel/plugin-syntax-dynamic-import', '@babel/plugin-syntax-object-rest-spread'];
}
function getPresets(options) {
var envOptions = {
loose: typeof options.loose === 'boolean' ? options.loose : true
};
function getPresets(targets) {
var env = targets ? ['@babel/env', {
targets: targets
}] : '@babel/env';
return [env, '@babel/flow', '@babel/react'];
if (options.targets) {
envOptions.targets = options.targets;
}
return [['@babel/env', envOptions], '@babel/flow', '@babel/react'];
} // eslint-disable-next-line flowtype/no-weak-types

@@ -19,8 +23,9 @@

module.exports = function (api, options) {
var targets = options && options.targets || null;
api.cache.never();
return {
plugins: getPlugins(),
presets: getPresets(targets)
presets: getPresets(options || {
loose: true
})
};
};
{
"name": "babel-preset-nodely",
"version": "0.3.0",
"version": "0.4.0",
"description": "Babel preset used by nodely.",

@@ -53,2 +53,3 @@ "main": "lib/index.js",

"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-object-rest-spread": "^7.0.0",

@@ -58,25 +59,3 @@ "@babel/preset-env": "^7.0.0",

"@babel/preset-react": "^7.0.0"
},
"jest": {
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.js"
],
"coverageReporters": [
"json-summary",
"lcov"
],
"coverageThreshold": {
"global": {
"branches": 100,
"functions": 100,
"lines": 100,
"statements": 100
}
},
"snapshotSerializers": [
"jest-serializer-path"
],
"testRegex": "/__tests__/.*-test\\.js$"
}
}

@@ -29,4 +29,65 @@ # babel-preset-nodely [![NPM][npm-img]][npm-url] [![Coverage][cov-img]][cov-url]

To use this preset simply include it in your Babel configuration for example:
*.babelrc*
```json
{
"presets": ["nodely"]
}
```
### Loose mode
By default this preset will enable loose mode but you can turn it off like so:
```json
{
"presets": [
[
"nodely",
{
"loose": false
}
]
]
}
```
### Targets
Your build can target a specific minimum Node version:
```json
{
"presets": [
[
"nodely",
{
"targets": {
"node": 8
}
}
]
]
}
```
Your build can also target certain browser support:
```json
{
"presets": [
[
"nodely",
{
"targets": {
"browsers": ["last 2 versions", "ie10"],
}
}
]
]
}
```
## Code of Conduct

@@ -33,0 +94,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