From 44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4 Mon Sep 17 00:00:00 2001 From: victorplentz <40007381+victorplentz@users.noreply.github.com> Date: Wed, 26 Feb 2020 19:30:08 -0300 Subject: [PATCH 1/9] fix: update links to match content in readme (#386) --- v1.js | 2 +- v3.js | 2 +- v4.js | 2 +- v5.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/v1.js b/v1.js index fc0f5f87..8acb0406 100644 --- a/v1.js +++ b/v1.js @@ -4,5 +4,5 @@ const v1 = require('./dist/v1.js'); module.exports = util.deprecate( v1, - "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.", + "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-uuid3 for more information.", ); diff --git a/v3.js b/v3.js index 6e5ba606..6d51c7f0 100644 --- a/v3.js +++ b/v3.js @@ -4,5 +4,5 @@ const v3 = require('./dist/v3.js'); module.exports = util.deprecate( v3, - "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.", + "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-uuid3 for more information.", ); diff --git a/v4.js b/v4.js index 45f8c2ff..081cb46a 100644 --- a/v4.js +++ b/v4.js @@ -4,5 +4,5 @@ const v4 = require('./dist/v4.js'); module.exports = util.deprecate( v4, - "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.", + "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-uuid3 for more information.", ); diff --git a/v5.js b/v5.js index db1f831b..23ff2aa4 100644 --- a/v5.js +++ b/v5.js @@ -4,5 +4,5 @@ const v5 = require('./dist/v5.js'); module.exports = util.deprecate( v5, - "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.", + "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-uuid3 for more information.", ); From 719e1b4d7c8bcf5093f886dfa8cc9144a04ca1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Thu, 27 Feb 2020 12:19:33 +0000 Subject: [PATCH 2/9] docs: add information on usage from React Native (#385) This adds information on how to get the library working on React Native to the readme. To verify that this works: 1. creating a new React Native project (`npx react-native init uuidtest`) 2. added the dependencies (`npm add react-native-get-random-values uuid`) 3. imported the polyfill (`import 'react-native-get-random-values'` in `index.js`) 4. and displayed an UUID in the app (`import * as uuid from 'uuid'` and `{uuid.v4()}` in `App.js`) Closes #375 --- README.md | 2 ++ README_js.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 57d1028a..97c134e0 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ versions, all of which are supported here. In order of popularity, they are: **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). +**Are you using React Native?** If you are using this library from React Native, you need to add a polyfill for `crypto.getRandomValues`. We recommend using [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme). + ### Create Version 4 (Random) UUIDs ```javascript diff --git a/README_js.md b/README_js.md index 9fc629e8..2164a656 100644 --- a/README_js.md +++ b/README_js.md @@ -48,6 +48,8 @@ versions, all of which are supported here. In order of popularity, they are: **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). +**Are you using React Native?** If you are using this library from React Native, you need to add a polyfill for `crypto.getRandomValues`. We recommend using [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme). + ### Create Version 4 (Random) UUIDs ```javascript --run v4 From 84e6733f91acf396fffdca35eeb21438c5bd2eff Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Fri, 28 Feb 2020 22:54:49 +0100 Subject: [PATCH 3/9] docs: move react-native docs to separate section (#387) * link to React Native readme section from rng error * For linkability, move react-native docs to separate section. * Link to readme in src/rng-browser.js Co-Authored-By: Robert Kieffer --- README.md | 13 +++++++++++-- README_js.md | 13 +++++++++++-- src/rng-browser.js | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 97c134e0..87b13006 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs - Node 8, 10, 12 - Chrome, Safari, Firefox, Edge, IE 11 browsers - Webpack and rollup.js module bundlers + - React Native ([see note](#getrandomvalues-not-supported)) - **Secure** - Cryptographically-strong random values - **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers - **CLI** - Includes the [`uuid` command line](#command-line) utility @@ -35,8 +36,6 @@ versions, all of which are supported here. In order of popularity, they are: **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). -**Are you using React Native?** If you are using this library from React Native, you need to add a polyfill for `crypto.getRandomValues`. We recommend using [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme). - ### Create Version 4 (Random) UUIDs ```javascript @@ -336,6 +335,16 @@ Available bundles: - https://unpkg.com/uuid@latest/dist/umd/ - https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/ +## "getRandomValues() not supported" + +This error occurs in environments where the standard +[`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) +API is not supported. This issue can be resolved by adding an appropriate polyfill: + +| Environment | Suggested Polyfill | +| ------------ | --------------------------------------------------------------------------------------------------- | +| React Native | [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) | + ## Upgrading From uuid\@3 "_Wait... what happened to uuid\@4 - uuid\@6?!?_" diff --git a/README_js.md b/README_js.md index 2164a656..260f85d2 100644 --- a/README_js.md +++ b/README_js.md @@ -25,6 +25,7 @@ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs - Node 8, 10, 12 - Chrome, Safari, Firefox, Edge, IE 11 browsers - Webpack and rollup.js module bundlers + - React Native ([see note](#getrandomvalues-not-supported)) - **Secure** - Cryptographically-strong random values - **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers - **CLI** - Includes the [`uuid` command line](#command-line) utility @@ -48,8 +49,6 @@ versions, all of which are supported here. In order of popularity, they are: **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). -**Are you using React Native?** If you are using this library from React Native, you need to add a polyfill for `crypto.getRandomValues`. We recommend using [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme). - ### Create Version 4 (Random) UUIDs ```javascript --run v4 @@ -325,6 +324,16 @@ Available bundles: - https://unpkg.com/uuid@latest/dist/umd/ - https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/ +## "getRandomValues() not supported" + +This error occurs in environments where the standard +[`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) +API is not supported. This issue can be resolved by adding an appropriate polyfill: + +| Environment | Suggested Polyfill | +| ------------ | --------------------------------------------------------------------------------------------------- | +| React Native | [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) | + ## Upgrading From uuid\@3 "_Wait... what happened to uuid\@4 - uuid\@6?!?_" diff --git a/src/rng-browser.js b/src/rng-browser.js index d91b4bc2..17ac1588 100644 --- a/src/rng-browser.js +++ b/src/rng-browser.js @@ -14,7 +14,7 @@ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef export default function rng() { if (!getRandomValues) { 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.', + 'crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported', ); } return getRandomValues(rnds8); From bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Sat, 29 Feb 2020 20:32:46 +0100 Subject: [PATCH 4/9] fix: simplify link in deprecation warning (#391) --- v1.js | 2 +- v3.js | 2 +- v4.js | 2 +- v5.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/v1.js b/v1.js index 8acb0406..3a90c4cd 100644 --- a/v1.js +++ b/v1.js @@ -4,5 +4,5 @@ const v1 = require('./dist/v1.js'); module.exports = util.deprecate( v1, - "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-uuid3 for more information.", + "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.", ); diff --git a/v3.js b/v3.js index 6d51c7f0..6b3753c4 100644 --- a/v3.js +++ b/v3.js @@ -4,5 +4,5 @@ const v3 = require('./dist/v3.js'); module.exports = util.deprecate( v3, - "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-uuid3 for more information.", + "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.", ); diff --git a/v4.js b/v4.js index 081cb46a..9f938cd1 100644 --- a/v4.js +++ b/v4.js @@ -4,5 +4,5 @@ const v4 = require('./dist/v4.js'); module.exports = util.deprecate( v4, - "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-uuid3 for more information.", + "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.", ); diff --git a/v5.js b/v5.js index 23ff2aa4..cc467bf1 100644 --- a/v5.js +++ b/v5.js @@ -4,5 +4,5 @@ const v5 = require('./dist/v5.js'); module.exports = util.deprecate( v5, - "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-uuid3 for more information.", + "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.", ); From 8bf2a20f3565df743da7215eebdbada9d2df118c Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Mon, 2 Mar 2020 22:30:51 +0100 Subject: [PATCH 5/9] fix: make access to msCrypto consistent (#393) It doesn't make sense to explicitly use window. only once in the chain. --- src/rng-browser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rng-browser.js b/src/rng-browser.js index 17ac1588..df51a764 100644 --- a/src/rng-browser.js +++ b/src/rng-browser.js @@ -7,7 +7,7 @@ var getRandomValues = (typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || (typeof msCrypto != 'undefined' && - typeof window.msCrypto.getRandomValues == 'function' && + typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef From 428b9e0f04de55d9f04836c151f5caba01a2b1fb Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Wed, 4 Mar 2020 10:50:20 +0100 Subject: [PATCH 6/9] docs: make react native polyfill docs more explicit (#396) --- README.md | 12 +++++++++--- README_js.md | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 87b13006..d96af011 100644 --- a/README.md +++ b/README.md @@ -341,9 +341,15 @@ This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill: -| Environment | Suggested Polyfill | -| ------------ | --------------------------------------------------------------------------------------------------- | -| React Native | [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) | +### React Native + +1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) +1. Import it before `uuid`: + +```javascript +import 'react-native-get-random-values'; +import { v4 as uuidv4 } from 'uuid'; +``` ## Upgrading From uuid\@3 diff --git a/README_js.md b/README_js.md index 260f85d2..64ec3ba0 100644 --- a/README_js.md +++ b/README_js.md @@ -330,9 +330,15 @@ This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill: -| Environment | Suggested Polyfill | -| ------------ | --------------------------------------------------------------------------------------------------- | -| React Native | [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) | +### React Native + +1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) +1. Import it before `uuid`: + +```javascript +import 'react-native-get-random-values'; +import { v4 as uuidv4 } from 'uuid'; +``` ## Upgrading From uuid\@3 From f9bb57f711e98a6ab0f9bb707f4ae06ffe386f13 Mon Sep 17 00:00:00 2001 From: Robert Kieffer Date: Wed, 4 Mar 2020 02:11:04 -0800 Subject: [PATCH 7/9] chore: add webworker to not supported section (#395) --- README.md | 6 ++++++ README_js.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index d96af011..8269e48a 100644 --- a/README.md +++ b/README.md @@ -351,6 +351,12 @@ import 'react-native-get-random-values'; import { v4 as uuidv4 } from 'uuid'; ``` +### Web Workers / Service Workers (Edge <= 18) + +[In Edge <= 18, Web Crypto is not supported in Web Workers or Service +Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if +you find one, please). + ## Upgrading From uuid\@3 "_Wait... what happened to uuid\@4 - uuid\@6?!?_" diff --git a/README_js.md b/README_js.md index 64ec3ba0..2f2869a8 100644 --- a/README_js.md +++ b/README_js.md @@ -340,6 +340,12 @@ import 'react-native-get-random-values'; import { v4 as uuidv4 } from 'uuid'; ``` +### Web Workers / Service Workers (Edge <= 18) + +[In Edge <= 18, Web Crypto is not supported in Web Workers or Service +Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if +you find one, please). + ## Upgrading From uuid\@3 "_Wait... what happened to uuid\@4 - uuid\@6?!?_" From 1a300f142fcb339f3e9de875c4ec60e46adbb370 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Wed, 4 Mar 2020 13:31:03 +0100 Subject: [PATCH 8/9] docs: directly link to new react-native section (#397) --- README.md | 2 +- README_js.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8269e48a..2b7c2cf1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs - Node 8, 10, 12 - Chrome, Safari, Firefox, Edge, IE 11 browsers - Webpack and rollup.js module bundlers - - React Native ([see note](#getrandomvalues-not-supported)) + - [React Native](#react-native) - **Secure** - Cryptographically-strong random values - **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers - **CLI** - Includes the [`uuid` command line](#command-line) utility diff --git a/README_js.md b/README_js.md index 2f2869a8..c5e3f248 100644 --- a/README_js.md +++ b/README_js.md @@ -25,7 +25,7 @@ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs - Node 8, 10, 12 - Chrome, Safari, Firefox, Edge, IE 11 browsers - Webpack and rollup.js module bundlers - - React Native ([see note](#getrandomvalues-not-supported)) + - [React Native](#react-native) - **Secure** - Cryptographically-strong random values - **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers - **CLI** - Includes the [`uuid` command line](#command-line) utility From 4b61be05c840ba4d6fadf89cc8d4e1bbba7b9b1a Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Wed, 4 Mar 2020 13:47:25 +0100 Subject: [PATCH 9/9] chore(release): 7.0.2 --- CHANGELOG.md | 8 ++++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1123b710..6d95146c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ 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. +### [7.0.2](https://github.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04) + +### Bug Fixes + +- make access to msCrypto consistent ([#393](https://github.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://github.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c)) +- simplify link in deprecation warning ([#391](https://github.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://github.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7)) +- update links to match content in readme ([#386](https://github.com/uuidjs/uuid/issues/386)) ([44f2f86](https://github.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4)) + ### [7.0.1](https://github.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25) ### Bug Fixes diff --git a/package-lock.json b/package-lock.json index c9551ace..4abdb122 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "uuid", - "version": "7.0.1", + "version": "7.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 9f439954..b2507fda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uuid", - "version": "7.0.1", + "version": "7.0.2", "description": "RFC4122 (v1, v4, and v5) UUIDs", "commitlint": { "extends": [