Skip to content

Classic host app has to use MU resolver to allow local lookups in MU addons #298

@buschtoens

Description

@buschtoens

If you want to use an MU addon with local lookup components in a classic host app, the host app has to use the MU resolver. Otherwise there's no expandLocalLookup.

expandLocalLookup(specifier, source, namespace) {
if (isAbsoluteSpecifier(specifier)) {
return specifier; // specifier is absolute
}
if (source || namespace) {
let rootName = namespace || this._configRootName;
let [type] = specifier.split(':');
/*
* Ember components require their lookupString to be massaged. Make this
* as "pay-go" as possible.
*/
if (namespace) {
// This is only required because:
// https://github.com/glimmerjs/glimmer-di/issues/45
source = `${type}:/${rootName}/`;
} else if (source) {
// make absolute
let parts = source.split(':src/ui/');
source = `${parts[0]}:/${rootName}/${parts[1]}`;
source = source.split('/template.hbs')[0];
}
let [_specifier, _source] = cleanupEmberSpecifier(specifier, source, rootName);
let absoluteSpecifier = this._glimmerResolver.identify(_specifier, _source);
if (absoluteSpecifier) {
return absoluteSpecifier;
}
absoluteSpecifier = this._glimmerResolver.identify(_specifier);
if (absoluteSpecifier) {
return specifier;
}
}
return specifier;
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions