Skip to content

Commit 0f38cf1

Browse files
authored
feat!: drop node@16 support (#883)
1 parent 42b6178 commit 0f38cf1

File tree

21 files changed

+92
-363
lines changed

21 files changed

+92
-363
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
node-version: [16.x, 18.x, 20.x, 22.x, 24.x]
30+
node-version: [18.x, 20.x, 22.x, 24.x]
3131
steps:
3232
- uses: actions/checkout@v4
3333
- name: Use Node.js ${{ matrix.node-version }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
*.tgz
22
browserstack.err
33
dist/
4+
dist-browser/
45
.build/
56
local.log
67
logs/
78
node_modules/
8-
examples/**/package-lock.json
9+
examples/**/package-lock.json

README.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (form
88

99
- **Complete** - Support for all RFC9562 UUID versions
1010
- **Cross-platform** - Support for...
11-
- ESM & Common JS
1211
- [Typescript](#support)
1312
- [Chrome, Safari, Firefox, and Edge](#support)
1413
- [NodeJS](#support)
@@ -19,10 +18,8 @@ For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (form
1918

2019
<!-- prettier-ignore -->
2120
> [!NOTE]
22-
> `uuid@11` is now available: See the [CHANGELOG](./CHANGELOG.md) for details. TL;DR:
23-
> * TypeScript support is now included (remove `@types/uuid` from your dependencies)
24-
> * Subtle changes to how the `options` arg is interpreted for `v1()`, `v6()`, and `v7()`. [See details](#options-handling-for-timestamp-uuids)
25-
> * Binary UUIDs are now `Uint8Array`s. (May impact callers of `parse()`, `stringify()`, or that pass an `option#buf` argument to `v1()`-`v7()`.)
21+
>
22+
> As of `uuid@12` CommonJS is no longer supported. See [ESM Module FAQ](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
2623
2724
## Quickstart
2825

@@ -34,18 +31,10 @@ npm install uuid
3431

3532
**2. Create a UUID**
3633

37-
ESM-syntax (must use named exports):
38-
3934
```javascript
4035
import { v4 as uuidv4 } from 'uuid';
41-
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
42-
```
4336

44-
... CommonJS:
45-
46-
```javascript
47-
const { v4: uuidv4 } = require('uuid');
48-
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
37+
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
4938
```
5039

5140
For timestamp UUIDs, namespace UUIDs, and other options read on ...
@@ -198,7 +187,7 @@ Example:
198187
```javascript
199188
import { v1 as uuidv1 } from 'uuid';
200189

201-
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-9bdd-2b0d7b3dcb6d'
190+
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-9b5d-ab8dfbbd4bed'
202191
```
203192

204193
Example using `options`:
@@ -253,7 +242,7 @@ Example:
253242
```javascript
254243
import { v4 as uuidv4 } from 'uuid';
255244

256-
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
245+
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
257246
```
258247

259248
Example using predefined `random` values:
@@ -329,7 +318,7 @@ This method takes the same arguments as uuid.v1().
329318
```javascript
330319
import { v6 as uuidv6 } from 'uuid';
331320

332-
uuidv6(); // ⇨ '1e940672-c5ea-64c0-9b5d-ab8dfbbd4bed'
321+
uuidv6(); // ⇨ '1e940672-c5ea-64c1-9bdd-2b0d7b3dcb6d'
333322
```
334323

335324
Example using `options`:
@@ -376,7 +365,7 @@ Example:
376365
```javascript
377366
import { v7 as uuidv7 } from 'uuid';
378367

379-
uuidv7(); // ⇨ '01695553-c90c-705a-b56d-778dfbbd4bed'
368+
uuidv7(); // ⇨ '01695553-c90c-745a-b76f-770d7b3dcb6d'
380369
```
381370

382371
### ~~uuid.v8()~~
@@ -483,7 +472,7 @@ Prior to `uuid@11`, it was possible for `options` state to interfere with the in
483472

484473
**Browsers**: `uuid` [builds are tested](/uuidjs/uuid/blob/main/wdio.conf.js) against the latest version of desktop Chrome, Safari, Firefox, and Edge. Mobile versions of these same browsers are expected to work but aren't currently tested.
485474

486-
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. `node@18` is in maintainence mode, and `node@22` is the current LTS release. So `uuid` supports `node@16`-`node@22`.
475+
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. At the time of this writing `node@20` is the "maintenance" release and `node@24` is the "current" release, so `uuid` supports `node@18`-`node@24`.
487476

488477
**Typescript**: TS versions released within the past two years are supported. [source](https://github.com/microsoft/TypeScript/issues/49088#issuecomment-2468723715)
489478

README_js.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
```javascript --hide
2+
import crypto from 'crypto';
3+
24
runmd.onRequire = (path) => {
35
if (path == 'rng') return fun;
4-
return path.replace(/^uuid/, './dist/cjs/');
6+
return path.replace(/^uuid/, './dist/');
57
};
68

79
// Shim Date and crypto so generated ids are consistent across doc revisions
810
runmd.Date.now = () => 1551914748172;
911

1012
let seed = 0xdefaced;
11-
require('crypto').randomFillSync = function (a) {
12-
for (let i = 0; i < 16; i++) a[i] = (seed = (seed * 0x41a7) & 0x7fffffff) & 0xff;
13+
crypto.randomFillSync = function (a) {
14+
for (let i = 0; i < a.length; i++) a[i] = (seed = (seed * 0x41a7) & 0x7fffffff) & 0xff;
1315
return a;
1416
};
1517

1618
// Prevent usage of native randomUUID implementation to ensure deterministic UUIDs
17-
require('crypto').randomUUID = undefined;
19+
crypto.randomUUID = undefined;
1820
```
1921

2022
# uuid [![CI](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [![Browser](https://github.com/uuidjs/uuid/workflows/Browser/badge.svg)](https://github.com/uuidjs/uuid/actions/workflows/browser.yml)
@@ -23,7 +25,6 @@ For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (form
2325

2426
- **Complete** - Support for all RFC9562 UUID versions
2527
- **Cross-platform** - Support for...
26-
- ESM & Common JS
2728
- [Typescript](#support)
2829
- [Chrome, Safari, Firefox, and Edge](#support)
2930
- [NodeJS](#support)
@@ -34,10 +35,8 @@ For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (form
3435

3536
<!-- prettier-ignore -->
3637
> [!NOTE]
37-
> `uuid@11` is now available: See the [CHANGELOG](./CHANGELOG.md) for details. TL;DR:
38-
> * TypeScript support is now included (remove `@types/uuid` from your dependencies)
39-
> * Subtle changes to how the `options` arg is interpreted for `v1()`, `v6()`, and `v7()`. [See details](#options-handling-for-timestamp-uuids)
40-
> * Binary UUIDs are now `Uint8Array`s. (May impact callers of `parse()`, `stringify()`, or that pass an `option#buf` argument to `v1()`-`v7()`.)
38+
>
39+
> As of `uuid@12` CommonJS is no longer supported. See [ESM Module FAQ](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
4140
4241
## Quickstart
4342

@@ -49,17 +48,9 @@ npm install uuid
4948

5049
**2. Create a UUID**
5150

52-
ESM-syntax (must use named exports):
53-
5451
```javascript --run
5552
import { v4 as uuidv4 } from 'uuid';
56-
uuidv4(); // RESULT
57-
```
58-
59-
... CommonJS:
6053

61-
```javascript --run
62-
const { v4: uuidv4 } = require('uuid');
6354
uuidv4(); // RESULT
6455
```
6556

@@ -492,7 +483,7 @@ Prior to `uuid@11`, it was possible for `options` state to interfere with the in
492483

493484
**Browsers**: `uuid` [builds are tested](/uuidjs/uuid/blob/main/wdio.conf.js) against the latest version of desktop Chrome, Safari, Firefox, and Edge. Mobile versions of these same browsers are expected to work but aren't currently tested.
494485

495-
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. `node@18` is in maintainence mode, and `node@22` is the current LTS release. So `uuid` supports `node@16`-`node@22`.
486+
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. At the time of this writing `node@20` is the "maintenance" release and `node@24` is the "current" release, so `uuid` supports `node@18`-`node@24`.
496487

497488
**Typescript**: TS versions released within the past two years are supported. [source](https://github.com/microsoft/TypeScript/issues/49088#issuecomment-2468723715)
498489

examples/browser-rollup/rollup.config.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const { nodeResolve } = require('@rollup/plugin-node-resolve');
2-
const terser = require('@rollup/plugin-terser');
1+
import { nodeResolve } from '@rollup/plugin-node-resolve';
2+
import terser from '@rollup/plugin-terser';
33

44
const plugins = [nodeResolve({ browser: true }), terser()];
5-
module.exports = [
5+
export default [
66
{
77
input: './example-all.js',
88
output: {
@@ -44,47 +44,47 @@ module.exports = [
4444
input: './size-v1.js',
4545
output: {
4646
file: 'dist/v1-size.js',
47-
format: 'cjs',
47+
format: 'es',
4848
},
4949
plugins,
5050
},
5151
{
5252
input: './size-v3.js',
5353
output: {
5454
file: 'dist/v3-size.js',
55-
format: 'cjs',
55+
format: 'es',
5656
},
5757
plugins,
5858
},
5959
{
6060
input: './size-v4.js',
6161
output: {
6262
file: 'dist/v4-size.js',
63-
format: 'cjs',
63+
format: 'es',
6464
},
6565
plugins,
6666
},
6767
{
6868
input: './size-v5.js',
6969
output: {
7070
file: 'dist/v5-size.js',
71-
format: 'cjs',
71+
format: 'es',
7272
},
7373
plugins,
7474
},
7575
{
7676
input: './size-v6.js',
7777
output: {
7878
file: 'dist/v6-size.js',
79-
format: 'cjs',
79+
format: 'es',
8080
},
8181
plugins,
8282
},
8383
{
8484
input: './size-v7.js',
8585
output: {
8686
file: 'dist/v7-size.js',
87-
format: 'cjs',
87+
format: 'es',
8888
},
8989
plugins,
9090
},

examples/browser-webpack/example-all-require.html

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/browser-webpack/example-all-require.js

Lines changed: 0 additions & 96 deletions
This file was deleted.

examples/browser-webpack/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports = {
55
},
66
entry: {
77
all: './example-all.js',
8-
allRequire: './example-all-require.js',
98
v1: './example-v1.js',
109
v4: './example-v4.js',
1110
v7: './example-v7.js',

examples/node-commonjs/README.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)