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

jsx-transform-modern-cli

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsx-transform-modern-cli

A CLI tool for converting JSX files into standard JS.

  • 1.0.2
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

jsx-convert

A CLI tool for converting JSX files into standard JS.

This script looks for JSX code and isolates it before performing a transform using jsx-transform on it. This allows it to support modern JS language features which might not be supported by the underlying jsx-transform package.

This script will not transform code inside a prop's value. It ignores the contents of a prop. It does this by first converting the prop's value into a backtick-string, escaping any backticks inside the value. This turns the value into a string which jsx-transform can handle in all cases. Then the transformed code is converted back into the original value.

Usage:

jsx-convert <glob> [--write] [--factory='h']

Some examples of what <glob> can be:

build/**/*.js
build/**/*{.js,.jsx}
file.js

Example

Input:

// Instaces of React are transform as well
import React from 'hyperscript'

const Component = () => (<div/>)
const test = (
  <div>
    <button onClick={() => console.log('click')}/>
    <Component />
  </div>
)

Output:

// Instaces of React are transform as well
import h from 'hyperscript'

const Component = () => (h('div'))
const test = (
  h('div', null, [
    h('button', {onClick: () => console.log('click')}),
    Component()
  ])
)

FAQs

Package last updated on 19 Jan 2023

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

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