You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first part is making builtins transformation more generic. Currently all helpers are used imperatively. A declarative solution should make code cleaner and allow some features that currently can't be implemented:
Non-call references ([1.5, 2.5].map(Math.floor))
Expose static information about supported builtins (for language service plugin)
Some sort of plugin system (since we can't really support polyfilling). It probably should use the same API as Pluggable transformer design #615.
Importing changes
The second part is helper files location.
First thing, I think we should completely drop inlining. TSTL helpers have a completely different use case compared to TS ones - they are a lot bigger and used more commonly (in TS they are used only for syntactic transforms, not for builtins). They are actually more similar to polyfills, which aren't inlined by any popular transpiler. In addition they can cause some huge issues due to having different references. The only use case for inlining is environments without module support, which should be covered by bundling.
Requirements:
Using one helper shouldn't load all of them
Helpers should be shared between modules when possible
Transformation changes
The first part is making builtins transformation more generic. Currently all helpers are used imperatively. A declarative solution should make code cleaner and allow some features that currently can't be implemented:
[1.5, 2.5].map(Math.floor))Importing changes
The second part is helper files location.
First thing, I think we should completely drop inlining. TSTL helpers have a completely different use case compared to TS ones - they are a lot bigger and used more commonly (in TS they are used only for syntactic transforms, not for builtins). They are actually more similar to polyfills, which aren't inlined by any popular transpiler. In addition they can cause some huge issues due to having different references. The only use case for inlining is environments without module support, which should be covered by bundling.
Requirements:
forRangeandluaTable)Option 1
Keep helpers where they are, import them with absolute requires.
Option 2
Distribute helpers as a separate package, import them as modules.