Преглед изворни кода

tech(systemjs): finally starting to get systemjs and typescript and runtime loading to work together in a manner that I want it to.. took forever

Torkel Ödegaard пре 10 година
родитељ
комит
3b8e478a6a
6 измењених фајлова са 45 додато и 39 уклоњено
  1. 6 2
      public/app/app.ts
  2. 2 1
      public/app/core/core.ts
  3. 2 0
      public/app/headers/common.d.ts
  4. 22 21
      public/app/jspm.conf.js
  5. 0 1
      tasks/options/typescript.js
  6. 13 14
      tsconfig.json

+ 6 - 2
public/app/app.ts

@@ -17,6 +17,9 @@ import kbn = require('app/core/utils/kbn');
 import angular = require('angular');
 import angular = require('angular');
 import config = require('app/core/config');
 import config = require('app/core/config');
 
 
+import mod from 'app/core/core_module';
+console.log(mod);
+
 class GrafanaApp {
 class GrafanaApp {
   registerFunctions: any;
   registerFunctions: any;
   ngModuleDependencies: any[];
   ngModuleDependencies: any[];
@@ -66,7 +69,8 @@ class GrafanaApp {
       this.useModule(angular.module(moduleName, []));
       this.useModule(angular.module(moduleName, []));
     });
     });
 
 
-    var preBootRequires = [System.import('app/features/all')];
+    //var preBootRequires = [System.import('app/features/all')];
+    var preBootRequires = [];
     var pluginModules = config.bootData.pluginModules || [];
     var pluginModules = config.bootData.pluginModules || [];
 
 
     // add plugin modules
     // add plugin modules
@@ -76,7 +80,7 @@ class GrafanaApp {
 
 
     Promise.all(preBootRequires).then(() => {
     Promise.all(preBootRequires).then(() => {
       // disable tool tip animation
       // disable tool tip animation
-      $.fn.tooltip.defaults.animation = false;
+      //$.fn.tooltip.defaults.animation = false;
       // bootstrap the app
       // bootstrap the app
       angular.bootstrap(document, this.ngModuleDependencies).invoke(() => {
       angular.bootstrap(document, this.ngModuleDependencies).invoke(() => {
         _.each(this.preBootModules, module => {
         _.each(this.preBootModules, module => {

+ 2 - 1
public/app/core/core.ts

@@ -28,8 +28,9 @@ import * as routes from 'app/core/routes/all';
 // export * from './directives/give_focus'
 // export * from './directives/give_focus'
 // export * from './filters/filters'
 // export * from './filters/filters'
 
 
-import {Component} from 'angular2/core';
+import {Component} from 'vendor/jspm/angular2/core';
 console.log(Component);
 console.log(Component);
+
 //  console.log(Component);
 //  console.log(Component);
 // // console.log(Component);
 // // console.log(Component);
 
 

+ 2 - 0
public/app/headers/common.d.ts

@@ -1,5 +1,7 @@
 ///<reference path="lodash/lodash.d.ts" />
 ///<reference path="lodash/lodash.d.ts" />
 ///<reference path="moment/moment.d.ts" />
 ///<reference path="moment/moment.d.ts" />
+///<reference path="../../vendor/jspm/angular2/typings/tsd.d.ts" />
+///<reference path="../../vendor/jspm/angular2/manual_typings/globals.d.ts" />
 
 
 // dummy modules
 // dummy modules
 declare module 'app/core/config' {
 declare module 'app/core/config' {

+ 22 - 21
public/app/jspm.conf.js

@@ -1,23 +1,21 @@
 System.config({
 System.config({
-  baseURL: "public",
-  defaultJSExtensions: true,
-  transpiler: false,
+  defaultJSExtenions: true,
   paths: {
   paths: {
-    moment:   'vendor/moment',
-    "jquery": "vendor/jquery/dist/jquery.js",
-    'lodash-src': 'vendor/lodash',
-    "lodash": 'app/core/lodash_extended',
-    "angular": "vendor/angular/angular.js",
-    "bootstrap": "vendor/bootstrap/bootstrap.js",
-    'angular-route':          'vendor/angular-route/angular-route',
-    'angular-sanitize':       'vendor/angular-sanitize/angular-sanitize',
-    "angular-ui":             "vendor/angular-ui/ui-bootstrap-tpls.js",
-    "angular-strap":          "vendor/angular-other/angular-strap.js",
-    "angular-dragdrop":       "vendor/angular-native-dragdrop/draganddrop.js",
-    "angular-bindonce":       "vendor/angular-bindonce/bindonce.js",
-    "spectrum": "vendor/spectrum.js",
-    "filesaver": "vendor/filesaver.js",
-    "bootstrap-tagsinput": "vendor/tagsinput/bootstrap-tagsinput.js",
+    moment:   'public/vendor/moment.js',
+    "jquery": "public/vendor/jquery/dist/jquery.js",
+    'lodash-src': 'public/vendor/lodash.js',
+    "lodash": 'public/app/core/lodash_extended.js',
+    "angular": "public/vendor/angular/angular.js",
+    "bootstrap": "public/vendor/bootstrap/bootstrap.js",
+    'angular-route':          'public/vendor/angular-route/angular-route.js',
+    'angular-sanitize':       'public/vendor/angular-sanitize/angular-sanitize.js',
+    "angular-ui":             "public/vendor/angular-ui/ui-bootstrap-tpls.js",
+    "angular-strap":          "public/vendor/angular-other/angular-strap.js",
+    "angular-dragdrop":       "public/vendor/angular-native-dragdrop/draganddrop.js",
+    "angular-bindonce":       "public/vendor/angular-bindonce/bindonce.js",
+    "spectrum": "public/vendor/spectrum.js",
+    "filesaver": "public/vendor/filesaver.js",
+    "bootstrap-tagsinput": "public/vendor/tagsinput/bootstrap-tagsinput.js",
     "jquery.flot": "vendor/flot/jquery.flot",
     "jquery.flot": "vendor/flot/jquery.flot",
     "jquery.flot.pie": "vendor/flot/jquery.flot.pie",
     "jquery.flot.pie": "vendor/flot/jquery.flot.pie",
     "jquery.flot.events": "vendor/flot/jquery.flot.events",
     "jquery.flot.events": "vendor/flot/jquery.flot.events",
@@ -30,12 +28,15 @@ System.config({
   },
   },
 
 
   packages: {
   packages: {
-    "js": {
-      "defaultExtension": "js"
-    }
+    app: {
+      defaultExtension: 'js',
+    },
   },
   },
 
 
   map: {
   map: {
+    'vendor/jspm/angular2': 'angular2',
+    app: 'public/app',
+    vendor: 'public/vendor',
   },
   },
 
 
   meta: {
   meta: {

+ 0 - 1
tasks/options/typescript.js

@@ -11,7 +11,6 @@ module.exports = function() {
         rootDir: 'public/',
         rootDir: 'public/',
         sourceRoot: 'public/',
         sourceRoot: 'public/',
         declaration: true,
         declaration: true,
-        moduleResolution: 2,
         emitDecoratorMetadata: true,
         emitDecoratorMetadata: true,
         experimentalDecorators: true,
         experimentalDecorators: true,
         sourceMap: true,
         sourceMap: true,

+ 13 - 14
tsconfig.json

@@ -1,16 +1,15 @@
 {
 {
     "compilerOptions": {
     "compilerOptions": {
-        "sourceMap": true,
-        "declaration": true,
-        "outDir": "public_gen",
-        "noImplicitAny": false,
-        "target": "es5",
-        "rootDir": "public/",
-        "module": "system",
-        "moduleResolution": 2,
-        "noEmitOnError": true
-    },
-    "files": [
-        "public/app/core/core_module.ts"
-    ]
-}
+      "emitDecoratorMetadata": true,
+      "experimentalDecorators": true,
+      "sourceMap": true,
+      "declaration": true,
+      "outDir": "public_gen",
+      "noImplicitAny": false,
+      "target": "es5",
+      "rootDir": "public",
+      "module": "system",
+      "noEmitOnError": true,
+      "moduleResolution": "classic"
+    }
+}