@shd101wyy/yo 0.1.11 → 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.
Files changed (166) hide show
  1. package/README.md +10 -1
  2. package/out/cjs/index.cjs +579 -573
  3. package/out/cjs/yo-cli.cjs +1413 -592
  4. package/out/esm/index.mjs +437 -431
  5. package/out/types/src/build-runner.d.ts +1 -1
  6. package/out/types/src/doc/builder.d.ts +21 -0
  7. package/out/types/src/doc/builder.test.d.ts +1 -0
  8. package/out/types/src/doc/extractor.d.ts +27 -0
  9. package/out/types/src/doc/extractor.test.d.ts +1 -0
  10. package/out/types/src/doc/model.d.ts +87 -0
  11. package/out/types/src/doc/render-html.d.ts +23 -0
  12. package/out/types/src/doc/render-html.test.d.ts +1 -0
  13. package/out/types/src/doc/render-json.d.ts +7 -0
  14. package/out/types/src/doc/render-json.test.d.ts +1 -0
  15. package/out/types/src/doc/render-markdown.d.ts +13 -0
  16. package/out/types/src/doc/render-markdown.test.d.ts +1 -0
  17. package/out/types/src/doc/sections.d.ts +7 -0
  18. package/out/types/src/doc/sections.test.d.ts +1 -0
  19. package/out/types/src/doc-command.d.ts +10 -0
  20. package/out/types/src/env.d.ts +1 -0
  21. package/out/types/src/evaluator/builtins/build.d.ts +17 -0
  22. package/out/types/src/evaluator/context.d.ts +1 -0
  23. package/out/types/src/evaluator/exprs/import.d.ts +2 -0
  24. package/out/types/src/expr.d.ts +2 -1
  25. package/out/types/src/tests/import-path.test.d.ts +1 -0
  26. package/out/types/src/token.d.ts +4 -0
  27. package/out/types/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +2 -1
  29. package/scripts/build-site.ts +461 -0
  30. package/std/alg/hash.yo +12 -24
  31. package/std/allocator.yo +21 -29
  32. package/std/async.yo +4 -2
  33. package/std/build.yo +188 -42
  34. package/std/cli/arg_parser.yo +37 -1
  35. package/std/collections/array_list.yo +8 -20
  36. package/std/collections/btree_map.yo +15 -20
  37. package/std/collections/deque.yo +13 -15
  38. package/std/collections/hash_map.yo +15 -54
  39. package/std/collections/hash_set.yo +14 -50
  40. package/std/collections/linked_list.yo +6 -23
  41. package/std/collections/priority_queue.yo +15 -17
  42. package/std/crypto/md5.yo +10 -9
  43. package/std/crypto/random.yo +14 -12
  44. package/std/crypto/sha256.yo +9 -8
  45. package/std/encoding/base64.yo +13 -15
  46. package/std/encoding/hex.yo +14 -10
  47. package/std/encoding/html.yo +14 -11
  48. package/std/encoding/html_char_utils.yo +14 -11
  49. package/std/encoding/html_entities.yo +7 -8
  50. package/std/encoding/json.yo +36 -19
  51. package/std/encoding/punycode.yo +21 -18
  52. package/std/encoding/toml.yo +23 -9
  53. package/std/encoding/utf16.yo +16 -9
  54. package/std/error.yo +10 -23
  55. package/std/fmt/display.yo +15 -17
  56. package/std/fmt/index.yo +6 -27
  57. package/std/fmt/to_string.yo +4 -10
  58. package/std/fmt/writer.yo +33 -34
  59. package/std/fs/dir.yo +37 -30
  60. package/std/fs/file.yo +77 -75
  61. package/std/fs/metadata.yo +25 -25
  62. package/std/fs/temp.yo +21 -27
  63. package/std/fs/types.yo +20 -23
  64. package/std/fs/walker.yo +26 -31
  65. package/std/gc.yo +5 -0
  66. package/std/glob/index.yo +3 -0
  67. package/std/http/client.yo +25 -11
  68. package/std/http/http.yo +20 -0
  69. package/std/http/index.yo +1 -0
  70. package/std/io/reader.yo +4 -8
  71. package/std/io/writer.yo +4 -7
  72. package/std/libc/assert.yo +2 -2
  73. package/std/libc/ctype.yo +1 -2
  74. package/std/libc/dirent.yo +1 -2
  75. package/std/libc/errno.yo +1 -2
  76. package/std/libc/fcntl.yo +2 -2
  77. package/std/libc/float.yo +1 -2
  78. package/std/libc/limits.yo +1 -2
  79. package/std/libc/math.yo +2 -0
  80. package/std/libc/signal.yo +1 -2
  81. package/std/libc/stdatomic.yo +1 -2
  82. package/std/libc/stdint.yo +4 -3
  83. package/std/libc/stdio.yo +2 -0
  84. package/std/libc/stdlib.yo +2 -0
  85. package/std/libc/string.yo +2 -0
  86. package/std/libc/sys/stat.yo +1 -2
  87. package/std/libc/time.yo +2 -2
  88. package/std/libc/unistd.yo +2 -0
  89. package/std/libc/wctype.yo +1 -2
  90. package/std/libc/windows.yo +2 -2
  91. package/std/log/index.yo +11 -26
  92. package/std/net/addr.yo +18 -11
  93. package/std/net/dns.yo +3 -2
  94. package/std/net/errors.yo +16 -2
  95. package/std/net/tcp.yo +25 -22
  96. package/std/net/udp.yo +14 -12
  97. package/std/os/env.yo +23 -18
  98. package/std/os/signal.yo +31 -19
  99. package/std/path.yo +23 -74
  100. package/std/prelude.yo +284 -113
  101. package/std/process.yo +23 -37
  102. package/std/regex/compiler.yo +3 -5
  103. package/std/regex/flags.yo +11 -11
  104. package/std/regex/index.yo +2 -13
  105. package/std/regex/match.yo +3 -5
  106. package/std/regex/node.yo +6 -6
  107. package/std/regex/parser.yo +2 -4
  108. package/std/regex/unicode.yo +5 -5
  109. package/std/regex/vm.yo +5 -5
  110. package/std/string/index.yo +2 -1
  111. package/std/string/rune.yo +25 -1
  112. package/std/string/string.yo +31 -19
  113. package/std/string/unicode.yo +14 -15
  114. package/std/sync/channel.yo +18 -28
  115. package/std/sync/cond.yo +4 -0
  116. package/std/sync/mutex.yo +4 -1
  117. package/std/sync/once.yo +17 -19
  118. package/std/sync/rwlock.yo +19 -22
  119. package/std/sync/waitgroup.yo +21 -23
  120. package/std/sys/advise.yo +4 -4
  121. package/std/sys/bufio/buf_reader.yo +19 -16
  122. package/std/sys/bufio/buf_writer.yo +14 -11
  123. package/std/sys/clock.yo +4 -4
  124. package/std/sys/constants.yo +5 -5
  125. package/std/sys/copy.yo +9 -8
  126. package/std/sys/dir.yo +9 -8
  127. package/std/sys/dns.yo +8 -8
  128. package/std/sys/errors.yo +35 -6
  129. package/std/sys/events.yo +3 -3
  130. package/std/sys/externs.yo +3 -3
  131. package/std/sys/fallocate.yo +4 -4
  132. package/std/sys/fcntl.yo +8 -6
  133. package/std/sys/file.yo +7 -8
  134. package/std/sys/future.yo +1 -3
  135. package/std/sys/iov.yo +4 -4
  136. package/std/sys/lock.yo +7 -7
  137. package/std/sys/mmap.yo +7 -8
  138. package/std/sys/path.yo +4 -7
  139. package/std/sys/perm.yo +8 -8
  140. package/std/sys/pipe.yo +9 -8
  141. package/std/sys/process.yo +8 -8
  142. package/std/sys/seek.yo +4 -4
  143. package/std/sys/signal.yo +4 -4
  144. package/std/sys/signals.yo +4 -4
  145. package/std/sys/socket.yo +4 -4
  146. package/std/sys/socketpair.yo +4 -4
  147. package/std/sys/sockinfo.yo +4 -4
  148. package/std/sys/statfs.yo +8 -8
  149. package/std/sys/statx.yo +4 -4
  150. package/std/sys/sysinfo.yo +4 -4
  151. package/std/sys/tcp.yo +8 -8
  152. package/std/sys/temp.yo +9 -8
  153. package/std/sys/time.yo +8 -8
  154. package/std/sys/timer.yo +7 -8
  155. package/std/sys/tty.yo +13 -10
  156. package/std/sys/udp.yo +8 -8
  157. package/std/sys/umask.yo +4 -4
  158. package/std/sys/unix.yo +5 -5
  159. package/std/testing/bench.yo +21 -10
  160. package/std/thread.yo +18 -9
  161. package/std/time/datetime.yo +12 -14
  162. package/std/time/duration.yo +12 -14
  163. package/std/time/instant.yo +13 -16
  164. package/std/time/sleep.yo +9 -8
  165. package/std/url/index.yo +3 -19
  166. package/std/worker.yo +10 -18
package/std/url/index.yo CHANGED
@@ -1,28 +1,11 @@
1
- // std/url - URL parsing and formatting
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
- // Worker - Thread Pool with Thread Affinity
2
- // ==========================================
3
- // Worker spawns tasks on a thread pool. Each task has thread affinity:
4
- // tasks are distributed round-robin to worker threads and stay on their
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
- // Spawn a task on the thread pool.
19
- // Returns immediately, task runs in background.
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
- // Get number of threads in pool.
27
- // Default: number of hardware threads (CPU cores).
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
- // Configure thread pool size.
33
- // Must be called before first spawn to take effect.
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
  );