From 76223e0cad82d5834266aa5c50d3ce1463d23d68 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Tue, 12 Apr 2016 07:40:28 -0400 Subject: [PATCH 1/2] [BUGFIX canary] Enable features that have been "go"ed. --- config/features.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/features.json b/config/features.json index e42f1bb4a7f..f8dced67655 100644 --- a/config/features.json +++ b/config/features.json @@ -1,11 +1,11 @@ { "ds-boolean-transform-allow-null": null, - "ds-finder-include": null, + "ds-finder-include": true, "ds-improved-ajax": null, - "ds-references": null, - "ds-transform-pass-options": null, + "ds-references": true, + "ds-transform-pass-options": true, "ds-pushpayload-return": null, - "ds-serialize-ids-and-types": null, + "ds-serialize-ids-and-types": true, "ds-extended-errors": null, "ds-links-in-record-array": null } From eeb8ee369ad3c32fc91042a4c9bde3b1f8922acb Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Tue, 12 Apr 2016 07:41:20 -0400 Subject: [PATCH 2/2] [BUGFIX release] Ensure feature flag stripping works for all builds. Prior to this, the feature flags would only be processed for `production` builds (from within an ember-cli app). This is incorrect, they should be processed for all builds (for every environment) so that any features explicitly enabled or disabled in the version of Ember data being used are stripped properly. --- index.js | 8 +++----- lib/javascripts.js | 5 ++--- lib/stripped-build-plugins.js | 37 ++++++++++++++++++++--------------- lib/stripped-build.js | 6 +++--- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/index.js b/index.js index f6a6ca6d979..e23683c1a8a 100644 --- a/index.js +++ b/index.js @@ -101,11 +101,9 @@ module.exports = { included: function(app) { this._super.included.apply(this, arguments); - if (process.env.EMBER_ENV === 'production') { - this.options.babel = this.options.babel || {}; - add(this.options.babel, 'blacklist', ['es6.modules', 'useStrict']); - add(this.options.babel, 'plugins', require('./lib/stripped-build-plugins')()); - } + this.options.babel = this.options.babel || {}; + add(this.options.babel, 'blacklist', ['es6.modules', 'useStrict']); + add(this.options.babel, 'plugins', require('./lib/stripped-build-plugins')(process.env.EMBER_ENV)); if (this._forceBowerUsage) { this.app.import({ diff --git a/lib/javascripts.js b/lib/javascripts.js index da66aa74ede..2209df30b17 100644 --- a/lib/javascripts.js +++ b/lib/javascripts.js @@ -10,11 +10,10 @@ var path = require('path'); var Funnel = require('broccoli-funnel'); var versionReplace = require('./version-replace'); var fileCreator = require('broccoli-file-creator'); -var babelBuild = require('./babel-build'); var strippedBuild = require('./stripped-build'); function debugBuild(packageName, tree) { - var compiled = babelBuild(packageName, tree); + var compiled = strippedBuild(packageName, tree, 'development'); return stew.mv(compiled, packageName); } @@ -24,7 +23,7 @@ function makeStrippedBuild(packageName, tree) { exclude: ['ember-data/-private/debug.js'] }); - var stripped = strippedBuild(packageName, withoutDebug); + var stripped = strippedBuild(packageName, withoutDebug, 'production'); return stew.mv(stripped, packageName); } diff --git a/lib/stripped-build-plugins.js b/lib/stripped-build-plugins.js index 49afe181683..2d9a7d08128 100644 --- a/lib/stripped-build-plugins.js +++ b/lib/stripped-build-plugins.js @@ -3,7 +3,7 @@ var path = require('path'); var filterImports = require('babel-plugin-filter-imports'); var featureFlags = require('babel-plugin-feature-flags'); -module.exports = function() { +module.exports = function(environment) { var featuresJsonPath = __dirname + '/../config/features.json'; var featuresJson = fs.readFileSync(featuresJsonPath, { encoding: 'utf8' }); var features = JSON.parse(featuresJson); @@ -16,24 +16,29 @@ module.exports = function() { // features[feature] = false; // } // } - - return [ + var plugins = [ featureFlags({ import: { module: 'ember-data/-private/features' }, features: features - }), - - filterImports({ - 'ember-data/-private/debug': [ - 'assert', - 'assertPolymorphicType', - 'debug', - 'deprecate', - 'info', - 'runInDebug', - 'warn', - 'debugSeal' - ] }) ]; + + if (environment === 'production') { + plugins.push( + filterImports({ + 'ember-data/-private/debug': [ + 'assert', + 'assertPolymorphicType', + 'debug', + 'deprecate', + 'info', + 'runInDebug', + 'warn', + 'debugSeal' + ] + }) + ); + } + + return plugins; }; diff --git a/lib/stripped-build.js b/lib/stripped-build.js index ddb9a0d39db..3eef7603efa 100644 --- a/lib/stripped-build.js +++ b/lib/stripped-build.js @@ -5,9 +5,9 @@ var featureFlags = require('babel-plugin-feature-flags'); var babelBuild = require('./babel-build'); var strippedBuildPlugins = require('./stripped-build-plugins'); -module.exports = function(packageName, tree, _options) { - var options = _options || {}; - options.plugins = strippedBuildPlugins(); +module.exports = function(packageName, tree, environmentBuildingFor) { + var options = {}; + options.plugins = strippedBuildPlugins(environmentBuildingFor); return babelBuild(packageName, tree, options); };