babel-preset-nodely
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -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 @@ |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5890
22
109
8
1
+ Added@babel/plugin-syntax-dynamic-import@7.8.3(transitive)