1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-19 19:52:51 +02:00

Fix make target dig-snfe

This commit is contained in:
Raymond Hill 2022-12-22 13:13:38 -05:00
parent bfed6059d4
commit e5a9b066ec
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -28,8 +28,8 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { createRequire } from 'module'; import { createRequire } from 'module';
import { readFileSync, writeFileSync } from 'fs'; import { readFile, writeFile, mkdir } from 'fs/promises';
import { dirname, resolve } from 'path'; import { dirname } from 'path';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));
@ -81,11 +81,12 @@ function nanoToMicro(bigint) {
} }
async function read(path) { async function read(path) {
return readFileSync(resolve(__dirname, path), 'utf8'); return readFile(path, 'utf8');
} }
async function write(path, data) { async function write(path, data) {
return writeFileSync(resolve(__dirname, path), data, 'utf8'); await mkdir(dirname(path), { recursive: true });
return writeFile(path, data, 'utf8');
} }
/******************************************************************************/ /******************************************************************************/
@ -356,9 +357,9 @@ async function bench() {
.then(raw => ({ name: 'resource-abuse', raw })), .then(raw => ({ name: 'resource-abuse', raw })),
read('assets/ublock/unbreak.txt') read('assets/ublock/unbreak.txt')
.then(raw => ({ name: 'unbreak.txt', raw })), .then(raw => ({ name: 'unbreak.txt', raw })),
read('assets/thirdparties/easylist-downloads.adblockplus.org/easylist.txt') read('assets/thirdparties/easylist/easylist.txt')
.then(raw => ({ name: 'easylist', raw })), .then(raw => ({ name: 'easylist', raw })),
read('assets/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt') read('assets/thirdparties/easylist/easyprivacy.txt')
.then(raw => ({ name: 'easyprivacy', raw })), .then(raw => ({ name: 'easyprivacy', raw })),
read('assets/thirdparties/pgl.yoyo.org/as/serverlist') read('assets/thirdparties/pgl.yoyo.org/as/serverlist')
.then(raw => ({ name: 'PGL', raw })), .then(raw => ({ name: 'PGL', raw })),