@oclif/core 3.25.1 → 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.
- package/lib/help/index.js +3 -1
- package/lib/module-loader.js +2 -4
- package/package.json +1 -1
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
|
|
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) {
|
package/lib/module-loader.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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;
|