Skip to content

Commit

Permalink
add disableDecoratorTransforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Mar 20, 2019
1 parent 5c2b079 commit 520190f
Show file tree
Hide file tree
Showing 4 changed files with 631 additions and 599 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ interface EmberCLIBabelConfig {
disableDebugTooling?: boolean;
disablePresetEnv?: boolean;
disableEmberModulesAPIPolyfill?: boolean;
disableDecoratorTransforms?: boolean;
extensions?: string[];
};
}
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ module.exports = {
let addonProvidedConfig = this._getAddonProvidedConfig(config);
let shouldCompileModules = this._shouldCompileModules(config);
let shouldIncludeHelpers = this._shouldIncludeHelpers(config);
let shouldIncludeDecoratorPlugins = this._shouldIncludeDecoratorPlugins(config);

let emberCLIBabelConfig = config['ember-cli-babel'];
let shouldRunPresetEnv = true;
Expand Down Expand Up @@ -294,7 +295,7 @@ module.exports = {
options.plugins = [].concat(
shouldIncludeHelpers && this._getHelpersPlugin(),
userPlugins,
this._getDecoratorPlugins(config),
shouldIncludeDecoratorPlugins && this._getDecoratorPlugins(config),
this._getDebugMacroPlugins(config),
this._getEmberModulesAPIPolyfill(config),
shouldCompileModules && this._getModulesPlugin(),
Expand All @@ -316,6 +317,12 @@ module.exports = {
return options;
},

_shouldIncludeDecoratorPlugins(config) {
let customOptions = config['ember-cli-babel'] || {};

return customOptions.disableDecoratorTransforms !== true;
},

_getDecoratorPlugins(config) {
const { hasPlugin } = require('ember-cli-babel-plugin-helpers');

Expand Down
3 changes: 2 additions & 1 deletion node-tests/addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ describe('ember-cli-babel', function() {
compileModules: false,
disablePresetEnv: true,
disableDebugTooling: true,
disableEmberModulesAPIPolyfill: true
disableEmberModulesAPIPolyfill: true,
disableDecoratorTransforms: true,
}
});

Expand Down
Loading

0 comments on commit 520190f

Please sign in to comment.