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.8.1 to 0.9.0

6

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

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

"devDependencies": {
"eslint": "^6.6.0",
"rollup": "^1.27.0"
"eslint": "^6.8.0",
"rollup": "^1.32.0"
}
}

@@ -5,6 +5,6 @@ # rollup-plugin-web-worker-loader

Can inline the worker code or emit a script file using code-splitting.
Handles Worker dependencies and can emit source maps.
Worker dependencies are added to Rollup's watch list.
Supports bundling workers for Node.js environments
Can inline the worker code or emit a script file using code-splitting.
Handles Worker dependencies and can emit source maps.
Worker dependencies are added to Rollup's watch list.
Supports bundling workers for Node.js environments

@@ -24,3 +24,3 @@ ### Getting started

entry: 'src/index.js',
plugins: [
plugins: [
webWorkerLoader(/* configuration */),

@@ -32,3 +32,3 @@ ],

Bundle the worker code using the RegEx pattern specified in the plugin's configuration.
Bundle the worker code using the RegEx pattern specified in the plugin's configuration.
By default you can add the prefix `web-worker:` to your imports:

@@ -53,3 +53,3 @@

sourcemap?: boolean, // when inlined, should a source map be included in the final output. Default: false
inline?: boolean, // should the worker code be inlined (Base64). Default: true

@@ -66,5 +66,8 @@

// payload. Default: false
loadPath?: string, // this options is useful when the worker scripts need to be loaded from another folder.
// Default: ''
skipPlugins?: Array // Plugins names to skip for web worker build
// Default: [ 'liveServer', 'serve', 'livereload' ]
})

@@ -78,3 +81,3 @@ ```

`loadPath` is meant to be used in situations where code-splitting is used (`inline = false`) and the entry script is hosted in a different folder than the worker code.
`loadPath` is meant to be used in situations where code-splitting is used (`inline = false`) and the entry script is hosted in a different folder than the worker code.

@@ -81,0 +84,0 @@

@@ -6,6 +6,2 @@ const fs = require('fs');

const bannedPluginNames = [
'liveServer',
];
module.exports = function workerLoaderPlugin(config = null) {

@@ -17,2 +13,7 @@ const sourcemap = (config && config.sourcemap) || false;

const pattern = config && config.hasOwnProperty('pattern') ? config.pattern : /web-worker:(.+)/;
const skipPlugins = new Set(config && config.hasOwnProperty('skipPlugins') ? config.skipPlugins : [
'liveServer',
'serve',
'livereload',
]);

@@ -39,5 +40,5 @@ let inline = config && config.hasOwnProperty('inline') ? config.inline : true;

options.plugins.forEach(plugin => {
if (bannedPluginNames.indexOf(plugin.name) === -1) {
plugins.push(plugin);
}
if (skipPlugins.has(plugin.name)) return;
plugins.push(plugin);
});

@@ -49,11 +50,11 @@ projectOptions.plugins = plugins;

try {
const entry = require.resolve(options.input, {paths:[cwd]});
const entry = require.resolve(options.input, { paths: [cwd] });
basePath = path.dirname(entry);
} catch (e) {}
} catch (e) { /* EMPTY */ }
} else if (Array.isArray(options.input)) {
let componentCount = Number.MAX_SAFE_INTEGER;
let shortestPath = null;
for (let i = 0,n = options.input.length; i < n; ++i) {
for (let i = 0, n = options.input.length; i < n; ++i) {
try {
const entry = require.resolve(options.input[i], {paths:[cwd]});
const entry = require.resolve(options.input[i], { paths: [cwd] });
const entryPath = path.dirname(entry);

@@ -65,3 +66,3 @@ const components = entryPath.split(path.sep);

}
} catch (e) {}
} catch (e) { /* EMPTY */ }
}

@@ -76,3 +77,3 @@ basePath = shortestPath;

try {
const entry = require.resolve(input, {paths:[cwd]});
const entry = require.resolve(input, { paths: [cwd] });
const entryPath = path.dirname(entry);

@@ -84,3 +85,3 @@ const components = entryPath.split(path.sep);

}
} catch (e) {}
} catch (e) { /* EMPTY */ }
}

@@ -87,0 +88,0 @@ basePath = shortestPath;

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