whet 0.0.1
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/LICENSE +21 -0
- package/README.md +47 -0
- package/bin/HxOverrides.d.ts +8 -0
- package/bin/HxOverrides.js +54 -0
- package/bin/Lambda.d.ts +86 -0
- package/bin/Lambda.js +141 -0
- package/bin/Map.d.ts +5 -0
- package/bin/Reflect.d.ts +19 -0
- package/bin/Reflect.js +41 -0
- package/bin/Std.d.ts +49 -0
- package/bin/Std.js +96 -0
- package/bin/StdTypes.d.ts +57 -0
- package/bin/StringTools.d.ts +23 -0
- package/bin/StringTools.js +36 -0
- package/bin/commander/AddHelpTextContext.d.ts +6 -0
- package/bin/commander/AddHelpTextPosition.d.ts +2 -0
- package/bin/commander/CommandOptions.d.ts +6 -0
- package/bin/commander/ErrorOptions.d.ts +11 -0
- package/bin/commander/ExecutableCommandOptions.d.ts +7 -0
- package/bin/commander/HelpContext.d.ts +4 -0
- package/bin/commander/HookEvent.d.ts +2 -0
- package/bin/commander/OptionValueSource.d.ts +2 -0
- package/bin/commander/OutputConfiguration.d.ts +8 -0
- package/bin/commander/ParseOptions.d.ts +4 -0
- package/bin/commander/ParseOptionsResult.d.ts +5 -0
- package/bin/genes/Register.d.ts +15 -0
- package/bin/genes/Register.js +107 -0
- package/bin/genes/util/EsMap.d.ts +12 -0
- package/bin/genes/util/EsMap.js +51 -0
- package/bin/haxe/Constraints.d.ts +8 -0
- package/bin/haxe/Constraints.js +5 -0
- package/bin/haxe/Exception.d.ts +66 -0
- package/bin/haxe/Exception.js +88 -0
- package/bin/haxe/NativeStackTrace.d.ts +7 -0
- package/bin/haxe/PosInfos.d.ts +19 -0
- package/bin/haxe/Rest.d.ts +2 -0
- package/bin/haxe/ValueException.d.ts +24 -0
- package/bin/haxe/ValueException.js +36 -0
- package/bin/haxe/crypto/Crc32.d.ts +12 -0
- package/bin/haxe/crypto/Crc32.js +40 -0
- package/bin/haxe/ds/List.d.ts +31 -0
- package/bin/haxe/ds/List.js +55 -0
- package/bin/haxe/ds/ObjectMap.d.ts +7 -0
- package/bin/haxe/ds/ObjectMap.js +25 -0
- package/bin/haxe/ds/StringMap.d.ts +6 -0
- package/bin/haxe/ds/StringMap.js +25 -0
- package/bin/haxe/exceptions/NotImplementedException.d.ts +10 -0
- package/bin/haxe/exceptions/NotImplementedException.js +27 -0
- package/bin/haxe/exceptions/PosException.d.ts +19 -0
- package/bin/haxe/exceptions/PosException.js +36 -0
- package/bin/haxe/extern/Rest.d.ts +11 -0
- package/bin/haxe/io/ArrayBufferView.d.ts +2 -0
- package/bin/haxe/io/Bytes.d.ts +19 -0
- package/bin/haxe/io/Bytes.js +78 -0
- package/bin/haxe/io/BytesBuffer.d.ts +19 -0
- package/bin/haxe/io/BytesBuffer.js +67 -0
- package/bin/haxe/io/BytesData.d.ts +2 -0
- package/bin/haxe/io/BytesOutput.d.ts +18 -0
- package/bin/haxe/io/BytesOutput.js +39 -0
- package/bin/haxe/io/Encoding.d.ts +20 -0
- package/bin/haxe/io/Encoding.js +20 -0
- package/bin/haxe/io/Error.d.ts +35 -0
- package/bin/haxe/io/Error.js +31 -0
- package/bin/haxe/io/Output.d.ts +63 -0
- package/bin/haxe/io/Output.js +126 -0
- package/bin/haxe/io/Path.d.ts +109 -0
- package/bin/haxe/io/Path.js +217 -0
- package/bin/haxe/io/UInt8Array.d.ts +2 -0
- package/bin/haxe/iterators/ArrayIterator.d.ts +19 -0
- package/bin/haxe/iterators/ArrayIterator.js +35 -0
- package/bin/haxe/macro/Expr.d.ts +331 -0
- package/bin/haxe/macro/Type.d.ts +609 -0
- package/bin/haxe/zip/Compress.d.ts +5 -0
- package/bin/haxe/zip/Compress.js +21 -0
- package/bin/haxe/zip/Entry.d.ts +27 -0
- package/bin/haxe/zip/Entry.js +15 -0
- package/bin/haxe/zip/Tools.d.ts +5 -0
- package/bin/haxe/zip/Tools.js +24 -0
- package/bin/haxe/zip/Writer.d.ts +22 -0
- package/bin/haxe/zip/Writer.js +149 -0
- package/bin/js/Boot.d.ts +18 -0
- package/bin/js/Boot.js +225 -0
- package/bin/js/Node.d.ts +6 -0
- package/bin/js/lib/ArrayBuffer.d.ts +4 -0
- package/bin/js/lib/ArrayBuffer.js +24 -0
- package/bin/js/lib/Iterator.d.ts +23 -0
- package/bin/js/lib/Map.d.ts +2 -0
- package/bin/js/lib/Object.d.ts +82 -0
- package/bin/js/lib/Promise.d.ts +10 -0
- package/bin/js/lib/intl/NumberFormat.d.ts +114 -0
- package/bin/js/node/Buffer.d.ts +3 -0
- package/bin/js/node/ChildProcess.d.ts +424 -0
- package/bin/js/node/Crypto.d.ts +21 -0
- package/bin/js/node/Dns.d.ts +57 -0
- package/bin/js/node/Fs.d.ts +308 -0
- package/bin/js/node/Http.d.ts +114 -0
- package/bin/js/node/Https.d.ts +330 -0
- package/bin/js/node/Iterator.d.ts +5 -0
- package/bin/js/node/Path.d.ts +44 -0
- package/bin/js/node/Process.d.ts +6 -0
- package/bin/js/node/Tls.d.ts +304 -0
- package/bin/js/node/Url.d.ts +126 -0
- package/bin/js/node/Util.d.ts +115 -0
- package/bin/js/node/Zlib.d.ts +29 -0
- package/bin/js/node/buffer/Buffer.d.ts +23 -0
- package/bin/js/node/buffer/Buffer.js +24 -0
- package/bin/js/node/child_process/ChildProcess.d.ts +11 -0
- package/bin/js/node/console/Console.d.ts +26 -0
- package/bin/js/node/http/Agent.d.ts +40 -0
- package/bin/js/node/http/ClientRequest.d.ts +10 -0
- package/bin/js/node/https/Agent.d.ts +50 -0
- package/bin/js/node/net/Server.d.ts +22 -0
- package/bin/js/node/net/Socket.d.ts +101 -0
- package/bin/js/node/stream/Duplex.d.ts +86 -0
- package/bin/js/node/stream/Readable.d.ts +41 -0
- package/bin/js/node/stream/Transform.d.ts +92 -0
- package/bin/js/node/stream/Writable.d.ts +57 -0
- package/bin/js/node/tls/SecureContext.d.ts +74 -0
- package/bin/js/node/tls/TLSSocket.d.ts +47 -0
- package/bin/ts/Undefined.d.ts +5 -0
- package/bin/whet/Log.d.ts +16 -0
- package/bin/whet/Log.js +106 -0
- package/bin/whet/Project.d.ts +33 -0
- package/bin/whet/Project.js +71 -0
- package/bin/whet/Source.d.ts +51 -0
- package/bin/whet/Source.js +136 -0
- package/bin/whet/SourceHash.d.ts +15 -0
- package/bin/whet/SourceHash.js +68 -0
- package/bin/whet/SourceId.d.ts +10 -0
- package/bin/whet/SourceId.js +74 -0
- package/bin/whet/Stone.d.ts +88 -0
- package/bin/whet/Stone.js +157 -0
- package/bin/whet/Utils.d.ts +16 -0
- package/bin/whet/Utils.js +72 -0
- package/bin/whet/Whet.d.ts +4 -0
- package/bin/whet/Whet.js +117 -0
- package/bin/whet/cache/BaseCache.d.ts +27 -0
- package/bin/whet/cache/BaseCache.js +210 -0
- package/bin/whet/cache/Cache.d.ts +72 -0
- package/bin/whet/cache/Cache.js +57 -0
- package/bin/whet/cache/CacheManager.d.ts +23 -0
- package/bin/whet/cache/CacheManager.js +103 -0
- package/bin/whet/cache/FileCache.d.ts +35 -0
- package/bin/whet/cache/FileCache.js +295 -0
- package/bin/whet/cache/MemoryCache.d.ts +12 -0
- package/bin/whet/cache/MemoryCache.js +58 -0
- package/bin/whet/magic/MaybeArray.d.ts +4 -0
- package/bin/whet/magic/MaybeArray.js +25 -0
- package/bin/whet/magic/RoutePathType.d.ts +9 -0
- package/bin/whet/magic/RoutePathType.js +48 -0
- package/bin/whet/magic/RouteType.d.ts +12 -0
- package/bin/whet/magic/RouteType.js +70 -0
- package/bin/whet/magic/StoneId.d.ts +5 -0
- package/bin/whet/magic/StoneId.js +32 -0
- package/bin/whet/route/Route.d.ts +15 -0
- package/bin/whet/route/Route.js +81 -0
- package/bin/whet/route/RouteResult.d.ts +22 -0
- package/bin/whet/route/RouteResult.js +25 -0
- package/bin/whet/route/Router.d.ts +33 -0
- package/bin/whet/route/Router.js +224 -0
- package/bin/whet/stones/Files.d.ts +28 -0
- package/bin/whet/stones/Files.js +86 -0
- package/bin/whet/stones/JsonStone.d.ts +33 -0
- package/bin/whet/stones/JsonStone.js +117 -0
- package/bin/whet/stones/RemoteFile.d.ts +28 -0
- package/bin/whet/stones/RemoteFile.js +71 -0
- package/bin/whet/stones/Server.d.ts +42 -0
- package/bin/whet/stones/Server.js +113 -0
- package/bin/whet/stones/Zip.d.ts +30 -0
- package/bin/whet/stones/Zip.js +111 -0
- package/bin/whet/stones/haxe/HaxeBuild.d.ts +34 -0
- package/bin/whet/stones/haxe/HaxeBuild.js +89 -0
- package/bin/whet/stones/haxe/Hxml.d.ts +102 -0
- package/bin/whet/stones/haxe/Hxml.js +348 -0
- package/bin/whet.d.ts +20 -0
- package/bin/whet.js +18 -0
- package/package.json +32 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {Error as Error__1} from "./Error.js"
|
|
2
|
+
import {Bytes} from "./Bytes.js"
|
|
3
|
+
import {NotImplementedException} from "../exceptions/NotImplementedException.js"
|
|
4
|
+
import {Exception} from "../Exception.js"
|
|
5
|
+
import {Register} from "../../genes/Register.js"
|
|
6
|
+
|
|
7
|
+
const $global = Register.$global
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
An Output is an abstract write. A specific output implementation will only
|
|
11
|
+
have to override the `writeByte` and maybe the `write`, `flush` and `close`
|
|
12
|
+
methods. See `File.write` and `String.write` for two ways of creating an
|
|
13
|
+
Output.
|
|
14
|
+
*/
|
|
15
|
+
export const Output = Register.global("$hxClasses")["haxe.io.Output"] =
|
|
16
|
+
class Output {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
Write one byte.
|
|
20
|
+
*/
|
|
21
|
+
writeByte(c) {
|
|
22
|
+
throw new NotImplementedException(null, null, {"fileName": "haxe/io/Output.hx", "lineNumber": 47, "className": "haxe.io.Output", "methodName": "writeByte"});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
Write `len` bytes from `s` starting by position specified by `pos`.
|
|
27
|
+
|
|
28
|
+
Returns the actual length of written data that can differ from `len`.
|
|
29
|
+
|
|
30
|
+
See `writeFullBytes` that tries to write the exact amount of specified bytes.
|
|
31
|
+
*/
|
|
32
|
+
writeBytes(s, pos, len) {
|
|
33
|
+
if (pos < 0 || len < 0 || pos + len > s.length) {
|
|
34
|
+
throw Exception.thrown(Error__1.OutsideBounds);
|
|
35
|
+
};
|
|
36
|
+
var b = s.b;
|
|
37
|
+
var k = len;
|
|
38
|
+
while (k > 0) {
|
|
39
|
+
this.writeByte(b[pos]);
|
|
40
|
+
++pos;
|
|
41
|
+
--k;
|
|
42
|
+
};
|
|
43
|
+
return len;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
Write all bytes stored in `s`.
|
|
48
|
+
*/
|
|
49
|
+
write(s) {
|
|
50
|
+
var l = s.length;
|
|
51
|
+
var p = 0;
|
|
52
|
+
while (l > 0) {
|
|
53
|
+
var k = this.writeBytes(s, p, l);
|
|
54
|
+
if (k == 0) {
|
|
55
|
+
throw Exception.thrown(Error__1.Blocked);
|
|
56
|
+
};
|
|
57
|
+
p += k;
|
|
58
|
+
l -= k;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
Write `len` bytes from `s` starting by position specified by `pos`.
|
|
64
|
+
|
|
65
|
+
Unlike `writeBytes`, this method tries to write the exact `len` amount of bytes.
|
|
66
|
+
*/
|
|
67
|
+
writeFullBytes(s, pos, len) {
|
|
68
|
+
while (len > 0) {
|
|
69
|
+
var k = this.writeBytes(s, pos, len);
|
|
70
|
+
pos += k;
|
|
71
|
+
len -= k;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
Write `x` as 16-bit unsigned integer.
|
|
77
|
+
|
|
78
|
+
Endianness is specified by the `bigEndian` property.
|
|
79
|
+
*/
|
|
80
|
+
writeUInt16(x) {
|
|
81
|
+
if (x < 0 || x >= 65536) {
|
|
82
|
+
throw Exception.thrown(Error__1.Overflow);
|
|
83
|
+
};
|
|
84
|
+
if (this.bigEndian) {
|
|
85
|
+
this.writeByte(x >> 8);
|
|
86
|
+
this.writeByte(x & 255);
|
|
87
|
+
} else {
|
|
88
|
+
this.writeByte(x & 255);
|
|
89
|
+
this.writeByte(x >> 8);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
Write `x` as 32-bit signed integer.
|
|
95
|
+
|
|
96
|
+
Endianness is specified by the `bigEndian` property.
|
|
97
|
+
*/
|
|
98
|
+
writeInt32(x) {
|
|
99
|
+
if (this.bigEndian) {
|
|
100
|
+
this.writeByte(x >>> 24);
|
|
101
|
+
this.writeByte(x >> 16 & 255);
|
|
102
|
+
this.writeByte(x >> 8 & 255);
|
|
103
|
+
this.writeByte(x & 255);
|
|
104
|
+
} else {
|
|
105
|
+
this.writeByte(x & 255);
|
|
106
|
+
this.writeByte(x >> 8 & 255);
|
|
107
|
+
this.writeByte(x >> 16 & 255);
|
|
108
|
+
this.writeByte(x >>> 24);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
Write `s` string.
|
|
114
|
+
*/
|
|
115
|
+
writeString(s, encoding) {
|
|
116
|
+
var b = Bytes.ofString(s, encoding);
|
|
117
|
+
this.writeFullBytes(b, 0, b.length);
|
|
118
|
+
}
|
|
119
|
+
static get __name__() {
|
|
120
|
+
return "haxe.io.Output"
|
|
121
|
+
}
|
|
122
|
+
get __class__() {
|
|
123
|
+
return Output
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
This iterator is used only when `Array<T>` is passed to `Iterable<T>`
|
|
4
|
+
*/
|
|
5
|
+
export declare class ArrayIterator<T> {
|
|
6
|
+
constructor(array: T[])
|
|
7
|
+
protected array: T[]
|
|
8
|
+
protected current: number
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
See `Iterator.hasNext`
|
|
12
|
+
*/
|
|
13
|
+
hasNext(): boolean
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
See `Iterator.next`
|
|
17
|
+
*/
|
|
18
|
+
next(): T
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {Register} from "../../genes/Register.js"
|
|
2
|
+
|
|
3
|
+
const $global = Register.$global
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
This iterator is used only when `Array<T>` is passed to `Iterable<T>`
|
|
7
|
+
*/
|
|
8
|
+
export const ArrayIterator = Register.global("$hxClasses")["haxe.iterators.ArrayIterator"] =
|
|
9
|
+
class ArrayIterator extends Register.inherits() {
|
|
10
|
+
new(array) {
|
|
11
|
+
this.current = 0;
|
|
12
|
+
this.array = array;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
See `Iterator.hasNext`
|
|
17
|
+
*/
|
|
18
|
+
hasNext() {
|
|
19
|
+
return this.current < this.array.length;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
See `Iterator.next`
|
|
24
|
+
*/
|
|
25
|
+
next() {
|
|
26
|
+
return this.array[this.current++];
|
|
27
|
+
}
|
|
28
|
+
static get __name__() {
|
|
29
|
+
return "haxe.iterators.ArrayIterator"
|
|
30
|
+
}
|
|
31
|
+
get __class__() {
|
|
32
|
+
return ArrayIterator
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|