index.d.ts 774 B

123456789101112131415161718192021
  1. export type Options = {
  2. browser?: boolean;
  3. conditions?: string[];
  4. require?: boolean;
  5. unsafe?: false;
  6. } | {
  7. conditions?: string[];
  8. unsafe?: true;
  9. }
  10. export function resolve<T=any>(pkg: T, entry: string, options?: Options): string | void;
  11. export type BrowserFiles = Record<string, string | false>;
  12. export function legacy<T=any>(pkg: T, options: { browser: true, fields?: string[] }): BrowserFiles | string | void;
  13. export function legacy<T=any>(pkg: T, options: { browser: string, fields?: string[] }): string | false | void;
  14. export function legacy<T=any>(pkg: T, options: { browser: false, fields?: string[] }): string | void;
  15. export function legacy<T=any>(pkg: T, options?: {
  16. browser?: boolean | string;
  17. fields?: string[];
  18. }): BrowserFiles | string | false | void;