@smoothdeploy/playwright 1.60.1 → 1.62.0
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/lib/agents/copilot-setup-steps.yml +2 -2
- package/lib/agents/generateAgents.js +48 -0
- package/lib/cli/reportActions.js +2 -2
- package/lib/cli/testActions.js +2 -0
- package/lib/common/index.js +246 -187
- package/lib/common/index.js.txt +13 -14
- package/lib/errorContext.js +2 -3
- package/lib/index.js +48 -21
- package/lib/loader/loaderProcessEntry.js +1 -1
- package/lib/matchers/expect.js +4830 -4394
- package/lib/matchers/expect.js.LICENSE +87 -140
- package/lib/matchers/expect.js.txt +30 -35
- package/lib/mcp/test/testContext.js +5 -1
- package/lib/program.js +28 -3
- package/lib/runner/index.js +400 -194
- package/lib/runner/index.js.txt +19 -18
- package/lib/transform/babelBundle.js +12899 -11654
- package/lib/transform/babelBundle.js.LICENSE +379 -354
- package/lib/transform/babelBundle.js.txt +39 -39
- package/lib/transform/esmLoader.js +3275 -1154
- package/lib/transform/esmLoader.js.LICENSE +81 -61
- package/lib/transform/esmLoader.js.txt +23 -18
- package/lib/util.js +14 -44
- package/lib/worker/workerProcessEntry.js +60 -1461
- package/lib/worker/workerProcessEntry.js.txt +8 -13
- package/package.json +3 -6
- package/types/test.d.ts +458 -21
- package/types/testReporter.d.ts +79 -4
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
8
|
var __copyProps = (to, from, except, desc) => {
|
|
12
9
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
10
|
for (let key of __getOwnPropNames(from))
|
|
@@ -25,1385 +22,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
22
|
mod
|
|
26
23
|
));
|
|
27
24
|
|
|
28
|
-
// packages/utils/third_party/yauzl/pend.js
|
|
29
|
-
var require_pend = __commonJS({
|
|
30
|
-
"packages/utils/third_party/yauzl/pend.js"(exports2, module2) {
|
|
31
|
-
"use strict";
|
|
32
|
-
module2.exports = Pend;
|
|
33
|
-
function Pend() {
|
|
34
|
-
this.pending = 0;
|
|
35
|
-
this.max = Infinity;
|
|
36
|
-
this.listeners = [];
|
|
37
|
-
this.waiting = [];
|
|
38
|
-
this.error = null;
|
|
39
|
-
}
|
|
40
|
-
Pend.prototype.go = function(fn) {
|
|
41
|
-
if (this.pending < this.max) {
|
|
42
|
-
pendGo(this, fn);
|
|
43
|
-
} else {
|
|
44
|
-
this.waiting.push(fn);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
Pend.prototype.wait = function(cb) {
|
|
48
|
-
if (this.pending === 0) {
|
|
49
|
-
cb(this.error);
|
|
50
|
-
} else {
|
|
51
|
-
this.listeners.push(cb);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
Pend.prototype.hold = function() {
|
|
55
|
-
return pendHold(this);
|
|
56
|
-
};
|
|
57
|
-
function pendHold(self) {
|
|
58
|
-
self.pending += 1;
|
|
59
|
-
var called = false;
|
|
60
|
-
return onCb;
|
|
61
|
-
function onCb(err) {
|
|
62
|
-
if (called) throw new Error("callback called twice");
|
|
63
|
-
called = true;
|
|
64
|
-
self.error = self.error || err;
|
|
65
|
-
self.pending -= 1;
|
|
66
|
-
if (self.waiting.length > 0 && self.pending < self.max) {
|
|
67
|
-
pendGo(self, self.waiting.shift());
|
|
68
|
-
} else if (self.pending === 0) {
|
|
69
|
-
var listeners = self.listeners;
|
|
70
|
-
self.listeners = [];
|
|
71
|
-
listeners.forEach(cbListener);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function cbListener(listener) {
|
|
75
|
-
listener(self.error);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function pendGo(self, fn) {
|
|
79
|
-
fn(pendHold(self));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// packages/utils/third_party/yauzl/fd-slicer.js
|
|
85
|
-
var require_fd_slicer = __commonJS({
|
|
86
|
-
"packages/utils/third_party/yauzl/fd-slicer.js"(exports2) {
|
|
87
|
-
"use strict";
|
|
88
|
-
var fs4 = require("fs");
|
|
89
|
-
var util2 = require("util");
|
|
90
|
-
var stream = require("stream");
|
|
91
|
-
var Readable = stream.Readable;
|
|
92
|
-
var Writable = stream.Writable;
|
|
93
|
-
var PassThrough = stream.PassThrough;
|
|
94
|
-
var Pend = require_pend();
|
|
95
|
-
var EventEmitter = require("events").EventEmitter;
|
|
96
|
-
exports2.createFromBuffer = createFromBuffer;
|
|
97
|
-
exports2.createFromFd = createFromFd;
|
|
98
|
-
exports2.BufferSlicer = BufferSlicer;
|
|
99
|
-
exports2.FdSlicer = FdSlicer;
|
|
100
|
-
util2.inherits(FdSlicer, EventEmitter);
|
|
101
|
-
function FdSlicer(fd, options2) {
|
|
102
|
-
options2 = options2 || {};
|
|
103
|
-
EventEmitter.call(this);
|
|
104
|
-
this.fd = fd;
|
|
105
|
-
this.pend = new Pend();
|
|
106
|
-
this.pend.max = 1;
|
|
107
|
-
this.refCount = 0;
|
|
108
|
-
this.autoClose = !!options2.autoClose;
|
|
109
|
-
}
|
|
110
|
-
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
111
|
-
var self = this;
|
|
112
|
-
self.pend.go(function(cb) {
|
|
113
|
-
fs4.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
|
|
114
|
-
cb();
|
|
115
|
-
callback(err, bytesRead, buffer2);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
120
|
-
var self = this;
|
|
121
|
-
self.pend.go(function(cb) {
|
|
122
|
-
fs4.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
|
|
123
|
-
cb();
|
|
124
|
-
callback(err, written, buffer2);
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
FdSlicer.prototype.createReadStream = function(options2) {
|
|
129
|
-
return new ReadStream(this, options2);
|
|
130
|
-
};
|
|
131
|
-
FdSlicer.prototype.createWriteStream = function(options2) {
|
|
132
|
-
return new WriteStream(this, options2);
|
|
133
|
-
};
|
|
134
|
-
FdSlicer.prototype.ref = function() {
|
|
135
|
-
this.refCount += 1;
|
|
136
|
-
};
|
|
137
|
-
FdSlicer.prototype.unref = function() {
|
|
138
|
-
var self = this;
|
|
139
|
-
self.refCount -= 1;
|
|
140
|
-
if (self.refCount > 0) return;
|
|
141
|
-
if (self.refCount < 0) throw new Error("invalid unref");
|
|
142
|
-
if (self.autoClose) {
|
|
143
|
-
fs4.close(self.fd, onCloseDone);
|
|
144
|
-
}
|
|
145
|
-
function onCloseDone(err) {
|
|
146
|
-
if (err) {
|
|
147
|
-
self.emit("error", err);
|
|
148
|
-
} else {
|
|
149
|
-
self.emit("close");
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
util2.inherits(ReadStream, Readable);
|
|
154
|
-
function ReadStream(context, options2) {
|
|
155
|
-
options2 = options2 || {};
|
|
156
|
-
Readable.call(this, options2);
|
|
157
|
-
this.context = context;
|
|
158
|
-
this.context.ref();
|
|
159
|
-
this.start = options2.start || 0;
|
|
160
|
-
this.endOffset = options2.end;
|
|
161
|
-
this.pos = this.start;
|
|
162
|
-
this._destroyed = false;
|
|
163
|
-
}
|
|
164
|
-
ReadStream.prototype._read = function(n) {
|
|
165
|
-
var self = this;
|
|
166
|
-
if (self._destroyed) return;
|
|
167
|
-
var toRead = Math.min(self._readableState.highWaterMark, n);
|
|
168
|
-
if (self.endOffset != null) {
|
|
169
|
-
toRead = Math.min(toRead, self.endOffset - self.pos);
|
|
170
|
-
}
|
|
171
|
-
if (toRead <= 0) {
|
|
172
|
-
self._destroyed = true;
|
|
173
|
-
self.push(null);
|
|
174
|
-
self.context.unref();
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
self.context.pend.go(function(cb) {
|
|
178
|
-
if (self._destroyed) return cb();
|
|
179
|
-
var buffer = Buffer.allocUnsafe(toRead);
|
|
180
|
-
fs4.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
181
|
-
if (self._destroyed) return cb();
|
|
182
|
-
if (err) {
|
|
183
|
-
self.destroy(err);
|
|
184
|
-
} else if (bytesRead === 0) {
|
|
185
|
-
self._destroyed = true;
|
|
186
|
-
self.push(null);
|
|
187
|
-
self.context.unref();
|
|
188
|
-
} else {
|
|
189
|
-
self.pos += bytesRead;
|
|
190
|
-
self.push(buffer.slice(0, bytesRead));
|
|
191
|
-
}
|
|
192
|
-
cb();
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
ReadStream.prototype.destroy = function(err) {
|
|
197
|
-
if (err == null && !this.readableEnded) {
|
|
198
|
-
err = new Error("stream destroyed");
|
|
199
|
-
}
|
|
200
|
-
return Readable.prototype.destroy.call(this, err);
|
|
201
|
-
};
|
|
202
|
-
ReadStream.prototype._destroy = function(err, cb) {
|
|
203
|
-
if (!this._destroyed) {
|
|
204
|
-
this._destroyed = true;
|
|
205
|
-
this.context.unref();
|
|
206
|
-
}
|
|
207
|
-
cb(err);
|
|
208
|
-
};
|
|
209
|
-
util2.inherits(WriteStream, Writable);
|
|
210
|
-
function WriteStream(context, options2) {
|
|
211
|
-
options2 = options2 || {};
|
|
212
|
-
Writable.call(this, options2);
|
|
213
|
-
this.context = context;
|
|
214
|
-
this.context.ref();
|
|
215
|
-
this.start = options2.start || 0;
|
|
216
|
-
this.endOffset = options2.end == null ? Infinity : +options2.end;
|
|
217
|
-
this.bytesWritten = 0;
|
|
218
|
-
this.pos = this.start;
|
|
219
|
-
this._destroyed = false;
|
|
220
|
-
this.on("finish", this.destroy.bind(this));
|
|
221
|
-
}
|
|
222
|
-
WriteStream.prototype._write = function(buffer, encoding, callback) {
|
|
223
|
-
var self = this;
|
|
224
|
-
if (self._destroyed) return;
|
|
225
|
-
if (self.pos + buffer.length > self.endOffset) {
|
|
226
|
-
var err = new Error("maximum file length exceeded");
|
|
227
|
-
err.code = "ETOOBIG";
|
|
228
|
-
self.destroy();
|
|
229
|
-
callback(err);
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
self.context.pend.go(function(cb) {
|
|
233
|
-
if (self._destroyed) return cb();
|
|
234
|
-
fs4.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
|
|
235
|
-
if (err2) {
|
|
236
|
-
self.destroy();
|
|
237
|
-
cb();
|
|
238
|
-
callback(err2);
|
|
239
|
-
} else {
|
|
240
|
-
self.bytesWritten += bytes;
|
|
241
|
-
self.pos += bytes;
|
|
242
|
-
self.emit("progress");
|
|
243
|
-
cb();
|
|
244
|
-
callback();
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
};
|
|
249
|
-
WriteStream.prototype._destroy = function(err, cb) {
|
|
250
|
-
if (!this._destroyed) {
|
|
251
|
-
this._destroyed = true;
|
|
252
|
-
this.context.unref();
|
|
253
|
-
}
|
|
254
|
-
cb(err);
|
|
255
|
-
};
|
|
256
|
-
util2.inherits(BufferSlicer, EventEmitter);
|
|
257
|
-
function BufferSlicer(buffer, options2) {
|
|
258
|
-
EventEmitter.call(this);
|
|
259
|
-
options2 = options2 || {};
|
|
260
|
-
this.refCount = 0;
|
|
261
|
-
this.buffer = buffer;
|
|
262
|
-
this.maxChunkSize = options2.maxChunkSize || Number.MAX_SAFE_INTEGER;
|
|
263
|
-
}
|
|
264
|
-
BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
265
|
-
if (!(0 <= offset && offset <= buffer.length)) throw new RangeError("offset outside buffer: 0 <= " + offset + " <= " + buffer.length);
|
|
266
|
-
if (position < 0) throw new RangeError("position is negative: " + position);
|
|
267
|
-
if (offset + length > buffer.length) {
|
|
268
|
-
length = buffer.length - offset;
|
|
269
|
-
}
|
|
270
|
-
if (position + length > this.buffer.length) {
|
|
271
|
-
length = this.buffer.length - position;
|
|
272
|
-
}
|
|
273
|
-
if (length <= 0) {
|
|
274
|
-
setImmediate(function() {
|
|
275
|
-
callback(null, 0);
|
|
276
|
-
});
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
this.buffer.copy(buffer, offset, position, position + length);
|
|
280
|
-
setImmediate(function() {
|
|
281
|
-
callback(null, length);
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
285
|
-
buffer.copy(this.buffer, position, offset, offset + length);
|
|
286
|
-
setImmediate(function() {
|
|
287
|
-
callback(null, length, buffer);
|
|
288
|
-
});
|
|
289
|
-
};
|
|
290
|
-
BufferSlicer.prototype.createReadStream = function(options2) {
|
|
291
|
-
options2 = options2 || {};
|
|
292
|
-
var readStream = new PassThrough(options2);
|
|
293
|
-
readStream._destroyed = false;
|
|
294
|
-
readStream.start = options2.start || 0;
|
|
295
|
-
readStream.endOffset = options2.end;
|
|
296
|
-
readStream.pos = readStream.endOffset || this.buffer.length;
|
|
297
|
-
var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
|
|
298
|
-
var offset = 0;
|
|
299
|
-
while (true) {
|
|
300
|
-
var nextOffset = offset + this.maxChunkSize;
|
|
301
|
-
if (nextOffset >= entireSlice.length) {
|
|
302
|
-
if (offset < entireSlice.length) {
|
|
303
|
-
readStream.write(entireSlice.slice(offset, entireSlice.length));
|
|
304
|
-
}
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
readStream.write(entireSlice.slice(offset, nextOffset));
|
|
308
|
-
offset = nextOffset;
|
|
309
|
-
}
|
|
310
|
-
readStream.end();
|
|
311
|
-
readStream._destroy = function(err, cb) {
|
|
312
|
-
readStream._destroyed = true;
|
|
313
|
-
PassThrough.prototype._destroy.call(readStream, err, cb);
|
|
314
|
-
};
|
|
315
|
-
return readStream;
|
|
316
|
-
};
|
|
317
|
-
BufferSlicer.prototype.createWriteStream = function(options2) {
|
|
318
|
-
var bufferSlicer = this;
|
|
319
|
-
options2 = options2 || {};
|
|
320
|
-
var writeStream = new Writable(options2);
|
|
321
|
-
writeStream.start = options2.start || 0;
|
|
322
|
-
writeStream.endOffset = options2.end == null ? this.buffer.length : +options2.end;
|
|
323
|
-
writeStream.bytesWritten = 0;
|
|
324
|
-
writeStream.pos = writeStream.start;
|
|
325
|
-
writeStream._destroyed = false;
|
|
326
|
-
writeStream._write = function(buffer, encoding, callback) {
|
|
327
|
-
if (writeStream._destroyed) return;
|
|
328
|
-
var end = writeStream.pos + buffer.length;
|
|
329
|
-
if (end > writeStream.endOffset) {
|
|
330
|
-
var err = new Error("maximum file length exceeded");
|
|
331
|
-
err.code = "ETOOBIG";
|
|
332
|
-
writeStream._destroyed = true;
|
|
333
|
-
callback(err);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
|
|
337
|
-
writeStream.bytesWritten += buffer.length;
|
|
338
|
-
writeStream.pos = end;
|
|
339
|
-
writeStream.emit("progress");
|
|
340
|
-
callback();
|
|
341
|
-
};
|
|
342
|
-
writeStream._destroy = function(err, cb) {
|
|
343
|
-
writeStream._destroyed = true;
|
|
344
|
-
cb(err);
|
|
345
|
-
};
|
|
346
|
-
return writeStream;
|
|
347
|
-
};
|
|
348
|
-
BufferSlicer.prototype.ref = function() {
|
|
349
|
-
this.refCount += 1;
|
|
350
|
-
};
|
|
351
|
-
BufferSlicer.prototype.unref = function() {
|
|
352
|
-
this.refCount -= 1;
|
|
353
|
-
if (this.refCount < 0) {
|
|
354
|
-
throw new Error("invalid unref");
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
function createFromBuffer(buffer, options2) {
|
|
358
|
-
return new BufferSlicer(buffer, options2);
|
|
359
|
-
}
|
|
360
|
-
function createFromFd(fd, options2) {
|
|
361
|
-
return new FdSlicer(fd, options2);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
// packages/utils/third_party/yauzl/buffer-crc32.js
|
|
367
|
-
var require_buffer_crc32 = __commonJS({
|
|
368
|
-
"packages/utils/third_party/yauzl/buffer-crc32.js"(exports2, module2) {
|
|
369
|
-
"use strict";
|
|
370
|
-
var Buffer2 = require("buffer").Buffer;
|
|
371
|
-
var CRC_TABLE = [
|
|
372
|
-
0,
|
|
373
|
-
1996959894,
|
|
374
|
-
3993919788,
|
|
375
|
-
2567524794,
|
|
376
|
-
124634137,
|
|
377
|
-
1886057615,
|
|
378
|
-
3915621685,
|
|
379
|
-
2657392035,
|
|
380
|
-
249268274,
|
|
381
|
-
2044508324,
|
|
382
|
-
3772115230,
|
|
383
|
-
2547177864,
|
|
384
|
-
162941995,
|
|
385
|
-
2125561021,
|
|
386
|
-
3887607047,
|
|
387
|
-
2428444049,
|
|
388
|
-
498536548,
|
|
389
|
-
1789927666,
|
|
390
|
-
4089016648,
|
|
391
|
-
2227061214,
|
|
392
|
-
450548861,
|
|
393
|
-
1843258603,
|
|
394
|
-
4107580753,
|
|
395
|
-
2211677639,
|
|
396
|
-
325883990,
|
|
397
|
-
1684777152,
|
|
398
|
-
4251122042,
|
|
399
|
-
2321926636,
|
|
400
|
-
335633487,
|
|
401
|
-
1661365465,
|
|
402
|
-
4195302755,
|
|
403
|
-
2366115317,
|
|
404
|
-
997073096,
|
|
405
|
-
1281953886,
|
|
406
|
-
3579855332,
|
|
407
|
-
2724688242,
|
|
408
|
-
1006888145,
|
|
409
|
-
1258607687,
|
|
410
|
-
3524101629,
|
|
411
|
-
2768942443,
|
|
412
|
-
901097722,
|
|
413
|
-
1119000684,
|
|
414
|
-
3686517206,
|
|
415
|
-
2898065728,
|
|
416
|
-
853044451,
|
|
417
|
-
1172266101,
|
|
418
|
-
3705015759,
|
|
419
|
-
2882616665,
|
|
420
|
-
651767980,
|
|
421
|
-
1373503546,
|
|
422
|
-
3369554304,
|
|
423
|
-
3218104598,
|
|
424
|
-
565507253,
|
|
425
|
-
1454621731,
|
|
426
|
-
3485111705,
|
|
427
|
-
3099436303,
|
|
428
|
-
671266974,
|
|
429
|
-
1594198024,
|
|
430
|
-
3322730930,
|
|
431
|
-
2970347812,
|
|
432
|
-
795835527,
|
|
433
|
-
1483230225,
|
|
434
|
-
3244367275,
|
|
435
|
-
3060149565,
|
|
436
|
-
1994146192,
|
|
437
|
-
31158534,
|
|
438
|
-
2563907772,
|
|
439
|
-
4023717930,
|
|
440
|
-
1907459465,
|
|
441
|
-
112637215,
|
|
442
|
-
2680153253,
|
|
443
|
-
3904427059,
|
|
444
|
-
2013776290,
|
|
445
|
-
251722036,
|
|
446
|
-
2517215374,
|
|
447
|
-
3775830040,
|
|
448
|
-
2137656763,
|
|
449
|
-
141376813,
|
|
450
|
-
2439277719,
|
|
451
|
-
3865271297,
|
|
452
|
-
1802195444,
|
|
453
|
-
476864866,
|
|
454
|
-
2238001368,
|
|
455
|
-
4066508878,
|
|
456
|
-
1812370925,
|
|
457
|
-
453092731,
|
|
458
|
-
2181625025,
|
|
459
|
-
4111451223,
|
|
460
|
-
1706088902,
|
|
461
|
-
314042704,
|
|
462
|
-
2344532202,
|
|
463
|
-
4240017532,
|
|
464
|
-
1658658271,
|
|
465
|
-
366619977,
|
|
466
|
-
2362670323,
|
|
467
|
-
4224994405,
|
|
468
|
-
1303535960,
|
|
469
|
-
984961486,
|
|
470
|
-
2747007092,
|
|
471
|
-
3569037538,
|
|
472
|
-
1256170817,
|
|
473
|
-
1037604311,
|
|
474
|
-
2765210733,
|
|
475
|
-
3554079995,
|
|
476
|
-
1131014506,
|
|
477
|
-
879679996,
|
|
478
|
-
2909243462,
|
|
479
|
-
3663771856,
|
|
480
|
-
1141124467,
|
|
481
|
-
855842277,
|
|
482
|
-
2852801631,
|
|
483
|
-
3708648649,
|
|
484
|
-
1342533948,
|
|
485
|
-
654459306,
|
|
486
|
-
3188396048,
|
|
487
|
-
3373015174,
|
|
488
|
-
1466479909,
|
|
489
|
-
544179635,
|
|
490
|
-
3110523913,
|
|
491
|
-
3462522015,
|
|
492
|
-
1591671054,
|
|
493
|
-
702138776,
|
|
494
|
-
2966460450,
|
|
495
|
-
3352799412,
|
|
496
|
-
1504918807,
|
|
497
|
-
783551873,
|
|
498
|
-
3082640443,
|
|
499
|
-
3233442989,
|
|
500
|
-
3988292384,
|
|
501
|
-
2596254646,
|
|
502
|
-
62317068,
|
|
503
|
-
1957810842,
|
|
504
|
-
3939845945,
|
|
505
|
-
2647816111,
|
|
506
|
-
81470997,
|
|
507
|
-
1943803523,
|
|
508
|
-
3814918930,
|
|
509
|
-
2489596804,
|
|
510
|
-
225274430,
|
|
511
|
-
2053790376,
|
|
512
|
-
3826175755,
|
|
513
|
-
2466906013,
|
|
514
|
-
167816743,
|
|
515
|
-
2097651377,
|
|
516
|
-
4027552580,
|
|
517
|
-
2265490386,
|
|
518
|
-
503444072,
|
|
519
|
-
1762050814,
|
|
520
|
-
4150417245,
|
|
521
|
-
2154129355,
|
|
522
|
-
426522225,
|
|
523
|
-
1852507879,
|
|
524
|
-
4275313526,
|
|
525
|
-
2312317920,
|
|
526
|
-
282753626,
|
|
527
|
-
1742555852,
|
|
528
|
-
4189708143,
|
|
529
|
-
2394877945,
|
|
530
|
-
397917763,
|
|
531
|
-
1622183637,
|
|
532
|
-
3604390888,
|
|
533
|
-
2714866558,
|
|
534
|
-
953729732,
|
|
535
|
-
1340076626,
|
|
536
|
-
3518719985,
|
|
537
|
-
2797360999,
|
|
538
|
-
1068828381,
|
|
539
|
-
1219638859,
|
|
540
|
-
3624741850,
|
|
541
|
-
2936675148,
|
|
542
|
-
906185462,
|
|
543
|
-
1090812512,
|
|
544
|
-
3747672003,
|
|
545
|
-
2825379669,
|
|
546
|
-
829329135,
|
|
547
|
-
1181335161,
|
|
548
|
-
3412177804,
|
|
549
|
-
3160834842,
|
|
550
|
-
628085408,
|
|
551
|
-
1382605366,
|
|
552
|
-
3423369109,
|
|
553
|
-
3138078467,
|
|
554
|
-
570562233,
|
|
555
|
-
1426400815,
|
|
556
|
-
3317316542,
|
|
557
|
-
2998733608,
|
|
558
|
-
733239954,
|
|
559
|
-
1555261956,
|
|
560
|
-
3268935591,
|
|
561
|
-
3050360625,
|
|
562
|
-
752459403,
|
|
563
|
-
1541320221,
|
|
564
|
-
2607071920,
|
|
565
|
-
3965973030,
|
|
566
|
-
1969922972,
|
|
567
|
-
40735498,
|
|
568
|
-
2617837225,
|
|
569
|
-
3943577151,
|
|
570
|
-
1913087877,
|
|
571
|
-
83908371,
|
|
572
|
-
2512341634,
|
|
573
|
-
3803740692,
|
|
574
|
-
2075208622,
|
|
575
|
-
213261112,
|
|
576
|
-
2463272603,
|
|
577
|
-
3855990285,
|
|
578
|
-
2094854071,
|
|
579
|
-
198958881,
|
|
580
|
-
2262029012,
|
|
581
|
-
4057260610,
|
|
582
|
-
1759359992,
|
|
583
|
-
534414190,
|
|
584
|
-
2176718541,
|
|
585
|
-
4139329115,
|
|
586
|
-
1873836001,
|
|
587
|
-
414664567,
|
|
588
|
-
2282248934,
|
|
589
|
-
4279200368,
|
|
590
|
-
1711684554,
|
|
591
|
-
285281116,
|
|
592
|
-
2405801727,
|
|
593
|
-
4167216745,
|
|
594
|
-
1634467795,
|
|
595
|
-
376229701,
|
|
596
|
-
2685067896,
|
|
597
|
-
3608007406,
|
|
598
|
-
1308918612,
|
|
599
|
-
956543938,
|
|
600
|
-
2808555105,
|
|
601
|
-
3495958263,
|
|
602
|
-
1231636301,
|
|
603
|
-
1047427035,
|
|
604
|
-
2932959818,
|
|
605
|
-
3654703836,
|
|
606
|
-
1088359270,
|
|
607
|
-
936918e3,
|
|
608
|
-
2847714899,
|
|
609
|
-
3736837829,
|
|
610
|
-
1202900863,
|
|
611
|
-
817233897,
|
|
612
|
-
3183342108,
|
|
613
|
-
3401237130,
|
|
614
|
-
1404277552,
|
|
615
|
-
615818150,
|
|
616
|
-
3134207493,
|
|
617
|
-
3453421203,
|
|
618
|
-
1423857449,
|
|
619
|
-
601450431,
|
|
620
|
-
3009837614,
|
|
621
|
-
3294710456,
|
|
622
|
-
1567103746,
|
|
623
|
-
711928724,
|
|
624
|
-
3020668471,
|
|
625
|
-
3272380065,
|
|
626
|
-
1510334235,
|
|
627
|
-
755167117
|
|
628
|
-
];
|
|
629
|
-
if (typeof Int32Array !== "undefined") {
|
|
630
|
-
CRC_TABLE = new Int32Array(CRC_TABLE);
|
|
631
|
-
}
|
|
632
|
-
function ensureBuffer(input) {
|
|
633
|
-
if (Buffer2.isBuffer(input)) {
|
|
634
|
-
return input;
|
|
635
|
-
}
|
|
636
|
-
var hasNewBufferAPI = typeof Buffer2.alloc === "function" && typeof Buffer2.from === "function";
|
|
637
|
-
if (typeof input === "number") {
|
|
638
|
-
return hasNewBufferAPI ? Buffer2.alloc(input) : new Buffer2(input);
|
|
639
|
-
} else if (typeof input === "string") {
|
|
640
|
-
return hasNewBufferAPI ? Buffer2.from(input) : new Buffer2(input);
|
|
641
|
-
} else {
|
|
642
|
-
throw new Error("input must be buffer, number, or string, received " + typeof input);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
function bufferizeInt(num) {
|
|
646
|
-
var tmp = ensureBuffer(4);
|
|
647
|
-
tmp.writeInt32BE(num, 0);
|
|
648
|
-
return tmp;
|
|
649
|
-
}
|
|
650
|
-
function _crc32(buf, previous) {
|
|
651
|
-
buf = ensureBuffer(buf);
|
|
652
|
-
if (Buffer2.isBuffer(previous)) {
|
|
653
|
-
previous = previous.readUInt32BE(0);
|
|
654
|
-
}
|
|
655
|
-
var crc = ~~previous ^ -1;
|
|
656
|
-
for (var n = 0; n < buf.length; n++) {
|
|
657
|
-
crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
|
|
658
|
-
}
|
|
659
|
-
return crc ^ -1;
|
|
660
|
-
}
|
|
661
|
-
function crc32() {
|
|
662
|
-
return bufferizeInt(_crc32.apply(null, arguments));
|
|
663
|
-
}
|
|
664
|
-
crc32.signed = function() {
|
|
665
|
-
return _crc32.apply(null, arguments);
|
|
666
|
-
};
|
|
667
|
-
crc32.unsigned = function() {
|
|
668
|
-
return _crc32.apply(null, arguments) >>> 0;
|
|
669
|
-
};
|
|
670
|
-
module2.exports = crc32;
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
|
-
|
|
674
|
-
// packages/utils/third_party/yauzl/index.js
|
|
675
|
-
var require_yauzl = __commonJS({
|
|
676
|
-
"packages/utils/third_party/yauzl/index.js"(exports2) {
|
|
677
|
-
"use strict";
|
|
678
|
-
var fs4 = require("fs");
|
|
679
|
-
var zlib = require("zlib");
|
|
680
|
-
var fd_slicer = require_fd_slicer();
|
|
681
|
-
var crc32 = require_buffer_crc32();
|
|
682
|
-
var util2 = require("util");
|
|
683
|
-
var EventEmitter = require("events").EventEmitter;
|
|
684
|
-
var Transform = require("stream").Transform;
|
|
685
|
-
var PassThrough = require("stream").PassThrough;
|
|
686
|
-
var Writable = require("stream").Writable;
|
|
687
|
-
exports2.open = open2;
|
|
688
|
-
exports2.fromFd = fromFd;
|
|
689
|
-
exports2.fromBuffer = fromBuffer;
|
|
690
|
-
exports2.fromRandomAccessReader = fromRandomAccessReader;
|
|
691
|
-
exports2.dosDateTimeToDate = dosDateTimeToDate;
|
|
692
|
-
exports2.getFileNameLowLevel = getFileNameLowLevel;
|
|
693
|
-
exports2.validateFileName = validateFileName;
|
|
694
|
-
exports2.parseExtraFields = parseExtraFields;
|
|
695
|
-
exports2.ZipFile = ZipFile;
|
|
696
|
-
exports2.Entry = Entry;
|
|
697
|
-
exports2.LocalFileHeader = LocalFileHeader;
|
|
698
|
-
exports2.RandomAccessReader = RandomAccessReader;
|
|
699
|
-
function open2(path4, options2, callback) {
|
|
700
|
-
if (typeof options2 === "function") {
|
|
701
|
-
callback = options2;
|
|
702
|
-
options2 = null;
|
|
703
|
-
}
|
|
704
|
-
if (options2 == null) options2 = {};
|
|
705
|
-
if (options2.autoClose == null) options2.autoClose = true;
|
|
706
|
-
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
707
|
-
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
708
|
-
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
709
|
-
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
710
|
-
if (callback == null) callback = defaultCallback;
|
|
711
|
-
fs4.open(path4, "r", function(err, fd) {
|
|
712
|
-
if (err) return callback(err);
|
|
713
|
-
fromFd(fd, options2, function(err2, zipfile) {
|
|
714
|
-
if (err2) fs4.close(fd, defaultCallback);
|
|
715
|
-
callback(err2, zipfile);
|
|
716
|
-
});
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
function fromFd(fd, options2, callback) {
|
|
720
|
-
if (typeof options2 === "function") {
|
|
721
|
-
callback = options2;
|
|
722
|
-
options2 = null;
|
|
723
|
-
}
|
|
724
|
-
if (options2 == null) options2 = {};
|
|
725
|
-
if (options2.autoClose == null) options2.autoClose = false;
|
|
726
|
-
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
727
|
-
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
728
|
-
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
729
|
-
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
730
|
-
if (callback == null) callback = defaultCallback;
|
|
731
|
-
fs4.fstat(fd, function(err, stats) {
|
|
732
|
-
if (err) return callback(err);
|
|
733
|
-
var reader = fd_slicer.createFromFd(fd, { autoClose: true });
|
|
734
|
-
fromRandomAccessReader(reader, stats.size, options2, callback);
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
function fromBuffer(buffer, options2, callback) {
|
|
738
|
-
if (typeof options2 === "function") {
|
|
739
|
-
callback = options2;
|
|
740
|
-
options2 = null;
|
|
741
|
-
}
|
|
742
|
-
if (options2 == null) options2 = {};
|
|
743
|
-
options2.autoClose = false;
|
|
744
|
-
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
745
|
-
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
746
|
-
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
747
|
-
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
748
|
-
var reader = fd_slicer.createFromBuffer(buffer, { maxChunkSize: 65536 });
|
|
749
|
-
fromRandomAccessReader(reader, buffer.length, options2, callback);
|
|
750
|
-
}
|
|
751
|
-
function fromRandomAccessReader(reader, totalSize, options2, callback) {
|
|
752
|
-
if (typeof options2 === "function") {
|
|
753
|
-
callback = options2;
|
|
754
|
-
options2 = null;
|
|
755
|
-
}
|
|
756
|
-
if (options2 == null) options2 = {};
|
|
757
|
-
if (options2.autoClose == null) options2.autoClose = true;
|
|
758
|
-
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
759
|
-
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
760
|
-
var decodeStrings = !!options2.decodeStrings;
|
|
761
|
-
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
762
|
-
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
763
|
-
if (callback == null) callback = defaultCallback;
|
|
764
|
-
if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
|
|
765
|
-
if (totalSize > Number.MAX_SAFE_INTEGER) {
|
|
766
|
-
throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
|
|
767
|
-
}
|
|
768
|
-
reader.ref();
|
|
769
|
-
var eocdrWithoutCommentSize = 22;
|
|
770
|
-
var zip64EocdlSize = 20;
|
|
771
|
-
var maxCommentSize = 65535;
|
|
772
|
-
var bufferSize = Math.min(zip64EocdlSize + eocdrWithoutCommentSize + maxCommentSize, totalSize);
|
|
773
|
-
var buffer = newBuffer(bufferSize);
|
|
774
|
-
var bufferReadStart = totalSize - buffer.length;
|
|
775
|
-
readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
|
|
776
|
-
if (err) return callback(err);
|
|
777
|
-
for (var i = bufferSize - eocdrWithoutCommentSize; i >= 0; i -= 1) {
|
|
778
|
-
if (buffer.readUInt32LE(i) !== 101010256) continue;
|
|
779
|
-
var eocdrBuffer = buffer.subarray(i);
|
|
780
|
-
var diskNumber = eocdrBuffer.readUInt16LE(4);
|
|
781
|
-
var entryCount = eocdrBuffer.readUInt16LE(10);
|
|
782
|
-
var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
|
|
783
|
-
var commentLength = eocdrBuffer.readUInt16LE(20);
|
|
784
|
-
var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
|
|
785
|
-
if (commentLength !== expectedCommentLength) {
|
|
786
|
-
return callback(new Error("Invalid comment length. Expected: " + expectedCommentLength + ". Found: " + commentLength + ". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK\u263A\u263B` in the comment?"));
|
|
787
|
-
}
|
|
788
|
-
var comment = decodeStrings ? decodeBuffer(eocdrBuffer.subarray(22), false) : eocdrBuffer.subarray(22);
|
|
789
|
-
if (i - zip64EocdlSize >= 0 && buffer.readUInt32LE(i - zip64EocdlSize) === 117853008) {
|
|
790
|
-
var zip64EocdlBuffer = buffer.subarray(i - zip64EocdlSize, i - zip64EocdlSize + zip64EocdlSize);
|
|
791
|
-
var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
|
|
792
|
-
var zip64EocdrBuffer = newBuffer(56);
|
|
793
|
-
return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err2) {
|
|
794
|
-
if (err2) return callback(err2);
|
|
795
|
-
if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
|
|
796
|
-
return callback(new Error("invalid zip64 end of central directory record signature"));
|
|
797
|
-
}
|
|
798
|
-
diskNumber = zip64EocdrBuffer.readUInt32LE(16);
|
|
799
|
-
if (diskNumber !== 0) {
|
|
800
|
-
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
801
|
-
}
|
|
802
|
-
entryCount = readUInt64LE(zip64EocdrBuffer, 32);
|
|
803
|
-
centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
|
|
804
|
-
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
if (diskNumber !== 0) {
|
|
808
|
-
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
809
|
-
}
|
|
810
|
-
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
|
|
811
|
-
}
|
|
812
|
-
callback(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."));
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
util2.inherits(ZipFile, EventEmitter);
|
|
816
|
-
function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
|
|
817
|
-
var self = this;
|
|
818
|
-
EventEmitter.call(self);
|
|
819
|
-
self.reader = reader;
|
|
820
|
-
self.reader.on("error", function(err) {
|
|
821
|
-
emitError(self, err);
|
|
822
|
-
});
|
|
823
|
-
self.reader.once("close", function() {
|
|
824
|
-
self.emit("close");
|
|
825
|
-
});
|
|
826
|
-
self.readEntryCursor = centralDirectoryOffset;
|
|
827
|
-
self.fileSize = fileSize;
|
|
828
|
-
self.entryCount = entryCount;
|
|
829
|
-
self.comment = comment;
|
|
830
|
-
self.entriesRead = 0;
|
|
831
|
-
self.autoClose = !!autoClose;
|
|
832
|
-
self.lazyEntries = !!lazyEntries;
|
|
833
|
-
self.decodeStrings = !!decodeStrings;
|
|
834
|
-
self.validateEntrySizes = !!validateEntrySizes;
|
|
835
|
-
self.strictFileNames = !!strictFileNames;
|
|
836
|
-
self.isOpen = true;
|
|
837
|
-
self.emittedError = false;
|
|
838
|
-
if (!self.lazyEntries) self._readEntry();
|
|
839
|
-
}
|
|
840
|
-
ZipFile.prototype.close = function() {
|
|
841
|
-
if (!this.isOpen) return;
|
|
842
|
-
this.isOpen = false;
|
|
843
|
-
this.reader.unref();
|
|
844
|
-
};
|
|
845
|
-
function emitErrorAndAutoClose(self, err) {
|
|
846
|
-
if (self.autoClose) self.close();
|
|
847
|
-
emitError(self, err);
|
|
848
|
-
}
|
|
849
|
-
function emitError(self, err) {
|
|
850
|
-
if (self.emittedError) return;
|
|
851
|
-
self.emittedError = true;
|
|
852
|
-
self.emit("error", err);
|
|
853
|
-
}
|
|
854
|
-
ZipFile.prototype.readEntry = function() {
|
|
855
|
-
if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
|
|
856
|
-
this._readEntry();
|
|
857
|
-
};
|
|
858
|
-
ZipFile.prototype._readEntry = function() {
|
|
859
|
-
var self = this;
|
|
860
|
-
if (self.entryCount === self.entriesRead) {
|
|
861
|
-
setImmediate(function() {
|
|
862
|
-
if (self.autoClose) self.close();
|
|
863
|
-
if (self.emittedError) return;
|
|
864
|
-
self.emit("end");
|
|
865
|
-
});
|
|
866
|
-
return;
|
|
867
|
-
}
|
|
868
|
-
if (self.emittedError) return;
|
|
869
|
-
var buffer = newBuffer(46);
|
|
870
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
|
|
871
|
-
if (err) return emitErrorAndAutoClose(self, err);
|
|
872
|
-
if (self.emittedError) return;
|
|
873
|
-
var entry = new Entry();
|
|
874
|
-
var signature = buffer.readUInt32LE(0);
|
|
875
|
-
if (signature !== 33639248) return emitErrorAndAutoClose(self, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
|
|
876
|
-
entry.versionMadeBy = buffer.readUInt16LE(4);
|
|
877
|
-
entry.versionNeededToExtract = buffer.readUInt16LE(6);
|
|
878
|
-
entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
|
|
879
|
-
entry.compressionMethod = buffer.readUInt16LE(10);
|
|
880
|
-
entry.lastModFileTime = buffer.readUInt16LE(12);
|
|
881
|
-
entry.lastModFileDate = buffer.readUInt16LE(14);
|
|
882
|
-
entry.crc32 = buffer.readUInt32LE(16);
|
|
883
|
-
entry.compressedSize = buffer.readUInt32LE(20);
|
|
884
|
-
entry.uncompressedSize = buffer.readUInt32LE(24);
|
|
885
|
-
entry.fileNameLength = buffer.readUInt16LE(28);
|
|
886
|
-
entry.extraFieldLength = buffer.readUInt16LE(30);
|
|
887
|
-
entry.fileCommentLength = buffer.readUInt16LE(32);
|
|
888
|
-
entry.internalFileAttributes = buffer.readUInt16LE(36);
|
|
889
|
-
entry.externalFileAttributes = buffer.readUInt32LE(38);
|
|
890
|
-
entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
|
|
891
|
-
if (entry.generalPurposeBitFlag & 64) return emitErrorAndAutoClose(self, new Error("strong encryption is not supported"));
|
|
892
|
-
self.readEntryCursor += 46;
|
|
893
|
-
buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
|
|
894
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err2) {
|
|
895
|
-
if (err2) return emitErrorAndAutoClose(self, err2);
|
|
896
|
-
if (self.emittedError) return;
|
|
897
|
-
entry.fileNameRaw = buffer.subarray(0, entry.fileNameLength);
|
|
898
|
-
var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
|
|
899
|
-
entry.extraFieldRaw = buffer.subarray(entry.fileNameLength, fileCommentStart);
|
|
900
|
-
entry.fileCommentRaw = buffer.subarray(fileCommentStart, fileCommentStart + entry.fileCommentLength);
|
|
901
|
-
try {
|
|
902
|
-
entry.extraFields = parseExtraFields(entry.extraFieldRaw);
|
|
903
|
-
} catch (err3) {
|
|
904
|
-
return emitErrorAndAutoClose(self, err3);
|
|
905
|
-
}
|
|
906
|
-
if (self.decodeStrings) {
|
|
907
|
-
var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
|
|
908
|
-
entry.fileComment = decodeBuffer(entry.fileCommentRaw, isUtf8);
|
|
909
|
-
entry.fileName = getFileNameLowLevel(entry.generalPurposeBitFlag, entry.fileNameRaw, entry.extraFields, self.strictFileNames);
|
|
910
|
-
var errorMessage = validateFileName(entry.fileName);
|
|
911
|
-
if (errorMessage != null) return emitErrorAndAutoClose(self, new Error(errorMessage));
|
|
912
|
-
} else {
|
|
913
|
-
entry.fileComment = entry.fileCommentRaw;
|
|
914
|
-
entry.fileName = entry.fileNameRaw;
|
|
915
|
-
}
|
|
916
|
-
entry.comment = entry.fileComment;
|
|
917
|
-
self.readEntryCursor += buffer.length;
|
|
918
|
-
self.entriesRead += 1;
|
|
919
|
-
for (var i = 0; i < entry.extraFields.length; i++) {
|
|
920
|
-
var extraField = entry.extraFields[i];
|
|
921
|
-
if (extraField.id !== 1) continue;
|
|
922
|
-
var zip64EiefBuffer = extraField.data;
|
|
923
|
-
var index = 0;
|
|
924
|
-
if (entry.uncompressedSize === 4294967295) {
|
|
925
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
926
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include uncompressed size"));
|
|
927
|
-
}
|
|
928
|
-
entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
|
|
929
|
-
index += 8;
|
|
930
|
-
}
|
|
931
|
-
if (entry.compressedSize === 4294967295) {
|
|
932
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
933
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include compressed size"));
|
|
934
|
-
}
|
|
935
|
-
entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
|
|
936
|
-
index += 8;
|
|
937
|
-
}
|
|
938
|
-
if (entry.relativeOffsetOfLocalHeader === 4294967295) {
|
|
939
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
940
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include relative header offset"));
|
|
941
|
-
}
|
|
942
|
-
entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
|
|
943
|
-
index += 8;
|
|
944
|
-
}
|
|
945
|
-
break;
|
|
946
|
-
}
|
|
947
|
-
if (self.validateEntrySizes && entry.compressionMethod === 0) {
|
|
948
|
-
var expectedCompressedSize = entry.uncompressedSize;
|
|
949
|
-
if (entry.isEncrypted()) {
|
|
950
|
-
expectedCompressedSize += 12;
|
|
951
|
-
}
|
|
952
|
-
if (entry.compressedSize !== expectedCompressedSize) {
|
|
953
|
-
var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
|
|
954
|
-
return emitErrorAndAutoClose(self, new Error(msg));
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
self.emit("entry", entry);
|
|
958
|
-
if (!self.lazyEntries) self._readEntry();
|
|
959
|
-
});
|
|
960
|
-
});
|
|
961
|
-
};
|
|
962
|
-
ZipFile.prototype.openReadStream = function(entry, options2, callback) {
|
|
963
|
-
var self = this;
|
|
964
|
-
var relativeStart = 0;
|
|
965
|
-
var relativeEnd = entry.compressedSize;
|
|
966
|
-
if (callback == null) {
|
|
967
|
-
callback = options2;
|
|
968
|
-
options2 = null;
|
|
969
|
-
}
|
|
970
|
-
if (options2 == null) {
|
|
971
|
-
options2 = {};
|
|
972
|
-
} else {
|
|
973
|
-
if (options2.decrypt != null) {
|
|
974
|
-
if (!entry.isEncrypted()) {
|
|
975
|
-
throw new Error("options.decrypt can only be specified for encrypted entries");
|
|
976
|
-
}
|
|
977
|
-
if (options2.decrypt !== false) throw new Error("invalid options.decrypt value: " + options2.decrypt);
|
|
978
|
-
if (entry.isCompressed()) {
|
|
979
|
-
if (options2.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false");
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
if (options2.decompress != null) {
|
|
983
|
-
if (!entry.isCompressed()) {
|
|
984
|
-
throw new Error("options.decompress can only be specified for compressed entries");
|
|
985
|
-
}
|
|
986
|
-
if (!(options2.decompress === false || options2.decompress === true)) {
|
|
987
|
-
throw new Error("invalid options.decompress value: " + options2.decompress);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
if (options2.start != null || options2.end != null) {
|
|
991
|
-
if (entry.isCompressed() && options2.decompress !== false) {
|
|
992
|
-
throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
|
|
993
|
-
}
|
|
994
|
-
if (entry.isEncrypted() && options2.decrypt !== false) {
|
|
995
|
-
throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
if (options2.start != null) {
|
|
999
|
-
relativeStart = options2.start;
|
|
1000
|
-
if (relativeStart < 0) throw new Error("options.start < 0");
|
|
1001
|
-
if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
|
|
1002
|
-
}
|
|
1003
|
-
if (options2.end != null) {
|
|
1004
|
-
relativeEnd = options2.end;
|
|
1005
|
-
if (relativeEnd < 0) throw new Error("options.end < 0");
|
|
1006
|
-
if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
|
|
1007
|
-
if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
if (!self.isOpen) return callback(new Error("closed"));
|
|
1011
|
-
if (entry.isEncrypted()) {
|
|
1012
|
-
if (options2.decrypt !== false) return callback(new Error("entry is encrypted, and options.decrypt !== false"));
|
|
1013
|
-
}
|
|
1014
|
-
var decompress;
|
|
1015
|
-
if (entry.compressionMethod === 0) {
|
|
1016
|
-
decompress = false;
|
|
1017
|
-
} else if (entry.compressionMethod === 8) {
|
|
1018
|
-
decompress = options2.decompress != null ? options2.decompress : true;
|
|
1019
|
-
} else {
|
|
1020
|
-
return callback(new Error("unsupported compression method: " + entry.compressionMethod));
|
|
1021
|
-
}
|
|
1022
|
-
self.readLocalFileHeader(entry, { minimal: true }, function(err, localFileHeader) {
|
|
1023
|
-
if (err) return callback(err);
|
|
1024
|
-
self.openReadStreamLowLevel(
|
|
1025
|
-
localFileHeader.fileDataStart,
|
|
1026
|
-
entry.compressedSize,
|
|
1027
|
-
relativeStart,
|
|
1028
|
-
relativeEnd,
|
|
1029
|
-
decompress,
|
|
1030
|
-
entry.uncompressedSize,
|
|
1031
|
-
callback
|
|
1032
|
-
);
|
|
1033
|
-
});
|
|
1034
|
-
};
|
|
1035
|
-
ZipFile.prototype.openReadStreamLowLevel = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize, callback) {
|
|
1036
|
-
var self = this;
|
|
1037
|
-
var fileDataEnd = fileDataStart + compressedSize;
|
|
1038
|
-
var readStream = self.reader.createReadStream({
|
|
1039
|
-
start: fileDataStart + relativeStart,
|
|
1040
|
-
end: fileDataStart + relativeEnd
|
|
1041
|
-
});
|
|
1042
|
-
var endpointStream = readStream;
|
|
1043
|
-
if (decompress) {
|
|
1044
|
-
var destroyed = false;
|
|
1045
|
-
var inflateFilter = zlib.createInflateRaw();
|
|
1046
|
-
readStream.on("error", function(err) {
|
|
1047
|
-
setImmediate(function() {
|
|
1048
|
-
if (!destroyed) inflateFilter.emit("error", err);
|
|
1049
|
-
});
|
|
1050
|
-
});
|
|
1051
|
-
readStream.pipe(inflateFilter);
|
|
1052
|
-
if (self.validateEntrySizes) {
|
|
1053
|
-
endpointStream = new AssertByteCountStream(uncompressedSize);
|
|
1054
|
-
inflateFilter.on("error", function(err) {
|
|
1055
|
-
setImmediate(function() {
|
|
1056
|
-
if (!destroyed) endpointStream.emit("error", err);
|
|
1057
|
-
});
|
|
1058
|
-
});
|
|
1059
|
-
inflateFilter.pipe(endpointStream);
|
|
1060
|
-
} else {
|
|
1061
|
-
endpointStream = inflateFilter;
|
|
1062
|
-
}
|
|
1063
|
-
installDestroyFn(endpointStream, function() {
|
|
1064
|
-
destroyed = true;
|
|
1065
|
-
if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
|
|
1066
|
-
readStream.unpipe(inflateFilter);
|
|
1067
|
-
readStream.destroy();
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
callback(null, endpointStream);
|
|
1071
|
-
};
|
|
1072
|
-
ZipFile.prototype.readLocalFileHeader = function(entry, options2, callback) {
|
|
1073
|
-
var self = this;
|
|
1074
|
-
if (callback == null) {
|
|
1075
|
-
callback = options2;
|
|
1076
|
-
options2 = null;
|
|
1077
|
-
}
|
|
1078
|
-
if (options2 == null) options2 = {};
|
|
1079
|
-
self.reader.ref();
|
|
1080
|
-
var buffer = newBuffer(30);
|
|
1081
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
|
|
1082
|
-
try {
|
|
1083
|
-
if (err) return callback(err);
|
|
1084
|
-
var signature = buffer.readUInt32LE(0);
|
|
1085
|
-
if (signature !== 67324752) {
|
|
1086
|
-
return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
|
|
1087
|
-
}
|
|
1088
|
-
var fileNameLength = buffer.readUInt16LE(26);
|
|
1089
|
-
var extraFieldLength = buffer.readUInt16LE(28);
|
|
1090
|
-
var fileDataStart = entry.relativeOffsetOfLocalHeader + 30 + fileNameLength + extraFieldLength;
|
|
1091
|
-
if (fileDataStart + entry.compressedSize > self.fileSize) {
|
|
1092
|
-
return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
|
|
1093
|
-
}
|
|
1094
|
-
if (options2.minimal) {
|
|
1095
|
-
return callback(null, { fileDataStart });
|
|
1096
|
-
}
|
|
1097
|
-
var localFileHeader = new LocalFileHeader();
|
|
1098
|
-
localFileHeader.fileDataStart = fileDataStart;
|
|
1099
|
-
localFileHeader.versionNeededToExtract = buffer.readUInt16LE(4);
|
|
1100
|
-
localFileHeader.generalPurposeBitFlag = buffer.readUInt16LE(6);
|
|
1101
|
-
localFileHeader.compressionMethod = buffer.readUInt16LE(8);
|
|
1102
|
-
localFileHeader.lastModFileTime = buffer.readUInt16LE(10);
|
|
1103
|
-
localFileHeader.lastModFileDate = buffer.readUInt16LE(12);
|
|
1104
|
-
localFileHeader.crc32 = buffer.readUInt32LE(14);
|
|
1105
|
-
localFileHeader.compressedSize = buffer.readUInt32LE(18);
|
|
1106
|
-
localFileHeader.uncompressedSize = buffer.readUInt32LE(22);
|
|
1107
|
-
localFileHeader.fileNameLength = fileNameLength;
|
|
1108
|
-
localFileHeader.extraFieldLength = extraFieldLength;
|
|
1109
|
-
buffer = newBuffer(fileNameLength + extraFieldLength);
|
|
1110
|
-
self.reader.ref();
|
|
1111
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err2) {
|
|
1112
|
-
try {
|
|
1113
|
-
if (err2) return callback(err2);
|
|
1114
|
-
localFileHeader.fileName = buffer.subarray(0, fileNameLength);
|
|
1115
|
-
localFileHeader.extraField = buffer.subarray(fileNameLength);
|
|
1116
|
-
return callback(null, localFileHeader);
|
|
1117
|
-
} finally {
|
|
1118
|
-
self.reader.unref();
|
|
1119
|
-
}
|
|
1120
|
-
});
|
|
1121
|
-
} finally {
|
|
1122
|
-
self.reader.unref();
|
|
1123
|
-
}
|
|
1124
|
-
});
|
|
1125
|
-
};
|
|
1126
|
-
function Entry() {
|
|
1127
|
-
}
|
|
1128
|
-
Entry.prototype.getLastModDate = function(options2) {
|
|
1129
|
-
if (options2 == null) options2 = {};
|
|
1130
|
-
if (!options2.forceDosFormat) {
|
|
1131
|
-
for (var i = 0; i < this.extraFields.length; i++) {
|
|
1132
|
-
var extraField = this.extraFields[i];
|
|
1133
|
-
if (extraField.id === 21589) {
|
|
1134
|
-
var data = extraField.data;
|
|
1135
|
-
if (data.length < 5) continue;
|
|
1136
|
-
var flags = data[0];
|
|
1137
|
-
var HAS_MTIME = 1;
|
|
1138
|
-
if (!(flags & HAS_MTIME)) continue;
|
|
1139
|
-
var posixTimestamp = data.readInt32LE(1);
|
|
1140
|
-
return new Date(posixTimestamp * 1e3);
|
|
1141
|
-
} else if (extraField.id === 10) {
|
|
1142
|
-
var data = extraField.data;
|
|
1143
|
-
if (data.length !== 32) continue;
|
|
1144
|
-
if (data.readUInt16LE(4) !== 1) continue;
|
|
1145
|
-
if (data.readUInt16LE(6) !== 24) continue;
|
|
1146
|
-
var hundredNanoSecondsSince1601 = data.readUInt32LE(8) + 4294967296 * data.readInt32LE(12);
|
|
1147
|
-
var millisecondsSince1970 = hundredNanoSecondsSince1601 / 1e4 - 116444736e5;
|
|
1148
|
-
return new Date(millisecondsSince1970);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime, options2.timezone);
|
|
1153
|
-
};
|
|
1154
|
-
Entry.prototype.isEncrypted = function() {
|
|
1155
|
-
return (this.generalPurposeBitFlag & 1) !== 0;
|
|
1156
|
-
};
|
|
1157
|
-
Entry.prototype.isCompressed = function() {
|
|
1158
|
-
return this.compressionMethod === 8;
|
|
1159
|
-
};
|
|
1160
|
-
function LocalFileHeader() {
|
|
1161
|
-
}
|
|
1162
|
-
function dosDateTimeToDate(date, time, timezone) {
|
|
1163
|
-
var day = date & 31;
|
|
1164
|
-
var month = (date >> 5 & 15) - 1;
|
|
1165
|
-
var year = (date >> 9 & 127) + 1980;
|
|
1166
|
-
var millisecond = 0;
|
|
1167
|
-
var second = (time & 31) * 2;
|
|
1168
|
-
var minute = time >> 5 & 63;
|
|
1169
|
-
var hour = time >> 11 & 31;
|
|
1170
|
-
if (timezone == null || timezone === "local") {
|
|
1171
|
-
return new Date(year, month, day, hour, minute, second, millisecond);
|
|
1172
|
-
} else if (timezone === "UTC") {
|
|
1173
|
-
return new Date(Date.UTC(year, month, day, hour, minute, second, millisecond));
|
|
1174
|
-
} else {
|
|
1175
|
-
throw new Error("unrecognized options.timezone: " + options.timezone);
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
function getFileNameLowLevel(generalPurposeBitFlag, fileNameBuffer, extraFields, strictFileNames) {
|
|
1179
|
-
var fileName = null;
|
|
1180
|
-
for (var i = 0; i < extraFields.length; i++) {
|
|
1181
|
-
var extraField = extraFields[i];
|
|
1182
|
-
if (extraField.id === 28789) {
|
|
1183
|
-
if (extraField.data.length < 6) {
|
|
1184
|
-
continue;
|
|
1185
|
-
}
|
|
1186
|
-
if (extraField.data.readUInt8(0) !== 1) {
|
|
1187
|
-
continue;
|
|
1188
|
-
}
|
|
1189
|
-
var oldNameCrc32 = extraField.data.readUInt32LE(1);
|
|
1190
|
-
if (crc32.unsigned(fileNameBuffer) !== oldNameCrc32) {
|
|
1191
|
-
continue;
|
|
1192
|
-
}
|
|
1193
|
-
fileName = decodeBuffer(extraField.data.subarray(5), true);
|
|
1194
|
-
break;
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
if (fileName == null) {
|
|
1198
|
-
var isUtf8 = (generalPurposeBitFlag & 2048) !== 0;
|
|
1199
|
-
fileName = decodeBuffer(fileNameBuffer, isUtf8);
|
|
1200
|
-
}
|
|
1201
|
-
if (!strictFileNames) {
|
|
1202
|
-
fileName = fileName.replace(/\\/g, "/");
|
|
1203
|
-
}
|
|
1204
|
-
return fileName;
|
|
1205
|
-
}
|
|
1206
|
-
function validateFileName(fileName) {
|
|
1207
|
-
if (fileName.indexOf("\\") !== -1) {
|
|
1208
|
-
return "invalid characters in fileName: " + fileName;
|
|
1209
|
-
}
|
|
1210
|
-
if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
|
|
1211
|
-
return "absolute path: " + fileName;
|
|
1212
|
-
}
|
|
1213
|
-
if (fileName.split("/").indexOf("..") !== -1) {
|
|
1214
|
-
return "invalid relative path: " + fileName;
|
|
1215
|
-
}
|
|
1216
|
-
return null;
|
|
1217
|
-
}
|
|
1218
|
-
function parseExtraFields(extraFieldBuffer) {
|
|
1219
|
-
var extraFields = [];
|
|
1220
|
-
var i = 0;
|
|
1221
|
-
while (i < extraFieldBuffer.length - 3) {
|
|
1222
|
-
var headerId = extraFieldBuffer.readUInt16LE(i + 0);
|
|
1223
|
-
var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
|
|
1224
|
-
var dataStart = i + 4;
|
|
1225
|
-
var dataEnd = dataStart + dataSize;
|
|
1226
|
-
if (dataEnd > extraFieldBuffer.length) throw new Error("extra field length exceeds extra field buffer size");
|
|
1227
|
-
var dataBuffer = extraFieldBuffer.subarray(dataStart, dataEnd);
|
|
1228
|
-
extraFields.push({
|
|
1229
|
-
id: headerId,
|
|
1230
|
-
data: dataBuffer
|
|
1231
|
-
});
|
|
1232
|
-
i = dataEnd;
|
|
1233
|
-
}
|
|
1234
|
-
return extraFields;
|
|
1235
|
-
}
|
|
1236
|
-
function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
|
|
1237
|
-
if (length === 0) {
|
|
1238
|
-
return setImmediate(function() {
|
|
1239
|
-
callback(null, newBuffer(0));
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
|
-
reader.read(buffer, offset, length, position, function(err, bytesRead) {
|
|
1243
|
-
if (err) return callback(err);
|
|
1244
|
-
if (bytesRead < length) {
|
|
1245
|
-
return callback(new Error("unexpected EOF"));
|
|
1246
|
-
}
|
|
1247
|
-
callback();
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
util2.inherits(AssertByteCountStream, Transform);
|
|
1251
|
-
function AssertByteCountStream(byteCount) {
|
|
1252
|
-
Transform.call(this);
|
|
1253
|
-
this.actualByteCount = 0;
|
|
1254
|
-
this.expectedByteCount = byteCount;
|
|
1255
|
-
}
|
|
1256
|
-
AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
|
|
1257
|
-
this.actualByteCount += chunk.length;
|
|
1258
|
-
if (this.actualByteCount > this.expectedByteCount) {
|
|
1259
|
-
var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
|
|
1260
|
-
return cb(new Error(msg));
|
|
1261
|
-
}
|
|
1262
|
-
cb(null, chunk);
|
|
1263
|
-
};
|
|
1264
|
-
AssertByteCountStream.prototype._flush = function(cb) {
|
|
1265
|
-
if (this.actualByteCount < this.expectedByteCount) {
|
|
1266
|
-
var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
|
|
1267
|
-
return cb(new Error(msg));
|
|
1268
|
-
}
|
|
1269
|
-
cb();
|
|
1270
|
-
};
|
|
1271
|
-
util2.inherits(RandomAccessReader, EventEmitter);
|
|
1272
|
-
function RandomAccessReader() {
|
|
1273
|
-
EventEmitter.call(this);
|
|
1274
|
-
this.refCount = 0;
|
|
1275
|
-
}
|
|
1276
|
-
RandomAccessReader.prototype.ref = function() {
|
|
1277
|
-
this.refCount += 1;
|
|
1278
|
-
};
|
|
1279
|
-
RandomAccessReader.prototype.unref = function() {
|
|
1280
|
-
var self = this;
|
|
1281
|
-
self.refCount -= 1;
|
|
1282
|
-
if (self.refCount > 0) return;
|
|
1283
|
-
if (self.refCount < 0) throw new Error("invalid unref");
|
|
1284
|
-
self.close(onCloseDone);
|
|
1285
|
-
function onCloseDone(err) {
|
|
1286
|
-
if (err) return self.emit("error", err);
|
|
1287
|
-
self.emit("close");
|
|
1288
|
-
}
|
|
1289
|
-
};
|
|
1290
|
-
RandomAccessReader.prototype.createReadStream = function(options2) {
|
|
1291
|
-
if (options2 == null) options2 = {};
|
|
1292
|
-
var start = options2.start;
|
|
1293
|
-
var end = options2.end;
|
|
1294
|
-
if (start === end) {
|
|
1295
|
-
var emptyStream = new PassThrough();
|
|
1296
|
-
setImmediate(function() {
|
|
1297
|
-
emptyStream.end();
|
|
1298
|
-
});
|
|
1299
|
-
return emptyStream;
|
|
1300
|
-
}
|
|
1301
|
-
var stream = this._readStreamForRange(start, end);
|
|
1302
|
-
var destroyed = false;
|
|
1303
|
-
var refUnrefFilter = new RefUnrefFilter(this);
|
|
1304
|
-
stream.on("error", function(err) {
|
|
1305
|
-
setImmediate(function() {
|
|
1306
|
-
if (!destroyed) refUnrefFilter.emit("error", err);
|
|
1307
|
-
});
|
|
1308
|
-
});
|
|
1309
|
-
installDestroyFn(refUnrefFilter, function() {
|
|
1310
|
-
stream.unpipe(refUnrefFilter);
|
|
1311
|
-
refUnrefFilter.unref();
|
|
1312
|
-
stream.destroy();
|
|
1313
|
-
});
|
|
1314
|
-
var byteCounter = new AssertByteCountStream(end - start);
|
|
1315
|
-
refUnrefFilter.on("error", function(err) {
|
|
1316
|
-
setImmediate(function() {
|
|
1317
|
-
if (!destroyed) byteCounter.emit("error", err);
|
|
1318
|
-
});
|
|
1319
|
-
});
|
|
1320
|
-
installDestroyFn(byteCounter, function() {
|
|
1321
|
-
destroyed = true;
|
|
1322
|
-
refUnrefFilter.unpipe(byteCounter);
|
|
1323
|
-
refUnrefFilter.destroy();
|
|
1324
|
-
});
|
|
1325
|
-
return stream.pipe(refUnrefFilter).pipe(byteCounter);
|
|
1326
|
-
};
|
|
1327
|
-
RandomAccessReader.prototype._readStreamForRange = function(start, end) {
|
|
1328
|
-
throw new Error("not implemented");
|
|
1329
|
-
};
|
|
1330
|
-
RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
|
|
1331
|
-
var readStream = this.createReadStream({ start: position, end: position + length });
|
|
1332
|
-
var writeStream = new Writable();
|
|
1333
|
-
var written = 0;
|
|
1334
|
-
writeStream._write = function(chunk, encoding, cb) {
|
|
1335
|
-
chunk.copy(buffer, offset + written, 0, chunk.length);
|
|
1336
|
-
written += chunk.length;
|
|
1337
|
-
cb();
|
|
1338
|
-
};
|
|
1339
|
-
writeStream.on("finish", callback);
|
|
1340
|
-
readStream.on("error", function(error) {
|
|
1341
|
-
callback(error);
|
|
1342
|
-
});
|
|
1343
|
-
readStream.pipe(writeStream);
|
|
1344
|
-
};
|
|
1345
|
-
RandomAccessReader.prototype.close = function(callback) {
|
|
1346
|
-
setImmediate(callback);
|
|
1347
|
-
};
|
|
1348
|
-
util2.inherits(RefUnrefFilter, PassThrough);
|
|
1349
|
-
function RefUnrefFilter(context) {
|
|
1350
|
-
PassThrough.call(this);
|
|
1351
|
-
this.context = context;
|
|
1352
|
-
this.context.ref();
|
|
1353
|
-
this.unreffedYet = false;
|
|
1354
|
-
}
|
|
1355
|
-
RefUnrefFilter.prototype._flush = function(cb) {
|
|
1356
|
-
this.unref();
|
|
1357
|
-
cb();
|
|
1358
|
-
};
|
|
1359
|
-
RefUnrefFilter.prototype.unref = function(cb) {
|
|
1360
|
-
if (this.unreffedYet) return;
|
|
1361
|
-
this.unreffedYet = true;
|
|
1362
|
-
this.context.unref();
|
|
1363
|
-
};
|
|
1364
|
-
var cp437 = "\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
|
|
1365
|
-
function decodeBuffer(buffer, isUtf8) {
|
|
1366
|
-
if (isUtf8) {
|
|
1367
|
-
return buffer.toString("utf8");
|
|
1368
|
-
} else {
|
|
1369
|
-
var result = "";
|
|
1370
|
-
for (var i = 0; i < buffer.length; i++) {
|
|
1371
|
-
result += cp437[buffer[i]];
|
|
1372
|
-
}
|
|
1373
|
-
return result;
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
function readUInt64LE(buffer, offset) {
|
|
1377
|
-
var lower32 = buffer.readUInt32LE(offset);
|
|
1378
|
-
var upper32 = buffer.readUInt32LE(offset + 4);
|
|
1379
|
-
return upper32 * 4294967296 + lower32;
|
|
1380
|
-
}
|
|
1381
|
-
var newBuffer;
|
|
1382
|
-
if (typeof Buffer.allocUnsafe === "function") {
|
|
1383
|
-
newBuffer = function(len) {
|
|
1384
|
-
return Buffer.allocUnsafe(len);
|
|
1385
|
-
};
|
|
1386
|
-
} else {
|
|
1387
|
-
newBuffer = function(len) {
|
|
1388
|
-
return new Buffer(len);
|
|
1389
|
-
};
|
|
1390
|
-
}
|
|
1391
|
-
function installDestroyFn(stream, fn) {
|
|
1392
|
-
if (typeof stream.destroy === "function") {
|
|
1393
|
-
stream._destroy = function(err, cb) {
|
|
1394
|
-
fn();
|
|
1395
|
-
if (cb != null) cb(err);
|
|
1396
|
-
};
|
|
1397
|
-
} else {
|
|
1398
|
-
stream.destroy = fn;
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
function defaultCallback(err) {
|
|
1402
|
-
if (err) throw err;
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
});
|
|
1406
|
-
|
|
1407
25
|
// packages/playwright/src/worker/workerProcessEntry.ts
|
|
1408
26
|
var import_common4 = require("../common");
|
|
1409
27
|
|
|
@@ -1418,14 +36,12 @@ var import_path = __toESM(require("path"));
|
|
|
1418
36
|
var import_util = __toESM(require("util"));
|
|
1419
37
|
var debug = require("playwright-core/lib/utilsBundle").debug;
|
|
1420
38
|
var mime = require("playwright-core/lib/utilsBundle").mime;
|
|
1421
|
-
var minimatch = require("playwright-core/lib/utilsBundle")
|
|
39
|
+
var { minimatch } = require("playwright-core/lib/utilsBundle");
|
|
1422
40
|
var { calculateSha1 } = require("playwright-core/lib/coreBundle").utils;
|
|
1423
41
|
var { sanitizeForFilePath } = require("playwright-core/lib/coreBundle").utils;
|
|
1424
42
|
var { isRegExp } = require("playwright-core/lib/coreBundle").iso;
|
|
1425
|
-
var {
|
|
43
|
+
var { stringifyStackFrames, filteredStackTrace } = require("playwright-core/lib/coreBundle").utils;
|
|
1426
44
|
var { ansiRegex, isString, stripAnsiEscapes } = require("playwright-core/lib/coreBundle").iso;
|
|
1427
|
-
var PLAYWRIGHT_TEST_PATH = import_path.default.join(__dirname, "..");
|
|
1428
|
-
var PLAYWRIGHT_CORE_PATH = import_path.default.dirname(require.resolve("playwright-core/package.json"));
|
|
1429
45
|
function filterStackTrace(e) {
|
|
1430
46
|
const name = e.name ? e.name + ": " : "";
|
|
1431
47
|
const cause = e.cause instanceof Error ? filterStackTrace(e.cause) : void 0;
|
|
@@ -1438,27 +54,6 @@ function filterStackTrace(e) {
|
|
|
1438
54
|
cause
|
|
1439
55
|
};
|
|
1440
56
|
}
|
|
1441
|
-
function filterStackFile(file) {
|
|
1442
|
-
if (process.env.PWDEBUGIMPL)
|
|
1443
|
-
return true;
|
|
1444
|
-
if (file.startsWith(PLAYWRIGHT_TEST_PATH))
|
|
1445
|
-
return false;
|
|
1446
|
-
if (file.startsWith(PLAYWRIGHT_CORE_PATH))
|
|
1447
|
-
return false;
|
|
1448
|
-
return true;
|
|
1449
|
-
}
|
|
1450
|
-
function filteredStackTrace(rawStack) {
|
|
1451
|
-
const frames = [];
|
|
1452
|
-
for (const line of rawStack) {
|
|
1453
|
-
const frame = parseStackFrame(line, import_path.default.sep, !!process.env.PWDEBUGIMPL);
|
|
1454
|
-
if (!frame || !frame.file)
|
|
1455
|
-
continue;
|
|
1456
|
-
if (!filterStackFile(frame.file))
|
|
1457
|
-
continue;
|
|
1458
|
-
frames.push(frame);
|
|
1459
|
-
}
|
|
1460
|
-
return frames;
|
|
1461
|
-
}
|
|
1462
57
|
function serializeError(error) {
|
|
1463
58
|
if (error instanceof Error)
|
|
1464
59
|
return filterStackTrace(error);
|
|
@@ -1475,15 +70,6 @@ function formatLocation(location) {
|
|
|
1475
70
|
return relativeFilePath(location.file) + ":" + location.line + ":" + location.column;
|
|
1476
71
|
}
|
|
1477
72
|
var windowsFilesystemFriendlyLength = 60;
|
|
1478
|
-
function trimLongString(s, length = 100) {
|
|
1479
|
-
if (s.length <= length)
|
|
1480
|
-
return s;
|
|
1481
|
-
const hash = calculateSha1(s);
|
|
1482
|
-
const middle = `-${hash.substring(0, 5)}-`;
|
|
1483
|
-
const start = Math.floor((length - middle.length) / 2);
|
|
1484
|
-
const end = length - middle.length - start;
|
|
1485
|
-
return s.substring(0, start) + middle + s.slice(-end);
|
|
1486
|
-
}
|
|
1487
73
|
function addSuffixToFilePath(filePath, suffix) {
|
|
1488
74
|
const ext = import_path.default.extname(filePath);
|
|
1489
75
|
const base = filePath.substring(0, filePath.length - ext.length);
|
|
@@ -1501,24 +87,24 @@ function getContainedPath(parentPath, subPath = "") {
|
|
|
1501
87
|
return null;
|
|
1502
88
|
}
|
|
1503
89
|
var debugTest = debug("pw:test");
|
|
1504
|
-
async function normalizeAndSaveAttachment(outputPath, name,
|
|
1505
|
-
if (
|
|
90
|
+
async function normalizeAndSaveAttachment(outputPath, name, options = {}) {
|
|
91
|
+
if (options.path === void 0 && options.body === void 0)
|
|
1506
92
|
return { name, contentType: "text/plain" };
|
|
1507
|
-
if ((
|
|
93
|
+
if ((options.path !== void 0 ? 1 : 0) + (options.body !== void 0 ? 1 : 0) !== 1)
|
|
1508
94
|
throw new Error(`Exactly one of "path" and "body" must be specified`);
|
|
1509
|
-
if (
|
|
1510
|
-
const hash = calculateSha1(
|
|
95
|
+
if (options.path !== void 0) {
|
|
96
|
+
const hash = calculateSha1(options.path);
|
|
1511
97
|
if (!isString(name))
|
|
1512
98
|
throw new Error('"name" should be string.');
|
|
1513
99
|
const sanitizedNamePrefix = sanitizeForFilePath(name) + "-";
|
|
1514
|
-
const dest = import_path.default.join(outputPath, "attachments", sanitizedNamePrefix + hash + import_path.default.extname(
|
|
100
|
+
const dest = import_path.default.join(outputPath, "attachments", sanitizedNamePrefix + hash + import_path.default.extname(options.path));
|
|
1515
101
|
await import_fs.default.promises.mkdir(import_path.default.dirname(dest), { recursive: true });
|
|
1516
|
-
await import_fs.default.promises.copyFile(
|
|
1517
|
-
const contentType =
|
|
102
|
+
await import_fs.default.promises.copyFile(options.path, dest);
|
|
103
|
+
const contentType = options.contentType ?? (mime.getType(import_path.default.basename(options.path)) || "application/octet-stream");
|
|
1518
104
|
return { name, contentType, path: dest };
|
|
1519
105
|
} else {
|
|
1520
|
-
const contentType =
|
|
1521
|
-
return { name, contentType, body: typeof
|
|
106
|
+
const contentType = options.contentType ?? (typeof options.body === "string" ? "text/plain" : "application/octet-stream");
|
|
107
|
+
return { name, contentType, body: typeof options.body === "string" ? Buffer.from(options.body) : options.body };
|
|
1522
108
|
}
|
|
1523
109
|
}
|
|
1524
110
|
|
|
@@ -1526,6 +112,7 @@ async function normalizeAndSaveAttachment(outputPath, name, options2 = {}) {
|
|
|
1526
112
|
var import_common = require("../common");
|
|
1527
113
|
var { ManualPromise } = require("playwright-core/lib/coreBundle").iso;
|
|
1528
114
|
var { escapeWithQuotes } = require("playwright-core/lib/coreBundle").iso;
|
|
115
|
+
var { filterStackFile } = require("playwright-core/lib/coreBundle").utils;
|
|
1529
116
|
var Fixture = class {
|
|
1530
117
|
constructor(runner, registration) {
|
|
1531
118
|
this.failed = false;
|
|
@@ -1922,13 +509,14 @@ var TimeoutManagerError = class extends Error {
|
|
|
1922
509
|
// packages/playwright/src/worker/testTracing.ts
|
|
1923
510
|
var import_fs2 = __toESM(require("fs"));
|
|
1924
511
|
var import_path2 = __toESM(require("path"));
|
|
1925
|
-
var yauzl = __toESM(require_yauzl());
|
|
1926
512
|
var import_coreBundle = require("playwright-core/lib/coreBundle");
|
|
1927
513
|
var yazl = require("playwright-core/lib/utilsBundle").yazl;
|
|
514
|
+
var yauzl = require("playwright-core/lib/utilsBundle").yauzl;
|
|
1928
515
|
var { ManualPromise: ManualPromise3 } = require("playwright-core/lib/coreBundle").iso;
|
|
1929
516
|
var { monotonicTime: monotonicTime2 } = require("playwright-core/lib/coreBundle").iso;
|
|
1930
517
|
var { calculateSha1: calculateSha12, createGuid } = require("playwright-core/lib/coreBundle").utils;
|
|
1931
518
|
var { SerializedFS } = require("playwright-core/lib/coreBundle").utils;
|
|
519
|
+
var { filteredStackTrace: filteredStackTrace2 } = require("playwright-core/lib/coreBundle").utils;
|
|
1932
520
|
var testTraceEntryName = "test.trace";
|
|
1933
521
|
var version = 8;
|
|
1934
522
|
var traceOrdinal = 0;
|
|
@@ -2087,9 +675,9 @@ var TestTracing = class {
|
|
|
2087
675
|
}
|
|
2088
676
|
const traceContent = Buffer.from(this._traceEvents.map((e) => JSON.stringify(e)).join("\n"));
|
|
2089
677
|
zipFile.addBuffer(traceContent, testTraceEntryName);
|
|
2090
|
-
await new Promise((
|
|
678
|
+
await new Promise((resolve, reject) => {
|
|
2091
679
|
zipFile.end(void 0, () => {
|
|
2092
|
-
zipFile.outputStream.pipe(import_fs2.default.createWriteStream(this._generateNextTraceRecordingPath())).on("close",
|
|
680
|
+
zipFile.outputStream.pipe(import_fs2.default.createWriteStream(this._generateNextTraceRecordingPath())).on("close", resolve).on("error", reject);
|
|
2093
681
|
});
|
|
2094
682
|
});
|
|
2095
683
|
const tracePath = this._testInfo.outputPath("trace.zip");
|
|
@@ -2098,7 +686,7 @@ var TestTracing = class {
|
|
|
2098
686
|
}
|
|
2099
687
|
appendForError(error) {
|
|
2100
688
|
const rawStack = error.stack?.split("\n") || [];
|
|
2101
|
-
const stack = rawStack ?
|
|
689
|
+
const stack = rawStack ? filteredStackTrace2(rawStack) : [];
|
|
2102
690
|
this._appendTraceEvent({
|
|
2103
691
|
type: "error",
|
|
2104
692
|
message: this._formatError(error),
|
|
@@ -2119,19 +707,19 @@ var TestTracing = class {
|
|
|
2119
707
|
base64: typeof chunk === "string" ? void 0 : chunk.toString("base64")
|
|
2120
708
|
});
|
|
2121
709
|
}
|
|
2122
|
-
appendBeforeActionForStep(
|
|
710
|
+
appendBeforeActionForStep(options) {
|
|
2123
711
|
this._appendTraceEvent({
|
|
2124
712
|
type: "before",
|
|
2125
|
-
callId:
|
|
2126
|
-
stepId:
|
|
2127
|
-
parentId:
|
|
713
|
+
callId: options.stepId,
|
|
714
|
+
stepId: options.stepId,
|
|
715
|
+
parentId: options.parentId,
|
|
2128
716
|
startTime: monotonicTime2(),
|
|
2129
717
|
class: "Test",
|
|
2130
|
-
method:
|
|
2131
|
-
title:
|
|
2132
|
-
params: Object.fromEntries(Object.entries(
|
|
2133
|
-
stack:
|
|
2134
|
-
group:
|
|
718
|
+
method: options.category,
|
|
719
|
+
title: options.title,
|
|
720
|
+
params: Object.fromEntries(Object.entries(options.params || {}).map(([name, value]) => [name, generatePreview(value)])),
|
|
721
|
+
stack: options.stack,
|
|
722
|
+
group: options.group
|
|
2135
723
|
});
|
|
2136
724
|
}
|
|
2137
725
|
appendAfterActionForStep(callId, error, attachments = [], annotations) {
|
|
@@ -2248,11 +836,11 @@ function testInfoError(error) {
|
|
|
2248
836
|
// packages/playwright/src/worker/testInfo.ts
|
|
2249
837
|
var import_common2 = require("../common");
|
|
2250
838
|
var { ManualPromise: ManualPromise4 } = require("playwright-core/lib/coreBundle").iso;
|
|
2251
|
-
var { captureRawStack, stringifyStackFrames: stringifyStackFrames2 } = require("playwright-core/lib/coreBundle").
|
|
839
|
+
var { captureRawStack, stringifyStackFrames: stringifyStackFrames2, filteredStackTrace: filteredStackTrace3 } = require("playwright-core/lib/coreBundle").utils;
|
|
2252
840
|
var { escapeWithQuotes: escapeWithQuotes2 } = require("playwright-core/lib/coreBundle").iso;
|
|
2253
841
|
var { monotonicTime: monotonicTime3 } = require("playwright-core/lib/coreBundle").iso;
|
|
2254
842
|
var { createGuid: createGuid2 } = require("playwright-core/lib/coreBundle").utils;
|
|
2255
|
-
var { sanitizeForFilePath: sanitizeForFilePath2 } = require("playwright-core/lib/coreBundle").utils;
|
|
843
|
+
var { sanitizeForFilePath: sanitizeForFilePath2, trimLongString } = require("playwright-core/lib/coreBundle").utils;
|
|
2256
844
|
var { currentZone } = require("playwright-core/lib/coreBundle").utils;
|
|
2257
845
|
var emtpyTestInfoCallbacks = {
|
|
2258
846
|
onStepBegin: () => {
|
|
@@ -2287,7 +875,7 @@ var TestInfoImpl = class {
|
|
|
2287
875
|
this._startTime = monotonicTime3();
|
|
2288
876
|
this._startWallTime = Date.now();
|
|
2289
877
|
this._requireFile = test?._requireFile ?? "";
|
|
2290
|
-
this._uniqueSymbol = Symbol("testInfoUniqueSymbol");
|
|
878
|
+
this._uniqueSymbol = /* @__PURE__ */ Symbol("testInfoUniqueSymbol");
|
|
2291
879
|
this._workerParams = workerParams;
|
|
2292
880
|
this.repeatEachIndex = workerParams.repeatEachIndex;
|
|
2293
881
|
this.retry = retry;
|
|
@@ -2404,7 +992,7 @@ var TestInfoImpl = class {
|
|
|
2404
992
|
if (!parentStep)
|
|
2405
993
|
parentStep = this._parentStep();
|
|
2406
994
|
}
|
|
2407
|
-
const filteredStack =
|
|
995
|
+
const filteredStack = filteredStackTrace3(captureRawStack());
|
|
2408
996
|
let boxedStack = parentStep?.boxedStack;
|
|
2409
997
|
let location = data.location;
|
|
2410
998
|
if (!boxedStack && data.box) {
|
|
@@ -2509,16 +1097,24 @@ ${stringifyStackFrames2(step.boxedStack).join("\n")}`;
|
|
|
2509
1097
|
if (this.status === "passed")
|
|
2510
1098
|
this.status = "interrupted";
|
|
2511
1099
|
}
|
|
2512
|
-
_failWithError(
|
|
1100
|
+
_failWithError(root) {
|
|
2513
1101
|
if (this.status === "passed" || this.status === "skipped")
|
|
2514
|
-
this.status =
|
|
2515
|
-
const
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
1102
|
+
this.status = root instanceof TimeoutManagerError ? "timedOut" : "failed";
|
|
1103
|
+
const visit = (error) => {
|
|
1104
|
+
const serialized = testInfoError(error);
|
|
1105
|
+
const step = error === root && typeof error === "object" ? error?.[stepSymbol] : void 0;
|
|
1106
|
+
if (step && step.boxedStack)
|
|
1107
|
+
serialized.stack = `${error.name}: ${error.message}
|
|
2519
1108
|
${stringifyStackFrames2(step.boxedStack).join("\n")}`;
|
|
2520
|
-
|
|
2521
|
-
|
|
1109
|
+
this.errors.push(serialized);
|
|
1110
|
+
this._tracing.appendForError(serialized);
|
|
1111
|
+
const children = error?.errors;
|
|
1112
|
+
if (Array.isArray(children)) {
|
|
1113
|
+
for (const child of children)
|
|
1114
|
+
visit(child);
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
visit(root);
|
|
2522
1118
|
}
|
|
2523
1119
|
async _runAsStep(stepInfo, cb) {
|
|
2524
1120
|
const step = this._addStep(stepInfo);
|
|
@@ -2574,13 +1170,13 @@ ${stringifyStackFrames2(step.boxedStack).join("\n")}`;
|
|
|
2574
1170
|
await cb();
|
|
2575
1171
|
}
|
|
2576
1172
|
// ------------ TestInfo methods ------------
|
|
2577
|
-
async attach(name,
|
|
1173
|
+
async attach(name, options = {}) {
|
|
2578
1174
|
const step = this._addStep({
|
|
2579
1175
|
title: `Attach ${escapeWithQuotes2(name, '"')}`,
|
|
2580
1176
|
category: "test.attach"
|
|
2581
1177
|
});
|
|
2582
1178
|
this._attach(
|
|
2583
|
-
await normalizeAndSaveAttachment(this.outputPath(), name,
|
|
1179
|
+
await normalizeAndSaveAttachment(this.outputPath(), name, options),
|
|
2584
1180
|
step.stepId
|
|
2585
1181
|
);
|
|
2586
1182
|
step.complete({});
|
|
@@ -2679,9 +1275,9 @@ ${stringifyStackFrames2(step.boxedStack).join("\n")}`;
|
|
|
2679
1275
|
snapshotPath(...args) {
|
|
2680
1276
|
let name = args;
|
|
2681
1277
|
let kind = "snapshot";
|
|
2682
|
-
const
|
|
2683
|
-
if (
|
|
2684
|
-
kind =
|
|
1278
|
+
const options = args[args.length - 1];
|
|
1279
|
+
if (options && typeof options === "object") {
|
|
1280
|
+
kind = options.kind ?? kind;
|
|
2685
1281
|
name = args.slice(0, -1);
|
|
2686
1282
|
}
|
|
2687
1283
|
if (!["snapshot", "screenshot", "aria"].includes(kind))
|
|
@@ -2723,8 +1319,8 @@ var TestStepInfoImpl = class {
|
|
|
2723
1319
|
throw e;
|
|
2724
1320
|
}
|
|
2725
1321
|
}
|
|
2726
|
-
async attach(name,
|
|
2727
|
-
this._testInfo._attach(await normalizeAndSaveAttachment(this._testInfo.outputPath(), name,
|
|
1322
|
+
async attach(name, options) {
|
|
1323
|
+
this._testInfo._attach(await normalizeAndSaveAttachment(this._testInfo.outputPath(), name, options), this._stepId);
|
|
2728
1324
|
}
|
|
2729
1325
|
get titlePath() {
|
|
2730
1326
|
const parent = this._parentStep ?? this._testInfo;
|
|
@@ -2737,13 +1333,14 @@ var TestAbortError = class extends Error {
|
|
|
2737
1333
|
};
|
|
2738
1334
|
var StepSkipError = class extends Error {
|
|
2739
1335
|
};
|
|
2740
|
-
var stepSymbol = Symbol("step");
|
|
1336
|
+
var stepSymbol = /* @__PURE__ */ Symbol("step");
|
|
2741
1337
|
|
|
2742
1338
|
// packages/playwright/src/worker/workerMain.ts
|
|
2743
1339
|
var colors2 = require("playwright-core/lib/utilsBundle").colors;
|
|
2744
1340
|
var { ManualPromise: ManualPromise5 } = require("playwright-core/lib/coreBundle").iso;
|
|
2745
1341
|
var { removeFolders } = require("playwright-core/lib/coreBundle").utils;
|
|
2746
1342
|
var { gracefullyCloseAll } = require("playwright-core/lib/coreBundle").utils;
|
|
1343
|
+
var { filteredStackTrace: filteredStackTrace4 } = require("playwright-core/lib/coreBundle").utils;
|
|
2747
1344
|
var WorkerMain = class extends import_common3.ProcessRunner {
|
|
2748
1345
|
constructor(params) {
|
|
2749
1346
|
super();
|
|
@@ -2891,6 +1488,8 @@ var WorkerMain = class extends import_common3.ProcessRunner {
|
|
|
2891
1488
|
import_common3.suiteUtils.applyRepeatEachIndex(this._project, suite, this._params.repeatEachIndex);
|
|
2892
1489
|
import_common3.suiteUtils.filterTestsRemoveEmptySuites(suite, (test) => entries.has(test.id));
|
|
2893
1490
|
const tests = suite.allTests();
|
|
1491
|
+
for (const test of tests)
|
|
1492
|
+
test.annotations.push(...entries.get(test.id).planAnnotations);
|
|
2894
1493
|
const unknownTestIds = new Set(entries.keys());
|
|
2895
1494
|
for (const test of tests)
|
|
2896
1495
|
unknownTestIds.delete(test.id);
|
|
@@ -2988,7 +1587,7 @@ var WorkerMain = class extends import_common3.ProcessRunner {
|
|
|
2988
1587
|
globals.setCurrentTestInfo(testInfo);
|
|
2989
1588
|
(0, import_expect.setExpectConfig)({
|
|
2990
1589
|
testInfo,
|
|
2991
|
-
filteredStackTrace,
|
|
1590
|
+
filteredStackTrace: filteredStackTrace4,
|
|
2992
1591
|
ignoreSnapshots: testInfo._projectInternal.project.ignoreSnapshots,
|
|
2993
1592
|
updateSnapshots: testInfo.config.updateSnapshots,
|
|
2994
1593
|
timeout: testInfo._projectInternal.expect?.timeout,
|
|
@@ -3119,7 +1718,7 @@ var WorkerMain = class extends import_common3.ProcessRunner {
|
|
|
3119
1718
|
testInfo.duration = testInfo._timeoutManager.defaultSlot().elapsed + afterHooksSlot.elapsed | 0;
|
|
3120
1719
|
this._currentTest = null;
|
|
3121
1720
|
globals.setCurrentTestInfo(null);
|
|
3122
|
-
(0, import_expect.setExpectConfig)({ testInfo: null, filteredStackTrace, ignoreSnapshots: false, updateSnapshots: "missing" });
|
|
1721
|
+
(0, import_expect.setExpectConfig)({ testInfo: null, filteredStackTrace: filteredStackTrace4, ignoreSnapshots: false, updateSnapshots: "missing" });
|
|
3123
1722
|
this.dispatchEvent("testEnd", buildTestEndPayload(testInfo));
|
|
3124
1723
|
const preserveOutput = this._config.config.preserveOutput === "always" || this._config.config.preserveOutput === "failures-only" && testInfo._isFailure();
|
|
3125
1724
|
if (!preserveOutput)
|