chore: roll @zip.js/zip.js to 2.7.29 (#27047)

This commit is contained in:
Max Schmitt 2023-09-13 18:39:10 +02:00 committed by GitHub
parent c06ed8c0bc
commit ce43ea7d99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 12 deletions

16
package-lock.json generated
View file

@ -35,7 +35,7 @@
"@typescript-eslint/parser": "^6.6.0", "@typescript-eslint/parser": "^6.6.0",
"@vitejs/plugin-basic-ssl": "^1.0.1", "@vitejs/plugin-basic-ssl": "^1.0.1",
"@vitejs/plugin-react": "^3.1.0", "@vitejs/plugin-react": "^3.1.0",
"@zip.js/zip.js": "^2.4.2", "@zip.js/zip.js": "^2.7.29",
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"colors": "^1.4.0", "colors": "^1.4.0",
"commonmark": "^0.30.0", "commonmark": "^0.30.0",
@ -2016,9 +2016,15 @@
"peer": true "peer": true
}, },
"node_modules/@zip.js/zip.js": { "node_modules/@zip.js/zip.js": {
"version": "2.4.2", "version": "2.7.29",
"resolved": "https://registry.npmjs.org/@zip.js/zip.js/-/zip.js-2.7.29.tgz",
"integrity": "sha512-KtOa3HY7Vi77ctZAVhx2nsKweDTCP4DVBghZkvg5qyIX6T/Z54QlU6f0q2hFhxu5j+LgUDeMMhiv2xj4ZF6snA==",
"dev": true, "dev": true,
"license": "BSD-3-Clause" "engines": {
"bun": ">=0.7.0",
"deno": ">=1.0.0",
"node": ">=16.5.0"
}
}, },
"node_modules/abbrev": { "node_modules/abbrev": {
"version": "1.1.1", "version": "1.1.1",
@ -8007,7 +8013,9 @@
"peer": true "peer": true
}, },
"@zip.js/zip.js": { "@zip.js/zip.js": {
"version": "2.4.2", "version": "2.7.29",
"resolved": "https://registry.npmjs.org/@zip.js/zip.js/-/zip.js-2.7.29.tgz",
"integrity": "sha512-KtOa3HY7Vi77ctZAVhx2nsKweDTCP4DVBghZkvg5qyIX6T/Z54QlU6f0q2hFhxu5j+LgUDeMMhiv2xj4ZF6snA==",
"dev": true "dev": true
}, },
"abbrev": { "abbrev": {

View file

@ -70,7 +70,7 @@
"@typescript-eslint/parser": "^6.6.0", "@typescript-eslint/parser": "^6.6.0",
"@vitejs/plugin-basic-ssl": "^1.0.1", "@vitejs/plugin-basic-ssl": "^1.0.1",
"@vitejs/plugin-react": "^3.1.0", "@vitejs/plugin-react": "^3.1.0",
"@zip.js/zip.js": "^2.4.2", "@zip.js/zip.js": "^2.7.29",
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"colors": "^1.4.0", "colors": "^1.4.0",
"commonmark": "^0.30.0", "commonmark": "^0.30.0",

View file

@ -46,7 +46,7 @@ class ZipReport implements LoadedReport {
private _json!: HTMLReport; private _json!: HTMLReport;
async load() { async load() {
const zipReader = new zipjs.ZipReader(new zipjs.Data64URIReader((window as any).playwrightReportBase64), { useWebWorkers: false }) as zip.ZipReader; const zipReader = new zipjs.ZipReader(new zipjs.Data64URIReader((window as any).playwrightReportBase64), { useWebWorkers: false });
for (const entry of await zipReader.getEntries()) for (const entry of await zipReader.getEntries())
this._entries.set(entry.filename, entry); this._entries.set(entry.filename, entry);
this._json = await this.entry('report.json') as HTMLReport; this._json = await this.entry('report.json') as HTMLReport;

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
type Progress = (done: number, total: number) => void; type Progress = (done: number, total: number) => undefined;
export function splitProgress(progress: Progress, weights: number[]): Progress[] { export function splitProgress(progress: Progress, weights: number[]): Progress[] {
const doneList = new Array(weights.length).fill(0); const doneList = new Array(weights.length).fill(0);

View file

@ -37,7 +37,7 @@ const loadedTraces = new Map<string, { traceModel: TraceModel, snapshotServer: S
const clientIdToTraceUrls = new Map<string, Set<string>>(); const clientIdToTraceUrls = new Map<string, Set<string>>();
async function loadTrace(traceUrl: string, traceFileName: string | null, clientId: string, progress: (done: number, total: number) => void): Promise<TraceModel> { async function loadTrace(traceUrl: string, traceFileName: string | null, clientId: string, progress: (done: number, total: number) => undefined): Promise<TraceModel> {
await gc(); await gc();
let set = clientIdToTraceUrls.get(clientId); let set = clientIdToTraceUrls.get(clientId);
if (!set) { if (!set) {

View file

@ -16,23 +16,24 @@
import type zip from '@zip.js/zip.js'; import type zip from '@zip.js/zip.js';
// @ts-ignore // @ts-ignore
import zipImport from '@zip.js/zip.js/dist/zip-no-worker-inflate.min.js'; import * as zipImport from '@zip.js/zip.js/lib/zip-no-worker-inflate.js';
import type { TraceModelBackend } from './traceModel'; import type { TraceModelBackend } from './traceModel';
const zipjs = zipImport as typeof zip; const zipjs = zipImport as typeof zip;
type Progress = (done: number, total: number) => void; type Progress = (done: number, total: number) => undefined;
export class ZipTraceModelBackend implements TraceModelBackend { export class ZipTraceModelBackend implements TraceModelBackend {
private _zipReader: zip.ZipReader; private _zipReader: zip.ZipReader<unknown>;
private _entriesPromise: Promise<Map<string, zip.Entry>>; private _entriesPromise: Promise<Map<string, zip.Entry>>;
private _traceURL: string; private _traceURL: string;
constructor(traceURL: string, progress: Progress) { constructor(traceURL: string, progress: Progress) {
this._traceURL = traceURL; this._traceURL = traceURL;
zipjs.configure({ baseURL: self.location.href } as any);
this._zipReader = new zipjs.ZipReader( this._zipReader = new zipjs.ZipReader(
new zipjs.HttpReader(formatUrl(traceURL), { mode: 'cors', preventHeadRequest: true } as any), new zipjs.HttpReader(formatUrl(traceURL), { mode: 'cors', preventHeadRequest: true } as any),
{ useWebWorkers: false }) as zip.ZipReader; { useWebWorkers: false });
this._entriesPromise = this._zipReader.getEntries({ onprogress: progress }).then(entries => { this._entriesPromise = this._zipReader.getEntries({ onprogress: progress }).then(entries => {
const map = new Map<string, zip.Entry>(); const map = new Map<string, zip.Entry>();
for (const entry of entries) for (const entry of entries)