How to find missing main components and variants

If you delete a main component or variant, an instance of it in the document will remain, but the only way to find it is to select it and see the “Restore Component” or “Missing variant” in the right panel.

Is there any way to list or explore the main component or its instances that are lost throughout the document or page?

I am the developer of the Figma Plugin, so any method utilizing the Figma API would be fine.

Thank you in advance.

Translated with DeepL Translate: The world's most accurate translator (free version)