@oclif/core 4.8.3 → 4.9.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/lib/command.js CHANGED
@@ -295,7 +295,7 @@ class Command {
295
295
  }
296
296
  warnIfCommandDeprecated() {
297
297
  const [id] = (0, util_1.normalizeArgv)(this.config);
298
- if (this.ctor.deprecateAliases && this.ctor.aliases.includes(id)) {
298
+ if (this.ctor.deprecateAliases && [...this.ctor.aliases, ...this.ctor.hiddenAliases].includes(id)) {
299
299
  const cmdName = (0, ids_1.toConfiguredId)(this.ctor.id, this.config);
300
300
  const aliasName = (0, ids_1.toConfiguredId)(id, this.config);
301
301
  this.warn((0, util_1.formatCommandDeprecationWarning)(aliasName, { to: cmdName }));
@@ -156,23 +156,11 @@ class Config {
156
156
  if (typeof opts === 'string')
157
157
  opts = { root: opts };
158
158
  if (isConfig(opts)) {
159
- /**
160
- * Reload the Config based on the version required by the command.
161
- * This is needed because the command is given the Config instantiated
162
- * by the root plugin, which may be a different version than the one
163
- * required by the command.
164
- *
165
- * Doing this ensures that the command can freely use any method on Config that
166
- * exists in the version of Config required by the command but may not exist on the
167
- * root's instance of Config.
168
- */
169
- if (BASE !== opts._base) {
170
- debug(`reloading config from ${opts._base} to ${BASE}`);
171
- const config = new Config({ ...opts.options, plugins: opts.plugins });
172
- await config.load();
173
- return config;
174
- }
175
- return opts;
159
+ debug(`reloading config from ${opts._base} to ${BASE}`);
160
+ const pluginMap = new Map(opts.getPluginsList().map((p) => [p.name, p]));
161
+ const config = new Config({ ...opts.options, plugins: pluginMap });
162
+ await config.load();
163
+ return config;
176
164
  }
177
165
  const config = new Config(opts);
178
166
  await config.load();
package/lib/help/index.js CHANGED
@@ -174,8 +174,8 @@ class Help extends HelpBase {
174
174
  ? `${(0, util_2.formatCommandDeprecationWarning)((0, ids_1.toConfiguredId)(name, this.config), command.deprecationOptions)}\n`
175
175
  : `This command is in ${state}.\n`);
176
176
  }
177
- if (command.deprecateAliases && command.aliases.includes(name)) {
178
- const actualCmd = this.config.commands.find((c) => c.aliases.includes(name));
177
+ if (command.deprecateAliases && [...(command.aliases ?? []), ...(command.hiddenAliases ?? [])].includes(name)) {
178
+ const actualCmd = this.config.commands.find((c) => [...(c.aliases ?? []), ...(c.hiddenAliases ?? [])].includes(name));
179
179
  const actualCmdName = actualCmd ? (0, ids_1.toConfiguredId)(actualCmd.id, this.config) : '';
180
180
  const opts = { ...command.deprecationOptions, ...(actualCmd ? { to: actualCmdName } : {}) };
181
181
  this.log(`${(0, util_2.formatCommandDeprecationWarning)((0, ids_1.toConfiguredId)(name, this.config), opts)}\n`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "4.8.3",
4
+ "version": "4.9.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {