@oclif/core 4.2.3 → 4.2.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.
package/lib/args.d.ts CHANGED
@@ -17,7 +17,7 @@ import { Arg, ArgDefinition } from './interfaces/parser';
17
17
  * },
18
18
  * })
19
19
  */
20
- export declare function custom<T = string, P = Record<string, unknown>>(defaults: Partial<Arg<T, P>>): ArgDefinition<T, P>;
20
+ export declare function custom<T = string, P = Record<string, unknown>>(_defaults: Partial<Arg<T, P>>): ArgDefinition<T, P>;
21
21
  export declare const boolean: ArgDefinition<boolean, Record<string, unknown>>;
22
22
  export declare const integer: ArgDefinition<number, {
23
23
  max?: number;
package/lib/cache.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { Config } from './config/config';
2
2
  import { OclifConfiguration, Plugin } from './interfaces';
3
- type OclifCoreInfo = {
4
- name: string;
5
- version: string;
6
- };
7
3
  type CacheContents = {
8
4
  rootPlugin: Plugin;
9
5
  config: Config;
10
6
  exitCodes: OclifConfiguration['exitCodes'];
11
7
  '@oclif/core': OclifCoreInfo;
12
8
  };
9
+ type OclifCoreInfo = {
10
+ name: string;
11
+ version: string;
12
+ };
13
13
  type ValueOf<T> = T[keyof T];
14
14
  /**
15
15
  * A simple cache for storing values that need to be accessed globally.
@@ -18,10 +18,10 @@ export default class Cache extends Map<keyof CacheContents, ValueOf<CacheContent
18
18
  static instance: Cache;
19
19
  constructor();
20
20
  static getInstance(): Cache;
21
- get(key: 'config'): Config | undefined;
22
- get(key: '@oclif/core'): OclifCoreInfo;
23
- get(key: 'rootPlugin'): Plugin | undefined;
24
- get(key: 'exitCodes'): OclifConfiguration['exitCodes'] | undefined;
21
+ get(_key: 'config'): Config | undefined;
22
+ get(_key: '@oclif/core'): OclifCoreInfo;
23
+ get(_key: 'rootPlugin'): Plugin | undefined;
24
+ get(_key: 'exitCodes'): OclifConfiguration['exitCodes'] | undefined;
25
25
  private getOclifCoreMeta;
26
26
  }
27
27
  export {};
package/lib/command.d.ts CHANGED
@@ -11,6 +11,7 @@ import { Plugin } from './interfaces/plugin';
11
11
  export declare abstract class Command {
12
12
  argv: string[];
13
13
  config: Config;
14
+ private static readonly _base;
14
15
  /** An array of aliases for this command. */
15
16
  static aliases: string[];
16
17
  /** An order-dependent object of arguments for the command */
@@ -72,12 +73,7 @@ export declare abstract class Command {
72
73
  static usage: string | string[] | undefined;
73
74
  protected debug: (...args: any[]) => void;
74
75
  id: string | undefined;
75
- private static readonly _base;
76
76
  constructor(argv: string[], config: Config);
77
- /**
78
- * actual command run code goes here
79
- */
80
- abstract run(): Promise<any>;
81
77
  /**
82
78
  * instantiate and run the command
83
79
  *
@@ -88,6 +84,7 @@ export declare abstract class Command {
88
84
  */
89
85
  static run<T extends Command>(this: new (argv: string[], config: Config) => T, argv?: string[], opts?: LoadOptions): Promise<ReturnType<T['run']>>;
90
86
  protected get ctor(): typeof Command;
87
+ protected _run<T>(): Promise<T>;
91
88
  protected catch(err: CommandError): Promise<any>;
92
89
  error(input: Error | string, options: {
93
90
  code?: string;
@@ -110,12 +107,15 @@ export declare abstract class Command {
110
107
  protected logJson(json: unknown): void;
111
108
  logToStderr(message?: string, ...args: any[]): void;
112
109
  protected parse<F extends FlagOutput, B extends FlagOutput, A extends ArgOutput>(options?: Input<F, B, A>, argv?: string[]): Promise<ParserOutput<F, B, A>>;
110
+ /**
111
+ * actual command run code goes here
112
+ */
113
+ abstract run(): Promise<any>;
113
114
  protected toErrorJson(err: unknown): any;
114
115
  protected toSuccessJson(result: unknown): any;
115
116
  warn(input: Error | string): Error | string;
116
117
  protected warnIfCommandDeprecated(): void;
117
118
  protected warnIfFlagDeprecated(flags: Record<string, unknown>): void;
118
- protected _run<T>(): Promise<T>;
119
119
  private removeEnvVar;
120
120
  }
121
121
  export declare namespace Command {
package/lib/command.js CHANGED
@@ -66,6 +66,7 @@ process.stdout.on('error', (err) => {
66
66
  class Command {
67
67
  argv;
68
68
  config;
69
+ static _base = `${pjson.name}@${pjson.version}`;
69
70
  /** An array of aliases for this command. */
70
71
  static aliases = [];
71
72
  /** An order-dependent object of arguments for the command */
@@ -127,7 +128,6 @@ class Command {
127
128
  static usage;
128
129
  debug;
129
130
  id;
130
- static _base = `${pjson.name}@${pjson.version}`;
131
131
  constructor(argv, config) {
132
132
  this.argv = argv;
133
133
  this.config = config;
@@ -171,6 +171,26 @@ class Command {
171
171
  get ctor() {
172
172
  return this.constructor;
173
173
  }
174
+ async _run() {
175
+ let err;
176
+ let result;
177
+ try {
178
+ // remove redirected env var to allow subsessions to run autoupdated client
179
+ this.removeEnvVar('REDIRECTED');
180
+ await this.init();
181
+ result = await this.run();
182
+ }
183
+ catch (error) {
184
+ err = error;
185
+ await this.catch(error);
186
+ }
187
+ finally {
188
+ await this.finally(err);
189
+ }
190
+ if (result && this.jsonEnabled())
191
+ this.logJson(this.toSuccessJson(result));
192
+ return result;
193
+ }
174
194
  async catch(err) {
175
195
  process.exitCode = process.exitCode ?? err.exitCode ?? 1;
176
196
  if (this.jsonEnabled()) {
@@ -195,7 +215,7 @@ class Command {
195
215
  async finally(_) { }
196
216
  async init() {
197
217
  this.debug('init version: %s argv: %o', this.ctor._base, this.argv);
198
- const g = global;
218
+ const g = globalThis;
199
219
  g['http-call'] = g['http-call'] || {};
200
220
  g['http-call'].userAgent = this.config.userAgent;
201
221
  this.warnIfCommandDeprecated();
@@ -216,9 +236,9 @@ class Command {
216
236
  const jsonIndex = this.argv.indexOf('--json');
217
237
  return passThroughIndex === -1
218
238
  ? // If '--' is not present, then check for `--json` in this.argv
219
- jsonIndex > -1
239
+ jsonIndex !== -1
220
240
  : // If '--' is present, return true only the --json flag exists and is before the '--'
221
- jsonIndex > -1 && jsonIndex < passThroughIndex;
241
+ jsonIndex !== -1 && jsonIndex < passThroughIndex;
222
242
  }
223
243
  log(message = '', ...args) {
224
244
  if (!this.jsonEnabled()) {
@@ -302,26 +322,6 @@ class Command {
302
322
  }
303
323
  }
304
324
  }
305
- async _run() {
306
- let err;
307
- let result;
308
- try {
309
- // remove redirected env var to allow subsessions to run autoupdated client
310
- this.removeEnvVar('REDIRECTED');
311
- await this.init();
312
- result = await this.run();
313
- }
314
- catch (error) {
315
- err = error;
316
- await this.catch(error);
317
- }
318
- finally {
319
- await this.finally(err);
320
- }
321
- if (result && this.jsonEnabled())
322
- this.logJson(this.toSuccessJson(result));
323
- return result;
324
- }
325
325
  removeEnvVar(envVar) {
326
326
  const keys = [];
327
327
  try {
@@ -44,12 +44,13 @@ export declare class Config implements IConfig {
44
44
  private topicPermutations;
45
45
  constructor(options: Options);
46
46
  static load(opts?: LoadOptions): Promise<Config>;
47
- static get rootPlugin(): IPlugin | undefined;
48
47
  get commandIDs(): string[];
49
48
  get commands(): Command.Loadable[];
50
49
  protected get isProd(): boolean;
50
+ static get rootPlugin(): IPlugin | undefined;
51
51
  get topics(): Topic[];
52
52
  get versionDetails(): VersionDetails;
53
+ protected _shell(): string;
53
54
  protected dir(category: 'cache' | 'config' | 'data'): string;
54
55
  findCommand(id: string, opts: {
55
56
  must: true;
@@ -101,13 +102,13 @@ export declare class Config implements IConfig {
101
102
  scopedEnvVar(k: string): string | undefined;
102
103
  /**
103
104
  * this DOES NOT account for bin aliases, use scopedEnvVarKeys instead which will account for bin aliases
104
- * @param {string} k, the unscoped key you want to get the value for
105
+ * @param k {string}, the unscoped key you want to get the value for
105
106
  * @returns {string} returns the env var key
106
107
  */
107
108
  scopedEnvVarKey(k: string): string;
108
109
  /**
109
110
  * gets the scoped env var keys for a given key, including bin aliases
110
- * @param {string} k, the env key e.g. 'debug'
111
+ * @param k {string}, the env key e.g. 'debug'
111
112
  * @returns {string[]} e.g. ['SF_DEBUG', 'SFDX_DEBUG']
112
113
  */
113
114
  scopedEnvVarKeys(k: string): string[];
@@ -115,7 +116,6 @@ export declare class Config implements IConfig {
115
116
  protected windowsHome(): string | undefined;
116
117
  protected windowsHomedriveHome(): string | undefined;
117
118
  protected windowsUserprofileHome(): string | undefined;
118
- protected _shell(): string;
119
119
  private buildS3Config;
120
120
  private getCmdLookupId;
121
121
  private getTopicLookupId;
@@ -126,7 +126,6 @@ export declare class Config implements IConfig {
126
126
  * with oclif-compatible ones returned by @oclif/plugin-legacy init hook.
127
127
  *
128
128
  * @param plugins array of oclif-compatible plugins
129
- * @returns void
130
129
  */
131
130
  private insertLegacyPlugins;
132
131
  private isJitPluginCommand;
@@ -178,9 +178,6 @@ class Config {
178
178
  await config.load();
179
179
  return config;
180
180
  }
181
- static get rootPlugin() {
182
- return this.rootPlugin;
183
- }
184
181
  get commandIDs() {
185
182
  if (this._commandIDs)
186
183
  return this._commandIDs;
@@ -193,6 +190,9 @@ class Config {
193
190
  get isProd() {
194
191
  return (0, util_2.isProd)();
195
192
  }
193
+ static get rootPlugin() {
194
+ return this.rootPlugin;
195
+ }
196
196
  get topics() {
197
197
  return [...this._topics.values()];
198
198
  }
@@ -208,6 +208,27 @@ class Config {
208
208
  shell: this.shell,
209
209
  };
210
210
  }
211
+ _shell() {
212
+ let shellPath;
213
+ const { COMSPEC } = process.env;
214
+ const SHELL = process.env.SHELL ?? (0, node_os_1.userInfo)().shell?.split(node_path_1.sep)?.pop();
215
+ if (SHELL) {
216
+ shellPath = SHELL.split('/');
217
+ }
218
+ else if (this.windows && process.title.toLowerCase().includes('powershell')) {
219
+ shellPath = ['powershell'];
220
+ }
221
+ else if (this.windows && process.title.toLowerCase().includes('command prompt')) {
222
+ shellPath = ['cmd.exe'];
223
+ }
224
+ else if (this.windows && COMSPEC) {
225
+ shellPath = COMSPEC.split(/\\|\//);
226
+ }
227
+ else {
228
+ shellPath = ['unknown'];
229
+ }
230
+ return shellPath.at(-1) ?? 'unknown';
231
+ }
211
232
  dir(category) {
212
233
  const base = process.env[`XDG_${category.toUpperCase()}_HOME`] ||
213
234
  (this.windows && process.env.LOCALAPPDATA) ||
@@ -379,8 +400,8 @@ class Config {
379
400
  return this.pjson.oclif.theme;
380
401
  };
381
402
  const [defaultTheme, userTheme] = await Promise.all([
382
- await getDefaultTheme(),
383
- await (0, fs_1.safeReadJson)(userThemeFile),
403
+ getDefaultTheme(),
404
+ (0, fs_1.safeReadJson)(userThemeFile),
384
405
  ]);
385
406
  // Merge the default theme with the user theme, giving the user theme precedence.
386
407
  const merged = { ...defaultTheme, ...userTheme };
@@ -431,7 +452,7 @@ class Config {
431
452
  }
432
453
  }
433
454
  const command = await c.load();
434
- await this.runHook('prerun', { Command: command, argv });
455
+ await this.runHook('prerun', { argv, Command: command });
435
456
  const result = (await command.run(argv, this));
436
457
  // If plugins:uninstall was run, we need to remove all the uninstalled plugins
437
458
  // from this.plugins so that the postrun hook doesn't attempt to run any
@@ -440,7 +461,7 @@ class Config {
440
461
  for (const arg of argv)
441
462
  this.plugins.delete(arg);
442
463
  }
443
- await this.runHook('postrun', { Command: command, argv, result });
464
+ await this.runHook('postrun', { argv, Command: command, result });
444
465
  marker?.addDetails({ command: id, plugin: c.pluginName });
445
466
  marker?.stop();
446
467
  return result;
@@ -560,7 +581,7 @@ class Config {
560
581
  }
561
582
  /**
562
583
  * this DOES NOT account for bin aliases, use scopedEnvVarKeys instead which will account for bin aliases
563
- * @param {string} k, the unscoped key you want to get the value for
584
+ * @param k {string}, the unscoped key you want to get the value for
564
585
  * @returns {string} returns the env var key
565
586
  */
566
587
  scopedEnvVarKey(k) {
@@ -571,7 +592,7 @@ class Config {
571
592
  }
572
593
  /**
573
594
  * gets the scoped env var keys for a given key, including bin aliases
574
- * @param {string} k, the env key e.g. 'debug'
595
+ * @param k {string}, the env key e.g. 'debug'
575
596
  * @returns {string[]} e.g. ['SF_DEBUG', 'SFDX_DEBUG']
576
597
  */
577
598
  scopedEnvVarKeys(k) {
@@ -592,27 +613,6 @@ class Config {
592
613
  windowsUserprofileHome() {
593
614
  return process.env.USERPROFILE;
594
615
  }
595
- _shell() {
596
- let shellPath;
597
- const { COMSPEC } = process.env;
598
- const SHELL = process.env.SHELL ?? (0, node_os_1.userInfo)().shell?.split(node_path_1.sep)?.pop();
599
- if (SHELL) {
600
- shellPath = SHELL.split('/');
601
- }
602
- else if (this.windows && process.title.toLowerCase().includes('powershell')) {
603
- shellPath = ['powershell'];
604
- }
605
- else if (this.windows && process.title.toLowerCase().includes('command prompt')) {
606
- shellPath = ['cmd.exe'];
607
- }
608
- else if (this.windows && COMSPEC) {
609
- shellPath = COMSPEC.split(/\\|\//);
610
- }
611
- else {
612
- shellPath = ['unknown'];
613
- }
614
- return shellPath.at(-1) ?? 'unknown';
615
- }
616
616
  buildS3Config() {
617
617
  const s3 = this.pjson.oclif.update?.s3;
618
618
  const bucket = this.scopedEnvVar('S3_BUCKET') ?? s3?.bucket;
@@ -661,7 +661,6 @@ class Config {
661
661
  * with oclif-compatible ones returned by @oclif/plugin-legacy init hook.
662
662
  *
663
663
  * @param plugins array of oclif-compatible plugins
664
- * @returns void
665
664
  */
666
665
  insertLegacyPlugins(plugins) {
667
666
  for (const plugin of plugins) {
@@ -5,6 +5,8 @@ import { Plugin as IPlugin, PluginOptions } from '../interfaces/plugin';
5
5
  import { Topic } from '../interfaces/topic';
6
6
  export declare class Plugin implements IPlugin {
7
7
  options: PluginOptions;
8
+ _base: string;
9
+ protected _debug: (..._: any) => void;
8
10
  alias: string;
9
11
  alreadyLoaded: boolean;
10
12
  children: Plugin[];
@@ -26,8 +28,6 @@ export declare class Plugin implements IPlugin {
26
28
  type: string;
27
29
  valid: boolean;
28
30
  version: string;
29
- _base: string;
30
- protected _debug: (..._: any) => void;
31
31
  private commandCache;
32
32
  private commandDiscoveryOpts;
33
33
  private flexibleTaxonomy;
@@ -81,6 +81,8 @@ function determineHookOptions(hook) {
81
81
  }
82
82
  class Plugin {
83
83
  options;
84
+ _base = `${_pjson.name}@${_pjson.version}`;
85
+ _debug = (0, util_2.makeDebug)();
84
86
  alias;
85
87
  alreadyLoaded = false;
86
88
  children = [];
@@ -101,8 +103,6 @@ class Plugin {
101
103
  type;
102
104
  valid = false;
103
105
  version;
104
- _base = `${_pjson.name}@${_pjson.version}`;
105
- _debug = (0, util_2.makeDebug)();
106
106
  commandCache;
107
107
  commandDiscoveryOpts;
108
108
  flexibleTaxonomy;
@@ -162,6 +162,7 @@ class Plugin {
162
162
  marker?.stop();
163
163
  return cmd;
164
164
  }
165
+ // eslint-disable-next-line complexity
165
166
  async load() {
166
167
  this.type = this.options.type ?? 'core';
167
168
  this.tag = this.options.tag;
@@ -17,7 +17,7 @@ export declare class CLIError extends Error implements OclifError {
17
17
  get stack(): string;
18
18
  /**
19
19
  * @deprecated `render` Errors display should be handled by display function, like pretty-print
20
- * @return {string} returns a string representing the dispay of the error
20
+ * @returns {string} returns a string representing the display of the error
21
21
  */
22
22
  render(): string;
23
23
  }
@@ -20,7 +20,7 @@ function addOclifExitCode(error, options) {
20
20
  ;
21
21
  error.oclif = {};
22
22
  }
23
- error.oclif.exit = options?.exit === undefined ? cache_1.default.getInstance().get('exitCodes')?.default ?? 2 : options.exit;
23
+ error.oclif.exit = options?.exit === undefined ? (cache_1.default.getInstance().get('exitCodes')?.default ?? 2) : options.exit;
24
24
  return error;
25
25
  }
26
26
  class CLIError extends Error {
@@ -34,6 +34,7 @@ class CLIError extends Error {
34
34
  this.code = options.code;
35
35
  this.suggestions = options.suggestions;
36
36
  }
37
+ // eslint-disable-next-line getter-return
37
38
  get bang() {
38
39
  try {
39
40
  return (0, theme_1.colorize)('red', process.platform === 'win32' ? '»' : '›');
@@ -45,7 +46,7 @@ class CLIError extends Error {
45
46
  }
46
47
  /**
47
48
  * @deprecated `render` Errors display should be handled by display function, like pretty-print
48
- * @return {string} returns a string representing the dispay of the error
49
+ * @returns {string} returns a string representing the display of the error
49
50
  */
50
51
  render() {
51
52
  if (settings_1.settings.debug) {
@@ -66,6 +67,7 @@ exports.CLIError = CLIError;
66
67
  super(err instanceof Error ? err.message : err);
67
68
  this.name = 'Warning';
68
69
  }
70
+ // eslint-disable-next-line getter-return
69
71
  get bang() {
70
72
  try {
71
73
  return (0, theme_1.colorize)('yellow', process.platform === 'win32' ? '»' : '›');
package/lib/execute.d.ts CHANGED
@@ -2,9 +2,6 @@ import { LoadOptions } from './interfaces';
2
2
  /**
3
3
  * Load and run oclif CLI
4
4
  *
5
- * @param options - options to load the CLI
6
- * @returns Promise<void>
7
- *
8
5
  * @example For ESM dev.js
9
6
  * ```
10
7
  * #!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
package/lib/execute.js CHANGED
@@ -9,9 +9,6 @@ const settings_1 = require("./settings");
9
9
  /**
10
10
  * Load and run oclif CLI
11
11
  *
12
- * @param options - options to load the CLI
13
- * @returns Promise<void>
14
- *
15
12
  * @example For ESM dev.js
16
13
  * ```
17
14
  * #!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
@@ -164,6 +164,7 @@ class CommandHelp extends formatter_1.HelpFormatter {
164
164
  if (flags.length === 0)
165
165
  return;
166
166
  const noChar = flags.reduce((previous, current) => previous && current.char === undefined, true);
167
+ // eslint-disable-next-line complexity
167
168
  return flags.map((flag) => {
168
169
  let left = this.flagHelpLabel(flag);
169
170
  if (noChar)
@@ -54,7 +54,7 @@ export declare class HelpFormatter {
54
54
  * ```
55
55
  * @param body the text to indent
56
56
  * @param spacing the final number of spaces this text will be indented
57
- * @return the formatted indented text
57
+ * @returns the formatted indented text
58
58
  */
59
59
  indent(body: string, spacing?: number): string;
60
60
  renderList(input: (string | undefined)[][], opts: {
@@ -57,7 +57,7 @@ class HelpFormatter {
57
57
  * ```
58
58
  * @param body the text to indent
59
59
  * @param spacing the final number of spaces this text will be indented
60
- * @return the formatted indented text
60
+ * @returns the formatted indented text
61
61
  */
62
62
  indent(body, spacing = this.indentSpacing) {
63
63
  return (0, indent_string_1.default)(body, spacing);
@@ -22,6 +22,7 @@ export declare abstract class HelpBase extends HelpFormatter {
22
22
  export declare class Help extends HelpBase {
23
23
  protected CommandHelpClass: typeof CommandHelp;
24
24
  constructor(config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>);
25
+ private get _topics();
25
26
  protected get sortedCommands(): Command.Loadable[];
26
27
  protected get sortedTopics(): Interfaces.Topic[];
27
28
  protected command(command: Command.Loadable): string;
@@ -38,7 +39,6 @@ export declare class Help extends HelpBase {
38
39
  protected showRootHelp(): Promise<void>;
39
40
  protected showTopicHelp(topic: Interfaces.Topic): Promise<void>;
40
41
  protected summary(c: Command.Loadable): string | undefined;
41
- private get _topics();
42
42
  }
43
43
  interface HelpBaseDerived {
44
44
  new (config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>): HelpBase;
package/lib/help/index.js CHANGED
@@ -53,6 +53,19 @@ class Help extends HelpBase {
53
53
  constructor(config, opts = {}) {
54
54
  super(config, opts);
55
55
  }
56
+ /*
57
+ * _topics is to work around Interfaces.topics mistakenly including commands that do
58
+ * not have children, as well as topics. A topic has children, either commands or other topics. When
59
+ * this is fixed upstream config.topics should return *only* topics with children,
60
+ * and this can be removed.
61
+ */
62
+ get _topics() {
63
+ return this.config.topics.filter((topic) => {
64
+ // it is assumed a topic has a child if it has children
65
+ const hasChild = this.config.topics.some((subTopic) => subTopic.name.includes(`${topic.name}:`));
66
+ return hasChild;
67
+ });
68
+ }
56
69
  get sortedCommands() {
57
70
  let { commands } = this.config;
58
71
  commands = commands.filter((c) => this.opts.all || !c.hidden);
@@ -147,7 +160,7 @@ class Help extends HelpBase {
147
160
  return new this.CommandHelpClass(command, this.config, this.opts);
148
161
  }
149
162
  log(...args) {
150
- this.opts.sendToStderr ? ux_1.ux.stderr(args) : ux_1.ux.stdout(args);
163
+ return this.opts.sendToStderr ? ux_1.ux.stderr(args) : ux_1.ux.stdout(args);
151
164
  }
152
165
  async showCommandHelp(command) {
153
166
  const name = command.id;
@@ -303,19 +316,6 @@ class Help extends HelpBase {
303
316
  return (0, theme_1.colorize)(this.config?.theme?.commandSummary, this.render(c.summary.split('\n')[0]));
304
317
  return c.description && (0, theme_1.colorize)(this.config?.theme?.commandSummary, this.render(c.description).split('\n')[0]);
305
318
  }
306
- /*
307
- * _topics is to work around Interfaces.topics mistakenly including commands that do
308
- * not have children, as well as topics. A topic has children, either commands or other topics. When
309
- * this is fixed upstream config.topics should return *only* topics with children,
310
- * and this can be removed.
311
- */
312
- get _topics() {
313
- return this.config.topics.filter((topic) => {
314
- // it is assumed a topic has a child if it has children
315
- const hasChild = this.config.topics.some((subTopic) => subTopic.name.includes(`${topic.name}:`));
316
- return hasChild;
317
- });
318
- }
319
319
  }
320
320
  exports.Help = Help;
321
321
  function extractClass(exported) {
package/lib/help/util.js CHANGED
@@ -96,7 +96,7 @@ function standardizeIDFromArgv(argv, config) {
96
96
  function getHelpFlagAdditions(config) {
97
97
  const helpFlags = ['--help'];
98
98
  const additionalHelpFlags = config.pjson.oclif.additionalHelpFlags ?? [];
99
- return [...new Set([...helpFlags, ...additionalHelpFlags]).values()];
99
+ return [...new Set([...additionalHelpFlags, ...helpFlags]).values()];
100
100
  }
101
101
  function formatFlagDeprecationWarning(flag, opts) {
102
102
  let message = `The "${flag}" flag has been deprecated`;
package/lib/index.js CHANGED
@@ -49,8 +49,8 @@ function checkNodeVersion() {
49
49
  if (process.env.OCLIF_DISABLE_ENGINE_WARNING && (0, util_1.isTruthy)(process.env.OCLIF_DISABLE_ENGINE_WARNING))
50
50
  return;
51
51
  try {
52
- const semver = require('semver');
53
52
  const path = require('node:path');
53
+ const semver = require('semver');
54
54
  const root = path.join(__dirname, '..');
55
55
  const pjson = require(path.join(root, 'package.json'));
56
56
  if (!semver.satisfies(process.versions.node, pjson.engines.node)) {
@@ -111,8 +111,8 @@ export interface Config {
111
111
  */
112
112
  readonly shell: string;
113
113
  readonly theme?: Theme | undefined;
114
- topicSeparator: ' ' | ':';
115
114
  readonly topics: Topic[];
115
+ topicSeparator: ' ' | ':';
116
116
  readonly updateConfig: NonNullable<OclifConfiguration['update']>;
117
117
  /**
118
118
  * user agent to use for http calls
@@ -4,13 +4,13 @@ exports.load = load;
4
4
  exports.loadWithData = loadWithData;
5
5
  exports.loadWithDataFromManifest = loadWithDataFromManifest;
6
6
  exports.isPathModule = isPathModule;
7
+ const getPackageType = require('get-package-type');
7
8
  const node_fs_1 = require("node:fs");
8
9
  const node_path_1 = require("node:path");
9
10
  const node_url_1 = require("node:url");
10
11
  const ts_path_1 = require("./config/ts-path");
11
12
  const module_load_1 = require("./errors/errors/module-load");
12
13
  const fs_1 = require("./util/fs");
13
- const getPackageType = require('get-package-type');
14
14
  /**
15
15
  * Defines file extension resolution when source files do not have an extension.
16
16
  */
@@ -23,9 +23,9 @@ export declare class Parser<T extends ParserInput, TFlags extends OutputFlags<T[
23
23
  private readonly flagAliases;
24
24
  private readonly raw;
25
25
  constructor(input: T);
26
+ private get _argTokens();
26
27
  parse(): Promise<ParserOutput<TFlags, BFlags, TArgs>>;
27
28
  private _args;
28
- private get _argTokens();
29
29
  private _debugInput;
30
30
  private _debugOutput;
31
31
  private _flags;
@@ -33,9 +33,9 @@ const readStdin = async () => {
33
33
  // Because of this, we have to set a timeout to prevent the process from hanging.
34
34
  if (stdin.isTTY)
35
35
  return null;
36
- if (global.oclif?.stdinCache) {
37
- debug('resolved stdin from global cache', global.oclif.stdinCache);
38
- return global.oclif.stdinCache;
36
+ if (globalThis.oclif?.stdinCache) {
37
+ debug('resolved stdin from global cache', globalThis.oclif.stdinCache);
38
+ return globalThis.oclif.stdinCache;
39
39
  }
40
40
  return new Promise((resolve) => {
41
41
  let result = '';
@@ -53,7 +53,7 @@ const readStdin = async () => {
53
53
  rl.once('close', () => {
54
54
  clearTimeout(timeout);
55
55
  debug('resolved from stdin', result);
56
- global.oclif = { ...global.oclif, stdinCache: result };
56
+ globalThis.oclif = { ...globalThis.oclif, stdinCache: result };
57
57
  resolve(result);
58
58
  });
59
59
  signal.addEventListener('abort', () => {
@@ -89,6 +89,9 @@ class Parser {
89
89
  this.booleanFlags = (0, util_1.pickBy)(input.flags, (f) => f.type === 'boolean');
90
90
  this.flagAliases = Object.fromEntries(Object.values(input.flags).flatMap((flag) => [...(flag.aliases ?? []), ...(flag.charAliases ?? [])].map((a) => [a, flag])));
91
91
  }
92
+ get _argTokens() {
93
+ return this.raw.filter((o) => o.type === 'arg');
94
+ }
92
95
  async parse() {
93
96
  this._debugInput();
94
97
  // eslint-disable-next-line complexity
@@ -235,9 +238,6 @@ class Parser {
235
238
  }
236
239
  return { args, argv };
237
240
  }
238
- get _argTokens() {
239
- return this.raw.filter((o) => o.type === 'arg');
240
- }
241
241
  _debugInput() {
242
242
  debug('input: %s', this.argv.join(' '));
243
243
  const args = Object.keys(this.input.args);
@@ -192,12 +192,12 @@ async function validate(parse) {
192
192
  case 'all': {
193
193
  return validateDependsOn(name, relationship.flags);
194
194
  }
195
- case 'some': {
196
- return validateSome(name, relationship.flags);
197
- }
198
195
  case 'none': {
199
196
  return validateExclusive(name, relationship.flags);
200
197
  }
198
+ case 'some': {
199
+ return validateSome(name, relationship.flags);
200
+ }
201
201
  default: {
202
202
  throw new Error(`Unknown relationship type: ${relationship.type}`);
203
203
  }
@@ -53,10 +53,8 @@ export declare class Performance {
53
53
  static collect(): Promise<void>;
54
54
  /**
55
55
  * Add debug logs for plugin loading performance
56
- * @returns void
57
56
  */
58
57
  static debug(): void;
59
- static get enabled(): boolean;
60
58
  static getResult(owner: string, name: string): PerfResult | undefined;
61
59
  /**
62
60
  * Add a new performance marker
@@ -67,6 +65,7 @@ export declare class Performance {
67
65
  * @returns Marker instance
68
66
  */
69
67
  static mark(owner: string, name: string, details?: Details): Marker | undefined;
68
+ static get enabled(): boolean;
70
69
  static get oclifPerf(): PerfHighlights | Record<string, never>;
71
70
  /** returns a map of owner, PerfResult[]. Excludes oclif PerfResult, which you can get from oclifPerf */
72
71
  static get results(): Map<string, PerfResult[]>;
@@ -62,6 +62,7 @@ class Performance {
62
62
  marker.stop();
63
63
  }
64
64
  return new Promise((resolve) => {
65
+ // eslint-disable-next-line complexity
65
66
  const perfObserver = new node_perf_hooks_1.PerformanceObserver((items) => {
66
67
  for (const entry of items.getEntries()) {
67
68
  const marker = Performance.markers.get(entry.name);
@@ -81,7 +82,7 @@ class Performance {
81
82
  const oclifResults = Performance._results.get(exports.OCLIF_MARKER_OWNER) ?? [];
82
83
  const command = oclifResults.find((r) => r.name.startsWith('config.runCommand'));
83
84
  const commandLoadTime = command
84
- ? Performance.getResult(exports.OCLIF_MARKER_OWNER, `plugin.findCommand#${command.details.plugin}.${command.details.command}`)?.duration ?? 0
85
+ ? (Performance.getResult(exports.OCLIF_MARKER_OWNER, `plugin.findCommand#${command.details.plugin}.${command.details.command}`)?.duration ?? 0)
85
86
  : 0;
86
87
  const pluginLoadTimes = Object.fromEntries(oclifResults
87
88
  .filter(({ name }) => name.startsWith('plugin.load#'))
@@ -139,7 +140,6 @@ class Performance {
139
140
  }
140
141
  /**
141
142
  * Add debug logs for plugin loading performance
142
- * @returns void
143
143
  */
144
144
  static debug() {
145
145
  if (!Performance.enabled)
@@ -189,9 +189,6 @@ class Performance {
189
189
  }
190
190
  }
191
191
  }
192
- static get enabled() {
193
- return settings_1.settings.performanceEnabled ?? false;
194
- }
195
192
  static getResult(owner, name) {
196
193
  return Performance._results.get(owner)?.find((r) => r.name === name);
197
194
  }
@@ -210,6 +207,9 @@ class Performance {
210
207
  Performance.markers.set(marker.name, marker);
211
208
  return marker;
212
209
  }
210
+ static get enabled() {
211
+ return settings_1.settings.performanceEnabled ?? false;
212
+ }
213
213
  static get oclifPerf() {
214
214
  if (!Performance.enabled)
215
215
  return {};
package/lib/settings.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.settings = void 0;
4
4
  // Set global.oclif to the new object if it wasn't set before
5
- if (!global.oclif)
6
- global.oclif = {};
7
- exports.settings = global.oclif;
5
+ if (!globalThis.oclif)
6
+ globalThis.oclif = {};
7
+ exports.settings = globalThis.oclif;
@@ -74,8 +74,8 @@ async function cacheCommand(uncachedCmd, plugin, respectNoCacheDefault = false)
74
74
  // @ts-expect-error because v2 commands have base flags stored in _baseFlags
75
75
  const uncachedBaseFlags = cmd.baseFlags ?? cmd._baseFlags;
76
76
  const [flags, args] = await Promise.all([
77
- await cacheFlags((0, aggregate_flags_1.aggregateFlags)(uncachedFlags, uncachedBaseFlags, cmd.enableJsonFlag), respectNoCacheDefault),
78
- await cacheArgs((0, ensure_arg_object_1.ensureArgObject)(cmd.args), respectNoCacheDefault),
77
+ cacheFlags((0, aggregate_flags_1.aggregateFlags)(uncachedFlags, uncachedBaseFlags, cmd.enableJsonFlag), respectNoCacheDefault),
78
+ cacheArgs((0, ensure_arg_object_1.ensureArgObject)(cmd.args), respectNoCacheDefault),
79
79
  ]);
80
80
  const stdProperties = {
81
81
  aliases: cmd.aliases ?? [],
@@ -110,7 +110,7 @@ async function cacheCommand(uncachedCmd, plugin, respectNoCacheDefault = false)
110
110
  '_base',
111
111
  ];
112
112
  // Add in any additional properties that are not standard command properties.
113
- const stdKeysAndIgnored = new Set([...Object.keys(stdProperties), ...ignoreCommandProperties]);
113
+ const stdKeysAndIgnored = new Set([...ignoreCommandProperties, ...Object.keys(stdProperties)]);
114
114
  const keysToAdd = Object.keys(cmd).filter((property) => !stdKeysAndIgnored.has(property));
115
115
  const additionalProperties = Object.fromEntries(keysToAdd.map((key) => [key, cmd[key]]));
116
116
  return { ...stdProperties, ...additionalProperties };
@@ -14,8 +14,5 @@ import { Command } from '../command';
14
14
  *
15
15
  * If there is not a core plugin command present, this function will return the first
16
16
  * plugin as discovered (will not change the order)
17
- *
18
- * @param commands commands to determine the priority of
19
- * @returns command instance {Command.Loadable} or undefined
20
17
  */
21
18
  export declare function determinePriority(plugins: string[], commands: Command.Loadable[]): Command.Loadable;
@@ -16,9 +16,6 @@ exports.determinePriority = determinePriority;
16
16
  *
17
17
  * If there is not a core plugin command present, this function will return the first
18
18
  * plugin as discovered (will not change the order)
19
- *
20
- * @param commands commands to determine the priority of
21
- * @returns command instance {Command.Loadable} or undefined
22
19
  */
23
20
  function determinePriority(plugins, commands) {
24
21
  const commandPlugins = commands.sort((a, b) => {
@@ -10,6 +10,7 @@ export declare class ActionBase {
10
10
  protected stdmocks?: ['stderr' | 'stdout', string[]][];
11
11
  type: ActionType;
12
12
  private stdmockOrigs;
13
+ private get globals();
13
14
  protected get output(): string | undefined;
14
15
  protected set output(output: string | undefined);
15
16
  get running(): boolean;
@@ -17,10 +18,6 @@ export declare class ActionBase {
17
18
  set status(status: string | undefined);
18
19
  get task(): Task | undefined;
19
20
  set task(task: Task | undefined);
20
- pause(fn: () => any, icon?: string): Promise<any>;
21
- pauseAsync<T>(fn: () => Promise<T>, icon?: string): Promise<T>;
22
- start(action: string, status?: string, opts?: Options): void;
23
- stop(msg?: string): void;
24
21
  protected _flushStdout(): void;
25
22
  protected _pause(_?: string): void;
26
23
  protected _resume(): void;
@@ -29,6 +26,9 @@ export declare class ActionBase {
29
26
  protected _stop(_: string): void;
30
27
  protected _updateStatus(_: string | undefined, __?: string): void;
31
28
  protected _write(std: 'stderr' | 'stdout', s: string | string[]): void;
32
- private get globals();
29
+ pause(fn: () => any, icon?: string): Promise<any>;
30
+ pauseAsync<T>(fn: () => Promise<T>, icon?: string): Promise<T>;
31
+ start(action: string, status?: string, opts?: Options): void;
32
+ stop(msg?: string): void;
33
33
  }
34
34
  export {};
@@ -11,6 +11,13 @@ class ActionBase {
11
11
  stderr: process.stderr.write,
12
12
  stdout: process.stdout.write,
13
13
  };
14
+ get globals() {
15
+ ;
16
+ globalThis.ux = globalThis.ux || {};
17
+ const globals = globalThis.ux;
18
+ globals.action = globals.action || {};
19
+ return globals;
20
+ }
14
21
  get output() {
15
22
  return this.globals.output;
16
23
  }
@@ -40,52 +47,6 @@ class ActionBase {
40
47
  set task(task) {
41
48
  this.globals.action.task = task;
42
49
  }
43
- pause(fn, icon) {
44
- const { task } = this;
45
- const active = task && task.active;
46
- if (task && active) {
47
- this._pause(icon);
48
- this._stdout(false);
49
- task.active = false;
50
- }
51
- const ret = fn();
52
- if (task && active) {
53
- this._resume();
54
- }
55
- return ret;
56
- }
57
- async pauseAsync(fn, icon) {
58
- const { task } = this;
59
- const active = task && task.active;
60
- if (task && active) {
61
- this._pause(icon);
62
- this._stdout(false);
63
- task.active = false;
64
- }
65
- const ret = await fn();
66
- if (task && active) {
67
- this._resume();
68
- }
69
- return ret;
70
- }
71
- start(action, status, opts = {}) {
72
- this.std = opts.stdout ? 'stdout' : 'stderr';
73
- const task = { action, active: Boolean(this.task && this.task.active), status };
74
- this.task = task;
75
- this._start(opts);
76
- task.active = true;
77
- this._stdout(true);
78
- }
79
- stop(msg = 'done') {
80
- const { task } = this;
81
- if (!task) {
82
- return;
83
- }
84
- this._stop(msg);
85
- task.active = false;
86
- this.task = undefined;
87
- this._stdout(false);
88
- }
89
50
  // flush mocked stdout/stderr
90
51
  _flushStdout() {
91
52
  try {
@@ -159,25 +120,64 @@ class ActionBase {
159
120
  // write to the real stdout/stderr
160
121
  _write(std, s) {
161
122
  switch (std) {
162
- case 'stdout': {
163
- this.stdmockOrigs.stdout.apply(process.stdout, (0, util_1.castArray)(s));
164
- break;
165
- }
166
123
  case 'stderr': {
167
124
  this.stdmockOrigs.stderr.apply(process.stderr, (0, util_1.castArray)(s));
168
125
  break;
169
126
  }
127
+ case 'stdout': {
128
+ this.stdmockOrigs.stdout.apply(process.stdout, (0, util_1.castArray)(s));
129
+ break;
130
+ }
170
131
  default: {
171
132
  throw new Error(`invalid std: ${std}`);
172
133
  }
173
134
  }
174
135
  }
175
- get globals() {
176
- ;
177
- global.ux = global.ux || {};
178
- const globals = global.ux;
179
- globals.action = globals.action || {};
180
- return globals;
136
+ pause(fn, icon) {
137
+ const { task } = this;
138
+ const active = task && task.active;
139
+ if (task && active) {
140
+ this._pause(icon);
141
+ this._stdout(false);
142
+ task.active = false;
143
+ }
144
+ const ret = fn();
145
+ if (task && active) {
146
+ this._resume();
147
+ }
148
+ return ret;
149
+ }
150
+ async pauseAsync(fn, icon) {
151
+ const { task } = this;
152
+ const active = task && task.active;
153
+ if (task && active) {
154
+ this._pause(icon);
155
+ this._stdout(false);
156
+ task.active = false;
157
+ }
158
+ const ret = await fn();
159
+ if (task && active) {
160
+ this._resume();
161
+ }
162
+ return ret;
163
+ }
164
+ start(action, status, opts = {}) {
165
+ this.std = opts.stdout ? 'stdout' : 'stderr';
166
+ const task = { action, active: Boolean(this.task && this.task.active), status };
167
+ this.task = task;
168
+ this._start(opts);
169
+ task.active = true;
170
+ this._stdout(true);
171
+ }
172
+ stop(msg = 'done') {
173
+ const { task } = this;
174
+ if (!task) {
175
+ return;
176
+ }
177
+ this._stop(msg);
178
+ task.active = false;
179
+ this.task = undefined;
180
+ this._stdout(false);
181
181
  }
182
182
  }
183
183
  exports.ActionBase = ActionBase;
@@ -1,11 +1,11 @@
1
1
  import { ActionBase, ActionType } from './base';
2
2
  export default class SimpleAction extends ActionBase {
3
3
  type: ActionType;
4
- private _flush;
5
4
  protected _pause(icon?: string): void;
6
- private _render;
7
5
  protected _resume(): void;
8
6
  protected _start(): void;
9
7
  protected _stop(status: string): void;
10
8
  protected _updateStatus(status: string, prevStatus?: string, newline?: boolean): void;
9
+ private _flush;
10
+ private _render;
11
11
  }
@@ -3,23 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const base_1 = require("./base");
4
4
  class SimpleAction extends base_1.ActionBase {
5
5
  type = 'simple';
6
- _flush() {
7
- this._write(this.std, '\n');
8
- this._flushStdout();
9
- }
10
6
  _pause(icon) {
11
7
  if (icon)
12
8
  this._updateStatus(icon);
13
9
  else
14
10
  this._flush();
15
11
  }
16
- _render(action, status) {
17
- if (!this.task)
18
- return;
19
- if (this.task.active)
20
- this._flush();
21
- this._write(this.std, status ? `${action}... ${status}` : `${action}...`);
22
- }
23
12
  _resume() {
24
13
  // Not implemented
25
14
  }
@@ -43,5 +32,16 @@ class SimpleAction extends base_1.ActionBase {
43
32
  if (newline || !prevStatus)
44
33
  this._flush();
45
34
  }
35
+ _flush() {
36
+ this._write(this.std, '\n');
37
+ this._flushStdout();
38
+ }
39
+ _render(action, status) {
40
+ if (!this.task)
41
+ return;
42
+ if (this.task.active)
43
+ this._flush();
44
+ this._write(this.std, status ? `${action}... ${status}` : `${action}...`);
45
+ }
46
46
  }
47
47
  exports.default = SimpleAction;
@@ -7,13 +7,13 @@ export default class SpinnerAction extends ActionBase {
7
7
  private frames;
8
8
  private spinner?;
9
9
  constructor();
10
- protected colorize(s: string): string;
11
10
  protected _frame(): string;
12
- private _lines;
13
11
  protected _pause(icon?: string): void;
14
- private _render;
15
- private _reset;
16
12
  protected _start(opts: Options): void;
17
13
  protected _stop(status: string): void;
14
+ protected colorize(s: string): string;
15
+ private _lines;
16
+ private _render;
17
+ private _reset;
18
18
  private getFrames;
19
19
  }
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const ansiEscapes = require('ansi-escapes');
6
7
  const ansis_1 = __importDefault(require("ansis"));
7
8
  const cli_spinners_1 = __importDefault(require("cli-spinners"));
8
9
  const cache_1 = __importDefault(require("../../cache"));
9
10
  const screen_1 = require("../../screen");
10
11
  const theme_1 = require("../theme");
11
12
  const base_1 = require("./base");
12
- const ansiEscapes = require('ansi-escapes');
13
13
  class SpinnerAction extends base_1.ActionBase {
14
14
  type = 'spinner';
15
15
  color = 'magenta';
@@ -21,19 +21,11 @@ class SpinnerAction extends base_1.ActionBase {
21
21
  this.frames = this.getFrames();
22
22
  this.frameIndex = 0;
23
23
  }
24
- colorize(s) {
25
- return (0, theme_1.colorize)(this.color, s);
26
- }
27
24
  _frame() {
28
25
  const frame = this.frames[this.frameIndex];
29
26
  this.frameIndex = ++this.frameIndex % this.frames.length;
30
27
  return this.colorize(frame);
31
28
  }
32
- _lines(s) {
33
- return ansis_1.default.strip(s).split('\n')
34
- .map((l) => Math.ceil(l.length / screen_1.errtermwidth))
35
- .reduce((c, i) => c + i, 0);
36
- }
37
29
  _pause(icon) {
38
30
  if (this.spinner)
39
31
  clearInterval(this.spinner);
@@ -42,23 +34,6 @@ class SpinnerAction extends base_1.ActionBase {
42
34
  this._render(` ${icon}`);
43
35
  this.output = undefined;
44
36
  }
45
- _render(icon) {
46
- if (!this.task)
47
- return;
48
- this._reset();
49
- this._flushStdout();
50
- const frame = icon === 'spinner' ? ` ${this._frame()}` : icon || '';
51
- const status = this.task.status ? ` ${this.task.status}` : '';
52
- this.output = `${this.task.action}...${frame}${status}\n`;
53
- this._write(this.std, this.output);
54
- }
55
- _reset() {
56
- if (!this.output)
57
- return;
58
- const lines = this._lines(this.output);
59
- this._write(this.std, ansiEscapes.cursorLeft + ansiEscapes.cursorUp(lines) + ansiEscapes.eraseDown);
60
- this.output = undefined;
61
- }
62
37
  _start(opts) {
63
38
  this.color = cache_1.default.getInstance().get('config')?.theme?.spinner ?? this.color;
64
39
  if (opts.style)
@@ -79,6 +54,31 @@ class SpinnerAction extends base_1.ActionBase {
79
54
  this._render();
80
55
  this.output = undefined;
81
56
  }
57
+ colorize(s) {
58
+ return (0, theme_1.colorize)(this.color, s);
59
+ }
60
+ _lines(s) {
61
+ return ansis_1.default.strip(s).split('\n')
62
+ .map((l) => Math.ceil(l.length / screen_1.errtermwidth))
63
+ .reduce((c, i) => c + i, 0);
64
+ }
65
+ _render(icon) {
66
+ if (!this.task)
67
+ return;
68
+ this._reset();
69
+ this._flushStdout();
70
+ const frame = icon === 'spinner' ? ` ${this._frame()}` : icon || '';
71
+ const status = this.task.status ? ` ${this.task.status}` : '';
72
+ this.output = `${this.task.action}...${frame}${status}\n`;
73
+ this._write(this.std, this.output);
74
+ }
75
+ _reset() {
76
+ if (!this.output)
77
+ return;
78
+ const lines = this._lines(this.output);
79
+ this._write(this.std, ansiEscapes.cursorLeft + ansiEscapes.cursorUp(lines) + ansiEscapes.eraseDown);
80
+ this.output = undefined;
81
+ }
82
82
  getFrames(opts) {
83
83
  if (opts?.style)
84
84
  return cli_spinners_1.default[opts.style].frames;
@@ -34,9 +34,9 @@ function serializer(replacer, cycleReplacer) {
34
34
  // @ts-expect-error because `this` is not typed
35
35
  const thisPos = stack.indexOf(this);
36
36
  // @ts-expect-error because `this` is not typed
37
- // eslint-disable-next-line no-bitwise
37
+ // eslint-disable-next-line no-bitwise, @typescript-eslint/no-unused-expressions
38
38
  ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
39
- // eslint-disable-next-line no-bitwise
39
+ // eslint-disable-next-line no-bitwise, @typescript-eslint/no-unused-expressions
40
40
  ~thisPos ? keys.splice(thisPos, Number.POSITIVE_INFINITY, key) : keys.push(key);
41
41
  // @ts-expect-error because `this` is not typed
42
42
  if (stack.includes(value))
package/lib/ux/list.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = renderList;
4
+ const wordwrap = require('wordwrap');
4
5
  const screen_1 = require("../screen");
5
6
  const util_1 = require("../util/util");
6
- const wordwrap = require('wordwrap');
7
7
  function linewrap(length, s) {
8
8
  return wordwrap(length, screen_1.stdtermwidth, {
9
9
  skipScheme: 'ansi-color',
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "4.2.3",
4
+ "version": "4.2.5",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {
8
8
  "ansi-escapes": "^4.3.2",
9
- "ansis": "^3.8.1",
9
+ "ansis": "^3.9.0",
10
10
  "clean-stack": "^3.0.1",
11
11
  "cli-spinners": "^2.9.2",
12
12
  "debug": "^4.4.0",
@@ -26,6 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@commitlint/config-conventional": "^19",
29
+ "@eslint/compat": "^1.2.5",
29
30
  "@oclif/plugin-help": "^6",
30
31
  "@oclif/plugin-plugins": "^5",
31
32
  "@oclif/prettier-config": "^0.2.1",
@@ -49,10 +50,9 @@
49
50
  "chai-as-promised": "^7.1.2",
50
51
  "commitlint": "^19",
51
52
  "cross-env": "^7.0.3",
52
- "eslint": "^8.57.1",
53
- "eslint-config-oclif": "^5.2.2",
54
- "eslint-config-oclif-typescript": "^3.1.13",
55
- "eslint-config-prettier": "^9.1.0",
53
+ "eslint": "^9",
54
+ "eslint-config-oclif": "^6",
55
+ "eslint-config-prettier": "^10",
56
56
  "husky": "^9.1.7",
57
57
  "lint-staged": "^15",
58
58
  "madge": "^6.1.0",
@@ -96,6 +96,7 @@
96
96
  "./hooks": "./lib/interfaces/hooks.js",
97
97
  "./interfaces": "./lib/interfaces/index.js",
98
98
  "./logger": "./lib/logger.js",
99
+ "./package.json": "./package.json",
99
100
  "./parser": "./lib/parser/index.js",
100
101
  "./performance": "./lib/performance.js",
101
102
  "./run": "./lib/main.js",
@@ -118,7 +119,7 @@
118
119
  "build": "shx rm -rf lib && tsc",
119
120
  "compile": "tsc",
120
121
  "format": "prettier --write \"+(src|test)/**/*.+(ts|js|json)\"",
121
- "lint": "eslint . --ext .ts",
122
+ "lint": "eslint",
122
123
  "posttest": "yarn lint && yarn test:circular-deps",
123
124
  "prepack": "yarn run build",
124
125
  "prepare": "husky",