@oclif/core 4.13.4 → 4.13.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.
@@ -258,7 +258,7 @@ class Config {
258
258
  this.channel = this.options.channel || channelFromVersion(this.version);
259
259
  this.valid = this.rootPlugin.valid;
260
260
  this.arch = (0, node_os_1.arch)() === 'ia32' ? 'x86' : (0, node_os_1.arch)();
261
- this.platform = (0, os_1.getPlatform)();
261
+ this.platform = await (0, os_1.getPlatform)();
262
262
  this.windows = this.platform === 'win32';
263
263
  this.bin = this.pjson.oclif.bin || this.name;
264
264
  this.binAliases = this.pjson.oclif.binAliases;
package/lib/util/os.d.ts CHANGED
@@ -15,5 +15,5 @@ export declare function getHomeDir(): string;
15
15
  *
16
16
  * @returns The process' platform
17
17
  */
18
- export declare function getPlatform(): 'wsl' | NodeJS.Platform;
18
+ export declare function getPlatform(): Promise<'wsl' | NodeJS.Platform>;
19
19
  export declare function getShell(): Promise<string>;
package/lib/util/os.js CHANGED
@@ -9,8 +9,6 @@ exports.getShell = getShell;
9
9
  const node_child_process_1 = require("node:child_process");
10
10
  const node_os_1 = require("node:os");
11
11
  const node_path_1 = __importDefault(require("node:path"));
12
- // eslint-disable-next-line perfectionist/sort-imports -- Conflicts with other import rules in the case of `require` statements.
13
- const wslUtils = require('wsl-utils');
14
12
  /**
15
13
  * Call os.homedir() and return the result
16
14
  *
@@ -30,8 +28,8 @@ function getHomeDir() {
30
28
  *
31
29
  * @returns The process' platform
32
30
  */
33
- function getPlatform() {
34
- return wslUtils.isWsl ? 'wsl' : (0, node_os_1.platform)();
31
+ async function getPlatform() {
32
+ return (await import('wsl-utils')).isWsl ? 'wsl' : (0, node_os_1.platform)();
35
33
  }
36
34
  async function getShell() {
37
35
  let shellPath;
@@ -39,7 +37,7 @@ async function getShell() {
39
37
  if (SHELL) {
40
38
  shellPath = SHELL.split('/');
41
39
  }
42
- else if (getPlatform() === 'win32') {
40
+ else if ((await getPlatform()) === 'win32') {
43
41
  shellPath = (await determineWindowsShell()).split(node_path_1.default.sep);
44
42
  }
45
43
  else {
@@ -49,7 +47,7 @@ async function getShell() {
49
47
  }
50
48
  async function determineWindowsShell() {
51
49
  try {
52
- const parentProcessName = (0, node_child_process_1.execSync)(`${await wslUtils.powerShellPath()} -NoProfile -Command "(Get-CimInstance Win32_Process -Filter 'ProcessID = ${process.ppid}').Name"`, { encoding: 'utf8' });
50
+ const parentProcessName = (0, node_child_process_1.execSync)(`${await (await import('wsl-utils')).powerShellPath()} -NoProfile -Command "(Get-CimInstance Win32_Process -Filter 'ProcessID = ${process.ppid}').Name"`, { encoding: 'utf8' });
53
51
  return parentProcessName.includes('powershell') || parentProcessName.includes('pwsh')
54
52
  ? 'powershell'
55
53
  : (process.env.COMSPEC ?? 'cmd.exe');
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": "4.13.4",
4
+ "version": "4.13.5",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {