jquery/jquery — comment on commit 8bc60bab5dd9747e7ae06c3fdb0c60782d346ff0
File: src/exports.js line 18
By jrburke:

@jdalton: I mentioned I would change the build tool if the jQuery folks preferred the other code structure. If the user uses jQuery, underscore and sproutcore and they all do it differently, it will be a complex regexp or AST transform for the end developer to construct. I would prefer that the optimizer just take care of it.

There is great value in having common idioms used consistently across libraries because it allows other people to write simpler optimization tools. But I would rather have the library-specific developers comfortable with their define() use. There is a tradeoff, and local library preferences may be more important than keeping with a common idiom.

@davidmurdoch: thanks for cluing me in on the numbers, I got confused.

As for the namepsace analysis, I am using regexps for that part. I use an AST for a different part of the optimization, but it does not really matter in this case if a regexp or an AST Is used, there still needs to be a pattern that is recognizable as the target of a transform. Using jQuery specific methods means having a custom transform that is aware of the jQuery method names and structure.