@zip.js/zip.js 2.7.58 → 2.7.60

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/deno.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@zip-js/zip-js",
3
- "version": "2.7.58",
3
+ "version": "2.7.59",
4
4
  "exports": {
5
5
  ".": "./index.js",
6
6
  "./data-uri": "./lib/zip-data-uri.js"
7
+ },
8
+ "lint": {
9
+ "exclude": [
10
+ "dist/*.js",
11
+ "*-inline.js",
12
+ "tests/vendor/*.js",
13
+ "index.cjs",
14
+ "index.min.js"
15
+ ]
7
16
  }
8
17
  }
package/eslint.config.mjs CHANGED
@@ -1,6 +1,17 @@
1
1
  import js from "@eslint/js";
2
2
 
3
3
  export default [
4
+ {
5
+ ignores: [
6
+ "**/node_modules/",
7
+ ".git/",
8
+ "dist/",
9
+ "**/*-inline.js",
10
+ "tests/vendor/*.js",
11
+ "index.cjs",
12
+ "index.min.js"
13
+ ]
14
+ },
4
15
  js.configs.recommended,
5
16
  {
6
17
  languageOptions: {
@@ -33,12 +44,6 @@ export default [
33
44
  "no-console": [
34
45
  "warn"
35
46
  ]
36
- },
37
- ignores: [
38
- "**/node_modules/",
39
- ".git/",
40
- "dist/",
41
- "**/*-inline.js"
42
- ]
47
+ }
43
48
  }
44
49
  ];
