@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
|
@@ -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(value2)) {
|
|
37
37
|
if (isTransferable(value2.buffer))
|
|
38
38
|
transfersSet.add(value2.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value2 instanceof MessageChannel) {
|
|
40
|
+
visit(value2.port1);
|
|
41
|
+
visit(value2.port2);
|
|
39
42
|
} else if (recursive && value2 instanceof Map) {
|
|
40
43
|
for (const [key2, item] of value2) {
|
|
41
44
|
visit(key2);
|
|
@@ -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, preload2) {
|
|
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 preload2?.();
|
|
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(operation2, signal) {
|
|
546
|
+
if (!signal)
|
|
547
|
+
return operation2;
|
|
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
|
+
operation2.then((value2) => {
|
|
557
|
+
signal.removeEventListener("abort", abort);
|
|
558
|
+
resolve(value2);
|
|
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(value2) {
|
|
575
|
+
if (!value2 || typeof value2 !== "object" || Object.getPrototypeOf(value2) !== 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(object2, recursive = true, transfers) {
|
|
744
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
745
|
+
if (!object2) {
|
|
746
|
+
} else if (isTransferable2(object2)) {
|
|
747
|
+
transfersSet.add(object2);
|
|
748
|
+
} else if (isTransferable2(object2.buffer)) {
|
|
749
|
+
transfersSet.add(object2.buffer);
|
|
750
|
+
} else if (ArrayBuffer.isView(object2)) {
|
|
751
|
+
} else if (recursive && typeof object2 === "object") {
|
|
752
|
+
for (const key2 in object2) {
|
|
753
|
+
getTransferList2(object2[key2], recursive, transfersSet);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
757
|
+
}
|
|
758
|
+
function isTransferable2(object2) {
|
|
759
|
+
if (!object2) {
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
762
|
+
if (object2 instanceof ArrayBuffer) {
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
765
|
+
if (typeof MessagePort !== "undefined" && object2 instanceof MessagePort) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
if (typeof ImageBitmap !== "undefined" && object2 instanceof ImageBitmap) {
|
|
769
|
+
return true;
|
|
770
|
+
}
|
|
771
|
+
if (typeof OffscreenCanvas !== "undefined" && object2 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: value2 }, options, context) => {
|
|
793
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
794
|
+
return { value: await process2(value2, 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 value2 of processInBatches(
|
|
802
|
+
values(),
|
|
803
|
+
options,
|
|
804
|
+
createContext(context),
|
|
805
|
+
context.state.context
|
|
806
|
+
)) {
|
|
807
|
+
yield { value: value2 };
|
|
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,
|
|
@@ -13473,11 +13809,11 @@ return true;`);
|
|
|
13473
13809
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
13474
13810
|
}
|
|
13475
13811
|
setValue(index, value2) {
|
|
13476
|
-
const
|
|
13477
|
-
const current =
|
|
13812
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
13813
|
+
const current = pending2.get(index);
|
|
13478
13814
|
current && (this._pendingLength -= current.length);
|
|
13479
13815
|
this._pendingLength += value2 instanceof MapRow ? value2[kKeys].length : value2.length;
|
|
13480
|
-
|
|
13816
|
+
pending2.set(index, value2);
|
|
13481
13817
|
}
|
|
13482
13818
|
setValid(index, isValid) {
|
|
13483
13819
|
if (!super.setValid(index, isValid)) {
|
|
@@ -13500,12 +13836,12 @@ return true;`);
|
|
|
13500
13836
|
return super.finish();
|
|
13501
13837
|
}
|
|
13502
13838
|
_flush() {
|
|
13503
|
-
const
|
|
13839
|
+
const pending2 = this._pending;
|
|
13504
13840
|
const pendingLength = this._pendingLength;
|
|
13505
13841
|
this._pendingLength = 0;
|
|
13506
13842
|
this._pending = void 0;
|
|
13507
|
-
if (
|
|
13508
|
-
this._flushPending(
|
|
13843
|
+
if (pending2 && pending2.size > 0) {
|
|
13844
|
+
this._flushPending(pending2, pendingLength);
|
|
13509
13845
|
}
|
|
13510
13846
|
return this;
|
|
13511
13847
|
}
|
|
@@ -16091,11 +16427,11 @@ return true;`);
|
|
|
16091
16427
|
setValue(index, value2) {
|
|
16092
16428
|
return super.setValue(index, toUint8Array(value2));
|
|
16093
16429
|
}
|
|
16094
|
-
_flushPending(
|
|
16430
|
+
_flushPending(pending2, pendingLength) {
|
|
16095
16431
|
const offsets = this._offsets;
|
|
16096
16432
|
const data = this._values.reserve(pendingLength).buffer;
|
|
16097
16433
|
let offset = 0;
|
|
16098
|
-
for (const [index, value2] of
|
|
16434
|
+
for (const [index, value2] of pending2) {
|
|
16099
16435
|
if (value2 === void 0) {
|
|
16100
16436
|
offsets.set(index, 0);
|
|
16101
16437
|
} else {
|
|
@@ -16132,11 +16468,11 @@ return true;`);
|
|
|
16132
16468
|
setValue(index, value2) {
|
|
16133
16469
|
return super.setValue(index, toUint8Array(value2));
|
|
16134
16470
|
}
|
|
16135
|
-
_flushPending(
|
|
16471
|
+
_flushPending(pending2, pendingLength) {
|
|
16136
16472
|
const offsets = this._offsets;
|
|
16137
16473
|
const data = this._values.reserve(pendingLength).buffer;
|
|
16138
16474
|
let offset = 0;
|
|
16139
|
-
for (const [index, value2] of
|
|
16475
|
+
for (const [index, value2] of pending2) {
|
|
16140
16476
|
if (value2 === void 0) {
|
|
16141
16477
|
offsets.set(index, BigInt(0));
|
|
16142
16478
|
} else {
|
|
@@ -16447,10 +16783,10 @@ return true;`);
|
|
|
16447
16783
|
this.type = new List2(new Field2(name, child2.type, true));
|
|
16448
16784
|
return this.numChildren - 1;
|
|
16449
16785
|
}
|
|
16450
|
-
_flushPending(
|
|
16786
|
+
_flushPending(pending2) {
|
|
16451
16787
|
const offsets = this._offsets;
|
|
16452
16788
|
const [child2] = this.children;
|
|
16453
|
-
for (const [index, value2] of
|
|
16789
|
+
for (const [index, value2] of pending2) {
|
|
16454
16790
|
if (typeof value2 === "undefined") {
|
|
16455
16791
|
offsets.set(index, 0);
|
|
16456
16792
|
} else {
|
|
@@ -16489,10 +16825,10 @@ return true;`);
|
|
|
16489
16825
|
this.type = new LargeList2(new Field2(name, child2.type, true));
|
|
16490
16826
|
return this.numChildren - 1;
|
|
16491
16827
|
}
|
|
16492
|
-
_flushPending(
|
|
16828
|
+
_flushPending(pending2) {
|
|
16493
16829
|
const offsets = this._offsets;
|
|
16494
16830
|
const [child2] = this.children;
|
|
16495
|
-
for (const [index, value2] of
|
|
16831
|
+
for (const [index, value2] of pending2) {
|
|
16496
16832
|
if (typeof value2 === "undefined") {
|
|
16497
16833
|
offsets.set(index, BigInt(0));
|
|
16498
16834
|
} else {
|
|
@@ -16522,11 +16858,11 @@ return true;`);
|
|
|
16522
16858
|
}
|
|
16523
16859
|
setValue(index, value2) {
|
|
16524
16860
|
const row = value2 instanceof Map ? value2 : new Map(Object.entries(value2));
|
|
16525
|
-
const
|
|
16526
|
-
const current =
|
|
16861
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
16862
|
+
const current = pending2.get(index);
|
|
16527
16863
|
current && (this._pendingLength -= current.size);
|
|
16528
16864
|
this._pendingLength += row.size;
|
|
16529
|
-
|
|
16865
|
+
pending2.set(index, row);
|
|
16530
16866
|
}
|
|
16531
16867
|
addChild(child2, name = `${this.numChildren}`) {
|
|
16532
16868
|
if (this.numChildren > 0) {
|
|
@@ -16536,10 +16872,10 @@ return true;`);
|
|
|
16536
16872
|
this.type = new Map_(new Field2(name, child2.type, true), this.type.keysSorted);
|
|
16537
16873
|
return this.numChildren - 1;
|
|
16538
16874
|
}
|
|
16539
|
-
_flushPending(
|
|
16875
|
+
_flushPending(pending2) {
|
|
16540
16876
|
const offsets = this._offsets;
|
|
16541
16877
|
const [child2] = this.children;
|
|
16542
|
-
for (const [index, value2] of
|
|
16878
|
+
for (const [index, value2] of pending2) {
|
|
16543
16879
|
if (value2 === void 0) {
|
|
16544
16880
|
offsets.set(index, 0);
|
|
16545
16881
|
} else {
|
|
@@ -16748,7 +17084,7 @@ return true;`);
|
|
|
16748
17084
|
return super.setValue(index, encodeUtf8(value2));
|
|
16749
17085
|
}
|
|
16750
17086
|
// @ts-ignore
|
|
16751
|
-
_flushPending(
|
|
17087
|
+
_flushPending(pending2, pendingLength) {
|
|
16752
17088
|
}
|
|
16753
17089
|
};
|
|
16754
17090
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -16779,7 +17115,7 @@ return true;`);
|
|
|
16779
17115
|
return super.setValue(index, encodeUtf8(value2));
|
|
16780
17116
|
}
|
|
16781
17117
|
// @ts-ignore
|
|
16782
|
-
_flushPending(
|
|
17118
|
+
_flushPending(pending2, pendingLength) {
|
|
16783
17119
|
}
|
|
16784
17120
|
};
|
|
16785
17121
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -18491,8 +18827,8 @@ return true;`);
|
|
|
18491
18827
|
});
|
|
18492
18828
|
|
|
18493
18829
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
18494
|
-
function shouldAutoDestroy(
|
|
18495
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
18830
|
+
function shouldAutoDestroy(self2, options) {
|
|
18831
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
18496
18832
|
}
|
|
18497
18833
|
function* readAllSync(source) {
|
|
18498
18834
|
const reader = RecordBatchReader.from(source);
|
|
@@ -33177,7 +33513,7 @@ return true;`);
|
|
|
33177
33513
|
"src/flatgeobuf/flatgeobuf-loader-types.ts"() {
|
|
33178
33514
|
"use strict";
|
|
33179
33515
|
init_flatgeobuf_format();
|
|
33180
|
-
VERSION = true ? "5.0.0-beta.
|
|
33516
|
+
VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
33181
33517
|
FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
|
|
33182
33518
|
FlatGeobufLoader = {
|
|
33183
33519
|
...FlatGeobufFormat,
|