Pushing changes

This commit is contained in:
2017-03-23 23:52:08 -05:00
parent 6075860b82
commit ac667ec74f
1465 changed files with 345149 additions and 3 deletions

6
node_modules/superagent/.npmignore generated vendored Normal file
View File

@ -0,0 +1,6 @@
support
test
examples
*.sock
lib-cov
coverage.html

18
node_modules/superagent/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,18 @@
sudo: false
language: node_js
node_js:
- "5.4"
- "4.2"
- "0.12"
- "0.10"
- "iojs"
env:
global:
- SAUCE_USERNAME='shtylman-superagent'
- SAUCE_ACCESS_KEY='39a45464-cb1d-4b8d-aa1f-83c7c04fa673'
matrix:
include:
- node_js: "4.2"
env: BROWSER=1

15
node_modules/superagent/.zuul.yml generated vendored Normal file
View File

@ -0,0 +1,15 @@
ui: mocha-bdd
server: ./test/support/server.js
browsers:
- name: chrome
version: latest
- name: firefox
version: latest
- name: safari
version: latest
- name: iphone
version: latest
- name: android
version: latest
- name: ie
version: 9..latest

7
node_modules/superagent/Contributing.md generated vendored Normal file
View File

@ -0,0 +1,7 @@
When submitting a PR, your chance of acceptance increases if you do the following:
* Code style is consistent with existing in the file.
* Tests are passing (client and server).
* You add a test for the failing issue you are fixing.
* Code changes are focused on the area of discussion.
* Do not rebuild the distribution files or increment version numbers.

554
node_modules/superagent/History.md generated vendored Normal file
View File

