Socket
Socket
Sign inDemoInstall

rollup-plugin-off-main-thread

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

43

index.js

@@ -24,3 +24,3 @@ /**

// unique enough to not appear in (minified) code accidentally.
marker: "_____TROLOLOLOL",
// marker: "_____TROLOLOLOL",
// Regexp for detecting worker calls

@@ -30,3 +30,3 @@ workerRegexp: /new Worker\((["'])(.+?)\1\)/g,

// Rollup has done its thing.
filenameRegexp: /(["'])([./].+?(?:\.js)?)\1/,
// filenameRegexp: /(["'])([./].+?(?:\.js)?)\1/,
// Function name to use instead of AMD’s `define`

@@ -48,13 +48,4 @@ amdFunctionName: "define"

async buildStart({ input }) {
async buildStart() {
workerFiles = [];
let inputs = input;
if (typeof inputs === "string") {
inputs = [inputs];
}
if (typeof inputs === "object") {
inputs = Object.values(inputs);
}
resolvedInputs = await Promise.all(inputs.map(id => this.resolve(id)));
return null;
},

@@ -92,7 +83,8 @@

workerFiles.push(resolvedWorkerFile);
const chunkRefId = this.emitChunk(resolvedWorkerFile);
const workerFileStartIndex = match.index + "new Worker(".length;
const workerFileEndIndex = match.index + match[0].length - ")".length;
ms.appendLeft(workerFileStartIndex, prefix);
ms.appendRight(workerFileEndIndex, suffix);
ms.overwrite(workerFileStartIndex, workerFileEndIndex, `import.meta.ROLLUP_CHUNK_URL_${chunkRefId}`);
}

@@ -119,25 +111,2 @@

// Remove markers from Worker constructors
const matcher = new RegExp(
`"${opts.marker}_start.+?${opts.marker}_end"`,
"g"
);
while (true) {
const match = matcher.exec(code);
if (!match) {
break;
}
const newFileNameMatch = opts.filenameRegexp.exec(match[0]);
let newFileName = newFileNameMatch[2];
if (!newFileName.endsWith(".js")) {
newFileName += ".js";
}
ms.overwrite(
match.index,
match.index + match[0].length,
`"${newFileName}"`
);
}
// Mangle define() call

@@ -144,0 +113,0 @@ const id = `./${chunk.fileName}`;

3

karma.conf.js

@@ -34,4 +34,3 @@ /**

concurrency: 1,
// browsers: ["Chrome", "Firefox", "Safari"],
browsers: ["ChromeHeadless"],
browsers: ["Chrome", "Firefox", "Safari"],
customLaunchers: {

@@ -38,0 +37,0 @@ DockerChrome: {

{
"name": "rollup-plugin-off-main-thread",
"version": "1.0.1",
"version": "1.1.0",
"description": "Use Rollup with workers and ES6 modules today.",

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc