Skip to content

Commit a80bc7e

Browse files
author
Chris Garrett
committed
[BUGFIX] Removes the class properties transform for the latest ember-cli-babel
1 parent 6b2029e commit a80bc7e

File tree

3 files changed

+129
-17
lines changed

3 files changed

+129
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"ember-cli-addon-docs": "^0.6.5",
7474
"ember-cli-addon-docs-esdoc": "^0.2.1",
7575
"ember-cli-app-version": "3.2.0",
76-
"ember-cli-babel": "7.6.0",
76+
"ember-cli-babel": "7.7.3",
7777
"ember-cli-blueprint-test-helpers": "0.19.2",
7878
"ember-cli-dependency-checker": "3.1.0",
7979
"ember-cli-deploy": "^1.0.2",

ts/addon.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,19 @@ export default addon({
7575
// preprocessor registry, so we need to beat it to the punch.
7676
this._registerBabelExtension();
7777

78-
this._addPluginIfMissing(
79-
'@babel/plugin-proposal-class-properties',
80-
{ loose: true },
81-
{
82-
// Needs to come after the decorators plugin, if present
83-
after: ['@babel/plugin-proposal-decorators'],
84-
}
85-
);
78+
// Newer versions of ember-cli-babel add the transforms automatically, so we
79+
// only need to add ours on older versions.
80+
let babelVersion = this._getBabelVersion();
81+
if (!babelVersion || semver.lt(babelVersion, '7.7.0')) {
82+
this._addPluginIfMissing(
83+
'@babel/plugin-proposal-class-properties',
84+
{ loose: true },
85+
{
86+
// Needs to come after the decorators plugin, if present
87+
after: ['@babel/plugin-proposal-decorators'],
88+
}
89+
);
90+
}
8691

8792
// Needs to come after the class properties plugin (see tests/unit/build-test.ts -
8893
// "property initialization occurs in the right order")
@@ -95,11 +100,15 @@ export default addon({
95100
return !['in-repo-a', 'in-repo-b'].includes(addon.name);
96101
},
97102

98-
_checkBabelVersion() {
103+
_getBabelVersion() {
99104
let babel = this.parent.addons.find(addon => addon.name === 'ember-cli-babel');
100-
let version = babel && babel.pkg.version;
101-
if (!babel || !(semver.gte(version!, '7.1.0') && semver.lt(version!, '8.0.0'))) {
102-
let versionString = babel ? `version ${babel.pkg.version}` : `no instance of ember-cli-babel`;
105+
return babel && babel.pkg.version;
106+
},
107+
108+
_checkBabelVersion() {
109+
let version = this._getBabelVersion();
110+
if (!version || !(semver.gte(version!, '7.1.0') && semver.lt(version!, '8.0.0'))) {
111+
let versionString = version ? `version ${version}` : `no instance of ember-cli-babel`;
103112
this.ui.writeWarnLine(
104113
`ember-cli-typescript requires ember-cli-babel ^7.1.0, but you have ${versionString} installed; ` +
105114
'your TypeScript files may not be transpiled correctly.'

yarn.lock

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@
4040
source-map "^0.5.0"
4141
trim-right "^1.0.1"
4242

43+
"@babel/generator@^7.4.0":
44+
version "7.4.0"
45+
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.4.0.tgz#c230e79589ae7a729fd4631b9ded4dc220418196"
46+
integrity sha512-/v5I+a1jhGSKLgZDcmAUZ4K/VePi43eRkUs3yePW1HB1iANOD5tqJXwGSG4BZhSksP8J9ejSlwGeTiiOFZOrXQ==
47+
dependencies:
48+
"@babel/types" "^7.4.0"
49+
jsesc "^2.5.1"
50+
lodash "^4.17.11"
51+
source-map "^0.5.0"
52+
trim-right "^1.0.1"
53+
4354
"@babel/helper-annotate-as-pure@^7.0.0":
4455
version "7.0.0"
4556
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32"
@@ -76,6 +87,18 @@
7687
"@babel/helper-replace-supers" "^7.3.4"
7788
"@babel/helper-split-export-declaration" "^7.0.0"
7889

90+
"@babel/helper-create-class-features-plugin@^7.4.0":
91+
version "7.4.0"
92+
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.4.0.tgz#30fd090e059d021995c1762a5b76798fa0b51d82"
93+
integrity sha512-2K8NohdOT7P6Vyp23QH4w2IleP8yG3UJsbRKwA4YP6H8fErcLkFuuEEqbF2/BYBKSNci/FWJiqm6R3VhM/QHgw==
94+
dependencies:
95+
"@babel/helper-function-name" "^7.1.0"
96+
"@babel/helper-member-expression-to-functions" "^7.0.0"
97+
"@babel/helper-optimise-call-expression" "^7.0.0"
98+
"@babel/helper-plugin-utils" "^7.0.0"
99+
"@babel/helper-replace-supers" "^7.4.0"
100+
"@babel/helper-split-export-declaration" "^7.4.0"
101+
79102
"@babel/helper-define-map@^7.1.0":
80103
version "7.1.0"
81104
resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz#3b74caec329b3c80c116290887c0dd9ae468c20c"
@@ -182,6 +205,16 @@
182205
"@babel/traverse" "^7.3.4"
183206
"@babel/types" "^7.3.4"
184207

208+
"@babel/helper-replace-supers@^7.4.0":
209+
version "7.4.0"
210+
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.4.0.tgz#4f56adb6aedcd449d2da9399c2dcf0545463b64c"
211+
integrity sha512-PVwCVnWWAgnal+kJ+ZSAphzyl58XrFeSKSAJRiqg5QToTsjL+Xu1f9+RJ+d+Q0aPhPfBGaYfkox66k86thxNSg==
212+
dependencies:
213+
"@babel/helper-member-expression-to-functions" "^7.0.0"
214+
"@babel/helper-optimise-call-expression" "^7.0.0"
215+
"@babel/traverse" "^7.4.0"
216+
"@babel/types" "^7.4.0"
217+
185218
"@babel/helper-simple-access@^7.1.0":
186219
version "7.1.0"
187220
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c"
@@ -197,6 +230,13 @@
197230
dependencies:
198231
"@babel/types" "^7.0.0"
199232

233+
"@babel/helper-split-export-declaration@^7.4.0":
234+
version "7.4.0"
235+
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.0.tgz#571bfd52701f492920d63b7f735030e9a3e10b55"
236+
integrity sha512-7Cuc6JZiYShaZnybDmfwhY4UYHzI6rlqhWjaIqbsJGsIqPimEYy5uh3akSRLMg65LSdSEnJ8a8/bWQN6u2oMGw==
237+
dependencies:
238+
"@babel/types" "^7.4.0"
239+
200240
"@babel/helper-wrap-function@^7.1.0":
201241
version "7.2.0"
202242
resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa"
@@ -230,6 +270,11 @@
230270
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.4.tgz#a43357e4bbf4b92a437fb9e465c192848287f27c"
231271
integrity sha512-tXZCqWtlOOP4wgCp6RjRvLmfuhnqTLy9VHwRochJBCP2nDm27JnnuFEnXFASVyQNHk36jD1tAammsCEEqgscIQ==
232272

273+
"@babel/parser@^7.4.0":
274+
version "7.4.2"
275+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.2.tgz#b4521a400cb5a871eab3890787b4bc1326d38d91"
276+
integrity sha512-9fJTDipQFvlfSVdD/JBtkiY0br9BtfvW2R8wo6CX/Ej2eMuV0gWPk1M67Mt3eggQvBqYW1FCEk8BN7WvGm/g5g==
277+
233278
"@babel/plugin-proposal-async-generator-functions@^7.2.0":
234279
version "7.2.0"
235280
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e"
@@ -247,6 +292,23 @@
247292
"@babel/helper-create-class-features-plugin" "^7.3.4"
248293
"@babel/helper-plugin-utils" "^7.0.0"
249294

295+
"@babel/plugin-proposal-class-properties@^7.3.4":
296+
version "7.4.0"
297+
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.4.0.tgz#d70db61a2f1fd79de927eea91f6411c964e084b8"
298+
integrity sha512-t2ECPNOXsIeK1JxJNKmgbzQtoG27KIlVE61vTqX0DKR9E9sZlVVxWUtEW9D5FlZ8b8j7SBNCHY47GgPKCKlpPg==
299+
dependencies:
300+
"@babel/helper-create-class-features-plugin" "^7.4.0"
301+
"@babel/helper-plugin-utils" "^7.0.0"
302+
303+
"@babel/plugin-proposal-decorators@^7.3.0":
304+
version "7.4.0"
305+
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.0.tgz#8e1bfd83efa54a5f662033afcc2b8e701f4bb3a9"
306+
integrity sha512-d08TLmXeK/XbgCo7ZeZ+JaeZDtDai/2ctapTRsWWkkmy7G/cqz8DQN/HlWG7RR4YmfXxmExsbU3SuCjlM7AtUg==
307+
dependencies:
308+
"@babel/helper-create-class-features-plugin" "^7.4.0"
309+
"@babel/helper-plugin-utils" "^7.0.0"
310+
"@babel/plugin-syntax-decorators" "^7.2.0"
311+
250312
"@babel/plugin-proposal-json-strings@^7.2.0":
251313
version "7.2.0"
252314
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317"
@@ -287,6 +349,13 @@
287349
dependencies:
288350
"@babel/helper-plugin-utils" "^7.0.0"
289351

352+
"@babel/plugin-syntax-decorators@^7.2.0":
353+
version "7.2.0"
354+
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.2.0.tgz#c50b1b957dcc69e4b1127b65e1c33eef61570c1b"
355+
integrity sha512-38QdqVoXdHUQfTpZo3rQwqQdWtCn5tMv4uV6r2RMfTqNBuv4ZBhz79SfaQWKTVmxHjeFv/DnXVC/+agHCklYWA==
356+
dependencies:
357+
"@babel/helper-plugin-utils" "^7.0.0"
358+
290359
"@babel/plugin-syntax-json-strings@^7.2.0":
291360
version "7.2.0"
292361
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470"
@@ -643,6 +712,21 @@
643712
globals "^11.1.0"
644713
lodash "^4.17.11"
645714

715+
"@babel/traverse@^7.4.0":
716+
version "7.4.0"
717+
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.0.tgz#14006967dd1d2b3494cdd650c686db9daf0ddada"
718+
integrity sha512-/DtIHKfyg2bBKnIN+BItaIlEg5pjAnzHOIQe5w+rHAw/rg9g0V7T4rqPX8BJPfW11kt3koyjAnTNwCzb28Y1PA==
719+
dependencies:
720+
"@babel/code-frame" "^7.0.0"
721+
"@babel/generator" "^7.4.0"
722+
"@babel/helper-function-name" "^7.1.0"
723+
"@babel/helper-split-export-declaration" "^7.4.0"
724+
"@babel/parser" "^7.4.0"
725+
"@babel/types" "^7.4.0"
726+
debug "^4.1.0"
727+
globals "^11.1.0"
728+
lodash "^4.17.11"
729+
646730
"@babel/types@^7.0.0", "@babel/types@^7.1.5", "@babel/types@^7.1.6", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.3.0", "@babel/types@^7.3.4":
647731
version "7.3.4"
648732
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.3.4.tgz#bf482eaeaffb367a28abbf9357a94963235d90ed"
@@ -652,6 +736,15 @@
652736
lodash "^4.17.11"
653737
to-fast-properties "^2.0.0"
654738

739+
"@babel/types@^7.4.0":
740+
version "7.4.0"
741+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.0.tgz#670724f77d24cce6cc7d8cf64599d511d164894c"
742+
integrity sha512-aPvkXyU2SPOnztlgo8n9cEiXW755mgyvueUPcpStqdzoSPm0fjO0vQBjLkt3JKJW7ufikfcnMTTPsN1xaTsBPA==
743+
dependencies:
744+
esutils "^2.0.2"
745+
lodash "^4.17.11"
746+
to-fast-properties "^2.0.0"
747+
655748
"@cnakazawa/watch@^1.0.3":
656749
version "1.0.3"
657750
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef"
@@ -5054,12 +5147,19 @@ ember-cli-babel-plugin-helpers@^1.0.0:
50545147
resolved "https://registry.yarnpkg.com/ember-cli-babel-plugin-helpers/-/ember-cli-babel-plugin-helpers-1.0.2.tgz#d4bec0f32febc530e621ea8d66d3365727cb5e6c"
50555148
integrity sha512-tTWmHiIvadgtu0i+Zlb5Jnue69qO6dtACcddkRhhV+m9NfAr+2XNoTKRSeGL8QyRDhfWeo4rsK9dqPrU4PQ+8g==
50565149

5057-
5058-
version "7.6.0"
5059-
resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-7.6.0.tgz#2e7f1df888fb62eb54d170defce4b6c536e8dfd3"
5060-
integrity sha512-2m400ZW9c4EE343g/j1U7beJgjJezTdDCgXM2koHdhpLlZB1Kz7iQw8S+t8gzXGwSGXlf7C7v0RHxP1/bo8frA==
5150+
ember-cli-babel-plugin-helpers@^1.1.0:
5151+
version "1.1.0"
5152+
resolved "https://registry.yarnpkg.com/ember-cli-babel-plugin-helpers/-/ember-cli-babel-plugin-helpers-1.1.0.tgz#de3baedd093163b6c2461f95964888c1676325ac"
5153+
integrity sha512-Zr4my8Xn+CzO0gIuFNXji0eTRml5AxZUTDQz/wsNJ5AJAtyFWCY4QtKdoELNNbiCVGt1lq5yLiwTm4scGKu6xA==
5154+
5155+
5156+
version "7.7.3"
5157+
resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-7.7.3.tgz#f94709f6727583d18685ca6773a995877b87b8a0"
5158+
integrity sha512-/LWwyKIoSlZQ7k52P+6agC7AhcOBqPJ5C2u27qXHVVxKvCtg6ahNuRk/KmfZmV4zkuw4EjTZxfJE1PzpFyHkXg==
50615159
dependencies:
50625160
"@babel/core" "^7.0.0"
5161+
"@babel/plugin-proposal-class-properties" "^7.3.4"
5162+
"@babel/plugin-proposal-decorators" "^7.3.0"
50635163
"@babel/plugin-transform-modules-amd" "^7.0.0"
50645164
"@babel/plugin-transform-runtime" "^7.2.0"
50655165
"@babel/polyfill" "^7.0.0"
@@ -5074,6 +5174,7 @@ [email protected]:
50745174
broccoli-funnel "^2.0.1"
50755175
broccoli-source "^1.1.0"
50765176
clone "^2.1.2"
5177+
ember-cli-babel-plugin-helpers "^1.1.0"
50775178
ember-cli-version-checker "^2.1.2"
50785179
ensure-posix-path "^1.0.2"
50795180
semver "^5.5.0"
@@ -7901,9 +8002,11 @@ imurmurhash@^0.1.4:
79018002

79028003
"in-repo-a@link:tests/dummy/lib/in-repo-a":
79038004
version "0.0.0"
8005+
uid ""
79048006

79058007
"in-repo-b@link:tests/dummy/lib/in-repo-b":
79068008
version "0.0.0"
8009+
uid ""
79078010

79088011
include-path-searcher@^0.1.0:
79098012
version "0.1.0"

0 commit comments

Comments
 (0)