]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Client: add basic aot support
authorChocobozzz <florian.bigard@gmail.com>
Fri, 13 Jan 2017 11:16:00 +0000 (12:16 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 13 Jan 2017 11:16:00 +0000 (12:16 +0100)
30 files changed:
client/.gitignore
client/config/empty.js [new file with mode: 0644]
client/config/helpers.js
client/config/resource-override.js [new file with mode: 0644]
client/config/webpack.common.js
client/config/webpack.dev.js
client/config/webpack.prod.js
client/package.json
client/src/app/account/account.service.ts
client/src/app/admin/friends/shared/friend.service.ts
client/src/app/admin/requests/request-stats/request-stats.component.ts
client/src/app/admin/requests/shared/request.service.ts
client/src/app/admin/users/shared/user.service.ts
client/src/app/app.component.ts
client/src/app/app.module.ts
client/src/app/app.service.ts
client/src/app/core/auth/auth.service.ts
client/src/app/environment.ts
client/src/app/shared/auth/auth-http.service.ts
client/src/app/videos/shared/video.service.ts
client/src/app/videos/video-watch/video-magnet.component.html
client/src/app/videos/video-watch/video-share.component.html
client/src/app/videos/video-watch/video-watch.component.ts
client/src/custom-typings.d.ts
client/src/main.browser.aot.ts [new file with mode: 0644]
client/src/main.browser.ts [moved from client/src/main.ts with 100% similarity]
client/src/polyfills.browser.ts [moved from client/src/polyfills.ts with 100% similarity]
client/src/sass/application.scss
client/src/vendor.ts [deleted file]
client/tsconfig.webpack.json [new file with mode: 0644]

index 27e212f08bcad2bf38ff94b1ec85c37c41ce6aa9..fa5433194fd9aa7792bb5e0c8cb79441b64a1601 100644 (file)
@@ -1,2 +1,4 @@
 /dist/
 /node_modules
+/compiled
+/stats.json
diff --git a/client/config/empty.js b/client/config/empty.js
new file mode 100644 (file)
index 0000000..33acae1
--- /dev/null
@@ -0,0 +1,8 @@
+module.exports = {
+  NgProbeToken: {},
+  HmrState: function () {},
+  _createConditionalRootRenderer: function (rootRenderer, extraTokens, coreTokens) {
+    return rootRenderer
+  },
+  __platform_browser_private__: {}
+}
index 6268d2628fbfdf067e1e7a773e6f6c83f29a4216..ca59234729a6344111dffcd4d42b69e0e54c45c9 100644 (file)
@@ -1,13 +1,17 @@
 const path = require('path')
 
+// Helper functions
 const ROOT = path.resolve(__dirname, '..')
-
-console.log('root directory:', root() + '\n')
+const EVENT = process.env.npm_lifecycle_event || ''
 
 function hasProcessFlag (flag) {
   return process.argv.join('').indexOf(flag) > -1
 }
 
+function hasNpmFlag (flag) {
+  return EVENT.includes(flag)
+}
+
 function isWebpackDevServer () {
   return process.argv[1] && !!(/webpack-dev-server$/.exec(process.argv[1]))
 }
@@ -18,5 +22,6 @@ function root (args) {
 }
 
 exports.hasProcessFlag = hasProcessFlag
+exports.hasNpmFlag = hasNpmFlag
 exports.isWebpackDevServer = isWebpackDevServer
 exports.root = root
diff --git a/client/config/resource-override.js b/client/config/resource-override.js
new file mode 100644 (file)
index 0000000..e69de29
index 7631af6b9f449167375f54f4350cc2bb08d7f927..09d6f72b5eddc6705edd90f5f32b753900e9993e 100644 (file)
@@ -1,17 +1,20 @@
-const webpack = require('webpack')
 const helpers = require('./helpers')
 
 /*
  * Webpack Plugins
  */
 
-const CopyWebpackPlugin = require('copy-webpack-plugin')
-const HtmlWebpackPlugin = require('html-webpack-plugin')
-const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin
 const AssetsPlugin = require('assets-webpack-plugin')
+const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
 const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin')
+const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin')
+const CopyWebpackPlugin = require('copy-webpack-plugin')
+const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin
+const HtmlWebpackPlugin = require('html-webpack-plugin')
 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
 const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
+const ngcWebpack = require('ngc-webpack')
+
 const WebpackNotifierPlugin = require('webpack-notifier')
 
 /*
@@ -29,7 +32,8 @@ const METADATA = {
  * See: http://webpack.github.io/docs/configuration.html#cli
  */
 module.exports = function (options) {
-  var isProd = options.env === 'production'
+  const isProd = options.env === 'production'
+  const AOT = isProd
 
   return {
 
@@ -49,9 +53,10 @@ module.exports = function (options) {
      * See: http://webpack.github.io/docs/configuration.html#entry
      */
     entry: {
-      'polyfills': './src/polyfills.ts',
-      'vendor': './src/vendor.ts',
-      'main': './src/main.ts'
+      'polyfills': './src/polyfills.browser.ts',
+      'main': AOT
+              ? './src/main.browser.aot.ts'
+              : './src/main.browser.ts'
     },
 
     /*
@@ -67,7 +72,7 @@ module.exports = function (options) {
        */
       extensions: [ '.ts', '.js', '.json', '.scss' ],
 
-      modules: [helpers.root('src'), 'node_modules'],
+      modules: [ helpers.root('src'), helpers.root('node_modules') ],
 
       alias: {
         'video.js': 'video.js/dist/alt/video.novtt'
@@ -90,10 +95,18 @@ module.exports = function (options) {
          */
         {
           test: /\.ts$/,
-          loaders: [
+          use: [
             '@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,
-            'awesome-typescript-loader',
-            'angular2-template-loader'
+            'awesome-typescript-loader?{configFileName: "tsconfig.webpack.json"}',
+            'angular2-template-loader',
+            {
+              loader: 'ng-router-loader',
+              options: {
+                loader: 'async-system',
+                genDir: 'compiled',
+                aot: AOT
+              }
+            }
           ],
           exclude: [/\.(spec|e2e)\.ts$/]
         },
@@ -110,10 +123,11 @@ module.exports = function (options) {
 
         {
           test: /\.(sass|scss)$/,
-          loaders: ['css-to-string-loader', 'css-loader?sourceMap', 'resolve-url', 'sass-loader?sourceMap']
+          use: ['css-to-string-loader', 'css-loader?sourceMap', 'resolve-url-loader', 'sass-loader?sourceMap'],
+          exclude: [ helpers.root('src', 'styles') ]
         },
-        { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url?limit=10000&minetype=application/font-woff' },
-        { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file' },
+        { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
+        { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' },
 
         /* Raw loader support for *.html
          * Returns file content as string
@@ -148,7 +162,7 @@ module.exports = function (options) {
        *
        * See: https://github.com/s-panferov/awesome-typescript-loader#forkchecker-boolean-defaultfalse
        */
-      new ForkCheckerPlugin(),
+      new CheckerPlugin(),
 
       /*
        * Plugin: CommonsChunkPlugin
@@ -158,8 +172,21 @@ module.exports = function (options) {
        * See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin
        * See: https://github.com/webpack/docs/wiki/optimization#multi-page-app
        */
-      new webpack.optimize.CommonsChunkPlugin({
-        name: [ 'polyfills', 'vendor' ].reverse()
+      new CommonsChunkPlugin({
+        name: 'polyfills',
+        chunks: ['polyfills']
+      }),
+
+      // This enables tree shaking of the vendor modules
+      new CommonsChunkPlugin({
+        name: 'vendor',
+        chunks: ['main'],
+        minChunks: module => /node_modules\//.test(module.resource)
+      }),
+
+      // Specify the correct order the scripts will be injected in
+      new CommonsChunkPlugin({
+        name: ['polyfills', 'vendor'].reverse()
       }),
 
       /**
@@ -171,8 +198,11 @@ module.exports = function (options) {
        */
       new ContextReplacementPlugin(
         // The (\\|\/) piece accounts for path separators in *nix and Windows
-        /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
-        helpers.root('src') // location of your src
+        /angular(\\|\/)core(\\|\/)src(\\|\/)linker/,
+        helpers.root('src'), // location of your src
+        {
+          // your Angular Async Route paths relative to this root directory
+        }
       ),
 
       /*
@@ -255,6 +285,34 @@ module.exports = function (options) {
             precision: 10
           }
         }
+      }),
+
+      // Fix Angular 2
+      new NormalModuleReplacementPlugin(
+        /facade(\\|\/)async/,
+        helpers.root('node_modules/@angular/core/src/facade/async.js')
+      ),
+      new NormalModuleReplacementPlugin(
+        /facade(\\|\/)collection/,
+        helpers.root('node_modules/@angular/core/src/facade/collection.js')
+      ),
+      new NormalModuleReplacementPlugin(
+        /facade(\\|\/)errors/,
+        helpers.root('node_modules/@angular/core/src/facade/errors.js')
+      ),
+      new NormalModuleReplacementPlugin(
+        /facade(\\|\/)lang/,
+        helpers.root('node_modules/@angular/core/src/facade/lang.js')
+      ),
+      new NormalModuleReplacementPlugin(
+        /facade(\\|\/)math/,
+        helpers.root('node_modules/@angular/core/src/facade/math.js')
+      ),
+
+      new ngcWebpack.NgcWebpackPlugin({
+        disabled: !AOT,
+        tsConfig: helpers.root('tsconfig.webpack.json'),
+        resourceOverride: helpers.root('config/resource-override.js')
       })
     ],
 
@@ -270,7 +328,9 @@ module.exports = function (options) {
       process: true,
       module: false,
       clearImmediate: false,
-      setImmediate: false
+      setImmediate: false,
+      setInterval: false,
+      setTimeout: false
     }
   }
 }
index 964ea56a5f73384189308e7c9e2247941b1d6e0e..cea9d03068ad7195f6f0c3f69c778af28f3d336e 100644 (file)
@@ -1,6 +1,7 @@
 const helpers = require('./helpers')
 const webpackMerge = require('webpack-merge') // used to merge webpack configs
 const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev
+const path = require('path')
 
 /**
  * Webpack Plugins
@@ -29,7 +30,7 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
  * See: http://webpack.github.io/docs/configuration.html#cli
  */
 module.exports = function (env) {
-  return webpackMerge(commonConfig({env: ENV}), {
+  return webpackMerge(commonConfig({ env: ENV }), {
     /**
     * Developer tool to enhance debugging
     *
index 447d47415ccbc331eab705253d5d078cfa2e305c..64d776f24a578bcffccd480ed7d546a8999860e1 100644 (file)
@@ -9,14 +9,15 @@ const commonConfig = require('./webpack.common.js') // the settings that are com
 /**
  * Webpack Plugins
  */
-// const ProvidePlugin = require('webpack/lib/ProvidePlugin')
 const DefinePlugin = require('webpack/lib/DefinePlugin')
-const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
+const ExtractTextPlugin = require('extract-text-webpack-plugin')
+const IgnorePlugin = require('webpack/lib/IgnorePlugin')
 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
-// const IgnorePlugin = require('webpack/lib/IgnorePlugin')
-// const DedupePlugin = require('webpack/lib/optimize/DedupePlugin')
+const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
+const ProvidePlugin = require('webpack/lib/ProvidePlugin')
 const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin')
 const WebpackMd5Hash = require('webpack-md5-hash')
+const V8LazyParseWebpackPlugin = require('v8-lazy-parse-webpack-plugin')
 
 /**
  * Webpack Constants
@@ -154,22 +155,67 @@ module.exports = function (env) {
         // comments: true, //debug
 
         beautify: false, // prod
+        output: {
+          comments: false
+        }, // prod
         mangle: {
-          screw_ie8: true,
-          keep_fnames: true
+          screw_ie8: true
         }, // prod
         compress: {
           screw_ie8: true,
-          warnings: false
-        }, // prod
-        comments: false // prod
+          warnings: false,
+          conditionals: true,
+          unused: true,
+          comparisons: true,
+          sequences: true,
+          dead_code: true,
+          evaluate: true,
+          if_return: true,
+          join_vars: true,
+          negate_iife: false // we need this for lazy v8
+        }
       }),
 
       new NormalModuleReplacementPlugin(
         /angular2-hmr/,
-        helpers.root('config/modules/angular2-hmr-prod.js')
+        helpers.root('config/empty.js')
       ),
 
+      new NormalModuleReplacementPlugin(
+        /zone\.js(\\|\/)dist(\\|\/)long-stack-trace-zone/,
+        helpers.root('config/empty.js')
+      ),
+
+      // AoT
+      // new NormalModuleReplacementPlugin(
+      //   /@angular(\\|\/)upgrade/,
+      //   helpers.root('config/empty.js')
+      // ),
+      // new NormalModuleReplacementPlugin(
+      //   /@angular(\\|\/)compiler/,
+      //   helpers.root('config/empty.js')
+      // ),
+      // new NormalModuleReplacementPlugin(
+      //   /@angular(\\|\/)platform-browser-dynamic/,
+      //   helpers.root('config/empty.js')
+      // ),
+      // new NormalModuleReplacementPlugin(
+      //   /dom(\\|\/)debug(\\|\/)ng_probe/,
+      //   helpers.root('config/empty.js')
+      // ),
+      // new NormalModuleReplacementPlugin(
+      //   /dom(\\|\/)debug(\\|\/)by/,
+      //   helpers.root('config/empty.js')
+      // ),
+      // new NormalModuleReplacementPlugin(
+      //   /src(\\|\/)debug(\\|\/)debug_node/,
+      //   helpers.root('config/empty.js')
+      // ),
+      // new NormalModuleReplacementPlugin(
+      //   /src(\\|\/)debug(\\|\/)debug_renderer/,
+      //   helpers.root('config/empty.js')
+      // ),
+
       /**
       * Plugin: IgnorePlugin
       * Description: Don’t generate modules for requests matching the provided RegExp.
@@ -228,7 +274,7 @@ module.exports = function (env) {
               [/\*/, /(?:)/],
               [/\[?\(?/, /(?:)/]
             ],
-            customAttrAssign: [/\)?]?=/]
+            customAttrAssign: [/\)?\]?=/]
           },
 
           // FIXME: Remove
index e9f41959dd63a75db1920a33f1c3d035269565ab..5d09f4c54bf3eb1ebd0c3ea0f1e39f079c0f332a 100644 (file)
@@ -20,6 +20,7 @@
   "dependencies": {
     "@angular/common": "~2.4.1",
     "@angular/compiler": "~2.4.1",
+    "@angular/compiler-cli": "^2.4.3",
     "@angular/core": "~2.4.1",
     "@angular/forms": "~2.4.1",
     "@angular/http": "~2.4.1",
     "@types/source-map": "^0.1.26",
     "@types/uglify-js": "^2.0.27",
     "@types/videojs": "0.0.30",
-    "@types/webpack": "^1.12.29",
+    "@types/webpack": "^2.0.0",
     "angular-pipes": "^5.0.0",
     "angular2-template-loader": "^0.6.0",
     "assets-webpack-plugin": "^3.4.0",
-    "awesome-typescript-loader": "^2.2.1",
-    "bootstrap-loader": "^2.0.0-beta.11",
+    "awesome-typescript-loader": "~3.0.0-beta.17",
+    "bootstrap": "^3.3.6",
+    "bootstrap-loader": "2.0.0-beta.18",
     "bootstrap-sass": "^3.3.6",
     "copy-webpack-plugin": "^4.0.0",
     "core-js": "^2.4.1",
     "intl": "^1.2.4",
     "json-loader": "^0.5.4",
     "ng2-bootstrap": "1.1.16-10",
-    "ng2-file-upload": "^1.1.0",
+    "ng2-file-upload": "^1.1.4-2",
     "ng2-meta": "^2.0.0",
-    "node-sass": "^3.10.0",
+    "ng-router-loader": "^1.0.2",
+    "ngc-webpack": "^1.1.0",
+    "node-sass": "^4.1.1",
     "normalize.css": "^5.0.0",
     "raw-loader": "^0.5.1",
     "reflect-metadata": "0.1.8",
     "ts-helpers": "^1.1.1",
     "tslint": "3.15.1",
     "tslint-loader": "^2.1.4",
-    "typescript": "~2.0.9",
+    "typescript": "~2.1.0",
     "url-loader": "^0.5.7",
+    "v8-lazy-parse-webpack-plugin": "^0.3.0",
     "video.js": "^5.11.9",
     "videojs-dock": "^2.0.2",
-    "webpack": "2.1.0-beta.25",
+    "webpack": "2.2.0-rc.3",
     "webpack-md5-hash": "0.0.5",
-    "webpack-merge": "^0.15.0",
+    "webpack-merge": "~2.3.1",
     "webpack-notifier": "^1.3.0",
     "webtorrent": "^0.98.0",
     "zone.js": "~0.7.2"
index 0635c253331f33b02ebd3b873e2753061e021fb3..046690347482e3a6089033c67e838734279094c2 100644 (file)
@@ -1,4 +1,6 @@
 import { Injectable } from '@angular/core';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/operator/map';
 
 import { AuthService } from '../core';
 import { AuthHttp, RestExtractor } from '../shared';
index 85ac04ba042f8b8e8f29f2703e55dba30ef77cad..e97459385dd4aa9e842cf2beb67fbcdfb28a1449 100644 (file)
@@ -1,5 +1,7 @@
 import { Injectable } from '@angular/core';
 import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/operator/map';
 
 import { Friend } from './friend.model';
 import { AuthHttp, RestExtractor, ResultList } from '../../../shared';
index 9e2af219c891e7980bd8ac0619e8b032a9d205d6..66075e4b5e7d0e24e122ca6e4badb7867cb56397 100644 (file)
@@ -1,3 +1,4 @@
+import { setInterval } from 'timers'
 import { Component, OnInit, OnDestroy } from '@angular/core';
 
 import { RequestService, RequestStats } from '../shared';
index aeec37448904b26a80a2fdcded4e005b787c453c..55b28bcfc3cefc0c377f72b1a0b9d5d8df8f8883 100644 (file)
@@ -1,5 +1,7 @@
 import { Injectable } from '@angular/core';
 import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/operator/map';
 
 import { RequestStats } from './request-stats.model';
 import { AuthHttp, RestExtractor } from '../../../shared';
index 13be553c01ce7b0db239a3339fd5c576a447b695..d9005b213e510a75ce1aa8e886eef0006ae58baa 100644 (file)
@@ -1,4 +1,6 @@
 import { Injectable } from '@angular/core';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/operator/map';
 
 import { AuthHttp, RestExtractor, ResultList, User } from '../../../shared';
 
index ce4fc04fffc85c4e9adb58b5b28902fab7abba64..3f2f1ace0fcfa22bdee40bc2a1ee67bdc1911f3d 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, ViewContainerRef } from '@angular/core';
 import { Router } from '@angular/router';
 
-import { MetaService } from 'ng2-meta';
+import { MetaService } from 'ng2-meta/src';
 @Component({
   selector: 'my-app',
   templateUrl: './app.component.html',
index e9bb800f4f2dfb2a5b793e82afa7e01147e997f8..fb71787c4cd8d8f75dfb58fe398042b0d08c41f7 100644 (file)
@@ -2,7 +2,8 @@ import { ApplicationRef, NgModule } from '@angular/core';
 import { BrowserModule } from '@angular/platform-browser';
 import { removeNgStyles, createNewHosts } from '@angularclass/hmr';
 
-import { MetaModule, MetaConfig } from 'ng2-meta';
+import { MetaModule, MetaConfig } from 'ng2-meta/src';
+import 'bootstrap-loader';
 
 import { ENV_PROVIDERS } from './environment';
 import { AppRoutingModule } from './app-routing.module';
index 033c21900affe152a7221f5edd8428ec51aee103..9b582e472a07d1fdf69f1c61558b5666cc1a4471 100644 (file)
@@ -1,35 +1,35 @@
-
 import { Injectable } from '@angular/core';
 
+export type InternalStateType = {
+  [key: string]: any
+};
+
 @Injectable()
 export class AppState {
-  _state = { };
 
-  constructor() { ; }
+  public _state: InternalStateType = { };
 
   // already return a clone of the current state
-  get state() {
+  public get state() {
     return this._state = this._clone(this._state);
   }
   // never allow mutation
-  set state(value) {
+  public set state(value) {
     throw new Error('do not mutate the `.state` directly');
   }
 
-
-  get(prop?: any) {
+  public get(prop?: any) {
     // use our state getter for the clone
     const state = this.state;
     return state.hasOwnProperty(prop) ? state[prop] : state;
   }
 
-  set(prop: string, value: any) {
+  public set(prop: string, value: any) {
     // internally mutate our state
     return this._state[prop] = value;
   }
 
-
-  _clone(object) {
+  private _clone(object: InternalStateType) {
     // simple object clone
     return JSON.parse(JSON.stringify( object ));
   }
index 1f0e322a96dff25641eeb21278506d5246dac6ac..bc276ed99a35c2cc9862ab47e163ee4229ff9c6b 100644 (file)
@@ -3,6 +3,8 @@ import { Headers, Http, Response, URLSearchParams } from '@angular/http';
 import { Router } from '@angular/router';
 import { Observable } from 'rxjs/Observable';
 import { Subject } from 'rxjs/Subject';
+import 'rxjs/add/operator/map';
+import 'rxjs/add/operator/mergeMap';
 
 // Do not use the barrel (dependency loop)
 import { AuthStatus } from '../../shared/auth/auth-status.model';
index 8bba89c4ecb139ea78fb7e25973b8a68f1414655..929e09490c763509888426f9302eacd3819c8778 100644 (file)
@@ -4,19 +4,24 @@
 import { enableDebugTools, disableDebugTools } from '@angular/platform-browser';
 import { enableProdMode, ApplicationRef } from '@angular/core';
 // Environment Providers
-let PROVIDERS = [
+let PROVIDERS: any[] = [
   // common env directives
 ];
 
 // Angular debug tools in the dev console
 // https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md
-let _decorateModuleRef = function identity(value) { return value; };
+let _decorateModuleRef = function identity<T>(value: T): T { return value; };
 
 if ('production' === ENV) {
-  // Production
-  disableDebugTools();
   enableProdMode();
 
+  // Production
+  _decorateModuleRef = (modRef: any) => {
+    disableDebugTools();
+
+    return modRef;
+  };
+
   PROVIDERS = [
     ...PROVIDERS,
     // custom providers in production
index 6027265705eac94a7b5f27df78eb5e29d15fe664..c4114aa023c5e555e5db47c8cb4fc39e35649f43 100644 (file)
@@ -80,12 +80,14 @@ export class AuthHttp extends Http {
   }
 }
 
+export function useFactory(backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) {
+  return new AuthHttp(backend, defaultOptions, authService);
+}
+
 export const AUTH_HTTP_PROVIDERS = [
   {
     provide: AuthHttp,
-    useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => {
-      return new AuthHttp(backend, defaultOptions, authService);
-    },
+    useFactory,
     deps: [ XHRBackend, RequestOptions, AuthService ]
   },
 ];
index f173ef06be5fdf01a61fdc0118e09eda43ccc6d4..9d79b2f5ea278c034be0a7b2a0b4dd07f1199201 100644 (file)
@@ -1,6 +1,8 @@
 import { Injectable } from '@angular/core';
 import { Http } from '@angular/http';
 import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/operator/map';
 
 import { Search } from '../../shared';
 import { SortField } from './sort-field.type';
index 9108c72582d3a5d2f8dfa8843495db685181cf4d..3fa82f1be3da775512e7fc6cf340d7760c24fedf 100644 (file)
@@ -3,7 +3,7 @@
     <div class="modal-content modal-lg">
 
       <div class="modal-header">
-        <button type="button" class="close" aria-label="Close" (click)="hideModal()">
+        <button type="button" class="close" aria-label="Close" (click)="hide()">
           <span aria-hidden="true">&times;</span>
         </button>
         <h4 class="modal-title">Magnet Uri</h4>
index 1c2fac1d7076cfbb742090ddc2cb7ee49c4133ff..88f59c0638c0d52bb74731c9fc994cdec95624af 100644 (file)
@@ -3,7 +3,7 @@
     <div class="modal-content">
 
       <div class="modal-header">
-        <button type="button" class="close" aria-label="Close" (click)="hideModal()">
+        <button type="button" class="close" aria-label="Close" (click)="hide()">
           <span aria-hidden="true">&times;</span>
         </button>
         <h4 class="modal-title">Share</h4>
index afc6fe01cba9df3b29a16e1508f4b336160085c6..14aae9895d6f0226880c6d0c695bf60d1ac4da7c 100644 (file)
@@ -1,7 +1,8 @@
+import { setInterval, setTimeout } from 'timers'
 import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
 import { ActivatedRoute } from '@angular/router';
 
-import { MetaService } from 'ng2-meta';
+import { MetaService } from 'ng2-meta/src';
 import * as videojs from 'video.js';
 
 import { VideoMagnetComponent } from './video-magnet.component';
index 95787181f4cb5e03a2e377c39dab9283d2f191e0..7cb57b62b097c5b4b6900d888543132924751295 100644 (file)
@@ -46,6 +46,16 @@ import * as _ from 'lodash'
 // support NodeJS modules without type definitions
 declare module '*';
 
+/*
+// for legacy tslint etc to understand rename 'modern-lru' with your package
+// then comment out `declare module '*';`. For each new module copy/paste
+// this method of creating an `any` module type definition
+declare module 'modern-lru' {
+  let x: any;
+  export = x;
+}
+*/
+
 // Extra variables that live on Global that will be replaced by webpack DefinePlugin
 declare var ENV: string;
 declare var HMR: boolean;
@@ -56,8 +66,8 @@ interface SystemJS {
 }
 
 interface GlobalEnvironment {
-  ENV;
-  HMR;
+  ENV: string;
+  HMR: boolean;
   SystemJS: SystemJS;
   System: SystemJS;
 }
@@ -76,7 +86,6 @@ type AsyncRoutes = {
                          FactoryPromise
 };
 
-
 type IdleCallbacks = Es6PromiseLoader |
                              Function |
               FactoryEs6PromiseLoader |
@@ -98,7 +107,6 @@ interface WebpackModule {
   };
 }
 
-
 interface WebpackRequire {
     (id: string): any;
     (paths: string[], callback: (...modules: any[]) => void): void;
@@ -114,7 +122,6 @@ interface ErrorStackTraceLimit {
   stackTraceLimit: number;
 }
 
-
 // Extend typings
 interface NodeRequire extends WebpackRequire {}
 interface ErrorConstructor extends ErrorStackTraceLimit {}
diff --git a/client/src/main.browser.aot.ts b/client/src/main.browser.aot.ts
new file mode 100644 (file)
index 0000000..29ecf73
--- /dev/null
@@ -0,0 +1,23 @@
+import { platformBrowser } from '@angular/platform-browser';
+import { decorateModuleRef } from './app/environment';
+/*
+ * App Module
+ * our top level module that holds all of our components
+ */
+import { AppModuleNgFactory } from '../compiled/src/app/app.module.ngfactory';
+
+/*
+ * Bootstrap our Angular app with a top level NgModule
+ */
+export function main(): Promise<any> {
+  return platformBrowser()
+    .bootstrapModuleFactory(AppModuleNgFactory)
+    .then(decorateModuleRef)
+    .catch((err) => console.error(err));
+}
+
+export function bootstrapDomReady() {
+  document.addEventListener('DOMContentLoaded', main);
+}
+
+bootstrapDomReady();
index cdb4865577c4262d86236de4ac96150440ab7c2e..30588067f1de617d1710659e39bc11c5dbcba9e7 100644 (file)
@@ -1,4 +1,4 @@
-@import '../video.js/dist/video-js.css';
+@import '../../node_modules/video.js/dist/video-js.css';
 
 body {
   padding: 20px;
diff --git a/client/src/vendor.ts b/client/src/vendor.ts
deleted file mode 100644 (file)
index 436c58f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// For vendors for example jQuery, Lodash, angular2-jwt just import them here unless you plan on
-// chunking vendors files for async loading. You would need to import the async loaded vendors
-// at the entry point of the async loaded file. Also see custom-typings.d.ts as you also need to
-// run `typings install x` where `x` is your module
-
-// Angular 2
-import '@angular/platform-browser';
-import '@angular/platform-browser-dynamic';
-import '@angular/core';
-import '@angular/common';
-import '@angular/forms';
-import '@angular/http';
-import '@angular/router';
-
-import '@angularclass/hmr';
-
-// RxJS
-import 'rxjs/Observable';
-import 'rxjs/Subject';
-import 'rxjs/ReplaySubject';
-import 'rxjs/add/operator/catch';
-import 'rxjs/add/operator/mergeMap';
-import 'rxjs/add/operator/map';
-import 'rxjs/add/observable/throw';
-
-import 'bootstrap-loader';
-
-import 'angular-pipes/src/math/bytes.pipe';
-import 'ng2-file-upload';
-import 'video.js';
-import 'ng2-meta';
-import 'ng2-bootstrap/pagination';
-import 'ng2-bootstrap/dropdown';
-import 'ng2-bootstrap/progressbar';
-import 'ng2-bootstrap/modal';
diff --git a/client/tsconfig.webpack.json b/client/tsconfig.webpack.json
new file mode 100644 (file)
index 0000000..a0830ca
--- /dev/null
@@ -0,0 +1,42 @@
+{
+  "compilerOptions": {
+    "target": "es5",
+    "module": "es2015",
+    "moduleResolution": "node",
+    "emitDecoratorMetadata": true,
+    "experimentalDecorators": true,
+    "allowSyntheticDefaultImports": true,
+    "sourceMap": true,
+    "noEmitHelpers": true,
+    "strictNullChecks": false,
+    "baseUrl": "./src",
+    "paths": [
+    ],
+    "lib": [
+      "dom",
+      "es6"
+    ],
+    "types": [
+      "node",
+      "source-map",
+      "uglify-js",
+      "videojs",
+      "webpack"
+    ]
+  },
+  "exclude": [
+    "node_modules",
+    "dist"
+  ],
+  "awesomeTypescriptLoaderOptions": {
+    "forkChecker": true,
+    "useWebpackText": true
+  },
+  "angularCompilerOptions": {
+    "genDir": "./compiled",
+    "skipMetadataEmit": true
+  },
+  "compileOnSave": false,
+  "buildOnSave": false,
+  "atom": { "rewriteTsconfig": false }
+}