@oclif/core 2.6.0 → 2.6.2

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.
@@ -6,15 +6,16 @@ import { Command } from '../command';
6
6
  export type LoadOptions = Options | string | Config | undefined;
7
7
  export type PlatformTypes = 'darwin' | 'linux' | 'win32' | 'aix' | 'freebsd' | 'openbsd' | 'sunos' | 'wsl';
8
8
  export type ArchTypes = 'arm' | 'arm64' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | 'x86';
9
+ export type PluginVersionDetail = {
10
+ version: string;
11
+ type: string;
12
+ root: string;
13
+ };
9
14
  export type VersionDetails = {
10
15
  cliVersion: string;
11
16
  architecture: string;
12
17
  nodeVersion: string;
13
- pluginVersions?: Record<string, {
14
- version: string;
15
- type: string;
16
- root: string;
17
- }>;
18
+ pluginVersions?: Record<string, PluginVersionDetail>;
18
19
  osVersion?: string;
19
20
  shell?: string;
20
21
  rootPath?: string;
@@ -108,6 +109,7 @@ export interface Config {
108
109
  readonly commands: Command.Loadable[];
109
110
  readonly topics: Topic[];
110
111
  readonly commandIDs: string[];
112
+ readonly versionDetails: VersionDetails;
111
113
  runCommand<T = unknown>(id: string, argv?: string[], cachedCommand?: Command.Loadable): Promise<T>;
112
114
  runHook<T extends keyof Hooks>(event: T, opts: Hooks[T]['options'], timeout?: number, captureErrors?: boolean): Promise<Hook.Result<Hooks[T]['return']>>;
113
115
  getAllCommandIDs(): string[];
@@ -1,5 +1,5 @@
1
1
  export { AlphabetLowercase, AlphabetUppercase } from './alphabet';
2
- export { Config, ArchTypes, PlatformTypes, LoadOptions } from './config';
2
+ export { Config, ArchTypes, PlatformTypes, LoadOptions, VersionDetails, PluginVersionDetail } from './config';
3
3
  export { OclifError, PrettyPrintableError, CommandError } from './errors';
4
4
  export { HelpOptions } from './help';
5
5
  export { Hook, Hooks } from './hooks';
@@ -33,6 +33,8 @@ class Performance {
33
33
  return settings_1.settings.performanceEnabled ?? false;
34
34
  }
35
35
  static get results() {
36
+ if (!Performance.enabled)
37
+ return [];
36
38
  if (Performance._results.length > 0)
37
39
  return Performance._results;
38
40
  throw new Error('Perf results not available. Did you forget to call await Performance.collect()?');
@@ -41,6 +43,8 @@ class Performance {
41
43
  return Performance.results.find(r => r.name === name);
42
44
  }
43
45
  static get highlights() {
46
+ if (!Performance.enabled)
47
+ return {};
44
48
  if (Performance._highlights)
45
49
  return Performance._highlights;
46
50
  throw new Error('Perf results not available. Did you forget to call await Performance.collect()?');
@@ -69,7 +73,10 @@ class Performance {
69
73
  return;
70
74
  if (Performance._results.length > 0)
71
75
  return;
72
- for (const marker of Object.values(Performance.markers).filter(m => !m.stopped)) {
76
+ const markers = Object.values(Performance.markers);
77
+ if (markers.length === 0)
78
+ return;
79
+ for (const marker of markers.filter(m => !m.stopped)) {
73
80
  marker.stop();
74
81
  }
75
82
  return new Promise(resolve => {
@@ -128,7 +135,7 @@ class Performance {
128
135
  resolve();
129
136
  });
130
137
  perfObserver.observe({ entryTypes: ['measure'], buffered: true });
131
- for (const marker of Object.values(Performance.markers)) {
138
+ for (const marker of markers) {
132
139
  try {
133
140
  marker.measure();
134
141
  }
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.6.0",
4
+ "version": "2.6.2",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {