whet 0.0.34 → 0.1.0

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 (81) hide show
  1. package/bin/Reflect.d.ts +31 -12
  2. package/bin/Reflect.js +46 -19
  3. package/bin/commander/LiteralUnion.d.ts +2 -0
  4. package/bin/commander/OptionValueSource.d.ts +2 -1
  5. package/bin/commander/OutputConfiguration.d.ts +3 -0
  6. package/bin/genes/Register.d.ts +2 -0
  7. package/bin/genes/Register.js +15 -11
  8. package/bin/genes/util/EsMap.js +2 -1
  9. package/bin/haxe/Exception.js +6 -1
  10. package/bin/haxe/ValueException.js +3 -2
  11. package/bin/haxe/ds/List.js +7 -2
  12. package/bin/haxe/ds/ObjectMap.js +2 -2
  13. package/bin/haxe/ds/StringMap.js +2 -2
  14. package/bin/haxe/exceptions/NotImplementedException.js +2 -2
  15. package/bin/haxe/exceptions/PosException.js +3 -2
  16. package/bin/haxe/io/Bytes.js +3 -1
  17. package/bin/haxe/io/BytesBuffer.js +6 -1
  18. package/bin/haxe/io/BytesOutput.js +2 -1
  19. package/bin/haxe/io/Output.js +1 -0
  20. package/bin/haxe/iterators/ArrayIterator.js +3 -1
  21. package/bin/haxe/zip/Writer.js +3 -1
  22. package/bin/js/lib/ConcatArray.d.ts +6 -0
  23. package/bin/js/lib/IRegExp.d.ts +53 -0
  24. package/bin/js/lib/IterableIterator.d.ts +8 -0
  25. package/bin/js/lib/IteratorResult.d.ts +2 -0
  26. package/bin/js/lib/IteratorReturnResult.d.ts +5 -0
  27. package/bin/js/lib/IteratorYieldResult.d.ts +5 -0
  28. package/bin/js/lib/RegExpExecArray.d.ts +137 -0
  29. package/bin/minimatch/MMRegExp.d.ts +55 -0
  30. package/bin/minimatch/MinimatchOptions.d.ts +102 -0
  31. package/bin/minimatch/ParseReturn.d.ts +2 -0
  32. package/bin/minimatch/ParseReturnFiltered.d.ts +2 -0
  33. package/bin/minimatch/Platform.d.ts +2 -0
  34. package/bin/pino_pretty/PrettyOptions.d.ts +2 -2
  35. package/bin/pino_pretty/default_/MessageFormatFunc.d.ts +1 -2
  36. package/bin/pino_pretty/default_/Prettifier.d.ts +2 -0
  37. package/bin/pino_pretty/pinopretty/PrettyOptions.d.ts +118 -0
  38. package/bin/sys/FileStat.d.ts +50 -0
  39. package/bin/whet/ConfigStore.d.ts +32 -0
  40. package/bin/whet/ConfigStore.js +342 -0
  41. package/bin/whet/Project.d.ts +39 -4
  42. package/bin/whet/Project.js +154 -3
  43. package/bin/whet/Source.d.ts +7 -1
  44. package/bin/whet/Source.js +40 -3
  45. package/bin/whet/SourceHash.js +18 -10
  46. package/bin/whet/Stone.d.ts +60 -9
  47. package/bin/whet/Stone.js +180 -18
  48. package/bin/whet/Whet.d.ts +0 -1
  49. package/bin/whet/Whet.js +23 -12
  50. package/bin/whet/cache/BaseCache.d.ts +23 -0
  51. package/bin/whet/cache/BaseCache.js +93 -1
  52. package/bin/whet/cache/CacheManager.d.ts +2 -0
  53. package/bin/whet/cache/CacheManager.js +38 -2
  54. package/bin/whet/cache/FileCache.d.ts +10 -2
  55. package/bin/whet/cache/FileCache.js +144 -42
  56. package/bin/whet/cache/HashCache.js +2 -1
  57. package/bin/whet/cache/MemoryCache.d.ts +3 -0
  58. package/bin/whet/cache/MemoryCache.js +53 -2
  59. package/bin/whet/magic/MinimatchType.d.ts +1 -1
  60. package/bin/whet/magic/MinimatchType.js +3 -3
  61. package/bin/whet/magic/RoutePathType.js +1 -1
  62. package/bin/whet/route/OutputFilterMatcher.js +2 -2
  63. package/bin/whet/route/RouteResult.d.ts +16 -0
  64. package/bin/whet/route/RouteResult.js +37 -4
  65. package/bin/whet/route/Router.d.ts +22 -1
  66. package/bin/whet/route/Router.js +121 -40
  67. package/bin/whet/stones/Files.d.ts +6 -1
  68. package/bin/whet/stones/Files.js +3 -2
  69. package/bin/whet/stones/JsonStone.d.ts +6 -1
  70. package/bin/whet/stones/JsonStone.js +3 -2
  71. package/bin/whet/stones/RemoteFile.d.ts +7 -2
  72. package/bin/whet/stones/RemoteFile.js +7 -4
  73. package/bin/whet/stones/Zip.d.ts +6 -1
  74. package/bin/whet/stones/Zip.js +2 -2
  75. package/bin/whet/stones/haxe/HaxeBuild.d.ts +7 -1
  76. package/bin/whet/stones/haxe/HaxeBuild.js +8 -6
  77. package/bin/whet/stones/haxe/Hxml.d.ts +7 -1
  78. package/bin/whet/stones/haxe/Hxml.js +7 -5
  79. package/bin/whet.d.ts +1 -2
  80. package/bin/whet.js +1 -1
  81. package/package.json +9 -10
