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

@hono/node-server

Package Overview
Dependencies
Maintainers
0
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/node-server - npm Package Compare versions

Comparing version 1.11.4 to 1.11.5

100

dist/serve-static.js

@@ -27,96 +27,4 @@ "use strict";

var import_fs = require("fs");
// node_modules/hono/dist/utils/filepath.js
var getFilePath = (options) => {
let filename = options.filename;
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) {
return;
}
let root = options.root || "";
const defaultDocument = options.defaultDocument || "index.html";
if (filename.endsWith("/")) {
filename = filename.concat(defaultDocument);
} else if (!filename.match(/\.[a-zA-Z0-9]+$/)) {
filename = filename.concat("/" + defaultDocument);
}
filename = filename.replace(/^\.?[\/\\]/, "");
filename = filename.replace(/\\/, "/");
root = root.replace(/\/$/, "");
let path = root ? root + "/" + filename : filename;
path = path.replace(/^\.?\//, "");
return path;
};
// node_modules/hono/dist/utils/mime.js
var getMimeType = (filename, mimes = baseMimes) => {
const regexp = /\.([a-zA-Z0-9]+?)$/;
const match = filename.match(regexp);
if (!match) {
return;
}
let mimeType = mimes[match[1]];
if (mimeType && mimeType.startsWith("text") || mimeType === "application/json") {
mimeType += "; charset=utf-8";
}
return mimeType;
};
var baseMimes = {
aac: "audio/aac",
avi: "video/x-msvideo",
avif: "image/avif",
av1: "video/av1",
bin: "application/octet-stream",
bmp: "image/bmp",
css: "text/css",
csv: "text/csv",
eot: "application/vnd.ms-fontobject",
epub: "application/epub+zip",
gif: "image/gif",
gz: "application/gzip",
htm: "text/html",
html: "text/html",
ico: "image/x-icon",
ics: "text/calendar",
jpeg: "image/jpeg",
jpg: "image/jpeg",
js: "text/javascript",
json: "application/json",
jsonld: "application/ld+json",
map: "application/json",
mid: "audio/x-midi",
midi: "audio/x-midi",
mjs: "text/javascript",
mp3: "audio/mpeg",
mp4: "video/mp4",
mpeg: "video/mpeg",
oga: "audio/ogg",
ogv: "video/ogg",
ogx: "application/ogg",
opus: "audio/opus",
otf: "font/otf",
pdf: "application/pdf",
png: "image/png",
rtf: "application/rtf",
svg: "image/svg+xml",
tif: "image/tiff",
tiff: "image/tiff",
ts: "video/mp2t",
ttf: "font/ttf",
txt: "text/plain",
wasm: "application/wasm",
webm: "video/webm",
weba: "audio/webm",
webp: "image/webp",
woff: "font/woff",
woff2: "font/woff2",
xhtml: "application/xhtml+xml",
xml: "application/xml",
zip: "application/zip",
"3gp": "video/3gpp",
"3g2": "video/3gpp2",
gltf: "model/gltf+json",
glb: "model/gltf-binary"
};
// src/serve-static.ts
var import_filepath = require("hono/utils/filepath");
var import_mime = require("hono/utils/mime");
var createStreamBody = (stream) => {

@@ -144,3 +52,3 @@ const body = new ReadableStream({

const filename = options.path ?? decodeURIComponent(c.req.path);
let path = getFilePath({
let path = (0, import_filepath.getFilePath)({
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,

@@ -158,3 +66,3 @@ root: options.root,

}
const mimeType = getMimeType(path);
const mimeType = (0, import_mime.getMimeType)(path);
if (mimeType) {

@@ -161,0 +69,0 @@ c.header("Content-Type", mimeType);

6

package.json
{
"name": "@hono/node-server",
"version": "1.11.4",
"version": "1.11.5",
"description": "Node.js Adapter for Hono",

@@ -50,3 +50,3 @@ "main": "dist/index.js",

"test": "node --expose-gc ./node_modules/.bin/jest",
"build": "tsup",
"build": "tsup --external hono",
"watch": "tsup --watch",

@@ -82,3 +82,3 @@ "postbuild": "publint",

"eslint": "^8.55.0",
"hono": "^4.0.3",
"hono": "^4.4.10",
"jest": "^29.6.1",

@@ -85,0 +85,0 @@ "np": "^7.7.0",

Sorry, the diff of this file is not supported yet

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