This commit is contained in:
Chris Dias 2017-03-24 18:09:39 -07:00
Родитель 75a9a69ddb
Коммит 72ff19bdc5
47 изменённых файлов: 266 добавлений и 3613 удалений

Просмотреть файл

@ -6,9 +6,4 @@ router.get('/', function(req, res, next) {
res.render('index', { title: 'Visual Studio Code!' });
});
/* GET Quick Start. */
router.get('/quickstart', function(req, res, next) {
res.render('quickstart');
});
module.exports = router;

Просмотреть файл

@ -1,4 +0,0 @@
extends layout
block content
include:md ../vscodequickstart.md

86
node-express-typescript/.vscode/launch.json поставляемый
Просмотреть файл

@ -1,56 +1,36 @@
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Launch ./src/www.js",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
// Workspace relative or absolute path to the program.
"program": "${workspaceRoot}/src/www.js",
// Automatically stop program after launch.
"stopOnEntry": false,
// Command line arguments passed to the program.
"args": [],
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
"cwd": "${workspaceRoot}",
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
"runtimeExecutable": null,
// Optional arguments passed to the runtime executable.
"runtimeArgs": [],
// Environment variables passed to the program.
"env": { },
// Use JavaScript source maps (if they exist).
"sourceMaps": true,
// If JavaScript source maps are enabled, the generated code is expected in this directory.
"outFiles": ["${workspaceRoot}/src/**/*.js"],
"smartStep": true
},
{
"request": "launch",
"name": "Debug Tests",
"type": "node",
// Notice, we bypass the launcher and start the test runner directly
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
// run the tests in the tests folder
"args": ["tests"],
"cwd": "${workspaceRoot}",
"runtimeExecutable": null,
"env": { },
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/tests/**/*.js"]
},
{
"name": "Launch Program",
"program": "${workspaceRoot}\\out\\www.js"
},
{
"type": "node",
"request": "attach",
"name": "Attach to running instance",
"type": "node",
// Port to attach to, must match port in gulpfile.js
"port": 5858
// ,"processId": "${command.PickProcess}"
}
]
}
"name": "Attach to Port",
"address": "localhost",
"port": 5858
},
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${workspaceRoot}/tests/out"
],
"internalConsoleOptions": "openOnSessionStart"
}
]
}

11
node-express-typescript/.vscode/settings.json поставляемый
Просмотреть файл

@ -1,11 +0,0 @@
// Place your settings in this file to overwrite default and user settings.
{
// Configure glob patterns for excluding files and folders.
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/*.js.map": true,
"**/*.js": {"when": "$(basename).ts"}
}
}

45
node-express-typescript/.vscode/tasks.json поставляемый
Просмотреть файл

@ -1,4 +1,6 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
@ -7,13 +9,32 @@
],
"tasks": [
{
"taskName": "build",
"taskName": "buildAll",
"args": [],
"isBuildCommand": true,
"problemMatcher": "$tsc"
"isBackground": false,
"problemMatcher": [
"$lessCompile",
"$tsc"
]
},
{
"taskName": "less",
"problemMatcher": "$lessCompile"
"taskName": "default",
"args": [],
"isBackground": false,
"problemMatcher": [
"$lessCompile",
"$tsc"
]
},
{
"taskName": "watch",
"args": [],
"isBackground": true,
"problemMatcher": [
"$lessCompile",
"$tsc"
]
},
{
"taskName": "test",
@ -21,17 +42,11 @@
"isTestCommand": true
},
{
"taskName": "buildTests",
"problemMatcher": "$tsc"
},
{
"taskName": "buildAll",
"problemMatcher": ["$tsc", "$lessCompile"]
},
{
"taskName": "watch",
"problemMatcher": ["$tsc", "$lessCompile"]
"taskName": "less",
"args": [],
"problemMatcher": [
"$lessCompile"
]
}
]
}

Просмотреть файл

