Skip to content

Commit 7dae270

Browse files
committed
3.19.3
1 parent dde0f68 commit 7dae270

File tree

12 files changed

+100
-76
lines changed

12 files changed

+100
-76
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Changelog
22
##### Unreleased
3+
- Nothing
4+
5+
##### 3.19.3 - 2021.12.06
36
- Fixed internal slots check in methods of some built-in types, [#1017](https://github.com/zloirock/core-js/issues/1017)
47
- Fixed `URLSearchParams` iterator `.next` that should be enumerable [by the spec](https://webidl.spec.whatwg.org/#es-iterator-prototype-object)
58
- Refactored `Subscription`

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ Promise.resolve(32).then(x => console.log(x)); // => 32
140140
### Installation:[](#index)
141141
```
142142
// global version
143-
npm install --save [email protected].2
143+
npm install --save [email protected].3
144144
// version without global namespace pollution
145-
npm install --save [email protected].2
145+
npm install --save [email protected].3
146146
// bundled global version
147-
npm install --save [email protected].2
147+
npm install --save [email protected].3
148148
```
149149

150-
Already bundled version of `core-js` [on CDN](https://unpkg.com/[email protected].2) ([minified version](https://unpkg.com/[email protected].2/minified.js)).
150+
Already bundled version of `core-js` [on CDN](https://unpkg.com/[email protected].3) ([minified version](https://unpkg.com/[email protected].3/minified.js)).
151151

152152
### `postinstall` message[](#index)
153153
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:

deno/corejs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
*Example*:
2626
```js
27-
import 'https://deno.land/x/[email protected].2/index.js'; // <- at the top of your entry point
27+
import 'https://deno.land/x/[email protected].3/index.js'; // <- at the top of your entry point
2828

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

deno/corejs/index.js

+82-61
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* core-js 3.19.2
2+
* core-js 3.19.3
33
* https://github.com/zloirock/core-js
44
* License: http://rock.mit-license.org
55
* © 2021 Denis Pushkarev (zloirock.ru)
@@ -847,7 +847,7 @@ var store = __webpack_require__(33);
847847
(module.exports = function (key, value) {
848848
return store[key] || (store[key] = value !== undefined ? value : {});
849849
})('versions', []).push({
850-
version: '3.19.2',
850+
version: '3.19.3',
851851
mode: IS_PURE ? 'pure' : 'global',
852852
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
853853
});
@@ -2807,8 +2807,9 @@ var AsyncIteratorPrototype = __webpack_require__(109);
28072807

28082808
var Promise = getBuiltIn('Promise');
28092809

2810+
var ASYNC_FROM_SYNC_ITERATOR = 'AsyncFromSyncIterator';
28102811
var setInternalState = InternalStateModule.set;
2811-
var getInternalState = InternalStateModule.get;
2812+
var getInternalState = InternalStateModule.getterFor(ASYNC_FROM_SYNC_ITERATOR);
28122813

28132814
var asyncFromSyncIteratorContinuation = function (result, resolve, reject) {
28142815
var done = result.done;
@@ -2819,6 +2820,7 @@ var asyncFromSyncIteratorContinuation = function (result, resolve, reject) {
28192820

28202821
var AsyncFromSyncIterator = function AsyncIterator(iterator) {
28212822
setInternalState(this, {
2823+
type: ASYNC_FROM_SYNC_ITERATOR,
28222824
iterator: anObject(iterator),
28232825
next: iterator.next
28242826
});
@@ -3629,13 +3631,15 @@ var AsyncIteratorPrototype = __webpack_require__(109);
36293631

36303632
var Promise = getBuiltIn('Promise');
36313633

3634+
var ASYNC_ITERATOR_PROXY = 'AsyncIteratorProxy';
36323635
var setInternalState = InternalStateModule.set;
3633-
var getInternalState = InternalStateModule.get;
3636+
var getInternalState = InternalStateModule.getterFor(ASYNC_ITERATOR_PROXY);
36343637

36353638
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
36363639

36373640
module.exports = function (nextHandler, IS_ITERATOR) {
36383641
var AsyncIteratorProxy = function AsyncIterator(state) {
3642+
state.type = ASYNC_ITERATOR_PROXY;
36393643
state.next = aCallable(state.iterator.next);
36403644
state.done = false;
36413645
state.ignoreArgument = !IS_ITERATOR;
@@ -4285,9 +4289,9 @@ var Iterators = __webpack_require__(77);
42854289

42864290
var returnThis = function () { return this; };
42874291

4288-
module.exports = function (IteratorConstructor, NAME, next) {
4292+
module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
42894293
var TO_STRING_TAG = NAME + ' Iterator';
4290-
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
4294+
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
42914295
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
42924296
Iterators[TO_STRING_TAG] = returnThis;
42934297
return IteratorConstructor;
@@ -5467,13 +5471,15 @@ var InternalStateModule = __webpack_require__(45);
54675471
var getMethod = __webpack_require__(26);
54685472
var IteratorPrototype = __webpack_require__(149).IteratorPrototype;
54695473

5474+
var ITERATOR_PROXY = 'IteratorProxy';
54705475
var setInternalState = InternalStateModule.set;
5471-
var getInternalState = InternalStateModule.get;
5476+
var getInternalState = InternalStateModule.getterFor(ITERATOR_PROXY);
54725477

54735478
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
54745479

54755480
module.exports = function (nextHandler, IS_ITERATOR) {
54765481
var IteratorProxy = function Iterator(state) {
5482+
state.type = ITERATOR_PROXY;
54775483
state.next = aCallable(state.iterator.next);
54785484
state.done = false;
54795485
state.ignoreArg = !IS_ITERATOR;
@@ -6932,51 +6938,60 @@ var hostReportErrors = __webpack_require__(228);
69326938
var wellKnownSymbol = __webpack_require__(30);
69336939
var InternalStateModule = __webpack_require__(45);
69346940

6935-
var OBSERVABLE = wellKnownSymbol('observable');
6936-
var getInternalState = InternalStateModule.get;
6941+
var $$OBSERVABLE = wellKnownSymbol('observable');
6942+
var OBSERVABLE = 'Observable';
6943+
var SUBSCRIPTION = 'Subscription';
6944+
var SUBSCRIPTION_OBSERVER = 'SubscriptionObserver';
6945+
var getterFor = InternalStateModule.getterFor;
69376946
var setInternalState = InternalStateModule.set;
6947+
var getObservableInternalState = getterFor(OBSERVABLE);
6948+
var getSubscriptionInternalState = getterFor(SUBSCRIPTION);
6949+
var getSubscriptionObserverInternalState = getterFor(SUBSCRIPTION_OBSERVER);
69386950
var Array = global.Array;
69396951

6940-
var cleanupSubscription = function (subscriptionState) {
6941-
var cleanup = subscriptionState.cleanup;
6942-
if (cleanup) {
6943-
subscriptionState.cleanup = undefined;
6944-
try {
6945-
cleanup();
6946-
} catch (error) {
6947-
hostReportErrors(error);
6948-
}
6949-
}
6950-
};
6951-
6952-
var subscriptionClosed = function (subscriptionState) {
6953-
return subscriptionState.observer === undefined;
6952+
var SubscriptionState = function (observer) {
6953+
this.observer = anObject(observer);
6954+
this.cleanup = undefined;
6955+
this.subscriptionObserver = undefined;
69546956
};
69556957

6956-
var close = function (subscriptionState) {
6957-
var subscription = subscriptionState.facade;
6958-
if (!DESCRIPTORS) {
6959-
subscription.closed = true;
6960-
var subscriptionObserver = subscriptionState.subscriptionObserver;
6961-
if (subscriptionObserver) subscriptionObserver.closed = true;
6962-
} subscriptionState.observer = undefined;
6958+
SubscriptionState.prototype = {
6959+
type: SUBSCRIPTION,
6960+
clean: function () {
6961+
var cleanup = this.cleanup;
6962+
if (cleanup) {
6963+
this.cleanup = undefined;
6964+
try {
6965+
cleanup();
6966+
} catch (error) {
6967+
hostReportErrors(error);
6968+
}
6969+
}
6970+
},
6971+
close: function () {
6972+
if (!DESCRIPTORS) {
6973+
var subscription = this.facade;
6974+
var subscriptionObserver = this.subscriptionObserver;
6975+
subscription.closed = true;
6976+
if (subscriptionObserver) subscriptionObserver.closed = true;
6977+
} this.observer = undefined;
6978+
},
6979+
isClosed: function () {
6980+
return this.observer === undefined;
6981+
}
69636982
};
69646983

69656984
var Subscription = function (observer, subscriber) {
6966-
var subscriptionState = setInternalState(this, {
6967-
cleanup: undefined,
6968-
observer: anObject(observer),
6969-
subscriptionObserver: undefined
6970-
});
6985+
var subscriptionState = setInternalState(this, new SubscriptionState(observer));
69716986
var start;
69726987
if (!DESCRIPTORS) this.closed = false;
69736988
try {
69746989
if (start = getMethod(observer, 'start')) call(start, observer, this);
69756990
} catch (error) {
69766991
hostReportErrors(error);
69776992
}
6978-
if (subscriptionClosed(subscriptionState)) return;
6979-
var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(this);
6993+
if (subscriptionState.isClosed()) return;
6994+
var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(subscriptionState);
69806995
try {
69816996
var cleanup = subscriber(subscriptionObserver);
69826997
var subscription = cleanup;
@@ -6986,35 +7001,38 @@ var Subscription = function (observer, subscriber) {
69867001
} catch (error) {
69877002
subscriptionObserver.error(error);
69887003
return;
6989-
} if (subscriptionClosed(subscriptionState)) cleanupSubscription(subscriptionState);
7004+
} if (subscriptionState.isClosed()) subscriptionState.clean();
69907005
};
69917006

69927007
Subscription.prototype = redefineAll({}, {
69937008
unsubscribe: function unsubscribe() {
6994-
var subscriptionState = getInternalState(this);
6995-
if (!subscriptionClosed(subscriptionState)) {
6996-
close(subscriptionState);
6997-
cleanupSubscription(subscriptionState);
7009+
var subscriptionState = getSubscriptionInternalState(this);
7010+
if (!subscriptionState.isClosed()) {
7011+
subscriptionState.close();
7012+
subscriptionState.clean();
69987013
}
69997014
}
70007015
});
70017016

70027017
if (DESCRIPTORS) defineProperty(Subscription.prototype, 'closed', {
70037018
configurable: true,
70047019
get: function () {
7005-
return subscriptionClosed(getInternalState(this));
7020+
return getSubscriptionInternalState(this).isClosed();
70067021
}
70077022
});
70087023

7009-
var SubscriptionObserver = function (subscription) {
7010-
setInternalState(this, { subscription: subscription });
7024+
var SubscriptionObserver = function (subscriptionState) {
7025+
setInternalState(this, {
7026+
type: SUBSCRIPTION_OBSERVER,
7027+
subscriptionState: subscriptionState
7028+
});
70117029
if (!DESCRIPTORS) this.closed = false;
70127030
};
70137031

70147032
SubscriptionObserver.prototype = redefineAll({}, {
70157033
next: function next(value) {
7016-
var subscriptionState = getInternalState(getInternalState(this).subscription);
7017-
if (!subscriptionClosed(subscriptionState)) {
7034+
var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState;
7035+
if (!subscriptionState.isClosed()) {
70187036
var observer = subscriptionState.observer;
70197037
try {
70207038
var nextMethod = getMethod(observer, 'next');
@@ -7025,44 +7043,47 @@ SubscriptionObserver.prototype = redefineAll({}, {
70257043
}
70267044
},
70277045
error: function error(value) {
7028-
var subscriptionState = getInternalState(getInternalState(this).subscription);
7029-
if (!subscriptionClosed(subscriptionState)) {
7046+
var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState;
7047+
if (!subscriptionState.isClosed()) {
70307048
var observer = subscriptionState.observer;
7031-
close(subscriptionState);
7049+
subscriptionState.close();
70327050
try {
70337051
var errorMethod = getMethod(observer, 'error');
70347052
if (errorMethod) call(errorMethod, observer, value);
70357053
else hostReportErrors(value);
70367054
} catch (err) {
70377055
hostReportErrors(err);
7038-
} cleanupSubscription(subscriptionState);
7056+
} subscriptionState.clean();
70397057
}
70407058
},
70417059
complete: function complete() {
7042-
var subscriptionState = getInternalState(getInternalState(this).subscription);
7043-
if (!subscriptionClosed(subscriptionState)) {
7060+
var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState;
7061+
if (!subscriptionState.isClosed()) {
70447062
var observer = subscriptionState.observer;
7045-
close(subscriptionState);
7063+
subscriptionState.close();
70467064
try {
70477065
var completeMethod = getMethod(observer, 'complete');
70487066
if (completeMethod) call(completeMethod, observer);
70497067
} catch (error) {
70507068
hostReportErrors(error);
7051-
} cleanupSubscription(subscriptionState);
7069+
} subscriptionState.clean();
70527070
}
70537071
}
70547072
});
70557073

70567074
if (DESCRIPTORS) defineProperty(SubscriptionObserver.prototype, 'closed', {
70577075
configurable: true,
70587076
get: function () {
7059-
return subscriptionClosed(getInternalState(getInternalState(this).subscription));
7077+
return getSubscriptionObserverInternalState(this).subscriptionState.isClosed();
70607078
}
70617079
});
70627080

70637081
var $Observable = function Observable(subscriber) {
70647082
anInstance(this, ObservablePrototype);
7065-
setInternalState(this, { subscriber: aCallable(subscriber) });
7083+
setInternalState(this, {
7084+
type: OBSERVABLE,
7085+
subscriber: aCallable(subscriber)
7086+
});
70667087
};
70677088

70687089
var ObservablePrototype = $Observable.prototype;
@@ -7074,14 +7095,14 @@ redefineAll(ObservablePrototype, {
70747095
next: observer,
70757096
error: length > 1 ? arguments[1] : undefined,
70767097
complete: length > 2 ? arguments[2] : undefined
7077-
} : isObject(observer) ? observer : {}, getInternalState(this).subscriber);
7098+
} : isObject(observer) ? observer : {}, getObservableInternalState(this).subscriber);
70787099
}
70797100
});
70807101

70817102
redefineAll($Observable, {
70827103
from: function from(x) {
70837104
var C = isConstructor(this) ? this : $Observable;
7084-
var observableMethod = getMethod(anObject(x), OBSERVABLE);
7105+
var observableMethod = getMethod(anObject(x), $$OBSERVABLE);
70857106
if (observableMethod) {
70867107
var observable = anObject(call(observableMethod, x));
70877108
return observable.constructor === C ? observable : new C(function (observer) {
@@ -7112,13 +7133,13 @@ redefineAll($Observable, {
71127133
}
71137134
});
71147135

7115-
redefine(ObservablePrototype, OBSERVABLE, function () { return this; });
7136+
redefine(ObservablePrototype, $$OBSERVABLE, function () { return this; });
71167137

71177138
$({ global: true }, {
71187139
Observable: $Observable
71197140
});
71207141

7121-
setSpecies('Observable');
7142+
setSpecies(OBSERVABLE);
71227143

71237144

71247145
/***/ }),

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.19.2",
2+
"version": "3.19.3",
33
"packages": [
44
"packages/*"
55
]

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.19.2",
2+
"version": "3.19.3",
33
"devDependencies": {
44
"@babel/cli": "^7.16.0",
55
"@babel/core": "^7.16.0",

packages/core-js-builder/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "core-js-builder",
33
"description": "core-js builder",
4-
"version": "3.19.2",
4+
"version": "3.19.3",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/zloirock/core-js.git",
88
"directory": "packages/core-js-builder"
99
},
1010
"main": "index.js",
1111
"dependencies": {
12-
"core-js": "3.19.2",
13-
"core-js-compat": "3.19.2",
12+
"core-js": "3.19.3",
13+
"core-js-compat": "3.19.3",
1414
"mkdirp": ">=0.5.5 <1",
1515
"webpack": ">=4.46.0 <5"
1616
},

packages/core-js-bundle/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "core-js-bundle",
33
"description": "Standard library",
4-
"version": "3.19.2",
4+
"version": "3.19.3",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/zloirock/core-js.git"

0 commit comments

Comments
 (0)