mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Perf: make build faster
This commit is contained in:
@@ -29,9 +29,7 @@ async function processDomainLists(domainListsUrl) {
|
||||
/** @type Set<string> */
|
||||
const domainSets = new Set();
|
||||
|
||||
const rl = await fetchRemoteTextAndCreateReadlineInterface(domainListsUrl);
|
||||
|
||||
for await (const line of rl) {
|
||||
for await (const line of await fetchRemoteTextAndCreateReadlineInterface(domainListsUrl)) {
|
||||
if (line.startsWith('!')) {
|
||||
continue;
|
||||
}
|
||||
@@ -65,9 +63,8 @@ async function processHosts(hostsUrl, includeAllSubDomain = false) {
|
||||
/** @type Set<string> */
|
||||
const domainSets = new Set();
|
||||
|
||||
const rl = await fetchRemoteTextAndCreateReadlineInterface(hostsUrl);
|
||||
for await (const _line of rl) {
|
||||
const line = processLine(_line);
|
||||
for await (const l of await fetchRemoteTextAndCreateReadlineInterface(hostsUrl)) {
|
||||
const line = processLine(l);
|
||||
if (!line) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -10,12 +10,10 @@ const { readFileByLine } = require('./fetch-remote-text-by-line');
|
||||
async function compareAndWriteFile(linesA, filePath) {
|
||||
await fse.ensureFile(filePath);
|
||||
|
||||
const rl = readFileByLine(filePath);
|
||||
|
||||
let isEqual = true;
|
||||
let index = 0;
|
||||
|
||||
for await (const lineB of rl) {
|
||||
for await (const lineB of readFileByLine(filePath)) {
|
||||
const lineA = linesA[index];
|
||||
index++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user