Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid conflicting transforms for @ember/debug. #161

Merged
merged 4 commits into from
Jul 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ module.exports = {
if (this._emberVersionRequiresModulesAPIPolyfill()) {
const ModulesAPIPolyfill = require('babel-plugin-ember-modules-api-polyfill');

return [[ModulesAPIPolyfill]];
return [[ModulesAPIPolyfill, { blacklist: ['@ember/debug'] }]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think all of those are required (e.g. this blacklist doesn't prevent @ember/debug/data-adapter or @ember/debug/container-debug-adapter). The only one that is not supported by babel-plugin-debug-macros is Ember.inspect (which seems misplaced in @ember/debug IMHO).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so import { inspect } from '@ember/debug'; won't work at all after this PR?

}
},

Expand Down
18 changes: 18 additions & 0 deletions node-tests/addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ describe('ember-cli-babel', function() {
"foo.js": `define('foo', [], function () {\n 'use strict';\n\n var Component = Ember.Component;\n});`
});
}));

it("does not remove _asyncToGenerator helper function when used together with debug-macros", co.wrap(function* () {
input.write({
"foo.js": stripIndent`
import { assert } from '@ember/debug';
export default { async foo() { await this.baz; }}
`
});

subject = this.addon.transpileTree(input.path());
output = createBuilder(subject);

yield output.build();

let contents = output.read()['foo.js'];

expect(contents).to.include('function _asyncToGenerator');
}));
});

describe('debug macros', function() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"dependencies": {
"amd-name-resolver": "0.0.6",
"babel-plugin-debug-macros": "^0.1.10",
"babel-plugin-ember-modules-api-polyfill": "^1.2.0",
"babel-plugin-ember-modules-api-polyfill": "^1.3.0",
"babel-plugin-transform-es2015-modules-amd": "^6.24.0",
"babel-polyfill": "^6.16.0",
"babel-preset-env": "^1.5.1",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,9 @@ babel-plugin-debug-macros@^0.1.1, babel-plugin-debug-macros@^0.1.10, babel-plugi
dependencies:
semver "^5.3.0"

babel-plugin-ember-modules-api-polyfill@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-ember-modules-api-polyfill/-/babel-plugin-ember-modules-api-polyfill-1.2.0.tgz#f99f26040d4d29ae42fdc333553198940d59cf46"
babel-plugin-ember-modules-api-polyfill@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/babel-plugin-ember-modules-api-polyfill/-/babel-plugin-ember-modules-api-polyfill-1.3.0.tgz#0b32e3dfdee47f26942968f49d2d67ba85346ae3"
dependencies:
ember-rfc176-data "^0.1.0"

Expand Down