in src/main/java/org/apache/sling/scripting/esx/Module.java [593:608]
public ModuleScript loadLocalModule(String module, Resource currentResource, boolean isFile, String loader) throws ScriptException {
String basePath = (resourceIsfile(currentResource))
? currentResource.getParent().getPath() : currentResource.getPath();
String path = normalizePath(module, basePath);
if (module.startsWith("/")) {
path = module;
}
ModuleScript script = loadAsFile(module, path, currentResource, loader);
if (script != null) {
return script;
}
return loadAsDirectory(module, path, currentResource, loader); // load as directory
}