move to typings

This commit is contained in:
Joao Moreno 2016-09-19 12:46:33 +02:00
parent 15ec864027
commit 398fcc91dc
40 changed files with 1997 additions and 1031 deletions

View file

@ -22,7 +22,7 @@ const readFile = denodeify<string, string, string>(fs.readFile);
const writeFile = denodeify<string, string, string, void>(fs.writeFile);
const unlink = denodeify<string, void>(fs.unlink);
const exec = denodeify<string, { cwd?: string; }, { stdout: string; stderr: string; }>(cp.exec, (err, stdout, stderr) => [err, { stdout, stderr }]);
const glob = denodeify<string, _glob.IOptions, string[]>(_glob);
const glob = denodeify<string, _glob.Options, string[]>(_glob);
const resourcesPath = path.join(path.dirname(__dirname), 'resources');
const vsixManifestTemplatePath = path.join(resourcesPath, 'extension.vsixmanifest');

View file

@ -1,5 +1,20 @@
{
"dependencies": {
"lodash": "registry:npm/lodash#4.0.0+20160723033700"
"glob": "registry:npm/glob#6.0.0+20160723033700",
"lodash": "registry:npm/lodash#4.0.0+20160723033700",
"mime": "registry:npm/mime#1.3.0+20160723033700",
"minimatch": "registry:npm/minimatch#3.0.0+20160723033700"
},
"globalDependencies": {
"commander": "registry:dt/commander#2.3.0+20160317120654",
"denodeify": "registry:dt/denodeify#1.2.1+20160316155526",
"es6-promise": "registry:dt/es6-promise#0.0.0+20160614011821",
"mocha": "registry:dt/mocha#2.2.5+20160720003353",
"node": "registry:env/node#4.0.0+20160918225031",
"q": "registry:dt/q#0.0.0+20160613154756",
"read": "registry:dt/read#0.0.0+20160317120654",
"semver": "registry:dt/semver#5.3.0+20160801120957",
"tmp": "registry:dt/tmp#0.0.0+20160514170650",
"xml2js": "registry:dt/xml2js#0.0.0+20160317120654"
}
}

View file

@ -1,73 +0,0 @@
// Type definitions for es6-promise
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface Thenable<R> {
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
}
declare class Promise<R> implements Thenable<R> {
/**
* If you call resolve in the body of the callback passed to the constructor,
* your promise is fulfilled with result object passed to resolve.
* If you call reject your promise is rejected with the object passed to resolve.
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
* Any errors thrown in the constructor callback will be implicitly passed to reject().
*/
constructor(callback: (resolve : (value?: R | Thenable<R>) => void, reject: (error?: any) => void) => void);
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
*
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
*
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
}
declare module Promise {
/**
* Make a new promise from the thenable.
* A thenable is promise-like in as far as it has a "then" method.
*/
function resolve<R>(value?: R | Thenable<R>): Promise<R>;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
*/
function reject(error: any): Promise<any>;
/**
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
* the array passed to all can be a mixture of promise-like objects and other objects.
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
*/
function all<R>(promises: (R | Thenable<R>)[]): Promise<R[]>;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
function race<R>(promises: (R | Thenable<R>)[]): Promise<R>;
}
declare module 'es6-promise' {
var foo: typeof Promise; // Temp variable to reference Promise in local context
module rsvp {
export var Promise: typeof foo;
}
export = rsvp;
}

112
typings/glob/glob.d.ts vendored
View file

@ -1,112 +0,0 @@
// Type definitions for Glob 5.0.10
// Project: https://github.com/isaacs/node-glob
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../minimatch/minimatch.d.ts" />
declare module "glob" {
import events = require("events");
import fs = require('fs');
import minimatch = require("minimatch");
function G(pattern: string, cb: (err: Error, matches: string[]) => void): void;
function G(pattern: string, options: G.IOptions, cb: (err: Error, matches: string[]) => void): void;
module G {
function sync(pattern: string, options?: IOptions): string[];
function hasMagic(pattern: string, options?: IOptions): boolean;
var Glob: IGlobStatic;
var GlobSync: IGlobSyncStatic;
interface IOptions extends minimatch.IOptions {
cwd?: string;
root?: string;
dot?: boolean;
nomount?: boolean;
mark?: boolean;
nosort?: boolean;
stat?: boolean;
silent?: boolean;
strict?: boolean;
cache?: { [path: string]: any /* boolean | string | string[] */ };
statCache?: { [path: string]: fs.Stats };
symlinks?: any;
sync?: boolean;
nounique?: boolean;
nonull?: boolean;
debug?: boolean;
nobrace?: boolean;
noglobstar?: boolean;
noext?: boolean;
nocase?: boolean;
matchBase?: any;
nodir?: boolean;
ignore?: any; /* string | string[] */
follow?: boolean;
realpath?: boolean;
nonegate?: boolean;
nocomment?: boolean;
/** Deprecated. */
globDebug?: boolean;
}
interface IGlobStatic extends events.EventEmitter {
new (pattern: string, cb?: (err: Error, matches: string[]) => void): IGlob;
new (pattern: string, options: IOptions, cb?: (err: Error, matches: string[]) => void): IGlob;
prototype: IGlob;
}
interface IGlobSyncStatic {
new (pattern: string, options?: IOptions): IGlobBase
prototype: IGlobBase;
}
interface IGlobBase {
minimatch: minimatch.IMinimatch;
options: IOptions;
aborted: boolean;
cache: { [path: string]: any /* boolean | string | string[] */ };
statCache: { [path: string]: fs.Stats };
symlinks: { [path: string]: boolean };
realpathCache: { [path: string]: string };
found: string[];
}
interface IGlob extends IGlobBase, events.EventEmitter {
pause(): void;
resume(): void;
abort(): void;
/** Deprecated. */
EOF: any;
/** Deprecated. */
paused: boolean;
/** Deprecated. */
maxDepth: number;
/** Deprecated. */
maxLength: number;
/** Deprecated. */
changedCwd: boolean;
/** Deprecated. */
cwd: string;
/** Deprecated. */
root: string;
/** Deprecated. */
error: any;
/** Deprecated. */
matches: string[];
/** Deprecated. */
log(...args: any[]): void;
/** Deprecated. */
emitMatch(m: any): void;
}
}
export = G;
}

View file

@ -1,11 +1,6 @@
// Type definitions for commanderjs 2.3.0
// Project: https://github.com/visionmedia/commander.js
// Definitions by: Marcelo Dezem <http://github.com/mdezem>, vvakame <http://github.com/vvakame>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module commander {
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/commander/commander.d.ts
declare namespace commander {
interface ICommandStatic {
/**
* Initialize a new `Command`.
@ -65,10 +60,11 @@ declare module commander {
*
* @param {String} name
* @param {String} [desc]
* @param {Mixed} [opts]
* @return {Command} the new command
* @api public
*/
command(name:string, desc?:string):ICommand;
command(name:string, desc?:string, opts?: any):ICommand;
/**
* Add an implicit `help [cmd]` subcommand

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/commander/commander.d.ts",
"raw": "registry:dt/commander#2.3.0+20160317120654",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/commander/commander.d.ts"
}
}

View file

@ -1,8 +1,5 @@
// Type definitions for denodeify 1.2.1
// Project: https://github.com/matthew-andrews/denodeify
// Definitions by: joaomoreno <https://github.com/joaomoreno/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/56295f5058cac7ae458540423c50ac2dcf9fc711/denodeify/denodeify.d.ts
declare module "denodeify" {
function _<R>(fn: _.F0<R>, transformer?: _.M): () => Promise<R>;
function _<A,R>(fn: _.F1<A,R>, transformer?: _.M): (a:A) => Promise<R>;
@ -13,8 +10,8 @@ declare module "denodeify" {
function _<A,B,C,D,E,F,R>(fn: _.F6<A,B,C,D,E,F,R>, transformer?: _.M): (a:A, b:B, c:C, d:D, e:E, f:F) => Promise<R>;
function _<A,B,C,D,E,F,G,R>(fn: _.F7<A,B,C,D,E,F,G,R>, transformer?: _.M): (a:A, b:B, c:C, d:D, e:E, f:F, g:G) => Promise<R>;
function _<A,B,C,D,E,F,G,H,R>(fn: _.F8<A,B,C,D,E,F,G,H,R>, transformer?: _.M): (a:A, b:B, c:C, d:D, e:E, f:F, g:G, h:H) => Promise<R>;
function _(fn: _.F, transformer?: _.M): (...args) => Promise<any>;
function _(fn: _.F, transformer?: _.M): (...args: any[]) => Promise<any>;
module _ {
type Callback<R> = (err: Error, result: R) => any;
type F0<R> = (cb: Callback<R>) => any;
@ -26,9 +23,9 @@ declare module "denodeify" {
type F6<A,B,C,D,E,F,R> = (a:A, b:B, c:C, d:D, e:E, f:F, cb: Callback<R>) => any;
type F7<A,B,C,D,E,F,G,R> = (a:A, b:B, c:C, d:D, e:E, f:F, g:G, cb: Callback<R>) => any;
type F8<A,B,C,D,E,F,G,H,R> = (a:A, b:B, c:C, d:D, e:E, f:F, g:G, h:H, cb: Callback<R>) => any;
type F = (...args) => any;
type M = (err: Error, ...args) => any[];
type F = (...args: any[]) => any;
type M = (err: Error, ...args: any[]) => any[];
}
export = _;
}
}

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/56295f5058cac7ae458540423c50ac2dcf9fc711/denodeify/denodeify.d.ts",
"raw": "registry:dt/denodeify#1.2.1+20160316155526",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/56295f5058cac7ae458540423c50ac2dcf9fc711/denodeify/denodeify.d.ts"
}
}

81
typings/globals/es6-promise/index.d.ts vendored Normal file
View file

@ -0,0 +1,81 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts
interface Thenable<T> {
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
}
declare class Promise<T> implements Thenable<T> {
/**
* If you call resolve in the body of the callback passed to the constructor,
* your promise is fulfilled with result object passed to resolve.
* If you call reject your promise is rejected with the object passed to reject.
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
* Any errors thrown in the constructor callback will be implicitly passed to reject().
*/
constructor(callback: (resolve : (value?: T | Thenable<T>) => void, reject: (error?: any) => void) => void);
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
*
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
*
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
}
declare namespace Promise {
/**
* Make a new promise from the thenable.
* A thenable is promise-like in as far as it has a "then" method.
*/
function resolve<T>(value?: T | Thenable<T>): Promise<T>;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
*/
function reject(error: any): Promise<any>;
function reject<T>(error: T): Promise<T>;
/**
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
* the array passed to all can be a mixture of promise-like objects and other objects.
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
*/
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>, T10 | Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
function all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
function all<T1, T2, T3, T4, T5, T6>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
function all<T1, T2, T3, T4, T5>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
function all<T1, T2, T3, T4>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>]): Promise<[T1, T2, T3, T4]>;
function all<T1, T2, T3>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>]): Promise<[T1, T2, T3]>;
function all<T1, T2>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>]): Promise<[T1, T2]>;
function all<T>(values: (T | Thenable<T>)[]): Promise<T[]>;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
function race<T>(promises: (T | Thenable<T>)[]): Promise<T>;
}
declare module 'es6-promise' {
var foo: typeof Promise; // Temp variable to reference Promise in local context
namespace rsvp {
export var Promise: typeof foo;
export function polyfill(): void;
}
export = rsvp;
}

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts",
"raw": "registry:dt/es6-promise#0.0.0+20160614011821",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts"
}
}

View file

@ -1,8 +1,5 @@
// Type definitions for mocha 2.2.5
// Project: http://mochajs.org/
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>, Vadim Macagon <https://github.com/enlight>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/a361a8ab3c327f208d3f82ad206971d4a63d8c25/mocha/mocha.d.ts
interface MochaSetupOptions {
//milliseconds to wait before considering a test slow
slow?: number;
@ -29,10 +26,6 @@ interface MochaSetupOptions {
grep?: any;
}
interface MochaDone {
(error?: Error): void;
}
declare var mocha: Mocha;
declare var describe: Mocha.IContextDefinition;
declare var xdescribe: Mocha.IContextDefinition;
@ -44,40 +37,31 @@ declare var it: Mocha.ITestDefinition;
declare var xit: Mocha.ITestDefinition;
// alias for `it`
declare var test: Mocha.ITestDefinition;
declare var specify: Mocha.ITestDefinition;
declare function before(action: () => void): void;
interface MochaDone {
(error?: any): any;
}
declare function before(action: (done: MochaDone) => void): void;
interface ActionFunction {
(done: MochaDone): any | PromiseLike<any>
}
declare function setup(action: () => void): void;
declare function setup(action: (done: MochaDone) => void): void;
declare function after(action: () => void): void;
declare function after(action: (done: MochaDone) => void): void;
declare function teardown(action: () => void): void;
declare function teardown(action: (done: MochaDone) => void): void;
declare function beforeEach(action: () => void): void;
declare function beforeEach(action: (done: MochaDone) => void): void;
declare function suiteSetup(action: () => void): void;
declare function suiteSetup(action: (done: MochaDone) => void): void;
declare function afterEach(action: () => void): void;
declare function afterEach(action: (done: MochaDone) => void): void;
declare function suiteTeardown(action: () => void): void;
declare function suiteTeardown(action: (done: MochaDone) => void): void;
declare function setup(action: ActionFunction): void;
declare function teardown(action: ActionFunction): void;
declare function suiteSetup(action: ActionFunction): void;
declare function suiteTeardown(action: ActionFunction): void;
declare function before(action: ActionFunction): void;
declare function before(description: string, action: ActionFunction): void;
declare function after(action: ActionFunction): void;
declare function after(description: string, action: ActionFunction): void;
declare function beforeEach(action: ActionFunction): void;
declare function beforeEach(description: string, action: ActionFunction): void;
declare function afterEach(action: ActionFunction): void;
declare function afterEach(description: string, action: ActionFunction): void;
declare class Mocha {
currentTest: Mocha.ITestDefinition;
constructor(options?: {
grep?: RegExp;
ui?: string;
@ -100,6 +84,12 @@ declare class Mocha {
invert(): Mocha;
ignoreLeaks(value: boolean): Mocha;
checkLeaks(): Mocha;
/**
* Function to allow assertion libraries to throw errors directly into mocha.
* This is useful when running tests in a browser because window.onerror will
* only receive the 'message' attribute of the Error.
*/
throwError(error: Error): void;
/** Enables growl support. */
growl(): Mocha;
globals(value: string): Mocha;
@ -116,7 +106,7 @@ declare class Mocha {
}
// merge the Mocha class declaration with a module
declare module Mocha {
declare namespace Mocha {
/** Partial interface for Mocha's `Runnable` class. */
interface IRunnable {
title: string;
@ -153,13 +143,11 @@ declare module Mocha {
}
interface ITestDefinition {
(expectation: string, assertion?: () => void): ITest;
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
only(expectation: string, assertion?: () => void): ITest;
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
skip(expectation: string, assertion?: () => void): void;
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
(expectation: string, assertion?: ActionFunction): ITest;
only(expectation: string, assertion?: ActionFunction): ITest;
skip(expectation: string, assertion?: ActionFunction): void;
timeout(ms: number): void;
state: "failed" | "passed";
}
export module reporters {

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/a361a8ab3c327f208d3f82ad206971d4a63d8c25/mocha/mocha.d.ts",
"raw": "registry:dt/mocha#2.2.5+20160720003353",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/a361a8ab3c327f208d3f82ad206971d4a63d8c25/mocha/mocha.d.ts"
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/types/env-node/959285e4da295481cf634f7d11f6ccccc863e430/4/typings.json",
"raw": "registry:env/node#4.0.0+20160918225031",
"version": "4",
"files": [
"node.d.ts"
],
"name": "node",
"type": "typings"
}
}

View file

@ -1,330 +1,357 @@
// Type definitions for Q
// Project: https://github.com/kriskowal/q
// Definitions by: Barrie Nemetchek <https://github.com/bnemetchek>, Andrew Gaspar <https://github.com/AndrewGaspar/>, John Reilly <https://github.com/johnnyreilly>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* If value is a Q promise, returns the promise.
* If value is a promise from another library it is coerced into a Q promise (where possible).
*/
declare function Q<T>(promise: Q.IPromise<T>): Q.Promise<T>;
/**
* If value is not a promise, returns a promise that is fulfilled with value.
*/
declare function Q<T>(value: T): Q.Promise<T>;
declare module Q {
interface IPromise<T> {
then<U>(onFulfill?: (value: T) => U | IPromise<U>, onReject?: (error: any) => U | IPromise<U>): IPromise<U>;
}
interface Deferred<T> {
promise: Promise<T>;
resolve(value: T): void;
reject(reason: any): void;
notify(value: any): void;
makeNodeResolver(): (reason: any, value: T) => void;
}
interface Promise<T> {
/**
* Like a finally clause, allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful for collecting resources regardless of whether a job succeeded, like closing a database connection, shutting a server down, or deleting an unneeded key from an object.
* finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished.
*/
fin(finallyCallback: () => any): Promise<T>;
/**
* Like a finally clause, allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful for collecting resources regardless of whether a job succeeded, like closing a database connection, shutting a server down, or deleting an unneeded key from an object.
* finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished.
*/
finally(finallyCallback: () => any): Promise<T>;
/**
* The then method from the Promises/A+ specification, with an additional progress handler.
*/
then<U>(onFulfill?: (value: T) => U | IPromise<U>, onReject?: (error: any) => U | IPromise<U>, onProgress?: Function): Promise<U>;
/**
* Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason.
*
* This is especially useful in conjunction with all
*/
spread<U>(onFulfill: (...args: any[]) => IPromise<U> | U, onReject?: (reason: any) => IPromise<U> | U): Promise<U>;
fail<U>(onRejected: (reason: any) => U | IPromise<U>): Promise<U>;
/**
* A sugar method, equivalent to promise.then(undefined, onRejected).
*/
catch<U>(onRejected: (reason: any) => U | IPromise<U>): Promise<U>;
/**
* A sugar method, equivalent to promise.then(undefined, undefined, onProgress).
*/
progress(onProgress: (progress: any) => any): Promise<T>;
/**
* Much like then, but with different behavior around unhandled rejection. If there is an unhandled rejection, either because promise is rejected and no onRejected callback was provided, or because onFulfilled or onRejected threw an error or returned a rejected promise, the resulting rejection reason is thrown as an exception in a future turn of the event loop.
*
* This method should be used to terminate chains of promises that will not be passed elsewhere. Since exceptions thrown in then callbacks are consumed and transformed into rejections, exceptions at the end of the chain are easy to accidentally, silently ignore. By arranging for the exception to be thrown in a future turn of the event loop, so that it won't be caught, it causes an onerror event on the browser window, or an uncaughtException event on Node.js's process object.
*
* Exceptions thrown by done will have long stack traces, if Q.longStackSupport is set to true. If Q.onerror is set, exceptions will be delivered there instead of thrown in a future turn.
*
* The Golden Rule of done vs. then usage is: either return your promise to someone else, or if the chain ends with you, call done to terminate it.
*/
done(onFulfilled?: (value: T) => any, onRejected?: (reason: any) => any, onProgress?: (progress: any) => any): void;
/**
* If callback is a function, assumes it's a Node.js-style callback, and calls it as either callback(rejectionReason) when/if promise becomes rejected, or as callback(null, fulfillmentValue) when/if promise becomes fulfilled. If callback is not a function, simply returns promise.
*/
nodeify(callback: (reason: any, value: any) => void): Promise<T>;
/**
* Returns a promise to get the named property of an object. Essentially equivalent to
*
* promise.then(function (o) {
* return o[propertyName];
* });
*/
get<U>(propertyName: String): Promise<U>;
set<U>(propertyName: String, value: any): Promise<U>;
delete<U>(propertyName: String): Promise<U>;
/**
* Returns a promise for the result of calling the named method of an object with the given array of arguments. The object itself is this in the function, just like a synchronous method call. Essentially equivalent to
*
* promise.then(function (o) {
* return o[methodName].apply(o, args);
* });
*/
post<U>(methodName: String, args: any[]): Promise<U>;
/**
* Returns a promise for the result of calling the named method of an object with the given variadic arguments. The object itself is this in the function, just like a synchronous method call.
*/
invoke<U>(methodName: String, ...args: any[]): Promise<U>;
fapply<U>(args: any[]): Promise<U>;
fcall<U>(...args: any[]): Promise<U>;
/**
* Returns a promise for an array of the property names of an object. Essentially equivalent to
*
* promise.then(function (o) {
* return Object.keys(o);
* });
*/
keys(): Promise<string[]>;
/**
* A sugar method, equivalent to promise.then(function () { return value; }).
*/
thenResolve<U>(value: U): Promise<U>;
/**
* A sugar method, equivalent to promise.then(function () { throw reason; }).
*/
thenReject(reason: any): Promise<T>;
/**
* Attaches a handler that will observe the value of the promise when it becomes fulfilled, returning a promise for that same value, perhaps deferred but not replaced by the promise returned by the onFulfilled handler.
*/
tap(onFulfilled: (value: T) => any): Promise<T>;
timeout(ms: number, message?: string): Promise<T>;
/**
* Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed.
*/
delay(ms: number): Promise<T>;
/**
* Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true.
*/
isFulfilled(): boolean;
/**
* Returns whether a given promise is in the rejected state. When the static version is used on non-promises, the result is always false.
*/
isRejected(): boolean;
/**
* Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false.
*/
isPending(): boolean;
valueOf(): any;
/**
* Returns a "state snapshot" object, which will be in one of three forms:
*
* - { state: "pending" }
* - { state: "fulfilled", value: <fulfllment value> }
* - { state: "rejected", reason: <rejection reason> }
*/
inspect(): PromiseState<T>;
}
interface PromiseState<T> {
/**
* "fulfilled", "rejected", "pending"
*/
state: string;
value?: T;
reason?: any;
}
// If no value provided, returned promise will be of void type
export function when(): Promise<void>;
// if no fulfill, reject, or progress provided, returned promise will be of same type
export function when<T>(value: T | IPromise<T>): Promise<T>;
// If a non-promise value is provided, it will not reject or progress
export function when<T, U>(value: T | IPromise<T>, onFulfilled: (val: T) => U | IPromise<U>, onRejected?: (reason: any) => U | IPromise<U>, onProgress?: (progress: any) => any): Promise<U>;
/**
* Currently "impossible" (and I use the term loosely) to implement due to TypeScript limitations as it is now.
* See: https://github.com/Microsoft/TypeScript/issues/1784 for discussion on it.
*/
// export function try(method: Function, ...args: any[]): Promise<any>;
export function fbind<T>(method: (...args: any[]) => T | IPromise<T>, ...args: any[]): (...args: any[]) => Promise<T>;
export function fcall<T>(method: (...args: any[]) => T, ...args: any[]): Promise<T>;
export function send<T>(obj: any, functionName: string, ...args: any[]): Promise<T>;
export function invoke<T>(obj: any, functionName: string, ...args: any[]): Promise<T>;
export function mcall<T>(obj: any, functionName: string, ...args: any[]): Promise<T>;
export function denodeify<T>(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise<T>;
export function nbind<T>(nodeFunction: Function, thisArg: any, ...args: any[]): (...args: any[]) => Promise<T>;
export function nfbind<T>(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise<T>;
export function nfcall<T>(nodeFunction: Function, ...args: any[]): Promise<T>;
export function nfapply<T>(nodeFunction: Function, args: any[]): Promise<T>;
export function ninvoke<T>(nodeModule: any, functionName: string, ...args: any[]): Promise<T>;
export function npost<T>(nodeModule: any, functionName: string, args: any[]): Promise<T>;
export function nsend<T>(nodeModule: any, functionName: string, ...args: any[]): Promise<T>;
export function nmcall<T>(nodeModule: any, functionName: string, ...args: any[]): Promise<T>;
/**
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
*/
export function all<T>(promises: IPromise<T>[]): Promise<T[]>;
/**
* Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected.
*/
export function allSettled<T>(promises: IPromise<T>[]): Promise<PromiseState<T>[]>;
export function allResolved<T>(promises: IPromise<T>[]): Promise<Promise<T>[]>;
/**
* Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason.
* This is especially useful in conjunction with all.
*/
export function spread<T, U>(promises: IPromise<T>[], onFulfilled: (...args: T[]) => U | IPromise<U>, onRejected?: (reason: any) => U | IPromise<U>): Promise<U>;
/**
* Returns a promise that will have the same result as promise, except that if promise is not fulfilled or rejected before ms milliseconds, the returned promise will be rejected with an Error with the given message. If message is not supplied, the message will be "Timed out after " + ms + " ms".
*/
export function timeout<T>(promise: Promise<T>, ms: number, message?: string): Promise<T>;
/**
* Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed.
*/
export function delay<T>(promise: Promise<T>, ms: number): Promise<T>;
/**
* Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed.
*/
export function delay<T>(value: T, ms: number): Promise<T>;
/**
* Returns a promise that will be fulfilled with undefined after at least ms milliseconds have passed.
*/
export function delay(ms: number): Promise <void>;
/**
* Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true.
*/
export function isFulfilled(promise: Promise<any>): boolean;
/**
* Returns whether a given promise is in the rejected state. When the static version is used on non-promises, the result is always false.
*/
export function isRejected(promise: Promise<any>): boolean;
/**
* Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false.
*/
export function isPending(promise: Promise<any>): boolean;
/**
* Returns a "deferred" object with a:
* promise property
* resolve(value) method
* reject(reason) method
* notify(value) method
* makeNodeResolver() method
*/
export function defer<T>(): Deferred<T>;
/**
* Returns a promise that is rejected with reason.
*/
export function reject<T>(reason?: any): Promise<T>;
export function Promise<T>(resolver: (resolve: (val: T | IPromise<T>) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise<T>;
/**
* Creates a new version of func that accepts any combination of promise and non-promise values, converting them to their fulfillment values before calling the original func. The returned version also always returns a promise: if func does a return or throw, then Q.promised(func) will return fulfilled or rejected promise, respectively.
*
* This can be useful for creating functions that accept either promises or non-promise values, and for ensuring that the function always returns a promise even in the face of unintentional thrown exceptions.
*/
export function promised<T>(callback: (...args: any[]) => T): (...args: any[]) => Promise<T>;
/**
* Returns whether the given value is a Q promise.
*/
export function isPromise(object: any): boolean;
/**
* Returns whether the given value is a promise (i.e. it's an object with a then function).
*/
export function isPromiseAlike(object: any): boolean;
/**
* Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false.
*/
export function isPending(object: any): boolean;
/**
* This is an experimental tool for converting a generator function into a deferred function. This has the potential of reducing nested callbacks in engines that support yield.
*/
export function async<T>(generatorFunction: any): (...args: any[]) => Promise<T>;
export function nextTick(callback: Function): void;
/**
* A settable property that will intercept any uncaught errors that would otherwise be thrown in the next tick of the event loop, usually as a result of done. Can be useful for getting the full stack trace of an error in browsers, which is not usually possible with window.onerror.
*/
export var onerror: (reason: any) => void;
/**
* A settable property that lets you turn on long stack trace support. If turned on, "stack jumps" will be tracked across asynchronous promise operations, so that if an uncaught error is thrown by done or a rejection reason's stack property is inspected in a rejection callback, a long stack trace is produced.
*/
export var longStackSupport: boolean;
/**
* Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does).
* Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason.
* Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value.
* Calling resolve with a non-promise value causes promise to be fulfilled with that value.
*/
export function resolve<T>(object: IPromise<T>): Promise<T>;
/**
* Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does).
* Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason.
* Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value.
* Calling resolve with a non-promise value causes promise to be fulfilled with that value.
*/
export function resolve<T>(object: T): Promise<T>;
/**
* Resets the global "Q" variable to the value it has before Q was loaded.
* This will either be undefined if there was no version or the version of Q which was already loaded before.
* @returns { The last version of Q. }
*/
export function noConflict(): typeof Q;
}
declare module "q" {
export = Q;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/623f30ab194a3486e014ca39bc7f2089897d6ce4/q/Q.d.ts
declare function Q<T>(promise: Q.IPromise<T>): Q.Promise<T>;
/**
* If value is not a promise, returns a promise that is fulfilled with value.
*/
declare function Q<T>(value: T): Q.Promise<T>;
declare namespace Q {
interface IPromise<T> {
then<U>(onFulfill?: (value: T) => U | IPromise<U>, onReject?: (error: any) => U | IPromise<U>): IPromise<U>;
}
interface Deferred<T> {
promise: Promise<T>;
resolve(value?: T): void;
resolve(value?: IPromise<T>): void;
reject(reason: any): void;
notify(value: any): void;
makeNodeResolver(): (reason: any, value: T) => void;
}
interface Promise<T> {
/**
* Like a finally clause, allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful for collecting resources regardless of whether a job succeeded, like closing a database connection, shutting a server down, or deleting an unneeded key from an object.
* finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished.
*/
fin(finallyCallback: () => any): Promise<T>;
/**
* Like a finally clause, allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful for collecting resources regardless of whether a job succeeded, like closing a database connection, shutting a server down, or deleting an unneeded key from an object.
* finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished.
*/
finally(finallyCallback: () => any): Promise<T>;
/**
* The then method from the Promises/A+ specification, with an additional progress handler.
*/
then<U>(onFulfill?: (value: T) => U | IPromise<U>, onReject?: (error: any) => U | IPromise<U>, onProgress?: Function): Promise<U>;
/**
* Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason.
*
* This is especially useful in conjunction with all
*/
spread<U>(onFulfill: (...args: any[]) => IPromise<U> | U, onReject?: (reason: any) => IPromise<U> | U): Promise<U>;
fail<U>(onRejected: (reason: any) => U | IPromise<U>): Promise<U>;
/**
* A sugar method, equivalent to promise.then(undefined, onRejected).
*/
catch<U>(onRejected: (reason: any) => U | IPromise<U>): Promise<U>;
/**
* A sugar method, equivalent to promise.then(undefined, undefined, onProgress).
*/
progress(onProgress: (progress: any) => any): Promise<T>;
/**
* Much like then, but with different behavior around unhandled rejection. If there is an unhandled rejection, either because promise is rejected and no onRejected callback was provided, or because onFulfilled or onRejected threw an error or returned a rejected promise, the resulting rejection reason is thrown as an exception in a future turn of the event loop.
*
* This method should be used to terminate chains of promises that will not be passed elsewhere. Since exceptions thrown in then callbacks are consumed and transformed into rejections, exceptions at the end of the chain are easy to accidentally, silently ignore. By arranging for the exception to be thrown in a future turn of the event loop, so that it won't be caught, it causes an onerror event on the browser window, or an uncaughtException event on Node.js's process object.
*
* Exceptions thrown by done will have long stack traces, if Q.longStackSupport is set to true. If Q.onerror is set, exceptions will be delivered there instead of thrown in a future turn.
*
* The Golden Rule of done vs. then usage is: either return your promise to someone else, or if the chain ends with you, call done to terminate it.
*/
done(onFulfilled?: (value: T) => any, onRejected?: (reason: any) => any, onProgress?: (progress: any) => any): void;
/**
* If callback is a function, assumes it's a Node.js-style callback, and calls it as either callback(rejectionReason) when/if promise becomes rejected, or as callback(null, fulfillmentValue) when/if promise becomes fulfilled. If callback is not a function, simply returns promise.
*/
nodeify(callback: (reason: any, value: any) => void): Promise<T>;
/**
* Returns a promise to get the named property of an object. Essentially equivalent to
*
* promise.then(function (o) {
* return o[propertyName];
* });
*/
get<U>(propertyName: String): Promise<U>;
set<U>(propertyName: String, value: any): Promise<U>;
delete<U>(propertyName: String): Promise<U>;
/**
* Returns a promise for the result of calling the named method of an object with the given array of arguments. The object itself is this in the function, just like a synchronous method call. Essentially equivalent to
*
* promise.then(function (o) {
* return o[methodName].apply(o, args);
* });
*/
post<U>(methodName: String, args: any[]): Promise<U>;
/**
* Returns a promise for the result of calling the named method of an object with the given variadic arguments. The object itself is this in the function, just like a synchronous method call.
*/
invoke<U>(methodName: String, ...args: any[]): Promise<U>;
fapply<U>(args: any[]): Promise<U>;
fcall<U>(...args: any[]): Promise<U>;
/**
* Returns a promise for an array of the property names of an object. Essentially equivalent to
*
* promise.then(function (o) {
* return Object.keys(o);
* });
*/
keys(): Promise<string[]>;
/**
* A sugar method, equivalent to promise.then(function () { return value; }).
*/
thenResolve<U>(value: U): Promise<U>;
/**
* A sugar method, equivalent to promise.then(function () { throw reason; }).
*/
thenReject(reason: any): Promise<T>;
/**
* Attaches a handler that will observe the value of the promise when it becomes fulfilled, returning a promise for that same value, perhaps deferred but not replaced by the promise returned by the onFulfilled handler.
*/
tap(onFulfilled: (value: T) => any): Promise<T>;
timeout(ms: number, message?: string): Promise<T>;
/**
* Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed.
*/
delay(ms: number): Promise<T>;
/**
* Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true.
*/
isFulfilled(): boolean;
/**
* Returns whether a given promise is in the rejected state. When the static version is used on non-promises, the result is always false.
*/
isRejected(): boolean;
/**
* Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false.
*/
isPending(): boolean;
valueOf(): any;
/**
* Returns a "state snapshot" object, which will be in one of three forms:
*
* - { state: "pending" }
* - { state: "fulfilled", value: <fulfllment value> }
* - { state: "rejected", reason: <rejection reason> }
*/
inspect(): PromiseState<T>;
}
interface PromiseState<T> {
/**
* "fulfilled", "rejected", "pending"
*/
state: string;
value?: T;
reason?: any;
}
// If no value provided, returned promise will be of void type
export function when(): Promise<void>;
// if no fulfill, reject, or progress provided, returned promise will be of same type
export function when<T>(value: T | IPromise<T>): Promise<T>;
// If a non-promise value is provided, it will not reject or progress
export function when<T, U>(value: T | IPromise<T>, onFulfilled: (val: T) => U | IPromise<U>, onRejected?: (reason: any) => U | IPromise<U>, onProgress?: (progress: any) => any): Promise<U>;
/**
* Currently "impossible" (and I use the term loosely) to implement due to TypeScript limitations as it is now.
* See: https://github.com/Microsoft/TypeScript/issues/1784 for discussion on it.
*/
// export function try(method: Function, ...args: any[]): Promise<any>;
export function fbind<T>(method: (...args: any[]) => T | IPromise<T>, ...args: any[]): (...args: any[]) => Promise<T>;
export function fcall<T>(method: (...args: any[]) => T, ...args: any[]): Promise<T>;
export function send<T>(obj: any, functionName: string, ...args: any[]): Promise<T>;
export function invoke<T>(obj: any, functionName: string, ...args: any[]): Promise<T>;
export function mcall<T>(obj: any, functionName: string, ...args: any[]): Promise<T>;
export function denodeify<T>(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise<T>;
export function nbind<T>(nodeFunction: Function, thisArg: any, ...args: any[]): (...args: any[]) => Promise<T>;
export function nfbind<T>(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise<T>;
export function nfcall<T>(nodeFunction: Function, ...args: any[]): Promise<T>;
export function nfapply<T>(nodeFunction: Function, args: any[]): Promise<T>;
export function ninvoke<T>(nodeModule: any, functionName: string, ...args: any[]): Promise<T>;
export function npost<T>(nodeModule: any, functionName: string, args: any[]): Promise<T>;
export function nsend<T>(nodeModule: any, functionName: string, ...args: any[]): Promise<T>;
export function nmcall<T>(nodeModule: any, functionName: string, ...args: any[]): Promise<T>;
/**
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
*/
export function all<A, B, C, D, E, F>(promises: [IPromise<A>, IPromise<B>, IPromise<C>, IPromise<D>, IPromise<E>, IPromise<F>]): Promise<[A, B, C, D, E, F]>;
/**
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
*/
export function all<A, B, C, D, E>(promises: [IPromise<A>, IPromise<B>, IPromise<C>, IPromise<D>, IPromise<E>]): Promise<[A, B, C, D, E]>;
/**
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
*/
export function all<A, B, C, D>(promises: [IPromise<A>, IPromise<B>, IPromise<C>, IPromise<D>]): Promise<[A, B, C, D]>;
/**
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
*/
export function all<A, B, C>(promises: [IPromise<A>, IPromise<B>, IPromise<C>]): Promise<[A, B, C]>;
/**
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
*/
export function all<A, B>(promises: [IPromise<A>, IPromise<B>]): Promise<[A, B]>;
/**
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
*/
export function all<T>(promises: IPromise<T>[]): Promise<T[]>;
/**
* Returns a promise for the first of an array of promises to become settled.
*/
export function race<T>(promises: IPromise<T>[]): Promise<T>;
/**
* Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected.
*/
export function allSettled<T>(promises: IPromise<T>[]): Promise<PromiseState<T>[]>;
export function allResolved<T>(promises: IPromise<T>[]): Promise<Promise<T>[]>;
/**
* Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason.
* This is especially useful in conjunction with all.
*/
export function spread<T, U>(promises: IPromise<T>[], onFulfilled: (...args: T[]) => U | IPromise<U>, onRejected?: (reason: any) => U | IPromise<U>): Promise<U>;
/**
* Returns a promise that will have the same result as promise, except that if promise is not fulfilled or rejected before ms milliseconds, the returned promise will be rejected with an Error with the given message. If message is not supplied, the message will be "Timed out after " + ms + " ms".
*/
export function timeout<T>(promise: Promise<T>, ms: number, message?: string): Promise<T>;
/**
* Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed.
*/
export function delay<T>(promise: Promise<T>, ms: number): Promise<T>;
/**
* Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed.
*/
export function delay<T>(value: T, ms: number): Promise<T>;
/**
* Returns a promise that will be fulfilled with undefined after at least ms milliseconds have passed.
*/
export function delay(ms: number): Promise <void>;
/**
* Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true.
*/
export function isFulfilled(promise: Promise<any>): boolean;
/**
* Returns whether a given promise is in the rejected state. When the static version is used on non-promises, the result is always false.
*/
export function isRejected(promise: Promise<any>): boolean;
/**
* Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false.
*/
export function isPending(promise: Promise<any>): boolean;
/**
* Returns a "deferred" object with a:
* promise property
* resolve(value) method
* reject(reason) method
* notify(value) method
* makeNodeResolver() method
*/
export function defer<T>(): Deferred<T>;
/**
* Returns a promise that is rejected with reason.
*/
export function reject<T>(reason?: any): Promise<T>;
export function Promise<T>(resolver: (resolve: (val: T | IPromise<T>) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise<T>;
/**
* Creates a new version of func that accepts any combination of promise and non-promise values, converting them to their fulfillment values before calling the original func. The returned version also always returns a promise: if func does a return or throw, then Q.promised(func) will return fulfilled or rejected promise, respectively.
*
* This can be useful for creating functions that accept either promises or non-promise values, and for ensuring that the function always returns a promise even in the face of unintentional thrown exceptions.
*/
export function promised<T>(callback: (...args: any[]) => T): (...args: any[]) => Promise<T>;
/**
* Returns whether the given value is a Q promise.
*/
export function isPromise(object: any): boolean;
/**
* Returns whether the given value is a promise (i.e. it's an object with a then function).
*/
export function isPromiseAlike(object: any): boolean;
/**
* Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false.
*/
export function isPending(object: any): boolean;
/**
* If an object is not a promise, it is as "near" as possible.
* If a promise is rejected, it is as "near" as possible too.
* If its a fulfilled promise, the fulfillment value is nearer.
* If its a deferred promise and the deferred has been resolved, the
* resolution is "nearer".
*/
export function nearer<T>(promise: Promise<T>): T;
/**
* This is an experimental tool for converting a generator function into a deferred function. This has the potential of reducing nested callbacks in engines that support yield.
*/
export function async<T>(generatorFunction: any): (...args: any[]) => Promise<T>;
export function nextTick(callback: Function): void;
/**
* A settable property that will intercept any uncaught errors that would otherwise be thrown in the next tick of the event loop, usually as a result of done. Can be useful for getting the full stack trace of an error in browsers, which is not usually possible with window.onerror.
*/
export var onerror: (reason: any) => void;
/**
* A settable property that lets you turn on long stack trace support. If turned on, "stack jumps" will be tracked across asynchronous promise operations, so that if an uncaught error is thrown by done or a rejection reason's stack property is inspected in a rejection callback, a long stack trace is produced.
*/
export var longStackSupport: boolean;
/**
* Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does).
* Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason.
* Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value.
* Calling resolve with a non-promise value causes promise to be fulfilled with that value.
*/
export function resolve<T>(object: IPromise<T>): Promise<T>;
/**
* Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does).
* Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason.
* Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value.
* Calling resolve with a non-promise value causes promise to be fulfilled with that value.
*/
export function resolve<T>(object: T): Promise<T>;
/**
* Resets the global "Q" variable to the value it has before Q was loaded.
* This will either be undefined if there was no version or the version of Q which was already loaded before.
* @returns { The last version of Q. }
*/
export function noConflict(): typeof Q;
}
declare module "q" {
export = Q;
}

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/623f30ab194a3486e014ca39bc7f2089897d6ce4/q/Q.d.ts",
"raw": "registry:dt/q#0.0.0+20160613154756",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/623f30ab194a3486e014ca39bc7f2089897d6ce4/q/Q.d.ts"
}
}

21
typings/globals/read/index.d.ts vendored Normal file
View file

@ -0,0 +1,21 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/read/read.d.ts
declare module 'read' {
function Read(options: Read.Options, callback: (error: any, result: string, isDefault: boolean) => any): void;
namespace Read {
interface Options {
prompt?: string;
silent?: boolean;
replace?: string;
timeout?: number;
default?: string;
edit?: boolean;
terminal?: boolean;
input?: any;
output?: any;
}
}
export = Read;
}

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/read/read.d.ts",
"raw": "registry:dt/read#0.0.0+20160317120654",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/read/read.d.ts"
}
}

View file

@ -1,17 +1,34 @@
// Type definitions for semver v2.2.1
// Project: https://github.com/isaacs/node-semver
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module SemVerModule {
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6ae1c56196c8018da94cfd0ebb75dd1d5f05466d/semver/semver.d.ts
declare namespace SemVerModule {
/**
* Return the parsed version, or null if it's not valid.
*/
function valid(v: string, loose?: boolean): string;
/**
* Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid.
*/
function clean(version: string, loose?: boolean): string;
/**
* Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid.
*/
function inc(v: string, release: string, loose?: boolean): string;
/**
* Return the major version number.
*/
function major(v: string, loose?: boolean): number;
/**
* Return the minor version number.
*/
function minor(v: string, loose?: boolean): number;
/**
* Return the patch version number.
*/
function patch(v: string, loose?: boolean): number;
/**
* Returns an array of prerelease components, or null if none exist.
*/
function prerelease(v: string, loose?: boolean): string[];
// Comparison
/**
@ -50,6 +67,10 @@ declare module SemVerModule {
* The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort().
*/
function rcompare(v1: string, v2: string, loose?: boolean): number;
/**
* Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same.
*/
function diff(v1: string, v2: string, loose?: boolean): string;
// Ranges
/**
@ -64,6 +85,10 @@ declare module SemVerModule {
* Return the highest version in the list that satisfies the range, or null if none of them do.
*/
function maxSatisfying(versions: string[], range: string, loose?: boolean): string;
/**
* Return the lowest version in the list that satisfies the range, or null if none of them do.
*/
function minSatisfying(versions: string[], range: string, loose?: boolean): string;
/**
* Return true if version is greater than all the versions possible in the range.
*/
@ -120,6 +145,39 @@ declare module SemVerModule {
}
}
interface SemVerStatic {
SemVer(version: string, loose?: boolean): SemVerModule.SemVer;
Comparator(comp: string, loose?: boolean): SemVerModule.Comparator;
Range(range: string, loose?: boolean): SemVerModule.Range;
clean(version: string, loose?: boolean): string;
SEMVER_SPEC_VERSION: string;
valid(v: string, loose?: boolean): string;
inc(v: string, release: string, loose?: boolean): string;
major(v: string, loose?: boolean): number;
minor(v: string, loose?: boolean): number;
patch(v: string, loose?: boolean): number;
gt(v1: string, v2: string, loose?: boolean): boolean;
gte(v1: string, v2: string, loose?: boolean): boolean;
lt(v1: string, v2: string, loose?: boolean): boolean;
lte(v1: string, v2: string, loose?: boolean): boolean;
eq(v1: string, v2: string, loose?: boolean): boolean;
neq(v1: string, v2: string, loose?: boolean): boolean;
cmp(v1: string, comparator: any, v2: string, loose?: boolean): boolean;
compare(v1: string, v2: string, loose?: boolean): number;
rcompare(v1: string, v2: string, loose?: boolean): number;
diff(v1: string, v2: string, loose?: boolean): string;
validRange(range: string, loose?: boolean): string;
satisfies(version: string, range: string, loose?: boolean): boolean;
maxSatisfying(versions: string[], range: string, loose?: boolean): string;
gtr(version: string, range: string, loose?: boolean): boolean;
ltr(version: string, range: string, loose?: boolean): boolean;
outside(version: string, range: string, hilo: string, loose?: boolean): boolean;
}
declare var semver: SemVerStatic;
declare module "semver" {
export = SemVerModule;
}

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6ae1c56196c8018da94cfd0ebb75dd1d5f05466d/semver/semver.d.ts",
"raw": "registry:dt/semver#5.3.0+20160801120957",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6ae1c56196c8018da94cfd0ebb75dd1d5f05466d/semver/semver.d.ts"
}
}

View file

@ -1,33 +1,45 @@
// Type definitions for tmp v0.0.24
// Project: https://www.npmjs.com/package/tmp
// Definitions by: Jared Klopper <https://github.com/optical>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "tmp" {
module tmp {
interface Options {
mode?: number;
prefix?: string;
postfix?: string;
template?: string;
dir?: string;
tries?: number;
keep?: boolean;
unsafeCleanup?: boolean;
}
function file(callback: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function file(config: Options, callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function dir(callback: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dir(config: Options, callback?: (err: any, path: string, cleanupCallback: () => void) => void): void;
function tmpName(callback: (err: any, path: string) => void): void;
function tmpName(config: Options, callback?: (err: any, path: string) => void): void;
function setGracefulCleanup(): void;
}
export = tmp;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d6115f046550714a28caa3555f47a1aec114fe5/tmp/tmp.d.ts
declare module "tmp" {
namespace tmp {
interface Options extends SimpleOptions {
mode?: number;
}
interface SimpleOptions {
prefix?: string;
postfix?: string;
template?: string;
dir?: string;
tries?: number;
keep?: boolean;
unsafeCleanup?: boolean;
}
interface SynchrounousResult {
name: string;
fd: number;
removeCallback: () => void;
}
function file(callback: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function file(config: Options, callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function fileSync(config?: Options): SynchrounousResult;
function dir(callback: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dir(config: Options, callback?: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dirSync(config?: Options): SynchrounousResult;
function tmpName(callback: (err: any, path: string) => void): void;
function tmpName(config: SimpleOptions, callback?: (err: any, path: string) => void): void;
function tmpNameSync(config?: SimpleOptions): string;
function setGracefulCleanup(): void;
}
export = tmp;
}

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d6115f046550714a28caa3555f47a1aec114fe5/tmp/tmp.d.ts",
"raw": "registry:dt/tmp#0.0.0+20160514170650",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d6115f046550714a28caa3555f47a1aec114fe5/tmp/tmp.d.ts"
}
}

View file

@ -1,16 +1,18 @@
// Type definitions for node-xml2js
// Project: https://github.com/Leonidas-from-XIV/node-xml2js
// Definitions by: Michel Salib <https://github.com/michelsalib>, Jason McNeil <https://github.com/jasonrm>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/xml2js/xml2js.d.ts
declare module 'xml2js' {
export = xml2js;
module xml2js {
namespace xml2js {
function parseString(xml: string, callback: (err: any, result: any) => void): void;
function parseString(xml: string, options: Options, callback: (err: any, result: any) => void): void;
var defaults: {
'0.1': Options;
'0.2': OptionsV2;
}
class Builder {
constructor(options?: BuilderOptions);
buildObject(rootObj: any): string;
@ -50,7 +52,8 @@ declare module 'xml2js' {
interface Options {
async?: boolean;
attrkey?: string;
attrNameProcessors?: (name: string) => string;
attrNameProcessors?: [(name: string) => string];
attrValueProcessors?: [(name: string) => string];
charkey?: string;
charsAsChildren?: boolean;
childkey?: string;
@ -67,7 +70,27 @@ declare module 'xml2js' {
tagNameProcessors?: [(name: string) => string];
trim?: boolean;
validator?: Function;
valueProcessors?: [(name: string) => string];
xmlns?: boolean;
}
interface OptionsV2 extends Options {
preserveChildrenOrder?: boolean;
rootName?: string;
xmldec?: {
version: string;
encoding?: string;
standalone?: boolean;
};
doctype?: any;
renderOpts?: {
pretty?: boolean;
indent?: string;
newline?: string;
};
headless?: boolean;
chunkSize?: number;
cdata?: boolean;
}
}
}

View file

@ -0,0 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/xml2js/xml2js.d.ts",
"raw": "registry:dt/xml2js#0.0.0+20160317120654",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/xml2js/xml2js.d.ts"
}
}

3
typings/http-patch.d.ts vendored Normal file
View file

@ -0,0 +1,3 @@
declare module 'http' {
export interface ClientResponse extends IncomingMessage {}
}

13
typings/index.d.ts vendored
View file

@ -1 +1,14 @@
/// <reference path="globals/commander/index.d.ts" />
/// <reference path="globals/denodeify/index.d.ts" />
/// <reference path="globals/es6-promise/index.d.ts" />
/// <reference path="globals/mocha/index.d.ts" />
/// <reference path="globals/node/index.d.ts" />
/// <reference path="globals/q/index.d.ts" />
/// <reference path="globals/read/index.d.ts" />
/// <reference path="globals/semver/index.d.ts" />
/// <reference path="globals/tmp/index.d.ts" />
/// <reference path="globals/xml2js/index.d.ts" />
/// <reference path="modules/glob/index.d.ts" />
/// <reference path="modules/lodash/index.d.ts" />
/// <reference path="modules/mime/index.d.ts" />
/// <reference path="modules/minimatch/index.d.ts" />

View file

@ -1,19 +0,0 @@
// Type definitions for mime
// Project: https://github.com/broofa/node-mime
// Definitions by: Jeff Goddard <https://github.com/jedigo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts
declare module "mime" {
export function lookup(path: string): string;
export function extension(mime: string): string;
export function load(filepath: string): void;
export function define(mimes: Object): void;
interface Charsets {
lookup(mime: string): string;
}
export var charsets: Charsets;
}

View file

@ -1,64 +0,0 @@
// Type definitions for Minimatch 2.0.8
// Project: https://github.com/isaacs/minimatch
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "minimatch" {
function M(target: string, pattern: string, options?: M.IOptions): boolean;
module M {
function match(list: string[], pattern: string, options?: IOptions): string[];
function filter(pattern: string, options?: IOptions): (element: string, indexed: number, array: string[]) => boolean;
function makeRe(pattern: string, options?: IOptions): RegExp;
var Minimatch: IMinimatchStatic;
interface IOptions {
debug?: boolean;
nobrace?: boolean;
noglobstar?: boolean;
dot?: boolean;
noext?: boolean;
nocase?: boolean;
nonull?: boolean;
matchBase?: boolean;
nocomment?: boolean;
nonegate?: boolean;
flipNegate?: boolean;
}
interface IMinimatchStatic {
new (pattern: string, options?: IOptions): IMinimatch;
prototype: IMinimatch;
}
interface IMinimatch {
pattern: string;
options: IOptions;
/** 2-dimensional array of regexp or string expressions. */
set: any[][]; // (RegExp | string)[][]
regexp: RegExp;
negate: boolean;
comment: boolean;
empty: boolean;
makeRe(): RegExp; // regexp or boolean
match(fname: string): boolean;
matchOne(files: string[], pattern: string[], partial: boolean): boolean;
/** Deprecated. For internal use. */
debug(): void;
/** Deprecated. For internal use. */
make(): void;
/** Deprecated. For internal use. */
parseNegate(): void;
/** Deprecated. For internal use. */
braceExpand(pattern: string, options: IOptions): void;
/** Deprecated. For internal use. */
parse(pattern: string, isSub?: boolean): void;
}
}
export = M;
}

290
typings/modules/glob/index.d.ts vendored Normal file
View file

@ -0,0 +1,290 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/typed-typings/npm-minimatch/74f47de8acb42d668491987fc6bc144e7d9aa891/minimatch.d.ts
declare module '~glob~minimatch' {
function minimatch (target: string, pattern: string, options?: minimatch.Options): boolean;
namespace minimatch {
export function match (list: string[], pattern: string, options?: Options): string[];
export function filter (pattern: string, options?: Options): (element: string, indexed: number, array: string[]) => boolean;
export function makeRe (pattern: string, options?: Options): RegExp;
/**
* All options are `false` by default.
*/
export interface Options {
/**
* Dump a ton of stuff to stderr.
*/
debug?: boolean;
/**
* Do not expand `{a,b}` and `{1..3}` brace sets.
*/
nobrace?: boolean;
/**
* Disable `**` matching against multiple folder names.
*/
noglobstar?: boolean;
/**
* Allow patterns to match filenames starting with a period, even if the pattern does not explicitly have a period in that spot.
*
* Note that by default, `a\/**\/b` will not match `a/.d/b`, unless `dot` is set.
*/
dot?: boolean;
/**
* Disable "extglob" style patterns like `+(a|b)`.
*/
noext?: boolean;
/**
* Perform a case-insensitive match.
*/
nocase?: boolean;
/**
* When a match is not found by `minimatch.match`, return a list containing the pattern itself if this option is set. When not set, an empty list is returned if there are no matches.
*/
nonull?: boolean;
/**
* If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
*/
matchBase?: boolean;
/**
* Suppress the behavior of treating `#` at the start of a pattern as a comment.
*/
nocomment?: boolean;
/**
* Suppress the behavior of treating a leading `!` character as negation.
*/
nonegate?: boolean;
/**
* Returns from negate expressions the same as if they were not negated. (Ie, true on a hit, false on a miss.)
*/
flipNegate?: boolean;
}
export class Minimatch {
constructor (pattern: string, options?: Options);
/**
* The original pattern the minimatch object represents.
*/
pattern: string;
/**
* The options supplied to the constructor.
*/
options: Options;
/**
* Created by the `makeRe` method. A single regular expression expressing the entire pattern. This is useful in cases where you wish to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
*/
regexp: RegExp;
/**
* True if the pattern is negated.
*/
negate: boolean;
/**
* True if the pattern is a comment.
*/
comment: boolean;
/**
* True if the pattern is `""`.
*/
empty: boolean;
/**
* Generate the regexp member if necessary, and return it. Will return false if the pattern is invalid.
*/
makeRe (): RegExp | boolean;
/**
* Return true if the filename matches the pattern, or false otherwise.
*/
match (fname: string): boolean;
/**
* Take a `/-`split filename, and match it against a single row in the `regExpSet`. This method is mainly for internal use, but is exposed so that it can be used by a glob-walker that needs to avoid excessive filesystem calls.
*/
matchOne (fileArray: string[], patternArray: string[], partial: boolean): boolean;
}
}
export = minimatch;
}
// Generated by typings
// Source: https://raw.githubusercontent.com/types/npm-glob/59ca0f5d4696a8d4da27858035316c1014133fcb/glob.d.ts
declare module 'glob' {
import events = require('events');
import fs = require('fs');
import minimatch = require('~glob~minimatch');
function glob (pattern: string, cb: (err: Error, matches: string[]) => void): void;
function glob (pattern: string, options: glob.Options, cb: (err: Error, matches: string[]) => void): void;
namespace glob {
export function sync (pattern: string, options?: Options): string[];
export function hasMagic (pattern: string, options?: Options): boolean;
export interface Cache {
[path: string]: boolean | string | string[];
}
export interface StatCache {
[path: string]: fs.Stats;
}
export interface Symlinks {
[path: string]: boolean;
}
export interface Options extends minimatch.Options {
/**
* The current working directory in which to search. Defaults to `process.cwd()`.
*/
cwd?: string;
/**
* The place where patterns starting with `/` will be mounted onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix systems, and `C:\` or some such on Windows.)
*/
root?: string;
/**
* Include `.dot` files in normal matches and `globstar` matches. Note that an explicit dot in a portion of the pattern will always match dot files.
*/
dot?: boolean;
/**
* By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid filesystem path is returned. Set this flag to disable that behavior.
*/
nomount?: boolean;
/**
* Add a `/` character to directory matches. Note that this requires additional stat calls.
*/
mark?: boolean;
/**
* Don't sort the results.
*/
nosort?: boolean;
/**
* Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless `readdir` is presumed to be an untrustworthy indicator of file existence.
*/
stat?: boolean;
/**
* When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr. Set the `silent` option to true to suppress these warnings.
*/
silent?: boolean;
/**
* When an unusual error is encountered when attempting to read a directory, the process will just continue on in search of other matches. Set the `strict` option to raise an error in these cases.
*/
strict?: boolean;
/**
* See `cache` property above. Pass in a previously generated cache object to save some fs calls.
*/
cache?: Cache;
/**
* A cache of results of filesystem information, to prevent unnecessary stat calls. While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the options object of another, if you know that the filesystem will not change between calls. (See https://github.com/isaacs/node-glob#race-conditions)
*/
statCache?: StatCache;
/**
* A cache of known symbolic links. You may pass in a previously generated `symlinks` object to save lstat calls when resolving `**` matches.
*/
symlinks?: Symlinks;
/**
* DEPRECATED: use `glob.sync(pattern, opts)` instead.
*/
sync?: boolean;
/**
* In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set. By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior.
*/
nounique?: boolean;
/**
* Set to never return an empty set, instead returning a set containing the pattern itself. This is the default in glob(3).
*/
nonull?: boolean;
/**
* Set to enable debug logging in minimatch and glob.
*/
debug?: boolean;
/**
* Do not expand `{a,b}` and `{1..3}` brace sets.
*/
nobrace?: boolean;
/**
* Do not match `**` against multiple filenames. (Ie, treat it as a normal `*` instead.)
*/
noglobstar?: boolean;
/**
* Do not match `+(a|b)` "extglob" patterns.
*/
noext?: boolean;
/**
* Perform a case-insensitive match. Note: on case-insensitive filesystems, non-magic patterns will match by default, since `stat` and `readdir` will not raise errors.
*/
nocase?: boolean;
/**
* Perform a basename-only match if the pattern does not contain any slash characters. That is, `*.js` would be treated as equivalent to `**\/*.js`, matching all js files in all directories.
*/
matchBase?: any;
/**
* Do not match directories, only files. (Note: to match only directories, simply put a `/` at the end of the pattern.)
*/
nodir?: boolean;
/**
* Add a pattern or an array of glob patterns to exclude matches. Note: `ignore` patterns are always in `dot:true` mode, regardless of any other settings.
*/
ignore?: string | string[];
/**
* Follow symlinked directories when expanding `**` patterns. Note that this can result in a lot of duplicate references in the presence of cyclic links.
*/
follow?: boolean;
/**
* Set to true to call `fs.realpath` on all of the results. In the case of a symlink that cannot be resolved, the full absolute path to the matched entry is returned (though it will usually be a broken symlink)
*/
realpath?: boolean;
}
export class Glob extends events.EventEmitter {
constructor (pattern: string, cb?: (err: Error, matches: string[]) => void);
constructor (pattern: string, options: Options, cb?: (err: Error, matches: string[]) => void);
/**
* The minimatch object that the glob uses.
*/
minimatch: minimatch.Minimatch;
/**
* The options object passed in.
*/
options: Options;
/**
* Boolean which is set to true when calling `abort()`. There is no way at this time to continue a glob search after aborting, but you can re-use the statCache to avoid having to duplicate syscalls.
* @type {boolean}
*/
aborted: boolean;
/**
* Convenience object.
*/
cache: Cache;
/**
* Cache of `fs.stat` results, to prevent statting the same path multiple times.
*/
statCache: StatCache;
/**
* A record of which paths are symbolic links, which is relevant in resolving `**` patterns.
*/
symlinks: Symlinks;
/**
* An optional object which is passed to `fs.realpath` to minimize unnecessary syscalls. It is stored on the instantiated Glob object, and may be re-used.
*/
realpathCache: { [path: string]: string };
found: string[];
/**
* Temporarily stop the search.
*/
pause(): void;
/**
* Resume the search.
*/
resume(): void;
/**
* Stop the search forever.
*/
abort(): void;
}
}
export = glob;
}

View file

@ -0,0 +1,19 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/types/npm-glob/59ca0f5d4696a8d4da27858035316c1014133fcb/typings.json",
"raw": "registry:npm/glob#6.0.0+20160723033700",
"main": "glob.d.ts",
"dependencies": {
"minimatch": {
"src": "https://raw.githubusercontent.com/typed-typings/npm-minimatch/74f47de8acb42d668491987fc6bc144e7d9aa891/typings.json",
"raw": "github:typed-typings/npm-minimatch#74f47de8acb42d668491987fc6bc144e7d9aa891",
"main": "minimatch.d.ts",
"name": "minimatch",
"type": "typings"
}
},
"name": "glob",
"type": "typings"
}
}

32
typings/modules/mime/index.d.ts vendored Normal file
View file

@ -0,0 +1,32 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/mime.d.ts
declare module 'mime' {
class Mime {
types: {
[extension: string]: string;
}
extensions: {
[extension: string]: string;
}
define (map: Map): void;
load (filename: string): void;
lookup (path: string, fallback?: string): string;
extension (mimeType: string): string;
}
interface Map {
[type: string]: string[];
}
var mime: Mime & {
default_type: string;
charsets: {
lookup (mimeType: string, fallback?: string): string;
}
Mime: typeof Mime;
}
export = mime;
}

View file

@ -0,0 +1,11 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typings.json",
"raw": "registry:npm/mime#1.3.0+20160723033700",
"main": "mime.d.ts",
"version": "^1.3.0",
"name": "mime",
"type": "typings"
}
}

108
typings/modules/minimatch/index.d.ts vendored Normal file
View file

@ -0,0 +1,108 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/types/npm-minimatch/74f47de8acb42d668491987fc6bc144e7d9aa891/minimatch.d.ts
declare module 'minimatch' {
function minimatch (target: string, pattern: string, options?: minimatch.Options): boolean;
namespace minimatch {
export function match (list: string[], pattern: string, options?: Options): string[];
export function filter (pattern: string, options?: Options): (element: string, indexed: number, array: string[]) => boolean;
export function makeRe (pattern: string, options?: Options): RegExp;
/**
* All options are `false` by default.
*/
export interface Options {
/**
* Dump a ton of stuff to stderr.
*/
debug?: boolean;
/**
* Do not expand `{a,b}` and `{1..3}` brace sets.
*/
nobrace?: boolean;
/**
* Disable `**` matching against multiple folder names.
*/
noglobstar?: boolean;
/**
* Allow patterns to match filenames starting with a period, even if the pattern does not explicitly have a period in that spot.
*
* Note that by default, `a\/**\/b` will not match `a/.d/b`, unless `dot` is set.
*/
dot?: boolean;
/**
* Disable "extglob" style patterns like `+(a|b)`.
*/
noext?: boolean;
/**
* Perform a case-insensitive match.
*/
nocase?: boolean;
/**
* When a match is not found by `minimatch.match`, return a list containing the pattern itself if this option is set. When not set, an empty list is returned if there are no matches.
*/
nonull?: boolean;
/**
* If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
*/
matchBase?: boolean;
/**
* Suppress the behavior of treating `#` at the start of a pattern as a comment.
*/
nocomment?: boolean;
/**
* Suppress the behavior of treating a leading `!` character as negation.
*/
nonegate?: boolean;
/**
* Returns from negate expressions the same as if they were not negated. (Ie, true on a hit, false on a miss.)
*/
flipNegate?: boolean;
}
export class Minimatch {
constructor (pattern: string, options?: Options);
/**
* The original pattern the minimatch object represents.
*/
pattern: string;
/**
* The options supplied to the constructor.
*/
options: Options;
/**
* Created by the `makeRe` method. A single regular expression expressing the entire pattern. This is useful in cases where you wish to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
*/
regexp: RegExp;
/**
* True if the pattern is negated.
*/
negate: boolean;
/**
* True if the pattern is a comment.
*/
comment: boolean;
/**
* True if the pattern is `""`.
*/
empty: boolean;
/**
* Generate the regexp member if necessary, and return it. Will return false if the pattern is invalid.
*/
makeRe (): RegExp | boolean;
/**
* Return true if the filename matches the pattern, or false otherwise.
*/
match (fname: string): boolean;
/**
* Take a `/-`split filename, and match it against a single row in the `regExpSet`. This method is mainly for internal use, but is exposed so that it can be used by a glob-walker that needs to avoid excessive filesystem calls.
*/
matchOne (fileArray: string[], patternArray: string[], partial: boolean): boolean;
}
}
export = minimatch;
}

View file

@ -0,0 +1,10 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/types/npm-minimatch/74f47de8acb42d668491987fc6bc144e7d9aa891/typings.json",
"raw": "registry:npm/minimatch#3.0.0+20160723033700",
"main": "minimatch.d.ts",
"name": "minimatch",
"type": "typings"
}
}

View file

@ -1,25 +0,0 @@
declare module "read" {
import { Readable, Writable } from 'stream';
function read(options: read.Options, callback: read.Callback): void;
module read {
interface Options {
prompt?: string;
silent?: boolean;
replace?: string;
timeout?: number;
default?: string;
edit?: boolean;
terminal?: boolean;
input?: Readable;
output?: Writable;
}
interface Callback {
(error: Error, result: string, isDefault: boolean): void;
}
}
export = read;
}

11
typings/tsd.d.ts vendored
View file

@ -1,11 +0,0 @@
/// <reference path="node/node.d.ts" />
/// <reference path="glob/glob.d.ts" />
/// <reference path="minimatch/minimatch.d.ts" />
/// <reference path="q/Q.d.ts" />
/// <reference path="tmp/tmp.d.ts" />
/// <reference path="commander/commander.d.ts" />
/// <reference path="es6-promise/es6-promise.d.ts" />
/// <reference path="mocha/mocha.d.ts" />
/// <reference path="xml2js/xml2js.d.ts" />
/// <reference path="mime/mime.d.ts" />
/// <reference path="semver/semver.d.ts" />

View file

@ -1,7 +1,7 @@
declare module 'url-join' {
function join(...args: string[]): string;
module join {}
export = join;
}