install.d.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /**
  2. * @license
  3. * Copyright 2017 Google Inc.
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. import { Browser, BrowserPlatform } from './browser-data/browser-data.js';
  7. import { InstalledBrowser } from './Cache.js';
  8. /**
  9. * @public
  10. */
  11. export interface InstallOptions {
  12. /**
  13. * Determines the path to download browsers to.
  14. */
  15. cacheDir: string;
  16. /**
  17. * Determines which platform the browser will be suited for.
  18. *
  19. * @defaultValue **Auto-detected.**
  20. */
  21. platform?: BrowserPlatform;
  22. /**
  23. * Determines which browser to install.
  24. */
  25. browser: Browser;
  26. /**
  27. * Determines which buildId to download. BuildId should uniquely identify
  28. * binaries and they are used for caching.
  29. */
  30. buildId: string;
  31. /**
  32. * An alias for the provided `buildId`. It will be used to maintain local
  33. * metadata to support aliases in the `launch` command.
  34. *
  35. * @example 'canary'
  36. */
  37. buildIdAlias?: string;
  38. /**
  39. * Provides information about the progress of the download.
  40. */
  41. downloadProgressCallback?: (downloadedBytes: number, totalBytes: number) => void;
  42. /**
  43. * Determines the host that will be used for downloading.
  44. *
  45. * @defaultValue Either
  46. *
  47. * - https://storage.googleapis.com/chrome-for-testing-public or
  48. * - https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central
  49. *
  50. */
  51. baseUrl?: string;
  52. /**
  53. * Whether to unpack and install browser archives.
  54. *
  55. * @defaultValue `true`
  56. */
  57. unpack?: boolean;
  58. /**
  59. * @internal
  60. * @defaultValue `false`
  61. */
  62. forceFallbackForTesting?: boolean;
  63. }
  64. /**
  65. * @public
  66. */
  67. export declare function install(options: InstallOptions & {
  68. unpack?: true;
  69. }): Promise<InstalledBrowser>;
  70. /**
  71. * @public
  72. */
  73. export declare function install(options: InstallOptions & {
  74. unpack: false;
  75. }): Promise<string>;
  76. /**
  77. * @public
  78. */
  79. export interface UninstallOptions {
  80. /**
  81. * Determines the platform for the browser binary.
  82. *
  83. * @defaultValue **Auto-detected.**
  84. */
  85. platform?: BrowserPlatform;
  86. /**
  87. * The path to the root of the cache directory.
  88. */
  89. cacheDir: string;
  90. /**
  91. * Determines which browser to uninstall.
  92. */
  93. browser: Browser;
  94. /**
  95. * The browser build to uninstall
  96. */
  97. buildId: string;
  98. }
  99. /**
  100. *
  101. * @public
  102. */
  103. export declare function uninstall(options: UninstallOptions): Promise<void>;
  104. /**
  105. * @public
  106. */
  107. export interface GetInstalledBrowsersOptions {
  108. /**
  109. * The path to the root of the cache directory.
  110. */
  111. cacheDir: string;
  112. }
  113. /**
  114. * Returns metadata about browsers installed in the cache directory.
  115. *
  116. * @public
  117. */
  118. export declare function getInstalledBrowsers(options: GetInstalledBrowsersOptions): Promise<InstalledBrowser[]>;
  119. /**
  120. * @public
  121. */
  122. export declare function canDownload(options: InstallOptions): Promise<boolean>;
  123. //# sourceMappingURL=install.d.ts.map