whet 0.0.3 → 0.0.4
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/haxe/Log.d.ts +33 -0
- package/bin/haxe/Log.js +61 -0
- package/bin/whet/Project.js +1 -0
- package/bin/whet/SourceHash.d.ts +1 -0
- package/bin/whet/SourceHash.js +12 -0
- package/bin/whet/Utils.d.ts +1 -0
- package/bin/whet/Utils.js +33 -0
- package/bin/whet/Whet.js +1 -0
- package/bin/whet/cache/BaseCache.js +5 -3
- package/bin/whet/cache/CacheManager.js +1 -1
- package/bin/whet/cache/FileCache.js +19 -5
- package/bin/whet/stones/Server.js +2 -0
- package/bin/whet/stones/haxe/HaxeBuild.js +64 -3
- package/bin/whet/stones/haxe/Hxml.js +19 -12
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {PosInfos} from "./PosInfos"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
Log primarily provides the `trace()` method, which is invoked upon a call to
|
|
5
|
+
`trace()` in Haxe code.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Log {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
Format the output of `trace` before printing it.
|
|
11
|
+
*/
|
|
12
|
+
static formatOutput(v: any, infos: PosInfos): string
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
Outputs `v` in a platform-dependent way.
|
|
16
|
+
|
|
17
|
+
The second parameter `infos` is injected by the compiler and contains
|
|
18
|
+
information about the position where the `trace()` call was made.
|
|
19
|
+
|
|
20
|
+
This method can be rebound to a custom function:
|
|
21
|
+
|
|
22
|
+
var oldTrace = haxe.Log.trace; // store old function
|
|
23
|
+
haxe.Log.trace = function(v, ?infos) {
|
|
24
|
+
// handle trace
|
|
25
|
+
}
|
|
26
|
+
...
|
|
27
|
+
haxe.Log.trace = oldTrace;
|
|
28
|
+
|
|
29
|
+
If it is bound to null, subsequent calls to `trace()` will cause an
|
|
30
|
+
exception.
|
|
31
|
+
*/
|
|
32
|
+
static trace(v: any, infos?: null | PosInfos): void
|
|
33
|
+
}
|
package/bin/haxe/Log.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {Register} from "../genes/Register.js"
|
|
2
|
+
import {Std} from "../Std.js"
|
|
3
|
+
|
|
4
|
+
const $global = Register.$global
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
Log primarily provides the `trace()` method, which is invoked upon a call to
|
|
8
|
+
`trace()` in Haxe code.
|
|
9
|
+
*/
|
|
10
|
+
export const Log = Register.global("$hxClasses")["haxe.Log"] =
|
|
11
|
+
class Log {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
Format the output of `trace` before printing it.
|
|
15
|
+
*/
|
|
16
|
+
static formatOutput(v, infos) {
|
|
17
|
+
var str = Std.string(v);
|
|
18
|
+
if (infos == null) {
|
|
19
|
+
return str;
|
|
20
|
+
};
|
|
21
|
+
var pstr = infos.fileName + ":" + infos.lineNumber;
|
|
22
|
+
if (infos.customParams != null) {
|
|
23
|
+
var _g = 0;
|
|
24
|
+
var _g1 = infos.customParams;
|
|
25
|
+
while (_g < _g1.length) str += ", " + Std.string(_g1[_g++]);
|
|
26
|
+
};
|
|
27
|
+
return pstr + ": " + str;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
Outputs `v` in a platform-dependent way.
|
|
32
|
+
|
|
33
|
+
The second parameter `infos` is injected by the compiler and contains
|
|
34
|
+
information about the position where the `trace()` call was made.
|
|
35
|
+
|
|
36
|
+
This method can be rebound to a custom function:
|
|
37
|
+
|
|
38
|
+
var oldTrace = haxe.Log.trace; // store old function
|
|
39
|
+
haxe.Log.trace = function(v, ?infos) {
|
|
40
|
+
// handle trace
|
|
41
|
+
}
|
|
42
|
+
...
|
|
43
|
+
haxe.Log.trace = oldTrace;
|
|
44
|
+
|
|
45
|
+
If it is bound to null, subsequent calls to `trace()` will cause an
|
|
46
|
+
exception.
|
|
47
|
+
*/
|
|
48
|
+
static trace(v, infos) {
|
|
49
|
+
var str = Log.formatOutput(v, infos);
|
|
50
|
+
if (typeof(console) != "undefined" && console.log != null) {
|
|
51
|
+
console.log(str);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
static get __name__() {
|
|
55
|
+
return "haxe.Log"
|
|
56
|
+
}
|
|
57
|
+
get __class__() {
|
|
58
|
+
return Log
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
package/bin/whet/Project.js
CHANGED
|
@@ -34,6 +34,7 @@ class Project extends Register.inherits() {
|
|
|
34
34
|
};
|
|
35
35
|
var file = new Error().stack[3].getFileName();
|
|
36
36
|
Error.prepareStackTrace = oldValue;
|
|
37
|
+
file = decodeURI(file);
|
|
37
38
|
file = StringTools.replace(file, "file:///", "");
|
|
38
39
|
var s = Path.relative(process.cwd(), file);
|
|
39
40
|
var norm = "/" + Path__1.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
|
package/bin/whet/SourceHash.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare class SourceHash {
|
|
|
5
5
|
protected bytes: Buffer
|
|
6
6
|
toString(): string
|
|
7
7
|
static EMPTY: SourceHash
|
|
8
|
+
static fromFile(path: string): Promise<SourceHash>
|
|
8
9
|
static fromBytes(data: Buffer): SourceHash
|
|
9
10
|
static fromString(data: string): SourceHash
|
|
10
11
|
static add(a: SourceHash, b: SourceHash): SourceHash
|
package/bin/whet/SourceHash.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {Register} from "../genes/Register.js"
|
|
2
|
+
import * as Fs from "fs"
|
|
2
3
|
import * as Crypto from "crypto"
|
|
3
4
|
import {Buffer} from "buffer"
|
|
4
5
|
|
|
@@ -12,6 +13,17 @@ class SourceHash extends Register.inherits() {
|
|
|
12
13
|
toString() {
|
|
13
14
|
return this.bytes.toString("hex");
|
|
14
15
|
}
|
|
16
|
+
static fromFile(path) {
|
|
17
|
+
return new Promise(function (res, rej) {
|
|
18
|
+
Fs.readFile(path, function (err, bytes) {
|
|
19
|
+
if (err != null) {
|
|
20
|
+
rej(err);
|
|
21
|
+
} else {
|
|
22
|
+
res(SourceHash.fromBytes(bytes));
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
15
27
|
static fromBytes(data) {
|
|
16
28
|
return new SourceHash(Crypto.createHash("sha256").update(data).digest());
|
|
17
29
|
}
|
package/bin/whet/Utils.d.ts
CHANGED
package/bin/whet/Utils.js
CHANGED
|
@@ -59,6 +59,39 @@ class Utils {
|
|
|
59
59
|
return new Promise(function (res, rej) {
|
|
60
60
|
Fs.rm(path, { recursive : true, force : true}, function(_) {
|
|
61
61
|
res(null);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
static listDirectoryRecursively(dir) {
|
|
66
|
+
return new Promise(function (res, rej) {
|
|
67
|
+
var result = [];
|
|
68
|
+
Fs.readdir(dir, { withFileTypes : true}, function(err,files) {
|
|
69
|
+
if(err != null) {
|
|
70
|
+
rej(err);
|
|
71
|
+
} else {
|
|
72
|
+
var otherDirs = [];
|
|
73
|
+
var _g = 0;
|
|
74
|
+
while(_g < files.length) {
|
|
75
|
+
var file = files[_g];
|
|
76
|
+
++_g;
|
|
77
|
+
var path = Path.join(dir,file.name);
|
|
78
|
+
if(file.isDirectory()) {
|
|
79
|
+
otherDirs.push(Utils.listDirectoryRecursively(path));
|
|
80
|
+
} else {
|
|
81
|
+
result.push(path);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
Promise.all(otherDirs).then(function(arr) {
|
|
85
|
+
var _g = 0;
|
|
86
|
+
while(_g < arr.length) {
|
|
87
|
+
var a = arr[_g];
|
|
88
|
+
++_g;
|
|
89
|
+
var _g1 = 0;
|
|
90
|
+
while(_g1 < a.length) result.push(a[_g1++]);
|
|
91
|
+
}
|
|
92
|
+
res(result);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
62
95
|
});
|
|
63
96
|
});
|
|
64
97
|
}
|
package/bin/whet/Whet.js
CHANGED
|
@@ -26,16 +26,16 @@ class BaseCache extends Register.inherits() {
|
|
|
26
26
|
}
|
|
27
27
|
get(stone, durability, check) {
|
|
28
28
|
var _gthis = this;
|
|
29
|
-
Log.log(20, ...["Looking for cached source.", {"stone": stone, "cache": this}]);
|
|
30
29
|
return stone.generateHash().then(function (hash) {
|
|
31
30
|
if (hash == null) {
|
|
32
|
-
Log.log(
|
|
31
|
+
Log.log(20, ...["Generating source, because it does not supply a hash.", {"stone": stone, "cache": _gthis}]);
|
|
33
32
|
};
|
|
34
33
|
if (hash == null) {
|
|
35
34
|
return stone.generateSource(null).then(function (generatedSource) {
|
|
36
35
|
return {"generatedSource": generatedSource, "hash": generatedSource.hash};
|
|
37
36
|
});
|
|
38
37
|
} else {
|
|
38
|
+
Log.log(20, ...["Stone provided hash.", {"stone": stone, "hash": SourceHash.toHex(hash)}]);
|
|
39
39
|
return Promise.resolve({"generatedSource": null, "hash": hash});
|
|
40
40
|
};
|
|
41
41
|
}).then(function (data) {
|
|
@@ -100,6 +100,7 @@ class BaseCache extends Register.inherits() {
|
|
|
100
100
|
}
|
|
101
101
|
set(source) {
|
|
102
102
|
var _gthis = this;
|
|
103
|
+
Log.log(10, ...["Setting source in cache.", {"source": source}]);
|
|
103
104
|
var k = this.key(source.origin);
|
|
104
105
|
if (!this.cache.exists(k)) {
|
|
105
106
|
this.cache.set(k, []);
|
|
@@ -141,7 +142,7 @@ class BaseCache extends Register.inherits() {
|
|
|
141
142
|
return SourceId.getPutInDir((s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm, baseDir);
|
|
142
143
|
}
|
|
143
144
|
checkDurability(stone, values, durability, useIndex, ageIndex) {
|
|
144
|
-
Log.log(
|
|
145
|
+
Log.log(20, ...["Checking durability.", {"stone": stone, "durability": Std.string(durability)}]);
|
|
145
146
|
if (values == null || values.length == 0) {
|
|
146
147
|
return;
|
|
147
148
|
};
|
|
@@ -190,6 +191,7 @@ class BaseCache extends Register.inherits() {
|
|
|
190
191
|
return true;
|
|
191
192
|
}
|
|
192
193
|
remove(stone, value) {
|
|
194
|
+
Log.log(20, ...["Removing cached value.", {"stone": stone, "valueHash": SourceHash.toHex(value.hash)}]);
|
|
193
195
|
HxOverrides.remove(this.cache.get(this.key(stone)), value);
|
|
194
196
|
return Promise.resolve(null);
|
|
195
197
|
}
|
|
@@ -21,7 +21,7 @@ class CacheManager extends Register.inherits() {
|
|
|
21
21
|
}
|
|
22
22
|
getSource(stone) {
|
|
23
23
|
var e = stone.cacheStrategy;
|
|
24
|
-
Log.log(10, ...["
|
|
24
|
+
Log.log(10, ...["Determining cache status.", {"stone": stone, "strategy": Register.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index]._hx_name}]);
|
|
25
25
|
var _g = stone.cacheStrategy;
|
|
26
26
|
switch (_g._hx_index) {
|
|
27
27
|
case 0:
|
|
@@ -99,7 +99,17 @@ class FileCache extends Register.inherits(BaseCache) {
|
|
|
99
99
|
if (_g._hx_index == 3) {
|
|
100
100
|
var _g1 = _g.path;
|
|
101
101
|
var invalidPath;
|
|
102
|
+
var invalidPath1;
|
|
102
103
|
if (value.files.length == 1) {
|
|
104
|
+
var norm = "/" + Path.normalize((_g1.charAt(0) == "/") ? HxOverrides.substr(_g1, 1, null) : _g1);
|
|
105
|
+
var invalidPath2 = (_g1.lastIndexOf("/") == _g1.length - 1) ? Path.addTrailingSlash(norm) : norm;
|
|
106
|
+
var s = Path.addTrailingSlash(Path.directory(_g1));
|
|
107
|
+
var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
|
|
108
|
+
invalidPath1 = invalidPath2 != ((s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm);
|
|
109
|
+
} else {
|
|
110
|
+
invalidPath1 = false;
|
|
111
|
+
};
|
|
112
|
+
if (invalidPath1) {
|
|
103
113
|
invalidPath = value.files[0].filePath != _g1;
|
|
104
114
|
} else {
|
|
105
115
|
var value1 = value.baseDir;
|
|
@@ -183,14 +193,14 @@ class FileCache extends Register.inherits(BaseCache) {
|
|
|
183
193
|
Log.log(20, ...["Deleting file.", {"path": (root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1}]);
|
|
184
194
|
var this1 = file[0].filePath;
|
|
185
195
|
var root = _gthis.rootDir;
|
|
186
|
-
Fs.unlink((root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1, (function () {
|
|
196
|
+
Fs.unlink((root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1, (function (file) {
|
|
187
197
|
return function (err) {
|
|
188
198
|
if (err != null) {
|
|
189
|
-
Log.log(50, ...[err]);
|
|
199
|
+
Log.log(50, ...["Error deleting file.", {"file": file[0], "error": err}]);
|
|
190
200
|
};
|
|
191
201
|
res(null);
|
|
192
202
|
};
|
|
193
|
-
})());
|
|
203
|
+
})(file));
|
|
194
204
|
};
|
|
195
205
|
})([_g2[_g1++]])));
|
|
196
206
|
return Promise.all(_g);
|
|
@@ -201,14 +211,18 @@ class FileCache extends Register.inherits(BaseCache) {
|
|
|
201
211
|
var root = _gthis.rootDir;
|
|
202
212
|
Fs.readdir((root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1, function (err, files) {
|
|
203
213
|
if (err != null) {
|
|
204
|
-
|
|
214
|
+
var this1 = value.baseDir;
|
|
215
|
+
var root = _gthis.rootDir;
|
|
216
|
+
Log.log(50, ...["Error reading directory", {"dir": (root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1, "error": err}]);
|
|
205
217
|
res(null);
|
|
206
218
|
} else if (files.length == 0) {
|
|
207
219
|
var this1 = value.baseDir;
|
|
208
220
|
var root = _gthis.rootDir;
|
|
209
221
|
Fs.rmdir((root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1, function (err) {
|
|
210
222
|
if (err != null) {
|
|
211
|
-
|
|
223
|
+
var this1 = value.baseDir;
|
|
224
|
+
var root = _gthis.rootDir;
|
|
225
|
+
Log.log(50, ...["Error removing directory.", {"dir": (root.length == 1) ? this1.substring(1) : root.substring(1, root.length - 1) + this1, "error": err}]);
|
|
212
226
|
};
|
|
213
227
|
res(null);
|
|
214
228
|
});
|
|
@@ -82,6 +82,7 @@ class Server extends Register.inherits(Stone) {
|
|
|
82
82
|
res.write(source.data, "binary");
|
|
83
83
|
res.end();
|
|
84
84
|
})["catch"](function (e) {
|
|
85
|
+
Log.log(40, ...["Server error.", {"error": e}]);
|
|
85
86
|
res.writeHead(500, "Error happened.");
|
|
86
87
|
res.write(Std.string(e), "utf-8");
|
|
87
88
|
res.end();
|
|
@@ -91,6 +92,7 @@ class Server extends Register.inherits(Stone) {
|
|
|
91
92
|
res.end();
|
|
92
93
|
};
|
|
93
94
|
})["catch"](function (e) {
|
|
95
|
+
Log.log(40, ...["Server error.", {"error": e}]);
|
|
94
96
|
res.writeHead(500, "Error happened.");
|
|
95
97
|
res.write(Std.string(e), "utf-8");
|
|
96
98
|
res.end();
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import {MaybeArray_Fields_} from "../../magic/MaybeArray.js"
|
|
1
2
|
import {Utils} from "../../Utils.js"
|
|
2
3
|
import {Stone} from "../../Stone.js"
|
|
3
4
|
import {RootDir} from "../../SourceId.js"
|
|
5
|
+
import {SourceHash} from "../../SourceHash.js"
|
|
4
6
|
import {SourceData} from "../../Source.js"
|
|
5
7
|
import {Log} from "../../Log.js"
|
|
6
8
|
import * as Path__1 from "path"
|
|
7
9
|
import {Path, Path as Path__2} from "../../../haxe/io/Path.js"
|
|
8
10
|
import {Register} from "../../../genes/Register.js"
|
|
9
11
|
import * as ChildProcess from "child_process"
|
|
12
|
+
import {StringTools} from "../../../StringTools.js"
|
|
13
|
+
import {Lambda} from "../../../Lambda.js"
|
|
10
14
|
import {HxOverrides} from "../../../HxOverrides.js"
|
|
11
15
|
|
|
12
16
|
const $global = Register.$global
|
|
@@ -35,7 +39,14 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
35
39
|
while (x.hasNext()) _g.push(x.next());
|
|
36
40
|
};
|
|
37
41
|
_g.unshift((_gthis.config.useNpx) ? "npx haxe" : "haxe");
|
|
38
|
-
|
|
42
|
+
var result = new Array(_g.length);
|
|
43
|
+
var _g1 = 0;
|
|
44
|
+
var _g2 = _g.length;
|
|
45
|
+
while (_g1 < _g2) {
|
|
46
|
+
var i = _g1++;
|
|
47
|
+
result[i] = StringTools.replace(_g[i], "\"", "\\\"");
|
|
48
|
+
};
|
|
49
|
+
ChildProcess.exec(result.join(" "), {"cwd": cwd1, "windowsHide": true}, function (err, stdout, stderr) {
|
|
39
50
|
if (err != null) {
|
|
40
51
|
rej(err);
|
|
41
52
|
} else {
|
|
@@ -59,7 +70,7 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
59
70
|
return [file];
|
|
60
71
|
});
|
|
61
72
|
})["catch"](function (err) {
|
|
62
|
-
Log.log(50, ...[err]);
|
|
73
|
+
Log.log(50, ...["Error during Haxe build.", {"error": err}]);
|
|
63
74
|
return null;
|
|
64
75
|
});
|
|
65
76
|
} else {
|
|
@@ -74,7 +85,57 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
74
85
|
};
|
|
75
86
|
}
|
|
76
87
|
generateHash() {
|
|
77
|
-
|
|
88
|
+
var hxmlHashP = this.config.hxml.generateHash();
|
|
89
|
+
var _g = [];
|
|
90
|
+
var _g1 = 0;
|
|
91
|
+
var _g2 = MaybeArray_Fields_.makeArray(this.config.hxml.config.paths);
|
|
92
|
+
while (_g1 < _g2.length) {
|
|
93
|
+
var src = _g2[_g1];
|
|
94
|
+
++_g1;
|
|
95
|
+
_g.push(Utils.listDirectoryRecursively(src));
|
|
96
|
+
};
|
|
97
|
+
var fileHashesP = Promise.all(_g).then(function (arrFiles) {
|
|
98
|
+
var result = new Array(arrFiles.length);
|
|
99
|
+
var _g = 0;
|
|
100
|
+
var _g1 = arrFiles.length;
|
|
101
|
+
while (_g < _g1) {
|
|
102
|
+
var i = _g++;
|
|
103
|
+
var files = arrFiles[i];
|
|
104
|
+
files.sort();
|
|
105
|
+
var result1 = new Array(files.length);
|
|
106
|
+
var _g2 = 0;
|
|
107
|
+
var _g3 = files.length;
|
|
108
|
+
while (_g2 < _g3) {
|
|
109
|
+
var i1 = _g2++;
|
|
110
|
+
result1[i1] = SourceHash.fromFile(files[i1]);
|
|
111
|
+
};
|
|
112
|
+
result[i] = Promise.all(result1);
|
|
113
|
+
};
|
|
114
|
+
return result;
|
|
115
|
+
}).then(function (proms) {
|
|
116
|
+
return Promise.all(proms);
|
|
117
|
+
}).then(function (allHashes) {
|
|
118
|
+
var _g = [];
|
|
119
|
+
var _g_current = 0;
|
|
120
|
+
var _g_array = allHashes;
|
|
121
|
+
while (_g_current < _g_array.length) {
|
|
122
|
+
var e = _g_array[_g_current++];
|
|
123
|
+
var x = Register.iter(e);
|
|
124
|
+
while (x.hasNext()) {
|
|
125
|
+
var x1 = x.next();
|
|
126
|
+
_g.push(x1);
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
return _g;
|
|
130
|
+
});
|
|
131
|
+
return Promise.all([hxmlHashP, fileHashesP]).then(function (r) {
|
|
132
|
+
var hxmlHash = r[0];
|
|
133
|
+
var fileHashes = r[1];
|
|
134
|
+
var r = Lambda.fold(fileHashes, function (i, r) {
|
|
135
|
+
return SourceHash.add(r, i);
|
|
136
|
+
}, hxmlHash);
|
|
137
|
+
return r;
|
|
138
|
+
});
|
|
78
139
|
}
|
|
79
140
|
static get __name__() {
|
|
80
141
|
return "whet.stones.haxe.HaxeBuild"
|
|
@@ -88,18 +88,23 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
88
88
|
};
|
|
89
89
|
var args1 = args.concat(result);
|
|
90
90
|
if (this.config.dce != null) {
|
|
91
|
+
var _g = this.config.dce;
|
|
91
92
|
var tmp;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
if (_g == null) {
|
|
94
|
+
throw new Error("Invalid DCE value.");
|
|
95
|
+
} else {
|
|
96
|
+
switch (_g._hx_index) {
|
|
97
|
+
case 0:
|
|
98
|
+
tmp = "std";
|
|
99
|
+
break
|
|
100
|
+
case 1:
|
|
101
|
+
tmp = "full";
|
|
102
|
+
break
|
|
103
|
+
case 2:
|
|
104
|
+
tmp = "no";
|
|
105
|
+
break
|
|
106
|
+
|
|
107
|
+
};
|
|
103
108
|
};
|
|
104
109
|
args1.push(["-dce", tmp]);
|
|
105
110
|
};
|
|
@@ -142,7 +147,9 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
142
147
|
if (this.isSingleFile()) {
|
|
143
148
|
var filename;
|
|
144
149
|
if (this.build.config.filename != null) {
|
|
145
|
-
|
|
150
|
+
var s = this.build.config.filename;
|
|
151
|
+
var norm = "/" + Path.normalize((s.charAt(0) == "/") ? HxOverrides.substr(s, 1, null) : s);
|
|
152
|
+
filename = (s.lastIndexOf("/") == s.length - 1) ? Path.addTrailingSlash(norm) : norm;
|
|
146
153
|
} else {
|
|
147
154
|
var norm = "/" + Path.normalize(("build".charAt(0) == "/") ? HxOverrides.substr("build", 1, null) : "build");
|
|
148
155
|
filename = ("build".lastIndexOf("/") == "build".length - 1) ? Path.addTrailingSlash(norm) : norm;
|