Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@11ty/eleventy-dev-server

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@11ty/eleventy-dev-server - npm Package Compare versions

Comparing version 1.0.0-canary.4 to 1.0.0-canary.5

2

package.json
{
"name": "@11ty/eleventy-dev-server",
"version": "1.0.0-canary.4",
"version": "1.0.0-canary.5",
"description": "A minimal, modern, generic, hot-reloading local web server to help web developers.",

@@ -5,0 +5,0 @@ "main": "server.js",

@@ -229,2 +229,19 @@ const pkg = require("./package.json");

renderFile(filepath, res) {
let contents = fs.readFileSync(filepath);
let mimeType = mime.getType(filepath);
if (mimeType === "text/html") {
res.setHeader("Content-Type", `text/html; charset=${this.options.encoding}`);
// the string is important here, wrapResponse expects strings internally for HTML content (for now)
return res.end(contents.toString());
}
if (mimeType) {
res.setHeader("Content-Type", mimeType);
}
return res.end(contents);
}
requestMiddleware(req, res) {

@@ -265,23 +282,18 @@ // Known issue with `finalhandler` and HTTP/2:

if (match.statusCode === 200 && match.filepath) {
let contents = fs.readFileSync(match.filepath);
let mimeType = mime.getType(match.filepath);
if (mimeType === "text/html") {
res.setHeader("Content-Type", `text/html; charset=${this.options.encoding}`);
// the string is important here, wrapResponse expects strings internally for HTML content (for now)
return res.end(contents.toString());
}
return this.renderFile(match.filepath, res);
}
if (mimeType) {
res.setHeader("Content-Type", mimeType);
}
return res.end(contents);
let raw404Path = this.getOutputDirFilePath("404.html");
if(match.statusCode === 404 && this.isOutputFilePathExists(raw404Path)) {
res.statusCode = match.statusCode;
return this.renderFile(raw404Path, res);
}
// TODO add support for 404 pages (in different Jamstack server configurations)
// Redirects
if (match.url) {
res.writeHead(match.statusCode, {
Location: match.url,
});
res.statusCode = match.statusCode;
res.setHeader("Location", match.url);
return res.end();
}
}

@@ -288,0 +300,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc