Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
core-js-compat
Advanced tools
The core-js-compat package provides compatibility data for core-js, which is a modular standard library for JavaScript, including polyfills for ECMAScript up to the latest standards. It is useful for developers who need to know which features are available in core-js for a specific version of a browser or Node.js.
Compatibility Data Retrieval
Retrieve a list of features supported by core-js for a specific environment, such as Chrome 70.
const { list } = require('core-js-compat')({ targets: 'chrome 70' });
Custom Build Generation
Generate a list of core-js modules required to support a specific target, such as Internet Explorer 11, with a specific version of core-js.
const { getModulesListForTargetVersion } = require('core-js-compat');
const modulesList = getModulesListForTargetVersion({ targets: { ie: 11 }, version: '3.6' });
Babel-polyfill is a package that includes Babel transforms and a polyfill that includes a custom regenerator runtime and core-js. It is similar to core-js-compat in that it provides polyfills for ECMAScript features, but it is less modular and is deprecated in favor of directly including core-js and regenerator-runtime.
The es6-shim package provides polyfills for ECMAScript 6 (also known as ECMAScript 2015) features. It is similar to core-js-compat in providing polyfills, but it is focused only on ES6 features and does not provide the modular approach or the compatibility data that core-js-compat offers.
The polyfill-service package by Financial Times provides a service that returns a set of polyfills based on the user-agent string of the browser making the request. It is similar to core-js-compat in that it aims to provide polyfills for compatibility, but it does so as a service rather than a package to include in your project.
core-js-compat
package contains data about the necessity of core-js
modules and API for getting a list of required core-js modules by browserslist query.
import compat from 'core-js-compat';
const {
list, // array of required modules
targets, // object with targets for each module
} = compat({
targets: '> 1%', // browserslist query or object of minimum environment versions to support, see below
modules: [ // optional list / filter of modules - regex, sting or an array of them:
'core-js/actual', // - an entry point
'esnext.array.unique-by', // - a module name (or just a start of a module name)
/^web\./, // - regex that a module name must satisfy
],
exclude: [ // optional list / filter of modules to exclude, the signature is similar to `modules` option
'web.atob',
],
version: '3.22', // used `core-js` version, by default - the latest
});
console.log(targets);
/* =>
{
'es.error.cause': { ios: '14.5-14.8', samsung: '16.0' },
'es.aggregate-error.cause': { ios: '14.5-14.8', samsung: '16.0' },
'es.array.at': { ios: '14.5-14.8' },
'es.object.has-own': { ios: '14.5-14.8', samsung: '16.0' },
'es.string.at-alternative': { ios: '14.5-14.8' },
'es.typed-array.at': { ios: '14.5-14.8' },
'es.typed-array.set': { samsung: '16.0' },
'esnext.array.find-last': { firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.array.find-last-index': { firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.array.group-by': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.array.group-by-to-map': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.array.to-reversed': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.array.to-sorted': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.array.to-spliced': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.array.unique-by': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.array.with': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.typed-array.find-last': { firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.typed-array.find-last-index': { firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.typed-array.to-reversed': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.typed-array.to-sorted': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.typed-array.to-spliced': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'esnext.typed-array.with': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'web.dom-exception.stack': { chrome: '98', edge: '99', ios: '14.5-14.8', samsung: '16.0' },
'web.immediate': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' },
'web.structured-clone': { chrome: '98', edge: '99', firefox: '98', ios: '14.5-14.8', samsung: '16.0' }
}
*/
targets
optiontargets
could be a browserslist
query or a targets object that specifies minimum environment versions to support:
// browserslist query:
'defaults, not IE 11, maintained node versions'
// object:
{
android: '4.0', // Android WebView version
chrome: '38', // Chrome version
deno: '1.12', // Deno version
edge: '13', // Edge version
electron: '5.0', // Electron framework version
firefox: '15', // Firefox version
ie: '8', // Internet Explorer version
ios: '13.0', // iOS Safari version
node: 'current', // NodeJS version, you could use 'current' for set it to currently used
opera: '12', // Opera version
opera_mobile: '7', // Opera Mobile version
phantom: '1.9', // PhantomJS headless browser version
rhino: '1.7.13', // Rhino engine version
safari: '14.0', // Safari version
samsung: '14.0', // Samsung Internet version
esmodules: true, // That option set target to minimum supporting ES Modules versions of all browsers
browsers: '> 0.25%', // Browserslist query or object with target browsers
}
// equals of of the method from the example above
require('core-js-compat/compat')({ targets, modules, version }); // => { list: Array<ModuleName>, targets: { [ModuleName]: { [EngineName]: EngineVersion } } }
// or
require('core-js-compat').compat({ targets, modules, version }); // => { list: Array<ModuleName>, targets: { [ModuleName]: { [EngineName]: EngineVersion } } }
// full compat data:
require('core-js-compat/data'); // => { [ModuleName]: { [EngineName]: EngineVersion } }
// or
require('core-js-compat').data; // => { [ModuleName]: { [EngineName]: EngineVersion } }
// map of modules by `core-js` entry points:
require('core-js-compat/entries'); // => { [EntryPoint]: Array<ModuleName> }
// or
require('core-js-compat').entries; // => { [EntryPoint]: Array<ModuleName> }
// full list of modules:
require('core-js-compat/modules'); // => Array<ModuleName>
// or
require('core-js-compat').modules; // => Array<ModuleName>
// the subset of modules which available in the passed `core-js` version:
require('core-js-compat/get-modules-list-for-target-version')('3.22'); // => Array<ModuleName>
// or
require('core-js-compat').getModulesListForTargetVersion('3.22'); // => Array<ModuleName>
If you want to add new / update data about modules required for target engines, follow this instruction.
Array
by copy proposal:
/actual/
entry points for methods from this proposalArray.prototype.toSpliced
throws a TypeError
instead of RangeError
if the result length is more than MAX_SAFE_INTEGER
, proposal-change-array-by-copy/70atob
/ btoa
fixes:
atob
does not ignore spaces, node/42530atob
does not validate encoding, node/42646/full/
namespace as the replacement for /features/
since it's more descriptive in context of the rest namespaces (/es/
⊆ /stable/
⊆ /actual/
⊆ /full/
)%TypedArray%.prototype.groupBy
was removed from the Array
grouping proposal a long time ago. We can't completely remove this method since it's a breaking change. But this proposal has been promoted to stage 3 - so the proposal should be promoted without this method, this method should not be available in /actual/
entries - but it should be available in early-stage entries to avoid breakage.core-js-compat
-> core-js-builder
-> core-js-bundle
output. That mean that if the output contains, for example, es.object.has-own
, the legacy reference to it, esnext.object.has-own
, no longer added.core-js-builder
and core-js-compat
, now it's modules
and exclude
optionstargets
option of core-js-compat
means that the targets
filter just will not be applied, so the result will contain modules required for all possible engines.stack
property on DOMException
marked as supported from Deno 1.15FAQs
core-js compat
The npm package core-js-compat receives a total of 0 weekly downloads. As such, core-js-compat popularity was classified as not popular.
We found that core-js-compat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.