23 lines
3.5 KiB
JavaScript
23 lines
3.5 KiB
JavaScript
|
"use strict";
|
||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const render_callsite_sync_1 = __importDefault(require("../utils/render-callsite-sync"));
|
||
|
const create_stack_filter_1 = __importDefault(require("../errors/create-stack-filter"));
|
||
|
const get_renderes_1 = __importDefault(require("../utils/get-renderes"));
|
||
|
function addWarning(warningLog, msg, callsite = void 0, ...args) {
|
||
|
const renderers = (0, get_renderes_1.default)(callsite);
|
||
|
const renderedCallsite = (0, render_callsite_sync_1.default)(callsite, {
|
||
|
renderer: renderers.noColor,
|
||
|
stackFilter: (0, create_stack_filter_1.default)(Error.stackTraceLimit),
|
||
|
});
|
||
|
const isStringMsg = typeof msg === 'string';
|
||
|
let message = isStringMsg ? msg.toString() : msg.message;
|
||
|
const actionId = isStringMsg ? null : msg.actionId;
|
||
|
message += `\n\n${renderedCallsite}`;
|
||
|
warningLog.addWarning({ message, actionId }, ...args);
|
||
|
}
|
||
|
exports.default = addWarning;
|
||
|
module.exports = exports.default;
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkLXJlbmRlcmVkLXdhcm5pbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbm90aWZpY2F0aW9ucy9hZGQtcmVuZGVyZWQtd2FybmluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHlGQUErRDtBQUMvRCx3RkFBOEQ7QUFDOUQseUVBQWlEO0FBR2pELFNBQXdCLFVBQVUsQ0FBRSxVQUFzQixFQUFFLEdBQStCLEVBQUUsV0FBZ0IsS0FBSyxDQUFDLEVBQUUsR0FBRyxJQUFXO0lBQy9ILE1BQU0sU0FBUyxHQUFVLElBQUEsc0JBQVksR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