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

fix(glimmer-wrapper): move debug normalize in .extend() block #313

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 9 additions & 13 deletions mu-trees/addon/resolvers/glimmer-wrapper/index.js
Expand Up @@ -82,7 +82,15 @@ const Resolver = GlobalsResolver.extend({
this._glimmerResolver = new GlimmerResolver(this.config, this.glimmerModuleRegistry);
},

normalize: null,
normalize: !DEBUG ? null : function(specifier) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you hoist this above? Something like:

const normalize = !DEBUG ? null : function normalize(specifier) {
  // ...snip...
};

GlobalsResolver.extend({
  // ...snip...
  normalize,
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 👍

// This method is called by `Registry#validateInjections` in dev mode.
// https://github.com/ember-cli/ember-resolver/issues/299
const [type, name] = specifier.split(':', 2);
if (name && (type === 'service' || type === 'controller')) {
return `${type}:${dasherize(name)}`;
}
return specifier;
},

expandLocalLookup(specifier, source, namespace) {
if (isAbsoluteSpecifier(specifier)) {
Expand Down Expand Up @@ -140,16 +148,4 @@ const Resolver = GlobalsResolver.extend({

});

if (DEBUG) {
Resolver.prototype.normalize = function(specifier) {
// This method is called by `Registry#validateInjections` in dev mode.
// https://github.com/ember-cli/ember-resolver/issues/299
const [type, name] = specifier.split(':', 2);
if (name && (type === 'service' || type === 'controller')) {
return `${type}:${dasherize(name)}`;
}
return specifier;
}
}

export default Resolver;