On 2/13/17, 11:51 PM, "Harbs" <[email protected]> wrote:

>Fair enough… ;-)
>
>The problem is creating libraries which can be used both in the browser
>and in Node.
>
>Unless we add another set of swcs for Node with a new COMPILE::NODE
>conditional, I don’t see how we can generalize FlexJS to be usable for
>both.
>
>Maybe adding COMPILE::NODE is the right answer.

Does the actual code path need to be different?  If so, then we will need
more conditional compilation statements.

Otherwise, it might be better to have a custom Emitter and/or Publisher
for Node.  Looks like there is already a NodePublisher.  I'm not quite
clear on what needs to be different.

The publishers generally visit the output JS files, scanning for the
goog.requires and removing them.  Since they scan that far, we have the
publisher look for inject_html, collect those in order to determine what
goes in the <head> section.  Currently, that's the only mechanism for
altering the <head> of the output html wrapper.

An Emitter could change the goog.requires in every file, and even use a
different require system like RequireJS.

If the <head> needs to be different between Browser and Node, then you
could introduce inject_node_html and have the NodePublisher check for that
instead of inject_html.

One reason to use inject_html as a directive in the comments instead of
MetaData is simply to avoid having to scan entire files of output.  The
requires are always early in the file.

HTH,
-Alex

Reply via email to