-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIndex.js
More file actions
35 lines (35 loc) · 1.41 KB
/
Index.js
File metadata and controls
35 lines (35 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var jServer = require('./lib/JDebugServer');
var utils = require('./lib/Utils');
var project = require('./lib/ProjectBuilder');
// handlers:
var tsHandler = require('./lib/handlers/TypeScriptHandler');
var cssHandler = require('./lib/handlers/CssHandler');
var templatesHandler = require('./lib/handlers/TemplatesHandler');
var definitionHandler = require('./lib/handlers/DefinitionHandler');
var build = require('jasper-build');
function jDebugServer(app, server, configFile) {
if (configFile === void 0) { configFile = 'jasper.json'; }
var buildConfig = utils.readJSON(configFile);
if (!buildConfig || !buildConfig.jDebugEnabled) {
return;
}
// debug enabled in config file? todo: extends
var jDebugUrl = '/jdebug';
var builder = new project.ProjectBuilder(new build.BuildManager(buildConfig));
function createServer() {
var jDebugServer = new jServer.JDebugServer(server, jDebugUrl, buildConfig.appPath);
// list of default handlers
var handlers = [
new tsHandler(jDebugServer),
new cssHandler(jDebugServer),
new templatesHandler(jDebugServer),
new definitionHandler(jDebugServer, builder)
];
jDebugServer.watch(handlers);
utils.log('server started at: ' + jDebugUrl);
return jDebugServer;
}
builder.rebuildProject();
app.jDebugServer = createServer;
}
module.exports = jDebugServer;