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

hono

Package Overview
Dependencies
Maintainers
1
Versions
344
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 1.4.6 to 1.4.7

dist/middleware/html/index.d.ts

17

dist/middleware/jsx/index.d.ts

@@ -1,5 +0,4 @@

import type { Context } from '../../context';
import type { Next } from '../../hono';
import type { HtmlEscapedString } from '../../utils/html';
declare global {
namespace h.JSX {
namespace jsx.JSX {
interface IntrinsicElements {

@@ -10,9 +9,9 @@ [tagName: string]: Record<string, any>;

}
export declare const jsx: () => (c: Context, next: Next) => Promise<void>;
declare type EscapedString = string & {
isEscaped: true;
};
export declare const h: (tag: string | Function, props: Record<string, any>, ...children: (string | EscapedString)[]) => EscapedString;
declare type FC<T = Record<string, any>> = (props: T) => EscapedString;
export declare const jsx: (tag: string | Function, props: Record<string, any>, ...children: (string | HtmlEscapedString)[]) => HtmlEscapedString;
declare type FC<T = Record<string, any>> = (props: T) => HtmlEscapedString;
export declare const memo: <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => FC<T>;
export declare const Fragment: (props: {
key?: string;
children?: any;
}) => HtmlEscapedString;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.memo = exports.h = exports.jsx = void 0;
exports.Fragment = exports.memo = exports.jsx = void 0;
const html_1 = require("../../utils/html");
const jsx = () => {
return async (c, next) => {
c.render = (content) => {
const output = `<!doctype html>${content.toString()}`;
return c.html(output);
};
await next();
};
};
exports.jsx = jsx;
const h = (tag, props, ...children) => {
const jsx = (tag, props, ...children) => {
if (typeof tag === 'function') {
return tag.call(null, { ...props, children: children.length <= 1 ? children[0] : children });
}
let result = `<${tag}`;
let result = tag !== '' ? `<${tag}` : '';
const propsKeys = Object.keys(props || {});

@@ -37,3 +27,5 @@ for (let i = 0, len = propsKeys.length; i < len; i++) {

}
result += '>';
if (tag !== '') {
result += '>';
}
const flattenChildren = children.flat(Infinity);

@@ -52,3 +44,5 @@ for (let i = 0, len = flattenChildren.length; i < len; i++) {

}
result += `</${tag}>`;
if (tag !== '') {
result += `</${tag}>`;
}
const escapedString = new String(result);

@@ -58,3 +52,3 @@ escapedString.isEscaped = true;

};
exports.h = h;
exports.jsx = jsx;
const shallowEqual = (a, b) => {

@@ -88,1 +82,5 @@ if (a === b) {

exports.memo = memo;
const Fragment = (props) => {
return (0, exports.jsx)('', {}, ...(props.children || []));
};
exports.Fragment = Fragment;

@@ -0,1 +1,4 @@

export declare type HtmlEscapedString = string & {
isEscaped: true;
};
export declare const escape: (str: string) => string;
{
"name": "hono",
"version": "1.4.6",
"version": "1.4.7",
"description": "Ultrafast web framework for Cloudflare Workers.",

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

"./graphql-server": "./dist/middleware/graphql-server/index.js",
"./html": "./dist/middleware/html/index.js",
"./jsx": "./dist/middleware/jsx/index.js",

@@ -65,2 +66,5 @@ "./jwt": "./dist/middleware/jwt/index.js",

],
"html": [
"./dist/middleware/html"
],
"jsx": [

@@ -67,0 +71,0 @@ "./dist/middleware/jsx"

@@ -76,2 +76,3 @@ <div align="center">

- [GraphQL Server](https://github.com/honojs/hono/tree/master/src/middleware/graphql-server/)
- [html](https://github.com/honojs/hono/tree/master/src/middleware/html/)
- [JSX](https://github.com/honojs/hono/tree/master/src/middleware/jsx/)

@@ -78,0 +79,0 @@ - [JWT Authentication](https://github.com/honojs/hono/tree/master/src/middleware/jwt/)

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