From 1c9b97a94d0abb31780394abccc1a5b474633461 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Thu, 28 May 2020 22:06:14 -0400 Subject: [PATCH 1/2] Update babel-plugin-ember-modules-api-polyfill to fix issues with invalid identifiers. The babel plugin previously took an identifier and replaced it's `name` value with one that included a string like `Ember.Foo`. This is completely invalid (a string like `Ember.Foo` is actually a MemberExpression), but we got away with it because for the most part Babel happily printed **whatever** value you give it in that spot. Unfortunately, this happy mistake has caused us quite a bit of pain due to Babel introducing new plugins that run as part of `@babel/preset-env` (e.g. to make sure that all identifiers would work properly on IE9), and those plugins **properly** sanitizing invalid identifiers. The plugin was updated to avoid this mistake, and properly rewrite the identifiers with a member expression. It also added tests to confirm things are working as intended. --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8a937850..6fd1510f 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "amd-name-resolver": "^1.2.1", "babel-plugin-debug-macros": "^0.3.0", "babel-plugin-ember-data-packages-polyfill": "^0.1.2", - "babel-plugin-ember-modules-api-polyfill": "^2.13.0", + "babel-plugin-ember-modules-api-polyfill": "^2.13.1", "babel-plugin-module-resolver": "^3.1.1", "broccoli-babel-transpiler": "^7.4.0", "broccoli-debug": "^0.6.4", diff --git a/yarn.lock b/yarn.lock index 93d5a06d..8ac6af3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1574,10 +1574,10 @@ babel-plugin-ember-modules-api-polyfill@^2.12.0, babel-plugin-ember-modules-api- dependencies: ember-rfc176-data "^0.3.12" -babel-plugin-ember-modules-api-polyfill@^2.13.0: - version "2.13.0" - resolved "https://registry.yarnpkg.com/babel-plugin-ember-modules-api-polyfill/-/babel-plugin-ember-modules-api-polyfill-2.13.0.tgz#f9d3928d4c40192a44a5b52b67bbdedc4a748ea2" - integrity sha512-Q2i7uZMNSuJFYUV8stEsLQIRfMhQJew62sOnR+ESNjb4vlI7Rj1JlSgymTGwmCTVh+poTBpMidiWCoITDtbiIA== +babel-plugin-ember-modules-api-polyfill@^2.13.1: + version "2.13.1" + resolved "https://registry.yarnpkg.com/babel-plugin-ember-modules-api-polyfill/-/babel-plugin-ember-modules-api-polyfill-2.13.1.tgz#a529ec260ee2c5af5b5696074b23334535100368" + integrity sha512-h9DZ4wD7LYfKK98bZ7Rf6EX7bi5bmfO/hS/jWdqFj4OrpBa4qwRUczBDU7tUlyLcOxyXvXa6+DzXk38I65Y7vA== dependencies: ember-rfc176-data "^0.3.13" From 9dd600dada51e55b11e37f6bae4126865448fe1e Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Thu, 28 May 2020 22:22:59 -0400 Subject: [PATCH 2/2] Update test assertion to work properly. This previously passed by _relying_ on the bug that was fixed in the modules API polyfill. --- node-tests/addon-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-tests/addon-test.js b/node-tests/addon-test.js index d593e4b4..19c7ff29 100644 --- a/node-tests/addon-test.js +++ b/node-tests/addon-test.js @@ -203,7 +203,7 @@ describe('ember-cli-babel', function() { expect(contents).to.not.include('@ember/debug'); expect(contents).to.include('function _asyncToGenerator'); - expect(contents).to.include('Ember.inspect;'); + expect(contents).to.include('inspect.call'); expect(contents).to.not.include('assert'); })); });