@oclif/core 3.25.0 → 3.25.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.
@@ -291,7 +291,7 @@ class Plugin {
291
291
  return manifest;
292
292
  }
293
293
  addErrorScope(err, scope) {
294
- err.name = `${err.name} Plugin: ${this.name}`;
294
+ err.name = err.name ?? (0, node_util_1.inspect)(err).trim();
295
295
  err.detail = (0, util_1.compact)([
296
296
  err.detail,
297
297
  `module: ${this._base}`,
@@ -368,7 +368,8 @@ class Plugin {
368
368
  warn(err, scope) {
369
369
  if (typeof err === 'string')
370
370
  err = new Error(err);
371
- process.emitWarning(this.addErrorScope(err, scope));
371
+ const warning = this.addErrorScope(err, scope);
372
+ process.emitWarning(warning.name, warning);
372
373
  }
373
374
  }
374
375
  exports.Plugin = Plugin;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.tsPath = exports.TS_CONFIGS = void 0;
7
+ const promises_1 = require("node:fs/promises");
7
8
  const node_path_1 = require("node:path");
8
9
  const cache_1 = __importDefault(require("../cache"));
9
10
  const warn_1 = require("../errors/warn");
@@ -200,8 +201,20 @@ async function determinePath(root, orig) {
200
201
  // In that case we attempt to resolve to the filename. If it fails it will revert back to the lib path
201
202
  debug(`lib dir: ${lib}`);
202
203
  debug(`src dir: ${src}`);
203
- debug(`src commands dir: ${out}`);
204
- if ((0, fs_1.existsSync)(out) || (0, fs_1.existsSync)(out + '.ts')) {
204
+ debug(`src directory to find: ${out}`);
205
+ if ((0, fs_1.existsSync)(out)) {
206
+ debug(`Found source directory for ${orig} at ${out}`);
207
+ return out;
208
+ }
209
+ const sourceFiles = await Promise.all([
210
+ (0, promises_1.access)(`${out}.ts`)
211
+ .then(() => `${out}.ts`)
212
+ .catch(() => false),
213
+ (0, promises_1.access)(`${out}.tsx`)
214
+ .then(() => `${out}.tsx`)
215
+ .catch(() => false),
216
+ ]);
217
+ if (sourceFiles.some(Boolean)) {
205
218
  debug(`Found source file for ${orig} at ${out}`);
206
219
  return out;
207
220
  }
package/lib/help/index.js CHANGED
@@ -8,6 +8,7 @@ const node_util_1 = require("node:util");
8
8
  const strip_ansi_1 = __importDefault(require("strip-ansi"));
9
9
  const theme_1 = require("../cli-ux/theme");
10
10
  const write_1 = __importDefault(require("../cli-ux/write"));
11
+ const ts_path_1 = require("../config/ts-path");
11
12
  const error_1 = require("../errors/error");
12
13
  const module_loader_1 = require("../module-loader");
13
14
  const symbols_1 = require("../symbols");
@@ -321,7 +322,8 @@ async function loadHelpClass(config) {
321
322
  const configuredClass = pjson.oclif?.helpClass;
322
323
  if (configuredClass) {
323
324
  try {
324
- const exported = (await (0, module_loader_1.load)(config, configuredClass));
325
+ const path = (await (0, ts_path_1.tsPath)(config.root, configuredClass)) ?? configuredClass;
326
+ const exported = await (0, module_loader_1.load)(config, path);
325
327
  return extractClass(exported);
326
328
  }
327
329
  catch (error) {
@@ -11,8 +11,7 @@ const getPackageType = require('get-package-type');
11
11
  /**
12
12
  * Defines file extension resolution when source files do not have an extension.
13
13
  */
14
- // eslint-disable-next-line camelcase
15
- const s_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts'];
14
+ const SUPPORTED_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts', '.tsx', '.jsx'];
16
15
  const isPlugin = (config) => config.type !== undefined;
17
16
  function handleError(error, isESM, path) {
18
17
  if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_MODULE_NOT_FOUND') {
@@ -198,8 +197,7 @@ async function resolvePath(config, modulePath) {
198
197
  * @returns {string | null} Modified file path including extension or null if file is not found.
199
198
  */
200
199
  function findFile(filePath) {
201
- // eslint-disable-next-line camelcase
202
- for (const extension of s_EXTENSIONS) {
200
+ for (const extension of SUPPORTED_EXTENSIONS) {
203
201
  const testPath = `${filePath}${extension}`;
204
202
  if ((0, fs_1.existsSync)(testPath)) {
205
203
  return testPath;
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.25.0",
4
+ "version": "3.25.2",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {