nexusframework 0.3.0-beta.73 → 0.3.0-beta.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/LICENSE.md +55 -55
  2. package/README.md +12 -12
  3. package/about/index.json +5 -5
  4. package/about/index.nhp +4 -4
  5. package/icon.png +0 -0
  6. package/index.d.ts +0 -2
  7. package/index.js +0 -0
  8. package/index.js.map +1 -1
  9. package/index.ts +101 -101
  10. package/indexOfSkeleton.nhp +133 -133
  11. package/legacySkeleton.nhp +22 -22
  12. package/loader/overlay.css +1 -1
  13. package/loader/overlay.html +25 -25
  14. package/loader/overlay.scss +152 -152
  15. package/package.json +102 -90
  16. package/scripts/es5/compat.js +100 -100
  17. package/scripts/es5/compat.min.js +1 -1
  18. package/scripts/es5/loader.js +0 -0
  19. package/scripts/es5/loader.js.map +0 -0
  20. package/scripts/es5/loader.min.js +1 -1
  21. package/scripts/es5/loader.min.js.map +0 -0
  22. package/scripts/es5/nexusframeworkclient.js +1224 -1224
  23. package/scripts/es5/nexusframeworkclient.js.map +0 -0
  24. package/scripts/es5/nexusframeworkclient.min.js +1 -1
  25. package/scripts/es5/nexusframeworkclient.min.js.map +0 -0
  26. package/scripts/es6/compat.js +64 -64
  27. package/scripts/es6/compat.min.js +1 -1
  28. package/scripts/es6/loader.js +0 -0
  29. package/scripts/es6/loader.js.map +0 -0
  30. package/scripts/es6/loader.min.js +1 -1
  31. package/scripts/es6/loader.min.js.map +0 -0
  32. package/scripts/es6/nexusframeworkclient.js +1146 -1146
  33. package/scripts/es6/nexusframeworkclient.js.map +0 -0
  34. package/scripts/es6/nexusframeworkclient.min.js +1 -1
  35. package/scripts/es6/nexusframeworkclient.min.js.map +0 -0
  36. package/scripts/index.d.ts +259 -259
  37. package/scripts/src/compat.ts +62 -62
  38. package/scripts/src/loader.ts +385 -385
  39. package/scripts/src/nexusframeworkclient.ts +1163 -1163
  40. package/scripts/tsconfig.json +11 -11
  41. package/src/cli.d.ts +1 -0
  42. package/src/cli.js +102 -102
  43. package/src/cli.js.map +1 -1
  44. package/src/cli.ts +101 -101
  45. package/src/compileScripts.d.ts +0 -0
  46. package/src/compileScripts.js +0 -0
  47. package/src/compileScripts.js.map +1 -1
  48. package/src/compileScripts.ts +153 -153
  49. package/src/nexusframework.d.ts +5 -5
  50. package/src/nexusframework.js +44 -37
  51. package/src/nexusframework.js.map +1 -1
  52. package/src/nexusframework.ts +3631 -3622
  53. package/templates/basic/package.json +3 -3
  54. package/templates/basic/www/skeleton.nhp +1 -1
  55. package/templates/bootstrap/package.json +2 -2
  56. package/templates/bootstrap/www/skeleton.nhp +1 -1
  57. package/templates/bootstrap-material-design/package.json +2 -2
  58. package/templates/bootstrap-material-design/www/skeleton.nhp +1 -1
  59. package/tsconfig.json +25 -22
  60. package/types.d.ts +612 -612
@@ -1,153 +1,153 @@
1
- import child_process = require("child_process");
2
- import uglifyJs = require("uglify-js");
3
- import uglifyEs = require("uglify-es");
4
- import logger = require("nulllogger");
5
- import async = require("async");
6
- import path = require("path");
7
- import _ = require("lodash");
8
- import fs = require("fs");
9
- import os = require("os");
10
-
11
- const cpus = os.cpus().length;
12
- const tsc = require.resolve("typescript/bin/tsc");
13
-
14
- const typeOptions = {
15
- "es5": ["--target", "ES5"],
16
- "es6": ["--target", "ES6"]
17
- };
18
-
19
- const compile = function(indir: string, outdir: string, cb: (err?: Error) => void, types = ["es5", "es6"]) {
20
- const log = new logger("NexusFramework");
21
- const sourcemap = indir === outdir;
22
- const options: any = {
23
- mangle: true,
24
- compress: true
25
- };
26
- if (sourcemap)
27
- indir = path.resolve(indir, "src");
28
- const _cpus = Math.max(1, Math.floor(cpus / types.length));
29
- fs.readdir(indir, function(err: Error, files?: string[]) {
30
- if (err)
31
- return cb(err);
32
- const compileDir = function(typeOutDir: string, _type: string, cb: (err?: Error) => void) {
33
- const l = log.extend(_type);
34
- l.info("Processing");
35
- async.eachLimit(files, _cpus, function(tsRaw, cb) {
36
- if (!/\.ts$/.test(tsRaw))
37
- return cb();
38
-
39
- const base = path.basename(tsRaw, ".ts");
40
- const minOut = base + ".min.js";
41
- const minOutJs = path.resolve(typeOutDir, minOut);
42
- const jsOut = path.resolve(typeOutDir, base + ".js");
43
- const tsIn = path.resolve(indir, tsRaw);
44
-
45
- var inmtime: number, outmtime: number;
46
- async.series([
47
- function(cb) {
48
- fs.stat(tsIn, function(err, stat) {
49
- if (err)
50
- return cb(err);
51
- inmtime = stat.mtimeMs;
52
- cb();
53
- })
54
- },
55
- function(cb) {
56
- fs.stat(minOutJs, function(err, stat) {
57
- if (err) {
58
- if (err.code === "ENOENT") {
59
- outmtime = 0;
60
- return cb();
61
- }
62
- return cb(err);
63
- }
64
- outmtime = stat.mtimeMs;
65
- cb();
66
- })
67
- }
68
- ], function(err: Error) {
69
- if (err)
70
- return cb(err);
71
- if (outmtime >= inmtime)
72
- return cb();
73
-
74
- const args = ["--module", "AMD", "--out", jsOut];
75
- const opts = typeOptions[_type];
76
- if (sourcemap)
77
- args.push("--sourceMap", "true");
78
- if (opts)
79
- args.push.apply(args, opts);
80
- args.push(tsIn);
81
-
82
- l.info("Compiling", tsIn);
83
- const child = child_process.fork(tsc, args, {stdio:"inherit"} as any);
84
- child.on("exit", function(code, signal) {
85
- if(signal)
86
- return cb(new Error("Exited with signal " + signal));
87
- if(code)
88
- return cb(new Error("Exited with code " + code));
89
-
90
- const uglify = _type === "es6" ? uglifyEs : uglifyJs;
91
- l.info("uglify ", jsOut, minOut);
92
- fs.readFile(jsOut, "utf8", function(err, code) {
93
- if(err)
94
- return cb(err);
95
- const data: any = {};
96
- data["../src/" + tsRaw] = code;
97
- const _opts: any = _.cloneDeep(options);
98
- const next = function() {
99
- const output = uglify.minify(data as any, _opts);
100
- err = output['error'];
101
- if(err)
102
- return cb(err instanceof Error ? err : new Error(err));
103
- if (sourcemap)
104
- output.code += "\n//# sourceMappingURL=" + base + ".min.js.map";
105
- fs.writeFile(minOutJs, output.code, "utf8", function(err) {
106
- if(err)
107
- return cb(err);
108
- if (sourcemap)
109
- fs.writeFile(path.resolve(typeOutDir, base + ".min.js.map"), output.map, "utf8", cb);
110
- else
111
- cb();
112
- });
113
- }
114
- if (sourcemap)
115
- fs.readFile(path.resolve(typeOutDir, base + ".js.map"), "utf8", function(err, smap) {
116
- if (err)
117
- return cb(err);
118
- _opts.sourceMap = {
119
- content: smap,
120
- filename: base + ".min.js"
121
- };
122
- next();
123
- });
124
- else
125
- fs.unlink(jsOut, function(err) {
126
- if (err)
127
- return cb(err);
128
- next();
129
- });
130
- });
131
- });
132
- });
133
- }, cb);
134
- }
135
- if(types.length === 1)
136
- compileDir(outdir, types[0], cb);
137
- else
138
- async.each(types, function(_type, cb) {
139
- compileDir(path.resolve(outdir, _type), _type, cb);
140
- }, cb);
141
- });
142
- }
143
- export = compile;
144
-
145
- if (require.main === module) {
146
- const scriptsDir = path.resolve(__dirname, "../scripts");
147
- compile(scriptsDir, scriptsDir, function(err?: Error) {
148
- if (err)
149
- throw err;
150
- else
151
- process.exit(0);
152
- });
153
- }
1
+ import child_process = require("child_process");
2
+ import uglifyJs = require("uglify-js");
3
+ import uglifyEs = require("uglify-es");
4
+ import logger = require("nulllogger");
5
+ import async = require("async");
6
+ import path = require("path");
7
+ import _ = require("lodash");
8
+ import fs = require("fs");
9
+ import os = require("os");
10
+
11
+ const cpus = os.cpus().length;
12
+ const tsc = require.resolve("typescript/bin/tsc");
13
+
14
+ const typeOptions = {
15
+ "es5": ["--target", "ES5"],
16
+ "es6": ["--target", "ES6"]
17
+ };
18
+
19
+ const compile = function(indir: string, outdir: string, cb: (err?: Error) => void, types = ["es5", "es6"]) {
20
+ const log = new logger("NexusFramework");
21
+ const sourcemap = indir === outdir;
22
+ const options: any = {
23
+ mangle: true,
24
+ compress: true
25
+ };
26
+ if (sourcemap)
27
+ indir = path.resolve(indir, "src");
28
+ const _cpus = Math.max(1, Math.floor(cpus / types.length));
29
+ fs.readdir(indir, function(err: Error, files?: string[]) {
30
+ if (err)
31
+ return cb(err);
32
+ const compileDir = function(typeOutDir: string, _type: string, cb: (err?: Error) => void) {
33
+ const l = log.extend(_type);
34
+ l.info("Processing");
35
+ async.eachLimit(files, _cpus, function(tsRaw, cb) {
36
+ if (!/\.ts$/.test(tsRaw))
37
+ return cb();
38
+
39
+ const base = path.basename(tsRaw, ".ts");
40
+ const minOut = base + ".min.js";
41
+ const minOutJs = path.resolve(typeOutDir, minOut);
42
+ const jsOut = path.resolve(typeOutDir, base + ".js");
43
+ const tsIn = path.resolve(indir, tsRaw);
44
+
45
+ var inmtime: number, outmtime: number;
46
+ async.series([
47
+ function(cb) {
48
+ fs.stat(tsIn, function(err, stat) {
49
+ if (err)
50
+ return cb(err);
51
+ inmtime = stat.mtimeMs;
52
+ cb();
53
+ })
54
+ },
55
+ function(cb) {
56
+ fs.stat(minOutJs, function(err, stat) {
57
+ if (err) {
58
+ if (err.code === "ENOENT") {
59
+ outmtime = 0;
60
+ return cb();
61
+ }
62
+ return cb(err);
63
+ }
64
+ outmtime = stat.mtimeMs;
65
+ cb();
66
+ })
67
+ }
68
+ ], function(err: Error) {
69
+ if (err)
70
+ return cb(err);
71
+ if (outmtime >= inmtime)
72
+ return cb();
73
+
74
+ const args = ["--module", "AMD", "--out", jsOut];
75
+ const opts = typeOptions[_type];
76
+ if (sourcemap)
77
+ args.push("--sourceMap", "true");
78
+ if (opts)
79
+ args.push.apply(args, opts);
80
+ args.push(tsIn);
81
+
82
+ l.info("Compiling", tsIn);
83
+ const child = child_process.fork(tsc, args, {stdio:"inherit"} as any);
84
+ child.on("exit", function(code, signal) {
85
+ if(signal)
86
+ return cb(new Error("Exited with signal " + signal));
87
+ if(code)
88
+ return cb(new Error("Exited with code " + code));
89
+
90
+ const uglify = _type === "es6" ? uglifyEs : uglifyJs;
91
+ l.info("uglify ", jsOut, minOut);
92
+ fs.readFile(jsOut, "utf8", function(err, code) {
93
+ if(err)
94
+ return cb(err);
95
+ const data: any = {};
96
+ data["../src/" + tsRaw] = code;
97
+ const _opts: any = _.cloneDeep(options);
98
+ const next = function() {
99
+ const output = uglify.minify(data as any, _opts);
100
+ err = output['error'];
101
+ if(err)
102
+ return cb(err instanceof Error ? err : new Error(err));
103
+ if (sourcemap)
104
+ output.code += "\n//# sourceMappingURL=" + base + ".min.js.map";
105
+ fs.writeFile(minOutJs, output.code, "utf8", function(err) {
106
+ if(err)
107
+ return cb(err);
108
+ if (sourcemap)
109
+ fs.writeFile(path.resolve(typeOutDir, base + ".min.js.map"), output.map, "utf8", cb);
110
+ else
111
+ cb();
112
+ });
113
+ }
114
+ if (sourcemap)
115
+ fs.readFile(path.resolve(typeOutDir, base + ".js.map"), "utf8", function(err, smap) {
116
+ if (err)
117
+ return cb(err);
118
+ _opts.sourceMap = {
119
+ content: smap,
120
+ filename: base + ".min.js"
121
+ };
122
+ next();
123
+ });
124
+ else
125
+ fs.unlink(jsOut, function(err) {
126
+ if (err)
127
+ return cb(err);
128
+ next();
129
+ });
130
+ });
131
+ });
132
+ });
133
+ }, cb);
134
+ }
135
+ if(types.length === 1)
136
+ compileDir(outdir, types[0], cb);
137
+ else
138
+ async.each(types, function(_type, cb) {
139
+ compileDir(path.resolve(outdir, _type), _type, cb);
140
+ }, cb);
141
+ });
142
+ }
143
+ export = compile;
144
+
145
+ if (require.main === module) {
146
+ const scriptsDir = path.resolve(__dirname, "../scripts");
147
+ compile(scriptsDir, scriptsDir, function(err?: Error) {
148
+ if (err)
149
+ throw err;
150
+ else
151
+ process.exit(0);
152
+ });
153
+ }
@@ -1,13 +1,12 @@
1
- /// <reference types="node" />
2
- /// <reference types="socket.io" />
3
- /// <reference types="nulllogger" />
4
1
  import { User, APIEncoder, ResponseLocals, StaticMountOptions, Renderer, PageSystemSkeleton, MountOptions, ImageResizerOptions, MappedRequestHandler, RequestHandler, RequestHandlerEntry, ExistsRequestHandler, RouteRequestHandler, AccessRequestHandler, RequestHandlerChildEntry, Request, Response } from "../types";
5
- import { Template } from "nhp/lib/Template";
6
2
  import { Application } from "express";
3
+ import socket_io = require("socket.io");
7
4
  import express = require("express");
8
5
  import events = require("events");
9
6
  import http = require("http");
10
7
  import nhp = require("nhp");
8
+ type Template = InstanceType<typeof nhp.Template>;
9
+ declare const Template: typeof nhp.Template;
11
10
  export declare class LeafRequestHandler implements RequestHandlerEntry {
12
11
  leaf: boolean;
13
12
  handle: RequestHandler<any, any>;
@@ -47,7 +46,7 @@ export declare class NexusFramework extends events.EventEmitter {
47
46
  readonly prefix: string;
48
47
  readonly app: Application;
49
48
  readonly server: http.Server;
50
- readonly io?: SocketIO.Server;
49
+ readonly io?: socket_io.Server;
51
50
  readonly logger: nulllogger.INullLogger;
52
51
  static readonly apiencoders: {
53
52
  [index: string]: APIEncoder<User, ResponseLocals<User>>;
@@ -175,3 +174,4 @@ export declare class NexusFramework extends events.EventEmitter {
175
174
  close(cb?: Function): void;
176
175
  isIOSetup(): boolean;
177
176
  }
177
+ export {};
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NexusFramework = exports.NHPRequestHandler = exports.LeafRequestHandler = void 0;
4
+ exports.createExtendedRequestHandler = createExtendedRequestHandler;
3
5
  const cookieParser = require("cookie-parser");
4
6
  const querystring = require("querystring");
5
7
  const lrucache = require("lru-weak-cache");
6
- const Template_1 = require("nhp/lib/Template");
7
8
  const nulllogger = require("nulllogger");
8
9
  const socket_io = require("socket.io");
9
10
  const useragent = require("useragent");
10
11
  const statuses = require("statuses");
11
- const chokidar = require("chokidar");
12
12
  const express = require("express");
13
13
  const mime = require("mime-magic");
14
14
  const events = require("events");
@@ -25,7 +25,8 @@ const url = require("url");
25
25
  const nhp = require("nhp");
26
26
  const fs = require("fs");
27
27
  const os = require("os");
28
- const BSON = new bson;
28
+ const Template = nhp.Template;
29
+ const BSON = bson;
29
30
  const noop = function () { };
30
31
  const mainpkgversion = (function () {
31
32
  try {
@@ -36,7 +37,7 @@ const mainpkgversion = (function () {
36
37
  }
37
38
  })();
38
39
  const iconSizes = [310, 196, 152, 150, 144, 128, 120, 114, 96, 76, 72, 70, 64, 60, 57, 48, 24, 16, 32];
39
- const socket_io_slim_js = require.resolve("socket.io-client/dist/socket.io.slim.js");
40
+ const socket_io_slim_js = require.resolve("socket.io-client/dist/socket.io.js");
40
41
  const has_slim_io_js = fs.existsSync(socket_io_slim_js);
41
42
  var socket_io_slim_path;
42
43
  var socket_io_slim_integrity;
@@ -54,8 +55,9 @@ if (has_slim_io_js) {
54
55
  else
55
56
  socket_io_slim_path = ":io/socket.io.js";
56
57
  var bson_path;
57
- const bson_js = require.resolve("bson/dist/bson.js");
58
- const bsonpkgjson = require("bson/package.json");
58
+ const bson_package_dir = _path.resolve(_path.dirname(require.resolve("bson")), "..");
59
+ const bson_js = _path.resolve(bson_package_dir, "lib/bson.bundle.js");
60
+ const bsonpkgjson = require(_path.resolve(bson_package_dir, "package.json"));
59
61
  if (bson_js) {
60
62
  bson_path = ":scripts/bson.js?v=" + bsonpkgjson.version;
61
63
  // try {
@@ -827,7 +829,6 @@ function createExtendedRequestHandler() {
827
829
  };
828
830
  return requestHandler;
829
831
  }
830
- exports.createExtendedRequestHandler = createExtendedRequestHandler;
831
832
  function lazyLoadMapping(impl, method, mapping) {
832
833
  if (impl instanceof Function)
833
834
  return impl;
@@ -1411,27 +1412,32 @@ class FSWatcherRequestHandler extends RequestHandlerWithChildren {
1411
1412
  this.pagesysskeleton = options.pagesysskeleton;
1412
1413
  this.autoindexskeleton = options.autoindexskeleton;
1413
1414
  var onready = [];
1414
- const fswatcher = this.fswatcher = chokidar.watch(fspath, {
1415
- ignorePermissionErrors: true
1416
- });
1417
1415
  const self = this;
1418
- fswatcher.on("ready", function () {
1419
- delete self.handle;
1420
- onready.forEach(function (cb) {
1421
- cb();
1416
+ const initializeWatcher = function (chokidar) {
1417
+ const fswatcher = self.fswatcher = chokidar.watch(fspath, {
1418
+ ignorePermissionErrors: true
1422
1419
  });
1423
- });
1424
- fswatcher.on("add", function (file) {
1425
- console.log("add", file);
1426
- });
1427
- fswatcher.on("remove", function (file) {
1428
- console.log("remove", file);
1429
- });
1420
+ fswatcher.on("ready", function () {
1421
+ delete self.handle;
1422
+ onready.forEach(function (cb) {
1423
+ cb();
1424
+ });
1425
+ });
1426
+ fswatcher.on("add", function (file) {
1427
+ console.log("add", file);
1428
+ });
1429
+ fswatcher.on("remove", function (file) {
1430
+ console.log("remove", file);
1431
+ });
1432
+ };
1430
1433
  this.handle = function (req, res, next) {
1431
1434
  onready.push(function () {
1432
1435
  self.handle(req, res, next);
1433
1436
  });
1434
1437
  };
1438
+ new Function("return import('chokidar')")().then(function (module) {
1439
+ initializeWatcher(module.default || module);
1440
+ });
1435
1441
  }
1436
1442
  destroy() {
1437
1443
  this.fswatcher.close();
@@ -1816,7 +1822,7 @@ class NexusFramework extends events.EventEmitter {
1816
1822
  if (!this.server)
1817
1823
  throw new Error("No server passed in constructor, cannot setup Socket.IO");
1818
1824
  const iopath = _path.posix.join(this.prefix, path);
1819
- const io = socket_io(this.server, {
1825
+ const io = new socket_io.Server(this.server, {
1820
1826
  serveClient: !has_slim_io_js,
1821
1827
  path: iopath
1822
1828
  });
@@ -2417,13 +2423,13 @@ class NexusFramework extends events.EventEmitter {
2417
2423
  };
2418
2424
  const contentType = req.get("content-type");
2419
2425
  if (!processors.length)
2420
- processors = [0 /* URLEncoded */, 2 /* JSONBody */, 1 /* MultipartFormData */];
2426
+ processors = [0 /* BodyProcessor.URLEncoded */, 2 /* BodyProcessor.JSONBody */, 1 /* BodyProcessor.MultipartFormData */];
2421
2427
  req.body = {};
2422
2428
  req.files = {};
2423
2429
  try {
2424
2430
  processors.forEach((processor) => {
2425
2431
  switch (processor) {
2426
- case 2 /* JSONBody */:
2432
+ case 2 /* BodyProcessor.JSONBody */:
2427
2433
  if (/\/(x\-)?json$/.test(contentType)) {
2428
2434
  req.readBody(function (err, data) {
2429
2435
  if (err)
@@ -2439,7 +2445,7 @@ class NexusFramework extends events.EventEmitter {
2439
2445
  throw true;
2440
2446
  }
2441
2447
  break;
2442
- case 0 /* URLEncoded */:
2448
+ case 0 /* BodyProcessor.URLEncoded */:
2443
2449
  if (/\/(((x\-)?www\-)?form\-)?urlencoded$/.test(contentType)) {
2444
2450
  req.readBody(function (err, data) {
2445
2451
  if (err)
@@ -2455,7 +2461,7 @@ class NexusFramework extends events.EventEmitter {
2455
2461
  throw true;
2456
2462
  }
2457
2463
  break;
2458
- case 1 /* MultipartFormData */:
2464
+ case 1 /* BodyProcessor.MultipartFormData */:
2459
2465
  if (/multipart\/form\-data(;.+)?$/.test(contentType)) {
2460
2466
  this.multerInstance(req, res, function (err) {
2461
2467
  if (err)
@@ -2955,7 +2961,7 @@ class NexusFramework extends events.EventEmitter {
2955
2961
  }
2956
2962
  });
2957
2963
  if (icon)
2958
- locals.progressContainerHead = "<div class=\"loader-progress-heading\"><img width=\"152\" src=\"" + Template_1.Template.encodeHTML(icon, true) + "\" /></div>";
2964
+ locals.progressContainerHead = "<div class=\"loader-progress-heading\"><img width=\"152\" src=\"" + Template.encodeHTML(icon, true) + "\" /></div>";
2959
2965
  else
2960
2966
  locals.progressContainerHead = "";
2961
2967
  }
@@ -3069,7 +3075,7 @@ class NexusFramework extends events.EventEmitter {
3069
3075
  }
3070
3076
  else {
3071
3077
  out.write("<script type=\"text/javascript\" src=\"");
3072
- out.write(Template_1.Template.encodeHTML(url.format(script.source), true));
3078
+ out.write(Template.encodeHTML(url.format(script.source), true));
3073
3079
  out.write("\"></script>");
3074
3080
  }
3075
3081
  });
@@ -3161,7 +3167,7 @@ class NexusFramework extends events.EventEmitter {
3161
3167
  const _url = url.parse(req.originalUrl, true);
3162
3168
  _url.query = _url.query || {};
3163
3169
  _url.query.noscript = "1";
3164
- out.write(Template_1.Template.encodeHTML(url.format(_url), true));
3170
+ out.write(Template.encodeHTML(url.format(_url), true));
3165
3171
  out.write('\'" /></noscript>');
3166
3172
  }
3167
3173
  }
@@ -3176,7 +3182,7 @@ class NexusFramework extends events.EventEmitter {
3176
3182
  out.write("\" type=\"image/");
3177
3183
  out.write(type);
3178
3184
  out.write("\" href=\"");
3179
- out.write(Template_1.Template.encodeHTML(icons + size + "." + type, true));
3185
+ out.write(Template.encodeHTML(icons + size + "." + type, true));
3180
3186
  out.write("\">");
3181
3187
  });
3182
3188
  }
@@ -3198,7 +3204,7 @@ class NexusFramework extends events.EventEmitter {
3198
3204
  else
3199
3205
  out.write("unknown");
3200
3206
  out.write("\" href=\"");
3201
- out.write(Template_1.Template.encodeHTML(path, true));
3207
+ out.write(Template.encodeHTML(path, true));
3202
3208
  out.write("\">");
3203
3209
  });
3204
3210
  }
@@ -3218,9 +3224,9 @@ class NexusFramework extends events.EventEmitter {
3218
3224
  else
3219
3225
  out.write("name");
3220
3226
  out.write("=\"");
3221
- out.write(Template_1.Template.encodeHTML(key, true));
3227
+ out.write(Template.encodeHTML(key, true));
3222
3228
  out.write("\" content=\"");
3223
- out.write(Template_1.Template.encodeHTML(meta[key]));
3229
+ out.write(Template.encodeHTML(meta[key]));
3224
3230
  out.write("\" />");
3225
3231
  });
3226
3232
  const links = res.locals.links;
@@ -3231,9 +3237,9 @@ class NexusFramework extends events.EventEmitter {
3231
3237
  catch (e) { }
3232
3238
  Object.keys(links).forEach(function (link) {
3233
3239
  out.write("<link rel=\"");
3234
- out.write(Template_1.Template.encodeHTML(link, true));
3240
+ out.write(Template.encodeHTML(link, true));
3235
3241
  out.write("\" href=\"");
3236
- out.write(Template_1.Template.encodeHTML(links[link], true));
3242
+ out.write(Template.encodeHTML(links[link], true));
3237
3243
  out.write("\" />");
3238
3244
  });
3239
3245
  }
@@ -3273,7 +3279,7 @@ class NexusFramework extends events.EventEmitter {
3273
3279
  }
3274
3280
  else {
3275
3281
  out.write("<link rel=\"stylesheet\" href=\"");
3276
- out.write(Template_1.Template.encodeHTML(url.format(style.source), true));
3282
+ out.write(Template.encodeHTML(url.format(style.source), true));
3277
3283
  out.write("\">");
3278
3284
  }
3279
3285
  });
@@ -3544,12 +3550,14 @@ class NexusFramework extends events.EventEmitter {
3544
3550
  this.__express(req, res, next);
3545
3551
  }
3546
3552
  close(cb) {
3553
+ this.nhp.destroy();
3547
3554
  this.server.close(cb);
3548
3555
  }
3549
3556
  isIOSetup() {
3550
3557
  return !!this.io;
3551
3558
  }
3552
3559
  }
3560
+ exports.NexusFramework = NexusFramework;
3553
3561
  NexusFramework.apiencoders = {
3554
3562
  "json": function (locals, req, res) {
3555
3563
  res.type("text/json").end(JSON.stringify(locals));
@@ -3564,7 +3572,6 @@ NexusFramework.apiencoders = {
3564
3572
  res.type("text/xml").end(XML.stringify(locals));
3565
3573
  }
3566
3574
  };
3567
- exports.NexusFramework = NexusFramework;
3568
3575
  NexusFramework.prototype.use = NexusFramework.prototype.pushMiddleware;
3569
3576
  const json = SocketIOResponse.prototype.json;
3570
3577
  NexusFramework.expressUpgrade(SocketIORequest.prototype, SocketIOResponse.prototype, true);