diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..936e5c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules/ +/package-lock.json diff --git a/buffer.js b/buffer.js index f14fd15..f5cb8f4 100644 --- a/buffer.js +++ b/buffer.js @@ -28,14 +28,17 @@ END_NODE_INCLUDE */ + + + /** * @type {Object.} */ var buffer = {}; /** - * @param {...*} var_args * @constructor + * @param {...*} var_args * @nosideeffects */ buffer.Buffer = function(var_args) {}; diff --git a/contrib/mime.js b/contrib/mime.js new file mode 100644 index 0000000..3b6f645 --- /dev/null +++ b/contrib/mime.js @@ -0,0 +1,63 @@ +/* + * Copyright 2012 The Closure Compiler Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Definitions for the mime module. + * @see https://www.npmjs.com/package/mime + * @see https://github.com/broofa/node-mime + * @externs + * @author Jay Shepherd + */ + +/** + BEGIN_NODE_INCLUDE + var mime = require('mime'); + END_NODE_INCLUDE + */ + + +var mime = {R_OK: {}}; + +/** + * Define mimetype -> xtension mappings. Each key is a mime-type that maps + * to an array of extensions associated with the type. The first extension is + * used as the default extension for the type. + * + * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); + * + * If a type declares an extension that has already been defined, an error will + * be thrown. To suppress this error and force the extension to be associated + * with the new type, pass `force`=true. Alternatively, you may prefix the + * extension with "*" to map the type to extension, without mapping the + * extension to the type. + * + * e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']}); + * + * + * @param typeMap (Object) type definitions + * @param force (Boolean) if true, force overriding of existing definitions + */ +mime.define = function(typeMap, force) {}; + +/** + * Lookup a mime type based on extension + */ +mime.getType = function(path) {}; + +/** + * Return file extension associated with a mime type + */ +mime.getExtension = function(type) {}; \ No newline at end of file diff --git a/core.js b/core.js index fbc2f12..4fb5a0e 100644 --- a/core.js +++ b/core.js @@ -103,7 +103,3 @@ module.children; */ var global = {}; -/** - * @type {buffer.Buffer} - */ -var Buffer; diff --git a/fs.js b/fs.js index 85ec1df..daba731 100644 --- a/fs.js +++ b/fs.js @@ -30,6 +30,16 @@ var fs = {}; + + +/** @enum {number} */ +fs.constants = {}; + +/** + * @type {number} + */ +fs.constants.R_OK; + /** * @param {string} oldPath * @param {string} newPath diff --git a/package.json b/package.json index 75e0bb5..91d6e24 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,10 @@ "author": "Daniel Wirtz ", "description": "A collection of node.js externs for use with ClosureCompiler.js.", "contributors": [ - { "name": "Daniel Wirtz", "email": "dcode@dcode.io" } + { + "name": "Daniel Wirtz", + "email": "dcode@dcode.io" + } ], "repository": { "type": "git", diff --git a/redundant/stdio.js b/redundant/stdio.js index 00888ec..b96ade1 100644 --- a/redundant/stdio.js +++ b/redundant/stdio.js @@ -22,7 +22,7 @@ */ /** - * @type {Object.} + * @type {Object.} */ var console = {}; diff --git a/redundant/timers.js b/redundant/timers.js index 576ccb5..16b8ebc 100644 --- a/redundant/timers.js +++ b/redundant/timers.js @@ -23,7 +23,7 @@ */ /** - * @param {function(...[*])} callback + * @param {function(...)} callback * @param {number} delay * @param {...*} var_args * @return {*} @@ -36,7 +36,7 @@ function setTimeout(callback, delay, var_args) {}; function clearTimeout(timeoutId) {}; /** - * @param {function(...[*])} callback + * @param {function(...)} callback * @param {number} delay * @param {...*} var_args * @return {*} diff --git a/tests/validate.js b/tests/validate.js index 5410455..e3fc9a9 100644 --- a/tests/validate.js +++ b/tests/validate.js @@ -29,18 +29,21 @@ for (var i=0; i