Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(data => {
this.config = TOML.parse(data);
// Each internal polyfill needs to target all supported browsers at all versions.
if (this.path.relative.startsWith('_')) {
const supportedBrowsers = Object.keys(UA.getBaselines()).sort((a, b) => a.localeCompare(b));
if (!supportedBrowsers.every(browser => this.config.browsers[browser] === "*")){
const browserSupport = {};
supportedBrowsers.forEach(browser => browserSupport[browser] = "*");
throw new Error("Internal polyfill called " + this.name + " is not targeting all supported browsers correctly. It should be: \n" + TOML.stringify(browserSupport));
}
}
this.config.detectSource = '';
this.config.baseDir = this.path.relative;
if ('licence' in this.config) {
throw new Error(`Incorrect spelling of license property in ${this.name}`);
}
this.config.hasTests = fs.existsSync(path.join(this.path.absolute, 'tests.js'));
this.config.isTestable = !('test' in this.config && 'ci' in this.config.test && this.config.test.ci === false);
"use strict";
const toposort = require("toposort").array;
const createAliasResolver = require("./aliases");
const UA = require('@financial-times/polyfill-useragent-normaliser');
const sources = require("./sources");
const appVersion = require("../package.json").version;
const streamFromPromise = require("stream-from-promise");
const streamFromString = require("from2-string");
const mergeStream = require("merge2");
const streamToString = require("stream-to-string");
const normalizeUserAgent = UA.normalize;
const LRUCache = require('mnemonist/lru-cache');
const cache = new LRUCache(1000);
module.exports = {
listAliases,
listAllPolyfills,
describePolyfill,
getOptions,
getPolyfills,
getPolyfillString,
normalizeUserAgent
};
/**
* Get a list of all the aliases which exist within the collection of polyfill sources.
* @returns {Promise} A promise which resolves with an array of all the aliases within the collection.
"use strict";
module.exports = {
supportedBrowsers: Object.entries(require("@financial-times/polyfill-useragent-normaliser/data.json").baselineVersions).map(([browser, version]) => {
switch (browser) {
case "ie": {
browser = "Internet Explorer";
break;
}
case "ie_mob": {
browser = "Internet Explorer Mobile";
break;
}
case "chrome": {
browser = "Chrome";
break;
}
case "safari": {
browser = "Safari";
break;