Skip to content
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
3 changes: 1 addition & 2 deletions features/error-cause.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Error cause
description: The `cause` property of errors records the specific original cause of the error, particularly for errors that have been re-thrown.
spec:
- https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-installerrorcause
spec: https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-installerrorcause
compat_features:
- javascript.builtins.Error.Error.options_cause_parameter
- javascript.builtins.Error.cause
7 changes: 4 additions & 3 deletions features/focus-events.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Focus events
description: Focus events, such as `focus` and `blur`, fire when an element gets or loses focus.
spec: https://w3c.github.io/uievents/#events-focusevent
compute_from:
- api.Element.blur_event
- api.Element.focus_event
status:
compute_from:
- api.Element.blur_event
- api.Element.focus_event
# It's possible that caniuse's `focusin-focusout-events` could be linked here
# or broken out into a separate feature. But caniuse and BCD conflict,
# making this difficult. See this issue to help resolve this:
Expand Down
14 changes: 11 additions & 3 deletions features/focus-events.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
baseline: high
baseline_low_date: 2015-07-29
baseline_high_date: 2018-01-29
support:
safari: "7"
safari_ios: "7"
chrome: "1"
chrome_android: "18"
edge: "12"
firefox: "24"
firefox_android: "24"
safari: "3.1"
safari_ios: "2"
compat_features:
# baseline: high
# baseline_low_date: 2015-07-29
Expand All @@ -20,6 +27,7 @@ compat_features:
# safari_ios: "2"
- api.Element.blur_event

# ⬇️ Same status as overall feature ⬇️
# baseline: high
# baseline_low_date: 2015-07-29
# baseline_high_date: 2018-01-29
Expand Down
3 changes: 1 addition & 2 deletions features/uint8array-base64-hex.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Uint8Array base64 and hex conversion
description: The `Uint8Array` object methods `fromBase64()`, `toBase64()`, and `setFromBase64()` convert to and from base64 strings. The `fromHex()`, `toHex()`, and `setFromHex()` methods convert to and from hex strings.
spec: https://tc39.es/proposal-arraybuffer-base64/spec/
group:
- typed-arrays
group: typed-arrays
compat_features:
- javascript.builtins.Uint8Array.fromBase64
- javascript.builtins.Uint8Array.fromHex
Expand Down
3 changes: 1 addition & 2 deletions features/weak-references.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Weak references
description: The `WeakRef` and `FinalizationRegistry` objects hold references to garbage-collectable objects without creating strong references that prevent their garbage collection.
spec:
- https://tc39.es/ecma262/multipage/managing-memory.html#sec-managing-memory
spec: https://tc39.es/ecma262/multipage/managing-memory.html#sec-managing-memory
snapshot: ecmascript-2021
group: javascript
status:
Expand Down
17 changes: 0 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"@types/diff": "^5.2.3",
"@types/node": "^18.19.68",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"caniuse-lite": "^1.0.30001689",
"diff": "^7.0.0",
"eslint-plugin-new-with-error": "^5.0.0",
Expand Down
13 changes: 4 additions & 9 deletions schemas/data.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"type": "array"
}
],
"description": "caniuse.com identifier"
"description": "caniuse.com identifier(s)"
},
"compat_features": {
"description": "Sources of support data for this feature",
Expand Down Expand Up @@ -70,7 +70,7 @@
"type": "array"
}
],
"description": "Group identifier"
"description": "Group identifier(s)"
},
"name": {
"description": "Short name",
Expand All @@ -89,26 +89,22 @@
"type": "array"
}
],
"description": "Snapshot identifier"
"description": "Snapshot identifier(s)"
},
"spec": {
"anyOf": [
{
"description": "Specification URL",
"format": "uri",
"type": "string"
},
{
"items": {
"description": "Specification URL",
"format": "uri",
"type": "string"
},
"minItems": 2,
"type": "array"
}
],
"description": "Specification"
"description": "Specification URL(s)"
},
"status": {
"additionalProperties": false,
Expand Down Expand Up @@ -286,7 +282,6 @@
},
"spec": {
"description": "Specification",
"format": "uri",
"type": "string"
}
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function valid(data: any): boolean {
if (!valid) {
// TODO: turn on strictNullChecks, fix all the errors, and replace this with:
// const errors = validate.errors;
const errors = (valid as any).errors as DefinedError[];
const errors = validate.errors as DefinedError[];
for (const error of errors) {
logger.error(`${error.instancePath}: ${error.message}`);
}
Expand Down
24 changes: 10 additions & 14 deletions scripts/validate.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import Ajv from "ajv";
import addFormats from "ajv-formats";
import assert from "node:assert/strict";

import * as schema from "../schemas/data.schema.json" with { type: "json" };

export function validate(data: any) {
const ajv = new Ajv({ allErrors: true, allowUnionTypes: true });
addFormats(ajv);
// TODO: turn on strictNullChecks, fix all the errors, and replace this with:
// const validator = ajv.compile<WebFeaturesData>(schema);
const validator = ajv.compile(schema);
const ajv = new Ajv({ allErrors: true, allowUnionTypes: true });
// TODO: turn on strictNullChecks, fix all the errors, and replace this with:
// const validator = ajv.compile<WebFeaturesData>(schema);
const validator = ajv.compile(schema);

assert.equal(
validator({}),
false,
"Failed confidence check: schema validates empty object",
);
assert.equal(
validator({}),
false,
"Failed confidence check: schema validates empty object",
);

return validator;
}
export { validator as validate };
17 changes: 6 additions & 11 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export interface FeatureData {
description: string;
/** Short description of the feature, as an HTML string */
description_html: string;
/** Specification */
spec: specification_url | [specification_url, specification_url, ...specification_url[]];
/** Group identifier */
/** Specification URL(s) */
spec: string | [string, string, ...string[]];
/** Group identifier(s) */
group?: string | [string, string, ...string[]];
/** Snapshot identifier */
/** Snapshot identifier(s) */
snapshot?: string | [string, string, ...string[]];
/** caniuse.com identifier */
/** caniuse.com identifier(s) */
caniuse?: string | [string, string, ...string[]];
/** Whether a feature is considered a "baseline" web platform feature and when it achieved that status */
status: SupportStatus;
Expand Down Expand Up @@ -69,11 +69,6 @@ interface SupportStatus extends Status {
by_compat_key?: Record<string, Status>
}

/** Specification URL
* @format uri
*/
type specification_url = string;

export interface GroupData {
/** Short name */
name: string;
Expand All @@ -85,5 +80,5 @@ export interface SnapshotData {
/** Short name */
name: string;
/** Specification */
spec: specification_url;
spec: string;
}
Loading