Phoscur,
On Friday, February 10, 2012 6:09:35 AM UTC+1, Phoscur wrote:
>
> Concerning webmake:
> I see that I can easily implement jslint/hinting with webmake, but I can
> online parse the concatenated source, getting line numbers out of that file
> is pretty useless. So I need another hook/event that gets called for each
> file processed.
>
What you can do is to run webmake programmatically and then on parser
object you have 'modules' property which holds source for each module, you
can iterate over it and jslint that way. If you still prefer some kind of
event, it wouldn't be difficult to add, let me know and we figure it
out. On my side I rather lint my packages individually, and have jslint
binded to pre-commit script.
>
> Also I ran into some dependency resolving issues.
> >webmake src/browser.js public/browser.js
> in src/submodule/foo.js (required by browser.js):
> >require("../../lib/someLib")
> Produces:
> >Error: Require out of package root scope
>
> This is because I have my entry file in a subfolder (?).
>
I assume that your top-level package is application, and some of the down
level packages use modules from application package. So speaking more
abstract problem is that you refer to module from outer package not by
package name (e.g. 'package/lib/module') but by path (e.g.
'../../package/lib/module',) with current design of output file it's hard
to make that work without altering require path in source code. Other thing
is that referring to other package by path not by name is rather bad
practice, even when I work that out (I plan to do it) I would still
probably fire a warning.
If your top level package is an application, then probably all you need for
down level package should also be somewhere down level and not in
application specific logic. If it's just about circular dependency then
it's better to refer to dependent packages by names not by paths. Let me
know if I got your case correctly.
> On the TODOlist you have
> > Right dependency parsing (probably with help of UglifyJS)
> What does that mean?
>
Currently parsing is done just via one regex, which is not perfect (e.g.
commented out require will be picked up). I was thinking about using some
JavaScript AST parser but I'm afraid it will largely affect performance and
we don't need full AST tree just for picking requires. Now I'm thinking
rather about dedicated script which only purpose would be to walk the code
and pick up requires. I've done once similar thing in python, it wouldn't
be difficult to do.
--
Mariusz Nowak
https://github.com/medikoo
http://twitter.com/medikoo
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en