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.22.3
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.22.4
Choose a head ref

Commits on Apr 29, 2022

  1. update dependencies

    zloirock committed Apr 29, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    49ad2ac View commit details
  2. 42

    - Ensured proper `.length` of polyfilled functions even in compressed code
    - Ensured proper `.name` of polyfilled accessors
    - Ensured proper source / `ToString` conversion of polyfilled accessors
    - Refactoring
    zloirock committed Apr 29, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    ba6ea46 View commit details

Commits on Apr 30, 2022

  1. update dependencies

    zloirock committed Apr 30, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    b0d50a3 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    f8482ae View commit details

Commits on May 1, 2022

  1. Update usage.mjs

    Fixed a problem: Insecure file download over HTTP.
    ImanSharaf authored May 1, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    4aaf69b View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    d23809e View commit details
  3. actualize Rhino compat data

    zloirock committed May 1, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    5bf5188 View commit details
  4. actualize Rhino compat data

    zloirock committed May 1, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    f788820 View commit details
  5. Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    468e18f View commit details
  6. fix a typo in docs

    zloirock committed May 1, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    kostasrim Kostas Kyrimis
    Copy the full SHA
    02c82ab View commit details
  7. Copy the full SHA
    5380564 View commit details

Commits on May 2, 2022

  1. Copy the full SHA
    256a143 View commit details
  2. add a note

    zloirock committed May 2, 2022
    Copy the full SHA
    ba77390 View commit details
  3. some stylistic changes

    zloirock committed May 2, 2022
    Copy the full SHA
    d411956 View commit details
  4. Copy the full SHA
    a4a654b View commit details
  5. on zx, we have minimist

    zloirock committed May 2, 2022
    Copy the full SHA
    318e1db View commit details
  6. add some details

    zloirock committed May 2, 2022
    Copy the full SHA
    12b1a02 View commit details
  7. Copy the full SHA
    c0bf1d6 View commit details
  8. add some docs

    zloirock committed May 2, 2022
    Copy the full SHA
    928b853 View commit details
  9. improve docs

    zloirock committed May 2, 2022
    Copy the full SHA
    ae61bb3 View commit details
  10. improve docs

    zloirock committed May 2, 2022
    Copy the full SHA
    01ea350 View commit details
  11. Copy the full SHA
    e591ab7 View commit details
  12. reuse the list of ignored in compat data modules, provide some additi…

    …onal data in the source
    zloirock committed May 2, 2022
    Copy the full SHA
    efa5631 View commit details
  13. Copy the full SHA
    47f8920 View commit details
  14. Copy the full SHA
    4c6e83c View commit details
  15. missed nbsp

    zloirock committed May 2, 2022
    Copy the full SHA
    14b2d5e View commit details
  16. 3.22.4

    zloirock committed May 2, 2022
    Copy the full SHA
    6ba79a5 View commit details
