mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-03 20:41:52 +08:00
Refactor: drop a few Bun.file usage
This commit is contained in:
@@ -2,7 +2,9 @@ import { toASCII } from 'punycode';
|
||||
import { createMemoizedPromise } from './memo-promise';
|
||||
import { getPublicSuffixListTextPromise } from './download-publicsuffixlist';
|
||||
|
||||
const customFetch = (url: string | URL): Promise<Blob> => Promise.resolve(Bun.file(url));
|
||||
const customFetch = typeof Bun !== 'undefined'
|
||||
? (url: string | URL) => Promise.resolve(Bun.file(url))
|
||||
: (url: string | URL) => fetch(url).then(resp => resp.blob() as Promise<Blob>);
|
||||
|
||||
export const getGorhillPublicSuffixPromise = createMemoizedPromise(async () => {
|
||||
const [publicSuffixListDat, { default: gorhill }] = await Promise.all([
|
||||
|
||||
Reference in New Issue
Block a user