@teambit/cli 0.0.590 → 0.0.592

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 (38) hide show
  1. package/dist/cli-parser.js +21 -106
  2. package/dist/cli-parser.js.map +1 -1
  3. package/dist/cli.aspect.js +0 -6
  4. package/dist/cli.aspect.js.map +1 -1
  5. package/dist/cli.cmd.js +3 -44
  6. package/dist/cli.cmd.js.map +1 -1
  7. package/dist/cli.composition.js +0 -6
  8. package/dist/cli.composition.js.map +1 -1
  9. package/dist/cli.main.runtime.js +11 -79
  10. package/dist/cli.main.runtime.js.map +1 -1
  11. package/dist/command-runner.js +6 -73
  12. package/dist/command-runner.js.map +1 -1
  13. package/dist/completion.cmd.js +0 -7
  14. package/dist/completion.cmd.js.map +1 -1
  15. package/dist/exceptions/already-exists.js +0 -6
  16. package/dist/exceptions/already-exists.js.map +1 -1
  17. package/dist/exceptions/command-not-found.js +0 -16
  18. package/dist/exceptions/command-not-found.js.map +1 -1
  19. package/dist/exceptions/index.js +0 -3
  20. package/dist/exceptions/index.js.map +1 -1
  21. package/dist/generate-doc-md.js +0 -33
  22. package/dist/generate-doc-md.js.map +1 -1
  23. package/dist/get-command-id.js +0 -3
  24. package/dist/get-command-id.js.map +1 -1
  25. package/dist/help.cmd.js +1 -12
  26. package/dist/help.cmd.js.map +1 -1
  27. package/dist/help.js +0 -23
  28. package/dist/help.js.map +1 -1
  29. package/dist/index.js +0 -11
  30. package/dist/index.js.map +1 -1
  31. package/dist/legacy-command-adapter.js +0 -14
  32. package/dist/legacy-command-adapter.js.map +1 -1
  33. package/dist/yargs-adapter.js +6 -41
  34. package/dist/yargs-adapter.js.map +1 -1
  35. package/package-tar/teambit-cli-0.0.592.tgz +0 -0
  36. package/package.json +5 -5
  37. package/{preview-1666312873430.js → preview-1666669368175.js} +2 -2
  38. package/package-tar/teambit-cli-0.0.590.tgz +0 -0
@@ -1,130 +1,91 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.js");
6
-
7
5
  require("core-js/modules/es.promise.js");
8
-
9
6
  require("core-js/modules/es.regexp.exec.js");
10
-
11
7
  require("core-js/modules/es.string.replace.js");
12
-
13
8
  Object.defineProperty(exports, "__esModule", {
14
9
  value: true
15
10
  });
16
11
  exports.CLIParser = void 0;
17
-
18
12
  function _didyoumean() {
19
13
  const data = _interopRequireDefault(require("didyoumean"));
20
-
21
14
  _didyoumean = function () {
22
15
  return data;
23
16
  };
24
-
25
17
  return data;
26
18
  }
27
-
28
19
  function _yargs() {
29
20
  const data = _interopRequireDefault(require("yargs"));
30
-
31
21
  _yargs = function () {
32
22
  return data;
33
23
  };
34
-
35
24
  return data;
36
25
  }
37
-
38
26
  function _lodash() {
39
27
  const data = require("lodash");
40
-
41
28
  _lodash = function () {
42
29
  return data;
43
30
  };
44
-
45
31
  return data;
46
32
  }
47
-
48
33
  function _consumer() {
49
34
  const data = require("@teambit/legacy/dist/consumer");
50
-
51
35
  _consumer = function () {
52
36
  return data;
53
37
  };
54
-
55
38
  return data;
56
39
  }
57
-
58
40
  function _logger() {
59
41
  const data = _interopRequireDefault(require("@teambit/legacy/dist/logger/logger"));
60
-
61
42
  _logger = function () {
62
43
  return data;
63
44
  };
64
-
65
45
  return data;
66
46
  }
67
-
68
47
  function _loader() {
69
48
  const data = _interopRequireDefault(require("@teambit/legacy/dist/cli/loader"));
70
-
71
49
  _loader = function () {
72
50
  return data;
73
51
  };
74
-
75
52
  return data;
76
53
  }
77
-
78
54
  function _chalk() {
79
55
  const data = _interopRequireDefault(require("chalk"));
80
-
81
56
  _chalk = function () {
82
57
  return data;
83
58
  };
84
-
85
59
  return data;
86
60
  }
87
-
88
61
  function _getCommandId() {
89
62
  const data = require("./get-command-id");
90
-
91
63
  _getCommandId = function () {
92
64
  return data;
93
65
  };
94
-
95
66
  return data;
96
67
  }
97
-
98
68
  function _help() {
99
69
  const data = require("./help");
100
-
101
70
  _help = function () {
102
71
  return data;
103
72
  };
104
-
105
73
  return data;
106
74
  }
107
-
108
75
  function _yargsAdapter() {
109
76
  const data = require("./yargs-adapter");
110
-
111
77
  _yargsAdapter = function () {
112
78
  return data;
113
79
  };
114
-
115
80
  return data;
116
81
  }
117
-
118
82
  function _commandNotFound() {
119
83
  const data = require("./exceptions/command-not-found");
120
-
121
84
  _commandNotFound = function () {
122
85
  return data;
123
86
  };
124
-
125
87
  return data;
126
88
  }
127
-
128
89
  class CLIParser {
129
90
  constructor(commands, groups, parser = _yargs().default, docsDomain) {
130
91
  this.commands = commands;
@@ -132,23 +93,17 @@ class CLIParser {
132
93
  this.parser = parser;
133
94
  this.docsDomain = docsDomain;
134
95
  }
135
-
136
96
  async parse(args = process.argv.slice(2)) {
137
97
  this.throwForNonExistsCommand(args[0]);
138
-
139
98
  _logger().default.debug(`[+] CLI-INPUT: ${args.join(' ')}`);
140
-
141
99
  (0, _yargs().default)(args);
142
-
143
100
  _yargs().default.help(false);
144
-
145
101
  this.configureParser();
146
102
  this.commands.forEach(command => {
147
103
  if (command.commands && command.commands.length) {
148
104
  this.parseCommandWithSubCommands(command);
149
105
  } else {
150
106
  const yargsCommand = this.getYargsCommand(command);
151
-
152
107
  _yargs().default.command(yargsCommand);
153
108
  }
154
109
  });
@@ -156,16 +111,13 @@ class CLIParser {
156
111
  this.setHelpMiddleware();
157
112
  this.handleCommandFailure();
158
113
  this.configureCompletion();
159
-
160
114
  _yargs().default.strict(); // don't allow non-exist flags and non-exist commands
161
115
 
162
-
163
- _yargs().default // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one
116
+ _yargs().default
117
+ // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one
164
118
  .wrap(null);
165
-
166
119
  await _yargs().default.parse();
167
120
  }
168
-
169
121
  setHelpMiddleware() {
170
122
  _yargs().default.middleware(argv => {
171
123
  if (argv._.length === 0 && argv.help) {
@@ -173,45 +125,35 @@ class CLIParser {
173
125
  this.printHelp();
174
126
  process.exit(0);
175
127
  }
176
-
177
128
  if (argv.help) {
178
129
  _loader().default.off(); // stop the "loading bit..." before showing help if needed
179
130
  // this is a command help page
180
-
181
-
182
131
  _yargs().default.showHelp(this.logCommandHelp.bind(this));
183
-
184
132
  if (!_logger().default.isDaemon) process.exit(0);
185
133
  }
186
134
  }, true);
187
135
  }
188
-
189
136
  handleCommandFailure() {
190
137
  _yargs().default.fail((msg, err) => {
191
138
  _loader().default.stop();
192
-
193
139
  if (err) {
194
140
  throw err;
195
141
  }
196
-
197
142
  _yargs().default.showHelp(this.logCommandHelp.bind(this));
198
-
199
143
  const args = process.argv.slice(2);
200
144
  const isHelpFlagEntered = args.includes('--help') || args.includes('-h');
201
- const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments'); // avoid showing the "Not enough non-option arguments" message when the user is trying to get the command help
202
-
145
+ const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');
146
+ // avoid showing the "Not enough non-option arguments" message when the user is trying to get the command help
203
147
  if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {
204
148
  // eslint-disable-next-line no-console
205
149
  console.log(`\n${_chalk().default.yellow(msg)}`);
206
150
  }
207
-
208
151
  if (!_logger().default.isDaemon) process.exit(1);
209
152
  });
210
153
  }
211
-
212
154
  configureCompletion() {
213
- const commandsToShowComponentIdsForCompletion = ['show', 'diff', 'tag', 'export', 'env', 'envs', 'compile', 'build', 'test', 'lint', 'log', 'dependents', 'dependencies']; // @ts-ignore
214
-
155
+ const commandsToShowComponentIdsForCompletion = ['show', 'diff', 'tag', 'export', 'env', 'envs', 'compile', 'build', 'test', 'lint', 'log', 'dependents', 'dependencies'];
156
+ // @ts-ignore
215
157
  _yargs().default.completion('completion', async function (current, argv, completionFilter, done) {
216
158
  if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {
217
159
  const consumer = await (0, _consumer().loadConsumerIfExist)();
@@ -221,13 +163,11 @@ class CLIParser {
221
163
  }
222
164
  });
223
165
  }
224
-
225
166
  printHelp() {
226
- const help = (0, _help().formatHelp)(this.commands, this.groups, this.docsDomain); // eslint-disable-next-line no-console
227
-
167
+ const help = (0, _help().formatHelp)(this.commands, this.groups, this.docsDomain);
168
+ // eslint-disable-next-line no-console
228
169
  console.log(help);
229
170
  }
230
-
231
171
  configureParser() {
232
172
  _yargs().default.parserConfiguration({
233
173
  // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work
@@ -236,36 +176,27 @@ class CLIParser {
236
176
  'populate--': true
237
177
  });
238
178
  }
239
-
240
179
  parseCommandWithSubCommands(command) {
241
180
  const yarnCommand = this.getYargsCommand(command);
242
-
243
181
  const builderFunc = () => {
244
182
  var _command$commands;
245
-
246
183
  (_command$commands = command.commands) === null || _command$commands === void 0 ? void 0 : _command$commands.forEach(cmd => {
247
184
  const subCommand = this.getYargsCommand(cmd);
248
-
249
185
  _yargs().default.command(subCommand);
250
- }); // since the "builder" method is overridden, the global flags of the main command are gone, this fixes it.
251
-
186
+ });
187
+ // since the "builder" method is overridden, the global flags of the main command are gone, this fixes it.
252
188
  _yargs().default.options(_yargsAdapter().YargsAdapter.getGlobalOptions(command));
253
-
254
189
  return _yargs().default;
255
190
  };
256
-
257
191
  yarnCommand.builder = builderFunc;
258
-
259
192
  _yargs().default.command(yarnCommand);
260
193
  }
261
-
262
194
  getYargsCommand(command) {
263
195
  const yarnCommand = new (_yargsAdapter().YargsAdapter)(command);
264
196
  yarnCommand.builder = yarnCommand.builder.bind(yarnCommand);
265
197
  yarnCommand.handler = yarnCommand.handler.bind(yarnCommand);
266
198
  return yarnCommand;
267
199
  }
268
-
269
200
  configureGlobalFlags() {
270
201
  _yargs().default.option('help', {
271
202
  alias: 'h',
@@ -278,18 +209,15 @@ class CLIParser {
278
209
  group: _yargsAdapter().GLOBAL_GROUP
279
210
  });
280
211
  }
281
-
282
212
  throwForNonExistsCommand(commandName) {
283
213
  if (!commandName || commandName.startsWith('-')) {
284
214
  return;
285
215
  }
286
-
287
216
  const commandsNames = this.commands.map(c => (0, _getCommandId().getCommandId)(c.name));
288
217
  const aliases = this.commands.map(c => c.alias).filter(a => a);
289
218
  const existingGlobalFlags = ['-V', '--version'];
290
219
  const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];
291
220
  const commandExist = validCommands.includes(commandName);
292
-
293
221
  if (!commandExist) {
294
222
  _didyoumean().default.returnFirstMatch = true;
295
223
  const suggestions = (0, _didyoumean().default)(commandName, this.commands.filter(c => !c.private).map(c => (0, _getCommandId().getCommandId)(c.name)));
@@ -297,6 +225,7 @@ class CLIParser {
297
225
  throw new (_commandNotFound().CommandNotFound)(commandName, suggestion);
298
226
  }
299
227
  }
228
+
300
229
  /**
301
230
  * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.
302
231
  * see https://github.com/yargs/yargs/issues/1956
@@ -309,13 +238,9 @@ class CLIParser {
309
238
  * Positionals
310
239
  * Examples
311
240
  */
312
-
313
-
314
241
  logCommandHelp(help) {
315
242
  const command = this.findCommandByArgv();
316
-
317
243
  const replacer = (_, p1, p2) => `${p1}${_chalk().default.green(p2)}`;
318
-
319
244
  const lines = help.split('\n');
320
245
  const linesWithoutEmpty = (0, _lodash().compact)(lines);
321
246
  const cmdLine = linesWithoutEmpty[0];
@@ -330,10 +255,8 @@ class CLIParser {
330
255
  let subCommandsStarted = false;
331
256
  let positionalsStarted = false;
332
257
  let examplesStarted = false;
333
-
334
258
  for (let i = 1; i < linesWithoutEmpty.length; i += 1) {
335
259
  const currentLine = linesWithoutEmpty[i];
336
-
337
260
  if (currentLine === _yargsAdapter().STANDARD_GROUP) {
338
261
  optionsStarted = true;
339
262
  } else if (currentLine === _yargsAdapter().GLOBAL_GROUP) {
@@ -357,27 +280,23 @@ class CLIParser {
357
280
  } else {
358
281
  description.push(currentLine);
359
282
  }
360
- } // show the flags in green
361
-
283
+ }
362
284
 
285
+ // show the flags in green
363
286
  const optionsColored = options.map(opt => opt.replace(/(--)([\w-]+)/, replacer).replace(/(-)([\w-]+)/, replacer));
364
287
  const argsColored = args.map(arg => arg.replace(/^ {2}\S+/, argName => _chalk().default.green(argName))); // regex: two spaces then the first word until a white space
365
-
366
288
  const optionsStr = options.length ? `\n${_yargsAdapter().STANDARD_GROUP}\n${optionsColored.join('\n')}\n` : '';
367
289
  const argumentsStr = args.length ? `\nArguments:\n${argsColored.join('\n')}\n` : '';
368
290
  const examplesStr = examples.length ? `\nExamples:\n${examples.join('\n')}\n` : '';
369
- const subCommandsStr = subCommands.length ? `\n${'Commands:'}\n${subCommands.join('\n')}\n` : ''; // show the description in bold
370
-
291
+ const subCommandsStr = subCommands.length ? `\n${'Commands:'}\n${subCommands.join('\n')}\n` : '';
292
+ // show the description in bold
371
293
  const descriptionColored = description.map(desc => _chalk().default.bold(desc));
372
-
373
294
  if (command !== null && command !== void 0 && command.extendedDescription) {
374
295
  descriptionColored.push(command === null || command === void 0 ? void 0 : command.extendedDescription);
375
296
  }
376
-
377
297
  if (command !== null && command !== void 0 && command.helpUrl) {
378
298
  descriptionColored.push(`for more info, visit: ${_chalk().default.underline(command.helpUrl)}`);
379
299
  }
380
-
381
300
  const descriptionStr = descriptionColored.join('\n');
382
301
  const globalOptionsStr = globalOptions.join('\n');
383
302
  const finalOutput = `${cmdLine}
@@ -385,32 +304,30 @@ class CLIParser {
385
304
  ${descriptionStr}
386
305
  ${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}
387
306
  ${_yargsAdapter().GLOBAL_GROUP}
388
- ${globalOptionsStr}`; // eslint-disable-next-line no-console
307
+ ${globalOptionsStr}`;
389
308
 
309
+ // eslint-disable-next-line no-console
390
310
  console.log(finalOutput);
391
311
  }
392
-
393
312
  findCommandByArgv() {
394
313
  const args = process.argv.slice(2);
395
314
  const enteredCommand = args[0];
396
315
  const enteredSubCommand = args[1];
397
-
398
316
  if (!enteredCommand) {
399
317
  return undefined;
400
318
  }
401
-
402
319
  const isCommandMatch = (cmd, str) => {
403
- return cmd.name.startsWith(`${str} `) || // e.g. "tag <id>".startsWith("tag ")
404
- cmd.name === str || // e.g. "globals" === "globals"
320
+ return cmd.name.startsWith(`${str} `) ||
321
+ // e.g. "tag <id>".startsWith("tag ")
322
+ cmd.name === str ||
323
+ // e.g. "globals" === "globals"
405
324
  cmd.alias === str; // e.g. "t" === "t"
406
325
  };
407
326
 
408
327
  const command = this.commands.find(cmd => isCommandMatch(cmd, enteredCommand));
409
-
410
328
  if (!command) {
411
329
  return undefined;
412
330
  }
413
-
414
331
  if (!command.commands || !enteredSubCommand) {
415
332
  return command; // no sub-commands.
416
333
  }
@@ -418,9 +335,7 @@ ${globalOptionsStr}`; // eslint-disable-next-line no-console
418
335
  const subCommand = command.commands.find(cmd => isCommandMatch(cmd, enteredSubCommand));
419
336
  return subCommand || command;
420
337
  }
421
-
422
338
  }
423
-
424
339
  exports.CLIParser = CLIParser;
425
340
 
426
341
  //# sourceMappingURL=cli-parser.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CLIParser","constructor","commands","groups","parser","yargs","docsDomain","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","middleware","_","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","isDaemon","fail","msg","err","stop","isHelpFlagEntered","includes","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","yarnCommand","builderFunc","cmd","subCommand","options","YargsAdapter","getGlobalOptions","builder","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","replacer","p1","p2","green","lines","split","linesWithoutEmpty","compact","cmdLine","description","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","i","currentLine","STANDARD_GROUP","push","optionsColored","opt","replace","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str","find"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs from 'yargs';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport { GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\n\nexport class CLIParser {\n constructor(\n private commands: Command[],\n private groups: GroupsType,\n public parser = yargs,\n private docsDomain: string\n ) {}\n\n async parse(args = process.argv.slice(2)) {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n yargs.command(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n // this is the main help page\n this.printHelp();\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n if (!logger.isDaemon) process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n yargs.showHelp(this.logCommandHelp.bind(this));\n const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n }\n if (!logger.isDaemon) process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp() {\n const help = formatHelp(this.commands, this.groups, this.docsDomain);\n // eslint-disable-next-line no-console\n console.log(help);\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yarnCommand = this.getYargsCommand(command);\n const builderFunc = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n yargs.command(subCommand);\n });\n // since the \"builder\" method is overridden, the global flags of the main command are gone, this fixes it.\n yargs.options(YargsAdapter.getGlobalOptions(command));\n return yargs;\n };\n yarnCommand.builder = builderFunc;\n yargs.command(yarnCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yarnCommand = new YargsAdapter(command);\n yarnCommand.builder = yarnCommand.builder.bind(yarnCommand);\n yarnCommand.handler = yarnCommand.handler.bind(yarnCommand);\n\n return yarnCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n *\n * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\n */\n private logCommandHelp(help: string) {\n const command = this.findCommandByArgv();\n\n const replacer = (_, p1, p2) => `${p1}${chalk.green(p2)}`;\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n const cmdLine = linesWithoutEmpty[0];\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((opt) => opt.replace(/(--)([\\w-]+)/, replacer).replace(/(-)([\\w-]+)/, replacer));\n const argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n // eslint-disable-next-line no-console\n console.log(finalOutput);\n }\n\n private findCommandByArgv(): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = this.commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command; // no sub-commands.\n }\n const subCommand = command.commands.find((cmd) => isCommandMatch(cmd, enteredSubCommand));\n return subCommand || command;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,SAAN,CAAgB;EACrBC,WAAW,CACDC,QADC,EAEDC,MAFC,EAGFC,MAAM,GAAGC,gBAHP,EAIDC,UAJC,EAKT;IAAA,KAJQJ,QAIR,GAJQA,QAIR;IAAA,KAHQC,MAGR,GAHQA,MAGR;IAAA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H,OAAO,GAAG,KAAKjB,QAAL,CAAcgJ,IAAd,CAAoB/E,GAAD,IAAS6E,cAAc,CAAC7E,GAAD,EAAM0E,cAAN,CAA1C,CAAhB;;IACA,IAAI,CAAC1H,OAAL,EAAc;MACZ,OAAO4H,SAAP;IACD;;IACD,IAAI,CAAC5H,OAAO,CAACjB,QAAT,IAAqB,CAAC4I,iBAA1B,EAA6C;MAC3C,OAAO3H,OAAP,CAD2C,CAC3B;IACjB;;IACD,MAAMiD,UAAU,GAAGjD,OAAO,CAACjB,QAAR,CAAiBgJ,IAAjB,CAAuB/E,GAAD,IAAS6E,cAAc,CAAC7E,GAAD,EAAM2E,iBAAN,CAA7C,CAAnB;IACA,OAAO1E,UAAU,IAAIjD,OAArB;EACD;;AA1RoB"}
1
+ {"version":3,"names":["CLIParser","constructor","commands","groups","parser","yargs","docsDomain","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","middleware","_","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","isDaemon","fail","msg","err","stop","isHelpFlagEntered","includes","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","yarnCommand","builderFunc","cmd","subCommand","options","YargsAdapter","getGlobalOptions","builder","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","replacer","p1","p2","green","lines","split","linesWithoutEmpty","compact","cmdLine","description","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","i","currentLine","STANDARD_GROUP","push","optionsColored","opt","replace","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str","find"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs from 'yargs';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport { GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\n\nexport class CLIParser {\n constructor(\n private commands: Command[],\n private groups: GroupsType,\n public parser = yargs,\n private docsDomain: string\n ) {}\n\n async parse(args = process.argv.slice(2)) {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n yargs.command(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n // this is the main help page\n this.printHelp();\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n if (!logger.isDaemon) process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n yargs.showHelp(this.logCommandHelp.bind(this));\n const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n }\n if (!logger.isDaemon) process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp() {\n const help = formatHelp(this.commands, this.groups, this.docsDomain);\n // eslint-disable-next-line no-console\n console.log(help);\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yarnCommand = this.getYargsCommand(command);\n const builderFunc = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n yargs.command(subCommand);\n });\n // since the \"builder\" method is overridden, the global flags of the main command are gone, this fixes it.\n yargs.options(YargsAdapter.getGlobalOptions(command));\n return yargs;\n };\n yarnCommand.builder = builderFunc;\n yargs.command(yarnCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yarnCommand = new YargsAdapter(command);\n yarnCommand.builder = yarnCommand.builder.bind(yarnCommand);\n yarnCommand.handler = yarnCommand.handler.bind(yarnCommand);\n\n return yarnCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n *\n * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\n */\n private logCommandHelp(help: string) {\n const command = this.findCommandByArgv();\n\n const replacer = (_, p1, p2) => `${p1}${chalk.green(p2)}`;\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n const cmdLine = linesWithoutEmpty[0];\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((opt) => opt.replace(/(--)([\\w-]+)/, replacer).replace(/(-)([\\w-]+)/, replacer));\n const argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n // eslint-disable-next-line no-console\n console.log(finalOutput);\n }\n\n private findCommandByArgv(): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = this.commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command; // no sub-commands.\n }\n const subCommand = command.commands.find((cmd) => isCommandMatch(cmd, enteredSubCommand));\n return subCommand || command;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,SAAS,CAAC;EACrBC,WAAW,CACDC,QAAmB,EACnBC,MAAkB,EACnBC,MAAM,GAAGC,gBAAK,EACbC,UAAkB,EAC1B;IAAA,KAJQJ,QAAmB,GAAnBA,QAAmB;IAAA,KACnBC,MAAkB,GAAlBA,MAAkB;IAAA,KACnBC,MAAM,GAANA,MAAM;IAAA,KACLE,UAAkB,GAAlBA,UAAkB;EACzB;EAEH,MAAMC,KAAK,CAACC,IAAI,GAAGC,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE;IACxC,IAA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MACZ,OAAO4H,SAAS;IAClB;IACA,IAAI,CAAC5H,OAAO,CAACjB,QAAQ,IAAI,CAAC4I,iBAAiB,EAAE;MAC3C,OAAO3H,OAAO,CAAC,CAAC;IAClB;;IACA,MAAMiD,UAAU,GAAGjD,OAAO,CAACjB,QAAQ,CAACgJ,IAAI,CAAE/E,GAAG,IAAK6E,cAAc,CAAC7E,GAAG,EAAE2E,iBAAiB,CAAC,CAAC;IACzF,OAAO1E,UAAU,IAAIjD,OAAO;EAC9B;AACF;AAAC"}
@@ -4,26 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MainRuntime = exports.CLIAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const MainRuntime = new (_harmony().RuntimeDefinition)('main');
19
15
  exports.MainRuntime = MainRuntime;
20
-
21
16
  const CLIAspect = _harmony().Aspect.create({
22
17
  id: 'teambit.harmony/cli',
23
18
  dependencies: [],
24
19
  declareRuntime: MainRuntime
25
20
  });
26
-
27
21
  exports.CLIAspect = CLIAspect;
28
22
 
29
23
  //# sourceMappingURL=cli.aspect.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["MainRuntime","RuntimeDefinition","CLIAspect","Aspect","create","id","dependencies","declareRuntime"],"sources":["cli.aspect.ts"],"sourcesContent":["import { Aspect, RuntimeDefinition } from '@teambit/harmony';\n\nexport const MainRuntime = new RuntimeDefinition('main');\n\nexport const CLIAspect = Aspect.create({\n id: 'teambit.harmony/cli',\n dependencies: [],\n declareRuntime: MainRuntime,\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,WAAW,GAAG,KAAIC,4BAAJ,EAAsB,MAAtB,CAApB;;;AAEA,MAAMC,SAAS,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EACrCC,EAAE,EAAE,qBADiC;EAErCC,YAAY,EAAE,EAFuB;EAGrCC,cAAc,EAAEP;AAHqB,CAAd,CAAlB"}
1
+ {"version":3,"names":["MainRuntime","RuntimeDefinition","CLIAspect","Aspect","create","id","dependencies","declareRuntime"],"sources":["cli.aspect.ts"],"sourcesContent":["import { Aspect, RuntimeDefinition } from '@teambit/harmony';\n\nexport const MainRuntime = new RuntimeDefinition('main');\n\nexport const CLIAspect = Aspect.create({\n id: 'teambit.harmony/cli',\n dependencies: [],\n declareRuntime: MainRuntime,\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,WAAW,GAAG,KAAIC,4BAAiB,EAAC,MAAM,CAAC;AAAC;AAElD,MAAMC,SAAS,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACrCC,EAAE,EAAE,qBAAqB;EACzBC,YAAY,EAAE,EAAE;EAChBC,cAAc,EAAEP;AAClB,CAAC,CAAC;AAAC"}