nomen-lang 0.6.13 → 0.7.0

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 (71) hide show
  1. package/NOMEN_AGENTS.md +27 -13
  2. package/audit_runtime.c +2 -0
  3. package/core/System/Arena.nm +4 -4
  4. package/core/System/Array.nm +108 -78
  5. package/core/System/Atomic.nm +81 -0
  6. package/core/System/Awaitable.nm +12 -5
  7. package/core/System/BigInt.nm +1 -1
  8. package/core/System/Box.nm +32 -0
  9. package/core/System/Buffer.nm +18 -18
  10. package/core/System/Channel.nm +27 -11
  11. package/core/System/ClassBuffer.nm +24 -28
  12. package/core/System/Console.nm +4 -4
  13. package/core/System/Controls/Button.nm +8 -3
  14. package/core/System/Controls/CheckBox.nm +8 -3
  15. package/core/System/Controls/Container.nm +18 -11
  16. package/core/System/Controls/Layout.nm +1 -1
  17. package/core/System/Controls/Text.nm +9 -4
  18. package/core/System/Controls/TextBox.nm +8 -3
  19. package/core/System/Controls/Window.nm +10 -3
  20. package/core/System/Fiber.nm +6 -2
  21. package/core/System/Graph.nm +2 -2
  22. package/core/System/Init.nm +2 -2
  23. package/core/System/LinkedList.nm +2 -2
  24. package/core/System/List.nm +7 -7
  25. package/core/System/Map.nm +10 -7
  26. package/core/System/Math.nm +1 -1
  27. package/core/System/Mutex.nm +14 -2
  28. package/core/System/Random.nm +7 -1
  29. package/core/System/Result.nm +1 -1
  30. package/core/System/Sendable.nm +2 -2
  31. package/core/System/Set.nm +6 -6
  32. package/core/System/Spawnable.nm +9 -9
  33. package/core/System/Stream/Directory.nm +1 -2
  34. package/core/System/Stream/File.nm +8 -9
  35. package/core/System/Stream/Http.nm +2 -3
  36. package/core/System/Stream/Tcp.nm +13 -8
  37. package/core/System/String.nm +22 -12
  38. package/core/System/StringBuilder.nm +2 -2
  39. package/core/System/Task.nm +21 -29
  40. package/core/System/Test.nm +10 -4
  41. package/core/System/Text/CharIndex.nm +2 -3
  42. package/core/System/Text/Json.nm +8 -12
  43. package/core/System/Text/JsonTree.nm +4 -4
  44. package/core/System/Text/Regex.nm +7 -7
  45. package/core/System/Text/Utf8.nm +2 -3
  46. package/core/System/Thread.nm +9 -4
  47. package/core/System/Tree.nm +2 -2
  48. package/core/System/Viewable.nm +2 -2
  49. package/core/System/WeakHandle.nm +56 -0
  50. package/core/System/bool.nm +1 -1
  51. package/core/System/char.nm +1 -1
  52. package/core/System/float.nm +1 -1
  53. package/core/System/float32.nm +1 -1
  54. package/core/System/float64.nm +1 -1
  55. package/core/System/int.nm +1 -1
  56. package/core/System/int16.nm +1 -1
  57. package/core/System/int32.nm +1 -1
  58. package/core/System/int64.nm +1 -1
  59. package/core/System/int8.nm +1 -1
  60. package/core/System/ufloat.nm +1 -1
  61. package/core/System/ufloat32.nm +1 -1
  62. package/core/System/ufloat64.nm +1 -1
  63. package/core/System/uint.nm +1 -1
  64. package/core/System/uint16.nm +1 -1
  65. package/core/System/uint32.nm +1 -1
  66. package/core/System/uint64.nm +1 -1
  67. package/core/System/uint8.nm +1 -1
  68. package/core/docs/System/Result.md +2 -2
  69. package/dist/index.mjs +29031 -25546
  70. package/package.json +1 -1
  71. package/src/test.ts +26 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nomen-lang",
3
- "version": "0.6.13",
3
+ "version": "0.7.0",
4
4
  "description": "The CLI for the Nomen programming language.",
5
5
  "keywords": [],
6
6
  "license": "ISC",
package/src/test.ts CHANGED
@@ -591,9 +591,14 @@ const C = {
591
591
  cyan: (s: string) => `\x1b[36m${s}\x1b[0m`,
592
592
  };
593
593
 
