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

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

Package Overview
Dependencies
Maintainers
1
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 1.2.0 to 1.3.0

tests/asset-in-worker.test.js

10

index.js

@@ -45,4 +45,2 @@ /**

const prefix = `"${opts.marker}_start" + import(`;
const suffix = `) + "${opts.marker}_end"`;
const urlLoaderPrefix = opts.urlLoaderScheme + ":";

@@ -98,3 +96,3 @@

if (!/^\.*\//.test(workerFile)) {
if (!new RegExp("^.*/").test(workerFile)) {
this.warn(

@@ -106,3 +104,3 @@ `Paths passed to the Worker constructor must be relative or absolute, i.e. start with /, ./ or ../ (just like dynamic import!). Ignoring "${workerFile}".`

const resolvedWorkerFile = await this.resolveId(workerFile, id);
const resolvedWorkerFile = (await this.resolve(workerFile, id)).id;
workerFiles.push(resolvedWorkerFile);

@@ -130,2 +128,6 @@ const chunkRefId = this.emitFile({

resolveFileUrl(chunk) {
return `"./${chunk.fileName}"`;
},
renderChunk(code, chunk, outputOptions) {

@@ -132,0 +134,0 @@ if (outputOptions.format !== "amd") {

4

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

@@ -23,3 +23,3 @@ "main": "index.js",

"prettier": "1.18.2",
"rollup": "1.31.1"
"rollup": "2.0.0-0"
},

@@ -26,0 +26,0 @@ "repository": {

@@ -22,34 +22,49 @@ /**

async function fileExists(file) {
try {
const stat = await fs.promises.stat(file);
return stat.isFile();
} catch (e) {
return false;
}
}
async function init() {
[
"./tests/fixtures/simple-bundle/entry.js",
"./tests/fixtures/import-meta/entry.js",
"./tests/fixtures/dynamic-import/entry.js",
"./tests/fixtures/public-path/entry.js",
"./tests/fixtures/worker/entry.js",
"./tests/fixtures/more-workers/entry.js",
"./tests/fixtures/amd-function-name/entry.js",
"./tests/fixtures/single-default/entry.js",
"./tests/fixtures/import-worker-url/entry.js",
"./tests/fixtures/import-worker-url-custom-scheme/entry.js"
].forEach(async input => {
const pathName = path.dirname(input);
let config = {};
try {
const configPath = path.join(pathName, "config.json");
config = JSON.parse(fs.readFileSync(configPath).toString());
} catch (e) {}
const bundle = await rollup.rollup({
input,
await Promise.all(
[
"./tests/fixtures/simple-bundle/entry.js",
"./tests/fixtures/import-meta/entry.js",
"./tests/fixtures/dynamic-import/entry.js",
"./tests/fixtures/public-path/entry.js",
"./tests/fixtures/worker/entry.js",
"./tests/fixtures/more-workers/entry.js",
"./tests/fixtures/amd-function-name/entry.js",
"./tests/fixtures/single-default/entry.js",
"./tests/fixtures/import-worker-url/entry.js",
"./tests/fixtures/import-worker-url-custom-scheme/entry.js",
"./tests/fixtures/assets-in-worker/entry.js"
].map(async input => {
const pathName = path.dirname(input);
let rollupConfig = {
input,
strictDeprecations: true
};
const rollupConfigPath = "./" + path.join(pathName, "rollup.config.js");
const configPath = "./" + path.join(pathName, "config.json");
if (await fileExists(rollupConfigPath)) {
require(rollupConfigPath)(rollupConfig, omt);
} else if (await fileExists(configPath)) {
rollupConfig.plugins = [omt(require(configPath))];
} else {
rollupConfig.plugins = [omt()];
}
const bundle = await rollup.rollup(rollupConfig);
const outputOptions = {
dir: path.join(pathName, "build"),
format: "amd"
};
await bundle.write(outputOptions);
})
);
plugins: [omt(config)]
});
const outputOptions = {
dir: path.join(pathName, "build"),
format: "amd"
};
await bundle.generate(outputOptions);
await bundle.write(outputOptions);
});
const karmaConfig = { port: 9876 };

@@ -56,0 +71,0 @@ myKarmaConfig({

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