Registry / devops / cherry-cljs

cherry-cljs

JSON →
library0.5.34jsnpmunverified

Cherry is an experimental ClojureScript-to-ES6 module compiler that outputs readable, source-mapped .mjs files. It aims to reduce friction between ClojureScript and JavaScript tooling by producing ES6 modules that can be used directly with Node.js, Vite, and other modern JS toolchains. Unlike the official ClojureScript compiler, Cherry does not depend on Google Closure and is distributed as an NPM package. It supports macros, REPL, async/await, JSX via #jsx, and JS object destructuring. Version 0.5.34 is the latest; the project is experimental and not recommended for production use, with many bugs and frequent breaking changes.

npm install cherry-cljs
INSTALL
IMPORT
SIG · CHERRY-CLJS
C
cherry-cljs
devopsjavascriptv0.5.34
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cherry
import { cherry } from 'cherry-cljs'
import cherry from 'cherry-cljs'
Default export is not available; cherry is a named export.
compileString
import { compileString } from 'cherry-cljs'
const compileString = require('cherry-cljs/compileString')
Only ESM imports are supported. compileString is a named export from the main package.
cljs.core
import { core } from 'cherry-cljs'
import * as core from 'cherry-cljs/core'
cljs.core functionality is bundled in the main 'cherry-cljs' package as a named export 'core'.

Compile and run a minimal ClojureScript file that uses Node.js fs and url modules.

mkdir cherry-test && cd cherry-test npm init -y npm install cherry-cljs@latest cat > example.cljs << 'EOF' (ns example (:require ["fs" :as fs] ["url" :refer [fileURLToPath]])) (prn (fs/existsSync (fileURLToPath js/import.meta.url))) (defn foo [{:keys [a b c]}] (+ a b c)) (js/console.log (foo {:a 1 :b 2 :c 3})) EOF npx cherry run example.cljs
cherry --version
Debug
Known issues
breakingCherry is experimental and not recommended for production; APIs and output may change without notice.
fix
Pin a specific version and test thoroughly before upgrading.
affects: >=0.1.0
gotchaCompiled output depends on 'cherry-cljs' runtime module. Breaking changes in the runtime may break compiled code.
fix
Ensure runtime version matches compiler version, or use lockfile.
affects: >=0.2.0
deprecatedThe `cherry-cljs/core` subpath import was replaced by named export `core`.
fix
Use `import { core } from 'cherry-cljs'` instead.
affects: >=0.3.0
gotchaCherry does not support all ClojureScript features, e.g., some macros or interop patterns.
fix
Refer to issue tracker for known incompatibilities; consider Squint for CLJS syntax to JS compilation.
affects: >=0.0.1
breakingVersion 0.5.0 changed how require of JS modules works: now uses JavaScript import syntax in output.
fix
Update .cljs files to use the new require syntax: `(:require ["mod" :as mod])` instead of `(:require ["mod" :refer [foo]])` for default imports.
affects: >=0.5.0
gotchaSource maps may not always be accurate in development mode due to experimental nature.
fix
Use `npx cherry run --debug` for better error messages, but expect occasional mismatches.
affects: >=0.4.0
Errors
Common errors & fixes
Error: Cannot find module 'cherry-cljs' when trying to import
Package is not installed or import path is incorrect.
fix
Run `npm install cherry-cljs@latest`. Ensure import uses named export: `import { cherry } from 'cherry-cljs'`.
SyntaxError: The requested module 'cherry-cljs' does not provide an export named 'default'
Wrong import style: default import used but package only exports named exports.
fix
Use `import { cherry } from 'cherry-cljs'` instead of `import cherry from 'cherry-cljs'`.
CompilerException: Unsupported :require syntax
Using old ClojureScript require syntax for JS modules.
fix
Use new syntax: `(:require ["module-name" :as alias])` or `(:require ["module-name" :refer [symbol]])`.
Upgrade
Version history
0.5.34latest on npm
Audit
Dependencies
morirequiredProvides ClojureScript-compatible persistent data structures
Agent activity
14 hits · last 30 days
node
10
OpenAI (training)
1
Resources
cherry-cljs — npm install cherry-cljs · libregistry