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/README.md b/README.md index 57d1028a..2b7c2cf1 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](#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 @@ -334,6 +335,28 @@ 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: + +### 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'; +``` + +### 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 9fc629e8..c5e3f248 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](#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 @@ -323,6 +324,28 @@ 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: + +### 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'; +``` + +### 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/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": [ diff --git a/src/rng-browser.js b/src/rng-browser.js index d91b4bc2..df51a764 100644 --- a/src/rng-browser.js +++ b/src/rng-browser.js @@ -7,14 +7,14 @@ 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 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); diff --git a/v1.js b/v1.js index fc0f5f87..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-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#deep-requires-now-deprecated for more information.", ); diff --git a/v3.js b/v3.js index 6e5ba606..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-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#deep-requires-now-deprecated for more information.", ); diff --git a/v4.js b/v4.js index 45f8c2ff..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-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#deep-requires-now-deprecated for more information.", ); diff --git a/v5.js b/v5.js index db1f831b..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-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#deep-requires-now-deprecated for more information.", );