index.d.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 `true`
  61. * - `includeDownstreamBrowsers`: `false` (default) or `true`
  62. * - `widelyAvailableOnDate`: date in format `YYYY-MM-DD`
  63. * - `targetYear`: year in format `YYYY`
  64. * - `supressWarnings`: `false` (default) or `true`
  65. */
  66. export declare function getCompatibleVersions(userOptions?: Options): BrowserVersion[];
  67. type AllVersionsOptions = {
  68. /**
  69. * Whether to return the output as a JavaScript `Array` (`"array"`), `Object` (`"object"`) or a CSV string (`"csv"`).
  70. * Defaults to `"array"`.
  71. */
  72. outputFormat?: string;
  73. /**
  74. * Whether to include browsers that use the same engines as a core Baseline browser.
  75. * Defaults to `false`.
  76. */
  77. includeDownstreamBrowsers?: boolean;
  78. /**
  79. * Whether to use the new "supports" property in place of "wa_compatible"
  80. * Defaults to `false`
  81. */
  82. useSupports?: boolean;
  83. /**
  84. * Whether to include KaiOS in the output. KaiOS implements the Gecko engine used in Firefox.
  85. * However, KaiOS also has a different interaction paradigm to other browsers and requires extra
  86. * consideration beyond simple feature compatibility to provide an optimal user experience.
  87. */
  88. includeKaiOS?: boolean;
  89. /**
  90. * Pass a boolean to suppress the warning about old data.
  91. * Defaults to `false`.
  92. */
  93. suppressWarnings?: boolean;
  94. };
  95. /**
  96. * 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"`).
  97. * Takes an optional configuration `Object` with three optional properties:
  98. * - `includeDownstreamBrowsers`: `false` (default) or `true`
  99. * - `outputFormat`: `"array"` (default), `"object"` or `"csv"`
  100. * - `useSupports`: `false` (default) or `true`, replaces `wa_compatible` property with optional `supports` property which returns `widely` or `newly` available when present.
  101. * - `supressWarnings`: `false` (default) or `true`
  102. */
  103. export declare function getAllVersions(userOptions?: AllVersionsOptions): AllBrowsersBrowserVersion[] | NestedBrowserVersions | string;
  104. export {};