mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 01:46:14 -04:00
plugins: Default the module name to the plugin name
This commit is contained in:
parent
afb025030c
commit
cedd27e4fe
2 changed files with 25 additions and 11 deletions
|
@ -58,11 +58,13 @@ const callInit = async () => {
|
|||
}
|
||||
|
||||
exports.pathNormalization = function (part, hook_fn_name, hook_name) {
|
||||
const parts = hook_fn_name.split(':');
|
||||
const functionName = (parts.length > 1) ? parts.pop() : hook_name;
|
||||
const tmp = hook_fn_name.split(':'); // hook_fn_name might be something like 'C:\\foo.js:myFunc'.
|
||||
// If there is a single colon assume it's 'filename:funcname' not 'C:\\filename'.
|
||||
const functionName = (tmp.length > 1 ? tmp.pop() : null) || hook_name;
|
||||
const moduleName = tmp.join(':') || part.plugin;
|
||||
const packageDir = path.dirname(defs.plugins[part.plugin].package.path);
|
||||
const fileName = path.normalize(path.join(packageDir, parts.join(':')));
|
||||
return fileName + ((functionName == null) ? '' : (':' + functionName));
|
||||
const fileName = path.normalize(path.join(packageDir, moduleName));
|
||||
return `${fileName}:${functionName}`;
|
||||
}
|
||||
|
||||
exports.update = async function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue