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

threads

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

threads - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0-error-reporting-fix

40

dist-esm/master/implementation.node.js

@@ -1,2 +0,2 @@

// tslint:disable function-constructor no-eval max-classes-per-file
// tslint:disable function-constructor no-eval no-duplicate-super max-classes-per-file
import getCallsites from "callsites";

@@ -41,3 +41,6 @@ import EventEmitter from "events";

const filename = callsite.getFileName();
return Boolean(filename && !filename.match(ignoreRegex) && !filename.match(/[\/\\]master[\/\\]implementation/));
return Boolean(filename &&
!filename.match(ignoreRegex) &&
!filename.match(/[\/\\]master[\/\\]implementation/) &&
!filename.match(/^internal\/process/));
});

@@ -48,7 +51,10 @@ const callerPath = parentCallSite ? parentCallSite.getFileName() : null;

}
function resolveScriptPath(scriptPath) {
// eval() hack is also webpack-related
function resolveScriptPath(scriptPath, baseURL) {
const makeRelative = (filePath) => {
// eval() hack is also webpack-related
return path.isAbsolute(filePath) ? filePath : path.join(baseURL || eval("__dirname"), filePath);
};
const workerFilePath = typeof __non_webpack_require__ === "function"
? __non_webpack_require__.resolve(path.join(eval("__dirname"), scriptPath))
: require.resolve(rebaseScriptPath(scriptPath, /[\/\\]worker_threads[\/\\]/));
? __non_webpack_require__.resolve(makeRelative(scriptPath))
: require.resolve(makeRelative(rebaseScriptPath(scriptPath, /[\/\\]worker_threads[\/\\]/)));
return workerFilePath;

@@ -64,6 +70,15 @@ }

constructor(scriptPath, options) {
const resolvedScriptPath = resolveScriptPath(scriptPath);
const resolvedScriptPath = resolveScriptPath(scriptPath, (options || {})._baseURL);
if (resolvedScriptPath.match(/\.tsx?$/i) && detectTsNode()) {
super(createTsNodeModule(resolvedScriptPath), { eval: true });
super(createTsNodeModule(resolvedScriptPath), Object.assign(Object.assign({}, options), { eval: true }));
}
else if (resolvedScriptPath.match(/\.asar[\/\\]/)) {
try {
super(resolvedScriptPath, options);
}
catch (_a) {
// See <https://github.com/andywer/threads-plugin/issues/17>
super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), options);
}
}
else {

@@ -110,2 +125,11 @@ super(resolvedScriptPath, options);

}
else if (resolvedScriptPath.match(/\.asar[\/\\]/)) {
try {
super(resolvedScriptPath, [], { esm: true });
}
catch (_a) {
// See <https://github.com/andywer/threads-plugin/issues/17>
super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), [], { esm: true });
}
}
else {

@@ -112,0 +136,0 @@ super(resolvedScriptPath, [], { esm: true });

@@ -88,4 +88,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

// tslint:disable-next-line no-console
console.error("Not reporting uncaught error back to master thread as it occured while " +
"reporting an uncaught error already. Latest error:", subError);
console.error("Not reporting uncaught error back to master thread as it " +
"occured while reporting an uncaught error already." +
"\nLatest error:", subError, "\nOriginal error:", error);
}

@@ -92,0 +93,0 @@ }

"use strict";
// tslint:disable function-constructor no-eval max-classes-per-file
// tslint:disable function-constructor no-eval no-duplicate-super max-classes-per-file
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -53,3 +53,6 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

const filename = callsite.getFileName();
return Boolean(filename && !filename.match(ignoreRegex) && !filename.match(/[\/\\]master[\/\\]implementation/));
return Boolean(filename &&
!filename.match(ignoreRegex) &&
!filename.match(/[\/\\]master[\/\\]implementation/) &&
!filename.match(/^internal\/process/));
});

@@ -60,7 +63,10 @@ const callerPath = parentCallSite ? parentCallSite.getFileName() : null;

}
function resolveScriptPath(scriptPath) {
// eval() hack is also webpack-related
function resolveScriptPath(scriptPath, baseURL) {
const makeRelative = (filePath) => {
// eval() hack is also webpack-related
return path.isAbsolute(filePath) ? filePath : path.join(baseURL || eval("__dirname"), filePath);
};
const workerFilePath = typeof __non_webpack_require__ === "function"
? __non_webpack_require__.resolve(path.join(eval("__dirname"), scriptPath))
: require.resolve(rebaseScriptPath(scriptPath, /[\/\\]worker_threads[\/\\]/));
? __non_webpack_require__.resolve(makeRelative(scriptPath))
: require.resolve(makeRelative(rebaseScriptPath(scriptPath, /[\/\\]worker_threads[\/\\]/)));
return workerFilePath;

@@ -76,6 +82,15 @@ }

constructor(scriptPath, options) {
const resolvedScriptPath = resolveScriptPath(scriptPath);
const resolvedScriptPath = resolveScriptPath(scriptPath, (options || {})._baseURL);
if (resolvedScriptPath.match(/\.tsx?$/i) && detectTsNode()) {
super(createTsNodeModule(resolvedScriptPath), { eval: true });
super(createTsNodeModule(resolvedScriptPath), Object.assign(Object.assign({}, options), { eval: true }));
}
else if (resolvedScriptPath.match(/\.asar[\/\\]/)) {
try {
super(resolvedScriptPath, options);
}
catch (_a) {
// See <https://github.com/andywer/threads-plugin/issues/17>
super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), options);
}
}
else {

@@ -122,2 +137,11 @@ super(resolvedScriptPath, options);

}
else if (resolvedScriptPath.match(/\.asar[\/\\]/)) {
try {
super(resolvedScriptPath, [], { esm: true });
}
catch (_a) {
// See <https://github.com/andywer/threads-plugin/issues/17>
super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), [], { esm: true });
}
}
else {

@@ -124,0 +148,0 @@ super(resolvedScriptPath, [], { esm: true });

@@ -95,4 +95,5 @@ "use strict";

// tslint:disable-next-line no-console
console.error("Not reporting uncaught error back to master thread as it occured while " +
"reporting an uncaught error already. Latest error:", subError);
console.error("Not reporting uncaught error back to master thread as it " +
"occured while reporting an uncaught error already." +
"\nLatest error:", subError, "\nOriginal error:", error);
}

@@ -99,0 +100,0 @@ }

2

package.json
{
"name": "threads",
"version": "1.3.1",
"version": "1.4.0-error-reporting-fix",
"description": "Web workers & worker threads as simple as a function call",

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

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