types.d.ts 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. declare module "@npmcli/arborist" {
  2. export interface ArboristOptions {
  3. path: string
  4. binLinks?: boolean
  5. progress?: boolean
  6. savePrefix?: string
  7. ignoreScripts?: boolean
  8. [key: string]: unknown
  9. }
  10. export interface ArboristNode {
  11. name: string
  12. path: string
  13. }
  14. export interface ArboristEdge {
  15. to?: ArboristNode
  16. }
  17. export interface ArboristTree {
  18. edgesOut: Map<string, ArboristEdge>
  19. }
  20. export interface ReifyOptions {
  21. add?: string[]
  22. save?: boolean
  23. saveType?: "prod" | "dev" | "optional" | "peer"
  24. [key: string]: unknown
  25. }
  26. export class Arborist {
  27. constructor(options: ArboristOptions)
  28. loadVirtual(): Promise<ArboristTree | undefined>
  29. reify(options?: ReifyOptions): Promise<ArboristTree>
  30. }
  31. }
  32. declare var Bun:
  33. | {
  34. file(path: string): {
  35. text(): Promise<string>
  36. json(): Promise<unknown>
  37. }
  38. write(path: string, content: string | Uint8Array): Promise<void>
  39. }
  40. | undefined