|
1 | | -import { computeBaseline, coreBrowserSet } from "compute-baseline"; |
| 1 | +import { computeBaseline, coreBrowserSet, getStatus } from "compute-baseline"; |
2 | 2 | import { Compat } from 'compute-baseline/browser-compat-data'; |
3 | 3 | import { features } from "web-features"; |
4 | 4 | import { readFileSync } from 'fs'; |
@@ -89,8 +89,33 @@ fetch(`http://unpkg.com/@mdn/browser-compat-data@${bcdVersion}/data.json`) |
89 | 89 | [support]: 'y' |
90 | 90 | }; |
91 | 91 | } else { |
92 | | - stats[platform][sub] = { |
93 | | - '*': 'n' |
| 92 | + // The feature is not fully baseline but some keys might not apply to baseline |
| 93 | + // Therefore we check if any features are suported and then assume partial support |
| 94 | + // We then show the list on the site for further review |
| 95 | + |
| 96 | + // Use getStatus to check every key |
| 97 | + let anySupported = false; |
| 98 | + const supportedKeys = []; |
| 99 | + const unsupportedKeys = []; |
| 100 | + for (const compatKey of feature.compat_features as [string, ...string[]]) { |
| 101 | + const status = getStatus(feature.name, compatKey, compat); |
| 102 | + if (status.support && status.support["webview_" + sub]) { |
| 103 | + anySupported = true; |
| 104 | + supportedKeys.push(compatKey); |
| 105 | + } else { |
| 106 | + unsupportedKeys.push(compatKey); |
| 107 | + } |
| 108 | + } |
| 109 | + if (anySupported) { |
| 110 | + stats[platform][sub] = { |
| 111 | + "partial": 'y', |
| 112 | + "supported_keys": supportedKeys, |
| 113 | + "unsupported_keys": unsupportedKeys |
| 114 | + }; |
| 115 | + } else { |
| 116 | + stats[platform][sub] = { |
| 117 | + "u": 'n' |
| 118 | + }; |
94 | 119 | } |
95 | 120 | } |
96 | 121 | } |
|
0 commit comments