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

esbuild-plugin-babel

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-babel - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "esbuild-plugin-babel",
"version": "0.2.0",
"version": "0.2.1",
"description": "Babel plugin for esbuild.",

@@ -5,0 +5,0 @@ "repository": "nativew/esbuild-plugin-babel",

@@ -7,7 +7,7 @@ import babel from '@babel/core';

name: 'babel',
setup(build, { transform } = {}) {
async setup(build, { transform } = {}) {
const { filter = /.*/, namespace = '', config = {} } = options;
const transformContents = ({ args, contents }) => {
const babelOptions = babel.loadOptions(config);
const babelOptions = babel.loadOptions({ filename: args.path, ...config });

@@ -20,12 +20,10 @@ if (babelOptions.sourceMaps) {

babel.transform(contents, babelOptions, (error, result) => {
if (error) throw error;
contents = result.code;
return new Promise((resolve, reject) => {
babel.transform(contents, babelOptions, (error, result) => {
error ? reject(error) : resolve({ contents: result.code });
});
});
return { contents };
};
if (transform) return transformContents(transform);
if (transform) return await transformContents(transform);

@@ -35,3 +33,3 @@ build.onLoad({ filter, namespace }, async args => {

return transformContents({ args, contents });
return await transformContents({ args, contents });
});

@@ -38,0 +36,0 @@ }

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