fsevents 1.2.7 → 1.2.11
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.
- package/.travis.yml +1 -2
- package/binding.gyp +1 -9
- package/fsevents.cc +8 -11
- package/fsevents.js +1 -3
- package/node_modules/abbrev/package.json +2 -3
- package/node_modules/ansi-regex/package.json +1 -1
- package/node_modules/aproba/package.json +1 -1
- package/node_modules/are-we-there-yet/package.json +1 -1
- package/node_modules/balanced-match/package.json +1 -1
- package/node_modules/brace-expansion/package.json +1 -1
- package/node_modules/chownr/chownr.js +47 -10
- package/node_modules/chownr/package.json +7 -7
- package/node_modules/code-point-at/package.json +1 -1
- package/node_modules/concat-map/package.json +1 -1
- package/node_modules/console-control-strings/package.json +1 -1
- package/node_modules/core-util-is/package.json +1 -1
- package/node_modules/debug/CHANGELOG.md +34 -1
- package/node_modules/debug/README.md +188 -63
- package/node_modules/debug/dist/debug.js +886 -0
- package/node_modules/debug/package.json +28 -26
- package/node_modules/debug/src/browser.js +77 -82
- package/node_modules/debug/src/common.js +249 -0
- package/node_modules/debug/src/index.js +5 -3
- package/node_modules/debug/src/node.js +72 -146
- package/node_modules/deep-extend/package.json +1 -1
- package/node_modules/delegates/package.json +1 -1
- package/node_modules/detect-libc/package.json +1 -1
- package/node_modules/fs-minipass/index.js +2 -1
- package/node_modules/fs-minipass/package.json +13 -10
- package/node_modules/fs.realpath/package.json +1 -1
- package/node_modules/gauge/package.json +1 -1
- package/node_modules/glob/LICENSE +6 -0
- package/node_modules/glob/README.md +8 -1
- package/node_modules/glob/package.json +9 -6
- package/node_modules/has-unicode/package.json +1 -1
- package/node_modules/iconv-lite/package.json +1 -1
- package/node_modules/ignore-walk/README.md +1 -1
- package/node_modules/ignore-walk/index.js +9 -5
- package/node_modules/ignore-walk/package.json +11 -8
- package/node_modules/inflight/package.json +1 -1
- package/node_modules/inherits/inherits.js +2 -0
- package/node_modules/inherits/inherits_browser.js +18 -14
- package/node_modules/inherits/package.json +9 -11
- package/node_modules/ini/package.json +1 -1
- package/node_modules/is-fullwidth-code-point/package.json +1 -1
- package/node_modules/isarray/package.json +1 -1
- package/node_modules/minimatch/package.json +1 -1
- package/node_modules/minimist/package.json +1 -1
- package/node_modules/minipass/README.md +486 -4
- package/node_modules/minipass/index.js +190 -28
- package/node_modules/minipass/package.json +17 -14
- package/node_modules/minizlib/README.md +36 -27
- package/node_modules/minizlib/constants.js +73 -4
- package/node_modules/minizlib/index.js +137 -152
- package/node_modules/minizlib/package.json +12 -12
- package/node_modules/mkdirp/package.json +1 -2
- package/node_modules/ms/index.js +29 -19
- package/node_modules/ms/package.json +17 -17
- package/node_modules/ms/readme.md +18 -9
- package/node_modules/needle/README.md +1 -2
- package/node_modules/needle/examples/multipart-stream.js +1 -1
- package/node_modules/needle/lib/auth.js +1 -1
- package/node_modules/needle/lib/multipart.js +1 -1
- package/node_modules/needle/lib/needle.js +4 -2
- package/node_modules/needle/package.json +13 -13
- package/node_modules/needle/test/basic_auth_spec.js +1 -1
- package/node_modules/needle/test/cookies_spec.js +2 -2
- package/node_modules/needle/test/headers_spec.js +1 -1
- package/node_modules/needle/test/output_spec.js +1 -1
- package/node_modules/needle/test/post_data_spec.js +20 -20
- package/node_modules/needle/test/proxy_spec.js +1 -1
- package/node_modules/needle/test/utils/test.js +1 -1
- package/node_modules/node-pre-gyp/CHANGELOG.md +21 -0
- package/node_modules/node-pre-gyp/README.md +41 -6
- package/node_modules/node-pre-gyp/lib/build.js +1 -1
- package/node_modules/node-pre-gyp/lib/install.js +64 -22
- package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
- package/node_modules/node-pre-gyp/lib/pre-binding.js +5 -5
- package/node_modules/node-pre-gyp/lib/rebuild.js +1 -1
- package/node_modules/node-pre-gyp/lib/reinstall.js +1 -1
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +288 -0
- package/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js +5 -2
- package/node_modules/node-pre-gyp/lib/util/napi.js +72 -23
- package/node_modules/node-pre-gyp/lib/util/versioning.js +7 -6
- package/node_modules/node-pre-gyp/package.json +12 -12
- package/node_modules/nopt/package.json +1 -1
- package/node_modules/npm-bundled/index.js +26 -6
- package/node_modules/npm-bundled/package.json +9 -6
- package/node_modules/npm-normalize-package-bin/.github/settings.yml +2 -0
- package/node_modules/npm-normalize-package-bin/.npmignore +24 -0
- package/node_modules/npm-normalize-package-bin/LICENSE +15 -0
- package/node_modules/npm-normalize-package-bin/README.md +14 -0
- package/node_modules/npm-normalize-package-bin/index.js +60 -0
- package/node_modules/npm-normalize-package-bin/package-lock.json +3529 -0
- package/node_modules/npm-normalize-package-bin/package.json +57 -0
- package/node_modules/npm-normalize-package-bin/test/array.js +37 -0
- package/node_modules/npm-normalize-package-bin/test/nobin.js +35 -0
- package/node_modules/npm-normalize-package-bin/test/object.js +141 -0
- package/node_modules/npm-normalize-package-bin/test/string.js +37 -0
- package/node_modules/npm-packlist/index.js +76 -16
- package/node_modules/npm-packlist/package.json +16 -9
- package/node_modules/npmlog/package.json +1 -1
- package/node_modules/number-is-nan/package.json +1 -1
- package/node_modules/object-assign/package.json +1 -1
- package/node_modules/once/package.json +1 -1
- package/node_modules/os-homedir/package.json +1 -1
- package/node_modules/os-tmpdir/package.json +1 -1
- package/node_modules/osenv/package.json +1 -1
- package/node_modules/path-is-absolute/package.json +1 -1
- package/node_modules/process-nextick-args/index.js +2 -1
- package/node_modules/process-nextick-args/package.json +6 -6
- package/node_modules/rc/node_modules/minimist/package.json +1 -1
- package/node_modules/rc/package.json +1 -1
- package/node_modules/readable-stream/package.json +1 -1
- package/node_modules/rimraf/package.json +6 -6
- package/node_modules/rimraf/rimraf.js +9 -1
- package/node_modules/safe-buffer/package.json +1 -1
- package/node_modules/safer-buffer/package.json +1 -1
- package/node_modules/sax/package.json +1 -1
- package/node_modules/semver/CHANGELOG.md +39 -0
- package/node_modules/semver/README.md +26 -13
- package/node_modules/semver/bin/semver +84 -77
- package/node_modules/semver/package.json +14 -8
- package/node_modules/semver/semver.js +906 -775
- package/node_modules/set-blocking/package.json +1 -1
- package/node_modules/signal-exit/package.json +1 -1
- package/node_modules/string-width/package.json +1 -1
- package/node_modules/string_decoder/package.json +1 -1
- package/node_modules/strip-ansi/package.json +1 -1
- package/node_modules/strip-json-comments/package.json +1 -1
- package/node_modules/tar/lib/large-numbers.js +32 -27
- package/node_modules/tar/lib/mkdir.js +2 -2
- package/node_modules/tar/lib/parse.js +6 -1
- package/node_modules/tar/lib/read-entry.js +4 -0
- package/node_modules/tar/lib/write-entry.js +2 -2
- package/node_modules/tar/package.json +22 -18
- package/node_modules/util-deprecate/package.json +1 -1
- package/node_modules/wide-align/package.json +1 -1
- package/node_modules/wrappy/package.json +1 -1
- package/node_modules/yallist/package.json +11 -11
- package/node_modules/yallist/yallist.js +50 -0
- package/package.json +5 -18
- package/src/constants.cc +20 -20
- package/install.js +0 -7
- package/node_modules/debug/.coveralls.yml +0 -1
- package/node_modules/debug/.eslintrc +0 -11
- package/node_modules/debug/.npmignore +0 -9
- package/node_modules/debug/.travis.yml +0 -14
- package/node_modules/debug/Makefile +0 -50
- package/node_modules/debug/component.json +0 -19
- package/node_modules/debug/karma.conf.js +0 -70
- package/node_modules/debug/src/debug.js +0 -202
- package/node_modules/debug/src/inspector-log.js +0 -15
- package/node_modules/needle/note.xml +0 -7
- package/node_modules/needle/note.xml.1 +0 -7
@@ -5,15 +5,21 @@ const Buffer = require('buffer').Buffer
|
|
5
5
|
const realZlib = require('zlib')
|
6
6
|
|
7
7
|
const constants = exports.constants = require('./constants.js')
|
8
|
-
const
|
8
|
+
const Minipass = require('minipass')
|
9
9
|
|
10
10
|
const OriginalBufferConcat = Buffer.concat
|
11
11
|
|
12
12
|
class ZlibError extends Error {
|
13
|
-
constructor (
|
14
|
-
super('zlib: ' +
|
15
|
-
this.
|
16
|
-
this.
|
13
|
+
constructor (err) {
|
14
|
+
super('zlib: ' + err.message)
|
15
|
+
this.code = err.code
|
16
|
+
this.errno = err.errno
|
17
|
+
/* istanbul ignore if */
|
18
|
+
if (!this.code)
|
19
|
+
this.code = 'ZLIB_ERROR'
|
20
|
+
|
21
|
+
this.message = 'zlib: ' + err.message
|
22
|
+
Error.captureStackTrace(this, this.constructor)
|
17
23
|
}
|
18
24
|
|
19
25
|
get name () {
|
@@ -21,126 +27,51 @@ class ZlibError extends Error {
|
|
21
27
|
}
|
22
28
|
}
|
23
29
|
|
24
|
-
// translation table for return codes.
|
25
|
-
const codes = new Map([
|
26
|
-
[constants.Z_OK, 'Z_OK'],
|
27
|
-
[constants.Z_STREAM_END, 'Z_STREAM_END'],
|
28
|
-
[constants.Z_NEED_DICT, 'Z_NEED_DICT'],
|
29
|
-
[constants.Z_ERRNO, 'Z_ERRNO'],
|
30
|
-
[constants.Z_STREAM_ERROR, 'Z_STREAM_ERROR'],
|
31
|
-
[constants.Z_DATA_ERROR, 'Z_DATA_ERROR'],
|
32
|
-
[constants.Z_MEM_ERROR, 'Z_MEM_ERROR'],
|
33
|
-
[constants.Z_BUF_ERROR, 'Z_BUF_ERROR'],
|
34
|
-
[constants.Z_VERSION_ERROR, 'Z_VERSION_ERROR']
|
35
|
-
])
|
36
|
-
|
37
|
-
const validFlushFlags = new Set([
|
38
|
-
constants.Z_NO_FLUSH,
|
39
|
-
constants.Z_PARTIAL_FLUSH,
|
40
|
-
constants.Z_SYNC_FLUSH,
|
41
|
-
constants.Z_FULL_FLUSH,
|
42
|
-
constants.Z_FINISH,
|
43
|
-
constants.Z_BLOCK
|
44
|
-
])
|
45
|
-
|
46
|
-
const strategies = new Set([
|
47
|
-
constants.Z_FILTERED,
|
48
|
-
constants.Z_HUFFMAN_ONLY,
|
49
|
-
constants.Z_RLE,
|
50
|
-
constants.Z_FIXED,
|
51
|
-
constants.Z_DEFAULT_STRATEGY
|
52
|
-
])
|
53
|
-
|
54
30
|
// the Zlib class they all inherit from
|
55
31
|
// This thing manages the queue of requests, and returns
|
56
32
|
// true or false if there is anything in the queue when
|
57
33
|
// you call the .write() method.
|
58
34
|
const _opts = Symbol('opts')
|
59
35
|
const _flushFlag = Symbol('flushFlag')
|
60
|
-
const
|
36
|
+
const _finishFlushFlag = Symbol('finishFlushFlag')
|
37
|
+
const _fullFlushFlag = Symbol('fullFlushFlag')
|
61
38
|
const _handle = Symbol('handle')
|
62
39
|
const _onError = Symbol('onError')
|
40
|
+
const _sawError = Symbol('sawError')
|
63
41
|
const _level = Symbol('level')
|
64
42
|
const _strategy = Symbol('strategy')
|
65
43
|
const _ended = Symbol('ended')
|
44
|
+
const _defaultFullFlush = Symbol('_defaultFullFlush')
|
66
45
|
|
67
|
-
class
|
46
|
+
class ZlibBase extends Minipass {
|
68
47
|
constructor (opts, mode) {
|
48
|
+
if (!opts || typeof opts !== 'object')
|
49
|
+
throw new TypeError('invalid options for ZlibBase constructor')
|
50
|
+
|
69
51
|
super(opts)
|
70
52
|
this[_ended] = false
|
71
|
-
this[_opts] = opts
|
72
|
-
if (opts.flush && !validFlushFlags.has(opts.flush)) {
|
73
|
-
throw new TypeError('Invalid flush flag: ' + opts.flush)
|
74
|
-
}
|
75
|
-
if (opts.finishFlush && !validFlushFlags.has(opts.finishFlush)) {
|
76
|
-
throw new TypeError('Invalid flush flag: ' + opts.finishFlush)
|
77
|
-
}
|
78
|
-
|
79
|
-
this[_flushFlag] = opts.flush || constants.Z_NO_FLUSH
|
80
|
-
this[_finishFlush] = typeof opts.finishFlush !== 'undefined' ?
|
81
|
-
opts.finishFlush : constants.Z_FINISH
|
82
|
-
|
83
|
-
if (opts.chunkSize) {
|
84
|
-
if (opts.chunkSize < constants.Z_MIN_CHUNK) {
|
85
|
-
throw new RangeError('Invalid chunk size: ' + opts.chunkSize)
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
|
-
if (opts.windowBits) {
|
90
|
-
if (opts.windowBits < constants.Z_MIN_WINDOWBITS ||
|
91
|
-
opts.windowBits > constants.Z_MAX_WINDOWBITS) {
|
92
|
-
throw new RangeError('Invalid windowBits: ' + opts.windowBits)
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
if (opts.level) {
|
97
|
-
if (opts.level < constants.Z_MIN_LEVEL ||
|
98
|
-
opts.level > constants.Z_MAX_LEVEL) {
|
99
|
-
throw new RangeError('Invalid compression level: ' + opts.level)
|
100
|
-
}
|
101
|
-
}
|
53
|
+
this[_opts] = opts
|
102
54
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
}
|
109
|
-
|
110
|
-
|
111
|
-
throw new TypeError('Invalid strategy: ' + opts.strategy)
|
112
|
-
|
113
|
-
if (opts.dictionary) {
|
114
|
-
if (!(opts.dictionary instanceof Buffer)) {
|
115
|
-
throw new TypeError('Invalid dictionary: it should be a Buffer instance')
|
116
|
-
}
|
55
|
+
this[_flushFlag] = opts.flush
|
56
|
+
this[_finishFlushFlag] = opts.finishFlush
|
57
|
+
// this will throw if any options are invalid for the class selected
|
58
|
+
try {
|
59
|
+
this[_handle] = new realZlib[mode](opts)
|
60
|
+
} catch (er) {
|
61
|
+
// make sure that all errors get decorated properly
|
62
|
+
throw new ZlibError(er)
|
117
63
|
}
|
118
64
|
|
119
|
-
this[_handle] = new realZlib[mode](opts)
|
120
|
-
|
121
65
|
this[_onError] = (err) => {
|
66
|
+
this[_sawError] = true
|
122
67
|
// there is no way to cleanly recover.
|
123
68
|
// continuing only obscures problems.
|
124
69
|
this.close()
|
125
|
-
|
126
|
-
const error = new ZlibError(err.message, err.errno)
|
127
|
-
this.emit('error', error)
|
70
|
+
this.emit('error', err)
|
128
71
|
}
|
129
|
-
this[_handle].on('error', this[_onError])
|
130
72
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
var strategy = typeof opts.strategy === 'number' ? opts.strategy
|
135
|
-
: constants.Z_DEFAULT_STRATEGY
|
136
|
-
|
137
|
-
// API changed in node v9
|
138
|
-
/* istanbul ignore next */
|
139
|
-
|
140
|
-
this[_level] = level
|
141
|
-
this[_strategy] = strategy
|
142
|
-
|
143
|
-
this.once('end', this.close)
|
73
|
+
this[_handle].on('error', er => this[_onError](new ZlibError(er)))
|
74
|
+
this.once('end', () => this.close)
|
144
75
|
}
|
145
76
|
|
146
77
|
close () {
|
@@ -151,66 +82,26 @@ class Zlib extends MiniPass {
|
|
151
82
|
}
|
152
83
|
}
|
153
84
|
|
154
|
-
|
155
|
-
if (!this[
|
156
|
-
throw new Error('cannot switch params when binding is closed')
|
157
|
-
|
158
|
-
// no way to test this without also not supporting params at all
|
159
|
-
/* istanbul ignore if */
|
160
|
-
if (!this[_handle].params)
|
161
|
-
throw new Error('not supported in this implementation')
|
162
|
-
|
163
|
-
if (level < constants.Z_MIN_LEVEL ||
|
164
|
-
level > constants.Z_MAX_LEVEL) {
|
165
|
-
throw new RangeError('Invalid compression level: ' + level)
|
166
|
-
}
|
167
|
-
|
168
|
-
if (!(strategies.has(strategy)))
|
169
|
-
throw new TypeError('Invalid strategy: ' + strategy)
|
170
|
-
|
171
|
-
if (this[_level] !== level || this[_strategy] !== strategy) {
|
172
|
-
this.flush(constants.Z_SYNC_FLUSH)
|
85
|
+
reset () {
|
86
|
+
if (!this[_sawError]) {
|
173
87
|
assert(this[_handle], 'zlib binding closed')
|
174
|
-
|
175
|
-
// core zlib. We override .flush() temporarily to intercept that and
|
176
|
-
// flush synchronously.
|
177
|
-
const origFlush = this[_handle].flush
|
178
|
-
this[_handle].flush = (flushFlag, cb) => {
|
179
|
-
this[_handle].flush = origFlush
|
180
|
-
this.flush(flushFlag)
|
181
|
-
cb()
|
182
|
-
}
|
183
|
-
this[_handle].params(level, strategy)
|
184
|
-
/* istanbul ignore else */
|
185
|
-
if (this[_handle]) {
|
186
|
-
this[_level] = level
|
187
|
-
this[_strategy] = strategy
|
188
|
-
}
|
88
|
+
return this[_handle].reset()
|
189
89
|
}
|
190
90
|
}
|
191
91
|
|
192
|
-
|
193
|
-
assert(this[_handle], 'zlib binding closed')
|
194
|
-
return this[_handle].reset()
|
195
|
-
}
|
196
|
-
|
197
|
-
flush (kind) {
|
198
|
-
if (kind === undefined)
|
199
|
-
kind = constants.Z_FULL_FLUSH
|
200
|
-
|
92
|
+
flush (flushFlag) {
|
201
93
|
if (this.ended)
|
202
94
|
return
|
203
95
|
|
204
|
-
|
205
|
-
|
206
|
-
this.write(Buffer.alloc(0))
|
207
|
-
this[_flushFlag] = flushFlag
|
96
|
+
if (typeof flushFlag !== 'number')
|
97
|
+
flushFlag = this[_fullFlushFlag]
|
98
|
+
this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))
|
208
99
|
}
|
209
100
|
|
210
101
|
end (chunk, encoding, cb) {
|
211
102
|
if (chunk)
|
212
103
|
this.write(chunk, encoding)
|
213
|
-
this.flush(this[
|
104
|
+
this.flush(this[_finishFlushFlag])
|
214
105
|
this[_ended] = true
|
215
106
|
return super.end(null, null, cb)
|
216
107
|
}
|
@@ -228,6 +119,8 @@ class Zlib extends MiniPass {
|
|
228
119
|
if (typeof chunk === 'string')
|
229
120
|
chunk = Buffer.from(chunk, encoding)
|
230
121
|
|
122
|
+
if (this[_sawError])
|
123
|
+
return
|
231
124
|
assert(this[_handle], 'zlib binding closed')
|
232
125
|
|
233
126
|
// _processChunk tries to .close() the native handle after it's done, so we
|
@@ -242,11 +135,17 @@ class Zlib extends MiniPass {
|
|
242
135
|
Buffer.concat = (args) => args
|
243
136
|
let result
|
244
137
|
try {
|
245
|
-
|
138
|
+
const flushFlag = typeof chunk[_flushFlag] === 'number'
|
139
|
+
? chunk[_flushFlag] : this[_flushFlag]
|
140
|
+
result = this[_handle]._processChunk(chunk, flushFlag)
|
141
|
+
// if we don't throw, reset it back how it was
|
142
|
+
Buffer.concat = OriginalBufferConcat
|
246
143
|
} catch (err) {
|
247
|
-
|
248
|
-
|
144
|
+
// or if we do, put Buffer.concat() back before we emit error
|
145
|
+
// Error events call into user code, which may call Buffer.concat()
|
249
146
|
Buffer.concat = OriginalBufferConcat
|
147
|
+
this[_onError](new ZlibError(err))
|
148
|
+
} finally {
|
250
149
|
if (this[_handle]) {
|
251
150
|
// Core zlib resets `_handle` to null after attempting to close the
|
252
151
|
// native handle. Our no-op handler prevented actual closure, but we
|
@@ -280,6 +179,56 @@ class Zlib extends MiniPass {
|
|
280
179
|
}
|
281
180
|
}
|
282
181
|
|
182
|
+
class Zlib extends ZlibBase {
|
183
|
+
constructor (opts, mode) {
|
184
|
+
opts = opts || {}
|
185
|
+
|
186
|
+
opts.flush = opts.flush || constants.Z_NO_FLUSH
|
187
|
+
opts.finishFlush = opts.finishFlush || constants.Z_FINISH
|
188
|
+
super(opts, mode)
|
189
|
+
|
190
|
+
this[_fullFlushFlag] = constants.Z_FULL_FLUSH
|
191
|
+
this[_level] = opts.level
|
192
|
+
this[_strategy] = opts.strategy
|
193
|
+
}
|
194
|
+
|
195
|
+
params (level, strategy) {
|
196
|
+
if (this[_sawError])
|
197
|
+
return
|
198
|
+
|
199
|
+
if (!this[_handle])
|
200
|
+
throw new Error('cannot switch params when binding is closed')
|
201
|
+
|
202
|
+
// no way to test this without also not supporting params at all
|
203
|
+
/* istanbul ignore if */
|
204
|
+
if (!this[_handle].params)
|
205
|
+
throw new Error('not supported in this implementation')
|
206
|
+
|
207
|
+
if (this[_level] !== level || this[_strategy] !== strategy) {
|
208
|
+
this.flush(constants.Z_SYNC_FLUSH)
|
209
|
+
assert(this[_handle], 'zlib binding closed')
|
210
|
+
// .params() calls .flush(), but the latter is always async in the
|
211
|
+
// core zlib. We override .flush() temporarily to intercept that and
|
212
|
+
// flush synchronously.
|
213
|
+
const origFlush = this[_handle].flush
|
214
|
+
this[_handle].flush = (flushFlag, cb) => {
|
215
|
+
this.flush(flushFlag)
|
216
|
+
cb()
|
217
|
+
}
|
218
|
+
try {
|
219
|
+
this[_handle].params(level, strategy)
|
220
|
+
} finally {
|
221
|
+
this[_handle].flush = origFlush
|
222
|
+
}
|
223
|
+
/* istanbul ignore else */
|
224
|
+
if (this[_handle]) {
|
225
|
+
this[_level] = level
|
226
|
+
this[_strategy] = strategy
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
283
232
|
// minimal 2-byte header
|
284
233
|
class Deflate extends Zlib {
|
285
234
|
constructor (opts) {
|
@@ -326,6 +275,31 @@ class Unzip extends Zlib {
|
|
326
275
|
}
|
327
276
|
}
|
328
277
|
|
278
|
+
class Brotli extends ZlibBase {
|
279
|
+
constructor (opts, mode) {
|
280
|
+
opts = opts || {}
|
281
|
+
|
282
|
+
opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS
|
283
|
+
opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH
|
284
|
+
|
285
|
+
super(opts, mode)
|
286
|
+
|
287
|
+
this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH
|
288
|
+
}
|
289
|
+
}
|
290
|
+
|
291
|
+
class BrotliCompress extends Brotli {
|
292
|
+
constructor (opts) {
|
293
|
+
super(opts, 'BrotliCompress')
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
class BrotliDecompress extends Brotli {
|
298
|
+
constructor (opts) {
|
299
|
+
super(opts, 'BrotliDecompress')
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
329
303
|
exports.Deflate = Deflate
|
330
304
|
exports.Inflate = Inflate
|
331
305
|
exports.Gzip = Gzip
|
@@ -333,3 +307,14 @@ exports.Gunzip = Gunzip
|
|
333
307
|
exports.DeflateRaw = DeflateRaw
|
334
308
|
exports.InflateRaw = InflateRaw
|
335
309
|
exports.Unzip = Unzip
|
310
|
+
/* istanbul ignore else */
|
311
|
+
if (typeof realZlib.BrotliCompress === 'function') {
|
312
|
+
exports.BrotliCompress = BrotliCompress
|
313
|
+
exports.BrotliDecompress = BrotliDecompress
|
314
|
+
} else {
|
315
|
+
exports.BrotliCompress = exports.BrotliDecompress = class {
|
316
|
+
constructor () {
|
317
|
+
throw new Error('Brotli is not supported in this version of Node.js')
|
318
|
+
}
|
319
|
+
}
|
320
|
+
}
|
@@ -1,27 +1,27 @@
|
|
1
1
|
{
|
2
|
-
"_from": "minizlib@^1.
|
3
|
-
"_id": "minizlib@1.
|
2
|
+
"_from": "minizlib@^1.2.1",
|
3
|
+
"_id": "minizlib@1.3.3",
|
4
4
|
"_inBundle": false,
|
5
|
-
"_integrity": "sha512-
|
5
|
+
"_integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==",
|
6
6
|
"_location": "/minizlib",
|
7
7
|
"_phantomChildren": {},
|
8
8
|
"_requested": {
|
9
9
|
"type": "range",
|
10
10
|
"registry": true,
|
11
|
-
"raw": "minizlib@^1.
|
11
|
+
"raw": "minizlib@^1.2.1",
|
12
12
|
"name": "minizlib",
|
13
13
|
"escapedName": "minizlib",
|
14
|
-
"rawSpec": "^1.
|
14
|
+
"rawSpec": "^1.2.1",
|
15
15
|
"saveSpec": null,
|
16
|
-
"fetchSpec": "^1.
|
16
|
+
"fetchSpec": "^1.2.1"
|
17
17
|
},
|
18
18
|
"_requiredBy": [
|
19
19
|
"/tar"
|
20
20
|
],
|
21
|
-
"_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.
|
22
|
-
"_shasum": "
|
23
|
-
"_spec": "minizlib@^1.
|
24
|
-
"_where": "/Users/
|
21
|
+
"_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz",
|
22
|
+
"_shasum": "2290de96818a34c29551c8a8d301216bd65a861d",
|
23
|
+
"_spec": "minizlib@^1.2.1",
|
24
|
+
"_where": "/Users/pipobscure/fsevents/node_modules/tar",
|
25
25
|
"author": {
|
26
26
|
"name": "Isaac Z. Schlueter",
|
27
27
|
"email": "i@izs.me",
|
@@ -32,7 +32,7 @@
|
|
32
32
|
},
|
33
33
|
"bundleDependencies": false,
|
34
34
|
"dependencies": {
|
35
|
-
"minipass": "^2.
|
35
|
+
"minipass": "^2.9.0"
|
36
36
|
},
|
37
37
|
"deprecated": false,
|
38
38
|
"description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
|
@@ -67,5 +67,5 @@
|
|
67
67
|
"preversion": "npm test",
|
68
68
|
"test": "tap test/*.js --100 -J"
|
69
69
|
},
|
70
|
-
"version": "1.
|
70
|
+
"version": "1.3.3"
|
71
71
|
}
|
@@ -17,13 +17,12 @@
|
|
17
17
|
},
|
18
18
|
"_requiredBy": [
|
19
19
|
"/node-pre-gyp",
|
20
|
-
"/tap",
|
21
20
|
"/tar"
|
22
21
|
],
|
23
22
|
"_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
24
23
|
"_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
|
25
24
|
"_spec": "mkdirp@^0.5.1",
|
26
|
-
"_where": "/Users/
|
25
|
+
"_where": "/Users/pipobscure/fsevents/node_modules/node-pre-gyp",
|
27
26
|
"author": {
|
28
27
|
"name": "James Halliday",
|
29
28
|
"email": "mail@substack.net",
|
package/node_modules/ms/index.js
CHANGED
@@ -6,6 +6,7 @@ var s = 1000;
|
|
6
6
|
var m = s * 60;
|
7
7
|
var h = m * 60;
|
8
8
|
var d = h * 24;
|
9
|
+
var w = d * 7;
|
9
10
|
var y = d * 365.25;
|
10
11
|
|
11
12
|
/**
|
@@ -27,7 +28,7 @@ module.exports = function(val, options) {
|
|
27
28
|
var type = typeof val;
|
28
29
|
if (type === 'string' && val.length > 0) {
|
29
30
|
return parse(val);
|
30
|
-
} else if (type === 'number' &&
|
31
|
+
} else if (type === 'number' && isFinite(val)) {
|
31
32
|
return options.long ? fmtLong(val) : fmtShort(val);
|
32
33
|
}
|
33
34
|
throw new Error(
|
@@ -49,7 +50,7 @@ function parse(str) {
|
|
49
50
|
if (str.length > 100) {
|
50
51
|
return;
|
51
52
|
}
|
52
|
-
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
53
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
53
54
|
str
|
54
55
|
);
|
55
56
|
if (!match) {
|
@@ -64,6 +65,10 @@ function parse(str) {
|
|
64
65
|
case 'yr':
|
65
66
|
case 'y':
|
66
67
|
return n * y;
|
68
|
+
case 'weeks':
|
69
|
+
case 'week':
|
70
|
+
case 'w':
|
71
|
+
return n * w;
|
67
72
|
case 'days':
|
68
73
|
case 'day':
|
69
74
|
case 'd':
|
@@ -106,16 +111,17 @@ function parse(str) {
|
|
106
111
|
*/
|
107
112
|
|
108
113
|
function fmtShort(ms) {
|
109
|
-
|
114
|
+
var msAbs = Math.abs(ms);
|
115
|
+
if (msAbs >= d) {
|
110
116
|
return Math.round(ms / d) + 'd';
|
111
117
|
}
|
112
|
-
if (
|
118
|
+
if (msAbs >= h) {
|
113
119
|
return Math.round(ms / h) + 'h';
|
114
120
|
}
|
115
|
-
if (
|
121
|
+
if (msAbs >= m) {
|
116
122
|
return Math.round(ms / m) + 'm';
|
117
123
|
}
|
118
|
-
if (
|
124
|
+
if (msAbs >= s) {
|
119
125
|
return Math.round(ms / s) + 's';
|
120
126
|
}
|
121
127
|
return ms + 'ms';
|
@@ -130,23 +136,27 @@ function fmtShort(ms) {
|
|
130
136
|
*/
|
131
137
|
|
132
138
|
function fmtLong(ms) {
|
133
|
-
|
134
|
-
|
135
|
-
plural(ms,
|
136
|
-
|
137
|
-
|
139
|
+
var msAbs = Math.abs(ms);
|
140
|
+
if (msAbs >= d) {
|
141
|
+
return plural(ms, msAbs, d, 'day');
|
142
|
+
}
|
143
|
+
if (msAbs >= h) {
|
144
|
+
return plural(ms, msAbs, h, 'hour');
|
145
|
+
}
|
146
|
+
if (msAbs >= m) {
|
147
|
+
return plural(ms, msAbs, m, 'minute');
|
148
|
+
}
|
149
|
+
if (msAbs >= s) {
|
150
|
+
return plural(ms, msAbs, s, 'second');
|
151
|
+
}
|
152
|
+
return ms + ' ms';
|
138
153
|
}
|
139
154
|
|
140
155
|
/**
|
141
156
|
* Pluralization helper.
|
142
157
|
*/
|
143
158
|
|
144
|
-
function plural(ms, n, name) {
|
145
|
-
|
146
|
-
|
147
|
-
}
|
148
|
-
if (ms < n * 1.5) {
|
149
|
-
return Math.floor(ms / n) + ' ' + name;
|
150
|
-
}
|
151
|
-
return Math.ceil(ms / n) + ' ' + name + 's';
|
159
|
+
function plural(ms, msAbs, n, name) {
|
160
|
+
var isPlural = msAbs >= n * 1.5;
|
161
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
152
162
|
}
|
@@ -1,39 +1,39 @@
|
|
1
1
|
{
|
2
|
-
"_from": "ms
|
3
|
-
"_id": "ms@2.
|
2
|
+
"_from": "ms@^2.1.1",
|
3
|
+
"_id": "ms@2.1.2",
|
4
4
|
"_inBundle": false,
|
5
|
-
"_integrity": "
|
5
|
+
"_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
6
6
|
"_location": "/ms",
|
7
7
|
"_phantomChildren": {},
|
8
8
|
"_requested": {
|
9
|
-
"type": "
|
9
|
+
"type": "range",
|
10
10
|
"registry": true,
|
11
|
-
"raw": "ms
|
11
|
+
"raw": "ms@^2.1.1",
|
12
12
|
"name": "ms",
|
13
13
|
"escapedName": "ms",
|
14
|
-
"rawSpec": "2.
|
14
|
+
"rawSpec": "^2.1.1",
|
15
15
|
"saveSpec": null,
|
16
|
-
"fetchSpec": "2.
|
16
|
+
"fetchSpec": "^2.1.1"
|
17
17
|
},
|
18
18
|
"_requiredBy": [
|
19
19
|
"/debug"
|
20
20
|
],
|
21
|
-
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.
|
22
|
-
"_shasum": "
|
23
|
-
"_spec": "ms
|
24
|
-
"_where": "/Users/
|
21
|
+
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
22
|
+
"_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009",
|
23
|
+
"_spec": "ms@^2.1.1",
|
24
|
+
"_where": "/Users/pipobscure/fsevents/node_modules/debug",
|
25
25
|
"bugs": {
|
26
26
|
"url": "https://github.com/zeit/ms/issues"
|
27
27
|
},
|
28
28
|
"bundleDependencies": false,
|
29
29
|
"deprecated": false,
|
30
|
-
"description": "Tiny
|
30
|
+
"description": "Tiny millisecond conversion utility",
|
31
31
|
"devDependencies": {
|
32
|
-
"eslint": "
|
32
|
+
"eslint": "4.12.1",
|
33
33
|
"expect.js": "0.3.1",
|
34
|
-
"husky": "0.
|
35
|
-
"lint-staged": "
|
36
|
-
"mocha": "
|
34
|
+
"husky": "0.14.3",
|
35
|
+
"lint-staged": "5.0.0",
|
36
|
+
"mocha": "4.0.1"
|
37
37
|
},
|
38
38
|
"eslintConfig": {
|
39
39
|
"extends": "eslint:recommended",
|
@@ -65,5 +65,5 @@
|
|
65
65
|
"precommit": "lint-staged",
|
66
66
|
"test": "mocha tests.js"
|
67
67
|
},
|
68
|
-
"version": "2.
|
68
|
+
"version": "2.1.2"
|
69
69
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# ms
|
2
2
|
|
3
3
|
[](https://travis-ci.org/zeit/ms)
|
4
|
-
[](https://spectrum.chat/zeit)
|
5
5
|
|
6
6
|
Use this package to easily convert various time formats to milliseconds.
|
7
7
|
|
@@ -17,35 +17,44 @@ ms('1m') // 60000
|
|
17
17
|
ms('5s') // 5000
|
18
18
|
ms('1y') // 31557600000
|
19
19
|
ms('100') // 100
|
20
|
+
ms('-3 days') // -259200000
|
21
|
+
ms('-1h') // -3600000
|
22
|
+
ms('-200') // -200
|
20
23
|
```
|
21
24
|
|
22
|
-
### Convert from
|
25
|
+
### Convert from Milliseconds
|
23
26
|
|
24
27
|
```js
|
25
28
|
ms(60000) // "1m"
|
26
29
|
ms(2 * 60000) // "2m"
|
30
|
+
ms(-3 * 60000) // "-3m"
|
27
31
|
ms(ms('10 hours')) // "10h"
|
28
32
|
```
|
29
33
|
|
30
|
-
### Time
|
34
|
+
### Time Format Written-Out
|
31
35
|
|
32
36
|
```js
|
33
37
|
ms(60000, { long: true }) // "1 minute"
|
34
38
|
ms(2 * 60000, { long: true }) // "2 minutes"
|
39
|
+
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
35
40
|
ms(ms('10 hours'), { long: true }) // "10 hours"
|
36
41
|
```
|
37
42
|
|
38
43
|
## Features
|
39
44
|
|
40
|
-
- Works both in [
|
41
|
-
- If a number is supplied to `ms`, a string with a unit is returned
|
42
|
-
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
43
|
-
- If you pass a string with a number and a valid unit, the number of equivalent
|
45
|
+
- Works both in [Node.js](https://nodejs.org) and in the browser
|
46
|
+
- If a number is supplied to `ms`, a string with a unit is returned
|
47
|
+
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
48
|
+
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
44
49
|
|
45
|
-
##
|
50
|
+
## Related Packages
|
51
|
+
|
52
|
+
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
53
|
+
|
54
|
+
## Caught a Bug?
|
46
55
|
|
47
56
|
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
48
57
|
2. Link the package to the global module directory: `npm link`
|
49
|
-
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm,
|
58
|
+
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
50
59
|
|
51
60
|
As always, you can run the tests using: `npm test`
|