@loaders.gl/textures 4.0.0-alpha.9 → 4.0.0-beta.2

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.
Files changed (121) hide show
  1. package/dist/basis-worker-node.js +392 -340
  2. package/dist/basis-worker.js +66 -38
  3. package/dist/compressed-texture-loader.d.ts +2 -35
  4. package/dist/compressed-texture-loader.d.ts.map +1 -1
  5. package/dist/compressed-texture-worker.js +75 -47
  6. package/dist/crunch-loader.d.ts +9 -17
  7. package/dist/crunch-loader.d.ts.map +1 -1
  8. package/dist/crunch-worker.js +53 -25
  9. package/dist/dist.min.js +99 -55
  10. package/dist/es5/compressed-texture-loader.js +15 -17
  11. package/dist/es5/compressed-texture-loader.js.map +1 -1
  12. package/dist/es5/crunch-loader.js +1 -3
  13. package/dist/es5/crunch-loader.js.map +1 -1
  14. package/dist/es5/index.js +14 -0
  15. package/dist/es5/index.js.map +1 -1
  16. package/dist/es5/ktx2-basis-writer.js +5 -5
  17. package/dist/es5/ktx2-basis-writer.js.map +1 -1
  18. package/dist/es5/lib/encoders/encode-ktx2-basis-texture.js +6 -5
  19. package/dist/es5/lib/encoders/encode-ktx2-basis-texture.js.map +1 -1
  20. package/dist/es5/lib/parsers/basis-module-loader.js +26 -21
  21. package/dist/es5/lib/parsers/basis-module-loader.js.map +1 -1
  22. package/dist/es5/lib/parsers/crunch-module-loader.js +6 -1
  23. package/dist/es5/lib/parsers/crunch-module-loader.js.map +1 -1
  24. package/dist/es5/lib/parsers/parse-basis.js +7 -7
  25. package/dist/es5/lib/parsers/parse-basis.js.map +1 -1
  26. package/dist/es5/lib/texture-api/deep-load.js.map +1 -1
  27. package/dist/es5/lib/utils/version.js +1 -1
  28. package/dist/es5/lib/utils/version.js.map +1 -1
  29. package/dist/es5/workers/compressed-texture-worker.js.map +1 -1
  30. package/dist/es5/workers/ktx2-basis-writer-worker-node.js.map +1 -1
  31. package/dist/es5/workers/ktx2-basis-writer-worker.js.map +1 -1
  32. package/dist/esm/compressed-texture-loader.js +10 -11
  33. package/dist/esm/compressed-texture-loader.js.map +1 -1
  34. package/dist/esm/crunch-loader.js +0 -1
  35. package/dist/esm/crunch-loader.js.map +1 -1
  36. package/dist/esm/index.js +2 -0
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/ktx2-basis-writer.js +6 -5
  39. package/dist/esm/ktx2-basis-writer.js.map +1 -1
  40. package/dist/esm/lib/encoders/encode-ktx2-basis-texture.js +1 -1
  41. package/dist/esm/lib/encoders/encode-ktx2-basis-texture.js.map +1 -1
  42. package/dist/esm/lib/parsers/basis-module-loader.js +13 -10
  43. package/dist/esm/lib/parsers/basis-module-loader.js.map +1 -1
  44. package/dist/esm/lib/parsers/crunch-module-loader.js +4 -1
  45. package/dist/esm/lib/parsers/crunch-module-loader.js.map +1 -1
  46. package/dist/esm/lib/parsers/parse-basis.js +3 -3
  47. package/dist/esm/lib/parsers/parse-basis.js.map +1 -1
  48. package/dist/esm/lib/texture-api/deep-load.js.map +1 -1
  49. package/dist/esm/lib/utils/version.js +1 -1
  50. package/dist/esm/lib/utils/version.js.map +1 -1
  51. package/dist/esm/workers/compressed-texture-worker.js.map +1 -1
  52. package/dist/esm/workers/ktx2-basis-writer-worker-node.js.map +1 -1
  53. package/dist/esm/workers/ktx2-basis-writer-worker.js.map +1 -1
  54. package/dist/index.d.ts +2 -0
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/ktx2-basis-writer-worker-node.js +387 -333
  57. package/dist/ktx2-basis-writer-worker.js +61 -31
  58. package/dist/ktx2-basis-writer.d.ts +8 -7
  59. package/dist/ktx2-basis-writer.d.ts.map +1 -1
  60. package/dist/lib/encoders/encode-ktx2-basis-texture.d.ts.map +1 -1
  61. package/dist/lib/parsers/basis-module-loader.d.ts +11 -1
  62. package/dist/lib/parsers/basis-module-loader.d.ts.map +1 -1
  63. package/dist/lib/parsers/crunch-module-loader.d.ts +4 -0
  64. package/dist/lib/parsers/crunch-module-loader.d.ts.map +1 -1
  65. package/dist/lib/texture-api/deep-load.d.ts.map +1 -1
  66. package/dist/npy-worker.js +9 -4
  67. package/dist/workers/crunch-worker.d.ts +13 -9
  68. package/dist/workers/crunch-worker.d.ts.map +1 -1
  69. package/package.json +7 -7
  70. package/src/compressed-texture-loader.ts +14 -17
  71. package/src/crunch-loader.ts +10 -7
  72. package/src/index.ts +4 -0
  73. package/src/ktx2-basis-writer.ts +14 -13
  74. package/src/lib/encoders/encode-ktx2-basis-texture.ts +6 -1
  75. package/src/lib/parsers/basis-module-loader.ts +19 -16
  76. package/src/lib/parsers/crunch-module-loader.ts +6 -1
  77. package/src/lib/parsers/parse-basis.ts +3 -3
  78. package/src/lib/texture-api/deep-load.ts +0 -1
  79. package/src/workers/compressed-texture-worker.ts +1 -0
  80. package/src/workers/ktx2-basis-writer-worker-node.ts +2 -2
  81. package/src/workers/ktx2-basis-writer-worker.ts +2 -2
  82. package/dist/basis-loader.js +0 -37
  83. package/dist/bundle.js +0 -5
  84. package/dist/compressed-texture-loader.js +0 -64
  85. package/dist/compressed-texture-writer.js +0 -34
  86. package/dist/crunch-loader.js +0 -25
  87. package/dist/index.js +0 -52
  88. package/dist/ktx2-basis-writer.js +0 -26
  89. package/dist/lib/encoders/encode-ktx.js +0 -10
  90. package/dist/lib/encoders/encode-ktx2-basis-texture.js +0 -41
  91. package/dist/lib/encoders/encode-texture.js +0 -27
  92. package/dist/lib/gl-extensions.js +0 -72
  93. package/dist/lib/parsers/basis-module-loader.js +0 -114
  94. package/dist/lib/parsers/crunch-module-loader.js +0 -35
  95. package/dist/lib/parsers/parse-basis.js +0 -245
  96. package/dist/lib/parsers/parse-compressed-texture.js +0 -26
  97. package/dist/lib/parsers/parse-crunch.js +0 -106
  98. package/dist/lib/parsers/parse-dds.js +0 -108
  99. package/dist/lib/parsers/parse-ktx.js +0 -46
  100. package/dist/lib/parsers/parse-npy.js +0 -81
  101. package/dist/lib/parsers/parse-pvr.js +0 -250
  102. package/dist/lib/texture-api/async-deep-map.js +0 -41
  103. package/dist/lib/texture-api/deep-load.js +0 -16
  104. package/dist/lib/texture-api/generate-url.js +0 -17
  105. package/dist/lib/texture-api/load-image-array.js +0 -21
  106. package/dist/lib/texture-api/load-image-cube.js +0 -47
  107. package/dist/lib/texture-api/load-image.js +0 -43
  108. package/dist/lib/texture-api/texture-api-types.js +0 -3
  109. package/dist/lib/utils/extract-mipmap-images.js +0 -50
  110. package/dist/lib/utils/ktx-format-helper.js +0 -125
  111. package/dist/lib/utils/texture-formats.js +0 -51
  112. package/dist/lib/utils/version.js +0 -8
  113. package/dist/npy-loader.js +0 -31
  114. package/dist/types.js +0 -1
  115. package/dist/workers/basis-worker-node.js +0 -7
  116. package/dist/workers/basis-worker.js +0 -5
  117. package/dist/workers/compressed-texture-worker.js +0 -5
  118. package/dist/workers/crunch-worker.js +0 -14
  119. package/dist/workers/ktx2-basis-writer-worker-node.js +0 -28
  120. package/dist/workers/ktx2-basis-writer-worker.js +0 -26
  121. package/dist/workers/npy-worker.js +0 -5
