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

@loaders.gl/worker-utils

Package Overview
Dependencies
Maintainers
9
Versions
205
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/worker-utils - npm Package Compare versions

Comparing version 4.2.0-alpha.5 to 4.2.0-alpha.6

3

dist/lib/async-queue/async-queue.js

@@ -19,2 +19,5 @@ // loaders.gl

export default class AsyncQueue {
_values;
_settlers;
_closed;
constructor() {

@@ -21,0 +24,0 @@ this._values = []; // enqueues > dequeues

4

dist/lib/env-utils/version.js

@@ -14,3 +14,3 @@ // loaders.gl

// __VERSION__ is injected by babel-plugin-version-inline
if (typeof "4.2.0-alpha.4" === 'undefined') {
if (typeof "4.2.0-alpha.5" === 'undefined') {
// eslint-disable-next-line

@@ -21,3 +21,3 @@ console.warn('loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.');

else {
globalThis._loadersgl_.version = "4.2.0-alpha.4";
globalThis._loadersgl_.version = "4.2.0-alpha.5";
}

@@ -24,0 +24,0 @@ }

@@ -1,3 +0,1 @@

/// <reference types="node" />
import * as ChildProcess from 'child_process';
export type ChildProcessProxyProps = {

@@ -16,3 +14,3 @@ command: string;

/** Options passed on to Node'.js `spawn` */
spawn?: ChildProcess.SpawnOptionsWithoutStdio;
spawn?: any;
/** Should proceed if stderr stream recieved data */

@@ -19,0 +17,0 @@ ignoreStderr?: boolean;

@@ -25,7 +25,9 @@ // loaders.gl

export default class ChildProcessProxy {
id;
props = { ...DEFAULT_PROPS };
childProcess = null;
port = 0;
successTimer; // NodeJS.Timeout;
// constructor(props?: {id?: string});
constructor({ id = 'browser-driver' } = {}) {
this.props = { ...DEFAULT_PROPS };
this.childProcess = null;
this.port = 0;
this.id = id;

@@ -32,0 +34,0 @@ }

@@ -5,2 +5,3 @@ // loaders.gl

import { getTransferList } from "../worker-utils/get-transfer-list.js";
// import type {TransferListItem} from '../node/worker_threads';
import { parentPort } from "../node/worker_threads.js";

@@ -51,3 +52,5 @@ /** Vile hack to defeat over-zealous bundlers from stripping out the require */

if (parentPort) {
parentPort.on('message', handleMessage);
parentPort.on('message', (message) => {
handleMessage(message);
});
// if (message == 'exit') { parentPort.unref(); }

@@ -54,0 +57,0 @@ // eslint-disable-next-line

@@ -16,2 +16,6 @@ // loaders.gl

export default class WorkerFarm {
props;
workerPools = new Map();
// singleton
static _workerFarm;
/** Checks if workers are supported on this platform */

@@ -29,3 +33,2 @@ static isSupported() {

constructor(props) {
this.workerPools = new Map();
this.props = { ...DEFAULT_PROPS };

@@ -32,0 +35,0 @@ this.setProps(props);

@@ -9,6 +9,10 @@ // loaders.gl

export default class WorkerJob {
name;
workerThread;
isRunning = true;
/** Promise that resolves when Job is done */
result;
_resolve = () => { };
_reject = () => { };
constructor(jobName, workerThread) {
this.isRunning = true;
this._resolve = () => { };
this._reject = () => { };
this.name = jobName;

@@ -15,0 +19,0 @@ this.workerThread = workerThread;

@@ -11,2 +11,14 @@ // loaders.gl

export default class WorkerPool {
name = 'unnamed';
source; // | Function;
url;
maxConcurrency = 1;
maxMobileConcurrency = 1;
onDebug = () => { };
reuseWorkers = true;
props = {};
jobQueue = [];
idleQueue = [];
count = 0;
isDestroyed = false;
/** Checks if workers are supported on this platform */

@@ -21,12 +33,2 @@ static isSupported() {

constructor(props) {
this.name = 'unnamed';
this.maxConcurrency = 1;
this.maxMobileConcurrency = 1;
this.onDebug = () => { };
this.reuseWorkers = true;
this.props = {};
this.jobQueue = [];
this.idleQueue = [];
this.count = 0;
this.isDestroyed = false;
this.source = props.source;

@@ -33,0 +35,0 @@ this.url = props.url;

@@ -14,2 +14,10 @@ // loaders.gl

export default class WorkerThread {
name;
source;
url;
terminated = false;
worker;
onMessage;
onError;
_loadableURL = '';
/** Checks if workers are supported on this platform */

@@ -21,4 +29,2 @@ static isSupported() {

constructor(props) {
this.terminated = false;
this._loadableURL = '';
const { name, source, url } = props;

@@ -25,0 +31,0 @@ assert(source || url); // Either source or url must be defined

@@ -32,2 +32,5 @@ "use strict";

var AsyncQueue = class {
_values;
_settlers;
_closed;
constructor() {

@@ -165,3 +168,5 @@ this._values = [];

if (parentPort2) {
parentPort2.on("message", handleMessage);
parentPort2.on("message", (message) => {
handleMessage(message);
});
parentPort2.on("exit", () => console.debug("Node worker closing"));

@@ -168,0 +173,0 @@ } else {

@@ -132,3 +132,5 @@ "use strict";

if (parentPort2) {
parentPort2.on("message", handleMessage);
parentPort2.on("message", (message) => {
handleMessage(message);
});
parentPort2.on("exit", () => console.debug("Node worker closing"));

@@ -135,0 +137,0 @@ } else {

{
"name": "@loaders.gl/worker-utils",
"version": "4.2.0-alpha.5",
"version": "4.2.0-alpha.6",
"description": "Utilities for running tasks on worker threads",

@@ -36,12 +36,12 @@ "license": "MIT",

"browser": {
"child_process": false,
"module": false,
"path": false,
"fs": false,
"./src/lib/node/worker_threads.ts": "./src/lib/node/worker_threads-browser.ts",
"./dist/esm/lib/process-utils/child-process-proxy.js": false,
"./dist/lib/node/require-utils.node.js": false,
"./dist/lib/node/worker_threads.js": "./dist/lib/node/worker_threads-browser.js",
"./src/lib/node/require-utils.node.ts": false,
"./dist/lib/node/require-utils.node.js": false,
"./src/lib/node/worker_threads.ts": "./src/lib/node/worker_threads-browser.ts",
"./src/lib/process-utils/child-process-proxy.ts": false,
"./dist/esm/lib/process-utils/child-process-proxy.js": false
"child_process": false,
"fs": false,
"module": false,
"path": false
},

@@ -56,3 +56,3 @@ "scripts": {

},
"gitHead": "32d95a81971f104e4dfeb88ab57065f05321a76a"
"gitHead": "37bd8ca71763529f18727ee4bf29dd176aa914ca"
}

@@ -25,3 +25,3 @@ // loaders.gl

/** Options passed on to Node'.js `spawn` */
spawn?: ChildProcess.SpawnOptionsWithoutStdio;
spawn?: any; // ChildProcess.SpawnOptionsWithoutStdio;
/** Should proceed if stderr stream recieved data */

@@ -28,0 +28,0 @@ ignoreStderr?: boolean;

@@ -7,4 +7,7 @@ // loaders.gl

import {getTransferList} from '../worker-utils/get-transfer-list';
import {TransferListItem, parentPort} from '../node/worker_threads';
// import type {TransferListItem} from '../node/worker_threads';
import {parentPort} from '../node/worker_threads';
type TransferListItem = any;
/** Vile hack to defeat over-zealous bundlers from stripping out the require */

@@ -58,3 +61,5 @@ async function getParentPort() {

if (parentPort) {
parentPort.on('message', handleMessage);
parentPort.on('message', (message) => {
handleMessage(message);
});
// if (message == 'exit') { parentPort.unref(); }

@@ -61,0 +66,0 @@ // eslint-disable-next-line

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

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