Skip to content
This repository has been archived by the owner on Sep 25, 2018. It is now read-only.

browserify bundle tickles scjson-analyzer bug #363

Open
mattoshry opened this issue Oct 3, 2015 · 2 comments
Open

browserify bundle tickles scjson-analyzer bug #363

mattoshry opened this issue Oct 3, 2015 · 2 comments

Comments

@mattoshry
Copy link
Collaborator

Attempting to use browserify [1] to write modules once and reuse them on the server and in the browser - including a SCION-based scxml browser.

Referencing a browserify generated bundle that requires 'util' [2] causes the following:

< TypeError: Cannot read property 'name' of undefined
< at Object.scJsonAnalyzer.analyze.treeTypes.AssignmentExpression (/Users/matto/gerrit/scxml/node_modules/scxml/lib/compiler/static-analysis/scjson-analyzer.js:270:71)
< at /Users/matto/gerrit/scxml/node_modules/scxml/lib/compiler/static-analysis/scjson-analyzer.js:285:37
< at Array.forEach (native)
< at traverseSyntaxTree (/Users/matto/gerrit/scxml/node_modules/scxml/lib/compiler/static-analysis/scjson-analyzer.js:282:22)
< at /Users/matto/gerrit/scxml/node_modules/scxml/lib/compiler/static-analysis/scjson-analyzer.js:289:15
< at Array.forEach (native)
< at traverseSyntaxTree (/Users/matto/gerrit/scxml/node_modules/scxml/lib/compiler/static-analysis/scjson-analyzer.js:282:22)
< at /Users/matto/gerrit/scxml/node_modules/scxml/lib/compiler/static-analysis/scjson-analyzer.js:289:15
< at Array.forEach (native)
< at traverseSyntaxTree (/Users/matto/gerrit/scxml/node_modules/scxml/lib/compiler/static-analysis/scjson-analyzer.js:282:22)
break in node_modules/scxml/lib/compiler/static-analysis/scjson-analyzer.js:260
258 } catch (e) {
259 console.error(e.stack);

260 debugger;

In treeTypes, there's an assumption that tree.init and tree.expression both always have a 'left' object:
if(tree.init && systemVariables.indexOf(tree.init.left.name) !== -1) {

            if(tree.expression && systemVariables.indexOf(tree.expression.left.name) !== -1) {

Also, in the catch handler:
errors.push(e.description);
should be
errors.push(e.message);

[1] http://browserify.org/
[2] https://www.npmjs.com/package/util

@jbeard4
Copy link
Owner

jbeard4 commented Oct 4, 2015

Could you elaborate on the use case? Are you trying to create a browserify-based build, and use the build inside of Node.js?

Could you please provide a minimal repro of the issue you're encountering? Thanks.

@mattoshry
Copy link
Collaborator Author

That is the use case, Jake. Please check your email for the scxml and js
bundle that reproduces this.
On Sun, Oct 4, 2015 at 2:54 PM Jacob Beard notifications@github.com wrote:

Could you elaborate on the use case? Are you trying to create a
browserify-based build, and use the build inside of Node.js?

Could you please provide a minimal repro of the issue you're encountering?
Thanks.


Reply to this email directly or view it on GitHub
#363 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants