Socket
Socket
Sign inDemoInstall

@surma/rollup-plugin-off-main-thread

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@surma/rollup-plugin-off-main-thread - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

27

index.js

@@ -150,7 +150,24 @@ /**

if (!/^\.{1,2}\//.test(workerFile)) {
this.warn(
`Paths passed to the Worker constructor must be relative to the current file, i.e. start with ./ or ../ (just like dynamic import!). Ignoring "${workerFile}".`,
matchIndex
);
continue;
let isError = false;
if (directWorkerFile) {
// If direct worker file, it must be in `./something` form.
isError = true;
} else {
// If `new URL(...)` it can be in `new URL('something', import.meta.url)` form too,
// so just check it's not absolute.
if (/^(\/|https?:)/.test(workerFile)) {
isError = true;
} else {
// If it does turn out to be `new URL('something', import.meta.url)` form,
// prepend `./` so that it becomes valid module specifier.
workerFile = `./${workerFile}`;
}
}
if (isError) {
this.warn(
`Paths passed to the Worker constructor must be relative to the current file, i.e. start with ./ or ../ (just like dynamic import!). Ignoring "${workerFile}".`,
matchIndex
);
continue;
}
}

@@ -157,0 +174,0 @@

@@ -0,0 +0,0 @@ /**

2

package.json
{
"name": "@surma/rollup-plugin-off-main-thread",
"version": "2.2.1",
"version": "2.2.2",
"description": "Use Rollup with workers and ES6 modules today.",

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

@@ -40,6 +40,8 @@ # rollup-plugin-off-main-thread

In your project's code:
In your project's code use a module-relative path via `new URL` to include a Worker:
```js
const worker = new Worker("./worker.js", { type: "module" });
const worker = new Worker(new URL("worker.js", import.meta.url), {
type: "module"
});
```

@@ -49,10 +51,14 @@

If required, the plugin also supports explicitly module-relative paths:
If required, the plugin also supports plain literal paths:
```js
const worker = new Worker(new URL("./worker.js", import.meta.url), {
type: "module"
});
const worker = new Worker("./worker.js", { type: "module" });
```
However, those are less portable: in Rollup they would result in module-relative
path, but if used directly in the browser, they'll be relative to the document
URL instead.
Hence, they're deprecated and `new URL` pattern is encouraged instead for portability.
### Importing workers as URLs

@@ -59,0 +65,0 @@

{
"extends": ["config:base"]
}

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ const MARKER = "my-special-import";

@@ -0,0 +0,0 @@ let worker;

{
"urlLoaderScheme": "fancy-custom-scheme"
}

@@ -0,0 +0,0 @@ module.exports = (config, outputOptions, omt) => {

{
"publicPath": "/base/tests/fixtures/public-path/build"
}

@@ -15,3 +15,3 @@ /**

// The type module should get removed for AMD format!
const w = new Worker(new URL("./worker.js", import.meta.url), {
const w = new Worker(new URL("worker.js", import.meta.url), {
type: "module"

@@ -18,0 +18,0 @@ });

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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