whet 0.0.9 → 0.0.10

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.
package/bin/whet/Whet.js CHANGED
@@ -10,7 +10,7 @@ const $global = Register.$global
10
10
  export const Whet_Fields_ = Register.global("$hxClasses")["whet._Whet.Whet_Fields_"] =
11
11
  class Whet_Fields_ {
12
12
  static main() {
13
- Whet_Fields_.program.enablePositionalOptions().passThroughOptions().description("Project tooling.").usage("[options] [command] [+ [command]...]").version("0.0.9", "-v, --version").allowUnknownOption(true).showSuggestionAfterError(true).option("-p, --project <file>", "project to run", "Project.mjs").option("-l, --log-level <level>", "log level, a string/number", "info");
13
+ Whet_Fields_.program.enablePositionalOptions().passThroughOptions().description("Project tooling.").usage("[options] [command] [+ [command]...]").version("0.0.10", "-v, --version").allowUnknownOption(true).showSuggestionAfterError(true).option("-p, --project <file>", "project to run", "Project.mjs").option("-l, --log-level <level>", "log level, a string/number", "info");
14
14
  Whet_Fields_.program.parse();
15
15
  var options = Whet_Fields_.program.opts();
16
16
  if (options.logLevel != null) {
@@ -98,26 +98,25 @@ class Server extends Register.inherits(Stone) {
98
98
  id = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
99
99
  };
100
100
  this.config.router.find(id).then(function (routeResult) {
101
- var sourcePromise = (routeResult.length > 0) ? routeResult[0].get() : (_gthis.routeDynamic != null) ? _gthis.routeDynamic(id) : null;
102
- if (sourcePromise != null) {
103
- sourcePromise.then(function (source) {
104
- res.writeHead(200, {"Content-Type": Mime.getType(Path.posix.extname(id).toLowerCase()), "Last-Modified": new Date(source.source.ctime * 1000).toUTCString(), "Content-Length": Std.string(source.data.length), "Cache-Control": "no-store, no-cache"});
105
- res.write(source.data, "binary");
101
+ return ((routeResult.length > 0) ? routeResult[0].get() : (_gthis.routeDynamic != null) ? _gthis.routeDynamic(id) : Promise.resolve(null)).then(function (source) {
102
+ if (source == null) {
103
+ res.writeHead(404, "File not found.");
106
104
  res.end();
107
- })["catch"](function (e) {
108
- Log.log(40, ...["Server error.", {"error": e}]);
109
- res.writeHead(500, "Error happened.");
110
- if (((e) instanceof Error)) {
111
- res.write(e.stack, "utf-8");
112
- } else {
113
- res.write(Std.string(e), "utf-8");
114
- };
115
- res.end();
116
- });
117
- } else {
118
- res.writeHead(404, "File not found.");
105
+ return;
106
+ };
107
+ res.writeHead(200, {"Content-Type": Mime.getType(Path.posix.extname(id).toLowerCase()), "Last-Modified": new Date(source.source.ctime * 1000).toUTCString(), "Content-Length": Std.string(source.data.length), "Cache-Control": "no-store, no-cache"});
108
+ res.write(source.data, "binary");
119
109
  res.end();
120
- };
110
+ })["catch"](function (e) {
111
+ Log.log(40, ...["Server error.", {"error": e}]);
112
+ res.writeHead(500, "Error happened.");
113
+ if (((e) instanceof Error)) {
114
+ res.write(e.stack, "utf-8");
115
+ } else {
116
+ res.write(Std.string(e), "utf-8");
117
+ };
118
+ res.end();
119
+ });
121
120
  })["catch"](function (e) {
122
121
  Log.log(40, ...["Server error.", {"error": e}]);
123
122
  res.writeHead(500, "Error happened.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whet",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "NodeJS based assets management and project tooling library.",
5
5
  "scripts": {
6
6
  "devinit": "npx dts2hx commander --modular --noLibWrap",