whet 0.0.14 → 0.0.17

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.
@@ -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
- }
@@ -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
-
@@ -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
- }
@@ -1,217 +0,0 @@
1
- import {Register} from "../../genes/Register.js"
2
- import {HxOverrides} from "../../HxOverrides.js"
3
-
4
- const $global = Register.$global
5
-
6
- /**
7
- This class provides a convenient way of working with paths. It supports the
8
- common path formats:
9
-
10
- - `directory1/directory2/filename.extension`
11
- - `directory1\directory2\filename.extension`
12
- */
13
- export const Path = Register.global("$hxClasses")["haxe.io.Path"] =
14
- class Path extends Register.inherits() {
15
- new(path) {
16
- switch (path) {
17
- case ".":case "..":
18
- this.dir = path;
19
- this.file = "";
20
- return;
21
- break
22
-
23
- };
24
- var c1 = path.lastIndexOf("/");
25
- var c2 = path.lastIndexOf("\\");
26
- if (c1 < c2) {
27
- this.dir = HxOverrides.substr(path, 0, c2);
28
- path = HxOverrides.substr(path, c2 + 1, null);
29
- this.backslash = true;
30
- } else if (c2 < c1) {
31
- this.dir = HxOverrides.substr(path, 0, c1);
32
- path = HxOverrides.substr(path, c1 + 1, null);
33
- } else {
34
- this.dir = null;
35
- };
36
- var cp = path.lastIndexOf(".");
37
- if (cp != -1) {
38
- this.ext = HxOverrides.substr(path, cp + 1, null);
39
- this.file = HxOverrides.substr(path, 0, cp);
40
- } else {
41
- this.ext = null;
42
- this.file = path;
43
- };
44
- }
45
-
46
- /**
47
- Returns a String representation of `this` path.
48
-
49
- If `this.backslash` is `true`, backslash is used as directory separator,
50
- otherwise slash is used. This only affects the separator between
51
- `this.dir` and `this.file`.
52
-
53
- If `this.directory` or `this.extension` is `null`, their representation
54
- is the empty String `""`.
55
- */
56
- toString() {
57
- return ((this.dir == null) ? "" : this.dir + ((this.backslash) ? "\\" : "/")) + this.file + ((this.ext == null) ? "" : "." + this.ext);
58
- }
59
-
60
- /**
61
- Returns the String representation of `path` without the directory.
62
-
63
- If `path` is `null`, the result is unspecified.
64
- */
65
- static withoutDirectory(path) {
66
- var s = new Path(path);
67
- s.dir = null;
68
- return s.toString();
69
- }
70
-
71
- /**
72
- Returns the directory of `path`.
73
-
74
- If the directory is `null`, the empty String `""` is returned.
75
-
76
- If `path` is `null`, the result is unspecified.
77
- */
78
- static directory(path) {
79
- var s = new Path(path);
80
- if (s.dir == null) {
81
- return "";
82
- };
83
- return s.dir;
84
- }
85
-
86
- /**
87
- Returns the extension of `path`.
88
-
89
- If `path` has no extension, the empty String `""` is returned.
90
-
91
- If `path` is `null`, the result is unspecified.
92
- */
93
- static extension(path) {
94
- var s = new Path(path);
95
- if (s.ext == null) {
96
- return "";
97
- };
98
- return s.ext;
99
- }
100
-
101
- /**
102
- Normalize a given `path` (e.g. turn `'/usr/local/../lib'` into `'/usr/lib'`).
103
-
104
- Also replaces backslashes `\` with slashes `/` and afterwards turns
105
- multiple slashes into a single one.
106
-
107
- If `path` is `null`, the result is unspecified.
108
- */
109
- static normalize(path) {
110
- var slash = "/";
111
- path = path.split("\\").join(slash);
112
- if (path == slash) {
113
- return slash;
114
- };
115
- var target = [];
116
- var _g = 0;
117
- var _g1 = path.split(slash);
118
- while (_g < _g1.length) {
119
- var token = _g1[_g];
120
- ++_g;
121
- if (token == ".." && target.length > 0 && target[target.length - 1] != "..") {
122
- target.pop();
123
- } else if (token == "") {
124
- if (target.length > 0 || HxOverrides.cca(path, 0) == 47) {
125
- target.push(token);
126
- };
127
- } else if (token != ".") {
128
- target.push(token);
129
- };
130
- };
131
- var acc_b = "";
132
- var colon = false;
133
- var slashes = false;
134
- var _g2_offset = 0;
135
- var _g2_s = target.join(slash);
136
- while (_g2_offset < _g2_s.length) {
137
- var s = _g2_s;
138
- var index = _g2_offset++;
139
- var c = s.charCodeAt(index);
140
- if (c >= 55296 && c <= 56319) {
141
- c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023;
142
- };
143
- var c1 = c;
144
- if (c1 >= 65536) {
145
- ++_g2_offset;
146
- };
147
- var c2 = c1;
148
- switch (c2) {
149
- case 47:
150
- if (!colon) {
151
- slashes = true;
152
- } else {
153
- var i = c2;
154
- colon = false;
155
- if (slashes) {
156
- acc_b += "/";
157
- slashes = false;
158
- };
159
- acc_b += String.fromCodePoint(i);
160
- };
161
- break
162
- case 58:
163
- acc_b += ":";
164
- colon = true;
165
- break
166
- default:
167
- var i1 = c2;
168
- colon = false;
169
- if (slashes) {
170
- acc_b += "/";
171
- slashes = false;
172
- };
173
- acc_b += String.fromCodePoint(i1);
174
-
175
- };
176
- };
177
- return acc_b;
178
- }
179
-
180
- /**
181
- Adds a trailing slash to `path`, if it does not have one already.
182
-
183
- If the last slash in `path` is a backslash, a backslash is appended to
184
- `path`.
185
-
186
- If the last slash in `path` is a slash, or if no slash is found, a slash
187
- is appended to `path`. In particular, this applies to the empty String
188
- `""`.
189
-
190
- If `path` is `null`, the result is unspecified.
191
- */
192
- static addTrailingSlash(path) {
193
- if (path.length == 0) {
194
- return "/";
195
- };
196
- var c1 = path.lastIndexOf("/");
197
- var c2 = path.lastIndexOf("\\");
198
- if (c1 < c2) {
199
- if (c2 != path.length - 1) {
200
- return path + "\\";
201
- } else {
202
- return path;
203
- };
204
- } else if (c1 != path.length - 1) {
205
- return path + "/";
206
- } else {
207
- return path;
208
- };
209
- }
210
- static get __name__() {
211
- return "haxe.io.Path"
212
- }
213
- get __class__() {
214
- return Path
215
- }
216
- }
217
-
@@ -1,13 +0,0 @@
1
- import {RouteResult} from "../route/RouteResult"
2
- import {Route, RouteData} from "../route/Route"
3
- import {MaybeArray} from "./MaybeArray"
4
- import {AnyStone} from "../Stone"
5
-
6
- /**
7
- * Anything that can be transformed into `Route`.
8
- */
9
- export type RouteType = Route | MaybeArray<MaybeArray<BaseRouteType>>
10
-
11
- export type BaseRouteType = RouteResult | string | AnyStone
12
-
13
- export const makeRoute: (routeType: RouteType) => Route