diff --git a/.gitignore b/.gitignore index 062afeb3b..75442c223 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules out .omnisharp-*/ .debugger +.vscode-test install.* diff --git a/.travis.yml b/.travis.yml index 20181ae17..c3a4ce12c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,21 @@ language: node_js node_js: -- "5.1" +- "6" -env: - - CXX=g++-4.8 +before_install: + - if [ $TRAVIS_OS_NAME == "linux" ]; then + export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0; + sh -e /etc/init.d/xvfb start; + sleep 3; + fi addons: apt: sources: - ubuntu-toolchain-r-test packages: - - g++-4.8 + - g++-4.9 install: - npm install @@ -19,6 +23,10 @@ install: - npm install -g vsce - vsce package +script: + - npm test --silent + - npm run test-syntax + deploy: provider: releases api_key: diff --git a/package.json b/package.json index 9bd20ee80..38e7d2575 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,11 @@ ], "main": "./out/src/main", "scripts": { - "compile": "node ./node_modules/vscode/bin/compile -p ./ && gulp tslint", - "watch": "node ./node_modules/vscode/bin/compile -watch -p ./", - "test": "mocha --timeout 15000 -u tdd ./out/test/*.tests.js ./out/test/**/*.tests.js", + "vscode:prepublish": "tsc -p ./", + "compile": "tsc -p ./ && gulp tslint", + "watch": "tsc -watch -p ./", + "test": "node ./node_modules/vscode/bin/test", + "test-syntax": "mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js", "postinstall": "node ./node_modules/vscode/bin/install" }, "dependencies": { @@ -38,17 +40,24 @@ "yauzl": "^2.5.0" }, "devDependencies": { + "@types/chai": "^3.4.34", + "@types/fs-extra-promise": "0.0.30", + "@types/mkdirp": "^0.3.29", + "@types/mocha": "^2.2.32", + "@types/node": "^6.0.40", + "@types/semver": "^5.3.30", + "@types/tmp": "0.0.32", + "chai": "^3.5.0", "del": "^2.0.2", "gulp": "^3.9.1", "gulp-mocha": "^2.1.3", "gulp-tslint": "^4.3.0", - "mocha": "^2.2.5", + "mocha": "^2.3.3", "tslint": "^3.15.1", "tslint-microsoft-contrib": "^2.0.12", "typescript": "^2.0.3", - "vscode": "^0.11.13", "vsce": "^1.7.0", - "chai": "^3.5.0", + "vscode": "^1.0.0", "vscode-textmate": "^2.1.1" }, "runtimeDependencies": [ @@ -288,7 +297,7 @@ } ], "engines": { - "vscode": "^1.3.0" + "vscode": "^1.5.0" }, "activationEvents": [ "onLanguage:csharp", @@ -1126,4 +1135,4 @@ } ] } -} \ No newline at end of file +} diff --git a/src/coreclr-debug/util.ts b/src/coreclr-debug/util.ts index 60585f470..1c14d0b00 100644 --- a/src/coreclr-debug/util.ts +++ b/src/coreclr-debug/util.ts @@ -138,7 +138,7 @@ export class CoreClrDebugUtil public static existsSync(path: string) : boolean { try { - fs.accessSync(path, fs.F_OK); + fs.accessSync(path, fs.constants.F_OK); return true; } catch (err) { if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { diff --git a/src/features/commands.ts b/src/features/commands.ts index fc228edce..3c239446b 100644 --- a/src/features/commands.ts +++ b/src/features/commands.ts @@ -9,7 +9,7 @@ import {OmniSharpServer} from '../omnisharp/server'; import * as serverUtils from '../omnisharp/utils'; import {findLaunchTargets} from '../omnisharp/launcher'; import * as cp from 'child_process'; -import * as fs from 'fs-extra-promise'; +import * as fs from 'fs'; import * as path from 'path'; import * as protocol from '../omnisharp/protocol'; import * as vscode from 'vscode'; @@ -87,18 +87,24 @@ function projectsToCommands(projects: protocol.DotNetProject[]): Promise { let projectDirectory = project.Path; - return fs.lstatAsync(projectDirectory).then(stats => { - if (stats.isFile()) { - projectDirectory = path.dirname(projectDirectory); - } + return new Promise((resolve, reject) => { + fs.lstat(projectDirectory, (err, stats) => { + if (err) { + return reject(err); + } - return { - label: `dotnet restore - (${project.Name || path.basename(project.Path)})`, - description: projectDirectory, - execute() { - return dotnetRestore(projectDirectory); + if (stats.isFile()) { + projectDirectory = path.dirname(projectDirectory); } - }; + + resolve({ + label: `dotnet restore - (${project.Name || path.basename(project.Path)})`, + description: projectDirectory, + execute() { + return dotnetRestore(projectDirectory); + } + }); + }); }); }); } diff --git a/src/packages.ts b/src/packages.ts index dff6a3dc6..b899d3051 100644 --- a/src/packages.ts +++ b/src/packages.ts @@ -5,7 +5,7 @@ import * as fs from 'fs'; import * as https from 'https'; -import { mkdirp } from 'mkdirp'; +import * as mkdirp from 'mkdirp'; import * as path from 'path'; import * as tmp from 'tmp'; import { parse as parseUrl } from 'url'; @@ -226,15 +226,15 @@ function downloadFile(urlString: string, pkg: Package, logger: Logger, status: S }); response.on('error', err => { - reject(new PackageError(`Reponse error: ${err.code || 'NONE'}`, pkg, err)); + reject(new PackageError(`Reponse error: ${err.message || 'NONE'}`, pkg, err)); }); // Begin piping data from the response to the package file response.pipe(tmpFile, { end: false }); }); - request.on('error', error => { - reject(new PackageError(`Request error: ${error.code || 'NONE'}`, pkg, error)); + request.on('error', err => { + reject(new PackageError(`Request error: ${err.message || 'NONE'}`, pkg, err)); }); // Execute the request diff --git a/src/platform.ts b/src/platform.ts index daee02a75..3720cfd05 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -160,7 +160,7 @@ export class PlatformInformation { throw new Error(`Unsupported platform: ${platform}`); } - return Promise.all([architecturePromise, distributionPromise]) + return Promise.all([architecturePromise, distributionPromise]) .then(([arch, distro]) => { return new PlatformInformation(platform, arch, distro); }); diff --git a/test/common.tests.ts b/test/common.test.ts similarity index 96% rename from test/common.tests.ts rename to test/common.test.ts index 8c604841f..ed2275e62 100644 --- a/test/common.tests.ts +++ b/test/common.test.ts @@ -7,7 +7,7 @@ import { should } from 'chai'; import { buildPromiseChain } from '../src/common'; suite("Common", () => { - before(() => should); + suiteSetup(() => should()); test("buildPromiseChain produces a sequence of promises", () => { let array: number[] = []; diff --git a/test/platform.tests.ts b/test/platform.test.ts similarity index 99% rename from test/platform.tests.ts rename to test/platform.test.ts index 660d29ebf..fe815c667 100644 --- a/test/platform.tests.ts +++ b/test/platform.test.ts @@ -7,7 +7,7 @@ import { should } from 'chai'; import { LinuxDistribution, PlatformInformation } from '../src/platform'; suite("Platform", () => { - before(() => should()); + suiteSetup(() => should()); test("Retrieve correct information for Ubuntu 14.04", () => { const dist = distro_ubuntu_14_04(); diff --git a/test/sanity.tests.ts b/test/sanity.test.ts similarity index 100% rename from test/sanity.tests.ts rename to test/sanity.test.ts diff --git a/test/syntaxes/class.tests.ts b/test/syntaxes/class.test.syntax.ts similarity index 97% rename from test/syntaxes/class.tests.ts rename to test/syntaxes/class.test.syntax.ts index cd95f9dd9..57bf66cfe 100644 --- a/test/syntaxes/class.tests.ts +++ b/test/syntaxes/class.test.syntax.ts @@ -1,169 +1,169 @@ -import { should } from 'chai'; -import { Tokens, Token } from './utils/tokenizer'; -import { TokenizerUtil } from'./utils/tokenizerUtil'; - -describe("Grammar", function() { - before(function() { - should(); - }); - - describe("Class", function() { - it("class keyword and storage modifiers", function() { - -const input = ` -namespace TestNamespace -{ - public class PublicClass { } - - class DefaultClass { } - - internal class InternalClass { } - - static class DefaultStaticClass { } - - public static class PublicStaticClass { } - - sealed class DefaultSealedClass { } - - public sealed class PublicSealedClass { } - - public abstract class PublicAbstractClass { } - - abstract class DefaultAbstractClass { } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.ClassKeyword("class", 4, 24)); - tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 4, 30)); - - tokens.should.contain(Tokens.ClassKeyword("class", 6, 24)); - tokens.should.contain(Tokens.ClassIdentifier("DefaultClass", 6, 30)); - - tokens.should.contain(Tokens.StorageModifierKeyword("internal", 8, 5)); - tokens.should.contain(Tokens.ClassKeyword("class", 8, 24)); - tokens.should.contain(Tokens.ClassIdentifier("InternalClass", 8, 30)); - - tokens.should.contain(Tokens.StorageModifierKeyword("static", 10, 15)); - tokens.should.contain(Tokens.ClassKeyword("class", 10, 24)); - tokens.should.contain(Tokens.ClassIdentifier("DefaultStaticClass", 10, 30)); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 12, 5)); - tokens.should.contain(Tokens.StorageModifierKeyword("static", 12, 15)); - tokens.should.contain(Tokens.ClassKeyword("class", 12, 24)); - tokens.should.contain(Tokens.ClassIdentifier("PublicStaticClass", 12, 30)); - - tokens.should.contain(Tokens.StorageModifierKeyword("sealed", 14, 15)); - tokens.should.contain(Tokens.ClassKeyword("class", 14, 24)); - tokens.should.contain(Tokens.ClassIdentifier("DefaultSealedClass", 14, 30)); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 16, 5)); - tokens.should.contain(Tokens.StorageModifierKeyword("sealed", 16, 15)); - tokens.should.contain(Tokens.ClassKeyword("class", 16, 24)); - tokens.should.contain(Tokens.ClassIdentifier("PublicSealedClass", 16, 30)); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 18, 5)); - tokens.should.contain(Tokens.StorageModifierKeyword("abstract", 18, 15)); - tokens.should.contain(Tokens.ClassKeyword("class", 18, 24)); - tokens.should.contain(Tokens.ClassIdentifier("PublicAbstractClass", 18, 30)); - - tokens.should.contain(Tokens.StorageModifierKeyword("abstract", 20, 15)); - tokens.should.contain(Tokens.ClassKeyword("class", 20, 24)); - tokens.should.contain(Tokens.ClassIdentifier("DefaultAbstractClass", 20, 30)); - - }); - - it("generics in identifier", function () { - - const input = ` -namespace TestNamespace -{ - class Dictionary> { } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); - tokens.should.contain(Tokens.ClassIdentifier("Dictionary>", 4, 11)); - }); - - it("inheritance", function() { - -const input = ` -namespace TestNamespace -{ - class PublicClass : IInterface, IInterfaceTwo { } - class PublicClass : Root.IInterface, Something.IInterfaceTwo { } - class PublicClass : Dictionary>, IMap> { } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); - tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 4, 11)); - tokens.should.contain(Tokens.Type("IInterface", 4, 28)); - tokens.should.contain(Tokens.Type("IInterfaceTwo", 4, 43)); - - tokens.should.contain(Tokens.ClassKeyword("class", 5, 5)); - tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 5, 11)); - tokens.should.contain(Tokens.Type("Root.IInterface", 5, 28)); - tokens.should.contain(Tokens.Type("Something.IInterfaceTwo", 5, 63)); - - tokens.should.contain(Tokens.Type("Dictionary>", 6, 28)); - tokens.should.contain(Tokens.Type("IMap>", 6, 71)); - }); - - it("generic constraints", function() { - -const input = ` -namespace TestNamespace -{ - class PublicClass where T : ISomething { } - class PublicClass : Dictionary[]>, ISomething where T : ICar, new() where X : struct { } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); - tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 4, 11)); - tokens.should.contain(Tokens.Keyword("where", 4, 26)); - tokens.should.contain(Tokens.Type("T", 4, 32)); - tokens.should.contain(Tokens.Type("ISomething", 4, 36)); - - tokens.should.contain(Tokens.ClassKeyword("class", 5, 5)); - tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 5, 11)); - tokens.should.contain(Tokens.Type("Dictionary[]>", 5, 31)); - tokens.should.contain(Tokens.Type("ISomething", 5, 62)); - tokens.should.contain(Tokens.Keyword("where", 5, 73)); - tokens.should.contain(Tokens.Type("T", 5, 79)); - tokens.should.contain(Tokens.Type("ICar", 5, 83)); - tokens.should.contain(Tokens.Keyword("new", 5, 89)); - tokens.should.contain(Tokens.Keyword("where", 5, 95)); - tokens.should.contain(Tokens.Type("X", 5, 101)); - tokens.should.contain(Tokens.Keyword("struct", 5, 105)); - - }); - - it("nested class", function() { - -const input = ` -namespace TestNamespace -{ - class Klass - { - public class Nested - { - - } - } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); - tokens.should.contain(Tokens.ClassIdentifier("Klass", 4, 11)); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 6, 9)); - tokens.should.contain(Tokens.ClassKeyword("class", 6, 16)); - tokens.should.contain(Tokens.ClassIdentifier("Nested", 6, 22)); - }); - }); -}); - - +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function() { + should(); + }); + + describe("Class", function() { + it("class keyword and storage modifiers", function() { + +const input = ` +namespace TestNamespace +{ + public class PublicClass { } + + class DefaultClass { } + + internal class InternalClass { } + + static class DefaultStaticClass { } + + public static class PublicStaticClass { } + + sealed class DefaultSealedClass { } + + public sealed class PublicSealedClass { } + + public abstract class PublicAbstractClass { } + + abstract class DefaultAbstractClass { } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.ClassKeyword("class", 4, 24)); + tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 4, 30)); + + tokens.should.contain(Tokens.ClassKeyword("class", 6, 24)); + tokens.should.contain(Tokens.ClassIdentifier("DefaultClass", 6, 30)); + + tokens.should.contain(Tokens.StorageModifierKeyword("internal", 8, 5)); + tokens.should.contain(Tokens.ClassKeyword("class", 8, 24)); + tokens.should.contain(Tokens.ClassIdentifier("InternalClass", 8, 30)); + + tokens.should.contain(Tokens.StorageModifierKeyword("static", 10, 15)); + tokens.should.contain(Tokens.ClassKeyword("class", 10, 24)); + tokens.should.contain(Tokens.ClassIdentifier("DefaultStaticClass", 10, 30)); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 12, 5)); + tokens.should.contain(Tokens.StorageModifierKeyword("static", 12, 15)); + tokens.should.contain(Tokens.ClassKeyword("class", 12, 24)); + tokens.should.contain(Tokens.ClassIdentifier("PublicStaticClass", 12, 30)); + + tokens.should.contain(Tokens.StorageModifierKeyword("sealed", 14, 15)); + tokens.should.contain(Tokens.ClassKeyword("class", 14, 24)); + tokens.should.contain(Tokens.ClassIdentifier("DefaultSealedClass", 14, 30)); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 16, 5)); + tokens.should.contain(Tokens.StorageModifierKeyword("sealed", 16, 15)); + tokens.should.contain(Tokens.ClassKeyword("class", 16, 24)); + tokens.should.contain(Tokens.ClassIdentifier("PublicSealedClass", 16, 30)); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 18, 5)); + tokens.should.contain(Tokens.StorageModifierKeyword("abstract", 18, 15)); + tokens.should.contain(Tokens.ClassKeyword("class", 18, 24)); + tokens.should.contain(Tokens.ClassIdentifier("PublicAbstractClass", 18, 30)); + + tokens.should.contain(Tokens.StorageModifierKeyword("abstract", 20, 15)); + tokens.should.contain(Tokens.ClassKeyword("class", 20, 24)); + tokens.should.contain(Tokens.ClassIdentifier("DefaultAbstractClass", 20, 30)); + + }); + + it("generics in identifier", function () { + + const input = ` +namespace TestNamespace +{ + class Dictionary> { } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); + tokens.should.contain(Tokens.ClassIdentifier("Dictionary>", 4, 11)); + }); + + it("inheritance", function() { + +const input = ` +namespace TestNamespace +{ + class PublicClass : IInterface, IInterfaceTwo { } + class PublicClass : Root.IInterface, Something.IInterfaceTwo { } + class PublicClass : Dictionary>, IMap> { } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); + tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 4, 11)); + tokens.should.contain(Tokens.Type("IInterface", 4, 28)); + tokens.should.contain(Tokens.Type("IInterfaceTwo", 4, 43)); + + tokens.should.contain(Tokens.ClassKeyword("class", 5, 5)); + tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 5, 11)); + tokens.should.contain(Tokens.Type("Root.IInterface", 5, 28)); + tokens.should.contain(Tokens.Type("Something.IInterfaceTwo", 5, 63)); + + tokens.should.contain(Tokens.Type("Dictionary>", 6, 28)); + tokens.should.contain(Tokens.Type("IMap>", 6, 71)); + }); + + it("generic constraints", function() { + +const input = ` +namespace TestNamespace +{ + class PublicClass where T : ISomething { } + class PublicClass : Dictionary[]>, ISomething where T : ICar, new() where X : struct { } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); + tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 4, 11)); + tokens.should.contain(Tokens.Keyword("where", 4, 26)); + tokens.should.contain(Tokens.Type("T", 4, 32)); + tokens.should.contain(Tokens.Type("ISomething", 4, 36)); + + tokens.should.contain(Tokens.ClassKeyword("class", 5, 5)); + tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 5, 11)); + tokens.should.contain(Tokens.Type("Dictionary[]>", 5, 31)); + tokens.should.contain(Tokens.Type("ISomething", 5, 62)); + tokens.should.contain(Tokens.Keyword("where", 5, 73)); + tokens.should.contain(Tokens.Type("T", 5, 79)); + tokens.should.contain(Tokens.Type("ICar", 5, 83)); + tokens.should.contain(Tokens.Keyword("new", 5, 89)); + tokens.should.contain(Tokens.Keyword("where", 5, 95)); + tokens.should.contain(Tokens.Type("X", 5, 101)); + tokens.should.contain(Tokens.Keyword("struct", 5, 105)); + + }); + + it("nested class", function() { + +const input = ` +namespace TestNamespace +{ + class Klass + { + public class Nested + { + + } + } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); + tokens.should.contain(Tokens.ClassIdentifier("Klass", 4, 11)); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 6, 9)); + tokens.should.contain(Tokens.ClassKeyword("class", 6, 16)); + tokens.should.contain(Tokens.ClassIdentifier("Nested", 6, 22)); + }); + }); +}); + + diff --git a/test/syntaxes/event.tests.ts b/test/syntaxes/event.test.syntax.ts similarity index 96% rename from test/syntaxes/event.tests.ts rename to test/syntaxes/event.test.syntax.ts index 38a849fb9..a20e85206 100644 --- a/test/syntaxes/event.tests.ts +++ b/test/syntaxes/event.test.syntax.ts @@ -1,45 +1,45 @@ -import { should } from 'chai'; -import { Tokens, Token } from './utils/tokenizer'; -import { TokenizerUtil } from'./utils/tokenizerUtil'; - -describe("Grammar", function() { - before(function() { - should(); - }); - - describe("Event", function() { - it("declaration", function() { - -const input = ` -public class Tester -{ - public event Type Event; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.StorageModifierKeyword("event", 4, 12)); - tokens.should.contain(Tokens.Type("Type", 4, 18)); - tokens.should.contain(Tokens.EventIdentifier("Event", 4, 23)); - }); - - it("generic", function () { - - const input = ` -public class Tester -{ - public event EventHandler, Dictionary> Event; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.StorageModifierKeyword("event", 4, 12)); - tokens.should.contain(Tokens.Type("EventHandler, Dictionary>", 4, 18)); - tokens.should.contain(Tokens.EventIdentifier("Event", 4, 58)); - }); - }); -}); - - +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function() { + should(); + }); + + describe("Event", function() { + it("declaration", function() { + +const input = ` +public class Tester +{ + public event Type Event; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.StorageModifierKeyword("event", 4, 12)); + tokens.should.contain(Tokens.Type("Type", 4, 18)); + tokens.should.contain(Tokens.EventIdentifier("Event", 4, 23)); + }); + + it("generic", function () { + + const input = ` +public class Tester +{ + public event EventHandler, Dictionary> Event; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.StorageModifierKeyword("event", 4, 12)); + tokens.should.contain(Tokens.Type("EventHandler, Dictionary>", 4, 18)); + tokens.should.contain(Tokens.EventIdentifier("Event", 4, 58)); + }); + }); +}); + + diff --git a/test/syntaxes/field.tests.ts b/test/syntaxes/field.test.syntax.ts similarity index 96% rename from test/syntaxes/field.tests.ts rename to test/syntaxes/field.test.syntax.ts index dee1b2bd7..366a6ab40 100644 --- a/test/syntaxes/field.tests.ts +++ b/test/syntaxes/field.test.syntax.ts @@ -1,134 +1,134 @@ -import { should } from 'chai'; -import { Tokens, Token } from './utils/tokenizer'; -import { TokenizerUtil } from'./utils/tokenizerUtil'; - -describe("Grammar", function() { - before(function() { - should(); - }); - - describe("Field", function() { - it("declaration", function() { - -const input = ` -public class Tester -{ - private List _field; - private List field; - private List field123; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); - tokens.should.contain(Tokens.Type("List", 4, 13)); - tokens.should.contain(Tokens.FieldIdentifier("_field", 4, 18)); - - tokens.should.contain(Tokens.FieldIdentifier("field", 5, 18)); - tokens.should.contain(Tokens.FieldIdentifier("field123", 6, 18)); - }); - - it("generic", function () { - - const input = ` -public class Tester -{ - private Dictionary< List, Dictionary> _field; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); - tokens.should.contain(Tokens.Type("Dictionary< List, Dictionary>", 4, 13)); - tokens.should.contain(Tokens.FieldIdentifier("_field", 4, 52)); - }); - - - it("modifiers", function() { - -const input = ` -public class Tester -{ - private static readonly List _field; - readonly string _field2; - string _field3; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); - tokens.should.contain(Tokens.StorageModifierKeyword("static", 4, 13)); - tokens.should.contain(Tokens.StorageModifierKeyword("readonly", 4, 20)); - tokens.should.contain(Tokens.Type("List", 4, 29)); - tokens.should.contain(Tokens.FieldIdentifier("_field", 4, 34)); - - tokens.should.contain(Tokens.FieldIdentifier("_field2", 5, 21)); - - tokens.should.contain(Tokens.FieldIdentifier("_field3", 6, 12)); - }); - - it("types", function() { - -const input = ` -public class Tester -{ - string field123; - string[] field123; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.Type("string", 4, 5)); - tokens.should.contain(Tokens.FieldIdentifier("field123", 4, 12)); - - tokens.should.contain(Tokens.Type("string[]", 5, 5)); - tokens.should.contain(Tokens.FieldIdentifier("field123", 5, 14)); - }); - - it("assignment", function() { - -const input = ` -public class Tester -{ - private string field = "hello"; - const bool field = true; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); - tokens.should.contain(Tokens.Type("string", 4, 13)); - tokens.should.contain(Tokens.FieldIdentifier("field", 4, 20)); - tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 29)); - - tokens.should.contain(Tokens.StorageModifierKeyword("const", 5, 5)); - tokens.should.contain(Tokens.Type("bool", 5, 13)); - tokens.should.contain(Tokens.FieldIdentifier("field", 5, 20)); - tokens.should.contain(Tokens.LanguageConstant("true", 5, 28)); - }); - - it("expression body", function() { - -const input = ` -public class Tester -{ - private string field => "hello"; - const bool field => true; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); - tokens.should.contain(Tokens.Type("string", 4, 13)); - tokens.should.contain(Tokens.FieldIdentifier("field", 4, 20)); - tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 30)); - - tokens.should.contain(Tokens.StorageModifierKeyword("const", 5, 5)); - tokens.should.contain(Tokens.Type("bool", 5, 13)); - tokens.should.contain(Tokens.FieldIdentifier("field", 5, 20)); - tokens.should.contain(Tokens.LanguageConstant("true", 5, 29)); - }); - }); -}); - - +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function() { + should(); + }); + + describe("Field", function() { + it("declaration", function() { + +const input = ` +public class Tester +{ + private List _field; + private List field; + private List field123; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); + tokens.should.contain(Tokens.Type("List", 4, 13)); + tokens.should.contain(Tokens.FieldIdentifier("_field", 4, 18)); + + tokens.should.contain(Tokens.FieldIdentifier("field", 5, 18)); + tokens.should.contain(Tokens.FieldIdentifier("field123", 6, 18)); + }); + + it("generic", function () { + + const input = ` +public class Tester +{ + private Dictionary< List, Dictionary> _field; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); + tokens.should.contain(Tokens.Type("Dictionary< List, Dictionary>", 4, 13)); + tokens.should.contain(Tokens.FieldIdentifier("_field", 4, 52)); + }); + + + it("modifiers", function() { + +const input = ` +public class Tester +{ + private static readonly List _field; + readonly string _field2; + string _field3; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); + tokens.should.contain(Tokens.StorageModifierKeyword("static", 4, 13)); + tokens.should.contain(Tokens.StorageModifierKeyword("readonly", 4, 20)); + tokens.should.contain(Tokens.Type("List", 4, 29)); + tokens.should.contain(Tokens.FieldIdentifier("_field", 4, 34)); + + tokens.should.contain(Tokens.FieldIdentifier("_field2", 5, 21)); + + tokens.should.contain(Tokens.FieldIdentifier("_field3", 6, 12)); + }); + + it("types", function() { + +const input = ` +public class Tester +{ + string field123; + string[] field123; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.Type("string", 4, 5)); + tokens.should.contain(Tokens.FieldIdentifier("field123", 4, 12)); + + tokens.should.contain(Tokens.Type("string[]", 5, 5)); + tokens.should.contain(Tokens.FieldIdentifier("field123", 5, 14)); + }); + + it("assignment", function() { + +const input = ` +public class Tester +{ + private string field = "hello"; + const bool field = true; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); + tokens.should.contain(Tokens.Type("string", 4, 13)); + tokens.should.contain(Tokens.FieldIdentifier("field", 4, 20)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 29)); + + tokens.should.contain(Tokens.StorageModifierKeyword("const", 5, 5)); + tokens.should.contain(Tokens.Type("bool", 5, 13)); + tokens.should.contain(Tokens.FieldIdentifier("field", 5, 20)); + tokens.should.contain(Tokens.LanguageConstant("true", 5, 28)); + }); + + it("expression body", function() { + +const input = ` +public class Tester +{ + private string field => "hello"; + const bool field => true; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); + tokens.should.contain(Tokens.Type("string", 4, 13)); + tokens.should.contain(Tokens.FieldIdentifier("field", 4, 20)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 30)); + + tokens.should.contain(Tokens.StorageModifierKeyword("const", 5, 5)); + tokens.should.contain(Tokens.Type("bool", 5, 13)); + tokens.should.contain(Tokens.FieldIdentifier("field", 5, 20)); + tokens.should.contain(Tokens.LanguageConstant("true", 5, 29)); + }); + }); +}); + + diff --git a/test/syntaxes/namespace.tests.ts b/test/syntaxes/namespace.test.syntax.ts similarity index 96% rename from test/syntaxes/namespace.tests.ts rename to test/syntaxes/namespace.test.syntax.ts index 30b3ca341..c071f4381 100644 --- a/test/syntaxes/namespace.tests.ts +++ b/test/syntaxes/namespace.test.syntax.ts @@ -1,78 +1,78 @@ -import { should } from 'chai'; -import { Tokens, Token } from './utils/tokenizer'; -import { TokenizerUtil } from'./utils/tokenizerUtil'; - -describe("Grammar", function() { - before(function () { - should(); - }); - - describe("Namespace", function() { - it("has a namespace keyword and a name", function() { - -const input = ` -namespace TestNamespace -{ -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.NamespaceKeyword("namespace", 2, 1)); - tokens.should.contain(Tokens.NamespaceIdentifier("TestNamespace", 2, 11)); - }); - - it("can be nested", function() { - -const input = ` -namespace TestNamespace -{ - namespace NestedNamespace { - - } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.NamespaceKeyword("namespace", 2, 1)); - tokens.should.contain(Tokens.NamespaceIdentifier("TestNamespace", 2, 11)); - - tokens.should.contain(Tokens.NamespaceKeyword("namespace", 4, 5)); - tokens.should.contain(Tokens.NamespaceIdentifier("NestedNamespace", 4, 15)); - }); - - it("can contain using statements", function() { - -const input = ` -using UsineOne; -using one = UsineOne.Something; - -namespace TestNamespace -{ - using UsingTwo; - using two = UsineOne.Something; - - namespace NestedNamespace - { - using UsingThree; - using three = UsineOne.Something; - } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.UsingKeyword("using", 2, 1)); - tokens.should.contain(Tokens.UsingKeyword("using", 3, 1)); - - tokens.should.contain(Tokens.NamespaceKeyword("namespace", 5, 1)); - tokens.should.contain(Tokens.NamespaceIdentifier("TestNamespace", 5, 11)); - - tokens.should.contain(Tokens.UsingKeyword("using", 7, 5)); - tokens.should.contain(Tokens.UsingKeyword("using", 8, 5)); - - tokens.should.contain(Tokens.NamespaceKeyword("namespace", 10, 5)); - tokens.should.contain(Tokens.NamespaceIdentifier("NestedNamespace", 10, 15)); - - tokens.should.contain(Tokens.UsingKeyword("using", 12, 9)); - tokens.should.contain(Tokens.UsingKeyword("using", 12, 9)); - }); - }); -}); - - +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function () { + should(); + }); + + describe("Namespace", function() { + it("has a namespace keyword and a name", function() { + +const input = ` +namespace TestNamespace +{ +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.NamespaceKeyword("namespace", 2, 1)); + tokens.should.contain(Tokens.NamespaceIdentifier("TestNamespace", 2, 11)); + }); + + it("can be nested", function() { + +const input = ` +namespace TestNamespace +{ + namespace NestedNamespace { + + } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.NamespaceKeyword("namespace", 2, 1)); + tokens.should.contain(Tokens.NamespaceIdentifier("TestNamespace", 2, 11)); + + tokens.should.contain(Tokens.NamespaceKeyword("namespace", 4, 5)); + tokens.should.contain(Tokens.NamespaceIdentifier("NestedNamespace", 4, 15)); + }); + + it("can contain using statements", function() { + +const input = ` +using UsineOne; +using one = UsineOne.Something; + +namespace TestNamespace +{ + using UsingTwo; + using two = UsineOne.Something; + + namespace NestedNamespace + { + using UsingThree; + using three = UsineOne.Something; + } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.UsingKeyword("using", 2, 1)); + tokens.should.contain(Tokens.UsingKeyword("using", 3, 1)); + + tokens.should.contain(Tokens.NamespaceKeyword("namespace", 5, 1)); + tokens.should.contain(Tokens.NamespaceIdentifier("TestNamespace", 5, 11)); + + tokens.should.contain(Tokens.UsingKeyword("using", 7, 5)); + tokens.should.contain(Tokens.UsingKeyword("using", 8, 5)); + + tokens.should.contain(Tokens.NamespaceKeyword("namespace", 10, 5)); + tokens.should.contain(Tokens.NamespaceIdentifier("NestedNamespace", 10, 15)); + + tokens.should.contain(Tokens.UsingKeyword("using", 12, 9)); + tokens.should.contain(Tokens.UsingKeyword("using", 12, 9)); + }); + }); +}); + + diff --git a/test/syntaxes/property.tests.ts b/test/syntaxes/property.test.syntax.ts similarity index 97% rename from test/syntaxes/property.tests.ts rename to test/syntaxes/property.test.syntax.ts index a7ad89745..3851ac49c 100644 --- a/test/syntaxes/property.tests.ts +++ b/test/syntaxes/property.test.syntax.ts @@ -1,133 +1,133 @@ -import { should } from 'chai'; -import { Tokens, Token } from './utils/tokenizer'; -import { TokenizerUtil } from'./utils/tokenizerUtil'; - -describe("Grammar", function() { - before(function() { - should(); - }); - - describe("Property", function() { - it("declaration", function() { - -const input = ` -class Tester -{ - public IBooom Property - { - get { return null; } - set { something = value; } - } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.Type("IBooom", 4, 12)); - tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); - tokens.should.contain(Tokens.Keyword("get", 6, 9)); - tokens.should.contain(Tokens.Keyword("set", 7, 9)); - }); - - it("declaration single line", function() { - -const input = ` -class Tester -{ - public IBooom Property { get { return null; } private set { something = value; } } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.Type("IBooom", 4, 12)); - tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); - tokens.should.contain(Tokens.Keyword("get", 4, 30)); - tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 51)); - tokens.should.contain(Tokens.Keyword("set", 4, 59)); - }); - - - it("declaration without modifiers", function() { - -const input = ` -class Tester -{ - IBooom Property {get; set;} -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.Type("IBooom", 4, 5)); - tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 12)); - }); - - it("auto-property single line", function() { - -const input = ` -class Tester -{ - public IBooom Property { get; set; } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.Type("IBooom", 4, 12)); - tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); - tokens.should.contain(Tokens.Keyword("get", 4, 30)); - tokens.should.contain(Tokens.Keyword("set", 4, 35)); - }); - - it("auto-property", function() { - -const input = ` -class Tester -{ - public IBooom Property - { - get; - set; - } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.Type("IBooom", 4, 12)); - tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); - tokens.should.contain(Tokens.Keyword("get", 6, 9)); - tokens.should.contain(Tokens.Keyword("set", 7, 9)); - }); - - it("generic auto-property", function() { - -const input = ` -class Tester -{ - public Dictionary[]> Property { get; set; } -}`; - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.Type("Dictionary[]>", 4, 12)); - tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 42)); - tokens.should.contain(Tokens.Keyword("get", 4, 53)); - tokens.should.contain(Tokens.Keyword("set", 4, 58)); - }); - - it("auto-property initializer", function() { - -const input = ` -class Tester -{ - public Dictionary[]> Property { get; } = new Dictionary[]>(); -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); - tokens.should.contain(Tokens.Type("Dictionary[]>", 4, 12)); - tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 42)); - tokens.should.contain(Tokens.Keyword("get", 4, 53)); - tokens.should.contain(Tokens.StorageModifierKeyword("new", 4, 62)); - }); - }); -}); - - +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function() { + should(); + }); + + describe("Property", function() { + it("declaration", function() { + +const input = ` +class Tester +{ + public IBooom Property + { + get { return null; } + set { something = value; } + } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("IBooom", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); + tokens.should.contain(Tokens.Keyword("get", 6, 9)); + tokens.should.contain(Tokens.Keyword("set", 7, 9)); + }); + + it("declaration single line", function() { + +const input = ` +class Tester +{ + public IBooom Property { get { return null; } private set { something = value; } } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("IBooom", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); + tokens.should.contain(Tokens.Keyword("get", 4, 30)); + tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 51)); + tokens.should.contain(Tokens.Keyword("set", 4, 59)); + }); + + + it("declaration without modifiers", function() { + +const input = ` +class Tester +{ + IBooom Property {get; set;} +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.Type("IBooom", 4, 5)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 12)); + }); + + it("auto-property single line", function() { + +const input = ` +class Tester +{ + public IBooom Property { get; set; } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("IBooom", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); + tokens.should.contain(Tokens.Keyword("get", 4, 30)); + tokens.should.contain(Tokens.Keyword("set", 4, 35)); + }); + + it("auto-property", function() { + +const input = ` +class Tester +{ + public IBooom Property + { + get; + set; + } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("IBooom", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); + tokens.should.contain(Tokens.Keyword("get", 6, 9)); + tokens.should.contain(Tokens.Keyword("set", 7, 9)); + }); + + it("generic auto-property", function() { + +const input = ` +class Tester +{ + public Dictionary[]> Property { get; set; } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("Dictionary[]>", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 42)); + tokens.should.contain(Tokens.Keyword("get", 4, 53)); + tokens.should.contain(Tokens.Keyword("set", 4, 58)); + }); + + it("auto-property initializer", function() { + +const input = ` +class Tester +{ + public Dictionary[]> Property { get; } = new Dictionary[]>(); +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("Dictionary[]>", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 42)); + tokens.should.contain(Tokens.Keyword("get", 4, 53)); + tokens.should.contain(Tokens.StorageModifierKeyword("new", 4, 62)); + }); + }); +}); + + diff --git a/test/syntaxes/string.tests.ts b/test/syntaxes/string.test.syntax.ts similarity index 97% rename from test/syntaxes/string.tests.ts rename to test/syntaxes/string.test.syntax.ts index fe58bb6f7..c7b9873d1 100644 --- a/test/syntaxes/string.tests.ts +++ b/test/syntaxes/string.test.syntax.ts @@ -1,123 +1,123 @@ -import { should } from 'chai'; -import { Tokens, Token } from './utils/tokenizer'; -import { TokenizerUtil } from'./utils/tokenizerUtil'; - -describe("Grammar", function() { - before(function() { - should(); - }); - - describe("String interpolated", function() { - it("non-verbatim", function() { - -const input = ` -public class Tester -{ - string test = $"hello {one} world {two}!"; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StringStart('$"', 4, 19)); - tokens.should.contain(Tokens.StringDoubleQuoted("hello ", 4, 21)); - tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 28)); - tokens.should.contain(Tokens.StringDoubleQuoted(" world ", 4, 32)); - tokens.should.contain(Tokens.StringInterpolatedExpression("two", 4, 40)); - tokens.should.contain(Tokens.StringDoubleQuoted("!", 4, 44)); - tokens.should.contain(Tokens.StringEnd('"', 4, 45)); - }); - - - it("non-verbatim without expressions single-line", function() { - -const input = ` -public class Tester -{ - string test = $"hello world!"; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StringStart('$"', 4, 19)); - tokens.should.contain(Tokens.StringDoubleQuoted("hello world!", 4, 21)); - tokens.should.contain(Tokens.StringEnd('"', 4, 33)); - }); - - it("non-verbatim multi-line", function() { - -const input = ` -public class Tester -{ - string test = $"hello -world!"; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StringStart('$"', 4, 19)); - tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 21)); - tokens.should.not.contain(Tokens.StringDoubleQuoted("world!", 5, 1)); - tokens.should.not.contain(Tokens.StringEnd('"', 5, 7)); - }); - - - it("verbatim single-line", function() { - -const input = ` -public class Tester -{ - string test = $@"hello {one} world {two}!"; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); - tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello ", 4, 22)); - tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 29)); - tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world ", 4, 33)); - tokens.should.contain(Tokens.StringInterpolatedExpression("two", 4, 41)); - tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("!", 4, 45)); - tokens.should.contain(Tokens.StringEnd('"', 4, 46)); - }); - - - it("verbatim multi-line", function() { - -const input = ` -public class Tester -{ - string test = $@"hello {one} - world {two}!"; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); - tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello ", 4, 22)); - tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 29)); - tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world ", 5, 1)); - tokens.should.contain(Tokens.StringInterpolatedExpression("two", 5, 12)); - tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("!", 5, 16)); - tokens.should.contain(Tokens.StringEnd('"', 5, 17)); - }); - - it("verbatim multi-line without expressions", function() { - -const input = ` -public class Tester -{ - string test = $@"hello - world!"; -}`; - - let tokens: Token[] = TokenizerUtil.tokenize(input); - - tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); - tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello", 4, 22)); - tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world!", 5, 1)); - tokens.should.contain(Tokens.StringEnd('"', 5, 11)); - }); - }); -}); - - +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function() { + should(); + }); + + describe("String interpolated", function() { + it("non-verbatim", function() { + +const input = ` +public class Tester +{ + string test = $"hello {one} world {two}!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello ", 4, 21)); + tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 28)); + tokens.should.contain(Tokens.StringDoubleQuoted(" world ", 4, 32)); + tokens.should.contain(Tokens.StringInterpolatedExpression("two", 4, 40)); + tokens.should.contain(Tokens.StringDoubleQuoted("!", 4, 44)); + tokens.should.contain(Tokens.StringEnd('"', 4, 45)); + }); + + + it("non-verbatim without expressions single-line", function() { + +const input = ` +public class Tester +{ + string test = $"hello world!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello world!", 4, 21)); + tokens.should.contain(Tokens.StringEnd('"', 4, 33)); + }); + + it("non-verbatim multi-line", function() { + +const input = ` +public class Tester +{ + string test = $"hello +world!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 21)); + tokens.should.not.contain(Tokens.StringDoubleQuoted("world!", 5, 1)); + tokens.should.not.contain(Tokens.StringEnd('"', 5, 7)); + }); + + + it("verbatim single-line", function() { + +const input = ` +public class Tester +{ + string test = $@"hello {one} world {two}!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello ", 4, 22)); + tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 29)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world ", 4, 33)); + tokens.should.contain(Tokens.StringInterpolatedExpression("two", 4, 41)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("!", 4, 45)); + tokens.should.contain(Tokens.StringEnd('"', 4, 46)); + }); + + + it("verbatim multi-line", function() { + +const input = ` +public class Tester +{ + string test = $@"hello {one} + world {two}!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello ", 4, 22)); + tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 29)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world ", 5, 1)); + tokens.should.contain(Tokens.StringInterpolatedExpression("two", 5, 12)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("!", 5, 16)); + tokens.should.contain(Tokens.StringEnd('"', 5, 17)); + }); + + it("verbatim multi-line without expressions", function() { + +const input = ` +public class Tester +{ + string test = $@"hello + world!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello", 4, 22)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world!", 5, 1)); + tokens.should.contain(Tokens.StringEnd('"', 5, 11)); + }); + }); +}); + + diff --git a/tsconfig.json b/tsconfig.json index 57bf70ff9..cbe85ef3a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,16 @@ { "compilerOptions": { - "target": "es5", + "target": "es6", "module": "commonjs", "outDir": "out", - "noLib": true, + "lib": [ + "es6" + ], "sourceMap": true, "rootDir": "." }, "exclude": [ - "node_modules" + "node_modules", + ".vscode-test" ] } \ No newline at end of file diff --git a/typings/bluebird/bluebird.d.ts b/typings/bluebird/bluebird.d.ts deleted file mode 100644 index 75f653440..000000000 --- a/typings/bluebird/bluebird.d.ts +++ /dev/null @@ -1,781 +0,0 @@ -// Type definitions for bluebird 2.0.0 -// Project: https://github.com/petkaantonov/bluebird -// Definitions by: Bart van der Schoor , falsandtru - -// ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts -// By: Campredon - -// Warning: recommended to use `tsc > v0.9.7` (critical bugs in earlier generic code): -// - https://github.com/borisyankov/DefinitelyTyped/issues/1563 - -// Note: replicate changes to all overloads in both definition and test file -// Note: keep both static and instance members inline (so similar) - -// TODO fix remaining TODO annotations in both definition and test - -// TODO verify support to have no return statement in handlers to get a Promise (more overloads?) - -declare var Promise: PromiseConstructor; - -interface PromiseConstructor { - /** - * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. - */ - new (callback: (resolve: (thenableOrResult?: T | PromiseLike) => void, reject: (error: any) => void) => void): Promise; - - // Ideally, we'd define e.g. "export class RangeError extends Error {}", - // but as Error is defined as an interface (not a class), TypeScript doesn't - // allow extending Error, only implementing it. - // However, if we want to catch() only a specific error type, we need to pass - // a constructor function to it. So, as a workaround, we define them here as such. - RangeError(): RangeError; - CancellationError(): Promise.CancellationError; - TimeoutError(): Promise.TimeoutError; - TypeError(): Promise.TypeError; - RejectionError(): Promise.RejectionError; - OperationalError(): Promise.OperationalError; - - /** - * Changes how bluebird schedules calls a-synchronously. - * - * @param scheduler Should be a function that asynchronously schedules - * the calling of the passed in function - */ - setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void; - - /** - * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. - * - * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call. - * - * Alias for `attempt();` for compatibility with earlier ECMAScript version. - */ - try(fn: () => PromiseLike, args?: any[], ctx?: any): Promise; - try(fn: () => T, args?: any[], ctx?: any): Promise; - - attempt(fn: () => PromiseLike, args?: any[], ctx?: any): Promise; - attempt(fn: () => T, args?: any[], ctx?: any): Promise; - - /** - * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. - * This method is convenient when a function can sometimes return synchronously or throw synchronously. - */ - method(fn: Function): Function; - - /** - * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state. - */ - resolve(): Promise; - resolve(value: PromiseLike): Promise; - resolve(value: T): Promise; - - /** - * Create a promise that is rejected with the given `reason`. - */ - reject(reason: any): Promise; - reject(reason: any): Promise; - - /** - * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution). - */ - defer(): Promise.Resolver; - - /** - * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. - */ - cast(value: PromiseLike): Promise; - cast(value: T): Promise; - - /** - * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`. - */ - bind(thisArg: any): Promise; - - /** - * See if `value` is a trusted Promise. - */ - is(value: any): boolean; - - /** - * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. - */ - longStackTraces(): void; - - /** - * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise. - */ - // TODO enable more overloads - delay(ms: number, value: PromiseLike): Promise; - delay(ms: number, value: T): Promise; - delay(ms: number): Promise; - - /** - * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. - * - * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. - * - * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. - */ - promisify(func: (callback: (err: any, result: T) => void) => void, receiver?: any): () => Promise; - promisify(func: (arg1: A1, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1) => Promise; - promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2) => Promise; - promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3) => Promise; - promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise; - promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise; - promisify(nodeFunction: Function, receiver?: any): Function; - - /** - * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object. - * - * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. - */ - // TODO how to model promisifyAll? - promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any; - - - /** - * Returns a promise that is resolved by a node style callback function. - */ - fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; - fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; - - /** - * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. - */ - // TODO fix coroutine GeneratorFunction - coroutine(generatorFunction: Function): Function; - - /** - * Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. - */ - // TODO fix spawn GeneratorFunction - spawn(generatorFunction: Function): Promise; - - /** - * This is relevant to browser environments with no module loader. - * - * Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else. - */ - noConflict(): typeof Promise; - - /** - * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. - * - * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. - */ - onPossiblyUnhandledRejection(handler: (reason: any) => any): void; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason. - */ - // TODO enable more overloads - // promise of array with promises of value - all(values: PromiseLike[]>): Promise; - // promise of array with values - all(values: PromiseLike): Promise; - // array with promises of value - all(values: PromiseLike[]): Promise; - // array with promises of different types - all(values: [PromiseLike, PromiseLike]): Promise<[T1, T2]>; - all(values: [PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4]>; - all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - // array with values - all(values: T[]): Promise; - - /** - * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. - * - * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. - * - * *The original object is not modified.* - */ - // TODO verify this is correct - // trusted promise for object - props(object: Promise): Promise; - // object - props(object: Object): Promise; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected. The fulfillment value is an array of ``PromiseInspection`` instances at respective positions in relation to the input array. - * - * *original: The array is not modified. The input array sparsity is retained in the resulting array.* - */ - // promise of array with promises of value - settle(values: PromiseLike[]>): Promise[]>; - // promise of array with values - settle(values: PromiseLike): Promise[]>; - // array with promises of value - settle(values: PromiseLike[]): Promise[]>; - // array with values - settle(values: T[]): Promise[]>; - - /** - * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. - */ - // promise of array with promises of value - any(values: PromiseLike[]>): Promise; - // promise of array with values - any(values: PromiseLike): Promise; - // array with promises of value - any(values: PromiseLike[]): Promise; - // array with values - any(values: T[]): Promise; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value. - * - * **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending. - */ - // promise of array with promises of value - race(values: PromiseLike[]>): Promise; - // promise of array with values - race(values: PromiseLike): Promise; - // array with promises of value - race(values: PromiseLike[]): Promise; - // array with values - race(values: T[]): Promise; - - /** - * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. - * - * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - some(values: PromiseLike[]>, count: number): Promise; - // promise of array with values - some(values: PromiseLike, count: number): Promise; - // array with promises of value - some(values: PromiseLike[], count: number): Promise; - // array with values - some(values: T[], count: number): Promise; - - /** - * Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments. - */ - // variadic array with promises of value - join(...values: PromiseLike[]): Promise; - // variadic array with values - join(...values: T[]): Promise; - - /** - * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - map(values: PromiseLike[]>, mapper: (item: T, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; - map(values: PromiseLike[]>, mapper: (item: T, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - - // promise of array with values - map(values: PromiseLike, mapper: (item: T, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; - map(values: PromiseLike, mapper: (item: T, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - - // array with promises of value - map(values: PromiseLike[], mapper: (item: T, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; - map(values: PromiseLike[], mapper: (item: T, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - - // array with values - map(values: T[], mapper: (item: T, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; - map(values: T[], mapper: (item: T, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - - /** - * Similar to `map` with concurrency set to 1 but guaranteed to execute in sequential order - * - * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - mapSeries(values: PromiseLike[]>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - - // promise of array with values - mapSeries(values: PromiseLike, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - - // array with promises of value - mapSeries(values: PromiseLike[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - - // array with values - mapSeries(values: R[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - - - /** - * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. - * - * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* - */ - // promise of array with promises of value - reduce(values: PromiseLike[]>, reducer: (total: U, current: T, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; - reduce(values: PromiseLike[]>, reducer: (total: U, current: T, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - // promise of array with values - reduce(values: PromiseLike, reducer: (total: U, current: T, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; - reduce(values: PromiseLike, reducer: (total: U, current: T, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - // array with promises of value - reduce(values: PromiseLike[], reducer: (total: U, current: T, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; - reduce(values: PromiseLike[], reducer: (total: U, current: T, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - // array with values - reduce(values: T[], reducer: (total: U, current: T, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; - reduce(values: T[], reducer: (total: U, current: T, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - /** - * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. - * - * *The original array is not modified. - */ - // promise of array with promises of value - filter(values: PromiseLike[]>, filterer: (item: T, index: number, arrayLength: number) => PromiseLike, option?: Promise.ConcurrencyOption): Promise; - filter(values: PromiseLike[]>, filterer: (item: T, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; - - // promise of array with values - filter(values: PromiseLike, filterer: (item: T, index: number, arrayLength: number) => PromiseLike, option?: Promise.ConcurrencyOption): Promise; - filter(values: PromiseLike, filterer: (item: T, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; - - // array with promises of value - filter(values: PromiseLike[], filterer: (item: T, index: number, arrayLength: number) => PromiseLike, option?: Promise.ConcurrencyOption): Promise; - filter(values: PromiseLike[], filterer: (item: T, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; - - // array with values - filter(values: T[], filterer: (item: T, index: number, arrayLength: number) => PromiseLike, option?: Promise.ConcurrencyOption): Promise; - filter(values: T[], filterer: (item: T, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; - - /** - * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. - * - * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. - */ - // promise of array with promises of value - each(values: PromiseLike[]>, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; - // array with promises of value - each(values: PromiseLike[], iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; - // array with values OR promise of array with values - each(values: T[] | PromiseLike, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; -} - -interface Promise extends PromiseLike, Promise.Inspection { - /** - * Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. - */ - then(onFulfill: (value: T) => U | PromiseLike, onReject?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): Promise; - then(onFulfill: (value: T) => U | PromiseLike, onReject?: (error: any) => void | PromiseLike, onProgress?: (note: any) => any): Promise; - - /** - * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. - * - * Alias `.caught();` for compatibility with earlier ECMAScript version. - */ - catch(onReject?: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - caught(onReject?: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - - catch(onReject?: (error: any) => U | PromiseLike): Promise; - caught(onReject?: (error: any) => U | PromiseLike): Promise; - - /** - * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. - * - * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. - * - * Alias `.caught();` for compatibility with earlier ECMAScript version. - */ - catch(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - caught(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - - catch(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike): Promise; - caught(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike): Promise; - - catch(ErrorClass: Function, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - caught(ErrorClass: Function, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - - catch(ErrorClass: Function, onReject: (error: any) => U | PromiseLike): Promise; - caught(ErrorClass: Function, onReject: (error: any) => U | PromiseLike): Promise; - - - /** - * Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections. - */ - error(onReject: (reason: any) => PromiseLike): Promise; - error(onReject: (reason: any) => U): Promise; - - /** - * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler. - * - * Alias `.lastly();` for compatibility with earlier ECMAScript version. - */ - finally(handler: () => PromiseLike): Promise; - finally(handler: () => U): Promise; - - lastly(handler: () => PromiseLike): Promise; - lastly(handler: () => U): Promise; - - /** - * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. - */ - bind(thisArg: any): Promise; - - /** - * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error. - */ - done(onFulfilled: (value: T) => PromiseLike, onRejected: (error: any) => PromiseLike, onProgress?: (note: any) => any): void; - done(onFulfilled: (value: T) => PromiseLike, onRejected?: (error: any) => U, onProgress?: (note: any) => any): void; - done(onFulfilled: (value: T) => U, onRejected: (error: any) => PromiseLike, onProgress?: (note: any) => any): void; - done(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): void; - - /** - * Like `.finally()`, but not called for rejections. - */ - tap(onFulFill: (value: T) => PromiseLike): Promise; - tap(onFulfill: (value: T) => U): Promise; - - /** - * Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise. - */ - progressed(handler: (note: any) => any): Promise; - - /** - * Same as calling `Promise.delay(this, ms)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - delay(ms: number): Promise; - - /** - * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is rejected with a `Promise.TimeoutError` instance. - * - * You may specify a custom error message with the `message` parameter. - */ - timeout(ms: number, message?: string): Promise; - - /** - * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. - * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. - */ - nodeify(callback: (err: any, value?: T) => void, options?: Promise.SpreadOption): Promise; - nodeify(...sink: any[]): Promise; - - /** - * Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise. - */ - cancellable(): Promise; - - /** - * Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending. - * - * That ancestor will then be rejected with a `CancellationError` (get a reference from `Promise.CancellationError`) object as the rejection reason. - * - * In a promise rejection handler you may check for a cancellation by seeing if the reason object has `.name === "Cancel"`. - * - * Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable. - */ - // TODO what to do with this? - cancel(reason?: any): Promise; - - /** - * Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors. - */ - fork(onFulfilled: (value: T) => PromiseLike, onRejected: (error: any) => PromiseLike, onProgress?: (note: any) => any): Promise; - fork(onFulfilled: (value: T) => PromiseLike, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; - fork(onFulfilled: (value: T) => U, onRejected: (error: any) => PromiseLike, onProgress?: (note: any) => any): Promise; - fork(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; - - /** - * Create an uncancellable promise based on this promise. - */ - uncancellable(): Promise; - - /** - * See if this promise can be cancelled. - */ - isCancellable(): boolean; - - /** - * See if this `promise` has been fulfilled. - */ - isFulfilled(): boolean; - - /** - * See if this `promise` has been rejected. - */ - isRejected(): boolean; - - /** - * See if this `promise` is still defer. - */ - isPending(): boolean; - - /** - * See if this `promise` is resolved -> either fulfilled or rejected. - */ - isResolved(): boolean; - - /** - * Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet. - * - * throws `TypeError` - */ - value(): T; - - /** - * Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet. - * - * throws `TypeError` - */ - reason(): any; - - /** - * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`. - */ - inspect(): Promise.Inspection; - - /** - * This is a convenience method for doing: - * - * - * promise.then(function(obj){ - * return obj[propertyName].call(obj, arg...); - * }); - * - */ - call(propertyName: string, ...args: any[]): Promise; - - /** - * This is a convenience method for doing: - * - * - * promise.then(function(obj){ - * return obj[propertyName]; - * }); - * - */ - // TODO find way to fix get() - // get(propertyName: string): Promise; - - /** - * Convenience method for: - * - * - * .then(function() { - * return value; - * }); - * - * - * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()` - * - * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. - */ - return(): Promise; - thenReturn(): Promise; - return(value: U): Promise; - thenReturn(value: U): Promise; - - /** - * Convenience method for: - * - * - * .then(function() { - * throw reason; - * }); - * - * Same limitations apply as with `.return()`. - * - * Alias `.thenThrow();` for compatibility with earlier ECMAScript version. - */ - throw(reason: Error): Promise; - thenThrow(reason: Error): Promise; - - /** - * Convert to String. - */ - toString(): string; - - /** - * This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`. - */ - toJSON(): Object; - - /** - * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. - */ - // TODO how to model instance.spread()? like Q? - spread(onFulfill: Function, onReject?: (reason: any) => PromiseLike): Promise; - spread(onFulfill: Function, onReject?: (reason: any) => U): Promise; - /* - // TODO or something like this? - spread(onFulfill: (...values: W[]) => PromiseLike, onReject?: (reason: any) => PromiseLike): Promise; - spread(onFulfill: (...values: W[]) => PromiseLike, onReject?: (reason: any) => U): Promise; - spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => PromiseLike): Promise; - spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise; - */ - /** - * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - all(): Promise; - - /** - * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO how to model instance.props()? - props(): Promise; - - /** - * Same as calling `Promise.settle(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - settle(): Promise[]>; - - /** - * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - any(): Promise; - - /** - * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - some(count: number): Promise; - - /** - * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - race(): Promise; - - /** - * Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - map(mapper: (item: Q, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; - map(mapper: (item: Q, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - - /** - * Same as `Promise.mapSeries(thisPromise, mapper)`. - */ - // TODO type inference from array-resolving promise? - mapSeries(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike): Promise; - - /** - * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; - reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - /** - * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - filter(filterer: (item: U, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; - filter(filterer: (item: U, index: number, arrayLength: number) => boolean, options?: Promise.ConcurrencyOption): Promise; - - /** - * Same as calling ``Promise.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - each(iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; -} - -/** - * Don't use variable namespace such as variables, functions, and classes. - * If you use this namespace, it will conflict in es6. - */ -declare namespace Promise { - export interface RangeError extends Error { - } - export interface CancellationError extends Error { - } - export interface TimeoutError extends Error { - } - export interface TypeError extends Error { - } - export interface RejectionError extends Error { - } - export interface OperationalError extends Error { - } - - export interface ConcurrencyOption { - concurrency: number; - } - export interface SpreadOption { - spread: boolean; - } - export interface PromisifyAllOptions { - suffix?: string; - filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean; - // The promisifier gets a reference to the original method and should return a function which returns a promise - promisifier?: (originalMethod: Function) => () => PromiseLike; - } - - export interface Resolver { - /** - * Returns a reference to the controlled promise that can be passed to clients. - */ - promise: Promise; - - /** - * Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state. - */ - resolve(value: T): void; - resolve(): void; - - /** - * Reject the underlying promise with `reason` as the rejection reason. - */ - reject(reason: any): void; - - /** - * Progress the underlying promise with `value` as the progression value. - */ - progress(value: any): void; - - /** - * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. - * - * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. - */ - // TODO specify resolver callback - callback: (err: any, value: T, ...values: T[]) => void; - } - - export interface Inspection { - /** - * See if the underlying promise was fulfilled at the creation time of this inspection object. - */ - isFulfilled(): boolean; - - /** - * See if the underlying promise was rejected at the creation time of this inspection object. - */ - isRejected(): boolean; - - /** - * See if the underlying promise was defer at the creation time of this inspection object. - */ - isPending(): boolean; - - /** - * Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object. - * - * throws `TypeError` - */ - value(): T; - - /** - * Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object. - * - * throws `TypeError` - */ - reason(): any; - } -} - -declare module 'bluebird' { - export = Promise; -} diff --git a/typings/chai/index.d.ts b/typings/chai/index.d.ts deleted file mode 100644 index ba75d951e..000000000 --- a/typings/chai/index.d.ts +++ /dev/null @@ -1,529 +0,0 @@ -// Generated by typings -// Source: https://raw.githubusercontent.com/typed-typings/npm-assertion-error/105841317bd2bdd5d110bfb763e49e482a77230d/main.d.ts -declare module '~chai~assertion-error' { -// Type definitions for assertion-error 1.0.0 -// Project: https://github.com/chaijs/assertion-error -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -export class AssertionError implements Error { - constructor(message: string, props?: any, ssf?: Function); - public name: string; - public message: string; - public showDiff: boolean; - public stack: string; - - /** - * Allow errors to be converted to JSON for static transfer. - * - * @param {Boolean} include stack (default: `true`) - * @return {Object} object that can be `JSON.stringify` - */ - public toJSON(stack: boolean): Object; -} -} - -// Generated by typings -// Source: https://raw.githubusercontent.com/types/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Assert.d.ts -declare module '~chai/lib/Assert' { -export interface AssertStatic extends Assert { -} - -export interface Assert { - /** - * @param expression Expression to test for truthiness. - * @param message Message to display on error. - */ - (expression: any, message?: string): void; - (expression: any, messageCallback: () => string): void; - - fail(actual?: any, expected?: any, msg?: string, operator?: string): void; - - ok(val: any, msg?: string): void; - isOk(val: any, msg?: string): void; - notOk(val: any, msg?: string): void; - isNotOk(val: any, msg?: string): void; - - equal(act: any, exp: any, msg?: string): void; - notEqual(act: any, exp: any, msg?: string): void; - - strictEqual(act: any, exp: any, msg?: string): void; - notStrictEqual(act: any, exp: any, msg?: string): void; - - deepEqual(act: any, exp: any, msg?: string): void; - notDeepEqual(act: any, exp: any, msg?: string): void; - - isTrue(val: any, msg?: string): void; - isFalse(val: any, msg?: string): void; - - isNotTrue(val: any, msg?: string): void; - isNotFalse(val: any, msg?: string): void; - - isNull(val: any, msg?: string): void; - isNotNull(val: any, msg?: string): void; - - isUndefined(val: any, msg?: string): void; - isDefined(val: any, msg?: string): void; - - isNaN(val: any, msg?: string): void; - isNotNaN(val: any, msg?: string): void; - - isAbove(val: number, abv: number, msg?: string): void; - isBelow(val: number, blw: number, msg?: string): void; - - isAtLeast(val: number, atlst: number, msg?: string): void; - isAtMost(val: number, atmst: number, msg?: string): void; - - isFunction(val: any, msg?: string): void; - isNotFunction(val: any, msg?: string): void; - - isObject(val: any, msg?: string): void; - isNotObject(val: any, msg?: string): void; - - isArray(val: any, msg?: string): void; - isNotArray(val: any, msg?: string): void; - - isString(val: any, msg?: string): void; - isNotString(val: any, msg?: string): void; - - isNumber(val: any, msg?: string): void; - isNotNumber(val: any, msg?: string): void; - - isBoolean(val: any, msg?: string): void; - isNotBoolean(val: any, msg?: string): void; - - typeOf(val: any, type: string, msg?: string): void; - notTypeOf(val: any, type: string, msg?: string): void; - - instanceOf(val: any, type: Function, msg?: string): void; - notInstanceOf(val: any, type: Function, msg?: string): void; - - include(exp: string, inc: any, msg?: string): void; - include(exp: any[], inc: any, msg?: string): void; - include(exp: Object, inc: Object, msg?: string): void; - - notInclude(exp: string, inc: any, msg?: string): void; - notInclude(exp: any[], inc: any, msg?: string): void; - - match(exp: any, re: RegExp, msg?: string): void; - notMatch(exp: any, re: RegExp, msg?: string): void; - - property(obj: Object, prop: string, msg?: string): void; - notProperty(obj: Object, prop: string, msg?: string): void; - deepProperty(obj: Object, prop: string, msg?: string): void; - notDeepProperty(obj: Object, prop: string, msg?: string): void; - - propertyVal(obj: Object, prop: string, val: any, msg?: string): void; - propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - - deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; - deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - - lengthOf(exp: any, len: number, msg?: string): void; - - throw(fn: Function, msg?: string): void; - throw(fn: Function, regExp: RegExp): void; - throw(fn: Function, errType: Function, msg?: string): void; - throw(fn: Function, errType: Function, regExp: RegExp): void; - - throws(fn: Function, msg?: string): void; - throws(fn: Function, regExp: RegExp): void; - throws(fn: Function, errType: Function, msg?: string): void; - throws(fn: Function, errType: Function, regExp: RegExp): void; - - Throw(fn: Function, msg?: string): void; - Throw(fn: Function, regExp: RegExp): void; - Throw(fn: Function, errType: Function, msg?: string): void; - Throw(fn: Function, errType: Function, regExp: RegExp): void; - - doesNotThrow(fn: Function, msg?: string): void; - doesNotThrow(fn: Function, regExp: RegExp): void; - doesNotThrow(fn: Function, errType: Function, msg?: string): void; - doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; - - operator(val: any, operator: string, val2: any, msg?: string): void; - closeTo(act: number, exp: number, delta: number, msg?: string): void; - approximately(act: number, exp: number, delta: number, msg?: string): void; - - sameMembers(set1: any[], set2: any[], msg?: string): void; - sameDeepMembers(set1: any[], set2: any[], msg?: string): void; - includeMembers(superset: any[], subset: any[], msg?: string): void; - includeDeepMembers(superset: any[], subset: any[], msg?: string): void; - - ifError(val: any, msg?: string): void; - - isExtensible(obj: {}, msg?: string): void; - extensible(obj: {}, msg?: string): void; - isNotExtensible(obj: {}, msg?: string): void; - notExtensible(obj: {}, msg?: string): void; - - isSealed(obj: {}, msg?: string): void; - sealed(obj: {}, msg?: string): void; - isNotSealed(obj: {}, msg?: string): void; - notSealed(obj: {}, msg?: string): void; - - isFrozen(obj: Object, msg?: string): void; - frozen(obj: Object, msg?: string): void; - isNotFrozen(obj: Object, msg?: string): void; - notFrozen(obj: Object, msg?: string): void; - - oneOf(inList: any, list: any[], msg?: string): void; - - changes(fn: Function, obj: {}, property: string): void; - doesNotChange(fn: Function, obj: {}, property: string): void; - increases(fn: Function, obj: {}, property: string): void; - doesNotIncrease(fn: Function, obj: {}, property: string): void; - - decreases(fn: Function, obj: {}, property: string): void; - doesNotDecrease(fn: Function, obj: {}, property: string): void; - } -} -declare module 'chai/lib/Assert' { -export * from '~chai/lib/Assert'; -} - -// Generated by typings -// Source: https://raw.githubusercontent.com/types/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Assertion.d.ts -declare module '~chai/lib/Assertion' { -export interface AssertionStatic { - (target?: any, message?: string, stack?: Function): Assertion; - new (target?: any, message?: string, stack?: Function): Assertion; -} - -export interface Assertion extends LanguageChains, NumericComparison, TypeComparison { - not: Assertion; - deep: Deep; - any: KeyFilter; - all: KeyFilter; - a: TypeComparison; - an: TypeComparison; - include: Include; - includes: Include; - contain: Include; - contains: Include; - ok: Assertion; - true: Assertion; - false: Assertion; - null: Assertion; - undefined: Assertion; - NaN: Assertion; - exist: Assertion; - empty: Assertion; - arguments: Assertion; - Arguments: Assertion; - equal: Equal; - equals: Equal; - eq: Equal; - eql: Equal; - eqls: Equal; - property: Property; - ownProperty: OwnProperty; - haveOwnProperty: OwnProperty; - ownPropertyDescriptor: OwnPropertyDescriptor; - haveOwnPropertyDescriptor: OwnPropertyDescriptor; - length: Length; - lengthOf: Length; - match: Match; - matches: Match; - string(str: string, message?: string): Assertion; - keys: Keys; - key(str: string): Assertion; - throw: Throw; - throws: Throw; - Throw: Throw; - respondTo: RespondTo; - respondsTo: RespondTo; - itself: Assertion; - satisfy: Satisfy; - satisfies: Satisfy; - closeTo: CloseTo; - approximately: CloseTo; - members: Members; - increase: PropertyChange; - increases: PropertyChange; - decrease: PropertyChange; - decreases: PropertyChange; - change: PropertyChange; - changes: PropertyChange; - extensible: Assertion; - sealed: Assertion; - frozen: Assertion; - oneOf(list: any[], message?: string): Assertion; -} - -export interface LanguageChains { - to: Assertion; - be: Assertion; - been: Assertion; - is: Assertion; - that: Assertion; - which: Assertion; - and: Assertion; - has: Assertion; - have: Assertion; - with: Assertion; - at: Assertion; - of: Assertion; - same: Assertion; -} - -export interface NumericComparison { - above: NumberComparer; - gt: NumberComparer; - greaterThan: NumberComparer; - least: NumberComparer; - gte: NumberComparer; - below: NumberComparer; - lt: NumberComparer; - lessThan: NumberComparer; - most: NumberComparer; - lte: NumberComparer; - within(start: number, finish: number, message?: string): Assertion; -} - -export interface NumberComparer { - (value: number, message?: string): Assertion; -} - -export interface TypeComparison { - (type: string, message?: string): Assertion; - instanceof: InstanceOf; - instanceOf: InstanceOf; -} - -export interface InstanceOf { - (constructor: Object, message?: string): Assertion; -} - -export interface CloseTo { - (expected: number, delta: number, message?: string): Assertion; -} - -export interface Deep { - equal: Equal; - equals: Equal; - eq: Equal; - include: Include; - property: Property; - members: Members; -} - -export interface KeyFilter { - keys: Keys; -} - -export interface Equal { - (value: any, message?: string): Assertion; -} - -export interface Property { - (name: string, value?: any, message?: string): Assertion; -} - -export interface OwnProperty { - (name: string, message?: string): Assertion; -} - -export interface OwnPropertyDescriptor { - (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; - (name: string, message?: string): Assertion; -} - -export interface Length extends LanguageChains, NumericComparison { - (length: number, message?: string): Assertion; -} - -export interface Include { - (value: Object, message?: string): Assertion; - (value: string, message?: string): Assertion; - (value: number, message?: string): Assertion; - string(value: string, message?: string): Assertion; - keys: Keys; - members: Members; - any: KeyFilter; - all: KeyFilter; -} - -export interface Match { - (regexp: RegExp | string, message?: string): Assertion; -} - -export interface Keys { - (...keys: any[]): Assertion; - (keys: any[]): Assertion; - (keys: Object): Assertion; -} - -export interface Throw { - (): Assertion; - (expected: string, message?: string): Assertion; - (expected: RegExp, message?: string): Assertion; - (constructor: Error, expected?: string, message?: string): Assertion; - (constructor: Error, expected?: RegExp, message?: string): Assertion; - (constructor: Function, expected?: string, message?: string): Assertion; - (constructor: Function, expected?: RegExp, message?: string): Assertion; -} - -export interface RespondTo { - (method: string, message?: string): Assertion; -} - -export interface Satisfy { - (matcher: Function, message?: string): Assertion; -} - -export interface Members { - (set: any[], message?: string): Assertion; -} - -export interface PropertyChange { - (object: Object, prop: string, msg?: string): Assertion; -} -} -declare module 'chai/lib/Assertion' { -export * from '~chai/lib/Assertion'; -} - -// Generated by typings -// Source: https://raw.githubusercontent.com/types/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Expect.d.ts -declare module '~chai/lib/Expect' { -import {AssertionStatic} from '~chai/lib/Assertion'; - -export interface ExpectStatic extends AssertionStatic { - fail(actual?: any, expected?: any, message?: string, operator?: string): void; -} -} -declare module 'chai/lib/Expect' { -export * from '~chai/lib/Expect'; -} - -// Generated by typings -// Source: https://raw.githubusercontent.com/types/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Should.d.ts -declare module '~chai/lib/Should' { -export interface Should extends ShouldAssertion { - not: ShouldAssertion; - fail(actual: any, expected: any, message?: string, operator?: string): void; -} - -export interface ShouldAssertion { - Throw: ShouldThrow; - throw: ShouldThrow; - equal(value1: any, value2: any, message?: string): void; - exist(value: any, message?: string): void; -} - -export interface ShouldThrow { - (actual: Function): void; - (actual: Function, expected: string | RegExp, message?: string): void; - (actual: Function, constructor: Error | Function, expected?: string | RegExp, message?: string): void; -} -} -declare module 'chai/lib/Should' { -export * from '~chai/lib/Should'; -} - -// Generated by typings -// Source: https://raw.githubusercontent.com/types/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Config.d.ts -declare module '~chai/lib/Config' { -export interface Config { - includeStack: boolean; - showDiff: boolean; - truncateThreshold: number; -} -} -declare module 'chai/lib/Config' { -export * from '~chai/lib/Config'; -} - -// Generated by typings -// Source: https://raw.githubusercontent.com/types/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Utils.d.ts -declare module '~chai/lib/Utils' { -import {Assertion} from '~chai/lib/Assertion'; - -export interface PathInfo { - parent: any; - name: number|string; - value: any; - exists: boolean; -} - -export interface Utils { - addChainableMethod(ctx: any, name: string, chainingBehavior: (value: any) => void): void; - addMethod(ctx: any, name: string, method: (value: any) => void): void; - addProperty(ctx: any, name: string, getter: () => void): void; - expectTypes(obj: Object, types: string[]): void; - flag(obj: Object, key: string, value?: any): any; - getActual(obj: Object, actual?: any): any; - getEnumerableProperties(obj: Object): string[]; - getMessage(obj: Object, params: any[]): string; - getMessage(obj: Object, message: string, negateMessage: string): string; - getName(func: Function): string; - getPathInfo(path: string, obj: Object): PathInfo; - getPathValue(path: string, obj: Object): any; - getProperties(obj: Object): string[]; - hasProperty(obj: Object, name: string): boolean; - transferFlags(assertion: Assertion | any, obj: Object, includeAll?: boolean): void; - inspect(obj: any): any; -} -} -declare module 'chai/lib/Utils' { -export * from '~chai/lib/Utils'; -} - -// Generated by typings -// Source: https://raw.githubusercontent.com/types/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/lib/Chai.d.ts -declare module '~chai/lib/Chai' { -import * as AE from '~chai~assertion-error'; - -import * as Assert from '~chai/lib/Assert'; -import * as A from '~chai/lib/Assertion'; -import * as Expect from '~chai/lib/Expect'; -import * as Should from '~chai/lib/Should'; -import * as Config from '~chai/lib/Config'; -import * as Utils from '~chai/lib/Utils'; - -namespace chai { - export interface AssertionStatic extends A.AssertionStatic {} - export class AssertionError extends AE.AssertionError {} - export var Assertion: A.AssertionStatic; - export var expect: Expect.ExpectStatic; - export var assert: Assert.AssertStatic; - export var config: Config.Config; - export var util: Utils.Utils; - export function should(): Should.Should; - export function Should(): Should.Should; - /** - * Provides a way to extend the internals of Chai - */ - export function use(fn: (chai: any, utils: Utils.Utils) => void): typeof chai; -} - -export = chai; - -/* tslint:disable:no-internal-module */ -global { - interface Object { - should: A.Assertion; - } -} -} -declare module 'chai/lib/Chai' { -import main = require('~chai/lib/Chai'); -export = main; -} - -// Generated by typings -// Source: https://raw.githubusercontent.com/types/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/index.d.ts -declare module 'chai' { -// Type definitions for chai 3.4.0 -// Project: http://chaijs.com/ -// Original Definitions by: Jed Mao , -// Bart van der Schoor , -// Andrew Brown , -// Olivier Chevet , -// Matt Wistrand - -import chai = require('~chai/lib/Chai'); - -export = chai; -} diff --git a/typings/fs-extra-promise/fs-extra-promise.d.ts b/typings/fs-extra-promise/fs-extra-promise.d.ts deleted file mode 100644 index c57403c79..000000000 --- a/typings/fs-extra-promise/fs-extra-promise.d.ts +++ /dev/null @@ -1,265 +0,0 @@ -// Type definitions for fs-extra-promise -// Project: https://github.com/overlookmotel/fs-extra-promise -// Definitions by: midknight41 , Jason Swearingen - -// Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts via TSD fs-extra definition - -/// -/// - -declare module "fs-extra-promise" { - import stream = require("stream"); - import Promise = require("bluebird"); - - export interface Stats { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - dev: number; - ino: number; - mode: number; - nlink: number; - uid: number; - gid: number; - rdev: number; - size: number; - blksize: number; - blocks: number; - atime: Date; - mtime: Date; - ctime: Date; - } - - export interface FSWatcher { - close(): void; - } - - export class ReadStream extends stream.Readable { } - export class WriteStream extends stream.Writable { } - - //extended methods - export function copy(src: string, dest: string, callback?: (err: Error) => void): void; - export function copy(src: string, dest: string, filter: (src: string) => boolean, callback?: (err: Error) => void): void; - - export function copySync(src: string, dest: string): void; - export function copySync(src: string, dest: string, filter: (src: string) => boolean): void; - - export function createFile(file: string, callback?: (err: Error) => void): void; - export function createFileSync(file: string): void; - - export function mkdirs(dir: string, callback?: (err: Error) => void): void; - export function mkdirp(dir: string, callback?: (err: Error) => void): void; - export function mkdirsSync(dir: string): void; - export function mkdirpSync(dir: string): void; - - export function outputFile(file: string, data: any, callback?: (err: Error) => void): void; - export function outputFileSync(file: string, data: any): void; - - export function outputJson(file: string, data: any, callback?: (err: Error) => void): void; - export function outputJSON(file: string, data: any, callback?: (err: Error) => void): void; - export function outputJsonSync(file: string, data: any): void; - export function outputJSONSync(file: string, data: any): void; - - export function readJson(file: string, callback?: (err: Error) => void): void; - export function readJson(file: string, options?: OpenOptions, callback?: (err: Error) => void): void; - export function readJSON(file: string, callback?: (err: Error) => void): void; - export function readJSON(file: string, options?: OpenOptions, callback?: (err: Error) => void): void; - - export function readJsonSync(file: string, options?: OpenOptions): void; - export function readJSONSync(file: string, options?: OpenOptions): void; - - export function remove(dir: string, callback?: (err: Error) => void): void; - export function removeSync(dir: string): void; - // export function delete(dir: string, callback?: (err: Error) => void): void; - // export function deleteSync(dir: string): void; - - export function writeJson(file: string, object: any, callback?: (err: Error) => void): void; - export function writeJson(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void; - export function writeJSON(file: string, object: any, callback?: (err: Error) => void): void; - export function writeJSON(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void; - - export function writeJsonSync(file: string, object: any, options?: OpenOptions): void; - export function writeJSONSync(file: string, object: any, options?: OpenOptions): void; - - export function rename(oldPath: string, newPath: string, callback?: (err: Error) => void): void; - export function renameSync(oldPath: string, newPath: string): void; - export function truncate(fd: number, len: number, callback?: (err: Error) => void): void; - export function truncateSync(fd: number, len: number): void; - export function chown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void; - export function chownSync(path: string, uid: number, gid: number): void; - export function fchown(fd: number, uid: number, gid: number, callback?: (err: Error) => void): void; - export function fchownSync(fd: number, uid: number, gid: number): void; - export function lchown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void; - export function lchownSync(path: string, uid: number, gid: number): void; - export function chmod(path: string, mode: number, callback?: (err: Error) => void): void; - export function chmod(path: string, mode: string, callback?: (err: Error) => void): void; - export function chmodSync(path: string, mode: number): void; - export function chmodSync(path: string, mode: string): void; - export function fchmod(fd: number, mode: number, callback?: (err: Error) => void): void; - export function fchmod(fd: number, mode: string, callback?: (err: Error) => void): void; - export function fchmodSync(fd: number, mode: number): void; - export function fchmodSync(fd: number, mode: string): void; - export function lchmod(path: string, mode: string, callback?: (err: Error) => void): void; - export function lchmod(path: string, mode: number, callback?: (err: Error) => void): void; - export function lchmodSync(path: string, mode: number): void; - export function lchmodSync(path: string, mode: string): void; - export function stat(path: string, callback?: (err: Error, stats: Stats) => void): void; - export function lstat(path: string, callback?: (err: Error, stats: Stats) => void): void; - export function fstat(fd: number, callback?: (err: Error, stats: Stats) => void): void; - export function statSync(path: string): Stats; - export function lstatSync(path: string): Stats; - export function fstatSync(fd: number): Stats; - export function link(srcpath: string, dstpath: string, callback?: (err: Error) => void): void; - export function linkSync(srcpath: string, dstpath: string): void; - export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err: Error) => void): void; - export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; - export function readlink(path: string, callback?: (err: Error, linkString: string) => void): void; - export function realpath(path: string, callback?: (err: Error, resolvedPath: string) => void): void; - export function realpath(path: string, cache: string, callback: (err: Error, resolvedPath: string) => void): void; - export function realpathSync(path: string, cache?: boolean): string; - export function unlink(path: string, callback?: (err: Error) => void): void; - export function unlinkSync(path: string): void; - export function rmdir(path: string, callback?: (err: Error) => void): void; - export function rmdirSync(path: string): void; - export function mkdir(path: string, mode?: number, callback?: (err: Error) => void): void; - export function mkdir(path: string, mode?: string, callback?: (err: Error) => void): void; - export function mkdirSync(path: string, mode?: number): void; - export function mkdirSync(path: string, mode?: string): void; - export function readdir(path: string, callback?: (err: Error, files: string[]) => void): void; - export function readdirSync(path: string): string[]; - export function close(fd: number, callback?: (err: Error) => void): void; - export function closeSync(fd: number): void; - export function open(path: string, flags: string, mode?: string, callback?: (err: Error, fs: number) => void): void; - export function openSync(path: string, flags: string, mode?: string): number; - export function utimes(path: string, atime: number, mtime: number, callback?: (err: Error) => void): void; - export function utimesSync(path: string, atime: number, mtime: number): void; - export function futimes(fd: number, atime: number, mtime: number, callback?: (err: Error) => void): void; - export function futimesSync(fd: number, atime: number, mtime: number): void; - export function fsync(fd: number, callback?: (err: Error) => void): void; - export function fsyncSync(fd: number): void; - export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: NodeBuffer) => void): void; - export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; - export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void): void; - export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; - export function readFile(filename: string, encoding: string, callback: (err: Error, data: string) => void): void; - export function readFile(filename: string, options: OpenOptions, callback: (err: Error, data: string) => void): void; - export function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void): void; - export function readFileSync(filename: string): NodeBuffer; - export function readFileSync(filename: string, encoding: string): string; - export function readFileSync(filename: string, options: OpenOptions): string; - export function writeFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void; - export function writeFile(filename: string, data: any, options?: OpenOptions, callback?: (err: Error) => void): void; - export function writeFileSync(filename: string, data: any, encoding?: string): void; - export function writeFileSync(filename: string, data: any, option?: OpenOptions): void; - export function appendFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void; - export function appendFile(filename: string, data: any, option?: OpenOptions, callback?: (err: Error) => void): void; - export function appendFileSync(filename: string, data: any, encoding?: string): void; - export function appendFileSync(filename: string, data: any, option?: OpenOptions): void; - export function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void; - export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void; - export function unwatchFile(filename: string, listener?: Stats): void; - export function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; - export function exists(path: string, callback?: (exists: boolean) => void): void; - export function existsSync(path: string): boolean; - export function ensureDir(path: string, cb: (err: Error) => void): void; - - export interface OpenOptions { - encoding?: string; - flag?: string; - } - - export interface ReadStreamOptions { - flags?: string; - encoding?: string; - fd?: number; - mode?: number; - autoClose?: boolean; - } - - export interface WriteStreamOptions { - flags?: string; - defaultEncounding?: string; - fd?: number; - mode?: number; - } - - export function createReadStream(path: string, options?: ReadStreamOptions): ReadStream; - export function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream; - - - - //promisified versions - export function copyAsync(src: string, dest: string): Promise; - export function copyAsync(src: string, dest: string, filter: (src: string) => boolean): Promise; - - export function createFileAsync(file: string): Promise; - - export function mkdirsAsync(dir: string): Promise; - export function mkdirpAsync(dir: string): Promise; - - export function outputFileAsync(file: string, data: any): Promise; - - export function outputJsonAsync(file: string, data: any): Promise; - export function outputJSONAsync(file: string, data: any): Promise; - - export function readJsonAsync(file: string): Promise; - export function readJsonAsync(file: string, options?: OpenOptions): Promise; - export function readJSONAsync(file: string): Promise; - export function readJSONAsync(file: string, options?: OpenOptions): Promise; - - - export function removeAsync(dir: string): Promise; - // export function deleteAsync(dir: string):Promise; - - export function writeJsonAsync(file: string, object: any): Promise; - export function writeJsonAsync(file: string, object: any, options?: OpenOptions): Promise; - export function writeJSONAsync(file: string, object: any): Promise; - export function writeJSONAsync(file: string, object: any, options?: OpenOptions): Promise; - - export function renameAsync(oldPath: string, newPath: string): Promise; - export function truncateAsync(fd: number, len: number): Promise; - export function chownAsync(path: string, uid: number, gid: number): Promise; - export function fchownAsync(fd: number, uid: number, gid: number): Promise; - export function lchownAsync(path: string, uid: number, gid: number): Promise; - export function chmodAsync(path: string, mode: number): Promise; - export function chmodAsync(path: string, mode: string): Promise; - export function fchmodAsync(fd: number, mode: number): Promise; - export function fchmodAsync(fd: number, mode: string): Promise; - export function lchmodAsync(path: string, mode: string): Promise; - export function lchmodAsync(path: string, mode: number): Promise; - export function statAsync(path: string): Promise; - export function lstatAsync(path: string): Promise; - export function fstatAsync(fd: number): Promise; - export function linkAsync(srcpath: string, dstpath: string): Promise; - export function symlinkAsync(srcpath: string, dstpath: string, type?: string): Promise; - export function readlinkAsync(path: string): Promise; - export function realpathAsync(path: string): Promise; - export function realpathAsync(path: string, cache: string): Promise; - export function unlinkAsync(path: string): Promise; - export function rmdirAsync(path: string): Promise; - export function mkdirAsync(path: string, mode?: number): Promise; - export function mkdirAsync(path: string, mode?: string): Promise; - export function readdirAsync(path: string): Promise; - export function closeAsync(fd: number): Promise; - export function openAsync(path: string, flags: string, mode?: string): Promise; - export function utimesAsync(path: string, atime: number, mtime: number): Promise; - export function futimesAsync(fd: number, atime: number, mtime: number): Promise; - export function fsyncAsync(fd: number): Promise; - export function writeAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>; - export function readAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>; - export function readFileAsync(filename: string, encoding: string): Promise; - export function readFileAsync(filename: string, options: OpenOptions): Promise; - export function readFileAsync(filename: string): Promise; - export function writeFileAsync(filename: string, data: any, encoding?: string): Promise; - export function writeFileAsync(filename: string, data: any, options?: OpenOptions): Promise; - export function appendFileAsync(filename: string, data: any, encoding?: string): Promise; - export function appendFileAsync(filename: string, data: any, option?: OpenOptions): Promise; - - export function existsAsync(path: string): Promise; - export function ensureDirAsync(path: string): Promise; -} - diff --git a/typings/mkdirp/mkdirp.d.ts b/typings/mkdirp/mkdirp.d.ts deleted file mode 100644 index ddaffbaef..000000000 --- a/typings/mkdirp/mkdirp.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "mkdirp" { - export function mkdirp( - dir: string, - opts: { - mode?: number - }, - cb: (err: any)=>void): void; -} \ No newline at end of file diff --git a/typings/ref.d.ts b/typings/ref.d.ts deleted file mode 100644 index c114b1823..000000000 --- a/typings/ref.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -/// -/// \ No newline at end of file diff --git a/typings/semver/semver.d.ts b/typings/semver/semver.d.ts deleted file mode 100644 index cb8efa4f5..000000000 --- a/typings/semver/semver.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -// Type definitions for semver v2.2.1 -// Project: https://github.com/isaacs/node-semver -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module SemVerModule { - /** - * Return the parsed version, or null if it's not valid. - */ - function valid(v: 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; - - // Comparison - /** - * v1 > v2 - */ - function gt(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 >= v2 - */ - function gte(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 < v2 - */ - function lt(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 <= v2 - */ - function lte(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. - */ - function eq(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 != v2 The opposite of eq. - */ - function neq(v1: string, v2: string, loose?: boolean): boolean; - /** - * Pass in a comparison string, and it'll call the corresponding semver comparison function. "===" and "!==" do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided. - */ - function cmp(v1: string, comparator: any, v2: string, loose?: boolean): boolean; - /** - * Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort(). - */ - function compare(v1: string, v2: string, loose?: boolean): number; - /** - * 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; - - // Ranges - /** - * Return the valid range or null if it's not valid - */ - function validRange(range: string, loose?: boolean): string; - /** - * Return true if the version satisfies the range. - */ - function satisfies(version: string, range: string, loose?: boolean): boolean; - /** - * 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 true if version is greater than all the versions possible in the range. - */ - function gtr(version: string, range: string, loose?: boolean): boolean; - /** - * Return true if version is less than all the versions possible in the range. - */ - function ltr(version: string, range: string, loose?: boolean): boolean; - /** - * Return true if the version is outside the bounds of the range in either the high or low direction. The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) - */ - function outside(version: string, range: string, hilo: string, loose?: boolean): boolean; - - class SemVerBase { - raw: string; - loose: boolean; - format(): string; - inspect(): string; - toString(): string; - } - - class SemVer extends SemVerBase { - constructor(version: string, loose?: boolean); - - major: number; - minor: number; - patch: number; - version: string; - build: string[]; - prerelease: string[]; - - compare(other:SemVer): number; - compareMain(other:SemVer): number; - comparePre(other:SemVer): number; - inc(release: string): SemVer; - } - - class Comparator extends SemVerBase { - constructor(comp: string, loose?: boolean); - - semver: SemVer; - operator: string; - value: boolean; - parse(comp: string): void; - test(version:SemVer): boolean; - } - - class Range extends SemVerBase { - constructor(range: string, loose?: boolean); - - set: Comparator[][]; - parseRange(range: string): Comparator[]; - test(version: SemVer): boolean; - } -} - -declare module "semver" { - export = SemVerModule; -} diff --git a/typings/tmp/tmp.d.ts b/typings/tmp/tmp.d.ts deleted file mode 100644 index b62673442..000000000 --- a/typings/tmp/tmp.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Type definitions for tmp v0.0.28 -// Project: https://www.npmjs.com/package/tmp -// Definitions by: Jared Klopper - -declare module "tmp" { - - module 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; -}