@@ -129,7 +129,7 @@ export const cssProperties = {
129129export interface Support {
130130 force ?: boolean
131131 passed ?: number
132- failed ?: number
132+ failed ?: Set < string >
133133}
134134
135135export interface VersionRange {
@@ -145,6 +145,7 @@ export interface PrefixData {
145145
146146export type SupportMap < F extends string > = Record < F , Partial < Record < Engine , Record < string , Support > > > >
147147export type VersionRangeMap < F extends string > = Partial < Record < F , Partial < Record < Engine , VersionRange [ ] > > > >
148+ export type WhyNotMap < F extends string > = Partial < Record < F , Partial < Record < Engine , string [ ] > > > >
148149export type CSSPrefixMap = Partial < Record < CSSProperty , PrefixData [ ] > >
149150
150151const compareVersions = ( a : number [ ] , b : number [ ] ) : number => {
@@ -187,12 +188,14 @@ const mergePrefixMaps = (to: CSSPrefixMap, from: CSSPrefixMap): void => {
187188 }
188189}
189190
190- const supportMapToVersionRanges = < F extends string > ( supportMap : SupportMap < F > ) : VersionRangeMap < F > => {
191+ const supportMapToVersionRanges = < F extends string > ( supportMap : SupportMap < F > ) : [ VersionRangeMap < F > , WhyNotMap < F > ] => {
191192 const versionRangeMap : VersionRangeMap < F > = { }
193+ const whyNotMap : WhyNotMap < F > = { }
192194
193195 for ( const feature in supportMap ) {
194196 const engines = supportMap [ feature as F ]
195197 const featureMap : Partial < Record < Engine , VersionRange [ ] > > = { }
198+ const whyNotByEngine : Partial < Record < Engine , string [ ] > > = { }
196199
197200 // Compute the maximum number of tests that any one engine has passed
198201 let maxPassed = 0
@@ -206,7 +209,7 @@ const supportMapToVersionRanges = <F extends string>(supportMap: SupportMap<F>):
206209
207210 for ( const engine in engines ) {
208211 const versions = engines [ engine as Engine ]
209- const sortedVersions : { version : number [ ] , supported : boolean } [ ] = [ ]
212+ const sortedVersions : { version : number [ ] , supported : boolean , failed ?: Set < string > } [ ] = [ ]
210213
211214 for ( const version in versions ) {
212215 const { force, passed, failed } = versions [ version ]
@@ -221,11 +224,17 @@ const supportMapToVersionRanges = <F extends string>(supportMap: SupportMap<F>):
221224 // feature to be unsupported if not all tests were run, since it could
222225 // be dangerous to assume otherwise.
223226 ! failed && passed === maxPassed ,
227+ failed,
224228 } )
225229 }
226230
227231 sortedVersions . sort ( ( a , b ) => compareVersions ( a . version , b . version ) )
228232
233+ if ( sortedVersions . length ) {
234+ const last = sortedVersions [ sortedVersions . length - 1 ]
235+ if ( last . failed ) whyNotByEngine [ engine as Engine ] = [ ...last . failed ] . sort ( )
236+ }
237+
229238 const versionRanges : VersionRange [ ] = [ ]
230239 let i = 0
231240
@@ -270,9 +279,10 @@ const supportMapToVersionRanges = <F extends string>(supportMap: SupportMap<F>):
270279 }
271280
272281 versionRangeMap [ feature as F ] = featureMap
282+ whyNotMap [ feature as F ] = whyNotByEngine
273283 }
274284
275- return versionRangeMap
285+ return [ versionRangeMap , whyNotMap ]
276286}
277287
278288const updateGithubDependencies = ( ) : void => {
@@ -469,7 +479,8 @@ import('./kangax').then(kangax => {
469479 // MDN data is wrong here: https://www.chromestatus.com/feature/6482797915013120
470480 js . ClassStaticBlocks . Chrome = { 91 : { force : true } }
471481
472- generateTableForJS ( supportMapToVersionRanges ( js ) )
482+ const [ jsVersionRanges , jsWhyNot ] = supportMapToVersionRanges ( js )
483+ generateTableForJS ( jsVersionRanges , jsWhyNot )
473484} )
474485
475486const css : SupportMap < CSSFeature > = { } as SupportMap < CSSFeature >
@@ -481,4 +492,5 @@ mergeSupportMaps(css, mdn.css)
481492mergePrefixMaps ( cssPrefix , caniuse . cssPrefix )
482493mergePrefixMaps ( cssPrefix , mdn . cssPrefix )
483494
484- generateTableForCSS ( supportMapToVersionRanges ( css ) , cssPrefix )
495+ const [ cssVersionRanges ] = supportMapToVersionRanges ( css )
496+ generateTableForCSS ( cssVersionRanges , cssPrefix )
0 commit comments