@salesforce/core 6.3.1-bundle-dev.0 → 6.3.1-bundle-dev1.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
@@ -34,6 +34,7 @@ const fs = __importStar(require("node:fs"));
34
34
  const os = __importStar(require("node:os"));
35
35
  const path = __importStar(require("node:path"));
36
36
  const util = __importStar(require("node:util"));
37
+ const node_url_1 = require("node:url");
37
38
  const ts_types_1 = require("@salesforce/ts-types");
38
39
  const kit_1 = require("@salesforce/kit");
39
40
  const sfError_1 = require("./sfError");
@@ -161,6 +162,9 @@ const jsAndJsonLoader = (filePath, fileContents) => {
161
162
  * // Create loader functions for all files in the messages directory
162
163
  * Messages.importMessagesDirectory(__dirname);
163
164
  *
165
+ * // or, for ESM code
166
+ * Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
167
+ *
164
168
  * // Now you can use the messages from anywhere in your code or file.
165
169
  * // If using importMessageDirectory, the bundle name is the file name.
166
170
  * const messages: Messages = Messages.loadMessages(packageName, bundleName);
@@ -252,6 +256,17 @@ class Messages {
252
256
  this.setLoaderFunction(packageName, bundleName, Messages.generateFileLoaderFunction(bundleName, filePath));
253
257
  }
254
258
  }
259
+ /**
260
+ * Support ESM plugins who can't use __dirname
261
+ *
262
+ * @param metaUrl pass in `import.meta.url`
263
+ * @param truncateToProjectPath Will look for the messages directory in the project root (where the package.json file is located).
264
+ * i.e., the module is typescript and the messages folder is in the top level of the module directory.
265
+ * @param packageName The npm package name. Figured out from the root directory's package.json.
266
+ */
267
+ static importMessagesDirectoryFromMetaUrl(metaUrl, truncateToProjectPath = true, packageName) {
268
+ return Messages.importMessagesDirectory(path.dirname((0, node_url_1.fileURLToPath)(metaUrl)), truncateToProjectPath, packageName);
269
+ }
255
270
  /**
256
271
  * Import all json and js files in a messages directory. Use the file name as the bundle key when
257
272
  * {@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
  }
@@ -224,7 +224,7 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
224
224
  parseAuthCodeFromRequest(response, request) {
225
225
  if (!this.validateState(request)) {
226
226
  const error = new sfError_1.SfError('urlStateMismatch');
227
- this.webServer.sendError(400, `${error.message}\n`, response);
227
+ this.webServer.sendError(400, error.message, response);
228
228
  this.closeRequest(request);
229
229
  this.logger.warn('urlStateMismatchAttempt detected.');
230
230
  if (!(0, ts_types_1.get)(this.webServer.server, 'urlStateMismatchAttempt')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "6.3.1-bundle-dev.0",
3
+ "version": "6.3.1-bundle-dev1.1",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "dist/index",
6
6
  "types": "dist/exported.d.ts",
@@ -19,7 +19,7 @@
19
19
  "lint": "wireit",
20
20
  "lint-fix": "yarn sf-lint --fix",
21
21
  "postcompile": "tsc -p typedocExamples",
22
- "prepack": "sf-prepack",
22
+ "prepack": "sf-prepack && yarn bundle",
23
23
  "prepare": "sf-install",
24
24
  "test": "wireit",
25
25
  "test:only": "wireit",
@@ -54,7 +54,7 @@
54
54
  "jszip": "3.10.1",
55
55
  "pino": "^8.16.2",
56
56
  "pino-abstract-transport": "^1.1.0",
57
- "pino-pretty": "^10.2.3",
57
+ "pino-pretty": "^10.3.1",
58
58
  "proper-lockfile": "^4.1.2",
59
59
  "semver": "^7.5.4",
60
60
  "ts-retry-promise": "^0.7.1"
@@ -68,11 +68,11 @@
68
68
  "@types/proper-lockfile": "^4.1.4",
69
69
  "benchmark": "^2.1.4",
70
70
  "chai-string": "^1.5.0",
71
+ "ts-node": "^10.9.2",
72
+ "ts-patch": "^3.1.1",
71
73
  "esbuild": "^0.19.5",
72
74
  "esbuild-plugin-pino": "^2.1.0",
73
75
  "npm-dts": "^1.3.12",
74
- "ts-node": "^10.9.1",
75
- "ts-patch": "^3.0.2",
76
76
  "typescript": "^5.2.2"
77
77
  },
78
78
  "repository": {