import MagicString from 'magic-string'; import { ESMExport } from 'mlly'; declare const builtinPresets: { '@vue/composition-api': InlinePreset; '@vueuse/core': () => Preset; '@vueuse/head': InlinePreset; pinia: InlinePreset; preact: InlinePreset; quasar: InlinePreset; react: InlinePreset; 'react-router': InlinePreset; 'react-router-dom': InlinePreset; svelte: InlinePreset; 'svelte/animate': InlinePreset; 'svelte/easing': InlinePreset; 'svelte/motion': InlinePreset; 'svelte/store': InlinePreset; 'svelte/transition': InlinePreset; 'vee-validate': InlinePreset; vitepress: InlinePreset; 'vue-demi': InlinePreset; 'vue-i18n': InlinePreset; 'vue-router': InlinePreset; 'vue-router-composables': InlinePreset; vue: InlinePreset; 'vue/macros': InlinePreset; vuex: InlinePreset; vitest: InlinePreset; 'uni-app': InlinePreset; 'solid-js': InlinePreset; 'solid-app-router': InlinePreset; rxjs: InlinePreset; 'date-fns': InlinePreset; }; type BuiltinPresetName = keyof typeof builtinPresets; type ModuleId = string; type ImportName = string; interface ImportCommon { /** Module specifier to import from */ from: ModuleId; /** * Priority of the import, if multiple imports have the same name, the one with the highest priority will be used * @default 1 */ priority?: number; /** If this import is disabled */ disabled?: boolean; /** Won't output import in declaration file if true */ dtsDisabled?: boolean; /** Import declaration type like const / var / enum */ declarationType?: ESMExport['declarationType']; /** * Metadata of the import */ meta?: { /** Short description of the import */ description?: string; /** URL to the documentation */ docsUrl?: string; /** Additional metadata */ [key: string]: any; }; /** * If this import is a pure type import */ type?: boolean; /** * Using this as the from when generating type declarations */ typeFrom?: ModuleId; } interface Import extends ImportCommon { /** Import name to be detected */ name: ImportName; /** Import as this name */ as?: ImportName; /** * With properties * * Ignored for CJS imports. */ with?: Record; } type PresetImport = Omit | ImportName | [name: ImportName, as?: ImportName, from?: ModuleId]; interface InlinePreset extends ImportCommon { imports: (PresetImport | InlinePreset)[]; } /** * Auto extract exports from a package for auto import */ interface PackagePreset { /** * Name of the package */ package: string; /** * Path of the importer * @default process.cwd() */ url?: string; /** * RegExp, string, or custom function to exclude names of the extracted imports */ ignore?: (string | RegExp | ((name: string) => boolean))[]; /** * Use local cache if exits * @default true */ cache?: boolean; } type Preset = InlinePreset | PackagePreset; interface UnimportContext { readonly version: string; options: Partial; staticImports: Import[]; dynamicImports: Import[]; addons: Addon[]; getImports: () => Promise; getImportMap: () => Promise>; getMetadata: () => UnimportMeta | undefined; modifyDynamicImports: (fn: (imports: Import[]) => Thenable) => Promise; clearDynamicImports: () => void; replaceImports: (imports: UnimportOptions['imports']) => Promise; invalidate: () => void; resolveId: (id: string, parentId?: string) => Thenable; } interface DetectImportResult { s: MagicString; strippedCode: string; isCJSContext: boolean; matchedImports: Import[]; firstOccurrence: number; } interface Unimport { readonly version: string; init: () => Promise; clearDynamicImports: UnimportContext['clearDynamicImports']; getImportMap: UnimportContext['getImportMap']; getImports: UnimportContext['getImports']; getInternalContext: () => UnimportContext; getMetadata: UnimportContext['getMetadata']; modifyDynamicImports: UnimportContext['modifyDynamicImports']; generateTypeDeclarations: (options?: TypeDeclarationOptions) => Promise; /** * Get un-imported usages from code */ detectImports: (code: string | MagicString) => Promise; /** * Insert missing imports statements to code */ injectImports: (code: string | MagicString, id?: string, options?: InjectImportsOptions) => Promise; scanImportsFromDir: (dir?: string[], options?: ScanDirExportsOptions) => Promise; scanImportsFromFile: (file: string, includeTypes?: boolean) => Promise; /** * @deprecated */ toExports: (filepath?: string, includeTypes?: boolean) => Promise; } interface InjectionUsageRecord { import: Import; count: number; moduleIds: string[]; } interface UnimportMeta { injectionUsage: Record; } interface AddonsOptions { addons?: Addon[]; /** * Enable auto import inside for Vue's