You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR: patch jsdom 0.2.14 used by jquery 1.8.3 used by munchjs; patch munch.js solving ENOENT .usage file and then remove script tags from your views to get MunchJS fully working.
Although MunchJS is many years old, it seems pretty useful as companies like Google and Facebook develop and utilize their own tools that do pretty much the same thing. So, as this may interest some people, I'm creating this Issue thread to help us install & use MunchJS as it was intended for.
In the initial scenario, we need a fresh install:
Git clone repo
$ cd ~
$ git clone https://github.com/jmrocela/munchjs.git
Install MunchJS globally:
$ npm install -g .
note the.at the end of the line
Test the tool with some simple example
index.html:
<html>
<head>
<title>This is a simple title</title>
</head>
<body>
</body>
<script src="js.js"></script>
</html>
Our first error: missing setters parameters
$ munch --view index.html
/usr/lib/node_modules/munch/node_modules/jquery/node_modules/jsdom/lib/jsdom/level1/core.js:418
set nodeName() { throw new core.DOMException();},
^^
SyntaxError: Setter must have exactly one formal parameter.
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/lib/node_modules/munch/node_modules/jquery/node_modules/jsdom/lib/jsdom/level2/core.js:1:94)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
You can solve it by entering the needed parameters in the setter functions. I'm using Sublime Text 2, so this is simple:
find what: set (\w+)\(\)
replace with: set \1(a)
We then execute munchjs again...
$ munch --view index.html
/usr/lib/node_modules/munch/node_modules/jquery/node_modules/jsdom/lib/jsdom/level2/html.js:446
set head() { /* noop */ },
^^
SyntaxError: Setter must have exactly one formal parameter.
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/lib/node_modules/munch/node_modules/jquery/node_modules/jsdom/lib/jsdom/level3/html.js:2:12)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
Hooray! Almost done! We can fix it by the same way we have fixed level1/core.js and then continue testin
$ munch --view index.html
fs.js:584
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open './usage'
at Error (native)
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:431:33)
at Object.exports.run (/usr/lib/node_modules/munch/munch.js:859:31)
at Object.<anonymous> (/usr/lib/node_modules/munch/bin/munch:7:27)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:429:10)
This is easily solved with this magic replacement:
$ munch --view index.html
__ ___ __ _
/ |/ /_ _____ ____/ / (_)__
/ /|_/ / // / _ \/ __/ _ \ / (_-<
/_/ /_/\_,_/_//_/\__/_//_/_/ /___/
|___/
Copyright (c) 2013 John Rocela <me@iamjamoy.com>
Processing view
index.html
Finished!
-------------------------------
Mapped 0 IDs and Classes
-------------------------------
Rewriting view
/usr/lib/node_modules/munch/node_modules/jsdom/lib/jsdom/level1/core.js:554
Array.prototype.splice.call(this._childNodes, refChildIndex, 0, newCh
ild);
^
TypeError: Cannot set property length of [object Object] which has only a getter
at Object.core.Node.insertBefore (/usr/lib/node_modules/munch/node_modules/jsdom/lib/jsdom/level1/core.js:554:30)
at Object.<anonymous> (/usr/lib/node_modules/munch/node_modules/jsdom/lib/jsdom/level2/events.js:314:20)
at Object.proto.(anonymous function) [as insertBefore] (/usr/lib/node_modules/munch/node_modules/jsdom/lib/jsdom/utils.js:21:26)
at Object.core.Node.appendChild (/usr/lib/node_modules/munch/node_modules/jsdom/lib/jsdom/level1/core.js:672:17)
at Function.jQuery.extend.clean (/usr/lib/node_modules/munch/node_modules/jquery/lib/node-jquery.js:6431:15)
at Function.jQuery.buildFragment (/usr/lib/node_modules/munch/node_modules/jquery/lib/node-jquery.js:6189:10)
at jQuery.fn.extend.domManip (/usr/lib/node_modules/munch/node_modules/jquery/lib/node-jquery.js:5999:21)
at jQuery.fn.extend.append (/usr/lib/node_modules/munch/node_modules/jquery/lib/node-jquery.js:5802:15)
at null.<anonymous> (/usr/lib/node_modules/munch/node_modules/jquery/lib/node-jquery.js:5732:18)
at Function.jQuery.extend.access (/usr/lib/node_modules/munch/node_modules/jquery/lib/node-jquery.js:839:9)
This error is very strange, at least for me, as I've found a simple solution that makes MunchJS run flawlessly: modify index.html, removing < script > tags.
The modified index.html now looks like:
<html>
<head>
<title>This is a simple title</title>
</head>
<body>
</body>
</html>
Well, at this moment I'm investigating the causes for this error, but for now this solution works and I'm on my way to expanding rewriteJS regexes. After Munching, re-inserting script tags is simple, so I won't be dealing with this problem further.
The text was updated successfully, but these errors were encountered:
TL;DR: patch jsdom 0.2.14 used by jquery 1.8.3 used by munchjs; patch munch.js solving ENOENT .usage file and then remove script tags from your views to get MunchJS fully working.
Although MunchJS is many years old, it seems pretty useful as companies like Google and Facebook develop and utilize their own tools that do pretty much the same thing. So, as this may interest some people, I'm creating this Issue thread to help us install & use MunchJS as it was intended for.
In the initial scenario, we need a fresh install:
Git clone repo
Install MunchJS globally:
note the . at the end of the line
Test the tool with some simple example
Our first error: missing setters parameters
Hooray! Our first error (please, refer to this)!
You can solve it by entering the needed parameters in the setter functions. I'm using Sublime Text 2, so this is simple:
We then execute munchjs again...
Hooray! Almost done! We can fix it by the same way we have fixed level1/core.js and then continue testin
Our second error: ENOENT '.usage'
Now that we solved this, we get to this
This is easily solved with this magic replacement:
Our third error: script tags
This error is very strange, at least for me, as I've found a simple solution that makes MunchJS run flawlessly: modify index.html, removing < script > tags.
The modified index.html now looks like:
Well, at this moment I'm investigating the causes for this error, but for now this solution works and I'm on my way to expanding rewriteJS regexes. After Munching, re-inserting script tags is simple, so I won't be dealing with this problem further.
The text was updated successfully, but these errors were encountered: