New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

jnk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jnk

jnk compiler - CLI tool for generating JSX using concise Emmet-style syntax. It's like Emmet, but for React.

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

jnk

jnk is a CLI tool for generating JSX using concise Emmet-style syntax. It's like Emmet, but for React.

Installation

# Global installation (recommended)
npm install -g jnk

# Or use with npx
npx jnk "div.container>h1{Hello}"

Usage

jnk "div.container>h1{Hello}+p{World}"

Programmatic

import { jnk } from "jnk";

const jsx = jnk("Button.primary[onClick={handleClick}]{Save}");
console.log(jsx);
// <Button className="primary" onClick={handleClick}>Save</Button>

Advanced (with AST)

import { jnkWithAST } from "jnk";

const { ast, jsx } = jnkWithAST("div.container>h1{Hello}");
console.log(ast); // Abstract Syntax Tree for custom processing
console.log(jsx); // Generated JSX

Examples

# Simple div with class and children
jnk "div.container>h1{Hello}+p{World}"
# Output:
# <div className="container">
#   <h1>Hello</h1>
#   <p>World</p>
# </div>

# Component with props
jnk "Button.primary[onClick={handleClick}]{Save}"
# Output: <Button className="primary" onClick={handleClick}>Save</Button>

# Nested components
jnk "Card>CardHeader{Title}+CardContent{Some content}+CardFooter>Button{Ok}"

# Expression content
jnk "ul>li*{items.map(i => <li>{i}</li>)}"

# Multiplication with numbering
jnk "ul>li.item\$*3>a{Link \$}"
# Output:
# <ul>
#   <li className="item1"><a>Link $</a></li>
#   <li className="item2"><a>Link $</a></li>
#   <li className="item3"><a>Link $</a></li>
# </ul>

# Grouping
jnk "(div.header+div.content)*2"
# Output:
# <div className="header" />
# <div className="content" />
# <div className="header" />
# <div className="content" />

Syntax

  • > - child element
  • + - sibling element
  • .class - adds className
  • #id - adds id attribute
  • [prop=value] - adds prop with string value
  • [prop={expression}] - adds prop with JS expression
  • {content} - text or JS expression content
  • *N - multiply element N times
  • *{expression} - expression content (like map)
  • $ - numbering placeholder (item$ becomes item1, item2, etc.)
  • $$$ - zero-padded numbering (item$$$ becomes item001, item002, etc.)
  • () - grouping elements
  • Uppercase tags become React components

Why jnk?

  • Faster than writing JSX by hand
  • React-focused with component support and JSX expressions
  • Emmet-compatible syntax you already know
  • Modern TypeScript-based with comprehensive tests

Development

git clone https://github.com/your-username/jnk
cd jnk
npm install
npm run build
npm test

Contributing

Contributions are welcome. Please keep code clean and follow best practices.

License

MIT © Janko Stanic

Keywords

react

FAQs

Package last updated on 04 Oct 2025

Did you know?

Socket

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.

Install

Related posts