diff --git a/packages/astro/src/runtime/server/astro-island.ts b/packages/astro/src/runtime/server/astro-island.ts index cf821a634..ed789939a 100644 --- a/packages/astro/src/runtime/server/astro-island.ts +++ b/packages/astro/src/runtime/server/astro-island.ts @@ -10,14 +10,27 @@ declare const Astro: { opts: Record, root: HTMLElement ) => void; -}; +} + +interface IslandMeta { + componentUrl: string; + rendererUrl: string; + beforeHydrationUrl?: string; + componentExport?: string; + props: Record; + opts: Record; +} { - // @ts-ignore - (self.Astro || (self.Astro = {})).assign = (script,value) => { - Object.assign(script.parentElement,value); - script.remove(); - }; + // island meta info (for all islands) is stored here + var $meta: Record = {}; + // Astro.assign is called in injected scripts + (self as any).Astro = Object.assign((self as any).Astro || {}, { + assign(script: HTMLElement, value: any) { + $meta[(script.parentElement as any).getAttribute('uid')] = value; + script.remove(); + } + }) if (!customElements.get('astro-island')) { customElements.define( @@ -25,16 +38,11 @@ declare const Astro: { class extends HTMLElement { public Component: any; public hydrator: any; - - // These props are injected by the Astro runtime via inline `