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

rollup-plugin-web-worker-loader

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-web-worker-loader - npm Package Compare versions

Comparing version 0.2.0 to 0.3.1

2

package.json
{
"name": "rollup-plugin-web-worker-loader",
"version": "0.2.0",
"version": "0.3.1",
"description": "Rollup plugin to handle Web Workers",

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

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

}
})
});
},

@@ -143,0 +143,0 @@

@@ -7,2 +7,13 @@ export function createInlineWorkerFactory(fn, sourcemap = null) {

const lines = body.split('\n').map(line => line.substring(4) + '\n');
if (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]') {
/* node.js */
const Worker = require('worker_threads').Worker; // eslint-disable-line
const concat = lines.join('\n');
return function WorkerFactory(options) {
return new Worker(concat, Object.assign({}, options, { eval: true }));
};
}
/* browser */
const blob = new Blob(lines, { type: 'application/javascript' });

@@ -16,5 +27,13 @@ const url = URL.createObjectURL(blob);

export function createURLWorkerFactory(url) {
if (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]') {
/* node.js */
const Worker = require('worker_threads').Worker; // eslint-disable-line
return function WorkerFactory(options) {
return new Worker(url, options);
};
}
/* browser */
return function WorkerFactory(options) {
return new Worker(url, options);
}
};
}
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