-
-
Notifications
You must be signed in to change notification settings - Fork 24
snake_case aliases from javascript libraries #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
snake_case aliases from javascript libraries #72
Conversation
da87af0 to
b294d41
Compare
|
Converting to Note it generates |
src/cherry/compiler.cljc
Outdated
| [p & _props] (when suffix | ||
| (str/split suffix #"\."))] | ||
| (str/split suffix #"\.")) | ||
| snake-case-as (some-> as str (str/replace "-" "_"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function we use in the compiler to do this transformation is called munge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip!
b294d41 to
4f4aa9e
Compare
|
@borkdude Looks like a couple of the functions I touched e.g. Also I wasn't entirely clear on the expected JS output for |
|
@alexdao3 I'm sorry for that! I'm still in progress of moving the common code to compiler-common and did a big chunk of that today. Previously I used compiler-common as a git submodule, but I had to revert that because it could no longer be used as a git dependency in deps.edn (deps.edn doesn't support submodules). What I moved to is the following: in development I work with a local checkout of compiler-common within the squint (and cherry) project and there is a task But I do realize that this makes contributing to this project a little harder. Perhaps you can still contribute the compiler tests here and the other changes to compiler common and I'll make sure to push both changes into a branch which runs CI. |
4f4aa9e to
f4fd290
Compare
|
@borkdude Thanks for the heads up, and no worries. I was a bit slow today to push up updates, so maybe you didn't expect there to be conflicts. Anyways I cherry-picked the relevant commits for From Wonder if there's a caching issue somewhere in my local setup. I'll dig into it |
| (is (str/includes? s "local_file_some_fn.call(null)"))) | ||
|
|
||
| (let [s (cherry/compile-string "(ns test-namespace (:require [clojure.core :as clojure-core])) (clojure-core/some-fn)")] | ||
| (is (str/includes? s "import { some_fn as clojure_core_some_fn } from 'clojure-core'")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Cherry didn't previously support requiring Clojure namespaces, I wasn't sure what the output here should be
Fixes #71