Socket
Socket
Sign inDemoInstall

hono

Package Overview
Dependencies
Maintainers
1
Versions
330
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hono - npm Package Compare versions

Comparing version 4.5.4 to 4.5.5

13

dist/adapter/bun/serve-static.js
// src/adapter/bun/serve-static.ts
import { serveStatic as baseServeStatic } from "../../middleware/serve-static/index.js";
import { stat } from "node:fs/promises";
var serveStatic = (options) => {

@@ -13,6 +14,16 @@ return async function serveStatic2(c, next) {

};
const isDir = async (path) => {
let isDir2;
try {
const stats = await stat(path);
isDir2 = stats.isDirectory();
} catch {
}
return isDir2;
};
return baseServeStatic({
...options,
getContent,
pathResolve
pathResolve,
isDir
})(c, next);

@@ -19,0 +30,0 @@ };

// src/adapter/deno/serve-static.ts
import { serveStatic as baseServeStatic } from "../../middleware/serve-static/index.js";
var { open } = Deno;
var { open, lstatSync } = Deno;
var serveStatic = (options) => {

@@ -17,6 +17,16 @@ return async function serveStatic2(c, next) {

};
const isDir = (path) => {
let isDir2;
try {
const stat = lstatSync(path);
isDir2 = stat.isDirectory;
} catch {
}
return isDir2;
};
return baseServeStatic({
...options,
getContent,
pathResolve
pathResolve,
isDir
})(c, next);

@@ -23,0 +33,0 @@ };

@@ -25,2 +25,3 @@ "use strict";

var import_serve_static = require("../../middleware/serve-static");
var import_promises = require("node:fs/promises");
const serveStatic = (options) => {

@@ -36,6 +37,16 @@ return async function serveStatic2(c, next) {

};
const isDir = async (path) => {
let isDir2;
try {
const stats = await (0, import_promises.stat)(path);
isDir2 = stats.isDirectory();
} catch {
}
return isDir2;
};
return (0, import_serve_static.serveStatic)({
...options,
getContent,
pathResolve
pathResolve,
isDir
})(c, next);

@@ -42,0 +53,0 @@ };

@@ -25,3 +25,3 @@ "use strict";

var import_serve_static = require("../../middleware/serve-static");
const { open } = Deno;
const { open, lstatSync } = Deno;
const serveStatic = (options) => {

@@ -40,6 +40,16 @@ return async function serveStatic2(c, next) {

};
const isDir = (path) => {
let isDir2;
try {
const stat = lstatSync(path);
isDir2 = stat.isDirectory;
} catch {
}
return isDir2;
};
return (0, import_serve_static.serveStatic)({
...options,
getContent,
pathResolve
pathResolve,
isDir
})(c, next);

@@ -46,0 +56,0 @@ };

8

dist/cjs/jsx/base.js

@@ -211,3 +211,5 @@ "use strict";

});
if (res instanceof Promise) {
if (typeof res === "boolean" || res == null) {
return;
} else if (res instanceof Promise) {
if (import_context.globalContexts.length === 0) {

@@ -307,7 +309,7 @@ buffer.unshift("", res);

const memo = (component, propsAreEqual = shallowEqual) => {
let computed = void 0;
let computed = null;
let prevProps = void 0;
return (props) => {
if (prevProps && !propsAreEqual(prevProps, props)) {
computed = void 0;
computed = null;
}

@@ -314,0 +316,0 @@ prevProps = props;

@@ -37,2 +37,11 @@ "use strict";

const root = options.root;
if (!filename.endsWith("/") && options.isDir) {
const path2 = (0, import_filepath.getFilePathWithoutDefaultDocument)({
filename,
root
});
if (path2 && await options.isDir(path2)) {
filename = filename + "/";
}
}
let path = (0, import_filepath.getFilePath)({

@@ -39,0 +48,0 @@ filename,

@@ -174,3 +174,5 @@ // src/jsx/base.ts

});
if (res instanceof Promise) {
if (typeof res === "boolean" || res == null) {
return;
} else if (res instanceof Promise) {
if (globalContexts.length === 0) {

@@ -270,7 +272,7 @@ buffer.unshift("", res);

var memo = (component, propsAreEqual = shallowEqual) => {
let computed = void 0;
let computed = null;
let prevProps = void 0;
return (props) => {
if (prevProps && !propsAreEqual(prevProps, props)) {
computed = void 0;
computed = null;
}

@@ -277,0 +279,0 @@ prevProps = props;

@@ -15,2 +15,11 @@ // src/middleware/serve-static/index.ts

const root = options.root;
if (!filename.endsWith("/") && options.isDir) {
const path2 = getFilePathWithoutDefaultDocument({
filename,
root
});
if (path2 && await options.isDir(path2)) {
filename = filename + "/";
}
}
let path = getFilePath({

@@ -17,0 +26,0 @@ filename,

@@ -6,3 +6,4 @@ import { HonoRequest } from './request';

import type { InvalidJSONValue, IsAny, JSONParsed, JSONValue, SimplifyDeepArray } from './utils/types';
type HeaderRecord = Record<string, string | string[]>;
import type { BaseMime } from './utils/mime';
type HeaderRecord = Record<'Content-Type', BaseMime> | Record<ResponseHeader, string | string[]> | Record<string, string | string[]>;
/**

@@ -162,2 +163,17 @@ * Data type can be a string, ArrayBuffer, or ReadableStream.

};
interface SetHeadersOptions {
append?: boolean;
}
type ResponseHeader = 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Age' | 'Allow' | 'Cache-Control' | 'Clear-Site-Data' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'ETag' | 'Expires' | 'Last-Modified' | 'Location' | 'Permissions-Policy' | 'Pragma' | 'Retry-After' | 'Save-Data' | 'Sec-CH-Prefers-Color-Scheme' | 'Sec-CH-Prefers-Reduced-Motion' | 'Sec-CH-UA' | 'Sec-CH-UA-Arch' | 'Sec-CH-UA-Bitness' | 'Sec-CH-UA-Form-Factor' | 'Sec-CH-UA-Full-Version' | 'Sec-CH-UA-Full-Version-List' | 'Sec-CH-UA-Mobile' | 'Sec-CH-UA-Model' | 'Sec-CH-UA-Platform' | 'Sec-CH-UA-Platform-Version' | 'Sec-CH-UA-WoW64' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-GPC' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'Strict-Transport-Security' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Vary' | 'WWW-Authenticate' | 'Warning' | 'X-Content-Type-Options' | 'X-DNS-Prefetch-Control' | 'X-Frame-Options' | 'X-Permitted-Cross-Domain-Policies' | 'X-Powered-By' | 'X-Robots-Tag' | 'X-XSS-Protection';
interface SetHeaders {
(name: 'Content-Type', value?: BaseMime, options?: SetHeadersOptions): void;
(name: ResponseHeader, value?: string, options?: SetHeadersOptions): void;
(name: string, value?: string, options?: SetHeadersOptions): void;
}
type ResponseHeadersInit = [string, string][] | Record<'Content-Type', BaseMime> | Record<ResponseHeader, string> | Record<string, string> | Headers;
interface ResponseInit {
headers?: ResponseHeadersInit;
status?: number;
statusText?: string;
}
export declare const TEXT_PLAIN = "text/plain; charset=UTF-8";

@@ -303,5 +319,3 @@ export declare class Context<E extends Env = any, P extends string = any, I extends Input = {}> {

*/
header: (name: string, value: string | undefined, options?: {
append?: boolean;
}) => void;
header: SetHeaders;
status: (status: StatusCode) => void;

@@ -308,0 +322,0 @@ /**

@@ -6,3 +6,3 @@ import type { HtmlEscaped, HtmlEscapedString, StringBufferWithCallbacks } from '../utils/html';

export type FC<P = Props> = {
(props: P): HtmlEscapedString | Promise<HtmlEscapedString>;
(props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null;
defaultProps?: Partial<P> | undefined;

@@ -9,0 +9,0 @@ displayName?: string | undefined;

@@ -152,3 +152,3 @@ /**

dir?: string | undefined;
draggable?: 'true' | 'false' | undefined;
draggable?: 'true' | 'false' | boolean | undefined;
enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;

@@ -155,0 +155,0 @@ hidden?: boolean | undefined;

@@ -20,2 +20,3 @@ /**

pathResolve?: ((path: string) => string) | undefined;
isDir?: ((path: string) => boolean | undefined | Promise<boolean | undefined>) | undefined;
}) => MiddlewareHandler;

@@ -8,2 +8,6 @@ /**

export { baseMimes as mimes };
declare const baseMimes: Record<string, string>;
/**
* Union types for BaseMime
*/
export type BaseMime = 'audio/aac' | 'video/x-msvideo' | 'image/avif' | 'video/av1' | 'application/octet-stream' | 'image/bmp' | 'text/css' | 'text/csv' | 'application/vnd.ms-fontobject' | 'application/epub+zip' | 'image/gif' | 'application/gzip' | 'text/html' | 'image/x-icon' | 'text/calendar' | 'image/jpeg' | 'text/javascript' | 'application/json' | 'application/ld+json' | 'audio/x-midi' | 'audio/mpeg' | 'video/mp4' | 'video/mpeg' | 'audio/ogg' | 'video/ogg' | 'application/ogg' | 'audio/opus' | 'font/otf' | 'application/pdf' | 'image/png' | 'application/rtf' | 'image/svg+xml' | 'image/tiff' | 'video/mp2t' | 'font/ttf' | 'text/plain' | 'application/wasm' | 'video/webm' | 'audio/webm' | 'image/webp' | 'font/woff' | 'font/woff2' | 'application/xhtml+xml' | 'application/xml' | 'application/zip' | 'video/3gpp' | 'video/3gpp2' | 'model/gltf+json' | 'model/gltf-binary';
declare const baseMimes: Record<string, BaseMime>;
{
"name": "hono",
"version": "4.5.4",
"version": "4.5.5",
"description": "Web framework built on Web Standards",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

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