backend-plus 2.6.8 → 2.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2063,6 +2063,18 @@ function require_resolve(moduleName){
2063
2063
  return resolved;
2064
2064
  }
2065
2065
 
2066
+ /* MEJORA:
2067
+ function module_root_dir(file){
2068
+ var dir = Path.dirname(file);
2069
+ while(!fs.existsSync(Path.join(dir,'package.json'))){
2070
+ var parent = Path.dirname(dir);
2071
+ if(parent==dir){ return Path.dirname(file); }
2072
+ dir = parent;
2073
+ }
2074
+ return dir;
2075
+ }
2076
+ // */
2077
+
2066
2078
  function resolve_module_dir(moduleName,path,fileToCheck){
2067
2079
  var baseDir;
2068
2080
  if(packagejson.name==moduleName){
@@ -2070,12 +2082,13 @@ function resolve_module_dir(moduleName,path,fileToCheck){
2070
2082
  }else{
2071
2083
  baseDir=require_resolve(moduleName);
2072
2084
  }
2085
+ // var resultDir = Path.join(path?module_root_dir(baseDir):Path.dirname(baseDir),path||'');
2073
2086
  var resultDir = Path.join(Path.dirname(baseDir),path||'');
2074
2087
  if (fileToCheck) {
2075
2088
  fs.stat(Path.join(resultDir, fileToCheck)).then(function(status){
2076
2089
  if (!status) {
2077
2090
  console.error('Error resolve_module_dir in:',resultDir,'no:',fileToCheck);
2078
- } else if(!status.isFile()) {
2091
+ } else if(!status.isFile() && fileToCheck != '.') {
2079
2092
  console.error('Error resolve_module_dir in:',resultDir,',',fileToCheck,'is not a file');
2080
2093
  }
2081
2094
  },function(err){
@@ -2276,6 +2289,7 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
2276
2289
  baseUrl='';
2277
2290
  }
2278
2291
  let baseLib = baseUrl + '/' + (moduleDef.path ? moduleDef.path : be.esJavascript(moduleDef.type)? 'lib': 'css');
2292
+ resolve_module_dir(moduleDef.module, moduleDef.modPath, moduleDef.file ?? '.')
2279
2293
  try {
2280
2294
  var allowedExts=(moduleDef.type=='js'?['js','map']:[moduleDef.type]);
2281
2295
  mainApp.use(baseLib, serveContent(resolve_module_dir(moduleDef.module, moduleDef.modPath), { allowedExts }));
@@ -2354,10 +2368,10 @@ AppBackend.prototype.clientIncludes = function clientIncludes(req, opts) {
2354
2368
  var list = [];
2355
2369
  if (!hideBEPlusInclusions) {
2356
2370
  list = [
2357
- { type: 'js', module: 'js-yaml', modPath: 'dist', file: 'js-yaml.js' },
2358
2371
  // { type: 'js', module: 'xlsx', modPath: 'dist', file: 'xlsx.core.min.js' },
2359
2372
  { type: 'js', module: 'xlsx', modPath: 'dist', file: 'xlsx.full.min.js' },
2360
2373
  { type: 'js', module: 'require-bro' },
2374
+ { type: 'js', module: 'js-yaml', modPath: 'browser', file: 'js-yaml.umd.min.js' },
2361
2375
  { type: 'js', module: 'cast-error' },
2362
2376
  { type: 'js', module: 'lazy-some' },
2363
2377
  { type: 'js', module: 'like-ar' },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "backend-plus",
3
3
  "description": "Backend for the anti Pareto rule",
4
- "version": "2.6.8",
4
+ "version": "2.6.9",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",
@@ -69,7 +69,7 @@
69
69
  "pug": "^3.0.4",
70
70
  "read-yaml-promise": "^1.0.2",
71
71
  "regexplicit": "^0.1.3",
72
- "require-bro": "^0.3.4",
72
+ "require-bro": "^0.3.5",
73
73
  "self-explain": "^0.11.0",
74
74
  "serve-content": "^1.0.4",
75
75
  "session-file-store": "^1.5.0",