From ca9fc7c03fbcb531d960344acc4e2ad1698e2503 Mon Sep 17 00:00:00 2001 From: Sergey Astapov Date: Mon, 21 Feb 2022 23:38:47 -0500 Subject: [PATCH] Allow to opt out of classic component patching --- index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/index.js b/index.js index 411327ba..b8f4517b 100644 --- a/index.js +++ b/index.js @@ -132,9 +132,22 @@ module.exports = { annotation: 'Merge (ember-component-css merge names with addon tree)' }); } + let checker = new VersionChecker(this); let ember = checker.forEmber(); let superTree = this._super.treeForAddon.call(this, tree); + + // Allow to opt-out from automatic Component.reopen() + if (this.addonConfig.patchClassicComponent === false) { + superTree = new Funnel(superTree, { + exclude: [ + 'ember-component-css/initializers/component-styles.js' + ], + annotation: + "Funnel (ember-component-css exclude addon/initializers/component-styles.js per config)" + }); + } + if (ember.isAbove('3.6.0')) { return new Funnel(superTree, { exclude: ['ember-component-css/initializers/route-styles.js'], @@ -151,6 +164,17 @@ module.exports = { }, treeForApp: function(tree) { + // Allow to opt-out from automatic Component.reopen() + if (this.addonConfig.patchClassicComponent === false) { + tree = new Funnel(tree, { + exclude: [ + "initializers/component-styles.js" + ], + annotation: + "Funnel (ember-component-css exclude app/initializers/component-styles.js per config)" + }); + } + let checker = new VersionChecker(this); let ember = checker.forEmber(); if (ember.isAbove('3.6.0')) {