esbuild-py
Python bindings to the esbuild Transform API.
Installation
pip install esbuild_py
Usage
from esbuild_py import transform
jsx = """
import * as React from 'react'
import * as ReactDOM from 'react-dom'
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
"""
print(transform(jsx))
API
transform
Parameters:
jsx
(str
) - The JSX string to be transformed.
Returns: str
- The transformed JS as a string.
Development
Setup
Create conda environment
conda create -n esbuild-py python=3.11
Build
conda activate esbuild-py
go get github.com/keller-mark/esbuild-py
Develop
Build python package and install in editable mode
python setup.py bdist_wheel
python setup.py sdist
pip install -e .
Publish
Increment the version in pyproject.toml
.
The cibuildwheel GH action will build wheels for a matrix of Python versions, OS, and architectures.
Then, GH actions will publish to PyPI.
Resources