@loaders.gl/zip 4.2.0-alpha.5 → 4.2.0-beta.1

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/dist.dev.js CHANGED
@@ -6986,6 +6986,8 @@ var __exports__ = (() => {
6986
6986
  var import_jszip = __toESM(require_jszip_min(), 1);
6987
6987
  var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
6988
6988
  var ZipLoader = {
6989
+ dataType: null,
6990
+ batchType: null,
6989
6991
  id: "zip",
6990
6992
  module: "zip",
6991
6993
  name: "Zip Archive",
@@ -7136,11 +7138,14 @@ var __exports__ = (() => {
7136
7138
  var inputLength;
7137
7139
  var recordSize = 512;
7138
7140
  var Tar = class {
7141
+ written;
7142
+ out;
7143
+ blocks = [];
7144
+ length;
7139
7145
  /**
7140
7146
  * @param [recordsPerBlock]
7141
7147
  */
7142
7148
  constructor(recordsPerBlock) {
7143
- this.blocks = [];
7144
7149
  this.written = 0;
7145
7150
  blockSize = (recordsPerBlock || 20) * recordSize;
7146
7151
  this.out = clean(blockSize);
@@ -7257,11 +7262,6 @@ var __exports__ = (() => {
7257
7262
  recordsPerBlock: 20
7258
7263
  };
7259
7264
  var TarBuilder = class {
7260
- constructor(options) {
7261
- this.count = 0;
7262
- this.options = { ...TAR_BUILDER_OPTIONS, ...options };
7263
- this.tape = new tar_default(this.options.recordsPerBlock);
7264
- }
7265
7265
  static get properties() {
7266
7266
  return {
7267
7267
  id: "tar",
@@ -7272,6 +7272,13 @@ var __exports__ = (() => {
7272
7272
  options: TAR_BUILDER_OPTIONS
7273
7273
  };
7274
7274
  }
7275
+ options;
7276
+ tape;
7277
+ count = 0;
7278
+ constructor(options) {
7279
+ this.options = { ...TAR_BUILDER_OPTIONS, ...options };
7280
+ this.tape = new tar_default(this.options.recordsPerBlock);
7281
+ }
7275
7282
  /** Adds a file to the archive. */
7276
7283
  addFile(filename2, buffer) {
7277
7284
  this.tape.append(filename2, new Uint8Array(buffer));
@@ -7300,6 +7307,13 @@ var __exports__ = (() => {
7300
7307
  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
7301
7308
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
7302
7309
 
7310
+ // ../loader-utils/src/lib/module-utils/js-module-utils.ts
7311
+ function registerJSModules(modules) {
7312
+ globalThis.loaders ||= {};
7313
+ globalThis.loaders.modules ||= {};
7314
+ Object.assign(globalThis.loaders.modules, modules);
7315
+ }
7316
+
7303
7317
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
7304
7318
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
7305
7319
  byteLength = byteLength || arrayBuffer1.byteLength;
@@ -7527,10 +7541,11 @@ var __exports__ = (() => {
7527
7541
  // ../loader-utils/src/lib/files/node-file-facade.ts
7528
7542
  var NOT_IMPLEMENTED = new Error("Not implemented");
7529
7543
  var NodeFileFacade = class {
7544
+ handle;
7545
+ size = 0;
7546
+ bigsize = 0n;
7547
+ url = "";
7530
7548
  constructor(url, flags, mode) {
7531
- this.size = 0;
7532
- this.bigsize = 0n;
7533
- this.url = "";
7534
7549
  if (globalThis.loaders?.NodeFile) {
7535
7550
  return new globalThis.loaders.NodeFile(url, flags, mode);
7536
7551
  }
@@ -7569,10 +7584,6 @@ var __exports__ = (() => {
7569
7584
  var NodeFileSystemFacade = class {
7570
7585
  // implements FileSystem
7571
7586
  constructor(options) {
7572
- // DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)
7573
- // implements RandomAccessReadFileSystem
7574
- this.readable = true;
7575
- this.writable = true;
7576
7587
  if (globalThis.loaders?.NodeFileSystem) {
7577
7588
  return new globalThis.loaders.NodeFileSystem(options);
7578
7589
  }
@@ -7583,6 +7594,10 @@ var __exports__ = (() => {
7583
7594
  "Can't instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first."
7584
7595
  );
7585
7596
  }
7597
+ // DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)
7598
+ // implements RandomAccessReadFileSystem
7599
+ readable = true;
7600
+ writable = true;
7586
7601
  async openReadableFile(path, flags) {
7587
7602
  throw NOT_IMPLEMENTED2;
7588
7603
  }
@@ -7612,6 +7627,8 @@ var __exports__ = (() => {
7612
7627
 
7613
7628
  // ../loader-utils/src/lib/file-provider/file-handle-file.ts
7614
7629
  var FileHandleFile = class {
7630
+ /** The FileHandle from which data is provided */
7631
+ file;
7615
7632
  /** Create a new FileHandleFile */
7616
7633
  constructor(path, append = false) {
7617
7634
  this.file = new NodeFileFacade(path, append ? "a+" : "r");
@@ -8444,6 +8461,7 @@ var __exports__ = (() => {
8444
8461
 
8445
8462
  // ../crypto/src/lib/algorithms/crc32.ts
8446
8463
  var CRC32 = class {
8464
+ crc;
8447
8465
  constructor() {
8448
8466
  this.crc = ~0;
8449
8467
  }
@@ -8808,9 +8826,10 @@ var __exports__ = (() => {
8808
8826
 
8809
8827
  // ../crypto/src/lib/crc32-hash.ts
8810
8828
  var CRC32Hash = class extends Hash {
8829
+ name = "crc32";
8830
+ options;
8811
8831
  constructor(options = {}) {
8812
8832
  super();
8813
- this.name = "crc32";
8814
8833
  this.options = { crypto: {}, ...options };
8815
8834
  this.hashBatches = this.hashBatches.bind(this);
8816
8835
  }
@@ -9248,9 +9267,10 @@ var __exports__ = (() => {
9248
9267
 
9249
9268
  // ../crypto/src/lib/md5-hash.ts
9250
9269
  var MD5Hash = class extends Hash {
9270
+ name = "md5";
9271
+ options;
9251
9272
  constructor(options = {}) {
9252
9273
  super();
9253
- this.name = "md5";
9254
9274
  this.options = options;
9255
9275
  }
9256
9276
  /**
@@ -9387,7 +9407,8 @@ var __exports__ = (() => {
9387
9407
  this.decompressBatches = this.decompressBatches.bind(this);
9388
9408
  }
9389
9409
  /** Preloads any dynamic libraries. May enable sync functions */
9390
- async preload() {
9410
+ async preload(modules = {}) {
9411
+ registerJSModules(modules);
9391
9412
  return;
9392
9413
  }
9393
9414
  /** Asynchronously compress data */
@@ -9434,13 +9455,14 @@ var __exports__ = (() => {
9434
9455
  var import_pako = __toESM(require_pako(), 1);
9435
9456
  var import_zlib = __toESM(require_zlib(), 1);
9436
9457
  var DeflateCompression = class extends Compression {
9458
+ name = "deflate";
9459
+ extensions = [];
9460
+ contentEncodings = ["deflate"];
9461
+ isSupported = true;
9462
+ options;
9463
+ _chunks = [];
9437
9464
  constructor(options = {}) {
9438
9465
  super(options);
9439
- this.name = "deflate";
9440
- this.extensions = [];
9441
- this.contentEncodings = ["deflate"];
9442
- this.isSupported = true;
9443
- this._chunks = [];
9444
9466
  this.options = options;
9445
9467
  }
9446
9468
  async compress(input) {
@@ -9557,14 +9579,15 @@ var __exports__ = (() => {
9557
9579
  }
9558
9580
  };
9559
9581
  var ZipFileSystem = class {
9582
+ /** FileProvider instance promise */
9583
+ fileProvider = null;
9584
+ fileName;
9585
+ archive = null;
9560
9586
  /**
9561
9587
  * Constructor
9562
9588
  * @param file - instance of FileProvider or file path string
9563
9589
  */
9564
9590
  constructor(file) {
9565
- /** FileProvider instance promise */
9566
- this.fileProvider = null;
9567
- this.archive = null;
9568
9591
  if (typeof file === "string") {
9569
9592
  this.fileName = file;
9570
9593
  if (!isBrowser) {
@@ -9616,6 +9639,9 @@ var __exports__ = (() => {
9616
9639
  * @returns - Response with file data
9617
9640
  */
9618
9641
  async fetch(filename2) {
9642
+ if (this.fileName && filename2.indexOf(this.fileName) === 0) {
9643
+ filename2 = filename2.substring(this.fileName.length + 1);
9644
+ }
9619
9645
  let uncompressedFile;
9620
9646
  if (this.archive) {
9621
9647
  uncompressedFile = await this.archive.getFile(filename2, "http");
@@ -9673,6 +9699,8 @@ var __exports__ = (() => {
9673
9699
 
9674
9700
  // src/filesystems/IndexedArchive.ts
9675
9701
  var IndexedArchive = class {
9702
+ fileProvider;
9703
+ fileName;
9676
9704
  /**
9677
9705
  * Constructor
9678
9706
  * @param fileProvider - instance of a binary data reader