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

rollup-plugin-worker-factory

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-worker-factory - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

7

CHANGELOG.md

@@ -0,1 +1,8 @@

<a name="0.5.3"></a>
## [0.5.3](https://github.com/brandonocasey/rollup-plugin-worker-factory/compare/v0.5.2...v0.5.3) (2021-03-11)
### Bug Fixes
* mock worker coverage support ([9ebfea6](https://github.com/brandonocasey/rollup-plugin-worker-factory/commit/9ebfea6))
<a name="0.5.2"></a>

@@ -2,0 +9,0 @@ ## [0.5.2](https://github.com/brandonocasey/rollup-plugin-worker-factory/compare/v0.5.1...v0.5.2) (2021-03-11)

2

package.json
{
"name": "rollup-plugin-worker-factory",
"version": "0.5.2",
"version": "0.5.3",
"description": "Bundle web workers that work in nodejs and the browser, without a separate build target.",

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

@@ -44,7 +44,7 @@ /* global Blob, BlobBuilder, Worker */

export const transform = function(code) {
export const transform = function(getWorkerString, fn) {
return `var browserWorkerPolyFill = ${browserWorkerPolyFill.toString()};\n` +
'browserWorkerPolyFill(self);\n' +
code;
getWorkerString(fn);
};

@@ -75,3 +75,3 @@ const rollup = require('rollup');

'import getWorkerString from "rollup-plugin-worker-factory/src/get-worker-string";\n' +
`const workerCode = transform(getWorkerString(function() {\n${code}\n}));\n` +
`const workerCode = transform(getWorkerString, function(self) {\n${code}\n});\n` +
'export default factory(workerCode);\n' +

@@ -78,0 +78,0 @@ `/* rollup-plugin-worker-factory end for ${id} */\n`;

@@ -72,6 +72,6 @@ class FakeWorker {

export const transform = function(code) {
export const transform = function(getWorkerString, fn) {
// eslint-disable-next-line
return new Function('self', code);
return fn;
};

@@ -34,7 +34,7 @@ // used to make nodejs workers behave like the browser

export const transform = function(code) {
export const transform = function(getWorkerString, fn) {
return `const nodeWorkerPolyfill = ${nodeWorkerPolyfill.toString()};\n` +
'global.self = nodeWorkerPolyfill(require("worker_threads").parentPort);\n' +
code;
getWorkerString(fn);
};
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