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 all commits
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
24 changes: 11 additions & 13 deletions mu-trees/addon/resolvers/glimmer-wrapper/index.js
Original file line number Diff line number Diff line change
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;