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

@snowpack/plugin-babel

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@snowpack/plugin-babel - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

worker.js

7

package.json
{
"name": "@snowpack/plugin-babel",
"version": "2.0.3",
"version": "2.1.0",
"main": "plugin.js",

@@ -10,5 +10,6 @@ "license": "MIT",

"dependencies": {
"@babel/core": "^7.10.5"
"@babel/core": "^7.10.5",
"workerpool": "^6.0.0"
},
"gitHead": "654bd755e28046312aafd74dc8aed5f5ec6f8bdc"
"gitHead": "d1b2ec113353d267fc68b88ce4bf8ac12f32f562"
}

@@ -1,2 +0,3 @@

const babel = require('@babel/core');
const workerpool = require('workerpool');
let worker, pool;

@@ -22,6 +23,8 @@ module.exports = function plugin(snowpackConfig, options = {}) {

async load({filePath}) {
if (!filePath) return;
const {transformOptions = {}} = options;
let {code, map} = await babel.transformFileAsync(filePath, {
if (!filePath) {
return;
}
pool = pool || workerpool.pool(require.resolve('./worker.js'));
worker = worker || (await pool.proxy());
let encodedResult = await worker.transformFileAsync(filePath, {
cwd: process.cwd(),

@@ -31,4 +34,5 @@ ast: false,

sourceMaps: snowpackConfig.buildOptions.sourceMaps,
...transformOptions,
...(options.transformOptions || {}),
});
let {code, map} = JSON.parse(encodedResult);

@@ -49,3 +53,6 @@ if (code) {

},
cleanup() {
pool && pool.terminate();
},
};
};
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