Skip to main content

Questions tagged [esprima]

Esprima is a high performance, standard-compliant JavaScript parser written in JavaScript.

0 votes
0 answers
38 views

Magento 2, RequireJS: r.js cannot parse ES6 syntax

I am maintaining Magento 2 store. Since we have issues with RequireJS preformance, I decided to try optimizing following this tutorial Advanced JS bundling. I have problem on "Run the r.js ...
dev's user avatar
  • 23
0 votes
1 answer
127 views

How can I know when the scope changes within an abstract syntax tree?

Can someone help me with figuring out how to know when the scope changing while traversing the ast tree? I am using the esprima parser and I know that babel does this but I want to create my own to ...
jjboi8708's user avatar
0 votes
1 answer
186 views

How to transform JavaScript AST to create infinite loop guards?

I'm using Esprima, estraverse, and escodegen to transform JavaScript code to add infinite loop guards inspired by Codepen But I have a problem in adding code after the loop. If I have code like this: ...
jcubic's user avatar
  • 65.3k
1 vote
1 answer
1k views

Cannot set property 'esprima' of undefined at webpackUniversalModuleDefinition

I'm receiving this error: Uncaught TypeError: Cannot set property 'esprima' of undefined at webpackUniversalModuleDefinition (esprima.js:11) at esprima.js:12 When trying to load a web app: The ...
Megidd's user avatar
  • 7,619
1 vote
1 answer
776 views

Esprima error 404 Not Found in npm install

I'm trying to install all dependencies in my react project, but when I run npm install I'm getting some errors related to esprima: npm ERR! 404 Not Found - GET https://codeload.github.com/ariya/...
Caíque Coelho's user avatar
0 votes
1 answer
170 views

Ignore error while generating JS AST using ESPIRMA

How to instruct esprima to continue generating AST even if there are syntax errors in the JS file? Example: var x = ; // syntax error var y = 5; x = y; The normal esprima output (even when enabling ...
Opaida's user avatar
  • 111
0 votes
1 answer
1k views

How to use esprima to parse a javascript file, from Java?

My requirement is to parse a javascript file and obtain the AST(Abstract Syntax Tree) in json format. The esprima.parseScript() function accepts the js code and generates the AST correctly. But, how ...
nithish's user avatar
1 vote
0 answers
177 views

How to generate all the leaf to leaf path in an AST?

Given a JS snippet, how to generate all the leaf-to-leaf path from the AST? Let’s say the code snippet is: var answer = 6 * 7; Example AST: https://esprima.org/demo/parse.html For this code snippet, I ...
Exploring's user avatar
  • 3,031
2 votes
1 answer
548 views

why esprima works fine in online browser demo, but failed locally

When I try to parse a snippet of code with the following script, it failed (using [email protected]). However it works fine in the esprima online browser demo, shown in the screenshot below. var esprima = ...
Bob Li's user avatar
  • 53
-2 votes
1 answer
605 views

How to use a global nodejs module?

I got the following error when I try to use esprima. Does anybody know how to fix the problem? Thanks. $ npm install -g esprima /usr/local/bin/esparse -> /usr/local/lib/node_modules/esprima/bin/...
user1424739's user avatar
  • 13.1k
-2 votes
4 answers
1k views

transpiler battle: breaking out of nested function, with vs without throw

I have just finished writing "version 0" of my first (toy) transpiler. It works. It turns a string of "pseudo JavaScript" (JavaScript with an additional feature) into a string of ...
mathheadinclouds's user avatar
1 vote
0 answers
307 views

How to add a custom operator to Javascript or node.js with BabelJS?

I would like to add custom operators, keywords, and syntax to Javascript. Someone asked for help with this many years ago and got some great instructions: How would I extend the JavaScript language ...
abalter's user avatar
  • 10.1k
106 votes
4 answers
43k views

How to use npm module in DENO?

Deno is super cool. I saw it in the morning and want to migrate to deno now. I was trying to move my existing nodejs script to deno. Can any one help me on how to use npm modules in deno. I need ...
Vinod Sai's user avatar
  • 2,082
1 vote
0 answers
92 views

extracting specific function calls from javascript

I want to extract function calls from javascript files. For example: ........... ........... ........... function moveEvent(event, dayDelta, minuteDelta, allDay){ jQuery.ajax({ data: 'id=...
Exploring's user avatar
  • 3,031
1 vote
1 answer
729 views

How to add keyword to acorn or esprima parser

I am working on a language that transpiles to javascript and has a similar syntax. However I want to include some new type of block statements. For syntax purposes they are the same as an IfStatement. ...
bruceceng's user avatar
  • 2,052

15 30 50 per page
1
2 3 4 5