From efaccd07476ffa7e29c3984cb34fa592764502ac Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 19 Nov 2024 11:50:57 +0100 Subject: [PATCH] Fix #577: support default + refer --- CHANGELOG.md | 4 ++++ test/squint/compiler_test.cljs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42b25f9f..fe07d241 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ [Squint](https://github.com/squint-cljs/squint): Light-weight ClojureScript dialect +## v0.8.125 (2024-11-19) + +- Fix [#577](https://github.com/squint-cljs/squint/issues/577): support `$default` + `:refer` + ## v0.8.124 (2024-11-08) - Add `delay` diff --git a/test/squint/compiler_test.cljs b/test/squint/compiler_test.cljs index c46947d2..f2d4f278 100644 --- a/test/squint/compiler_test.cljs +++ b/test/squint/compiler_test.cljs @@ -1621,6 +1621,13 @@ (str/trim (squint/compile-string "(ns foo (:require [\"some-js-lib\" :refer [atom]])) atom" {:repl true})) "foo.atom;"))) +(deftest default-require-test + (let [js (squint/compile-string "(ns foo (:require [\"some-js-lib$default\" :as a :refer [atom]])) atom")] + (is (str/includes? js "import default$1 from 'some-js-lib'")) + (is (str/includes? js "const { atom } = default$1;"))) + (let [js (squint/compile-string "(ns foo (:require [\"some-js-lib$default\" :as a :refer [atom]])) atom" {:repl true})] + (is (str/includes? js "var { atom } = (await import ('some-js-lib')).default;")))) + (deftest ns-test-async (t/async done (let [js (squint/compile-string "(ns foo (:require [clojure.string :as str])) (str 1 2 3 (str/join \",\" [1 2 3]))" {:repl true