mirror of
https://github.com/S2-/gitlit
synced 2025-08-04 05:10:05 +02:00
update dependencies
This commit is contained in:
10
app/node_modules/electron-packager/.npmignore
generated
vendored
10
app/node_modules/electron-packager/.npmignore
generated
vendored
@@ -1,10 +0,0 @@
|
||||
*.cer
|
||||
*.csr
|
||||
*.key
|
||||
*.pem
|
||||
node_modules
|
||||
test/fixtures/basic/main-link.js
|
||||
test/work
|
||||
.DS_Store
|
||||
.nyc_output
|
||||
npm-debug.log
|
49
app/node_modules/electron-packager/NEWS.md
generated
vendored
49
app/node_modules/electron-packager/NEWS.md
generated
vendored
@@ -2,7 +2,54 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
[Unreleased]: https://github.com/electron-userland/electron-packager/compare/v12.0.2...master
|
||||
[Unreleased]: https://github.com/electron-userland/electron-packager/compare/v12.2.0...master
|
||||
|
||||
## [12.2.0] - 2018-10-02
|
||||
|
||||
[12.2.0]: https://github.com/electron-userland/electron-packager/compare/v12.1.2...v12.2.0
|
||||
|
||||
### Added
|
||||
|
||||
* darwinDarkModeSupport option to support macOS Mojave dark mode for older Electron versions (#893)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Don't handle EH/NP Helpers if they don't exist (#894)
|
||||
|
||||
## [12.1.2] - 2018-09-12
|
||||
|
||||
[12.1.2]: https://github.com/electron-userland/electron-packager/compare/v12.1.1...v12.1.2
|
||||
|
||||
### Fixed
|
||||
|
||||
* Prune user-namespaced modules (#889)
|
||||
|
||||
## [12.1.1] - 2018-08-18
|
||||
|
||||
[12.1.1]: https://github.com/electron-userland/electron-packager/compare/v12.1.0...v12.1.1
|
||||
|
||||
### Changed
|
||||
|
||||
* Host arch utilities moved to electron-download. This is not a breaking change, as the existing API
|
||||
has been kept the same.
|
||||
|
||||
### Deprecated
|
||||
|
||||
* `hostArch` and `unameArch` in `electron-packager/targets`, replaced with `host` and `uname` in
|
||||
`electron-download/lib/arch`, respectively
|
||||
|
||||
## [12.1.0] - 2018-05-18
|
||||
|
||||
[12.1.0]: https://github.com/electron-userland/electron-packager/compare/v12.0.2...v12.1.0
|
||||
|
||||
### Added
|
||||
|
||||
* `--version` shows the Packager/Node versions & host platform/arch (#841)
|
||||
|
||||
### Fixed
|
||||
|
||||
* `mips64el` arch is only available with Electron 1.8.x (#843)
|
||||
* better detection of node modules (#847)
|
||||
|
||||
## [12.0.2] - 2018-05-02
|
||||
|
||||
|
6
app/node_modules/electron-packager/cli.js
generated
vendored
6
app/node_modules/electron-packager/cli.js
generated
vendored
@@ -34,6 +34,12 @@ function printUsageAndExit (isError) {
|
||||
|
||||
if (args.help) {
|
||||
printUsageAndExit(false)
|
||||
} else if (args.version) {
|
||||
if (typeof args.version !== 'boolean') {
|
||||
console.error('--version does not take an argument. Perhaps you meant --app-version or --electron-version?\n')
|
||||
}
|
||||
console.log(common.hostInfo())
|
||||
process.exit(0)
|
||||
} else if (!args.dir) {
|
||||
printUsageAndExit(true)
|
||||
}
|
||||
|
6
app/node_modules/electron-packager/common.js
generated
vendored
6
app/node_modules/electron-packager/common.js
generated
vendored
@@ -1,5 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const metadata = require('./package.json')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const sanitize = require('sanitize-filename')
|
||||
@@ -149,6 +150,11 @@ module.exports = {
|
||||
return pathToNormalize.replace(/\\/g, '/')
|
||||
},
|
||||
|
||||
hostInfo: function hostInfo () {
|
||||
return `Electron Packager ${metadata.version}\n` +
|
||||
`Node ${process.version}\n` +
|
||||
`Host Operating system: ${process.platform} (${process.arch})`
|
||||
},
|
||||
info: info,
|
||||
warning: warning
|
||||
}
|
||||
|
8
app/node_modules/electron-packager/docs/api.md
generated
vendored
8
app/node_modules/electron-packager/docs/api.md
generated
vendored
@@ -230,6 +230,14 @@ valid versions. If omitted, it will use the version of the nearest local install
|
||||
`electron`, `electron-prebuilt-compile`, or `electron-prebuilt`, defined in `package.json` in either
|
||||
`dependencies` or `devDependencies`.
|
||||
|
||||
##### `darwinDarkModeSupport`
|
||||
|
||||
*Boolean* (default: `false`)
|
||||
|
||||
Forces support for Mojave (macOS 10.14) dark mode in your packaged app, this sets the
|
||||
`NSRequiresAquaSystemAppearance` key to `false` in your app's `Info.plist`. For more
|
||||
information see the [Apple developer documentation](https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_app).
|
||||
|
||||
##### `extraResource`
|
||||
|
||||
*String* or *Array* of *String*s
|
||||
|
5
app/node_modules/electron-packager/index.js
generated
vendored
5
app/node_modules/electron-packager/index.js
generated
vendored
@@ -8,16 +8,13 @@ const fs = require('fs-extra')
|
||||
const getMetadataFromPackageJSON = require('./infer')
|
||||
const hooks = require('./hooks')
|
||||
const ignore = require('./ignore')
|
||||
const metadata = require('./package.json')
|
||||
const nodeify = require('nodeify')
|
||||
const path = require('path')
|
||||
const pify = require('pify')
|
||||
const targets = require('./targets')
|
||||
|
||||
function debugHostInfo () {
|
||||
debug(`Electron Packager ${metadata.version}`)
|
||||
debug(`Node ${process.version}`)
|
||||
debug(`Host Operating system: ${process.platform} (${process.arch})`)
|
||||
debug(common.hostInfo())
|
||||
}
|
||||
|
||||
class Packager {
|
||||
|
2
app/node_modules/electron-packager/infer.js
generated
vendored
2
app/node_modules/electron-packager/infer.js
generated
vendored
@@ -115,7 +115,7 @@ module.exports = function getMetadataFromPackageJSON (platforms, opts, dir) {
|
||||
if (props.length === 0) return Promise.resolve()
|
||||
|
||||
// Search package.json files to infer name and version from
|
||||
return pify(getPackageInfo)(props, dir)
|
||||
return getPackageInfo(props, dir)
|
||||
.then(result => handleMetadata(opts, result))
|
||||
.catch(err => {
|
||||
if (err.missingProps) {
|
||||
|
59
app/node_modules/electron-packager/mac.js
generated
vendored
59
app/node_modules/electron-packager/mac.js
generated
vendored
@@ -31,6 +31,10 @@ class MacApp extends App {
|
||||
return this.opts.buildVersion
|
||||
}
|
||||
|
||||
get enableDarkMode () {
|
||||
return this.opts.darwinDarkModeSupport
|
||||
}
|
||||
|
||||
get protocols () {
|
||||
return this.opts.protocols.map((protocol) => {
|
||||
return {
|
||||
@@ -147,25 +151,22 @@ class MacApp extends App {
|
||||
|
||||
determinePlistFilesToUpdate () {
|
||||
const appPlistFilename = path.join(this.contentsPath, 'Info.plist')
|
||||
const helperPlistFilename = this.ehPlistFilename('Electron Helper.app')
|
||||
const helperEHPlistFilename = this.ehPlistFilename('Electron Helper EH.app')
|
||||
const helperNPPlistFilename = this.ehPlistFilename('Electron Helper NP.app')
|
||||
const loginHelperPlistFilename = this.helperPlistFilename(this.loginHelperPath)
|
||||
|
||||
const plists = [
|
||||
[appPlistFilename, 'appPlist'],
|
||||
[helperPlistFilename, 'helperPlist'],
|
||||
[helperEHPlistFilename, 'helperEHPlist'],
|
||||
[helperNPPlistFilename, 'helperNPPlist']
|
||||
[this.ehPlistFilename('Electron Helper.app'), 'helperPlist']
|
||||
]
|
||||
|
||||
return fs.pathExists(loginHelperPlistFilename)
|
||||
.then(exists => {
|
||||
if (exists) {
|
||||
plists.push([loginHelperPlistFilename, 'loginHelperPlist'])
|
||||
}
|
||||
return plists
|
||||
})
|
||||
const possiblePlists = [
|
||||
[this.ehPlistFilename('Electron Helper EH.app'), 'helperEHPlist'],
|
||||
[this.ehPlistFilename('Electron Helper NP.app'), 'helperNPPlist'],
|
||||
[this.helperPlistFilename(this.loginHelperPath), 'loginHelperPlist']
|
||||
]
|
||||
|
||||
return Promise.all(possiblePlists.map(item =>
|
||||
fs.pathExists(item[0])
|
||||
.then(exists => exists ? item : null)
|
||||
)).then(optional => plists.concat(optional.filter(item => item)))
|
||||
}
|
||||
|
||||
updatePlistFiles () {
|
||||
@@ -182,8 +183,12 @@ class MacApp extends App {
|
||||
.then(() => {
|
||||
this.appPlist = this.updatePlist(this.appPlist, this.executableName, appBundleIdentifier, this.appName)
|
||||
this.helperPlist = this.updateHelperPlist(this.helperPlist)
|
||||
this.helperEHPlist = this.updateHelperPlist(this.helperEHPlist, 'EH')
|
||||
this.helperNPPlist = this.updateHelperPlist(this.helperNPPlist, 'NP')
|
||||
if (this.helperEHPlist) {
|
||||
this.helperEHPlist = this.updateHelperPlist(this.helperEHPlist, 'EH')
|
||||
}
|
||||
if (this.helperNPPlist) {
|
||||
this.helperNPPlist = this.updateHelperPlist(this.helperNPPlist, 'NP')
|
||||
}
|
||||
|
||||
if (this.loginHelperPlist) {
|
||||
const loginHelperName = common.sanitizeAppName(`${this.appName} Login Helper`)
|
||||
@@ -212,6 +217,10 @@ class MacApp extends App {
|
||||
this.appPlist.NSHumanReadableCopyright = this.appCopyright
|
||||
}
|
||||
|
||||
if (this.enableDarkMode) {
|
||||
this.appPlist.NSRequiresAquaSystemAppearance = false
|
||||
}
|
||||
|
||||
return Promise.all(plists.map(plistArgs => {
|
||||
const filename = plistArgs[0]
|
||||
const varName = plistArgs[1]
|
||||
@@ -229,10 +238,24 @@ class MacApp extends App {
|
||||
|
||||
moveHelper (helperDirectory, suffix) {
|
||||
const originalBasename = `Electron${suffix}`
|
||||
const newBasename = `${common.sanitizeAppName(this.appName)}${suffix}`
|
||||
|
||||
return fs.pathExists(path.join(helperDirectory, `${originalBasename}.app`))
|
||||
.then(exists => {
|
||||
if (exists) {
|
||||
return this.renameHelperAndExecutable(
|
||||
helperDirectory,
|
||||
originalBasename,
|
||||
`${common.sanitizeAppName(this.appName)}${suffix}`
|
||||
)
|
||||
} else {
|
||||
return Promise.resolve()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
renameHelperAndExecutable (helperDirectory, originalBasename, newBasename) {
|
||||
const originalAppname = `${originalBasename}.app`
|
||||
const executableBasePath = path.join(helperDirectory, originalAppname, 'Contents', 'MacOS')
|
||||
|
||||
return this.relativeRename(executableBasePath, originalBasename, newBasename)
|
||||
.then(() => this.relativeRename(helperDirectory, originalAppname, `${newBasename}.app`))
|
||||
}
|
||||
|
16
app/node_modules/electron-packager/node_modules/.bin/electron-download
generated
vendored
16
app/node_modules/electron-packager/node_modules/.bin/electron-download
generated
vendored
@@ -1 +1,15 @@
|
||||
../electron-download/lib/cli.js
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../electron-download/lib/cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../electron-download/lib/cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
|
7
app/node_modules/electron-packager/node_modules/.bin/electron-download.cmd
generated
vendored
Normal file
7
app/node_modules/electron-packager/node_modules/.bin/electron-download.cmd
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\electron-download\lib\cli.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\electron-download\lib\cli.js" %*
|
||||
)
|
1
app/node_modules/electron-packager/node_modules/debug/.coveralls.yml
generated
vendored
1
app/node_modules/electron-packager/node_modules/debug/.coveralls.yml
generated
vendored
@@ -1 +0,0 @@
|
||||
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
14
app/node_modules/electron-packager/node_modules/debug/.eslintrc
generated
vendored
14
app/node_modules/electron-packager/node_modules/debug/.eslintrc
generated
vendored
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"chrome": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"no-empty": [1, { "allowEmptyCatch": true }]
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
9
app/node_modules/electron-packager/node_modules/debug/.npmignore
generated
vendored
9
app/node_modules/electron-packager/node_modules/debug/.npmignore
generated
vendored
@@ -1,9 +0,0 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
||||
yarn.lock
|
||||
coverage
|
||||
bower.json
|
20
app/node_modules/electron-packager/node_modules/debug/.travis.yml
generated
vendored
20
app/node_modules/electron-packager/node_modules/debug/.travis.yml
generated
vendored
@@ -1,20 +0,0 @@
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "4"
|
||||
- "6"
|
||||
- "8"
|
||||
|
||||
install:
|
||||
- make install
|
||||
|
||||
script:
|
||||
- make lint
|
||||
- make test
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- node_js: '8'
|
||||
env: BROWSER=1
|
58
app/node_modules/electron-packager/node_modules/debug/Makefile
generated
vendored
58
app/node_modules/electron-packager/node_modules/debug/Makefile
generated
vendored
@@ -1,58 +0,0 @@
|
||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
# BIN directory
|
||||
BIN := $(THIS_DIR)/node_modules/.bin
|
||||
|
||||
# Path
|
||||
PATH := node_modules/.bin:$(PATH)
|
||||
SHELL := /bin/bash
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
YARN ?= $(shell which yarn)
|
||||
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
install: node_modules
|
||||
|
||||
browser: dist/debug.js
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(PKG) install
|
||||
@touch node_modules
|
||||
|
||||
dist/debug.js: src/*.js node_modules
|
||||
@mkdir -p dist
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > dist/debug.js
|
||||
|
||||
lint:
|
||||
@eslint *.js src/*.js
|
||||
|
||||
test-node:
|
||||
@istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
||||
@cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||
|
||||
test-browser:
|
||||
@$(MAKE) browser
|
||||
@karma start --single-run
|
||||
|
||||
test-all:
|
||||
@concurrently \
|
||||
"make test-node" \
|
||||
"make test-browser"
|
||||
|
||||
test:
|
||||
@if [ "x$(BROWSER)" = "x" ]; then \
|
||||
$(MAKE) test-node; \
|
||||
else \
|
||||
$(MAKE) test-browser; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
rimraf dist coverage
|
||||
|
||||
.PHONY: browser install clean lint test test-all test-node test-browser
|
73
app/node_modules/electron-packager/node_modules/debug/README.md
generated
vendored
73
app/node_modules/electron-packager/node_modules/debug/README.md
generated
vendored
@@ -70,7 +70,9 @@ Here are some examples:
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
|
||||
|
||||
#### Windows note
|
||||
#### Windows command prompt notes
|
||||
|
||||
##### CMD
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
@@ -78,14 +80,32 @@ On Windows the environment variable is set using the `set` command.
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Note that PowerShell uses different syntax to set environment variables.
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
set DEBUG=* & node app.js
|
||||
```
|
||||
|
||||
##### PowerShell (VS Code default)
|
||||
|
||||
PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
$env:DEBUG='app';node app.js
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
npm script example:
|
||||
```js
|
||||
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
|
||||
```
|
||||
|
||||
## Namespace Colors
|
||||
|
||||
@@ -248,6 +268,55 @@ error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
## Extend
|
||||
You can simply extend debugger
|
||||
```js
|
||||
const log = require('debug')('auth');
|
||||
|
||||
//creates new debug instance with extended namespace
|
||||
const logSign = log.extend('sign');
|
||||
const logLogin = log.extend('login');
|
||||
|
||||
log('hello'); // auth hello
|
||||
logSign('hello'); //auth:sign hello
|
||||
logLogin('hello'); //auth:login hello
|
||||
```
|
||||
|
||||
## Set dynamically
|
||||
|
||||
You can also enable debug dynamically by calling the `enable()` method :
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
|
||||
console.log(1, debug.enabled('test'));
|
||||
|
||||
debug.enable('test');
|
||||
console.log(2, debug.enabled('test'));
|
||||
|
||||
debug.disable();
|
||||
console.log(3, debug.enabled('test'));
|
||||
|
||||
```
|
||||
|
||||
print :
|
||||
```
|
||||
1 false
|
||||
2 true
|
||||
3 false
|
||||
```
|
||||
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
`namespaces` can include modes separated by a colon and wildcards.
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
```
|
||||
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
|
||||
=> false
|
||||
```
|
||||
|
||||
## Checking whether a debug target is enabled
|
||||
|
||||
After you've created a debug instance, you can determine whether or not it is
|
||||
|
70
app/node_modules/electron-packager/node_modules/debug/karma.conf.js
generated
vendored
70
app/node_modules/electron-packager/node_modules/debug/karma.conf.js
generated
vendored
@@ -1,70 +0,0 @@
|
||||
// Karma configuration
|
||||
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['mocha', 'chai', 'sinon'],
|
||||
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'dist/debug.js',
|
||||
'test/*spec.js'
|
||||
],
|
||||
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
'src/node.js'
|
||||
],
|
||||
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: false,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity
|
||||
})
|
||||
}
|
59
app/node_modules/electron-packager/node_modules/debug/package.json
generated
vendored
59
app/node_modules/electron-packager/node_modules/debug/package.json
generated
vendored
@@ -1,33 +1,28 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"debug@3.1.0",
|
||||
"/home/s2/Documents/Code/gitlit/app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "debug@3.1.0",
|
||||
"_id": "debug@3.1.0",
|
||||
"_from": "debug@^3.0.0",
|
||||
"_id": "debug@3.2.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||
"_integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==",
|
||||
"_location": "/electron-packager/debug",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "debug@3.1.0",
|
||||
"raw": "debug@^3.0.0",
|
||||
"name": "debug",
|
||||
"escapedName": "debug",
|
||||
"rawSpec": "3.1.0",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.1.0"
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron-packager"
|
||||
"/electron-packager",
|
||||
"/electron-packager/electron-download"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||
"_spec": "3.1.0",
|
||||
"_where": "/home/s2/Documents/Code/gitlit/app",
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz",
|
||||
"_shasum": "c2418fbfd7a29f4d4f70ff4cea604d4b64c46407",
|
||||
"_spec": "debug@^3.0.0",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app\\node_modules\\electron-packager",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
@@ -36,6 +31,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
@@ -48,27 +44,35 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
"ms": "^2.1.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "small debugging utility",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"browserify": "14.4.0",
|
||||
"chai": "^3.5.0",
|
||||
"concurrently": "^3.1.0",
|
||||
"coveralls": "^2.11.15",
|
||||
"eslint": "^3.12.1",
|
||||
"coveralls": "^3.0.2",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^1.3.0",
|
||||
"karma": "^3.0.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sinon": "^1.0.5",
|
||||
"mocha": "^3.2.0",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"sinon": "^1.17.6",
|
||||
"sinon-chai": "^2.8.0"
|
||||
"xo": "^0.23.0"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"node.js",
|
||||
"dist/debug.js",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/visionmedia/debug#readme",
|
||||
"keywords": [
|
||||
"debug",
|
||||
@@ -82,5 +86,6 @@
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"version": "3.1.0"
|
||||
"unpkg": "./dist/debug.js",
|
||||
"version": "3.2.5"
|
||||
}
|
||||
|
171
app/node_modules/electron-packager/node_modules/debug/src/browser.js
generated
vendored
171
app/node_modules/electron-packager/node_modules/debug/src/browser.js
generated
vendored
@@ -1,38 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = 'undefined' != typeof chrome
|
||||
&& 'undefined' != typeof chrome.storage
|
||||
? chrome.storage.local
|
||||
: localstorage();
|
||||
|
||||
exports.storage = localstorage();
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
|
||||
'#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
|
||||
'#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
|
||||
'#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
|
||||
'#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
|
||||
'#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
|
||||
'#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
|
||||
'#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
|
||||
'#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
|
||||
'#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
|
||||
'#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
|
||||
];
|
||||
|
||||
exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
@@ -40,84 +25,65 @@ exports.colors = [
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
// eslint-disable-next-line complexity
|
||||
|
||||
function useColors() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
||||
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
||||
return true;
|
||||
}
|
||||
} // Internet Explorer and Edge do not support colors.
|
||||
|
||||
|
||||
// Internet Explorer and Edge do not support colors.
|
||||
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
} // Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||
// double check webkit in userAgent just in case we are in a worker
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||
|
||||
|
||||
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
||||
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
||||
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (err) {
|
||||
return '[UnexpectedJSONParseError]: ' + err.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function formatArgs(args) {
|
||||
var useColors = this.useColors;
|
||||
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return;
|
||||
if (!this.useColors) {
|
||||
return;
|
||||
}
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit')
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
args[0].replace(/%[a-zA-Z%]/g, function (match) {
|
||||
if (match === '%%') {
|
||||
return;
|
||||
}
|
||||
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
|
||||
if (match === '%c') {
|
||||
// We only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
@@ -125,14 +91,14 @@ function formatArgs(args) {
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// this hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return 'object' === typeof console
|
||||
&& console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
function log() {
|
||||
var _console;
|
||||
|
||||
// This hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
|
||||
}
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
@@ -140,16 +106,18 @@ function log() {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
exports.storage.removeItem('debug');
|
||||
if (namespaces) {
|
||||
exports.storage.setItem('debug', namespaces);
|
||||
} else {
|
||||
exports.storage.debug = namespaces;
|
||||
exports.storage.removeItem('debug');
|
||||
}
|
||||
} catch(e) {}
|
||||
} catch (error) {// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
@@ -157,26 +125,23 @@ function save(namespaces) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
r = exports.storage.debug;
|
||||
} catch(e) {}
|
||||
|
||||
try {
|
||||
r = exports.storage.getItem('debug');
|
||||
} catch (error) {} // Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
|
||||
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
@@ -188,8 +153,28 @@ exports.enable(load());
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function localstorage() {
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (e) {}
|
||||
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
||||
// The Browser also has localStorage in the global context.
|
||||
return localStorage;
|
||||
} catch (error) {// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
var formatters = module.exports.formatters;
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
formatters.j = function (v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (error) {
|
||||
return '[UnexpectedJSONParseError]: ' + error.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
249
app/node_modules/electron-packager/node_modules/debug/src/common.js
generated
vendored
Normal file
249
app/node_modules/electron-packager/node_modules/debug/src/common.js
generated
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*/
|
||||
function setup(env) {
|
||||
createDebug.debug = createDebug;
|
||||
createDebug.default = createDebug;
|
||||
createDebug.coerce = coerce;
|
||||
createDebug.disable = disable;
|
||||
createDebug.enable = enable;
|
||||
createDebug.enabled = enabled;
|
||||
createDebug.humanize = require('ms');
|
||||
Object.keys(env).forEach(function (key) {
|
||||
createDebug[key] = env[key];
|
||||
});
|
||||
/**
|
||||
* Active `debug` instances.
|
||||
*/
|
||||
|
||||
createDebug.instances = [];
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
|
||||
createDebug.formatters = {};
|
||||
/**
|
||||
* Selects a color for a debug namespace
|
||||
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
||||
* @return {Number|String} An ANSI color code for the given namespace
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor(namespace) {
|
||||
var hash = 0;
|
||||
|
||||
for (var i = 0; i < namespace.length; i++) {
|
||||
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
||||
}
|
||||
|
||||
createDebug.selectColor = selectColor;
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function createDebug(namespace) {
|
||||
var prevTime;
|
||||
|
||||
function debug() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
// Disabled?
|
||||
if (!debug.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = debug; // Set `diff` timestamp
|
||||
|
||||
var curr = Number(new Date());
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
args[0] = createDebug.coerce(args[0]);
|
||||
|
||||
if (typeof args[0] !== 'string') {
|
||||
// Anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
} // Apply any `formatters` transformations
|
||||
|
||||
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
|
||||
// If we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') {
|
||||
return match;
|
||||
}
|
||||
|
||||
index++;
|
||||
var formatter = createDebug.formatters[format];
|
||||
|
||||
if (typeof formatter === 'function') {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
|
||||
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
|
||||
return match;
|
||||
}); // Apply env-specific formatting (colors, etc.)
|
||||
|
||||
createDebug.formatArgs.call(self, args);
|
||||
var logFn = self.log || createDebug.log;
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.enabled = createDebug.enabled(namespace);
|
||||
debug.useColors = createDebug.useColors();
|
||||
debug.color = selectColor(namespace);
|
||||
debug.destroy = destroy;
|
||||
debug.extend = extend; // Debug.formatArgs = formatArgs;
|
||||
// debug.rawLog = rawLog;
|
||||
// env-specific initialization logic for debug instances
|
||||
|
||||
if (typeof createDebug.init === 'function') {
|
||||
createDebug.init(debug);
|
||||
}
|
||||
|
||||
createDebug.instances.push(debug);
|
||||
return debug;
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
var index = createDebug.instances.indexOf(this);
|
||||
|
||||
if (index !== -1) {
|
||||
createDebug.instances.splice(index, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function extend(namespace, delimiter) {
|
||||
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
}
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function enable(namespaces) {
|
||||
createDebug.save(namespaces);
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
var i;
|
||||
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!split[i]) {
|
||||
// ignore empty strings
|
||||
continue;
|
||||
}
|
||||
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
|
||||
if (namespaces[0] === '-') {
|
||||
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < createDebug.instances.length; i++) {
|
||||
var instance = createDebug.instances[i];
|
||||
instance.enabled = createDebug.enabled(instance.namespace);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function disable() {
|
||||
createDebug.enable('');
|
||||
}
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function enabled(name) {
|
||||
if (name[name.length - 1] === '*') {
|
||||
return true;
|
||||
}
|
||||
|
||||
var i;
|
||||
var len;
|
||||
|
||||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
||||
if (createDebug.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
||||
if (createDebug.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) {
|
||||
return val.stack || val.message;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
createDebug.enable(createDebug.load());
|
||||
return createDebug;
|
||||
}
|
||||
|
||||
module.exports = setup;
|
||||
|
225
app/node_modules/electron-packager/node_modules/debug/src/debug.js
generated
vendored
225
app/node_modules/electron-packager/node_modules/debug/src/debug.js
generated
vendored
@@ -1,225 +0,0 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
||||
exports.coerce = coerce;
|
||||
exports.disable = disable;
|
||||
exports.enable = enable;
|
||||
exports.enabled = enabled;
|
||||
exports.humanize = require('ms');
|
||||
|
||||
/**
|
||||
* Active `debug` instances.
|
||||
*/
|
||||
exports.instances = [];
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
* @param {String} namespace
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor(namespace) {
|
||||
var hash = 0, i;
|
||||
|
||||
for (i in namespace) {
|
||||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return exports.colors[Math.abs(hash) % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function createDebug(namespace) {
|
||||
|
||||
var prevTime;
|
||||
|
||||
function debug() {
|
||||
// disabled?
|
||||
if (!debug.enabled) return;
|
||||
|
||||
var self = debug;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// turn the `arguments` into a proper Array
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
||||
// if we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') return match;
|
||||
index++;
|
||||
var formatter = exports.formatters[format];
|
||||
if ('function' === typeof formatter) {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
// apply env-specific formatting (colors, etc.)
|
||||
exports.formatArgs.call(self, args);
|
||||
|
||||
var logFn = debug.log || exports.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.enabled = exports.enabled(namespace);
|
||||
debug.useColors = exports.useColors();
|
||||
debug.color = selectColor(namespace);
|
||||
debug.destroy = destroy;
|
||||
|
||||
// env-specific initialization logic for debug instances
|
||||
if ('function' === typeof exports.init) {
|
||||
exports.init(debug);
|
||||
}
|
||||
|
||||
exports.instances.push(debug);
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
function destroy () {
|
||||
var index = exports.instances.indexOf(this);
|
||||
if (index !== -1) {
|
||||
exports.instances.splice(index, 1);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enable(namespaces) {
|
||||
exports.save(namespaces);
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
var i;
|
||||
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < exports.instances.length; i++) {
|
||||
var instance = exports.instances[i];
|
||||
instance.enabled = exports.enabled(instance.namespace);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function disable() {
|
||||
exports.enable('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enabled(name) {
|
||||
if (name[name.length - 1] === '*') {
|
||||
return true;
|
||||
}
|
||||
var i, len;
|
||||
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||
if (exports.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||
if (exports.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) return val.stack || val.message;
|
||||
return val;
|
||||
}
|
8
app/node_modules/electron-packager/node_modules/debug/src/index.js
generated
vendored
8
app/node_modules/electron-packager/node_modules/debug/src/index.js
generated
vendored
@@ -1,10 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Detect Electron renderer process, which is node, but we should
|
||||
* Detect Electron renderer / nwjs process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process === 'undefined' || process.type === 'renderer') {
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
||||
|
||||
|
134
app/node_modules/electron-packager/node_modules/debug/src/node.js
generated
vendored
134
app/node_modules/electron-packager/node_modules/debug/src/node.js
generated
vendored
@@ -1,44 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var util = require('util');
|
||||
|
||||
var util = require('util');
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
|
||||
exports.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [ 6, 2, 3, 4, 5, 1 ];
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
try {
|
||||
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
var supportsColor = require('supports-color');
|
||||
if (supportsColor && supportsColor.level >= 2) {
|
||||
exports.colors = [
|
||||
20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68,
|
||||
69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134,
|
||||
135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
|
||||
172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204,
|
||||
205, 206, 207, 208, 209, 214, 215, 220, 221
|
||||
];
|
||||
|
||||
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
||||
exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
|
||||
}
|
||||
} catch (err) {
|
||||
// swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||||
}
|
||||
} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
@@ -46,74 +39,54 @@ try {
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce(function (obj, key) {
|
||||
// camel-case
|
||||
var prop = key
|
||||
.substring(6)
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
||||
// Camel-case
|
||||
var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
|
||||
return k.toUpperCase();
|
||||
}); // Coerce string value into JS value
|
||||
|
||||
// coerce string value into JS value
|
||||
var val = process.env[key];
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
||||
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
||||
else if (val === 'null') val = null;
|
||||
else val = Number(val);
|
||||
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
||||
val = true;
|
||||
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
||||
val = false;
|
||||
} else if (val === 'null') {
|
||||
val = null;
|
||||
} else {
|
||||
val = Number(val);
|
||||
}
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts
|
||||
? Boolean(exports.inspectOpts.colors)
|
||||
: tty.isatty(process.stderr.fd);
|
||||
return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
exports.formatters.o = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.split('\n').map(function(str) {
|
||||
return str.trim()
|
||||
}).join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
exports.formatters.O = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function formatArgs(args) {
|
||||
var name = this.namespace;
|
||||
var useColors = this.useColors;
|
||||
var name = this.namespace,
|
||||
useColors = this.useColors;
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c);
|
||||
var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m';
|
||||
|
||||
var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
|
||||
var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
||||
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
|
||||
} else {
|
||||
args[0] = getDate() + name + ' ' + args[0];
|
||||
}
|
||||
@@ -122,19 +95,18 @@ function formatArgs(args) {
|
||||
function getDate() {
|
||||
if (exports.inspectOpts.hideDate) {
|
||||
return '';
|
||||
} else {
|
||||
return new Date().toISOString() + ' ';
|
||||
}
|
||||
}
|
||||
|
||||
return new Date().toISOString() + ' ';
|
||||
}
|
||||
/**
|
||||
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
||||
*/
|
||||
|
||||
|
||||
function log() {
|
||||
return process.stderr.write(util.format.apply(util, arguments) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
@@ -142,16 +114,16 @@ function log() {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function save(namespaces) {
|
||||
if (null == namespaces) {
|
||||
if (namespaces) {
|
||||
process.env.DEBUG = namespaces;
|
||||
} else {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
} else {
|
||||
process.env.DEBUG = namespaces;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
@@ -159,10 +131,10 @@ function save(namespaces) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
@@ -170,17 +142,33 @@ function load() {
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
function init (debug) {
|
||||
debug.inspectOpts = {};
|
||||
|
||||
function init(debug) {
|
||||
debug.inspectOpts = {};
|
||||
var keys = Object.keys(exports.inspectOpts);
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
var formatters = module.exports.formatters;
|
||||
/**
|
||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
formatters.o = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' ');
|
||||
};
|
||||
/**
|
||||
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
|
||||
formatters.O = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
||||
|
||||
|
5
app/node_modules/electron-packager/node_modules/electron-download/CODE_OF_CONDUCT.md
generated
vendored
Normal file
5
app/node_modules/electron-packager/node_modules/electron-download/CODE_OF_CONDUCT.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Code of Conduct
|
||||
|
||||
This project is a part of the Electron ecosystem. As such, all contributions to this project follow
|
||||
[Electron's code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md)
|
||||
where appropriate.
|
29
app/node_modules/electron-packager/node_modules/electron-download/LICENSE
generated
vendored
Normal file
29
app/node_modules/electron-packager/node_modules/electron-download/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2018, Electron Userland
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
app/node_modules/electron-packager/node_modules/electron-download/lib/arch.js
generated
vendored
Normal file
30
app/node_modules/electron-packager/node_modules/electron-download/lib/arch.js
generated
vendored
Normal 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()
|
||||
}
|
||||
}
|
2
app/node_modules/electron-packager/node_modules/electron-download/lib/cli.js
generated
vendored
2
app/node_modules/electron-packager/node_modules/electron-download/lib/cli.js
generated
vendored
@@ -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
|
||||
|
66
app/node_modules/electron-packager/node_modules/electron-download/lib/index.js
generated
vendored
66
app/node_modules/electron-packager/node_modules/electron-download/lib/index.js
generated
vendored
@@ -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)
|
||||
}
|
||||
}
|
||||
|
@@ -1 +0,0 @@
|
||||
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"no-empty": [1, { "allowEmptyCatch": true }]
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
||||
yarn.lock
|
||||
coverage
|
||||
bower.json
|
@@ -1,14 +0,0 @@
|
||||
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "5"
|
||||
- "4"
|
||||
|
||||
install:
|
||||
- make node_modules
|
||||
|
||||
script:
|
||||
- make lint
|
||||
- make test
|
||||
- make coveralls
|
@@ -1,362 +0,0 @@
|
||||
|
||||
2.6.9 / 2017-09-22
|
||||
==================
|
||||
|
||||
* remove ReDoS regexp in %o formatter (#504)
|
||||
|
||||
2.6.8 / 2017-05-18
|
||||
==================
|
||||
|
||||
* Fix: Check for undefined on browser globals (#462, @marbemac)
|
||||
|
||||
2.6.7 / 2017-05-16
|
||||
==================
|
||||
|
||||
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
|
||||
* Fix: Inline extend function in node implementation (#452, @dougwilson)
|
||||
* Docs: Fix typo (#455, @msasad)
|
||||
|
||||
2.6.5 / 2017-04-27
|
||||
==================
|
||||
|
||||
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
|
||||
* Misc: clean up browser reference checks (#447, @thebigredgeek)
|
||||
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
|
||||
|
||||
|
||||
2.6.4 / 2017-04-20
|
||||
==================
|
||||
|
||||
* Fix: bug that would occure if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
|
||||
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
|
||||
* Misc: update "ms" to v0.7.3 (@tootallnate)
|
||||
|
||||
2.6.3 / 2017-03-13
|
||||
==================
|
||||
|
||||
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||
* Docs: Changelog fix (@thebigredgeek)
|
||||
|
||||
2.6.2 / 2017-03-10
|
||||
==================
|
||||
|
||||
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||
* Docs: Add Slackin invite badge (@tootallnate)
|
||||
|
||||
2.6.1 / 2017-02-10
|
||||
==================
|
||||
|
||||
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||
|
||||
2.6.0 / 2016-12-28
|
||||
==================
|
||||
|
||||
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||
|
||||
2.5.2 / 2016-12-25
|
||||
==================
|
||||
|
||||
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||
* Docs: fixed README typo (#391, @lurch)
|
||||
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||
|
||||
2.5.1 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: babel-core compatibility
|
||||
|
||||
2.5.0 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||
* Fix: webworker compatibility (@thebigredgeek)
|
||||
* Fix: output formatting issue (#388, @kribblo)
|
||||
* Fix: babel-loader compatibility (#383, @escwald)
|
||||
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||
* Test: coveralls integration (#378, @yamikuronue)
|
||||
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||
|
||||
2.4.5 / 2016-12-17
|
||||
==================
|
||||
|
||||
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||
* Fix: custom log function (#379, @hsiliev)
|
||||
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||
|
||||
2.4.4 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||
|
||||
2.4.3 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||
|
||||
2.4.2 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: browser colors (#367, @tootallnate)
|
||||
* Misc: travis ci integration (@thebigredgeek)
|
||||
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||
|
||||
2.4.1 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: typo that broke the package (#356)
|
||||
|
||||
2.4.0 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||
* Improvement: allow colors in workers (#335, @botverse)
|
||||
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||
|
||||
2.3.3 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||
|
||||
2.3.2 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||
* Fix: should check whether process exists (Tom Newby)
|
||||
|
||||
2.3.1 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||
* Improvement: Added performance optimizations (@tootallnate)
|
||||
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||
|
||||
2.3.0 / 2016-11-07
|
||||
==================
|
||||
|
||||
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||
* Misc: Updated contributors (@thebigredgeek)
|
||||
|
||||
2.2.0 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||
* README: add logging to file example (#193, @DanielOchoa)
|
||||
* README: fixed a typo (#191, @amir-s)
|
||||
* browser: expose `storage` (#190, @stephenmathieson)
|
||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||
|
||||
2.1.3 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Updated stdout/stderr example (#186)
|
||||
* Updated example/stdout.js to match debug current behaviour
|
||||
* Renamed example/stderr.js to stdout.js
|
||||
* Update Readme.md (#184)
|
||||
* replace high intensity foreground color for bold (#182, #183)
|
||||
|
||||
2.1.2 / 2015-03-01
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* update "ms" to v0.7.0
|
||||
* package: update "browserify" to v9.0.3
|
||||
* component: fix "ms.js" repo location
|
||||
* changed bower package name
|
||||
* updated documentation about using debug in a browser
|
||||
* fix: security error on safari (#167, #168, @yields)
|
||||
|
||||
2.1.1 / 2014-12-29
|
||||
==================
|
||||
|
||||
* browser: use `typeof` to check for `console` existence
|
||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||
* browser: add support for Chrome apps
|
||||
* Readme: added Windows usage remarks
|
||||
* Add `bower.json` to properly support bower install
|
||||
|
||||
2.1.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* node: implement `DEBUG_FD` env variable support
|
||||
* package: update "browserify" to v6.1.0
|
||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
@@ -1,19 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
|
@@ -1,50 +0,0 @@
|
||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
# BIN directory
|
||||
BIN := $(THIS_DIR)/node_modules/.bin
|
||||
|
||||
# Path
|
||||
PATH := node_modules/.bin:$(PATH)
|
||||
SHELL := /bin/bash
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
YARN ?= $(shell which yarn)
|
||||
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
.FORCE:
|
||||
|
||||
install: node_modules
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(PKG) install
|
||||
@touch node_modules
|
||||
|
||||
lint: .FORCE
|
||||
eslint browser.js debug.js index.js node.js
|
||||
|
||||
test-node: .FORCE
|
||||
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
||||
|
||||
test-browser: .FORCE
|
||||
mkdir -p dist
|
||||
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > dist/debug.js
|
||||
|
||||
karma start --single-run
|
||||
rimraf dist
|
||||
|
||||
test: .FORCE
|
||||
concurrently \
|
||||
"make test-node" \
|
||||
"make test-browser"
|
||||
|
||||
coveralls:
|
||||
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||
|
||||
.PHONY: all install clean distclean
|
@@ -1,312 +0,0 @@
|
||||
# debug
|
||||
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master) [](https://visionmedia-community-slackin.now.sh/) [](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
|
||||
|
||||
A tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
Example _app.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %s', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example _worker.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('worker');
|
||||
|
||||
setInterval(function(){
|
||||
debug('doing some work');
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
#### Windows note
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Note that PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||

|
||||
|
||||
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||

|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
## Browser support
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
#### Web Inspector Colors
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
Colored output looks something like:
|
||||
|
||||

|
||||
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
Example _stdout.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"repo": "visionmedia/debug",
|
||||
"description": "small debugging utility",
|
||||
"version": "2.6.9",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"main": "src/browser.js",
|
||||
"scripts": [
|
||||
"src/browser.js",
|
||||
"src/debug.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"rauchg/ms.js": "0.7.1"
|
||||
}
|
||||
}
|
@@ -1,70 +0,0 @@
|
||||
// Karma configuration
|
||||
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['mocha', 'chai', 'sinon'],
|
||||
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'dist/debug.js',
|
||||
'test/*spec.js'
|
||||
],
|
||||
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
'src/node.js'
|
||||
],
|
||||
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: false,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity
|
||||
})
|
||||
}
|
@@ -1 +0,0 @@
|
||||
module.exports = require('./src/node');
|
@@ -1,92 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"debug@2.6.9",
|
||||
"/home/s2/Documents/Code/gitlit/app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "debug@2.6.9",
|
||||
"_id": "debug@2.6.9",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"_location": "/electron-packager/electron-download/debug",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "debug@2.6.9",
|
||||
"name": "debug",
|
||||
"escapedName": "debug",
|
||||
"rawSpec": "2.6.9",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.6.9"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron-packager/electron-download"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"_spec": "2.6.9",
|
||||
"_where": "/home/s2/Documents/Code/gitlit/app",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"browser": "./src/browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"component": {
|
||||
"scripts": {
|
||||
"debug/index.js": "browser.js",
|
||||
"debug/debug.js": "debug.js"
|
||||
}
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://n8.io"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Rhyne",
|
||||
"email": "rhyneandrew@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"devDependencies": {
|
||||
"browserify": "9.0.3",
|
||||
"chai": "^3.5.0",
|
||||
"concurrently": "^3.1.0",
|
||||
"coveralls": "^2.11.15",
|
||||
"eslint": "^3.12.1",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^1.3.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sinon": "^1.0.5",
|
||||
"mocha": "^3.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"sinon": "^1.17.6",
|
||||
"sinon-chai": "^2.8.0"
|
||||
},
|
||||
"homepage": "https://github.com/visionmedia/debug#readme",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./src/index.js",
|
||||
"name": "debug",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"version": "2.6.9"
|
||||
}
|
@@ -1,185 +0,0 @@
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = 'undefined' != typeof chrome
|
||||
&& 'undefined' != typeof chrome.storage
|
||||
? chrome.storage.local
|
||||
: localstorage();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'lightseagreen',
|
||||
'forestgreen',
|
||||
'goldenrod',
|
||||
'dodgerblue',
|
||||
'darkorchid',
|
||||
'crimson'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||
// double check webkit in userAgent just in case we are in a worker
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (err) {
|
||||
return '[UnexpectedJSONParseError]: ' + err.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return;
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit')
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// this hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return 'object' === typeof console
|
||||
&& console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
exports.storage.removeItem('debug');
|
||||
} else {
|
||||
exports.storage.debug = namespaces;
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
r = exports.storage.debug;
|
||||
} catch(e) {}
|
||||
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage() {
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (e) {}
|
||||
}
|
@@ -1,202 +0,0 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
||||
exports.coerce = coerce;
|
||||
exports.disable = disable;
|
||||
exports.enable = enable;
|
||||
exports.enabled = enabled;
|
||||
exports.humanize = require('ms');
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
* @param {String} namespace
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor(namespace) {
|
||||
var hash = 0, i;
|
||||
|
||||
for (i in namespace) {
|
||||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return exports.colors[Math.abs(hash) % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function createDebug(namespace) {
|
||||
|
||||
function debug() {
|
||||
// disabled?
|
||||
if (!debug.enabled) return;
|
||||
|
||||
var self = debug;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// turn the `arguments` into a proper Array
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
||||
// if we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') return match;
|
||||
index++;
|
||||
var formatter = exports.formatters[format];
|
||||
if ('function' === typeof formatter) {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
// apply env-specific formatting (colors, etc.)
|
||||
exports.formatArgs.call(self, args);
|
||||
|
||||
var logFn = debug.log || exports.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.enabled = exports.enabled(namespace);
|
||||
debug.useColors = exports.useColors();
|
||||
debug.color = selectColor(namespace);
|
||||
|
||||
// env-specific initialization logic for debug instances
|
||||
if ('function' === typeof exports.init) {
|
||||
exports.init(debug);
|
||||
}
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enable(namespaces) {
|
||||
exports.save(namespaces);
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function disable() {
|
||||
exports.enable('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enabled(name) {
|
||||
var i, len;
|
||||
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||
if (exports.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||
if (exports.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) return val.stack || val.message;
|
||||
return val;
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Detect Electron renderer process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
module.exports = inspectorLog;
|
||||
|
||||
// black hole
|
||||
const nullStream = new (require('stream').Writable)();
|
||||
nullStream._write = () => {};
|
||||
|
||||
/**
|
||||
* Outputs a `console.log()` to the Node.js Inspector console *only*.
|
||||
*/
|
||||
function inspectorLog() {
|
||||
const stdout = console._stdout;
|
||||
console._stdout = nullStream;
|
||||
console.log.apply(console, arguments);
|
||||
console._stdout = stdout;
|
||||
}
|
@@ -1,248 +0,0 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
*
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce(function (obj, key) {
|
||||
// camel-case
|
||||
var prop = key
|
||||
.substring(6)
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
||||
|
||||
// coerce string value into JS value
|
||||
var val = process.env[key];
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
||||
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
||||
else if (val === 'null') val = null;
|
||||
else val = Number(val);
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* The file descriptor to write the `debug()` calls to.
|
||||
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
||||
*
|
||||
* $ DEBUG_FD=3 node script.js 3>debug.log
|
||||
*/
|
||||
|
||||
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
||||
|
||||
if (1 !== fd && 2 !== fd) {
|
||||
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
|
||||
}
|
||||
|
||||
var stream = 1 === fd ? process.stdout :
|
||||
2 === fd ? process.stderr :
|
||||
createWritableStdioStream(fd);
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts
|
||||
? Boolean(exports.inspectOpts.colors)
|
||||
: tty.isatty(fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
exports.formatters.o = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.split('\n').map(function(str) {
|
||||
return str.trim()
|
||||
}).join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
exports.formatters.O = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
var name = this.namespace;
|
||||
var useColors = this.useColors;
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
||||
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
||||
} else {
|
||||
args[0] = new Date().toUTCString()
|
||||
+ ' ' + name + ' ' + args[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
||||
*/
|
||||
|
||||
function log() {
|
||||
return stream.write(util.format.apply(util, arguments) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
if (null == namespaces) {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
} else {
|
||||
process.env.DEBUG = namespaces;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copied from `node/src/node.js`.
|
||||
*
|
||||
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
||||
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
||||
*/
|
||||
|
||||
function createWritableStdioStream (fd) {
|
||||
var stream;
|
||||
var tty_wrap = process.binding('tty_wrap');
|
||||
|
||||
// Note stream._type is used for test-module-load-list.js
|
||||
|
||||
switch (tty_wrap.guessHandleType(fd)) {
|
||||
case 'TTY':
|
||||
stream = new tty.WriteStream(fd);
|
||||
stream._type = 'tty';
|
||||
|
||||
// Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'FILE':
|
||||
var fs = require('fs');
|
||||
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
||||
stream._type = 'fs';
|
||||
break;
|
||||
|
||||
case 'PIPE':
|
||||
case 'TCP':
|
||||
var net = require('net');
|
||||
stream = new net.Socket({
|
||||
fd: fd,
|
||||
readable: false,
|
||||
writable: true
|
||||
});
|
||||
|
||||
// FIXME Should probably have an option in net.Socket to create a
|
||||
// stream from an existing fd which is writable only. But for now
|
||||
// we'll just add this hack and set the `readable` member to false.
|
||||
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
||||
stream.readable = false;
|
||||
stream.read = null;
|
||||
stream._type = 'pipe';
|
||||
|
||||
// FIXME Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Probably an error on in uv_guess_handle()
|
||||
throw new Error('Implement me. Unknown stream file type!');
|
||||
}
|
||||
|
||||
// For supporting legacy API we put the FD here.
|
||||
stream.fd = fd;
|
||||
|
||||
stream._isStdio = true;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
* Create a new `inspectOpts` object in case `useColors` is set
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
function init (debug) {
|
||||
debug.inspectOpts = {};
|
||||
|
||||
var keys = Object.keys(exports.inspectOpts);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
@@ -1,8 +0,0 @@
|
||||
.nyc_output/
|
||||
coverage/
|
||||
test/
|
||||
.travis.yml
|
||||
appveyor.yml
|
||||
lib/**/__tests__/
|
||||
test/readme.md
|
||||
test.js
|
@@ -1,3 +1,66 @@
|
||||
4.0.3 / 2017-12-05
|
||||
------------------
|
||||
|
||||
- Fix wrong `chmod` values in `fs.remove()` [#501](https://github.com/jprichardson/node-fs-extra/pull/501)
|
||||
- Fix `TypeError` on systems that don't have some `fs` operations like `lchown` [#520](https://github.com/jprichardson/node-fs-extra/pull/520)
|
||||
|
||||
4.0.2 / 2017-09-12
|
||||
------------------
|
||||
|
||||
- Added `EOL` option to `writeJson*` & `outputJson*` (via upgrade to jsonfile v4)
|
||||
- Added promise support to [`fs.copyFile()`](https://nodejs.org/api/fs.html#fs_fs_copyfile_src_dest_flags_callback) in Node 8.5+
|
||||
- Added `.js` extension to `main` field in `package.json` for better tooling compatibility. [#485](https://github.com/jprichardson/node-fs-extra/pull/485)
|
||||
|
||||
4.0.1 / 2017-07-31
|
||||
------------------
|
||||
|
||||
### Fixed
|
||||
|
||||
- Previously, `ensureFile()` & `ensureFileSync()` would do nothing if the path was a directory. Now, they error out for consistency with `ensureDir()`. [#465](https://github.com/jprichardson/node-fs-extra/issues/465), [#466](https://github.com/jprichardson/node-fs-extra/pull/466), [#470](https://github.com/jprichardson/node-fs-extra/issues/470)
|
||||
|
||||
4.0.0 / 2017-07-14
|
||||
------------------
|
||||
|
||||
### Changed
|
||||
|
||||
- **BREAKING:** The promisified versions of `fs.read()` & `fs.write()` now return objects. See [the docs](docs/fs-read-write.md) for details. [#436](https://github.com/jprichardson/node-fs-extra/issues/436), [#449](https://github.com/jprichardson/node-fs-extra/pull/449)
|
||||
- `fs.move()` now errors out when destination is a subdirectory of source. [#458](https://github.com/jprichardson/node-fs-extra/pull/458)
|
||||
- Applied upstream fixes from `rimraf` to `fs.remove()` & `fs.removeSync()`. [#459](https://github.com/jprichardson/node-fs-extra/pull/459)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Got `fs.outputJSONSync()` working again; it was broken due to refactoring. [#428](https://github.com/jprichardson/node-fs-extra/pull/428)
|
||||
|
||||
Also clarified the docs in a few places.
|
||||
|
||||
3.0.1 / 2017-05-04
|
||||
------------------
|
||||
|
||||
- Fix bug in `move()` & `moveSync()` when source and destination are the same, and source does not exist. [#415](https://github.com/jprichardson/node-fs-extra/pull/415)
|
||||
|
||||
3.0.0 / 2017-04-27
|
||||
------------------
|
||||
|
||||
### Added
|
||||
|
||||
- **BREAKING:** Added Promise support. All asynchronous native fs methods and fs-extra methods now return a promise if the callback is not passed. [#403](https://github.com/jprichardson/node-fs-extra/pull/403)
|
||||
- `pathExists()`, a replacement for the deprecated `fs.exists`. `pathExists` has a normal error-first callback signature. Also added `pathExistsSync`, an alias to `fs.existsSync`, for completeness. [#406](https://github.com/jprichardson/node-fs-extra/pull/406)
|
||||
|
||||
### Removed
|
||||
|
||||
- **BREAKING:** Removed support for setting the default spaces for `writeJson()`, `writeJsonSync()`, `outputJson()`, & `outputJsonSync()`. This was undocumented. [#402](https://github.com/jprichardson/node-fs-extra/pull/402)
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgraded jsonfile dependency to v3.0.0:
|
||||
- **BREAKING:** Changed behavior of `throws` option for `readJsonSync()`; now does not throw filesystem errors when `throws` is `false`.
|
||||
- **BREAKING:** `writeJson()`, `writeJsonSync()`, `outputJson()`, & `outputJsonSync()` now output minified JSON by default for consistency with `JSON.stringify()`; set the `spaces` option to `2` to override this new behavior. [#402](https://github.com/jprichardson/node-fs-extra/pull/402)
|
||||
- Use `Buffer.allocUnsafe()` instead of `new Buffer()` in environments that support it. [#394](https://github.com/jprichardson/node-fs-extra/pull/394)
|
||||
|
||||
### Fixed
|
||||
|
||||
- `removeSync()` silently failed on Windows in some cases. Now throws an `EBUSY` error. [#408](https://github.com/jprichardson/node-fs-extra/pull/408)
|
||||
|
||||
2.1.2 / 2017-03-16
|
||||
------------------
|
||||
|
||||
@@ -218,10 +281,10 @@ this package had both `fs.readJsonFile` and `fs.readJson` that were aliases to e
|
||||
|
||||
0.16.0 / 2015-01-28
|
||||
-------------------
|
||||
- bugfix `fs.move()` into itself. Closes #104
|
||||
- bugfix `fs.move()` moving directory across device. Closes #108
|
||||
- bugfix `fs.move()` into itself. Closes [#104]
|
||||
- bugfix `fs.move()` moving directory across device. Closes [#108]
|
||||
- added coveralls support
|
||||
- bugfix: nasty multiple callback `fs.copy()` bug. Closes #98
|
||||
- bugfix: nasty multiple callback `fs.copy()` bug. Closes [#98]
|
||||
- misc fs.copy code cleanups
|
||||
|
||||
0.15.0 / 2015-01-21
|
||||
@@ -258,7 +321,7 @@ see https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options f
|
||||
0.10.0 / 2014-06-29
|
||||
------------------
|
||||
* bugfix: upgaded `"jsonfile": "~1.1.0"` to `"jsonfile": "^1.2.0"`, bumped minor because of `jsonfile` dep change
|
||||
from `~` to `^`. #67
|
||||
from `~` to `^`. [#67]
|
||||
|
||||
0.9.1 / 2014-05-22
|
||||
------------------
|
||||
@@ -266,31 +329,31 @@ from `~` to `^`. #67
|
||||
|
||||
0.9.0 / 2014-05-22
|
||||
------------------
|
||||
* upgraded `ncp` from `~0.4.2` to `^0.5.1`, #58
|
||||
* upgraded `ncp` from `~0.4.2` to `^0.5.1`, [#58]
|
||||
* upgraded `rimraf` from `~2.2.6` to `^2.2.8`
|
||||
* upgraded `mkdirp` from `0.3.x` to `^0.5.0`
|
||||
* added methods `ensureFile()`, `ensureFileSync()`
|
||||
* added methods `ensureDir()`, `ensureDirSync()` #31
|
||||
* added methods `ensureDir()`, `ensureDirSync()` [#31]
|
||||
* added `move()` method. From: https://github.com/andrewrk/node-mv
|
||||
|
||||
|
||||
0.8.1 / 2013-10-24
|
||||
------------------
|
||||
* copy failed to return an error to the callback if a file doesn't exist (ulikoehler #38, #39)
|
||||
* copy failed to return an error to the callback if a file doesn't exist (ulikoehler [#38], [#39])
|
||||
|
||||
0.8.0 / 2013-10-14
|
||||
------------------
|
||||
* `filter` implemented on `copy()` and `copySync()`. (Srirangan / #36)
|
||||
* `filter` implemented on `copy()` and `copySync()`. (Srirangan / [#36])
|
||||
|
||||
0.7.1 / 2013-10-12
|
||||
------------------
|
||||
* `copySync()` implemented (Srirangan / #33)
|
||||
* updated to the latest `jsonfile` version `1.1.0` which gives `options` params for the JSON methods. Closes #32
|
||||
* `copySync()` implemented (Srirangan / [#33])
|
||||
* updated to the latest `jsonfile` version `1.1.0` which gives `options` params for the JSON methods. Closes [#32]
|
||||
|
||||
0.7.0 / 2013-10-07
|
||||
------------------
|
||||
* update readme conventions
|
||||
* `copy()` now works if destination directory does not exist. Closes #29
|
||||
* `copy()` now works if destination directory does not exist. Closes [#29]
|
||||
|
||||
0.6.4 / 2013-09-05
|
||||
------------------
|
||||
@@ -304,19 +367,19 @@ from `~` to `^`. #67
|
||||
|
||||
0.6.2 / 2013-06-28
|
||||
------------------
|
||||
* added .npmignore, #25
|
||||
* added .npmignore, [#25]
|
||||
|
||||
0.6.1 / 2013-05-14
|
||||
------------------
|
||||
* modified for `strict` mode, closes #24
|
||||
* added `outputJson()/outputJsonSync()`, closes #23
|
||||
* modified for `strict` mode, closes [#24]
|
||||
* added `outputJson()/outputJsonSync()`, closes [#23]
|
||||
|
||||
0.6.0 / 2013-03-18
|
||||
------------------
|
||||
* removed node 0.6 support
|
||||
* added node 0.10 support
|
||||
* upgraded to latest `ncp` and `rimraf`.
|
||||
* optional `graceful-fs` support. Closes #17
|
||||
* optional `graceful-fs` support. Closes [#17]
|
||||
|
||||
|
||||
0.5.0 / 2013-02-03
|
||||
@@ -354,7 +417,7 @@ from `~` to `^`. #67
|
||||
0.2.0 / 2012-09-10
|
||||
------------------
|
||||
* Rewrote module into JavaScript. (Must still rewrite tests into JavaScript)
|
||||
* Added all methods of [jsonfile][https://github.com/jprichardson/node-jsonfile]
|
||||
* Added all methods of [jsonfile](https://github.com/jprichardson/node-jsonfile)
|
||||
* Added Travis-CI.
|
||||
|
||||
0.1.3 / 2012-08-13
|
||||
@@ -451,7 +514,7 @@ from `~` to `^`. #67
|
||||
[#284]: https://github.com/jprichardson/node-fs-extra/issues/284 "outputFile method is missing a check to determine if existing item is a folder or not"
|
||||
[#283]: https://github.com/jprichardson/node-fs-extra/pull/283 "Apply filter also on directories and symlinks for copySync()"
|
||||
[#282]: https://github.com/jprichardson/node-fs-extra/pull/282 "Apply filter also on directories and symlinks for copySync()"
|
||||
[#281]: https://github.com/jprichardson/node-fs-extra/issues/281 "remove function executes "successfully" but doesn't do anything?"
|
||||
[#281]: https://github.com/jprichardson/node-fs-extra/issues/281 "remove function executes 'successfully' but doesn't do anything?"
|
||||
[#280]: https://github.com/jprichardson/node-fs-extra/pull/280 "Disable rimraf globbing"
|
||||
[#279]: https://github.com/jprichardson/node-fs-extra/issues/279 "Some code is vendored instead of included [awaiting-reply]"
|
||||
[#278]: https://github.com/jprichardson/node-fs-extra/issues/278 "copy() does not preserve file/directory ownership"
|
||||
@@ -673,7 +736,7 @@ from `~` to `^`. #67
|
||||
[#62]: https://github.com/jprichardson/node-fs-extra/issues/62 "npm install fs-extra doesn't work"
|
||||
[#61]: https://github.com/jprichardson/node-fs-extra/issues/61 "No longer supports node 0.8 due to use of `^` in package.json dependencies"
|
||||
[#60]: https://github.com/jprichardson/node-fs-extra/issues/60 "chmod & chown for mkdirs"
|
||||
[#59]: https://github.com/jprichardson/node-fs-extra/issues/59 "Consider including mkdirp and making fs-extra "--use_strict" safe [question]"
|
||||
[#59]: https://github.com/jprichardson/node-fs-extra/issues/59 "Consider including mkdirp and making fs-extra '--use_strict' safe [question]"
|
||||
[#58]: https://github.com/jprichardson/node-fs-extra/issues/58 "Stack trace not included in fs.copy error"
|
||||
[#57]: https://github.com/jprichardson/node-fs-extra/issues/57 "Possible to include wildcards in delete?"
|
||||
[#56]: https://github.com/jprichardson/node-fs-extra/issues/56 "Crash when have no access to write to destination file in copy "
|
||||
@@ -685,7 +748,7 @@ from `~` to `^`. #67
|
||||
[#50]: https://github.com/jprichardson/node-fs-extra/issues/50 "Replace mechanism in createFile"
|
||||
[#49]: https://github.com/jprichardson/node-fs-extra/pull/49 "update rimraf to v2.2.6"
|
||||
[#48]: https://github.com/jprichardson/node-fs-extra/issues/48 "fs.copy issue [bug]"
|
||||
[#47]: https://github.com/jprichardson/node-fs-extra/issues/47 "Bug in copy - callback called on readStream "close" - Fixed in ncp 0.5.0"
|
||||
[#47]: https://github.com/jprichardson/node-fs-extra/issues/47 "Bug in copy - callback called on readStream 'close' - Fixed in ncp 0.5.0"
|
||||
[#46]: https://github.com/jprichardson/node-fs-extra/pull/46 "update copyright year"
|
||||
[#45]: https://github.com/jprichardson/node-fs-extra/pull/45 "Added note about fse.outputFile() being the one that overwrites"
|
||||
[#44]: https://github.com/jprichardson/node-fs-extra/pull/44 "Proposal: Stream support"
|
||||
@@ -715,7 +778,7 @@ from `~` to `^`. #67
|
||||
[#20]: https://github.com/jprichardson/node-fs-extra/issues/20 "fs.remove yields callback before directory is really deleted"
|
||||
[#19]: https://github.com/jprichardson/node-fs-extra/issues/19 "fs.copy err is empty array"
|
||||
[#18]: https://github.com/jprichardson/node-fs-extra/pull/18 "Exposed copyFile Function"
|
||||
[#17]: https://github.com/jprichardson/node-fs-extra/issues/17 "Use `require("graceful-fs")` if found instead of `require("fs")`"
|
||||
[#17]: https://github.com/jprichardson/node-fs-extra/issues/17 "Use `require('graceful-fs')` if found instead of `require('fs')`"
|
||||
[#16]: https://github.com/jprichardson/node-fs-extra/pull/16 "Update README.md"
|
||||
[#15]: https://github.com/jprichardson/node-fs-extra/issues/15 "Implement cp -r but sync aka copySync. [enhancement]"
|
||||
[#14]: https://github.com/jprichardson/node-fs-extra/issues/14 "fs.mkdirSync is broken in 0.3.1"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Node.js: fs-extra
|
||||
=================
|
||||
|
||||
`fs-extra` adds file system methods that aren't included in the native `fs` module. It is a drop in replacement for `fs`.
|
||||
`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It should be a drop in replacement for `fs`.
|
||||
|
||||
[](https://www.npmjs.org/package/fs-extra)
|
||||
[](http://travis-ci.org/jprichardson/node-fs-extra)
|
||||
@@ -30,7 +30,7 @@ Installation
|
||||
Usage
|
||||
-----
|
||||
|
||||
`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are unmodified and attached to `fs-extra`.
|
||||
`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed.
|
||||
|
||||
You don't ever need to include the original `fs` module again:
|
||||
|
||||
@@ -60,7 +60,7 @@ const fse = require('fs-extra')
|
||||
|
||||
Sync vs Async
|
||||
-------------
|
||||
Most methods are async by default (they take a callback with an `Error` as first argument).
|
||||
Most methods are async by default. All async methods will return a promise if the callback isn't passed.
|
||||
|
||||
Sync methods on the other hand will throw if an error occurs.
|
||||
|
||||
@@ -69,14 +69,21 @@ Example:
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// Async with promises:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
||||
.then(() => console.log('success!'))
|
||||
.catch(err => console.error(err))
|
||||
|
||||
// Async with callbacks:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
|
||||
if (err) return console.error(err)
|
||||
console.log("success!")
|
||||
});
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
// Sync:
|
||||
try {
|
||||
fs.copySync('/tmp/myfile', '/tmp/mynewfile')
|
||||
console.log("success!")
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
@@ -98,6 +105,7 @@ Methods
|
||||
- [move](docs/move.md)
|
||||
- [outputFile](docs/outputFile.md)
|
||||
- [outputJson](docs/outputJson.md)
|
||||
- [pathExists](docs/pathExists.md)
|
||||
- [readJson](docs/readJson.md)
|
||||
- [remove](docs/remove.md)
|
||||
- [writeJson](docs/writeJson.md)
|
||||
@@ -114,12 +122,13 @@ Methods
|
||||
- [moveSync](docs/move-sync.md)
|
||||
- [outputFileSync](docs/outputFile-sync.md)
|
||||
- [outputJsonSync](docs/outputJson-sync.md)
|
||||
- [pathExistsSync](docs/pathExists-sync.md)
|
||||
- [readJsonSync](docs/readJson-sync.md)
|
||||
- [removeSync](docs/remove-sync.md)
|
||||
- [writeJsonSync](docs/writeJson-sync.md)
|
||||
|
||||
|
||||
**NOTE:** You can still use the native Node.js methods. They are copied over to `fs-extra`.
|
||||
**NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()` & `fs.write()`](docs/fs-read-write.md)
|
||||
|
||||
### What happened to `walk()` and `walkSync()`?
|
||||
|
||||
@@ -129,28 +138,10 @@ They were removed from `fs-extra` in v2.0.0. If you need the functionality, `wal
|
||||
Third Party
|
||||
-----------
|
||||
|
||||
### Promises
|
||||
|
||||
Use [Bluebird](https://github.com/petkaantonov/bluebird). See https://github.com/petkaantonov/bluebird/blob/master/API.md#promisification. `fs-extra` is
|
||||
explicitly listed as supported.
|
||||
|
||||
```js
|
||||
const Promise = require('bluebird')
|
||||
const fs = Promise.promisifyAll(require('fs-extra'))
|
||||
```
|
||||
|
||||
Or you can use a dedicated package:
|
||||
|
||||
- [`fs-extra-promise`](https://github.com/overlookmotel/fs-extra-promise) uses Bluebird.
|
||||
- [`fs-promise`](https://github.com/kevinbeaty/fs-promise) uses
|
||||
[Any Promise](https://github.com/kevinbeaty/any-promise) and also covers
|
||||
[`mz/fs`](https://github.com/normalize/mz/blob/master/fs.js).
|
||||
- [`fs-p`](https://github.com/grammarly/fs-p) - TypeScript-friendly promises implementation
|
||||
|
||||
|
||||
### TypeScript
|
||||
|
||||
If you like TypeScript, you can use `fs-extra` with it: https://github.com/borisyankov/DefinitelyTyped/tree/master/fs-extra
|
||||
If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra
|
||||
|
||||
|
||||
### File / Directory Watching
|
||||
|
@@ -1,9 +1,9 @@
|
||||
# copy(src, dest, [options], callback)
|
||||
# copy(src, dest, [options, callback])
|
||||
|
||||
Copy a file or directory. The directory can have contents. Like `cp -r`.
|
||||
|
||||
- `src` `<String>`
|
||||
- `dest` `<String>`
|
||||
- `dest` `<String>` Note that if `src` is a file, `dest` cannot be a directory (see [issue #323](https://github.com/jprichardson/node-fs-extra/issues/323)).
|
||||
- `options` `<Object>`
|
||||
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
|
||||
- `errorOnExist` `<boolean>`: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
|
||||
@@ -28,6 +28,15 @@ fs.copy('/tmp/mydir', '/tmp/mynewdir', err => {
|
||||
|
||||
console.log('success!')
|
||||
}) // copies directory, even if it has subdirectories or files
|
||||
|
||||
// Promise usage:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
**Using filter function**
|
||||
|
@@ -18,4 +18,13 @@ fs.emptyDir('/tmp/some/dir', err => {
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
// With promises
|
||||
fs.emptyDir('/tmp/some/dir')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# ensureDir(dir, callback)
|
||||
# ensureDir(dir, [callback])
|
||||
|
||||
Ensures that the directory exists. If the directory structure does not exist, it is created. Like `mkdir -p`.
|
||||
|
||||
@@ -17,4 +17,13 @@ fs.ensureDir(dir, err => {
|
||||
console.log(err) // => null
|
||||
// dir has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureDir(dir)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# ensureFile(file, callback)
|
||||
# ensureFile(file, [callback])
|
||||
|
||||
Ensures that the file exists. If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is **NOT MODIFIED**.
|
||||
|
||||
@@ -17,4 +17,13 @@ fs.ensureFile(file, err => {
|
||||
console.log(err) // => null
|
||||
// file has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureFile(file)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# ensureLink(srcpath, dstpath, callback)
|
||||
# ensureLink(srcpath, dstpath, [callback])
|
||||
|
||||
Ensures that the link exists. If the directory structure does not exist, it is created.
|
||||
|
||||
@@ -17,4 +17,13 @@ fs.ensureLink(srcpath, dstpath, err => {
|
||||
console.log(err) // => null
|
||||
// link has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureLink(srcpath, dstpath)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# ensureSymlink(srcpath, dstpath, [type], callback)
|
||||
# ensureSymlink(srcpath, dstpath, [type, callback])
|
||||
|
||||
Ensures that the symlink exists. If the directory structure does not exist, it is created.
|
||||
|
||||
@@ -18,4 +18,13 @@ fs.ensureSymlink(srcpath, dstpath, err => {
|
||||
console.log(err) // => null
|
||||
// symlink has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureSymlink(srcpath, dstpath)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
39
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/docs/fs-read-write.md
generated
vendored
Normal file
39
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/docs/fs-read-write.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# About `fs.read()` & `fs.write()`
|
||||
|
||||
[`fs.read()`](https://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback) & [`fs.write()`](https://nodejs.org/api/fs.html#fs_fs_write_fd_buffer_offset_length_position_callback) are different from other `fs` methods in that their callbacks are called with 3 arguments instead of the usual 2 arguments.
|
||||
|
||||
If you're using them with callbacks, they will behave as usual. However, their promise usage is a little different. `fs-extra` promisifies these methods like [`util.promisify()`](https://nodejs.org/api/util.html#util_util_promisify_original) (only available in Node 8+) does.
|
||||
|
||||
Here's the example promise usage:
|
||||
|
||||
## `fs.read()`
|
||||
|
||||
```js
|
||||
// Basic promises
|
||||
fs.read(fd, buffer, offset, length, position)
|
||||
.then(results => {
|
||||
console.log(results)
|
||||
// { bytesRead: 20, buffer: <Buffer 0f 34 5d ...> }
|
||||
})
|
||||
|
||||
// Async/await usage:
|
||||
async function example () {
|
||||
const { bytesRead, buffer } = await fs.read(fd, Buffer.alloc(length), offset, length, position)
|
||||
}
|
||||
```
|
||||
|
||||
## `fs.write()`
|
||||
|
||||
```js
|
||||
// Basic promises
|
||||
fs.write(fd, buffer, offset, length, position)
|
||||
.then(results => {
|
||||
console.log(results)
|
||||
// { bytesWritten: 20, buffer: <Buffer 0f 34 5d ...> }
|
||||
})
|
||||
|
||||
// Async/await usage:
|
||||
async function example () {
|
||||
const { bytesWritten, buffer } = await fs.write(fd, Buffer.alloc(length), offset, length, position)
|
||||
}
|
||||
```
|
@@ -1,4 +1,4 @@
|
||||
# move(src, dest, [options], callback)
|
||||
# move(src, dest, [options, callback])
|
||||
|
||||
Moves a file or directory, even across devices.
|
||||
|
||||
@@ -18,6 +18,14 @@ fs.move('/tmp/somefile', '/tmp/does/not/exist/yet/somefile', err => {
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
fs.move('/tmp/somefile', '/tmp/does/not/exist/yet/somefile')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
**Using `overwrite` option**
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# outputFile(file, data, [options], callback)
|
||||
# outputFile(file, data, [options, callback])
|
||||
|
||||
Almost the same as `writeFile` (i.e. it [overwrites](http://pages.citebite.com/v2o5n8l2f5reb)), except that if the parent directory does not exist, it's created. `file` must be a file path (a buffer or a file descriptor is not allowed). `options` are what you'd pass to [`fs.writeFile()`](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback).
|
||||
|
||||
@@ -17,7 +17,18 @@ fs.outputFile(file, 'hello!', err => {
|
||||
console.log(err) // => null
|
||||
|
||||
fs.readFile(file, 'utf8', (err, data) => {
|
||||
if (err) return console.error(err)
|
||||
console.log(data) // => hello!
|
||||
})
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.outputFile(file, 'hello!')
|
||||
.then(() => fs.readFile(file, 'utf8'))
|
||||
.then(data => {
|
||||
console.log(data) // => hello!
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
@@ -1,13 +1,16 @@
|
||||
# outputJsonSync(file, object, [options])
|
||||
|
||||
Almost the same as [`writeJsonSync`](writeJson-sync.md), except that if the directory does not exist, it's created.
|
||||
`options` are what you'd pass to [`jsonFile.writeFileSync()`](https://github.com/jprichardson/node-jsonfile#writefilesyncfilename-obj-options).
|
||||
|
||||
**Alias:** `outputJSONSync()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `object` `<Object>`
|
||||
- `options` `<Object>`
|
||||
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
|
||||
- `EOL` `<String>` Set EOL character. Default is `\n`.
|
||||
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
|
||||
- Also accepts [`fs.writeFileSync` options](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options)
|
||||
|
||||
## Example:
|
||||
|
||||
|
@@ -1,13 +1,16 @@
|
||||
# outputJson(file, object, [options], callback)
|
||||
# outputJson(file, object, [options, callback])
|
||||
|
||||
Almost the same as [`writeJson`](writeJson.md), except that if the directory does not exist, it's created.
|
||||
`options` are what you'd pass to [`jsonFile.writeFile()`](https://github.com/jprichardson/node-jsonfile#writefilefilename-options-callback).
|
||||
|
||||
**Alias:** `outputJSON()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `object` `<Object>`
|
||||
- `options` `<Object>`
|
||||
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
|
||||
- `EOL` `<String>` Set EOL character. Default is `\n`.
|
||||
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
|
||||
- Also accepts [`fs.writeFile` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
@@ -20,7 +23,18 @@ fs.outputJson(file, {name: 'JP'}, err => {
|
||||
console.log(err) // => null
|
||||
|
||||
fs.readJson(file, (err, data) => {
|
||||
if (err) return console.error(err)
|
||||
console.log(data.name) // => JP
|
||||
})
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.outputJson(file, {name: 'JP'})
|
||||
.then(() => fs.readJson(file))
|
||||
.then(data => {
|
||||
console.log(data.name) // => JP
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
3
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/docs/pathExists-sync.md
generated
vendored
Normal file
3
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/docs/pathExists-sync.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# pathExistsSync(file)
|
||||
|
||||
An alias for [`fs.existsSync()`](https://nodejs.org/api/fs.html#fs_fs_existssync_path), created for consistency with [`pathExists()`](pathExists.md).
|
22
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/docs/pathExists.md
generated
vendored
Normal file
22
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/docs/pathExists.md
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# pathExists(file[, callback])
|
||||
|
||||
Test whether or not the given path exists by checking with the file system. Like [`fs.exists`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback), but with a normal callback signature (err, exists). Uses `fs.access` under the hood.
|
||||
|
||||
- `file` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
// Promise usage:
|
||||
fs.pathExists(file)
|
||||
.then(exists => console.log(exists)) // => false
|
||||
// Callback usage:
|
||||
fs.pathExists(file, (err, exists) => {
|
||||
console.log(err) // => null
|
||||
console.log(exists) // => false
|
||||
})
|
||||
```
|
@@ -1,4 +1,4 @@
|
||||
# readJson(file, [options], callback)
|
||||
# readJson(file, [options, callback])
|
||||
|
||||
Reads a JSON file and then parses it into an object. `options` are the same
|
||||
that you'd pass to [`jsonFile.readFile`](https://github.com/jprichardson/node-jsonfile#readfilefilename-options-callback).
|
||||
@@ -16,9 +16,18 @@ const fs = require('fs-extra')
|
||||
|
||||
fs.readJson('./package.json', (err, packageObj) => {
|
||||
if (err) console.error(err)
|
||||
|
||||
|
||||
console.log(packageObj.version) // => 0.1.3
|
||||
})
|
||||
|
||||
// Promise Usage
|
||||
fs.readJson('./package.json')
|
||||
.then(packageObj => {
|
||||
console.log(packageObj.version) // => 0.1.3
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
@@ -37,4 +46,13 @@ fs.readJson(file, { throws: false }, (err, obj) => {
|
||||
|
||||
console.log(obj) // => null
|
||||
})
|
||||
|
||||
// Promise Usage
|
||||
fs.readJson(file, { throws: false })
|
||||
.then(obj => {
|
||||
console.log(obj) // => null
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err) // Not called
|
||||
})
|
||||
```
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# remove(path, callback)
|
||||
# remove(path, [callback])
|
||||
|
||||
Removes a file or directory. The directory can have contents. Like `rm -rf`.
|
||||
|
||||
@@ -22,4 +22,13 @@ fs.remove('/home/jprichardson', err => {
|
||||
|
||||
console.log('success!') // I just deleted my entire HOME directory.
|
||||
})
|
||||
|
||||
// Promise Usage
|
||||
fs.remove('/tmp/myfile')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
@@ -1,13 +1,16 @@
|
||||
# writeJsonSync(file, object, [options])
|
||||
|
||||
Writes an object to a JSON file. `options` are the same that
|
||||
you'd pass to [`jsonFile.writeFileSync()`](https://github.com/jprichardson/node-jsonfile#writefilesyncfilename-obj-options).
|
||||
Writes an object to a JSON file.
|
||||
|
||||
**Alias:** `writeJSONSync()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `object` `<Object>`
|
||||
- `options` `<Object>`
|
||||
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
|
||||
- `EOL` `<String>` Set EOL character. Default is `\n`.
|
||||
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
|
||||
- Also accepts [`fs.writeFileSync` options](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options)
|
||||
|
||||
## Example:
|
||||
|
||||
|
@@ -1,13 +1,16 @@
|
||||
# writeJson(file, object, [options], callback)
|
||||
# writeJson(file, object, [options, callback])
|
||||
|
||||
Writes an object to a JSON file. `options` are the same that
|
||||
you'd pass to [`jsonFile.writeFile()`](https://github.com/jprichardson/node-jsonfile#writefilefilename-options-callback).
|
||||
Writes an object to a JSON file.
|
||||
|
||||
**Alias:** `writeJSON()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `object` `<Object>`
|
||||
- `options` `<Object>`
|
||||
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
|
||||
- `EOL` `<String>` Set EOL character. Default is `\n`.
|
||||
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
|
||||
- Also accepts [`fs.writeFile` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
@@ -20,6 +23,15 @@ fs.writeJson('./package.json', {name: 'fs-extra'}, err => {
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
// With Promises
|
||||
fs.writeJson('./package.json', {name: 'fs-extra'})
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
@@ -3,7 +3,7 @@
|
||||
const fs = require('graceful-fs')
|
||||
|
||||
const BUF_LENGTH = 64 * 1024
|
||||
const _buff = new Buffer(BUF_LENGTH)
|
||||
const _buff = require('../util/buffer')(BUF_LENGTH)
|
||||
|
||||
function copyFileSync (srcFile, destFile, options) {
|
||||
const overwrite = options.overwrite
|
||||
|
@@ -4,6 +4,7 @@ const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const ncp = require('./ncp')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function copy (src, dest, options, callback) {
|
||||
if (typeof options === 'function' && !callback) {
|
||||
@@ -39,7 +40,8 @@ function copy (src, dest, options, callback) {
|
||||
dir = path.dirname(dest)
|
||||
}
|
||||
|
||||
fs.exists(dir, dirExists => {
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return ncp(src, dest, options, callback)
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
const u = require('universalify').fromCallback
|
||||
module.exports = {
|
||||
copy: require('./copy')
|
||||
copy: u(require('./copy'))
|
||||
}
|
||||
|
@@ -1,11 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const remove = require('../remove')
|
||||
|
||||
function emptyDir (dir, callback) {
|
||||
const emptyDir = u(function emptyDir (dir, callback) {
|
||||
callback = callback || function () {}
|
||||
fs.readdir(dir, (err, items) => {
|
||||
if (err) return mkdir.mkdirs(dir, callback)
|
||||
@@ -23,7 +24,7 @@ function emptyDir (dir, callback) {
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
function emptyDirSync (dir) {
|
||||
let items
|
||||
|
@@ -1,8 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function createFile (file, callback) {
|
||||
function makeFile () {
|
||||
@@ -12,10 +14,11 @@ function createFile (file, callback) {
|
||||
})
|
||||
}
|
||||
|
||||
fs.exists(file, fileExists => {
|
||||
if (fileExists) return callback()
|
||||
fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err
|
||||
if (!err && stats.isFile()) return callback()
|
||||
const dir = path.dirname(file)
|
||||
fs.exists(dir, dirExists => {
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return makeFile()
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
@@ -26,7 +29,11 @@ function createFile (file, callback) {
|
||||
}
|
||||
|
||||
function createFileSync (file) {
|
||||
if (fs.existsSync(file)) return
|
||||
let stats
|
||||
try {
|
||||
stats = fs.statSync(file)
|
||||
} catch (e) {}
|
||||
if (stats && stats.isFile()) return
|
||||
|
||||
const dir = path.dirname(file)
|
||||
if (!fs.existsSync(dir)) {
|
||||
@@ -37,9 +44,6 @@ function createFileSync (file) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createFile,
|
||||
createFileSync,
|
||||
// alias
|
||||
ensureFile: createFile,
|
||||
ensureFileSync: createFileSync
|
||||
createFile: u(createFile),
|
||||
createFileSync
|
||||
}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function createLink (srcpath, dstpath, callback) {
|
||||
function makeLink (srcpath, dstpath) {
|
||||
@@ -12,7 +14,8 @@ function createLink (srcpath, dstpath, callback) {
|
||||
})
|
||||
}
|
||||
|
||||
fs.exists(dstpath, destinationExists => {
|
||||
pathExists(dstpath, (err, destinationExists) => {
|
||||
if (err) return callback(err)
|
||||
if (destinationExists) return callback(null)
|
||||
fs.lstat(srcpath, (err, stat) => {
|
||||
if (err) {
|
||||
@@ -21,7 +24,8 @@ function createLink (srcpath, dstpath, callback) {
|
||||
}
|
||||
|
||||
const dir = path.dirname(dstpath)
|
||||
fs.exists(dir, dirExists => {
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return makeLink(srcpath, dstpath)
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
@@ -52,9 +56,6 @@ function createLinkSync (srcpath, dstpath, callback) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createLink,
|
||||
createLinkSync,
|
||||
// alias
|
||||
ensureLink: createLink,
|
||||
ensureLinkSync: createLinkSync
|
||||
createLink: u(createLink),
|
||||
createLinkSync
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
/**
|
||||
* Function that returns two types of paths, one relative to symlink, and one
|
||||
@@ -40,7 +41,8 @@ function symlinkPaths (srcpath, dstpath, callback) {
|
||||
} else {
|
||||
const dstdir = path.dirname(dstpath)
|
||||
const relativeToDst = path.join(dstdir, srcpath)
|
||||
return fs.exists(relativeToDst, exists => {
|
||||
return pathExists(relativeToDst, (err, exists) => {
|
||||
if (err) return callback(err)
|
||||
if (exists) {
|
||||
return callback(null, {
|
||||
'toCwd': relativeToDst,
|
||||
|
@@ -1,5 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const _mkdirs = require('../mkdirs')
|
||||
@@ -14,11 +15,14 @@ const _symlinkType = require('./symlink-type')
|
||||
const symlinkType = _symlinkType.symlinkType
|
||||
const symlinkTypeSync = _symlinkType.symlinkTypeSync
|
||||
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function createSymlink (srcpath, dstpath, type, callback) {
|
||||
callback = (typeof type === 'function') ? type : callback
|
||||
type = (typeof type === 'function') ? false : type
|
||||
|
||||
fs.exists(dstpath, destinationExists => {
|
||||
pathExists(dstpath, (err, destinationExists) => {
|
||||
if (err) return callback(err)
|
||||
if (destinationExists) return callback(null)
|
||||
symlinkPaths(srcpath, dstpath, (err, relative) => {
|
||||
if (err) return callback(err)
|
||||
@@ -26,7 +30,8 @@ function createSymlink (srcpath, dstpath, type, callback) {
|
||||
symlinkType(relative.toCwd, type, (err, type) => {
|
||||
if (err) return callback(err)
|
||||
const dir = path.dirname(dstpath)
|
||||
fs.exists(dir, dirExists => {
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)
|
||||
mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
@@ -56,9 +61,6 @@ function createSymlinkSync (srcpath, dstpath, type, callback) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createSymlink,
|
||||
createSymlinkSync,
|
||||
// alias
|
||||
ensureSymlink: createSymlink,
|
||||
ensureSymlinkSync: createSymlinkSync
|
||||
createSymlink: u(createSymlink),
|
||||
createSymlinkSync
|
||||
}
|
||||
|
107
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/lib/fs/index.js
generated
vendored
Normal file
107
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/lib/fs/index.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
// This is adapted from https://github.com/normalize/mz
|
||||
// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('graceful-fs')
|
||||
|
||||
const api = [
|
||||
'access',
|
||||
'appendFile',
|
||||
'chmod',
|
||||
'chown',
|
||||
'close',
|
||||
'copyFile',
|
||||
'fchmod',
|
||||
'fchown',
|
||||
'fdatasync',
|
||||
'fstat',
|
||||
'fsync',
|
||||
'ftruncate',
|
||||
'futimes',
|
||||
'lchown',
|
||||
'link',
|
||||
'lstat',
|
||||
'mkdir',
|
||||
'mkdtemp',
|
||||
'open',
|
||||
'readFile',
|
||||
'readdir',
|
||||
'readlink',
|
||||
'realpath',
|
||||
'rename',
|
||||
'rmdir',
|
||||
'stat',
|
||||
'symlink',
|
||||
'truncate',
|
||||
'unlink',
|
||||
'utimes',
|
||||
'writeFile'
|
||||
].filter(key => {
|
||||
// Some commands are not available on some systems. Ex:
|
||||
// fs.copyFile was added in Node.js v8.5.0
|
||||
// fs.mkdtemp was added in Node.js v5.10.0
|
||||
// fs.lchown is not available on at least some Linux
|
||||
return typeof fs[key] === 'function'
|
||||
})
|
||||
|
||||
// Export all keys:
|
||||
Object.keys(fs).forEach(key => {
|
||||
exports[key] = fs[key]
|
||||
})
|
||||
|
||||
// Universalify async methods:
|
||||
api.forEach(method => {
|
||||
exports[method] = u(fs[method])
|
||||
})
|
||||
|
||||
// We differ from mz/fs in that we still ship the old, broken, fs.exists()
|
||||
// since we are a drop-in replacement for the native module
|
||||
exports.exists = function (filename, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
return fs.exists(filename, callback)
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
return fs.exists(filename, resolve)
|
||||
})
|
||||
}
|
||||
|
||||
// fs.read() & fs.write need special treatment due to multiple callback args
|
||||
|
||||
exports.read = function (fd, buffer, offset, length, position, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
return fs.read(fd, buffer, offset, length, position, callback)
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesRead, buffer })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Function signature can be
|
||||
// fs.write(fd, buffer[, offset[, length[, position]]], callback)
|
||||
// OR
|
||||
// fs.write(fd, string[, position[, encoding]], callback)
|
||||
// so we need to handle both cases
|
||||
exports.write = function (fd, buffer, a, b, c, callback) {
|
||||
if (typeof arguments[arguments.length - 1] === 'function') {
|
||||
return fs.write(fd, buffer, a, b, c, callback)
|
||||
}
|
||||
|
||||
// Check for old, depricated fs.write(fd, string[, position[, encoding]], callback)
|
||||
if (typeof buffer === 'string') {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.write(fd, buffer, a, b, (err, bytesWritten, buffer) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesWritten, buffer })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.write(fd, buffer, a, b, c, (err, bytesWritten, buffer) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesWritten, buffer })
|
||||
})
|
||||
})
|
||||
}
|
@@ -2,16 +2,11 @@
|
||||
|
||||
const assign = require('./util/assign')
|
||||
|
||||
const fse = {}
|
||||
const gfs = require('graceful-fs')
|
||||
|
||||
// attach fs methods to fse
|
||||
Object.keys(gfs).forEach(key => {
|
||||
fse[key] = gfs[key]
|
||||
})
|
||||
|
||||
const fs = fse
|
||||
const fs = {}
|
||||
|
||||
// Export graceful-fs:
|
||||
assign(fs, require('./fs'))
|
||||
// Export extra methods:
|
||||
assign(fs, require('./copy'))
|
||||
assign(fs, require('./copy-sync'))
|
||||
assign(fs, require('./mkdirs'))
|
||||
@@ -22,16 +17,6 @@ assign(fs, require('./move-sync'))
|
||||
assign(fs, require('./empty'))
|
||||
assign(fs, require('./ensure'))
|
||||
assign(fs, require('./output'))
|
||||
assign(fs, require('./path-exists'))
|
||||
|
||||
module.exports = fs
|
||||
|
||||
// maintain backwards compatibility for awhile
|
||||
const jsonfile = {}
|
||||
Object.defineProperty(jsonfile, 'spaces', {
|
||||
get: () => fs.spaces, // found in ./json
|
||||
set: val => {
|
||||
fs.spaces = val
|
||||
}
|
||||
})
|
||||
|
||||
module.exports.jsonfile = jsonfile // so users of fs-extra can modify jsonFile.spaces
|
||||
|
@@ -1,11 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const jsonFile = require('./jsonfile')
|
||||
|
||||
jsonFile.outputJson = u(require('./output-json'))
|
||||
jsonFile.outputJsonSync = require('./output-json-sync')
|
||||
jsonFile.outputJson = require('./output-json')
|
||||
// aliases
|
||||
jsonFile.outputJSONSync = require('./output-json-sync')
|
||||
jsonFile.outputJSON = require('./output-json')
|
||||
jsonFile.outputJSON = jsonFile.outputJson
|
||||
jsonFile.outputJSONSync = jsonFile.outputJsonSync
|
||||
jsonFile.writeJSON = jsonFile.writeJson
|
||||
jsonFile.writeJSONSync = jsonFile.writeJsonSync
|
||||
jsonFile.readJSON = jsonFile.readJson
|
||||
jsonFile.readJSONSync = jsonFile.readJsonSync
|
||||
|
||||
module.exports = jsonFile
|
||||
|
@@ -1,16 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const jsonFile = require('jsonfile')
|
||||
|
||||
module.exports = {
|
||||
// jsonfile exports
|
||||
readJson: jsonFile.readFile,
|
||||
readJSON: jsonFile.readFile,
|
||||
readJson: u(jsonFile.readFile),
|
||||
readJsonSync: jsonFile.readFileSync,
|
||||
readJSONSync: jsonFile.readFileSync,
|
||||
writeJson: jsonFile.writeFile,
|
||||
writeJSON: jsonFile.writeFile,
|
||||
writeJsonSync: jsonFile.writeFileSync,
|
||||
writeJSONSync: jsonFile.writeFileSync,
|
||||
spaces: 2 // default in fs-extra
|
||||
writeJson: u(jsonFile.writeFile),
|
||||
writeJsonSync: jsonFile.writeFileSync
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
const jsonFile = require('./jsonfile')
|
||||
|
||||
function outputJson (file, data, options, callback) {
|
||||
@@ -13,7 +13,8 @@ function outputJson (file, data, options, callback) {
|
||||
|
||||
const dir = path.dirname(file)
|
||||
|
||||
fs.exists(dir, itDoes => {
|
||||
pathExists(dir, (err, itDoes) => {
|
||||
if (err) return callback(err)
|
||||
if (itDoes) return jsonFile.writeJson(file, data, options, callback)
|
||||
|
||||
mkdir.mkdirs(dir, err => {
|
||||
|
@@ -1,9 +1,14 @@
|
||||
'use strict'
|
||||
const u = require('universalify').fromCallback
|
||||
const mkdirs = u(require('./mkdirs'))
|
||||
const mkdirsSync = require('./mkdirs-sync')
|
||||
|
||||
module.exports = {
|
||||
mkdirs: require('./mkdirs'),
|
||||
mkdirsSync: require('./mkdirs-sync'),
|
||||
mkdirs: mkdirs,
|
||||
mkdirsSync: mkdirsSync,
|
||||
// alias
|
||||
mkdirp: require('./mkdirs'),
|
||||
mkdirpSync: require('./mkdirs-sync'),
|
||||
ensureDir: require('./mkdirs'),
|
||||
ensureDirSync: require('./mkdirs-sync')
|
||||
mkdirp: mkdirs,
|
||||
mkdirpSync: mkdirsSync,
|
||||
ensureDir: mkdirs,
|
||||
ensureDirSync: mkdirsSync
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ const path = require('path')
|
||||
const copySync = require('../copy-sync').copySync
|
||||
const removeSync = require('../remove').removeSync
|
||||
const mkdirpSync = require('../mkdirs').mkdirsSync
|
||||
const buffer = require('../util/buffer')
|
||||
|
||||
function moveSync (src, dest, options) {
|
||||
options = options || {}
|
||||
@@ -13,7 +14,7 @@ function moveSync (src, dest, options) {
|
||||
src = path.resolve(src)
|
||||
dest = path.resolve(dest)
|
||||
|
||||
if (src === dest) return
|
||||
if (src === dest) return fs.accessSync(src)
|
||||
|
||||
if (isSrcSubdir(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`)
|
||||
|
||||
@@ -60,7 +61,7 @@ function moveSyncAcrossDevice (src, dest, overwrite) {
|
||||
|
||||
function moveFileSyncAcrossDevice (src, dest, overwrite) {
|
||||
const BUF_LENGTH = 64 * 1024
|
||||
const _buff = new Buffer(BUF_LENGTH)
|
||||
const _buff = buffer(BUF_LENGTH)
|
||||
|
||||
const flags = overwrite ? 'w' : 'wx'
|
||||
|
||||
|
@@ -6,46 +6,42 @@
|
||||
|
||||
// this needs a cleanup
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('graceful-fs')
|
||||
const ncp = require('../copy/ncp')
|
||||
const path = require('path')
|
||||
const remove = require('../remove').remove
|
||||
const mkdirp = require('../mkdirs').mkdirs
|
||||
|
||||
function move (source, dest, options, callback) {
|
||||
function move (src, dest, options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
const shouldMkdirp = ('mkdirp' in options) ? options.mkdirp : true
|
||||
const overwrite = options.overwrite || options.clobber || false
|
||||
|
||||
if (shouldMkdirp) {
|
||||
mkdirs()
|
||||
} else {
|
||||
doRename()
|
||||
}
|
||||
|
||||
function mkdirs () {
|
||||
isSrcSubdir(src, dest, (err, itIs) => {
|
||||
if (err) return callback(err)
|
||||
if (itIs) return callback(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`))
|
||||
mkdirp(path.dirname(dest), err => {
|
||||
if (err) return callback(err)
|
||||
doRename()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
function doRename () {
|
||||
if (path.resolve(source) === path.resolve(dest)) {
|
||||
setImmediate(callback)
|
||||
if (path.resolve(src) === path.resolve(dest)) {
|
||||
fs.access(src, callback)
|
||||
} else if (overwrite) {
|
||||
fs.rename(source, dest, err => {
|
||||
fs.rename(src, dest, err => {
|
||||
if (!err) return callback()
|
||||
|
||||
if (err.code === 'ENOTEMPTY' || err.code === 'EEXIST') {
|
||||
remove(dest, err => {
|
||||
if (err) return callback(err)
|
||||
options.overwrite = false // just overwriteed it, no need to do it again
|
||||
move(source, dest, options, callback)
|
||||
move(src, dest, options, callback)
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -56,49 +52,44 @@ function move (source, dest, options, callback) {
|
||||
remove(dest, err => {
|
||||
if (err) return callback(err)
|
||||
options.overwrite = false
|
||||
move(source, dest, options, callback)
|
||||
move(src, dest, options, callback)
|
||||
})
|
||||
}, 200)
|
||||
return
|
||||
}
|
||||
|
||||
if (err.code !== 'EXDEV') return callback(err)
|
||||
moveAcrossDevice(source, dest, overwrite, callback)
|
||||
moveAcrossDevice(src, dest, overwrite, callback)
|
||||
})
|
||||
} else {
|
||||
fs.link(source, dest, err => {
|
||||
fs.link(src, dest, err => {
|
||||
if (err) {
|
||||
if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') {
|
||||
moveAcrossDevice(source, dest, overwrite, callback)
|
||||
return
|
||||
return moveAcrossDevice(src, dest, overwrite, callback)
|
||||
}
|
||||
callback(err)
|
||||
return
|
||||
return callback(err)
|
||||
}
|
||||
fs.unlink(source, callback)
|
||||
return fs.unlink(src, callback)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function moveAcrossDevice (source, dest, overwrite, callback) {
|
||||
fs.stat(source, (err, stat) => {
|
||||
if (err) {
|
||||
callback(err)
|
||||
return
|
||||
}
|
||||
function moveAcrossDevice (src, dest, overwrite, callback) {
|
||||
fs.stat(src, (err, stat) => {
|
||||
if (err) return callback(err)
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
moveDirAcrossDevice(source, dest, overwrite, callback)
|
||||
moveDirAcrossDevice(src, dest, overwrite, callback)
|
||||
} else {
|
||||
moveFileAcrossDevice(source, dest, overwrite, callback)
|
||||
moveFileAcrossDevice(src, dest, overwrite, callback)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function moveFileAcrossDevice (source, dest, overwrite, callback) {
|
||||
function moveFileAcrossDevice (src, dest, overwrite, callback) {
|
||||
const flags = overwrite ? 'w' : 'wx'
|
||||
const ins = fs.createReadStream(source)
|
||||
const ins = fs.createReadStream(src)
|
||||
const outs = fs.createWriteStream(dest, { flags })
|
||||
|
||||
ins.on('error', err => {
|
||||
@@ -112,7 +103,7 @@ function moveFileAcrossDevice (source, dest, overwrite, callback) {
|
||||
fs.unlink(dest, () => {
|
||||
// note: `err` here is from the input stream errror
|
||||
if (err.code === 'EISDIR' || err.code === 'EPERM') {
|
||||
moveDirAcrossDevice(source, dest, overwrite, callback)
|
||||
moveDirAcrossDevice(src, dest, overwrite, callback)
|
||||
} else {
|
||||
callback(err)
|
||||
}
|
||||
@@ -130,11 +121,11 @@ function moveFileAcrossDevice (source, dest, overwrite, callback) {
|
||||
ins.pipe(outs)
|
||||
|
||||
function onClose () {
|
||||
fs.unlink(source, callback)
|
||||
fs.unlink(src, callback)
|
||||
}
|
||||
}
|
||||
|
||||
function moveDirAcrossDevice (source, dest, overwrite, callback) {
|
||||
function moveDirAcrossDevice (src, dest, overwrite, callback) {
|
||||
const options = {
|
||||
overwrite: false
|
||||
}
|
||||
@@ -149,13 +140,31 @@ function moveDirAcrossDevice (source, dest, overwrite, callback) {
|
||||
}
|
||||
|
||||
function startNcp () {
|
||||
ncp(source, dest, options, err => {
|
||||
ncp(src, dest, options, err => {
|
||||
if (err) return callback(err)
|
||||
remove(source, callback)
|
||||
remove(src, callback)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
move
|
||||
// return true if dest is a subdir of src, otherwise false.
|
||||
// extract dest base dir and check if that is the same as src basename
|
||||
function isSrcSubdir (src, dest, cb) {
|
||||
fs.stat(src, (err, st) => {
|
||||
if (err) return cb(err)
|
||||
if (st.isDirectory()) {
|
||||
const baseDir = dest.split(path.dirname(src) + path.sep)[1]
|
||||
if (baseDir) {
|
||||
const destBasename = baseDir.split(path.sep)[0]
|
||||
if (destBasename) return cb(null, src !== dest && dest.indexOf(src) > -1 && destBasename === path.basename(src))
|
||||
return cb(null, false)
|
||||
}
|
||||
return cb(null, false)
|
||||
}
|
||||
return cb(null, false)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
move: u(move)
|
||||
}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function outputFile (file, data, encoding, callback) {
|
||||
if (typeof encoding === 'function') {
|
||||
@@ -11,7 +13,8 @@ function outputFile (file, data, encoding, callback) {
|
||||
}
|
||||
|
||||
const dir = path.dirname(file)
|
||||
fs.exists(dir, itDoes => {
|
||||
pathExists(dir, (err, itDoes) => {
|
||||
if (err) return callback(err)
|
||||
if (itDoes) return fs.writeFile(file, data, encoding, callback)
|
||||
|
||||
mkdir.mkdirs(dir, err => {
|
||||
@@ -32,6 +35,6 @@ function outputFileSync (file, data, encoding) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
outputFile,
|
||||
outputFile: u(outputFile),
|
||||
outputFileSync
|
||||
}
|
||||
|
12
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/lib/path-exists/index.js
generated
vendored
Normal file
12
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/lib/path-exists/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
const u = require('universalify').fromPromise
|
||||
const fs = require('../fs')
|
||||
|
||||
function pathExists (path) {
|
||||
return fs.access(path).then(() => true).catch(() => false)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
pathExists: u(pathExists),
|
||||
pathExistsSync: fs.existsSync
|
||||
}
|
@@ -1,17 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const rimraf = require('./rimraf')
|
||||
|
||||
function removeSync (dir) {
|
||||
return rimraf.sync(dir, {disableGlob: true})
|
||||
}
|
||||
|
||||
function remove (dir, callback) {
|
||||
const options = {disableGlob: true}
|
||||
return callback ? rimraf(dir, options, callback) : rimraf(dir, options, function () {})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
remove,
|
||||
removeSync
|
||||
remove: u(rimraf),
|
||||
removeSync: rimraf.sync
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ function rimraf (p, options, cb) {
|
||||
|
||||
rimraf_(p, options, function CB (er) {
|
||||
if (er) {
|
||||
if (isWindows && (er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
|
||||
if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
|
||||
busyTries < options.maxBusyTries) {
|
||||
busyTries++
|
||||
let time = busyTries * 100
|
||||
@@ -117,7 +117,7 @@ function fixWinEPERM (p, options, er, cb) {
|
||||
assert(er instanceof Error)
|
||||
}
|
||||
|
||||
options.chmod(p, 666, er2 => {
|
||||
options.chmod(p, 0o666, er2 => {
|
||||
if (er2) {
|
||||
cb(er2.code === 'ENOENT' ? null : er)
|
||||
} else {
|
||||
@@ -144,7 +144,7 @@ function fixWinEPERMSync (p, options, er) {
|
||||
}
|
||||
|
||||
try {
|
||||
options.chmodSync(p, 666)
|
||||
options.chmodSync(p, 0o666)
|
||||
} catch (er2) {
|
||||
if (er2.code === 'ENOENT') {
|
||||
return
|
||||
@@ -275,12 +275,12 @@ function rmdirSync (p, options, originalEr) {
|
||||
try {
|
||||
options.rmdirSync(p)
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
return
|
||||
} else if (er.code === 'ENOTDIR') {
|
||||
if (er.code === 'ENOTDIR') {
|
||||
throw originalEr
|
||||
} else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') {
|
||||
rmkidsSync(p, options)
|
||||
} else if (er.code !== 'ENOENT') {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,7 +289,25 @@ function rmkidsSync (p, options) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
|
||||
options.rmdirSync(p, options)
|
||||
|
||||
// We only end up here once we got ENOTEMPTY at least once, and
|
||||
// at this point, we are guaranteed to have removed all the kids.
|
||||
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
|
||||
// try really hard to delete stuff on windows, because it has a
|
||||
// PROFOUNDLY annoying habit of not closing handles promptly when
|
||||
// files are deleted, resulting in spurious ENOTEMPTY errors.
|
||||
const retries = isWindows ? 100 : 1
|
||||
let i = 0
|
||||
do {
|
||||
let threw = true
|
||||
try {
|
||||
const ret = options.rmdirSync(p, options)
|
||||
threw = false
|
||||
return ret
|
||||
} finally {
|
||||
if (++i < retries && threw) continue // eslint-disable-line
|
||||
}
|
||||
} while (true)
|
||||
}
|
||||
|
||||
module.exports = rimraf
|
||||
|
11
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/lib/util/buffer.js
generated
vendored
Normal file
11
app/node_modules/electron-packager/node_modules/electron-download/node_modules/fs-extra/lib/util/buffer.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/* eslint-disable node/no-deprecated-api */
|
||||
module.exports = function (size) {
|
||||
if (typeof Buffer.allocUnsafe === 'function') {
|
||||
try {
|
||||
return Buffer.allocUnsafe(size)
|
||||
} catch (e) {
|
||||
return new Buffer(size)
|
||||
}
|
||||
}
|
||||
return new Buffer(size)
|
||||
}
|
@@ -1,33 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"fs-extra@2.1.2",
|
||||
"/home/s2/Documents/Code/gitlit/app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "fs-extra@2.1.2",
|
||||
"_id": "fs-extra@2.1.2",
|
||||
"_from": "fs-extra@^4.0.1",
|
||||
"_id": "fs-extra@4.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU=",
|
||||
"_integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==",
|
||||
"_location": "/electron-packager/electron-download/fs-extra",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "fs-extra@2.1.2",
|
||||
"raw": "fs-extra@^4.0.1",
|
||||
"name": "fs-extra",
|
||||
"escapedName": "fs-extra",
|
||||
"rawSpec": "2.1.2",
|
||||
"rawSpec": "^4.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.1.2"
|
||||
"fetchSpec": "^4.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron-packager/electron-download"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz",
|
||||
"_spec": "2.1.2",
|
||||
"_where": "/home/s2/Documents/Code/gitlit/app",
|
||||
"_resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz",
|
||||
"_shasum": "0d852122e5bc5beb453fb028e9c0c9bf36340c94",
|
||||
"_spec": "fs-extra@^4.0.1",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app\\node_modules\\electron-packager\\node_modules\\electron-download",
|
||||
"author": {
|
||||
"name": "JP Richardson",
|
||||
"email": "jprichardson@gmail.com"
|
||||
@@ -35,10 +29,13 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/jprichardson/node-fs-extra/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"jsonfile": "^2.1.0"
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
@@ -51,7 +48,9 @@
|
||||
"read-dir-files": "^0.1.1",
|
||||
"rimraf": "^2.2.8",
|
||||
"secure-random": "^1.1.1",
|
||||
"standard": "^8.5.0"
|
||||
"semver": "^5.3.0",
|
||||
"standard": "^10.0.2",
|
||||
"standard-markdown": "^4.0.1"
|
||||
},
|
||||
"homepage": "https://github.com/jprichardson/node-fs-extra",
|
||||
"keywords": [
|
||||
@@ -78,7 +77,7 @@
|
||||
"move"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index",
|
||||
"main": "./lib/index.js",
|
||||
"name": "fs-extra",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -86,11 +85,11 @@
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "istanbul cover -i 'lib/**' -x '**/__tests__/**' test.js",
|
||||
"coveralls": "npm run coverage && coveralls < coverage/lcov.info",
|
||||
"lint": "standard",
|
||||
"coveralls": "coveralls < coverage/lcov.info",
|
||||
"lint": "standard && standard-markdown",
|
||||
"test": "npm run lint && npm run unit",
|
||||
"test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha",
|
||||
"unit": "node test.js"
|
||||
},
|
||||
"version": "2.1.2"
|
||||
"version": "4.0.3"
|
||||
}
|
||||
|
65
app/node_modules/electron-packager/node_modules/electron-download/package.json
generated
vendored
65
app/node_modules/electron-packager/node_modules/electron-download/package.json
generated
vendored
@@ -1,37 +1,31 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"electron-download@4.1.0",
|
||||
"/home/s2/Documents/Code/gitlit/app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "electron-download@4.1.0",
|
||||
"_id": "electron-download@4.1.0",
|
||||
"_from": "electron-download@^4.1.1",
|
||||
"_id": "electron-download@4.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-v5MsdG8vh//MCdHdRy8v9rkYeEU=",
|
||||
"_integrity": "sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg==",
|
||||
"_location": "/electron-packager/electron-download",
|
||||
"_phantomChildren": {
|
||||
"graceful-fs": "4.1.11",
|
||||
"jsonfile": "2.4.0",
|
||||
"ms": "2.0.0"
|
||||
"jsonfile": "4.0.0",
|
||||
"universalify": "0.1.2"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "electron-download@4.1.0",
|
||||
"raw": "electron-download@^4.1.1",
|
||||
"name": "electron-download",
|
||||
"escapedName": "electron-download",
|
||||
"rawSpec": "4.1.0",
|
||||
"rawSpec": "^4.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.1.0"
|
||||
"fetchSpec": "^4.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron-packager"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/electron-download/-/electron-download-4.1.0.tgz",
|
||||
"_spec": "4.1.0",
|
||||
"_where": "/home/s2/Documents/Code/gitlit/app",
|
||||
"_resolved": "https://registry.npmjs.org/electron-download/-/electron-download-4.1.1.tgz",
|
||||
"_shasum": "02e69556705cc456e520f9e035556ed5a015ebe8",
|
||||
"_spec": "electron-download@^4.1.1",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app\\node_modules\\electron-packager",
|
||||
"author": {
|
||||
"name": "max ogden"
|
||||
},
|
||||
@@ -41,25 +35,29 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/electron-userland/electron-download/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"debug": "^2.2.0",
|
||||
"debug": "^3.0.0",
|
||||
"env-paths": "^1.0.0",
|
||||
"fs-extra": "^2.0.0",
|
||||
"fs-extra": "^4.0.1",
|
||||
"minimist": "^1.2.0",
|
||||
"nugget": "^2.0.0",
|
||||
"nugget": "^2.0.1",
|
||||
"path-exists": "^3.0.0",
|
||||
"rc": "^1.1.2",
|
||||
"semver": "^5.3.0",
|
||||
"sumchecker": "^2.0.1"
|
||||
"rc": "^1.2.1",
|
||||
"semver": "^5.4.1",
|
||||
"sumchecker": "^2.0.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "download electron prebuilt binary zips from github releases",
|
||||
"devDependencies": {
|
||||
"eslint": "^3.2.0",
|
||||
"eslint-config-standard": "^5.2.0",
|
||||
"eslint-plugin-promise": "^2.0.0",
|
||||
"eslint-plugin-standard": "^2.0.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"tape": "^4.6.0",
|
||||
"eslint": "^4.4.1",
|
||||
"eslint-config-standard": "^10.2.1",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"eslint-plugin-node": "^5.1.1",
|
||||
"eslint-plugin-promise": "^3.5.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"sinon": "^6.1.4",
|
||||
"tape": "^4.8.0",
|
||||
"temp": "^0.8.3"
|
||||
},
|
||||
"engines": {
|
||||
@@ -73,6 +71,9 @@
|
||||
"rules": {
|
||||
"strict": [
|
||||
"error"
|
||||
],
|
||||
"prefer-const": [
|
||||
"error"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -90,5 +91,5 @@
|
||||
"test": "npm run unit-tests && npm run lint",
|
||||
"unit-tests": "tape test/*.js"
|
||||
},
|
||||
"version": "4.1.0"
|
||||
"version": "4.1.1"
|
||||
}
|
||||
|
33
app/node_modules/electron-packager/node_modules/electron-download/readme.md
generated
vendored
33
app/node_modules/electron-packager/node_modules/electron-download/readme.md
generated
vendored
@@ -57,17 +57,50 @@ ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
|
||||
## or for a local mirror
|
||||
ELECTRON_MIRROR="https://10.1.2.105/"
|
||||
ELECTRON_CUSTOM_DIR="our/internal/filePath"
|
||||
ELECTRON_CUSTOM_FILENAME="electron.zip"
|
||||
```
|
||||
|
||||
You can set ELECTRON_MIRROR in `.npmrc` as well, using the lowercase name:
|
||||
|
||||
```plain
|
||||
electron_mirror=https://10.1.2.105/
|
||||
electron_custom_dir="our/internal/filePath"
|
||||
electron_custom_filename="electron.zip"
|
||||
```
|
||||
|
||||
You can also set the same variables in your project's package.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"name" : "my-electron-project",
|
||||
"config" : {
|
||||
"electron_mirror": "https://10.1.2.105/",
|
||||
"electron_custom_dir": "our/internal/filePath",
|
||||
"electron_custom_filename": "electron.zip"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The order of precedence is:
|
||||
|
||||
1. npm config or .npmrc, uppercase (`process.env.NPM_CONFIG_ELECTRON_*`)
|
||||
1. npm config or .npmrc, lowercase(`process.env.npm_config_electron_*`)
|
||||
1. package.json (`process.env.npm_package_config_electron_*`)
|
||||
1. environment variables (`process.env.ELECTRON_*`)
|
||||
1. the options given to `download`
|
||||
1. defaults
|
||||
|
||||
You can also disable checksum validation if you really want to (this is in
|
||||
general a bad idea). Do this by setting `disableChecksumSafetyCheck` to `true`
|
||||
in the options object. Use this only when testing local build of Electron,
|
||||
if you have internal builds of Electron you should generate the SHASUMS file
|
||||
yourself and let `electron-download` still perform its hash validations.
|
||||
|
||||
### Cache location
|
||||
The location of the cache depends on the operating system, the defaults are:
|
||||
- Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||
- MacOS: `~/Library/Caches/electron/`
|
||||
- Windows: `$LOCALAPPDATA/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||
|
||||
You can set the `ELECTRON_CACHE` environment variable to set cache location explicitly.
|
||||
|
||||
|
4
app/node_modules/electron-packager/node_modules/fs-extra/package.json
generated
vendored
4
app/node_modules/electron-packager/node_modules/fs-extra/package.json
generated
vendored
@@ -2,7 +2,7 @@
|
||||
"_args": [
|
||||
[
|
||||
"fs-extra@5.0.0",
|
||||
"/home/s2/Documents/Code/gitlit/app"
|
||||
"E:\\projects\\p\\gitlit\\app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -29,7 +29,7 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz",
|
||||
"_spec": "5.0.0",
|
||||
"_where": "/home/s2/Documents/Code/gitlit/app",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app",
|
||||
"author": {
|
||||
"name": "JP Richardson",
|
||||
"email": "jprichardson@gmail.com"
|
||||
|
@@ -2,32 +2,34 @@
|
||||
"_args": [
|
||||
[
|
||||
"jsonfile@4.0.0",
|
||||
"/home/s2/Documents/Code/gitlit/app"
|
||||
"E:\\projects\\p\\gitlit\\app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "jsonfile@4.0.0",
|
||||
"_from": "jsonfile@^4.0.0",
|
||||
"_id": "jsonfile@4.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
|
||||
"_location": "/electron-packager/fs-extra/jsonfile",
|
||||
"_location": "/electron-packager/jsonfile",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "jsonfile@4.0.0",
|
||||
"raw": "jsonfile@^4.0.0",
|
||||
"name": "jsonfile",
|
||||
"escapedName": "jsonfile",
|
||||
"rawSpec": "4.0.0",
|
||||
"rawSpec": "^4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.0.0"
|
||||
"fetchSpec": "^4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron-packager/electron-download/fs-extra",
|
||||
"/electron-packager/fs-extra"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||
"_spec": "4.0.0",
|
||||
"_where": "/home/s2/Documents/Code/gitlit/app",
|
||||
"_shasum": "8771aae0799b64076b76640fca058f9c10e33ecb",
|
||||
"_spec": "jsonfile@^4.0.0",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app\\node_modules\\electron-packager\\node_modules\\electron-download\\node_modules\\fs-extra",
|
||||
"author": {
|
||||
"name": "JP Richardson",
|
||||
"email": "jprichardson@gmail.com"
|
||||
@@ -35,9 +37,11 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/jprichardson/node-jsonfile/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Easily read/write JSON files.",
|
||||
"devDependencies": {
|
||||
"mocha": "2.x",
|
162
app/node_modules/electron-packager/node_modules/ms/index.js
generated
vendored
Normal file
162
app/node_modules/electron-packager/node_modules/ms/index.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var w = d * 7;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} [options]
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options) {
|
||||
options = options || {};
|
||||
var type = typeof val;
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val);
|
||||
} else if (type === 'number' && isNaN(val) === false) {
|
||||
return options.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new Error(
|
||||
'val is not a non-empty string or a valid number. val=' +
|
||||
JSON.stringify(val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
return;
|
||||
}
|
||||
var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
||||
str
|
||||
);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'weeks':
|
||||
case 'week':
|
||||
case 'w':
|
||||
return n * w;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return Math.round(ms / d) + 'd';
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return Math.round(ms / h) + 'h';
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return Math.round(ms / m) + 'm';
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return Math.round(ms / s) + 's';
|
||||
}
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtLong(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return plural(ms, msAbs, d, 'day');
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return plural(ms, msAbs, h, 'hour');
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return plural(ms, msAbs, m, 'minute');
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return plural(ms, msAbs, s, 'second');
|
||||
}
|
||||
return ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, msAbs, n, name) {
|
||||
var isPlural = msAbs >= n * 1.5;
|
||||
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
||||
}
|
21
app/node_modules/electron-packager/node_modules/ms/license.md
generated
vendored
Normal file
21
app/node_modules/electron-packager/node_modules/ms/license.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
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.
|
69
app/node_modules/electron-packager/node_modules/ms/package.json
generated
vendored
Normal file
69
app/node_modules/electron-packager/node_modules/ms/package.json
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "ms@^2.1.1",
|
||||
"_id": "ms@2.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
|
||||
"_location": "/electron-packager/ms",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ms@^2.1.1",
|
||||
"name": "ms",
|
||||
"escapedName": "ms",
|
||||
"rawSpec": "^2.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron-packager/debug"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
"_shasum": "30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a",
|
||||
"_spec": "ms@^2.1.1",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app\\node_modules\\electron-packager\\node_modules\\debug",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zeit/ms/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tiny millisecond conversion utility",
|
||||
"devDependencies": {
|
||||
"eslint": "4.12.1",
|
||||
"expect.js": "0.3.1",
|
||||
"husky": "0.14.3",
|
||||
"lint-staged": "5.0.0",
|
||||
"mocha": "4.0.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/zeit/ms#readme",
|
||||
"license": "MIT",
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"npm run lint",
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"main": "./index",
|
||||
"name": "ms",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zeit/ms.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib/* bin/*",
|
||||
"precommit": "lint-staged",
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"version": "2.1.1"
|
||||
}
|
60
app/node_modules/electron-packager/node_modules/ms/readme.md
generated
vendored
Normal file
60
app/node_modules/electron-packager/node_modules/ms/readme.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# ms
|
||||
|
||||
[](https://travis-ci.org/zeit/ms)
|
||||
[](https://zeit.chat/)
|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
ms('-3 days') // -259200000
|
||||
ms('-1h') // -3600000
|
||||
ms('-200') // -200
|
||||
```
|
||||
|
||||
### Convert from Milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(-3 * 60000) // "-3m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time Format Written-Out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [Node.js](https://nodejs.org) and in the browser
|
||||
- If a number is supplied to `ms`, a string with a unit is returned
|
||||
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
||||
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
||||
|
||||
## Related Packages
|
||||
|
||||
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
||||
|
||||
## Caught a Bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
4
app/node_modules/electron-packager/node_modules/path-exists/package.json
generated
vendored
4
app/node_modules/electron-packager/node_modules/path-exists/package.json
generated
vendored
@@ -2,7 +2,7 @@
|
||||
"_args": [
|
||||
[
|
||||
"path-exists@3.0.0",
|
||||
"/home/s2/Documents/Code/gitlit/app"
|
||||
"E:\\projects\\p\\gitlit\\app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
@@ -27,7 +27,7 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||
"_spec": "3.0.0",
|
||||
"_where": "/home/s2/Documents/Code/gitlit/app",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user