whet 0.0.5 → 0.0.8

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 (43) 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/NativeStackTrace.js +147 -0
  6. package/bin/whet/Log.js +3 -0
  7. package/bin/whet/Project.d.ts +5 -2
  8. package/bin/whet/Project.js +32 -9
  9. package/bin/whet/Source.d.ts +2 -2
  10. package/bin/whet/Source.js +21 -5
  11. package/bin/whet/SourceHash.d.ts +7 -1
  12. package/bin/whet/SourceHash.js +93 -7
  13. package/bin/whet/SourceId.d.ts +1 -0
  14. package/bin/whet/SourceId.js +37 -28
  15. package/bin/whet/Stone.d.ts +21 -5
  16. package/bin/whet/Stone.js +63 -18
  17. package/bin/whet/Utils.d.ts +8 -2
  18. package/bin/whet/Utils.js +25 -5
  19. package/bin/whet/Whet.js +4 -1
  20. package/bin/whet/cache/BaseCache.js +18 -17
  21. package/bin/whet/cache/CacheManager.d.ts +5 -0
  22. package/bin/whet/cache/CacheManager.js +21 -12
  23. package/bin/whet/cache/FileCache.js +83 -43
  24. package/bin/whet/magic/RoutePathType.js +10 -4
  25. package/bin/whet/magic/RouteType.d.ts +4 -3
  26. package/bin/whet/magic/RouteType.js +31 -13
  27. package/bin/whet/magic/StoneId.d.ts +1 -0
  28. package/bin/whet/magic/StoneId.js +11 -1
  29. package/bin/whet/route/Route.d.ts +5 -1
  30. package/bin/whet/route/Route.js +33 -13
  31. package/bin/whet/route/Router.js +27 -36
  32. package/bin/whet/stones/Files.js +25 -16
  33. package/bin/whet/stones/JsonStone.js +7 -6
  34. package/bin/whet/stones/RemoteFile.js +5 -7
  35. package/bin/whet/stones/Server.d.ts +1 -2
  36. package/bin/whet/stones/Server.js +29 -22
  37. package/bin/whet/stones/Zip.js +17 -11
  38. package/bin/whet/stones/haxe/HaxeBuild.d.ts +2 -2
  39. package/bin/whet/stones/haxe/HaxeBuild.js +42 -69
  40. package/bin/whet/stones/haxe/Hxml.js +39 -24
  41. package/bin/whet.d.ts +3 -0
  42. package/bin/whet.js +3 -0
  43. 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) {
@@ -148,19 +149,24 @@ class Hxml extends Register.inherits(Stone) {
148
149
  var filename;
149
150
  if (this.build.config.filename != null) {
150
151
  var s = this.build.config.filename;
151
- var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
152
- filename = (s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm;
152
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
153
+ s = StringTools.replace(s, "\\", "/");
154
+ filename = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
153
155
  } else {
154
- var norm = "/" + Path.normalize(("build".charAt(0) == "/") ? HxOverrides.substr("build", 1, null) : "build");
155
- filename = ("build".lastIndexOf("/") == "build".length - 1) ? Path.addTrailingSlash(norm) : norm;
156
+ var s = "build";
157
+ s = Path.posix.normalize(("build".length > 1 && SourceId_Fields_.startsWithSlash("build")) ? HxOverrides.substr("build", 1, null) : "build");
158
+ s = StringTools.replace(s, "\\", "/");
159
+ filename = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
156
160
  };
157
- if (Path.extension(filename) == "") {
161
+ if (Path.posix.extname(filename) == "") {
158
162
  var v = this.getBuildExtension();
159
- var p = new Path(filename);
160
- p.ext = v;
161
- var s = p.toString();
162
- var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
163
- 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.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
168
+ s = StringTools.replace(s, "\\", "/");
169
+ filename = ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s) + Path.posix.parse(filename.substring(filename.lastIndexOf("/"))).name + v;
164
170
  };
165
171
  return filename;
166
172
  } else {
@@ -169,9 +175,14 @@ class Hxml extends Register.inherits(Stone) {
169
175
  }
170
176
  getPlatform() {
171
177
  var this1 = this.getBuildExportPath();
172
- var norm = "/" + Path.normalize(("/".charAt(0) == "/") ? HxOverrides.substr("/", 1, null) : "/");
173
- var root = ("/".lastIndexOf("/") == "/".length - 1) ? Path.addTrailingSlash(norm) : norm;
174
- var path = (root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1;
178
+ var s = "/";
179
+ s = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
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);
175
186
  var _g = this.config.platform;
176
187
  if (_g == null) {
177
188
  return [];
@@ -271,14 +282,18 @@ class Hxml extends Register.inherits(Stone) {
271
282
  }
272
283
  filename() {
273
284
  var s = this.id;
274
- var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
275
- var fn = (s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm;
276
- if (Path.extension(fn) == "") {
277
- var p = new Path(fn);
278
- p.ext = "hxml";
279
- var s = p.toString();
280
- var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
281
- fn = (s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm;
285
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : 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.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
295
+ s = StringTools.replace(s, "\\", "/");
296
+ fn = ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s) + Path.posix.parse(fn.substring(fn.lastIndexOf("/"))).name + v;
282
297
  };
283
298
  return fn;
284
299
  }
package/bin/whet.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
 
2
+ export {addOption} from "./whet/Project"
2
3
  export {ZipStone} from "./whet/stones/Zip"
3
4
  export {ZipConfig} from "./whet/stones/Zip"
5
+ export {Utils} from "./whet/Utils"
4
6
  export {Stone} from "./whet/Stone"
5
7
  export {ServerConfig} from "./whet/stones/Server"
6
8
  export {Server} from "./whet/stones/Server"
7
9
  export {Router} from "./whet/route/Router"
10
+ export {Route} from "./whet/route/Route"
8
11
  export {RemoteFileConfig} from "./whet/stones/RemoteFile"
9
12
  export {RemoteFile} from "./whet/stones/RemoteFile"
10
13
  export {Project} from "./whet/Project"
package/bin/whet.js CHANGED
@@ -5,10 +5,13 @@ import {Register} from "./genes/Register.js"
5
5
  const $global = Register.$global
6
6
 
7
7
  Whet_Fields_.main()
8
+ export {addOption} from "./whet/Project.js"
8
9
  export {ZipStone} from "./whet/stones/Zip.js"
10
+ export {Utils} from "./whet/Utils.js"
9
11
  export {Stone} from "./whet/Stone.js"
10
12
  export {Server} from "./whet/stones/Server.js"
11
13
  export {Router} from "./whet/route/Router.js"
14
+ export {Route} from "./whet/route/Route.js"
12
15
  export {RemoteFile} from "./whet/stones/RemoteFile.js"
13
16
  export {Project} from "./whet/Project.js"
14
17
  export {Log} from "./whet/Log.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whet",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "description": "NodeJS based assets management and project tooling library.",
5
5
  "scripts": {
6
6
  "devinit": "npx dts2hx commander --modular --noLibWrap",