shama / yo-yoify

Transform choo, yo-yo or bel template strings into pure and fast document calls
111 stars 17 forks source link

Fails on files with async function #34

Closed rahatarmanahmed closed 7 years ago

rahatarmanahmed commented 7 years ago

Example js file:

async function whatever () {
    console.log('idc')
}
$ browserify index.js -t yo-yoify
SyntaxError: Unexpected token (1:6) while parsing file: /Users/rahat/Downloads/test/babel-test/index.js
    at Parser.pp.raise (/Users/rahat/Downloads/test/babel-test/node_modules/acorn/dist/acorn.js:1745:13)
    at Parser.pp.unexpected (/Users/rahat/Downloads/test/babel-test/node_modules/acorn/dist/acorn.js:2264:8)
    at Parser.pp.semicolon (/Users/rahat/Downloads/test/babel-test/node_modules/acorn/dist/acorn.js:2243:59)
    at Parser.pp.parseExpressionStatement (/Users/rahat/Downloads/test/babel-test/node_modules/acorn/dist/acorn.js:2677:8)
    at Parser.pp.parseStatement (/Users/rahat/Downloads/test/babel-test/node_modules/acorn/dist/acorn.js:2462:160)
    at Parser.pp.parseTopLevel (/Users/rahat/Downloads/test/babel-test/node_modules/acorn/dist/acorn.js:2379:21)
    at parse (/Users/rahat/Downloads/test/babel-test/node_modules/acorn/dist/acorn.js:101:12)
    at module.exports (/Users/rahat/Downloads/test/babel-test/node_modules/falafel/index.js:22:15)
    at DestroyableTransform.end [as _flush] (/Users/rahat/Downloads/test/babel-test/node_modules/yo-yoify/index.js:55:13)
    at DestroyableTransform.<anonymous> (/Users/rahat/Downloads/test/babel-test/node_modules/readable-stream/lib/_stream_transform.js:115:49)

Maybe using a newer version of acorn might help?

shama commented 7 years ago

I added a skipped test for it here https://github.com/shama/yo-yoify/blob/master/test/index.js#L163 but it looks like even with the latest version of falafel, async still isn't supported.

So you would need to use another transpiler that supports it first atm.