whet 0.0.6 → 0.0.7

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.
@@ -12,7 +12,7 @@ export declare class Project {
12
12
  stones: AnyStone[]
13
13
  onInit: (config: any) => Promise<any>
14
14
  protected options: Option[]
15
- addCommand(cmd: Command, stone?: null | AnyStone): void
15
+ addCommand(name: string, stone?: null | AnyStone): Command
16
16
  toString(): string
17
17
  protected static projects: Project[]
18
18
  }
@@ -27,8 +27,10 @@ export type ProjectConfig = {
27
27
  */
28
28
  onInit?: null | ((config: any) => Promise<any>),
29
29
  /**
30
- * Array of Commander.js options this project supports.
30
+ * Array of Commander.js options this project supports. Use `addOption` to get Option instance.
31
31
  */
32
32
  options?: null | Option[],
33
33
  rootDir?: null | string
34
34
  }
35
+
36
+ export const addOption: (flags: string, description: null | string) => Option
@@ -4,7 +4,9 @@ import {SourceId_Fields_} from "./SourceId.js"
4
4
  import {Log} from "./Log.js"
5
5
  import * as Path from "path"
6
6
  import {Register} from "../genes/Register.js"
7
+ import {Command, Option} from "commander"
7
8
  import {StringTools} from "../StringTools.js"
9
+ import {HxOverrides} from "../HxOverrides.js"
8
10
 
9
11
  const $global = Register.$global
10
12
 
@@ -37,16 +39,16 @@ class Project extends Register.inherits() {
37
39
  file = decodeURI(file);
38
40
  file = StringTools.replace(file, "file:///", "");
39
41
  var s = Path.relative(process.cwd(), file);
40
- s = Path.posix.normalize(s);
42
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
41
43
  s = StringTools.replace(s, "\\", "/");
42
44
  var this1 = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
43
45
  var s = this1.substring(0, this1.lastIndexOf("/") + 1);
44
- s = Path.posix.normalize(s);
46
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
45
47
  s = StringTools.replace(s, "\\", "/");
46
48
  this.rootDir = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
47
49
  } else {
48
50
  var s = config.rootDir;
49
- s = Path.posix.normalize(s);
51
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
50
52
  s = StringTools.replace(s, "\\", "/");
51
53
  this.rootDir = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
52
54
  };
@@ -55,11 +57,13 @@ class Project extends Register.inherits() {
55
57
  var this1 = ["New project created.", {"project": this, "projectCount": Project.projects.length}];
56
58
  Log.log(30, ...this1);
57
59
  }
58
- addCommand(cmd, stone) {
60
+ addCommand(name, stone) {
61
+ var cmd = new Command(name);
59
62
  if (stone != null) {
60
63
  cmd.alias(stone.id + "." + cmd.name());
61
64
  };
62
65
  Whet_Fields_.program.addCommand(cmd);
66
+ return cmd;
63
67
  }
64
68
  toString() {
65
69
  return "" + this.name + "@" + this.rootDir;
@@ -73,4 +77,19 @@ class Project extends Register.inherits() {
73
77
  }
74
78
 
75
79
 
76
- Project.projects = []
80
+ Project.projects = []
81
+ export const Project_Fields_ = Register.global("$hxClasses")["whet._Project.Project_Fields_"] =
82
+ class Project_Fields_ {
83
+ static get __name__() {
84
+ return "whet._Project.Project_Fields_"
85
+ }
86
+ get __class__() {
87
+ return Project_Fields_
88
+ }
89
+ }
90
+
91
+
92
+ Project_Fields_.addOption = function (flags, description) {
93
+ return new Option(flags, description);
94
+ }
95
+ export const addOption = Project_Fields_.addOption
@@ -8,6 +8,7 @@ import * as Fs from "fs"
8
8
  import {Buffer} from "buffer"
9
9
  import {StringTools} from "../StringTools.js"
10
10
  import {Lambda} from "../Lambda.js"
11
+ import {HxOverrides} from "../HxOverrides.js"
11
12
 
12
13
  const $global = Register.$global
13
14
 
@@ -45,7 +46,7 @@ class Source extends Register.inherits() {
45
46
  return this.data[0];
46
47
  } else {
47
48
  var s = id;
48
- s = Path.posix.normalize(id);
49
+ s = Path.posix.normalize((id.length > 1 && SourceId_Fields_.startsWithSlash(id)) ? HxOverrides.substr(id, 1, null) : id);
49
50
  s = StringTools.replace(s, "\\", "/");
50
51
  var sid = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
51
52
  return Lambda.find(this.data, function (entry) {
@@ -124,7 +125,7 @@ class SourceData extends Register.inherits() {
124
125
  var source = SourceData.fromBytes(id, buffer);
125
126
  source.filePath = path;
126
127
  var s = pathId;
127
- s = Path.posix.normalize(s);
128
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
128
129
  s = StringTools.replace(s, "\\", "/");
129
130
  source.filePathId = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
130
131
  res(source);
@@ -137,7 +138,7 @@ class SourceData extends Register.inherits() {
137
138
  }
138
139
  static fromBytes(id, data) {
139
140
  var s = id;
140
- s = Path.posix.normalize(id);
141
+ s = Path.posix.normalize((id.length > 1 && SourceId_Fields_.startsWithSlash(id)) ? HxOverrides.substr(id, 1, null) : id);
141
142
  s = StringTools.replace(s, "\\", "/");
142
143
  return new SourceData((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s, data);
143
144
  }
@@ -13,7 +13,7 @@ class SourceId {
13
13
  };
14
14
  var tmp;
15
15
  var s = this1.substring(0, this1.lastIndexOf("/") + 1);
16
- s = Path.posix.normalize(s);
16
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
17
17
  s = StringTools.replace(s, "\\", "/");
18
18
  tmp = ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s).indexOf(directory) == 0;
19
19
  if (tmp) {
@@ -27,16 +27,16 @@ class SourceId {
27
27
  throw new Error("\"" + dir + "\" is not a directory.");
28
28
  };
29
29
  var s = "/";
30
- s = Path.posix.normalize("/");
30
+ s = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
31
31
  s = StringTools.replace(s, "\\", "/");
32
32
  if (dir == ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s)) {
33
33
  var s = this1;
34
- s = Path.posix.normalize(this1);
34
+ s = Path.posix.normalize((this1.length > 1 && SourceId_Fields_.startsWithSlash(this1)) ? HxOverrides.substr(this1, 1, null) : this1);
35
35
  s = StringTools.replace(s, "\\", "/");
36
36
  return (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
37
37
  } else {
38
38
  var s = dir + this1;
39
- s = Path.posix.normalize(s);
39
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
40
40
  s = StringTools.replace(s, "\\", "/");
41
41
  return (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
42
42
  };
@@ -4,7 +4,6 @@ import {CacheStrategy} from "./cache/Cache"
4
4
  import {SourceHash} from "./SourceHash"
5
5
  import {Source, SourceData} from "./Source"
6
6
  import {Project} from "./Project"
7
- import {Command} from "commander"
8
7
 
9
8
  export declare class Stone<T extends StoneConfig> {
10
9
  constructor(config: T)
@@ -25,9 +24,9 @@ export declare class Stone<T extends StoneConfig> {
25
24
  protected initConfig(): void
26
25
 
27
26
  /**
28
- Override this to register commands.
27
+ Override this to register commands via `this.project.addCommand`.
29
28
  */
30
- protected getCommands(): Command[]
29
+ protected addCommands(): void
31
30
 
32
31
  /**
33
32
  * **Do not override.**
@@ -77,6 +76,13 @@ export declare class Stone<T extends StoneConfig> {
77
76
  */
78
77
  setAbsolutePath(path: string, generate?: boolean): Promise<Source>
79
78
 
79
+ /**
80
+ * Stores this resource in the supplied path, without changing cache strategy.
81
+ * @param path Path relative to this stone's project.
82
+ * Can be a directory or a file path (only if this resource generates single source).
83
+ */
84
+ exportTo(path: string): Promise<any>
85
+
80
86
  /**
81
87
  * Convenient function to get CWD-relative path from project-relative one.
82
88
  * Useful for pure JS stones.
package/bin/whet/Stone.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {StoneId_Fields_} from "./magic/StoneId.js"
2
2
  import {CacheStrategy, CacheDurability} from "./cache/Cache.js"
3
- import {SourceId_Fields_} from "./SourceId.js"
3
+ import {Utils} from "./Utils.js"
4
+ import {SourceId_Fields_, SourceId, RootDir} from "./SourceId.js"
4
5
  import {SourceHash} from "./SourceHash.js"
5
6
  import {Source} from "./Source.js"
6
7
  import {Project} from "./Project.js"
@@ -8,6 +9,7 @@ import {Log} from "./Log.js"
8
9
  import * as Path from "path"
9
10
  import {Register} from "../genes/Register.js"
10
11
  import {StringTools} from "../StringTools.js"
12
+ import {HxOverrides} from "../HxOverrides.js"
11
13
 
12
14
  const $global = Register.$global
13
15
 
@@ -28,9 +30,7 @@ class Stone extends Register.inherits() {
28
30
  this.initConfig();
29
31
  this.id = (config.id != null) ? StoneId_Fields_.makeStoneId(config.id) : StoneId_Fields_.makeStoneId(this);
30
32
  this.cacheStrategy = (config.cacheStrategy == null) ? this.project.cache.defaultStrategy : config.cacheStrategy;
31
- var _g = 0;
32
- var _g1 = this.getCommands();
33
- while (_g < _g1.length) this.project.addCommand(_g1[_g++], this);
33
+ this.addCommands();
34
34
  }
35
35
  get cache() {
36
36
  return this.get_cache()
@@ -43,10 +43,9 @@ class Stone extends Register.inherits() {
43
43
  }
44
44
 
45
45
  /**
46
- Override this to register commands.
46
+ Override this to register commands via `this.project.addCommand`.
47
47
  */
48
- getCommands() {
49
- return [];
48
+ addCommands() {
50
49
  }
51
50
 
52
51
  /**
@@ -142,7 +141,7 @@ class Stone extends Register.inherits() {
142
141
  generate = true;
143
142
  };
144
143
  var s = path;
145
- s = Path.posix.normalize(path);
144
+ s = Path.posix.normalize((path.length > 1 && SourceId_Fields_.startsWithSlash(path)) ? HxOverrides.substr(path, 1, null) : path);
146
145
  s = StringTools.replace(s, "\\", "/");
147
146
  this.cacheStrategy = CacheStrategy.AbsolutePath((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s, CacheDurability.LimitCountByAge(1));
148
147
  if (generate) {
@@ -152,6 +151,40 @@ class Stone extends Register.inherits() {
152
151
  };
153
152
  }
154
153
 
154
+ /**
155
+ * Stores this resource in the supplied path, without changing cache strategy.
156
+ * @param path Path relative to this stone's project.
157
+ * Can be a directory or a file path (only if this resource generates single source).
158
+ */
159
+ exportTo(path) {
160
+ var _gthis = this;
161
+ Log.log(30, ...["Exporting file(s).", {"path": path, "stone": this}]);
162
+ var s = path;
163
+ s = Path.posix.normalize((path.length > 1 && SourceId_Fields_.startsWithSlash(path)) ? HxOverrides.substr(path, 1, null) : path);
164
+ s = StringTools.replace(s, "\\", "/");
165
+ var pathId = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
166
+ var isDir = SourceId_Fields_.endsWithSlash(pathId);
167
+ return this.getSource().then(function (src) {
168
+ if (src.data.length > 1 && !isDir) {
169
+ throw new Error("Path is not a directory for multiple source export.");
170
+ };
171
+ var _g = [];
172
+ var _g1 = 0;
173
+ var _g2 = src.data;
174
+ while (_g1 < _g2.length) {
175
+ var data = _g2[_g1];
176
+ ++_g1;
177
+ var id = (isDir) ? SourceId.getPutInDir(data.id, pathId) : pathId;
178
+ var root = RootDir.fromProject(_gthis.project);
179
+ if (id.charAt(0) != "/") {
180
+ throw new Error("Badly formed SourceId.");
181
+ };
182
+ _g.push(Utils.saveBytes(Path.posix.join(".", root, ".", id), data.data));
183
+ };
184
+ return Promise.all(_g);
185
+ });
186
+ }
187
+
155
188
  /**
156
189
  * Convenient function to get CWD-relative path from project-relative one.
157
190
  * Useful for pure JS stones.
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.6", "-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.7", "-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) {
@@ -125,7 +125,7 @@ class BaseCache extends Register.inherits() {
125
125
  var filenames = this.getExistingDirs(stone);
126
126
  var maxNum = (filenames != null) ? Lambda.fold(filenames, function (fn, num) {
127
127
  var s = fn.substring(0, fn.lastIndexOf("/") + 1);
128
- s = Path.posix.normalize(s);
128
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
129
129
  s = StringTools.replace(s, "\\", "/");
130
130
  var this1 = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
131
131
  var root = _gthis.rootDir;
@@ -138,7 +138,7 @@ class BaseCache extends Register.inherits() {
138
138
  }, 0) : 0;
139
139
  ++maxNum;
140
140
  var s = "v" + maxNum + "/";
141
- s = Path.posix.normalize(s);
141
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
142
142
  s = StringTools.replace(s, "\\", "/");
143
143
  return SourceId.getPutInDir((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s, baseDir);
144
144
  }
@@ -6,6 +6,7 @@ import {Log} from "../Log.js"
6
6
  import * as Path from "path"
7
7
  import {Register} from "../../genes/Register.js"
8
8
  import {StringTools} from "../../StringTools.js"
9
+ import {HxOverrides} from "../../HxOverrides.js"
9
10
 
10
11
  const $global = Register.$global
11
12
 
@@ -53,7 +54,7 @@ class CacheManager extends Register.inherits() {
53
54
  */
54
55
  getDir(stone, hash) {
55
56
  var s = stone.id + "/";
56
- s = Path.posix.normalize(s);
57
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
57
58
  s = StringTools.replace(s, "\\", "/");
58
59
  var baseDir = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
59
60
  var tmp;
@@ -70,12 +71,12 @@ class CacheManager extends Register.inherits() {
70
71
  };
71
72
  if (tmp) {
72
73
  var s = ".temp/";
73
- s = Path.posix.normalize(".temp/");
74
+ s = Path.posix.normalize((".temp/".length > 1 && SourceId_Fields_.startsWithSlash(".temp/")) ? HxOverrides.substr(".temp/", 1, null) : ".temp/");
74
75
  s = StringTools.replace(s, "\\", "/");
75
76
  baseDir = SourceId.getPutInDir(baseDir, (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s);
76
77
  };
77
78
  var s = ".whet/";
78
- s = Path.posix.normalize(".whet/");
79
+ s = Path.posix.normalize((".whet/".length > 1 && SourceId_Fields_.startsWithSlash(".whet/")) ? HxOverrides.substr(".whet/", 1, null) : ".whet/");
79
80
  s = StringTools.replace(s, "\\", "/");
80
81
  baseDir = SourceId.getPutInDir(baseDir, (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s);
81
82
  var id;
@@ -93,7 +94,7 @@ class CacheManager extends Register.inherits() {
93
94
  case 3:
94
95
  var _g1 = _g.path;
95
96
  var s = _g1.substring(0, _g1.lastIndexOf("/") + 1);
96
- s = Path.posix.normalize(s);
97
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
97
98
  s = StringTools.replace(s, "\\", "/");
98
99
  id = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
99
100
  break
@@ -21,7 +21,7 @@ class FileCache extends Register.inherits(BaseCache) {
21
21
  this.flushQueued = false;
22
22
  super.new(rootDir, new StringMap());
23
23
  var s = ".whet/cache.json";
24
- s = Path.posix.normalize(".whet/cache.json");
24
+ s = Path.posix.normalize((".whet/cache.json".length > 1 && SourceId_Fields_.startsWithSlash(".whet/cache.json")) ? HxOverrides.substr(".whet/cache.json", 1, null) : ".whet/cache.json");
25
25
  s = StringTools.replace(s, "\\", "/");
26
26
  var this1 = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
27
27
  if (this1.charAt(0) != "/") {
@@ -44,7 +44,7 @@ class FileCache extends Register.inherits(BaseCache) {
44
44
  var tmp = SourceHash.fromHex(val.hash);
45
45
  var val1 = val.ctime;
46
46
  var s = val.baseDir;
47
- s = Path.posix.normalize(s);
47
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
48
48
  s = StringTools.replace(s, "\\", "/");
49
49
  var tmp1 = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
50
50
  var _g2 = [];
@@ -55,11 +55,11 @@ class FileCache extends Register.inherits(BaseCache) {
55
55
  ++_g3;
56
56
  var tmp2 = SourceHash.fromHex(file.fileHash);
57
57
  var s1 = file.filePath;
58
- s1 = Path.posix.normalize(s1);
58
+ s1 = Path.posix.normalize((s1.length > 1 && SourceId_Fields_.startsWithSlash(s1)) ? HxOverrides.substr(s1, 1, null) : s1);
59
59
  s1 = StringTools.replace(s1, "\\", "/");
60
60
  var tmp3 = (SourceId_Fields_.startsWithSlash(s1)) ? s1 : "/" + s1;
61
61
  var s2 = file.id;
62
- s2 = Path.posix.normalize(s2);
62
+ s2 = Path.posix.normalize((s2.length > 1 && SourceId_Fields_.startsWithSlash(s2)) ? HxOverrides.substr(s2, 1, null) : s2);
63
63
  s2 = StringTools.replace(s2, "\\", "/");
64
64
  _g2.push({"fileHash": tmp2, "filePath": tmp3, "id": (SourceId_Fields_.startsWithSlash(s2)) ? s2 : "/" + s2});
65
65
  };
@@ -80,7 +80,7 @@ class FileCache extends Register.inherits(BaseCache) {
80
80
  var _g1 = _g.path;
81
81
  if (source.data.length == 1) {
82
82
  var s = _g1.substring(_g1.lastIndexOf("/"));
83
- s = Path.posix.normalize(s);
83
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
84
84
  s = StringTools.replace(s, "\\", "/");
85
85
  idOverride = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
86
86
  } else {
@@ -116,7 +116,7 @@ class FileCache extends Register.inherits(BaseCache) {
116
116
  } else {
117
117
  var value1 = value.baseDir;
118
118
  var s = _g1.substring(0, _g1.lastIndexOf("/") + 1);
119
- s = Path.posix.normalize(s);
119
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
120
120
  s = StringTools.replace(s, "\\", "/");
121
121
  invalidPath = value1 != ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s);
122
122
  };
@@ -292,7 +292,7 @@ class FileCache extends Register.inherits(BaseCache) {
292
292
  var tmp1 = HxOverrides.dateStr(new Date(val.ctime * 1000));
293
293
  var this2 = val.baseDir;
294
294
  var s = "/";
295
- s = Path.posix.normalize("/");
295
+ s = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
296
296
  s = StringTools.replace(s, "\\", "/");
297
297
  var root = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
298
298
  if (this2.charAt(0) != "/") {
@@ -308,7 +308,7 @@ class FileCache extends Register.inherits(BaseCache) {
308
308
  var tmp3 = SourceHash.toHex(file.fileHash);
309
309
  var this3 = file.filePath;
310
310
  var s1 = "/";
311
- s1 = Path.posix.normalize("/");
311
+ s1 = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
312
312
  s1 = StringTools.replace(s1, "\\", "/");
313
313
  var root1 = (SourceId_Fields_.startsWithSlash(s1)) ? s1 : "/" + s1;
314
314
  if (this3.charAt(0) != "/") {
@@ -317,7 +317,7 @@ class FileCache extends Register.inherits(BaseCache) {
317
317
  var tmp4 = Path.posix.join(".", root1, ".", this3);
318
318
  var this4 = file.id;
319
319
  var s2 = "/";
320
- s2 = Path.posix.normalize("/");
320
+ s2 = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
321
321
  s2 = StringTools.replace(s2, "\\", "/");
322
322
  var root2 = (SourceId_Fields_.startsWithSlash(s2)) ? s2 : "/" + s2;
323
323
  if (this4.charAt(0) != "/") {
@@ -5,6 +5,7 @@ import {SourceId_Fields_} from "../SourceId.js"
5
5
  import * as Path from "path"
6
6
  import {Register} from "../../genes/Register.js"
7
7
  import {StringTools} from "../../StringTools.js"
8
+ import {HxOverrides} from "../../HxOverrides.js"
8
9
 
9
10
  const $global = Register.$global
10
11
 
@@ -33,7 +34,7 @@ class RoutePathType_Fields_ {
33
34
  throw new Error("RoutePath element should have at most 3 entries `[serveId, route, filter]`.");
34
35
  };
35
36
  var s = item[0];
36
- s = Path.posix.normalize(s);
37
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
37
38
  s = StringTools.replace(s, "\\", "/");
38
39
  var tmp = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
39
40
  var _g3 = item.slice(1);
@@ -1,3 +1,4 @@
1
+ import {RouteResult} from "../route/RouteResult"
1
2
  import {Route, RouteData} from "../route/Route"
2
3
  import {MaybeArray} from "./MaybeArray"
3
4
  import {AnyStone} from "../Stone"
@@ -7,6 +8,6 @@ import {AnyStone} from "../Stone"
7
8
  */
8
9
  export type RouteType = Route | MaybeArray<MaybeArray<BaseRouteType>>
9
10
 
10
- export type BaseRouteType = string | AnyStone
11
+ export type BaseRouteType = RouteResult | string | AnyStone
11
12
 
12
13
  export const makeRoute: (routeType: RouteType) => Route
@@ -1,4 +1,5 @@
1
1
  import {Files} from "../stones/Files.js"
2
+ import {RouteResult} from "../route/RouteResult.js"
2
3
  import {Route} from "../route/Route.js"
3
4
  import {MaybeArray_Fields_} from "./MaybeArray.js"
4
5
  import {Stone} from "../Stone.js"
@@ -7,6 +8,7 @@ import * as Path from "path"
7
8
  import {Register} from "../../genes/Register.js"
8
9
  import {StringTools} from "../../StringTools.js"
9
10
  import {Std} from "../../Std.js"
11
+ import {HxOverrides} from "../../HxOverrides.js"
10
12
 
11
13
  const $global = Register.$global
12
14
 
@@ -33,7 +35,7 @@ class RouteType_Fields_ {
33
35
  };
34
36
  var tinner1 = tinner[0];
35
37
  var s = tinner[1];
36
- s = Path.posix.normalize(s);
38
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
37
39
  s = StringTools.replace(s, "\\", "/");
38
40
  _g.push(RouteType_Fields_.getRoute(tinner1, (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s));
39
41
  };
@@ -48,11 +50,11 @@ class RouteType_Fields_ {
48
50
  tmp1 = path;
49
51
  } else {
50
52
  var s = t;
51
- s = Path.posix.normalize(s);
53
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
52
54
  s = StringTools.replace(s, "\\", "/");
53
55
  var p = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
54
56
  var s = p.substring(0, p.lastIndexOf("/") + 1);
55
- s = Path.posix.normalize(s);
57
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
56
58
  s = StringTools.replace(s, "\\", "/");
57
59
  tmp1 = SourceId.relativeTo(p, (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s);
58
60
  };
@@ -63,13 +65,15 @@ class RouteType_Fields_ {
63
65
  tmp = path;
64
66
  } else {
65
67
  var s = "/";
66
- s = Path.posix.normalize("/");
68
+ s = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
67
69
  s = StringTools.replace(s, "\\", "/");
68
70
  tmp = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
69
71
  };
70
72
  return {"stone": t, "path": tmp};
73
+ } else if (((t) instanceof RouteResult)) {
74
+ return {"stone": t.source, "path": t.sourceId};
71
75
  } else {
72
- throw new Error("Unsupported type for Route. Expected String or Stone, but got " + Std.string(t.constructor?.name) + ".");
76
+ throw new Error("Unsupported type for Route. Expected String, Stone or RouteResult, but got " + Std.string(t.constructor?.name) + ".");
73
77
  };
74
78
  }
75
79
  static get __name__() {
@@ -5,6 +5,7 @@ import {SourceHash} from "../SourceHash.js"
5
5
  import * as Path from "path"
6
6
  import {Register} from "../../genes/Register.js"
7
7
  import {StringTools} from "../../StringTools.js"
8
+ import {HxOverrides} from "../../HxOverrides.js"
8
9
 
9
10
  const $global = Register.$global
10
11
 
@@ -58,7 +59,7 @@ class Route extends Register.inherits() {
58
59
  if (path == r[0].path) {
59
60
  var _g1 = r[0].stone;
60
61
  var s = path.substring(path.lastIndexOf("/"));
61
- s = Path.posix.normalize(s);
62
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
62
63
  s = StringTools.replace(s, "\\", "/");
63
64
  arr.push(new RouteResult((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s, path, _g1));
64
65
  };
@@ -5,6 +5,7 @@ import {SourceHash} from "../SourceHash.js"
5
5
  import * as Path from "path"
6
6
  import {Register} from "../../genes/Register.js"
7
7
  import {StringTools} from "../../StringTools.js"
8
+ import {HxOverrides} from "../../HxOverrides.js"
8
9
 
9
10
  const $global = Register.$global
10
11
 
@@ -26,7 +27,7 @@ class Router extends Register.inherits() {
26
27
  find(id, firstOnly) {
27
28
  var _gthis = this;
28
29
  var s = id;
29
- s = Path.posix.normalize(id);
30
+ s = Path.posix.normalize((id.length > 1 && SourceId_Fields_.startsWithSlash(id)) ? HxOverrides.substr(id, 1, null) : id);
30
31
  s = StringTools.replace(s, "\\", "/");
31
32
  var sourceId = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
32
33
  return new Promise(function (res, rej) {
@@ -56,7 +57,7 @@ class Router extends Register.inherits() {
56
57
  };
57
58
  } else if (sourceId == item.serveId) {
58
59
  var s = sourceId.substring(sourceId.lastIndexOf("/"));
59
- s = Path.posix.normalize(s);
60
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
60
61
  s = StringTools.replace(s, "\\", "/");
61
62
  item.serveId = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
62
63
  result.push(item);
@@ -76,7 +77,7 @@ class Router extends Register.inherits() {
76
77
  };
77
78
  } else if (sourceId == item.serveId) {
78
79
  var s = sourceId.substring(sourceId.lastIndexOf("/"));
79
- s = Path.posix.normalize(s);
80
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
80
81
  s = StringTools.replace(s, "\\", "/");
81
82
  item.serveId = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
82
83
  result.push(item);
@@ -164,7 +165,7 @@ class Router extends Register.inherits() {
164
165
  var saveInto1 = saveInto;
165
166
  var this1 = r.serveId;
166
167
  var s = "/";
167
- s = Path.posix.normalize("/");
168
+ s = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
168
169
  s = StringTools.replace(s, "\\", "/");
169
170
  var root = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
170
171
  if (this1.charAt(0) != "/") {
@@ -6,6 +6,7 @@ import * as Path from "path"
6
6
  import {Register} from "../../genes/Register.js"
7
7
  import * as Fs from "fs"
8
8
  import {StringTools} from "../../StringTools.js"
9
+ import {HxOverrides} from "../../HxOverrides.js"
9
10
 
10
11
  const $global = Register.$global
11
12
 
@@ -20,7 +21,7 @@ class Files extends Register.inherits(Stone) {
20
21
  while (0 < _g.length) {
21
22
  var pathString = _g[0];
22
23
  var s = pathString;
23
- s = Path.posix.normalize(pathString);
24
+ s = Path.posix.normalize((pathString.length > 1 && SourceId_Fields_.startsWithSlash(pathString)) ? HxOverrides.substr(pathString, 1, null) : pathString);
24
25
  s = StringTools.replace(s, "\\", "/");
25
26
  var path = [(SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s];
26
27
  var tmp;
@@ -43,7 +44,7 @@ class Files extends Register.inherits(Stone) {
43
44
  var file = files[_g1];
44
45
  ++_g1;
45
46
  var s = file;
46
- s = Path.posix.normalize(file);
47
+ s = Path.posix.normalize((file.length > 1 && SourceId_Fields_.startsWithSlash(file)) ? HxOverrides.substr(file, 1, null) : file);
47
48
  s = StringTools.replace(s, "\\", "/");
48
49
  var filepath = SourceId.getPutInDir((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s, path[0]);
49
50
  _g.push({"id": SourceId.relativeTo(filepath, path[0]), "pathId": filepath});
@@ -56,7 +57,7 @@ class Files extends Register.inherits(Stone) {
56
57
  })(path));
57
58
  } else {
58
59
  var s1 = path[0].substring(path[0].lastIndexOf("/"));
59
- s1 = Path.posix.normalize(s1);
60
+ s1 = Path.posix.normalize((s1.length > 1 && SourceId_Fields_.startsWithSlash(s1)) ? HxOverrides.substr(s1, 1, null) : s1);
60
61
  s1 = StringTools.replace(s1, "\\", "/");
61
62
  tmp = Promise.resolve([{"id": (SourceId_Fields_.startsWithSlash(s1)) ? s1 : "/" + s1, "pathId": path[0]}]);
62
63
  };
@@ -8,6 +8,7 @@ import * as Path from "path"
8
8
  import {Register} from "../../genes/Register.js"
9
9
  import {StringTools} from "../../StringTools.js"
10
10
  import {Reflect as Reflect__1} from "../../Reflect.js"
11
+ import {HxOverrides} from "../../HxOverrides.js"
11
12
 
12
13
  const $global = Register.$global
13
14
 
@@ -91,7 +92,7 @@ class JsonStone extends Register.inherits(Stone) {
91
92
  }
92
93
  list() {
93
94
  var s = this.config.name;
94
- s = Path.posix.normalize(s);
95
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
95
96
  s = StringTools.replace(s, "\\", "/");
96
97
  return Promise.resolve([(SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s]);
97
98
  }
@@ -10,6 +10,7 @@ import * as Https from "https"
10
10
  import {Register} from "../../genes/Register.js"
11
11
  import {Buffer} from "buffer"
12
12
  import {StringTools} from "../../StringTools.js"
13
+ import {HxOverrides} from "../../HxOverrides.js"
13
14
 
14
15
  const $global = Register.$global
15
16
 
@@ -51,7 +52,7 @@ class RemoteFile extends Register.inherits(Stone) {
51
52
  }
52
53
  getId() {
53
54
  var s = Path.basename(new URL(this.config.url).pathname);
54
- s = Path.posix.normalize(s);
55
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
55
56
  s = StringTools.replace(s, "\\", "/");
56
57
  return (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
57
58
  }
@@ -6,7 +6,6 @@ import {SourceHash} from "../SourceHash"
6
6
  import {SourceData} from "../Source"
7
7
  import {Project} from "../Project"
8
8
  import {IncomingMessage, ServerResponse} from "http"
9
- import {Command} from "commander"
10
9
 
11
10
  export declare class Server extends Stone<ServerConfig> {
12
11
  constructor(config: ServerConfig)
@@ -20,7 +19,7 @@ export declare class Server extends Stone<ServerConfig> {
20
19
  */
21
20
  serve(): void
22
21
  protected initConfig(): void
23
- protected getCommands(): Command[]
22
+ protected addCommands(): void
24
23
  protected handler(req: IncomingMessage, res: ServerResponse): void
25
24
  }
26
25
 
@@ -5,9 +5,9 @@ import * as Path from "path"
5
5
  import Mime from "mime"
6
6
  import * as Http from "http"
7
7
  import {Register} from "../../genes/Register.js"
8
- import {Command} from "commander"
9
8
  import {StringTools} from "../../StringTools.js"
10
9
  import {Std} from "../../Std.js"
10
+ import {HxOverrides} from "../../HxOverrides.js"
11
11
 
12
12
  const $global = Register.$global
13
13
 
@@ -41,35 +41,36 @@ class Server extends Register.inherits(Stone) {
41
41
  if (this.config.port == null) {
42
42
  this.config.port = 7000;
43
43
  };
44
+ this.project.addCommand("serve", this);
44
45
  }
45
- getCommands() {
46
+ addCommands() {
46
47
  var _gthis = this;
47
- return [new Command("serve").option("-p, --port <port>", "server port", "" + this.config.port).action(function (...args) {
48
+ this.project.addCommand("serve", this).option("-p, --port <port>", "server port", "" + this.config.port).action(function (...args) {
48
49
  if (args[0].port != null) {
49
50
  _gthis.config.port = Std.parseInt(args[0].port);
50
51
  };
51
52
  _gthis.serve();
52
53
  return null;
53
- })];
54
+ });
54
55
  }
55
56
  handler(req, res) {
56
57
  var _gthis = this;
57
58
  Log.log(30, ...["Handling request.", {"url": req.url, "method": req.method}]);
58
59
  var s = req.url;
59
- s = Path.posix.normalize(s);
60
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
60
61
  s = StringTools.replace(s, "\\", "/");
61
62
  var id = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
62
63
  if (req.method == "GET") {
63
64
  if (SourceId_Fields_.endsWithSlash(id)) {
64
65
  if ("index.html".length > 0) {
65
66
  var s = id.substring(0, id.lastIndexOf("/") + 1);
66
- s = Path.posix.normalize(s);
67
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
67
68
  s = StringTools.replace(s, "\\", "/");
68
69
  id = ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s) + "index.html";
69
70
  };
70
71
  } else if (Path.posix.extname(id) == "") {
71
72
  var s = "" + id + "/index.html";
72
- s = Path.posix.normalize(s);
73
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
73
74
  s = StringTools.replace(s, "\\", "/");
74
75
  id = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
75
76
  };
@@ -15,6 +15,7 @@ import {Register} from "../../genes/Register.js"
15
15
  import {Buffer} from "buffer"
16
16
  import {StringTools} from "../../StringTools.js"
17
17
  import {Lambda} from "../../Lambda.js"
18
+ import {HxOverrides} from "../../HxOverrides.js"
18
19
 
19
20
  const $global = Register.$global
20
21
 
@@ -75,7 +76,7 @@ class ZipStone extends Register.inherits(Stone) {
75
76
  var bytes = Helper.bytesOfBuffer(data.data);
76
77
  var this1 = file[0].serveId;
77
78
  var s = "/";
78
- s = Path.posix.normalize("/");
79
+ s = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
79
80
  s = StringTools.replace(s, "\\", "/");
80
81
  var root = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
81
82
  if (this1.charAt(0) != "/") {
@@ -99,7 +100,7 @@ class ZipStone extends Register.inherits(Stone) {
99
100
  }
100
101
  list() {
101
102
  var s = this.config.filename;
102
- s = Path.posix.normalize(s);
103
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
103
104
  s = StringTools.replace(s, "\\", "/");
104
105
  return Promise.resolve([(SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s]);
105
106
  }
@@ -5,7 +5,6 @@ import {Stone} from "../../Stone"
5
5
  import {SourceHash} from "../../SourceHash"
6
6
  import {SourceData} from "../../Source"
7
7
  import {Project} from "../../Project"
8
- import {Command} from "commander"
9
8
 
10
9
  export declare class HaxeBuild extends Stone<BuildConfig> {
11
10
  constructor(config: BuildConfig)
@@ -16,7 +15,7 @@ export declare class HaxeBuild extends Stone<BuildConfig> {
16
15
  */
17
16
  build(): Promise<any>
18
17
  protected generate(hash: SourceHash): Promise<SourceData[]>
19
- protected getCommands(): Command[]
18
+ protected addCommands(): void
20
19
  list(): Promise<string[]>
21
20
  protected generateHash(): Promise<SourceHash>
22
21
  }
@@ -7,9 +7,9 @@ import {SourceData} from "../../Source.js"
7
7
  import {Log} from "../../Log.js"
8
8
  import * as Path from "path"
9
9
  import {Register} from "../../../genes/Register.js"
10
- import {Command} from "commander"
11
10
  import * as ChildProcess from "child_process"
12
11
  import {StringTools} from "../../../StringTools.js"
12
+ import {HxOverrides} from "../../../HxOverrides.js"
13
13
 
14
14
  const $global = Register.$global
15
15
 
@@ -34,7 +34,7 @@ class HaxeBuild extends Register.inherits(Stone) {
34
34
  var cwd = process.cwd();
35
35
  var this1 = _gthis.project.rootDir;
36
36
  var s = "/";
37
- s = Path.posix.normalize("/");
37
+ s = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
38
38
  s = StringTools.replace(s, "\\", "/");
39
39
  var root = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
40
40
  if (this1.charAt(0) != "/") {
@@ -84,11 +84,11 @@ class HaxeBuild extends Register.inherits(Stone) {
84
84
  throw new Error("Cannot get source of a multi-file build. Not implemented yet.");
85
85
  };
86
86
  }
87
- getCommands() {
87
+ addCommands() {
88
88
  var _gthis = this;
89
- return [new Command("build").action(function (..._) {
89
+ this.project.addCommand("build", this).action(function (..._) {
90
90
  return _gthis.build();
91
- })];
91
+ });
92
92
  }
93
93
  list() {
94
94
  if (this.config.hxml.isSingleFile()) {
@@ -105,7 +105,7 @@ class HaxeBuild extends Register.inherits(Stone) {
105
105
  while (_g < _g1) {
106
106
  var i = _g++;
107
107
  var s = _this[i];
108
- s = Path.posix.normalize(s);
108
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
109
109
  s = StringTools.replace(s, "\\", "/");
110
110
  var this1 = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
111
111
  var root = RootDir.fromProject(this.config.hxml.project);
@@ -149,12 +149,12 @@ class Hxml extends Register.inherits(Stone) {
149
149
  var filename;
150
150
  if (this.build.config.filename != null) {
151
151
  var s = this.build.config.filename;
152
- s = Path.posix.normalize(s);
152
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
153
153
  s = StringTools.replace(s, "\\", "/");
154
154
  filename = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
155
155
  } else {
156
156
  var s = "build";
157
- s = Path.posix.normalize("build");
157
+ s = Path.posix.normalize(("build".length > 1 && SourceId_Fields_.startsWithSlash("build")) ? HxOverrides.substr("build", 1, null) : "build");
158
158
  s = StringTools.replace(s, "\\", "/");
159
159
  filename = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
160
160
  };
@@ -164,7 +164,7 @@ class Hxml extends Register.inherits(Stone) {
164
164
  v = "." + v;
165
165
  };
166
166
  var s = filename.substring(0, filename.lastIndexOf("/") + 1);
167
- s = Path.posix.normalize(s);
167
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
168
168
  s = StringTools.replace(s, "\\", "/");
169
169
  filename = ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s) + Path.posix.parse(filename.substring(filename.lastIndexOf("/"))).name + v;
170
170
  };
@@ -176,7 +176,7 @@ class Hxml extends Register.inherits(Stone) {
176
176
  getPlatform() {
177
177
  var this1 = this.getBuildExportPath();
178
178
  var s = "/";
179
- s = Path.posix.normalize("/");
179
+ s = Path.posix.normalize(("/".length > 1 && SourceId_Fields_.startsWithSlash("/")) ? HxOverrides.substr("/", 1, null) : "/");
180
180
  s = StringTools.replace(s, "\\", "/");
181
181
  var root = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
182
182
  if (this1.charAt(0) != "/") {
@@ -282,7 +282,7 @@ class Hxml extends Register.inherits(Stone) {
282
282
  }
283
283
  filename() {
284
284
  var s = this.id;
285
- s = Path.posix.normalize(s);
285
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
286
286
  s = StringTools.replace(s, "\\", "/");
287
287
  var fn = (SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s;
288
288
  if (Path.posix.extname(fn) == "") {
@@ -291,7 +291,7 @@ class Hxml extends Register.inherits(Stone) {
291
291
  v = "." + "hxml";
292
292
  };
293
293
  var s = fn.substring(0, fn.lastIndexOf("/") + 1);
294
- s = Path.posix.normalize(s);
294
+ s = Path.posix.normalize((s.length > 1 && SourceId_Fields_.startsWithSlash(s)) ? HxOverrides.substr(s, 1, null) : s);
295
295
  s = StringTools.replace(s, "\\", "/");
296
296
  fn = ((SourceId_Fields_.startsWithSlash(s)) ? s : "/" + s) + Path.posix.parse(fn.substring(fn.lastIndexOf("/"))).name + v;
297
297
  };
package/bin/whet.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
 
2
+ export {addOption} from "./whet/Project"
2
3
  export {ZipStone} from "./whet/stones/Zip"
3
4
  export {ZipConfig} from "./whet/stones/Zip"
4
5
  export {Utils} from "./whet/Utils"
package/bin/whet.js CHANGED
@@ -5,6 +5,7 @@ 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"
9
10
  export {Utils} from "./whet/Utils.js"
10
11
  export {Stone} from "./whet/Stone.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whet",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "NodeJS based assets management and project tooling library.",
5
5
  "scripts": {
6
6
  "devinit": "npx dts2hx commander --modular --noLibWrap",