uuid 7.0.0-beta.0 → 7.0.0
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/CHANGELOG.md +36 -0
- package/README.md +141 -127
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [7.0.0](https://github.com/uuidjs/uuid/compare/v3.4.0...v7.0.0) (2020-02-24)
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
- The default export, which used to be the v4() method
|
|
10
|
+
but which was already discouraged in v3.x of this library, has been
|
|
11
|
+
removed.
|
|
12
|
+
- Explicitly note that deep imports of the different uuid
|
|
13
|
+
version functions are deprecated and no longer encouraged and that
|
|
14
|
+
ECMAScript module named imports should be used instead.
|
|
15
|
+
Emit a deprecation warning for people who deep-require the different
|
|
16
|
+
algorithm variants.
|
|
17
|
+
- Remove builtin support for insecure random number
|
|
18
|
+
generators in the browser. Users who want that will have to supply their
|
|
19
|
+
own random number generator function.
|
|
20
|
+
- Remove support for generating v3 and v5 UUIDs in
|
|
21
|
+
Node.js<4.x
|
|
22
|
+
- Convert code base to ECMAScript Modules (ESM) and
|
|
23
|
+
release CommonJS build for node and ESM build for browser bundlers.
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
- add UMD build to npm package ([#357](https://github.com/uuidjs/uuid/issues/357)) ([4e75adf](https://github.com/uuidjs/uuid/commit/4e75adf435196f28e3fbbe0185d654b5ded7ca2c)), closes [#345](https://github.com/uuidjs/uuid/issues/345)
|
|
28
|
+
- add various es module and CommonJS examples ([b238510](https://github.com/uuidjs/uuid/commit/b238510bf352463521f74bab175a3af9b7a42555))
|
|
29
|
+
- ensure that docs are up-to-date in CI ([ee5e77d](https://github.com/uuidjs/uuid/commit/ee5e77db547474f5a8f23d6c857a6d399209986b))
|
|
30
|
+
- hybrid CommonJS & ECMAScript modules build ([a3f078f](https://github.com/uuidjs/uuid/commit/a3f078faa0baff69ab41aed08e041f8f9c8993d0))
|
|
31
|
+
- remove insecure fallback random number generator ([3a5842b](https://github.com/uuidjs/uuid/commit/3a5842b141a6e5de0ae338f391661e6b84b167c9)), closes [#173](https://github.com/uuidjs/uuid/issues/173)
|
|
32
|
+
- remove support for pre Node.js v4 Buffer API ([#356](https://github.com/uuidjs/uuid/issues/356)) ([b59b5c5](https://github.com/uuidjs/uuid/commit/b59b5c5ecad271c5453f1a156f011671f6d35627))
|
|
33
|
+
- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([c37a518](https://github.com/uuidjs/uuid/commit/c37a518e367ac4b6d0aa62dba1bc6ce9e85020f7)), closes [#338](https://github.com/uuidjs/uuid/issues/338)
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
- add deep-require proxies for local testing and adjust tests ([#365](https://github.com/uuidjs/uuid/issues/365)) ([7fedc79](https://github.com/uuidjs/uuid/commit/7fedc79ac8fda4bfd1c566c7f05ef4ac13b2db48))
|
|
38
|
+
- add note about removal of default export ([#372](https://github.com/uuidjs/uuid/issues/372)) ([12749b7](https://github.com/uuidjs/uuid/commit/12749b700eb49db8a9759fd306d8be05dbfbd58c)), closes [#370](https://github.com/uuidjs/uuid/issues/370)
|
|
39
|
+
- deprecated deep requiring of the different algorithm versions ([#361](https://github.com/uuidjs/uuid/issues/361)) ([c0bdf15](https://github.com/uuidjs/uuid/commit/c0bdf15e417639b1aeb0b247b2fb11f7a0a26b23))
|
|
40
|
+
|
|
5
41
|
## [3.4.0](https://github.com/uuidjs/uuid/compare/v3.3.3...v3.4.0) (2020-01-16)
|
|
6
42
|
|
|
7
43
|
### Features
|
package/README.md
CHANGED
|
@@ -4,47 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
# uuid [](https://github.com/uuidjs/uuid/actions)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs
|
|
10
|
+
- **Cross-platform** - Support for ...
|
|
11
|
+
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and UMD builds
|
|
12
|
+
- Node 8, 10, 12
|
|
13
|
+
- Chrome, Safari, Firefox, Edge, IE 11 browsers
|
|
14
|
+
- Webpack and rollup.js module bundlers
|
|
15
|
+
- **Secure** - Cryptographically-strong random values
|
|
16
|
+
- **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers
|
|
17
|
+
- **CLI** - Includes the [`uuid` command line](#command-line) utility
|
|
10
18
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
browser.
|
|
14
|
-
- Uses cryptographically-strong random number APIs
|
|
15
|
-
- Zero-dependency, small footprint
|
|
16
|
-
|
|
17
|
-
⚠️⚠️⚠️ This is the README of the upcoming major version of this library. You can still [access the README
|
|
18
|
-
of the current stable version](https://github.com/uuidjs/uuid/blob/v3.4.0/README.md). ⚠️⚠️⚠️
|
|
19
|
-
|
|
20
|
-
## Upgrading from v3.x of this Module
|
|
21
|
-
|
|
22
|
-
In v3.x of this library we were promoting the use of deep requires to reduce bundlesize for browser
|
|
23
|
-
builds:
|
|
24
|
-
|
|
25
|
-
```javascript
|
|
26
|
-
const uuidv4 = require('uuid/v4');
|
|
27
|
-
uuidv4();
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
As of v7.x this library has been converted to ECMAScript Modules and deep requires are now
|
|
31
|
-
deprecated and may be removed in a future major version of this library.
|
|
32
|
-
|
|
33
|
-
Since all modern bundlers like rollup or Webpack support tree-shaking for ECMAScript Modules out of
|
|
34
|
-
the box we now encourage you to use modern `import` syntax instead, see [ECMAScript Modules /
|
|
35
|
-
ESM](#ecmascript-modules--esm):
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
39
|
-
uuidv4();
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
For use as CommonJS module with Node.js you can use:
|
|
43
|
-
|
|
44
|
-
```javascript
|
|
45
|
-
const { v4: uuidv4 } = require('uuid');
|
|
46
|
-
uuidv4();
|
|
47
|
-
```
|
|
19
|
+
**Upgrading from uuid\@3?** Your code is probably okay, but check out [Upgrading
|
|
20
|
+
From uuid\@3](#upgrading-from-uuid3) for details.
|
|
48
21
|
|
|
49
22
|
## Quickstart - Node.js/CommonJS
|
|
50
23
|
|
|
@@ -52,92 +25,56 @@ uuidv4();
|
|
|
52
25
|
npm install uuid
|
|
53
26
|
```
|
|
54
27
|
|
|
55
|
-
|
|
28
|
+
Once installed, decide which type of UUID you need. RFC4122 provides for four
|
|
29
|
+
versions, all of which are supported here. In order of popularity, they are:
|
|
30
|
+
|
|
31
|
+
- Version 4 (random) - Created from cryptographically-strong random values
|
|
32
|
+
- Version 1 (timestamp) - Created from the system clock (plus random values)
|
|
33
|
+
- Version 5 (namespace, SHA-1) - Created from user-supplied name and namespace strings
|
|
34
|
+
- Version 3 (namespace, MD5) - Like version 5, above, but with a poorer hash algorithm
|
|
35
|
+
|
|
36
|
+
**Unsure which one to use?** Use version 4 (random) unless you have a specific need for one of the other versions. See also [this FAQ](https://github.com/tc39/proposal-uuid#faq).
|
|
56
37
|
|
|
57
|
-
Version 4 (
|
|
38
|
+
### Create Version 4 (Random) UUIDs
|
|
58
39
|
|
|
59
40
|
```javascript
|
|
60
41
|
import { v4 as uuidv4 } from 'uuid';
|
|
61
42
|
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
|
62
43
|
```
|
|
63
44
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Version 1 (timestamp):
|
|
45
|
+
### Create Version 1 (Timestamp) UUIDs
|
|
67
46
|
|
|
68
47
|
```javascript
|
|
69
48
|
import { v1 as uuidv1 } from 'uuid';
|
|
70
49
|
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8b2d-1b9d6bcdbbfd'
|
|
71
50
|
```
|
|
72
51
|
|
|
73
|
-
Version 3 (
|
|
52
|
+
### Create Version 3 or Version 5 (Namespace) UUIDs
|
|
74
53
|
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
⚠️ Version 3 and Version 5 UUIDs are basically the same, differing
|
|
55
|
+
only in the underlying hash algorithm. Note that per the RFC, "_If backward
|
|
56
|
+
compatibility is not an issue, SHA-1 [Version 5] is preferred_."
|
|
77
57
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// ... using predefined URL namespace (for, well, URLs)
|
|
82
|
-
uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
|
|
83
|
-
|
|
84
|
-
// ... using a custom namespace
|
|
85
|
-
//
|
|
86
|
-
// Note: Custom namespaces should be a UUID string specific to your application!
|
|
87
|
-
// E.g. the one here was generated using this modules `uuid` CLI.
|
|
88
|
-
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
89
|
-
uuidv3('Hello, World!', MY_NAMESPACE); // ⇨ 'e8b5a51d-11c8-3310-a6ab-367563f20686'
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Version 5 (namespace):
|
|
58
|
+
⚠️ If using a custom namespace **be sure to generate your own
|
|
59
|
+
namespace UUID**. You can grab one [here](https://www.uuidgenerator.net/).
|
|
93
60
|
|
|
94
61
|
```javascript
|
|
95
|
-
import { v5 as uuidv5 } from 'uuid';
|
|
62
|
+
import { v5 as uuidv5 } from 'uuid'; // For version 5
|
|
63
|
+
import { v3 as uuidv3 } from 'uuid'; // For version 3
|
|
96
64
|
|
|
97
|
-
//
|
|
65
|
+
// Using predefined DNS namespace (for domain names)
|
|
98
66
|
uuidv5('hello.example.com', uuidv5.DNS); // ⇨ 'fdda765f-fc57-5604-a269-52a7df8164ec'
|
|
67
|
+
uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
|
|
99
68
|
|
|
100
|
-
//
|
|
69
|
+
// Using predefined URL namespace (for URLs)
|
|
101
70
|
uuidv5('http://example.com/hello', uuidv5.URL); // ⇨ '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'
|
|
71
|
+
uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
|
|
102
72
|
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
// Note: Custom namespaces should be a UUID string specific to your application!
|
|
106
|
-
// E.g. the one here was generated using this modules `uuid` CLI.
|
|
73
|
+
// Using a custom namespace (See note, above, about generating your own
|
|
74
|
+
// namespace UUID)
|
|
107
75
|
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
108
76
|
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
## Supported Platforms
|
|
112
|
-
|
|
113
|
-
- Node.js: All LTS, i.e. 8.x, 10.x, 12.x
|
|
114
|
-
- Browsers (with bundlers like webpack/rollup):
|
|
115
|
-
- Chrome: >= 49
|
|
116
|
-
- Safari: >= 10
|
|
117
|
-
- Firefox: >= 44
|
|
118
|
-
- Edge: >= 15
|
|
119
|
-
- IE: 11
|
|
120
|
-
|
|
121
|
-
## ECMAScript Modules / ESM
|
|
122
|
-
|
|
123
|
-
For usage in the browser `uuid` provides support for [ECMAScript
|
|
124
|
-
Modules](https://www.ecma-international.org/ecma-262/6.0/#sec-modules) (ESM) that enable
|
|
125
|
-
tree-shaking for bundlers, like [rollup.js](https://rollupjs.org/guide/en/#tree-shaking)
|
|
126
|
-
([example](./examples/browser-rollup/)) and [webpack](https://webpack.js.org/guides/tree-shaking/)
|
|
127
|
-
([example](./examples/browser-webpack/)).
|
|
128
|
-
|
|
129
|
-
```javascript
|
|
130
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
131
|
-
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
There is experimental native ESM support for [the browser](./examples/browser-esmodules/) but it
|
|
135
|
-
should not be considered ready for production use and may change or disappear in future releases.
|
|
136
|
-
|
|
137
|
-
To run the examples you must first create a dist build of this library in the module root:
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
npm run build
|
|
77
|
+
uuidv3('Hello, World!', MY_NAMESPACE); // ⇨ 'e8b5a51d-11c8-3310-a6ab-367563f20686'
|
|
141
78
|
```
|
|
142
79
|
|
|
143
80
|
## API
|
|
@@ -153,7 +90,7 @@ uuidv4(options);
|
|
|
153
90
|
uuidv4(options, buffer, offset);
|
|
154
91
|
```
|
|
155
92
|
|
|
156
|
-
Generate and return a RFC4122
|
|
93
|
+
Generate and return a RFC4122 version 4 UUID.
|
|
157
94
|
|
|
158
95
|
- `options` - (Object) Optional uuid state to apply. Properties may include:
|
|
159
96
|
- `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values. Takes precedence over `options.rng`.
|
|
@@ -209,11 +146,7 @@ uuidv4(null, buffer, 16); // ⇨
|
|
|
209
146
|
// ]
|
|
210
147
|
```
|
|
211
148
|
|
|
212
|
-
### Version 1 (Timestamp
|
|
213
|
-
|
|
214
|
-
⚠️⚠️⚠️ **Please make sure to check whether you really need the timestamp properties of Version 1 UUIDs
|
|
215
|
-
before using them. In many cases, Version 4 random UUIDs are the better choice. [This
|
|
216
|
-
FAQ](https://github.com/tc39/proposal-uuid#faq) covers more details.** ⚠️⚠️⚠️
|
|
149
|
+
### Version 1 (Timestamp)
|
|
217
150
|
|
|
218
151
|
```javascript
|
|
219
152
|
import { v1 as uuidv1 } from 'uuid';
|
|
@@ -224,7 +157,7 @@ uuidv1(options);
|
|
|
224
157
|
uuidv1(options, buffer, offset);
|
|
225
158
|
```
|
|
226
159
|
|
|
227
|
-
Generate and return a RFC4122
|
|
160
|
+
Generate and return a RFC4122 version 1 (timestamp) UUID.
|
|
228
161
|
|
|
229
162
|
- `options` - (Object) Optional uuid state to apply. Properties may include:
|
|
230
163
|
- `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.
|
|
@@ -273,18 +206,18 @@ uuidv1(null, arr, 16); // ⇨
|
|
|
273
206
|
// ]
|
|
274
207
|
```
|
|
275
208
|
|
|
276
|
-
### Version
|
|
209
|
+
### Version 5 (Namespace)
|
|
277
210
|
|
|
278
211
|
```javascript
|
|
279
|
-
import {
|
|
212
|
+
import { v5 as uuidv5 } from 'uuid';
|
|
280
213
|
|
|
281
214
|
// Incantations
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
215
|
+
uuidv5(name, namespace);
|
|
216
|
+
uuidv5(name, namespace, buffer);
|
|
217
|
+
uuidv5(name, namespace, buffer, offset);
|
|
285
218
|
```
|
|
286
219
|
|
|
287
|
-
Generate and return a RFC4122
|
|
220
|
+
Generate and return a RFC4122 version 5 UUID.
|
|
288
221
|
|
|
289
222
|
- `name` - (String | Array[]) "name" to create UUID with
|
|
290
223
|
- `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
|
|
@@ -296,21 +229,23 @@ Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
|
296
229
|
Example:
|
|
297
230
|
|
|
298
231
|
```javascript
|
|
299
|
-
|
|
232
|
+
uuidv5('hello world', MY_NAMESPACE); // ⇨ '9f282611-e0fd-5650-8953-89c8e342da0b'
|
|
300
233
|
```
|
|
301
234
|
|
|
302
|
-
### Version
|
|
235
|
+
### Version 3 (Namespace)
|
|
236
|
+
|
|
237
|
+
⚠️ Note: Per the RFC, "_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_."
|
|
303
238
|
|
|
304
239
|
```javascript
|
|
305
|
-
import {
|
|
240
|
+
import { v3 as uuidv3 } from 'uuid';
|
|
306
241
|
|
|
307
242
|
// Incantations
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
243
|
+
uuidv3(name, namespace);
|
|
244
|
+
uuidv3(name, namespace, buffer);
|
|
245
|
+
uuidv3(name, namespace, buffer, offset);
|
|
311
246
|
```
|
|
312
247
|
|
|
313
|
-
Generate and return a RFC4122
|
|
248
|
+
Generate and return a RFC4122 version 3 UUID.
|
|
314
249
|
|
|
315
250
|
- `name` - (String | Array[]) "name" to create UUID with
|
|
316
251
|
- `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
|
|
@@ -322,24 +257,58 @@ Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
|
322
257
|
Example:
|
|
323
258
|
|
|
324
259
|
```javascript
|
|
325
|
-
|
|
260
|
+
uuidv3('hello world', MY_NAMESPACE); // ⇨ '042ffd34-d989-321c-ad06-f60826172424'
|
|
326
261
|
```
|
|
327
262
|
|
|
328
263
|
## Command Line
|
|
329
264
|
|
|
330
|
-
UUIDs can be generated from the command line
|
|
265
|
+
UUIDs can be generated from the command line using `uuid`.
|
|
331
266
|
|
|
332
267
|
```shell
|
|
333
268
|
$ uuid
|
|
334
269
|
ddeb27fb-d9a0-4624-be4d-4615062daed4
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details:
|
|
335
273
|
|
|
336
|
-
$ uuid v1
|
|
337
|
-
02d37060-d446-11e7-a9fa-7bdae751ebe1
|
|
338
274
|
```
|
|
275
|
+
$ uuid --help
|
|
276
|
+
|
|
277
|
+
Usage:
|
|
278
|
+
uuid
|
|
279
|
+
uuid v1
|
|
280
|
+
uuid v3 <name> <namespace uuid>
|
|
281
|
+
uuid v4
|
|
282
|
+
uuid v5 <name> <namespace uuid>
|
|
283
|
+
uuid --help
|
|
284
|
+
|
|
285
|
+
Note: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs
|
|
286
|
+
defined by RFC4122
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## ECMAScript Modules
|
|
290
|
+
|
|
291
|
+
For usage in the browser `uuid` provides support for [ECMAScript
|
|
292
|
+
Modules](https://www.ecma-international.org/ecma-262/6.0/#sec-modules) (ESM) that enable
|
|
293
|
+
tree-shaking for bundlers, like [rollup.js](https://rollupjs.org/guide/en/#tree-shaking)
|
|
294
|
+
([example](./examples/browser-rollup/)) and [webpack](https://webpack.js.org/guides/tree-shaking/)
|
|
295
|
+
([example](./examples/browser-webpack/)).
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
299
|
+
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
There is experimental native ESM support for [the browser](./examples/browser-esmodules/) but it
|
|
303
|
+
should not be considered ready for production use and may change or disappear in future releases.
|
|
339
304
|
|
|
340
|
-
|
|
305
|
+
To run the examples you must first create a dist build of this library in the module root:
|
|
341
306
|
|
|
342
|
-
|
|
307
|
+
```
|
|
308
|
+
npm run build
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## UMD Builds
|
|
343
312
|
|
|
344
313
|
If you want to load a minified UMD build directly in the browser you can use one of the popular npm
|
|
345
314
|
CDNs:
|
|
@@ -365,5 +334,50 @@ Available bundles:
|
|
|
365
334
|
- https://unpkg.com/uuid@latest/dist/umd/
|
|
366
335
|
- https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/
|
|
367
336
|
|
|
337
|
+
## Upgrading From uuid\@3
|
|
338
|
+
|
|
339
|
+
"_Wait... what happened to uuid\@4 - uuid\@6?!?_"
|
|
340
|
+
|
|
341
|
+
In order to avoid confusion with RFC [version 4](#version-4-random) and [version
|
|
342
|
+
5](#version-5-namespace) UUIDs, and a possible [version
|
|
343
|
+
6](http://gh.peabody.io/uuidv6/), releases 4 thru 6 of this module have been
|
|
344
|
+
skipped. Hence, how we're now at uuid\@7.
|
|
345
|
+
|
|
346
|
+
### Deep Requires Now Deprecated
|
|
347
|
+
|
|
348
|
+
uuid\@3 encouraged the use of deep requires to minimize the bundle size of
|
|
349
|
+
browser builds:
|
|
350
|
+
|
|
351
|
+
```javascript
|
|
352
|
+
const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED!
|
|
353
|
+
uuidv4();
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
As of uuid\@7 this library now provides ECMAScript modules builds, which allow
|
|
357
|
+
packagers like Webpack and Rollup to do "tree-shaking" to remove dead code.
|
|
358
|
+
Instead, use the `import` syntax:
|
|
359
|
+
|
|
360
|
+
```javascript
|
|
361
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
362
|
+
uuidv4();
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
... or for CommonJS:
|
|
366
|
+
|
|
367
|
+
```javascript
|
|
368
|
+
const { v4: uuidv4 } = require('uuid');
|
|
369
|
+
uuidv4();
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Default Export Removed
|
|
373
|
+
|
|
374
|
+
uuid\@3 was exporting the Version 4 UUID method as a default export:
|
|
375
|
+
|
|
376
|
+
```javascript
|
|
377
|
+
const uuid = require('uuid'); // <== REMOVED!
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
This usage pattern was already discouraged in uuid\@3 and has been removed in uuid\@7.
|
|
381
|
+
|
|
368
382
|
----
|
|
369
383
|
Markdown generated from [README_js.md](README_js.md) by [](https://github.com/broofa/runmd)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uuid",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
|
5
5
|
"commitlint": {
|
|
6
6
|
"extends": [
|
|
@@ -31,30 +31,30 @@
|
|
|
31
31
|
"v5.js"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@babel/cli": "7.8.
|
|
35
|
-
"@babel/core": "7.8.
|
|
36
|
-
"@babel/preset-env": "7.8.
|
|
34
|
+
"@babel/cli": "7.8.4",
|
|
35
|
+
"@babel/core": "7.8.4",
|
|
36
|
+
"@babel/preset-env": "7.8.4",
|
|
37
37
|
"@commitlint/cli": "8.3.5",
|
|
38
38
|
"@commitlint/config-conventional": "8.3.4",
|
|
39
39
|
"babel-eslint": "10.0.3",
|
|
40
40
|
"babel-plugin-add-module-exports": "1.0.2",
|
|
41
|
-
"browserstack-local": "1.4.
|
|
41
|
+
"browserstack-local": "1.4.5",
|
|
42
42
|
"bundlewatch": "0.2.5",
|
|
43
43
|
"eslint": "6.8.0",
|
|
44
|
-
"eslint-config-prettier": "6.
|
|
44
|
+
"eslint-config-prettier": "6.10.0",
|
|
45
45
|
"eslint-plugin-prettier": "3.1.2",
|
|
46
46
|
"esm": "3.2.25",
|
|
47
47
|
"http-server": "0.12.1",
|
|
48
48
|
"husky": "3.0.9",
|
|
49
|
-
"jest": "
|
|
50
|
-
"lint-staged": "10.0.
|
|
49
|
+
"jest": "25.1.0",
|
|
50
|
+
"lint-staged": "10.0.7",
|
|
51
51
|
"npm-run-all": "4.1.5",
|
|
52
52
|
"prettier": "1.19.1",
|
|
53
|
-
"rollup": "1.
|
|
53
|
+
"rollup": "1.31.1",
|
|
54
54
|
"rollup-plugin-terser": "5.2.0",
|
|
55
55
|
"runmd": "1.3.2",
|
|
56
56
|
"selenium-webdriver": "3.6.0",
|
|
57
|
-
"standard-version": "7.0
|
|
57
|
+
"standard-version": "7.1.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"examples:browser-webpack:build": "cd examples/browser-webpack && npm install && npm run build",
|