polyfill-library 4.5.0 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -4,10 +4,10 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- #### [v4.5.0](https://github.com/Financial-Times/polyfill-library/compare/v4.5.0...v4.5.0)
7
+ #### [v4.6.0](https://github.com/Financial-Times/polyfill-library/compare/v4.6.0...v4.6.0)
8
8
 
9
- #### v4.5.0
9
+ #### v4.6.0
10
10
 
11
- > 3 October 2022
11
+ > 13 January 2023
12
12
 
13
- - prepare v4.5.0 [`#1232`](https://github.com/Financial-Times/polyfill-library/pull/1232)
13
+ - prepare 4.6.0 [`#1260`](https://github.com/Financial-Times/polyfill-library/pull/1260)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polyfill-library",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "A polyfill combinator",
5
5
  "main": "lib/index.js",
6
6
  "contributors": [
@@ -98,7 +98,7 @@
98
98
  "eslint-plugin-uncalled-iife": "^1.0.2",
99
99
  "eslint-plugin-unicorn": "^27.0.0",
100
100
  "execa": "^5.0.0",
101
- "express": "^4.17.1",
101
+ "express": "^4.17.3",
102
102
  "fastestsmallesttextencoderdecoder": "1.0.22",
103
103
  "fs-extra": "^9.0.1",
104
104
  "glob": "^7.1.1",
@@ -1 +1 @@
1
- {"dependencies":["fetch","Object.getOwnPropertyDescriptor","Object.setPrototypeOf","Event","Map","Symbol","Symbol.toStringTag","WeakMap"],"license":"MIT","spec":"https://dom.spec.whatwg.org/#interface-abortcontroller","repo":"https://github.com/mysticatea/abort-controller","docs":"https://developer.mozilla.org/en-US/docs/Web/API/AbortController","browsers":{"android":"*","chrome":"4 - 65","edge":"<16","edge_mob":"*","firefox":"2 - 56","firefox_mob":"<64","ie":">=10","ie_mob":">=10","opera":"10 - 52","op_mob":"<47","safari":"3.1 - 12.0","ios_saf":"3.2 - 12.0","samsung_mob":"<9.0"},"install":{"module":"abort-controller","paths":["dist/abort-controller.umd.js"]},"detectSource":"\"AbortController\"in self&&\"function\"==typeof self.AbortController\n","baseDir":"AbortController","hasTests":true,"isTestable":true,"isPublic":true,"size":9029}
1
+ {"dependencies":["fetch","Object.getOwnPropertyDescriptor","Object.setPrototypeOf","Event","Map","Symbol","Symbol.toStringTag","WeakMap"],"license":"MIT","spec":"https://dom.spec.whatwg.org/#interface-abortcontroller","repo":"https://github.com/mysticatea/abort-controller","docs":"https://developer.mozilla.org/en-US/docs/Web/API/AbortController","browsers":{"android":"*","chrome":"4 - 65","edge":"<16","edge_mob":"<16","firefox":"2 - 56","firefox_mob":"<64","ie":">=10","ie_mob":">=10","opera":"10 - 52","op_mob":"<47","safari":"3.1 - 12.0","ios_saf":"3.2 - 12.0","samsung_mob":"<9.0"},"install":{"module":"abort-controller","paths":["dist/abort-controller.umd.js"]},"detectSource":"\"AbortController\"in self&&\"function\"==typeof self.AbortController\n","baseDir":"AbortController","hasTests":true,"isTestable":true,"isPublic":true,"size":9029}
@@ -1 +1 @@
1
- {"aliases":["es2021"],"dependencies":["_ESAbstract.CreateDataPropertyOrThrow","_ESAbstract.IterableToList"],"license":"MIT","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError","browsers":{"android":"*","bb":"*","chrome":"<85","edge":"*","edge_mob":"*","firefox":"<79","firefox_mob":"<79","ie":"*","ie_mob":"*","opera":"<71","op_mob":"<60","op_mini":"*","safari":"<14.0","ios_saf":"<14.0","samsung_mob":"<14.0"},"detectSource":"\"AggregateError\"in self\n","baseDir":"AggregateError","hasTests":true,"isTestable":true,"isPublic":true,"size":485}
1
+ {"aliases":["es2021"],"dependencies":["_ESAbstract.CreateDataPropertyOrThrow","_ESAbstract.CreateMethodProperty","_ESAbstract.IterableToList","_ErrorConstructor"],"license":"MIT","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError","browsers":{"android":"*","bb":"*","chrome":"<85","edge":"*","edge_mob":"*","firefox":"<79","firefox_mob":"<79","ie":"*","ie_mob":"*","opera":"<71","op_mob":"<60","op_mini":"*","safari":"<14.0","ios_saf":"<14.0","samsung_mob":"<14.0"},"detectSource":"\"AggregateError\"in self\n","baseDir":"AggregateError","hasTests":true,"isTestable":true,"isPublic":true,"size":722}
@@ -1 +1 @@
1
- !function(){function r(r,e){var t=void 0===e?new Error:new Error(e);CreateDataPropertyOrThrow(this,"name","AggregateError"),CreateDataPropertyOrThrow(this,"message",t.message),CreateDataPropertyOrThrow(this,"stack",t.stack);var o;if(Array.isArray(r))o=r.slice();else try{o=IterableToList(r)}catch(r){throw new TypeError("Argument is not iterable")}CreateDataPropertyOrThrow(this,"errors",o)}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,self.AggregateError=r}();
1
+ !function(){function r(e,t){if(!(this instanceof r))return new r(e,t);var o=void 0===t?new Error:new Error(t);CreateDataPropertyOrThrow(this,"name","AggregateError"),CreateDataPropertyOrThrow(this,"message",o.message),CreateDataPropertyOrThrow(this,"stack",o.stack);var a;if(Array.isArray(e))a=e.slice();else try{a=IterableToList(e)}catch(r){throw new TypeError("Argument is not iterable")}CreateDataPropertyOrThrow(this,"errors",a)}var e=function(){try{return"c"===new Error("m",{cause:"c"}).cause}catch(r){return!1}}();r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,CreateMethodProperty(self,"AggregateError",r),e&&CreateMethodProperty(self,"AggregateError",_ErrorConstructor("AggregateError"))}();
@@ -1,8 +1,18 @@
1
1
 
2
2
  // AggregateError
3
- /* global CreateDataPropertyOrThrow, IterableToList */
3
+ /* global _ErrorConstructor, CreateDataPropertyOrThrow, CreateMethodProperty, IterableToList */
4
4
  (function () {
5
+ var hasErrorCause = (function () {
6
+ try {
7
+ return new Error('m', { cause: 'c' }).cause === 'c';
8
+ } catch (e) {
9
+ return false;
10
+ }
11
+ })();
12
+
5
13
  function AggregateError (errors, message) {
14
+ if (!(this instanceof AggregateError)) return new AggregateError(errors, message);
15
+
6
16
  var temp = typeof message === 'undefined' ? new Error() : new Error(message);
7
17
 
8
18
  CreateDataPropertyOrThrow(this, 'name', 'AggregateError');
@@ -26,5 +36,10 @@
26
36
  AggregateError.prototype = Object.create(Error.prototype);
27
37
  AggregateError.prototype.constructor = AggregateError;
28
38
 
29
- self.AggregateError = AggregateError;
39
+ CreateMethodProperty(self, 'AggregateError', AggregateError);
40
+
41
+ // If `Error.cause` is available, add it to `AggregateError`
42
+ if (hasErrorCause) {
43
+ CreateMethodProperty(self, 'AggregateError', _ErrorConstructor('AggregateError'));
44
+ }
30
45
  })();
@@ -0,0 +1 @@
1
+ {"aliases":["es2022"],"dependencies":["_ESAbstract.CreateMethodProperty","_ErrorConstructor"],"spec":"https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-installerrorcause","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause","browsers":{"android":"*","bb":"*","chrome":"<93","edge":"*","edge_mob":"*","firefox":"<91","firefox_mob":"<91","ie":"*","ie_mob":"*","opera":"<79","op_mob":"<66","op_mini":"*","safari":"<15.0","ios_saf":"<15.0","samsung_mob":"<17.0"},"detectSource":"(function(){try{return\"c\"===new Error(\"m\",{cause:\"c\"}).cause}catch(r){return!1}})()\n","baseDir":"Error/cause","hasTests":true,"isTestable":true,"isPublic":true,"size":250}
@@ -0,0 +1 @@
1
+ !function(){var r=["Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"];"AggregateError"in self&&r.push("AggregateError");for(var e=0;e<r.length;e++){var o=r[e];CreateMethodProperty(self,o,_ErrorConstructor(o))}}();
@@ -0,0 +1,24 @@
1
+
2
+ // Error.cause
3
+ /* global _ErrorConstructor, CreateMethodProperty */
4
+
5
+ (function () {
6
+ var _errorNames = [
7
+ 'Error',
8
+ 'EvalError',
9
+ 'RangeError',
10
+ 'ReferenceError',
11
+ 'SyntaxError',
12
+ 'TypeError',
13
+ 'URIError'
14
+ ];
15
+
16
+ if ('AggregateError' in self) {
17
+ _errorNames.push('AggregateError');
18
+ }
19
+
20
+ for (var i = 0; i < _errorNames.length; i++) {
21
+ var name = _errorNames[i];
22
+ CreateMethodProperty(self, name, _ErrorConstructor(name));
23
+ }
24
+ })();
@@ -1 +1 @@
1
- {"dependencies":["Element.prototype.matches","Map","MutationObserver","Node.prototype.contains","Set","WeakMap"],"aliases":["Element.prototype.inert"],"license":"W3C","spec":"https://html.spec.whatwg.org/multipage/interaction.html#dom-inert","repo":"https://github.com/WICG/inert","docs":"https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert","browsers":{"android":"*","bb":"*","chrome":"<102","edge":"*","edge_mob":"*","firefox":"<104","firefox_mob":"<104","ie":">=9","ie_mob":">=9","opera":"<88","op_mob":"<70","op_mini":"*","safari":"<15.5","ios_saf":"<15.5","samsung_mob":"*"},"detectSource":"\"HTMLElement\"in self&&\"inert\"in HTMLElement.prototype\n","baseDir":"HTMLElement/prototype/inert","hasTests":true,"isTestable":true,"isPublic":true,"size":8386}
1
+ {"dependencies":["Element.prototype.matches","Map","MutationObserver","Node.prototype.contains","Set","WeakMap"],"aliases":["Element.prototype.inert"],"license":"W3C","spec":"https://html.spec.whatwg.org/multipage/interaction.html#dom-inert","repo":"https://github.com/WICG/inert","docs":"https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert","browsers":{"android":"*","bb":"*","chrome":"<102","edge":"*","edge_mob":"*","firefox":"<104","firefox_mob":"<104","ie":">=9","ie_mob":">=9","opera":"<88","op_mob":"<70","op_mini":"*","safari":"<15.5","ios_saf":"<15.5","samsung_mob":"<19.0"},"detectSource":"\"HTMLElement\"in self&&\"inert\"in HTMLElement.prototype\n","baseDir":"HTMLElement/prototype/inert","hasTests":true,"isTestable":true,"isPublic":true,"size":8386}
@@ -1 +1 @@
1
- {"aliases":[],"dependencies":["Event","performance.now"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver","spec":"http://rawgit.com/w3c/IntersectionObserver/master/index.html","notes":[],"repo":"https://github.com/w3c/IntersectionObserver","browsers":{"android":"*","bb":"*","chrome":"<51","edge":"<16","edge_mob":"<16","firefox":"<55","firefox_mob":"<55","ie":"*","ie_mob":"*","opera":"<45","op_mob":"<46","op_mini":"*","safari":"<16.1","ios_saf":"<16.1","samsung_mob":"<7.0"},"detectSource":"\"IntersectionObserver\"in window&&\"IntersectionObserverEntry\"in window&&\"intersectionRatio\"in window.IntersectionObserverEntry.prototype\n","baseDir":"IntersectionObserver","hasTests":false,"isTestable":true,"isPublic":true,"size":6733}
1
+ {"aliases":[],"dependencies":["Event","performance.now"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver","spec":"http://rawgit.com/w3c/IntersectionObserver/master/index.html","notes":[],"repo":"https://github.com/w3c/IntersectionObserver","browsers":{"android":"*","bb":"*","chrome":"<51","edge":"<16","edge_mob":"<16","firefox":"<55","firefox_mob":"<55","ie":"*","ie_mob":"*","opera":"<45","op_mob":"<46","op_mini":"*","safari":"<17.0","ios_saf":"<17.0","samsung_mob":"<7.0"},"detectSource":"\"IntersectionObserver\"in window&&\"IntersectionObserverEntry\"in window&&\"intersectionRatio\"in window.IntersectionObserverEntry.prototype\n","baseDir":"IntersectionObserver","hasTests":false,"isTestable":true,"isPublic":true,"size":6733}
@@ -0,0 +1 @@
1
+ {"dependencies":["_ESAbstract.DefinePropertyOrThrow"],"spec":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-createnonenumerabledatapropertyorthrow","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"*","op_mob":"*","op_mini":"*","safari":"*","ios_saf":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ESAbstract/CreateNonEnumerableDataPropertyOrThrow","hasTests":false,"isTestable":true,"isPublic":false,"size":142}
@@ -0,0 +1 @@
1
+ function CreateNonEnumerableDataPropertyOrThrow(e,r,a){var n={value:a,writable:!0,enumerable:!1,configurable:!0};DefinePropertyOrThrow(e,r,n)}
@@ -0,0 +1,17 @@
1
+
2
+ // _ESAbstract.CreateNonEnumerableDataPropertyOrThrow
3
+ /* global DefinePropertyOrThrow */
4
+ // 7.3.8 CreateNonEnumerableDataPropertyOrThrow ( O, P, V )
5
+ function CreateNonEnumerableDataPropertyOrThrow (O, P, V) { // eslint-disable-line no-unused-vars
6
+ // 1. Assert: O is an ordinary, extensible object with no non-configurable properties.
7
+ // 2. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }.
8
+ var newDesc = {
9
+ value: V,
10
+ writable: true,
11
+ enumerable: false,
12
+ configurable: true
13
+ };
14
+ // 3. Perform ! DefinePropertyOrThrow(O, P, newDesc).
15
+ DefinePropertyOrThrow(O, P, newDesc);
16
+ // 4. Return unused.
17
+ }
@@ -0,0 +1 @@
1
+ {"dependencies":[],"spec":"https://tc39.es/ecma262/multipage/abstract-operations.html#sec-definepropertyorthrow","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"*","op_mob":"*","op_mini":"*","safari":"*","ios_saf":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ESAbstract/DefinePropertyOrThrow","hasTests":false,"isTestable":true,"isPublic":false,"size":238}
@@ -0,0 +1 @@
1
+ function DefinePropertyOrThrow(t,r,e){var o;try{Object.defineProperty(t,r,e),o=!0}catch(t){o=!1}if(!o)throw new TypeError("Cannot define property `"+Object.prototype.toString.call(r)+"` on object `"+Object.prototype.toString.call(t)+"`")}
@@ -0,0 +1,18 @@
1
+
2
+ // _ESAbstract.DefinePropertyOrThrow
3
+ // 7.3.9 DefinePropertyOrThrow ( O, P, desc )
4
+ function DefinePropertyOrThrow (O, P, desc) { // eslint-disable-line no-unused-vars
5
+ // 1. Let success be ? O.[[DefineOwnProperty]](P, desc).
6
+ var success;
7
+ try {
8
+ Object.defineProperty(O, P, desc);
9
+ success = true;
10
+ } catch (e) {
11
+ success = false;
12
+ }
13
+ // 2. If success is false, throw a TypeError exception.
14
+ if (!success) {
15
+ throw new TypeError('Cannot define property `' + Object.prototype.toString.call(P) + '` on object `' + Object.prototype.toString.call(O) + '`');
16
+ }
17
+ // 3. Return unused.
18
+ }
@@ -0,0 +1 @@
1
+ {"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.CreateNonEnumerableDataPropertyOrThrow","_ESAbstract.Get","_ESAbstract.HasProperty","_ESAbstract.Type","Object.setPrototypeOf"],"spec":"https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-installerrorcause","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause","browsers":{"android":"*","bb":"*","chrome":"*","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"*","op_mob":"*","op_mini":"*","safari":"*","ios_saf":"*","samsung_mob":"*"},"detectSource":"","baseDir":"_ErrorConstructor","hasTests":false,"isTestable":true,"isPublic":false,"size":1261}
@@ -0,0 +1 @@
1
+ var _ErrorConstructor;!function(){function r(r,n){if("object"===Type(n)&&HasProperty(n,"cause")){var e=Get(n,"cause");CreateNonEnumerableDataPropertyOrThrow(r,"cause",e)}}function n(n,e){var t=o[n],u=e.length;return function(){var n=2===u?t.call(null,arguments[0],arguments[1]):t.call(null,arguments[0]);return r(n,arguments.length>u&&arguments[u]),CreateMethodProperty(n,"constructor",e),n}}function e(r,n){return"Error"!==r&&Object.setPrototypeOf(n,self.Error),n.prototype=o[r].prototype,Object.defineProperty(n,"prototype",{writable:!1}),n.name!==r&&Object.defineProperty(n,"name",{value:r,configurable:!0}),n}var t={Error:function r(n){return u.Error.apply(null,arguments)},EvalError:function r(n){return u.EvalError.apply(null,arguments)},RangeError:function r(n){return u.RangeError.apply(null,arguments)},ReferenceError:function r(n){return u.ReferenceError.apply(null,arguments)},SyntaxError:function r(n){return u.SyntaxError.apply(null,arguments)},TypeError:function r(n){return u.TypeError.apply(null,arguments)},URIError:function r(n){return u.URIError.apply(null,arguments)},AggregateError:function r(n,e){return u.AggregateError.apply(null,arguments)}},o={},u={};_ErrorConstructor=function(r){return o[r]=self[r],u[r]=n(r,t[r]),e(r,t[r]),t[r]}}();
@@ -0,0 +1,69 @@
1
+
2
+ // _ErrorConstructor
3
+ /* global CreateMethodProperty, CreateNonEnumerableDataPropertyOrThrow, Get, HasProperty, Type */
4
+
5
+ // eslint-disable-next-line no-unused-vars
6
+ var _ErrorConstructor;
7
+
8
+ (function () {
9
+ // 20.5.8.1 InstallErrorCause ( O, options )
10
+ function InstallErrorCause(O, options) {
11
+ // 1. If options is an Object and ? HasProperty(options, "cause") is true, then
12
+ if (Type(options) === 'object' && HasProperty(options, 'cause')) {
13
+ // a. Let cause be ? Get(options, "cause").
14
+ var cause = Get(options, 'cause');
15
+ // b. Perform CreateNonEnumerableDataPropertyOrThrow(O, "cause", cause).
16
+ CreateNonEnumerableDataPropertyOrThrow(O, 'cause', cause);
17
+ }
18
+ // 2. Return unused.
19
+ }
20
+
21
+ // based on https://github.com/es-shims/error-cause/blob/de17ea05/Error/implementation.js#L12-L20
22
+ function _makeErrorConstructor (name, _Error) {
23
+ var _NativeError = _nativeErrors[name];
24
+ var arity = _Error.length;
25
+ return function () {
26
+ var O = arity === 2
27
+ ? _NativeError.call(null, arguments[0], arguments[1])
28
+ : _NativeError.call(null, arguments[0]);
29
+ InstallErrorCause(O, arguments.length > arity && arguments[arity]);
30
+ CreateMethodProperty(O, 'constructor', _Error);
31
+ return O;
32
+ }
33
+ }
34
+
35
+ // based on https://github.com/es-shims/error-cause/blob/de17ea05/Error/implementation.js#L22-L29
36
+ function _inheritErrorPrototype (name, _Error) {
37
+ if (name !== 'Error') {
38
+ Object.setPrototypeOf(_Error, self.Error);
39
+ }
40
+ _Error.prototype = _nativeErrors[name].prototype;
41
+ Object.defineProperty(_Error, 'prototype', { writable: false });
42
+ // in IE11, the constructor name needs to be corrected
43
+ if (_Error.name !== name) {
44
+ Object.defineProperty(_Error, 'name', { value: name, configurable: true });
45
+ }
46
+ return _Error;
47
+ }
48
+
49
+ var _newErrors = {
50
+ Error: function Error (_message) { return _errorConstructors.Error.apply(null, arguments); },
51
+ EvalError: function EvalError (_message) { return _errorConstructors.EvalError.apply(null, arguments); },
52
+ RangeError: function RangeError (_message) { return _errorConstructors.RangeError.apply(null, arguments); },
53
+ ReferenceError: function ReferenceError (_message) { return _errorConstructors.ReferenceError.apply(null, arguments); },
54
+ SyntaxError: function SyntaxError (_message) { return _errorConstructors.SyntaxError.apply(null, arguments); },
55
+ TypeError: function TypeError (_message) { return _errorConstructors.TypeError.apply(null, arguments); },
56
+ URIError: function URIError (_message) { return _errorConstructors.URIError.apply(null, arguments); },
57
+ AggregateError: function AggregateError (_errors, _message) { return _errorConstructors.AggregateError.apply(null, arguments); }
58
+ };
59
+
60
+ var _nativeErrors = {};
61
+ var _errorConstructors = {};
62
+
63
+ _ErrorConstructor = function (name) {
64
+ _nativeErrors[name] = self[name];
65
+ _errorConstructors[name] = _makeErrorConstructor(name, _newErrors[name]);
66
+ _inheritErrorPrototype(name, _newErrors[name]);
67
+ return _newErrors[name];
68
+ }
69
+ })();