🎉 Refactor backend: Remove unnecessary files & update documentation 📚, 🔧 Clean up node_modules & static assets 🗑️, 📝 Update README.md & related docs 📚, 🚀 Deploy new frontend images 📦.

This commit is contained in:
Till Tomczak 2025-05-31 22:51:37 +02:00
parent df8fb197c0
commit fae594014d
34 changed files with 681 additions and 2628 deletions

View File

@ -1,2 +1,8 @@
fund=false
audit-level=moderate
package-lock=true
save-exact=true
save-prefix=
ca[]=
cafile=/etc/ssl/certs/ca-certificates.crt
strict-ssl=true

View File

@ -1,36 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIGOTCCBCGgAwIBAgIQSeiY3h8+WoxNSBg0jOy/ozANBgkqhkiG9w0BAQsFADA9
MQswCQYDVQQGEwJERTETMBEGA1UECgwKRGFpbWxlciBBRzEZMBcGA1UEAwwQQ29y
cC1QcmotUm9vdC1DQTAeFw0yMDA5MzAyMTM0MzlaFw00MDA5MzAyMTM0MzlaMD0x
CzAJBgNVBAYTAkRFMRMwEQYDVQQKDApEYWltbGVyIEFHMRkwFwYDVQQDDBBDb3Jw
LVByai1Sb290LUNBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAmwTL
4Pwy4W9yM637BwmYYPle5YErD/lpbmP8b3if+BKmwsWsOz2pRzCNDCPUnZl7xW1e
XrMmmksD6MRXk2vwz/BAXgf5Bc6+ii+q4ia3Tt+voKLZXJej5cXuqoZrGWzdlC5H
bY2SxUwbr7O05CsQzVsGhI+rbGDCUbjfE6NY2s3BbMpjndQYX/9JV+KHg6puZI/o
s1vt/RaOHkuvd9NFmrCdb9A+b0CpMT2K4tQzgNjk30MNfI6DRwHUjxF2l1ZpscHq
28gj4PfWbA9d/kxwuxOOJX4rfihRiwwnUzwF3jD1MlnHu4GTGLBIoke2KUXL0BI9
IrSKvl3DjRZf3XRcAo4IlT8tECaRZloTIVNgACsUmSNtIWn/x6EUKoaLvqZf6BQt
4I+tuMdmIqRkGA+MRuCHbPsjpDBPsQ5Y+r80MF1STode0Peq6gTdYvRbN7KJjbET
uXFjD520LEBRP1YaA99DMmer2e0znhkCffwrkWYQUc1B2yUdyS08UfMIqm8CybWD
lFTE2Taau2xebGlBeipvJ4QkzrR3TZ9CsTb+h38o50F4GHUh5nF0ll0IIS/73XtQ
YSEOaCxCBiEraIxPIg9HRj6yASnA7korzqUb3cmJiqIoLOjoMqZL1NksbEJBranV
QMzY4lNuNHabjwa3P36MoGIkUj334EigoEtqwvMCAwEAAaOCATMwggEvMA4GA1Ud
DwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTojU2VKgTmq3j3
JZl7o9WYdlWuHDCB7AYDVR0gBIHkMIHhMIHeBgRVHSAAMIHVMCoGCCsGAQUFBwIB
Fh5odHRwOi8vcGtpLmNvcnBzaGFyZWQubmV0L2Nwcy8wgaYGCCsGAQUFBwICMIGZ
HoGWAEQAYQBpAG0AbABlAHIAIABQAHIAbwBqAGUAYwB0ACAAQwBBACAAQwBlAHIA
dABpAGYAaQBjAGEAdABlACAAUABvAGwAaQBjAHkAIABhAG4AZAAgAEMAZQByAHQA
aQBmAGkAYwBhAHQAaQBvAG4AIABQAHIAYQBjAHQAaQBjAGUAIABTAHQAYQB0AGUA
bQBlAG4AdAAuMA0GCSqGSIb3DQEBCwUAA4ICAQA1/LxktggnmFd7k77Qkub89LpI
26BdNXpozIpc5+uW0W2Q1jJ30PHNEaXGNt2hBA7sXxCYx/+NrrC2RE/8QClZ6kUk
P+AT8W2j0msmh5TpH9TRizDRGFbIlvsLlDRAW2FuTKYL1N7LXFE8oqlqpo6Tl+k9
6yWJwVyZInTwRy0BWAPviA/n2gJuEGTIFi3I494d6YMKIDw5LAvH90ISVNRN7+a3
DBmdVATSQRA9cEsLgDxpDQnOMxNaSIsIKD8DKGwD+m7Kzgwg5Qg9JyC734wJMqu9
wHdZJ1FiTXNkH68dOK2zNGNEsjhUTH058joY2y33dxawJXTkeqDVP2uozC2ruWDs
QUT/AdLcUWa+mrFyDSw0IvrdUmSp3fWW9+Sx3o2uInSSBISkVByg3XvYag+Ibdiy
83Denqi9SVQjzTclfx0XNbjcSoxvRRluegNXuU0P48PZ2/QKZhs0hJ7poQCeUlDe
O8oOGhOOejlouUi0uqOthfS1puqlLIAESjWADyufir1+WcMow7PVUy9+agg9lpgr
aH7+klVjLPiGYUg3CxGv+aO6uYSA089SuhJRrurYuOXuP3VqaoPx0Smbj1JZ1n3D
HlSPGaSVWF06l5gF0dZj1IgrWjljvhfhr8Mfj5aQCiUDWN7YhLzthzlrhSeV8sY7
i9eJKKHKnwWB67iC4g==
-----END CERTIFICATE-----

View File

