1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-04 05:10:05 +02:00

update dependencies

This commit is contained in:
s2
2018-10-09 09:51:34 +02:00
parent 4fcc873901
commit da4083f574
1112 changed files with 23205 additions and 21697 deletions

30
node_modules/electron-download/lib/arch.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
'use strict'
const execSync = require('child_process').execSync
module.exports = {
host: function host (quiet) {
const arch = process.arch
if (arch === 'arm') {
switch (process.config.variables.arm_version) {
case '6':
return module.exports.uname()
case '7':
return 'armv7l'
default:
if (!quiet) {
console.warn(`WARNING: Could not determine specific ARM arch. Detected ARM version: ${JSON.stringify(process.config.variables.arm_version)}`)
}
}
}
return arch
},
/**
* Returns the arch name from the `uname` utility.
*/
uname: function uname () {
return execSync('uname -m').toString().trim()
}
}

View File

@@ -5,7 +5,7 @@
const download = require('./')
const minimist = require('minimist')
let opts = minimist(process.argv.slice(2))
const opts = minimist(process.argv.slice(2))
if (opts['strict-ssl'] === false) {
opts.strictSSL = false

View File

@@ -1,5 +1,6 @@
'use strict'
const arch = require('./arch')
const debug = require('debug')('electron-download')
const envPaths = require('env-paths')
const fs = require('fs-extra')
@@ -13,7 +14,10 @@ const sumchecker = require('sumchecker')
class ElectronDownloader {
constructor (opts) {
this.opts = opts
this.opts = Object.assign({ autoDownload: true }, opts)
if (this.opts.force && !this.opts.autoDownload) {
throw new Error('force and autoDownload options are incompatible for Electron Download')
}
this.npmrc = {}
try {
@@ -24,27 +28,47 @@ class ElectronDownloader {
}
get baseUrl () {
if (this.version.indexOf('nightly') !== -1) {
return process.env.NPM_CONFIG_ELECTRON_NIGHTLY_MIRROR ||
process.env.npm_config_electron_nightly_mirror ||
process.env.npm_package_config_electron_nightly_mirror ||
process.env.ELECTRON_NIGHTLY_MIRROR ||
this.opts.nightly_mirror ||
'https://github.com/electron/nightlies/releases/download/v'
}
return process.env.NPM_CONFIG_ELECTRON_MIRROR ||
process.env.npm_config_electron_mirror ||
process.env.npm_package_config_electron_mirror ||
process.env.ELECTRON_MIRROR ||
this.opts.mirror ||
'https://github.com/electron/electron/releases/download/v'
}
get middleUrl () {
return process.env.ELECTRON_CUSTOM_DIR || this.opts.customDir || this.version
return process.env.NPM_CONFIG_ELECTRON_CUSTOM_DIR ||
process.env.npm_config_electron_custom_dir ||
process.env.npm_package_config_electron_custom_dir ||
process.env.ELECTRON_CUSTOM_DIR ||
this.opts.customDir ||
this.version
}
get urlSuffix () {
return process.env.ELECTRON_CUSTOM_FILENAME || this.opts.customFilename || this.filename
return process.env.NPM_CONFIG_ELECTRON_CUSTOM_FILENAME ||
process.env.npm_config_electron_custom_filename ||
process.env.npm_package_config_electron_custom_filename ||
process.env.ELECTRON_CUSTOM_FILENAME ||
this.opts.customFilename ||
this.filename
}
get arch () {
return this.opts.arch || os.arch()
return this.opts.arch || arch.host(this.quiet)
}
get cache () {
if (this.opts.cache) return this.opts.cache
const cacheLocation = this.opts.cache || process.env.ELECTRON_CACHE
if (cacheLocation) return cacheLocation
const oldCacheDirectory = path.join(os.homedir(), './.electron')
if (pathExists.sync(path.join(oldCacheDirectory, this.filename))) {
@@ -144,17 +168,22 @@ class ElectronDownloader {
}
get url () {
return `${this.baseUrl}${this.middleUrl}/${this.urlSuffix}`
return process.env.ELECTRON_DOWNLOAD_OVERRIDE_URL ||
`${this.baseUrl}${this.middleUrl}/${this.urlSuffix}`
}
get verifyChecksumNeeded () {
return semver.gte(this.version, '1.3.2')
return !this.opts.disableChecksumSafetyCheck && semver.gte(this.version, '1.3.2')
}
get version () {
return this.opts.version
}
get headers () {
return this.opts.headers
}
checkForCachedChecksum (cb) {
pathExists(this.cachedChecksum)
.then(exists => {
@@ -171,8 +200,10 @@ class ElectronDownloader {
if (exists && !this.force) {
debug('zip exists', this.cachedZip)
this.checkIfZipNeedsVerifying(cb)
} else {
} else if (this.opts.autoDownload) {
this.ensureCacheDir(cb)
} else {
cb(new Error(`File: "${this.cachedZip}" does not exist locally and autoDownload is false`))
}
})
}
@@ -190,7 +221,7 @@ class ElectronDownloader {
if (err) {
if (err.code !== 'EACCES') return cb(err)
// try local folder if homedir is off limits (e.g. some linuxes return '/' as homedir)
let localCache = path.resolve('./.electron')
const localCache = path.resolve('./.electron')
return fs.mkdirs(localCache, function (err) {
if (err) return cb(err)
cb(null, localCache)
@@ -207,13 +238,14 @@ class ElectronDownloader {
downloadFile (url, cacheFilename, cb, onSuccess) {
const tempFileName = `tmp-${process.pid}-${(ElectronDownloader.tmpFileCounter++).toString(16)}-${path.basename(cacheFilename)}`
debug('downloading', url, 'to', this.cache)
let nuggetOpts = {
const nuggetOpts = {
target: tempFileName,
dir: this.cache,
resume: true,
quiet: this.quiet,
strictSSL: this.strictSSL,
proxy: this.proxy
proxy: this.proxy,
headers: this.headers
}
nugget(url, nuggetOpts, (errors) => {
if (errors) {
@@ -276,11 +308,11 @@ class ElectronDownloader {
}
verifyChecksum (cb) {
let options = {}
const options = {}
if (semver.lt(this.version, '1.3.5')) {
options.defaultTextEncoding = 'binary'
}
let checker = new sumchecker.ChecksumValidator('sha256', this.cachedChecksum, options)
const checker = new sumchecker.ChecksumValidator('sha256', this.cachedChecksum, options)
checker.validate(this.cache, this.filename).then(() => {
cb(null, this.cachedZip)
}, (err) => {
@@ -295,6 +327,10 @@ class ElectronDownloader {
ElectronDownloader.tmpFileCounter = 0
module.exports = function download (opts, cb) {
let downloader = new ElectronDownloader(opts)
downloader.downloadIfNotCached(cb)
try {
const downloader = new ElectronDownloader(opts)
downloader.downloadIfNotCached(cb)
} catch (err) {
cb(err)
}
}