Skip to content

Commit

Permalink
add comment explaining the code for backwards compat
Browse files Browse the repository at this point in the history
  • Loading branch information
stramel committed Oct 2, 2024
1 parent 313caaa commit 44cc6c2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/astro/src/assets/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ export function createSvgComponent({ meta, attributes, children }: SvgComponentP
makeNonEnumerable(Component);

if (import.meta.env.DEV) {
// Maintaining the current `console.log` output for SVG imports
Object.defineProperty(Component, Symbol.for('nodejs.util.inspect.custom'), {
value: (_: any, opts: any, inspect: any) => inspect(meta, opts),
});
}

// Attaching the metadata to the component to maintain current functionality
return Object.assign(Component, meta);
}

0 comments on commit 44cc6c2

Please sign in to comment.