-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into MP-1242-redirect-to-preferred-locale
- Loading branch information
Showing
80 changed files
with
5,035 additions
and
4,918 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
".": "2.60.0" | ||
".": "2.63.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,41 @@ | ||
import webFeatures from "web-features"; | ||
import { features } from "web-features"; | ||
import { computeBaseline } from "compute-baseline"; | ||
|
||
export function getWebFeatureStatus(...features: string[]) { | ||
if (features.length === 0) { | ||
return; | ||
import type { Doc } from "../libs/types/document.js"; | ||
|
||
export function addBaseline(doc: Partial<Doc>) { | ||
if ( | ||
doc.browserCompat && | ||
doc.browserCompat.length == 1 && | ||
!doc.mdn_url?.includes("/docs/MDN/") | ||
) { | ||
const bcdKey = doc.browserCompat[0]; | ||
const { featureStatus, keyStatus } = getStatuses(bcdKey); | ||
|
||
if (!featureStatus) { | ||
return; | ||
} | ||
|
||
if (featureStatus.baseline !== keyStatus.baseline) { | ||
return; | ||
} | ||
|
||
return featureStatus; | ||
} | ||
} | ||
|
||
for (const feature of Object.values(webFeatures)) { | ||
if ( | ||
feature.status && | ||
feature.compat_features?.some((feature) => features.includes(feature)) | ||
) { | ||
return feature.status; | ||
function getStatuses(bcdKey: string) { | ||
for (const feature of Object.values(features)) { | ||
if (feature.status && feature.compat_features?.includes(bcdKey)) { | ||
try { | ||
return { | ||
featureStatus: feature.status, | ||
keyStatus: computeBaseline({ compatKeys: [bcdKey] }), | ||
}; | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
} | ||
return {}; | ||
} |
Oops, something went wrong.