@shd101wyy/yo 0.1.12 → 0.1.13
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 +10 -1
- package/out/cjs/index.cjs +578 -572
- package/out/cjs/yo-cli.cjs +1413 -592
- package/out/esm/index.mjs +434 -428
- package/out/types/src/build-runner.d.ts +1 -1
- package/out/types/src/doc/builder.d.ts +21 -0
- package/out/types/src/doc/builder.test.d.ts +1 -0
- package/out/types/src/doc/extractor.d.ts +27 -0
- package/out/types/src/doc/extractor.test.d.ts +1 -0
- package/out/types/src/doc/model.d.ts +87 -0
- package/out/types/src/doc/render-html.d.ts +23 -0
- package/out/types/src/doc/render-html.test.d.ts +1 -0
- package/out/types/src/doc/render-json.d.ts +7 -0
- package/out/types/src/doc/render-json.test.d.ts +1 -0
- package/out/types/src/doc/render-markdown.d.ts +13 -0
- package/out/types/src/doc/render-markdown.test.d.ts +1 -0
- package/out/types/src/doc/sections.d.ts +7 -0
- package/out/types/src/doc/sections.test.d.ts +1 -0
- package/out/types/src/doc-command.d.ts +10 -0
- package/out/types/src/env.d.ts +1 -0
- package/out/types/src/evaluator/builtins/build.d.ts +17 -0
- package/out/types/src/evaluator/context.d.ts +1 -0
- package/out/types/src/expr.d.ts +2 -1
- package/out/types/src/token.d.ts +4 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/scripts/build-site.ts +461 -0
- package/std/alg/hash.yo +12 -24
- package/std/allocator.yo +21 -29
- package/std/async.yo +4 -2
- package/std/build.yo +188 -42
- package/std/cli/arg_parser.yo +37 -1
- package/std/collections/array_list.yo +8 -20
- package/std/collections/btree_map.yo +15 -20
- package/std/collections/deque.yo +13 -15
- package/std/collections/hash_map.yo +15 -54
- package/std/collections/hash_set.yo +14 -50
- package/std/collections/linked_list.yo +6 -23
- package/std/collections/priority_queue.yo +15 -17
- package/std/crypto/md5.yo +10 -9
- package/std/crypto/random.yo +14 -12
- package/std/crypto/sha256.yo +9 -8
- package/std/encoding/base64.yo +13 -15
- package/std/encoding/hex.yo +14 -10
- package/std/encoding/html.yo +14 -11
- package/std/encoding/html_char_utils.yo +14 -11
- package/std/encoding/html_entities.yo +7 -8
- package/std/encoding/json.yo +36 -19
- package/std/encoding/punycode.yo +21 -18
- package/std/encoding/toml.yo +23 -9
- package/std/encoding/utf16.yo +16 -9
- package/std/error.yo +10 -23
- package/std/fmt/display.yo +15 -17
- package/std/fmt/index.yo +6 -27
- package/std/fmt/to_string.yo +4 -10
- package/std/fmt/writer.yo +33 -34
- package/std/fs/dir.yo +37 -30
- package/std/fs/file.yo +77 -75
- package/std/fs/metadata.yo +25 -25
- package/std/fs/temp.yo +21 -27
- package/std/fs/types.yo +20 -23
- package/std/fs/walker.yo +26 -31
- package/std/gc.yo +5 -0
- package/std/glob/index.yo +3 -0
- package/std/http/client.yo +25 -11
- package/std/http/http.yo +20 -0
- package/std/http/index.yo +1 -0
- package/std/io/reader.yo +4 -8
- package/std/io/writer.yo +4 -7
- package/std/libc/assert.yo +2 -2
- package/std/libc/ctype.yo +1 -2
- package/std/libc/dirent.yo +1 -2
- package/std/libc/errno.yo +1 -2
- package/std/libc/fcntl.yo +2 -2
- package/std/libc/float.yo +1 -2
- package/std/libc/limits.yo +1 -2
- package/std/libc/math.yo +2 -0
- package/std/libc/signal.yo +1 -2
- package/std/libc/stdatomic.yo +1 -2
- package/std/libc/stdint.yo +4 -3
- package/std/libc/stdio.yo +2 -0
- package/std/libc/stdlib.yo +2 -0
- package/std/libc/string.yo +2 -0
- package/std/libc/sys/stat.yo +1 -2
- package/std/libc/time.yo +2 -2
- package/std/libc/unistd.yo +2 -0
- package/std/libc/wctype.yo +1 -2
- package/std/libc/windows.yo +2 -2
- package/std/log/index.yo +11 -26
- package/std/net/addr.yo +18 -11
- package/std/net/dns.yo +3 -2
- package/std/net/errors.yo +16 -2
- package/std/net/tcp.yo +25 -22
- package/std/net/udp.yo +14 -12
- package/std/os/env.yo +23 -18
- package/std/os/signal.yo +31 -19
- package/std/path.yo +23 -74
- package/std/prelude.yo +284 -113
- package/std/process.yo +23 -37
- package/std/regex/compiler.yo +3 -5
- package/std/regex/flags.yo +11 -11
- package/std/regex/index.yo +2 -13
- package/std/regex/match.yo +3 -5
- package/std/regex/node.yo +6 -6
- package/std/regex/parser.yo +2 -4
- package/std/regex/unicode.yo +5 -5
- package/std/regex/vm.yo +5 -5
- package/std/string/index.yo +2 -1
- package/std/string/rune.yo +25 -1
- package/std/string/string.yo +31 -19
- package/std/string/unicode.yo +14 -15
- package/std/sync/channel.yo +18 -28
- package/std/sync/cond.yo +4 -0
- package/std/sync/mutex.yo +4 -1
- package/std/sync/once.yo +17 -19
- package/std/sync/rwlock.yo +19 -22
- package/std/sync/waitgroup.yo +21 -23
- package/std/sys/advise.yo +4 -4
- package/std/sys/bufio/buf_reader.yo +19 -16
- package/std/sys/bufio/buf_writer.yo +14 -11
- package/std/sys/clock.yo +4 -4
- package/std/sys/constants.yo +5 -5
- package/std/sys/copy.yo +9 -8
- package/std/sys/dir.yo +9 -8
- package/std/sys/dns.yo +8 -8
- package/std/sys/errors.yo +35 -6
- package/std/sys/events.yo +3 -3
- package/std/sys/externs.yo +3 -3
- package/std/sys/fallocate.yo +4 -4
- package/std/sys/fcntl.yo +8 -6
- package/std/sys/file.yo +7 -8
- package/std/sys/future.yo +1 -3
- package/std/sys/iov.yo +4 -4
- package/std/sys/lock.yo +7 -7
- package/std/sys/mmap.yo +7 -8
- package/std/sys/path.yo +4 -7
- package/std/sys/perm.yo +8 -8
- package/std/sys/pipe.yo +9 -8
- package/std/sys/process.yo +8 -8
- package/std/sys/seek.yo +4 -4
- package/std/sys/signal.yo +4 -4
- package/std/sys/signals.yo +4 -4
- package/std/sys/socket.yo +4 -4
- package/std/sys/socketpair.yo +4 -4
- package/std/sys/sockinfo.yo +4 -4
- package/std/sys/statfs.yo +8 -8
- package/std/sys/statx.yo +4 -4
- package/std/sys/sysinfo.yo +4 -4
- package/std/sys/tcp.yo +8 -8
- package/std/sys/temp.yo +9 -8
- package/std/sys/time.yo +8 -8
- package/std/sys/timer.yo +7 -8
- package/std/sys/tty.yo +13 -10
- package/std/sys/udp.yo +8 -8
- package/std/sys/umask.yo +4 -4
- package/std/sys/unix.yo +5 -5
- package/std/testing/bench.yo +21 -10
- package/std/thread.yo +18 -9
- package/std/time/datetime.yo +12 -14
- package/std/time/duration.yo +12 -14
- package/std/time/instant.yo +13 -16
- package/std/time/sleep.yo +9 -8
- package/std/url/index.yo +3 -19
- package/std/worker.yo +10 -18
package/std/url/index.yo
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
// Parse, manipulate, and format URLs per RFC 3986 (simplified).
|
|
4
|
-
//
|
|
5
|
-
// Example:
|
|
6
|
-
// { Url, UrlError } :: import "std/url";
|
|
7
|
-
//
|
|
8
|
-
// url := Url.parse("https://example.com:8080/path?q=1#frag").unwrap();
|
|
9
|
-
// assert(url.scheme() == `https`);
|
|
10
|
-
// assert(url.host() == .Some(`example.com`));
|
|
11
|
-
// assert(url.port() == .Some(u16(8080)));
|
|
12
|
-
// assert(url.path() == `/path`));
|
|
13
|
-
// assert(url.query() == .Some(`q=1`));
|
|
14
|
-
// assert(url.fragment() == .Some(`frag`));
|
|
15
|
-
// println(url.to_string()); // "https://example.com:8080/path?q=1#frag"
|
|
1
|
+
//! URL parsing and formatting per RFC 3986 (simplified).
|
|
16
2
|
|
|
17
3
|
open import "../string";
|
|
18
4
|
{ ArrayList } :: import "../collections/array_list";
|
|
19
5
|
{ ToString } :: import "../fmt";
|
|
20
6
|
{ Error, AnyError, Exception } :: import "../error";
|
|
21
7
|
|
|
22
|
-
|
|
23
|
-
// UrlError
|
|
24
|
-
// ============================================================================
|
|
25
|
-
|
|
8
|
+
/// Errors that can occur during URL parsing.
|
|
26
9
|
UrlError :: enum(
|
|
27
10
|
EmptyInput,
|
|
28
11
|
MissingScheme,
|
|
@@ -101,6 +84,7 @@ _parse_port :: (fn(s: str, start: usize, end: usize, using(exn : Exception)) ->
|
|
|
101
84
|
u16(val)
|
|
102
85
|
});
|
|
103
86
|
|
|
87
|
+
/// Parsed URL with scheme, host, port, path, query, and fragment components.
|
|
104
88
|
Url :: object(
|
|
105
89
|
_scheme : String,
|
|
106
90
|
_host : Option(String),
|
package/std/worker.yo
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// assigned thread (no work stealing).
|
|
6
|
-
//
|
|
7
|
-
// Thread-per-core: By default, one worker thread per CPU core.
|
|
8
|
-
// Thread affinity: Each task runs on a specific worker thread.
|
|
9
|
-
// Thread-local GC: Each worker thread has its own GC heap.
|
|
10
|
-
// Per-thread IO: Each worker thread has its own async event loop, shared by all tasks on that thread.
|
|
1
|
+
//! Thread pool with per-core thread affinity and round-robin task distribution.
|
|
2
|
+
//!
|
|
3
|
+
//! Each task is pinned to a worker thread (no work stealing).
|
|
4
|
+
//! Each worker thread has its own GC heap and async IO event loop.
|
|
11
5
|
|
|
12
6
|
extern "Yo",
|
|
13
7
|
__yo_worker_spawn : (fn(cb : Impl(Fn(using(io : IO)) -> unit, Send)) -> unit),
|
|
@@ -15,22 +9,20 @@ extern "Yo",
|
|
|
15
9
|
__yo_worker_set_num_threads : (fn(num: usize) -> unit)
|
|
16
10
|
;
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// Tasks are distributed round-robin to worker threads.
|
|
21
|
-
// The closure receives the worker thread's IO event loop.
|
|
12
|
+
/// Spawn a task on the thread pool. Returns immediately; the task runs in the background.
|
|
13
|
+
/// Tasks are distributed round-robin to worker threads.
|
|
22
14
|
spawn :: (fn(cb : Impl(Fn(using(io : IO)) -> unit, Send)) -> unit)({
|
|
23
15
|
__yo_worker_spawn(cb);
|
|
24
16
|
});
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
/// Get the number of worker threads in the pool.
|
|
19
|
+
/// Defaults to the number of hardware threads (CPU cores).
|
|
28
20
|
get_num_threads :: (fn() -> usize)(
|
|
29
21
|
__yo_worker_get_num_threads()
|
|
30
22
|
);
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
/// Set the number of worker threads in the pool.
|
|
25
|
+
/// Must be called before the first `spawn` to take effect.
|
|
34
26
|
set_num_threads :: (fn(num: usize) -> unit)(
|
|
35
27
|
__yo_worker_set_num_threads(num)
|
|
36
28
|
);
|