Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
e32b25845e | |||
99dc9d3e93 | |||
95e3feed97 | |||
34abfbc007 | |||
e994c5a865 | |||
|
8b7ee59113 | ||
9887a6f445 | |||
|
8cbb6dcc01 | ||
|
85cf64980c | ||
|
ff01dbbf3d | ||
a8129d8a8c |
14
.env
@@ -1,3 +1,11 @@
|
|||||||
MYSQL_ROOT_PASSWORD=changeme
|
# Root password
|
||||||
MYSQL_USER=radar
|
DATABASE_ROOT_PASSWORD=changeme # NEED TO CHANGE !
|
||||||
MYSQL_PASSWORD=changeme
|
|
||||||
|
# User to use
|
||||||
|
DATABASE_USER=radar
|
||||||
|
|
||||||
|
# User password
|
||||||
|
DATABASE_PASSWORD=changeme # NEED TO CHANGE !
|
||||||
|
|
||||||
|
# Database name
|
||||||
|
DATABASE=rappaurio
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 Jordan Harband
|
Copyright (c) 2023 Dario Weinberger & Raphael Payet
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
40
README.md
@@ -49,9 +49,43 @@ Installation Guides:
|
|||||||
Configure logins and passwords in the ".env" located in the root of the project (PLEASE USE STRONG PASSWORDS):
|
Configure logins and passwords in the ".env" located in the root of the project (PLEASE USE STRONG PASSWORDS):
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
MYSQL_ROOT_PASSWORD=changeme
|
# Root password
|
||||||
MYSQL_USER=radar
|
DATABASE_ROOT_PASSWORD=changeme # NEED TO CHANGE !
|
||||||
MYSQL_PASSWORD=changeme
|
|
||||||
|
# User to use
|
||||||
|
DATABASE_USER=radar
|
||||||
|
|
||||||
|
# User password
|
||||||
|
DATABASE_PASSWORD=changeme # NEED TO CHANGE !
|
||||||
|
|
||||||
|
# Database name
|
||||||
|
DATABASE=rappaurio
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
And do the same for the ".env" inside the "app-rappaurio" folder :
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# Root password
|
||||||
|
DATABASE_ROOT_PASSWORD=changeme # NEED TO CHANGE !
|
||||||
|
|
||||||
|
# MariaDB hostname
|
||||||
|
DATABASE_HOST=db
|
||||||
|
|
||||||
|
# User to use
|
||||||
|
DATABASE_USER=radar
|
||||||
|
|
||||||
|
# User password
|
||||||
|
DATABASE_PASSWORD=changeme # NEED TO CHANGE !
|
||||||
|
|
||||||
|
# Database name
|
||||||
|
DATABASE=rappaurio
|
||||||
|
|
||||||
|
# Token private Key
|
||||||
|
JWT_SECRET=hsdgbniojksdgoijosidgjoisdg # NEED TO CHANGE !
|
||||||
|
|
||||||
|
JWT_EXPIRES_IN=86400000
|
||||||
|
JWT_COOKIE_EXPIRES_IN=86400000
|
||||||
```
|
```
|
||||||
|
|
||||||
Building images using docker-compose.yml:
|
Building images using docker-compose.yml:
|
||||||
|
20
app-rappaurio/.env
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Root password
|
||||||
|
DATABASE_ROOT_PASSWORD=changeme # NEED TO CHANGE !
|
||||||
|
|
||||||
|
# MariaDB hostname
|
||||||
|
DATABASE_HOST=db
|
||||||
|
|
||||||
|
# User to use
|
||||||
|
DATABASE_USER=radar
|
||||||
|
|
||||||
|
# User password
|
||||||
|
DATABASE_PASSWORD=changeme # NEED TO CHANGE !
|
||||||
|
|
||||||
|
# Database name
|
||||||
|
DATABASE=rappaurio
|
||||||
|
|
||||||
|
# Token private Key
|
||||||
|
JWT_SECRET=hsdgbniojksdgoijosidgjoisdg # NEED TO CHANGE !
|
||||||
|
|
||||||
|
JWT_EXPIRES_IN=86400000
|
||||||
|
JWT_COOKIE_EXPIRES_IN=86400000
|
@@ -17,4 +17,4 @@ COPY . .
|
|||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
# the command that starts our app
|
# the command that starts our app
|
||||||
CMD ["node", "index.js"]
|
CMD ["npm", "start"]
|
63
app-rappaurio/app.js
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
var createError = require('http-errors');
|
||||||
|
var express = require('express');
|
||||||
|
var path = require('path');
|
||||||
|
var cookieParser = require('cookie-parser');
|
||||||
|
var logger = require('morgan');
|
||||||
|
const mysql = require('mysql');
|
||||||
|
const dotenv = require('dotenv');
|
||||||
|
|
||||||
|
var app = express();
|
||||||
|
|
||||||
|
dotenv.config({ path : './.env'})
|
||||||
|
|
||||||
|
// Create database connection
|
||||||
|
const db = mysql.createConnection({
|
||||||
|
host: process.env.DATABASE_HOST,
|
||||||
|
user: process.env.DATABASE_USER,
|
||||||
|
password: process.env.DATABASE_PASSWORD,
|
||||||
|
database: process.env.DATABASE
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Connecting our databse and checking everything works fine
|
||||||
|
db.connect( (error)=>{
|
||||||
|
if(error){
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
console.log("MySQL database connected...")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// view engine setup
|
||||||
|
app.set('views', path.join(__dirname, 'views'));
|
||||||
|
app.set('view engine', 'hbs');
|
||||||
|
|
||||||
|
app.use(logger('dev'));
|
||||||
|
app.use(express.json());
|
||||||
|
app.use(express.urlencoded({ extended: false }));
|
||||||
|
app.use(cookieParser());
|
||||||
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
||||||
|
// Define Routes
|
||||||
|
app.use('/', require('./server/routes/index'));
|
||||||
|
app.use('/auth', require('./server/routes/auth'));
|
||||||
|
|
||||||
|
|
||||||
|
// catch 404 and forward to error handler
|
||||||
|
app.use(function(req, res, next) {
|
||||||
|
next(createError(404));
|
||||||
|
});
|
||||||
|
|
||||||
|
// error handler
|
||||||
|
app.use(function(err, req, res, next) {
|
||||||
|
// set locals, only providing error in development
|
||||||
|
res.locals.message = err.message;
|
||||||
|
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
||||||
|
|
||||||
|
// render the error page
|
||||||
|
res.status(err.status || 500);
|
||||||
|
res.render('contains/404');
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = app;
|
91
app-rappaurio/bin/www
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var app = require('../app');
|
||||||
|
var debug = require('debug')('app-rappaurio:server');
|
||||||
|
var http = require('http');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get port from environment and store in Express.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var port = normalizePort(process.env.PORT || '5000');
|
||||||
|
app.set('port', port);
|
||||||
|
console.log("Server started on port : " + port);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create HTTP server.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var server = http.createServer(app);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen on provided port, on all network interfaces.
|
||||||
|
*/
|
||||||
|
|
||||||
|
server.listen(port);
|
||||||
|
server.on('error', onError);
|
||||||
|
server.on('listening', onListening);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a port into a number, string, or false.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function normalizePort(val) {
|
||||||
|
var port = parseInt(val, 10);
|
||||||
|
|
||||||
|
if (isNaN(port)) {
|
||||||
|
// named pipe
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (port >= 0) {
|
||||||
|
// port number
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event listener for HTTP server "error" event.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onError(error) {
|
||||||
|
if (error.syscall !== 'listen') {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bind = typeof port === 'string'
|
||||||
|
? 'Pipe ' + port
|
||||||
|
: 'Port ' + port;
|
||||||
|
|
||||||
|
// handle specific listen errors with friendly messages
|
||||||
|
switch (error.code) {
|
||||||
|
case 'EACCES':
|
||||||
|
console.error(bind + ' requires elevated privileges');
|
||||||
|
process.exit(1);
|
||||||
|
break;
|
||||||
|
case 'EADDRINUSE':
|
||||||
|
console.error(bind + ' is already in use');
|
||||||
|
process.exit(1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event listener for HTTP server "listening" event.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onListening() {
|
||||||
|
var addr = server.address();
|
||||||
|
var bind = typeof addr === 'string'
|
||||||
|
? 'pipe ' + addr
|
||||||
|
: 'port ' + addr.port;
|
||||||
|
debug('Listening on ' + bind);
|
||||||
|
}
|
1292
app-rappaurio/package-lock.json
generated
Normal file
26
app-rappaurio/package.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "app-rappaurio",
|
||||||
|
"version": "1.2.0",
|
||||||
|
"description": "Require nodejs 14 or higher",
|
||||||
|
"main": "app.js",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"start": "node ./bin/www"
|
||||||
|
},
|
||||||
|
"author": "Dario WEINBERGER & Raphael PAYET",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.5.1",
|
||||||
|
"bcryptjs": "^2.4.3",
|
||||||
|
"cookie-parser": "~1.4.4",
|
||||||
|
"debug": "~2.6.9",
|
||||||
|
"dotenv": "^16.3.1",
|
||||||
|
"express": "^4.18.2",
|
||||||
|
"hbs": "^4.2.0",
|
||||||
|
"http-errors": "~1.6.3",
|
||||||
|
"jsonwebtoken": "^9.0.2",
|
||||||
|
"morgan": "~1.9.1",
|
||||||
|
"mysql": "^2.18.1",
|
||||||
|
"wikiapi": "^1.19.4"
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 265 KiB After Width: | Height: | Size: 265 KiB |
Before Width: | Height: | Size: 265 KiB After Width: | Height: | Size: 265 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
368
app-rappaurio/public/js/custom.js
Normal file
@@ -0,0 +1,368 @@
|
|||||||
|
|
||||||
|
// === SCROLL MENU ===
|
||||||
|
const pageLink = document.querySelectorAll('.menu-scroll');
|
||||||
|
|
||||||
|
pageLink.forEach((elem) => {
|
||||||
|
elem.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
document.querySelector(elem.getAttribute('href')).scrollIntoView({
|
||||||
|
behavior: 'smooth',
|
||||||
|
offsetTop: 1 - 60,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// section menu active
|
||||||
|
function onScroll(event) {
|
||||||
|
const sections = document.querySelectorAll('.menu-scroll');
|
||||||
|
const scrollPos = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
|
|
||||||
|
for (let i = 0; i < sections.length; i++) {
|
||||||
|
const currLink = sections[i];
|
||||||
|
const val = currLink.getAttribute('href');
|
||||||
|
const refElement = document.querySelector(val);
|
||||||
|
const scrollTopMinus = scrollPos + 73;
|
||||||
|
if (refElement.offsetTop <= scrollTopMinus && refElement.offsetTop + refElement.offsetHeight > scrollTopMinus) {
|
||||||
|
document.querySelector('.menu-scroll').classList.remove('active');
|
||||||
|
currLink.classList.add('active');
|
||||||
|
} else {
|
||||||
|
currLink.classList.remove('active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.document.addEventListener('scroll', onScroll);
|
||||||
|
|
||||||
|
// === FOOTER DYNAMIC ===
|
||||||
|
|
||||||
|
// Sélectionnez le footer par son ID
|
||||||
|
const footer = document.getElementById('leFooter');
|
||||||
|
|
||||||
|
// Fonction pour positionner le footer en bas de la page
|
||||||
|
function positionFooter() {
|
||||||
|
const windowHeight = window.innerHeight;
|
||||||
|
const bodyHeight = document.body.clientHeight;
|
||||||
|
const footerHeight = footer.clientHeight;
|
||||||
|
|
||||||
|
if (bodyHeight < windowHeight) {
|
||||||
|
footer.style.position = 'absolute';
|
||||||
|
footer.style.bottom = '0';
|
||||||
|
} else {
|
||||||
|
footer.style.position = 'static';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Appelez la fonction lors du chargement de la page et lorsque la fenêtre est redimensionnée
|
||||||
|
window.addEventListener('load', positionFooter);
|
||||||
|
window.addEventListener('resize', positionFooter);
|
||||||
|
|
||||||
|
|
||||||
|
// === MODE SOMBRE +> LOCAL STORAGE ===
|
||||||
|
|
||||||
|
// Fonction pour lire la valeur du thème depuis localStorage
|
||||||
|
function getThemeLocalStorage() {
|
||||||
|
return localStorage.getItem('theme');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fonction pour définir le thème dans localStorage
|
||||||
|
function setThemeLocalStorage(theme) {
|
||||||
|
localStorage.setItem('theme', theme);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fonction pour mettre à jour la classe sur le <html> en fonction du thème
|
||||||
|
function updateThemeClass() {
|
||||||
|
const darkTogglerCheckbox = document.querySelector('#darkToggler');
|
||||||
|
const html = document.querySelector('html');
|
||||||
|
const theme = getThemeLocalStorage();
|
||||||
|
|
||||||
|
// Appliquer la classe en fonction de la valeur de localStorage
|
||||||
|
if (theme === 'dark') {
|
||||||
|
darkTogglerCheckbox.checked = true;
|
||||||
|
html.classList.add('dark');
|
||||||
|
} else {
|
||||||
|
darkTogglerCheckbox.checked = false;
|
||||||
|
html.classList.remove('dark');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Appeler la fonction d'initialisation de la gestion du thème
|
||||||
|
updateThemeClass();
|
||||||
|
|
||||||
|
// Gérer le changement de thème lorsque l'utilisateur clique sur la case à cocher
|
||||||
|
const darkTogglerCheckbox = document.querySelector('#darkToggler');
|
||||||
|
darkTogglerCheckbox.addEventListener('click', function () {
|
||||||
|
if (darkTogglerCheckbox.checked) {
|
||||||
|
setThemeLocalStorage('dark');
|
||||||
|
} else {
|
||||||
|
setThemeLocalStorage('light');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// === ENVOIE FORMULAIRE AVEC AJAX ===
|
||||||
|
|
||||||
|
// Attendre que le document soit prêt
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
// Sélectionnez le formulaire de COMPARAISON par son ID
|
||||||
|
$('#formulaire-comp').submit(function (e) {
|
||||||
|
|
||||||
|
// Fait scroll une fois le formulaire envoyé
|
||||||
|
$(document).ready(function () {
|
||||||
|
// Sélectionnez le lien par son ID
|
||||||
|
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: $('#resultat').offset().top
|
||||||
|
}, 1000); // 1000 millisecondes (1 seconde) pour l'animation
|
||||||
|
});
|
||||||
|
|
||||||
|
// Empêchez la soumission normale du formulaire
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Affiche le chargement
|
||||||
|
$('#loading').removeClass('hidden');
|
||||||
|
|
||||||
|
$('#articleIntrouvable').addClass('hidden');
|
||||||
|
$('#articleContainer1').addClass('hidden');
|
||||||
|
$('#articleContainer2').addClass('hidden');
|
||||||
|
|
||||||
|
// Reste du code pour gérer la soumission du formulaire
|
||||||
|
//console.log('Formulaire soumis !');
|
||||||
|
|
||||||
|
// Récupérez les valeurs des champs du formulaire
|
||||||
|
const articleTitle1 = $('#articleTitle1').val();
|
||||||
|
const articleTitle2 = $('#articleTitle2').val();
|
||||||
|
|
||||||
|
// Créez un objet JavaScript avec les données à envoyer au serveur
|
||||||
|
const formData = {
|
||||||
|
articleTitle1: articleTitle1,
|
||||||
|
articleTitle2: articleTitle2
|
||||||
|
};
|
||||||
|
|
||||||
|
// Utilisez AJAX pour envoyer les données au serveur
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/search',
|
||||||
|
data: formData,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (response) {
|
||||||
|
console.log(response);
|
||||||
|
|
||||||
|
$('#loading').addClass('hidden');
|
||||||
|
$('#articleIntrouvable').removeClass('hidden');
|
||||||
|
|
||||||
|
// Mettez à jour la section HTML avec les données reçues ici
|
||||||
|
|
||||||
|
// Vérifiez si response.articleInfo1 existe et contient les informations nécessaires
|
||||||
|
if (response.articleInfo1) {
|
||||||
|
$('#articleInfo1Title').html(response.articleInfo1.title);
|
||||||
|
|
||||||
|
// Article 1
|
||||||
|
$('#articleInfo1Title').html(response.articleInfo1.title);
|
||||||
|
$('#articleInfo1url').attr('href', response.articleInfo1.url);
|
||||||
|
$('#articleInfo1extract').html(response.articleInfo1.extract);
|
||||||
|
$('#articleInfo1lastEdit').html(response.articleInfo1.lastEdit);
|
||||||
|
$('#articleInfo1numRevisions').html(response.articleInfo1.numRevisions);
|
||||||
|
$('#articleInfo1pageSize').html(response.articleInfo1.pageSize);
|
||||||
|
$('#articleInfo1firstRevisionUser').html(response.articleInfo1.firstRevisionUser);
|
||||||
|
$('#articleInfo1latestRevisionId').html(response.articleInfo1.latestRevisionId);
|
||||||
|
$('#articleInfo1pageId').html(response.articleInfo1.pageId);
|
||||||
|
$('#articleInfo1latestVersion').html(response.articleInfo1.latestVersion);
|
||||||
|
$('#articleInfo1wordCount').html(response.articleInfo1.wordCount);
|
||||||
|
$('#articleInfo1charCount').html(response.articleInfo1.charCount);
|
||||||
|
$('#articleInfo1lastContributor').html(response.articleInfo1.lastContributor);
|
||||||
|
$('#articleInfo1image').attr('href', response.articleInfo1.image);
|
||||||
|
$('#articleInfo1image img').attr('src', response.articleInfo1.image);
|
||||||
|
|
||||||
|
// Récupérez la valeur de l'image
|
||||||
|
const articleInfo1ImageValue = response.articleInfo1.image;
|
||||||
|
|
||||||
|
// Récupérez l'élément image par son ID
|
||||||
|
const articleInfo1Image = document.getElementById("articleInfo1image");
|
||||||
|
|
||||||
|
if (articleInfo1ImageValue === "Non disponible") {
|
||||||
|
// Si la valeur est "Non disponible", masquez l'élément
|
||||||
|
articleInfo1Image.style.display = "none";
|
||||||
|
} else {
|
||||||
|
// Sinon, affichez l'élément
|
||||||
|
articleInfo1Image.style.display = "block"; // Vous pouvez utiliser "inline" si nécessaire
|
||||||
|
// Assurez-vous de définir la source de l'image ici en fonction de votre logique
|
||||||
|
articleInfo1Image.src = articleInfo1ImageValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const infoboxContainer1 = document.getElementById("infoboxcontainer1");
|
||||||
|
// Supprimer le contenu précédent de l'infobox
|
||||||
|
while (infoboxContainer1.firstChild) {
|
||||||
|
infoboxContainer1.removeChild(infoboxContainer1.firstChild);
|
||||||
|
}
|
||||||
|
// Ajouter les nouvelles informations pour articleInfo1
|
||||||
|
const infoboxData1 = response.articleInfo1.infobox;
|
||||||
|
Object.entries(infoboxData1).forEach(([key, value]) => {
|
||||||
|
const ligne = document.createElement("tr");
|
||||||
|
ligne.innerHTML = `<th>${key}</th> <td>${value}</td>`;
|
||||||
|
infoboxContainer1.appendChild(ligne);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Traitez le cas où response.articleInfo1 n'existe pas
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Vérifiez si response.articleInfo2 existe et contient les informations nécessaires
|
||||||
|
if (response.articleInfo2) {
|
||||||
|
$('#articleInfo2Title').html(response.articleInfo2.title);
|
||||||
|
|
||||||
|
// Article 2
|
||||||
|
$('#articleInfo2Title').html(response.articleInfo2.title);
|
||||||
|
$('#articleInfo2url').attr('href', response.articleInfo2.url);
|
||||||
|
$('#articleInfo2extract').html(response.articleInfo2.extract);
|
||||||
|
$('#articleInfo2lastEdit').html(response.articleInfo2.lastEdit);
|
||||||
|
$('#articleInfo2numRevisions').html(response.articleInfo2.numRevisions);
|
||||||
|
$('#articleInfo2pageSize').html(response.articleInfo2.pageSize);
|
||||||
|
$('#articleInfo2firstRevisionUser').html(response.articleInfo2.firstRevisionUser);
|
||||||
|
$('#articleInfo2latestRevisionId').html(response.articleInfo2.latestRevisionId);
|
||||||
|
$('#articleInfo2pageId').html(response.articleInfo2.pageId);
|
||||||
|
$('#articleInfo2latestVersion').html(response.articleInfo2.latestVersion);
|
||||||
|
$('#articleInfo2wordCount').html(response.articleInfo2.wordCount);
|
||||||
|
$('#articleInfo2charCount').html(response.articleInfo2.charCount);
|
||||||
|
$('#articleInfo2lastContributor').html(response.articleInfo2.lastContributor);
|
||||||
|
$('#articleInfo2image').attr('href', response.articleInfo2.image);
|
||||||
|
$('#articleInfo2image img').attr('src', response.articleInfo2.image);
|
||||||
|
|
||||||
|
|
||||||
|
// Récupérez la valeur de l'image
|
||||||
|
const articleInfo2ImageValue = response.articleInfo2.image;
|
||||||
|
|
||||||
|
// Récupérez l'élément image par son ID
|
||||||
|
const articleInfo2Image = document.getElementById("articleInfo2image");
|
||||||
|
|
||||||
|
if (articleInfo2ImageValue === "Non disponible") {
|
||||||
|
// Si la valeur est "Non disponible", masquez l'élément
|
||||||
|
articleInfo2Image.style.display = "none";
|
||||||
|
} else {
|
||||||
|
// Sinon, affichez l'élément
|
||||||
|
articleInfo2Image.style.display = "block"; // Vous pouvez utiliser "inline" si nécessaire
|
||||||
|
// Assurez-vous de définir la source de l'image ici en fonction de votre logique
|
||||||
|
articleInfo2Image.src = articleInfo2ImageValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const infoboxContainer2 = document.getElementById("infoboxcontainer2");
|
||||||
|
// Supprimer le contenu précédent de l'infobox
|
||||||
|
while (infoboxContainer2.firstChild) {
|
||||||
|
infoboxContainer2.removeChild(infoboxContainer2.firstChild);
|
||||||
|
}
|
||||||
|
// Ajouter les nouvelles informations pour articleInfo2
|
||||||
|
const infoboxData2 = response.articleInfo2.infobox;
|
||||||
|
Object.entries(infoboxData2).forEach(([key, value]) => {
|
||||||
|
const ligne = document.createElement("tr");
|
||||||
|
ligne.innerHTML = `<th>${key}</th> <td>${value}</td>`;
|
||||||
|
infoboxContainer2.appendChild(ligne);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Traitez le cas où response.articleInfo2 n'existe pas
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vérifiez si toutes les informations nécessaires sont disponibles
|
||||||
|
const allInfoAvailable = checkIfAllInfoAvailable(response);
|
||||||
|
|
||||||
|
if (allInfoAvailable) {
|
||||||
|
$('#articleContainer1').removeClass('hidden');
|
||||||
|
$('#articleContainer2').removeClass('hidden');
|
||||||
|
$('#articleIntrouvable').addClass('hidden');
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
// Sélectionnez le lien par son ID
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: $('#resultat').offset().top
|
||||||
|
}, 1000); // 1000 millisecondes (1 seconde) pour l'animation
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Traitez le cas où certaines informations ne sont pas disponibles
|
||||||
|
const articleIntrouvable = document.getElementById("articleIntrouvable");
|
||||||
|
let errorMessage = "";
|
||||||
|
|
||||||
|
if (!response.articleInfo1 && !response.articleInfo2) {
|
||||||
|
errorMessage += "Les articles " +
|
||||||
|
'<span class="underline">' + articleTitle1 + "</span> et " +
|
||||||
|
'<span class="underline">' + articleTitle2 + "</span> sont introuvables.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if (!response.articleInfo1) {
|
||||||
|
errorMessage += "L'article " + '<span class="underline">' + articleTitle1 + "</span> est introuvable.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.articleInfo2) {
|
||||||
|
errorMessage += "L'article " + '<span class="underline">' + articleTitle2 + "</span> est introuvable.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
articleIntrouvable.innerHTML = errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
error: function (error) {
|
||||||
|
console.error('Erreur lors de la recherche d\'informations sur les articles :', error);
|
||||||
|
|
||||||
|
// Ajoutez une console.log pour vérifier si cette partie du code est exécutée
|
||||||
|
console.log('Erreur AJAX');
|
||||||
|
|
||||||
|
// Sélectionnez le div d'erreur par son ID
|
||||||
|
const articleIntrouvable = document.getElementById("articleIntrouvable");
|
||||||
|
|
||||||
|
// Mettez à jour le contenu du div avec un message d'erreur
|
||||||
|
articleIntrouvable.textContent = "Aucun article n'a été trouvé.";
|
||||||
|
|
||||||
|
// Assurez-vous de masquer les conteneurs d'articles
|
||||||
|
$('#articleContainer1').addClass('hidden');
|
||||||
|
$('#articleContainer2').addClass('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function checkIfAllInfoAvailable(response) {
|
||||||
|
// Vérifiez si response.articleInfo1 contient toutes les informations nécessaires
|
||||||
|
const articleInfo1 = response.articleInfo1;
|
||||||
|
if (!articleInfo1) {
|
||||||
|
return false; // Si articleInfo1 est absent, retournez false
|
||||||
|
}
|
||||||
|
// Ajoutez ici des vérifications spécifiques pour les propriétés nécessaires dans articleInfo1
|
||||||
|
if (!articleInfo1.title || !articleInfo1.url || !articleInfo1.extract || !articleInfo1.lastEdit) {
|
||||||
|
return false; // Si l'une des propriétés nécessaires est absente, retournez false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vérifiez si response.articleInfo2 contient toutes les informations nécessaires
|
||||||
|
const articleInfo2 = response.articleInfo2;
|
||||||
|
if (!articleInfo2) {
|
||||||
|
return false; // Si articleInfo2 est absent, retournez false
|
||||||
|
}
|
||||||
|
// Ajoutez ici des vérifications spécifiques pour les propriétés nécessaires dans articleInfo2
|
||||||
|
if (!articleInfo2.title || !articleInfo2.url || !articleInfo2.extract || !articleInfo2.lastEdit) {
|
||||||
|
return false; // Si l'une des propriétés nécessaires est absente, retournez false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si toutes les vérifications sont passées, cela signifie que toutes les informations nécessaires sont disponibles
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === SMOOTH SCROLL ~(^^)~
|
||||||
|
|
||||||
|
// Fait scroll jusqu'au formulaire de comparaison
|
||||||
|
$(document).ready(function () {
|
||||||
|
// Sélectionnez le lien par son ID
|
||||||
|
$('#letzgooo').click(function (e) {
|
||||||
|
e.preventDefault(); // Empêchez le comportement de clic par défaut
|
||||||
|
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: $('#comparaison').offset().top
|
||||||
|
}, 1000); // 1000 millisecondes (1 seconde) pour l'animation
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -1011,6 +1011,7 @@ table th {
|
|||||||
border-bottom: 1px solid #1D2144;
|
border-bottom: 1px solid #1D2144;
|
||||||
border-width: 10%;
|
border-width: 10%;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1020,7 +1021,11 @@ table td {
|
|||||||
border-bottom: 1px solid #1D2144;
|
border-bottom: 1px solid #1D2144;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
width: 65%;
|
width: 65%;
|
||||||
}
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
button,
|
button,
|
||||||
input,
|
input,
|
||||||
@@ -2261,6 +2266,29 @@ input#checkboxLabel:checked~.box span {
|
|||||||
text-align: center
|
text-align: center
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-alert{
|
||||||
|
color: #ff0000;
|
||||||
|
background-color: #fd00001c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-info{
|
||||||
|
color: #148f33;
|
||||||
|
background-color: #14eb0027;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bienvenu-msg{
|
||||||
|
padding: 20px;
|
||||||
|
width: 40%;
|
||||||
|
margin-bottom: 60px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size:larger;
|
||||||
|
min-width: 160px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mt-6{
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
.text-end {
|
.text-end {
|
||||||
text-align: end
|
text-align: end
|
||||||
}
|
}
|
162
app-rappaurio/server/controllers/auth.js
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
const mysql = require('mysql');
|
||||||
|
const jwt = require('jsonwebtoken');
|
||||||
|
const bcrypt = require('bcryptjs');
|
||||||
|
const { promisify } = require('util');
|
||||||
|
|
||||||
|
const db = mysql.createConnection({
|
||||||
|
host: process.env.DATABASE_HOST,
|
||||||
|
user: process.env.DATABASE_USER,
|
||||||
|
password: process.env.DATABASE_PASSWORD,
|
||||||
|
database: process.env.DATABASE
|
||||||
|
});
|
||||||
|
|
||||||
|
exports.login = async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { email, password } = req.body;
|
||||||
|
if (!email || !password) {
|
||||||
|
return res.status(400).render('contains/connexion', {
|
||||||
|
message: 'Veuillez entrer un email et un mot de passe'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
db.query('SELECT * FROM users WHERE email = ?', [email], async (error, result) => {
|
||||||
|
console.log(result)
|
||||||
|
if (!result || result.length == 0 || !(await bcrypt.compare(password, result[0].password))) {
|
||||||
|
res.status(401).render('contains/connexion', {
|
||||||
|
message: 'Email ou Mot de passe incorrect'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const id = result[0].id;
|
||||||
|
// creating a token
|
||||||
|
const token = jwt.sign({ id: id }, process.env.JWT_SECRET, {
|
||||||
|
expiresIn: process.env.JWT_EXPIRES_IN
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("The token is : " + token);
|
||||||
|
|
||||||
|
// when does our token expires
|
||||||
|
const cookieOptions = {
|
||||||
|
expires: new Date(
|
||||||
|
Date.now() + process.env.JWT_COOKIE_EXPIRES_IN * 24 * 60 * 60 * 1000
|
||||||
|
),
|
||||||
|
// just to prevent if someone is not messing with our cookies
|
||||||
|
httpOnly: true
|
||||||
|
}
|
||||||
|
// we can use any name here in res.cookie(name , token , cookieoptions ) ;
|
||||||
|
// after a user is loged in we put cookie in browser
|
||||||
|
res.cookie('jwt', token, cookieOptions);
|
||||||
|
res.status(200).redirect('/');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.register = (req, res) => {
|
||||||
|
console.log(req.body);
|
||||||
|
|
||||||
|
// de-structuring in javaScript....
|
||||||
|
const { name, email, password } = req.body;
|
||||||
|
|
||||||
|
db.query('SELECT email FROM users WHERE email = ?', [email], async (error, result) => {
|
||||||
|
if (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
if (result.length > 0) {
|
||||||
|
return res.render('contains/inscription', {
|
||||||
|
message: 'Cet email est déjà utilisé'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let hashedPassword = await bcrypt.hash(password, 8);
|
||||||
|
|
||||||
|
console.log(hashedPassword);
|
||||||
|
|
||||||
|
db.query('INSERT INTO users SET ?', { name: name, email: email, password: hashedPassword }, (error, result) => {
|
||||||
|
if (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log(result);
|
||||||
|
|
||||||
|
db.query('SELECT * FROM users WHERE email = ?', [email], async (error, result) => {
|
||||||
|
console.log(result)
|
||||||
|
|
||||||
|
const id = result[0].id;
|
||||||
|
// creating a token
|
||||||
|
const token = jwt.sign({ id: id }, process.env.JWT_SECRET, {
|
||||||
|
expiresIn: process.env.JWT_EXPIRES_IN
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("The token is : " + token);
|
||||||
|
|
||||||
|
// when does our token expires
|
||||||
|
const cookieOptions = {
|
||||||
|
expires: new Date(
|
||||||
|
Date.now() + process.env.JWT_COOKIE_EXPIRES_IN * 24 * 60 * 60 * 1000
|
||||||
|
),
|
||||||
|
// just to prevent if someone is not messing with our cookies
|
||||||
|
httpOnly: true
|
||||||
|
}
|
||||||
|
// we can use any name here in res.cookie(name , token , cookieoptions ) ;
|
||||||
|
// after a user is loged in we put cookie in browser
|
||||||
|
res.cookie('jwt', token, cookieOptions);
|
||||||
|
res.status(200).redirect('/');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.isLoggedIn = async (req, res, next) => {
|
||||||
|
|
||||||
|
console.log(req.cookies);
|
||||||
|
if (req.cookies.jwt) {
|
||||||
|
try {
|
||||||
|
// step 1 : Verify the token
|
||||||
|
const decoded = await promisify(jwt.verify)(
|
||||||
|
req.cookies.jwt,
|
||||||
|
process.env.JWT_SECRET
|
||||||
|
)
|
||||||
|
|
||||||
|
//console.log(decoded);
|
||||||
|
|
||||||
|
const userId = decoded.id;
|
||||||
|
req.userId = userId;
|
||||||
|
|
||||||
|
// step 2: check if the user still exists
|
||||||
|
db.query('SELECT * FROM users WHERE id = ?', [decoded.id], (error, result) => {
|
||||||
|
console.log(result);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
req.user = result[0];
|
||||||
|
return next();
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
exports.logout = async (req, res) => {
|
||||||
|
res.cookie('jwt', 'déconnecté', {
|
||||||
|
expires: new Date(Date.now() + 2 * 1000),
|
||||||
|
httpOnly: true
|
||||||
|
});
|
||||||
|
res.status(200).redirect('/');
|
||||||
|
}
|
21
app-rappaurio/server/controllers/historiqueController.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
const mysql = require('mysql');
|
||||||
|
|
||||||
|
// Créez une connexion à la base de données
|
||||||
|
const db = mysql.createConnection({
|
||||||
|
host: process.env.DATABASE_HOST,
|
||||||
|
user: process.env.DATABASE_USER,
|
||||||
|
password: process.env.DATABASE_PASSWORD,
|
||||||
|
database: process.env.DATABASE
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fonction pour récupérer les données depuis la base de données
|
||||||
|
exports.getHistoriqueData = (userId, callback) => {
|
||||||
|
db.query('SELECT * FROM search WHERE id = ? LIMIT 50', [userId], (error, results) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Erreur lors de la récupération des données depuis la base de données :', error);
|
||||||
|
callback(error, null);
|
||||||
|
} else {
|
||||||
|
callback(null, results);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
27
app-rappaurio/server/controllers/searchController.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// searchController.js
|
||||||
|
|
||||||
|
const mysql = require('mysql');
|
||||||
|
|
||||||
|
// Créez une connexion à la base de données
|
||||||
|
const db = mysql.createConnection({
|
||||||
|
host: process.env.DATABASE_HOST,
|
||||||
|
user: process.env.DATABASE_USER,
|
||||||
|
password: process.env.DATABASE_PASSWORD,
|
||||||
|
database: process.env.DATABASE
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fonction pour insérer les données de recherche dans la base de données
|
||||||
|
exports.insertSearchData = (userId, articleTitle1, articleTitle2, callback) => {
|
||||||
|
db.query('INSERT INTO search (id, article1, article2) VALUES (?, ?, ?)', [userId, articleTitle1, articleTitle2], (error, result) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Erreur lors de l\'insertion des données dans la base de données :', error);
|
||||||
|
// Vous pouvez gérer l'erreur en appelant le callback avec l'erreur
|
||||||
|
callback(error, null);
|
||||||
|
} else {
|
||||||
|
// Les données ont été insérées avec succès
|
||||||
|
console.log('Données insérées avec succès dans la base de données.');
|
||||||
|
// Appelez le callback avec succès
|
||||||
|
callback(null, result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
@@ -1,46 +1,9 @@
|
|||||||
const express = require('express');
|
|
||||||
const exphbs = require('express-handlebars');
|
|
||||||
const path = require('path');
|
|
||||||
const cookieParser = require('cookie-parser');
|
|
||||||
const axios = require('axios');
|
|
||||||
const bodyParser = require('body-parser');
|
|
||||||
const Wikiapi = require('wikiapi');
|
const Wikiapi = require('wikiapi');
|
||||||
const wiki = new Wikiapi('fr');
|
const wiki = new Wikiapi('fr');
|
||||||
const app = express();
|
const axios = require('axios');
|
||||||
const morgan = require('morgan');
|
|
||||||
|
|
||||||
app.use(morgan('dev'));
|
|
||||||
|
|
||||||
// Configuration du moteur de modèle Handlebars
|
// == Functions
|
||||||
app.engine('.hbs', exphbs.engine({ extname: '.hbs' }));
|
|
||||||
app.set('view engine', '.hbs');
|
|
||||||
app.set('views', path.join(__dirname, 'views'));
|
|
||||||
|
|
||||||
// Middleware pour servir les fichiers statiques
|
|
||||||
app.use(express.static(path.join(__dirname, '/')));
|
|
||||||
|
|
||||||
// Utilisation de cookie-parser comme middleware
|
|
||||||
app.use(cookieParser());
|
|
||||||
|
|
||||||
// Middleware pour gérer le thème basé sur le cookie
|
|
||||||
|
|
||||||
/*
|
|
||||||
app.use((req, res, next) => {
|
|
||||||
if (req.cookies.theme === 'dark') {
|
|
||||||
// Si le cookie "theme" est défini sur "dark", ajoutez la classe "dark" au <html>
|
|
||||||
res.locals.theme = 'dark';
|
|
||||||
} else {
|
|
||||||
// Sinon, retirez la classe "dark"
|
|
||||||
res.locals.theme = '';
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Middleware body-parser pour traiter les données POST du formulaire
|
|
||||||
app.use(bodyParser.urlencoded({ extended: false }));
|
|
||||||
|
|
||||||
// ================ FONCTIONS ==============================
|
|
||||||
|
|
||||||
// Fonction de nettoyage personnalisée (pour infobox)
|
// Fonction de nettoyage personnalisée (pour infobox)
|
||||||
function cleanInfoboxText(text) {
|
function cleanInfoboxText(text) {
|
||||||
@@ -105,7 +68,8 @@ async function fetchArticleInfoFromAPI(articleTitle) {
|
|||||||
const page_data = await wiki.page(articleTitle);
|
const page_data = await wiki.page(articleTitle);
|
||||||
const parsed = page_data.parse();
|
const parsed = page_data.parse();
|
||||||
|
|
||||||
const variablesExclues = ['image', 'blason', 'drapeau', 'logo', 'légende', 'carte', 'légende-carte', 'Site-Internet', 'siteweb', '_', 'statut', 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
// Filtre des données compliquée à représentée
|
||||||
|
const variablesExclues = ['image', 'blason', 'drapeau', 'logo', 'légende', 'carte', 'légende-carte', '_', 'statut', 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||||
|
|
||||||
// Lire les modèles Infobox, les convertir en JSON.
|
// Lire les modèles Infobox, les convertir en JSON.
|
||||||
parsed.each('template', (template_token) => {
|
parsed.each('template', (template_token) => {
|
||||||
@@ -187,7 +151,7 @@ async function fetchArticleInfoFromAPI(articleTitle) {
|
|||||||
return articleInfo;
|
return articleInfo;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(`Warning :l'article "${articleTitle}" n'a pas été trouvé.`);
|
console.log(`Warning : l'article "${articleTitle}" n'a pas été trouvé.`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -196,80 +160,6 @@ async function fetchArticleInfoFromAPI(articleTitle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===================== ROUTES ==========================
|
module.exports = {
|
||||||
|
fetchArticleInfoFromAPI
|
||||||
// Index
|
};
|
||||||
app.get('/', async (req, res) => {
|
|
||||||
|
|
||||||
// Renvoyez la page index avec les informations de l'article et de l'infobox
|
|
||||||
res.render('contains/index', { pageTitle: 'Accueil' });
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Comparaison d'articles
|
|
||||||
app.post('/search', async (req, res) => {
|
|
||||||
try {
|
|
||||||
// Récupérez les données du formulaire depuis req.body comme d'habitude
|
|
||||||
const articleTitle1 = req.body.articleTitle1;
|
|
||||||
const articleTitle2 = req.body.articleTitle2;
|
|
||||||
|
|
||||||
// Utilisez la fonction pour récupérer les informations des articles
|
|
||||||
const articleInfo1 = await fetchArticleInfoFromAPI(articleTitle1);
|
|
||||||
const articleInfo2 = await fetchArticleInfoFromAPI(articleTitle2);
|
|
||||||
|
|
||||||
// Renvoyez la réponse au format JSON
|
|
||||||
res.json({ articleInfo1, articleInfo2 });
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Erreur lors de la recherche d\'informations sur les articles :', error);
|
|
||||||
res.status(500).json({ error: 'Une erreur s\'est produite lors de la recherche d\'informations sur les articles.' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Historique
|
|
||||||
app.get('/historique', (req, res) => {
|
|
||||||
res.render('contains/historique', { pageTitle: 'Historique' });
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Connexion
|
|
||||||
app.get('/connexion', (req, res) => {
|
|
||||||
res.render('contains/signin', { pageTitle: 'Connexion' });
|
|
||||||
});
|
|
||||||
|
|
||||||
// Inscription
|
|
||||||
app.get('/inscription', (req, res) => {
|
|
||||||
res.render('contains/signup', { pageTitle: 'Inscription' });
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/* EXEMPLE UTILISATION COOKIE
|
|
||||||
|
|
||||||
// Changer le thème en fonction de la case cochée
|
|
||||||
app.post('/toggle-theme', (req, res) => {
|
|
||||||
if (req.cookies.theme === 'dark') {
|
|
||||||
// Si le thème est actuellement "dark", changez-le en "light"
|
|
||||||
res.cookie('theme', 'light', { sameSite: 'None', secure: true });
|
|
||||||
} else {
|
|
||||||
// Sinon, changez-le en "dark"
|
|
||||||
res.cookie('theme', 'dark', { sameSite: 'None', secure: true });
|
|
||||||
}
|
|
||||||
res.redirect(req.get('referer'));
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// 404
|
|
||||||
app.use((req, res, next) => {
|
|
||||||
res.status(404).render('contains/404', { title: 'Erreur 404' });
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ======================== PORT ===========================
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 5000;
|
|
||||||
app.listen(PORT, () => {
|
|
||||||
console.log(`Info : le serveur est en écoute sur le port ${PORT}`);
|
|
||||||
});
|
|
14
app-rappaurio/server/routes/auth.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const authController = require('../controllers/auth');
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
router.post('/inscription' , authController.register);
|
||||||
|
|
||||||
|
router.post('/connexion' , authController.login);
|
||||||
|
|
||||||
|
router.get('/deconnexion' , authController.logout)
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router ;
|
83
app-rappaurio/server/routes/index.js
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
var express = require('express');
|
||||||
|
const authController = require('../controllers/auth')
|
||||||
|
const searchController = require('../controllers/searchController');
|
||||||
|
const historiqueController = require('../controllers/historiqueController');
|
||||||
|
const { fetchArticleInfoFromAPI } = require('../functions/compare');
|
||||||
|
|
||||||
|
var router = express.Router();
|
||||||
|
|
||||||
|
/* GET home page. */
|
||||||
|
router.get('/', authController.isLoggedIn, (req, res, next) => {
|
||||||
|
res.render('contains/index', { user_details: req.user });
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// inscription page
|
||||||
|
router.get('/inscription', (req, res) => {
|
||||||
|
res.render('contains/inscription')
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/connexion', (req, res) => {
|
||||||
|
res.render('contains/connexion')
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
router.get('/historique', authController.isLoggedIn, (req, res) => {
|
||||||
|
console.log(req.user);
|
||||||
|
|
||||||
|
if (req.user) {
|
||||||
|
const userId = req.user.id;
|
||||||
|
historiqueController.getHistoriqueData(userId, (error, historiqueData) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Erreur lors de la récupération des données depuis la base de données :', error);
|
||||||
|
res.status(500).json({ error: 'Une erreur s\'est produite lors de la récupération des données.' });
|
||||||
|
} else {
|
||||||
|
|
||||||
|
res.render('contains/historique', {
|
||||||
|
user_details: req.user,
|
||||||
|
historiqueData: historiqueData
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
res.redirect('/connexion');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Send search for articles
|
||||||
|
router.post('/search', authController.isLoggedIn, async (req, res) => {
|
||||||
|
try {
|
||||||
|
// Récupérez les données du formulaire depuis req.body
|
||||||
|
const articleTitle1 = req.body.articleTitle1;
|
||||||
|
const articleTitle2 = req.body.articleTitle2;
|
||||||
|
|
||||||
|
// Utilisez la fonction pour récupérer les informations des articles
|
||||||
|
const articleInfo1 = await fetchArticleInfoFromAPI(articleTitle1);
|
||||||
|
const articleInfo2 = await fetchArticleInfoFromAPI(articleTitle2);
|
||||||
|
|
||||||
|
// Récupérez l'ID de l'utilisateur
|
||||||
|
const userId = req.userId;
|
||||||
|
|
||||||
|
// Utilisez la fonction du contrôleur pour insérer les données
|
||||||
|
|
||||||
|
if (userId) {
|
||||||
|
searchController.insertSearchData(userId, articleTitle1, articleTitle2, (error, result) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Erreur lors de l\'insertion des données dans la base de données :', error);
|
||||||
|
res.status(500).json({ error: 'Une erreur s\'est produite lors de l\'enregistrement des données.' });
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Renvoyez la réponse au format JSON
|
||||||
|
res.json({ articleInfo1, articleInfo2 });
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erreur lors de la recherche d\'informations sur les articles :', error);
|
||||||
|
res.status(500).json({ error: 'Une erreur s\'est produite lors de la recherche d\'informations sur les articles.' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router;
|
90
app-rappaurio/views/contains/connexion.hbs
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<section class="relative overflow-hidden z-10 pt-[180px] pb-[120px]">
|
||||||
|
<div class="container">
|
||||||
|
<div class="flex flex-wrap mx-[-16px]">
|
||||||
|
<div class="w-full px-4">
|
||||||
|
<div class="max-w-[500px] mx-auto bg-dark bg-opacity-15 dark:bg-dark rounded-md p-12 sm:p-[60px]">
|
||||||
|
<h3 class="font-bold text-white dark:text-white text-2xl sm:text-3xl mb-6 text-center">
|
||||||
|
Connexion à votre compte
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<!--FORMULAIRE-->
|
||||||
|
<form method="POST" action="/auth/connexion">
|
||||||
|
<div class="mb-8">
|
||||||
|
<label for="email" class="block text-sm font-medium text-white dark:text-white mb-3">
|
||||||
|
Email <sup class="text-body-color">*</sup>
|
||||||
|
</label>
|
||||||
|
<input type="email" name="email" id="email" placeholder="Entrer votre email..."
|
||||||
|
required="required"
|
||||||
|
class="w-full border border-transparent bg-primary bg-opacity-10 dark:bg-[#242B51] rounded-md shadow-one dark:shadow-signUp py-3 px-6 text-body-color text-base placeholder-body-color outline-none focus-visible:shadow-none focus:border-primary" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-8">
|
||||||
|
<label for="password" class="block text-sm font-medium text-white dark:text-white mb-3">
|
||||||
|
Mot de passe <sup class="text-body-color">*</sup>
|
||||||
|
</label>
|
||||||
|
<input type="password" name="password" id="password"
|
||||||
|
placeholder="Entrer votre mot de passe..." required="required"
|
||||||
|
class="w-full border border-transparent bg-primary bg-opacity-10 dark:bg-[#242B51] rounded-md shadow-one dark:shadow-signUp py-3 px-6 text-body-color text-base placeholder-body-color outline-none focus-visible:shadow-none focus:border-primary" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<sup class="text-body-color">* champs obligatoires</sup>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--CASE COCHER POUR SOUVENIR MDP-->
|
||||||
|
<div class="flex items-center justify-between mb-8">
|
||||||
|
<!--
|
||||||
|
<div>
|
||||||
|
<label for="checkboxLabel"
|
||||||
|
class="flex items-center cursor-pointer text-body-color text-sm font-medium select-none">
|
||||||
|
<div class="relative">
|
||||||
|
<input type="checkbox" id="checkboxLabel" class="sr-only" />
|
||||||
|
<div
|
||||||
|
class="box flex items-center justify-center w-5 h-5 rounded border border-body-color border-opacity-20 dark:border-white dark:border-opacity-10 mr-4">
|
||||||
|
<span class="opacity-0">
|
||||||
|
<svg width="11" height="8" viewBox="0 0 11 8" fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path
|
||||||
|
d="M10.0915 0.951972L10.0867 0.946075L10.0813 0.940568C9.90076 0.753564 9.61034 0.753146 9.42927 0.939309L4.16201 6.22962L1.58507 3.63469C1.40401 3.44841 1.11351 3.44879 0.932892 3.63584C0.755703 3.81933 0.755703 4.10875 0.932892 4.29224L0.932878 4.29225L0.934851 4.29424L3.58046 6.95832C3.73676 7.11955 3.94983 7.2 4.1473 7.2C4.36196 7.2 4.55963 7.11773 4.71406 6.9584L10.0468 1.60234C10.2436 1.4199 10.2421 1.1339 10.0915 0.951972ZM4.2327 6.30081L4.2317 6.2998C4.23206 6.30015 4.23237 6.30049 4.23269 6.30082L4.2327 6.30081Z"
|
||||||
|
fill="#3056D3" stroke="#3056D3" stroke-width="0.4" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
Rester connecté
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a href="javascript:void(0)" class="text-primary text-sm font-medium hover:underline">
|
||||||
|
Mot de passe oublié? </a>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--MDP OUBLIER-->
|
||||||
|
<div class="mb-6">
|
||||||
|
<button type="submit"
|
||||||
|
class="w-full flex items-center justify-center text-base font-medium text-white bg-primary py-4 px-9 hover:shadow-signUp hover:bg-opacity-80 transition duration-300 ease-in-out rounded-md">
|
||||||
|
Connexion
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p class="font-medium text-base text-body-color text-center">
|
||||||
|
Vous n'avez pas de compte?
|
||||||
|
<a href="/inscription" class="text-primary hover:underline"> Inscription </a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{#if message }}
|
||||||
|
<h4 class="text-center mt-6 border text-alert px-4 py-3 rounded relative">{{message}}</h4>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
34
app-rappaurio/views/contains/historique.hbs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<section id="home"
|
||||||
|
class="relative overflow-hidden z-10 pt-[120px] pb-[110px] md:pt-[150px] md:pb-[120px] xl:pt-[180px] xl:pb-[160px] 2xl:pt-[210px] 2xl:pb-[200px]">
|
||||||
|
<div class="container">
|
||||||
|
<div class="flex flex-wrap mx-[-16px]">
|
||||||
|
<div class="w-full px-4">
|
||||||
|
|
||||||
|
|
||||||
|
<table class="text-center">
|
||||||
|
|
||||||
|
<!-- Statistiques -->
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>Article 1</th>
|
||||||
|
<th>Article 2</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{{#each historiqueData }}
|
||||||
|
<tr>
|
||||||
|
<td>{{this.article1}}</td>
|
||||||
|
<td>{{this.article2}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
@@ -10,9 +10,9 @@
|
|||||||
class="text-black dark:text-white font-bold text-3xl sm:text-4xl md:text-5xl leading-tight sm:leading-tight md:leading-tight mb-8">
|
class="text-black dark:text-white font-bold text-3xl sm:text-4xl md:text-5xl leading-tight sm:leading-tight md:leading-tight mb-8">
|
||||||
Comparateur d'articles Wikipédia
|
Comparateur d'articles Wikipédia
|
||||||
</h1>
|
</h1>
|
||||||
<img src="assets/images/wikipedia.png" alt="logo wikipedia" width="150"
|
<img src="/images/wikipedia.png" alt="logo wikipedia" width="150"
|
||||||
class="mx-auto mb-8 dark:hidden" />
|
class="mx-auto mb-8 dark:hidden" />
|
||||||
<img src="assets/images/wikipedia-dark.png" alt="logo wikipedia" width="150"
|
<img src="/images/wikipedia-dark.png" alt="logo wikipedia" width="150"
|
||||||
class="mx-auto mb-8 hidden dark:block" />
|
class="mx-auto mb-8 hidden dark:block" />
|
||||||
<p
|
<p
|
||||||
class="font-lg text-lg md:text-xl leading-relaxed md:leading-relaxed text-body-color dark:text-white dark:opacity-90 mb-12">
|
class="font-lg text-lg md:text-xl leading-relaxed md:leading-relaxed text-body-color dark:text-white dark:opacity-90 mb-12">
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-full px-4 flex items-center justify-center">
|
<div class="w-full px-4 flex items-center justify-center">
|
||||||
<button id="lance-comparaison" type="submit" onclick="scroll(0, 100);"
|
<button id="lance-comparaison" type="submit"
|
||||||
class="text-base mb-16 font-medium text-white bg-primary py-4 px-9 hover:bg-opacity-80 hover:shadow-signUp rounded-md transition duration-300 ease-in-out">
|
class="text-base mb-16 font-medium text-white bg-primary py-4 px-9 hover:bg-opacity-80 hover:shadow-signUp rounded-md transition duration-300 ease-in-out">
|
||||||
Comparer
|
Comparer
|
||||||
</button>
|
</button>
|
||||||
@@ -334,7 +334,7 @@
|
|||||||
Excepteur sint occaecat cupidatat.
|
Excepteur sint occaecat cupidatat.
|
||||||
</p>
|
</p>
|
||||||
<div class="w-full rounded overflow-hidden mb-10">
|
<div class="w-full rounded overflow-hidden mb-10">
|
||||||
<img src="assets/images/blog-details-02.jpg" alt="image"
|
<img src="/images/blog-details-02.jpg" alt="image"
|
||||||
class="w-full h-full object-cover object-center" />
|
class="w-full h-full object-cover object-center" />
|
||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
94
app-rappaurio/views/contains/inscription.hbs
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<section class="relative overflow-hidden z-10 pt-[180px] pb-[120px]">
|
||||||
|
<div class="container">
|
||||||
|
<div class="flex flex-wrap mx-[-16px]">
|
||||||
|
<div class="w-full px-4">
|
||||||
|
<div class="max-w-[500px] mx-auto bg-dark bg-opacity-15 dark:bg-dark rounded-md p-12 sm:p-[60px]">
|
||||||
|
<h3 class="font-bold text-white dark:text-white text-2xl mb-6 sm:text-3xl text-center">
|
||||||
|
Créez votre compte
|
||||||
|
</h3>
|
||||||
|
<form method="POST" action="/auth/inscription">
|
||||||
|
<div class="mb-8">
|
||||||
|
<label for="name" class="block text-sm font-medium text-white dark:text-white mb-3">
|
||||||
|
Nom <sup class="text-body-color">*</sup>
|
||||||
|
</label>
|
||||||
|
<input type="text" name="name" id="name" placeholder="Entrer votre nom..."
|
||||||
|
required="required"
|
||||||
|
class="w-full border border-transparent bg-primary bg-opacity-10 dark:bg-[#242B51] rounded-md shadow-one dark:shadow-signUp py-3 px-6 text-body-color text-base placeholder-body-color outline-none focus-visible:shadow-none focus:border-primary" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-8">
|
||||||
|
<label for="email" class="block text-sm font-medium text-white dark:text-white mb-3">
|
||||||
|
Email <sup class="text-body-color">*</sup>
|
||||||
|
</label>
|
||||||
|
<input type="email" name="email" id="email" placeholder="Entrer votre Email..."
|
||||||
|
required="required"
|
||||||
|
class="w-full border border-transparent bg-primary bg-opacity-10 dark:bg-[#242B51] rounded-md shadow-one dark:shadow-signUp py-3 px-6 text-body-color text-base placeholder-body-color outline-none focus-visible:shadow-none focus:border-primary" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-12">
|
||||||
|
<label for="password" class="block text-sm font-medium text-white dark:text-white mb-3">
|
||||||
|
Mot de passe <sup class="text-body-color">*</sup>
|
||||||
|
</label>
|
||||||
|
<input type="password" name="password" id="password"
|
||||||
|
placeholder="Entrer votre mot de passe..." required="required"
|
||||||
|
class="w-full border border-transparent bg-primary bg-opacity-10 dark:bg-[#242B51] rounded-md shadow-one dark:shadow-signUp py-3 px-6 text-body-color text-base placeholder-body-color outline-none focus-visible:shadow-none focus:border-primary" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-8">
|
||||||
|
<sup class="text-body-color">* champs obligatoires</sup>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- CONDITIONS D'UTILISATION
|
||||||
|
|
||||||
|
<div class="flex mb-8">
|
||||||
|
<label for="checkboxLabel"
|
||||||
|
class="flex cursor-pointer text-body-color text-sm font-medium select-none">
|
||||||
|
<div class="relative">
|
||||||
|
<input type="checkbox" id="checkboxLabel" class="sr-only" />
|
||||||
|
<div
|
||||||
|
class="box flex items-center justify-center w-5 h-5 rounded border border-body-color border-opacity-20 dark:border-white dark:border-opacity-10 mr-4 mt-1">
|
||||||
|
<span class="opacity-0">
|
||||||
|
<svg width="11" height="8" viewBox="0 0 11 8" fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path
|
||||||
|
d="M10.0915 0.951972L10.0867 0.946075L10.0813 0.940568C9.90076 0.753564 9.61034 0.753146 9.42927 0.939309L4.16201 6.22962L1.58507 3.63469C1.40401 3.44841 1.11351 3.44879 0.932892 3.63584C0.755703 3.81933 0.755703 4.10875 0.932892 4.29224L0.932878 4.29225L0.934851 4.29424L3.58046 6.95832C3.73676 7.11955 3.94983 7.2 4.1473 7.2C4.36196 7.2 4.55963 7.11773 4.71406 6.9584L10.0468 1.60234C10.2436 1.4199 10.2421 1.1339 10.0915 0.951972ZM4.2327 6.30081L4.2317 6.2998C4.23206 6.30015 4.23237 6.30049 4.23269 6.30082L4.2327 6.30081Z"
|
||||||
|
fill="#3056D3" stroke="#3056D3" stroke-width="0.4" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span>
|
||||||
|
By creating account means you agree to the
|
||||||
|
<a href="javascript:void(0)" class="text-primary hover:underline"> Terms and
|
||||||
|
Conditions </a>
|
||||||
|
, and our
|
||||||
|
<a href="javascript:void(0)" class="text-primary hover:underline"> Privacy
|
||||||
|
Policy </a>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<div class="mb-6">
|
||||||
|
<button type="submit"
|
||||||
|
class="w-full flex items-center justify-center text-base font-medium text-white bg-primary py-4 px-9 hover:shadow-signUp hover:bg-opacity-80 transition duration-300 ease-in-out rounded-md">
|
||||||
|
Inscription
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<p class="font-medium text-base text-body-color text-center">
|
||||||
|
Déjà un compte?
|
||||||
|
<a href="/connexion" class="text-primary hover:underline"> Connexion </a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{#if message }}
|
||||||
|
<h4 class="text-center mt-6 border text-alert px-4 py-3 rounded relative">{{message}}</h4>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
@@ -8,28 +8,14 @@
|
|||||||
<meta name="title" content="Rappaurio | Projet Universitaire" />
|
<meta name="title" content="Rappaurio | Projet Universitaire" />
|
||||||
<meta name="darkreader-lock">
|
<meta name="darkreader-lock">
|
||||||
<title>Rappaurio - Wiki</title>
|
<title>Rappaurio - Wiki</title>
|
||||||
<link rel="icon" href="assets/images/icon.png">
|
<link rel="icon" href="/images/icon.png">
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<link href="assets/css/style.css" rel="stylesheet">
|
<link href="/stylesheets/style.css" rel="stylesheet">
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
text-decoration: none;
|
|
||||||
list-style: none;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
$(document).ready(function () {
|
|
||||||
cookieBanner.init();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="dark:bg-black">
|
<body class="dark:bg-black">
|
||||||
|
|
||||||
<div id="cookieBlur"></div>
|
|
||||||
|
|
||||||
<!--BAR DE NAVIGATION-->
|
<!--BAR DE NAVIGATION-->
|
||||||
|
|
||||||
@@ -38,8 +24,8 @@
|
|||||||
<div class="flex mx-[-16px] items-center justify-between relative">
|
<div class="flex mx-[-16px] items-center justify-between relative">
|
||||||
<div class="px-4 w-60 max-w-full">
|
<div class="px-4 w-60 max-w-full">
|
||||||
<a href="/" class="w-full block py-8 header-logo">
|
<a href="/" class="w-full block py-8 header-logo">
|
||||||
<img src="assets/images/logo-2.svg" alt="logo" class="w-full dark:hidden" />
|
<img src="/images/logo-2.svg" alt="logo" class="w-full dark:hidden" />
|
||||||
<img src="assets/images/logo.svg" alt="logo" class="w-full hidden dark:block" />
|
<img src="/images/logo.svg" alt="logo" class="w-full hidden dark:block" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex px-4 justify-between items-center w-full">
|
<div class="flex px-4 justify-between items-center w-full">
|
||||||
@@ -52,21 +38,47 @@
|
|||||||
</button>
|
</button>
|
||||||
<nav id="navbarCollapse"
|
<nav id="navbarCollapse"
|
||||||
class="absolute py-5 lg:py-0 lg:px-4 xl:px-6 bg-white dark:bg-dark lg:dark:bg-transparent lg:bg-transparent shadow-lg rounded-lg max-w-[250px] w-full lg:max-w-full lg:w-full right-4 top-full hidden lg:block lg:static lg:shadow-none">
|
class="absolute py-5 lg:py-0 lg:px-4 xl:px-6 bg-white dark:bg-dark lg:dark:bg-transparent lg:bg-transparent shadow-lg rounded-lg max-w-[250px] w-full lg:max-w-full lg:w-full right-4 top-full hidden lg:block lg:static lg:shadow-none">
|
||||||
|
|
||||||
<ul class="block lg:flex">
|
<ul class="block lg:flex">
|
||||||
|
|
||||||
|
{{#if user_details }}
|
||||||
|
|
||||||
<li class="relative group">
|
<li class="relative group">
|
||||||
<a href="/historique"
|
<a href="/historique"
|
||||||
class="text-base text-dark dark:text-white group-hover:opacity-70 py-2 lg:py-6 lg:inline-flex lg:px-0 flex mx-8 lg:mr-0">
|
class="text-base text-dark dark:text-white group-hover:opacity-70 py-2 lg:py-6 lg:inline-flex lg:px-0 flex mx-8 lg:mr-0">
|
||||||
Historique
|
Historique
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!--
|
|
||||||
<li class="relative group">
|
<li class="relative group submenu-item">
|
||||||
<a href="/erreur"
|
<a href="javascript:void(0)"
|
||||||
|
class="text-base text-dark dark:text-white group-hover:opacity-70 py-2 lg:py-6 lg:inline-flex lg:pl-0 lg:pr-4 flex mx-8 lg:mr-0 lg:ml-8 xl:ml-12 relative after:absolute after:w-2 after:h-2 after:border-b-2 after:border-r-2 after:border-current after:rotate-45 lg:after:right-0 after:right-1 after:top-1/2 after:translate-y-[-50%] after:mt-[-2px]">
|
||||||
|
Contact
|
||||||
|
</a>
|
||||||
|
<div
|
||||||
|
class="submenu hidden relative lg:absolute w-[250px] top-full lg:top-[110%] left-0 rounded-md lg:shadow-lg p-4 lg:block lg:opacity-0 lg:invisible group-hover:opacity-100 lg:group-hover:visible lg:group-hover:top-full bg-white dark:bg-dark transition-[top] duration-300">
|
||||||
|
<a href="https://blog-raph.dariow.fr/" target="_blank"
|
||||||
|
class="block text-base rounded py-[10px] px-4 text-dark dark:text-white hover:opacity-70">
|
||||||
|
Raphael Payet
|
||||||
|
</a>
|
||||||
|
<a href="https://blog.dariow.fr/" target="_blank"
|
||||||
|
class="block text-base rounded py-[10px] px-4 text-dark dark:text-white hover:opacity-70">
|
||||||
|
Dario Weinberger
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="relative group visible sm:visible md:invisible lg:invisible">
|
||||||
|
<a href="/auth/deconnexion"
|
||||||
class="text-base text-dark dark:text-white group-hover:opacity-70 py-2 lg:py-6 lg:inline-flex lg:px-0 flex mx-8 lg:mr-0 lg:ml-8 xl:ml-12">
|
class="text-base text-dark dark:text-white group-hover:opacity-70 py-2 lg:py-6 lg:inline-flex lg:px-0 flex mx-8 lg:mr-0 lg:ml-8 xl:ml-12">
|
||||||
Erreur 404
|
Deconnexion
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
|
{{else}}
|
||||||
|
|
||||||
<li class="relative group submenu-item">
|
<li class="relative group submenu-item">
|
||||||
<a href="javascript:void(0)"
|
<a href="javascript:void(0)"
|
||||||
class="text-base text-dark dark:text-white group-hover:opacity-70 py-2 lg:py-6 lg:inline-flex lg:pl-0 lg:pr-4 flex mx-8 lg:mr-0 lg:ml-8 xl:ml-12 relative after:absolute after:w-2 after:h-2 after:border-b-2 after:border-r-2 after:border-current after:rotate-45 lg:after:right-0 after:right-1 after:top-1/2 after:translate-y-[-50%] after:mt-[-2px]">
|
class="text-base text-dark dark:text-white group-hover:opacity-70 py-2 lg:py-6 lg:inline-flex lg:pl-0 lg:pr-4 flex mx-8 lg:mr-0 lg:ml-8 xl:ml-12 relative after:absolute after:w-2 after:h-2 after:border-b-2 after:border-r-2 after:border-current after:rotate-45 lg:after:right-0 after:right-1 after:top-1/2 after:translate-y-[-50%] after:mt-[-2px]">
|
||||||
@@ -92,28 +104,40 @@
|
|||||||
</a>
|
</a>
|
||||||
<div
|
<div
|
||||||
class="submenu hidden relative lg:absolute w-[150px] top-full lg:top-[110%] left-0 rounded-md lg:shadow-lg p-4 lg:block lg:opacity-0 lg:invisible group-hover:opacity-100 lg:group-hover:visible lg:group-hover:top-full bg-white dark:bg-dark transition-[top] duration-300">
|
class="submenu hidden relative lg:absolute w-[150px] top-full lg:top-[110%] left-0 rounded-md lg:shadow-lg p-4 lg:block lg:opacity-0 lg:invisible group-hover:opacity-100 lg:group-hover:visible lg:group-hover:top-full bg-white dark:bg-dark transition-[top] duration-300">
|
||||||
<a href="connexion"
|
<a href="/connexion"
|
||||||
class="block text-base rounded py-[10px] px-4 text-dark dark:text-white hover:opacity-70">
|
class="block text-base rounded py-[10px] px-4 text-dark dark:text-white hover:opacity-70">
|
||||||
Connexion
|
Connexion
|
||||||
</a>
|
</a>
|
||||||
<a href="inscription"
|
<a href="/inscription"
|
||||||
class="block text-base font-bold rounded py-[10px] px-4 text-dark dark:text-white hover:opacity-70">
|
class="block text-base font-bold rounded py-[10px] px-4 text-dark dark:text-white hover:opacity-70">
|
||||||
Inscription
|
Inscription
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="flex justify-end items-center pr-16 lg:pr-0">
|
<div class="flex justify-end items-center pr-16 lg:pr-0">
|
||||||
<a href="connexion"
|
{{#if user_details }}
|
||||||
|
<a href="/auth/deconnexion"
|
||||||
|
class="hidden visible sm:invisible md:block text-base font-bold text-dark dark:text-white hover:opacity-70 py-3 px-7">
|
||||||
|
Deconnexion
|
||||||
|
</a>
|
||||||
|
{{else}}
|
||||||
|
<a href="/connexion"
|
||||||
class="hidden visible sm:invisible md:block text-base font-bold text-dark dark:text-white hover:opacity-70 py-3 px-7">
|
class="hidden visible sm:invisible md:block text-base font-bold text-dark dark:text-white hover:opacity-70 py-3 px-7">
|
||||||
Connexion
|
Connexion
|
||||||
</a>
|
</a>
|
||||||
<a href="inscription"
|
<a href="/inscription"
|
||||||
class="hidden visible sm:invisible md:block text-base font-bold text-white bg-primary py-3 px-8 md:px-9 lg:px-6 xl:px-9 hover:shadow-signUp hover:bg-opacity-90 rounded-md transition ease-in-up duration-300">
|
class="hidden visible sm:invisible md:block text-base font-bold text-white bg-primary py-3 px-8 md:px-9 lg:px-6 xl:px-9 hover:shadow-signUp hover:bg-opacity-90 rounded-md transition ease-in-up duration-300">
|
||||||
Inscription
|
Inscription
|
||||||
</a>
|
</a>
|
||||||
|
{{/if}}
|
||||||
<div>
|
<div>
|
||||||
<label for="darkToggler"
|
<label for="darkToggler"
|
||||||
class="cursor-pointer w-9 h-9 md:w-14 md:h-14 rounded-full flex items-center justify-center bg-gray-2 dark:bg-dark-bg text-black dark:text-white">
|
class="cursor-pointer w-9 h-9 md:w-14 md:h-14 rounded-full flex items-center justify-center bg-gray-2 dark:bg-dark-bg text-black dark:text-white">
|
||||||
@@ -136,6 +160,8 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -168,8 +194,8 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!--SCRIPTS JS-->
|
<!--SCRIPTS JS-->
|
||||||
<script defer src="assets/js/custom.js"></script>
|
<script defer src="/js/custom.js"></script>
|
||||||
<script defer src="assets/js/bundle.js"></script>
|
<script defer src="/js/bundle.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
14
app/node_modules/@isaacs/cliui/LICENSE.txt
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
Copyright (c) 2015, Contributors
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
|
||||||
for any purpose with or without fee is hereby granted, provided
|
|
||||||
that the above copyright notice and this permission notice
|
|
||||||
appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
||||||
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
|
|
||||||
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
|
||||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
||||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
143
app/node_modules/@isaacs/cliui/README.md
generated
vendored
@@ -1,143 +0,0 @@
|
|||||||
# @isaacs/cliui
|
|
||||||
|
|
||||||
Temporary fork of [cliui](http://npm.im/cliui).
|
|
||||||
|
|
||||||

|
|
||||||
[](https://www.npmjs.com/package/cliui)
|
|
||||||
[](https://conventionalcommits.org)
|
|
||||||

|
|
||||||
|
|
||||||
easily create complex multi-column command-line-interfaces.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```js
|
|
||||||
const ui = require('cliui')()
|
|
||||||
|
|
||||||
ui.div('Usage: $0 [command] [options]')
|
|
||||||
|
|
||||||
ui.div({
|
|
||||||
text: 'Options:',
|
|
||||||
padding: [2, 0, 1, 0]
|
|
||||||
})
|
|
||||||
|
|
||||||
ui.div(
|
|
||||||
{
|
|
||||||
text: "-f, --file",
|
|
||||||
width: 20,
|
|
||||||
padding: [0, 4, 0, 4]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "the file to load." +
|
|
||||||
chalk.green("(if this description is long it wraps).")
|
|
||||||
,
|
|
||||||
width: 20
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: chalk.red("[required]"),
|
|
||||||
align: 'right'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
console.log(ui.toString())
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deno/ESM Support
|
|
||||||
|
|
||||||
As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and
|
|
||||||
[ESM](https://nodejs.org/api/esm.html#esm_ecmascript_modules):
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import cliui from "https://deno.land/x/cliui/deno.ts";
|
|
||||||
|
|
||||||
const ui = cliui({})
|
|
||||||
|
|
||||||
ui.div('Usage: $0 [command] [options]')
|
|
||||||
|
|
||||||
ui.div({
|
|
||||||
text: 'Options:',
|
|
||||||
padding: [2, 0, 1, 0]
|
|
||||||
})
|
|
||||||
|
|
||||||
ui.div({
|
|
||||||
text: "-f, --file",
|
|
||||||
width: 20,
|
|
||||||
padding: [0, 4, 0, 4]
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log(ui.toString())
|
|
||||||
```
|
|
||||||
|
|
||||||
<img width="500" src="screenshot.png">
|
|
||||||
|
|
||||||
## Layout DSL
|
|
||||||
|
|
||||||
cliui exposes a simple layout DSL:
|
|
||||||
|
|
||||||
If you create a single `ui.div`, passing a string rather than an
|
|
||||||
object:
|
|
||||||
|
|
||||||
* `\n`: characters will be interpreted as new rows.
|
|
||||||
* `\t`: characters will be interpreted as new columns.
|
|
||||||
* `\s`: characters will be interpreted as padding.
|
|
||||||
|
|
||||||
**as an example...**
|
|
||||||
|
|
||||||
```js
|
|
||||||
var ui = require('./')({
|
|
||||||
width: 60
|
|
||||||
})
|
|
||||||
|
|
||||||
ui.div(
|
|
||||||
'Usage: node ./bin/foo.js\n' +
|
|
||||||
' <regex>\t provide a regex\n' +
|
|
||||||
' <glob>\t provide a glob\t [required]'
|
|
||||||
)
|
|
||||||
|
|
||||||
console.log(ui.toString())
|
|
||||||
```
|
|
||||||
|
|
||||||
**will output:**
|
|
||||||
|
|
||||||
```shell
|
|
||||||
Usage: node ./bin/foo.js
|
|
||||||
<regex> provide a regex
|
|
||||||
<glob> provide a glob [required]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
```js
|
|
||||||
cliui = require('cliui')
|
|
||||||
```
|
|
||||||
|
|
||||||
### cliui({width: integer})
|
|
||||||
|
|
||||||
Specify the maximum width of the UI being generated.
|
|
||||||
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
|
|
||||||
|
|
||||||
### cliui({wrap: boolean})
|
|
||||||
|
|
||||||
Enable or disable the wrapping of text in a column.
|
|
||||||
|
|
||||||
### cliui.div(column, column, column)
|
|
||||||
|
|
||||||
Create a row with any number of columns, a column
|
|
||||||
can either be a string, or an object with the following
|
|
||||||
options:
|
|
||||||
|
|
||||||
* **text:** some text to place in the column.
|
|
||||||
* **width:** the width of a column.
|
|
||||||
* **align:** alignment, `right` or `center`.
|
|
||||||
* **padding:** `[top, right, bottom, left]`.
|
|
||||||
* **border:** should a border be placed around the div?
|
|
||||||
|
|
||||||
### cliui.span(column, column, column)
|
|
||||||
|
|
||||||
Similar to `div`, except the next row will be appended without
|
|
||||||
a new line being created.
|
|
||||||
|
|
||||||
### cliui.resetOutput()
|
|
||||||
|
|
||||||
Resets the UI elements of the current cliui instance, maintaining the values
|
|
||||||
set for `width` and `wrap`.
|
|
317
app/node_modules/@isaacs/cliui/build/index.cjs
generated
vendored
@@ -1,317 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const align = {
|
|
||||||
right: alignRight,
|
|
||||||
center: alignCenter
|
|
||||||
};
|
|
||||||
const top = 0;
|
|
||||||
const right = 1;
|
|
||||||
const bottom = 2;
|
|
||||||
const left = 3;
|
|
||||||
class UI {
|
|
||||||
constructor(opts) {
|
|
||||||
var _a;
|
|
||||||
this.width = opts.width;
|
|
||||||
/* c8 ignore start */
|
|
||||||
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
this.rows = [];
|
|
||||||
}
|
|
||||||
span(...args) {
|
|
||||||
const cols = this.div(...args);
|
|
||||||
cols.span = true;
|
|
||||||
}
|
|
||||||
resetOutput() {
|
|
||||||
this.rows = [];
|
|
||||||
}
|
|
||||||
div(...args) {
|
|
||||||
if (args.length === 0) {
|
|
||||||
this.div('');
|
|
||||||
}
|
|
||||||
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
|
|
||||||
return this.applyLayoutDSL(args[0]);
|
|
||||||
}
|
|
||||||
const cols = args.map(arg => {
|
|
||||||
if (typeof arg === 'string') {
|
|
||||||
return this.colFromString(arg);
|
|
||||||
}
|
|
||||||
return arg;
|
|
||||||
});
|
|
||||||
this.rows.push(cols);
|
|
||||||
return cols;
|
|
||||||
}
|
|
||||||
shouldApplyLayoutDSL(...args) {
|
|
||||||
return args.length === 1 && typeof args[0] === 'string' &&
|
|
||||||
/[\t\n]/.test(args[0]);
|
|
||||||
}
|
|
||||||
applyLayoutDSL(str) {
|
|
||||||
const rows = str.split('\n').map(row => row.split('\t'));
|
|
||||||
let leftColumnWidth = 0;
|
|
||||||
// simple heuristic for layout, make sure the
|
|
||||||
// second column lines up along the left-hand.
|
|
||||||
// don't allow the first column to take up more
|
|
||||||
// than 50% of the screen.
|
|
||||||
rows.forEach(columns => {
|
|
||||||
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
|
||||||
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// generate a table:
|
|
||||||
// replacing ' ' with padding calculations.
|
|
||||||
// using the algorithmically generated width.
|
|
||||||
rows.forEach(columns => {
|
|
||||||
this.div(...columns.map((r, i) => {
|
|
||||||
return {
|
|
||||||
text: r.trim(),
|
|
||||||
padding: this.measurePadding(r),
|
|
||||||
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
return this.rows[this.rows.length - 1];
|
|
||||||
}
|
|
||||||
colFromString(text) {
|
|
||||||
return {
|
|
||||||
text,
|
|
||||||
padding: this.measurePadding(text)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
measurePadding(str) {
|
|
||||||
// measure padding without ansi escape codes
|
|
||||||
const noAnsi = mixin.stripAnsi(str);
|
|
||||||
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
const lines = [];
|
|
||||||
this.rows.forEach(row => {
|
|
||||||
this.rowToString(row, lines);
|
|
||||||
});
|
|
||||||
// don't display any lines with the
|
|
||||||
// hidden flag set.
|
|
||||||
return lines
|
|
||||||
.filter(line => !line.hidden)
|
|
||||||
.map(line => line.text)
|
|
||||||
.join('\n');
|
|
||||||
}
|
|
||||||
rowToString(row, lines) {
|
|
||||||
this.rasterize(row).forEach((rrow, r) => {
|
|
||||||
let str = '';
|
|
||||||
rrow.forEach((col, c) => {
|
|
||||||
const { width } = row[c]; // the width with padding.
|
|
||||||
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
|
|
||||||
let ts = col; // temporary string used during alignment/padding.
|
|
||||||
if (wrapWidth > mixin.stringWidth(col)) {
|
|
||||||
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
|
|
||||||
}
|
|
||||||
// align the string within its column.
|
|
||||||
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
|
||||||
const fn = align[row[c].align];
|
|
||||||
ts = fn(ts, wrapWidth);
|
|
||||||
if (mixin.stringWidth(ts) < wrapWidth) {
|
|
||||||
/* c8 ignore start */
|
|
||||||
const w = width || 0;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
ts += ' '.repeat(w - mixin.stringWidth(ts) - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// apply border and padding to string.
|
|
||||||
const padding = row[c].padding || [0, 0, 0, 0];
|
|
||||||
if (padding[left]) {
|
|
||||||
str += ' '.repeat(padding[left]);
|
|
||||||
}
|
|
||||||
str += addBorder(row[c], ts, '| ');
|
|
||||||
str += ts;
|
|
||||||
str += addBorder(row[c], ts, ' |');
|
|
||||||
if (padding[right]) {
|
|
||||||
str += ' '.repeat(padding[right]);
|
|
||||||
}
|
|
||||||
// if prior row is span, try to render the
|
|
||||||
// current row on the prior line.
|
|
||||||
if (r === 0 && lines.length > 0) {
|
|
||||||
str = this.renderInline(str, lines[lines.length - 1]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// remove trailing whitespace.
|
|
||||||
lines.push({
|
|
||||||
text: str.replace(/ +$/, ''),
|
|
||||||
span: row.span
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return lines;
|
|
||||||
}
|
|
||||||
// if the full 'source' can render in
|
|
||||||
// the target line, do so.
|
|
||||||
renderInline(source, previousLine) {
|
|
||||||
const match = source.match(/^ */);
|
|
||||||
/* c8 ignore start */
|
|
||||||
const leadingWhitespace = match ? match[0].length : 0;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
const target = previousLine.text;
|
|
||||||
const targetTextWidth = mixin.stringWidth(target.trimEnd());
|
|
||||||
if (!previousLine.span) {
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
// if we're not applying wrapping logic,
|
|
||||||
// just always append to the span.
|
|
||||||
if (!this.wrap) {
|
|
||||||
previousLine.hidden = true;
|
|
||||||
return target + source;
|
|
||||||
}
|
|
||||||
if (leadingWhitespace < targetTextWidth) {
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
previousLine.hidden = true;
|
|
||||||
return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart();
|
|
||||||
}
|
|
||||||
rasterize(row) {
|
|
||||||
const rrows = [];
|
|
||||||
const widths = this.columnWidths(row);
|
|
||||||
let wrapped;
|
|
||||||
// word wrap all columns, and create
|
|
||||||
// a data-structure that is easy to rasterize.
|
|
||||||
row.forEach((col, c) => {
|
|
||||||
// leave room for left and right padding.
|
|
||||||
col.width = widths[c];
|
|
||||||
if (this.wrap) {
|
|
||||||
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
wrapped = col.text.split('\n');
|
|
||||||
}
|
|
||||||
if (col.border) {
|
|
||||||
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
|
||||||
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
|
||||||
}
|
|
||||||
// add top and bottom padding.
|
|
||||||
if (col.padding) {
|
|
||||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
|
||||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
|
||||||
}
|
|
||||||
wrapped.forEach((str, r) => {
|
|
||||||
if (!rrows[r]) {
|
|
||||||
rrows.push([]);
|
|
||||||
}
|
|
||||||
const rrow = rrows[r];
|
|
||||||
for (let i = 0; i < c; i++) {
|
|
||||||
if (rrow[i] === undefined) {
|
|
||||||
rrow.push('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rrow.push(str);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return rrows;
|
|
||||||
}
|
|
||||||
negatePadding(col) {
|
|
||||||
/* c8 ignore start */
|
|
||||||
let wrapWidth = col.width || 0;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
if (col.padding) {
|
|
||||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
|
||||||
}
|
|
||||||
if (col.border) {
|
|
||||||
wrapWidth -= 4;
|
|
||||||
}
|
|
||||||
return wrapWidth;
|
|
||||||
}
|
|
||||||
columnWidths(row) {
|
|
||||||
if (!this.wrap) {
|
|
||||||
return row.map(col => {
|
|
||||||
return col.width || mixin.stringWidth(col.text);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let unset = row.length;
|
|
||||||
let remainingWidth = this.width;
|
|
||||||
// column widths can be set in config.
|
|
||||||
const widths = row.map(col => {
|
|
||||||
if (col.width) {
|
|
||||||
unset--;
|
|
||||||
remainingWidth -= col.width;
|
|
||||||
return col.width;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
});
|
|
||||||
// any unset widths should be calculated.
|
|
||||||
/* c8 ignore start */
|
|
||||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
return widths.map((w, i) => {
|
|
||||||
if (w === undefined) {
|
|
||||||
return Math.max(unsetWidth, _minWidth(row[i]));
|
|
||||||
}
|
|
||||||
return w;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function addBorder(col, ts, style) {
|
|
||||||
if (col.border) {
|
|
||||||
if (/[.']-+[.']/.test(ts)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
if (ts.trim().length !== 0) {
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
return ' ';
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
// calculates the minimum width of
|
|
||||||
// a column, based on padding preferences.
|
|
||||||
function _minWidth(col) {
|
|
||||||
const padding = col.padding || [];
|
|
||||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
|
||||||
if (col.border) {
|
|
||||||
return minWidth + 4;
|
|
||||||
}
|
|
||||||
return minWidth;
|
|
||||||
}
|
|
||||||
function getWindowWidth() {
|
|
||||||
/* c8 ignore start */
|
|
||||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
|
||||||
return process.stdout.columns;
|
|
||||||
}
|
|
||||||
return 80;
|
|
||||||
}
|
|
||||||
/* c8 ignore stop */
|
|
||||||
function alignRight(str, width) {
|
|
||||||
str = str.trim();
|
|
||||||
const strWidth = mixin.stringWidth(str);
|
|
||||||
if (strWidth < width) {
|
|
||||||
return ' '.repeat(width - strWidth) + str;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
function alignCenter(str, width) {
|
|
||||||
str = str.trim();
|
|
||||||
const strWidth = mixin.stringWidth(str);
|
|
||||||
/* c8 ignore start */
|
|
||||||
if (strWidth >= width) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
/* c8 ignore stop */
|
|
||||||
return ' '.repeat((width - strWidth) >> 1) + str;
|
|
||||||
}
|
|
||||||
let mixin;
|
|
||||||
function cliui(opts, _mixin) {
|
|
||||||
mixin = _mixin;
|
|
||||||
return new UI({
|
|
||||||
/* c8 ignore start */
|
|
||||||
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
|
||||||
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
|
||||||
/* c8 ignore stop */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bootstrap cliui with CommonJS dependencies:
|
|
||||||
const stringWidth = require('string-width-cjs');
|
|
||||||
const stripAnsi = require('strip-ansi-cjs');
|
|
||||||
const wrap = require('wrap-ansi-cjs');
|
|
||||||
function ui(opts) {
|
|
||||||
return cliui(opts, {
|
|
||||||
stringWidth,
|
|
||||||
stripAnsi,
|
|
||||||
wrap
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = ui;
|
|
43
app/node_modules/@isaacs/cliui/build/index.d.cts
generated
vendored
@@ -1,43 +0,0 @@
|
|||||||
interface UIOptions {
|
|
||||||
width: number;
|
|
||||||
wrap?: boolean;
|
|
||||||
rows?: string[];
|
|
||||||
}
|
|
||||||
interface Column {
|
|
||||||
text: string;
|
|
||||||
width?: number;
|
|
||||||
align?: "right" | "left" | "center";
|
|
||||||
padding: number[];
|
|
||||||
border?: boolean;
|
|
||||||
}
|
|
||||||
interface ColumnArray extends Array<Column> {
|
|
||||||
span: boolean;
|
|
||||||
}
|
|
||||||
interface Line {
|
|
||||||
hidden?: boolean;
|
|
||||||
text: string;
|
|
||||||
span?: boolean;
|
|
||||||
}
|
|
||||||
declare class UI {
|
|
||||||
width: number;
|
|
||||||
wrap: boolean;
|
|
||||||
rows: ColumnArray[];
|
|
||||||
constructor(opts: UIOptions);
|
|
||||||
span(...args: ColumnArray): void;
|
|
||||||
resetOutput(): void;
|
|
||||||
div(...args: (Column | string)[]): ColumnArray;
|
|
||||||
private shouldApplyLayoutDSL;
|
|
||||||
private applyLayoutDSL;
|
|
||||||
private colFromString;
|
|
||||||
private measurePadding;
|
|
||||||
toString(): string;
|
|
||||||
rowToString(row: ColumnArray, lines: Line[]): Line[];
|
|
||||||
// if the full 'source' can render in
|
|
||||||
// the target line, do so.
|
|
||||||
private renderInline;
|
|
||||||
private rasterize;
|
|
||||||
private negatePadding;
|
|
||||||
private columnWidths;
|
|
||||||
}
|
|
||||||
declare function ui(opts: UIOptions): UI;
|
|
||||||
export { ui as default };
|
|
302
app/node_modules/@isaacs/cliui/build/lib/index.js
generated
vendored
@@ -1,302 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
const align = {
|
|
||||||
right: alignRight,
|
|
||||||
center: alignCenter
|
|
||||||
};
|
|
||||||
const top = 0;
|
|
||||||
const right = 1;
|
|
||||||
const bottom = 2;
|
|
||||||
const left = 3;
|
|
||||||
export class UI {
|
|
||||||
constructor(opts) {
|
|
||||||
var _a;
|
|
||||||
this.width = opts.width;
|
|
||||||
/* c8 ignore start */
|
|
||||||
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
this.rows = [];
|
|
||||||
}
|
|
||||||
span(...args) {
|
|
||||||
const cols = this.div(...args);
|
|
||||||
cols.span = true;
|
|
||||||
}
|
|
||||||
resetOutput() {
|
|
||||||
this.rows = [];
|
|
||||||
}
|
|
||||||
div(...args) {
|
|
||||||
if (args.length === 0) {
|
|
||||||
this.div('');
|
|
||||||
}
|
|
||||||
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
|
|
||||||
return this.applyLayoutDSL(args[0]);
|
|
||||||
}
|
|
||||||
const cols = args.map(arg => {
|
|
||||||
if (typeof arg === 'string') {
|
|
||||||
return this.colFromString(arg);
|
|
||||||
}
|
|
||||||
return arg;
|
|
||||||
});
|
|
||||||
this.rows.push(cols);
|
|
||||||
return cols;
|
|
||||||
}
|
|
||||||
shouldApplyLayoutDSL(...args) {
|
|
||||||
return args.length === 1 && typeof args[0] === 'string' &&
|
|
||||||
/[\t\n]/.test(args[0]);
|
|
||||||
}
|
|
||||||
applyLayoutDSL(str) {
|
|
||||||
const rows = str.split('\n').map(row => row.split('\t'));
|
|
||||||
let leftColumnWidth = 0;
|
|
||||||
// simple heuristic for layout, make sure the
|
|
||||||
// second column lines up along the left-hand.
|
|
||||||
// don't allow the first column to take up more
|
|
||||||
// than 50% of the screen.
|
|
||||||
rows.forEach(columns => {
|
|
||||||
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
|
||||||
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// generate a table:
|
|
||||||
// replacing ' ' with padding calculations.
|
|
||||||
// using the algorithmically generated width.
|
|
||||||
rows.forEach(columns => {
|
|
||||||
this.div(...columns.map((r, i) => {
|
|
||||||
return {
|
|
||||||
text: r.trim(),
|
|
||||||
padding: this.measurePadding(r),
|
|
||||||
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
return this.rows[this.rows.length - 1];
|
|
||||||
}
|
|
||||||
colFromString(text) {
|
|
||||||
return {
|
|
||||||
text,
|
|
||||||
padding: this.measurePadding(text)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
measurePadding(str) {
|
|
||||||
// measure padding without ansi escape codes
|
|
||||||
const noAnsi = mixin.stripAnsi(str);
|
|
||||||
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
const lines = [];
|
|
||||||
this.rows.forEach(row => {
|
|
||||||
this.rowToString(row, lines);
|
|
||||||
});
|
|
||||||
// don't display any lines with the
|
|
||||||
// hidden flag set.
|
|
||||||
return lines
|
|
||||||
.filter(line => !line.hidden)
|
|
||||||
.map(line => line.text)
|
|
||||||
.join('\n');
|
|
||||||
}
|
|
||||||
rowToString(row, lines) {
|
|
||||||
this.rasterize(row).forEach((rrow, r) => {
|
|
||||||
let str = '';
|
|
||||||
rrow.forEach((col, c) => {
|
|
||||||
const { width } = row[c]; // the width with padding.
|
|
||||||
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
|
|
||||||
let ts = col; // temporary string used during alignment/padding.
|
|
||||||
if (wrapWidth > mixin.stringWidth(col)) {
|
|
||||||
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
|
|
||||||
}
|
|
||||||
// align the string within its column.
|
|
||||||
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
|
||||||
const fn = align[row[c].align];
|
|
||||||
ts = fn(ts, wrapWidth);
|
|
||||||
if (mixin.stringWidth(ts) < wrapWidth) {
|
|
||||||
/* c8 ignore start */
|
|
||||||
const w = width || 0;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
ts += ' '.repeat(w - mixin.stringWidth(ts) - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// apply border and padding to string.
|
|
||||||
const padding = row[c].padding || [0, 0, 0, 0];
|
|
||||||
if (padding[left]) {
|
|
||||||
str += ' '.repeat(padding[left]);
|
|
||||||
}
|
|
||||||
str += addBorder(row[c], ts, '| ');
|
|
||||||
str += ts;
|
|
||||||
str += addBorder(row[c], ts, ' |');
|
|
||||||
if (padding[right]) {
|
|
||||||
str += ' '.repeat(padding[right]);
|
|
||||||
}
|
|
||||||
// if prior row is span, try to render the
|
|
||||||
// current row on the prior line.
|
|
||||||
if (r === 0 && lines.length > 0) {
|
|
||||||
str = this.renderInline(str, lines[lines.length - 1]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// remove trailing whitespace.
|
|
||||||
lines.push({
|
|
||||||
text: str.replace(/ +$/, ''),
|
|
||||||
span: row.span
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return lines;
|
|
||||||
}
|
|
||||||
// if the full 'source' can render in
|
|
||||||
// the target line, do so.
|
|
||||||
renderInline(source, previousLine) {
|
|
||||||
const match = source.match(/^ */);
|
|
||||||
/* c8 ignore start */
|
|
||||||
const leadingWhitespace = match ? match[0].length : 0;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
const target = previousLine.text;
|
|
||||||
const targetTextWidth = mixin.stringWidth(target.trimEnd());
|
|
||||||
if (!previousLine.span) {
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
// if we're not applying wrapping logic,
|
|
||||||
// just always append to the span.
|
|
||||||
if (!this.wrap) {
|
|
||||||
previousLine.hidden = true;
|
|
||||||
return target + source;
|
|
||||||
}
|
|
||||||
if (leadingWhitespace < targetTextWidth) {
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
previousLine.hidden = true;
|
|
||||||
return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart();
|
|
||||||
}
|
|
||||||
rasterize(row) {
|
|
||||||
const rrows = [];
|
|
||||||
const widths = this.columnWidths(row);
|
|
||||||
let wrapped;
|
|
||||||
// word wrap all columns, and create
|
|
||||||
// a data-structure that is easy to rasterize.
|
|
||||||
row.forEach((col, c) => {
|
|
||||||
// leave room for left and right padding.
|
|
||||||
col.width = widths[c];
|
|
||||||
if (this.wrap) {
|
|
||||||
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
wrapped = col.text.split('\n');
|
|
||||||
}
|
|
||||||
if (col.border) {
|
|
||||||
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
|
||||||
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
|
||||||
}
|
|
||||||
// add top and bottom padding.
|
|
||||||
if (col.padding) {
|
|
||||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
|
||||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
|
||||||
}
|
|
||||||
wrapped.forEach((str, r) => {
|
|
||||||
if (!rrows[r]) {
|
|
||||||
rrows.push([]);
|
|
||||||
}
|
|
||||||
const rrow = rrows[r];
|
|
||||||
for (let i = 0; i < c; i++) {
|
|
||||||
if (rrow[i] === undefined) {
|
|
||||||
rrow.push('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rrow.push(str);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return rrows;
|
|
||||||
}
|
|
||||||
negatePadding(col) {
|
|
||||||
/* c8 ignore start */
|
|
||||||
let wrapWidth = col.width || 0;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
if (col.padding) {
|
|
||||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
|
||||||
}
|
|
||||||
if (col.border) {
|
|
||||||
wrapWidth -= 4;
|
|
||||||
}
|
|
||||||
return wrapWidth;
|
|
||||||
}
|
|
||||||
columnWidths(row) {
|
|
||||||
if (!this.wrap) {
|
|
||||||
return row.map(col => {
|
|
||||||
return col.width || mixin.stringWidth(col.text);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let unset = row.length;
|
|
||||||
let remainingWidth = this.width;
|
|
||||||
// column widths can be set in config.
|
|
||||||
const widths = row.map(col => {
|
|
||||||
if (col.width) {
|
|
||||||
unset--;
|
|
||||||
remainingWidth -= col.width;
|
|
||||||
return col.width;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
});
|
|
||||||
// any unset widths should be calculated.
|
|
||||||
/* c8 ignore start */
|
|
||||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
|
||||||
/* c8 ignore stop */
|
|
||||||
return widths.map((w, i) => {
|
|
||||||
if (w === undefined) {
|
|
||||||
return Math.max(unsetWidth, _minWidth(row[i]));
|
|
||||||
}
|
|
||||||
return w;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function addBorder(col, ts, style) {
|
|
||||||
if (col.border) {
|
|
||||||
if (/[.']-+[.']/.test(ts)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
if (ts.trim().length !== 0) {
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
return ' ';
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
// calculates the minimum width of
|
|
||||||
// a column, based on padding preferences.
|
|
||||||
function _minWidth(col) {
|
|
||||||
const padding = col.padding || [];
|
|
||||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
|
||||||
if (col.border) {
|
|
||||||
return minWidth + 4;
|
|
||||||
}
|
|
||||||
return minWidth;
|
|
||||||
}
|
|
||||||
function getWindowWidth() {
|
|
||||||
/* c8 ignore start */
|
|
||||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
|
||||||
return process.stdout.columns;
|
|
||||||
}
|
|
||||||
return 80;
|
|
||||||
}
|
|
||||||
/* c8 ignore stop */
|
|
||||||
function alignRight(str, width) {
|
|
||||||
str = str.trim();
|
|
||||||
const strWidth = mixin.stringWidth(str);
|
|
||||||
if (strWidth < width) {
|
|
||||||
return ' '.repeat(width - strWidth) + str;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
function alignCenter(str, width) {
|
|
||||||
str = str.trim();
|
|
||||||
const strWidth = mixin.stringWidth(str);
|
|
||||||
/* c8 ignore start */
|
|
||||||
if (strWidth >= width) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
/* c8 ignore stop */
|
|
||||||
return ' '.repeat((width - strWidth) >> 1) + str;
|
|
||||||
}
|
|
||||||
let mixin;
|
|
||||||
export function cliui(opts, _mixin) {
|
|
||||||
mixin = _mixin;
|
|
||||||
return new UI({
|
|
||||||
/* c8 ignore start */
|
|
||||||
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
|
||||||
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
|
||||||
/* c8 ignore stop */
|
|
||||||
});
|
|
||||||
}
|
|
14
app/node_modules/@isaacs/cliui/index.mjs
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
// Bootstrap cliui with ESM dependencies:
|
|
||||||
import { cliui } from './build/lib/index.js'
|
|
||||||
|
|
||||||
import stringWidth from 'string-width'
|
|
||||||
import stripAnsi from 'strip-ansi'
|
|
||||||
import wrap from 'wrap-ansi'
|
|
||||||
|
|
||||||
export default function ui (opts) {
|
|
||||||
return cliui(opts, {
|
|
||||||
stringWidth,
|
|
||||||
stripAnsi,
|
|
||||||
wrap
|
|
||||||
})
|
|
||||||
}
|
|
122
app/node_modules/@isaacs/cliui/package.json
generated
vendored
@@ -1,122 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "@isaacs/cliui@^8.0.2",
|
|
||||||
"_id": "@isaacs/cliui@8.0.2",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
|
|
||||||
"_location": "/@isaacs/cliui",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "range",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@isaacs/cliui@^8.0.2",
|
|
||||||
"name": "@isaacs/cliui",
|
|
||||||
"escapedName": "@isaacs%2fcliui",
|
|
||||||
"scope": "@isaacs",
|
|
||||||
"rawSpec": "^8.0.2",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "^8.0.2"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/jackspeak"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
|
||||||
"_shasum": "b37667b7bc181c168782259bab42474fbf52b550",
|
|
||||||
"_spec": "@isaacs/cliui@^8.0.2",
|
|
||||||
"_where": "/mnt/c/Users/docto/Downloads/Rappaurio/node_modules/jackspeak",
|
|
||||||
"author": {
|
|
||||||
"name": "Ben Coe",
|
|
||||||
"email": "ben@npmjs.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/yargs/cliui/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"dependencies": {
|
|
||||||
"string-width": "^5.1.2",
|
|
||||||
"string-width-cjs": "npm:string-width@^4.2.0",
|
|
||||||
"strip-ansi": "^7.0.1",
|
|
||||||
"strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
|
|
||||||
"wrap-ansi": "^8.1.0",
|
|
||||||
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
|
|
||||||
},
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "easily create complex multi-column command-line-interfaces",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^14.0.27",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^4.0.0",
|
|
||||||
"@typescript-eslint/parser": "^4.0.0",
|
|
||||||
"c8": "^7.3.0",
|
|
||||||
"chai": "^4.2.0",
|
|
||||||
"chalk": "^4.1.0",
|
|
||||||
"cross-env": "^7.0.2",
|
|
||||||
"eslint": "^7.6.0",
|
|
||||||
"eslint-plugin-import": "^2.22.0",
|
|
||||||
"eslint-plugin-node": "^11.1.0",
|
|
||||||
"gts": "^3.0.0",
|
|
||||||
"mocha": "^10.0.0",
|
|
||||||
"rimraf": "^3.0.2",
|
|
||||||
"rollup": "^2.23.1",
|
|
||||||
"rollup-plugin-ts": "^3.0.2",
|
|
||||||
"standardx": "^7.0.0",
|
|
||||||
"typescript": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
},
|
|
||||||
"exports": {
|
|
||||||
".": [
|
|
||||||
{
|
|
||||||
"import": "./index.mjs",
|
|
||||||
"require": "./build/index.cjs"
|
|
||||||
},
|
|
||||||
"./build/index.cjs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"build",
|
|
||||||
"index.mjs",
|
|
||||||
"!*.d.ts"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/yargs/cliui#readme",
|
|
||||||
"keywords": [
|
|
||||||
"cli",
|
|
||||||
"command-line",
|
|
||||||
"layout",
|
|
||||||
"design",
|
|
||||||
"console",
|
|
||||||
"wrap",
|
|
||||||
"table"
|
|
||||||
],
|
|
||||||
"license": "ISC",
|
|
||||||
"main": "build/index.cjs",
|
|
||||||
"module": "./index.mjs",
|
|
||||||
"name": "@isaacs/cliui",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/yargs/cliui.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build:cjs": "rollup -c",
|
|
||||||
"check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
|
|
||||||
"compile": "tsc",
|
|
||||||
"coverage": "c8 report --check-coverage",
|
|
||||||
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
|
|
||||||
"postcompile": "npm run build:cjs",
|
|
||||||
"postest": "check",
|
|
||||||
"precompile": "rimraf build",
|
|
||||||
"prepare": "npm run compile",
|
|
||||||
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
|
|
||||||
"test": "c8 mocha ./test/*.cjs",
|
|
||||||
"test:esm": "c8 mocha ./test/**/*.mjs"
|
|
||||||
},
|
|
||||||
"standard": {
|
|
||||||
"ignore": [
|
|
||||||
"**/example/**"
|
|
||||||
],
|
|
||||||
"globals": [
|
|
||||||
"it"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"type": "module",
|
|
||||||
"version": "8.0.2"
|
|
||||||
}
|
|
14
app/node_modules/@pkgjs/parseargs/.editorconfig
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
# EditorConfig is awesome: http://EditorConfig.org
|
|
||||||
|
|
||||||
# top-most EditorConfig file
|
|
||||||
root = true
|
|
||||||
|
|
||||||
# Copied from Node.js to ease compatibility in PR.
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
|
||||||
indent_size = 2
|
|
||||||
indent_style = space
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
quote_type = single
|
|
147
app/node_modules/@pkgjs/parseargs/CHANGELOG.md
generated
vendored
@@ -1,147 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## [0.11.0](https://github.com/pkgjs/parseargs/compare/v0.10.0...v0.11.0) (2022-10-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add `default` option parameter ([#142](https://github.com/pkgjs/parseargs/issues/142)) ([cd20847](https://github.com/pkgjs/parseargs/commit/cd20847a00b2f556aa9c085ac83b942c60868ec1))
|
|
||||||
|
|
||||||
## [0.10.0](https://github.com/pkgjs/parseargs/compare/v0.9.1...v0.10.0) (2022-07-21)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add parsed meta-data to returned properties ([#129](https://github.com/pkgjs/parseargs/issues/129)) ([91bfb4d](https://github.com/pkgjs/parseargs/commit/91bfb4d3f7b6937efab1b27c91c45d1205f1497e))
|
|
||||||
|
|
||||||
## [0.9.1](https://github.com/pkgjs/parseargs/compare/v0.9.0...v0.9.1) (2022-06-20)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **runtime:** support node 14+ ([#135](https://github.com/pkgjs/parseargs/issues/135)) ([6a1c5a6](https://github.com/pkgjs/parseargs/commit/6a1c5a6f7cadf2f035e004027e2742e3c4ce554b))
|
|
||||||
|
|
||||||
## [0.9.0](https://github.com/pkgjs/parseargs/compare/v0.8.0...v0.9.0) (2022-05-23)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* drop handling of electron arguments (#121)
|
|
||||||
|
|
||||||
### Code Refactoring
|
|
||||||
|
|
||||||
* drop handling of electron arguments ([#121](https://github.com/pkgjs/parseargs/issues/121)) ([a2ffd53](https://github.com/pkgjs/parseargs/commit/a2ffd537c244a062371522b955acb45a404fc9f2))
|
|
||||||
|
|
||||||
## [0.8.0](https://github.com/pkgjs/parseargs/compare/v0.7.1...v0.8.0) (2022-05-16)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* switch type:string option arguments to greedy, but with error for suspect cases in strict mode (#88)
|
|
||||||
* positionals now opt-in when strict:true (#116)
|
|
||||||
* create result.values with null prototype (#111)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* create result.values with null prototype ([#111](https://github.com/pkgjs/parseargs/issues/111)) ([9d539c3](https://github.com/pkgjs/parseargs/commit/9d539c3d57f269c160e74e0656ad4fa84ff92ec2))
|
|
||||||
* positionals now opt-in when strict:true ([#116](https://github.com/pkgjs/parseargs/issues/116)) ([3643338](https://github.com/pkgjs/parseargs/commit/364333826b746e8a7dc5505b4b22fd19ac51df3b))
|
|
||||||
* switch type:string option arguments to greedy, but with error for suspect cases in strict mode ([#88](https://github.com/pkgjs/parseargs/issues/88)) ([c2b5e72](https://github.com/pkgjs/parseargs/commit/c2b5e72161991dfdc535909f1327cc9b970fe7e8))
|
|
||||||
|
|
||||||
### [0.7.1](https://github.com/pkgjs/parseargs/compare/v0.7.0...v0.7.1) (2022-04-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* resist pollution ([#106](https://github.com/pkgjs/parseargs/issues/106)) ([ecf2dec](https://github.com/pkgjs/parseargs/commit/ecf2dece0a9f2a76d789384d5d71c68ffe64022a))
|
|
||||||
|
|
||||||
## [0.7.0](https://github.com/pkgjs/parseargs/compare/v0.6.0...v0.7.0) (2022-04-13)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* Add strict mode to parser ([#74](https://github.com/pkgjs/parseargs/issues/74)) ([8267d02](https://github.com/pkgjs/parseargs/commit/8267d02083a87b8b8a71fcce08348d1e031ea91c))
|
|
||||||
|
|
||||||
## [0.6.0](https://github.com/pkgjs/parseargs/compare/v0.5.0...v0.6.0) (2022-04-11)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* rework results to remove redundant `flags` property and store value true for boolean options (#83)
|
|
||||||
* switch to existing ERR_INVALID_ARG_VALUE (#97)
|
|
||||||
|
|
||||||
### Code Refactoring
|
|
||||||
|
|
||||||
* rework results to remove redundant `flags` property and store value true for boolean options ([#83](https://github.com/pkgjs/parseargs/issues/83)) ([be153db](https://github.com/pkgjs/parseargs/commit/be153dbed1d488cb7b6e27df92f601ba7337713d))
|
|
||||||
* switch to existing ERR_INVALID_ARG_VALUE ([#97](https://github.com/pkgjs/parseargs/issues/97)) ([084a23f](https://github.com/pkgjs/parseargs/commit/084a23f9fde2da030b159edb1c2385f24579ce40))
|
|
||||||
|
|
||||||
## [0.5.0](https://github.com/pkgjs/parseargs/compare/v0.4.0...v0.5.0) (2022-04-10)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* Require type to be specified for each supplied option (#95)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* Require type to be specified for each supplied option ([#95](https://github.com/pkgjs/parseargs/issues/95)) ([02cd018](https://github.com/pkgjs/parseargs/commit/02cd01885b8aaa59f2db8308f2d4479e64340068))
|
|
||||||
|
|
||||||
## [0.4.0](https://github.com/pkgjs/parseargs/compare/v0.3.0...v0.4.0) (2022-03-12)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* parsing, revisit short option groups, add support for combined short and value (#75)
|
|
||||||
* restructure configuration to take options bag (#63)
|
|
||||||
|
|
||||||
### Code Refactoring
|
|
||||||
|
|
||||||
* parsing, revisit short option groups, add support for combined short and value ([#75](https://github.com/pkgjs/parseargs/issues/75)) ([a92600f](https://github.com/pkgjs/parseargs/commit/a92600fa6c214508ab1e016fa55879a314f541af))
|
|
||||||
* restructure configuration to take options bag ([#63](https://github.com/pkgjs/parseargs/issues/63)) ([b412095](https://github.com/pkgjs/parseargs/commit/b4120957d90e809ee8b607b06e747d3e6a6b213e))
|
|
||||||
|
|
||||||
## [0.3.0](https://github.com/pkgjs/parseargs/compare/v0.2.0...v0.3.0) (2022-02-06)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **parser:** support short-option groups ([#59](https://github.com/pkgjs/parseargs/issues/59)) ([882067b](https://github.com/pkgjs/parseargs/commit/882067bc2d7cbc6b796f8e5a079a99bc99d4e6ba))
|
|
||||||
|
|
||||||
## [0.2.0](https://github.com/pkgjs/parseargs/compare/v0.1.1...v0.2.0) (2022-02-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* basic support for shorts ([#50](https://github.com/pkgjs/parseargs/issues/50)) ([a2f36d7](https://github.com/pkgjs/parseargs/commit/a2f36d7da4145af1c92f76806b7fe2baf6beeceb))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* always store value for a=b ([#43](https://github.com/pkgjs/parseargs/issues/43)) ([a85e8dc](https://github.com/pkgjs/parseargs/commit/a85e8dc06379fd2696ee195cc625de8fac6aee42))
|
|
||||||
* support single dash as positional ([#49](https://github.com/pkgjs/parseargs/issues/49)) ([d795bf8](https://github.com/pkgjs/parseargs/commit/d795bf877d068fd67aec381f30b30b63f97109ad))
|
|
||||||
|
|
||||||
### [0.1.1](https://github.com/pkgjs/parseargs/compare/v0.1.0...v0.1.1) (2022-01-25)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* only use arrays in results for multiples ([#42](https://github.com/pkgjs/parseargs/issues/42)) ([c357584](https://github.com/pkgjs/parseargs/commit/c357584847912506319ed34a0840080116f4fd65))
|
|
||||||
|
|
||||||
## 0.1.0 (2022-01-22)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* expand scenarios covered by default arguments for environments ([#20](https://github.com/pkgjs/parseargs/issues/20)) ([582ada7](https://github.com/pkgjs/parseargs/commit/582ada7be0eca3a73d6e0bd016e7ace43449fa4c))
|
|
||||||
* update readme and include contributing guidelines ([8edd6fc](https://github.com/pkgjs/parseargs/commit/8edd6fc863cd705f6fac732724159ebe8065a2b0))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* do not strip excess leading dashes on long option names ([#21](https://github.com/pkgjs/parseargs/issues/21)) ([f848590](https://github.com/pkgjs/parseargs/commit/f848590ebf3249ed5979ff47e003fa6e1a8ec5c0))
|
|
||||||
* name & readme ([3f057c1](https://github.com/pkgjs/parseargs/commit/3f057c1b158a1bdbe878c64b57460c58e56e465f))
|
|
||||||
* package.json values ([9bac300](https://github.com/pkgjs/parseargs/commit/9bac300e00cd76c77076bf9e75e44f8929512da9))
|
|
||||||
* update readme name ([957d8d9](https://github.com/pkgjs/parseargs/commit/957d8d96e1dcb48297c0a14345d44c0123b2883e))
|
|
||||||
|
|
||||||
|
|
||||||
### Build System
|
|
||||||
|
|
||||||
* first release as minor ([421c6e2](https://github.com/pkgjs/parseargs/commit/421c6e2569a8668ad14fac5a5af5be60479a7571))
|
|
201
app/node_modules/@pkgjs/parseargs/LICENSE
generated
vendored
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
413
app/node_modules/@pkgjs/parseargs/README.md
generated
vendored
@@ -1,413 +0,0 @@
|
|||||||
<!-- omit in toc -->
|
|
||||||
# parseArgs
|
|
||||||
|
|
||||||
[![Coverage][coverage-image]][coverage-url]
|
|
||||||
|
|
||||||
Polyfill of `util.parseArgs()`
|
|
||||||
|
|
||||||
## `util.parseArgs([config])`
|
|
||||||
|
|
||||||
<!-- YAML
|
|
||||||
added: v18.3.0
|
|
||||||
changes:
|
|
||||||
- version: REPLACEME
|
|
||||||
pr-url: https://github.com/nodejs/node/pull/43459
|
|
||||||
description: add support for returning detailed parse information
|
|
||||||
using `tokens` in input `config` and returned properties.
|
|
||||||
-->
|
|
||||||
|
|
||||||
> Stability: 1 - Experimental
|
|
||||||
|
|
||||||
* `config` {Object} Used to provide arguments for parsing and to configure
|
|
||||||
the parser. `config` supports the following properties:
|
|
||||||
* `args` {string\[]} array of argument strings. **Default:** `process.argv`
|
|
||||||
with `execPath` and `filename` removed.
|
|
||||||
* `options` {Object} Used to describe arguments known to the parser.
|
|
||||||
Keys of `options` are the long names of options and values are an
|
|
||||||
{Object} accepting the following properties:
|
|
||||||
* `type` {string} Type of argument, which must be either `boolean` or `string`.
|
|
||||||
* `multiple` {boolean} Whether this option can be provided multiple
|
|
||||||
times. If `true`, all values will be collected in an array. If
|
|
||||||
`false`, values for the option are last-wins. **Default:** `false`.
|
|
||||||
* `short` {string} A single character alias for the option.
|
|
||||||
* `default` {string | boolean | string\[] | boolean\[]} The default option
|
|
||||||
value when it is not set by args. It must be of the same type as the
|
|
||||||
the `type` property. When `multiple` is `true`, it must be an array.
|
|
||||||
* `strict` {boolean} Should an error be thrown when unknown arguments
|
|
||||||
are encountered, or when arguments are passed that do not match the
|
|
||||||
`type` configured in `options`.
|
|
||||||
**Default:** `true`.
|
|
||||||
* `allowPositionals` {boolean} Whether this command accepts positional
|
|
||||||
arguments.
|
|
||||||
**Default:** `false` if `strict` is `true`, otherwise `true`.
|
|
||||||
* `tokens` {boolean} Return the parsed tokens. This is useful for extending
|
|
||||||
the built-in behavior, from adding additional checks through to reprocessing
|
|
||||||
the tokens in different ways.
|
|
||||||
**Default:** `false`.
|
|
||||||
|
|
||||||
* Returns: {Object} The parsed command line arguments:
|
|
||||||
* `values` {Object} A mapping of parsed option names with their {string}
|
|
||||||
or {boolean} values.
|
|
||||||
* `positionals` {string\[]} Positional arguments.
|
|
||||||
* `tokens` {Object\[] | undefined} See [parseArgs tokens](#parseargs-tokens)
|
|
||||||
section. Only returned if `config` includes `tokens: true`.
|
|
||||||
|
|
||||||
Provides a higher level API for command-line argument parsing than interacting
|
|
||||||
with `process.argv` directly. Takes a specification for the expected arguments
|
|
||||||
and returns a structured object with the parsed options and positionals.
|
|
||||||
|
|
||||||
```mjs
|
|
||||||
import { parseArgs } from 'node:util';
|
|
||||||
const args = ['-f', '--bar', 'b'];
|
|
||||||
const options = {
|
|
||||||
foo: {
|
|
||||||
type: 'boolean',
|
|
||||||
short: 'f'
|
|
||||||
},
|
|
||||||
bar: {
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const {
|
|
||||||
values,
|
|
||||||
positionals
|
|
||||||
} = parseArgs({ args, options });
|
|
||||||
console.log(values, positionals);
|
|
||||||
// Prints: [Object: null prototype] { foo: true, bar: 'b' } []
|
|
||||||
```
|
|
||||||
|
|
||||||
```cjs
|
|
||||||
const { parseArgs } = require('node:util');
|
|
||||||
const args = ['-f', '--bar', 'b'];
|
|
||||||
const options = {
|
|
||||||
foo: {
|
|
||||||
type: 'boolean',
|
|
||||||
short: 'f'
|
|
||||||
},
|
|
||||||
bar: {
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const {
|
|
||||||
values,
|
|
||||||
positionals
|
|
||||||
} = parseArgs({ args, options });
|
|
||||||
console.log(values, positionals);
|
|
||||||
// Prints: [Object: null prototype] { foo: true, bar: 'b' } []
|
|
||||||
```
|
|
||||||
|
|
||||||
`util.parseArgs` is experimental and behavior may change. Join the
|
|
||||||
conversation in [pkgjs/parseargs][] to contribute to the design.
|
|
||||||
|
|
||||||
### `parseArgs` `tokens`
|
|
||||||
|
|
||||||
Detailed parse information is available for adding custom behaviours by
|
|
||||||
specifying `tokens: true` in the configuration.
|
|
||||||
The returned tokens have properties describing:
|
|
||||||
|
|
||||||
* all tokens
|
|
||||||
* `kind` {string} One of 'option', 'positional', or 'option-terminator'.
|
|
||||||
* `index` {number} Index of element in `args` containing token. So the
|
|
||||||
source argument for a token is `args[token.index]`.
|
|
||||||
* option tokens
|
|
||||||
* `name` {string} Long name of option.
|
|
||||||
* `rawName` {string} How option used in args, like `-f` of `--foo`.
|
|
||||||
* `value` {string | undefined} Option value specified in args.
|
|
||||||
Undefined for boolean options.
|
|
||||||
* `inlineValue` {boolean | undefined} Whether option value specified inline,
|
|
||||||
like `--foo=bar`.
|
|
||||||
* positional tokens
|
|
||||||
* `value` {string} The value of the positional argument in args (i.e. `args[index]`).
|
|
||||||
* option-terminator token
|
|
||||||
|
|
||||||
The returned tokens are in the order encountered in the input args. Options
|
|
||||||
that appear more than once in args produce a token for each use. Short option
|
|
||||||
groups like `-xy` expand to a token for each option. So `-xxx` produces
|
|
||||||
three tokens.
|
|
||||||
|
|
||||||
For example to use the returned tokens to add support for a negated option
|
|
||||||
like `--no-color`, the tokens can be reprocessed to change the value stored
|
|
||||||
for the negated option.
|
|
||||||
|
|
||||||
```mjs
|
|
||||||
import { parseArgs } from 'node:util';
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
'color': { type: 'boolean' },
|
|
||||||
'no-color': { type: 'boolean' },
|
|
||||||
'logfile': { type: 'string' },
|
|
||||||
'no-logfile': { type: 'boolean' },
|
|
||||||
};
|
|
||||||
const { values, tokens } = parseArgs({ options, tokens: true });
|
|
||||||
|
|
||||||
// Reprocess the option tokens and overwrite the returned values.
|
|
||||||
tokens
|
|
||||||
.filter((token) => token.kind === 'option')
|
|
||||||
.forEach((token) => {
|
|
||||||
if (token.name.startsWith('no-')) {
|
|
||||||
// Store foo:false for --no-foo
|
|
||||||
const positiveName = token.name.slice(3);
|
|
||||||
values[positiveName] = false;
|
|
||||||
delete values[token.name];
|
|
||||||
} else {
|
|
||||||
// Resave value so last one wins if both --foo and --no-foo.
|
|
||||||
values[token.name] = token.value ?? true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const color = values.color;
|
|
||||||
const logfile = values.logfile ?? 'default.log';
|
|
||||||
|
|
||||||
console.log({ logfile, color });
|
|
||||||
```
|
|
||||||
|
|
||||||
```cjs
|
|
||||||
const { parseArgs } = require('node:util');
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
'color': { type: 'boolean' },
|
|
||||||
'no-color': { type: 'boolean' },
|
|
||||||
'logfile': { type: 'string' },
|
|
||||||
'no-logfile': { type: 'boolean' },
|
|
||||||
};
|
|
||||||
const { values, tokens } = parseArgs({ options, tokens: true });
|
|
||||||
|
|
||||||
// Reprocess the option tokens and overwrite the returned values.
|
|
||||||
tokens
|
|
||||||
.filter((token) => token.kind === 'option')
|
|
||||||
.forEach((token) => {
|
|
||||||
if (token.name.startsWith('no-')) {
|
|
||||||
// Store foo:false for --no-foo
|
|
||||||
const positiveName = token.name.slice(3);
|
|
||||||
values[positiveName] = false;
|
|
||||||
delete values[token.name];
|
|
||||||
} else {
|
|
||||||
// Resave value so last one wins if both --foo and --no-foo.
|
|
||||||
values[token.name] = token.value ?? true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const color = values.color;
|
|
||||||
const logfile = values.logfile ?? 'default.log';
|
|
||||||
|
|
||||||
console.log({ logfile, color });
|
|
||||||
```
|
|
||||||
|
|
||||||
Example usage showing negated options, and when an option is used
|
|
||||||
multiple ways then last one wins.
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ node negate.js
|
|
||||||
{ logfile: 'default.log', color: undefined }
|
|
||||||
$ node negate.js --no-logfile --no-color
|
|
||||||
{ logfile: false, color: false }
|
|
||||||
$ node negate.js --logfile=test.log --color
|
|
||||||
{ logfile: 'test.log', color: true }
|
|
||||||
$ node negate.js --no-logfile --logfile=test.log --color --no-color
|
|
||||||
{ logfile: 'test.log', color: false }
|
|
||||||
```
|
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
<!-- omit in toc -->
|
|
||||||
## Table of Contents
|
|
||||||
- [`util.parseArgs([config])`](#utilparseargsconfig)
|
|
||||||
- [Scope](#scope)
|
|
||||||
- [Version Matchups](#version-matchups)
|
|
||||||
- [🚀 Getting Started](#-getting-started)
|
|
||||||
- [🙌 Contributing](#-contributing)
|
|
||||||
- [💡 `process.mainArgs` Proposal](#-processmainargs-proposal)
|
|
||||||
- [Implementation:](#implementation)
|
|
||||||
- [📃 Examples](#-examples)
|
|
||||||
- [F.A.Qs](#faqs)
|
|
||||||
- [Links & Resources](#links--resources)
|
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
It is already possible to build great arg parsing modules on top of what Node.js provides; the prickly API is abstracted away by these modules. Thus, process.parseArgs() is not necessarily intended for library authors; it is intended for developers of simple CLI tools, ad-hoc scripts, deployed Node.js applications, and learning materials.
|
|
||||||
|
|
||||||
It is exceedingly difficult to provide an API which would both be friendly to these Node.js users while being extensible enough for libraries to build upon. We chose to prioritize these use cases because these are currently not well-served by Node.js' API.
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
## Version Matchups
|
|
||||||
|
|
||||||
| Node.js | @pkgjs/parseArgs |
|
|
||||||
| -- | -- |
|
|
||||||
| [v18.3.0](https://nodejs.org/docs/latest-v18.x/api/util.html#utilparseargsconfig) | [v0.9.1](https://github.com/pkgjs/parseargs/tree/v0.9.1#utilparseargsconfig) |
|
|
||||||
| [v16.17.0](https://nodejs.org/dist/latest-v16.x/docs/api/util.html#utilparseargsconfig), [v18.7.0](https://nodejs.org/docs/latest-v18.x/api/util.html#utilparseargsconfig) | [0.10.0](https://github.com/pkgjs/parseargs/tree/v0.10.0#utilparseargsconfig) |
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
## 🚀 Getting Started
|
|
||||||
|
|
||||||
1. **Install dependencies.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Open the index.js file and start editing!**
|
|
||||||
|
|
||||||
3. **Test your code by calling parseArgs through our test file**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm test
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
## 🙌 Contributing
|
|
||||||
|
|
||||||
Any person who wants to contribute to the initiative is welcome! Please first read the [Contributing Guide](CONTRIBUTING.md)
|
|
||||||
|
|
||||||
Additionally, reading the [`Examples w/ Output`](#-examples-w-output) section of this document will be the best way to familiarize yourself with the target expected behavior for parseArgs() once it is fully implemented.
|
|
||||||
|
|
||||||
This package was implemented using [tape](https://www.npmjs.com/package/tape) as its test harness.
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
## 💡 `process.mainArgs` Proposal
|
|
||||||
|
|
||||||
> Note: This can be moved forward independently of the `util.parseArgs()` proposal/work.
|
|
||||||
|
|
||||||
### Implementation:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
process.mainArgs = process.argv.slice(process._exec ? 1 : 2)
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
## 📃 Examples
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { parseArgs } = require('@pkgjs/parseargs');
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { parseArgs } = require('@pkgjs/parseargs');
|
|
||||||
// specify the options that may be used
|
|
||||||
const options = {
|
|
||||||
foo: { type: 'string'},
|
|
||||||
bar: { type: 'boolean' },
|
|
||||||
};
|
|
||||||
const args = ['--foo=a', '--bar'];
|
|
||||||
const { values, positionals } = parseArgs({ args, options });
|
|
||||||
// values = { foo: 'a', bar: true }
|
|
||||||
// positionals = []
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { parseArgs } = require('@pkgjs/parseargs');
|
|
||||||
// type:string & multiple
|
|
||||||
const options = {
|
|
||||||
foo: {
|
|
||||||
type: 'string',
|
|
||||||
multiple: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const args = ['--foo=a', '--foo', 'b'];
|
|
||||||
const { values, positionals } = parseArgs({ args, options });
|
|
||||||
// values = { foo: [ 'a', 'b' ] }
|
|
||||||
// positionals = []
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { parseArgs } = require('@pkgjs/parseargs');
|
|
||||||
// shorts
|
|
||||||
const options = {
|
|
||||||
foo: {
|
|
||||||
short: 'f',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const args = ['-f', 'b'];
|
|
||||||
const { values, positionals } = parseArgs({ args, options, allowPositionals: true });
|
|
||||||
// values = { foo: true }
|
|
||||||
// positionals = ['b']
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { parseArgs } = require('@pkgjs/parseargs');
|
|
||||||
// unconfigured
|
|
||||||
const options = {};
|
|
||||||
const args = ['-f', '--foo=a', '--bar', 'b'];
|
|
||||||
const { values, positionals } = parseArgs({ strict: false, args, options, allowPositionals: true });
|
|
||||||
// values = { f: true, foo: 'a', bar: true }
|
|
||||||
// positionals = ['b']
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
## F.A.Qs
|
|
||||||
|
|
||||||
- Is `cmd --foo=bar baz` the same as `cmd baz --foo=bar`?
|
|
||||||
- yes
|
|
||||||
- Does the parser execute a function?
|
|
||||||
- no
|
|
||||||
- Does the parser execute one of several functions, depending on input?
|
|
||||||
- no
|
|
||||||
- Can subcommands take options that are distinct from the main command?
|
|
||||||
- no
|
|
||||||
- Does it output generated help when no options match?
|
|
||||||
- no
|
|
||||||
- Does it generated short usage? Like: `usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]`
|
|
||||||
- no (no usage/help at all)
|
|
||||||
- Does the user provide the long usage text? For each option? For the whole command?
|
|
||||||
- no
|
|
||||||
- Do subcommands (if implemented) have their own usage output?
|
|
||||||
- no
|
|
||||||
- Does usage print if the user runs `cmd --help`?
|
|
||||||
- no
|
|
||||||
- Does it set `process.exitCode`?
|
|
||||||
- no
|
|
||||||
- Does usage print to stderr or stdout?
|
|
||||||
- N/A
|
|
||||||
- Does it check types? (Say, specify that an option is a boolean, number, etc.)
|
|
||||||
- no
|
|
||||||
- Can an option have more than one type? (string or false, for example)
|
|
||||||
- no
|
|
||||||
- Can the user define a type? (Say, `type: path` to call `path.resolve()` on the argument.)
|
|
||||||
- no
|
|
||||||
- Does a `--foo=0o22` mean 0, 22, 18, or "0o22"?
|
|
||||||
- `"0o22"`
|
|
||||||
- Does it coerce types?
|
|
||||||
- no
|
|
||||||
- Does `--no-foo` coerce to `--foo=false`? For all options? Only boolean options?
|
|
||||||
- no, it sets `{values:{'no-foo': true}}`
|
|
||||||
- Is `--foo` the same as `--foo=true`? Only for known booleans? Only at the end?
|
|
||||||
- no, they are not the same. There is no special handling of `true` as a value so it is just another string.
|
|
||||||
- Does it read environment variables? Ie, is `FOO=1 cmd` the same as `cmd --foo=1`?
|
|
||||||
- no
|
|
||||||
- Do unknown arguments raise an error? Are they parsed? Are they treated as positional arguments?
|
|
||||||
- no, they are parsed, not treated as positionals
|
|
||||||
- Does `--` signal the end of options?
|
|
||||||
- yes
|
|
||||||
- Is `--` included as a positional?
|
|
||||||
- no
|
|
||||||
- Is `program -- foo` the same as `program foo`?
|
|
||||||
- yes, both store `{positionals:['foo']}`
|
|
||||||
- Does the API specify whether a `--` was present/relevant?
|
|
||||||
- no
|
|
||||||
- Is `-bar` the same as `--bar`?
|
|
||||||
- no, `-bar` is a short option or options, with expansion logic that follows the
|
|
||||||
[Utility Syntax Guidelines in POSIX.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html). `-bar` expands to `-b`, `-a`, `-r`.
|
|
||||||
- Is `---foo` the same as `--foo`?
|
|
||||||
- no
|
|
||||||
- the first is a long option named `'-foo'`
|
|
||||||
- the second is a long option named `'foo'`
|
|
||||||
- Is `-` a positional? ie, `bash some-test.sh | tap -`
|
|
||||||
- yes
|
|
||||||
|
|
||||||
## Links & Resources
|
|
||||||
|
|
||||||
* [Initial Tooling Issue](https://github.com/nodejs/tooling/issues/19)
|
|
||||||
* [Initial Proposal](https://github.com/nodejs/node/pull/35015)
|
|
||||||
* [parseArgs Proposal](https://github.com/nodejs/node/pull/42675)
|
|
||||||
|
|
||||||
[coverage-image]: https://img.shields.io/nycrc/pkgjs/parseargs
|
|
||||||
[coverage-url]: https://github.com/pkgjs/parseargs/blob/main/.nycrc
|
|
||||||
[pkgjs/parseargs]: https://github.com/pkgjs/parseargs
|
|
25
app/node_modules/@pkgjs/parseargs/examples/is-default-value.js
generated
vendored
@@ -1,25 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This example shows how to understand if a default value is used or not.
|
|
||||||
|
|
||||||
// 1. const { parseArgs } = require('node:util'); // from node
|
|
||||||
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
|
||||||
const { parseArgs } = require('..'); // in repo
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
file: { short: 'f', type: 'string', default: 'FOO' },
|
|
||||||
};
|
|
||||||
|
|
||||||
const { values, tokens } = parseArgs({ options, tokens: true });
|
|
||||||
|
|
||||||
const isFileDefault = !tokens.some((token) => token.kind === 'option' &&
|
|
||||||
token.name === 'file'
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(values);
|
|
||||||
console.log(`Is the file option [${values.file}] the default value? ${isFileDefault}`);
|
|
||||||
|
|
||||||
// Try the following:
|
|
||||||
// node is-default-value.js
|
|
||||||
// node is-default-value.js -f FILE
|
|
||||||
// node is-default-value.js --file FILE
|
|
35
app/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This is an example of using tokens to add a custom behaviour.
|
|
||||||
//
|
|
||||||
// Require the use of `=` for long options and values by blocking
|
|
||||||
// the use of space separated values.
|
|
||||||
// So allow `--foo=bar`, and not allow `--foo bar`.
|
|
||||||
//
|
|
||||||
// Note: this is not a common behaviour, most CLIs allow both forms.
|
|
||||||
|
|
||||||
// 1. const { parseArgs } = require('node:util'); // from node
|
|
||||||
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
|
||||||
const { parseArgs } = require('..'); // in repo
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
file: { short: 'f', type: 'string' },
|
|
||||||
log: { type: 'string' },
|
|
||||||
};
|
|
||||||
|
|
||||||
const { values, tokens } = parseArgs({ options, tokens: true });
|
|
||||||
|
|
||||||
const badToken = tokens.find((token) => token.kind === 'option' &&
|
|
||||||
token.value != null &&
|
|
||||||
token.rawName.startsWith('--') &&
|
|
||||||
!token.inlineValue
|
|
||||||
);
|
|
||||||
if (badToken) {
|
|
||||||
throw new Error(`Option value for '${badToken.rawName}' must be inline, like '${badToken.rawName}=VALUE'`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values);
|
|
||||||
|
|
||||||
// Try the following:
|
|
||||||
// node limit-long-syntax.js -f FILE --log=LOG
|
|
||||||
// node limit-long-syntax.js --file FILE
|
|
43
app/node_modules/@pkgjs/parseargs/examples/negate.js
generated
vendored
@@ -1,43 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This example is used in the documentation.
|
|
||||||
|
|
||||||
// How might I add my own support for --no-foo?
|
|
||||||
|
|
||||||
// 1. const { parseArgs } = require('node:util'); // from node
|
|
||||||
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
|
||||||
const { parseArgs } = require('..'); // in repo
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
'color': { type: 'boolean' },
|
|
||||||
'no-color': { type: 'boolean' },
|
|
||||||
'logfile': { type: 'string' },
|
|
||||||
'no-logfile': { type: 'boolean' },
|
|
||||||
};
|
|
||||||
const { values, tokens } = parseArgs({ options, tokens: true });
|
|
||||||
|
|
||||||
// Reprocess the option tokens and overwrite the returned values.
|
|
||||||
tokens
|
|
||||||
.filter((token) => token.kind === 'option')
|
|
||||||
.forEach((token) => {
|
|
||||||
if (token.name.startsWith('no-')) {
|
|
||||||
// Store foo:false for --no-foo
|
|
||||||
const positiveName = token.name.slice(3);
|
|
||||||
values[positiveName] = false;
|
|
||||||
delete values[token.name];
|
|
||||||
} else {
|
|
||||||
// Resave value so last one wins if both --foo and --no-foo.
|
|
||||||
values[token.name] = token.value ?? true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const color = values.color;
|
|
||||||
const logfile = values.logfile ?? 'default.log';
|
|
||||||
|
|
||||||
console.log({ logfile, color });
|
|
||||||
|
|
||||||
// Try the following:
|
|
||||||
// node negate.js
|
|
||||||
// node negate.js --no-logfile --no-color
|
|
||||||
// negate.js --logfile=test.log --color
|
|
||||||
// node negate.js --no-logfile --logfile=test.log --color --no-color
|
|
31
app/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js
generated
vendored
@@ -1,31 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This is an example of using tokens to add a custom behaviour.
|
|
||||||
//
|
|
||||||
// Throw an error if an option is used more than once.
|
|
||||||
|
|
||||||
// 1. const { parseArgs } = require('node:util'); // from node
|
|
||||||
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
|
||||||
const { parseArgs } = require('..'); // in repo
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
ding: { type: 'boolean', short: 'd' },
|
|
||||||
beep: { type: 'boolean', short: 'b' }
|
|
||||||
};
|
|
||||||
const { values, tokens } = parseArgs({ options, tokens: true });
|
|
||||||
|
|
||||||
const seenBefore = new Set();
|
|
||||||
tokens.forEach((token) => {
|
|
||||||
if (token.kind !== 'option') return;
|
|
||||||
if (seenBefore.has(token.name)) {
|
|
||||||
throw new Error(`option '${token.name}' used multiple times`);
|
|
||||||
}
|
|
||||||
seenBefore.add(token.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(values);
|
|
||||||
|
|
||||||
// Try the following:
|
|
||||||
// node no-repeated-options --ding --beep
|
|
||||||
// node no-repeated-options --beep -b
|
|
||||||
// node no-repeated-options -ddd
|
|
41
app/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs
generated
vendored
@@ -1,41 +0,0 @@
|
|||||||
// This is an example of using tokens to add a custom behaviour.
|
|
||||||
//
|
|
||||||
// This adds a option order check so that --some-unstable-option
|
|
||||||
// may only be used after --enable-experimental-options
|
|
||||||
//
|
|
||||||
// Note: this is not a common behaviour, the order of different options
|
|
||||||
// does not usually matter.
|
|
||||||
|
|
||||||
import { parseArgs } from '../index.js';
|
|
||||||
|
|
||||||
function findTokenIndex(tokens, target) {
|
|
||||||
return tokens.findIndex((token) => token.kind === 'option' &&
|
|
||||||
token.name === target
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const experimentalName = 'enable-experimental-options';
|
|
||||||
const unstableName = 'some-unstable-option';
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
[experimentalName]: { type: 'boolean' },
|
|
||||||
[unstableName]: { type: 'boolean' },
|
|
||||||
};
|
|
||||||
|
|
||||||
const { values, tokens } = parseArgs({ options, tokens: true });
|
|
||||||
|
|
||||||
const experimentalIndex = findTokenIndex(tokens, experimentalName);
|
|
||||||
const unstableIndex = findTokenIndex(tokens, unstableName);
|
|
||||||
if (unstableIndex !== -1 &&
|
|
||||||
((experimentalIndex === -1) || (unstableIndex < experimentalIndex))) {
|
|
||||||
throw new Error(`'--${experimentalName}' must be specified before '--${unstableName}'`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values);
|
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
|
||||||
// Try the following:
|
|
||||||
// node ordered-options.mjs
|
|
||||||
// node ordered-options.mjs --some-unstable-option
|
|
||||||
// node ordered-options.mjs --some-unstable-option --enable-experimental-options
|
|
||||||
// node ordered-options.mjs --enable-experimental-options --some-unstable-option
|
|
26
app/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js
generated
vendored
@@ -1,26 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This example is used in the documentation.
|
|
||||||
|
|
||||||
// 1. const { parseArgs } = require('node:util'); // from node
|
|
||||||
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
|
||||||
const { parseArgs } = require('..'); // in repo
|
|
||||||
|
|
||||||
const args = ['-f', '--bar', 'b'];
|
|
||||||
const options = {
|
|
||||||
foo: {
|
|
||||||
type: 'boolean',
|
|
||||||
short: 'f'
|
|
||||||
},
|
|
||||||
bar: {
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const {
|
|
||||||
values,
|
|
||||||
positionals
|
|
||||||
} = parseArgs({ args, options });
|
|
||||||
console.log(values, positionals);
|
|
||||||
|
|
||||||
// Try the following:
|
|
||||||
// node simple-hard-coded.js
|
|
396
app/node_modules/@pkgjs/parseargs/index.js
generated
vendored
@@ -1,396 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const {
|
|
||||||
ArrayPrototypeForEach,
|
|
||||||
ArrayPrototypeIncludes,
|
|
||||||
ArrayPrototypeMap,
|
|
||||||
ArrayPrototypePush,
|
|
||||||
ArrayPrototypePushApply,
|
|
||||||
ArrayPrototypeShift,
|
|
||||||
ArrayPrototypeSlice,
|
|
||||||
ArrayPrototypeUnshiftApply,
|
|
||||||
ObjectEntries,
|
|
||||||
ObjectPrototypeHasOwnProperty: ObjectHasOwn,
|
|
||||||
StringPrototypeCharAt,
|
|
||||||
StringPrototypeIndexOf,
|
|
||||||
StringPrototypeSlice,
|
|
||||||
StringPrototypeStartsWith,
|
|
||||||
} = require('./internal/primordials');
|
|
||||||
|
|
||||||
const {
|
|
||||||
validateArray,
|
|
||||||
validateBoolean,
|
|
||||||
validateBooleanArray,
|
|
||||||
validateObject,
|
|
||||||
validateString,
|
|
||||||
validateStringArray,
|
|
||||||
validateUnion,
|
|
||||||
} = require('./internal/validators');
|
|
||||||
|
|
||||||
const {
|
|
||||||
kEmptyObject,
|
|
||||||
} = require('./internal/util');
|
|
||||||
|
|
||||||
const {
|
|
||||||
findLongOptionForShort,
|
|
||||||
isLoneLongOption,
|
|
||||||
isLoneShortOption,
|
|
||||||
isLongOptionAndValue,
|
|
||||||
isOptionValue,
|
|
||||||
isOptionLikeValue,
|
|
||||||
isShortOptionAndValue,
|
|
||||||
isShortOptionGroup,
|
|
||||||
useDefaultValueOption,
|
|
||||||
objectGetOwn,
|
|
||||||
optionsGetOwn,
|
|
||||||
} = require('./utils');
|
|
||||||
|
|
||||||
const {
|
|
||||||
codes: {
|
|
||||||
ERR_INVALID_ARG_VALUE,
|
|
||||||
ERR_PARSE_ARGS_INVALID_OPTION_VALUE,
|
|
||||||
ERR_PARSE_ARGS_UNKNOWN_OPTION,
|
|
||||||
ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL,
|
|
||||||
},
|
|
||||||
} = require('./internal/errors');
|
|
||||||
|
|
||||||
function getMainArgs() {
|
|
||||||
// Work out where to slice process.argv for user supplied arguments.
|
|
||||||
|
|
||||||
// Check node options for scenarios where user CLI args follow executable.
|
|
||||||
const execArgv = process.execArgv;
|
|
||||||
if (ArrayPrototypeIncludes(execArgv, '-e') ||
|
|
||||||
ArrayPrototypeIncludes(execArgv, '--eval') ||
|
|
||||||
ArrayPrototypeIncludes(execArgv, '-p') ||
|
|
||||||
ArrayPrototypeIncludes(execArgv, '--print')) {
|
|
||||||
return ArrayPrototypeSlice(process.argv, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normally first two arguments are executable and script, then CLI arguments
|
|
||||||
return ArrayPrototypeSlice(process.argv, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In strict mode, throw for possible usage errors like --foo --bar
|
|
||||||
*
|
|
||||||
* @param {object} token - from tokens as available from parseArgs
|
|
||||||
*/
|
|
||||||
function checkOptionLikeValue(token) {
|
|
||||||
if (!token.inlineValue && isOptionLikeValue(token.value)) {
|
|
||||||
// Only show short example if user used short option.
|
|
||||||
const example = StringPrototypeStartsWith(token.rawName, '--') ?
|
|
||||||
`'${token.rawName}=-XYZ'` :
|
|
||||||
`'--${token.name}=-XYZ' or '${token.rawName}-XYZ'`;
|
|
||||||
const errorMessage = `Option '${token.rawName}' argument is ambiguous.
|
|
||||||
Did you forget to specify the option argument for '${token.rawName}'?
|
|
||||||
To specify an option argument starting with a dash use ${example}.`;
|
|
||||||
throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(errorMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In strict mode, throw for usage errors.
|
|
||||||
*
|
|
||||||
* @param {object} config - from config passed to parseArgs
|
|
||||||
* @param {object} token - from tokens as available from parseArgs
|
|
||||||
*/
|
|
||||||
function checkOptionUsage(config, token) {
|
|
||||||
if (!ObjectHasOwn(config.options, token.name)) {
|
|
||||||
throw new ERR_PARSE_ARGS_UNKNOWN_OPTION(
|
|
||||||
token.rawName, config.allowPositionals);
|
|
||||||
}
|
|
||||||
|
|
||||||
const short = optionsGetOwn(config.options, token.name, 'short');
|
|
||||||
const shortAndLong = `${short ? `-${short}, ` : ''}--${token.name}`;
|
|
||||||
const type = optionsGetOwn(config.options, token.name, 'type');
|
|
||||||
if (type === 'string' && typeof token.value !== 'string') {
|
|
||||||
throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong} <value>' argument missing`);
|
|
||||||
}
|
|
||||||
// (Idiomatic test for undefined||null, expecting undefined.)
|
|
||||||
if (type === 'boolean' && token.value != null) {
|
|
||||||
throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong}' does not take an argument`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store the option value in `values`.
|
|
||||||
*
|
|
||||||
* @param {string} longOption - long option name e.g. 'foo'
|
|
||||||
* @param {string|undefined} optionValue - value from user args
|
|
||||||
* @param {object} options - option configs, from parseArgs({ options })
|
|
||||||
* @param {object} values - option values returned in `values` by parseArgs
|
|
||||||
*/
|
|
||||||
function storeOption(longOption, optionValue, options, values) {
|
|
||||||
if (longOption === '__proto__') {
|
|
||||||
return; // No. Just no.
|
|
||||||
}
|
|
||||||
|
|
||||||
// We store based on the option value rather than option type,
|
|
||||||
// preserving the users intent for author to deal with.
|
|
||||||
const newValue = optionValue ?? true;
|
|
||||||
if (optionsGetOwn(options, longOption, 'multiple')) {
|
|
||||||
// Always store value in array, including for boolean.
|
|
||||||
// values[longOption] starts out not present,
|
|
||||||
// first value is added as new array [newValue],
|
|
||||||
// subsequent values are pushed to existing array.
|
|
||||||
// (note: values has null prototype, so simpler usage)
|
|
||||||
if (values[longOption]) {
|
|
||||||
ArrayPrototypePush(values[longOption], newValue);
|
|
||||||
} else {
|
|
||||||
values[longOption] = [newValue];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
values[longOption] = newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store the default option value in `values`.
|
|
||||||
*
|
|
||||||
* @param {string} longOption - long option name e.g. 'foo'
|
|
||||||
* @param {string
|
|
||||||
* | boolean
|
|
||||||
* | string[]
|
|
||||||
* | boolean[]} optionValue - default value from option config
|
|
||||||
* @param {object} values - option values returned in `values` by parseArgs
|
|
||||||
*/
|
|
||||||
function storeDefaultOption(longOption, optionValue, values) {
|
|
||||||
if (longOption === '__proto__') {
|
|
||||||
return; // No. Just no.
|
|
||||||
}
|
|
||||||
|
|
||||||
values[longOption] = optionValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process args and turn into identified tokens:
|
|
||||||
* - option (along with value, if any)
|
|
||||||
* - positional
|
|
||||||
* - option-terminator
|
|
||||||
*
|
|
||||||
* @param {string[]} args - from parseArgs({ args }) or mainArgs
|
|
||||||
* @param {object} options - option configs, from parseArgs({ options })
|
|
||||||
*/
|
|
||||||
function argsToTokens(args, options) {
|
|
||||||
const tokens = [];
|
|
||||||
let index = -1;
|
|
||||||
let groupCount = 0;
|
|
||||||
|
|
||||||
const remainingArgs = ArrayPrototypeSlice(args);
|
|
||||||
while (remainingArgs.length > 0) {
|
|
||||||
const arg = ArrayPrototypeShift(remainingArgs);
|
|
||||||
const nextArg = remainingArgs[0];
|
|
||||||
if (groupCount > 0)
|
|
||||||
groupCount--;
|
|
||||||
else
|
|
||||||
index++;
|
|
||||||
|
|
||||||
// Check if `arg` is an options terminator.
|
|
||||||
// Guideline 10 in https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
|
|
||||||
if (arg === '--') {
|
|
||||||
// Everything after a bare '--' is considered a positional argument.
|
|
||||||
ArrayPrototypePush(tokens, { kind: 'option-terminator', index });
|
|
||||||
ArrayPrototypePushApply(
|
|
||||||
tokens, ArrayPrototypeMap(remainingArgs, (arg) => {
|
|
||||||
return { kind: 'positional', index: ++index, value: arg };
|
|
||||||
})
|
|
||||||
);
|
|
||||||
break; // Finished processing args, leave while loop.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isLoneShortOption(arg)) {
|
|
||||||
// e.g. '-f'
|
|
||||||
const shortOption = StringPrototypeCharAt(arg, 1);
|
|
||||||
const longOption = findLongOptionForShort(shortOption, options);
|
|
||||||
let value;
|
|
||||||
let inlineValue;
|
|
||||||
if (optionsGetOwn(options, longOption, 'type') === 'string' &&
|
|
||||||
isOptionValue(nextArg)) {
|
|
||||||
// e.g. '-f', 'bar'
|
|
||||||
value = ArrayPrototypeShift(remainingArgs);
|
|
||||||
inlineValue = false;
|
|
||||||
}
|
|
||||||
ArrayPrototypePush(
|
|
||||||
tokens,
|
|
||||||
{ kind: 'option', name: longOption, rawName: arg,
|
|
||||||
index, value, inlineValue });
|
|
||||||
if (value != null) ++index;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isShortOptionGroup(arg, options)) {
|
|
||||||
// Expand -fXzy to -f -X -z -y
|
|
||||||
const expanded = [];
|
|
||||||
for (let index = 1; index < arg.length; index++) {
|
|
||||||
const shortOption = StringPrototypeCharAt(arg, index);
|
|
||||||
const longOption = findLongOptionForShort(shortOption, options);
|
|
||||||
if (optionsGetOwn(options, longOption, 'type') !== 'string' ||
|
|
||||||
index === arg.length - 1) {
|
|
||||||
// Boolean option, or last short in group. Well formed.
|
|
||||||
ArrayPrototypePush(expanded, `-${shortOption}`);
|
|
||||||
} else {
|
|
||||||
// String option in middle. Yuck.
|
|
||||||
// Expand -abfFILE to -a -b -fFILE
|
|
||||||
ArrayPrototypePush(expanded, `-${StringPrototypeSlice(arg, index)}`);
|
|
||||||
break; // finished short group
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ArrayPrototypeUnshiftApply(remainingArgs, expanded);
|
|
||||||
groupCount = expanded.length;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isShortOptionAndValue(arg, options)) {
|
|
||||||
// e.g. -fFILE
|
|
||||||
const shortOption = StringPrototypeCharAt(arg, 1);
|
|
||||||
const longOption = findLongOptionForShort(shortOption, options);
|
|
||||||
const value = StringPrototypeSlice(arg, 2);
|
|
||||||
ArrayPrototypePush(
|
|
||||||
tokens,
|
|
||||||
{ kind: 'option', name: longOption, rawName: `-${shortOption}`,
|
|
||||||
index, value, inlineValue: true });
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isLoneLongOption(arg)) {
|
|
||||||
// e.g. '--foo'
|
|
||||||
const longOption = StringPrototypeSlice(arg, 2);
|
|
||||||
let value;
|
|
||||||
let inlineValue;
|
|
||||||
if (optionsGetOwn(options, longOption, 'type') === 'string' &&
|
|
||||||
isOptionValue(nextArg)) {
|
|
||||||
// e.g. '--foo', 'bar'
|
|
||||||
value = ArrayPrototypeShift(remainingArgs);
|
|
||||||
inlineValue = false;
|
|
||||||
}
|
|
||||||
ArrayPrototypePush(
|
|
||||||
tokens,
|
|
||||||
{ kind: 'option', name: longOption, rawName: arg,
|
|
||||||
index, value, inlineValue });
|
|
||||||
if (value != null) ++index;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isLongOptionAndValue(arg)) {
|
|
||||||
// e.g. --foo=bar
|
|
||||||
const equalIndex = StringPrototypeIndexOf(arg, '=');
|
|
||||||
const longOption = StringPrototypeSlice(arg, 2, equalIndex);
|
|
||||||
const value = StringPrototypeSlice(arg, equalIndex + 1);
|
|
||||||
ArrayPrototypePush(
|
|
||||||
tokens,
|
|
||||||
{ kind: 'option', name: longOption, rawName: `--${longOption}`,
|
|
||||||
index, value, inlineValue: true });
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayPrototypePush(tokens, { kind: 'positional', index, value: arg });
|
|
||||||
}
|
|
||||||
|
|
||||||
return tokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
const parseArgs = (config = kEmptyObject) => {
|
|
||||||
const args = objectGetOwn(config, 'args') ?? getMainArgs();
|
|
||||||
const strict = objectGetOwn(config, 'strict') ?? true;
|
|
||||||
const allowPositionals = objectGetOwn(config, 'allowPositionals') ?? !strict;
|
|
||||||
const returnTokens = objectGetOwn(config, 'tokens') ?? false;
|
|
||||||
const options = objectGetOwn(config, 'options') ?? { __proto__: null };
|
|
||||||
// Bundle these up for passing to strict-mode checks.
|
|
||||||
const parseConfig = { args, strict, options, allowPositionals };
|
|
||||||
|
|
||||||
// Validate input configuration.
|
|
||||||
validateArray(args, 'args');
|
|
||||||
validateBoolean(strict, 'strict');
|
|
||||||
validateBoolean(allowPositionals, 'allowPositionals');
|
|
||||||
validateBoolean(returnTokens, 'tokens');
|
|
||||||
validateObject(options, 'options');
|
|
||||||
ArrayPrototypeForEach(
|
|
||||||
ObjectEntries(options),
|
|
||||||
({ 0: longOption, 1: optionConfig }) => {
|
|
||||||
validateObject(optionConfig, `options.${longOption}`);
|
|
||||||
|
|
||||||
// type is required
|
|
||||||
const optionType = objectGetOwn(optionConfig, 'type');
|
|
||||||
validateUnion(optionType, `options.${longOption}.type`, ['string', 'boolean']);
|
|
||||||
|
|
||||||
if (ObjectHasOwn(optionConfig, 'short')) {
|
|
||||||
const shortOption = optionConfig.short;
|
|
||||||
validateString(shortOption, `options.${longOption}.short`);
|
|
||||||
if (shortOption.length !== 1) {
|
|
||||||
throw new ERR_INVALID_ARG_VALUE(
|
|
||||||
`options.${longOption}.short`,
|
|
||||||
shortOption,
|
|
||||||
'must be a single character'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const multipleOption = objectGetOwn(optionConfig, 'multiple');
|
|
||||||
if (ObjectHasOwn(optionConfig, 'multiple')) {
|
|
||||||
validateBoolean(multipleOption, `options.${longOption}.multiple`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultValue = objectGetOwn(optionConfig, 'default');
|
|
||||||
if (defaultValue !== undefined) {
|
|
||||||
let validator;
|
|
||||||
switch (optionType) {
|
|
||||||
case 'string':
|
|
||||||
validator = multipleOption ? validateStringArray : validateString;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'boolean':
|
|
||||||
validator = multipleOption ? validateBooleanArray : validateBoolean;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
validator(defaultValue, `options.${longOption}.default`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Phase 1: identify tokens
|
|
||||||
const tokens = argsToTokens(args, options);
|
|
||||||
|
|
||||||
// Phase 2: process tokens into parsed option values and positionals
|
|
||||||
const result = {
|
|
||||||
values: { __proto__: null },
|
|
||||||
positionals: [],
|
|
||||||
};
|
|
||||||
if (returnTokens) {
|
|
||||||
result.tokens = tokens;
|
|
||||||
}
|
|
||||||
ArrayPrototypeForEach(tokens, (token) => {
|
|
||||||
if (token.kind === 'option') {
|
|
||||||
if (strict) {
|
|
||||||
checkOptionUsage(parseConfig, token);
|
|
||||||
checkOptionLikeValue(token);
|
|
||||||
}
|
|
||||||
storeOption(token.name, token.value, options, result.values);
|
|
||||||
} else if (token.kind === 'positional') {
|
|
||||||
if (!allowPositionals) {
|
|
||||||
throw new ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL(token.value);
|
|
||||||
}
|
|
||||||
ArrayPrototypePush(result.positionals, token.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Phase 3: fill in default values for missing args
|
|
||||||
ArrayPrototypeForEach(ObjectEntries(options), ({ 0: longOption,
|
|
||||||
1: optionConfig }) => {
|
|
||||||
const mustSetDefault = useDefaultValueOption(longOption,
|
|
||||||
optionConfig,
|
|
||||||
result.values);
|
|
||||||
if (mustSetDefault) {
|
|
||||||
storeDefaultOption(longOption,
|
|
||||||
objectGetOwn(optionConfig, 'default'),
|
|
||||||
result.values);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
parseArgs,
|
|
||||||
};
|
|
47
app/node_modules/@pkgjs/parseargs/internal/errors.js
generated
vendored
@@ -1,47 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
class ERR_INVALID_ARG_TYPE extends TypeError {
|
|
||||||
constructor(name, expected, actual) {
|
|
||||||
super(`${name} must be ${expected} got ${actual}`);
|
|
||||||
this.code = 'ERR_INVALID_ARG_TYPE';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ERR_INVALID_ARG_VALUE extends TypeError {
|
|
||||||
constructor(arg1, arg2, expected) {
|
|
||||||
super(`The property ${arg1} ${expected}. Received '${arg2}'`);
|
|
||||||
this.code = 'ERR_INVALID_ARG_VALUE';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ERR_PARSE_ARGS_INVALID_OPTION_VALUE extends Error {
|
|
||||||
constructor(message) {
|
|
||||||
super(message);
|
|
||||||
this.code = 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ERR_PARSE_ARGS_UNKNOWN_OPTION extends Error {
|
|
||||||
constructor(option, allowPositionals) {
|
|
||||||
const suggestDashDash = allowPositionals ? `. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${JSON.stringify(option)}` : '';
|
|
||||||
super(`Unknown option '${option}'${suggestDashDash}`);
|
|
||||||
this.code = 'ERR_PARSE_ARGS_UNKNOWN_OPTION';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL extends Error {
|
|
||||||
constructor(positional) {
|
|
||||||
super(`Unexpected argument '${positional}'. This command does not take positional arguments`);
|
|
||||||
this.code = 'ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
codes: {
|
|
||||||
ERR_INVALID_ARG_TYPE,
|
|
||||||
ERR_INVALID_ARG_VALUE,
|
|
||||||
ERR_PARSE_ARGS_INVALID_OPTION_VALUE,
|
|
||||||
ERR_PARSE_ARGS_UNKNOWN_OPTION,
|
|
||||||
ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL,
|
|
||||||
}
|
|
||||||
};
|
|
393
app/node_modules/@pkgjs/parseargs/internal/primordials.js
generated
vendored
@@ -1,393 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is copied from https://github.com/nodejs/node/blob/v14.19.3/lib/internal/per_context/primordials.js
|
|
||||||
under the following license:
|
|
||||||
|
|
||||||
Copyright Node.js contributors. All rights reserved.
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/* eslint-disable node-core/prefer-primordials */
|
|
||||||
|
|
||||||
// This file subclasses and stores the JS builtins that come from the VM
|
|
||||||
// so that Node.js's builtin modules do not need to later look these up from
|
|
||||||
// the global proxy, which can be mutated by users.
|
|
||||||
|
|
||||||
// Use of primordials have sometimes a dramatic impact on performance, please
|
|
||||||
// benchmark all changes made in performance-sensitive areas of the codebase.
|
|
||||||
// See: https://github.com/nodejs/node/pull/38248
|
|
||||||
|
|
||||||
const primordials = {};
|
|
||||||
|
|
||||||
const {
|
|
||||||
defineProperty: ReflectDefineProperty,
|
|
||||||
getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor,
|
|
||||||
ownKeys: ReflectOwnKeys,
|
|
||||||
} = Reflect;
|
|
||||||
|
|
||||||
// `uncurryThis` is equivalent to `func => Function.prototype.call.bind(func)`.
|
|
||||||
// It is using `bind.bind(call)` to avoid using `Function.prototype.bind`
|
|
||||||
// and `Function.prototype.call` after it may have been mutated by users.
|
|
||||||
const { apply, bind, call } = Function.prototype;
|
|
||||||
const uncurryThis = bind.bind(call);
|
|
||||||
primordials.uncurryThis = uncurryThis;
|
|
||||||
|
|
||||||
// `applyBind` is equivalent to `func => Function.prototype.apply.bind(func)`.
|
|
||||||
// It is using `bind.bind(apply)` to avoid using `Function.prototype.bind`
|
|
||||||
// and `Function.prototype.apply` after it may have been mutated by users.
|
|
||||||
const applyBind = bind.bind(apply);
|
|
||||||
primordials.applyBind = applyBind;
|
|
||||||
|
|
||||||
// Methods that accept a variable number of arguments, and thus it's useful to
|
|
||||||
// also create `${prefix}${key}Apply`, which uses `Function.prototype.apply`,
|
|
||||||
// instead of `Function.prototype.call`, and thus doesn't require iterator
|
|
||||||
// destructuring.
|
|
||||||
const varargsMethods = [
|
|
||||||
// 'ArrayPrototypeConcat' is omitted, because it performs the spread
|
|
||||||
// on its own for arrays and array-likes with a truthy
|
|
||||||
// @@isConcatSpreadable symbol property.
|
|
||||||
'ArrayOf',
|
|
||||||
'ArrayPrototypePush',
|
|
||||||
'ArrayPrototypeUnshift',
|
|
||||||
// 'FunctionPrototypeCall' is omitted, since there's 'ReflectApply'
|
|
||||||
// and 'FunctionPrototypeApply'.
|
|
||||||
'MathHypot',
|
|
||||||
'MathMax',
|
|
||||||
'MathMin',
|
|
||||||
'StringPrototypeConcat',
|
|
||||||
'TypedArrayOf',
|
|
||||||
];
|
|
||||||
|
|
||||||
function getNewKey(key) {
|
|
||||||
return typeof key === 'symbol' ?
|
|
||||||
`Symbol${key.description[7].toUpperCase()}${key.description.slice(8)}` :
|
|
||||||
`${key[0].toUpperCase()}${key.slice(1)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyAccessor(dest, prefix, key, { enumerable, get, set }) {
|
|
||||||
ReflectDefineProperty(dest, `${prefix}Get${key}`, {
|
|
||||||
value: uncurryThis(get),
|
|
||||||
enumerable
|
|
||||||
});
|
|
||||||
if (set !== undefined) {
|
|
||||||
ReflectDefineProperty(dest, `${prefix}Set${key}`, {
|
|
||||||
value: uncurryThis(set),
|
|
||||||
enumerable
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyPropsRenamed(src, dest, prefix) {
|
|
||||||
for (const key of ReflectOwnKeys(src)) {
|
|
||||||
const newKey = getNewKey(key);
|
|
||||||
const desc = ReflectGetOwnPropertyDescriptor(src, key);
|
|
||||||
if ('get' in desc) {
|
|
||||||
copyAccessor(dest, prefix, newKey, desc);
|
|
||||||
} else {
|
|
||||||
const name = `${prefix}${newKey}`;
|
|
||||||
ReflectDefineProperty(dest, name, desc);
|
|
||||||
if (varargsMethods.includes(name)) {
|
|
||||||
ReflectDefineProperty(dest, `${name}Apply`, {
|
|
||||||
// `src` is bound as the `this` so that the static `this` points
|
|
||||||
// to the object it was defined on,
|
|
||||||
// e.g.: `ArrayOfApply` gets a `this` of `Array`:
|
|
||||||
value: applyBind(desc.value, src),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyPropsRenamedBound(src, dest, prefix) {
|
|
||||||
for (const key of ReflectOwnKeys(src)) {
|
|
||||||
const newKey = getNewKey(key);
|
|
||||||
const desc = ReflectGetOwnPropertyDescriptor(src, key);
|
|
||||||
if ('get' in desc) {
|
|
||||||
copyAccessor(dest, prefix, newKey, desc);
|
|
||||||
} else {
|
|
||||||
const { value } = desc;
|
|
||||||
if (typeof value === 'function') {
|
|
||||||
desc.value = value.bind(src);
|
|
||||||
}
|
|
||||||
|
|
||||||
const name = `${prefix}${newKey}`;
|
|
||||||
ReflectDefineProperty(dest, name, desc);
|
|
||||||
if (varargsMethods.includes(name)) {
|
|
||||||
ReflectDefineProperty(dest, `${name}Apply`, {
|
|
||||||
value: applyBind(value, src),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyPrototype(src, dest, prefix) {
|
|
||||||
for (const key of ReflectOwnKeys(src)) {
|
|
||||||
const newKey = getNewKey(key);
|
|
||||||
const desc = ReflectGetOwnPropertyDescriptor(src, key);
|
|
||||||
if ('get' in desc) {
|
|
||||||
copyAccessor(dest, prefix, newKey, desc);
|
|
||||||
} else {
|
|
||||||
const { value } = desc;
|
|
||||||
if (typeof value === 'function') {
|
|
||||||
desc.value = uncurryThis(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
const name = `${prefix}${newKey}`;
|
|
||||||
ReflectDefineProperty(dest, name, desc);
|
|
||||||
if (varargsMethods.includes(name)) {
|
|
||||||
ReflectDefineProperty(dest, `${name}Apply`, {
|
|
||||||
value: applyBind(value),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create copies of configurable value properties of the global object
|
|
||||||
[
|
|
||||||
'Proxy',
|
|
||||||
'globalThis',
|
|
||||||
].forEach((name) => {
|
|
||||||
// eslint-disable-next-line no-restricted-globals
|
|
||||||
primordials[name] = globalThis[name];
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create copies of URI handling functions
|
|
||||||
[
|
|
||||||
decodeURI,
|
|
||||||
decodeURIComponent,
|
|
||||||
encodeURI,
|
|
||||||
encodeURIComponent,
|
|
||||||
].forEach((fn) => {
|
|
||||||
primordials[fn.name] = fn;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create copies of the namespace objects
|
|
||||||
[
|
|
||||||
'JSON',
|
|
||||||
'Math',
|
|
||||||
'Proxy',
|
|
||||||
'Reflect',
|
|
||||||
].forEach((name) => {
|
|
||||||
// eslint-disable-next-line no-restricted-globals
|
|
||||||
copyPropsRenamed(global[name], primordials, name);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create copies of intrinsic objects
|
|
||||||
[
|
|
||||||
'Array',
|
|
||||||
'ArrayBuffer',
|
|
||||||
'BigInt',
|
|
||||||
'BigInt64Array',
|
|
||||||
'BigUint64Array',
|
|
||||||
'Boolean',
|
|
||||||
'DataView',
|
|
||||||
'Date',
|
|
||||||
'Error',
|
|
||||||
'EvalError',
|
|
||||||
'Float32Array',
|
|
||||||
'Float64Array',
|
|
||||||
'Function',
|
|
||||||
'Int16Array',
|
|
||||||
'Int32Array',
|
|
||||||
'Int8Array',
|
|
||||||
'Map',
|
|
||||||
'Number',
|
|
||||||
'Object',
|
|
||||||
'RangeError',
|
|
||||||
'ReferenceError',
|
|
||||||
'RegExp',
|
|
||||||
'Set',
|
|
||||||
'String',
|
|
||||||
'Symbol',
|
|
||||||
'SyntaxError',
|
|
||||||
'TypeError',
|
|
||||||
'URIError',
|
|
||||||
'Uint16Array',
|
|
||||||
'Uint32Array',
|
|
||||||
'Uint8Array',
|
|
||||||
'Uint8ClampedArray',
|
|
||||||
'WeakMap',
|
|
||||||
'WeakSet',
|
|
||||||
].forEach((name) => {
|
|
||||||
// eslint-disable-next-line no-restricted-globals
|
|
||||||
const original = global[name];
|
|
||||||
primordials[name] = original;
|
|
||||||
copyPropsRenamed(original, primordials, name);
|
|
||||||
copyPrototype(original.prototype, primordials, `${name}Prototype`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create copies of intrinsic objects that require a valid `this` to call
|
|
||||||
// static methods.
|
|
||||||
// Refs: https://www.ecma-international.org/ecma-262/#sec-promise.all
|
|
||||||
[
|
|
||||||
'Promise',
|
|
||||||
].forEach((name) => {
|
|
||||||
// eslint-disable-next-line no-restricted-globals
|
|
||||||
const original = global[name];
|
|
||||||
primordials[name] = original;
|
|
||||||
copyPropsRenamedBound(original, primordials, name);
|
|
||||||
copyPrototype(original.prototype, primordials, `${name}Prototype`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create copies of abstract intrinsic objects that are not directly exposed
|
|
||||||
// on the global object.
|
|
||||||
// Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
|
|
||||||
[
|
|
||||||
{ name: 'TypedArray', original: Reflect.getPrototypeOf(Uint8Array) },
|
|
||||||
{ name: 'ArrayIterator', original: {
|
|
||||||
prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()),
|
|
||||||
} },
|
|
||||||
{ name: 'StringIterator', original: {
|
|
||||||
prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()),
|
|
||||||
} },
|
|
||||||
].forEach(({ name, original }) => {
|
|
||||||
primordials[name] = original;
|
|
||||||
// The static %TypedArray% methods require a valid `this`, but can't be bound,
|
|
||||||
// as they need a subclass constructor as the receiver:
|
|
||||||
copyPrototype(original, primordials, name);
|
|
||||||
copyPrototype(original.prototype, primordials, `${name}Prototype`);
|
|
||||||
});
|
|
||||||
|
|
||||||
/* eslint-enable node-core/prefer-primordials */
|
|
||||||
|
|
||||||
const {
|
|
||||||
ArrayPrototypeForEach,
|
|
||||||
FunctionPrototypeCall,
|
|
||||||
Map,
|
|
||||||
ObjectFreeze,
|
|
||||||
ObjectSetPrototypeOf,
|
|
||||||
Set,
|
|
||||||
SymbolIterator,
|
|
||||||
WeakMap,
|
|
||||||
WeakSet,
|
|
||||||
} = primordials;
|
|
||||||
|
|
||||||
// Because these functions are used by `makeSafe`, which is exposed
|
|
||||||
// on the `primordials` object, it's important to use const references
|
|
||||||
// to the primordials that they use:
|
|
||||||
const createSafeIterator = (factory, next) => {
|
|
||||||
class SafeIterator {
|
|
||||||
constructor(iterable) {
|
|
||||||
this._iterator = factory(iterable);
|
|
||||||
}
|
|
||||||
next() {
|
|
||||||
return next(this._iterator);
|
|
||||||
}
|
|
||||||
[SymbolIterator]() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ObjectSetPrototypeOf(SafeIterator.prototype, null);
|
|
||||||
ObjectFreeze(SafeIterator.prototype);
|
|
||||||
ObjectFreeze(SafeIterator);
|
|
||||||
return SafeIterator;
|
|
||||||
};
|
|
||||||
|
|
||||||
primordials.SafeArrayIterator = createSafeIterator(
|
|
||||||
primordials.ArrayPrototypeSymbolIterator,
|
|
||||||
primordials.ArrayIteratorPrototypeNext
|
|
||||||
);
|
|
||||||
primordials.SafeStringIterator = createSafeIterator(
|
|
||||||
primordials.StringPrototypeSymbolIterator,
|
|
||||||
primordials.StringIteratorPrototypeNext
|
|
||||||
);
|
|
||||||
|
|
||||||
const copyProps = (src, dest) => {
|
|
||||||
ArrayPrototypeForEach(ReflectOwnKeys(src), (key) => {
|
|
||||||
if (!ReflectGetOwnPropertyDescriptor(dest, key)) {
|
|
||||||
ReflectDefineProperty(
|
|
||||||
dest,
|
|
||||||
key,
|
|
||||||
ReflectGetOwnPropertyDescriptor(src, key));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const makeSafe = (unsafe, safe) => {
|
|
||||||
if (SymbolIterator in unsafe.prototype) {
|
|
||||||
const dummy = new unsafe();
|
|
||||||
let next; // We can reuse the same `next` method.
|
|
||||||
|
|
||||||
ArrayPrototypeForEach(ReflectOwnKeys(unsafe.prototype), (key) => {
|
|
||||||
if (!ReflectGetOwnPropertyDescriptor(safe.prototype, key)) {
|
|
||||||
const desc = ReflectGetOwnPropertyDescriptor(unsafe.prototype, key);
|
|
||||||
if (
|
|
||||||
typeof desc.value === 'function' &&
|
|
||||||
desc.value.length === 0 &&
|
|
||||||
SymbolIterator in (FunctionPrototypeCall(desc.value, dummy) ?? {})
|
|
||||||
) {
|
|
||||||
const createIterator = uncurryThis(desc.value);
|
|
||||||
next = next ?? uncurryThis(createIterator(dummy).next);
|
|
||||||
const SafeIterator = createSafeIterator(createIterator, next);
|
|
||||||
desc.value = function() {
|
|
||||||
return new SafeIterator(this);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
ReflectDefineProperty(safe.prototype, key, desc);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
copyProps(unsafe.prototype, safe.prototype);
|
|
||||||
}
|
|
||||||
copyProps(unsafe, safe);
|
|
||||||
|
|
||||||
ObjectSetPrototypeOf(safe.prototype, null);
|
|
||||||
ObjectFreeze(safe.prototype);
|
|
||||||
ObjectFreeze(safe);
|
|
||||||
return safe;
|
|
||||||
};
|
|
||||||
primordials.makeSafe = makeSafe;
|
|
||||||
|
|
||||||
// Subclass the constructors because we need to use their prototype
|
|
||||||
// methods later.
|
|
||||||
// Defining the `constructor` is necessary here to avoid the default
|
|
||||||
// constructor which uses the user-mutable `%ArrayIteratorPrototype%.next`.
|
|
||||||
primordials.SafeMap = makeSafe(
|
|
||||||
Map,
|
|
||||||
class SafeMap extends Map {
|
|
||||||
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
|
|
||||||
}
|
|
||||||
);
|
|
||||||
primordials.SafeWeakMap = makeSafe(
|
|
||||||
WeakMap,
|
|
||||||
class SafeWeakMap extends WeakMap {
|
|
||||||
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
|
|
||||||
}
|
|
||||||
);
|
|
||||||
primordials.SafeSet = makeSafe(
|
|
||||||
Set,
|
|
||||||
class SafeSet extends Set {
|
|
||||||
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
|
|
||||||
}
|
|
||||||
);
|
|
||||||
primordials.SafeWeakSet = makeSafe(
|
|
||||||
WeakSet,
|
|
||||||
class SafeWeakSet extends WeakSet {
|
|
||||||
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
ObjectSetPrototypeOf(primordials, null);
|
|
||||||
ObjectFreeze(primordials);
|
|
||||||
|
|
||||||
module.exports = primordials;
|
|
14
app/node_modules/@pkgjs/parseargs/internal/util.js
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This is a placeholder for util.js in node.js land.
|
|
||||||
|
|
||||||
const {
|
|
||||||
ObjectCreate,
|
|
||||||
ObjectFreeze,
|
|
||||||
} = require('./primordials');
|
|
||||||
|
|
||||||
const kEmptyObject = ObjectFreeze(ObjectCreate(null));
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
kEmptyObject,
|
|
||||||
};
|
|
89
app/node_modules/@pkgjs/parseargs/internal/validators.js
generated
vendored
@@ -1,89 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This file is a proxy of the original file located at:
|
|
||||||
// https://github.com/nodejs/node/blob/main/lib/internal/validators.js
|
|
||||||
// Every addition or modification to this file must be evaluated
|
|
||||||
// during the PR review.
|
|
||||||
|
|
||||||
const {
|
|
||||||
ArrayIsArray,
|
|
||||||
ArrayPrototypeIncludes,
|
|
||||||
ArrayPrototypeJoin,
|
|
||||||
} = require('./primordials');
|
|
||||||
|
|
||||||
const {
|
|
||||||
codes: {
|
|
||||||
ERR_INVALID_ARG_TYPE
|
|
||||||
}
|
|
||||||
} = require('./errors');
|
|
||||||
|
|
||||||
function validateString(value, name) {
|
|
||||||
if (typeof value !== 'string') {
|
|
||||||
throw new ERR_INVALID_ARG_TYPE(name, 'String', value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateUnion(value, name, union) {
|
|
||||||
if (!ArrayPrototypeIncludes(union, value)) {
|
|
||||||
throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateBoolean(value, name) {
|
|
||||||
if (typeof value !== 'boolean') {
|
|
||||||
throw new ERR_INVALID_ARG_TYPE(name, 'Boolean', value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateArray(value, name) {
|
|
||||||
if (!ArrayIsArray(value)) {
|
|
||||||
throw new ERR_INVALID_ARG_TYPE(name, 'Array', value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateStringArray(value, name) {
|
|
||||||
validateArray(value, name);
|
|
||||||
for (let i = 0; i < value.length; i++) {
|
|
||||||
validateString(value[i], `${name}[${i}]`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateBooleanArray(value, name) {
|
|
||||||
validateArray(value, name);
|
|
||||||
for (let i = 0; i < value.length; i++) {
|
|
||||||
validateBoolean(value[i], `${name}[${i}]`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {unknown} value
|
|
||||||
* @param {string} name
|
|
||||||
* @param {{
|
|
||||||
* allowArray?: boolean,
|
|
||||||
* allowFunction?: boolean,
|
|
||||||
* nullable?: boolean
|
|
||||||
* }} [options]
|
|
||||||
*/
|
|
||||||
function validateObject(value, name, options) {
|
|
||||||
const useDefaultOptions = options == null;
|
|
||||||
const allowArray = useDefaultOptions ? false : options.allowArray;
|
|
||||||
const allowFunction = useDefaultOptions ? false : options.allowFunction;
|
|
||||||
const nullable = useDefaultOptions ? false : options.nullable;
|
|
||||||
if ((!nullable && value === null) ||
|
|
||||||
(!allowArray && ArrayIsArray(value)) ||
|
|
||||||
(typeof value !== 'object' && (
|
|
||||||
!allowFunction || typeof value !== 'function'
|
|
||||||
))) {
|
|
||||||
throw new ERR_INVALID_ARG_TYPE(name, 'Object', value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
validateArray,
|
|
||||||
validateObject,
|
|
||||||
validateString,
|
|
||||||
validateStringArray,
|
|
||||||
validateUnion,
|
|
||||||
validateBoolean,
|
|
||||||
validateBooleanArray,
|
|
||||||
};
|
|
62
app/node_modules/@pkgjs/parseargs/package.json
generated
vendored
@@ -1,62 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "@pkgjs/parseargs@^0.11.0",
|
|
||||||
"_id": "@pkgjs/parseargs@0.11.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
|
|
||||||
"_location": "/@pkgjs/parseargs",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "range",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@pkgjs/parseargs@^0.11.0",
|
|
||||||
"name": "@pkgjs/parseargs",
|
|
||||||
"escapedName": "@pkgjs%2fparseargs",
|
|
||||||
"scope": "@pkgjs",
|
|
||||||
"rawSpec": "^0.11.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "^0.11.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/jackspeak"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
|
||||||
"_shasum": "a77ea742fab25775145434eb1d2328cf5013ac33",
|
|
||||||
"_spec": "@pkgjs/parseargs@^0.11.0",
|
|
||||||
"_where": "/mnt/c/Users/docto/Downloads/Rappaurio/node_modules/jackspeak",
|
|
||||||
"author": "",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/pkgjs/parseargs/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Polyfill of future proposal for `util.parseArgs()`",
|
|
||||||
"devDependencies": {
|
|
||||||
"c8": "^7.10.0",
|
|
||||||
"eslint": "^8.2.0",
|
|
||||||
"eslint-plugin-node-core": "github:iansu/eslint-plugin-node-core",
|
|
||||||
"tape": "^5.2.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14"
|
|
||||||
},
|
|
||||||
"exports": {
|
|
||||||
".": "./index.js",
|
|
||||||
"./package.json": "./package.json"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/pkgjs/parseargs#readme",
|
|
||||||
"keywords": [],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "index.js",
|
|
||||||
"name": "@pkgjs/parseargs",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+ssh://git@github.com/pkgjs/parseargs.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"coverage": "c8 --check-coverage tape 'test/*.js'",
|
|
||||||
"fix": "npm run posttest -- --fix",
|
|
||||||
"posttest": "eslint .",
|
|
||||||
"test": "c8 tape 'test/*.js'"
|
|
||||||
},
|
|
||||||
"version": "0.11.0"
|
|
||||||
}
|
|
198
app/node_modules/@pkgjs/parseargs/utils.js
generated
vendored
@@ -1,198 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const {
|
|
||||||
ArrayPrototypeFind,
|
|
||||||
ObjectEntries,
|
|
||||||
ObjectPrototypeHasOwnProperty: ObjectHasOwn,
|
|
||||||
StringPrototypeCharAt,
|
|
||||||
StringPrototypeIncludes,
|
|
||||||
StringPrototypeStartsWith,
|
|
||||||
} = require('./internal/primordials');
|
|
||||||
|
|
||||||
const {
|
|
||||||
validateObject,
|
|
||||||
} = require('./internal/validators');
|
|
||||||
|
|
||||||
// These are internal utilities to make the parsing logic easier to read, and
|
|
||||||
// add lots of detail for the curious. They are in a separate file to allow
|
|
||||||
// unit testing, although that is not essential (this could be rolled into
|
|
||||||
// main file and just tested implicitly via API).
|
|
||||||
//
|
|
||||||
// These routines are for internal use, not for export to client.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the named property, but only if it is an own property.
|
|
||||||
*/
|
|
||||||
function objectGetOwn(obj, prop) {
|
|
||||||
if (ObjectHasOwn(obj, prop))
|
|
||||||
return obj[prop];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the named options property, but only if it is an own property.
|
|
||||||
*/
|
|
||||||
function optionsGetOwn(options, longOption, prop) {
|
|
||||||
if (ObjectHasOwn(options, longOption))
|
|
||||||
return objectGetOwn(options[longOption], prop);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if the argument may be used as an option value.
|
|
||||||
* @example
|
|
||||||
* isOptionValue('V') // returns true
|
|
||||||
* isOptionValue('-v') // returns true (greedy)
|
|
||||||
* isOptionValue('--foo') // returns true (greedy)
|
|
||||||
* isOptionValue(undefined) // returns false
|
|
||||||
*/
|
|
||||||
function isOptionValue(value) {
|
|
||||||
if (value == null) return false;
|
|
||||||
|
|
||||||
// Open Group Utility Conventions are that an option-argument
|
|
||||||
// is the argument after the option, and may start with a dash.
|
|
||||||
return true; // greedy!
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detect whether there is possible confusion and user may have omitted
|
|
||||||
* the option argument, like `--port --verbose` when `port` of type:string.
|
|
||||||
* In strict mode we throw errors if value is option-like.
|
|
||||||
*/
|
|
||||||
function isOptionLikeValue(value) {
|
|
||||||
if (value == null) return false;
|
|
||||||
|
|
||||||
return value.length > 1 && StringPrototypeCharAt(value, 0) === '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if `arg` is just a short option.
|
|
||||||
* @example '-f'
|
|
||||||
*/
|
|
||||||
function isLoneShortOption(arg) {
|
|
||||||
return arg.length === 2 &&
|
|
||||||
StringPrototypeCharAt(arg, 0) === '-' &&
|
|
||||||
StringPrototypeCharAt(arg, 1) !== '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if `arg` is a lone long option.
|
|
||||||
* @example
|
|
||||||
* isLoneLongOption('a') // returns false
|
|
||||||
* isLoneLongOption('-a') // returns false
|
|
||||||
* isLoneLongOption('--foo') // returns true
|
|
||||||
* isLoneLongOption('--foo=bar') // returns false
|
|
||||||
*/
|
|
||||||
function isLoneLongOption(arg) {
|
|
||||||
return arg.length > 2 &&
|
|
||||||
StringPrototypeStartsWith(arg, '--') &&
|
|
||||||
!StringPrototypeIncludes(arg, '=', 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if `arg` is a long option and value in the same argument.
|
|
||||||
* @example
|
|
||||||
* isLongOptionAndValue('--foo') // returns false
|
|
||||||
* isLongOptionAndValue('--foo=bar') // returns true
|
|
||||||
*/
|
|
||||||
function isLongOptionAndValue(arg) {
|
|
||||||
return arg.length > 2 &&
|
|
||||||
StringPrototypeStartsWith(arg, '--') &&
|
|
||||||
StringPrototypeIncludes(arg, '=', 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if `arg` is a short option group.
|
|
||||||
*
|
|
||||||
* See Guideline 5 of the [Open Group Utility Conventions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html).
|
|
||||||
* One or more options without option-arguments, followed by at most one
|
|
||||||
* option that takes an option-argument, should be accepted when grouped
|
|
||||||
* behind one '-' delimiter.
|
|
||||||
* @example
|
|
||||||
* isShortOptionGroup('-a', {}) // returns false
|
|
||||||
* isShortOptionGroup('-ab', {}) // returns true
|
|
||||||
* // -fb is an option and a value, not a short option group
|
|
||||||
* isShortOptionGroup('-fb', {
|
|
||||||
* options: { f: { type: 'string' } }
|
|
||||||
* }) // returns false
|
|
||||||
* isShortOptionGroup('-bf', {
|
|
||||||
* options: { f: { type: 'string' } }
|
|
||||||
* }) // returns true
|
|
||||||
* // -bfb is an edge case, return true and caller sorts it out
|
|
||||||
* isShortOptionGroup('-bfb', {
|
|
||||||
* options: { f: { type: 'string' } }
|
|
||||||
* }) // returns true
|
|
||||||
*/
|
|
||||||
function isShortOptionGroup(arg, options) {
|
|
||||||
if (arg.length <= 2) return false;
|
|
||||||
if (StringPrototypeCharAt(arg, 0) !== '-') return false;
|
|
||||||
if (StringPrototypeCharAt(arg, 1) === '-') return false;
|
|
||||||
|
|
||||||
const firstShort = StringPrototypeCharAt(arg, 1);
|
|
||||||
const longOption = findLongOptionForShort(firstShort, options);
|
|
||||||
return optionsGetOwn(options, longOption, 'type') !== 'string';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if arg is a short string option followed by its value.
|
|
||||||
* @example
|
|
||||||
* isShortOptionAndValue('-a', {}); // returns false
|
|
||||||
* isShortOptionAndValue('-ab', {}); // returns false
|
|
||||||
* isShortOptionAndValue('-fFILE', {
|
|
||||||
* options: { foo: { short: 'f', type: 'string' }}
|
|
||||||
* }) // returns true
|
|
||||||
*/
|
|
||||||
function isShortOptionAndValue(arg, options) {
|
|
||||||
validateObject(options, 'options');
|
|
||||||
|
|
||||||
if (arg.length <= 2) return false;
|
|
||||||
if (StringPrototypeCharAt(arg, 0) !== '-') return false;
|
|
||||||
if (StringPrototypeCharAt(arg, 1) === '-') return false;
|
|
||||||
|
|
||||||
const shortOption = StringPrototypeCharAt(arg, 1);
|
|
||||||
const longOption = findLongOptionForShort(shortOption, options);
|
|
||||||
return optionsGetOwn(options, longOption, 'type') === 'string';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find the long option associated with a short option. Looks for a configured
|
|
||||||
* `short` and returns the short option itself if a long option is not found.
|
|
||||||
* @example
|
|
||||||
* findLongOptionForShort('a', {}) // returns 'a'
|
|
||||||
* findLongOptionForShort('b', {
|
|
||||||
* options: { bar: { short: 'b' } }
|
|
||||||
* }) // returns 'bar'
|
|
||||||
*/
|
|
||||||
function findLongOptionForShort(shortOption, options) {
|
|
||||||
validateObject(options, 'options');
|
|
||||||
const longOptionEntry = ArrayPrototypeFind(
|
|
||||||
ObjectEntries(options),
|
|
||||||
({ 1: optionConfig }) => objectGetOwn(optionConfig, 'short') === shortOption
|
|
||||||
);
|
|
||||||
return longOptionEntry?.[0] ?? shortOption;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given option includes a default value
|
|
||||||
* and that option has not been set by the input args.
|
|
||||||
*
|
|
||||||
* @param {string} longOption - long option name e.g. 'foo'
|
|
||||||
* @param {object} optionConfig - the option configuration properties
|
|
||||||
* @param {object} values - option values returned in `values` by parseArgs
|
|
||||||
*/
|
|
||||||
function useDefaultValueOption(longOption, optionConfig, values) {
|
|
||||||
return objectGetOwn(optionConfig, 'default') !== undefined &&
|
|
||||||
values[longOption] === undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
findLongOptionForShort,
|
|
||||||
isLoneLongOption,
|
|
||||||
isLoneShortOption,
|
|
||||||
isLongOptionAndValue,
|
|
||||||
isOptionValue,
|
|
||||||
isOptionLikeValue,
|
|
||||||
isShortOptionAndValue,
|
|
||||||
isShortOptionGroup,
|
|
||||||
useDefaultValueOption,
|
|
||||||
objectGetOwn,
|
|
||||||
optionsGetOwn,
|
|
||||||
};
|
|
243
app/node_modules/accepts/HISTORY.md
generated
vendored
@@ -1,243 +0,0 @@
|
|||||||
1.3.8 / 2022-02-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.34
|
|
||||||
- deps: mime-db@~1.51.0
|
|
||||||
* deps: negotiator@0.6.3
|
|
||||||
|
|
||||||
1.3.7 / 2019-04-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.6.2
|
|
||||||
- Fix sorting charset, encoding, and language with extra parameters
|
|
||||||
|
|
||||||
1.3.6 / 2019-04-28
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.24
|
|
||||||
- deps: mime-db@~1.40.0
|
|
||||||
|
|
||||||
1.3.5 / 2018-02-28
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.18
|
|
||||||
- deps: mime-db@~1.33.0
|
|
||||||
|
|
||||||
1.3.4 / 2017-08-22
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.16
|
|
||||||
- deps: mime-db@~1.29.0
|
|
||||||
|
|
||||||
1.3.3 / 2016-05-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.11
|
|
||||||
- deps: mime-db@~1.23.0
|
|
||||||
* deps: negotiator@0.6.1
|
|
||||||
- perf: improve `Accept` parsing speed
|
|
||||||
- perf: improve `Accept-Charset` parsing speed
|
|
||||||
- perf: improve `Accept-Encoding` parsing speed
|
|
||||||
- perf: improve `Accept-Language` parsing speed
|
|
||||||
|
|
||||||
1.3.2 / 2016-03-08
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.10
|
|
||||||
- Fix extension of `application/dash+xml`
|
|
||||||
- Update primary extension for `audio/mp4`
|
|
||||||
- deps: mime-db@~1.22.0
|
|
||||||
|
|
||||||
1.3.1 / 2016-01-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.9
|
|
||||||
- deps: mime-db@~1.21.0
|
|
||||||
|
|
||||||
1.3.0 / 2015-09-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.7
|
|
||||||
- deps: mime-db@~1.19.0
|
|
||||||
* deps: negotiator@0.6.0
|
|
||||||
- Fix including type extensions in parameters in `Accept` parsing
|
|
||||||
- Fix parsing `Accept` parameters with quoted equals
|
|
||||||
- Fix parsing `Accept` parameters with quoted semicolons
|
|
||||||
- Lazy-load modules from main entry point
|
|
||||||
- perf: delay type concatenation until needed
|
|
||||||
- perf: enable strict mode
|
|
||||||
- perf: hoist regular expressions
|
|
||||||
- perf: remove closures getting spec properties
|
|
||||||
- perf: remove a closure from media type parsing
|
|
||||||
- perf: remove property delete from media type parsing
|
|
||||||
|
|
||||||
1.2.13 / 2015-09-06
|
|
||||||
===================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.6
|
|
||||||
- deps: mime-db@~1.18.0
|
|
||||||
|
|
||||||
1.2.12 / 2015-07-30
|
|
||||||
===================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.4
|
|
||||||
- deps: mime-db@~1.16.0
|
|
||||||
|
|
||||||
1.2.11 / 2015-07-16
|
|
||||||
===================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.3
|
|
||||||
- deps: mime-db@~1.15.0
|
|
||||||
|
|
||||||
1.2.10 / 2015-07-01
|
|
||||||
===================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.2
|
|
||||||
- deps: mime-db@~1.14.0
|
|
||||||
|
|
||||||
1.2.9 / 2015-06-08
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.1
|
|
||||||
- perf: fix deopt during mapping
|
|
||||||
|
|
||||||
1.2.8 / 2015-06-07
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.0
|
|
||||||
- deps: mime-db@~1.13.0
|
|
||||||
* perf: avoid argument reassignment & argument slice
|
|
||||||
* perf: avoid negotiator recursive construction
|
|
||||||
* perf: enable strict mode
|
|
||||||
* perf: remove unnecessary bitwise operator
|
|
||||||
|
|
||||||
1.2.7 / 2015-05-10
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.5.3
|
|
||||||
- Fix media type parameter matching to be case-insensitive
|
|
||||||
|
|
||||||
1.2.6 / 2015-05-07
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.11
|
|
||||||
- deps: mime-db@~1.9.1
|
|
||||||
* deps: negotiator@0.5.2
|
|
||||||
- Fix comparing media types with quoted values
|
|
||||||
- Fix splitting media types with quoted commas
|
|
||||||
|
|
||||||
1.2.5 / 2015-03-13
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.10
|
|
||||||
- deps: mime-db@~1.8.0
|
|
||||||
|
|
||||||
1.2.4 / 2015-02-14
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Support Node.js 0.6
|
|
||||||
* deps: mime-types@~2.0.9
|
|
||||||
- deps: mime-db@~1.7.0
|
|
||||||
* deps: negotiator@0.5.1
|
|
||||||
- Fix preference sorting to be stable for long acceptable lists
|
|
||||||
|
|
||||||
1.2.3 / 2015-01-31
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.8
|
|
||||||
- deps: mime-db@~1.6.0
|
|
||||||
|
|
||||||
1.2.2 / 2014-12-30
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.7
|
|
||||||
- deps: mime-db@~1.5.0
|
|
||||||
|
|
||||||
1.2.1 / 2014-12-30
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.5
|
|
||||||
- deps: mime-db@~1.3.1
|
|
||||||
|
|
||||||
1.2.0 / 2014-12-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.5.0
|
|
||||||
- Fix list return order when large accepted list
|
|
||||||
- Fix missing identity encoding when q=0 exists
|
|
||||||
- Remove dynamic building of Negotiator class
|
|
||||||
|
|
||||||
1.1.4 / 2014-12-10
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.4
|
|
||||||
- deps: mime-db@~1.3.0
|
|
||||||
|
|
||||||
1.1.3 / 2014-11-09
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.3
|
|
||||||
- deps: mime-db@~1.2.0
|
|
||||||
|
|
||||||
1.1.2 / 2014-10-14
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.4.9
|
|
||||||
- Fix error when media type has invalid parameter
|
|
||||||
|
|
||||||
1.1.1 / 2014-09-28
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.2
|
|
||||||
- deps: mime-db@~1.1.0
|
|
||||||
* deps: negotiator@0.4.8
|
|
||||||
- Fix all negotiations to be case-insensitive
|
|
||||||
- Stable sort preferences of same quality according to client order
|
|
||||||
|
|
||||||
1.1.0 / 2014-09-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* update `mime-types`
|
|
||||||
|
|
||||||
1.0.7 / 2014-07-04
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix wrong type returned from `type` when match after unknown extension
|
|
||||||
|
|
||||||
1.0.6 / 2014-06-24
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.4.7
|
|
||||||
|
|
||||||
1.0.5 / 2014-06-20
|
|
||||||
==================
|
|
||||||
|
|
||||||
* fix crash when unknown extension given
|
|
||||||
|
|
||||||
1.0.4 / 2014-06-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* use `mime-types`
|
|
||||||
|
|
||||||
1.0.3 / 2014-06-11
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.4.6
|
|
||||||
- Order by specificity when quality is the same
|
|
||||||
|
|
||||||
1.0.2 / 2014-05-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix interpretation when header not in request
|
|
||||||
* deps: pin negotiator@0.4.5
|
|
||||||
|
|
||||||
1.0.1 / 2014-01-18
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Identity encoding isn't always acceptable
|
|
||||||
* deps: negotiator@~0.4.0
|
|
||||||
|
|
||||||
1.0.0 / 2013-12-27
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Genesis
|
|
23
app/node_modules/accepts/LICENSE
generated
vendored
@@ -1,23 +0,0 @@
|
|||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
|
||||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.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.
|
|
140
app/node_modules/accepts/README.md
generated
vendored
@@ -1,140 +0,0 @@
|
|||||||
# accepts
|
|
||||||
|
|
||||||
[![NPM Version][npm-version-image]][npm-url]
|
|
||||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
|
||||||
[![Node.js Version][node-version-image]][node-version-url]
|
|
||||||
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
|
|
||||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
|
||||||
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
|
||||||
|
|
||||||
In addition to negotiator, it allows:
|
|
||||||
|
|
||||||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
|
||||||
as well as `('text/html', 'application/json')`.
|
|
||||||
- Allows type shorthands such as `json`.
|
|
||||||
- Returns `false` when no types match
|
|
||||||
- Treats non-existent headers as `*`
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
||||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
||||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install accepts
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
```js
|
|
||||||
var accepts = require('accepts')
|
|
||||||
```
|
|
||||||
|
|
||||||
### accepts(req)
|
|
||||||
|
|
||||||
Create a new `Accepts` object for the given `req`.
|
|
||||||
|
|
||||||
#### .charset(charsets)
|
|
||||||
|
|
||||||
Return the first accepted charset. If nothing in `charsets` is accepted,
|
|
||||||
then `false` is returned.
|
|
||||||
|
|
||||||
#### .charsets()
|
|
||||||
|
|
||||||
Return the charsets that the request accepts, in the order of the client's
|
|
||||||
preference (most preferred first).
|
|
||||||
|
|
||||||
#### .encoding(encodings)
|
|
||||||
|
|
||||||
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
|
||||||
then `false` is returned.
|
|
||||||
|
|
||||||
#### .encodings()
|
|
||||||
|
|
||||||
Return the encodings that the request accepts, in the order of the client's
|
|
||||||
preference (most preferred first).
|
|
||||||
|
|
||||||
#### .language(languages)
|
|
||||||
|
|
||||||
Return the first accepted language. If nothing in `languages` is accepted,
|
|
||||||
then `false` is returned.
|
|
||||||
|
|
||||||
#### .languages()
|
|
||||||
|
|
||||||
Return the languages that the request accepts, in the order of the client's
|
|
||||||
preference (most preferred first).
|
|
||||||
|
|
||||||
#### .type(types)
|
|
||||||
|
|
||||||
Return the first accepted type (and it is returned as the same text as what
|
|
||||||
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
|
||||||
is returned.
|
|
||||||
|
|
||||||
The `types` array can contain full MIME types or file extensions. Any value
|
|
||||||
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
|
||||||
|
|
||||||
#### .types()
|
|
||||||
|
|
||||||
Return the types that the request accepts, in the order of the client's
|
|
||||||
preference (most preferred first).
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Simple type negotiation
|
|
||||||
|
|
||||||
This simple example shows how to use `accepts` to return a different typed
|
|
||||||
respond body based on what the client wants to accept. The server lists it's
|
|
||||||
preferences in order and will get back the best match between the client and
|
|
||||||
server.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var accepts = require('accepts')
|
|
||||||
var http = require('http')
|
|
||||||
|
|
||||||
function app (req, res) {
|
|
||||||
var accept = accepts(req)
|
|
||||||
|
|
||||||
// the order of this list is significant; should be server preferred order
|
|
||||||
switch (accept.type(['json', 'html'])) {
|
|
||||||
case 'json':
|
|
||||||
res.setHeader('Content-Type', 'application/json')
|
|
||||||
res.write('{"hello":"world!"}')
|
|
||||||
break
|
|
||||||
case 'html':
|
|
||||||
res.setHeader('Content-Type', 'text/html')
|
|
||||||
res.write('<b>hello, world!</b>')
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
// the fallback is text/plain, so no need to specify it above
|
|
||||||
res.setHeader('Content-Type', 'text/plain')
|
|
||||||
res.write('hello, world!')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
res.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
http.createServer(app).listen(3000)
|
|
||||||
```
|
|
||||||
|
|
||||||
You can test this out with the cURL program:
|
|
||||||
```sh
|
|
||||||
curl -I -H'Accept: text/html' http://localhost:3000/
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
|
||||||
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
|
||||||
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
|
|
||||||
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
|
|
||||||
[node-version-image]: https://badgen.net/npm/node/accepts
|
|
||||||
[node-version-url]: https://nodejs.org/en/download
|
|
||||||
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
|
||||||
[npm-url]: https://npmjs.org/package/accepts
|
|
||||||
[npm-version-image]: https://badgen.net/npm/v/accepts
|
|
238
app/node_modules/accepts/index.js
generated
vendored
@@ -1,238 +0,0 @@
|
|||||||
/*!
|
|
||||||
* accepts
|
|
||||||
* Copyright(c) 2014 Jonathan Ong
|
|
||||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Negotiator = require('negotiator')
|
|
||||||
var mime = require('mime-types')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = Accepts
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new Accepts object for the given req.
|
|
||||||
*
|
|
||||||
* @param {object} req
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function Accepts (req) {
|
|
||||||
if (!(this instanceof Accepts)) {
|
|
||||||
return new Accepts(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.headers = req.headers
|
|
||||||
this.negotiator = new Negotiator(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given `type(s)` is acceptable, returning
|
|
||||||
* the best match when true, otherwise `undefined`, in which
|
|
||||||
* case you should respond with 406 "Not Acceptable".
|
|
||||||
*
|
|
||||||
* The `type` value may be a single mime type string
|
|
||||||
* such as "application/json", the extension name
|
|
||||||
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
|
||||||
* or array is given the _best_ match, if any is returned.
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
*
|
|
||||||
* // Accept: text/html
|
|
||||||
* this.types('html');
|
|
||||||
* // => "html"
|
|
||||||
*
|
|
||||||
* // Accept: text/*, application/json
|
|
||||||
* this.types('html');
|
|
||||||
* // => "html"
|
|
||||||
* this.types('text/html');
|
|
||||||
* // => "text/html"
|
|
||||||
* this.types('json', 'text');
|
|
||||||
* // => "json"
|
|
||||||
* this.types('application/json');
|
|
||||||
* // => "application/json"
|
|
||||||
*
|
|
||||||
* // Accept: text/*, application/json
|
|
||||||
* this.types('image/png');
|
|
||||||
* this.types('png');
|
|
||||||
* // => undefined
|
|
||||||
*
|
|
||||||
* // Accept: text/*;q=.5, application/json
|
|
||||||
* this.types(['html', 'json']);
|
|
||||||
* this.types('html', 'json');
|
|
||||||
* // => "json"
|
|
||||||
*
|
|
||||||
* @param {String|Array} types...
|
|
||||||
* @return {String|Array|Boolean}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
Accepts.prototype.type =
|
|
||||||
Accepts.prototype.types = function (types_) {
|
|
||||||
var types = types_
|
|
||||||
|
|
||||||
// support flattened arguments
|
|
||||||
if (types && !Array.isArray(types)) {
|
|
||||||
types = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < types.length; i++) {
|
|
||||||
types[i] = arguments[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no types, return all requested types
|
|
||||||
if (!types || types.length === 0) {
|
|
||||||
return this.negotiator.mediaTypes()
|
|
||||||
}
|
|
||||||
|
|
||||||
// no accept header, return first given type
|
|
||||||
if (!this.headers.accept) {
|
|
||||||
return types[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
var mimes = types.map(extToMime)
|
|
||||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
|
||||||
var first = accepts[0]
|
|
||||||
|
|
||||||
return first
|
|
||||||
? types[mimes.indexOf(first)]
|
|
||||||
: false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return accepted encodings or best fit based on `encodings`.
|
|
||||||
*
|
|
||||||
* Given `Accept-Encoding: gzip, deflate`
|
|
||||||
* an array sorted by quality is returned:
|
|
||||||
*
|
|
||||||
* ['gzip', 'deflate']
|
|
||||||
*
|
|
||||||
* @param {String|Array} encodings...
|
|
||||||
* @return {String|Array}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
Accepts.prototype.encoding =
|
|
||||||
Accepts.prototype.encodings = function (encodings_) {
|
|
||||||
var encodings = encodings_
|
|
||||||
|
|
||||||
// support flattened arguments
|
|
||||||
if (encodings && !Array.isArray(encodings)) {
|
|
||||||
encodings = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < encodings.length; i++) {
|
|
||||||
encodings[i] = arguments[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no encodings, return all requested encodings
|
|
||||||
if (!encodings || encodings.length === 0) {
|
|
||||||
return this.negotiator.encodings()
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.negotiator.encodings(encodings)[0] || false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return accepted charsets or best fit based on `charsets`.
|
|
||||||
*
|
|
||||||
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
|
||||||
* an array sorted by quality is returned:
|
|
||||||
*
|
|
||||||
* ['utf-8', 'utf-7', 'iso-8859-1']
|
|
||||||
*
|
|
||||||
* @param {String|Array} charsets...
|
|
||||||
* @return {String|Array}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
Accepts.prototype.charset =
|
|
||||||
Accepts.prototype.charsets = function (charsets_) {
|
|
||||||
var charsets = charsets_
|
|
||||||
|
|
||||||
// support flattened arguments
|
|
||||||
if (charsets && !Array.isArray(charsets)) {
|
|
||||||
charsets = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < charsets.length; i++) {
|
|
||||||
charsets[i] = arguments[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no charsets, return all requested charsets
|
|
||||||
if (!charsets || charsets.length === 0) {
|
|
||||||
return this.negotiator.charsets()
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.negotiator.charsets(charsets)[0] || false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return accepted languages or best fit based on `langs`.
|
|
||||||
*
|
|
||||||
* Given `Accept-Language: en;q=0.8, es, pt`
|
|
||||||
* an array sorted by quality is returned:
|
|
||||||
*
|
|
||||||
* ['es', 'pt', 'en']
|
|
||||||
*
|
|
||||||
* @param {String|Array} langs...
|
|
||||||
* @return {Array|String}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
Accepts.prototype.lang =
|
|
||||||
Accepts.prototype.langs =
|
|
||||||
Accepts.prototype.language =
|
|
||||||
Accepts.prototype.languages = function (languages_) {
|
|
||||||
var languages = languages_
|
|
||||||
|
|
||||||
// support flattened arguments
|
|
||||||
if (languages && !Array.isArray(languages)) {
|
|
||||||
languages = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < languages.length; i++) {
|
|
||||||
languages[i] = arguments[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no languages, return all requested languages
|
|
||||||
if (!languages || languages.length === 0) {
|
|
||||||
return this.negotiator.languages()
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.negotiator.languages(languages)[0] || false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert extnames to mime.
|
|
||||||
*
|
|
||||||
* @param {String} type
|
|
||||||
* @return {String}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function extToMime (type) {
|
|
||||||
return type.indexOf('/') === -1
|
|
||||||
? mime.lookup(type)
|
|
||||||
: type
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if mime is valid.
|
|
||||||
*
|
|
||||||
* @param {String} type
|
|
||||||
* @return {String}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function validMime (type) {
|
|
||||||
return typeof type === 'string'
|
|
||||||
}
|
|
86
app/node_modules/accepts/package.json
generated
vendored
@@ -1,86 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "accepts@~1.3.8",
|
|
||||||
"_id": "accepts@1.3.8",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
|
||||||
"_location": "/accepts",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "range",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "accepts@~1.3.8",
|
|
||||||
"name": "accepts",
|
|
||||||
"escapedName": "accepts",
|
|
||||||
"rawSpec": "~1.3.8",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "~1.3.8"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/express"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
|
||||||
"_shasum": "0bf0be125b67014adcb0b0921e62db7bffe16b2e",
|
|
||||||
"_spec": "accepts@~1.3.8",
|
|
||||||
"_where": "/mnt/c/Users/docto/Downloads/Rappaurio/node_modules/express",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/jshttp/accepts/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Douglas Christopher Wilson",
|
|
||||||
"email": "doug@somethingdoug.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Jonathan Ong",
|
|
||||||
"email": "me@jongleberry.com",
|
|
||||||
"url": "http://jongleberry.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"mime-types": "~2.1.34",
|
|
||||||
"negotiator": "0.6.3"
|
|
||||||
},
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Higher-level content negotiation",
|
|
||||||
"devDependencies": {
|
|
||||||
"deep-equal": "1.0.1",
|
|
||||||
"eslint": "7.32.0",
|
|
||||||
"eslint-config-standard": "14.1.1",
|
|
||||||
"eslint-plugin-import": "2.25.4",
|
|
||||||
"eslint-plugin-markdown": "2.2.1",
|
|
||||||
"eslint-plugin-node": "11.1.0",
|
|
||||||
"eslint-plugin-promise": "4.3.1",
|
|
||||||
"eslint-plugin-standard": "4.1.0",
|
|
||||||
"mocha": "9.2.0",
|
|
||||||
"nyc": "15.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"LICENSE",
|
|
||||||
"HISTORY.md",
|
|
||||||
"index.js"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/jshttp/accepts#readme",
|
|
||||||
"keywords": [
|
|
||||||
"content",
|
|
||||||
"negotiation",
|
|
||||||
"accept",
|
|
||||||
"accepts"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"name": "accepts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/jshttp/accepts.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"lint": "eslint .",
|
|
||||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
|
||||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
|
||||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
|
||||||
},
|
|
||||||
"version": "1.3.8"
|
|
||||||
}
|
|
33
app/node_modules/ansi-regex/index.d.ts
generated
vendored
@@ -1,33 +0,0 @@
|
|||||||
export interface Options {
|
|
||||||
/**
|
|
||||||
Match only the first ANSI escape.
|
|
||||||
|
|
||||||
@default false
|
|
||||||
*/
|
|
||||||
readonly onlyFirst: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Regular expression for matching ANSI escape codes.
|
|
||||||
|
|
||||||
@example
|
|
||||||
```
|
|
||||||
import ansiRegex from 'ansi-regex';
|
|
||||||
|
|
||||||
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
|
||||||
//=> true
|
|
||||||
|
|
||||||
ansiRegex().test('cake');
|
|
||||||
//=> false
|
|
||||||
|
|
||||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
|
||||||
//=> ['\u001B[4m', '\u001B[0m']
|
|
||||||
|
|
||||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
|
||||||
//=> ['\u001B[4m']
|
|
||||||
|
|
||||||
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
|
||||||
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
|
||||||
```
|
|
||||||
*/
|
|
||||||
export default function ansiRegex(options?: Options): RegExp;
|
|
8
app/node_modules/ansi-regex/index.js
generated
vendored
@@ -1,8 +0,0 @@
|
|||||||
export default function ansiRegex({onlyFirst = false} = {}) {
|
|
||||||
const pattern = [
|
|
||||||
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
||||||
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
|
||||||
].join('|');
|
|
||||||
|
|
||||||
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
|
||||||
}
|
|
9
app/node_modules/ansi-regex/license
generated
vendored
@@ -1,9 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.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.
|
|
90
app/node_modules/ansi-regex/package.json
generated
vendored
@@ -1,90 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "ansi-regex@^6.0.1",
|
|
||||||
"_id": "ansi-regex@6.0.1",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
|
|
||||||
"_location": "/ansi-regex",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "range",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "ansi-regex@^6.0.1",
|
|
||||||
"name": "ansi-regex",
|
|
||||||
"escapedName": "ansi-regex",
|
|
||||||
"rawSpec": "^6.0.1",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "^6.0.1"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/strip-ansi"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
|
|
||||||
"_shasum": "3183e38fae9a65d7cb5e53945cd5897d0260a06a",
|
|
||||||
"_spec": "ansi-regex@^6.0.1",
|
|
||||||
"_where": "/mnt/c/Users/docto/Downloads/Rappaurio/node_modules/strip-ansi",
|
|
||||||
"author": {
|
|
||||||
"name": "Sindre Sorhus",
|
|
||||||
"email": "sindresorhus@gmail.com",
|
|
||||||
"url": "https://sindresorhus.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/chalk/ansi-regex/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Regular expression for matching ANSI escape codes",
|
|
||||||
"devDependencies": {
|
|
||||||
"ava": "^3.15.0",
|
|
||||||
"tsd": "^0.14.0",
|
|
||||||
"xo": "^0.38.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
},
|
|
||||||
"exports": "./index.js",
|
|
||||||
"files": [
|
|
||||||
"index.js",
|
|
||||||
"index.d.ts"
|
|
||||||
],
|
|
||||||
"funding": "https://github.com/chalk/ansi-regex?sponsor=1",
|
|
||||||
"homepage": "https://github.com/chalk/ansi-regex#readme",
|
|
||||||
"keywords": [
|
|
||||||
"ansi",
|
|
||||||
"styles",
|
|
||||||
"color",
|
|
||||||
"colour",
|
|
||||||
"colors",
|
|
||||||
"terminal",
|
|
||||||
"console",
|
|
||||||
"cli",
|
|
||||||
"string",
|
|
||||||
"tty",
|
|
||||||
"escape",
|
|
||||||
"formatting",
|
|
||||||
"rgb",
|
|
||||||
"256",
|
|
||||||
"shell",
|
|
||||||
"xterm",
|
|
||||||
"command-line",
|
|
||||||
"text",
|
|
||||||
"regex",
|
|
||||||
"regexp",
|
|
||||||
"re",
|
|
||||||
"match",
|
|
||||||
"test",
|
|
||||||
"find",
|
|
||||||
"pattern"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"name": "ansi-regex",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/chalk/ansi-regex.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "xo && ava && tsd",
|
|
||||||
"view-supported": "node fixtures/view-codes.js"
|
|
||||||
},
|
|
||||||
"type": "module",
|
|
||||||
"version": "6.0.1"
|
|
||||||
}
|
|
72
app/node_modules/ansi-regex/readme.md
generated
vendored
@@ -1,72 +0,0 @@
|
|||||||
# ansi-regex
|
|
||||||
|
|
||||||
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```
|
|
||||||
$ npm install ansi-regex
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```js
|
|
||||||
import ansiRegex from 'ansi-regex';
|
|
||||||
|
|
||||||
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
|
||||||
//=> true
|
|
||||||
|
|
||||||
ansiRegex().test('cake');
|
|
||||||
//=> false
|
|
||||||
|
|
||||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
|
||||||
//=> ['\u001B[4m', '\u001B[0m']
|
|
||||||
|
|
||||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
|
||||||
//=> ['\u001B[4m']
|
|
||||||
|
|
||||||
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
|
||||||
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### ansiRegex(options?)
|
|
||||||
|
|
||||||
Returns a regex for matching ANSI escape codes.
|
|
||||||
|
|
||||||
#### options
|
|
||||||
|
|
||||||
Type: `object`
|
|
||||||
|
|
||||||
##### onlyFirst
|
|
||||||
|
|
||||||
Type: `boolean`\
|
|
||||||
Default: `false` *(Matches any ANSI escape codes in a string)*
|
|
||||||
|
|
||||||
Match only the first ANSI escape.
|
|
||||||
|
|
||||||
## FAQ
|
|
||||||
|
|
||||||
### Why do you test for codes not in the ECMA 48 standard?
|
|
||||||
|
|
||||||
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
|
||||||
|
|
||||||
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
|
||||||
|
|
||||||
## Maintainers
|
|
||||||
|
|
||||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
|
||||||
- [Josh Junon](https://github.com/qix-)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
<b>
|
|
||||||
<a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
|
||||||
</b>
|
|
||||||
<br>
|
|
||||||
<sub>
|
|
||||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|
||||||
</sub>
|
|
||||||
</div>
|
|
236
app/node_modules/ansi-styles/index.d.ts
generated
vendored
@@ -1,236 +0,0 @@
|
|||||||
export interface CSPair { // eslint-disable-line @typescript-eslint/naming-convention
|
|
||||||
/**
|
|
||||||
The ANSI terminal control sequence for starting this style.
|
|
||||||
*/
|
|
||||||
readonly open: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
The ANSI terminal control sequence for ending this style.
|
|
||||||
*/
|
|
||||||
readonly close: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ColorBase {
|
|
||||||
/**
|
|
||||||
The ANSI terminal control sequence for ending this color.
|
|
||||||
*/
|
|
||||||
readonly close: string;
|
|
||||||
|
|
||||||
ansi(code: number): string;
|
|
||||||
|
|
||||||
ansi256(code: number): string;
|
|
||||||
|
|
||||||
ansi16m(red: number, green: number, blue: number): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Modifier {
|
|
||||||
/**
|
|
||||||
Resets the current color chain.
|
|
||||||
*/
|
|
||||||
readonly reset: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Make text bold.
|
|
||||||
*/
|
|
||||||
readonly bold: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Emitting only a small amount of light.
|
|
||||||
*/
|
|
||||||
readonly dim: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Make text italic. (Not widely supported)
|
|
||||||
*/
|
|
||||||
readonly italic: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Make text underline. (Not widely supported)
|
|
||||||
*/
|
|
||||||
readonly underline: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Make text overline.
|
|
||||||
|
|
||||||
Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.
|
|
||||||
*/
|
|
||||||
readonly overline: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Inverse background and foreground colors.
|
|
||||||
*/
|
|
||||||
readonly inverse: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Prints the text, but makes it invisible.
|
|
||||||
*/
|
|
||||||
readonly hidden: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Puts a horizontal line through the center of the text. (Not widely supported)
|
|
||||||
*/
|
|
||||||
readonly strikethrough: CSPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ForegroundColor {
|
|
||||||
readonly black: CSPair;
|
|
||||||
readonly red: CSPair;
|
|
||||||
readonly green: CSPair;
|
|
||||||
readonly yellow: CSPair;
|
|
||||||
readonly blue: CSPair;
|
|
||||||
readonly cyan: CSPair;
|
|
||||||
readonly magenta: CSPair;
|
|
||||||
readonly white: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Alias for `blackBright`.
|
|
||||||
*/
|
|
||||||
readonly gray: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Alias for `blackBright`.
|
|
||||||
*/
|
|
||||||
readonly grey: CSPair;
|
|
||||||
|
|
||||||
readonly blackBright: CSPair;
|
|
||||||
readonly redBright: CSPair;
|
|
||||||
readonly greenBright: CSPair;
|
|
||||||
readonly yellowBright: CSPair;
|
|
||||||
readonly blueBright: CSPair;
|
|
||||||
readonly cyanBright: CSPair;
|
|
||||||
readonly magentaBright: CSPair;
|
|
||||||
readonly whiteBright: CSPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BackgroundColor {
|
|
||||||
readonly bgBlack: CSPair;
|
|
||||||
readonly bgRed: CSPair;
|
|
||||||
readonly bgGreen: CSPair;
|
|
||||||
readonly bgYellow: CSPair;
|
|
||||||
readonly bgBlue: CSPair;
|
|
||||||
readonly bgCyan: CSPair;
|
|
||||||
readonly bgMagenta: CSPair;
|
|
||||||
readonly bgWhite: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Alias for `bgBlackBright`.
|
|
||||||
*/
|
|
||||||
readonly bgGray: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Alias for `bgBlackBright`.
|
|
||||||
*/
|
|
||||||
readonly bgGrey: CSPair;
|
|
||||||
|
|
||||||
readonly bgBlackBright: CSPair;
|
|
||||||
readonly bgRedBright: CSPair;
|
|
||||||
readonly bgGreenBright: CSPair;
|
|
||||||
readonly bgYellowBright: CSPair;
|
|
||||||
readonly bgBlueBright: CSPair;
|
|
||||||
readonly bgCyanBright: CSPair;
|
|
||||||
readonly bgMagentaBright: CSPair;
|
|
||||||
readonly bgWhiteBright: CSPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ConvertColor {
|
|
||||||
/**
|
|
||||||
Convert from the RGB color space to the ANSI 256 color space.
|
|
||||||
|
|
||||||
@param red - (`0...255`)
|
|
||||||
@param green - (`0...255`)
|
|
||||||
@param blue - (`0...255`)
|
|
||||||
*/
|
|
||||||
rgbToAnsi256(red: number, green: number, blue: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert from the RGB HEX color space to the RGB color space.
|
|
||||||
|
|
||||||
@param hex - A hexadecimal string containing RGB data.
|
|
||||||
*/
|
|
||||||
hexToRgb(hex: string): [red: number, green: number, blue: number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert from the RGB HEX color space to the ANSI 256 color space.
|
|
||||||
|
|
||||||
@param hex - A hexadecimal string containing RGB data.
|
|
||||||
*/
|
|
||||||
hexToAnsi256(hex: string): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert from the ANSI 256 color space to the ANSI 16 color space.
|
|
||||||
|
|
||||||
@param code - A number representing the ANSI 256 color.
|
|
||||||
*/
|
|
||||||
ansi256ToAnsi(code: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert from the RGB color space to the ANSI 16 color space.
|
|
||||||
|
|
||||||
@param red - (`0...255`)
|
|
||||||
@param green - (`0...255`)
|
|
||||||
@param blue - (`0...255`)
|
|
||||||
*/
|
|
||||||
rgbToAnsi(red: number, green: number, blue: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert from the RGB HEX color space to the ANSI 16 color space.
|
|
||||||
|
|
||||||
@param hex - A hexadecimal string containing RGB data.
|
|
||||||
*/
|
|
||||||
hexToAnsi(hex: string): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Basic modifier names.
|
|
||||||
*/
|
|
||||||
export type ModifierName = keyof Modifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Basic foreground color names.
|
|
||||||
|
|
||||||
[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
|
|
||||||
*/
|
|
||||||
export type ForegroundColorName = keyof ForegroundColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Basic background color names.
|
|
||||||
|
|
||||||
[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
|
|
||||||
*/
|
|
||||||
export type BackgroundColorName = keyof BackgroundColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Basic color names. The combination of foreground and background color names.
|
|
||||||
|
|
||||||
[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
|
|
||||||
*/
|
|
||||||
export type ColorName = ForegroundColorName | BackgroundColorName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Basic modifier names.
|
|
||||||
*/
|
|
||||||
export const modifierNames: readonly ModifierName[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
Basic foreground color names.
|
|
||||||
*/
|
|
||||||
export const foregroundColorNames: readonly ForegroundColorName[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
Basic background color names.
|
|
||||||
*/
|
|
||||||
export const backgroundColorNames: readonly BackgroundColorName[];
|
|
||||||
|
|
||||||
/*
|
|
||||||
Basic color names. The combination of foreground and background color names.
|
|
||||||
*/
|
|
||||||
export const colorNames: readonly ColorName[];
|
|
||||||
|
|
||||||
declare const ansiStyles: {
|
|
||||||
readonly modifier: Modifier;
|
|
||||||
readonly color: ColorBase & ForegroundColor;
|
|
||||||
readonly bgColor: ColorBase & BackgroundColor;
|
|
||||||
readonly codes: ReadonlyMap<number, number>;
|
|
||||||
} & ForegroundColor & BackgroundColor & Modifier & ConvertColor;
|
|
||||||
|
|
||||||
export default ansiStyles;
|
|
223
app/node_modules/ansi-styles/index.js
generated
vendored
@@ -1,223 +0,0 @@
|
|||||||
const ANSI_BACKGROUND_OFFSET = 10;
|
|
||||||
|
|
||||||
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
|
|
||||||
|
|
||||||
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
|
||||||
|
|
||||||
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
||||||
|
|
||||||
const styles = {
|
|
||||||
modifier: {
|
|
||||||
reset: [0, 0],
|
|
||||||
// 21 isn't widely supported and 22 does the same thing
|
|
||||||
bold: [1, 22],
|
|
||||||
dim: [2, 22],
|
|
||||||
italic: [3, 23],
|
|
||||||
underline: [4, 24],
|
|
||||||
overline: [53, 55],
|
|
||||||
inverse: [7, 27],
|
|
||||||
hidden: [8, 28],
|
|
||||||
strikethrough: [9, 29],
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
black: [30, 39],
|
|
||||||
red: [31, 39],
|
|
||||||
green: [32, 39],
|
|
||||||
yellow: [33, 39],
|
|
||||||
blue: [34, 39],
|
|
||||||
magenta: [35, 39],
|
|
||||||
cyan: [36, 39],
|
|
||||||
white: [37, 39],
|
|
||||||
|
|
||||||
// Bright color
|
|
||||||
blackBright: [90, 39],
|
|
||||||
gray: [90, 39], // Alias of `blackBright`
|
|
||||||
grey: [90, 39], // Alias of `blackBright`
|
|
||||||
redBright: [91, 39],
|
|
||||||
greenBright: [92, 39],
|
|
||||||
yellowBright: [93, 39],
|
|
||||||
blueBright: [94, 39],
|
|
||||||
magentaBright: [95, 39],
|
|
||||||
cyanBright: [96, 39],
|
|
||||||
whiteBright: [97, 39],
|
|
||||||
},
|
|
||||||
bgColor: {
|
|
||||||
bgBlack: [40, 49],
|
|
||||||
bgRed: [41, 49],
|
|
||||||
bgGreen: [42, 49],
|
|
||||||
bgYellow: [43, 49],
|
|
||||||
bgBlue: [44, 49],
|
|
||||||
bgMagenta: [45, 49],
|
|
||||||
bgCyan: [46, 49],
|
|
||||||
bgWhite: [47, 49],
|
|
||||||
|
|
||||||
// Bright color
|
|
||||||
bgBlackBright: [100, 49],
|
|
||||||
bgGray: [100, 49], // Alias of `bgBlackBright`
|
|
||||||
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
|
||||||
bgRedBright: [101, 49],
|
|
||||||
bgGreenBright: [102, 49],
|
|
||||||
bgYellowBright: [103, 49],
|
|
||||||
bgBlueBright: [104, 49],
|
|
||||||
bgMagentaBright: [105, 49],
|
|
||||||
bgCyanBright: [106, 49],
|
|
||||||
bgWhiteBright: [107, 49],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const modifierNames = Object.keys(styles.modifier);
|
|
||||||
export const foregroundColorNames = Object.keys(styles.color);
|
|
||||||
export const backgroundColorNames = Object.keys(styles.bgColor);
|
|
||||||
export const colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
||||||
|
|
||||||
function assembleStyles() {
|
|
||||||
const codes = new Map();
|
|
||||||
|
|
||||||
for (const [groupName, group] of Object.entries(styles)) {
|
|
||||||
for (const [styleName, style] of Object.entries(group)) {
|
|
||||||
styles[styleName] = {
|
|
||||||
open: `\u001B[${style[0]}m`,
|
|
||||||
close: `\u001B[${style[1]}m`,
|
|
||||||
};
|
|
||||||
|
|
||||||
group[styleName] = styles[styleName];
|
|
||||||
|
|
||||||
codes.set(style[0], style[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.defineProperty(styles, groupName, {
|
|
||||||
value: group,
|
|
||||||
enumerable: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.defineProperty(styles, 'codes', {
|
|
||||||
value: codes,
|
|
||||||
enumerable: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
styles.color.close = '\u001B[39m';
|
|
||||||
styles.bgColor.close = '\u001B[49m';
|
|
||||||
|
|
||||||
styles.color.ansi = wrapAnsi16();
|
|
||||||
styles.color.ansi256 = wrapAnsi256();
|
|
||||||
styles.color.ansi16m = wrapAnsi16m();
|
|
||||||
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
||||||
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
||||||
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
||||||
|
|
||||||
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
|
||||||
Object.defineProperties(styles, {
|
|
||||||
rgbToAnsi256: {
|
|
||||||
value: (red, green, blue) => {
|
|
||||||
// We use the extended greyscale palette here, with the exception of
|
|
||||||
// black and white. normal palette only has 4 greyscale shades.
|
|
||||||
if (red === green && green === blue) {
|
|
||||||
if (red < 8) {
|
|
||||||
return 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (red > 248) {
|
|
||||||
return 231;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.round(((red - 8) / 247) * 24) + 232;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 16
|
|
||||||
+ (36 * Math.round(red / 255 * 5))
|
|
||||||
+ (6 * Math.round(green / 255 * 5))
|
|
||||||
+ Math.round(blue / 255 * 5);
|
|
||||||
},
|
|
||||||
enumerable: false,
|
|
||||||
},
|
|
||||||
hexToRgb: {
|
|
||||||
value: hex => {
|
|
||||||
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
||||||
if (!matches) {
|
|
||||||
return [0, 0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
let [colorString] = matches;
|
|
||||||
|
|
||||||
if (colorString.length === 3) {
|
|
||||||
colorString = [...colorString].map(character => character + character).join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
const integer = Number.parseInt(colorString, 16);
|
|
||||||
|
|
||||||
return [
|
|
||||||
/* eslint-disable no-bitwise */
|
|
||||||
(integer >> 16) & 0xFF,
|
|
||||||
(integer >> 8) & 0xFF,
|
|
||||||
integer & 0xFF,
|
|
||||||
/* eslint-enable no-bitwise */
|
|
||||||
];
|
|
||||||
},
|
|
||||||
enumerable: false,
|
|
||||||
},
|
|
||||||
hexToAnsi256: {
|
|
||||||
value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
||||||
enumerable: false,
|
|
||||||
},
|
|
||||||
ansi256ToAnsi: {
|
|
||||||
value: code => {
|
|
||||||
if (code < 8) {
|
|
||||||
return 30 + code;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (code < 16) {
|
|
||||||
return 90 + (code - 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
let red;
|
|
||||||
let green;
|
|
||||||
let blue;
|
|
||||||
|
|
||||||
if (code >= 232) {
|
|
||||||
red = (((code - 232) * 10) + 8) / 255;
|
|
||||||
green = red;
|
|
||||||
blue = red;
|
|
||||||
} else {
|
|
||||||
code -= 16;
|
|
||||||
|
|
||||||
const remainder = code % 36;
|
|
||||||
|
|
||||||
red = Math.floor(code / 36) / 5;
|
|
||||||
green = Math.floor(remainder / 6) / 5;
|
|
||||||
blue = (remainder % 6) / 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
const value = Math.max(red, green, blue) * 2;
|
|
||||||
|
|
||||||
if (value === 0) {
|
|
||||||
return 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-bitwise
|
|
||||||
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
|
||||||
|
|
||||||
if (value === 2) {
|
|
||||||
result += 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
enumerable: false,
|
|
||||||
},
|
|
||||||
rgbToAnsi: {
|
|
||||||
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
||||||
enumerable: false,
|
|
||||||
},
|
|
||||||
hexToAnsi: {
|
|
||||||
value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
||||||
enumerable: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return styles;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ansiStyles = assembleStyles();
|
|
||||||
|
|
||||||
export default ansiStyles;
|
|
9
app/node_modules/ansi-styles/license
generated
vendored
@@ -1,9 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.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.
|
|
86
app/node_modules/ansi-styles/package.json
generated
vendored
@@ -1,86 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "ansi-styles@^6.1.0",
|
|
||||||
"_id": "ansi-styles@6.2.1",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
|
||||||
"_location": "/ansi-styles",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "range",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "ansi-styles@^6.1.0",
|
|
||||||
"name": "ansi-styles",
|
|
||||||
"escapedName": "ansi-styles",
|
|
||||||
"rawSpec": "^6.1.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "^6.1.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/wrap-ansi"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
|
|
||||||
"_shasum": "0e62320cf99c21afff3b3012192546aacbfb05c5",
|
|
||||||
"_spec": "ansi-styles@^6.1.0",
|
|
||||||
"_where": "/mnt/c/Users/docto/Downloads/Rappaurio/node_modules/wrap-ansi",
|
|
||||||
"author": {
|
|
||||||
"name": "Sindre Sorhus",
|
|
||||||
"email": "sindresorhus@gmail.com",
|
|
||||||
"url": "https://sindresorhus.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/chalk/ansi-styles/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "ANSI escape codes for styling strings in the terminal",
|
|
||||||
"devDependencies": {
|
|
||||||
"ava": "^3.15.0",
|
|
||||||
"svg-term-cli": "^2.1.1",
|
|
||||||
"tsd": "^0.19.0",
|
|
||||||
"xo": "^0.47.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
},
|
|
||||||
"exports": "./index.js",
|
|
||||||
"files": [
|
|
||||||
"index.js",
|
|
||||||
"index.d.ts"
|
|
||||||
],
|
|
||||||
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
|
|
||||||
"homepage": "https://github.com/chalk/ansi-styles#readme",
|
|
||||||
"keywords": [
|
|
||||||
"ansi",
|
|
||||||
"styles",
|
|
||||||
"color",
|
|
||||||
"colour",
|
|
||||||
"colors",
|
|
||||||
"terminal",
|
|
||||||
"console",
|
|
||||||
"cli",
|
|
||||||
"string",
|
|
||||||
"tty",
|
|
||||||
"escape",
|
|
||||||
"formatting",
|
|
||||||
"rgb",
|
|
||||||
"256",
|
|
||||||
"shell",
|
|
||||||
"xterm",
|
|
||||||
"log",
|
|
||||||
"logging",
|
|
||||||
"command-line",
|
|
||||||
"text"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"name": "ansi-styles",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/chalk/ansi-styles.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
|
|
||||||
"test": "xo && ava && tsd"
|
|
||||||
},
|
|
||||||
"type": "module",
|
|
||||||
"version": "6.2.1"
|
|
||||||
}
|
|
173
app/node_modules/ansi-styles/readme.md
generated
vendored
@@ -1,173 +0,0 @@
|
|||||||
# ansi-styles
|
|
||||||
|
|
||||||
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
|
||||||
|
|
||||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install ansi-styles
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```js
|
|
||||||
import styles from 'ansi-styles';
|
|
||||||
|
|
||||||
console.log(`${styles.green.open}Hello world!${styles.green.close}`);
|
|
||||||
|
|
||||||
|
|
||||||
// Color conversion between 256/truecolor
|
|
||||||
// NOTE: When converting from truecolor to 256 colors, the original color
|
|
||||||
// may be degraded to fit the new color palette. This means terminals
|
|
||||||
// that do not support 16 million colors will best-match the
|
|
||||||
// original color.
|
|
||||||
console.log(`${styles.color.ansi(styles.rgbToAnsi(199, 20, 250))}Hello World${styles.color.close}`)
|
|
||||||
console.log(`${styles.color.ansi256(styles.rgbToAnsi256(199, 20, 250))}Hello World${styles.color.close}`)
|
|
||||||
console.log(`${styles.color.ansi16m(...styles.hexToRgb('#abcdef'))}Hello World${styles.color.close}`)
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### `open` and `close`
|
|
||||||
|
|
||||||
Each style has an `open` and `close` property.
|
|
||||||
|
|
||||||
### `modifierNames`, `foregroundColorNames`, `backgroundColorNames`, and `colorNames`
|
|
||||||
|
|
||||||
All supported style strings are exposed as an array of strings for convenience. `colorNames` is the combination of `foregroundColorNames` and `backgroundColorNames`.
|
|
||||||
|
|
||||||
This can be useful if you need to validate input:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import {modifierNames, foregroundColorNames} from 'ansi-styles';
|
|
||||||
|
|
||||||
console.log(modifierNames.includes('bold'));
|
|
||||||
//=> true
|
|
||||||
|
|
||||||
console.log(foregroundColorNames.includes('pink'));
|
|
||||||
//=> false
|
|
||||||
```
|
|
||||||
|
|
||||||
## Styles
|
|
||||||
|
|
||||||
### Modifiers
|
|
||||||
|
|
||||||
- `reset`
|
|
||||||
- `bold`
|
|
||||||
- `dim`
|
|
||||||
- `italic` *(Not widely supported)*
|
|
||||||
- `underline`
|
|
||||||
- `overline` *Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.*
|
|
||||||
- `inverse`
|
|
||||||
- `hidden`
|
|
||||||
- `strikethrough` *(Not widely supported)*
|
|
||||||
|
|
||||||
### Colors
|
|
||||||
|
|
||||||
- `black`
|
|
||||||
- `red`
|
|
||||||
- `green`
|
|
||||||
- `yellow`
|
|
||||||
- `blue`
|
|
||||||
- `magenta`
|
|
||||||
- `cyan`
|
|
||||||
- `white`
|
|
||||||
- `blackBright` (alias: `gray`, `grey`)
|
|
||||||
- `redBright`
|
|
||||||
- `greenBright`
|
|
||||||
- `yellowBright`
|
|
||||||
- `blueBright`
|
|
||||||
- `magentaBright`
|
|
||||||
- `cyanBright`
|
|
||||||
- `whiteBright`
|
|
||||||
|
|
||||||
### Background colors
|
|
||||||
|
|
||||||
- `bgBlack`
|
|
||||||
- `bgRed`
|
|
||||||
- `bgGreen`
|
|
||||||
- `bgYellow`
|
|
||||||
- `bgBlue`
|
|
||||||
- `bgMagenta`
|
|
||||||
- `bgCyan`
|
|
||||||
- `bgWhite`
|
|
||||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
|
||||||
- `bgRedBright`
|
|
||||||
- `bgGreenBright`
|
|
||||||
- `bgYellowBright`
|
|
||||||
- `bgBlueBright`
|
|
||||||
- `bgMagentaBright`
|
|
||||||
- `bgCyanBright`
|
|
||||||
- `bgWhiteBright`
|
|
||||||
|
|
||||||
## Advanced usage
|
|
||||||
|
|
||||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
|
||||||
|
|
||||||
- `styles.modifier`
|
|
||||||
- `styles.color`
|
|
||||||
- `styles.bgColor`
|
|
||||||
|
|
||||||
###### Example
|
|
||||||
|
|
||||||
```js
|
|
||||||
import styles from 'ansi-styles';
|
|
||||||
|
|
||||||
console.log(styles.color.green.open);
|
|
||||||
```
|
|
||||||
|
|
||||||
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `styles.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
|
||||||
|
|
||||||
###### Example
|
|
||||||
|
|
||||||
```js
|
|
||||||
import styles from 'ansi-styles';
|
|
||||||
|
|
||||||
console.log(styles.codes.get(36));
|
|
||||||
//=> 39
|
|
||||||
```
|
|
||||||
|
|
||||||
## 16 / 256 / 16 million (TrueColor) support
|
|
||||||
|
|
||||||
`ansi-styles` allows converting between various color formats and ANSI escapes, with support for 16, 256 and [16 million colors](https://gist.github.com/XVilka/8346728).
|
|
||||||
|
|
||||||
The following color spaces are supported:
|
|
||||||
|
|
||||||
- `rgb`
|
|
||||||
- `hex`
|
|
||||||
- `ansi256`
|
|
||||||
- `ansi`
|
|
||||||
|
|
||||||
To use these, call the associated conversion function with the intended output, for example:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import styles from 'ansi-styles';
|
|
||||||
|
|
||||||
styles.color.ansi(styles.rgbToAnsi(100, 200, 15)); // RGB to 16 color ansi foreground code
|
|
||||||
styles.bgColor.ansi(styles.hexToAnsi('#C0FFEE')); // HEX to 16 color ansi foreground code
|
|
||||||
|
|
||||||
styles.color.ansi256(styles.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code
|
|
||||||
styles.bgColor.ansi256(styles.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code
|
|
||||||
|
|
||||||
styles.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code
|
|
||||||
styles.bgColor.ansi16m(...styles.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code
|
|
||||||
```
|
|
||||||
|
|
||||||
## Related
|
|
||||||
|
|
||||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
|
||||||
|
|
||||||
## Maintainers
|
|
||||||
|
|
||||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
|
||||||
- [Josh Junon](https://github.com/qix-)
|
|
||||||
|
|
||||||
## For enterprise
|
|
||||||
|
|
||||||
Available as part of the Tidelift Subscription.
|
|
||||||
|
|
||||||
The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
|
21
app/node_modules/array-flatten/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.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.
|
|
43
app/node_modules/array-flatten/README.md
generated
vendored
@@ -1,43 +0,0 @@
|
|||||||
# Array Flatten
|
|
||||||
|
|
||||||
[![NPM version][npm-image]][npm-url]
|
|
||||||
[![NPM downloads][downloads-image]][downloads-url]
|
|
||||||
[![Build status][travis-image]][travis-url]
|
|
||||||
[![Test coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install array-flatten --save
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var flatten = require('array-flatten')
|
|
||||||
|
|
||||||
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
|
|
||||||
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
||||||
|
|
||||||
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
|
|
||||||
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
flatten(arguments) //=> [1, 2, 3]
|
|
||||||
})(1, [2, 3])
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
|
|
||||||
[npm-url]: https://npmjs.org/package/array-flatten
|
|
||||||
[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
|
|
||||||
[downloads-url]: https://npmjs.org/package/array-flatten
|
|
||||||
[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
|
|
||||||
[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
|
|
||||||
[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
|
|
64
app/node_modules/array-flatten/array-flatten.js
generated
vendored
@@ -1,64 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose `arrayFlatten`.
|
|
||||||
*/
|
|
||||||
module.exports = arrayFlatten
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursive flatten function with depth.
|
|
||||||
*
|
|
||||||
* @param {Array} array
|
|
||||||
* @param {Array} result
|
|
||||||
* @param {Number} depth
|
|
||||||
* @return {Array}
|
|
||||||
*/
|
|
||||||
function flattenWithDepth (array, result, depth) {
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
var value = array[i]
|
|
||||||
|
|
||||||
if (depth > 0 && Array.isArray(value)) {
|
|
||||||
flattenWithDepth(value, result, depth - 1)
|
|
||||||
} else {
|
|
||||||
result.push(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursive flatten function. Omitting depth is slightly faster.
|
|
||||||
*
|
|
||||||
* @param {Array} array
|
|
||||||
* @param {Array} result
|
|
||||||
* @return {Array}
|
|
||||||
*/
|
|
||||||
function flattenForever (array, result) {
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
var value = array[i]
|
|
||||||
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
flattenForever(value, result)
|
|
||||||
} else {
|
|
||||||
result.push(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flatten an array, with the ability to define a depth.
|
|
||||||
*
|
|
||||||
* @param {Array} array
|
|
||||||
* @param {Number} depth
|
|
||||||
* @return {Array}
|
|
||||||
*/
|
|
||||||
function arrayFlatten (array, depth) {
|
|
||||||
if (depth == null) {
|
|
||||||
return flattenForever(array, [])
|
|
||||||
}
|
|
||||||
|
|
||||||
return flattenWithDepth(array, [], depth)
|
|
||||||
}
|
|
64
app/node_modules/array-flatten/package.json
generated
vendored
@@ -1,64 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "array-flatten@1.1.1",
|
|
||||||
"_id": "array-flatten@1.1.1",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
|
||||||
"_location": "/array-flatten",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "array-flatten@1.1.1",
|
|
||||||
"name": "array-flatten",
|
|
||||||
"escapedName": "array-flatten",
|
|
||||||
"rawSpec": "1.1.1",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.1.1"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/express"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
|
||||||
"_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2",
|
|
||||||
"_spec": "array-flatten@1.1.1",
|
|
||||||
"_where": "/mnt/c/Users/docto/Downloads/Rappaurio/node_modules/express",
|
|
||||||
"author": {
|
|
||||||
"name": "Blake Embrey",
|
|
||||||
"email": "hello@blakeembrey.com",
|
|
||||||
"url": "http://blakeembrey.me"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/blakeembrey/array-flatten/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Flatten an array of nested arrays into a single flat array",
|
|
||||||
"devDependencies": {
|
|
||||||
"istanbul": "^0.3.13",
|
|
||||||
"mocha": "^2.2.4",
|
|
||||||
"pre-commit": "^1.0.7",
|
|
||||||
"standard": "^3.7.3"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"array-flatten.js",
|
|
||||||
"LICENSE"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/blakeembrey/array-flatten",
|
|
||||||
"keywords": [
|
|
||||||
"array",
|
|
||||||
"flatten",
|
|
||||||
"arguments",
|
|
||||||
"depth"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "array-flatten.js",
|
|
||||||
"name": "array-flatten",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/blakeembrey/array-flatten.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "istanbul cover _mocha -- -R spec"
|
|
||||||
},
|
|
||||||
"version": "1.1.1"
|
|
||||||
}
|
|
21
app/node_modules/asynckit/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 Alex Indigo
|
|
||||||
|
|
||||||
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.
|
|
233
app/node_modules/asynckit/README.md
generated
vendored
@@ -1,233 +0,0 @@
|
|||||||
# asynckit [](https://www.npmjs.com/package/asynckit)
|
|
||||||
|
|
||||||
Minimal async jobs utility library, with streams support.
|
|
||||||
|
|
||||||
[](https://travis-ci.org/alexindigo/asynckit)
|
|
||||||
[](https://travis-ci.org/alexindigo/asynckit)
|
|
||||||
[](https://ci.appveyor.com/project/alexindigo/asynckit)
|
|
||||||
|
|
||||||
[](https://coveralls.io/github/alexindigo/asynckit?branch=master)
|
|
||||||
[](https://david-dm.org/alexindigo/asynckit)
|
|
||||||
[](https://www.bithound.io/github/alexindigo/asynckit)
|
|
||||||
|
|
||||||
<!-- [](https://www.npmjs.com/package/reamde) -->
|
|
||||||
|
|
||||||
AsyncKit provides harness for `parallel` and `serial` iterators over list of items represented by arrays or objects.
|
|
||||||
Optionally it accepts abort function (should be synchronously return by iterator for each item), and terminates left over jobs upon an error event. For specific iteration order built-in (`ascending` and `descending`) and custom sort helpers also supported, via `asynckit.serialOrdered` method.
|
|
||||||
|
|
||||||
It ensures async operations to keep behavior more stable and prevent `Maximum call stack size exceeded` errors, from sync iterators.
|
|
||||||
|
|
||||||
| compression | size |
|
|
||||||
| :----------------- | -------: |
|
|
||||||
| asynckit.js | 12.34 kB |
|
|
||||||
| asynckit.min.js | 4.11 kB |
|
|
||||||
| asynckit.min.js.gz | 1.47 kB |
|
|
||||||
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install --save asynckit
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Parallel Jobs
|
|
||||||
|
|
||||||
Runs iterator over provided array in parallel. Stores output in the `result` array,
|
|
||||||
on the matching positions. In unlikely event of an error from one of the jobs,
|
|
||||||
will terminate rest of the active jobs (if abort function is provided)
|
|
||||||
and return error along with salvaged data to the main callback function.
|
|
||||||
|
|
||||||
#### Input Array
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var parallel = require('asynckit').parallel
|
|
||||||
, assert = require('assert')
|
|
||||||
;
|
|
||||||
|
|
||||||
var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
|
|
||||||
, expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
|
|
||||||
, expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ]
|
|
||||||
, target = []
|
|
||||||
;
|
|
||||||
|
|
||||||
parallel(source, asyncJob, function(err, result)
|
|
||||||
{
|
|
||||||
assert.deepEqual(result, expectedResult);
|
|
||||||
assert.deepEqual(target, expectedTarget);
|
|
||||||
});
|
|
||||||
|
|
||||||
// async job accepts one element from the array
|
|
||||||
// and a callback function
|
|
||||||
function asyncJob(item, cb)
|
|
||||||
{
|
|
||||||
// different delays (in ms) per item
|
|
||||||
var delay = item * 25;
|
|
||||||
|
|
||||||
// pretend different jobs take different time to finish
|
|
||||||
// and not in consequential order
|
|
||||||
var timeoutId = setTimeout(function() {
|
|
||||||
target.push(item);
|
|
||||||
cb(null, item * 2);
|
|
||||||
}, delay);
|
|
||||||
|
|
||||||
// allow to cancel "leftover" jobs upon error
|
|
||||||
// return function, invoking of which will abort this job
|
|
||||||
return clearTimeout.bind(null, timeoutId);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
More examples could be found in [test/test-parallel-array.js](test/test-parallel-array.js).
|
|
||||||
|
|
||||||
#### Input Object
|
|
||||||
|
|
||||||
Also it supports named jobs, listed via object.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var parallel = require('asynckit/parallel')
|
|
||||||
, assert = require('assert')
|
|
||||||
;
|
|
||||||
|
|
||||||
var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 }
|
|
||||||
, expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 }
|
|
||||||
, expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ]
|
|
||||||
, expectedKeys = [ 'first', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtyTwo', 'sixtyFour' ]
|
|
||||||
, target = []
|
|
||||||
, keys = []
|
|
||||||
;
|
|
||||||
|
|
||||||
parallel(source, asyncJob, function(err, result)
|
|
||||||
{
|
|
||||||
assert.deepEqual(result, expectedResult);
|
|
||||||
assert.deepEqual(target, expectedTarget);
|
|
||||||
assert.deepEqual(keys, expectedKeys);
|
|
||||||
});
|
|
||||||
|
|
||||||
// supports full value, key, callback (shortcut) interface
|
|
||||||
function asyncJob(item, key, cb)
|
|
||||||
{
|
|
||||||
// different delays (in ms) per item
|
|
||||||
var delay = item * 25;
|
|
||||||
|
|
||||||
// pretend different jobs take different time to finish
|
|
||||||
// and not in consequential order
|
|
||||||
var timeoutId = setTimeout(function() {
|
|
||||||
keys.push(key);
|
|
||||||
target.push(item);
|
|
||||||
cb(null, item * 2);
|
|
||||||
}, delay);
|
|
||||||
|
|
||||||
// allow to cancel "leftover" jobs upon error
|
|
||||||
// return function, invoking of which will abort this job
|
|
||||||
return clearTimeout.bind(null, timeoutId);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
More examples could be found in [test/test-parallel-object.js](test/test-parallel-object.js).
|
|
||||||
|
|
||||||
### Serial Jobs
|
|
||||||
|
|
||||||
Runs iterator over provided array sequentially. Stores output in the `result` array,
|
|
||||||
on the matching positions. In unlikely event of an error from one of the jobs,
|
|
||||||
will not proceed to the rest of the items in the list
|
|
||||||
and return error along with salvaged data to the main callback function.
|
|
||||||
|
|
||||||
#### Input Array
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var serial = require('asynckit/serial')
|
|
||||||
, assert = require('assert')
|
|
||||||
;
|
|
||||||
|
|
||||||
var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
|
|
||||||
, expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
|
|
||||||
, expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ]
|
|
||||||
, target = []
|
|
||||||
;
|
|
||||||
|
|
||||||
serial(source, asyncJob, function(err, result)
|
|
||||||
{
|
|
||||||
assert.deepEqual(result, expectedResult);
|
|
||||||
assert.deepEqual(target, expectedTarget);
|
|
||||||
});
|
|
||||||
|
|
||||||
// extended interface (item, key, callback)
|
|
||||||
// also supported for arrays
|
|
||||||
function asyncJob(item, key, cb)
|
|
||||||
{
|
|
||||||
target.push(key);
|
|
||||||
|
|
||||||
// it will be automatically made async
|
|
||||||
// even it iterator "returns" in the same event loop
|
|
||||||
cb(null, item * 2);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
More examples could be found in [test/test-serial-array.js](test/test-serial-array.js).
|
|
||||||
|
|
||||||
#### Input Object
|
|
||||||
|
|
||||||
Also it supports named jobs, listed via object.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var serial = require('asynckit').serial
|
|
||||||
, assert = require('assert')
|
|
||||||
;
|
|
||||||
|
|
||||||
var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
|
|
||||||
, expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
|
|
||||||
, expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ]
|
|
||||||
, target = []
|
|
||||||
;
|
|
||||||
|
|
||||||
var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 }
|
|
||||||
, expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 }
|
|
||||||
, expectedTarget = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
|
|
||||||
, target = []
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
serial(source, asyncJob, function(err, result)
|
|
||||||
{
|
|
||||||
assert.deepEqual(result, expectedResult);
|
|
||||||
assert.deepEqual(target, expectedTarget);
|
|
||||||
});
|
|
||||||
|
|
||||||
// shortcut interface (item, callback)
|
|
||||||
// works for object as well as for the arrays
|
|
||||||
function asyncJob(item, cb)
|
|
||||||
{
|
|
||||||
target.push(item);
|
|
||||||
|
|
||||||
// it will be automatically made async
|
|
||||||
// even it iterator "returns" in the same event loop
|
|
||||||
cb(null, item * 2);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
More examples could be found in [test/test-serial-object.js](test/test-serial-object.js).
|
|
||||||
|
|
||||||
_Note: Since _object_ is an _unordered_ collection of properties,
|
|
||||||
it may produce unexpected results with sequential iterations.
|
|
||||||
Whenever order of the jobs' execution is important please use `serialOrdered` method._
|
|
||||||
|
|
||||||
### Ordered Serial Iterations
|
|
||||||
|
|
||||||
TBD
|
|
||||||
|
|
||||||
For example [compare-property](compare-property) package.
|
|
||||||
|
|
||||||
### Streaming interface
|
|
||||||
|
|
||||||
TBD
|
|
||||||
|
|
||||||
## Want to Know More?
|
|
||||||
|
|
||||||
More examples can be found in [test folder](test/).
|
|
||||||
|
|
||||||
Or open an [issue](https://github.com/alexindigo/asynckit/issues) with questions and/or suggestions.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
AsyncKit is licensed under the MIT license.
|
|
76
app/node_modules/asynckit/bench.js
generated
vendored
@@ -1,76 +0,0 @@
|
|||||||
/* eslint no-console: "off" */
|
|
||||||
|
|
||||||
var asynckit = require('./')
|
|
||||||
, async = require('async')
|
|
||||||
, assert = require('assert')
|
|
||||||
, expected = 0
|
|
||||||
;
|
|
||||||
|
|
||||||
var Benchmark = require('benchmark');
|
|
||||||
var suite = new Benchmark.Suite;
|
|
||||||
|
|
||||||
var source = [];
|
|
||||||
for (var z = 1; z < 100; z++)
|
|
||||||
{
|
|
||||||
source.push(z);
|
|
||||||
expected += z;
|
|
||||||
}
|
|
||||||
|
|
||||||
suite
|
|
||||||
// add tests
|
|
||||||
|
|
||||||
.add('async.map', function(deferred)
|
|
||||||
{
|
|
||||||
var total = 0;
|
|
||||||
|
|
||||||
async.map(source,
|
|
||||||
function(i, cb)
|
|
||||||
{
|
|
||||||
setImmediate(function()
|
|
||||||
{
|
|
||||||
total += i;
|
|
||||||
cb(null, total);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
function(err, result)
|
|
||||||
{
|
|
||||||
assert.ifError(err);
|
|
||||||
assert.equal(result[result.length - 1], expected);
|
|
||||||
deferred.resolve();
|
|
||||||
});
|
|
||||||
}, {'defer': true})
|
|
||||||
|
|
||||||
|
|
||||||
.add('asynckit.parallel', function(deferred)
|
|
||||||
{
|
|
||||||
var total = 0;
|
|
||||||
|
|
||||||
asynckit.parallel(source,
|
|
||||||
function(i, cb)
|
|
||||||
{
|
|
||||||
setImmediate(function()
|
|
||||||
{
|
|
||||||
total += i;
|
|
||||||
cb(null, total);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
function(err, result)
|
|
||||||
{
|
|
||||||
assert.ifError(err);
|
|
||||||
assert.equal(result[result.length - 1], expected);
|
|
||||||
deferred.resolve();
|
|
||||||
});
|
|
||||||
}, {'defer': true})
|
|
||||||
|
|
||||||
|
|
||||||
// add listeners
|
|
||||||
.on('cycle', function(ev)
|
|
||||||
{
|
|
||||||
console.log(String(ev.target));
|
|
||||||
})
|
|
||||||
.on('complete', function()
|
|
||||||
{
|
|
||||||
console.log('Fastest is ' + this.filter('fastest').map('name'));
|
|
||||||
})
|
|
||||||
// run async
|
|
||||||
.run({ 'async': true });
|
|
6
app/node_modules/asynckit/index.js
generated
vendored
@@ -1,6 +0,0 @@
|
|||||||
module.exports =
|
|
||||||
{
|
|
||||||
parallel : require('./parallel.js'),
|
|
||||||
serial : require('./serial.js'),
|
|
||||||
serialOrdered : require('./serialOrdered.js')
|
|
||||||
};
|
|
29
app/node_modules/asynckit/lib/abort.js
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
// API
|
|
||||||
module.exports = abort;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aborts leftover active jobs
|
|
||||||
*
|
|
||||||
* @param {object} state - current state object
|
|
||||||
*/
|
|
||||||
function abort(state)
|
|
||||||
{
|
|
||||||
Object.keys(state.jobs).forEach(clean.bind(state));
|
|
||||||
|
|
||||||
// reset leftover jobs
|
|
||||||
state.jobs = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cleans up leftover job by invoking abort function for the provided job id
|
|
||||||
*
|
|
||||||
* @this state
|
|
||||||
* @param {string|number} key - job id to abort
|
|
||||||
*/
|
|
||||||
function clean(key)
|
|
||||||
{
|
|
||||||
if (typeof this.jobs[key] == 'function')
|
|
||||||
{
|
|
||||||
this.jobs[key]();
|
|
||||||
}
|
|
||||||
}
|
|
34
app/node_modules/asynckit/lib/async.js
generated
vendored
@@ -1,34 +0,0 @@
|
|||||||
var defer = require('./defer.js');
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports = async;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs provided callback asynchronously
|
|
||||||
* even if callback itself is not
|
|
||||||
*
|
|
||||||
* @param {function} callback - callback to invoke
|
|
||||||
* @returns {function} - augmented callback
|
|
||||||
*/
|
|
||||||
function async(callback)
|
|
||||||
{
|
|
||||||
var isAsync = false;
|
|
||||||
|
|
||||||
// check if async happened
|
|
||||||
defer(function() { isAsync = true; });
|
|
||||||
|
|
||||||
return function async_callback(err, result)
|
|
||||||
{
|
|
||||||
if (isAsync)
|
|
||||||
{
|
|
||||||
callback(err, result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
defer(function nextTick_callback()
|
|
||||||
{
|
|
||||||
callback(err, result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
26
app/node_modules/asynckit/lib/defer.js
generated
vendored
@@ -1,26 +0,0 @@
|
|||||||
module.exports = defer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs provided function on next iteration of the event loop
|
|
||||||
*
|
|
||||||
* @param {function} fn - function to run
|
|
||||||
*/
|
|
||||||
function defer(fn)
|
|
||||||
{
|
|
||||||
var nextTick = typeof setImmediate == 'function'
|
|
||||||
? setImmediate
|
|
||||||
: (
|
|
||||||
typeof process == 'object' && typeof process.nextTick == 'function'
|
|
||||||
? process.nextTick
|
|
||||||
: null
|
|
||||||
);
|
|
||||||
|
|
||||||
if (nextTick)
|
|
||||||
{
|
|
||||||
nextTick(fn);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setTimeout(fn, 0);
|
|
||||||
}
|
|
||||||
}
|
|
75
app/node_modules/asynckit/lib/iterate.js
generated
vendored
@@ -1,75 +0,0 @@
|
|||||||
var async = require('./async.js')
|
|
||||||
, abort = require('./abort.js')
|
|
||||||
;
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports = iterate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterates over each job object
|
|
||||||
*
|
|
||||||
* @param {array|object} list - array or object (named list) to iterate over
|
|
||||||
* @param {function} iterator - iterator to run
|
|
||||||
* @param {object} state - current job status
|
|
||||||
* @param {function} callback - invoked when all elements processed
|
|
||||||
*/
|
|
||||||
function iterate(list, iterator, state, callback)
|
|
||||||
{
|
|
||||||
// store current index
|
|
||||||
var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;
|
|
||||||
|
|
||||||
state.jobs[key] = runJob(iterator, key, list[key], function(error, output)
|
|
||||||
{
|
|
||||||
// don't repeat yourself
|
|
||||||
// skip secondary callbacks
|
|
||||||
if (!(key in state.jobs))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clean up jobs
|
|
||||||
delete state.jobs[key];
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
// don't process rest of the results
|
|
||||||
// stop still active jobs
|
|
||||||
// and reset the list
|
|
||||||
abort(state);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
state.results[key] = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
// return salvaged results
|
|
||||||
callback(error, state.results);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs iterator over provided job element
|
|
||||||
*
|
|
||||||
* @param {function} iterator - iterator to invoke
|
|
||||||
* @param {string|number} key - key/index of the element in the list of jobs
|
|
||||||
* @param {mixed} item - job description
|
|
||||||
* @param {function} callback - invoked after iterator is done with the job
|
|
||||||
* @returns {function|mixed} - job abort function or something else
|
|
||||||
*/
|
|
||||||
function runJob(iterator, key, item, callback)
|
|
||||||
{
|
|
||||||
var aborter;
|
|
||||||
|
|
||||||
// allow shortcut if iterator expects only two arguments
|
|
||||||
if (iterator.length == 2)
|
|
||||||
{
|
|
||||||
aborter = iterator(item, async(callback));
|
|
||||||
}
|
|
||||||
// otherwise go with full three arguments
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aborter = iterator(item, key, async(callback));
|
|
||||||
}
|
|
||||||
|
|
||||||
return aborter;
|
|
||||||
}
|
|
91
app/node_modules/asynckit/lib/readable_asynckit.js
generated
vendored
@@ -1,91 +0,0 @@
|
|||||||
var streamify = require('./streamify.js')
|
|
||||||
, defer = require('./defer.js')
|
|
||||||
;
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports = ReadableAsyncKit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base constructor for all streams
|
|
||||||
* used to hold properties/methods
|
|
||||||
*/
|
|
||||||
function ReadableAsyncKit()
|
|
||||||
{
|
|
||||||
ReadableAsyncKit.super_.apply(this, arguments);
|
|
||||||
|
|
||||||
// list of active jobs
|
|
||||||
this.jobs = {};
|
|
||||||
|
|
||||||
// add stream methods
|
|
||||||
this.destroy = destroy;
|
|
||||||
this._start = _start;
|
|
||||||
this._read = _read;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys readable stream,
|
|
||||||
* by aborting outstanding jobs
|
|
||||||
*
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function destroy()
|
|
||||||
{
|
|
||||||
if (this.destroyed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.destroyed = true;
|
|
||||||
|
|
||||||
if (typeof this.terminator == 'function')
|
|
||||||
{
|
|
||||||
this.terminator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts provided jobs in async manner
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
function _start()
|
|
||||||
{
|
|
||||||
// first argument – runner function
|
|
||||||
var runner = arguments[0]
|
|
||||||
// take away first argument
|
|
||||||
, args = Array.prototype.slice.call(arguments, 1)
|
|
||||||
// second argument - input data
|
|
||||||
, input = args[0]
|
|
||||||
// last argument - result callback
|
|
||||||
, endCb = streamify.callback.call(this, args[args.length - 1])
|
|
||||||
;
|
|
||||||
|
|
||||||
args[args.length - 1] = endCb;
|
|
||||||
// third argument - iterator
|
|
||||||
args[1] = streamify.iterator.call(this, args[1]);
|
|
||||||
|
|
||||||
// allow time for proper setup
|
|
||||||
defer(function()
|
|
||||||
{
|
|
||||||
if (!this.destroyed)
|
|
||||||
{
|
|
||||||
this.terminator = runner.apply(null, args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
endCb(null, Array.isArray(input) ? [] : {});
|
|
||||||
}
|
|
||||||
}.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement _read to comply with Readable streams
|
|
||||||
* Doesn't really make sense for flowing object mode
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
function _read()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
25
app/node_modules/asynckit/lib/readable_parallel.js
generated
vendored
@@ -1,25 +0,0 @@
|
|||||||
var parallel = require('../parallel.js');
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports = ReadableParallel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Streaming wrapper to `asynckit.parallel`
|
|
||||||
*
|
|
||||||
* @param {array|object} list - array or object (named list) to iterate over
|
|
||||||
* @param {function} iterator - iterator to run
|
|
||||||
* @param {function} callback - invoked when all elements processed
|
|
||||||
* @returns {stream.Readable#}
|
|
||||||
*/
|
|
||||||
function ReadableParallel(list, iterator, callback)
|
|
||||||
{
|
|
||||||
if (!(this instanceof ReadableParallel))
|
|
||||||
{
|
|
||||||
return new ReadableParallel(list, iterator, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
// turn on object mode
|
|
||||||
ReadableParallel.super_.call(this, {objectMode: true});
|
|
||||||
|
|
||||||
this._start(parallel, list, iterator, callback);
|
|
||||||
}
|
|
25
app/node_modules/asynckit/lib/readable_serial.js
generated
vendored
@@ -1,25 +0,0 @@
|
|||||||
var serial = require('../serial.js');
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports = ReadableSerial;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Streaming wrapper to `asynckit.serial`
|
|
||||||
*
|
|
||||||
* @param {array|object} list - array or object (named list) to iterate over
|
|
||||||
* @param {function} iterator - iterator to run
|
|
||||||
* @param {function} callback - invoked when all elements processed
|
|
||||||
* @returns {stream.Readable#}
|
|
||||||
*/
|
|
||||||
function ReadableSerial(list, iterator, callback)
|
|
||||||
{
|
|
||||||
if (!(this instanceof ReadableSerial))
|
|
||||||
{
|
|
||||||
return new ReadableSerial(list, iterator, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
// turn on object mode
|
|
||||||
ReadableSerial.super_.call(this, {objectMode: true});
|
|
||||||
|
|
||||||
this._start(serial, list, iterator, callback);
|
|
||||||
}
|
|
29
app/node_modules/asynckit/lib/readable_serial_ordered.js
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
var serialOrdered = require('../serialOrdered.js');
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports = ReadableSerialOrdered;
|
|
||||||
// expose sort helpers
|
|
||||||
module.exports.ascending = serialOrdered.ascending;
|
|
||||||
module.exports.descending = serialOrdered.descending;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Streaming wrapper to `asynckit.serialOrdered`
|
|
||||||
*
|
|
||||||
* @param {array|object} list - array or object (named list) to iterate over
|
|
||||||
* @param {function} iterator - iterator to run
|
|
||||||
* @param {function} sortMethod - custom sort function
|
|
||||||
* @param {function} callback - invoked when all elements processed
|
|
||||||
* @returns {stream.Readable#}
|
|
||||||
*/
|
|
||||||
function ReadableSerialOrdered(list, iterator, sortMethod, callback)
|
|
||||||
{
|
|
||||||
if (!(this instanceof ReadableSerialOrdered))
|
|
||||||
{
|
|
||||||
return new ReadableSerialOrdered(list, iterator, sortMethod, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
// turn on object mode
|
|
||||||
ReadableSerialOrdered.super_.call(this, {objectMode: true});
|
|
||||||
|
|
||||||
this._start(serialOrdered, list, iterator, sortMethod, callback);
|
|
||||||
}
|
|
37
app/node_modules/asynckit/lib/state.js
generated
vendored
@@ -1,37 +0,0 @@
|
|||||||
// API
|
|
||||||
module.exports = state;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates initial state object
|
|
||||||
* for iteration over list
|
|
||||||
*
|
|
||||||
* @param {array|object} list - list to iterate over
|
|
||||||
* @param {function|null} sortMethod - function to use for keys sort,
|
|
||||||
* or `null` to keep them as is
|
|
||||||
* @returns {object} - initial state object
|
|
||||||
*/
|
|
||||||
function state(list, sortMethod)
|
|
||||||
{
|
|
||||||
var isNamedList = !Array.isArray(list)
|
|
||||||
, initState =
|
|
||||||
{
|
|
||||||
index : 0,
|
|
||||||
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
|
||||||
jobs : {},
|
|
||||||
results : isNamedList ? {} : [],
|
|
||||||
size : isNamedList ? Object.keys(list).length : list.length
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
if (sortMethod)
|
|
||||||
{
|
|
||||||
// sort array keys based on it's values
|
|
||||||
// sort object's keys just on own merit
|
|
||||||
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
|
||||||
{
|
|
||||||
return sortMethod(list[a], list[b]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return initState;
|
|
||||||
}
|
|
141
app/node_modules/asynckit/lib/streamify.js
generated
vendored
@@ -1,141 +0,0 @@
|
|||||||
var async = require('./async.js');
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports = {
|
|
||||||
iterator: wrapIterator,
|
|
||||||
callback: wrapCallback
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wraps iterators with long signature
|
|
||||||
*
|
|
||||||
* @this ReadableAsyncKit#
|
|
||||||
* @param {function} iterator - function to wrap
|
|
||||||
* @returns {function} - wrapped function
|
|
||||||
*/
|
|
||||||
function wrapIterator(iterator)
|
|
||||||
{
|
|
||||||
var stream = this;
|
|
||||||
|
|
||||||
return function(item, key, cb)
|
|
||||||
{
|
|
||||||
var aborter
|
|
||||||
, wrappedCb = async(wrapIteratorCallback.call(stream, cb, key))
|
|
||||||
;
|
|
||||||
|
|
||||||
stream.jobs[key] = wrappedCb;
|
|
||||||
|
|
||||||
// it's either shortcut (item, cb)
|
|
||||||
if (iterator.length == 2)
|
|
||||||
{
|
|
||||||
aborter = iterator(item, wrappedCb);
|
|
||||||
}
|
|
||||||
// or long format (item, key, cb)
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aborter = iterator(item, key, wrappedCb);
|
|
||||||
}
|
|
||||||
|
|
||||||
return aborter;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wraps provided callback function
|
|
||||||
* allowing to execute snitch function before
|
|
||||||
* real callback
|
|
||||||
*
|
|
||||||
* @this ReadableAsyncKit#
|
|
||||||
* @param {function} callback - function to wrap
|
|
||||||
* @returns {function} - wrapped function
|
|
||||||
*/
|
|
||||||
function wrapCallback(callback)
|
|
||||||
{
|
|
||||||
var stream = this;
|
|
||||||
|
|
||||||
var wrapped = function(error, result)
|
|
||||||
{
|
|
||||||
return finisher.call(stream, error, result, callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
return wrapped;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wraps provided iterator callback function
|
|
||||||
* makes sure snitch only called once,
|
|
||||||
* but passes secondary calls to the original callback
|
|
||||||
*
|
|
||||||
* @this ReadableAsyncKit#
|
|
||||||
* @param {function} callback - callback to wrap
|
|
||||||
* @param {number|string} key - iteration key
|
|
||||||
* @returns {function} wrapped callback
|
|
||||||
*/
|
|
||||||
function wrapIteratorCallback(callback, key)
|
|
||||||
{
|
|
||||||
var stream = this;
|
|
||||||
|
|
||||||
return function(error, output)
|
|
||||||
{
|
|
||||||
// don't repeat yourself
|
|
||||||
if (!(key in stream.jobs))
|
|
||||||
{
|
|
||||||
callback(error, output);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clean up jobs
|
|
||||||
delete stream.jobs[key];
|
|
||||||
|
|
||||||
return streamer.call(stream, error, {key: key, value: output}, callback);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stream wrapper for iterator callback
|
|
||||||
*
|
|
||||||
* @this ReadableAsyncKit#
|
|
||||||
* @param {mixed} error - error response
|
|
||||||
* @param {mixed} output - iterator output
|
|
||||||
* @param {function} callback - callback that expects iterator results
|
|
||||||
*/
|
|
||||||
function streamer(error, output, callback)
|
|
||||||
{
|
|
||||||
if (error && !this.error)
|
|
||||||
{
|
|
||||||
this.error = error;
|
|
||||||
this.pause();
|
|
||||||
this.emit('error', error);
|
|
||||||
// send back value only, as expected
|
|
||||||
callback(error, output && output.value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// stream stuff
|
|
||||||
this.push(output);
|
|
||||||
|
|
||||||
// back to original track
|
|
||||||
// send back value only, as expected
|
|
||||||
callback(error, output && output.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stream wrapper for finishing callback
|
|
||||||
*
|
|
||||||
* @this ReadableAsyncKit#
|
|
||||||
* @param {mixed} error - error response
|
|
||||||
* @param {mixed} output - iterator output
|
|
||||||
* @param {function} callback - callback that expects final results
|
|
||||||
*/
|
|
||||||
function finisher(error, output, callback)
|
|
||||||
{
|
|
||||||
// signal end of the stream
|
|
||||||
// only for successfully finished streams
|
|
||||||
if (!error)
|
|
||||||
{
|
|
||||||
this.push(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// back to original track
|
|
||||||
callback(error, output);
|
|
||||||
}
|
|
29
app/node_modules/asynckit/lib/terminator.js
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
var abort = require('./abort.js')
|
|
||||||
, async = require('./async.js')
|
|
||||||
;
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports = terminator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Terminates jobs in the attached state context
|
|
||||||
*
|
|
||||||
* @this AsyncKitState#
|
|
||||||
* @param {function} callback - final callback to invoke after termination
|
|
||||||
*/
|
|
||||||
function terminator(callback)
|
|
||||||
{
|
|
||||||
if (!Object.keys(this.jobs).length)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// fast forward iteration index
|
|
||||||
this.index = this.size;
|
|
||||||
|
|
||||||
// abort jobs
|
|
||||||
abort(this);
|
|
||||||
|
|
||||||
// send back results we have so far
|
|
||||||
async(callback)(null, this.results);
|
|
||||||
}
|
|
91
app/node_modules/asynckit/package.json
generated
vendored
@@ -1,91 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "asynckit@^0.4.0",
|
|
||||||
"_id": "asynckit@0.4.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
|
||||||
"_location": "/asynckit",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "range",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "asynckit@^0.4.0",
|
|
||||||
"name": "asynckit",
|
|
||||||
"escapedName": "asynckit",
|
|
||||||
"rawSpec": "^0.4.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "^0.4.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/form-data"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
|
||||||
"_shasum": "c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79",
|
|
||||||
"_spec": "asynckit@^0.4.0",
|
|
||||||
"_where": "/mnt/c/Users/docto/Downloads/Rappaurio/node_modules/form-data",
|
|
||||||
"author": {
|
|
||||||
"name": "Alex Indigo",
|
|
||||||
"email": "iam@alexindigo.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/alexindigo/asynckit/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"dependencies": {},
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Minimal async jobs utility library, with streams support",
|
|
||||||
"devDependencies": {
|
|
||||||
"browserify": "^13.0.0",
|
|
||||||
"browserify-istanbul": "^2.0.0",
|
|
||||||
"coveralls": "^2.11.9",
|
|
||||||
"eslint": "^2.9.0",
|
|
||||||
"istanbul": "^0.4.3",
|
|
||||||
"obake": "^0.1.2",
|
|
||||||
"phantomjs-prebuilt": "^2.1.7",
|
|
||||||
"pre-commit": "^1.1.3",
|
|
||||||
"reamde": "^1.1.0",
|
|
||||||
"rimraf": "^2.5.2",
|
|
||||||
"size-table": "^0.2.0",
|
|
||||||
"tap-spec": "^4.1.1",
|
|
||||||
"tape": "^4.5.1"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/alexindigo/asynckit#readme",
|
|
||||||
"keywords": [
|
|
||||||
"async",
|
|
||||||
"jobs",
|
|
||||||
"parallel",
|
|
||||||
"serial",
|
|
||||||
"iterator",
|
|
||||||
"array",
|
|
||||||
"object",
|
|
||||||
"stream",
|
|
||||||
"destroy",
|
|
||||||
"terminate",
|
|
||||||
"abort"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "index.js",
|
|
||||||
"name": "asynckit",
|
|
||||||
"pre-commit": [
|
|
||||||
"clean",
|
|
||||||
"lint",
|
|
||||||
"test",
|
|
||||||
"browser",
|
|
||||||
"report",
|
|
||||||
"size"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/alexindigo/asynckit.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec",
|
|
||||||
"clean": "rimraf coverage",
|
|
||||||
"debug": "tape test/test-*.js",
|
|
||||||
"lint": "eslint *.js lib/*.js test/*.js",
|
|
||||||
"report": "istanbul report",
|
|
||||||
"size": "browserify index.js | size-table asynckit",
|
|
||||||
"test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec",
|
|
||||||
"win-test": "tape test/test-*.js"
|
|
||||||
},
|
|
||||||
"version": "0.4.0"
|
|
||||||
}
|
|
43
app/node_modules/asynckit/parallel.js
generated
vendored
@@ -1,43 +0,0 @@
|
|||||||
var iterate = require('./lib/iterate.js')
|
|
||||||
, initState = require('./lib/state.js')
|
|
||||||
, terminator = require('./lib/terminator.js')
|
|
||||||
;
|
|
||||||
|
|
||||||
// Public API
|
|
||||||
module.exports = parallel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs iterator over provided array elements in parallel
|
|
||||||
*
|
|
||||||
* @param {array|object} list - array or object (named list) to iterate over
|
|
||||||
* @param {function} iterator - iterator to run
|
|
||||||
* @param {function} callback - invoked when all elements processed
|
|
||||||
* @returns {function} - jobs terminator
|
|
||||||
*/
|
|
||||||
function parallel(list, iterator, callback)
|
|
||||||
{
|
|
||||||
var state = initState(list);
|
|
||||||
|
|
||||||
while (state.index < (state['keyedList'] || list).length)
|
|
||||||
{
|
|
||||||
iterate(list, iterator, state, function(error, result)
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
callback(error, result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// looks like it's the last one
|
|
||||||
if (Object.keys(state.jobs).length === 0)
|
|
||||||
{
|
|
||||||
callback(null, state.results);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
state.index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return terminator.bind(state, callback);
|
|
||||||
}
|
|
17
app/node_modules/asynckit/serial.js
generated
vendored
@@ -1,17 +0,0 @@
|
|||||||
var serialOrdered = require('./serialOrdered.js');
|
|
||||||
|
|
||||||
// Public API
|
|
||||||
module.exports = serial;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs iterator over provided array elements in series
|
|
||||||
*
|
|
||||||
* @param {array|object} list - array or object (named list) to iterate over
|
|
||||||
* @param {function} iterator - iterator to run
|
|
||||||
* @param {function} callback - invoked when all elements processed
|
|
||||||
* @returns {function} - jobs terminator
|
|
||||||
*/
|
|
||||||
function serial(list, iterator, callback)
|
|
||||||
{
|
|
||||||
return serialOrdered(list, iterator, null, callback);
|
|
||||||
}
|
|
75
app/node_modules/asynckit/serialOrdered.js
generated
vendored
@@ -1,75 +0,0 @@
|
|||||||
var iterate = require('./lib/iterate.js')
|
|
||||||
, initState = require('./lib/state.js')
|
|
||||||
, terminator = require('./lib/terminator.js')
|
|
||||||
;
|
|
||||||
|
|
||||||
// Public API
|
|
||||||
module.exports = serialOrdered;
|
|
||||||
// sorting helpers
|
|
||||||
module.exports.ascending = ascending;
|
|
||||||
module.exports.descending = descending;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs iterator over provided sorted array elements in series
|
|
||||||
*
|
|
||||||
* @param {array|object} list - array or object (named list) to iterate over
|
|
||||||
* @param {function} iterator - iterator to run
|
|
||||||
* @param {function} sortMethod - custom sort function
|
|
||||||
* @param {function} callback - invoked when all elements processed
|
|
||||||
* @returns {function} - jobs terminator
|
|
||||||
*/
|
|
||||||
function serialOrdered(list, iterator, sortMethod, callback)
|
|
||||||
{
|
|
||||||
var state = initState(list, sortMethod);
|
|
||||||
|
|
||||||
iterate(list, iterator, state, function iteratorHandler(error, result)
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
callback(error, result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
state.index++;
|
|
||||||
|
|
||||||
// are we there yet?
|
|
||||||
if (state.index < (state['keyedList'] || list).length)
|
|
||||||
{
|
|
||||||
iterate(list, iterator, state, iteratorHandler);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// done here
|
|
||||||
callback(null, state.results);
|
|
||||||
});
|
|
||||||
|
|
||||||
return terminator.bind(state, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* -- Sort methods
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* sort helper to sort array elements in ascending order
|
|
||||||
*
|
|
||||||
* @param {mixed} a - an item to compare
|
|
||||||
* @param {mixed} b - an item to compare
|
|
||||||
* @returns {number} - comparison result
|
|
||||||
*/
|
|
||||||
function ascending(a, b)
|
|
||||||
{
|
|
||||||
return a < b ? -1 : a > b ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* sort helper to sort array elements in descending order
|
|
||||||
*
|
|
||||||
* @param {mixed} a - an item to compare
|
|
||||||
* @param {mixed} b - an item to compare
|
|
||||||
* @returns {number} - comparison result
|
|
||||||
*/
|
|
||||||
function descending(a, b)
|
|
||||||
{
|
|
||||||
return -1 * ascending(a, b);
|
|
||||||
}
|
|
21
app/node_modules/asynckit/stream.js
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
var inherits = require('util').inherits
|
|
||||||
, Readable = require('stream').Readable
|
|
||||||
, ReadableAsyncKit = require('./lib/readable_asynckit.js')
|
|
||||||
, ReadableParallel = require('./lib/readable_parallel.js')
|
|
||||||
, ReadableSerial = require('./lib/readable_serial.js')
|
|
||||||
, ReadableSerialOrdered = require('./lib/readable_serial_ordered.js')
|
|
||||||
;
|
|
||||||
|
|
||||||
// API
|
|
||||||
module.exports =
|
|
||||||
{
|
|
||||||
parallel : ReadableParallel,
|
|
||||||
serial : ReadableSerial,
|
|
||||||
serialOrdered : ReadableSerialOrdered,
|
|
||||||
};
|
|
||||||
|
|
||||||
inherits(ReadableAsyncKit, Readable);
|
|
||||||
|
|
||||||
inherits(ReadableParallel, ReadableAsyncKit);
|
|
||||||
inherits(ReadableSerial, ReadableAsyncKit);
|
|
||||||
inherits(ReadableSerialOrdered, ReadableAsyncKit);
|
|
565
app/node_modules/axios/CHANGELOG.md
generated
vendored
@@ -1,565 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **adapter:** make adapter loading error more clear by using platform-specific adapters explicitly ([#5837](https://github.com/axios/axios/issues/5837)) ([9a414bb](https://github.com/axios/axios/commit/9a414bb6c81796a95c6c7fe668637825458e8b6d))
|
|
||||||
* **dns:** fixed `cacheable-lookup` integration; ([#5836](https://github.com/axios/axios/issues/5836)) ([b3e327d](https://github.com/axios/axios/commit/b3e327dcc9277bdce34c7ef57beedf644b00d628))
|
|
||||||
* **headers:** added support for setting header names that overlap with class methods; ([#5831](https://github.com/axios/axios/issues/5831)) ([d8b4ca0](https://github.com/axios/axios/commit/d8b4ca0ea5f2f05efa4edfe1e7684593f9f68273))
|
|
||||||
* **headers:** fixed common Content-Type header merging; ([#5832](https://github.com/axios/axios/issues/5832)) ([8fda276](https://github.com/axios/axios/commit/8fda2766b1e6bcb72c3fabc146223083ef13ce17))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* export getAdapter function ([#5324](https://github.com/axios/axios/issues/5324)) ([ca73eb8](https://github.com/axios/axios/commit/ca73eb878df0ae2dace81fe3a7f1fb5986231bf1))
|
|
||||||
* **export:** export adapters without `unsafe` prefix ([#5839](https://github.com/axios/axios/issues/5839)) ([1601f4a](https://github.com/axios/axios/commit/1601f4a27a81ab47fea228f1e244b2c4e3ce28bf))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+66/-29 (#5839 #5837 #5836 #5832 #5831 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/102841186?v=4&s=18" alt="avatar" width="18"/> [夜葬](https://github.com/geekact "+42/-0 (#5324 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/65978976?v=4&s=18" alt="avatar" width="18"/> [Jonathan Budiman](https://github.com/JBudiman00 "+30/-0 (#5788 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+3/-5 (#5791 )")
|
|
||||||
|
|
||||||
# [1.4.0](https://github.com/axios/axios/compare/v1.3.6...v1.4.0) (2023-04-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **formdata:** add `multipart/form-data` content type for FormData payload on custom client environments; ([#5678](https://github.com/axios/axios/issues/5678)) ([bbb61e7](https://github.com/axios/axios/commit/bbb61e70cb1185adfb1cbbb86eaf6652c48d89d1))
|
|
||||||
* **package:** export package internals with unsafe path prefix; ([#5677](https://github.com/axios/axios/issues/5677)) ([df38c94](https://github.com/axios/axios/commit/df38c949f26414d88ba29ec1e353c4d4f97eaf09))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **dns:** added support for a custom lookup function; ([#5339](https://github.com/axios/axios/issues/5339)) ([2701911](https://github.com/axios/axios/commit/2701911260a1faa5cc5e1afe437121b330a3b7bb))
|
|
||||||
* **types:** export `AxiosHeaderValue` type. ([#5525](https://github.com/axios/axios/issues/5525)) ([726f1c8](https://github.com/axios/axios/commit/726f1c8e00cffa0461a8813a9bdcb8f8b9d762cf))
|
|
||||||
|
|
||||||
|
|
||||||
### Performance Improvements
|
|
||||||
|
|
||||||
* **merge-config:** optimize mergeConfig performance by avoiding duplicate key visits; ([#5679](https://github.com/axios/axios/issues/5679)) ([e6f7053](https://github.com/axios/axios/commit/e6f7053bf1a3e87cf1f9da8677e12e3fe829d68e))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+151/-16 (#5684 #5339 #5679 #5678 #5677 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/47537704?v=4&s=18" alt="avatar" width="18"/> [Arthur Fiorette](https://github.com/arthurfiorette "+19/-19 (#5525 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/43876655?v=4&s=18" alt="avatar" width="18"/> [PIYUSH NEGI](https://github.com/npiyush97 "+2/-18 (#5670 )")
|
|
||||||
|
|
||||||
## [1.3.6](https://github.com/axios/axios/compare/v1.3.5...v1.3.6) (2023-04-19)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **types:** added transport to RawAxiosRequestConfig ([#5445](https://github.com/axios/axios/issues/5445)) ([6f360a2](https://github.com/axios/axios/commit/6f360a2531d8d70363fd9becef6a45a323f170e2))
|
|
||||||
* **utils:** make isFormData detection logic stricter to avoid unnecessary calling of the `toString` method on the target; ([#5661](https://github.com/axios/axios/issues/5661)) ([aa372f7](https://github.com/axios/axios/commit/aa372f7306295dfd1100c1c2c77ce95c95808e76))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+48/-10 (#5665 #5661 #5663 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+2/-0 (#5445 )")
|
|
||||||
|
|
||||||
## [1.3.5](https://github.com/axios/axios/compare/v1.3.4...v1.3.5) (2023-04-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **headers:** fixed isValidHeaderName to support full list of allowed characters; ([#5584](https://github.com/axios/axios/issues/5584)) ([e7decef](https://github.com/axios/axios/commit/e7decef6a99f4627e27ed9ea5b00ce8e201c3841))
|
|
||||||
* **params:** re-added the ability to set the function as `paramsSerializer` config; ([#5633](https://github.com/axios/axios/issues/5633)) ([a56c866](https://github.com/axios/axios/commit/a56c8661209d5ce5a645a05f294a0e08a6c1f6b3))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+28/-10 (#5633 #5584 )")
|
|
||||||
|
|
||||||
## [1.3.4](https://github.com/axios/axios/compare/v1.3.3...v1.3.4) (2023-02-22)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **blob:** added a check to make sure the Blob class is available in the browser's global scope; ([#5548](https://github.com/axios/axios/issues/5548)) ([3772c8f](https://github.com/axios/axios/commit/3772c8fe74112a56e3e9551f894d899bc3a9443a))
|
|
||||||
* **http:** fixed regression bug when handling synchronous errors inside the adapter; ([#5564](https://github.com/axios/axios/issues/5564)) ([a3b246c](https://github.com/axios/axios/commit/a3b246c9de5c3bc4b5a742e15add55b375479451))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+38/-26 (#5564 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/19550000?v=4&s=18" alt="avatar" width="18"/> [lcysgsg](https://github.com/lcysgsg "+4/-0 (#5548 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+3/-0 (#5444 )")
|
|
||||||
|
|
||||||
## [1.3.3](https://github.com/axios/axios/compare/v1.3.2...v1.3.3) (2023-02-13)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **formdata:** added a check to make sure the FormData class is available in the browser's global scope; ([#5545](https://github.com/axios/axios/issues/5545)) ([a6dfa72](https://github.com/axios/axios/commit/a6dfa72010db5ad52db8bd13c0f98e537e8fd05d))
|
|
||||||
* **formdata:** fixed setting NaN as Content-Length for form payload in some cases; ([#5535](https://github.com/axios/axios/issues/5535)) ([c19f7bf](https://github.com/axios/axios/commit/c19f7bf770f90ae8307f4ea3104f227056912da1))
|
|
||||||
* **headers:** fixed the filtering logic of the clear method; ([#5542](https://github.com/axios/axios/issues/5542)) ([ea87ebf](https://github.com/axios/axios/commit/ea87ebfe6d1699af072b9e7cd40faf8f14b0ab93))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+11/-7 (#5545 #5535 #5542 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/19842213?v=4&s=18" alt="avatar" width="18"/> [陈若枫](https://github.com/ruofee "+2/-2 (#5467 )")
|
|
||||||
|
|
||||||
## [1.3.2](https://github.com/axios/axios/compare/v1.3.1...v1.3.2) (2023-02-03)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **http:** treat http://localhost as base URL for relative paths to avoid `ERR_INVALID_URL` error; ([#5528](https://github.com/axios/axios/issues/5528)) ([128d56f](https://github.com/axios/axios/commit/128d56f4a0fb8f5f2ed6e0dd80bc9225fee9538c))
|
|
||||||
* **http:** use explicit import instead of TextEncoder global; ([#5530](https://github.com/axios/axios/issues/5530)) ([6b3c305](https://github.com/axios/axios/commit/6b3c305fc40c56428e0afabedc6f4d29c2830f6f))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+2/-1 (#5530 #5528 )")
|
|
||||||
|
|
||||||
## [1.3.1](https://github.com/axios/axios/compare/v1.3.0...v1.3.1) (2023-02-01)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **formdata:** add hotfix to use the asynchronous API to compute the content-length header value; ([#5521](https://github.com/axios/axios/issues/5521)) ([96d336f](https://github.com/axios/axios/commit/96d336f527619f21da012fe1f117eeb53e5a2120))
|
|
||||||
* **serializer:** fixed serialization of array-like objects; ([#5518](https://github.com/axios/axios/issues/5518)) ([08104c0](https://github.com/axios/axios/commit/08104c028c0f9353897b1b6691d74c440fd0c32d))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+27/-8 (#5521 #5518 )")
|
|
||||||
|
|
||||||
# [1.3.0](https://github.com/axios/axios/compare/v1.2.6...v1.3.0) (2023-01-31)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **headers:** fixed & optimized clear method; ([#5507](https://github.com/axios/axios/issues/5507)) ([9915635](https://github.com/axios/axios/commit/9915635c69d0ab70daca5738488421f67ca60959))
|
|
||||||
* **http:** add zlib headers if missing ([#5497](https://github.com/axios/axios/issues/5497)) ([65e8d1e](https://github.com/axios/axios/commit/65e8d1e28ce829f47a837e45129730e541950d3c))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **fomdata:** added support for spec-compliant FormData & Blob types; ([#5316](https://github.com/axios/axios/issues/5316)) ([6ac574e](https://github.com/axios/axios/commit/6ac574e00a06731288347acea1e8246091196953))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+352/-67 (#5514 #5512 #5510 #5509 #5508 #5316 #5507 )")
|
|
||||||
- <img src="https://avatars.githubusercontent.com/u/35015993?v=4&s=18" alt="avatar" width="18"/> [ItsNotGoodName](https://github.com/ItsNotGoodName "+43/-2 (#5497 )")
|
|
||||||
|
|
||||||
## [1.2.6](https://github.com/axios/axios/compare/v1.2.5...v1.2.6) (2023-01-28)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **headers:** added missed Authorization accessor; ([#5502](https://github.com/axios/axios/issues/5502)) ([342c0ba](https://github.com/axios/axios/commit/342c0ba9a16ea50f5ed7d2366c5c1a2c877e3f26))
|
|
||||||
* **types:** fixed `CommonRequestHeadersList` & `CommonResponseHeadersList` types to be private in commonJS; ([#5503](https://github.com/axios/axios/issues/5503)) ([5a3d0a3](https://github.com/axios/axios/commit/5a3d0a3234d77361a1bc7cedee2da1e11df08e2c))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+24/-9 (#5503 #5502 )")
|
|
||||||
|
|
||||||
## [1.2.5](https://github.com/axios/axios/compare/v1.2.4...v1.2.5) (2023-01-26)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **types:** fixed AxiosHeaders to handle spread syntax by making all methods non-enumerable; ([#5499](https://github.com/axios/axios/issues/5499)) ([580f1e8](https://github.com/axios/axios/commit/580f1e8033a61baa38149d59fd16019de3932c22))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+82/-54 (#5499 )")
|
|
||||||
-  [Elliot Ford](https://github.com/EFord36 "+1/-1 (#5462 )")
|
|
||||||
|
|
||||||
## [1.2.4](https://github.com/axios/axios/compare/v1.2.3...v1.2.4) (2023-01-22)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **types:** renamed `RawAxiosRequestConfig` back to `AxiosRequestConfig`; ([#5486](https://github.com/axios/axios/issues/5486)) ([2a71f49](https://github.com/axios/axios/commit/2a71f49bc6c68495fa419003a3107ed8bd703ad0))
|
|
||||||
* **types:** fix `AxiosRequestConfig` generic; ([#5478](https://github.com/axios/axios/issues/5478)) ([9bce81b](https://github.com/axios/axios/commit/186ea062da8b7d578ae78b1a5c220986b9bce81b))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+242/-108 (#5486 #5482 )")
|
|
||||||
-  [Daniel Hillmann](https://github.com/hilleer "+1/-1 (#5478 )")
|
|
||||||
|
|
||||||
## [1.2.3](https://github.com/axios/axios/compare/1.2.2...1.2.3) (2023-01-10)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **types:** fixed AxiosRequestConfig header interface by refactoring it to RawAxiosRequestConfig; ([#5420](https://github.com/axios/axios/issues/5420)) ([0811963](https://github.com/axios/axios/commit/08119634a22f1d5b19f5c9ea0adccb6d3eebc3bc))
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+938/-442 (#5456 #5455 #5453 #5451 #5449 #5447 #5446 #5443 #5442 #5439 #5420 )")
|
|
||||||
|
|
||||||
## [1.2.2] - 2022-12-29
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- fix(ci): fix release script inputs [#5392](https://github.com/axios/axios/pull/5392)
|
|
||||||
- fix(ci): prerelease scipts [#5377](https://github.com/axios/axios/pull/5377)
|
|
||||||
- fix(ci): release scripts [#5376](https://github.com/axios/axios/pull/5376)
|
|
||||||
- fix(ci): typescript tests [#5375](https://github.com/axios/axios/pull/5375)
|
|
||||||
- fix: Brotli decompression [#5353](https://github.com/axios/axios/pull/5353)
|
|
||||||
- fix: add missing HttpStatusCode [#5345](https://github.com/axios/axios/pull/5345)
|
|
||||||
|
|
||||||
### Chores
|
|
||||||
- chore(ci): set conventional-changelog header config [#5406](https://github.com/axios/axios/pull/5406)
|
|
||||||
- chore(ci): fix automatic contributors resolving [#5403](https://github.com/axios/axios/pull/5403)
|
|
||||||
- chore(ci): improved logging for the contributors list generator [#5398](https://github.com/axios/axios/pull/5398)
|
|
||||||
- chore(ci): fix release action [#5397](https://github.com/axios/axios/pull/5397)
|
|
||||||
- chore(ci): fix version bump script by adding bump argument for target version [#5393](https://github.com/axios/axios/pull/5393)
|
|
||||||
- chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 [#5342](https://github.com/axios/axios/pull/5342)
|
|
||||||
- chore(ci): GitHub Actions Release script [#5384](https://github.com/axios/axios/pull/5384)
|
|
||||||
- chore(ci): release scripts [#5364](https://github.com/axios/axios/pull/5364)
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
-  [Winnie](https://github.com/winniehell)
|
|
||||||
|
|
||||||
## [1.2.1] - 2022-12-05
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- feat(exports): export mergeConfig [#5151](https://github.com/axios/axios/pull/5151)
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- fix(CancelledError): include config [#4922](https://github.com/axios/axios/pull/4922)
|
|
||||||
- fix(general): removing multiple/trailing/leading whitespace [#5022](https://github.com/axios/axios/pull/5022)
|
|
||||||
- fix(headers): decompression for responses without Content-Length header [#5306](https://github.com/axios/axios/pull/5306)
|
|
||||||
- fix(webWorker): exception to sending form data in web worker [#5139](https://github.com/axios/axios/pull/5139)
|
|
||||||
|
|
||||||
### Refactors
|
|
||||||
- refactor(types): AxiosProgressEvent.event type to any [#5308](https://github.com/axios/axios/pull/5308)
|
|
||||||
- refactor(types): add missing types for static AxiosError.from method [#4956](https://github.com/axios/axios/pull/4956)
|
|
||||||
|
|
||||||
### Chores
|
|
||||||
- chore(docs): remove README link to non-existent upgrade guide [#5307](https://github.com/axios/axios/pull/5307)
|
|
||||||
- chore(docs): typo in issue template name [#5159](https://github.com/axios/axios/pull/5159)
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
- [Zachary Lysobey](https://github.com/zachlysobey)
|
|
||||||
- [Kevin Ennis](https://github.com/kevincennis)
|
|
||||||
- [Philipp Loose](https://github.com/phloose)
|
|
||||||
- [secondl1ght](https://github.com/secondl1ght)
|
|
||||||
- [wenzheng](https://github.com/0x30)
|
|
||||||
- [Ivan Barsukov](https://github.com/ovarn)
|
|
||||||
- [Arthur Fiorette](https://github.com/arthurfiorette)
|
|
||||||
|
|
||||||
## [1.2.0] - 2022-11-10
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- changed: refactored module exports [#5162](https://github.com/axios/axios/pull/5162)
|
|
||||||
- change: re-added support for loading Axios with require('axios').default [#5225](https://github.com/axios/axios/pull/5225)
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- fix: improve AxiosHeaders class [#5224](https://github.com/axios/axios/pull/5224)
|
|
||||||
- fix: TypeScript type definitions for commonjs [#5196](https://github.com/axios/axios/pull/5196)
|
|
||||||
- fix: type definition of use method on AxiosInterceptorManager to match the the README [#5071](https://github.com/axios/axios/pull/5071)
|
|
||||||
- fix: __dirname is not defined in the sandbox [#5269](https://github.com/axios/axios/pull/5269)
|
|
||||||
- fix: AxiosError.toJSON method to avoid circular references [#5247](https://github.com/axios/axios/pull/5247)
|
|
||||||
- fix: Z_BUF_ERROR when content-encoding is set but the response body is empty [#5250](https://github.com/axios/axios/pull/5250)
|
|
||||||
|
|
||||||
### Refactors
|
|
||||||
- refactor: allowing adapters to be loaded by name [#5277](https://github.com/axios/axios/pull/5277)
|
|
||||||
|
|
||||||
### Chores
|
|
||||||
|
|
||||||
- chore: force CI restart [#5243](https://github.com/axios/axios/pull/5243)
|
|
||||||
- chore: update ECOSYSTEM.md [#5077](https://github.com/axios/axios/pull/5077)
|
|
||||||
- chore: update get/index.html [#5116](https://github.com/axios/axios/pull/5116)
|
|
||||||
- chore: update Sandbox UI/UX [#5205](https://github.com/axios/axios/pull/5205)
|
|
||||||
- chore:(actions): remove git credentials after checkout [#5235](https://github.com/axios/axios/pull/5235)
|
|
||||||
- chore(actions): bump actions/dependency-review-action from 2 to 3 [#5266](https://github.com/axios/axios/pull/5266)
|
|
||||||
- chore(packages): bump loader-utils from 1.4.1 to 1.4.2 [#5295](https://github.com/axios/axios/pull/5295)
|
|
||||||
- chore(packages): bump engine.io from 6.2.0 to 6.2.1 [#5294](https://github.com/axios/axios/pull/5294)
|
|
||||||
- chore(packages): bump socket.io-parser from 4.0.4 to 4.0.5 [#5241](https://github.com/axios/axios/pull/5241)
|
|
||||||
- chore(packages): bump loader-utils from 1.4.0 to 1.4.1 [#5245](https://github.com/axios/axios/pull/5245)
|
|
||||||
- chore(docs): update Resources links in README [#5119](https://github.com/axios/axios/pull/5119)
|
|
||||||
- chore(docs): update the link for JSON url [#5265](https://github.com/axios/axios/pull/5265)
|
|
||||||
- chore(docs): fix broken links [#5218](https://github.com/axios/axios/pull/5218)
|
|
||||||
- chore(docs): update and rename UPGRADE_GUIDE.md to MIGRATION_GUIDE.md [#5170](https://github.com/axios/axios/pull/5170)
|
|
||||||
- chore(docs): typo fix line #856 and #920 [#5194](https://github.com/axios/axios/pull/5194)
|
|
||||||
- chore(docs): typo fix #800 [#5193](https://github.com/axios/axios/pull/5193)
|
|
||||||
- chore(docs): fix typos [#5184](https://github.com/axios/axios/pull/5184)
|
|
||||||
- chore(docs): fix punctuation in README.md [#5197](https://github.com/axios/axios/pull/5197)
|
|
||||||
- chore(docs): update readme in the Handling Errors section - issue reference #5260 [#5261](https://github.com/axios/axios/pull/5261)
|
|
||||||
- chore: remove \b from filename [#5207](https://github.com/axios/axios/pull/5207)
|
|
||||||
- chore(docs): update CHANGELOG.md [#5137](https://github.com/axios/axios/pull/5137)
|
|
||||||
- chore: add sideEffects false to package.json [#5025](https://github.com/axios/axios/pull/5025)
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- [Maddy Miller](https://github.com/me4502)
|
|
||||||
- [Amit Saini](https://github.com/amitsainii)
|
|
||||||
- [ecyrbe](https://github.com/ecyrbe)
|
|
||||||
- [Ikko Ashimine](https://github.com/eltociear)
|
|
||||||
- [Geeth Gunnampalli](https://github.com/thetechie7)
|
|
||||||
- [Shreem Asati](https://github.com/shreem-123)
|
|
||||||
- [Frieder Bluemle](https://github.com/friederbluemle)
|
|
||||||
- [윤세영](https://github.com/yunseyeong)
|
|
||||||
- [Claudio Busatto](https://github.com/cjcbusatto)
|
|
||||||
- [Remco Haszing](https://github.com/remcohaszing)
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
- [Csaba Maulis](https://github.com/om4csaba)
|
|
||||||
- [MoPaMo](https://github.com/MoPaMo)
|
|
||||||
- [Daniel Fjeldstad](https://github.com/w3bdesign)
|
|
||||||
- [Adrien Brunet](https://github.com/adrien-may)
|
|
||||||
- [Frazer Smith](https://github.com/Fdawgs)
|
|
||||||
- [HaiTao](https://github.com/836334258)
|
|
||||||
- [AZM](https://github.com/aziyatali)
|
|
||||||
- [relbns](https://github.com/relbns)
|
|
||||||
|
|
||||||
## [1.1.3] - 2022-10-15
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- Added custom params serializer support [#5113](https://github.com/axios/axios/pull/5113)
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Fixed top-level export to keep them in-line with static properties [#5109](https://github.com/axios/axios/pull/5109)
|
|
||||||
- Stopped including null values to query string. [#5108](https://github.com/axios/axios/pull/5108)
|
|
||||||
- Restored proxy config backwards compatibility with 0.x [#5097](https://github.com/axios/axios/pull/5097)
|
|
||||||
- Added back AxiosHeaders in AxiosHeaderValue [#5103](https://github.com/axios/axios/pull/5103)
|
|
||||||
- Pin CDN install instructions to a specific version [#5060](https://github.com/axios/axios/pull/5060)
|
|
||||||
- Handling of array values fixed for AxiosHeaders [#5085](https://github.com/axios/axios/pull/5085)
|
|
||||||
|
|
||||||
### Chores
|
|
||||||
|
|
||||||
- docs: match badge style, add link to them [#5046](https://github.com/axios/axios/pull/5046)
|
|
||||||
- chore: fixing comments typo [#5054](https://github.com/axios/axios/pull/5054)
|
|
||||||
- chore: update issue template [#5061](https://github.com/axios/axios/pull/5061)
|
|
||||||
- chore: added progress capturing section to the docs; [#5084](https://github.com/axios/axios/pull/5084)
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- [Jason Saayman](https://github.com/jasonsaayman)
|
|
||||||
- [scarf](https://github.com/scarf005)
|
|
||||||
- [Lenz Weber-Tronic](https://github.com/phryneas)
|
|
||||||
- [Arvindh](https://github.com/itsarvindh)
|
|
||||||
- [Félix Legrelle](https://github.com/FelixLgr)
|
|
||||||
- [Patrick Petrovic](https://github.com/ppati000)
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
- [littledian](https://github.com/littledian)
|
|
||||||
- [ChronosMasterOfAllTime](https://github.com/ChronosMasterOfAllTime)
|
|
||||||
|
|
||||||
## [1.1.2] - 2022-10-07
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Fixed broken exports for UMD builds.
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- [Jason Saayman](https://github.com/jasonsaayman)
|
|
||||||
|
|
||||||
## [1.1.1] - 2022-10-07
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Fixed broken exports for common js. This fix breaks a prior fix, I will fix both issues ASAP but the commonJS use is more impactful.
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- [Jason Saayman](https://github.com/jasonsaayman)
|
|
||||||
|
|
||||||
## [1.1.0] - 2022-10-06
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Fixed missing exports in type definition index.d.ts [#5003](https://github.com/axios/axios/pull/5003)
|
|
||||||
- Fixed query params composing [#5018](https://github.com/axios/axios/pull/5018)
|
|
||||||
- Fixed GenericAbortSignal interface by making it more generic [#5021](https://github.com/axios/axios/pull/5021)
|
|
||||||
- Fixed adding "clear" to AxiosInterceptorManager [#5010](https://github.com/axios/axios/pull/5010)
|
|
||||||
- Fixed commonjs & umd exports [#5030](https://github.com/axios/axios/pull/5030)
|
|
||||||
- Fixed inability to access response headers when using axios 1.x with Jest [#5036](https://github.com/axios/axios/pull/5036)
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- [Trim21](https://github.com/trim21)
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
- [shingo.sasaki](https://github.com/s-sasaki-0529)
|
|
||||||
- [Ivan Pepelko](https://github.com/ivanpepelko)
|
|
||||||
- [Richard Kořínek](https://github.com/risa)
|
|
||||||
|
|
||||||
## [1.0.0] - 2022-10-04
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- Added stack trace to AxiosError [#4624](https://github.com/axios/axios/pull/4624)
|
|
||||||
- Add AxiosError to AxiosStatic [#4654](https://github.com/axios/axios/pull/4654)
|
|
||||||
- Replaced Rollup as our build runner [#4596](https://github.com/axios/axios/pull/4596)
|
|
||||||
- Added generic TS types for the exposed toFormData helper [#4668](https://github.com/axios/axios/pull/4668)
|
|
||||||
- Added listen callback function [#4096](https://github.com/axios/axios/pull/4096)
|
|
||||||
- Added instructions for installing using PNPM [#4207](https://github.com/axios/axios/pull/4207)
|
|
||||||
- Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill [#4229](https://github.com/axios/axios/pull/4229)
|
|
||||||
- Added axios-url-template in ECOSYSTEM.md [#4238](https://github.com/axios/axios/pull/4238)
|
|
||||||
- Added a clear() function to the request and response interceptors object so a user can ensure that all interceptors have been removed from an axios instance [#4248](https://github.com/axios/axios/pull/4248)
|
|
||||||
- Added react hook plugin [#4319](https://github.com/axios/axios/pull/4319)
|
|
||||||
- Adding HTTP status code for transformResponse [#4580](https://github.com/axios/axios/pull/4580)
|
|
||||||
- Added blob to the list of protocols supported by the browser [#4678](https://github.com/axios/axios/pull/4678)
|
|
||||||
- Resolving proxy from env on redirect [#4436](https://github.com/axios/axios/pull/4436)
|
|
||||||
- Added enhanced toFormData implementation with additional options [4704](https://github.com/axios/axios/pull/4704)
|
|
||||||
- Adding Canceler parameters config and request [#4711](https://github.com/axios/axios/pull/4711)
|
|
||||||
- Added automatic payload serialization to application/x-www-form-urlencoded [#4714](https://github.com/axios/axios/pull/4714)
|
|
||||||
- Added the ability for webpack users to overwrite built-ins [#4715](https://github.com/axios/axios/pull/4715)
|
|
||||||
- Added string[] to AxiosRequestHeaders type [#4322](https://github.com/axios/axios/pull/4322)
|
|
||||||
- Added the ability for the url-encoded-form serializer to respect the formSerializer config [#4721](https://github.com/axios/axios/pull/4721)
|
|
||||||
- Added isCancel type assert [#4293](https://github.com/axios/axios/pull/4293)
|
|
||||||
- Added data URL support for node.js [#4725](https://github.com/axios/axios/pull/4725)
|
|
||||||
- Adding types for progress event callbacks [#4675](https://github.com/axios/axios/pull/4675)
|
|
||||||
- URL params serializer [#4734](https://github.com/axios/axios/pull/4734)
|
|
||||||
- Added axios.formToJSON method [#4735](https://github.com/axios/axios/pull/4735)
|
|
||||||
- Bower platform add data protocol [#4804](https://github.com/axios/axios/pull/4804)
|
|
||||||
- Use WHATWG URL API instead of url.parse() [#4852](https://github.com/axios/axios/pull/4852)
|
|
||||||
- Add ENUM containing Http Status Codes to typings [#4903](https://github.com/axios/axios/pull/4903)
|
|
||||||
- Improve typing of timeout in index.d.ts [#4934](https://github.com/axios/axios/pull/4934)
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- Updated AxiosError.config to be optional in the type definition [#4665](https://github.com/axios/axios/pull/4665)
|
|
||||||
- Updated README emphasizing the URLSearchParam built-in interface over other solutions [#4590](https://github.com/axios/axios/pull/4590)
|
|
||||||
- Include request and config when creating a CanceledError instance [#4659](https://github.com/axios/axios/pull/4659)
|
|
||||||
- Changed func-names eslint rule to as-needed [#4492](https://github.com/axios/axios/pull/4492)
|
|
||||||
- Replacing deprecated substr() with slice() as substr() is deprecated [#4468](https://github.com/axios/axios/pull/4468)
|
|
||||||
- Updating HTTP links in README.md to use HTTPS [#4387](https://github.com/axios/axios/pull/4387)
|
|
||||||
- Updated to a better trim() polyfill [#4072](https://github.com/axios/axios/pull/4072)
|
|
||||||
- Updated types to allow specifying partial default headers on instance create [#4185](https://github.com/axios/axios/pull/4185)
|
|
||||||
- Expanded isAxiosError types [#4344](https://github.com/axios/axios/pull/4344)
|
|
||||||
- Updated type definition for axios instance methods [#4224](https://github.com/axios/axios/pull/4224)
|
|
||||||
- Updated eslint config [#4722](https://github.com/axios/axios/pull/4722)
|
|
||||||
- Updated Docs [#4742](https://github.com/axios/axios/pull/4742)
|
|
||||||
- Refactored Axios to use ES2017 [#4787](https://github.com/axios/axios/pull/4787)
|
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
- There are multiple deprecations, refactors and fixes provided in this release. Please read through the full release notes to see how this may impact your project and use case.
|
|
||||||
|
|
||||||
### Removed
|
|
||||||
|
|
||||||
- Removed incorrect argument for NetworkError constructor [#4656](https://github.com/axios/axios/pull/4656)
|
|
||||||
- Removed Webpack [#4596](https://github.com/axios/axios/pull/4596)
|
|
||||||
- Removed function that transform arguments to array [#4544](https://github.com/axios/axios/pull/4544)
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Fixed grammar in README [#4649](https://github.com/axios/axios/pull/4649)
|
|
||||||
- Fixed code error in README [#4599](https://github.com/axios/axios/pull/4599)
|
|
||||||
- Optimized the code that checks cancellation [#4587](https://github.com/axios/axios/pull/4587)
|
|
||||||
- Fix url pointing to defaults.js in README [#4532](https://github.com/axios/axios/pull/4532)
|
|
||||||
- Use type alias instead of interface for AxiosPromise [#4505](https://github.com/axios/axios/pull/4505)
|
|
||||||
- Fix some word spelling and lint style in code comments [#4500](https://github.com/axios/axios/pull/4500)
|
|
||||||
- Edited readme with 3 updated browser icons of Chrome, FireFox and Safari [#4414](https://github.com/axios/axios/pull/4414)
|
|
||||||
- Bump follow-redirects from 1.14.9 to 1.15.0 [#4673](https://github.com/axios/axios/pull/4673)
|
|
||||||
- Fixing http tests to avoid hanging when assertions fail [#4435](https://github.com/axios/axios/pull/4435)
|
|
||||||
- Fix TS definition for AxiosRequestTransformer [#4201](https://github.com/axios/axios/pull/4201)
|
|
||||||
- Fix grammatical issues in README [#4232](https://github.com/axios/axios/pull/4232)
|
|
||||||
- Fixing instance.defaults.headers type [#4557](https://github.com/axios/axios/pull/4557)
|
|
||||||
- Fixed race condition on immediate requests cancellation [#4261](https://github.com/axios/axios/pull/4261)
|
|
||||||
- Fixing Z_BUF_ERROR when no content [#4701](https://github.com/axios/axios/pull/4701)
|
|
||||||
- Fixing proxy beforeRedirect regression [#4708](https://github.com/axios/axios/pull/4708)
|
|
||||||
- Fixed AxiosError status code type [#4717](https://github.com/axios/axios/pull/4717)
|
|
||||||
- Fixed AxiosError stack capturing [#4718](https://github.com/axios/axios/pull/4718)
|
|
||||||
- Fixing AxiosRequestHeaders typings [#4334](https://github.com/axios/axios/pull/4334)
|
|
||||||
- Fixed max body length defaults [#4731](https://github.com/axios/axios/pull/4731)
|
|
||||||
- Fixed toFormData Blob issue on node>v17 [#4728](https://github.com/axios/axios/pull/4728)
|
|
||||||
- Bump grunt from 1.5.2 to 1.5.3 [#4743](https://github.com/axios/axios/pull/4743)
|
|
||||||
- Fixing content-type header repeated [#4745](https://github.com/axios/axios/pull/4745)
|
|
||||||
- Fixed timeout error message for http [4738](https://github.com/axios/axios/pull/4738)
|
|
||||||
- Request ignores false, 0 and empty string as body values [#4785](https://github.com/axios/axios/pull/4785)
|
|
||||||
- Added back missing minified builds [#4805](https://github.com/axios/axios/pull/4805)
|
|
||||||
- Fixed a type error [#4815](https://github.com/axios/axios/pull/4815)
|
|
||||||
- Fixed a regression bug with unsubscribing from cancel token; [#4819](https://github.com/axios/axios/pull/4819)
|
|
||||||
- Remove repeated compression algorithm [#4820](https://github.com/axios/axios/pull/4820)
|
|
||||||
- The error of calling extend to pass parameters [#4857](https://github.com/axios/axios/pull/4857)
|
|
||||||
- SerializerOptions.indexes allows boolean | null | undefined [#4862](https://github.com/axios/axios/pull/4862)
|
|
||||||
- Require interceptors to return values [#4874](https://github.com/axios/axios/pull/4874)
|
|
||||||
- Removed unused imports [#4949](https://github.com/axios/axios/pull/4949)
|
|
||||||
- Allow null indexes on formSerializer and paramsSerializer [#4960](https://github.com/axios/axios/pull/4960)
|
|
||||||
|
|
||||||
### Chores
|
|
||||||
- Set permissions for GitHub actions [#4765](https://github.com/axios/axios/pull/4765)
|
|
||||||
- Included githubactions in the dependabot config [#4770](https://github.com/axios/axios/pull/4770)
|
|
||||||
- Included dependency review [#4771](https://github.com/axios/axios/pull/4771)
|
|
||||||
- Update security.md [#4784](https://github.com/axios/axios/pull/4784)
|
|
||||||
- Remove unnecessary spaces [#4854](https://github.com/axios/axios/pull/4854)
|
|
||||||
- Simplify the import path of AxiosError [#4875](https://github.com/axios/axios/pull/4875)
|
|
||||||
- Fix Gitpod dead link [#4941](https://github.com/axios/axios/pull/4941)
|
|
||||||
- Enable syntax highlighting for a code block [#4970](https://github.com/axios/axios/pull/4970)
|
|
||||||
- Using Logo Axios in Readme.md [#4993](https://github.com/axios/axios/pull/4993)
|
|
||||||
- Fix markup for note in README [#4825](https://github.com/axios/axios/pull/4825)
|
|
||||||
- Fix typo and formatting, add colons [#4853](https://github.com/axios/axios/pull/4853)
|
|
||||||
- Fix typo in readme [#4942](https://github.com/axios/axios/pull/4942)
|
|
||||||
|
|
||||||
### Security
|
|
||||||
|
|
||||||
- Update SECURITY.md [#4687](https://github.com/axios/axios/pull/4687)
|
|
||||||
|
|
||||||
### Contributors to this release
|
|
||||||
|
|
||||||
- [Bertrand Marron](https://github.com/tusbar)
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
- [Dan Mooney](https://github.com/danmooney)
|
|
||||||
- [Michael Li](https://github.com/xiaoyu-tamu)
|
|
||||||
- [aong](https://github.com/yxwzaxns)
|
|
||||||
- [Des Preston](https://github.com/despreston)
|
|
||||||
- [Ted Robertson](https://github.com/tredondo)
|
|
||||||
- [zhoulixiang](https://github.com/zh-lx)
|
|
||||||
- [Arthur Fiorette](https://github.com/arthurfiorette)
|
|
||||||
- [Kumar Shanu](https://github.com/Kr-Shanu)
|
|
||||||
- [JALAL](https://github.com/JLL32)
|
|
||||||
- [Jingyi Lin](https://github.com/MageeLin)
|
|
||||||
- [Philipp Loose](https://github.com/phloose)
|
|
||||||
- [Alexander Shchukin](https://github.com/sashsvamir)
|
|
||||||
- [Dave Cardwell](https://github.com/davecardwell)
|
|
||||||
- [Cat Scarlet](https://github.com/catscarlet)
|
|
||||||
- [Luca Pizzini](https://github.com/lpizzinidev)
|
|
||||||
- [Kai](https://github.com/Schweinepriester)
|
|
||||||
- [Maxime Bargiel](https://github.com/mbargiel)
|
|
||||||
- [Brian Helba](https://github.com/brianhelba)
|
|
||||||
- [reslear](https://github.com/reslear)
|
|
||||||
- [Jamie Slome](https://github.com/JamieSlome)
|
|
||||||
- [Landro3](https://github.com/Landro3)
|
|
||||||
- [rafw87](https://github.com/rafw87)
|
|
||||||
- [Afzal Sayed](https://github.com/afzalsayed96)
|
|
||||||
- [Koki Oyatsu](https://github.com/kaishuu0123)
|
|
||||||
- [Dave](https://github.com/wangcch)
|
|
||||||
- [暴走老七](https://github.com/baozouai)
|
|
||||||
- [Spencer](https://github.com/spalger)
|
|
||||||
- [Adrian Wieprzkowicz](https://github.com/Argeento)
|
|
||||||
- [Jamie Telin](https://github.com/lejahmie)
|
|
||||||
- [毛呆](https://github.com/aweikalee)
|
|
||||||
- [Kirill Shakirov](https://github.com/turisap)
|
|
||||||
- [Rraji Abdelbari](https://github.com/estarossa0)
|
|
||||||
- [Jelle Schutter](https://github.com/jelleschutter)
|
|
||||||
- [Tom Ceuppens](https://github.com/KyorCode)
|
|
||||||
- [Johann Cooper](https://github.com/JohannCooper)
|
|
||||||
- [Dimitris Halatsis](https://github.com/mitsos1os)
|
|
||||||
- [chenjigeng](https://github.com/chenjigeng)
|
|
||||||
- [João Gabriel Quaresma](https://github.com/joaoGabriel55)
|
|
||||||
- [Victor Augusto](https://github.com/VictorAugDB)
|
|
||||||
- [neilnaveen](https://github.com/neilnaveen)
|
|
||||||
- [Pavlos](https://github.com/psmoros)
|
|
||||||
- [Kiryl Valkovich](https://github.com/visortelle)
|
|
||||||
- [Naveen](https://github.com/naveensrinivasan)
|
|
||||||
- [wenzheng](https://github.com/0x30)
|
|
||||||
- [hcwhan](https://github.com/hcwhan)
|
|
||||||
- [Bassel Rachid](https://github.com/basselworkforce)
|
|
||||||
- [Grégoire Pineau](https://github.com/lyrixx)
|
|
||||||
- [felipedamin](https://github.com/felipedamin)
|
|
||||||
- [Karl Horky](https://github.com/karlhorky)
|
|
||||||
- [Yue JIN](https://github.com/kingyue737)
|
|
||||||
- [Usman Ali Siddiqui](https://github.com/usman250994)
|
|
||||||
- [WD](https://github.com/techbirds)
|
|
||||||
- [Günther Foidl](https://github.com/gfoidl)
|
|
||||||
- [Stephen Jennings](https://github.com/jennings)
|
|
||||||
- [C.T.Lin](https://github.com/chentsulin)
|
|
||||||
- [mia-z](https://github.com/mia-z)
|
|
||||||
- [Parth Banathia](https://github.com/Parth0105)
|
|
||||||
- [parth0105pluang](https://github.com/parth0105pluang)
|
|
||||||
- [Marco Weber](https://github.com/mrcwbr)
|
|
||||||
- [Luca Pizzini](https://github.com/lpizzinidev)
|
|
||||||
- [Willian Agostini](https://github.com/WillianAgostini)
|
|
||||||
- [Huyen Nguyen](https://github.com/huyenltnguyen)
|
|
7
app/node_modules/axios/LICENSE
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
# Copyright (c) 2014-present Matt Zabriskie & Collaborators
|
|
||||||
|
|
||||||
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.
|
|
3
app/node_modules/axios/MIGRATION_GUIDE.md
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
# Migration Guide
|
|
||||||
|
|
||||||
## 0.x.x -> 1.1.0
|
|