whet 0.0.15 → 0.0.18
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/pino_pretty/PrettyOptions.d.ts +98 -0
- package/bin/pino_pretty/default_/MessageFormatFunc.d.ts +3 -0
- package/bin/whet/Log.d.ts +1 -0
- package/bin/whet/Log.js +3 -2
- package/bin/whet/Stone.js +1 -0
- package/bin/whet/Whet.d.ts +1 -0
- package/bin/whet/Whet.js +20 -3
- package/bin/whet/extern/Minimatch.d.ts +77 -0
- package/bin/whet/magic/MinimatchType.d.ts +5 -0
- package/bin/whet/magic/MinimatchType.js +26 -0
- package/bin/whet/magic/RoutePathType.d.ts +12 -3
- package/bin/whet/magic/RoutePathType.js +87 -23
- package/bin/whet/route/Router.d.ts +19 -12
- package/bin/whet/route/Router.js +224 -91
- package/bin/whet/stones/JsonStone.d.ts +2 -3
- package/bin/whet/stones/JsonStone.js +19 -50
- package/bin/whet/stones/Server.d.ts +1 -0
- package/bin/whet/stones/Server.js +91 -35
- package/bin/whet/stones/Zip.js +2 -22
- package/bin/whet.d.ts +0 -1
- package/bin/whet.js +0 -1
- package/package.json +6 -3
- package/bin/StringBuf.d.ts +0 -13
- package/bin/StringBuf.js +0 -25
- package/bin/haxe/CallStack.d.ts +0 -41
- package/bin/haxe/CallStack.js +0 -96
- package/bin/haxe/NativeStackTrace.js +0 -147
- package/bin/haxe/io/Path.d.ts +0 -109
- package/bin/haxe/io/Path.js +0 -217
- package/bin/whet/magic/RouteType.d.ts +0 -13
- package/bin/whet/magic/RouteType.js +0 -104
- package/bin/whet/route/Route.d.ts +0 -19
- package/bin/whet/route/Route.js +0 -121
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Whet_Fields_} from "../Whet.js"
|
|
1
2
|
import {Stone} from "../Stone.js"
|
|
2
3
|
import {Log} from "../Log.js"
|
|
3
4
|
import * as Path from "path"
|
|
@@ -6,6 +7,7 @@ import * as Http from "http"
|
|
|
6
7
|
import {Register} from "../../genes/Register.js"
|
|
7
8
|
import {StringTools} from "../../StringTools.js"
|
|
8
9
|
import {Std} from "../../Std.js"
|
|
10
|
+
import {Reflect as Reflect__1} from "../../Reflect.js"
|
|
9
11
|
import {HxOverrides} from "../../HxOverrides.js"
|
|
10
12
|
|
|
11
13
|
const $global = Register.$global
|
|
@@ -75,41 +77,62 @@ class Server extends Register.inherits(Stone) {
|
|
|
75
77
|
s = str;
|
|
76
78
|
id = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
77
79
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
|
|
80
|
+
switch (req.method) {
|
|
81
|
+
case "GET":
|
|
82
|
+
if (HxOverrides.cca(id, id.length - 1) == 47) {
|
|
83
|
+
if ("index.html".length > 0) {
|
|
84
|
+
var s = id.substring(0, id.lastIndexOf("/") + 1);
|
|
85
|
+
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
86
|
+
if (str.length > 0) {
|
|
87
|
+
str = Path.posix.normalize(str);
|
|
88
|
+
str = StringTools.replace(str, "\\", "/");
|
|
89
|
+
};
|
|
90
|
+
s = str;
|
|
91
|
+
id = ((HxOverrides.cca(s, 0) == 47) ? s : "/" + s) + "index.html";
|
|
92
|
+
};
|
|
93
|
+
} else if (Path.posix.extname(id) == "") {
|
|
94
|
+
var s = "" + id + "/index.html";
|
|
82
95
|
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
83
96
|
if (str.length > 0) {
|
|
84
97
|
str = Path.posix.normalize(str);
|
|
85
98
|
str = StringTools.replace(str, "\\", "/");
|
|
86
99
|
};
|
|
87
100
|
s = str;
|
|
88
|
-
id = (
|
|
89
|
-
};
|
|
90
|
-
} else if (Path.posix.extname(id) == "") {
|
|
91
|
-
var s = "" + id + "/index.html";
|
|
92
|
-
var str = (s.length > 1 && HxOverrides.cca(s, 0) == 47) ? s.substring(1) : s;
|
|
93
|
-
if (str.length > 0) {
|
|
94
|
-
str = Path.posix.normalize(str);
|
|
95
|
-
str = StringTools.replace(str, "\\", "/");
|
|
101
|
+
id = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
96
102
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
this.config.router.get(id).then(function (routeResult) {
|
|
104
|
+
return ((routeResult.length > 0) ? routeResult[0].get() : (_gthis.routeDynamic != null) ? _gthis.routeDynamic(id) : Promise.resolve(null)).then(function (source) {
|
|
105
|
+
if (source == null) {
|
|
106
|
+
res.writeHead(404, "File not found.");
|
|
107
|
+
res.end();
|
|
108
|
+
return;
|
|
109
|
+
};
|
|
110
|
+
var 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"};
|
|
111
|
+
if (_gthis.config.headers != null) {
|
|
112
|
+
var access = _gthis.config.headers;
|
|
113
|
+
var _g_keys = Reflect__1.fields(access);
|
|
114
|
+
var _g_index = 0;
|
|
115
|
+
while (_g_index < _g_keys.length) {
|
|
116
|
+
var key = _g_keys[_g_index++];
|
|
117
|
+
headers[key] = access[key];
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
res.writeHead(200, headers);
|
|
121
|
+
res.write(source.data, "binary");
|
|
104
122
|
res.end();
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
})["catch"](function (e) {
|
|
124
|
+
Log.log(40, ...["Server error.", {"error": e}]);
|
|
125
|
+
res.writeHead(500, "Error happened.", _gthis.config.headers);
|
|
126
|
+
if (((e) instanceof Error)) {
|
|
127
|
+
res.write(e.stack, "utf-8");
|
|
128
|
+
} else {
|
|
129
|
+
res.write(Std.string(e), "utf-8");
|
|
130
|
+
};
|
|
131
|
+
res.end();
|
|
132
|
+
});
|
|
110
133
|
})["catch"](function (e) {
|
|
111
134
|
Log.log(40, ...["Server error.", {"error": e}]);
|
|
112
|
-
res.writeHead(500, "Error happened.");
|
|
135
|
+
res.writeHead(500, "Error happened.", _gthis.config.headers);
|
|
113
136
|
if (((e) instanceof Error)) {
|
|
114
137
|
res.write(e.stack, "utf-8");
|
|
115
138
|
} else {
|
|
@@ -117,19 +140,52 @@ class Server extends Register.inherits(Stone) {
|
|
|
117
140
|
};
|
|
118
141
|
res.end();
|
|
119
142
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
res.writeHead(
|
|
123
|
-
if (((e) instanceof Error)) {
|
|
124
|
-
res.write(e.stack, "utf-8");
|
|
125
|
-
} else {
|
|
126
|
-
res.write(Std.string(e), "utf-8");
|
|
127
|
-
};
|
|
143
|
+
break
|
|
144
|
+
case "OPTIONS":
|
|
145
|
+
res.writeHead(200, this.config.headers);
|
|
128
146
|
res.end();
|
|
129
|
-
|
|
130
|
-
|
|
147
|
+
break
|
|
148
|
+
case "PUT":
|
|
149
|
+
var s = "/";
|
|
150
|
+
var str = ("/".length > 1 && HxOverrides.cca("/", 0) == 47) ? "/".substring(1) : "/";
|
|
151
|
+
if (str.length > 0) {
|
|
152
|
+
str = Path.posix.normalize(str);
|
|
153
|
+
str = StringTools.replace(str, "\\", "/");
|
|
154
|
+
};
|
|
155
|
+
s = str;
|
|
156
|
+
var root = (HxOverrides.cca(s, 0) == 47) ? s : "/" + s;
|
|
157
|
+
if (id.charAt(0) != "/") {
|
|
158
|
+
throw new Error("Badly formed SourceId.");
|
|
159
|
+
};
|
|
160
|
+
var cmd = [Path.posix.join(".", root, ".", id)];
|
|
161
|
+
var body = "";
|
|
162
|
+
req.on("data", function (chunk) {
|
|
163
|
+
body += chunk;
|
|
164
|
+
return body;
|
|
165
|
+
});
|
|
166
|
+
req.on("end", function () {
|
|
167
|
+
if (body != "") {
|
|
168
|
+
cmd.push(body);
|
|
169
|
+
};
|
|
170
|
+
return Whet_Fields_.executeCommand(cmd).then(function (_) {
|
|
171
|
+
res.writeHead(200, _gthis.config.headers);
|
|
172
|
+
res.end();
|
|
173
|
+
})["catch"](function (e) {
|
|
174
|
+
Log.log(40, ...["Server error.", {"error": e}]);
|
|
175
|
+
res.writeHead(500, "Error happened.", _gthis.config.headers);
|
|
176
|
+
if (((e) instanceof Error)) {
|
|
177
|
+
res.write(e.stack, "utf-8");
|
|
178
|
+
} else {
|
|
179
|
+
res.write(Std.string(e), "utf-8");
|
|
180
|
+
};
|
|
181
|
+
res.end();
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
break
|
|
185
|
+
default:
|
|
131
186
|
res.writeHead(400, "Unsupported method.");
|
|
132
187
|
res.end();
|
|
188
|
+
|
|
133
189
|
};
|
|
134
190
|
}
|
|
135
191
|
static get __name__() {
|
package/bin/whet/stones/Zip.js
CHANGED
|
@@ -36,27 +36,7 @@ class ZipStone extends Register.inherits(Stone) {
|
|
|
36
36
|
}
|
|
37
37
|
generateHash() {
|
|
38
38
|
var _gthis = this;
|
|
39
|
-
|
|
40
|
-
var result = new Array(_this.length);
|
|
41
|
-
var _g = 0;
|
|
42
|
-
var _g1 = _this.length;
|
|
43
|
-
while (_g < _g1) {
|
|
44
|
-
var i = _g++;
|
|
45
|
-
var _this1 = _this[i].route.routes;
|
|
46
|
-
var result1 = new Array(_this1.length);
|
|
47
|
-
var _g2 = 0;
|
|
48
|
-
var _g3 = _this1.length;
|
|
49
|
-
while (_g2 < _g3) {
|
|
50
|
-
var i1 = _g2++;
|
|
51
|
-
result1[i1] = _this1[i1].stone.getHash();
|
|
52
|
-
};
|
|
53
|
-
result[i] = Promise.all(result1).then(function (hashes) {
|
|
54
|
-
return SourceHash.merge(...hashes);
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
return Promise.all(result).then(function (hashes) {
|
|
58
|
-
return SourceHash.merge(...hashes);
|
|
59
|
-
}).then(function (hash) {
|
|
39
|
+
return new Router(this.config.sources).getHash().then(function (hash) {
|
|
60
40
|
return SourceHash.fromString(_gthis.config.filename + _gthis.config.level).add(hash);
|
|
61
41
|
});
|
|
62
42
|
}
|
|
@@ -64,7 +44,7 @@ class ZipStone extends Register.inherits(Stone) {
|
|
|
64
44
|
var _gthis = this;
|
|
65
45
|
Log.log(30, ...["Zipping files."]);
|
|
66
46
|
var level = this.config.level;
|
|
67
|
-
return new Router(this.config.sources).
|
|
47
|
+
return new Router(this.config.sources).get().then(function (files) {
|
|
68
48
|
var _g = [];
|
|
69
49
|
var _g1 = 0;
|
|
70
50
|
while (_g1 < files.length) {
|
package/bin/whet.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export {Stone} from "./whet/Stone"
|
|
|
7
7
|
export {ServerConfig} from "./whet/stones/Server"
|
|
8
8
|
export {Server} from "./whet/stones/Server"
|
|
9
9
|
export {Router} from "./whet/route/Router"
|
|
10
|
-
export {Route} from "./whet/route/Route"
|
|
11
10
|
export {RemoteFileConfig} from "./whet/stones/RemoteFile"
|
|
12
11
|
export {RemoteFile} from "./whet/stones/RemoteFile"
|
|
13
12
|
export {Project} from "./whet/Project"
|
package/bin/whet.js
CHANGED
|
@@ -11,7 +11,6 @@ export {Utils} from "./whet/Utils.js"
|
|
|
11
11
|
export {Stone} from "./whet/Stone.js"
|
|
12
12
|
export {Server} from "./whet/stones/Server.js"
|
|
13
13
|
export {Router} from "./whet/route/Router.js"
|
|
14
|
-
export {Route} from "./whet/route/Route.js"
|
|
15
14
|
export {RemoteFile} from "./whet/stones/RemoteFile.js"
|
|
16
15
|
export {Project} from "./whet/Project.js"
|
|
17
16
|
export {Log} from "./whet/Log.js"
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whet",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "NodeJS based assets management and project tooling library.",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"devinit": "npx dts2hx commander --modular --noLibWrap",
|
|
6
|
+
"devinit": "npx dts2hx commander pino-pretty --modular --noLibWrap",
|
|
7
7
|
"build": "npx haxe build.hxml"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
@@ -24,9 +24,12 @@
|
|
|
24
24
|
"homepage": "https://github.com/Antriel/whet#readme",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"commander": "^9.0.0",
|
|
27
|
-
"mime": "^3.0.0"
|
|
27
|
+
"mime": "^3.0.0",
|
|
28
|
+
"minimatch": "^5.1.0",
|
|
29
|
+
"pino-pretty": "^9.1.0"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
32
|
+
"@types/minimatch": "^5.1.0",
|
|
30
33
|
"dts2hx": "^0.18.1",
|
|
31
34
|
"lix": "^15.11.6"
|
|
32
35
|
}
|
package/bin/StringBuf.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
A String buffer is an efficient way to build a big string by appending small
|
|
4
|
-
elements together.
|
|
5
|
-
|
|
6
|
-
Unlike String, an instance of StringBuf is not immutable in the sense that
|
|
7
|
-
it can be passed as argument to functions which modify it by appending more
|
|
8
|
-
values.
|
|
9
|
-
*/
|
|
10
|
-
export declare class StringBuf {
|
|
11
|
-
constructor()
|
|
12
|
-
protected b: string
|
|
13
|
-
}
|
package/bin/StringBuf.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {Register} from "./genes/Register.js"
|
|
2
|
-
|
|
3
|
-
const $global = Register.$global
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
A String buffer is an efficient way to build a big string by appending small
|
|
7
|
-
elements together.
|
|
8
|
-
|
|
9
|
-
Unlike String, an instance of StringBuf is not immutable in the sense that
|
|
10
|
-
it can be passed as argument to functions which modify it by appending more
|
|
11
|
-
values.
|
|
12
|
-
*/
|
|
13
|
-
export const StringBuf = Register.global("$hxClasses")["StringBuf"] =
|
|
14
|
-
class StringBuf extends Register.inherits() {
|
|
15
|
-
new() {
|
|
16
|
-
this.b = "";
|
|
17
|
-
}
|
|
18
|
-
static get __name__() {
|
|
19
|
-
return "StringBuf"
|
|
20
|
-
}
|
|
21
|
-
get __class__() {
|
|
22
|
-
return StringBuf
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
package/bin/haxe/CallStack.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {StringBuf} from "../StringBuf"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
Elements return by `CallStack` methods.
|
|
5
|
-
*/
|
|
6
|
-
export declare namespace StackItem {
|
|
7
|
-
export type Module = {_hx_index: 1, m: string, __enum__: "haxe.StackItem"}
|
|
8
|
-
export const Module: (m: string) => StackItem
|
|
9
|
-
export type Method = {_hx_index: 3, classname: null | string, method: string, __enum__: "haxe.StackItem"}
|
|
10
|
-
export const Method: (classname: null | string, method: string) => StackItem
|
|
11
|
-
export type LocalFunction = {_hx_index: 4, v: null | number, __enum__: "haxe.StackItem"}
|
|
12
|
-
export const LocalFunction: (v: null | number) => StackItem
|
|
13
|
-
export type FilePos = {_hx_index: 2, s: null | StackItem, file: string, line: number, column: null | number, __enum__: "haxe.StackItem"}
|
|
14
|
-
export const FilePos: (s: null | StackItem, file: string, line: number, column: null | number) => StackItem
|
|
15
|
-
export type CFunction = {_hx_index: 0, __enum__: "haxe.StackItem"}
|
|
16
|
-
export const CFunction: CFunction
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
Elements return by `CallStack` methods.
|
|
21
|
-
*/
|
|
22
|
-
export declare type StackItem =
|
|
23
|
-
| StackItem.Module
|
|
24
|
-
| StackItem.Method
|
|
25
|
-
| StackItem.LocalFunction
|
|
26
|
-
| StackItem.FilePos
|
|
27
|
-
| StackItem.CFunction
|
|
28
|
-
|
|
29
|
-
export declare class CallStack {
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
Return the call stack elements, or an empty array if not available.
|
|
33
|
-
*/
|
|
34
|
-
static callStack(): StackItem[]
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
Returns a representation of the stack as a printable string.
|
|
38
|
-
*/
|
|
39
|
-
static toString(stack: StackItem[]): string
|
|
40
|
-
protected static itemToString(b: StringBuf, s: StackItem): void
|
|
41
|
-
}
|
package/bin/haxe/CallStack.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import {NativeStackTrace} from "./NativeStackTrace.js"
|
|
2
|
-
import {Register} from "../genes/Register.js"
|
|
3
|
-
import {StringBuf} from "../StringBuf.js"
|
|
4
|
-
import {Std} from "../Std.js"
|
|
5
|
-
|
|
6
|
-
const $global = Register.$global
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
Elements return by `CallStack` methods.
|
|
10
|
-
*/
|
|
11
|
-
export const StackItem =
|
|
12
|
-
Register.global("$hxEnums")["haxe.StackItem"] =
|
|
13
|
-
{
|
|
14
|
-
__ename__: "haxe.StackItem",
|
|
15
|
-
|
|
16
|
-
CFunction: {_hx_name: "CFunction", _hx_index: 0, __enum__: "haxe.StackItem"},
|
|
17
|
-
Module: Object.assign((m) => ({_hx_index: 1, __enum__: "haxe.StackItem", "m": m}), {_hx_name: "Module", __params__: ["m"]}),
|
|
18
|
-
FilePos: Object.assign((s, file, line, column) => ({_hx_index: 2, __enum__: "haxe.StackItem", "s": s, "file": file, "line": line, "column": column}), {_hx_name: "FilePos", __params__: ["s", "file", "line", "column"]}),
|
|
19
|
-
Method: Object.assign((classname, method) => ({_hx_index: 3, __enum__: "haxe.StackItem", "classname": classname, "method": method}), {_hx_name: "Method", __params__: ["classname", "method"]}),
|
|
20
|
-
LocalFunction: Object.assign((v) => ({_hx_index: 4, __enum__: "haxe.StackItem", "v": v}), {_hx_name: "LocalFunction", __params__: ["v"]})
|
|
21
|
-
}
|
|
22
|
-
StackItem.__constructs__ = [StackItem.CFunction, StackItem.Module, StackItem.FilePos, StackItem.Method, StackItem.LocalFunction]
|
|
23
|
-
StackItem.__empty_constructs__ = [StackItem.CFunction]
|
|
24
|
-
|
|
25
|
-
export const CallStack = Register.global("$hxClasses")["haxe._CallStack.CallStack"] =
|
|
26
|
-
class CallStack {
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
Return the call stack elements, or an empty array if not available.
|
|
30
|
-
*/
|
|
31
|
-
static callStack() {
|
|
32
|
-
return NativeStackTrace.toHaxe(NativeStackTrace.callStack());
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
Returns a representation of the stack as a printable string.
|
|
37
|
-
*/
|
|
38
|
-
static toString(stack) {
|
|
39
|
-
var b = new StringBuf();
|
|
40
|
-
var _g = 0;
|
|
41
|
-
var _g1 = stack;
|
|
42
|
-
while (_g < _g1.length) {
|
|
43
|
-
var s = _g1[_g++];
|
|
44
|
-
b.b += "\nCalled from ";
|
|
45
|
-
CallStack.itemToString(b, s);
|
|
46
|
-
};
|
|
47
|
-
return b.b;
|
|
48
|
-
}
|
|
49
|
-
static itemToString(b, s) {
|
|
50
|
-
switch (s._hx_index) {
|
|
51
|
-
case 0:
|
|
52
|
-
b.b += "a C function";
|
|
53
|
-
break
|
|
54
|
-
case 1:
|
|
55
|
-
var _g = s.m;
|
|
56
|
-
b.b = (b.b += "module ") + ((_g == null) ? "null" : "" + _g);
|
|
57
|
-
break
|
|
58
|
-
case 2:
|
|
59
|
-
var _g = s.s;
|
|
60
|
-
var _g1 = s.file;
|
|
61
|
-
var _g2 = s.line;
|
|
62
|
-
var _g3 = s.column;
|
|
63
|
-
if (_g != null) {
|
|
64
|
-
CallStack.itemToString(b, _g);
|
|
65
|
-
b.b += " (";
|
|
66
|
-
};
|
|
67
|
-
b.b = (b.b += (_g1 == null) ? "null" : "" + _g1) + " line ";
|
|
68
|
-
b.b += (_g2 == null) ? "null" : "" + _g2;
|
|
69
|
-
if (_g3 != null) {
|
|
70
|
-
b.b = (b.b += " column ") + ((_g3 == null) ? "null" : "" + _g3);
|
|
71
|
-
};
|
|
72
|
-
if (_g != null) {
|
|
73
|
-
b.b += ")";
|
|
74
|
-
};
|
|
75
|
-
break
|
|
76
|
-
case 3:
|
|
77
|
-
var _g = s.classname;
|
|
78
|
-
var _g1 = s.method;
|
|
79
|
-
b.b = (b.b += Std.string((_g == null) ? "<unknown>" : _g)) + ".";
|
|
80
|
-
b.b += (_g1 == null) ? "null" : "" + _g1;
|
|
81
|
-
break
|
|
82
|
-
case 4:
|
|
83
|
-
var _g = s.v;
|
|
84
|
-
b.b = (b.b += "local function #") + ((_g == null) ? "null" : "" + _g);
|
|
85
|
-
break
|
|
86
|
-
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
static get __name__() {
|
|
90
|
-
return "haxe._CallStack.CallStack_Impl_"
|
|
91
|
-
}
|
|
92
|
-
get __class__() {
|
|
93
|
-
return CallStack
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import {StackItem} from "./CallStack.js"
|
|
2
|
-
import {Register} from "../genes/Register.js"
|
|
3
|
-
import {StringTools} from "../StringTools.js"
|
|
4
|
-
import {Std} from "../Std.js"
|
|
5
|
-
|
|
6
|
-
const $global = Register.$global
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
Do not use manually.
|
|
10
|
-
*/
|
|
11
|
-
export const NativeStackTrace = Register.global("$hxClasses")["haxe.NativeStackTrace"] =
|
|
12
|
-
class NativeStackTrace {
|
|
13
|
-
static callStack() {
|
|
14
|
-
var e = new Error("");
|
|
15
|
-
var stack = NativeStackTrace.tryHaxeStack(e);
|
|
16
|
-
if (typeof(stack) == "undefined") {
|
|
17
|
-
try {
|
|
18
|
-
throw e;
|
|
19
|
-
}catch (_g) {
|
|
20
|
-
};
|
|
21
|
-
stack = e.stack;
|
|
22
|
-
};
|
|
23
|
-
return NativeStackTrace.normalize(stack, 2);
|
|
24
|
-
}
|
|
25
|
-
static toHaxe(s, skip) {
|
|
26
|
-
if (skip == null) {
|
|
27
|
-
skip = 0;
|
|
28
|
-
};
|
|
29
|
-
if (s == null) {
|
|
30
|
-
return [];
|
|
31
|
-
} else if (typeof(s) == "string") {
|
|
32
|
-
var stack = s.split("\n");
|
|
33
|
-
if (stack[0] == "Error") {
|
|
34
|
-
stack.shift();
|
|
35
|
-
};
|
|
36
|
-
var m = [];
|
|
37
|
-
var _g = 0;
|
|
38
|
-
var _g1 = stack.length;
|
|
39
|
-
while (_g < _g1) {
|
|
40
|
-
var i = _g++;
|
|
41
|
-
if (skip > i) {
|
|
42
|
-
continue;
|
|
43
|
-
};
|
|
44
|
-
var line = stack[i];
|
|
45
|
-
var matched = line.match(/^ at ([A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/);
|
|
46
|
-
if (matched != null) {
|
|
47
|
-
var path = matched[1].split(".");
|
|
48
|
-
if (path[0] == "$hxClasses") {
|
|
49
|
-
path.shift();
|
|
50
|
-
};
|
|
51
|
-
var meth = path.pop();
|
|
52
|
-
var file = matched[2];
|
|
53
|
-
var line1 = Std.parseInt(matched[3]);
|
|
54
|
-
var column = Std.parseInt(matched[4]);
|
|
55
|
-
m.push(StackItem.FilePos((meth == "Anonymous function") ? StackItem.LocalFunction() : (meth == "Global code") ? null : StackItem.Method(path.join("."), meth), file, line1, column));
|
|
56
|
-
} else {
|
|
57
|
-
m.push(StackItem.Module(StringTools.trim(line)));
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
return m;
|
|
61
|
-
} else if (skip > 0 && Array.isArray(s)) {
|
|
62
|
-
return s.slice(skip);
|
|
63
|
-
} else {
|
|
64
|
-
return s;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
static tryHaxeStack(e) {
|
|
68
|
-
if (e == null) {
|
|
69
|
-
return [];
|
|
70
|
-
};
|
|
71
|
-
var oldValue = Error.prepareStackTrace;
|
|
72
|
-
Error.prepareStackTrace = NativeStackTrace.prepareHxStackTrace;
|
|
73
|
-
Error.prepareStackTrace = oldValue;
|
|
74
|
-
return e.stack;
|
|
75
|
-
}
|
|
76
|
-
static prepareHxStackTrace(e, callsites) {
|
|
77
|
-
var stack = [];
|
|
78
|
-
var _g = 0;
|
|
79
|
-
while (_g < callsites.length) {
|
|
80
|
-
var site = callsites[_g];
|
|
81
|
-
++_g;
|
|
82
|
-
if (NativeStackTrace.wrapCallSite != null) {
|
|
83
|
-
site = NativeStackTrace.wrapCallSite(site);
|
|
84
|
-
};
|
|
85
|
-
var method = null;
|
|
86
|
-
var fullName = site.getFunctionName();
|
|
87
|
-
if (fullName != null) {
|
|
88
|
-
var idx = fullName.lastIndexOf(".");
|
|
89
|
-
if (idx >= 0) {
|
|
90
|
-
method = StackItem.Method(fullName.substring(0, idx), fullName.substring(idx + 1));
|
|
91
|
-
} else {
|
|
92
|
-
method = StackItem.Method(null, fullName);
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
var fileName = site.getFileName();
|
|
96
|
-
var fileAddr = (fileName == null) ? -1 : fileName.indexOf("file:");
|
|
97
|
-
if (NativeStackTrace.wrapCallSite != null && fileAddr > 0) {
|
|
98
|
-
fileName = fileName.substring(fileAddr + 6);
|
|
99
|
-
};
|
|
100
|
-
stack.push(StackItem.FilePos(method, fileName, site.getLineNumber(), site.getColumnNumber()));
|
|
101
|
-
};
|
|
102
|
-
return stack;
|
|
103
|
-
}
|
|
104
|
-
static normalize(stack, skipItems) {
|
|
105
|
-
if (skipItems == null) {
|
|
106
|
-
skipItems = 0;
|
|
107
|
-
};
|
|
108
|
-
if (Array.isArray(stack) && skipItems > 0) {
|
|
109
|
-
return stack.slice(skipItems);
|
|
110
|
-
} else if (typeof(stack) == "string") {
|
|
111
|
-
switch (stack.substring(0, 6)) {
|
|
112
|
-
case "Error\n":case "Error:":
|
|
113
|
-
++skipItems;
|
|
114
|
-
break
|
|
115
|
-
default:
|
|
116
|
-
|
|
117
|
-
};
|
|
118
|
-
return NativeStackTrace.skipLines(stack, skipItems);
|
|
119
|
-
} else {
|
|
120
|
-
return stack;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
static skipLines(stack, skip, pos) {
|
|
124
|
-
if (pos == null) {
|
|
125
|
-
pos = 0;
|
|
126
|
-
};
|
|
127
|
-
while (true) if (skip > 0) {
|
|
128
|
-
pos = stack.indexOf("\n", pos);
|
|
129
|
-
if (pos < 0) {
|
|
130
|
-
return "";
|
|
131
|
-
} else {
|
|
132
|
-
skip = --skip;
|
|
133
|
-
pos += 1;
|
|
134
|
-
continue;
|
|
135
|
-
};
|
|
136
|
-
} else {
|
|
137
|
-
return stack.substring(pos);
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
static get __name__() {
|
|
141
|
-
return "haxe.NativeStackTrace"
|
|
142
|
-
}
|
|
143
|
-
get __class__() {
|
|
144
|
-
return NativeStackTrace
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
package/bin/haxe/io/Path.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
This class provides a convenient way of working with paths. It supports the
|
|
4
|
-
common path formats:
|
|
5
|
-
|
|
6
|
-
- `directory1/directory2/filename.extension`
|
|
7
|
-
- `directory1\directory2\filename.extension`
|
|
8
|
-
*/
|
|
9
|
-
export declare class Path {
|
|
10
|
-
constructor(path: string)
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
The directory.
|
|
14
|
-
|
|
15
|
-
This is the leading part of the path that is not part of the file name
|
|
16
|
-
and the extension.
|
|
17
|
-
|
|
18
|
-
Does not end with a `/` or `\` separator.
|
|
19
|
-
|
|
20
|
-
If the path has no directory, the value is `null`.
|
|
21
|
-
*/
|
|
22
|
-
dir: null | string
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
The file name.
|
|
26
|
-
|
|
27
|
-
This is the part of the part between the directory and the extension.
|
|
28
|
-
|
|
29
|
-
If there is no file name, e.g. for `".htaccess"` or `"/dir/"`, the value
|
|
30
|
-
is the empty String `""`.
|
|
31
|
-
*/
|
|
32
|
-
file: string
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
The file extension.
|
|
36
|
-
|
|
37
|
-
It is separated from the file name by a dot. This dot is not part of
|
|
38
|
-
the extension.
|
|
39
|
-
|
|
40
|
-
If the path has no extension, the value is `null`.
|
|
41
|
-
*/
|
|
42
|
-
ext: null | string
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
`true` if the last directory separator is a backslash, `false` otherwise.
|
|
46
|
-
*/
|
|
47
|
-
backslash: boolean
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
Returns a String representation of `this` path.
|
|
51
|
-
|
|
52
|
-
If `this.backslash` is `true`, backslash is used as directory separator,
|
|
53
|
-
otherwise slash is used. This only affects the separator between
|
|
54
|
-
`this.dir` and `this.file`.
|
|
55
|
-
|
|
56
|
-
If `this.directory` or `this.extension` is `null`, their representation
|
|
57
|
-
is the empty String `""`.
|
|
58
|
-
*/
|
|
59
|
-
toString(): string
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
Returns the String representation of `path` without the directory.
|
|
63
|
-
|
|
64
|
-
If `path` is `null`, the result is unspecified.
|
|
65
|
-
*/
|
|
66
|
-
static withoutDirectory(path: string): string
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
Returns the directory of `path`.
|
|
70
|
-
|
|
71
|
-
If the directory is `null`, the empty String `""` is returned.
|
|
72
|
-
|
|
73
|
-
If `path` is `null`, the result is unspecified.
|
|
74
|
-
*/
|
|
75
|
-
static directory(path: string): string
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
Returns the extension of `path`.
|
|
79
|
-
|
|
80
|
-
If `path` has no extension, the empty String `""` is returned.
|
|
81
|
-
|
|
82
|
-
If `path` is `null`, the result is unspecified.
|
|
83
|
-
*/
|
|
84
|
-
static extension(path: string): string
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
Normalize a given `path` (e.g. turn `'/usr/local/../lib'` into `'/usr/lib'`).
|
|
88
|
-
|
|
89
|
-
Also replaces backslashes `\` with slashes `/` and afterwards turns
|
|
90
|
-
multiple slashes into a single one.
|
|
91
|
-
|
|
92
|
-
If `path` is `null`, the result is unspecified.
|
|
93
|
-
*/
|
|
94
|
-
static normalize(path: string): string
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
Adds a trailing slash to `path`, if it does not have one already.
|
|
98
|
-
|
|
99
|
-
If the last slash in `path` is a backslash, a backslash is appended to
|
|
100
|
-
`path`.
|
|
101
|
-
|
|
102
|
-
If the last slash in `path` is a slash, or if no slash is found, a slash
|
|
103
|
-
is appended to `path`. In particular, this applies to the empty String
|
|
104
|
-
`""`.
|
|
105
|
-
|
|
106
|
-
If `path` is `null`, the result is unspecified.
|
|
107
|
-
*/
|
|
108
|
-
static addTrailingSlash(path: string): string
|
|
109
|
-
}
|