refactor: need to explicitly import types due to verbatimModuleSyntax
This commit is contained in:
parent
b13d129832
commit
b20ef42332
|
@ -1,4 +1,4 @@
|
|||
import {
|
||||
import type {
|
||||
BlockingResponse,
|
||||
OnBeforeRequestDetailsType,
|
||||
OnBeforeSendHeadersDetailsType,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import BaseProvider from "./baseProvider.js";
|
||||
import {
|
||||
import type {
|
||||
BlockingResponse,
|
||||
OnBeforeRequestDetailsType,
|
||||
OnHeadersReceivedDetailsType,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import BaseProvider from "./baseProvider.js";
|
||||
import {
|
||||
import type {
|
||||
BlockingResponse,
|
||||
OnBeforeRequestDetailsType,
|
||||
OnBeforeSendHeadersDetailsType,
|
||||
|
@ -10,9 +10,10 @@ import {
|
|||
import { getRelayProxies } from "../util.js";
|
||||
import { ipfsPath, ipnsPath, path as checkPath } from "is-ipfs";
|
||||
import { createClient } from "@lumeweb/kernel-ipfs-client";
|
||||
import { DNS_RECORD_TYPE, DNSResult } from "@lumeweb/libresolver";
|
||||
import { DNS_RECORD_TYPE } from "@lumeweb/libresolver";
|
||||
import type { DNSResult } from "@lumeweb/libresolver";
|
||||
import RequestStream from "../requestStream.js";
|
||||
import { UnixFSStats } from "@helia/unixfs";
|
||||
import type { UnixFSStats } from "@helia/unixfs";
|
||||
import * as path from "path";
|
||||
import { CID } from "multiformats/cid";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
import BaseProvider from "./baseProvider.js";
|
||||
import { OnBeforeRequestDetailsType, OnRequestDetailsType } from "../types.js";
|
||||
import type {
|
||||
OnBeforeRequestDetailsType,
|
||||
OnRequestDetailsType,
|
||||
} from "../types.js";
|
||||
import { isDomain, isIp } from "../util.js";
|
||||
import { DNS_RECORD_TYPE, DNSRecord, DNSResult } from "@lumeweb/libresolver";
|
||||
import { DNS_RECORD_TYPE } from "@lumeweb/libresolver";
|
||||
import type { DNSRecord, DNSResult } from "@lumeweb/libresolver";
|
||||
|
||||
export default class ServerProvider extends BaseProvider {
|
||||
async shouldHandleRequest(
|
||||
details: OnBeforeRequestDetailsType
|
||||
details: OnBeforeRequestDetailsType,
|
||||
): Promise<boolean> {
|
||||
let dnsResult: DNSResult | boolean = await this.resolveDns(details, [
|
||||
DNS_RECORD_TYPE.A,
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import NodeCache from "node-cache";
|
||||
import {
|
||||
DNS_RECORD_TYPE,
|
||||
DNSResult,
|
||||
ResolverOptions,
|
||||
} from "@lumeweb/libresolver";
|
||||
import { DNS_RECORD_TYPE } from "@lumeweb/libresolver";
|
||||
import type { DNSResult, ResolverOptions } from "@lumeweb/libresolver";
|
||||
import { bufToHex } from "@lumeweb/libweb";
|
||||
import { getDnsSetupDefer } from "./vars.js";
|
||||
import { dnsClient } from "./clients.js";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {
|
||||
addContextToErr,
|
||||
downloadObject,
|
||||
Err,
|
||||
maybeInitDefaultPortals,
|
||||
setActivePortalMasterKey,
|
||||
} from "@lumeweb/libweb";
|
||||
import type { Err } from "@lumeweb/libweb";
|
||||
import { log, logErr, sendAuthUpdate } from "./util.js";
|
||||
import {
|
||||
defaultKernelLink,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { OnBeforeRequestDetailsType, StreamFilter } from "./types.js";
|
||||
import type { OnBeforeRequestDetailsType, StreamFilter } from "./types.js";
|
||||
import browser from "webextension-polyfill";
|
||||
import { iterateStream, streamToArray } from "./util.js";
|
||||
|
||||
|
|
26
src/types.ts
26
src/types.ts
|
@ -1,23 +1,21 @@
|
|||
import {
|
||||
import type {
|
||||
WebRequest,
|
||||
Proxy,
|
||||
Tabs,
|
||||
WebNavigation,
|
||||
Menus,
|
||||
} from "webextension-polyfill";
|
||||
import OnHeadersReceivedDetailsType = WebRequest.OnHeadersReceivedDetailsType;
|
||||
import OnBeforeRequestDetailsType = WebRequest.OnBeforeRequestDetailsType;
|
||||
import OnBeforeSendHeadersDetailsType = WebRequest.OnBeforeSendHeadersDetailsType;
|
||||
import OnCompletedDetailsType = WebRequest.OnCompletedDetailsType;
|
||||
import OnErrorOccurredDetailsType = WebRequest.OnErrorOccurredDetailsType;
|
||||
import BlockingResponse = WebRequest.BlockingResponse;
|
||||
import OnRequestDetailsType = Proxy.OnRequestDetailsType;
|
||||
import HttpHeaders = WebRequest.HttpHeaders;
|
||||
import StreamFilter = WebRequest.StreamFilter;
|
||||
import HttpHeadersItemType = WebRequest.HttpHeadersItemType;
|
||||
import OnBeforeNavigateDetailsType = WebNavigation.OnBeforeNavigateDetailsType;
|
||||
type OnHeadersReceivedDetailsType = WebRequest.OnHeadersReceivedDetailsType;
|
||||
type OnBeforeRequestDetailsType = WebRequest.OnBeforeRequestDetailsType;
|
||||
type OnBeforeSendHeadersDetailsType = WebRequest.OnBeforeSendHeadersDetailsType;
|
||||
type OnCompletedDetailsType = WebRequest.OnCompletedDetailsType;
|
||||
type OnErrorOccurredDetailsType = WebRequest.OnErrorOccurredDetailsType;
|
||||
type BlockingResponse = WebRequest.BlockingResponse;
|
||||
type OnRequestDetailsType = Proxy.OnRequestDetailsType;
|
||||
type StreamFilter = WebRequest.StreamFilter;
|
||||
type OnBeforeNavigateDetailsType = WebNavigation.OnBeforeNavigateDetailsType;
|
||||
|
||||
export {
|
||||
export type {
|
||||
OnHeadersReceivedDetailsType,
|
||||
OnBeforeRequestDetailsType,
|
||||
OnBeforeSendHeadersDetailsType,
|
||||
|
@ -25,9 +23,7 @@ export {
|
|||
OnErrorOccurredDetailsType,
|
||||
BlockingResponse,
|
||||
OnRequestDetailsType,
|
||||
HttpHeaders,
|
||||
StreamFilter,
|
||||
HttpHeadersItemType,
|
||||
Tabs,
|
||||
OnBeforeNavigateDetailsType,
|
||||
Menus,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import browser from "webextension-polyfill";
|
||||
import BaseProvider from "./contentProviders/baseProvider.js";
|
||||
import {
|
||||
import type {
|
||||
BlockingResponse,
|
||||
OnBeforeNavigateDetailsType,
|
||||
OnBeforeRequestDetailsType,
|
||||
|
@ -15,7 +15,7 @@ import tldEnum from "@lumeweb/tld-enum";
|
|||
import { scanRecords } from "./dns.js";
|
||||
import { bufToHex } from "@lumeweb/libweb";
|
||||
import { getAuthStatus } from "./vars.js";
|
||||
import { DNSResult } from "@lumeweb/libresolver";
|
||||
import type { DNSResult } from "@lumeweb/libresolver";
|
||||
import { blake3 } from "@noble/hashes/blake3";
|
||||
|
||||
import "./contentFilters/index.js";
|
||||
|
|
Reference in New Issue