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,
|
BlockingResponse,
|
||||||
OnBeforeRequestDetailsType,
|
OnBeforeRequestDetailsType,
|
||||||
OnBeforeSendHeadersDetailsType,
|
OnBeforeSendHeadersDetailsType,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import BaseProvider from "./baseProvider.js";
|
import BaseProvider from "./baseProvider.js";
|
||||||
import {
|
import type {
|
||||||
BlockingResponse,
|
BlockingResponse,
|
||||||
OnBeforeRequestDetailsType,
|
OnBeforeRequestDetailsType,
|
||||||
OnHeadersReceivedDetailsType,
|
OnHeadersReceivedDetailsType,
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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";
|
||||||
|
|
||||||
|
|
26
src/types.ts
26
src/types.ts
|
@ -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,
|
||||||
|
|
|
@ -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";
|
||||||
|
|
Reference in New Issue