From ecba869b6e07d2cb021d350a199058eafdc3f155 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 08:58:13 -0600 Subject: [PATCH 01/17] Fix capitalization of Array and Object types Array and Object were often written as array and object, causing warnings such as: ./buffer.js:32: WARNING - Bad type annotation. Unknown type object * @type {object.} ^ Fix the warnings by correcting the capitalization. Signed-off-by: Kevin Locke --- contrib/Preprocessor.js | 4 ++-- contrib/ProtoBuf.js | 12 ++++++------ contrib/Ws.js | 14 +++++++------- fs.js | 8 ++++---- os.js | 6 +++--- process.js | 8 ++++---- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/contrib/Preprocessor.js b/contrib/Preprocessor.js index e8bbb2e..c241206 100644 --- a/contrib/Preprocessor.js +++ b/contrib/Preprocessor.js @@ -63,7 +63,7 @@ Preprocessor.indent = function(str, indent) {}; Preprocessor.nlToStr = function(str) {}; /** - * @param {object.} defines + * @param {Object.} defines * @param {string} expr * @return {*} * @throws {Error} @@ -72,7 +72,7 @@ Preprocessor.nlToStr = function(str) {}; Preprocessor.evaluate = function(defines, expr) {}; /** - * @param {object.} directives + * @param {Object.} directives * @return {string} */ Preprocessor.prototype.process = function(directives) {}; diff --git a/contrib/ProtoBuf.js b/contrib/ProtoBuf.js index 30dd113..b218f74 100644 --- a/contrib/ProtoBuf.js +++ b/contrib/ProtoBuf.js @@ -27,7 +27,7 @@ */ /** - * {@type object.} + * {@type Object.} */ var ProtoBuf = {}; @@ -38,7 +38,7 @@ var ProtoBuf = {}; ProtoBuf.VERSION = "0.9.2"; /** - * @type {!object.} + * @type {!Object.} * @const */ ProtoBuf.WIRE_TYPES = {}; @@ -81,7 +81,7 @@ ProtoBuf.WIRE_TYPES.BITS32 = 5; /** * @dict - * @type {!object.} + * @type {!Object.} * @const */ ProtoBuf.TYPES = { @@ -136,12 +136,12 @@ ProtoBuf.TYPES = { }; /** - * @type {!object.} + * @type {!Object.} */ ProtoBuf.Lang = {}; /** - * @type {!object.} + * @type {!Object.} */ ProtoBuf.DotProto = {}; @@ -162,7 +162,7 @@ ProtoBuf.DotProto.Tokenizer.prototype.source; ProtoBuf.DotProto.Tokenizer.prototype.index; /** - * @type {array.} + * @type {Array.} */ ProtoBuf.DotProto.Tokenizer.prototype.stack; diff --git a/contrib/Ws.js b/contrib/Ws.js index e4c761e..5e76132 100644 --- a/contrib/Ws.js +++ b/contrib/Ws.js @@ -57,7 +57,7 @@ ws.Server.prototype.handleUpgrade = function(request, socket, upgradeHead, callb /** * @param {string} address - * @param {object.=} options + * @param {Object.=} options * @constructor * @extends events.EventEmitter */ @@ -84,7 +84,7 @@ ws.WebSocket.prototype.protocolVersion; ws.WebSocket.prototype.url; /** - * @type {object.} + * @type {Object.} */ ws.WebSocket.prototype.supports; @@ -100,14 +100,14 @@ ws.WebSocket.prototype.pause = function() {}; /** * @param {*=} data - * @param {object.=} options + * @param {Object.=} options * @param {boolean=} dontFailWhenClosed */ ws.WebSocket.prototype.ping = function(data, options, dontFailWhenClosed) {}; /** * @param {*=}data - * @param {object.=} options + * @param {Object.=} options * @param {boolean=} dontFailWhenClosed */ ws.WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) {}; @@ -118,13 +118,13 @@ ws.WebSocket.prototype.resume = function() {}; /** * @param {*} data - * @param {object.=} options + * @param {Object.=} options * @param {function(...[*])=} callback */ ws.WebSocket.prototype.send = function(data, options, callback) {}; /** - * @param {object.|function(string, boolean)} options + * @param {Object.|function(string, boolean)} options * @param {function(string, boolean)=} callback */ ws.WebSocket.prototype.stream = function(options, callback) {}; @@ -149,6 +149,6 @@ ws.WebSocket.prototype.onerror = function(error) {}; ws.WebSocket.prototype.onclose = function(code, message) {}; /** - * @type {?function(*, object.)} + * @type {?function(*, Object.)} */ ws.WebSocket.prototype.onmessage = function(data, flags) {}; diff --git a/fs.js b/fs.js index bd646cc..6035cdb 100644 --- a/fs.js +++ b/fs.js @@ -226,7 +226,7 @@ fs.readlinkSync = function(path) {}; /** * @param {string} path - * @param {object.|function(string, string)=} cache + * @param {Object.|function(string, string)=} cache * @param {function(string, string)=} callback * @nosideeffects */ @@ -234,7 +234,7 @@ fs.realpath = function(path, cache, callback) {}; /** * @param {string} path - * @param {object.=} cache + * @param {Object.=} cache * @return {string} * @nosideeffects */ @@ -277,14 +277,14 @@ fs.mkdirSync = function(path, mode) {}; /** * @param {string} path - * @param {function(string,array.)=} callback + * @param {function(string,Array.)=} callback * @nosideeffects */ fs.readdir = function(path, callback) {}; /** * @param {string} path - * @return {array.} + * @return {Array.} * @nosideeffects */ fs.readdirSync = function(path) {}; diff --git a/os.js b/os.js index 01d06c8..71cfa0e 100644 --- a/os.js +++ b/os.js @@ -72,7 +72,7 @@ os.release = function() {}; os.uptime = function() {}; /** - * @return {array.} + * @return {Array.} * @nosideeffects */ os.loadavg = function() {}; @@ -95,7 +95,7 @@ os.freemem = function() {}; var osCpusInfo; /** - * @return {array.} + * @return {Array.} * @nosideeffects */ os.cpus = function() {}; @@ -106,7 +106,7 @@ os.cpus = function() {}; var osNetworkInterfacesInfo; /** - * @return {object.} + * @return {Object.} * @nosideeffects */ os.networkInterfaces = function() {}; diff --git a/process.js b/process.js index 9dcfd15..b1592f4 100644 --- a/process.js +++ b/process.js @@ -43,7 +43,7 @@ process.stdout; process.stderr; /** - * @type {array.} + * @type {Array.} */ process.argv; @@ -68,7 +68,7 @@ process.chdir = function(directory) {}; process.cwd = function() {}; /** - * @type {object.} + * @type {Object.} */ process.env; @@ -110,7 +110,7 @@ process.version; process.versions; /** - * @type {object.} + * @type {Object.} */ process.config; @@ -141,7 +141,7 @@ process.arch; process.platform; /** - * @return {object.} + * @return {Object.} * @nosideeffects */ process.memoryUsage = function() {}; From ae67e0ab5384f45efc000f690f218e752bbd24d5 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 09:00:51 -0600 Subject: [PATCH 02/17] Fix typos in type annotations The intent of these annotations seems clear, fix the typos. Signed-off-by: Kevin Locke --- domain.js | 2 +- net.js | 4 ++-- zlib.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/domain.js b/domain.js index 5064e58..3349561 100644 --- a/domain.js +++ b/domain.js @@ -54,7 +54,7 @@ domain.Domain.prototype.run = function(fn) {}; domain.Domain.prototype.members; /** - * @param {events.Emitter} emitter + * @param {events.EventEmitter} emitter */ domain.Domain.prototype.add = function(emitter) {}; diff --git a/net.js b/net.js index d38d582..57bf9d0 100644 --- a/net.js +++ b/net.js @@ -72,7 +72,7 @@ net.Server = function() {}; /** * - * @param {mumber|*} port + * @param {number|*} port * @param {(string|number|function(...))=} host * @param {(number|function(...))=} backlog * @param {function(...)=} callback @@ -107,7 +107,7 @@ net.Server.prototype.connections; net.Socket = function(options) {}; /** - * @param {number|string|function(..)} port + * @param {number|string|function(...)} port * @param {(string|function(...))=} host * @param {function(...)=} connectListener */ diff --git a/zlib.js b/zlib.js index 2bd9eab..37591ee 100644 --- a/zlib.js +++ b/zlib.js @@ -122,7 +122,7 @@ zlib.createInflate = function(options) {}; /** * @param {zlib.Options} options - * @return {zlib.ReflateRaw} + * @return {zlib.DeflateRaw} */ zlib.createDeflateRaw = function(options) {}; From 51887289c810b179f0aef73a618f8abb8f340aad Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 09:01:36 -0600 Subject: [PATCH 03/17] Fix unqualified uses of the buffer.Buffer type The type requires the buffer namespace in order to be resolved. Add it where missing. Signed-off-by: Kevin Locke --- child_process.js | 6 +++--- http.js | 8 ++++---- stream.js | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/child_process.js b/child_process.js index a846bd8..b9719c5 100644 --- a/child_process.js +++ b/child_process.js @@ -90,8 +90,8 @@ child_process.ChildProcess.spawn = function(command, args, options) {}; /** * @param {string} command - * @param {child_process.Options|function(Error, Buffer, Buffer)=} options - * @param {function(Error, Buffer, Buffer)=} callback + * @param {child_process.Options|function(Error, buffer.Buffer, buffer.Buffer)=} options + * @param {function(Error, buffer.Buffer, buffer.Buffer)=} callback * @return {child_process.ChildProcess} */ child_process.exec = function(command, options, callback) {}; @@ -100,7 +100,7 @@ child_process.exec = function(command, options, callback) {}; * @param {string} file * @param {Array.} args * @param {child_process.Options} options - * @param {function(Error, Buffer, Buffer)} callback + * @param {function(Error, buffer.Buffer, buffer.Buffer)} callback * @return {child_process.ChildProcess} */ child_process.execFile = function(file, args, options, callback) {}; diff --git a/http.js b/http.js index c332d4b..e34b755 100644 --- a/http.js +++ b/http.js @@ -159,7 +159,7 @@ http.ServerResponse.prototype.getHeader = function(name) {}; http.ServerResponse.prototype.removeHeader = function(name) {}; /** - * @param {string|Array|Buffer} chunk + * @param {string|Array|buffer.Buffer} chunk * @param {string=} encoding */ http.ServerResponse.prototype.write = function(chunk, encoding) {}; @@ -170,7 +170,7 @@ http.ServerResponse.prototype.write = function(chunk, encoding) {}; http.ServerResponse.prototype.addTrailers = function(headers) {}; /** - * @param {(string|Array|Buffer)=} data + * @param {(string|Array|buffer.Buffer)=} data * @param {string=} encoding */ http.ServerResponse.prototype.end = function(data, encoding) {}; @@ -183,13 +183,13 @@ http.ServerResponse.prototype.end = function(data, encoding) {}; http.ClientRequest = function() {}; /** - * @param {string|Array|Buffer} chunk + * @param {string|Array|buffer.Buffer} chunk * @param {string=} encoding */ http.ClientRequest.prototype.write = function(chunk, encoding) {}; /** - * @param {(string|Array|Buffer)=} data + * @param {(string|Array|buffer.Buffer)=} data * @param {string=} encoding */ http.ClientRequest.prototype.end = function(data, encoding) {}; diff --git a/stream.js b/stream.js index 4130cce..27ee8d1 100644 --- a/stream.js +++ b/stream.js @@ -75,13 +75,13 @@ stream.WritableStream.prototype.drain = function() {}; stream.WritableStream.prototype.writable; /** - * @param {string|buffer} buffer + * @param {string|buffer.Buffer} buffer * @param {string=} encoding */ stream.WritableStream.prototype.write = function(buffer, encoding) {}; /** - * @param {string|buffer} buffer + * @param {string|buffer.Buffer} buffer * @param {string=} encoding */ stream.WritableStream.prototype.end = function(buffer, encoding) {}; @@ -109,7 +109,7 @@ stream.Readable = function(options) {}; stream.Readable.prototype.readable; /** - * @param {string|buffer.Buffe} chunk + * @param {string|buffer.Buffer} chunk * @return {boolean} */ stream.Readable.prototype.push = function(chunk) {}; From d76ca545b5da0dc06f9f832d73576188bab681fc Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 09:08:28 -0600 Subject: [PATCH 04/17] Buffer doesn't extend Array From source inspection and usage, it's clear that Buffer doesn't extend Array (for example, Buffer has no pop method). Remove this annotation (which also fixes the type incompatibility of the slice method). Signed-off-by: Kevin Locke --- buffer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/buffer.js b/buffer.js index 5547046..276610f 100644 --- a/buffer.js +++ b/buffer.js @@ -36,7 +36,6 @@ var buffer = {}; /** * @param {...*} var_args * @constructor - * @extends Array * @nosideeffects */ buffer.Buffer = function(var_args) {}; From 7c545e06dbae0ac4aa433d96068dbf32a9c94f00 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 09:15:00 -0600 Subject: [PATCH 05/17] Fix type of cluster cluster is actually an instance of the private Cluster type, which extends EventEmitter. Therefore, annotate cluster as being of type EventEmitter. Note: This code is now not runnable, since assigning to cluster would require either reference to the events namespace (which isn't imported) or leaving it null which would fail for subsequent property accesses. But that's fine, since externs aren't run. Signed-off-by: Kevin Locke --- cluster.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster.js b/cluster.js index 7e0a4b0..0e5b4a9 100644 --- a/cluster.js +++ b/cluster.js @@ -29,9 +29,9 @@ */ /** - * @extends events.EventEmitter + * @type events.EventEmitter */ -var cluster = function() {}; +var cluster; /** * @typedef {{exec: string, args: Array., silent: boolean}} From 53d8d289cd60b95fbd7aa0e307b2bfaacb891ab2 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 09:17:26 -0600 Subject: [PATCH 06/17] Make options argument of child_process.fork optional According to the docs (and code) this argument is optional. This also fixes the warning about non-optional arguments following optional arguments. Signed-off-by: Kevin Locke --- child_process.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/child_process.js b/child_process.js index b9719c5..d881932 100644 --- a/child_process.js +++ b/child_process.js @@ -108,7 +108,7 @@ child_process.execFile = function(file, args, options, callback) {}; /** * @param {string} modulePath * @param {Array.=} args - * @param {child_process.Options} options + * @param {child_process.Options=} options * @return {child_process.ChildProcess} */ child_process.fork = function(modulePath, args, options) {}; From 338e07eee368f7f173aecf0fe6f7a2999fc8990f Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 09:20:51 -0600 Subject: [PATCH 07/17] Fix type of module.require Although it has the same type as the global require function, the global require function isn't a type (constructor). So update the type of module.require to match it. This fixes the following warning: ./core.js:76: WARNING - Bad type annotation. Unknown type require * @type {require} ^ Signed-off-by: Kevin Locke --- core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core.js b/core.js index 70f87dc..9f3f090 100644 --- a/core.js +++ b/core.js @@ -73,7 +73,7 @@ var exports; module.exports; /** - * @type {require} + * @type {function(string)} */ module.require; From 9415d5d2f26b8d61a61f676cedaef4f12a348edb Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 11:13:12 -0600 Subject: [PATCH 08/17] Major reworking of streams Update the annotations to match their definitions in node 0.10. Also, stream (the namespace) is not a class, use stream.Stream instead as appropriate. This commit doesn't fix the multiple inheritance/mixin issue with Duplex needing to extend from both Readable and Writable. This may require defining some interfaces which can be implemented. This commit also doesn't touch ReadableStream and WritableStream. I'm not sure of the purpose of these classes and since they are heavily used in other namespaces, I'll leave them alone for now. Signed-off-by: Kevin Locke --- repl.js | 2 +- stream.js | 73 +++++++++++++++++++++++++++++-------------------------- tls.js | 2 +- zlib.js | 2 +- 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/repl.js b/repl.js index b7864b7..02f0bc6 100644 --- a/repl.js +++ b/repl.js @@ -34,7 +34,7 @@ var repl = {}; /** - * @param {{prompt: ?string, input: ?stream, output: ?stream, terminal: ?boolean, eval: ?function(string), useColors: ?boolean, useGlobal: ?boolean, ignoreUndefined: ?boolean, writer: ?function(string)}} options + * @param {{prompt: ?string, input: ?stream.Readable, output: ?stream.Writable, terminal: ?boolean, eval: ?function(string), useColors: ?boolean, useGlobal: ?boolean, ignoreUndefined: ?boolean, writer: ?function(string)}} options * @return {repl.REPLServer} */ repl.start = function(options) {}; diff --git a/stream.js b/stream.js index 27ee8d1..b543cbd 100644 --- a/stream.js +++ b/stream.js @@ -28,16 +28,21 @@ END_NODE_INCLUDE */ +var stream = {}; + /** * @constructor + * @param {Object=} options * @extends events.EventEmitter */ -var stream = function() {}; +stream.Stream = function(options) {}; /** - * @type {stream} + * @param {stream.Writable} dest + * @param {{end: boolean}=} pipeOpts + * @return {stream.Writable} */ -stream.Stream = function() {}; +stream.Stream.prototype.pipe = function(dest, pipeOpts) {}; /** * @constructor @@ -99,23 +104,25 @@ stream.WritableStream.prototype.destroySoon = function() {}; /** * @constructor * @param {Object=} options - * @extends stream + * @extends stream.Stream */ stream.Readable = function(options) {}; /** * @type {boolean} + * @deprecated */ stream.Readable.prototype.readable; /** - * @param {string|buffer.Buffer} chunk + * @protected + * @param {string|buffer.Buffer|null} chunk * @return {boolean} */ stream.Readable.prototype.push = function(chunk) {}; /** - * @param {string|buffer.Buffer} chunk + * @param {string|buffer.Buffer|null} chunk * @return {boolean} */ stream.Readable.prototype.unshift = function(chunk) {}; @@ -126,26 +133,19 @@ stream.Readable.prototype.unshift = function(chunk) {}; stream.Readable.prototype.setEncoding = function(enc) {}; /** - * @param {number} n - * @return {buffer.Buffer} + * @param {number=} n + * @return {buffer.Buffer|string|null} */ stream.Readable.prototype.read = function(n) {}; /** + * @protected * @param {number} n - * @return {?buffer.Buffer} */ stream.Readable.prototype._read = function(n) {}; /** - * @param {stream.Writable} dest - * @param {{end: boolean}=} pipeOpts - * @return {stream.Writable} - */ -stream.Readable.prototype.pipe = function(dest, pipeOpts) {}; - -/** - * @param {stream.Writable} dest + * @param {stream.Writable=} dest * @return {stream.Readable} */ stream.Readable.prototype.unpipe = function(dest) {}; @@ -159,46 +159,44 @@ stream.Readable.prototype.resume = function() {}; stream.Readable.prototype.pause = function() {}; /** - * @param {stream} stream + * @param {stream.Stream} stream + * @return {stream.Readable} */ stream.Readable.prototype.wrap = function(stream) {}; /** * @constructor * @param {Object=} options - * @extends stream + * @extends stream.Stream */ stream.Writable = function(options) {}; /** + * @deprecated * @type {boolean} */ stream.Writable.prototype.writable; -/** - */ -stream.Writable.prototype.pipe = function() {}; - /** * @param {string|buffer.Buffer} chunk - * @param {(string|function(...))=} encoding - * @param {function(...)=} cb + * @param {string=} encoding + * @param {function(*=)=} cb * @return {boolean} */ stream.Writable.prototype.write = function(chunk, encoding, cb) {}; /** + * @protected * @param {string|buffer.Buffer} chunk - * @param {(string|function(...))=} encoding - * @param {function(...)=} cb + * @param {string} encoding + * @param {function(*=)} cb */ stream.Writable.prototype._write = function(chunk, encoding, cb) {}; /** - * @param {string|buffer.Buffer} chunk - * @param {(string|function(...))=} encoding - * @param {function(...)=} cb - * @return {boolean} + * @param {string|buffer.Buffer=} chunk + * @param {string=} encoding + * @param {function(*=)=} cb */ stream.Writable.prototype.end = function(chunk, encoding, cb) {}; @@ -206,7 +204,7 @@ stream.Writable.prototype.end = function(chunk, encoding, cb) {}; * @constructor * @param {Object=} options * @extends stream.Readable - * @implements stream.Writable + * Xextends stream.Writable */ stream.Duplex = function(options) {}; @@ -224,11 +222,18 @@ stream.Duplex.prototype.allowHalfOpen; stream.Transform = function(options) {}; /** + * @protected * @param {string|buffer.Buffer} chunk - * @param {*} output + * @param {string} encoding + * @param {function(*=)} cb + */ +stream.Transform._transform = function(chunk, encoding, cb) {}; + +/** + * @protected * @param {function(*=)} cb */ -stream.Transform._transform = function(chunk, output, cb) {}; +stream.Transform._flush = function(cb) {}; /** * @param {Object=} options diff --git a/tls.js b/tls.js index 5d181a2..56450f7 100644 --- a/tls.js +++ b/tls.js @@ -115,7 +115,7 @@ tls.Server.prototype.connections; /** * @constructor - * @extends stream + * @extends stream.Duplex */ tls.CleartextStream = function() {}; diff --git a/zlib.js b/zlib.js index 37591ee..30b95b7 100644 --- a/zlib.js +++ b/zlib.js @@ -42,7 +42,7 @@ zlib.Options; /** * @constructor - * @extends stream.WriteStream + * @extends stream.Transform */ zlib.Zlib = function() {}; From 67e8321ad488f83a88fa8ebcf7ac39f60f1a6d80 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 11:27:22 -0600 Subject: [PATCH 09/17] Add Date type to time arguments in fs All of the functions which take a time argument accept either numbers (as seconds since the epoch) or a Date. Add the Date type to arguments where it was missing. Signed-off-by: Kevin Locke --- fs.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs.js b/fs.js index 6035cdb..818558c 100644 --- a/fs.js +++ b/fs.js @@ -320,8 +320,8 @@ fs.openSync = function(path, flags, mode) {}; /** * @param {string} path - * @param {number} atime - * @param {number} mtime + * @param {number|Date} atime + * @param {number|Date} mtime * @param {function(...)=} callback * @nosideeffects */ @@ -329,16 +329,16 @@ fs.utimes = function(path, atime, mtime, callback) {}; /** * @param {string} path - * @param {number} atime - * @param {number} mtime + * @param {number|Date} atime + * @param {number|Date} mtime * @nosideeffects */ fs.utimesSync = function(path, atime, mtime) {}; /** * @param {*} fd - * @param {number} atime - * @param {number} mtime + * @param {number|Date} atime + * @param {number|Date} mtime * @param {function(...)=} callback * @nosideeffects */ @@ -346,8 +346,8 @@ fs.futimes = function(fd, atime, mtime, callback) {}; /** * @param {*} fd - * @param {number} atime - * @param {number} mtime + * @param {number|Date} atime + * @param {number|Date} mtime * @nosideeffects */ fs.futimesSync = function(fd, atime, mtime) {}; From fdf9cfde902af836570b4190ff0a5c44d4e92536 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 11:28:08 -0600 Subject: [PATCH 10/17] Remove number assignment to Date properties The properties of Stat with Date type were being assigned numbers, which caused compile warnings. Remove the unnecessary assignment. Signed-off-by: Kevin Locke --- fs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs.js b/fs.js index 818558c..5c44b16 100644 --- a/fs.js +++ b/fs.js @@ -585,17 +585,17 @@ fs.Stats.prototype.blocks = 0; /** * @type {Date} */ -fs.Stats.prototype.atime = 0; +fs.Stats.prototype.atime; /** * @type {Date} */ -fs.Stats.prototype.mtime = 0; +fs.Stats.prototype.mtime; /** * @type {Date} */ -fs.Stats.prototype.ctime = 0; +fs.Stats.prototype.ctime; /** * @param {string} path From 787ef3dc1efd52dbc7c8ec8ad6161097cf84f671 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 12:11:02 -0600 Subject: [PATCH 11/17] Replace ServerRequest/ClientResponse with IncomingMessage Replace the http.ServerRequest and http.ClientResponse classes with the IncomingMessage class, as is done in recent versions of node. Add the missing members to the prototype. Signed-off-by: Kevin Locke --- contrib/Ws.js | 2 +- http.js | 94 +++++++++++++-------------------------------------- https.js | 6 ++-- 3 files changed, 27 insertions(+), 75 deletions(-) diff --git a/contrib/Ws.js b/contrib/Ws.js index 5e76132..c7f1f6a 100644 --- a/contrib/Ws.js +++ b/contrib/Ws.js @@ -48,7 +48,7 @@ ws.Server = function(options, callback) {}; ws.Server.prototype.close = function(code, data) {}; /** - * @param {http.ServerRequest} request + * @param {http.IncomingMessage} request * @param {net.Socket} socket * @param {string} upgradeHead * @param {function(...)} callback diff --git a/http.js b/http.js index e34b755..fa36537 100644 --- a/http.js +++ b/http.js @@ -30,7 +30,7 @@ END_NODE_INCLUDE var http = {}; /** - * @typedef {function(http.ServerRequest, http.ServerResponse)} + * @typedef {function(http.IncomingMessage, http.ServerResponse)} */ http.requestListener; @@ -60,63 +60,65 @@ http.Server.prototype.close = function() {}; /** * @constructor - * @extends events.EventEmitter - * @private + * @extends stream.Readable */ -http.ServerRequest = function() {}; +http.IncomingMessage = function() {}; /** - * @type {string} + * @type {?string} * */ -http.ServerRequest.prototype.method; +http.IncomingMessage.prototype.method; /** - * @type {string} + * @type {?string} */ -http.ServerRequest.prototype.url; +http.IncomingMessage.prototype.url; /** * @type {Object} * */ -http.ServerRequest.prototype.headers; +http.IncomingMessage.prototype.headers; /** * @type {Object} * */ -http.ServerRequest.prototype.trailers; +http.IncomingMessage.prototype.trailers; /** * @type {string} */ -http.ServerRequest.prototype.httpVersion; +http.IncomingMessage.prototype.httpVersion; /** * @type {string} */ -http.ServerRequest.prototype.httpVersionMajor; +http.IncomingMessage.prototype.httpVersionMajor; /** * @type {string} */ -http.ServerRequest.prototype.httpVersionMinor; +http.IncomingMessage.prototype.httpVersionMinor; /** - * @param {?string} encoding + * @type {*} */ -http.ServerRequest.prototype.setEncoding = function(encoding) {}; +http.IncomingMessage.prototype.connection; /** + * @type {?number} */ -http.ServerRequest.prototype.pause = function() {}; +http.IncomingMessage.prototype.statusCode; /** + * @type {net.Socket} */ -http.ServerRequest.prototype.resume = function() {}; +http.IncomingMessage.prototype.socket; /** - * @type {*} + * @param {number} msecs + * @param {function()} callback */ -http.ServerRequest.prototype.connection; +http.IncomingMessage.prototype.setTimeout = function(msecs, callback) {}; /** * @constructor @@ -198,66 +200,16 @@ http.ClientRequest.prototype.end = function(data, encoding) {}; */ http.ClientRequest.prototype.abort = function() {}; -/** - * @constructor - * @extends events.EventEmitter - * @private - */ -http.ClientResponse = function() {}; - -/** - * @type {number} - */ -http.ClientResponse.prototype.statusCode; - -/** - * @type {string} - */ -http.ClientResponse.prototype.httpVersion; - -/** - * @type {string} - */ -http.ClientResponse.prototype.httpVersionMajor; - -/** - * @type {string} - */ -http.ClientResponse.prototype.httpVersionMinor; - -/** - * @type {Object} - * */ -http.ClientResponse.prototype.headers; - -/** - * @type {Object} - * */ -http.ClientResponse.prototype.trailers; - -/** - * @param {?string} encoding - */ -http.ClientResponse.prototype.setEncoding = function(encoding) {}; - -/** - */ -http.ClientResponse.prototype.pause = function() {}; - -/** - */ -http.ClientResponse.prototype.resume = function() {}; - /** * @param {Object} options - * @param {function(http.ClientResponse)} callback + * @param {function(http.IncomingMessage)} callback * @return {http.ClientRequest} */ http.request = function(options, callback) {}; /** * @param {Object} options - * @param {function(http.ClientResponse)} callback + * @param {function(http.IncomingMessage)} callback * @return {http.ClientRequest} */ http.get = function(options, callback) {}; diff --git a/https.js b/https.js index af31516..8d129b3 100644 --- a/https.js +++ b/https.js @@ -47,7 +47,7 @@ https.Server.prototype.close = function(callback) {}; /** * @param {tls.CreateOptions} options - * @param {function(https.Request, https.Response)=} requestListener + * @param {function(http.IncomingMessage, http.ServerResponse)=} requestListener */ https.createServer = function(options, requestListener) {}; @@ -58,14 +58,14 @@ https.ConnectOptions; /** * @param {https.ConnectOptions|string} options - * @param {function(http.ClientResponse)} callback + * @param {function(http.IncomingMessage)} callback * @return {http.ClientRequest} */ https.request = function(options, callback) {}; /** * @param {https.ConnectOptions|string} options - * @param {function(http.ClientResponse)} callback + * @param {function(http.IncomingMessage)} callback * @return {http.ClientRequest} */ https.get = function(options, callback) {}; From 2691d32bf737d9bf39242eb4736dc0a92c3ec1bd Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 12:49:51 -0600 Subject: [PATCH 12/17] Update crypto module Lots of refactoring to work around the fact that Closure Compiler doesn't have proper support for mixins. Ensure that @extends meets the requirement that X instanceof Y if X @extends Y. Add copies of the annotations for all mixin methods and aliased functions. Also add missing annotations for pbkdf2. Signed-off-by: Kevin Locke --- crypto.js | 195 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 140 insertions(+), 55 deletions(-) diff --git a/crypto.js b/crypto.js index 6d963a9..28e9a8f 100644 --- a/crypto.js +++ b/crypto.js @@ -57,7 +57,7 @@ crypto.createHash = function(algorithm) {}; /** * @param {string} algorithm - * @param {Object} options + * @param {Object=} options * @constructor * @extends stream.Transform */ @@ -85,7 +85,7 @@ crypto.createHmac = function(algorithm, key) {}; /** * @param {string} hmac * @param {string|buffer.Buffer} key - * @param {Object} options + * @param {Object=} options * @constructor * @extends stream.Transform */ @@ -112,14 +112,14 @@ crypto.createCipher = function(algorithm, password) {}; * @param {string} algorithm * @param {string|buffer.Buffer} key * @param {string|buffer.Buffer} iv - * @return {crypto.Cipher} + * @return {crypto.Cipheriv} */ crypto.createCipheriv = function(algorithm, key, iv) {}; /** * @param {string|buffer.Buffer} cipher * @param {string} password - * @param {Object} options + * @param {Object=} options * @constructor * @extends stream.Transform */ @@ -135,11 +135,10 @@ crypto.Cipher.prototype.update = function(data, input_encoding, output_encoding) /** * @name crypto.Cipher.prototype.final - * @function * @param {string} output_encoding * @return {string|buffer.Buffer} */ -// crypto.Cipher.prototype.final = function(output_encoding) {}; +crypto.Cipher.prototype['final'] = function(output_encoding) {}; /** * @param {boolean=} auto_padding @@ -147,14 +146,37 @@ crypto.Cipher.prototype.update = function(data, input_encoding, output_encoding) crypto.Cipher.prototype.setAutoPadding = function(auto_padding) {}; /** - * @param {string|crypto.Cipheriv} cipher + * Note: Cipheriv mixes update, final, and setAutoPadding from Cipher but + * doesn't inherit directly from Cipher. + * + * @param {string} cipher * @param {string|buffer.Buffer} key * @param {string|buffer.Buffer} iv * @constructor - * @extends crypto.Cipher + * @extends stream.Transform */ crypto.Cipheriv = function(cipher, key, iv) {}; +/** + * @param {string|buffer.Buffer} data + * @param {string=} input_encoding + * @param {string=} output_encoding + * @return {string|buffer.Buffer} + */ +crypto.Cipheriv.prototype.update = function(data, input_encoding, output_encoding) {}; + +/** + * @name crypto.Cipheriv.prototype.final + * @param {string} output_encoding + * @return {string|buffer.Buffer} + */ +crypto.Cipheriv.prototype['final'] = function(output_encoding) {}; + +/** + * @param {boolean=} auto_padding + */ +crypto.Cipheriv.prototype.setAutoPadding = function(auto_padding) {}; + /** * @param {string} algorithm * @param {string|buffer.Buffer} password @@ -166,14 +188,17 @@ crypto.createDecipher = function(algorithm, password) {}; * @param {string} algorithm * @param {string|buffer.Buffer} key * @param {string|buffer.Buffer} iv - * @return {crypto.Decipher} + * @return {crypto.Decipheriv} */ crypto.createDecipheriv = function(algorithm, key, iv) {}; /** - * @param {string|buffer.Buffer|crypto.Decipher} cipher + * Note: Decipher mixes update, final, and setAutoPadding from Cipher but + * doesn't inherit directly from Cipher. + * + * @param {string|buffer.Buffer} cipher * @param {string|buffer.Buffer} password - * @param {Object} options + * @param {Object=} options * @constructor * @extends stream.Transform */ @@ -189,11 +214,16 @@ crypto.Decipher.prototype.update = function(data, input_encoding, output_encodin /** * @name crypto.Decipher.prototype.final - * @function * @param {string} output_encoding * @return {string|buffer.Buffer} */ -// crypto.Decipher.prototype.final = function(output_encoding) {}; +crypto.Decipher.prototype['final'] = function(output_encoding) {}; + +/** + * @param {string} output_encoding + * @return {string|buffer.Buffer} + */ +crypto.Decipher.prototype.finaltol = function(output_encoding) {}; /** * @param {boolean=} auto_padding @@ -201,29 +231,53 @@ crypto.Decipher.prototype.update = function(data, input_encoding, output_encodin crypto.Decipher.prototype.setAutoPadding = function(auto_padding) {}; /** + * Note: Decipheriv mixes update, final, and setAutoPadding from Cipher but + * doesn't inherit directly from Cipher. + * * @param {string|buffer.Buffer|crypto.Decipheriv} cipher * @param {string|buffer.Buffer} key * @param {string|buffer.Buffer} iv - * @param {Object} options + * @param {Object=} options * @constructor - * @extends crypto.Cipher + * @extends stream.Transform */ crypto.Decipheriv = function(cipher, key, iv, options) {}; /** - * @type {crypto.Cipher.prototype.final} + * @param {string|buffer.Buffer} data + * @param {string=} input_encoding + * @param {string=} output_encoding + * @return {string|buffer.Buffer} + */ +crypto.Decipheriv.prototype.update = function(data, input_encoding, output_encoding) {}; + +/** + * @name crypto.Decipheriv.prototype.final + * @param {string} output_encoding + * @return {string|buffer.Buffer} + */ +crypto.Decipheriv.prototype['final'] = function(output_encoding) {}; + +/** + * @param {string} output_encoding + * @return {string|buffer.Buffer} */ -crypto.Decipheriv.prototype.finaltol; +crypto.Decipheriv.prototype.finaltol = function(output_encoding) {}; + +/** + * @param {boolean=} auto_padding + */ +crypto.Decipheriv.prototype.setAutoPadding = function(auto_padding) {}; /** * @param {string} algorithm - * @return {crypto.Signer} + * @return {crypto.Sign} */ crypto.createSign = function(algorithm) {}; /** * @param {string} algorithm - * @param {Object} options + * @param {Object=} options * @constructor * @extends stream.Writable */ @@ -241,11 +295,6 @@ crypto.Sign.prototype.update = function(data) {}; */ crypto.Sign.prototype.sign = function(private_key, output_format) {}; -/** - * @type {crypto.Sign} - */ -crypto.Signer; // Not sure about API docs / source diff - /** * @param {string} algorithm * @return crypto.Verify @@ -254,17 +303,12 @@ crypto.createVerify = function(algorithm) {}; /** * @param {string} algorithm - * @param {Object} options + * @param {Object=} options * @constructor * @extends stream.Writable */ crypto.Verify = function(algorithm, options) {}; -/** - * @type {crypto.Sign._write} - */ -crypto.Verify.prototype._write; - /** * @param {string|buffer.Buffer} data */ @@ -287,7 +331,7 @@ crypto.createDiffieHellman = function(prime, encoding) {}; /** * @param {number} sizeOrKey - * @param {string} encoding + * @param {string=} encoding * @constructor */ crypto.DiffieHellman = function(sizeOrKey, encoding) {}; @@ -345,70 +389,111 @@ crypto.DiffieHellman.prototype.setPublicKey = function(key, encoding) {}; crypto.DiffieHellman.prototype.setPrivateKey = function(key, encoding) {}; /** + * Note: DiffieHellmanGroup mixes DiffieHellman but doesn't inherit directly. + * * @param {string} name * @constructor */ crypto.DiffieHellmanGroup = function(name) {}; /** - * TODO: Not sure if this works. + * @param {string=} encoding + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellmanGroup.prototype.generateKeys = function(encoding) {}; + +/** + * @param {string|buffer.Buffer} key + * @param {string=} inEnc + * @param {string=} outEnc + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellmanGroup.prototype.computeSecret = function(key, inEnc, outEnc) {}; + +/** + * @param {string=} encoding + * @return {string|buffer.Buffer} */ -crypto.DiffieHellmanGroup.prototype.generateKeys = crypto.DiffieHellman.prototype.generateKeys; +crypto.DiffieHellmanGroup.prototype.getPrime = function(encoding) {}; /** - * TODO: Not sure if this works. + * @param {string=} encoding + * @return {string|buffer.Buffer} */ -crypto.DiffieHellmanGroup.prototype.computeSecret = crypto.DiffieHellman.prototype.computeSecret; +crypto.DiffieHellmanGroup.prototype.getGenerator = function(encoding) {}; /** - * @type {crypto.DiffieHellman.prototype.getPrime} + * @param {string=} encoding + * @return {string|buffer.Buffer} */ -crypto.DiffieHellmanGroup.prototype.getPrime = crypto.DiffieHellman.prototype.getPrime; +crypto.DiffieHellmanGroup.prototype.getPublicKey = function(encoding) {}; /** - * @type {crypto.DiffieHellman.prototype.getGenerator} + * @param {string} encoding + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellmanGroup.prototype.getPrivateKey = function(encoding) {} + +/** + * @param {string|buffer.Buffer} key + * @param {string=} encoding + * @return {crypto.DiffieHellmanGroup} */ -crypto.DiffieHellmanGroup.prototype.getGenerator = crypto.DiffieHellman.prototype.getGenerator; +crypto.DiffieHellmanGroup.prototype.setPublicKey = function(key, encoding) {}; /** - * @type {crypto.DiffieHellman.prototype.getPublicKey} + * @param {string|buffer.Buffer} key + * @param {string=} encoding + * @return {crypto.DiffieHellmanGroup} */ -crypto.DiffieHellmanGroup.prototype.getPublicKey = crypto.DiffieHellman.prototype.getPublicKey; +crypto.DiffieHellmanGroup.prototype.setPrivateKey = function(key, encoding) {}; /** - * @type {crypto.DiffieHellman.prototype.getPrivateKey} + * @param {string} group_name + * @return {crypto.DiffieHellmanGroup} */ -crypto.DiffieHellmanGroup.prototype.getPrivateKey = crypto.DiffieHellman.prototype.getPrivateKey; +crypto.getDiffieHellman = function(group_name) {}; /** - * @type {crypto.DiffieHellman.prototype.setPublicKey} + * @param {string|buffer.Buffer} password + * @param {string|buffer.Buffer} salt + * @param {number} iterations + * @param {number} keylen + * @param {function(*, string)} callback */ -crypto.DiffieHellmanGroup.prototype.setPublicKey = crypto.DiffieHellman.prototype.setPublicKey; +crypto.pbkdf2 = function(password, salt, iterations, keylen, callback) {}; /** - * @type {crypto.DiffieHellman.prototype.setPrivateKey} + * @param {string|buffer.Buffer} password + * @param {string|buffer.Buffer} salt + * @param {number} iterations + * @param {number} keylen */ -crypto.DiffieHellmanGroup.prototype.setPrivateKey = crypto.DiffieHellman.prototype.setPrivateKey; +crypto.pbkdf2Sync = function(password, salt, iterations, keylen) {}; /** - * @type {*} + * @param {number} size + * @param {function(Error, buffer.Buffer)=} callback */ -crypto.randomBytes; +crypto.randomBytes = function(size, callback) {}; /** - * @type {*} + * @param {number} size + * @param {function(Error, buffer.Buffer)=} callback */ -crypto.pseudoRandomBytes; +crypto.pseudoRandomBytes = function(size, callback) {}; /** - * @type {crypto.randomBytes} + * @param {number} size + * @param {function(Error, buffer.Buffer)=} callback */ -crypto.rng = crypto.randomBytes; +crypto.rng = function(size, callback) {}; /** - * @type {crypto.pseudoRandomBytes} + * @param {number} size + * @param {function(Error, buffer.Buffer)=} callback */ -crypto.prng = crypto.pseudoRandomBytes; +crypto.prng = function(size, callback) {}; /** * @return {Array.} From d801af7da07935f4cec63699eb4434ab131ce0a1 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 12:56:57 -0600 Subject: [PATCH 13/17] Remove unnecessary members from tls.Server These members are all inherited from net.Server and don't need to be redefined for tls.Server (and the listen definition was causing type warnings). Signed-off-by: Kevin Locke --- tls.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/tls.js b/tls.js index 56450f7..0d3980f 100644 --- a/tls.js +++ b/tls.js @@ -81,38 +81,12 @@ tls.SecurePair = function() {}; */ tls.Server = function() {}; -/** - * @param {number} port - * @param {(string|function(...))=} host - * @param {function(...)=} callback - */ -tls.Server.prototype.listen = function(port, host, callback) {}; - -/** - */ -tls.Server.prototype.close = function() {}; - -/** - * @return {{port: number, family: string, address: string}} - */ -tls.Server.prototype.address = function() {}; - /** * @param {string} hostname * @param {string|buffer.Buffer} credentials */ tls.Server.prototype.addContext = function(hostname, credentials) {}; -/** - * @type {number} - */ -tls.Server.prototype.maxConnections; - -/** - * @type {number} - */ -tls.Server.prototype.connections; - /** * @constructor * @extends stream.Duplex From b111cb1938c2a94e84e1c6476583b13359fe64fc Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 13:08:07 -0600 Subject: [PATCH 14/17] Remove Object.prototype.inspect I'm not sure if this used to be added by node, but I can't find it anywhere in the docs or code in recent versions. It was also causing the following warning (due to a conflict with util.inspect): ./util.js:77: WARNING - assignment to property inspect of Object. found : function (*, boolean=, number=, boolean=): string required: function (this:Object): ? util.inspect = function(object, showHidden, depth, colors) {}; ^ Signed-off-by: Kevin Locke --- core.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core.js b/core.js index 9f3f090..3167e88 100644 --- a/core.js +++ b/core.js @@ -22,10 +22,6 @@ * @author Daniel Wirtz */ -/** - */ -Object.prototype.inspect = function() {}; - /** * @param name * @return {*} From 13fca10965d1f567033da1ec71a84baf30a52002 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 13:10:46 -0600 Subject: [PATCH 15/17] Match stream.WritableStream.end to stream.Writable.end Until we decide what to do with WritableStream, fix it to avoid producing any warnings. Signed-off-by: Kevin Locke --- stream.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stream.js b/stream.js index b543cbd..c0a645c 100644 --- a/stream.js +++ b/stream.js @@ -86,10 +86,11 @@ stream.WritableStream.prototype.writable; stream.WritableStream.prototype.write = function(buffer, encoding) {}; /** - * @param {string|buffer.Buffer} buffer + * @param {string|buffer.Buffer=} buffer * @param {string=} encoding + * @param {function(*=)=} cb */ -stream.WritableStream.prototype.end = function(buffer, encoding) {}; +stream.WritableStream.prototype.end = function(buffer, encoding, cb) {}; /** */ From 62c1aac8324b4264c7fe348ca7576ad8672ef983 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 13:30:38 -0600 Subject: [PATCH 16/17] Remove @nosideeffects from buffer.Buffer.prototype.copy The side-effect of this method is copying data into the target buffer given as an argument. Signed-off-by: Kevin Locke --- buffer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/buffer.js b/buffer.js index 276610f..f14fd15 100644 --- a/buffer.js +++ b/buffer.js @@ -106,7 +106,6 @@ buffer.Buffer.prototype.length; * @param {number=} sourceStart * @param {number=} sourceEnd * @return {buffer.Buffer} - * @nosideeffects */ buffer.Buffer.prototype.copy = function(targetBuffer, targetStart, sourceStart, sourceEnd){}; From 92351b41fcb6e3c0f7ff099e8a081a216d0995f3 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 13 Apr 2013 13:31:29 -0600 Subject: [PATCH 17/17] Remove @nosideeffects from fs functions with callback The side-effectfulness of these functions is determined based on whether the callback function has side-effects. Presumably it does (what's the point of the callback otherwise?). So remove the @nosideeffects annotation. Signed-off-by: Kevin Locke --- fs.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/fs.js b/fs.js index 5c44b16..33b0442 100644 --- a/fs.js +++ b/fs.js @@ -143,7 +143,6 @@ fs.lchmodSync = function(path, mode) {}; /** * @param {string} path * @param {function(string, fs.Stats)=} callback - * @nosideeffects */ fs.stat = function(path, callback) {}; @@ -157,7 +156,6 @@ fs.statSync = function(path) {} /** * @param {*} fd * @param {function(string, fs.Stats)=} callback - * @nosideeffects */ fs.fstat = function(fd, callback) {}; @@ -171,7 +169,6 @@ fs.fstatSync = function(fd) {} /** * @param {string} path * @param {function(string, fs.Stats)=} callback - * @nosideeffects */ fs.lstat = function(path, callback) {}; @@ -213,7 +210,6 @@ fs.symlinkSync = function(srcpath, dstpath, type) {}; /** * @param {string} path * @param {function(string, string)=} callback - * @nosideeffects */ fs.readlink = function(path, callback) {}; @@ -228,7 +224,6 @@ fs.readlinkSync = function(path) {}; * @param {string} path * @param {Object.|function(string, string)=} cache * @param {function(string, string)=} callback - * @nosideeffects */ fs.realpath = function(path, cache, callback) {}; @@ -278,7 +273,6 @@ fs.mkdirSync = function(path, mode) {}; /** * @param {string} path * @param {function(string,Array.)=} callback - * @nosideeffects */ fs.readdir = function(path, callback) {}; @@ -305,7 +299,6 @@ fs.closeSync = function(fd) {}; * @param {string} flags * @param {number=} mode * @param {function(string, *)=} callback - * @nosideeffects */ fs.open = function(path, flags, mode, callback) {}; @@ -323,7 +316,6 @@ fs.openSync = function(path, flags, mode) {}; * @param {number|Date} atime * @param {number|Date} mtime * @param {function(...)=} callback - * @nosideeffects */ fs.utimes = function(path, atime, mtime, callback) {}; @@ -340,7 +332,6 @@ fs.utimesSync = function(path, atime, mtime) {}; * @param {number|Date} atime * @param {number|Date} mtime * @param {function(...)=} callback - * @nosideeffects */ fs.futimes = function(fd, atime, mtime, callback) {}; @@ -390,7 +381,6 @@ fs.writeSync = function(fd, buffer, offset, length, position) {}; * @param {number} length * @param {number} position * @param {function(string, number, *)=} callback - * @nosideeffects */ fs.read = function(fd, buffer, offset, length, position, callback) {}; @@ -409,7 +399,6 @@ fs.readSync = function(fd, buffer, offset, length, position) {}; * @param {string} filename * @param {string|function(string, *)=}encoding * @param {function(string, *)=} callback - * @nosideeffects */ fs.readFile = function(filename, encoding, callback) {}; @@ -475,7 +464,6 @@ fs.watch = function(filename, options, listener) {}; /** * @param {string} path * @param {function(boolean)} callback - * @nosideeffects */ fs.exists = function(path, callback) {};