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

babel-preset-o

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-o - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

37

index.js

@@ -5,3 +5,5 @@ const path = require('path')

const nodeEnv = process.env.NODE_ENV
const isTest = nodeEnv === 'test'
const isDev = nodeEnv === 'development'
const isProd = nodeEnv === 'production'

@@ -16,5 +18,6 @@ let absoluteRuntime = null

const {
nodeVersion = 'current',
modules = false,
useBuiltIns = false,
runtime = 'classic',
nodeVersion,
} = options

@@ -24,6 +27,18 @@

presets: [
require("@babel/preset-react").default,
[
require("@babel/preset-env").default,
require('@babel/preset-react').default,
{
...(runtime !== 'automatic' ? { useBuiltIns: true } : {}),
runtime,
}
],
isTest && [
require('@babel/preset-env').default,
{
targets: { node: 'current' }
}
],
isProd && [
require('@babel/preset-env').default,
{
loose: true,

@@ -33,12 +48,14 @@ corejs: useBuiltIns ? 3 : false,

useBuiltIns,
targets: {
node: nodeVersion,
},
// when node version is specified, use nodeVersion first,
// otherwise let browserslist works
...(nodeVersion ? {
targets: { node: nodeVersion }
} : {}),
exclude: ['@babel/plugin-transform-typeof-symbol'],
},
],
],
].filter(Boolean),
plugins: [
[
require("@babel/plugin-proposal-class-properties").default,
require('@babel/plugin-proposal-class-properties').default,
{ loose: true },

@@ -58,7 +75,7 @@ ],

[
require("@babel/plugin-proposal-optional-chaining").default,
require('@babel/plugin-proposal-optional-chaining').default,
{ loose: true },
],
[
require("@babel/plugin-proposal-nullish-coalescing-operator").default,
require('@babel/plugin-proposal-nullish-coalescing-operator').default,
{ loose: true },

@@ -65,0 +82,0 @@ ]

{
"name": "babel-preset-o",
"version": "0.2.1",
"version": "0.3.0",
"description": "tiny and flexible babel preset",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,3 @@ # babel-preset-o

cover basic usage for react development
### Usage
## Usage

@@ -18,1 +18,27 @@ ```sh

```
## Options
Use this preset with customized options to extend flexibility of compilation.
#### `nodeVersion`
Default is `undefined`, will use browserslist if project specified. Ref to [babel-preset-env#targetsnode](https://babeljs.io/docs/en/babel-preset-env#targetsnode)
#### `modules`
Default is `false`, ref to [babel-preset-env#modules](https://babeljs.io/docs/en/babel-preset-env#modules)
#### `useBuiltIns`
Default is `false`, ref to [babel-preset-env#usebuiltins](https://babeljs.io/docs/en/babel-preset-env#usebuiltins)
#### `runtime`
Default is `'classic'`, Ref to [babel-preset-react#runtime](https://babeljs.io/docs/en/babel-preset-react#runtime)
### Example
```js
// babel.config.js
module.exports = {
presets: [
['babel-preset-o', { modules: 'commonjs', nodeVersion: '8' }]
]
}
```
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