-
Notifications
You must be signed in to change notification settings - Fork 21
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
RFC - supply code and AST to esperanto #141
Conversation
Would it be possible to get the |
Yep, that works too: esperanto.toCjs({
code: '...',
ast: {...}
}, options ); |
Ah awesome! Was digging through the code but didn't see it anywhere. Thanks! |
Alright, so I've basically got this integrated and it's working surprisingly well. The only issue so far is that esperanto will always put |
Damn, you work fast.
O_o I don't know what to say to that... @thejameskyle raised a related issue recently (#121) and the consensus was that it wasn't worth giving people the option, but I suppose this changes things. Will get onto it shortly and include it in this PR. |
RFC - supply code and AST to esperanto
Released in 0.6.27. To disable the 'use strict' pragma, pass |
First crack at #140. Would welcome feedback (cc @sebmck). It basically follows the proposal in #140, with one thing to be aware of - the properties of the
modules
option are paths relative to the base dir (whether specified asbase
or implicit, i.e.process.cwd()
.This is necessary because
import foo from './foo'
could refer tofoo/index.js
(esperanto works that way because CommonJS works that way... open for discussion - removing support forindex.js
would simplify some things, but I kinda like it), which means that relative paths infoo
need to know whether they're relative tofoo.js
orfoo/index.js
.So usage looks like this:
The supplied AST should have
start
andend
character offset properties on each node - acorn includes these by default.