@@ -12,7 +12,7 @@ const $global = Register.$global
12
12
 
13
13
  export const Router = Register.global("$hxClasses")["whet.route.Router"] =
14
14
  class Router extends Register.inherits() {
15
- new(routes) {
15
+ [Register.new](routes) {
16
16
  this.routes = (routes != null) ? RoutePathType_Fields_.makeRoutePath(routes) : [];
17
17
  }
18
18
  route(r) {
@@ -45,7 +45,7 @@ class Router extends Register.inherits() {
45
45
  while (_g2 < _g3) {
46
46
  let i = _g2++;
47
47
  let f = mainFilters[i];
48
- result[i] = {"filter": f.filter, "pathSoFar": f.pathSoFar.slice(), "inProgress": f.inProgress, "remDirs": f.remDirs.slice()};
48
+ result[i] = {"filter": f.filter, "pathSoFar": f.pathSoFar, "inProgress": f.inProgress, "remDirs": f.remDirs};
49
49
  };
50
50
  let routeFilters = result;
51
51
  let possible;
@@ -126,7 +126,10 @@ class Router extends Register.inherits() {
126
126
  let f = route.filter;
127
127
  let extractDir = route.extractDirs;
128
128
  if (extractDir != null && routeFilters.length > 0) {
129
- routeFilters[routeFilters.length - 1].remDirs.push(extractDir);
129
+ let routeFilters1 = routeFilters;
130
+ let tmp = routeFilters.length - 1;
131
+ let tmp1 = routeFilters[routeFilters.length - 1].remDirs.concat([extractDir]);
132
+ routeFilters1[tmp].remDirs = tmp1;
130
133
  };
131
134
  routeFilters.push({"pathSoFar": [], "filter": f, "inProgress": true, "remDirs": []});
132
135
  };
@@ -145,47 +148,13 @@ class Router extends Register.inherits() {
145
148
  let prom;
146
149
  if (((route.source) instanceof Stone)) {
147
150
  let stone = route.source;
148
- prom = stone.list().then(function (list) {
151
+ prom = stone.listIds().then(function (list) {
149
152
  let _g = 0;
150
153
  while (_g < list.length) {
151
154
  let sourceId = list[_g];
152
155
  ++_g;
153
- let result = new Array(routeFilters.length);
154
- let _g1 = 0;
155
- let _g2 = routeFilters.length;
156
- while (_g1 < _g2) {
157
- let i = _g1++;
158
- let f = routeFilters[i];
159
- result[i] = {"filter": f.filter, "pathSoFar": f.pathSoFar.slice(), "inProgress": f.inProgress, "remDirs": f.remDirs.slice()};
160
- };
161
- let finalFilters = result;
162
- let parts = sourceId.split("/");
163
- let res = true;
164
- let i = finalFilters.length;
165
- while (--i >= 0) {
166
- let f = finalFilters[i];
167
- if (f.inProgress) {
168
- f.inProgress = false;
169
- if (f.remDirs.length != 0) {
170
- let i = parts.length;
171
- while (--i >= 0) {
172
- let _g = 0;
173
- let _g1 = f.remDirs;
174
- while (_g < _g1.length) if (_g1[_g++].match(parts[i] + "/")) {
175
- parts.splice(i, 1);
176
- break;
177
- };
178
- };
179
- };
180
- f.pathSoFar = f.pathSoFar.concat(parts);
181
- if (!(f.filter == null || f.filter.match(Path.posix.join(...f.pathSoFar)))) {
182
- res = false;
183
- break;
184
- };
185
- };
186
- };
187
- if (res) {
188
- let serveId = Path.posix.join(...finalFilters[0].pathSoFar);
156
+ let serveId = Filters.tryFinalize(routeFilters, sourceId);
157
+ if (serveId != null) {
189
158
  results.push(new RouteResult(serveId, sourceId, stone));
190
159
  };
191
160
  };
@@ -275,6 +244,33 @@ class Router extends Register.inherits() {
275
244
  return Promise.all(_g);
276
245
  });
277
246
  }
247
+
248
+ /**
249
+ Get the raw Buffer of the first matching result.
250
+ */
251
+ getData(pattern) {
252
+ return this.get(pattern).then(function (r) {
253
+ return r[0].getData();
254
+ });
255
+ }
256
+
257
+ /**
258
+ Get the first matching result as a UTF-8 string.
259
+ */
260
+ getString(pattern) {
261
+ return this.get(pattern).then(function (r) {
262
+ return r[0].getString();
263
+ });
264
+ }
265
+
266
+ /**
267
+ Get the first matching result parsed as JSON.
268
+ */
269
+ getJson(pattern) {
270
+ return this.get(pattern).then(function (r) {
271
+ return r[0].getJson();
272
+ });
273
+ }
278
274
  listContents(pattern) {
279
275
  return this.get(pattern).then(function (files) {
280
276
  let result = new Array(files.length);
@@ -352,10 +348,95 @@ class Router extends Register.inherits() {
352
348
  return Router
353
349
  }
354
350
  }
351
+ Router.prototype.routes = null;
355
352
 
356
353
 
357
354
  export const Filters = Register.global("$hxClasses")["whet.route._Router.Filters"] =
358
355
  class Filters {
356
+
357
+ /**
358
+ Like finalize, but restores filter state afterwards. Returns serveId on match, null otherwise.
359
+ */
360
+ static tryFinalize(this1, finalPath) {
361
+ if (this1.length == 1) {
362
+ let f = this1[0];
363
+ let savedPath = f.pathSoFar;
364
+ let savedIP = f.inProgress;
365
+ let parts = finalPath.split("/");
366
+ let res = true;
367
+ let i = this1.length;
368
+ while (--i >= 0) {
369
+ let f = this1[i];
370
+ if (f.inProgress) {
371
+ f.inProgress = false;
372
+ if (f.remDirs.length != 0) {
373
+ let i = parts.length;
374
+ while (--i >= 0) {
375
+ let _g = 0;
376
+ let _g1 = f.remDirs;
377
+ while (_g < _g1.length) if (_g1[_g++].match(parts[i] + "/")) {
378
+ parts.splice(i, 1);
379
+ break;
380
+ };
381
+ };
382
+ };
383
+ f.pathSoFar = f.pathSoFar.concat(parts);
384
+ if (!(f.filter == null || f.filter.match(Path.posix.join(...f.pathSoFar)))) {
385
+ res = false;
386
+ break;
387
+ };
388
+ };
389
+ };
390
+ let serveId = (res) ? Path.posix.join(...this1[0].pathSoFar) : null;
391
+ f.pathSoFar = savedPath;
392
+ f.inProgress = savedIP;
393
+ return serveId;
394
+ };
395
+ let arr = this1;
396
+ let _g = [];
397
+ let _g1 = 0;
398
+ while (_g1 < arr.length) {
399
+ let f = arr[_g1];
400
+ ++_g1;
401
+ _g.push({"p": f.pathSoFar, "ip": f.inProgress});
402
+ };
403
+ let parts = finalPath.split("/");
404
+ let res = true;
405
+ let i = this1.length;
406
+ while (--i >= 0) {
407
+ let f = this1[i];
408
+ if (f.inProgress) {
409
+ f.inProgress = false;
410
+ if (f.remDirs.length != 0) {
411
+ let i = parts.length;
412
+ while (--i >= 0) {
413
+ let _g = 0;
414
+ let _g1 = f.remDirs;
415
+ while (_g < _g1.length) if (_g1[_g++].match(parts[i] + "/")) {
416
+ parts.splice(i, 1);
417
+ break;
418
+ };
419
+ };
420
+ };
421
+ f.pathSoFar = f.pathSoFar.concat(parts);
422
+ if (!(f.filter == null || f.filter.match(Path.posix.join(...f.pathSoFar)))) {
423
+ res = false;
424
+ break;
425
+ };
426
+ };
427
+ };
428
+ let serveId = (res) ? Path.posix.join(...this1[0].pathSoFar) : null;
429
+ let i1 = 0;
430
+ let _g2 = 0;
431
+ while (_g2 < arr.length) {
432
+ let f = arr[_g2];
433
+ ++_g2;
434
+ f.pathSoFar = _g[i1].p;
435
+ f.inProgress = _g[i1].ip;
436
+ ++i1;
437
+ };
438
+ return serveId;
439
+ }
359
440
  static isPathPossible(this1, f) {
360
441
  if (f.filter.options.matchBase) {
361
442
  return true;
@@ -5,12 +5,13 @@ import {Stone, AnyStone} from "../Stone"
5
5
  import {SourceHash} from "../SourceHash"
6
6
  import {SourceData} from "../Source"
7
7
  import {Project} from "../Project"
8
+ import {ConfigStore} from "../ConfigStore"
8
9
 
9
10
  export declare class Files extends Stone<FilesConfig> {
10
11
  constructor(config: FilesConfig)
11
12
  protected initConfig(): void
12
13
  protected generateHash(): Promise<SourceHash>
13
- list(): Promise<string[]>
14
+ protected list(): Promise<null | string[]>
14
15
  protected generate(hash: SourceHash): Promise<SourceData[]>
15
16
  protected walk<T>(onFile: ((arg0: string) => T), onDirFile: ((arg0: string, arg1: string) => T)): Promise<T[]>
16
17
  protected fromCwd(file: string, dir: string): {
@@ -27,6 +28,10 @@ export type FilesConfig = {
27
28
  */
28
29
  cacheStrategy?: null | CacheStrategy,
29
30
  /**
31
+ Optional ConfigStore for persistent per-stone config patching. Overrides project-level configStore.
32
+ */
33
+ configStore?: null | ConfigStore,
34
+ /**
30
35
  * Registers another stone(s) as dependency of this one. Useful for external processes
31
36
  * that use a source of some stone, but don't go via Whet to get it.
32
37
  * Use with combination of `setAbsolutePath` on the dependency, so that the external process
@@ -11,11 +11,12 @@ const $global = Register.$global
11
11
 
12
12
  export const Files = Register.global("$hxClasses")["whet.stones.Files"] =
13
13
  class Files extends Register.inherits(() => Stone, true) {
14
- new(config) {
15
- super.new(config);
14
+ [Register.new](config) {
15
+ super[Register.new](config);
16
16
  }
17
17
  initConfig() {
18
18
  this.config.recursive = (this.config.recursive != null) ? this.config.recursive : true;
19
+ this.config.id = (this.config.id != null) ? this.config.id : MaybeArray_Fields_.makeArray(this.config.paths)[0];
19
20
  }
20
21
  generateHash() {
21
22
  let hashCache = HashCache.get();
@@ -6,6 +6,7 @@ import {Stone, AnyStone} from "../Stone"
6
6
  import {SourceHash} from "../SourceHash"
7
7
  import {SourceData} from "../Source"
8
8
  import {Project} from "../Project"
9
+ import {ConfigStore} from "../ConfigStore"
9
10
 
10
11
  export declare class JsonStone extends Stone<JsonStoneConfig> {
11
12
  constructor(config: JsonStoneConfig)
@@ -13,7 +14,7 @@ export declare class JsonStone extends Stone<JsonStoneConfig> {
13
14
  addProjectData(): JsonStone
14
15
  protected generate(hash: SourceHash): Promise<SourceData[]>
15
16
  protected generateHash(): Promise<SourceHash>
16
- list(): Promise<string[]>
17
+ protected list(): Promise<null | string[]>
17
18
  protected initConfig(): void
18
19
  }
19
20
 
@@ -25,6 +26,10 @@ export type JsonStoneConfig = {
25
26
  */
26
27
  cacheStrategy?: null | CacheStrategy,
27
28
  /**
29
+ Optional ConfigStore for persistent per-stone config patching. Overrides project-level configStore.
30
+ */
31
+ configStore?: null | ConfigStore,
32
+ /**
28
33
  * Registers another stone(s) as dependency of this one. Useful for external processes
29
34
  * that use a source of some stone, but don't go via Whet to get it.
30
35
  * Use with combination of `setAbsolutePath` on the dependency, so that the external process
@@ -9,9 +9,9 @@ const $global = Register.$global
9
9
 
10
10
  export const JsonStone = Register.global("$hxClasses")["whet.stones.JsonStone"] =
11
11
  class JsonStone extends Register.inherits(Stone) {
12
- new(config) {
12
+ [Register.new](config) {
13
13
  this.data = {};
14
- super.new(config);
14
+ super[Register.new](config);
15
15
  }
16
16
  addProjectData() {
17
17
  this.data["name"] = this.project.name;
@@ -80,4 +80,5 @@ class JsonStone extends Register.inherits(Stone) {
80
80
  return JsonStone
81
81
  }
82
82
  }
83
+ JsonStone.prototype.data = null;
83
84
 
@@ -5,13 +5,14 @@ import {Stone, AnyStone} from "../Stone"
5
5
  import {SourceHash} from "../SourceHash"
6
6
  import {SourceData} from "../Source"
7
7
  import {Project} from "../Project"
8
+ import {ConfigStore} from "../ConfigStore"
8
9
 
9
10
  export declare class RemoteFile extends Stone<RemoteFileConfig> {
10
11
  constructor(config: RemoteFileConfig)
11
12
  protected initConfig(): void
12
13
  protected generate(hash: SourceHash): Promise<SourceData[]>
13
- protected get(url: string, res: ((arg0: SourceData[]) => void), rej: ((reason: any) => void)): void
14
- list(): Promise<string[]>
14
+ protected get(url: string, res: ((arg0: SourceData[]) => void), rej: ((arg0: Error) => void)): void
15
+ protected list(): Promise<null | string[]>
15
16
  generateHash(): Promise<SourceHash>
16
17
  protected getId(): string
17
18
  }
@@ -24,6 +25,10 @@ export type RemoteFileConfig = {
24
25
  */
25
26
  cacheStrategy?: null | CacheStrategy,
26
27
  /**
28
+ Optional ConfigStore for persistent per-stone config patching. Overrides project-level configStore.
29
+ */
30
+ configStore?: null | ConfigStore,
31
+ /**
27
32
  * Registers another stone(s) as dependency of this one. Useful for external processes
28
33
  * that use a source of some stone, but don't go via Whet to get it.
29
34
  * Use with combination of `setAbsolutePath` on the dependency, so that the external process
@@ -13,8 +13,8 @@ const $global = Register.$global
13
13
 
14
14
  export const RemoteFile = Register.global("$hxClasses")["whet.stones.RemoteFile"] =
15
15
  class RemoteFile extends Register.inherits(Stone) {
16
- new(config) {
17
- super.new(config);
16
+ [Register.new](config) {
17
+ super[Register.new](config);
18
18
  }
19
19
  initConfig() {
20
20
  if (this.config.cacheStrategy == null) {
@@ -30,24 +30,27 @@ class RemoteFile extends Register.inherits(Stone) {
30
30
  }
31
31
  get(url, res, rej) {
32
32
  let _gthis = this;
33
- Https.get(url, function (response) {
33
+ let req = Https.get(url, function (response) {
34
34
  if (response.statusCode == 301 || response.statusCode == 302) {
35
35
  _gthis.get(response.headers["location"], res, rej);
36
36
  return;
37
37
  };
38
38
  if (response.statusCode < 200 || response.statusCode >= 300) {
39
39
  response.resume();
40
- throw new Error("Error downloading file. " + response.statusCode + " – " + response.statusMessage);
40
+ rej(new Error("Error downloading file. " + response.statusCode + " – " + response.statusMessage));
41
+ return;
41
42
  };
42
43
  let bufs = [];
43
44
  response.on("data", function (d) {
44
45
  return bufs.push(d);
45
46
  });
47
+ response.on("error", rej);
46
48
  response.on("end", function () {
47
49
  let data = Buffer.concat(bufs);
48
50
  res([SourceData.fromBytes(_gthis.getId(), data)]);
49
51
  });
50
52
  });
53
+ req.on("error", rej);
51
54
  }
52
55
  list() {
53
56
  return Promise.resolve([this.getId()]);
@@ -6,6 +6,7 @@ import {Stone, AnyStone} from "../Stone"
6
6
  import {SourceHash} from "../SourceHash"
7
7
  import {SourceData} from "../Source"
8
8
  import {Project} from "../Project"
9
+ import {ConfigStore} from "../ConfigStore"
9
10
 
10
11
  export declare class ZipStone extends Stone<ZipConfig> {
11
12
  constructor(config: ZipConfig)
@@ -16,7 +17,7 @@ export declare class ZipStone extends Stone<ZipConfig> {
16
17
  */
17
18
  protected generateHash(): Promise<SourceHash>
18
19
  protected generate(hash: SourceHash): Promise<SourceData[]>
19
- list(): Promise<string[]>
20
+ protected list(): Promise<null | string[]>
20
21
  }
21
22
 
22
23
  export type ZipConfig = {
@@ -27,6 +28,10 @@ export type ZipConfig = {
27
28
  */
28
29
  cacheStrategy?: null | CacheStrategy,
29
30
  /**
31
+ Optional ConfigStore for persistent per-stone config patching. Overrides project-level configStore.
32
+ */
33
+ configStore?: null | ConfigStore,
34
+ /**
30
35
  * Registers another stone(s) as dependency of this one. Useful for external processes
31
36
  * that use a source of some stone, but don't go via Whet to get it.
32
37
  * Use with combination of `setAbsolutePath` on the dependency, so that the external process
@@ -17,8 +17,8 @@ const $global = Register.$global
17
17
 
18
18
  export const ZipStone = Register.global("$hxClasses")["whet.stones.ZipStone"] =
19
19
  class ZipStone extends Register.inherits(Stone) {
20
- new(config) {
21
- super.new(config);
20
+ [Register.new](config) {
21
+ super[Register.new](config);
22
22
  }
23
23
  initConfig() {
24
24
  if (this.config.filename == null) {
@@ -6,6 +6,7 @@ import {Stone, AnyStone} from "../../Stone"
6
6
  import {SourceHash} from "../../SourceHash"
7
7
  import {SourceData} from "../../Source"
8
8
  import {Project} from "../../Project"
9
+ import {ConfigStore} from "../../ConfigStore"
9
10
 
10
11
  export declare class HaxeBuild extends Stone<BuildConfig> {
11
12
  constructor(config: BuildConfig)
@@ -17,7 +18,7 @@ export declare class HaxeBuild extends Stone<BuildConfig> {
17
18
  build(): Promise<any>
18
19
  protected generate(hash: SourceHash): Promise<SourceData[]>
19
20
  protected addCommands(): void
20
- list(): Promise<string[]>
21
+ protected list(): Promise<null | string[]>
21
22
  protected generateHash(): Promise<SourceHash>
22
23
  }
23
24
 
@@ -28,6 +29,10 @@ export type BuildConfig = {
28
29
  * After stone is initialized, change `stone.cacheStrategy` directly.
29
30
  */
30
31
  cacheStrategy?: null | CacheStrategy,
32
+ /**
33
+ Optional ConfigStore for persistent per-stone config patching. Overrides project-level configStore.
34
+ */
35
+ configStore?: null | ConfigStore,
31
36
  cwd?: null | string,
32
37
  /**
33
38
  * Registers another stone(s) as dependency of this one. Useful for external processes
@@ -40,6 +45,7 @@ export type BuildConfig = {
40
45
  * Do not create cyclic dependencies!
41
46
  */
42
47
  dependencies?: null | MaybeArray<AnyStone>,
48
+ exposeCommands?: null | boolean,
43
49
  filename?: null | string,
44
50
  hxml: Hxml,
45
51
  /**
@@ -14,8 +14,8 @@ const $global = Register.$global
14
14
 
15
15
  export const HaxeBuild = Register.global("$hxClasses")["whet.stones.haxe.HaxeBuild"] =
16
16
  class HaxeBuild extends Register.inherits(Stone) {
17
- new(config) {
18
- super.new(config);
17
+ [Register.new](config) {
18
+ super[Register.new](config);
19
19
  }
20
20
  initConfig() {
21
21
  if (this.config.cacheStrategy == null) {
@@ -78,15 +78,17 @@ class HaxeBuild extends Register.inherits(Stone) {
78
78
  }
79
79
  addCommands() {
80
80
  let _gthis = this;
81
- this.project.addCommand("build", this).action(function (..._) {
82
- return _gthis.project.cache.refreshSource(_gthis);
83
- });
81
+ if (this.config.exposeCommands != false) {
82
+ this.project.addCommand("build", this).action(function (..._) {
83
+ return _gthis.project.cache.refreshSource(_gthis);
84
+ });
85
+ };
84
86
  }
85
87
  list() {
86
88
  if (this.config.hxml.isSingleFile()) {
87
89
  return Promise.resolve([this.config.hxml.getBuildFilename()]);
88
90
  } else {
89
- return super.list();
91
+ return Promise.resolve(null);
90
92
  };
91
93
  }
92
94
  generateHash() {
@@ -6,6 +6,7 @@ import {Stone, AnyStone} from "../../Stone"
6
6
  import {SourceHash} from "../../SourceHash"
7
7
  import {SourceData} from "../../Source"
8
8
  import {Project} from "../../Project"
9
+ import {ConfigStore} from "../../ConfigStore"
9
10
 
10
11
  export declare class Hxml extends Stone<HxmlConfig> {
11
12
  constructor(config: HxmlConfig)
@@ -22,7 +23,7 @@ export declare class Hxml extends Stone<HxmlConfig> {
22
23
  isSingleFile(): boolean
23
24
  getBuildExtension(): string
24
25
  protected generate(hash: SourceHash): Promise<SourceData[]>
25
- list(): Promise<string[]>
26
+ protected list(): Promise<null | string[]>
26
27
  protected filename(): string
27
28
  generateHash(): Promise<SourceHash>
28
29
  generateHashSync(): SourceHash
@@ -36,6 +37,10 @@ export type HxmlConfig = {
36
37
  * After stone is initialized, change `stone.cacheStrategy` directly.
37
38
  */
38
39
  cacheStrategy?: null | CacheStrategy,
40
+ /**
41
+ Optional ConfigStore for persistent per-stone config patching. Overrides project-level configStore.
42
+ */
43
+ configStore?: null | ConfigStore,
39
44
  dce?: null | DCE,
40
45
  debug?: null | boolean,
41
46
  defines?: null | MaybeArray<string>,
@@ -50,6 +55,7 @@ export type HxmlConfig = {
50
55
  * Do not create cyclic dependencies!
51
56
  */
52
57
  dependencies?: null | MaybeArray<AnyStone>,
58
+ exposeCommands?: null | boolean,
53
59
  flags?: null | MaybeArray<MaybeArray<string>>,
54
60
  /**
55
61
  Defaults to the Stone's class name.
@@ -13,18 +13,19 @@ const $global = Register.$global
13
13
 
14
14
  export const Hxml = Register.global("$hxClasses")["whet.stones.haxe.Hxml"] =
15
15
  class Hxml extends Register.inherits(Stone) {
16
- new(config) {
17
- super.new(config);
16
+ [Register.new](config) {
17
+ super[Register.new](config);
18
18
  }
19
19
  initConfig() {
20
20
  if (this.config.cacheStrategy == null) {
21
21
  this.config.cacheStrategy = CacheStrategy.InFile(CacheDurability.LimitCountByLastUse(1));
22
22
  };
23
- this.build = new HaxeBuild({"hxml": this, "id": "build", "project": this.config.project});
23
+ let tmp = this.config.id;
24
+ this.build = new HaxeBuild({"hxml": this, "id": ((tmp != null) ? tmp : "haxe") + "-build", "project": this.config.project, "exposeCommands": this.config.exposeCommands});
24
25
  }
25
26
  clone(id) {
26
27
  let configClone = this.cloneConfig(this.config);
27
- configClone.id = StoneId_Fields_.makeStoneId((id == null) ? this.id : id);
28
+ configClone.id = StoneId_Fields_.makeStoneId((id == null) ? this.id + "-clone" : id);
28
29
  return new Hxml(configClone);
29
30
  }
30
31
  mergeConfig(additionalConfig) {
@@ -302,7 +303,7 @@ class Hxml extends Register.inherits(Stone) {
302
303
  let _g1 = 0;
303
304
  let _g2 = MaybeArray_Fields_.makeArray(config.flags);
304
305
  while (_g1 < _g2.length) _g.push(MaybeArray_Fields_.makeArray(_g2[_g1++]).slice());
305
- return {"project": config1, "libs": tmp, "paths": tmp1, "defines": tmp2, "dce": config2, "main": config3, "debug": config4, "flags": _g, "platform": config.platform};
306
+ return {"project": config1, "libs": tmp, "paths": tmp1, "defines": tmp2, "dce": config2, "main": config3, "debug": config4, "flags": _g, "platform": config.platform, "exposeCommands": false};
306
307
  }
307
308
  static get __name__() {
308
309
  return "whet.stones.haxe.Hxml"
@@ -314,6 +315,7 @@ class Hxml extends Register.inherits(Stone) {
314
315
  return Hxml
315
316
  }
316
317
  }
318
+ Hxml.prototype.build = null;
317
319
 
318
320
 
319
321
  export const DCE =
package/bin/whet.d.ts CHANGED
@@ -4,8 +4,6 @@ export {ZipStone} from "./whet/stones/Zip"
4
4
  export {ZipConfig} from "./whet/stones/Zip"
5
5
  export {Utils} from "./whet/Utils"
6
6
  export {Stone} from "./whet/Stone"
7
- export {ServerConfig} from "./whet/stones/Server"
8
- export {Server} from "./whet/stones/Server"
9
7
  export {Router} from "./whet/route/Router"
10
8
  export {RemoteFileConfig} from "./whet/stones/RemoteFile"
11
9
  export {RemoteFile} from "./whet/stones/RemoteFile"
@@ -20,5 +18,6 @@ export {HaxeBuild} from "./whet/stones/haxe/HaxeBuild"
20
18
  export {FilesConfig} from "./whet/stones/Files"
21
19
  export {Files} from "./whet/stones/Files"
22
20
  export {DCE} from "./whet/stones/haxe/Hxml"
21
+ export {ConfigStore} from "./whet/ConfigStore"
23
22
  export {BuildPlatform} from "./whet/stones/haxe/Hxml"
24
23
  export {BuildConfig} from "./whet/stones/haxe/HaxeBuild"
package/bin/whet.js CHANGED
@@ -9,7 +9,6 @@ export {addOption} from "./whet/Project.js"
9
9
  export {ZipStone} from "./whet/stones/Zip.js"
10
10
  export {Utils} from "./whet/Utils.js"
11
11
  export {Stone} from "./whet/Stone.js"
12
- export {Server} from "./whet/stones/Server.js"
13
12
  export {Router} from "./whet/route/Router.js"
14
13
  export {RemoteFile} from "./whet/stones/RemoteFile.js"
15
14
  export {Project} from "./whet/Project.js"
@@ -20,4 +19,5 @@ export {Hxml} from "./whet/stones/haxe/Hxml.js"
20
19
  export {HaxeBuild} from "./whet/stones/haxe/HaxeBuild.js"
21
20
  export {Files} from "./whet/stones/Files.js"
22
21
  export {DCE} from "./whet/stones/haxe/Hxml.js"
22
+ export {ConfigStore} from "./whet/ConfigStore.js"
23
23
  export {BuildPlatform} from "./whet/stones/haxe/Hxml.js"
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "whet",
3
- "version": "0.0.34",
3
+ "version": "0.1.0",
4
4
  "description": "NodeJS based assets management and project tooling library.",
5
5
  "scripts": {
6
- "devinit": "npx dts2hx commander pino-pretty --modular --noLibWrap",
7
- "build": "npx haxe build.hxml"
6
+ "devinit": "npx dts2hx commander pino-pretty minimatch --modular --noLibWrap",
7
+ "build": "npx haxe build.hxml",
8
+ "test": "node --test \"test/**/*.test.mjs\""
8
9
  },
9
10
  "repository": {
10
11
  "type": "git",
@@ -25,14 +26,12 @@
25
26
  },
26
27
  "homepage": "https://github.com/Antriel/whet#readme",
27
28
  "dependencies": {
28
- "commander": "^9.0.0",
29
- "mime": "^3.0.0",
30
- "minimatch": "^5.1.0",
31
- "pino-pretty": "^9.1.0"
29
+ "commander": "^14.0.3",
30
+ "minimatch": "^10.2.2",
31
+ "pino-pretty": "^13.1.3"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/minimatch": "^5.1.0",
35
- "dts2hx": "^0.18.1",
36
- "lix": "^15.11.6"
34
+ "dts2hx": "^0.20.0",
35
+ "lix": "^16.0.2"
37
36
  }
38
37
  }