@ -1,35 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIGIjCCBAqgAwIBAgIQHFAzqM8GW6RCGy2VQ1JYBDANBgkqhkiG9w0BAQsFADA8
MQswCQYDVQQGEwJERTETMBEGA1UECgwKRGFpbWxlciBBRzEYMBYGA1UEAwwPQ29y
cC1Sb290LUNBLUcyMB4XDTE2MTEwMjEzNTE1NFoXDTM2MTEwMjEzNTE1NFowPDEL
MAkGA1UEBhMCREUxEzARBgNVBAoMCkRhaW1sZXIgQUcxGDAWBgNVBAMMD0NvcnAt
Um9vdC1DQS1HMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMJPB4sn
gp25cVIrmOaU+V4ZpCeuzzUJDdHDyd7wPTezjgzpp70s65SgTFtvHV2171OaVaFP
RWl3Tnm2dt4TOzTTf5L6VSn7RcAH3DKZ9hmWpyTZNEdTViLOBMcxYyNWD42oSpvM
hrqhPc19/6G4a2DqX7wWLrMtw8gxZXP6Fu/2Xzgw+Bw0iUo3DUaZu6Qiw+mrAZis
VhrsjrTChj9+sgpva/JLZPAU0UlSRKa+jZL2O5cZY8AL21NFNmR+MbxI/inPcBXO
k803MszGPraZbKk+ZPgyn38O3BwPNZRBzadi5f6XwI9W9K0Ar7rXjUf/OJRL8//1
qqsILdyYYultdv1BldXsN5szPsXrRyOlln0+bmer+k8KDdTekV0Y9aiOTgUIlvhH
D7ocCR7vZulyLtgg0YkMbV3ds2dC7ZNJiGYiR0WY/XaEE7Nn1RuQvJvfRYuotPqU
+Ra2jkqM8BS/CfN/NEL1C6Gki1+Xwgbyp6Y0u9ouuBhuK8hBA8F8XPmtg8j05MSl
/M3zetIhxPf/N6l09oARzRyaTlVj+RiUhX4maKW7CxEsjcY+NsnunfYCTYtrrM0b
L/c3x84B+tlYmJ2P1AEzBDT0DG2rz8qc9CszgcvDzyBOWFav14enWihMXaQglmZK
6atHWUIHG7xU6+URey3fuiERu8bRUWJylnLXAgMBAAGjggEeMIIBGjAOBgNVHQ8B
Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUjMD1u+au8ZZ5Svfo
uG1K4odr0XQwgdcGA1UdIASBzzCBzDCByQYEVR0gADCBwDArBggrBgEFBQcCARYf
aHR0cDovL3BraS5jb3Jwc2hhcmVkLm5ldC9jcHMvADCBkAYIKwYBBQUHAgIwgYMe
gYAARABhAGkAbQBsAGUAcgAgAEMAZQByAHQAaQBmAGkAYwBhAHQAZQAgAFAAbwBs
AGkAYwB5ACAAYQBuAGQAIABDAGUAcgB0AGkAZgBpAGMAYQB0AGkAbwBuACAAUABy
AGEAYwB0AGkAYwBlACAAUwB0AGEAdABlAG0AZQBuAHQALjANBgkqhkiG9w0BAQsF
AAOCAgEAO/YuDNU9uPMKlkjTHg7kzs3dtEE2HA/aRD2ko4UDkOf8fSynIv5AcuC2
O//bbcTmFByU7OFx/P6JXIsqXhnw+8HdScZB8RxUwskjbD9qSq2zG+vcL9WRvNw5
5/Igq3xbNMHWLix+h98IV3Rzok6i6btHr9/yvdvDMHlcy7hMfkMhsx9IoXveJLcB
2n0s/JYqkR+eN+zJ7C3sx+W/nAMkwqG3oFAiaKVUmvbRD9eKOssAEQGZi7AgCige
D395CIL+jIZfxrSotTlR5oxx0LabxACEAulL6I5Retnnpsnbc75sQnpMBKFvQO8n
dPTdzNCp7337Qby1fPnrzig4SndSSf/crbPBU3N/tZWKldC3SHmcOhAzBUwMibQC
GsvkPxIqROYFRoKRv5VlsoqSJkb225DTfq1TyP9wHhi80ZllOpHrFkdc+Z6a62O3
sGQNSymxC5xyNMsVd8GidgxbCa1xXHNtTnKTxsbzFvTXgL7GwbJnaf341uP/+sTt
L7i3SsMynWRMQgXIbu8h+zriacnAWoQmxeJ/by/TZUUSNcYxyZWDmIxR3ZIdS2AO
srlDmNt++Q3P0DHpJXOvZKeRoWyTsA8RceRvAoJWjBSBwuW2kThKHqwAOVRwQ2o9
uPU7Ic3wisWJTNmVF7d/QATRL2tVV2HV1+O4aTNl9s8bTKZ4P1w=
-----END CERTIFICATE-----

BIN
backend/database/myp.db-shm Normal file

Binary file not shown.

BIN
backend/database/myp.db-wal Normal file

Binary file not shown.

View File

