@loaders.gl/loader-utils 4.2.0-alpha.4 → 4.2.0-alpha.6
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/index.cjs +103 -95
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +46 -46
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -1
- package/dist/json-loader.d.ts +1 -1
- package/dist/json-loader.d.ts.map +1 -1
- package/dist/json-loader.js +20 -14
- package/dist/lib/binary-utils/array-buffer-utils.js +75 -46
- package/dist/lib/binary-utils/dataview-copy-utils.d.ts +1 -1
- package/dist/lib/binary-utils/dataview-copy-utils.d.ts.map +1 -1
- package/dist/lib/binary-utils/dataview-copy-utils.js +75 -34
- package/dist/lib/binary-utils/get-first-characters.js +39 -21
- package/dist/lib/binary-utils/memory-conversion-utils.js +38 -23
- package/dist/lib/binary-utils/memory-copy-utils.js +49 -20
- package/dist/lib/env-utils/assert.js +7 -4
- package/dist/lib/env-utils/globals.js +15 -7
- package/dist/lib/file-provider/data-view-file.d.ts +1 -1
- package/dist/lib/file-provider/data-view-file.d.ts.map +1 -1
- package/dist/lib/file-provider/data-view-file.js +60 -29
- package/dist/lib/file-provider/file-handle-file.d.ts +1 -1
- package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -1
- package/dist/lib/file-provider/file-handle-file.js +98 -58
- package/dist/lib/file-provider/file-provider.js +8 -3
- package/dist/lib/files/blob-file.d.ts +1 -1
- package/dist/lib/files/blob-file.d.ts.map +1 -1
- package/dist/lib/files/blob-file.js +28 -23
- package/dist/lib/files/file.js +3 -1
- package/dist/lib/files/http-file.d.ts +1 -1
- package/dist/lib/files/http-file.d.ts.map +1 -1
- package/dist/lib/files/http-file.js +93 -71
- package/dist/lib/files/node-file-facade.d.ts +1 -1
- package/dist/lib/files/node-file-facade.d.ts.map +1 -1
- package/dist/lib/files/node-file-facade.js +38 -29
- package/dist/lib/files/sources.js +150 -1
- package/dist/lib/filesystems/filesystem.d.ts +1 -1
- package/dist/lib/filesystems/filesystem.d.ts.map +1 -1
- package/dist/lib/filesystems/filesystem.js +3 -1
- package/dist/lib/filesystems/node-filesystem-facade.d.ts +3 -3
- package/dist/lib/filesystems/node-filesystem-facade.d.ts.map +1 -1
- package/dist/lib/filesystems/node-filesystem-facade.js +41 -31
- package/dist/lib/iterators/async-iteration.js +39 -24
- package/dist/lib/iterators/text-iterators.js +46 -39
- package/dist/lib/node/buffer.browser.js +15 -3
- package/dist/lib/node/buffer.js +30 -16
- package/dist/lib/node/fs.browser.js +0 -1
- package/dist/lib/node/promisify.js +10 -4
- package/dist/lib/node/stream.browser.js +0 -1
- package/dist/lib/node/stream.js +4 -1
- package/dist/lib/option-utils/merge-loader-options.d.ts +1 -1
- package/dist/lib/option-utils/merge-loader-options.d.ts.map +1 -1
- package/dist/lib/option-utils/merge-loader-options.js +25 -17
- package/dist/lib/parser-utils/parse-json.js +9 -6
- package/dist/lib/path-utils/file-aliases.js +29 -13
- package/dist/lib/path-utils/get-cwd.js +6 -7
- package/dist/lib/path-utils/path.js +149 -105
- package/dist/lib/request-utils/request-scheduler.d.ts +2 -1
- package/dist/lib/request-utils/request-scheduler.d.ts.map +1 -1
- package/dist/lib/request-utils/request-scheduler.js +132 -102
- package/dist/lib/sources/data-source.js +53 -38
- package/dist/lib/sources/image-source.d.ts +3 -3
- package/dist/lib/sources/image-source.d.ts.map +1 -1
- package/dist/lib/sources/image-source.js +12 -4
- package/dist/lib/sources/image-tile-source.d.ts +3 -3
- package/dist/lib/sources/image-tile-source.d.ts.map +1 -1
- package/dist/lib/sources/image-tile-source.js +3 -1
- package/dist/lib/sources/tile-source-adapter.d.ts +3 -3
- package/dist/lib/sources/tile-source-adapter.d.ts.map +1 -1
- package/dist/lib/sources/tile-source-adapter.js +44 -36
- package/dist/lib/sources/tile-source.js +3 -1
- package/dist/lib/sources/utils/image-type.js +0 -1
- package/dist/lib/sources/utils/utils.js +31 -17
- package/dist/lib/sources/vector-tile-source.d.ts +2 -2
- package/dist/lib/sources/vector-tile-source.d.ts.map +1 -1
- package/dist/lib/sources/vector-tile-source.js +3 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.d.ts +1 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.d.ts.map +1 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.js +87 -87
- package/dist/lib/worker-loader-utils/encode-with-worker.d.ts +1 -1
- package/dist/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
- package/dist/lib/worker-loader-utils/encode-with-worker.js +13 -8
- package/dist/lib/worker-loader-utils/parse-with-worker.d.ts +1 -1
- package/dist/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
- package/dist/lib/worker-loader-utils/parse-with-worker.js +68 -55
- package/dist/loader-types.d.ts +2 -2
- package/dist/loader-types.d.ts.map +1 -1
- package/dist/loader-types.js +26 -10
- package/dist/service-types.d.ts +1 -1
- package/dist/service-types.d.ts.map +1 -1
- package/dist/service-types.js +3 -1
- package/dist/types.js +1 -1
- package/dist/workers/json-worker.js +0 -1
- package/dist/writer-types.js +3 -1
- package/package.json +10 -8
- package/src/lib/request-utils/request-scheduler.ts +17 -8
- package/src/lib/sources/tile-source-adapter.ts +1 -1
- package/dist/index.js.map +0 -1
- package/dist/json-loader.js.map +0 -1
- package/dist/lib/binary-utils/array-buffer-utils.js.map +0 -1
- package/dist/lib/binary-utils/dataview-copy-utils.js.map +0 -1
- package/dist/lib/binary-utils/get-first-characters.js.map +0 -1
- package/dist/lib/binary-utils/memory-conversion-utils.js.map +0 -1
- package/dist/lib/binary-utils/memory-copy-utils.js.map +0 -1
- package/dist/lib/env-utils/assert.js.map +0 -1
- package/dist/lib/env-utils/globals.js.map +0 -1
- package/dist/lib/file-provider/data-view-file.js.map +0 -1
- package/dist/lib/file-provider/file-handle-file.js.map +0 -1
- package/dist/lib/file-provider/file-provider.js.map +0 -1
- package/dist/lib/files/blob-file.js.map +0 -1
- package/dist/lib/files/file.js.map +0 -1
- package/dist/lib/files/http-file.js.map +0 -1
- package/dist/lib/files/node-file-facade.js.map +0 -1
- package/dist/lib/files/sources.js.map +0 -1
- package/dist/lib/filesystems/filesystem.js.map +0 -1
- package/dist/lib/filesystems/node-filesystem-facade.js.map +0 -1
- package/dist/lib/iterators/async-iteration.js.map +0 -1
- package/dist/lib/iterators/text-iterators.js.map +0 -1
- package/dist/lib/node/buffer.browser.js.map +0 -1
- package/dist/lib/node/buffer.js.map +0 -1
- package/dist/lib/node/fs.browser.js.map +0 -1
- package/dist/lib/node/promisify.js.map +0 -1
- package/dist/lib/node/stream.browser.js.map +0 -1
- package/dist/lib/node/stream.js.map +0 -1
- package/dist/lib/option-utils/merge-loader-options.js.map +0 -1
- package/dist/lib/parser-utils/parse-json.js.map +0 -1
- package/dist/lib/path-utils/file-aliases.js.map +0 -1
- package/dist/lib/path-utils/get-cwd.js.map +0 -1
- package/dist/lib/path-utils/path.js.map +0 -1
- package/dist/lib/request-utils/request-scheduler.js.map +0 -1
- package/dist/lib/sources/data-source.js.map +0 -1
- package/dist/lib/sources/image-source.js.map +0 -1
- package/dist/lib/sources/image-tile-source.js.map +0 -1
- package/dist/lib/sources/tile-source-adapter.js.map +0 -1
- package/dist/lib/sources/tile-source.js.map +0 -1
- package/dist/lib/sources/utils/image-type.js.map +0 -1
- package/dist/lib/sources/utils/utils.js.map +0 -1
- package/dist/lib/sources/vector-tile-source.js.map +0 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
- package/dist/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
- package/dist/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
- package/dist/loader-types.js.map +0 -1
- package/dist/service-types.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/workers/json-worker.js.map +0 -1
- package/dist/writer-types.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,10 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
17
|
return to;
|
|
17
18
|
};
|
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var __publicField = (obj, key, value) => {
|
|
21
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
19
24
|
|
|
20
|
-
//
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
25
|
+
// dist/index.js
|
|
26
|
+
var dist_exports = {};
|
|
27
|
+
__export(dist_exports, {
|
|
23
28
|
BlobFile: () => BlobFile,
|
|
24
29
|
DataSource: () => DataSource,
|
|
25
30
|
DataViewFile: () => DataViewFile,
|
|
@@ -81,9 +86,9 @@ __export(src_exports, {
|
|
|
81
86
|
toBuffer: () => toBuffer2,
|
|
82
87
|
window: () => window_
|
|
83
88
|
});
|
|
84
|
-
module.exports = __toCommonJS(
|
|
89
|
+
module.exports = __toCommonJS(dist_exports);
|
|
85
90
|
|
|
86
|
-
//
|
|
91
|
+
// dist/loader-types.js
|
|
87
92
|
async function parseFromContext(data, loaders, options, context) {
|
|
88
93
|
return context._parse(data, loaders, options, context);
|
|
89
94
|
}
|
|
@@ -100,14 +105,14 @@ async function parseInBatchesFromContext(data, loader, options, context) {
|
|
|
100
105
|
return context._parseInBatches(data, loader, options, context);
|
|
101
106
|
}
|
|
102
107
|
|
|
103
|
-
//
|
|
108
|
+
// dist/lib/env-utils/assert.js
|
|
104
109
|
function assert(condition, message) {
|
|
105
110
|
if (!condition) {
|
|
106
111
|
throw new Error(message || "loader assertion failed.");
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
|
|
110
|
-
//
|
|
115
|
+
// dist/lib/env-utils/globals.js
|
|
111
116
|
var globals = {
|
|
112
117
|
self: typeof self !== "undefined" && self,
|
|
113
118
|
window: typeof window !== "undefined" && window,
|
|
@@ -126,7 +131,7 @@ var isWorker = typeof importScripts === "function";
|
|
|
126
131
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
127
132
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
128
133
|
|
|
129
|
-
//
|
|
134
|
+
// dist/lib/option-utils/merge-loader-options.js
|
|
130
135
|
function mergeLoaderOptions(baseOptions, newOptions) {
|
|
131
136
|
return mergeOptionsRecursively(baseOptions || {}, newOptions);
|
|
132
137
|
}
|
|
@@ -137,11 +142,7 @@ function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
|
|
|
137
142
|
const options = { ...baseOptions };
|
|
138
143
|
for (const [key, newValue] of Object.entries(newOptions)) {
|
|
139
144
|
if (newValue && typeof newValue === "object" && !Array.isArray(newValue)) {
|
|
140
|
-
options[key] = mergeOptionsRecursively(
|
|
141
|
-
options[key] || {},
|
|
142
|
-
newOptions[key],
|
|
143
|
-
level + 1
|
|
144
|
-
);
|
|
145
|
+
options[key] = mergeOptionsRecursively(options[key] || {}, newOptions[key], level + 1);
|
|
145
146
|
} else {
|
|
146
147
|
options[key] = newOptions[key];
|
|
147
148
|
}
|
|
@@ -149,7 +150,7 @@ function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
|
|
|
149
150
|
return options;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
//
|
|
153
|
+
// dist/lib/worker-loader-utils/create-loader-worker.js
|
|
153
154
|
var import_worker_utils = require("@loaders.gl/worker-utils");
|
|
154
155
|
var requestId = 0;
|
|
155
156
|
async function createLoaderWorker(loader) {
|
|
@@ -205,12 +206,7 @@ function parseOnMainThread(arrayBuffer, loader, options, context) {
|
|
|
205
206
|
import_worker_utils.WorkerBody.postMessage("process", payload);
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
|
-
async function parseData({
|
|
209
|
-
loader,
|
|
210
|
-
arrayBuffer,
|
|
211
|
-
options,
|
|
212
|
-
context
|
|
213
|
-
}) {
|
|
209
|
+
async function parseData({ loader, arrayBuffer, options, context }) {
|
|
214
210
|
let data;
|
|
215
211
|
let parser;
|
|
216
212
|
if (loader.parseSync || loader.parse) {
|
|
@@ -231,7 +227,7 @@ async function parseData({
|
|
|
231
227
|
return await parser(data, { ...options }, context, loader);
|
|
232
228
|
}
|
|
233
229
|
|
|
234
|
-
//
|
|
230
|
+
// dist/lib/worker-loader-utils/parse-with-worker.js
|
|
235
231
|
var import_worker_utils2 = require("@loaders.gl/worker-utils");
|
|
236
232
|
var import_worker_utils3 = require("@loaders.gl/worker-utils");
|
|
237
233
|
function canParseWithWorker(loader, options) {
|
|
@@ -288,7 +284,7 @@ async function onMessage(parseOnMainThread2, job, type, payload) {
|
|
|
288
284
|
}
|
|
289
285
|
}
|
|
290
286
|
|
|
291
|
-
//
|
|
287
|
+
// dist/lib/worker-loader-utils/encode-with-worker.js
|
|
292
288
|
var import_worker_utils4 = require("@loaders.gl/worker-utils");
|
|
293
289
|
function canEncodeWithWorker(writer, options) {
|
|
294
290
|
if (!import_worker_utils4.WorkerFarm.isSupported()) {
|
|
@@ -300,7 +296,7 @@ function canEncodeWithWorker(writer, options) {
|
|
|
300
296
|
return writer.worker && (options == null ? void 0 : options.worker);
|
|
301
297
|
}
|
|
302
298
|
|
|
303
|
-
//
|
|
299
|
+
// dist/lib/binary-utils/get-first-characters.js
|
|
304
300
|
function getFirstCharacters(data, length = 5) {
|
|
305
301
|
if (typeof data === "string") {
|
|
306
302
|
return data.slice(0, length);
|
|
@@ -324,7 +320,7 @@ function getMagicString(arrayBuffer, byteOffset, length) {
|
|
|
324
320
|
return magic;
|
|
325
321
|
}
|
|
326
322
|
|
|
327
|
-
//
|
|
323
|
+
// dist/lib/parser-utils/parse-json.js
|
|
328
324
|
function parseJSON(string) {
|
|
329
325
|
try {
|
|
330
326
|
return JSON.parse(string);
|
|
@@ -333,7 +329,7 @@ function parseJSON(string) {
|
|
|
333
329
|
}
|
|
334
330
|
}
|
|
335
331
|
|
|
336
|
-
//
|
|
332
|
+
// dist/lib/binary-utils/array-buffer-utils.js
|
|
337
333
|
function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
|
|
338
334
|
byteLength = byteLength || arrayBuffer1.byteLength;
|
|
339
335
|
if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
|
|
@@ -352,9 +348,7 @@ function concatenateArrayBuffers(...sources) {
|
|
|
352
348
|
return concatenateArrayBuffersFromArray(sources);
|
|
353
349
|
}
|
|
354
350
|
function concatenateArrayBuffersFromArray(sources) {
|
|
355
|
-
const sourceArrays = sources.map(
|
|
356
|
-
(source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2
|
|
357
|
-
);
|
|
351
|
+
const sourceArrays = sources.map((source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
|
|
358
352
|
const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);
|
|
359
353
|
const result = new Uint8Array(byteLength);
|
|
360
354
|
let offset = 0;
|
|
@@ -368,9 +362,7 @@ function concatenateTypedArrays(...typedArrays) {
|
|
|
368
362
|
const arrays = typedArrays;
|
|
369
363
|
const TypedArrayConstructor = arrays && arrays.length > 1 && arrays[0].constructor || null;
|
|
370
364
|
if (!TypedArrayConstructor) {
|
|
371
|
-
throw new Error(
|
|
372
|
-
'"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types'
|
|
373
|
-
);
|
|
365
|
+
throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');
|
|
374
366
|
}
|
|
375
367
|
const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
|
|
376
368
|
const result = new TypedArrayConstructor(sumLength);
|
|
@@ -387,7 +379,7 @@ function sliceArrayBuffer(arrayBuffer, byteOffset, byteLength) {
|
|
|
387
379
|
return arrayCopy.buffer;
|
|
388
380
|
}
|
|
389
381
|
|
|
390
|
-
//
|
|
382
|
+
// dist/lib/binary-utils/memory-copy-utils.js
|
|
391
383
|
function padToNBytes(byteLength, padding) {
|
|
392
384
|
assert(byteLength >= 0);
|
|
393
385
|
assert(padding > 0);
|
|
@@ -412,7 +404,7 @@ function copyToArray(source, target, targetOffset) {
|
|
|
412
404
|
return targetOffset + padToNBytes(sourceArray.byteLength, 4);
|
|
413
405
|
}
|
|
414
406
|
|
|
415
|
-
//
|
|
407
|
+
// dist/lib/binary-utils/dataview-copy-utils.js
|
|
416
408
|
function padStringToByteAlignment(string, byteAlignment) {
|
|
417
409
|
const length = string.length;
|
|
418
410
|
const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
|
|
@@ -443,11 +435,7 @@ function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, pad
|
|
|
443
435
|
const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
|
|
444
436
|
const padLength = paddedLength - sourceBuffer.byteLength;
|
|
445
437
|
if (dataView) {
|
|
446
|
-
const targetArray = new Uint8Array(
|
|
447
|
-
dataView.buffer,
|
|
448
|
-
dataView.byteOffset + byteOffset,
|
|
449
|
-
sourceBuffer.byteLength
|
|
450
|
-
);
|
|
438
|
+
const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
|
|
451
439
|
const sourceArray = new Uint8Array(sourceBuffer);
|
|
452
440
|
targetArray.set(sourceArray);
|
|
453
441
|
for (let i = 0; i < padLength; ++i) {
|
|
@@ -464,7 +452,7 @@ function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
|
|
|
464
452
|
return byteOffset;
|
|
465
453
|
}
|
|
466
454
|
|
|
467
|
-
//
|
|
455
|
+
// dist/lib/iterators/text-iterators.js
|
|
468
456
|
async function* makeTextDecoderIterator(arrayBufferIterator, options = {}) {
|
|
469
457
|
const textDecoder = new TextDecoder(void 0, options);
|
|
470
458
|
for await (const arrayBuffer of arrayBufferIterator) {
|
|
@@ -500,7 +488,7 @@ async function* makeNumberedLineIterator(lineIterator) {
|
|
|
500
488
|
}
|
|
501
489
|
}
|
|
502
490
|
|
|
503
|
-
//
|
|
491
|
+
// dist/lib/iterators/async-iteration.js
|
|
504
492
|
async function forEach(iterator, visitor) {
|
|
505
493
|
while (true) {
|
|
506
494
|
const { done, value } = await iterator.next();
|
|
@@ -522,7 +510,7 @@ async function concatenateArrayBuffersAsync(asyncIterator) {
|
|
|
522
510
|
return concatenateArrayBuffers(...arrayBuffers);
|
|
523
511
|
}
|
|
524
512
|
|
|
525
|
-
//
|
|
513
|
+
// dist/lib/request-utils/request-scheduler.js
|
|
526
514
|
var import_stats = require("@probe.gl/stats");
|
|
527
515
|
var STAT_QUEUED_REQUESTS = "Queued Requests";
|
|
528
516
|
var STAT_ACTIVE_REQUESTS = "Active Requests";
|
|
@@ -531,18 +519,25 @@ var STAT_QUEUED_REQUESTS_EVER = "Queued Requests Ever";
|
|
|
531
519
|
var STAT_ACTIVE_REQUESTS_EVER = "Active Requests Ever";
|
|
532
520
|
var DEFAULT_PROPS = {
|
|
533
521
|
id: "request-scheduler",
|
|
534
|
-
|
|
522
|
+
/** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */
|
|
535
523
|
throttleRequests: true,
|
|
536
|
-
|
|
537
|
-
maxRequests: 6
|
|
524
|
+
/** The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit. */
|
|
525
|
+
maxRequests: 6,
|
|
526
|
+
/**
|
|
527
|
+
* Specifies a debounce time, in milliseconds. All requests are queued, until no new requests have
|
|
528
|
+
* been added to the queue for this amount of time.
|
|
529
|
+
*/
|
|
530
|
+
debounceTime: 0
|
|
538
531
|
};
|
|
539
532
|
var RequestScheduler = class {
|
|
533
|
+
props;
|
|
534
|
+
stats;
|
|
535
|
+
activeRequestCount = 0;
|
|
536
|
+
/** Tracks the number of active requests and prioritizes/cancels queued requests. */
|
|
537
|
+
requestQueue = [];
|
|
538
|
+
requestMap = /* @__PURE__ */ new Map();
|
|
539
|
+
updateTimer = null;
|
|
540
540
|
constructor(props = {}) {
|
|
541
|
-
this.activeRequestCount = 0;
|
|
542
|
-
/** Tracks the number of active requests and prioritizes/cancels queued requests. */
|
|
543
|
-
this.requestQueue = [];
|
|
544
|
-
this.requestMap = /* @__PURE__ */ new Map();
|
|
545
|
-
this.deferredUpdate = null;
|
|
546
541
|
this.props = { ...DEFAULT_PROPS, ...props };
|
|
547
542
|
this.stats = new import_stats.Stats({ id: this.props.id });
|
|
548
543
|
this.stats.get(STAT_QUEUED_REQUESTS);
|
|
@@ -602,13 +597,17 @@ var RequestScheduler = class {
|
|
|
602
597
|
}
|
|
603
598
|
/** We check requests asynchronously, to prevent multiple updates */
|
|
604
599
|
_issueNewRequests() {
|
|
605
|
-
if (
|
|
606
|
-
|
|
600
|
+
if (this.updateTimer !== null) {
|
|
601
|
+
clearTimeout(this.updateTimer);
|
|
607
602
|
}
|
|
603
|
+
this.updateTimer = setTimeout(() => this._issueNewRequestsAsync(), this.props.debounceTime);
|
|
608
604
|
}
|
|
609
605
|
/** Refresh all requests */
|
|
610
606
|
_issueNewRequestsAsync() {
|
|
611
|
-
this.
|
|
607
|
+
if (this.updateTimer !== null) {
|
|
608
|
+
clearTimeout(this.updateTimer);
|
|
609
|
+
}
|
|
610
|
+
this.updateTimer = null;
|
|
612
611
|
const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);
|
|
613
612
|
if (freeSlots === 0) {
|
|
614
613
|
return;
|
|
@@ -645,7 +644,7 @@ var RequestScheduler = class {
|
|
|
645
644
|
}
|
|
646
645
|
};
|
|
647
646
|
|
|
648
|
-
//
|
|
647
|
+
// dist/lib/path-utils/file-aliases.js
|
|
649
648
|
var pathPrefix = "";
|
|
650
649
|
var fileAliases = {};
|
|
651
650
|
function setPathPrefix(prefix) {
|
|
@@ -670,8 +669,8 @@ function resolvePath(filename2) {
|
|
|
670
669
|
return filename2;
|
|
671
670
|
}
|
|
672
671
|
|
|
673
|
-
//
|
|
674
|
-
var VERSION =
|
|
672
|
+
// dist/json-loader.js
|
|
673
|
+
var VERSION = true ? "4.2.0-alpha.5" : "latest";
|
|
675
674
|
var JSONLoader = {
|
|
676
675
|
name: "JSON",
|
|
677
676
|
id: "json",
|
|
@@ -689,7 +688,7 @@ function parseTextSync(text) {
|
|
|
689
688
|
return JSON.parse(text);
|
|
690
689
|
}
|
|
691
690
|
|
|
692
|
-
//
|
|
691
|
+
// dist/lib/node/buffer.browser.js
|
|
693
692
|
function toArrayBuffer(buffer) {
|
|
694
693
|
return buffer;
|
|
695
694
|
}
|
|
@@ -697,7 +696,7 @@ function toBuffer(binaryData) {
|
|
|
697
696
|
throw new Error("Buffer not supported in browser");
|
|
698
697
|
}
|
|
699
698
|
|
|
700
|
-
//
|
|
699
|
+
// dist/lib/binary-utils/memory-conversion-utils.js
|
|
701
700
|
function isBuffer(value) {
|
|
702
701
|
return value && typeof value === "object" && value.isBuffer;
|
|
703
702
|
}
|
|
@@ -728,19 +727,15 @@ function toArrayBuffer2(data) {
|
|
|
728
727
|
throw new Error("toArrayBuffer");
|
|
729
728
|
}
|
|
730
729
|
|
|
731
|
-
//
|
|
730
|
+
// dist/lib/node/promisify.js
|
|
732
731
|
function promisify1(fn) {
|
|
733
|
-
return (args) => new Promise(
|
|
734
|
-
(resolve2, reject) => fn(args, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs))
|
|
735
|
-
);
|
|
732
|
+
return (args) => new Promise((resolve2, reject) => fn(args, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs)));
|
|
736
733
|
}
|
|
737
734
|
function promisify2(fn) {
|
|
738
|
-
return (arg1, arg2) => new Promise(
|
|
739
|
-
(resolve2, reject) => fn(arg1, arg2, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs))
|
|
740
|
-
);
|
|
735
|
+
return (arg1, arg2) => new Promise((resolve2, reject) => fn(arg1, arg2, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs)));
|
|
741
736
|
}
|
|
742
737
|
|
|
743
|
-
//
|
|
738
|
+
// dist/lib/path-utils/path.js
|
|
744
739
|
var path_exports = {};
|
|
745
740
|
__export(path_exports, {
|
|
746
741
|
dirname: () => dirname,
|
|
@@ -749,7 +744,7 @@ __export(path_exports, {
|
|
|
749
744
|
resolve: () => resolve
|
|
750
745
|
});
|
|
751
746
|
|
|
752
|
-
//
|
|
747
|
+
// dist/lib/path-utils/get-cwd.js
|
|
753
748
|
function getCWD() {
|
|
754
749
|
var _a;
|
|
755
750
|
if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
|
|
@@ -759,7 +754,7 @@ function getCWD() {
|
|
|
759
754
|
return (pathname == null ? void 0 : pathname.slice(0, pathname.lastIndexOf("/") + 1)) || "";
|
|
760
755
|
}
|
|
761
756
|
|
|
762
|
-
//
|
|
757
|
+
// dist/lib/path-utils/path.js
|
|
763
758
|
function filename(url) {
|
|
764
759
|
const slashIndex = url ? url.lastIndexOf("/") : -1;
|
|
765
760
|
return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
|
|
@@ -884,15 +879,19 @@ function normalizeStringPosix(path, allowAboveRoot) {
|
|
|
884
879
|
return res;
|
|
885
880
|
}
|
|
886
881
|
|
|
887
|
-
//
|
|
882
|
+
// dist/lib/node/stream.browser.js
|
|
888
883
|
var stream_browser_exports = {};
|
|
889
884
|
__export(stream_browser_exports, {
|
|
890
885
|
isSupported: () => isSupported
|
|
891
886
|
});
|
|
892
887
|
var isSupported = false;
|
|
893
888
|
|
|
894
|
-
//
|
|
889
|
+
// dist/lib/files/blob-file.js
|
|
895
890
|
var BlobFile = class {
|
|
891
|
+
handle;
|
|
892
|
+
size;
|
|
893
|
+
bigsize;
|
|
894
|
+
url;
|
|
896
895
|
constructor(blob) {
|
|
897
896
|
this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;
|
|
898
897
|
this.size = blob instanceof ArrayBuffer ? blob.byteLength : blob.size;
|
|
@@ -914,11 +913,13 @@ var BlobFile = class {
|
|
|
914
913
|
}
|
|
915
914
|
};
|
|
916
915
|
|
|
917
|
-
//
|
|
916
|
+
// dist/lib/files/http-file.js
|
|
918
917
|
var HttpFile = class {
|
|
918
|
+
handle;
|
|
919
|
+
size = 0;
|
|
920
|
+
bigsize = 0n;
|
|
921
|
+
url;
|
|
919
922
|
constructor(url) {
|
|
920
|
-
this.size = 0;
|
|
921
|
-
this.bigsize = 0n;
|
|
922
923
|
this.handle = url;
|
|
923
924
|
this.url = url;
|
|
924
925
|
}
|
|
@@ -972,9 +973,7 @@ var HttpFile = class {
|
|
|
972
973
|
if (controller) {
|
|
973
974
|
controller.abort();
|
|
974
975
|
}
|
|
975
|
-
throw Error(
|
|
976
|
-
"content-length header missing or exceeding request. Server must support HTTP Byte Serving."
|
|
977
|
-
);
|
|
976
|
+
throw Error("content-length header missing or exceeding request. Server must support HTTP Byte Serving.");
|
|
978
977
|
}
|
|
979
978
|
case 416:
|
|
980
979
|
if (offset === 0) {
|
|
@@ -998,13 +997,14 @@ var HttpFile = class {
|
|
|
998
997
|
}
|
|
999
998
|
};
|
|
1000
999
|
|
|
1001
|
-
//
|
|
1000
|
+
// dist/lib/files/node-file-facade.js
|
|
1002
1001
|
var NOT_IMPLEMENTED = new Error("Not implemented");
|
|
1003
1002
|
var NodeFileFacade = class {
|
|
1003
|
+
handle;
|
|
1004
|
+
size = 0;
|
|
1005
|
+
bigsize = 0n;
|
|
1006
|
+
url = "";
|
|
1004
1007
|
constructor(url, flags, mode) {
|
|
1005
|
-
this.size = 0;
|
|
1006
|
-
this.bigsize = 0n;
|
|
1007
|
-
this.url = "";
|
|
1008
1008
|
var _a;
|
|
1009
1009
|
if ((_a = globalThis.loaders) == null ? void 0 : _a.NodeFile) {
|
|
1010
1010
|
return new globalThis.loaders.NodeFile(url, flags, mode);
|
|
@@ -1039,15 +1039,11 @@ var NodeFileFacade = class {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
};
|
|
1041
1041
|
|
|
1042
|
-
//
|
|
1042
|
+
// dist/lib/filesystems/node-filesystem-facade.js
|
|
1043
1043
|
var NOT_IMPLEMENTED2 = new Error("Not implemented");
|
|
1044
1044
|
var NodeFileSystemFacade = class {
|
|
1045
1045
|
// implements FileSystem
|
|
1046
1046
|
constructor(options) {
|
|
1047
|
-
// DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)
|
|
1048
|
-
// implements RandomAccessReadFileSystem
|
|
1049
|
-
this.readable = true;
|
|
1050
|
-
this.writable = true;
|
|
1051
1047
|
var _a;
|
|
1052
1048
|
if ((_a = globalThis.loaders) == null ? void 0 : _a.NodeFileSystem) {
|
|
1053
1049
|
return new globalThis.loaders.NodeFileSystem(options);
|
|
@@ -1055,10 +1051,12 @@ var NodeFileSystemFacade = class {
|
|
|
1055
1051
|
if (isBrowser) {
|
|
1056
1052
|
throw new Error("Can't instantiate NodeFileSystem in browser.");
|
|
1057
1053
|
}
|
|
1058
|
-
throw new Error(
|
|
1059
|
-
"Can't instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first."
|
|
1060
|
-
);
|
|
1054
|
+
throw new Error("Can't instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first.");
|
|
1061
1055
|
}
|
|
1056
|
+
// DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)
|
|
1057
|
+
// implements RandomAccessReadFileSystem
|
|
1058
|
+
readable = true;
|
|
1059
|
+
writable = true;
|
|
1062
1060
|
async openReadableFile(path, flags) {
|
|
1063
1061
|
throw NOT_IMPLEMENTED2;
|
|
1064
1062
|
}
|
|
@@ -1081,13 +1079,15 @@ var NodeFileSystemFacade = class {
|
|
|
1081
1079
|
}
|
|
1082
1080
|
};
|
|
1083
1081
|
|
|
1084
|
-
//
|
|
1082
|
+
// dist/lib/file-provider/file-provider.js
|
|
1085
1083
|
var isFileProvider = (fileProvider) => {
|
|
1086
1084
|
return (fileProvider == null ? void 0 : fileProvider.getUint8) && (fileProvider == null ? void 0 : fileProvider.slice) && (fileProvider == null ? void 0 : fileProvider.length);
|
|
1087
1085
|
};
|
|
1088
1086
|
|
|
1089
|
-
//
|
|
1087
|
+
// dist/lib/file-provider/file-handle-file.js
|
|
1090
1088
|
var FileHandleFile = class {
|
|
1089
|
+
/** The FileHandle from which data is provided */
|
|
1090
|
+
file;
|
|
1091
1091
|
/** Create a new FileHandleFile */
|
|
1092
1092
|
constructor(path, append = false) {
|
|
1093
1093
|
this.file = new NodeFileFacade(path, append ? "a+" : "r");
|
|
@@ -1179,7 +1179,7 @@ var FileHandleFile = class {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
};
|
|
1181
1181
|
|
|
1182
|
-
//
|
|
1182
|
+
// dist/lib/file-provider/data-view-file.js
|
|
1183
1183
|
var toNumber = (bigint) => {
|
|
1184
1184
|
if (bigint > Number.MAX_SAFE_INTEGER) {
|
|
1185
1185
|
throw new Error("Offset is out of bounds");
|
|
@@ -1187,6 +1187,8 @@ var toNumber = (bigint) => {
|
|
|
1187
1187
|
return Number(bigint);
|
|
1188
1188
|
};
|
|
1189
1189
|
var DataViewFile = class {
|
|
1190
|
+
/** The DataView from which data is provided */
|
|
1191
|
+
file;
|
|
1190
1192
|
constructor(file) {
|
|
1191
1193
|
this.file = file;
|
|
1192
1194
|
}
|
|
@@ -1234,10 +1236,15 @@ var DataViewFile = class {
|
|
|
1234
1236
|
}
|
|
1235
1237
|
};
|
|
1236
1238
|
|
|
1237
|
-
//
|
|
1239
|
+
// dist/lib/sources/data-source.js
|
|
1238
1240
|
var DataSource = class {
|
|
1241
|
+
/** A resolved fetch function extracted from loadOptions prop */
|
|
1242
|
+
fetch;
|
|
1243
|
+
/** The actual load options, if calling a loaders.gl loader */
|
|
1244
|
+
loadOptions;
|
|
1245
|
+
_needsRefresh = true;
|
|
1246
|
+
props;
|
|
1239
1247
|
constructor(props) {
|
|
1240
|
-
this._needsRefresh = true;
|
|
1241
1248
|
this.props = { ...props };
|
|
1242
1249
|
this.loadOptions = { ...props.loadOptions };
|
|
1243
1250
|
this.fetch = getFetchFunction(this.loadOptions);
|
|
@@ -1274,8 +1281,9 @@ function getFetchFunction(options) {
|
|
|
1274
1281
|
return (url) => fetch(url);
|
|
1275
1282
|
}
|
|
1276
1283
|
|
|
1277
|
-
//
|
|
1284
|
+
// dist/lib/sources/image-source.js
|
|
1278
1285
|
var ImageSource = class extends DataSource {
|
|
1279
1286
|
};
|
|
1280
|
-
ImageSource
|
|
1281
|
-
ImageSource
|
|
1287
|
+
__publicField(ImageSource, "type", "template");
|
|
1288
|
+
__publicField(ImageSource, "testURL", (url) => false);
|
|
1289
|
+
//# sourceMappingURL=index.cjs.map
|