Software /
code /
prosody
Annotate
loader.lua @ 12947:14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Actually `hg mv`-ing all the files is disruptive, basically breaking
everything from rebasing all my WIP draft commits to the package
building. So instead, what if we didn't and instead rewrote package
names as they are `require()`-d?
Debian packages produced by the Prosody are already installed into this
structure so much will Just Work if all require calls are updated.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 17 Mar 2023 13:51:43 +0100 |
child | 12948:29983f09c913 |
rev | line source |
---|---|
12947
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 for i = #package.searchers, 1, -1 do |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 local search = package.searchers[i]; |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 table.insert(package.searchers, i, function(module_name) |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 local lib = module_name:match("^prosody%.(.*)$"); |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 if lib then |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 return search(lib); |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 end |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 end) |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 end |