@oclif/core 2.11.3 → 2.11.5

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.
@@ -9,6 +9,9 @@ export interface PJSON {
9
9
  };
10
10
  oclif: {
11
11
  schema?: number;
12
+ bin?: string;
13
+ dirname?: string;
14
+ hooks?: Record<string, string | string[]>;
12
15
  };
13
16
  }
14
17
  export declare namespace PJSON {
@@ -11,11 +11,6 @@ const getPackageType = require('get-package-type');
11
11
  */
12
12
  // eslint-disable-next-line camelcase
13
13
  const s_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs'];
14
- /**
15
- * Provides a mechanism to use dynamic import / import() with tsconfig -> module: commonJS as otherwise import() gets
16
- * transpiled to require().
17
- */
18
- const _importDynamic = new Function('modulePath', 'return import(modulePath)'); // eslint-disable-line no-new-func
19
14
  /**
20
15
  * Provides a static class with several utility methods to work with Oclif config / plugin to load ESM or CJS Node
21
16
  * modules and source files.
@@ -45,8 +40,8 @@ class ModuleLoader {
45
40
  let isESM;
46
41
  try {
47
42
  ({ isESM, filePath } = ModuleLoader.resolvePath(config, modulePath));
48
- // It is important to await on _importDynamic to catch the error code.
49
- return isESM ? await _importDynamic(url.pathToFileURL(filePath)) : require(filePath);
43
+ // It is important to await on import to catch the error code.
44
+ return isESM ? await import(url.pathToFileURL(filePath).href) : require(filePath);
50
45
  }
51
46
  catch (error) {
52
47
  if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_MODULE_NOT_FOUND') {
@@ -77,7 +72,7 @@ class ModuleLoader {
77
72
  let isESM;
78
73
  try {
79
74
  ({ isESM, filePath } = ModuleLoader.resolvePath(config, modulePath));
80
- const module = isESM ? await _importDynamic(url.pathToFileURL(filePath)) : require(filePath);
75
+ const module = isESM ? await import(url.pathToFileURL(filePath).href) : require(filePath);
81
76
  return { isESM, module, filePath };
82
77
  }
83
78
  catch (error) {
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": "2.11.3",
4
+ "version": "2.11.5",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {