🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

rollup-plugin-web-worker-loader

Package Overview
Dependencies
Maintainers
1
Versions
32
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

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);
}
};
}