-
Notifications
You must be signed in to change notification settings - Fork 17
/
.mdn-spec-links.ts
152 lines (145 loc) · 4.78 KB
/
.mdn-spec-links.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/**
* Each top-level entry in our data is an object with a single key: A
* fragment ID from a spec. Each top-level entry associates its spec
* fragment ID with one or more objects holding data about a feature.
*/
export interface MDNSpecLink {
[specLinkFragmentID: string]: Feature[];
}
/**
* Each object for a feature has data from the MDN article for the feature,
* along with data from BCD https://github.com/mdn/browser-compat-data/.
*/
export interface Feature {
/**
* Name of the feature (interface, method, or property name); from BCD.
*/
name: string;
/**
* Filename of the BCD file containing the data for the feature.
*/
filename: string | null;
/**
* Title of the MDN article for the feature.
*/
title: string;
/**
* Slug (URL path) of the MDN article for the feature.
*/
slug: string;
/**
* First paragraph or "seoSummary" of the MDN article for the feature.
*/
summary: string;
/**
* Names of engines with support for the feature that conforms to the
* spec (that is, un-prefixed and not under an alternative name —
* though possibly requiring a runtime flag or preference to be set).
*/
engines: Engines[];
/**
* Names of engines with support for the feature implemented under a
* wholly different name (in contrast to just being prefixed).
*/
altname?: Engines[];
/**
* Names of engines with support for the feature that requires setting
* a runtime flag or preference.
*/
needsflag?: Engines[];
/**
* Names of engines with support for the feature that differs from the
* spec in a way that may cause compatibility problems.
*/
partial?: Engines[];
/**
* Names of engines with support for the feature that requires adding
* a prefix to the standard feature name defined in the spec.
*/
prefixed?: Engines[];
/**
* Per-browser data about support for the feature.
*/
support: Support | null;
/**
* The caniuse.com shortname for the feature, along with the title of
* the caniuse.com table (page) for the feature.
*/
caniuse?: { feature: string, title: string };
}
export type Engines = "blink" | "gecko" | "webkit";
type Browsers =
"chrome"
| "chrome_android"
| "edge"
| "edge_blink"
| "firefox"
| "firefox_android"
| "ie"
| "nodejs"
| "opera"
| "opera_android"
| "qq_android"
| "safari"
| "safari_ios"
| "samsunginternet_android"
| "uc_android"
| "uc_chinese_android"
| "webview_android";
export type Support = Partial<Record <Browsers, SupportData>>;
export type SupportData = SupportDetails | SupportDetails[]
export interface SupportDetails {
/**
* Either: (1) a browser version number (the first version of the
* browser to add support for the feature), or (2) boolean true to
* indicate just that the browser supports the feature (but the first
* version to add support for it is unknown), or (3) boolean false to
* indicate the browser doesn't support the feature, or else (4) null
* to indicate it's unknown whether the browser supports the feature.
*/
version_added: string | boolean | null;
/**
* Either: (1) a browser version number (the version of the browser
* which dropped support for the feature), or (2) boolean true to
* indicate just that the feature was dropped from the browser (but the
* first version to drop support for it is unknown). (Boolean false and
* null are also allowed as values, but the semantics are undefined.)
*/
version_removed?: string | boolean | null;
/**
* Alternative name for the feature, for cases of a feature implemented
* under a wholly different name (in contrast to just being prefixed).
*/
alternative_name?: string;
/**
* Data about flags needed to enable support for the feature.
*/
flags?: Flag[];
/**
* Additional/noteworthy information about support for the feature.
*/
notes?: string | string[];
/**
* Boolean indicating whether support for the feature deviates from the
* specification in a way that may cause compatibility problems.
*/
partial_implementation?: boolean;
/**
* Prefix that must be added to the feature name defined in the spec in
* order to enable support. Includes any leading/trailing dashes.
*/
prefix?: string;
}
export interface Flag {
/**
* The name of the flag or preference that must be set in order to
* enable support for the feature.
*/
name: string;
type: "preference" | "runtime_flag";
/**
* The value to which the specified flag must be set in order to enable
* support for the feature.
*/
value_to_set?: string;
}