Skip to content

Commit ea752c4

Browse files
committed
Revert "Properly handle class properties proposal"
This reverts commit 0d47e8b. Fix #423 #425
1 parent 4b44a6f commit ea752c4

6 files changed

+1336
-2568
lines changed

lib/babel-options-util.js

+5-17
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function _getPresetEnv(config, project) {
3030
}
3131

3232
function _getModulesPlugin() {
33-
const resolvePath =
34-
require("./relative-module-paths").resolveRelativeModulePath;
33+
const resolvePath = require("./relative-module-paths")
34+
.resolveRelativeModulePath;
3535

3636
return [
3737
[require.resolve("babel-plugin-module-resolver"), { resolvePath }],
@@ -296,12 +296,7 @@ function _getHelperVersion(project) {
296296
return APP_BABEL_RUNTIME_VERSION.get(project);
297297
}
298298

299-
function _buildClassFeaturePluginConstraints(
300-
constraints,
301-
config,
302-
parent,
303-
project
304-
) {
299+
function _buildClassFeaturePluginConstraints(constraints, config, parent, project) {
305300
// With versions of ember-cli-typescript < 4.0, class feature plugins like
306301
// @babel/plugin-proposal-class-properties were run before the TS transform.
307302
if (!_shouldHandleTypeScript(config, parent, project)) {
@@ -312,14 +307,7 @@ function _buildClassFeaturePluginConstraints(
312307
return constraints;
313308
}
314309

315-
function _addDecoratorPlugins({
316-
plugins,
317-
options,
318-
config,
319-
parent,
320-
project,
321-
isClassPropertiesRequired,
322-
}) {
310+
function _addDecoratorPlugins(plugins, options, config, parent, project) {
323311
const { hasPlugin, addPlugin } = require("ember-cli-babel-plugin-helpers");
324312

325313
if (hasPlugin(plugins, "@babel/plugin-proposal-decorators")) {
@@ -353,7 +341,7 @@ function _addDecoratorPlugins({
353341
)} has added the class-properties plugin to its build, but ember-cli-babel provides these by default now! You can remove the transforms, or the addon that provided them, such as @ember-decorators/babel-transforms.`
354342
);
355343
}
356-
} else if (isClassPropertiesRequired) {
344+
} else {
357345
addPlugin(
358346
plugins,
359347
[

lib/get-babel-options.js

+10-14
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ const {
1414
_getPresetEnv,
1515
} = require("./babel-options-util");
1616

17-
module.exports = function getBabelOptions(config, cliBabelInstance) {
18-
let { parent, project } = cliBabelInstance;
17+
module.exports = function getBabelOptions(config, appInstance) {
18+
let { parent, project } = appInstance;
1919
let addonProvidedConfig = _getAddonProvidedConfig(config);
20-
let shouldIncludeHelpers = _shouldIncludeHelpers(config, cliBabelInstance);
20+
let shouldIncludeHelpers = _shouldIncludeHelpers(config, appInstance);
2121
let shouldHandleTypeScript = _shouldHandleTypeScript(config, parent, project);
2222
let shouldIncludeDecoratorPlugins = _shouldIncludeDecoratorPlugins(config);
2323

24-
let emberCLIBabelConfig = config["ember-cli-babel"];
24+
let emberCLIBabelConfig = config["ember-cli-babel"];
2525
let shouldRunPresetEnv = true;
2626

2727
if (emberCLIBabelConfig) {
@@ -38,16 +38,13 @@ module.exports = function getBabelOptions(config, cliBabelInstance) {
3838
}
3939

4040
if (shouldIncludeDecoratorPlugins) {
41-
userPlugins = _addDecoratorPlugins({
42-
plugins: userPlugins.slice(),
43-
options: addonProvidedConfig.options,
41+
userPlugins = _addDecoratorPlugins(
42+
userPlugins.slice(),
43+
addonProvidedConfig.options,
4444
config,
4545
parent,
46-
project,
47-
isClassPropertiesRequired: cliBabelInstance.isPluginRequired(
48-
"proposal-class-properties"
49-
),
50-
});
46+
project
47+
);
5148
}
5249

5350
options.plugins = []
@@ -59,8 +56,7 @@ module.exports = function getBabelOptions(config, cliBabelInstance) {
5956
_getEmberDataPackagesPolyfill(config, parent),
6057
_shouldCompileModules(config, project) && _getModulesPlugin(),
6158
userPostTransformPlugins
62-
)
63-
.filter(Boolean);
59+
).filter(Boolean);
6460

6561
options.presets = [
6662
shouldRunPresetEnv && _getPresetEnv(addonProvidedConfig, project),

0 commit comments

Comments
 (0)