diff --git a/CHANGELOG.md b/CHANGELOG.md index c6b232457b8b..162843068d36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,13 @@ ## Changelog ##### Unreleased +- Nothing + +##### [3.30.0 - 2023.04.04](https://github.com/zloirock/core-js/releases/tag/v3.30.0) - Added [`URL.canParse` method](https://url.spec.whatwg.org/#dom-url-canparse), [url/763](https://github.com/whatwg/url/pull/763) - [`Set` methods proposal](https://github.com/tc39/proposal-set-methods): - Removed sort from `Set.prototype.intersection`, [March 2023 TC39 meeting](https://github.com/babel/proposals/issues/87#issuecomment-1478610425), [proposal-set-methods/94](https://github.com/tc39/proposal-set-methods/pull/94) -- (Async) Iterator Helpers proposals ([sync](https://github.com/tc39/proposal-iterator-helpers), [async](https://github.com/tc39/proposal-async-iterator-helpers)): - Iterator Helpers proposals ([sync](https://github.com/tc39/proposal-iterator-helpers), [async](https://github.com/tc39/proposal-async-iterator-helpers)): - Validate arguments before opening iterator, [March 2023 TC39 meeting](https://github.com/babel/proposals/issues/87#issuecomment-1478412430), [proposal-iterator-helpers/265](https://github.com/tc39/proposal-iterator-helpers/pull/265) -- (Async) Explicit Resource Management proposals ([sync](https://github.com/tc39/proposal-explicit-resource-management), [async](https://github.com/tc39/proposal-async-explicit-resource-management)): - Explicit Resource Management proposals ([sync](https://github.com/tc39/proposal-explicit-resource-management), [async](https://github.com/tc39/proposal-async-explicit-resource-management)): - `(Async)DisposableStack.prototype.move` marks the original stack as disposed, [#1226](https://github.com/zloirock/core-js/issues/1226) - Some simplifications like [proposal-explicit-resource-management/150](https://github.com/tc39/proposal-explicit-resource-management/pull/150) diff --git a/README.md b/README.md index 4881319d6a94..b5d28d084ef8 100644 --- a/README.md +++ b/README.md @@ -208,11 +208,11 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3]) ### Installation:[⬆](#index) ```sh // global version -npm install --save core-js@3.29.1 +npm install --save core-js@3.30.0 // version without global namespace pollution -npm install --save core-js-pure@3.29.1 +npm install --save core-js-pure@3.30.0 // bundled global version -npm install --save core-js-bundle@3.29.1 +npm install --save core-js-bundle@3.30.0 ``` Or you can use `core-js` [from CDN](https://www.jsdelivr.com/package/npm/core-js-bundle). @@ -309,9 +309,9 @@ import 'regenerator-runtime/runtime'; #### `@babel/preset-env`[⬆](#index) -[`@babel/preset-env`](https://github.com/babel/babel/tree/master/packages/babel-preset-env) has `useBuiltIns` option, which optimizes working with global version of `core-js`. With `useBuiltIns` option, you should also set `corejs` option to used version of `core-js`, like `corejs: '3.29'`. +[`@babel/preset-env`](https://github.com/babel/babel/tree/master/packages/babel-preset-env) has `useBuiltIns` option, which optimizes working with global version of `core-js`. With `useBuiltIns` option, you should also set `corejs` option to used version of `core-js`, like `corejs: '3.30'`. -> **Warning!** Recommended to specify used minor `core-js` version, like `corejs: '3.29'`, instead of `corejs: 3`, since with `corejs: 3` will not be injected modules which were added in minor `core-js` releases. +> **Warning!** Recommended to specify used minor `core-js` version, like `corejs: '3.30'`, instead of `corejs: 3`, since with `corejs: 3` will not be injected modules which were added in minor `core-js` releases. - `useBuiltIns: 'entry'` replaces imports of `core-js` to import only required for a target environment modules. So, for example, ```js @@ -366,7 +366,7 @@ import 'core-js/modules/es.array.of'; 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.29', proposals: true }`. +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.30', proposals: true }`. > **Warning!** In the case of `useBuiltIns: 'usage'`, you should not add `core-js` imports by yourself, they will be added automatically. @@ -402,7 +402,7 @@ Fast JavaScript transpiler `swc` [contains integration with `core-js`](https://s "env": { "targets": "> 0.25%, not dead", "mode": "entry", - "coreJs": "3.29" + "coreJs": "3.30" } } ``` diff --git a/deno/corejs/README.md b/deno/corejs/README.md index c44ccd69b2d9..cf7d1f1eb559 100644 --- a/deno/corejs/README.md +++ b/deno/corejs/README.md @@ -28,7 +28,7 @@ *Example*: ```js -import 'https://deno.land/x/corejs@v3.29.1/index.js'; // <- at the top of your entry point +import 'https://deno.land/x/corejs@v3.30.0/index.js'; // <- at the top of your entry point Object.hasOwn({ foo: 42 }, 'foo'); // => true diff --git a/deno/corejs/index.js b/deno/corejs/index.js index ce7392869820..987fd1f3349c 100644 --- a/deno/corejs/index.js +++ b/deno/corejs/index.js @@ -1,7 +1,7 @@ /** - * core-js 3.29.1 + * core-js 3.30.0 * © 2014-2023 Denis Pushkarev (zloirock.ru) - * license: https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE + * license: https://github.com/zloirock/core-js/blob/v3.30.0/LICENSE * source: https://github.com/zloirock/core-js */ !function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap @@ -278,7 +278,8 @@ __webpack_require__(434); __webpack_require__(435); __webpack_require__(440); __webpack_require__(441); -module.exports = __webpack_require__(442); +__webpack_require__(442); +module.exports = __webpack_require__(443); /***/ }), @@ -943,10 +944,10 @@ var store = __webpack_require__(36); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.29.1', + version: '3.30.0', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)', - license: 'https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE', + license: 'https://github.com/zloirock/core-js/blob/v3.30.0/LICENSE', source: 'https://github.com/zloirock/core-js' }); @@ -5289,12 +5290,11 @@ module.exports = function (value, done) { /***/ (function(module, exports, __webpack_require__) { var aCallable = __webpack_require__(30); -var anObject = __webpack_require__(46); module.exports = function (obj) { return { iterator: obj, - next: aCallable(anObject(obj).next) + next: aCallable(obj.next) }; }; @@ -5322,13 +5322,14 @@ var createMethod = function (TYPE) { var IS_EVERY = TYPE == 2; var IS_SOME = TYPE == 3; return function (object, fn, target) { + anObject(object); + var MAPPING = fn !== undefined; + if (MAPPING || !IS_TO_ARRAY) aCallable(fn); var record = getIteratorDirect(object); var Promise = getBuiltIn('Promise'); var iterator = record.iterator; var next = record.next; var counter = 0; - var MAPPING = fn !== undefined; - if (MAPPING || !IS_TO_ARRAY) aCallable(fn); return new Promise(function (resolve, reject) { var ifAbruptCloseAsyncIterator = function (error) { @@ -6172,7 +6173,11 @@ var HINT = 'async-dispose'; var DISPOSED = 'disposed'; var PENDING = 'pending'; -var ALREADY_DISPOSED = ASYNC_DISPOSABLE_STACK + ' already disposed'; +var getPendingAsyncDisposableStackInternalState = function (stack) { + var internalState = getAsyncDisposableStackInternalState(stack); + if (internalState.state == DISPOSED) throw $ReferenceError(ASYNC_DISPOSABLE_STACK + ' already disposed'); + return internalState; +}; var $AsyncDisposableStack = function AsyncDisposableStack() { setInternalState(anInstance(this, AsyncDisposableStackPrototype), { @@ -6229,14 +6234,11 @@ defineBuiltIns(AsyncDisposableStackPrototype, { }); }, use: function use(value) { - var internalState = getAsyncDisposableStackInternalState(this); - if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED); - addDisposableResource(internalState, value, HINT); + addDisposableResource(getPendingAsyncDisposableStackInternalState(this), value, HINT); return value; }, adopt: function adopt(value, onDispose) { - var internalState = getAsyncDisposableStackInternalState(this); - if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED); + var internalState = getPendingAsyncDisposableStackInternalState(this); aCallable(onDispose); addDisposableResource(internalState, undefined, HINT, function () { onDispose(value); @@ -6244,17 +6246,17 @@ defineBuiltIns(AsyncDisposableStackPrototype, { return value; }, defer: function defer(onDispose) { - var internalState = getAsyncDisposableStackInternalState(this); - if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED); + var internalState = getPendingAsyncDisposableStackInternalState(this); aCallable(onDispose); addDisposableResource(internalState, undefined, HINT, onDispose); }, move: function move() { - var internalState = getAsyncDisposableStackInternalState(this); - if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED); + var internalState = getPendingAsyncDisposableStackInternalState(this); var newAsyncDisposableStack = new $AsyncDisposableStack(); getAsyncDisposableStackInternalState(newAsyncDisposableStack).stack = internalState.stack; internalState.stack = []; + internalState.state = DISPOSED; + if (!DESCRIPTORS) this.disposed = true; return newAsyncDisposableStack; } }); @@ -6308,11 +6310,9 @@ module.exports = function (disposable, V, hint, method) { var resource; if (!method) { if (isNullOrUndefined(V)) return; - resource = createDisposableResource(V, hint); - } else if (isNullOrUndefined(V)) { - resource = createDisposableResource(undefined, hint, method); + resource = createDisposableResource(anObject(V), hint); } else { - resource = createDisposableResource(anObject(V), hint, method); + resource = createDisposableResource(undefined, hint, method); } push(disposable.stack, resource); @@ -6447,8 +6447,10 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { // `AsyncIterator.prototype.map` method // https://github.com/tc39/proposal-iterator-helpers module.exports = function map(mapper) { + anObject(this); + aCallable(mapper); return new AsyncIteratorProxy(getIteratorDirect(this), { - mapper: aCallable(mapper) + mapper: mapper }); }; @@ -6646,8 +6648,10 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { drop: function drop(limit) { + anObject(this); + var remaining = toPositiveInteger(notANaN(+limit)); return new AsyncIteratorProxy(getIteratorDirect(this), { - remaining: toPositiveInteger(notANaN(+limit)) + remaining: remaining }); } }); @@ -6748,8 +6752,10 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { filter: function filter(predicate) { + anObject(this); + aCallable(predicate); return new AsyncIteratorProxy(getIteratorDirect(this), { - predicate: aCallable(predicate) + predicate: predicate }); } }); @@ -6857,8 +6863,10 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { flatMap: function flatMap(mapper) { + anObject(this); + aCallable(mapper); return new AsyncIteratorProxy(getIteratorDirect(this), { - mapper: aCallable(mapper), + mapper: mapper, inner: null }); } @@ -6889,7 +6897,7 @@ module.exports = function from(obj) { method = getIteratorMethod(object); alreadyAsync = false; } - if (isCallable(method)) { + if (method !== undefined) { iterator = call(method, object); } else { iterator = object; @@ -7005,13 +7013,14 @@ var $TypeError = TypeError; // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { reduce: function reduce(reducer /* , initialValue */) { + anObject(this); + aCallable(reducer); var record = getIteratorDirect(this); var iterator = record.iterator; var next = record.next; var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; var counter = 0; - aCallable(reducer); return new Promise(function (resolve, reject) { var ifAbruptCloseAsyncIterator = function (error) { @@ -7117,8 +7126,10 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { take: function take(limit) { + anObject(this); + var remaining = toPositiveInteger(notANaN(+limit)); return new AsyncIteratorProxy(getIteratorDirect(this), { - remaining: toPositiveInteger(notANaN(+limit)) + remaining: remaining }); } }); @@ -8419,7 +8430,11 @@ var HINT = 'sync-dispose'; var DISPOSED = 'disposed'; var PENDING = 'pending'; -var ALREADY_DISPOSED = DISPOSABLE_STACK + ' already disposed'; +var getPendingDisposableStackInternalState = function (stack) { + var internalState = getDisposableStackInternalState(stack); + if (internalState.state == DISPOSED) throw $ReferenceError(DISPOSABLE_STACK + ' already disposed'); + return internalState; +}; var $DisposableStack = function DisposableStack() { setInternalState(anInstance(this, DisposableStackPrototype), { @@ -8461,14 +8476,11 @@ defineBuiltIns(DisposableStackPrototype, { if (thrown) throw suppressed; }, use: function use(value) { - var internalState = getDisposableStackInternalState(this); - if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED); - addDisposableResource(internalState, value, HINT); + addDisposableResource(getPendingDisposableStackInternalState(this), value, HINT); return value; }, adopt: function adopt(value, onDispose) { - var internalState = getDisposableStackInternalState(this); - if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED); + var internalState = getPendingDisposableStackInternalState(this); aCallable(onDispose); addDisposableResource(internalState, undefined, HINT, function () { onDispose(value); @@ -8476,17 +8488,17 @@ defineBuiltIns(DisposableStackPrototype, { return value; }, defer: function defer(onDispose) { - var internalState = getDisposableStackInternalState(this); - if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED); + var internalState = getPendingDisposableStackInternalState(this); aCallable(onDispose); addDisposableResource(internalState, undefined, HINT, onDispose); }, move: function move() { - var internalState = getDisposableStackInternalState(this); - if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED); + var internalState = getPendingDisposableStackInternalState(this); var newDisposableStack = new $DisposableStack(); getDisposableStackInternalState(newDisposableStack).stack = internalState.stack; internalState.stack = []; + internalState.state = DISPOSED; + if (!DESCRIPTORS) this.disposed = true; return newDisposableStack; } }); @@ -8705,8 +8717,10 @@ var IteratorProxy = createIteratorProxy(function () { // `Iterator.prototype.map` method // https://github.com/tc39/proposal-iterator-helpers module.exports = function map(mapper) { + anObject(this); + aCallable(mapper); return new IteratorProxy(getIteratorDirect(this), { - mapper: aCallable(mapper) + mapper: mapper }); }; @@ -8868,8 +8882,10 @@ var IteratorProxy = createIteratorProxy(function () { // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { drop: function drop(limit) { + anObject(this); + var remaining = toPositiveInteger(notANaN(+limit)); return new IteratorProxy(getIteratorDirect(this), { - remaining: toPositiveInteger(notANaN(+limit)) + remaining: remaining }); } }); @@ -8884,15 +8900,17 @@ $({ target: 'Iterator', proto: true, real: true }, { var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); +var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(184); // `Iterator.prototype.every` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { every: function every(predicate) { + anObject(this); + aCallable(predicate); var record = getIteratorDirect(this); var counter = 0; - aCallable(predicate); return !iterate(record, function (value, stop) { if (!predicate(value, counter++)) return stop(); }, { IS_RECORD: true, INTERRUPTED: true }).stopped; @@ -8932,8 +8950,10 @@ var IteratorProxy = createIteratorProxy(function () { // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { filter: function filter(predicate) { + anObject(this); + aCallable(predicate); return new IteratorProxy(getIteratorDirect(this), { - predicate: aCallable(predicate) + predicate: predicate }); } }); @@ -8948,15 +8968,17 @@ $({ target: 'Iterator', proto: true, real: true }, { var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); +var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(184); // `Iterator.prototype.find` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { find: function find(predicate) { + anObject(this); + aCallable(predicate); var record = getIteratorDirect(this); var counter = 0; - aCallable(predicate); return iterate(record, function (value, stop) { if (predicate(value, counter++)) return stop(value); }, { IS_RECORD: true, INTERRUPTED: true }).result; @@ -9005,8 +9027,10 @@ var IteratorProxy = createIteratorProxy(function () { // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { flatMap: function flatMap(mapper) { + anObject(this); + aCallable(mapper); return new IteratorProxy(getIteratorDirect(this), { - mapper: aCallable(mapper), + mapper: mapper, inner: null }); } @@ -9018,7 +9042,6 @@ $({ target: 'Iterator', proto: true, real: true }, { /***/ (function(module, exports, __webpack_require__) { var call = __webpack_require__(7); -var isCallable = __webpack_require__(20); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(184); var getIteratorMethod = __webpack_require__(97); @@ -9026,7 +9049,7 @@ var getIteratorMethod = __webpack_require__(97); module.exports = function (obj) { var object = anObject(obj); var method = getIteratorMethod(object); - return getIteratorDirect(anObject(isCallable(method) ? call(method, object) : object)); + return getIteratorDirect(anObject(method !== undefined ? call(method, object) : object)); }; @@ -9039,15 +9062,17 @@ module.exports = function (obj) { var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); +var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(184); // `Iterator.prototype.forEach` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { forEach: function forEach(fn) { + anObject(this); + aCallable(fn); var record = getIteratorDirect(this); var counter = 0; - aCallable(fn); iterate(record, function (value) { fn(value, counter++); }, { IS_RECORD: true }); @@ -9144,6 +9169,7 @@ $({ target: 'Iterator', stat: true, forced: true }, { var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); +var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(184); var $TypeError = TypeError; @@ -9152,8 +9178,9 @@ var $TypeError = TypeError; // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { reduce: function reduce(reducer /* , initialValue */) { - var record = getIteratorDirect(this); + anObject(this); aCallable(reducer); + var record = getIteratorDirect(this); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; var counter = 0; @@ -9181,15 +9208,17 @@ $({ target: 'Iterator', proto: true, real: true }, { var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); +var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(184); // `Iterator.prototype.some` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { some: function some(predicate) { + anObject(this); + aCallable(predicate); var record = getIteratorDirect(this); var counter = 0; - aCallable(predicate); return iterate(record, function (value, stop) { if (predicate(value, counter++)) return stop(); }, { IS_RECORD: true, INTERRUPTED: true }).stopped; @@ -9227,8 +9256,10 @@ var IteratorProxy = createIteratorProxy(function () { // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { take: function take(limit) { + anObject(this); + var remaining = toPositiveInteger(notANaN(+limit)); return new IteratorProxy(getIteratorDirect(this), { - remaining: toPositiveInteger(notANaN(+limit)) + remaining: remaining }); } }); @@ -9241,6 +9272,7 @@ $({ target: 'Iterator', proto: true, real: true }, { "use strict"; var $ = __webpack_require__(2); +var anObject = __webpack_require__(46); var iterate = __webpack_require__(91); var getIteratorDirect = __webpack_require__(184); @@ -9251,7 +9283,7 @@ var push = [].push; $({ target: 'Iterator', proto: true, real: true }, { toArray: function toArray() { var result = []; - iterate(getIteratorDirect(this), push, { that: result, IS_RECORD: true }); + iterate(getIteratorDirect(anObject(this)), push, { that: result, IS_RECORD: true }); return result; } }); @@ -9264,6 +9296,7 @@ $({ target: 'Iterator', proto: true, real: true }, { "use strict"; var $ = __webpack_require__(2); +var anObject = __webpack_require__(46); var AsyncFromSyncIterator = __webpack_require__(180); var WrapAsyncIterator = __webpack_require__(231); var getIteratorDirect = __webpack_require__(184); @@ -9272,7 +9305,7 @@ var getIteratorDirect = __webpack_require__(184); // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { toAsync: function toAsync() { - return new WrapAsyncIterator(getIteratorDirect(new AsyncFromSyncIterator(getIteratorDirect(this)))); + return new WrapAsyncIterator(getIteratorDirect(new AsyncFromSyncIterator(getIteratorDirect(anObject(this))))); } }); @@ -11328,9 +11361,7 @@ module.exports = { add: uncurryThis(SetPrototype.add), has: uncurryThis(SetPrototype.has), remove: uncurryThis(SetPrototype['delete']), - proto: SetPrototype, - $has: SetPrototype.has, - $keys: SetPrototype.keys + proto: SetPrototype }; @@ -11701,12 +11732,18 @@ $({ target: 'Set', stat: true, forced: true }, { /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(2); +var fails = __webpack_require__(6); var intersection = __webpack_require__(369); var setMethodAcceptSetLike = __webpack_require__(360); +var INCORRECT = !setMethodAcceptSetLike('intersection') || fails(function () { + // eslint-disable-next-line es/no-array-from, es/no-set -- testing + return Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2]))) != '3,2'; +}); + // `Set.prototype.intersection` method // https://github.com/tc39/proposal-set-methods -$({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('intersection') }, { +$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { intersection: intersection }); @@ -11727,12 +11764,6 @@ var iterateSimple = __webpack_require__(205); var Set = SetHelpers.Set; var add = SetHelpers.add; var has = SetHelpers.has; -var nativeHas = SetHelpers.$has; -var nativeKeys = SetHelpers.$keys; - -var isNativeSetRecord = function (record) { - return record.has === nativeHas && record.keys === nativeKeys; -}; // `Set.prototype.intersection` method // https://github.com/tc39/proposal-set-methods @@ -11741,19 +11772,10 @@ module.exports = function intersection(other) { var otherRec = getSetRecord(other); var result = new Set(); - // observable side effects - if (!isNativeSetRecord(otherRec) && size(O) > otherRec.size) { + if (size(O) > otherRec.size) { iterateSimple(otherRec.getIterator(), function (e) { if (has(O, e)) add(result, e); }); - - if (size(result) < 2) return result; - - var disordered = result; - result = new Set(); - iterateSet(O, function (e) { - if (has(disordered, e)) add(result, e); - }); } else { iterateSet(O, function (e) { if (otherRec.includes(e)) add(result, e); @@ -14298,6 +14320,33 @@ $({ global: true, enumerable: true, sham: !PROPER_TRANSFER, forced: FORCED_REPLA /* 442 */ /***/ (function(module, exports, __webpack_require__) { +var $ = __webpack_require__(2); +var getBuiltIn = __webpack_require__(23); +var validateArgumentsLength = __webpack_require__(131); +var toString = __webpack_require__(76); + +var URL = getBuiltIn('URL'); + +// `URL.canParse` method +// https://url.spec.whatwg.org/#dom-url-canparse +$({ target: 'URL', stat: true }, { + canParse: function canParse(url) { + var length = validateArgumentsLength(arguments.length, 1); + var urlString = toString(url); + var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]); + try { + return !!new URL(urlString, base); + } catch (error) { + return false; + } + } +}); + + +/***/ }), +/* 443 */ +/***/ (function(module, exports, __webpack_require__) { + "use strict"; var DESCRIPTORS = __webpack_require__(5); diff --git a/docs/compat/compat-data.js b/docs/compat/compat-data.js index 009e3128895f..e75a2300afbb 100644 --- a/docs/compat/compat-data.js +++ b/docs/compat/compat-data.js @@ -1180,8 +1180,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "es.array.to-sorted": { "android": "110", @@ -1192,8 +1197,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "es.array.to-spliced": { "android": "110", @@ -1204,8 +1214,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "es.array.unscopables.flat": { "android": "73", @@ -1279,8 +1294,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "es.array-buffer.constructor": { "android": "4.4", @@ -3788,6 +3808,7 @@ "bun": "0.1.1", "chrome": "111", "chrome-android": "111", + "deno": "1.32", "edge": "111", "electron": "24.0", "firefox": "78", @@ -5480,8 +5501,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "es.typed-array.to-sorted": { "android": "110", @@ -5492,8 +5518,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "es.typed-array.to-string": { "android": "51", @@ -5525,7 +5556,14 @@ "deno": "1.27", "edge": "110", "electron": "23.0", - "opera": "96" + "ios": "16.4", + "oculus": "26.0", + "opera": "96", + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.4", + "samsung": "21.0" }, "es.unescape": { "android": "3.0", @@ -5658,7 +5696,9 @@ }, "esnext.suppressed-error.constructor": {}, "esnext.array.from-async": { - "bun": "0.3.0" + "bun": "0.3.0", + "ios": "16.4", + "safari": "16.4" }, "esnext.array.at": { "android": "92", @@ -5728,12 +5768,16 @@ "samsung": "18.0" }, "esnext.array.group": { - "bun": "0.1.9" + "bun": "0.1.9", + "ios": "16.4", + "safari": "16.4" }, "esnext.array.group-by": {}, "esnext.array.group-by-to-map": {}, "esnext.array.group-to-map": { - "bun": "0.1.9" + "bun": "0.1.9", + "ios": "16.4", + "safari": "16.4" }, "esnext.array.is-template-object": {}, "esnext.array.last-index": {}, @@ -5747,8 +5791,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "esnext.array.to-sorted": { "android": "110", @@ -5759,8 +5808,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "esnext.array.to-spliced": { "android": "110", @@ -5771,8 +5825,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "esnext.array.unique-by": {}, "esnext.array.with": { @@ -5784,8 +5843,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "esnext.array-buffer.detached": {}, "esnext.array-buffer.transfer": {}, @@ -6019,9 +6083,12 @@ "bun": "0.4.0", "chrome": "111", "chrome-android": "111", + "deno": "1.32", "edge": "111", "electron": "24.0", - "opera": "97" + "ios": "16.4", + "opera": "97", + "safari": "16.4" }, "esnext.string.match-all": { "android": "80", @@ -6072,9 +6139,12 @@ "bun": "0.5.7", "chrome": "111", "chrome-android": "111", + "deno": "1.32", "edge": "111", "electron": "24.0", - "opera": "97" + "ios": "16.4", + "opera": "97", + "safari": "16.4" }, "esnext.symbol.async-dispose": {}, "esnext.symbol.dispose": {}, @@ -6164,8 +6234,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "esnext.typed-array.to-sorted": { "android": "110", @@ -6176,8 +6251,13 @@ "edge": "110", "electron": "23.0", "ios": "16.0", + "oculus": "26.0", "opera": "96", - "safari": "16.0" + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.0", + "samsung": "21.0" }, "esnext.typed-array.to-spliced": {}, "esnext.typed-array.unique-by": {}, @@ -6189,7 +6269,14 @@ "deno": "1.27", "edge": "110", "electron": "23.0", - "opera": "96" + "ios": "16.4", + "oculus": "26.0", + "opera": "96", + "opera-android": "74", + "opera_mobile": "74", + "quest": "26.0", + "safari": "16.4", + "samsung": "21.0" }, "esnext.weak-map.delete-all": {}, "esnext.weak-map.from": {}, @@ -6502,6 +6589,7 @@ "safari": "14.0", "samsung": "9.0" }, + "web.url.can-parse": {}, "web.url.to-json": { "android": "71", "bun": "0.1.1", @@ -6562,5 +6650,10 @@ "safari": "14.0", "samsung": "9.0" }, - "web.url-search-params.size": {} + "web.url-search-params.size": { + "deno": "1.32", + "firefox": "112", + "firefox-android": "112", + "node": "19.8.0" + } } \ No newline at end of file diff --git a/docs/compat/tests.js b/docs/compat/tests.js index d57ee9539e00..2c1facc541e7 100644 --- a/docs/compat/tests.js +++ b/docs/compat/tests.js @@ -1714,7 +1714,7 @@ GLOBAL.tests = { return Set.from; }, 'esnext.set.intersection.v2': function () { - return Set.prototype.intersection; + return Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2]))) == '3,2'; }, 'esnext.set.is-disjoint-from.v2': function () { return Set.prototype.isDisjointFrom; @@ -1936,6 +1936,9 @@ GLOBAL.tests = { // TODO: Remove this module from `core-js@4` since it's split to submodules 'web.timers': TIMERS, 'web.url.constructor': URL_AND_URL_SEARCH_PARAMS_SUPPORT, + 'web.url.can-parse': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { + return URL.canParse; + }], 'web.url.to-json': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { return URL.prototype.toJSON; }], diff --git a/package-lock.json b/package-lock.json index ed061fff3fb8..c4caafec75a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "core-js", - "version": "3.29.1", + "version": "3.30.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "version": "3.29.1", + "version": "3.30.0", "license": "MIT", "workspaces": [ "./packages/*" @@ -6240,7 +6240,7 @@ } }, "packages/core-js": { - "version": "3.29.1", + "version": "3.30.0", "hasInstallScript": true, "license": "MIT", "funding": { @@ -6249,11 +6249,11 @@ } }, "packages/core-js-builder": { - "version": "3.29.1", + "version": "3.30.0", "license": "MIT", "dependencies": { - "core-js": "3.29.1", - "core-js-compat": "3.29.1", + "core-js": "3.30.0", + "core-js-compat": "3.30.0", "mkdirp": ">=0.5.5 <1", "webpack": ">=4.46.0 <5" }, @@ -6266,7 +6266,7 @@ } }, "packages/core-js-bundle": { - "version": "3.29.1", + "version": "3.30.0", "hasInstallScript": true, "license": "MIT", "funding": { @@ -6275,7 +6275,7 @@ } }, "packages/core-js-compat": { - "version": "3.29.1", + "version": "3.30.0", "license": "MIT", "dependencies": { "browserslist": "^4.21.5" @@ -6286,7 +6286,7 @@ } }, "packages/core-js-pure": { - "version": "3.29.1", + "version": "3.30.0", "hasInstallScript": true, "license": "MIT", "funding": { diff --git a/package.json b/package.json index 8976bdcee81a..f93f8e6130d5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "3.29.1", + "version": "3.30.0", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" diff --git a/packages/core-js-builder/package.json b/packages/core-js-builder/package.json index 6e1d348dcb6a..74b0957d0ae3 100644 --- a/packages/core-js-builder/package.json +++ b/packages/core-js-builder/package.json @@ -1,6 +1,6 @@ { "name": "core-js-builder", - "version": "3.29.1", + "version": "3.30.0", "description": "core-js builder", "repository": { "type": "git", @@ -21,8 +21,8 @@ "main": "index.js", "types": "index.d.ts", "dependencies": { - "core-js": "3.29.1", - "core-js-compat": "3.29.1", + "core-js": "3.30.0", + "core-js-compat": "3.30.0", "mkdirp": ">=0.5.5 <1", "webpack": ">=4.46.0 <5" }, diff --git a/packages/core-js-bundle/package.json b/packages/core-js-bundle/package.json index 2e3e2e9a65b3..6dfde577d8f1 100644 --- a/packages/core-js-bundle/package.json +++ b/packages/core-js-bundle/package.json @@ -1,6 +1,6 @@ { "name": "core-js-bundle", - "version": "3.29.1", + "version": "3.30.0", "description": "Standard library", "keywords": [ "ES3", diff --git a/packages/core-js-compat/README.md b/packages/core-js-compat/README.md index 6b88c5d18775..ba53fda33292 100644 --- a/packages/core-js-compat/README.md +++ b/packages/core-js-compat/README.md @@ -27,7 +27,7 @@ const { exclude: [ // optional list / filter of modules to exclude, the signature is similar to `modules` option 'web.atob', ], - version: '3.29', // used `core-js` version, by default - the latest + version: '3.30', // used `core-js` version, by default - the latest inverse: false, // inverse of the result - shows modules that are NOT required for the target environment }); @@ -125,9 +125,9 @@ require('core-js-compat/modules'); // => Array require('core-js-compat').modules; // => Array // the subset of modules which available in the passed `core-js` version: -require('core-js-compat/get-modules-list-for-target-version')('3.29'); // => Array +require('core-js-compat/get-modules-list-for-target-version')('3.30'); // => Array // or -require('core-js-compat').getModulesListForTargetVersion('3.29'); // => Array +require('core-js-compat').getModulesListForTargetVersion('3.30'); // => Array ``` If you wanna help to improve this data, you could take a look at the related section of [`CONTRIBUTING.md`](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md#how-to-update-core-js-compat-data). The visualization of compatibility data and the browser tests runner is available [here](http://zloirock.github.io/core-js/compat/), the example: diff --git a/packages/core-js-compat/package.json b/packages/core-js-compat/package.json index e124d0e55610..94e8ad61af88 100644 --- a/packages/core-js-compat/package.json +++ b/packages/core-js-compat/package.json @@ -1,6 +1,6 @@ { "name": "core-js-compat", - "version": "3.29.1", + "version": "3.30.0", "description": "core-js compat", "repository": { "type": "git", diff --git a/packages/core-js-pure/package.json b/packages/core-js-pure/package.json index 0705db6e6d23..55b2a49bdc6a 100644 --- a/packages/core-js-pure/package.json +++ b/packages/core-js-pure/package.json @@ -1,6 +1,6 @@ { "name": "core-js-pure", - "version": "3.29.1", + "version": "3.30.0", "description": "Standard library", "keywords": [ "ES3", diff --git a/packages/core-js/internals/shared.js b/packages/core-js/internals/shared.js index 8d0c5583f35e..fb7848f1cf57 100644 --- a/packages/core-js/internals/shared.js +++ b/packages/core-js/internals/shared.js @@ -4,9 +4,9 @@ var store = require('../internals/shared-store'); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.29.1', + version: '3.30.0', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)', - license: 'https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE', + license: 'https://github.com/zloirock/core-js/blob/v3.30.0/LICENSE', source: 'https://github.com/zloirock/core-js' }); diff --git a/packages/core-js/package.json b/packages/core-js/package.json index a2de433d8bc0..451af323edc4 100644 --- a/packages/core-js/package.json +++ b/packages/core-js/package.json @@ -1,6 +1,6 @@ { "name": "core-js", - "version": "3.29.1", + "version": "3.30.0", "description": "Standard library", "keywords": [ "ES3",