-
-
Notifications
You must be signed in to change notification settings - Fork 899
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make deep require deprecation warning work in browsers (#409)
Relates to #408
- Loading branch information
Showing
6 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Extracted from: https://github.com/TooTallNate/util-deprecate | ||
let deprecate; | ||
try { | ||
const util = require('util'); | ||
deprecate = util.deprecate; | ||
} catch (err) { | ||
deprecate = function deprecate(fn, msg) { | ||
var warned = false; | ||
function deprecated() { | ||
if (!warned) { | ||
console.warn(msg); | ||
warned = true; | ||
} | ||
return fn.apply(this, arguments); | ||
} | ||
|
||
return deprecated; | ||
}; | ||
} | ||
module.exports = deprecate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
"CONTRIBUTING.md", | ||
"LICENSE.md", | ||
"README.md", | ||
"deprecate.js", | ||
"dist", | ||
"v1.js", | ||
"v3.js", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const util = require('util'); | ||
const deprecate = require('./deprecate.js'); | ||
|
||
const v1 = require('./dist/v1.js'); | ||
|
||
module.exports = util.deprecate( | ||
module.exports = 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#deep-requires-now-deprecated for more information.", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const util = require('util'); | ||
const deprecate = require('./deprecate.js'); | ||
|
||
const v3 = require('./dist/v3.js'); | ||
|
||
module.exports = util.deprecate( | ||
module.exports = 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#deep-requires-now-deprecated for more information.", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const util = require('util'); | ||
const deprecate = require('./deprecate.js'); | ||
|
||
const v4 = require('./dist/v4.js'); | ||
|
||
module.exports = util.deprecate( | ||
module.exports = 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#deep-requires-now-deprecated for more information.", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const util = require('util'); | ||
const deprecate = require('./deprecate.js'); | ||
|
||
const v5 = require('./dist/v5.js'); | ||
|
||
module.exports = util.deprecate( | ||
module.exports = 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#deep-requires-now-deprecated for more information.", | ||
); |