rollup-plugin-web-worker-loader
Advanced tools
Comparing version 0.5.2 to 0.6.0
{ | ||
"name": "rollup-plugin-web-worker-loader", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "Rollup plugin to handle Web Workers", | ||
@@ -20,4 +20,4 @@ "main": "src/index.js", | ||
"devDependencies": { | ||
"eslint": "^6.1.0" | ||
"eslint": "^6.3.0" | ||
} | ||
} |
const kIsNodeJS = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'; | ||
const kRequire = kIsNodeJS ? module.require : null; // eslint-disable-line | ||
const kRequire = kIsNodeJS && typeof module.require === 'function' ? module.require : null; // eslint-disable-line | ||
@@ -8,7 +8,7 @@ export function createInlineWorkerFactory(fn, sourcemap = null) { | ||
const end = source.indexOf('}', source.length - 1); | ||
const body = source.substring(start, end) + (sourcemap ? `//# sourceMappingURL=${sourcemap}` : ''); | ||
const body = source.substring(start, end) + (sourcemap ? `\/\/# sourceMappingURL=${sourcemap}` : ''); | ||
const blankPrefixLength = body.search(/\S/); | ||
const lines = body.split('\n').map(line => line.substring(blankPrefixLength) + '\n'); | ||
if (kIsNodeJS) { | ||
if (kRequire) { | ||
/* node.js */ | ||
@@ -31,3 +31,3 @@ const Worker = kRequire('worker_threads').Worker; // eslint-disable-line | ||
export function createURLWorkerFactory(url) { | ||
if (kIsNodeJS) { | ||
if (kRequire) { | ||
/* node.js */ | ||
@@ -48,5 +48,5 @@ const Worker = kRequire('worker_threads').Worker; // eslint-disable-line | ||
const start = source.indexOf('\n', 10) + 1; | ||
const body = source.substring(start) + (sourcemap ? `//# sourceMappingURL=${sourcemap}` : ''); | ||
const body = source.substring(start) + (sourcemap ? `\/\/# sourceMappingURL=${sourcemap}` : ''); | ||
if (kIsNodeJS) { | ||
if (kRequire) { | ||
/* node.js */ | ||
@@ -53,0 +53,0 @@ const Worker = kRequire('worker_threads').Worker; // eslint-disable-line |
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
37216