@mappable-world/mappable-cli
Advanced tools
Comparing version 0.0.1-beta.38 to 0.0.1-beta.39
{ | ||
"name": "@mappable-world/mappable-cli", | ||
"version": "0.0.1-beta.38", | ||
"version": "0.0.1-beta.39", | ||
"description": "Library for encapsulating the logic of autotests and building packages mappable.world js API", | ||
@@ -53,2 +53,4 @@ "main": "dist/index.js", | ||
"utils", | ||
"cli", | ||
"mappable-cli", | ||
"packages" | ||
@@ -55,0 +57,0 @@ ], |
@@ -5,2 +5,13 @@ const path = require('path'); | ||
const EXT_MIME = { | ||
js: 'application/javascript', | ||
json: 'application/json', | ||
html: 'text/html', | ||
css: 'text/css', | ||
svg: 'image/svg+xml', | ||
png: 'image/png', | ||
jpg: 'image/jpeg', | ||
jpeg: 'image/jpeg' | ||
}; | ||
module.exports.replaceMiddleware = (dir) => (middleares, devServer) => { | ||
@@ -20,5 +31,5 @@ devServer.app.get('/*', (req, res, next) => { | ||
<ul>${fs | ||
.readdirSync(file) | ||
.map((p) => `<li><a href="${path.join(req.path, p)}">${p}</a></li>`) | ||
.join('')} | ||
.readdirSync(file) | ||
.map((p) => `<li><a href="${path.join(req.path, p)}">${p}</a></li>`) | ||
.join('')} | ||
</ul> | ||
@@ -31,2 +42,5 @@ </body> | ||
const extMatch = pathname.match(/(?<=\.)\w+$/); | ||
const mime = (extMatch && EXT_MIME[extMatch[0]]); | ||
let rs = fs.createReadStream(file); | ||
@@ -44,2 +58,4 @@ if (/\.html?$/.test(req.url)) { | ||
rs.pipe(res); | ||
mime && res.set({'Content-Type': mime}); | ||
}); | ||
@@ -46,0 +62,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43279
658