Showing with 1,556 additions and 1,388 deletions.
  1. +1 −0 .eslintignore
  2. +2 −0 .gitignore
  3. +7 −0 CHANGELOG.md
  4. +23 −4 CONTRIBUTING.md
  5. +6 −3 README.md
  6. +1 −1 deno/corejs/README.md
  7. +991 −953 deno/corejs/index.js
  8. +1 −1 lerna.json
  9. +13 −10 package.json
  10. +3 −3 packages/core-js-builder/package.json
  11. +1 −1 packages/core-js-bundle/package.json
  12. +1 −1 packages/core-js-compat/package.json
  13. +69 −48 packages/core-js-compat/src/data.mjs
  14. +5 −0 packages/core-js-pure/override/internals/define-built-in-accessor.js
  15. +1 −0 packages/core-js-pure/override/internals/{redefine.js → define-built-in.js}
  16. +2 −2 packages/core-js-pure/override/internals/{redefine-all.js → define-built-ins.js}
  17. +3 −0 packages/core-js-pure/override/internals/make-built-in.js
  18. +1 −1 packages/core-js-pure/package.json
  19. +4 −4 packages/core-js/internals/array-buffer-view-core.js
  20. +3 −3 packages/core-js/internals/array-buffer.js
  21. +2 −2 packages/core-js/internals/async-from-sync-iterator.js
  22. +2 −2 packages/core-js/internals/async-iterator-create-proxy.js
  23. +2 −2 packages/core-js/internals/async-iterator-prototype.js
  24. +3 −3 packages/core-js/internals/collection-strong.js
  25. +3 −3 packages/core-js/internals/collection-weak.js
  26. +2 −2 packages/core-js/internals/collection.js
  27. +8 −0 packages/core-js/internals/define-built-in-accessor.js
  28. +25 −0 packages/core-js/internals/define-built-in.js
  29. +6 −0 packages/core-js/internals/define-built-ins.js
  30. +4 −4 packages/core-js/internals/define-iterator.js
  31. +2 −3 packages/core-js/internals/export.js
  32. +3 −3 packages/core-js/internals/fix-regexp-well-known-symbol-logic.js
  33. +2 −2 packages/core-js/internals/iterator-create-proxy.js
  34. +2 −2 packages/core-js/internals/iterators-core.js
  35. +40 −0 packages/core-js/internals/make-built-in.js
  36. +0 −6 packages/core-js/internals/redefine-all.js
  37. +0 −46 packages/core-js/internals/redefine.js
  38. +2 −2 packages/core-js/internals/shared.js
  39. +3 −3 packages/core-js/internals/symbol-define-to-primitive.js
  40. +1 −1 packages/core-js/modules/es.aggregate-error.cause.js
  41. +1 −1 packages/core-js/modules/es.array.concat.js
  42. +1 −1 packages/core-js/modules/es.date.to-json.js
  43. +2 −2 packages/core-js/modules/es.date.to-primitive.js
  44. +2 −2 packages/core-js/modules/es.date.to-string.js
  45. +2 −2 packages/core-js/modules/es.error.cause.js
  46. +2 −2 packages/core-js/modules/es.error.to-string.js
  47. +3 −2 packages/core-js/modules/es.function.has-instance.js
  48. +1 −1 packages/core-js/modules/es.json.stringify.js
  49. +1 −1 packages/core-js/modules/es.math.hypot.js
  50. +2 −2 packages/core-js/modules/es.number.constructor.js
  51. +1 −1 packages/core-js/modules/es.object.assign.js
  52. +2 −2 packages/core-js/modules/es.object.to-string.js
  53. +2 −2 packages/core-js/modules/es.promise.catch.js
  54. +16 −20 packages/core-js/modules/es.promise.constructor.js
  55. +2 −2 packages/core-js/modules/es.promise.finally.js
  56. +2 −2 packages/core-js/modules/es.regexp.constructor.js
  57. +3 −3 packages/core-js/modules/es.regexp.dot-all.js
  58. +2 −2 packages/core-js/modules/es.regexp.flags.js
  59. +3 −3 packages/core-js/modules/es.regexp.sticky.js
  60. +2 −2 packages/core-js/modules/es.regexp.to-string.js
  61. +1 −1 packages/core-js/modules/es.string.from-code-point.js
  62. +2 −2 packages/core-js/modules/es.string.match-all.js
  63. +4 −4 packages/core-js/modules/es.symbol.constructor.js
  64. +2 −2 packages/core-js/modules/es.weak-map.constructor.js
  65. +2 −2 packages/core-js/modules/esnext.array.last-index.js
  66. +2 −2 packages/core-js/modules/esnext.array.last-item.js
  67. +1 −1 packages/core-js/modules/esnext.array.to-spliced.js
  68. +1 −1 packages/core-js/modules/esnext.map.merge.js
  69. +11 −11 packages/core-js/modules/esnext.observable.constructor.js
  70. +1 −1 packages/core-js/modules/esnext.typed-array.to-spliced.js
  71. +9 −9 packages/core-js/modules/web.dom-exception.constructor.js
  72. +5 −5 packages/core-js/modules/web.url-search-params.constructor.js
  73. +42 −44 packages/core-js/modules/web.url.constructor.js
  74. +1 −1 packages/core-js/package.json
  75. +14 −4 scripts/build-compat-data.mjs
  76. +2 −29 scripts/check-compat-tests.mjs
  77. +3 −29 scripts/check-unused-modules.mjs
  78. +1 −1 scripts/usage.mjs
  79. +45 −5 tests/compat/browsers-runner.js
  80. +39 −0 tests/compat/common-runner.js
  81. +6 −20 tests/compat/deno-runner.mjs
  82. +29 −3 tests/compat/index.html
  83. +4 −21 tests/compat/node-runner.js
  84. +7 −0 tests/compat/rhino-prepare.mjs
  85. +6 −0 tests/compat/rhino-runner.js
  86. +14 −14 tests/compat/tests.js
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -4,3 +4,4 @@ node_modules/
/packages/core-js-compat/*.json
/packages/core-js-pure/override/
/tests/bundles/
/tests/compat/compat-data.js
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -39,5 +39,7 @@ node_modules/
/packages/core-js-pure/configurator.js
/packages/core-js-pure/postinstall.js
/tests/bundles/
/tests/compat/*.jar
/tests/compat/compat-data.js
/tests/tests/index.js
/tests/pure/index.js
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@
##### Unreleased
- Nothing

##### 3.22.4 - 2022.05.03
- Ensured proper `.length` of polyfilled functions even in compressed code (excepting some ancient engines)
- Ensured proper `.name` of polyfilled accessors (excepting some ancient engines)
- Ensured proper source / `ToString` conversion of polyfilled accessors
- Actualized Rhino compat data
- Refactoring

##### 3.22.3 - 2022.04.28
- Added a fix for FF99+ `Array.prototype.includes` broken on sparse arrays

27 changes: 23 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -8,23 +8,42 @@ Contributions are always welcome. If you don't know how you can help, you can ch
- 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 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), how to do it [see below](#how-to-update-core-js-compat-data), 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/full`](./packages/core-js/full), [`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).
- 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).
- Document 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 `npm run compat` with the installed required NodeJS version and you will see the results in the console. Use `npm run compat-json` if you want to get the result as JSON.
- If you want to add new data for a browser, run in this browser [`tests/compat/index.html`](http://es6.zloirock.ru/compat/) and you will see what `core-js` modules are required for this browser.
- If you want to add new data for NodeJS, run `npm run compat-node` with the installed required NodeJS version and you will see the results in the console. Use `npm run compat-node-json` if you want to get the result as JSON.
- If you want to add new data for Deno, run `npm run compat-deno` with the installed required Deno version and you will see the results in the console. Use `npm run compat-deno-json` if you want to get the result as JSON.
- If you want to add new data for Rhino, set the required Rhino version in `compat-rhino-prepare` NPM script in [`package.json`](./package.json), run `npm run compat-rhino` 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).

engine | mandatory check | how to run tests | base data inherits from | mapping for a new version
--- | --- | --- | --- | ---
`android` | | browser runner | `chrome` |
`chrome` | features | browser runner | |
`deno` | non-ES features | deno runner | `chrome` (only ES) | required
`edge` | features | browser runner | `ie` (<=18), `chrome` (>=74) |
`electron` | | browser runner | `chrome` | required
`firefox` | features | browser runner | |
`ie` | features | browser runner | |
`ios` | | browser runner | `safari` | required
`node` | non-ES features | node runner | `chrome` (only ES) | required
`opera` | | browser runner | `chrome` (>12) | in case of inconsistency
`opera_mobile` | | browser runner | `opera`, `chrome` | required
`phantom` | | browser runner | `safari` |
`rhino` | features | rhino runner | |
`safari` | features | browser runner | |
`samsung` | | browser runner | `chrome` | required

## 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:
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -176,11 +176,11 @@ queueMicrotask(() => console.log('called as microtask'));
### Installation:[](#index)
```
// global version
npm install --save core-js@3.22.3
npm install --save core-js@3.22.4
// version without global namespace pollution
npm install --save core-js-pure@3.22.3
npm install --save core-js-pure@3.22.4
// bundled global version
npm install --save core-js-bundle@3.22.3
npm install --save core-js-bundle@3.22.4
```

Or you can use `core-js` [from CDN](https://www.jsdelivr.com/package/npm/core-js-bundle).
@@ -336,6 +336,8 @@ var array = Array.of(1, 2, 3);

By default, `@babel/preset-env` with `useBuiltIns: 'usage'` option only polyfills stable features, but you can enable polyfilling of proposals by `proposals` option, as `corejs: { version: '3.22', proposals: true }`.

> **Warning!** In the case of `useBuiltIns: 'usage'`, you should not add `core-js` imports by yourself, they will be added automatically.
#### `@babel/runtime`[](#index)

[`@babel/runtime`](https://babeljs.io/docs/plugins/transform-runtime/) with `corejs: 3` option simplifies work with `core-js-pure`. It automatically replaces usage of modern features from JS standard library to imports from the version of `core-js` without global namespace pollution, so instead of:
@@ -418,6 +420,7 @@ For some cases could be useful to exclude some `core-js` features or generate a
- PhantomJS 1.9+
- NodeJS 0.8+
- Deno 1.0+
- Rhino 1.7.14+

...and it doesn't mean `core-js` will not work in other engines, they just have not been tested.

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.22.3/index.js'; // <- at the top of your entry point
import 'https://deno.land/x/corejs@v3.22.4/index.js'; // <- at the top of your entry point

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

Loading