Skip to content

Commit 1bbce4e

Browse files
committed
deps: update to wabac.js 2.25.1
cleanup: remove unneeded type warnings
1 parent 26fdca5 commit 1bbce4e

File tree

6 files changed

+22
-35
lines changed

6 files changed

+22
-35
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@fortawesome/fontawesome-free": "^5.13.0",
1515
"@ipld/car": "^5.3.2",
1616
"@ipld/unixfs": "^3.0.0",
17-
"@webrecorder/wabac": "^2.24.5",
17+
"@webrecorder/wabac": "^2.25.0",
1818
"auto-js-ipfs": "^2.3.0",
1919
"browsertrix-behaviors": "^0.9.5",
2020
"btoa": "^1.2.1",
@@ -69,7 +69,7 @@
6969
"webpack-extension-reloader": "^1.1.4"
7070
},
7171
"resolutions": {
72-
"@webrecorder/wabac": "^2.24.5"
72+
"@webrecorder/wabac": "^2.25.0"
7373
},
7474
"files": [
7575
"src/",

src/sw/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ class ExtAPI extends API {
161161
const urlObj = new URL(url);
162162
urlObj.searchParams.set("filename", filename || "");
163163
urlObj.searchParams.set("name", dl.metadata["title"] || filename || "");
164-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
165164
const fetchPromise = fetch(urlObj.href, {
166165
method: "PUT",
167166
headers,
@@ -464,6 +463,7 @@ class CountingStream {
464463
}
465464

466465
transformStream() {
466+
// eslint-disable-next-line @typescript-eslint/no-this-alias
467467
const counterStream = this;
468468

469469
return new TransformStream({

src/sw/ipfsutils.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type MetadataWithIPFS = CollMetadata & {
3535
ipfsPins?: { url: string; cid: string }[] | null;
3636
};
3737

38+
// eslint-disable-next-line @typescript-eslint/require-await
3839
export async function setAutoIPFSUrl(url: string) {
3940
if (autoipfsOpts.daemonURL !== url) {
4041
autoipfs = null;
@@ -213,7 +214,6 @@ async function ipfsWriteBuff(
213214
const file = UnixFS.createFileWriter(writer);
214215
if (content instanceof Uint8Array) {
215216
await file.write(content);
216-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
217217
} else if (content[Symbol.asyncIterator]) {
218218
for await (const chunk of content) {
219219
await file.write(chunk);
@@ -347,7 +347,6 @@ async function splitByWarcRecordGroup(
347347
links = [];
348348
}
349349

350-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
351350
fileLinks.push(link);
352351

353352
const [dirName, filename] = getDirAndName(currName);
@@ -364,7 +363,6 @@ async function splitByWarcRecordGroup(
364363
dir = dirs[dirName];
365364
}
366365

367-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
368366
dir.set(filename, link);
369367

370368
inZipFile = false;
@@ -379,7 +377,6 @@ async function splitByWarcRecordGroup(
379377
file = UnixFS.createFileWriter(writer);
380378

381379
if (chunk === WARC_GROUP) {
382-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
383380
secondaryLinks.push(await concat(writer, links));
384381
links = [];
385382
}
@@ -416,7 +413,6 @@ async function splitByWarcRecordGroup(
416413

417414
rootDir.set("webarchive", await waczDir.close());
418415

419-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
420416
rootDir.set(waczPath, await concat(writer, fileLinks));
421417
}
422418

@@ -429,7 +425,6 @@ async function concat(
429425
const { fileEncoder, hasher, linker } = writer.settings;
430426
// eslint-disable-next-line @typescript-eslint/no-explicit-any
431427
const advanced = (fileEncoder as any).createAdvancedFile(links);
432-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
433428
const bytes = fileEncoder.encode(advanced);
434429
const hash = await hasher.digest(bytes);
435430
const cid = linker.createLink(fileEncoder.code, hash);
@@ -449,7 +444,6 @@ async function concat(
449444

450445
export const iterate = async function* (stream: ReadableStream<Uint8Array>) {
451446
const reader = stream.getReader();
452-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
453447
while (true) {
454448
const next = await reader.read();
455449
if (next.done) {
@@ -462,7 +456,6 @@ export const iterate = async function* (stream: ReadableStream<Uint8Array>) {
462456

463457
// eslint-disable-next-line @typescript-eslint/no-explicit-any
464458
export async function encodeBlocks(blocks: UnixFS.Block[], root?: any) {
465-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
466459
const { writer, out } = CarWriter.create(root);
467460
/** @type {Error?} */
468461
let error;
@@ -480,7 +473,6 @@ export async function encodeBlocks(blocks: UnixFS.Block[], root?: any) {
480473
})();
481474
const chunks = [];
482475
for await (const chunk of out) chunks.push(chunk);
483-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
484476
if (error != null) throw error;
485477
const roots = root != null ? [root] : [];
486478
console.log("chunks", chunks.length);
@@ -558,7 +550,6 @@ export class ShardingStream extends TransformStream {
558550
shard = [];
559551
currSize = 0;
560552
}
561-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
562553
shard.push(block);
563554
currSize += block.bytes.length;
564555
},

src/sw/keystore.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,11 @@ export class KeyStore {
7171

7272
async listAll() {
7373
await this._ready;
74-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
7574
return await this.db!.getAll(this.mainStore);
7675
}
7776

7877
async get(name: string) {
7978
await this._ready;
80-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
8179
return await this.db!.get(this.mainStore, name);
8280
}
8381

@@ -209,7 +207,6 @@ export class Signer {
209207

210208
async loadSig(id: string): Promise<string> {
211209
const res = await this._store!.get(id);
212-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
213210
return res?.sig;
214211
}
215212

@@ -219,7 +216,6 @@ export class Signer {
219216

220217
async loadKeys(id = "_userkey"): Promise<KeyPair | null> {
221218
const res = await this._store!.get(id);
222-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
223219
return res?.keys;
224220
}
225221
}

src/sw/recproxy.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export class RecProxy extends ArchiveDB {
4646

4747
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4848
constructor(config: any, collLoader: CollectionLoader) {
49-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
5049
super(config.dbname);
5150

5251
this.name = config.dbname.slice(3);
@@ -55,7 +54,6 @@ export class RecProxy extends ArchiveDB {
5554

5655
this.recordProxied = config.extraConfig.recordProxied || false;
5756

58-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
5957
this.liveProxy = new LiveProxy(config.extraConfig, {
6058
cloneResponse: true,
6159
allowBody: true,
@@ -93,7 +91,7 @@ export class RecProxy extends ArchiveDB {
9391

9492
async getCounter(): Promise<number | undefined> {
9593
//TODO: fix
96-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return
94+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9795
return await (this.db! as any).get("rec", "numPending");
9896
}
9997

@@ -131,7 +129,6 @@ export class RecProxy extends ArchiveDB {
131129
}
132130

133131
// don't record content proxied from specified hosts
134-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
135132
if (!this.recordProxied && this.liveProxy.hostProxy) {
136133
const parsedUrl = new URL(response!.url);
137134
if (this.liveProxy.hostProxy[parsedUrl.host]) {
@@ -297,7 +294,6 @@ export class RecordingCollections extends SWCollections {
297294
return store;
298295
}
299296

300-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
301297
return await super._initStore(type, config);
302298
}
303299

@@ -306,7 +302,6 @@ export class RecordingCollections extends SWCollections {
306302

307303
switch (event.data.msg_type) {
308304
case "toggle-record":
309-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
310305
coll = await this.getColl(event.data.id);
311306
if (coll && coll.store instanceof RecProxy) {
312307
console.log("Recording Toggled!", event.data.isRecording);
@@ -315,10 +310,8 @@ export class RecordingCollections extends SWCollections {
315310
break;
316311

317312
case "update-favicon":
318-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
319313
coll = await this.getColl(event.data.id);
320314
if (coll && coll.store instanceof RecProxy) {
321-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
322315
await coll.store.updateFavIcon(event.data.url, event.data.favIconUrl);
323316
}
324317
break;

yarn.lock

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,16 +2401,16 @@
24012401
resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e"
24022402
integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==
24032403

2404-
"@webrecorder/wabac@^2.24.5":
2405-
version "2.24.5"
2406-
resolved "https://registry.yarnpkg.com/@webrecorder/wabac/-/wabac-2.24.5.tgz#253b0d5a9b7691af475c7a158c6483df33f2d3ff"
2407-
integrity sha512-Wt9bdZMYrl+DYRkUdRfYAPSUfygHBQGIiZ9oMZ/DRLIeqsqeN36UBGuvbj6kmUawLNWRYVQj6kNl/ndtRZSa6w==
2404+
"@webrecorder/wabac@^2.24.5", "@webrecorder/wabac@^2.25.0":
2405+
version "2.25.0"
2406+
resolved "https://registry.yarnpkg.com/@webrecorder/wabac/-/wabac-2.25.0.tgz#232eeb2dd9bdf58871aeeff6bfe4a18be30e0046"
2407+
integrity sha512-pJF0RavEGUwRGNWfhQtPgO7Ry7Sr1l50pf9RvvH3YCCNdRpcfhDw6oRf/Zc3V8z2UpBHLRInWwrjTiUV3WuJPg==
24082408
dependencies:
24092409
"@peculiar/asn1-ecc" "^2.3.4"
24102410
"@peculiar/asn1-schema" "^2.3.3"
24112411
"@peculiar/x509" "^1.9.2"
24122412
"@types/js-levenshtein" "^1.1.3"
2413-
"@webrecorder/wombat" "^3.10.1"
2413+
"@webrecorder/wombat" "^3.10.2"
24142414
acorn-loose "^8.5.2"
24152415
auto-js-ipfs "^2.1.1"
24162416
base64-js "^1.5.1"
@@ -2421,7 +2421,7 @@
24212421
http-status-codes "^2.1.4"
24222422
idb "^7.1.1"
24232423
js-levenshtein "^1.1.6"
2424-
js-yaml "^4.1.0"
2424+
js-yaml "^4.1.1"
24252425
pako "^1.0.11"
24262426
parse5-html-rewriting-stream "^7.0.0"
24272427
parse5-sax-parser "^7.0.0"
@@ -2430,10 +2430,10 @@
24302430
stream-browserify "^3.0.0"
24312431
warcio "^2.4.7"
24322432

2433-
"@webrecorder/wombat@^3.10.1":
2434-
version "3.10.1"
2435-
resolved "https://registry.yarnpkg.com/@webrecorder/wombat/-/wombat-3.10.1.tgz#d45417f9ef61c9f02357bacf1ba930f6e09dd7fa"
2436-
integrity sha512-OzYrv3iqC1AdgjG+QD/tNQi6+yv+1izzr2PoN+40AvleL+RLsIk/AwOmdYJpz9r+L7UIOdRrK4v/JrUWPwUDzw==
2433+
"@webrecorder/wombat@^3.10.2":
2434+
version "3.10.2"
2435+
resolved "https://registry.yarnpkg.com/@webrecorder/wombat/-/wombat-3.10.2.tgz#0d8e4057be66e4b67a522b605f8be907f912d5e0"
2436+
integrity sha512-01vr0mf+ecggorX6nyxTyf8gYrFichu1UE8RQi71Ckz8DAf+mxym96ozecq9bcS80+4Bkb7vFLAGyb4h6ZRXAw==
24372437
dependencies:
24382438
warcio "^2.4.7"
24392439

@@ -5606,6 +5606,13 @@ js-yaml@^4.1.0:
56065606
dependencies:
56075607
argparse "^2.0.1"
56085608

5609+
js-yaml@^4.1.1:
5610+
version "4.1.1"
5611+
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.1.tgz#854c292467705b699476e1a2decc0c8a3458806b"
5612+
integrity sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==
5613+
dependencies:
5614+
argparse "^2.0.1"
5615+
56095616
jsbn@1.1.0:
56105617
version "1.1.0"
56115618
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040"

0 commit comments

Comments
 (0)