Closed cooolbasha closed 10 years ago
Mostly. You can use the node-theseus module just like the node-theseus wrapper does. However, it works by hooking into require, so if you do it from within app.js, app.js won't be instrumented.
what does the launch do..it has an fork and spawn
The only necessary part of launch()
is the last line, require(scriptPath)
. The rest is defense against programmer errors & misconceptions.
I am newby...sorry about the asking basic question..where are you calling node app.js. I assume that require(scriptPath) is require 'app.js' you have a web server created and how is the connection from app.js / other files done from ... is throuhg the instrumentation thing...what is the sms install doing..
Don't worry about it!
Yes, scriptPath
ends up being the (full) path to app.js
, and requiring a file executes it. Since beginInstrumentation has added a hook to instrument any .js
files that get required, app.js
will be instrumented.
listen() starts a WebSocket server that Brackets connects to to get debugging information from your program.
sms is the source-map-support module required at the top of the file. It uses source maps to print stack traces containing the original source code instead of the instrumented source code.
Your initial question, "can this be a express module" makes me wonder if we aren't going down the wrong path.
I started fondue-middleware so that I could drop that into any Connect/Express server and have all the JavaScript be instrumented. Look at bin/fondue-proxy
and bin/fondue-server
for examples. I can't remember if I finished it, but it seemed to work just now, so I pushed it to npm. :) You won't be able to debug the page with Brackets without some additional work, but you'll be able to use fondue's API directly on the page.
what do you mean by instrumenting
instead of calling as node-thesus app.js can I call as nodemon app.js with the option to call the thesus based on a flag within the app.js