Closed hojberg closed 10 years ago
You can simply parse the source, and set mod.ast
:
var recast = require('recast');
var ast = recast.parse(src); // src is the source string
@caridy not sure how that answers my question.
Im looking to transpile a source string instead of a file - I know that es6-module-transpiler uses recast, but not sure how that helps me getting it to accept a string instead of a file?
See my comment on the gulp project for an avenue for fixing this using a custom resolver. If this does not work or requires changes to the transpiler come back and comment here and I'll reopen.
@hojberg I've solved your issue by creating Module
objects directly and adding them to the container manually (see gulpe-es6mt/index.js#L37)
This might already be possible, but would be awesome if I could just give the container a source string instead of a filename. My current usecase is a series of transpilations happening on a file and want to perform all operations without having to go to a tmp disk in between transpilations.