Compare commits

...

5 Commits

Author SHA1 Message Date
884a5d23db [Build] Transpile ES2015 modules to AMD 2017-12-11 10:54:02 -08:00
afa797bb15 [Build] Use computed name syntax correctly 2017-12-11 10:48:24 -08:00
efcf5d2108 [Build] Convert BundleRegistry to ES6 2017-12-11 10:48:24 -08:00
0c21ec60e2 [Build] Add transpile step 2017-12-11 10:48:24 -08:00
9911bf5721 [Build] Add babel dependencies
...to support transpilation from ES6, #1245
2017-12-11 10:48:24 -08:00
3 changed files with 28 additions and 20 deletions

View File

@ -42,6 +42,10 @@ var gulp = require('gulp'),
specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ], specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ],
}, },
options = { options = {
babel: {
plugins: ["transform-es2015-modules-amd"],
presets: ['es2015']
},
requirejsOptimize: { requirejsOptimize: {
name: 'bower_components/almond/almond.js', name: 'bower_components/almond/almond.js',
include: paths.main.replace('.js', ''), include: paths.main.replace('.js', ''),
@ -80,10 +84,12 @@ if (process.env.NODE_ENV === 'development') {
gulp.task('scripts', function () { gulp.task('scripts', function () {
var babel = require('gulp-babel');
var requirejsOptimize = require('gulp-requirejs-optimize'); var requirejsOptimize = require('gulp-requirejs-optimize');
return gulp.src(paths.main) return gulp.src(paths.main)
.pipe(sourcemaps.init()) .pipe(sourcemaps.init())
.pipe(babel(options.babel))
.pipe(requirejsOptimize(options.requirejsOptimize)) .pipe(requirejsOptimize(options.requirejsOptimize))
.pipe(sourcemaps.write('.')) .pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.dist)); .pipe(gulp.dest(paths.dist));

View File

@ -19,10 +19,13 @@
"vue": "^2.5.6" "vue": "^2.5.6"
}, },
"devDependencies": { "devDependencies": {
"babel-plugin-transform-es2015-modules-amd": "^6.24.1",
"babel-preset-es2015": "^6.18.0",
"bower": "^1.7.7", "bower": "^1.7.7",
"git-rev-sync": "^1.4.0", "git-rev-sync": "^1.4.0",
"glob": ">= 3.0.0", "glob": ">= 3.0.0",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-jscs": "^3.0.2", "gulp-jscs": "^3.0.2",
"gulp-jshint": "^2.0.0", "gulp-jshint": "^2.0.0",
"gulp-jshint-html-reporter": "^0.1.3", "gulp-jshint-html-reporter": "^0.1.3",

View File

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