Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release V2 as stable #173

Open
wants to merge 70 commits into
base: v1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2ce771c
Promise streams
kriskowal Oct 7, 2013
2147b9f
Use SymbolicLink rather than Symlink in API
francoisfrisch Nov 4, 2013
c9d41c1
Add deprecation warning for followInsecureSymlinks
francoisfrisch Nov 5, 2013
dc2c0ed
Added some specs for followInsecureSymbolicLinks.
francoisfrisch Nov 6, 2013
53b2265
Changes in Markdown format
kriskowal Nov 11, 2013
7047fa2
Update change log
kriskowal Nov 11, 2013
a88d97d
End promise chain
Nov 9, 2013
21261a5
Update change log
kriskowal Nov 12, 2013
0e982d7
1.10.4
kriskowal Nov 12, 2013
b65cc0c
Use SymbolicLink rather than Symlink in API
francoisfrisch Nov 4, 2013
51ae7b4
Merge changes from version 1 train
kriskowal Jan 17, 2014
9d9cc30
Truncate before write in mock file system
kriskowal Feb 10, 2014
05e28c4
Adds missing mock method to fs-root.js
3on Feb 24, 2014
dc65953
Update change log
kriskowal Feb 25, 2014
265aaeb
Port all specs to Jasminum
kriskowal Feb 25, 2014
bcbd932
Rename specs to tests.
kriskowal Feb 25, 2014
8b82fa8
Use method, not function, when calling reroot recursively
Stuk Feb 27, 2014
3d568ec
Simplify behavior of reroot
kriskowal Feb 27, 2014
3f050d9
Version 2.0.0
kriskowal Mar 20, 2014
1f83809
Version 2.0.1
kriskowal Mar 20, 2014
f9c11e4
Version 2.0.2
kriskowal Mar 20, 2014
6f62656
Add a wrapper for the Node.js process IPC stream
kriskowal Mar 24, 2014
4556773
Fixes #88
Apr 6, 2014
ff595e2
Notify when request is missing a host header
kriskowal Apr 9, 2014
67822ef
Only add agent property if it is used.
kriskowal Apr 9, 2014
4be4a32
Refactor file system for prototypical inheritance
kriskowal May 21, 2014
1764795
Use future tag in npm
kriskowal May 21, 2014
03543d8
Use Node.js 0.10 for Travis CI
kriskowal May 21, 2014
cdfe385
Merge pull request #87 into v2
kriskowal May 29, 2014
e47ed82
Relocated test for request normalization
kriskowal May 30, 2014
fb77106
Add self-link to node_modules
kriskowal May 30, 2014
2258b49
Support HTTP response statusText
kriskowal May 30, 2014
a593e0a
Use strict mode
kriskowal May 30, 2014
c8ebd88
Address problems with stream life cycle
kriskowal May 30, 2014
8b1b996
Remove support for reader.join
kriskowal May 30, 2014
d09d67a
Add missing node property to node writers
kriskowal May 30, 2014
62f790d
Update change log for next patch
kriskowal May 30, 2014
2c3871c
2.0.3
kriskowal May 30, 2014
8c51bdb
Channel all Node.js HTTP request options
kriskowal May 30, 2014
dccc693
Fix HTTP request normalization tests
kriskowal May 30, 2014
2c515a2
Add support for progress observer on stream read
kriskowal May 30, 2014
9bc07e6
Use given listDirectory function
Stuk Jun 5, 2014
4c9e580
Merge pull request #102 from Stuk/list-directories-v2
kriskowal Jun 5, 2014
51c5514
Decode pathInfo before passing to services
kriskowal Jun 5, 2014
d63e630
Add support for targetFs override etc
kriskowal Jun 6, 2014
3112384
Update change log.
kriskowal Jun 6, 2014
7b05407
2.0.4
kriskowal Jun 6, 2014
c01c9de
Fix bugs introduced with new canonical and streams
kriskowal Jun 6, 2014
5da6e3b
2.0.5
kriskowal Jun 6, 2014
fde2703
Favor yield/return over write/close
kriskowal Jun 6, 2014
c619be7
2.0.6
kriskowal Jun 6, 2014
20dc439
Fix tests, to favor yield/return
kriskowal Jun 6, 2014
434ba3f
Fixed invalid reference
anton-rudeshko Jul 10, 2014
adf16bc
Remove superfluous cookie parsing
kriskowal Feb 16, 2015
fa1ea1d
Fix cookie parsing, decoding keys and values
kriskowal Feb 16, 2015
84f3d5b
Add timeout option to the http.request()
arikon Mar 9, 2015
09923aa
Fix up tests on v2 branch
kriskowal Nov 2, 2016
e6df781
Catch up with node 4
kriskowal Nov 2, 2016
7d573a8
disable spec that depend remote server and causing ENOTFOUND test.web…
hthetiot Jul 20, 2018
fb82aca
update npm run test|jshint
hthetiot Jul 20, 2018
126e4dd
delete node_modules/q-io
hthetiot Jul 20, 2018
1720bb6
update npm and travis badges
hthetiot Jul 20, 2018
fe6fffc
fix TypeError: Constructor Set requires 'new'
hthetiot Jul 20, 2018
ce5ccda
Merge pull request #158 from kriskowal/fixup
hthetiot Jul 20, 2018
89dd893
fix handleJsonResponse 'reviver' is not defined.
hthetiot Jul 20, 2018
c6bba59
update .gitignore .jshintignore .jshintrc
hthetiot Jul 20, 2018
cc7f49b
jshint light q-io v2
hthetiot Jul 20, 2018
df7e87f
update travis with lint
hthetiot Jul 20, 2018
dcb6747
upgrade jshint
hthetiot Jul 20, 2018
12fa77a
Merge pull request #175 from kriskowal/bugs/jshint-v2
hthetiot Aug 22, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
.idea
.tmp
.coverage_data
cover_html
node_modules
4 changes: 4 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
test/
cover_html/
.coverage_data/
126 changes: 126 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
// * set all relaxing options to false
// * set all environment options to false, except the browser value
// * set all JSLint legacy options to false
//
// [1]: http://www.jshint.com/
// [2]: https://github.com/jshint/node-jshint/blob/master/example/config.json
// [3]: https://github.com/oryband/dotfiles/blob/master/jshintrc
//
// @author http://michael.haschke.biz/
// @license http://unlicense.org/

