whet 0.0.19 → 0.0.21
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/README.md +9 -6
- package/bin/HxOverrides.d.ts +0 -1
- package/bin/HxOverrides.js +0 -7
- package/bin/whet/Project.js +4 -25
- package/bin/whet/Source.d.ts +3 -2
- package/bin/whet/Source.js +14 -37
- package/bin/whet/SourceId.d.ts +17 -5
- package/bin/whet/SourceId.js +93 -68
- package/bin/whet/Stone.js +14 -26
- package/bin/whet/Whet.js +1 -1
- package/bin/whet/cache/BaseCache.js +6 -23
- package/bin/whet/cache/CacheManager.js +10 -33
- package/bin/whet/cache/FileCache.js +17 -143
- package/bin/whet/magic/MinimatchType.js +1 -11
- package/bin/whet/magic/RoutePathType.js +8 -45
- package/bin/whet/route/Router.d.ts +15 -5
- package/bin/whet/route/Router.js +166 -227
- package/bin/whet/stones/Files.d.ts +6 -0
- package/bin/whet/stones/Files.js +95 -52
- package/bin/whet/stones/JsonStone.d.ts +2 -2
- package/bin/whet/stones/JsonStone.js +6 -13
- package/bin/whet/stones/RemoteFile.js +1 -10
- package/bin/whet/stones/Server.js +9 -33
- package/bin/whet/stones/Zip.d.ts +2 -2
- package/bin/whet/stones/Zip.js +4 -26
- package/bin/whet/stones/haxe/HaxeBuild.js +6 -35
- package/bin/whet/stones/haxe/Hxml.js +21 -67
- package/bin/whet.d.ts +1 -0
- package/bin/whet.js +1 -0
- package/package.json +1 -1
|
@@ -2,11 +2,8 @@ import {Router} from "../route/Router.js"
|
|
|
2
2
|
import {Stone} from "../Stone.js"
|
|
3
3
|
import {SourceHash} from "../SourceHash.js"
|
|
4
4
|
import {SourceData} from "../Source.js"
|
|
5
|
-
import * as Path from "path"
|
|
6
5
|
import {Register} from "../../genes/Register.js"
|
|
7
|
-
import {StringTools} from "../../StringTools.js"
|
|
8
6
|
import {Reflect as Reflect__1} from "../../Reflect.js"
|
|
9
|
-
import {HxOverrides} from "../../HxOverrides.js"
|
|
10
7
|
|
|
11
8
|
const $global = Register.$global
|
|
12
9
|
|
|
@@ -32,7 +29,7 @@ class JsonStone extends Register.inherits(Stone) {
|
|
|
32
29
|
var key = _g_keys[_g_index++];
|
|
33
30
|
obj[key] = access[key];
|
|
34
31
|
};
|
|
35
|
-
return
|
|
32
|
+
return this.config.mergeFiles.get().then(function (list) {
|
|
36
33
|
var result = new Array(list.length);
|
|
37
34
|
var _g = 0;
|
|
38
35
|
var _g1 = list.length;
|
|
@@ -57,24 +54,20 @@ class JsonStone extends Register.inherits(Stone) {
|
|
|
57
54
|
}
|
|
58
55
|
generateHash() {
|
|
59
56
|
var _gthis = this;
|
|
60
|
-
return
|
|
57
|
+
return this.config.mergeFiles.getHash().then(function (hash) {
|
|
61
58
|
return hash.add(SourceHash.fromString(JSON.stringify(_gthis.data)));
|
|
62
59
|
});
|
|
63
60
|
}
|
|
64
61
|
list() {
|
|
65
|
-
|
|
66
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
67
|
-
if (str.length > 0) {
|
|
68
|
-
str = Path.posix.normalize(str);
|
|
69
|
-
str = StringTools.replace(str, "\\", "/");
|
|
70
|
-
};
|
|
71
|
-
s = str;
|
|
72
|
-
return Promise.resolve([(HxOverrides.cca(s, 0) == 47) ? s : "/" + s]);
|
|
62
|
+
return Promise.resolve([this.config.name]);
|
|
73
63
|
}
|
|
74
64
|
initConfig() {
|
|
75
65
|
if (this.config.name == null) {
|
|
76
66
|
this.config.name = "data.json";
|
|
77
67
|
};
|
|
68
|
+
if (this.config.mergeFiles == null) {
|
|
69
|
+
this.config.mergeFiles = new Router();
|
|
70
|
+
};
|
|
78
71
|
super.initConfig();
|
|
79
72
|
}
|
|
80
73
|
static get __name__() {
|
|
@@ -8,8 +8,6 @@ import * as Path from "path"
|
|
|
8
8
|
import * as Https from "https"
|
|
9
9
|
import {Register} from "../../genes/Register.js"
|
|
10
10
|
import {Buffer} from "buffer"
|
|
11
|
-
import {StringTools} from "../../StringTools.js"
|
|
12
|
-
import {HxOverrides} from "../../HxOverrides.js"
|
|
13
11
|
|
|
14
12
|
const $global = Register.$global
|
|
15
13
|
|
|
@@ -50,14 +48,7 @@ class RemoteFile extends Register.inherits(Stone) {
|
|
|
50
48
|
return Promise.resolve(SourceHash.fromString(this.config.url));
|
|
51
49
|
}
|
|
52
50
|
getId() {
|
|
53
|
-
|
|
54
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
55
|
-
if (str.length > 0) {
|
|
56
|
-
str = Path.posix.normalize(str);
|
|
57
|
-
str = StringTools.replace(str, "\\", "/");
|
|
58
|
-
};
|
|
59
|
-
s = str;
|
|
60
|
-
return (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
51
|
+
return Path.basename(new URL(this.config.url).pathname);
|
|
61
52
|
}
|
|
62
53
|
static get __name__() {
|
|
63
54
|
return "whet.stones.RemoteFile"
|
|
@@ -5,10 +5,8 @@ import * as Path from "path"
|
|
|
5
5
|
import Mime from "mime"
|
|
6
6
|
import * as Http from "http"
|
|
7
7
|
import {Register} from "../../genes/Register.js"
|
|
8
|
-
import {StringTools} from "../../StringTools.js"
|
|
9
8
|
import {Std} from "../../Std.js"
|
|
10
9
|
import {Reflect as Reflect__1} from "../../Reflect.js"
|
|
11
|
-
import {HxOverrides} from "../../HxOverrides.js"
|
|
12
10
|
|
|
13
11
|
const $global = Register.$global
|
|
14
12
|
|
|
@@ -58,28 +56,17 @@ class Server extends Register.inherits(Stone) {
|
|
|
58
56
|
Log.log(30, ...["Handling request.", {"url": req.url, "method": req.method}]);
|
|
59
57
|
var searchIndex = req.url.indexOf("?");
|
|
60
58
|
var id = decodeURI((searchIndex > 0 ? req.url.substring(0,searchIndex) : req.url));
|
|
59
|
+
if (id.charCodeAt(0) == 47) {
|
|
60
|
+
id = id.substring(1);
|
|
61
|
+
};
|
|
61
62
|
switch (req.method) {
|
|
62
63
|
case "GET":
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (str.length > 0) {
|
|
68
|
-
str = Path.posix.normalize(str);
|
|
69
|
-
str = StringTools.replace(str, "\\", "/");
|
|
70
|
-
};
|
|
71
|
-
s = str;
|
|
72
|
-
id = ((HxOverrides.cca(s, 0) == 47) ? s : "/" + s) + "index.html";
|
|
73
|
-
};
|
|
64
|
+
if (id.length == 0 || id.charCodeAt(id.length - 1) == 47) {
|
|
65
|
+
var id1 = id;
|
|
66
|
+
var dir = id1.substring(0, id1.lastIndexOf("/") + 1);
|
|
67
|
+
id = Path.posix.join((dir.length == 0) ? "./" : dir, "index.html");
|
|
74
68
|
} else if (Path.posix.extname(id) == "") {
|
|
75
|
-
|
|
76
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
77
|
-
if (str.length > 0) {
|
|
78
|
-
str = Path.posix.normalize(str);
|
|
79
|
-
str = StringTools.replace(str, "\\", "/");
|
|
80
|
-
};
|
|
81
|
-
s = str;
|
|
82
|
-
id = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
69
|
+
id = "" + id + "/index.html";
|
|
83
70
|
};
|
|
84
71
|
this.config.router.get(id).then(function (routeResult) {
|
|
85
72
|
return ((routeResult.length > 0) ? routeResult[0].get() : (_gthis.routeDynamic != null) ? _gthis.routeDynamic(id) : Promise.resolve(null)).then(function (source) {
|
|
@@ -127,18 +114,7 @@ class Server extends Register.inherits(Stone) {
|
|
|
127
114
|
res.end();
|
|
128
115
|
break
|
|
129
116
|
case "PUT":
|
|
130
|
-
var
|
|
131
|
-
var str = ("/".length > 1 && HxOverrides.cca("/", 0) == 47) ? "/".substring(1) : "/";
|
|
132
|
-
if (str.length > 0) {
|
|
133
|
-
str = Path.posix.normalize(str);
|
|
134
|
-
str = StringTools.replace(str, "\\", "/");
|
|
135
|
-
};
|
|
136
|
-
s = str;
|
|
137
|
-
var root = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
138
|
-
if (id.charAt(0) != "/") {
|
|
139
|
-
throw new Error("Badly formed SourceId.");
|
|
140
|
-
};
|
|
141
|
-
var cmd = [Path.posix.join(".", root, ".", id)];
|
|
117
|
+
var cmd = [Path.posix.join(".", "./", ".", id)];
|
|
142
118
|
var body = "";
|
|
143
119
|
req.on("data", function (chunk) {
|
|
144
120
|
body += chunk;
|
package/bin/whet/stones/Zip.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import {Router} from "../route/Router"
|
|
1
2
|
import {StoneIdType} from "../magic/StoneId"
|
|
2
|
-
import {RoutePathType} from "../magic/RoutePathType"
|
|
3
3
|
import {MaybeArray} from "../magic/MaybeArray"
|
|
4
4
|
import {CacheStrategy} from "../cache/Cache"
|
|
5
5
|
import {Stone, AnyStone} from "../Stone"
|
|
@@ -43,5 +43,5 @@ export type ZipConfig = {
|
|
|
43
43
|
Defaults to the last instanced project.
|
|
44
44
|
*/
|
|
45
45
|
project?: null | Project,
|
|
46
|
-
sources:
|
|
46
|
+
sources: Router
|
|
47
47
|
}
|
package/bin/whet/stones/Zip.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {Router} from "../route/Router.js"
|
|
2
1
|
import {CacheStrategy, CacheDurability, DurabilityCheck} from "../cache/Cache.js"
|
|
3
2
|
import {Stone} from "../Stone.js"
|
|
4
3
|
import {SourceHash} from "../SourceHash.js"
|
|
@@ -12,9 +11,7 @@ import {BytesOutput} from "../../haxe/io/BytesOutput.js"
|
|
|
12
11
|
import {Crc32} from "../../haxe/crypto/Crc32.js"
|
|
13
12
|
import {Register} from "../../genes/Register.js"
|
|
14
13
|
import {Buffer} from "buffer"
|
|
15
|
-
import {StringTools} from "../../StringTools.js"
|
|
16
14
|
import {Lambda} from "../../Lambda.js"
|
|
17
|
-
import {HxOverrides} from "../../HxOverrides.js"
|
|
18
15
|
|
|
19
16
|
const $global = Register.$global
|
|
20
17
|
|
|
@@ -36,7 +33,7 @@ class ZipStone extends Register.inherits(Stone) {
|
|
|
36
33
|
}
|
|
37
34
|
generateHash() {
|
|
38
35
|
var _gthis = this;
|
|
39
|
-
return
|
|
36
|
+
return this.config.sources.getHash().then(function (hash) {
|
|
40
37
|
return SourceHash.fromString(_gthis.config.filename + _gthis.config.level).add(hash);
|
|
41
38
|
});
|
|
42
39
|
}
|
|
@@ -44,7 +41,7 @@ class ZipStone extends Register.inherits(Stone) {
|
|
|
44
41
|
var _gthis = this;
|
|
45
42
|
Log.log(30, ...["Zipping files."]);
|
|
46
43
|
var level = this.config.level;
|
|
47
|
-
return
|
|
44
|
+
return this.config.sources.get().then(function (files) {
|
|
48
45
|
var _g = [];
|
|
49
46
|
var _g1 = 0;
|
|
50
47
|
while (_g1 < files.length) {
|
|
@@ -53,19 +50,7 @@ class ZipStone extends Register.inherits(Stone) {
|
|
|
53
50
|
_g.push(file[0].get().then((function (file) {
|
|
54
51
|
return function (data) {
|
|
55
52
|
var bytes = Helper.bytesOfBuffer(data.data);
|
|
56
|
-
var
|
|
57
|
-
var s = "/";
|
|
58
|
-
var str = ("/".length > 1 && HxOverrides.cca("/", 0) == 47) ? "/".substring(1) : "/";
|
|
59
|
-
if (str.length > 0) {
|
|
60
|
-
str = Path.posix.normalize(str);
|
|
61
|
-
str = StringTools.replace(str, "\\", "/");
|
|
62
|
-
};
|
|
63
|
-
s = str;
|
|
64
|
-
var root = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
65
|
-
if (this1.charAt(0) != "/") {
|
|
66
|
-
throw new Error("Badly formed SourceId.");
|
|
67
|
-
};
|
|
68
|
-
var entry = {"fileName": Path.posix.join(".", root, ".", this1), "fileSize": data.data.length, "fileTime": new Date(data.source.ctime * 1000), "compressed": false, "dataSize": data.data.length, "data": bytes, "crc32": Crc32.make(bytes)};
|
|
53
|
+
var entry = {"fileName": Path.posix.join(".", "./", ".", file[0].serveId), "fileSize": data.data.length, "fileTime": new Date(data.source.ctime * 1000), "compressed": false, "dataSize": data.data.length, "data": bytes, "crc32": Crc32.make(bytes)};
|
|
69
54
|
Tools.compress(entry, level);
|
|
70
55
|
return entry;
|
|
71
56
|
};
|
|
@@ -82,14 +67,7 @@ class ZipStone extends Register.inherits(Stone) {
|
|
|
82
67
|
});
|
|
83
68
|
}
|
|
84
69
|
list() {
|
|
85
|
-
|
|
86
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
87
|
-
if (str.length > 0) {
|
|
88
|
-
str = Path.posix.normalize(str);
|
|
89
|
-
str = StringTools.replace(str, "\\", "/");
|
|
90
|
-
};
|
|
91
|
-
s = str;
|
|
92
|
-
return Promise.resolve([(HxOverrides.cca(s, 0) == 47) ? s : "/" + s]);
|
|
70
|
+
return Promise.resolve([this.config.filename]);
|
|
93
71
|
}
|
|
94
72
|
static get __name__() {
|
|
95
73
|
return "whet.stones.ZipStone"
|
|
@@ -9,7 +9,6 @@ import * as Path from "path"
|
|
|
9
9
|
import {Register} from "../../../genes/Register.js"
|
|
10
10
|
import * as ChildProcess from "child_process"
|
|
11
11
|
import {StringTools} from "../../../StringTools.js"
|
|
12
|
-
import {HxOverrides} from "../../../HxOverrides.js"
|
|
13
12
|
|
|
14
13
|
const $global = Register.$global
|
|
15
14
|
|
|
@@ -31,20 +30,7 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
31
30
|
var _gthis = this;
|
|
32
31
|
Log.log(30, ...["Building Haxe project."]);
|
|
33
32
|
return new Promise(function (res, rej) {
|
|
34
|
-
var cwd = process.cwd();
|
|
35
|
-
var this1 = _gthis.project.rootDir;
|
|
36
|
-
var s = "/";
|
|
37
|
-
var str = ("/".length > 1 && HxOverrides.cca("/", 0) == 47) ? "/".substring(1) : "/";
|
|
38
|
-
if (str.length > 0) {
|
|
39
|
-
str = Path.posix.normalize(str);
|
|
40
|
-
str = StringTools.replace(str, "\\", "/");
|
|
41
|
-
};
|
|
42
|
-
s = str;
|
|
43
|
-
var root = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
44
|
-
if (this1.charAt(0) != "/") {
|
|
45
|
-
throw new Error("Badly formed SourceId.");
|
|
46
|
-
};
|
|
47
|
-
var cwd1 = Path.join(cwd, Path.posix.join(".", root, ".", this1));
|
|
33
|
+
var cwd = Path.join(process.cwd(), Path.posix.join(".", "./", ".", _gthis.project.rootDir));
|
|
48
34
|
var _g = [];
|
|
49
35
|
var e = Register.iter(_gthis.config.hxml.getBuildArgs());
|
|
50
36
|
while (e.hasNext()) {
|
|
@@ -59,7 +45,7 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
59
45
|
var i = _g1++;
|
|
60
46
|
result[i] = StringTools.replace(_g[i], "\"", "\\\"");
|
|
61
47
|
};
|
|
62
|
-
ChildProcess.exec(result.join(" "), {"cwd":
|
|
48
|
+
ChildProcess.exec(result.join(" "), {"cwd": cwd, "windowsHide": true}, function (err, stdout, stderr) {
|
|
63
49
|
if (err != null) {
|
|
64
50
|
var haxeError = new Error(stderr);
|
|
65
51
|
haxeError.name = "Haxe Build Error";
|
|
@@ -75,15 +61,12 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
75
61
|
var _gthis = this;
|
|
76
62
|
if (this.config.hxml.isSingleFile()) {
|
|
77
63
|
var pathId = this.config.hxml.getBuildExportPath();
|
|
78
|
-
var
|
|
79
|
-
if (pathId.charAt(0) != "/") {
|
|
80
|
-
throw new Error("Badly formed SourceId.");
|
|
81
|
-
};
|
|
82
|
-
var path = Path.posix.join(".", root, ".", pathId);
|
|
64
|
+
var path = Path.posix.join(".", RootDir.fromProject(this.project), ".", pathId);
|
|
83
65
|
return Utils.deleteAll(path).then(function (_) {
|
|
84
66
|
return _gthis.build();
|
|
85
67
|
}).then(function (_) {
|
|
86
|
-
|
|
68
|
+
var id = pathId;
|
|
69
|
+
return SourceData.fromFile(id.substring(id.lastIndexOf("/") + 1), path, pathId).then(function (file) {
|
|
87
70
|
return [file];
|
|
88
71
|
});
|
|
89
72
|
});
|
|
@@ -111,19 +94,7 @@ class HaxeBuild extends Register.inherits(Stone) {
|
|
|
111
94
|
var _g1 = _this.length;
|
|
112
95
|
while (_g < _g1) {
|
|
113
96
|
var i = _g++;
|
|
114
|
-
|
|
115
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
116
|
-
if (str.length > 0) {
|
|
117
|
-
str = Path.posix.normalize(str);
|
|
118
|
-
str = StringTools.replace(str, "\\", "/");
|
|
119
|
-
};
|
|
120
|
-
s = str;
|
|
121
|
-
var this1 = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
122
|
-
var root = RootDir.fromProject(this.config.hxml.project);
|
|
123
|
-
if (this1.charAt(0) != "/") {
|
|
124
|
-
throw new Error("Badly formed SourceId.");
|
|
125
|
-
};
|
|
126
|
-
result[i] = Path.posix.join(".", root, ".", this1);
|
|
97
|
+
result[i] = Path.posix.join(".", RootDir.fromProject(this.config.hxml.project), ".", _this[i]);
|
|
127
98
|
};
|
|
128
99
|
return Promise.all([this.config.hxml.getHash(), SourceHash.fromFiles(result)]).then(function (r) {
|
|
129
100
|
return SourceHash.merge(...r);
|
|
@@ -3,14 +3,11 @@ import {StoneId_Fields_} from "../../magic/StoneId.js"
|
|
|
3
3
|
import {MaybeArray_Fields_} from "../../magic/MaybeArray.js"
|
|
4
4
|
import {CacheStrategy, CacheDurability} from "../../cache/Cache.js"
|
|
5
5
|
import {Stone} from "../../Stone.js"
|
|
6
|
-
import {SourceId} from "../../SourceId.js"
|
|
7
6
|
import {SourceHash} from "../../SourceHash.js"
|
|
8
7
|
import {SourceData} from "../../Source.js"
|
|
9
8
|
import {Log} from "../../Log.js"
|
|
10
9
|
import * as Path from "path"
|
|
11
10
|
import {Register} from "../../../genes/Register.js"
|
|
12
|
-
import {StringTools} from "../../../StringTools.js"
|
|
13
|
-
import {HxOverrides} from "../../../HxOverrides.js"
|
|
14
11
|
|
|
15
12
|
const $global = Register.$global
|
|
16
13
|
|
|
@@ -139,46 +136,26 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
139
136
|
getBuildExportPath() {
|
|
140
137
|
var dir = this.project.cache.getDir(this.build, this.generateHashSync());
|
|
141
138
|
if (this.isSingleFile()) {
|
|
142
|
-
|
|
139
|
+
var id = this.getBuildFilename();
|
|
140
|
+
if (!(dir.length == 0 || dir.charCodeAt(dir.length - 1) == 47)) {
|
|
141
|
+
throw new Error("\"" + dir + "\" is not a directory.");
|
|
142
|
+
};
|
|
143
|
+
return Path.posix.join(dir, id);
|
|
143
144
|
} else {
|
|
144
145
|
return dir;
|
|
145
146
|
};
|
|
146
147
|
}
|
|
147
148
|
getBuildFilename() {
|
|
148
149
|
if (this.isSingleFile()) {
|
|
149
|
-
var filename;
|
|
150
|
-
if (this.build.config.filename != null) {
|
|
151
|
-
var s = this.build.config.filename;
|
|
152
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
153
|
-
if (str.length > 0) {
|
|
154
|
-
str = Path.posix.normalize(str);
|
|
155
|
-
str = StringTools.replace(str, "\\", "/");
|
|
156
|
-
};
|
|
157
|
-
s = str;
|
|
158
|
-
filename = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
159
|
-
} else {
|
|
160
|
-
var s = "build";
|
|
161
|
-
var str = ("build".length > 1 && HxOverrides.cca("build", 0) == 47) ? "build".substring(1) : "build";
|
|
162
|
-
if (str.length > 0) {
|
|
163
|
-
str = Path.posix.normalize(str);
|
|
164
|
-
str = StringTools.replace(str, "\\", "/");
|
|
165
|
-
};
|
|
166
|
-
s = str;
|
|
167
|
-
filename = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
168
|
-
};
|
|
150
|
+
var filename = (this.build.config.filename != null) ? this.build.config.filename : "build";
|
|
169
151
|
if (Path.posix.extname(filename) == "") {
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
|
|
152
|
+
var id = filename;
|
|
153
|
+
var ext = this.getBuildExtension();
|
|
154
|
+
if (ext.length > 0 && ext.charCodeAt(0) != 46) {
|
|
155
|
+
ext = "." + ext;
|
|
173
156
|
};
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
if (str.length > 0) {
|
|
177
|
-
str = Path.posix.normalize(str);
|
|
178
|
-
str = StringTools.replace(str, "\\", "/");
|
|
179
|
-
};
|
|
180
|
-
s = str;
|
|
181
|
-
filename = ((HxOverrides.cca(s, 0) == 47) ? s : "/" + s) + Path.posix.parse(filename.substring(filename.lastIndexOf("/"))).name + v;
|
|
157
|
+
var dir = id.substring(0, id.lastIndexOf("/") + 1);
|
|
158
|
+
filename = Path.posix.join((dir.length == 0) ? "./" : dir, Path.posix.parse(id).name) + ext;
|
|
182
159
|
};
|
|
183
160
|
return filename;
|
|
184
161
|
} else {
|
|
@@ -186,19 +163,8 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
186
163
|
};
|
|
187
164
|
}
|
|
188
165
|
getPlatform() {
|
|
189
|
-
var
|
|
190
|
-
var
|
|
191
|
-
var str = ("/".length > 1 && HxOverrides.cca("/", 0) == 47) ? "/".substring(1) : "/";
|
|
192
|
-
if (str.length > 0) {
|
|
193
|
-
str = Path.posix.normalize(str);
|
|
194
|
-
str = StringTools.replace(str, "\\", "/");
|
|
195
|
-
};
|
|
196
|
-
s = str;
|
|
197
|
-
var root = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
198
|
-
if (this1.charAt(0) != "/") {
|
|
199
|
-
throw new Error("Badly formed SourceId.");
|
|
200
|
-
};
|
|
201
|
-
var path = Path.posix.join(".", root, ".", this1);
|
|
166
|
+
var id = this.getBuildExportPath();
|
|
167
|
+
var path = Path.posix.join(".", "./", ".", id);
|
|
202
168
|
var _g = this.config.platform;
|
|
203
169
|
if (_g == null) {
|
|
204
170
|
return [];
|
|
@@ -297,27 +263,15 @@ class Hxml extends Register.inherits(Stone) {
|
|
|
297
263
|
return Promise.resolve([this.filename()]);
|
|
298
264
|
}
|
|
299
265
|
filename() {
|
|
300
|
-
var
|
|
301
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
302
|
-
if (str.length > 0) {
|
|
303
|
-
str = Path.posix.normalize(str);
|
|
304
|
-
str = StringTools.replace(str, "\\", "/");
|
|
305
|
-
};
|
|
306
|
-
s = str;
|
|
307
|
-
var fn = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
266
|
+
var fn = this.id;
|
|
308
267
|
if (Path.posix.extname(fn) == "") {
|
|
309
|
-
var
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
var s = fn.substring(0, fn.lastIndexOf("/") + 1);
|
|
314
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
315
|
-
if (str.length > 0) {
|
|
316
|
-
str = Path.posix.normalize(str);
|
|
317
|
-
str = StringTools.replace(str, "\\", "/");
|
|
268
|
+
var id = fn;
|
|
269
|
+
var ext = "hxml";
|
|
270
|
+
if ("hxml".length > 0 && ext.charCodeAt(0) != 46) {
|
|
271
|
+
ext = "." + ext;
|
|
318
272
|
};
|
|
319
|
-
|
|
320
|
-
fn = ((
|
|
273
|
+
var dir = id.substring(0, id.lastIndexOf("/") + 1);
|
|
274
|
+
fn = Path.posix.join((dir.length == 0) ? "./" : dir, Path.posix.parse(id).name) + ext;
|
|
321
275
|
};
|
|
322
276
|
return fn;
|
|
323
277
|
}
|
package/bin/whet.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export {Project} from "./whet/Project"
|
|
|
13
13
|
export {Log} from "./whet/Log"
|
|
14
14
|
export {JsonStoneConfig} from "./whet/stones/JsonStone"
|
|
15
15
|
export {JsonStone} from "./whet/stones/JsonStone"
|
|
16
|
+
export {IdUtils} from "./whet/SourceId"
|
|
16
17
|
export {HxmlConfig} from "./whet/stones/haxe/Hxml"
|
|
17
18
|
export {Hxml} from "./whet/stones/haxe/Hxml"
|
|
18
19
|
export {HaxeBuild} from "./whet/stones/haxe/HaxeBuild"
|
package/bin/whet.js
CHANGED
|
@@ -15,6 +15,7 @@ export {RemoteFile} from "./whet/stones/RemoteFile.js"
|
|
|
15
15
|
export {Project} from "./whet/Project.js"
|
|
16
16
|
export {Log} from "./whet/Log.js"
|
|
17
17
|
export {JsonStone} from "./whet/stones/JsonStone.js"
|
|
18
|
+
export {IdUtils} from "./whet/SourceId.js"
|
|
18
19
|
export {Hxml} from "./whet/stones/haxe/Hxml.js"
|
|
19
20
|
export {HaxeBuild} from "./whet/stones/haxe/HaxeBuild.js"
|
|
20
21
|
export {Files} from "./whet/stones/Files.js"
|