ClojureScript

add :preamble option to compiler

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:

Description

Per this thread:

https://groups.google.com/forum/#!searchin/clojurescript/preamble/clojurescript/rUIlLfcYZvE/Yskfh4znL_0J

1) :preamble 's value will be a vector of paths
2) the compiled output is prepended with the contents of the files at those paths
3) the generated source map points to the correct/adjusted line numbers

Additionally, when compiling for the :nodejs target the preamble contents will default to the hashbang we currently write in that situation.

Activity

David Nolen made changes -
Field Original Value New Value
Priority Major [ 3 ] Minor [ 4 ]
Hide
Travis Vachon added a comment -

patch to add :preamble

I'm not confident this is the best way to do the source map stuff - any thoughts/suggestions would be very welcome

Show
Travis Vachon added a comment - patch to add :preamble I'm not confident this is the best way to do the source map stuff - any thoughts/suggestions would be very welcome
Travis Vachon made changes -
Attachment cljs_723.patch [ 12530 ]
Hide
Michael Bradley, Jr. added a comment -

Could the issue (and patch) be expanded to also support a :postamble option?

With both :preamble and :postamble options available, it would be easy to implement more sophisticated compiler-output wrappers, such as the one used by David Nolen's mori library (which I helped adapt from the Q javascript library).

See: https://github.com/swannodette/mori/blob/master/support/wrapper.js

Show
Michael Bradley, Jr. added a comment - Could the issue (and patch) be expanded to also support a :postamble option? With both :preamble and :postamble options available, it would be easy to implement more sophisticated compiler-output wrappers, such as the one used by David Nolen's mori library (which I helped adapt from the Q javascript library). See: https://github.com/swannodette/mori/blob/master/support/wrapper.js
Hide
David Nolen added a comment -

I'm fine with extending this to {:postamble}.

Show
David Nolen added a comment - I'm fine with extending this to {:postamble}.
David Nolen made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Hide
David Nolen added a comment -

Oops resolved wrong ticket

Show
David Nolen added a comment - Oops resolved wrong ticket
David Nolen made changes -
Status Resolved [ 5 ] Reopened [ 4 ]
Resolution Completed [ 1 ]
Hide
David Nolen added a comment -

fixed, https://github.com/clojure/clojurescript/commit/136bf46c656265a93dd15c40925f11edb34bd127.

If someone wants to open a postamble ticket and attach a patch go for it.

Show
David Nolen added a comment - fixed, https://github.com/clojure/clojurescript/commit/136bf46c656265a93dd15c40925f11edb34bd127. If someone wants to open a postamble ticket and attach a patch go for it.
David Nolen made changes -
Resolution Completed [ 1 ]
Status Reopened [ 4 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: