Socket
Socket
Sign inDemoInstall

core-js-compat

Package Overview
Dependencies
8
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    core-js-compat

core-js compat


Version published
Maintainers
1
Install size
1.95 MB
Created

Package description

What is core-js-compat?

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.

What are core-js-compat's main functionalities?

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' });

Other packages similar to core-js-compat

Changelog

Source

3.19.1 - 2021.11.03

  • Added a workaround for FF26- bug where ArrayBuffers are non-extensible, but Object.isExtensible does not report it:
    • Fixed in Object.{ isExtensible, isSealed, isFrozen } and Reflect.isExtensible
    • Fixed handling of ArrayBuffers as collections keys
  • Fixed Object#toString on AggregateError in IE10-
  • Fixed possible lack of dependencies of WeakMap in IE8-
  • .findLast methods family marked as supported from Chrome 97
  • Fixed inheritance of Electron compat data web. modules
  • Fixed Safari 15.1 compat data (some features were not added)
  • Added iOS Safari 15.1 compat data mapping

Readme

Source

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.

const {
  list,                  // array of required modules
  targets,               // object with targets for each module
} = require('core-js-compat')({
  targets: '> 2.5%',     // browserslist query or object of minimum environment versions to support
  filter: /^(es|web)\./, // optional filter - string-prefix, regexp or list of modules
  version: '3.19',       // used `core-js` version, by default - the latest
});

console.log(targets);
/* =>
{
  'es.symbol.match-all': { ios: '12.2-12.4' },
  'es.array.unscopables.flat': { ios: '12.2-12.4' },
  'es.array.unscopables.flat-map': { ios: '12.2-12.4' },
  'es.math.hypot': { chrome: '77' },
  'es.promise.all-settled': { firefox: '69', ios: '12.2-12.4' },
  'es.promise.finally': { ios: '12.2-12.4' },
  'es.string.match-all': { chrome: '77', firefox: '69', ios: '12.2-12.4' },
  'es.string.replace': { firefox: '69', ios: '12.2-12.4' },
  'es.typed-array.float32-array': { ios: '12.2-12.4' },
  'es.typed-array.float64-array': { ios: '12.2-12.4' },
  'es.typed-array.int8-array': { ios: '12.2-12.4' },
  'es.typed-array.int16-array': { ios: '12.2-12.4' },
  'es.typed-array.int32-array': { ios: '12.2-12.4' },
  'es.typed-array.uint8-array': { ios: '12.2-12.4' },
  'es.typed-array.uint8-clamped-array': { ios: '12.2-12.4' },
  'es.typed-array.uint16-array': { ios: '12.2-12.4' },
  'es.typed-array.uint32-array': { ios: '12.2-12.4' },
  'es.typed-array.from': { ios: '12.2-12.4' },
  'es.typed-array.of': { ios: '12.2-12.4' },
  'web.dom-collections.iterator': { ios: '12.2-12.4' },
  'web.immediate': { chrome: '77', firefox: '69', ios: '12.2-12.4' },
  'web.url': { ios: '12.2-12.4' },
  'web.url.to-json': { ios: '12.2-12.4' },
  'web.url-search-params': { ios: '12.2-12.4' }
}
*/

targets option

targets 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
}

Additional API:

// equals of of the method from the example above
require('core-js-compat/compat')({ targets, filter, version }); // => { list: Array<ModuleName>, targets: { [ModuleName]: { [EngineName]: EngineVersion } } }
// or
require('core-js-compat').compat({ targets, filter, 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.19'); // => Array<ModuleName>
// or
require('core-js-compat').getModulesListForTargetVersion('3.19'); // => Array<ModuleName>

If you want to add new / update data about modules required for target engines, follow this instruction.

FAQs

Last updated on 02 Nov 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc