@loaders.gl/textures 4.0.0-beta.1 → 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.
@@ -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;
@@ -62518,6 +62518,275 @@ function btoa(base642) {
62518
62518
  return Buffer.from(base642, "base64").toString("ascii");
62519
62519
  }
62520
62520
 
62521
+ // ../polyfills/src/node/images/encode-image.node.ts
62522
+ var import_save_pixels = __toModule(require_save_pixels());
62523
+ var import_ndarray = __toModule(require_ndarray());
62524
+
62525
+ // ../polyfills/src/node/buffer/to-array-buffer.node.ts
62526
+ function bufferToArrayBuffer(buffer) {
62527
+ if (Buffer.isBuffer(buffer)) {
62528
+ const typedArray = new Uint8Array(buffer);
62529
+ return typedArray.buffer;
62530
+ }
62531
+ return buffer;
62532
+ }
62533
+
62534
+ // ../polyfills/src/node/images/encode-image.node.ts
62535
+ function encodeImageToStreamNode(image, options) {
62536
+ const type = options.type ? options.type.replace("image/", "") : "jpeg";
62537
+ const pixels = (0, import_ndarray.default)(image.data, [image.width, image.height, 4], [4, image.width * 4, 1], 0);
62538
+ return (0, import_save_pixels.default)(pixels, type, options);
62539
+ }
62540
+ function encodeImageNode(image, options) {
62541
+ const imageStream = encodeImageToStreamNode(image, options);
62542
+ return new Promise((resolve) => {
62543
+ const buffers = [];
62544
+ imageStream.on("data", (buffer) => buffers.push(buffer));
62545
+ imageStream.on("end", () => {
62546
+ const buffer = Buffer.concat(buffers);
62547
+ resolve(bufferToArrayBuffer(buffer));
62548
+ });
62549
+ });
62550
+ }
62551
+
62552
+ // ../polyfills/src/node/images/parse-image.node.ts
62553
+ var import_get_pixels = __toModule(require_node_pixels());
62554
+ var NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
62555
+ async function parseImageNode(arrayBuffer, mimeType) {
62556
+ if (!mimeType) {
62557
+ throw new Error("MIMEType is required to parse image under Node.js");
62558
+ }
62559
+ const buffer = arrayBuffer instanceof Buffer ? arrayBuffer : Buffer.from(arrayBuffer);
62560
+ const ndarray2 = await getPixelsAsync(buffer, mimeType);
62561
+ return ndarray2;
62562
+ }
62563
+ function getPixelsAsync(buffer, mimeType) {
62564
+ return new Promise((resolve) => (0, import_get_pixels.default)(buffer, mimeType, (err, ndarray2) => {
62565
+ if (err) {
62566
+ throw err;
62567
+ }
62568
+ const shape = [...ndarray2.shape];
62569
+ const layers = ndarray2.shape.length === 4 ? ndarray2.shape.shift() : 1;
62570
+ const data = ndarray2.data instanceof Buffer ? new Uint8Array(ndarray2.data) : ndarray2.data;
62571
+ resolve({
62572
+ shape,
62573
+ data,
62574
+ width: ndarray2.shape[0],
62575
+ height: ndarray2.shape[1],
62576
+ components: ndarray2.shape[2],
62577
+ layers: layers ? [layers] : []
62578
+ });
62579
+ }));
62580
+ }
62581
+
62582
+ // ../polyfills/src/node/file/readable-stream.ts
62583
+ var import_web_streams_polyfill = __toModule(require_polyfill());
62584
+ delete global.ReadableStream;
62585
+ var ReadableStreamPolyfill = class extends import_web_streams_polyfill.ReadableStream {
62586
+ };
62587
+
62588
+ // ../polyfills/src/node/file/blob-stream-controller.ts
62589
+ var BlobStreamController = class {
62590
+ constructor(chunks) {
62591
+ this.isWorking = false;
62592
+ this.isCancelled = false;
62593
+ this.chunks = chunks;
62594
+ }
62595
+ start(controller) {
62596
+ this.work(controller);
62597
+ }
62598
+ async work(controller) {
62599
+ const { chunks } = this;
62600
+ this.isWorking = true;
62601
+ while (!this.isCancelled && (controller.desiredSize || 0) > 0) {
62602
+ let next;
62603
+ try {
62604
+ next = chunks.next();
62605
+ } catch (error) {
62606
+ controller.error(error);
62607
+ break;
62608
+ }
62609
+ if (next) {
62610
+ if (!next.done && !this.isCancelled) {
62611
+ controller.enqueue(next.value);
62612
+ } else {
62613
+ controller.close();
62614
+ }
62615
+ }
62616
+ }
62617
+ this.isWorking = false;
62618
+ }
62619
+ pull(controller) {
62620
+ if (!this.isWorking) {
62621
+ this.work(controller);
62622
+ }
62623
+ }
62624
+ cancel() {
62625
+ this.isCancelled = true;
62626
+ }
62627
+ };
62628
+
62629
+ // ../polyfills/src/node/file/blob-stream.ts
62630
+ var BlobStream = class extends ReadableStreamPolyfill {
62631
+ constructor(chunks) {
62632
+ super(new BlobStreamController(chunks.values()), { type: "bytes" });
62633
+ this._chunks = chunks;
62634
+ }
62635
+ async *[Symbol.asyncIterator](_options) {
62636
+ const reader = this.getReader();
62637
+ yield* this._chunks;
62638
+ reader.releaseLock();
62639
+ }
62640
+ };
62641
+
62642
+ // ../polyfills/src/node/file/blob.ts
62643
+ var BlobPolyfill = class {
62644
+ constructor(init = [], options = {}) {
62645
+ this.parts = [];
62646
+ this.size = 0;
62647
+ for (const part of init) {
62648
+ if (typeof part === "string") {
62649
+ const bytes = new TextEncoder().encode(part);
62650
+ this.parts.push(bytes);
62651
+ this.size += bytes.byteLength;
62652
+ } else if (part instanceof BlobPolyfill) {
62653
+ this.size += part.size;
62654
+ this.parts.push(...part.parts);
62655
+ } else if (part instanceof ArrayBuffer) {
62656
+ this.parts.push(new Uint8Array(part));
62657
+ this.size += part.byteLength;
62658
+ } else if (part instanceof Uint8Array) {
62659
+ this.parts.push(part);
62660
+ this.size += part.byteLength;
62661
+ } else if (ArrayBuffer.isView(part)) {
62662
+ const { buffer, byteOffset, byteLength } = part;
62663
+ this.parts.push(new Uint8Array(buffer, byteOffset, byteLength));
62664
+ this.size += byteLength;
62665
+ } else {
62666
+ const bytes = new TextEncoder().encode(String(part));
62667
+ this.parts.push(bytes);
62668
+ this.size += bytes.byteLength;
62669
+ }
62670
+ }
62671
+ this.type = readType(options.type);
62672
+ }
62673
+ slice(start = 0, end = this.size, type = "") {
62674
+ const { size, parts } = this;
62675
+ let offset = start < 0 ? Math.max(size + start, 0) : Math.min(start, size);
62676
+ let limit = end < 0 ? Math.max(size + end, 0) : Math.min(end, size);
62677
+ const span = Math.max(limit - offset, 0);
62678
+ const blob = new BlobPolyfill([], { type });
62679
+ if (span === 0) {
62680
+ return blob;
62681
+ }
62682
+ let blobSize = 0;
62683
+ const blobParts = [];
62684
+ for (const part of parts) {
62685
+ const { byteLength } = part;
62686
+ if (offset > 0 && byteLength <= offset) {
62687
+ offset -= byteLength;
62688
+ limit -= byteLength;
62689
+ } else {
62690
+ const chunk = part.subarray(offset, Math.min(byteLength, limit));
62691
+ blobParts.push(chunk);
62692
+ blobSize += chunk.byteLength;
62693
+ offset = 0;
62694
+ if (blobSize >= span) {
62695
+ break;
62696
+ }
62697
+ }
62698
+ }
62699
+ blob.parts = blobParts;
62700
+ blob.size = blobSize;
62701
+ return blob;
62702
+ }
62703
+ async arrayBuffer() {
62704
+ return this._toArrayBuffer();
62705
+ }
62706
+ async text() {
62707
+ const decoder = new TextDecoder();
62708
+ let text = "";
62709
+ for (const part of this.parts) {
62710
+ text += decoder.decode(part);
62711
+ }
62712
+ return text;
62713
+ }
62714
+ stream() {
62715
+ return new BlobStream(this.parts);
62716
+ }
62717
+ toString() {
62718
+ return "[object Blob]";
62719
+ }
62720
+ get [Symbol.toStringTag]() {
62721
+ return "Blob";
62722
+ }
62723
+ _toArrayBuffer() {
62724
+ const buffer = new ArrayBuffer(this.size);
62725
+ const bytes = new Uint8Array(buffer);
62726
+ let offset = 0;
62727
+ for (const part of this.parts) {
62728
+ bytes.set(part, offset);
62729
+ offset += part.byteLength;
62730
+ }
62731
+ return buffer;
62732
+ }
62733
+ };
62734
+ function readType(input = "") {
62735
+ const type = String(input).toLowerCase();
62736
+ return /[^\u0020-\u007E]/.test(type) ? "" : type;
62737
+ }
62738
+
62739
+ // ../polyfills/src/node/file/file.ts
62740
+ var FilePolyfill = class extends BlobPolyfill {
62741
+ constructor(init, name, options = {}) {
62742
+ super(init, options);
62743
+ this.name = "";
62744
+ this.webkitRelativePath = "";
62745
+ this.name = String(name).replace(/\//g, ":");
62746
+ this.lastModified = (options == null ? void 0 : options.lastModified) || Date.now();
62747
+ }
62748
+ get [Symbol.toStringTag]() {
62749
+ return "File";
62750
+ }
62751
+ };
62752
+
62753
+ // ../polyfills/src/filesystems/node-filesystem.ts
62754
+ var import_fs = __toModule(require("fs"));
62755
+ var import_promises = __toModule(require("fs/promises"));
62756
+ var NodeFileSystem = class {
62757
+ constructor(options) {
62758
+ this.fetch = options._fetch;
62759
+ }
62760
+ async readdir(dirname = ".", options) {
62761
+ return await import_promises.default.readdir(dirname, options);
62762
+ }
62763
+ async stat(path2, options) {
62764
+ const info = await import_promises.default.stat(path2, options);
62765
+ return { size: Number(info.size), isDirectory: () => false, info };
62766
+ }
62767
+ async fetch(path2, options) {
62768
+ const fallbackFetch = options.fetch || this.fetch;
62769
+ return fallbackFetch(path2, options);
62770
+ }
62771
+ async open(path2, flags, mode) {
62772
+ return await import_promises.default.open(path2, flags);
62773
+ }
62774
+ async close(fd) {
62775
+ import_fs.default.close(fd);
62776
+ }
62777
+ async fstat(fd) {
62778
+ return await new Promise((resolve, reject) => import_fs.default.fstat(fd, (err, info) => err ? reject(err) : resolve(info)));
62779
+ }
62780
+ async read(fd, { buffer = null, offset = 0, length = buffer.byteLength, position = null }) {
62781
+ let totalBytesRead = 0;
62782
+ while (totalBytesRead < length) {
62783
+ 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 })));
62784
+ totalBytesRead += bytesRead;
62785
+ }
62786
+ return { bytesRead: totalBytesRead, buffer };
62787
+ }
62788
+ };
62789
+
62521
62790
  // ../polyfills/src/node/fetch/headers.node.ts
