Seems like you could create two modules, where each provide a different entry point. Both would inherit from the common logic module. Each then has a different boostrap JavaScript URL (the .nocache.js). Disadvantage is that those will be completely different scripts to browser, so no caching benefits if you switch between widget and full version.
You can also do simple test within entry point method whether the entry point should be executed - just return if not. You can for instance check whether expected container element exists in DOM, or URL, or whatever. There is no much problem if two entry points are executed in a single module.