feat: do not include redundant metadata

This commit is contained in:
Nate Moore 2023-08-15 13:49:43 -05:00
parent c70396e72d
commit 5628e62194

View file

@ -155,7 +155,7 @@ export async function generateHydrateScript(
// Add renderer url
if (renderer.clientEntrypoint) {
scriptProps['componentExport'] = componentExport.value;
if (componentExport.value !== 'default') scriptProps['componentExport'] = componentExport.value;
scriptProps['rendererUrl'] = await result.resolve(decodeURI(renderer.clientEntrypoint));
}
@ -165,11 +165,16 @@ export async function generateHydrateScript(
if (beforeHydrationUrl.length) {
scriptProps['beforeHydrationUrl'] = beforeHydrationUrl;
}
scriptProps['opts'] = {
name: metadata.displayName,
value: metadata.hydrateArgs || '',
scriptProps['opts'] = {};
if (metadata.displayName) {
scriptProps.opts.name = metadata.displayName;
}
if (metadata.hydrateArgs !== true) {
scriptProps.opts.value = metadata.hydrateArgs;
}
if (typeof props === 'object' && Object.keys(props).length > 0) {
scriptProps['props'] = props;
}
scriptProps['props'] = props;
transitionDirectivesToCopyOnIsland.forEach((name) => {
if (props[name]) {