angular2 test

This commit is contained in:
Torkel Ödegaard 2015-12-16 12:21:13 +01:00
parent 04ff97cd72
commit ca84ef38f8
6156 changed files with 175112 additions and 595117 deletions

View File

@ -33,7 +33,7 @@
"grunt-ng-annotate": "^0.9.2",
"grunt-string-replace": "~0.2.4",
"grunt-tslint": "^2.5.0",
"grunt-typescript": "^0.7.0",
"grunt-typescript": "^0.8.0",
"grunt-usemin": "3.0.0",
"jshint-stylish": "~0.1.5",
"karma": "~0.12.31",
@ -50,7 +50,14 @@
"mocha": "2.2.4",
"requirejs": "2.1.17",
"rjs-build-analysis": "0.0.3",
"tslint": "^2.5.0-beta"
"tslint": "^2.5.0-beta",
"angular2": "2.0.0-beta.0",
"systemjs": "0.19.6",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"zone.js": "0.5.10"
},
"engines": {
"node": "0.4.x",
@ -66,25 +73,7 @@
"grunt-sync": "^0.4.1",
"karma-sinon": "^1.0.3",
"lodash": "^2.4.1",
"sinon": "1.16.1"
},
"jspm": {
"directories": {
"packages": "public/vendor/jspm",
"src": "public"
},
"configFile": "public/app/jspm.conf.js",
"dependencies": {
"angular": "github:angular/bower-angular@^1.4.5",
"angular-route": "github:angular/bower-angular-route@^1.4.5",
"angular-sanitize": "github:angular/bower-angular-sanitize@^1.4.5",
"angular2": "npm:angular2@^2.0.0-alpha.54",
"es6-promise": "npm:es6-promise@^3.0.2",
"es6-shim": "npm:es6-shim@^0.33.13",
"jquery": "github:components/jquery@^2.1.4",
"lodash": "npm:lodash@^3.10.1",
"moment": "github:moment/moment@^2.10.6"
},
"devDependencies": {}
"sinon": "1.16.1",
"typescript": "^1.7.5"
}
}

View File

@ -1,16 +1,15 @@
///<reference path="headers/common.d.ts" />
///<amd-dependency path="bootstrap" />
///<amd-dependency path="angular-strap" />
///<amd-dependency path="angular-route" />
///<amd-dependency path="angular-sanitize" />
///<amd-dependency path="angular-dragdrop" />
///<amd-dependency path="angular-bindonce" />
///<amd-dependency path="angular-ui" />
///<amd-dependency path="app/core/core" />
import 'es6-shim';
import 'es6-promise';
import 'bootstrap';
import 'angular-strap';
import 'angular-route';
import 'angular-sanitize';
import 'angular-dragdrop';
import 'angular-bindonce';
import 'angular-ui';
import 'app/core/core';
import _ = require('lodash');
import $ = require('jquery');
@ -88,14 +87,14 @@ class GrafanaApp {
this.preBootModules = null;
});
}).catch(function(err) {
console.log('Application boot failed: ' + err);
console.log('Application boot failed:', err);
});
}
}
var grafanaApp = new GrafanaApp();
export = {
export default {
init: function() {
grafanaApp.init();
},

5
public/app/core/controllers/all.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
declare module "app/core/controllers/all" {
let json: any;
export {json};
}

View File

@ -0,0 +1,18 @@
// import grafanaCtrl from './grafana_ctrl';
//
// import * as asd from './sidemenu_ctrl';
//
// export {grafanaCtrl};
define([
'./grafana_ctrl',
'./search_ctrl',
'./inspect_ctrl',
'./json_editor_ctrl',
'./login_ctrl',
'./invited_ctrl',
'./signup_ctrl',
'./reset_password_ctrl',
'./sidemenu_ctrl',
'./error_ctrl',
], function () {});

View File

@ -1,15 +0,0 @@
import grafanaCtrl from './grafana_ctrl';
export {grafanaCtrl};
// define([
// './grafana_ctrl',
// './search_ctrl',
// './inspect_ctrl',
// './json_editor_ctrl',
// './login_ctrl',
// './invited_ctrl',
// './signup_ctrl',
// './reset_password_ctrl',
// './sidemenu_ctrl',
// './error_ctrl',
// ], function () {});

View File

@ -5,7 +5,7 @@ define([
function (angular, coreModule) {
'use strict';
coreModule.controller('ErrorCtrl', function($scope, contextSrv) {
coreModule.default.controller('ErrorCtrl', function($scope, contextSrv) {
var showSideMenu = contextSrv.sidemenu;
contextSrv.sidemenu = false;

View File

@ -1,6 +1,7 @@
///<reference path="../../headers/common.d.ts" />
import angular = require('angular');
import _ = require('lodash');
import config = require('app/core/config');
import store = require('app/core/store');
import coreModule from '../core_module';

View File

@ -7,7 +7,7 @@ define([
function (angular, _, $, coreModule) {
'use strict';
coreModule.controller('InspectCtrl', function($scope) {
coreModule.default.controller('InspectCtrl', function($scope) {
var model = $scope.inspector;
function getParametersFromQueryString(queryString) {

View File

@ -6,7 +6,7 @@ define([
function (angular, coreModule, config) {
'use strict';
coreModule.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) {
coreModule.default.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) {
contextSrv.sidemenu = false;
$scope.formModel = {};

View File

@ -5,7 +5,7 @@ define([
function (angular, coreModule) {
'use strict';
coreModule.controller('JsonEditorCtrl', function($scope) {
coreModule.default.controller('JsonEditorCtrl', function($scope) {
$scope.json = angular.toJson($scope.object, true);
$scope.canUpdate = $scope.updateHandler !== void 0;

View File

@ -6,7 +6,7 @@ define([
function (angular, coreModule, config) {
'use strict';
coreModule.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) {
coreModule.default.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) {
$scope.formModel = {
user: '',
email: '',

View File

@ -5,7 +5,7 @@ define([
function (angular, coreModule) {
'use strict';
coreModule.controller('ResetPasswordCtrl', function($scope, contextSrv, backendSrv, $location) {
coreModule.default.controller('ResetPasswordCtrl', function($scope, contextSrv, backendSrv, $location) {
contextSrv.sidemenu = false;
$scope.formModel = {};
$scope.mode = 'send';

View File

@ -7,7 +7,7 @@ define([
function (angular, _, coreModule, config) {
'use strict';
coreModule.controller('SearchCtrl', function($scope, $location, $timeout, backendSrv) {
coreModule.default.controller('SearchCtrl', function($scope, $location, $timeout, backendSrv) {
$scope.init = function() {
$scope.giveSearchFocus = 0;

View File

@ -8,7 +8,7 @@ define([
function (angular, _, $, coreModule, config) {
'use strict';
coreModule.controller('SideMenuCtrl', function($scope, $location, contextSrv, backendSrv) {
coreModule.default.controller('SideMenuCtrl', function($scope, $location, contextSrv, backendSrv) {
$scope.getUrl = function(url) {
return config.appSubUrl + url;

View File

@ -2,7 +2,7 @@
import angular = require('angular');
import config = require('app/core/config');
import coreModule = require('../core_module');
import coreModule from '../core_module';
export class SignUpCtrl {

View File

@ -1,3 +1,5 @@
///<reference path="../headers/common.d.ts" />
///<amd-dependency path="./directives/annotation_tooltip" />
///<amd-dependency path="./directives/body_class" />
///<amd-dependency path="./directives/config_modal" />
@ -14,20 +16,19 @@
///<amd-dependency path="./directives/tags" />
///<amd-dependency path="./directives/topnav" />
///<amd-dependency path="./directives/value_select_dropdown" />
///<amd-dependency path="./routes/all" />
///<amd-dependency path="./controllers/all" />
///<amd-dependency path="./services/all" />
///<amd-dependency path="./jquery_extended" />
///<amd-dependency path="./partials" />
import {arrayJoin} from './directives/array_join';
import * as test from './controllers/all';
import * as controllers from 'app/core/controllers/all';
import * as services from 'app/core/services/all';
import * as routes from 'app/core/routes/all';
// export * from './directives/give_focus'
// export * from './filters/filters'
//
// import {Component} from 'angular2/angular2';
import {Component} from 'angular2/core';
console.log(Component);
// console.log(Component);
export {arrayJoin, test};
export {arrayJoin, controllers, services, routes};

View File

@ -1,7 +1,7 @@
///<reference path="../../headers/common.d.ts" />
import angular = require('angular');
import coreModule = require('../core_module');
import coreModule from '../core_module';
coreModule.directive('giveFocus', function() {
return function(scope, element, attrs) {

View File

@ -4,7 +4,7 @@ import angular = require('angular');
import jquery = require('jquery');
import moment = require('moment');
import _ = require('lodash');
import coreModule = require('../core_module');
import coreModule from '../core_module';
coreModule.filter('stringSort', function() {
return function(input) {
@ -71,4 +71,4 @@ coreModule.filter('interpolateTemplateVars', function (templateSrv) {
return filterFunc;
});
export {};
export default {};

5
public/app/core/routes.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
declare module "app/core/controllers/all" {
let json: any;
export default json;
}

5
public/app/core/routes/all.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
declare module "app/core/routes/all" {
let json: any;
export {json};
}

View File

@ -6,11 +6,10 @@ define([
], function(angular, coreModule, BundleLoader) {
"use strict";
coreModule.config(function($routeProvider, $locationProvider) {
coreModule.default.config(function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
var loadOrgBundle = new BundleLoader.BundleLoader('app/features/org/all');
console.log('routing');
$routeProvider
.when('/', {

View File

@ -1,4 +1,5 @@
///<reference path="../../headers/require/require.d.ts" />
///<reference path="../../headers/common.d.ts" />
export class BundleLoader {
lazy: any;
@ -12,7 +13,7 @@ export class BundleLoader {
this.loadingDefer = $q.defer();
require([bundleName], () => {
System.import(bundleName).then(() => {
this.loadingDefer.resolve();
});

View File

@ -4,7 +4,7 @@ define([
function (coreModule) {
"use strict";
coreModule.controller('LoadDashboardCtrl', function($scope, $routeParams, dashboardLoaderSrv, backendSrv) {
coreModule.default.controller('LoadDashboardCtrl', function($scope, $routeParams, dashboardLoaderSrv, backendSrv) {
if (!$routeParams.slug) {
backendSrv.get('/api/dashboards/home').then(function(result) {
@ -21,7 +21,7 @@ function (coreModule) {
});
coreModule.controller('DashFromImportCtrl', function($scope, $location, alertSrv) {
coreModule.default.controller('DashFromImportCtrl', function($scope, $location, alertSrv) {
if (!window.grafanaImportDashboard) {
alertSrv.set('Not found', 'Cannot reload page with unsaved imported dashboard', 'warning', 7000);
$location.path('');
@ -33,7 +33,7 @@ function (coreModule) {
}, $scope);
});
coreModule.controller('NewDashboardCtrl', function($scope) {
coreModule.default.controller('NewDashboardCtrl', function($scope) {
$scope.initDashboard({
meta: { canStar: false, canShare: false },
dashboard: {

View File

@ -6,7 +6,7 @@ define([
function (angular, _, coreModule) {
'use strict';
coreModule.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) {
coreModule.default.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) {
var self = this;
this.init = function() {

5
public/app/core/services/all.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
declare module "app/core/services/all" {
let json: any;
export default json;
}

View File

@ -5,7 +5,7 @@ define([
function(angular, coreModule) {
'use strict';
coreModule.service('googleAnalyticsSrv', function($rootScope, $location) {
coreModule.default.service('googleAnalyticsSrv', function($rootScope, $location) {
var first = true;
this.init = function() {

View File

@ -7,7 +7,7 @@ define([
function (angular, _, coreModule, config) {
'use strict';
coreModule.service('backendSrv', function($http, alertSrv, $timeout) {
coreModule.default.service('backendSrv', function($http, alertSrv, $timeout) {
var self = this;
this.get = function(url, params) {

View File

@ -8,7 +8,7 @@ define([
function (angular, _, coreModule, store, config) {
'use strict';
coreModule.service('contextSrv', function($rootScope, $timeout) {
coreModule.default.service('contextSrv', function($rootScope, $timeout) {
var self = this;
function User() {

View File

@ -7,7 +7,7 @@ define([
function (angular, _, coreModule, config) {
'use strict';
coreModule.service('datasourceSrv', function($q, $injector, $rootScope) {
coreModule.default.service('datasourceSrv', function($q, $injector) {
var self = this;
this.init = function() {

View File

@ -8,7 +8,7 @@ function (angular, _, coreModule) {
// This service was based on OpenJS library available in BSD License
// http://www.openjs.com/scripts/events/keyboard_shortcuts/index.php
coreModule.factory('keyboardManager', ['$window', '$timeout', function ($window, $timeout) {
coreModule.default.factory('keyboardManager', ['$window', '$timeout', function ($window, $timeout) {
var keyboardManagerService = {};
var defaultOpt = {

View File

@ -7,7 +7,7 @@ define([
function (angular, _, $, coreModule) {
'use strict';
coreModule.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) {
coreModule.default.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) {
this.getTemplate = function(url) {
return $q.when($templateCache.get(url) || $http.get(url, {cache: true}));

View File

@ -6,7 +6,7 @@ define([
function (angular, _, coreModule) {
'use strict';
coreModule.service('uiSegmentSrv', function($sce, templateSrv) {
coreModule.default.service('uiSegmentSrv', function($sce, templateSrv) {
var self = this;
function MetricSegment(options) {

View File

@ -6,7 +6,7 @@ define([
function (angular, _, coreModule) {
'use strict';
coreModule.service('timer', function($timeout) {
coreModule.default.service('timer', function($timeout) {
// This service really just tracks a list of $timeout promises to give us a
// method for cancelling them all when we need to

View File

@ -5,7 +5,7 @@ define([
function (angular, coreModule) {
'use strict';
coreModule.service('utilSrv', function($rootScope, $modal, $q) {
coreModule.default.service('utilSrv', function($rootScope, $modal, $q) {
this.init = function() {
$rootScope.onAppEvent('show-modal', this.showModal, $rootScope);

View File

@ -1,5 +1,5 @@
class TableModel {
export default class TableModel {
columns: any[];
rows: any[];
type: string;
@ -35,5 +35,3 @@ class TableModel {
}
}
}
export = TableModel;

View File

@ -18,7 +18,7 @@ function translateFillOption(fill) {
return fill === 0 ? 0.001 : fill/10;
}
class TimeSeries {
export default class TimeSeries {
datapoints: any;
id: string;
label: string;
@ -168,5 +168,3 @@ class TimeSeries {
return this.valueFormater(value, this.decimals, this.scaledDecimals);
}
}
export = TimeSeries;

View File

@ -10,7 +10,7 @@ var unitsAsc = _.sortBy(units, function (unit) {
var unitsDesc = unitsAsc.reverse();
function parse(text, roundUp?) {
export function parse(text, roundUp?) {
if (!text) { return undefined; }
if (moment.isMoment(text)) { return text; }
if (_.isDate(text)) { return moment(text); }
@ -43,7 +43,7 @@ function parse(text, roundUp?) {
return parseDateMath(mathString, time, roundUp);
}
function isValid(text) {
export function isValid(text) {
var date = parse(text);
if (!date) {
return false;
@ -56,7 +56,7 @@ function isValid(text) {
return false;
}
function parseDateMath(mathString, time, roundUp?) {
export function parseDateMath(mathString, time, roundUp?) {
var dateTime = time;
var i = 0;
var len = mathString.length;
@ -118,8 +118,3 @@ function parseDateMath(mathString, time, roundUp?) {
return dateTime;
}
export = {
parse: parse,
parseDateMath: parseDateMath,
isValid: isValid
};

View File

@ -1,7 +1,7 @@
// Copyright (c) 2014, Hugh Kennedy
// Based on code from https://github.com/hughsk/flat/blob/master/index.js
//
function flatten(target, opts): any {
export default function flatten(target, opts): any {
opts = opts || {};
var delimiter = opts.delimiter || '.';
@ -35,5 +35,3 @@ function flatten(target, opts): any {
return output;
}
export = flatten;

View File

@ -2,8 +2,8 @@
import moment = require('moment');
import _ = require('lodash');
import dateMath = require('app/core/utils/datemath');
import angular = require('angular');
import * as dateMath from 'app/core/utils/datemath';
var spans = {
's': {display: 'second'},
@ -56,95 +56,89 @@ _.each(rangeOptions, function (frame) {
rangeIndex[frame.from + ' to ' + frame.to] = frame;
});
function getRelativeTimesList(timepickerSettings, currentDisplay) {
var groups = _.groupBy(rangeOptions, (option: any) => {
option.active = option.display === currentDisplay;
return option.section;
});
export function getRelativeTimesList(timepickerSettings, currentDisplay) {
var groups = _.groupBy(rangeOptions, (option: any) => {
option.active = option.display === currentDisplay;
return option.section;
});
// _.each(timepickerSettings.time_options, (duration: string) => {
// let info = describeTextRange(duration);
// if (info.section) {
// groups[info.section].push(info);
// }
// });
// _.each(timepickerSettings.time_options, (duration: string) => {
// let info = describeTextRange(duration);
// if (info.section) {
// groups[info.section].push(info);
// }
// });
return groups;
return groups;
}
function formatDate(date) {
return date.format(absoluteFormat);
}
// handles expressions like
// 5m
// 5m to now/d
// now/d to now
// now/d
// if no to <expr> then to now is assumed
export function describeTextRange(expr: any) {
if (expr.indexOf('now') === -1) {
expr = 'now-' + expr;
}
function formatDate(date) {
return date.format(absoluteFormat);
}
// handles expressions like
// 5m
// 5m to now/d
// now/d to now
// now/d
// if no to <expr> then to now is assumed
function describeTextRange(expr: any) {
if (expr.indexOf('now') === -1) {
expr = 'now-' + expr;
}
let opt = rangeIndex[expr + ' to now'];
if (opt) {
return opt;
}
opt = {from: expr, to: 'now'};
let parts = /^now-(\d+)(\w)/.exec(expr);
if (parts) {
let unit = parts[2];
let amount = parseInt(parts[1]);
let span = spans[unit];
if (span) {
opt.display = 'Last ' + amount + ' ' + span.display;
opt.section = span.section;
if (amount > 1) {
opt.display += 's';
}
}
} else {
opt.display = opt.from + ' to ' + opt.to;
opt.invalid = true;
}
let opt = rangeIndex[expr + ' to now'];
if (opt) {
return opt;
}
function describeTimeRange(range) {
var option = rangeIndex[range.from.toString() + ' to ' + range.to.toString()];
if (option) {
return option.display;
}
opt = {from: expr, to: 'now'};
if (moment.isMoment(range.from) && moment.isMoment(range.to)) {
return formatDate(range.from) + ' to ' + formatDate(range.to);
let parts = /^now-(\d+)(\w)/.exec(expr);
if (parts) {
let unit = parts[2];
let amount = parseInt(parts[1]);
let span = spans[unit];
if (span) {
opt.display = 'Last ' + amount + ' ' + span.display;
opt.section = span.section;
if (amount > 1) {
opt.display += 's';
}
}
if (moment.isMoment(range.from)) {
var toMoment = dateMath.parse(range.to, true);
return formatDate(range.from) + ' to ' + toMoment.fromNow();
}
if (moment.isMoment(range.to)) {
var from = dateMath.parse(range.from, false);
return from.fromNow() + ' to ' + formatDate(range.to);
}
if (range.to.toString() === 'now') {
var res = describeTextRange(range.from);
return res.display;
}
return range.from.toString() + ' to ' + range.to.toString();
} else {
opt.display = opt.from + ' to ' + opt.to;
opt.invalid = true;
}
export = {
getRelativeTimesList: getRelativeTimesList,
describeTextRange: describeTextRange,
describeTimeRange: describeTimeRange,
return opt;
}
export function describeTimeRange(range) {
var option = rangeIndex[range.from.toString() + ' to ' + range.to.toString()];
if (option) {
return option.display;
}
if (moment.isMoment(range.from) && moment.isMoment(range.to)) {
return formatDate(range.from) + ' to ' + formatDate(range.to);
}
if (moment.isMoment(range.from)) {
var toMoment = dateMath.parse(range.to, true);
return formatDate(range.from) + ' to ' + toMoment.fromNow();
}
if (moment.isMoment(range.to)) {
var from = dateMath.parse(range.from, false);
return from.fromNow() + ' to ' + formatDate(range.to);
}
if (range.to.toString() === 'now') {
var res = describeTextRange(range.from);
return res.display;
}
return range.from.toString() + ' to ' + range.to.toString();
}

View File

@ -5,8 +5,9 @@ import angular = require('angular');
import _ = require('lodash');
import moment = require('moment');
import kbn = require('app/core/utils/kbn');
import dateMath = require('app/core/utils/datemath');
import rangeUtil = require('app/core/utils/rangeutil');
import * as dateMath from 'app/core/utils/datemath';
import * as rangeUtil from 'app/core/utils/rangeutil';
declare var inputDate: any;

View File

@ -1,4 +1,4 @@
class PanelMeta {
export default class PanelMeta {
description: any;
fullscreen: any;
editIcon: any;
@ -46,4 +46,3 @@ class PanelMeta {
}
}
export = PanelMeta;

View File

@ -3,8 +3,10 @@ System.config({
defaultJSExtensions: true,
transpiler: false,
paths: {
"github:*": "vendor/jspm/github/*",
"npm:*": "vendor/jspm/npm/*",
"github:*": "public/vendor/jspm/github/*",
"npm:*": "public/vendor/jspm/npm/*",
"angular": "vendor/jquery/dist/jquery.js",
"jquery": "vendor/angular/angular.js",
"bootstrap": "vendor/bootstrap/bootstrap.js",
"angular-ui": "vendor/angular-ui/ui-bootstrap-tpls.js",
"angular-strap": "vendor/angular-other/angular-strap.js",
@ -13,15 +15,15 @@ System.config({
"spectrum": "vendor/spectrum.js",
"filesaver": "vendor/filesaver.js",
"bootstrap-tagsinput": "vendor/tagsinput/bootstrap-tagsinput.js",
'jquery.flot': 'vendor/flot/jquery.flot',
'jquery.flot.pie': 'vendor/flot/jquery.flot.pie',
'jquery.flot.events': 'vendor/flot/jquery.flot.events',
'jquery.flot.selection': 'vendor/flot/jquery.flot.selection',
'jquery.flot.stack': 'vendor/flot/jquery.flot.stack',
'jquery.flot.stackpercent':'vendor/flot/jquery.flot.stackpercent',
'jquery.flot.time': 'vendor/flot/jquery.flot.time',
'jquery.flot.crosshair': 'vendor/flot/jquery.flot.crosshair',
'jquery.flot.fillbelow': 'vendor/flot/jquery.flot.fillbelow',
"jquery.flot": "vendor/flot/jquery.flot",
"jquery.flot.pie": "vendor/flot/jquery.flot.pie",
"jquery.flot.events": "vendor/flot/jquery.flot.events",
"jquery.flot.selection": "vendor/flot/jquery.flot.selection",
"jquery.flot.stack": "vendor/flot/jquery.flot.stack",
"jquery.flot.stackpercent": "vendor/flot/jquery.flot.stackpercent",
"jquery.flot.time": "vendor/flot/jquery.flot.time",
"jquery.flot.crosshair": "vendor/flot/jquery.flot.crosshair",
"jquery.flot.fillbelow": "vendor/flot/jquery.flot.fillbelow"
},
packages: {
@ -31,316 +33,5 @@ System.config({
},
map: {
"angular": "github:angular/bower-angular@1.4.5",
"angular-route": "github:angular/bower-angular-route@1.4.5",
"angular-sanitize": "github:angular/bower-angular-sanitize@1.4.5",
"angular2/angular2": "npm:angular2@2.0.0-alpha.54/bundles/angular2.dev",
"babel": "npm:babel-core@5.8.34",
"babel-runtime": "npm:babel-runtime@5.8.34",
"core-js": "npm:core-js@1.2.6",
"es6-promise": "npm:es6-promise@3.0.2",
"es6-shim": "npm:es6-shim@0.33.13",
"jquery": "github:components/jquery@2.1.4",
"lodash": "npm:lodash@3.10.1",
"moment": "github:moment/moment@2.10.6",
"github:angular/bower-angular-route@1.4.5": {
"angular": "github:angular/bower-angular@1.4.5"
},
"github:angular/bower-angular-sanitize@1.4.5": {
"angular": "github:angular/bower-angular@1.4.5"
},
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.3.0"
},
"github:jspm/nodelibs-buffer@0.1.0": {
"buffer": "npm:buffer@3.5.5"
},
"github:jspm/nodelibs-constants@0.1.0": {
"constants-browserify": "npm:constants-browserify@0.0.1"
},
"github:jspm/nodelibs-crypto@0.1.0": {
"crypto-browserify": "npm:crypto-browserify@3.11.0"
},
"github:jspm/nodelibs-events@0.1.1": {
"events": "npm:events@1.0.2"
},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.2": {
"process": "npm:process@0.11.2"
},
"github:jspm/nodelibs-stream@0.1.0": {
"stream-browserify": "npm:stream-browserify@1.0.0"
},
"github:jspm/nodelibs-string_decoder@0.1.0": {
"string_decoder": "npm:string_decoder@0.10.31"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@0.10.3"
},
"github:jspm/nodelibs-vm@0.1.0": {
"vm-browserify": "npm:vm-browserify@0.0.4"
},
"npm:angular2@2.0.0-alpha.54": {
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"es6-promise": "npm:es6-promise@3.0.2",
"es6-shim": "npm:es6-shim@0.33.13",
"process": "github:jspm/nodelibs-process@0.1.2",
"reflect-metadata": "npm:reflect-metadata@0.1.2",
"rxjs": "npm:rxjs@5.0.0-beta.0",
"zone.js": "npm:zone.js@0.5.10"
},
"npm:asn1.js@4.2.1": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"bn.js": "npm:bn.js@4.5.2",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"inherits": "npm:inherits@2.0.1",
"minimalistic-assert": "npm:minimalistic-assert@1.0.0",
"vm": "github:jspm/nodelibs-vm@0.1.0"
},
"npm:assert@1.3.0": {
"util": "npm:util@0.10.3"
},
"npm:babel-runtime@5.8.34": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:browserify-aes@1.0.5": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"buffer-xor": "npm:buffer-xor@1.0.3",
"cipher-base": "npm:cipher-base@1.0.2",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:browserify-cipher@1.0.0": {
"browserify-aes": "npm:browserify-aes@1.0.5",
"browserify-des": "npm:browserify-des@1.0.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0"
},
"npm:browserify-des@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"cipher-base": "npm:cipher-base@1.0.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"des.js": "npm:des.js@1.0.0",
"inherits": "npm:inherits@2.0.1"
},
"npm:browserify-rsa@4.0.0": {
"bn.js": "npm:bn.js@4.5.2",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"constants": "github:jspm/nodelibs-constants@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"randombytes": "npm:randombytes@2.0.1"
},
"npm:browserify-sign@4.0.0": {
"bn.js": "npm:bn.js@4.5.2",
"browserify-rsa": "npm:browserify-rsa@4.0.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"create-hmac": "npm:create-hmac@1.1.4",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"elliptic": "npm:elliptic@6.0.2",
"inherits": "npm:inherits@2.0.1",
"parse-asn1": "npm:parse-asn1@5.0.0",
"stream": "github:jspm/nodelibs-stream@0.1.0"
},
"npm:buffer-xor@1.0.3": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:buffer@3.5.5": {
"base64-js": "npm:base64-js@0.0.8",
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"ieee754": "npm:ieee754@1.1.6",
"isarray": "npm:isarray@1.0.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:cipher-base@1.0.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"inherits": "npm:inherits@2.0.1",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"string_decoder": "github:jspm/nodelibs-string_decoder@0.1.0"
},
"npm:constants-browserify@0.0.1": {
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:core-js@1.2.6": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:core-util-is@1.0.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:create-ecdh@4.0.0": {
"bn.js": "npm:bn.js@4.5.2",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"elliptic": "npm:elliptic@6.0.2"
},
"npm:create-hash@1.1.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"cipher-base": "npm:cipher-base@1.0.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"ripemd160": "npm:ripemd160@1.0.1",
"sha.js": "npm:sha.js@2.4.4"
},
"npm:create-hmac@1.1.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"inherits": "npm:inherits@2.0.1",
"stream": "github:jspm/nodelibs-stream@0.1.0"
},
"npm:crypto-browserify@3.11.0": {
"browserify-cipher": "npm:browserify-cipher@1.0.0",
"browserify-sign": "npm:browserify-sign@4.0.0",
"create-ecdh": "npm:create-ecdh@4.0.0",
"create-hash": "npm:create-hash@1.1.2",
"create-hmac": "npm:create-hmac@1.1.4",
"diffie-hellman": "npm:diffie-hellman@5.0.0",
"inherits": "npm:inherits@2.0.1",
"pbkdf2": "npm:pbkdf2@3.0.4",
"public-encrypt": "npm:public-encrypt@4.0.0",
"randombytes": "npm:randombytes@2.0.1"
},
"npm:des.js@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"inherits": "npm:inherits@2.0.1",
"minimalistic-assert": "npm:minimalistic-assert@1.0.0"
},
"npm:diffie-hellman@5.0.0": {
"bn.js": "npm:bn.js@4.5.2",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"miller-rabin": "npm:miller-rabin@4.0.0",
"randombytes": "npm:randombytes@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:elliptic@6.0.2": {
"bn.js": "npm:bn.js@4.5.2",
"brorand": "npm:brorand@1.0.5",
"hash.js": "npm:hash.js@1.0.3",
"inherits": "npm:inherits@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:es6-promise@3.0.2": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:es6-shim@0.33.13": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:evp_bytestokey@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0"
},
"npm:hash.js@1.0.3": {
"inherits": "npm:inherits@2.0.1"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:lodash@3.10.1": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:miller-rabin@4.0.0": {
"bn.js": "npm:bn.js@4.5.2",
"brorand": "npm:brorand@1.0.5"
},
"npm:parse-asn1@5.0.0": {
"asn1.js": "npm:asn1.js@4.2.1",
"browserify-aes": "npm:browserify-aes@1.0.5",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0",
"pbkdf2": "npm:pbkdf2@3.0.4",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:pbkdf2@3.0.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"create-hmac": "npm:create-hmac@1.1.4",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:process@0.11.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0"
},
"npm:public-encrypt@4.0.0": {
"bn.js": "npm:bn.js@4.5.2",
"browserify-rsa": "npm:browserify-rsa@4.0.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"parse-asn1": "npm:parse-asn1@5.0.0",
"randombytes": "npm:randombytes@2.0.1"
},
"npm:randombytes@2.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:readable-stream@1.1.13": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"core-util-is": "npm:core-util-is@1.0.2",
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"isarray": "npm:isarray@0.0.1",
"process": "github:jspm/nodelibs-process@0.1.2",
"stream-browserify": "npm:stream-browserify@1.0.0",
"string_decoder": "npm:string_decoder@0.10.31"
},
"npm:reflect-metadata@0.1.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:ripemd160@1.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:rxjs@5.0.0-beta.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:sha.js@2.4.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:stream-browserify@1.0.0": {
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"readable-stream": "npm:readable-stream@1.1.13"
},
"npm:string_decoder@0.10.31": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:vm-browserify@0.0.4": {
"indexof": "npm:indexof@0.0.1"
},
"npm:zone.js@0.5.10": {
"es6-promise": "npm:es6-promise@3.0.2",
"process": "github:jspm/nodelibs-process@0.1.2"
}
}
});

View File

@ -1,9 +1,9 @@
///<reference path="../../../headers/common.d.ts" />
import _ = require('lodash');
import queryPart = require('./query_part');
import queryPart from './query_part';
class InfluxQuery {
export default class InfluxQuery {
target: any;
selectModels: any[];
groupByParts: any;
@ -212,5 +212,3 @@ measurement = '"' + measurement+ '"';
return query;
}
}
export = InfluxQuery;

View File

@ -421,7 +421,7 @@ class QueryPart {
}
}
export = {
export default {
create: function(part): any {
return new QueryPart(part);
},

View File

@ -3,7 +3,7 @@
import angular = require('angular');
import _ = require('lodash');
import moment = require('moment');
import PanelMeta = require('app/features/panel/panel_meta');
import PanelMeta from 'app/features/panel/panel_meta';
import {transformDataToTable} from './transformers';
@ -128,4 +128,3 @@ export class TablePanelCtrl {
$scope.init();
}
}

View File

@ -1,52 +0,0 @@
import {transformers} from './transformers';
export class TableModel {
columns: any[];
rows: any[];
constructor() {
this.columns = [];
this.rows = [];
}
sort(options) {
if (options.col === null || this.columns.length <= options.col) {
return;
}
this.rows.sort(function(a, b) {
a = a[options.col];
b = b[options.col];
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
});
this.columns[options.col].sort = true;
if (options.desc) {
this.rows.reverse();
this.columns[options.col].desc = true;
}
}
static transform(data, panel) {
var model = new TableModel();
if (!data || data.length === 0) {
return model;
}
var transformer = transformers[panel.transform];
if (!transformer) {
throw {message: 'Transformer ' + panel.transformer + ' not found'};
}
transformer.transform(data, panel, model);
return model;
}
}

View File

@ -2,9 +2,9 @@
import moment = require('moment');
import _ = require('lodash');
import flatten = require('app/core/utils/flatten');
import TimeSeries = require('app/core/time_series');
import TableModel = require('app/core/table_model');
import flatten from 'app/core/utils/flatten';
import TimeSeries from 'app/core/time_series';
import TableModel from 'app/core/table_model';
var transformers = {};

View File

@ -1,317 +0,0 @@
{
"npm:lodash@3.10.1": {
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"github:components/jquery@2.1.4": {},
"github:moment/moment@2.10.6": {},
"npm:assert@1.3.0": {
"util": "npm:util@0.10.3"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@^0.1.0"
},
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@^1.3.0"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@^0.10.3"
},
"npm:babel-runtime@5.8.34": {
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:babel-core@5.8.34": {},
"npm:core-js@1.2.6": {
"systemjs-json": "github:systemjs/plugin-json@^0.1.0",
"process": "github:jspm/nodelibs-process@^0.1.0",
"fs": "github:jspm/nodelibs-fs@^0.1.0",
"path": "github:jspm/nodelibs-path@^0.1.0"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"github:systemjs/plugin-json@0.1.0": {},
"github:jspm/nodelibs-fs@0.1.2": {},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"npm:es6-promise@3.0.2": {
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:reflect-metadata@0.1.2": {
"process": "github:jspm/nodelibs-process@^0.1.0",
"assert": "github:jspm/nodelibs-assert@^0.1.0"
},
"npm:es6-shim@0.33.13": {
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:zone.js@0.5.10": {
"es6-promise": "npm:es6-promise@^3.0.2",
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:rxjs@5.0.0-beta.0": {
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:angular2@2.0.0-alpha.54": {
"es6-promise": "npm:es6-promise@^3.0.2",
"es6-shim": "npm:es6-shim@^0.33.3",
"reflect-metadata": "npm:reflect-metadata@0.1.2",
"rxjs": "npm:rxjs@5.0.0-beta.0",
"zone.js": "npm:zone.js@0.5.10",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0",
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:buffer@3.5.5": {
"base64-js": "npm:base64-js@0.0.8",
"ieee754": "npm:ieee754@^1.1.4",
"isarray": "npm:isarray@^1.0.0",
"fs": "github:jspm/nodelibs-fs@^0.1.0",
"child_process": "github:jspm/nodelibs-child_process@^0.1.0",
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:ieee754@1.1.6": {},
"npm:isarray@1.0.0": {},
"npm:base64-js@0.0.8": {},
"github:jspm/nodelibs-buffer@0.1.0": {
"buffer": "npm:buffer@^3.0.1"
},
"github:jspm/nodelibs-child_process@0.1.0": {},
"npm:crypto-browserify@3.11.0": {
"browserify-cipher": "npm:browserify-cipher@^1.0.0",
"browserify-sign": "npm:browserify-sign@^4.0.0",
"create-ecdh": "npm:create-ecdh@^4.0.0",
"create-hash": "npm:create-hash@^1.1.0",
"create-hmac": "npm:create-hmac@^1.1.0",
"diffie-hellman": "npm:diffie-hellman@^5.0.0",
"inherits": "npm:inherits@^2.0.1",
"pbkdf2": "npm:pbkdf2@^3.0.3",
"public-encrypt": "npm:public-encrypt@^4.0.0",
"randombytes": "npm:randombytes@^2.0.0"
},
"npm:browserify-cipher@1.0.0": {
"browserify-aes": "npm:browserify-aes@^1.0.4",
"browserify-des": "npm:browserify-des@^1.0.0",
"evp_bytestokey": "npm:evp_bytestokey@^1.0.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:create-ecdh@4.0.0": {
"bn.js": "npm:bn.js@^4.1.0",
"elliptic": "npm:elliptic@^6.0.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0"
},
"npm:create-hmac@1.1.4": {
"create-hash": "npm:create-hash@^1.1.0",
"inherits": "npm:inherits@^2.0.1",
"stream": "github:jspm/nodelibs-stream@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0"
},
"npm:create-hash@1.1.2": {
"cipher-base": "npm:cipher-base@^1.0.1",
"inherits": "npm:inherits@^2.0.1",
"ripemd160": "npm:ripemd160@^1.0.0",
"sha.js": "npm:sha.js@^2.3.6",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"fs": "github:jspm/nodelibs-fs@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0"
},
"npm:pbkdf2@3.0.4": {
"create-hmac": "npm:create-hmac@^1.1.2",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"process": "github:jspm/nodelibs-process@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0",
"child_process": "github:jspm/nodelibs-child_process@^0.1.0",
"path": "github:jspm/nodelibs-path@^0.1.0",
"systemjs-json": "github:systemjs/plugin-json@^0.1.0"
},
"npm:diffie-hellman@5.0.0": {
"bn.js": "npm:bn.js@^4.1.0",
"miller-rabin": "npm:miller-rabin@^4.0.0",
"randombytes": "npm:randombytes@^2.0.0",
"systemjs-json": "github:systemjs/plugin-json@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0"
},
"npm:browserify-aes@1.0.5": {
"buffer-xor": "npm:buffer-xor@^1.0.2",
"cipher-base": "npm:cipher-base@^1.0.0",
"create-hash": "npm:create-hash@^1.1.0",
"evp_bytestokey": "npm:evp_bytestokey@^1.0.0",
"inherits": "npm:inherits@^2.0.1",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0",
"systemjs-json": "github:systemjs/plugin-json@^0.1.0",
"fs": "github:jspm/nodelibs-fs@^0.1.0"
},
"github:jspm/nodelibs-crypto@0.1.0": {
"crypto-browserify": "npm:crypto-browserify@^3.7.2"
},
"npm:cipher-base@1.0.2": {
"inherits": "npm:inherits@^2.0.1",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"stream": "github:jspm/nodelibs-stream@^0.1.0",
"string_decoder": "github:jspm/nodelibs-string_decoder@^0.1.0"
},
"npm:ripemd160@1.0.1": {
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"process": "github:jspm/nodelibs-process@^0.1.0"
},
"npm:browserify-sign@4.0.0": {
"bn.js": "npm:bn.js@^4.1.1",
"browserify-rsa": "npm:browserify-rsa@^4.0.0",
"create-hash": "npm:create-hash@^1.1.0",
"create-hmac": "npm:create-hmac@^1.1.2",
"elliptic": "npm:elliptic@^6.0.0",
"inherits": "npm:inherits@^2.0.1",
"parse-asn1": "npm:parse-asn1@^5.0.0",
"stream": "github:jspm/nodelibs-stream@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0"
},
"npm:browserify-des@1.0.0": {
"cipher-base": "npm:cipher-base@^1.0.1",
"des.js": "npm:des.js@^1.0.0",
"inherits": "npm:inherits@^2.0.1",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:public-encrypt@4.0.0": {
"bn.js": "npm:bn.js@^4.1.0",
"browserify-rsa": "npm:browserify-rsa@^4.0.0",
"create-hash": "npm:create-hash@^1.1.0",
"parse-asn1": "npm:parse-asn1@^5.0.0",
"randombytes": "npm:randombytes@^2.0.1",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0"
},
"npm:bn.js@4.5.2": {},
"npm:buffer-xor@1.0.3": {
"systemjs-json": "github:systemjs/plugin-json@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:browserify-rsa@4.0.0": {
"bn.js": "npm:bn.js@^4.1.0",
"randombytes": "npm:randombytes@^2.0.1",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0",
"constants": "github:jspm/nodelibs-constants@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:miller-rabin@4.0.0": {
"bn.js": "npm:bn.js@^4.0.0",
"brorand": "npm:brorand@^1.0.1"
},
"npm:des.js@1.0.0": {
"inherits": "npm:inherits@^2.0.1",
"minimalistic-assert": "npm:minimalistic-assert@^1.0.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:parse-asn1@5.0.0": {
"asn1.js": "npm:asn1.js@^4.0.0",
"browserify-aes": "npm:browserify-aes@^1.0.0",
"create-hash": "npm:create-hash@^1.1.0",
"evp_bytestokey": "npm:evp_bytestokey@^1.0.0",
"pbkdf2": "npm:pbkdf2@^3.0.3",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"systemjs-json": "github:systemjs/plugin-json@^0.1.0"
},
"npm:brorand@1.0.5": {},
"npm:randombytes@2.0.1": {
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"process": "github:jspm/nodelibs-process@^0.1.0",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0"
},
"npm:minimalistic-assert@1.0.0": {},
"npm:asn1.js@4.2.1": {
"bn.js": "npm:bn.js@^4.0.0",
"inherits": "npm:inherits@^2.0.1",
"minimalistic-assert": "npm:minimalistic-assert@^1.0.0",
"vm": "github:jspm/nodelibs-vm@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"assert": "github:jspm/nodelibs-assert@^0.1.0"
},
"npm:evp_bytestokey@1.0.0": {
"create-hash": "npm:create-hash@^1.1.1",
"crypto": "github:jspm/nodelibs-crypto@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:sha.js@2.4.4": {
"inherits": "npm:inherits@^2.0.1",
"fs": "github:jspm/nodelibs-fs@^0.1.0",
"process": "github:jspm/nodelibs-process@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:elliptic@6.0.2": {
"bn.js": "npm:bn.js@^4.0.0",
"brorand": "npm:brorand@^1.0.1",
"hash.js": "npm:hash.js@^1.0.0",
"inherits": "npm:inherits@^2.0.1",
"systemjs-json": "github:systemjs/plugin-json@^0.1.0"
},
"npm:hash.js@1.0.3": {
"inherits": "npm:inherits@^2.0.1"
},
"npm:stream-browserify@1.0.0": {
"inherits": "npm:inherits@~2.0.1",
"readable-stream": "npm:readable-stream@^1.0.27-1",
"events": "github:jspm/nodelibs-events@^0.1.1"
},
"npm:string_decoder@0.10.31": {
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:isarray@0.0.1": {},
"npm:readable-stream@1.1.13": {
"core-util-is": "npm:core-util-is@~1.0.0",
"inherits": "npm:inherits@~2.0.1",
"isarray": "npm:isarray@0.0.1",
"string_decoder": "npm:string_decoder@~0.10.0",
"stream-browserify": "npm:stream-browserify@^1.0.0",
"process": "github:jspm/nodelibs-process@^0.1.0",
"buffer": "github:jspm/nodelibs-buffer@^0.1.0",
"events": "github:jspm/nodelibs-events@^0.1.1"
},
"npm:core-util-is@1.0.2": {
"buffer": "github:jspm/nodelibs-buffer@^0.1.0"
},
"npm:constants-browserify@0.0.1": {
"systemjs-json": "github:systemjs/plugin-json@^0.1.0"
},
"github:jspm/nodelibs-stream@0.1.0": {
"stream-browserify": "npm:stream-browserify@^1.0.0"
},
"npm:vm-browserify@0.0.4": {
"indexof": "npm:indexof@0.0.1"
},
"github:jspm/nodelibs-string_decoder@0.1.0": {
"string_decoder": "npm:string_decoder@^0.10.31"
},
"npm:indexof@0.0.1": {},
"github:jspm/nodelibs-constants@0.1.0": {
"constants-browserify": "npm:constants-browserify@0.0.1"
},
"github:jspm/nodelibs-vm@0.1.0": {
"vm-browserify": "npm:vm-browserify@0.0.4"
},
"npm:events@1.0.2": {},
"github:jspm/nodelibs-events@0.1.1": {
"events": "npm:events@1.0.2"
},
"github:angular/bower-angular-route@1.4.5": {
"angular": "jspm:angular@^1.3.0"
},
"github:angular/bower-angular-sanitize@1.4.5": {
"angular": "jspm:angular@^1.3.0"
},
"github:angular/bower-angular@1.4.5": {},
"github:jspm/nodelibs-process@0.1.2": {
"process": "npm:process@^0.11.0"
},
"npm:process@0.11.2": {
"assert": "github:jspm/nodelibs-assert@^0.1.0"
}
}

View File

@ -1 +0,0 @@
0.19.7

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
/* */
"format register";
System.register("angular2/src/facade/lang", [], true, function(require, exports, module) {
var global = System.global,
@ -34,19 +33,19 @@ System.register("angular2/src/facade/lang", [], true, function(require, exports,
exports.getTypeNameForDebugging = getTypeNameForDebugging;
exports.Math = _global.Math;
exports.Date = _global.Date;
var _devMode = !!_global.angularDevMode;
var _devModeLocked = false;
function lockDevMode() {
_devModeLocked = true;
var _devMode = true;
var _modeLocked = false;
function lockMode() {
_modeLocked = true;
}
exports.lockDevMode = lockDevMode;
function enableDevMode() {
if (_devModeLocked) {
throw 'Cannot enable dev mode after platform setup.';
exports.lockMode = lockMode;
function enableProdMode() {
if (_modeLocked) {
throw 'Cannot enable prod mode after platform setup.';
}
_devMode = true;
_devMode = false;
}
exports.enableDevMode = enableDevMode;
exports.enableProdMode = enableProdMode;
function assertionsEnabled() {
return _devMode;
}
@ -5474,12 +5473,12 @@ System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"],
return module.exports;
});
System.register("angular2/src/core/dev_mode", ["angular2/src/facade/lang"], true, function(require, exports, module) {
System.register("angular2/src/core/prod_mode", ["angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var lang_1 = require("angular2/src/facade/lang");
exports.enableDevMode = lang_1.enableDevMode;
exports.enableProdMode = lang_1.enableProdMode;
global.define = __define;
return module.exports;
});
@ -7296,6 +7295,41 @@ System.register("angular2/src/core/linker/template_commands", ["angular2/src/fac
return module.exports;
});
System.register("angular2/src/core/console", ["angular2/src/core/di", "angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
var di_1 = require("angular2/src/core/di");
var lang_1 = require("angular2/src/facade/lang");
var Console = (function() {
function Console() {}
Console.prototype.log = function(message) {
lang_1.print(message);
};
Console = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], Console);
return Console;
})();
exports.Console = Console;
global.define = __define;
return module.exports;
});
System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
@ -7577,12 +7611,13 @@ System.register("angular2/src/core/debug/debug_element", ["angular2/src/facade/l
return module.exports;
});
System.register("angular2/src/core/platform_common_providers", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability"], true, function(require, exports, module) {
System.register("angular2/src/core/platform_common_providers", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/console", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var lang_1 = require("angular2/src/facade/lang");
var di_1 = require("angular2/src/core/di");
var console_1 = require("angular2/src/core/console");
var reflection_1 = require("angular2/src/core/reflection/reflection");
var testability_1 = require("angular2/src/core/testability/testability");
function _reflector() {
@ -7591,7 +7626,7 @@ System.register("angular2/src/core/platform_common_providers", ["angular2/src/fa
exports.PLATFORM_COMMON_PROVIDERS = lang_1.CONST_EXPR([new di_1.Provider(reflection_1.Reflector, {
useFactory: _reflector,
deps: []
}), testability_1.TestabilityRegistry]);
}), testability_1.TestabilityRegistry, console_1.Console]);
global.define = __define;
return module.exports;
});
@ -14604,7 +14639,7 @@ System.register("angular2/src/facade/facade", ["angular2/src/facade/lang", "angu
return module.exports;
});
System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/testability/testability", "angular2/src/core/linker/dynamic_component_loader", "angular2/src/facade/exceptions", "angular2/src/core/linker/view_ref", "angular2/src/core/profile/profile", "angular2/src/facade/lang"], true, function(require, exports, module) {
System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/testability/testability", "angular2/src/core/linker/dynamic_component_loader", "angular2/src/facade/exceptions", "angular2/src/core/linker/view_ref", "angular2/src/core/console", "angular2/src/core/profile/profile", "angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@ -14627,6 +14662,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
var dynamic_component_loader_1 = require("angular2/src/core/linker/dynamic_component_loader");
var exceptions_1 = require("angular2/src/facade/exceptions");
var view_ref_1 = require("angular2/src/core/linker/view_ref");
var console_1 = require("angular2/src/core/console");
var profile_1 = require("angular2/src/core/profile/profile");
var lang_2 = require("angular2/src/facade/lang");
function _componentProviders(appComponentType) {
@ -14660,7 +14696,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
var _platform;
var _platformProviders;
function platform(providers) {
lang_2.lockDevMode();
lang_2.lockMode();
if (lang_1.isPresent(_platform)) {
if (collection_1.ListWrapper.equals(_platformProviders, providers)) {
return _platform;
@ -14893,7 +14929,12 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
completer.reject(e, e.stack);
}
});
return completer.promise;
return completer.promise.then(function(_) {
var c = _this._injector.get(console_1.Console);
var modeDescription = lang_1.assertionsEnabled() ? "in the development mode. Call enableProdMode() to enable the production mode." : "in the production mode. Call enableDevMode() to enable the development mode.";
c.log("Angular 2 is running " + modeDescription);
return _;
});
};
ApplicationRef_.prototype._loadComponent = function(ref) {
var appChangeDetector = view_ref_1.internalView(ref.hostView).changeDetector;
@ -14969,7 +15010,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
return module.exports;
});
System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/dev_mode", "angular2/src/core/di", "angular2/src/facade/facade", "angular2/src/core/application_ref", "angular2/src/core/application_tokens", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/linker", "angular2/src/core/debug/debug_element", "angular2/src/core/testability/testability", "angular2/src/core/change_detection", "angular2/src/core/platform_directives_and_pipes", "angular2/src/core/platform_common_providers", "angular2/src/core/application_common_providers", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) {
System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/prod_mode", "angular2/src/core/di", "angular2/src/facade/facade", "angular2/src/facade/lang", "angular2/src/core/application_ref", "angular2/src/core/application_tokens", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/linker", "angular2/src/core/debug/debug_element", "angular2/src/core/testability/testability", "angular2/src/core/change_detection", "angular2/src/core/platform_directives_and_pipes", "angular2/src/core/platform_common_providers", "angular2/src/core/application_common_providers", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@ -14980,9 +15021,11 @@ System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/co
}
__export(require("angular2/src/core/metadata"));
__export(require("angular2/src/core/util"));
__export(require("angular2/src/core/dev_mode"));
__export(require("angular2/src/core/prod_mode"));
__export(require("angular2/src/core/di"));
__export(require("angular2/src/facade/facade"));
var lang_1 = require("angular2/src/facade/lang");
exports.enableProdMode = lang_1.enableProdMode;
var application_ref_1 = require("angular2/src/core/application_ref");
exports.platform = application_ref_1.platform;
exports.createNgZone = application_ref_1.createNgZone;

View File

@ -1,4 +1,3 @@
/* */
"format register";
System.register("angular2/src/facade/lang", [], true, function(require, exports, module) {
var global = System.global,
@ -34,19 +33,19 @@ System.register("angular2/src/facade/lang", [], true, function(require, exports,
exports.getTypeNameForDebugging = getTypeNameForDebugging;
exports.Math = _global.Math;
exports.Date = _global.Date;
var _devMode = !!_global.angularDevMode;
var _devModeLocked = false;
function lockDevMode() {
_devModeLocked = true;
var _devMode = true;
var _modeLocked = false;
function lockMode() {
_modeLocked = true;
}
exports.lockDevMode = lockDevMode;
function enableDevMode() {
if (_devModeLocked) {
throw 'Cannot enable dev mode after platform setup.';
exports.lockMode = lockMode;
function enableProdMode() {
if (_modeLocked) {
throw 'Cannot enable prod mode after platform setup.';
}
_devMode = true;
_devMode = false;
}
exports.enableDevMode = enableDevMode;
exports.enableProdMode = enableProdMode;
function assertionsEnabled() {
return _devMode;
}
@ -5474,12 +5473,12 @@ System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"],
return module.exports;
});
System.register("angular2/src/core/dev_mode", ["angular2/src/facade/lang"], true, function(require, exports, module) {
System.register("angular2/src/core/prod_mode", ["angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var lang_1 = require("angular2/src/facade/lang");
exports.enableDevMode = lang_1.enableDevMode;
exports.enableProdMode = lang_1.enableProdMode;
global.define = __define;
return module.exports;
});
@ -7296,6 +7295,41 @@ System.register("angular2/src/core/linker/template_commands", ["angular2/src/fac
return module.exports;
});
System.register("angular2/src/core/console", ["angular2/src/core/di", "angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
var di_1 = require("angular2/src/core/di");
var lang_1 = require("angular2/src/facade/lang");
var Console = (function() {
function Console() {}
Console.prototype.log = function(message) {
lang_1.print(message);
};
Console = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], Console);
return Console;
})();
exports.Console = Console;
global.define = __define;
return module.exports;
});
System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
@ -7577,12 +7611,13 @@ System.register("angular2/src/core/debug/debug_element", ["angular2/src/facade/l
return module.exports;
});
System.register("angular2/src/core/platform_common_providers", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability"], true, function(require, exports, module) {
System.register("angular2/src/core/platform_common_providers", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/console", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var lang_1 = require("angular2/src/facade/lang");
var di_1 = require("angular2/src/core/di");
var console_1 = require("angular2/src/core/console");
var reflection_1 = require("angular2/src/core/reflection/reflection");
var testability_1 = require("angular2/src/core/testability/testability");
function _reflector() {
@ -7591,7 +7626,7 @@ System.register("angular2/src/core/platform_common_providers", ["angular2/src/fa
exports.PLATFORM_COMMON_PROVIDERS = lang_1.CONST_EXPR([new di_1.Provider(reflection_1.Reflector, {
useFactory: _reflector,
deps: []
}), testability_1.TestabilityRegistry]);
}), testability_1.TestabilityRegistry, console_1.Console]);
global.define = __define;
return module.exports;
});
@ -14604,7 +14639,7 @@ System.register("angular2/src/facade/facade", ["angular2/src/facade/lang", "angu
return module.exports;
});
System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/testability/testability", "angular2/src/core/linker/dynamic_component_loader", "angular2/src/facade/exceptions", "angular2/src/core/linker/view_ref", "angular2/src/core/profile/profile", "angular2/src/facade/lang"], true, function(require, exports, module) {
System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/testability/testability", "angular2/src/core/linker/dynamic_component_loader", "angular2/src/facade/exceptions", "angular2/src/core/linker/view_ref", "angular2/src/core/console", "angular2/src/core/profile/profile", "angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@ -14627,6 +14662,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
var dynamic_component_loader_1 = require("angular2/src/core/linker/dynamic_component_loader");
var exceptions_1 = require("angular2/src/facade/exceptions");
var view_ref_1 = require("angular2/src/core/linker/view_ref");
var console_1 = require("angular2/src/core/console");
var profile_1 = require("angular2/src/core/profile/profile");
var lang_2 = require("angular2/src/facade/lang");
function _componentProviders(appComponentType) {
@ -14660,7 +14696,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
var _platform;
var _platformProviders;
function platform(providers) {
lang_2.lockDevMode();
lang_2.lockMode();
if (lang_1.isPresent(_platform)) {
if (collection_1.ListWrapper.equals(_platformProviders, providers)) {
return _platform;
@ -14893,7 +14929,12 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
completer.reject(e, e.stack);
}
});
return completer.promise;
return completer.promise.then(function(_) {
var c = _this._injector.get(console_1.Console);
var modeDescription = lang_1.assertionsEnabled() ? "in the development mode. Call enableProdMode() to enable the production mode." : "in the production mode. Call enableDevMode() to enable the development mode.";
c.log("Angular 2 is running " + modeDescription);
return _;
});
};
ApplicationRef_.prototype._loadComponent = function(ref) {
var appChangeDetector = view_ref_1.internalView(ref.hostView).changeDetector;
@ -14969,7 +15010,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
return module.exports;
});
System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/dev_mode", "angular2/src/core/di", "angular2/src/facade/facade", "angular2/src/core/application_ref", "angular2/src/core/application_tokens", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/linker", "angular2/src/core/debug/debug_element", "angular2/src/core/testability/testability", "angular2/src/core/change_detection", "angular2/src/core/platform_directives_and_pipes", "angular2/src/core/platform_common_providers", "angular2/src/core/application_common_providers", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) {
System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/prod_mode", "angular2/src/core/di", "angular2/src/facade/facade", "angular2/src/facade/lang", "angular2/src/core/application_ref", "angular2/src/core/application_tokens", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/linker", "angular2/src/core/debug/debug_element", "angular2/src/core/testability/testability", "angular2/src/core/change_detection", "angular2/src/core/platform_directives_and_pipes", "angular2/src/core/platform_common_providers", "angular2/src/core/application_common_providers", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@ -14980,9 +15021,11 @@ System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/co
}
__export(require("angular2/src/core/metadata"));
__export(require("angular2/src/core/util"));
__export(require("angular2/src/core/dev_mode"));
__export(require("angular2/src/core/prod_mode"));
__export(require("angular2/src/core/di"));
__export(require("angular2/src/facade/facade"));
var lang_1 = require("angular2/src/facade/lang");
exports.enableProdMode = lang_1.enableProdMode;
var application_ref_1 = require("angular2/src/core/application_ref");
exports.platform = application_ref_1.platform;
exports.createNgZone = application_ref_1.createNgZone;

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
/* */
"format register";
System.register("angular2/src/http/interfaces", [], true, function(require, exports, module) {
var global = System.global,

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
/* */
"format register";
System.register("angular2/src/router/router_link_transform", ["angular2/compiler", "angular2/src/core/change_detection/parser/ast", "angular2/src/facade/exceptions", "angular2/core", "angular2/src/core/change_detection/parser/parser"], true, function(require, exports, module) {
var global = System.global,
@ -233,7 +232,7 @@ System.register("angular2/router/router_link_dsl", ["angular2/compiler", "angula
var lang_1 = require("angular2/src/facade/lang");
var router_link_transform_2 = require("angular2/src/router/router_link_transform");
exports.RouterLinkTransform = router_link_transform_2.RouterLinkTransform;
var ROUTER_LINK_DSL_PROVIDER = lang_1.CONST_EXPR(new core_1.Provider(compiler_1.TEMPLATE_TRANSFORMS, {
exports.ROUTER_LINK_DSL_PROVIDER = lang_1.CONST_EXPR(new core_1.Provider(compiler_1.TEMPLATE_TRANSFORMS, {
useClass: router_link_transform_1.RouterLinkTransform,
multi: true
}));

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
/* */
"format register";
System.register("angular2/src/mock/location_mock", ["angular2/src/core/di", "angular2/src/facade/async"], true, function(require, exports, module) {
var global = System.global,
@ -193,7 +192,7 @@ System.register("angular2/src/mock/mock_location_strategy", ["angular2/src/core/
}
MockLocationStrategy.prototype.simulatePopState = function(url) {
this.internalPath = url;
async_1.ObservableWrapper.callEmit(this._subject, new MockPopStateEvent(this.path()));
async_1.ObservableWrapper.callEmit(this._subject, new _MockPopStateEvent(this.path()));
};
MockLocationStrategy.prototype.path = function() {
return this.internalPath;
@ -238,13 +237,13 @@ System.register("angular2/src/mock/mock_location_strategy", ["angular2/src/core/
return MockLocationStrategy;
})(location_strategy_1.LocationStrategy);
exports.MockLocationStrategy = MockLocationStrategy;
var MockPopStateEvent = (function() {
function MockPopStateEvent(newUrl) {
var _MockPopStateEvent = (function() {
function _MockPopStateEvent(newUrl) {
this.newUrl = newUrl;
this.pop = true;
this.type = 'popstate';
}
return MockPopStateEvent;
return _MockPopStateEvent;
})();
global.define = __define;
return module.exports;

View File

@ -1,4 +1,3 @@
/* */
"format register";
System.register("angular2/src/upgrade/metadata", ["angular2/core"], true, function(require, exports, module) {
var global = System.global,

View File

@ -0,0 +1,774 @@
"format register";
System.register("angular2/src/upgrade/metadata", ["angular2/core"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var core_1 = require("angular2/core");
var COMPONENT_SELECTOR = /^[\w|-]*$/;
var SKEWER_CASE = /-(\w)/g;
var directiveResolver = new core_1.DirectiveResolver();
function getComponentInfo(type) {
var resolvedMetadata = directiveResolver.resolve(type);
var selector = resolvedMetadata.selector;
if (!selector.match(COMPONENT_SELECTOR)) {
throw new Error('Only selectors matching element names are supported, got: ' + selector);
}
var selector = selector.replace(SKEWER_CASE, function(all, letter) {
return letter.toUpperCase();
});
return {
type: type,
selector: selector,
inputs: parseFields(resolvedMetadata.inputs),
outputs: parseFields(resolvedMetadata.outputs)
};
}
exports.getComponentInfo = getComponentInfo;
function parseFields(names) {
var attrProps = [];
if (names) {
for (var i = 0; i < names.length; i++) {
var parts = names[i].split(':');
var prop = parts[0].trim();
var attr = (parts[1] || parts[0]).trim();
var capitalAttr = attr.charAt(0).toUpperCase() + attr.substr(1);
attrProps.push({
prop: prop,
attr: attr,
bracketAttr: "[" + attr + "]",
parenAttr: "(" + attr + ")",
bracketParenAttr: "[(" + attr + ")]",
onAttr: "on" + capitalAttr,
bindAttr: "bind" + capitalAttr,
bindonAttr: "bindon" + capitalAttr
});
}
}
return attrProps;
}
exports.parseFields = parseFields;
global.define = __define;
return module.exports;
});
System.register("angular2/src/upgrade/util", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
function stringify(obj) {
if (typeof obj == 'function')
return obj.name || obj.toString();
return '' + obj;
}
exports.stringify = stringify;
function onError(e) {
console.log(e, e.stack);
throw e;
}
exports.onError = onError;
function controllerKey(name) {
return '$' + name + 'Controller';
}
exports.controllerKey = controllerKey;
global.define = __define;
return module.exports;
});
System.register("angular2/src/upgrade/constants", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
exports.NG2_APP_VIEW_MANAGER = 'ng2.AppViewManager';
exports.NG2_COMPILER = 'ng2.Compiler';
exports.NG2_INJECTOR = 'ng2.Injector';
exports.NG2_PROTO_VIEW_REF_MAP = 'ng2.ProtoViewRefMap';
exports.NG2_ZONE = 'ng2.NgZone';
exports.NG1_CONTROLLER = '$controller';
exports.NG1_SCOPE = '$scope';
exports.NG1_ROOT_SCOPE = '$rootScope';
exports.NG1_COMPILE = '$compile';
exports.NG1_HTTP_BACKEND = '$httpBackend';
exports.NG1_INJECTOR = '$injector';
exports.NG1_PARSE = '$parse';
exports.NG1_TEMPLATE_CACHE = '$templateCache';
exports.REQUIRE_INJECTOR = '^' + exports.NG2_INJECTOR;
global.define = __define;
return module.exports;
});
System.register("angular2/src/upgrade/downgrade_ng2_adapter", ["angular2/core", "angular2/src/upgrade/constants"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var core_1 = require("angular2/core");
var constants_1 = require("angular2/src/upgrade/constants");
var INITIAL_VALUE = {__UNINITIALIZED__: true};
var DowngradeNg2ComponentAdapter = (function() {
function DowngradeNg2ComponentAdapter(id, info, element, attrs, scope, parentInjector, parse, viewManager, protoView) {
this.id = id;
this.info = info;
this.element = element;
this.attrs = attrs;
this.scope = scope;
this.parentInjector = parentInjector;
this.parse = parse;
this.viewManager = viewManager;
this.protoView = protoView;
this.component = null;
this.inputChangeCount = 0;
this.inputChanges = null;
this.hostViewRef = null;
this.changeDetector = null;
this.contentInserctionPoint = null;
this.element[0].id = id;
this.componentScope = scope.$new();
this.childNodes = element.contents();
}
DowngradeNg2ComponentAdapter.prototype.bootstrapNg2 = function() {
var childInjector = this.parentInjector.resolveAndCreateChild([core_1.provide(constants_1.NG1_SCOPE, {useValue: this.componentScope})]);
this.hostViewRef = this.viewManager.createRootHostView(this.protoView, '#' + this.id, childInjector);
var renderer = this.hostViewRef.render;
var hostElement = this.viewManager.getHostElement(this.hostViewRef);
this.changeDetector = this.hostViewRef.changeDetectorRef;
this.component = this.viewManager.getComponent(hostElement);
this.contentInserctionPoint = renderer.rootContentInsertionPoints[0];
};
DowngradeNg2ComponentAdapter.prototype.setupInputs = function() {
var _this = this;
var attrs = this.attrs;
var inputs = this.info.inputs;
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
var expr = null;
if (attrs.hasOwnProperty(input.attr)) {
var observeFn = (function(prop) {
var prevValue = INITIAL_VALUE;
return function(value) {
if (_this.inputChanges !== null) {
_this.inputChangeCount++;
_this.inputChanges[prop] = new Ng1Change(value, prevValue === INITIAL_VALUE ? value : prevValue);
prevValue = value;
}
_this.component[prop] = value;
};
})(input.prop);
attrs.$observe(input.attr, observeFn);
} else if (attrs.hasOwnProperty(input.bindAttr)) {
expr = attrs[input.bindAttr];
} else if (attrs.hasOwnProperty(input.bracketAttr)) {
expr = attrs[input.bracketAttr];
} else if (attrs.hasOwnProperty(input.bindonAttr)) {
expr = attrs[input.bindonAttr];
} else if (attrs.hasOwnProperty(input.bracketParenAttr)) {
expr = attrs[input.bracketParenAttr];
}
if (expr != null) {
var watchFn = (function(prop) {
return function(value, prevValue) {
if (_this.inputChanges != null) {
_this.inputChangeCount++;
_this.inputChanges[prop] = new Ng1Change(prevValue, value);
}
_this.component[prop] = value;
};
})(input.prop);
this.componentScope.$watch(expr, watchFn);
}
}
var prototype = this.info.type.prototype;
if (prototype && prototype.ngOnChanges) {
this.inputChanges = {};
this.componentScope.$watch(function() {
return _this.inputChangeCount;
}, function() {
var inputChanges = _this.inputChanges;
_this.inputChanges = {};
_this.component.ngOnChanges(inputChanges);
});
}
this.componentScope.$watch(function() {
return _this.changeDetector && _this.changeDetector.detectChanges();
});
};
DowngradeNg2ComponentAdapter.prototype.projectContent = function() {
var childNodes = this.childNodes;
if (this.contentInserctionPoint) {
var parent = this.contentInserctionPoint.parentNode;
for (var i = 0,
ii = childNodes.length; i < ii; i++) {
parent.insertBefore(childNodes[i], this.contentInserctionPoint);
}
}
};
DowngradeNg2ComponentAdapter.prototype.setupOutputs = function() {
var _this = this;
var attrs = this.attrs;
var outputs = this.info.outputs;
for (var j = 0; j < outputs.length; j++) {
var output = outputs[j];
var expr = null;
var assignExpr = false;
var bindonAttr = output.bindonAttr ? output.bindonAttr.substring(0, output.bindonAttr.length - 6) : null;
var bracketParenAttr = output.bracketParenAttr ? "[(" + output.bracketParenAttr.substring(2, output.bracketParenAttr.length - 8) + ")]" : null;
if (attrs.hasOwnProperty(output.onAttr)) {
expr = attrs[output.onAttr];
} else if (attrs.hasOwnProperty(output.parenAttr)) {
expr = attrs[output.parenAttr];
} else if (attrs.hasOwnProperty(bindonAttr)) {
expr = attrs[bindonAttr];
assignExpr = true;
} else if (attrs.hasOwnProperty(bracketParenAttr)) {
expr = attrs[bracketParenAttr];
assignExpr = true;
}
if (expr != null && assignExpr != null) {
var getter = this.parse(expr);
var setter = getter.assign;
if (assignExpr && !setter) {
throw new Error("Expression '" + expr + "' is not assignable!");
}
var emitter = this.component[output.prop];
if (emitter) {
emitter.subscribe({next: assignExpr ? (function(setter) {
return function(value) {
return setter(_this.scope, value);
};
})(setter) : (function(getter) {
return function(value) {
return getter(_this.scope, {$event: value});
};
})(getter)});
} else {
throw new Error("Missing emitter '" + output.prop + "' on component '" + this.info.selector + "'!");
}
}
}
};
DowngradeNg2ComponentAdapter.prototype.registerCleanup = function() {
var _this = this;
this.element.bind('$remove', function() {
return _this.viewManager.destroyRootHostView(_this.hostViewRef);
});
};
return DowngradeNg2ComponentAdapter;
})();
exports.DowngradeNg2ComponentAdapter = DowngradeNg2ComponentAdapter;
var Ng1Change = (function() {
function Ng1Change(previousValue, currentValue) {
this.previousValue = previousValue;
this.currentValue = currentValue;
}
Ng1Change.prototype.isFirstChange = function() {
return this.previousValue === this.currentValue;
};
return Ng1Change;
})();
global.define = __define;
return module.exports;
});
System.register("angular2/src/upgrade/angular_js", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
function noNg() {
throw new Error('AngularJS v1.x is not loaded!');
}
var angular = {
bootstrap: noNg,
module: noNg,
element: noNg,
version: noNg
};
try {
if (window.hasOwnProperty('angular')) {
angular = window.angular;
}
} catch (e) {}
exports.bootstrap = angular.bootstrap;
exports.module = angular.module;
exports.element = angular.element;
exports.version = angular.version;
global.define = __define;
return module.exports;
});
System.register("angular2/src/upgrade/upgrade_ng1_adapter", ["angular2/core", "angular2/src/upgrade/constants", "angular2/src/upgrade/util", "angular2/src/upgrade/angular_js"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var core_1 = require("angular2/core");
var constants_1 = require("angular2/src/upgrade/constants");
var util_1 = require("angular2/src/upgrade/util");
var angular = require("angular2/src/upgrade/angular_js");
var CAMEL_CASE = /([A-Z])/g;
var INITIAL_VALUE = {__UNINITIALIZED__: true};
var NOT_SUPPORTED = 'NOT_SUPPORTED';
var UpgradeNg1ComponentAdapterBuilder = (function() {
function UpgradeNg1ComponentAdapterBuilder(name) {
this.name = name;
this.inputs = [];
this.inputsRename = [];
this.outputs = [];
this.outputsRename = [];
this.propertyOutputs = [];
this.checkProperties = [];
this.propertyMap = {};
this.linkFn = null;
this.directive = null;
this.$controller = null;
var selector = name.replace(CAMEL_CASE, function(all, next) {
return '-' + next.toLowerCase();
});
var self = this;
this.type = core_1.Directive({
selector: selector,
inputs: this.inputsRename,
outputs: this.outputsRename
}).Class({
constructor: [new core_1.Inject(constants_1.NG1_SCOPE), core_1.ElementRef, function(scope, elementRef) {
return new UpgradeNg1ComponentAdapter(self.linkFn, scope, self.directive, elementRef, self.$controller, self.inputs, self.outputs, self.propertyOutputs, self.checkProperties, self.propertyMap);
}],
ngOnChanges: function() {},
ngDoCheck: function() {}
});
}
UpgradeNg1ComponentAdapterBuilder.prototype.extractDirective = function(injector) {
var directives = injector.get(this.name + 'Directive');
if (directives.length > 1) {
throw new Error('Only support single directive definition for: ' + this.name);
}
var directive = directives[0];
if (directive.replace)
this.notSupported('replace');
if (directive.terminal)
this.notSupported('terminal');
var link = directive.link;
if (typeof link == 'object') {
if (link.post)
this.notSupported('link.post');
}
return directive;
};
UpgradeNg1ComponentAdapterBuilder.prototype.notSupported = function(feature) {
throw new Error("Upgraded directive '" + this.name + "' does not support '" + feature + "'.");
};
UpgradeNg1ComponentAdapterBuilder.prototype.extractBindings = function() {
var scope = this.directive.scope;
if (typeof scope == 'object') {
for (var name in scope) {
if (scope.hasOwnProperty(name)) {
var localName = scope[name];
var type = localName.charAt(0);
localName = localName.substr(1) || name;
var outputName = 'output_' + name;
var outputNameRename = outputName + ': ' + name;
var outputNameRenameChange = outputName + ': ' + name + 'Change';
var inputName = 'input_' + name;
var inputNameRename = inputName + ': ' + name;
switch (type) {
case '=':
this.propertyOutputs.push(outputName);
this.checkProperties.push(localName);
this.outputs.push(outputName);
this.outputsRename.push(outputNameRenameChange);
this.propertyMap[outputName] = localName;
case '@':
this.inputs.push(inputName);
this.inputsRename.push(inputNameRename);
this.propertyMap[inputName] = localName;
break;
case '&':
this.outputs.push(outputName);
this.outputsRename.push(outputNameRename);
this.propertyMap[outputName] = localName;
break;
default:
var json = JSON.stringify(scope);
throw new Error("Unexpected mapping '" + type + "' in '" + json + "' in '" + this.name + "' directive.");
}
}
}
}
};
UpgradeNg1ComponentAdapterBuilder.prototype.compileTemplate = function(compile, templateCache, httpBackend) {
var _this = this;
if (this.directive.template !== undefined) {
this.linkFn = compileHtml(this.directive.template);
} else if (this.directive.templateUrl) {
var url = this.directive.templateUrl;
var html = templateCache.get(url);
if (html !== undefined) {
this.linkFn = compileHtml(html);
} else {
return new Promise(function(resolve, err) {
httpBackend('GET', url, null, function(status, response) {
if (status == 200) {
resolve(_this.linkFn = compileHtml(templateCache.put(url, response)));
} else {
err("GET " + url + " returned " + status + ": " + response);
}
});
});
}
} else {
throw new Error("Directive '" + this.name + "' is not a component, it is missing template.");
}
return null;
function compileHtml(html) {
var div = document.createElement('div');
div.innerHTML = html;
return compile(div.childNodes);
}
};
UpgradeNg1ComponentAdapterBuilder.resolve = function(exportedComponents, injector) {
var promises = [];
var compile = injector.get(constants_1.NG1_COMPILE);
var templateCache = injector.get(constants_1.NG1_TEMPLATE_CACHE);
var httpBackend = injector.get(constants_1.NG1_HTTP_BACKEND);
var $controller = injector.get(constants_1.NG1_CONTROLLER);
for (var name in exportedComponents) {
if (exportedComponents.hasOwnProperty(name)) {
var exportedComponent = exportedComponents[name];
exportedComponent.directive = exportedComponent.extractDirective(injector);
exportedComponent.$controller = $controller;
exportedComponent.extractBindings();
var promise = exportedComponent.compileTemplate(compile, templateCache, httpBackend);
if (promise)
promises.push(promise);
}
}
return Promise.all(promises);
};
return UpgradeNg1ComponentAdapterBuilder;
})();
exports.UpgradeNg1ComponentAdapterBuilder = UpgradeNg1ComponentAdapterBuilder;
var UpgradeNg1ComponentAdapter = (function() {
function UpgradeNg1ComponentAdapter(linkFn, scope, directive, elementRef, $controller, inputs, outputs, propOuts, checkProperties, propertyMap) {
this.directive = directive;
this.inputs = inputs;
this.outputs = outputs;
this.propOuts = propOuts;
this.checkProperties = checkProperties;
this.propertyMap = propertyMap;
this.destinationObj = null;
this.checkLastValues = [];
var element = elementRef.nativeElement;
var childNodes = [];
var childNode;
while (childNode = element.firstChild) {
element.removeChild(childNode);
childNodes.push(childNode);
}
var componentScope = scope.$new(!!directive.scope);
var $element = angular.element(element);
var controllerType = directive.controller;
var controller = null;
if (controllerType) {
var locals = {
$scope: componentScope,
$element: $element
};
controller = $controller(controllerType, locals, null, directive.controllerAs);
$element.data(util_1.controllerKey(directive.name), controller);
}
var link = directive.link;
if (typeof link == 'object')
link = link.pre;
if (link) {
var attrs = NOT_SUPPORTED;
var transcludeFn = NOT_SUPPORTED;
var linkController = this.resolveRequired($element, directive.require);
directive.link(componentScope, $element, attrs, linkController, transcludeFn);
}
this.destinationObj = directive.bindToController && controller ? controller : componentScope;
linkFn(componentScope, function(clonedElement, scope) {
for (var i = 0,
ii = clonedElement.length; i < ii; i++) {
element.appendChild(clonedElement[i]);
}
}, {parentBoundTranscludeFn: function(scope, cloneAttach) {
cloneAttach(childNodes);
}});
for (var i = 0; i < inputs.length; i++) {
this[inputs[i]] = null;
}
for (var j = 0; j < outputs.length; j++) {
var emitter = this[outputs[j]] = new core_1.EventEmitter();
this.setComponentProperty(outputs[j], (function(emitter) {
return function(value) {
return emitter.emit(value);
};
})(emitter));
}
for (var k = 0; k < propOuts.length; k++) {
this[propOuts[k]] = new core_1.EventEmitter();
this.checkLastValues.push(INITIAL_VALUE);
}
}
UpgradeNg1ComponentAdapter.prototype.ngOnChanges = function(changes) {
for (var name in changes) {
if (changes.hasOwnProperty(name)) {
var change = changes[name];
this.setComponentProperty(name, change.currentValue);
}
}
};
UpgradeNg1ComponentAdapter.prototype.ngDoCheck = function() {
var count = 0;
var destinationObj = this.destinationObj;
var lastValues = this.checkLastValues;
var checkProperties = this.checkProperties;
for (var i = 0; i < checkProperties.length; i++) {
var value = destinationObj[checkProperties[i]];
var last = lastValues[i];
if (value !== last) {
if (typeof value == 'number' && isNaN(value) && typeof last == 'number' && isNaN(last)) {} else {
var eventEmitter = this[this.propOuts[i]];
eventEmitter.emit(lastValues[i] = value);
}
}
}
return count;
};
UpgradeNg1ComponentAdapter.prototype.setComponentProperty = function(name, value) {
this.destinationObj[this.propertyMap[name]] = value;
};
UpgradeNg1ComponentAdapter.prototype.resolveRequired = function($element, require) {
if (!require) {
return undefined;
} else if (typeof require == 'string') {
var name = require;
var isOptional = false;
var startParent = false;
var searchParents = false;
var ch;
if (name.charAt(0) == '?') {
isOptional = true;
name = name.substr(1);
}
if (name.charAt(0) == '^') {
searchParents = true;
name = name.substr(1);
}
if (name.charAt(0) == '^') {
startParent = true;
name = name.substr(1);
}
var key = util_1.controllerKey(name);
if (startParent)
$element = $element.parent();
var dep = searchParents ? $element.inheritedData(key) : $element.data(key);
if (!dep && !isOptional) {
throw new Error("Can not locate '" + require + "' in '" + this.directive.name + "'.");
}
return dep;
} else if (require instanceof Array) {
var deps = [];
for (var i = 0; i < require.length; i++) {
deps.push(this.resolveRequired($element, require[i]));
}
return deps;
}
throw new Error("Directive '" + this.directive.name + "' require syntax unrecognized: " + this.directive.require);
};
return UpgradeNg1ComponentAdapter;
})();
global.define = __define;
return module.exports;
});
System.register("angular2/src/upgrade/upgrade_adapter", ["angular2/core", "angular2/src/facade/async", "angular2/platform/browser", "angular2/src/upgrade/metadata", "angular2/src/upgrade/util", "angular2/src/upgrade/constants", "angular2/src/upgrade/downgrade_ng2_adapter", "angular2/src/upgrade/upgrade_ng1_adapter", "angular2/src/upgrade/angular_js"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var core_1 = require("angular2/core");
var async_1 = require("angular2/src/facade/async");
var browser_1 = require("angular2/platform/browser");
var metadata_1 = require("angular2/src/upgrade/metadata");
var util_1 = require("angular2/src/upgrade/util");
var constants_1 = require("angular2/src/upgrade/constants");
var downgrade_ng2_adapter_1 = require("angular2/src/upgrade/downgrade_ng2_adapter");
var upgrade_ng1_adapter_1 = require("angular2/src/upgrade/upgrade_ng1_adapter");
var angular = require("angular2/src/upgrade/angular_js");
var upgradeCount = 0;
var UpgradeAdapter = (function() {
function UpgradeAdapter() {
this.idPrefix = "NG2_UPGRADE_" + upgradeCount++ + "_";
this.upgradedComponents = [];
this.downgradedComponents = {};
this.providers = [];
}
UpgradeAdapter.prototype.downgradeNg2Component = function(type) {
this.upgradedComponents.push(type);
var info = metadata_1.getComponentInfo(type);
return ng1ComponentDirective(info, "" + this.idPrefix + info.selector + "_c");
};
UpgradeAdapter.prototype.upgradeNg1Component = function(name) {
if (this.downgradedComponents.hasOwnProperty(name)) {
return this.downgradedComponents[name].type;
} else {
return (this.downgradedComponents[name] = new upgrade_ng1_adapter_1.UpgradeNg1ComponentAdapterBuilder(name)).type;
}
};
UpgradeAdapter.prototype.bootstrap = function(element, modules, config) {
var _this = this;
var upgrade = new UpgradeAdapterRef();
var ng1Injector = null;
var platformRef = core_1.platform(browser_1.BROWSER_PROVIDERS);
var applicationRef = platformRef.application([browser_1.BROWSER_APP_PROVIDERS, core_1.provide(constants_1.NG1_INJECTOR, {useFactory: function() {
return ng1Injector;
}}), core_1.provide(constants_1.NG1_COMPILE, {useFactory: function() {
return ng1Injector.get(constants_1.NG1_COMPILE);
}}), this.providers]);
var injector = applicationRef.injector;
var ngZone = injector.get(core_1.NgZone);
var compiler = injector.get(core_1.Compiler);
var delayApplyExps = [];
var original$applyFn;
var rootScopePrototype;
var rootScope;
var protoViewRefMap = {};
var ng1Module = angular.module(this.idPrefix, modules);
var ng1compilePromise = null;
ng1Module.value(constants_1.NG2_INJECTOR, injector).value(constants_1.NG2_ZONE, ngZone).value(constants_1.NG2_COMPILER, compiler).value(constants_1.NG2_PROTO_VIEW_REF_MAP, protoViewRefMap).value(constants_1.NG2_APP_VIEW_MANAGER, injector.get(core_1.AppViewManager)).config(['$provide', function(provide) {
provide.decorator(constants_1.NG1_ROOT_SCOPE, ['$delegate', function(rootScopeDelegate) {
rootScopePrototype = rootScopeDelegate.constructor.prototype;
if (rootScopePrototype.hasOwnProperty('$apply')) {
original$applyFn = rootScopePrototype.$apply;
rootScopePrototype.$apply = function(exp) {
return delayApplyExps.push(exp);
};
} else {
throw new Error("Failed to find '$apply' on '$rootScope'!");
}
return rootScope = rootScopeDelegate;
}]);
}]).run(['$injector', '$rootScope', function(injector, rootScope) {
ng1Injector = injector;
async_1.ObservableWrapper.subscribe(ngZone.onTurnDone, function(_) {
ngZone.run(function() {
return rootScope.$apply();
});
});
ng1compilePromise = upgrade_ng1_adapter_1.UpgradeNg1ComponentAdapterBuilder.resolve(_this.downgradedComponents, injector);
}]);
angular.element(element).data(util_1.controllerKey(constants_1.NG2_INJECTOR), injector);
ngZone.run(function() {
angular.bootstrap(element, [_this.idPrefix], config);
});
Promise.all([this.compileNg2Components(compiler, protoViewRefMap), ng1compilePromise]).then(function() {
ngZone.run(function() {
if (rootScopePrototype) {
rootScopePrototype.$apply = original$applyFn;
while (delayApplyExps.length) {
rootScope.$apply(delayApplyExps.shift());
}
upgrade._bootstrapDone(applicationRef, ng1Injector);
rootScopePrototype = null;
}
});
}, util_1.onError);
return upgrade;
};
UpgradeAdapter.prototype.addProvider = function(provider) {
this.providers.push(provider);
};
UpgradeAdapter.prototype.upgradeNg1Provider = function(name, options) {
var token = options && options.asToken || name;
this.providers.push(core_1.provide(token, {
useFactory: function(ng1Injector) {
return ng1Injector.get(name);
},
deps: [constants_1.NG1_INJECTOR]
}));
};
UpgradeAdapter.prototype.downgradeNg2Provider = function(token) {
var factory = function(injector) {
return injector.get(token);
};
factory.$inject = [constants_1.NG2_INJECTOR];
return factory;
};
UpgradeAdapter.prototype.compileNg2Components = function(compiler, protoViewRefMap) {
var _this = this;
var promises = [];
var types = this.upgradedComponents;
for (var i = 0; i < types.length; i++) {
promises.push(compiler.compileInHost(types[i]));
}
return Promise.all(promises).then(function(protoViews) {
var types = _this.upgradedComponents;
for (var i = 0; i < protoViews.length; i++) {
protoViewRefMap[metadata_1.getComponentInfo(types[i]).selector] = protoViews[i];
}
return protoViewRefMap;
}, util_1.onError);
};
return UpgradeAdapter;
})();
exports.UpgradeAdapter = UpgradeAdapter;
function ng1ComponentDirective(info, idPrefix) {
directiveFactory.$inject = [constants_1.NG2_PROTO_VIEW_REF_MAP, constants_1.NG2_APP_VIEW_MANAGER, constants_1.NG1_PARSE];
function directiveFactory(protoViewRefMap, viewManager, parse) {
var protoView = protoViewRefMap[info.selector];
if (!protoView)
throw new Error('Expecting ProtoViewRef for: ' + info.selector);
var idCount = 0;
return {
restrict: 'E',
require: constants_1.REQUIRE_INJECTOR,
link: {post: function(scope, element, attrs, parentInjector, transclude) {
var domElement = element[0];
var facade = new downgrade_ng2_adapter_1.DowngradeNg2ComponentAdapter(idPrefix + (idCount++), info, element, attrs, scope, parentInjector, parse, viewManager, protoView);
facade.setupInputs();
facade.bootstrapNg2();
facade.projectContent();
facade.setupOutputs();
facade.registerCleanup();
}}
};
}
return directiveFactory;
}
var UpgradeAdapterRef = (function() {
function UpgradeAdapterRef() {
this._readyFn = null;
this.ng1RootScope = null;
this.ng1Injector = null;
this.ng2ApplicationRef = null;
this.ng2Injector = null;
}
UpgradeAdapterRef.prototype._bootstrapDone = function(applicationRef, ng1Injector) {
this.ng2ApplicationRef = applicationRef;
this.ng2Injector = applicationRef.injector;
this.ng1Injector = ng1Injector;
this.ng1RootScope = ng1Injector.get(constants_1.NG1_ROOT_SCOPE);
this._readyFn && this._readyFn(this);
};
UpgradeAdapterRef.prototype.ready = function(fn) {
this._readyFn = fn;
};
UpgradeAdapterRef.prototype.dispose = function() {
this.ng1Injector.get(constants_1.NG1_ROOT_SCOPE).$destroy();
this.ng2ApplicationRef.dispose();
};
return UpgradeAdapterRef;
})();
exports.UpgradeAdapterRef = UpgradeAdapterRef;
global.define = __define;
return module.exports;
});
System.register("angular2/upgrade", ["angular2/src/upgrade/upgrade_adapter"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var upgrade_adapter_1 = require("angular2/src/upgrade/upgrade_adapter");
exports.UpgradeAdapter = upgrade_adapter_1.UpgradeAdapter;
exports.UpgradeAdapterRef = upgrade_adapter_1.UpgradeAdapterRef;
global.define = __define;
return module.exports;
});
//# sourceMappingURLDisabled=upgrade.js.map

View File

@ -1,4 +1,3 @@
/* */
"format register";
System.register("angular2/src/facade/lang", [], true, function(require, exports, module) {
var global = System.global,
@ -34,19 +33,19 @@ System.register("angular2/src/facade/lang", [], true, function(require, exports,
exports.getTypeNameForDebugging = getTypeNameForDebugging;
exports.Math = _global.Math;
exports.Date = _global.Date;
var _devMode = !!_global.angularDevMode;
var _devModeLocked = false;
function lockDevMode() {
_devModeLocked = true;
var _devMode = true;
var _modeLocked = false;
function lockMode() {
_modeLocked = true;
}
exports.lockDevMode = lockDevMode;
function enableDevMode() {
if (_devModeLocked) {
throw 'Cannot enable dev mode after platform setup.';
exports.lockMode = lockMode;
function enableProdMode() {
if (_modeLocked) {
throw 'Cannot enable prod mode after platform setup.';
}
_devMode = true;
_devMode = false;
}
exports.enableDevMode = enableDevMode;
exports.enableProdMode = enableProdMode;
function assertionsEnabled() {
return _devMode;
}
@ -6972,6 +6971,41 @@ System.register("angular2/src/core/linker/template_commands", ["angular2/src/fac
return module.exports;
});
System.register("angular2/src/core/console", ["angular2/src/core/di", "angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
var di_1 = require("angular2/src/core/di");
var lang_1 = require("angular2/src/facade/lang");
var Console = (function() {
function Console() {}
Console.prototype.log = function(message) {
lang_1.print(message);
};
Console = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], Console);
return Console;
})();
exports.Console = Console;
global.define = __define;
return module.exports;
});
System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
@ -7009,12 +7043,12 @@ System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"],
return module.exports;
});
System.register("angular2/src/core/dev_mode", ["angular2/src/facade/lang"], true, function(require, exports, module) {
System.register("angular2/src/core/prod_mode", ["angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var lang_1 = require("angular2/src/facade/lang");
exports.enableDevMode = lang_1.enableDevMode;
exports.enableProdMode = lang_1.enableProdMode;
global.define = __define;
return module.exports;
});
@ -7289,12 +7323,13 @@ System.register("angular2/src/core/debug/debug_element", ["angular2/src/facade/l
return module.exports;
});
System.register("angular2/src/core/platform_common_providers", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability"], true, function(require, exports, module) {
System.register("angular2/src/core/platform_common_providers", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/console", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var lang_1 = require("angular2/src/facade/lang");
var di_1 = require("angular2/src/core/di");
var console_1 = require("angular2/src/core/console");
var reflection_1 = require("angular2/src/core/reflection/reflection");
var testability_1 = require("angular2/src/core/testability/testability");
function _reflector() {
@ -7303,7 +7338,7 @@ System.register("angular2/src/core/platform_common_providers", ["angular2/src/fa
exports.PLATFORM_COMMON_PROVIDERS = lang_1.CONST_EXPR([new di_1.Provider(reflection_1.Reflector, {
useFactory: _reflector,
deps: []
}), testability_1.TestabilityRegistry]);
}), testability_1.TestabilityRegistry, console_1.Console]);
global.define = __define;
return module.exports;
});
@ -13409,7 +13444,7 @@ System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di",
return module.exports;
});
System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/dev_mode", "angular2/src/core/di", "angular2/src/facade/facade", "angular2/src/core/application_ref", "angular2/src/core/application_tokens", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/linker", "angular2/src/core/debug/debug_element", "angular2/src/core/testability/testability", "angular2/src/core/change_detection", "angular2/src/core/platform_directives_and_pipes", "angular2/src/core/platform_common_providers", "angular2/src/core/application_common_providers", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) {
System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/prod_mode", "angular2/src/core/di", "angular2/src/facade/facade", "angular2/src/facade/lang", "angular2/src/core/application_ref", "angular2/src/core/application_tokens", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/linker", "angular2/src/core/debug/debug_element", "angular2/src/core/testability/testability", "angular2/src/core/change_detection", "angular2/src/core/platform_directives_and_pipes", "angular2/src/core/platform_common_providers", "angular2/src/core/application_common_providers", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@ -13420,9 +13455,11 @@ System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/co
}
__export(require("angular2/src/core/metadata"));
__export(require("angular2/src/core/util"));
__export(require("angular2/src/core/dev_mode"));
__export(require("angular2/src/core/prod_mode"));
__export(require("angular2/src/core/di"));
__export(require("angular2/src/facade/facade"));
var lang_1 = require("angular2/src/facade/lang");
exports.enableProdMode = lang_1.enableProdMode;
var application_ref_1 = require("angular2/src/core/application_ref");
exports.platform = application_ref_1.platform;
exports.createNgZone = application_ref_1.createNgZone;
@ -23442,7 +23479,7 @@ System.register("angular2/src/platform/worker_render_common", ["angular2/src/fac
return module.exports;
});
System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/testability/testability", "angular2/src/core/linker/dynamic_component_loader", "angular2/src/facade/exceptions", "angular2/src/core/linker/view_ref", "angular2/src/core/profile/profile", "angular2/src/facade/lang"], true, function(require, exports, module) {
System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/testability/testability", "angular2/src/core/linker/dynamic_component_loader", "angular2/src/facade/exceptions", "angular2/src/core/linker/view_ref", "angular2/src/core/console", "angular2/src/core/profile/profile", "angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@ -23465,6 +23502,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
var dynamic_component_loader_1 = require("angular2/src/core/linker/dynamic_component_loader");
var exceptions_1 = require("angular2/src/facade/exceptions");
var view_ref_1 = require("angular2/src/core/linker/view_ref");
var console_1 = require("angular2/src/core/console");
var profile_1 = require("angular2/src/core/profile/profile");
var lang_2 = require("angular2/src/facade/lang");
function _componentProviders(appComponentType) {
@ -23498,7 +23536,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
var _platform;
var _platformProviders;
function platform(providers) {
lang_2.lockDevMode();
lang_2.lockMode();
if (lang_1.isPresent(_platform)) {
if (collection_1.ListWrapper.equals(_platformProviders, providers)) {
return _platform;
@ -23731,7 +23769,12 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
completer.reject(e, e.stack);
}
});
return completer.promise;
return completer.promise.then(function(_) {
var c = _this._injector.get(console_1.Console);
var modeDescription = lang_1.assertionsEnabled() ? "in the development mode. Call enableProdMode() to enable the production mode." : "in the production mode. Call enableDevMode() to enable the development mode.";
c.log("Angular 2 is running " + modeDescription);
return _;
});
};
ApplicationRef_.prototype._loadComponent = function(ref) {
var appChangeDetector = view_ref_1.internalView(ref.hostView).changeDetector;

View File

@ -1,4 +1,3 @@
/* */
"format register";
System.register("angular2/src/facade/lang", [], true, function(require, exports, module) {
var global = System.global,
@ -34,19 +33,19 @@ System.register("angular2/src/facade/lang", [], true, function(require, exports,
exports.getTypeNameForDebugging = getTypeNameForDebugging;
exports.Math = _global.Math;
exports.Date = _global.Date;
var _devMode = !!_global.angularDevMode;
var _devModeLocked = false;
function lockDevMode() {
_devModeLocked = true;
var _devMode = true;
var _modeLocked = false;
function lockMode() {
_modeLocked = true;
}
exports.lockDevMode = lockDevMode;
function enableDevMode() {
if (_devModeLocked) {
throw 'Cannot enable dev mode after platform setup.';
exports.lockMode = lockMode;
function enableProdMode() {
if (_modeLocked) {
throw 'Cannot enable prod mode after platform setup.';
}
_devMode = true;
_devMode = false;
}
exports.enableDevMode = enableDevMode;
exports.enableProdMode = enableProdMode;
function assertionsEnabled() {
return _devMode;
}
@ -5552,12 +5551,12 @@ System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"],
return module.exports;
});
System.register("angular2/src/core/dev_mode", ["angular2/src/facade/lang"], true, function(require, exports, module) {
System.register("angular2/src/core/prod_mode", ["angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var lang_1 = require("angular2/src/facade/lang");
exports.enableDevMode = lang_1.enableDevMode;
exports.enableProdMode = lang_1.enableProdMode;
global.define = __define;
return module.exports;
});
@ -7332,6 +7331,41 @@ System.register("angular2/src/core/linker/template_commands", ["angular2/src/fac
return module.exports;
});
System.register("angular2/src/core/console", ["angular2/src/core/di", "angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
var di_1 = require("angular2/src/core/di");
var lang_1 = require("angular2/src/facade/lang");
var Console = (function() {
function Console() {}
Console.prototype.log = function(message) {
lang_1.print(message);
};
Console = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], Console);
return Console;
})();
exports.Console = Console;
global.define = __define;
return module.exports;
});
System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
@ -7613,12 +7647,13 @@ System.register("angular2/src/core/debug/debug_element", ["angular2/src/facade/l
return module.exports;
});
System.register("angular2/src/core/platform_common_providers", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability"], true, function(require, exports, module) {
System.register("angular2/src/core/platform_common_providers", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/console", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var lang_1 = require("angular2/src/facade/lang");
var di_1 = require("angular2/src/core/di");
var console_1 = require("angular2/src/core/console");
var reflection_1 = require("angular2/src/core/reflection/reflection");
var testability_1 = require("angular2/src/core/testability/testability");
function _reflector() {
@ -7627,7 +7662,7 @@ System.register("angular2/src/core/platform_common_providers", ["angular2/src/fa
exports.PLATFORM_COMMON_PROVIDERS = lang_1.CONST_EXPR([new di_1.Provider(reflection_1.Reflector, {
useFactory: _reflector,
deps: []
}), testability_1.TestabilityRegistry]);
}), testability_1.TestabilityRegistry, console_1.Console]);
global.define = __define;
return module.exports;
});
@ -35820,7 +35855,7 @@ System.register("angular2/src/core/metadata/directives", ["angular2/src/facade/l
return module.exports;
});
System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/testability/testability", "angular2/src/core/linker/dynamic_component_loader", "angular2/src/facade/exceptions", "angular2/src/core/linker/view_ref", "angular2/src/core/profile/profile", "angular2/src/facade/lang"], true, function(require, exports, module) {
System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/testability/testability", "angular2/src/core/linker/dynamic_component_loader", "angular2/src/facade/exceptions", "angular2/src/core/linker/view_ref", "angular2/src/core/console", "angular2/src/core/profile/profile", "angular2/src/facade/lang"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@ -35843,6 +35878,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
var dynamic_component_loader_1 = require("angular2/src/core/linker/dynamic_component_loader");
var exceptions_1 = require("angular2/src/facade/exceptions");
var view_ref_1 = require("angular2/src/core/linker/view_ref");
var console_1 = require("angular2/src/core/console");
var profile_1 = require("angular2/src/core/profile/profile");
var lang_2 = require("angular2/src/facade/lang");
function _componentProviders(appComponentType) {
@ -35876,7 +35912,7 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
var _platform;
var _platformProviders;
function platform(providers) {
lang_2.lockDevMode();
lang_2.lockMode();
if (lang_1.isPresent(_platform)) {
if (collection_1.ListWrapper.equals(_platformProviders, providers)) {
return _platform;
@ -36109,7 +36145,12 @@ System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng
completer.reject(e, e.stack);
}
});
return completer.promise;
return completer.promise.then(function(_) {
var c = _this._injector.get(console_1.Console);
var modeDescription = lang_1.assertionsEnabled() ? "in the development mode. Call enableProdMode() to enable the production mode." : "in the production mode. Call enableDevMode() to enable the development mode.";
c.log("Angular 2 is running " + modeDescription);
return _;
});
};
ApplicationRef_.prototype._loadComponent = function(ref) {
var appChangeDetector = view_ref_1.internalView(ref.hostView).changeDetector;
@ -36349,7 +36390,7 @@ System.register("angular2/platform/worker_app", ["angular2/src/platform/worker_a
return module.exports;
});
System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/dev_mode", "angular2/src/core/di", "angular2/src/facade/facade", "angular2/src/core/application_ref", "angular2/src/core/application_tokens", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/linker", "angular2/src/core/debug/debug_element", "angular2/src/core/testability/testability", "angular2/src/core/change_detection", "angular2/src/core/platform_directives_and_pipes", "angular2/src/core/platform_common_providers", "angular2/src/core/application_common_providers", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) {
System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/prod_mode", "angular2/src/core/di", "angular2/src/facade/facade", "angular2/src/facade/lang", "angular2/src/core/application_ref", "angular2/src/core/application_tokens", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/linker", "angular2/src/core/debug/debug_element", "angular2/src/core/testability/testability", "angular2/src/core/change_detection", "angular2/src/core/platform_directives_and_pipes", "angular2/src/core/platform_common_providers", "angular2/src/core/application_common_providers", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@ -36360,9 +36401,11 @@ System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/co
}
__export(require("angular2/src/core/metadata"));
__export(require("angular2/src/core/util"));
__export(require("angular2/src/core/dev_mode"));
__export(require("angular2/src/core/prod_mode"));
__export(require("angular2/src/core/di"));
__export(require("angular2/src/facade/facade"));
var lang_1 = require("angular2/src/facade/lang");
exports.enableProdMode = lang_1.enableProdMode;
var application_ref_1 = require("angular2/src/core/application_ref");
exports.platform = application_ref_1.platform;
exports.createNgZone = application_ref_1.createNgZone;

View File

@ -0,0 +1,967 @@
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
* @version 3.0.2
*/
(function() {
"use strict";
function lib$es6$promise$utils$$objectOrFunction(x) {
return typeof x === 'function' || (typeof x === 'object' && x !== null);
}
function lib$es6$promise$utils$$isFunction(x) {
return typeof x === 'function';
}
function lib$es6$promise$utils$$isMaybeThenable(x) {
return typeof x === 'object' && x !== null;
}
var lib$es6$promise$utils$$_isArray;
if (!Array.isArray) {
lib$es6$promise$utils$$_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
} else {
lib$es6$promise$utils$$_isArray = Array.isArray;
}
var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
var lib$es6$promise$asap$$len = 0;
var lib$es6$promise$asap$$toString = {}.toString;
var lib$es6$promise$asap$$vertxNext;
var lib$es6$promise$asap$$customSchedulerFn;
var lib$es6$promise$asap$$asap = function asap(callback, arg) {
lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
lib$es6$promise$asap$$len += 2;
if (lib$es6$promise$asap$$len === 2) {
// If len is 2, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
if (lib$es6$promise$asap$$customSchedulerFn) {
lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
} else {
lib$es6$promise$asap$$scheduleFlush();
}
}
}
function lib$es6$promise$asap$$setScheduler(scheduleFn) {
lib$es6$promise$asap$$customSchedulerFn = scheduleFn;
}
function lib$es6$promise$asap$$setAsap(asapFn) {
lib$es6$promise$asap$$asap = asapFn;
}
var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
// test for web worker but not in IE10
var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
typeof importScripts !== 'undefined' &&
typeof MessageChannel !== 'undefined';
// node
function lib$es6$promise$asap$$useNextTick() {
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
// see https://github.com/cujojs/when/issues/410 for details
return function() {
process.nextTick(lib$es6$promise$asap$$flush);
};
}
// vertx
function lib$es6$promise$asap$$useVertxTimer() {
return function() {
lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
};
}
function lib$es6$promise$asap$$useMutationObserver() {
var iterations = 0;
var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function() {
node.data = (iterations = ++iterations % 2);
};
}
// web worker
function lib$es6$promise$asap$$useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = lib$es6$promise$asap$$flush;
return function () {
channel.port2.postMessage(0);
};
}
function lib$es6$promise$asap$$useSetTimeout() {
return function() {
setTimeout(lib$es6$promise$asap$$flush, 1);
};
}
var lib$es6$promise$asap$$queue = new Array(1000);
function lib$es6$promise$asap$$flush() {
for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
var callback = lib$es6$promise$asap$$queue[i];
var arg = lib$es6$promise$asap$$queue[i+1];
callback(arg);
lib$es6$promise$asap$$queue[i] = undefined;
lib$es6$promise$asap$$queue[i+1] = undefined;
}
lib$es6$promise$asap$$len = 0;
}
function lib$es6$promise$asap$$attemptVertx() {
try {
var r = require;
var vertx = r('vertx');
lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
return lib$es6$promise$asap$$useVertxTimer();
} catch(e) {
return lib$es6$promise$asap$$useSetTimeout();
}
}
var lib$es6$promise$asap$$scheduleFlush;
// Decide what async method to use to triggering processing of queued callbacks:
if (lib$es6$promise$asap$$isNode) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
} else if (lib$es6$promise$asap$$BrowserMutationObserver) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
} else if (lib$es6$promise$asap$$isWorker) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
} else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();
} else {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
}
function lib$es6$promise$$internal$$noop() {}
var lib$es6$promise$$internal$$PENDING = void 0;
var lib$es6$promise$$internal$$FULFILLED = 1;
var lib$es6$promise$$internal$$REJECTED = 2;
var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
function lib$es6$promise$$internal$$selfFulfillment() {
return new TypeError("You cannot resolve a promise with itself");
}
function lib$es6$promise$$internal$$cannotReturnOwn() {
return new TypeError('A promises callback cannot return that same promise.');
}
function lib$es6$promise$$internal$$getThen(promise) {
try {
return promise.then;
} catch(error) {
lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
return lib$es6$promise$$internal$$GET_THEN_ERROR;
}
}
function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
try {
then.call(value, fulfillmentHandler, rejectionHandler);
} catch(e) {
return e;
}
}
function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
lib$es6$promise$asap$$asap(function(promise) {
var sealed = false;
var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
if (sealed) { return; }
sealed = true;
if (thenable !== value) {
lib$es6$promise$$internal$$resolve(promise, value);
} else {
lib$es6$promise$$internal$$fulfill(promise, value);
}
}, function(reason) {
if (sealed) { return; }
sealed = true;
lib$es6$promise$$internal$$reject(promise, reason);
}, 'Settle: ' + (promise._label || ' unknown promise'));
if (!sealed && error) {
sealed = true;
lib$es6$promise$$internal$$reject(promise, error);
}
}, promise);
}
function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
lib$es6$promise$$internal$$fulfill(promise, thenable._result);
} else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, thenable._result);
} else {
lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
lib$es6$promise$$internal$$resolve(promise, value);
}, function(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
});
}
}
function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
if (maybeThenable.constructor === promise.constructor) {
lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
} else {
var then = lib$es6$promise$$internal$$getThen(maybeThenable);
if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
} else if (then === undefined) {
lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
} else if (lib$es6$promise$utils$$isFunction(then)) {
lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
} else {
lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
}
}
}
function lib$es6$promise$$internal$$resolve(promise, value) {
if (promise === value) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());
} else if (lib$es6$promise$utils$$objectOrFunction(value)) {
lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
} else {
lib$es6$promise$$internal$$fulfill(promise, value);
}
}
function lib$es6$promise$$internal$$publishRejection(promise) {
if (promise._onerror) {
promise._onerror(promise._result);
}
lib$es6$promise$$internal$$publish(promise);
}
function lib$es6$promise$$internal$$fulfill(promise, value) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
promise._result = value;
promise._state = lib$es6$promise$$internal$$FULFILLED;
if (promise._subscribers.length !== 0) {
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
}
}
function lib$es6$promise$$internal$$reject(promise, reason) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
promise._state = lib$es6$promise$$internal$$REJECTED;
promise._result = reason;
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
}
function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
parent._onerror = null;
subscribers[length] = child;
subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
if (length === 0 && parent._state) {
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
}
}
function lib$es6$promise$$internal$$publish(promise) {
var subscribers = promise._subscribers;
var settled = promise._state;
if (subscribers.length === 0) { return; }
var child, callback, detail = promise._result;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
if (child) {
lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
} else {
callback(detail);
}
}
promise._subscribers.length = 0;
}
function lib$es6$promise$$internal$$ErrorObject() {
this.error = null;
}
var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
function lib$es6$promise$$internal$$tryCatch(callback, detail) {
try {
return callback(detail);
} catch(e) {
lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
}
}
function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
var hasCallback = lib$es6$promise$utils$$isFunction(callback),
value, error, succeeded, failed;
if (hasCallback) {
value = lib$es6$promise$$internal$$tryCatch(callback, detail);
if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
failed = true;
error = value.error;
value = null;
} else {
succeeded = true;
}
if (promise === value) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
return;
}
} else {
value = detail;
succeeded = true;
}
if (promise._state !== lib$es6$promise$$internal$$PENDING) {
// noop
} else if (hasCallback && succeeded) {
lib$es6$promise$$internal$$resolve(promise, value);
} else if (failed) {
lib$es6$promise$$internal$$reject(promise, error);
} else if (settled === lib$es6$promise$$internal$$FULFILLED) {
lib$es6$promise$$internal$$fulfill(promise, value);
} else if (settled === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, value);
}
}
function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
try {
resolver(function resolvePromise(value){
lib$es6$promise$$internal$$resolve(promise, value);
}, function rejectPromise(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
});
} catch(e) {
lib$es6$promise$$internal$$reject(promise, e);
}
}
function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
var enumerator = this;
enumerator._instanceConstructor = Constructor;
enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop);
if (enumerator._validateInput(input)) {
enumerator._input = input;
enumerator.length = input.length;
enumerator._remaining = input.length;
enumerator._init();
if (enumerator.length === 0) {
lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
} else {
enumerator.length = enumerator.length || 0;
enumerator._enumerate();
if (enumerator._remaining === 0) {
lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
}
}
} else {
lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
}
}
lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) {
return lib$es6$promise$utils$$isArray(input);
};
lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {
return new Error('Array Methods must be provided an Array');
};
lib$es6$promise$enumerator$$Enumerator.prototype._init = function() {
this._result = new Array(this.length);
};
var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
var enumerator = this;
var length = enumerator.length;
var promise = enumerator.promise;
var input = enumerator._input;
for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
enumerator._eachEntry(input[i], i);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
var enumerator = this;
var c = enumerator._instanceConstructor;
if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) {
entry._onerror = null;
enumerator._settledAt(entry._state, i, entry._result);
} else {
enumerator._willSettleAt(c.resolve(entry), i);
}
} else {
enumerator._remaining--;
enumerator._result[i] = entry;
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
var enumerator = this;
var promise = enumerator.promise;
if (promise._state === lib$es6$promise$$internal$$PENDING) {
enumerator._remaining--;
if (state === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, value);
} else {
enumerator._result[i] = value;
}
}
if (enumerator._remaining === 0) {
lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
var enumerator = this;
lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
}, function(reason) {
enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
});
};
function lib$es6$promise$promise$all$$all(entries) {
return new lib$es6$promise$enumerator$$default(this, entries).promise;
}
var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
function lib$es6$promise$promise$race$$race(entries) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(lib$es6$promise$$internal$$noop);
if (!lib$es6$promise$utils$$isArray(entries)) {
lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
return promise;
}
var length = entries.length;
function onFulfillment(value) {
lib$es6$promise$$internal$$resolve(promise, value);
}
function onRejection(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
}
for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
}
return promise;
}
var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
function lib$es6$promise$promise$resolve$$resolve(object) {
/*jshint validthis:true */
var Constructor = this;
if (object && typeof object === 'object' && object.constructor === Constructor) {
return object;
}
var promise = new Constructor(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$resolve(promise, object);
return promise;
}
var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
function lib$es6$promise$promise$reject$$reject(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$reject(promise, reason);
return promise;
}
var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
var lib$es6$promise$promise$$counter = 0;
function lib$es6$promise$promise$$needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
function lib$es6$promise$promise$$needsNew() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
/**
Promise objects represent the eventual result of an asynchronous operation. The
primary way of interacting with a promise is through its `then` method, which
registers callbacks to receive either a promise's eventual value or the reason
why the promise cannot be fulfilled.
Terminology
-----------
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- `thenable` is an object or function that defines a `then` method.
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- `exception` is a value that is thrown using the throw statement.
- `reason` is a value that indicates why a promise was rejected.
- `settled` the final resting state of a promise, fulfilled or rejected.
A promise can be in one of three states: pending, fulfilled, or rejected.
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state. Promises that are rejected have a rejection reason and are in the
rejected state. A fulfillment value is never a thenable.
Promises can also be said to *resolve* a value. If this value is also a
promise, then the original promise's settled state will match the value's
settled state. So a promise that *resolves* a promise that rejects will
itself reject, and a promise that *resolves* a promise that fulfills will
itself fulfill.
Basic Usage:
------------
```js
var promise = new Promise(function(resolve, reject) {
// on success
resolve(value);
// on failure
reject(reason);
});
promise.then(function(value) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Advanced Usage:
---------------
Promises shine when abstracting away asynchronous interactions such as
`XMLHttpRequest`s.
```js
function getJSON(url) {
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = handler;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.send();
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
}
}
};
});
}
getJSON('/posts.json').then(function(json) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Unlike callbacks, promises are great composable primitives.
```js
Promise.all([
getJSON('/posts'),
getJSON('/comments')
]).then(function(values){
values[0] // => postsJSON
values[1] // => commentsJSON
return values;
});
```
@class Promise
@param {function} resolver
Useful for tooling.
@constructor
*/
function lib$es6$promise$promise$$Promise(resolver) {
this._id = lib$es6$promise$promise$$counter++;
this._state = undefined;
this._result = undefined;
this._subscribers = [];
if (lib$es6$promise$$internal$$noop !== resolver) {
if (!lib$es6$promise$utils$$isFunction(resolver)) {
lib$es6$promise$promise$$needsResolver();
}
if (!(this instanceof lib$es6$promise$promise$$Promise)) {
lib$es6$promise$promise$$needsNew();
}
lib$es6$promise$$internal$$initializePromise(this, resolver);
}
}
lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;
lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;
lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;
lib$es6$promise$promise$$Promise.prototype = {
constructor: lib$es6$promise$promise$$Promise,
/**
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
```js
findUser().then(function(user){
// user is available
}, function(reason){
// user is unavailable, and you are given the reason why
});
```
Chaining
--------
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
```js
findUser().then(function (user) {
return user.name;
}, function (reason) {
return 'default name';
}).then(function (userName) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
throw new Error('`findUser` rejected and we're unhappy');
}).then(function (value) {
// never reached
}, function (reason) {
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
}).then(function (value) {
// never reached
}).then(function (value) {
// never reached
}, function (reason) {
// The `PedgagocialException` is propagated all the way down to here
});
```
Assimilation
------------
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// The user's comments are now available
});
```
If the assimliated promise rejects, then the downstream promise will also reject.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// If `findCommentsByAuthor` fulfills, we'll have the value here
}, function (reason) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
Simple Example
--------------
Synchronous Example
```javascript
var result;
try {
result = findResult();
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
findResult(function(result, err){
if (err) {
// failure
} else {
// success
}
});
```
Promise Example;
```javascript
findResult().then(function(result){
// success
}, function(reason){
// failure
});
```
Advanced Example
--------------
Synchronous Example
```javascript
var author, books;
try {
author = findAuthor();
books = findBooksByAuthor(author);
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
function foundBooks(books) {
}
function failure(reason) {
}
findAuthor(function(author, err){
if (err) {
failure(err);
// failure
} else {
try {
findBoooksByAuthor(author, function(books, err) {
if (err) {
failure(err);
} else {
try {
foundBooks(books);
} catch(reason) {
failure(reason);
}
}
});
} catch(error) {
failure(err);
}
// success
}
});
```
Promise Example;
```javascript
findAuthor().
then(findBooksByAuthor).
then(function(books){
// found books
}).catch(function(reason){
// something went wrong
});
```
@method then
@param {Function} onFulfilled
@param {Function} onRejected
Useful for tooling.
@return {Promise}
*/
then: function(onFulfillment, onRejection) {
var parent = this;
var state = parent._state;
if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
return this;
}
var child = new this.constructor(lib$es6$promise$$internal$$noop);
var result = parent._result;
if (state) {
var callback = arguments[state - 1];
lib$es6$promise$asap$$asap(function(){
lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
});
} else {
lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
}
return child;
},
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
```js
function findAuthor(){
throw new Error('couldn't find that author');
}
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
@method catch
@param {Function} onRejection
Useful for tooling.
@return {Promise}
*/
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};
function lib$es6$promise$polyfill$$polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof self !== 'undefined') {
local = self;
} else {
try {
local = Function('return this')();
} catch (e) {
throw new Error('polyfill failed because global object is unavailable in this environment');
}
}
var P = local.Promise;
if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
return;
}
local.Promise = lib$es6$promise$promise$$default;
}
var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
var lib$es6$promise$umd$$ES6Promise = {
'Promise': lib$es6$promise$promise$$default,
'polyfill': lib$es6$promise$polyfill$$default
};
/* global define:true module:true window: true */
if (typeof define === 'function' && define['amd']) {
define(function() { return lib$es6$promise$umd$$ES6Promise; });
} else if (typeof module !== 'undefined' && module['exports']) {
module['exports'] = lib$es6$promise$umd$$ES6Promise;
} else if (typeof this !== 'undefined') {
this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
}
lib$es6$promise$polyfill$$default();
}).call(this);

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,3 @@
/* */
"format cjs";
import Promise from './es6-promise/promise';
import polyfill from './es6-promise/polyfill';

View File

@ -1,5 +1,3 @@
/* */
"format cjs";
import {
objectOrFunction,
isFunction

View File

@ -0,0 +1,120 @@
var len = 0;
var toString = {}.toString;
var vertxNext;
var customSchedulerFn;
export var asap = function asap(callback, arg) {
queue[len] = callback;
queue[len + 1] = arg;
len += 2;
if (len === 2) {
// If len is 2, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
if (customSchedulerFn) {
customSchedulerFn(flush);
} else {
scheduleFlush();
}
}
}
export function setScheduler(scheduleFn) {
customSchedulerFn = scheduleFn;
}
export function setAsap(asapFn) {
asap = asapFn;
}
var browserWindow = (typeof window !== 'undefined') ? window : undefined;
var browserGlobal = browserWindow || {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
// test for web worker but not in IE10
var isWorker = typeof Uint8ClampedArray !== 'undefined' &&
typeof importScripts !== 'undefined' &&
typeof MessageChannel !== 'undefined';
// node
function useNextTick() {
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
// see https://github.com/cujojs/when/issues/410 for details
return function() {
process.nextTick(flush);
};
}
// vertx
function useVertxTimer() {
return function() {
vertxNext(flush);
};
}
function useMutationObserver() {
var iterations = 0;
var observer = new BrowserMutationObserver(flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function() {
node.data = (iterations = ++iterations % 2);
};
}
// web worker
function useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = flush;
return function () {
channel.port2.postMessage(0);
};
}
function useSetTimeout() {
return function() {
setTimeout(flush, 1);
};
}
var queue = new Array(1000);
function flush() {
for (var i = 0; i < len; i+=2) {
var callback = queue[i];
var arg = queue[i+1];
callback(arg);
queue[i] = undefined;
queue[i+1] = undefined;
}
len = 0;
}
function attemptVertx() {
try {
var r = require;
var vertx = r('vertx');
vertxNext = vertx.runOnLoop || vertx.runOnContext;
return useVertxTimer();
} catch(e) {
return useSetTimeout();
}
}
var scheduleFlush;
// Decide what async method to use to triggering processing of queued callbacks:
if (isNode) {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else if (isWorker) {
scheduleFlush = useMessageChannel();
} else if (browserWindow === undefined && typeof require === 'function') {
scheduleFlush = attemptVertx();
} else {
scheduleFlush = useSetTimeout();
}

View File

@ -1,5 +1,3 @@
/* */
"format cjs";
import {
isArray,
isMaybeThenable

View File

@ -0,0 +1,26 @@
/*global self*/
import Promise from './promise';
export default function polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof self !== 'undefined') {
local = self;
} else {
try {
local = Function('return this')();
} catch (e) {
throw new Error('polyfill failed because global object is unavailable in this environment');
}
}
var P = local.Promise;
if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
return;
}
local.Promise = Promise;
}

View File

@ -0,0 +1,415 @@
import {
isFunction
} from './utils';
import {
noop,
subscribe,
initializePromise,
invokeCallback,
FULFILLED,
REJECTED
} from './-internal';
import {
asap,
setAsap,
setScheduler
} from './asap';
import all from './promise/all';
import race from './promise/race';
import Resolve from './promise/resolve';
import Reject from './promise/reject';
var counter = 0;
function needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
function needsNew() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
export default Promise;
/**
Promise objects represent the eventual result of an asynchronous operation. The
primary way of interacting with a promise is through its `then` method, which
registers callbacks to receive either a promise's eventual value or the reason
why the promise cannot be fulfilled.
Terminology
-----------
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- `thenable` is an object or function that defines a `then` method.
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- `exception` is a value that is thrown using the throw statement.
- `reason` is a value that indicates why a promise was rejected.
- `settled` the final resting state of a promise, fulfilled or rejected.
A promise can be in one of three states: pending, fulfilled, or rejected.
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state. Promises that are rejected have a rejection reason and are in the
rejected state. A fulfillment value is never a thenable.
Promises can also be said to *resolve* a value. If this value is also a
promise, then the original promise's settled state will match the value's
settled state. So a promise that *resolves* a promise that rejects will
itself reject, and a promise that *resolves* a promise that fulfills will
itself fulfill.
Basic Usage:
------------
```js
var promise = new Promise(function(resolve, reject) {
// on success
resolve(value);
// on failure
reject(reason);
});
promise.then(function(value) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Advanced Usage:
---------------
Promises shine when abstracting away asynchronous interactions such as
`XMLHttpRequest`s.
```js
function getJSON(url) {
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = handler;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.send();
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
}
}
};
});
}
getJSON('/posts.json').then(function(json) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Unlike callbacks, promises are great composable primitives.
```js
Promise.all([
getJSON('/posts'),
getJSON('/comments')
]).then(function(values){
values[0] // => postsJSON
values[1] // => commentsJSON
return values;
});
```
@class Promise
@param {function} resolver
Useful for tooling.
@constructor
*/
function Promise(resolver) {
this._id = counter++;
this._state = undefined;
this._result = undefined;
this._subscribers = [];
if (noop !== resolver) {
if (!isFunction(resolver)) {
needsResolver();
}
if (!(this instanceof Promise)) {
needsNew();
}
initializePromise(this, resolver);
}
}
Promise.all = all;
Promise.race = race;
Promise.resolve = Resolve;
Promise.reject = Reject;
Promise._setScheduler = setScheduler;
Promise._setAsap = setAsap;
Promise._asap = asap;
Promise.prototype = {
constructor: Promise,
/**
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
```js
findUser().then(function(user){
// user is available
}, function(reason){
// user is unavailable, and you are given the reason why
});
```
Chaining
--------
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
```js
findUser().then(function (user) {
return user.name;
}, function (reason) {
return 'default name';
}).then(function (userName) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
throw new Error('`findUser` rejected and we're unhappy');
}).then(function (value) {
// never reached
}, function (reason) {
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
}).then(function (value) {
// never reached
}).then(function (value) {
// never reached
}, function (reason) {
// The `PedgagocialException` is propagated all the way down to here
});
```
Assimilation
------------
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// The user's comments are now available
});
```
If the assimliated promise rejects, then the downstream promise will also reject.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// If `findCommentsByAuthor` fulfills, we'll have the value here
}, function (reason) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
Simple Example
--------------
Synchronous Example
```javascript
var result;
try {
result = findResult();
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
findResult(function(result, err){
if (err) {
// failure
} else {
// success
}
});
```
Promise Example;
```javascript
findResult().then(function(result){
// success
}, function(reason){
// failure
});
```
Advanced Example
--------------
Synchronous Example
```javascript
var author, books;
try {
author = findAuthor();
books = findBooksByAuthor(author);
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
function foundBooks(books) {
}
function failure(reason) {
}
findAuthor(function(author, err){
if (err) {
failure(err);
// failure
} else {
try {
findBoooksByAuthor(author, function(books, err) {
if (err) {
failure(err);
} else {
try {
foundBooks(books);
} catch(reason) {
failure(reason);
}
}
});
} catch(error) {
failure(err);
}
// success
}
});
```
Promise Example;
```javascript
findAuthor().
then(findBooksByAuthor).
then(function(books){
// found books
}).catch(function(reason){
// something went wrong
});
```
@method then
@param {Function} onFulfilled
@param {Function} onRejected
Useful for tooling.
@return {Promise}
*/
then: function(onFulfillment, onRejection) {
var parent = this;
var state = parent._state;
if (state === FULFILLED && !onFulfillment || state === REJECTED && !onRejection) {
return this;
}
var child = new this.constructor(noop);
var result = parent._result;
if (state) {
var callback = arguments[state - 1];
asap(function(){
invokeCallback(state, child, callback, result);
});
} else {
subscribe(parent, child, onFulfillment, onRejection);
}
return child;
},
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
```js
function findAuthor(){
throw new Error('couldn't find that author');
}
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
@method catch
@param {Function} onRejection
Useful for tooling.
@return {Promise}
*/
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};

View File

@ -0,0 +1,52 @@
import Enumerator from '../enumerator';
/**
`Promise.all` accepts an array of promises, and returns a new promise which
is fulfilled with an array of fulfillment values for the passed promises, or
rejected with the reason of the first passed promise to be rejected. It casts all
elements of the passed iterable to promises as it runs this algorithm.
Example:
```javascript
var promise1 = resolve(1);
var promise2 = resolve(2);
var promise3 = resolve(3);
var promises = [ promise1, promise2, promise3 ];
Promise.all(promises).then(function(array){
// The array here would be [ 1, 2, 3 ];
});
```
If any of the `promises` given to `all` are rejected, the first promise
that is rejected will be given as an argument to the returned promises's
rejection handler. For example:
Example:
```javascript
var promise1 = resolve(1);
var promise2 = reject(new Error("2"));
var promise3 = reject(new Error("3"));
var promises = [ promise1, promise2, promise3 ];
Promise.all(promises).then(function(array){
// Code here never runs because there are rejected promises!
}, function(error) {
// error.message === "2"
});
```
@method all
@static
@param {Array} entries array of promises
@param {String} label optional string for labeling the promise.
Useful for tooling.
@return {Promise} promise that is fulfilled when all `promises` have been
fulfilled, or rejected if any of them become rejected.
@static
*/
export default function all(entries) {
return new Enumerator(this, entries).promise;
}

View File

@ -1,5 +1,3 @@
/* */
"format cjs";
import {
isArray
} from "../utils";

View File

@ -0,0 +1,46 @@
import {
noop,
reject as _reject
} from '../-internal';
/**
`Promise.reject` returns a promise rejected with the passed `reason`.
It is shorthand for the following:
```javascript
var promise = new Promise(function(resolve, reject){
reject(new Error('WHOOPS'));
});
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
var promise = Promise.reject(new Error('WHOOPS'));
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
@method reject
@static
@param {Any} reason value that the returned promise will be rejected with.
Useful for tooling.
@return {Promise} a promise rejected with the given `reason`.
*/
export default function reject(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(noop);
_reject(promise, reason);
return promise;
}

View File

@ -0,0 +1,22 @@
export function objectOrFunction(x) {
return typeof x === 'function' || (typeof x === 'object' && x !== null);
}
export function isFunction(x) {
return typeof x === 'function';
}
export function isMaybeThenable(x) {
return typeof x === 'object' && x !== null;
}
var _isArray;
if (!Array.isArray) {
_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
} else {
_isArray = Array.isArray;
}
export var isArray = _isArray;

View File

@ -0,0 +1,94 @@
{
"name": "es6-promise",
"namespace": "es6-promise",
"version": "3.0.2",
"description": "A lightweight library that provides tools for organizing asynchronous code",
"main": "dist/es6-promise.js",
"directories": {
"lib": "lib"
},
"files": [
"dist",
"lib",
"!dist/test"
],
"devDependencies": {
"bower": "^1.3.9",
"brfs": "0.0.8",
"broccoli-es3-safe-recast": "0.0.8",
"broccoli-es6-module-transpiler": "^0.5.0",
"broccoli-jshint": "^0.5.1",
"broccoli-merge-trees": "^0.1.4",
"broccoli-replace": "^0.2.0",
"broccoli-stew": "0.0.6",
"broccoli-uglify-js": "^0.1.3",
"broccoli-watchify": "^0.2.0",
"ember-cli": "0.2.3",
"ember-publisher": "0.0.7",
"git-repo-version": "0.0.2",
"json3": "^3.3.2",
"minimatch": "^2.0.1",
"mocha": "^1.20.1",
"promises-aplus-tests-phantom": "^2.1.0-revise",
"release-it": "0.0.10"
},
"scripts": {
"build": "ember build",
"start": "ember s",
"test": "ember test",
"test:server": "ember test --server",
"test:node": "ember build && mocha ./dist/test/browserify",
"lint": "jshint lib",
"prepublish": "ember build --environment production",
"dry-run-release": "ember build --environment production && release-it --dry-run --non-interactive"
},
"repository": {
"type": "git",
"url": "git://github.com/jakearchibald/ES6-Promises.git"
},
"bugs": {
"url": "https://github.com/jakearchibald/ES6-Promises/issues"
},
"browser": {
"vertx": false
},
"keywords": [
"promises",
"futures"
],
"author": {
"name": "Yehuda Katz, Tom Dale, Stefan Penner and contributors",
"url": "Conversion to ES6 API by Jake Archibald"
},
"license": "MIT",
"spm": {
"main": "dist/es6-promise.js"
},
"gitHead": "6c49ef79609737bac2b496d508806a3d5e37303e",
"homepage": "https://github.com/jakearchibald/ES6-Promises#readme",
"_id": "es6-promise@3.0.2",
"_shasum": "010d5858423a5f118979665f46486a95c6ee2bb6",
"_from": "es6-promise@*",
"_npmVersion": "2.13.4",
"_nodeVersion": "2.2.1",
"_npmUser": {
"name": "stefanpenner",
"email": "stefan.penner@gmail.com"
},
"maintainers": [
{
"name": "jaffathecake",
"email": "jaffathecake@gmail.com"
},
{
"name": "stefanpenner",
"email": "stefan.penner@gmail.com"
}
],
"dist": {
"shasum": "010d5858423a5f118979665f46486a95c6ee2bb6",
"tarball": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz"
},
"_resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz",
"readme": "ERROR: No README data found!"
}

View File

@ -0,0 +1,98 @@
'use strict';
module.exports = function (grunt) {
var browsers = [
{ browserName: 'firefox', version: '19', platform: 'XP' },
{ browserName: 'firefox', platform: 'linux' },
{ browserName: 'firefox', platform: 'OS X 10.10' },
{ browserName: 'chrome', platform: 'linux' },
{ browserName: 'chrome', platform: 'OS X 10.9' },
{ browserName: 'chrome', platform: 'XP' },
{ browserName: 'internet explorer', platform: 'Windows 8.1', version: '11' },
{ browserName: 'internet explorer', platform: 'WIN8', version: '10' },
{ browserName: 'internet explorer', platform: 'VISTA', version: '9' },
{ browserName: 'safari', platform: 'OS X 10.6' },
{ browserName: 'safari', platform: 'OS X 10.8' },
{ browserName: 'safari', platform: 'OS X 10.9' },
{ browserName: 'safari', platform: 'OS X 10.10' },
{ browserName: 'iphone', platform: 'OS X 10.9', version: '7.1' },
{ browserName: 'android', platform: 'Linux', version: '4.4' },
];
var extraBrowsers = [
{ browserName: 'firefox', platform: 'linux', version: '30' },
{ browserName: 'firefox', platform: 'linux', version: '25' },
{ browserName: 'iphone', platform: 'OS X 10.8', version: '6.1' },
{ browserName: 'iphone', platform: 'OS X 10.8', version: '5.1' },
{ browserName: 'android', platform: 'Linux', version: '4.2' },
// XXX haven't investigated these:
// { browserName: 'opera', platform: 'Windows 7', version: '12' },
// { browserName: 'opera', platform: 'Windows 2008', version: '12' }
// { browserName: 'iphone', platform: 'OS X 10.6', version: '4.3' },
// { browserName: 'android', platform: 'Linux', version: '4.0' },
];
if (grunt.option('extra')) {
browsers = browsers.concat(extraBrowsers);
}
grunt.initConfig({
connect: {
server: {
options: {
base: '',
port: 9999,
useAvailablePort: true
}
}
},
'saucelabs-mocha': {
all: {
options: {
urls: (function () {
var urls = ['http://localhost:9999/test/'];
if (grunt.option('extra')) {
urls.push('http://localhost:9999/test-sham/');
}
return urls;
}()),
// tunnelTimeout: 5,
build: process.env.TRAVIS_BUILD_NUMBER,
tunneled: !process.env.SAUCE_HAS_TUNNEL,
identifier: process.env.TRAVIS_JOB_NUMBER,
sauceConfig: {
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER
},
// concurrency: 3,
browsers: browsers,
testname: (function () {
var testname = 'mocha';
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
testname += ' (PR ' + process.env.TRAVIS_PULL_REQUEST + ')';
}
if (process.env.TRAVIS_BRANCH && process.env.TRAVIS_BRANCH !== 'false') {
testname += ' (branch ' + process.env.TRAVIS_BRANCH + ')';
}
return testname;
}()),
tags: (function () {
var tags = [];
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
tags.push('PR-' + process.env.TRAVIS_PULL_REQUEST);
}
if (process.env.TRAVIS_BRANCH && process.env.TRAVIS_BRANCH !== 'false') {
tags.push(process.env.TRAVIS_BRANCH);
}
return tags;
}())
}
}
},
watch: {}
});
// Loading dependencies
for (var key in grunt.file.readJSON('package.json').devDependencies) {
if (key !== 'grunt' && key.indexOf('grunt') === 0) {
grunt.loadNpmTasks(key);
}
}
grunt.registerTask('dev', ['connect', 'watch']);
grunt.registerTask('sauce', ['connect', 'saucelabs-mocha']);
};

View File

@ -1,5 +1,3 @@
/* */
"format cjs";
/*!
* https://github.com/paulmillr/es6-shim
* @license es6-shim Copyright 2013-2015 by Paul Miller (http://paulmillr.com)

View File

@ -1,5 +1,3 @@
/* */
"format cjs";
/*!
* https://github.com/paulmillr/es6-shim
* @license es6-shim Copyright 2013-2015 by Paul Miller (http://paulmillr.com)

Some files were not shown because too many files have changed in this diff Show More