New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Script Loader #883
Comments
Looks pretty good 🚀, do you want to open a pr for this?. cc: @manast |
@roggervalf Will do. Just give me a day or so to cleanup |
This looks indeed amazing and would help us a lot in refactoring all the lua scripts we have. |
Had some git issues. I'll push the PR tomorrow. |
Closing it as the feature was released already 🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RFC: scriptLoader
A replacement for the script loading mechanism in
bullmq
See WIP branch here and tests here
Why ?
To allow modularity and composability of
lua
scripts, with recursive dependency handling and path mapping.Example
isNil.lua
string.lua
math.lua
utils.lua
app.js
result
All children are loaded transitively and in dependency order to any depth.
Path mapping is supported, so we can do the following:
utils.lua
app.ts
The
~
character at the beginning of an include maps to the project root (location of the project'spackage.json
)For convenience, we can do
glob
includesutils.lua
--- @include "<includes>/util-*.lua"
API
loadScript() function
Signature:
Parameters
Returns:
string
The interpolated script
addScriptPathMapping() function
Add a script path mapping. Allows @includes of the form
<includes>/utils.lua
whereincludes
is a userdefined path.
Signature:
Parameters
Returns:
void
The text was updated successfully, but these errors were encountered: