whet 0.0.3 → 0.0.6

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 (44) hide show
  1. package/bin/StringBuf.d.ts +13 -0
  2. package/bin/StringBuf.js +25 -0
  3. package/bin/haxe/CallStack.d.ts +41 -0
  4. package/bin/haxe/CallStack.js +96 -0
  5. package/bin/haxe/Log.d.ts +33 -0
  6. package/bin/haxe/Log.js +61 -0
  7. package/bin/haxe/NativeStackTrace.js +147 -0
  8. package/bin/whet/Log.js +3 -0
  9. package/bin/whet/Project.d.ts +1 -0
  10. package/bin/whet/Project.js +13 -8
  11. package/bin/whet/Source.d.ts +2 -2
  12. package/bin/whet/Source.js +20 -5
  13. package/bin/whet/SourceHash.d.ts +8 -1
  14. package/bin/whet/SourceHash.js +105 -7
  15. package/bin/whet/SourceId.d.ts +1 -0
  16. package/bin/whet/SourceId.js +37 -28
  17. package/bin/whet/Stone.d.ts +12 -2
  18. package/bin/whet/Stone.js +25 -13
  19. package/bin/whet/Utils.d.ts +8 -1
  20. package/bin/whet/Utils.js +56 -3
  21. package/bin/whet/Whet.js +5 -1
  22. package/bin/whet/cache/BaseCache.js +23 -20
  23. package/bin/whet/cache/CacheManager.d.ts +5 -0
  24. package/bin/whet/cache/CacheManager.js +22 -14
  25. package/bin/whet/cache/FileCache.js +89 -35
  26. package/bin/whet/magic/RoutePathType.js +10 -5
  27. package/bin/whet/magic/RouteType.d.ts +2 -2
  28. package/bin/whet/magic/RouteType.js +28 -14
  29. package/bin/whet/magic/StoneId.d.ts +1 -0
  30. package/bin/whet/magic/StoneId.js +11 -1
  31. package/bin/whet/route/Route.d.ts +5 -1
  32. package/bin/whet/route/Route.js +33 -14
  33. package/bin/whet/route/Router.js +27 -37
  34. package/bin/whet/stones/Files.js +25 -17
  35. package/bin/whet/stones/JsonStone.js +7 -7
  36. package/bin/whet/stones/RemoteFile.js +5 -8
  37. package/bin/whet/stones/Server.js +28 -19
  38. package/bin/whet/stones/Zip.js +17 -12
  39. package/bin/whet/stones/haxe/HaxeBuild.d.ts +3 -0
  40. package/bin/whet/stones/haxe/HaxeBuild.js +58 -16
  41. package/bin/whet/stones/haxe/Hxml.js +56 -34
  42. package/bin/whet.d.ts +2 -0
  43. package/bin/whet.js +2 -0
  44. package/package.json +1 -1
@@ -3,12 +3,13 @@ import {StoneId_Fields_} from "../../magic/StoneId.js"
3
3
  import {MaybeArray_Fields_} from "../../magic/MaybeArray.js"
4
4
  import {CacheStrategy, CacheDurability} from "../../cache/Cache.js"
5
5
  import {Stone} from "../../Stone.js"
6
- import {SourceId} from "../../SourceId.js"
6
+ import {SourceId, SourceId_Fields_} from "../../SourceId.js"
7
7
  import {SourceHash} from "../../SourceHash.js"
8
8
  import {SourceData} from "../../Source.js"
9
9
  import {Log} from "../../Log.js"
10
- import {Path} from "../../../haxe/io/Path.js"
10
+ import * as Path from "path"
11
11
  import {Register} from "../../../genes/Register.js"
12
+ import {StringTools} from "../../../StringTools.js"
12
13
  import {HxOverrides} from "../../../HxOverrides.js"
13
14
 
14
15
  const $global = Register.$global
@@ -26,7 +27,7 @@ class Hxml extends Register.inherits(Stone) {
26
27
  }
27
28
  clone(id) {
28
29
  var configClone = this.cloneConfig(this.config);
29
- configClone.id = StoneId_Fields_.makeStoneId(id);
30
+ configClone.id = StoneId_Fields_.makeStoneId((id == null) ? this.id : id);
30
31
  return new Hxml(configClone);
31
32
  }
32
33
  mergeConfig(additionalConfig) {
@@ -88,18 +89,23 @@ class Hxml extends Register.inherits(Stone) {
88
89
  };
89
90
  var args1 = args.concat(result);
90
91
  if (this.config.dce != null) {
92
+ var _g = this.config.dce;
91
93
  var tmp;
92
- switch (this.config.dce._hx_index) {
93
- case 0:
94
- tmp = "std";
95
- break
96
- case 1:
97
- tmp = "full";
98
- break
99
- case 2:
100
- tmp = "no";
101
- break
102
-
94
+ if (_g == null) {
95
+ throw new Error("Invalid DCE value.");
96
+ } else {
97
+ switch (_g._hx_index) {
98
+ case 0:
99
+ tmp = "std";
100
+ break
101
+ case 1:
102
+ tmp = "full";
103
+ break
104
+ case 2:
105
+ tmp = "no";
106
+ break
107
+
108
+ };
103
109
  };
104
110
  args1.push(["-dce", tmp]);
105
111
  };
@@ -142,18 +148,25 @@ class Hxml extends Register.inherits(Stone) {
142
148
  if (this.isSingleFile()) {
143
149
  var filename;
144
150
  if (this.build.config.filename != null) {
145
- filename = this.build.config.filename;
151
+ var s = this.build.config.filename;
152
+ s = Path.posix.normalize(s);
153
+ s = StringTools.replace(s, "\\", "/");
154
+ filename = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
146
155
  } else {
147
- var norm = "/" + Path.normalize(("build".charAt(0) == "/") ? HxOverrides.substr("build", 1, null) : "build");
148
- filename = ("build".lastIndexOf("/") == "build".length - 1) ? Path.addTrailingSlash(norm) : norm;
156
+ var s = "build";
157
+ s = Path.posix.normalize("build");
158
+ s = StringTools.replace(s, "\\", "/");
159
+ filename = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
149
160
  };
150
- if (Path.extension(filename) == "") {
161
+ if (Path.posix.extname(filename) == "") {
151
162
  var v = this.getBuildExtension();
152
- var p = new Path(filename);
153
- p.ext = v;
154
- var s = p.toString();
155
- var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
156
- filename = (s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm;
163
+ if (v.length > 0 && HxOverrides.cca(v, 0) != 46) {
164
+ v = "." + v;
165
+ };
166
+ var s = filename.substring(0, filename.lastIndexOf("/") + 1);
167
+ s = Path.posix.normalize(s);
168
+ s = StringTools.replace(s, "\\", "/");
169
+ filename = ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s) + Path.posix.parse(filename.substring(filename.lastIndexOf("/"))).name + v;
157
170
  };
158
171
  return filename;
159
172
  } else {
@@ -162,9 +175,14 @@ class Hxml extends Register.inherits(Stone) {
162
175
  }
163
176
  getPlatform() {
164
177
  var this1 = this.getBuildExportPath();
165
- var norm = "/" + Path.normalize(("/".charAt(0) == "/") ? HxOverrides.substr("/", 1, null) : "/");
166
- var root = ("/".lastIndexOf("/") == "/".length - 1) ? Path.addTrailingSlash(norm) : norm;
167
- var path = (root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1;
178
+ var s = "/";
179
+ s = Path.posix.normalize("/");
180
+ s = StringTools.replace(s, "\\", "/");
181
+ var root = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
182
+ if (this1.charAt(0) != "/") {
183
+ throw new Error("Badly formed SourceId.");
184
+ };
185
+ var path = Path.posix.join(".", root, ".", this1);
168
186
  var _g = this.config.platform;
169
187
  if (_g == null) {
170
188
  return [];
@@ -264,14 +282,18 @@ class Hxml extends Register.inherits(Stone) {
264
282
  }
265
283
  filename() {
266
284
  var s = this.id;
267
- var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
268
- var fn = (s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm;
269
- if (Path.extension(fn) == "") {
270
- var p = new Path(fn);
271
- p.ext = "hxml";
272
- var s = p.toString();
273
- var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
274
- fn = (s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm;
285
+ s = Path.posix.normalize(s);
286
+ s = StringTools.replace(s, "\\", "/");
287
+ var fn = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
288
+ if (Path.posix.extname(fn) == "") {
289
+ var v = "hxml";
290
+ if ("hxml".length > 0 && HxOverrides.cca("hxml", 0) != 46) {
291
+ v = "." + "hxml";
292
+ };
293
+ var s = fn.substring(0, fn.lastIndexOf("/") + 1);
294
+ s = Path.posix.normalize(s);
295
+ s = StringTools.replace(s, "\\", "/");
296
+ fn = ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s) + Path.posix.parse(fn.substring(fn.lastIndexOf("/"))).name + v;
275
297
  };
276
298
  return fn;
277
299
  }
package/bin/whet.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
 
2
2
  export {ZipStone} from "./whet/stones/Zip"
3
3
  export {ZipConfig} from "./whet/stones/Zip"
4
+ export {Utils} from "./whet/Utils"
4
5
  export {Stone} from "./whet/Stone"
5
6
  export {ServerConfig} from "./whet/stones/Server"
6
7
  export {Server} from "./whet/stones/Server"
7
8
  export {Router} from "./whet/route/Router"
9
+ export {Route} from "./whet/route/Route"
8
10
  export {RemoteFileConfig} from "./whet/stones/RemoteFile"
9
11
  export {RemoteFile} from "./whet/stones/RemoteFile"
10
12
  export {Project} from "./whet/Project"
package/bin/whet.js CHANGED
@@ -6,9 +6,11 @@ const $global = Register.$global
6
6
 
7
7
  Whet_Fields_.main()
8
8
  export {ZipStone} from "./whet/stones/Zip.js"
9
+ export {Utils} from "./whet/Utils.js"
9
10
  export {Stone} from "./whet/Stone.js"
10
11
  export {Server} from "./whet/stones/Server.js"
11
12
  export {Router} from "./whet/route/Router.js"
13
+ export {Route} from "./whet/route/Route.js"
12
14
  export {RemoteFile} from "./whet/stones/RemoteFile.js"
13
15
  export {Project} from "./whet/Project.js"
14
16
  export {Log} from "./whet/Log.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whet",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "NodeJS based assets management and project tooling library.",
5
5
  "scripts": {
6
6
  "devinit": "npx dts2hx commander --modular --noLibWrap",