@loaders.gl/i3s 4.0.1 → 4.0.3

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.
@@ -92,7 +92,7 @@
92
92
  }
93
93
 
94
94
  // ../worker-utils/src/lib/env-utils/version.ts
95
- var NPM_TAG = "beta";
95
+ var NPM_TAG = "latest";
96
96
  function getVersion() {
97
97
  if (!globalThis._loadersgl_?.version) {
98
98
  globalThis._loadersgl_ = globalThis._loadersgl_ || {};
@@ -102,7 +102,7 @@
102
102
  );
103
103
  globalThis._loadersgl_.version = NPM_TAG;
104
104
  } else {
105
- globalThis._loadersgl_.version = "4.0.1";
105
+ globalThis._loadersgl_.version = "4.0.3";
106
106
  }
107
107
  }
108
108
  return globalThis._loadersgl_.version;
@@ -602,61 +602,69 @@
602
602
  __publicField(WorkerFarm, "_workerFarm");
603
603
 
604
604
  // ../worker-utils/src/lib/worker-farm/worker-body.ts
605
- function getParentPort() {
605
+ async function getParentPort() {
606
606
  let parentPort;
607
607
  try {
608
608
  eval("globalThis.parentPort = require('worker_threads').parentPort");
609
609
  parentPort = globalThis.parentPort;
610
610
  } catch {
611
+ try {
612
+ eval("globalThis.workerThreadsPromise = import('worker_threads')");
613
+ const workerThreads = await globalThis.workerThreadsPromise;
614
+ parentPort = workerThreads.parentPort;
615
+ } catch (error) {
616
+ console.error(error.message);
617
+ }
611
618
  }
612
619
  return parentPort;
613
620
  }
614
621
  var onMessageWrapperMap = /* @__PURE__ */ new Map();
615
622
  var WorkerBody = class {
616
623
  /** Check that we are actually in a worker thread */
617
- static inWorkerThread() {
618
- return typeof self !== "undefined" || Boolean(getParentPort());
624
+ static async inWorkerThread() {
625
+ return typeof self !== "undefined" || Boolean(await getParentPort());
619
626
  }
620
627
  /*
621
628
  * (type: WorkerMessageType, payload: WorkerMessagePayload) => any
622
629
  */
623
630
  static set onmessage(onMessage2) {
624
- function handleMessage(message) {
625
- const parentPort3 = getParentPort();
626
- const { type, payload } = parentPort3 ? message : message.data;
631
+ async function handleMessage(message) {
632
+ const parentPort2 = await getParentPort();
633
+ const { type, payload } = parentPort2 ? message : message.data;
627
634
  onMessage2(type, payload);
628
635
  }
629
- const parentPort2 = getParentPort();
630
- if (parentPort2) {
631
- parentPort2.on("message", handleMessage);
632
- parentPort2.on("exit", () => console.debug("Node worker closing"));
633
- } else {
634
- globalThis.onmessage = handleMessage;
635
- }
636
+ getParentPort().then((parentPort2) => {
637
+ if (parentPort2) {
638
+ parentPort2.on("message", handleMessage);
639
+ parentPort2.on("exit", () => console.debug("Node worker closing"));
640
+ } else {
641
+ globalThis.onmessage = handleMessage;
642
+ }
643
+ });
636
644
  }
637
- static addEventListener(onMessage2) {
645
+ static async addEventListener(onMessage2) {
638
646
  let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
639
647
  if (!onMessageWrapper) {
640
- onMessageWrapper = (message) => {
648
+ onMessageWrapper = async (message) => {
641
649
  if (!isKnownMessage(message)) {
642
650
  return;
643
651
  }
644
- const parentPort3 = getParentPort();
652
+ const parentPort3 = await getParentPort();
645
653
  const { type, payload } = parentPort3 ? message : message.data;
646
654
  onMessage2(type, payload);
647
655
  };
648
656
  }
649
- const parentPort2 = getParentPort();
657
+ const parentPort2 = await getParentPort();
650
658
  if (parentPort2) {
651
659
  console.error("not implemented");
652
660
  } else {
653
661
  globalThis.addEventListener("message", onMessageWrapper);
654
662
  }
655
663
  }
656
- static removeEventListener(onMessage2) {
664
+ static async removeEventListener(onMessage2) {
657
665
  const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
658
666
  onMessageWrapperMap.delete(onMessage2);
659
- const parentPort2 = getParentPort();
667
+ const parentPort2 = await getParentPort();
660
668
  if (parentPort2) {
661
669
  console.error("not implemented");
662
670
  } else {
@@ -668,10 +676,10 @@
668
676
  * @param type
669
677
  * @param payload
670
678
  */
671
- static postMessage(type, payload) {
679
+ static async postMessage(type, payload) {
672
680
  const data = { source: "loaders.gl", type, payload };
673
681
  const transferList = getTransferList(payload);
674
- const parentPort2 = getParentPort();
682
+ const parentPort2 = await getParentPort();
675
683
  if (parentPort2) {
676
684
  parentPort2.postMessage(data, transferList);
677
685
  } else {
@@ -693,7 +701,11 @@
693
701
  url = options.workerUrl;
694
702
  }
695
703
  if (options._workerType === "test") {
696
- url = `modules/${worker.module}/dist/${workerFile}`;
704
+ if (isBrowser2) {
705
+ url = `modules/${worker.module}/dist/${workerFile}`;
706
+ } else {
707
+ url = `modules/${worker.module}/src/workers/${worker.id}-worker-node.ts`;
708
+ }
697
709
  }
698
710
  if (!url) {
699
711
  let version = worker.version;
@@ -802,8 +814,8 @@
802
814
 
803
815
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
804
816
  var requestId = 0;
805
- function createLoaderWorker(loader) {
806
- if (!WorkerBody.inWorkerThread()) {
817
+ async function createLoaderWorker(loader) {
818
+ if (!await WorkerBody.inWorkerThread()) {
807
819
  return;
808
820
  }
809
821
  WorkerBody.onmessage = async (type, payload) => {
@@ -1435,7 +1447,7 @@
1435
1447
  var navigator_ = globalThis.navigator || {};
1436
1448
 
1437
1449
  // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
1438
- var VERSION2 = true ? "4.0.1" : "untranspiled source";
1450
+ var VERSION2 = true ? "4.0.3" : "untranspiled source";
1439
1451
  var isBrowser4 = isBrowser3();
1440
1452
 
1441
1453
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
@@ -2598,6 +2610,83 @@
2598
2610
  throw new Error(`${loader.id} loader - no parser found and worker is disabled`);
2599
2611
  }
2600
2612
 
2613
+ // ../schema/src/lib/table/simple-table/data-type.ts
2614
+ function getDataTypeFromTypedArray(array) {
2615
+ switch (array.constructor) {
2616
+ case Int8Array:
2617
+ return "int8";
2618
+ case Uint8Array:
2619
+ case Uint8ClampedArray:
2620
+ return "uint8";
2621
+ case Int16Array:
2622
+ return "int16";
2623
+ case Uint16Array:
2624
+ return "uint16";
2625
+ case Int32Array:
2626
+ return "int32";
2627
+ case Uint32Array:
2628
+ return "uint32";
2629
+ case Float32Array:
2630
+ return "float32";
2631
+ case Float64Array:
2632
+ return "float64";
2633
+ default:
2634
+ return "null";
2635
+ }
2636
+ }
2637
+
2638
+ // ../schema/src/lib/mesh/mesh-utils.ts
2639
+ function getMeshBoundingBox(attributes) {
2640
+ let minX = Infinity;
2641
+ let minY = Infinity;
2642
+ let minZ = Infinity;
2643
+ let maxX = -Infinity;
2644
+ let maxY = -Infinity;
2645
+ let maxZ = -Infinity;
2646
+ const positions = attributes.POSITION ? attributes.POSITION.value : [];
2647
+ const len2 = positions && positions.length;
2648
+ for (let i2 = 0; i2 < len2; i2 += 3) {
2649
+ const x = positions[i2];
2650
+ const y = positions[i2 + 1];
2651
+ const z = positions[i2 + 2];
2652
+ minX = x < minX ? x : minX;
2653
+ minY = y < minY ? y : minY;
2654
+ minZ = z < minZ ? z : minZ;
2655
+ maxX = x > maxX ? x : maxX;
2656
+ maxY = y > maxY ? y : maxY;
2657
+ maxZ = z > maxZ ? z : maxZ;
2658
+ }
2659
+ return [
2660
+ [minX, minY, minZ],
2661
+ [maxX, maxY, maxZ]
2662
+ ];
2663
+ }
2664
+
2665
+ // ../schema/src/lib/mesh/deduce-mesh-schema.ts
2666
+ function deduceMeshField(name, attribute, optionalMetadata) {
2667
+ const type = getDataTypeFromTypedArray(attribute.value);
2668
+ const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
2669
+ return {
2670
+ name,
2671
+ type: { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] },
2672
+ nullable: false,
2673
+ metadata
2674
+ };
2675
+ }
2676
+ function makeMeshAttributeMetadata(attribute) {
2677
+ const result = {};
2678
+ if ("byteOffset" in attribute) {
2679
+ result.byteOffset = attribute.byteOffset.toString(10);
2680
+ }
2681
+ if ("byteStride" in attribute) {
2682
+ result.byteStride = attribute.byteStride.toString(10);
2683
+ }
2684
+ if ("normalized" in attribute) {
2685
+ result.normalized = attribute.normalized.toString();
2686
+ }
2687
+ return result;
2688
+ }
2689
+
2601
2690
  // ../core/src/lib/api/load.ts
2602
2691
  async function load(url, loaders, options, context) {
2603
2692
  let resolvedLoaders;
@@ -5226,7 +5315,7 @@
5226
5315
  _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
5227
5316
 
5228
5317
  // ../images/src/lib/utils/version.ts
5229
- var VERSION3 = true ? "4.0.1" : "latest";
5318
+ var VERSION3 = true ? "4.0.3" : "latest";
5230
5319
 
5231
5320
  // ../images/src/lib/category-api/image-type.ts
5232
5321
  var parseImageNode = globalThis.loaders?.parseImageNode;
@@ -5353,7 +5442,10 @@
5353
5442
  return await new Promise((resolve2, reject) => {
5354
5443
  try {
5355
5444
  image.onload = () => resolve2(image);
5356
- image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));
5445
+ image.onerror = (error) => {
5446
+ const message = error instanceof Error ? error.message : "error";
5447
+ reject(new Error(message));
5448
+ };
5357
5449
  } catch (error) {
5358
5450
  reject(error);
5359
5451
  }
@@ -5629,7 +5721,7 @@
5629
5721
  };
5630
5722
 
5631
5723
  // ../draco/src/lib/utils/version.ts
5632
- var VERSION4 = true ? "4.0.1" : "latest";
5724
+ var VERSION4 = true ? "4.0.3" : "latest";
5633
5725
 
5634
5726
  // ../draco/src/draco-loader.ts
5635
5727
  var DEFAULT_DRACO_OPTIONS = {
@@ -5655,83 +5747,6 @@
5655
5747
  options: DEFAULT_DRACO_OPTIONS
5656
5748
  };
5657
5749
 
5658
- // ../schema/src/lib/table/simple-table/data-type.ts
5659
- function getDataTypeFromTypedArray(array) {
5660
- switch (array.constructor) {
5661
- case Int8Array:
5662
- return "int8";
5663
- case Uint8Array:
5664
- case Uint8ClampedArray:
5665
- return "uint8";
5666
- case Int16Array:
5667
- return "int16";
5668
- case Uint16Array:
5669
- return "uint16";
5670
- case Int32Array:
5671
- return "int32";
5672
- case Uint32Array:
5673
- return "uint32";
5674
- case Float32Array:
5675
- return "float32";
5676
- case Float64Array:
5677
- return "float64";
5678
- default:
5679
- return "null";
5680
- }
5681
- }
5682
-
5683
- // ../schema/src/lib/mesh/mesh-utils.ts
5684
- function getMeshBoundingBox(attributes) {
5685
- let minX = Infinity;
5686
- let minY = Infinity;
5687
- let minZ = Infinity;
5688
- let maxX = -Infinity;
5689
- let maxY = -Infinity;
5690
- let maxZ = -Infinity;
5691
- const positions = attributes.POSITION ? attributes.POSITION.value : [];
5692
- const len2 = positions && positions.length;
5693
- for (let i2 = 0; i2 < len2; i2 += 3) {
5694
- const x = positions[i2];
5695
- const y = positions[i2 + 1];
5696
- const z = positions[i2 + 2];
5697
- minX = x < minX ? x : minX;
5698
- minY = y < minY ? y : minY;
5699
- minZ = z < minZ ? z : minZ;
5700
- maxX = x > maxX ? x : maxX;
5701
- maxY = y > maxY ? y : maxY;
5702
- maxZ = z > maxZ ? z : maxZ;
5703
- }
5704
- return [
5705
- [minX, minY, minZ],
5706
- [maxX, maxY, maxZ]
5707
- ];
5708
- }
5709
-
5710
- // ../schema/src/lib/mesh/deduce-mesh-schema.ts
5711
- function deduceMeshField(name, attribute, optionalMetadata) {
5712
- const type = getDataTypeFromTypedArray(attribute.value);
5713
- const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
5714
- return {
5715
- name,
5716
- type: { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] },
5717
- nullable: false,
5718
- metadata
5719
- };
5720
- }
5721
- function makeMeshAttributeMetadata(attribute) {
5722
- const result = {};
5723
- if ("byteOffset" in attribute) {
5724
- result.byteOffset = attribute.byteOffset.toString(10);
5725
- }
5726
- if ("byteStride" in attribute) {
5727
- result.byteStride = attribute.byteStride.toString(10);
5728
- }
5729
- if ("normalized" in attribute) {
5730
- result.normalized = attribute.normalized.toString();
5731
- }
5732
- return result;
5733
- }
5734
-
5735
5750
  // ../draco/src/lib/utils/get-draco-schema.ts
5736
5751
  function getDracoSchema(attributes, loaderData, indices) {
5737
5752
  const metadata = makeMetadata(loaderData.metadata);
@@ -6310,7 +6325,7 @@
6310
6325
  }
6311
6326
 
6312
6327
  // ../textures/src/lib/utils/version.ts
6313
- var VERSION5 = true ? "4.0.1" : "beta";
6328
+ var VERSION5 = true ? "4.0.3" : "latest";
6314
6329
 
6315
6330
  // ../textures/src/lib/parsers/basis-module-loader.ts
6316
6331
  var BASIS_EXTERNAL_LIBRARIES = {
@@ -7838,7 +7853,7 @@
7838
7853
  }
7839
7854
 
7840
7855
  // src/i3s-content-loader.ts
7841
- var VERSION6 = true ? "4.0.1" : "beta";
7856
+ var VERSION6 = true ? "4.0.3" : "latest";
7842
7857
  var I3SContentLoader = {
7843
7858
  name: "I3S Content (Indexed Scene Layers)",
7844
7859
  id: "i3s-content",
package/dist/index.cjs CHANGED
@@ -533,7 +533,7 @@ function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
533
533
  }
534
534
 
535
535
  // src/i3s-content-loader.ts
536
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
536
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
537
537
  var I3SContentLoader = {
538
538
  name: "I3S Content (Indexed Scene Layers)",
539
539
  id: "i3s-content",
@@ -1387,7 +1387,7 @@ function parseSublayersTree(sublayers, url) {
1387
1387
  }
1388
1388
 
1389
1389
  // src/i3s-building-scene-layer-loader.ts
1390
- var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
1390
+ var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
1391
1391
  var I3SBuildingSceneLayerLoader = {
1392
1392
  name: "I3S Building Scene Layer",
1393
1393
  id: "i3s-building-scene-layer",
@@ -1471,7 +1471,7 @@ async function checkSupportedIndexCRS(layer) {
1471
1471
  }
1472
1472
 
1473
1473
  // src/arcgis-webscene-loader.ts
1474
- var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
1474
+ var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
1475
1475
  var ArcGISWebSceneLoader = {
1476
1476
  name: "ArcGIS Web Scene Loader",
1477
1477
  id: "arcgis-web-scene",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/i3s",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "i3s .",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,20 +41,20 @@
41
41
  "build-worker-node": "esbuild src/workers/i3s-content-worker-node.ts --outfile=dist/i3s-content-worker-node.js --platform=node --target=node16 --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
42
42
  },
43
43
  "dependencies": {
44
- "@loaders.gl/compression": "4.0.1",
45
- "@loaders.gl/crypto": "4.0.1",
46
- "@loaders.gl/draco": "4.0.1",
47
- "@loaders.gl/images": "4.0.1",
48
- "@loaders.gl/loader-utils": "4.0.1",
49
- "@loaders.gl/schema": "4.0.1",
50
- "@loaders.gl/textures": "4.0.1",
51
- "@loaders.gl/tiles": "4.0.1",
44
+ "@loaders.gl/compression": "4.0.3",
45
+ "@loaders.gl/crypto": "4.0.3",
46
+ "@loaders.gl/draco": "4.0.3",
47
+ "@loaders.gl/images": "4.0.3",
48
+ "@loaders.gl/loader-utils": "4.0.3",
49
+ "@loaders.gl/schema": "4.0.3",
50
+ "@loaders.gl/textures": "4.0.3",
51
+ "@loaders.gl/tiles": "4.0.3",
52
52
  "@math.gl/core": "^4.0.0",
53
53
  "@math.gl/culling": "^4.0.0",
54
54
  "@math.gl/geospatial": "^4.0.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@loaders.gl/core": "4.0.0-beta.8"
57
+ "@loaders.gl/core": "^4.0.0"
58
58
  },
59
- "gitHead": "765e5a26a6bf3f2cc02cabffc4a1e3665ec92a53"
59
+ "gitHead": "03c871839b36c997249dabae1844df53a35d3760"
60
60
  }
@@ -5,7 +5,7 @@ import {parseWebscene} from './lib/parsers/parse-arcgis-webscene';
5
5
 
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
8
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
9
9
 
10
10
  export type ArcGISWebSceneLoaderOptions = LoaderOptions & {};
11
11
 
@@ -7,7 +7,7 @@ import {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-la
7
7
  // __VERSION__ is injected by babel-plugin-version-inline
8
8
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
9
9
 
10
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
10
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
11
11
  /**
12
12
  * Loader for I3S - Building Scene Layer
13
13
  */
@@ -6,7 +6,7 @@ import {I3STileContent, I3STileOptions, I3STilesetOptions} from './types';
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
8
 
9
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
9
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
10
10
 
11
11
  /**
12
12
  * Loader for I3S - Indexed 3D Scene Layer