rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
163 stars 46 forks source link

Tree shaking #183

Open TwitchBronBron opened 4 years ago

TwitchBronBron commented 4 years ago

We should add the ability to discard unused code. (Called tree shaking in JavaScript land).

This would mean removing functions that are never called, and components that are never used, and any other files in the package that are never referenced.

There are several edge cases that we will needs to guard against, like certain functions referenced by string name as callbacks, components added through node update() calls, and I'm sure some others as well. But we can develop patterns to support these edge cases.

This would allow for smaller package sizes.

chrisdp commented 3 years ago

To add to this we could likely expand this to give diagnostics to assist with cleaning out unused code. Or even like how typescript fades out unused vars.