Closed sagiegurari closed 9 years ago
Are you compiling the script with spider -c
and then run it on node, or execute the script through spider (spider script.spider
)?
running the spider.compile via node
var spider = require('spider-script'); spider.compile(....);
see at: https://github.com/sagiegurari/node-spider-script/blob/master/lib/spider-loader.js
it works good with 0.0.6 and 0.0.7, but with the 0.1.x you changed to use that system.register that should be defined at begining of script file.
Okay, fixed in 0.1.3. Please note that the spider.compile
has been refactored. It will be documented soon.
Usage:
var out = spider.compile({
text: "var x = 5;",
fileName: "test.spider",
target: "ES5", // (or "ES6")
generateSourceMap: true
});
The out
object has 3 properties: errors
, result
and sourceMap
.
To print errors, you can use the spider.formatErrors
API. For example:
console.log(spider.formatErrors("test.spider", "var x = 5;", out.errors));
beatzlaha, and thanks for your plugin :)
great. i'll try it out tomorrow and release a new version based on it. thanks for the quick fix.
works good and I made the changes as per you comment. I saw the lang changed a bit (from func to fn) so I fixed my test cases as well.
when running under nodeJS (not browser), in spider.js you start with System.register but there is no var System = require(...) so System is not defined.