@salesforce/core-bundle 7.4.1 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +16 -52
- package/lib/index.js +91 -58
- package/lib/pino-file.js +26 -11
- package/lib/pino-pretty.js +86 -31
- package/lib/pino-worker.js +133 -68
- package/lib/thread-stream-worker.js +5 -1
- package/package.json +7 -7
- package/lib/pino-pipeline-worker.js +0 -87
package/lib/pino-pretty.js
CHANGED
@@ -12559,11 +12559,32 @@ var require_constants = __commonJS({
|
|
12559
12559
|
}
|
12560
12560
|
});
|
12561
12561
|
|
12562
|
+
// node_modules/pino-pretty/lib/utils/get-level-label-data.js
|
12563
|
+
var require_get_level_label_data = __commonJS({
|
12564
|
+
"node_modules/pino-pretty/lib/utils/get-level-label-data.js"(exports2, module2) {
|
12565
|
+
"use strict";
|
12566
|
+
module2.exports = getLevelLabelData;
|
12567
|
+
var { LEVELS, LEVEL_NAMES } = require_constants();
|
12568
|
+
function getLevelLabelData(useOnlyCustomProps, customLevels, customLevelNames) {
|
12569
|
+
const levels = useOnlyCustomProps ? customLevels || LEVELS : Object.assign({}, LEVELS, customLevels);
|
12570
|
+
const levelNames = useOnlyCustomProps ? customLevelNames || LEVEL_NAMES : Object.assign({}, LEVEL_NAMES, customLevelNames);
|
12571
|
+
return function(level) {
|
12572
|
+
let levelNum = "default";
|
12573
|
+
if (Number.isInteger(+level)) {
|
12574
|
+
levelNum = Object.prototype.hasOwnProperty.call(levels, level) ? level : levelNum;
|
12575
|
+
} else {
|
12576
|
+
levelNum = Object.prototype.hasOwnProperty.call(levelNames, level.toLowerCase()) ? levelNames[level.toLowerCase()] : levelNum;
|
12577
|
+
}
|
12578
|
+
return [levels[levelNum], levelNum];
|
12579
|
+
};
|
12580
|
+
}
|
12581
|
+
}
|
12582
|
+
});
|
12583
|
+
|
12562
12584
|
// node_modules/pino-pretty/lib/colors.js
|
12563
12585
|
var require_colors = __commonJS({
|
12564
12586
|
"node_modules/pino-pretty/lib/colors.js"(exports2, module2) {
|
12565
12587
|
"use strict";
|
12566
|
-
var { LEVELS, LEVEL_NAMES } = require_constants();
|
12567
12588
|
var nocolor = (input) => input;
|
12568
12589
|
var plain = {
|
12569
12590
|
default: nocolor,
|
@@ -12577,6 +12598,7 @@ var require_colors = __commonJS({
|
|
12577
12598
|
greyMessage: nocolor
|
12578
12599
|
};
|
12579
12600
|
var { createColors } = require_colorette();
|
12601
|
+
var getLevelLabelData = require_get_level_label_data();
|
12580
12602
|
var availableColors = createColors({ useColor: true });
|
12581
12603
|
var { white, bgRed, red, yellow, green, blue, gray, cyan } = availableColors;
|
12582
12604
|
var colored = {
|
@@ -12601,15 +12623,7 @@ var require_colors = __commonJS({
|
|
12601
12623
|
}
|
12602
12624
|
function colorizeLevel(useOnlyCustomProps) {
|
12603
12625
|
return function(level, colorizer, { customLevels, customLevelNames } = {}) {
|
12604
|
-
const
|
12605
|
-
const levelNames = useOnlyCustomProps ? customLevelNames || LEVEL_NAMES : Object.assign({}, LEVEL_NAMES, customLevelNames);
|
12606
|
-
let levelNum = "default";
|
12607
|
-
if (Number.isInteger(+level)) {
|
12608
|
-
levelNum = Object.prototype.hasOwnProperty.call(levels, level) ? level : levelNum;
|
12609
|
-
} else {
|
12610
|
-
levelNum = Object.prototype.hasOwnProperty.call(levelNames, level.toLowerCase()) ? levelNames[level.toLowerCase()] : levelNum;
|
12611
|
-
}
|
12612
|
-
const levelStr = levels[levelNum];
|
12626
|
+
const [levelStr, levelNum] = getLevelLabelData(useOnlyCustomProps, customLevels, customLevelNames)(level);
|
12613
12627
|
return Object.prototype.hasOwnProperty.call(colorizer, levelNum) ? colorizer[levelNum](levelStr) : colorizer.default(levelStr);
|
12614
12628
|
};
|
12615
12629
|
}
|
@@ -12620,6 +12634,7 @@ var require_colors = __commonJS({
|
|
12620
12634
|
};
|
12621
12635
|
customColoredColorizer.message = plain.message;
|
12622
12636
|
customColoredColorizer.greyMessage = plain.greyMessage;
|
12637
|
+
customColoredColorizer.colors = createColors({ useColor: false });
|
12623
12638
|
return customColoredColorizer;
|
12624
12639
|
}
|
12625
12640
|
function coloredColorizer(useOnlyCustomProps) {
|
@@ -12629,6 +12644,7 @@ var require_colors = __commonJS({
|
|
12629
12644
|
};
|
12630
12645
|
customColoredColorizer.message = colored.message;
|
12631
12646
|
customColoredColorizer.greyMessage = colored.greyMessage;
|
12647
|
+
customColoredColorizer.colors = availableColors;
|
12632
12648
|
return customColoredColorizer;
|
12633
12649
|
}
|
12634
12650
|
function customColoredColorizerFactory(customColors, useOnlyCustomProps) {
|
@@ -12638,6 +12654,7 @@ var require_colors = __commonJS({
|
|
12638
12654
|
const customColoredColorizer = function(level, opts) {
|
12639
12655
|
return colorizeLevelCustom(level, customColored, opts);
|
12640
12656
|
};
|
12657
|
+
customColoredColorizer.colors = availableColors;
|
12641
12658
|
customColoredColorizer.message = customColoredColorizer.message || customColored.message;
|
12642
12659
|
customColoredColorizer.greyMessage = customColoredColorizer.greyMessage || customColored.greyMessage;
|
12643
12660
|
return customColoredColorizer;
|
@@ -14239,6 +14256,7 @@ var require_parse_factory_options = __commonJS({
|
|
14239
14256
|
var colors2 = require_colors();
|
14240
14257
|
var handleCustomLevelsOpts = require_handle_custom_levels_opts();
|
14241
14258
|
var handleCustomLevelsNamesOpts = require_handle_custom_levels_names_opts();
|
14259
|
+
var handleLevelLabelData = require_get_level_label_data();
|
14242
14260
|
function parseFactoryOptions2(options) {
|
14243
14261
|
const EOL = options.crlf ? "\r\n" : "\n";
|
14244
14262
|
const IDENT = " ";
|
@@ -14260,16 +14278,30 @@ var require_parse_factory_options = __commonJS({
|
|
14260
14278
|
const useOnlyCustomProps = typeof options.useOnlyCustomProps === "boolean" ? options.useOnlyCustomProps : options.useOnlyCustomProps === "true";
|
14261
14279
|
const customLevels = handleCustomLevelsOpts(options.customLevels);
|
14262
14280
|
const customLevelNames = handleCustomLevelsNamesOpts(options.customLevels);
|
14281
|
+
const getLevelLabelData = handleLevelLabelData(useOnlyCustomProps, customLevels, customLevelNames);
|
14263
14282
|
let customColors;
|
14264
14283
|
if (options.customColors) {
|
14265
|
-
|
14266
|
-
|
14267
|
-
|
14268
|
-
|
14269
|
-
|
14270
|
-
|
14271
|
-
|
14272
|
-
|
14284
|
+
if (typeof options.customColors === "string") {
|
14285
|
+
customColors = options.customColors.split(",").reduce((agg, value) => {
|
14286
|
+
const [level, color] = value.split(":");
|
14287
|
+
const condition = useOnlyCustomProps ? options.customLevels : customLevelNames[level] !== void 0;
|
14288
|
+
const levelNum = condition ? customLevelNames[level] : LEVEL_NAMES[level];
|
14289
|
+
const colorIdx = levelNum !== void 0 ? levelNum : level;
|
14290
|
+
agg.push([colorIdx, color]);
|
14291
|
+
return agg;
|
14292
|
+
}, []);
|
14293
|
+
} else if (typeof options.customColors === "object") {
|
14294
|
+
customColors = Object.keys(options.customColors).reduce((agg, value) => {
|
14295
|
+
const [level, color] = [value, options.customColors[value]];
|
14296
|
+
const condition = useOnlyCustomProps ? options.customLevels : customLevelNames[level] !== void 0;
|
14297
|
+
const levelNum = condition ? customLevelNames[level] : LEVEL_NAMES[level];
|
14298
|
+
const colorIdx = levelNum !== void 0 ? levelNum : level;
|
14299
|
+
agg.push([colorIdx, color]);
|
14300
|
+
return agg;
|
14301
|
+
}, []);
|
14302
|
+
} else {
|
14303
|
+
throw new Error("options.customColors must be of type string or object.");
|
14304
|
+
}
|
14273
14305
|
}
|
14274
14306
|
const customProperties = { customLevels, customLevelNames };
|
14275
14307
|
if (useOnlyCustomProps === true && !options.customLevels) {
|
@@ -14291,6 +14323,7 @@ var require_parse_factory_options = __commonJS({
|
|
14291
14323
|
customProperties,
|
14292
14324
|
errorLikeObjectKeys,
|
14293
14325
|
errorProps,
|
14326
|
+
getLevelLabelData,
|
14294
14327
|
hideObject,
|
14295
14328
|
ignoreKeys,
|
14296
14329
|
includeKeys,
|
@@ -14560,7 +14593,8 @@ var require_prettify_object = __commonJS({
|
|
14560
14593
|
customPrettifiers,
|
14561
14594
|
errorLikeObjectKeys: errorLikeKeys,
|
14562
14595
|
objectColorizer,
|
14563
|
-
singleLine
|
14596
|
+
singleLine,
|
14597
|
+
colorizer
|
14564
14598
|
} = context;
|
14565
14599
|
const keysToIgnore = [].concat(skipKeys);
|
14566
14600
|
if (excludeLoggerKeys === true)
|
@@ -14568,7 +14602,7 @@ var require_prettify_object = __commonJS({
|
|
14568
14602
|
let result = "";
|
14569
14603
|
const { plain, errors } = Object.entries(log).reduce(({ plain: plain2, errors: errors2 }, [k, v]) => {
|
14570
14604
|
if (keysToIgnore.includes(k) === false) {
|
14571
|
-
const pretty2 = typeof customPrettifiers[k] === "function" ? customPrettifiers[k](v, k, log) : v;
|
14605
|
+
const pretty2 = typeof customPrettifiers[k] === "function" ? customPrettifiers[k](v, k, log, { colors: colorizer.colors }) : v;
|
14572
14606
|
if (errorLikeKeys.includes(k)) {
|
14573
14607
|
errors2[k] = pretty2;
|
14574
14608
|
} else {
|
@@ -14668,13 +14702,19 @@ var require_prettify_level = __commonJS({
|
|
14668
14702
|
colorizer,
|
14669
14703
|
customLevels,
|
14670
14704
|
customLevelNames,
|
14671
|
-
levelKey
|
14705
|
+
levelKey,
|
14706
|
+
getLevelLabelData
|
14672
14707
|
} = context;
|
14673
14708
|
const prettifier = context.customPrettifiers?.level;
|
14674
14709
|
const output = getPropertyValue(log, levelKey);
|
14675
14710
|
if (output === void 0)
|
14676
14711
|
return void 0;
|
14677
|
-
|
14712
|
+
const labelColorized = colorizer(output, { customLevels, customLevelNames });
|
14713
|
+
if (prettifier) {
|
14714
|
+
const [label] = getLevelLabelData(output);
|
14715
|
+
return prettifier(output, levelKey, log, { label, labelColorized, colors: colorizer.colors });
|
14716
|
+
}
|
14717
|
+
return labelColorized;
|
14678
14718
|
}
|
14679
14719
|
}
|
14680
14720
|
});
|
@@ -14715,7 +14755,7 @@ var require_prettify_message = __commonJS({
|
|
14715
14755
|
return colorizer.message(message);
|
14716
14756
|
}
|
14717
14757
|
if (messageFormat && typeof messageFormat === "function") {
|
14718
|
-
const msg = messageFormat(log, messageKey, levelLabel);
|
14758
|
+
const msg = messageFormat(log, messageKey, levelLabel, { colors: colorizer.colors });
|
14719
14759
|
return colorizer.message(msg);
|
14720
14760
|
}
|
14721
14761
|
if (messageKey in log === false)
|
@@ -14733,15 +14773,15 @@ var require_prettify_metadata = __commonJS({
|
|
14733
14773
|
"use strict";
|
14734
14774
|
module2.exports = prettifyMetadata;
|
14735
14775
|
function prettifyMetadata({ log, context }) {
|
14736
|
-
const prettifiers = context
|
14776
|
+
const { customPrettifiers: prettifiers, colorizer } = context;
|
14737
14777
|
let line = "";
|
14738
14778
|
if (log.name || log.pid || log.hostname) {
|
14739
14779
|
line += "(";
|
14740
14780
|
if (log.name) {
|
14741
|
-
line += prettifiers.name ? prettifiers.name(log.name) : log.name;
|
14781
|
+
line += prettifiers.name ? prettifiers.name(log.name, "name", log, { colors: colorizer.colors }) : log.name;
|
14742
14782
|
}
|
14743
14783
|
if (log.pid) {
|
14744
|
-
const prettyPid = prettifiers.pid ? prettifiers.pid(log.pid) : log.pid;
|
14784
|
+
const prettyPid = prettifiers.pid ? prettifiers.pid(log.pid, "pid", log, { colors: colorizer.colors }) : log.pid;
|
14745
14785
|
if (log.name && log.pid) {
|
14746
14786
|
line += "/" + prettyPid;
|
14747
14787
|
} else {
|
@@ -14749,12 +14789,14 @@ var require_prettify_metadata = __commonJS({
|
|
14749
14789
|
}
|
14750
14790
|
}
|
14751
14791
|
if (log.hostname) {
|
14752
|
-
|
14792
|
+
const prettyHostname = prettifiers.hostname ? prettifiers.hostname(log.hostname, "hostname", log, { colors: colorizer.colors }) : log.hostname;
|
14793
|
+
line += `${line === "(" ? "on" : " on"} ${prettyHostname}`;
|
14753
14794
|
}
|
14754
14795
|
line += ")";
|
14755
14796
|
}
|
14756
14797
|
if (log.caller) {
|
14757
|
-
|
14798
|
+
const prettyCaller = prettifiers.caller ? prettifiers.caller(log.caller, "caller", log, { colors: colorizer.colors }) : log.caller;
|
14799
|
+
line += `${line === "" ? "" : " "}<${prettyCaller}>`;
|
14758
14800
|
}
|
14759
14801
|
if (line === "") {
|
14760
14802
|
return void 0;
|
@@ -14817,7 +14859,8 @@ var require_utils3 = __commonJS({
|
|
14817
14859
|
prettifyMetadata: require_prettify_metadata(),
|
14818
14860
|
prettifyObject: require_prettify_object(),
|
14819
14861
|
prettifyTime: require_prettify_time(),
|
14820
|
-
splitPropertyKey: require_split_property_key()
|
14862
|
+
splitPropertyKey: require_split_property_key(),
|
14863
|
+
getLevelLabelData: require_get_level_label_data()
|
14821
14864
|
};
|
14822
14865
|
}
|
14823
14866
|
});
|
@@ -15035,7 +15078,7 @@ var require_pretty = __commonJS({
|
|
15035
15078
|
if (line.length > 0 && !this.singleLine) {
|
15036
15079
|
line += this.EOL;
|
15037
15080
|
}
|
15038
|
-
if (log.type === "Error" && log.stack) {
|
15081
|
+
if (log.type === "Error" && typeof log.stack === "string") {
|
15039
15082
|
const prettifiedErrorLog = prettifyErrorLog({ log, context: this.context });
|
15040
15083
|
if (this.singleLine)
|
15041
15084
|
line += this.EOL;
|
@@ -15110,8 +15153,19 @@ function prettyFactory(options) {
|
|
15110
15153
|
return pretty.bind({ ...context, context });
|
15111
15154
|
}
|
15112
15155
|
function build(opts = {}) {
|
15113
|
-
|
15156
|
+
let pretty2 = prettyFactory(opts);
|
15114
15157
|
return abstractTransport(function(source) {
|
15158
|
+
source.on("message", function pinoConfigListener(message) {
|
15159
|
+
if (!message || message.code !== "PINO_CONFIG")
|
15160
|
+
return;
|
15161
|
+
Object.assign(opts, {
|
15162
|
+
messageKey: message.config.messageKey,
|
15163
|
+
errorLikeObjectKeys: Array.from(/* @__PURE__ */ new Set([...opts.errorLikeObjectKeys || ERROR_LIKE_KEYS, message.config.errorKey])),
|
15164
|
+
customLevels: message.config.levels.values
|
15165
|
+
});
|
15166
|
+
pretty2 = prettyFactory(opts);
|
15167
|
+
source.off("message", pinoConfigListener);
|
15168
|
+
});
|
15115
15169
|
const stream = new Transform({
|
15116
15170
|
objectMode: true,
|
15117
15171
|
autoDestroy: true,
|
@@ -15143,4 +15197,5 @@ module.exports = build;
|
|
15143
15197
|
module.exports.build = build;
|
15144
15198
|
module.exports.prettyFactory = prettyFactory;
|
15145
15199
|
module.exports.colorizerFactory = colors;
|
15200
|
+
module.exports.isColorSupported = isColorSupported;
|
15146
15201
|
module.exports.default = build;
|