dundalek / react-blessed-contrib

A wrapper for blessed-contrib widgets to be rendered with react-blessed.
MIT License
61 stars 9 forks source link

Support for neo-blessed possible? #6

Open philraj opened 5 years ago

philraj commented 5 years ago

(Sorry for spamming you with so many issues)

Is there any way you can think of to get this to work when using a blessed fork like neo-blessed?

I noticed that the way this interacts with react-blessed is by patching the blessed object with a fake element type. I don't know if there's a cleaner way than making it an optional peer dependency and using something like require.resolve to see if neo-blessed is being used.

I know it's a less probable use case, but unfortunately the standard blessed has strange bugs that will probably never be fixed.

dundalek commented 5 years ago

Thanks, no problem, I appreciate the input!

I didn't know about neo-blessed. It sounds like a good idea to support it, too. I think it should be possible by trying to patch both by wrapping that in try/catch. I will give it a try.

dundalek commented 5 years ago

I gave it some more thought. I think the trouble is that both react-blessed and blessed-contrib load blessed internally. So even if we patched neo-blessed the original blessed would be still used.

So the question is if there is a way to override blessed in react-blessed and blessed-contrib. If that is somehow possible then adding support to react-blessed-contrib would be then pretty simple.

philraj commented 5 years ago

https://github.com/Yomguithereal/react-blessed/blob/master/README.md#using-blessed-forks

This is the supported way to override which blessed is being used, so at least on that side it is possible.

dundalek commented 5 years ago

Oh, that's neat. Now only if there would be a similar approach for blessed-contrib.

lirantal commented 5 years ago

@dundalek I have access to blessed-contrib and can merge and push releases as required. It would be helpful though if you or others could help triage PRs there as I'm less informed on the internals.

dustinlacewell commented 3 years ago

I'm really hoping this happens some day.

dundalek commented 3 years ago

@dustinlacewell It looks like there is another option now since npm v6.9.0 introduced support for module aliases. You should be able to install neo-blessed as blessed with npm install blessed@npm:neo-blessed and things should just work.

lirantal commented 3 years ago

☝️ love this hack idea!

@dustinlacewell - are there any specific updates in neo-blessed that you are looking for?