d91c2c985051b29b1d5a947c462df23f8897213b87c71d58064e9489794687b14e8076b1b63e01fe8b7a4931fb9988100600ec6e8a287d632b24494e790353 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { P as Preset, I as Import, B as BuiltinPresetName, a as InlinePreset, T as TypeDeclarationOptions, M as MagicStringResult, S as ScanDirExportsOptions, U as UnimportOptions, b as Thenable, c as InjectImportsOptions, d as ImportInjectionResult, e as UnimportMeta, f as InstallGlobalOptions } from './types-31beb514.js';
  2. export { p as Addon, A as AddonsOptions, j as ImportCommon, i as ImportName, n as InjectionUsageRecord, h as ModuleId, l as PackagePreset, o as PathFromResolver, k as PresetImport, m as UnimportContext, g as builtinPresets } from './types-31beb514.js';
  3. import MagicString from 'magic-string';
  4. import * as mlly from 'mlly';
  5. declare function resolvePreset(preset: Preset): Promise<Import[]>;
  6. declare function resolveBuiltinPresets(presets: (BuiltinPresetName | Preset)[]): Promise<Import[]>;
  7. declare const excludeRE: RegExp[];
  8. declare const importAsRE: RegExp;
  9. declare const separatorRE: RegExp;
  10. /** | |
  11. * destructing case&ternary non-call | id |
  12. * ↓ ↓ ↓ | |*/
  13. declare const matchRE: RegExp;
  14. declare function stripCommentsAndStrings(code: string): string;
  15. declare function defineUnimportPreset(preset: InlinePreset): InlinePreset;
  16. declare function toImports(imports: Import[], isCJS?: boolean): string;
  17. declare function dedupeImports(imports: Import[], warn: (msg: string) => void): Import[];
  18. declare function toExports(imports: Import[], fileDir?: string): string;
  19. declare function toTypeDeclarationItems(imports: Import[], options?: TypeDeclarationOptions): string[];
  20. declare function toTypeDeclarationFile(imports: Import[], options?: TypeDeclarationOptions): string;
  21. declare function getString(code: string | MagicString): string;
  22. declare function getMagicString(code: string | MagicString): MagicString;
  23. declare function addImportToCode(code: string | MagicString, imports: Import[], isCJS?: boolean, mergeExisting?: boolean): MagicStringResult;
  24. declare function normalizeImports(imports: Import[]): Import[];
  25. declare function resolveIdAbsolute(id: string, parentId?: string): Promise<any>;
  26. declare function scanDirExports(dir: string | string[], options?: ScanDirExportsOptions): Promise<Import[]>;
  27. declare function scanExports(filepath: string): Promise<Import[]>;
  28. type Unimport = ReturnType<typeof createUnimport>;
  29. declare function createUnimport(opts: Partial<UnimportOptions>): {
  30. clearDynamicImports: () => void;
  31. modifyDynamicImports: (fn: (imports: Import[]) => Thenable<void | Import[]>) => Promise<void>;
  32. getImports: () => Promise<Import[]>;
  33. detectImports: (code: string | MagicString) => Promise<{
  34. s: MagicString;
  35. strippedCode: string;
  36. isCJSContext: boolean;
  37. matchedImports: Import[];
  38. }>;
  39. injectImports: (code: string | MagicString, id?: string, options?: InjectImportsOptions) => Promise<ImportInjectionResult>;
  40. toExports: (filepath?: string) => Promise<string>;
  41. parseVirtualImports: (code: string) => mlly.ParsedStaticImport[];
  42. generateTypeDeclarations: (options?: TypeDeclarationOptions) => Promise<string>;
  43. getMetadata: () => UnimportMeta | undefined;
  44. };
  45. declare function installGlobalAutoImports(imports: Import[] | Unimport, options?: InstallGlobalOptions): Promise<any>;
  46. export { BuiltinPresetName, Import, ImportInjectionResult, InjectImportsOptions, InlinePreset, InstallGlobalOptions, MagicStringResult, Preset, ScanDirExportsOptions, Thenable, TypeDeclarationOptions, Unimport, UnimportMeta, UnimportOptions, addImportToCode, createUnimport, dedupeImports, defineUnimportPreset, excludeRE, getMagicString, getString, importAsRE, installGlobalAutoImports, matchRE, normalizeImports, resolveBuiltinPresets, resolveIdAbsolute, resolvePreset, scanDirExports, scanExports, separatorRE, stripCommentsAndStrings, toExports, toImports, toTypeDeclarationFile, toTypeDeclarationItems };