mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 09:10:35 +08:00
Chore: Housekeeping
This commit is contained in:
parent
f04dd0e783
commit
71630a5391
@ -14,15 +14,11 @@ import { task } from './trace';
|
|||||||
// tldts-experimental is way faster than tldts, but very little bit inaccurate
|
// tldts-experimental is way faster than tldts, but very little bit inaccurate
|
||||||
// (since it is hashes based). But the result is still deterministic, which is
|
// (since it is hashes based). But the result is still deterministic, which is
|
||||||
// enough when creating a simple stat of reject hosts.
|
// enough when creating a simple stat of reject hosts.
|
||||||
import * as tldts from 'tldts-experimental';
|
|
||||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||||
import { getPhishingDomains } from './lib/get-phishing-domains';
|
import { getPhishingDomains } from './lib/get-phishing-domains';
|
||||||
|
|
||||||
import { subtract as SetSubstract } from 'mnemonist/set';
|
|
||||||
import { setAddFromArray, setAddFromArrayCurried } from './lib/set-add-from-array';
|
import { setAddFromArray, setAddFromArrayCurried } from './lib/set-add-from-array';
|
||||||
import { sort } from './lib/timsort';
|
import { sort } from './lib/timsort';
|
||||||
import { looseTldtsOpt } from './constants/loose-tldts-opt';
|
|
||||||
import { build } from 'bun';
|
|
||||||
|
|
||||||
const getRejectSukkaConfPromise = readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/domainset/reject_sukka.conf'));
|
const getRejectSukkaConfPromise = readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/domainset/reject_sukka.conf'));
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import { processLine } from './lib/process-line';
|
|||||||
import { TTL, deserializeArray, fsFetchCache, serializeArray } from './lib/cache-filesystem';
|
import { TTL, deserializeArray, fsFetchCache, serializeArray } from './lib/cache-filesystem';
|
||||||
import { createMemoizedPromise } from './lib/memo-promise';
|
import { createMemoizedPromise } from './lib/memo-promise';
|
||||||
|
|
||||||
import * as SetHelpers from 'mnemonist/set';
|
import { setAddFromArrayCurried } from './lib/set-add-from-array';
|
||||||
|
|
||||||
const s = new Sema(2);
|
const s = new Sema(2);
|
||||||
|
|
||||||
@ -83,11 +83,11 @@ const querySpeedtestApi = async (keyword: string): Promise<Array<string | null>>
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getPreviousSpeedtestDomainsPromise = createMemoizedPromise(async () => {
|
const getPreviousSpeedtestDomainsPromise = createMemoizedPromise(async () => {
|
||||||
const domains = new Set<string>();
|
const domains: string[] = [];
|
||||||
for await (const l of await fetchRemoteTextByLine('https://ruleset.skk.moe/List/domainset/speedtest.conf')) {
|
for await (const l of await fetchRemoteTextByLine('https://ruleset.skk.moe/List/domainset/speedtest.conf')) {
|
||||||
const line = processLine(l);
|
const line = processLine(l);
|
||||||
if (line) {
|
if (line) {
|
||||||
domains.add(line);
|
domains.push(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return domains;
|
return domains;
|
||||||
@ -182,9 +182,11 @@ export const buildSpeedtestDomainSet = task(import.meta.path, async (span) => {
|
|||||||
'mensura.cdn-apple.com' // From netQuality command
|
'mensura.cdn-apple.com' // From netQuality command
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await span.traceChildAsync('fetch previous speedtest domainset', async () => {
|
await span.traceChildAsync(
|
||||||
SetHelpers.add(domains, await getPreviousSpeedtestDomainsPromise());
|
'fetch previous speedtest domainset',
|
||||||
});
|
() => getPreviousSpeedtestDomainsPromise()
|
||||||
|
.then(setAddFromArrayCurried(domains))
|
||||||
|
);
|
||||||
|
|
||||||
await new Promise<void>((resolve) => {
|
await new Promise<void>((resolve) => {
|
||||||
const pMap = ([
|
const pMap = ([
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import type { PublicSuffixList } from '@gorhill/publicsuffixlist';
|
|||||||
import picocolors from 'picocolors';
|
import picocolors from 'picocolors';
|
||||||
import { normalizeDomain } from './normalize-domain';
|
import { normalizeDomain } from './normalize-domain';
|
||||||
import { fetchAssets } from './fetch-assets';
|
import { fetchAssets } from './fetch-assets';
|
||||||
import { deserializeArray, deserializeSet, fsFetchCache, serializeArray, serializeSet } from './cache-filesystem';
|
import { deserializeArray, fsFetchCache, serializeArray } from './cache-filesystem';
|
||||||
import type { Span } from '../trace';
|
import type { Span } from '../trace';
|
||||||
import createKeywordFilter from './aho-corasick';
|
import createKeywordFilter from './aho-corasick';
|
||||||
|
|
||||||
|
|||||||
16
package.json
16
package.json
@ -21,25 +21,25 @@
|
|||||||
"async-retry": "^1.3.3",
|
"async-retry": "^1.3.3",
|
||||||
"async-sema": "^3.1.1",
|
"async-sema": "^3.1.1",
|
||||||
"ci-info": "^4.0.0",
|
"ci-info": "^4.0.0",
|
||||||
"csv-parse": "^5.5.5",
|
"csv-parse": "^5.5.6",
|
||||||
"fast-cidr-tools": "^0.2.5",
|
"fast-cidr-tools": "^0.2.5",
|
||||||
"mnemonist": "^0.39.8",
|
"mnemonist": "^0.39.8",
|
||||||
"path-scurry": "^1.10.2",
|
"path-scurry": "^1.11.1",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.1",
|
||||||
"punycode": "^2.3.1",
|
"punycode": "^2.3.1",
|
||||||
"table": "^6.8.2",
|
"table": "^6.8.2",
|
||||||
"tar-stream": "^3.1.7",
|
"tar-stream": "^3.1.7",
|
||||||
"tldts": "^6.1.19",
|
"tldts": "^6.1.22",
|
||||||
"tldts-experimental": "^6.1.21"
|
"tldts-experimental": "^6.1.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint-sukka/node": "6.0.0-beta.3",
|
"@eslint-sukka/node": "6.0.0-beta.3",
|
||||||
"@eslint-sukka/ts": "6.0.0-beta.3",
|
"@eslint-sukka/ts": "6.0.0-beta.3",
|
||||||
"@types/async-retry": "^1.4.8",
|
"@types/async-retry": "^1.4.8",
|
||||||
"@types/bun": "^1.1.1",
|
"@types/bun": "^1.1.3",
|
||||||
"@types/tar-stream": "^3.1.3",
|
"@types/tar-stream": "^3.1.3",
|
||||||
"bun-types": "^1.1.7",
|
"bun-types": "^1.1.10",
|
||||||
"eslint": "^9.2.0",
|
"eslint": "^9.3.0",
|
||||||
"eslint-config-sukka": "6.0.0-beta.3",
|
"eslint-config-sukka": "6.0.0-beta.3",
|
||||||
"eslint-formatter-sukka": "6.0.0-beta.3",
|
"eslint-formatter-sukka": "6.0.0-beta.3",
|
||||||
"mitata": "^0.1.11",
|
"mitata": "^0.1.11",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user