@oclif/core 4.13.3 → 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.
@@ -1,43 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
38
5
  Object.defineProperty(exports, "__esModule", { value: true });
39
6
  exports.Config = void 0;
40
- const ejs = __importStar(require("ejs"));
7
+ const ejs_1 = __importDefault(require("ejs"));
41
8
  const node_os_1 = require("node:os");
42
9
  const node_path_1 = require("node:path");
43
10
  const node_url_1 = require("node:url");
@@ -291,7 +258,7 @@ class Config {
291
258
  this.channel = this.options.channel || channelFromVersion(this.version);
292
259
  this.valid = this.rootPlugin.valid;
293
260
  this.arch = (0, node_os_1.arch)() === 'ia32' ? 'x86' : (0, node_os_1.arch)();
294
- this.platform = (0, os_1.getPlatform)();
261
+ this.platform = await (0, os_1.getPlatform)();
295
262
  this.windows = this.platform === 'win32';
296
263
  this.bin = this.pjson.oclif.bin || this.name;
297
264
  this.binAliases = this.pjson.oclif.binAliases;
@@ -304,7 +271,7 @@ class Config {
304
271
  if (this.platform === 'win32')
305
272
  this.dirname = this.dirname.replace('/', '\\');
306
273
  this.userAgent = `${this.name}/${this.version} ${this.platform}-${this.arch} node-${process.version}`;
307
- this.shell = (0, os_1.getShell)();
274
+ this.shell = await (0, os_1.getShell)();
308
275
  this.home = process.env.HOME || (this.windows && this.windowsHome()) || (0, os_1.getHomeDir)() || (0, node_os_1.tmpdir)();
309
276
  this.cacheDir = this.scopedEnvVar('CACHE_DIR') || this.macosCacheDir() || this.dir('cache');
310
277
  this.configDir = this.scopedEnvVar('CONFIG_DIR') || this.dir('config');
@@ -532,7 +499,7 @@ class Config {
532
499
  else if (ext)
533
500
  options.ext = ext;
534
501
  const template = this.updateConfig.s3?.templates?.[options.platform ? 'target' : 'vanilla'][type] ?? '';
535
- return ejs.render(template, { ...this, ...options });
502
+ return ejs_1.default.render(template, { ...this, ...options });
536
503
  }
537
504
  s3Url(key) {
538
505
  const { host } = this.updateConfig.s3 ?? { host: undefined };
package/lib/help/util.js CHANGED
@@ -1,37 +1,7 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
35
5
  Object.defineProperty(exports, "__esModule", { value: true });
36
6
  exports.template = template;
37
7
  exports.standardizeIDFromArgv = standardizeIDFromArgv;
@@ -39,12 +9,12 @@ exports.getHelpFlagAdditions = getHelpFlagAdditions;
39
9
  exports.formatFlagDeprecationWarning = formatFlagDeprecationWarning;
40
10
  exports.formatCommandDeprecationWarning = formatCommandDeprecationWarning;
41
11
  exports.normalizeArgv = normalizeArgv;
42
- const ejs = __importStar(require("ejs"));
12
+ const ejs_1 = __importDefault(require("ejs"));
43
13
  const util_1 = require("../config/util");
44
14
  const ids_1 = require("../util/ids");
45
15
  function template(context) {
46
16
  function render(t) {
47
- return ejs.render(t, context);
17
+ return ejs_1.default.render(t, context);
48
18
  }
49
19
  return render;
50
20
  }
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;
19
- export declare function getShell(): string;
18
+ export declare function getPlatform(): Promise<'wsl' | NodeJS.Platform>;
19
+ export declare function getShell(): Promise<string>;
package/lib/util/os.js CHANGED
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getHomeDir = getHomeDir;
7
7
  exports.getPlatform = getPlatform;
8
8
  exports.getShell = getShell;
9
- const is_wsl_1 = __importDefault(require("is-wsl"));
10
9
  const node_child_process_1 = require("node:child_process");
11
10
  const node_os_1 = require("node:os");
12
11
  const node_path_1 = __importDefault(require("node:path"));
@@ -29,26 +28,26 @@ function getHomeDir() {
29
28
  *
30
29
  * @returns The process' platform
31
30
  */
32
- function getPlatform() {
33
- return is_wsl_1.default ? 'wsl' : (0, node_os_1.platform)();
31
+ async function getPlatform() {
32
+ return (await import('wsl-utils')).isWsl ? 'wsl' : (0, node_os_1.platform)();
34
33
  }
35
- function getShell() {
34
+ async function getShell() {
36
35
  let shellPath;
37
36
  const SHELL = process.env.SHELL ?? (0, node_os_1.userInfo)().shell?.split(node_path_1.default.sep)?.pop();
38
37
  if (SHELL) {
39
38
  shellPath = SHELL.split('/');
40
39
  }
41
- else if (getPlatform() === 'win32') {
42
- shellPath = determineWindowsShell().split(node_path_1.default.sep);
40
+ else if ((await getPlatform()) === 'win32') {
41
+ shellPath = (await determineWindowsShell()).split(node_path_1.default.sep);
43
42
  }
44
43
  else {
45
44
  shellPath = ['unknown'];
46
45
  }
47
46
  return shellPath.at(-1) ?? 'unknown';
48
47
  }
49
- function determineWindowsShell() {
48
+ async function determineWindowsShell() {
50
49
  try {
51
- const parentProcessName = (0, node_child_process_1.execSync)(`powershell.exe -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' });
52
51
  return parentProcessName.includes('powershell') || parentProcessName.includes('pwsh')
53
52
  ? 'powershell'
54
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.3",
4
+ "version": "4.13.5",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {
@@ -10,10 +10,9 @@
10
10
  "clean-stack": "^3.0.1",
11
11
  "cli-spinners": "^2.9.2",
12
12
  "debug": "^4.4.3",
13
- "ejs": "^3.1.10",
13
+ "ejs": "^6",
14
14
  "get-package-type": "^0.1.0",
15
15
  "indent-string": "^4.0.0",
16
- "is-wsl": "^2.2.0",
17
16
  "lilconfig": "^3.1.3",
18
17
  "minimatch": "^10.2.5",
19
18
  "semver": "^7.8.1",
@@ -22,7 +21,8 @@
22
21
  "tinyglobby": "^0.2.17",
23
22
  "widest-line": "^3.1.0",
24
23
  "wordwrap": "^1.0.0",
25
- "wrap-ansi": "^7.0.0"
24
+ "wrap-ansi": "^7.0.0",
25
+ "wsl-utils": "^0.4.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@commitlint/config-conventional": "^19",