Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zloirock/core-js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.20.2
Choose a base ref
...
head repository: zloirock/core-js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.20.3
Choose a head ref
  • 18 commits
  • 30 files changed
  • 2 contributors

Commits on Jan 2, 2022

  1. fix a typo and rephrase

    zloirock committed Jan 2, 2022

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    844d525 View commit details

Commits on Jan 3, 2022

  1. update dependencies

    zloirock committed Jan 3, 2022

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    da5b543 View commit details

Commits on Jan 4, 2022

  1. Corrections (#1033)

    ritikbanger authored Jan 4, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6c6340f View commit details
  2. Copy the full SHA
    328f48a View commit details

Commits on Jan 5, 2022

  1. improve CONTRIBUTING.md

    zloirock committed Jan 5, 2022
    Copy the full SHA
    04a2c8a View commit details
  2. improve CONTRIBUTING.md

    zloirock committed Jan 5, 2022
    Copy the full SHA
    ca3cbdc View commit details
  3. Copy the full SHA
    ce0392b View commit details
  4. improve CONTRIBUTING.md

    zloirock committed Jan 5, 2022
    Copy the full SHA
    cceecb7 View commit details
  5. Copy the full SHA
    b4534bd View commit details

Commits on Jan 6, 2022

  1. Copy the full SHA
    1a3c1ca View commit details

Commits on Jan 7, 2022

  1. update the changelog

    zloirock committed Jan 7, 2022
    Copy the full SHA
    18cb22b View commit details

Commits on Jan 8, 2022

  1. update dependencies

    zloirock committed Jan 8, 2022
    Copy the full SHA
    336eae4 View commit details

Commits on Jan 9, 2022

  1. Copy the full SHA
    4f12ebe View commit details

Commits on Jan 10, 2022

  1. Copy the full SHA
    f00f917 View commit details

Commits on Jan 11, 2022

  1. update dependencies

    zloirock committed Jan 11, 2022
    Copy the full SHA
    d85dd8c View commit details

Commits on Jan 13, 2022

  1. update dependencies

    zloirock committed Jan 13, 2022
    Copy the full SHA
    9ef0526 View commit details

Commits on Jan 15, 2022

  1. update the changelog

    zloirock committed Jan 15, 2022
    Copy the full SHA
    61d15fd View commit details
  2. 3.20.3

    zloirock committed Jan 15, 2022
    Copy the full SHA
    4bcdaf8 View commit details
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,11 @@
##### Unreleased
- Nothing

##### 3.20.3 - 2022.01.15
- Detects and replaces broken third-party `Function#bind` polyfills, uses only native `Function#bind` in the internals
- `structuredClone` should throw an error if no arguments passed
- Changed the structure of notes in `__core-js_shared__`

##### 3.20.2 - 2022.01.02
- Added a fix of [a V8 ~ Chrome 36- `Object.{ defineProperty, defineProperties }` bug](https://bugs.chromium.org/p/v8/issues/detail?id=3334), [Babel issue](https://github.com/babel/babel/issues/14056)
- Added fixes of some different `%TypedArray%.prototype.set` bugs, affects modern engines (like Chrome < 95 or Safari < 14.1)
107 changes: 53 additions & 54 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -5,23 +5,33 @@ Contributions are always welcome. If you don't know how you can help, you can ch
## How to add a new polyfill

- The polyfill implementation should be added to the [`packages/core-js/modules`](./packages/core-js/modules) directory.
- Any shared helpers should be added to the [`packages/core-js/internals`](./packages/core-js/internals) directory.
- If the implementation for the `pure` version differs from the global version, add it to [`packages/core-js-pure/override`](./packages/core-js-pure/override) directory. The rest parts of `core-js-pure` will be copied from `core-js` package.
- For export the polyfill, in almost all cases use `internals/export` helper.
- Add feature detection of the polyfill to [`tests/compat/tests.js`](./tests/compat/tests.js) and compatibility data to [`packages/core-js-compat/src/data.mjs`](./packages/core-js-compat/src/data.mjs) and [`packages/core-js-compat/src/modules-by-versions.mjs`](./packages/core-js-compat/src/modules-by-versions.mjs) (this data also used for getting the default list of polyfills at bundling).
- Add it to entry points where it's required: directories [`packages/core-js/features`](./packages/core-js/features), [`packages/core-js/es`](./packages/core-js/es), [`packages/core-js/proposals`](./packages/core-js/proposals), [`packages/core-js/stage`](./packages/core-js/stage) and [`packages/core-js/web`](./packages/core-js/web).
- Shared helpers should be added to the [`packages/core-js/internals`](./packages/core-js/internals) directory. Reuse already existing helpers.
- For export the polyfill, in all common cases use `internals/export` helper. Use something else only if this helper is not applicable - for example, if you want to polyfill accessors.
- If the code of the pure version implementation should significantly differ from the global version (*that's not a frequent situation, in most cases `internals/is-pure` is enough*), you can add it to [`packages/core-js-pure/override`](./packages/core-js-pure/override) directory. The rest parts of `core-js-pure` will be copied from `core-js` package.
- Add the feature detection of the polyfill to [`tests/compat/tests.js`](./tests/compat/tests.js), add the compatibility data to [`packages/core-js-compat/src/data.mjs`](./packages/core-js-compat/src/data.mjs) and the name of the polyfill module to [`packages/core-js-compat/src/modules-by-versions.mjs`](./packages/core-js-compat/src/modules-by-versions.mjs) (this data is also used for getting the default list of polyfills at bundling and generation indexes).
- Add it to entry points where it's required: directories [`packages/core-js/es`](./packages/core-js/es), [`packages/core-js/stable`](./packages/core-js/stable), [`packages/core-js/actual`](./packages/core-js/actual), [`packages/core-js/features`](./packages/core-js/features), [`packages/core-js/proposals`](./packages/core-js/proposals), [`packages/core-js/stage`](./packages/core-js/stage) and [`packages/core-js/web`](./packages/core-js/web).
- Add unit tests to [`tests/tests`](./tests/tests) and [`tests/pure`](./tests/pure).
- Add tests of entry points to [`tests/commonjs.js`](./tests/commonjs.js).
- Add documentation to [README.md](./README.md).
- Make sure that you are following [our coding style](#style-and-standards) and [all tests](#testing) are passed.
- Documentat it in [README.md](./README.md) and [CHANGELOG.md](./CHANGELOG.md).

## How to update `core-js-compat` data

For updating `core-js-compat` data:

- If you want to add new data for a browser, run in this browser `tests/compat/index.html` and you will see what `core-js` modules are required for this browser.
- If you want to add new data for NodeJS, run `tests/compat/node-runner.js` in the required NodeJS version and you will see the results in the console.
- After getting this data, add it to [`packages/core-js-compat/src/data.mjs`](./packages/core-js-compat/src/data.mjs).
- If you want to add new mapping (for example, to add a new iOS Safari version based on Safari or NodeJS based on Chrome), add it to [`packages/core-js-compat/src/mapping.mjs`](./packages/core-js-compat/src/mapping.mjs).

## Style and standards

The coding style should follow our [`.eslintrc`](./.eslintrc.js). You can test it by calling [`npm run lint`](#testing). Different places have different syntax and standard library limitations:
- Polyfill implementations should use only ES3 syntax and standard library. Polyfills should not use another polyfill from the global namespace.
- In unit tests should be used modern syntax with our [minimalistic Babel config](./babel.config.js). Unit tests for the `pure` version should not use any modern standard library features.
- In building tools and tests, performed in Node.js, should be used only available in Node.js 4 syntax and standard library.
- Polyfill implementations should use only ES3 syntax and standard library, they should not use other polyfills from the global scope.
- Unit tests should use the modern syntax with our [minimalistic Babel config](./babel.config.js). Unit tests for the pure version should not use any modern standard library features.
- Tools, scripts and tests, performed in NodeJS, should use only the syntax and the standard library available in NodeJS 8.

File names should be in the kebab-case. Name of files with polyfills should follow naming convention `namespace.subnamespace-where-required.feature-name`, for example, `esnext.promise.try`. Top-level namespace could be `es` for stable ECMAScript features, `esnext` for ECMAScript proposals and `web` for other web standards.
File names should be in the kebab-case. Name of polyfill modules should follow the naming convention `namespace.subnamespace-where-required.feature-name`, for example, `esnext.set.intersection`. The top-level namespace should be `es` for stable ECMAScript features, `esnext` for ECMAScript proposals and `web` for other web standards.

## Testing

@@ -35,49 +45,38 @@ $ npm run test
```
You can run parts of the test case separately:
- Linting:
```
$ npm run lint
```
- Global version unit tests:
```
$ npm run test-unit-global-standalone
```
- `pure` version unit tests:
```
$ npm run test-unit-pure-standalone
```
- [Promises/A+ test case](https://github.com/promises-aplus/promises-tests):
```
$ npm run test-promises-standalone
```
```
$ npm run lint
```
- The global version unit tests:
```
$ npm run test-unit-global-standalone
```
- The pure version unit tests:
```
$ npm run test-unit-pure-standalone
```
- [Promises/A+](https://github.com/promises-aplus/promises-tests) and [ES6 `Promise`](https://github.com/promises-es6/promises-es6) test cases:
```
$ npm run test-promises-standalone
```
- [ECMAScript `Observable` test case](https://github.com/tc39/proposal-observable):
```
$ npm run test-observables-standalone
```
```
$ npm run test-observables-standalone
```
- CommonJS entry points tests:
```
$ npm run test-entries-standalone
```
If you want to run tests in a certain browser at first you should build packages and test bundles:
```
$ npm run build
```
- For running the global version of the unit test case use this file:
```
tests/tests.html
```
- For running the pure version of the unit test case use this file:
```
tests/pure.html
```

## Updating `core-js-compat` data

For updating `core-js-compat` data:

- Clone `core-js` repo.
- If you wanna add new data for a browser, run in this browser `tests/compat/index.html` and you will see which `core-js` modules required for this browser.
- If you wanna add new data for Node.js, run `tests/compat/node-runner.js` in required Node.js version and you will see results in the console.
- After getting this data, add it to [`packages/core-js-compat/src/data.mjs`](./packages/core-js-compat/src/data.mjs).
- If you wanna add new mapping (for example, add a new iOS Safari version based on Safari or Node.js based on Chrome), add it to [`packages/core-js-compat/src/mapping.mjs`](./packages/core-js-compat/src/mapping.mjs).
- Add a pull request to `core-js` repo.
```
$ npm run test-entries-standalone
```
- If you want to run tests in a certain browser, at first, you should build packages and test bundles:
```
$ npm run bundle-standalone
```
- For running the global version of the unit test case, use this file:
```
tests/tests.html
```
- For running the pure version of the unit test case, use this file:
```
tests/pure.html
```
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -175,14 +175,14 @@ queueMicrotask(() => console.log('called as microtask'));
### Installation:[](#index)
```
// global version
npm install --save core-js@3.20.2
npm install --save core-js@3.20.3
// version without global namespace pollution
npm install --save core-js-pure@3.20.2
npm install --save core-js-pure@3.20.3
// bundled global version
npm install --save core-js-bundle@3.20.2
npm install --save core-js-bundle@3.20.3
```

Already bundled version of `core-js` [on CDN](https://unpkg.com/core-js-bundle@3.20.2) ([minified version](https://unpkg.com/core-js-bundle@3.20.2/minified.js)).
Already bundled version of `core-js` [on CDN](https://unpkg.com/core-js-bundle@3.20.3) ([minified version](https://unpkg.com/core-js-bundle@3.20.3/minified.js)).

### `postinstall` message[](#index)
The `core-js` project needs your help, so the package shows a message about it after installation. If it causes problems for you, you can disable it:
2 changes: 1 addition & 1 deletion deno/corejs/README.md
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@

*Example*:
```js
import 'https://deno.land/x/corejs@v3.20.2/index.js'; // <- at the top of your entry point
import 'https://deno.land/x/corejs@v3.20.3/index.js'; // <- at the top of your entry point

Object.hasOwn({ foo: 42 }, 'foo'); // => true

Loading