Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial feature support definition #40

Merged
merged 8 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions feature-group-definitions/cascade-layers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ status:
chrome: "99"
firefox: "97"
safari: "15.4"
compat_features:
- css.at-rules.layer
- css.at-rules.import.layer
- api.CSSImportRule.layerName
- api.CSSLayerBlockRule
- api.CSSLayerBlockRule.name
- api.CSSLayerStatementRule
- api.CSSLayerStatementRule.nameList
21 changes: 18 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,29 @@ import YAML from 'yaml';

interface FeatureData {
spec: string,
caniuse?: string
caniuse?: string,
status?: SupportStatus
compat_features?: string[];
}

type browserIdentifier = "chrome" | "firefox" | "safari";

interface SupportStatus {
is_basline: boolean, since?: string, support?: {[K in browserIdentifier]?: string}
is_baseline: boolean, since?: string, support?: {[K in browserIdentifier]?: string}
}

// Some FeatureData keys aren't (and may never) be ready for publishing.
// They're not part of the public schema (yet).
// They'll be removed.
const omittables = [
"compat_features"
]

function scrub(data: FeatureData) {
for (const key of omittables) {
delete data[key];
}
return data;
}

const filePaths = new fdir()
Expand All @@ -30,7 +45,7 @@ for (const fp of filePaths) {

const src = fs.readFileSync(fp, { encoding: 'utf-8'});
const data = YAML.parse(src);
features[key] = data;
features[key] = scrub(data);
}

export default features;