Comparing version 0.1.1 to 0.1.2
/** | ||
* Known platform names | ||
*/ | ||
declare const platforms: readonly ["aws", "azure", "cloudflare", "deno", "firebase", "netlify", "vercel"]; | ||
/** | ||
* Known platform name | ||
*/ | ||
type PlatformName = (typeof platforms)[number]; | ||
/** | ||
* Normalize the compatibility dates from input config and defaults. | ||
*/ | ||
declare function resolveCompatibilityDates(input: CompatibilityDate, defaults?: Partial<CompatibilityDates>): CompatibilityDates; | ||
/** | ||
* Resolve compatibility dates with environment variables as defaults. | ||
* | ||
* Environment variable name format is `COMPATIBILITY_DATE` for default and `COMPATIBILITY_DATE_<PLATFORM>` for specific platforms. | ||
*/ | ||
declare function resolveCompatibilityDatesFromEnv(input: CompatibilityDate): CompatibilityDates; | ||
/** | ||
* Format a date to a `YYYY-MM-DD` string | ||
@@ -10,3 +29,3 @@ * | ||
*/ | ||
declare function formatDateString(date: DateValue): DateString; | ||
declare function formatDate(date: string | Date): DateString; | ||
type Year = `${number}${number}${number}${number}`; | ||
@@ -19,9 +38,3 @@ type Month = `${"0" | "1"}${number}`; | ||
type DateString = `${Year}-${Month}-${Day}`; | ||
type DateValue = Date | DateString; | ||
/** | ||
* List of known platforms | ||
*/ | ||
type PlatformName = "aws" | "azure" | "cloudflare" | "deno" | "firebase" | "netlify" | "vercel"; | ||
/** | ||
* Last known compatibility dates for platforms | ||
@@ -35,3 +48,3 @@ * | ||
*/ | ||
type PlatformCompatibilityDates = { | ||
type CompatibilityDates = { | ||
/** | ||
@@ -45,3 +58,3 @@ * Default compatibility date for all unspecified platforms (required) | ||
*/ | ||
type PlatformCompatibilityDate = DateString | PlatformCompatibilityDates; | ||
type CompatibilityDate = DateString | CompatibilityDates; | ||
@@ -51,7 +64,7 @@ /** | ||
*/ | ||
declare function getCompatibilityUpdates(allUpdates: CompatibilityUpdates, compatibilityDate: PlatformCompatibilityDate): CompatibilityUpdates; | ||
declare function getCompatibilityUpdates(allUpdates: CompatibilityUpdates, compatibilityDate: CompatibilityDate): CompatibilityUpdates; | ||
/** | ||
* Get compatibility changes between two dates. | ||
*/ | ||
declare function getCompatibilityChanges(allUpdates: CompatibilityUpdates, compatibilityDate1: PlatformCompatibilityDate, compatibilityDate2: PlatformCompatibilityDate): { | ||
declare function getCompatibilityChanges(allUpdates: CompatibilityUpdates, compatibilityDate1: CompatibilityDate, compatibilityDate2: CompatibilityDate): { | ||
added: CompatibilityUpdates; | ||
@@ -77,2 +90,2 @@ removed: CompatibilityUpdates; | ||
export { type CompatibilityUpdate, type CompatibilityUpdates, type DateString, type PlatformCompatibilityDate, type PlatformCompatibilityDates, type PlatformName, formatDateString, getCompatibilityChanges, getCompatibilityUpdates }; | ||
export { type CompatibilityDate, type CompatibilityDates, type CompatibilityUpdate, type CompatibilityUpdates, type DateString, type PlatformName, formatDate, getCompatibilityChanges, getCompatibilityUpdates, platforms, resolveCompatibilityDates, resolveCompatibilityDatesFromEnv }; |
{ | ||
"name": "compatx", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "🌴 Gradual feature flags.", | ||
@@ -5,0 +5,0 @@ "repository": "unjs/compatx", |
@@ -42,3 +42,3 @@ # `compatx` | ||
### `formatDateString(date)` | ||
### `formatDate(date)` | ||
@@ -61,2 +61,17 @@ Format a date to a `YYYY-MM-DD` string | ||
### `platforms` | ||
- **Type**: `array` | ||
- **Default**: `["aws","azure","cloudflare","deno","firebase","netlify","vercel"]` | ||
### `resolveCompatibilityDates(input, defaults?)` | ||
Normalize the compatibility dates from input config and defaults. | ||
### `resolveCompatibilityDatesFromEnv(input)` | ||
Resolve compatibility dates with environment variables as defaults. | ||
Environment variable name format is `COMPATIBILITY_DATE` for default and `COMPATIBILITY_DATE_<PLATFORM>` for specific platforms. | ||
<!-- /automd --> | ||
@@ -70,7 +85,8 @@ | ||
DateString, | ||
// Platform compatibility dates | ||
// Platform names | ||
PlatformName, | ||
PlatformCompatibilityDate, | ||
PlatformCompatibilityDates, | ||
// Platform compatibility updates | ||
// Compatibility dates | ||
CompatibilityDate, | ||
CompatibilityDates, | ||
// Compatibility updates | ||
CompatibilityUpdate, | ||
@@ -77,0 +93,0 @@ CompatibilityUpdates |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18091
239
107