@@ -21408,7 +21408,7 @@ var require_cookie = __commonJS({
21408
21408
  var Store = require_store().Store;
21409
21409
  var MemoryCookieStore = require_memstore().MemoryCookieStore;
21410
21410
  var pathMatch = require_pathMatch().pathMatch;
21411
- var VERSION5 = require_version();
21411
+ var VERSION3 = require_version();
21412
21412
  var punycode;
21413
21413
  try {
21414
21414
  punycode = require("punycode");
@@ -22225,7 +22225,7 @@ var require_cookie = __commonJS({
22225
22225
  type = null;
22226
22226
  }
22227
22227
  var serialized = {
22228
- version: "tough-cookie@" + VERSION5,
22228
+ version: "tough-cookie@" + VERSION3,
22229
22229
  storeType: type,
22230
22230
  rejectPublicSuffixes: !!this.rejectPublicSuffixes,
22231
22231
  cookies: []
@@ -22377,7 +22377,7 @@ var require_cookie = __commonJS({
22377
22377
  CAN_BE_SYNC.forEach(function(method) {
22378
22378
  CookieJar.prototype[method + "Sync"] = syncWrap(method);
22379
22379
  });
22380
- exports2.version = VERSION5;
22380
+ exports2.version = VERSION3;
22381
22381
  exports2.CookieJar = CookieJar;
22382
22382
  exports2.Cookie = Cookie;
22383
22383
  exports2.Store = Store;
@@ -45980,7 +45980,7 @@ var require_form_data = __commonJS({
45980
45980
  var http2 = require("http");
45981
45981
  var https2 = require("https");
45982
45982
  var parseUrl = require("url").parse;
45983
- var fs2 = require("fs");
45983
+ var fs3 = require("fs");
45984
45984
  var mime = require_mime_types();
45985
45985
  var asynckit = require_asynckit();
45986
45986
  var populate = require_populate();
@@ -46044,7 +46044,7 @@ var require_form_data = __commonJS({
46044
46044
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
46045
46045
  callback(null, value.end + 1 - (value.start ? value.start : 0));
46046
46046
  } else {
46047
- fs2.stat(value.path, function(err, stat) {
46047
+ fs3.stat(value.path, function(err, stat) {
46048
46048
  var fileSize;
46049
46049
  if (err) {
46050
46050
  callback(err);
@@ -54151,7 +54151,7 @@ var require_promise = __commonJS({
54151
54151
  var require_har2 = __commonJS({
54152
54152
  "../../node_modules/request/lib/har.js"(exports2) {
54153
54153
  "use strict";
54154
- var fs2 = require("fs");
54154
+ var fs3 = require("fs");
54155
54155
  var qs = require("querystring");
54156
54156
  var validate = require_promise();
54157
54157
  var extend = require_extend();
@@ -54285,7 +54285,7 @@ var require_har2 = __commonJS({
54285
54285
  return;
54286
54286
  }
54287
54287
  if (param.fileName && !param.value) {
54288
- attachment.value = fs2.createReadStream(param.fileName);
54288
+ attachment.value = fs3.createReadStream(param.fileName);
54289
54289
  } else if (param.value) {
54290
54290
  attachment.value = param.value;
54291
54291
  }
@@ -56833,7 +56833,7 @@ var require_node_pixels = __commonJS({
56833
56833
  var pack = require_convert();
56834
56834
  var GifReader = require_omggif().GifReader;
56835
56835
  var Bitmap = require_node_bitmap();
56836
- var fs2 = require("fs");
56836
+ var fs3 = require("fs");
56837
56837
  var request = require_request3();
56838
56838
  var mime = require_mime_types();
56839
56839
  var parseDataURI = require_parse_data_uri();
@@ -56985,7 +56985,7 @@ var require_node_pixels = __commonJS({
56985
56985
  doParse(type, body, cb);
56986
56986
  });
56987
56987
  } else {
56988
- fs2.readFile(url, function(err, data) {
56988
+ fs3.readFile(url, function(err, data) {
56989
56989
  if (err) {
56990
56990
  cb(err);
56991
56991
  return;
@@ -62693,6 +62693,275 @@ function btoa(base642) {
62693
62693
  return Buffer.from(base642, "base64").toString("ascii");
62694
62694
  }
62695
62695
 
62696
+ // ../polyfills/src/node/images/encode-image.node.ts
62697
+ var import_save_pixels = __toModule(require_save_pixels());
62698
+ var import_ndarray = __toModule(require_ndarray());
62699
+
62700
+ // ../polyfills/src/node/buffer/to-array-buffer.node.ts
62701
+ function bufferToArrayBuffer(buffer) {
62702
+ if (Buffer.isBuffer(buffer)) {
62703
+ const typedArray = new Uint8Array(buffer);
62704
+ return typedArray.buffer;
62705
+ }
62706
+ return buffer;
62707
+ }
62708
+
62709
+ // ../polyfills/src/node/images/encode-image.node.ts
62710
+ function encodeImageToStreamNode(image, options) {
62711
+ const type = options.type ? options.type.replace("image/", "") : "jpeg";
62712
+ const pixels = (0, import_ndarray.default)(image.data, [image.width, image.height, 4], [4, image.width * 4, 1], 0);
62713
+ return (0, import_save_pixels.default)(pixels, type, options);
62714
+ }
62715
+ function encodeImageNode(image, options) {
62716
+ const imageStream = encodeImageToStreamNode(image, options);
62717
+ return new Promise((resolve) => {
62718
+ const buffers = [];
62719
+ imageStream.on("data", (buffer) => buffers.push(buffer));
62720
+ imageStream.on("end", () => {
62721
+ const buffer = Buffer.concat(buffers);
62722
+ resolve(bufferToArrayBuffer(buffer));
62723
+ });
62724
+ });
62725
+ }
62726
+
62727
+ // ../polyfills/src/node/images/parse-image.node.ts
62728
+ var import_get_pixels = __toModule(require_node_pixels());
62729
+ var NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
62730
+ async function parseImageNode(arrayBuffer, mimeType) {
62731
+ if (!mimeType) {
62732
+ throw new Error("MIMEType is required to parse image under Node.js");
62733
+ }
62734
+ const buffer = arrayBuffer instanceof Buffer ? arrayBuffer : Buffer.from(arrayBuffer);
62735
+ const ndarray2 = await getPixelsAsync(buffer, mimeType);
62736
+ return ndarray2;
62737
+ }
62738
+ function getPixelsAsync(buffer, mimeType) {
62739
+ return new Promise((resolve) => (0, import_get_pixels.default)(buffer, mimeType, (err, ndarray2) => {
62740
+ if (err) {
62741
+ throw err;
62742
+ }
62743
+ const shape = [...ndarray2.shape];
62744
+ const layers = ndarray2.shape.length === 4 ? ndarray2.shape.shift() : 1;
62745
+ const data = ndarray2.data instanceof Buffer ? new Uint8Array(ndarray2.data) : ndarray2.data;
62746
+ resolve({
62747
+ shape,
62748
+ data,
62749
+ width: ndarray2.shape[0],
62750
+ height: ndarray2.shape[1],
62751
+ components: ndarray2.shape[2],
62752
+ layers: layers ? [layers] : []
62753
+ });
62754
+ }));
62755
+ }
62756
+
62757
+ // ../polyfills/src/node/file/readable-stream.ts
62758
+ var import_web_streams_polyfill = __toModule(require_polyfill());
62759
+ delete global.ReadableStream;
62760
+ var ReadableStreamPolyfill = class extends import_web_streams_polyfill.ReadableStream {
62761
+ };
62762
+
62763
+ // ../polyfills/src/node/file/blob-stream-controller.ts
62764
+ var BlobStreamController = class {
62765
+ constructor(chunks) {
62766
+ this.isWorking = false;
62767
+ this.isCancelled = false;
62768
+ this.chunks = chunks;
62769
+ }
62770
+ start(controller) {
62771
+ this.work(controller);
62772
+ }
62773
+ async work(controller) {
62774
+ const { chunks } = this;
62775
+ this.isWorking = true;
62776
+ while (!this.isCancelled && (controller.desiredSize || 0) > 0) {
62777
+ let next;
62778
+ try {
62779
+ next = chunks.next();
62780
+ } catch (error) {
62781
+ controller.error(error);
62782
+ break;
62783
+ }
62784
+ if (next) {
62785
+ if (!next.done && !this.isCancelled) {
62786
+ controller.enqueue(next.value);
62787
+ } else {
62788
+ controller.close();
62789
+ }
62790
+ }
62791
+ }
62792
+ this.isWorking = false;
62793
+ }
62794
+ pull(controller) {
62795
+ if (!this.isWorking) {
62796
+ this.work(controller);
62797
+ }
62798
+ }
62799
+ cancel() {
62800
+ this.isCancelled = true;
62801
+ }
62802
+ };
62803
+
62804
+ // ../polyfills/src/node/file/blob-stream.ts
62805
+ var BlobStream = class extends ReadableStreamPolyfill {
62806
+ constructor(chunks) {
62807
+ super(new BlobStreamController(chunks.values()), { type: "bytes" });
62808
+ this._chunks = chunks;
62809
+ }
62810
+ async *[Symbol.asyncIterator](_options) {
62811
+ const reader = this.getReader();
62812
+ yield* this._chunks;
62813
+ reader.releaseLock();
62814
+ }
62815
+ };
62816
+
62817
+ // ../polyfills/src/node/file/blob.ts
62818
+ var BlobPolyfill = class {
62819
+ constructor(init = [], options = {}) {
62820
+ this.parts = [];
62821
+ this.size = 0;
62822
+ for (const part of init) {
62823
+ if (typeof part === "string") {
62824
+ const bytes = new TextEncoder().encode(part);
62825
+ this.parts.push(bytes);
62826
+ this.size += bytes.byteLength;
62827
+ } else if (part instanceof BlobPolyfill) {
62828
+ this.size += part.size;
62829
+ this.parts.push(...part.parts);
62830
+ } else if (part instanceof ArrayBuffer) {
62831
+ this.parts.push(new Uint8Array(part));
62832
+ this.size += part.byteLength;
62833
+ } else if (part instanceof Uint8Array) {
62834
+ this.parts.push(part);
62835
+ this.size += part.byteLength;
62836
+ } else if (ArrayBuffer.isView(part)) {
62837
+ const { buffer, byteOffset, byteLength } = part;
62838
+ this.parts.push(new Uint8Array(buffer, byteOffset, byteLength));
62839
+ this.size += byteLength;
62840
+ } else {
62841
+ const bytes = new TextEncoder().encode(String(part));
62842
+ this.parts.push(bytes);
62843
+ this.size += bytes.byteLength;
62844
+ }
62845
+ }
62846
+ this.type = readType(options.type);
62847
+ }
62848
+ slice(start = 0, end = this.size, type = "") {
62849
+ const { size, parts } = this;
62850
+ let offset = start < 0 ? Math.max(size + start, 0) : Math.min(start, size);
62851
+ let limit = end < 0 ? Math.max(size + end, 0) : Math.min(end, size);
62852
+ const span = Math.max(limit - offset, 0);
62853
+ const blob = new BlobPolyfill([], { type });
62854
+ if (span === 0) {
62855
+ return blob;
62856
+ }
62857
+ let blobSize = 0;
62858
+ const blobParts = [];
62859
+ for (const part of parts) {
62860
+ const { byteLength } = part;
62861
+ if (offset > 0 && byteLength <= offset) {
62862
+ offset -= byteLength;
62863
+ limit -= byteLength;
62864
+ } else {
62865
+ const chunk = part.subarray(offset, Math.min(byteLength, limit));
62866
+ blobParts.push(chunk);
62867
+ blobSize += chunk.byteLength;
62868
+ offset = 0;
62869
+ if (blobSize >= span) {
62870
+ break;
62871
+ }
62872
+ }
62873
+ }
62874
+ blob.parts = blobParts;
62875
+ blob.size = blobSize;
62876
+ return blob;
62877
+ }
62878
+ async arrayBuffer() {
62879
+ return this._toArrayBuffer();
62880
+ }
62881
+ async text() {
62882
+ const decoder = new TextDecoder();
62883
+ let text = "";
62884
+ for (const part of this.parts) {
62885
+ text += decoder.decode(part);
62886
+ }
62887
+ return text;
62888
+ }
62889
+ stream() {
62890
+ return new BlobStream(this.parts);
62891
+ }
62892
+ toString() {
62893
+ return "[object Blob]";
62894
+ }
62895
+ get [Symbol.toStringTag]() {
62896
+ return "Blob";
62897
+ }
62898
+ _toArrayBuffer() {
62899
+ const buffer = new ArrayBuffer(this.size);
62900
+ const bytes = new Uint8Array(buffer);
62901
+ let offset = 0;
62902
+ for (const part of this.parts) {
62903
+ bytes.set(part, offset);
62904
+ offset += part.byteLength;
62905
+ }
62906
+ return buffer;
62907
+ }
62908
+ };
62909
+ function readType(input = "") {
62910
+ const type = String(input).toLowerCase();
62911
+ return /[^\u0020-\u007E]/.test(type) ? "" : type;
62912
+ }
62913
+
62914
+ // ../polyfills/src/node/file/file.ts
62915
+ var FilePolyfill = class extends BlobPolyfill {
62916
+ constructor(init, name, options = {}) {
62917
+ super(init, options);
62918
+ this.name = "";
62919
+ this.webkitRelativePath = "";
62920
+ this.name = String(name).replace(/\//g, ":");
62921
+ this.lastModified = (options == null ? void 0 : options.lastModified) || Date.now();
62922
+ }
62923
+ get [Symbol.toStringTag]() {
62924
+ return "File";
62925
+ }
62926
+ };
62927
+
62928
+ // ../polyfills/src/filesystems/node-filesystem.ts
62929
+ var import_fs = __toModule(require("fs"));
62930
+ var import_promises = __toModule(require("fs/promises"));
62931
+ var NodeFileSystem = class {
62932
+ constructor(options) {
62933
+ this.fetch = options._fetch;
62934
+ }
62935
+ async readdir(dirname = ".", options) {
62936
+ return await import_promises.default.readdir(dirname, options);
62937
+ }
62938
+ async stat(path2, options) {
62939
+ const info = await import_promises.default.stat(path2, options);
62940
+ return { size: Number(info.size), isDirectory: () => false, info };
62941
+ }
62942
+ async fetch(path2, options) {
62943
+ const fallbackFetch = options.fetch || this.fetch;
62944
+ return fallbackFetch(path2, options);
62945
+ }
62946
+ async open(path2, flags, mode) {
62947
+ return await import_promises.default.open(path2, flags);
62948
+ }
62949
+ async close(fd) {
62950
+ import_fs.default.close(fd);
62951
+ }
62952
+ async fstat(fd) {
62953
+ return await new Promise((resolve, reject) => import_fs.default.fstat(fd, (err, info) => err ? reject(err) : resolve(info)));
62954
+ }
62955
+ async read(fd, { buffer = null, offset = 0, length = buffer.byteLength, position = null }) {
62956
+ let totalBytesRead = 0;
62957
+ while (totalBytesRead < length) {
62958
+ const { bytesRead } = await new Promise((resolve, reject) => import_fs.default.read(fd, buffer, offset + totalBytesRead, length - totalBytesRead, position + totalBytesRead, (err, bytesRead2, buffer2) => err ? reject(err) : resolve({ bytesRead: bytesRead2, buffer: buffer2 })));
62959
+ totalBytesRead += bytesRead;
62960
+ }
62961
+ return { bytesRead: totalBytesRead, buffer };
62962
+ }
62963
+ };
62964
+
62696
62965
  // ../polyfills/src/node/fetch/headers.node.ts
62697
62966
  var Headers = class {
62698
62967
  constructor(headers) {
@@ -62939,48 +63208,12 @@ var Response = class {
62939
63208
  // ../polyfills/src/node/fetch/fetch.node.ts
62940
63209
  var import_http = __toModule(require("http"));
62941
63210
  var import_https = __toModule(require("https"));
62942
-
62943
- // ../polyfills/src/node/fetch/fetch-file.node.ts
62944
- var import_fs = __toModule(require("fs"));
62945
- async function fetchFileNode(url, options) {
62946
- const noqueryUrl = url.split("?")[0];
62947
- try {
62948
- const body = await new Promise((resolve, reject) => {
62949
- const stream = import_fs.default.createReadStream(noqueryUrl, { encoding: null });
62950
- stream.once("readable", () => resolve(stream));
62951
- stream.on("error", (error) => reject(error));
62952
- });
62953
- const status = 200;
62954
- const statusText = "OK";
62955
- const headers = getHeadersForFile(noqueryUrl);
62956
- return new Response(body, { headers, status, statusText, url });
62957
- } catch (error) {
62958
- const status = 400;
62959
- const statusText = error.message;
62960
- const headers = {};
62961
- return new Response(error.message, { headers, status, statusText, url });
62962
- }
62963
- }
62964
- function getHeadersForFile(noqueryUrl) {
62965
- const headers = {};
62966
- if (!headers["content-length"]) {
62967
- const stats = import_fs.default.statSync(noqueryUrl);
62968
- headers["content-length"] = stats.size;
62969
- }
62970
- if (noqueryUrl.endsWith(".gz")) {
62971
- noqueryUrl = noqueryUrl.slice(0, -3);
62972
- headers["content-encoding"] = "gzip";
62973
- }
62974
- return new Headers(headers);
62975
- }
62976
-
62977
- // ../polyfills/src/node/fetch/fetch.node.ts
62978
63211
  var isDataURL = (url) => url.startsWith("data:");
62979
63212
  var isRequestURL = (url) => url.startsWith("http:") || url.startsWith("https:");
62980
63213
  async function fetchNode(url, options) {
62981
63214
  try {
62982
- if (!isRequestURL(url) && !isDataURL(url)) {
62983
- return await fetchFileNode(url, options);
63215
+ if (globalThis.fetch !== fetchNode && (isRequestURL(url) || isDataURL(url))) {
63216
+ return await fetch(url, options);
62984
63217
  }
62985
63218
  if (isDataURL(url)) {
62986
63219
  const { arrayBuffer, mimeType } = decodeDataUri(url);
@@ -63070,278 +63303,59 @@ function getContentLength(url) {
63070
63303
  return isDataURL(url) ? url.length - "data:".length : null;
63071
63304
  }
63072
63305
 
63073
- // ../polyfills/src/node/images/encode-image.node.ts
63074
- var import_save_pixels = __toModule(require_save_pixels());
63075
- var import_ndarray = __toModule(require_ndarray());
63076
-
63077
- // ../polyfills/src/node/buffer/to-array-buffer.node.ts
63078
- function bufferToArrayBuffer(buffer) {
63079
- if (Buffer.isBuffer(buffer)) {
63080
- const typedArray = new Uint8Array(buffer);
63081
- return typedArray.buffer;
63082
- }
63083
- return buffer;
63084
- }
63085
-
63086
- // ../polyfills/src/node/images/encode-image.node.ts
63087
- function encodeImageToStreamNode(image, options) {
63088
- const type = options.type ? options.type.replace("image/", "") : "jpeg";
63089
- const pixels = (0, import_ndarray.default)(image.data, [image.width, image.height, 4], [4, image.width * 4, 1], 0);
63090
- return (0, import_save_pixels.default)(pixels, type, options);
63091
- }
63092
- function encodeImageNode(image, options) {
63093
- const imageStream = encodeImageToStreamNode(image, options);
63094
- return new Promise((resolve) => {
63095
- const buffers = [];
63096
- imageStream.on("data", (buffer) => buffers.push(buffer));
63097
- imageStream.on("end", () => {
63098
- const buffer = Buffer.concat(buffers);
63099
- resolve(bufferToArrayBuffer(buffer));
63100
- });
63101
- });
63102
- }
63103
-
63104
- // ../polyfills/src/node/images/parse-image.node.ts
63105
- var import_get_pixels = __toModule(require_node_pixels());
63106
- var NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
63107
- async function parseImageNode(arrayBuffer, mimeType) {
63108
- if (!mimeType) {
63109
- throw new Error("MIMEType is required to parse image under Node.js");
63110
- }
63111
- const buffer = arrayBuffer instanceof Buffer ? arrayBuffer : Buffer.from(arrayBuffer);
63112
- const ndarray2 = await getPixelsAsync(buffer, mimeType);
63113
- return ndarray2;
63114
- }
63115
- function getPixelsAsync(buffer, mimeType) {
63116
- return new Promise((resolve) => (0, import_get_pixels.default)(buffer, mimeType, (err, ndarray2) => {
63117
- if (err) {
63118
- throw err;
63119
- }
63120
- const shape = [...ndarray2.shape];
63121
- const layers = ndarray2.shape.length === 4 ? ndarray2.shape.shift() : 1;
63122
- const data = ndarray2.data instanceof Buffer ? new Uint8Array(ndarray2.data) : ndarray2.data;
63123
- resolve({
63124
- shape,
63125
- data,
63126
- width: ndarray2.shape[0],
63127
- height: ndarray2.shape[1],
63128
- components: ndarray2.shape[2],
63129
- layers: layers ? [layers] : []
63130
- });
63131
- }));
63132
- }
63133
-
63134
- // ../polyfills/src/node/file/readable-stream.ts
63135
- var import_web_streams_polyfill = __toModule(require_polyfill());
63136
- delete global.ReadableStream;
63137
- var ReadableStreamPolyfill = class extends import_web_streams_polyfill.ReadableStream {
63138
- };
63139
-
63140
- // ../polyfills/src/node/file/blob-stream-controller.ts
63141
- var BlobStreamController = class {
63142
- constructor(chunks) {
63143
- this.isWorking = false;
63144
- this.isCancelled = false;
63145
- this.chunks = chunks;
63146
- }
63147
- start(controller) {
63148
- this.work(controller);
63149
- }
63150
- async work(controller) {
63151
- const { chunks } = this;
63152
- this.isWorking = true;
63153
- while (!this.isCancelled && (controller.desiredSize || 0) > 0) {
63154
- let next;
63155
- try {
63156
- next = chunks.next();
63157
- } catch (error) {
63158
- controller.error(error);
63159
- break;
63160
- }
63161
- if (next) {
63162
- if (!next.done && !this.isCancelled) {
63163
- controller.enqueue(next.value);
63164
- } else {
63165
- controller.close();
63166
- }
63167
- }
63168
- }
63169
- this.isWorking = false;
63170
- }
63171
- pull(controller) {
63172
- if (!this.isWorking) {
63173
- this.work(controller);
63174
- }
63175
- }
63176
- cancel() {
63177
- this.isCancelled = true;
63178
- }
63179
- };
63180
-
63181
- // ../polyfills/src/node/file/blob-stream.ts
63182
- var BlobStream = class extends ReadableStreamPolyfill {
63183
- constructor(chunks) {
63184
- super(new BlobStreamController(chunks.values()), { type: "bytes" });
63185
- this._chunks = chunks;
63186
- }
63187
- async *[Symbol.asyncIterator](_options) {
63188
- const reader = this.getReader();
63189
- yield* this._chunks;
63190
- reader.releaseLock();
63191
- }
63192
- };
63193
-
63194
- // ../polyfills/src/node/file/blob.ts
63195
- var BlobPolyfill = class {
63196
- constructor(init = [], options = {}) {
63197
- this.parts = [];
63198
- this.size = 0;
63199
- for (const part of init) {
63200
- if (typeof part === "string") {
63201
- const bytes = new TextEncoder().encode(part);
63202
- this.parts.push(bytes);
63203
- this.size += bytes.byteLength;
63204
- } else if (part instanceof BlobPolyfill) {
63205
- this.size += part.size;
63206
- this.parts.push(...part.parts);
63207
- } else if (part instanceof ArrayBuffer) {
63208
- this.parts.push(new Uint8Array(part));
63209
- this.size += part.byteLength;
63210
- } else if (part instanceof Uint8Array) {
63211
- this.parts.push(part);
63212
- this.size += part.byteLength;
63213
- } else if (ArrayBuffer.isView(part)) {
63214
- const { buffer, byteOffset, byteLength } = part;
63215
- this.parts.push(new Uint8Array(buffer, byteOffset, byteLength));
63216
- this.size += byteLength;
63217
- } else {
63218
- const bytes = new TextEncoder().encode(String(part));
63219
- this.parts.push(bytes);
63220
- this.size += bytes.byteLength;
63221
- }
63222
- }
63223
- this.type = readType(options.type);
63224
- }
63225
- slice(start = 0, end = this.size, type = "") {
63226
- const { size, parts } = this;
63227
- let offset = start < 0 ? Math.max(size + start, 0) : Math.min(start, size);
63228
- let limit = end < 0 ? Math.max(size + end, 0) : Math.min(end, size);
63229
- const span = Math.max(limit - offset, 0);
63230
- const blob = new BlobPolyfill([], { type });
63231
- if (span === 0) {
63232
- return blob;
63233
- }
63234
- let blobSize = 0;
63235
- const blobParts = [];
63236
- for (const part of parts) {
63237
- const { byteLength } = part;
63238
- if (offset > 0 && byteLength <= offset) {
63239
- offset -= byteLength;
63240
- limit -= byteLength;
63241
- } else {
63242
- const chunk = part.subarray(offset, Math.min(byteLength, limit));
63243
- blobParts.push(chunk);
63244
- blobSize += chunk.byteLength;
63245
- offset = 0;
63246
- if (blobSize >= span) {
63247
- break;
63248
- }
63249
- }
63250
- }
63251
- blob.parts = blobParts;
63252
- blob.size = blobSize;
63253
- return blob;
63254
- }
63255
- async arrayBuffer() {
63256
- return this._toArrayBuffer();
63257
- }
63258
- async text() {
63259
- const decoder = new TextDecoder();
63260
- let text = "";
63261
- for (const part of this.parts) {
63262
- text += decoder.decode(part);
63263
- }
63264
- return text;
63265
- }
63266
- stream() {
63267
- return new BlobStream(this.parts);
63268
- }
63269
- toString() {
63270
- return "[object Blob]";
63271
- }
63272
- get [Symbol.toStringTag]() {
63273
- return "Blob";
63274
- }
63275
- _toArrayBuffer() {
63276
- const buffer = new ArrayBuffer(this.size);
63277
- const bytes = new Uint8Array(buffer);
63278
- let offset = 0;
63279
- for (const part of this.parts) {
63280
- bytes.set(part, offset);
63281
- offset += part.byteLength;
63282
- }
63283
- return buffer;
63284
- }
63285
- };
63286
- function readType(input = "") {
63287
- const type = String(input).toLowerCase();
63288
- return /[^\u0020-\u007E]/.test(type) ? "" : type;
63289
- }
63290
-
63291
- // ../polyfills/src/node/file/file.ts
63292
- var FilePolyfill = class extends BlobPolyfill {
63293
- constructor(init, name, options = {}) {
63294
- super(init, options);
63295
- this.name = "";
63296
- this.webkitRelativePath = "";
63297
- this.name = String(name).replace(/\//g, ":");
63298
- this.lastModified = (options == null ? void 0 : options.lastModified) || Date.now();
63299
- }
63300
- get [Symbol.toStringTag]() {
63301
- return "File";
63302
- }
63303
- };
63304
-
63305
63306
  // ../polyfills/src/index.ts
63306
- var installTextEncoder = !isBrowser || !("TextEncoder" in global_);
63307
- if (installTextEncoder) {
63308
- global_["TextEncoder"] = TextEncoder2;
63309
- }
63310
- var installTextDecoder = !isBrowser || !("TextDecoder" in global_);
63311
- if (installTextDecoder) {
63312
- global_["TextDecoder"] = TextDecoder2;
63307
+ if (isBrowser) {
63308
+ console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");
63313
63309
  }
63314
- if (!isBrowser && !("atob" in global_) && atob) {
63315
- global_["atob"] = atob;
63310
+ if (!globalThis.TextEncoder) {
63311
+ globalThis.TextEncoder = TextEncoder2;
63316
63312
  }
63317
- if (!isBrowser && !("btoa" in global_) && btoa) {
63318
- global_["btoa"] = btoa;
63313
+ if (!globalThis.TextDecoder) {
63314
+ globalThis.TextDecoder = TextDecoder2;
63319
63315
  }
63320
- if (!isBrowser && !("Headers" in global_) && Headers) {
63321
- global_["Headers"] = Headers;
63316
+ if (!isBrowser && !("atob" in globalThis) && atob) {
63317
+ globalThis["atob"] = atob;
63322
63318
  }
63323
- if (!isBrowser && !("Response" in global_) && Response) {
63324
- global_["Response"] = Response;
63319
+ if (!isBrowser && !("btoa" in globalThis) && btoa) {
63320
+ globalThis["btoa"] = btoa;
63325
63321
  }
63326
- if (!isBrowser && !("fetch" in global_) && fetchNode) {
63327
- global_["fetch"] = fetchNode;
63322
+ globalThis.loaders = globalThis.loaders || {};
63323
+ globalThis.loaders.NodeFileSystem = NodeFileSystem;
63324
+ if (!isBrowser && !("_encodeImageNode" in globalThis) && encodeImageNode) {
63325
+ globalThis["_encodeImageNode"] = encodeImageNode;
63328
63326
  }
63329
- if (!isBrowser && !("_encodeImageNode" in global_) && encodeImageNode) {
63330
- global_["_encodeImageNode"] = encodeImageNode;
63331
- }
63332
- if (!isBrowser && !("_parseImageNode" in global_) && parseImageNode) {
63333
- global_["_parseImageNode"] = parseImageNode;
63334
- global_["_imageFormatsNode"] = NODE_FORMAT_SUPPORT;
63327
+ if (!isBrowser && !("_parseImageNode" in globalThis) && parseImageNode) {
63328
+ globalThis["_parseImageNode"] = parseImageNode;
63329
+ globalThis["_imageFormatsNode"] = NODE_FORMAT_SUPPORT;
63335
63330
  }
63336
63331
  if (!("allSettled" in Promise)) {
63337
63332
  Promise.allSettled = allSettled;
63338
63333
  }
63334
+ if (!isBrowser && !("Headers" in globalThis) && Headers) {
63335
+ globalThis.Headers = Headers;
63336
+ }
63337
+ if (!isBrowser && !("Response" in globalThis) && Response) {
63338
+ globalThis.Response = Response;
63339
+ }
63340
+ if (!isBrowser && !("fetch" in globalThis) && fetchNode) {
63341
+ globalThis.fetch = fetchNode;
63342
+ }
63339
63343
 
63340
63344
  // ../worker-utils/src/lib/env-utils/version.ts
63341
- var VERSION = true ? "4.0.0-alpha.9" : DEFAULT_VERSION;
63342
- if (false) {
63343
- console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
63345
+ function getVersion() {
63346
+ var _a;
63347
+ if (!((_a = globalThis._loadersgl_) == null ? void 0 : _a.version)) {
63348
+ globalThis._loadersgl_ = globalThis._loadersgl_ || {};
63349
+ if (false) {
63350
+ console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
63351
+ globalThis._loadersgl_.version = NPM_TAG;
63352
+ } else {
63353
+ globalThis._loadersgl_.version = "4.0.0-beta.2";
63354
+ }
63355
+ }
63356
+ return globalThis._loadersgl_.version;
63344
63357
  }
63358
+ var VERSION = getVersion();
63345
63359
 
63346
63360
  // ../worker-utils/src/lib/env-utils/assert.ts
63347
63361
  function assert2(condition, message) {
@@ -63479,11 +63493,30 @@ function isKnownMessage(message) {
63479
63493
  // ../worker-utils/src/lib/node/require-utils.node.ts
63480
63494
  var require_utils_node_exports = {};
63481
63495
  __export(require_utils_node_exports, {
63496
+ readFileAsArrayBuffer: () => readFileAsArrayBuffer,
63497
+ readFileAsText: () => readFileAsText,
63482
63498
  requireFromFile: () => requireFromFile,
63483
63499
  requireFromString: () => requireFromString
63484
63500
  });
63485
63501
  var import_module = __toModule(require("module"));
63486
63502
  var import_path = __toModule(require("path"));
63503
+ var import_fs2 = __toModule(require("fs"));
63504
+ async function readFileAsArrayBuffer(filename) {
63505
+ if (filename.startsWith("http")) {
63506
+ const response = await fetch(filename);
63507
+ return await response.arrayBuffer();
63508
+ }
63509
+ const buffer = import_fs2.default.readFileSync(filename);
63510
+ return buffer.buffer;
63511
+ }
63512
+ async function readFileAsText(filename) {
63513
+ if (filename.startsWith("http")) {
63514
+ const response = await fetch(filename);
63515
+ return await response.text();
63516
+ }
63517
+ const text = import_fs2.default.readFileSync(filename, "utf8");
63518
+ return text;
63519
+ }
63487
63520
  async function requireFromFile(filename) {
63488
63521
  if (filename.startsWith("http")) {
63489
63522
  const response = await fetch(filename);
@@ -63516,40 +63549,38 @@ function requireFromString(code, filename = "", options) {
63516
63549
  }
63517
63550
 
63518
63551
  // ../worker-utils/src/lib/library-utils/library-utils.ts
63519
- var LATEST = "beta";
63520
- var VERSION2 = typeof VERSION !== "undefined" ? VERSION : LATEST;
63521
63552
  var loadLibraryPromises = {};
63522
- async function loadLibrary(libraryUrl, moduleName = null, options = {}) {
63553
+ async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
63523
63554
  if (moduleName) {
63524
- libraryUrl = getLibraryUrl(libraryUrl, moduleName, options);
63555
+ libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
63525
63556
  }
63526
63557
  loadLibraryPromises[libraryUrl] = loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
63527
63558
  return await loadLibraryPromises[libraryUrl];
63528
63559
  }
63529
- function getLibraryUrl(library, moduleName, options) {
63530
- if (library.startsWith("http")) {
63560
+ function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
63561
+ if (!options.useLocalLibraries && library.startsWith("http")) {
63531
63562
  return library;
63532
63563
  }
63564
+ libraryName = libraryName || library;
63533
63565
  const modules = options.modules || {};
63534
- if (modules[library]) {
63535
- return modules[library];
63566
+ if (modules[libraryName]) {
63567
+ return modules[libraryName];
63536
63568
  }
63537
63569
  if (!isBrowser2) {
63538
- return `modules/${moduleName}/dist/libs/${library}`;
63570
+ return `modules/${moduleName}/dist/libs/${libraryName}`;
63539
63571
  }
63540
63572
  if (options.CDN) {
63541
63573
  assert2(options.CDN.startsWith("http"));
63542
- return `${options.CDN}/${moduleName}@${VERSION2}/dist/libs/${library}`;
63574
+ return `${options.CDN}/${moduleName}@${VERSION}/dist/libs/${libraryName}`;
63543
63575
  }
63544
63576
  if (isWorker) {
63545
- return `../src/libs/${library}`;
63577
+ return `../src/libs/${libraryName}`;
63546
63578
  }
63547
- return `modules/${moduleName}/src/libs/${library}`;
63579
+ return `modules/${moduleName}/src/libs/${libraryName}`;
63548
63580
  }
63549
63581
  async function loadLibraryFromFile(libraryUrl) {
63550
63582
  if (libraryUrl.endsWith("wasm")) {
63551
- const response2 = await fetch(libraryUrl);
63552
- return await response2.arrayBuffer();
63583
+ return await loadAsArrayBuffer(libraryUrl);
63553
63584
  }
63554
63585
  if (!isBrowser2) {
63555
63586
  try {
@@ -63561,8 +63592,7 @@ async function loadLibraryFromFile(libraryUrl) {
63561
63592
  if (isWorker) {
63562
63593
  return importScripts(libraryUrl);
63563
63594
  }
63564
- const response = await fetch(libraryUrl);
63565
- const scriptSource = await response.text();
63595
+ const scriptSource = await loadAsText(libraryUrl);
63566
63596
  return loadLibraryFromString(scriptSource, libraryUrl);
63567
63597
  }
63568
63598
  function loadLibraryFromString(scriptSource, id) {
@@ -63583,6 +63613,20 @@ function loadLibraryFromString(scriptSource, id) {
63583
63613
  document.body.appendChild(script);
63584
63614
  return null;
63585
63615
  }
63616
+ async function loadAsArrayBuffer(url) {
63617
+ if (!readFileAsArrayBuffer || url.startsWith("http")) {
63618
+ const response = await fetch(url);
63619
+ return await response.arrayBuffer();
63620
+ }
63621
+ return await readFileAsArrayBuffer(url);
63622
+ }
63623
+ async function loadAsText(url) {
63624
+ if (!readFileAsText || url.startsWith("http")) {
63625
+ const response = await fetch(url);
63626
+ return await response.text();
63627
+ }
63628
+ return await readFileAsText(url);
63629
+ }
63586
63630
 
63587
63631
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
63588
63632
  var requestId = 0;
@@ -63600,7 +63644,7 @@ function createLoaderWorker(loader) {
63600
63644
  arrayBuffer: input,
63601
63645
  options,
63602
63646
  context: __spreadProps(__spreadValues({}, context), {
63603
- parse: parseOnMainThread
63647
+ _parse: parseOnMainThread
63604
63648
  })
63605
63649
  });
63606
63650
  WorkerBody.postMessage("done", { result });
@@ -63613,7 +63657,7 @@ function createLoaderWorker(loader) {
63613
63657
  }
63614
63658
  };
63615
63659
  }
63616
- function parseOnMainThread(arrayBuffer, options) {
63660
+ function parseOnMainThread(arrayBuffer, loader, options, context) {
63617
63661
  return new Promise((resolve, reject) => {
63618
63662
  const id = requestId++;
63619
63663
  const onMessage = (type, payload2) => {
@@ -63637,7 +63681,12 @@ function parseOnMainThread(arrayBuffer, options) {
63637
63681
  WorkerBody.postMessage("process", payload);
63638
63682
  });
63639
63683
  }
63640
- async function parseData({ loader, arrayBuffer, options, context }) {
63684
+ async function parseData({
63685
+ loader,
63686
+ arrayBuffer,
63687
+ options,
63688
+ context
63689
+ }) {
63641
63690
  let data;
63642
63691
  let parser;
63643
63692
  if (loader.parseSync || loader.parse) {
@@ -63658,32 +63707,35 @@ async function parseData({ loader, arrayBuffer, options, context }) {
63658
63707
  }
63659
63708
 
63660
63709
  // src/lib/utils/version.ts
63661
- var VERSION3 = true ? "4.0.0-alpha.9" : "beta";
63710
+ var VERSION2 = true ? "4.0.0-beta.2" : "beta";
63662
63711
 
63663
63712
  // src/lib/parsers/basis-module-loader.ts
63664
- var VERSION4 = true ? "4.0.0-alpha.9" : "beta";
63665
- var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION4}/dist/libs/basis_encoder.wasm`;
63666
- var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION4}/dist/libs/basis_encoder.js`;
63713
+ var BASIS_EXTERNAL_LIBRARIES = {
63714
+ TRANSCODER: "basis_transcoder.js",
63715
+ TRANSCODER_WASM: "basis_transcoder.wasm",
63716
+ ENCODER: "basis_encoder.js",
63717
+ ENCODER_WASM: "basis_encoder.wasm"
63718
+ };
63667
63719
  var loadBasisTranscoderPromise;
63668
- async function loadBasisTrascoderModule(options) {
63720
+ async function loadBasisTranscoderModule(options) {
63669
63721
  const modules = options.modules || {};
63670
63722
  if (modules.basis) {
63671
63723
  return modules.basis;
63672
63724
  }
63673
- loadBasisTranscoderPromise = loadBasisTranscoderPromise || loadBasisTrascoder(options);
63725
+ loadBasisTranscoderPromise = loadBasisTranscoderPromise || loadBasisTranscoder(options);
63674
63726
  return await loadBasisTranscoderPromise;
63675
63727
  }
63676
- async function loadBasisTrascoder(options) {
63728
+ async function loadBasisTranscoder(options) {
63677
63729
  let BASIS = null;
63678
63730
  let wasmBinary = null;
63679
63731
  [BASIS, wasmBinary] = await Promise.all([
63680
- await loadLibrary("basis_transcoder.js", "textures", options),
63681
- await loadLibrary("basis_transcoder.wasm", "textures", options)
63732
+ await loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER, "textures", options),
63733
+ await loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM, "textures", options)
63682
63734
  ]);
63683
63735
  BASIS = BASIS || globalThis.BASIS;
63684
- return await initializeBasisTrascoderModule(BASIS, wasmBinary);
63736
+ return await initializeBasisTranscoderModule(BASIS, wasmBinary);
63685
63737
  }
63686
- function initializeBasisTrascoderModule(BasisModule, wasmBinary) {
63738
+ function initializeBasisTranscoderModule(BasisModule, wasmBinary) {
63687
63739
  const options = {};
63688
63740
  if (wasmBinary) {
63689
63741
  options.wasmBinary = wasmBinary;
@@ -63709,8 +63761,8 @@ async function loadBasisEncoder(options) {
63709
63761
  let BASIS_ENCODER = null;
63710
63762
  let wasmBinary = null;
63711
63763
  [BASIS_ENCODER, wasmBinary] = await Promise.all([
63712
- await loadLibrary(BASIS_CDN_ENCODER_JS, "textures", options),
63713
- await loadLibrary(BASIS_CDN_ENCODER_WASM, "textures", options)
63764
+ await loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER, "textures", options),
63765
+ await loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, "textures", options)
63714
63766
  ]);
63715
63767
  BASIS_ENCODER = BASIS_ENCODER || globalThis.BASIS;
63716
63768
  return await initializeBasisEncoderModule(BASIS_ENCODER, wasmBinary);
@@ -63900,7 +63952,7 @@ async function parseBasis(data, options) {
63900
63952
  const fileConstructors = await loadBasisEncoderModule(options);
63901
63953
  return parseKTX2File(fileConstructors.KTX2File, data, options);
63902
63954
  }
63903
- const { BasisFile } = await loadBasisTrascoderModule(options);
63955
+ const { BasisFile } = await loadBasisTranscoderModule(options);
63904
63956
  return parseBasisFile(BasisFile, data, options);
63905
63957
  }
63906
63958
  switch (options.basis.module) {
@@ -63915,7 +63967,7 @@ async function parseBasis(data, options) {
63915
63967
  }
63916
63968
  case "transcoder":
63917
63969
  default:
63918
- const { BasisFile } = await loadBasisTrascoderModule(options);
63970
+ const { BasisFile } = await loadBasisTranscoderModule(options);
63919
63971
  return parseBasisFile(BasisFile, data, options);
63920
63972
  }
63921
63973
  }
@@ -64034,7 +64086,7 @@ var BasisWorkerLoader = {
64034
64086
  name: "Basis",
64035
64087
  id: "basis",
64036
64088
  module: "textures",
64037
- version: VERSION3,
64089
+ version: VERSION2,
64038
64090
  worker: true,
64039
64091
  extensions: ["basis", "ktx2"],
64040
64092
  mimeTypes: ["application/octet-stream", "image/ktx2"],