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

rollup-plugin-web-worker-loader

Package Overview
Dependencies
Maintainers
1
Versions
31
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 0.3.1 to 0.4.0

2

package.json
{
"name": "rollup-plugin-web-worker-loader",
"version": "0.3.1",
"version": "0.4.0",
"description": "Rollup plugin to handle Web Workers",

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

@@ -7,3 +7,4 @@ # rollup-plugin-web-worker-loader

Handles Worker dependencies and can emit source maps.
Worker dependencies are added to Rollup's watch list.
Worker dependencies are added to Rollup's watch list.
Supports bundling workers for Node.js environments

@@ -10,0 +11,0 @@ ### Getting started

@@ -0,1 +1,4 @@

const kIsNodeJS = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
const kRequire = kIsNodeJS ? module.require : null; // eslint-disable-line
export function createInlineWorkerFactory(fn, sourcemap = null) {

@@ -6,7 +9,8 @@ const source = fn.toString();

const body = source.substring(start, end) + (sourcemap ? `//# sourceMappingURL=${sourcemap}` : '');
const lines = body.split('\n').map(line => line.substring(4) + '\n');
const blankPrefixLength = body.search(/\S/);
const lines = body.split('\n').map(line => line.substring(blankPrefixLength) + '\n');
if (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]') {
if (kIsNodeJS) {
/* node.js */
const Worker = require('worker_threads').Worker; // eslint-disable-line
const Worker = kRequire('worker_threads').Worker; // eslint-disable-line
const concat = lines.join('\n');

@@ -27,5 +31,5 @@ return function WorkerFactory(options) {

export function createURLWorkerFactory(url) {
if (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]') {
if (kIsNodeJS) {
/* node.js */
const Worker = require('worker_threads').Worker; // eslint-disable-line
const Worker = kRequire('worker_threads').Worker; // eslint-disable-line
return function WorkerFactory(options) {

@@ -32,0 +36,0 @@ return new Worker(url, options);

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