@zip.js/zip.js 2.8.41 → 2.8.42

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 (45) hide show
  1. package/README.md +37 -0
  2. package/deno.json +6 -2
  3. package/dist/README.md +10 -1
  4. package/dist/zip-core-external.js +8180 -0
  5. package/dist/zip-core-external.min.js +1 -0
  6. package/dist/zip-core.js +55 -3
  7. package/dist/zip-core.min.js +1 -1
  8. package/dist/zip-fs-core-external.js +9196 -0
  9. package/dist/zip-fs-core-external.min.js +1 -0
  10. package/dist/zip-fs-core.js +55 -3
  11. package/dist/zip-fs-core.min.js +1 -1
  12. package/dist/zip-fs-external.js +10833 -0
  13. package/dist/zip-fs-external.min.js +1 -0
  14. package/dist/zip-fs-native.js +57 -5
  15. package/dist/zip-fs-native.min.js +1 -1
  16. package/dist/zip-fs.js +131 -24
  17. package/dist/zip-fs.min.js +1 -1
  18. package/dist/zip-legacy.js +57 -5
  19. package/dist/zip-legacy.min.js +1 -1
  20. package/dist/zip-native.js +57 -5
  21. package/dist/zip-native.min.js +1 -1
  22. package/dist/zip-web-worker-native.js +1 -1
  23. package/dist/zip-web-worker.js +1 -1
  24. package/dist/zip.js +131 -24
  25. package/dist/zip.min.js +1 -1
  26. package/index-native.cjs +57 -5
  27. package/index-native.min.js +1 -1
  28. package/index.cjs +131 -24
  29. package/index.min.js +1 -1
  30. package/lib/core/codec-worker.js +4 -1
  31. package/lib/core/external-assets.js +42 -0
  32. package/lib/core/streams/zip-entry-stream.js +51 -2
  33. package/lib/core/streams/zlib-wasm/zlib-streams-loader.js +27 -17
  34. package/lib/core/streams/zlib-wasm/zlib-streams.js +14 -1
  35. package/lib/core/web-worker-base.js +6 -2
  36. package/lib/core/web-worker-inline-native.js +1 -1
  37. package/lib/core/web-worker-inline-wasm.js +1 -1
  38. package/lib/zip-core-external.js +34 -0
  39. package/lib/zip-fs-core-external.js +30 -0
  40. package/lib/zip-fs-external.js +30 -0
  41. package/lib/zip-mime-types.js +29 -0
  42. package/lib/zip-module-wasm-base.js +64 -0
  43. package/lib/zip-module-wasm.js +1 -31
  44. package/package.json +63 -2
  45. package/worker-message-property-names.js +1 -1
@@ -0,0 +1,64 @@
1
+ /*
2
+ Copyright (c) 2025 Gildas Lormeau. All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in
12
+ the documentation and/or other materials provided with the distribution.
13
+
14
+ 3. The names of the authors may not be used to endorse or promote products
15
+ derived from this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
18
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
20
+ INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
21
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+
29
+ import { FUNCTION_TYPE } from "./core/constants.js";
30
+ import { setDefaultConfiguration } from "./core/configuration.js";
31
+ import { configureWorker } from "./core/codec-worker.js";
32
+ import { terminateWorkers } from "./core/codec-pool.js";
33
+ import { initModule, resetWasmModule, CompressionStreamZlib, DecompressionStreamZlib } from "./core/streams/zlib-wasm/zlib-streams-loader.js";
34
+
35
+ let modulePromise;
36
+
37
+ configureWorker({
38
+ initModule: config => {
39
+ if (!modulePromise) {
40
+ let { wasmURI } = config;
41
+ // deno-lint-ignore valid-typeof
42
+ if (typeof wasmURI == FUNCTION_TYPE) {
43
+ wasmURI = wasmURI();
44
+ }
45
+ modulePromise = initModule(wasmURI, config).catch(error => {
46
+ modulePromise = null;
47
+ throw error;
48
+ });
49
+ }
50
+ return modulePromise;
51
+ }
52
+ });
53
+ setDefaultConfiguration({
54
+ CompressionStreamZlib,
55
+ DecompressionStreamZlib
56
+ });
57
+
58
+ export { terminateWorkersAndModule as terminateWorkers };
59
+
60
+ function terminateWorkersAndModule() {
61
+ modulePromise = null;
62
+ terminateWorkers();
63
+ resetWasmModule();
64
+ }
@@ -26,39 +26,9 @@
26
26
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
  */
28
28
 
29
- import { FUNCTION_TYPE } from "./core/constants.js";
30
29
  import { setDefaultConfiguration } from "./core/configuration.js";
31
30
  import { configureZlibModule } from "./core/zlib-streams-inline.js";
32
- import { configureWorker } from "./core/codec-worker.js";
33
- import { terminateWorkers } from "./core/codec-pool.js";
34
- import { initModule, resetWasmModule, CompressionStreamZlib, DecompressionStreamZlib } from "./core/streams/zlib-wasm/zlib-streams-loader.js";
35
-
36
- let modulePromise;
37
31
 