@ -192,7 +192,7 @@ install_mercedes_certificates() {
progress "Aktualisiere CA-Zertifikate..."
# CA-Zertifikate Paket installieren/aktualisieren
apt-get install -y ca-certificates curl || error "CA-Zertifikate Installation fehlgeschlagen"
apt-get install -y ca-certificates curl openssl || error "CA-Zertifikate Installation fehlgeschlagen"
# Standard CA-Bundle aktualisieren
update-ca-certificates || warning "CA-Zertifikate Update teilweise fehlgeschlagen"
@ -201,21 +201,104 @@ install_mercedes_certificates() {
if [ -d "$CURRENT_DIR/certs/mercedes" ] && [ "$(ls -A $CURRENT_DIR/certs/mercedes 2>/dev/null)" ]; then
progress "Installiere Mercedes Corporate Zertifikate..."
# Alle .crt und .pem Dateien kopieren
find "$CURRENT_DIR/certs/mercedes" -type f \( -name "*.crt" -o -name "*.pem" -o -name "*.cer" \) -exec cp {} /usr/local/share/ca-certificates/ \; 2>/dev/null || true
# Erstelle temporäres Verzeichnis für Zertifikat-Verarbeitung
TEMP_CERT_DIR="/tmp/mercedes_certs"
mkdir -p "$TEMP_CERT_DIR"
# Zertifikate aktualisieren
# Alle Zertifikatsdateien verarbeiten (.crt, .pem, .cer)
find "$CURRENT_DIR/certs/mercedes" -type f \( -name "*.crt" -o -name "*.pem" -o -name "*.cer" \) | while read cert_file; do
cert_basename=$(basename "$cert_file")
cert_name="${cert_basename%.*}"
progress "Verarbeite Mercedes-Zertifikat: $cert_basename"
# .cer Dateien in .crt konvertieren (falls nötig)
if [[ "$cert_file" == *.cer ]]; then
progress "Konvertiere .cer zu .crt: $cert_basename"
# Überprüfe ob es sich um DER- oder PEM-Format handelt
if openssl x509 -in "$cert_file" -text -noout >/dev/null 2>&1; then
# PEM-Format - direkt kopieren mit .crt Endung
cp "$cert_file" "$TEMP_CERT_DIR/${cert_name}.crt"
elif openssl x509 -in "$cert_file" -inform DER -text -noout >/dev/null 2>&1; then
# DER-Format - zu PEM konvertieren
openssl x509 -in "$cert_file" -inform DER -out "$TEMP_CERT_DIR/${cert_name}.crt" -outform PEM
else
warning "Unbekanntes Zertifikatformat: $cert_file"
continue
fi
else
# .crt oder .pem - direkt kopieren
cp "$cert_file" "$TEMP_CERT_DIR/"
fi
# Zertifikat validieren
if openssl x509 -in "$TEMP_CERT_DIR/${cert_name}.crt" -text -noout >/dev/null 2>&1; then
log "✅ Zertifikat validiert: ${cert_name}.crt"
# In CA-Zertifikate-Verzeichnis kopieren
cp "$TEMP_CERT_DIR/${cert_name}.crt" "/usr/local/share/ca-certificates/"
else
warning "⚠️ Ungültiges Zertifikat übersprungen: $cert_file"
fi
done
# Spezielle Mercedes-Zertifikate verarbeiten
if [ -f "$CURRENT_DIR/certs/mercedes/Corp-Pri-Root-CA.cer" ]; then
progress "Installiere Mercedes Corporate Primary Root CA..."
# Versuche DER-zu-PEM Konvertierung
if openssl x509 -in "$CURRENT_DIR/certs/mercedes/Corp-Pri-Root-CA.cer" -inform DER -out "/usr/local/share/ca-certificates/Mercedes-Corp-Pri-Root-CA.crt" -outform PEM 2>/dev/null; then
log "✅ Corp-Pri-Root-CA.cer erfolgreich als DER konvertiert"
# Versuche direkte PEM-Kopie
elif openssl x509 -in "$CURRENT_DIR/certs/mercedes/Corp-Pri-Root-CA.cer" -text -noout >/dev/null 2>&1; then
cp "$CURRENT_DIR/certs/mercedes/Corp-Pri-Root-CA.cer" "/usr/local/share/ca-certificates/Mercedes-Corp-Pri-Root-CA.crt"
log "✅ Corp-Pri-Root-CA.cer direkt als PEM kopiert"
else
warning "⚠️ Corp-Pri-Root-CA.cer Format nicht erkannt - übersprungen"
fi
fi
if [ -f "$CURRENT_DIR/certs/mercedes/Corp-Root-CA-G2.cer" ]; then
progress "Installiere Mercedes Corporate Root CA G2..."
# Versuche DER-zu-PEM Konvertierung
if openssl x509 -in "$CURRENT_DIR/certs/mercedes/Corp-Root-CA-G2.cer" -inform DER -out "/usr/local/share/ca-certificates/Mercedes-Corp-Root-CA-G2.crt" -outform PEM 2>/dev/null; then
log "✅ Corp-Root-CA-G2.cer erfolgreich als DER konvertiert"
# Versuche direkte PEM-Kopie
elif openssl x509 -in "$CURRENT_DIR/certs/mercedes/Corp-Root-CA-G2.cer" -text -noout >/dev/null 2>&1; then
cp "$CURRENT_DIR/certs/mercedes/Corp-Root-CA-G2.cer" "/usr/local/share/ca-certificates/Mercedes-Corp-Root-CA-G2.crt"
log "✅ Corp-Root-CA-G2.cer direkt als PEM kopiert"
else
warning "⚠️ Corp-Root-CA-G2.cer Format nicht erkannt - übersprungen"
fi
fi
# Temporäres Verzeichnis aufräumen
rm -rf "$TEMP_CERT_DIR"
# CA-Zertifikate aktualisieren
update-ca-certificates || warning "Mercedes Zertifikate Update fehlgeschlagen"
log "✅ Mercedes Zertifikate installiert"
# Installierte Mercedes-Zertifikate auflisten
MERCEDES_CERTS=$(ls /usr/local/share/ca-certificates/*Mercedes* 2>/dev/null | wc -l)
if [ "$MERCEDES_CERTS" -gt 0 ]; then
log "$MERCEDES_CERTS Mercedes-Zertifikate erfolgreich installiert"
ls /usr/local/share/ca-certificates/*Mercedes* 2>/dev/null | while read cert; do
log " 📜 $(basename "$cert")"
done
else
info "Keine Mercedes Zertifikate gefunden - verwende Standard CA-Bundle"
warning "⚠️ Keine Mercedes-Zertifikate installiert"
fi
else
info "Keine Mercedes-Zertifikate gefunden - verwende Standard CA-Bundle"
fi
# Python SSL-Konfiguration optimieren
progress "Konfiguriere Python SSL-Einstellungen..."
# pip Konfiguration für SSL
# pip Konfiguration für SSL mit erweiterten Optionen
mkdir -p /root/.pip
cat > /root/.pip/pip.conf << EOF
[global]
@ -225,31 +308,58 @@ trusted-host = pypi.org
cert = /etc/ssl/certs/ca-certificates.crt
timeout = 60
retries = 3
no-cache-dir = true
[install]
trusted-host = pypi.org
pypi.python.org
files.pythonhosted.org
no-warn-script-location = true
EOF
# Python HTTPS-Konfiguration
# Python HTTPS-Konfiguration mit Mercedes-Support
export SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
export REQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt"
export CURL_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt"
export PYTHONHTTPSVERIFY=1
# Node.js SSL-Konfiguration hinzufügen
export NODE_TLS_REJECT_UNAUTHORIZED=1
export NODE_EXTRA_CA_CERTS="/etc/ssl/certs/ca-certificates.crt"
# npm SSL-Konfiguration mit verbesserter Fehlerbehandlung
progress "Konfiguriere npm SSL-Einstellungen..."
npm config set ca "" 2>/dev/null || true
npm config set cafile "/etc/ssl/certs/ca-certificates.crt" 2>/dev/null || true
npm config set strict-ssl true 2>/dev/null || true
npm config set registry "https://registry.npmjs.org/" 2>/dev/null || true
# Pip auf neueste Version aktualisieren
progress "Aktualisiere pip auf neueste Version..."
python3 -m pip install --upgrade pip --break-system-packages --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org || warning "pip Update fehlgeschlagen"
# SSL-Test durchführen
progress "Teste SSL-Verbindung zu PyPI..."
# SSL-Tests durchführen
progress "Teste SSL-Verbindungen..."
# Test PyPI
if python3 -c "import ssl, urllib.request; urllib.request.urlopen('https://pypi.org')" 2>/dev/null; then
log "✅ SSL-Verbindung zu PyPI erfolgreich"
else
warning "⚠️ SSL-Verbindung zu PyPI problematisch - Installation wird dennoch versucht"
warning "⚠️ SSL-Verbindung zu PyPI problematisch"
fi
log "✅ Mercedes SSL-Zertifikate und Python-Konfiguration abgeschlossen"
# Test npm Registry
if npm ping --registry https://registry.npmjs.org >/dev/null 2>&1; then
log "✅ SSL-Verbindung zu npm Registry erfolgreich"
else
warning "⚠️ SSL-Verbindung zu npm Registry problematisch"
fi
# Zeige installierte CA-Zertifikate-Anzahl
CA_COUNT=$(ls /etc/ssl/certs/*.pem 2>/dev/null | wc -l)
log "✅ Insgesamt $CA_COUNT CA-Zertifikate im System verfügbar"
log "✅ Mercedes SSL-Zertifikate und System-Konfiguration abgeschlossen"
}
# ========================== ABHÄNGIGKEITEN INSTALLIEREN ==========================
@ -286,21 +396,35 @@ install_system_dependencies() {
# ========================== NODE.JS UND NPM INSTALLATION ==========================
progress "Installiere Node.js und npm..."
# NodeSource Repository für neueste LTS Version hinzufügen
progress "Füge NodeSource Repository hinzu..."
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - || {
warning "NodeSource Repository konnte nicht hinzugefügt werden - verwende Debian-Pakete"
apt-get install -y nodejs npm || error "Node.js Installation aus Debian-Repository fehlgeschlagen"
# Alte Node.js-Installationen entfernen
progress "Entferne alte Node.js-Installationen..."
apt-get remove --purge -y nodejs npm 2>/dev/null || true
apt-get autoremove -y 2>/dev/null || true
# NodeSource Repository für Node.js LTS 20.x hinzufügen
progress "Füge NodeSource Repository für Node.js 20.x LTS hinzu..."
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - || {
warning "NodeSource Repository konnte nicht hinzugefügt werden"
# Fallback: Manueller Download und Installation
progress "Fallback: Installiere Node.js aus Debian-Repository..."
apt-get update -y
apt-get install -y nodejs npm || {
error "Node.js Installation komplett fehlgeschlagen"
}
}
# Node.js aus NodeSource Repository installieren (falls Repository erfolgreich hinzugefügt)
if [ -f /etc/apt/sources.list.d/nodesource.list ]; then
progress "Installiere Node.js LTS aus NodeSource Repository..."
progress "Installiere Node.js 20.x LTS aus NodeSource Repository..."
apt-get update -y
apt-get install -y nodejs || error "Node.js Installation aus NodeSource fehlgeschlagen"
apt-get install -y nodejs || {
warning "NodeSource Installation fehlgeschlagen - verwende Fallback"
apt-get install -y nodejs npm || error "Node.js Fallback Installation fehlgeschlagen"
}
fi
# Überprüfe Node.js und npm Installation
# Überprüfe Node.js Installation
if command -v node >/dev/null 2>&1; then
NODE_VERSION=$(node --version)
log "✅ Node.js erfolgreich installiert: $NODE_VERSION"
@ -308,25 +432,32 @@ install_system_dependencies() {
error "❌ Node.js Installation fehlgeschlagen"
fi
# npm sollte automatisch mit Node.js mitgeliefert werden
if command -v npm >/dev/null 2>&1; then
NPM_VERSION=$(npm --version)
log "✅ npm erfolgreich installiert: $NPM_VERSION"
log "✅ npm automatisch installiert: $NPM_VERSION"
# npm auf neueste Version aktualisieren
progress "Aktualisiere npm auf neueste Version..."
npm install -g npm@latest || warning "npm Update fehlgeschlagen"
# VORSICHTIG: npm NUR aktualisieren wenn Node.js >= 18
NODE_MAJOR_VERSION=$(node --version | cut -d'.' -f1 | sed 's/v//')
if [ "$NODE_MAJOR_VERSION" -ge 18 ]; then
progress "Node.js $NODE_MAJOR_VERSION erkannt - npm-Update möglich..."
npm install -g npm@latest --force 2>/dev/null || {
warning "npm-Update fehlgeschlagen - verwende bestehende Version $NPM_VERSION"
}
NPM_VERSION_NEW=$(npm --version)
log "✅ npm aktualisiert: $NPM_VERSION_NEW"
log "✅ npm Version: $NPM_VERSION_NEW"
else
error "❌ npm Installation fehlgeschlagen"
warning "⚠️ Node.js < 18 - npm-Update übersprungen für Kompatibilität"
fi
else
error "❌ npm nicht verfügbar"
fi
# npm-Konfiguration für bessere Performance und Sicherheit
# npm-Konfiguration für bessere Performance
progress "Konfiguriere npm-Einstellungen..."
npm config set fund false
npm config set audit-level moderate
npm config set package-lock true
npm config set save-exact true
npm config set fund false 2>/dev/null || true
npm config set audit-level moderate 2>/dev/null || true
npm config set package-lock true 2>/dev/null || true
# WICHTIG: Mercedes Zertifikate vor Python-Paketen installieren
install_mercedes_certificates
@ -377,12 +508,30 @@ install_system_dependencies() {
# npm install OHNE --production um auch devDependencies (TailwindCSS) zu installieren
progress "Installiere alle npm-Abhängigkeiten (inklusive devDependencies für TailwindCSS)..."
npm install --no-optional --no-audit --no-fund || {
warning "npm install fehlgeschlagen - versuche mit --legacy-peer-deps"
npm install --no-optional --no-audit --no-fund --legacy-peer-deps || error "npm install komplett fehlgeschlagen"
}
log "✅ npm-Abhängigkeiten erfolgreich installiert:"
# Erste Versuche: Standard-Installation
if npm install --no-optional --no-audit --no-fund 2>/dev/null; then
log "✅ npm install erfolgreich (Standard)"
# Zweiter Versuch: Mit legacy-peer-deps
elif npm install --no-optional --no-audit --no-fund --legacy-peer-deps 2>/dev/null; then
log "✅ npm install erfolgreich (mit --legacy-peer-deps)"
# Dritter Versuch: Mit force Flag
elif npm install --no-optional --no-audit --no-fund --force 2>/dev/null; then
log "✅ npm install erfolgreich (mit --force)"
# Vierter Versuch: Mit allen Flags
elif npm install --no-optional --no-audit --no-fund --legacy-peer-deps --force 2>/dev/null; then
log "✅ npm install erfolgreich (mit allen Flags)"
else
warning "⚠️ npm install fehlgeschlagen - versuche manuelle Paket-Installation..."
# Manuelle Installation der wichtigsten Pakete
npm install tailwindcss --no-audit --no-fund --force 2>/dev/null || warning "TailwindCSS Installation fehlgeschlagen"
npm install @tailwindcss/forms --no-audit --no-fund --force 2>/dev/null || warning "@tailwindcss/forms Installation fehlgeschlagen"
npm install chart.js --no-audit --no-fund --force 2>/dev/null || warning "Chart.js Installation fehlgeschlagen"
npm install @fortawesome/fontawesome-free --no-audit --no-fund --force 2>/dev/null || warning "FontAwesome Installation fehlgeschlagen"
fi
log "✅ npm-Abhängigkeiten-Installation abgeschlossen:"
log " 📦 Dependencies: FontAwesome, FullCalendar, Chart.js, Vite"
log " 🛠️ DevDependencies: TailwindCSS, PostCSS, Autoprefixer"
@ -390,19 +539,28 @@ install_system_dependencies() {
if npx tailwindcss --help >/dev/null 2>&1; then
log "✅ TailwindCSS erfolgreich installiert und verfügbar"
else
error "❌ TailwindCSS nicht verfügbar - Build wird fehlschlagen"
warning "❌ TailwindCSS nicht verfügbar - versuche globale Installation..."
npm install -g tailwindcss --force 2>/dev/null || error "TailwindCSS Installation komplett fehlgeschlagen"
fi
# Überprüfe auf Build-Scripts und führe sie aus
if npm run | grep -q "build:css"; then
progress "CSS-Build-Script gefunden - führe npm run build:css aus..."
npm run build:css || error "npm run build:css fehlgeschlagen - TailwindCSS Build nicht möglich"
log "✅ TailwindCSS Build abgeschlossen - CSS-Dateien generiert"
if npm run build:css 2>/dev/null; then
log "✅ TailwindCSS Build erfolgreich abgeschlossen"
else
warning "⚠️ npm run build:css fehlgeschlagen - versuche direkten npx-Aufruf..."
if npx tailwindcss -i ./static/css/input.css -o ./static/css/tailwind.min.css --minify 2>/dev/null; then
log "✅ TailwindCSS mit npx erfolgreich kompiliert"
else
error "❌ TailwindCSS Build komplett fehlgeschlagen"
fi
fi
fi
if npm run | grep -q "build" && ! npm run | grep -q "build:css"; then
progress "Haupt-Build-Script gefunden - führe npm run build aus..."
npm run build || warning "npm run build fehlgeschlagen"
npm run build 2>/dev/null || warning "npm run build fehlgeschlagen"
log "✅ Frontend-Build abgeschlossen"
fi

View File

@ -16,22 +16,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.25.4",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.4.tgz",
"integrity": "sha512-nOT2vZNw6hJ+z43oP1SPea/G/6AbN6X+bGNhNuq8NtRHy4wsMhw765IKLNmnjek7GvjWBYQ8Q5VBoYTFg9y1UQ==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@fortawesome/fontawesome-free": {
"version": "6.7.2",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.7.2.tgz",
@ -195,29 +179,6 @@
"node": ">= 8"
}
},
"node_modules/@pkgjs/parseargs": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
"integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
"license": "MIT",
"optional": true,
"engines": {
"node": ">=14"
}
},
"node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.41.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.41.1.tgz",
"integrity": "sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@tailwindcss/forms": {
"version": "0.5.10",
"resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.10.tgz",

View File

@ -1,3 +0,0 @@
# esbuild
This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.

Binary file not shown.

View File

@ -1,20 +0,0 @@
{
"name": "@esbuild/win32-x64",
"version": "0.25.4",
"description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
"repository": {
"type": "git",
"url": "git+https://github.com/evanw/esbuild.git"
},
"license": "MIT",
"preferUnplugged": true,
"engines": {
"node": ">=18"
},
"os": [
"win32"
],
"cpu": [
"x64"
]
}

View File

@ -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

View File

@ -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))

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,
};

View File

@ -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,
}
};

View File

@ -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;

View File

@ -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,
};

View File

@ -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,
};

View File

@ -1,36 +0,0 @@
{
"name": "@pkgjs/parseargs",
"version": "0.11.0",
"description": "Polyfill of future proposal for `util.parseArgs()`",
"engines": {
"node": ">=14"
},
"main": "index.js",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"scripts": {
"coverage": "c8 --check-coverage tape 'test/*.js'",
"test": "c8 tape 'test/*.js'",
"posttest": "eslint .",
"fix": "npm run posttest -- --fix"
},
"repository": {
"type": "git",
"url": "git@github.com:pkgjs/parseargs.git"
},
"keywords": [],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/pkgjs/parseargs/issues"
},
"homepage": "https://github.com/pkgjs/parseargs#readme",
"devDependencies": {
"c8": "^7.10.0",
"eslint": "^8.2.0",
"eslint-plugin-node-core": "iansu/eslint-plugin-node-core",
"tape": "^5.2.2"
}
}

View File

@ -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,
};

View File

@ -1,3 +0,0 @@
# `@rollup/rollup-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `rollup`

View File

@ -1,19 +0,0 @@
{
"name": "@rollup/rollup-win32-x64-msvc",
"version": "4.41.1",
"os": [
"win32"
],
"cpu": [
"x64"
],
"files": [
"rollup.win32-x64-msvc.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": "rollup/rollup",
"main": "./rollup.win32-x64-msvc.node"
}

View File

@ -1,33 +1,103 @@
/**
* MYP Platform Komponenten-Bibliothek
* Erweiterte UI-Komponenten basierend auf Tailwind CSS
* RESPONSIVE DESIGN OPTIMIERT FÜR ALLE BILDSCHIRMGROSSEN
*/
@layer components {
/* Professionelle Mercedes-Benz Karten und Container */
/* ===== RESPONSIVE FOUNDATION STYLES ===== */
/* Base responsive container */
.responsive-container {
@apply w-full max-w-none mx-auto px-3 sm:px-4 md:px-6 lg:px-8 xl:px-12;
}
/* Responsive grid system */
.responsive-grid {
@apply grid gap-3 sm:gap-4 md:gap-6 lg:gap-8;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.responsive-grid-2 {
@apply grid gap-3 sm:gap-4 md:gap-6 grid-cols-1 sm:grid-cols-2;
}
.responsive-grid-3 {
@apply grid gap-3 sm:gap-4 md:gap-6 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3;
}
.responsive-grid-4 {
@apply grid gap-3 sm:gap-4 md:gap-6 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4;
}
/* ===== PROFESSIONELLE MERCEDES-BENZ KARTEN - RESPONSIVE ===== */
.card {
@apply bg-white dark:bg-slate-900 rounded-xl shadow-lg border border-slate-200 dark:border-slate-700 p-6 m-4 transition-all duration-300;
@apply bg-white dark:bg-slate-900 rounded-lg sm:rounded-xl shadow-mobile sm:shadow-tablet lg:shadow-desktop border border-slate-200 dark:border-slate-700 p-3 sm:p-4 md:p-6 m-2 sm:m-3 md:m-4 transition-all duration-300;
}
.card-hover {
@apply hover:shadow-xl hover:shadow-slate-300/50 dark:hover:shadow-slate-900/50 hover:bg-slate-50 dark:hover:bg-slate-800 transform hover:-translate-y-1 transition-all duration-300;
}
.container-panel {
@apply bg-slate-50 dark:bg-slate-800 rounded-xl p-6 m-4 border border-slate-200 dark:border-slate-700 shadow-sm;
/* Responsive dashboard card */
.dashboard-card {
@apply bg-white dark:bg-slate-900 rounded-lg sm:rounded-xl md:rounded-2xl shadow-mobile sm:shadow-tablet lg:shadow-desktop border border-slate-200 dark:border-slate-700 p-3 sm:p-4 md:p-6 lg:p-8 transition-all duration-300;
}
/* Professionelle Formulare */
.container-panel {
@apply bg-slate-50 dark:bg-slate-800 rounded-lg sm:rounded-xl p-3 sm:p-4 md:p-6 m-2 sm:m-3 md:m-4 border border-slate-200 dark:border-slate-700 shadow-sm;
}
/* ===== RESPONSIVE NAVIGATION ===== */
/* Professional Navigation Bar */
.navbar {
@apply bg-white/90 dark:bg-slate-900/90 backdrop-blur-md border-b border-slate-200 dark:border-slate-700 sticky top-0 z-50 transition-all duration-300;
}
/* Desktop navigation menu */
.navbar-menu-new {
@apply flex items-center space-x-1 lg:space-x-2 xl:space-x-3;
}
/* Navigation items responsive */
.nav-item {
@apply flex items-center gap-2 lg:gap-3 px-3 lg:px-4 py-2 lg:py-3 rounded-lg text-sm lg:text-base font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-white transition-all duration-300 relative;
}
.nav-item.active {
@apply bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-semibold shadow-sm;
}
/* Mobile menu */
.mobile-menu-new {
@apply bg-white dark:bg-slate-900 border-b border-slate-200 dark:border-slate-700 backdrop-blur-md;
}
.mobile-nav-item {
@apply flex items-center gap-3 px-4 py-3 text-base font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-white transition-all duration-300 rounded-lg mx-2;
}
.mobile-nav-item.active {
@apply bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-semibold;
}
/* Brand section responsive */
.navbar-brand {
@apply flex items-center no-underline transition-all duration-300 hover:opacity-80;
}
/* ===== RESPONSIVE FORMS ===== */
.form-input {
@apply w-full rounded-xl border-2 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 px-4 py-3 text-slate-900 dark:text-white placeholder-slate-500 dark:placeholder-slate-400 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-4 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 transition-all duration-300;
@apply w-full rounded-lg sm:rounded-xl border-2 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 px-3 sm:px-4 py-2 sm:py-3 text-sm sm:text-base text-slate-900 dark:text-white placeholder-slate-500 dark:placeholder-slate-400 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-4 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 transition-all duration-300 touch-target;
}
.form-label {
@apply block text-sm font-semibold text-slate-700 dark:text-slate-300 mb-2 transition-colors duration-300;
@apply block text-xs sm:text-sm font-semibold text-slate-700 dark:text-slate-300 mb-1 sm:mb-2 transition-colors duration-300;
}
.form-group {
@apply mb-6;
@apply mb-4 sm:mb-6;
}
.form-help {
@ -38,13 +108,13 @@
@apply mt-1 text-xs text-red-600 dark:text-red-400 font-medium transition-colors duration-300;
}
/* Professionelle Buttons */
/* ===== RESPONSIVE BUTTONS ===== */
.btn-icon {
@apply inline-flex items-center justify-center rounded-xl p-3 transition-all duration-300 shadow-md hover:shadow-lg;
@apply inline-flex items-center justify-center rounded-lg sm:rounded-xl p-2 sm:p-3 transition-all duration-300 shadow-mobile sm:shadow-tablet hover:shadow-lg touch-target;
}
.btn-text {
@apply inline-flex items-center justify-center gap-2 rounded-xl px-6 py-3 text-sm font-semibold transition-all duration-300 shadow-md hover:shadow-lg;
@apply inline-flex items-center justify-center gap-2 rounded-lg sm:rounded-xl px-4 sm:px-6 py-2 sm:py-3 text-xs sm:text-sm font-semibold transition-all duration-300 shadow-mobile sm:shadow-tablet hover:shadow-lg touch-target;
}
.btn-rounded {
@ -52,16 +122,16 @@
}
.btn-sm {
@apply px-4 py-2 text-xs;
@apply px-3 sm:px-4 py-1.5 sm:py-2 text-xs;
}
.btn-lg {
@apply px-8 py-4 text-base;
@apply px-6 sm:px-8 py-3 sm:py-4 text-sm sm:text-base;
}
/* Professionelle Badges und Tags */
/* ===== RESPONSIVE BADGES ===== */
.badge {
@apply inline-flex items-center rounded-full px-3 py-1.5 text-xs font-semibold transition-all duration-300 shadow-sm;
@apply inline-flex items-center rounded-full px-2 sm:px-3 py-1 sm:py-1.5 text-xs font-semibold transition-all duration-300 shadow-sm;
}
.badge-blue {
@ -84,9 +154,9 @@
@apply bg-purple-100 text-purple-800 border border-purple-200 dark:bg-purple-900/30 dark:text-purple-300 dark:border-purple-700;
}
/* Erweiterte Status Anzeigen */
/* ===== RESPONSIVE STATUS INDICATORS ===== */
.status-dot {
@apply relative flex h-3 w-3 rounded-full shadow-sm;
@apply relative flex h-2 w-2 sm:h-3 sm:w-3 rounded-full shadow-sm;
}
.status-dot::after {
@ -113,13 +183,13 @@
@apply bg-yellow-500 dark:bg-yellow-400;
}
/* Professionelle Tabellen */
/* ===== RESPONSIVE TABLES ===== */
.table-container {
@apply w-full overflow-x-auto rounded-xl border border-slate-200 dark:border-slate-700 shadow-lg bg-white dark:bg-slate-900;
@apply w-full overflow-x-auto rounded-lg sm:rounded-xl border border-slate-200 dark:border-slate-700 shadow-mobile sm:shadow-tablet lg:shadow-desktop bg-white dark:bg-slate-900;
}
.table-styled {
@apply w-full whitespace-nowrap text-left text-sm text-slate-700 dark:text-slate-300;
@apply w-full whitespace-nowrap text-left text-xs sm:text-sm text-slate-700 dark:text-slate-300;
}
.table-styled thead {
@ -127,7 +197,7 @@
}
.table-styled th {
@apply px-6 py-4 font-semibold text-slate-900 dark:text-white transition-colors duration-300;
@apply px-3 sm:px-6 py-2 sm:py-4 font-semibold text-slate-900 dark:text-white transition-colors duration-300 text-xs sm:text-sm;
}
.table-styled tbody tr {
@ -139,12 +209,12 @@
}
.table-styled td {
@apply px-6 py-4 transition-colors duration-300;
@apply px-3 sm:px-6 py-2 sm:py-4 transition-colors duration-300 text-xs sm:text-sm;
}
/* Professionelle Alert und Toast */
/* ===== RESPONSIVE ALERTS ===== */
.alert {
@apply rounded-xl border-2 p-6 mb-4 transition-all duration-300 shadow-lg;
@apply rounded-lg sm:rounded-xl border-2 p-3 sm:p-4 md:p-6 mb-3 sm:mb-4 transition-all duration-300 shadow-mobile sm:shadow-tablet;
}
.alert-info {
@ -163,9 +233,9 @@
@apply bg-red-50 dark:bg-red-900/20 border-red-300 dark:border-red-600 text-red-900 dark:text-red-200;
}
/* Professionelle Navigation */
/* ===== RESPONSIVE NAVIGATION TABS ===== */
.nav-tab {
@apply inline-flex items-center gap-2 px-6 py-3 border-b-2 text-sm font-semibold transition-all duration-300;
@apply inline-flex items-center gap-1 sm:gap-2 px-3 sm:px-6 py-2 sm:py-3 border-b-2 text-xs sm:text-sm font-semibold transition-all duration-300;
}
.nav-tab-active {
@ -176,18 +246,9 @@
@apply border-transparent text-slate-600 dark:text-slate-400 hover:text-slate-900 dark:hover:text-slate-200 hover:border-slate-300 dark:hover:border-slate-600 hover:bg-slate-50 dark:hover:bg-slate-800 rounded-t-lg;
}
/* Professionelle Navigation Links */
.nav-link {
@apply flex items-center gap-3 px-4 py-3 rounded-xl text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-white transition-all duration-300 font-medium;
}
.nav-link.active {
@apply bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-semibold shadow-sm;
}
/* Erweiterte Printer Status */
/* ===== RESPONSIVE PRINTER STATUS ===== */
.printer-status {
@apply inline-flex items-center gap-2 px-4 py-2 rounded-full text-xs font-semibold shadow-sm border;
@apply inline-flex items-center gap-1 sm:gap-2 px-2 sm:px-4 py-1 sm:py-2 rounded-full text-xs font-semibold shadow-sm border;
}
.printer-ready {
@ -210,9 +271,9 @@
@apply bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300 border-purple-200 dark:border-purple-700;
}
/* Erweiterte Job Status */
/* ===== RESPONSIVE JOB STATUS ===== */
.job-status {
@apply inline-flex items-center gap-2 px-4 py-2 rounded-full text-xs font-semibold shadow-sm border;
@apply inline-flex items-center gap-1 sm:gap-2 px-2 sm:px-4 py-1 sm:py-2 rounded-full text-xs font-semibold shadow-sm border;
}
.job-queued {
@ -239,9 +300,9 @@
@apply bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300 border-purple-200 dark:border-purple-700;
}
/* Professionelle Buttons für beide Modi */
/* ===== RESPONSIVE BUTTONS - ENHANCED ===== */
.btn {
@apply px-6 py-3 rounded-xl transition-all duration-300 focus:outline-none focus:ring-4 shadow-lg hover:shadow-xl font-semibold;
@apply px-4 sm:px-6 py-2 sm:py-3 rounded-lg sm:rounded-xl transition-all duration-300 focus:outline-none focus:ring-4 shadow-mobile sm:shadow-tablet hover:shadow-lg font-semibold text-sm sm:text-base touch-target;
}
.btn-primary {
@ -260,312 +321,192 @@
@apply btn bg-green-600 hover:bg-green-700 text-white focus:ring-green-500/50 shadow-green-500/25;
}
/* Professionelle Mercedes-Benz Design-Komponenten */
/* ===== RESPONSIVE DARK MODE TOGGLE ===== */
.dark-mode-toggle-premium {
@apply relative inline-flex items-center justify-center w-10 h-10 sm:w-11 sm:h-11 rounded-full transition-all duration-300 focus:outline-none focus:ring-4 focus:ring-blue-500/50 touch-target;
}
/* Glassmorphism - Verbessert für beide Modi */
/* ===== RESPONSIVE MERCEDES-BENZ DESIGN COMPONENTS ===== */
/* Glassmorphism - Responsive */
.mercedes-glass {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(20px);
backdrop-filter: blur(15px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.2);
transition: all 0.3s ease;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
@apply rounded-lg sm:rounded-xl;
}
.dark .mercedes-glass {
background: rgba(15, 23, 42, 0.9);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
/* Professionelle Gradients - Strikt getrennt */
/* Responsive Gradients */
.professional-gradient {
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 25%, #cbd5e1 50%, #94a3b8 75%, #64748b 100%);
@apply rounded-lg sm:rounded-xl;
}
.dark .professional-gradient {
background: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #334155 50%, #475569 75%, #64748b 100%);
}
/* Mercedes-Pattern - Verbessert */
/* Responsive Mercedes Pattern */
.mercedes-pattern {
background-image:
radial-gradient(circle at 25% 25%, rgba(255,255,255,0.1) 1px, transparent 1px),
radial-gradient(circle at 75% 75%, rgba(255,255,255,0.1) 1px, transparent 1px);
background-size: 40px 40px;
}
@media (min-width: 640px) {
.mercedes-pattern {
background-size: 60px 60px;
background-image:
radial-gradient(circle at 25% 25%, rgba(255,255,255,0.1) 2px, transparent 2px),
radial-gradient(circle at 75% 75%, rgba(255,255,255,0.1) 2px, transparent 2px);
background-size: 60px 60px;
}
}
.dark .mercedes-pattern {
background-image:
radial-gradient(circle at 25% 25%, rgba(255,255,255,0.05) 2px, transparent 2px),
radial-gradient(circle at 75% 75%, rgba(255,255,255,0.05) 2px, transparent 2px);
background-size: 60px 60px;
radial-gradient(circle at 25% 25%, rgba(255,255,255,0.05) 1px, transparent 1px),
radial-gradient(circle at 75% 75%, rgba(255,255,255,0.05) 1px, transparent 1px);
}
/* Professionelle Schatten - Kontextabhängig */
/* Responsive Professional Shadows */
.professional-shadow {
box-shadow:
0 10px 25px -5px rgba(0, 0, 0, 0.1),
0 4px 8px rgba(0, 0, 0, 0.05),
0 0 0 1px rgba(255, 255, 255, 0.05);
}
@media (min-width: 768px) {
.professional-shadow {
box-shadow:
0 25px 50px -12px rgba(0, 0, 0, 0.15),
0 8px 16px rgba(0, 0, 0, 0.1),
0 0 0 1px rgba(255, 255, 255, 0.05);
}
}
.dark .professional-shadow {
box-shadow:
0 10px 25px -5px rgba(0, 0, 0, 0.3),
0 4px 8px rgba(0, 0, 0, 0.2),
0 0 0 1px rgba(255, 255, 255, 0.1);
}
@media (min-width: 768px) {
.dark .professional-shadow {
box-shadow:
0 25px 50px -12px rgba(0, 0, 0, 0.5),
0 8px 16px rgba(0, 0, 0, 0.3),
0 0 0 1px rgba(255, 255, 255, 0.1);
}
/* Professionelle Button Styles - Erweitert */
.professional-button {
background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.dark .professional-button {
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}
.professional-button::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
transition: left 0.5s;
}
.professional-button:hover::before {
left: 100%;
}
.professional-button:hover {
background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
transform: translateY(-2px);
box-shadow: 0 15px 35px rgba(59, 130, 246, 0.4);
}
.dark .professional-button:hover {
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
box-shadow: 0 15px 35px rgba(59, 130, 246, 0.3);
}
/* Professionelle Input Fields - Erweitert */
.input-field {
transition: all 0.3s ease;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border: 2px solid rgba(203, 213, 225, 0.8);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.dark .input-field {
background: rgba(51, 65, 85, 0.95);
border: 2px solid rgba(71, 85, 105, 0.8);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.input-field:focus {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
border-color: #3b82f6;
background: rgba(255, 255, 255, 1);
}
.dark .input-field:focus {
background: rgba(51, 65, 85, 1);
box-shadow: 0 10px 25px rgba(59, 130, 246, 0.2);
}
/* Professionelle Cards - Erweitert */
.professional-card {
border-radius: 1.5rem;
overflow: hidden;
background: rgba(255, 255, 255, 0.98);
backdrop-filter: blur(20px);
border: 1px solid rgba(203, 213, 225, 0.5);
transition: all 0.3s ease;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.dark .professional-card {
background: rgba(15, 23, 42, 0.98);
border: 1px solid rgba(71, 85, 105, 0.5);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.professional-card:hover {
transform: translateY(-4px);
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}
.dark .professional-card:hover {
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}
/* Professionelle Navigation Verbesserungen */
.nav-item {
position: relative;
transition: all 0.3s ease;
border-radius: 0.75rem;
}
.nav-item::after {
content: '';
position: absolute;
bottom: -2px;
left: 50%;
width: 0;
height: 2px;
background: linear-gradient(90deg, #3b82f6, #1d4ed8);
transition: all 0.3s ease;
transform: translateX(-50%);
}
.nav-item:hover::after,
.nav-item.active::after {
width: 100%;
}
/* Verbesserte Header-Stile */
.hero-header {
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
border: 1px solid rgba(203, 213, 225, 0.5);
}
.dark .hero-header {
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
border: 1px solid rgba(71, 85, 105, 0.5);
}
/* Verbesserte Container */
.main-container {
background: rgba(248, 250, 252, 0.8);
backdrop-filter: blur(10px);
}
.dark .main-container {
background: rgba(15, 23, 42, 0.8);
}
/* Professionelle Status Badges - Erweitert */
.status-badge {
display: inline-flex;
align-items: center;
padding: 0.5rem 0.75rem;
font-size: 0.75rem;
font-weight: 700;
border-radius: 9999px;
transition: all 0.2s ease;
border: 1px solid transparent;
text-transform: uppercase;
letter-spacing: 0.025em;
}
.status-badge:hover {
transform: scale(1.05);
}
/* Smooth Transitions für alle Elemente */
* {
transition:
background-color 0.3s ease,
border-color 0.3s ease,
color 0.3s ease,
box-shadow 0.3s ease,
transform 0.3s ease;
}
/* Interactive Hover Effects */
.interactive-hover {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.interactive-hover:hover {
transform: translateY(-2px);
}
/* Light Mode spezifische Hover-Effekte */
.interactive-hover:hover {
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.dark .interactive-hover:hover {
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}
/* Professional Loading States */
/* ===== RESPONSIVE LOADING AND SHIMMER ===== */
.loading-shimmer {
background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: shimmer 2s infinite;
animation: shimmer 1.5s infinite;
@apply rounded-lg sm:rounded-xl;
}
.dark .loading-shimmer {
background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
background-size: 200% 100%;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
/* Focus Indicators für Accessibility */
/* ===== RESPONSIVE FOCUS RINGS ===== */
.focus-ring:focus {
outline: 3px solid #3b82f6;
outline-offset: 2px;
@apply outline-none ring-4 ring-blue-500/50 dark:ring-blue-400/50;
}
.dark .focus-ring:focus {
outline: 3px solid #60a5fa;
@apply ring-blue-400/50;
}
/* Professionelle Typography */
/* ===== RESPONSIVE TITLES ===== */
.professional-title {
@apply text-lg sm:text-xl md:text-2xl lg:text-3xl xl:text-4xl font-bold text-slate-900 dark:text-white tracking-tight;
background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
background-clip: text;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 700;
letter-spacing: -0.025em;
}
.dark .professional-title {
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
background-clip: text;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
/* Responsives Design für kleine Bildschirme */
/* ===== RESPONSIVE UTILITIES ===== */
/* Touch-friendly interactive elements */
.touch-friendly {
@apply min-h-[44px] min-w-[44px] touch-target;
}
/* Responsive text sizes */
.text-responsive {
font-size: clamp(0.875rem, 2.5vw, 1.125rem);
line-height: 1.5;
}
.text-responsive-lg {
font-size: clamp(1.125rem, 3vw, 1.5rem);
line-height: 1.4;
}
.text-responsive-xl {
font-size: clamp(1.5rem, 4vw, 2.25rem);
line-height: 1.3;
}
/* ===== MOBILE-SPECIFIC OPTIMIZATIONS ===== */
@media (max-width: 768px) {
.professional-shadow {
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.professional-card {
border-radius: 1rem;
@apply rounded-lg;
}
.mercedes-glass {
backdrop-filter: blur(15px);
backdrop-filter: blur(10px);
}
/* Optimize spacing for mobile */
.card {
@apply m-1 p-3;
}
.dashboard-card {
@apply p-4;
}
}
/* Animationen für bessere UX */
/* ===== ANIMATION CLASSES - RESPONSIVE ===== */
.fade-in {
animation: fadeIn 0.5s ease-in-out;
}
.slide-up {
animation: slideUp 0.5s ease-in-out;
animation: slideUp 0.5s ease-out;
}
@keyframes fadeIn {
@ -579,26 +520,86 @@
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(30px);
opacity: 0;
}
to {
opacity: 1;
transform: translateY(0);
opacity: 1;
}
}
/* Root Variablen für konsistente Farben */
/* ===== CSS CUSTOM PROPERTIES - RESPONSIVE ===== */
:root {
--mercedes-primary: #3b82f6;
--mercedes-secondary: #64748b;
--mercedes-accent: #1d4ed8;
--shadow-light: rgba(0, 0, 0, 0.1);
--shadow-dark: rgba(0, 0, 0, 0.3);
--border-radius-mobile: 0.5rem;
--border-radius-tablet: 0.75rem;
--border-radius-desktop: 1rem;
--shadow-mobile: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
--shadow-tablet: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
--shadow-desktop: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.dark {
--shadow-light: rgba(0, 0, 0, 0.2);
--shadow-dark: rgba(0, 0, 0, 0.5);
--shadow-mobile: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
--shadow-tablet: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
--shadow-desktop: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}
/* ===== RESPONSIVE SCROLLBAR IMPROVEMENTS ===== */
/* Webkit-Browser - Responsive scrollbars */
::-webkit-scrollbar {
width: 4px;
height: 4px;
}
@media (min-width: 768px) {
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 3px;
transition: all 0.3s ease;
}
/* Nur bei Hover über scrollbaren Container sichtbar */
*:hover::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.05);
}
*:hover::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.1);
}
/* Dark Mode - noch dezenter */
.dark *:hover::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.03);
}
.dark *:hover::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.08);
}
/* ===== PRINT STYLES ===== */
@media print {
.card, .dashboard-card {
@apply shadow-none border border-gray-300;
}
.btn, .nav-item {
@apply shadow-none;
}
.dark-mode-toggle-premium {
@apply hidden;
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -8,10 +8,78 @@ module.exports = {
darkMode: 'class',
theme: {
extend: {
// Erweiterte Container-Einstellungen für bessere Responsivität
container: {
center: true,
padding: {
DEFAULT: '1rem',
sm: '1.5rem',
lg: '2rem',
xl: '3rem',
'2xl': '4rem',
},
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
'2xl': '1400px',
},
},
// Erweiterte Breakpoints für bessere Kontrolle
screens: {
'xs': '480px', // Extra small devices
'sm': '640px', // Small devices
'md': '768px', // Medium devices
'lg': '1024px', // Large devices
'xl': '1280px', // Extra large devices
'2xl': '1536px', // 2X large devices
'3xl': '1920px', // Ultra wide screens
// Custom breakpoints für spezielle Anwendungsfälle
'tablet': '768px',
'laptop': '1024px',
'desktop': '1280px',
'wide': '1536px',
// Orientierungs-spezifische Breakpoints
'landscape': {'raw': '(orientation: landscape)'},
'portrait': {'raw': '(orientation: portrait)'},
// Touch device detection
'touch': {'raw': '(hover: none) and (pointer: coarse)'},
'no-touch': {'raw': '(hover: hover) and (pointer: fine)'},
},
spacing: {
'72': '18rem',
'84': '21rem',
'96': '24rem'
'96': '24rem',
'128': '32rem',
'144': '36rem',
'160': '40rem',
// Responsive spacing utilities
'safe-top': 'env(safe-area-inset-top)',
'safe-bottom': 'env(safe-area-inset-bottom)',
'safe-left': 'env(safe-area-inset-left)',
'safe-right': 'env(safe-area-inset-right)',
},
fontSize: {
// Responsive font sizes
'xs': ['0.75rem', { lineHeight: '1rem' }],
'sm': ['0.875rem', { lineHeight: '1.25rem' }],
'base': ['1rem', { lineHeight: '1.5rem' }],
'lg': ['1.125rem', { lineHeight: '1.75rem' }],
'xl': ['1.25rem', { lineHeight: '1.75rem' }],
'2xl': ['1.5rem', { lineHeight: '2rem' }],
'3xl': ['1.875rem', { lineHeight: '2.25rem' }],
'4xl': ['2.25rem', { lineHeight: '2.5rem' }],
'5xl': ['3rem', { lineHeight: '1' }],
'6xl': ['3.75rem', { lineHeight: '1' }],
'7xl': ['4.5rem', { lineHeight: '1' }],
'8xl': ['6rem', { lineHeight: '1' }],
'9xl': ['8rem', { lineHeight: '1' }],
// Mobile-optimized sizes
'mobile-xs': ['0.675rem', { lineHeight: '0.875rem' }],
'mobile-sm': ['0.8rem', { lineHeight: '1.1rem' }],
'mobile-base': ['0.925rem', { lineHeight: '1.4rem' }],
'mobile-lg': ['1.05rem', { lineHeight: '1.6rem' }],
},
colors: {
// Mercedes-Benz Corporate Colors
@ -126,8 +194,132 @@ module.exports = {
boxShadow: {
'mercedes': '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
'card-dark': '0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2)',
// Responsive shadows
'mobile': '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
'tablet': '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
'desktop': '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
},
// Responsive border radius
borderRadius: {
'none': '0',
'sm': '0.125rem',
DEFAULT: '0.25rem',
'md': '0.375rem',
'lg': '0.5rem',
'xl': '0.75rem',
'2xl': '1rem',
'3xl': '1.5rem',
'full': '9999px',
// Mobile-optimized radius
'mobile': '0.375rem',
'tablet': '0.5rem',
'desktop': '0.75rem',
},
// Animation improvements
animation: {
'fade-in': 'fadeIn 0.5s ease-in-out',
'slide-up': 'slideUp 0.5s ease-out',
'slide-down': 'slideDown 0.5s ease-out',
'slide-left': 'slideLeft 0.5s ease-out',
'slide-right': 'slideRight 0.5s ease-out',
'scale-in': 'scaleIn 0.3s ease-out',
'bounce-soft': 'bounceSoft 0.6s ease-out',
'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite',
},
keyframes: {
fadeIn: {
'0%': { opacity: '0' },
'100%': { opacity: '1' },
},
slideUp: {
'0%': { transform: 'translateY(100%)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
slideDown: {
'0%': { transform: 'translateY(-100%)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
slideLeft: {
'0%': { transform: 'translateX(100%)', opacity: '0' },
'100%': { transform: 'translateX(0)', opacity: '1' },
},
slideRight: {
'0%': { transform: 'translateX(-100%)', opacity: '0' },
'100%': { transform: 'translateX(0)', opacity: '1' },
},
scaleIn: {
'0%': { transform: 'scale(0.9)', opacity: '0' },
'100%': { transform: 'scale(1)', opacity: '1' },
},
bounceSoft: {
'0%, 20%, 53%, 80%, 100%': { transform: 'translate3d(0,0,0)' },
'40%, 43%': { transform: 'translate3d(0,-15px,0)' },
'70%': { transform: 'translate3d(0,-7px,0)' },
'90%': { transform: 'translate3d(0,-2px,0)' },
},
},
// Responsive grid templates
gridTemplateColumns: {
'auto-fit-240': 'repeat(auto-fit, minmax(240px, 1fr))',
'auto-fit-280': 'repeat(auto-fit, minmax(280px, 1fr))',
'auto-fit-320': 'repeat(auto-fit, minmax(320px, 1fr))',
'auto-fill-240': 'repeat(auto-fill, minmax(240px, 1fr))',
'auto-fill-280': 'repeat(auto-fill, minmax(280px, 1fr))',
'auto-fill-320': 'repeat(auto-fill, minmax(320px, 1fr))',
},
},
},
plugins: [
// Plugin für erweiterte responsive Utilities
function({ addUtilities, theme }) {
const newUtilities = {
// Safe area utilities für mobile Geräte
'.pt-safe': {
'padding-top': 'env(safe-area-inset-top)',
},
'.pb-safe': {
'padding-bottom': 'env(safe-area-inset-bottom)',
},
'.pl-safe': {
'padding-left': 'env(safe-area-inset-left)',
},
'.pr-safe': {
'padding-right': 'env(safe-area-inset-right)',
},
'.p-safe': {
'padding-top': 'env(safe-area-inset-top)',
'padding-bottom': 'env(safe-area-inset-bottom)',
'padding-left': 'env(safe-area-inset-left)',
'padding-right': 'env(safe-area-inset-right)',
},
// Responsive text utilities
'.text-responsive': {
'font-size': 'clamp(0.875rem, 2.5vw, 1.125rem)',
'line-height': '1.5',
},
'.text-responsive-lg': {
'font-size': 'clamp(1.125rem, 3vw, 1.5rem)',
'line-height': '1.4',
},
'.text-responsive-xl': {
'font-size': 'clamp(1.5rem, 4vw, 2.25rem)',
'line-height': '1.3',
},
// Container query utilities
'.container-responsive': {
'container-type': 'inline-size',
},
// Touch-friendly targets
'.touch-target': {
'min-height': '44px',
'min-width': '44px',
},
'.touch-target-lg': {
'min-height': '48px',
'min-width': '48px',
},
}
},
},
plugins: [],
addUtilities(newUtilities, ['responsive'])
}
],
}