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

babel-preset-proposals

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-proposals

A Babel preset to manage use of proposal plugins

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
increased by154.16%
Maintainers
1
Weekly downloads
 
Created
Source

babel-preset-proposals

Travis npm package Coveralls

A Babel 7 preset to manage experimental proposal plugin dependencies and usage, providing default configuration for plugins which have mandatory options, and ensuring that proposal plugins which affect one another are used in the correct order and have appropriate options set.

Install

npm install babel-preset-proposals

Options

absolutePaths

boolean, defaults to false.

Use absolute paths in plugins config - use this option if you're creating a Babel configuration which will be used outside of the module resolution scope of where you're generating it.

all

boolean, defaults to false.

Enable all plugins which haven't been otherwise configured.

loose

boolean

Sets the loose option for all plugins which are enabled and have a loose option - primarily intended for flipping plugin loose options to true, since they default to false.

Plugin Options

boolean or an Object, defaults to false.

To enable a plugin, pass its option as true:

{
  "presets": [
    ["babel-preset-proposals", {
      "classProperties": true,
      "decorators": true,
      "exportDefaultFrom": true,
      "exportNamespaceFrom": true
    }]
  ]
}

If the plugin takes options, you can pass an options Object for it.

{
  "presets": [
    ["babel-preset-proposals", {
      "decorators": {"legacy": true}
    }]
  ]
}
Preset optionBabel Plugin Docs
functionBind@babel/plugin-proposal-function-bind
exportDefaultFrom@babel/plugin-proposal-export-default-from
logicalAssignmentOperators@babel/plugin-proposal-logical-assignment-operators
pipelineOperator@babel/plugin-proposal-pipeline-operator
doExpressions@babel/plugin-proposal-do-expressions
decorators@babel/plugin-proposal-decorators
functionSent@babel/plugin-proposal-function-sent
exportNamespaceFrom@babel/plugin-proposal-export-namespace-from
numericSeparator@babel/plugin-proposal-numeric-separator
throwExpressions@babel/plugin-proposal-throw-expressions
dynamicImport@babel/plugin-syntax-dynamic-import
importMeta@babel/plugin-syntax-import-meta
classStaticBlock@babel/plugin-proposal-class-static-block
classProperties@babel/plugin-proposal-class-properties

If a plugin requires configuration and you enable it with a true option, this preset will provide default options:

Preset optionDefault plugin options
decorators{decoratorsBeforeExport: false} (as per this decision in the proposal repo)
pipelineOperator{proposal: 'minimal'}

API

validateOptions(options?: Object): String[]

The validation this plugin performs on its options is exported if you need to use it in tooling which accepts user configuration, as you may want to report option validation issues yourself rather than letting Babel blow up.

It returns an Array of error messages, which will be empty if options were valid.

Versioning

Proposal plugins will never be stable, so this package will always be at a 0.X version and will make breaking changes as necessary, so lock it to the specific 0.X version you're using.

MIT Licensed

Keywords

FAQs

Package last updated on 01 Apr 2021

Did you know?

Socket

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.

Install

Related posts

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