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:
parent
cafd36ef77
commit
d6a834488b
1 changed files with 7 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue