mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge branch 'master' of https://github.com/segayuu/DefinitelyTyped into cleanup-bluebird-ignore-error
This commit is contained in:
@@ -114,6 +114,12 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/camel-case",
|
||||
"asOfVersion": "1.2.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "chalk",
|
||||
"typingsPackageName": "chalk",
|
||||
"sourceRepoURL": "https://github.com/chalk/chalk",
|
||||
"asOfVersion": "2.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "change-case",
|
||||
"typingsPackageName": "change-case",
|
||||
|
||||
@@ -644,6 +644,9 @@ isolateScope = element.find('div').isolateScope();
|
||||
isolateScope = element.children().isolateScope();
|
||||
let element2 = angular.element(element);
|
||||
let elementArray = angular.element(document.querySelectorAll('div'));
|
||||
let elementReadyFn = angular.element(() => {
|
||||
console.log('ready');
|
||||
});
|
||||
|
||||
// $timeout signature tests
|
||||
namespace TestTimeout {
|
||||
|
||||
Vendored
+1
-1
@@ -684,7 +684,7 @@ interface JQuery {
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
(element: string | Element | Document | JQuery | ArrayLike<Element>): JQLite;
|
||||
(element: string | Element | Document | JQuery | ArrayLike<Element> | (() => void)): JQLite;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/expressjs/body-parser
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo>, Vilic Vane <https://github.com/vilic>, Jonathan Häberle <https://github.com/dreampulse>, Gevik Babakhani <https://github.com/blendsdk>, Tomasz Łaziuk <https://github.com/tlaziuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import chalk = require('chalk');
|
||||
|
||||
var str = '';
|
||||
var bool = false;
|
||||
var chain: chalk.ChalkChain;
|
||||
|
||||
chalk.enabled = bool;
|
||||
str = chalk.stripColor(str);
|
||||
|
||||
bool = chalk.supportsColor;
|
||||
bool = chalk.hasColor(str);
|
||||
|
||||
// style a string
|
||||
console.log( chalk.blue('Hello world!') );
|
||||
|
||||
// combine styled and normal strings
|
||||
console.log( chalk.blue('Hello'), 'World' + chalk.red('!') );
|
||||
|
||||
// compose multiple styles using the chainable API
|
||||
console.log( chalk.blue.bgRed.bold('Hello world!') );
|
||||
|
||||
// pass in multiple arguments
|
||||
console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') );
|
||||
|
||||
// nest styles
|
||||
console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') );
|
||||
|
||||
// nest styles of the same type even (color, underline, background)
|
||||
console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') );
|
||||
|
||||
chain = chalk.green;
|
||||
chain = chain.underline;
|
||||
str = chain('someString');
|
||||
|
||||
chalk.enabled = chalk.supportsColor = bool;
|
||||
|
||||
var chalkObj = new chalk.constructor({enabled: false});
|
||||
|
||||
chain = chalkObj.green;
|
||||
chain = chalkObj.underline;
|
||||
chalkObj.enabled = true;
|
||||
str = chain('foo');
|
||||
Vendored
-133
@@ -1,133 +0,0 @@
|
||||
// Type definitions for chalk v0.4.0
|
||||
// Project: https://github.com/sindresorhus/chalk
|
||||
// Definitions by: Diullei Gomes <https://github.com/Diullei>, Bart van der Schoor <https://github.com/Bartvds>, Nico Jansen <https://github.com/nicojs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = Chalk;
|
||||
|
||||
declare namespace Chalk {
|
||||
export var enabled: boolean;
|
||||
export var supportsColor: boolean;
|
||||
export var styles: ChalkStyleMap;
|
||||
|
||||
export function stripColor(value: string): any;
|
||||
export function hasColor(str: string): boolean;
|
||||
|
||||
export interface ChalkChain extends ChalkStyle {
|
||||
(): boolean;
|
||||
(...text: string[]): string;
|
||||
}
|
||||
|
||||
export interface ChalkStyleElement {
|
||||
open: string;
|
||||
close: string;
|
||||
}
|
||||
|
||||
// General
|
||||
export var reset: ChalkChain;
|
||||
export var bold: ChalkChain;
|
||||
export var dim: ChalkChain;
|
||||
export var italic: ChalkChain;
|
||||
export var underline: ChalkChain;
|
||||
export var inverse: ChalkChain;
|
||||
export var hidden: ChalkChain;
|
||||
export var strikethrough: ChalkChain;
|
||||
|
||||
// Text colors
|
||||
export var black: ChalkChain;
|
||||
export var red: ChalkChain;
|
||||
export var green: ChalkChain;
|
||||
export var yellow: ChalkChain;
|
||||
export var blue: ChalkChain;
|
||||
export var magenta: ChalkChain;
|
||||
export var cyan: ChalkChain;
|
||||
export var white: ChalkChain;
|
||||
export var gray: ChalkChain;
|
||||
export var grey: ChalkChain;
|
||||
|
||||
// Background colors
|
||||
export var bgBlack: ChalkChain;
|
||||
export var bgRed: ChalkChain;
|
||||
export var bgGreen: ChalkChain;
|
||||
export var bgYellow: ChalkChain;
|
||||
export var bgBlue: ChalkChain;
|
||||
export var bgMagenta: ChalkChain;
|
||||
export var bgCyan: ChalkChain;
|
||||
export var bgWhite: ChalkChain;
|
||||
|
||||
|
||||
export interface ChalkStyle {
|
||||
// General
|
||||
reset: ChalkChain;
|
||||
bold: ChalkChain;
|
||||
dim: ChalkChain;
|
||||
italic: ChalkChain;
|
||||
underline: ChalkChain;
|
||||
inverse: ChalkChain;
|
||||
hidden: ChalkChain;
|
||||
strikethrough: ChalkChain;
|
||||
|
||||
// Text colors
|
||||
black: ChalkChain;
|
||||
red: ChalkChain;
|
||||
green: ChalkChain;
|
||||
yellow: ChalkChain;
|
||||
blue: ChalkChain;
|
||||
magenta: ChalkChain;
|
||||
cyan: ChalkChain;
|
||||
white: ChalkChain;
|
||||
gray: ChalkChain;
|
||||
grey: ChalkChain;
|
||||
|
||||
// Background colors
|
||||
bgBlack: ChalkChain;
|
||||
bgRed: ChalkChain;
|
||||
bgGreen: ChalkChain;
|
||||
bgYellow: ChalkChain;
|
||||
bgBlue: ChalkChain;
|
||||
bgMagenta: ChalkChain;
|
||||
bgCyan: ChalkChain;
|
||||
bgWhite: ChalkChain;
|
||||
}
|
||||
|
||||
export interface ChalkStyleMap {
|
||||
// General
|
||||
reset: ChalkStyleElement;
|
||||
bold: ChalkStyleElement;
|
||||
dim: ChalkStyleElement;
|
||||
italic: ChalkStyleElement;
|
||||
underline: ChalkStyleElement;
|
||||
inverse: ChalkStyleElement;
|
||||
hidden: ChalkStyleElement;
|
||||
strikethrough: ChalkStyleElement;
|
||||
|
||||
// Text colors
|
||||
black: ChalkStyleElement;
|
||||
red: ChalkStyleElement;
|
||||
green: ChalkStyleElement;
|
||||
yellow: ChalkStyleElement;
|
||||
blue: ChalkStyleElement;
|
||||
magenta: ChalkStyleElement;
|
||||
cyan: ChalkStyleElement;
|
||||
white: ChalkStyleElement;
|
||||
gray: ChalkStyleElement;
|
||||
|
||||
// Background colors
|
||||
bgBlack: ChalkStyleElement;
|
||||
bgRed: ChalkStyleElement;
|
||||
bgGreen: ChalkStyleElement;
|
||||
bgYellow: ChalkStyleElement;
|
||||
bgBlue: ChalkStyleElement;
|
||||
bgMagenta: ChalkStyleElement;
|
||||
bgCyan: ChalkStyleElement;
|
||||
bgWhite: ChalkStyleElement;
|
||||
}
|
||||
|
||||
export const constructor: {
|
||||
new (options: {enabled: boolean}): Chalk;
|
||||
}
|
||||
|
||||
export interface Chalk extends ChalkStyle {
|
||||
enabled: boolean;
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -569,7 +569,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
*
|
||||
* @param name Name of the transition.
|
||||
*/
|
||||
export function transition<OldDatum>(name: string): Transition<HTMLElement, OldDatum, null, undefined>;
|
||||
export function transition<OldDatum>(name?: string): Transition<HTMLElement, OldDatum, null, undefined>;
|
||||
|
||||
/**
|
||||
* Returns a new transition from an existing transition.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { detect } from 'detect-browser';
|
||||
const browser = detect();
|
||||
|
||||
import detectBrowser = require("detect-browser");
|
||||
|
||||
const n: string = detectBrowser.name;
|
||||
const v: string = detectBrowser.version;
|
||||
if (browser) {
|
||||
const name: string = browser.name;
|
||||
const version: string = browser.version;
|
||||
}
|
||||
|
||||
Vendored
+22
-9
@@ -1,14 +1,27 @@
|
||||
// Type definitions for detect-browser v1.6.2
|
||||
// Type definitions for detect-browser 2.0
|
||||
// Project: https://github.com/DamonOehlman/detect-browser
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Browser name
|
||||
*/
|
||||
export const name: "edge" | "yandexbrowser" | "chrome" | "crios" | "firefox" | "opera" | "ie" | "bb10" | "android" | "ios" | "safari";
|
||||
export type BrowserName =
|
||||
"android" |
|
||||
"bb10" |
|
||||
"chrome" |
|
||||
"crios" |
|
||||
"edge" |
|
||||
"firefox" |
|
||||
"fxios" |
|
||||
"ie" |
|
||||
"ios" |
|
||||
"kakaotalk" |
|
||||
"opera" |
|
||||
"phantomjs" |
|
||||
"safari" |
|
||||
"vivaldi" |
|
||||
"yandexbrowser";
|
||||
|
||||
/**
|
||||
* Browser version
|
||||
*/
|
||||
export const version: string;
|
||||
export function detect(): null | {
|
||||
name: BrowserName | "node";
|
||||
version: string;
|
||||
os: string;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
|
||||
@@ -1,79 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"indent": [
|
||||
true,
|
||||
"spaces",
|
||||
4
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import * as express from 'express';
|
||||
import * as expressEjsLayouts from 'express-ejs-layouts';
|
||||
|
||||
function expressRequestHandlerTest() {
|
||||
const app = express()
|
||||
.use(expressEjsLayouts());
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// Type definitions for express-ejs-layouts 2.3
|
||||
// Project: https://github.com/Soarez/express-ejs-layouts
|
||||
// Definitions by: Erik Mavrinac <https://github.com/erikma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { RequestHandler } from 'express';
|
||||
|
||||
declare function expressEjsLayouts(): RequestHandler;
|
||||
|
||||
declare namespace expressEjsLayouts {
|
||||
}
|
||||
|
||||
export = expressEjsLayouts;
|
||||
@@ -2,8 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
@@ -19,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chalk-tests.ts"
|
||||
"express-ejs-layouts-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/nfriedly/express-rate-limit
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, makepost <https://github.com/makepost>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import express = require("express");
|
||||
|
||||
|
||||
+7
-10
@@ -2,6 +2,8 @@
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>, Michał Lytek <https://github.com/19majkel94>, Kacper Polak <https://github.com/kacepe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
// This extracts the core definitions from express to prevent a circular dependency between express and serve-static
|
||||
/// <reference types="node" />
|
||||
|
||||
@@ -174,12 +176,7 @@ interface RequestRanges extends Array<ByteRange> { type: string; }
|
||||
|
||||
interface Errback { (err: Error): void; }
|
||||
|
||||
interface Request<
|
||||
Body = any,
|
||||
Query = any,
|
||||
Params = any,
|
||||
Cookies = any
|
||||
> extends http.IncomingMessage, Express.Request {
|
||||
interface Request extends http.IncomingMessage, Express.Request {
|
||||
|
||||
/**
|
||||
* Return request header.
|
||||
@@ -440,14 +437,14 @@ interface Request<
|
||||
xhr: boolean;
|
||||
|
||||
//body: { username: string; password: string; remember: boolean; title: string; };
|
||||
body: Body;
|
||||
body: any;
|
||||
|
||||
//cookies: { string; remember: boolean; };
|
||||
cookies: Cookies;
|
||||
cookies: any;
|
||||
|
||||
method: string;
|
||||
|
||||
params: Params;
|
||||
params: any;
|
||||
|
||||
/**
|
||||
* Clear cookie `name`.
|
||||
@@ -457,7 +454,7 @@ interface Request<
|
||||
*/
|
||||
clearCookie(name: string, options?: any): Response;
|
||||
|
||||
query: Query;
|
||||
query: any;
|
||||
|
||||
route: any;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Definitions by: Jacob Bogers <https://github.com/jacobbogers
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
@@ -17,10 +17,9 @@ namespace express_tests {
|
||||
next();
|
||||
});
|
||||
|
||||
app.use((err: any, req: express.Request<{ hello: string; }>, res: express.Response, next: express.NextFunction) => {
|
||||
console.log(req.body.hello);
|
||||
console.error(err);
|
||||
next(err);
|
||||
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
console.error(err);
|
||||
next(err);
|
||||
});
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
|
||||
Vendored
+2
-7
@@ -2,7 +2,7 @@
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
@@ -76,12 +76,7 @@ declare namespace e {
|
||||
interface IRouterMatcher<T> extends core.IRouterMatcher<T> { }
|
||||
interface MediaType extends core.MediaType { }
|
||||
interface NextFunction extends core.NextFunction { }
|
||||
interface Request<
|
||||
Body = any,
|
||||
Query = any,
|
||||
Params = any,
|
||||
Cookies = any
|
||||
> extends core.Request<Body, Query, Params, Cookies> { }
|
||||
interface Request extends core.Request { }
|
||||
interface RequestHandler extends core.RequestHandler { }
|
||||
interface RequestParamHandler extends core.RequestParamHandler { }
|
||||
export interface Response extends core.Response { }
|
||||
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for fossil-delta 0.2.5
|
||||
// Type definitions for fossil-delta 1.0.0
|
||||
// Project: https://github.com/dchest/fossil-delta-js
|
||||
// Definitions by: Endel Dreyer <https://github.com/endel>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -8,5 +8,5 @@
|
||||
type ByteArray = Array<number> | Uint8Array | Buffer;
|
||||
|
||||
export function create(origin: ByteArray, target: ByteArray): Array<number>;
|
||||
export function apply(origin: ByteArray, delta: Array<number>): Array<number>;
|
||||
export function apply(origin: ByteArray, delta: Array<number>, ops?: { verifyChecksum: boolean }): Array<number>;
|
||||
export function outputSize(delta: Array<number>): number;
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import fs = require("fs");
|
||||
import * as grasp from "grasp";
|
||||
|
||||
grasp(); // $ExpectError
|
||||
grasp({ args: [] }); // $ExpectType void
|
||||
|
||||
// $ExpectType void
|
||||
grasp({
|
||||
args: [],
|
||||
error: console.error,
|
||||
callback: console.log,
|
||||
exit: process.exit,
|
||||
console,
|
||||
stdin: process.stdin,
|
||||
fs,
|
||||
input: "foo bar"
|
||||
});
|
||||
|
||||
// $ExpectError
|
||||
grasp({
|
||||
args: [],
|
||||
textFormat: { cyan: "cyan" }
|
||||
});
|
||||
|
||||
// $ExpectType string
|
||||
grasp.VERSION;
|
||||
|
||||
const fooquery = grasp.search("fooquery"); // $ExpectError
|
||||
const equery = grasp.search("equery");
|
||||
const squery = grasp.search("squery");
|
||||
|
||||
// $ExpectType Node[]
|
||||
grasp.search("equery", "pattern", "input");
|
||||
|
||||
// $ExpectType Node[]
|
||||
equery("pattern")("input");
|
||||
|
||||
// $ExpectType (input: string) => Node[]
|
||||
squery("pattern");
|
||||
|
||||
const replacer = grasp.replace("equery", "pattern");
|
||||
|
||||
// $ExpectType string
|
||||
replacer("replacement", "input");
|
||||
|
||||
// $ExpectType string
|
||||
replacer((getRaw, node, query, named) => {
|
||||
getRaw(node); // $ExpectType string
|
||||
return "foo";
|
||||
}, "input");
|
||||
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
// Type definitions for grasp 0.6
|
||||
// Project: http://graspjs.com
|
||||
// Definitions by: Isaac Wolkerstorfer <https://github.com/agnoster>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as cliColor from "cli-color";
|
||||
// Though Grasp does not use esprima, the parser it uses (flow-parser) has a compatible Node type and existing typedefs
|
||||
import { Node } from "estree";
|
||||
|
||||
export = grasp;
|
||||
|
||||
declare function grasp(options: {
|
||||
args: string[] | Record<string, any> | string;
|
||||
error?: (message: string) => void;
|
||||
callback?: (result: string) => void;
|
||||
exit?: (code: number) => void;
|
||||
input?: string;
|
||||
|
||||
// The following are "overrides" for defaults, such as console, cli-color,
|
||||
// process.stdin, or fs. In most cases grasp only makes use of a small
|
||||
// surface area of the types, but I think if someone really wants to pass a
|
||||
// fake fs that only implements the subset of methods they think grasp uses,
|
||||
// it should be up to them to use a cast rather than the typedef to be
|
||||
// overly lenient. We never know if grasp might change their internal use of
|
||||
// fs, after all.
|
||||
fs?: typeof fs;
|
||||
console?: typeof console;
|
||||
textFormat?: typeof cliColor;
|
||||
stdin?: typeof process.stdin;
|
||||
}): void;
|
||||
|
||||
declare namespace grasp {
|
||||
const VERSION: string;
|
||||
|
||||
// Both the search and replace functions are curryable, which leads to quite
|
||||
// a bit of noise. Using generic currying will discard variable name
|
||||
// information, so we hand-roll it here
|
||||
|
||||
function search(engine: QueryEngineType, selector: string, input: string): Node[];
|
||||
function search(engine: QueryEngineType, selector: string): (input: string) => Node[];
|
||||
function search(engine: QueryEngineType): GraspSearchWithQueryEngine;
|
||||
|
||||
function replace(engine: QueryEngineType, selector: string, replacement: Replacement, input: string): string;
|
||||
function replace(engine: QueryEngineType, selector: string, replacement: Replacement): (input: string) => string;
|
||||
function replace(engine: QueryEngineType, selector: string): GraspReplaceWithSelector;
|
||||
function replace(engine: QueryEngineType): GraspReplaceWithQueryEngine;
|
||||
|
||||
type QueryEngineType = "squery" | "equery";
|
||||
|
||||
type Replacement =
|
||||
| string
|
||||
| ((
|
||||
getRaw: (node: Node) => string,
|
||||
node: Node,
|
||||
query: (q: string) => Node[],
|
||||
named: { [key: string]: string | Node }
|
||||
) => string);
|
||||
|
||||
type GraspSearchWithQueryEngine = ((selector: string, input: string) => Node[]) &
|
||||
((selector: string) => (input: string) => Node[]);
|
||||
|
||||
type GraspReplaceWithQueryEngine = ((selector: string) => GraspReplaceWithSelector) &
|
||||
((selector: string, replacement: Replacement) => (input: string) => string) &
|
||||
((selector: string, replacement: Replacement, input: string) => string);
|
||||
|
||||
type GraspReplaceWithSelector = ((replacement: Replacement) => (input: string) => string) &
|
||||
((replacement: Replacement, input: string) => string);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "grasp-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+117
-117
@@ -7,15 +7,16 @@ import path = require('path');
|
||||
import should = require('should');
|
||||
import Stream = require('stream');
|
||||
import through = require('through2');
|
||||
var es = require('event-stream');
|
||||
const es = require('event-stream');
|
||||
//TODO: import es = require('event-stream');
|
||||
|
||||
// ReSharper disable WrongExpressionStatement
|
||||
describe('File()', () => {
|
||||
it('should return a valid file', done => {
|
||||
var fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
var base = path.join(__dirname, './fixtures/');
|
||||
var file = new util.File({
|
||||
base: base,
|
||||
const fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
const base = path.join(__dirname, './fixtures/');
|
||||
const file = new util.File({
|
||||
base,
|
||||
cwd: __dirname,
|
||||
path: fname
|
||||
});
|
||||
@@ -32,10 +33,10 @@ describe('File()', () => {
|
||||
});
|
||||
|
||||
it('should return a valid file 2', done => {
|
||||
var fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
var base = __dirname;
|
||||
var file = new util.File({
|
||||
base: base,
|
||||
const fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
const base = __dirname;
|
||||
const file = new util.File({
|
||||
base,
|
||||
cwd: __dirname,
|
||||
path: fname
|
||||
});
|
||||
@@ -54,32 +55,31 @@ describe('File()', () => {
|
||||
|
||||
describe('replaceExtension()', () => {
|
||||
it('should return a valid replaced extension on nested', done => {
|
||||
var fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
var expected = path.join(__dirname, './fixtures/test.js');
|
||||
var nu = util.replaceExtension(fname, '.js');
|
||||
const fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
const expected = path.join(__dirname, './fixtures/test.js');
|
||||
const nu = util.replaceExtension(fname, '.js');
|
||||
should.exist(nu);
|
||||
nu.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return a valid replaced extension on flat', done => {
|
||||
var fname = 'test.coffee';
|
||||
var expected = 'test.js';
|
||||
var nu = util.replaceExtension(fname, '.js');
|
||||
const fname = 'test.coffee';
|
||||
const expected = 'test.js';
|
||||
const nu = util.replaceExtension(fname, '.js');
|
||||
should.exist(nu);
|
||||
nu.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should not return a valid replaced extension on empty string', done => {
|
||||
var fname = '';
|
||||
var expected = '';
|
||||
var nu = util.replaceExtension(fname, '.js');
|
||||
const fname = '';
|
||||
const expected = '';
|
||||
const nu = util.replaceExtension(fname, '.js');
|
||||
should.exist(nu);
|
||||
nu.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('colors', () => {
|
||||
@@ -96,14 +96,14 @@ describe('date', () => {
|
||||
done();
|
||||
});
|
||||
it('should return today\'s date', done => {
|
||||
var time = new Date();
|
||||
var dateutil = util.date('HH:MM:ss');
|
||||
dateutil.should.equal(('0' + time.getHours()).slice(-2) + ':' + ('0' + time.getMinutes()).slice(-2) + ':' + ('0' + time.getSeconds()).slice(-2));
|
||||
const time = new Date();
|
||||
const dateutil = util.date('HH:MM:ss');
|
||||
dateutil.should.equal(`${('0' + time.getHours()).slice(-2)}:${('0' + time.getMinutes()).slice(-2)}:${('0' + time.getSeconds()).slice(-2)}`);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
var now = new Date();
|
||||
const now = new Date();
|
||||
|
||||
// Basic usage
|
||||
util.date(now, 'dddd, mmmm dS, yyyy, h:MM:ss TT');
|
||||
@@ -157,11 +157,11 @@ util.date(now, 'N');
|
||||
|
||||
describe('log()', () => {
|
||||
it('should work i guess', done => {
|
||||
var writtenValue = '';
|
||||
const writtenValue = '';
|
||||
|
||||
util.log(1, 2, 3, 4, 'five');
|
||||
var time = util.date(new Date(), 'HH:MM:ss');
|
||||
writtenValue.should.eql('[' + util.colors.gray(time) + '] 1 2 3 4 five\n');
|
||||
const time = util.date(new Date(), 'HH:MM:ss');
|
||||
writtenValue.should.eql(`[${util.colors.gray(time)}] 1 2 3 4 five\n`);
|
||||
|
||||
done();
|
||||
});
|
||||
@@ -169,34 +169,34 @@ describe('log()', () => {
|
||||
|
||||
describe('template()', () => {
|
||||
it('should work with just a template', done => {
|
||||
var opt = {
|
||||
const opt = {
|
||||
name: 'todd',
|
||||
file: {
|
||||
path: 'hi.js'
|
||||
}
|
||||
};
|
||||
var expected = 'test todd hi.js';
|
||||
const expected = 'test todd hi.js';
|
||||
|
||||
var tmpl = util.template('test <%= name %> <%= file.path %>');
|
||||
const tmpl = util.template('test <%= name %> <%= file.path %>');
|
||||
should.exist(tmpl);
|
||||
'function'.should.equal(typeof (tmpl));
|
||||
|
||||
// eval it now
|
||||
var etmpl = tmpl(opt);
|
||||
const etmpl = tmpl(opt);
|
||||
'string'.should.equal(typeof (etmpl));
|
||||
etmpl.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should work with a template and data', done => {
|
||||
var opt = {
|
||||
const opt = {
|
||||
name: 'todd',
|
||||
file: {
|
||||
path: 'hi.js'
|
||||
}
|
||||
};
|
||||
var expected = 'test todd hi.js';
|
||||
var tmpl = util.template('test <%= name %> <%= file.path %>', opt);
|
||||
const expected = 'test todd hi.js';
|
||||
const tmpl = util.template('test <%= name %> <%= file.path %>', opt);
|
||||
should.exist(tmpl);
|
||||
'string'.should.equal(typeof (tmpl));
|
||||
tmpl.should.equal(expected);
|
||||
@@ -204,11 +204,11 @@ describe('template()', () => {
|
||||
});
|
||||
|
||||
//it('should throw an error when no file object is passed', done => {
|
||||
// var opt = {
|
||||
// const opt = {
|
||||
// name: 'todd'
|
||||
// };
|
||||
// try {
|
||||
// var tmpl = util.template('test <%= name %> <%= file.path %>', opt);
|
||||
// const tmpl = util.template('test <%= name %> <%= file.path %>', opt);
|
||||
// } catch (err) {
|
||||
// should.exist(err);
|
||||
// done();
|
||||
@@ -216,23 +216,23 @@ describe('template()', () => {
|
||||
//});
|
||||
|
||||
it('should ignore modified templateSettings', done => {
|
||||
var templateSettings = require('lodash.templatesettings');
|
||||
const templateSettings = require('lodash.templatesettings');
|
||||
templateSettings.interpolate = /\{\{([\s\S]+?)\}\}/g;
|
||||
|
||||
var opt = {
|
||||
const opt = {
|
||||
name: 'todd',
|
||||
file: {
|
||||
path: 'hi.js'
|
||||
}
|
||||
};
|
||||
var expected = 'test {{name}} hi.js';
|
||||
const expected = 'test {{name}} hi.js';
|
||||
|
||||
var tmpl = util.template('test {{name}} <%= file.path %>');
|
||||
const tmpl = util.template('test {{name}} <%= file.path %>');
|
||||
should.exist(tmpl);
|
||||
'function'.should.equal(typeof (tmpl));
|
||||
|
||||
// eval it now
|
||||
var etmpl = tmpl(opt);
|
||||
const etmpl = tmpl(opt);
|
||||
'string'.should.equal(typeof (etmpl));
|
||||
etmpl.should.equal(expected);
|
||||
|
||||
@@ -240,26 +240,25 @@ describe('template()', () => {
|
||||
});
|
||||
|
||||
it('should allow ES6 delimiters', done => {
|
||||
var opt = {
|
||||
const opt = {
|
||||
name: 'todd',
|
||||
file: {
|
||||
path: 'hi.js'
|
||||
}
|
||||
};
|
||||
var expected = 'test todd hi.js';
|
||||
const expected = 'test todd hi.js';
|
||||
|
||||
var tmpl = util.template('test ${name} ${file.path}');
|
||||
const tmpl = util.template('test ${name} ${file.path}'); // tslint:disable-line no-invalid-template-strings
|
||||
should.exist(tmpl);
|
||||
'function'.should.equal(typeof (tmpl));
|
||||
|
||||
// eval it now
|
||||
var etmpl = tmpl(opt);
|
||||
const etmpl = tmpl(opt);
|
||||
'string'.should.equal(typeof (etmpl));
|
||||
etmpl.should.equal(expected);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('env', () => {
|
||||
@@ -276,8 +275,8 @@ describe('noop()', () => {
|
||||
done();
|
||||
});
|
||||
it('should return a stream that passes through all data', done => {
|
||||
var inp = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
var stream = util.noop();
|
||||
const inp = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
const stream = util.noop();
|
||||
es.readArray(inp)
|
||||
.pipe(stream)
|
||||
.pipe(es.writeArray((err: Error, arr: any[]) => {
|
||||
@@ -291,7 +290,7 @@ describe('noop()', () => {
|
||||
|
||||
describe('beep()', () => {
|
||||
it('should send the right code to stdout', done => {
|
||||
var writtenValue = '';
|
||||
const writtenValue = '';
|
||||
|
||||
util.beep();
|
||||
writtenValue.should.equal('\x07');
|
||||
@@ -338,45 +337,45 @@ describe('isNull()', () => {
|
||||
});
|
||||
|
||||
// linefeed
|
||||
declare var lines: string[];
|
||||
declare const lines: string[];
|
||||
lines.join(util.linefeed);
|
||||
|
||||
describe('combine()', () => {
|
||||
it('should return a function', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
var factory = util.combine(inp);
|
||||
const src = [1, 2, 3];
|
||||
const inp = es.readArray(src);
|
||||
const factory = util.combine(inp);
|
||||
factory.should.be.type('function');
|
||||
done();
|
||||
});
|
||||
it('should return a function that returns a stream combination', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
var inp2 = es.writeArray((err: Error, data: any[]) => {
|
||||
const src = [1, 2, 3];
|
||||
const inp = es.readArray(src);
|
||||
const inp2 = es.writeArray((err: Error, data: any[]) => {
|
||||
should.not.exist(err);
|
||||
data.should.eql(src);
|
||||
done();
|
||||
});
|
||||
var factory = util.combine(inp, inp2);
|
||||
const factory = util.combine(inp, inp2);
|
||||
factory().should.be.instanceof(Stream.Readable);
|
||||
});
|
||||
it('should return a function that returns a stream combination when given an array', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
var inp2 = es.writeArray((err: Error, data: any[]) => {
|
||||
const src = [1, 2, 3];
|
||||
const inp = es.readArray(src);
|
||||
const inp2 = es.writeArray((err: Error, data: any[]) => {
|
||||
should.not.exist(err);
|
||||
data.should.eql(src);
|
||||
done();
|
||||
});
|
||||
var factory = util.combine([inp, inp2]);
|
||||
const factory = util.combine([inp, inp2]);
|
||||
factory().should.be.instanceof(Stream.Readable);
|
||||
});
|
||||
});
|
||||
|
||||
describe('buffer()', () => {
|
||||
it('should buffer stuff and return an array into the callback', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
const src = [1, 2, 3];
|
||||
const inp = es.readArray(src);
|
||||
inp.pipe(util.buffer((err: Error, data: any[]) => {
|
||||
should.not.exist(err);
|
||||
should.exist(data);
|
||||
@@ -385,8 +384,8 @@ describe('buffer()', () => {
|
||||
}));
|
||||
});
|
||||
it('should buffer stuff and emit it as a data event', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
const src = [1, 2, 3];
|
||||
const inp = es.readArray(src);
|
||||
inp.pipe(util.buffer()).on('data', (data: any[]) => {
|
||||
should.exist(data);
|
||||
data.should.eql(src);
|
||||
@@ -394,8 +393,8 @@ describe('buffer()', () => {
|
||||
});
|
||||
});
|
||||
it('should buffer stuff and return a stream with the buffered data', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
const src = [1, 2, 3];
|
||||
const inp = es.readArray(src);
|
||||
inp.pipe(util.buffer()).pipe(es.through((data: any[]) => {
|
||||
should.exist(data);
|
||||
data.should.eql(src);
|
||||
@@ -406,35 +405,35 @@ describe('buffer()', () => {
|
||||
|
||||
describe('PluginError()', () => {
|
||||
it('should default name to Error', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
const err = new util.PluginError('test', 'something broke');
|
||||
err.name.should.equal('Error');
|
||||
});
|
||||
|
||||
it('should default name to Error, even when wrapped error has no name', () => {
|
||||
var realErr = { message: 'something broke' };
|
||||
var err = new util.PluginError('test', realErr);
|
||||
const realErr = { message: 'something broke' };
|
||||
const err = new util.PluginError('test', realErr);
|
||||
err.name.should.equal('Error');
|
||||
});
|
||||
|
||||
it('should print the plugin name in toString', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
const err = new util.PluginError('test', 'something broke');
|
||||
err.toString().indexOf('test').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should not include the stack by default in toString', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
const err = new util.PluginError('test', 'something broke');
|
||||
// just check that there are no 'at' lines
|
||||
err.toString().indexOf('at').should.equal(-1);
|
||||
});
|
||||
|
||||
it('should include the stack when specified in toString', () => {
|
||||
var err = new util.PluginError('test', 'something broke', { stack: "at huh", showStack: true });
|
||||
const err = new util.PluginError('test', 'something broke', { stack: "at huh", showStack: true });
|
||||
// just check that there are 'at' lines
|
||||
err.toString().indexOf('at').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should take arguments as one object', () => {
|
||||
var err = new util.PluginError({
|
||||
const err = new util.PluginError({
|
||||
plugin: 'test',
|
||||
message: 'something broke'
|
||||
});
|
||||
@@ -443,7 +442,7 @@ describe('PluginError()', () => {
|
||||
});
|
||||
|
||||
it('should take arguments as plugin name and one object', () => {
|
||||
var err = new util.PluginError('test', {
|
||||
const err = new util.PluginError('test', {
|
||||
message: 'something broke'
|
||||
});
|
||||
err.plugin.should.equal('test');
|
||||
@@ -451,22 +450,22 @@ describe('PluginError()', () => {
|
||||
});
|
||||
|
||||
it('should take arguments as plugin name and message', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
const err = new util.PluginError('test', 'something broke');
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
});
|
||||
|
||||
it('should take arguments as plugin name, message, and one object', () => {
|
||||
var err = new util.PluginError('test', 'something broke', { showStack: true });
|
||||
const err = new util.PluginError('test', 'something broke', { showStack: true });
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
err.showStack.should.equal(true);
|
||||
});
|
||||
|
||||
it('should take arguments as plugin name, error, and one object', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
var err = new util.PluginError('test', realErr, { showStack: true, fileName: 'override.js' });
|
||||
const realErr = new Error('something broke') as Error & { fileName: string };
|
||||
realErr.fileName = 'original.js';
|
||||
const err = new util.PluginError('test', realErr, { showStack: true, fileName: 'override.js' });
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
err.fileName.should.equal('override.js');
|
||||
@@ -474,26 +473,27 @@ describe('PluginError()', () => {
|
||||
});
|
||||
|
||||
it('should take properties from error', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).abstractProperty = 'abstract';
|
||||
var err = new util.PluginError('test', realErr);
|
||||
const realErr = new Error('something broke') as Error & { abstractProperty: string };
|
||||
realErr.abstractProperty = 'abstract';
|
||||
const err = new util.PluginError('test', realErr);
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
(<any>err).abstractProperty.should.equal('abstract');
|
||||
// TODO: use generics to make this work without a cast?
|
||||
(err as util.PluginError & { abstractProperty: string }).abstractProperty.should.equal('abstract');
|
||||
});
|
||||
|
||||
it('should be configured to show properties by default', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
const err = new util.PluginError('test', 'something broke');
|
||||
err.showProperties.should.be.true;
|
||||
});
|
||||
|
||||
it('should not be configured to take option to show properties', () => {
|
||||
var err = new util.PluginError('test', 'something broke', { showProperties: false });
|
||||
const err = new util.PluginError('test', 'something broke', { showProperties: false });
|
||||
err.showProperties.should.be.false;
|
||||
});
|
||||
|
||||
it('should show properties', () => {
|
||||
var err = new util.PluginError('test', 'it broke', { showProperties: true });
|
||||
const err = new util.PluginError('test', 'it broke', { showProperties: true });
|
||||
err.fileName = 'original.js';
|
||||
err.lineNumber = 35;
|
||||
err.toString().indexOf('it broke').should.not.equal(-1);
|
||||
@@ -502,25 +502,25 @@ describe('PluginError()', () => {
|
||||
});
|
||||
|
||||
it('should show properties', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).lineNumber = 35;
|
||||
var err = new util.PluginError('test', realErr, { showProperties: true });
|
||||
const realErr = new Error('something broke') as Error & { fileName: string, lineNumber: number };
|
||||
realErr.fileName = 'original.js';
|
||||
realErr.lineNumber = 35;
|
||||
const err = new util.PluginError('test', realErr, { showProperties: true });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should not show properties', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).lineNumber = 35;
|
||||
var err = new util.PluginError('test', realErr, { showProperties: false });
|
||||
const realErr = new Error('something broke') as Error & { fileName: string, lineNumber: number };
|
||||
realErr.fileName = 'original.js';
|
||||
realErr.lineNumber = 35;
|
||||
const err = new util.PluginError('test', realErr, { showProperties: false });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.equal(-1);
|
||||
});
|
||||
|
||||
it('should not show properties, but should show stack', () => {
|
||||
var err = new util.PluginError('test', 'it broke', { stack: 'test stack', showStack: true, showProperties: false });
|
||||
const err = new util.PluginError('test', 'it broke', { stack: 'test stack', showStack: true, showProperties: false });
|
||||
err.fileName = 'original.js';
|
||||
err.lineNumber = 35;
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
@@ -529,40 +529,40 @@ describe('PluginError()', () => {
|
||||
});
|
||||
|
||||
it('should not show properties, but should show stack for real error', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).lineNumber = 35;
|
||||
(<any>realErr).stack = 'test stack';
|
||||
var err = new util.PluginError('test', realErr, { showStack: true, showProperties: false });
|
||||
const realErr = new Error('something broke') as Error & { fileName: string, lineNumber: number };
|
||||
realErr.fileName = 'original.js';
|
||||
realErr.lineNumber = 35;
|
||||
realErr.stack = 'test stack';
|
||||
const err = new util.PluginError('test', realErr, { showStack: true, showProperties: false });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.equal(-1);
|
||||
err.toString().indexOf('test stack').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should not show properties, but should show stack for _stack', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).lineNumber = 35;
|
||||
(<any>realErr)._stack = 'test stack';
|
||||
var err = new util.PluginError('test', realErr, { showStack: true, showProperties: false });
|
||||
const realErr = new Error('something broke') as Error & { fileName: string, lineNumber: number, _stack: string };
|
||||
realErr.fileName = 'original.js';
|
||||
realErr.lineNumber = 35;
|
||||
realErr._stack = 'test stack';
|
||||
const err = new util.PluginError('test', realErr, { showStack: true, showProperties: false });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.equal(-1);
|
||||
err.toString().indexOf('test stack').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should show properties and stack', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).stack = 'test stack';
|
||||
var err = new util.PluginError('test', realErr, { showStack: true });
|
||||
const realErr = new Error('something broke') as Error & { fileName: string };
|
||||
realErr.fileName = 'original.js';
|
||||
realErr.stack = 'test stack';
|
||||
const err = new util.PluginError('test', realErr, { showStack: true });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.not.equal(-1);
|
||||
err.toString().indexOf('test stack').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should show properties added after the error is created', () => {
|
||||
var realErr = new Error('something broke');
|
||||
var err = new util.PluginError('test', realErr);
|
||||
const realErr = new Error('something broke');
|
||||
const err = new util.PluginError('test', realErr);
|
||||
err.fileName = 'original.js';
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.not.equal(-1);
|
||||
@@ -571,8 +571,8 @@ describe('PluginError()', () => {
|
||||
it('should toString quickly', function(done) {
|
||||
this.timeout(100);
|
||||
|
||||
var err = new util.PluginError('test', 'it broke', { showStack: true });
|
||||
var str = err.toString();
|
||||
const err = new util.PluginError('test', 'it broke', { showStack: true });
|
||||
const str = err.toString();
|
||||
|
||||
done();
|
||||
});
|
||||
@@ -580,15 +580,15 @@ describe('PluginError()', () => {
|
||||
it('should toString quickly with original error', function(done) {
|
||||
this.timeout(100);
|
||||
|
||||
var realErr = new Error('it broke');
|
||||
var err = new util.PluginError('test', realErr, { showStack: true });
|
||||
var str = err.toString();
|
||||
const realErr = new Error('it broke');
|
||||
const err = new util.PluginError('test', realErr, { showStack: true });
|
||||
const str = err.toString();
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should not show "Details:" if there are no properties to show', () => {
|
||||
var err = new util.PluginError('plugin', 'message');
|
||||
const err = new util.PluginError('plugin', 'message');
|
||||
err.toString().indexOf('Details:').should.equal(-1);
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+51
-55
@@ -1,53 +1,50 @@
|
||||
// Type definitions for gulp-util v3.0.x
|
||||
// Type definitions for gulp-util 3.0
|
||||
// Project: https://github.com/gulpjs/gulp-util
|
||||
// Definitions by: jedmao <https://github.com/jedmao>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference types="chalk" />
|
||||
/// <reference types="vinyl" />
|
||||
|
||||
import vinyl = require('vinyl');
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import through2 = require('through2');
|
||||
|
||||
export { vinyl as File };
|
||||
|
||||
/**
|
||||
* Replaces a file extension in a path. Returns the new path.
|
||||
*/
|
||||
* Replaces a file extension in a path. Returns the new path.
|
||||
*/
|
||||
export function replaceExtension(npath: string, ext: string): string;
|
||||
|
||||
export var colors: typeof chalk;
|
||||
export const colors: typeof chalk;
|
||||
|
||||
export var date: {
|
||||
(now?: Date, mask?: string, convertLocalTimeToUTC?: boolean): any;
|
||||
(date?: string, mask?: string, convertLocalTimeToUTC?: boolean): any;
|
||||
export const date: {
|
||||
(now?: Date | string, mask?: string, convertLocalTimeToUTC?: boolean): any;
|
||||
masks: any;
|
||||
};
|
||||
|
||||
/**
|
||||
* Logs stuff. Already prefixed with [gulp] and all that. Use the right colors
|
||||
* for values. If you pass in multiple arguments it will join them by a space.
|
||||
*/
|
||||
* Logs stuff. Already prefixed with [gulp] and all that. Use the right colors
|
||||
* for values. If you pass in multiple arguments it will join them by a space.
|
||||
*/
|
||||
export function log(message?: any, ...optionalParams: any[]): void;
|
||||
|
||||
/**
|
||||
* This is a lodash.template function wrapper. You must pass in a valid gulp
|
||||
* file object so it is available to the user or it will error. You can not
|
||||
* configure any of the delimiters. Look at the lodash docs for more info.
|
||||
*/
|
||||
* This is a lodash.template function wrapper. You must pass in a valid gulp
|
||||
* file object so it is available to the user or it will error. You can not
|
||||
* configure any of the delimiters. Look at the lodash docs for more info.
|
||||
*/
|
||||
export function template(tmpl: string): (opt: { file: { path: string } }) => string;
|
||||
export function template(tmpl: string, opt: { file: { path: string } }): string;
|
||||
|
||||
export var env: any;
|
||||
export const env: any;
|
||||
|
||||
export function beep(): void;
|
||||
|
||||
/**
|
||||
* Returns a stream that does nothing but pass data straight through.
|
||||
*/
|
||||
export var noop: typeof through2;
|
||||
* Returns a stream that does nothing but pass data straight through.
|
||||
*/
|
||||
export const noop: typeof through2;
|
||||
|
||||
export function isStream(obj: any): boolean;
|
||||
|
||||
@@ -55,47 +52,46 @@ export function isBuffer(obj: any): boolean;
|
||||
|
||||
export function isNull(obj: any): boolean;
|
||||
|
||||
export var linefeed: string;
|
||||
export const linefeed: string;
|
||||
|
||||
export function combine(streams: NodeJS.ReadWriteStream[]): () => NodeJS.ReadWriteStream;
|
||||
export function combine(...streams: NodeJS.ReadWriteStream[]): () => NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* This is similar to es.wait but instead of buffering text into one string
|
||||
* it buffers anything into an array (so very useful for file objects).
|
||||
*/
|
||||
* This is similar to es.wait but instead of buffering text into one string
|
||||
* it buffers anything into an array (so very useful for file objects).
|
||||
*/
|
||||
export function buffer(cb?: (err: Error, data: any[]) => void): NodeJS.ReadWriteStream;
|
||||
|
||||
export class PluginError implements Error, PluginErrorOptions {
|
||||
constructor(options?: PluginErrorOptions);
|
||||
constructor(pluginName: string, options?: PluginErrorOptions);
|
||||
constructor(pluginName: string, message: string, options?: PluginErrorOptions);
|
||||
constructor(pluginName: string, message: Error, options?: PluginErrorOptions);
|
||||
constructor(pluginName: string, message: string | Error, options?: PluginErrorOptions);
|
||||
/**
|
||||
* The module name of your plugin.
|
||||
*/
|
||||
* The module name of your plugin.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Can be a string or an existing error.
|
||||
*/
|
||||
* Can be a string or an existing error.
|
||||
*/
|
||||
message: any;
|
||||
fileName: string;
|
||||
lineNumber: number;
|
||||
/**
|
||||
* You need to include the message along with this stack. If you pass an
|
||||
* error in as the message the stack will be pulled from that, otherwise one
|
||||
* will be created.
|
||||
*/
|
||||
* You need to include the message along with this stack. If you pass an
|
||||
* error in as the message the stack will be pulled from that, otherwise one
|
||||
* will be created.
|
||||
*/
|
||||
stack: string;
|
||||
/**
|
||||
* By default the stack will not be shown. Set this to true if you think the
|
||||
* stack is important for your error.
|
||||
*/
|
||||
* By default the stack will not be shown. Set this to true if you think the
|
||||
* stack is important for your error.
|
||||
*/
|
||||
showStack: boolean;
|
||||
/**
|
||||
* Error properties will be included in err.toString(). Can be omitted by
|
||||
* setting this to false.
|
||||
*/
|
||||
* Error properties will be included in err.toString(). Can be omitted by
|
||||
* setting this to false.
|
||||
*/
|
||||
showProperties: boolean;
|
||||
plugin: string;
|
||||
error: Error;
|
||||
@@ -103,30 +99,30 @@ export class PluginError implements Error, PluginErrorOptions {
|
||||
|
||||
export interface PluginErrorOptions {
|
||||
/**
|
||||
* The module name of your plugin.
|
||||
*/
|
||||
* The module name of your plugin.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Can be a string or an existing error.
|
||||
*/
|
||||
* Can be a string or an existing error.
|
||||
*/
|
||||
message?: any;
|
||||
fileName?: string;
|
||||
lineNumber?: number;
|
||||
/**
|
||||
* You need to include the message along with this stack. If you pass an
|
||||
* error in as the message the stack will be pulled from that, otherwise one
|
||||
* will be created.
|
||||
*/
|
||||
* You need to include the message along with this stack. If you pass an
|
||||
* error in as the message the stack will be pulled from that, otherwise one
|
||||
* will be created.
|
||||
*/
|
||||
stack?: string;
|
||||
/**
|
||||
* By default the stack will not be shown. Set this to true if you think the
|
||||
* stack is important for your error.
|
||||
*/
|
||||
* By default the stack will not be shown. Set this to true if you think the
|
||||
* stack is important for your error.
|
||||
*/
|
||||
showStack?: boolean;
|
||||
/**
|
||||
* Error properties will be included in err.toString(). Can be omitted by
|
||||
* setting this to false.
|
||||
*/
|
||||
* Error properties will be included in err.toString(). Can be omitted by
|
||||
* setting this to false.
|
||||
*/
|
||||
showProperties?: boolean;
|
||||
plugin?: string;
|
||||
error?: Error;
|
||||
|
||||
@@ -1,80 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-invalid-template-strings": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"comment-format": false, // TODO
|
||||
"no-reference-import": false, // TODO: fix "should"
|
||||
"no-var-requires": false // TODO
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// FindQ <https://github.com/FindQ>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
declare namespace i18n {
|
||||
interface ConfigurationOptions {
|
||||
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for jest-json-schema 1.2
|
||||
// Project: https://github.com/americanexpress/jest-json-schema#readme
|
||||
// Definitions by: Igor Korolev <https://github.com/deadNightTiger>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jest" />
|
||||
import * as ajv from "ajv";
|
||||
|
||||
declare global {
|
||||
namespace jest {
|
||||
interface Matchers<R> {
|
||||
toMatchSchema(schema: object): R;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const matchers: jest.ExpectExtendMap;
|
||||
export function matchersWithOptions(options: ajv.Options): jest.ExpectExtendMap;
|
||||
@@ -0,0 +1,13 @@
|
||||
import { matchers } from 'jest-json-schema';
|
||||
|
||||
expect.extend(matchers);
|
||||
|
||||
it('validates my json', () => {
|
||||
const schema = {
|
||||
properties: {
|
||||
hello: { type: 'string' },
|
||||
},
|
||||
required: ['hello'],
|
||||
};
|
||||
expect({ hello: 'world' }).toMatchSchema(schema);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"ajv": "^4.11.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jest-json-schema-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for klaw v1.3.0
|
||||
// Type definitions for klaw v2.1.0
|
||||
// Project: https://github.com/jprichardson/node-klaw
|
||||
// Definitions by: Matthew McEachen <https://github.com/mceachen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -25,6 +25,7 @@ declare module "klaw" {
|
||||
pathSorter?: (pathA: string, pathB: string) => number
|
||||
fs?: any // fs or mock-fs
|
||||
filter?: (path: string) => boolean
|
||||
depthLimit?: number
|
||||
}
|
||||
|
||||
type Event = "close" | "data" | "end" | "readable" | "error"
|
||||
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for klaw v1.3.0
|
||||
// Project: https://github.com/jprichardson/node-klaw
|
||||
// Definitions by: Matthew McEachen <https://github.com/mceachen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare module "klaw" {
|
||||
|
||||
import * as fs from "fs"
|
||||
import { Readable, ReadableOptions } from 'stream'
|
||||
|
||||
function K(root: string, options?: K.Options): K.Walker
|
||||
|
||||
namespace K {
|
||||
interface Item {
|
||||
path: string
|
||||
stats: fs.Stats
|
||||
}
|
||||
|
||||
type QueueMethod = "shift" | "pop"
|
||||
|
||||
interface Options extends ReadableOptions {
|
||||
queueMethod?: QueueMethod
|
||||
pathSorter?: (pathA: string, pathB: string) => number
|
||||
fs?: any // fs or mock-fs
|
||||
filter?: (path: string) => boolean
|
||||
}
|
||||
|
||||
type Event = "close" | "data" | "end" | "readable" | "error"
|
||||
|
||||
interface Walker {
|
||||
on(event: Event, listener: Function): this
|
||||
on(event: "close", listener: () => void): this
|
||||
on(event: "data", listener: (item: Item) => void): this
|
||||
on(event: "end", listener: () => void): this
|
||||
on(event: "readable", listener: () => void): this
|
||||
on(event: "error", listener: (err: Error) => void): this
|
||||
read(): Item
|
||||
}
|
||||
}
|
||||
|
||||
export = K
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import * as klaw from "klaw";
|
||||
const path = require('path');
|
||||
|
||||
// README.md: Streams 1 (push) example:
|
||||
|
||||
let items: klaw.Item[] = [] // files, directories, symlinks, etc
|
||||
|
||||
klaw('/some/dir')
|
||||
.on('data', function(item: klaw.Item) {
|
||||
items.push(item)
|
||||
})
|
||||
.on('end', function() {
|
||||
console.dir(items) // => [ ... array of files]
|
||||
})
|
||||
|
||||
// README.md: Streams 2 & 3 (pull) with error handling
|
||||
|
||||
klaw('/some/dir')
|
||||
.on('readable', function() {
|
||||
let item: klaw.Item;
|
||||
while (item = this.read()) {
|
||||
items.push(item)
|
||||
}
|
||||
})
|
||||
.on('error', function(err: Error, item: klaw.Item) {
|
||||
console.log(err.message)
|
||||
console.log(item.path) // the file the error occurred on
|
||||
})
|
||||
.on('end', function() {
|
||||
console.log(items) // => [ ... array of files]
|
||||
})
|
||||
|
||||
// README.md: Example (ignore hidden directories):
|
||||
|
||||
var filterFunc = function(item: string): boolean {
|
||||
var basename = path.basename(item);
|
||||
return basename === '.' || basename[0] !== '.'
|
||||
}
|
||||
|
||||
klaw('/some/dir', { filter: filterFunc })
|
||||
.on('data', function(item: klaw.Item) {
|
||||
// only items of none hidden folders will reach here
|
||||
})
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"paths": {
|
||||
"klaw": [
|
||||
"klaw/v1"
|
||||
]
|
||||
},
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"klaw-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/koa-modules/morgan
|
||||
// Definitions by: Vesa Poikajärvi <https://github.com/vesse>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
import * as Koa from 'koa';
|
||||
|
||||
Vendored
+4
-2
@@ -70,9 +70,10 @@ export interface LolexClock<TTimerId extends TimerId> {
|
||||
*
|
||||
* @param callback Callback to be fired.
|
||||
* @param timeout How many ticks to wait to run the callback.
|
||||
* @param args Any extra arguments to pass to the callback.
|
||||
* @returns Time identifier for cancellation.
|
||||
*/
|
||||
setTimeout(callback: () => any, timeout: number): TTimerId;
|
||||
setTimeout(callback: () => any, timeout: number, ...args: any[]): TTimerId;
|
||||
|
||||
/**
|
||||
* Clears a timer, as long as it was created using setTimeout.
|
||||
@@ -86,9 +87,10 @@ export interface LolexClock<TTimerId extends TimerId> {
|
||||
*
|
||||
* @param callback Callback to be fired.
|
||||
* @param timeout How many ticks to wait between callbacks.
|
||||
* @param args Any extra arguments to pass to the callback.
|
||||
* @returns Time identifier for cancellation.
|
||||
*/
|
||||
setInterval(callback: () => any, timeout: number): TTimerId;
|
||||
setInterval(callback: () => any, timeout: number, ...args: any[]): TTimerId;
|
||||
|
||||
/**
|
||||
* Clears a timer, as long as it was created using setInterval.
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for microsoftteams 1.1
|
||||
// Type definitions for microsoftteams 1.2
|
||||
// Project: https://github.com/OfficeDev/microsoft-teams-library-js
|
||||
// Definitions by: Bhargav Krishna <https://github.com/WrathOfZombies>
|
||||
// Jay Ongg <https://github.com/jayongg>
|
||||
|
||||
Vendored
+3
@@ -27,6 +27,9 @@ interface MochaSetupOptions {
|
||||
|
||||
// grep string or regexp to filter tests with
|
||||
grep?: any;
|
||||
|
||||
// require modules before running tests
|
||||
require?: string[];
|
||||
}
|
||||
|
||||
declare var mocha: Mocha;
|
||||
|
||||
@@ -339,6 +339,10 @@ function test_setup_reporter_string_option() {
|
||||
mocha.setup({ reporter: 'html' });
|
||||
}
|
||||
|
||||
function test_setup_require_stringArray_option() {
|
||||
mocha.setup({ require: ['ts-node/register'] });
|
||||
}
|
||||
|
||||
function test_setup_reporter_function_option() {
|
||||
mocha.setup({ reporter: class { } });
|
||||
}
|
||||
@@ -372,7 +376,8 @@ function test_setup_all_options() {
|
||||
reporter: 'html',
|
||||
bail: true,
|
||||
ignoreLeaks: true,
|
||||
grep: 'test'
|
||||
grep: 'test',
|
||||
require: ['ts-node/register']
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
// Type definitions for mongoose-geojson-schema 2.1
|
||||
// Project: https://github.com/rideamigoscorp/mongoose-geojson-schema#readme
|
||||
// Definitions by: Bond <https://github.com/bondz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import mongoose = require('mongoose');
|
||||
|
||||
declare module 'mongoose' {
|
||||
namespace Schema {
|
||||
namespace Types {
|
||||
class GeoJSON extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'GeoJSON';
|
||||
}
|
||||
|
||||
class Point extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'Point';
|
||||
}
|
||||
|
||||
class MultiPoint extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'MultiPoint';
|
||||
}
|
||||
|
||||
class LineString extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'LineString';
|
||||
}
|
||||
|
||||
class MultiLineString extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'MultiLineString';
|
||||
}
|
||||
|
||||
class Polygon extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'Polygon';
|
||||
}
|
||||
|
||||
class MultiPolygon extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'MultiPolygon';
|
||||
}
|
||||
|
||||
class Geometry extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'Geometry';
|
||||
}
|
||||
|
||||
class GeometryCollection extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'GeometryCollection';
|
||||
}
|
||||
|
||||
class Feature extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'Feature';
|
||||
}
|
||||
|
||||
class FeatureCollection extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'FeatureCollection';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
import * as mongoose from 'mongoose';
|
||||
import * as mongooseGeoJSONSchema from 'mongoose-geojson-schema';
|
||||
|
||||
const TestSchema = new mongoose.Schema(
|
||||
{
|
||||
title: String,
|
||||
test: {},
|
||||
point: mongoose.Schema.Types.Point,
|
||||
multipoint: mongoose.Schema.Types.MultiPoint,
|
||||
linestring: mongoose.Schema.Types.LineString,
|
||||
multilinestring: mongoose.Schema.Types.MultiLineString,
|
||||
polygon: mongoose.Schema.Types.Polygon,
|
||||
multipolygon: mongoose.Schema.Types.MultiPolygon,
|
||||
geometry: mongoose.Schema.Types.Geometry,
|
||||
geometrycollection: mongoose.Schema.Types.GeometryCollection,
|
||||
feature: mongoose.Schema.Types.Feature,
|
||||
featurecollection: mongoose.Schema.Types.FeatureCollection,
|
||||
},
|
||||
{ typeKey: '$type', collection: 'echoes' }
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mongoose-geojson-schema-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Paolo Scanferla <https://github.com/pscanf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import express = require('express');
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
// Michael Ledin <https://github.com/mxl>
|
||||
// HyunSeob Lee <https://github.com/hyunseob>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as express from 'express';
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Robbie Van Gorkom <https://github.com/vangorra>,
|
||||
// Charles Irick <https://github.com/cirick>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import { Request, RequestHandler } from "express";
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/apollostack/optics-agent-js#readme
|
||||
// Definitions by: Crevil <https://github.com/crevil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import { GraphQLSchema } from "graphql";
|
||||
import { Request, Response } from "express";
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/jaredhanson/passport-oauth2#readme
|
||||
// Definitions by: Pasi Eronen <https://github.com/pasieronen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Request } from 'express';
|
||||
import { Strategy } from 'passport';
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/bergie/passport-saml
|
||||
// Definitions by: Chris Barth <https://github.com/cjbarth>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
Vendored
+5
@@ -3299,6 +3299,11 @@ interface ImagePropertiesAndroid {
|
||||
* It should also be used if the image is slightly bigger than the view.
|
||||
*/
|
||||
resizeMethod?: 'auto' | 'resize' | 'scale'
|
||||
|
||||
/**
|
||||
* Duration of fade in animation.
|
||||
*/
|
||||
fadeDuration?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+5
-4
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/faceyspacey/redux-first-router#readme
|
||||
// Definitions by: Valbrand <https://github.com/Valbrand>
|
||||
// viggyfresh <https://github.com/viggyfresh>
|
||||
// janb87 <https://github.com/janb87>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -113,8 +114,8 @@ export interface Meta {
|
||||
|
||||
export interface Action {
|
||||
type: string;
|
||||
payload: Payload;
|
||||
meta: Meta;
|
||||
payload?: Payload;
|
||||
meta?: Meta;
|
||||
query?: object;
|
||||
navKey?: Nullable<string>;
|
||||
}
|
||||
@@ -193,9 +194,9 @@ export type Payload = object;
|
||||
|
||||
export type ScrollUpdater = (performedByUser: boolean) => void;
|
||||
|
||||
export const NOT_FOUND: string;
|
||||
export const NOT_FOUND: '@@redux-first-router/NOT_FOUND';
|
||||
|
||||
export function actionToPath(action: ReceivedAction, routesMap: RoutesMap): string;
|
||||
export function actionToPath(action: ReceivedAction, routesMap: RoutesMap, querySerializer?: QuerySerializer): string;
|
||||
|
||||
export function back(): void;
|
||||
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
import { connectRoutes, LocationState, RoutesMap } from 'redux-first-router';
|
||||
import {
|
||||
connectRoutes,
|
||||
LocationState,
|
||||
RoutesMap,
|
||||
actionToPath,
|
||||
ReceivedAction,
|
||||
redirect,
|
||||
Action as ReduxFirstRouterAction,
|
||||
QuerySerializer
|
||||
} from 'redux-first-router';
|
||||
import {
|
||||
createStore,
|
||||
applyMiddleware,
|
||||
@@ -40,5 +49,22 @@ const storeEnhancer = compose<StoreCreator, StoreCreator, StoreCreator>(enhancer
|
||||
|
||||
const store = createStore(reducer, storeEnhancer);
|
||||
|
||||
const receivedAction: ReceivedAction = {
|
||||
type: 'HOME',
|
||||
payload: {}
|
||||
};
|
||||
actionToPath(receivedAction, routesMap); // $ExpectType string
|
||||
|
||||
const querySerializer: QuerySerializer = {
|
||||
stringify: (params) => '',
|
||||
parse: (queryString) => ({})
|
||||
};
|
||||
actionToPath(receivedAction, routesMap, querySerializer); // $ExpectType string
|
||||
|
||||
const action: ReduxFirstRouterAction = {
|
||||
type: 'HOME'
|
||||
};
|
||||
redirect(action); // $ExpectType Action
|
||||
|
||||
// $ExpectType Store<LocationState>
|
||||
store;
|
||||
|
||||
Vendored
+12
-4
@@ -244,6 +244,14 @@ declare namespace Selectize {
|
||||
*/
|
||||
searchConjunction?: string;
|
||||
|
||||
/**
|
||||
* If truthy, Selectize will make all optgroups be in the same order as they were added (by the `$order`
|
||||
* property). Otherwise, it will order based on the score of the results in each.
|
||||
*
|
||||
* Default: false
|
||||
*/
|
||||
lockOptgroupOrder?: boolean;
|
||||
|
||||
/**
|
||||
* An array of optgroup values that indicates the order they should be listed in in the dropdown.
|
||||
* If not provided, groups will be ordered by the ranking of the options within them.
|
||||
@@ -426,7 +434,7 @@ declare namespace Selectize {
|
||||
/**
|
||||
* Resets / clears all selected items from the control.
|
||||
*/
|
||||
clear(): void;
|
||||
clear(silent?: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns the jQuery element of the item matching the given value.
|
||||
@@ -436,18 +444,18 @@ declare namespace Selectize {
|
||||
/**
|
||||
* "Selects" an item. Adds it to the list at the current caret position.
|
||||
*/
|
||||
addItem(value: T): void;
|
||||
addItem(value: T, silent?: boolean): void;
|
||||
|
||||
/**
|
||||
* Removes the selected item matching the provided value.
|
||||
*/
|
||||
removeItem(value: T): void;
|
||||
removeItem(value: T, silent?: boolean): void;
|
||||
|
||||
/**
|
||||
* Invokes the "create" method provided in the selectize options that should provide the data for the
|
||||
* new item, given the user input. Once this completes, it will be added to the item list.
|
||||
*/
|
||||
createItem(value: T): void;
|
||||
createItem(value: T, triggerDropdown?: boolean, callback?: (data?: any) => void): void;
|
||||
|
||||
/**
|
||||
* Re-renders the selected item lists.
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://www.npmjs.com/package/swagger-node-runner
|
||||
// Definitions by: Michael Mrowetz <https://github.com/micmro>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -42,7 +42,7 @@ export declare function splitTags(text: string): string[];
|
||||
export declare function extractHashtags(text: string): string[];
|
||||
export declare function extractHashtagsWithIndices(text: string): HashtagWithIndices[];
|
||||
export declare function extractUrls(text: string): string[];
|
||||
export declare function extractUrlsWithIndices(text: string): UrlWithIndices[];
|
||||
export declare function extractUrlsWithIndices(text: string, options?: {extractUrlsWithoutProtocol: boolean}): UrlWithIndices[];
|
||||
export declare function extractMentions(text: string): string[];
|
||||
export declare function extractMentionsWithIndices(text: string): MentionWithIndices[];
|
||||
export declare function extractMentionsOrListsWithIndices(text: string): MentionOrListWithIndices[];
|
||||
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// Type definitions for url-metadata 2.1
|
||||
// Project: https://github.com/LevelNewsOrg/url-metadata
|
||||
// Definitions by: Kevin Gravier <https://github.com/mrkmg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = urlMetadata;
|
||||
|
||||
declare function urlMetadata(url: string, options?: urlMetadata.Options): Promise<urlMetadata.Result>;
|
||||
|
||||
declare namespace urlMetadata {
|
||||
interface Options {
|
||||
userAgent?: string;
|
||||
fromEmail?: string;
|
||||
maxRedirects?: number;
|
||||
timeout?: number;
|
||||
descriptionLength?: number;
|
||||
ensureSecureImageRequest?: boolean;
|
||||
sourceMap?: { [key: string]: string };
|
||||
encode?: () => void;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
"url": string;
|
||||
"canonical": string;
|
||||
"title": string;
|
||||
"image": string;
|
||||
"author": string;
|
||||
"description": string;
|
||||
"keywords": string;
|
||||
"source": string;
|
||||
"og:url": string;
|
||||
"og:locale": string;
|
||||
"og:locale:alternate": string;
|
||||
"og:title": string;
|
||||
"og:type": string;
|
||||
"og:description": string;
|
||||
"og:determiner": string;
|
||||
"og:site_name": string;
|
||||
"og:image": string;
|
||||
"og:image:secure_url": string;
|
||||
"og:image:type": string;
|
||||
"og:image:width": string;
|
||||
"og:image:height": string;
|
||||
"article:published_time"?: string;
|
||||
"article:modified_time"?: string;
|
||||
"article:expiration_time"?: string;
|
||||
"article:author"?: string;
|
||||
"article:section"?: string;
|
||||
"article:tag"?: string;
|
||||
"og:article:published_time"?: string;
|
||||
"og:article:modified_time"?: string;
|
||||
"og:article:expiration_time"?: string;
|
||||
"og:article:author"?: string;
|
||||
"og:article:section"?: string;
|
||||
"og:article:tag"?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"url-metadata-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as urlMetadata from "url-metadata";
|
||||
|
||||
const opts: urlMetadata.Options = {
|
||||
userAgent: "url-metadata-test",
|
||||
fromEmail: "testing@url-metadata.com",
|
||||
maxRedirects: 3,
|
||||
timeout: 10000,
|
||||
descriptionLength: 10000,
|
||||
ensureSecureImageRequest: true
|
||||
};
|
||||
const url = "https://google.com";
|
||||
|
||||
urlMetadata(url, opts).then((result: urlMetadata.Result) => {
|
||||
result; // $ExpectType Result
|
||||
});
|
||||
Vendored
+75
-359
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user