refactor: need to explicitly import types due to verbatimModuleSyntax

This commit is contained in:
Derrick Hammer 2023-07-25 12:04:30 -04:00
parent b13d129832
commit b20ef42332
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
9 changed files with 30 additions and 32 deletions

View File

@ -1,4 +1,4 @@
import { import type {
BlockingResponse, BlockingResponse,
OnBeforeRequestDetailsType, OnBeforeRequestDetailsType,
OnBeforeSendHeadersDetailsType, OnBeforeSendHeadersDetailsType,

View File

@ -1,5 +1,5 @@
import BaseProvider from "./baseProvider.js"; import BaseProvider from "./baseProvider.js";
import { import type {
BlockingResponse, BlockingResponse,
OnBeforeRequestDetailsType, OnBeforeRequestDetailsType,
OnHeadersReceivedDetailsType, OnHeadersReceivedDetailsType,

View File

@ -1,5 +1,5 @@
import BaseProvider from "./baseProvider.js"; import BaseProvider from "./baseProvider.js";
import { import type {
BlockingResponse, BlockingResponse,
OnBeforeRequestDetailsType, OnBeforeRequestDetailsType,
OnBeforeSendHeadersDetailsType, OnBeforeSendHeadersDetailsType,
@ -10,9 +10,10 @@ import {
import { getRelayProxies } from "../util.js"; import { getRelayProxies } from "../util.js";
import { ipfsPath, ipnsPath, path as checkPath } from "is-ipfs"; import { ipfsPath, ipnsPath, path as checkPath } from "is-ipfs";
import { createClient } from "@lumeweb/kernel-ipfs-client"; 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 RequestStream from "../requestStream.js";
import { UnixFSStats } from "@helia/unixfs"; import type { UnixFSStats } from "@helia/unixfs";
import * as path from "path"; import * as path from "path";
import { CID } from "multiformats/cid"; import { CID } from "multiformats/cid";
import { fileTypeFromBuffer } from "file-type"; import { fileTypeFromBuffer } from "file-type";

View File

@ -1,11 +1,15 @@
import BaseProvider from "./baseProvider.js"; 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 { 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 { export default class ServerProvider extends BaseProvider {
async shouldHandleRequest( async shouldHandleRequest(
details: OnBeforeRequestDetailsType details: OnBeforeRequestDetailsType,
): Promise<boolean> { ): Promise<boolean> {
let dnsResult: DNSResult | boolean = await this.resolveDns(details, [ let dnsResult: DNSResult | boolean = await this.resolveDns(details, [
DNS_RECORD_TYPE.A, DNS_RECORD_TYPE.A,

View File

@ -1,9 +1,6 @@
import NodeCache from "node-cache"; import NodeCache from "node-cache";
import { import { DNS_RECORD_TYPE } from "@lumeweb/libresolver";
DNS_RECORD_TYPE, import type { DNSResult, ResolverOptions } from "@lumeweb/libresolver";
DNSResult,
ResolverOptions,
} from "@lumeweb/libresolver";
import { bufToHex } from "@lumeweb/libweb"; import { bufToHex } from "@lumeweb/libweb";
import { getDnsSetupDefer } from "./vars.js"; import { getDnsSetupDefer } from "./vars.js";
import { dnsClient } from "./clients.js"; import { dnsClient } from "./clients.js";

View File

@ -1,10 +1,10 @@
import { import {
addContextToErr, addContextToErr,
downloadObject, downloadObject,
Err,
maybeInitDefaultPortals, maybeInitDefaultPortals,
setActivePortalMasterKey, setActivePortalMasterKey,
} from "@lumeweb/libweb"; } from "@lumeweb/libweb";
import type { Err } from "@lumeweb/libweb";
import { log, logErr, sendAuthUpdate } from "./util.js"; import { log, logErr, sendAuthUpdate } from "./util.js";
import { import {
defaultKernelLink, defaultKernelLink,

View File

@ -1,4 +1,4 @@
import { OnBeforeRequestDetailsType, StreamFilter } from "./types.js"; import type { OnBeforeRequestDetailsType, StreamFilter } from "./types.js";
import browser from "webextension-polyfill"; import browser from "webextension-polyfill";
import { iterateStream, streamToArray } from "./util.js"; import { iterateStream, streamToArray } from "./util.js";

View File

@ -1,23 +1,21 @@
import { import type {
WebRequest, WebRequest,
Proxy, Proxy,
Tabs, Tabs,
WebNavigation, WebNavigation,
Menus, Menus,
} from "webextension-polyfill"; } from "webextension-polyfill";
import OnHeadersReceivedDetailsType = WebRequest.OnHeadersReceivedDetailsType; type OnHeadersReceivedDetailsType = WebRequest.OnHeadersReceivedDetailsType;
import OnBeforeRequestDetailsType = WebRequest.OnBeforeRequestDetailsType; type OnBeforeRequestDetailsType = WebRequest.OnBeforeRequestDetailsType;
import OnBeforeSendHeadersDetailsType = WebRequest.OnBeforeSendHeadersDetailsType; type OnBeforeSendHeadersDetailsType = WebRequest.OnBeforeSendHeadersDetailsType;
import OnCompletedDetailsType = WebRequest.OnCompletedDetailsType; type OnCompletedDetailsType = WebRequest.OnCompletedDetailsType;
import OnErrorOccurredDetailsType = WebRequest.OnErrorOccurredDetailsType; type OnErrorOccurredDetailsType = WebRequest.OnErrorOccurredDetailsType;
import BlockingResponse = WebRequest.BlockingResponse; type BlockingResponse = WebRequest.BlockingResponse;
import OnRequestDetailsType = Proxy.OnRequestDetailsType; type OnRequestDetailsType = Proxy.OnRequestDetailsType;
import HttpHeaders = WebRequest.HttpHeaders; type StreamFilter = WebRequest.StreamFilter;
import StreamFilter = WebRequest.StreamFilter; type OnBeforeNavigateDetailsType = WebNavigation.OnBeforeNavigateDetailsType;
import HttpHeadersItemType = WebRequest.HttpHeadersItemType;
import OnBeforeNavigateDetailsType = WebNavigation.OnBeforeNavigateDetailsType;
export { export type {
OnHeadersReceivedDetailsType, OnHeadersReceivedDetailsType,
OnBeforeRequestDetailsType, OnBeforeRequestDetailsType,
OnBeforeSendHeadersDetailsType, OnBeforeSendHeadersDetailsType,
@ -25,9 +23,7 @@ export {
OnErrorOccurredDetailsType, OnErrorOccurredDetailsType,
BlockingResponse, BlockingResponse,
OnRequestDetailsType, OnRequestDetailsType,
HttpHeaders,
StreamFilter, StreamFilter,
HttpHeadersItemType,
Tabs, Tabs,
OnBeforeNavigateDetailsType, OnBeforeNavigateDetailsType,
Menus, Menus,

View File

@ -1,6 +1,6 @@
import browser from "webextension-polyfill"; import browser from "webextension-polyfill";
import BaseProvider from "./contentProviders/baseProvider.js"; import BaseProvider from "./contentProviders/baseProvider.js";
import { import type {
BlockingResponse, BlockingResponse,
OnBeforeNavigateDetailsType, OnBeforeNavigateDetailsType,
OnBeforeRequestDetailsType, OnBeforeRequestDetailsType,
@ -15,7 +15,7 @@ import tldEnum from "@lumeweb/tld-enum";
import { scanRecords } from "./dns.js"; import { scanRecords } from "./dns.js";
import { bufToHex } from "@lumeweb/libweb"; import { bufToHex } from "@lumeweb/libweb";
import { getAuthStatus } from "./vars.js"; import { getAuthStatus } from "./vars.js";
import { DNSResult } from "@lumeweb/libresolver"; import type { DNSResult } from "@lumeweb/libresolver";
import { blake3 } from "@noble/hashes/blake3"; import { blake3 } from "@noble/hashes/blake3";
import "./contentFilters/index.js"; import "./contentFilters/index.js";