@loaders.gl/worker-utils
Advanced tools
Comparing version 3.0.0-alpha.19 to 3.0.0-alpha.20
@@ -160,3 +160,3 @@ "use strict"; | ||
var VERSION = typeof "3.0.0-alpha.19" !== 'undefined' ? "3.0.0-alpha.19" : 'latest'; | ||
var VERSION = typeof "3.0.0-alpha.20" !== 'undefined' ? "3.0.0-alpha.20" : 'latest'; | ||
var NullWorker = { | ||
@@ -163,0 +163,0 @@ id: 'null', |
@@ -28,3 +28,3 @@ "use strict"; | ||
var LATEST = 'beta'; | ||
var VERSION = typeof "3.0.0-alpha.19" !== 'undefined' ? "3.0.0-alpha.19" : LATEST; | ||
var VERSION = typeof "3.0.0-alpha.20" !== 'undefined' ? "3.0.0-alpha.20" : LATEST; | ||
var loadLibraryPromises = {}; | ||
@@ -31,0 +31,0 @@ |
@@ -18,3 +18,3 @@ "use strict"; | ||
var NPM_TAG = 'beta'; | ||
var VERSION = typeof "3.0.0-alpha.19" !== 'undefined' ? "3.0.0-alpha.19" : NPM_TAG; | ||
var VERSION = typeof "3.0.0-alpha.20" !== 'undefined' ? "3.0.0-alpha.20" : NPM_TAG; | ||
@@ -21,0 +21,0 @@ function getWorkerObjectURL(worker, options) { |
@@ -16,3 +16,3 @@ export { WorkerObject } from './types'; | ||
export { default as ChildProcessProxy } from './lib/process-utils/child-process-proxy'; | ||
var VERSION = typeof "3.0.0-alpha.19" !== 'undefined' ? "3.0.0-alpha.19" : 'latest'; | ||
var VERSION = typeof "3.0.0-alpha.20" !== 'undefined' ? "3.0.0-alpha.20" : 'latest'; | ||
export var NullWorker = { | ||
@@ -19,0 +19,0 @@ id: 'null', |
@@ -7,3 +7,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
var LATEST = 'beta'; | ||
var VERSION = typeof "3.0.0-alpha.19" !== 'undefined' ? "3.0.0-alpha.19" : LATEST; | ||
var VERSION = typeof "3.0.0-alpha.20" !== 'undefined' ? "3.0.0-alpha.20" : LATEST; | ||
var loadLibraryPromises = {}; | ||
@@ -10,0 +10,0 @@ export function loadLibrary(_x) { |
import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
import { assert } from '../env-utils/assert'; | ||
var NPM_TAG = 'beta'; | ||
var VERSION = typeof "3.0.0-alpha.19" !== 'undefined' ? "3.0.0-alpha.19" : NPM_TAG; | ||
var VERSION = typeof "3.0.0-alpha.20" !== 'undefined' ? "3.0.0-alpha.20" : NPM_TAG; | ||
export function getWorkerObjectURL(worker, options) { | ||
@@ -6,0 +6,0 @@ var topOptions = options || {}; |
@@ -468,2 +468,3 @@ /******/ (function(modules) { // webpackBootstrap | ||
/******/ }); | ||
/******/ }); | ||
//# sourceMappingURL=null-worker.js.map |
{ | ||
"name": "@loaders.gl/worker-utils", | ||
"version": "3.0.0-alpha.19", | ||
"version": "3.0.0-alpha.20", | ||
"description": "Utilities for running tasks on worker threads", | ||
@@ -44,3 +44,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "4e0a11c8f59a3c3b96eab8e5b81469f72d682e96" | ||
"gitHead": "a21d85019d34c9045feae797e22ee7ce7f34d648" | ||
} |
@@ -56,6 +56,3 @@ // Fork of https://github.com/floatdrop/require-from-string/blob/master/index.js | ||
newModule.filename = filename; | ||
newModule.paths = [] | ||
.concat(options.prependPaths) | ||
.concat(paths) | ||
.concat(options.appendPaths); | ||
newModule.paths = [].concat(options.prependPaths).concat(paths).concat(options.appendPaths); | ||
// @ts-ignore | ||
@@ -62,0 +59,0 @@ newModule._compile(code, filename); |
@@ -16,3 +16,3 @@ // Forked from probe.gl under MIT license, Copyright (c) 2015 - 2017 Uber Technologies, Inc. | ||
nodeSpawnOptions: {maxBuffer: 5000 * 1024}, | ||
onSuccess: processProxy => { | ||
onSuccess: (processProxy) => { | ||
console.log(`Started ${processProxy.options.command}`); | ||
@@ -59,7 +59,7 @@ } | ||
this.childProcess.stdout.on('data', data => { | ||
this.childProcess.stdout.on('data', (data) => { | ||
console.log(data.toString()); | ||
}); | ||
// TODO - add option regarding whether stderr should be treated as data | ||
this.childProcess.stderr.on('data', data => { | ||
this.childProcess.stderr.on('data', (data) => { | ||
console.log(`Child process wrote to stderr: "${data}".`); | ||
@@ -69,3 +69,3 @@ this._clearTimeout(); | ||
}); | ||
this.childProcess.on('error', error => { | ||
this.childProcess.on('error', (error) => { | ||
console.log(`Child process errored with ${error}`); | ||
@@ -75,3 +75,3 @@ this._clearTimeout(); | ||
}); | ||
this.childProcess.on('close', code => { | ||
this.childProcess.on('close', (code) => { | ||
console.log(`Child process exited with ${code}`); | ||
@@ -78,0 +78,0 @@ this.childProcess = null; |
@@ -17,3 +17,3 @@ import ChildProcess from 'child_process'; | ||
const regex = /:(\d+) \(LISTEN\)/; | ||
stdout.split('\n').forEach(line => { | ||
stdout.split('\n').forEach((line) => { | ||
const match = line.match(regex); | ||
@@ -20,0 +20,0 @@ if (match) { |
@@ -17,3 +17,3 @@ /* eslint-disable no-restricted-globals */ | ||
static set onmessage(onMessage) { | ||
self.onmessage = message => { | ||
self.onmessage = (message) => { | ||
if (!isKnownMessage(message)) { | ||
@@ -33,3 +33,3 @@ return; | ||
if (!onMessageWrapper) { | ||
onMessageWrapper = message => { | ||
onMessageWrapper = (message) => { | ||
if (!isKnownMessage(message)) { | ||
@@ -36,0 +36,0 @@ return; |
@@ -35,3 +35,3 @@ /** @typedef {import('./worker-farm').WorkerFarmProps} WorkerFarmProps */ | ||
destroy() { | ||
this.workerPools.forEach(workerPool => workerPool.destroy()); | ||
this.workerPools.forEach((workerPool) => workerPool.destroy()); | ||
} | ||
@@ -38,0 +38,0 @@ |
@@ -45,3 +45,3 @@ /** @typedef {import('../worker-protocol/protocol').WorkerMessageType} WorkerMessageType */ | ||
// Destroy idle workers, active Workers will be destroyed on completion | ||
this.idleQueue.forEach(worker => worker.destroy()); | ||
this.idleQueue.forEach((worker) => worker.destroy()); | ||
this.isDestroyed = true; | ||
@@ -56,3 +56,3 @@ } | ||
// Promise resolves when thread starts working on this job | ||
const startPromise = new Promise(onStart => { | ||
const startPromise = new Promise((onStart) => { | ||
// Promise resolves when thread completes or fails working on this job | ||
@@ -96,4 +96,4 @@ this.jobQueue.push({name, onMessage, onError, onStart}); | ||
// Set the worker thread's message handlers | ||
workerThread.onMessage = data => queuedJob.onMessage(job, data.type, data.payload); | ||
workerThread.onError = error => queuedJob.onError(job, error); | ||
workerThread.onMessage = (data) => queuedJob.onMessage(job, data.type, data.payload); | ||
workerThread.onError = (error) => queuedJob.onError(job, error); | ||
@@ -100,0 +100,0 @@ // Resolve the start promise so that the app can start sending messages to worker |
@@ -6,3 +6,3 @@ /** @typedef {import('./worker-thread').WorkerThreadProps} WorkerThreadProps */ | ||
const NOOP = _ => {}; | ||
const NOOP = (_) => {}; | ||
export default class WorkerThread { | ||
@@ -23,3 +23,3 @@ static isSupported() { | ||
this.onMessage = NOOP; | ||
this.onError = error => console.log(error); // eslint-disable-line | ||
this.onError = (error) => console.log(error); // eslint-disable-line | ||
this.terminated = false; | ||
@@ -78,3 +78,3 @@ | ||
worker.onmessage = event => { | ||
worker.onmessage = (event) => { | ||
if (!event.data) { | ||
@@ -87,3 +87,3 @@ this.onError('No data received'); | ||
// This callback represents an uncaught exception in the worker thread | ||
worker.onerror = error => { | ||
worker.onerror = (error) => { | ||
this.onError(this._getErrorFromErrorEvent(error)); | ||
@@ -93,3 +93,3 @@ this.terminated = true; | ||
// TODO - not clear when this would be called, for now just log in case it happens | ||
worker.onmessageerror = event => console.error(event); // eslint-disable-line | ||
worker.onmessageerror = (event) => console.error(event); // eslint-disable-line | ||
@@ -96,0 +96,0 @@ return worker; |
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
375418
156
5538
205
5
9
0
48