@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.
- package/dist/basis-worker-node.js +306 -266
- package/dist/basis-worker.js +2 -2
- package/dist/compressed-texture-worker.js +2 -2
- package/dist/crunch-worker.js +2 -2
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/ktx2-basis-writer-worker-node.js +306 -266
- package/dist/ktx2-basis-writer-worker.js +2 -2
- package/dist/npy-worker.js +1 -1
- package/package.json +7 -7
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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) {
|
|
@@ -63034,272 +63303,43 @@ function getContentLength(url) {
|
|
|
63034
63303
|
return isDataURL(url) ? url.length - "data:".length : null;
|
|
63035
63304
|
}
|
|
63036
63305
|
|
|
63037
|
-
// ../polyfills/src/node/images/encode-image.node.ts
|
|
63038
|
-
var import_save_pixels = __toModule(require_save_pixels());
|
|
63039
|
-
var import_ndarray = __toModule(require_ndarray());
|
|
63040
|
-
|
|
63041
|
-
// ../polyfills/src/node/buffer/to-array-buffer.node.ts
|
|
63042
|
-
function bufferToArrayBuffer(buffer) {
|
|
63043
|
-
if (Buffer.isBuffer(buffer)) {
|
|
63044
|
-
const typedArray = new Uint8Array(buffer);
|
|
63045
|
-
return typedArray.buffer;
|
|
63046
|
-
}
|
|
63047
|
-
return buffer;
|
|
63048
|
-
}
|
|
63049
|
-
|
|
63050
|
-
// ../polyfills/src/node/images/encode-image.node.ts
|
|
63051
|
-
function encodeImageToStreamNode(image, options) {
|
|
63052
|
-
const type = options.type ? options.type.replace("image/", "") : "jpeg";
|
|
63053
|
-
const pixels = (0, import_ndarray.default)(image.data, [image.width, image.height, 4], [4, image.width * 4, 1], 0);
|
|
63054
|
-
return (0, import_save_pixels.default)(pixels, type, options);
|
|
63055
|
-
}
|
|
63056
|
-
function encodeImageNode(image, options) {
|
|
63057
|
-
const imageStream = encodeImageToStreamNode(image, options);
|
|
63058
|
-
return new Promise((resolve) => {
|
|
63059
|
-
const buffers = [];
|
|
63060
|
-
imageStream.on("data", (buffer) => buffers.push(buffer));
|
|
63061
|
-
imageStream.on("end", () => {
|
|
63062
|
-
const buffer = Buffer.concat(buffers);
|
|
63063
|
-
resolve(bufferToArrayBuffer(buffer));
|
|
63064
|
-
});
|
|
63065
|
-
});
|
|
63066
|
-
}
|
|
63067
|
-
|
|
63068
|
-
// ../polyfills/src/node/images/parse-image.node.ts
|
|
63069
|
-
var import_get_pixels = __toModule(require_node_pixels());
|
|
63070
|
-
var NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
|
|
63071
|
-
async function parseImageNode(arrayBuffer, mimeType) {
|
|
63072
|
-
if (!mimeType) {
|
|
63073
|
-
throw new Error("MIMEType is required to parse image under Node.js");
|
|
63074
|
-
}
|
|
63075
|
-
const buffer = arrayBuffer instanceof Buffer ? arrayBuffer : Buffer.from(arrayBuffer);
|
|
63076
|
-
const ndarray2 = await getPixelsAsync(buffer, mimeType);
|
|
63077
|
-
return ndarray2;
|
|
63078
|
-
}
|
|
63079
|
-
function getPixelsAsync(buffer, mimeType) {
|
|
63080
|
-
return new Promise((resolve) => (0, import_get_pixels.default)(buffer, mimeType, (err, ndarray2) => {
|
|
63081
|
-
if (err) {
|
|
63082
|
-
throw err;
|
|
63083
|
-
}
|
|
63084
|
-
const shape = [...ndarray2.shape];
|
|
63085
|
-
const layers = ndarray2.shape.length === 4 ? ndarray2.shape.shift() : 1;
|
|
63086
|
-
const data = ndarray2.data instanceof Buffer ? new Uint8Array(ndarray2.data) : ndarray2.data;
|
|
63087
|
-
resolve({
|
|
63088
|
-
shape,
|
|
63089
|
-
data,
|
|
63090
|
-
width: ndarray2.shape[0],
|
|
63091
|
-
height: ndarray2.shape[1],
|
|
63092
|
-
components: ndarray2.shape[2],
|
|
63093
|
-
layers: layers ? [layers] : []
|
|
63094
|
-
});
|
|
63095
|
-
}));
|
|
63096
|
-
}
|
|
63097
|
-
|
|
63098
|
-
// ../polyfills/src/node/file/readable-stream.ts
|
|
63099
|
-
var import_web_streams_polyfill = __toModule(require_polyfill());
|
|
63100
|
-
delete global.ReadableStream;
|
|
63101
|
-
var ReadableStreamPolyfill = class extends import_web_streams_polyfill.ReadableStream {
|
|
63102
|
-
};
|
|
63103
|
-
|
|
63104
|
-
// ../polyfills/src/node/file/blob-stream-controller.ts
|
|
63105
|
-
var BlobStreamController = class {
|
|
63106
|
-
constructor(chunks) {
|
|
63107
|
-
this.isWorking = false;
|
|
63108
|
-
this.isCancelled = false;
|
|
63109
|
-
this.chunks = chunks;
|
|
63110
|
-
}
|
|
63111
|
-
start(controller) {
|
|
63112
|
-
this.work(controller);
|
|
63113
|
-
}
|
|
63114
|
-
async work(controller) {
|
|
63115
|
-
const { chunks } = this;
|
|
63116
|
-
this.isWorking = true;
|
|
63117
|
-
while (!this.isCancelled && (controller.desiredSize || 0) > 0) {
|
|
63118
|
-
let next;
|
|
63119
|
-
try {
|
|
63120
|
-
next = chunks.next();
|
|
63121
|
-
} catch (error) {
|
|
63122
|
-
controller.error(error);
|
|
63123
|
-
break;
|
|
63124
|
-
}
|
|
63125
|
-
if (next) {
|
|
63126
|
-
if (!next.done && !this.isCancelled) {
|
|
63127
|
-
controller.enqueue(next.value);
|
|
63128
|
-
} else {
|
|
63129
|
-
controller.close();
|
|
63130
|
-
}
|
|
63131
|
-
}
|
|
63132
|
-
}
|
|
63133
|
-
this.isWorking = false;
|
|
63134
|
-
}
|
|
63135
|
-
pull(controller) {
|
|
63136
|
-
if (!this.isWorking) {
|
|
63137
|
-
this.work(controller);
|
|
63138
|
-
}
|
|
63139
|
-
}
|
|
63140
|
-
cancel() {
|
|
63141
|
-
this.isCancelled = true;
|
|
63142
|
-
}
|
|
63143
|
-
};
|
|
63144
|
-
|
|
63145
|
-
// ../polyfills/src/node/file/blob-stream.ts
|
|
63146
|
-
var BlobStream = class extends ReadableStreamPolyfill {
|
|
63147
|
-
constructor(chunks) {
|
|
63148
|
-
super(new BlobStreamController(chunks.values()), { type: "bytes" });
|
|
63149
|
-
this._chunks = chunks;
|
|
63150
|
-
}
|
|
63151
|
-
async *[Symbol.asyncIterator](_options) {
|
|
63152
|
-
const reader = this.getReader();
|
|
63153
|
-
yield* this._chunks;
|
|
63154
|
-
reader.releaseLock();
|
|
63155
|
-
}
|
|
63156
|
-
};
|
|
63157
|
-
|
|
63158
|
-
// ../polyfills/src/node/file/blob.ts
|
|
63159
|
-
var BlobPolyfill = class {
|
|
63160
|
-
constructor(init = [], options = {}) {
|
|
63161
|
-
this.parts = [];
|
|
63162
|
-
this.size = 0;
|
|
63163
|
-
for (const part of init) {
|
|
63164
|
-
if (typeof part === "string") {
|
|
63165
|
-
const bytes = new TextEncoder().encode(part);
|
|
63166
|
-
this.parts.push(bytes);
|
|
63167
|
-
this.size += bytes.byteLength;
|
|
63168
|
-
} else if (part instanceof BlobPolyfill) {
|
|
63169
|
-
this.size += part.size;
|
|
63170
|
-
this.parts.push(...part.parts);
|
|
63171
|
-
} else if (part instanceof ArrayBuffer) {
|
|
63172
|
-
this.parts.push(new Uint8Array(part));
|
|
63173
|
-
this.size += part.byteLength;
|
|
63174
|
-
} else if (part instanceof Uint8Array) {
|
|
63175
|
-
this.parts.push(part);
|
|
63176
|
-
this.size += part.byteLength;
|
|
63177
|
-
} else if (ArrayBuffer.isView(part)) {
|
|
63178
|
-
const { buffer, byteOffset, byteLength } = part;
|
|
63179
|
-
this.parts.push(new Uint8Array(buffer, byteOffset, byteLength));
|
|
63180
|
-
this.size += byteLength;
|
|
63181
|
-
} else {
|
|
63182
|
-
const bytes = new TextEncoder().encode(String(part));
|
|
63183
|
-
this.parts.push(bytes);
|
|
63184
|
-
this.size += bytes.byteLength;
|
|
63185
|
-
}
|
|
63186
|
-
}
|
|
63187
|
-
this.type = readType(options.type);
|
|
63188
|
-
}
|
|
63189
|
-
slice(start = 0, end = this.size, type = "") {
|
|
63190
|
-
const { size, parts } = this;
|
|
63191
|
-
let offset = start < 0 ? Math.max(size + start, 0) : Math.min(start, size);
|
|
63192
|
-
let limit = end < 0 ? Math.max(size + end, 0) : Math.min(end, size);
|
|
63193
|
-
const span = Math.max(limit - offset, 0);
|
|
63194
|
-
const blob = new BlobPolyfill([], { type });
|
|
63195
|
-
if (span === 0) {
|
|
63196
|
-
return blob;
|
|
63197
|
-
}
|
|
63198
|
-
let blobSize = 0;
|
|
63199
|
-
const blobParts = [];
|
|
63200
|
-
for (const part of parts) {
|
|
63201
|
-
const { byteLength } = part;
|
|
63202
|
-
if (offset > 0 && byteLength <= offset) {
|
|
63203
|
-
offset -= byteLength;
|
|
63204
|
-
limit -= byteLength;
|
|
63205
|
-
} else {
|
|
63206
|
-
const chunk = part.subarray(offset, Math.min(byteLength, limit));
|
|
63207
|
-
blobParts.push(chunk);
|
|
63208
|
-
blobSize += chunk.byteLength;
|
|
63209
|
-
offset = 0;
|
|
63210
|
-
if (blobSize >= span) {
|
|
63211
|
-
break;
|
|
63212
|
-
}
|
|
63213
|
-
}
|
|
63214
|
-
}
|
|
63215
|
-
blob.parts = blobParts;
|
|
63216
|
-
blob.size = blobSize;
|
|
63217
|
-
return blob;
|
|
63218
|
-
}
|
|
63219
|
-
async arrayBuffer() {
|
|
63220
|
-
return this._toArrayBuffer();
|
|
63221
|
-
}
|
|
63222
|
-
async text() {
|
|
63223
|
-
const decoder = new TextDecoder();
|
|
63224
|
-
let text = "";
|
|
63225
|
-
for (const part of this.parts) {
|
|
63226
|
-
text += decoder.decode(part);
|
|
63227
|
-
}
|
|
63228
|
-
return text;
|
|
63229
|
-
}
|
|
63230
|
-
stream() {
|
|
63231
|
-
return new BlobStream(this.parts);
|
|
63232
|
-
}
|
|
63233
|
-
toString() {
|
|
63234
|
-
return "[object Blob]";
|
|
63235
|
-
}
|
|
63236
|
-
get [Symbol.toStringTag]() {
|
|
63237
|
-
return "Blob";
|
|
63238
|
-
}
|
|
63239
|
-
_toArrayBuffer() {
|
|
63240
|
-
const buffer = new ArrayBuffer(this.size);
|
|
63241
|
-
const bytes = new Uint8Array(buffer);
|
|
63242
|
-
let offset = 0;
|
|
63243
|
-
for (const part of this.parts) {
|
|
63244
|
-
bytes.set(part, offset);
|
|
63245
|
-
offset += part.byteLength;
|
|
63246
|
-
}
|
|
63247
|
-
return buffer;
|
|
63248
|
-
}
|
|
63249
|
-
};
|
|
63250
|
-
function readType(input = "") {
|
|
63251
|
-
const type = String(input).toLowerCase();
|
|
63252
|
-
return /[^\u0020-\u007E]/.test(type) ? "" : type;
|
|
63253
|
-
}
|
|
63254
|
-
|
|
63255
|
-
// ../polyfills/src/node/file/file.ts
|
|
63256
|
-
var FilePolyfill = class extends BlobPolyfill {
|
|
63257
|
-
constructor(init, name, options = {}) {
|
|
63258
|
-
super(init, options);
|
|
63259
|
-
this.name = "";
|
|
63260
|
-
this.webkitRelativePath = "";
|
|
63261
|
-
this.name = String(name).replace(/\//g, ":");
|
|
63262
|
-
this.lastModified = (options == null ? void 0 : options.lastModified) || Date.now();
|
|
63263
|
-
}
|
|
63264
|
-
get [Symbol.toStringTag]() {
|
|
63265
|
-
return "File";
|
|
63266
|
-
}
|
|
63267
|
-
};
|
|
63268
|
-
|
|
63269
63306
|
// ../polyfills/src/index.ts
|
|
63270
|
-
|
|
63271
|
-
|
|
63272
|
-
global_["TextEncoder"] = TextEncoder2;
|
|
63273
|
-
}
|
|
63274
|
-
var installTextDecoder = !isBrowser || !("TextDecoder" in global_);
|
|
63275
|
-
if (installTextDecoder) {
|
|
63276
|
-
global_["TextDecoder"] = TextDecoder2;
|
|
63307
|
+
if (isBrowser) {
|
|
63308
|
+
console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");
|
|
63277
63309
|
}
|
|
63278
|
-
if (!
|
|
63279
|
-
|
|
63310
|
+
if (!globalThis.TextEncoder) {
|
|
63311
|
+
globalThis.TextEncoder = TextEncoder2;
|
|
63280
63312
|
}
|
|
63281
|
-
if (!
|
|
63282
|
-
|
|
63313
|
+
if (!globalThis.TextDecoder) {
|
|
63314
|
+
globalThis.TextDecoder = TextDecoder2;
|
|
63283
63315
|
}
|
|
63284
|
-
if (!isBrowser && !("
|
|
63285
|
-
|
|
63316
|
+
if (!isBrowser && !("atob" in globalThis) && atob) {
|
|
63317
|
+
globalThis["atob"] = atob;
|
|
63286
63318
|
}
|
|
63287
|
-
if (!isBrowser && !("
|
|
63288
|
-
|
|
63319
|
+
if (!isBrowser && !("btoa" in globalThis) && btoa) {
|
|
63320
|
+
globalThis["btoa"] = btoa;
|
|
63289
63321
|
}
|
|
63290
|
-
|
|
63291
|
-
|
|
63322
|
+
globalThis.loaders = globalThis.loaders || {};
|
|
63323
|
+
globalThis.loaders.NodeFileSystem = NodeFileSystem;
|
|
63324
|
+
if (!isBrowser && !("_encodeImageNode" in globalThis) && encodeImageNode) {
|
|
63325
|
+
globalThis["_encodeImageNode"] = encodeImageNode;
|
|
63292
63326
|
}
|
|
63293
|
-
if (!isBrowser && !("
|
|
63294
|
-
|
|
63295
|
-
|
|
63296
|
-
if (!isBrowser && !("_parseImageNode" in global_) && parseImageNode) {
|
|
63297
|
-
global_["_parseImageNode"] = parseImageNode;
|
|
63298
|
-
global_["_imageFormatsNode"] = NODE_FORMAT_SUPPORT;
|
|
63327
|
+
if (!isBrowser && !("_parseImageNode" in globalThis) && parseImageNode) {
|
|
63328
|
+
globalThis["_parseImageNode"] = parseImageNode;
|
|
63329
|
+
globalThis["_imageFormatsNode"] = NODE_FORMAT_SUPPORT;
|
|
63299
63330
|
}
|
|
63300
63331
|
if (!("allSettled" in Promise)) {
|
|
63301
63332
|
Promise.allSettled = allSettled;
|
|
63302
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
|
+
}
|
|
63303
63343
|
|
|
63304
63344
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
63305
63345
|
function getVersion() {
|
|
@@ -63310,7 +63350,7 @@ function getVersion() {
|
|
|
63310
63350
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
63311
63351
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
63312
63352
|
} else {
|
|
63313
|
-
globalThis._loadersgl_.version = "4.0.0-beta.
|
|
63353
|
+
globalThis._loadersgl_.version = "4.0.0-beta.2";
|
|
63314
63354
|
}
|
|
63315
63355
|
}
|
|
63316
63356
|
return globalThis._loadersgl_.version;
|
|
@@ -63460,13 +63500,13 @@ __export(require_utils_node_exports, {
|
|
|
63460
63500
|
});
|
|
63461
63501
|
var import_module = __toModule(require("module"));
|
|
63462
63502
|
var import_path = __toModule(require("path"));
|
|
63463
|
-
var
|
|
63503
|
+
var import_fs2 = __toModule(require("fs"));
|
|
63464
63504
|
async function readFileAsArrayBuffer(filename) {
|
|
63465
63505
|
if (filename.startsWith("http")) {
|
|
63466
63506
|
const response = await fetch(filename);
|
|
63467
63507
|
return await response.arrayBuffer();
|
|
63468
63508
|
}
|
|
63469
|
-
const buffer =
|
|
63509
|
+
const buffer = import_fs2.default.readFileSync(filename);
|
|
63470
63510
|
return buffer.buffer;
|
|
63471
63511
|
}
|
|
63472
63512
|
async function readFileAsText(filename) {
|
|
@@ -63474,7 +63514,7 @@ async function readFileAsText(filename) {
|
|
|
63474
63514
|
const response = await fetch(filename);
|
|
63475
63515
|
return await response.text();
|
|
63476
63516
|
}
|
|
63477
|
-
const text =
|
|
63517
|
+
const text = import_fs2.default.readFileSync(filename, "utf8");
|
|
63478
63518
|
return text;
|
|
63479
63519
|
}
|
|
63480
63520
|
async function requireFromFile(filename) {
|
|
@@ -63667,7 +63707,7 @@ async function parseData({
|
|
|
63667
63707
|
}
|
|
63668
63708
|
|
|
63669
63709
|
// src/lib/utils/version.ts
|
|
63670
|
-
var VERSION2 = true ? "4.0.0-beta.
|
|
63710
|
+
var VERSION2 = true ? "4.0.0-beta.2" : "beta";
|
|
63671
63711
|
|
|
63672
63712
|
// src/lib/parsers/basis-module-loader.ts
|
|
63673
63713
|
var BASIS_EXTERNAL_LIBRARIES = {
|
package/dist/basis-worker.js
CHANGED
|
@@ -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.
|
|
38
|
+
globalThis._loadersgl_.version = "4.0.0-beta.2";
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
return globalThis._loadersgl_.version;
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
// src/lib/utils/version.ts
|
|
340
|
-
var VERSION2 = true ? "4.0.0-beta.
|
|
340
|
+
var VERSION2 = true ? "4.0.0-beta.2" : "beta";
|
|
341
341
|
|
|
342
342
|
// src/lib/parsers/basis-module-loader.ts
|
|
343
343
|
var BASIS_EXTERNAL_LIBRARIES = {
|