@loaders.gl/geospatial 5.0.0-beta.2 → 5.0.0-beta.4
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/dbf-loader-types.cjs +1 -1
- package/dist/dbf-worker.js +393 -57
- package/dist/flatgeobuf/flatgeobuf-loader-types.cjs +1 -1
- package/dist/flatgeobuf/flatgeobuf-loader-types.js +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.cjs +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.js +1 -1
- package/dist/flatgeobuf-loader-types.cjs +1 -1
- package/dist/flatgeobuf-source-loader.cjs +1 -1
- package/dist/flatgeobuf-worker.js +393 -57
- package/dist/geopackage/geopackage-source-loader.cjs +1 -1
- package/dist/geopackage/geopackage-source-loader.js +1 -1
- package/dist/geopackage-source-loader.cjs +1 -1
- package/dist/gpx-loader-types.cjs +1 -1
- package/dist/kml/gpx-loader-types.cjs +1 -1
- package/dist/kml/gpx-loader-types.js +1 -1
- package/dist/kml/kml-loader-types.cjs +1 -1
- package/dist/kml/kml-loader-types.js +1 -1
- package/dist/kml/kml-writer.cjs +1 -1
- package/dist/kml/kml-writer.js +1 -1
- package/dist/kml/kmz-loader-types.cjs +1 -1
- package/dist/kml/kmz-loader-types.js +1 -1
- package/dist/kml/kmz-source.cjs +1 -1
- package/dist/kml/kmz-source.js +1 -1
- package/dist/kml/tcx-loader-types.cjs +1 -1
- package/dist/kml/tcx-loader-types.js +1 -1
- package/dist/kml-loader-types.cjs +1 -1
- package/dist/kml-writer.cjs +1 -1
- package/dist/kmz-loader-types.cjs +1 -1
- package/dist/kmz-source.cjs +1 -1
- package/dist/shapefile/dbf-loader-types.cjs +1 -1
- package/dist/shapefile/dbf-loader-types.js +1 -1
- package/dist/shapefile/dbf-loader.d.ts +1 -1
- package/dist/shapefile/shapefile-loader-types.cjs +1 -1
- package/dist/shapefile/shapefile-loader-types.js +1 -1
- package/dist/shapefile/shp-loader-types.cjs +1 -1
- package/dist/shapefile/shp-loader-types.js +1 -1
- package/dist/shapefile/shp-loader.d.ts +1 -1
- package/dist/shapefile-loader-types.cjs +1 -1
- package/dist/shapefile-worker.js +395 -59
- package/dist/shp-loader-types.cjs +1 -1
- package/dist/shp-worker.js +393 -57
- package/dist/tcx-loader-types.cjs +1 -1
- package/dist/wkt/lib/version.cjs +1 -1
- package/dist/wkt/lib/version.js +1 -1
- package/dist/wkt-worker.js +339 -32
- package/package.json +5 -5
package/dist/dbf-worker.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
21
|
"../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
-
parentPort = null;
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
else if (ArrayBuffer.isView(value)) {
|
|
37
37
|
if (isTransferable(value.buffer))
|
|
38
38
|
transfersSet.add(value.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
40
|
+
visit(value.port1);
|
|
41
|
+
visit(value.port2);
|
|
39
42
|
} else if (recursive && value instanceof Map) {
|
|
40
43
|
for (const [key, item] of value) {
|
|
41
44
|
visit(key);
|
|
@@ -103,16 +106,16 @@
|
|
|
103
106
|
*/
|
|
104
107
|
static set onmessage(onMessage) {
|
|
105
108
|
async function handleMessage(message) {
|
|
106
|
-
const
|
|
107
|
-
const { type, payload } =
|
|
109
|
+
const parentPort3 = await getParentPort();
|
|
110
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
108
111
|
onMessage(type, payload);
|
|
109
112
|
}
|
|
110
|
-
getParentPort().then((
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
+
getParentPort().then((parentPort3) => {
|
|
114
|
+
if (parentPort3) {
|
|
115
|
+
parentPort3.on("message", (message) => {
|
|
113
116
|
handleMessage(message);
|
|
114
117
|
});
|
|
115
|
-
|
|
118
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
116
119
|
} else {
|
|
117
120
|
globalThis.onmessage = handleMessage;
|
|
118
121
|
}
|
|
@@ -130,9 +133,9 @@
|
|
|
130
133
|
};
|
|
131
134
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
132
135
|
}
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
+
const parentPort3 = await getParentPort();
|
|
137
|
+
if (parentPort3) {
|
|
138
|
+
parentPort3.on("message", onMessageWrapper);
|
|
136
139
|
} else {
|
|
137
140
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
138
141
|
}
|
|
@@ -143,9 +146,9 @@
|
|
|
143
146
|
if (!onMessageWrapper) {
|
|
144
147
|
return;
|
|
145
148
|
}
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
+
const parentPort3 = await getParentPort();
|
|
150
|
+
if (parentPort3) {
|
|
151
|
+
parentPort3.off("message", onMessageWrapper);
|
|
149
152
|
} else {
|
|
150
153
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
151
154
|
}
|
|
@@ -155,12 +158,12 @@
|
|
|
155
158
|
* @param type
|
|
156
159
|
* @param payload
|
|
157
160
|
*/
|
|
158
|
-
static async postMessage(type, payload) {
|
|
161
|
+
static async postMessage(type, payload, copy = false) {
|
|
159
162
|
const data = { source: "loaders.gl", type, payload };
|
|
160
|
-
const transferList = getTransferList(payload);
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
|
|
163
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
164
|
+
const parentPort3 = await getParentPort();
|
|
165
|
+
if (parentPort3) {
|
|
166
|
+
parentPort3.postMessage(data, transferList);
|
|
164
167
|
} else {
|
|
165
168
|
globalThis.postMessage(data, transferList);
|
|
166
169
|
}
|
|
@@ -285,8 +288,19 @@
|
|
|
285
288
|
}
|
|
286
289
|
});
|
|
287
290
|
|
|
291
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
292
|
+
function validateOutputOwnership(ownership) {
|
|
293
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
294
|
+
throw new Error("Invalid worker output ownership");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
var init_validate_output_ownership = __esm({
|
|
298
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
288
302
|
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
|
|
289
|
-
async function createWorker(
|
|
303
|
+
async function createWorker(process2, processInBatches, preload) {
|
|
290
304
|
if (!await WorkerBody.inWorkerThread()) {
|
|
291
305
|
return;
|
|
292
306
|
}
|
|
@@ -327,23 +341,26 @@
|
|
|
327
341
|
}
|
|
328
342
|
switch (type) {
|
|
329
343
|
case "preload":
|
|
344
|
+
await preload?.();
|
|
330
345
|
WorkerBody.postMessage("done", {});
|
|
331
346
|
break;
|
|
332
347
|
case "process":
|
|
333
348
|
throwIfAborted();
|
|
334
|
-
|
|
349
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
350
|
+
if (!process2) {
|
|
335
351
|
throw new Error("Worker does not support atomic processing");
|
|
336
352
|
}
|
|
337
|
-
const result = await
|
|
353
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
338
354
|
throwIfAborted();
|
|
339
355
|
reporter?.finish();
|
|
340
356
|
await WorkerBody.postMessage("done", {
|
|
341
357
|
result,
|
|
342
358
|
executionMs: performance.now() - startedAt
|
|
343
|
-
});
|
|
359
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
344
360
|
break;
|
|
345
361
|
case "process-in-batches":
|
|
346
362
|
throwIfAborted();
|
|
363
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
347
364
|
if (!processInBatches) {
|
|
348
365
|
throw new Error("Worker does not support batched processing");
|
|
349
366
|
}
|
|
@@ -355,7 +372,7 @@
|
|
|
355
372
|
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
356
373
|
for await (const batch of resultIterator) {
|
|
357
374
|
throwIfAborted();
|
|
358
|
-
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
375
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
359
376
|
await outputAcknowledgements.next();
|
|
360
377
|
}
|
|
361
378
|
throwIfAborted();
|
|
@@ -453,14 +470,14 @@
|
|
|
453
470
|
});
|
|
454
471
|
}
|
|
455
472
|
function createProgressReporter() {
|
|
456
|
-
let
|
|
473
|
+
let pending2;
|
|
457
474
|
let finished = false;
|
|
458
475
|
let scheduled = false;
|
|
459
476
|
const flush = () => {
|
|
460
477
|
scheduled = false;
|
|
461
|
-
if (
|
|
462
|
-
WorkerBody.postMessage("progress", { progress:
|
|
463
|
-
|
|
478
|
+
if (pending2) {
|
|
479
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
480
|
+
pending2 = void 0;
|
|
464
481
|
}
|
|
465
482
|
};
|
|
466
483
|
return {
|
|
@@ -468,9 +485,9 @@
|
|
|
468
485
|
report(progress) {
|
|
469
486
|
if (finished)
|
|
470
487
|
return;
|
|
471
|
-
if (
|
|
488
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
472
489
|
flush();
|
|
473
|
-
|
|
490
|
+
pending2 = { ...progress };
|
|
474
491
|
if (!scheduled) {
|
|
475
492
|
scheduled = true;
|
|
476
493
|
setTimeout(flush, 0);
|
|
@@ -479,7 +496,7 @@
|
|
|
479
496
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
480
497
|
finish(discard = false) {
|
|
481
498
|
if (discard)
|
|
482
|
-
|
|
499
|
+
pending2 = void 0;
|
|
483
500
|
flush();
|
|
484
501
|
finished = true;
|
|
485
502
|
}
|
|
@@ -491,6 +508,7 @@
|
|
|
491
508
|
init_shared_state();
|
|
492
509
|
init_async_queue();
|
|
493
510
|
init_worker_body();
|
|
511
|
+
init_validate_output_ownership();
|
|
494
512
|
requestId = 0;
|
|
495
513
|
activeController = null;
|
|
496
514
|
activeInputBatches = null;
|
|
@@ -502,6 +520,7 @@
|
|
|
502
520
|
var import_meta, path, moduleUrl;
|
|
503
521
|
var init_worker_utils = __esm({
|
|
504
522
|
"../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
505
524
|
init_create_worker();
|
|
506
525
|
import_meta = {};
|
|
507
526
|
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
@@ -509,18 +528,335 @@
|
|
|
509
528
|
}
|
|
510
529
|
});
|
|
511
530
|
|
|
531
|
+
// ../../node_modules/@math.gl/core/dist/tasks/task-preload.js
|
|
532
|
+
function preloadTaskCode(task, signal) {
|
|
533
|
+
if (!task.preload)
|
|
534
|
+
return Promise.resolve();
|
|
535
|
+
let promise = pending.get(task);
|
|
536
|
+
if (!promise) {
|
|
537
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
538
|
+
loaded.add(task);
|
|
539
|
+
});
|
|
540
|
+
pending.set(task, promise);
|
|
541
|
+
void promise.catch(() => pending.delete(task));
|
|
542
|
+
}
|
|
543
|
+
return withSignal(promise, signal);
|
|
544
|
+
}
|
|
545
|
+
function withSignal(operation, signal) {
|
|
546
|
+
if (!signal)
|
|
547
|
+
return operation;
|
|
548
|
+
return new Promise((resolve, reject) => {
|
|
549
|
+
const abort = () => {
|
|
550
|
+
signal.removeEventListener("abort", abort);
|
|
551
|
+
reject(signal.reason);
|
|
552
|
+
};
|
|
553
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
554
|
+
if (signal.aborted)
|
|
555
|
+
abort();
|
|
556
|
+
operation.then((value) => {
|
|
557
|
+
signal.removeEventListener("abort", abort);
|
|
558
|
+
resolve(value);
|
|
559
|
+
}, (error) => {
|
|
560
|
+
signal.removeEventListener("abort", abort);
|
|
561
|
+
reject(error);
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
var pending, loaded;
|
|
566
|
+
var init_task_preload = __esm({
|
|
567
|
+
"../../node_modules/@math.gl/core/dist/tasks/task-preload.js"() {
|
|
568
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
569
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
// ../../node_modules/@math.gl/core/dist/tasks/task-runtime.js
|
|
574
|
+
function assertPayload(value) {
|
|
575
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
576
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function taskContext(state, context = {}) {
|
|
580
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
581
|
+
return {
|
|
582
|
+
state,
|
|
583
|
+
signal,
|
|
584
|
+
throwIfAborted: () => {
|
|
585
|
+
signal.throwIfAborted();
|
|
586
|
+
context.throwIfAborted?.();
|
|
587
|
+
},
|
|
588
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
589
|
+
...progress,
|
|
590
|
+
phase: progress.phase ?? "process",
|
|
591
|
+
unit: progress.unit ?? "items"
|
|
592
|
+
})
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
async function initializeTaskWorker(task) {
|
|
596
|
+
if (!await WorkerBody.inWorkerThread())
|
|
597
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
598
|
+
if (installed)
|
|
599
|
+
throw new Error("A task is already installed in this worker");
|
|
600
|
+
installed = true;
|
|
601
|
+
const runtime = new TaskRuntime(task);
|
|
602
|
+
let streamOptions = {};
|
|
603
|
+
return createWorker(async (request, _options, context) => {
|
|
604
|
+
switch (request.operation) {
|
|
605
|
+
case "initialize":
|
|
606
|
+
return runtime.initialize(request.input, context);
|
|
607
|
+
case "destroy":
|
|
608
|
+
return runtime.destroy();
|
|
609
|
+
case "stream-options":
|
|
610
|
+
streamOptions = request.options;
|
|
611
|
+
return {};
|
|
612
|
+
case "process":
|
|
613
|
+
return runtime.process(request.input, request.options, context);
|
|
614
|
+
default:
|
|
615
|
+
throw new Error("Unknown task operation");
|
|
616
|
+
}
|
|
617
|
+
}, async function* (inputs, _options, context) {
|
|
618
|
+
async function* batches() {
|
|
619
|
+
for await (const input of inputs) {
|
|
620
|
+
assertPayload(input);
|
|
621
|
+
yield input;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
try {
|
|
625
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
626
|
+
} finally {
|
|
627
|
+
streamOptions = {};
|
|
628
|
+
}
|
|
629
|
+
}, () => preloadTaskCode(task));
|
|
630
|
+
}
|
|
631
|
+
var TaskRuntime, installed;
|
|
632
|
+
var init_task_runtime = __esm({
|
|
633
|
+
"../../node_modules/@math.gl/core/dist/tasks/task-runtime.js"() {
|
|
634
|
+
init_worker_utils();
|
|
635
|
+
init_task_preload();
|
|
636
|
+
TaskRuntime = class {
|
|
637
|
+
constructor(task) {
|
|
638
|
+
this.task = task;
|
|
639
|
+
this.initialized = false;
|
|
640
|
+
}
|
|
641
|
+
async initialize(input, context = {}) {
|
|
642
|
+
if (this.initialized)
|
|
643
|
+
throw new Error("Task is already initialized");
|
|
644
|
+
assertPayload(input);
|
|
645
|
+
await preloadTaskCode(this.task, context.signal);
|
|
646
|
+
context.signal?.throwIfAborted();
|
|
647
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
648
|
+
this.initialized = true;
|
|
649
|
+
return {};
|
|
650
|
+
}
|
|
651
|
+
async destroy() {
|
|
652
|
+
if (this.initialized) {
|
|
653
|
+
this.initialized = false;
|
|
654
|
+
const state = this.state;
|
|
655
|
+
this.state = void 0;
|
|
656
|
+
if (this.task.initialize)
|
|
657
|
+
await this.task.destroy?.(state);
|
|
658
|
+
}
|
|
659
|
+
return {};
|
|
660
|
+
}
|
|
661
|
+
async process(input, options, context = {}) {
|
|
662
|
+
if (!this.initialized)
|
|
663
|
+
throw new Error("Task is not initialized");
|
|
664
|
+
if (!this.task.process)
|
|
665
|
+
throw new Error("Task has no atomic processor");
|
|
666
|
+
assertPayload(input);
|
|
667
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
668
|
+
assertPayload(result);
|
|
669
|
+
return result;
|
|
670
|
+
}
|
|
671
|
+
async *stream(inputs, options, context = {}) {
|
|
672
|
+
if (!this.initialized)
|
|
673
|
+
throw new Error("Task is not initialized");
|
|
674
|
+
if (!this.task.processInBatches)
|
|
675
|
+
throw new Error("Task has no streaming processor");
|
|
676
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
677
|
+
assertPayload(output);
|
|
678
|
+
yield output;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
installed = false;
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
|
|
512
686
|
// ../../node_modules/@math.gl/core/dist/tasks/index.js
|
|
513
687
|
var init_tasks = __esm({
|
|
514
688
|
"../../node_modules/@math.gl/core/dist/tasks/index.js"() {
|
|
515
|
-
|
|
689
|
+
init_task_runtime();
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
694
|
+
var worker_threads_browser_exports = {};
|
|
695
|
+
__export(worker_threads_browser_exports, {
|
|
696
|
+
NodeWorker: () => NodeWorker,
|
|
697
|
+
parentPort: () => parentPort2
|
|
698
|
+
});
|
|
699
|
+
var NodeWorker, parentPort2;
|
|
700
|
+
var init_worker_threads_browser2 = __esm({
|
|
701
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
702
|
+
"use strict";
|
|
703
|
+
NodeWorker = class {
|
|
704
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
705
|
+
constructor(...arguments_) {
|
|
706
|
+
const runtimeProcess = globalThis.process;
|
|
707
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
708
|
+
if (WorkerConstructor) {
|
|
709
|
+
return new WorkerConstructor(...arguments_);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
713
|
+
terminate() {
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
parentPort2 = null;
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
721
|
+
function normalizeTaskProgress(progress) {
|
|
722
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
723
|
+
}
|
|
724
|
+
async function isWorkerThread() {
|
|
725
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
726
|
+
return true;
|
|
727
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
728
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
729
|
+
return !isMainThread;
|
|
730
|
+
}
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
733
|
+
var initializeTaskWorker2;
|
|
734
|
+
var init_task_runtime2 = __esm({
|
|
735
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
736
|
+
"use strict";
|
|
737
|
+
init_tasks();
|
|
738
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
743
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
744
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
745
|
+
if (!object) {
|
|
746
|
+
} else if (isTransferable2(object)) {
|
|
747
|
+
transfersSet.add(object);
|
|
748
|
+
} else if (isTransferable2(object.buffer)) {
|
|
749
|
+
transfersSet.add(object.buffer);
|
|
750
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
751
|
+
} else if (recursive && typeof object === "object") {
|
|
752
|
+
for (const key in object) {
|
|
753
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
757
|
+
}
|
|
758
|
+
function isTransferable2(object) {
|
|
759
|
+
if (!object) {
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
762
|
+
if (object instanceof ArrayBuffer) {
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
765
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
769
|
+
return true;
|
|
770
|
+
}
|
|
771
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
772
|
+
return true;
|
|
773
|
+
}
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
var init_get_transfer_list2 = __esm({
|
|
777
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
778
|
+
"use strict";
|
|
516
779
|
}
|
|
517
780
|
});
|
|
518
781
|
|
|
519
782
|
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
783
|
+
async function createWorker2(process2, processInBatches) {
|
|
784
|
+
if (!await isWorkerThread()) return;
|
|
785
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
786
|
+
}
|
|
787
|
+
function createWorkerTask(process2, processInBatches) {
|
|
788
|
+
return {
|
|
789
|
+
id: "loaders.gl",
|
|
790
|
+
initialize: (state) => state,
|
|
791
|
+
destroy: (state) => state.port?.close(),
|
|
792
|
+
process: async ({ value }, options, context) => {
|
|
793
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
794
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
795
|
+
},
|
|
796
|
+
...processInBatches ? {
|
|
797
|
+
processInBatches: async function* (inputs, options, context) {
|
|
798
|
+
async function* values() {
|
|
799
|
+
for await (const input of inputs) yield input.value;
|
|
800
|
+
}
|
|
801
|
+
for await (const value of processInBatches(
|
|
802
|
+
values(),
|
|
803
|
+
options,
|
|
804
|
+
createContext(context),
|
|
805
|
+
context.state.context
|
|
806
|
+
)) {
|
|
807
|
+
yield { value };
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
} : {}
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function createContext(context) {
|
|
814
|
+
let requestIdentifier = 0;
|
|
815
|
+
const port = context.state.port;
|
|
816
|
+
return {
|
|
817
|
+
signal: context.signal,
|
|
818
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
819
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
820
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
821
|
+
context.throwIfAborted();
|
|
822
|
+
const identifier = ++requestIdentifier;
|
|
823
|
+
return new Promise((resolve, reject) => {
|
|
824
|
+
const onMessage = (event) => {
|
|
825
|
+
if (event.data.identifier !== identifier) return;
|
|
826
|
+
cleanup();
|
|
827
|
+
if (event.data.error) {
|
|
828
|
+
const error = new Error(event.data.error.message);
|
|
829
|
+
error.name = event.data.error.name;
|
|
830
|
+
reject(error);
|
|
831
|
+
} else resolve(event.data.value);
|
|
832
|
+
};
|
|
833
|
+
const onAbort = () => {
|
|
834
|
+
cleanup();
|
|
835
|
+
reject(context.signal.reason);
|
|
836
|
+
};
|
|
837
|
+
const cleanup = () => {
|
|
838
|
+
port.removeEventListener("message", onMessage);
|
|
839
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
840
|
+
};
|
|
841
|
+
port.addEventListener("message", onMessage);
|
|
842
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
843
|
+
port.start();
|
|
844
|
+
try {
|
|
845
|
+
const request = { identifier, input, options, context: jobContext };
|
|
846
|
+
port.postMessage(request, getTransferList2(request));
|
|
847
|
+
} catch (error) {
|
|
848
|
+
cleanup();
|
|
849
|
+
reject(error);
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
} : void 0
|
|
853
|
+
};
|
|
854
|
+
}
|
|
520
855
|
var init_create_worker2 = __esm({
|
|
521
856
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
522
857
|
"use strict";
|
|
523
|
-
|
|
858
|
+
init_task_runtime2();
|
|
859
|
+
init_get_transfer_list2();
|
|
524
860
|
}
|
|
525
861
|
});
|
|
526
862
|
|
|
@@ -534,7 +870,7 @@
|
|
|
534
870
|
|
|
535
871
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
536
872
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
537
|
-
await
|
|
873
|
+
await createWorker2(
|
|
538
874
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
539
875
|
selectLoader(options || {}),
|
|
540
876
|
input,
|
|
@@ -8876,11 +9212,11 @@ return true;`);
|
|
|
8876
9212
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8877
9213
|
}
|
|
8878
9214
|
setValue(index, value) {
|
|
8879
|
-
const
|
|
8880
|
-
const current =
|
|
9215
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
9216
|
+
const current = pending2.get(index);
|
|
8881
9217
|
current && (this._pendingLength -= current.length);
|
|
8882
9218
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8883
|
-
|
|
9219
|
+
pending2.set(index, value);
|
|
8884
9220
|
}
|
|
8885
9221
|
setValid(index, isValid) {
|
|
8886
9222
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8903,12 +9239,12 @@ return true;`);
|
|
|
8903
9239
|
return super.finish();
|
|
8904
9240
|
}
|
|
8905
9241
|
_flush() {
|
|
8906
|
-
const
|
|
9242
|
+
const pending2 = this._pending;
|
|
8907
9243
|
const pendingLength = this._pendingLength;
|
|
8908
9244
|
this._pendingLength = 0;
|
|
8909
9245
|
this._pending = void 0;
|
|
8910
|
-
if (
|
|
8911
|
-
this._flushPending(
|
|
9246
|
+
if (pending2 && pending2.size > 0) {
|
|
9247
|
+
this._flushPending(pending2, pendingLength);
|
|
8912
9248
|
}
|
|
8913
9249
|
return this;
|
|
8914
9250
|
}
|
|
@@ -11494,11 +11830,11 @@ return true;`);
|
|
|
11494
11830
|
setValue(index, value) {
|
|
11495
11831
|
return super.setValue(index, toUint8Array(value));
|
|
11496
11832
|
}
|
|
11497
|
-
_flushPending(
|
|
11833
|
+
_flushPending(pending2, pendingLength) {
|
|
11498
11834
|
const offsets = this._offsets;
|
|
11499
11835
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11500
11836
|
let offset = 0;
|
|
11501
|
-
for (const [index, value] of
|
|
11837
|
+
for (const [index, value] of pending2) {
|
|
11502
11838
|
if (value === void 0) {
|
|
11503
11839
|
offsets.set(index, 0);
|
|
11504
11840
|
} else {
|
|
@@ -11535,11 +11871,11 @@ return true;`);
|
|
|
11535
11871
|
setValue(index, value) {
|
|
11536
11872
|
return super.setValue(index, toUint8Array(value));
|
|
11537
11873
|
}
|
|
11538
|
-
_flushPending(
|
|
11874
|
+
_flushPending(pending2, pendingLength) {
|
|
11539
11875
|
const offsets = this._offsets;
|
|
11540
11876
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11541
11877
|
let offset = 0;
|
|
11542
|
-
for (const [index, value] of
|
|
11878
|
+
for (const [index, value] of pending2) {
|
|
11543
11879
|
if (value === void 0) {
|
|
11544
11880
|
offsets.set(index, BigInt(0));
|
|
11545
11881
|
} else {
|
|
@@ -11850,10 +12186,10 @@ return true;`);
|
|
|
11850
12186
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11851
12187
|
return this.numChildren - 1;
|
|
11852
12188
|
}
|
|
11853
|
-
_flushPending(
|
|
12189
|
+
_flushPending(pending2) {
|
|
11854
12190
|
const offsets = this._offsets;
|
|
11855
12191
|
const [child] = this.children;
|
|
11856
|
-
for (const [index, value] of
|
|
12192
|
+
for (const [index, value] of pending2) {
|
|
11857
12193
|
if (typeof value === "undefined") {
|
|
11858
12194
|
offsets.set(index, 0);
|
|
11859
12195
|
} else {
|
|
@@ -11892,10 +12228,10 @@ return true;`);
|
|
|
11892
12228
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11893
12229
|
return this.numChildren - 1;
|
|
11894
12230
|
}
|
|
11895
|
-
_flushPending(
|
|
12231
|
+
_flushPending(pending2) {
|
|
11896
12232
|
const offsets = this._offsets;
|
|
11897
12233
|
const [child] = this.children;
|
|
11898
|
-
for (const [index, value] of
|
|
12234
|
+
for (const [index, value] of pending2) {
|
|
11899
12235
|
if (typeof value === "undefined") {
|
|
11900
12236
|
offsets.set(index, BigInt(0));
|
|
11901
12237
|
} else {
|
|
@@ -11925,11 +12261,11 @@ return true;`);
|
|
|
11925
12261
|
}
|
|
11926
12262
|
setValue(index, value) {
|
|
11927
12263
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11928
|
-
const
|
|
11929
|
-
const current =
|
|
12264
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12265
|
+
const current = pending2.get(index);
|
|
11930
12266
|
current && (this._pendingLength -= current.size);
|
|
11931
12267
|
this._pendingLength += row.size;
|
|
11932
|
-
|
|
12268
|
+
pending2.set(index, row);
|
|
11933
12269
|
}
|
|
11934
12270
|
addChild(child, name = `${this.numChildren}`) {
|
|
11935
12271
|
if (this.numChildren > 0) {
|
|
@@ -11939,10 +12275,10 @@ return true;`);
|
|
|
11939
12275
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11940
12276
|
return this.numChildren - 1;
|
|
11941
12277
|
}
|
|
11942
|
-
_flushPending(
|
|
12278
|
+
_flushPending(pending2) {
|
|
11943
12279
|
const offsets = this._offsets;
|
|
11944
12280
|
const [child] = this.children;
|
|
11945
|
-
for (const [index, value] of
|
|
12281
|
+
for (const [index, value] of pending2) {
|
|
11946
12282
|
if (value === void 0) {
|
|
11947
12283
|
offsets.set(index, 0);
|
|
11948
12284
|
} else {
|
|
@@ -12151,7 +12487,7 @@ return true;`);
|
|
|
12151
12487
|
return super.setValue(index, encodeUtf8(value));
|
|
12152
12488
|
}
|
|
12153
12489
|
// @ts-ignore
|
|
12154
|
-
_flushPending(
|
|
12490
|
+
_flushPending(pending2, pendingLength) {
|
|
12155
12491
|
}
|
|
12156
12492
|
};
|
|
12157
12493
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -12182,7 +12518,7 @@ return true;`);
|
|
|
12182
12518
|
return super.setValue(index, encodeUtf8(value));
|
|
12183
12519
|
}
|
|
12184
12520
|
// @ts-ignore
|
|
12185
|
-
_flushPending(
|
|
12521
|
+
_flushPending(pending2, pendingLength) {
|
|
12186
12522
|
}
|
|
12187
12523
|
};
|
|
12188
12524
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -13894,8 +14230,8 @@ return true;`);
|
|
|
13894
14230
|
});
|
|
13895
14231
|
|
|
13896
14232
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
13897
|
-
function shouldAutoDestroy(
|
|
13898
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
14233
|
+
function shouldAutoDestroy(self2, options) {
|
|
14234
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
13899
14235
|
}
|
|
13900
14236
|
function* readAllSync(source) {
|
|
13901
14237
|
const reader = RecordBatchReader.from(source);
|
|
@@ -16978,7 +17314,7 @@ return true;`);
|
|
|
16978
17314
|
var init_dbf_loader_types = __esm({
|
|
16979
17315
|
"src/shapefile/dbf-loader-types.ts"() {
|
|
16980
17316
|
"use strict";
|
|
16981
|
-
VERSION = true ? "5.0.0-beta.
|
|
17317
|
+
VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
16982
17318
|
DBFLoader = {
|
|
16983
17319
|
name: "DBF",
|
|
16984
17320
|
dataType: null,
|