esmodule-server
Advanced tools
Comparing version 0.1.0 to 0.2.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var meta_1 = require("./meta"); | ||
var mimetype_1 = require("./mimetype"); | ||
var http = require("http2"); | ||
var fs = require("fs"); | ||
var filepath = require("path"); | ||
var chalk_1 = require("chalk"); | ||
@@ -36,3 +38,3 @@ var document_root_path = process.cwd(); | ||
_a[http.constants.HTTP2_HEADER_STATUS] = 404, | ||
_a[http.constants.HTTP2_HEADER_CONTENT_TYPE] = 'text/plain; charset=utf-8', | ||
_a[http.constants.HTTP2_HEADER_CONTENT_TYPE] = 'text/plain', | ||
_a)); | ||
@@ -42,18 +44,11 @@ response.stream.end('Not found.'); | ||
else { | ||
var mimetype = mimetype_1.default(filepath.extname(path)); | ||
console.debug('File', path); | ||
console.debug('MimeType', mimetype); | ||
response.stream.respondWithFile(path, (_b = {}, | ||
_b[http.constants.HTTP2_HEADER_STATUS] = 200, | ||
_b[http.constants.HTTP2_HEADER_CONTENT_TYPE] = 'text/html; charset=utf-8', | ||
_b[http.constants.HTTP2_HEADER_CONTENT_TYPE] = mimetype, | ||
_b), { onError: function (error) { return console.error(error); } }); | ||
} | ||
}) | ||
// .on('stream', (stream, headers) => { | ||
// console.log(99) | ||
// stream.respond({ | ||
// [http.constants.HTTP2_HEADER_STATUS]: 200, | ||
// [http.constants.HTTP2_HEADER_CONTENT_TYPE]: 'text/html; charset=utf-8', | ||
// }) | ||
// stream.on('error', (error) => console.error(error)) | ||
// stream.end('hello world!') | ||
// }) | ||
.on('sessionError', function (error) { | ||
@@ -60,0 +55,0 @@ console.error('Session Error', error); |
{ | ||
"name": "esmodule-server", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "ECMAScript-Module (ES Module) web server.", | ||
@@ -14,3 +14,3 @@ "author": "Jumilla <fumio@jumilla.me>", | ||
"bin": { | ||
"esmc": "bin/esms.js" | ||
"esms": "bin/esms.js" | ||
}, | ||
@@ -44,3 +44,3 @@ "main": "lib/cli.js", | ||
}, | ||
"gitHead": "2fc52a1da0116d4479444579676d5a79f185403c" | ||
"gitHead": "ecc47493c51ec6fcb5c21c152cc1ddd4a138bc4e" | ||
} |
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
19671
12
218