Dia antes primera install

This commit is contained in:
2025-12-08 15:20:28 -06:00
commit 1416478c9c
4130 changed files with 886376 additions and 0 deletions

21
node_modules/command-line-usage/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015-18 Lloyd Brookes <75pound@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

264
node_modules/command-line-usage/README.md generated vendored Normal file
View File

@@ -0,0 +1,264 @@
[![view on npm](http://img.shields.io/npm/v/command-line-usage.svg)](https://www.npmjs.org/package/command-line-usage)
[![npm module downloads](http://img.shields.io/npm/dt/command-line-usage.svg)](https://www.npmjs.org/package/command-line-usage)
[![Build Status](https://travis-ci.org/75lb/command-line-usage.svg?branch=master)](https://travis-ci.org/75lb/command-line-usage)
[![Dependency Status](https://david-dm.org/75lb/command-line-usage.svg)](https://david-dm.org/75lb/command-line-usage)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
# command-line-usage
A simple, data-driven module for creating a usage guide.
## Synopsis
A usage guide is created by first defining an arbitrary number of sections, e.g. a description section, synopsis, option list, examples, footer etc. Each section has an optional header and some content. Each section must be of type <code><a href="#commandlineusagecontent">content</a></code> or <code><a href="#commandlineusageoptionlist">optionList</a></code>.
This section data is passed to <code><a href="#commandlineusagesections--string-">commandLineUsage()</a></code> which renders the usage guide.
Inline ansi formatting can be used anywhere within section content using the formatting syntax described [here](https://github.com/75lb/ansi-escape-sequences#module_ansi-escape-sequences.format).
For example, this script:
```js
const getUsage = require('command-line-usage')
const sections = [
{
header: 'A typical app',
content: 'Generates something [italic]{very} important.'
},
{
header: 'Options',
optionList: [
{
name: 'input',
typeLabel: '[underline]{file}',
description: 'The input to process.'
},
{
name: 'help',
description: 'Print this usage guide.'
}
]
}
]
const usage = getUsage(sections)
console.log(usage)
```
Outputs this guide:
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/synopsis.png)
## More examples
### Simple
A fairly typical usage guide with three sections - description, option list and footer. [Code](https://github.com/75lb/command-line-usage/blob/master/example/simple.js).
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/simple.png)
### Option List groups
Demonstrates breaking the option list up into groups. [Code](https://github.com/75lb/command-line-usage/blob/master/example/groups.js).
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/groups.png)
### Banners
A banner is created by adding the `raw: true` property to your `content`. This flag disables any formatting on the content, displaying it raw as supplied.
#### Header
Demonstrates a banner at the top. This example also adds a `synopsis` section. [Code](https://github.com/75lb/command-line-usage/blob/master/example/header.js).
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/header.png)
#### Footer
Demonstrates a footer banner. [Code](https://github.com/75lb/command-line-usage/blob/master/example/footer.js).
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/footer.png)
### Examples section (table layout)
An examples section is added. To achieve this table layout, supply the `content` as an array of objects. The property names of each object are not important, so long as they are consistent throughout the array. [Code](https://github.com/75lb/command-line-usage/blob/master/example/examples.js).
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/example-columns.png)
### Command list
Useful if your app is [command-driven](https://github.com/75lb/command-line-commands), like git or npm. [Code](https://github.com/75lb/command-line-usage/blob/master/example/command-list.js).
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/command-list.png)
### Description section (table layout)
Demonstrates supplying specific [table layout](https://github.com/75lb/table-layout) options to achieve more advanced layout. In this case the second column (containing the hammer and sickle) has a fixed `width` of 40 and `noWrap` enabled (as the input is already formatted as desired). [Code](https://github.com/75lb/command-line-usage/blob/master/example/description-columns.js).
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/description-columns.png)
### Whitespace
By default, whitespace from the beginning of each line is trimmed to ensure wrapped text always aligns neatly to the left edge of the column. This can be undesirable when whitespace is intentional like the indented bullet points shown in this example. The two ways to disable whitespace trimming are shown in [this example code](https://github.com/75lb/command-line-usage/blob/master/example/whitespace.js).
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/whitespace.png)
### Real-life
The [polymer-cli](https://github.com/Polymer/polymer-cli/) usage guide is a good real-life example.
![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/polymer.png)
## API Reference
* [command-line-usage](#module_command-line-usage)
* [commandLineUsage(sections)](#exp_module_command-line-usage--commandLineUsage) ⇒ <code>string</code>
* [~content](#module_command-line-usage--commandLineUsage..content)
* [~optionList](#module_command-line-usage--commandLineUsage..optionList)
<a name="exp_module_command-line-usage--commandLineUsage"></a>
### commandLineUsage(sections) ⇒ <code>string</code> ⏏
Generates a usage guide suitable for a command-line app.
**Kind**: Exported function
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>sections</td><td><code>Section</code> | <code>Array.&lt;Section&gt;</code></td><td><p>One of more section objects (<a href="#module_command-line-usage--commandLineUsage..content">content</a> or <a href="#module_command-line-usage--commandLineUsage..optionList">optionList</a>).</p>
</td>
</tr> </tbody>
</table>
<a name="module_command-line-usage--commandLineUsage..content"></a>
#### commandLineUsage~content
A Content section comprises a header and one or more lines of content.
**Kind**: inner typedef of [<code>commandLineUsage</code>](#exp_module_command-line-usage--commandLineUsage)
**Properties**
<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>header</td><td><code>string</code></td><td><p>The section header, always bold and underlined.</p>
</td>
</tr><tr>
<td>content</td><td><code>string</code> | <code>Array.&lt;string&gt;</code> | <code>Array.&lt;object&gt;</code></td><td><p>Overloaded property, accepting data in one of four formats:</p>
<ol>
<li>A single string (one line of text)</li>
<li>An array of strings (multiple lines of text)</li>
<li>An array of objects (recordset-style data). In this case, the data will be rendered in table format. The property names of each object are not important, so long as they are consistent throughout the array.</li>
<li>An object with two properties - <code>data</code> and <code>options</code>. In this case, the data and options will be passed directly to the underlying <a href="https://github.com/75lb/table-layout">table layout</a> module for rendering.</li>
</ol>
</td>
</tr><tr>
<td>raw</td><td><code>boolean</code></td><td><p>Set to true to avoid indentation and wrapping. Useful for banners.</p>
</td>
</tr> </tbody>
</table>
**Example**
Simple string of content. The syntax for ansi formatting is documented [here](https://github.com/75lb/ansi-escape-sequences#module_ansi-escape-sequences.format).
```js
{
header: 'A typical app',
content: 'Generates something [italic]{very} important.'
}
```
An array of strings is interpreted as lines, to be joined by the system newline character.
```js
{
header: 'A typical app',
content: [
'First line.',
'Second line.'
]
}
```
An array of recordset-style objects are rendered in table layout.
```js
{
header: 'A typical app',
content: [
{ colA: 'First row, first column.', colB: 'First row, second column.'},
{ colA: 'Second row, first column.', colB: 'Second row, second column.'}
]
}
```
An object with `data` and `options` properties will be passed directly to the underlying [table layout](https://github.com/75lb/table-layout) module for rendering.
```js
{
header: 'A typical app',
content: {
data: [
{ colA: 'First row, first column.', colB: 'First row, second column.'},
{ colA: 'Second row, first column.', colB: 'Second row, second column.'}
],
options: {
maxWidth: 60
}
}
}
```
<a name="module_command-line-usage--commandLineUsage..optionList"></a>
#### commandLineUsage~optionList
A OptionList section adds a table displaying details of the available options.
**Kind**: inner typedef of [<code>commandLineUsage</code>](#exp_module_command-line-usage--commandLineUsage)
**Properties**
<table>
<thead>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>header</td><td><code>string</code></td><td><p>The section header, always bold and underlined.</p>
</td>
</tr><tr>
<td>optionList</td><td><code>Array.&lt;OptionDefinition&gt;</code></td><td><p>an array of <a href="https://github.com/75lb/command-line-args#optiondefinition-">option definition</a> objects. In addition to the regular definition properties, command-line-usage will look for:</p>
<ul>
<li><code>description</code> - a string describing the option.</li>
<li><code>typeLabel</code> - a string to replace the default type string (e.g. <code>&lt;string&gt;</code>). It&#39;s often more useful to set a more descriptive type label, like <code>&lt;ms&gt;</code>, <code>&lt;files&gt;</code>, <code>&lt;command&gt;</code> etc.</li>
</ul>
</td>
</tr><tr>
<td>group</td><td><code>string</code> | <code>Array.&lt;string&gt;</code></td><td><p>If specified, only options from this particular group will be printed. <a href="https://github.com/75lb/command-line-usage/blob/master/example/groups.js">Example</a>.</p>
</td>
</tr><tr>
<td>hide</td><td><code>string</code> | <code>Array.&lt;string&gt;</code></td><td><p>The names of one of more option definitions to hide from the option list. <a href="https://github.com/75lb/command-line-usage/blob/master/example/hide.js">Example</a>.</p>
</td>
</tr><tr>
<td>reverseNameOrder</td><td><code>boolean</code></td><td><p>If true, the option alias will be displayed after the name, i.e. <code>--verbose, -v</code> instead of <code>-v, --verbose</code>).</p>
</td>
</tr> </tbody>
</table>
**Example**
```js
{
header: 'Options',
optionList: [
{
name: 'help', alias: 'h', description: 'Display this usage guide.'
},
{
name: 'src', description: 'The input files to process',
multiple: true, defaultOption: true, typeLabel: '[underline]{file} ...'
},
{
name: 'timeout', description: 'Timeout value in ms. This description is needlessly long unless you count testing of the description column maxWidth useful.',
alias: 't', typeLabel: '[underline]{ms}'
}
]
}
```
* * *
&copy; 2015-18 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).

View File

@@ -0,0 +1,120 @@
'use strict'
const OptionList = require('./option-list')
const ContentSection = require('./content-section')
const arrayify = require('array-back')
/**
* @module command-line-usage
*/
module.exports = commandLineUsage
/**
* Generates a usage guide suitable for a command-line app.
* @param {Section|Section[]} - One of more section objects ({@link module:command-line-usage~content} or {@link module:command-line-usage~optionList}).
* @returns {string}
* @alias module:command-line-usage
*/
function commandLineUsage (sections) {
sections = arrayify(sections)
if (sections.length) {
const output = sections.map(section => {
if (section.optionList) {
return new OptionList(section)
} else {
return new ContentSection(section)
}
})
return '\n' + output.join('\n')
}
}
/**
* A Content section comprises a header and one or more lines of content.
* @typedef content
* @property header {string} - The section header, always bold and underlined.
* @property content {string|string[]|object[]} - Overloaded property, accepting data in one of four formats:
*
* 1. A single string (one line of text)
* 2. An array of strings (multiple lines of text)
* 3. An array of objects (recordset-style data). In this case, the data will be rendered in table format. The property names of each object are not important, so long as they are consistent throughout the array.
* 4. An object with two properties - `data` and `options`. In this case, the data and options will be passed directly to the underlying [table layout](https://github.com/75lb/table-layout) module for rendering.
*
* @property raw {boolean} - Set to true to avoid indentation and wrapping. Useful for banners.
* @example
* Simple string of content. The syntax for ansi formatting is documented [here](https://github.com/75lb/ansi-escape-sequences#module_ansi-escape-sequences.format).
* ```js
* {
* header: 'A typical app',
* content: 'Generates something [italic]{very} important.'
* }
* ```
*
* An array of strings is interpreted as lines, to be joined by the system newline character.
* ```js
* {
* header: 'A typical app',
* content: [
* 'First line.',
* 'Second line.'
* ]
* }
* ```
*
* An array of recordset-style objects are rendered in table layout.
* ```js
* {
* header: 'A typical app',
* content: [
* { colA: 'First row, first column.', colB: 'First row, second column.'},
* { colA: 'Second row, first column.', colB: 'Second row, second column.'}
* ]
* }
* ```
*
* An object with `data` and `options` properties will be passed directly to the underlying [table layout](https://github.com/75lb/table-layout) module for rendering.
* ```js
* {
* header: 'A typical app',
* content: {
* data: [
* { colA: 'First row, first column.', colB: 'First row, second column.'},
* { colA: 'Second row, first column.', colB: 'Second row, second column.'}
* ],
* options: {
* maxWidth: 60
* }
* }
* }
* ```
*/
/**
* A OptionList section adds a table displaying details of the available options.
* @typedef optionList
* @property {string} [header] - The section header, always bold and underlined.
* @property optionList {OptionDefinition[]} - an array of [option definition](https://github.com/75lb/command-line-args#optiondefinition-) objects. In addition to the regular definition properties, command-line-usage will look for:
*
* - `description` - a string describing the option.
* - `typeLabel` - a string to replace the default type string (e.g. `<string>`). It's often more useful to set a more descriptive type label, like `<ms>`, `<files>`, `<command>` etc.
* @property {string|string[]} [group] - If specified, only options from this particular group will be printed. [Example](https://github.com/75lb/command-line-usage/blob/master/example/groups.js).
* @property {string|string[]} [hide] - The names of one of more option definitions to hide from the option list. [Example](https://github.com/75lb/command-line-usage/blob/master/example/hide.js).
* @property {boolean} [reverseNameOrder] - If true, the option alias will be displayed after the name, i.e. `--verbose, -v` instead of `-v, --verbose`).
*
* @example
* {
* header: 'Options',
* optionList: [
* {
* name: 'help', alias: 'h', description: 'Display this usage guide.'
* },
* {
* name: 'src', description: 'The input files to process',
* multiple: true, defaultOption: true, typeLabel: '[underline]{file} ...'
* },
* {
* name: 'timeout', description: 'Timeout value in ms. This description is needlessly long unless you count testing of the description column maxWidth useful.',
* alias: 't', typeLabel: '[underline]{ms}'
* }
* ]
* }
*/

24
node_modules/command-line-usage/lib/content-section.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
'use strict'
const Section = require('./section')
const Content = require('./content')
class ContentSection extends Section {
constructor (section) {
super()
this.header(section.header)
if (section.content) {
/* add content without indentation or wrapping */
if (section.raw) {
this.add(section.content)
} else {
const content = new Content(section.content)
this.add(content.lines())
}
this.emptyLine()
}
}
}
module.exports = ContentSection

81
node_modules/command-line-usage/lib/content.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
'use strict'
const Table = require('table-layout')
const ansi = require('ansi-escape-sequences')
const t = require('typical')
class Content {
constructor (content) {
this._content = content
}
lines () {
const content = this._content
const defaultPadding = { left: ' ', right: ' ' }
if (content) {
/* string content */
if (t.isString(content)) {
const table = new Table({ column: ansi.format(content) }, {
padding: defaultPadding,
maxWidth: 80
})
return table.renderLines()
/* array of strings */
} else if (Array.isArray(content) && content.every(t.isString)) {
const rows = content.map(string => ({ column: ansi.format(string) }))
const table = new Table(rows, {
padding: defaultPadding,
maxWidth: 80
})
return table.renderLines()
/* array of objects (use table-layout) */
} else if (Array.isArray(content) && content.every(t.isPlainObject)) {
const table = new Table(content.map(row => ansiFormatRow(row)), {
padding: defaultPadding
})
return table.renderLines()
/* { options: object, data: object[] } */
} else if (t.isPlainObject(content)) {
if (!content.options || !content.data) {
throw new Error('must have an "options" or "data" property\n' + JSON.stringify(content))
}
const options = Object.assign(
{ padding: defaultPadding },
content.options
)
/* convert nowrap to noWrap to avoid breaking compatibility */
if (options.columns) {
options.columns = options.columns.map(column => {
if (column.nowrap) {
column.noWrap = column.nowrap
delete column.nowrap
}
return column
})
}
const table = new Table(
content.data.map(row => ansiFormatRow(row)),
options
)
return table.renderLines()
} else {
const message = `invalid input - 'content' must be a string, array of strings, or array of plain objects:\n\n${JSON.stringify(content)}`
throw new Error(message)
}
}
}
}
function ansiFormatRow (row) {
for (const key in row) {
row[key] = ansi.format(row[key])
}
return row
}
module.exports = Content

81
node_modules/command-line-usage/lib/option-list.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
'use strict'
const Section = require('./section')
const Table = require('table-layout')
const ansi = require('ansi-escape-sequences')
const t = require('typical')
const arrayify = require('array-back')
class OptionList extends Section {
constructor (data) {
super()
let definitions = arrayify(data.optionList)
const hide = arrayify(data.hide)
const groups = arrayify(data.group)
/* filter out hidden definitions */
if (hide.length) {
definitions = definitions.filter(definition => {
return hide.indexOf(definition.name) === -1
})
}
if (data.header) this.header(data.header)
if (groups.length) {
definitions = definitions.filter(def => {
const noGroupMatch = groups.indexOf('_none') > -1 && !t.isDefined(def.group)
const groupMatch = intersect(arrayify(def.group), groups)
if (noGroupMatch || groupMatch) return def
})
}
const rows = definitions.map(def => {
return {
option: getOptionNames(def, 'bold', data.reverseNameOrder),
description: ansi.format(def.description)
}
})
const table = new Table(rows, {
padding: { left: ' ', right: ' ' },
columns: [
{ name: 'option', noWrap: true },
{ name: 'description', maxWidth: 80 }
]
})
this.add(table.renderLines())
this.emptyLine()
}
}
function getOptionNames (definition, optionNameStyles, reverseNameOrder) {
let type = definition.type ? definition.type.name.toLowerCase() : ''
const multiple = definition.multiple ? '[]' : ''
if (type) {
type = type === 'boolean' ? '' : `[underline]{${type}${multiple}}`
}
type = ansi.format(definition.typeLabel || type)
let result = ''
if (definition.alias) {
if (reverseNameOrder) {
result = `${ansi.format(`--${definition.name}`, optionNameStyles)}, ${ansi.format('-' + definition.alias, optionNameStyles)} ${type}`
} else {
result = `${ansi.format('-' + definition.alias, optionNameStyles)}, ${ansi.format(`--${definition.name} ${type}`, optionNameStyles)}`
}
} else {
result = `${ansi.format(`--${definition.name}`, optionNameStyles)} ${type}`
}
return result
}
function intersect (arr1, arr2) {
return arr1.some(function (item1) {
return arr2.some(function (item2) {
return item1 === item2
})
})
}
module.exports = OptionList

27
node_modules/command-line-usage/lib/section.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
'use strict'
const ansi = require('ansi-escape-sequences')
const os = require('os')
const arrayify = require('array-back')
class Section {
constructor () {
this.list = []
}
add (content) {
arrayify(content).forEach(line => this.list.push(ansi.format(line)))
}
emptyLine () {
this.list.push('')
}
header (text) {
if (text) {
this.add(ansi.format(text, [ 'underline', 'bold' ]))
this.emptyLine()
}
}
toString () {
return this.list.join(os.EOL)
}
}
module.exports = Section

35
node_modules/command-line-usage/package.json generated vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "command-line-usage",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "4.1.0",
"description": "Generates command-line usage information",
"repository": "https://github.com/75lb/command-line-usage.git",
"license": "MIT",
"main": "lib/command-line-usage",
"files": [
"lib"
],
"keywords": [
"terminal",
"command line",
"usage",
"generator"
],
"engines": {
"node": ">=4.0.0"
},
"scripts": {
"docs": "jsdoc2md -t jsdoc2md/README.hbs --no-gfm lib/*.js > README.md; echo",
"test": "test-runner test/*.js"
},
"dependencies": {
"ansi-escape-sequences": "^4.0.0",
"array-back": "^2.0.0",
"table-layout": "^0.4.2",
"typical": "^2.6.1"
},
"devDependencies": {
"jsdoc-to-markdown": "^3.0.4",
"test-runner": "^0.5.0"
}
}