Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
babel-plugin-feature-flags
Advanced tools
Changelog
Readme
This plugin is for Babel 6. If you need to support Babel 5 use the 0.2.x releases.
A babel plugin that implements feature flags for enabling and disabling features. This plugin is intended to be followed by a dead code elimination pass (Uglify, babel-plugin-dead-code-elimination, etc.) to remove any unreachable code.
Feature flags are implemented by looking for call expressions like isEnabled('my-feature')
and checking if the feature is enabled/disabled/disabled in a feature map that is passed through the plugin options. If the feature is known to be enabled or disabled then the call expression is replace with a boolean literal (true
or false
respectively). If the feature is dynamic, than the call expression is left alone.
Given the .babelrc
{
"plugins": [["feature-flags", {
"import": {
"module": "my-features"
},
"features": {
"new-feature": "disabled"
}
}]]
}
the JavaScript file
import isEnabled from 'my-features';
if (isEnabled('new-feature')) {
// code
}
will be transformed to
import isEnabled from 'my-features';
if (false) {
// code
}
Here are the options that you can pass to the babel plugin.
options.import.module
[String
]: The name of the module that the feature function is imported from.options.import.name
[String
(Optional)]: The name of the export that the feature function is imported from. Defaults to "default"
.options.features
[Map(String -> 'enabled' | 'disabled' | 'dynamic')
]: An object whose keys are the names of features and whose values determine whether the feature is enabled/disabled/dynamic.FAQs
A babel transform for managing feature flags
The npm package babel-plugin-feature-flags receives a total of 15,389 weekly downloads. As such, babel-plugin-feature-flags popularity was classified as popular.
We found that babel-plugin-feature-flags demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.