版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

61 line
4.5 KiB

  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 UnimportContext, g as InstallGlobalOptions } from './types-2cb9c8f5.js';
  2. export { p as Addon, A as AddonsOptions, k as ImportCommon, j as ImportName, n as InjectionUsageRecord, i as ModuleId, m as PackagePreset, o as PathFromResolver, l as PresetImport, h as builtinPresets } from './types-2cb9c8f5.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 toTypeReExports(imports: Import[], options?: TypeDeclarationOptions): string;
  22. declare function getString(code: string | MagicString): string;
  23. declare function getMagicString(code: string | MagicString): MagicString;
  24. declare function addImportToCode(code: string | MagicString, imports: Import[], isCJS?: boolean, mergeExisting?: boolean, injectAtLast?: boolean, firstOccurrence?: number): MagicStringResult;
  25. declare function normalizeImports(imports: Import[]): Import[];
  26. declare function resolveIdAbsolute(id: string, parentId?: string): Promise<any>;
  27. declare function scanFilesFromDir(dir: string | string[], options?: ScanDirExportsOptions): Promise<string[]>;
  28. declare function scanDirExports(dir: string | string[], options?: ScanDirExportsOptions): Promise<Import[]>;
  29. declare function scanExports(filepath: string, seen?: Set<string>): Promise<Import[]>;
  30. type Unimport = ReturnType<typeof createUnimport>;
  31. declare function createUnimport(opts: Partial<UnimportOptions>): {
  32. init: () => Promise<void>;
  33. clearDynamicImports: () => void;
  34. modifyDynamicImports: (fn: (imports: Import[]) => Thenable<void | Import[]>) => Promise<void>;
  35. scanImportsFromDir: (dirs?: string[], options?: ScanDirExportsOptions | undefined) => Promise<Import[]>;
  36. scanImportsFromFile: (filepath: string) => Promise<Import[]>;
  37. getImports: () => Promise<Import[]>;
  38. getImportMap: () => Promise<Map<string, Import>>;
  39. detectImports: (code: string | MagicString) => Promise<{
  40. s: MagicString;
  41. strippedCode: string;
  42. isCJSContext: boolean;
  43. matchedImports: Import[];
  44. firstOccurrence: number;
  45. }>;
  46. injectImports: (code: string | MagicString, id?: string, options?: InjectImportsOptions) => Promise<ImportInjectionResult>;
  47. toExports: (filepath?: string) => Promise<string>;
  48. parseVirtualImports: (code: string) => mlly.ParsedStaticImport[];
  49. generateTypeDeclarations: (options?: TypeDeclarationOptions) => Promise<string>;
  50. getMetadata: () => UnimportMeta | undefined;
  51. getInternalContext: () => UnimportContext;
  52. };
  53. declare function installGlobalAutoImports(imports: Import[] | Unimport, options?: InstallGlobalOptions): Promise<any>;
  54. export { BuiltinPresetName, Import, ImportInjectionResult, InjectImportsOptions, InlinePreset, InstallGlobalOptions, MagicStringResult, Preset, ScanDirExportsOptions, Thenable, TypeDeclarationOptions, Unimport, UnimportContext, UnimportMeta, UnimportOptions, addImportToCode, createUnimport, dedupeImports, defineUnimportPreset, excludeRE, getMagicString, getString, importAsRE, installGlobalAutoImports, matchRE, normalizeImports, resolveBuiltinPresets, resolveIdAbsolute, resolvePreset, scanDirExports, scanExports, scanFilesFromDir, separatorRE, stripCommentsAndStrings, toExports, toImports, toTypeDeclarationFile, toTypeDeclarationItems, toTypeReExports };