whet 0.0.26 → 0.0.28
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/HxOverrides.js +6 -6
- package/bin/Lambda.js +10 -10
- package/bin/Reflect.js +2 -2
- package/bin/Std.js +1 -1
- package/bin/genes/Register.d.ts +11 -1
- package/bin/genes/Register.js +69 -40
- package/bin/genes/util/EsMap.js +5 -5
- package/bin/haxe/Exception.js +1 -1
- package/bin/haxe/crypto/Crc32.js +5 -5
- package/bin/haxe/ds/List.js +1 -1
- package/bin/haxe/io/Bytes.js +8 -8
- package/bin/haxe/io/BytesBuffer.js +6 -6
- package/bin/haxe/io/Output.js +7 -7
- package/bin/haxe/zip/Compress.js +2 -2
- package/bin/haxe/zip/Tools.js +1 -1
- package/bin/haxe/zip/Writer.js +18 -18
- package/bin/js/Boot.js +25 -25
- package/bin/js/node/buffer/Buffer.js +1 -1
- package/bin/whet/Log.js +7 -7
- package/bin/whet/Project.js +6 -6
- package/bin/whet/Source.js +7 -7
- package/bin/whet/SourceHash.js +49 -55
- package/bin/whet/SourceId.js +12 -12
- package/bin/whet/Stone.js +40 -40
- package/bin/whet/Utils.js +12 -12
- package/bin/whet/Whet.js +23 -23
- package/bin/whet/cache/BaseCache.js +23 -22
- package/bin/whet/cache/CacheManager.js +13 -13
- package/bin/whet/cache/FileCache.js +97 -101
- package/bin/whet/cache/MemoryCache.js +12 -12
- package/bin/whet/magic/RoutePathType.js +15 -15
- package/bin/whet/magic/StoneId.js +2 -2
- package/bin/whet/route/RouteResult.js +1 -1
- package/bin/whet/route/Router.js +128 -132
- package/bin/whet/stones/Files.js +47 -53
- package/bin/whet/stones/JsonStone.js +16 -16
- package/bin/whet/stones/RemoteFile.js +4 -4
- package/bin/whet/stones/Server.js +17 -17
- package/bin/whet/stones/Zip.js +16 -18
- package/bin/whet/stones/haxe/HaxeBuild.d.ts +1 -0
- package/bin/whet/stones/haxe/HaxeBuild.js +26 -24
- package/bin/whet/stones/haxe/Hxml.js +72 -71
- package/package.json +1 -1
- package/bin/haxe/Log.d.ts +0 -33
- package/bin/haxe/Log.js +0 -61
- package/bin/js/lib/ArrayBuffer.d.ts +0 -4
- package/bin/js/lib/ArrayBuffer.js +0 -24
|
@@ -22,14 +22,14 @@ class RemoteFile extends Register.inherits(Stone) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
generate(hash) {
|
|
25
|
-
var _gthis = this;
|
|
26
25
|
Log.log(30, ...["Downloading file.", {"url": this.config.url}]);
|
|
26
|
+
let _gthis = this;
|
|
27
27
|
return new Promise(function (res, rej) {
|
|
28
28
|
_gthis.get(_gthis.config.url, res, rej);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
get(url, res, rej) {
|
|
32
|
-
|
|
32
|
+
let _gthis = this;
|
|
33
33
|
Https.get(url, function (response) {
|
|
34
34
|
if (response.statusCode == 301 || response.statusCode == 302) {
|
|
35
35
|
_gthis.get(response.headers["location"], res, rej);
|
|
@@ -39,12 +39,12 @@ class RemoteFile extends Register.inherits(Stone) {
|
|
|
39
39
|
response.resume();
|
|
40
40
|
throw new Error("Error downloading file. " + response.statusCode + " – " + response.statusMessage);
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
let bufs = [];
|
|
43
43
|
response.on("data", function (d) {
|
|
44
44
|
return bufs.push(d);
|
|
45
45
|
});
|
|
46
46
|
response.on("end", function () {
|
|
47
|
-
|
|
47
|
+
let data = Buffer.concat(bufs);
|
|
48
48
|
res([SourceData.fromBytes(_gthis.getId(), data)]);
|
|
49
49
|
});
|
|
50
50
|
});
|
|
@@ -30,9 +30,9 @@ class Server extends Register.inherits(Stone) {
|
|
|
30
30
|
Starts a static server hosting attached resources.
|
|
31
31
|
*/
|
|
32
32
|
serve() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
let server = Http.createServer(Register.bind(this, this.handler));
|
|
34
|
+
let nextRetry = 500;
|
|
35
|
+
let _gthis = this;
|
|
36
36
|
server.on("error", function (err) {
|
|
37
37
|
Log.log(50, ...["Failed to open a server. Retrying in " + nextRetry + "ms.", {"error": err}]);
|
|
38
38
|
global.setTimeout(function () {
|
|
@@ -52,7 +52,7 @@ class Server extends Register.inherits(Stone) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
addCommands() {
|
|
55
|
-
|
|
55
|
+
let _gthis = this;
|
|
56
56
|
this.project.addCommand("serve", this).option("-p, --port <port>", "server port", "" + this.config.port).action(function (...args) {
|
|
57
57
|
if (args[0].port != null) {
|
|
58
58
|
_gthis.config.port = Std.parseInt(args[0].port);
|
|
@@ -62,37 +62,37 @@ class Server extends Register.inherits(Stone) {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
handler(req, res) {
|
|
65
|
-
var _gthis = this;
|
|
66
65
|
Log.log(30, ...["Handling request.", {"url": req.url, "method": req.method}]);
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
let searchIndex = req.url.indexOf("?");
|
|
67
|
+
let id = decodeURI((searchIndex > 0 ? req.url.substring(0,searchIndex) : req.url));
|
|
69
68
|
if (id.charCodeAt(0) == 47) {
|
|
70
69
|
id = id.substring(1);
|
|
71
70
|
};
|
|
71
|
+
let _gthis = this;
|
|
72
72
|
switch (req.method) {
|
|
73
73
|
case "GET":
|
|
74
74
|
if (id.length == 0 || id.charCodeAt(id.length - 1) == 47) {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
let id1 = id;
|
|
76
|
+
let dir = id1.substring(0, id1.lastIndexOf("/") + 1);
|
|
77
77
|
id = Path.posix.join((dir.length == 0) ? "./" : dir, "index.html");
|
|
78
78
|
} else if (Path.posix.extname(id) == "") {
|
|
79
79
|
id = "" + id + "/index.html";
|
|
80
80
|
};
|
|
81
81
|
this.config.router.get(id).then(function (routeResult) {
|
|
82
|
-
|
|
82
|
+
let sourcePromise = (routeResult.length > 0) ? routeResult[0].get() : (_gthis.routeDynamic != null) ? _gthis.routeDynamic(id) : Promise.resolve(null);
|
|
83
83
|
return sourcePromise.then(function (source) {
|
|
84
84
|
if (source == null) {
|
|
85
85
|
res.writeHead(404, "File not found.");
|
|
86
86
|
res.end();
|
|
87
87
|
return;
|
|
88
88
|
};
|
|
89
|
-
|
|
89
|
+
let headers = {"Content-Type": Mime.getType(Path.posix.extname(id).toLowerCase()), "Last-Modified": new Date(source.source.ctime * 1000).toUTCString(), "Content-Length": Std.string(source.data.length), "Cache-Control": "no-store, no-cache"};
|
|
90
90
|
if (_gthis.config.headers != null) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
let access = _gthis.config.headers;
|
|
92
|
+
let _g_keys = Reflect__1.fields(access);
|
|
93
|
+
let _g_index = 0;
|
|
94
94
|
while (_g_index < _g_keys.length) {
|
|
95
|
-
|
|
95
|
+
let key = _g_keys[_g_index++];
|
|
96
96
|
headers[key] = access[key];
|
|
97
97
|
};
|
|
98
98
|
};
|
|
@@ -125,8 +125,8 @@ class Server extends Register.inherits(Stone) {
|
|
|
125
125
|
res.end();
|
|
126
126
|
break
|
|
127
127
|
case "PUT":
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
let cmd = [Path.posix.join(".", "./", ".", id)];
|
|
129
|
+
let body = "";
|
|
130
130
|
req.on("data", function (chunk) {
|
|
131
131
|
body += chunk;
|
|
132
132
|
return body;
|
package/bin/whet/stones/Zip.js
CHANGED
|
@@ -36,36 +36,34 @@ class ZipStone extends Register.inherits(Stone) {
|
|
|
36
36
|
Keep last used 5 for a day and last used 1 indefinitely.
|
|
37
37
|
*/
|
|
38
38
|
generateHash() {
|
|
39
|
-
|
|
39
|
+
let _gthis = this;
|
|
40
40
|
return this.config.sources.getHash().then(function (hash) {
|
|
41
41
|
return SourceHash.fromString(_gthis.config.filename + _gthis.config.level).add(hash);
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
generate(hash) {
|
|
45
|
-
var _gthis = this;
|
|
46
45
|
Log.log(30, ...["Zipping files."]);
|
|
47
|
-
|
|
46
|
+
let level = this.config.level;
|
|
47
|
+
let _gthis = this;
|
|
48
48
|
return this.config.sources.get().then(function (files) {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
let _g = [];
|
|
50
|
+
let _g1 = 0;
|
|
51
51
|
while (_g1 < files.length) {
|
|
52
|
-
|
|
52
|
+
let file = files[_g1];
|
|
53
53
|
++_g1;
|
|
54
|
-
_g.push(file
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
})(file)));
|
|
54
|
+
_g.push(file.get().then(function (data) {
|
|
55
|
+
let bytes = Helper.bytesOfBuffer(data.data);
|
|
56
|
+
let entry = {"fileName": Path.posix.join(".", "./", ".", file.serveId), "fileSize": data.data.length, "fileTime": new Date(data.source.ctime * 1000), "compressed": false, "dataSize": data.data.length, "data": bytes, "crc32": Crc32.make(bytes)};
|
|
57
|
+
Tools.compress(entry, level);
|
|
58
|
+
return entry;
|
|
59
|
+
}));
|
|
62
60
|
};
|
|
63
61
|
return Promise.all(_g).then(function (entries) {
|
|
64
|
-
|
|
62
|
+
let out = new BytesOutput();
|
|
65
63
|
new Writer(out).write(Lambda.list(entries));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
let _gthis1 = _gthis.config.filename;
|
|
65
|
+
let b = out.getBytes();
|
|
66
|
+
let data = b.b;
|
|
69
67
|
return [SourceData.fromBytes(_gthis1, Buffer.from(data.buffer, data.byteOffset, b.length))];
|
|
70
68
|
});
|
|
71
69
|
});
|
|
@@ -28,6 +28,7 @@ export type BuildConfig = {
|
|
|
28
28
|
* After stone is initialized, change `stone.cacheStrategy` directly.
|
|
29
29
|
*/
|
|
30
30
|
cacheStrategy?: null | CacheStrategy,
|
|
31
|
+
cwd?: null | string,
|
|
31
32
|
/**
|
|
32
33
|
* Registers another stone(s) as dependency of this one. Useful for external processes
|
|
33
34
|
* that use a source of some stone, but don't go via Whet to get it.
|
|
@@ -21,51 +21,53 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
21
21
|
if (this.config.cacheStrategy == null) {
|
|
22
22
|
this.config.cacheStrategy = this.project.cache.defaultFileStrategy;
|
|
23
23
|
};
|
|
24
|
+
let tmp = (this.config.cwd != null) ? this.config.cwd : Path.join(process.cwd(), Path.posix.join(".", "./", ".", this.project.rootDir));
|
|
25
|
+
this.config.cwd = tmp;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
Build the given hxml.
|
|
28
30
|
*/
|
|
29
31
|
build() {
|
|
30
|
-
|
|
31
|
-
Log.log(30, ...["Building Haxe project."]);
|
|
32
|
+
let startTime = Date.now();
|
|
33
|
+
Log.log(30, ...["Building Haxe project (id \"" + this.config.id + "\")."]);
|
|
34
|
+
let _gthis = this;
|
|
32
35
|
return new Promise(function (res, rej) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var e = Register.iter(_gthis.config.hxml.getBuildArgs());
|
|
36
|
+
let _g = [];
|
|
37
|
+
let e = Register.getIterator(_gthis.config.hxml.getBuildArgs());
|
|
36
38
|
while (e.hasNext()) {
|
|
37
|
-
|
|
39
|
+
let x = Register.getIterator(e.next());
|
|
38
40
|
while (x.hasNext()) _g.push(x.next());
|
|
39
41
|
};
|
|
40
42
|
_g.unshift((_gthis.config.useNpx) ? "npx haxe" : "haxe");
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
let result = new Array(_g.length);
|
|
44
|
+
let _g1 = 0;
|
|
45
|
+
let _g2 = _g.length;
|
|
44
46
|
while (_g1 < _g2) {
|
|
45
|
-
|
|
47
|
+
let i = _g1++;
|
|
46
48
|
result[i] = StringTools.replace(_g[i], "\"", "\\\"");
|
|
47
49
|
};
|
|
48
|
-
ChildProcess.exec(result.join(" "), {"cwd": cwd, "windowsHide": true}, function (err, stdout, stderr) {
|
|
50
|
+
ChildProcess.exec(result.join(" "), {"cwd": _gthis.config.cwd, "windowsHide": true}, function (err, stdout, stderr) {
|
|
49
51
|
if (err != null) {
|
|
50
|
-
|
|
52
|
+
let haxeError = new Error(stderr);
|
|
51
53
|
haxeError.name = "Haxe Build Error";
|
|
52
54
|
rej(haxeError);
|
|
53
55
|
} else {
|
|
54
|
-
Log.log(30, ...["Haxe build successful."]);
|
|
56
|
+
Log.log(30, ...["Haxe build successful (id \"" + _gthis.config.id + "\" in " + (Date.now() - startTime) + " ms)."]);
|
|
55
57
|
res(null);
|
|
56
58
|
};
|
|
57
59
|
});
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
generate(hash) {
|
|
61
|
-
|
|
63
|
+
let _gthis = this;
|
|
62
64
|
if (this.config.hxml.isSingleFile()) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
let pathId = this.config.hxml.getBuildExportPath();
|
|
66
|
+
let path = Path.posix.join(".", RootDir.fromProject(this.project), ".", pathId);
|
|
65
67
|
return Utils.deleteAll(path).then(function (_) {
|
|
66
68
|
return _gthis.build();
|
|
67
69
|
}).then(function (_) {
|
|
68
|
-
|
|
70
|
+
let id = pathId;
|
|
69
71
|
return SourceData.fromFile(id.substring(id.lastIndexOf("/") + 1), path, pathId).then(function (file) {
|
|
70
72
|
return [file];
|
|
71
73
|
});
|
|
@@ -75,7 +77,7 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
79
|
addCommands() {
|
|
78
|
-
|
|
80
|
+
let _gthis = this;
|
|
79
81
|
this.project.addCommand("build", this).action(function (..._) {
|
|
80
82
|
return _gthis.project.cache.refreshSource(_gthis);
|
|
81
83
|
});
|
|
@@ -88,13 +90,13 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
92
|
generateHash() {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
let _this = MaybeArray_Fields_.makeArray(this.config.hxml.config.paths);
|
|
94
|
+
let result = new Array(_this.length);
|
|
95
|
+
let _g = 0;
|
|
96
|
+
let _g1 = _this.length;
|
|
95
97
|
while (_g < _g1) {
|
|
96
|
-
|
|
97
|
-
result[i] = Path.
|
|
98
|
+
let i = _g++;
|
|
99
|
+
result[i] = Path.join(this.config.cwd, _this[i]);
|
|
98
100
|
};
|
|
99
101
|
return Promise.all([this.config.hxml.getHash(), SourceHash.fromFiles(result)]).then(function (r) {
|
|
100
102
|
return SourceHash.merge(...r);
|
|
@@ -23,16 +23,16 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
23
23
|
this.build = new HaxeBuild({"hxml": this, "id": "build", "project": this.config.project});
|
|
24
24
|
}
|
|
25
25
|
clone(id) {
|
|
26
|
-
|
|
26
|
+
let configClone = this.cloneConfig(this.config);
|
|
27
27
|
configClone.id = StoneId_Fields_.makeStoneId((id == null) ? this.id : id);
|
|
28
28
|
return new Hxml(configClone);
|
|
29
29
|
}
|
|
30
30
|
mergeConfig(additionalConfig) {
|
|
31
|
-
|
|
31
|
+
let merge = function (from, to) {
|
|
32
32
|
if (from != null) {
|
|
33
|
-
|
|
33
|
+
let _g = 0;
|
|
34
34
|
while (_g < from.length) {
|
|
35
|
-
|
|
35
|
+
let item = from[_g];
|
|
36
36
|
++_g;
|
|
37
37
|
if (to.indexOf(item) == -1) {
|
|
38
38
|
to.push(item);
|
|
@@ -59,35 +59,35 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
59
59
|
return this.getBaseArgs().concat([this.getPlatform()]);
|
|
60
60
|
}
|
|
61
61
|
getBaseArgs() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
let _this = MaybeArray_Fields_.makeArray(this.config.libs);
|
|
63
|
+
let result = new Array(_this.length);
|
|
64
|
+
let _g = 0;
|
|
65
|
+
let _g1 = _this.length;
|
|
66
66
|
while (_g < _g1) {
|
|
67
|
-
|
|
67
|
+
let i = _g++;
|
|
68
68
|
result[i] = ["-lib", _this[i]];
|
|
69
69
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
while (
|
|
75
|
-
|
|
76
|
-
result1[i] = ["-cp",
|
|
70
|
+
let _this1 = MaybeArray_Fields_.makeArray(this.config.paths);
|
|
71
|
+
let result1 = new Array(_this1.length);
|
|
72
|
+
let _g2 = 0;
|
|
73
|
+
let _g3 = _this1.length;
|
|
74
|
+
while (_g2 < _g3) {
|
|
75
|
+
let i = _g2++;
|
|
76
|
+
result1[i] = ["-cp", _this1[i]];
|
|
77
77
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
while (
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
let args = result.concat(result1);
|
|
79
|
+
let _this2 = MaybeArray_Fields_.makeArray(this.config.defines);
|
|
80
|
+
let result2 = new Array(_this2.length);
|
|
81
|
+
let _g4 = 0;
|
|
82
|
+
let _g5 = _this2.length;
|
|
83
|
+
while (_g4 < _g5) {
|
|
84
|
+
let i = _g4++;
|
|
85
|
+
result2[i] = ["-D", _this2[i]];
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
let args1 = args.concat(result2);
|
|
88
88
|
if (this.config.dce != null) {
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
let _g = this.config.dce;
|
|
90
|
+
let tmp;
|
|
91
91
|
if (_g == null) {
|
|
92
92
|
throw new Error("Invalid DCE value.");
|
|
93
93
|
} else {
|
|
@@ -112,31 +112,31 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
112
112
|
if (this.config.debug == true) {
|
|
113
113
|
args1.push(["-debug"]);
|
|
114
114
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
while (
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
let _this3 = MaybeArray_Fields_.makeArray(this.config.flags);
|
|
116
|
+
let result3 = new Array(_this3.length);
|
|
117
|
+
let _g6 = 0;
|
|
118
|
+
let _g7 = _this3.length;
|
|
119
|
+
while (_g6 < _g7) {
|
|
120
|
+
let i = _g6++;
|
|
121
|
+
result3[i] = MaybeArray_Fields_.makeArray(_this3[i]);
|
|
122
122
|
};
|
|
123
|
-
return args1.concat(
|
|
123
|
+
return args1.concat(result3);
|
|
124
124
|
}
|
|
125
125
|
getFileContent() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
let _this = this.getBuildArgs();
|
|
127
|
+
let result = new Array(_this.length);
|
|
128
|
+
let _g = 0;
|
|
129
|
+
let _g1 = _this.length;
|
|
130
130
|
while (_g < _g1) {
|
|
131
|
-
|
|
131
|
+
let i = _g++;
|
|
132
132
|
result[i] = _this[i].join(" ");
|
|
133
133
|
};
|
|
134
134
|
return "# Generated from Whet library. Do not edit manually.\n" + result.join("\n");
|
|
135
135
|
}
|
|
136
136
|
getBuildExportPath() {
|
|
137
|
-
|
|
137
|
+
let dir = this.project.cache.getDir(this.build, this.generateHashSync());
|
|
138
138
|
if (this.isSingleFile()) {
|
|
139
|
-
|
|
139
|
+
let id = this.getBuildFilename();
|
|
140
140
|
if (!(dir.length == 0 || dir.charCodeAt(dir.length - 1) == 47)) {
|
|
141
141
|
throw new Error("\"" + dir + "\" is not a directory.");
|
|
142
142
|
};
|
|
@@ -147,14 +147,14 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
147
147
|
}
|
|
148
148
|
getBuildFilename() {
|
|
149
149
|
if (this.isSingleFile()) {
|
|
150
|
-
|
|
150
|
+
let filename = (this.build.config.filename != null) ? this.build.config.filename : "build";
|
|
151
151
|
if (Path.posix.extname(filename) == "") {
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
let id = filename;
|
|
153
|
+
let ext = this.getBuildExtension();
|
|
154
154
|
if (ext.length > 0 && ext.charCodeAt(0) != 46) {
|
|
155
155
|
ext = "." + ext;
|
|
156
156
|
};
|
|
157
|
-
|
|
157
|
+
let dir = id.substring(0, id.lastIndexOf("/") + 1);
|
|
158
158
|
filename = Path.posix.join((dir.length == 0) ? "./" : dir, Path.posix.parse(id).name) + ext;
|
|
159
159
|
};
|
|
160
160
|
return filename;
|
|
@@ -163,9 +163,10 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
getPlatform() {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
let path = this.getBuildExportPath();
|
|
167
|
+
path = Path.resolve(this.build.project.rootDir, path);
|
|
168
|
+
path = Path.relative(this.build.config.cwd, path);
|
|
169
|
+
let _g = this.config.platform;
|
|
169
170
|
if (_g == null) {
|
|
170
171
|
return [];
|
|
171
172
|
} else {
|
|
@@ -208,7 +209,7 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
208
209
|
};
|
|
209
210
|
}
|
|
210
211
|
isSingleFile() {
|
|
211
|
-
|
|
212
|
+
let _g = this.config.platform;
|
|
212
213
|
if (_g == null) {
|
|
213
214
|
return false;
|
|
214
215
|
} else {
|
|
@@ -223,7 +224,7 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
223
224
|
};
|
|
224
225
|
}
|
|
225
226
|
getBuildExtension() {
|
|
226
|
-
|
|
227
|
+
let _g = this.config.platform;
|
|
227
228
|
if (_g == null) {
|
|
228
229
|
return "";
|
|
229
230
|
} else {
|
|
@@ -263,14 +264,14 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
263
264
|
return Promise.resolve([this.filename()]);
|
|
264
265
|
}
|
|
265
266
|
filename() {
|
|
266
|
-
|
|
267
|
+
let fn = this.id;
|
|
267
268
|
if (Path.posix.extname(fn) == "") {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (
|
|
269
|
+
let id = fn;
|
|
270
|
+
let ext = "hxml";
|
|
271
|
+
if (ext.length > 0 && ext.charCodeAt(0) != 46) {
|
|
271
272
|
ext = "." + ext;
|
|
272
273
|
};
|
|
273
|
-
|
|
274
|
+
let dir = id.substring(0, id.lastIndexOf("/") + 1);
|
|
274
275
|
fn = Path.posix.join((dir.length == 0) ? "./" : dir, Path.posix.parse(id).name) + ext;
|
|
275
276
|
};
|
|
276
277
|
return fn;
|
|
@@ -279,27 +280,27 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
279
280
|
return Promise.resolve(this.generateHashSync());
|
|
280
281
|
}
|
|
281
282
|
generateHashSync() {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
let _this = this.getBaseArgs();
|
|
284
|
+
let result = new Array(_this.length);
|
|
285
|
+
let _g = 0;
|
|
286
|
+
let _g1 = _this.length;
|
|
286
287
|
while (_g < _g1) {
|
|
287
|
-
|
|
288
|
+
let i = _g++;
|
|
288
289
|
result[i] = _this[i].join(" ");
|
|
289
290
|
};
|
|
290
291
|
return SourceHash.fromString(result.join("\n"));
|
|
291
292
|
}
|
|
292
293
|
cloneConfig(config) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
294
|
+
let config1 = config.project;
|
|
295
|
+
let tmp = MaybeArray_Fields_.makeArray(config.libs).slice();
|
|
296
|
+
let tmp1 = MaybeArray_Fields_.makeArray(config.paths).slice();
|
|
297
|
+
let tmp2 = MaybeArray_Fields_.makeArray(config.defines).slice();
|
|
298
|
+
let config2 = config.dce;
|
|
299
|
+
let config3 = config.main;
|
|
300
|
+
let config4 = config.debug;
|
|
301
|
+
let _g = [];
|
|
302
|
+
let _g1 = 0;
|
|
303
|
+
let _g2 = MaybeArray_Fields_.makeArray(config.flags);
|
|
303
304
|
while (_g1 < _g2.length) _g.push(MaybeArray_Fields_.makeArray(_g2[_g1++]).slice());
|
|
304
305
|
return {"project": config1, "libs": tmp, "paths": tmp1, "defines": tmp2, "dce": config2, "main": config3, "debug": config4, "flags": _g, "platform": config.platform};
|
|
305
306
|
}
|
package/package.json
CHANGED
package/bin/haxe/Log.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {Register} from "../../genes/Register.js"
|
|
2
|
-
|
|
3
|
-
const $global = Register.$global
|
|
4
|
-
|
|
5
|
-
export const ArrayBufferCompat = Register.global("$hxClasses")["js.lib._ArrayBuffer.ArrayBufferCompat"] =
|
|
6
|
-
class ArrayBufferCompat {
|
|
7
|
-
static sliceImpl(begin, end) {
|
|
8
|
-
var u = new Uint8Array(this, begin, (end == null) ? null : end - begin);
|
|
9
|
-
var resultArray = new Uint8Array(u.byteLength);
|
|
10
|
-
resultArray.set(u);
|
|
11
|
-
return resultArray.buffer;
|
|
12
|
-
}
|
|
13
|
-
static get __name__() {
|
|
14
|
-
return "js.lib._ArrayBuffer.ArrayBufferCompat"
|
|
15
|
-
}
|
|
16
|
-
get __class__() {
|
|
17
|
-
return ArrayBufferCompat
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
;if (ArrayBuffer.prototype.slice == null) {
|
|
23
|
-
ArrayBuffer.prototype.slice = ArrayBufferCompat.sliceImpl;
|
|
24
|
-
}
|