Skip to content

Commit 0f433e5

Browse files
authoredAug 3, 2022
build: drop support for legacy browsers (IE11, Safari 10) (#604)
BREAKING CHANGE: Drop support for browsers that don't correctly implement const/let and default arguments, and no longer transpile the browser build to ES2015. This also removes the fallback on msCrypto instead of the crypto API. Browser tests are run in the first supported version of each supported browser and in the latest (as of this commit) version available on Browserstack.
1 parent 16f9c46 commit 0f433e5

File tree

5 files changed

+86
-48
lines changed

5 files changed

+86
-48
lines changed
 

‎README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For the creation of [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) UUIDs
1010
- **Cross-platform** - Support for ...
1111
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds)
1212
- Node 10, 12, 14, 16
13-
- Chrome, Safari, Firefox, Edge, IE 11 browsers
13+
- Chrome, Safari, Firefox, Edge browsers
1414
- Webpack and rollup.js module bundlers
1515
- [React Native / Expo](#react-native--expo)
1616
- **Secure** - Cryptographically-strong random values
@@ -417,6 +417,10 @@ Note: If you are using Expo, you must be using at least `react-native-get-random
417417

418418
[In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please).
419419

420+
### IE 11 (Internet Explorer)
421+
422+
Support for IE11 and other legacy browsers has been dropped as of `uuid@9`. If you need to support legacy browsers, you can always transpile the uuid module source yourself (e.g. using [Babel](https://babeljs.io/)).
423+
420424
## Upgrading From `uuid@7`
421425

422426
### Only Named Exports Supported When Using with Node.js ESM

‎README_js.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ For the creation of [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) UUIDs
2525
- **Cross-platform** - Support for ...
2626
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds)
2727
- Node 10, 12, 14, 16
28-
- Chrome, Safari, Firefox, Edge, IE 11 browsers
28+
- Chrome, Safari, Firefox, Edge browsers
2929
- Webpack and rollup.js module bundlers
3030
- [React Native / Expo](#react-native--expo)
3131
- **Secure** - Cryptographically-strong random values
@@ -426,6 +426,10 @@ Note: If you are using Expo, you must be using at least `react-native-get-random
426426

427427
[In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please).
428428

429+
### IE 11 (Internet Explorer)
430+
431+
Support for IE11 and other legacy browsers has been dropped as of `uuid@9`. If you need to support legacy browsers, you can always transpile the uuid module source yourself (e.g. using [Babel](https://babeljs.io/)).
432+
429433
## Upgrading From `uuid@7`
430434

431435
### Only Named Exports Supported When Using with Node.js ESM

‎babel.config.json

+52-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,64 @@
33
"plugins": [],
44
"env": {
55
"commonjsNode": {
6-
"presets": [["@babel/preset-env", { "targets": { "node": "10" }, "modules": "commonjs" }]]
6+
"presets": [
7+
[
8+
"@babel/preset-env",
9+
{
10+
"targets": {
11+
"node": "10"
12+
},
13+
"modules": "commonjs"
14+
}
15+
]
16+
]
717
},
818
"esmNode": {
9-
"presets": [["@babel/preset-env", { "targets": { "node": "10" }, "modules": false }]]
19+
"presets": [
20+
[
21+
"@babel/preset-env",
22+
{
23+
"targets": {
24+
"node": "10"
25+
},
26+
"modules": false
27+
}
28+
]
29+
]
1030
},
1131
"commonjsBrowser": {
12-
"presets": [["@babel/preset-env", { "modules": "commonjs" }]]
32+
"presets": [
33+
[
34+
"@babel/preset-env",
35+
{
36+
"targets": {
37+
"chrome": "49",
38+
"edge": "15",
39+
"firefox": "53",
40+
"safari": "11"
41+
},
42+
"bugfixes": true,
43+
"modules": "commonjs"
44+
}
45+
]
46+
]
1347
},
1448
"esmBrowser": {
15-
"presets": [["@babel/preset-env", { "modules": false }]]
49+
"presets": [
50+
[
51+
"@babel/preset-env",
52+
{
53+
"targets": {
54+
"chrome": "49",
55+
"edge": "15",
56+
"firefox": "53",
57+
"safari": "11"
58+
},
59+
"bugfixes": true,
60+
"modules": false
61+
}
62+
]
63+
]
1664
}
1765
}
1866
}

‎src/rng-browser.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ const rnds8 = new Uint8Array(16);
99
export default function rng() {
1010
// lazy load so that environments that need to polyfill have a chance to do so
1111
if (!getRandomValues) {
12-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
13-
// find the complete implementation of crypto (msCrypto) on IE11.
12+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
1413
getRandomValues =
15-
(typeof crypto !== 'undefined' &&
16-
crypto.getRandomValues &&
17-
crypto.getRandomValues.bind(crypto)) ||
18-
(typeof msCrypto !== 'undefined' &&
19-
typeof msCrypto.getRandomValues === 'function' &&
20-
msCrypto.getRandomValues.bind(msCrypto));
14+
typeof crypto !== 'undefined' &&
15+
crypto.getRandomValues &&
16+
crypto.getRandomValues.bind(crypto);
2117
if (!getRandomValues) {
2218
throw new Error(
2319
'crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'

‎wdio.conf.js

+20-34
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,26 @@ const commonCapabilities = {
1414
};
1515

1616
const capabilities = [
17-
// IE
18-
{
19-
'bstack:options': {
20-
os: 'Windows',
21-
osVersion: '10',
22-
...commonCapabilities,
23-
},
24-
browserName: 'IE',
25-
browserVersion: '11.0',
26-
},
27-
{
28-
'bstack:options': {
29-
...commonCapabilities,
30-
os: 'Windows',
31-
osVersion: '7',
32-
},
33-
browserName: 'IE',
34-
browserVersion: '11.0',
35-
},
36-
3717
// Chrome
38-
// Chrome 92 introduced native support for crypto.randomUUID
18+
// Latest
3919
{
4020
'bstack:options': {
4121
...commonCapabilities,
4222
os: 'Windows',
43-
osVersion: '10',
23+
osVersion: '11',
4424
},
4525
browserName: 'Chrome',
46-
browserVersion: '92.0',
26+
browserVersion: '103.0',
4727
},
28+
// Chrome 92 introduced native support for crypto.randomUUID
4829
{
4930
'bstack:options': {
5031
...commonCapabilities,
5132
os: 'Windows',
52-
osVersion: '10',
33+
osVersion: '11',
5334
},
5435
browserName: 'Chrome',
55-
browserVersion: '81.0',
36+
browserVersion: '92.0',
5637
},
5738
// Chrome 49 released on 2016-03-02 was the last version supported on Windows XP, Windows Vista, Mac OS X 10.6, 10.7, and 10.8
5839
{
@@ -66,35 +47,39 @@ const capabilities = [
6647
},
6748

6849
// Firefox
50+
// Latest
6951
{
7052
'bstack:options': {
7153
...commonCapabilities,
7254
os: 'Windows',
73-
osVersion: '10',
55+
osVersion: '11',
7456
},
7557
browserName: 'Firefox',
76-
browserVersion: '75.0',
58+
browserVersion: '103.0',
7759
},
60+
// Firefox 51 was the first Firefox to correctly support const/let
7861
{
7962
'bstack:options': {
8063
...commonCapabilities,
8164
os: 'Windows',
8265
osVersion: '10',
8366
},
8467
browserName: 'Firefox',
85-
browserVersion: '44.0',
68+
browserVersion: '51.0',
8669
},
8770

8871
// Edge
8972
{
9073
'bstack:options': {
9174
...commonCapabilities,
9275
os: 'Windows',
93-
osVersion: '10',
76+
osVersion: '11',
9477
},
9578
browserName: 'Edge',
96-
browserVersion: '81.0',
79+
browserVersion: '103.0',
9780
},
81+
// While Edge 12 already supported const/let, Edge 15 is the earliest Edge available on
82+
// Browserstack
9883
{
9984
'bstack:options': {
10085
...commonCapabilities,
@@ -110,19 +95,20 @@ const capabilities = [
11095
'bstack:options': {
11196
...commonCapabilities,
11297
os: 'OS X',
113-
osVersion: 'Catalina',
98+
osVersion: 'Monterey',
11499
},
115100
browserName: 'Safari',
116-
browserVersion: '13.0',
101+
browserVersion: '15.0',
117102
},
103+
// Safari 11 was the first Safari to correctly support const/let
118104
{
119105
'bstack:options': {
120106
...commonCapabilities,
121107
os: 'OS X',
122-
osVersion: 'Sierra',
108+
osVersion: 'High Sierra',
123109
},
124110
browserName: 'Safari',
125-
browserVersion: '10.0',
111+
browserVersion: '11.0',
126112
},
127113
];
128114

0 commit comments

Comments
 (0)
Please sign in to comment.