package/index.d.ts CHANGED
@@ -1,3 +1,163 @@
1
+ /**
2
+ * zip.js is a JavaScript open-source library (BSD-3-Clause license) for
3
+ * compressing and decompressing zip files. It has been designed to handle large amounts
4
+ * of data. It supports notably multi-core compression, native compression with
5
+ * compression streams, archives larger than 4GB with Zip64, split zip files and data
6
+ * encryption.
7
+ *
8
+ * @author Gildas Lormeau
9
+ * @license BSD-3-Clause
10
+ *
11
+ * @example
12
+ * Hello world
13
+ * ```js
14
+ * import {
15
+ * BlobReader,
16
+ * BlobWriter,
17
+ * TextReader,
18
+ * TextWriter,
19
+ * ZipReader,
20
+ * ZipWriter,
21
+ * } from from "@zip-js/zip-js";
22
+ *
23
+ * // ----
24
+ * // Write the zip file
25
+ * // ----
26
+ *
27
+ * // Creates a BlobWriter object where the zip content will be written.
28
+ * const zipFileWriter = new BlobWriter();
29
+ *
30
+ * // Creates a TextReader object storing the text of the entry to add in the zip
31
+ * // (i.e. "Hello world!").
32
+ * const helloWorldReader = new TextReader("Hello world!");
33
+ *
34
+ * // Creates a ZipWriter object writing data via `zipFileWriter`, adds the entry
35
+ * // "hello.txt" containing the text "Hello world!" via `helloWorldReader`, and
36
+ * // closes the writer.
37
+ * const zipWriter = new ZipWriter(zipFileWriter);
38
+ * await zipWriter.add("hello.txt", helloWorldReader);
39
+ * await zipWriter.close();
40
+ *
41
+ * // Retrieves the Blob object containing the zip content into `zipFileBlob`. It
42
+ * // is also returned by zipWriter.close() for more convenience.
43
+ * const zipFileBlob = await zipFileWriter.getData();
44
+ *
45
+ * // ----
46
+ * // Read the zip file
47
+ * // ----
48
+ *
49
+ * // Creates a BlobReader object used to read `zipFileBlob`.
50
+ * const zipFileReader = new BlobReader(zipFileBlob);
51
+ * // Creates a TextWriter object where the content of the first entry in the zip
52
+ * // will be written.
53
+ * const helloWorldWriter = new TextWriter();
54
+ *
55
+ * // Creates a ZipReader object reading the zip content via `zipFileReader`,
56
+ * // retrieves metadata (name, dates, etc.) of the first entry, retrieves its
57
+ * // content via `helloWorldWriter`, and closes the reader.
58
+ * const zipReader = new ZipReader(zipFileReader);
59
+ * const firstEntry = (await zipReader.getEntries()).shift();
60
+ * const helloWorldText = await firstEntry.getData(helloWorldWriter);
61
+ * await zipReader.close();
62
+ *
63
+ * // Displays "Hello world!".
64
+ * console.log(helloWorldText);
65
+ * ```
66
+ *
67
+ * @example
68
+ * Hello world with Streams
69
+ * ```js
70
+ * import {
71
+ * BlobReader,
72
+ * ZipReader,
73
+ * ZipWriter,
74
+ * } from "@zip-js/zip-js";
75
+ *
76
+ * // ----
77
+ * // Write the zip file
78
+ * // ----
79
+ *
80
+ * // Creates a TransformStream object, the zip content will be written in the
81
+ * // `writable` property.
82
+ * const zipFileStream = new TransformStream();
83
+ * // Creates a Promise object resolved to the zip content returned as a Blob
84
+ * // object retrieved from `zipFileStream.readable`.
85
+ * const zipFileBlobPromise = new Response(zipFileStream.readable).blob();
86
+ * // Creates a ReadableStream object storing the text of the entry to add in the
87
+ * // zip (i.e. "Hello world!").
88
+ * const helloWorldReadable = new Blob(["Hello world!"]).stream();
89
+ *
90
+ * // Creates a ZipWriter object writing data into `zipFileStream.writable`, adds
91
+ * // the entry "hello.txt" containing the text "Hello world!" retrieved from
92
+ * // `helloWorldReadable`, and closes the writer.
93
+ * const zipWriter = new ZipWriter(zipFileStream.writable);
94
+ * await zipWriter.add("hello.txt", helloWorldReadable);
95
+ * await zipWriter.close();
96
+ *
97
+ * // Retrieves the Blob object containing the zip content into `zipFileBlob`.
98
+ * const zipFileBlob = await zipFileBlobPromise;
99
+ *
100
+ * // ----
101
+ * // Read the zip file
102
+ * // ----
103
+ *
104
+ * // Creates a BlobReader object used to read `zipFileBlob`.
105
+ * const zipFileReader = new BlobReader(zipFileBlob);
106
+ * // Creates a TransformStream object, the content of the first entry in the zip
107
+ * // will be written in the `writable` property.
108
+ * const helloWorldStream = new TransformStream();
109
+ * // Creates a Promise object resolved to the content of the first entry returned
110
+ * // as text from `helloWorldStream.readable`.
111
+ * const helloWorldTextPromise = new Response(helloWorldStream.readable).text();
112
+ *
113
+ * // Creates a ZipReader object reading the zip content via `zipFileReader`,
114
+ * // retrieves metadata (name, dates, etc.) of the first entry, retrieves its
115
+ * // content into `helloWorldStream.writable`, and closes the reader.
116
+ * const zipReader = new ZipReader(zipFileReader);
117
+ * const firstEntry = (await zipReader.getEntries()).shift();
118
+ * await firstEntry.getData(helloWorldStream.writable);
119
+ * await zipReader.close();
120
+ *
121
+ * // Displays "Hello world!".
122
+ * const helloWorldText = await helloWorldTextPromise;
123
+ * console.log(helloWorldText);
124
+ * ```
125
+ *
126
+ * @example
127
+ * Adding concurrently multiple entries in a zip file
128
+ * ```js
129
+ * import {
130
+ * BlobWriter,
131
+ * HttpReader,
132
+ * TextReader,
133
+ * ZipWriter,
134
+ * } from "@zip-js/zip-js";
135
+ *
136
+ * const README_URL = "https://unpkg.com/@zip.js/zip.js/README.md";
137
+ * getZipFileBlob()
138
+ * .then(downloadFile);
139
+ *
140
+ * async function getZipFileBlob() {
141
+ * const zipWriter = new ZipWriter(new BlobWriter("application/zip"));
142
+ * await Promise.all([
143
+ * zipWriter.add("hello.txt", new TextReader("Hello world!")),
144
+ * zipWriter.add("README.md", new HttpReader(README_URL)),
145
+ * ]);
146
+ * return zipWriter.close();
147
+ * }
148
+ *
149
+ * function downloadFile(blob) {
150
+ * document.body.appendChild(Object.assign(document.createElement("a"), {
151
+ * download: "hello.zip",
152
+ * href: URL.createObjectURL(blob),
153
+ * textContent: "Download zip file",
154
+ * }));
155
+ * }
156
+ * ```
157
+ *
158
+ * @module
159
+ */
160
+
1
161
  /**
2
162
  * Represents the `FileSystemEntry` class.
3
163
  *
@@ -175,7 +335,7 @@ export interface dataHandler {
175
335
  /**
176
336
  * @param data The processed chunk of data.
177
337
  */
