Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2015-10-15 08:17:03 +0300
committerRebecca Turner <me@re-becca.org>2015-10-16 01:25:33 +0300
commit25a234b4595ee3f1a2c09e2a39e3c238aa642557 (patch)
treedef772e3c15c7bd3d0b05eeeb6069898617cbf23 /node_modules/form-data
parent4cd74b0cdc639081fcf292eb9a03dbd93451c7c0 (diff)
src: install npm@3 with npm@2
Restore the ability to do one-shot upgrades from the versions of npm bundled with Node 0.8 to npm@3, which simplifies using Travis with old Node and new npm, for compatibility testing purposes. Older versions of npm repack packages on install, which works poorly with the way npm@3 handles bundledDependencies with flat trees. Fixes: #9668 PR-URL: https://github.com/npm/npm/pull/9981
Diffstat (limited to 'node_modules/form-data')
-rw-r--r--node_modules/form-data/License19
-rw-r--r--node_modules/form-data/Readme.md210
-rw-r--r--node_modules/form-data/lib/browser.js1
-rw-r--r--node_modules/form-data/lib/form_data.js374
-rw-r--r--node_modules/form-data/package.json109
5 files changed, 0 insertions, 713 deletions
diff --git a/node_modules/form-data/License b/node_modules/form-data/License
deleted file mode 100644
index c7ff12a2f..000000000
--- a/node_modules/form-data/License
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
-
- 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.
diff --git a/node_modules/form-data/Readme.md b/node_modules/form-data/Readme.md
deleted file mode 100644
index 492773231..000000000
--- a/node_modules/form-data/Readme.md
+++ /dev/null
@@ -1,210 +0,0 @@
-# Form-Data [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) [![Build Status](https://img.shields.io/travis/form-data/form-data/master.svg)](https://travis-ci.org/form-data/form-data) [![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data)
-
-A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
-
-The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
-
-[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
-[streams2-thing]: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions
-
-## Install
-
-```
-npm install form-data
-```
-
-## Usage
-
-In this example we are constructing a form with 3 fields that contain a string,
-a buffer and a file stream.
-
-``` javascript
-var FormData = require('form-data');
-var fs = require('fs');
-
-var form = new FormData();
-form.append('my_field', 'my value');
-form.append('my_buffer', new Buffer(10));
-form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
-```
-
-Also you can use http-response stream:
-
-``` javascript
-var FormData = require('form-data');
-var http = require('http');
-
-var form = new FormData();
-
-http.request('http://nodejs.org/images/logo.png', function(response) {
- form.append('my_field', 'my value');
- form.append('my_buffer', new Buffer(10));
- form.append('my_logo', response);
-});
-```
-
-Or @mikeal's [request](https://github.com/request/request) stream:
-
-``` javascript
-var FormData = require('form-data');
-var request = require('request');
-
-var form = new FormData();
-
-form.append('my_field', 'my value');
-form.append('my_buffer', new Buffer(10));
-form.append('my_logo', request('http://nodejs.org/images/logo.png'));
-```
-
-In order to submit this form to a web application, call ```submit(url, [callback])``` method:
-
-``` javascript
-form.submit('http://example.org/', function(err, res) {
- // res – response object (http.IncomingMessage) //
- res.resume();
-});
-
-```
-
-For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
-
-### Alternative submission methods
-
-You can use node's http client interface:
-
-``` javascript
-var http = require('http');
-
-var request = http.request({
- method: 'post',
- host: 'example.org',
- path: '/upload',
- headers: form.getHeaders()
-});
-
-form.pipe(request);
-
-request.on('response', function(res) {
- console.log(res.statusCode);
-});
-```
-
-Or if you would prefer the `'Content-Length'` header to be set for you:
-
-``` javascript
-form.submit('example.org/upload', function(err, res) {
- console.log(res.statusCode);
-});
-```
-
-To use custom headers and pre-known length in parts:
-
-``` javascript
-var CRLF = '\r\n';
-var form = new FormData();
-
-var options = {
- header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,
- knownLength: 1
-};
-
-form.append('my_buffer', buffer, options);
-
-form.submit('http://example.com/', function(err, res) {
- if (err) throw err;
- console.log('Done');
-});
-```
-
-Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
-
-``` javascript
-someModule.stream(function(err, stdout, stderr) {
- if (err) throw err;
-
- var form = new FormData();
-
- form.append('file', stdout, {
- filename: 'unicycle.jpg',
- contentType: 'image/jpg',
- knownLength: 19806
- });
-
- form.submit('http://example.com/', function(err, res) {
- if (err) throw err;
- console.log('Done');
- });
-});
-```
-
-For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
-
-``` javascript
-form.submit({
- host: 'example.com',
- path: '/probably.php?extra=params',
- auth: 'username:password'
-}, function(err, res) {
- console.log(res.statusCode);
-});
-```
-
-In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
-
-``` javascript
-form.submit({
- host: 'example.com',
- path: '/surelynot.php',
- headers: {'x-test-header': 'test-header-value'}
-}, function(err, res) {
- console.log(res.statusCode);
-});
-```
-
-### Integration with other libraries
-
-#### Request
-
-Form submission using [request](https://github.com/request/request):
-
-```javascript
-var formData = {
- my_field: 'my_value',
- my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),
-};
-
-request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) {
- if (err) {
- return console.error('upload failed:', err);
- }
- console.log('Upload successful! Server responded with:', body);
-});
-```
-
-For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads).
-
-#### node-fetch
-
-You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch):
-
-```javascript
-var form = new FormData();
-
-form.append('a', 1);
-
-fetch('http://example.com', { method: 'POST', body: form })
- .then(function(res) {
- return res.json();
- }).then(function(json) {
- console.log(json);
- });
-```
-
-## Notes
-
-- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
-- If it feels like FormData hangs after submit and you're on ```node-0.10```, please check [Compatibility with Older Node Versions][streams2-thing]
-
-## License
-
-Form-Data is licensed under the MIT license.
diff --git a/node_modules/form-data/lib/browser.js b/node_modules/form-data/lib/browser.js
deleted file mode 100644
index 1e7717d56..000000000
--- a/node_modules/form-data/lib/browser.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = FormData; \ No newline at end of file
diff --git a/node_modules/form-data/lib/form_data.js b/node_modules/form-data/lib/form_data.js
deleted file mode 100644
index 524f392b4..000000000
--- a/node_modules/form-data/lib/form_data.js
+++ /dev/null
@@ -1,374 +0,0 @@
-var CombinedStream = require('combined-stream');
-var util = require('util');
-var path = require('path');
-var http = require('http');
-var https = require('https');
-var parseUrl = require('url').parse;
-var fs = require('fs');
-var mime = require('mime-types');
-var async = require('async');
-
-module.exports = FormData;
-function FormData() {
- this._overheadLength = 0;
- this._valueLength = 0;
- this._lengthRetrievers = [];
-
- CombinedStream.call(this);
-}
-util.inherits(FormData, CombinedStream);
-
-FormData.LINE_BREAK = '\r\n';
-FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
-
-FormData.prototype.append = function(field, value, options) {
- options = (typeof options === 'string')
- ? { filename: options }
- : options || {};
-
- var append = CombinedStream.prototype.append.bind(this);
-
- // all that streamy business can't handle numbers
- if (typeof value == 'number') value = ''+value;
-
- // https://github.com/felixge/node-form-data/issues/38
- if (util.isArray(value)) {
- // Please convert your array into string
- // the way web server expects it
- this._error(new Error('Arrays are not supported.'));
- return;
- }
-
- var header = this._multiPartHeader(field, value, options);
- var footer = this._multiPartFooter(field, value, options);
-
- append(header);
- append(value);
- append(footer);
-
- // pass along options.knownLength
- this._trackLength(header, value, options);
-};
-
-FormData.prototype._trackLength = function(header, value, options) {
- var valueLength = 0;
-
- // used w/ getLengthSync(), when length is known.
- // e.g. for streaming directly from a remote server,
- // w/ a known file a size, and not wanting to wait for
- // incoming file to finish to get its size.
- if (options.knownLength != null) {
- valueLength += +options.knownLength;
- } else if (Buffer.isBuffer(value)) {
- valueLength = value.length;
- } else if (typeof value === 'string') {
- valueLength = Buffer.byteLength(value);
- }
-
- this._valueLength += valueLength;
-
- // @check why add CRLF? does this account for custom/multiple CRLFs?
- this._overheadLength +=
- Buffer.byteLength(header) +
- FormData.LINE_BREAK.length;
-
- // empty or either doesn't have path or not an http response
- if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
- return;
- }
-
- // no need to bother with the length
- if (!options.knownLength)
- this._lengthRetrievers.push(function(next) {
-
- if (value.hasOwnProperty('fd')) {
-
- // take read range into a account
- // `end` = Infinity –> read file till the end
- //
- // TODO: Looks like there is bug in Node fs.createReadStream
- // it doesn't respect `end` options without `start` options
- // Fix it when node fixes it.
- // https://github.com/joyent/node/issues/7819
- if (value.end != undefined && value.end != Infinity && value.start != undefined) {
-
- // when end specified
- // no need to calculate range
- // inclusive, starts with 0
- next(null, value.end+1 - (value.start ? value.start : 0));
-
- // not that fast snoopy
- } else {
- // still need to fetch file size from fs
- fs.stat(value.path, function(err, stat) {
-
- var fileSize;
-
- if (err) {
- next(err);
- return;
- }
-
- // update final size based on the range options
- fileSize = stat.size - (value.start ? value.start : 0);
- next(null, fileSize);
- });
- }
-
- // or http response
- } else if (value.hasOwnProperty('httpVersion')) {
- next(null, +value.headers['content-length']);
-
- // or request stream http://github.com/mikeal/request
- } else if (value.hasOwnProperty('httpModule')) {
- // wait till response come back
- value.on('response', function(response) {
- value.pause();
- next(null, +response.headers['content-length']);
- });
- value.resume();
-
- // something else
- } else {
- next('Unknown stream');
- }
- });
-};
-
-FormData.prototype._multiPartHeader = function(field, value, options) {
- // custom header specified (as string)?
- // it becomes responsible for boundary
- // (e.g. to handle extra CRLFs on .NET servers)
- if (options.header != null) {
- return options.header;
- }
-
- var contents = '';
- var headers = {
- 'Content-Disposition': ['form-data', 'name="' + field + '"'],
- 'Content-Type': []
- };
-
- // fs- and request- streams have path property
- // or use custom filename and/or contentType
- // TODO: Use request's response mime-type
- if (options.filename || value.path) {
- headers['Content-Disposition'].push(
- 'filename="' + path.basename(options.filename || value.path) + '"'
- );
- headers['Content-Type'].push(
- options.contentType ||
- mime.lookup(options.filename || value.path) ||
- FormData.DEFAULT_CONTENT_TYPE
- );
- // http response has not
- } else if (value.readable && value.hasOwnProperty('httpVersion')) {
- headers['Content-Disposition'].push(
- 'filename="' + path.basename(value.client._httpMessage.path) + '"'
- );
- headers['Content-Type'].push(
- options.contentType ||
- value.headers['content-type'] ||
- FormData.DEFAULT_CONTENT_TYPE
- );
- } else if (Buffer.isBuffer(value)) {
- headers['Content-Type'].push(
- options.contentType ||
- FormData.DEFAULT_CONTENT_TYPE
- );
- } else if (options.contentType) {
- headers['Content-Type'].push(options.contentType);
- }
-
- for (var prop in headers) {
- if (headers[prop].length) {
- contents += prop + ': ' + headers[prop].join('; ') + FormData.LINE_BREAK;
- }
- }
-
- return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
-};
-
-FormData.prototype._multiPartFooter = function(field, value, options) {
- return function(next) {
- var footer = FormData.LINE_BREAK;
-
- var lastPart = (this._streams.length === 0);
- if (lastPart) {
- footer += this._lastBoundary();
- }
-
- next(footer);
- }.bind(this);
-};
-
-FormData.prototype._lastBoundary = function() {
- return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
-};
-
-FormData.prototype.getHeaders = function(userHeaders) {
- var formHeaders = {
- 'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
- };
-
- for (var header in userHeaders) {
- formHeaders[header.toLowerCase()] = userHeaders[header];
- }
-
- return formHeaders;
-}
-
-FormData.prototype.getCustomHeaders = function(contentType) {
- contentType = contentType ? contentType : 'multipart/form-data';
-
- var formHeaders = {
- 'content-type': contentType + '; boundary=' + this.getBoundary(),
- 'content-length': this.getLengthSync()
- };
-
- return formHeaders;
-}
-
-FormData.prototype.getBoundary = function() {
- if (!this._boundary) {
- this._generateBoundary();
- }
-
- return this._boundary;
-};
-
-FormData.prototype._generateBoundary = function() {
- // This generates a 50 character boundary similar to those used by Firefox.
- // They are optimized for boyer-moore parsing.
- var boundary = '--------------------------';
- for (var i = 0; i < 24; i++) {
- boundary += Math.floor(Math.random() * 10).toString(16);
- }
-
- this._boundary = boundary;
-};
-
-// Note: getLengthSync DOESN'T calculate streams length
-// As workaround one can calculate file size manually
-// and add it as knownLength option
-FormData.prototype.getLengthSync = function(debug) {
- var knownLength = this._overheadLength + this._valueLength;
-
- // Don't get confused, there are 3 "internal" streams for each keyval pair
- // so it basically checks if there is any value added to the form
- if (this._streams.length) {
- knownLength += this._lastBoundary().length;
- }
-
- // https://github.com/felixge/node-form-data/issues/40
- if (this._lengthRetrievers.length) {
- // Some async length retrivers are present
- // therefore synchronous length calculation is false.
- // Please use getLength(callback) to get proper length
- this._error(new Error('Cannot calculate proper length in synchronous way.'));
- }
-
- return knownLength;
-};
-
-FormData.prototype.getLength = function(cb) {
- var knownLength = this._overheadLength + this._valueLength;
-
- if (this._streams.length) {
- knownLength += this._lastBoundary().length;
- }
-
- if (!this._lengthRetrievers.length) {
- process.nextTick(cb.bind(this, null, knownLength));
- return;
- }
-
- async.parallel(this._lengthRetrievers, function(err, values) {
- if (err) {
- cb(err);
- return;
- }
-
- values.forEach(function(length) {
- knownLength += length;
- });
-
- cb(null, knownLength);
- });
-};
-
-FormData.prototype.submit = function(params, cb) {
-
- var request
- , options
- , defaults = {
- method : 'post'
- };
-
- // parse provided url if it's string
- // or treat it as options object
- if (typeof params == 'string') {
- params = parseUrl(params);
-
- options = populate({
- port: params.port,
- path: params.pathname,
- host: params.hostname
- }, defaults);
- }
- else // use custom params
- {
- options = populate(params, defaults);
- // if no port provided use default one
- if (!options.port) {
- options.port = options.protocol == 'https:' ? 443 : 80;
- }
- }
-
- // put that good code in getHeaders to some use
- options.headers = this.getHeaders(params.headers);
-
- // https if specified, fallback to http in any other case
- if (options.protocol == 'https:') {
- request = https.request(options);
- } else {
- request = http.request(options);
- }
-
- // get content length and fire away
- this.getLength(function(err, length) {
-
- // TODO: Add chunked encoding when no length (if err)
-
- // add content length
- request.setHeader('Content-Length', length);
-
- this.pipe(request);
- if (cb) {
- request.on('error', cb);
- request.on('response', cb.bind(this, null));
- }
- }.bind(this));
-
- return request;
-};
-
-FormData.prototype._error = function(err) {
- if (this.error) return;
-
- this.error = err;
- this.pause();
- this.emit('error', err);
-};
-
-/*
- * Santa's little helpers
- */
-
-// populates missing values
-function populate(dst, src) {
- for (var prop in src) {
- if (!dst[prop]) dst[prop] = src[prop];
- }
- return dst;
-}
diff --git a/node_modules/form-data/package.json b/node_modules/form-data/package.json
deleted file mode 100644
index 01f179864..000000000
--- a/node_modules/form-data/package.json
+++ /dev/null
@@ -1,109 +0,0 @@
-{
- "_args": [
- [
- "form-data@1.0.0-rc3",
- "/Users/rebecca/code/npm"
- ]
- ],
- "_from": "form-data@1.0.0-rc3",
- "_id": "form-data@1.0.0-rc3",
- "_inCache": true,
- "_location": "/form-data",
- "_nodeVersion": "2.2.1",
- "_npmUser": {
- "email": "pierceydylan@gmail.com",
- "name": "dylanpiercey"
- },
- "_npmVersion": "2.11.0",
- "_phantomChildren": {},
- "_requested": {
- "name": "form-data",
- "raw": "form-data@1.0.0-rc3",
- "rawSpec": "1.0.0-rc3",
- "scope": null,
- "spec": "1.0.0-rc3",
- "type": "version"
- },
- "_requiredBy": [
- "/request"
- ],
- "_resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc3.tgz",
- "_shasum": "d35bc62e7fbc2937ae78f948aaa0d38d90607577",
- "_shrinkwrap": null,
- "_spec": "form-data@1.0.0-rc3",
- "_where": "/Users/rebecca/code/npm",
- "author": {
- "email": "felix@debuggable.com",
- "name": "Felix Geisendörfer",
- "url": "http://debuggable.com/"
- },
- "browser": "./lib/browser",
- "bugs": {
- "url": "https://github.com/form-data/form-data/issues"
- },
- "dependencies": {
- "async": "^1.4.0",
- "combined-stream": "^1.0.5",
- "mime-types": "^2.1.3"
- },
- "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
- "devDependencies": {
- "fake": "^0.2.2",
- "far": "^0.0.7",
- "formidable": "^1.0.17",
- "pre-commit": "^1.0.10",
- "request": "^2.60.0"
- },
- "directories": {},
- "dist": {
- "shasum": "d35bc62e7fbc2937ae78f948aaa0d38d90607577",
- "tarball": "http://registry.npmjs.org/form-data/-/form-data-1.0.0-rc3.tgz"
- },
- "engines": {
- "node": ">= 0.10"
- },
- "gitHead": "c174f1b7f3a78a00ec5af0360469280445e37804",
- "homepage": "https://github.com/form-data/form-data#readme",
- "installable": true,
- "license": "MIT",
- "main": "./lib/form_data",
- "maintainers": [
- {
- "name": "felixge",
- "email": "felix@debuggable.com"
- },
- {
- "name": "idralyuk",
- "email": "igor@buran.us"
- },
- {
- "name": "alexindigo",
- "email": "iam@alexindigo.com"
- },
- {
- "name": "mikeal",
- "email": "mikeal.rogers@gmail.com"
- },
- {
- "name": "celer",
- "email": "dtyree77@gmail.com"
- },
- {
- "name": "dylanpiercey",
- "email": "pierceydylan@gmail.com"
- }
- ],
- "name": "form-data",
- "optionalDependencies": {},
- "pre-commit": [
- "test"
- ],
- "repository": {
- "type": "git",
- "url": "git://github.com/form-data/form-data.git"
- },
- "scripts": {
- "test": "./test/run.js"
- },
- "version": "1.0.0-rc3"
-}