62522
62791
  var Headers = class {
62523
62792
  constructor(headers) {
@@ -62859,272 +63128,43 @@ function getContentLength(url) {
62859
63128
  return isDataURL(url) ? url.length - "data:".length : null;
62860
63129
  }
62861
63130
 
62862
- // ../polyfills/src/node/images/encode-image.node.ts
62863
- var import_save_pixels = __toModule(require_save_pixels());
62864
- var import_ndarray = __toModule(require_ndarray());
62865
-
62866
- // ../polyfills/src/node/buffer/to-array-buffer.node.ts
62867
- function bufferToArrayBuffer(buffer) {
62868
- if (Buffer.isBuffer(buffer)) {
62869
- const typedArray = new Uint8Array(buffer);
62870
- return typedArray.buffer;
62871
- }
62872
- return buffer;
62873
- }
62874
-
62875
- // ../polyfills/src/node/images/encode-image.node.ts
62876
- function encodeImageToStreamNode(image, options) {
62877
- const type = options.type ? options.type.replace("image/", "") : "jpeg";
62878
- const pixels = (0, import_ndarray.default)(image.data, [image.width, image.height, 4], [4, image.width * 4, 1], 0);
62879
- return (0, import_save_pixels.default)(pixels, type, options);
62880
- }
62881
- function encodeImageNode(image, options) {
62882
- const imageStream = encodeImageToStreamNode(image, options);
62883
- return new Promise((resolve) => {
62884
- const buffers = [];
62885
- imageStream.on("data", (buffer) => buffers.push(buffer));
62886
- imageStream.on("end", () => {
62887
- const buffer = Buffer.concat(buffers);
62888
- resolve(bufferToArrayBuffer(buffer));
62889
- });
62890
- });
62891
- }
62892
-
62893
- // ../polyfills/src/node/images/parse-image.node.ts
62894
- var import_get_pixels = __toModule(require_node_pixels());
62895
- var NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
62896
- async function parseImageNode(arrayBuffer, mimeType) {
62897
- if (!mimeType) {
62898
- throw new Error("MIMEType is required to parse image under Node.js");
62899
- }
62900
- const buffer = arrayBuffer instanceof Buffer ? arrayBuffer : Buffer.from(arrayBuffer);
62901
- const ndarray2 = await getPixelsAsync(buffer, mimeType);
62902
- return ndarray2;
62903
- }
62904
- function getPixelsAsync(buffer, mimeType) {
62905
- return new Promise((resolve) => (0, import_get_pixels.default)(buffer, mimeType, (err, ndarray2) => {
62906
- if (err) {
62907
- throw err;
62908
- }
62909
- const shape = [...ndarray2.shape];
62910
- const layers = ndarray2.shape.length === 4 ? ndarray2.shape.shift() : 1;
62911
- const data = ndarray2.data instanceof Buffer ? new Uint8Array(ndarray2.data) : ndarray2.data;
62912
- resolve({
62913
- shape,
62914
- data,
62915
- width: ndarray2.shape[0],
62916
- height: ndarray2.shape[1],
62917
- components: ndarray2.shape[2],
62918
- layers: layers ? [layers] : []
62919
- });
62920
- }));
62921
- }
62922
-
62923
- // ../polyfills/src/node/file/readable-stream.ts
62924
- var import_web_streams_polyfill = __toModule(require_polyfill());
62925
- delete global.ReadableStream;
62926
- var ReadableStreamPolyfill = class extends import_web_streams_polyfill.ReadableStream {
62927
- };
62928
-
62929
- // ../polyfills/src/node/file/blob-stream-controller.ts
62930
- var BlobStreamController = class {
62931
- constructor(chunks) {
62932
- this.isWorking = false;
62933
- this.isCancelled = false;
62934
- this.chunks = chunks;
62935
- }
62936
- start(controller) {
62937
- this.work(controller);
62938
- }
62939
- async work(controller) {
62940
- const { chunks } = this;
62941
- this.isWorking = true;
62942
- while (!this.isCancelled && (controller.desiredSize || 0) > 0) {
62943
- let next;
62944
- try {
62945
- next = chunks.next();
62946
- } catch (error) {
62947
- controller.error(error);
62948
- break;
62949
- }
62950
- if (next) {
62951
- if (!next.done && !this.isCancelled) {
62952
- controller.enqueue(next.value);
62953
- } else {
62954
- controller.close();
62955
- }
62956
- }
62957
- }
62958
- this.isWorking = false;
62959
- }
62960
- pull(controller) {
62961
- if (!this.isWorking) {
62962
- this.work(controller);
62963
- }
62964
- }
62965
- cancel() {
62966
- this.isCancelled = true;
62967
- }
62968
- };
62969
-
62970
- // ../polyfills/src/node/file/blob-stream.ts
62971
- var BlobStream = class extends ReadableStreamPolyfill {
62972
- constructor(chunks) {
62973
- super(new BlobStreamController(chunks.values()), { type: "bytes" });
62974
- this._chunks = chunks;
62975
- }
62976
- async *[Symbol.asyncIterator](_options) {
62977
- const reader = this.getReader();
62978
- yield* this._chunks;
62979
- reader.releaseLock();
62980
- }
62981
- };
62982
-
62983
- // ../polyfills/src/node/file/blob.ts
62984
- var BlobPolyfill = class {
62985
- constructor(init = [], options = {}) {
62986
- this.parts = [];
62987
- this.size = 0;
62988
- for (const part of init) {
62989
- if (typeof part === "string") {
62990
- const bytes = new TextEncoder().encode(part);
62991
- this.parts.push(bytes);
62992
- this.size += bytes.byteLength;
62993
- } else if (part instanceof BlobPolyfill) {
62994
- this.size += part.size;
62995
- this.parts.push(...part.parts);
62996
- } else if (part instanceof ArrayBuffer) {
62997
- this.parts.push(new Uint8Array(part));
62998
- this.size += part.byteLength;
62999
- } else if (part instanceof Uint8Array) {
63000
- this.parts.push(part);
63001
- this.size += part.byteLength;
63002
- } else if (ArrayBuffer.isView(part)) {
63003
- const { buffer, byteOffset, byteLength } = part;
63004
- this.parts.push(new Uint8Array(buffer, byteOffset, byteLength));
63005
- this.size += byteLength;
63006
- } else {
63007
- const bytes = new TextEncoder().encode(String(part));
63008
- this.parts.push(bytes);
63009
- this.size += bytes.byteLength;
63010
- }
63011
- }
63012
- this.type = readType(options.type);
63013
- }
63014
- slice(start = 0, end = this.size, type = "") {
63015
- const { size, parts } = this;
63016
- let offset = start < 0 ? Math.max(size + start, 0) : Math.min(start, size);
63017
- let limit = end < 0 ? Math.max(size + end, 0) : Math.min(end, size);
63018
- const span = Math.max(limit - offset, 0);
63019
- const blob = new BlobPolyfill([], { type });
63020
- if (span === 0) {
63021
- return blob;
63022
- }
63023
- let blobSize = 0;
63024
- const blobParts = [];
63025
- for (const part of parts) {
63026
- const { byteLength } = part;
63027
- if (offset > 0 && byteLength <= offset) {
63028
- offset -= byteLength;
63029
- limit -= byteLength;
63030
- } else {
63031
- const chunk = part.subarray(offset, Math.min(byteLength, limit));
63032
- blobParts.push(chunk);
63033
- blobSize += chunk.byteLength;
63034
- offset = 0;
63035
- if (blobSize >= span) {
63036
- break;
63037
- }
63038
- }
63039
- }
63040
- blob.parts = blobParts;
63041
- blob.size = blobSize;
63042
- return blob;
63043
- }
63044
- async arrayBuffer() {
63045
- return this._toArrayBuffer();
63046
- }
63047
- async text() {
63048
- const decoder = new TextDecoder();
63049
- let text = "";
63050
- for (const part of this.parts) {
63051
- text += decoder.decode(part);
63052
- }
63053
- return text;
63054
- }
63055
- stream() {
63056
- return new BlobStream(this.parts);
63057
- }
63058
- toString() {
63059
- return "[object Blob]";
63060
- }
63061
- get [Symbol.toStringTag]() {
63062
- return "Blob";
63063
- }
63064
- _toArrayBuffer() {
63065
- const buffer = new ArrayBuffer(this.size);
63066
- const bytes = new Uint8Array(buffer);
63067
- let offset = 0;
63068
- for (const part of this.parts) {
63069
- bytes.set(part, offset);
63070
- offset += part.byteLength;
63071
- }
63072
- return buffer;
63073
- }
63074
- };
63075
- function readType(input = "") {
63076
- const type = String(input).toLowerCase();
63077
- return /[^\u0020-\u007E]/.test(type) ? "" : type;
63078
- }
63079
-
63080
- // ../polyfills/src/node/file/file.ts
63081
- var FilePolyfill = class extends BlobPolyfill {
63082
- constructor(init, name, options = {}) {
63083
- super(init, options);
63084
- this.name = "";
63085
- this.webkitRelativePath = "";
63086
- this.name = String(name).replace(/\//g, ":");
63087
- this.lastModified = (options == null ? void 0 : options.lastModified) || Date.now();
63088
- }
63089
- get [Symbol.toStringTag]() {
63090
- return "File";
63091
- }
63092
- };
63093
-
63094
63131
  // ../polyfills/src/index.ts
63095
- var installTextEncoder = !isBrowser || !("TextEncoder" in global_);
63096
- if (installTextEncoder) {
63097
- global_["TextEncoder"] = TextEncoder2;
63098
- }
63099
- var installTextDecoder = !isBrowser || !("TextDecoder" in global_);
63100
- if (installTextDecoder) {
63101
- global_["TextDecoder"] = TextDecoder2;
63132
+ if (isBrowser) {
63133
+ console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");
63102
63134
  }
63103
- if (!isBrowser && !("atob" in global_) && atob) {
63104
- global_["atob"] = atob;
63135
+ if (!globalThis.TextEncoder) {
63136
+ globalThis.TextEncoder = TextEncoder2;
63105
63137
  }
63106
- if (!isBrowser && !("btoa" in global_) && btoa) {
63107
- global_["btoa"] = btoa;
63138
+ if (!globalThis.TextDecoder) {
63139
+ globalThis.TextDecoder = TextDecoder2;
63108
63140
  }
63109
- if (!isBrowser && !("Headers" in global_) && Headers) {
63110
- global_["Headers"] = Headers;
63141
+ if (!isBrowser && !("atob" in globalThis) && atob) {
63142
+ globalThis["atob"] = atob;
63111
63143
  }
63112
- if (!isBrowser && !("Response" in global_) && Response) {
63113
- global_["Response"] = Response;
63144
+ if (!isBrowser && !("btoa" in globalThis) && btoa) {
63145
+ globalThis["btoa"] = btoa;
63114
63146
  }
63115
- if (!isBrowser && !("fetch" in global_) && fetchNode) {
63116
- global_["fetch"] = fetchNode;
63147
+ globalThis.loaders = globalThis.loaders || {};
63148
+ globalThis.loaders.NodeFileSystem = NodeFileSystem;
63149
+ if (!isBrowser && !("_encodeImageNode" in globalThis) && encodeImageNode) {
63150
+ globalThis["_encodeImageNode"] = encodeImageNode;
63117
63151
  }
63118
- if (!isBrowser && !("_encodeImageNode" in global_) && encodeImageNode) {
63119
- global_["_encodeImageNode"] = encodeImageNode;
63120
- }
63121
- if (!isBrowser && !("_parseImageNode" in global_) && parseImageNode) {
63122
- global_["_parseImageNode"] = parseImageNode;
63123
- global_["_imageFormatsNode"] = NODE_FORMAT_SUPPORT;
63152
+ if (!isBrowser && !("_parseImageNode" in globalThis) && parseImageNode) {
63153
+ globalThis["_parseImageNode"] = parseImageNode;
63154
+ globalThis["_imageFormatsNode"] = NODE_FORMAT_SUPPORT;
63124
63155
  }
63125
63156
  if (!("allSettled" in Promise)) {
63126
63157
  Promise.allSettled = allSettled;
63127
63158
  }
63159
+ if (!isBrowser && !("Headers" in globalThis) && Headers) {
63160
+ globalThis.Headers = Headers;
63161
+ }
63162
+ if (!isBrowser && !("Response" in globalThis) && Response) {
63163
+ globalThis.Response = Response;
63164
+ }
63165
+ if (!isBrowser && !("fetch" in globalThis) && fetchNode) {
63166
+ globalThis.fetch = fetchNode;
63167
+ }
63128
63168
 
63129
63169
  // ../worker-utils/src/lib/env-utils/version.ts
63130
63170
  function getVersion() {
@@ -63135,7 +63175,7 @@ function getVersion() {
63135
63175
  console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
63136
63176
  globalThis._loadersgl_.version = NPM_TAG;
63137
63177
  } else {
63138
- globalThis._loadersgl_.version = "4.0.0-beta.1";
63178
+ globalThis._loadersgl_.version = "4.0.0-beta.2";
63139
63179
  }
63140
63180
  }
63141
63181
  return globalThis._loadersgl_.version;
@@ -63285,13 +63325,13 @@ __export(require_utils_node_exports, {
63285
63325
  });
63286
63326
  var import_module = __toModule(require("module"));
63287
63327
  var import_path = __toModule(require("path"));
63288
- var import_fs = __toModule(require("fs"));
63328
+ var import_fs2 = __toModule(require("fs"));
63289
63329
  async function readFileAsArrayBuffer(filename) {
63290
63330
  if (filename.startsWith("http")) {
63291
63331
  const response = await fetch(filename);
63292
63332
  return await response.arrayBuffer();
63293
63333
  }
63294
- const buffer = import_fs.default.readFileSync(filename);
63334
+ const buffer = import_fs2.default.readFileSync(filename);
63295
63335
  return buffer.buffer;
63296
63336
  }
63297
63337
  async function readFileAsText(filename) {
@@ -63299,7 +63339,7 @@ async function readFileAsText(filename) {
63299
63339
  const response = await fetch(filename);
63300
63340
  return await response.text();
63301
63341
  }
63302
- const text = import_fs.default.readFileSync(filename, "utf8");
63342
+ const text = import_fs2.default.readFileSync(filename, "utf8");
63303
63343
  return text;
63304
63344
  }
63305
63345
  async function requireFromFile(filename) {
@@ -63414,7 +63454,7 @@ async function loadAsText(url) {
63414
63454
  }
63415
63455
 
63416
63456
  // src/lib/utils/version.ts
63417
- var VERSION2 = true ? "4.0.0-beta.1" : "beta";
63457
+ var VERSION2 = true ? "4.0.0-beta.2" : "beta";
63418
63458
 
63419
63459
  // src/lib/parsers/basis-module-loader.ts
63420
63460
  var BASIS_EXTERNAL_LIBRARIES = {
@@ -35,7 +35,7 @@
35
35
  console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
36
36
  globalThis._loadersgl_.version = NPM_TAG;
37
37
  } else {
38
- globalThis._loadersgl_.version = "4.0.0-beta.1";
38
+ globalThis._loadersgl_.version = "4.0.0-beta.2";
39
39
  }
40
40
  }
41
41
  return globalThis._loadersgl_.version;
@@ -257,7 +257,7 @@
257
257
  }
258
258
 
259
259
  // src/lib/utils/version.ts
260
- var VERSION2 = true ? "4.0.0-beta.1" : "beta";
260
+ var VERSION2 = true ? "4.0.0-beta.2" : "beta";
261
261
 
262
262
  // src/lib/parsers/basis-module-loader.ts
263
263
  var BASIS_EXTERNAL_LIBRARIES = {
@@ -1,6 +1,6 @@
1
1
  (() => {
2
2
  // src/lib/utils/version.ts
3
- var VERSION = true ? "4.0.0-beta.1" : "beta";
3
+ var VERSION = true ? "4.0.0-beta.2" : "beta";
4
4
 
5
5
  // src/lib/parsers/parse-npy.ts
6
6
  var a = new Uint32Array([305419896]);