178
- (data: Uint8Array<ArrayBuffer>): void;
338
+ (data: Uint8Array): void;
179
339
  }
180
340
 
181
341
  /**
@@ -206,13 +366,13 @@ declare class EventBasedCodec {
206
366
  *
207
367
  * @param data The chunk of data to append.
208
368
  */
209
- push(data: Uint8Array<ArrayBuffer>): void;
369
+ push(data: Uint8Array): void;
210
370
  /**
211
371
  * The function called when a chunk of data has been compressed/decompressed.
212
372
  *
213
373
  * @param data The chunk of compressed/decompressed data.
214
374
  */
215
- ondata(data?: Uint8Array<ArrayBuffer>): void;
375
+ ondata(data?: Uint8Array): void;
216
376
  }
217
377
 
218
378
  /**
@@ -240,7 +400,7 @@ declare class SyncCodec {
240
400
  * @param data The chunk of decompressed data to append.
241
401
  * @returns A chunk of compressed data.
242
402
  */
243
- append(data: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
403
+ append(data: Uint8Array): Uint8Array;
244
404
  }
245
405
 
246
406
  /**
@@ -252,7 +412,7 @@ declare class ZipDeflate extends SyncCodec {
252
412
  *
253
413
  * @returns A chunk of compressed data.
254
414
  */
255
- flush(): Uint8Array<ArrayBuffer>;
415
+ flush(): Uint8Array;
256
416
  }
257
417
 
258
418
  /**
@@ -355,7 +515,7 @@ export class Reader<Type> implements Initializable, ReadableReader {
355
515
  * @param length The length of the data to read in bytes.
356
516
  * @returns A promise resolving to a chunk of data.
357
517
  */
358
- readUint8Array(index: number, length: number): Promise<Uint8Array<ArrayBuffer>>;
518
+ readUint8Array(index: number, length: number): Promise<Uint8Array>;
359
519
  }
360
520
 
361
521
  /**
@@ -376,7 +536,7 @@ export class Data64URIReader extends Reader<string> { }
376
536
  /**
377
537
  * Represents a {@link Reader} instance used to read data provided as a `Uint8Array` instance.
378
538
  */
379
- export class Uint8ArrayReader extends Reader<Uint8Array<ArrayBuffer>> { }
539
+ export class Uint8ArrayReader extends Reader<Uint8Array> { }
380
540
 
381
541
  /**
382
542
  * Represents a {@link Reader} instance used to read data provided as an array of {@link ReadableReader} instances (e.g. split zip files).
@@ -391,17 +551,22 @@ export class SplitZipReader extends SplitDataReader { }
391
551
  export class SplitDataReader
392
552
  extends Reader<Reader<unknown>[] | ReadableReader[] | ReadableStream[]> { }
393
553
 
554
+ /**
555
+ * Represents a URL stored into a `string`.
556
+ */
557
+ interface URLString extends String { }
558
+
394
559
  /**
395
560
  * Represents a {@link Reader} instance used to fetch data from a URL.
396
561
  */
397
- export class HttpReader extends Reader<string> {
562
+ export class HttpReader extends Reader<URLString> {
398
563
  /**
399
564
  * Creates the {@link HttpReader} instance
400
565
  *
401
566
  * @param url The URL of the data.
402
567
  * @param options The options.
403
568
  */
404
- constructor(url: string | URL, options?: HttpOptions);
569
+ constructor(url: URLString | URL, options?: HttpOptions);
405
570
  }
406
571
 
407
572
  /**
@@ -414,7 +579,7 @@ export class HttpRangeReader extends HttpReader {
414
579
  * @param url The URL of the data.
415
580
  * @param options The options.
416
581
  */
417
- constructor(url: string | URL, options?: HttpRangeOptions);
582
+ constructor(url: URLString | URL, options?: HttpRangeOptions);
418
583
  }
419
584
 
420
585
  /**
@@ -521,7 +686,7 @@ export class Writer<Type> implements Initializable, WritableWriter {
521
686
  *
522
687
  * @virtual
523
688
  */
