Skip to content

Commit

Permalink
Merge pull request #313 from buschtoens/fix/actually-add-normalize-fo…
Browse files Browse the repository at this point in the history
…r-debug

fix(glimmer-wrapper): move debug `normalize` in `.extend()` block
  • Loading branch information
rwjblue committed Feb 15, 2019
2 parents 0cb9584 + c607a8a commit 86c1a9a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions mu-trees/addon/resolvers/glimmer-wrapper/index.js
Expand Up @@ -64,6 +64,16 @@ function cleanupEmberSpecifier(specifier, source, _namespace) {
return [specifier, source];
}

const normalize = !DEBUG ? null : 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;
};

/*
* Wrap the @glimmer/resolver in Ember's resolver API. Although
* this code extends from the DefaultResolver, it should never
Expand All @@ -82,7 +92,7 @@ const Resolver = GlobalsResolver.extend({
this._glimmerResolver = new GlimmerResolver(this.config, this.glimmerModuleRegistry);
},

normalize: null,
normalize,

expandLocalLookup(specifier, source, namespace) {
if (isAbsoluteSpecifier(specifier)) {
Expand Down Expand Up @@ -140,16 +150,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;

0 comments on commit 86c1a9a

Please sign in to comment.