refactor: 移除不必要的 export 关键字

中优先级任务:将仅内部使用的函数和类型移除 export 关键字

移除 export 的函数:
- uiPopover: showPopover
- storageCleaner: injectClearLocalStorage, injectClearSessionStorage,
  injectClearIndexedDB, injectClearCacheStorage, injectUnregisterServiceWorkers

移除 export 的类型和常量:
- base64Converter: SUPPORTED_IMAGE_TYPES, SUPPORTED_IMAGE_EXTENSIONS,
  TextToBase64Result, Base64ToBlobResult
- contextMenu: ContextMenuItemConfig, ContextMenuClickedInfo, ParseResult
- jsonFormatter: JsonMinifyResult
- jsonToToml: JsonToTomlResult
- jsonToYaml: JsonToYamlResult
- jwt: JwtHeader, JwtPayload
- qrCodeParser: QrCodeParseResult

所有 473 个测试通过,类型检查通过
This commit is contained in:
雨霖铃
2026-06-06 00:55:05 +08:00
parent 9990d86270
commit 7f22b95aa2
9 changed files with 19 additions and 19 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ function positionPopover(popover: HTMLElement, x: number, y: number): void {
let hideTimeout: ReturnType<typeof setTimeout> | null = null; let hideTimeout: ReturnType<typeof setTimeout> | null = null;
export function showPopover( function showPopover(
x: number, x: number,
y: number, y: number,
contentHtml: string, contentHtml: string,
+4 -4
View File
@@ -8,7 +8,7 @@ import { formatBytes } from './format';
export const MAX_FILE_SIZE = 10 * 1024 * 1024; export const MAX_FILE_SIZE = 10 * 1024 * 1024;
/** 支持的图像 MIME 类型 */ /** 支持的图像 MIME 类型 */
export const SUPPORTED_IMAGE_TYPES = [ const SUPPORTED_IMAGE_TYPES = [
'image/png', 'image/png',
'image/jpeg', 'image/jpeg',
'image/jpg', 'image/jpg',
@@ -20,7 +20,7 @@ export const SUPPORTED_IMAGE_TYPES = [
] as const; ] as const;
/** 支持的图像文件扩展名 */ /** 支持的图像文件扩展名 */
export const SUPPORTED_IMAGE_EXTENSIONS = [ const SUPPORTED_IMAGE_EXTENSIONS = [
'.png', '.png',
'.jpg', '.jpg',
'.jpeg', '.jpeg',
@@ -34,7 +34,7 @@ export const SUPPORTED_IMAGE_EXTENSIONS = [
/** /**
* 文本转 Base64 编码结果 * 文本转 Base64 编码结果
*/ */
export interface TextToBase64Result { interface TextToBase64Result {
/** Base64 编码结果 */ /** Base64 编码结果 */
output: string; output: string;
/** 原始字节数 */ /** 原始字节数 */
@@ -226,7 +226,7 @@ export function formatFileSize(bytes: number): string {
/** /**
* Base64 解码为二进制后的产物 * Base64 解码为二进制后的产物
*/ */
export interface Base64ToBlobResult { interface Base64ToBlobResult {
/** 解码后的 Blob */ /** 解码后的 Blob */
blob: Blob; blob: Blob;
/** 推断出的 MIME 类型 */ /** 推断出的 MIME 类型 */
+3 -3
View File
@@ -1,18 +1,18 @@
import type { PageType } from '@/types/storage'; import type { PageType } from '@/types/storage';
export interface ContextMenuItemConfig { interface ContextMenuItemConfig {
id: string; id: string;
title: string; title: string;
contexts: [`${chrome.contextMenus.ContextType}`, ...`${chrome.contextMenus.ContextType}`[]]; contexts: [`${chrome.contextMenus.ContextType}`, ...`${chrome.contextMenus.ContextType}`[]];
parentId?: string; parentId?: string;
} }
export interface ContextMenuClickedInfo { interface ContextMenuClickedInfo {
featureKey: PageType; featureKey: PageType;
payload: string; payload: string;
} }
export interface ParseResult { interface ParseResult {
success: boolean; success: boolean;
data?: ContextMenuClickedInfo; data?: ContextMenuClickedInfo;
error?: string; error?: string;
+1 -1
View File
@@ -71,7 +71,7 @@ export function formatJson(text: string, options: JsonFormatOptions): JsonFormat
/** /**
* JSON 压缩结果 * JSON 压缩结果
*/ */
export interface JsonMinifyResult { interface JsonMinifyResult {
/** 压缩后的 JSON 字符串 */ /** 压缩后的 JSON 字符串 */
minified: string; minified: string;
/** 原始输入的字节大小 */ /** 原始输入的字节大小 */
+1 -1
View File
@@ -1,7 +1,7 @@
/** /**
* JSON 转 TOML 转换结果 * JSON 转 TOML 转换结果
*/ */
export interface JsonToTomlResult { interface JsonToTomlResult {
/** 转换后的 TOML 字符串 */ /** 转换后的 TOML 字符串 */
output: string; output: string;
/** 原始输入的字节大小 */ /** 原始输入的字节大小 */
+1 -1
View File
@@ -1,7 +1,7 @@
/** /**
* JSON 转 YAML 转换结果 * JSON 转 YAML 转换结果
*/ */
export interface JsonToYamlResult { interface JsonToYamlResult {
/** 转换后的 YAML 字符串 */ /** 转换后的 YAML 字符串 */
output: string; output: string;
/** 原始输入的字节大小 */ /** 原始输入的字节大小 */
+2 -2
View File
@@ -4,13 +4,13 @@
import { getMessage } from '@/utils/chromeI18n'; import { getMessage } from '@/utils/chromeI18n';
export interface JwtHeader { interface JwtHeader {
alg: string; alg: string;
typ?: string; typ?: string;
[key: string]: unknown; [key: string]: unknown;
} }
export interface JwtPayload { interface JwtPayload {
iss?: string; iss?: string;
sub?: string; sub?: string;
aud?: string | string[]; aud?: string | string[];
+1 -1
View File
@@ -1,6 +1,6 @@
import QrScanner from 'qr-scanner'; import QrScanner from 'qr-scanner';
export interface QrCodeParseResult { interface QrCodeParseResult {
success: boolean; success: boolean;
data?: string; data?: string;
error?: string; error?: string;
+5 -5
View File
@@ -224,7 +224,7 @@ async function runCleanScript(
return { success: false, error: 'No result returned' }; return { success: false, error: 'No result returned' };
} }
export async function injectClearLocalStorage(tabId: number): Promise<StorageCleanResult> { async function injectClearLocalStorage(tabId: number): Promise<StorageCleanResult> {
return runCleanScript( return runCleanScript(
tabId, tabId,
() => { () => {
@@ -236,7 +236,7 @@ export async function injectClearLocalStorage(tabId: number): Promise<StorageCle
); );
} }
export async function injectClearSessionStorage(tabId: number): Promise<StorageCleanResult> { async function injectClearSessionStorage(tabId: number): Promise<StorageCleanResult> {
return runCleanScript( return runCleanScript(
tabId, tabId,
() => { () => {
@@ -248,7 +248,7 @@ export async function injectClearSessionStorage(tabId: number): Promise<StorageC
); );
} }
export async function injectClearIndexedDB(tabId: number): Promise<StorageCleanResult> { async function injectClearIndexedDB(tabId: number): Promise<StorageCleanResult> {
return runCleanScript( return runCleanScript(
tabId, tabId,
async () => { async () => {
@@ -292,7 +292,7 @@ export async function injectClearIndexedDB(tabId: number): Promise<StorageCleanR
); );
} }
export async function injectClearCacheStorage(tabId: number): Promise<StorageCleanResult> { async function injectClearCacheStorage(tabId: number): Promise<StorageCleanResult> {
return runCleanScript( return runCleanScript(
tabId, tabId,
async () => { async () => {
@@ -309,7 +309,7 @@ export async function injectClearCacheStorage(tabId: number): Promise<StorageCle
); );
} }
export async function injectUnregisterServiceWorkers(tabId: number): Promise<StorageCleanResult> { async function injectUnregisterServiceWorkers(tabId: number): Promise<StorageCleanResult> {
return runCleanScript( return runCleanScript(
tabId, tabId,
async () => { async () => {