estools / escodegen

ECMAScript code generator
BSD 2-Clause "Simplified" License
2.64k stars 336 forks source link

add support for template literals #163

Open disnet opened 10 years ago

disnet commented 10 years ago

The harmony branch of esprima supports ES6 template strings but when I pass it to escodegen I get:

Error: Unknown expression type: TemplateLiteral
deviousasti commented 6 years ago

Any update on this?

JohnScottMcNerney commented 6 years ago

I have the same problem using the escodegen.browser.js, but the NODEJS version (installed July 2018) worked fine on the exact same input file. My guess is that my escodegen.browser.js copy is an old copy, before the support for TemplateLiteral was put in.

Looking at the GitHub -> escodegen / test / compare-harmony directory, there looks like lots of tests for Literals. Other tests have been updated within the last few months, so this repository still looks active.

The instructions for creating the escodegen.browser.js failed for me, on a new/clean install.

** Error: Cannot find module "tools/entry-point.js"

unix> find . -name "entry-point.js" -print

yielded no results.

I had to find a copy of escodegen.browser.js floating around somewhere to use (obviously an old version). If anyone has a recent escodegen.browser.js I would appreciate a copy (.min version okay too).

JohnScottMcNerney commented 6 years ago

I had to manually create the tools/entry-point.js file (found on this GitHub repository) in my directory. Now it works fine.

If I was a developer and did a full GIT download of this project, this file would have been there. It is not there when just doing a NPM install/init/build.