Skip to content

Commit

Permalink
Merge branch 'main' into explain-yes-compatibility-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gagan-bhullar-tech authored Jul 25, 2024
2 parents d7c16d0 + 72781eb commit e0ed948
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 122 deletions.
10 changes: 5 additions & 5 deletions build/web-features.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import webFeatures from "web-features";
import { features } from "web-features";

export function getWebFeatureStatus(...features: string[]) {
if (features.length === 0) {
export function getWebFeatureStatus(...bcdKeys: string[]) {
if (bcdKeys.length === 0) {
return;
}

for (const feature of Object.values(webFeatures)) {
for (const feature of Object.values(features)) {
if (
feature.status &&
feature.compat_features?.some((feature) => features.includes(feature))
feature.compat_features?.some((feature) => bcdKeys.includes(feature))
) {
return feature.status;
}
Expand Down
15 changes: 9 additions & 6 deletions client/src/document/baseline-indicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import { useLocation } from "react-router";

import "./baseline-indicator.scss";

import type {
SupportStatus,
browserIdentifier,
} from "../../../libs/types/web-features";
// web-features doesn't export these types directly so we need to do a little typescript magic:
import type { features } from "web-features";
type SupportStatus = (typeof features)[keyof typeof features]["status"];
type BrowserIdentifier =
keyof (typeof features)[keyof typeof features]["status"]["support"];

interface BrowserGroup {
name: string;
ids: browserIdentifier[];
ids: BrowserIdentifier[];
}

const ENGINES: {
Expand Down Expand Up @@ -62,9 +63,11 @@ export function BaselineIndicator({ status }: { status: SupportStatus }) {
LOCALIZED_BCD_IDS[locale] || LOCALIZED_BCD_IDS[DEFAULT_LOCALE]
}`;

const low_date_range = status.baseline_low_date?.match(/^([^0-9])/)?.[0];
const low_date = status.baseline_low_date
? new Date(status.baseline_low_date)
? new Date(status.baseline_low_date.slice(low_date_range ? 1 : 0))
: undefined;

const level = status.baseline
? status.baseline
: status.baseline === false
Expand Down
5 changes: 4 additions & 1 deletion libs/types/document.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { type Locale } from "./core.js";
import type { SupportStatus } from "./web-features.js";

// web-features doesn't export this type directly so we need to do a little typescript magic:
import type { features } from "web-features";
type SupportStatus = (typeof features)[keyof typeof features]["status"];

export interface Source {
folder: string;
Expand Down
53 changes: 0 additions & 53 deletions libs/types/web-features.ts

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@mdn/bcd-utils-api": "^0.0.7",
"@mdn/browser-compat-data": "^5.5.41",
"@mozilla/glean": "5.0.2",
"@sentry/node": "^8.19.0",
"@sentry/node": "^8.20.0",
"@stripe/stripe-js": "^4.1.0",
"@use-it/interval": "^1.0.0",
"@vscode/ripgrep": "^1.15.9",
Expand Down Expand Up @@ -145,7 +145,7 @@
"unified": "^11.0.5",
"unist-builder": "^4.0.0",
"unist-util-visit": "^5.0.0",
"web-features": "^0.9.0",
"web-features": "^1.0.0",
"web-specs": "^3.13.1"
},
"devDependencies": {
Expand Down Expand Up @@ -216,7 +216,7 @@
"mini-css-extract-plugin": "^2.9.0",
"node-dev": "^8.0.0",
"peggy": "^4.0.3",
"postcss": "^8.4.39",
"postcss": "^8.4.40",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-loader": "^8.1.1",
"postcss-normalize": "^10.0.1",
Expand All @@ -236,7 +236,7 @@
"resolve-url-loader": "^5.0.0",
"rough-notation": "^0.5.1",
"sass": "^1.77.6",
"sass-loader": "^14.2.1",
"sass-loader": "^15.0.0",
"source-map-explorer": "^2.5.3",
"source-map-loader": "^5.0.0",
"style-loader": "^3.3.4",
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"front-matter": ["./type-fixes/front-matter.js"],
"@mdn/browser-compat-data/types": [
"./node_modules/@mdn/browser-compat-data/types.d.ts"
],
"web-features": ["./type-fixes/web-features.js"]
]
},
"preserveWatchOutput": true,
"resolveJsonModule": true,
Expand Down
5 changes: 0 additions & 5 deletions type-fixes/web-features.ts

This file was deleted.

93 changes: 47 additions & 46 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2756,18 +2756,18 @@
resolved "https://registry.yarnpkg.com/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz#60de891bb126abfdc5410fdc6166aca065f10a0c"
integrity sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==

"@sentry/core@8.19.0":
version "8.19.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-8.19.0.tgz#427d09ca27557ddc7c1bfa5e810b7f802836e0b4"
integrity sha512-MrgjsZCEjOJgQjIznnDSrLEy7qL+4LVpNieAvr49cV1rzBNSwGmWRnt/puVaPsLyCUgupVx/43BPUHB/HtKNUw==
"@sentry/core@8.20.0":
version "8.20.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-8.20.0.tgz#c50d082033a44295d2fe9140319f912ba1f946d3"
integrity sha512-R81snuw+67VT4aCxr6ShST/s0Y6FlwN2YczhDwaGyzumn5rlvA6A4JtQDeExduNoDDyv4T3LrmW8wlYZn3CJJw==
dependencies:
"@sentry/types" "8.19.0"
"@sentry/utils" "8.19.0"
"@sentry/types" "8.20.0"
"@sentry/utils" "8.20.0"

"@sentry/node@^8.19.0":
version "8.19.0"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-8.19.0.tgz#366ca24436461b103c245867cc7881c8f5aca13c"
integrity sha512-r7AeKxfB9eE/UW0NZT3AMh+hNA65NFEwtsMYO6iI52FPLFZh0DLOvzVOeNsmsJqPpyetooUGTtUYpBdinZldWA==
"@sentry/node@^8.20.0":
version "8.20.0"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-8.20.0.tgz#dc20f03dfdec8797f2a0074ebe90044d305d1c59"
integrity sha512-i4ywT2m0Gw65U3uwI4NwiNcyqp9YF6/RsusfH1pg4YkiL/RYp7FS0MPVgMggfvoue9S3KjCgRVlzTLwFATyPXQ==
dependencies:
"@opentelemetry/api" "^1.9.0"
"@opentelemetry/context-async-hooks" "^1.25.1"
Expand All @@ -2792,33 +2792,34 @@
"@opentelemetry/sdk-trace-base" "^1.25.1"
"@opentelemetry/semantic-conventions" "^1.25.1"
"@prisma/instrumentation" "5.17.0"
"@sentry/core" "8.19.0"
"@sentry/opentelemetry" "8.19.0"
"@sentry/types" "8.19.0"
"@sentry/utils" "8.19.0"
"@sentry/core" "8.20.0"
"@sentry/opentelemetry" "8.20.0"
"@sentry/types" "8.20.0"
"@sentry/utils" "8.20.0"
import-in-the-middle "^1.10.0"
optionalDependencies:
opentelemetry-instrumentation-fetch-node "1.2.3"

"@sentry/opentelemetry@8.19.0":
version "8.19.0"
resolved "https://registry.yarnpkg.com/@sentry/opentelemetry/-/opentelemetry-8.19.0.tgz#5656cfb372e09a4e792838692885435d7b7b6cfd"
integrity sha512-L1aSxO/aJJ7D3pIlTaVOgbiZJAnUHXezobTc8j5pqFCQACjxnLMSDrt53QfFV52CcjbliDWCYe4IB8umu4DgpA==
"@sentry/opentelemetry@8.20.0":
version "8.20.0"
resolved "https://registry.yarnpkg.com/@sentry/opentelemetry/-/opentelemetry-8.20.0.tgz#5e62a361f43e6b53686037a62b82a7de51995578"
integrity sha512-NFcLK6+t9wUc4HlGKeuDn6W4KjZxZfZmWlrK2/tgC5KzG1cnVeOnWUrJzGHTa+YDDdIijpjiFUcpXGPkX3rmIg==
dependencies:
"@sentry/core" "8.19.0"
"@sentry/types" "8.19.0"
"@sentry/utils" "8.19.0"
"@sentry/core" "8.20.0"
"@sentry/types" "8.20.0"
"@sentry/utils" "8.20.0"

"@sentry/types@8.19.0":
version "8.19.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-8.19.0.tgz#26a5d56c823c5eabbb7d6f53112da335b6d96dcb"
integrity sha512-52C8X5V7mK2KIxMJt8MV5TxXAFHqrQR1RKm1oPTwKVWm8hKr1ZYJXINymNrWvpAc3oVIKLC/sa9WFYgXQh+YlA==
"@sentry/types@8.20.0":
version "8.20.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-8.20.0.tgz#f0f50c84eb768df8b55ee7b41459fec2d39d0d5e"
integrity sha512-6IP278KojOpiAA7vrd1hjhUyn26cl0n0nGsShzic5ztCVs92sTeVRnh7MTB9irDVtAbOEyt/YH6go3h+Jia1pA==

"@sentry/utils@8.19.0":
version "8.19.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-8.19.0.tgz#f22df2a38327b1cff1e04ba7f11fdf1a32d3ba22"
integrity sha512-8dWJJKaUN6Hf92Oxw2TBmHchGua2W3ZmonrZTTwLvl06jcAigbiQD0MGuF5ytZP8PHx860orV+SbTGKFzfU3Pg==
"@sentry/utils@8.20.0":
version "8.20.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-8.20.0.tgz#fcbf46c8e8c8eccbf1db532b087547eb4f6c449c"
integrity sha512-+1I5H8dojURiEUGPliDwheQk8dhjp8uV1sMccR/W/zjFrt4wZyPs+Ttp/V7gzm9LDJoNek9tmELert/jQqWTgg==
dependencies:
"@sentry/types" "8.19.0"
"@sentry/types" "8.20.0"

"@sidvind/[email protected]":
version "2.1.3"
Expand Down Expand Up @@ -8938,10 +8939,10 @@ [email protected]:
cjs-module-lexer "^1.2.2"
module-details-from-path "^1.0.3"

import-in-the-middle@^1.8.1:
version "1.8.1"
resolved "https://registry.yarnpkg.com/import-in-the-middle/-/import-in-the-middle-1.8.1.tgz#8b51c2cc631b64e53e958d7048d2d9463ce628f8"
integrity sha512-yhRwoHtiLGvmSozNOALgjRPFI6uYsds60EoMqqnXyyv+JOIW/BrrLejuTGBt+bq0T5tLzOHrN0T7xYTm4Qt/ng==
import-in-the-middle@^1.10.0, import-in-the-middle@^1.8.1:
version "1.10.0"
resolved "https://registry.yarnpkg.com/import-in-the-middle/-/import-in-the-middle-1.10.0.tgz#f15b0841950ded8d899b635058da5646256949b1"
integrity sha512-Z1jumVdF2GwnnYfM0a/y2ts7mZbwFMgt5rRuVmLgobgahC6iKgN5MBuXjzfTIOUpq5LSU10vJIPpVKe0X89fIw==
dependencies:
acorn "^8.8.2"
acorn-import-attributes "^1.9.5"
Expand Down Expand Up @@ -12764,10 +12765,10 @@ postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0:
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514"
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==

postcss@^8.2.14, postcss@^8.4.28, postcss@^8.4.32, postcss@^8.4.33, postcss@^8.4.38, postcss@^8.4.39:
version "8.4.39"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.39.tgz#aa3c94998b61d3a9c259efa51db4b392e1bde0e3"
integrity sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==
postcss@^8.2.14, postcss@^8.4.28, postcss@^8.4.32, postcss@^8.4.33, postcss@^8.4.38, postcss@^8.4.40:
version "8.4.40"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.40.tgz#eb81f2a4dd7668ed869a6db25999e02e9ad909d8"
integrity sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==
dependencies:
nanoid "^3.3.7"
picocolors "^1.0.1"
Expand Down Expand Up @@ -13778,10 +13779,10 @@ sanitize.css@*:
resolved "https://registry.yarnpkg.com/sanitize.css/-/sanitize.css-13.0.0.tgz#2675553974b27964c75562ade3bd85d79879f173"
integrity sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA==

sass-loader@^14.2.1:
version "14.2.1"
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-14.2.1.tgz#db9ad96b56dc1c1ea546101e76375d5b008fec70"
integrity sha512-G0VcnMYU18a4N7VoNDegg2OuMjYtxnqzQWARVWCIVSZwJeiL9kg8QMsuIZOplsJgTzZLF6jGxI3AClj8I9nRdQ==
sass-loader@^15.0.0:
version "15.0.0"
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-15.0.0.tgz#a883fda2b70c27d4a49835057da6b8d8564a419d"
integrity sha512-mbXAL7sI/fgt3skXR6xHxtKkaGyxRrGf7zrU4hLLWxBDJEcAe0QsoNy92qKttCb3zfMniTkU2kD9yakUKtW7vQ==
dependencies:
neo-async "^2.6.2"

Expand Down Expand Up @@ -15824,10 +15825,10 @@ wbuf@^1.1.0, wbuf@^1.7.3:
dependencies:
minimalistic-assert "^1.0.0"

web-features@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/web-features/-/web-features-0.9.0.tgz#f46748e1cffe50e03a3331e44fcd85844cbc47d5"
integrity sha512-Y1SZbw8yt762LBfdDgD0Qe2XHpsmjcKnUKNi5HH/Y/uqJYST06ua+VFatwxvS/NIBPPuRwI0KbJl0VG606jNpg==
web-features@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/web-features/-/web-features-1.0.0.tgz#c40f74bd38a09ef9ba7b7769521a336686b5811b"
integrity sha512-U/ppX0h851Fr8LbOVMybiuH3iGWGlPi+DYXoj6VkOvXJc6VgYpSdGDosduYl/4qvW6YNlZ4IaczLgqHqbaU25A==

web-namespaces@^2.0.0:
version "2.0.1"
Expand Down

0 comments on commit e0ed948

Please sign in to comment.