manifest.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { APP_PLATFORM } from './utils';
  2. interface ManifestFile {
  3. md5: string;
  4. }
  5. declare const VERSION = "1";
  6. export interface Manifest {
  7. version: typeof VERSION;
  8. env: Record<string, unknown>;
  9. files: {
  10. [file: string]: ManifestFile;
  11. };
  12. }
  13. /**
  14. * 计算文件 md5(有缓存)
  15. * @param file
  16. * @returns
  17. */
  18. export declare function hash(file: string): Promise<string>;
  19. interface GenManifestJsonOptions {
  20. pluginDir: string;
  21. env: Record<string, unknown>;
  22. files?: string[];
  23. is_uni_modules: boolean;
  24. }
  25. export interface GenManifestFileOptions {
  26. cacheDir: string;
  27. pluginRelativeDir: string;
  28. is_uni_modules: boolean;
  29. env: Record<string, unknown>;
  30. pluginDir: string;
  31. files?: string[];
  32. }
  33. export declare function genManifestFile(platform: APP_PLATFORM, { files, pluginDir, env, cacheDir, pluginRelativeDir, is_uni_modules, }: GenManifestFileOptions): Promise<boolean>;
  34. export declare function genManifestJson(platform: APP_PLATFORM, { pluginDir, files, env, is_uni_modules }: GenManifestJsonOptions): Promise<Manifest>;
  35. export declare function resolvePluginFiles(platform: APP_PLATFORM, pluginDir: string, is_uni_modules: boolean): Promise<string[]>;
  36. export declare function checkManifest(manifest: Manifest, { env, files, pluginDir, }: {
  37. pluginDir: string;
  38. files: string[];
  39. env: Record<string, unknown>;
  40. }): Promise<string | boolean>;
  41. export declare function hasCustomResources(files: string[], resources: string[]): true | undefined;
  42. export declare function isCustomResources(file: string, resources: string[]): boolean;
  43. export declare function resolveManifestJson(platform: APP_PLATFORM, pluginRelativeDir: string, cacheDir: string): Manifest | undefined;
  44. export {};