594
- /** Print a vitest-style report for one file's results. */
595
- export function report_file(result: TestFileResult): void {
594
+ /**
595
+ * Print a vitest-style report for one file's results. `progress` (e.g.
596
+ * "[3/24]") is appended to the header line when given — the streaming
597
+ * `runTests` passes a done/total counter so long suites show movement.
598
+ */
599
+ export function report_file(result: TestFileResult, progress?: string): void {
596
600
  const rel = path.relative(process.cwd(), result.file);
601
+ const counter = progress ? ` ${C.dim(progress)}` : "";
597
602
  if (result.crashed && result.tests.length === 0 && result.fails.length === 0) {
598
603
  // Name the stage that actually failed. A binary that linked fine and
599
604
  // then died before emitting any record (e.g. SIGSEGV) is NOT a build
@@ -606,14 +611,14 @@ export function report_file(result: TestFileResult): void {
606
611
  : result.phase === "setup"
607
612
  ? "(setup failed)"
608
613
  : "(failed to build)";
609
- console.log(` ${C.red("✗")} ${rel} ${C.red(label)}`);
614
+ console.log(` ${C.red("✗")} ${rel} ${C.red(label)}${counter}`);
610
615
  console.log(C.red(result.crashed));
611
616
  return;
612
617
  }
613
618
  const totalTests = result.tests.length;
614
619
  const mark = result.ok ? C.green("✓") : C.red("✗");
615
620
  console.log(
616
- ` ${mark} ${rel} ${C.dim(`(${totalTests} tests)`)} ${C.dim(format_duration(result.ms))}`,
621
+ ` ${mark} ${rel} ${C.dim(`(${totalTests} tests)`)} ${C.dim(format_duration(result.ms))}${counter}`,
617
622
  );
618
623
  if (result.crashed) {
619
624
  console.log(C.red(` ${result.crashed}`));
@@ -701,7 +706,13 @@ export async function runTests(root: string, options: RunTestsOptions = {}): Pro
701
706
  const lib = resolve_lib_for(root);
702
707
  const files = collect_test_files(root).filter((f) => !options.filter || options.filter.test(f));
703
708
 
704
- console.log(`Found ${files.length} test file(s)\n`);
709
+ console.log(`Found ${files.length} test file(s)`);
710
+ // Announce everything that will run before the first result lands, so a
711
+ // long suite shows its scope immediately instead of a single counter line.
712
+ for (const file of files) {
713
+ console.log(` ${C.dim(path.relative(process.cwd(), file))}`);
714
+ }
715
+ console.log("");
705
716
 
706
717
  const startTime = performance.now();
707
718
  // The CWD contract: test binaries run in the --in root, so relative
@@ -711,13 +722,16 @@ export async function runTests(root: string, options: RunTestsOptions = {}): Pro
711
722
  // Bounded-concurrency pool: at most `jobs` files are in flight. The
712
723
  // parse/build halves are synchronous (no internal awaits), so they run
713
724
  // atomically on the main thread between the subprocess awaits — the
714
- // compiler's in-process state never interleaves. Results are collected by
715
- // file INDEX and reported after the pool drains, so the report stays in
716
- // discovery order regardless of completion order (and stdout isn't
717
- // interleaved).
725
+ // compiler's in-process state never interleaves. Results are ALSO
726
+ // collected by file INDEX (for the discovery-order summary below), but
727
+ // each finished file reports the moment it lands: `report_file` runs
728
+ // synchronously on the event loop, so its lines can never interleave
729
+ // with another worker's, and a slow file no longer hides the files that
730
+ // finished (or failed) before it.
718
731
  const jobs = Math.max(1, Math.min(options.jobs ?? default_jobs(), files.length));
719
- const results: TestFileResult[] = new Array(files.length);
732
+ const results: TestFileResult[] = Array.from<TestFileResult>({ length: files.length });
720
733
  let next = 0;
734
+ let done = 0;
721
735
  const worker = async (): Promise<void> => {
722
736
  for (;;) {
723
737
  const i = next++;
@@ -731,10 +745,11 @@ export async function runTests(root: string, options: RunTestsOptions = {}): Pro
731
745
  options.release,
732
746
  binary_cwd,
733
747
  );
748
+ done += 1;
749
+ report_file(results[i], `[${done}/${files.length}]`);
734
750
  }
735
751
  };
736
752
  await Promise.all(Array.from({ length: jobs }, worker));
737
- for (const result of results) report_file(result);
738
753
 
739
754
  const elapsed = performance.now() - startTime;
740
755
  const totalFiles = results.length;