easycom.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. interface EasycomOption {
  2. isX?: boolean;
  3. dirs?: string[];
  4. rootDir: string;
  5. extensions: string[];
  6. autoscan?: boolean;
  7. custom?: EasycomCustom;
  8. }
  9. export interface EasycomMatcher {
  10. name: string;
  11. pattern: RegExp;
  12. replacement: string;
  13. }
  14. interface EasycomCustom {
  15. [key: string]: string;
  16. }
  17. export declare function initEasycoms(inputDir: string, { dirs, platform, isX, }: {
  18. dirs: string[];
  19. platform: UniApp.PLATFORM;
  20. isX?: boolean;
  21. }): {
  22. options: EasycomOption;
  23. filter: (id: unknown) => boolean;
  24. refresh(): void;
  25. easycoms: EasycomMatcher[];
  26. };
  27. export declare const initEasycomsOnce: typeof initEasycoms;
  28. export declare function matchEasycom(tag: string): string | false | undefined;
  29. export declare function addImportDeclaration(importDeclarations: string[], local: string, source: string, imported?: string): string;
  30. export declare function genResolveEasycomCode(importDeclarations: string[], code: string, name: string): string;
  31. export declare const UNI_EASYCOM_EXCLUDE: RegExp[];
  32. export declare function getUTSEasyComAutoImports(): Record<string, [[string, string]]>;
  33. export declare function addUTSEasyComAutoImports(source: string, imports: [string, string]): void;
  34. export declare function genUTSComponentPublicInstanceIdent(tagName: string): string;
  35. export declare function genUTSComponentPublicInstanceImported(root: string, fileName: string): string;
  36. export {};