New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-njs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-njs - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

25

index.js

@@ -28,5 +28,24 @@ const { declare } = require('@babel/helper-plugin-utils')

const asyncHelpersValues = ['external', 'local', 'inline']
const bundlers = [
'@rollup/plugin-babel',
'babel-loader', // webpack
]
module.exports = declare((api, opts) => {
api.assertVersion(7)
const callerName = api.caller(c => c.name)
const asyncHelpers = v.validateStringOption(
'asyncHelpers',
opts.asyncHelpers,
bundlers.includes(callerName) ? 'external' : 'local',
)
if (!asyncHelpersValues.includes(asyncHelpers)) {
const allowedValues = asyncHelpersValues.map(x => `'${x}'`).join(', ')
throw Error(`'asyncHelpers' option must be one of: ${allowedValues}, but given: '${asyncHelpers}'`)
}
const assumeArrayIterables = v.validateBooleanOption(

@@ -130,5 +149,9 @@ 'assumeArrayIterables',

// calls with use of minimal helper functions.
[transformAsyncToPromises],
[transformAsyncToPromises, {
target: 'es6',
externalHelpers: asyncHelpers === 'external',
inlineHelpers: asyncHelpers === 'inline',
}],
],
}
})

2

package.json
{
"name": "babel-preset-njs",
"version": "0.1.2",
"version": "0.2.0",
"description": "A Babel preset for njs - NGINX JavaScript.",

@@ -5,0 +5,0 @@ "author": "Jakub Jirutka <jakub@jirutka.cz>",

@@ -56,3 +56,3 @@ A [Babel](https://babeljs.io)

Assume that all iterables used in `for…​of` loops, [array spread
Assume that all iterables used in `for...of` loops, [array spread
syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#Spread_in_array_literals)

@@ -79,2 +79,26 @@ and [array

### `asyncHelpers`
`'external'`, `'local'`, `'inline'`
Toggles how
[async-to-promises](https://github.com/rpetrich/babel-plugin-transform-async-to-promises)
injects its helpers:
- `'external'` — injects import from
`babel-plugin-transform-async-to-promises/helpers` into each file
with async/await
- `'local'` — injects the needed helper functions into each file with
async/await
- `'inline'` — inlines the needed helper code in place of each
occurrence of async/await
Defaults to `'external'` if Rollup or webpack is detected, otherwise
`'local'`.
- [async-to-promises](https://github.com/rpetrich/babel-plugin-transform-async-to-promises):
`externalHelpers`, `inlineHelpers`
### `looseClasses`

@@ -133,3 +157,3 @@

The list of included Babel plugins is available
[here](https://github.com/jirutka/babel-preset-njs/blob/v0.1.2/README.adoc#plugins).
[here](https://github.com/jirutka/babel-preset-njs/blob/v0.2.0/README.adoc#plugins).

@@ -136,0 +160,0 @@ ## References

Sorry, the diff of this file is not supported yet

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