Socket
Socket
Sign inDemoInstall

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.3 to 0.5.4

7

CHANGELOG.md

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

<a name="0.5.4"></a>
## [0.5.4](https://github.com/brandonocasey/rollup-plugin-worker-factory/compare/v0.5.3...v0.5.4) (2021-03-11)
### Bug Fixes
* do not break uglify ([d282fcc](https://github.com/brandonocasey/rollup-plugin-worker-factory/commit/d282fcc))
<a name="0.5.3"></a>

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

2

package.json
{
"name": "rollup-plugin-worker-factory",
"version": "0.5.3",
"version": "0.5.4",
"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(getWorkerString, fn) {
export const transform = function(code) {
return `var browserWorkerPolyFill = ${browserWorkerPolyFill.toString()};\n` +
'browserWorkerPolyFill(self);\n' +
getWorkerString(fn);
code;
};

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

const code = output[0].code;
let workerCode;
// mock worker does not use a string, it uses a
// real function
if (factoryPath !== mock) {
workerCode = `getWorkerString(function() {\n${code}\n})`;
} else {
workerCode = `function(self) {\n${code}\n}`;
}
const newCode = '' +

@@ -76,3 +86,3 @@ `/* rollup-plugin-worker-factory start for ${id} */\n` +

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

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

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

export const transform = function(getWorkerString, fn) {
export const transform = function(fn) {
// eslint-disable-next-line

@@ -75,0 +75,0 @@ return fn;

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

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