@github/browser-support 1.0.7 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/arraylike-at.d.ts.map +1 -1
- package/lib/arraylike-at.js +9 -5
- package/lib/arraylike-at.js.map +1 -1
- package/lib/element-replacechildren.d.ts +5 -0
- package/lib/element-replacechildren.d.ts.map +1 -0
- package/lib/element-replacechildren.js +29 -0
- package/lib/element-replacechildren.js.map +1 -0
- package/lib/index.d.ts +27 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +38 -31
- package/lib/index.js.map +1 -1
- package/lib/promise-allsettled.d.ts +7 -0
- package/lib/promise-allsettled.d.ts.map +1 -0
- package/lib/promise-allsettled.js +19 -0
- package/lib/promise-allsettled.js.map +1 -0
- package/lib/string-replaceall.d.ts +5 -0
- package/lib/string-replaceall.d.ts.map +1 -0
- package/lib/string-replaceall.js +33 -0
- package/lib/string-replaceall.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Please do not add any polyfills for ECMA features that are Stage 3 or below. We
|
|
|
42
42
|
|
|
43
43
|
### Removing polyfills
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Polyfills should only be removed after consulting with the `@github/web-systems` who will determine if a polyfill can be removed. This code is designed to be kept lightweight, we do not want to ship dozens of kb of polyfills.
|
|
46
46
|
|
|
47
47
|
As a polyfill is removed, it may be worth adding feature detection to the `baseSupport` const, to ensure that our baseline moves with our browser support matrix.
|
|
48
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arraylike-at.d.ts","sourceRoot":"","sources":["../src/arraylike-at.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAKtE;AAGD,wBAAgB,WAAW,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"arraylike-at.d.ts","sourceRoot":"","sources":["../src/arraylike-at.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAKtE;AAGD,wBAAgB,WAAW,IAAI,OAAO,CAUrC;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAOtC;AAED,wBAAgB,KAAK,IAAI,IAAI,CAO5B"}
|
package/lib/arraylike-at.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const TypedArray = Reflect.getPrototypeOf(Int8Array);
|
|
2
2
|
export function arrayLikeAt(i) {
|
|
3
3
|
const l = this.length;
|
|
4
4
|
i = Math.trunc(i) || 0;
|
|
@@ -12,19 +12,23 @@ export function isSupported() {
|
|
|
12
12
|
typeof Array.prototype.at === 'function' &&
|
|
13
13
|
'at' in String.prototype &&
|
|
14
14
|
typeof String.prototype.at === 'function' &&
|
|
15
|
-
'
|
|
16
|
-
|
|
15
|
+
typeof TypedArray === 'function' &&
|
|
16
|
+
'at' in TypedArray.prototype &&
|
|
17
|
+
typeof TypedArray.prototype.at === 'function');
|
|
17
18
|
}
|
|
18
19
|
/*#__PURE__*/
|
|
19
20
|
export function isPolyfilled() {
|
|
20
|
-
return Array.prototype.at === arrayLikeAt &&
|
|
21
|
+
return (Array.prototype.at === arrayLikeAt &&
|
|
22
|
+
String.prototype.at === arrayLikeAt &&
|
|
23
|
+
typeof TypedArray === 'function' &&
|
|
24
|
+
TypedArray.prototype.at === arrayLikeAt);
|
|
21
25
|
}
|
|
22
26
|
export function apply() {
|
|
23
27
|
if (!isSupported()) {
|
|
24
28
|
const defn = { value: arrayLikeAt, writable: true, configurable: true };
|
|
25
29
|
Object.defineProperty(Array.prototype, 'at', defn);
|
|
26
30
|
Object.defineProperty(String.prototype, 'at', defn);
|
|
27
|
-
Object.defineProperty(
|
|
31
|
+
Object.defineProperty(TypedArray, 'at', defn);
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
//# sourceMappingURL=arraylike-at.js.map
|
package/lib/arraylike-at.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arraylike-at.js","sourceRoot":"","sources":["../src/arraylike-at.ts"],"names":[],"mappings":"AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"arraylike-at.js","sourceRoot":"","sources":["../src/arraylike-at.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAgC,CAAA;AAEnF,MAAM,UAAU,WAAW,CAAwB,CAAS;IAC1D,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAA;IACrB,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACtB,IAAI,CAAC,GAAG,CAAC;QAAE,CAAC,IAAI,CAAC,CAAA;IACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC9C,CAAC;AAED,aAAa;AACb,MAAM,UAAU,WAAW;IACzB,OAAO,CACL,IAAI,IAAI,KAAK,CAAC,SAAS;QACvB,OAAO,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,UAAU;QACxC,IAAI,IAAI,MAAM,CAAC,SAAS;QACxB,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,UAAU;QACzC,OAAO,UAAU,KAAK,UAAU;QAChC,IAAI,IAAI,UAAU,CAAC,SAAS;QAC5B,OAAO,UAAU,CAAC,SAAS,CAAC,EAAE,KAAK,UAAU,CAC9C,CAAA;AACH,CAAC;AAED,aAAa;AACb,MAAM,UAAU,YAAY;IAC1B,OAAO,CACL,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,WAAW;QAClC,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,WAAW;QACnC,OAAO,UAAU,KAAK,UAAU;QAChC,UAAU,CAAC,SAAS,CAAC,EAAE,KAAK,WAAW,CACxC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,WAAW,EAAE,EAAE;QAClB,MAAM,IAAI,GAAG,EAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAC,CAAA;QACrE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAClD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QACnD,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;KAC9C;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function replaceChildren(this: Element | Document | DocumentFragment, ...children: Node[]): void;
|
|
2
|
+
export declare function isSupported(): boolean;
|
|
3
|
+
export declare function isPolyfilled(): boolean;
|
|
4
|
+
export declare function apply(): void;
|
|
5
|
+
//# sourceMappingURL=element-replacechildren.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-replacechildren.d.ts","sourceRoot":"","sources":["../src/element-replacechildren.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,gBAAgB,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,QAG/F;AAGD,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAMtC;AAED,wBAAgB,KAAK,IAAI,IAAI,CAO5B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function replaceChildren(...children) {
|
|
2
|
+
while (this.firstChild)
|
|
3
|
+
this.removeChild(this.firstChild);
|
|
4
|
+
this.append(...children);
|
|
5
|
+
}
|
|
6
|
+
/*#__PURE__*/
|
|
7
|
+
export function isSupported() {
|
|
8
|
+
return ('replaceChildren' in Element.prototype &&
|
|
9
|
+
typeof Element.prototype.replaceChildren === 'function' &&
|
|
10
|
+
'replaceChildren' in Document.prototype &&
|
|
11
|
+
typeof Document.prototype.replaceChildren === 'function' &&
|
|
12
|
+
'replaceChildren' in DocumentFragment.prototype &&
|
|
13
|
+
typeof DocumentFragment.prototype.replaceChildren === 'function');
|
|
14
|
+
}
|
|
15
|
+
/*#__PURE__*/
|
|
16
|
+
export function isPolyfilled() {
|
|
17
|
+
return (Element.prototype.replaceChildren === replaceChildren &&
|
|
18
|
+
Document.prototype.replaceChildren === replaceChildren &&
|
|
19
|
+
DocumentFragment.prototype.replaceChildren === replaceChildren);
|
|
20
|
+
}
|
|
21
|
+
export function apply() {
|
|
22
|
+
if (!isSupported()) {
|
|
23
|
+
Element.prototype.replaceChildren =
|
|
24
|
+
Document.prototype.replaceChildren =
|
|
25
|
+
DocumentFragment.prototype.replaceChildren =
|
|
26
|
+
replaceChildren;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=element-replacechildren.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-replacechildren.js","sourceRoot":"","sources":["../src/element-replacechildren.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAA8C,GAAG,QAAgB;IAC9F,OAAO,IAAI,CAAC,UAAU;QAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACzD,IAAI,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAA;AAC1B,CAAC;AAED,aAAa;AACb,MAAM,UAAU,WAAW;IACzB,OAAO,CACL,iBAAiB,IAAI,OAAO,CAAC,SAAS;QACtC,OAAO,OAAO,CAAC,SAAS,CAAC,eAAe,KAAK,UAAU;QACvD,iBAAiB,IAAI,QAAQ,CAAC,SAAS;QACvC,OAAO,QAAQ,CAAC,SAAS,CAAC,eAAe,KAAK,UAAU;QACxD,iBAAiB,IAAI,gBAAgB,CAAC,SAAS;QAC/C,OAAO,gBAAgB,CAAC,SAAS,CAAC,eAAe,KAAK,UAAU,CACjE,CAAA;AACH,CAAC;AAED,aAAa;AACb,MAAM,UAAU,YAAY;IAC1B,OAAO,CACL,OAAO,CAAC,SAAS,CAAC,eAAe,KAAK,eAAe;QACrD,QAAQ,CAAC,SAAS,CAAC,eAAe,KAAK,eAAe;QACtD,gBAAgB,CAAC,SAAS,CAAC,eAAe,KAAK,eAAe,CAC/D,CAAA;AACH,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,WAAW,EAAE,EAAE;QAClB,OAAO,CAAC,SAAS,CAAC,eAAe;YAC/B,QAAQ,CAAC,SAAS,CAAC,eAAe;gBAClC,gBAAgB,CAAC,SAAS,CAAC,eAAe;oBACxC,eAAe,CAAA;KACpB;AACH,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
import * as abortSignalAbort from './abortsignal-abort.js';
|
|
2
|
+
import * as abortSignalTimeout from './abortsignal-timeout.js';
|
|
3
|
+
import * as aggregateError from './aggregateerror.js';
|
|
4
|
+
import * as arrayAt from './arraylike-at.js';
|
|
5
|
+
import * as cryptoRandomUUID from './crypto-randomuuid.js';
|
|
6
|
+
import * as elementReplaceChildren from './element-replacechildren.js';
|
|
7
|
+
import * as eventAbortSignal from './event-abortsignal.js';
|
|
8
|
+
import * as objectHasOwn from './object-hasown.js';
|
|
9
|
+
import * as promiseAllSettled from './promise-allsettled.js';
|
|
10
|
+
import * as promiseAny from './promise-any.js';
|
|
11
|
+
import * as requestIdleCallback from './requestidlecallback.js';
|
|
12
|
+
import * as stringReplaceAll from './string-replaceall.js';
|
|
13
|
+
export declare const baseSupport: boolean;
|
|
14
|
+
export declare const polyfills: {
|
|
15
|
+
abortSignalAbort: typeof abortSignalAbort;
|
|
16
|
+
abortSignalTimeout: typeof abortSignalTimeout;
|
|
17
|
+
aggregateError: typeof aggregateError;
|
|
18
|
+
arrayAt: typeof arrayAt;
|
|
19
|
+
cryptoRandomUUID: typeof cryptoRandomUUID;
|
|
20
|
+
elementReplaceChildren: typeof elementReplaceChildren;
|
|
21
|
+
eventAbortSignal: typeof eventAbortSignal;
|
|
22
|
+
objectHasOwn: typeof objectHasOwn;
|
|
23
|
+
promiseAllSettled: typeof promiseAllSettled;
|
|
24
|
+
promiseAny: typeof promiseAny;
|
|
25
|
+
requestIdleCallback: typeof requestIdleCallback;
|
|
26
|
+
stringReplaceAll: typeof stringReplaceAll;
|
|
27
|
+
};
|
|
1
28
|
export declare function isSupported(): boolean;
|
|
2
29
|
export declare function isPolyfilled(): boolean;
|
|
3
30
|
export declare function apply(): void;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,kBAAkB,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,sBAAsB,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAE1D,eAAO,MAAM,WAAW,SAuClB,CAAA;AAEN,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAarB,CAAA;AAED,wBAAgB,WAAW,YAO1B;AAED,wBAAgB,YAAY,YAI3B;AAED,wBAAgB,KAAK,SAIpB"}
|
package/lib/index.js
CHANGED
|
@@ -3,11 +3,14 @@ import * as abortSignalTimeout from './abortsignal-timeout.js';
|
|
|
3
3
|
import * as aggregateError from './aggregateerror.js';
|
|
4
4
|
import * as arrayAt from './arraylike-at.js';
|
|
5
5
|
import * as cryptoRandomUUID from './crypto-randomuuid.js';
|
|
6
|
+
import * as elementReplaceChildren from './element-replacechildren.js';
|
|
6
7
|
import * as eventAbortSignal from './event-abortsignal.js';
|
|
7
8
|
import * as objectHasOwn from './object-hasown.js';
|
|
9
|
+
import * as promiseAllSettled from './promise-allsettled.js';
|
|
8
10
|
import * as promiseAny from './promise-any.js';
|
|
9
11
|
import * as requestIdleCallback from './requestidlecallback.js';
|
|
10
|
-
|
|
12
|
+
import * as stringReplaceAll from './string-replaceall.js';
|
|
13
|
+
export const baseSupport = typeof Blob === 'function' &&
|
|
11
14
|
typeof PerformanceObserver === 'function' &&
|
|
12
15
|
typeof Intl === 'object' &&
|
|
13
16
|
typeof MutationObserver === 'function' &&
|
|
@@ -21,55 +24,59 @@ const baseSupport = typeof Blob === 'function' &&
|
|
|
21
24
|
typeof HTMLDetailsElement === 'function' &&
|
|
22
25
|
typeof AbortController === 'function' &&
|
|
23
26
|
typeof AbortSignal === 'function' &&
|
|
27
|
+
typeof globalThis === 'object' &&
|
|
24
28
|
'entries' in FormData.prototype &&
|
|
25
29
|
'toggleAttribute' in Element.prototype &&
|
|
26
|
-
'replaceChildren' in Element.prototype &&
|
|
27
30
|
// ES2019
|
|
28
31
|
'fromEntries' in Object &&
|
|
29
32
|
'flatMap' in Array.prototype &&
|
|
30
33
|
'trimEnd' in String.prototype &&
|
|
31
34
|
// ES2020
|
|
32
|
-
'allSettled' in Promise &&
|
|
35
|
+
//'allSettled' in Promise && // Polyfilled
|
|
33
36
|
'matchAll' in String.prototype &&
|
|
34
37
|
// ES2021
|
|
35
|
-
'replaceAll' in String.prototype &&
|
|
38
|
+
//'replaceAll' in String.prototype && // Polyfilled
|
|
36
39
|
// 'any' in Promise && // Polyfilled
|
|
37
40
|
// ES2022
|
|
38
41
|
// 'at' in String.prototype && // Polyfilled
|
|
39
42
|
// 'at' in Array.prototype && // Polyfilled
|
|
43
|
+
// 'hasOwn' in Object && // Polyfilled
|
|
44
|
+
// ESNext
|
|
45
|
+
// 'abort' in AbortSignal && // Polyfilled
|
|
46
|
+
// 'timeout' in AbortSignal && // Polyfilled
|
|
47
|
+
// typeof AggregateError === 'function' && // Polyfilled
|
|
48
|
+
// 'randomUUID' in crypto && // Polyfilled
|
|
49
|
+
// 'replaceChildren' in Element.prototype && // Polyfilled
|
|
50
|
+
// 'requestIdleCallback' in window && // Polyfilled
|
|
40
51
|
true;
|
|
52
|
+
export const polyfills = {
|
|
53
|
+
abortSignalAbort,
|
|
54
|
+
abortSignalTimeout,
|
|
55
|
+
aggregateError,
|
|
56
|
+
arrayAt,
|
|
57
|
+
cryptoRandomUUID,
|
|
58
|
+
elementReplaceChildren,
|
|
59
|
+
eventAbortSignal,
|
|
60
|
+
objectHasOwn,
|
|
61
|
+
promiseAllSettled,
|
|
62
|
+
promiseAny,
|
|
63
|
+
requestIdleCallback,
|
|
64
|
+
stringReplaceAll
|
|
65
|
+
};
|
|
41
66
|
export function isSupported() {
|
|
42
67
|
return (baseSupport &&
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
arrayAt.isSupported() &&
|
|
47
|
-
cryptoRandomUUID.isSupported() &&
|
|
48
|
-
eventAbortSignal.isSupported() &&
|
|
49
|
-
objectHasOwn.isSupported() &&
|
|
50
|
-
promiseAny.isSupported() &&
|
|
51
|
-
requestIdleCallback.isSupported());
|
|
68
|
+
Object.values(polyfills).every(polyfill => {
|
|
69
|
+
polyfill.isSupported();
|
|
70
|
+
}));
|
|
52
71
|
}
|
|
53
72
|
export function isPolyfilled() {
|
|
54
|
-
return (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
arrayAt.isPolyfilled() &&
|
|
58
|
-
cryptoRandomUUID.isPolyfilled() &&
|
|
59
|
-
eventAbortSignal.isPolyfilled() &&
|
|
60
|
-
objectHasOwn.isPolyfilled() &&
|
|
61
|
-
promiseAny.isPolyfilled() &&
|
|
62
|
-
requestIdleCallback.isPolyfilled());
|
|
73
|
+
return Object.values(polyfills).every(polyfill => {
|
|
74
|
+
polyfill.isPolyfilled();
|
|
75
|
+
});
|
|
63
76
|
}
|
|
64
77
|
export function apply() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
arrayAt.apply();
|
|
69
|
-
cryptoRandomUUID.apply();
|
|
70
|
-
eventAbortSignal.apply();
|
|
71
|
-
objectHasOwn.apply();
|
|
72
|
-
promiseAny.apply();
|
|
73
|
-
requestIdleCallback.apply();
|
|
78
|
+
for (const polyfill of Object.values(polyfills)) {
|
|
79
|
+
polyfill.apply();
|
|
80
|
+
}
|
|
74
81
|
}
|
|
75
82
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,kBAAkB,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,YAAY,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
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function promiseAllSettled<T extends readonly unknown[] | []>(values: T): Promise<{
|
|
2
|
+
-readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>>;
|
|
3
|
+
}>;
|
|
4
|
+
export declare function isSupported(): boolean;
|
|
5
|
+
export declare function isPolyfilled(): boolean;
|
|
6
|
+
export declare function apply(): void;
|
|
7
|
+
//# sourceMappingURL=promise-allsettled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-allsettled.d.ts","sourceRoot":"","sources":["../src/promise-allsettled.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,EACjE,MAAM,EAAE,CAAC,GACR,OAAO,CAAC;IAAC,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,CAAC,CAU1E;AAGD,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,KAAK,IAAI,IAAI,CAI5B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function promiseAllSettled(values) {
|
|
2
|
+
return Promise.all(values.map(p =>
|
|
3
|
+
// eslint-disable-next-line github/no-then
|
|
4
|
+
Promise.resolve(p).then((value) => ({ status: 'fulfilled', value }), (reason) => ({ status: 'rejected', reason }))));
|
|
5
|
+
}
|
|
6
|
+
/*#__PURE__*/
|
|
7
|
+
export function isSupported() {
|
|
8
|
+
return 'allSettled' in Promise && typeof Promise.allSettled === 'function';
|
|
9
|
+
}
|
|
10
|
+
/*#__PURE__*/
|
|
11
|
+
export function isPolyfilled() {
|
|
12
|
+
return Promise.all === promiseAllSettled;
|
|
13
|
+
}
|
|
14
|
+
export function apply() {
|
|
15
|
+
if (!isSupported()) {
|
|
16
|
+
Promise.allSettled = promiseAllSettled;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=promise-allsettled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-allsettled.js","sourceRoot":"","sources":["../src/promise-allsettled.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAC/B,MAAS;IAET,OAAO,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;IACb,0CAA0C;IAC1C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CACrB,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC,EAClD,CAAC,MAAe,EAAE,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAC,CAAC,CACpD,CACF,CACqF,CAAA;AAC1F,CAAC;AAED,aAAa;AACb,MAAM,UAAU,WAAW;IACzB,OAAO,YAAY,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,UAAU,CAAA;AAC5E,CAAC;AAED,aAAa;AACb,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,KAAK,iBAAiB,CAAA;AAC1C,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,WAAW,EAAE,EAAE;QAClB,OAAO,CAAC,UAAU,GAAG,iBAAiB,CAAA;KACvC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function stringReplaceAll(this: string, searchValue: RegExp | string, replaceValue: ((substring: string, ...args: unknown[]) => string) | string): string;
|
|
2
|
+
export declare function isSupported(): boolean;
|
|
3
|
+
export declare function isPolyfilled(): boolean;
|
|
4
|
+
export declare function apply(): void;
|
|
5
|
+
//# sourceMappingURL=string-replaceall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-replaceall.d.ts","sourceRoot":"","sources":["../src/string-replaceall.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,YAAY,EAAE,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC,GAAG,MAAM,GACzE,MAAM,CAiBR;AAGD,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,KAAK,IAAI,IAAI,CAI5B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function stringReplaceAll(searchValue, replaceValue) {
|
|
2
|
+
if (searchValue instanceof RegExp)
|
|
3
|
+
return this.replace(searchValue, replaceValue);
|
|
4
|
+
let pos = -1;
|
|
5
|
+
let endOfLastMatch = 0;
|
|
6
|
+
let result = '';
|
|
7
|
+
if (typeof replaceValue === 'function') {
|
|
8
|
+
const unwrapped = replaceValue;
|
|
9
|
+
replaceValue = () => unwrapped(searchValue, pos, this);
|
|
10
|
+
}
|
|
11
|
+
pos = this.indexOf(searchValue, pos + 1);
|
|
12
|
+
while (pos !== -1) {
|
|
13
|
+
result += this.substring(endOfLastMatch, pos);
|
|
14
|
+
result += searchValue.replace(searchValue, replaceValue);
|
|
15
|
+
endOfLastMatch = pos + searchValue.length;
|
|
16
|
+
pos = this.indexOf(searchValue, pos + 1);
|
|
17
|
+
}
|
|
18
|
+
return result + this.substring(endOfLastMatch);
|
|
19
|
+
}
|
|
20
|
+
/*#__PURE__*/
|
|
21
|
+
export function isSupported() {
|
|
22
|
+
return 'replaceAll' in String.prototype && typeof String.prototype.replaceAll === 'function';
|
|
23
|
+
}
|
|
24
|
+
/*#__PURE__*/
|
|
25
|
+
export function isPolyfilled() {
|
|
26
|
+
return String.prototype.replaceAll === stringReplaceAll;
|
|
27
|
+
}
|
|
28
|
+
export function apply() {
|
|
29
|
+
if (!isSupported()) {
|
|
30
|
+
String.prototype.replaceAll = stringReplaceAll;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=string-replaceall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-replaceall.js","sourceRoot":"","sources":["../src/string-replaceall.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAE9B,WAA4B,EAC5B,YAA0E;IAE1E,IAAI,WAAW,YAAY,MAAM;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,YAAiC,CAAC,CAAA;IACtG,IAAI,GAAG,GAAG,CAAC,CAAC,CAAA;IACZ,IAAI,cAAc,GAAG,CAAC,CAAA;IACtB,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;QACtC,MAAM,SAAS,GAAG,YAAY,CAAA;QAC9B,YAAY,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;KACvD;IACD,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;IACxC,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE;QACjB,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;QAC7C,MAAM,IAAI,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,YAAsB,CAAC,CAAA;QAClE,cAAc,GAAG,GAAG,GAAG,WAAW,CAAC,MAAM,CAAA;QACzC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;KACzC;IACD,OAAO,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;AAChD,CAAC;AAED,aAAa;AACb,MAAM,UAAU,WAAW;IACzB,OAAO,YAAY,IAAI,MAAM,CAAC,SAAS,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAA;AAC9F,CAAC;AAED,aAAa;AACb,MAAM,UAAU,YAAY;IAC1B,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,gBAAgB,CAAA;AACzD,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,WAAW,EAAE,EAAE;QAClB,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG,gBAAgB,CAAA;KAC/C;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@github/browser-support",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Polyfills and Capable Browser detection",
|
|
5
5
|
"homepage": "https://github.github.io/browser-support",
|
|
6
6
|
"bugs": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"lint": "eslint . --ignore-path .gitignore",
|
|
28
28
|
"pretest": "npm run build",
|
|
29
29
|
"test": "npm run lint && karma start test/karma.config.cjs",
|
|
30
|
-
"
|
|
30
|
+
"prepack": "npm run build",
|
|
31
31
|
"postpublish": "npm publish --ignore-scripts --@github:registry='https://npm.pkg.github.com'"
|
|
32
32
|
},
|
|
33
33
|
"prettier": "@github/prettier-config",
|