It is my understanding that a namespace has to {{:require-macros}} itself to have its macros accessible automatically but this no longer seems to be accurate.
Given this minimal example
;; src/demo/lib.cljs
(ns demo.lib)
;; src/demo/lib.clj
(ns demo.lib)
(defmacro foo [& args]
`(prn ::macro))
;; src/demo/test.cljs
(ns demo.test
(:require [demo.lib :as lib]))
(lib/foo 1 2 3)
I would expect a warning for {{lib/foo}} since {{demo.lib}} has no {{:require-macros}} for its macros and the {{demo.test}} did not use {{:include-macros}} or {{:refer-macros}}.
Compiling this via the build API does in fact produce the expected warning but only iff the {{demo.lib}} CLJ namespace was not required anywhere else.
WARNING: Use of undeclared Var demo.lib/foo at line 5 src/demo/test.cljs
;; build.clj
(require '[cljs.build.api :as cljs])
;; (require 'demo.lib) ;; requiring this here removes the warning
(cljs/build
"src"
{:output-dir "out"
:optimizations :none
:verbose true})
Enabling the {{(require 'demo.lib)}} in the {{build.clj}} causes the warning to disappear and the code uses the macro properly.
Some popular libraries (eg. devcards) do not self-require but still work if the macro file was at least required somewhere else.
Is this intended behaviour or just accidental?