// == Enforcing Options ===============================================
//
// These options tell JSHint to be more strict towards your code. Use
// them if you want to allow only a safe subset of JavaScript, very
// useful when your codebase is shared with a big number of developers
// with different skill levels.
"unused" : false,
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
"curly" : false, // Require {} for every new block or scope.
"eqeqeq" : false, // Require triple equals i.e. `===`.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef" : false, // Prohibit variable use before definition.
"newcap" : false, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"noempty" : false, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects.
"plusplus" : false, // Prohibit use of `++` & `--`.
"regexp" : true, // Prohibit `.` and `[^...]` in regular expressions.
"undef" : true, // Require all non-global variables be declared before they are used.
"strict" : false, // Require `use strict` pragma in every file.
"trailing" : true, // Prohibit trailing whitespaces.

// == Relaxing Options ================================================
//
// These options allow you to suppress certain types of warnings. Use
// them only if you are absolutely positive that you know what you are
// doing.

"asi" : true, // Tolerate Automatic Semicolon Insertion (no semicolons).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"eqnull" : false, // Tolerate use of `== null`.
"es5" : false, // Allow EcmaScript 5 syntax.
"esnext" : false, // Allow ES.next specific features such as `const` and `let`.
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"funcscope" : false, // Tolerate declarations of variables inside of control structures while accessing them later from the outside.
"globalstrict" : true, // Allow global "use strict" (also enables 'strict').
"iterator" : false, // Allow usage of __iterator__ property.
"lastsemic" : false, // Tolerat missing semicolons when the it is omitted for the last statement in a one-line block.
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"laxcomma" : false, // Suppress warnings about comma-first coding style.
"loopfunc" : false, // Allow functions to be defined within loops.
"multistr" : true, // Tolerate multi-line strings.
"onecase" : false, // Tolerate switches with just one case.
"proto" : true, // Tolerate __proto__ property. This property is deprecated.
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
"scripturl" : false, // Tolerate script-targeted URLs.
"smarttabs" : false, // Tolerate mixed tabs and spaces when the latter are used for alignmnent only.
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"supernew" : true, // Tolerate `new function () { ... };` and `new Object;`.
"validthis" : false, // Tolerate strict violations when the code is running in strict mode and you use this in a non-constructor function.

// == Environments ====================================================
//
// These options pre-define global variables that are exposed by
// popular JavaScript libraries and runtime environments—such as
// browser or node.js.

