Skip to content

Commit

Permalink
fix build to work with latest babel
Browse files Browse the repository at this point in the history
  • Loading branch information
bnavetta committed Dec 25, 2015
1 parent 94d83f0 commit ca50db2
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 54 deletions.
8 changes: 1 addition & 7 deletions build/babel-options.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
module.exports = {
modules: 'system',
moduleIds: false,
comments: false,
compact: false,
stage:2,
optional: [
"es7.decorators",
"es7.classProperties"
]
compact: false
};
12 changes: 8 additions & 4 deletions build/tasks/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var gulp = require('gulp');
var runSequence = require('run-sequence');
var to5 = require('gulp-babel');
var babel = require('gulp-babel');
var paths = require('../paths');
var compilerOptions = require('../babel-options');
var assign = Object.assign || require('object.assign');
Expand All @@ -22,7 +22,7 @@ gulp.task('build-html-commonjs', function () {

gulp.task('build-commonjs', ['build-html-commonjs'], function () {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'common'})))
.pipe(babel(assign({}, compilerOptions, {presets: ['es2015']})))
.pipe(gulp.dest(paths.output + 'commonjs'));
});

Expand All @@ -33,7 +33,9 @@ gulp.task('build-html-amd', function () {

gulp.task('build-amd', ['build-html-amd'], function () {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'amd'})))
.pipe(babel(assign({}, compilerOptions, {
presets: ['es2015'],
plugins: ['transform-es2015-modules-amd']})))
.pipe(gulp.dest(paths.output + 'amd'));
});

Expand All @@ -44,7 +46,9 @@ gulp.task('build-html-system', function () {

gulp.task('build-system', ['build-html-system'], function () {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'system'})))
.pipe(babel(assign({}, compilerOptions, {
presets: ['es2015'],
plugins: ['transform-es2015-modules-systemjs']})))
.pipe(gulp.dest(paths.output + 'system'));
});

Expand Down
37 changes: 26 additions & 11 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
define(['exports', 'aurelia-framework', 'aurelia-templating-binding', 'aurelia-logging'], function (exports, _aureliaFramework, _aureliaTemplatingBinding, _aureliaLogging) {
'use strict';
'use strict';

Object.defineProperty(exports, '__esModule', {
define(['exports', 'aurelia-framework', 'aurelia-templating-binding', 'aurelia-logging'], function (exports, _aureliaFramework, _aureliaTemplatingBinding, _aureliaLogging) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.configure = configure;

var logger = _aureliaLogging.getLogger('polymer');
var LogManager = _interopRequireWildcard(_aureliaLogging);

function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};

if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
}
}

newObj.default = obj;
return newObj;
}
}

var logger = LogManager.getLogger('polymer');

function registerElement(eventManager, bindingLanguage, prototype) {
var propertyConfig = { 'bind-value': ['change', 'input'] };
var propertyConfig = {
'bind-value': ['change', 'input']
};

function handleProp(propName, prop) {
if (prop.notify) {
Expand All @@ -20,17 +41,14 @@ define(['exports', 'aurelia-framework', 'aurelia-templating-binding', 'aurelia-l
Object.keys(prototype.properties).forEach(function (propName) {
return handleProp(propName, prototype.properties[propName]);
});

prototype.behaviors.forEach(function (behavior) {
if (typeof behavior.properties != 'undefined') {
Object.keys(behavior.properties).forEach(function (propName) {
return handleProp(propName, behavior.properties[propName]);
});
}
});

logger.debug("Registering configuration for Polymer element [" + prototype.is + "]");

eventManager.registerElementConfig({
tagName: prototype.is,
properties: propertyConfig
Expand All @@ -40,11 +58,8 @@ define(['exports', 'aurelia-framework', 'aurelia-templating-binding', 'aurelia-l
function configure(aurelia) {
var eventManager = aurelia.container.get(_aureliaFramework.EventManager);
var bindingLanguage = aurelia.container.get(_aureliaTemplatingBinding.TemplatingBindingLanguage);

bindingLanguage.attributeMap['bind-value'] = 'bindValue';

logger.debug("Performing initial Polymer binding");

var registrations = Polymer.telemetry.registrations;
registrations.forEach(function (prototype) {
return registerElement(eventManager, bindingLanguage, prototype);
Expand Down
6 changes: 3 additions & 3 deletions dist/commonjs/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
'use strict';

Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.configure = configure;

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

var _aureliaFramework = require('aurelia-framework');

var _aureliaTemplatingBinding = require('aurelia-templating-binding');
Expand All @@ -15,6 +13,8 @@ var _aureliaLogging = require('aurelia-logging');

var LogManager = _interopRequireWildcard(_aureliaLogging);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var logger = LogManager.getLogger('polymer');

function registerElement(eventManager, bindingLanguage, prototype) {
Expand Down
54 changes: 25 additions & 29 deletions dist/system/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
System.register(['aurelia-framework', 'aurelia-templating-binding', 'aurelia-logging'], function (_export) {
'use strict';
'use strict';

System.register(['aurelia-framework', 'aurelia-templating-binding', 'aurelia-logging'], function (_export) {
var EventManager, ObserverLocator, TemplatingBindingLanguage, LogManager, logger;

_export('configure', configure);

function registerElement(eventManager, bindingLanguage, prototype) {
var propertyConfig = { 'bind-value': ['change', 'input'] };
var propertyConfig = {
'bind-value': ['change', 'input']
};

function handleProp(propName, prop) {
if (prop.notify) {
Expand All @@ -17,44 +17,20 @@ System.register(['aurelia-framework', 'aurelia-templating-binding', 'aurelia-log
Object.keys(prototype.properties).forEach(function (propName) {
return handleProp(propName, prototype.properties[propName]);
});

prototype.behaviors.forEach(function (behavior) {
if (typeof behavior.properties != 'undefined') {
Object.keys(behavior.properties).forEach(function (propName) {
return handleProp(propName, behavior.properties[propName]);
});
}
});

logger.debug("Registering configuration for Polymer element [" + prototype.is + "]");

eventManager.registerElementConfig({
tagName: prototype.is,
properties: propertyConfig
});
}

function configure(aurelia) {
var eventManager = aurelia.container.get(EventManager);
var bindingLanguage = aurelia.container.get(TemplatingBindingLanguage);

bindingLanguage.attributeMap['bind-value'] = 'bindValue';

logger.debug("Performing initial Polymer binding");

var registrations = Polymer.telemetry.registrations;
registrations.forEach(function (prototype) {
return registerElement(eventManager, bindingLanguage, prototype);
});

var oldRegistrate = Polymer.telemetry._registrate.bind(Polymer.telemetry);

Polymer.telemetry._registrate = function (prototype) {
oldRegistrate(prototype);
registerElement(eventManager, bindingLanguage, prototype);
};
}

return {
setters: [function (_aureliaFramework) {
EventManager = _aureliaFramework.EventManager;
Expand All @@ -66,6 +42,26 @@ System.register(['aurelia-framework', 'aurelia-templating-binding', 'aurelia-log
}],
execute: function () {
logger = LogManager.getLogger('polymer');

function configure(aurelia) {
var eventManager = aurelia.container.get(EventManager);
var bindingLanguage = aurelia.container.get(TemplatingBindingLanguage);
bindingLanguage.attributeMap['bind-value'] = 'bindValue';
logger.debug("Performing initial Polymer binding");
var registrations = Polymer.telemetry.registrations;
registrations.forEach(function (prototype) {
return registerElement(eventManager, bindingLanguage, prototype);
});

var oldRegistrate = Polymer.telemetry._registrate.bind(Polymer.telemetry);

Polymer.telemetry._registrate = function (prototype) {
oldRegistrate(prototype);
registerElement(eventManager, bindingLanguage, prototype);
};
}

_export('configure', configure);
}
};
});
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
},
"devDependencies": {
"aurelia-tools": "^0.1.3",
"babel-plugin-transform-es2015-modules-amd": "^6.3.13",
"babel-plugin-transform-es2015-modules-systemjs": "^6.3.13",
"babel-preset-es2015": "^6.3.13",
"conventional-changelog": "0.0.11",
"del": "^2.2.0",
"gulp": "^3.8.10",
Expand Down

0 comments on commit ca50db2

Please sign in to comment.