38
32
  configureZlibModule(setDefaultConfiguration);
39
- configureWorker({
40
- initModule: config => {
41
- if (!modulePromise) {
42
- let { wasmURI } = config;
43
- // deno-lint-ignore valid-typeof
44
- if (typeof wasmURI == FUNCTION_TYPE) {
45
- wasmURI = wasmURI();
46
- }
47
- modulePromise = initModule(wasmURI, config);
48
-
49
- }
50
- return modulePromise;
51
- }
52
- });
53
- setDefaultConfiguration({
54
- CompressionStreamZlib,
55
- DecompressionStreamZlib
56
- });
57
-
58
- export { terminateWorkersAndModule as terminateWorkers };
59
33
 
60
- function terminateWorkersAndModule() {
61
- modulePromise = null;
62
- terminateWorkers();
63
- resetWasmModule();
64
- }
34
+ export * from "./zip-module-wasm-base.js";
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.8.41",
6
+ "version": "2.8.42",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "zip",
@@ -71,6 +71,66 @@
71
71
  "default": "./index.cjs"
72
72
  }
73
73
  },
74
+ "./external": {
75
+ "import": {
76
+ "types": "./index.d.ts",
77
+ "default": "./lib/zip-fs-external.js"
78
+ }
79
+ },
80
+ "./mime-types": {
81
+ "import": {
82
+ "types": "./index.d.ts",
83
+ "default": "./lib/zip-mime-types.js"
84
+ }
85
+ },
86
+ "./lib/zip-core-external.js": {
87
+ "import": {
88
+ "types": "./index.d.ts",
89
+ "default": "./lib/zip-core-external.js"
90
+ }
91
+ },
92
+ "./lib/zip-fs-core-external.js": {
93
+ "import": {
94
+ "types": "./index.d.ts",
95
+ "default": "./lib/zip-fs-core-external.js"
96
+ }
97
+ },
98
+ "./dist/zip-fs-external.js": {
99
+ "import": {
100
+ "types": "./index.d.ts",
101
+ "default": "./dist/zip-fs-external.js"
102
+ }
103
+ },
104
+ "./dist/zip-fs-external.min.js": {
105
+ "import": {
106
+ "types": "./index.d.ts",
107
+ "default": "./dist/zip-fs-external.min.js"
108
+ }
109
+ },
110
+ "./dist/zip-fs-core-external.js": {
111
+ "import": {
112
+ "types": "./index.d.ts",
113
+ "default": "./dist/zip-fs-core-external.js"
114
+ }
115
+ },
116
+ "./dist/zip-fs-core-external.min.js": {
117
+ "import": {
118
+ "types": "./index.d.ts",
119
+ "default": "./dist/zip-fs-core-external.min.js"
120
+ }
121
+ },
122
+ "./dist/zip-core-external.js": {
123
+ "import": {
124
+ "types": "./index.d.ts",
125
+ "default": "./dist/zip-core-external.js"
126
+ }
127
+ },
128
+ "./dist/zip-core-external.min.js": {
129
+ "import": {
130
+ "types": "./index.d.ts",
131
+ "default": "./dist/zip-core-external.min.js"
132
+ }
133
+ },
74
134
  "./index-native.js": {
75
135
  "import": {
76
136
  "types": "./index.d.ts",
@@ -179,6 +239,7 @@
179
239
  "rollup": "^4.62.4",
180
240
  "typedoc": "^0.28.20",
181
241
  "typedoc-plugin-markdown": "^4.12.0",
182
- "web-streams-polyfill": "^4.3.0"
242
+ "web-streams-polyfill": "^4.3.0",
243
+ "web-worker": "^1.5.0"
183
244
  }
184
245
  }
@@ -1,3 +1,3 @@
1
- const WORKER_MESSAGE_PROPERTY_NAMES = ["baseURI", "checkPasswordOnly", "chunkSize", "code", "codecType", "codecURI", "compressed", "compressionMethod", "config", "deflate64", "done", "encrypted", "encryptionStrength", "error", "format", "inputSize", "level", "message", "messageId", "name", "options", "outputSize", "password", "passwordVerification", "rawBitFlag", "rawPassword", "readable", "result", "signature", "signed", "stack", "transferStreams", "type", "useCompressionStream", "useWebWorkers", "value", "wasmURI", "workerStartupTimeout", "writable", "zipCrypto"];
1
+ const WORKER_MESSAGE_PROPERTY_NAMES = ["baseURI", "cause", "checkPasswordOnly", "chunkSize", "code", "codecType", "codecURI", "compressed", "compressionMethod", "config", "deflate64", "done", "encrypted", "encryptionStrength", "error", "format", "inputSize", "level", "message", "messageId", "name", "options", "outputSize", "password", "passwordVerification", "rawBitFlag", "rawPassword", "readable", "result", "signature", "signed", "stack", "transferStreams", "type", "useCompressionStream", "useWebWorkers", "value", "wasmURI", "workerStartupTimeout", "writable", "zipCrypto"];
2
2
 
3
3
  export { WORKER_MESSAGE_PROPERTY_NAMES };