How to install a dependency when a package extension is loaded?

Say I have a Project.toml structure as this one:

name = "MyPackage"

FirstDep = "..."
SecondDep = "..."

FirstWeakDep = "..."

ExtModule = "FirstWeakDep"

julia = "1.9"

and I want that when a user does using MyPackage, FirstWeakDep, when the extension is loaded the first time, a new package, say ThirdDep, gets installed. This way, I can import ThirdDep in ExtModule even though it wasn’t previously installed when the user did ]add MyPackage . After the first time, it shouldn’t install it again clearly, just import it.

In practice this would allow not installing ThirdDep when MyPackage gets installed but only when the extension is used the first time, which could be useful if ThirdDep requires a lot of time to install and it is needed just by a few users. Is there a way to do this? Should the Project.toml be changed somehow to achieve this?

I didn’t find anything in the documentation of Pkg.jl about this in the presentation of package extensions Conditional-loading-of-code-in-packages-(Extensions)