rollup-plugin-worker-factory
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -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) |
{ | ||
"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); | ||
}; | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24736