├── .editorconfig ├── .gitattributes ├── .gitignore ├── .jshintrc ├── .yo-rc.json ├── README.md ├── app ├── index.js └── templates │ ├── .editorconfig │ ├── .jshintrc │ ├── app │ ├── app.html │ ├── app.jade │ ├── app.ts │ ├── components │ │ ├── about │ │ │ ├── about.html │ │ │ ├── about.jade │ │ │ └── about.ts │ │ └── home │ │ │ ├── home.html │ │ │ ├── home.jade │ │ │ └── home.ts │ ├── index.html │ ├── index.jade │ ├── init.ts │ ├── services │ │ └── NameList.ts │ ├── styles │ │ ├── app.css │ │ └── app.sass │ └── typings │ │ └── _custom.d.ts │ ├── bower.json │ ├── gulpfile.js │ ├── package.json │ ├── tsconfig.json │ ├── tsd.json │ └── tsd_typings │ ├── angular2 │ ├── angular2.d.ts │ └── router.d.ts │ ├── es6-promise │ └── es6-promise.d.ts │ ├── rx │ ├── rx-lite.d.ts │ └── rx.d.ts │ ├── systemjs │ └── systemjs.d.ts │ └── tsd.d.ts └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 4, 10 | "latedef": true, 11 | "newcap": true, 12 | "noarg": true, 13 | "quotmark": "single", 14 | "undef": true, 15 | "unused": true, 16 | "strict": true 17 | } 18 | -------------------------------------------------------------------------------- /.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "generator-generator": {} 3 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # generator-gulp-angular2 2 | 3 | > [Yeoman](http://yeoman.io) generator 4 | 5 | 6 | base on [generator-gulp-angular](https://github.com/Swiip/generator-gulp-angular) and [angular2-seed](https://github.com/mgechev/angular2-seed) 7 | 8 | 9 | ## Getting Started 10 | 11 | ### Install 12 | 13 | Install required tools yo, gulp and bower: 14 | 15 | ```bash 16 | npm install -g yo gulp bower 17 | ``` 18 | 19 | To install generator-gulp-angular2 from npm, run: 20 | 21 | ```bash 22 | npm install -g generator-gulp-angular2 23 | ``` 24 | 25 | Finally, initiate the generator: 26 | 27 | ```bash 28 | yo gulp-angular2 29 | ``` 30 | 31 | ### Usage 32 | 33 | ```bash 34 | gulp serve.dev 35 | 36 | //or 37 | 38 | gulp serve.prod 39 | ``` 40 | 41 | ### Build 42 | ```bash 43 | gulp build.dev 44 | 45 | //or 46 | 47 | gulp build.prod 48 | ``` 49 | 50 | ## License 51 | 52 | MIT 53 | -------------------------------------------------------------------------------- /app/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var yeoman = require('yeoman-generator'); 3 | var chalk = require('chalk'); 4 | var yosay = require('yosay'); 5 | //var fs = require('fs'); 6 | 7 | module.exports = yeoman.generators.Base.extend({ 8 | constructor: function () { 9 | yeoman.generators.Base.apply(this, arguments); 10 | 11 | this.argument('appName', { 12 | type: String, 13 | required: false 14 | }); 15 | 16 | this.appName = this.appname || path.basename(process.cwd()); 17 | 18 | this.props = {}; 19 | }, 20 | 21 | askFor: function () { 22 | var done = this.async(); 23 | 24 | this.log(yosay( 25 | chalk.red('Welcome!') + '\n' + 26 | chalk.yellow('You\'re using the fantastic generator for scaffolding an application with Angular2 and Gulp!') 27 | )); 28 | var prompts = [{ 29 | type: 'list', 30 | name: 'htmlPreprocessor', 31 | message: 'Which HTML template engine would you want?', 32 | choices: [{ 33 | value: { 34 | key: 'none', 35 | extension: 'html' 36 | }, 37 | name: 'None, I like to code in standard HTML.' 38 | }, { 39 | value: { 40 | key: 'jade', 41 | extension: 'jade' 42 | }, 43 | name: 'Jade (*.jade)' 44 | }] 45 | }, { 46 | type: 'list', 47 | name: 'cssPreprocessor', 48 | message: 'Which CSS preprocessor do you want?', 49 | choices: [{ 50 | value: { 51 | key: 'node-sass', 52 | extension: 'scss' 53 | }, 54 | name: 'Sass (Node)' 55 | }/*, { 56 | value: { 57 | key: 'ruby-sass', 58 | extension: 'scss' 59 | }, 60 | name: 'Sass (Ruby)' 61 | }, { 62 | value: { 63 | key: 'less', 64 | extension: 'less' 65 | }, 66 | name: 'Less' 67 | }, { 68 | value: { 69 | key: 'stylus', 70 | extension: 'styl' 71 | }, 72 | name: 'Stylus' 73 | }*/, { 74 | value: { 75 | key: 'none', 76 | extension: 'css' 77 | }, 78 | name: 'None, only the good old CSS' 79 | }] 80 | }]; 81 | 82 | 83 | this.prompt(prompts, function (props) { 84 | this.props = props; 85 | done(); 86 | }.bind(this)); 87 | }, 88 | 89 | write: function () { 90 | var statics = [ 91 | 'bower.json', 92 | 'tsconfig.json', 93 | 'tsd.json', 94 | '.editorconfig', 95 | '.jshintrc' 96 | ]; 97 | 98 | var statics_dir = [ 99 | 'tsd_typings', 100 | 'app/typings' 101 | ]; 102 | 103 | var templates = [ 104 | 'package.json', 105 | 'gulpfile.js' 106 | ]; 107 | 108 | var scripts = [ 109 | 'app/init.ts', 110 | 'app/app.ts', 111 | 'app/components/about/about.ts', 112 | 'app/components/home/home.ts', 113 | 'app/services/NameList.ts' 114 | ]; 115 | 116 | var styles = [ 117 | 'app/styles/app' 118 | ]; 119 | var htmls = [ 120 | 'app/index', 121 | 'app/app', 122 | 'app/components/home/home', 123 | 'app/components/about/about' 124 | ]; 125 | 126 | // write statics 127 | var me = this; 128 | statics.forEach(function(f) { 129 | me.copy(f, f); 130 | }); 131 | statics_dir.forEach(function(f) { 132 | me.bulkDirectory(f, f); 133 | }); 134 | templates.forEach(function(f) { 135 | me.template(f, f, me); 136 | }); 137 | scripts.forEach(function(f) { 138 | me.copy(f, f) 139 | }); 140 | 141 | var htmlSuffix = '.html'; 142 | if (me.props.htmlPreprocessor.key === 'jade') { 143 | htmlSuffix = '.jade'; 144 | } 145 | htmls.forEach(function(f) { 146 | f = f + htmlSuffix; 147 | me.copy(f, f); 148 | }); 149 | 150 | var styleSuffix = '.css'; 151 | if (me.props.cssPreprocessor.key === 'node-sass') { 152 | styleSuffix = '.sass'; 153 | } 154 | styles.forEach(function(f) { 155 | f = f + styleSuffix; 156 | me.copy(f, f); 157 | }); 158 | 159 | 160 | 161 | }, 162 | 163 | install: function () { 164 | this.installDependencies({ 165 | skipInstall: this.options['skip-install'], 166 | skipMessage: this.options['skip-message'] 167 | }); 168 | } 169 | 170 | 171 | 172 | }); 173 | -------------------------------------------------------------------------------- /app/templates/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /app/templates/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 2, 10 | "latedef": true, 11 | "newcap": true, 12 | "noarg": true, 13 | "quotmark": "single", 14 | "undef": true, 15 | "unused": true, 16 | "strict": true 17 | } 18 | -------------------------------------------------------------------------------- /app/templates/app/app.html: -------------------------------------------------------------------------------- 1 |
2 | 6 | 7 | 8 |
-------------------------------------------------------------------------------- /app/templates/app/app.jade: -------------------------------------------------------------------------------- 1 | // 2 | Created by yangdongxu on 15/8/24. 3 | 4 | section.sample-app-content 5 | nav 6 | a([router-link]="['/home']") Home 7 | a([router-link]="['/about']") About 8 | router-outlet 9 | -------------------------------------------------------------------------------- /app/templates/app/app.ts: -------------------------------------------------------------------------------- 1 | import {Component, View, bootstrap} from 'angular2/angular2'; 2 | import {RouteConfig, RouterOutlet, RouterLink, routerInjectables} from 'angular2/router'; 3 | 4 | import {Home} from './components/home/home'; 5 | import {About} from './components/about/about'; 6 | import {NamesList} from './services/NameList'; 7 | 8 | 9 | @Component({ 10 | selector: 'app', 11 | viewBindings: [NamesList] 12 | }) 13 | @RouteConfig([ 14 | {path: '/', component: Home, as: 'home'}, 15 | {path: '/about', component: About, as: 'about'} 16 | ]) 17 | @View({ 18 | templateUrl: './app.html', 19 | directives: [RouterOutlet, RouterLink] 20 | }) 21 | class App { 22 | } 23 | 24 | 25 | bootstrap(App, [routerInjectables]); 26 | -------------------------------------------------------------------------------- /app/templates/app/components/about/about.html: -------------------------------------------------------------------------------- 1 |

For reward, here is a list of awesome computer scientists!

2 |

You want more? Add them yourself!

3 |

4 | 5 | 6 |

