Roslyn Analyzer/Source Generator for other Packages, is it possible to create one?

Hey, lately I've been playing with Roslyn analyzer and source generator. I managed to create one according to the instructions in the documentation. Its main idea is to scan scripts created by the developer and scan scripts from the installed packages (PrimeTween package, to be more precise), looking for functions for tweening, and for each such function, I wanted to create a separate class based on it.

Unfortunately, the analyzer can only scan scripts located in the Assets folder, but cannot in the Packages/PrimeTween folder (I tried installing it from the tgz local-tarball format, but also as embedded).

I even tried creating an Assembly Reference with a reference to PrimeTween.Runtime, but that didn't work either. The analyzer continued not to see the functions I wanted.


Here are the scripts that interest me (parent folder: Packages/PrimeTween):

The main question is:
Is scanning other Packages (not only Assets folder) with Roslyn Analyzer impossible? Is there any other way or am I doing something wrong?

I'm running into a similar problem trying to get MemoryPack working, and would love to know if there's a solution.

I quoted the documentation and looked into some details about analyzer/generator scope here:

Short answer: No, code inside packages requires an asmdef and asmdefs are only processed by analyzers/generators if they reference the asmdef containing the analyzer/generator (directly or indirectly). Since you cannot modify the asmdefs of read-only packages, you cannot add your analyzer/generator reference to them.

The only thing you could do is to embed those packages to make them writeable and then add a reference to your asmdef. This would run your analyzer on them but of course is only a temporary workaround.