whet 0.0.11 → 0.0.14
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.
- package/bin/whet/Source.js +6 -3
- package/bin/whet/Stone.d.ts +31 -3
- package/bin/whet/Stone.js +65 -16
- package/bin/whet/Utils.js +1 -1
- package/bin/whet/Whet.js +1 -1
- package/bin/whet/cache/BaseCache.js +1 -1
- package/bin/whet/cache/CacheManager.js +2 -2
- package/bin/whet/cache/FileCache.js +5 -1
- package/bin/whet/route/RouteResult.js +11 -0
- package/bin/whet/stones/Files.d.ts +7 -2
- package/bin/whet/stones/JsonStone.d.ts +7 -2
- package/bin/whet/stones/RemoteFile.d.ts +7 -2
- package/bin/whet/stones/Server.d.ts +7 -2
- package/bin/whet/stones/Server.js +6 -1
- package/bin/whet/stones/Zip.d.ts +7 -2
- package/bin/whet/stones/haxe/HaxeBuild.d.ts +7 -2
- package/bin/whet/stones/haxe/HaxeBuild.js +4 -3
- package/bin/whet/stones/haxe/Hxml.d.ts +7 -2
- package/package.json +1 -1
package/bin/whet/Source.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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} from "./Log.js"
|
|
4
|
+
import {Log as Log__1} from "./Log.js"
|
|
5
5
|
import * as Path from "path"
|
|
6
|
+
import {Log} from "../haxe/Log.js"
|
|
6
7
|
import {Register} from "../genes/Register.js"
|
|
7
8
|
import * as Fs from "fs"
|
|
8
9
|
import {Buffer} from "buffer"
|
|
@@ -82,6 +83,7 @@ class SourceData extends Register.inherits() {
|
|
|
82
83
|
*/
|
|
83
84
|
getFilePathId(idOverride) {
|
|
84
85
|
var _gthis = this;
|
|
86
|
+
Log.trace(this.filePath, {"fileName": "src/whet/Source.hx", "lineNumber": 106, "className": "whet.SourceData", "methodName": "getFilePathId", "customParams": [this.filePathId, idOverride]});
|
|
85
87
|
if (this.filePathId == null) {
|
|
86
88
|
return this.getFilePath(idOverride).then(function (_) {
|
|
87
89
|
return _gthis.filePathId;
|
|
@@ -101,13 +103,14 @@ class SourceData extends Register.inherits() {
|
|
|
101
103
|
new Error("Data without source.");
|
|
102
104
|
};
|
|
103
105
|
var dir = this.source.getDirPath();
|
|
104
|
-
this.filePathId = SourceId.getPutInDir((idOverride != null) ? idOverride : this.id, dir);
|
|
106
|
+
this.filePathId = SourceId.getPutInDir((idOverride != null && HxOverrides.cca(idOverride, idOverride.length - 1) != 47) ? idOverride : this.id, dir);
|
|
105
107
|
var this1 = this.filePathId;
|
|
106
108
|
var root = RootDir.fromProject(this.source.origin.project);
|
|
107
109
|
if (this1.charAt(0) != "/") {
|
|
108
110
|
throw new Error("Badly formed SourceId.");
|
|
109
111
|
};
|
|
110
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]});
|
|
111
114
|
return Utils.saveBytes(this.filePath, this.data).then(function (_) {
|
|
112
115
|
return _gthis.filePath;
|
|
113
116
|
});
|
|
@@ -126,7 +129,7 @@ class SourceData extends Register.inherits() {
|
|
|
126
129
|
return new Promise(function (res, rej) {
|
|
127
130
|
Fs.readFile(path, function (err, buffer) {
|
|
128
131
|
if (err != null) {
|
|
129
|
-
|
|
132
|
+
Log__1.log(50, ...["File does not exist.", {"id": id, "path": path}]);
|
|
130
133
|
res(null);
|
|
131
134
|
} else {
|
|
132
135
|
var source = SourceData.fromBytes(id, buffer);
|
package/bin/whet/Stone.d.ts
CHANGED
|
@@ -42,18 +42,41 @@ export declare class Stone<T extends StoneConfig> {
|
|
|
42
42
|
*/
|
|
43
43
|
getHash(): Promise<SourceHash>
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* **Do not override.**
|
|
47
|
+
* Should only be used internally.
|
|
48
|
+
* Used to finalize a hash in `getHash` or in `generateSource` if `getHash` isn't implemented.
|
|
49
|
+
* Also used by the cache for the same purpose.
|
|
50
|
+
*/
|
|
51
|
+
protected finalizeHash(hash: SourceHash): Promise<null | SourceHash>
|
|
52
|
+
|
|
45
53
|
/**
|
|
46
54
|
* **Do not override.**
|
|
47
55
|
* Generates new Source. Used by the cache when needed.
|
|
48
56
|
* Hash passed should be the same as is this stone's current one. Passed in as optimization.
|
|
49
57
|
*/
|
|
50
|
-
protected generateSource(hash: SourceHash): Promise<Source>
|
|
58
|
+
protected generateSource(hash: null | SourceHash): Promise<Source>
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* To be used externally (i.e. `myStone.handleError = err => ...`) for providing a fallback value
|
|
62
|
+
* where it might make sense.
|
|
63
|
+
* @param err Any error that might have happened during `generateSource`.
|
|
64
|
+
*/
|
|
65
|
+
handleError(err: any): Promise<SourceData[]>
|
|
51
66
|
|
|
52
67
|
/**
|
|
53
68
|
* Optionally overridable hash generation as optimization.
|
|
69
|
+
* Do not use directly. Use `getHash` instead.
|
|
54
70
|
*/
|
|
55
71
|
protected generateHash(): Promise<SourceHash>
|
|
56
72
|
|
|
73
|
+
/**
|
|
74
|
+
* **Do not override.**
|
|
75
|
+
* Used by cache. Returns either null, or result of `generateHash` finalized by adding
|
|
76
|
+
* dependencies.
|
|
77
|
+
*/
|
|
78
|
+
protected finalMaybeHash(): Promise<null | SourceHash>
|
|
79
|
+
|
|
57
80
|
/**
|
|
58
81
|
* Abstract method.
|
|
59
82
|
* Function that actually generates the source. Passed hash is only non-null
|
|
@@ -97,12 +120,17 @@ export declare class Stone<T extends StoneConfig> {
|
|
|
97
120
|
}
|
|
98
121
|
|
|
99
122
|
export type StoneConfig = {
|
|
123
|
+
/**
|
|
124
|
+
* Defaults to `project.cache.defaultStrategy`.
|
|
125
|
+
* **Do not modify after initialization – it is ignored.**
|
|
126
|
+
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
127
|
+
*/
|
|
100
128
|
cacheStrategy?: null | CacheStrategy,
|
|
101
129
|
/**
|
|
102
|
-
* Registers another stone as dependency of this one. Useful for external processes
|
|
130
|
+
* Registers another stone(s) as dependency of this one. Useful for external processes
|
|
103
131
|
* that use a source of some stone, but don't go via Whet to get it.
|
|
104
132
|
* Use with combination of `setAbsolutePath` on the dependency, so that the external process
|
|
105
|
-
* can rely on fixed path.
|
|
133
|
+
* can rely on a fixed path.
|
|
106
134
|
* Will make sure the cached file is up to date when generating this stone.
|
|
107
135
|
* Hash of the dependency is automatically combined with hash generated by this stone. There's no
|
|
108
136
|
* need to add it manually.
|
package/bin/whet/Stone.js
CHANGED
|
@@ -66,27 +66,37 @@ class Stone extends Register.inherits() {
|
|
|
66
66
|
getHash() {
|
|
67
67
|
var _gthis = this;
|
|
68
68
|
Log.log(20, ...["Generating hash.", {"stone": this}]);
|
|
69
|
-
return this.
|
|
69
|
+
return this.finalMaybeHash().then(function (hash) {
|
|
70
70
|
if (hash != null) {
|
|
71
71
|
return hash;
|
|
72
72
|
} else {
|
|
73
73
|
return _gthis.getSource().then(function (s) {
|
|
74
|
-
|
|
75
|
-
var _g = [];
|
|
76
|
-
var _g1 = 0;
|
|
77
|
-
var _g2 = MaybeArray_Fields_.makeArray(_gthis.config.dependencies);
|
|
78
|
-
while (_g1 < _g2.length) _g.push(_g2[_g1++].getHash());
|
|
79
|
-
return Promise.all(_g).then(function (hashes) {
|
|
80
|
-
return s.hash.add(SourceHash.merge(...hashes));
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
return Promise.resolve(s.hash);
|
|
84
|
-
};
|
|
74
|
+
return s.hash;
|
|
85
75
|
});
|
|
86
76
|
};
|
|
87
77
|
});
|
|
88
78
|
}
|
|
89
79
|
|
|
80
|
+
/**
|
|
81
|
+
* **Do not override.**
|
|
82
|
+
* Should only be used internally.
|
|
83
|
+
* Used to finalize a hash in `getHash` or in `generateSource` if `getHash` isn't implemented.
|
|
84
|
+
* Also used by the cache for the same purpose.
|
|
85
|
+
*/
|
|
86
|
+
finalizeHash(hash) {
|
|
87
|
+
if (hash == null || this.config.dependencies == null) {
|
|
88
|
+
return Promise.resolve(hash);
|
|
89
|
+
} else {
|
|
90
|
+
var _g = [];
|
|
91
|
+
var _g1 = 0;
|
|
92
|
+
var _g2 = MaybeArray_Fields_.makeArray(this.config.dependencies);
|
|
93
|
+
while (_g1 < _g2.length) _g.push(_g2[_g1++].getHash());
|
|
94
|
+
return Promise.all(_g).then(function (hashes) {
|
|
95
|
+
return hash.add(SourceHash.merge(...hashes));
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
90
100
|
/**
|
|
91
101
|
* **Do not override.**
|
|
92
102
|
* Generates new Source. Used by the cache when needed.
|
|
@@ -95,7 +105,6 @@ class Stone extends Register.inherits() {
|
|
|
95
105
|
generateSource(hash) {
|
|
96
106
|
var _gthis = this;
|
|
97
107
|
Log.log(20, ...["Generating source.", {"stone": this, "hash": hash}]);
|
|
98
|
-
console.log("src/whet/Stone.hx:74:",this.config.dependencies);
|
|
99
108
|
var init;
|
|
100
109
|
if (this.config.dependencies != null) {
|
|
101
110
|
var _g = [];
|
|
@@ -110,7 +119,11 @@ class Stone extends Register.inherits() {
|
|
|
110
119
|
var dataPromise = _gthis.generate(hash);
|
|
111
120
|
if (dataPromise != null) {
|
|
112
121
|
return dataPromise.then(function (data) {
|
|
113
|
-
|
|
122
|
+
var finalHash;
|
|
123
|
+
if (hash != null) {
|
|
124
|
+
finalHash = Promise.resolve(hash);
|
|
125
|
+
} else {
|
|
126
|
+
var _gthis1 = _gthis;
|
|
114
127
|
var result = new Array(data.length);
|
|
115
128
|
var _g = 0;
|
|
116
129
|
var _g1 = data.length;
|
|
@@ -118,23 +131,59 @@ class Stone extends Register.inherits() {
|
|
|
118
131
|
var i = _g++;
|
|
119
132
|
result[i] = SourceHash.fromBytes(data[i].data);
|
|
120
133
|
};
|
|
121
|
-
|
|
134
|
+
finalHash = _gthis1.finalizeHash(SourceHash.merge(...result));
|
|
122
135
|
};
|
|
123
|
-
return
|
|
136
|
+
return finalHash.then(function (hash) {
|
|
137
|
+
return new Source(data, hash, _gthis, Date.now() / 1000);
|
|
138
|
+
});
|
|
124
139
|
});
|
|
125
140
|
} else {
|
|
126
141
|
return null;
|
|
127
142
|
};
|
|
143
|
+
})["catch"](function (e) {
|
|
144
|
+
return _gthis.handleError(e).then(function (data) {
|
|
145
|
+
Log.log(40, ...["Error happened and was handled by `handleError`.", {"stone": _gthis, "error": e}]);
|
|
146
|
+
var result = new Array(data.length);
|
|
147
|
+
var _g = 0;
|
|
148
|
+
var _g1 = data.length;
|
|
149
|
+
while (_g < _g1) {
|
|
150
|
+
var i = _g++;
|
|
151
|
+
result[i] = SourceHash.fromBytes(data[i].data);
|
|
152
|
+
};
|
|
153
|
+
return new Source(data, SourceHash.merge(...result), _gthis, Date.now() / 1000);
|
|
154
|
+
});
|
|
128
155
|
});
|
|
129
156
|
}
|
|
130
157
|
|
|
158
|
+
/**
|
|
159
|
+
* To be used externally (i.e. `myStone.handleError = err => ...`) for providing a fallback value
|
|
160
|
+
* where it might make sense.
|
|
161
|
+
* @param err Any error that might have happened during `generateSource`.
|
|
162
|
+
*/
|
|
163
|
+
handleError(err) {
|
|
164
|
+
return Promise.reject(err);
|
|
165
|
+
}
|
|
166
|
+
|
|
131
167
|
/**
|
|
132
168
|
* Optionally overridable hash generation as optimization.
|
|
169
|
+
* Do not use directly. Use `getHash` instead.
|
|
133
170
|
*/
|
|
134
171
|
generateHash() {
|
|
135
172
|
return Promise.resolve(null);
|
|
136
173
|
}
|
|
137
174
|
|
|
175
|
+
/**
|
|
176
|
+
* **Do not override.**
|
|
177
|
+
* Used by cache. Returns either null, or result of `generateHash` finalized by adding
|
|
178
|
+
* dependencies.
|
|
179
|
+
*/
|
|
180
|
+
finalMaybeHash() {
|
|
181
|
+
var _gthis = this;
|
|
182
|
+
return this.generateHash().then(function (hash) {
|
|
183
|
+
return _gthis.finalizeHash(hash);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
138
187
|
/**
|
|
139
188
|
* Returns a list of sources that this stone generates.
|
|
140
189
|
* Used by Router for finding the correct asset.
|
package/bin/whet/Utils.js
CHANGED
|
@@ -53,7 +53,7 @@ class Utils {
|
|
|
53
53
|
Saves bytes Buffer, creates missing directories if needed.
|
|
54
54
|
*/
|
|
55
55
|
static saveBytes(path, bytes) {
|
|
56
|
-
Log.log(10, ...["Writing bytes to " + path + "."]);
|
|
56
|
+
Log.log(10, ...["Writing bytes to \"" + path + "\"."]);
|
|
57
57
|
return Utils.ensureDirExist(Path.dirname(path)).then(function (_) {
|
|
58
58
|
return new Promise(function (res, rej) {
|
|
59
59
|
Fs.writeFile(path, bytes, function (err) {
|
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.
|
|
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");
|
|
14
14
|
Whet_Fields_.program.parse();
|
|
15
15
|
var options = Whet_Fields_.program.opts();
|
|
16
16
|
if (options.logLevel != null) {
|
|
@@ -23,7 +23,7 @@ class BaseCache extends Register.inherits() {
|
|
|
23
23
|
}
|
|
24
24
|
get(stone, durability, check) {
|
|
25
25
|
var _gthis = this;
|
|
26
|
-
return stone.
|
|
26
|
+
return stone.finalMaybeHash().then(function (hash) {
|
|
27
27
|
if (hash == null) {
|
|
28
28
|
Log.log(20, ...["Generating source, because it does not supply a hash.", {"stone": stone, "cache": _gthis}]);
|
|
29
29
|
};
|
|
@@ -27,7 +27,7 @@ class CacheManager extends Register.inherits() {
|
|
|
27
27
|
var _g = stone.cacheStrategy;
|
|
28
28
|
switch (_g._hx_index) {
|
|
29
29
|
case 0:
|
|
30
|
-
return stone.
|
|
30
|
+
return stone.finalMaybeHash().then(function (hash) {
|
|
31
31
|
return stone.generateSource(hash);
|
|
32
32
|
});
|
|
33
33
|
break
|
|
@@ -54,7 +54,7 @@ class CacheManager extends Register.inherits() {
|
|
|
54
54
|
Log.log(10, ...["Re-generating cached stone.", {"stone": stone}]);
|
|
55
55
|
switch (stone.cacheStrategy._hx_index) {
|
|
56
56
|
case 0:
|
|
57
|
-
return stone.
|
|
57
|
+
return stone.finalMaybeHash().then(function (hash) {
|
|
58
58
|
return stone.generateSource(hash);
|
|
59
59
|
});
|
|
60
60
|
break
|
|
@@ -94,6 +94,7 @@ 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);
|
|
97
98
|
var s = _g1.substring(_g1.lastIndexOf("/"));
|
|
98
99
|
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
99
100
|
if (str.length > 0) {
|
|
@@ -108,6 +109,7 @@ class FileCache extends Register.inherits(BaseCache) {
|
|
|
108
109
|
} else {
|
|
109
110
|
idOverride = null;
|
|
110
111
|
};
|
|
112
|
+
console.log("src/whet/cache/FileCache.hx:50:",idOverride);
|
|
111
113
|
var _g = [];
|
|
112
114
|
var _g1 = 0;
|
|
113
115
|
var _g2 = source.data;
|
|
@@ -116,7 +118,9 @@ class FileCache extends Register.inherits(BaseCache) {
|
|
|
116
118
|
++_g1;
|
|
117
119
|
_g.push(data[0].getFilePathId(idOverride).then((function (data) {
|
|
118
120
|
return function (filePath) {
|
|
119
|
-
|
|
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};
|
|
120
124
|
};
|
|
121
125
|
})(data)));
|
|
122
126
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Log} from "../../haxe/Log.js"
|
|
1
2
|
import {Register} from "../../genes/Register.js"
|
|
2
3
|
|
|
3
4
|
const $global = Register.$global
|
|
@@ -12,6 +13,16 @@ class RouteResult extends Register.inherits() {
|
|
|
12
13
|
get() {
|
|
13
14
|
var _gthis = this;
|
|
14
15
|
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);
|
|
15
26
|
return data.get(_gthis.sourceId);
|
|
16
27
|
});
|
|
17
28
|
}
|
|
@@ -13,12 +13,17 @@ export declare class Files extends Stone<FilesConfig> {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export type FilesConfig = {
|
|
16
|
+
/**
|
|
17
|
+
* Defaults to `project.cache.defaultStrategy`.
|
|
18
|
+
* **Do not modify after initialization – it is ignored.**
|
|
19
|
+
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
20
|
+
*/
|
|
16
21
|
cacheStrategy?: null | CacheStrategy,
|
|
17
22
|
/**
|
|
18
|
-
* Registers another stone as dependency of this one. Useful for external processes
|
|
23
|
+
* Registers another stone(s) as dependency of this one. Useful for external processes
|
|
19
24
|
* that use a source of some stone, but don't go via Whet to get it.
|
|
20
25
|
* Use with combination of `setAbsolutePath` on the dependency, so that the external process
|
|
21
|
-
* can rely on fixed path.
|
|
26
|
+
* can rely on a fixed path.
|
|
22
27
|
* Will make sure the cached file is up to date when generating this stone.
|
|
23
28
|
* Hash of the dependency is automatically combined with hash generated by this stone. There's no
|
|
24
29
|
* need to add it manually.
|
|
@@ -19,12 +19,17 @@ export declare class JsonStone extends Stone<JsonStoneConfig> {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export type JsonStoneConfig = {
|
|
22
|
+
/**
|
|
23
|
+
* Defaults to `project.cache.defaultStrategy`.
|
|
24
|
+
* **Do not modify after initialization – it is ignored.**
|
|
25
|
+
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
26
|
+
*/
|
|
22
27
|
cacheStrategy?: null | CacheStrategy,
|
|
23
28
|
/**
|
|
24
|
-
* Registers another stone as dependency of this one. Useful for external processes
|
|
29
|
+
* Registers another stone(s) as dependency of this one. Useful for external processes
|
|
25
30
|
* that use a source of some stone, but don't go via Whet to get it.
|
|
26
31
|
* Use with combination of `setAbsolutePath` on the dependency, so that the external process
|
|
27
|
-
* can rely on fixed path.
|
|
32
|
+
* can rely on a fixed path.
|
|
28
33
|
* Will make sure the cached file is up to date when generating this stone.
|
|
29
34
|
* Hash of the dependency is automatically combined with hash generated by this stone. There's no
|
|
30
35
|
* need to add it manually.
|
|
@@ -16,12 +16,17 @@ export declare class RemoteFile extends Stone<RemoteFileConfig> {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export type RemoteFileConfig = {
|
|
19
|
+
/**
|
|
20
|
+
* Defaults to `project.cache.defaultStrategy`.
|
|
21
|
+
* **Do not modify after initialization – it is ignored.**
|
|
22
|
+
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
23
|
+
*/
|
|
19
24
|
cacheStrategy?: null | CacheStrategy,
|
|
20
25
|
/**
|
|
21
|
-
* Registers another stone as dependency of this one. Useful for external processes
|
|
26
|
+
* Registers another stone(s) as dependency of this one. Useful for external processes
|
|
22
27
|
* that use a source of some stone, but don't go via Whet to get it.
|
|
23
28
|
* Use with combination of `setAbsolutePath` on the dependency, so that the external process
|
|
24
|
-
* can rely on fixed path.
|
|
29
|
+
* can rely on a fixed path.
|
|
25
30
|
* Will make sure the cached file is up to date when generating this stone.
|
|
26
31
|
* Hash of the dependency is automatically combined with hash generated by this stone. There's no
|
|
27
32
|
* need to add it manually.
|
|
@@ -25,12 +25,17 @@ export declare class Server extends Stone<ServerConfig> {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export type ServerConfig = {
|
|
28
|
+
/**
|
|
29
|
+
* Defaults to `project.cache.defaultStrategy`.
|
|
30
|
+
* **Do not modify after initialization – it is ignored.**
|
|
31
|
+
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
32
|
+
*/
|
|
28
33
|
cacheStrategy?: null | CacheStrategy,
|
|
29
34
|
/**
|
|
30
|
-
* Registers another stone as dependency of this one. Useful for external processes
|
|
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
|
|
33
|
-
* can rely on fixed path.
|
|
38
|
+
* can rely on a fixed path.
|
|
34
39
|
* Will make sure the cached file is up to date when generating this stone.
|
|
35
40
|
* Hash of the dependency is automatically combined with hash generated by this stone. There's no
|
|
36
41
|
* need to add it manually.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {Stone} from "../Stone.js"
|
|
2
|
-
import {Log} from "../Log.js"
|
|
2
|
+
import {Log, Log as Log__2} 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"
|
|
6
7
|
import {Register} from "../../genes/Register.js"
|
|
7
8
|
import {StringTools} from "../../StringTools.js"
|
|
8
9
|
import {Std} from "../../Std.js"
|
|
@@ -98,7 +99,11 @@ class Server extends Register.inherits(Stone) {
|
|
|
98
99
|
id = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
99
100
|
};
|
|
100
101
|
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);
|
|
101
104
|
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);
|
|
102
107
|
if (source == null) {
|
|
103
108
|
res.writeHead(404, "File not found.");
|
|
104
109
|
res.end();
|
package/bin/whet/stones/Zip.d.ts
CHANGED
|
@@ -16,12 +16,17 @@ export declare class ZipStone extends Stone<ZipConfig> {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export type ZipConfig = {
|
|
19
|
+
/**
|
|
20
|
+
* Defaults to `project.cache.defaultStrategy`.
|
|
21
|
+
* **Do not modify after initialization – it is ignored.**
|
|
22
|
+
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
23
|
+
*/
|
|
19
24
|
cacheStrategy?: null | CacheStrategy,
|
|
20
25
|
/**
|
|
21
|
-
* Registers another stone as dependency of this one. Useful for external processes
|
|
26
|
+
* Registers another stone(s) as dependency of this one. Useful for external processes
|
|
22
27
|
* that use a source of some stone, but don't go via Whet to get it.
|
|
23
28
|
* Use with combination of `setAbsolutePath` on the dependency, so that the external process
|
|
24
|
-
* can rely on fixed path.
|
|
29
|
+
* can rely on a fixed path.
|
|
25
30
|
* Will make sure the cached file is up to date when generating this stone.
|
|
26
31
|
* Hash of the dependency is automatically combined with hash generated by this stone. There's no
|
|
27
32
|
* need to add it manually.
|
|
@@ -22,12 +22,17 @@ export declare class HaxeBuild extends Stone<BuildConfig> {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export type BuildConfig = {
|
|
25
|
+
/**
|
|
26
|
+
* Defaults to `project.cache.defaultStrategy`.
|
|
27
|
+
* **Do not modify after initialization – it is ignored.**
|
|
28
|
+
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
29
|
+
*/
|
|
25
30
|
cacheStrategy?: null | CacheStrategy,
|
|
26
31
|
/**
|
|
27
|
-
* Registers another stone as dependency of this one. Useful for external processes
|
|
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
|
|
30
|
-
* can rely on fixed path.
|
|
35
|
+
* can rely on a fixed path.
|
|
31
36
|
* Will make sure the cached file is up to date when generating this stone.
|
|
32
37
|
* Hash of the dependency is automatically combined with hash generated by this stone. There's no
|
|
33
38
|
* need to add it manually.
|
|
@@ -61,8 +61,9 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
61
61
|
};
|
|
62
62
|
ChildProcess.exec(result.join(" "), {"cwd": cwd1, "windowsHide": true}, function (err, stdout, stderr) {
|
|
63
63
|
if (err != null) {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
var haxeError = new Error(stderr);
|
|
65
|
+
haxeError.name = "Haxe Build Error";
|
|
66
|
+
rej(haxeError);
|
|
66
67
|
} else {
|
|
67
68
|
Log.log(30, ...["Haxe build successful."]);
|
|
68
69
|
res(null);
|
|
@@ -124,7 +125,7 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
124
125
|
};
|
|
125
126
|
result[i] = Path.posix.join(".", root, ".", this1);
|
|
126
127
|
};
|
|
127
|
-
return Promise.all([this.config.hxml.
|
|
128
|
+
return Promise.all([this.config.hxml.getHash(), SourceHash.fromFiles(result)]).then(function (r) {
|
|
128
129
|
return SourceHash.merge(...r);
|
|
129
130
|
});
|
|
130
131
|
}
|
|
@@ -30,15 +30,20 @@ export declare class Hxml extends Stone<HxmlConfig> {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export type HxmlConfig = {
|
|
33
|
+
/**
|
|
34
|
+
* Defaults to `project.cache.defaultStrategy`.
|
|
35
|
+
* **Do not modify after initialization – it is ignored.**
|
|
36
|
+
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
37
|
+
*/
|
|
33
38
|
cacheStrategy?: null | CacheStrategy,
|
|
34
39
|
dce?: null | DCE,
|
|
35
40
|
debug?: null | boolean,
|
|
36
41
|
defines?: null | MaybeArray<string>,
|
|
37
42
|
/**
|
|
38
|
-
* Registers another stone as dependency of this one. Useful for external processes
|
|
43
|
+
* Registers another stone(s) as dependency of this one. Useful for external processes
|
|
39
44
|
* that use a source of some stone, but don't go via Whet to get it.
|
|
40
45
|
* Use with combination of `setAbsolutePath` on the dependency, so that the external process
|
|
41
|
-
* can rely on fixed path.
|
|
46
|
+
* can rely on a fixed path.
|
|
42
47
|
* Will make sure the cached file is up to date when generating this stone.
|
|
43
48
|
* Hash of the dependency is automatically combined with hash generated by this stone. There's no
|
|
44
49
|
* need to add it manually.
|