@esfx/internal-deprecate
Advanced tools
Comparing version
@@ -19,8 +19,11 @@ "use strict"; | ||
exports.deprecateProperty = exports.deprecate = void 0; | ||
let deprecateCore; | ||
try { | ||
const util = require('util'); | ||
deprecateCore = util.deprecate; | ||
function tryGetNodeDeprecate() { | ||
try { | ||
const util = require('util'); | ||
return util.deprecate; | ||
} | ||
catch { | ||
} | ||
} | ||
catch (_) { | ||
function createDeprecateCore() { | ||
const emitWarning = typeof process === "object" && typeof process.emitWarning === "function" ? function emitWarning(warning, type = "Warning", ctor = emitWarning) { | ||
@@ -45,3 +48,3 @@ process.emitWarning(warning, type, ctor); | ||
}; | ||
deprecateCore = (fn, msg) => { | ||
return (fn, msg) => { | ||
let warned = false; | ||
@@ -61,2 +64,3 @@ function deprecated(...args) { | ||
} | ||
const deprecateCore = tryGetNodeDeprecate() || createDeprecateCore(); | ||
/** @internal */ | ||
@@ -63,0 +67,0 @@ function deprecate(fn, message) { |
{ | ||
"name": "@esfx/internal-deprecate", | ||
"version": "1.0.0-pre.19", | ||
"version": "1.0.0-pre.23", | ||
"description": "This package provides internal utilities for '@esfx' and is not intended for use in user-code.", | ||
@@ -21,3 +21,3 @@ "type": "commonjs", | ||
}, | ||
"gitHead": "36454798ce965ab3bc08a8841a2ba2e86c5d6115" | ||
"gitHead": "f9237c5979277bdf71658fb78571958d42cd9e03" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23130
1.56%104
4%