@loaders.gl/worker-utils
Advanced tools
Comparing version 3.0.7 to 3.0.8
@@ -8,8 +8,8 @@ "use strict"; | ||
var DEFAULT_VERSION = 'beta'; | ||
var VERSION = typeof "3.0.7" !== 'undefined' ? "3.0.7" : DEFAULT_VERSION; | ||
var VERSION = typeof "3.0.8" !== 'undefined' ? "3.0.8" : DEFAULT_VERSION; | ||
exports.VERSION = VERSION; | ||
if (typeof "3.0.7" === 'undefined') { | ||
if (typeof "3.0.8" === 'undefined') { | ||
console.error('loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.'); | ||
} | ||
//# sourceMappingURL=version.js.map |
@@ -30,3 +30,3 @@ "use strict"; | ||
var LATEST = 'beta'; | ||
var VERSION = typeof "3.0.7" !== 'undefined' ? "3.0.7" : LATEST; | ||
var VERSION = typeof "3.0.8" !== 'undefined' ? "3.0.8" : LATEST; | ||
var loadLibraryPromises = {}; | ||
@@ -33,0 +33,0 @@ |
@@ -5,2 +5,4 @@ "use strict"; | ||
var _typeof = require("@babel/runtime/helpers/typeof"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -23,6 +25,10 @@ value: true | ||
var _child_process = require("child_process"); | ||
var ChildProcess = _interopRequireWildcard(require("child_process")); | ||
var _processUtils = require("./process-utils"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
@@ -106,3 +112,3 @@ | ||
console.log("Spawning ".concat(props.command, " ").concat(props.arguments.join(' '))); | ||
var childProcess = (0, _child_process.spawn)(props.command, args, props.spawn); | ||
var childProcess = ChildProcess.spawn(props.command, args, props.spawn); | ||
_this.childProcess = childProcess; | ||
@@ -109,0 +115,0 @@ childProcess.stdout.on('data', function (data) { |
@@ -14,3 +14,3 @@ "use strict"; | ||
var NPM_TAG = 'latest'; | ||
var VERSION = typeof "3.0.7" !== 'undefined' ? "3.0.7" : NPM_TAG; | ||
var VERSION = typeof "3.0.8" !== 'undefined' ? "3.0.8" : NPM_TAG; | ||
@@ -17,0 +17,0 @@ function getWorkerName(worker) { |
const DEFAULT_VERSION = 'beta'; | ||
export const VERSION = typeof "3.0.7" !== 'undefined' ? "3.0.7" : DEFAULT_VERSION; | ||
export const VERSION = typeof "3.0.8" !== 'undefined' ? "3.0.8" : DEFAULT_VERSION; | ||
if (typeof "3.0.7" === 'undefined') { | ||
if (typeof "3.0.8" === 'undefined') { | ||
console.error('loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.'); | ||
} | ||
//# sourceMappingURL=version.js.map |
@@ -6,3 +6,3 @@ import { global, isBrowser, isWorker } from '../env-utils/globals'; | ||
const LATEST = 'beta'; | ||
const VERSION = typeof "3.0.7" !== 'undefined' ? "3.0.7" : LATEST; | ||
const VERSION = typeof "3.0.8" !== 'undefined' ? "3.0.8" : LATEST; | ||
const loadLibraryPromises = {}; | ||
@@ -29,3 +29,3 @@ export async function loadLibrary(libraryUrl, moduleName = null, options = {}) { | ||
if (!isBrowser) { | ||
return "modules/".concat(moduleName, "/dist/libs/").concat(library); | ||
return `modules/${moduleName}/dist/libs/${library}`; | ||
} | ||
@@ -35,10 +35,10 @@ | ||
assert(options.CDN.startsWith('http')); | ||
return "".concat(options.CDN, "/").concat(moduleName, "@").concat(VERSION, "/dist/libs/").concat(library); | ||
return `${options.CDN}/${moduleName}@${VERSION}/dist/libs/${library}`; | ||
} | ||
if (isWorker) { | ||
return "../src/libs/".concat(library); | ||
return `../src/libs/${library}`; | ||
} | ||
return "modules/".concat(moduleName, "/src/libs/").concat(library); | ||
return `modules/${moduleName}/src/libs/${library}`; | ||
} | ||
@@ -45,0 +45,0 @@ |
@@ -11,3 +11,3 @@ import Module from 'module'; | ||
if (!filename.startsWith('/')) { | ||
filename = "".concat(process.cwd(), "/").concat(filename); | ||
filename = `${process.cwd()}/${filename}`; | ||
} | ||
@@ -30,3 +30,3 @@ | ||
if (typeof code !== 'string') { | ||
throw new Error("code must be a string, not ".concat(typeof code)); | ||
throw new Error(`code must be a string, not ${typeof code}`); | ||
} | ||
@@ -33,0 +33,0 @@ |
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import { spawn } from 'child_process'; | ||
import * as ChildProcess from 'child_process'; | ||
import { getAvailablePort } from './process-utils'; | ||
@@ -11,3 +11,3 @@ const DEFAULT_PROPS = { | ||
onSuccess: processProxy => { | ||
console.log("Started ".concat(processProxy.props.command)); | ||
console.log(`Started ${processProxy.props.command}`); | ||
} | ||
@@ -59,4 +59,4 @@ }; | ||
console.log("Spawning ".concat(props.command, " ").concat(props.arguments.join(' '))); | ||
const childProcess = spawn(props.command, args, props.spawn); | ||
console.log(`Spawning ${props.command} ${props.arguments.join(' ')}`); | ||
const childProcess = ChildProcess.spawn(props.command, args, props.spawn); | ||
this.childProcess = childProcess; | ||
@@ -67,3 +67,3 @@ childProcess.stdout.on('data', data => { | ||
childProcess.stderr.on('data', data => { | ||
console.log("Child process wrote to stderr: \"".concat(data, "\".")); | ||
console.log(`Child process wrote to stderr: "${data}".`); | ||
@@ -75,3 +75,3 @@ this._clearTimeout(); | ||
childProcess.on('error', error => { | ||
console.log("Child process errored with ".concat(error)); | ||
console.log(`Child process errored with ${error}`); | ||
@@ -83,3 +83,3 @@ this._clearTimeout(); | ||
childProcess.on('close', code => { | ||
console.log("Child process exited with ".concat(code)); | ||
console.log(`Child process exited with ${code}`); | ||
this.childProcess = null; | ||
@@ -86,0 +86,0 @@ |
import { assert } from '../env-utils/assert'; | ||
import { VERSION as __VERSION__ } from '../env-utils/version'; | ||
const NPM_TAG = 'latest'; | ||
const VERSION = typeof "3.0.7" !== 'undefined' ? "3.0.7" : NPM_TAG; | ||
const VERSION = typeof "3.0.8" !== 'undefined' ? "3.0.8" : NPM_TAG; | ||
export function getWorkerName(worker) { | ||
const warning = worker.version !== VERSION ? " (worker-utils@".concat(VERSION, ")") : ''; | ||
return "".concat(worker.name, "@").concat(worker.version).concat(warning); | ||
const warning = worker.version !== VERSION ? ` (worker-utils@${VERSION})` : ''; | ||
return `${worker.name}@${worker.version}${warning}`; | ||
} | ||
export function getWorkerURL(worker, options = {}) { | ||
const workerOptions = options[worker.id] || {}; | ||
const workerFile = "".concat(worker.id, "-worker.js"); | ||
const workerFile = `${worker.id}-worker.js`; | ||
let url = workerOptions.workerUrl; | ||
if (options._workerType === 'test') { | ||
url = "modules/".concat(worker.module, "/dist/").concat(workerFile); | ||
url = `modules/${worker.module}/dist/${workerFile}`; | ||
} | ||
@@ -25,4 +25,4 @@ | ||
const versionTag = version ? "@".concat(version) : ''; | ||
url = "https://unpkg.com/@loaders.gl/".concat(worker.module).concat(versionTag, "/dist/").concat(workerFile); | ||
const versionTag = version ? `@${version}` : ''; | ||
url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`; | ||
} | ||
@@ -29,0 +29,0 @@ |
@@ -72,5 +72,5 @@ import WorkerFarm from '../worker-farm/worker-farm'; | ||
default: | ||
console.warn("process-on-worker: unknown message ".concat(type)); | ||
console.warn(`process-on-worker: unknown message ${type}`); | ||
} | ||
} | ||
//# sourceMappingURL=process-on-worker.js.map |
@@ -141,3 +141,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
this.count++; | ||
const name = "".concat(this.name.toLowerCase(), " (#").concat(this.count, " of ").concat(this.maxConcurrency, ")"); | ||
const name = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`; | ||
return new WorkerThread({ | ||
@@ -144,0 +144,0 @@ name, |
@@ -64,10 +64,10 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
let message = 'Failed to load '; | ||
message += "worker ".concat(this.name, ". "); | ||
message += `worker ${this.name}. `; | ||
if (event.message) { | ||
message += "".concat(event.message, " in "); | ||
message += `${event.message} in `; | ||
} | ||
if (event.lineno) { | ||
message += ":".concat(event.lineno, ":").concat(event.colno); | ||
message += `:${event.lineno}:${event.colno}`; | ||
} | ||
@@ -74,0 +74,0 @@ |
@@ -40,4 +40,10 @@ import { assert } from '../env-utils/assert'; | ||
function buildScriptSource(workerUrl) { | ||
return "try {\n importScripts('".concat(workerUrl, "');\n} catch (error) {\n console.error(error);\n throw error;\n}"); | ||
return `\ | ||
try { | ||
importScripts('${workerUrl}'); | ||
} catch (error) { | ||
console.error(error); | ||
throw error; | ||
}`; | ||
} | ||
//# sourceMappingURL=get-loadable-worker-url.js.map |
@@ -90,5 +90,5 @@ /******/ (function(modules) { // webpackBootstrap | ||
/***/ "../../node_modules/@babel/runtime/helpers/defineProperty.js": | ||
/*!**************************************************************************************************!*\ | ||
!*** /home/user/apps/loaders.gl_duplicate/node_modules/@babel/runtime/helpers/defineProperty.js ***! | ||
\**************************************************************************************************/ | ||
/*!****************************************************************************************!*\ | ||
!*** /home/user/apps/loaders.gl/node_modules/@babel/runtime/helpers/defineProperty.js ***! | ||
\****************************************************************************************/ | ||
/*! no static exports found */ | ||
@@ -95,0 +95,0 @@ /***/ (function(module, exports) { |
{ | ||
"name": "@loaders.gl/worker-utils", | ||
"version": "3.0.7", | ||
"version": "3.0.8", | ||
"description": "Utilities for running tasks on worker threads", | ||
@@ -32,3 +32,6 @@ "license": "MIT", | ||
"./dist/es5/lib/node/require-utils.node.js": false, | ||
"./dist/esm/lib/node/require-utils.node.js": false | ||
"./dist/esm/lib/node/require-utils.node.js": false, | ||
"./src/lib/process-utils/child-process-proxy.ts": false, | ||
"./dist/es5/lib/process-utils/child-process-proxy.js": false, | ||
"./dist/esm/lib/process-utils/child-process-proxy.js": false | ||
}, | ||
@@ -44,3 +47,3 @@ "scripts": { | ||
}, | ||
"gitHead": "8ac2b84d84114e3e79c5c1e42732d4edeb832f19" | ||
"gitHead": "8b6a769ffd9cb7f451691f32f174e4b7312d6806" | ||
} |
/* eslint-disable no-console */ | ||
import {spawn, ChildProcess, SpawnOptionsWithoutStdio} from 'child_process'; | ||
// Avoid using named imports for Node builtins to help with "empty" resolution | ||
// for bundlers targeting browser environments. Access imports & types | ||
// through the `ChildProcess` object (e.g. `ChildProcess.spawn`, `ChildProcess.ChildProcess`). | ||
import * as ChildProcess from 'child_process'; | ||
import {getAvailablePort} from './process-utils'; | ||
@@ -18,3 +21,3 @@ | ||
/** Options passed on to Node'.js `spawn` */ | ||
spawn?: SpawnOptionsWithoutStdio; | ||
spawn?: ChildProcess.SpawnOptionsWithoutStdio; | ||
/** Callback when the */ | ||
@@ -43,3 +46,3 @@ onStart?: (proxy: ChildProcessProxy) => void; | ||
props: ChildProcessProxyProps = {...DEFAULT_PROPS}; | ||
private childProcess: ChildProcess | null = null; | ||
private childProcess: ChildProcess.ChildProcess | null = null; | ||
private port: number = 0; | ||
@@ -79,3 +82,3 @@ private successTimer?; | ||
console.log(`Spawning ${props.command} ${props.arguments.join(' ')}`); | ||
const childProcess = spawn(props.command, args, props.spawn); | ||
const childProcess = ChildProcess.spawn(props.command, args, props.spawn); | ||
this.childProcess = childProcess; | ||
@@ -82,0 +85,0 @@ |
@@ -34,2 +34,4 @@ import type {WorkerObject} from '../../types'; | ||
} | ||
// @ts-ignore | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
@@ -36,0 +38,0 @@ function parseVersion(version) { |
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
378940
1
4792