![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
coffee-react-transform
Advanced tools
Provides support for an equivalent of JSX syntax in Coffeescript (called CJSX) so you can write your Facebook React components with the full awesomeness of Coffeescript.
car-component.coffee
# @cjsx React.DOM
Car = React.createClass
render: ->
<Vehicle doors=4 stars={getSafetyRating()*5} data-top-down="yep" checked>
<FrontSeat />
<BackSeat />
<p>Which seat can I take? {@props.seat}</p>
</Vehicle>
React.renderComponent(<Car seat="front, obvs" />, document.getElementById('container'))
transform
cjsx-transform car-component.coffee
output
# @cjsx React.DOM
Car = React.createClass
render: ->
Vehicle({"doors": "4", "stars": (getSafetyRating()*5), "data-top-down": "yep", "checked": true}, FrontSeat(null), BackSeat(null), React.DOM.p(null, """Which seat can I take?""", (@props.seat)))
React.renderComponent(Car({"seat": "front, obvs"}), document.getElementById('container'))
The custom file extension recently changed from .csx
to .cjsx
to avoid conflicting with an existing C# related file extension, so be sure to update your files accordingly (including changing the pragma to @cjsx
). You can also just use .coffee
as the file extension. Backwards compatibility will be maintained until the next major version.
npm install -g coffee-react-transform
cjsx-transform [input file]
Outputs Coffeescript code to stdout. Redirect it to a file or straight to the Coffeescript compiler, eg.
cjsx-transform examples/car.coffee | coffee -cs > car.js
transform = require 'coffee-react-transform'
transformed = transform('...some cjsx code...')
cake test
or cake watch:test
FAQs
React JSX support for Coffeescript
The npm package coffee-react-transform receives a total of 13,442 weekly downloads. As such, coffee-react-transform popularity was classified as popular.
We found that coffee-react-transform 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.