"browser" : true, // Standard browser globals e.g. `window`, `document`.
"couch" : false, // Enable globals exposed by CouchDB.
"devel" : true, // Allow development statements e.g. `console.log();`.
"dojo" : false, // Enable globals exposed by Dojo Toolkit.
"jquery" : false, // Enable globals exposed by jQuery JavaScript library.
"mootools" : false, // Enable globals exposed by MooTools JavaScript framework.
"node" : false, // Enable globals available when code is running inside of the NodeJS runtime environment.
"nonstandard" : false, // Define non-standard but widely adopted globals such as escape and unescape.
"prototypejs" : false, // Enable globals exposed by Prototype JavaScript framework.
"rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment.
"wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host.

// == JSLint Legacy ===================================================
//
// These options are legacy from JSLint. Aside from bug fixes they will
// not be improved in any way and might be removed at any point.

"nomen" : false, // Prohibit use of initial or trailing underbars in names.
"onevar" : false, // Allow only one `var` statement per function.
"passfail" : false, // Stop on first error.
"white" : false, // Check against strict whitespace and indentation rules.

// == Undocumented Options ============================================
//
// While I've found these options in [example1][2] and [example2][3]
// they are not described in the [JSHint Options documentation][4].
//
// [4]: http://www.jshint.com/options/

"maxerr" : 100, // Maximum errors before stopping.
"predef" : [ // Extra globals.
//"exampleVar",
//"anotherCoolGlobal",
//"iLoveDouglas"
],
"indent" : 4, // Specify indentation spacing
"globals": {
"URL": true,
"Buffer": false,
"require": false,
"exports": false,
"module": false
}
}
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.idea
.tmp
.coverage_data
cover_html
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
sudo: false
language: node_js
node_js:
- 0.8
- 4
- 6
- 8
script:
- npm run lint
- npm run test
60 changes: 60 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
<!-- vim:ts=4:sts=4:sw=4:et:tw=60 -->

## 2.0.4

Streams:

- Added support for progress observers on readable stream `read` promise.

File system:

- Added support for `targetFs` argument to `copy` and `copyTree`.
- Fixed `canonical` by implementing in JavaScript based on `readLink`.
Depending on Node.js `realpath` was an error since realpath does not handle
path remainders.
- Fixed rerooted base file systems.
- Quietly added `rejoin` to file system, for reversing `split` properly.
Must consider finding a better narrative about `join`, `absolute`, `split`
and the distinguishing of relative and absolute paths in their split form,
as well as handling the issue of drive letters for Windows properly.

HTTP:

- Server request's now decode `pathInfo` on demand.
If the encoding is invalid, accessing `pathInfo` will throw an error.
This change makes it possible to receive requests with file names.
Using an accessor is questionable.
A future release might elect to pass `null` for path info if it does not
parse properly.
- File service now uses the configured `listDirectory` function if overridden.
- The client now supports requests with all of the same properteis as the
options that can be passed to the Node.js request function.

## 2.0.2

- Fixed problems with hanging connections, and problems with early termination
of streams.
- Added missing `node` property to Node writable stream wrapper.
- Removed `Reader.join`. Removed support for `Reader.prototype.join`.
Use `Reader(x).read()` and `Buffer.concat(buffers)`.
- Added `node/process` process stream wrapper.
- HTTP client now warns when there is a missing host header.
- Fix problem with HTTP agent option with Node.js v0.11.
- Refactored file system to use prototype inheritance pattern
instead of Crockford style closure constructors.
- Merged changes from v1 for HTTP request normalization.
- Added support for response.statusText

## 2.0.1

- Fixed URL dependency.

## 2.0.0 :warning:

- Rebased on next generation of Q and Collections
- Reimplements streams. Streams now support back pressure and are consumed on
demand. Streams must be expressly cancelled or they will stay open
indefinitely, or until a connection timeout.

## 1.11.0

- Adds `removeDirectory` and `statLink` to the Mock file system interface.

## 1.10.7-8

- Fixes support for range content requests, such that Q-IO based web serves can
Expand Down
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Q-IO v2

