uuid 7.0.0-beta.0 → 7.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,57 @@
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.2](https://github.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04)
6
+
7
+ ### Bug Fixes
8
+
9
+ - make access to msCrypto consistent ([#393](https://github.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://github.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c))
10
+ - simplify link in deprecation warning ([#391](https://github.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://github.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7))
11
+ - update links to match content in readme ([#386](https://github.com/uuidjs/uuid/issues/386)) ([44f2f86](https://github.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4))
12
+
13
+ ### [7.0.1](https://github.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25)
14
+
15
+ ### Bug Fixes
16
+
17
+ - clean up esm builds for node and browser ([#383](https://github.com/uuidjs/uuid/issues/383)) ([59e6a49](https://github.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc))
18
+ - provide browser versions independent from module system ([#380](https://github.com/uuidjs/uuid/issues/380)) ([4344a22](https://github.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#378](https://github.com/uuidjs/uuid/issues/378)
19
+
20
+ ## [7.0.0](https://github.com/uuidjs/uuid/compare/v3.4.0...v7.0.0) (2020-02-24)
21
+
22
+ ### ⚠ BREAKING CHANGES
23
+
24
+ - The default export, which used to be the v4() method
25
+ but which was already discouraged in v3.x of this library, has been
26
+ removed.
27
+ - Explicitly note that deep imports of the different uuid
28
+ version functions are deprecated and no longer encouraged and that
29
+ ECMAScript module named imports should be used instead.
30
+ Emit a deprecation warning for people who deep-require the different
31
+ algorithm variants.
32
+ - Remove builtin support for insecure random number
33
+ generators in the browser. Users who want that will have to supply their
34
+ own random number generator function.
35
+ - Remove support for generating v3 and v5 UUIDs in
36
+ Node.js<4.x
37
+ - Convert code base to ECMAScript Modules (ESM) and
38
+ release CommonJS build for node and ESM build for browser bundlers.
39
+
40
+ ### Features
41
+
42
+ - 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)
43
+ - add various es module and CommonJS examples ([b238510](https://github.com/uuidjs/uuid/commit/b238510bf352463521f74bab175a3af9b7a42555))
44
+ - ensure that docs are up-to-date in CI ([ee5e77d](https://github.com/uuidjs/uuid/commit/ee5e77db547474f5a8f23d6c857a6d399209986b))
45
+ - hybrid CommonJS & ECMAScript modules build ([a3f078f](https://github.com/uuidjs/uuid/commit/a3f078faa0baff69ab41aed08e041f8f9c8993d0))
46
+ - remove insecure fallback random number generator ([3a5842b](https://github.com/uuidjs/uuid/commit/3a5842b141a6e5de0ae338f391661e6b84b167c9)), closes [#173](https://github.com/uuidjs/uuid/issues/173)
47
+ - 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))
48
+ - 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)
49
+
50
+ ### Bug Fixes
51
+
52
+ - 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))
53
+ - 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)
54
+ - deprecated deep requiring of the different algorithm versions ([#361](https://github.com/uuidjs/uuid/issues/361)) ([c0bdf15](https://github.com/uuidjs/uuid/commit/c0bdf15e417639b1aeb0b247b2fb11f7a0a26b23))
55
+
5
56
  ## [3.4.0](https://github.com/uuidjs/uuid/compare/v3.3.3...v3.4.0) (2020-01-16)
6
57
 
7
58
  ### Features
package/README.md CHANGED
@@ -4,47 +4,21 @@
4
4
 
5
5
  # uuid [![Build Status](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions)
6
6
 
7
- Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs.
8
-
9
- Features:
10
-
11
- - Support for version 1, 3, 4 and 5 UUIDs
12
- - Cross-platform: CommonJS build for Node.js and [ECMAScript Modules](#ecmascript-modules) for the
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
- ```
7
+ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs
8
+
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
+ - [React Native](#react-native)
16
+ - **Secure** - Cryptographically-strong random values
17
+ - **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers
18
+ - **CLI** - Includes the [`uuid` command line](#command-line) utility
19
+
20
+ **Upgrading from uuid\@3?** Your code is probably okay, but check out [Upgrading
21
+ From uuid\@3](#upgrading-from-uuid3) for details.
48
22
 
49
23
  ## Quickstart - Node.js/CommonJS
50
24
 
@@ -52,92 +26,56 @@ uuidv4();
52
26
  npm install uuid
53
27
  ```
54
28
 
55
- Then generate a random UUID (v4 algorithm), which is almost always what you want ...
29
+ Once installed, decide which type of UUID you need. RFC4122 provides for four
30
+ versions, all of which are supported here. In order of popularity, they are:
31
+
32
+ - Version 4 (random) - Created from cryptographically-strong random values
33
+ - Version 1 (timestamp) - Created from the system clock (plus random values)
34
+ - Version 5 (namespace, SHA-1) - Created from user-supplied name and namespace strings
35
+ - Version 3 (namespace, MD5) - Like version 5, above, but with a poorer hash algorithm
36
+
37
+ **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
38
 
57
- Version 4 (random):
39
+ ### Create Version 4 (Random) UUIDs
58
40
 
59
41
  ```javascript
60
42
  import { v4 as uuidv4 } from 'uuid';
61
43
  uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
62
44
  ```
63
45
 
64
- Or generate UUIDs with other algorithms of your choice ...
65
-
66
- Version 1 (timestamp):
46
+ ### Create Version 1 (Timestamp) UUIDs
67
47
 
68
48
  ```javascript
69
49
  import { v1 as uuidv1 } from 'uuid';
70
50
  uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8b2d-1b9d6bcdbbfd'
71
51
  ```
72
52
 
73
- Version 3 (namespace):
74
-
75
- ```javascript
76
- import { v3 as uuidv3 } from 'uuid';
77
-
78
- // ... using predefined DNS namespace (for domain names)
79
- uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
53
+ ### Create Version 3 or Version 5 (Namespace) UUIDs
80
54
 
81
- // ... using predefined URL namespace (for, well, URLs)
82
- uuidv3('http://example.com/hello', uuidv3.URL); // 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
55
+ &#x26a0;&#xfe0f; Version 3 and Version 5 UUIDs are basically the same, differing
56
+ only in the underlying hash algorithm. Note that per the RFC, "_If backward
57
+ compatibility is not an issue, SHA-1 [Version 5] is preferred_."
83
58
 
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):
59
+ &#x26a0;&#xfe0f; If using a custom namespace **be sure to generate your own
60
+ namespace UUID**. You can grab one [here](https://www.uuidgenerator.net/).
93
61
 
94
62
  ```javascript
95
- import { v5 as uuidv5 } from 'uuid';
63
+ import { v5 as uuidv5 } from 'uuid'; // For version 5
64
+ import { v3 as uuidv3 } from 'uuid'; // For version 3
96
65
 
97
- // ... using predefined DNS namespace (for domain names)
66
+ // Using predefined DNS namespace (for domain names)
98
67
  uuidv5('hello.example.com', uuidv5.DNS); // ⇨ 'fdda765f-fc57-5604-a269-52a7df8164ec'
68
+ uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
99
69
 
100
- // ... using predefined URL namespace (for, well, URLs)
70
+ // Using predefined URL namespace (for URLs)
101
71
  uuidv5('http://example.com/hello', uuidv5.URL); // ⇨ '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'
72
+ uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
102
73
 
103
- // ... using a custom namespace
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.
74
+ // Using a custom namespace (See note, above, about generating your own
75
+ // namespace UUID)
107
76
  const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
108
77
  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
78
+ uuidv3('Hello, World!', MY_NAMESPACE); // ⇨ 'e8b5a51d-11c8-3310-a6ab-367563f20686'
141
79
  ```
142
80
 
143
81
  ## API
@@ -153,7 +91,7 @@ uuidv4(options);
153
91
  uuidv4(options, buffer, offset);
154
92
  ```
155
93
 
156
- Generate and return a RFC4122 v4 UUID.
94
+ Generate and return a RFC4122 version 4 UUID.
157
95
 
158
96
  - `options` - (Object) Optional uuid state to apply. Properties may include:
159
97
  - `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values. Takes precedence over `options.rng`.
@@ -209,11 +147,7 @@ uuidv4(null, buffer, 16); // ⇨
209
147
  // ]
210
148
  ```
211
149
 
212
- ### Version 1 (Timestamp + Node)
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.** ⚠️⚠️⚠️
150
+ ### Version 1 (Timestamp)
217
151
 
218
152
  ```javascript
219
153
  import { v1 as uuidv1 } from 'uuid';
@@ -224,7 +158,7 @@ uuidv1(options);
224
158
  uuidv1(options, buffer, offset);
225
159
  ```
226
160
 
227
- Generate and return a RFC4122 v1 (timestamp-based) UUID.
161
+ Generate and return a RFC4122 version 1 (timestamp) UUID.
228
162
 
229
163
  - `options` - (Object) Optional uuid state to apply. Properties may include:
230
164
  - `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.
@@ -273,18 +207,18 @@ uuidv1(null, arr, 16); // ⇨
273
207
  // ]
274
208
  ```
275
209
 
276
- ### Version 3 (Namespace)
210
+ ### Version 5 (Namespace)
277
211
 
278
212
  ```javascript
279
- import { v3 as uuidv3 } from 'uuid';
213
+ import { v5 as uuidv5 } from 'uuid';
280
214
 
281
215
  // Incantations
282
- uuidv3(name, namespace);
283
- uuidv3(name, namespace, buffer);
284
- uuidv3(name, namespace, buffer, offset);
216
+ uuidv5(name, namespace);
217
+ uuidv5(name, namespace, buffer);
218
+ uuidv5(name, namespace, buffer, offset);
285
219
  ```
286
220
 
287
- Generate and return a RFC4122 v3 UUID.
221
+ Generate and return a RFC4122 version 5 UUID.
288
222
 
289
223
  - `name` - (String | Array[]) "name" to create UUID with
290
224
  - `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
@@ -296,21 +230,23 @@ Returns `buffer`, if specified, otherwise the string form of the UUID
296
230
  Example:
297
231
 
298
232
  ```javascript
299
- uuidv3('hello world', MY_NAMESPACE); // ⇨ '042ffd34-d989-321c-ad06-f60826172424'
233
+ uuidv5('hello world', MY_NAMESPACE); // ⇨ '9f282611-e0fd-5650-8953-89c8e342da0b'
300
234
  ```
301
235
 
302
- ### Version 5 (Namespace)
236
+ ### Version 3 (Namespace)
237
+
238
+ &#x26a0;&#xfe0f; Note: Per the RFC, "_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_."
303
239
 
304
240
  ```javascript
305
- import { v5 as uuidv5 } from 'uuid';
241
+ import { v3 as uuidv3 } from 'uuid';
306
242
 
307
243
  // Incantations
308
- uuidv5(name, namespace);
309
- uuidv5(name, namespace, buffer);
310
- uuidv5(name, namespace, buffer, offset);
244
+ uuidv3(name, namespace);
245
+ uuidv3(name, namespace, buffer);
246
+ uuidv3(name, namespace, buffer, offset);
311
247
  ```
312
248
 
313
- Generate and return a RFC4122 v5 UUID.
249
+ Generate and return a RFC4122 version 3 UUID.
314
250
 
315
251
  - `name` - (String | Array[]) "name" to create UUID with
316
252
  - `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
@@ -322,24 +258,58 @@ Returns `buffer`, if specified, otherwise the string form of the UUID
322
258
  Example:
323
259
 
324
260
  ```javascript
325
- uuidv5('hello world', MY_NAMESPACE); // ⇨ '9f282611-e0fd-5650-8953-89c8e342da0b'
261
+ uuidv3('hello world', MY_NAMESPACE); // ⇨ '042ffd34-d989-321c-ad06-f60826172424'
326
262
  ```
327
263
 
328
264
  ## Command Line
329
265
 
330
- UUIDs can be generated from the command line with the `uuid` command.
266
+ UUIDs can be generated from the command line using `uuid`.
331
267
 
332
268
  ```shell
333
269
  $ uuid
334
270
  ddeb27fb-d9a0-4624-be4d-4615062daed4
271
+ ```
335
272
 
336
- $ uuid v1
337
- 02d37060-d446-11e7-a9fa-7bdae751ebe1
273
+ The default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details:
274
+
275
+ ```
276
+ $ uuid --help
277
+
278
+ Usage:
279
+ uuid
280
+ uuid v1
281
+ uuid v3 <name> <namespace uuid>
282
+ uuid v4
283
+ uuid v5 <name> <namespace uuid>
284
+ uuid --help
285
+
286
+ Note: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs
287
+ defined by RFC4122
338
288
  ```
339
289
 
340
- Type `uuid --help` for usage details
290
+ ## ECMAScript Modules
291
+
292
+ For usage in the browser `uuid` provides support for [ECMAScript
293
+ Modules](https://www.ecma-international.org/ecma-262/6.0/#sec-modules) (ESM) that enable
294
+ tree-shaking for bundlers, like [rollup.js](https://rollupjs.org/guide/en/#tree-shaking)
295
+ ([example](./examples/browser-rollup/)) and [webpack](https://webpack.js.org/guides/tree-shaking/)
296
+ ([example](./examples/browser-webpack/)).
297
+
298
+ ```javascript
299
+ import { v4 as uuidv4 } from 'uuid';
300
+ uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
301
+ ```
302
+
303
+ There is experimental native ESM support for [the browser](./examples/browser-esmodules/) but it
304
+ should not be considered ready for production use and may change or disappear in future releases.
305
+
306
+ To run the examples you must first create a dist build of this library in the module root:
307
+
308
+ ```
309
+ npm run build
310
+ ```
341
311
 
342
- ## UMD Build
312
+ ## UMD Builds
343
313
 
344
314
  If you want to load a minified UMD build directly in the browser you can use one of the popular npm
345
315
  CDNs:
@@ -365,5 +335,72 @@ Available bundles:
365
335
  - https://unpkg.com/uuid@latest/dist/umd/
366
336
  - https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/
367
337
 
338
+ ## "getRandomValues() not supported"
339
+
340
+ This error occurs in environments where the standard
341
+ [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)
342
+ API is not supported. This issue can be resolved by adding an appropriate polyfill:
343
+
344
+ ### React Native
345
+
346
+ 1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)
347
+ 1. Import it before `uuid`:
348
+
349
+ ```javascript
350
+ import 'react-native-get-random-values';
351
+ import { v4 as uuidv4 } from 'uuid';
352
+ ```
353
+
354
+ ### Web Workers / Service Workers (Edge <= 18)
355
+
356
+ [In Edge <= 18, Web Crypto is not supported in Web Workers or Service
357
+ Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if
358
+ you find one, please).
359
+
360
+ ## Upgrading From uuid\@3
361
+
362
+ "_Wait... what happened to uuid\@4 - uuid\@6?!?_"
363
+
364
+ In order to avoid confusion with RFC [version 4](#version-4-random) and [version
365
+ 5](#version-5-namespace) UUIDs, and a possible [version
366
+ 6](http://gh.peabody.io/uuidv6/), releases 4 thru 6 of this module have been
367
+ skipped. Hence, how we're now at uuid\@7.
368
+
369
+ ### Deep Requires Now Deprecated
370
+
371
+ uuid\@3 encouraged the use of deep requires to minimize the bundle size of
372
+ browser builds:
373
+
374
+ ```javascript
375
+ const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED!
376
+ uuidv4();
377
+ ```
378
+
379
+ As of uuid\@7 this library now provides ECMAScript modules builds, which allow
380
+ packagers like Webpack and Rollup to do "tree-shaking" to remove dead code.
381
+ Instead, use the `import` syntax:
382
+
383
+ ```javascript
384
+ import { v4 as uuidv4 } from 'uuid';
385
+ uuidv4();
386
+ ```
387
+
388
+ ... or for CommonJS:
389
+
390
+ ```javascript
391
+ const { v4: uuidv4 } = require('uuid');
392
+ uuidv4();
393
+ ```
394
+
395
+ ### Default Export Removed
396
+
397
+ uuid\@3 was exporting the Version 4 UUID method as a default export:
398
+
399
+ ```javascript
400
+ const uuid = require('uuid'); // <== REMOVED!
401
+ ```
402
+
403
+ This usage pattern was already discouraged in uuid\@3 and has been removed in uuid\@7.
404
+
368
405
  ----
369
406
  Markdown generated from [README_js.md](README_js.md) by [![RunMD Logo](http://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd)
@@ -3,12 +3,12 @@
3
3
  // generators (like Math.random()).
4
4
  // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
5
5
  // find the complete implementation of crypto (msCrypto) on IE11.
6
- var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
6
+ var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
7
7
  var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
8
8
 
9
9
  export default function rng() {
10
10
  if (!getRandomValues) {
11
- throw new Error('uuid: This browser does not seem to support crypto.getRandomValues(). If you need to support this browser, please provide a custom random number generator through options.rng.');
11
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
12
12
  }
13
13
 
14
14
  return getRandomValues(rnds8);
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Convert array of 16 byte values to UUID string format of the form:
3
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
4
+ */
5
+ var byteToHex = [];
6
+
7
+ for (var i = 0; i < 256; ++i) {
8
+ byteToHex[i] = (i + 0x100).toString(16).substr(1);
9
+ }
10
+
11
+ function bytesToUuid(buf, offset) {
12
+ var i = offset || 0;
13
+ var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
14
+
15
+ return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
16
+ }
17
+
18
+ export default bytesToUuid;
@@ -0,0 +1,4 @@
1
+ export { default as v1 } from './v1.js';
2
+ export { default as v3 } from './v3.js';
3
+ export { default as v4 } from './v4.js';
4
+ export { default as v5 } from './v5.js';
@@ -0,0 +1,13 @@
1
+ import crypto from 'crypto';
2
+
3
+ function md5(bytes) {
4
+ if (Array.isArray(bytes)) {
5
+ bytes = Buffer.from(bytes);
6
+ } else if (typeof bytes === 'string') {
7
+ bytes = Buffer.from(bytes, 'utf8');
8
+ }
9
+
10
+ return crypto.createHash('md5').update(bytes).digest();
11
+ }
12
+
13
+ export default md5;
@@ -0,0 +1,4 @@
1
+ import crypto from 'crypto';
2
+ export default function rng() {
3
+ return crypto.randomBytes(16);
4
+ }
@@ -0,0 +1,13 @@
1
+ import crypto from 'crypto';
2
+
3
+ function sha1(bytes) {
4
+ if (Array.isArray(bytes)) {
5
+ bytes = Buffer.from(bytes);
6
+ } else if (typeof bytes === 'string') {
7
+ bytes = Buffer.from(bytes, 'utf8');
8
+ }
9
+
10
+ return crypto.createHash('sha1').update(bytes).digest();
11
+ }
12
+
13
+ export default sha1;
@@ -0,0 +1,95 @@
1
+ import rng from './rng.js';
2
+ import bytesToUuid from './bytesToUuid.js'; // **`v1()` - Generate time-based UUID**
3
+ //
4
+ // Inspired by https://github.com/LiosK/UUID.js
5
+ // and http://docs.python.org/library/uuid.html
6
+
7
+ var _nodeId;
8
+
9
+ var _clockseq; // Previous uuid creation time
10
+
11
+
12
+ var _lastMSecs = 0;
13
+ var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
14
+
15
+ function v1(options, buf, offset) {
16
+ var i = buf && offset || 0;
17
+ var b = buf || [];
18
+ options = options || {};
19
+ var node = options.node || _nodeId;
20
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
21
+ // specified. We do this lazily to minimize issues related to insufficient
22
+ // system entropy. See #189
23
+
24
+ if (node == null || clockseq == null) {
25
+ var seedBytes = options.random || (options.rng || rng)();
26
+
27
+ if (node == null) {
28
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
29
+ node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
30
+ }
31
+
32
+ if (clockseq == null) {
33
+ // Per 4.2.2, randomize (14 bit) clockseq
34
+ clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
35
+ }
36
+ } // UUID timestamps are 100 nano-second units since the Gregorian epoch,
37
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
38
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
39
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
40
+
41
+
42
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock
43
+ // cycle to simulate higher resolution clock
44
+
45
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
46
+
47
+ var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
48
+
49
+ if (dt < 0 && options.clockseq === undefined) {
50
+ clockseq = clockseq + 1 & 0x3fff;
51
+ } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
52
+ // time interval
53
+
54
+
55
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
56
+ nsecs = 0;
57
+ } // Per 4.2.1.2 Throw error if too many uuids are requested
58
+
59
+
60
+ if (nsecs >= 10000) {
61
+ throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
62
+ }
63
+
64
+ _lastMSecs = msecs;
65
+ _lastNSecs = nsecs;
66
+ _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
67
+
68
+ msecs += 12219292800000; // `time_low`
69
+
70
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
71
+ b[i++] = tl >>> 24 & 0xff;
72
+ b[i++] = tl >>> 16 & 0xff;
73
+ b[i++] = tl >>> 8 & 0xff;
74
+ b[i++] = tl & 0xff; // `time_mid`
75
+
76
+ var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
77
+ b[i++] = tmh >>> 8 & 0xff;
78
+ b[i++] = tmh & 0xff; // `time_high_and_version`
79
+
80
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
81
+
82
+ b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
83
+
84
+ b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
85
+
86
+ b[i++] = clockseq & 0xff; // `node`
87
+
88
+ for (var n = 0; n < 6; ++n) {
89
+ b[i + n] = node[n];
90
+ }
91
+
92
+ return buf ? buf : bytesToUuid(b);
93
+ }
94
+
95
+ export default v1;
@@ -0,0 +1,4 @@
1
+ import v35 from './v35.js';
2
+ import md5 from './md5.js';
3
+ const v3 = v35('v3', 0x30, md5);
4
+ export default v3;
@@ -0,0 +1,56 @@
1
+ import bytesToUuid from './bytesToUuid.js';
2
+
3
+ function uuidToBytes(uuid) {
4
+ // Note: We assume we're being passed a valid uuid string
5
+ var bytes = [];
6
+ uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {
7
+ bytes.push(parseInt(hex, 16));
8
+ });
9
+ return bytes;
10
+ }
11
+
12
+ function stringToBytes(str) {
13
+ str = unescape(encodeURIComponent(str)); // UTF8 escape
14
+
15
+ var bytes = new Array(str.length);
16
+
17
+ for (var i = 0; i < str.length; i++) {
18
+ bytes[i] = str.charCodeAt(i);
19
+ }
20
+
21
+ return bytes;
22
+ }
23
+
24
+ export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
25
+ export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
26
+ export default function (name, version, hashfunc) {
27
+ var generateUUID = function (value, namespace, buf, offset) {
28
+ var off = buf && offset || 0;
29
+ if (typeof value == 'string') value = stringToBytes(value);
30
+ if (typeof namespace == 'string') namespace = uuidToBytes(namespace);
31
+ if (!Array.isArray(value)) throw TypeError('value must be an array of bytes');
32
+ if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values'); // Per 4.3
33
+
34
+ var bytes = hashfunc(namespace.concat(value));
35
+ bytes[6] = bytes[6] & 0x0f | version;
36
+ bytes[8] = bytes[8] & 0x3f | 0x80;
37
+
38
+ if (buf) {
39
+ for (var idx = 0; idx < 16; ++idx) {
40
+ buf[off + idx] = bytes[idx];
41
+ }
42
+ }
43
+
44
+ return buf || bytesToUuid(bytes);
45
+ }; // Function#name is not settable on some platforms (#270)
46
+
47
+
48
+ try {
49
+ generateUUID.name = name;
50
+ } catch (err) {} // For CommonJS default export support
51
+
52
+
53
+ generateUUID.DNS = DNS;
54
+ generateUUID.URL = URL;
55
+ return generateUUID;
56
+ }
@@ -0,0 +1,27 @@
1
+ import rng from './rng.js';
2
+ import bytesToUuid from './bytesToUuid.js';
3
+
4
+ function v4(options, buf, offset) {
5
+ var i = buf && offset || 0;
6
+
7
+ if (typeof options == 'string') {
8
+ buf = options === 'binary' ? new Array(16) : null;
9
+ options = null;
10
+ }
11
+
12
+ options = options || {};
13
+ var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
14
+
15
+ rnds[6] = rnds[6] & 0x0f | 0x40;
16
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
17
+
18
+ if (buf) {
19
+ for (var ii = 0; ii < 16; ++ii) {
20
+ buf[i + ii] = rnds[ii];
21
+ }
22
+ }
23
+
24
+ return buf || bytesToUuid(rnds);
25
+ }
26
+
27
+ export default v4;
@@ -0,0 +1,4 @@
1
+ import v35 from './v35.js';
2
+ import sha1 from './sha1.js';
3
+ const v5 = v35('v5', 0x50, sha1);
4
+ export default v5;
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ /*
9
+ * Browser-compatible JavaScript MD5
10
+ *
11
+ * Modification of JavaScript MD5
12
+ * https://github.com/blueimp/JavaScript-MD5
13
+ *
14
+ * Copyright 2011, Sebastian Tschan
15
+ * https://blueimp.net
16
+ *
17
+ * Licensed under the MIT license:
18
+ * https://opensource.org/licenses/MIT
19
+ *
20
+ * Based on
21
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
22
+ * Digest Algorithm, as defined in RFC 1321.
23
+ * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
24
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
25
+ * Distributed under the BSD License
26
+ * See http://pajhome.org.uk/crypt/md5 for more info.
27
+ */
28
+ function md5(bytes) {
29
+ if (typeof bytes == 'string') {
30
+ var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
31
+
32
+ bytes = new Array(msg.length);
33
+
34
+ for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i);
35
+ }
36
+
37
+ return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
38
+ }
39
+ /*
40
+ * Convert an array of little-endian words to an array of bytes
41
+ */
42
+
43
+
44
+ function md5ToHexEncodedArray(input) {
45
+ var i;
46
+ var x;
47
+ var output = [];
48
+ var length32 = input.length * 32;
49
+ var hexTab = '0123456789abcdef';
50
+ var hex;
51
+
52
+ for (i = 0; i < length32; i += 8) {
53
+ x = input[i >> 5] >>> i % 32 & 0xff;
54
+ hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
55
+ output.push(hex);
56
+ }
57
+
58
+ return output;
59
+ }
60
+ /*
61
+ * Calculate the MD5 of an array of little-endian words, and a bit length.
62
+ */
63
+
64
+
65
+ function wordsToMd5(x, len) {
66
+ /* append padding */
67
+ x[len >> 5] |= 0x80 << len % 32;
68
+ x[(len + 64 >>> 9 << 4) + 14] = len;
69
+ var i;
70
+ var olda;
71
+ var oldb;
72
+ var oldc;
73
+ var oldd;
74
+ var a = 1732584193;
75
+ var b = -271733879;
76
+ var c = -1732584194;
77
+ var d = 271733878;
78
+
79
+ for (i = 0; i < x.length; i += 16) {
80
+ olda = a;
81
+ oldb = b;
82
+ oldc = c;
83
+ oldd = d;
84
+ a = md5ff(a, b, c, d, x[i], 7, -680876936);
85
+ d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
86
+ c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
87
+ b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
88
+ a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
89
+ d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
90
+ c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
91
+ b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
92
+ a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
93
+ d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
94
+ c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
95
+ b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
96
+ a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
97
+ d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
98
+ c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
99
+ b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
100
+ a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
101
+ d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
102
+ c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
103
+ b = md5gg(b, c, d, a, x[i], 20, -373897302);
104
+ a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
105
+ d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
106
+ c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
107
+ b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
108
+ a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
109
+ d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
110
+ c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
111
+ b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
112
+ a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
113
+ d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
114
+ c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
115
+ b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
116
+ a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
117
+ d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
118
+ c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
119
+ b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
120
+ a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
121
+ d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
122
+ c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
123
+ b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
124
+ a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
125
+ d = md5hh(d, a, b, c, x[i], 11, -358537222);
126
+ c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
127
+ b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
128
+ a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
129
+ d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
130
+ c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
131
+ b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
132
+ a = md5ii(a, b, c, d, x[i], 6, -198630844);
133
+ d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
134
+ c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
135
+ b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
136
+ a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
137
+ d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
138
+ c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
139
+ b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
140
+ a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
141
+ d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
142
+ c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
143
+ b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
144
+ a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
145
+ d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
146
+ c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
147
+ b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
148
+ a = safeAdd(a, olda);
149
+ b = safeAdd(b, oldb);
150
+ c = safeAdd(c, oldc);
151
+ d = safeAdd(d, oldd);
152
+ }
153
+
154
+ return [a, b, c, d];
155
+ }
156
+ /*
157
+ * Convert an array bytes to an array of little-endian words
158
+ * Characters >255 have their high-byte silently ignored.
159
+ */
160
+
161
+
162
+ function bytesToWords(input) {
163
+ var i;
164
+ var output = [];
165
+ output[(input.length >> 2) - 1] = undefined;
166
+
167
+ for (i = 0; i < output.length; i += 1) {
168
+ output[i] = 0;
169
+ }
170
+
171
+ var length8 = input.length * 8;
172
+
173
+ for (i = 0; i < length8; i += 8) {
174
+ output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
175
+ }
176
+
177
+ return output;
178
+ }
179
+ /*
180
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
181
+ * to work around bugs in some JS interpreters.
182
+ */
183
+
184
+
185
+ function safeAdd(x, y) {
186
+ var lsw = (x & 0xffff) + (y & 0xffff);
187
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
188
+ return msw << 16 | lsw & 0xffff;
189
+ }
190
+ /*
191
+ * Bitwise rotate a 32-bit number to the left.
192
+ */
193
+
194
+
195
+ function bitRotateLeft(num, cnt) {
196
+ return num << cnt | num >>> 32 - cnt;
197
+ }
198
+ /*
199
+ * These functions implement the four basic operations the algorithm uses.
200
+ */
201
+
202
+
203
+ function md5cmn(q, a, b, x, s, t) {
204
+ return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
205
+ }
206
+
207
+ function md5ff(a, b, c, d, x, s, t) {
208
+ return md5cmn(b & c | ~b & d, a, b, x, s, t);
209
+ }
210
+
211
+ function md5gg(a, b, c, d, x, s, t) {
212
+ return md5cmn(b & d | c & ~d, a, b, x, s, t);
213
+ }
214
+
215
+ function md5hh(a, b, c, d, x, s, t) {
216
+ return md5cmn(b ^ c ^ d, a, b, x, s, t);
217
+ }
218
+
219
+ function md5ii(a, b, c, d, x, s, t) {
220
+ return md5cmn(c ^ (b | ~d), a, b, x, s, t);
221
+ }
222
+
223
+ var _default = md5;
224
+ exports.default = _default;
225
+ module.exports = exports.default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = rng;
7
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
8
+ // require the crypto API and do not support built-in fallback to lower quality random number
9
+ // generators (like Math.random()).
10
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
11
+ // find the complete implementation of crypto (msCrypto) on IE11.
12
+ var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
13
+ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
14
+
15
+ function rng() {
16
+ if (!getRandomValues) {
17
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
18
+ }
19
+
20
+ return getRandomValues(rnds8);
21
+ }
22
+
23
+ module.exports = exports.default;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ // Adapted from Chris Veness' SHA1 code at
9
+ // http://www.movable-type.co.uk/scripts/sha1.html
10
+ function f(s, x, y, z) {
11
+ switch (s) {
12
+ case 0:
13
+ return x & y ^ ~x & z;
14
+
15
+ case 1:
16
+ return x ^ y ^ z;
17
+
18
+ case 2:
19
+ return x & y ^ x & z ^ y & z;
20
+
21
+ case 3:
22
+ return x ^ y ^ z;
23
+ }
24
+ }
25
+
26
+ function ROTL(x, n) {
27
+ return x << n | x >>> 32 - n;
28
+ }
29
+
30
+ function sha1(bytes) {
31
+ var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
32
+ var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
33
+
34
+ if (typeof bytes == 'string') {
35
+ var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
36
+
37
+ bytes = new Array(msg.length);
38
+
39
+ for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i);
40
+ }
41
+
42
+ bytes.push(0x80);
43
+ var l = bytes.length / 4 + 2;
44
+ var N = Math.ceil(l / 16);
45
+ var M = new Array(N);
46
+
47
+ for (var i = 0; i < N; i++) {
48
+ M[i] = new Array(16);
49
+
50
+ for (var j = 0; j < 16; j++) {
51
+ M[i][j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
52
+ }
53
+ }
54
+
55
+ M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
56
+ M[N - 1][14] = Math.floor(M[N - 1][14]);
57
+ M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
58
+
59
+ for (var i = 0; i < N; i++) {
60
+ var W = new Array(80);
61
+
62
+ for (var t = 0; t < 16; t++) W[t] = M[i][t];
63
+
64
+ for (var t = 16; t < 80; t++) {
65
+ W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
66
+ }
67
+
68
+ var a = H[0];
69
+ var b = H[1];
70
+ var c = H[2];
71
+ var d = H[3];
72
+ var e = H[4];
73
+
74
+ for (var t = 0; t < 80; t++) {
75
+ var s = Math.floor(t / 20);
76
+ var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
77
+ e = d;
78
+ d = c;
79
+ c = ROTL(b, 30) >>> 0;
80
+ b = a;
81
+ a = T;
82
+ }
83
+
84
+ H[0] = H[0] + a >>> 0;
85
+ H[1] = H[1] + b >>> 0;
86
+ H[2] = H[2] + c >>> 0;
87
+ H[3] = H[3] + d >>> 0;
88
+ H[4] = H[4] + e >>> 0;
89
+ }
90
+
91
+ return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
92
+ }
93
+
94
+ var _default = sha1;
95
+ exports.default = _default;
96
+ module.exports = exports.default;
@@ -1 +1 @@
1
- !function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((r=r||self).uuid={})}(this,(function(r){"use strict";var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),e=new Uint8Array(16);function t(){if(!n)throw new Error("uuid: This browser does not seem to support crypto.getRandomValues(). If you need to support this browser, please provide a custom random number generator through options.rng.");return n(e)}for(var o,a,u=[],f=0;f<256;++f)u[f]=(f+256).toString(16).substr(1);function c(r,n){var e=n||0,t=u;return[t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]]].join("")}var i=0,s=0;function d(r,n,e){var t=function(r,t,o,a){var u=o&&a||0;if("string"==typeof r&&(r=function(r){r=unescape(encodeURIComponent(r));for(var n=new Array(r.length),e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n}(r)),"string"==typeof t&&(t=function(r){var n=[];return r.replace(/[a-fA-F0-9]{2}/g,(function(r){n.push(parseInt(r,16))})),n}(t)),!Array.isArray(r))throw TypeError("value must be an array of bytes");if(!Array.isArray(t)||16!==t.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var f=e(t.concat(r));if(f[6]=15&f[6]|n,f[8]=63&f[8]|128,o)for(var i=0;i<16;++i)o[u+i]=f[i];return o||c(f)};try{t.name=r}catch(r){}return t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",t}function v(r,n){var e=(65535&r)+(65535&n);return(r>>16)+(n>>16)+(e>>16)<<16|65535&e}function l(r,n,e,t,o,a){return v((u=v(v(n,r),v(t,a)))<<(f=o)|u>>>32-f,e);var u,f}function p(r,n,e,t,o,a,u){return l(n&e|~n&t,r,n,o,a,u)}function y(r,n,e,t,o,a,u){return l(n&t|e&~t,r,n,o,a,u)}function h(r,n,e,t,o,a,u){return l(n^e^t,r,n,o,a,u)}function g(r,n,e,t,o,a,u){return l(e^(n|~t),r,n,o,a,u)}var m=d("v3",48,(function(r){if("string"==typeof r){var n=unescape(encodeURIComponent(r));r=new Array(n.length);for(var e=0;e<n.length;e++)r[e]=n.charCodeAt(e)}return function(r){var n,e,t,o=[],a=32*r.length;for(n=0;n<a;n+=8)e=r[n>>5]>>>n%32&255,t=parseInt("0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(15&e),16),o.push(t);return o}(function(r,n){var e,t,o,a,u;r[n>>5]|=128<<n%32,r[14+(n+64>>>9<<4)]=n;var f=1732584193,c=-271733879,i=-1732584194,s=271733878;for(e=0;e<r.length;e+=16)t=f,o=c,a=i,u=s,f=p(f,c,i,s,r[e],7,-680876936),s=p(s,f,c,i,r[e+1],12,-389564586),i=p(i,s,f,c,r[e+2],17,606105819),c=p(c,i,s,f,r[e+3],22,-1044525330),f=p(f,c,i,s,r[e+4],7,-176418897),s=p(s,f,c,i,r[e+5],12,1200080426),i=p(i,s,f,c,r[e+6],17,-1473231341),c=p(c,i,s,f,r[e+7],22,-45705983),f=p(f,c,i,s,r[e+8],7,1770035416),s=p(s,f,c,i,r[e+9],12,-1958414417),i=p(i,s,f,c,r[e+10],17,-42063),c=p(c,i,s,f,r[e+11],22,-1990404162),f=p(f,c,i,s,r[e+12],7,1804603682),s=p(s,f,c,i,r[e+13],12,-40341101),i=p(i,s,f,c,r[e+14],17,-1502002290),c=p(c,i,s,f,r[e+15],22,1236535329),f=y(f,c,i,s,r[e+1],5,-165796510),s=y(s,f,c,i,r[e+6],9,-1069501632),i=y(i,s,f,c,r[e+11],14,643717713),c=y(c,i,s,f,r[e],20,-373897302),f=y(f,c,i,s,r[e+5],5,-701558691),s=y(s,f,c,i,r[e+10],9,38016083),i=y(i,s,f,c,r[e+15],14,-660478335),c=y(c,i,s,f,r[e+4],20,-405537848),f=y(f,c,i,s,r[e+9],5,568446438),s=y(s,f,c,i,r[e+14],9,-1019803690),i=y(i,s,f,c,r[e+3],14,-187363961),c=y(c,i,s,f,r[e+8],20,1163531501),f=y(f,c,i,s,r[e+13],5,-1444681467),s=y(s,f,c,i,r[e+2],9,-51403784),i=y(i,s,f,c,r[e+7],14,1735328473),c=y(c,i,s,f,r[e+12],20,-1926607734),f=h(f,c,i,s,r[e+5],4,-378558),s=h(s,f,c,i,r[e+8],11,-2022574463),i=h(i,s,f,c,r[e+11],16,1839030562),c=h(c,i,s,f,r[e+14],23,-35309556),f=h(f,c,i,s,r[e+1],4,-1530992060),s=h(s,f,c,i,r[e+4],11,1272893353),i=h(i,s,f,c,r[e+7],16,-155497632),c=h(c,i,s,f,r[e+10],23,-1094730640),f=h(f,c,i,s,r[e+13],4,681279174),s=h(s,f,c,i,r[e],11,-358537222),i=h(i,s,f,c,r[e+3],16,-722521979),c=h(c,i,s,f,r[e+6],23,76029189),f=h(f,c,i,s,r[e+9],4,-640364487),s=h(s,f,c,i,r[e+12],11,-421815835),i=h(i,s,f,c,r[e+15],16,530742520),c=h(c,i,s,f,r[e+2],23,-995338651),f=g(f,c,i,s,r[e],6,-198630844),s=g(s,f,c,i,r[e+7],10,1126891415),i=g(i,s,f,c,r[e+14],15,-1416354905),c=g(c,i,s,f,r[e+5],21,-57434055),f=g(f,c,i,s,r[e+12],6,1700485571),s=g(s,f,c,i,r[e+3],10,-1894986606),i=g(i,s,f,c,r[e+10],15,-1051523),c=g(c,i,s,f,r[e+1],21,-2054922799),f=g(f,c,i,s,r[e+8],6,1873313359),s=g(s,f,c,i,r[e+15],10,-30611744),i=g(i,s,f,c,r[e+6],15,-1560198380),c=g(c,i,s,f,r[e+13],21,1309151649),f=g(f,c,i,s,r[e+4],6,-145523070),s=g(s,f,c,i,r[e+11],10,-1120210379),i=g(i,s,f,c,r[e+2],15,718787259),c=g(c,i,s,f,r[e+9],21,-343485551),f=v(f,t),c=v(c,o),i=v(i,a),s=v(s,u);return[f,c,i,s]}(function(r){var n,e=[];for(e[(r.length>>2)-1]=void 0,n=0;n<e.length;n+=1)e[n]=0;var t=8*r.length;for(n=0;n<t;n+=8)e[n>>5]|=(255&r[n/8])<<n%32;return e}(r),8*r.length))}));function b(r,n,e,t){switch(r){case 0:return n&e^~n&t;case 1:return n^e^t;case 2:return n&e^n&t^e&t;case 3:return n^e^t}}function w(r,n){return r<<n|r>>>32-n}var A=d("v5",80,(function(r){var n=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof r){var t=unescape(encodeURIComponent(r));r=new Array(t.length);for(var o=0;o<t.length;o++)r[o]=t.charCodeAt(o)}r.push(128);var a=r.length/4+2,u=Math.ceil(a/16),f=new Array(u);for(o=0;o<u;o++){f[o]=new Array(16);for(var c=0;c<16;c++)f[o][c]=r[64*o+4*c]<<24|r[64*o+4*c+1]<<16|r[64*o+4*c+2]<<8|r[64*o+4*c+3]}for(f[u-1][14]=8*(r.length-1)/Math.pow(2,32),f[u-1][14]=Math.floor(f[u-1][14]),f[u-1][15]=8*(r.length-1)&4294967295,o=0;o<u;o++){for(var i=new Array(80),s=0;s<16;s++)i[s]=f[o][s];for(s=16;s<80;s++)i[s]=w(i[s-3]^i[s-8]^i[s-14]^i[s-16],1);var d=e[0],v=e[1],l=e[2],p=e[3],y=e[4];for(s=0;s<80;s++){var h=Math.floor(s/20),g=w(d,5)+b(h,v,l,p)+y+n[h]+i[s]>>>0;y=p,p=l,l=w(v,30)>>>0,v=d,d=g}e[0]=e[0]+d>>>0,e[1]=e[1]+v>>>0,e[2]=e[2]+l>>>0,e[3]=e[3]+p>>>0,e[4]=e[4]+y>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}));r.v1=function(r,n,e){var u=n&&e||0,f=n||[],d=(r=r||{}).node||o,v=void 0!==r.clockseq?r.clockseq:a;if(null==d||null==v){var l=r.random||(r.rng||t)();null==d&&(d=o=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),null==v&&(v=a=16383&(l[6]<<8|l[7]))}var p=void 0!==r.msecs?r.msecs:(new Date).getTime(),y=void 0!==r.nsecs?r.nsecs:s+1,h=p-i+(y-s)/1e4;if(h<0&&void 0===r.clockseq&&(v=v+1&16383),(h<0||p>i)&&void 0===r.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=p,s=y,a=v;var g=(1e4*(268435455&(p+=122192928e5))+y)%4294967296;f[u++]=g>>>24&255,f[u++]=g>>>16&255,f[u++]=g>>>8&255,f[u++]=255&g;var m=p/4294967296*1e4&268435455;f[u++]=m>>>8&255,f[u++]=255&m,f[u++]=m>>>24&15|16,f[u++]=m>>>16&255,f[u++]=v>>>8|128,f[u++]=255&v;for(var b=0;b<6;++b)f[u+b]=d[b];return n||c(f)},r.v3=m,r.v4=function(r,n,e){var o=n&&e||0;"string"==typeof r&&(n="binary"===r?new Array(16):null,r=null);var a=(r=r||{}).random||(r.rng||t)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var u=0;u<16;++u)n[o+u]=a[u];return n||c(a)},r.v5=A,Object.defineProperty(r,"__esModule",{value:!0})}));
1
+ !function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((r=r||self).uuid={})}(this,(function(r){"use strict";var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),e=new Uint8Array(16);function t(){if(!n)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(e)}for(var o,a,u=[],f=0;f<256;++f)u[f]=(f+256).toString(16).substr(1);function c(r,n){var e=n||0,t=u;return[t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]]].join("")}var i=0,s=0;function v(r,n,e){var t=function(r,t,o,a){var u=o&&a||0;if("string"==typeof r&&(r=function(r){r=unescape(encodeURIComponent(r));for(var n=new Array(r.length),e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n}(r)),"string"==typeof t&&(t=function(r){var n=[];return r.replace(/[a-fA-F0-9]{2}/g,(function(r){n.push(parseInt(r,16))})),n}(t)),!Array.isArray(r))throw TypeError("value must be an array of bytes");if(!Array.isArray(t)||16!==t.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var f=e(t.concat(r));if(f[6]=15&f[6]|n,f[8]=63&f[8]|128,o)for(var i=0;i<16;++i)o[u+i]=f[i];return o||c(f)};try{t.name=r}catch(r){}return t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",t}function d(r,n){var e=(65535&r)+(65535&n);return(r>>16)+(n>>16)+(e>>16)<<16|65535&e}function l(r,n,e,t,o,a){return d((u=d(d(n,r),d(t,a)))<<(f=o)|u>>>32-f,e);var u,f}function p(r,n,e,t,o,a,u){return l(n&e|~n&t,r,n,o,a,u)}function y(r,n,e,t,o,a,u){return l(n&t|e&~t,r,n,o,a,u)}function h(r,n,e,t,o,a,u){return l(n^e^t,r,n,o,a,u)}function g(r,n,e,t,o,a,u){return l(e^(n|~t),r,n,o,a,u)}var m=v("v3",48,(function(r){if("string"==typeof r){var n=unescape(encodeURIComponent(r));r=new Array(n.length);for(var e=0;e<n.length;e++)r[e]=n.charCodeAt(e)}return function(r){var n,e,t,o=[],a=32*r.length;for(n=0;n<a;n+=8)e=r[n>>5]>>>n%32&255,t=parseInt("0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(15&e),16),o.push(t);return o}(function(r,n){var e,t,o,a,u;r[n>>5]|=128<<n%32,r[14+(n+64>>>9<<4)]=n;var f=1732584193,c=-271733879,i=-1732584194,s=271733878;for(e=0;e<r.length;e+=16)t=f,o=c,a=i,u=s,f=p(f,c,i,s,r[e],7,-680876936),s=p(s,f,c,i,r[e+1],12,-389564586),i=p(i,s,f,c,r[e+2],17,606105819),c=p(c,i,s,f,r[e+3],22,-1044525330),f=p(f,c,i,s,r[e+4],7,-176418897),s=p(s,f,c,i,r[e+5],12,1200080426),i=p(i,s,f,c,r[e+6],17,-1473231341),c=p(c,i,s,f,r[e+7],22,-45705983),f=p(f,c,i,s,r[e+8],7,1770035416),s=p(s,f,c,i,r[e+9],12,-1958414417),i=p(i,s,f,c,r[e+10],17,-42063),c=p(c,i,s,f,r[e+11],22,-1990404162),f=p(f,c,i,s,r[e+12],7,1804603682),s=p(s,f,c,i,r[e+13],12,-40341101),i=p(i,s,f,c,r[e+14],17,-1502002290),c=p(c,i,s,f,r[e+15],22,1236535329),f=y(f,c,i,s,r[e+1],5,-165796510),s=y(s,f,c,i,r[e+6],9,-1069501632),i=y(i,s,f,c,r[e+11],14,643717713),c=y(c,i,s,f,r[e],20,-373897302),f=y(f,c,i,s,r[e+5],5,-701558691),s=y(s,f,c,i,r[e+10],9,38016083),i=y(i,s,f,c,r[e+15],14,-660478335),c=y(c,i,s,f,r[e+4],20,-405537848),f=y(f,c,i,s,r[e+9],5,568446438),s=y(s,f,c,i,r[e+14],9,-1019803690),i=y(i,s,f,c,r[e+3],14,-187363961),c=y(c,i,s,f,r[e+8],20,1163531501),f=y(f,c,i,s,r[e+13],5,-1444681467),s=y(s,f,c,i,r[e+2],9,-51403784),i=y(i,s,f,c,r[e+7],14,1735328473),c=y(c,i,s,f,r[e+12],20,-1926607734),f=h(f,c,i,s,r[e+5],4,-378558),s=h(s,f,c,i,r[e+8],11,-2022574463),i=h(i,s,f,c,r[e+11],16,1839030562),c=h(c,i,s,f,r[e+14],23,-35309556),f=h(f,c,i,s,r[e+1],4,-1530992060),s=h(s,f,c,i,r[e+4],11,1272893353),i=h(i,s,f,c,r[e+7],16,-155497632),c=h(c,i,s,f,r[e+10],23,-1094730640),f=h(f,c,i,s,r[e+13],4,681279174),s=h(s,f,c,i,r[e],11,-358537222),i=h(i,s,f,c,r[e+3],16,-722521979),c=h(c,i,s,f,r[e+6],23,76029189),f=h(f,c,i,s,r[e+9],4,-640364487),s=h(s,f,c,i,r[e+12],11,-421815835),i=h(i,s,f,c,r[e+15],16,530742520),c=h(c,i,s,f,r[e+2],23,-995338651),f=g(f,c,i,s,r[e],6,-198630844),s=g(s,f,c,i,r[e+7],10,1126891415),i=g(i,s,f,c,r[e+14],15,-1416354905),c=g(c,i,s,f,r[e+5],21,-57434055),f=g(f,c,i,s,r[e+12],6,1700485571),s=g(s,f,c,i,r[e+3],10,-1894986606),i=g(i,s,f,c,r[e+10],15,-1051523),c=g(c,i,s,f,r[e+1],21,-2054922799),f=g(f,c,i,s,r[e+8],6,1873313359),s=g(s,f,c,i,r[e+15],10,-30611744),i=g(i,s,f,c,r[e+6],15,-1560198380),c=g(c,i,s,f,r[e+13],21,1309151649),f=g(f,c,i,s,r[e+4],6,-145523070),s=g(s,f,c,i,r[e+11],10,-1120210379),i=g(i,s,f,c,r[e+2],15,718787259),c=g(c,i,s,f,r[e+9],21,-343485551),f=d(f,t),c=d(c,o),i=d(i,a),s=d(s,u);return[f,c,i,s]}(function(r){var n,e=[];for(e[(r.length>>2)-1]=void 0,n=0;n<e.length;n+=1)e[n]=0;var t=8*r.length;for(n=0;n<t;n+=8)e[n>>5]|=(255&r[n/8])<<n%32;return e}(r),8*r.length))}));function b(r,n,e,t){switch(r){case 0:return n&e^~n&t;case 1:return n^e^t;case 2:return n&e^n&t^e&t;case 3:return n^e^t}}function A(r,n){return r<<n|r>>>32-n}var w=v("v5",80,(function(r){var n=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof r){var t=unescape(encodeURIComponent(r));r=new Array(t.length);for(var o=0;o<t.length;o++)r[o]=t.charCodeAt(o)}r.push(128);var a=r.length/4+2,u=Math.ceil(a/16),f=new Array(u);for(o=0;o<u;o++){f[o]=new Array(16);for(var c=0;c<16;c++)f[o][c]=r[64*o+4*c]<<24|r[64*o+4*c+1]<<16|r[64*o+4*c+2]<<8|r[64*o+4*c+3]}for(f[u-1][14]=8*(r.length-1)/Math.pow(2,32),f[u-1][14]=Math.floor(f[u-1][14]),f[u-1][15]=8*(r.length-1)&4294967295,o=0;o<u;o++){for(var i=new Array(80),s=0;s<16;s++)i[s]=f[o][s];for(s=16;s<80;s++)i[s]=A(i[s-3]^i[s-8]^i[s-14]^i[s-16],1);var v=e[0],d=e[1],l=e[2],p=e[3],y=e[4];for(s=0;s<80;s++){var h=Math.floor(s/20),g=A(v,5)+b(h,d,l,p)+y+n[h]+i[s]>>>0;y=p,p=l,l=A(d,30)>>>0,d=v,v=g}e[0]=e[0]+v>>>0,e[1]=e[1]+d>>>0,e[2]=e[2]+l>>>0,e[3]=e[3]+p>>>0,e[4]=e[4]+y>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}));r.v1=function(r,n,e){var u=n&&e||0,f=n||[],v=(r=r||{}).node||o,d=void 0!==r.clockseq?r.clockseq:a;if(null==v||null==d){var l=r.random||(r.rng||t)();null==v&&(v=o=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),null==d&&(d=a=16383&(l[6]<<8|l[7]))}var p=void 0!==r.msecs?r.msecs:(new Date).getTime(),y=void 0!==r.nsecs?r.nsecs:s+1,h=p-i+(y-s)/1e4;if(h<0&&void 0===r.clockseq&&(d=d+1&16383),(h<0||p>i)&&void 0===r.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=p,s=y,a=d;var g=(1e4*(268435455&(p+=122192928e5))+y)%4294967296;f[u++]=g>>>24&255,f[u++]=g>>>16&255,f[u++]=g>>>8&255,f[u++]=255&g;var m=p/4294967296*1e4&268435455;f[u++]=m>>>8&255,f[u++]=255&m,f[u++]=m>>>24&15|16,f[u++]=m>>>16&255,f[u++]=d>>>8|128,f[u++]=255&d;for(var b=0;b<6;++b)f[u+b]=v[b];return n||c(f)},r.v3=m,r.v4=function(r,n,e){var o=n&&e||0;"string"==typeof r&&(n="binary"===r?new Array(16):null,r=null);var a=(r=r||{}).random||(r.rng||t)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var u=0;u<16;++u)n[o+u]=a[u];return n||c(a)},r.v5=w,Object.defineProperty(r,"__esModule",{value:!0})}));
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e=e||self).uuidv1=o()}(this,(function(){"use strict";var e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function n(){if(!e)throw new Error("uuid: This browser does not seem to support crypto.getRandomValues(). If you need to support this browser, please provide a custom random number generator through options.rng.");return e(o)}for(var r,t,s=[],u=0;u<256;++u)s[u]=(u+256).toString(16).substr(1);var i=0,d=0;return function(e,o,u){var a=o&&u||0,c=o||[],f=(e=e||{}).node||r,p=void 0!==e.clockseq?e.clockseq:t;if(null==f||null==p){var m=e.random||(e.rng||n)();null==f&&(f=r=[1|m[0],m[1],m[2],m[3],m[4],m[5]]),null==p&&(p=t=16383&(m[6]<<8|m[7]))}var l=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:d+1,y=l-i+(v-d)/1e4;if(y<0&&void 0===e.clockseq&&(p=p+1&16383),(y<0||l>i)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=l,d=v,t=p;var g=(1e4*(268435455&(l+=122192928e5))+v)%4294967296;c[a++]=g>>>24&255,c[a++]=g>>>16&255,c[a++]=g>>>8&255,c[a++]=255&g;var w=l/4294967296*1e4&268435455;c[a++]=w>>>8&255,c[a++]=255&w,c[a++]=w>>>24&15|16,c[a++]=w>>>16&255,c[a++]=p>>>8|128,c[a++]=255&p;for(var h=0;h<6;++h)c[a+h]=f[h];return o||function(e,o){var n=o||0,r=s;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}(c)}}));
1
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e=e||self).uuidv1=o()}(this,(function(){"use strict";var e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function n(){if(!e)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(o)}for(var t,r,u=[],s=0;s<256;++s)u[s]=(s+256).toString(16).substr(1);var i=0,d=0;return function(e,o,s){var a=o&&s||0,c=o||[],f=(e=e||{}).node||t,p=void 0!==e.clockseq?e.clockseq:r;if(null==f||null==p){var l=e.random||(e.rng||n)();null==f&&(f=t=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),null==p&&(p=r=16383&(l[6]<<8|l[7]))}var m=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:d+1,y=m-i+(v-d)/1e4;if(y<0&&void 0===e.clockseq&&(p=p+1&16383),(y<0||m>i)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=m,d=v,r=p;var g=(1e4*(268435455&(m+=122192928e5))+v)%4294967296;c[a++]=g>>>24&255,c[a++]=g>>>16&255,c[a++]=g>>>8&255,c[a++]=255&g;var h=m/4294967296*1e4&268435455;c[a++]=h>>>8&255,c[a++]=255&h,c[a++]=h>>>24&15|16,c[a++]=h>>>16&255,c[a++]=p>>>8|128,c[a++]=255&p;for(var w=0;w<6;++w)c[a+w]=f[w];return o||function(e,o){var n=o||0,t=u;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]]].join("")}(c)}}));
@@ -1 +1 @@
1
- !function(o,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(o=o||self).uuidv4=e()}(this,(function(){"use strict";var o="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),e=new Uint8Array(16);function r(){if(!o)throw new Error("uuid: This browser does not seem to support crypto.getRandomValues(). If you need to support this browser, please provide a custom random number generator through options.rng.");return o(e)}for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);return function(o,e,t){var u=e&&t||0;"string"==typeof o&&(e="binary"===o?new Array(16):null,o=null);var i=(o=o||{}).random||(o.rng||r)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var s=0;s<16;++s)e[u+s]=i[s];return e||function(o,e){var r=e||0,t=n;return[t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]]].join("")}(i)}}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).uuidv4=e()}(this,(function(){"use strict";var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),e=new Uint8Array(16);function n(){if(!t)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(e)}for(var o=[],r=0;r<256;++r)o[r]=(r+256).toString(16).substr(1);return function(t,e,r){var u=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var i=(t=t||{}).random||(t.rng||n)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var d=0;d<16;++d)e[u+d]=i[d];return e||function(t,e){var n=e||0,r=o;return[r[t[n++]],r[t[n++]],r[t[n++]],r[t[n++]],"-",r[t[n++]],r[t[n++]],"-",r[t[n++]],r[t[n++]],"-",r[t[n++]],r[t[n++]],"-",r[t[n++]],r[t[n++]],r[t[n++]],r[t[n++]],r[t[n++]],r[t[n++]]].join("")}(i)}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uuid",
3
- "version": "7.0.0-beta.0",
3
+ "version": "7.0.2",
4
4
  "description": "RFC4122 (v1, v4, and v5) UUIDs",
5
5
  "commitlint": {
6
6
  "extends": [
@@ -18,7 +18,13 @@
18
18
  },
19
19
  "sideEffects": false,
20
20
  "main": "dist/index.js",
21
- "module": "dist/esm-browser/index.js",
21
+ "module": "dist/esm-node/index.js",
22
+ "browser": {
23
+ "./dist/md5.js": "./dist/md5-browser.js",
24
+ "./dist/rng.js": "./dist/rng-browser.js",
25
+ "./dist/sha1.js": "./dist/sha1-browser.js",
26
+ "./dist/esm-node/index.js": "./dist/esm-browser/index.js"
27
+ },
22
28
  "files": [
23
29
  "CHANGELOG.md",
24
30
  "CONTRIBUTING.md",
@@ -31,30 +37,31 @@
31
37
  "v5.js"
32
38
  ],
33
39
  "devDependencies": {
34
- "@babel/cli": "7.8.3",
35
- "@babel/core": "7.8.3",
36
- "@babel/preset-env": "7.8.3",
40
+ "@babel/cli": "7.8.4",
41
+ "@babel/core": "7.8.4",
42
+ "@babel/preset-env": "7.8.4",
37
43
  "@commitlint/cli": "8.3.5",
38
44
  "@commitlint/config-conventional": "8.3.4",
45
+ "@rollup/plugin-node-resolve": "7.1.1",
39
46
  "babel-eslint": "10.0.3",
40
47
  "babel-plugin-add-module-exports": "1.0.2",
41
- "browserstack-local": "1.4.4",
48
+ "browserstack-local": "1.4.5",
42
49
  "bundlewatch": "0.2.5",
43
50
  "eslint": "6.8.0",
44
- "eslint-config-prettier": "6.9.0",
51
+ "eslint-config-prettier": "6.10.0",
45
52
  "eslint-plugin-prettier": "3.1.2",
46
53
  "esm": "3.2.25",
47
54
  "http-server": "0.12.1",
48
55
  "husky": "3.0.9",
49
- "jest": "24.9.0",
50
- "lint-staged": "10.0.1",
56
+ "jest": "25.1.0",
57
+ "lint-staged": "10.0.7",
51
58
  "npm-run-all": "4.1.5",
52
59
  "prettier": "1.19.1",
53
- "rollup": "1.30.0",
60
+ "rollup": "1.31.1",
54
61
  "rollup-plugin-terser": "5.2.0",
55
62
  "runmd": "1.3.2",
56
63
  "selenium-webdriver": "3.6.0",
57
- "standard-version": "7.0.1"
64
+ "standard-version": "7.1.0"
58
65
  },
59
66
  "scripts": {
60
67
  "examples:browser-webpack:build": "cd examples/browser-webpack && npm install && npm run build",
package/v1.js CHANGED
@@ -4,5 +4,5 @@ const v1 = require('./dist/v1.js');
4
4
 
5
5
  module.exports = util.deprecate(
6
6
  v1,
7
- "Deep requiring like `const uuidv1 = require('uuid/v1');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid/blob/master/README.md#upgrading-from-v3x-of-this-module for more information.",
7
+ "Deep requiring like `const uuidv1 = require('uuid/v1');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated for more information.",
8
8
  );
package/v3.js CHANGED
@@ -4,5 +4,5 @@ const v3 = require('./dist/v3.js');
4
4
 
5
5
  module.exports = util.deprecate(
6
6
  v3,
7
- "Deep requiring like `const uuidv3 = require('uuid/v3');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid/blob/master/README.md#upgrading-from-v3x-of-this-module for more information.",
7
+ "Deep requiring like `const uuidv3 = require('uuid/v3');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated for more information.",
8
8
  );
package/v4.js CHANGED
@@ -4,5 +4,5 @@ const v4 = require('./dist/v4.js');
4
4
 
5
5
  module.exports = util.deprecate(
6
6
  v4,
7
- "Deep requiring like `const uuidv4 = require('uuid/v4');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid/blob/master/README.md#upgrading-from-v3x-of-this-module for more information.",
7
+ "Deep requiring like `const uuidv4 = require('uuid/v4');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated for more information.",
8
8
  );
package/v5.js CHANGED
@@ -4,5 +4,5 @@ const v5 = require('./dist/v5.js');
4
4
 
5
5
  module.exports = util.deprecate(
6
6
  v5,
7
- "Deep requiring like `const uuidv5 = require('uuid/v5');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid/blob/master/README.md#upgrading-from-v5x-of-this-module for more information.",
7
+ "Deep requiring like `const uuidv5 = require('uuid/v5');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated for more information.",
8
8
  );