@loaders.gl/core 4.3.0-alpha.7 → 4.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +117 -258
- package/dist/dist.min.js +3 -3
- package/dist/index.cjs +40 -42
- package/dist/index.cjs.map +3 -3
- package/dist/iterators/make-iterator/make-iterator.d.ts +0 -1
- package/dist/iterators/make-iterator/make-iterator.d.ts.map +1 -1
- package/dist/iterators/make-iterator/make-stream-iterator.d.ts +0 -1
- package/dist/iterators/make-iterator/make-stream-iterator.d.ts.map +1 -1
- package/dist/javascript-utils/is-type.d.ts +0 -1
- package/dist/javascript-utils/is-type.d.ts.map +1 -1
- package/dist/lib/api/encode.d.ts +6 -6
- package/dist/lib/api/encode.d.ts.map +1 -1
- package/dist/lib/api/encode.js +3 -4
- package/dist/lib/api/load-in-batches.d.ts +1 -2
- package/dist/lib/api/load-in-batches.d.ts.map +1 -1
- package/dist/lib/api/load.d.ts +6 -4
- package/dist/lib/api/load.d.ts.map +1 -1
- package/dist/lib/api/load.js +1 -0
- package/dist/lib/api/parse-in-batches.d.ts +3 -4
- package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
- package/dist/lib/api/parse-sync.d.ts +3 -4
- package/dist/lib/api/parse-sync.d.ts.map +1 -1
- package/dist/lib/api/parse.d.ts +3 -4
- package/dist/lib/api/parse.d.ts.map +1 -1
- package/dist/lib/api/parse.js +1 -2
- package/dist/lib/api/register-loaders.d.ts +8 -1
- package/dist/lib/api/register-loaders.d.ts.map +1 -1
- package/dist/lib/api/register-loaders.js +8 -1
- package/dist/lib/init.js +1 -1
- package/dist/null-loader.d.ts +1 -1
- package/dist/null-loader.d.ts.map +1 -1
- package/dist/null-loader.js +1 -1
- package/dist/null-worker-node.js +1 -1
- package/dist/null-worker.js +1 -1
- package/package.json +5 -5
- package/src/lib/api/encode.ts +29 -24
- package/src/lib/api/load-in-batches.ts +3 -2
- package/src/lib/api/load.ts +24 -9
- package/src/lib/api/parse-in-batches.ts +19 -7
- package/src/lib/api/parse-sync.ts +19 -7
- package/src/lib/api/parse.ts +20 -9
- package/src/lib/api/register-loaders.ts +8 -1
package/dist/dist.dev.js
CHANGED
|
@@ -117,85 +117,37 @@ var __exports__ = (() => {
|
|
|
117
117
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
118
118
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
119
119
|
|
|
120
|
-
// ../../node_modules/@
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
127
|
-
}, _typeof(obj);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
131
|
-
function _toPrimitive(input, hint) {
|
|
132
|
-
if (_typeof(input) !== "object" || input === null)
|
|
133
|
-
return input;
|
|
134
|
-
var prim = input[Symbol.toPrimitive];
|
|
135
|
-
if (prim !== void 0) {
|
|
136
|
-
var res = prim.call(input, hint || "default");
|
|
137
|
-
if (_typeof(res) !== "object")
|
|
138
|
-
return res;
|
|
139
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
140
|
-
}
|
|
141
|
-
return (hint === "string" ? String : Number)(input);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
145
|
-
function _toPropertyKey(arg) {
|
|
146
|
-
var key = _toPrimitive(arg, "string");
|
|
147
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
151
|
-
function _defineProperty(obj, key, value) {
|
|
152
|
-
key = _toPropertyKey(key);
|
|
153
|
-
if (key in obj) {
|
|
154
|
-
Object.defineProperty(obj, key, {
|
|
155
|
-
value,
|
|
156
|
-
enumerable: true,
|
|
157
|
-
configurable: true,
|
|
158
|
-
writable: true
|
|
159
|
-
});
|
|
160
|
-
} else {
|
|
161
|
-
obj[key] = value;
|
|
162
|
-
}
|
|
163
|
-
return obj;
|
|
164
|
-
}
|
|
120
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
|
|
121
|
+
var window_2 = globalThis;
|
|
122
|
+
var document_2 = globalThis.document || {};
|
|
123
|
+
var process_ = globalThis.process || {};
|
|
124
|
+
var console_ = globalThis.console;
|
|
125
|
+
var navigator_ = globalThis.navigator || {};
|
|
165
126
|
|
|
166
127
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
167
128
|
function isElectron(mockUserAgent) {
|
|
168
|
-
if (typeof window !== "undefined" &&
|
|
129
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
169
130
|
return true;
|
|
170
131
|
}
|
|
171
|
-
if (typeof process !== "undefined" &&
|
|
132
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
172
133
|
return true;
|
|
173
134
|
}
|
|
174
|
-
const realUserAgent = typeof navigator
|
|
135
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
175
136
|
const userAgent = mockUserAgent || realUserAgent;
|
|
176
|
-
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
return false;
|
|
137
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
180
138
|
}
|
|
181
139
|
|
|
182
140
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
183
141
|
function isBrowser2() {
|
|
184
|
-
const isNode =
|
|
142
|
+
const isNode = (
|
|
143
|
+
// @ts-expect-error
|
|
144
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
145
|
+
);
|
|
185
146
|
return !isNode || isElectron();
|
|
186
147
|
}
|
|
187
148
|
|
|
188
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/
|
|
189
|
-
var
|
|
190
|
-
var window_2 = globalThis.window || globalThis.self || globalThis.global;
|
|
191
|
-
var document_2 = globalThis.document || {};
|
|
192
|
-
var process_ = globalThis.process || {};
|
|
193
|
-
var console_ = globalThis.console;
|
|
194
|
-
var navigator_ = globalThis.navigator || {};
|
|
195
|
-
|
|
196
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
197
|
-
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
|
|
198
|
-
var isBrowser3 = isBrowser2();
|
|
149
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js
|
|
150
|
+
var VERSION = true ? "4.0.7" : "untranspiled source";
|
|
199
151
|
|
|
200
152
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
201
153
|
function getStorage(type) {
|
|
@@ -210,11 +162,7 @@ var __exports__ = (() => {
|
|
|
210
162
|
}
|
|
211
163
|
}
|
|
212
164
|
var LocalStorage = class {
|
|
213
|
-
constructor(id, defaultConfig) {
|
|
214
|
-
let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
|
|
215
|
-
_defineProperty(this, "storage", void 0);
|
|
216
|
-
_defineProperty(this, "id", void 0);
|
|
217
|
-
_defineProperty(this, "config", void 0);
|
|
165
|
+
constructor(id, defaultConfig, type = "sessionStorage") {
|
|
218
166
|
this.storage = getStorage(type);
|
|
219
167
|
this.id = id;
|
|
220
168
|
this.config = defaultConfig;
|
|
@@ -230,6 +178,7 @@ var __exports__ = (() => {
|
|
|
230
178
|
this.storage.setItem(this.id, serialized);
|
|
231
179
|
}
|
|
232
180
|
}
|
|
181
|
+
// Get config from persistent store, if available
|
|
233
182
|
_loadConfiguration() {
|
|
234
183
|
let configuration = {};
|
|
235
184
|
if (this.storage) {
|
|
@@ -245,31 +194,19 @@ var __exports__ = (() => {
|
|
|
245
194
|
function formatTime(ms) {
|
|
246
195
|
let formatted;
|
|
247
196
|
if (ms < 10) {
|
|
248
|
-
formatted =
|
|
197
|
+
formatted = `${ms.toFixed(2)}ms`;
|
|
249
198
|
} else if (ms < 100) {
|
|
250
|
-
formatted =
|
|
199
|
+
formatted = `${ms.toFixed(1)}ms`;
|
|
251
200
|
} else if (ms < 1e3) {
|
|
252
|
-
formatted =
|
|
201
|
+
formatted = `${ms.toFixed(0)}ms`;
|
|
253
202
|
} else {
|
|
254
|
-
formatted =
|
|
203
|
+
formatted = `${(ms / 1e3).toFixed(2)}s`;
|
|
255
204
|
}
|
|
256
205
|
return formatted;
|
|
257
206
|
}
|
|
258
|
-
function leftPad(string) {
|
|
259
|
-
let length = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
|
|
207
|
+
function leftPad(string, length = 8) {
|
|
260
208
|
const padLength = Math.max(length - string.length, 0);
|
|
261
|
-
return "
|
|
262
|
-
}
|
|
263
|
-
function formatImage(image, message, scale) {
|
|
264
|
-
let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
|
|
265
|
-
const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
|
|
266
|
-
if (image.width > maxWidth) {
|
|
267
|
-
scale = Math.min(scale, maxWidth / image.width);
|
|
268
|
-
}
|
|
269
|
-
const width = image.width * scale;
|
|
270
|
-
const height = image.height * scale;
|
|
271
|
-
const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
|
|
272
|
-
return ["".concat(message, " %c+"), style];
|
|
209
|
+
return `${" ".repeat(padLength)}${string}`;
|
|
273
210
|
}
|
|
274
211
|
|
|
275
212
|
// ../../node_modules/@probe.gl/log/dist/utils/color.js
|
|
@@ -304,19 +241,18 @@ var __exports__ = (() => {
|
|
|
304
241
|
if (!isBrowser2 && typeof string === "string") {
|
|
305
242
|
if (color) {
|
|
306
243
|
const colorCode = getColor(color);
|
|
307
|
-
string =
|
|
244
|
+
string = `\x1B[${colorCode}m${string}\x1B[39m`;
|
|
308
245
|
}
|
|
309
246
|
if (background) {
|
|
310
247
|
const colorCode = getColor(background);
|
|
311
|
-
string =
|
|
248
|
+
string = `\x1B[${colorCode + BACKGROUND_INCREMENT}m${string}\x1B[49m`;
|
|
312
249
|
}
|
|
313
250
|
}
|
|
314
251
|
return string;
|
|
315
252
|
}
|
|
316
253
|
|
|
317
254
|
// ../../node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
318
|
-
function autobind(obj) {
|
|
319
|
-
let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
|
|
255
|
+
function autobind(obj, predefined = ["constructor"]) {
|
|
320
256
|
const proto = Object.getPrototypeOf(obj);
|
|
321
257
|
const propNames = Object.getOwnPropertyNames(proto);
|
|
322
258
|
const object = obj;
|
|
@@ -341,11 +277,9 @@ var __exports__ = (() => {
|
|
|
341
277
|
function getHiResTimestamp() {
|
|
342
278
|
let timestamp;
|
|
343
279
|
if (isBrowser2() && window_2.performance) {
|
|
344
|
-
|
|
345
|
-
timestamp = window_2 === null || window_2 === void 0 ? void 0 : (_window$performance = window_2.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
|
|
280
|
+
timestamp = window_2?.performance?.now?.();
|
|
346
281
|
} else if ("hrtime" in process_) {
|
|
347
|
-
|
|
348
|
-
const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
|
|
282
|
+
const timeParts = process_?.hrtime?.();
|
|
349
283
|
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
350
284
|
} else {
|
|
351
285
|
timestamp = Date.now();
|
|
@@ -368,27 +302,18 @@ var __exports__ = (() => {
|
|
|
368
302
|
function noop() {
|
|
369
303
|
}
|
|
370
304
|
var cache = {};
|
|
371
|
-
var ONCE = {
|
|
372
|
-
once: true
|
|
373
|
-
};
|
|
305
|
+
var ONCE = { once: true };
|
|
374
306
|
var Log = class {
|
|
375
|
-
constructor() {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
_defineProperty(this, "id", void 0);
|
|
382
|
-
_defineProperty(this, "VERSION", VERSION);
|
|
383
|
-
_defineProperty(this, "_startTs", getHiResTimestamp());
|
|
384
|
-
_defineProperty(this, "_deltaTs", getHiResTimestamp());
|
|
385
|
-
_defineProperty(this, "_storage", void 0);
|
|
386
|
-
_defineProperty(this, "userData", {});
|
|
387
|
-
_defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
307
|
+
constructor({ id } = { id: "" }) {
|
|
308
|
+
this.VERSION = VERSION;
|
|
309
|
+
this._startTs = getHiResTimestamp();
|
|
310
|
+
this._deltaTs = getHiResTimestamp();
|
|
311
|
+
this.userData = {};
|
|
312
|
+
this.LOG_THROTTLE_TIMEOUT = 0;
|
|
388
313
|
this.id = id;
|
|
389
314
|
this.userData = {};
|
|
390
|
-
this._storage = new LocalStorage(
|
|
391
|
-
this.timeStamp(
|
|
315
|
+
this._storage = new LocalStorage(`__probe-${this.id}__`, DEFAULT_LOG_CONFIGURATION);
|
|
316
|
+
this.timeStamp(`${this.id} started`);
|
|
392
317
|
autobind(this);
|
|
393
318
|
Object.seal(this);
|
|
394
319
|
}
|
|
@@ -404,42 +329,44 @@ var __exports__ = (() => {
|
|
|
404
329
|
getLevel() {
|
|
405
330
|
return this._storage.config.level;
|
|
406
331
|
}
|
|
332
|
+
/** @return milliseconds, with fractions */
|
|
407
333
|
getTotal() {
|
|
408
334
|
return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
|
|
409
335
|
}
|
|
336
|
+
/** @return milliseconds, with fractions */
|
|
410
337
|
getDelta() {
|
|
411
338
|
return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
|
|
412
339
|
}
|
|
340
|
+
/** @deprecated use logLevel */
|
|
413
341
|
set priority(newPriority) {
|
|
414
342
|
this.level = newPriority;
|
|
415
343
|
}
|
|
344
|
+
/** @deprecated use logLevel */
|
|
416
345
|
get priority() {
|
|
417
346
|
return this.level;
|
|
418
347
|
}
|
|
348
|
+
/** @deprecated use logLevel */
|
|
419
349
|
getPriority() {
|
|
420
350
|
return this.level;
|
|
421
351
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
this._storage.setConfiguration({
|
|
425
|
-
enabled
|
|
426
|
-
});
|
|
352
|
+
// Configure
|
|
353
|
+
enable(enabled = true) {
|
|
354
|
+
this._storage.setConfiguration({ enabled });
|
|
427
355
|
return this;
|
|
428
356
|
}
|
|
429
357
|
setLevel(level) {
|
|
430
|
-
this._storage.setConfiguration({
|
|
431
|
-
level
|
|
432
|
-
});
|
|
358
|
+
this._storage.setConfiguration({ level });
|
|
433
359
|
return this;
|
|
434
360
|
}
|
|
361
|
+
/** return the current status of the setting */
|
|
435
362
|
get(setting) {
|
|
436
363
|
return this._storage.config[setting];
|
|
437
364
|
}
|
|
365
|
+
// update the status of the setting
|
|
438
366
|
set(setting, value) {
|
|
439
|
-
this._storage.setConfiguration({
|
|
440
|
-
[setting]: value
|
|
441
|
-
});
|
|
367
|
+
this._storage.setConfiguration({ [setting]: value });
|
|
442
368
|
}
|
|
369
|
+
/** Logs the current settings as a table */
|
|
443
370
|
settings() {
|
|
444
371
|
if (console.table) {
|
|
445
372
|
console.table(this._storage.config);
|
|
@@ -447,8 +374,11 @@ var __exports__ = (() => {
|
|
|
447
374
|
console.log(this._storage.config);
|
|
448
375
|
}
|
|
449
376
|
}
|
|
377
|
+
// Unconditional logging
|
|
450
378
|
assert(condition, message) {
|
|
451
|
-
|
|
379
|
+
if (!condition) {
|
|
380
|
+
throw new Error(message || "Assertion failed");
|
|
381
|
+
}
|
|
452
382
|
}
|
|
453
383
|
warn(message) {
|
|
454
384
|
return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
|
|
@@ -456,11 +386,13 @@ var __exports__ = (() => {
|
|
|
456
386
|
error(message) {
|
|
457
387
|
return this._getLogFunction(0, message, originalConsole.error, arguments);
|
|
458
388
|
}
|
|
389
|
+
/** Print a deprecation warning */
|
|
459
390
|
deprecated(oldUsage, newUsage) {
|
|
460
|
-
return this.warn(
|
|
391
|
+
return this.warn(`\`${oldUsage}\` is deprecated and will be removed in a later version. Use \`${newUsage}\` instead`);
|
|
461
392
|
}
|
|
393
|
+
/** Print a removal warning */
|
|
462
394
|
removed(oldUsage, newUsage) {
|
|
463
|
-
return this.error(
|
|
395
|
+
return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
|
|
464
396
|
}
|
|
465
397
|
probe(logLevel, message) {
|
|
466
398
|
return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
|
|
@@ -477,6 +409,7 @@ var __exports__ = (() => {
|
|
|
477
409
|
once(logLevel, message) {
|
|
478
410
|
return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
|
|
479
411
|
}
|
|
412
|
+
/** Logs an object as a table */
|
|
480
413
|
table(logLevel, table, columns) {
|
|
481
414
|
if (table) {
|
|
482
415
|
return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
|
|
@@ -485,27 +418,6 @@ var __exports__ = (() => {
|
|
|
485
418
|
}
|
|
486
419
|
return noop;
|
|
487
420
|
}
|
|
488
|
-
image(_ref) {
|
|
489
|
-
let {
|
|
490
|
-
logLevel,
|
|
491
|
-
priority,
|
|
492
|
-
image,
|
|
493
|
-
message = "",
|
|
494
|
-
scale = 1
|
|
495
|
-
} = _ref;
|
|
496
|
-
if (!this._shouldLog(logLevel || priority)) {
|
|
497
|
-
return noop;
|
|
498
|
-
}
|
|
499
|
-
return isBrowser2() ? logImageInBrowser({
|
|
500
|
-
image,
|
|
501
|
-
message,
|
|
502
|
-
scale
|
|
503
|
-
}) : logImageInNode({
|
|
504
|
-
image,
|
|
505
|
-
message,
|
|
506
|
-
scale
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
421
|
time(logLevel, message) {
|
|
510
422
|
return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
|
|
511
423
|
}
|
|
@@ -515,30 +427,19 @@ var __exports__ = (() => {
|
|
|
515
427
|
timeStamp(logLevel, message) {
|
|
516
428
|
return this._getLogFunction(logLevel, message, console.timeStamp || noop);
|
|
517
429
|
}
|
|
518
|
-
group(logLevel, message) {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
};
|
|
522
|
-
const options = normalizeArguments({
|
|
523
|
-
logLevel,
|
|
524
|
-
message,
|
|
525
|
-
opts
|
|
526
|
-
});
|
|
527
|
-
const {
|
|
528
|
-
collapsed
|
|
529
|
-
} = opts;
|
|
430
|
+
group(logLevel, message, opts = { collapsed: false }) {
|
|
431
|
+
const options = normalizeArguments({ logLevel, message, opts });
|
|
432
|
+
const { collapsed } = opts;
|
|
530
433
|
options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
|
|
531
434
|
return this._getLogFunction(options);
|
|
532
435
|
}
|
|
533
|
-
groupCollapsed(logLevel, message) {
|
|
534
|
-
|
|
535
|
-
return this.group(logLevel, message, Object.assign({}, opts, {
|
|
536
|
-
collapsed: true
|
|
537
|
-
}));
|
|
436
|
+
groupCollapsed(logLevel, message, opts = {}) {
|
|
437
|
+
return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
|
|
538
438
|
}
|
|
539
439
|
groupEnd(logLevel) {
|
|
540
440
|
return this._getLogFunction(logLevel, "", console.groupEnd || noop);
|
|
541
441
|
}
|
|
442
|
+
// EXPERIMENTAL
|
|
542
443
|
withGroup(logLevel, message, func) {
|
|
543
444
|
this.group(logLevel, message)();
|
|
544
445
|
try {
|
|
@@ -552,17 +453,14 @@ var __exports__ = (() => {
|
|
|
552
453
|
console.trace();
|
|
553
454
|
}
|
|
554
455
|
}
|
|
456
|
+
// PRIVATE METHODS
|
|
457
|
+
/** Deduces log level from a variety of arguments */
|
|
555
458
|
_shouldLog(logLevel) {
|
|
556
459
|
return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
|
|
557
460
|
}
|
|
558
461
|
_getLogFunction(logLevel, message, method, args, opts) {
|
|
559
462
|
if (this._shouldLog(logLevel)) {
|
|
560
|
-
opts = normalizeArguments({
|
|
561
|
-
logLevel,
|
|
562
|
-
message,
|
|
563
|
-
args,
|
|
564
|
-
opts
|
|
565
|
-
});
|
|
463
|
+
opts = normalizeArguments({ logLevel, message, args, opts });
|
|
566
464
|
method = method || opts.method;
|
|
567
465
|
assert2(method);
|
|
568
466
|
opts.total = this.getTotal();
|
|
@@ -582,7 +480,7 @@ var __exports__ = (() => {
|
|
|
582
480
|
return noop;
|
|
583
481
|
}
|
|
584
482
|
};
|
|
585
|
-
|
|
483
|
+
Log.VERSION = VERSION;
|
|
586
484
|
function normalizeLogLevel(logLevel) {
|
|
587
485
|
if (!logLevel) {
|
|
588
486
|
return 0;
|
|
@@ -602,10 +500,7 @@ var __exports__ = (() => {
|
|
|
602
500
|
return resolvedLevel;
|
|
603
501
|
}
|
|
604
502
|
function normalizeArguments(opts) {
|
|
605
|
-
const {
|
|
606
|
-
logLevel,
|
|
607
|
-
message
|
|
608
|
-
} = opts;
|
|
503
|
+
const { logLevel, message } = opts;
|
|
609
504
|
opts.logLevel = normalizeLogLevel(logLevel);
|
|
610
505
|
const args = opts.args ? Array.from(opts.args) : [];
|
|
611
506
|
while (args.length && args.shift() !== message) {
|
|
@@ -628,55 +523,16 @@ var __exports__ = (() => {
|
|
|
628
523
|
}
|
|
629
524
|
const messageType = typeof opts.message;
|
|
630
525
|
assert2(messageType === "string" || messageType === "object");
|
|
631
|
-
return Object.assign(opts, {
|
|
632
|
-
args
|
|
633
|
-
}, opts.opts);
|
|
526
|
+
return Object.assign(opts, { args }, opts.opts);
|
|
634
527
|
}
|
|
635
528
|
function decorateMessage(id, message, opts) {
|
|
636
529
|
if (typeof message === "string") {
|
|
637
530
|
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
|
|
638
|
-
message = opts.time ?
|
|
531
|
+
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
|
|
639
532
|
message = addColor(message, opts.color, opts.background);
|
|
640
533
|
}
|
|
641
534
|
return message;
|
|
642
535
|
}
|
|
643
|
-
function logImageInNode(_ref2) {
|
|
644
|
-
let {
|
|
645
|
-
image,
|
|
646
|
-
message = "",
|
|
647
|
-
scale = 1
|
|
648
|
-
} = _ref2;
|
|
649
|
-
console.warn("removed");
|
|
650
|
-
return noop;
|
|
651
|
-
}
|
|
652
|
-
function logImageInBrowser(_ref3) {
|
|
653
|
-
let {
|
|
654
|
-
image,
|
|
655
|
-
message = "",
|
|
656
|
-
scale = 1
|
|
657
|
-
} = _ref3;
|
|
658
|
-
if (typeof image === "string") {
|
|
659
|
-
const img = new Image();
|
|
660
|
-
img.onload = () => {
|
|
661
|
-
const args = formatImage(img, message, scale);
|
|
662
|
-
console.log(...args);
|
|
663
|
-
};
|
|
664
|
-
img.src = image;
|
|
665
|
-
return noop;
|
|
666
|
-
}
|
|
667
|
-
const element = image.nodeName || "";
|
|
668
|
-
if (element.toLowerCase() === "img") {
|
|
669
|
-
console.log(...formatImage(image, message, scale));
|
|
670
|
-
return noop;
|
|
671
|
-
}
|
|
672
|
-
if (element.toLowerCase() === "canvas") {
|
|
673
|
-
const img = new Image();
|
|
674
|
-
img.onload = () => console.log(...formatImage(img, message, scale));
|
|
675
|
-
img.src = image.toDataURL();
|
|
676
|
-
return noop;
|
|
677
|
-
}
|
|
678
|
-
return noop;
|
|
679
|
-
}
|
|
680
536
|
function getTableHeader(table) {
|
|
681
537
|
for (const key in table) {
|
|
682
538
|
for (const title in table[key]) {
|
|
@@ -686,10 +542,11 @@ var __exports__ = (() => {
|
|
|
686
542
|
return "empty";
|
|
687
543
|
}
|
|
688
544
|
|
|
545
|
+
// ../../node_modules/@probe.gl/log/dist/init.js
|
|
546
|
+
globalThis.probe = {};
|
|
547
|
+
|
|
689
548
|
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
690
|
-
var dist_default = new Log({
|
|
691
|
-
id: "@probe.gl/log"
|
|
692
|
-
});
|
|
549
|
+
var dist_default = new Log({ id: "@probe.gl/log" });
|
|
693
550
|
|
|
694
551
|
// ../loader-utils/src/lib/log-utils/log.ts
|
|
695
552
|
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
@@ -767,11 +624,11 @@ var __exports__ = (() => {
|
|
|
767
624
|
global: typeof global !== "undefined" && global,
|
|
768
625
|
document: typeof document !== "undefined" && document
|
|
769
626
|
};
|
|
770
|
-
var
|
|
627
|
+
var self_2 = globals2.self || globals2.window || globals2.global || {};
|
|
771
628
|
var window_3 = globals2.window || globals2.self || globals2.global || {};
|
|
772
629
|
var global_3 = globals2.global || globals2.self || globals2.window || {};
|
|
773
630
|
var document_3 = globals2.document || {};
|
|
774
|
-
var
|
|
631
|
+
var isBrowser3 = (
|
|
775
632
|
// @ts-ignore process.browser
|
|
776
633
|
typeof process !== "object" || String(process) !== "[object process]" || process.browser
|
|
777
634
|
);
|
|
@@ -937,7 +794,7 @@ var __exports__ = (() => {
|
|
|
937
794
|
_loadableURL = "";
|
|
938
795
|
/** Checks if workers are supported on this platform */
|
|
939
796
|
static isSupported() {
|
|
940
|
-
return typeof Worker !== "undefined" &&
|
|
797
|
+
return typeof Worker !== "undefined" && isBrowser3 || typeof NodeWorker !== "undefined" && !isBrowser3;
|
|
941
798
|
}
|
|
942
799
|
constructor(props) {
|
|
943
800
|
const { name, source, url } = props;
|
|
@@ -947,7 +804,7 @@ var __exports__ = (() => {
|
|
|
947
804
|
this.url = url;
|
|
948
805
|
this.onMessage = NOOP;
|
|
949
806
|
this.onError = (error) => console.log(error);
|
|
950
|
-
this.worker =
|
|
807
|
+
this.worker = isBrowser3 ? this._createBrowserWorker() : this._createNodeWorker();
|
|
951
808
|
}
|
|
952
809
|
/**
|
|
953
810
|
* Terminate this worker thread
|
|
@@ -1143,7 +1000,7 @@ var __exports__ = (() => {
|
|
|
1143
1000
|
const shouldDestroyWorker = (
|
|
1144
1001
|
// Workers on Node.js prevent the process from exiting.
|
|
1145
1002
|
// Until we figure out how to close them before exit, we always destroy them
|
|
1146
|
-
!
|
|
1003
|
+
!isBrowser3 || // If the pool is destroyed, there is no reason to keep the worker around
|
|
1147
1004
|
this.isDestroyed || // If the app has disabled worker reuse, any completed workers should be destroyed
|
|
1148
1005
|
!this.reuseWorkers || // If concurrency has been lowered, this worker might be surplus to requirements
|
|
1149
1006
|
this.count > this._getMaxConcurrency()
|
|
@@ -1267,13 +1124,13 @@ var __exports__ = (() => {
|
|
|
1267
1124
|
}
|
|
1268
1125
|
function getWorkerURL(worker, options = {}) {
|
|
1269
1126
|
const workerOptions = options[worker.id] || {};
|
|
1270
|
-
const workerFile =
|
|
1127
|
+
const workerFile = isBrowser3 ? `${worker.id}-worker.js` : `${worker.id}-worker-node.js`;
|
|
1271
1128
|
let url = workerOptions.workerUrl;
|
|
1272
1129
|
if (!url && worker.id === "compression") {
|
|
1273
1130
|
url = options.workerUrl;
|
|
1274
1131
|
}
|
|
1275
1132
|
if (options._workerType === "test") {
|
|
1276
|
-
if (
|
|
1133
|
+
if (isBrowser3) {
|
|
1277
1134
|
url = `modules/${worker.module}/dist/${workerFile}`;
|
|
1278
1135
|
} else {
|
|
1279
1136
|
url = `modules/${worker.module}/src/workers/${worker.id}-worker-node.ts`;
|
|
@@ -1354,7 +1211,7 @@ var __exports__ = (() => {
|
|
|
1354
1211
|
if (!WorkerFarm.isSupported()) {
|
|
1355
1212
|
return false;
|
|
1356
1213
|
}
|
|
1357
|
-
if (!
|
|
1214
|
+
if (!isBrowser3 && !options?._nodeWorkers) {
|
|
1358
1215
|
return false;
|
|
1359
1216
|
}
|
|
1360
1217
|
return loader.worker && options?.worker;
|
|
@@ -1522,20 +1379,18 @@ var __exports__ = (() => {
|
|
|
1522
1379
|
// ../../node_modules/@probe.gl/stats/dist/lib/stat.js
|
|
1523
1380
|
var Stat = class {
|
|
1524
1381
|
constructor(name, type) {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
_defineProperty(this, "_startTime", 0);
|
|
1538
|
-
_defineProperty(this, "_timerPending", false);
|
|
1382
|
+
this.sampleSize = 1;
|
|
1383
|
+
this.time = 0;
|
|
1384
|
+
this.count = 0;
|
|
1385
|
+
this.samples = 0;
|
|
1386
|
+
this.lastTiming = 0;
|
|
1387
|
+
this.lastSampleTime = 0;
|
|
1388
|
+
this.lastSampleCount = 0;
|
|
1389
|
+
this._count = 0;
|
|
1390
|
+
this._time = 0;
|
|
1391
|
+
this._samples = 0;
|
|
1392
|
+
this._startTime = 0;
|
|
1393
|
+
this._timerPending = false;
|
|
1539
1394
|
this.name = name;
|
|
1540
1395
|
this.type = type;
|
|
1541
1396
|
this.reset();
|
|
@@ -1558,26 +1413,31 @@ var __exports__ = (() => {
|
|
|
1558
1413
|
this.sampleSize = samples;
|
|
1559
1414
|
return this;
|
|
1560
1415
|
}
|
|
1416
|
+
/** Call to increment count (+1) */
|
|
1561
1417
|
incrementCount() {
|
|
1562
1418
|
this.addCount(1);
|
|
1563
1419
|
return this;
|
|
1564
1420
|
}
|
|
1421
|
+
/** Call to decrement count (-1) */
|
|
1565
1422
|
decrementCount() {
|
|
1566
1423
|
this.subtractCount(1);
|
|
1567
1424
|
return this;
|
|
1568
1425
|
}
|
|
1426
|
+
/** Increase count */
|
|
1569
1427
|
addCount(value) {
|
|
1570
1428
|
this._count += value;
|
|
1571
1429
|
this._samples++;
|
|
1572
1430
|
this._checkSampling();
|
|
1573
1431
|
return this;
|
|
1574
1432
|
}
|
|
1433
|
+
/** Decrease count */
|
|
1575
1434
|
subtractCount(value) {
|
|
1576
1435
|
this._count -= value;
|
|
1577
1436
|
this._samples++;
|
|
1578
1437
|
this._checkSampling();
|
|
1579
1438
|
return this;
|
|
1580
1439
|
}
|
|
1440
|
+
/** Add an arbitrary timing and bump the count */
|
|
1581
1441
|
addTime(time) {
|
|
1582
1442
|
this._time += time;
|
|
1583
1443
|
this.lastTiming = time;
|
|
@@ -1585,11 +1445,13 @@ var __exports__ = (() => {
|
|
|
1585
1445
|
this._checkSampling();
|
|
1586
1446
|
return this;
|
|
1587
1447
|
}
|
|
1448
|
+
/** Start a timer */
|
|
1588
1449
|
timeStart() {
|
|
1589
1450
|
this._startTime = getHiResTimestamp2();
|
|
1590
1451
|
this._timerPending = true;
|
|
1591
1452
|
return this;
|
|
1592
1453
|
}
|
|
1454
|
+
/** End a timer. Adds to time and bumps the timing count. */
|
|
1593
1455
|
timeEnd() {
|
|
1594
1456
|
if (!this._timerPending) {
|
|
1595
1457
|
return this;
|
|
@@ -1602,18 +1464,22 @@ var __exports__ = (() => {
|
|
|
1602
1464
|
getSampleAverageCount() {
|
|
1603
1465
|
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
|
|
1604
1466
|
}
|
|
1467
|
+
/** Calculate average time / count for the previous window */
|
|
1605
1468
|
getSampleAverageTime() {
|
|
1606
1469
|
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
|
|
1607
1470
|
}
|
|
1471
|
+
/** Calculate counts per second for the previous window */
|
|
1608
1472
|
getSampleHz() {
|
|
1609
1473
|
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
|
|
1610
1474
|
}
|
|
1611
1475
|
getAverageCount() {
|
|
1612
1476
|
return this.samples > 0 ? this.count / this.samples : 0;
|
|
1613
1477
|
}
|
|
1478
|
+
/** Calculate average time / count */
|
|
1614
1479
|
getAverageTime() {
|
|
1615
1480
|
return this.samples > 0 ? this.time / this.samples : 0;
|
|
1616
1481
|
}
|
|
1482
|
+
/** Calculate counts per second */
|
|
1617
1483
|
getHz() {
|
|
1618
1484
|
return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
|
|
1619
1485
|
}
|
|
@@ -1634,23 +1500,20 @@ var __exports__ = (() => {
|
|
|
1634
1500
|
// ../../node_modules/@probe.gl/stats/dist/lib/stats.js
|
|
1635
1501
|
var Stats = class {
|
|
1636
1502
|
constructor(options) {
|
|
1637
|
-
|
|
1638
|
-
_defineProperty(this, "stats", {});
|
|
1503
|
+
this.stats = {};
|
|
1639
1504
|
this.id = options.id;
|
|
1640
1505
|
this.stats = {};
|
|
1641
1506
|
this._initializeStats(options.stats);
|
|
1642
1507
|
Object.seal(this);
|
|
1643
1508
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
return this._getOrCreate({
|
|
1647
|
-
name,
|
|
1648
|
-
type
|
|
1649
|
-
});
|
|
1509
|
+
/** Acquire a stat. Create if it doesn't exist. */
|
|
1510
|
+
get(name, type = "count") {
|
|
1511
|
+
return this._getOrCreate({ name, type });
|
|
1650
1512
|
}
|
|
1651
1513
|
get size() {
|
|
1652
1514
|
return Object.keys(this.stats).length;
|
|
1653
1515
|
}
|
|
1516
|
+
/** Reset all stats */
|
|
1654
1517
|
reset() {
|
|
1655
1518
|
for (const stat of Object.values(this.stats)) {
|
|
1656
1519
|
stat.reset();
|
|
@@ -1674,15 +1537,11 @@ var __exports__ = (() => {
|
|
|
1674
1537
|
});
|
|
1675
1538
|
return table;
|
|
1676
1539
|
}
|
|
1677
|
-
_initializeStats() {
|
|
1678
|
-
let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
1540
|
+
_initializeStats(stats = []) {
|
|
1679
1541
|
stats.forEach((stat) => this._getOrCreate(stat));
|
|
1680
1542
|
}
|
|
1681
1543
|
_getOrCreate(stat) {
|
|
1682
|
-
const {
|
|
1683
|
-
name,
|
|
1684
|
-
type
|
|
1685
|
-
} = stat;
|
|
1544
|
+
const { name, type } = stat;
|
|
1686
1545
|
let result = this.stats[name];
|
|
1687
1546
|
if (!result) {
|
|
1688
1547
|
if (stat instanceof Stat) {
|
|
@@ -3341,9 +3200,9 @@ var __exports__ = (() => {
|
|
|
3341
3200
|
}
|
|
3342
3201
|
|
|
3343
3202
|
// src/lib/api/encode.ts
|
|
3344
|
-
async function encode(data, writer,
|
|
3203
|
+
async function encode(data, writer, options_) {
|
|
3345
3204
|
const globalOptions = getGlobalLoaderOptions();
|
|
3346
|
-
options = { ...globalOptions, ...
|
|
3205
|
+
const options = { ...globalOptions, ...options_ };
|
|
3347
3206
|
if (writer.encodeURLtoURL) {
|
|
3348
3207
|
return encodeWithCommandLineTool(writer, data, options);
|
|
3349
3208
|
}
|