You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
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

to
1.0.0-beta.2-ts-node-worker

25

dist/master/implementation.node.js

@@ -26,3 +26,3 @@ "use strict";

const rebasedScriptPath = callerPath ? path.join(path.dirname(callerPath), scriptPath) : scriptPath;
return rebasedScriptPath.replace(/\.ts$/, ".js");
return rebasedScriptPath;
}

@@ -43,3 +43,13 @@ function resolveScriptPath(scriptPath) {

constructor(scriptPath) {
super(resolveScriptPath(scriptPath));
const resolvedScriptPath = resolveScriptPath(scriptPath);
if (resolvedScriptPath.match(/\.tsx?$/)) {
const content = `
require("ts-node/register/transpile-only");
require(${JSON.stringify(resolvedScriptPath)});
`;
super(content, { eval: true });
}
else {
super(resolvedScriptPath);
}
this.mappedEventListeners = new WeakMap();

@@ -71,3 +81,12 @@ }

: resolveScriptPath(scriptPath);
super(resolvedScriptPath, [], { esm: true });
if (resolvedScriptPath.match(/\.tsx?$/)) {
const content = `
require("ts-node/register/transpile-only");
require(${JSON.stringify(resolvedScriptPath)});
`;
super(new Function(content), [], { esm: true });
}
else {
super(resolvedScriptPath, [], { esm: true });
}
allWorkers.push(this);

@@ -74,0 +93,0 @@ this.emitter = new events_1.default();

3

package.json
{
"name": "threads",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.2-ts-node-worker",
"description": "Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron",

@@ -9,3 +9,2 @@ "main": "dist/index.js",

"build": "tsc",
"pretest": "babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts",
"test": "run-s test:ava test:puppeteer:basic test:puppeteer:webpack",

@@ -12,0 +11,0 @@ "test:ava": "cross-env TS_NODE_FILES=true ava",

@@ -149,3 +149,3 @@ <h1 align="center">threads</h1>

await Thread.terminate(sum)
await Thread.terminate(add)
}

@@ -152,0 +152,0 @@