support shebangs - fixes #55
This commit is contained in:
@@ -33,6 +33,17 @@ File.normaliseOptions = function (opts) {
|
||||
return opts;
|
||||
};
|
||||
|
||||
File.prototype.parse = function (code) {
|
||||
// remove shebang
|
||||
code = code.replace(/^\#\!.*/, "");
|
||||
|
||||
var self = this;
|
||||
|
||||
return util.parse(this.opts, code, function (tree) {
|
||||
return self.transform(tree);
|
||||
});
|
||||
};
|
||||
|
||||
File.prototype.transform = function (ast) {
|
||||
this.ast = ast;
|
||||
|
||||
|
||||
@@ -11,10 +11,7 @@ function transform(code, opts) {
|
||||
code = (code || "") + "";
|
||||
|
||||
var file = new File(opts);
|
||||
|
||||
return util.parse(opts, code, function (tree) {
|
||||
return file.transform(tree);
|
||||
});
|
||||
return util.parse(code);
|
||||
}
|
||||
|
||||
transform.test = function (task, assert) {
|
||||
|
||||
Reference in New Issue
Block a user