sindresorhus / emoj

Find relevant emoji from text on the command-line :open_mouth: :sparkles: :raised_hands: :horse: :boom: :see_no_evil:
MIT License
2.37k stars 58 forks source link

Require Node.js 8 and use async/await #22

Closed sindresorhus closed 7 years ago

sindresorhus commented 7 years ago

@vadimdemedes I'm getting an error with this:

❯ emoj
/Users/sindresorhus/dev/oss/emoj/node_modules/buble/dist/buble.umd.js:7700
        throw err;
        ^

SyntaxError: Unexpected token (241:21)
    at Parser.pp$4.raise (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp.unexpected (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:603:10)
    at Parser.pp.expect (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:597:28)
    at Parser.pp$3.parseExprList (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:2152:16)
    at Parser.pp$3.parseSubscripts (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:1741:35)
    at Parser.pp$3.parseExprSubscripts (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:1718:17)
    at Parser.pp$3.parseMaybeUnary (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:1692:19)
    at Parser.pp$3.parseExprOps (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:1637:21)
    at Parser.pp$3.parseMaybeConditional (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (/Users/sindresorhus/dev/oss/emoj/node_modules/acorn/dist/acorn.js:1597:21)

Can you add support for async/await in Ink? This is really the downside of transpiling JSX...

See: https://gitlab.com/Rich-Harris/buble/issues/71

vadimdemedes commented 7 years ago

So judging by the linked issue, Bublé fails when it encounters async/await. Setting generator: false as recommended there also doesn't help. I'll see what can be done!

sindresorhus commented 7 years ago

Try the second tip: https://gitlab.com/Rich-Harris/buble/issues/71#note_31999787

vadimdemedes commented 7 years ago

Tried require('acorn-es7-plugin')(require('acorn/dist/acorn.js'));, but no positive effect.

vadimdemedes commented 7 years ago

I think I'll have to replace Bublé with https://github.com/alexmingoia/jsx-transform in https://github.com/vadimdemedes/import-jsx.

vadimdemedes commented 7 years ago

Or not. Just discovered source map support is missing.

Wondering if using babel-core only with babel-plugin-transform-react-jsx is going to be of a problem. I compared sizes of buble and this combo using cost-of-modules and it doesn't seem to be a big difference. Stability at the cost of increased size.

vadimdemedes commented 7 years ago

Updated to use latest import-jsx, which uses Babel, instead of Buble. Works now!