@salesforce/core 8.1.0 → 8.1.2
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/lifecycleEvents.d.ts +1 -1
- package/lib/lifecycleEvents.js +3 -1
- package/lib/messages.js +24 -2
- package/package.json +2 -2
package/lib/lifecycleEvents.d.ts
CHANGED
|
@@ -94,5 +94,5 @@ export declare class Lifecycle {
|
|
|
94
94
|
*/
|
|
95
95
|
emit<T = AnyJson>(eventName: string, data: T): Promise<void>;
|
|
96
96
|
}
|
|
97
|
-
export declare const cloneUniqueListeners: (uniqueListeners: UniqueListenerMap) => UniqueListenerMap;
|
|
97
|
+
export declare const cloneUniqueListeners: (uniqueListeners: UniqueListenerMap | undefined) => UniqueListenerMap;
|
|
98
98
|
export {};
|
package/lib/lifecycleEvents.js
CHANGED
|
@@ -233,6 +233,8 @@ class Lifecycle {
|
|
|
233
233
|
}
|
|
234
234
|
exports.Lifecycle = Lifecycle;
|
|
235
235
|
const cloneListeners = (listeners) => new Map(Array.from(listeners.entries()));
|
|
236
|
-
const cloneUniqueListeners = (uniqueListeners) =>
|
|
236
|
+
const cloneUniqueListeners = (uniqueListeners) =>
|
|
237
|
+
// in case we're crossing major sfdx-core versions where uniqueListeners might be undefined
|
|
238
|
+
new Map(Array.from(uniqueListeners?.entries() ?? []).map(([key, value]) => [key, cloneListeners(value)]));
|
|
237
239
|
exports.cloneUniqueListeners = cloneUniqueListeners;
|
|
238
240
|
//# sourceMappingURL=lifecycleEvents.js.map
|
package/lib/messages.js
CHANGED
|
@@ -37,6 +37,7 @@ const util = __importStar(require("node:util"));
|
|
|
37
37
|
const node_url_1 = require("node:url");
|
|
38
38
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
39
39
|
const kit_1 = require("@salesforce/kit");
|
|
40
|
+
const lifecycleEvents_1 = require("./lifecycleEvents");
|
|
40
41
|
const sfError_1 = require("./sfError");
|
|
41
42
|
const getKey = (packageName, bundleName) => `${packageName}:${bundleName}`;
|
|
42
43
|
const REGEXP_NO_CONTENT = /^\s*$/g;
|
|
@@ -519,8 +520,29 @@ class Messages {
|
|
|
519
520
|
}
|
|
520
521
|
const messages = (0, kit_1.ensureArray)(msg);
|
|
521
522
|
return messages.map((message) => {
|
|
522
|
-
(0, ts_types_1.ensureString)(message);
|
|
523
|
-
|
|
523
|
+
const msgStr = (0, ts_types_1.ensureString)(message);
|
|
524
|
+
// If the message does not contain a specifier, util.format still appends the token to the end.
|
|
525
|
+
// The 'markdownLoader' automatically splits bulleted lists into arrays.
|
|
526
|
+
// This causes the token to be appended to each line regardless of the presence of a specifier.
|
|
527
|
+
// Here we check for the presence of a specifier and only format the message if one is present.
|
|
528
|
+
// https://nodejs.org/api/util.html#utilformatformat-args
|
|
529
|
+
// https://regex101.com/r/8Hf8Z6/1
|
|
530
|
+
const specifierRegex = new RegExp('%[sdifjoO]{1}', 'gm');
|
|
531
|
+
// NOTE: This is a temporary telemetry event to track down missing specifiers in messages.
|
|
532
|
+
// Once we have enough data and correct missing specifiers, we can remove this.
|
|
533
|
+
// The followup work is outlined in: W-16197665
|
|
534
|
+
if (!specifierRegex.test(msgStr) && tokens.length > 0) {
|
|
535
|
+
void lifecycleEvents_1.Lifecycle.getInstance().emitTelemetry({
|
|
536
|
+
eventName: 'missing_message_specifier',
|
|
537
|
+
library: 'sfdx-core',
|
|
538
|
+
function: 'getMessageWithMap',
|
|
539
|
+
messagesLength: messages.length,
|
|
540
|
+
message: msgStr,
|
|
541
|
+
tokensLength: tokens.length,
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
// return specifierRegex.test(msgStr) ? util.format(msgStr, ...tokens) : msgStr;
|
|
545
|
+
return util.format(msgStr, ...tokens);
|
|
524
546
|
});
|
|
525
547
|
}
|
|
526
548
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.2",
|
|
4
4
|
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@salesforce/kit": "^3.1.6",
|
|
57
57
|
"@salesforce/schemas": "^1.9.0",
|
|
58
58
|
"@salesforce/ts-types": "^2.0.10",
|
|
59
|
-
"ajv": "^8.
|
|
59
|
+
"ajv": "^8.17.1",
|
|
60
60
|
"change-case": "^4.1.2",
|
|
61
61
|
"fast-levenshtein": "^3.0.0",
|
|
62
62
|
"faye": "^1.4.0",
|