@salesforce/core 6.3.0 → 6.4.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/messages.d.ts CHANGED
@@ -78,6 +78,9 @@ export type StoredMessageMap = Map<string, StoredMessage>;
78
78
  * // Create loader functions for all files in the messages directory
79
79
  * Messages.importMessagesDirectory(__dirname);
80
80
  *
81
+ * // or, for ESM code
82
+ * Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
83
+ *
81
84
  * // Now you can use the messages from anywhere in your code or file.
82
85
  * // If using importMessageDirectory, the bundle name is the file name.
83
86
  * const messages: Messages = Messages.loadMessages(packageName, bundleName);
@@ -146,6 +149,15 @@ export declare class Messages<T extends string> {
146
149
  * @param filePath The path of the file.
147
150
  */
148
151
  static importMessageFile(packageName: string, filePath: string): void;
152
+ /**
153
+ * Support ESM plugins who can't use __dirname
154
+ *
155
+ * @param metaUrl pass in `import.meta.url`
156
+ * @param truncateToProjectPath Will look for the messages directory in the project root (where the package.json file is located).
157
+ * i.e., the module is typescript and the messages folder is in the top level of the module directory.
158
+ * @param packageName The npm package name. Figured out from the root directory's package.json.
159
+ */
160
+ static importMessagesDirectoryFromMetaUrl(metaUrl: string, truncateToProjectPath?: boolean, packageName?: string): void;
149
161
  /**
150
162
  * Import all json and js files in a messages directory. Use the file name as the bundle key when
151
163
  * {@link Messages.loadMessages} is called. By default, we're assuming the moduleDirectoryPart is a
package/lib/messages.js CHANGED
@@ -11,6 +11,7 @@ const fs = require("node:fs");
11
11
  const os = require("node:os");
12
12
  const path = require("node:path");
13
13
  const util = require("node:util");
14
+ const node_url_1 = require("node:url");
14
15
  const ts_types_1 = require("@salesforce/ts-types");
15
16
  const kit_1 = require("@salesforce/kit");
16
17
  const sfError_1 = require("./sfError");
@@ -138,6 +139,9 @@ const jsAndJsonLoader = (filePath, fileContents) => {
138
139
  * // Create loader functions for all files in the messages directory
139
140
  * Messages.importMessagesDirectory(__dirname);
140
141
  *
142
+ * // or, for ESM code
143
+ * Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
144
+ *
141
145
  * // Now you can use the messages from anywhere in your code or file.
142
146
  * // If using importMessageDirectory, the bundle name is the file name.
143
147
  * const messages: Messages = Messages.loadMessages(packageName, bundleName);
@@ -229,6 +233,17 @@ class Messages {
229
233
  this.setLoaderFunction(packageName, bundleName, Messages.generateFileLoaderFunction(bundleName, filePath));
230
234
  }
231
235
  }
236
+ /**
237
+ * Support ESM plugins who can't use __dirname
238
+ *
239
+ * @param metaUrl pass in `import.meta.url`
240
+ * @param truncateToProjectPath Will look for the messages directory in the project root (where the package.json file is located).
241
+ * i.e., the module is typescript and the messages folder is in the top level of the module directory.
242
+ * @param packageName The npm package name. Figured out from the root directory's package.json.
243
+ */
244
+ static importMessagesDirectoryFromMetaUrl(metaUrl, truncateToProjectPath = true, packageName) {
245
+ return Messages.importMessagesDirectory(path.dirname((0, node_url_1.fileURLToPath)(metaUrl)), truncateToProjectPath, packageName);
246
+ }
232
247
  /**
233
248
  * Import all json and js files in a messages directory. Use the file name as the bundle key when
234
249
  * {@link Messages.loadMessages} is called. By default, we're assuming the moduleDirectoryPart is a
@@ -304,7 +304,7 @@ class Connection extends jsforce_1.Connection {
304
304
  });
305
305
  const query = tooling ? await this.tooling.query(soql, options) : await this.query(soql, options);
306
306
  if (query.records.length && query.totalSize > query.records.length) {
307
- void lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`The query result is missing ${query.totalSize - query.records.length} records due to a ${maxFetch} record limit. Increase the number of records returned by setting the config value "maxQueryLimit" or the environment variable "SFDX_MAX_QUERY_LIMIT" to ${query.totalSize} or greater than ${maxFetch}.`);
307
+ void lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`The query result is missing ${query.totalSize - query.records.length} records due to a ${maxFetch} record limit. Increase the number of records returned by setting the config value "maxQueryLimit" or the environment variable "SF_ORG_MAX_QUERY_LIMIT" to ${query.totalSize} or greater than ${maxFetch}.`);
308
308
  }
309
309
  return query;
310
310
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "6.3.0",
3
+ "version": "6.4.1",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -66,8 +66,8 @@
66
66
  "@types/proper-lockfile": "^4.1.4",
67
67
  "benchmark": "^2.1.4",
68
68
  "chai-string": "^1.5.0",
69
- "ts-node": "^10.9.1",
70
- "ts-patch": "^3.0.2",
69
+ "ts-node": "^10.9.2",
70
+ "ts-patch": "^3.1.1",
71
71
  "typescript": "^5.2.2"
72
72
  },
73
73
  "repository": {