On Mar 4, 2014, at 10:09, Travis Vachon wrote:

> This works for me - conceptually, I think this means that the
> "preamble" is the part of the file between the (optional) hashbang and
> the JavaScript generated by the ClojureScript compiler, which feels
> coherent. I have this patch on my todo list but won't be upset if
> someone beats me to it ;-D

The patch is already there :)

> 
> Thanks Michael!



> 
> Travis
> 
> On Tue, Mar 4, 2014 at 9:17 AM, Michael Glaesemann <g...@seespotcode.net> 
> wrote:
>> 
>> On Feb 26, 2014, at 14:48, Michael Glaesemann wrote:
>> 
>>> 
>>> On Feb 26, 2014, at 14:33, Travis Vachon wrote:
>>> 
>>>> oh! I totally missed :hashbang "" - I'm pretty sure that'll do what I
>>>> want yep - thanks! I'll let you know if that doesn't do the trick.
>>> 
>>> Actually, I don't think it does, as the code prepends the #! to the path to 
>>> node. :/
>>> 
>>> What I'd like to make sure is that if you're targeting node, you either 
>>> always use :target :nodejs or you don't. I wouldn't want to get in a state 
>>> where if you're targeting node you use :target :nodejs unless you're in 
>>> some certain environment, then you don't target node, and you just use a 
>>> preamble. That'd be confusing, at least to me.
>>> 
>>> Perhaps just update the code to prepend #! unless :hashbang is "", or omit 
>>> if :hashbang is false?
>> 
>> I've opened a ticket omitting hashbang for nodejs targets and submitted a 
>> patch: http://dev.clojure.org/jira/browse/CLJS-779
>> 
>> I chose to omit the hashbang if :hashbang false is included in the compiler 
>> options. I think this is clearer than requiring the user to include the 
>> hashbang in a preamble if one is provided (though I can see it possibly 
>> abusing the term preamble in this case).
>> 
>> In summary:
>> 
>>  {:target :nodejs} => default hashbang of #!/usr/bin/env node
>>  {:target :nodejs
>>   :hashbang "/bin/env node"} => #!/bin/env node
>>  {:target :nodejs
>>   :hashbang false} => hashbang omitted
>> 
>> Any preamble follows the hashbang.
>> 
>> 
>> 
>>> 
>>>> 
>>>> On Wed, Feb 26, 2014 at 2:23 PM, Michael Glaesemann
>>>> <g...@seespotcode.net> wrote:
>>>>> 
>>>>> On Feb 26, 2014, at 13:58, Travis Vachon wrote:
>>>>> 
>>>>>> Hm - sorry to chime in late on this, but I'm not sure I follow the
>>>>>> logic in the original question - :preamble and :target :nodejs weren't
>>>>>> mutually exclusive, it was just the case that the default :preamble
>>>>>> was the hashbang when using :target :nodejs
>>>>>> 
>>>>>> As patched, it's no longer possible to exclude the hashbang when
>>>>>> targetting nodejs, which breaks deployment in the parse.com cloud code
>>>>>> environment. Couldn't you have used :target :nodejs and included both
>>>>>> the hashbang and the sourcemap comment in the preamble?
>>>>> 
>>>>> That'd be an option, though it's also possible to set the value of the 
>>>>> hashbang. Does :hashbang "" do what you want?
>>>>> 
>>>>>> 
>>>>>> On Fri, Feb 21, 2014 at 2:14 PM, Michael Glaesemann
>>>>>> <g...@seespotcode.net> wrote:
>>>>>>> 
>>>>>>> On Feb 21, 2014, at 13:56, David Nolen wrote:
>>>>>>> 
>>>>>>>> JIRA ticket + patch welcome. Make sure to send in your Clojure CA, 
>>>>>>>> thanks!
>>>>>>> 
>>>>>>> http://dev.clojure.org/jira/browse/CLJS-771
>>>>>>> 
>>>>>>> As for the CA, I'm already listed on http://clojure.org/contributing.
>>>>>>> 
>>>>>>> Cheers!
>>>>>>> 
>>>>>>> 
>>>>>>>> 
>>>>>>>> David
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Fri, Feb 21, 2014 at 1:52 PM, Michael Glaesemann 
>>>>>>>> <g...@seespotcode.net>wrote:
>>>>>>>> 
>>>>>>>>> Currently the :preamble and :target :nodejs compiler options are 
>>>>>>>>> mutually
>>>>>>>>> exclusive.
>>>>>>>>> 
>>>>>>>>> I recently had a situation where I wanted to use a preamble with 
>>>>>>>>> node: I
>>>>>>>>> came across
>>>>>>>>> a nodejs module for [source map support](
>>>>>>>>> http://github.com/evanw/node-source-map-support).
>>>>>>>>> 
>>>>>>>>> It requires adding a bit of code at the top of the compiled file to
>>>>>>>>> 
>>>>>>>>> //# sourceMappingURL=path/to/source.map
>>>>>>>>> require('source-map-support').install();
>>>>>>>>> 
>>>>>>>>> While the source map support is still rudimentary, I don't see a 
>>>>>>>>> reason
>>>>>>>>> not to allow
>>>>>>>>> nodejs targets to have a preamble.
>>>>>>>>> 
>>>>>>>>> I've attached a patch that adds the preamble directly after the node
>>>>>>>>> hashbang.
>>>>>>>>> 
>>>>>>>>> If this looks like something that would be generally useful, I'm 
>>>>>>>>> happy to
>>>>>>>>> create a JIRA issue and attach the patch.
>>>>>>>>> 
>>>>>>>>> Cheers,
>>>>>>>>> 
>>>>>>>>> Michael Glaesemann
>>>>>>>>> grzm seespotcode net
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> --
>>>>>>>>> Note that posts from new members are moderated - please be patient 
>>>>>>>>> with
>>>>>>>>> your first post.
>>>>>>>>> ---
>>>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>>>> Groups
>>>>>>>>> "ClojureScript" group.
>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>>>> send an
>>>>>>>>> email to clojurescript+unsubscr...@googlegroups.com.
>>>>>>>>> To post to this group, send email to clojurescript@googlegroups.com.
>>>>>>>>> Visit this group at http://groups.google.com/group/clojurescript.
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Note that posts from new members are moderated - please be patient 
>>>>>>>> with your first post.
>>>>>>>> ---
>>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>>> Groups "ClojureScript" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>>>>> an email to clojurescript+unsubscr...@googlegroups.com.
>>>>>>>> To post to this group, send email to clojurescript@googlegroups.com.
>>>>>>>> Visit this group at http://groups.google.com/group/clojurescript.
>>>>>>> 
>>>>>>> Michael Glaesemann
>>>>>>> grzm seespotcode net
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> Note that posts from new members are moderated - please be patient with 
>>>>>>> your first post.
>>>>>>> ---
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "ClojureScript" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>>>> an email to clojurescript+unsubscr...@googlegroups.com.
>>>>>>> To post to this group, send email to clojurescript@googlegroups.com.
>>>>>>> Visit this group at http://groups.google.com/group/clojurescript.
>>>>>> 
>>>>>> --
>>>>>> Note that posts from new members are moderated - please be patient with 
>>>>>> your first post.
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "ClojureScript" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>>> an email to clojurescript+unsubscr...@googlegroups.com.
>>>>>> To post to this group, send email to clojurescript@googlegroups.com.
>>>>>> Visit this group at http://groups.google.com/group/clojurescript.
>>>>> 
>>>>> Michael Glaesemann
>>>>> grzm seespotcode net
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Note that posts from new members are moderated - please be patient with 
>>>>> your first post.
>>>>> ---
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "ClojureScript" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>>> email to clojurescript+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to clojurescript@googlegroups.com.
>>>>> Visit this group at http://groups.google.com/group/clojurescript.
>>>> 
>>>> --
>>>> Note that posts from new members are moderated - please be patient with 
>>>> your first post.
>>>> ---
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "ClojureScript" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>> email to clojurescript+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to clojurescript@googlegroups.com.
>>>> Visit this group at http://groups.google.com/group/clojurescript.
>>> 
>>> Michael Glaesemann
>>> grzm seespotcode net
>>> 
>>> 
>>> 
>> 
>> Michael Glaesemann
>> grzm seespotcode net
>> 
>> 
>> 
>> --
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "ClojureScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojurescript+unsubscr...@googlegroups.com.
>> To post to this group, send email to clojurescript@googlegroups.com.
>> Visit this group at http://groups.google.com/group/clojurescript.
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.

Michael Glaesemann
grzm seespotcode net



-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to