Compare commits

...

9 Commits

Author SHA1 Message Date
04618a1a36 Merge pull request #1377 from cseale/es6-1245
[Build] Added Babel Preprocessor to Karma for ES6 compatability
2017-01-11 13:22:16 -08:00
de2e546f18 [Build] Add babel-polyfill 2017-01-06 23:44:58 +00:00
c1630c339e Merge branch 'es6-1245' of github.com:cseale/openmct into es6-1245 2017-01-01 17:14:29 +00:00
e86a3de31a [Build] Added Babel Preprocessor to Karma for ES6 compatability
Issue #1245
2017-01-01 17:11:49 +00:00
fdb269ef97 [Build] Added Babel Preprocessor to Karma for ES6 compatability
Issue #1245
2016-12-30 10:44:59 +00:00
ce4b85be6e [Build] Use computed name syntax correctly 2016-11-16 15:42:31 -08:00
1215dd7b99 [Build] Convert BundleRegistry to ES6 2016-11-16 11:32:16 -08:00
f942fd3cf3 [Build] Add transpile step 2016-11-16 10:43:42 -08:00
d33e8d9be4 [Build] Add babel dependencies
...to support transpilation from ES6, #1245
2016-11-16 10:38:00 -08:00
9 changed files with 41 additions and 23 deletions

3
.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}

View File

@ -3,6 +3,7 @@
"browser": true,
"curly": true,
"eqeqeq": true,
"esversion": 6,
"forin": true,
"freeze": true,
"funcscope": false,

View File

@ -23,6 +23,7 @@
"lodash": "3.10.1",
"almond": "~0.3.2",
"d3": "~4.1.0",
"html2canvas": "^0.4.1"
"html2canvas": "^0.4.1",
"babel-polyfill": "^0.0.1"
}
}

View File

@ -42,6 +42,9 @@ var gulp = require('gulp'),
specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ],
},
options = {
babel: {
presets: ['es2015']
},
requirejsOptimize: {
name: 'bower_components/almond/almond.js',
include: paths.main.replace('.js', ''),
@ -70,10 +73,12 @@ var gulp = require('gulp'),
};
gulp.task('scripts', function () {
var babel = require('gulp-babel');
var requirejsOptimize = require('gulp-requirejs-optimize');
var replace = require('gulp-replace-task');
return gulp.src(paths.main)
.pipe(sourcemaps.init())
.pipe(babel(options.babel))
.pipe(requirejsOptimize(options.requirejsOptimize))
.pipe(sourcemaps.write('.'))
.pipe(replace(options.replace))

View File

@ -53,10 +53,14 @@ module.exports = function(config) {
// Preprocess matching files before serving them to the browser.
// https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'openmct.js': ['babel'],
'test-main.js': ['babel'],
'src/**/*.js': ['babel'],
'platform/**/src/**/*.js': ['babel'],
'platform/**/test/**/*.js': ['babel'],
'src/**/src/**/!(*Spec).js': [ 'coverage' ],
'platform/**/src/**/!(*Spec).js': [ 'coverage' ]
},
// Test results reporter to use
// Possible values: 'dots', 'progress'
// Available reporters: https://npmjs.org/browse/keyword/karma-reporter

View File

@ -23,6 +23,7 @@
requirejs.config({
"paths": {
"browser-polyfill": "bower_components/babel-polyfill/browser-polyfill", // ES6 browser polyfill, must be included before any other loads
"legacyRegistry": "src/legacyRegistry",
"angular": "bower_components/angular/angular.min",
"angular-route": "bower_components/angular-route/angular-route.min",

View File

@ -8,10 +8,12 @@
"request": "^2.69.0"
},
"devDependencies": {
"babel-preset-es2015": "^6.18.0",
"bower": "^1.7.7",
"git-rev-sync": "^1.4.0",
"glob": ">= 3.0.0",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.2",
"gulp-jscs": "^3.0.2",
"gulp-jshint": "^2.0.0",
"gulp-jshint-html-reporter": "^0.1.3",
@ -24,6 +26,7 @@
"jsdoc": "^3.3.2",
"jshint": "^2.7.0",
"karma": "^0.13.3",
"karma-babel-preprocessor": "^6.0.1",
"karma-chrome-launcher": "^0.1.8",
"karma-cli": "0.0.4",
"karma-coverage": "^0.5.3",

View File

@ -32,7 +32,7 @@ define(
html2canvas,
saveAs
) {
var self = this;
var self = null;
/**
* The export image service will export any HTML node to
@ -44,6 +44,7 @@ define(
* @constructor
*/
function ExportImageService($q, $timeout, $log, EXPORT_IMAGE_TIMEOUT, injHtml2Canvas, injSaveAs, injFileReader) {
self = this;
self.$q = $q;
self.$timeout = $timeout;
self.$log = $log;

View File

@ -20,55 +20,54 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(function () {
function BundleRegistry() {
define(() => class BundleRegistry {
constructor() {
this.bundles = {};
this.knownBundles = {};
}
BundleRegistry.prototype.register = function (path, definition) {
register(path, definition) {
if (this.knownBundles.hasOwnProperty(path)) {
throw new Error('Cannot register bundle with duplicate path', path);
}
this.knownBundles[path] = definition;
};
}
BundleRegistry.prototype.enable = function (path) {
enable(path) {
if (!this.knownBundles[path]) {
throw new Error('Unknown bundle ' + path);
}
this.bundles[path] = this.knownBundles[path];
};
}
BundleRegistry.prototype.disable = function (path) {
disable(path) {
if (!this.bundles[path]) {
throw new Error('Tried to disable inactive bundle ' + path);
}
delete this.bundles[path];
};
}
BundleRegistry.prototype.contains = function (path) {
contains(path) {
return !!this.bundles[path];
};
}
BundleRegistry.prototype.get = function (path) {
get(path) {
return this.bundles[path];
};
}
BundleRegistry.prototype.list = function () {
list() {
return Object.keys(this.bundles);
};
}
BundleRegistry.prototype.remove = BundleRegistry.prototype.disable;
remove(path) {
this.disable(path);
}
BundleRegistry.prototype.delete = function (path) {
["delete"](path) {
if (!this.knownBundles[path]) {
throw new Error('Cannot remove Unknown Bundle ' + path);
}
delete this.bundles[path];
delete this.knownBundles[path];
};
return BundleRegistry;
}
});