0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

wip: improve custom element detection

This commit is contained in:
Nate Moore 2022-04-25 11:24:49 -04:00
parent cafd36ef77
commit d6a834488b

View file

@ -139,10 +139,17 @@ export class Metadata {
private findComponentMetadata(Component: any): ComponentMetadata | null {
const isCustomElement = typeof Component === 'string';
const ComponentConstructor = isCustomElement ? customElements.get(Component) : null;
for (const { module, specifier } of this.modules) {
const id = this.resolvePath(specifier);
for (const [key, value] of Object.entries(module)) {
if (isCustomElement) {
if (ComponentConstructor === value) {
return {
componentExport: key,
componentUrl: id
}
}
if (key === 'tagName' && Component === value) {
return {
componentExport: key,