
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
@qvistdev/node-jsx
Advanced tools
This is a minimal, non-React JSX factory which allows using JSX expressions to generate static html. Being naturally TypeScript-friendly, this could be used as a strongly typed templating engine, or as a static site generator.
This is a minimal, non-React JSX factory which allows using JSX expressions to generate static html. Being naturally TypeScript-friendly, this could be used as a strongly typed templating engine, or as a static site generator.
This is a minimal project made for learning purposes. It has not been exhaustively tested for production deployments and contains no particular measures to remedy common safety issues stemming from HTML template engines. Use at own risk.
npm install @qvistdev/node-jsx
Add the following fields to your tsconfig.json:
{
"compilerOptions": {
"jsx": "react",
"jsxFactory": "NodeJSX",
"jsxFragmentFactory": "NodeJSX.Fragment"
},
}
NodeJSX is the name of the function that will be used to resolve JSX expressions. As long as it is imported into a file, JSX expressions can be used.
import NodeJSX from "node-jsx";
interface Props {
name: string;
city: string;
}
const PersonListItem = ({ name, city }: Props) => (
<li>
<span class="person_name">{name}</span>
<span class="person_city">{city}</span>
</li>
);
const person = <PersonListItem name="Oscar" city="Stockholm" />;
// All elements returned from JSX expressions have a render method,
// which returns the HTML as a string.
const html = person.render();
// Output:
// <li>
// <span class="person_name">Oscar</span>
// <span class="person_city">Stockholm</span>
// </li>
Similar to React, there is a helper type for components that accept children.
import NodeJSX, { PropsWithChildren } from "node-jsx";
type Props = PropsWithChildren<{ navItems: string[] }>;
const Layout = ({ navItems, children }: Props) => (
<div>
<nav>{navItems.map(navlink => <a href={navlink}>{navlink}</a>)}</nav>
<main>
{children}
</main>
</div>
);
const Page = () => (
<Layout>
<p>Some stuff</p>
</Layout>
);
Custom components can be nested into each other, and their props will be typed.
import NodeJSX from "node-jsx";
interface CardProps {
header: string;
content: string;
}
const Card = ({ header, content }: CardProps) => (
<div class="card">
<h2>{header}</h2>
<p>{content}</p>
</div>
);
interface DeckProps {
cards: Array<{ header: string; content: string; }>
}
const Deck = ({ cards }: DeckProps) => (
<main>
{cards.map(({ header, content }) => (
<Card header={header} content={content} />
))}
</main>
);
FAQs
This is a minimal, non-React JSX factory which allows using JSX expressions to generate static html. Being naturally TypeScript-friendly, this could be used as a strongly typed templating engine, or as a static site generator.
We found that @qvistdev/node-jsx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.