@oclif/core 3.21.1 → 3.21.2

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.
@@ -26,7 +26,6 @@ export declare class Plugin implements IPlugin {
26
26
  type: string;
27
27
  valid: boolean;
28
28
  version: string;
29
- protected warned: boolean;
30
29
  _base: string;
31
30
  protected _debug: (..._: any) => void;
32
31
  private commandCache;
@@ -103,7 +103,6 @@ class Plugin {
103
103
  type;
104
104
  valid = false;
105
105
  version;
106
- warned = false;
107
106
  _base = `${_pjson.name}@${_pjson.version}`;
108
107
  // eslint-disable-next-line new-cap
109
108
  _debug = (0, util_2.Debug)();
@@ -272,7 +271,7 @@ class Plugin {
272
271
  return [id, cached];
273
272
  }
274
273
  catch (error) {
275
- const scope = 'cacheCommand';
274
+ const scope = `findCommand (${id})`;
276
275
  if (Boolean(errorOnManifestCreate) === false)
277
276
  this.warn(error, scope);
278
277
  else
@@ -367,8 +366,6 @@ class Plugin {
367
366
  }
368
367
  }
369
368
  warn(err, scope) {
370
- if (this.warned)
371
- return;
372
369
  if (typeof err === 'string')
373
370
  err = new Error(err);
374
371
  process.emitWarning(this.addErrorScope(err, scope));
@@ -14,6 +14,12 @@ const getPackageType = require('get-package-type');
14
14
  // eslint-disable-next-line camelcase
15
15
  const s_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts'];
16
16
  const isPlugin = (config) => config.type !== undefined;
17
+ function handleError(error, isESM, path) {
18
+ if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_MODULE_NOT_FOUND') {
19
+ throw new errors_1.ModuleLoadError(`${isESM ? 'import()' : 'require'} failed to load ${path}: ${error.message}`);
20
+ }
21
+ throw error;
22
+ }
17
23
  /**
18
24
  * Loads and returns a module.
19
25
  *
@@ -39,10 +45,7 @@ async function load(config, modulePath) {
39
45
  return (isESM ? await import((0, node_url_1.pathToFileURL)(filePath).href) : require(filePath));
40
46
  }
41
47
  catch (error) {
42
- if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_MODULE_NOT_FOUND') {
43
- throw new errors_1.ModuleLoadError(`${isESM ? 'import()' : 'require'} failed to load ${filePath || modulePath}`);
44
- }
45
- throw error;
48
+ handleError(error, isESM, filePath ?? modulePath);
46
49
  }
47
50
  }
48
51
  exports.load = load;
@@ -73,10 +76,7 @@ async function loadWithData(config, modulePath) {
73
76
  return { filePath, isESM, module };
74
77
  }
75
78
  catch (error) {
76
- if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_MODULE_NOT_FOUND') {
77
- throw new errors_1.ModuleLoadError(`${isESM ? 'import()' : 'require'} failed to load ${filePath || modulePath}: ${error.message}`);
78
- }
79
- throw error;
79
+ handleError(error, isESM, filePath ?? modulePath);
80
80
  }
81
81
  }
82
82
  exports.loadWithData = loadWithData;
@@ -109,10 +109,7 @@ async function loadWithDataFromManifest(cached, modulePath) {
109
109
  return { filePath, isESM, module };
110
110
  }
111
111
  catch (error) {
112
- if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_MODULE_NOT_FOUND') {
113
- throw new errors_1.ModuleLoadError(`${isESM ? 'import()' : 'require'} failed to load ${filePath || modulePath}: ${error.message}`);
114
- }
115
- throw error;
112
+ handleError(error, isESM, filePath ?? modulePath);
116
113
  }
117
114
  }
118
115
  exports.loadWithDataFromManifest = loadWithDataFromManifest;
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.21.1",
4
+ "version": "3.21.2",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {