whet 0.0.14 → 0.0.15

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.
@@ -39,12 +39,14 @@ export declare class SourceData {
39
39
  /**
40
40
  Same as `getFilePath` but relative to project, not CWD.
41
41
  */
42
- protected getFilePathId(idOverride?: null | string): Promise<string>
42
+ getFilePathId(idOverride?: null | string): Promise<string>
43
43
 
44
44
  /**
45
- Path to a file for this source, relative to CWD.
45
+ * Path to a file for this source, relative to CWD.
46
+ * Useful for working with sources outside of Whet ecosystem.
47
+ * @param [idOverride] Use to change the name/directory of the file. Ignored if source already has a filepath.
46
48
  */
47
- protected getFilePath(idOverride?: null | string): Promise<string>
49
+ getFilePath(idOverride?: null | string): Promise<string>
48
50
 
49
51
  /**
50
52
  * @param id Path id relative to stone that generates it.
@@ -1,9 +1,8 @@
1
1
  import {Utils} from "./Utils.js"
2
2
  import {SourceId, RootDir} from "./SourceId.js"
3
3
  import {SourceHash} from "./SourceHash.js"
4
- import {Log as Log__1} from "./Log.js"
4
+ import {Log} from "./Log.js"
5
5
  import * as Path from "path"
6
- import {Log} from "../haxe/Log.js"
7
6
  import {Register} from "../genes/Register.js"
8
7
  import * as Fs from "fs"
9
8
  import {Buffer} from "buffer"
@@ -83,7 +82,6 @@ class SourceData extends Register.inherits() {
83
82
  */
84
83
  getFilePathId(idOverride) {
85
84
  var _gthis = this;
86
- Log.trace(this.filePath, {"fileName": "src/whet/Source.hx", "lineNumber": 106, "className": "whet.SourceData", "methodName": "getFilePathId", "customParams": [this.filePathId, idOverride]});
87
85
  if (this.filePathId == null) {
88
86
  return this.getFilePath(idOverride).then(function (_) {
89
87
  return _gthis.filePathId;
@@ -94,7 +92,9 @@ class SourceData extends Register.inherits() {
94
92
  }
95
93
 
96
94
  /**
97
- Path to a file for this source, relative to CWD.
95
+ * Path to a file for this source, relative to CWD.
96
+ * Useful for working with sources outside of Whet ecosystem.
97
+ * @param [idOverride] Use to change the name/directory of the file. Ignored if source already has a filepath.
98
98
  */
99
99
  getFilePath(idOverride) {
100
100
  var _gthis = this;
@@ -110,7 +110,6 @@ class SourceData extends Register.inherits() {
110
110
  throw new Error("Badly formed SourceId.");
111
111
  };
112
112
  this.filePath = Path.posix.join(".", root, ".", this1);
113
- Log.trace(dir, {"fileName": "src/whet/Source.hx", "lineNumber": 121, "className": "whet.SourceData", "methodName": "getFilePath", "customParams": [this.filePath, this.filePathId]});
114
113
  return Utils.saveBytes(this.filePath, this.data).then(function (_) {
115
114
  return _gthis.filePath;
116
115
  });
@@ -129,7 +128,7 @@ class SourceData extends Register.inherits() {
129
128
  return new Promise(function (res, rej) {
130
129
  Fs.readFile(path, function (err, buffer) {
131
130
  if (err != null) {
132
- Log__1.log(50, ...["File does not exist.", {"id": id, "path": path}]);
131
+ Log.log(50, ...["File does not exist.", {"id": id, "path": path}]);
133
132
  res(null);
134
133
  } else {
135
134
  var source = SourceData.fromBytes(id, buffer);
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.14", "-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.15", "-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) {
@@ -94,7 +94,6 @@ class FileCache extends Register.inherits(BaseCache) {
94
94
  if (_g._hx_index == 3) {
95
95
  var _g1 = _g.path;
96
96
  if (source.data.length == 1) {
97
- console.log("src/whet/cache/FileCache.hx:46:",_g1);
98
97
  var s = _g1.substring(_g1.lastIndexOf("/"));
99
98
  var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
100
99
  if (str.length > 0) {
@@ -109,7 +108,6 @@ class FileCache extends Register.inherits(BaseCache) {
109
108
  } else {
110
109
  idOverride = null;
111
110
  };
112
- console.log("src/whet/cache/FileCache.hx:50:",idOverride);
113
111
  var _g = [];
114
112
  var _g1 = 0;
115
113
  var _g2 = source.data;
@@ -118,9 +116,7 @@ class FileCache extends Register.inherits(BaseCache) {
118
116
  ++_g1;
119
117
  _g.push(data[0].getFilePathId(idOverride).then((function (data) {
120
118
  return function (filePath) {
121
- var tmp = SourceHash.fromBytes(data[0].data);
122
- console.log("src/whet/cache/FileCache.hx:53:",filePath);
123
- return {"fileHash": tmp, "filePath": filePath, "id": data[0].id};
119
+ return {"fileHash": SourceHash.fromBytes(data[0].data), "filePath": filePath, "id": data[0].id};
124
120
  };
125
121
  })(data)));
126
122
  };
@@ -1,4 +1,3 @@
1
- import {Log} from "../../haxe/Log.js"
2
1
  import {Register} from "../../genes/Register.js"
3
2
 
4
3
  const $global = Register.$global
@@ -13,16 +12,6 @@ class RouteResult extends Register.inherits() {
13
12
  get() {
14
13
  var _gthis = this;
15
14
  return this.source.getSource().then(function (data) {
16
- Log.trace("getting ", {"fileName": "src/whet/route/RouteResult.hx", "lineNumber": 17, "className": "whet.route.RouteResult", "methodName": "get", "customParams": [_gthis.sourceId, "has data:"]});
17
- var _this = data.data;
18
- var result = new Array(_this.length);
19
- var _g = 0;
20
- var _g1 = _this.length;
21
- while (_g < _g1) {
22
- var i = _g++;
23
- result[i] = _this[i].id;
24
- };
25
- console.log("src/whet/route/RouteResult.hx:18:",result);
26
15
  return data.get(_gthis.sourceId);
27
16
  });
28
17
  }
@@ -1,9 +1,8 @@
1
1
  import {Stone} from "../Stone.js"
2
- import {Log, Log as Log__2} from "../Log.js"
2
+ import {Log} from "../Log.js"
3
3
  import * as Path from "path"
4
4
  import Mime from "mime"
5
5
  import * as Http from "http"
6
- import {Log as Log__1} from "../../haxe/Log.js"
7
6
  import {Register} from "../../genes/Register.js"
8
7
  import {StringTools} from "../../StringTools.js"
9
8
  import {Std} from "../../Std.js"
@@ -99,11 +98,7 @@ class Server extends Register.inherits(Stone) {
99
98
  id = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
100
99
  };
101
100
  this.config.router.find(id).then(function (routeResult) {
102
- Log__1.trace("result for ", {"fileName": "src/whet/stones/Server.hx", "lineNumber": 60, "className": "whet.stones.Server", "methodName": "handler", "customParams": [id]});
103
- console.log("src/whet/stones/Server.hx:61:",routeResult);
104
101
  return ((routeResult.length > 0) ? routeResult[0].get() : (_gthis.routeDynamic != null) ? _gthis.routeDynamic(id) : Promise.resolve(null)).then(function (source) {
105
- Log__1.trace("Source for ", {"fileName": "src/whet/stones/Server.hx", "lineNumber": 66, "className": "whet.stones.Server", "methodName": "handler", "customParams": [id]});
106
- console.log("src/whet/stones/Server.hx:67:",source);
107
102
  if (source == null) {
108
103
  res.writeHead(404, "File not found.");
109
104
  res.end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whet",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "NodeJS based assets management and project tooling library.",
5
5
  "scripts": {
6
6
  "devinit": "npx dts2hx commander --modular --noLibWrap",