[![Build Status](https://secure.travis-ci.org/kriskowal/q-io.png)](http://travis-ci.org/kriskowal/q-io)
[![npm version](https://img.shields.io/npm/v/q-io.svg?style=flat)](https://www.npmjs.com/package/q-io)

# Q-IO
[![Build Status](https://secure.travis-ci.org/kriskowal/q-io.png?branch=v2)](https://github.com/kriskowal/q-io/tree/v2)

Interfaces for IO that make use of promises.

Expand Down Expand Up @@ -563,15 +564,7 @@ Reader instances have the following methods:
- `close()`
- `node` the underlying node reader

Additionally, the `Reader` constructor has the following methods:

- `read(stream, charset)` accepts any foreachable and returns either a
buffer or a string if given a charset.
- `join(buffers)` consolidates an array of buffers into a single
buffer. The buffers array is collapsed in place and the new first
and only buffer is returned.

The `reader` module exports a function that accepts a Node reader and
The `node/reader` module exports a function that accepts a Node reader and
returns a Q reader.

### Writer
Expand All @@ -586,7 +579,7 @@ Writer instances have the following methods:
- `destroy()`
- `node` the underlying node writer

The `writer` module exports a function that accepts a Node writer and
The `node/writer` module exports a function that accepts a Node writer and
returns a Q writer.

### Buffer
Expand Down
File renamed without changes.
59 changes: 2 additions & 57 deletions buffer-stream.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,4 @@
"use strict";

var Q = require("q");
var Reader = require("./reader");

module.exports = BufferStream;
function BufferStream(chunks, charset) {
if (!(this instanceof BufferStream)) {
return new BufferStream(chunks, charset);
}
if (!chunks) {
chunks = [];
} else if (!Array.isArray(chunks)) {
chunks = [chunks];
}
this._charset = charset;
this._chunks = chunks;
this._close = Q.defer();
this.closed = this._close.promise;
}

BufferStream.prototype.forEach = function (write, thisp) {
var self = this;
var chunks = self._chunks;
return Q.fcall(function () {
chunks.splice(0, chunks.length).forEach(write, thisp);
});
};

BufferStream.prototype.read = function () {
var result;
result = Reader.join(this._chunks);
if (this._charset) {
result = result.toString(this._charset);
}
return Q.resolve(result);
};

BufferStream.prototype.write = function (chunk) {
if (this._charset) {
chunk = new Buffer(String(chunk), this._charset);
} else {
if (!(chunk instanceof Buffer)) {
throw new Error("Can't write strings to buffer stream without a charset: " + chunk);
}
}
this._chunks.push(chunk);
return Q.resolve();
};

BufferStream.prototype.close = function () {
this._close.resolve();
return Q.resolve();
};

BufferStream.prototype.destroy = function () {
this._close.resolve();
return Q.resolve();
};
module.exports = require("./streams").BufferStream;

13 changes: 9 additions & 4 deletions coverage-report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* global __dirname:false */

"use strict";

require("collections/shim");
var Q = require("q");
var FS = require("./fs");

Expand All @@ -22,16 +24,19 @@ FS.listTree(".coverage_data", function (name, stat) {
console.log(" </tr>");
console.log(" </thead>");
console.log(" <tbody>");
Object.forEach(coverage.files, function (file, path) {
var paths = Object.keys(coverage.files);
for (var i = 0; i < paths.length; i++) {
var path = paths[i];
var file = coverage.files[path];
path = FS.relativeFromDirectory(__dirname, path);
if (/^spec/.test(path))
return;
continue;
console.log(" <tr>");
console.log(" <td><code>" + path + "</code></td>");
console.log(" <td>" + (file.stats.percentage * 100).toFixed(0) + "%</td>");
console.log(" <td>" + file.stats.missing + "</td>");
console.log(" </tr>");
});
}
console.log(" </tbody>");
console.log("</table>");
}, function (error) {
Expand Down
9 changes: 7 additions & 2 deletions deprecate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

/**
* @module deprecate
*/
Expand All @@ -10,9 +12,12 @@
* @param {String} alternative - Name of alternative that should be used instead.
* @param {Number} [stackTraceLimit] - depth of the stack trace to print out. Set to falsy value to disable stack.
*/
exports.deprecationWarning = function deprecationWarning(name, alternative, stackTraceLimit) {
exports.deprecationWarning = deprecationWarning;

function deprecationWarning(name, alternative, stackTraceLimit) {
var depth;
if (stackTraceLimit) {
var depth = Error.stackTraceLimit;
depth = Error.stackTraceLimit;
Error.stackTraceLimit = stackTraceLimit;
}
if (typeof console !== "undefined" && typeof console.warn === "function") {
Expand Down
Loading