@surma/rollup-plugin-off-main-thread
Advanced tools
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 @@ /** |
{ | ||
"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 @@ /** |
@@ -0,0 +0,0 @@ /** |
{ | ||
"amdFunctionName": "foo" | ||
} |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ const MARKER = "my-special-import"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ let worker; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
{ | ||
"urlLoaderScheme": "fancy-custom-scheme" | ||
} |
@@ -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 @@ module.exports = (config, outputOptions, omt) => { |
@@ -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 @@ /** |
{ | ||
"publicPath": "/base/tests/fixtures/public-path/build" | ||
} |
@@ -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 @@ /** |
@@ -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 @@ /** |
@@ -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
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
1559
98
91305