@oclif/core 3.7.0 → 3.8.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.
@@ -458,7 +458,7 @@ class Config {
458
458
  const marker = performance_1.Performance.mark(performance_1.OCLIF_MARKER_OWNER, `config.runHook#${p.name}(${hook})`);
459
459
  try {
460
460
  /* eslint-disable no-await-in-loop */
461
- const { filePath, isESM, module } = await (0, module_loader_1.loadWithData)(p, (0, node_path_1.join)(p.root, hook));
461
+ const { filePath, isESM, module } = await (0, module_loader_1.loadWithData)(p, hook);
462
462
  debug('start', isESM ? '(import)' : '(require)', filePath);
463
463
  const result = timeout
464
464
  ? await withTimeout(timeout, search(module).call(context, { ...opts, config: this }))
@@ -686,6 +686,15 @@ class Config {
686
686
  insertLegacyPlugins(plugins) {
687
687
  for (const plugin of plugins) {
688
688
  this.plugins.set(plugin.name, plugin);
689
+ // Delete all commands from the legacy plugin so that we can re-add them.
690
+ // This is necessary because this.determinePriority will pick the initial
691
+ // command that was added, which won't have been converted by PluginLegacy yet.
692
+ for (const cmd of plugin.commands ?? []) {
693
+ this._commands.delete(cmd.id);
694
+ for (const alias of [...(cmd.aliases ?? []), ...(cmd.hiddenAliases ?? [])]) {
695
+ this._commands.delete(alias);
696
+ }
697
+ }
689
698
  this.loadCommands(plugin);
690
699
  }
691
700
  }
@@ -163,7 +163,7 @@ class Plugin {
163
163
  else {
164
164
  this.pjson.oclif = this.pjson['cli-engine'] || {};
165
165
  }
166
- this.hooks = (0, util_1.mapValues)(this.pjson.oclif.hooks || {}, (i) => (Array.isArray(i) ? i : [i]));
166
+ this.hooks = (0, util_1.mapValues)(this.pjson.oclif.hooks ?? {}, (i) => (0, util_1.castArray)(i).map((i) => (0, ts_node_1.tsPath)(this.root, i, this)));
167
167
  this.manifest = await this._manifest();
168
168
  this.commands = Object.entries(this.manifest.commands)
169
169
  .map(([id, c]) => ({
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": "3.7.0",
4
+ "version": "3.8.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {