@salesforce/cli 2.8.2 → 2.8.3-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/bin/dev.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env 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,54 @@
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 { Config, run as oclifRun, settings } from '@oclif/core';
10
+ import { set } from '@salesforce/kit';
11
+ import Debug from 'debug';
12
+ import { default as nodeEnv, Env } from './util/env.js';
17
13
  const debug = Debug('sf');
18
14
  const envVars = [
19
15
  ...new Set([
20
16
  ...Object.keys(process.env).filter((e) => e.startsWith('SF_') || e.startsWith('SFDX_')),
21
17
  'NODE_OPTIONS',
22
- env_1.Env.SF_AUTOUPDATE_DISABLE,
18
+ Env.SF_AUTOUPDATE_DISABLE,
23
19
  'SF_BINPATH',
24
20
  '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,
21
+ Env.SF_DISABLE_AUTOUPDATE,
22
+ Env.SF_ENV,
23
+ Env.SF_INSTALLER,
24
+ Env.SF_NPM_REGISTRY,
29
25
  'SF_REDIRECTED',
30
- env_1.Env.SF_UPDATE_INSTRUCTIONS,
26
+ Env.SF_UPDATE_INSTRUCTIONS,
31
27
  ]),
32
28
  ];
33
- exports.UPDATE_DISABLED_INSTALLER = 'Manual and automatic CLI updates have been disabled by setting "SF_AUTOUPDATE_DISABLE=true". ' +
29
+ export const UPDATE_DISABLED_INSTALLER = 'Manual and automatic CLI updates have been disabled by setting "SF_AUTOUPDATE_DISABLE=true". ' +
34
30
  '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. ' +
31
+ export const UPDATE_DISABLED_NPM = 'Use "npm update --global @salesforce/cli" to update npm-based installations.';
32
+ export const UPDATE_DISABLED_DEMO = 'Manual and automatic CLI updates have been disabled in DEMO mode. ' +
37
33
  'To check for a new version, unset the environment variable SF_ENV.';
38
- function configureUpdateSites(config, env = env_1.default) {
34
+ export function configureUpdateSites(config, env = nodeEnv) {
39
35
  const npmRegistry = env.getNpmRegistryOverride();
40
36
  if (npmRegistry) {
41
37
  // Override config value if set via envar
42
- (0, kit_1.set)(config, 'pjson.oclif.warn-if-update-available.registry', npmRegistry);
38
+ set(config, 'pjson.oclif.warn-if-update-available.registry', npmRegistry);
43
39
  }
44
40
  }
45
- exports.configureUpdateSites = configureUpdateSites;
46
- function configureAutoUpdate(envars) {
41
+ export function configureAutoUpdate(envars) {
47
42
  if (envars.isDemoMode()) {
48
43
  // Disable autoupdates in demo mode
49
44
  envars.setAutoupdateDisabled(true);
50
- envars.setUpdateInstructions(exports.UPDATE_DISABLED_DEMO);
45
+ envars.setUpdateInstructions(UPDATE_DISABLED_DEMO);
51
46
  return;
52
47
  }
53
48
  if (envars.isInstaller()) {
54
49
  envars.normalizeAutoupdateDisabled();
55
50
  if (envars.isAutoupdateDisabled()) {
56
- envars.setUpdateInstructions(exports.UPDATE_DISABLED_INSTALLER);
51
+ envars.setUpdateInstructions(UPDATE_DISABLED_INSTALLER);
57
52
  }
58
53
  return;
59
54
  }
@@ -63,10 +58,9 @@ function configureAutoUpdate(envars) {
63
58
  envars.setAutoupdateDisabled(true);
64
59
  }
65
60
  if (envars.isAutoupdateDisabled()) {
66
- envars.setUpdateInstructions(exports.UPDATE_DISABLED_NPM);
61
+ envars.setUpdateInstructions(UPDATE_DISABLED_NPM);
67
62
  }
68
63
  }
69
- exports.configureAutoUpdate = configureAutoUpdate;
70
64
  function debugCliInfo(version, channel, env, config) {
71
65
  function debugSection(section, items) {
72
66
  const pad = 25;
@@ -91,28 +85,27 @@ function debugCliInfo(version, channel, env, config) {
91
85
  debugSection('ENV', [...envVars].map((key) => [key, env.getString(key, '<not set>')]));
92
86
  debugSection('ARGS', process.argv.map((arg, i) => [i.toString(), arg]));
93
87
  }
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'));
88
+ export function create(opts) {
89
+ var _a;
90
+ settings.performanceEnabled = true;
91
+ const root = path.resolve(import.meta.url, '..');
99
92
  const args = process.argv.slice(2);
93
+ const env = (_a = opts.env) !== null && _a !== void 0 ? _a : nodeEnv;
100
94
  return {
101
95
  async run() {
102
- const config = new core_1.Config({
103
- name: (0, ts_types_1.get)(pjson, 'oclif.bin'),
96
+ const config = new Config({
97
+ name: opts.bin,
104
98
  root,
105
- version,
106
- channel,
99
+ version: opts.version,
100
+ channel: opts.channel,
107
101
  });
108
102
  await config.load();
109
- configureUpdateSites(config, env);
103
+ configureUpdateSites(config, opts.env);
110
104
  configureAutoUpdate(env);
111
- debugCliInfo(version, channel, env, config);
105
+ debugCliInfo(opts.version, opts.channel, env, config);
112
106
  // 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);
107
+ return opts.run ? opts.run(args, config) : oclifRun(args, config);
114
108
  },
115
109
  };
116
110
  }
117
- exports.create = create;
118
111
  //# 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;
@@ -31,6 +28,7 @@ class SfCommandHelp extends core_1.CommandHelp {
31
28
  {
32
29
  header: 'CONFIGURATION VARIABLES',
33
30
  generate: ({ cmd }) => {
31
+ // @ts-expect-error because sf-plugins-core is on @oclif/core v2 still
34
32
  const sfCommand = cmd;
35
33
  return sfCommand.configurationVariablesSection;
36
34
  },
@@ -38,6 +36,7 @@ class SfCommandHelp extends core_1.CommandHelp {
38
36
  {
39
37
  header: 'ENVIRONMENT VARIABLES',
40
38
  generate: ({ cmd }) => {
39
+ // @ts-expect-error because sf-plugins-core is on @oclif/core v2 still
41
40
  const sfCommand = cmd;
42
41
  return sfCommand.envVariablesSection;
43
42
  },
@@ -45,6 +44,7 @@ class SfCommandHelp extends core_1.CommandHelp {
45
44
  {
46
45
  header: 'ERROR CODES',
47
46
  generate: ({ cmd }) => {
47
+ // @ts-expect-error because sf-plugins-core is on @oclif/core v2 still
48
48
  const sfCommand = cmd;
49
49
  return sfCommand.errorCodes;
50
50
  },
@@ -57,5 +57,4 @@ class SfCommandHelp extends core_1.CommandHelp {
57
57
  return sections;
58
58
  }
59
59
  }
60
- exports.SfCommandHelp = SfCommandHelp;
61
60
  //# 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,18 +1,16 @@
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");
7
+ import { join } from 'path';
8
+ import { spawn } from 'child_process';
9
+ import { ux } from '@oclif/core';
12
10
  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());
11
+ ux.log('NOTE: This error can be ignored in CI and may be silenced in the future');
12
+ ux.log('- Set the SF_HIDE_RELEASE_NOTES env var to "true" to skip this script\n');
13
+ ux.log(msg.toString());
16
14
  };
17
15
  /*
18
16
  * NOTE: Please read "Notes about the hook scripts" in this PR before making changes:
@@ -23,7 +21,7 @@ const hook = async () => new Promise((resolve) => {
23
21
  resolve();
24
22
  }
25
23
  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'], {
24
+ const cmd = spawn(join(__dirname, '..', '..', 'bin', executable), ['whatsnew', '--hook'], {
27
25
  stdio: ['ignore', 'inherit', 'pipe'],
28
26
  timeout: 10000,
29
27
  });
@@ -43,5 +41,5 @@ const hook = async () => new Promise((resolve) => {
43
41
  resolve();
44
42
  });
45
43
  });
46
- exports.default = hook;
44
+ export default hook;
47
45
  //# sourceMappingURL=display-release-notes.js.map
@@ -1,20 +1,19 @@
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");
12
- const core_2 = require("@salesforce/core");
7
+ import * as os from 'os';
8
+ import { toConfiguredId, toStandardizedId, loadHelpClass } from '@oclif/core';
9
+ import { Prompter } from '@salesforce/sf-plugins-core';
10
+ import { Lifecycle } from '@salesforce/core';
13
11
  function buildChoices(matches, config) {
14
- const configuredIds = matches.map((p) => (0, core_1.toConfiguredId)(p.id, config));
12
+ const configuredIds = matches.map((p) => toConfiguredId(p.id, config));
15
13
  const maxCommandLength = configuredIds.reduce((max, id) => Math.max(max, id.length), 0);
16
14
  return matches.map((p, i) => {
17
- const summary = p.summary ?? p.description?.split(os.EOL)[0] ?? '';
15
+ var _a, _b, _c;
16
+ 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 : '';
18
17
  return {
19
18
  name: `${configuredIds[i].padEnd(maxCommandLength + 5, ' ')}${summary}`,
20
19
  value: p,
@@ -25,7 +24,7 @@ function buildChoices(matches, config) {
25
24
  async function determineCommand(config, matches) {
26
25
  if (matches.length === 1)
27
26
  return matches[0].id;
28
- const prompter = new sf_plugins_core_1.Prompter();
27
+ const prompter = new Prompter();
29
28
  const choices = buildChoices(matches, config);
30
29
  const { command } = await prompter.timedPrompt([
31
30
  {
@@ -40,15 +39,15 @@ async function determineCommand(config, matches) {
40
39
  const hook = async function ({ config, matches, argv }) {
41
40
  const command = await determineCommand(config, matches);
42
41
  if (argv.includes('--help') || argv.includes('-h')) {
43
- const Help = await (0, core_1.loadHelpClass)(config);
42
+ const Help = await loadHelpClass(config);
44
43
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
45
44
  const help = new Help(config, config.pjson.helpOptions);
46
- return help.showHelp([(0, core_1.toStandardizedId)(command, config), ...argv]);
45
+ return help.showHelp([toStandardizedId(command, config), ...argv]);
47
46
  }
48
47
  if (matches.length === 1) {
49
- await core_2.Lifecycle.getInstance().emitWarning(`One command matches the partial command entered, running command:${os.EOL}${config.bin} ${(0, core_1.toConfiguredId)(command, config)} ${argv.join(' ')}`);
48
+ await Lifecycle.getInstance().emitWarning(`One command matches the partial command entered, running command:${os.EOL}${config.bin} ${toConfiguredId(command, config)} ${argv.join(' ')}`);
50
49
  }
51
- return config.runCommand((0, core_1.toStandardizedId)(command, config), argv);
50
+ return config.runCommand(toStandardizedId(command, config), argv);
52
51
  };
53
- exports.default = hook;
52
+ export default hook;
54
53
  //# 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
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