@zip.js/zip.js 2.6.63 → 2.6.64
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/.vscode/launch.json +18 -0
- package/package.json +1 -1
- package/.eslintrc.json +0 -43
- package/cli-deno/mc-zip.js +0 -185
- package/rollup-es5.config.dev.js +0 -199
- package/rollup-es5.config.js +0 -243
- package/rollup-fflate.config.dev.js +0 -124
- package/rollup-fflate.config.js +0 -162
- package/rollup.config.dev.js +0 -126
- package/rollup.config.js +0 -171
- package/tests/all/loader.html +0 -29
- package/tests/all/test-abort-signal-read.js +0 -34
- package/tests/all/test-abort-signal-write.js +0 -30
- package/tests/all/test-array.js +0 -29
- package/tests/all/test-base64.js +0 -25
- package/tests/all/test-blob.js +0 -31
- package/tests/all/test-common-js.cjs +0 -31
- package/tests/all/test-crc.js +0 -22
- package/tests/all/test-crypto.js +0 -47
- package/tests/all/test-custom-io.js +0 -61
- package/tests/all/test-data-descriptor-signature.js +0 -33
- package/tests/all/test-data-descriptor.js +0 -33
- package/tests/all/test-duplicated-filename.js +0 -24
- package/tests/all/test-empty.js +0 -16
- package/tests/all/test-extended-timestamp.js +0 -30
- package/tests/all/test-extra-field.js +0 -26
- package/tests/all/test-fflate-no-worker.js +0 -31
- package/tests/all/test-fflate.js +0 -29
- package/tests/all/test-fs-base64.js +0 -24
- package/tests/all/test-fs-export-options.js +0 -34
- package/tests/all/test-fs-http-import.js +0 -25
- package/tests/all/test-fs-http-reader.js +0 -24
- package/tests/all/test-fs-replace.js +0 -27
- package/tests/all/test-fs-streams.js +0 -24
- package/tests/all/test-fs-text.js +0 -21
- package/tests/all/test-fs-unzip-store.js +0 -25
- package/tests/all/test-fs.js +0 -24
- package/tests/all/test-http-crypto.js +0 -31
- package/tests/all/test-http-range.js +0 -18
- package/tests/all/test-http-split-zip.js +0 -37
- package/tests/all/test-http-zip64.js +0 -21
- package/tests/all/test-invalid-crc.js +0 -30
- package/tests/all/test-multiple-writers.js +0 -19
- package/tests/all/test-no-worker.js +0 -25
- package/tests/all/test-pako-no-worker.js +0 -31
- package/tests/all/test-pako.js +0 -29
- package/tests/all/test-parallel-reads.js +0 -53
- package/tests/all/test-parallel-writes-auto-buffered.js +0 -71
- package/tests/all/test-parallel-writes-ordered.js +0 -34
- package/tests/all/test-parallel-writes.js +0 -51
- package/tests/all/test-readable-stream.js +0 -23
- package/tests/all/test-readable-zip-stream.js +0 -20
- package/tests/all/test-safe-closing.js +0 -51
- package/tests/all/test-split-data.js +0 -38
- package/tests/all/test-split-zip.js +0 -41
- package/tests/all/test-store.js +0 -38
- package/tests/all/test-streams.js +0 -29
- package/tests/all/test-sw-worker.js +0 -31
- package/tests/all/test-sw.js +0 -44
- package/tests/all/test-worker-timeout.js +0 -22
- package/tests/all/test-wrapped.js +0 -72
- package/tests/all/test-writable-stream.js +0 -39
- package/tests/all/test-zip64-auto.js +0 -78
- package/tests/all/test-zip64-crypto.js +0 -35
- package/tests/all/test-zip64.js +0 -25
- package/tests/all/test-zipcrypto.js +0 -41
- package/tests/data/lorem-encrypted.zip +0 -0
- package/tests/data/lorem-invalid-crc.zip +0 -0
- package/tests/data/lorem-split.z01 +0 -0
- package/tests/data/lorem-split.z02 +0 -0
- package/tests/data/lorem-split.z03 +0 -0
- package/tests/data/lorem-split.z04 +0 -0
- package/tests/data/lorem-split.z05 +0 -0
- package/tests/data/lorem-split.z06 +0 -0
- package/tests/data/lorem-split.z07 +0 -0
- package/tests/data/lorem-split.zip +0 -0
- package/tests/data/lorem-store.zip +0 -0
- package/tests/data/lorem-zip64.zip +0 -0
- package/tests/data/lorem.txt +0 -1
- package/tests/data/lorem.zip +0 -0
- package/tests/deno-runner.js +0 -15
- package/tests/index.html +0 -21
- package/tests/node-runner.js +0 -40
- package/tests/tests-data.js +0 -55
- package/tests/vendor/fflate-es2019.min.js +0 -1
- package/tests/vendor/fflate.min.js +0 -1
- package/tests/vendor/pako.min.js +0 -2
- package/tests/vendor/pako_deflate.min.js +0 -2
- package/tests/vendor/pako_inflate.min.js +0 -2
- package/tests/web-runner.js +0 -50
- package/tsconfig.json +0 -6
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// You must install fflate (e.g. npm i fflate) before running this script
|
|
2
|
-
|
|
3
|
-
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
4
|
-
import replace from "@rollup/plugin-replace";
|
|
5
|
-
import fs from "fs";
|
|
6
|
-
|
|
7
|
-
const GLOBALS = "const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker } = typeof globalThis !== 'undefined' ? globalThis : this || self;";
|
|
8
|
-
const GLOBALS_WORKER = "const { Array, Object, Number, Math, Error, Uint8Array, Uint16Array, Uint32Array, Int32Array, Map, DataView, Promise, TextEncoder, crypto, postMessage, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream } = self;";
|
|
9
|
-
|
|
10
|
-
export default [{
|
|
11
|
-
input: "lib/z-worker-fflate.js",
|
|
12
|
-
output: [{
|
|
13
|
-
intro: GLOBALS_WORKER,
|
|
14
|
-
file: "lib/z-worker-inline.js",
|
|
15
|
-
format: "umd"
|
|
16
|
-
}],
|
|
17
|
-
plugins: [nodeResolve()]
|
|
18
|
-
}, {
|
|
19
|
-
input: "lib/z-worker-inline-template.js",
|
|
20
|
-
output: [{
|
|
21
|
-
file: "lib/z-worker-inline.js",
|
|
22
|
-
format: "es"
|
|
23
|
-
}],
|
|
24
|
-
plugins: [
|
|
25
|
-
replace({
|
|
26
|
-
preventAssignment: true,
|
|
27
|
-
"__workerCode__": () => fs.readFileSync("lib/z-worker-inline.js").toString()
|
|
28
|
-
})
|
|
29
|
-
]
|
|
30
|
-
}, {
|
|
31
|
-
input: ["lib/zip.js"],
|
|
32
|
-
output: [{
|
|
33
|
-
intro: GLOBALS,
|
|
34
|
-
file: "dist/zip.min.js",
|
|
35
|
-
format: "umd",
|
|
36
|
-
name: "zip"
|
|
37
|
-
}, {
|
|
38
|
-
intro: GLOBALS,
|
|
39
|
-
file: "dist/zip.js",
|
|
40
|
-
format: "umd",
|
|
41
|
-
name: "zip"
|
|
42
|
-
}],
|
|
43
|
-
plugins: [nodeResolve()]
|
|
44
|
-
}, {
|
|
45
|
-
input: ["lib/zip-full-fflate.js"],
|
|
46
|
-
output: [{
|
|
47
|
-
intro: GLOBALS,
|
|
48
|
-
file: "dist/zip-full.min.js",
|
|
49
|
-
format: "umd",
|
|
50
|
-
name: "zip"
|
|
51
|
-
}, {
|
|
52
|
-
intro: GLOBALS,
|
|
53
|
-
file: "dist/zip-full.js",
|
|
54
|
-
format: "umd",
|
|
55
|
-
name: "zip"
|
|
56
|
-
}],
|
|
57
|
-
plugins: [nodeResolve()]
|
|
58
|
-
}, {
|
|
59
|
-
input: "lib/zip-no-worker-fflate.js",
|
|
60
|
-
output: [{
|
|
61
|
-
intro: GLOBALS,
|
|
62
|
-
file: "dist/zip-no-worker.min.js",
|
|
63
|
-
format: "umd",
|
|
64
|
-
name: "zip"
|
|
65
|
-
}],
|
|
66
|
-
plugins: [nodeResolve()]
|
|
67
|
-
}, {
|
|
68
|
-
input: "lib/zip-no-worker-fflate-deflate.js",
|
|
69
|
-
output: [{
|
|
70
|
-
intro: GLOBALS,
|
|
71
|
-
file: "dist/zip-no-worker-deflate.min.js",
|
|
72
|
-
format: "umd",
|
|
73
|
-
name: "zip"
|
|
74
|
-
}],
|
|
75
|
-
plugins: [nodeResolve()]
|
|
76
|
-
}, {
|
|
77
|
-
input: "lib/zip-no-worker-fflate-inflate.js",
|
|
78
|
-
output: [{
|
|
79
|
-
intro: GLOBALS,
|
|
80
|
-
file: "dist/zip-no-worker-inflate.min.js",
|
|
81
|
-
format: "umd",
|
|
82
|
-
name: "zip"
|
|
83
|
-
}],
|
|
84
|
-
plugins: [nodeResolve()]
|
|
85
|
-
}, {
|
|
86
|
-
input: "lib/zip-fs.js",
|
|
87
|
-
output: [{
|
|
88
|
-
intro: GLOBALS,
|
|
89
|
-
file: "dist/zip-fs.min.js",
|
|
90
|
-
format: "umd",
|
|
91
|
-
name: "zip"
|
|
92
|
-
}, {
|
|
93
|
-
intro: GLOBALS,
|
|
94
|
-
file: "dist/zip-fs.js",
|
|
95
|
-
format: "umd",
|
|
96
|
-
name: "zip"
|
|
97
|
-
}],
|
|
98
|
-
plugins: [nodeResolve()]
|
|
99
|
-
}, {
|
|
100
|
-
input: "index-fflate.js",
|
|
101
|
-
output: [{
|
|
102
|
-
intro: GLOBALS,
|
|
103
|
-
file: "dist/zip-fs-full.min.js",
|
|
104
|
-
format: "umd",
|
|
105
|
-
name: "zip"
|
|
106
|
-
}, {
|
|
107
|
-
intro: GLOBALS,
|
|
108
|
-
file: "dist/zip-fs-full.js",
|
|
109
|
-
format: "umd",
|
|
110
|
-
name: "zip"
|
|
111
|
-
}, {
|
|
112
|
-
file: "index.cjs",
|
|
113
|
-
format: "cjs"
|
|
114
|
-
}],
|
|
115
|
-
plugins: [nodeResolve()]
|
|
116
|
-
}, {
|
|
117
|
-
input: "lib/z-worker-fflate.js",
|
|
118
|
-
output: [{
|
|
119
|
-
intro: GLOBALS_WORKER,
|
|
120
|
-
file: "dist/z-worker.js",
|
|
121
|
-
format: "iife"
|
|
122
|
-
}],
|
|
123
|
-
plugins: [nodeResolve()]
|
|
124
|
-
}];
|
package/rollup-fflate.config.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
// You must install fflate (e.g. npm i fflate) before running this script
|
|
2
|
-
|
|
3
|
-
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
4
|
-
import replace from "@rollup/plugin-replace";
|
|
5
|
-
import { terser } from "rollup-plugin-terser";
|
|
6
|
-
import fs from "fs";
|
|
7
|
-
|
|
8
|
-
const bundledTerserOptions = {
|
|
9
|
-
compress: {
|
|
10
|
-
unsafe: true,
|
|
11
|
-
unsafe_arrows: true,
|
|
12
|
-
unsafe_comps: true,
|
|
13
|
-
unsafe_symbols: true,
|
|
14
|
-
unsafe_proto: true,
|
|
15
|
-
keep_fargs: false,
|
|
16
|
-
passes: 3,
|
|
17
|
-
ecma: "2020"
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const inlineTerserOptions = {
|
|
22
|
-
compress: {
|
|
23
|
-
unsafe: true,
|
|
24
|
-
unsafe_arrows: true,
|
|
25
|
-
unsafe_comps: true,
|
|
26
|
-
unsafe_math: true,
|
|
27
|
-
unsafe_symbols: true,
|
|
28
|
-
unsafe_proto: true,
|
|
29
|
-
keep_fargs: false,
|
|
30
|
-
passes: 3,
|
|
31
|
-
ecma: "2020"
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const GLOBALS = "const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker } = typeof globalThis !== 'undefined' ? globalThis : this || self;";
|
|
36
|
-
const GLOBALS_WORKER = "const { Array, Object, Number, Math, Error, Uint8Array, Uint16Array, Uint32Array, Int32Array, Map, DataView, Promise, TextEncoder, crypto, postMessage, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream } = self;";
|
|
37
|
-
|
|
38
|
-
export default [{
|
|
39
|
-
input: "lib/z-worker-fflate.js",
|
|
40
|
-
output: [{
|
|
41
|
-
intro: GLOBALS_WORKER,
|
|
42
|
-
file: "lib/z-worker-inline.js",
|
|
43
|
-
format: "es",
|
|
44
|
-
plugins: [terser(inlineTerserOptions)]
|
|
45
|
-
}],
|
|
46
|
-
plugins: [nodeResolve()]
|
|
47
|
-
}, {
|
|
48
|
-
input: "lib/z-worker-inline-template.js",
|
|
49
|
-
output: [{
|
|
50
|
-
file: "lib/z-worker-inline.js",
|
|
51
|
-
format: "es"
|
|
52
|
-
}],
|
|
53
|
-
plugins: [
|
|
54
|
-
replace({
|
|
55
|
-
preventAssignment: true,
|
|
56
|
-
"__workerCode__": () => fs.readFileSync("lib/z-worker-inline.js").toString()
|
|
57
|
-
}),
|
|
58
|
-
terser(bundledTerserOptions)
|
|
59
|
-
]
|
|
60
|
-
}, {
|
|
61
|
-
input: ["lib/zip.js"],
|
|
62
|
-
output: [{
|
|
63
|
-
intro: GLOBALS,
|
|
64
|
-
file: "dist/zip.min.js",
|
|
65
|
-
format: "umd",
|
|
66
|
-
name: "zip",
|
|
67
|
-
plugins: [terser(bundledTerserOptions)]
|
|
68
|
-
}, {
|
|
69
|
-
intro: GLOBALS,
|
|
70
|
-
file: "dist/zip.js",
|
|
71
|
-
format: "umd",
|
|
72
|
-
name: "zip"
|
|
73
|
-
}],
|
|
74
|
-
plugins: [nodeResolve()]
|
|
75
|
-
}, {
|
|
76
|
-
input: ["lib/zip-full-fflate.js"],
|
|
77
|
-
output: [{
|
|
78
|
-
intro: GLOBALS,
|
|
79
|
-
file: "dist/zip-full.min.js",
|
|
80
|
-
format: "umd",
|
|
81
|
-
name: "zip",
|
|
82
|
-
plugins: [terser(bundledTerserOptions)]
|
|
83
|
-
}, {
|
|
84
|
-
intro: GLOBALS,
|
|
85
|
-
file: "dist/zip-full.js",
|
|
86
|
-
format: "umd",
|
|
87
|
-
name: "zip"
|
|
88
|
-
}],
|
|
89
|
-
plugins: [nodeResolve()]
|
|
90
|
-
}, {
|
|
91
|
-
input: "lib/zip-no-worker-fflate.js",
|
|
92
|
-
output: [{
|
|
93
|
-
intro: GLOBALS,
|
|
94
|
-
file: "dist/zip-no-worker.min.js",
|
|
95
|
-
format: "umd",
|
|
96
|
-
name: "zip",
|
|
97
|
-
plugins: [terser(bundledTerserOptions)]
|
|
98
|
-
}],
|
|
99
|
-
plugins: [nodeResolve()]
|
|
100
|
-
}, {
|
|
101
|
-
input: "lib/zip-no-worker-fflate-deflate.js",
|
|
102
|
-
output: [{
|
|
103
|
-
intro: GLOBALS,
|
|
104
|
-
file: "dist/zip-no-worker-deflate.min.js",
|
|
105
|
-
format: "umd",
|
|
106
|
-
name: "zip",
|
|
107
|
-
plugins: [terser(bundledTerserOptions)]
|
|
108
|
-
}],
|
|
109
|
-
plugins: [nodeResolve()]
|
|
110
|
-
}, {
|
|
111
|
-
input: "lib/zip-no-worker-fflate-inflate.js",
|
|
112
|
-
output: [{
|
|
113
|
-
intro: GLOBALS,
|
|
114
|
-
file: "dist/zip-no-worker-inflate.min.js",
|
|
115
|
-
format: "umd",
|
|
116
|
-
name: "zip",
|
|
117
|
-
plugins: [terser(bundledTerserOptions)]
|
|
118
|
-
}],
|
|
119
|
-
plugins: [nodeResolve()]
|
|
120
|
-
}, {
|
|
121
|
-
input: "lib/zip-fs.js",
|
|
122
|
-
output: [{
|
|
123
|
-
intro: GLOBALS,
|
|
124
|
-
file: "dist/zip-fs.min.js",
|
|
125
|
-
format: "umd",
|
|
126
|
-
name: "zip",
|
|
127
|
-
plugins: [terser(bundledTerserOptions)]
|
|
128
|
-
}, {
|
|
129
|
-
intro: GLOBALS,
|
|
130
|
-
file: "dist/zip-fs.js",
|
|
131
|
-
format: "umd",
|
|
132
|
-
name: "zip"
|
|
133
|
-
}],
|
|
134
|
-
plugins: [nodeResolve()]
|
|
135
|
-
}, {
|
|
136
|
-
input: "index-fflate.js",
|
|
137
|
-
output: [{
|
|
138
|
-
intro: GLOBALS,
|
|
139
|
-
file: "dist/zip-fs-full.min.js",
|
|
140
|
-
format: "umd",
|
|
141
|
-
name: "zip",
|
|
142
|
-
plugins: [terser(bundledTerserOptions)]
|
|
143
|
-
}, {
|
|
144
|
-
intro: GLOBALS,
|
|
145
|
-
file: "dist/zip-fs-full.js",
|
|
146
|
-
format: "umd",
|
|
147
|
-
name: "zip"
|
|
148
|
-
}, {
|
|
149
|
-
file: "index.cjs",
|
|
150
|
-
format: "cjs"
|
|
151
|
-
}],
|
|
152
|
-
plugins: [nodeResolve()]
|
|
153
|
-
}, {
|
|
154
|
-
input: "lib/z-worker-fflate.js",
|
|
155
|
-
output: [{
|
|
156
|
-
intro: GLOBALS_WORKER,
|
|
157
|
-
file: "dist/z-worker.js",
|
|
158
|
-
format: "iife",
|
|
159
|
-
plugins: [terser(bundledTerserOptions)]
|
|
160
|
-
}],
|
|
161
|
-
plugins: [nodeResolve()]
|
|
162
|
-
}];
|
package/rollup.config.dev.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import replace from "@rollup/plugin-replace";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
|
|
4
|
-
const GLOBALS = "const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker } = typeof globalThis !== 'undefined' ? globalThis : this || self;";
|
|
5
|
-
const GLOBALS_WORKER = "const { Array, Object, Number, Math, Error, Uint8Array, Uint16Array, Uint32Array, Int32Array, Map, DataView, Promise, TextEncoder, crypto, postMessage, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream } = self;";
|
|
6
|
-
|
|
7
|
-
export default [{
|
|
8
|
-
input: "lib/z-worker.js",
|
|
9
|
-
output: [{
|
|
10
|
-
intro: GLOBALS_WORKER,
|
|
11
|
-
file: "lib/z-worker-inline.js",
|
|
12
|
-
format: "umd"
|
|
13
|
-
}]
|
|
14
|
-
}, {
|
|
15
|
-
input: "lib/z-worker-inline-template.js",
|
|
16
|
-
output: [{
|
|
17
|
-
file: "lib/z-worker-inline.js",
|
|
18
|
-
format: "es"
|
|
19
|
-
}],
|
|
20
|
-
plugins: [
|
|
21
|
-
replace({
|
|
22
|
-
preventAssignment: true,
|
|
23
|
-
"__workerCode__": () => fs.readFileSync("lib/z-worker-inline.js").toString()
|
|
24
|
-
})
|
|
25
|
-
]
|
|
26
|
-
}, {
|
|
27
|
-
input: ["lib/zip.js"],
|
|
28
|
-
output: [{
|
|
29
|
-
intro: GLOBALS,
|
|
30
|
-
file: "dist/zip.min.js",
|
|
31
|
-
format: "umd",
|
|
32
|
-
name: "zip"
|
|
33
|
-
}, {
|
|
34
|
-
intro: GLOBALS,
|
|
35
|
-
file: "dist/zip.js",
|
|
36
|
-
format: "umd",
|
|
37
|
-
name: "zip"
|
|
38
|
-
}]
|
|
39
|
-
}, {
|
|
40
|
-
input: ["lib/zip-full.js"],
|
|
41
|
-
output: [{
|
|
42
|
-
intro: GLOBALS,
|
|
43
|
-
file: "dist/zip-full.min.js",
|
|
44
|
-
format: "umd",
|
|
45
|
-
name: "zip"
|
|
46
|
-
}, {
|
|
47
|
-
intro: GLOBALS,
|
|
48
|
-
file: "dist/zip-full.js",
|
|
49
|
-
format: "umd",
|
|
50
|
-
name: "zip"
|
|
51
|
-
}]
|
|
52
|
-
}, {
|
|
53
|
-
input: "lib/zip-no-worker.js",
|
|
54
|
-
output: [{
|
|
55
|
-
intro: GLOBALS,
|
|
56
|
-
file: "dist/zip-no-worker.min.js",
|
|
57
|
-
format: "umd",
|
|
58
|
-
name: "zip"
|
|
59
|
-
}]
|
|
60
|
-
}, {
|
|
61
|
-
input: "lib/zip-no-worker-deflate.js",
|
|
62
|
-
output: [{
|
|
63
|
-
intro: GLOBALS,
|
|
64
|
-
file: "dist/zip-no-worker-deflate.min.js",
|
|
65
|
-
format: "umd",
|
|
66
|
-
name: "zip"
|
|
67
|
-
}]
|
|
68
|
-
}, {
|
|
69
|
-
input: "lib/zip-no-worker-inflate.js",
|
|
70
|
-
output: [{
|
|
71
|
-
intro: GLOBALS,
|
|
72
|
-
file: "dist/zip-no-worker-inflate.min.js",
|
|
73
|
-
format: "umd",
|
|
74
|
-
name: "zip"
|
|
75
|
-
}]
|
|
76
|
-
}, {
|
|
77
|
-
input: "lib/zip-fs.js",
|
|
78
|
-
output: [{
|
|
79
|
-
intro: GLOBALS,
|
|
80
|
-
file: "dist/zip-fs.min.js",
|
|
81
|
-
format: "umd",
|
|
82
|
-
name: "zip"
|
|
83
|
-
}, {
|
|
84
|
-
intro: GLOBALS,
|
|
85
|
-
file: "dist/zip-fs.js",
|
|
86
|
-
format: "umd",
|
|
87
|
-
name: "zip"
|
|
88
|
-
}]
|
|
89
|
-
}, {
|
|
90
|
-
input: "index.js",
|
|
91
|
-
output: [{
|
|
92
|
-
intro: GLOBALS,
|
|
93
|
-
file: "dist/zip-fs-full.min.js",
|
|
94
|
-
format: "umd",
|
|
95
|
-
name: "zip"
|
|
96
|
-
}, {
|
|
97
|
-
intro: GLOBALS,
|
|
98
|
-
file: "dist/zip-fs-full.js",
|
|
99
|
-
format: "umd",
|
|
100
|
-
name: "zip"
|
|
101
|
-
}, {
|
|
102
|
-
file: "index.cjs",
|
|
103
|
-
format: "cjs"
|
|
104
|
-
}]
|
|
105
|
-
}, {
|
|
106
|
-
input: "lib/z-worker-bootstrap-pako.js",
|
|
107
|
-
output: [{
|
|
108
|
-
intro: GLOBALS_WORKER,
|
|
109
|
-
file: "dist/z-worker-pako.js",
|
|
110
|
-
format: "iife"
|
|
111
|
-
}]
|
|
112
|
-
}, {
|
|
113
|
-
input: "lib/z-worker-bootstrap-fflate.js",
|
|
114
|
-
output: [{
|
|
115
|
-
intro: GLOBALS_WORKER,
|
|
116
|
-
file: "dist/z-worker-fflate.js",
|
|
117
|
-
format: "iife"
|
|
118
|
-
}]
|
|
119
|
-
}, {
|
|
120
|
-
input: "lib/z-worker.js",
|
|
121
|
-
output: [{
|
|
122
|
-
intro: GLOBALS_WORKER,
|
|
123
|
-
file: "dist/z-worker.js",
|
|
124
|
-
format: "iife"
|
|
125
|
-
}]
|
|
126
|
-
}];
|
package/rollup.config.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import replace from "@rollup/plugin-replace";
|
|
2
|
-
import { terser } from "rollup-plugin-terser";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
|
|
5
|
-
const bundledTerserOptions = {
|
|
6
|
-
compress: {
|
|
7
|
-
unsafe: true,
|
|
8
|
-
unsafe_arrows: true,
|
|
9
|
-
unsafe_comps: true,
|
|
10
|
-
unsafe_symbols: true,
|
|
11
|
-
unsafe_proto: true,
|
|
12
|
-
keep_fargs: false,
|
|
13
|
-
passes: 3,
|
|
14
|
-
ecma: "2020"
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const inlineTerserOptions = {
|
|
19
|
-
compress: {
|
|
20
|
-
unsafe: true,
|
|
21
|
-
unsafe_arrows: true,
|
|
22
|
-
unsafe_comps: true,
|
|
23
|
-
unsafe_math: true,
|
|
24
|
-
unsafe_symbols: true,
|
|
25
|
-
unsafe_proto: true,
|
|
26
|
-
keep_fargs: false,
|
|
27
|
-
passes: 3,
|
|
28
|
-
ecma: "2020"
|
|
29
|
-
},
|
|
30
|
-
mangle: {
|
|
31
|
-
properties: {
|
|
32
|
-
reserved: ["codecType", "config", "salt", "iterations", "keys", "password", "encryptionStrength", "encrypted", "signed", "compressed", "level", "zipCrypto", "passwordVerification", "pull", "enqueue", "close", "messageId", "chunkSize", "highWaterMark", "useCompressionStream", "preventAbort", "CompressionStreamNative", "DecompressionStreamNative"]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const GLOBALS = "const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker } = typeof globalThis !== 'undefined' ? globalThis : this || self;";
|
|
38
|
-
const GLOBALS_WORKER = "const { Array, Object, Number, Math, Error, Uint8Array, Uint16Array, Uint32Array, Int32Array, Map, DataView, Promise, TextEncoder, crypto, postMessage, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream } = self;";
|
|
39
|
-
|
|
40
|
-
export default [{
|
|
41
|
-
input: "lib/z-worker.js",
|
|
42
|
-
output: [{
|
|
43
|
-
intro: GLOBALS_WORKER,
|
|
44
|
-
file: "lib/z-worker-inline.js",
|
|
45
|
-
format: "es",
|
|
46
|
-
plugins: [terser(inlineTerserOptions)]
|
|
47
|
-
}]
|
|
48
|
-
}, {
|
|
49
|
-
input: "lib/z-worker-inline-template.js",
|
|
50
|
-
output: [{
|
|
51
|
-
file: "lib/z-worker-inline.js",
|
|
52
|
-
format: "es"
|
|
53
|
-
}],
|
|
54
|
-
plugins: [
|
|
55
|
-
replace({
|
|
56
|
-
preventAssignment: true,
|
|
57
|
-
"__workerCode__": () => fs.readFileSync("lib/z-worker-inline.js").toString()
|
|
58
|
-
}),
|
|
59
|
-
terser(bundledTerserOptions)
|
|
60
|
-
]
|
|
61
|
-
}, {
|
|
62
|
-
input: ["lib/zip.js"],
|
|
63
|
-
output: [{
|
|
64
|
-
intro: GLOBALS,
|
|
65
|
-
file: "dist/zip.min.js",
|
|
66
|
-
format: "umd",
|
|
67
|
-
name: "zip",
|
|
68
|
-
plugins: [terser(bundledTerserOptions)]
|
|
69
|
-
}, {
|
|
70
|
-
intro: GLOBALS,
|
|
71
|
-
file: "dist/zip.js",
|
|
72
|
-
format: "umd",
|
|
73
|
-
name: "zip"
|
|
74
|
-
}]
|
|
75
|
-
}, {
|
|
76
|
-
input: ["lib/zip-full.js"],
|
|
77
|
-
output: [{
|
|
78
|
-
intro: GLOBALS,
|
|
79
|
-
file: "dist/zip-full.min.js",
|
|
80
|
-
format: "umd",
|
|
81
|
-
name: "zip",
|
|
82
|
-
plugins: [terser(bundledTerserOptions)]
|
|
83
|
-
}, {
|
|
84
|
-
intro: GLOBALS,
|
|
85
|
-
file: "dist/zip-full.js",
|
|
86
|
-
format: "umd",
|
|
87
|
-
name: "zip"
|
|
88
|
-
}]
|
|
89
|
-
}, {
|
|
90
|
-
input: "lib/zip-no-worker.js",
|
|
91
|
-
output: [{
|
|
92
|
-
intro: GLOBALS,
|
|
93
|
-
file: "dist/zip-no-worker.min.js",
|
|
94
|
-
format: "umd",
|
|
95
|
-
name: "zip",
|
|
96
|
-
plugins: [terser(bundledTerserOptions)]
|
|
97
|
-
}]
|
|
98
|
-
}, {
|
|
99
|
-
input: "lib/zip-no-worker-deflate.js",
|
|
100
|
-
output: [{
|
|
101
|
-
intro: GLOBALS,
|
|
102
|
-
file: "dist/zip-no-worker-deflate.min.js",
|
|
103
|
-
format: "umd",
|
|
104
|
-
name: "zip",
|
|
105
|
-
plugins: [terser(bundledTerserOptions)]
|
|
106
|
-
}]
|
|
107
|
-
}, {
|
|
108
|
-
input: "lib/zip-no-worker-inflate.js",
|
|
109
|
-
output: [{
|
|
110
|
-
intro: GLOBALS,
|
|
111
|
-
file: "dist/zip-no-worker-inflate.min.js",
|
|
112
|
-
format: "umd",
|
|
113
|
-
name: "zip",
|
|
114
|
-
plugins: [terser(bundledTerserOptions)]
|
|
115
|
-
}]
|
|
116
|
-
}, {
|
|
117
|
-
input: "lib/zip-fs.js",
|
|
118
|
-
output: [{
|
|
119
|
-
intro: GLOBALS,
|
|
120
|
-
file: "dist/zip-fs.min.js",
|
|
121
|
-
format: "umd",
|
|
122
|
-
name: "zip",
|
|
123
|
-
plugins: [terser(bundledTerserOptions)]
|
|
124
|
-
}, {
|
|
125
|
-
intro: GLOBALS,
|
|
126
|
-
file: "dist/zip-fs.js",
|
|
127
|
-
format: "umd",
|
|
128
|
-
name: "zip"
|
|
129
|
-
}]
|
|
130
|
-
}, {
|
|
131
|
-
input: "index.js",
|
|
132
|
-
output: [{
|
|
133
|
-
intro: GLOBALS,
|
|
134
|
-
file: "dist/zip-fs-full.min.js",
|
|
135
|
-
format: "umd",
|
|
136
|
-
name: "zip",
|
|
137
|
-
plugins: [terser(bundledTerserOptions)]
|
|
138
|
-
}, {
|
|
139
|
-
intro: GLOBALS,
|
|
140
|
-
file: "dist/zip-fs-full.js",
|
|
141
|
-
format: "umd",
|
|
142
|
-
name: "zip"
|
|
143
|
-
}, {
|
|
144
|
-
file: "index.cjs",
|
|
145
|
-
format: "cjs"
|
|
146
|
-
}]
|
|
147
|
-
}, {
|
|
148
|
-
input: "lib/z-worker-bootstrap-pako.js",
|
|
149
|
-
output: [{
|
|
150
|
-
intro: GLOBALS_WORKER,
|
|
151
|
-
file: "dist/z-worker-pako.js",
|
|
152
|
-
format: "iife",
|
|
153
|
-
plugins: [terser(bundledTerserOptions)]
|
|
154
|
-
}]
|
|
155
|
-
}, {
|
|
156
|
-
input: "lib/z-worker-bootstrap-fflate.js",
|
|
157
|
-
output: [{
|
|
158
|
-
intro: GLOBALS_WORKER,
|
|
159
|
-
file: "dist/z-worker-fflate.js",
|
|
160
|
-
format: "iife",
|
|
161
|
-
plugins: [terser(bundledTerserOptions)]
|
|
162
|
-
}]
|
|
163
|
-
}, {
|
|
164
|
-
input: "lib/z-worker.js",
|
|
165
|
-
output: [{
|
|
166
|
-
intro: GLOBALS_WORKER,
|
|
167
|
-
file: "dist/z-worker.js",
|
|
168
|
-
format: "iife",
|
|
169
|
-
plugins: [terser(bundledTerserOptions)]
|
|
170
|
-
}]
|
|
171
|
-
}];
|
package/tests/all/loader.html
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset='utf-8'>
|
|
6
|
-
<style>
|
|
7
|
-
body {
|
|
8
|
-
margin: 0;
|
|
9
|
-
}
|
|
10
|
-
</style>
|
|
11
|
-
</head>
|
|
12
|
-
|
|
13
|
-
<body>
|
|
14
|
-
...
|
|
15
|
-
<script>
|
|
16
|
-
const testData = JSON.parse(decodeURIComponent(location.hash.substring(1)));
|
|
17
|
-
const script = testData.script;
|
|
18
|
-
import(testData.script).then(async Module => {
|
|
19
|
-
try {
|
|
20
|
-
const result = await Module.test();
|
|
21
|
-
document.body.innerHTML = "ok";
|
|
22
|
-
parent.postMessage(JSON.stringify({ script }), "*");
|
|
23
|
-
} catch (error) {
|
|
24
|
-
parent.postMessage(JSON.stringify({ script, error: { message: error.message, stack: error.stack } }), "*");
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
</script>
|
|
29
|
-
</body>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* global Blob, AbortController */
|
|
2
|
-
|
|
3
|
-
import * as zip from "../../index.js";
|
|
4
|
-
|
|
5
|
-
const TEXT_CONTENT = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.";
|
|
6
|
-
const FILENAME = "lorem.txt";
|
|
7
|
-
const BLOB = new Blob([TEXT_CONTENT], { type: zip.getMimeType(FILENAME) });
|
|
8
|
-
|
|
9
|
-
export { test };
|
|
10
|
-
|
|
11
|
-
async function test() {
|
|
12
|
-
zip.configure({ chunkSize: 128, useWebWorkers: true });
|
|
13
|
-
const blobWriter = new zip.BlobWriter("application/zip");
|
|
14
|
-
const zipWriter = new zip.ZipWriter(blobWriter);
|
|
15
|
-
await zipWriter.add(FILENAME, new zip.BlobReader(BLOB));
|
|
16
|
-
await zipWriter.close();
|
|
17
|
-
const zipReader = new zip.ZipReader(new zip.BlobReader(await blobWriter.getData()));
|
|
18
|
-
const entries = await zipReader.getEntries();
|
|
19
|
-
const controller = new AbortController();
|
|
20
|
-
const signal = controller.signal;
|
|
21
|
-
try {
|
|
22
|
-
await entries[0].getData(new zip.BlobWriter(zip.getMimeType(entries[0].filename)), {
|
|
23
|
-
onstart: () => controller.abort(),
|
|
24
|
-
signal
|
|
25
|
-
});
|
|
26
|
-
await zipReader.close();
|
|
27
|
-
} catch (error) {
|
|
28
|
-
if (signal.reason == error || signal.reason.code == error.code) {
|
|
29
|
-
zip.terminateWorkers();
|
|
30
|
-
} else {
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* global Blob, AbortController */
|
|
2
|
-
|
|
3
|
-
import * as zip from "../../index.js";
|
|
4
|
-
|
|
5
|
-
const TEXT_CONTENT = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.";
|
|
6
|
-
const FILENAME = "lorem.txt";
|
|
7
|
-
const BLOB = new Blob([TEXT_CONTENT], { type: zip.getMimeType(FILENAME) });
|
|
8
|
-
|
|
9
|
-
export { test };
|
|
10
|
-
|
|
11
|
-
async function test() {
|
|
12
|
-
zip.configure({ chunkSize: 128, useWebWorkers: true });
|
|
13
|
-
const blobWriter = new zip.BlobWriter("application/zip");
|
|
14
|
-
const zipWriter = new zip.ZipWriter(blobWriter);
|
|
15
|
-
const controller = new AbortController();
|
|
16
|
-
const signal = controller.signal;
|
|
17
|
-
try {
|
|
18
|
-
await zipWriter.add(FILENAME, new zip.BlobReader(BLOB), {
|
|
19
|
-
onprogress: () => controller.abort(),
|
|
20
|
-
signal
|
|
21
|
-
});
|
|
22
|
-
await zipWriter.close();
|
|
23
|
-
} catch (error) {
|
|
24
|
-
if (signal.reason == error || signal.reason.code == error.code) {
|
|
25
|
-
zip.terminateWorkers();
|
|
26
|
-
} else {
|
|
27
|
-
throw error;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|