7 | 10 | 11 | -------------------------------------------------------------------------------- /app/templates/app/components/about/about.jade: -------------------------------------------------------------------------------- 1 | p For reward, here is a list of awesome computer scientists! 2 | p You want more? Add them yourself! 3 | p 4 | input(#newname) 5 | button((click)="addName(newname)") Add 6 | ul 7 | li(*ng-for="#name of list.get()") {{name}} 8 | 9 | -------------------------------------------------------------------------------- /app/templates/app/components/about/about.ts: -------------------------------------------------------------------------------- 1 | import {Component, View, NgFor} from 'angular2/angular2'; 2 | 3 | import {NamesList} from '../../services/NameList'; 4 | 5 | @Component({ 6 | selector: 'component-2' 7 | }) 8 | @View({ 9 | templateUrl: './components/about/about.html?v=<%= VERSION %>', 10 | directives: [NgFor] 11 | }) 12 | export class About { 13 | constructor(public list: NamesList) { 14 | } 15 | addName(newname) { 16 | this.list.add(newname.value); 17 | newname.value = ''; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/templates/app/components/home/home.html: -------------------------------------------------------------------------------- 1 |

Howdy!

2 |

Gratz!!!!!!!

3 |

4 | Your deployment of Angular 2 Seed worked perfectly! 5 | Click here to get your reward! 6 |

7 | -------------------------------------------------------------------------------- /app/templates/app/components/home/home.jade: -------------------------------------------------------------------------------- 1 | h1 Howdy! 2 | h2 Gratz!!!!!!! 3 | p 4 | | Your deployment of Angular 2 Seed worked perfectly! 5 | | Click  6 | a([router-link]="['/about']") 7 | |here 8 | |  to get your reward! 9 | -------------------------------------------------------------------------------- /app/templates/app/components/home/home.ts: -------------------------------------------------------------------------------- 1 | import {Component, View} from 'angular2/angular2'; 2 | import {RouterLink} from 'angular2/router'; 3 | 4 | @Component({ 5 | selector: 'component-1' 6 | }) 7 | @View({ 8 | templateUrl: './components/home/home.html?v=<%= VERSION %>', 9 | directives: [RouterLink] 10 | }) 11 | export class Home {} 12 | -------------------------------------------------------------------------------- /app/templates/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | My Angular 2 App 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Loading... 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/templates/app/index.jade: -------------------------------------------------------------------------------- 1 | // 2 | Created by yangdongxu on 15/8/24. 3 | 4 | doctype html 5 | html(lang="en") 6 | head 7 | meta(charset="utf-8") 8 | meta(http-equiv="X-UA-Compatible" content="IE=edge") 9 | title My Angular 2 App 10 | base(href="/") 11 | 12 | script. 13 | baseElement = document.querySelector('base');baseElement.attr = baseElement.getAttribute; 14 | meta(name="description" content="") 15 | meta(name="viewport" content="width=device-width, initial-scale=1") 16 | 17 | 18 | body 19 | app Loading... 20 | 21 | 22 | script(src="/init.js") 23 | 24 | -------------------------------------------------------------------------------- /app/templates/app/init.ts: -------------------------------------------------------------------------------- 1 | System.config({ 2 | baseURL: '/', 3 | paths: {'*': '*.js'} 4 | }); 5 | 6 | // Patching System.js 7 | System['import'] = function (name:string, options?:any):any { 8 | return System.originalSystem.import.call(this, name, options).then(function (module) { 9 | return module; 10 | }); 11 | }; 12 | 13 | 14 | // Dirty workaround in order to load angular2/router properly 15 | System.import('angular2/router').then(m => { 16 | System.defined['angular2/router'] = {normalizedDeps: []}; 17 | System.defined['angular2/router'].module = {}; 18 | System.defined['angular2/router'].module.exports = m; 19 | }); 20 | 21 | 22 | System.import('app') 23 | .catch(e => console.error(e, 24 | 'Report this error at https://github.com/mgechev/angular2-seed/issues')); 25 | -------------------------------------------------------------------------------- /app/templates/app/services/NameList.ts: -------------------------------------------------------------------------------- 1 | export class NamesList { 2 | private names = ['Dijkstra', 'Knuth', 'Turing', 'Hopper']; 3 | 4 | get() { 5 | return this.names; 6 | } 7 | add(value: string) { 8 | this.names.push(value); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/templates/app/styles/app.css: -------------------------------------------------------------------------------- 1 | * { 2 | color: #666; 3 | } 4 | -------------------------------------------------------------------------------- /app/templates/app/styles/app.sass: -------------------------------------------------------------------------------- 1 | * 2 | color: #666 -------------------------------------------------------------------------------- /app/templates/app/typings/_custom.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Your custom types 3 | * Place references (from ./app/typings) to any custom typings you need here 4 | */ 5 | 6 | 7 | /* 8 | * tsd generated types 9 | */ 10 | /// -------------------------------------------------------------------------------- /app/templates/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "package", 3 | "version": "0.0.0", 4 | "dependencies": {} 5 | } 6 | 7 | -------------------------------------------------------------------------------- /app/templates/gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var gulp = require('gulp'); 4 | var bump = require('gulp-bump'); 5 | var concat = require('gulp-concat'); 6 | var filter = require('gulp-filter'); 7 | var inject = require('gulp-inject'); 8 | var rename = require('gulp-rename'); 9 | var flatten = require('gulp-flatten'); 10 | var minifyCSS = require('gulp-minify-css'); 11 | var minifyHTML = require('gulp-minify-html'); 12 | var plumber = require('gulp-plumber'); 13 | var sourcemaps = require('gulp-sourcemaps'); 14 | var template = require('gulp-template'); 15 | var tsc = require('gulp-typescript'); 16 | var uglify = require('gulp-uglify'); 17 | var watch = require('gulp-watch'); 18 | var insert = require('gulp-insert'); 19 | 20 | <% if (props.cssPreprocessor.key === 'node-sass') { %> 21 | var sass = require('gulp-sass'); 22 | <% } %> 23 | 24 | <% if (props.htmlPreprocessor.key === 'jade') { %> 25 | var jade = require('gulp-jade'); 26 | <% } %> 27 | 28 | 29 | var Builder = require('systemjs-builder'); 30 | var del = require('del'); 31 | var fs = require('fs'); 32 | var path = require('path'); 33 | var join = path.join; 34 | var runSequence = require('run-sequence'); 35 | var semver = require('semver'); 36 | var series = require('stream-series'); 37 | 38 | var express = require('express'); 39 | var serveStatic = require('serve-static'); 40 | var openResource = require('open'); 41 | 42 | var tinylr = require('tiny-lr')(); 43 | var connectLivereload = require('connect-livereload'); 44 | var bowerFiles = require('main-bower-files'); 45 | 46 | 47 | // -------------- 48 | // Configuration. 49 | var APP_BASE = '/'; 50 | 51 | var PATH = { 52 | dest: { 53 | all: 'dist', 54 | dev: { 55 | all: 'dist/dev', 56 | lib: 'dist/dev/lib', 57 | vendor: 'dist/dev/vendor', 58 | ng2: 'dist/dev/lib/angular2.js', 59 | router: 'dist/dev/lib/router.js' 60 | }, 61 | prod: { 62 | all: 'dist/prod', 63 | lib: 'dist/prod/lib', 64 | vendor: 'dist/prod/vendor' 65 | } 66 | }, 67 | src: { 68 | // Order is quite important here for the HTML tag injection. 69 | lib: [ 70 | './node_modules/traceur/bin/traceur-runtime.js', 71 | './node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.js', 72 | './node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.js.map', 73 | './node_modules/reflect-metadata/Reflect.js', 74 | './node_modules/reflect-metadata/Reflect.js.map', 75 | './node_modules/systemjs/dist/system.src.js', 76 | './node_modules/angular2/node_modules/zone.js/dist/zone.js' 77 | ] 78 | } 79 | }; 80 | 81 | var PORT = 5555; 82 | var LIVE_RELOAD_PORT = 4002; 83 | 84 | var ng2Builder = new Builder({ 85 | defaultJSExtensions: true, 86 | paths: { 87 | 'angular2/*': 'node_modules/angular2/es6/dev/*.js', 88 | rx: 'node_modules/angular2/node_modules/rx/dist/rx.js' 89 | }, 90 | meta: { 91 | rx: { 92 | format: 'cjs' 93 | } 94 | } 95 | }); 96 | 97 | var appProdBuilder = new Builder({ 98 | baseURL: 'file:./tmp', 99 | meta: { 100 | 'angular2/angular2': {build: false}, 101 | 'angular2/router': {build: false} 102 | } 103 | }); 104 | 105 | var HTMLMinifierOpts = {conditionals: true}; 106 | 107 | var tsProject = tsc.createProject('tsconfig.json', { 108 | typescript: require('typescript') 109 | }); 110 | 111 | var semverReleases = ['major', 'premajor', 'minor', 'preminor', 'patch', 112 | 'prepatch', 'prerelease']; 113 | 114 | // -------------- 115 | // Clean. 116 | 117 | gulp.task('clean', function (done) { 118 | del(PATH.dest.all, done); 119 | }); 120 | 121 | gulp.task('clean.dev', function (done) { 122 | del(PATH.dest.dev.all, done); 123 | }); 124 | 125 | gulp.task('clean.app.dev', function (done) { 126 | // TODO: rework this part. 127 | del([join(PATH.dest.dev.all, '**/*'), '!' + 128 | PATH.dest.dev.lib, '!' + join(PATH.dest.dev.lib, '*')], done); 129 | }); 130 | 131 | gulp.task('clean.prod', function (done) { 132 | del(PATH.dest.prod.all, done); 133 | }); 134 | 135 | gulp.task('clean.app.prod', function (done) { 136 | // TODO: rework this part. 137 | del([join(PATH.dest.prod.all, '**/*'), '!' + 138 | PATH.dest.prod.lib, '!' + join(PATH.dest.prod.lib, '*')], done); 139 | }); 140 | 141 | gulp.task('clean.tmp', function (done) { 142 | del('tmp', done); 143 | }); 144 | 145 | // -------------- 146 | // Build dev. 147 | 148 | gulp.task('build.ng2.dev', function () { 149 | ng2Builder.build('angular2/router - angular2/angular2', PATH.dest.dev.router, {}); 150 | return ng2Builder.build('angular2/angular2', PATH.dest.dev.ng2, {}); 151 | }); 152 | 153 | gulp.task('build.lib.dev', ['build.ng2.dev'], function () { 154 | return gulp.src(PATH.src.lib) 155 | .pipe(gulp.dest(PATH.dest.dev.lib)); 156 | }); 157 | 158 | gulp.task('build.js.dev', function () { 159 | var result = gulp.src('./app/**/*ts') 160 | .pipe(plumber()) 161 | .pipe(sourcemaps.init()) 162 | .pipe(tsc(tsProject)); 163 | 164 | return result.js 165 | .pipe(sourcemaps.write()) 166 | .pipe(template(templateLocals())) 167 | .pipe(gulp.dest(PATH.dest.dev.all)); 168 | }); 169 | 170 | <% if (props.htmlPreprocessor.key === 'jade') { %> 171 | gulp.task('build.jade.dev', function() { 172 | var YOUR_LOCALS = {}; 173 | return gulp.src('./app/**/*.jade') 174 | .pipe(jade({ 175 | locals: YOUR_LOCALS, 176 | doctype: 'html' //保证angular2的标记被正常解析 177 | })) 178 | .pipe(gulp.dest(PATH.dest.dev.all)); 179 | }); 180 | <% } %> 181 | 182 | gulp.task('build.assets.dev', [ 183 | 'build.js.dev' 184 | <% if (props.htmlPreprocessor.key === 'jade') { %> 185 | ,'build.jade.dev' 186 | <% } %> 187 | ], function () { 188 | 189 | <% if (props.cssPreprocessor.key === 'node-sass') { %> 190 | gulp.src(['./app/**/*.sass', './app/**/*.scss']) 191 | .pipe(sass().on('error', sass.logError)) 192 | .pipe(gulp.dest(PATH.dest.dev.all)); 193 | 194 | <% } %> 195 | 196 | 197 | 198 | return gulp.src(['./app/**/*.html', './app/**/*.css']) 199 | .pipe(gulp.dest(PATH.dest.dev.all)); 200 | }); 201 | 202 | gulp.task('build.fonts.dev', function () { 203 | return gulp.src('./bower_components/**/*.{eot,svg,ttf,woff,woff2}') 204 | .pipe(flatten()) 205 | .pipe(gulp.dest(path.join(PATH.dest.dev.all, 'fonts/'))); 206 | }); 207 | 208 | gulp.task('build.index.dev', ['build.fonts.dev'], function () { 209 | var target = gulp.src(injectableDevAssetsRef(), {read: false}); 210 | var bower = injectableBowerComponents('dev'); 211 | return gulp.src(PATH.dest.dev.all + '/index.html') 212 | .pipe(inject(series(target, bower), { transform: transformPath('dev') })) 213 | .pipe(template(templateLocals())) 214 | .pipe(gulp.dest(PATH.dest.dev.all)); 215 | }); 216 | 217 | gulp.task('build.app.dev', function (done) { 218 | runSequence('clean.app.dev', 'build.assets.dev', 'build.index.dev', done); 219 | }); 220 | 221 | gulp.task('build.dev', function (done) { 222 | runSequence('clean.dev', 'build.lib.dev', 'build.app.dev', done); 223 | }); 224 | 225 | // -------------- 226 | // Build prod. 227 | 228 | gulp.task('build.ng2.prod', function () { 229 | ng2Builder.build('angular2/router - angular2/angular2', join('tmp', 'router.js'), {}); 230 | return ng2Builder.build('angular2/angular2', join('tmp', 'angular2.js'), {}); 231 | }); 232 | 233 | gulp.task('build.lib.prod', ['build.ng2.prod'], function () { 234 | var jsOnly = filter('**/*.js'); 235 | var lib = gulp.src(PATH.src.lib); 236 | var ng2 = gulp.src('tmp/angular2.js'); 237 | var router = gulp.src('tmp/router.js'); 238 | 239 | return series(lib, ng2, router) 240 | .pipe(jsOnly) 241 | .pipe(concat('lib.js')) 242 | .pipe(uglify()) 243 | .pipe(gulp.dest(PATH.dest.prod.lib)); 244 | }); 245 | 246 | gulp.task('build.js.tmp', function () { 247 | var result = gulp.src(['./app/**/*ts', '!./app/init.ts']) 248 | .pipe(plumber()) 249 | .pipe(tsc(tsProject)); 250 | 251 | return result.js 252 | .pipe(template({VERSION: getVersion()})) 253 | .pipe(gulp.dest('tmp')); 254 | }); 255 | 256 | // TODO: add inline source maps (System only generate separate source maps file). 257 | gulp.task('build.js.prod', ['build.js.tmp'], function () { 258 | return appProdBuilder.build('app', join(PATH.dest.prod.all, 'app.js'), 259 | {minify: true}).catch(function (e) { 260 | console.log(e); 261 | }); 262 | }); 263 | 264 | gulp.task('build.init.prod', function () { 265 | var result = gulp.src('./app/init.ts') 266 | .pipe(insert.prepend('declare var System;')) 267 | .pipe(plumber()) 268 | .pipe(sourcemaps.init()) 269 | .pipe(tsc(tsProject)); 270 | 271 | return result.js 272 | .pipe(uglify()) 273 | .pipe(template(templateLocals())) 274 | .pipe(sourcemaps.write()) 275 | .pipe(gulp.dest(PATH.dest.prod.all)); 276 | }); 277 | 278 | <% if (props.htmlPreprocessor.key === 'jade') { %> 279 | gulp.task('build.jade.prod', function() { 280 | var YOUR_LOCALS = {}; 281 | return gulp.src('./app/**/*.jade') 282 | .pipe(jade({ 283 | locals: YOUR_LOCALS, 284 | doctype: 'html' //保证angular2的标记被正常解析 285 | })) 286 | .pipe(gulp.dest(PATH.dest.prod.all)); 287 | }); 288 | <% } %> 289 | 290 | gulp.task('build.assets.prod', [ 291 | 'build.js.prod' 292 | <% if (props.htmlPreprocessor.key === 'jade') { %> 293 | ,'build.jade.prod' 294 | <% } %> 295 | ], function () { 296 | <% if (props.cssPreprocessor.key === 'node-sass') { %> 297 | gulp.src(['./app/**/*.sass', './app/**/*.scss']) 298 | .pipe(sass().on('error', sass.logError)) 299 | .pipe(gulp.dest(PATH.dest.dev.all)); 300 | 301 | <% } %> 302 | 303 | var filterHTML = filter('**/*.html'); 304 | var filterCSS = filter('**/*.css'); 305 | return gulp.src(['./app/**/*.html', './app/**/*.css']) 306 | .pipe(filterHTML) 307 | .pipe(minifyHTML(HTMLMinifierOpts)) 308 | .pipe(filterHTML.restore()) 309 | .pipe(filterCSS) 310 | .pipe(minifyCSS()) 311 | .pipe(filterCSS.restore()) 312 | .pipe(gulp.dest(PATH.dest.prod.all)); 313 | }); 314 | 315 | gulp.task('build.fonts.prod', function () { 316 | return gulp.src('./bower_components/**/*.{eot,svg,ttf,woff,woff2}') 317 | .pipe(flatten()) 318 | .pipe(gulp.dest(path.join(PATH.dest.prod.all, 'fonts/'))); 319 | }); 320 | 321 | gulp.task('build.index.prod', ['build.fonts.prod'], function () { 322 | var bower = injectableBowerComponents('prod'); 323 | var target = gulp.src([join(PATH.dest.prod.lib, 'lib.js'), 324 | join(PATH.dest.prod.all, '**/*.css')], {read: false}); 325 | return gulp.src(PATH.dest.prod.all + '/index.html') 326 | .pipe(inject(series(target, bower), { transform: transformPath('prod') })) 327 | .pipe(template(templateLocals())) 328 | .pipe(gulp.dest(PATH.dest.prod.all)); 329 | }); 330 | 331 | gulp.task('build.app.prod', function (done) { 332 | // build.init.prod does not work as sub tasks dependencies so placed it here. 333 | runSequence('clean.app.prod', 'build.init.prod', 'build.assets.prod', 334 | 'build.index.prod', 'clean.tmp', done); 335 | }); 336 | 337 | gulp.task('build.prod', function (done) { 338 | runSequence('clean.prod', 'build.lib.prod', 'clean.tmp', 'build.app.prod', 339 | done); 340 | }); 341 | 342 | // -------------- 343 | // Version. 344 | 345 | registerBumpTasks(); 346 | 347 | gulp.task('bump.reset', function () { 348 | return gulp.src('package.json') 349 | .pipe(bump({version: '0.0.0'})) 350 | .pipe(gulp.dest('./')); 351 | }); 352 | 353 | // -------------- 354 | // Test. 355 | 356 | // To be implemented. 357 | 358 | // -------------- 359 | // Serve dev. 360 | 361 | gulp.task('serve.dev', ['build.dev', 'livereload'], function () { 362 | watch('./app/**', function (e) { 363 | runSequence('build.app.dev', function () { 364 | notifyLiveReload(e); 365 | }); 366 | }); 367 | serveSPA('dev'); 368 | }); 369 | 370 | // -------------- 371 | // Serve prod. 372 | 373 | gulp.task('serve.prod', ['build.prod', 'livereload'], function () { 374 | watch('./app/**', function (e) { 375 | runSequence('build.app.prod', function () { 376 | notifyLiveReload(e); 377 | }); 378 | }); 379 | serveSPA('prod'); 380 | }); 381 | 382 | // -------------- 383 | // Livereload. 384 | 385 | gulp.task('livereload', function () { 386 | tinylr.listen(LIVE_RELOAD_PORT); 387 | }); 388 | 389 | // -------------- 390 | // Utils. 391 | 392 | function notifyLiveReload(e) { 393 | var fileName = e.path; 394 | tinylr.changed({ 395 | body: { 396 | files: [fileName] 397 | } 398 | }); 399 | } 400 | 401 | function transformPath(env) { 402 | var v = '?v=' + getVersion(); 403 | return function (filepath) { 404 | var filename = filepath.replace('/' + PATH.dest[env].all, '') + v; 405 | arguments[0] = join(APP_BASE, filename); 406 | return inject.transform.apply(inject.transform, arguments); 407 | }; 408 | } 409 | 410 | function injectableDevAssetsRef() { 411 | var src = PATH.src.lib.map(function (path) { 412 | return join(PATH.dest.dev.lib, path.split('/').pop()); 413 | }); 414 | src.push(PATH.dest.dev.ng2, PATH.dest.dev.router, 415 | join(PATH.dest.dev.all, '**/*.css')); 416 | return src; 417 | } 418 | 419 | function getVersion() { 420 | var pkg = JSON.parse(fs.readFileSync('package.json')); 421 | return pkg.version; 422 | } 423 | 424 | function templateLocals() { 425 | return { 426 | VERSION: getVersion(), 427 | APP_BASE: APP_BASE 428 | }; 429 | } 430 | 431 | function registerBumpTasks() { 432 | semverReleases.forEach(function (release) { 433 | var semverTaskName = 'semver.' + release; 434 | var bumpTaskName = 'bump.' + release; 435 | gulp.task(semverTaskName, function () { 436 | var version = semver.inc(getVersion(), release); 437 | return gulp.src('package.json') 438 | .pipe(bump({version: version})) 439 | .pipe(gulp.dest('./')); 440 | }); 441 | gulp.task(bumpTaskName, function (done) { 442 | runSequence(semverTaskName, 'build.app.prod', done); 443 | }); 444 | }); 445 | } 446 | 447 | function injectableBowerComponents(path) { 448 | 449 | var jsFilter = filter('**/*.js'); 450 | var cssFilter = filter('**/*.css'); 451 | 452 | return gulp.src(bowerFiles()) 453 | .pipe(jsFilter) 454 | .pipe(uglify()) 455 | .pipe(gulp.dest(PATH.dest[path].vendor)) 456 | .pipe(jsFilter.restore()) 457 | .pipe(cssFilter) 458 | .pipe(concat('vendor.css')) 459 | .pipe(minifyCSS()) 460 | .pipe(rename({ suffix: '.min' })) 461 | .pipe(gulp.dest(PATH.dest[path].vendor)) 462 | .pipe(cssFilter.restore()); 463 | } 464 | 465 | function serveSPA(env) { 466 | var app; 467 | app = express().use(APP_BASE, connectLivereload({port: LIVE_RELOAD_PORT}), serveStatic(join(__dirname, PATH.dest[env].all))); 468 | app.all(APP_BASE + '*', function (req, res, next) { 469 | res.sendFile(join(__dirname, PATH.dest[env].all, 'index.html')); 470 | }); 471 | app.listen(PORT, function () { 472 | openResource('http://localhost:' + PORT + APP_BASE); 473 | }); 474 | } 475 | -------------------------------------------------------------------------------- /app/templates/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%- appName %>", 3 | "version": "0.0.0", 4 | "dependencies": { 5 | "angular2": "2.0.0-alpha.34", 6 | "es6-module-loader": "^0.15.0", 7 | "gulp-jade": "^1.1.0", 8 | "reflect-metadata": "0.1.0", 9 | "rx": "^4.0.7", 10 | "systemjs": "^0.16.0", 11 | "zone.js": "^0.4.1" 12 | }, 13 | "devDependencies": { 14 | 15 | <% if (props.cssPreprocessor.key === 'node-sass') { %> 16 | "gulp-sass": "~2.0.1", 17 | <% } %> 18 | 19 | <% if (props.htmlPreprocessor.key !== 'none') { %> 20 | "gulp-consolidate": "~0.1.2", 21 | <% } if (props.htmlPreprocessor.key === 'jade') { %> 22 | "jade": "~1.11.0", 23 | <% } %> 24 | 25 | "connect-livereload": "^0.5.3", 26 | "del": "^1.1.1", 27 | "express": "~4.13.1", 28 | "gulp": "^3.8.11", 29 | "gulp-bump": "^0.3.1", 30 | "gulp-concat": "^2.5.2", 31 | "gulp-filter": "^2.0.2", 32 | "gulp-inject": "^1.3.1", 33 | "gulp-minify-css": "^1.1.6", 34 | "gulp-minify-html": "^1.0.3", 35 | "gulp-plumber": "~1.0.1", 36 | "gulp-sourcemaps": "~1.5.2", 37 | "gulp-template": "^3.0.0", 38 | "gulp-typescript": "~2.7.5", 39 | "gulp-uglify": "^1.2.0", 40 | "gulp-watch": "^4.2.4", 41 | "gulp-insert": "^0.5.0", 42 | "gulp-rename": "^1.2.2", 43 | "main-bower-files": "^2.11.1", 44 | "open": "0.0.5", 45 | "run-sequence": "^1.1.0", 46 | "semver": "^4.3.6", 47 | "serve-static": "^1.9.2", 48 | "stream-series": "^0.1.1", 49 | "systemjs-builder": "^0.10.6", 50 | "tiny-lr": "^0.1.6", 51 | "typescript": "~1.5.3" 52 | 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/templates/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.5.3", 3 | "compilerOptions": { 4 | "target": "es5", 5 | "module": "commonjs", 6 | "declaration": false, 7 | "noImplicitAny": false, 8 | "removeComments": true, 9 | "noLib": false, 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "sourceMap": true 13 | }, 14 | "files": [ 15 | "./app/app.ts", 16 | "./app/components/about/about.ts", 17 | "./app/components/home/home.ts", 18 | "./app/init.ts", 19 | "./app/services/NameList.ts", 20 | "./app/typings/_custom.d.ts", 21 | "./tsd_typings/angular2/angular2.d.ts", 22 | "./tsd_typings/angular2/router.d.ts", 23 | "./tsd_typings/es6-promise/es6-promise.d.ts", 24 | "./tsd_typings/rx/rx-lite.d.ts", 25 | "./tsd_typings/rx/rx.d.ts", 26 | "./tsd_typings/systemjs/systemjs.d.ts", 27 | "./tsd_typings/tsd.d.ts" 28 | ], 29 | "filesGlob": [ 30 | "./app/**/*.ts", 31 | "./tsd_typings/**/*.ts" 32 | ], 33 | "compileOnSave": false 34 | } 35 | -------------------------------------------------------------------------------- /app/templates/tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "tsd_typings", 6 | "bundle": "tsd_typings/tsd.d.ts", 7 | "installed": { 8 | "es6-promise/es6-promise.d.ts": { 9 | "commit": "8ebc099072402b1a80d205c3eece59bed963ad87" 10 | }, 11 | "rx/rx.d.ts": { 12 | "commit": "8ebc099072402b1a80d205c3eece59bed963ad87" 13 | }, 14 | "rx/rx-lite.d.ts": { 15 | "commit": "8ebc099072402b1a80d205c3eece59bed963ad87" 16 | }, 17 | "angular2/angular2.d.ts": { 18 | "commit": "f6c8ca47193fb67947944a3170912672ac3e908e" 19 | }, 20 | "angular2/router.d.ts": { 21 | "commit": "f6c8ca47193fb67947944a3170912672ac3e908e" 22 | }, 23 | "systemjs/systemjs.d.ts": { 24 | "commit": "bd03c6ea51abde7d13e354908716c6373fc38b1f" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/templates/tsd_typings/angular2/router.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for Angular v2.0.0-alpha.31 2 | // Project: http://angular.io/ 3 | // Definitions by: angular team 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | // *********************************************************** 7 | // This file is generated by the Angular build process. 8 | // Please do not create manual edits or send pull requests 9 | // modifying this file. 10 | // *********************************************************** 11 | /// 12 | 13 | 14 | 15 | /** 16 | * @module 17 | * @description 18 | * Maps application URLs into application states, to support deep-linking and navigation. 19 | */ 20 | declare module ng { 21 | interface List extends Array {} 22 | interface Map {} 23 | interface StringMap extends Map {} 24 | 25 | export class Instruction { 26 | // "capturedUrl" is the part of the URL captured by this instruction 27 | // "accumulatedUrl" is the part of the URL captured by this instruction and all children 28 | accumulatedUrl: string; 29 | reuse: boolean; 30 | specificity: number; 31 | 32 | private _params: StringMap; 33 | 34 | constructor (component: any, capturedUrl: string, 35 | _recognizer: PathRecognizer, child: Instruction); 36 | 37 | params(): StringMap; 38 | } 39 | 40 | class TouchMap { 41 | map: StringMap; 42 | keys: StringMap; 43 | 44 | constructor(map: StringMap); 45 | 46 | get(key: string): string; 47 | 48 | getUnused(): StringMap; 49 | } 50 | 51 | export class Segment { 52 | name: string; 53 | regex: string; 54 | generate(params: TouchMap): string; 55 | } 56 | 57 | export class PathRecognizer { 58 | segments: List; 59 | regex: RegExp; 60 | specificity: number; 61 | terminal: boolean; 62 | path: string; 63 | handler: RouteHandler; 64 | 65 | constructor(path: string, handler: RouteHandler); 66 | 67 | parseParams(url: string): StringMap; 68 | 69 | generate(params: StringMap): string; 70 | 71 | resolveComponentType(): Promise; 72 | } 73 | 74 | 75 | export interface RouteHandler { 76 | componentType: Function; 77 | resolveComponentType(): Promise; 78 | } 79 | 80 | /** 81 | * # Router 82 | * The router is responsible for mapping URLs to components. 83 | * 84 | * You can see the state of the router by inspecting the read-only field `router.navigating`. 85 | * This may be useful for showing a spinner, for instance. 86 | * 87 | * ## Concepts 88 | * Routers and component instances have a 1:1 correspondence. 89 | * 90 | * The router holds reference to a number of "outlets." An outlet is a placeholder that the 91 | * router dynamically fills in depending on the current URL. 92 | * 93 | * When the router navigates from a URL, it must first recognizes it and serialize it into an 94 | * `Instruction`. 95 | * The router uses the `RouteRegistry` to get an `Instruction`. 96 | */ 97 | class Router { 98 | 99 | navigating: boolean; 100 | 101 | lastNavigationAttempt: string; 102 | 103 | registry: RouteRegistry; 104 | 105 | parent: Router; 106 | 107 | hostComponent: any; 108 | 109 | 110 | /** 111 | * Constructs a child router. You probably don't need to use this unless you're writing a reusable 112 | * component. 113 | */ 114 | childRouter(hostComponent: any): Router; 115 | 116 | 117 | /** 118 | * Register an object to notify of route changes. You probably don't need to use this unless 119 | * you're writing a reusable component. 120 | */ 121 | registerOutlet(outlet: RouterOutlet): Promise; 122 | 123 | 124 | /** 125 | * Dynamically update the routing configuration and trigger a navigation. 126 | * 127 | * # Usage 128 | * 129 | * ``` 130 | * router.config({ 'path': '/', 'component': IndexCmp}); 131 | * ``` 132 | * 133 | * Or: 134 | * 135 | * ``` 136 | * router.config([ 137 | * { 'path': '/', 'component': IndexComp }, 138 | * { 'path': '/user/:id', 'component': UserComp }, 139 | * ]); 140 | * ``` 141 | */ 142 | config(config: StringMap| List>): Promise; 143 | 144 | 145 | /** 146 | * Navigate to a URL. Returns a promise that resolves when navigation is complete. 147 | * 148 | * If the given URL begins with a `/`, router will navigate absolutely. 149 | * If the given URL does not begin with `/`, the router will navigate relative to this component. 150 | */ 151 | navigate(url: string): Promise; 152 | 153 | 154 | /** 155 | * Updates this router and all descendant routers according to the given instruction 156 | */ 157 | commit(instruction: Instruction): Promise; 158 | 159 | 160 | /** 161 | * Subscribe to URL updates from the router 162 | */ 163 | subscribe(onNext: any): void; 164 | 165 | 166 | /** 167 | * Removes the contents of this router's outlet and all descendant outlets 168 | */ 169 | deactivate(instruction: Instruction): Promise; 170 | 171 | 172 | /** 173 | * Given a URL, returns an instruction representing the component graph 174 | */ 175 | recognize(url: string): Promise; 176 | 177 | 178 | /** 179 | * Navigates to either the last URL successfully navigated to, or the last URL requested if the 180 | * router has yet to successfully navigate. 181 | */ 182 | renavigate(): Promise; 183 | 184 | 185 | /** 186 | * Generate a URL from a component name and optional map of parameters. The URL is relative to the 187 | * app's base href. 188 | */ 189 | generate(linkParams: List): string; 190 | } 191 | 192 | class RootRouter extends Router { 193 | 194 | commit(instruction: any): Promise; 195 | } 196 | 197 | 198 | /** 199 | * A router outlet is a placeholder that Angular dynamically fills based on the application's route. 200 | * 201 | * ## Use 202 | * 203 | * ``` 204 | * 205 | * ``` 206 | */ 207 | class RouterOutlet { 208 | 209 | childRouter: Router; 210 | 211 | 212 | /** 213 | * Given an instruction, update the contents of this outlet. 214 | */ 215 | commit(instruction: Instruction): Promise; 216 | 217 | 218 | /** 219 | * Called by Router during recognition phase 220 | */ 221 | canDeactivate(nextInstruction: Instruction): Promise; 222 | 223 | 224 | /** 225 | * Called by Router during recognition phase 226 | */ 227 | canReuse(nextInstruction: Instruction): Promise; 228 | 229 | deactivate(nextInstruction: Instruction): Promise; 230 | } 231 | 232 | 233 | /** 234 | * The RouterLink directive lets you link to specific parts of your app. 235 | * 236 | * Consider the following route configuration: 237 | * 238 | * ``` 239 | * @RouteConfig({ 240 | * path: '/user', component: UserCmp, as: 'user' 241 | * }); 242 | * class MyComp {} 243 | * ``` 244 | * 245 | * When linking to this `user` route, you can write: 246 | * 247 | * ``` 248 | * link to user component 249 | * ``` 250 | * 251 | * RouterLink expects the value to be an array of route names, followed by the params 252 | * for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]` 253 | * means that we want to generate a link for the `team` route with params `{teamId: 1}`, 254 | * and with a child route `user` with params `{userId: 2}`. 255 | * 256 | * The first route name should be prepended with `/`, `./`, or `../`. 257 | * If the route begins with `/`, the router will look up the route from the root of the app. 258 | * If the route begins with `./`, the router will instead look in the current component's 259 | * children for the route. And if the route begins with `../`, the router will look at the 260 | * current component's parent. 261 | */ 262 | class RouterLink { 263 | 264 | visibleHref: string; 265 | 266 | routeParams: void; 267 | 268 | onClick(): boolean; 269 | } 270 | 271 | class RouteParams { 272 | 273 | params: StringMap; 274 | 275 | get(param: string): string; 276 | } 277 | 278 | 279 | /** 280 | * The RouteRegistry holds route configurations for each component in an Angular app. 281 | * It is responsible for creating Instructions from URLs, and generating URLs based on route and 282 | * parameters. 283 | */ 284 | class RouteRegistry { 285 | 286 | 287 | /** 288 | * Given a component and a configuration object, add the route to this registry 289 | */ 290 | config(parentComponent: any, config: StringMap): void; 291 | 292 | 293 | /** 294 | * Reads the annotations of a component and configures the registry based on them 295 | */ 296 | configFromComponent(component: any): void; 297 | 298 | 299 | /** 300 | * Given a URL and a parent component, return the most specific instruction for navigating 301 | * the application into the state specified by the url 302 | */ 303 | recognize(url: string, parentComponent: any): Promise; 304 | 305 | 306 | /** 307 | * Given a normalized list with component names and params like: `['user', {id: 3 }]` 308 | * generates a url with a leading slash relative to the provided `parentComponent`. 309 | */ 310 | generate(linkParams: List, parentComponent: any): string; 311 | } 312 | 313 | class LocationStrategy { 314 | 315 | path(): string; 316 | 317 | pushState(ctx: any, title: string, url: string): void; 318 | 319 | forward(): void; 320 | 321 | back(): void; 322 | 323 | onPopState(fn: any): void; 324 | 325 | getBaseHref(): string; 326 | } 327 | 328 | class HashLocationStrategy extends LocationStrategy { 329 | 330 | onPopState(fn: EventListener): void; 331 | 332 | getBaseHref(): string; 333 | 334 | path(): string; 335 | 336 | pushState(state: any, title: string, url: string): void; 337 | 338 | forward(): void; 339 | 340 | back(): void; 341 | } 342 | 343 | class HTML5LocationStrategy extends LocationStrategy { 344 | 345 | onPopState(fn: EventListener): void; 346 | 347 | getBaseHref(): string; 348 | 349 | path(): string; 350 | 351 | pushState(state: any, title: string, url: string): void; 352 | 353 | forward(): void; 354 | 355 | back(): void; 356 | } 357 | 358 | 359 | /** 360 | * This is the service that an application developer will directly interact with. 361 | * 362 | * Responsible for normalizing the URL against the application's base href. 363 | * A normalized URL is absolute from the URL host, includes the application's base href, and has no 364 | * trailing slash: 365 | * - `/my/app/user/123` is normalized 366 | * - `my/app/user/123` **is not** normalized 367 | * - `/my/app/user/123/` **is not** normalized 368 | */ 369 | class Location { 370 | 371 | path(): string; 372 | 373 | normalize(url: string): string; 374 | 375 | normalizeAbsolutely(url: string): string; 376 | 377 | go(url: string): void; 378 | 379 | forward(): void; 380 | 381 | back(): void; 382 | 383 | subscribe(onNext: any, onThrow?: any, onReturn?: any): void; 384 | } 385 | 386 | var appBaseHrefToken : OpaqueToken ; 387 | 388 | 389 | /** 390 | * Responsible for performing each step of navigation. 391 | * "Steps" are conceptually similar to "middleware" 392 | */ 393 | class Pipeline { 394 | 395 | steps: List; 396 | 397 | process(instruction: Instruction): Promise; 398 | } 399 | 400 | 401 | /** 402 | * Defines route lifecycle method [onActivate] 403 | */ 404 | interface OnActivate { 405 | 406 | onActivate(nextInstruction: Instruction, prevInstruction: Instruction): any; 407 | } 408 | 409 | 410 | /** 411 | * Defines route lifecycle method [onDeactivate] 412 | */ 413 | interface OnDeactivate { 414 | 415 | onDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any; 416 | } 417 | 418 | 419 | /** 420 | * Defines route lifecycle method [onReuse] 421 | */ 422 | interface OnReuse { 423 | 424 | onReuse(nextInstruction: Instruction, prevInstruction: Instruction): any; 425 | } 426 | 427 | 428 | /** 429 | * Defines route lifecycle method [canDeactivate] 430 | */ 431 | interface CanDeactivate { 432 | 433 | canDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any; 434 | } 435 | 436 | 437 | /** 438 | * Defines route lifecycle method [canReuse] 439 | */ 440 | interface CanReuse { 441 | 442 | canReuse(nextInstruction: Instruction, prevInstruction: Instruction): any; 443 | } 444 | 445 | var CanActivate:any; 446 | 447 | var routerDirectives : List ; 448 | 449 | var routerInjectables : List ; 450 | 451 | var RouteConfig:any; 452 | 453 | } 454 | 455 | 456 | 457 | declare module "angular2/router" { 458 | export = ng; 459 | } 460 | -------------------------------------------------------------------------------- /app/templates/tsd_typings/es6-promise/es6-promise.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for es6-promise 2 | // Project: https://github.com/jakearchibald/ES6-Promise 3 | // Definitions by: François de Campredon , vvakame 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | interface Thenable { 7 | then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; 8 | then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; 9 | } 10 | 11 | declare class Promise implements Thenable { 12 | /** 13 | * If you call resolve in the body of the callback passed to the constructor, 14 | * your promise is fulfilled with result object passed to resolve. 15 | * If you call reject your promise is rejected with the object passed to resolve. 16 | * For consistency and debugging (eg stack traces), obj should be an instanceof Error. 17 | * Any errors thrown in the constructor callback will be implicitly passed to reject(). 18 | */ 19 | constructor(callback: (resolve : (value?: R | Thenable) => void, reject: (error?: any) => void) => void); 20 | 21 | /** 22 | * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. 23 | * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. 24 | * Both callbacks have a single parameter , the fulfillment value or rejection reason. 25 | * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. 26 | * If an error is thrown in the callback, the returned promise rejects with that error. 27 | * 28 | * @param onFulfilled called when/if "promise" resolves 29 | * @param onRejected called when/if "promise" rejects 30 | */ 31 | then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; 32 | then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Promise; 33 | 34 | /** 35 | * Sugar for promise.then(undefined, onRejected) 36 | * 37 | * @param onRejected called when/if "promise" rejects 38 | */ 39 | catch(onRejected?: (error: any) => U | Thenable): Promise; 40 | } 41 | 42 | declare module Promise { 43 | /** 44 | * Make a new promise from the thenable. 45 | * A thenable is promise-like in as far as it has a "then" method. 46 | */ 47 | function resolve(value?: R | Thenable): Promise; 48 | 49 | /** 50 | * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error 51 | */ 52 | function reject(error: any): Promise; 53 | 54 | /** 55 | * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. 56 | * the array passed to all can be a mixture of promise-like objects and other objects. 57 | * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. 58 | */ 59 | function all(promises: (R | Thenable)[]): Promise; 60 | 61 | /** 62 | * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. 63 | */ 64 | function race(promises: (R | Thenable)[]): Promise; 65 | } 66 | 67 | declare module 'es6-promise' { 68 | var foo: typeof Promise; // Temp variable to reference Promise in local context 69 | module rsvp { 70 | export var Promise: typeof foo; 71 | } 72 | export = rsvp; 73 | } 74 | -------------------------------------------------------------------------------- /app/templates/tsd_typings/rx/rx-lite.d.ts: -------------------------------------------------------------------------------- 1 | // DefinitelyTyped: partial 2 | 3 | // This file contains common part of defintions for rx.d.ts and rx.lite.d.ts 4 | // Do not include the file separately. 5 | 6 | declare module Rx { 7 | export module internals { 8 | function isEqual(left: any, right: any): boolean; 9 | function addRef(xs: Observable, r: { getDisposable(): IDisposable; }): Observable; 10 | 11 | // Priority Queue for Scheduling 12 | export class PriorityQueue { 13 | constructor(capacity: number); 14 | 15 | length: number; 16 | 17 | isHigherPriority(left: number, right: number): boolean; 18 | percolate(index: number): void; 19 | heapify(index: number): void; 20 | peek(): ScheduledItem; 21 | removeAt(index: number): void; 22 | dequeue(): ScheduledItem; 23 | enqueue(item: ScheduledItem): void; 24 | remove(item: ScheduledItem): boolean; 25 | 26 | static count: number; 27 | } 28 | 29 | export class ScheduledItem { 30 | constructor(scheduler: IScheduler, state: any, action: (scheduler: IScheduler, state: any) => IDisposable, dueTime: TTime, comparer?: (x: TTime, y: TTime) => number); 31 | 32 | scheduler: IScheduler; 33 | state: TTime; 34 | action: (scheduler: IScheduler, state: any) => IDisposable; 35 | dueTime: TTime; 36 | comparer: (x: TTime, y: TTime) => number; 37 | disposable: SingleAssignmentDisposable; 38 | 39 | invoke(): void; 40 | compareTo(other: ScheduledItem): number; 41 | isCancelled(): boolean; 42 | invokeCore(): IDisposable; 43 | } 44 | } 45 | 46 | export module config { 47 | export var Promise: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise; }; 48 | } 49 | 50 | export module helpers { 51 | function noop(): void; 52 | function notDefined(value: any): boolean; 53 | function isScheduler(value: any): boolean; 54 | function identity(value: T): T; 55 | function defaultNow(): number; 56 | function defaultComparer(left: any, right: any): boolean; 57 | function defaultSubComparer(left: any, right: any): number; 58 | function defaultKeySerializer(key: any): string; 59 | function defaultError(err: any): void; 60 | function isPromise(p: any): boolean; 61 | function asArray(...args: T[]): T[]; 62 | function not(value: any): boolean; 63 | function isFunction(value: any): boolean; 64 | } 65 | 66 | export interface IDisposable { 67 | dispose(): void; 68 | } 69 | 70 | export class CompositeDisposable implements IDisposable { 71 | constructor (...disposables: IDisposable[]); 72 | constructor (disposables: IDisposable[]); 73 | 74 | isDisposed: boolean; 75 | length: number; 76 | 77 | dispose(): void; 78 | add(item: IDisposable): void; 79 | remove(item: IDisposable): boolean; 80 | toArray(): IDisposable[]; 81 | } 82 | 83 | export class Disposable implements IDisposable { 84 | constructor(action: () => void); 85 | 86 | static create(action: () => void): IDisposable; 87 | static empty: IDisposable; 88 | 89 | dispose(): void; 90 | } 91 | 92 | // Single assignment 93 | export class SingleAssignmentDisposable implements IDisposable { 94 | constructor(); 95 | 96 | isDisposed: boolean; 97 | current: IDisposable; 98 | 99 | dispose(): void ; 100 | getDisposable(): IDisposable; 101 | setDisposable(value: IDisposable): void ; 102 | } 103 | 104 | // SerialDisposable it's an alias of SingleAssignmentDisposable 105 | export class SerialDisposable extends SingleAssignmentDisposable { 106 | constructor(); 107 | } 108 | 109 | export class RefCountDisposable implements IDisposable { 110 | constructor(disposable: IDisposable); 111 | 112 | dispose(): void; 113 | 114 | isDisposed: boolean; 115 | getDisposable(): IDisposable; 116 | } 117 | 118 | export interface IScheduler { 119 | now(): number; 120 | 121 | schedule(action: () => void): IDisposable; 122 | scheduleWithState(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable; 123 | scheduleWithAbsolute(dueTime: number, action: () => void): IDisposable; 124 | scheduleWithAbsoluteAndState(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) =>IDisposable): IDisposable; 125 | scheduleWithRelative(dueTime: number, action: () => void): IDisposable; 126 | scheduleWithRelativeAndState(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) =>IDisposable): IDisposable; 127 | 128 | scheduleRecursive(action: (action: () =>void ) =>void ): IDisposable; 129 | scheduleRecursiveWithState(state: TState, action: (state: TState, action: (state: TState) =>void ) =>void ): IDisposable; 130 | scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable; 131 | scheduleRecursiveWithAbsoluteAndState(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable; 132 | scheduleRecursiveWithRelative(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): IDisposable; 133 | scheduleRecursiveWithRelativeAndState(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) =>void ) =>void ): IDisposable; 134 | 135 | schedulePeriodic(period: number, action: () => void): IDisposable; 136 | schedulePeriodicWithState(state: TState, period: number, action: (state: TState) => TState): IDisposable; 137 | } 138 | 139 | export interface Scheduler extends IScheduler { 140 | } 141 | 142 | export interface SchedulerStatic { 143 | new ( 144 | now: () => number, 145 | schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable, 146 | scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable, 147 | scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Scheduler; 148 | 149 | normalize(timeSpan: number): number; 150 | 151 | immediate: IScheduler; 152 | currentThread: ICurrentThreadScheduler; 153 | timeout: IScheduler; 154 | } 155 | 156 | export var Scheduler: SchedulerStatic; 157 | 158 | // Current Thread IScheduler 159 | interface ICurrentThreadScheduler extends IScheduler { 160 | scheduleRequired(): boolean; 161 | } 162 | 163 | // Notifications 164 | export class Notification { 165 | accept(observer: IObserver): void; 166 | accept(onNext: (value: T) => TResult, onError?: (exception: any) => TResult, onCompleted?: () => TResult): TResult; 167 | toObservable(scheduler?: IScheduler): Observable; 168 | hasValue: boolean; 169 | equals(other: Notification): boolean; 170 | kind: string; 171 | value: T; 172 | exception: any; 173 | 174 | static createOnNext(value: T): Notification; 175 | static createOnError(exception: any): Notification; 176 | static createOnCompleted(): Notification; 177 | } 178 | 179 | /** 180 | * Promise A+ 181 | */ 182 | export interface IPromise { 183 | then(onFulfilled: (value: T) => IPromise, onRejected: (reason: any) => IPromise): IPromise; 184 | then(onFulfilled: (value: T) => IPromise, onRejected?: (reason: any) => R): IPromise; 185 | then(onFulfilled: (value: T) => R, onRejected: (reason: any) => IPromise): IPromise; 186 | then(onFulfilled?: (value: T) => R, onRejected?: (reason: any) => R): IPromise; 187 | } 188 | 189 | // Observer 190 | export interface IObserver { 191 | onNext(value: T): void; 192 | onError(exception: any): void; 193 | onCompleted(): void; 194 | } 195 | 196 | export interface Observer extends IObserver { 197 | toNotifier(): (notification: Notification) => void; 198 | asObserver(): Observer; 199 | } 200 | 201 | interface ObserverStatic { 202 | create(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observer; 203 | fromNotifier(handler: (notification: Notification, thisArg?: any) => void): Observer; 204 | } 205 | 206 | export var Observer: ObserverStatic; 207 | 208 | export interface IObservable { 209 | subscribe(observer: Observer): IDisposable; 210 | subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable; 211 | 212 | subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable; 213 | subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable; 214 | subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable; 215 | } 216 | 217 | export interface Observable extends IObservable { 218 | forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable; // alias for subscribe 219 | toArray(): Observable; 220 | 221 | catch(handler: (exception: any) => Observable): Observable; 222 | catchException(handler: (exception: any) => Observable): Observable; // alias for catch 223 | catch(handler: (exception: any) => IPromise): Observable; 224 | catchException(handler: (exception: any) => IPromise): Observable; // alias for catch 225 | catch(second: Observable): Observable; 226 | catchException(second: Observable): Observable; // alias for catch 227 | combineLatest(second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; 228 | combineLatest(second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; 229 | combineLatest(second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 230 | combineLatest(second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 231 | combineLatest(second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 232 | combineLatest(second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 233 | combineLatest(second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 234 | combineLatest(second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 235 | combineLatest(second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 236 | combineLatest(second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 237 | combineLatest(second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 238 | combineLatest(second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 239 | combineLatest(second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 240 | combineLatest(second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 241 | combineLatest(second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; 242 | combineLatest(souces: Observable[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; 243 | combineLatest(souces: IPromise[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; 244 | concat(...sources: Observable[]): Observable; 245 | concat(...sources: IPromise[]): Observable; 246 | concat(sources: Observable[]): Observable; 247 | concat(sources: IPromise[]): Observable; 248 | concatAll(): T; 249 | concatObservable(): T; // alias for concatAll 250 | concatMap(selector: (value: T, index: number) => Observable, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; // alias for selectConcat 251 | concatMap(selector: (value: T, index: number) => IPromise, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; // alias for selectConcat 252 | concatMap(selector: (value: T, index: number) => Observable): Observable; // alias for selectConcat 253 | concatMap(selector: (value: T, index: number) => IPromise): Observable; // alias for selectConcat 254 | concatMap(sequence: Observable): Observable; // alias for selectConcat 255 | merge(maxConcurrent: number): T; 256 | merge(other: Observable): Observable; 257 | merge(other: IPromise): Observable; 258 | mergeAll(): T; 259 | mergeObservable(): T; // alias for mergeAll 260 | skipUntil(other: Observable): Observable; 261 | skipUntil(other: IPromise): Observable; 262 | switch(): T; 263 | switchLatest(): T; // alias for switch 264 | takeUntil(other: Observable): Observable; 265 | takeUntil(other: IPromise): Observable; 266 | zip(second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; 267 | zip(second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; 268 | zip(second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 269 | zip(second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 270 | zip(second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 271 | zip(second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 272 | zip(second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 273 | zip(second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 274 | zip(second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 275 | zip(second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 276 | zip(second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 277 | zip(second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 278 | zip(second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 279 | zip(second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 280 | zip(second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; 281 | zip(second: Observable[], resultSelector: (left: T, ...right: TOther[]) => TResult): Observable; 282 | zip(second: IPromise[], resultSelector: (left: T, ...right: TOther[]) => TResult): Observable; 283 | 284 | asObservable(): Observable; 285 | dematerialize(): Observable; 286 | distinctUntilChanged(skipParameter: boolean, comparer: (x: T, y: T) => boolean): Observable; 287 | distinctUntilChanged(keySelector?: (value: T) => TValue, comparer?: (x: TValue, y: TValue) => boolean): Observable; 288 | do(observer: Observer): Observable; 289 | doAction(observer: Observer): Observable; // alias for do 290 | tap(observer: Observer): Observable; // alias for do 291 | do(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; 292 | doAction(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; // alias for do 293 | tap(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; // alias for do 294 | 295 | doOnNext(onNext: (value: T) => void, thisArg?: any): Observable; 296 | doOnError(onError: (exception: any) => void, thisArg?: any): Observable; 297 | doOnCompleted(onCompleted: () => void, thisArg?: any): Observable; 298 | tapOnNext(onNext: (value: T) => void, thisArg?: any): Observable; 299 | tapOnError(onError: (exception: any) => void, thisArg?: any): Observable; 300 | tapOnCompleted(onCompleted: () => void, thisArg?: any): Observable; 301 | 302 | finally(action: () => void): Observable; 303 | finallyAction(action: () => void): Observable; // alias for finally 304 | ignoreElements(): Observable; 305 | materialize(): Observable>; 306 | repeat(repeatCount?: number): Observable; 307 | retry(retryCount?: number): Observable; 308 | scan(seed: TAcc, accumulator: (acc: TAcc, value: T) => TAcc): Observable; 309 | scan(accumulator: (acc: T, value: T) => T): Observable; 310 | skipLast(count: number): Observable; 311 | startWith(...values: T[]): Observable; 312 | startWith(scheduler: IScheduler, ...values: T[]): Observable; 313 | takeLast(count: number): Observable; 314 | takeLastBuffer(count: number): Observable; 315 | 316 | select(selector: (value: T, index: number, source: Observable) => TResult, thisArg?: any): Observable; 317 | map(selector: (value: T, index: number, source: Observable) => TResult, thisArg?: any): Observable; // alias for select 318 | pluck(prop: string): Observable; 319 | selectMany(selector: (value: T) => Observable, resultSelector: (item: T, other: TOther) => TResult): Observable; 320 | selectMany(selector: (value: T) => IPromise, resultSelector: (item: T, other: TOther) => TResult): Observable; 321 | selectMany(selector: (value: T) => Observable): Observable; 322 | selectMany(selector: (value: T) => IPromise): Observable; 323 | selectMany(other: Observable): Observable; 324 | selectMany(other: IPromise): Observable; 325 | flatMap(selector: (value: T) => Observable, resultSelector: (item: T, other: TOther) => TResult): Observable; // alias for selectMany 326 | flatMap(selector: (value: T) => IPromise, resultSelector: (item: T, other: TOther) => TResult): Observable; // alias for selectMany 327 | flatMap(selector: (value: T) => Observable): Observable; // alias for selectMany 328 | flatMap(selector: (value: T) => IPromise): Observable; // alias for selectMany 329 | flatMap(other: Observable): Observable; // alias for selectMany 330 | flatMap(other: IPromise): Observable; // alias for selectMany 331 | 332 | selectConcat(selector: (value: T, index: number) => Observable, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; 333 | selectConcat(selector: (value: T, index: number) => IPromise, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; 334 | selectConcat(selector: (value: T, index: number) => Observable): Observable; 335 | selectConcat(selector: (value: T, index: number) => IPromise): Observable; 336 | selectConcat(sequence: Observable): Observable; 337 | 338 | /** 339 | * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then 340 | * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. 341 | * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. 342 | * @param [thisArg] Object to use as this when executing callback. 343 | * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences 344 | * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. 345 | */ 346 | selectSwitch(selector: (value: T, index: number, source: Observable) => Observable, thisArg?: any): Observable; 347 | /** 348 | * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then 349 | * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. 350 | * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. 351 | * @param [thisArg] Object to use as this when executing callback. 352 | * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences 353 | * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. 354 | */ 355 | flatMapLatest(selector: (value: T, index: number, source: Observable) => Observable, thisArg?: any): Observable; // alias for selectSwitch 356 | /** 357 | * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then 358 | * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. 359 | * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. 360 | * @param [thisArg] Object to use as this when executing callback. 361 | * @since 2.2.28 362 | * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences 363 | * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. 364 | */ 365 | switchMap(selector: (value: T, index: number, source: Observable) => TResult, thisArg?: any): Observable; // alias for selectSwitch 366 | 367 | skip(count: number): Observable; 368 | skipWhile(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; 369 | take(count: number, scheduler?: IScheduler): Observable; 370 | takeWhile(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; 371 | where(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; 372 | filter(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; // alias for where 373 | 374 | /** 375 | * Converts an existing observable sequence to an ES6 Compatible Promise 376 | * @example 377 | * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); 378 | * @param promiseCtor The constructor of the promise. 379 | * @returns An ES6 compatible promise with the last value from the observable sequence. 380 | */ 381 | toPromise>(promiseCtor: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): TPromise; }): TPromise; 382 | /** 383 | * Converts an existing observable sequence to an ES6 Compatible Promise 384 | * @example 385 | * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); 386 | * 387 | * // With config 388 | * Rx.config.Promise = RSVP.Promise; 389 | * var promise = Rx.Observable.return(42).toPromise(); 390 | * @param [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise. 391 | * @returns An ES6 compatible promise with the last value from the observable sequence. 392 | */ 393 | toPromise(promiseCtor?: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise; }): IPromise; 394 | 395 | // Experimental Flattening 396 | 397 | /** 398 | * Performs a exclusive waiting for the first to finish before subscribing to another observable. 399 | * Observables that come in between subscriptions will be dropped on the floor. 400 | * Can be applied on `Observable>` or `Observable>`. 401 | * @since 2.2.28 402 | * @returns A exclusive observable with only the results that happen when subscribed. 403 | */ 404 | exclusive(): Observable; 405 | 406 | /** 407 | * Performs a exclusive map waiting for the first to finish before subscribing to another observable. 408 | * Observables that come in between subscriptions will be dropped on the floor. 409 | * Can be applied on `Observable>` or `Observable>`. 410 | * @since 2.2.28 411 | * @param selector Selector to invoke for every item in the current subscription. 412 | * @param [thisArg] An optional context to invoke with the selector parameter. 413 | * @returns {An exclusive observable with only the results that happen when subscribed. 414 | */ 415 | exclusiveMap(selector: (value: I, index: number, source: Observable) => R, thisArg?: any): Observable; 416 | } 417 | 418 | interface ObservableStatic { 419 | create(subscribe: (observer: Observer) => IDisposable): Observable; 420 | create(subscribe: (observer: Observer) => () => void): Observable; 421 | create(subscribe: (observer: Observer) => void): Observable; 422 | createWithDisposable(subscribe: (observer: Observer) => IDisposable): Observable; 423 | defer(observableFactory: () => Observable): Observable; 424 | defer(observableFactory: () => IPromise): Observable; 425 | empty(scheduler?: IScheduler): Observable; 426 | 427 | /** 428 | * This method creates a new Observable sequence from an array object. 429 | * @param array An array-like or iterable object to convert to an Observable sequence. 430 | * @param mapFn Map function to call on every element of the array. 431 | * @param [thisArg] The context to use calling the mapFn if provided. 432 | * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. 433 | */ 434 | from(array: T[], mapFn: (value: T, index: number) => TResult, thisArg?: any, scheduler?: IScheduler): Observable; 435 | /** 436 | * This method creates a new Observable sequence from an array object. 437 | * @param array An array-like or iterable object to convert to an Observable sequence. 438 | * @param [mapFn] Map function to call on every element of the array. 439 | * @param [thisArg] The context to use calling the mapFn if provided. 440 | * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. 441 | */ 442 | from(array: T[], mapFn?: (value: T, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable; 443 | 444 | /** 445 | * This method creates a new Observable sequence from an array-like object. 446 | * @param array An array-like or iterable object to convert to an Observable sequence. 447 | * @param mapFn Map function to call on every element of the array. 448 | * @param [thisArg] The context to use calling the mapFn if provided. 449 | * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. 450 | */ 451 | from(array: { length: number;[index: number]: T; }, mapFn: (value: T, index: number) => TResult, thisArg?: any, scheduler?: IScheduler): Observable; 452 | /** 453 | * This method creates a new Observable sequence from an array-like object. 454 | * @param array An array-like or iterable object to convert to an Observable sequence. 455 | * @param [mapFn] Map function to call on every element of the array. 456 | * @param [thisArg] The context to use calling the mapFn if provided. 457 | * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. 458 | */ 459 | from(array: { length: number;[index: number]: T; }, mapFn?: (value: T, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable; 460 | 461 | /** 462 | * This method creates a new Observable sequence from an array-like or iterable object. 463 | * @param array An array-like or iterable object to convert to an Observable sequence. 464 | * @param [mapFn] Map function to call on every element of the array. 465 | * @param [thisArg] The context to use calling the mapFn if provided. 466 | * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. 467 | */ 468 | from(iterable: any, mapFn?: (value: any, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable; 469 | 470 | fromArray(array: T[], scheduler?: IScheduler): Observable; 471 | fromArray(array: { length: number;[index: number]: T; }, scheduler?: IScheduler): Observable; 472 | 473 | /** 474 | * Converts an iterable into an Observable sequence 475 | * 476 | * @example 477 | * var res = Rx.Observable.fromIterable(new Map()); 478 | * var res = Rx.Observable.fromIterable(function* () { yield 42; }); 479 | * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); 480 | * @param generator Generator to convert from. 481 | * @param [scheduler] Scheduler to run the enumeration of the input sequence on. 482 | * @returns The observable sequence whose elements are pulled from the given generator sequence. 483 | */ 484 | fromItreable(generator: () => { next(): { done: boolean; value?: T; }; }, scheduler?: IScheduler): Observable; 485 | 486 | /** 487 | * Converts an iterable into an Observable sequence 488 | * 489 | * @example 490 | * var res = Rx.Observable.fromIterable(new Map()); 491 | * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); 492 | * @param iterable Iterable to convert from. 493 | * @param [scheduler] Scheduler to run the enumeration of the input sequence on. 494 | * @returns The observable sequence whose elements are pulled from the given generator sequence. 495 | */ 496 | fromItreable(iterable: {}, scheduler?: IScheduler): Observable; // todo: can't describe ES6 Iterable via TypeScript type system 497 | generate(initialState: TState, condition: (state: TState) => boolean, iterate: (state: TState) => TState, resultSelector: (state: TState) => TResult, scheduler?: IScheduler): Observable; 498 | never(): Observable; 499 | 500 | /** 501 | * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. 502 | * 503 | * @example 504 | * var res = Rx.Observable.of(1, 2, 3); 505 | * @since 2.2.28 506 | * @returns The observable sequence whose elements are pulled from the given arguments. 507 | */ 508 | of(...values: T[]): Observable; 509 | 510 | /** 511 | * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. 512 | * @example 513 | * var res = Rx.Observable.ofWithScheduler(Rx.Scheduler.timeout, 1, 2, 3); 514 | * @since 2.2.28 515 | * @param [scheduler] A scheduler to use for scheduling the arguments. 516 | * @returns The observable sequence whose elements are pulled from the given arguments. 517 | */ 518 | ofWithScheduler(scheduler?: IScheduler, ...values: T[]): Observable; 519 | range(start: number, count: number, scheduler?: IScheduler): Observable; 520 | repeat(value: T, repeatCount?: number, scheduler?: IScheduler): Observable; 521 | return(value: T, scheduler?: IScheduler): Observable; 522 | /** 523 | * @since 2.2.28 524 | */ 525 | just(value: T, scheduler?: IScheduler): Observable; // alias for return 526 | returnValue(value: T, scheduler?: IScheduler): Observable; // alias for return 527 | throw(exception: Error, scheduler?: IScheduler): Observable; 528 | throw(exception: any, scheduler?: IScheduler): Observable; 529 | throwException(exception: Error, scheduler?: IScheduler): Observable; // alias for throw 530 | throwException(exception: any, scheduler?: IScheduler): Observable; // alias for throw 531 | throwError(error: Error, scheduler?: IScheduler): Observable; // alias for throw 532 | throwError(error: any, scheduler?: IScheduler): Observable; // alias for throw 533 | 534 | catch(sources: Observable[]): Observable; 535 | catch(sources: IPromise[]): Observable; 536 | catchException(sources: Observable[]): Observable; // alias for catch 537 | catchException(sources: IPromise[]): Observable; // alias for catch 538 | catchError(sources: Observable[]): Observable; // alias for catch 539 | catchError(sources: IPromise[]): Observable; // alias for catch 540 | catch(...sources: Observable[]): Observable; 541 | catch(...sources: IPromise[]): Observable; 542 | catchException(...sources: Observable[]): Observable; // alias for catch 543 | catchException(...sources: IPromise[]): Observable; // alias for catch 544 | catchError(...sources: Observable[]): Observable; // alias for catch 545 | catchError(...sources: IPromise[]): Observable; // alias for catch 546 | 547 | combineLatest(first: Observable, second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; 548 | combineLatest(first: IPromise, second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; 549 | combineLatest(first: Observable, second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; 550 | combineLatest(first: IPromise, second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; 551 | combineLatest(first: Observable, second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 552 | combineLatest(first: Observable, second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 553 | combineLatest(first: Observable, second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 554 | combineLatest(first: Observable, second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 555 | combineLatest(first: IPromise, second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 556 | combineLatest(first: IPromise, second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 557 | combineLatest(first: IPromise, second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 558 | combineLatest(first: IPromise, second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; 559 | combineLatest(first: Observable, second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 560 | combineLatest(first: Observable, second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 561 | combineLatest(first: Observable, second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 562 | combineLatest(first: Observable, second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 563 | combineLatest(first: Observable, second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 564 | combineLatest(first: Observable, second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 565 | combineLatest(first: Observable, second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 566 | combineLatest(first: Observable, second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 567 | combineLatest(first: IPromise, second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 568 | combineLatest(first: IPromise, second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 569 | combineLatest(first: IPromise, second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 570 | combineLatest(first: IPromise, second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 571 | combineLatest(first: IPromise, second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 572 | combineLatest(first: IPromise, second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 573 | combineLatest(first: IPromise, second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 574 | combineLatest(first: IPromise, second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; 575 | combineLatest(first: Observable, second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; 576 | combineLatest(souces: Observable[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; 577 | combineLatest(souces: IPromise[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; 578 | 579 | concat(...sources: Observable[]): Observable; 580 | concat(...sources: IPromise[]): Observable; 581 | concat(sources: Observable[]): Observable; 582 | concat(sources: IPromise[]): Observable; 583 | merge(...sources: Observable[]): Observable; 584 | merge(...sources: IPromise[]): Observable; 585 | merge(sources: Observable[]): Observable; 586 | merge(sources: IPromise[]): Observable; 587 | merge(scheduler: IScheduler, ...sources: Observable[]): Observable; 588 | merge(scheduler: IScheduler, ...sources: IPromise[]): Observable; 589 | merge(scheduler: IScheduler, sources: Observable[]): Observable; 590 | merge(scheduler: IScheduler, sources: IPromise[]): Observable; 591 | 592 | pairs(obj: { [key: string]: T }, scheduler?: IScheduler): Observable<[string, T]>; 593 | 594 | zip(first: Observable, sources: Observable[], resultSelector: (item1: T1, ...right: T2[]) => TResult): Observable; 595 | zip(first: Observable, sources: IPromise[], resultSelector: (item1: T1, ...right: T2[]) => TResult): Observable; 596 | zip(source1: Observable, source2: Observable, resultSelector: (item1: T1, item2: T2) => TResult): Observable; 597 | zip(source1: Observable, source2: IPromise, resultSelector: (item1: T1, item2: T2) => TResult): Observable; 598 | zip(source1: Observable, source2: Observable, source3: Observable, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable; 599 | zip(source1: Observable, source2: Observable, source3: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable; 600 | zip(source1: Observable, source2: IPromise, source3: Observable, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable; 601 | zip(source1: Observable, source2: IPromise, source3: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable; 602 | zip(source1: Observable, source2: Observable, source3: Observable, source4: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; 603 | zip(source1: Observable, source2: Observable, source3: Observable, source4: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; 604 | zip(source1: Observable, source2: Observable, source3: IPromise, source4: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; 605 | zip(source1: Observable, source2: Observable, source3: IPromise, source4: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; 606 | zip(source1: Observable, source2: IPromise, source3: Observable, source4: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; 607 | zip(source1: Observable, source2: IPromise, source3: Observable, source4: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; 608 | zip(source1: Observable, source2: IPromise, source3: IPromise, source4: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; 609 | zip(source1: Observable, source2: IPromise, source3: IPromise, source4: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; 610 | zip(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5) => TResult): Observable; 611 | zipArray(...sources: Observable[]): Observable; 612 | zipArray(sources: Observable[]): Observable; 613 | 614 | /** 615 | * Converts a Promise to an Observable sequence 616 | * @param promise An ES6 Compliant promise. 617 | * @returns An Observable sequence which wraps the existing promise success and failure. 618 | */ 619 | fromPromise(promise: IPromise): Observable; 620 | } 621 | 622 | export var Observable: ObservableStatic; 623 | 624 | interface ISubject extends Observable, Observer, IDisposable { 625 | hasObservers(): boolean; 626 | } 627 | 628 | export interface Subject extends ISubject { 629 | } 630 | 631 | interface SubjectStatic { 632 | new (): Subject; 633 | create(observer?: Observer, observable?: Observable): ISubject; 634 | } 635 | 636 | export var Subject: SubjectStatic; 637 | 638 | export interface AsyncSubject extends Subject { 639 | } 640 | 641 | interface AsyncSubjectStatic { 642 | new (): AsyncSubject; 643 | } 644 | 645 | export var AsyncSubject: AsyncSubjectStatic; 646 | } 647 | -------------------------------------------------------------------------------- /app/templates/tsd_typings/rx/rx.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for RxJS v2.2.28 2 | // Project: http://rx.codeplex.com/ 3 | // Definitions by: gsino , Igor Oleinikov 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare module Rx { 9 | export interface IScheduler { 10 | catch(handler: (exception: any) => boolean): IScheduler; 11 | catchException(handler: (exception: any) => boolean): IScheduler; 12 | } 13 | 14 | // Observer 15 | export interface Observer { 16 | checked(): Observer; 17 | } 18 | 19 | interface ObserverStatic { 20 | /** 21 | * Schedules the invocation of observer methods on the given scheduler. 22 | * @param scheduler Scheduler to schedule observer messages on. 23 | * @returns Observer whose messages are scheduled on the given scheduler. 24 | */ 25 | notifyOn(scheduler: IScheduler): Observer; 26 | } 27 | 28 | export interface Observable { 29 | observeOn(scheduler: IScheduler): Observable; 30 | subscribeOn(scheduler: IScheduler): Observable; 31 | 32 | amb(rightSource: Observable): Observable; 33 | amb(rightSource: IPromise): Observable; 34 | onErrorResumeNext(second: Observable): Observable; 35 | onErrorResumeNext(second: IPromise): Observable; 36 | bufferWithCount(count: number, skip?: number): Observable; 37 | windowWithCount(count: number, skip?: number): Observable>; 38 | defaultIfEmpty(defaultValue?: T): Observable; 39 | distinct(skipParameter: boolean, valueSerializer: (value: T) => string): Observable; 40 | distinct(keySelector?: (value: T) => TKey, keySerializer?: (key: TKey) => string): Observable; 41 | groupBy(keySelector: (value: T) => TKey, skipElementSelector?: boolean, keySerializer?: (key: TKey) => string): Observable>; 42 | groupBy(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, keySerializer?: (key: TKey) => string): Observable>; 43 | groupByUntil(keySelector: (value: T) => TKey, skipElementSelector: boolean, durationSelector: (group: GroupedObservable) => Observable, keySerializer?: (key: TKey) => string): Observable>; 44 | groupByUntil(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, durationSelector: (group: GroupedObservable) => Observable, keySerializer?: (key: TKey) => string): Observable>; 45 | } 46 | 47 | interface ObservableStatic { 48 | using(resourceFactory: () => TResource, observableFactory: (resource: TResource) => Observable): Observable; 49 | amb(...sources: Observable[]): Observable; 50 | amb(...sources: IPromise[]): Observable; 51 | amb(sources: Observable[]): Observable; 52 | amb(sources: IPromise[]): Observable; 53 | onErrorResumeNext(...sources: Observable[]): Observable; 54 | onErrorResumeNext(...sources: IPromise[]): Observable; 55 | onErrorResumeNext(sources: Observable[]): Observable; 56 | onErrorResumeNext(sources: IPromise[]): Observable; 57 | } 58 | 59 | interface GroupedObservable extends Observable { 60 | key: TKey; 61 | underlyingObservable: Observable; 62 | } 63 | } 64 | 65 | declare module "rx" { 66 | export = Rx 67 | } 68 | -------------------------------------------------------------------------------- /app/templates/tsd_typings/systemjs/systemjs.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for System.js 0.18.4 2 | // Project: https://github.com/systemjs/systemjs 3 | // Definitions by: Ludovic HENIN , Nathan Walker 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | interface System { 7 | 'import': (name: string, options?: any) => any; 8 | defined: any; 9 | amdDefine: () => void; 10 | amdRequire: () => void; 11 | baseURL: string; 12 | paths: { [key: string]: string }; 13 | meta: { [key: string]: Object }; 14 | config: any; 15 | originalSystem: any; 16 | } 17 | 18 | declare var System: System; 19 | 20 | declare module "systemjs" { 21 | export = System; 22 | } -------------------------------------------------------------------------------- /app/templates/tsd_typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-gulp-angular2", 3 | "version": "0.1.4", 4 | "description": "Yeoman generator for Angular2 + Gulp, base on angular2-seed and generator-gulp-angular", 5 | "license": "MIT", 6 | "main": "app/index.js", 7 | "repository": "x6doooo/generator-gulp-angular2", 8 | "author": { 9 | "name": "Dx. Yang", 10 | "email": "x6doooo@gmail.com", 11 | "url": "https://github.com/x6doooo" 12 | }, 13 | "scripts": { 14 | "test": "mocha" 15 | }, 16 | "files": [ 17 | "app" 18 | ], 19 | "keywords": [ 20 | "yeoman-generator", 21 | "angular2" 22 | ], 23 | "dependencies": { 24 | "yeoman-generator": "^0.19.0", 25 | "chalk": "^1.0.0", 26 | "yosay": "^1.0.2" 27 | }, 28 | "devDependencies": { 29 | "mocha": "*" 30 | } 31 | } 32 | --------------------------------------------------------------------------------