Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
}
if((options.contrib === "true" || options.contrib === "all" ) && versionAddedAtRules === true){
// eslint-disable-next-line no-console
console.log("CSS @-rule: @" + node.name + " with true in BCD for " + browser + ": https://github.com/mdn/browser-compat-data/tree/master/css/at-rules/" + node.name + ".json to fix that 🤘");
}
if((options.contrib === "null" || options.contrib === "all" ) && versionAddedAtRules === null){
// eslint-disable-next-line no-console
console.log("CSS @-rule: @" + node.name + " with null in BCD for " + browser + ": https://github.com/mdn/browser-compat-data/tree/master/css/at-rules/" + node.name + ".json to fix that 🤘");
}
});
}
}
if(node.type === "MediaFeature"){
const mfName = node.name.replace(/^(min)|(max)-/,"");
if((mfName + "_media_feature") in bcd.css["at-rules"]["media"]){
Object.keys(browserScope).map((browser)=>{
const supportBrowser = bcd.css["at-rules"]["media"][mfName + "_media_feature"].__compat.support[browser];
let versionAddedMediaFeature;
if(Array.isArray(supportBrowser)){
versionAddedMediaFeature = supportBrowser[0].version_added;
} else {
versionAddedMediaFeature = supportBrowser.version_added;
}
if((versionAddedMediaFeature !== null) && ((!versionAddedMediaFeature) || (versionAddedMediaFeature !== true && semver.lt(semver.coerce(browserScope[browser]), semver.coerce(versionAddedMediaFeature)) ))){
report.push({
"featureName": "Media feature: @" + mfName,
"browser":browser,
"fileName":fileName,
"column": node.loc.start.column,
"featureVersion": versionAddedMediaFeature,
"line": node.loc.start.line + lineShift
onopentag: function (name, attribs){
if(bcd.html.elements[name]){
Object.keys(browserScope).map((browser)=>{
let versionAddedElem;
if(bcd.html.elements[name].__compat.support[browser]){
versionAddedElem = bcd.html.elements[name].__compat.support[browser].version_added;
}
if((versionAddedElem !== null) && ((!versionAddedElem) || (versionAddedElem !== true && semver.lt(semver.coerce(browserScope[browser]), semver.coerce(versionAddedElem)) ))){
report.push({
"featureName":"<" + name + ">",
"browser":browser,
"fileName":fileName,
"line": numLine,
"column": 0,
"featureVersion":versionAddedElem
});
}
// Intercept any feature that isn't properly filled into MDN according to
// svg: compatData.svg,
// webdriver: compatData.webdriver,
// webextensions: compatData.webextensions
// }
const payload = {
api: compatData.api,
browsers: compatData.browsers,
css: compatData.css,
html: compatData.html,
http: compatData.http,
javascript: compatData.javascript,
mathml: compatData.mathml,
svg: compatData.svg,
webdriver: compatData.webdriver,
webextensions: compatData.webextensions
}
fs.writeFile(
path.resolve(
__dirname,
'..',
'public',
'data.json'
),
JSON.stringify(payload, null, 2),
err => {
if (err) {
console.error(err)
}
}
)
// http: compatData.http,
// javascript: compatData.javascript,
// mathml: compatData.mathml,
// svg: compatData.svg,
// webdriver: compatData.webdriver,
// webextensions: compatData.webextensions
// }
const payload = {
api: compatData.api,
browsers: compatData.browsers,
css: compatData.css,
html: compatData.html,
http: compatData.http,
javascript: compatData.javascript,
mathml: compatData.mathml,
svg: compatData.svg,
webdriver: compatData.webdriver,
webextensions: compatData.webextensions
}
fs.writeFile(
path.resolve(
__dirname,
'..',
'public',
'data.json'
),
JSON.stringify(payload, null, 2),
err => {
if (err) {
console.error(err)
// javascript: compatData.javascript,
// mathml: compatData.mathml,
// svg: compatData.svg,
// webdriver: compatData.webdriver,
// webextensions: compatData.webextensions
// }
const payload = {
api: compatData.api,
browsers: compatData.browsers,
css: compatData.css,
html: compatData.html,
http: compatData.http,
javascript: compatData.javascript,
mathml: compatData.mathml,
svg: compatData.svg,
webdriver: compatData.webdriver,
webextensions: compatData.webextensions
}
fs.writeFile(
path.resolve(
__dirname,
'..',
'public',
'data.json'
),
JSON.stringify(payload, null, 2),
err => {
if (err) {
console.error(err)
}
// mathml: compatData.mathml,
// svg: compatData.svg,
// webdriver: compatData.webdriver,
// webextensions: compatData.webextensions
// }
const payload = {
api: compatData.api,
browsers: compatData.browsers,
css: compatData.css,
html: compatData.html,
http: compatData.http,
javascript: compatData.javascript,
mathml: compatData.mathml,
svg: compatData.svg,
webdriver: compatData.webdriver,
webextensions: compatData.webextensions
}
fs.writeFile(
path.resolve(
__dirname,
'..',
'public',
'data.json'
),
JSON.stringify(payload, null, 2),
err => {
if (err) {
console.error(err)
}
}
// browsers: compatData.browsers,
// css: compatData.css,
// html: compatData.html,
// http: compatData.http,
// javascript: compatData.javascript,
// mathml: compatData.mathml,
// svg: compatData.svg,
// webdriver: compatData.webdriver,
// webextensions: compatData.webextensions
// }
const payload = {
api: compatData.api,
browsers: compatData.browsers,
css: compatData.css,
html: compatData.html,
http: compatData.http,
javascript: compatData.javascript,
mathml: compatData.mathml,
svg: compatData.svg,
webdriver: compatData.webdriver,
webextensions: compatData.webextensions
}
fs.writeFile(
path.resolve(
__dirname,
'..',
'public',
'data.json'
),
JSON.stringify(payload, null, 2),
* Strip browser details down to name only.
*
* @param {bcd.Browsers} browsers
*/
const removeBrowserDetails = (browsers) => {
for (const browserName of Object.keys(browsers)) {
browsers[browserName] = /** @type {any} */({ name: browsers[browserName].name });
}
};
// Remove unnecessary data
const data = {
browsers: mdn.browsers,
css: mdn.css,
html: mdn.html
};
// TODO: drop `browsers` after `hint-compat-api` uses new util methods.
removeBrowserDetails(data.browsers);
removeFeatures(data.css);
removeFeatures(data.html);
const code = `/* eslint-disable */
import { Browsers, PrimaryIdentifier } from 'mdn-browser-compat-data/types';
type Data = {
browsers: Browsers;
css: PrimaryIdentifier;
html: PrimaryIdentifier;
}
// api: compatData.api,
// browsers: compatData.browsers,
// css: compatData.css,
// html: compatData.html,
// http: compatData.http,
// javascript: compatData.javascript,
// mathml: compatData.mathml,
// svg: compatData.svg,
// webdriver: compatData.webdriver,
// webextensions: compatData.webextensions
// }
const payload = {
api: compatData.api,
browsers: compatData.browsers,
css: compatData.css,
html: compatData.html,
http: compatData.http,
javascript: compatData.javascript,
mathml: compatData.mathml,
svg: compatData.svg,
webdriver: compatData.webdriver,
webextensions: compatData.webextensions
}
fs.writeFile(
path.resolve(
__dirname,
'..',
'public',
'data.json'
),
/**
* Strip browser details down to name only.
*
* @param {bcd.Browsers} browsers
*/
const removeBrowserDetails = (browsers) => {
for (const browserName of Object.keys(browsers)) {
browsers[browserName] = /** @type {any} */({ name: browsers[browserName].name });
}
};
// Remove unnecessary data
const data = {
browsers: mdn.browsers,
css: mdn.css,
html: mdn.html
};
// TODO: drop `browsers` after `hint-compat-api` uses new util methods.
removeBrowserDetails(data.browsers);
removeFeatures(data.css);
removeFeatures(data.html);
const code = `/* eslint-disable */
import { Browsers, PrimaryIdentifier } from 'mdn-browser-compat-data/types';
type Data = {
browsers: Browsers;
css: PrimaryIdentifier;
html: PrimaryIdentifier;
}