524
- writeUint8Array(array: Uint8Array<ArrayBuffer>): Promise<void>;
689
+ writeUint8Array(array: Uint8Array): Promise<void>;
525
690
  /**
526
691
  * Retrieves all the written data
527
692
  *
@@ -617,7 +782,7 @@ export class SplitDataWriter implements Initializable, WritableWriter {
617
782
  /**
618
783
  * Represents a {@link Writer} instance used to retrieve the written data as a `Uint8Array` instance.
619
784
  */
620
- export class Uint8ArrayWriter extends Writer<Uint8Array<ArrayBuffer>> { }
785
+ export class Uint8ArrayWriter extends Writer<Uint8Array> { }
621
786
 
622
787
  /**
623
788
  * Represents an instance used to create an unzipped stream.
@@ -652,7 +817,7 @@ export class ZipReaderStream<T> {
652
817
  * The readable stream.
653
818
  */
654
819
  readable: ReadableStream<
655
- Omit<Entry, "getData"> & { readable?: ReadableStream<Uint8Array<ArrayBuffer>> }
820
+ Omit<Entry, "getData"> & { readable?: ReadableStream<Uint8Array> }
656
821
  >;
657
822
 
658
823
  /**
@@ -713,15 +878,15 @@ export class ZipReader<Type> {
713
878
  /**
714
879
  * The global comment of the zip file.
715
880
  */
716
- comment: Uint8Array<ArrayBuffer>;
881
+ comment: Uint8Array;
717
882
  /**
718
883
  * The data prepended before the zip file.
719
884
  */
720
- prependedData?: Uint8Array<ArrayBuffer>;
885
+ prependedData?: Uint8Array;
721
886
  /**
722
887
  * The data appended after the zip file.
723
888
  */
724
- appendedData?: Uint8Array<ArrayBuffer>;
889
+ appendedData?: Uint8Array;
725
890
  /**
726
891
  * Returns all the entries in the zip file
727
892
  *
@@ -783,12 +948,12 @@ export interface GetEntriesOptions {
783
948
  commentEncoding?: string;
784
949
  /**
785
950
  * The function called for decoding the filename and the comment of the entry.
786
- *
951
+ *
787
952
  * @param value The raw text value.
788
953
  * @param encoding The encoding of the text.
789
954
  * @returns The decoded text value or `undefined` if the raw text value should be decoded by zip.js.
790
955
  */
791
- decodeText?(value: Uint8Array<ArrayBuffer>, encoding: string): string | undefined;
956
+ decodeText?(value: Uint8Array, encoding: string): string | undefined;
792
957
  }
793
958
 
794
959
  /**
@@ -818,7 +983,7 @@ export interface ZipReaderOptions {
818
983
  /**
819
984
  * The password used to encrypt the content of the entry (raw).
820
985
  */
821
- rawPassword?: Uint8Array<ArrayBuffer>;
986
+ rawPassword?: Uint8Array;
822
987
  /**
823
988
  * The `AbortSignal` instance used to cancel the decompression.
824
989
  */
