@salesforce/cli 2.12.6 → 2.12.7-esm.0

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/README.md CHANGED
@@ -24,7 +24,7 @@ $ npm install -g @salesforce/cli
24
24
  $ sf COMMAND
25
25
  running command...
26
26
  $ sf (--version|-v)
27
- @salesforce/cli/2.12.6 linux-x64 node-v18.18.0
27
+ @salesforce/cli/2.12.7-esm.0 linux-x64 node-v18.18.0
28
28
  $ sf --help [COMMAND]
29
29
  USAGE
30
30
  $ sf COMMAND
package/bin/dev.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ts-node
2
+
3
+ void (async () => {
4
+ const oclif = await import('@oclif/core');
5
+ oclif.settings.performanceEnabled = true;
6
+ await oclif.execute({ development: true, dir: import.meta.url });
7
+ })();
package/bin/run.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+
3
+ void (async () => {
4
+ // Since the CLI is a single process, we can have a larger amount of max listeners since
5
+ // the process gets shut down. Don't set it to 0 (no limit) since we should still be aware
6
+ // of rouge event listeners
7
+ process.setMaxListeners(parseInt(process.env.SF_MAX_EVENT_LISTENERS, 10) || 1000);
8
+
9
+ // Don't let other plugins override the CLI specified max listener count
10
+ process.setMaxListeners = () => {};
11
+
12
+ // Pre-process/prune flags before creating or running the actual CLI
13
+ (await import('../dist/flags.js')).preprocessCliFlags(process);
14
+
15
+ const oclif = await import('@oclif/core');
16
+ const { createRequire } = await import('module');
17
+ const pjson = createRequire(import.meta.url)('../package.json');
18
+
19
+ const cli = await import('../dist/cli.js');
20
+
21
+ cli
22
+ .create({ version: pjson.version, bin: pjson.oclif.bin, channel: 'stable' })
23
+ .run()
24
+ .then(async () => {
25
+ await oclif.flush();
26
+ })
27
+ .catch(async (err) => {
28
+ await oclif.handle(err);
29
+ });
30
+ })();
package/dist/cli.js CHANGED
@@ -1,59 +1,55 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2022, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.create = exports.configureAutoUpdate = exports.configureUpdateSites = exports.UPDATE_DISABLED_DEMO = exports.UPDATE_DISABLED_NPM = exports.UPDATE_DISABLED_INSTALLER = void 0;
10
- const os = require("os");
11
- const path = require("path");
12
- const core_1 = require("@oclif/core");
13
- const kit_1 = require("@salesforce/kit");
14
- const ts_types_1 = require("@salesforce/ts-types");
15
- const Debug = require("debug");
16
- const env_1 = require("./util/env");
7
+ import * as os from 'os';
8
+ import * as path from 'path';
9
+ import { fileURLToPath } from 'url';
10
+ import { Config, run as oclifRun, settings } from '@oclif/core';
11
+ import { set } from '@salesforce/kit';
12
+ import Debug from 'debug';
13
+ import { default as nodeEnv, Env } from './util/env.js';
17
14
  const debug = Debug('sf');
18
15
  const envVars = [
19
16
  ...new Set([
20
17
  ...Object.keys(process.env).filter((e) => e.startsWith('SF_') || e.startsWith('SFDX_')),
21
18
  'NODE_OPTIONS',
22
- env_1.Env.SF_AUTOUPDATE_DISABLE,
19
+ Env.SF_AUTOUPDATE_DISABLE,
23
20
  'SF_BINPATH',
24
21
  'SF_COMPILE_CACHE',
25
- env_1.Env.SF_DISABLE_AUTOUPDATE,
26
- env_1.Env.SF_ENV,
27
- env_1.Env.SF_INSTALLER,
28
- env_1.Env.SF_NPM_REGISTRY,
22
+ Env.SF_DISABLE_AUTOUPDATE,
23
+ Env.SF_ENV,
24
+ Env.SF_INSTALLER,
25
+ Env.SF_NPM_REGISTRY,
29
26
  'SF_REDIRECTED',
30
- env_1.Env.SF_UPDATE_INSTRUCTIONS,
27
+ Env.SF_UPDATE_INSTRUCTIONS,
31
28
  ]),
32
29
  ];
33
- exports.UPDATE_DISABLED_INSTALLER = 'Manual and automatic CLI updates have been disabled by setting "SF_AUTOUPDATE_DISABLE=true". ' +
30
+ export const UPDATE_DISABLED_INSTALLER = 'Manual and automatic CLI updates have been disabled by setting "SF_AUTOUPDATE_DISABLE=true". ' +
34
31
  'To check for a new version, unset that environment variable.';
35
- exports.UPDATE_DISABLED_NPM = 'Use "npm update --global @salesforce/cli" to update npm-based installations.';
36
- exports.UPDATE_DISABLED_DEMO = 'Manual and automatic CLI updates have been disabled in DEMO mode. ' +
32
+ export const UPDATE_DISABLED_NPM = 'Use "npm update --global @salesforce/cli" to update npm-based installations.';
33
+ export const UPDATE_DISABLED_DEMO = 'Manual and automatic CLI updates have been disabled in DEMO mode. ' +
37
34
  'To check for a new version, unset the environment variable SF_ENV.';
38
- function configureUpdateSites(config, env = env_1.default) {
35
+ export function configureUpdateSites(config, env = nodeEnv) {
39
36
  const npmRegistry = env.getNpmRegistryOverride();
40
37
  if (npmRegistry) {
41
38
  // Override config value if set via envar
42
- (0, kit_1.set)(config, 'pjson.oclif.warn-if-update-available.registry', npmRegistry);
39
+ set(config, 'pjson.oclif.warn-if-update-available.registry', npmRegistry);
43
40
  }
44
41
  }
45
- exports.configureUpdateSites = configureUpdateSites;
46
- function configureAutoUpdate(envars) {
42
+ export function configureAutoUpdate(envars) {
47
43
  if (envars.isDemoMode()) {
48
44
  // Disable autoupdates in demo mode
49
45
  envars.setAutoupdateDisabled(true);
50
- envars.setUpdateInstructions(exports.UPDATE_DISABLED_DEMO);
46
+ envars.setUpdateInstructions(UPDATE_DISABLED_DEMO);
51
47
  return;
52
48
  }
53
49
  if (envars.isInstaller()) {
54
50
  envars.normalizeAutoupdateDisabled();
55
51
  if (envars.isAutoupdateDisabled()) {
56
- envars.setUpdateInstructions(exports.UPDATE_DISABLED_INSTALLER);
52
+ envars.setUpdateInstructions(UPDATE_DISABLED_INSTALLER);
57
53
  }
58
54
  return;
59
55
  }
@@ -63,10 +59,9 @@ function configureAutoUpdate(envars) {
63
59
  envars.setAutoupdateDisabled(true);
64
60
  }
65
61
  if (envars.isAutoupdateDisabled()) {
66
- envars.setUpdateInstructions(exports.UPDATE_DISABLED_NPM);
62
+ envars.setUpdateInstructions(UPDATE_DISABLED_NPM);
67
63
  }
68
64
  }
69
- exports.configureAutoUpdate = configureAutoUpdate;
70
65
  function debugCliInfo(version, channel, env, config) {
71
66
  function debugSection(section, items) {
72
67
  const pad = 25;
@@ -91,28 +86,27 @@ function debugCliInfo(version, channel, env, config) {
91
86
  debugSection('ENV', [...envVars].map((key) => [key, env.getString(key, '<not set>')]));
92
87
  debugSection('ARGS', process.argv.map((arg, i) => [i.toString(), arg]));
93
88
  }
94
- function create(version, channel, run, env = env_1.default) {
95
- core_1.settings.performanceEnabled = true;
96
- const root = path.resolve(__dirname, '..');
97
- // eslint-disable-next-line @typescript-eslint/no-var-requires
98
- const pjson = require(path.resolve(__dirname, '..', 'package.json'));
89
+ export function create(opts) {
90
+ var _a;
91
+ settings.performanceEnabled = true;
92
+ const root = path.resolve(fileURLToPath(import.meta.url), '..');
99
93
  const args = process.argv.slice(2);
94
+ const env = (_a = opts.env) !== null && _a !== void 0 ? _a : nodeEnv;
100
95
  return {
101
96
  async run() {
102
- const config = new core_1.Config({
103
- name: (0, ts_types_1.get)(pjson, 'oclif.bin'),
97
+ const config = new Config({
98
+ name: opts.bin,
104
99
  root,
105
- version,
106
- channel,
100
+ version: opts.version,
101
+ channel: opts.channel,
107
102
  });
108
103
  await config.load();
109
- configureUpdateSites(config, env);
104
+ configureUpdateSites(config, opts.env);
110
105
  configureAutoUpdate(env);
111
- debugCliInfo(version, channel, env, config);
106
+ debugCliInfo(opts.version, opts.channel, env, config);
112
107
  // Example of how run is used in a test https://github.com/salesforcecli/cli/pull/171/files#diff-1deee0a575599b2df117c280da319f7938aaf6fdb0c04bcdbde769dbf464be69R46
113
- return run ? run(args, config) : (0, core_1.run)(args, config);
108
+ return opts.run ? opts.run(args, config) : oclifRun(args, config);
114
109
  },
115
110
  };
116
111
  }
117
- exports.create = create;
118
112
  //# sourceMappingURL=cli.js.map
package/dist/flags.js CHANGED
@@ -1,13 +1,10 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2020, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.preprocessCliFlags = void 0;
10
- function preprocessCliFlags(process) {
7
+ export function preprocessCliFlags(process) {
11
8
  process.argv.map((arg) => {
12
9
  if (arg === '--dev-debug') {
13
10
  let debug = '*';
@@ -25,7 +22,4 @@ function preprocessCliFlags(process) {
25
22
  }
26
23
  });
27
24
  }
28
- exports.preprocessCliFlags = preprocessCliFlags;
29
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
30
- module.exports.preprocessCliFlags = preprocessCliFlags;
31
25
  //# sourceMappingURL=flags.js.map
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SfCommandHelp = void 0;
4
1
  /*
5
2
  * Copyright (c) 2022, salesforce.com, inc.
6
3
  * All rights reserved.
7
4
  * Licensed under the BSD 3-Clause license.
8
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
6
  */
10
- const core_1 = require("@oclif/core");
11
- class SfCommandHelp extends core_1.CommandHelp {
7
+ import { CommandHelp } from '@oclif/core';
8
+ export class SfCommandHelp extends CommandHelp {
12
9
  constructor(command, config, opts) {
13
10
  super(command, config, opts);
14
11
  this.command = command;
@@ -57,5 +54,4 @@ class SfCommandHelp extends core_1.CommandHelp {
57
54
  return sections;
58
55
  }
59
56
  }
60
- exports.SfCommandHelp = SfCommandHelp;
61
57
  //# sourceMappingURL=sfCommandHelp.js.map
@@ -1,18 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  /*
4
2
  * Copyright (c) 2022, salesforce.com, inc.
5
3
  * All rights reserved.
6
4
  * Licensed under the BSD 3-Clause license.
7
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
6
  */
9
- const core_1 = require("@oclif/core");
10
- const chalk = require("chalk");
11
- const sfCommandHelp_1 = require("./sfCommandHelp");
12
- class SfHelp extends core_1.Help {
7
+ import { Help } from '@oclif/core';
8
+ import chalk from 'chalk';
9
+ import { SfCommandHelp } from './sfCommandHelp.js';
10
+ export default class SfHelp extends Help {
13
11
  constructor() {
14
12
  super(...arguments);
15
- this.CommandHelpClass = sfCommandHelp_1.SfCommandHelp;
13
+ this.CommandHelpClass = SfCommandHelp;
16
14
  this.showShortHelp = false;
17
15
  this.commands = [];
18
16
  this.subCommands = {};
@@ -45,5 +43,4 @@ class SfHelp extends core_1.Help {
45
43
  super.log(...formatted);
46
44
  }
47
45
  }
48
- exports.default = SfHelp;
49
46
  //# sourceMappingURL=sfHelp.js.map
@@ -1,47 +1,22 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2021, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const path_1 = require("path");
10
- const child_process_1 = require("child_process");
11
- const core_1 = require("@oclif/core");
12
- const logError = (msg) => {
13
- core_1.ux.log('NOTE: This error can be ignored in CI and may be silenced in the future');
14
- core_1.ux.log('- Set the SF_HIDE_RELEASE_NOTES env var to "true" to skip this script\n');
15
- core_1.ux.log(msg.toString());
16
- };
17
- /*
18
- * NOTE: Please read "Notes about the hook scripts" in this PR before making changes:
19
- * https://github.com/salesforcecli/sfdx-cli/pull/407
20
- */
21
- const hook = async () => new Promise((resolve) => {
22
- if (process.env.SF_HIDE_RELEASE_NOTES === 'true') {
23
- resolve();
7
+ import { ux } from '@oclif/core';
8
+ export const hook = async function ({ config }) {
9
+ if (process.env.SF_HIDE_RELEASE_NOTES === 'true')
10
+ return;
11
+ try {
12
+ return await config.runCommand('whatsnew', ['--hook']);
24
13
  }
25
- const executable = process.platform === 'win32' ? 'run.cmd' : 'run';
26
- const cmd = (0, child_process_1.spawn)((0, path_1.join)(__dirname, '..', '..', 'bin', executable), ['whatsnew', '--hook'], {
27
- stdio: ['ignore', 'inherit', 'pipe'],
28
- timeout: 10000,
29
- });
30
- cmd.stderr.on('data', (error) => {
31
- logError(error);
32
- resolve();
33
- });
34
- cmd.on('error', (error) => {
35
- logError(error);
36
- resolve();
37
- });
38
- // 'exit' fires whether or not the stream are finished
39
- cmd.on('exit', () => {
40
- resolve();
41
- });
42
- cmd.on('close', () => {
43
- resolve();
44
- });
45
- });
46
- exports.default = hook;
14
+ catch (err) {
15
+ const error = err;
16
+ ux.log('NOTE: This error can be ignored in CI and may be silenced in the future');
17
+ ux.log('- Set the SF_HIDE_RELEASE_NOTES env var to "true" to skip this script\n');
18
+ ux.log(error.message);
19
+ }
20
+ };
21
+ export default hook;
47
22
  //# sourceMappingURL=display-release-notes.js.map
@@ -1,19 +1,18 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2022, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const os = require("os");
10
- const core_1 = require("@oclif/core");
11
- const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
7
+ import * as os from 'os';
8
+ import { toConfiguredId, toStandardizedId, loadHelpClass } from '@oclif/core';
9
+ import { Prompter } from '@salesforce/sf-plugins-core';
12
10
  function buildChoices(matches, config) {
13
- const configuredIds = matches.map((p) => (0, core_1.toConfiguredId)(p.id, config));
11
+ const configuredIds = matches.map((p) => toConfiguredId(p.id, config));
14
12
  const maxCommandLength = configuredIds.reduce((max, id) => Math.max(max, id.length), 0);
15
13
  return matches.map((p, i) => {
16
- const summary = p.summary ?? p.description?.split(os.EOL)[0] ?? '';
14
+ var _a, _b, _c;
15
+ const summary = (_c = (_a = p.summary) !== null && _a !== void 0 ? _a : (_b = p.description) === null || _b === void 0 ? void 0 : _b.split(os.EOL)[0]) !== null && _c !== void 0 ? _c : '';
17
16
  return {
18
17
  name: `${configuredIds[i].padEnd(maxCommandLength + 5, ' ')}${summary}`,
19
18
  value: p,
@@ -22,7 +21,7 @@ function buildChoices(matches, config) {
22
21
  });
23
22
  }
24
23
  async function determineCommand(config, matches) {
25
- const prompter = new sf_plugins_core_1.Prompter();
24
+ const prompter = new Prompter();
26
25
  const choices = buildChoices(matches, config);
27
26
  const { command } = await prompter.timedPrompt([
28
27
  {
@@ -37,12 +36,12 @@ async function determineCommand(config, matches) {
37
36
  const hook = async function ({ config, matches, argv }) {
38
37
  const command = await determineCommand(config, matches);
39
38
  if (argv.includes('--help') || argv.includes('-h')) {
40
- const Help = await (0, core_1.loadHelpClass)(config);
39
+ const Help = await loadHelpClass(config);
41
40
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
42
41
  const help = new Help(config, config.pjson.helpOptions);
43
- return help.showHelp([(0, core_1.toStandardizedId)(command, config), ...argv]);
42
+ return help.showHelp([toStandardizedId(command, config), ...argv]);
44
43
  }
45
- return config.runCommand((0, core_1.toStandardizedId)(command, config), argv);
44
+ return config.runCommand(toStandardizedId(command, config), argv);
46
45
  };
47
- exports.default = hook;
46
+ export default hook;
48
47
  //# sourceMappingURL=incomplete.js.map
@@ -1,18 +1,16 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2022, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const core_1 = require("@oclif/core");
7
+ import { Errors } from '@oclif/core';
10
8
  const hook = async function (options) {
11
9
  const verifySignHookResult = await this.config.runHook('plugins:preinstall:verify:signature', options);
12
10
  const pluginTrustFailure = verifySignHookResult.failures.find((failure) => failure.plugin.name === '@salesforce/plugin-trust');
13
11
  if (pluginTrustFailure !== undefined) {
14
- core_1.Errors.handle(pluginTrustFailure.error);
12
+ await Errors.handle(pluginTrustFailure.error);
15
13
  }
16
14
  };
17
- exports.default = hook;
15
+ export default hook;
18
16
  //# sourceMappingURL=pluginsPreinstall.js.map
@@ -1,14 +1,13 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2023, salesforce.com, inc.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const core_1 = require("@oclif/core");
7
+ import { ux } from '@oclif/core';
10
8
  // eslint-disable-next-line @typescript-eslint/require-await
11
9
  const hook = async function ({ Command, config }) {
10
+ var _a, _b, _c;
12
11
  if (process.argv.includes('--json'))
13
12
  return;
14
13
  const { plugin } = Command;
@@ -16,14 +15,14 @@ const hook = async function ({ Command, config }) {
16
15
  return;
17
16
  if (plugin.type === 'link')
18
17
  return;
19
- const jitPlugins = config.pjson.oclif.jitPlugins ?? {};
20
- const deps = config.pjson.dependencies ?? {};
21
- const specifiedVersion = jitPlugins[plugin.name] ?? deps[plugin.name];
18
+ const jitPlugins = (_a = config.pjson.oclif.jitPlugins) !== null && _a !== void 0 ? _a : {};
19
+ const deps = (_b = config.pjson.dependencies) !== null && _b !== void 0 ? _b : {};
20
+ const specifiedVersion = (_c = jitPlugins[plugin.name]) !== null && _c !== void 0 ? _c : deps[plugin.name];
22
21
  if (!specifiedVersion)
23
22
  return;
24
23
  if (plugin.version !== specifiedVersion) {
25
- core_1.ux.warn(`Plugin ${plugin.name} (${plugin.version}) differs from the version specified by ${config.bin} (${specifiedVersion})`);
24
+ ux.warn(`Plugin ${plugin.name} (${plugin.version}) differs from the version specified by ${config.bin} (${specifiedVersion})`);
26
25
  }
27
26
  };
28
- exports.default = hook;
27
+ export default hook;
29
28
  //# sourceMappingURL=prerun.js.map
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
package/dist/util/env.js CHANGED
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Env = void 0;
4
1
  /*
5
2
  * Copyright (c) 2022, salesforce.com, inc.
6
3
  * All rights reserved.
7
4
  * Licensed under the BSD 3-Clause license.
8
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
6
  */
10
- const envVars_1 = require("@salesforce/core/lib/config/envVars");
11
- class Env extends envVars_1.EnvVars {
7
+ import { EnvVars } from '@salesforce/core/lib/config/envVars.js';
8
+ export class Env extends EnvVars {
12
9
  constructor(env = process.env) {
13
10
  super(env);
14
11
  }
@@ -51,12 +48,11 @@ class Env extends envVars_1.EnvVars {
51
48
  }
52
49
  }
53
50
  }
54
- exports.Env = Env;
55
51
  Env.SF_AUTOUPDATE_DISABLE = 'SF_AUTOUPDATE_DISABLE';
56
52
  Env.SF_DISABLE_AUTOUPDATE = 'SF_DISABLE_AUTOUPDATE';
57
53
  Env.SF_ENV = 'SF_ENV';
58
54
  Env.SF_INSTALLER = 'SF_INSTALLER';
59
55
  Env.SF_NPM_REGISTRY = 'SF_NPM_REGISTRY';
60
56
  Env.SF_UPDATE_INSTRUCTIONS = 'SF_UPDATE_INSTRUCTIONS';
61
- exports.default = new Env();
57
+ export default new Env();
62
58
  //# sourceMappingURL=env.js.map