@ -0,0 +1,554 @@
# 1.8.2 (2016-03-20)
* Fixed handling of HTTP status 204 with content-encoding: gzip (Andrew Shelton)
* Handling of FormData error events (scriptype)
* Fixed parsing of `vnd+json` MIME types (Kornel Lesiński)
* Aliased browser implementation of `.parse()` as `.serialize()` for forward compatibility
# 1.8.1 (2016-03-14)
* Fixed form-data incompatibility with IE9
# 1.8.0 (2016-03-09)
* Extracted common code into request-base class (Peter Lyons)
* It does not affect the public API, but please let us know if you notice any plugins/subclasses breaking!
* Added option `{type:'auto'}` to `auth` method, which enables browser-native auth types (Jungle, Askar Yusupov)
* Added `responseType()` to set XHR `responseType` (chris)
* Switched to form-data for browserify-compatible `FormData` (Peter Lyons)
* Added `statusCode` to error response when JSON response is malformed (mattdell)
* Prevented TCP port conflicts in all tests (Peter Lyons)
* Updated form-data dependency
# 1.7.2 (2016-01-26)
* Fix case-sensitivity of header fields introduced by a4ddd6a. (Edward J. Jinotti)
* bump extend dependency, as former version did not contain any license information (Lukas Eipert)
# 1.7.1 (2016-01-21)
* Fixed a conflict with express when using npm 3.x (Glenn)
* Fixed redirects after a multipart/form-data POST request (cyclist2)
# 1.7.0 (2016-01-18)
* When attaching files, read default filename from the `File` object (JD Isaacks)
* Add `direction` property to `progress` events (Joseph Dykstra)
* Update component-emitter & formidable (Kornel Lesiński)
* Don't re-encode query string needlessly (Ruben Verborgh)
* ensure querystring is appended when doing `stream.pipe(request)` (Keith Grennan)
* change set header function, not call `this.request()` until call `this.end()` (vicanso)
* Add no-op `withCredentials` to Node API (markdalgleish)
* fix `delete` breaking on ie8 (kenjiokabe)
* Don't let request error override responses (Clay Reimann)
* Increased number of tests shared between node and client (Kornel Lesiński)
# 1.6.0/1.6.1 (2015-12-09)
* avoid misleading CORS error message
* added 'progress' event on file/form upload in Node (Olivier Lalonde)
* return raw response if the response parsing fails (Rei Colina)
* parse content-types ending with `+json` as JSON (Eiryyy)
* fix to avoid throwing errors on aborted requests (gjurgens)
* retain cookies on redirect when hosts match (Tom Conroy)
* added Bower manifest (Johnny Freeman)
* upgrade to latest cookiejar (Andy Burke)
# 1.5.0 (2015-11-30)
* encode array values as `key=1&key=2&key=3` etc... (aalpern, Davis Kim)
* avoid the error which is omitted from 'socket hang up'
* faster JSON parsing, handling of zlib errors (jbellenger)
* fix IE11 sends 'undefined' string if data was undefined (Vadim Goncharov)
* alias `del()` method as `delete()` (Aaron Krause)
* revert Request#parse since it was actually Response#parse
# 1.4.0 (2015-09-14)
* add Request#parse method to client library
* add missing statusCode in client response
* don't apply JSON heuristics if a valid parser is found
* fix detection of root object for webworkers
# 1.3.0 (2015-08-05)
* fix incorrect content-length of data set to buffer
* serialize request data takes into account charsets
* add basic promise support via a `then` function
# 1.2.0 (2015-04-13)
* add progress events to downlodas
* make usable in webworkers
* add support for 308 redirects
* update node-form-data dependency
* update to work in react native
* update node-mime dependency
# 1.1.0 (2015-03-13)
* Fix responseType checks without xhr2 and ie9 tests (rase-)
* errors have .status and .response fields if applicable (defunctzombie)
* fix end callback called before saving cookies (rase-)
1.0.0 / 2015-03-08
==================
* All non-200 responses are treated as errors now. (The callback is called with an error when the response has a status < 200 or >= 300 now. In previous versions this would not have raised an error and the client would have to check the `res` object. See [#283](https://github.com/visionmedia/superagent/issues/283).
* keep timeouts intact across redirects (hopkinsth)
* handle falsy json values (themaarten)
* fire response events in browser version (Schoonology)
* getXHR exported in client version (KidsKilla)
* remove arity check on `.end()` callbacks (defunctzombie)
* avoid setting content-type for host objects (rexxars)
* don't index array strings in querystring (travisjeffery)
* fix pipe() with redirects (cyrilis)
* add xhr2 file download (vstirbu)
* set default response type to text/plain if not specified (warrenseine)
0.21.0 / 2014-11-11
==================
* Trim text before parsing json (gjohnson)
* Update tests to express 4 (gaastonsr)
* Prevent double callback when error is thrown (pgn-vole)
* Fix missing clearTimeout (nickdima)
* Update debug (TooTallNate)
0.20.0 / 2014-10-02
==================
* Add toJSON() to request and response instances. (yields)
* Prevent HEAD requests from getting parsed. (gjohnson)
* Update debug. (TooTallNate)
0.19.1 / 2014-09-24
==================
* Fix basic auth issue when password is falsey value. (gjohnson)
0.19.0 / 2014-09-24
==================
* Add unset() to browser. (shesek)
* Prefer XHR over ActiveX. (omeid)
* Catch parse errors. (jacwright)
* Update qs dependency. (wercker)
* Add use() to node. (Financial-Times)
* Add response text to errors. (yields)
* Don't send empty cookie headers. (undoZen)
* Don't parse empty response bodies. (DveMac)
* Use hostname when setting cookie host. (prasunsultania)
0.18.2 / 2014-07-12
==================
* Handle parser errors. (kof)
* Ensure not to use default parsers when there is a user defined one. (kof)
0.18.1 / 2014-07-05
==================
* Upgrade cookiejar dependency (juanpin)
* Support image mime types (nebulade)
* Make .agent chainable (kof)
* Upgrade debug (TooTallNate)
* Fix docs (aheckmann)
0.18.0 / 2014-04-29
===================
* Use "form-data" module for the multipart/form-data implementation. (TooTallNate)
* Add basic `field()` and `attach()` functions for HTML5 FormData. (TooTallNate)
* Deprecate `part()`. (TooTallNate)
* Set default user-agent header. (bevacqua)
* Add `unset()` method for removing headers. (bevacqua)
* Update cookiejar. (missinglink)
* Fix response error formatting. (shesek)
0.17.0 / 2014-03-06
===================
* supply uri malformed error to the callback (yields)
* add request event (yields)
* allow simple auth (yields)
* add request event (yields)
* switch to component/reduce (visionmedia)
* fix part content-disposition (mscdex)
* add browser testing via zuul (defunctzombie)
* adds request.use() (johntron)
0.16.0 / 2014-01-07
==================
* remove support for 0.6 (superjoe30)
* fix CORS withCredentials (wejendorp)
* add "test" script (superjoe30)
* add request .accept() method (nickl-)
* add xml to mime types mappings (nickl-)
* fix parse body error on HEAD requests (gjohnson)
* fix documentation typos (matteofigus)
* fix content-type + charset (bengourley)
* fix null values on query parameters (cristiandouce)
0.15.7 / 2013-10-19
==================
* pin should.js to 1.3.0 due to breaking change in 2.0.x
* fix browserify regression
0.15.5 / 2013-10-09
==================
* add browser field to support browserify
* fix .field() value number support
0.15.4 / 2013-07-09
==================
* node: add a Request#agent() function to set the http Agent to use
0.15.3 / 2013-07-05
==================
* fix .pipe() unzipping on more recent nodes. Closes #240
* fix passing an empty object to .query() no longer appends "?"
* fix formidable error handling
* update formidable
0.15.2 / 2013-07-02
==================
* fix: emit 'end' when piping.
0.15.1 / 2013-06-26
==================
* add try/catch around parseLinks
0.15.0 / 2013-06-25
==================
* make `Response#toError()` have a more meaningful `message`
0.14.9 / 2013-06-15
==================
* add debug()s to the node client
* add .abort() method to node client
0.14.8 / 2013-06-13
==================
* set .agent = false always
* remove X-Requested-With. Closes #189
0.14.7 / 2013-06-06
==================
* fix unzip error handling
0.14.6 / 2013-05-23
==================
* fix HEAD unzip bug
0.14.5 / 2013-05-23
==================
* add flag to ensure the callback is __never__ invoked twice
0.14.4 / 2013-05-22
==================
* add superagent.js build output
* update qs
* update emitter-component
* revert "add browser field to support browserify" see GH-221
0.14.3 / 2013-05-18
==================
* add browser field to support browserify
0.14.2/ 2013-05-07
==================
* add host object check to fix serialization of File/Blobs etc as json
0.14.1 / 2013-04-09
==================
* update qs
0.14.0 / 2013-04-02
==================
* add client-side basic auth
* fix retaining of .set() header field case
0.13.0 / 2013-03-13
==================
* add progress events to client
* add simple example
* add res.headers as alias of res.header for browser client
* add res.get(field) to node/client
0.12.4 / 2013-02-11
==================
* fix get content-type even if can't get other headers in firefox. fixes #181
0.12.3 / 2013-02-11
==================
* add quick "progress" event support
0.12.2 / 2013-02-04
==================
* add test to check if response acts as a readable stream
* add ReadableStream in the Response prototype.
* add test to assert correct redirection when the host changes in the location header.
* add default Accept-Encoding. Closes #155
* fix req.pipe() return value of original stream for node parity. Closes #171
* remove the host header when cleaning headers to properly follow the redirection.
0.12.1 / 2013-01-10
==================
* add x-domain error handling
0.12.0 / 2013-01-04
==================
* add header persistence on redirects
0.11.0 / 2013-01-02
==================
* add .error Error object. Closes #156
* add forcing of res.text removal for FF HEAD responses. Closes #162
* add reduce component usage. Closes #90
* move better-assert dep to development deps
0.10.0 / 2012-11-14
==================
* add req.timeout(ms) support for the client
0.9.10 / 2012-11-14
==================
* fix client-side .query(str) support
0.9.9 / 2012-11-14
==================
* add .parse(fn) support
* fix socket hangup with dates in querystring. Closes #146
* fix socket hangup "error" event when a callback of arity 2 is provided
0.9.8 / 2012-11-03
==================
* add emission of error from `Request#callback()`
* add a better fix for nodes weird socket hang up error
* add PUT/POST/PATCH data support to client short-hand functions
* add .license property to component.json
* change client portion to build using component(1)
* fix GET body support [guille]
0.9.7 / 2012-10-19
==================
* fix `.buffer()` `res.text` when no parser matches
0.9.6 / 2012-10-17
==================
* change: use `this` when `window` is undefined
* update to new component spec [juliangruber]
* fix emission of "data" events for compressed responses without encoding. Closes #125
0.9.5 / 2012-10-01
==================
* add field name to .attach()
* add text "parser"
* refactor isObject()
* remove wtf isFunction() helper
0.9.4 / 2012-09-20
==================
* fix `Buffer` responses [TooTallNate]
* fix `res.type` when a "type" param is present [TooTallNate]
0.9.3 / 2012-09-18
==================
* remove __GET__ `.send()` == `.query()` special-case (__API__ change !!!)
0.9.2 / 2012-09-17
==================
* add `.aborted` prop
* add `.abort()`. Closes #115
0.9.1 / 2012-09-07
==================
* add `.forbidden` response property
* add component.json
* change emitter-component to 0.0.5
* fix client-side tests
0.9.0 / 2012-08-28
==================
* add `.timeout(ms)`. Closes #17
0.8.2 / 2012-08-28
==================
* fix pathname relative redirects. Closes #112
0.8.1 / 2012-08-21
==================
* fix redirects when schema is specified
0.8.0 / 2012-08-19
==================
* add `res.buffered` flag
* add buffering of text/*, json and forms only by default. Closes #61
* add `.buffer(false)` cancellation
* add cookie jar support [hunterloftis]
* add agent functionality [hunterloftis]
0.7.0 / 2012-08-03
==================
* allow `query()` to be called after the internal `req` has been created [tootallnate]
0.6.0 / 2012-07-17
==================
* add `res.send('foo=bar')` default of "application/x-www-form-urlencoded"
0.5.1 / 2012-07-16
==================
* add "methods" dep
* add `.end()` arity check to node callbacks
* fix unzip support due to weird node internals
0.5.0 / 2012-06-16
==================
* Added "Link" response header field parsing, exposing `res.links`
0.4.3 / 2012-06-15
==================
* Added 303, 305 and 307 as redirect status codes [slaskis]
* Fixed passing an object as the url
0.4.2 / 2012-06-02
==================
* Added component support
* Fixed redirect data
0.4.1 / 2012-04-13
==================
* Added HTTP PATCH support
* Fixed: GET / HEAD when following redirects. Closes #86
* Fixed Content-Length detection for multibyte chars
0.4.0 / 2012-03-04
==================
* Added `.head()` method [browser]. Closes #78
* Added `make test-cov` support
* Added multipart request support. Closes #11
* Added all methods that node supports. Closes #71
* Added "response" event providing a Response object. Closes #28
* Added `.query(obj)`. Closes #59
* Added `res.type` (browser). Closes #54
* Changed: default `res.body` and `res.files` to {}
* Fixed: port existing query-string fix (browser). Closes #57
0.3.0 / 2012-01-24
==================
* Added deflate/gzip support [guillermo]
* Added `res.type` (Content-Type void of params)
* Added `res.statusCode` to mirror node
* Added `res.headers` to mirror node
* Changed: parsers take callbacks
* Fixed optional schema support. Closes #49
0.2.0 / 2012-01-05
==================
* Added url auth support
* Added `.auth(username, password)`
* Added basic auth support [node]. Closes #41
* Added `make test-docs`
* Added guillermo's EventEmitter. Closes #16
* Removed `Request#data()` for SS, renamed to `send()`
* Removed `Request#data()` from client, renamed to `send()`
* Fixed array support. [browser]
* Fixed array support. Closes #35 [node]
* Fixed `EventEmitter#emit()`
0.1.3 / 2011-10-25
==================
* Added error to callback
* Bumped node dep for 0.5.x
0.1.2 / 2011-09-24
==================
* Added markdown documentation
* Added `request(url[, fn])` support to the client
* Added `qs` dependency to package.json
* Added options for `Request#pipe()`
* Added support for `request(url, callback)`
* Added `request(url)` as shortcut for `request.get(url)`
* Added `Request#pipe(stream)`
* Added inherit from `Stream`
* Added multipart support
* Added ssl support (node)
* Removed Content-Length field from client
* Fixed buffering, `setEncoding()` to utf8 [reported by stagas]
* Fixed "end" event when piping
0.1.1 / 2011-08-20
==================
* Added `res.redirect` flag (node)
* Added redirect support (node)
* Added `Request#redirects(n)` (node)
* Added `.set(object)` header field support
* Fixed `Content-Length` support
0.1.0 / 2011-08-09
==================
* Added support for multiple calls to `.data()`
* Added support for `.get(uri, obj)`
* Added GET `.data()` querystring support
* Added IE{6,7,8} support [alexyoung]
0.0.1 / 2011-08-05
==================
* Initial commit

22
node_modules/superagent/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
(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.

57
node_modules/superagent/Makefile generated vendored Normal file
View File

@ -0,0 +1,57 @@
NODETESTS ?= test/*.js test/node/*.js
BROWSERTESTS ?= test/*.js test/client/*.js
REPORTER = spec
all: superagent.js
test:
@if [ "x$(BROWSER)" = "x" ]; then make test-node; else make test-browser; fi
test-node:
@NODE_ENV=test NODE_TLS_REJECT_UNAUTHORIZED=0 ./node_modules/.bin/mocha \
--require should \
--reporter $(REPORTER) \
--timeout 5000 \
--growl \
$(NODETESTS)
test-cov: lib-cov
SUPERAGENT_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
test-browser:
./node_modules/.bin/zuul -- $(BROWSERTESTS)
test-browser-local:
./node_modules/.bin/zuul --local 4000 -- $(BROWSERTESTS)
lib-cov:
jscoverage lib lib-cov
superagent.js: lib/node/*.js lib/node/parsers/*.js
@./node_modules/.bin/browserify \
--standalone superagent \
--outfile superagent.js .
test-server:
@node test/server
docs: index.html test-docs
index.html: docs/index.md
marked < $< \
| cat docs/head.html - docs/tail.html \
> $@
docclean:
rm -f index.html test.html
test-docs:
make test REPORTER=doc \
| cat docs/head.html - docs/tail.html \
> test.html
clean:
rm -fr superagent.js components
.PHONY: test-cov test docs test-docs clean test-browser-local

116
node_modules/superagent/Readme.md generated vendored Normal file
View File

@ -0,0 +1,116 @@
# SuperAgent [![Build Status](https://travis-ci.org/visionmedia/superagent.svg?branch=master)](https://travis-ci.org/visionmedia/superagent)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/shtylman-superagent.svg)](https://saucelabs.com/u/shtylman-superagent)
SuperAgent is a small progressive __client-side__ HTTP request library, and __Node.js__ module with the same API, sporting many high-level HTTP client features. View the [docs](http://visionmedia.github.io/superagent/).
![super agent](http://f.cl.ly/items/3d282n3A0h0Z0K2w0q2a/Screenshot.png)
## Installation
node:
```
$ npm install superagent
```
component:
```
$ component install visionmedia/superagent
```
Works with [browserify](https://github.com/substack/node-browserify) and should work with [webpack](https://github.com/visionmedia/superagent/wiki/Superagent-for-Webpack)
```js
request
.post('/api/pet')
.send({ name: 'Manny', species: 'cat' })
.set('X-API-Key', 'foobar')
.set('Accept', 'application/json')
.end(function(err, res){
// Calling the end function will send the request
});
```
## Supported browsers
Tested browsers:
- Latest Android
- Latest Firefox
- Latest Chrome
- IE9 through latest
- Latest iPhone
- Latest Safari
Even though IE9 is supported, a polyfill `window.btoa` is needed to use basic auth.
# Plugins
Superagent is easily extended via plugins.
```js
var nocache = require('superagent-no-cache');
var request = require('superagent');
var prefix = require('superagent-prefix')('/static');
request
.get('/some-url')
.use(prefix) // Prefixes *only* this request
.use(nocache) // Prevents caching of *only* this request
.end(function(err, res){
// Do something
});
```
Existing plugins:
* [superagent-no-cache](https://github.com/johntron/superagent-no-cache) - prevents caching by including Cache-Control header
* [superagent-prefix](https://github.com/johntron/superagent-prefix) - prefixes absolute URLs (useful in test environment)
* [superagent-suffix](https://github.com/timneutkens1/superagent-suffix) - suffix URLs with a given path
* [superagent-mock](https://github.com/M6Web/superagent-mock) - simulate HTTP calls by returning data fixtures based on the requested URL
* [superagent-mocker](https://github.com/shuvalov-anton/superagent-mocker) — simulate REST API
* [superagent-cache](https://github.com/jpodwys/superagent-cache) - superagent with built-in, flexible caching
* [superagent-jsonapify](https://github.com/alex94puchades/superagent-jsonapify) - A lightweight [json-api](http://jsonapi.org/format/) client addon for superagent
* [superagent-serializer](https://github.com/zzarcon/superagent-serializer) - Converts server payload into different cases
* [superagent-promise-plugin](https://github.com/jomaxx/superagent-promise-plugin) - Shims req.end to return a promise when executed with no callback.
* [superagent-use](https://github.com/koenpunt/superagent-use) - A client addon to apply plugins to all requests.
Please prefix your plugin with `superagent-*` so that it can easily be found by others.
For superagent extensions such as couchdb and oauth visit the [wiki](https://github.com/visionmedia/superagent/wiki).
## Running node tests
Install dependencies:
```shell
$ npm install
```
Run em!
```shell
$ make test
```
## Running browser tests
Install dependencies:
```shell
$ npm install
```
Start the test runner:
```shell
$ make test-browser-local
```
Visit `http://localhost:4000/__zuul` in your browser.
Edit tests and refresh your browser. You do not have to restart the test runner.
## License
MIT

4
node_modules/superagent/bower.json generated vendored Normal file
View File

@ -0,0 +1,4 @@
{
"name": "superagent",
"main": "lib/client.js"
}

21
node_modules/superagent/component.json generated vendored Normal file
View File

@ -0,0 +1,21 @@
{
"name": "superagent",
"repo": "visionmedia/superagent",
"version": "1.8.2",
"description": "elegant & feature rich browser / node HTTP with a fluent API",
"keywords": [
"http",
"ajax",
"request",
"agent"
],
"scripts": [
"lib/client.js"
],
"main": "lib/client.js",
"dependencies": {
"component/emitter": "*",
"component/reduce": "*"
},
"license": "MIT"
}

21
node_modules/superagent/docs/head.html generated vendored Normal file
View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>SuperAgent - Ajax with less suck</title>
<link rel="stylesheet" href="docs/style.css">
<script src="docs/jquery.js"></script>
<script src="docs/jquery-ui.min.js"></script>
<script src="docs/highlight.js"></script>
<script src="docs/jquery.tocify.min.js"></script>
<script>
$(function(){
$('#menu').tocify({
selectors: 'h2',
hashGenerator: 'pretty'
});
});
</script>
</head>
<body>
<ul id="menu"></ul>
<div id="content">

17
node_modules/superagent/docs/highlight.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
$(function(){
$('code').each(function(){
$(this).html(highlight($(this).text()));
});
});
function highlight(js) {
return js
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/('.*?')/gm, '<span class="string">$1</span>')
.replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
.replace(/(\d+)/gm, '<span class="number">$1</span>')
.replace(/\bnew *(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
.replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
}

BIN
node_modules/superagent/docs/images/bg.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

448
node_modules/superagent/docs/index.md generated vendored Normal file
View File

@ -0,0 +1,448 @@
# SuperAgent
Super Agent is light-weight progressive ajax API crafted for flexibility, readability, and a low learning curve after being frustrated with many of the existing request APIs. It also works with Node.js!
request
.post('/api/pet')
.send({ name: 'Manny', species: 'cat' })
.set('X-API-Key', 'foobar')
.set('Accept', 'application/json')
.end(function(err, res){
if (err || !res.ok) {
alert('Oh no! error');
} else {
alert('yay got ' + JSON.stringify(res.body));
}
});
## Test documentation
The following [test documentation](docs/test.html) was generated with [Mocha's](http://visionmedia.github.com/mocha) "doc" reporter, and directly reflects the test suite. This provides an additional source of documentation.
## Request basics
A request can be initiated by invoking the appropriate method on the `request` object, then calling `.end()` to send the request. For example a simple GET request:
request
.get('/search')
.end(function(err, res){
});
A method string may also be passed:
request('GET', '/search').end(callback);
The __node__ client may also provide absolute urls:
request
.get('http://example.com/search')
.end(function(err, res){
});
__DELETE__, __HEAD__, __POST__, __PUT__ and other __HTTP__ verbs may also be used, simply change the method name:
request
.head('/favicon.ico')
.end(function(err, res){
});
__DELETE__ is a special-case, as it's a reserved word, so the method is named `.del()`:
request
.del('/user/1')
.end(function(err, res){
});
The HTTP method defaults to __GET__, so if you wish, the following is valid:
request('/search', function(err, res){
});
## Setting header fields
Setting header fields is simple, invoke `.set()` with a field name and value:
request
.get('/search')
.set('API-Key', 'foobar')
.set('Accept', 'application/json')
.end(callback);
You may also pass an object to set several fields in a single call:
request
.get('/search')
.set({ 'API-Key': 'foobar', Accept: 'application/json' })
.end(callback);
## GET requests
The `.query()` method accepts objects, which when used with the __GET__ method will form a query-string. The following will produce the path `/search?query=Manny&range=1..5&order=desc`.
request
.get('/search')
.query({ query: 'Manny' })
.query({ range: '1..5' })
.query({ order: 'desc' })
.end(function(err, res){
});
Or as a single object:
request
.get('/search')
.query({ query: 'Manny', range: '1..5', order: 'desc' })
.end(function(err, res){
});
The `.query()` method accepts strings as well:
request
.get('/querystring')
.query('search=Manny&range=1..5')
.end(function(err, res){
});
Or joined:
request
.get('/querystring')
.query('search=Manny')
.query('range=1..5')
.end(function(err, res){
});
## HEAD requests
You can also use the `.query()` method for HEAD requests. The following will produce the path `/users?email=joe@smith.com`.
request
.head('/users')
.query({ email: 'joe@smith.com' })
.end(function(err, res){
});
## POST / PUT requests
A typical JSON __POST__ request might look a little like the following, where we set the Content-Type header field appropriately, and "write" some data, in this case just a JSON string.
request.post('/user')
.set('Content-Type', 'application/json')
.send('{"name":"tj","pet":"tobi"}')
.end(callback)
Since JSON is undoubtably the most common, it's the _default_! The following example is equivalent to the previous.
request.post('/user')
.send({ name: 'tj', pet: 'tobi' })
.end(callback)
Or using multiple `.send()` calls:
request.post('/user')
.send({ name: 'tj' })
.send({ pet: 'tobi' })
.end(callback)
By default sending strings will set the Content-Type to `application/x-www-form-urlencoded`,
multiple calls will be concatenated with `&`, here resulting in `name=tj&pet=tobi`:
request.post('/user')
.send('name=tj')
.send('pet=tobi')
.end(callback);
SuperAgent formats are extensible, however by default "json" and "form" are supported. To send the data as `application/x-www-form-urlencoded` simply invoke `.type()` with "form", where the default is "json". This request will POST the body "name=tj&pet=tobi".
request.post('/user')
.type('form')
.send({ name: 'tj' })
.send({ pet: 'tobi' })
.end(callback)
Note: "form" is aliased as "form-data" and "urlencoded" for backwards compat.
## Setting the Content-Type
The obvious solution is to use the `.set()` method:
request.post('/user')
.set('Content-Type', 'application/json')
As a short-hand the `.type()` method is also available, accepting
the canonicalized MIME type name complete with type/subtype, or
simply the extension name such as "xml", "json", "png", etc:
request.post('/user')
.type('application/json')
request.post('/user')
.type('json')
request.post('/user')
.type('png')
## Setting Accept
In a similar fashion to the `.type()` method it is also possible to set the Accept header via the short hand method `.accept()`. Which references `request.types` as well allowing you to specify either the full canonicalized MIME type name as type/subtype, or the extension suffix form as "xml", "json", "png", etc for convenience:
request.get('/user')
.accept('application/json')
request.get('/user')
.accept('json')
request.post('/user')
.accept('png')
## Query strings
`res.query(obj)` is a method which may be used to build up a query-string. For example populating `?format=json&dest=/login` on a __POST__:
request
.post('/')
.query({ format: 'json' })
.query({ dest: '/login' })
.send({ post: 'data', here: 'wahoo' })
.end(callback);
## Parsing response bodies
Super Agent will parse known response-body data for you, currently supporting _application/x-www-form-urlencoded_, _application/json_, and _multipart/form-data_.
### JSON / Urlencoded
The property `res.body` is the parsed object, for example if a request responded with the JSON string '{"user":{"name":"tobi"}}', `res.body.user.name` would be "tobi". Likewise the x-www-form-urlencoded value of "user[name]=tobi" would yield the same result.
### Multipart
The Node client supports _multipart/form-data_ via the [Formidable](https://github.com/felixge/node-formidable) module. When parsing multipart responses, the object `res.files` is also available to you. Suppose for example a request responds with the following multipart body:
--whoop
Content-Disposition: attachment; name="image"; filename="tobi.png"
Content-Type: image/png
... data here ...
--whoop
Content-Disposition: form-data; name="name"
Content-Type: text/plain
Tobi
--whoop--
You would have the values `res.body.name` provided as "Tobi", and `res.files.image` as a `File` object containing the path on disk, filename, and other properties.
## Response properties
Many helpful flags and properties are set on the `Response` object, ranging from the response text, parsed response body, header fields, status flags and more.
### Response text
The `res.text` property contains the unparsed response body string. This
property is always present for the client API, and only when the mime type
matches "text/*", "*/json", or "x-www-form-urlencoding" by default for node. The
reasoning is to conserve memory, as buffering text of large bodies such as multipart files or images is extremely inefficient.
To force buffering see the "Buffering responses" section.
### Response body
Much like SuperAgent can auto-serialize request data, it can also automatically parse it. When a parser is defined for the Content-Type, it is parsed, which by default includes "application/json" and "application/x-www-form-urlencoded". The parsed object is then available via `res.body`.
### Response header fields
The `res.header` contains an object of parsed header fields, lowercasing field names much like node does. For example `res.header['content-length']`.
### Response Content-Type
The Content-Type response header is special-cased, providing `res.type`, which is void of the charset (if any). For example the Content-Type of "text/html; charset=utf8" will provide "text/html" as `res.type`, and the `res.charset` property would then contain "utf8".
### Response status
The response status flags help determine if the request was a success, among other useful information, making SuperAgent ideal for interacting with RESTful web services. These flags are currently defined as:
var type = status / 100 | 0;
// status / class
res.status = status;
res.statusType = type;
// basics
res.info = 1 == type;
res.ok = 2 == type;
res.clientError = 4 == type;
res.serverError = 5 == type;
res.error = 4 == type || 5 == type;
// sugar
res.accepted = 202 == status;
res.noContent = 204 == status || 1223 == status;
res.badRequest = 400 == status;
res.unauthorized = 401 == status;
res.notAcceptable = 406 == status;
res.notFound = 404 == status;
res.forbidden = 403 == status;
## Aborting requests
To abort requests simply invoke the `req.abort()` method.
## Request timeouts
A timeout can be applied by invoking `req.timeout(ms)`, after which an error
will be triggered. To differentiate between other errors the `err.timeout` property
is set to the `ms` value. __NOTE__ that this is a timeout applied to the request
and all subsequent redirects, not per request.
## Basic authentication
Basic auth is currently provided by the _node_ client in two forms, first via the URL as "user:pass":
request.get('http://tobi:learnboost@local').end(callback);
As well as via the `.auth()` method:
request
.get('http://local')
.auth('tobi', 'learnboost')
.end(callback);
## Following redirects
By default up to 5 redirects will be followed, however you may specify this with the `res.redirects(n)` method:
request
.get('/some.png')
.redirects(2)
.end(callback);
## Piping data
The Node client allows you to pipe data to and from the request. For example piping a file's contents as the request:
var request = require('superagent')
, fs = require('fs');
var stream = fs.createReadStream('path/to/my.json');
var req = request.post('/somewhere');
req.type('json');
stream.pipe(req);
Or piping the response to a file:
var request = require('superagent')
, fs = require('fs');
var stream = fs.createWriteStream('path/to/my.json');
var req = request.get('/some.json');
req.pipe(stream);
## Multipart requests
Super Agent is also great for _building_ multipart requests for which it provides methods `.attach()` and `.field()`.
### Attaching files
As mentioned a higher-level API is also provided, in the form of `.attach(name, [path], [filename])` and `.field(name, value)`. Attaching several files is simple, you can also provide a custom filename for the attachment, otherwise the basename of the attached file is used.
request
.post('/upload')
.attach('avatar', 'path/to/tobi.png', 'user.png')
.attach('image', 'path/to/loki.png')
.attach('file', 'path/to/jane.png')
.end(callback);
### Field values
Much like form fields in HTML, you can set field values with the `.field(name, value)` method. Suppose you want to upload a few images with your name and email, your request might look something like this:
request
.post('/upload')
.field('user[name]', 'Tobi')
.field('user[email]', 'tobi@learnboost.com')
.attach('image', 'path/to/tobi.png')
.end(callback);
## Compression
The node client supports compressed responses, best of all, you don't have to do anything! It just works.
## Buffering responses
To force buffering of response bodies as `res.text` you may invoke `req.buffer()`. To undo the default of buffering for text responses such
as "text/plain", "text/html" etc you may invoke `req.buffer(false)`.
When buffered the `res.buffered` flag is provided, you may use this to
handle both buffered and unbuffered responses in the same callback.
## CORS
The `.withCredentials()` method enables the ability to send cookies
from the origin, however only when "Access-Control-Allow-Origin" is
_not_ a wildcard ("*"), and "Access-Control-Allow-Credentials" is "true".
request
.get('http://localhost:4001/')
.withCredentials()
.end(function(err, res){
assert(200 == res.status);
assert('tobi' == res.text);
next();
})
## Error handling
Your callback function will always be passed two arguments: error and response. If no error occurred, the first argument will be null:
request
.post('/upload')
.attach('image', 'path/to/tobi.png')
.end(function(err, res){
});
An "error" event is also emitted, with you can listen for:
request
.post('/upload')
.attach('image', 'path/to/tobi.png')
.on('error', handle)
.end(function(err, res){
});
Note that a 4xx or 5xx response with super agent **are** considered an error by default. For example if you get a 500 or 403 response, this status information will be available via `err.status`. Errors from such responses also contain an `err.response` field with all of the properties mentioned in "Response properties". The library behaves in this way to handle the common case of wanting success responses and treating HTTP error status codes as errors while still allowing for custom logic around specific error conditions.
Network failures, timeouts, and other errors that produce no response will contain no `err.status` or `err.response` fields.
If you wish to handle 404 or other HTTP error responses, you can query the `err.status` property.
When an HTTP error occurs (4xx or 5xx response) the `res.error` property is an `Error` object,
this allows you to perform checks such as:
if (err && err.status === 404) {
alert('oh no ' + res.body.message);
}
else if (err) {
// all other error types we handle generically
}
## Generator support
Superagent now supports easier control flow using generators. By using a generator control flow
like [co](https://github.com/tj/co) or a web framework like [koa](https://github.com/koajs/koa),
you can `yield` on any superagent method:
var res = yield request
.get('http://local')
.auth('tobi', 'learnboost')

6
node_modules/superagent/docs/jquery-ui.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

4
node_modules/superagent/docs/jquery.js generated vendored Normal file

File diff suppressed because one or more lines are too long

4
node_modules/superagent/docs/jquery.tocify.min.js generated vendored Executable file

File diff suppressed because one or more lines are too long

81
node_modules/superagent/docs/style.css generated vendored Normal file
View File

@ -0,0 +1,81 @@
body {
padding: 40px 80px;
font: 14px/1.5 "Helvetica Neue", Helvetica, sans-serif;
background: #181818 url(images/bg.png);
text-align: center;
}
#content {
margin: 0 auto;
padding: 10px 40px;
text-align: left;
background: white;
width: 50%;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0 2px 5px 0 black;
}
#menu {
font-size: 13px;
margin: 0;
padding: 0;
text-align: left;
position: fixed;
top: 15px;
left: 15px;
}
#menu ul {
margin: 0;
padding: 0;
}
#menu li {
list-style: none;
}
#menu a {
color: rgba(255,255,255,.5);
text-decoration: none;
}
#menu a:hover {
color: white;
}
#menu .active a {
color: white;
}
pre {
padding: 10px;
}
code {
font: 12px/1 monaco, monospace;
}
p code {
border: 1px solid #ECEA75;
padding: 1px 3px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
background: #FDFCD1;
}
pre {
padding: 20px 25px;
border: 1px solid #ddd;
-webkit-box-shadow: inset 0 0 5px #eee;
-moz-box-shadow: inset 0 0 5px #eee;
box-shadow: inset 0 0 5px #eee;
}
code .comment { color: #ddd }
code .init { color: #2F6FAD }
code .string { color: #5890AD }
code .keyword { color: #8A6343 }
code .number { color: #2F6FAD }

4
node_modules/superagent/docs/tail.html generated vendored Normal file
View File

@ -0,0 +1,4 @@
</div>
<a href="http://github.com/visionmedia/superagent"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub"></a>
</body>
</html>

2082
node_modules/superagent/docs/test.html generated vendored Normal file

File diff suppressed because it is too large Load Diff

1077
node_modules/superagent/lib/client.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

13
node_modules/superagent/lib/is-object.js generated vendored Normal file
View File

@ -0,0 +1,13 @@
/**
* Check if `obj` is an object.
*
* @param {Object} obj
* @return {Boolean}
* @api private
*/
function isObject(obj) {
return null != obj && 'object' == typeof obj;
}
module.exports = isObject;

82
node_modules/superagent/lib/node/agent.js generated vendored Normal file
View File

@ -0,0 +1,82 @@
/**
* Module dependencies.
*/
var CookieJar = require('cookiejar').CookieJar;
var CookieAccess = require('cookiejar').CookieAccessInfo;
var parse = require('url').parse;
var request = require('./index');
var methods = require('methods');
/**
* Expose `Agent`.
*/
module.exports = Agent;
/**
* Initialize a new `Agent`.
*
* @api public
*/
function Agent(options) {
if (!(this instanceof Agent)) return new Agent(options);
if (options) this._ca = options.ca;
this.jar = new CookieJar;
}
/**
* Save the cookies in the given `res` to
* the agent's cookie jar for persistence.
*
* @param {Response} res
* @api private
*/
Agent.prototype.saveCookies = function(res){
var cookies = res.headers['set-cookie'];
if (cookies) this.jar.setCookies(cookies);
};
/**
* Attach cookies when available to the given `req`.
*
* @param {Request} req
* @api private
*/
Agent.prototype.attachCookies = function(req){
var url = parse(req.url);
var access = CookieAccess(url.hostname, url.pathname, 'https:' == url.protocol);
var cookies = this.jar.getCookies(access).toValueString();
req.cookies = cookies;
};
// generate HTTP verb methods
if (methods.indexOf('del') == -1) {
// create a copy so we don't cause conflicts with
// other packages using the methods package and
// npm 3.x
methods = methods.slice(0);
methods.push('del');
}
methods.forEach(function(method){
var name = method;
method = 'del' == method ? 'delete' : method;
method = method.toUpperCase();
Agent.prototype[name] = function(url, fn){
var req = request(method, url);
req.ca(this._ca);
req.on('response', this.saveCookies.bind(this));
req.on('redirect', this.saveCookies.bind(this));
req.on('redirect', this.attachCookies.bind(this, req));
this.attachCookies(req);
fn && req.end(fn);
return req;
};
});

1093
node_modules/superagent/lib/node/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

10
node_modules/superagent/lib/node/parsers/image.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
module.exports = function(res, fn){
var data = []; // Binary data needs binary storage
res.on('data', function(chunk){
data.push(chunk);
});
res.on('end', function () {
fn(null, Buffer.concat(data));
});
};

5
node_modules/superagent/lib/node/parsers/index.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
exports['application/x-www-form-urlencoded'] = require('./urlencoded');
exports['application/json'] = require('./json');
exports.text = require('./text');
exports.image = require('./image');

19
node_modules/superagent/lib/node/parsers/json.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
module.exports = function parseJSON(res, fn){
res.text = '';
res.setEncoding('utf8');
res.on('data', function(chunk){ res.text += chunk;});
res.on('end', function(){
try {
var body = res.text && JSON.parse(res.text);
} catch (e) {
var err = e;
// issue #675: return the raw response if the response parsing fails
err.rawResponse = res.text || null;
// issue #876: return the http status code if the response parsing fails
err.statusCode = res.statusCode;
} finally {
fn(err, body);
}
});
};

7
node_modules/superagent/lib/node/parsers/text.js generated vendored Normal file
View File

@ -0,0 +1,7 @@
module.exports = function(res, fn){
res.text = '';
res.setEncoding('utf8');
res.on('data', function(chunk){ res.text += chunk; });
res.on('end', fn);
};

19
node_modules/superagent/lib/node/parsers/urlencoded.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
/**
* Module dependencies.
*/
var qs = require('qs');
module.exports = function(res, fn){
res.text = '';
res.setEncoding('ascii');
res.on('data', function(chunk){ res.text += chunk; });
res.on('end', function(){
try {
fn(null, qs.parse(res.text));
} catch (err) {
fn(err);
}
});
};

149
node_modules/superagent/lib/node/part.js generated vendored Normal file
View File

@ -0,0 +1,149 @@
/**
* Module dependencies.
*/
var util = require('util');
var mime = require('mime');
var FormData = require('form-data');
var PassThrough = require('readable-stream/passthrough');
/**
* Initialize a new `Part` for the given `req`.
*
* @param {Request} req
* @api public
* @deprecated pass a readable stream in to `Request#attach()` instead
*/
var Part = function (req) {
PassThrough.call(this);
this._req = req;
this._attached = false;
this._name = null;
this._type = null;
this._header = null;
this._filename = null;
this.once('pipe', this._attach.bind(this));
};
Part = util.deprecate(Part, 'The `Part()` constructor is deprecated. ' +
'Pass a readable stream in to `Request#attach()` instead.');
/**
* Inherit from `PassThrough`.
*/
util.inherits(Part, PassThrough);
/**
* Expose `Part`.
*/
module.exports = Part;
/**
* Set header `field` to `val`.
*
* @param {String} field
* @param {String} val
* @return {Part} for chaining
* @api public
*/
Part.prototype.set = function(field, val){
//if (!this._header) this._header = {};
//this._header[field] = val;
//return this;
throw new TypeError('setting custom form-data part headers is unsupported');
};
/**
* Set _Content-Type_ response header passed through `mime.lookup()`.
*
* Examples:
*
* res.type('html');
* res.type('.html');
*
* @param {String} type
* @return {Part} for chaining
* @api public
*/
Part.prototype.type = function(type){
var lookup = mime.lookup(type);
this._type = lookup;
//this.set('Content-Type', lookup);
return this;
};
/**
* Set the "name" portion for the _Content-Disposition_ header field.
*
* @param {String} name
* @return {Part} for chaining
* @api public
*/
Part.prototype.name = function(name){
this._name = name;
return this;
};
/**
* Set _Content-Disposition_ header field to _attachment_ with `filename`
* and field `name`.
*
* @param {String} name
* @param {String} filename
* @return {Part} for chaining
* @api public
*/
Part.prototype.attachment = function(name, filename){
this.name(name);
if (filename) {
this.type(filename);
this._filename = filename;
}
return this;
};
/**
* Calls `FormData#append()` on the Request instance's FormData object.
*
* Gets called implicitly upon the first `write()` call, or the "pipe" event.
*
* @api private
*/
Part.prototype._attach = function(){
if (this._attached) return;
this._attached = true;
if (!this._name) throw new Error('must call `Part#name()` first!');
// add `this` Stream's readable side as a stream for this Part
this._req._getFormData().append(this._name, this, {
contentType: this._type,
filename: this._filename
});
// restore PassThrough's default `write()` function now that we're setup
this.write = PassThrough.prototype.write;
};
/**
* Write `data` with `encoding`.
*
* @param {Buffer|String} data
* @param {String} encoding
* @return {Boolean}
* @api public
*/
Part.prototype.write = function(){
this._attach();
return this.write.apply(this, arguments);
};

210
node_modules/superagent/lib/node/response.js generated vendored Normal file
View File

@ -0,0 +1,210 @@
/**
* Module dependencies.
*/
var util = require('util');
var utils = require('./utils');
var Stream = require('stream');
/**
* Expose `Response`.
*/
module.exports = Response;
/**
* Initialize a new `Response` with the given `xhr`.
*
* - set flags (.ok, .error, etc)
* - parse header
*
* @param {Request} req
* @param {Object} options
* @constructor
* @extends {Stream}
* @implements {ReadableStream}
* @api private
*/
function Response(req, options) {
Stream.call(this);
options = options || {};
var res = this.res = req.res;
this.request = req;
this.req = req.req;
this.links = {};
this.text = res.text;
this.body = res.body !== undefined ? res.body : {};
this.files = res.files || {};
this.buffered = 'string' == typeof this.text;
this.header = this.headers = res.headers;
this.setStatusProperties(res.statusCode);
this.setHeaderProperties(this.header);
this.setEncoding = res.setEncoding.bind(res);
res.on('data', this.emit.bind(this, 'data'));
res.on('end', this.emit.bind(this, 'end'));
res.on('close', this.emit.bind(this, 'close'));
res.on('error', this.emit.bind(this, 'error'));
}
/**
* Inherit from `Stream`.
*/
util.inherits(Response, Stream);
/**
* Get case-insensitive `field` value.
*
* @param {String} field
* @return {String}
* @api public
*/
Response.prototype.get = function(field){
return this.header[field.toLowerCase()];
};
/**
* Implements methods of a `ReadableStream`
*/
Response.prototype.destroy = function(err){
this.res.destroy(err);
};
/**
* Pause.
*/
Response.prototype.pause = function(){
this.res.pause();
};
/**
* Resume.
*/
Response.prototype.resume = function(){
this.res.resume();
};
/**
* Return an `Error` representative of this response.
*
* @return {Error}
* @api public
*/
Response.prototype.toError = function(){
var req = this.req;
var method = req.method;
var path = req.path;
var msg = 'cannot ' + method + ' ' + path + ' (' + this.status + ')';
var err = new Error(msg);
err.status = this.status;
err.text = this.text;
err.method = method;
err.path = path;
return err;
};
/**
* Set header related properties:
*
* - `.type` the content type without params
*
* A response of "Content-Type: text/plain; charset=utf-8"
* will provide you with a `.type` of "text/plain".
*
* @param {Object} header
* @api private
*/
Response.prototype.setHeaderProperties = function(header){
// TODO: moar!
// TODO: make this a util
// content-type
var ct = this.header['content-type'] || '';
// params
var params = utils.params(ct);
for (var key in params) this[key] = params[key];
this.type = utils.type(ct);
// links
try {
if (header.link) this.links = utils.parseLinks(header.link);
} catch (err) {
// ignore
}
};
/**
* Set flags such as `.ok` based on `status`.
*
* For example a 2xx response will give you a `.ok` of __true__
* whereas 5xx will be __false__ and `.error` will be __true__. The
* `.clientError` and `.serverError` are also available to be more
* specific, and `.statusType` is the class of error ranging from 1..5
* sometimes useful for mapping respond colors etc.
*
* "sugar" properties are also defined for common cases. Currently providing:
*
* - .noContent
* - .badRequest
* - .unauthorized
* - .notAcceptable
* - .notFound
*
* @param {Number} status
* @api private
*/
Response.prototype.setStatusProperties = function(status){
var type = status / 100 | 0;
// status / class
this.status = this.statusCode = status;
this.statusType = type;
// basics
this.info = 1 == type;
this.ok = 2 == type;
this.redirect = 3 == type;
this.clientError = 4 == type;
this.serverError = 5 == type;
this.error = (4 == type || 5 == type)
? this.toError()
: false;
// sugar
this.accepted = 202 == status;
this.noContent = 204 == status;
this.badRequest = 400 == status;
this.unauthorized = 401 == status;
this.notAcceptable = 406 == status;
this.forbidden = 403 == status;
this.notFound = 404 == status;
};
/**
* To json.
*
* @return {Object}
* @api public
*/
Response.prototype.toJSON = function(){
return {
req: this.request.toJSON(),
header: this.header,
status: this.status,
text: this.text
};
};

142
node_modules/superagent/lib/node/utils.js generated vendored Normal file
View File

@ -0,0 +1,142 @@
/**
* Module dependencies.
*/
var StringDecoder = require('string_decoder').StringDecoder;
var Stream = require('stream');
var zlib;
/**
* Require zlib module for Node 0.6+
*/
try {
zlib = require('zlib');
} catch (e) { }
/**
* Return the mime type for the given `str`.
*
* @param {String} str
* @return {String}
* @api private
*/
exports.type = function(str){
return str.split(/ *; */).shift();
};
/**
* Return header field parameters.
*
* @param {String} str
* @return {Object}
* @api private
*/
exports.params = function(str){
return str.split(/ *; */).reduce(function(obj, str){
var parts = str.split(/ *= */);
var key = parts.shift();
var val = parts.shift();
if (key && val) obj[key] = val;
return obj;
}, {});
};
/**
* Parse Link header fields.
*
* @param {String} str
* @return {Object}
* @api private
*/
exports.parseLinks = function(str){
return str.split(/ *, */).reduce(function(obj, str){
var parts = str.split(/ *; */);
var url = parts[0].slice(1, -1);
var rel = parts[1].split(/ *= */)[1].slice(1, -1);
obj[rel] = url;
return obj;
}, {});
};
/**
* Buffers response data events and re-emits when they're unzipped.
*
* @param {Request} req
* @param {Response} res
* @api private
*/
exports.unzip = function(req, res){
if (!zlib) return;
var unzip = zlib.createUnzip();
var stream = new Stream;
var decoder;
// make node responseOnEnd() happy
stream.req = req;
unzip.on('error', function(err){
stream.emit('error', err);
});
// pipe to unzip
res.pipe(unzip);
// override `setEncoding` to capture encoding
res.setEncoding = function(type){
decoder = new StringDecoder(type);
};
// decode upon decompressing with captured encoding
unzip.on('data', function(buf){
if (decoder) {
var str = decoder.write(buf);
if (str.length) stream.emit('data', str);
} else {
stream.emit('data', buf);
}
});
unzip.on('end', function(){
stream.emit('end');
});
// override `on` to capture data listeners
var _on = res.on;
res.on = function(type, fn){
if ('data' == type || 'end' == type) {
stream.on(type, fn);
} else if ('error' == type) {
stream.on(type, fn);
_on.call(res, type, fn);
} else {
_on.call(res, type, fn);
}
};
};
/**
* Strip content related fields from `header`.
*
* @param {Object} header
* @return {Object} header
* @api private
*/
exports.cleanHeader = function(header, shouldStripCookie){
delete header['content-type'];
delete header['content-length'];
delete header['transfer-encoding'];
delete header['host'];
if (shouldStripCookie) {
delete header['cookie'];
}
return header;
};

166
node_modules/superagent/lib/request-base.js generated vendored Normal file
View File

@ -0,0 +1,166 @@
/**
* Module of mixed-in functions shared between node and client code
*/
var isObject = require('./is-object');
/**
* Clear previous timeout.
*
* @return {Request} for chaining
* @api public
*/
exports.clearTimeout = function _clearTimeout(){
this._timeout = 0;
clearTimeout(this._timer);
return this;
};
/**
* Force given parser
*
* Sets the body parser no matter type.
*
* @param {Function}
* @api public
*/
exports.parse = function parse(fn){
this._parser = fn;
return this;
};
/**
* Set timeout to `ms`.
*
* @param {Number} ms
* @return {Request} for chaining
* @api public
*/
exports.timeout = function timeout(ms){
this._timeout = ms;
return this;
};
/**
* Faux promise support
*
* @param {Function} fulfill
* @param {Function} reject
* @return {Request}
*/
exports.then = function then(fulfill, reject) {
return this.end(function(err, res) {
err ? reject(err) : fulfill(res);
});
}
/**
* Allow for extension
*/
exports.use = function use(fn) {
fn(this);
return this;
}
/**
* Get request header `field`.
* Case-insensitive.
*
* @param {String} field
* @return {String}
* @api public
*/
exports.get = function(field){
return this._header[field.toLowerCase()];
};
/**
* Get case-insensitive header `field` value.
* This is a deprecated internal API. Use `.get(field)` instead.
*
* (getHeader is no longer used internally by the superagent code base)
*
* @param {String} field
* @return {String}
* @api private
* @deprecated
*/
exports.getHeader = exports.get;
/**
* Set header `field` to `val`, or multiple fields with one object.
* Case-insensitive.
*
* Examples:
*
* req.get('/')
* .set('Accept', 'application/json')
* .set('X-API-Key', 'foobar')
* .end(callback);
*
* req.get('/')
* .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
* .end(callback);
*
* @param {String|Object} field
* @param {String} val
* @return {Request} for chaining
* @api public
*/
exports.set = function(field, val){
if (isObject(field)) {
for (var key in field) {
this.set(key, field[key]);
}
return this;
}
this._header[field.toLowerCase()] = val;
this.header[field] = val;
return this;
};
/**
* Remove header `field`.
* Case-insensitive.
*
* Example:
*
* req.get('/')
* .unset('User-Agent')
* .end(callback);
*
* @param {String} field
*/
exports.unset = function(field){
delete this._header[field.toLowerCase()];
delete this.header[field];
return this;
};
/**
* Write the field `name` and `val` for "multipart/form-data"
* request bodies.
*
* ``` js
* request.post('/upload')
* .field('foo', 'bar')
* .end(callback);
* ```
*
* @param {String} name
* @param {String|Blob|File|Buffer|fs.ReadStream} val
* @return {Request} for chaining
* @api public
*/
exports.field = function(name, val) {
this._getFormData().append(name, val);
return this;
};

32
node_modules/superagent/lib/request.js generated vendored Normal file
View File

@ -0,0 +1,32 @@
// The node and browser modules expose versions of this with the
// appropriate constructor function bound as first argument
/**
* Issue a request:
*
* Examples:
*
* request('GET', '/users').end(callback)
* request('/users').end(callback)
* request('/users', callback)
*
* @param {String} method
* @param {String|Function} url or callback
* @return {Request}
* @api public
*/
function request(RequestConstructor, method, url) {
// callback
if ('function' == typeof url) {
return new RequestConstructor('GET', method).end(url);
}
// url first
if (2 == arguments.length) {
return new RequestConstructor('GET', method);
}
return new RequestConstructor(method, url);
}
module.exports = request;

View File

@ -0,0 +1 @@
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve

11
node_modules/superagent/node_modules/debug/.eslintrc generated vendored Normal file
View File

@ -0,0 +1,11 @@
{
"env": {
"browser": true,
"node": true
},
"rules": {
"no-console": 0,
"no-empty": [1, { "allowEmptyCatch": true }]
},
"extends": "eslint:recommended"
}

View File

@ -0,0 +1,8 @@
support
test
examples
example
*.sock
dist
yarn.lock
coverage

14
node_modules/superagent/node_modules/debug/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,14 @@
language: node_js
node_js:
- "6"
- "5"
- "4"
install:
- make node_modules
script:
- make lint
- make test
- make coveralls

330
node_modules/superagent/node_modules/debug/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,330 @@
2.6.3 / 2017-03-13
==================
* Fix: Fix for 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

19
node_modules/superagent/node_modules/debug/LICENSE generated vendored Normal file
View File

@ -0,0 +1,19 @@
(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.

50
node_modules/superagent/node_modules/debug/Makefile generated vendored Normal file
View File

@ -0,0 +1,50 @@
# 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

312
node_modules/superagent/node_modules/debug/README.md generated vendored Normal file
View File

@ -0,0 +1,312 @@
# debug
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#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:
![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
#### 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.
![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
## 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/disabled 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:
![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
## 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 &lt;tj@vision-media.ca&gt;
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.

29
node_modules/superagent/node_modules/debug/bower.json generated vendored Normal file
View File

@ -0,0 +1,29 @@
{
"name": "visionmedia-debug",
"main": "./src/browser.js",
"homepage": "https://github.com/visionmedia/debug",
"authors": [
"TJ Holowaychuk <tj@vision-media.ca>",
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
"Andrew Rhyne <rhyneandrew@gmail.com>"
],
"description": "visionmedia-debug",
"moduleType": [
"amd",
"es6",
"globals",
"node"
],
"keywords": [
"visionmedia",
"debug"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

View File

@ -0,0 +1,19 @@
{
"name": "debug",
"repo": "visionmedia/debug",
"description": "small debugging utility",
"version": "2.6.3",
"keywords": [
"debug",
"log",
"debugger"
],
"main": "src/browser.js",
"scripts": [
"src/browser.js",
"src/debug.js"
],
"dependencies": {
"rauchg/ms.js": "0.7.1"
}
}

View File

@ -0,0 +1,70 @@
// 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
node_modules/superagent/node_modules/debug/node.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./src/node');

124
node_modules/superagent/node_modules/debug/package.json generated vendored Normal file
View File

@ -0,0 +1,124 @@
{
"_args": [
[
{
"raw": "debug@2",
"scope": null,
"escapedName": "debug",
"name": "debug",
"rawSpec": "2",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"/home/burchettm/statsbot/node_modules/superagent"
]
],
"_from": "debug@>=2.0.0 <3.0.0",
"_id": "debug@2.6.3",
"_inCache": true,
"_location": "/superagent/debug",
"_nodeVersion": "6.9.2",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/debug-2.6.3.tgz_1489463433800_0.9440390267409384"
},
"_npmUser": {
"name": "thebigredgeek",
"email": "rhyneandrew@gmail.com"
},
"_npmVersion": "3.10.9",
"_phantomChildren": {},
"_requested": {
"raw": "debug@2",
"scope": null,
"escapedName": "debug",
"name": "debug",
"rawSpec": "2",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/superagent"
],
"_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.3.tgz",
"_shasum": "0f7eb8c30965ec08c72accfa0130c8b79984141d",
"_shrinkwrap": null,
"_spec": "debug@2",
"_where": "/home/burchettm/statsbot/node_modules/superagent",
"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": "0.7.2"
},
"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"
},
"directories": {},
"dist": {
"shasum": "0f7eb8c30965ec08c72accfa0130c8b79984141d",
"tarball": "https://registry.npmjs.org/debug/-/debug-2.6.3.tgz"
},
"gitHead": "9dc30f8378cc12192635cc6a31f0d96bb39be8bb",
"homepage": "https://github.com/visionmedia/debug#readme",
"keywords": [
"debug",
"log",
"debugger"
],
"license": "MIT",
"main": "./src/index.js",
"maintainers": [
{
"name": "thebigredgeek",
"email": "rhyneandrew@gmail.com"
}
],
"name": "debug",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/visionmedia/debug.git"
},
"scripts": {},
"version": "2.6.3"
}

View File

@ -0,0 +1,185 @@
/**
* 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 && typeof window.process !== 'undefined' && 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 && 'WebkitAppearance' in document.documentElement.style) ||
// is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) ||
// is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator && 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 && 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) {}
}

202
node_modules/superagent/node_modules/debug/src/debug.js generated vendored Normal file
View File

@ -0,0 +1,202 @@
/**
* 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 = (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;
}

View File

@ -0,0 +1,10 @@
/**
* 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');
}

241
node_modules/superagent/node_modules/debug/src/node.js generated vendored Normal file
View File

@ -0,0 +1,241 @@
/**
* 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)
.replace(/\s*\n\s*/g, ' ');
};
/**
* 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 = util._extend({}, exports.inspectOpts);
}
/**
* Enable namespaces listed in `process.env.DEBUG` initially.
*/
exports.enable(load());

182
node_modules/superagent/package.json generated vendored Normal file
View File

@ -0,0 +1,182 @@
{
"_args": [
[
{
"raw": "superagent@^1.4.0",
"scope": null,
"escapedName": "superagent",
"name": "superagent",
"rawSpec": "^1.4.0",
"spec": ">=1.4.0 <2.0.0",
"type": "range"
},
"/home/burchettm/statsbot/node_modules/discordie"
]
],
"_from": "superagent@>=1.4.0 <2.0.0",
"_id": "superagent@1.8.5",
"_inCache": true,
"_location": "/superagent",
"_nodeVersion": "7.2.1",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/superagent-1.8.5.tgz_1481494456683_0.23376551712863147"
},
"_npmUser": {
"name": "kornel",
"email": "pornel@pornel.net"
},
"_npmVersion": "4.0.5",
"_phantomChildren": {
"ms": "0.7.2"
},
"_requested": {
"raw": "superagent@^1.4.0",
"scope": null,
"escapedName": "superagent",
"name": "superagent",
"rawSpec": "^1.4.0",
"spec": ">=1.4.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/discordie"
],
"_resolved": "https://registry.npmjs.org/superagent/-/superagent-1.8.5.tgz",
"_shasum": "1c0ddc3af30e80eb84ebc05cb2122da8fe940b55",
"_shrinkwrap": null,
"_spec": "superagent@^1.4.0",
"_where": "/home/burchettm/statsbot/node_modules/discordie",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
"browser": {
"./lib/node/index.js": "./lib/client.js",
"emitter": "component-emitter",
"reduce": "reduce-component",
"./test/support/server.js": "./test/support/blank.js"
},
"bugs": {
"url": "https://github.com/visionmedia/superagent/issues"
},
"component": {
"scripts": {
"superagent": "lib/client.js"
}
},
"contributors": [
{
"name": "Kornel Lesiński",
"email": "kornel@geekhood.net"
},
{
"name": "Peter Lyons",
"email": "pete@peterlyons.com"
},
{
"name": "Hunter Loftis",
"email": "hunter@hunterloftis.com"
}
],
"dependencies": {
"component-emitter": "~1.2.0",
"cookiejar": "2.0.6",
"debug": "2",
"extend": "3.0.0",
"form-data": "1.0.0-rc3",
"formidable": "~1.0.14",
"methods": "~1.1.1",
"mime": "1.3.4",
"qs": "2.3.3",
"readable-stream": "1.0.27-1",
"reduce-component": "1.0.1"
},
"description": "elegant & feature rich browser / node HTTP with a fluent API",
"devDependencies": {
"Base64": "~0.3.0",
"basic-auth-connect": "~1.0.0",
"better-assert": "~1.0.1",
"body-parser": "~1.9.2",
"browserify": "~6.3.2",
"cookie-parser": "~1.3.3",
"express": "~4.9.8",
"express-session": "~1.9.1",
"marked": "0.3.5",
"mocha": "~2.0.1",
"should": "~3.1.3",
"zuul": "~1.19.0"
},
"directories": {},
"dist": {
"shasum": "1c0ddc3af30e80eb84ebc05cb2122da8fe940b55",
"tarball": "https://registry.npmjs.org/superagent/-/superagent-1.8.5.tgz"
},
"engines": {
"node": ">= 0.8"
},
"gitHead": "21ce90ec63f33827e7208131dd36a9ac8c6c7d00",
"homepage": "https://github.com/visionmedia/superagent#readme",
"keywords": [
"http",
"ajax",
"request",
"agent"
],
"license": "MIT",
"main": "./lib/node/index.js",
"maintainers": [
{
"name": "defunctzombie",
"email": "shtylman@gmail.com"
},
{
"name": "kof",
"email": "oleg008@gmail.com"
},
{
"name": "kornel",
"email": "pornel@pornel.net"
},
{
"name": "naman34",
"email": "naman34@gmail.com"
},
{
"name": "nw",
"email": "nw@nwhite.net"
},
{
"name": "rauchg",
"email": "rauchg@gmail.com"
},
{
"name": "superjoe",
"email": "superjoe30@gmail.com"
},
{
"name": "tjholowaychuk",
"email": "tj@vision-media.ca"
},
{
"name": "travisjeffery",
"email": "tj@travisjeffery.com"
},
{
"name": "yields",
"email": "yields@icloud.com"
}
],
"name": "superagent",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/visionmedia/superagent.git"
},
"scripts": {
"prepublish": "make all",
"test": "make test"
},
"version": "1.8.5"
}

1488
node_modules/superagent/superagent.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

3713
node_modules/superagent/yarn-error.log generated vendored Normal file

File diff suppressed because it is too large Load Diff

2631
node_modules/superagent/yarn.lock generated vendored Normal file

File diff suppressed because it is too large Load Diff