@zip.js/zip.js 2.13.0 → 2.13.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/deno.json +1 -1
- package/dist/zip-core-external.js +36 -12
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +36 -12
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +36 -12
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +36 -12
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +36 -12
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +36 -12
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +36 -12
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +36 -12
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +36 -12
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +36 -12
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +36 -12
- package/index-native.min.js +1 -1
- package/index.cjs +36 -12
- package/index.d.cts +6 -0
- package/index.d.ts +6 -0
- package/index.min.js +1 -1
- package/lib/core/codec-worker-web.js +35 -11
- package/lib/core/version.js +1 -1
- package/package.json +1 -1
|
@@ -3078,7 +3078,7 @@ async function runWebWorker(workerData, config) {
|
|
|
3078
3078
|
rejectResult = error => {
|
|
3079
3079
|
const { outputSize, workerOptions } = workerData;
|
|
3080
3080
|
workerOptions.outputSize = outputSize;
|
|
3081
|
-
if (isErrorObject(error)
|
|
3081
|
+
if (isErrorObject(error)) {
|
|
3082
3082
|
try {
|
|
3083
3083
|
error.outputSize = outputSize;
|
|
3084
3084
|
} catch {
|
|
@@ -3092,12 +3092,14 @@ async function runWebWorker(workerData, config) {
|
|
|
3092
3092
|
reader: null,
|
|
3093
3093
|
writer: null,
|
|
3094
3094
|
outputSize: 0,
|
|
3095
|
+
destinationFailed: false,
|
|
3096
|
+
destinationError: null,
|
|
3095
3097
|
resolveResult,
|
|
3096
3098
|
rejectResult,
|
|
3097
3099
|
result
|
|
3098
3100
|
});
|
|
3099
3101
|
const { readable, options } = workerData;
|
|
3100
|
-
const { writable, closed, abortPipe } = watchClosedStream(workerData.writable);
|
|
3102
|
+
const { writable, closed, abortPipe } = watchClosedStream(workerData.writable, workerData);
|
|
3101
3103
|
let streamsTransferred;
|
|
3102
3104
|
try {
|
|
3103
3105
|
streamsTransferred = sendMessage({
|
|
@@ -3140,7 +3142,18 @@ async function runWebWorker(workerData, config) {
|
|
|
3140
3142
|
} catch {
|
|
3141
3143
|
// ignored
|
|
3142
3144
|
}
|
|
3143
|
-
|
|
3145
|
+
const { outputSize, workerOptions, destinationFailed, destinationError } = workerData;
|
|
3146
|
+
workerOptions.outputSize = outputSize;
|
|
3147
|
+
const workerFailed = isErrorObject(error) && (error.codecImportFailed || error.workerStartupFailed);
|
|
3148
|
+
const reportedError = destinationFailed && !workerFailed ? destinationError : error;
|
|
3149
|
+
if (isErrorObject(reportedError)) {
|
|
3150
|
+
try {
|
|
3151
|
+
reportedError.outputSize = outputSize;
|
|
3152
|
+
} catch {
|
|
3153
|
+
// ignored
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
throw reportedError;
|
|
3144
3157
|
}
|
|
3145
3158
|
|
|
3146
3159
|
async function closeWritable() {
|
|
@@ -3154,12 +3167,27 @@ async function runWebWorker(workerData, config) {
|
|
|
3154
3167
|
}
|
|
3155
3168
|
}
|
|
3156
3169
|
|
|
3157
|
-
function watchClosedStream(writableSource) {
|
|
3170
|
+
function watchClosedStream(writableSource, workerData) {
|
|
3158
3171
|
const abortController = new AbortController();
|
|
3159
|
-
|
|
3172
|
+
let aborting;
|
|
3173
|
+
const { writable, readable } = new TransformStream({
|
|
3174
|
+
transform(chunk, controller) {
|
|
3175
|
+
workerData.outputSize += chunk.length;
|
|
3176
|
+
controller.enqueue(chunk);
|
|
3177
|
+
}
|
|
3178
|
+
});
|
|
3160
3179
|
const closed = readable.pipeTo(writableSource, { preventClose: true, preventAbort: true, signal: abortController.signal });
|
|
3161
|
-
closed.catch(
|
|
3162
|
-
|
|
3180
|
+
closed.catch(error => {
|
|
3181
|
+
if (!aborting) {
|
|
3182
|
+
Object.assign(workerData, { destinationFailed: true, destinationError: error });
|
|
3183
|
+
}
|
|
3184
|
+
});
|
|
3185
|
+
return {
|
|
3186
|
+
writable, closed, abortPipe: () => {
|
|
3187
|
+
aborting = true;
|
|
3188
|
+
abortController.abort();
|
|
3189
|
+
}
|
|
3190
|
+
};
|
|
3163
3191
|
}
|
|
3164
3192
|
|
|
3165
3193
|
function releaseWorkerStreams(workerData) {
|
|
@@ -3357,9 +3385,6 @@ async function onMessage({ data }, workerData) {
|
|
|
3357
3385
|
const stale = () => workerData.generation != generation;
|
|
3358
3386
|
try {
|
|
3359
3387
|
if (error) {
|
|
3360
|
-
if (error.outputSize !== UNDEFINED_VALUE) {
|
|
3361
|
-
workerData.outputSize = error.outputSize;
|
|
3362
|
-
}
|
|
3363
3388
|
fail(getResponseError(error, errorValue));
|
|
3364
3389
|
} else {
|
|
3365
3390
|
if (type == MESSAGE_PULL) {
|
|
@@ -3372,7 +3397,6 @@ async function onMessage({ data }, workerData) {
|
|
|
3372
3397
|
const chunk = new Uint8Array(value);
|
|
3373
3398
|
await writer.ready;
|
|
3374
3399
|
await writer.write(chunk);
|
|
3375
|
-
workerData.outputSize += chunk.length;
|
|
3376
3400
|
if (!stale()) {
|
|
3377
3401
|
sendMessage({ type: MESSAGE_ACK_DATA, messageId }, workerData);
|
|
3378
3402
|
}
|
|
@@ -9109,7 +9133,7 @@ function formatSupported(StreamClass, format) {
|
|
|
9109
9133
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9110
9134
|
*/
|
|
9111
9135
|
|
|
9112
|
-
const VERSION = "2.13.
|
|
9136
|
+
const VERSION = "2.13.1";
|
|
9113
9137
|
|
|
9114
9138
|
/*
|
|
9115
9139
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|