Skip to content

Commit f7f2142

Browse files
Deraendnolen
authored andcommitted
CLJS-1922: Use :file as relative output path for foreign-libs
1 parent c28e41a commit f7f2142

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@
319319
(-foreign? [this] false)
320320
(-closure-lib? [this] false)
321321
(-url [this] nil)
322+
(-relative-path [this] nil)
322323
(-provides [this] (:provides (deps/parse-js-ns (string/split-lines this))))
323324
(-requires [this] (:requires (deps/parse-js-ns (string/split-lines this))))
324325
(-source [this] this)
@@ -328,6 +329,9 @@
328329
(-closure-lib? [this] (:closure-lib this))
329330
(-url [this] (or (:url this)
330331
(deps/to-url (:file this))))
332+
(-relative-path [this] (let [file (io/as-file (:file this))]
333+
(if (and file (not (.isAbsolute file)))
334+
(:file this))))
331335
(-provides [this] (map name (:provides this)))
332336
(-requires [this] (map name (:requires this)))
333337
(-source [this] (if-let [s (:source this)]
@@ -339,6 +343,7 @@
339343
(-foreign? [this] foreign)
340344
(-closure-lib? [this] (:closure-lib this))
341345
(-url [this] url)
346+
(-relative-path [this] nil)
342347
(-provides [this] provides)
343348
(-requires [this] requires)
344349
(-source [this]
@@ -1500,7 +1505,8 @@
15001505
url
15011506
(cond
15021507
(deps/-closure-lib? js) (lib-rel-path js)
1503-
(deps/-foreign? js) (util/relative-name url)
1508+
(deps/-foreign? js) (or (deps/-relative-path js)
1509+
(util/relative-name url))
15041510
:else (path-from-jarfile url))
15051511

15061512
(string? js)

src/main/clojure/cljs/js_deps.cljc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ case."
123123
library")
124124
(-url [this] "The URL where this JavaScript is located. Returns nil
125125
when JavaScript exists in memory only.")
126+
(-relative-path [this] "Relative path for this JavaScript.")
126127
(-provides [this] "A list of namespaces that this JavaScript provides.")
127128
(-requires [this] "A list of namespaces that this JavaScript requires.")
128129
(-source [this] "The JavaScript source string."))

0 commit comments

Comments
 (0)