Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
babel-preset-daun
Advanced tools
A default babel preset for my personal projects.
Contains transforms for all stage 4 and stage 3 syntax. Stage 4 syntax that is excluded is as follows:
regenerator-runtime
is too heavyweight for our use.async/await
: regenerator-runtime
is too heavyweight for our use, and async-to-promises is not yet complete enough to be safely used.async function
snpm install --save-dev babel-preset-daun
Add the preset to your .babelrc
:
{
"presets": ["daun"]
}
This module uses @babel/preset-env
to target specific environments. Please refer to @babel/preset-env#targets for a list of available options.
For a list of browsers please see browserlist.
You may override the default list of targets by providing a targets
key.
{
"presets": [["daun", {
"targets": {
"chrome": 50,
"ie": 11,
"firefox": 45
}
}]]
}
Or inherit the default list of browsers and extend them using additionalTargets
.
{
"presets": [["daun", {
"additionalTargets": {
"chrome": 42,
"ie": 8
}
}]]
}
Enable debugging by providing a debug
key.
{
"presets": [["daun", {
"debug": true
}]]
}
By default, this preset will compile classes in normal mode. This is safer, but comes with a bundle size and runtime overhead. To compile classes in loose mode, set the looseClasses
option to true
:
{
"presets": [["daun", {
"looseClasses": true,
}]]
}
The risks of enabling loose classes are outlined in the Babel docs.
By default @babel/plugin-transform-runtime will assume the oldest version of the runtime to avoid importing helpers that don't exist which would fail at runtime. This can result in newer helpers being inlined into modules (ex. objectSpread2) which increases bundle size.
To avoid this you can configure the preset to use the same version of the runtime that's installed in your package.json.
ex. If package.json has "@babel/runtime": "^7.5.5"
then you can use:
{
"presets": [["daun", {
"runtimeVersion": "7.5.5",
}]]
}
Note that this will result in a runtime breakage if the version passed into the preset is newer than the version of the babel runtime actually being used at build time.
plugin-transform-runtime
You can use the transformRuntime
option to disable @babel/plugin-transform-runtime
. Specifying false
will disable the plugin. This option defaults to true
.
You can use the modules
option to enable transformation of modules given to this preset:
{
"presets": [["daun", {
"modules": "auto"
}]]
}
Both true
and the option default auto
will not transform modules if ES6 module syntax is already supported by the environment, or "commonjs"
otherwise. false
will not transform modules.
You can use the runtimeHelpersUseESModules
option to prevent transformation of runtime helpers to CommonJS modules.
{
"presets": [["daun", {
"runtimeHelpersUseESModules": true
}]]
}
true
will not transform runtime helpers to CommonJS modules. false
will transform runtime helpers to CommonJS modules. The option defaults to true
if modules
is set to false
, and false
otherwise.
FAQs
A babel preset
The npm package babel-preset-daun receives a total of 16 weekly downloads. As such, babel-preset-daun popularity was classified as not popular.
We found that babel-preset-daun demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.