Python bindings to the esbuild Transform API.
pip install esbuild_py
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))
Parameters:
jsx
(str
) - The JSX string to be transformed.
Returns: str
- The transformed JS as a string.
Create conda environment
conda create -n esbuild-py python=3.11
- Install go v1.20.12 from https://go.dev/dl/
conda activate esbuild-py
go get github.com/keller-mark/esbuild-py
# go build -buildmode=c-shared -o _esbuild.so
Build python package and install in editable mode
python setup.py bdist_wheel
python setup.py sdist
pip install -e .
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.