Comparing version 1.0.0-beta.2-tsconfig.2 to 1.0.0-beta.3-bugfix-148
export * from "./master/index"; | ||
export { expose } from "./worker/index"; | ||
export { Observable } from "./observable"; | ||
export { Transfer, TransferDescriptor } from "./transferable"; |
@@ -9,5 +9,3 @@ "use strict"; | ||
exports.expose = index_1.expose; | ||
var observable_1 = require("./observable"); | ||
exports.Observable = observable_1.Observable; | ||
var transferable_1 = require("./transferable"); | ||
exports.Transfer = transferable_1.Transfer; |
"use strict"; | ||
// tslint:disable no-eval max-classes-per-file | ||
// tslint:disable function-constructor no-eval max-classes-per-file | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -18,3 +18,34 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const path = __importStar(require("path")); | ||
let tsNodeAvailable; | ||
const defaultPoolSize = os_1.cpus().length; | ||
function detectTsNode() { | ||
if (typeof __non_webpack_require__ === "function") { | ||
// Webpack build: => No ts-node required or possible | ||
return false; | ||
} | ||
if (tsNodeAvailable) { | ||
return tsNodeAvailable; | ||
} | ||
try { | ||
require.resolve("ts-node"); | ||
tsNodeAvailable = true; | ||
} | ||
catch (error) { | ||
if (error && error.code === "MODULE_NOT_FOUND") { | ||
tsNodeAvailable = false; | ||
} | ||
else { | ||
// Re-throw | ||
throw error; | ||
} | ||
} | ||
return tsNodeAvailable; | ||
} | ||
function createTsNodeModule(scriptPath) { | ||
const content = ` | ||
require("ts-node/register/transpile-only"); | ||
require(${JSON.stringify(scriptPath)}); | ||
`; | ||
return content; | ||
} | ||
function rebaseScriptPath(scriptPath, ignoreRegex) { | ||
@@ -27,3 +58,3 @@ const parentCallSite = callsites_1.default().find((callsite) => { | ||
const rebasedScriptPath = callerPath ? path.join(path.dirname(callerPath), scriptPath) : scriptPath; | ||
return rebasedScriptPath.replace(/\.ts$/, ".js"); | ||
return rebasedScriptPath; | ||
} | ||
@@ -44,3 +75,9 @@ function resolveScriptPath(scriptPath) { | ||
constructor(scriptPath) { | ||
super(resolveScriptPath(scriptPath)); | ||
const resolvedScriptPath = resolveScriptPath(scriptPath); | ||
if (resolvedScriptPath.match(/\.tsx?$/i) && detectTsNode()) { | ||
super(createTsNodeModule(resolvedScriptPath), { eval: true }); | ||
} | ||
else { | ||
super(resolvedScriptPath); | ||
} | ||
this.mappedEventListeners = new WeakMap(); | ||
@@ -72,3 +109,8 @@ } | ||
: resolveScriptPath(scriptPath); | ||
super(resolvedScriptPath, [], { esm: true }); | ||
if (resolvedScriptPath.match(/\.tsx?$/i) && detectTsNode()) { | ||
super(new Function(createTsNodeModule(resolveScriptPath(scriptPath))), [], { esm: true }); | ||
} | ||
else { | ||
super(resolvedScriptPath, [], { esm: true }); | ||
} | ||
allWorkers.push(this); | ||
@@ -75,0 +117,0 @@ this.emitter = new events_1.default(); |
@@ -7,2 +7,3 @@ import { Worker as WorkerType } from "../types/master"; | ||
export declare type Worker = WorkerType; | ||
/** Worker implementation. Either web worker or a node.js Worker class. */ | ||
export declare const Worker: typeof import("../types/master").WorkerImplementation; |
@@ -13,2 +13,3 @@ "use strict"; | ||
exports.Thread = thread_1.Thread; | ||
/** Worker implementation. Either web worker or a node.js Worker class. */ | ||
exports.Worker = implementation_1.default.selectWorkerImplementation(); |
@@ -1,2 +0,2 @@ | ||
import { Observable } from "../observable"; | ||
import Observable from "zen-observable"; | ||
import { Thread } from "./thread"; | ||
@@ -8,2 +8,3 @@ export { Thread }; | ||
} | ||
/** Pool event type. Specifies the type of each `PoolEvent`. */ | ||
export declare enum PoolEventType { | ||
@@ -20,2 +21,3 @@ initialized = "initialized", | ||
declare type TaskRunFunction<ThreadType extends Thread, Return> = (worker: ThreadType) => Promise<Return>; | ||
/** Pool event. Subscribe to those events using `pool.events()`. Useful for debugging. */ | ||
export declare type PoolEvent<ThreadType extends Thread> = { | ||
@@ -69,3 +71,3 @@ type: PoolEventType.initialized; | ||
/** | ||
* Thread pool implementation managing a set of worker threads. | ||
* Thread pool managing a set of worker threads. | ||
* Use it to queue tasks that are run on those threads with limited | ||
@@ -108,4 +110,7 @@ * concurrency. | ||
declare function PoolConstructor<ThreadType extends Thread>(spawnWorker: () => Promise<ThreadType>, optionsOrSize?: number | PoolOptions): Pool<ThreadType>; | ||
/** | ||
* Thread pool constructor. Creates a new pool and spawns its worker threads. | ||
*/ | ||
export declare const Pool: typeof PoolConstructor & { | ||
EventType: typeof PoolEventType; | ||
}; |
@@ -15,3 +15,3 @@ "use strict"; | ||
const debug_1 = __importDefault(require("debug")); | ||
const observable_1 = require("../observable"); | ||
const zen_observable_1 = __importDefault(require("zen-observable")); | ||
const observable_promise_1 = require("../observable-promise"); | ||
@@ -33,2 +33,3 @@ const implementation_1 = __importDefault(require("./implementation")); | ||
} | ||
/** Pool event type. Specifies the type of each `PoolEvent`. */ | ||
var PoolEventType; | ||
@@ -102,3 +103,3 @@ (function (PoolEventType) { | ||
let eventSubject; | ||
const eventObservable = observable_promise_1.makeHot(new observable_1.Observable(subscriber => { | ||
const eventObservable = observable_promise_1.makeHot(new zen_observable_1.default(subscriber => { | ||
eventSubject = subscriber; | ||
@@ -251,2 +252,5 @@ })); | ||
PoolConstructor.EventType = PoolEventType; | ||
/** | ||
* Thread pool constructor. Creates a new pool and spawns its worker threads. | ||
*/ | ||
exports.Pool = PoolConstructor; |
@@ -1,2 +0,2 @@ | ||
import { Observable } from "../observable"; | ||
import Observable from "zen-observable"; | ||
import { FunctionThread, ModuleThread, Worker as WorkerType } from "../types/master"; | ||
@@ -10,3 +10,10 @@ import { WorkerFunction, WorkerModule } from "../types/worker"; | ||
declare type StripAsync<Type> = Type extends Promise<infer PromiseBaseType> ? PromiseBaseType : Type extends Observable<infer ObservableBaseType> ? ObservableBaseType : Type; | ||
/** | ||
* Spawn a new thread. Takes a fresh worker instance, wraps it in a thin | ||
* abstraction layer to provide the transparent API and verifies that | ||
* the worker has initialized successfully. | ||
* | ||
* @param worker Instance of `Worker`. Either a web worker, `worker_threads` worker or `tiny-worker` worker. | ||
*/ | ||
export declare function spawn<Exposed extends WorkerFunction | WorkerModule<any> = ArbitraryWorkerInterface>(worker: WorkerType): Promise<ExposedToThreadType<Exposed>>; | ||
export {}; |
@@ -15,4 +15,4 @@ "use strict"; | ||
const debug_1 = __importDefault(require("debug")); | ||
const zen_observable_1 = __importDefault(require("zen-observable")); | ||
const common_1 = require("../common"); | ||
const observable_1 = require("../observable"); | ||
const promise_1 = require("../promise"); | ||
@@ -59,3 +59,3 @@ const symbols_1 = require("../symbols"); | ||
function createEventObservable(worker, workerTermination) { | ||
return new observable_1.Observable(observer => { | ||
return new zen_observable_1.default(observer => { | ||
const messageHandler = ((messageEvent) => { | ||
@@ -111,2 +111,9 @@ const workerEvent = { | ||
} | ||
/** | ||
* Spawn a new thread. Takes a fresh worker instance, wraps it in a thin | ||
* abstraction layer to provide the transparent API and verifies that | ||
* the worker has initialized successfully. | ||
* | ||
* @param worker Instance of `Worker`. Either a web worker, `worker_threads` worker or `tiny-worker` worker. | ||
*/ | ||
function spawn(worker) { | ||
@@ -113,0 +120,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -0,7 +1,12 @@ | ||
import Observable from "zen-observable"; | ||
import { Thread as ThreadType, WorkerEvent } from "../types/master"; | ||
export declare type Thread = ThreadType; | ||
/** Thread utility functions. Use them to manage or inspect a `spawn()`-ed thread. */ | ||
export declare const Thread: { | ||
errors<ThreadT extends ThreadType>(thread: ThreadT): import("../observable").ObservableT<Error>; | ||
events<ThreadT extends ThreadType>(thread: ThreadT): import("../observable").ObservableT<WorkerEvent>; | ||
/** Return an observable that can be used to subscribe to all errors happening in the thread. */ | ||
errors<ThreadT extends ThreadType>(thread: ThreadT): Observable<Error>; | ||
/** Return an observable that can be used to subscribe to internal events happening in the thread. Useful for debugging. */ | ||
events<ThreadT extends ThreadType>(thread: ThreadT): Observable<WorkerEvent>; | ||
/** Terminate a thread. Remember to terminate every thread when you are done using it. */ | ||
terminate<ThreadT extends ThreadType>(thread: ThreadT): Promise<void>; | ||
}; |
@@ -7,9 +7,13 @@ "use strict"; | ||
} | ||
/** Thread utility functions. Use them to manage or inspect a `spawn()`-ed thread. */ | ||
exports.Thread = { | ||
/** Return an observable that can be used to subscribe to all errors happening in the thread. */ | ||
errors(thread) { | ||
return thread[symbols_1.$errors] || fail("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise."); | ||
}, | ||
/** Return an observable that can be used to subscribe to internal events happening in the thread. Useful for debugging. */ | ||
events(thread) { | ||
return thread[symbols_1.$events] || fail("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise."); | ||
}, | ||
/** Terminate a thread. Remember to terminate every thread when you are done using it. */ | ||
terminate(thread) { | ||
@@ -16,0 +20,0 @@ return thread[symbols_1.$terminate](); |
@@ -1,4 +0,4 @@ | ||
import { Observable, SubscriptionObserver } from "./observable"; | ||
import Observable from "zen-observable"; | ||
export declare type ObservablePromise<T> = Promise<T> & Observable<T>; | ||
declare type Initializer<T> = (resolve: (value?: T) => void, reject: (error: Error) => void, observer: SubscriptionObserver<T>) => UnsubscribeFn | void; | ||
declare type Initializer<T> = (resolve: (value?: T) => void, reject: (error: Error) => void, observer: ZenObservable.SubscriptionObserver<T>) => UnsubscribeFn | void; | ||
declare type UnsubscribeFn = () => void; | ||
@@ -9,4 +9,4 @@ /** | ||
* It is used to proxy async process states when we are initially not sure | ||
* if that async process will yield values/errors once (-> Promise) or | ||
* multiple times (-> Observable). | ||
* if that async process will yield values once (-> Promise) or multiple | ||
* times (-> Observable). | ||
* | ||
@@ -13,0 +13,0 @@ * Note that the observable promise inherits some of zen-observable's characteristics: |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const observable_1 = require("./observable"); | ||
const zen_observable_1 = __importDefault(require("zen-observable")); | ||
const doNothing = () => undefined; | ||
@@ -14,4 +17,4 @@ const returnInput = (input) => input; | ||
* It is used to proxy async process states when we are initially not sure | ||
* if that async process will yield values/errors once (-> Promise) or | ||
* multiple times (-> Observable). | ||
* if that async process will yield values once (-> Promise) or multiple | ||
* times (-> Observable). | ||
* | ||
@@ -55,3 +58,3 @@ * Note that the observable promise inherits some of zen-observable's characteristics: | ||
}; | ||
const observable = new observable_1.Observable(originalObserver => { | ||
const observable = new zen_observable_1.default(originalObserver => { | ||
const observer = Object.assign({}, originalObserver, { complete() { | ||
@@ -58,0 +61,0 @@ originalObserver.complete(); |
@@ -1,42 +0,3 @@ | ||
/// <reference path="../types/zen-observable.d.ts" /> | ||
import BaseObservable from "zen-observable"; | ||
import Observable from "zen-observable"; | ||
declare const $observers: unique symbol; | ||
export interface SubscriptionObserver<T> { | ||
closed: boolean; | ||
next(value: T): void; | ||
error(errorValue: any): void; | ||
complete(): void; | ||
} | ||
export interface Subscription { | ||
closed: boolean; | ||
unsubscribe(): void; | ||
} | ||
export interface Observer<T> { | ||
start?(subscription: Subscription): any; | ||
next?(value: T): void; | ||
error?(errorValue: any): void; | ||
complete?(): void; | ||
} | ||
export declare type Subscriber<T> = (observer: SubscriptionObserver<T>) => void | (() => void) | Subscription; | ||
export interface ObservableLike<T> { | ||
subscribe?: Subscriber<T>; | ||
[Symbol.observable](): ObservableT<T> | ObservableLike<T>; | ||
} | ||
export declare class ObservableT<T> { | ||
constructor(subscriber: Subscriber<T>); | ||
subscribe(observer: Observer<T>): Subscription; | ||
subscribe(onNext: (value: T) => void, onError?: (error: any) => void, onComplete?: () => void): Subscription; | ||
[Symbol.observable](): ObservableT<T>; | ||
forEach(callback: (value: T) => void): Promise<void>; | ||
map<R>(callback: (value: T) => R): ObservableT<R>; | ||
filter(callback: (value: T) => boolean): ObservableT<T>; | ||
reduce(callback: (previousValue: T, currentValue: T) => T, initialValue?: T): ObservableT<T>; | ||
reduce<R>(callback: (previousValue: R, currentValue: T) => R, initialValue?: R): ObservableT<R>; | ||
flatMap<R>(callback: (value: T) => ObservableLike<R>): ObservableT<R>; | ||
concat<R>(...observable: Array<ObservableT<R>>): ObservableT<R>; | ||
static from<R>(observable: ObservableT<R> | ObservableLike<R> | ArrayLike<R>): ObservableT<R>; | ||
static of<R>(...items: R[]): ObservableT<R>; | ||
} | ||
export declare const Observable: typeof BaseObservable; | ||
export declare type Observable<T> = ObservableT<T>; | ||
/** | ||
@@ -51,3 +12,3 @@ * Observable subject. Implements the Observable interface, but also exposes | ||
*/ | ||
export declare class Subject<T> extends BaseObservable<T> implements ObservableLike<T> { | ||
declare class Subject<T> extends Observable<T> implements ZenObservable.ObservableLike<T> { | ||
private [$observers]; | ||
@@ -59,2 +20,2 @@ constructor(); | ||
} | ||
export {}; | ||
export { Observable, Subject }; |
"use strict"; | ||
// tslint:disable max-classes-per-file no-reference | ||
/// <reference path="../types/zen-observable.d.ts" /> | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -8,7 +6,5 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Somewhat unelegant code to prevent the consuming app's tsconfig needing to set | ||
// `compilerOptions.esModuleInterop` | ||
const zen_observable_1 = __importDefault(require("zen-observable")); | ||
exports.Observable = zen_observable_1.default; | ||
const $observers = Symbol("observers"); | ||
exports.Observable = zen_observable_1.default; | ||
/** | ||
@@ -15,0 +11,0 @@ * Observable subject. Implements the Observable interface, but also exposes |
@@ -0,1 +1,5 @@ | ||
/** | ||
* Creates a new promise and exposes its resolver function. | ||
* Use with care! | ||
*/ | ||
export declare function createPromiseWithResolver<T>(): [Promise<T>, (result: T) => void]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const doNothing = () => undefined; | ||
/** | ||
* Creates a new promise and exposes its resolver function. | ||
* Use with care! | ||
*/ | ||
function createPromiseWithResolver() { | ||
@@ -5,0 +9,0 @@ let alreadyResolved = false; |
import { $transferable } from "./symbols"; | ||
import { Transferable } from "./types/dom"; | ||
export interface TransferDescriptor<T = any> { | ||
@@ -9,2 +8,18 @@ [$transferable]: true; | ||
export declare function isTransferDescriptor(thing: any): thing is TransferDescriptor; | ||
/** | ||
* Mark a transferable object as such, so it will no be serialized and | ||
* deserialized on messaging with the main thread, but to transfer | ||
* ownership of it to the receiving thread. | ||
* | ||
* Only works with array buffers, message ports and few more special | ||
* types of objects, but it's much faster than serializing and | ||
* deserializing them. | ||
* | ||
* Note: | ||
* The transferable object cannot be accessed by this thread again | ||
* unless the receiving thread transfers it back again! | ||
* | ||
* @param transferable Array buffer, message port or similar. | ||
* @see <https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast> | ||
*/ | ||
export declare function Transfer(transferable: Transferable): TransferDescriptor; |
@@ -14,2 +14,19 @@ "use strict"; | ||
exports.isTransferDescriptor = isTransferDescriptor; | ||
/** | ||
* Mark transferable objects within an arbitrary object or array as | ||
* being a transferable object. They will then not be serialized | ||
* and deserialized on messaging with the main thread, but ownership | ||
* of them will be tranferred to the receiving thread. | ||
* | ||
* Only array buffers, message ports and few more special types of | ||
* objects can be transferred, but it's much faster than serializing and | ||
* deserializing them. | ||
* | ||
* Note: | ||
* The transferable object cannot be accessed by this thread again | ||
* unless the receiving thread transfers it back again! | ||
* | ||
* @param transferable Array buffer, message port or similar. | ||
* @see <https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast> | ||
*/ | ||
function Transfer(payload, transferables) { | ||
@@ -16,0 +33,0 @@ if (!transferables) { |
@@ -1,5 +0,4 @@ | ||
import { Observable } from "../observable"; | ||
import Observable from "zen-observable"; | ||
import { ObservablePromise } from "../observable-promise"; | ||
import { $errors, $events, $terminate, $worker } from "../symbols"; | ||
import { EventTarget, Transferable, Worker } from "./dom"; | ||
export declare type ModuleMethods = { | ||
@@ -20,4 +19,11 @@ [methodName: string]: (...args: any) => any; | ||
export declare type ModuleThread<Methods extends ModuleMethods = any> = ModuleProxy<Methods> & PrivateThreadProps; | ||
export declare type Thread = FunctionThread<any, any> | ModuleThread<any>; | ||
interface AnyFunctionThread extends PrivateThreadProps { | ||
(...args: any[]): ObservablePromise<any>; | ||
} | ||
interface AnyModuleThread extends PrivateThreadProps { | ||
} | ||
/** Worker thread. Either a `FunctionThread` or a `ModuleThread`. */ | ||
export declare type Thread = AnyFunctionThread | AnyModuleThread; | ||
export declare type TransferList = Transferable[]; | ||
/** Worker instance. Either a web worker or a node.js Worker provided by `worker_threads` or `tiny-worker`. */ | ||
export interface Worker extends EventTarget { | ||
@@ -27,2 +33,3 @@ postMessage(value: any, transferList?: TransferList): void; | ||
} | ||
/** Worker implementation. Either web worker or a node.js Worker class. */ | ||
export declare class WorkerImplementation extends EventTarget implements Worker { | ||
@@ -33,2 +40,3 @@ constructor(path: string); | ||
} | ||
/** Event as emitted by worker thread. Subscribe to using `Thread.events(thread)`. */ | ||
export declare enum WorkerEventType { | ||
@@ -51,1 +59,2 @@ internalError = "internalError", | ||
export declare type WorkerEvent = WorkerInternalErrorEvent | WorkerMessageEvent<any> | WorkerTerminationEvent; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const symbols_1 = require("../symbols"); | ||
const dom_1 = require("./dom"); | ||
/** Event as emitted by worker thread. Subscribe to using `Thread.events(thread)`. */ | ||
var WorkerEventType; | ||
@@ -6,0 +6,0 @@ (function (WorkerEventType) { |
@@ -1,2 +0,1 @@ | ||
import { Transferable } from "./dom"; | ||
declare type UnsubscribeFn = () => void; | ||
@@ -3,0 +2,0 @@ export interface AbstractedWorkerAPI { |
/// <reference no-default-lib="true"/> | ||
declare const _default: { | ||
isWorkerRuntime: () => boolean; | ||
postMessageToMaster: (message: any, transferList?: import("../types/dom").Transferable[] | undefined) => void; | ||
postMessageToMaster: (message: any, transferList?: Transferable[] | undefined) => void; | ||
subscribeToMasterMessages: (onMessage: (data: any) => void) => () => void; | ||
}; | ||
export default _default; |
/// <reference no-default-lib="true"/> | ||
declare const _default: { | ||
isWorkerRuntime: () => boolean; | ||
postMessageToMaster: (message: any, transferList?: import("../types/dom").Transferable[] | undefined) => void; | ||
postMessageToMaster: (message: any, transferList?: Transferable[] | undefined) => void; | ||
subscribeToMasterMessages: (onMessage: (data: any) => void) => () => void; | ||
}; | ||
export default _default; |
declare const _default: { | ||
isWorkerRuntime: () => boolean; | ||
postMessageToMaster: (message: any, transferList?: import("../types/dom").Transferable[] | undefined) => void; | ||
postMessageToMaster: (message: any, transferList?: Transferable[] | undefined) => void; | ||
subscribeToMasterMessages: (onMessage: (data: any) => void) => () => void; | ||
}; | ||
export default _default; |
@@ -1,5 +0,10 @@ | ||
import { Observable } from "../observable"; | ||
import { WorkerFunction, WorkerModule } from "../types/worker"; | ||
export { Transfer } from "../transferable"; | ||
export { Observable }; | ||
/** | ||
* Expose a function or a module (an object whose values are functions) | ||
* to the main thread. Must be called exactly once in every worker thread | ||
* to signal its API to the main thread. | ||
* | ||
* @param exposed Function or object whose values are functions | ||
*/ | ||
export declare function expose(exposed: WorkerFunction | WorkerModule<any>): void; |
@@ -16,4 +16,2 @@ "use strict"; | ||
const common_1 = require("../common"); | ||
const observable_1 = require("../observable"); | ||
exports.Observable = observable_1.Observable; | ||
const transferable_1 = require("../transferable"); | ||
@@ -114,2 +112,9 @@ const messages_1 = require("../types/messages"); | ||
} | ||
/** | ||
* Expose a function or a module (an object whose values are functions) | ||
* to the main thread. Must be called exactly once in every worker thread | ||
* to signal its API to the main thread. | ||
* | ||
* @param exposed Function or object whose values are functions | ||
*/ | ||
function expose(exposed) { | ||
@@ -158,3 +163,3 @@ if (!implementation_1.default.isWorkerRuntime()) { | ||
} | ||
if (typeof process !== "undefined" && implementation_1.default.isWorkerRuntime()) { | ||
if (typeof process !== "undefined" && typeof process.on === "function" && implementation_1.default.isWorkerRuntime()) { | ||
process.on("uncaughtException", (error) => { | ||
@@ -161,0 +166,0 @@ // Post with some delay, so the master had some time to subscribe to messages |
{ | ||
"name": "threads", | ||
"version": "1.0.0-beta.2-tsconfig.2", | ||
"version": "1.0.0-beta.3-bugfix-148", | ||
"description": "Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron", | ||
@@ -9,7 +9,6 @@ "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", | ||
"test:ava": "cross-env TS_NODE_FILES=true ava", | ||
"test:puppeteer:basic": "puppet-run plugin:mocha ./test/*.chromium*.ts", | ||
"test:puppeteer:webpack": "puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts", | ||
"test:puppeteer:basic": "puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts", | ||
"test:puppeteer:webpack": "puppet-run --serve ./test/webpack/dist.web/0.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts", | ||
"posttest": "tslint --project .", | ||
@@ -27,3 +26,3 @@ "prepare": "run-s build" | ||
}, | ||
"homepage": "https://github.com/andywer/threads.js#readme", | ||
"homepage": "https://threads.js.org", | ||
"keywords": [ | ||
@@ -40,2 +39,3 @@ "thread", | ||
"dependencies": { | ||
"@types/zen-observable": "^0.8.0", | ||
"callsites": "^3.1.0", | ||
@@ -53,3 +53,2 @@ "debug": "^4.1.1", | ||
"@types/debug": "^4.1.4", | ||
"@types/execa": "^0.9.0", | ||
"@types/mocha": "^5.2.6", | ||
@@ -61,7 +60,6 @@ "@types/node": "^11.13.8", | ||
"cross-env": "^5.2.0", | ||
"execa": "^2.0.3", | ||
"mocha": "^5.2.0", | ||
"npm-run-all": "^4.1.5", | ||
"puppet-run": "^0.5.0", | ||
"puppet-run-plugin-mocha": "^0.1.1", | ||
"puppet-run": "^0.10.0-alpha", | ||
"puppet-run-plugin-mocha": "^0.10.0-alpha", | ||
"rimraf": "^2.6.3", | ||
@@ -108,3 +106,2 @@ "threads-plugin": "^1.0.0", | ||
"dist/**", | ||
"types/**", | ||
"*.js", | ||
@@ -111,0 +108,0 @@ "*.ts" |
@@ -14,6 +14,6 @@ <h1 align="center">threads</h1> | ||
* **Speed up** code by parallel processing | ||
* **Keep UI responsive** by offloading work from rendering thread | ||
* First-class support for **async functions** & **observables** | ||
* Manage bulk task executions with **thread pools** | ||
* Works great with **webpack** | ||
* Allows using **require()** and **import**/**export** in workers | ||
@@ -185,2 +185,3 @@ ### Version 0.x | ||
- [**Basics**](https://threads.js.org/usage#basics) | ||
- [**TypeScript**](https://threads.js.org/usage#typescript) | ||
- [**Observables**](https://threads.js.org/usage#observables) | ||
@@ -187,0 +188,0 @@ - [**Thread pool**](https://threads.js.org/usage#thread-pool) |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
26
214
81877
6
60
1773
3
+ Added@types/zen-observable@^0.8.0
+ Added@types/zen-observable@0.8.7(transitive)