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.
9885069--1426419--upload_2024-6-11_19-13-46.png

9885069--1426422--upload_2024-6-11_19-14-18.png

Here are the scripts that interest me (parent folder: Packages/PrimeTween):
9885069--1426425--upload_2024-6-11_19-15-7.png

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:
https://discussions.unity.com/t/923345/2

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.