mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-21 05:24:45 +00:00
.
This commit is contained in:
parent
beb1329f9f
commit
2b95e76931
7736 changed files with 1874747 additions and 51184 deletions
27
node_modules/prompts/dist/util/action.js
generated
vendored
Normal file
27
node_modules/prompts/dist/util/action.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = key => {
|
||||
if (key.ctrl) {
|
||||
if (key.name === 'a') return 'first';
|
||||
if (key.name === 'c') return 'abort';
|
||||
if (key.name === 'd') return 'abort';
|
||||
if (key.name === 'e') return 'last';
|
||||
if (key.name === 'g') return 'reset';
|
||||
}
|
||||
|
||||
if (key.name === 'return') return 'submit';
|
||||
if (key.name === 'enter') return 'submit'; // ctrl + J
|
||||
|
||||
if (key.name === 'backspace') return 'delete';
|
||||
if (key.name === 'delete') return 'deleteForward';
|
||||
if (key.name === 'abort') return 'abort';
|
||||
if (key.name === 'escape') return 'abort';
|
||||
if (key.name === 'tab') return 'next';
|
||||
if (key.name === 'pagedown') return 'nextPage';
|
||||
if (key.name === 'pageup') return 'prevPage';
|
||||
if (key.name === 'up') return 'up';
|
||||
if (key.name === 'down') return 'down';
|
||||
if (key.name === 'right') return 'right';
|
||||
if (key.name === 'left') return 'left';
|
||||
return false;
|
||||
};
|
40
node_modules/prompts/dist/util/clear.js
generated
vendored
Normal file
40
node_modules/prompts/dist/util/clear.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
const strip = require('./strip');
|
||||
|
||||
const _require = require('sisteransi'),
|
||||
erase = _require.erase,
|
||||
cursor = _require.cursor;
|
||||
|
||||
const width = str => [...strip(str)].length;
|
||||
|
||||
module.exports = function (prompt, perLine = process.stdout.columns) {
|
||||
if (!perLine) return erase.line + cursor.to(0);
|
||||
let rows = 0;
|
||||
const lines = prompt.split(/\r?\n/);
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
let line = _step.value;
|
||||
rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (erase.line + cursor.prevLine()).repeat(rows - 1) + erase.line + cursor.to(0);
|
||||
};
|
32
node_modules/prompts/dist/util/figures.js
generated
vendored
Normal file
32
node_modules/prompts/dist/util/figures.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
|
||||
const main = {
|
||||
arrowUp: '↑',
|
||||
arrowDown: '↓',
|
||||
arrowLeft: '←',
|
||||
arrowRight: '→',
|
||||
radioOn: '◉',
|
||||
radioOff: '◯',
|
||||
tick: '✔',
|
||||
cross: '✖',
|
||||
ellipsis: '…',
|
||||
pointerSmall: '›',
|
||||
line: '─',
|
||||
pointer: '❯'
|
||||
};
|
||||
const win = {
|
||||
arrowUp: main.arrowUp,
|
||||
arrowDown: main.arrowDown,
|
||||
arrowLeft: main.arrowLeft,
|
||||
arrowRight: main.arrowRight,
|
||||
radioOn: '(*)',
|
||||
radioOff: '( )',
|
||||
tick: '√',
|
||||
cross: '×',
|
||||
ellipsis: '...',
|
||||
pointerSmall: '»',
|
||||
line: '─',
|
||||
pointer: '>'
|
||||
};
|
||||
const figures = process.platform === 'win32' ? win : main;
|
||||
module.exports = figures;
|
9
node_modules/prompts/dist/util/index.js
generated
vendored
Normal file
9
node_modules/prompts/dist/util/index.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
action: require('./action'),
|
||||
clear: require('./clear'),
|
||||
style: require('./style'),
|
||||
strip: require('./strip'),
|
||||
figures: require('./figures')
|
||||
};
|
7
node_modules/prompts/dist/util/strip.js
generated
vendored
Normal file
7
node_modules/prompts/dist/util/strip.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = str => {
|
||||
const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'].join('|');
|
||||
const RGX = new RegExp(pattern, 'g');
|
||||
return typeof str === 'string' ? str.replace(RGX, '') : str;
|
||||
};
|
50
node_modules/prompts/dist/util/style.js
generated
vendored
Normal file
50
node_modules/prompts/dist/util/style.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
'use strict';
|
||||
|
||||
const c = require('kleur');
|
||||
|
||||
const figures = require('./figures'); // rendering user input.
|
||||
|
||||
|
||||
const styles = Object.freeze({
|
||||
password: {
|
||||
scale: 1,
|
||||
render: input => '*'.repeat(input.length)
|
||||
},
|
||||
emoji: {
|
||||
scale: 2,
|
||||
render: input => '😃'.repeat(input.length)
|
||||
},
|
||||
invisible: {
|
||||
scale: 0,
|
||||
render: input => ''
|
||||
},
|
||||
default: {
|
||||
scale: 1,
|
||||
render: input => `${input}`
|
||||
}
|
||||
});
|
||||
|
||||
const render = type => styles[type] || styles.default; // icon to signalize a prompt.
|
||||
|
||||
|
||||
const symbols = Object.freeze({
|
||||
aborted: c.red(figures.cross),
|
||||
done: c.green(figures.tick),
|
||||
default: c.cyan('?')
|
||||
});
|
||||
|
||||
const symbol = (done, aborted) => aborted ? symbols.aborted : done ? symbols.done : symbols.default; // between the question and the user's input.
|
||||
|
||||
|
||||
const delimiter = completing => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
|
||||
|
||||
const item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : '+' : figures.line);
|
||||
|
||||
module.exports = {
|
||||
styles,
|
||||
render,
|
||||
symbols,
|
||||
symbol,
|
||||
delimiter,
|
||||
item
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue