52 lines
3.8 KiB
TypeScript
52 lines
3.8 KiB
TypeScript
import { P as Preset, I as Import, B as BuiltinPresetName, a as InlinePreset, T as TypeDeclarationOptions, b as ImportInjectionResult, S as ScanDirExportsOptions, U as UnimportOptions, c as Thenable, d as InjectImportsOptions, e as InstallGlobalOptions } from './types-0d3b142b.js';
|
|
export { m as Addon, A as AddonsOptions, B as BuiltinPresetName, I as Import, h as ImportCommon, b as ImportInjectionResult, g as ImportName, d as InjectImportsOptions, a as InlinePreset, e as InstallGlobalOptions, M as ModuleId, j as PackagePreset, l as PathFromResolver, P as Preset, i as PresetImport, S as ScanDirExportsOptions, c as Thenable, T as TypeDeclarationOptions, k as UnimportContext, U as UnimportOptions, f as builtinPresets } from './types-0d3b142b.js';
|
|
import MagicString from 'magic-string';
|
|
import * as mlly from 'mlly';
|
|
|
|
declare function resolvePreset(preset: Preset): Promise<Import[]>;
|
|
declare function resolveBuiltinPresets(presets: (BuiltinPresetName | Preset)[]): Promise<Import[]>;
|
|
|
|
declare const excludeRE: RegExp[];
|
|
declare const importAsRE: RegExp;
|
|
declare const separatorRE: RegExp;
|
|
/** | |
|
|
* destructing case&ternary non-call | id |
|
|
* ↓ ↓ ↓ | |*/
|
|
declare const matchRE: RegExp;
|
|
declare function stripCommentsAndStrings(code: string): string;
|
|
declare function defineUnimportPreset(preset: InlinePreset): InlinePreset;
|
|
declare function toImports(imports: Import[], isCJS?: boolean): string;
|
|
declare function dedupeImports(imports: Import[], warn: (msg: string) => void): Import[];
|
|
declare function toExports(imports: Import[], fileDir?: string): string;
|
|
declare function toTypeDeclarationItems(imports: Import[], options?: TypeDeclarationOptions): string[];
|
|
declare function toTypeDeclarationFile(imports: Import[], options?: TypeDeclarationOptions): string;
|
|
declare function getString(code: string | MagicString): string;
|
|
declare function getMagicString(code: string | MagicString): MagicString;
|
|
declare function addImportToCode(code: string | MagicString, imports: Import[], isCJS?: boolean, mergeExisting?: boolean): ImportInjectionResult;
|
|
declare function normalizeImports(imports: Import[]): Import[];
|
|
declare function resolveIdAbsolute(id: string, parentId?: string): Promise<any>;
|
|
|
|
declare function scanDirExports(dir: string | string[], options?: ScanDirExportsOptions): Promise<Import[]>;
|
|
declare function scanExports(filepath: string): Promise<Import[]>;
|
|
|
|
type Unimport = ReturnType<typeof createUnimport>;
|
|
declare function createUnimport(opts: Partial<UnimportOptions>): {
|
|
clearDynamicImports: () => void;
|
|
modifyDynamicImports: (fn: (imports: Import[]) => Thenable<void | Import[]>) => Promise<void>;
|
|
getImports: () => Promise<Import[]>;
|
|
detectImports: (code: string | MagicString) => Promise<{
|
|
s: MagicString;
|
|
strippedCode: string;
|
|
isCJSContext: boolean;
|
|
matchedImports: Import[];
|
|
}>;
|
|
injectImports: (code: string | MagicString, id?: string, options?: InjectImportsOptions) => Promise<ImportInjectionResult>;
|
|
toExports: (filepath?: string) => Promise<string>;
|
|
parseVirtualImports: (code: string) => mlly.ParsedStaticImport[];
|
|
generateTypeDeclarations: (options?: TypeDeclarationOptions) => Promise<string>;
|
|
};
|
|
|
|
declare function installGlobalAutoImports(imports: Import[] | Unimport, options?: InstallGlobalOptions): Promise<any>;
|
|
|
|
export { Unimport, addImportToCode, createUnimport, dedupeImports, defineUnimportPreset, excludeRE, getMagicString, getString, importAsRE, installGlobalAutoImports, matchRE, normalizeImports, resolveBuiltinPresets, resolveIdAbsolute, resolvePreset, scanDirExports, scanExports, separatorRE, stripCommentsAndStrings, toExports, toImports, toTypeDeclarationFile, toTypeDeclarationItems };
|