index.d.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. export declare function _resetHasWarned(): void;
  2. type BrowserVersion = {
  3. browser: string;
  4. version: string;
  5. release_date?: string;
  6. engine?: string;
  7. engine_version?: string;
  8. };
  9. interface AllBrowsersBrowserVersion extends BrowserVersion {
  10. year: number | string;
  11. supports?: string;
  12. wa_compatible?: boolean;
  13. }
  14. type NestedBrowserVersions = {
  15. [browser: string]: {
  16. [version: string]: AllBrowsersBrowserVersion;
  17. };
  18. };
  19. type Options = {
  20. /**
  21. * Whether to include only the minimum compatible browser versions or all compatible versions.
  22. * Defaults to `false`.
  23. */
  24. listAllCompatibleVersions?: boolean;
  25. /**
  26. * Whether to include browsers that use the same engines as a core Baseline browser.
  27. * Defaults to `false`.
  28. */
  29. includeDownstreamBrowsers?: boolean;
  30. /**
  31. * Pass a date in the format 'YYYY-MM-DD' to get versions compatible with Widely available on the specified date.
  32. * If left undefined and a `targetYear` is not passed, defaults to Widely available as of the current date.
  33. * > NOTE: cannot be used with `targetYear`.
  34. */
  35. widelyAvailableOnDate?: string | number;
  36. /**
  37. * Pass a year between 2015 and the current year to get browser versions compatible with all
  38. * Newly Available features as of the end of the year specified.
  39. * > NOTE: cannot be used with `widelyAvailableOnDate`.
  40. */
  41. targetYear?: number;
  42. /**
  43. * Pass a boolean that determines whether KaiOS is included in browser mappings. KaiOS implements
  44. * the Gecko engine used in Firefox. However, KaiOS also has a different interaction paradigm to
  45. * other browsers and requires extra consideration beyond simple feature compatibility to provide
  46. * an optimal user experience. Defaults to `false`.
  47. */
  48. includeKaiOS?: boolean;
  49. overrideLastUpdated?: number;
  50. /**
  51. * Pass a boolean to suppress the warning about stale data.
  52. * Defaults to `false`.
  53. */
  54. suppressWarnings?: boolean;
  55. };
  56. /**
  57. * Returns browser versions compatible with specified Baseline targets.
  58. * Defaults to returning the minimum versions of the core browser set that support Baseline Widely available.
  59. * Takes an optional configuration `Object` with four optional properties:
  60. * - `listAllCompatibleVersions`: `false` (default) or `false`
  61. * - `includeDownstreamBrowsers`: `false` (default) or `false`
  62. * - `widelyAvailableOnDate`: date in format `YYYY-MM-DD`
  63. * - `targetYear`: year in format `YYYY`
  64. */
  65. export declare function getCompatibleVersions(userOptions?: Options): BrowserVersion[];
  66. type AllVersionsOptions = {
  67. /**
  68. * Whether to return the output as a JavaScript `Array` (`"array"`), `Object` (`"object"`) or a CSV string (`"csv"`).
  69. * Defaults to `"array"`.
  70. */
  71. outputFormat?: string;
  72. /**
  73. * Whether to include browsers that use the same engines as a core Baseline browser.
  74. * Defaults to `false`.
  75. */
  76. includeDownstreamBrowsers?: boolean;
  77. /**
  78. * Whether to use the new "supports" property in place of "wa_compatible"
  79. * Defaults to `false`
  80. */
  81. useSupports?: boolean;
  82. /**
  83. * Whether to include KaiOS in the output. KaiOS implements the Gecko engine used in Firefox.
  84. * However, KaiOS also has a different interaction paradigm to other browsers and requires extra
  85. * consideration beyond simple feature compatibility to provide an optimal user experience.
  86. */
  87. includeKaiOS?: boolean;
  88. /**
  89. * Pass a boolean to suppress the warning about old data.
  90. * Defaults to `false`.
  91. */
  92. suppressWarnings?: boolean;
  93. };
  94. /**
  95. * Returns all browser versions known to this module with their level of Baseline support as a JavaScript `Array` (`"array"`), `Object` (`"object"`) or a CSV string (`"csv"`).
  96. * Takes an optional configuration `Object` with three optional properties:
  97. * - `includeDownstreamBrowsers`: `true` (default) or `false`
  98. * - `outputFormat`: `"array"` (default), `"object"` or `"csv"`
  99. * - `useSupports`: `false` (default) or `true`, replaces `wa_compatible` property with optional `supports` property which returns `widely` or `newly` available when present.
  100. */
  101. export declare function getAllVersions(userOptions?: AllVersionsOptions): AllBrowsersBrowserVersion[] | NestedBrowserVersions | string;
  102. export {};