@oclif/core 3.0.0-beta.9 → 3.0.0

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.
Files changed (142) hide show
  1. package/README.md +4 -2
  2. package/flush.d.ts +3 -0
  3. package/flush.js +1 -0
  4. package/handle.js +1 -0
  5. package/lib/args.d.ts +2 -2
  6. package/lib/args.js +17 -18
  7. package/lib/{ux → cli-ux}/action/base.d.ts +19 -21
  8. package/lib/{ux → cli-ux}/action/base.js +126 -120
  9. package/lib/{ux → cli-ux}/action/simple.js +25 -30
  10. package/lib/{ux → cli-ux}/action/spinner.d.ts +9 -7
  11. package/lib/{ux → cli-ux}/action/spinner.js +45 -37
  12. package/lib/{ux → cli-ux}/action/spinners.js +187 -187
  13. package/lib/cli-ux/action/types.d.ts +5 -0
  14. package/lib/cli-ux/action/types.js +2 -0
  15. package/lib/{ux → cli-ux}/config.d.ts +5 -5
  16. package/lib/{ux → cli-ux}/config.js +17 -17
  17. package/lib/{ux → cli-ux}/exit.js +3 -0
  18. package/lib/cli-ux/flush.d.ts +1 -0
  19. package/lib/cli-ux/flush.js +28 -0
  20. package/lib/cli-ux/index.d.ts +39 -0
  21. package/lib/{ux → cli-ux}/index.js +74 -88
  22. package/lib/{ux → cli-ux}/list.js +3 -3
  23. package/lib/{ux → cli-ux}/prompt.d.ts +3 -3
  24. package/lib/{ux → cli-ux}/prompt.js +35 -25
  25. package/lib/{ux → cli-ux}/stream.d.ts +6 -6
  26. package/lib/{ux → cli-ux}/stream.js +11 -10
  27. package/lib/cli-ux/styled/index.d.ts +4 -0
  28. package/lib/cli-ux/styled/index.js +11 -0
  29. package/lib/{ux → cli-ux}/styled/object.js +7 -9
  30. package/lib/{ux → cli-ux}/styled/table.d.ts +10 -10
  31. package/lib/{ux → cli-ux}/styled/table.js +130 -133
  32. package/lib/{ux → cli-ux}/styled/tree.js +11 -13
  33. package/lib/cli-ux/wait.js +5 -0
  34. package/lib/command.d.ts +82 -88
  35. package/lib/command.js +196 -175
  36. package/lib/config/config.d.ts +89 -90
  37. package/lib/config/config.js +466 -566
  38. package/lib/config/index.d.ts +0 -1
  39. package/lib/config/index.js +1 -3
  40. package/lib/config/plugin-loader.d.ts +12 -12
  41. package/lib/config/plugin-loader.js +72 -56
  42. package/lib/config/plugin.d.ts +25 -24
  43. package/lib/config/plugin.js +188 -154
  44. package/lib/config/ts-node.d.ts +2 -1
  45. package/lib/config/ts-node.js +71 -58
  46. package/lib/config/util.d.ts +1 -11
  47. package/lib/config/util.js +6 -59
  48. package/lib/errors/config.d.ts +1 -1
  49. package/lib/errors/config.js +6 -6
  50. package/lib/errors/errors/cli.d.ts +7 -7
  51. package/lib/errors/errors/cli.js +20 -16
  52. package/lib/errors/errors/exit.d.ts +1 -4
  53. package/lib/errors/errors/exit.js +1 -1
  54. package/lib/errors/errors/module-load.d.ts +1 -4
  55. package/lib/errors/errors/module-load.js +1 -1
  56. package/lib/errors/errors/pretty-print.d.ts +1 -1
  57. package/lib/errors/errors/pretty-print.js +12 -10
  58. package/lib/errors/handle.d.ts +12 -2
  59. package/lib/errors/handle.js +26 -14
  60. package/lib/errors/index.d.ts +10 -10
  61. package/lib/errors/index.js +25 -24
  62. package/lib/errors/logger.d.ts +2 -2
  63. package/lib/errors/logger.js +14 -13
  64. package/lib/execute.d.ts +6 -6
  65. package/lib/execute.js +10 -9
  66. package/lib/flags.d.ts +103 -32
  67. package/lib/flags.js +79 -45
  68. package/lib/help/command.d.ts +16 -14
  69. package/lib/help/command.js +178 -163
  70. package/lib/help/docopts.d.ts +5 -5
  71. package/lib/help/docopts.js +50 -54
  72. package/lib/help/formatter.d.ts +37 -37
  73. package/lib/help/formatter.js +66 -55
  74. package/lib/help/index.d.ts +25 -21
  75. package/lib/help/index.js +169 -147
  76. package/lib/help/root.d.ts +1 -1
  77. package/lib/help/root.js +15 -17
  78. package/lib/help/util.d.ts +2 -8
  79. package/lib/help/util.js +8 -28
  80. package/lib/index.d.ts +19 -20
  81. package/lib/index.js +37 -43
  82. package/lib/interfaces/config.d.ts +67 -66
  83. package/lib/interfaces/errors.d.ts +5 -5
  84. package/lib/interfaces/help.d.ts +17 -17
  85. package/lib/interfaces/hooks.d.ts +49 -49
  86. package/lib/interfaces/index.d.ts +7 -7
  87. package/lib/interfaces/manifest.d.ts +1 -1
  88. package/lib/interfaces/parser.d.ts +175 -51
  89. package/lib/interfaces/pjson.d.ts +41 -41
  90. package/lib/interfaces/plugin.d.ts +47 -41
  91. package/lib/interfaces/s3-manifest.d.ts +7 -7
  92. package/lib/interfaces/topic.d.ts +1 -1
  93. package/lib/interfaces/ts-config.d.ts +7 -7
  94. package/lib/main.d.ts +2 -2
  95. package/lib/main.js +16 -16
  96. package/lib/module-loader.d.ts +67 -77
  97. package/lib/module-loader.js +183 -150
  98. package/lib/parser/errors.d.ts +7 -7
  99. package/lib/parser/errors.js +29 -22
  100. package/lib/parser/help.js +5 -5
  101. package/lib/parser/index.js +2 -2
  102. package/lib/parser/parse.d.ts +9 -6
  103. package/lib/parser/parse.js +253 -221
  104. package/lib/parser/validate.js +53 -33
  105. package/lib/performance.d.ts +43 -32
  106. package/lib/performance.js +133 -91
  107. package/lib/screen.js +2 -2
  108. package/lib/settings.d.ts +11 -12
  109. package/lib/settings.js +2 -2
  110. package/lib/util/aggregate-flags.d.ts +2 -0
  111. package/lib/util/aggregate-flags.js +13 -0
  112. package/lib/util/cache-command.d.ts +3 -0
  113. package/lib/util/cache-command.js +109 -0
  114. package/lib/util/cache-default-value.d.ts +2 -0
  115. package/lib/util/cache-default-value.js +28 -0
  116. package/lib/util/ensure-arg-object.d.ts +12 -0
  117. package/lib/util/ensure-arg-object.js +14 -0
  118. package/lib/util/fs.d.ts +7 -0
  119. package/lib/util/fs.js +54 -0
  120. package/lib/util/os.d.ts +19 -0
  121. package/lib/util/os.js +28 -0
  122. package/lib/{util.d.ts → util/util.d.ts} +7 -16
  123. package/lib/util/util.js +98 -0
  124. package/package.json +35 -37
  125. package/lib/util.js +0 -126
  126. package/lib/ux/flush.d.ts +0 -1
  127. package/lib/ux/flush.js +0 -27
  128. package/lib/ux/index.d.ts +0 -58
  129. package/lib/ux/styled/index.d.ts +0 -6
  130. package/lib/ux/styled/index.js +0 -13
  131. package/lib/ux/styled/json.d.ts +0 -1
  132. package/lib/ux/styled/json.js +0 -15
  133. package/lib/ux/wait.js +0 -7
  134. package/lib/{ux → cli-ux}/action/simple.d.ts +4 -4
  135. package/lib/{ux → cli-ux}/action/spinners.d.ts +117 -117
  136. package/lib/{ux → cli-ux}/exit.d.ts +2 -2
  137. package/lib/{ux → cli-ux}/list.d.ts +0 -0
  138. package/lib/{ux → cli-ux}/styled/object.d.ts +0 -0
  139. package/lib/{ux → cli-ux}/styled/progress.d.ts +0 -0
  140. package/lib/{ux → cli-ux}/styled/progress.js +0 -0
  141. package/lib/{ux → cli-ux}/styled/tree.d.ts +1 -1
  142. /package/lib/{ux → cli-ux}/wait.d.ts +0 -0
@@ -1,12 +1,20 @@
1
- import { Options, Plugin as IPlugin } from '../interfaces/plugin';
2
- import { Config as IConfig, ArchTypes, PlatformTypes, LoadOptions, VersionDetails } from '../interfaces/config';
3
- import { Hook, Hooks, PJSON, Topic } from '../interfaces';
4
1
  import { Command } from '../command';
2
+ import { Hook, Hooks, PJSON, Topic } from '../interfaces';
3
+ import { ArchTypes, Config as IConfig, LoadOptions, PlatformTypes, VersionDetails } from '../interfaces/config';
4
+ import { Plugin as IPlugin, Options } from '../interfaces/plugin';
5
5
  export declare class Config implements IConfig {
6
6
  options: Options;
7
7
  private _base;
8
+ private _commandIDs;
9
+ private _commands;
10
+ private static _rootPlugin;
11
+ private _topics;
12
+ private commandPermutations;
13
+ private pluginLoader;
14
+ private topicPermutations;
8
15
  arch: ArchTypes;
9
16
  bin: string;
17
+ binAliases?: string[];
10
18
  binPath?: string;
11
19
  cacheDir: string;
12
20
  channel: string;
@@ -19,62 +27,66 @@ export declare class Config implements IConfig {
19
27
  home: string;
20
28
  name: string;
21
29
  npmRegistry?: string;
30
+ nsisCustomization?: string;
22
31
  pjson: PJSON.CLI;
23
32
  platform: PlatformTypes;
24
33
  plugins: Map<string, IPlugin>;
25
34
  root: string;
26
35
  shell: string;
27
- topicSeparator: ':' | ' ';
36
+ topicSeparator: ' ' | ':';
28
37
  userAgent: string;
29
38
  userPJSON?: PJSON.User;
30
39
  valid: boolean;
31
40
  version: string;
32
- windows: boolean;
33
- binAliases?: string[];
34
- nsisCustomization?: string;
35
41
  protected warned: boolean;
36
- private commandPermutations;
37
- private topicPermutations;
38
- private _commands;
39
- private _topics;
40
- private _commandIDs;
41
- private pluginLoader;
42
- private static _rootPlugin;
42
+ windows: boolean;
43
43
  constructor(options: Options);
44
44
  static load(opts?: LoadOptions): Promise<Config>;
45
45
  static get rootPlugin(): IPlugin | undefined;
46
- load(): Promise<void>;
47
- loadPluginsAndCommands(opts?: {
48
- force: boolean;
49
- }): Promise<void>;
50
- runHook<T extends keyof Hooks>(event: T, opts: Hooks[T]['options'], timeout?: number, captureErrors?: boolean): Promise<Hook.Result<Hooks[T]['return']>>;
51
- runCommand<T = unknown>(id: string, argv?: string[], cachedCommand?: Command.Loadable | null): Promise<T>;
52
- scopedEnvVar(k: string): string | undefined;
53
- scopedEnvVarTrue(k: string): boolean;
46
+ protected _debug(): number;
47
+ protected _shell(): string;
54
48
  /**
55
- * this DOES NOT account for bin aliases, use scopedEnvVarKeys instead which will account for bin aliases
56
- * @param {string} k, the unscoped key you want to get the value for
57
- * @returns {string} returns the env var key
49
+ * This method is responsible for locating the correct plugin to use for a named command id
50
+ * It searches the {Config} registered commands to match either the raw command id or the command alias
51
+ * It is possible that more than one command will be found. This is due the ability of two distinct plugins to
52
+ * create the same command or command alias.
53
+ *
54
+ * In the case of more than one found command, the function will select the command based on the order in which
55
+ * the plugin is included in the package.json `oclif.plugins` list. The command that occurs first in the list
56
+ * is selected as the command to run.
57
+ *
58
+ * Commands can also be present from either an install or a link. When a command is one of these and a core plugin
59
+ * is present, this function defers to the core plugin.
60
+ *
61
+ * If there is not a core plugin command present, this function will return the first
62
+ * plugin as discovered (will not change the order)
63
+ *
64
+ * @param commands commands to determine the priority of
65
+ * @returns command instance {Command.Loadable} or undefined
58
66
  */
59
- scopedEnvVarKey(k: string): string;
67
+ private determinePriority;
68
+ private getCmdLookupId;
69
+ private getTopicLookupId;
60
70
  /**
61
- * gets the scoped env var keys for a given key, including bin aliases
62
- * @param {string} k, the env key e.g. 'debug'
63
- * @returns {string[]} e.g. ['SF_DEBUG', 'SFDX_DEBUG']
71
+ * Insert legacy plugins
72
+ *
73
+ * Replace invalid CLI plugins (cli-engine plugins, mostly Heroku) loaded via `this.loadPlugins`
74
+ * with oclif-compatible ones returned by @oclif/plugin-legacy init hook.
75
+ *
76
+ * @param plugins array of oclif-compatible plugins
77
+ * @returns void
64
78
  */
65
- scopedEnvVarKeys(k: string): string[];
79
+ private insertLegacyPlugins;
80
+ private isJitPluginCommand;
81
+ private loadCommands;
82
+ private loadTopics;
83
+ protected dir(category: 'cache' | 'config' | 'data'): string;
66
84
  findCommand(id: string, opts: {
67
85
  must: true;
68
86
  }): Command.Loadable;
69
87
  findCommand(id: string, opts?: {
70
88
  must: boolean;
71
89
  }): Command.Loadable | undefined;
72
- findTopic(id: string, opts: {
73
- must: true;
74
- }): Topic;
75
- findTopic(id: string, opts?: {
76
- must: boolean;
77
- }): Topic | undefined;
78
90
  /**
79
91
  * Find all command ids that include the provided command id.
80
92
  *
@@ -89,69 +101,56 @@ export declare class Config implements IConfig {
89
101
  * @returns string[]
90
102
  */
91
103
  findMatches(partialCmdId: string, argv: string[]): Command.Loadable[];
92
- /**
93
- * Returns an array of all commands. If flexible taxonomy is enabled then all permutations will be appended to the array.
94
- * @returns Command.Loadable[]
95
- */
96
- getAllCommands(): Command.Loadable[];
104
+ findTopic(id: string, opts: {
105
+ must: true;
106
+ }): Topic;
107
+ findTopic(id: string, opts?: {
108
+ must: boolean;
109
+ }): Topic | undefined;
97
110
  /**
98
111
  * Returns an array of all command ids. If flexible taxonomy is enabled then all permutations will be appended to the array.
99
112
  * @returns string[]
100
113
  */
101
114
  getAllCommandIDs(): string[];
102
- get commands(): Command.Loadable[];
103
- get commandIDs(): string[];
104
- get topics(): Topic[];
105
- get versionDetails(): VersionDetails;
115
+ /**
116
+ * Returns an array of all commands. If flexible taxonomy is enabled then all permutations will be appended to the array.
117
+ * @returns Command.Loadable[]
118
+ */
119
+ getAllCommands(): Command.Loadable[];
120
+ getPluginsList(): IPlugin[];
121
+ load(): Promise<void>;
122
+ loadPluginsAndCommands(opts?: {
123
+ force: boolean;
124
+ }): Promise<void>;
125
+ protected macosCacheDir(): string | undefined;
126
+ runCommand<T = unknown>(id: string, argv?: string[], cachedCommand?: Command.Loadable | null): Promise<T>;
127
+ runHook<T extends keyof Hooks>(event: T, opts: Hooks[T]['options'], timeout?: number, captureErrors?: boolean): Promise<Hook.Result<Hooks[T]['return']>>;
106
128
  s3Key(type: keyof PJSON.S3.Templates, ext?: '.tar.gz' | '.tar.xz' | IConfig.s3Key.Options, options?: IConfig.s3Key.Options): string;
107
129
  s3Url(key: string): string;
108
- getPluginsList(): IPlugin[];
109
- protected dir(category: 'cache' | 'data' | 'config'): string;
130
+ scopedEnvVar(k: string): string | undefined;
131
+ /**
132
+ * this DOES NOT account for bin aliases, use scopedEnvVarKeys instead which will account for bin aliases
133
+ * @param {string} k, the unscoped key you want to get the value for
134
+ * @returns {string} returns the env var key
135
+ */
136
+ scopedEnvVarKey(k: string): string;
137
+ /**
138
+ * gets the scoped env var keys for a given key, including bin aliases
139
+ * @param {string} k, the env key e.g. 'debug'
140
+ * @returns {string[]} e.g. ['SF_DEBUG', 'SFDX_DEBUG']
141
+ */
142
+ scopedEnvVarKeys(k: string): string[];
143
+ scopedEnvVarTrue(k: string): boolean;
144
+ protected warn(err: {
145
+ detail: string;
146
+ name: string;
147
+ } | Error | string, scope?: string): void;
110
148
  protected windowsHome(): string | undefined;
111
149
  protected windowsHomedriveHome(): string | undefined;
112
150
  protected windowsUserprofileHome(): string | undefined;
113
- protected macosCacheDir(): string | undefined;
114
- protected _shell(): string;
115
- protected _debug(): number;
116
- protected warn(err: string | Error | {
117
- name: string;
118
- detail: string;
119
- }, scope?: string): void;
151
+ get commandIDs(): string[];
152
+ get commands(): Command.Loadable[];
120
153
  protected get isProd(): boolean;
121
- private isJitPluginCommand;
122
- private getCmdLookupId;
123
- private getTopicLookupId;
124
- private loadCommands;
125
- private loadTopics;
126
- /**
127
- * This method is responsible for locating the correct plugin to use for a named command id
128
- * It searches the {Config} registered commands to match either the raw command id or the command alias
129
- * It is possible that more than one command will be found. This is due the ability of two distinct plugins to
130
- * create the same command or command alias.
131
- *
132
- * In the case of more than one found command, the function will select the command based on the order in which
133
- * the plugin is included in the package.json `oclif.plugins` list. The command that occurs first in the list
134
- * is selected as the command to run.
135
- *
136
- * Commands can also be present from either an install or a link. When a command is one of these and a core plugin
137
- * is present, this function defers to the core plugin.
138
- *
139
- * If there is not a core plugin command present, this function will return the first
140
- * plugin as discovered (will not change the order)
141
- *
142
- * @param commands commands to determine the priority of
143
- * @returns command instance {Command.Loadable} or undefined
144
- */
145
- private determinePriority;
146
- /**
147
- * Insert legacy plugins
148
- *
149
- * Replace invalid CLI plugins (cli-engine plugins, mostly Heroku) loaded via `this.loadPlugins`
150
- * with oclif-compatible ones returned by @oclif/plugin-legacy init hook.
151
- *
152
- * @param plugins array of oclif-compatible plugins
153
- * @returns void
154
- */
155
- private insertLegacyPlugins;
154
+ get topics(): Topic[];
155
+ get versionDetails(): VersionDetails;
156
156
  }
157
- export declare function toCached(c: Command.Class, plugin?: IPlugin, respectNoCacheDefault?: boolean): Promise<Command.Cached>;