Add additional options for emitting lualib bundle#1662
Add additional options for emitting lualib bundle#1662MCJack123 wants to merge 3 commits intoTypeScriptToLua:masterfrom
Conversation
|
I think adding Regarding |
That would prevent the lualib from being imported entirely, i.e. there would be no |
|
This seems like a very specific use-case I would rather fix with the use of our existing plugin infrastructure rather than pulling this logic and configuration complexity into tstl core. I'm currently lacking sufficient motivation to want to merge something like this. |
This PR adds two new configuration options, which control how the lualib bundle is saved to disk:
luaLibName: Sets the name to use for the lualib bundle. For example, I find the namelualib_bundleto be vague, so I usually change it totypescriptto make it clear what the library is for.luaLibEmit: Setting this tofalseprevents the lualib bundle from being emitted. This is useful to avoid storing lualib in bundled code when it's available outside the bundle already, or simply to reduce generated file bloat.These options have been useful for my environment, where I have a multitude of common libraries in a store made available system-wide. Being able to change the name allows me to use a more descriptive file name in that store, and being able to suppress its generation means I don't have the duplicated file dangling around in bundles or the build directory.
Neither of these options can be accomplished through plugins. Changing the name in the generated code could be done with
moduleResolution(I haven't tried), but it would not change the generated file's name on disk or in a bundle, and would potentially break other parts of the code. Suppressing emission can't be done for a bundle, since the file is incorporated betweenafterPrintandbeforeEmitwith no chance to intervene.These changes will not affect users who do not use them; all default settings match how they were before.