1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/enhanced-resolve/lib/createInnerCallback.js

53 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2023-12-18 13:12:25 +08:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const util = require("util");
// TODO remove in enhanced-resolve 5
2024-01-16 21:26:16 +08:00
module.exports = util.deprecate(function createInnerCallback(
callback,
options,
message,
messageOptional
) {
2023-12-18 13:12:25 +08:00
const log = options.log;
2024-01-16 21:26:16 +08:00
if (!log) {
if (options.stack !== callback.stack) {
2023-12-18 13:12:25 +08:00
const callbackWrapper = function callbackWrapper() {
return callback.apply(this, arguments);
};
callbackWrapper.stack = options.stack;
callbackWrapper.missing = options.missing;
return callbackWrapper;
}
return callback;
}
function loggingCallbackWrapper() {
return callback.apply(this, arguments);
}
2024-01-16 21:26:16 +08:00
if (message) {
if (!messageOptional) {
2023-12-18 13:12:25 +08:00
log(message);
}
loggingCallbackWrapper.log = function writeLog(msg) {
2024-01-16 21:26:16 +08:00
if (messageOptional) {
2023-12-18 13:12:25 +08:00
log(message);
messageOptional = false;
}
log(" " + msg);
};
} else {
loggingCallbackWrapper.log = function writeLog(msg) {
log(msg);
};
}
loggingCallbackWrapper.stack = options.stack;
loggingCallbackWrapper.missing = options.missing;
return loggingCallbackWrapper;
2024-01-16 21:26:16 +08:00
},
"Pass resolveContext instead and use createInnerContext");