@ -11,4 +11,4 @@
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](http://daringfireball.net)
** Enjoy!**
**Enjoy!**

Просмотреть файл

@ -15,14 +15,13 @@ gulp.task('less', function () {
.pipe(less({
paths: [path.join(__dirname, 'less', 'includes')]
}))
.pipe(gulp.dest('./src/public/stylesheets'));
.pipe(gulp.dest('./out/public/stylesheets'));
});
// run mocha tests in the ./tests folder
gulp.task('test', function () {
return gulp.src('./tests/test*.js', { read: false })
return gulp.src('./tests/out/test*.js', { read: false })
// gulp-mocha needs filepaths so you can't have any plugins before it
.pipe(mocha());
});
@ -31,7 +30,7 @@ gulp.task('test', function () {
gulp.task('browser-sync', ['nodemon', 'watch'], function () {
browserSync.init(null, {
proxy: "http://localhost:3000",
files: ["src/public/**/*.*", "src/views/**/*.*"],
files: ["out/**/*.*", "out/routes/**/*.*", "out/public/**/*.*", "out/views/**/*.*"],
port: 7000,
});
});
@ -41,8 +40,8 @@ gulp.task('nodemon', function (cb) {
var started = false;
return nodemon({
script: 'src/www.js',
watch: ['src/*.js']
script: 'out/www.js',
watch: ['out/*.js']
}).on('start', function () {
if (!started) {
cb();
@ -57,31 +56,20 @@ gulp.task('nodemon', function (cb) {
});
});
// TypeScript build for /src folder, pipes in .d.ts files from typings folder
// TypeScript build for /src folder
var tsConfigSrc = tsb.create('src/tsconfig.json');
gulp.task('build', function () {
return gulp.src(['typings/**/*.ts', 'src/**/*.ts'])
return gulp.src('./src/**/*.ts')
.pipe(tsConfigSrc())
.pipe(gulp.dest('src'));
});
// TypeScript build for /tests folder, pipes in .d.ts files from typings folder
// as well as the src/tsd.d.ts which is referenced by tests/tsd.d.ts
var tsConfigTests = tsb.create('tests/tsconfig.json');
gulp.task('buildTests', function () {
// pipe in all necessary files
return gulp.src(['typings/**/*.ts', 'tests/**/*.ts', 'src/tsd.d.ts'])
.pipe(tsConfigTests())
.pipe(gulp.dest('tests'));
.pipe(gulp.dest('./out'));
});
// watch for any TypeScript or LESS file changes
// if a file change is detected, run the TypeScript or LESS compile gulp tasks
gulp.task('watch', function () {
gulp.watch('src/**/*.ts', ['build']);
gulp.watch('tests/**/*.ts', ['buildTests']);
gulp.watch('src/styles/**/*.less', ['less']);
});
gulp.task('buildAll', ['build', 'buildTests', 'less']);
gulp.task('buildAll', ['build', 'less']);
gulp.task('default', ['browser-sync']);

Просмотреть файл

@ -1,52 +1,52 @@
"use strict";
var express = require('express');
var logger = require('morgan');
var bodyParser = require('body-parser');
var path_1 = require('path');
var index_1 = require('./routes/index');
var users_1 = require('./routes/users');
var cookieParser = require('cookie-parser'); // this module doesn't use the ES6 default export yet
var app = express();
// view engine setup
app.set('views', path_1.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
//app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path_1.join(__dirname, 'public')));
app.use('/', index_1.default);
app.use('/users', users_1.default);
// catch 404 and forward to error handler
app.use(function (req, res, next) {
var err = new Error('Not Found');
err['status'] = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function (error, req, res, next) {
res.status(error['status'] || 500);
res.render('error', {
message: error.message,
error: error
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function (error, req, res, next) {
res.status(error['status'] || 500);
res.render('error', {
message: error.message,
error: {}
});
return null;
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = app;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var express = require("express");
var logger = require("morgan");
var bodyParser = require("body-parser");
var path = require("path");
var index_1 = require("./routes/index");
var users_1 = require("./routes/users");
var cookieParser = require("cookie-parser"); // this module doesn't use the ES6 default export yet
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
//app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', index_1.default);
app.use('/users', users_1.default);
// catch 404 and forward to error handler
app.use(function (req, res, next) {
var err = new Error('Not Found');
err['status'] = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function (error, req, res, next) {
res.status(error['status'] || 500);
res.render('error', {
message: error.message,
error: error
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function (error, req, res, next) {
res.status(error['status'] || 500);
res.render('error', {
message: error.message,
error: {}
});
return null;
});
exports.default = app;
//# sourceMappingURL=app.js.map

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,+BAAiC;AACjC,wCAA0C;AAC1C,2BAA6B;AAC7B,wCAAmC;AACnC,wCAAmC;AACnC,4CAA+C,CAAC,qDAAqD;AAErG,IAAM,GAAG,GAAoB,OAAO,EAAE,CAAC;AAEvC,oBAAoB;AACpB,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAChD,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAE/B,kDAAkD;AAClD,sDAAsD;AACtD,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACvB,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;AAC3B,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACpD,GAAG,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AC,OAAO;QACtB,KAAK,EAAE,EAAE;KACV,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAGH,kBAAe,GAAG,CAAC"}

Просмотреть файл

@ -1,14 +1,10 @@
"use strict";
var express_1 = require('express');
var index = express_1.Router();
/* GET home page. */
index.get('/', function (req, res, next) {
res.render('index', { title: 'Visual Studio Code!' });
});
/* GET Quick Start. */
index.get('/quickstart', function (req, res, next) {
res.render('quickstart');
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = index;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var express_1 = require("express");
var index = express_1.Router();
/* GET home page. */
index.get('/', function (req, res, next) {
res.render('index', { title: 'Visual Studio Code!' });
});
exports.default = index;
//# sourceMappingURL=index.js.map

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":";;AAAA,mCAAiC;AAEjC,IAAM,KAAK,GAAW,gBAAM,EAAE,CAAC;AAE/B,oBAAoB;AACpB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI;IACpC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAEH,kBAAe,KAAK,CAAC"}

Просмотреть файл

@ -1,10 +1,10 @@
"use strict";
var express_1 = require('express');
var users = express_1.Router();
/* GET users listing. */
users.get('/', function (req, res, next) {
res.send('respond with a resource');
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = users;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var express_1 = require("express");
var users = express_1.Router();
/* GET users listing. */
users.get('/', function (req, res, next) {
res.send('respond with a resource');
});
exports.default = users;
//# sourceMappingURL=users.js.map

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/routes/users.ts"],"names":[],"mappings":";;AAAA,mCAAiC;AAEjC,IAAM,KAAK,GAAU,gBAAM,EAAE,CAAC;AAE9B,wBAAwB;AACxB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI;IACpC,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC;AAEH,kBAAe,KAAK,CAAC"}

Просмотреть файл

@ -1,63 +1,64 @@
"use strict";
var app_1 = require('./app');
var debugModule = require('debug');
var http = require('http');
var debug = debugModule('node-express-typescript:server');
// Get port from environment and store in Express.
var port = normalizePort(process.env.PORT || '3000');
app_1.default.set('port', port);
// create server and listen on provided port (on all network interfaces).
var server = http.createServer(app_1.default);
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var app_1 = require("./app");
var debugModule = require("debug");
var http = require("http");
var debug = debugModule('node-express-typescript:server');
// Get port from environment and store in Express.
var port = normalizePort(process.env.PORT || '3000');
app_1.default.set('port', port);
// create server and listen on provided port (on all network interfaces).
var server = http.createServer(app_1.default);
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
console.log('Listening on ' + bind);
}
//# sourceMappingURL=www.js.map

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"www.js","sourceRoot":"","sources":["../src/www.ts"],"names":[],"mappings":";;AAAA,6BAAwB;AACxB,mCAAqC;AACrC,2BAA6B;AAE7B,IAAM,KAAK,GAAG,WAAW,CAAC,gCAAgC,CAAC,CAAC;AAE5D,kDAAkD;AAClD,IAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC;AACvD,aAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAEtB,yEAAyE;AACzE,IAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,aAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAEpC;;GAEG;AACH,uBAAuB,GAAQ;IAC7B,IAAI,IAAI,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAE7B,EAAE,CAAC,C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node ./src/www.js",
"test": "mocha ./tests/test.js"
"start": "node ./out/www.js",
"test": "mocha ./tests/out/test.js",
"compile": "node ./node_modules/typescript/bin/tsc -p ./src",
"compiletests": "node ./node_modules/typescript/bin/tsc -p ./tests"
},
"dependencies": {
"body-parser": "~1.13.2",
@ -17,6 +19,20 @@
"serve-favicon": "~2.3.0"
},
"devDependencies": {
"@types/body-parser": "^1.16.1",
"@types/cookie-parser": "^1.3.30",
"@types/debug": "^0.0.29",
"@types/express": "^4.0.35",
"@types/gulp": "^4.0.2",
"@types/gulp-less": "^0.0.30",
"@types/gulp-mocha": "^0.0.30",
"@types/gulp-nodemon": "^0.0.30",
"@types/marked": "^0.0.28",
"@types/mocha": "^2.2.40",
"@types/morgan": "^1.7.32",
"@types/node": "^7.0.10",
"@types/power-assert": "^1.4.29",
"@types/serve-favicon": "^2.2.28",
"browser-sync": "^2.18.8",
"gulp": "^3.9.1",
"gulp-less": "^3.3.0",

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":";AAAA,IAAY,OAAO,WAAM,SAAS,CAAC,CAAA;AACnC,IAAY,MAAM,WAAM,QAAQ,CAAC,CAAA;AACjC,IAAY,UAAU,WAAM,aAAa,CAAC,CAAA;AAC1C,qBAAmB,MAAM,CAAC,CAAA;AAC1B,sBAAkB,gBAAgB,CAAC,CAAA;AACnC,sBAAkB,gBAAgB,CAAC,CAAA;AACnC,IAAO,YAAY,WAAW,eAAe,CAAC,CAAC,CAAC,qDAAqD;AAErG,IAAM,GAAG,GAAoB,OAAO,EAAE,CAAC;AAEvC,oBAAoB;AACpB,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,WAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3C,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAE/B,kDAAkD;AAClD,sDAAsD;AACtD,GAAG,CAAC,GAAG,CAAC,MAAM,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CAAC,UAAC,KAAU,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI;IACjC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;IACnC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,EAAE;KACV,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAGH;kBAAe,GAAG,CAAC"}

Просмотреть файл

@ -1,7 +1,7 @@
import * as express from 'express';
import * as logger from 'morgan';
import * as bodyParser from 'body-parser';
import {join} from 'path';
import * as path from 'path';
import index from './routes/index';
import users from './routes/users';
import cookieParser = require('cookie-parser'); // this module doesn't use the ES6 default export yet
@ -9,7 +9,7 @@ import cookieParser = require('cookie-parser'); // this module doesn't use the E
const app: express.Express = express();
// view engine setup
app.set('views', join(__dirname, 'views'));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
@ -18,7 +18,7 @@ app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', index);
app.use('/users', users);

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,wBAAqB,SAAS,CAAC,CAAA;AAE/B,IAAM,KAAK,GAAG,gBAAM,EAAE,CAAC;AAEvB,oBAAoB;AACpB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI;IACpC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAEH,sBAAsB;AACtB,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI;IAC9C,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEH;kBAAe,KAAK,CAAC"}

Просмотреть файл

@ -1,15 +1,10 @@
import {Router} from 'express';
import { Router } from 'express';
const index = Router();
const index: Router = Router();
/* GET home page. */
index.get('/', function(req, res, next) {
res.render('index', { title: 'Visual Studio Code!' });
});
/* GET Quick Start. */
index.get('/quickstart', function(req, res, next) {
res.render('quickstart');
});
export default index;

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"file":"users.js","sourceRoot":"","sources":["users.ts"],"names":[],"mappings":";AAAA,wBAAqB,SAAS,CAAC,CAAA;AAE/B,IAAM,KAAK,GAAG,gBAAM,EAAE,CAAC;AAEvB,wBAAwB;AACxB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI;IACpC,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC;AAEH;kBAAe,KAAK,CAAC"}

Просмотреть файл

@ -1,6 +1,6 @@
import {Router} from 'express';
import { Router } from 'express';
const users = Router();
const users:Router = Router();
/* GET users listing. */
users.get('/', function(req, res, next) {

Просмотреть файл

@ -1,10 +1,15 @@
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"noImplicitAny": false,
"removeComments": false,
"preserveConstEnums": true
}
"target": "es5",
"outDir": "../out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "."
},
"exclude": [
"node_modules"
]
}

9
node-express-typescript/src/tsd.d.ts поставляемый
Просмотреть файл

@ -1,9 +0,0 @@
/// <reference path="../typings/body-parser/body-parser.d.ts" />
/// <reference path="../typings/cookie-parser/cookie-parser.d.ts" />
/// <reference path="../typings/debug/debug.d.ts" />
/// <reference path="../typings/express/express.d.ts" />
/// <reference path="../typings/morgan/morgan.d.ts" />
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/serve-favicon/serve-favicon.d.ts" />
/// <reference path="../typings/mocha/mocha.d.ts" />
/// <reference path="../typings/gulp/gulp.d.ts" />

Просмотреть файл

@ -1,4 +0,0 @@
extends layout
block content
include:md ../../vscodequickstart.md

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"file":"www.js","sourceRoot":"","sources":["www.ts"],"names":[],"mappings":";AAAA,oBAAgB,OAAO,CAAC,CAAA;AACxB,IAAO,WAAW,WAAW,OAAO,CAAC,CAAC;AACtC,IAAO,IAAI,WAAW,MAAM,CAAC,CAAC;AAE9B,IAAM,KAAK,GAAG,WAAW,CAAC,gCAAgC,CAAC,CAAC;AAE5D,kDAAkD;AAClD,IAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC;AACvD,aAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAEtB,yEAAyE;AACzE,IAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,aAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAEpC;;GAEG;AACH,uBAAuB,GAAQ;IAC7B,IAAI,IAAI,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAE7B,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,aAAa;QACb,MAAM,CAAC,GAAG,CAAC;IACb,CAAC;IAED,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,cAAc;QACd,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,iBAAiB,KAAK;IACpB,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC;QAC/B,MAAM,KAAK,CAAC;IACd,CAAC;IAED,IAAI,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ;UAC/B,OAAO,GAAG,IAAI;UACd,OAAO,GAAG,IAAI,CAAA;IAElB,uDAAuD;IACvD,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,+BAA+B,CAAC,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,KAAK,CAAC;QACR,KAAK,YAAY;YACf,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,oBAAoB,CAAC,CAAC;YAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,KAAK,CAAC;QACR;YACE,MAAM,KAAK,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;GAEG;AACH;IACE,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAC5B,IAAI,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ;UAC/B,OAAO,GAAG,IAAI;UACd,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;IAExB,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;AAChC,CAAC"}

Просмотреть файл

@ -1,6 +1,6 @@
import app from './app';
import debugModule = require('debug');
import http = require('http');
import * as debugModule from 'debug';
import * as http from 'http';
const debug = debugModule('node-express-typescript:server');
@ -69,5 +69,5 @@ function onListening() {
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
console.log('Listening on ' + bind);
}

Просмотреть файл

@ -1,4 +1,7 @@
var assert = require('assert');
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var assert = require("assert");
//var assert = require("assert");
describe('Array', function () {
describe('#indexOf()', function () {
it('should return -1 when the value is not present', function () {

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":[],"mappings":";;AACA,+BAAiC;AAGjC,iCAAiC;AAEjC,QAAQ,CAAC,OAAO,EAAE;IAChB,QAAQ,CAAC,YAAY,EAAE;QACrB,EAAE,CAAC,gDAAgD,EAAE;YACnD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AACA,IAAO,MAAM,WAAW,QAAQ,CAAC,CAAC;AAElC,QAAQ,CAAC,OAAO,EAAE;IAChB,QAAQ,CAAC,YAAY,EAAE;QACrB,EAAE,CAAC,gDAAgD,EAAE;YACnD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

Просмотреть файл

@ -1,5 +1,6 @@
import assert = require('assert');
import * as assert from 'assert';
import * as mocha from 'mocha';
describe('Array', function(){
describe('#indexOf()', function(){

Просмотреть файл

@ -1,10 +1,15 @@
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"noImplicitAny": false,
"removeComments": false,
"preserveConstEnums": true
}
"target": "es5",
"outDir": "./out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "."
},
"exclude": [
"node_modules"
]
}

1
node-express-typescript/tests/tsd.d.ts поставляемый
Просмотреть файл

@ -1 +0,0 @@
/// <reference path="../src/tsd.d.ts" />

Просмотреть файл

@ -1,36 +0,0 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "src/tsd.d.ts",
"installed": {
"express/express.d.ts": {
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
},
"node/node.d.ts": {
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
},
"serve-favicon/serve-favicon.d.ts": {
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
},
"morgan/morgan.d.ts": {
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
},
"cookie-parser/cookie-parser.d.ts": {
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
},
"body-parser/body-parser.d.ts": {
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
},
"debug/debug.d.ts": {
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
},
"mocha/mocha.d.ts": {
"commit": "983126e131a2b81739053d60e4bbdbb46d6577b7"
},
"gulp/gulp.d.ts": {
"commit": "3d2916191781fe400176a030c03722ac4b87f1c1"
}
}
}

Просмотреть файл

@ -1,138 +0,0 @@
// Type definitions for body-parser
// Project: http://expressjs.com
// Definitions by: Santi Albo <https://github.com/santialbo/>, VILIC VANE <https://vilic.info>, Jonathan Häberle <https://github.com/dreampulse/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
declare module "body-parser" {
import express = require('express');
/**
* bodyParser: use individual json/urlencoded middlewares
* @deprecated
*/
function bodyParser(options?: {
/**
* if deflated bodies will be inflated. (default: true)
*/
inflate?: boolean;
/**
* maximum request body size. (default: '100kb')
*/
limit?: any;
/**
* function to verify body content, the parsing can be aborted by throwing an error.
*/
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
/**
* only parse objects and arrays. (default: true)
*/
strict?: boolean;
/**
* passed to JSON.parse().
*/
receiver?: (key: string, value: any) => any;
/**
* parse extended syntax with the qs module. (default: true)
*/
extended?: boolean;
}): express.RequestHandler;
module bodyParser {
export function json(options?: {
/**
* if deflated bodies will be inflated. (default: true)
*/
inflate?: boolean;
/**
* maximum request body size. (default: '100kb')
*/
limit?: any;
/**
* request content-type to parse, passed directly to the type-is library. (default: 'json')
*/
type?: any;
/**
* function to verify body content, the parsing can be aborted by throwing an error.
*/
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
/**
* only parse objects and arrays. (default: true)
*/
strict?: boolean;
/**
* passed to JSON.parse().
*/
receiver?: (key: string, value: any) => any;
}): express.RequestHandler;
export function raw(options?: {
/**
* if deflated bodies will be inflated. (default: true)
*/
inflate?: boolean;
/**
* maximum request body size. (default: '100kb')
*/
limit?: any;
/**
* request content-type to parse, passed directly to the type-is library. (default: 'application/octet-stream')
*/
type?: any;
/**
* function to verify body content, the parsing can be aborted by throwing an error.
*/
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
}): express.RequestHandler;
export function text(options?: {
/**
* if deflated bodies will be inflated. (default: true)
*/
inflate?: boolean;
/**
* maximum request body size. (default: '100kb')
*/
limit?: any;
/**
* request content-type to parse, passed directly to the type-is library. (default: 'text/plain')
*/
type?: any;
/**
* function to verify body content, the parsing can be aborted by throwing an error.
*/
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
/**
* the default charset to parse as, if not specified in content-type. (default: 'utf-8')
*/
defaultCharset?: string;
}): express.RequestHandler;
export function urlencoded(options?: {
/**
* if deflated bodies will be inflated. (default: true)
*/
inflate?: boolean;
/**
* maximum request body size. (default: '100kb')
*/
limit?: any;
/**
* request content-type to parse, passed directly to the type-is library. (default: 'urlencoded')
*/
type?: any;
/**
* function to verify body content, the parsing can be aborted by throwing an error.
*/
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
/**
* parse extended syntax with the qs module. (default: true)
*/
extended?: boolean;
}): express.RequestHandler;
}
export = bodyParser;
}

Просмотреть файл

@ -1,12 +0,0 @@
// Type definitions for cookie-parser
// Project: https://github.com/expressjs/cookie-parser
// Definitions by: Santi Albo <https://github.com/santialbo/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
declare module "cookie-parser" {
import express = require('express');
function e(secret?: string, options?: any): express.RequestHandler;
export = e;
}

Просмотреть файл

@ -1,30 +0,0 @@
// Type definitions for debug
// Project: https://github.com/visionmedia/debug
// Definitions by: Seon-Wook Park <https://github.com/swook>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "debug" {
function d(namespace: string): d.Debugger;
module d {
export var log: Function;
function enable(namespaces: string): void;
function disable(): void;
function enabled(namespace: string): boolean;
export interface Debugger {
(formatter: any, ...args: any[]): void;
enabled: boolean;
log: Function;
namespace: string;
}
}
export = d;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

264
node-express-typescript/typings/gulp/gulp.d.ts поставляемый
Просмотреть файл

@ -1,264 +0,0 @@
// Type definitions for Gulp v3.8.x
// Project: http://gulpjs.com
// Definitions by: Drew Noakes <https://drewnoakes.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module gulp {
/**
* Options to pass to node-glob through glob-stream.
* Specifies two options in addition to those used by node-glob:
* https://github.com/isaacs/node-glob#options
*/
interface ISrcOptions {
/**
* Setting this to <code>false</code> will return <code>file.contents</code> as <code>null</code>
* and not read the file at all.
* Default: <code>true</code>.
*/
read?: boolean;
/**
* Setting this to false will return <code>file.contents</code> as a stream and not buffer files.
* This is useful when working with large files.
* Note: Plugins might not implement support for streams.
* Default: <code>true</code>.
*/
buffer?: boolean;
/**
* The current working directory in which to search.
* Defaults to process.cwd().
*/
cwd?: string;
/**
* The place where patterns starting with / will be mounted onto.
* Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.)
*/
root?: string;
/**
* Include .dot files in normal matches and globstar matches.
* Note that an explicit dot in a portion of the pattern will always match dot files.
*/
dot?: boolean;
/**
* By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid
* filesystem path is returned. Set this flag to disable that behavior.
*/
nomount?: boolean;
/**
* Add a / character to directory matches. Note that this requires additional stat calls.
*/
mark?: boolean;
/**
* Don't sort the results.
*/
nosort?: boolean;
/**
* Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless
* readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one
* level sooner in the case of cyclical symbolic links.
*/
stat?: boolean;
/**
* When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr.
* Set the silent option to true to suppress these warnings.
*/
silent?: boolean;
/**
* When an unusual error is encountered when attempting to read a directory, the process will just continue on in
* search of other matches. Set the strict option to raise an error in these cases.
*/
strict?: boolean;
/**
* See cache property above. Pass in a previously generated cache object to save some fs calls.
*/
cache?: boolean;
/**
* A cache of results of filesystem information, to prevent unnecessary stat calls.
* While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the
* options object of another, if you know that the filesystem will not change between calls.
*/
statCache?: boolean;
/**
* Perform a synchronous glob search.
*/
sync?: boolean;
/**
* In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set.
* By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior.
*/
nounique?: boolean;
/**
* Set to never return an empty set, instead returning a set containing the pattern itself.
* This is the default in glob(3).
*/
nonull?: boolean;
/**
* Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning
* results that are case-insensitively matched anyway, since readdir and stat will not raise an error.
*/
nocase?: boolean;
/**
* Set to enable debug logging in minimatch and glob.
*/
debug?: boolean;
/**
* Set to enable debug logging in glob, but not minimatch.
*/
globDebug?: boolean;
}
interface IDestOptions {
/**
* The output folder. Only has an effect if provided output folder is relative.
* Default: process.cwd()
*/
cwd?: string;
/**
* Octal permission string specifying mode for any folders that need to be created for output folder.
* Default: 0777.
*/
mode?: string;
}
/**
* Options that are passed to <code>gaze</code>.
* https://github.com/shama/gaze
*/
interface IWatchOptions {
/** Interval to pass to fs.watchFile. */
interval?: number;
/** Delay for events called in succession for the same file/event. */
debounceDelay?: number;
/** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */
mode?: string;
/** The current working directory to base file patterns from. Default is process.cwd().. */
cwd?: string;
}
interface IWatchEvent {
/** The type of change that occurred, either added, changed or deleted. */
type: string;
/** The path to the file that triggered the event. */
path: string;
}
/**
* Callback to be called on each watched file change.
*/
interface IWatchCallback {
(event:IWatchEvent): void;
}
interface ITaskCallback {
/**
* Defines a task.
* Tasks may be made asynchronous if they are passing a callback or return a promise or a stream.
* @param cb callback used to signal asynchronous completion. Caller includes <code>err</code> in case of error.
*/
(cb?:(err?:any)=>void): any;
}
interface EventEmitter {
any: any;
}
interface Gulp {
/**
* Define a task.
*
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
*/
task(name:string, fn:ITaskCallback): any;
/**
* Define a task.
*
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
* @param dep an array of tasks to be executed and completed before your task will run.
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
*/
task(name:string, dep:string[], fn?:ITaskCallback): any;
/**
* Takes a glob and represents a file structure. Can be piped to plugins.
* @param glob a glob string, using node-glob syntax
* @param opt an optional option object
*/
src(glob:string, opt?:ISrcOptions): NodeJS.ReadWriteStream;
/**
* Takes a glob and represents a file structure. Can be piped to plugins.
* @param glob an array of glob strings, using node-glob syntax
* @param opt an optional option object
*/
src(glob:string[], opt?:ISrcOptions): NodeJS.ReadWriteStream;
/**
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
* Folders that don't exist will be created.
*
* @param outFolder the path (output folder) to write files to.
* @param opt
*/
dest(outFolder:string, opt?:IDestOptions): NodeJS.ReadWriteStream;
/**
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
* Folders that don't exist will be created.
*
* @param outFolder a function that converts a vinyl File instance into an output path
* @param opt
*/
dest(outFolder:(file:string)=>string, opt?:IDestOptions): NodeJS.ReadWriteStream;
/**
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
*
* @param glob a single glob or array of globs that indicate which files to watch for changes.
* @param opt options, that are passed to the gaze library.
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with gulp.task().
*/
watch(glob:string, fn:(IWatchCallback|string)): EventEmitter;
watch(glob:string, fn:(IWatchCallback|string)[]): EventEmitter;
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
watch(glob:string[], fn:(IWatchCallback|string)): EventEmitter;
watch(glob:string[], fn:(IWatchCallback|string)[]): EventEmitter;
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
}
}
declare module "gulp" {
var _tmp:gulp.Gulp;
export = _tmp;
}
interface IGulpPlugin {
(...args: any[]): NodeJS.ReadWriteStream;
}

Просмотреть файл

@ -1,214 +0,0 @@
// Type definitions for mocha 2.2.5
// Project: http://mochajs.org/
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>, Vadim Macagon <https://github.com/enlight>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface MochaSetupOptions {
//milliseconds to wait before considering a test slow
slow?: number;
// timeout in milliseconds
timeout?: number;
// ui name "bdd", "tdd", "exports" etc
ui?: string;
//array of accepted globals
globals?: any[];
// reporter instance (function or string), defaults to `mocha.reporters.Spec`
reporter?: any;
// bail on the first test failure
bail?: boolean;
// ignore global leaks
ignoreLeaks?: boolean;
// grep string or regexp to filter tests with
grep?: any;
}
interface MochaDone {
(error?: Error): void;
}
declare var mocha: Mocha;
declare var describe: Mocha.IContextDefinition;
declare var xdescribe: Mocha.IContextDefinition;
// alias for `describe`
declare var context: Mocha.IContextDefinition;
// alias for `describe`
declare var suite: Mocha.IContextDefinition;
declare var it: Mocha.ITestDefinition;
declare var xit: Mocha.ITestDefinition;
// alias for `it`
declare var test: Mocha.ITestDefinition;
declare function before(action: () => void): void;
declare function before(action: (done: MochaDone) => void): void;
declare function setup(action: () => void): void;
declare function setup(action: (done: MochaDone) => void): void;
declare function after(action: () => void): void;
declare function after(action: (done: MochaDone) => void): void;
declare function teardown(action: () => void): void;
declare function teardown(action: (done: MochaDone) => void): void;
declare function beforeEach(action: () => void): void;
declare function beforeEach(action: (done: MochaDone) => void): void;
declare function suiteSetup(action: () => void): void;
declare function suiteSetup(action: (done: MochaDone) => void): void;
declare function afterEach(action: () => void): void;
declare function afterEach(action: (done: MochaDone) => void): void;
declare function suiteTeardown(action: () => void): void;
declare function suiteTeardown(action: (done: MochaDone) => void): void;
declare class Mocha {
constructor(options?: {
grep?: RegExp;
ui?: string;
reporter?: string;
timeout?: number;
bail?: boolean;
});
/** Setup mocha with the given options. */
setup(options: MochaSetupOptions): Mocha;
bail(value?: boolean): Mocha;
addFile(file: string): Mocha;
/** Sets reporter by name, defaults to "spec". */
reporter(name: string): Mocha;
/** Sets reporter constructor, defaults to mocha.reporters.Spec. */
reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha;
ui(value: string): Mocha;
grep(value: string): Mocha;
grep(value: RegExp): Mocha;
invert(): Mocha;
ignoreLeaks(value: boolean): Mocha;
checkLeaks(): Mocha;
/** Enables growl support. */
growl(): Mocha;
globals(value: string): Mocha;
globals(values: string[]): Mocha;
useColors(value: boolean): Mocha;
useInlineDiffs(value: boolean): Mocha;
timeout(value: number): Mocha;
slow(value: number): Mocha;
enableTimeouts(value: boolean): Mocha;
asyncOnly(value: boolean): Mocha;
noHighlighting(value: boolean): Mocha;
/** Runs tests and invokes `onComplete()` when finished. */
run(onComplete?: (failures: number) => void): Mocha.IRunner;
}
// merge the Mocha class declaration with a module
declare module Mocha {
/** Partial interface for Mocha's `Runnable` class. */
interface IRunnable {
title: string;
fn: Function;
async: boolean;
sync: boolean;
timedOut: boolean;
}
/** Partial interface for Mocha's `Suite` class. */
interface ISuite {
parent: ISuite;
title: string;
fullTitle(): string;
}
/** Partial interface for Mocha's `Test` class. */
interface ITest extends IRunnable {
parent: ISuite;
pending: boolean;
fullTitle(): string;
}
/** Partial interface for Mocha's `Runner` class. */
interface IRunner {}
interface IContextDefinition {
(description: string, spec: () => void): ISuite;
only(description: string, spec: () => void): ISuite;
skip(description: string, spec: () => void): void;
timeout(ms: number): void;
}
interface ITestDefinition {
(expectation: string, assertion?: () => void): ITest;
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
only(expectation: string, assertion?: () => void): ITest;
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
skip(expectation: string, assertion?: () => void): void;
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
timeout(ms: number): void;
}
export module reporters {
export class Base {
stats: {
suites: number;
tests: number;
passes: number;
pending: number;
failures: number;
};
constructor(runner: IRunner);
}
export class Doc extends Base {}
export class Dot extends Base {}
export class HTML extends Base {}
export class HTMLCov extends Base {}
export class JSON extends Base {}
export class JSONCov extends Base {}
export class JSONStream extends Base {}
export class Landing extends Base {}
export class List extends Base {}
export class Markdown extends Base {}
export class Min extends Base {}
export class Nyan extends Base {}
export class Progress extends Base {
/**
* @param options.open String used to indicate the start of the progress bar.
* @param options.complete String used to indicate a complete test on the progress bar.
* @param options.incomplete String used to indicate an incomplete test on the progress bar.
* @param options.close String used to indicate the end of the progress bar.
*/
constructor(runner: IRunner, options?: {
open?: string;
complete?: string;
incomplete?: string;
close?: string;
});
}
export class Spec extends Base {}
export class TAP extends Base {}
export class XUnit extends Base {
constructor(runner: IRunner, options?: any);
}
}
}
declare module "mocha" {
export = Mocha;
}

Просмотреть файл

@ -1,93 +0,0 @@
// Type definitions for morgan 1.2.2
// Project: https://github.com/expressjs/morgan
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
declare module "morgan" {
import express = require('express');
module morgan {
export function token<T>(name: string, callback: (req: express.Request, res: express.Response) => T): express.RequestHandler;
/***
* Morgan accepts these properties in the options object.
*/
export interface Options {
/***
* Buffer duration before writing logs to the stream, defaults to false. When set to true, defaults to 1000 ms.
*/
buffer?: boolean;
/***
* Write log line on request instead of response. This means that a requests will be logged even if the server crashes, but data from the response cannot be logged (like the response code).
*/
immediate?: boolean;
/***
* Function to determine if logging is skipped, defaults to false. This function will be called as skip(req, res).
*/
skip?: (req: express.Request, res: express.Response) => boolean;
/***
* Output stream for writing log lines, defaults to process.stdout.
* @param str
*/
stream?: (str: string) => void;
}
}
/***
* Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names), a string of a format string, or a function that will produce a log entry.
* @param format
* @param options
*/
function morgan(format: string, options?: morgan.Options): express.RequestHandler;
/***
* Standard Apache combined log output.
* :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"
* @param format
* @param options
*/
function morgan(format: 'combined', options?: morgan.Options): express.RequestHandler;
/***
* Standard Apache common log output.
* :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length]
* @param format
* @param options
*/
function morgan(format: 'common', options?: morgan.Options): express.RequestHandler;
/***
* Concise output colored by response status for development use. The :status token will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
* :method :url :status :response-time ms - :res[content-length]
* @param format
* @param options
*/
function morgan(format: 'dev', options?: morgan.Options): express.RequestHandler;
/***
* Shorter than default, also including response time.
* :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms
* @param format
* @param options
*/
function morgan(format: 'short', options?: morgan.Options): express.RequestHandler;
/***
* The minimal output.
* :method :url :status :res[content-length] - :response-time ms
* @param format
* @param options
*/
function morgan(format: 'tiny', options?: morgan.Options): express.RequestHandler;
function morgan(custom: (req: express.Request, res: express.Response) => string): express.RequestHandler
export = morgan;
}

1409
node-express-typescript/typings/node/node.d.ts поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,29 +0,0 @@
// Type definitions for serve-favicon 2.1.6
// Project: https://github.com/expressjs/serve-favicon
// Definitions by: Uros Smolnik <https://github.com/urossmolnik/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* =================== USAGE ===================
import serveFavicon = require('serve-favicon');
app.use(serveFavicon(__dirname + '/public/favicon.ico'));
=============================================== */
/// <reference path="../express/express.d.ts" />
declare module "serve-favicon" {
import express = require('express');
/**
* Node.js middleware for serving a favicon.
*/
function serveFavicon(path: string, options?: {
/**
* The cache-control max-age directive in ms, defaulting to 1 day. This can also be a string accepted by the ms module.
*/
maxAge?: number;
}): express.RequestHandler;
export = serveFavicon;
}