@@ -852,7 +1017,7 @@ export interface EntryMetaData {
852
1017
  /**
853
1018
  * The filename of the entry (raw).
854
1019
  */
855
- rawFilename: Uint8Array<ArrayBuffer>;
1020
+ rawFilename: Uint8Array;
856
1021
  /**
857
1022
  * `true` if the filename is encoded in UTF-8.
858
1023
  */
@@ -912,7 +1077,7 @@ export interface EntryMetaData {
912
1077
  /**
913
1078
  * The comment of the entry (raw).
914
1079
  */
915
- rawComment: Uint8Array<ArrayBuffer>;
1080
+ rawComment: Uint8Array;
916
1081
  /**
917
1082
  * `true` if the comment is encoded in UTF-8.
918
1083
  */
@@ -924,11 +1089,11 @@ export interface EntryMetaData {
924
1089
  /**
925
1090
  * The extra field.
926
1091
  */
927
- extraField?: Map<number, { type: number, data: Uint8Array<ArrayBuffer> }>;
1092
+ extraField?: Map<number, { type: number, data: Uint8Array }>;
928
1093
  /**
929
1094
  * The extra field (raw).
930
1095
  */
931
- rawExtraField: Uint8Array<ArrayBuffer>;
1096
+ rawExtraField: Uint8Array;
932
1097
  /**
933
1098
  * `true` if the entry is using Zip64.
934
1099
  */
@@ -1059,7 +1224,7 @@ export class ZipWriterStream {
1059
1224
  /**
1060
1225
  * The readable stream.
1061
1226
  */
1062
- readable: ReadableStream<Uint8Array<ArrayBuffer>>;
1227
+ readable: ReadableStream<Uint8Array>;
1063
1228
 
1064
1229
  /**
1065
1230
  * The ZipWriter property.
@@ -1092,7 +1257,7 @@ export class ZipWriterStream {
1092
1257
  * @returns The content of the zip file.
1093
1258
  */
1094
1259
  close(
1095
- comment?: Uint8Array<ArrayBuffer>,
1260
+ comment?: Uint8Array,
1096
1261
  options?: ZipWriterCloseOptions,
1097
1262
  ): Promise<unknown>;
1098
1263
  }
@@ -1165,7 +1330,7 @@ export class ZipWriter<Type> {
1165
1330
  * @param options The options.
1166
1331
  * @returns The content of the zip file.
1167
1332
  */
1168
- close(comment?: Uint8Array<ArrayBuffer>, options?: ZipWriterCloseOptions): Promise<Type>;
1333
+ close(comment?: Uint8Array, options?: ZipWriterCloseOptions): Promise<Type>;
1169
1334
  }
1170
1335
 
1171
1336
  /**
@@ -1195,7 +1360,7 @@ export interface ZipWriterAddDataOptions
1195
1360
  /**
1196
1361
  * The extra field of the entry.
1197
1362
  */
1198
- extraField?: Map<number, Uint8Array<ArrayBuffer>>;
1363
+ extraField?: Map<number, Uint8Array>;
1199
1364
  /**
1200
1365
  * The uncompressed size of the entry. This option is ignored if the {@link ZipWriterConstructorOptions#passThrough} option is not set to `true`.
1201
1366
  */
@@ -1274,7 +1439,7 @@ export interface ZipWriterConstructorOptions {
1274
1439
  /**
1275
1440
  * The password used to encrypt the content of the entry (raw).
1276
1441
  */
1277
- rawPassword?: Uint8Array<ArrayBuffer>;
1442
+ rawPassword?: Uint8Array;
1278
1443
  /**
1279
1444
  * The encryption strength (AES):
1280
1445
  * - 1: 128-bit encryption key
@@ -1338,7 +1503,7 @@ export interface ZipWriterConstructorOptions {
1338
1503
  versionMadeBy?: number;
1339
1504
  /**
1340
1505
  * `true` to mark the file names as UTF-8 setting the general purpose bit 11 in the header (see Appendix D - Language Encoding (EFS)), `false` to mark the names as compliant with the original IBM Code Page 437.
1341
- *
1506
+ *
1342
1507
  * Note that this does not ensure that the file names are in the correct encoding.
1343
1508
  *
1344
1509
  * @defaultValue true
@@ -1406,11 +1571,11 @@ export interface ZipWriterConstructorOptions {
1406
1571
  compressionMethod?: number
1407
1572
  /**
1408
1573
  * The function called for encoding the filename and the comment of the entry.
1409
- *
1574
+ *
1410
1575
  * @param text The text to encode.
1411
1576
  * @returns The encoded text or `undefined` if the text should be encoded by zip.js.
1412
1577
  */
1413
- encodeText?(text: string): Uint8Array<ArrayBuffer> | undefined;
1578
+ encodeText?(text: string): Uint8Array | undefined;
1414
1579
  }
1415
1580
 
1416
1581
  /**
@@ -1586,7 +1751,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
1586
1751
  * @param options The options.
1587
1752
  * @returns A promise resolving to a `Uint8Array` instance.
1588
1753
  */
1589
- getUint8Array(options?: EntryGetDataOptions): Promise<Uint8Array<ArrayBuffer>>;
1754
+ getUint8Array(options?: EntryGetDataOptions): Promise<Uint8Array>;
1590
1755
  /**
1591
1756
  * Retrieves the content of the entry via a `WritableStream` instance
1592
1757
  *
@@ -1636,7 +1801,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
1636
1801
  *
1637
1802
  * @param array The `Uint8Array` instance.
1638
1803
  */
1639
- replaceUint8Array(array: Uint8Array<ArrayBuffer>): void;
1804
+ replaceUint8Array(array: Uint8Array): void;
1640
1805
  /**
1641
1806
  * Replaces the content of the entry with a `ReadableStream` instance
1642
1807
  *
@@ -1720,9 +1885,9 @@ export class ZipDirectoryEntry extends ZipEntry {
1720
1885
  */
1721
1886
  addUint8Array(
1722
1887
  name: string,
1723
- array: Uint8Array<ArrayBuffer>,
1888
+ array: Uint8Array,
1724
1889
  options?: ZipWriterAddDataOptions,
1725
- ): ZipFileEntry<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
1890
+ ): ZipFileEntry<Uint8Array, Uint8Array>;
1726
1891
  /**
1727
1892
  * Adds an entry with content fetched from a URL
1728
1893
  *
@@ -1809,7 +1974,7 @@ export class ZipDirectoryEntry extends ZipEntry {
1809
1974
  * @param options The options.
1810
1975
  */
1811
1976
  importUint8Array(
1812
- array: Uint8Array<ArrayBuffer>,
1977
+ array: Uint8Array,
1813
1978
  options?: ZipReaderConstructorOptions,
1814
1979
  ): Promise<[ZipEntry]>;
1815
1980
  /**
@@ -1870,7 +2035,7 @@ export class ZipDirectoryEntry extends ZipEntry {
1870
2035
  */
1871
2036
  exportUint8Array(
1872
2037
  options?: ZipDirectoryEntryExportOptions,
1873
- ): Promise<Uint8Array<ArrayBuffer>>;
2038
+ ): Promise<Uint8Array>;
1874
2039
  /**
1875
2040
  * Creates a zip file via a `WritableStream` instance containing the entry and its descendants
1876
2041
  *
@@ -43,7 +43,6 @@ import {
43
43
  MESSAGE_CLOSE
44
44
  } from "./streams/codec-stream.js";
45
45
 
46
- // deno-lint-ignore valid-typeof
47
46
  let WEB_WORKERS_SUPPORTED = typeof Worker != UNDEFINED_TYPE;
48
47
 
49
48
  export {
@@ -241,7 +240,6 @@ let transferStreamsSupported = true;
241
240
  function getWebWorker(url, baseURL, workerData) {
242
241
  const workerOptions = { type: "module" };
243
242
  let scriptUrl, worker;
244
- // deno-lint-ignore valid-typeof
245
243
  if (typeof url == FUNCTION_TYPE) {
246
244
  url = url();
247
245
  }
@@ -56,7 +56,6 @@ const SALT_LENGTH = [8, 12, 16];
56
56
  const KEY_LENGTH = [16, 24, 32];
57
57
  const SIGNATURE_LENGTH = 10;
58
58
  const COUNTER_DEFAULT_VALUE = [0, 0, 0, 0];
59
- // deno-lint-ignore valid-typeof
60
59
  const CRYPTO_API_SUPPORTED = typeof crypto != UNDEFINED_TYPE;
61
60
  const subtle = CRYPTO_API_SUPPORTED && crypto.subtle;
62
61
  const SUBTLE_API_SUPPORTED = CRYPTO_API_SUPPORTED && typeof subtle != UNDEFINED_TYPE;
@@ -35,7 +35,6 @@ export {
35
35
  };
36
36
 
37
37
  function encodeText(value) {
38
- // deno-lint-ignore valid-typeof
39
38
  if (typeof TextEncoder == UNDEFINED_TYPE) {
40
39
  value = unescape(encodeURIComponent(value));
41
40
  const result = new Uint8Array(value.length);
@@ -42,10 +42,8 @@ function initShimAsyncCodec(library, options = {}, registerDataHandler) {
42
42
  }
43
43
 
44
44
  function objectHasOwn(object, propertyName) {
45
- // deno-lint-ignore valid-typeof
46
45
  return typeof Object.hasOwn === FUNCTION_TYPE ?
47
46
  Object.hasOwn(object, propertyName) :
48
- // deno-lint-ignore no-prototype-builtins
49
47
  object.hasOwnProperty(propertyName);
50
48
  }
51
49
 
@@ -53,7 +51,6 @@ function createCodecClass(constructor, constructorOptions, registerDataHandler)
53
51
  return class {
54
52
 
55
53
  constructor(options) {
56
- // deno-lint-ignore no-this-alias
57
54
  const codecAdapter = this;
58
55
  const onData = data => {
59
56
  if (codecAdapter.pendingData) {
@@ -1,3 +1,5 @@
1
+ /// <reference types="./../index.d.ts" />
2
+
1
3
  /*
2
4
  Copyright (c) 2022 Gildas Lormeau. All rights reserved.
3
5
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
4
4
  "author": "Gildas Lormeau",
5
5
  "license": "BSD-3-Clause",
6
- "version": "2.7.58",
6
+ "version": "2.7.60",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "zip",
@@ -37,7 +37,7 @@
37
37
  "build-fflate": "npm i --no-save fflate && npx rollup -c rollup-fflate.config.js",
38
38
  "build-fflate-dev": "npm i --no-save fflate && npx rollup -c rollup-fflate.config.dev.js",
39
39
  "build-doc-api": "npx typedoc",
40
- "build-markdown-docs": "npx typedoc --plugin typedoc-plugin-markdown --out ./docs",
40
+ "build-doc-markdown": "npx typedoc --plugin typedoc-plugin-markdown --out ./docs",
41
41
  "test-deno": "cd ./tests && deno test --allow-read ./deno-runner.js",
42
42
  "test-node": "cd ./tests && node ./node-runner.js",
43
43
  "test-bun": "cd ./tests && bun test ./bun-runner.js",
@@ -49,7 +49,6 @@
49
49
  "types": "./index.d.ts",
50
50
  "exports": {
51
51
  "./package.json": "./package.json",
52
- "./index.min.js": "./index.min.js",
53
52
  ".": {
54
53
  "import": {
55
54
  "types": "./index.d.ts",
@@ -60,13 +59,54 @@
60
59
  "default": "./index.cjs"
61
60
  }
62
61
  },
63
- "./data-uri.js": "./lib/zip-data-uri.js",
64
- "./lib/zip-fs.js": "./lib/zip-fs.js",
65
- "./lib/zip-full.js": "./lib/zip-full.js",
66
- "./lib/zip-no-worker-deflate.js": "./lib/zip-no-worker-deflate.js",
67
- "./lib/zip-no-worker-inflate.js": "./lib/zip-no-worker-inflate.js",
68
- "./lib/zip-no-worker.js": "./lib/zip-no-worker.js",
69
- "./lib/zip.js": "./lib/zip.js"
62
+ "./index.min.js": {
63
+ "import": {
64
+ "types": "./index.d.ts",
65
+ "default": "./index.min.js"
66
+ }
67
+ },
68
+ "./data-uri.js": {
69
+ "import": {
70
+ "types": "./index.d.ts",
71
+ "default": "./lib/zip-data-uri.js"
72
+ }
73
+ },
74
+ "./lib/zip-fs.js": {
75
+ "import": {
76
+ "types": "./lib/zip-fs.d.ts",
77
+ "default": "./lib/zip-fs.js"
78
+ }
79
+ },
80
+ "./lib/zip-full.js": {
81
+ "import": {
82
+ "types": "./lib/zip-full.d.ts",
83
+ "default": "./lib/zip-full.js"
84
+ }
85
+ },
86
+ "./lib/zip-no-worker-deflate.js": {
87
+ "import": {
88
+ "types": "./lib/zip-no-worker-deflate.d.ts",
89
+ "default": "./lib/zip-no-worker-deflate.js"
90
+ }
91
+ },
92
+ "./lib/zip-no-worker-inflate.js": {
93
+ "import": {
94
+ "types": "./lib/zip-no-worker-inflate.d.ts",
95
+ "default": "./lib/zip-no-worker-inflate.js"
96
+ }
97
+ },
98
+ "./lib/zip-no-worker.js": {
99
+ "import": {
100
+ "types": "./lib/zip-no-worker.d.ts",
101
+ "default": "./lib/zip-no-worker.js"
102
+ }
103
+ },
104
+ "./lib/zip.js": {
105
+ "import": {
106
+ "types": "./lib/zip.d.ts",
107
+ "default": "./lib/zip.js"
108
+ }
109
+ }
70
110
  },
71
111
  "repository": {
72
112
  "type": "git",
@@ -82,8 +122,8 @@
82
122
  "@rollup/plugin-terser": "^0.4.4",
83
123
  "eslint": "^9.23.0",
84
124
  "http-server": "^14.1.1",
85
- "rollup": "^4.37.0",
125
+ "rollup": "^4.38.0",
86
126
  "typedoc": "^0.28.1",
87
127
  "typedoc-plugin-markdown": "^4.6.0"
88
128
  }
89
- }
129
+ }