fsevents 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/node_modules/ansi-styles/index.js +72 -6
- package/node_modules/ansi-styles/package.json +19 -12
- package/node_modules/ansi-styles/readme.md +36 -8
- package/node_modules/are-we-there-yet/CHANGES.md +19 -0
- package/node_modules/are-we-there-yet/README.md +12 -2
- package/node_modules/are-we-there-yet/index.js +4 -132
- package/node_modules/are-we-there-yet/package.json +18 -13
- package/node_modules/are-we-there-yet/test/lib/test-event.js +29 -0
- package/node_modules/are-we-there-yet/test/tracker.js +44 -43
- package/node_modules/are-we-there-yet/test/trackergroup.js +73 -64
- package/node_modules/are-we-there-yet/test/trackerstream.js +26 -40
- package/node_modules/are-we-there-yet/tracker-base.js +11 -0
- package/node_modules/are-we-there-yet/tracker-group.js +107 -0
- package/node_modules/are-we-there-yet/tracker-stream.js +35 -0
- package/node_modules/are-we-there-yet/tracker.js +30 -0
- package/node_modules/asn1/package.json +1 -2
- package/node_modules/assert-plus/package.json +1 -3
- package/node_modules/async/package.json +1 -1
- package/node_modules/aws4/.npmignore +2 -1
- package/node_modules/aws4/README.md +4 -0
- package/node_modules/aws4/aws4.js +8 -3
- package/node_modules/aws4/node_modules/lru-cache/.npmignore +3 -0
- package/node_modules/aws4/node_modules/lru-cache/.travis.yml +3 -4
- package/node_modules/aws4/node_modules/lru-cache/README.md +29 -24
- package/node_modules/aws4/node_modules/lru-cache/benchmarks/insertion-time.js +32 -0
- package/node_modules/aws4/node_modules/lru-cache/lib/lru-cache.js +333 -199
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/LICENSE +15 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/README.md +60 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/map.js +9 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/package.json +59 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js +113 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/test/basic.js +86 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/.npmignore +4 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/.travis.yml +7 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/CONTRIBUTING.md +4 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/LICENSE +15 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/README.md +204 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/package.json +59 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/test/basic.js +188 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/yallist.js +360 -0
- package/node_modules/aws4/node_modules/lru-cache/package.json +16 -12
- package/node_modules/aws4/node_modules/lru-cache/test/basic.js +270 -146
- package/node_modules/aws4/node_modules/lru-cache/test/foreach.js +39 -25
- package/node_modules/aws4/node_modules/lru-cache/test/inspect.js +54 -0
- package/node_modules/aws4/node_modules/lru-cache/test/no-symbol.js +3 -0
- package/node_modules/aws4/node_modules/lru-cache/test/serialize.js +115 -104
- package/node_modules/aws4/package.json +17 -14
- package/node_modules/bl/bl.js +9 -3
- package/node_modules/bl/package.json +12 -12
- package/node_modules/bl/test/test.js +14 -0
- package/node_modules/color-convert/README.md +62 -0
- package/node_modules/color-convert/conversions.js +594 -0
- package/node_modules/color-convert/css-keywords.js +151 -0
- package/node_modules/color-convert/index.js +75 -0
- package/node_modules/color-convert/package.json +92 -0
- package/node_modules/color-convert/route.js +98 -0
- package/node_modules/dashdash/lib/dashdash.js +1 -1
- package/node_modules/dashdash/node_modules/assert-plus/AUTHORS +6 -0
- package/node_modules/dashdash/node_modules/assert-plus/CHANGES.md +14 -0
- package/node_modules/dashdash/node_modules/assert-plus/README.md +162 -0
- package/node_modules/dashdash/node_modules/assert-plus/assert.js +211 -0
- package/node_modules/dashdash/node_modules/assert-plus/package.json +89 -0
- package/node_modules/dashdash/package.json +19 -12
- package/node_modules/ecc-jsbn/package.json +1 -2
- package/node_modules/escape-string-regexp/package.json +15 -11
- package/node_modules/extsprintf/package.json +2 -3
- package/node_modules/form-data/.dockerignore +7 -0
- package/node_modules/form-data/.editorconfig +10 -0
- package/node_modules/form-data/.eslintignore +1 -0
- package/node_modules/form-data/.eslintrc +64 -0
- package/node_modules/form-data/{Readme.md → README.md} +9 -1
- package/node_modules/form-data/lib/browser.js +2 -1
- package/node_modules/form-data/lib/form_data.js +172 -135
- package/node_modules/form-data/lib/populate.js +9 -0
- package/node_modules/form-data/package.json +35 -16
- package/node_modules/form-data/wercker.yml +36 -0
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/index.js +1 -1
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +14 -10
- package/node_modules/gauge/README.md +1 -1
- package/node_modules/gauge/package.json +18 -14
- package/node_modules/gauge/progress-bar.js +2 -2
- package/node_modules/http-signature/package.json +1 -2
- package/node_modules/is-my-json-valid/README.md +2 -2
- package/node_modules/is-my-json-valid/index.js +15 -6
- package/node_modules/is-my-json-valid/package.json +11 -7
- package/node_modules/is-my-json-valid/test/json-schema-draft4/multipleOf.json +36 -0
- package/node_modules/is-my-json-valid/test/misc.js +18 -0
- package/node_modules/is-typedarray/package.json +1 -2
- package/node_modules/isarray/.npmignore +1 -0
- package/node_modules/isarray/.travis.yml +4 -0
- package/node_modules/isarray/Makefile +6 -0
- package/node_modules/isarray/README.md +6 -0
- package/node_modules/isarray/index.js +3 -1
- package/node_modules/isarray/package.json +28 -10
- package/node_modules/isarray/test.js +20 -0
- package/node_modules/jodid25519/package.json +1 -2
- package/node_modules/jsbn/package.json +1 -2
- package/node_modules/json-schema/package.json +1 -1
- package/node_modules/jsprim/package.json +1 -2
- package/node_modules/lodash.pad/LICENSE +17 -16
- package/node_modules/lodash.pad/README.md +2 -2
- package/node_modules/lodash.pad/index.js +3 -94
- package/node_modules/lodash.pad/package.json +12 -12
- package/node_modules/lodash.padend/LICENSE +23 -0
- package/node_modules/lodash.padend/README.md +18 -0
- package/node_modules/lodash.padend/index.js +285 -0
- package/node_modules/lodash.padend/package.json +91 -0
- package/node_modules/lodash.padstart/LICENSE +23 -0
- package/node_modules/lodash.padstart/README.md +18 -0
- package/node_modules/lodash.padstart/index.js +285 -0
- package/node_modules/lodash.padstart/package.json +91 -0
- package/node_modules/lodash.repeat/LICENSE +17 -16
- package/node_modules/lodash.repeat/README.md +2 -2
- package/node_modules/lodash.repeat/index.js +3 -94
- package/node_modules/lodash.repeat/package.json +14 -13
- package/node_modules/lodash.tostring/LICENSE +23 -0
- package/node_modules/lodash.tostring/README.md +18 -0
- package/node_modules/lodash.tostring/index.js +164 -0
- package/node_modules/lodash.tostring/package.json +91 -0
- package/node_modules/mime-db/HISTORY.md +14 -0
- package/node_modules/mime-db/db.json +26 -3
- package/node_modules/mime-db/package.json +23 -18
- package/node_modules/mime-types/HISTORY.md +8 -0
- package/node_modules/mime-types/README.md +1 -1
- package/node_modules/mime-types/package.json +21 -16
- package/node_modules/node-pre-gyp/CHANGELOG.md +11 -0
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +44 -4
- package/node_modules/node-pre-gyp/package.json +16 -16
- package/node_modules/npmlog/.nyc_output/64996.json +1 -0
- package/node_modules/npmlog/.nyc_output/64998.json +1 -0
- package/node_modules/npmlog/.nyc_output/65000.json +1 -0
- package/node_modules/npmlog/log.js +3 -2
- package/node_modules/npmlog/package.json +15 -11
- package/node_modules/npmlog/test/progress.js +25 -8
- package/node_modules/once/package.json +1 -1
- package/node_modules/qs/package.json +1 -2
- package/node_modules/readable-stream/.travis.yml +18 -16
- package/node_modules/readable-stream/README.md +1 -1
- package/node_modules/readable-stream/doc/stream.markdown +435 -405
- package/node_modules/readable-stream/lib/_stream_duplex.js +13 -20
- package/node_modules/readable-stream/lib/_stream_passthrough.js +3 -4
- package/node_modules/readable-stream/lib/_stream_readable.js +110 -205
- package/node_modules/readable-stream/lib/_stream_transform.js +21 -38
- package/node_modules/readable-stream/lib/_stream_writable.js +108 -121
- package/node_modules/readable-stream/package.json +19 -15
- package/node_modules/request/package.json +1 -2
- package/node_modules/rimraf/node_modules/glob/README.md +6 -0
- package/node_modules/rimraf/node_modules/glob/common.js +12 -3
- package/node_modules/rimraf/node_modules/glob/glob.js +20 -3
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +1 -1
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +14 -10
- package/node_modules/rimraf/node_modules/glob/package.json +15 -11
- package/node_modules/rimraf/node_modules/glob/sync.js +8 -1
- package/node_modules/rimraf/package.json +14 -10
- package/node_modules/semver/package.json +1 -2
- package/node_modules/sshpk/lib/formats/rfc4253.js +2 -1
- package/node_modules/sshpk/package.json +13 -10
- package/node_modules/strip-ansi/package.json +21 -16
- package/node_modules/strip-ansi/readme.md +5 -5
- package/node_modules/tough-cookie/lib/cookie.js +2 -2
- package/node_modules/tough-cookie/package.json +13 -9
- package/node_modules/tweetnacl/CHANGELOG.md +53 -0
- package/node_modules/tweetnacl/COPYING.txt +9 -0
- package/node_modules/tweetnacl/README.md +14 -40
- package/node_modules/tweetnacl/nacl-fast.js +21 -51
- package/node_modules/tweetnacl/nacl-fast.min.js +2 -2
- package/node_modules/tweetnacl/nacl.js +21 -51
- package/node_modules/tweetnacl/nacl.min.js +1 -1
- package/node_modules/tweetnacl/package.json +28 -38
- package/node_modules/verror/package.json +2 -3
- package/package.json +2 -2
- package/node_modules/aws4/example.js +0 -372
- package/node_modules/aws4/node_modules/lru-cache/test/memory-leak.js +0 -51
- package/node_modules/isarray/build/build.js +0 -209
- package/node_modules/lodash._basetostring/LICENSE +0 -22
- package/node_modules/lodash._basetostring/README.md +0 -20
- package/node_modules/lodash._basetostring/index.js +0 -22
- package/node_modules/lodash._basetostring/package.json +0 -99
- package/node_modules/lodash._createpadding/LICENSE +0 -22
- package/node_modules/lodash._createpadding/README.md +0 -20
- package/node_modules/lodash._createpadding/index.js +0 -37
- package/node_modules/lodash._createpadding/package.json +0 -101
- package/node_modules/lodash._root/LICENSE +0 -22
- package/node_modules/lodash._root/README.md +0 -18
- package/node_modules/lodash._root/index.js +0 -53
- package/node_modules/lodash._root/package.json +0 -77
- package/node_modules/lodash.padleft/LICENSE.txt +0 -22
- package/node_modules/lodash.padleft/README.md +0 -20
- package/node_modules/lodash.padleft/index.js +0 -50
- package/node_modules/lodash.padleft/package.json +0 -107
- package/node_modules/lodash.padright/LICENSE.txt +0 -22
- package/node_modules/lodash.padright/README.md +0 -20
- package/node_modules/lodash.padright/index.js +0 -50
- package/node_modules/lodash.padright/package.json +0 -107
@@ -1,87 +1,96 @@
|
|
1
|
-
|
2
|
-
var test = require(
|
3
|
-
var
|
4
|
-
var
|
1
|
+
'use strict'
|
2
|
+
var test = require('tap').test
|
3
|
+
var TrackerGroup = require('../index.js').TrackerGroup
|
4
|
+
var testEvent = require('./lib/test-event.js')
|
5
5
|
|
6
|
-
|
7
|
-
var
|
8
|
-
var timeout = setTimeout(function(){
|
9
|
-
obj.removeListener(event, eventHandler)
|
10
|
-
next(timeoutError)
|
11
|
-
}, 10)
|
12
|
-
var eventHandler = function () {
|
13
|
-
var args = Array.prototype.slice.call(arguments)
|
14
|
-
args.unshift(null)
|
15
|
-
clearTimeout(timeout)
|
16
|
-
next.apply(null, args)
|
17
|
-
}
|
18
|
-
obj.once(event, eventHandler)
|
19
|
-
}
|
20
|
-
|
21
|
-
test("TrackerGroup", function (t) {
|
22
|
-
var name = "test"
|
6
|
+
test('TrackerGroup', function (t) {
|
7
|
+
var name = 'test'
|
23
8
|
|
24
9
|
var track = new TrackerGroup(name)
|
25
|
-
t.is(track.completed(), 0,
|
26
|
-
testEvent(track,
|
10
|
+
t.is(track.completed(), 0, 'Nothing todo is 0 completion')
|
11
|
+
testEvent(track, 'change', afterFinishEmpty)
|
27
12
|
track.finish()
|
28
13
|
var a, b
|
29
|
-
function afterFinishEmpty(er, onChangeName) {
|
30
|
-
t.is(er, null,
|
31
|
-
t.is(onChangeName, name,
|
32
|
-
t.is(
|
14
|
+
function afterFinishEmpty (er, onChangeName, completion) {
|
15
|
+
t.is(er, null, 'finishEmpty: on change event fired')
|
16
|
+
t.is(onChangeName, name, 'finishEmpty: on change emits the correct name')
|
17
|
+
t.is(completion, 1, 'finishEmpty: passed through completion was correct')
|
18
|
+
t.is(track.completed(), 1, 'finishEmpty: Finishing an empty group actually finishes it')
|
33
19
|
|
34
20
|
track = new TrackerGroup(name)
|
35
|
-
a = track.newItem(
|
36
|
-
b = track.newItem(
|
37
|
-
t.is(track.completed(), 0,
|
38
|
-
testEvent(track,
|
21
|
+
a = track.newItem('a', 10, 1)
|
22
|
+
b = track.newItem('b', 10, 1)
|
23
|
+
t.is(track.completed(), 0, 'Initially empty')
|
24
|
+
testEvent(track, 'change', afterCompleteWork)
|
39
25
|
a.completeWork(5)
|
40
26
|
}
|
41
|
-
function afterCompleteWork(er, onChangeName) {
|
42
|
-
t.is(er, null,
|
43
|
-
t.is(onChangeName,
|
44
|
-
t.is(
|
45
|
-
|
27
|
+
function afterCompleteWork (er, onChangeName, completion) {
|
28
|
+
t.is(er, null, 'on change event fired')
|
29
|
+
t.is(onChangeName, 'a', 'on change emits the correct name')
|
30
|
+
t.is(completion, 0.25, 'Complete half of one is a quarter overall')
|
31
|
+
t.is(track.completed(), 0.25, 'Complete half of one is a quarter overall')
|
32
|
+
testEvent(track, 'change', afterFinishAll)
|
46
33
|
track.finish()
|
47
34
|
}
|
48
|
-
function afterFinishAll(er, onChangeName) {
|
49
|
-
t.is(er, null,
|
50
|
-
t.is(onChangeName, name,
|
51
|
-
t.is(
|
52
|
-
|
35
|
+
function afterFinishAll (er, onChangeName, completion) {
|
36
|
+
t.is(er, null, 'finishAll: on change event fired')
|
37
|
+
t.is(onChangeName, name, 'finishAll: on change emits the correct name')
|
38
|
+
t.is(completion, 1, 'Finishing everything ')
|
39
|
+
t.is(track.completed(), 1, 'Finishing everything ')
|
40
|
+
|
53
41
|
track = new TrackerGroup(name)
|
54
|
-
a = track.newItem(
|
55
|
-
b = track.newItem(
|
56
|
-
t.is(track.completed(), 0,
|
57
|
-
testEvent(track,
|
42
|
+
a = track.newItem('a', 10, 2)
|
43
|
+
b = track.newItem('b', 10, 1)
|
44
|
+
t.is(track.completed(), 0, 'weighted: Initially empty')
|
45
|
+
testEvent(track, 'change', afterWeightedCompleteWork)
|
58
46
|
a.completeWork(5)
|
59
47
|
}
|
60
|
-
function afterWeightedCompleteWork(er, onChangeName) {
|
61
|
-
t.is(er, null,
|
62
|
-
t.is(onChangeName,
|
63
|
-
t.is(Math.
|
64
|
-
|
48
|
+
function afterWeightedCompleteWork (er, onChangeName, completion) {
|
49
|
+
t.is(er, null, 'weighted: on change event fired')
|
50
|
+
t.is(onChangeName, 'a', 'weighted: on change emits the correct name')
|
51
|
+
t.is(Math.floor(completion * 100), 33, 'weighted: Complete half of double weighted')
|
52
|
+
t.is(Math.floor(track.completed() * 100), 33, 'weighted: Complete half of double weighted')
|
53
|
+
testEvent(track, 'change', afterWeightedFinishAll)
|
65
54
|
track.finish()
|
66
55
|
}
|
67
|
-
function afterWeightedFinishAll(er, onChangeName) {
|
68
|
-
t.is(er, null,
|
69
|
-
t.is(onChangeName, name,
|
70
|
-
t.is(
|
71
|
-
|
56
|
+
function afterWeightedFinishAll (er, onChangeName, completion) {
|
57
|
+
t.is(er, null, 'weightedFinishAll: on change event fired')
|
58
|
+
t.is(onChangeName, name, 'weightedFinishAll: on change emits the correct name')
|
59
|
+
t.is(completion, 1, 'weightedFinishaAll: Finishing everything ')
|
60
|
+
t.is(track.completed(), 1, 'weightedFinishaAll: Finishing everything ')
|
61
|
+
|
72
62
|
track = new TrackerGroup(name)
|
73
|
-
a = track.newGroup(
|
74
|
-
b = track.newGroup(
|
75
|
-
var a1 = a.newItem(
|
63
|
+
a = track.newGroup('a', 10)
|
64
|
+
b = track.newGroup('b', 10)
|
65
|
+
var a1 = a.newItem('a.1', 10)
|
76
66
|
a1.completeWork(5)
|
77
|
-
t.is(track.completed(), 0.25,
|
78
|
-
testEvent(track,
|
67
|
+
t.is(track.completed(), 0.25, 'nested: Initially quarter done')
|
68
|
+
testEvent(track, 'change', afterNestedComplete)
|
79
69
|
b.finish()
|
80
70
|
}
|
81
|
-
function afterNestedComplete(er, onChangeName) {
|
82
|
-
t.is(er, null,
|
83
|
-
t.is(onChangeName,
|
84
|
-
t.is(
|
71
|
+
function afterNestedComplete (er, onChangeName, completion) {
|
72
|
+
t.is(er, null, 'nestedComplete: on change event fired')
|
73
|
+
t.is(onChangeName, 'b', 'nestedComplete: on change emits the correct name')
|
74
|
+
t.is(completion, 0.75, 'nestedComplete: Finishing everything ')
|
75
|
+
t.is(track.completed(), 0.75, 'nestedComplete: Finishing everything ')
|
85
76
|
t.end()
|
86
77
|
}
|
87
78
|
})
|
79
|
+
|
80
|
+
test('cycles', function (t) {
|
81
|
+
var track = new TrackerGroup('top')
|
82
|
+
testCycle(track, track)
|
83
|
+
var layer1 = track.newGroup('layer1')
|
84
|
+
testCycle(layer1, track)
|
85
|
+
t.end()
|
86
|
+
|
87
|
+
function testCycle (addTo, toAdd) {
|
88
|
+
try {
|
89
|
+
addTo.addUnit(toAdd)
|
90
|
+
t.fail(toAdd.name)
|
91
|
+
} catch (ex) {
|
92
|
+
console.log(ex)
|
93
|
+
t.pass(toAdd.name)
|
94
|
+
}
|
95
|
+
}
|
96
|
+
})
|
@@ -1,65 +1,51 @@
|
|
1
|
-
|
2
|
-
var test = require(
|
3
|
-
var util = require(
|
4
|
-
var stream = require(
|
5
|
-
var TrackerStream = require(
|
6
|
-
|
7
|
-
var timeoutError = new Error("timeout")
|
8
|
-
var testEvent = function (obj,event,next) {
|
9
|
-
var timeout = setTimeout(function(){
|
10
|
-
obj.removeListener(event, eventHandler)
|
11
|
-
next(timeoutError)
|
12
|
-
}, 10)
|
13
|
-
var eventHandler = function () {
|
14
|
-
var args = Array.prototype.slice.call(arguments)
|
15
|
-
args.unshift(null)
|
16
|
-
clearTimeout(timeout)
|
17
|
-
next.apply(null, args)
|
18
|
-
}
|
19
|
-
obj.once(event, eventHandler)
|
20
|
-
}
|
1
|
+
'use strict'
|
2
|
+
var test = require('tap').test
|
3
|
+
var util = require('util')
|
4
|
+
var stream = require('readable-stream')
|
5
|
+
var TrackerStream = require('../index.js').TrackerStream
|
6
|
+
var testEvent = require('./lib/test-event.js')
|
21
7
|
|
22
8
|
var Sink = function () {
|
23
|
-
stream.Writable.apply(this,arguments)
|
9
|
+
stream.Writable.apply(this, arguments)
|
24
10
|
}
|
25
11
|
util.inherits(Sink, stream.Writable)
|
26
12
|
Sink.prototype._write = function (data, encoding, cb) {
|
27
13
|
cb()
|
28
14
|
}
|
29
15
|
|
30
|
-
test(
|
16
|
+
test('TrackerStream', function (t) {
|
31
17
|
t.plan(9)
|
32
18
|
|
33
|
-
var name =
|
19
|
+
var name = 'test'
|
34
20
|
var track = new TrackerStream(name)
|
35
21
|
|
36
|
-
t.is(track.completed(), 0,
|
22
|
+
t.is(track.completed(), 0, 'Nothing todo is 0 completion')
|
37
23
|
|
38
24
|
var todo = 10
|
39
25
|
track = new TrackerStream(name, todo)
|
40
|
-
t.is(track.completed(), 0,
|
26
|
+
t.is(track.completed(), 0, 'Nothing done is 0 completion')
|
41
27
|
|
42
28
|
track.pipe(new Sink())
|
43
29
|
|
44
|
-
testEvent(track,
|
45
|
-
track.write(
|
46
|
-
function afterCompleteWork(er, onChangeName) {
|
47
|
-
t.is(er, null,
|
48
|
-
t.is(onChangeName, name,
|
49
|
-
t.is(track.completed(), 1,
|
30
|
+
testEvent(track, 'change', afterCompleteWork)
|
31
|
+
track.write('0123456789')
|
32
|
+
function afterCompleteWork (er, onChangeName) {
|
33
|
+
t.is(er, null, 'write: on change event fired')
|
34
|
+
t.is(onChangeName, name, 'write: on change emits the correct name')
|
35
|
+
t.is(track.completed(), 1, 'write: 100% completed')
|
50
36
|
|
51
|
-
testEvent(track,
|
37
|
+
testEvent(track, 'change', afterAddWork)
|
52
38
|
track.addWork(10)
|
53
39
|
}
|
54
|
-
function afterAddWork(er, onChangeName) {
|
55
|
-
t.is(er, null,
|
56
|
-
t.is(track.completed(), 0.5,
|
40
|
+
function afterAddWork (er, onChangeName) {
|
41
|
+
t.is(er, null, 'addWork: on change event fired')
|
42
|
+
t.is(track.completed(), 0.5, 'addWork: 50% completed')
|
57
43
|
|
58
|
-
testEvent(track,
|
59
|
-
track.write(
|
44
|
+
testEvent(track, 'change', afterAllWork)
|
45
|
+
track.write('ABCDEFGHIJKLMNOPQRST')
|
60
46
|
}
|
61
|
-
function afterAllWork(er) {
|
62
|
-
t.is(er, null,
|
63
|
-
t.is(track.completed(), 1,
|
47
|
+
function afterAllWork (er) {
|
48
|
+
t.is(er, null, 'allWork: on change event fired')
|
49
|
+
t.is(track.completed(), 1, 'allWork: 100% completed')
|
64
50
|
}
|
65
51
|
})
|
@@ -0,0 +1,11 @@
|
|
1
|
+
'use strict'
|
2
|
+
var EventEmitter = require('events').EventEmitter
|
3
|
+
var util = require('util')
|
4
|
+
|
5
|
+
var trackerId = 0
|
6
|
+
var TrackerBase = module.exports = function (name) {
|
7
|
+
EventEmitter.call(this)
|
8
|
+
this.id = ++trackerId
|
9
|
+
this.name = name
|
10
|
+
}
|
11
|
+
util.inherits(TrackerBase, EventEmitter)
|
@@ -0,0 +1,107 @@
|
|
1
|
+
'use strict'
|
2
|
+
var util = require('util')
|
3
|
+
var TrackerBase = require('./tracker-base.js')
|
4
|
+
var Tracker = require('./tracker.js')
|
5
|
+
var TrackerStream = require('./tracker-stream.js')
|
6
|
+
|
7
|
+
var TrackerGroup = module.exports = function (name) {
|
8
|
+
TrackerBase.call(this, name)
|
9
|
+
this.parentGroup = null
|
10
|
+
this.trackers = []
|
11
|
+
this.completion = {}
|
12
|
+
this.weight = {}
|
13
|
+
this.totalWeight = 0
|
14
|
+
this.finished = false
|
15
|
+
this.bubbleChange = bubbleChange(this)
|
16
|
+
}
|
17
|
+
util.inherits(TrackerGroup, TrackerBase)
|
18
|
+
|
19
|
+
function bubbleChange (trackerGroup) {
|
20
|
+
return function (name, completed, tracker) {
|
21
|
+
trackerGroup.completion[tracker.id] = completed
|
22
|
+
if (trackerGroup.finished) return
|
23
|
+
trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
TrackerGroup.prototype.nameInTree = function () {
|
28
|
+
var names = []
|
29
|
+
var from = this
|
30
|
+
while (from) {
|
31
|
+
names.unshift(from.name)
|
32
|
+
from = from.parentGroup
|
33
|
+
}
|
34
|
+
return names.join('/')
|
35
|
+
}
|
36
|
+
|
37
|
+
TrackerGroup.prototype.addUnit = function (unit, weight) {
|
38
|
+
if (unit.addUnit) {
|
39
|
+
var toTest = this
|
40
|
+
while (toTest) {
|
41
|
+
if (unit === toTest) {
|
42
|
+
throw new Error(
|
43
|
+
'Attempted to add tracker group ' +
|
44
|
+
unit.name + ' to tree that already includes it ' +
|
45
|
+
this.nameInTree(this))
|
46
|
+
}
|
47
|
+
toTest = toTest.parentGroup
|
48
|
+
}
|
49
|
+
unit.parentGroup = this
|
50
|
+
}
|
51
|
+
this.weight[unit.id] = weight || 1
|
52
|
+
this.totalWeight += this.weight[unit.id]
|
53
|
+
this.trackers.push(unit)
|
54
|
+
this.completion[unit.id] = unit.completed()
|
55
|
+
unit.on('change', this.bubbleChange)
|
56
|
+
if (!this.finished) this.emit('change', unit.name, this.completion[unit.id], unit)
|
57
|
+
return unit
|
58
|
+
}
|
59
|
+
|
60
|
+
TrackerGroup.prototype.completed = function () {
|
61
|
+
if (this.trackers.length === 0) return 0
|
62
|
+
var valPerWeight = 1 / this.totalWeight
|
63
|
+
var completed = 0
|
64
|
+
for (var ii = 0; ii < this.trackers.length; ii++) {
|
65
|
+
var trackerId = this.trackers[ii].id
|
66
|
+
completed += valPerWeight * this.weight[trackerId] * this.completion[trackerId]
|
67
|
+
}
|
68
|
+
return completed
|
69
|
+
}
|
70
|
+
|
71
|
+
TrackerGroup.prototype.newGroup = function (name, weight) {
|
72
|
+
return this.addUnit(new TrackerGroup(name), weight)
|
73
|
+
}
|
74
|
+
|
75
|
+
TrackerGroup.prototype.newItem = function (name, todo, weight) {
|
76
|
+
return this.addUnit(new Tracker(name, todo), weight)
|
77
|
+
}
|
78
|
+
|
79
|
+
TrackerGroup.prototype.newStream = function (name, todo, weight) {
|
80
|
+
return this.addUnit(new TrackerStream(name, todo), weight)
|
81
|
+
}
|
82
|
+
|
83
|
+
TrackerGroup.prototype.finish = function () {
|
84
|
+
this.finished = true
|
85
|
+
if (!this.trackers.length) this.addUnit(new Tracker(), 1, true)
|
86
|
+
for (var ii = 0; ii < this.trackers.length; ii++) {
|
87
|
+
var tracker = this.trackers[ii]
|
88
|
+
tracker.finish()
|
89
|
+
tracker.removeListener('change', this.bubbleChange)
|
90
|
+
}
|
91
|
+
this.emit('change', this.name, 1, this)
|
92
|
+
}
|
93
|
+
|
94
|
+
var buffer = ' '
|
95
|
+
TrackerGroup.prototype.debug = function (depth) {
|
96
|
+
depth = depth || 0
|
97
|
+
var indent = depth ? buffer.substr(0, depth) : ''
|
98
|
+
var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n'
|
99
|
+
this.trackers.forEach(function (tracker) {
|
100
|
+
if (tracker instanceof TrackerGroup) {
|
101
|
+
output += tracker.debug(depth + 1)
|
102
|
+
} else {
|
103
|
+
output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n'
|
104
|
+
}
|
105
|
+
})
|
106
|
+
return output
|
107
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
'use strict'
|
2
|
+
var util = require('util')
|
3
|
+
var stream = require('readable-stream')
|
4
|
+
var delegate = require('delegates')
|
5
|
+
var Tracker = require('./tracker.js')
|
6
|
+
|
7
|
+
var TrackerStream = module.exports = function (name, size, options) {
|
8
|
+
stream.Transform.call(this, options)
|
9
|
+
this.tracker = new Tracker(name, size)
|
10
|
+
this.name = name
|
11
|
+
this.id = this.tracker.id
|
12
|
+
this.tracker.on('change', delegateChange(this))
|
13
|
+
}
|
14
|
+
util.inherits(TrackerStream, stream.Transform)
|
15
|
+
|
16
|
+
function delegateChange (trackerStream) {
|
17
|
+
return function (name, completion, tracker) {
|
18
|
+
trackerStream.emit('change', name, completion, trackerStream)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
TrackerStream.prototype._transform = function (data, encoding, cb) {
|
23
|
+
this.tracker.completeWork(data.length ? data.length : 1)
|
24
|
+
this.push(data)
|
25
|
+
cb()
|
26
|
+
}
|
27
|
+
|
28
|
+
TrackerStream.prototype._flush = function (cb) {
|
29
|
+
this.tracker.finish()
|
30
|
+
cb()
|
31
|
+
}
|
32
|
+
|
33
|
+
delegate(TrackerStream.prototype, 'tracker')
|
34
|
+
.method('completed')
|
35
|
+
.method('addWork')
|
@@ -0,0 +1,30 @@
|
|
1
|
+
'use strict'
|
2
|
+
var util = require('util')
|
3
|
+
var TrackerBase = require('./tracker-base.js')
|
4
|
+
|
5
|
+
var Tracker = module.exports = function (name, todo) {
|
6
|
+
TrackerBase.call(this, name)
|
7
|
+
this.workDone = 0
|
8
|
+
this.workTodo = todo || 0
|
9
|
+
}
|
10
|
+
util.inherits(Tracker, TrackerBase)
|
11
|
+
|
12
|
+
Tracker.prototype.completed = function () {
|
13
|
+
return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
|
14
|
+
}
|
15
|
+
|
16
|
+
Tracker.prototype.addWork = function (work) {
|
17
|
+
this.workTodo += work
|
18
|
+
this.emit('change', this.name, this.completed(), this)
|
19
|
+
}
|
20
|
+
|
21
|
+
Tracker.prototype.completeWork = function (work) {
|
22
|
+
this.workDone += work
|
23
|
+
if (this.workDone > this.workTodo) this.workDone = this.workTodo
|
24
|
+
this.emit('change', this.name, this.completed(), this)
|
25
|
+
}
|
26
|
+
|
27
|
+
Tracker.prototype.finish = function () {
|
28
|
+
this.workTodo = this.workDone = 1
|
29
|
+
this.emit('change', this.name, 1, this)
|
30
|
+
}
|
@@ -60,8 +60,7 @@
|
|
60
60
|
],
|
61
61
|
"name": "asn1",
|
62
62
|
"optionalDependencies": {},
|
63
|
-
"readme": "
|
64
|
-
"readmeFilename": "README.md",
|
63
|
+
"readme": "ERROR: No README data found!",
|
65
64
|
"repository": {
|
66
65
|
"type": "git",
|
67
66
|
"url": "git://github.com/mcavage/node-asn1.git"
|
@@ -10,7 +10,6 @@
|
|
10
10
|
"_npmVersion": "3.3.8",
|
11
11
|
"_phantomChildren": {},
|
12
12
|
"_requiredBy": [
|
13
|
-
"/dashdash",
|
14
13
|
"/http-signature",
|
15
14
|
"/sshpk"
|
16
15
|
],
|
@@ -79,8 +78,7 @@
|
|
79
78
|
],
|
80
79
|
"name": "assert-plus",
|
81
80
|
"optionalDependencies": {},
|
82
|
-
"readme": "
|
83
|
-
"readmeFilename": "README.md",
|
81
|
+
"readme": "ERROR: No README data found!",
|
84
82
|
"repository": {
|
85
83
|
"type": "git",
|
86
84
|
"url": "git+https://github.com/mcavage/node-assert-plus.git"
|
@@ -6,6 +6,8 @@ aws4
|
|
6
6
|
A small utility to sign vanilla node.js http(s) request options using Amazon's
|
7
7
|
[AWS Signature Version 4](http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html).
|
8
8
|
|
9
|
+
Can also be used [in the browser](./browser).
|
10
|
+
|
9
11
|
This signature is supported by nearly all Amazon services, including
|
10
12
|
[S3](http://docs.aws.amazon.com/AmazonS3/latest/API/),
|
11
13
|
[EC2](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/),
|
@@ -497,6 +499,8 @@ With [npm](http://npmjs.org/) do:
|
|
497
499
|
npm install aws4
|
498
500
|
```
|
499
501
|
|
502
|
+
Can also be used [in the browser](./browser).
|
503
|
+
|
500
504
|
Thanks
|
501
505
|
------
|
502
506
|
|
@@ -43,8 +43,13 @@ function RequestSigner(request, credentials) {
|
|
43
43
|
if (!request.method && request.body)
|
44
44
|
request.method = 'POST'
|
45
45
|
|
46
|
-
if (!headers.Host && !headers.host)
|
46
|
+
if (!headers.Host && !headers.host) {
|
47
47
|
headers.Host = request.hostname || request.host || this.createHost()
|
48
|
+
|
49
|
+
// If a port is specified explicitly, use it as is
|
50
|
+
if (request.port)
|
51
|
+
headers.Host += ':' + request.port
|
52
|
+
}
|
48
53
|
if (!request.hostname && !request.host)
|
49
54
|
request.hostname = headers.Host || headers.host
|
50
55
|
}
|
@@ -210,8 +215,7 @@ RequestSigner.prototype.canonicalString = function() {
|
|
210
215
|
}
|
211
216
|
if (pathStr !== '/') {
|
212
217
|
if (normalizePath) pathStr = pathStr.replace(/\/{2,}/g, '/')
|
213
|
-
|
214
|
-
pathStr = '/' + pathStr.split('/').reduce(function(path, piece) {
|
218
|
+
pathStr = pathStr.split('/').reduce(function(path, piece) {
|
215
219
|
if (normalizePath && piece === '..') {
|
216
220
|
path.pop()
|
217
221
|
} else if (!normalizePath || piece !== '.') {
|
@@ -220,6 +224,7 @@ RequestSigner.prototype.canonicalString = function() {
|
|
220
224
|
}
|
221
225
|
return path
|
222
226
|
}, []).join('/')
|
227
|
+
if (pathStr[0] !== '/') pathStr = '/' + pathStr
|
223
228
|
if (decodeSlashesInPath) pathStr = pathStr.replace(/%2F/g, '/')
|
224
229
|
}
|
225
230
|
|