-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ast build handlers #51
Comments
I've been trying to implement this functionality in the meteor tools, and actually my opinion has changed since our discussion last year in meteor/meteor#1207. I think it's a good model to have one source handler per extension. Basically we are using it to transform any language ( What would be useful I think is a way to take a complete compiled “image” (for instance the browser application) and modify it (for instance to remove Modifying the AST might not be the most simple task for package authors, but here come the excellent recast library by @benjamn (who is currently working at MDG). The API could be something like
In the Open questions:
|
One convenient property of Recast is that it doesn't care how you do the AST transformation, so I think it makes a lot of sense to give the plugin author the AST and let her decide how to modify it. If the author decides to use On the implementation side, we can certainly use |
@mquandalle Se see your point - Lets keep sourcehandlers be simple converters, one pr. file ext.
This concept would be really powerful if html/css is also converted into js format? |
btw. @benjamn I read the recast code awhile back - I kinda liked the concept - It would be nice to use it in the build tool, would allow us to do crazy stuff |
@raix, I guess you would be able to rewrite https://github.com/raix/Meteor-famono |
@mquandalle Famono will deprecate if this became a feature - we could do alot of code optimizations eg. removing dead code and merge alike functions etc. This way we wont have to think about including the whole famous library. But I've got a lot of other ideas for this feature too, |
@mquandalle definitely happy to add a |
It seems as if facebook is creating a system much like meteor - but with some very important improvements, many of those are sadly old feature requests to meteor that haven't been touched yet. |
Which system are you talking about? |
The Facebook stack:
This FR is the type "Loaders"AST transformations in webpack https://www.youtube.com/playlist?list=PLb0IAmt7-GS1cbw4qonlQztYV1TAW0sCr |
But for server side they do not provide anything? Node? PHP? |
Just to connect the dots, here is the discussion about Meteor and React (started by @mitar): |
I'm not sure @mitar they mention it in the end of the Relay talk I think Thanks @steph643 for the reference (I'm not subscribing to the meteor talk due to spam) additional ref: meteor/meteor#3728 |
The stream based build tool proposal is an exciting architecture proposal! It seems that Babel transformers could be used to handle AST modifications, see https://speakerdeck.com/sebmck/babel-facebook-talk. |
That would be awesome! |
Why? - Let packages modify and improve code in steps,
Examples of packages that could do work on the code:
The quick fix just lets multiple source handlers look at the source - basicly to allow code reporting / jshint
Your use case could bring a really nice / important improvement - having eg. a source handler for replacing
Meteor.isClient
andMeteor.isServer
withtrue
/false
would be nice to run before eg. uglify (uglify would then remove the dead code/unused code blocks)I'm not sure of a way to let the bundler sort source handlers - first thought was a unix like load levels
init 1 - 5
each level runs source handlers unordered - but ordered to levels - but the levels would be triggy to define / standardize?An other issue is that:
jshintHandler
is not handed the actual source?Could do something like:
where
initLevel
is some sortable levelSomething like that could be nice - but it would require some work - and extruding the uglify to a package - but this would be an improvement too?
Quotes taken out of context - read ref links to get it all:
@raix:
@gadicc:
@mquandalle:
@ccorcos:
@glasser:
Ref:
The text was updated successfully, but these errors were encountered: