@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
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(tcx_loader_types_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/kml/tcx-loader-types.ts
|
|
38
38
|
var import_kml_format = require("./kml-format.cjs");
|
|
39
|
-
var VERSION = true ? "5.0.0-beta.
|
|
39
|
+
var VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
40
40
|
async function preloadTCXLoader() {
|
|
41
41
|
const { TCXLoaderWithParser } = await import("@loaders.gl/geospatial/tcx");
|
|
42
42
|
return TCXLoaderWithParser;
|
package/dist/wkt/lib/version.cjs
CHANGED
|
@@ -23,7 +23,7 @@ __export(version_exports, {
|
|
|
23
23
|
VERSION: () => VERSION
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(version_exports);
|
|
26
|
-
var VERSION = true ? "5.0.0-beta.
|
|
26
|
+
var VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
|
29
29
|
VERSION
|
package/dist/wkt/lib/version.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
export const VERSION = typeof "5.0.0-beta.
|
|
7
|
+
export const VERSION = typeof "5.0.0-beta.4" !== 'undefined' ? "5.0.0-beta.4" : 'latest';
|
|
8
8
|
//# sourceMappingURL=version.js.map
|
package/dist/wkt-worker.js
CHANGED
|
@@ -15,6 +15,33 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
19
|
+
var worker_threads_browser_exports = {};
|
|
20
|
+
__export(worker_threads_browser_exports, {
|
|
21
|
+
NodeWorker: () => NodeWorker,
|
|
22
|
+
parentPort: () => parentPort2
|
|
23
|
+
});
|
|
24
|
+
var NodeWorker, parentPort2;
|
|
25
|
+
var init_worker_threads_browser = __esm({
|
|
26
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
27
|
+
"use strict";
|
|
28
|
+
NodeWorker = class {
|
|
29
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
30
|
+
constructor(...arguments_) {
|
|
31
|
+
const runtimeProcess = globalThis.process;
|
|
32
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
33
|
+
if (WorkerConstructor) {
|
|
34
|
+
return new WorkerConstructor(...arguments_);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
38
|
+
terminate() {
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
parentPort2 = null;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
18
45
|
// ../../node_modules/@math.gl/geospatial/dist/entries/ellipsoid.js
|
|
19
46
|
var init_ellipsoid = __esm({
|
|
20
47
|
"../../node_modules/@math.gl/geospatial/dist/entries/ellipsoid.js"() {
|
|
@@ -599,7 +626,7 @@
|
|
|
599
626
|
var init_version = __esm({
|
|
600
627
|
"src/wkt/lib/version.ts"() {
|
|
601
628
|
"use strict";
|
|
602
|
-
VERSION = true ? "5.0.0-beta.
|
|
629
|
+
VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
603
630
|
}
|
|
604
631
|
});
|
|
605
632
|
|
|
@@ -778,7 +805,7 @@
|
|
|
778
805
|
});
|
|
779
806
|
|
|
780
807
|
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
781
|
-
var parentPort = null;
|
|
808
|
+
var parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
782
809
|
|
|
783
810
|
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
784
811
|
function getTransferList(object, recursive = true, transfers) {
|
|
@@ -793,6 +820,9 @@
|
|
|
793
820
|
else if (ArrayBuffer.isView(value)) {
|
|
794
821
|
if (isTransferable(value.buffer))
|
|
795
822
|
transfersSet.add(value.buffer);
|
|
823
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
824
|
+
visit(value.port1);
|
|
825
|
+
visit(value.port2);
|
|
796
826
|
} else if (recursive && value instanceof Map) {
|
|
797
827
|
for (const [key, item] of value) {
|
|
798
828
|
visit(key);
|
|
@@ -844,16 +874,16 @@
|
|
|
844
874
|
*/
|
|
845
875
|
static set onmessage(onMessage) {
|
|
846
876
|
async function handleMessage(message) {
|
|
847
|
-
const
|
|
848
|
-
const { type, payload } =
|
|
877
|
+
const parentPort3 = await getParentPort();
|
|
878
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
849
879
|
onMessage(type, payload);
|
|
850
880
|
}
|
|
851
|
-
getParentPort().then((
|
|
852
|
-
if (
|
|
853
|
-
|
|
881
|
+
getParentPort().then((parentPort3) => {
|
|
882
|
+
if (parentPort3) {
|
|
883
|
+
parentPort3.on("message", (message) => {
|
|
854
884
|
handleMessage(message);
|
|
855
885
|
});
|
|
856
|
-
|
|
886
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
857
887
|
} else {
|
|
858
888
|
globalThis.onmessage = handleMessage;
|
|
859
889
|
}
|
|
@@ -871,9 +901,9 @@
|
|
|
871
901
|
};
|
|
872
902
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
873
903
|
}
|
|
874
|
-
const
|
|
875
|
-
if (
|
|
876
|
-
|
|
904
|
+
const parentPort3 = await getParentPort();
|
|
905
|
+
if (parentPort3) {
|
|
906
|
+
parentPort3.on("message", onMessageWrapper);
|
|
877
907
|
} else {
|
|
878
908
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
879
909
|
}
|
|
@@ -884,9 +914,9 @@
|
|
|
884
914
|
if (!onMessageWrapper) {
|
|
885
915
|
return;
|
|
886
916
|
}
|
|
887
|
-
const
|
|
888
|
-
if (
|
|
889
|
-
|
|
917
|
+
const parentPort3 = await getParentPort();
|
|
918
|
+
if (parentPort3) {
|
|
919
|
+
parentPort3.off("message", onMessageWrapper);
|
|
890
920
|
} else {
|
|
891
921
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
892
922
|
}
|
|
@@ -896,12 +926,12 @@
|
|
|
896
926
|
* @param type
|
|
897
927
|
* @param payload
|
|
898
928
|
*/
|
|
899
|
-
static async postMessage(type, payload) {
|
|
929
|
+
static async postMessage(type, payload, copy = false) {
|
|
900
930
|
const data = { source: "loaders.gl", type, payload };
|
|
901
|
-
const transferList = getTransferList(payload);
|
|
902
|
-
const
|
|
903
|
-
if (
|
|
904
|
-
|
|
931
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
932
|
+
const parentPort3 = await getParentPort();
|
|
933
|
+
if (parentPort3) {
|
|
934
|
+
parentPort3.postMessage(data, transferList);
|
|
905
935
|
} else {
|
|
906
936
|
globalThis.postMessage(data, transferList);
|
|
907
937
|
}
|
|
@@ -1021,12 +1051,19 @@
|
|
|
1021
1051
|
}
|
|
1022
1052
|
};
|
|
1023
1053
|
|
|
1054
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
1055
|
+
function validateOutputOwnership(ownership) {
|
|
1056
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
1057
|
+
throw new Error("Invalid worker output ownership");
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1024
1061
|
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
|
|
1025
1062
|
var requestId = 0;
|
|
1026
1063
|
var activeController = null;
|
|
1027
1064
|
var activeInputBatches = null;
|
|
1028
1065
|
var activeOutputAcknowledgements = null;
|
|
1029
|
-
async function createWorker(
|
|
1066
|
+
async function createWorker(process2, processInBatches, preload3) {
|
|
1030
1067
|
if (!await WorkerBody.inWorkerThread()) {
|
|
1031
1068
|
return;
|
|
1032
1069
|
}
|
|
@@ -1067,23 +1104,26 @@
|
|
|
1067
1104
|
}
|
|
1068
1105
|
switch (type) {
|
|
1069
1106
|
case "preload":
|
|
1107
|
+
await preload3?.();
|
|
1070
1108
|
WorkerBody.postMessage("done", {});
|
|
1071
1109
|
break;
|
|
1072
1110
|
case "process":
|
|
1073
1111
|
throwIfAborted();
|
|
1074
|
-
|
|
1112
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
1113
|
+
if (!process2) {
|
|
1075
1114
|
throw new Error("Worker does not support atomic processing");
|
|
1076
1115
|
}
|
|
1077
|
-
const result = await
|
|
1116
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
1078
1117
|
throwIfAborted();
|
|
1079
1118
|
reporter?.finish();
|
|
1080
1119
|
await WorkerBody.postMessage("done", {
|
|
1081
1120
|
result,
|
|
1082
1121
|
executionMs: performance.now() - startedAt
|
|
1083
|
-
});
|
|
1122
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
1084
1123
|
break;
|
|
1085
1124
|
case "process-in-batches":
|
|
1086
1125
|
throwIfAborted();
|
|
1126
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
1087
1127
|
if (!processInBatches) {
|
|
1088
1128
|
throw new Error("Worker does not support batched processing");
|
|
1089
1129
|
}
|
|
@@ -1095,7 +1135,7 @@
|
|
|
1095
1135
|
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
1096
1136
|
for await (const batch of resultIterator) {
|
|
1097
1137
|
throwIfAborted();
|
|
1098
|
-
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
1138
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
1099
1139
|
await outputAcknowledgements.next();
|
|
1100
1140
|
}
|
|
1101
1141
|
throwIfAborted();
|
|
@@ -1193,14 +1233,14 @@
|
|
|
1193
1233
|
});
|
|
1194
1234
|
}
|
|
1195
1235
|
function createProgressReporter() {
|
|
1196
|
-
let
|
|
1236
|
+
let pending2;
|
|
1197
1237
|
let finished = false;
|
|
1198
1238
|
let scheduled = false;
|
|
1199
1239
|
const flush = () => {
|
|
1200
1240
|
scheduled = false;
|
|
1201
|
-
if (
|
|
1202
|
-
WorkerBody.postMessage("progress", { progress:
|
|
1203
|
-
|
|
1241
|
+
if (pending2) {
|
|
1242
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
1243
|
+
pending2 = void 0;
|
|
1204
1244
|
}
|
|
1205
1245
|
};
|
|
1206
1246
|
return {
|
|
@@ -1208,9 +1248,9 @@
|
|
|
1208
1248
|
report(progress) {
|
|
1209
1249
|
if (finished)
|
|
1210
1250
|
return;
|
|
1211
|
-
if (
|
|
1251
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
1212
1252
|
flush();
|
|
1213
|
-
|
|
1253
|
+
pending2 = { ...progress };
|
|
1214
1254
|
if (!scheduled) {
|
|
1215
1255
|
scheduled = true;
|
|
1216
1256
|
setTimeout(flush, 0);
|
|
@@ -1219,7 +1259,7 @@
|
|
|
1219
1259
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
1220
1260
|
finish(discard = false) {
|
|
1221
1261
|
if (discard)
|
|
1222
|
-
|
|
1262
|
+
pending2 = void 0;
|
|
1223
1263
|
flush();
|
|
1224
1264
|
finished = true;
|
|
1225
1265
|
}
|
|
@@ -1231,9 +1271,276 @@
|
|
|
1231
1271
|
var path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
1232
1272
|
var moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
1233
1273
|
|
|
1274
|
+
// ../../node_modules/@math.gl/core/dist/tasks/task-preload.js
|
|
1275
|
+
var pending = /* @__PURE__ */ new WeakMap();
|
|
1276
|
+
var loaded = /* @__PURE__ */ new WeakSet();
|
|
1277
|
+
function preloadTaskCode(task, signal) {
|
|
1278
|
+
if (!task.preload)
|
|
1279
|
+
return Promise.resolve();
|
|
1280
|
+
let promise = pending.get(task);
|
|
1281
|
+
if (!promise) {
|
|
1282
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
1283
|
+
loaded.add(task);
|
|
1284
|
+
});
|
|
1285
|
+
pending.set(task, promise);
|
|
1286
|
+
void promise.catch(() => pending.delete(task));
|
|
1287
|
+
}
|
|
1288
|
+
return withSignal(promise, signal);
|
|
1289
|
+
}
|
|
1290
|
+
function withSignal(operation, signal) {
|
|
1291
|
+
if (!signal)
|
|
1292
|
+
return operation;
|
|
1293
|
+
return new Promise((resolve, reject) => {
|
|
1294
|
+
const abort = () => {
|
|
1295
|
+
signal.removeEventListener("abort", abort);
|
|
1296
|
+
reject(signal.reason);
|
|
1297
|
+
};
|
|
1298
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
1299
|
+
if (signal.aborted)
|
|
1300
|
+
abort();
|
|
1301
|
+
operation.then((value) => {
|
|
1302
|
+
signal.removeEventListener("abort", abort);
|
|
1303
|
+
resolve(value);
|
|
1304
|
+
}, (error) => {
|
|
1305
|
+
signal.removeEventListener("abort", abort);
|
|
1306
|
+
reject(error);
|
|
1307
|
+
});
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// ../../node_modules/@math.gl/core/dist/tasks/task-runtime.js
|
|
1312
|
+
function assertPayload(value) {
|
|
1313
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
1314
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
function taskContext(state, context = {}) {
|
|
1318
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
1319
|
+
return {
|
|
1320
|
+
state,
|
|
1321
|
+
signal,
|
|
1322
|
+
throwIfAborted: () => {
|
|
1323
|
+
signal.throwIfAborted();
|
|
1324
|
+
context.throwIfAborted?.();
|
|
1325
|
+
},
|
|
1326
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
1327
|
+
...progress,
|
|
1328
|
+
phase: progress.phase ?? "process",
|
|
1329
|
+
unit: progress.unit ?? "items"
|
|
1330
|
+
})
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
var TaskRuntime = class {
|
|
1334
|
+
constructor(task) {
|
|
1335
|
+
this.task = task;
|
|
1336
|
+
this.initialized = false;
|
|
1337
|
+
}
|
|
1338
|
+
async initialize(input, context = {}) {
|
|
1339
|
+
if (this.initialized)
|
|
1340
|
+
throw new Error("Task is already initialized");
|
|
1341
|
+
assertPayload(input);
|
|
1342
|
+
await preloadTaskCode(this.task, context.signal);
|
|
1343
|
+
context.signal?.throwIfAborted();
|
|
1344
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
1345
|
+
this.initialized = true;
|
|
1346
|
+
return {};
|
|
1347
|
+
}
|
|
1348
|
+
async destroy() {
|
|
1349
|
+
if (this.initialized) {
|
|
1350
|
+
this.initialized = false;
|
|
1351
|
+
const state = this.state;
|
|
1352
|
+
this.state = void 0;
|
|
1353
|
+
if (this.task.initialize)
|
|
1354
|
+
await this.task.destroy?.(state);
|
|
1355
|
+
}
|
|
1356
|
+
return {};
|
|
1357
|
+
}
|
|
1358
|
+
async process(input, options, context = {}) {
|
|
1359
|
+
if (!this.initialized)
|
|
1360
|
+
throw new Error("Task is not initialized");
|
|
1361
|
+
if (!this.task.process)
|
|
1362
|
+
throw new Error("Task has no atomic processor");
|
|
1363
|
+
assertPayload(input);
|
|
1364
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
1365
|
+
assertPayload(result);
|
|
1366
|
+
return result;
|
|
1367
|
+
}
|
|
1368
|
+
async *stream(inputs, options, context = {}) {
|
|
1369
|
+
if (!this.initialized)
|
|
1370
|
+
throw new Error("Task is not initialized");
|
|
1371
|
+
if (!this.task.processInBatches)
|
|
1372
|
+
throw new Error("Task has no streaming processor");
|
|
1373
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
1374
|
+
assertPayload(output);
|
|
1375
|
+
yield output;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
async function initializeTaskWorker(task) {
|
|
1380
|
+
if (!await WorkerBody.inWorkerThread())
|
|
1381
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
1382
|
+
if (installed)
|
|
1383
|
+
throw new Error("A task is already installed in this worker");
|
|
1384
|
+
installed = true;
|
|
1385
|
+
const runtime = new TaskRuntime(task);
|
|
1386
|
+
let streamOptions = {};
|
|
1387
|
+
return createWorker(async (request, _options, context) => {
|
|
1388
|
+
switch (request.operation) {
|
|
1389
|
+
case "initialize":
|
|
1390
|
+
return runtime.initialize(request.input, context);
|
|
1391
|
+
case "destroy":
|
|
1392
|
+
return runtime.destroy();
|
|
1393
|
+
case "stream-options":
|
|
1394
|
+
streamOptions = request.options;
|
|
1395
|
+
return {};
|
|
1396
|
+
case "process":
|
|
1397
|
+
return runtime.process(request.input, request.options, context);
|
|
1398
|
+
default:
|
|
1399
|
+
throw new Error("Unknown task operation");
|
|
1400
|
+
}
|
|
1401
|
+
}, async function* (inputs, _options, context) {
|
|
1402
|
+
async function* batches() {
|
|
1403
|
+
for await (const input of inputs) {
|
|
1404
|
+
assertPayload(input);
|
|
1405
|
+
yield input;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
try {
|
|
1409
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
1410
|
+
} finally {
|
|
1411
|
+
streamOptions = {};
|
|
1412
|
+
}
|
|
1413
|
+
}, () => preloadTaskCode(task));
|
|
1414
|
+
}
|
|
1415
|
+
var installed = false;
|
|
1416
|
+
|
|
1417
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
1418
|
+
function normalizeTaskProgress(progress) {
|
|
1419
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
1420
|
+
}
|
|
1421
|
+
async function isWorkerThread() {
|
|
1422
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
1423
|
+
return true;
|
|
1424
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
1425
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser(), worker_threads_browser_exports));
|
|
1426
|
+
return !isMainThread;
|
|
1427
|
+
}
|
|
1428
|
+
return false;
|
|
1429
|
+
}
|
|
1430
|
+
var initializeTaskWorker2 = initializeTaskWorker;
|
|
1431
|
+
|
|
1432
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
1433
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
1434
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
1435
|
+
if (!object) {
|
|
1436
|
+
} else if (isTransferable2(object)) {
|
|
1437
|
+
transfersSet.add(object);
|
|
1438
|
+
} else if (isTransferable2(object.buffer)) {
|
|
1439
|
+
transfersSet.add(object.buffer);
|
|
1440
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
1441
|
+
} else if (recursive && typeof object === "object") {
|
|
1442
|
+
for (const key in object) {
|
|
1443
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
1447
|
+
}
|
|
1448
|
+
function isTransferable2(object) {
|
|
1449
|
+
if (!object) {
|
|
1450
|
+
return false;
|
|
1451
|
+
}
|
|
1452
|
+
if (object instanceof ArrayBuffer) {
|
|
1453
|
+
return true;
|
|
1454
|
+
}
|
|
1455
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
1456
|
+
return true;
|
|
1457
|
+
}
|
|
1458
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
1459
|
+
return true;
|
|
1460
|
+
}
|
|
1461
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
1462
|
+
return true;
|
|
1463
|
+
}
|
|
1464
|
+
return false;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
1468
|
+
async function createWorker2(process2, processInBatches) {
|
|
1469
|
+
if (!await isWorkerThread()) return;
|
|
1470
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
1471
|
+
}
|
|
1472
|
+
function createWorkerTask(process2, processInBatches) {
|
|
1473
|
+
return {
|
|
1474
|
+
id: "loaders.gl",
|
|
1475
|
+
initialize: (state) => state,
|
|
1476
|
+
destroy: (state) => state.port?.close(),
|
|
1477
|
+
process: async ({ value }, options, context) => {
|
|
1478
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
1479
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
1480
|
+
},
|
|
1481
|
+
...processInBatches ? {
|
|
1482
|
+
processInBatches: async function* (inputs, options, context) {
|
|
1483
|
+
async function* values() {
|
|
1484
|
+
for await (const input of inputs) yield input.value;
|
|
1485
|
+
}
|
|
1486
|
+
for await (const value of processInBatches(
|
|
1487
|
+
values(),
|
|
1488
|
+
options,
|
|
1489
|
+
createContext(context),
|
|
1490
|
+
context.state.context
|
|
1491
|
+
)) {
|
|
1492
|
+
yield { value };
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
} : {}
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
function createContext(context) {
|
|
1499
|
+
let requestIdentifier = 0;
|
|
1500
|
+
const port = context.state.port;
|
|
1501
|
+
return {
|
|
1502
|
+
signal: context.signal,
|
|
1503
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
1504
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
1505
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
1506
|
+
context.throwIfAborted();
|
|
1507
|
+
const identifier = ++requestIdentifier;
|
|
1508
|
+
return new Promise((resolve, reject) => {
|
|
1509
|
+
const onMessage = (event) => {
|
|
1510
|
+
if (event.data.identifier !== identifier) return;
|
|
1511
|
+
cleanup();
|
|
1512
|
+
if (event.data.error) {
|
|
1513
|
+
const error = new Error(event.data.error.message);
|
|
1514
|
+
error.name = event.data.error.name;
|
|
1515
|
+
reject(error);
|
|
1516
|
+
} else resolve(event.data.value);
|
|
1517
|
+
};
|
|
1518
|
+
const onAbort = () => {
|
|
1519
|
+
cleanup();
|
|
1520
|
+
reject(context.signal.reason);
|
|
1521
|
+
};
|
|
1522
|
+
const cleanup = () => {
|
|
1523
|
+
port.removeEventListener("message", onMessage);
|
|
1524
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
1525
|
+
};
|
|
1526
|
+
port.addEventListener("message", onMessage);
|
|
1527
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
1528
|
+
port.start();
|
|
1529
|
+
try {
|
|
1530
|
+
const request = { identifier, input, options, context: jobContext };
|
|
1531
|
+
port.postMessage(request, getTransferList2(request));
|
|
1532
|
+
} catch (error) {
|
|
1533
|
+
cleanup();
|
|
1534
|
+
reject(error);
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
} : void 0
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1234
1541
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
1235
1542
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
1236
|
-
await
|
|
1543
|
+
await createWorker2(
|
|
1237
1544
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
1238
1545
|
selectLoader(options || {}),
|
|
1239
1546
|
input,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/geospatial",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.4",
|
|
4
4
|
"description": "Geospatial loaders and writers for vector files and geometry encodings",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -375,9 +375,9 @@
|
|
|
375
375
|
"build-worker-shapefile": "node ../../scripts/build-codec-worker.mjs src/workers/shapefile-worker.ts --bundle --outfile=dist/shapefile-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
376
376
|
},
|
|
377
377
|
"dependencies": {
|
|
378
|
-
"@loaders.gl/archives": "5.0.0-beta.
|
|
379
|
-
"@loaders.gl/documents": "5.0.0-beta.
|
|
380
|
-
"@math.gl/geospatial": "5.0.0-beta.
|
|
378
|
+
"@loaders.gl/archives": "5.0.0-beta.4",
|
|
379
|
+
"@loaders.gl/documents": "5.0.0-beta.4",
|
|
380
|
+
"@math.gl/geospatial": "5.0.0-beta.4",
|
|
381
381
|
"@types/sql.js": "^1.4.5",
|
|
382
382
|
"apache-arrow": ">= 17.0.0"
|
|
383
383
|
},
|
|
@@ -418,5 +418,5 @@
|
|
|
418
418
|
"fgb",
|
|
419
419
|
"gpkg"
|
|
420
420
|
],
|
|
421
|
-
"gitHead": "
|
|
421
|
+
"gitHead": "c9420f06e870fa353889d55b684e3588d24574c2"
|
|
422
422
|
}
|