Skip to content

Commit

Permalink
Merge pull request #66 from Entrox-Licher/custom-root-fix
Browse files Browse the repository at this point in the history
Added a fix to allow files with non __root roots to still unbundle correctly
  • Loading branch information
argonui authored Nov 2, 2024
2 parents cd0fe9b + bca0e26 commit 834fdb9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bundler/luabundler.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ end)(nil)`
funcprefixReplace string = `SRC_LOCATION`
funcprefix string = `__bundle_register("SRC_LOCATION", function(require, _LOADED, __bundle_register, __bundle_modules)`
funcsuffix string = `end)`
// Rootname is the bundle name for the batch of raw lua
)

// Rootname is the bundle name for the batch of raw lua
var (
Rootname string = `__root`
)

Expand Down Expand Up @@ -91,6 +94,10 @@ func UnbundleAll(rawlua string) (map[string]string, error) {
if !IsBundled(rawlua) {
return map[string]string{Rootname: rawlua}, nil
}
newRootInd := regexp.MustCompile(`__bundle_require\(".*"\)`).FindStringIndex(rawlua)
if newRootInd != nil {
Rootname = rawlua[newRootInd[0]+18 : newRootInd[1]-2]
}
scripts := map[string]string{}
r, err := findNextBundledScript(rawlua)
for r.leftover != "" {
Expand Down

0 comments on commit 834fdb9

Please sign in to comment.