@oclif/core 3.0.0-beta.10 → 3.0.0-beta.12

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,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const chalk = require("chalk");
4
- const index_1 = require("../index");
4
+ const index_1 = require("../../index");
5
5
  function styledJSON(obj) {
6
6
  const json = JSON.stringify(obj, null, 2);
7
7
  if (!chalk.level) {
@@ -1,25 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toCached = exports.Config = void 0;
4
- const errors_1 = require("../errors");
4
+ const node_url_1 = require("node:url");
5
+ const node_util_1 = require("node:util");
6
+ const node_os_1 = require("node:os");
7
+ const node_path_1 = require("node:path");
5
8
  const ejs = require("ejs");
6
- const os = require("os");
7
- const path = require("path");
8
- const url_1 = require("url");
9
- const util_1 = require("util");
10
- const util_2 = require("./util");
11
- const util_3 = require("../util");
9
+ const errors_1 = require("../errors");
10
+ const util_1 = require("./util");
11
+ const util_2 = require("../util");
12
12
  const module_loader_1 = require("../module-loader");
13
13
  const help_1 = require("../help");
14
14
  const stream_1 = require("../cli-ux/stream");
15
15
  const performance_1 = require("../performance");
16
16
  const settings_1 = require("../settings");
17
- const node_os_1 = require("node:os");
18
- const node_path_1 = require("node:path");
19
17
  const plugin_loader_1 = require("./plugin-loader");
20
18
  // eslint-disable-next-line new-cap
21
- const debug = (0, util_2.Debug)();
22
- const _pjson = (0, util_3.requireJson)(__dirname, '..', '..', 'package.json');
19
+ const debug = (0, util_1.Debug)();
20
+ const _pjson = (0, util_2.requireJson)(__dirname, '..', '..', 'package.json');
23
21
  const BASE = `${_pjson.name}@${_pjson.version}`;
24
22
  function channelFromVersion(version) {
25
23
  const m = version.match(/[^-]+(?:-([^.]+))?/);
@@ -36,7 +34,7 @@ class Permutations extends Map {
36
34
  }
37
35
  add(permutation, commandId) {
38
36
  this.validPermutations.set(permutation, commandId);
39
- for (const id of (0, util_2.collectUsableIds)([permutation])) {
37
+ for (const id of (0, util_1.collectUsableIds)([permutation])) {
40
38
  if (this.has(id)) {
41
39
  this.set(id, this.get(id).add(commandId));
42
40
  }
@@ -74,7 +72,7 @@ class Config {
74
72
  static async load(opts = module.filename || __dirname) {
75
73
  // Handle the case when a file URL string is passed in such as 'import.meta.url'; covert to file path.
76
74
  if (typeof opts === 'string' && opts.startsWith('file://')) {
77
- opts = (0, url_1.fileURLToPath)(opts);
75
+ opts = (0, node_url_1.fileURLToPath)(opts);
78
76
  }
79
77
  if (typeof opts === 'string')
80
78
  opts = { root: opts };
@@ -118,8 +116,8 @@ class Config {
118
116
  this.version = this.options.version || this.pjson.version || '0.0.0';
119
117
  this.channel = this.options.channel || channelFromVersion(this.version);
120
118
  this.valid = Config._rootPlugin.valid;
121
- this.arch = (os.arch() === 'ia32' ? 'x86' : os.arch());
122
- this.platform = WSL ? 'wsl' : os.platform();
119
+ this.arch = ((0, node_os_1.arch)() === 'ia32' ? 'x86' : (0, node_os_1.arch)());
120
+ this.platform = WSL ? 'wsl' : (0, node_os_1.platform)();
123
121
  this.windows = this.platform === 'win32';
124
122
  this.bin = this.pjson.oclif.bin || this.name;
125
123
  this.binAliases = this.pjson.oclif.binAliases;
@@ -134,11 +132,11 @@ class Config {
134
132
  this.userAgent = `${this.name}/${this.version} ${this.platform}-${this.arch} node-${process.version}`;
135
133
  this.shell = this._shell();
136
134
  this.debug = this._debug();
137
- this.home = process.env.HOME || (this.windows && this.windowsHome()) || os.homedir() || os.tmpdir();
135
+ this.home = process.env.HOME || (this.windows && this.windowsHome()) || (0, node_os_1.homedir)() || (0, node_os_1.tmpdir)();
138
136
  this.cacheDir = this.scopedEnvVar('CACHE_DIR') || this.macosCacheDir() || this.dir('cache');
139
137
  this.configDir = this.scopedEnvVar('CONFIG_DIR') || this.dir('config');
140
138
  this.dataDir = this.scopedEnvVar('DATA_DIR') || this.dir('data');
141
- this.errlog = path.join(this.cacheDir, 'error.log');
139
+ this.errlog = (0, node_path_1.join)(this.cacheDir, 'error.log');
142
140
  this.binPath = this.scopedEnvVar('BINPATH');
143
141
  this.npmRegistry = this.scopedEnvVar('NPM_REGISTRY') || this.pjson.oclif.npmRegistry;
144
142
  this.pjson.oclif.update = this.pjson.oclif.update || {};
@@ -230,7 +228,7 @@ class Config {
230
228
  (0, errors_1.exit)(code);
231
229
  },
232
230
  log(message, ...args) {
233
- stream_1.stdout.write((0, util_1.format)(message, ...args) + '\n');
231
+ stream_1.stdout.write((0, node_util_1.format)(message, ...args) + '\n');
234
232
  },
235
233
  error(message, options = {}) {
236
234
  (0, errors_1.error)(message, options);
@@ -430,7 +428,7 @@ class Config {
430
428
  architecture,
431
429
  nodeVersion,
432
430
  pluginVersions: Object.fromEntries([...this.plugins.values()].map(p => [p.name, { version: p.version, type: p.type, root: p.root }])),
433
- osVersion: `${os.type()} ${os.release()}`,
431
+ osVersion: `${(0, node_os_1.type)()} ${(0, node_os_1.release)()}`,
434
432
  shell: this.shell,
435
433
  rootPath: this.root,
436
434
  };
@@ -447,8 +445,8 @@ class Config {
447
445
  const host = this.pjson.oclif.update.s3.host;
448
446
  if (!host)
449
447
  throw new Error('no s3 host is set');
450
- const url = new url_1.URL(host);
451
- url.pathname = path.join(url.pathname, key);
448
+ const url = new node_url_1.URL(host);
449
+ url.pathname = (0, node_path_1.join)(url.pathname, key);
452
450
  return url.toString();
453
451
  }
454
452
  getPluginsList() {
@@ -457,20 +455,20 @@ class Config {
457
455
  dir(category) {
458
456
  const base = process.env[`XDG_${category.toUpperCase()}_HOME`] ||
459
457
  (this.windows && process.env.LOCALAPPDATA) ||
460
- path.join(this.home, category === 'data' ? '.local/share' : '.' + category);
461
- return path.join(base, this.dirname);
458
+ (0, node_path_1.join)(this.home, category === 'data' ? '.local/share' : '.' + category);
459
+ return (0, node_path_1.join)(base, this.dirname);
462
460
  }
463
461
  windowsHome() {
464
462
  return this.windowsHomedriveHome() || this.windowsUserprofileHome();
465
463
  }
466
464
  windowsHomedriveHome() {
467
- return (process.env.HOMEDRIVE && process.env.HOMEPATH && path.join(process.env.HOMEDRIVE, process.env.HOMEPATH));
465
+ return (process.env.HOMEDRIVE && process.env.HOMEPATH && (0, node_path_1.join)(process.env.HOMEDRIVE, process.env.HOMEPATH));
468
466
  }
469
467
  windowsUserprofileHome() {
470
468
  return process.env.USERPROFILE;
471
469
  }
472
470
  macosCacheDir() {
473
- return (this.platform === 'darwin' && path.join(this.home, 'Library', 'Caches', this.dirname)) || undefined;
471
+ return (this.platform === 'darwin' && (0, node_path_1.join)(this.home, 'Library', 'Caches', this.dirname)) || undefined;
474
472
  }
475
473
  _shell() {
476
474
  let shellPath;
@@ -508,7 +506,7 @@ class Config {
508
506
  if (err instanceof Error) {
509
507
  const modifiedErr = err;
510
508
  modifiedErr.name = `${err.name} Plugin: ${this.name}`;
511
- modifiedErr.detail = (0, util_2.compact)([
509
+ modifiedErr.detail = (0, util_1.compact)([
512
510
  err.detail,
513
511
  `module: ${this._base}`,
514
512
  scope && `task: ${scope}`,
@@ -522,7 +520,7 @@ class Config {
522
520
  // err is an object
523
521
  process.emitWarning('Config.warn expected either a string or Error, but instead received an object');
524
522
  err.name = `${err.name} Plugin: ${this.name}`;
525
- err.detail = (0, util_2.compact)([
523
+ err.detail = (0, util_1.compact)([
526
524
  err.detail,
527
525
  `module: ${this._base}`,
528
526
  scope && `task: ${scope}`,
@@ -533,7 +531,7 @@ class Config {
533
531
  process.emitWarning(JSON.stringify(err));
534
532
  }
535
533
  get isProd() {
536
- return (0, util_3.isProd)();
534
+ return (0, util_2.isProd)();
537
535
  }
538
536
  isJitPluginCommand(c) {
539
537
  // Return true if the command's plugin is listed under oclif.jitPlugins AND if the plugin hasn't been loaded to this.plugins
@@ -588,7 +586,7 @@ class Config {
588
586
  }
589
587
  loadTopics(plugin) {
590
588
  const marker = performance_1.default.mark(`config.loadTopics#${plugin.name}`, { plugin: plugin.name });
591
- for (const topic of (0, util_2.compact)(plugin.topics)) {
589
+ for (const topic of (0, util_1.compact)(plugin.topics)) {
592
590
  const existing = this._topics.get(topic.name);
593
591
  if (existing) {
594
592
  existing.description = topic.description || existing.description;
@@ -597,7 +595,7 @@ class Config {
597
595
  else {
598
596
  this._topics.set(topic.name, topic);
599
597
  }
600
- const permutations = this.flexibleTaxonomy ? (0, util_2.getCommandIdPermutations)(topic.name) : [topic.name];
598
+ const permutations = this.flexibleTaxonomy ? (0, util_1.getCommandIdPermutations)(topic.name) : [topic.name];
601
599
  for (const permutation of permutations) {
602
600
  this.topicPermutations.add(permutation, topic.name);
603
601
  }
@@ -787,7 +785,7 @@ async function toCached(c, plugin, respectNoCacheDefault = false) {
787
785
  }
788
786
  }
789
787
  const args = {};
790
- for (const [name, arg] of Object.entries((0, util_3.ensureArgObject)(c.args))) {
788
+ for (const [name, arg] of Object.entries((0, util_2.ensureArgObject)(c.args))) {
791
789
  args[name] = {
792
790
  name,
793
791
  description: arg.description,
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.0.0-beta.10",
4
+ "version": "3.0.0-beta.12",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {