Skip to content

Commit f8d64cf

Browse files
HeroicEricbertdeblock
authored andcommitted
Remove workaround for bug fixed upstream
This removes a workaround that was added for a bug in `babel-helper-compilation-targets` that was fixed upstream and is included in the version that is required by this addon. The bugfix in `babel-helpers-compilation-targets` was included in [`v7.10.2`](https://github.com/babel/babel/releases/tag/v7.10.2) `ember-cli-babel` began requiring a version of `babel-helpers-compilation-targets` that includes the bugfix since [`v7.21.0`](https://github.com/babel/ember-cli-babel/releases/tag/v7.21.0) --- - [Original bugfix workaround PR](#345) - [Dependency upgrade PR](#354) - [`[email protected]` Release notes](https://github.com/babel/ember-cli-babel/releases/tag/v7.21.0) - [`[email protected]` Release notes](https://github.com/babel/babel/releases/tag/v7.10.2)
1 parent 315df8a commit f8d64cf

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const {
1010
} = require("./lib/babel-options-util");
1111

1212
const VersionChecker = require('ember-cli-version-checker');
13-
const clone = require('clone');
1413
const babel = require('@babel/core');
1514
const path = require('path');
1615
const getBabelOptions = require('./lib/get-babel-options');
@@ -332,14 +331,7 @@ module.exports = {
332331

333332
let parser = require('@babel/helper-compilation-targets').default;
334333
if (typeof targets === 'object' && targets !== null) {
335-
// babel version 7.10.0 introduced a change that mutates the input:
336-
// https://github.com/babel/babel/pull/11500
337-
// copy the object to guard against it, otherwise subsequent calls to
338-
// _getTargets() will only have a mutated copy and lose all config from `config/targets.js`
339-
// in the host application.
340-
// PR to fix this upstream in babel: https://github.com/babel/babel/pull/11648
341-
const copy = clone(targets);
342-
return parser(copy);
334+
return parser(targets);
343335
} else {
344336
return targets;
345337
}

node-tests/addon-test.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const terminateWorkerPool = require('./utils/terminate-workers');
1919
const path = require('path');
2020
const fs = require('fs');
2121
const rimraf = require('rimraf');
22-
const clone = require('clone');
2322
const {
2423
_shouldHandleTypeScript,
2524
_shouldIncludeHelpers,
@@ -134,15 +133,15 @@ describe('ember-cli-babel', function() {
134133
input.write({
135134
"foo.js": `import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nexport default class Foo extends Component { @tracked thisIsTracked = true; }`,
136135
});
137-
136+
138137
this.addon.project.targets = {
139138
browsers: ["last 2 chrome versions"],
140139
};
141-
140+
142141
subject = this.addon.transpileTree(input.path(), {});
143-
142+
144143
output = createBuilder(subject);
145-
144+
146145
yield output.build();
147146
expect(output.read()["foo.js"]).not.to.include(
148147
"_initializerWarningHelper(_descriptor, this)"
@@ -1932,16 +1931,6 @@ describe('ember-cli-babel', function() {
19321931
let pluginRequired = this.addon.isPluginRequired('transform-regenerator');
19331932
expect(pluginRequired).to.be.false;
19341933
});
1935-
1936-
it('defensively copies `targets` to prevent @babel/helper-compilation-functions mutating it', function() {
1937-
let targets = {
1938-
browsers: ['last 2 Chrome versions']
1939-
};
1940-
this.addon.project.targets = clone(targets);
1941-
1942-
this.addon.isPluginRequired('transform-regenerator');
1943-
expect(this.addon.project.targets).to.deep.equal(targets);
1944-
});
19451934
});
19461935
});
19471936

0 commit comments

Comments
 (0)