All Projects → ember-cli → babel-plugin-feature-flags

ember-cli / babel-plugin-feature-flags

Licence: other
A babel transform for managing feature flags

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to babel-plugin-feature-flags

Babel Plugin React Docgen
📝 Babel plugin to add react-docgen info into your code.
Stars: ✭ 156 (+173.68%)
Mutual labels:  babel-plugin
Babel Plugin React Intl Auto
i18n for the component age. Auto management react-intl ID.
Stars: ✭ 203 (+256.14%)
Mutual labels:  babel-plugin
babel-plugin-hyperscript-to-jsx
This plugin transforms react-hyperscript into JSX. Intended to be used as codemod.
Stars: ✭ 20 (-64.91%)
Mutual labels:  babel-plugin
Babel Plugin React Css Modules
Transforms styleName to className using compile time CSS module resolution.
Stars: ✭ 1,989 (+3389.47%)
Mutual labels:  babel-plugin
Emotion
👩‍🎤 CSS-in-JS library designed for high performance style composition
Stars: ✭ 14,177 (+24771.93%)
Mutual labels:  babel-plugin
Xwind
Tailwind CSS as a templating language in JS and CSS-in-JS
Stars: ✭ 249 (+336.84%)
Mutual labels:  babel-plugin
Babel Plugin Transform Incremental Dom
Turn JSX into IncrementalDOM
Stars: ✭ 146 (+156.14%)
Mutual labels:  babel-plugin
idomizer
An HTML template parser compiling an incremental-dom render factory.
Stars: ✭ 15 (-73.68%)
Mutual labels:  babel-plugin
Babel Plugin Macros
🎣 Allows you to build simple compile-time libraries
Stars: ✭ 2,366 (+4050.88%)
Mutual labels:  babel-plugin
babel-plugin-rewire-exports
Babel plugin for stubbing [ES6, ES2015] module exports
Stars: ✭ 62 (+8.77%)
Mutual labels:  babel-plugin
Babel Plugin Wildcard
Wildcard imports import a directories JS files
Stars: ✭ 170 (+198.25%)
Mutual labels:  babel-plugin
Param.macro
Partial application syntax and lambda parameters for JavaScript, inspired by Scala's `_` & Kotlin's `it`
Stars: ✭ 170 (+198.25%)
Mutual labels:  babel-plugin
S2s
Coding time Compile. A tool to write code fastest.
Stars: ✭ 254 (+345.61%)
Mutual labels:  babel-plugin
Babel Plugin Graphql Tag
Compiles GraphQL tagged template strings using graphql-tag.
Stars: ✭ 156 (+173.68%)
Mutual labels:  babel-plugin
nornj
More exciting JS/JSX based on Template Engine, support control flow tags, custom directives, two-way binding, filters and custom operators.
Stars: ✭ 97 (+70.18%)
Mutual labels:  babel-plugin
Babel Plugin Object To Json Parse
This plugin converts object literal to JSON.parse
Stars: ✭ 151 (+164.91%)
Mutual labels:  babel-plugin
Eslint Import Resolver Babel Module
Custom eslint resolve for babel-plugin-module-resolver
Stars: ✭ 236 (+314.04%)
Mutual labels:  babel-plugin
babel-plugin-transform-for-of-as-array
Transform all for-of loops into the equivalent array for loop
Stars: ✭ 14 (-75.44%)
Mutual labels:  babel-plugin
penv.macro
A macro used with babel-plugin-macros to write configurations for multiple environments, and remove configurations are irrelevant with the specified environment from your codes finally.
Stars: ✭ 73 (+28.07%)
Mutual labels:  babel-plugin
babel-plugin-tailwind-rn
Allows you to use className="w-full md:w-1/2" syntax in your react native projects.
Stars: ✭ 31 (-45.61%)
Mutual labels:  babel-plugin

babel-plugin-feature-flags

Build Status

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.

Example

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
}

Configuration

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].