index.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import { ResolvedConfig } from '../config';
  2. export interface DepOptimizationOptions {
  3. /**
  4. * Force optimize listed dependencies (supports deep paths).
  5. */
  6. include?: string[];
  7. /**
  8. * Do not optimize these dependencies.
  9. */
  10. exclude?: string[];
  11. /**
  12. * A list of linked dependencies that should be treated as source code.
  13. * Use this to list linked packages in a monorepo so that their dependencies
  14. * are also included for optimization.
  15. */
  16. link?: string[];
  17. /**
  18. * A list of depdendencies that imports Node built-ins, but do not actually
  19. * use them in browsers.
  20. */
  21. allowNodeBuiltins?: string[];
  22. /**
  23. * Automatically run `vite optimize` on server start?
  24. * @default true
  25. */
  26. auto?: boolean;
  27. }
  28. export declare const OPTIMIZE_CACHE_DIR = "node_modules/.vite_opt_cache";
  29. export declare function optimizeDeps(config: ResolvedConfig & {
  30. force?: boolean;
  31. }, asCommand?: boolean): Promise<void>;
  32. export declare function getDepHash(root: string, configPath: string | undefined): string;
  33. export declare function resolveOptimizedCacheDir(root: string, pkgPath?: string): string | null;