@uniorg/localneo
Advanced tools
+4
-1
| { | ||
| "name": "@uniorg/localneo", | ||
| "version": "1.6.0", | ||
| "version": "1.7.0", | ||
| "author": "m.schmale@uniorg.de", | ||
@@ -17,2 +17,5 @@ "license": "MIT", | ||
| "homepage": "https://github.com/UNIORG-Solutions/localneo", | ||
| "publishConfig": { | ||
| "@uniorg:registry": "https://registry.npmjs.org/" | ||
| }, | ||
| "bin": { | ||
@@ -19,0 +22,0 @@ "localneo": "./start.js" |
+43
-20
@@ -35,3 +35,3 @@ const fs = require('fs') | ||
| return new TargetInfo({ path, desc, target, name }) | ||
| return new TargetInfo({path, desc, target, name}) | ||
| }) | ||
@@ -60,3 +60,3 @@ | ||
| case 'application': | ||
| if (!this.dest.applications || !this.dest.applications[ targetInfo.name ]) { | ||
| if (!this.dest.applications || !this.dest.applications[targetInfo.name]) { | ||
| console.error(`${this.name}: cannot find application definition for target ${targetInfo.name}`) | ||
@@ -70,3 +70,6 @@ if (reg.has('app:' + targetInfo.name)) { | ||
| let app = this.getAppTarget(this.dest.applications[ targetInfo.name ]) | ||
| let app = this.getAppTarget(Object.assign({ | ||
| name: targetInfo.name, | ||
| localUrl: targetPath | ||
| }, this.dest.applications[targetInfo.name])) | ||
@@ -78,3 +81,3 @@ if (app) { | ||
| case 'destination': | ||
| if (!this.dest.destinations || !this.dest.destinations[ targetInfo.name ]) { | ||
| if (!this.dest.destinations || !this.dest.destinations[targetInfo.name]) { | ||
| console.error(`${this.name}: cannot find destination definition for target ${targetInfo.name}`) | ||
@@ -88,3 +91,3 @@ if (reg.has('dest:' + targetInfo.name)) { | ||
| let dest = this.getDestTarget(this.dest.destinations[ targetInfo.name ], targetInfo, targetPath) | ||
| let dest = this.getDestTarget(this.dest.destinations[targetInfo.name], targetInfo, targetPath) | ||
| if (dest) { | ||
@@ -97,10 +100,15 @@ reg.put('dest:' + targetInfo.name, dest) | ||
| let serviceConfig = {} | ||
| if (this.dest && this.dest.service && this.dest.service[ targetInfo.name ]) { | ||
| serviceConfig = this.dest.service[ targetInfo.name ] | ||
| if (this.dest && this.dest.service && this.dest.service[targetInfo.name]) { | ||
| serviceConfig = this.dest.service[targetInfo.name] | ||
| } | ||
| return ServiceFactory.create(targetInfo, targetPath, serviceConfig) | ||
| if (!reg.has(`srv:${targetInfo.name}@${targetInfo.entryPath}`)) { | ||
| reg.put(`srv:${targetInfo.name}@${targetInfo.entryPath}`, ServiceFactory.create(targetInfo, targetPath, serviceConfig)) | ||
| } | ||
| return reg.get(`srv:${targetInfo.name}@${targetInfo.entryPath}`) | ||
| } | ||
| } | ||
| getDestTarget ({ url: proxyUrl, auth }, { entryPath }, incomingPath) { | ||
| getDestTarget ({url: proxyUrl, auth}, {entryPath}, incomingPath) { | ||
| return new Destination({ | ||
@@ -114,3 +122,14 @@ url: proxyUrl, | ||
| getAppTarget ({ path: appPath, name }) { | ||
| directoryExists (path) { | ||
| try { | ||
| return !fs.statSync(path).isDirectory() | ||
| } catch (err) { | ||
| if (err.code !== 'ENOENT') { | ||
| console.error(err) | ||
| } | ||
| return false | ||
| } | ||
| } | ||
| getAppTarget ({path: appPath, name, remotePath, preferLocal, localUrl}) { | ||
| if (!path.isAbsolute(appPath)) { | ||
@@ -120,14 +139,18 @@ appPath = path.normalize(path.join(this.dir, appPath)) | ||
| try { | ||
| if (!fs.statSync(appPath).isDirectory()) { | ||
| console.error(`cannot find direcory "${appPath}" for target ${name}`) | ||
| } | ||
| } catch (err) { | ||
| if (err.code === 'ENOENT') { | ||
| console.error(`cannot find direcory "${appPath}" for target ${name}`) | ||
| } else { | ||
| console.error(err) | ||
| } | ||
| const dirExists = this.directoryExists(appPath) | ||
| if (!dirExists && remotePath === undefined) { | ||
| console.error(`cannot find direcory "${appPath}" for target ${name}`) | ||
| return | ||
| } | ||
| if (remotePath && (preferLocal === false || !dirExists)) { | ||
| // proxy remote | ||
| console.warn(`redirecting to remote destination ${remotePath}`) | ||
| return new Destination({ | ||
| url: remotePath, | ||
| localPath: localUrl | ||
| }) | ||
| } | ||
| let appReader = MapReader.fromApplicationDirectory(appPath) | ||
@@ -134,0 +157,0 @@ |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
50555
1.42%454
3.89%