@shd101wyy/yo 0.0.4 → 0.0.6

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 (37) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +40 -11
  3. package/out/cjs/index.cjs +14 -14
  4. package/out/cjs/yo-cli.cjs +453 -403
  5. package/out/esm/index.mjs +22 -22
  6. package/out/types/src/codegen/expressions/index.d.ts +0 -1
  7. package/out/types/src/codegen/utils/index.d.ts +5 -3
  8. package/out/types/src/env.d.ts +7 -6
  9. package/out/types/src/error.d.ts +6 -3
  10. package/out/types/src/evaluator/async/await-analysis-types.d.ts +1 -1
  11. package/out/types/src/evaluator/builtins/arc_fns.d.ts +20 -0
  12. package/out/types/src/evaluator/builtins/array_fns.d.ts +8 -0
  13. package/out/types/src/evaluator/builtins/type_fns.d.ts +2 -2
  14. package/out/types/src/evaluator/builtins/var_fns.d.ts +1 -1
  15. package/out/types/src/evaluator/calls/numeric_type.d.ts +4 -0
  16. package/out/types/src/evaluator/types/utils.d.ts +10 -10
  17. package/out/types/src/evaluator/utils.d.ts +1 -1
  18. package/out/types/src/expr.d.ts +9 -4
  19. package/out/types/src/types/creators.d.ts +1 -1
  20. package/out/types/src/types/definitions.d.ts +1 -1
  21. package/out/types/src/types/guards.d.ts +1 -1
  22. package/out/types/src/types/utils.d.ts +3 -2
  23. package/out/types/src/utils.d.ts +3 -1
  24. package/out/types/src/value.d.ts +4 -4
  25. package/out/types/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +15 -2
  27. package/scripts/check-liburing.js +51 -39
  28. package/std/collections/array_list.yo +2 -2
  29. package/std/prelude.yo +272 -189
  30. package/out/types/src/codegen/expressions/array.d.ts +0 -4
  31. package/out/types/src/evaluator/utils/array-utils.d.ts +0 -15
  32. package/out/types/src/tests/codegen.test.d.ts +0 -1
  33. package/out/types/src/tests/module-manager.test.d.ts +0 -1
  34. package/out/types/src/tests/parser.test.d.ts +0 -1
  35. package/out/types/src/tests/sample.test.d.ts +0 -0
  36. package/out/types/src/tests/std.test.d.ts +0 -1
  37. package/std/monad.yo +0 -152
@@ -1,28 +1,30 @@
1
1
  #!/usr/bin/env node
2
+ /* eslint-disable no-undef */
3
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
4
 
3
- const { execSync } = require('child_process');
4
- const os = require('os');
5
- const fs = require('fs');
5
+ const { execSync } = require("child_process");
6
+ const os = require("os");
7
+ const fs = require("fs");
6
8
 
7
9
  function checkLiburing() {
8
10
  const platform = os.platform();
9
-
11
+
10
12
  // Only check on Linux
11
- if (platform !== 'linux') {
12
- console.log('ℹ️ Async I/O with io_uring is only supported on Linux.');
13
+ if (platform !== "linux") {
14
+ console.log("ℹ️ Async I/O with io_uring is only supported on Linux.");
13
15
  return;
14
16
  }
15
17
 
16
18
  try {
17
19
  // Try to find liburing using pkg-config
18
- execSync('pkg-config --exists liburing', { stdio: 'ignore' });
19
- console.log('✅ liburing is installed and available.');
20
+ execSync("pkg-config --exists liburing", { stdio: "ignore" });
21
+ console.log("✅ liburing is installed and available.");
20
22
  return;
21
23
  } catch (error) {
22
24
  // liburing not found via pkg-config, check if library exists
23
25
  try {
24
- execSync('ldconfig -p | grep liburing', { stdio: 'ignore' });
25
- console.log('✅ liburing library found.');
26
+ execSync("ldconfig -p | grep liburing", { stdio: "ignore" });
27
+ console.log("✅ liburing library found.");
26
28
  return;
27
29
  } catch (e) {
28
30
  // Not found at all
@@ -30,46 +32,56 @@ function checkLiburing() {
30
32
  }
31
33
 
32
34
  // liburing not found - show installation instructions
33
- console.log('\n⚠️ liburing not found on your system.');
34
- console.log('📦 Async I/O features require liburing to be installed.\n');
35
-
35
+ console.log("\n⚠️ liburing not found on your system.");
36
+ console.log("📦 Async I/O features require liburing to be installed.\n");
37
+
36
38
  // Detect Linux distribution
37
- let distro = '';
39
+ let distro = "";
38
40
  try {
39
- if (fs.existsSync('/etc/os-release')) {
40
- const osRelease = fs.readFileSync('/etc/os-release', 'utf8');
41
- const idLine = osRelease.split('\n').find(line => line.startsWith('ID='));
41
+ if (fs.existsSync("/etc/os-release")) {
42
+ const osRelease = fs.readFileSync("/etc/os-release", "utf8");
43
+ const idLine = osRelease
44
+ .split("\n")
45
+ .find((line) => line.startsWith("ID="));
42
46
  if (idLine) {
43
- distro = idLine.split('=')[1].replace(/"/g, '').toLowerCase();
47
+ distro = idLine.split("=")[1].replace(/"/g, "").toLowerCase();
44
48
  }
45
49
  }
46
50
  } catch (e) {
47
51
  // Ignore errors
48
52
  }
49
53
 
50
- console.log('Installation instructions:');
51
-
52
- if (distro.includes('ubuntu') || distro.includes('debian')) {
53
- console.log(' Debian/Ubuntu:');
54
- console.log(' sudo apt-get update');
55
- console.log(' sudo apt-get install liburing-dev\n');
56
- } else if (distro.includes('fedora') || distro.includes('rhel') || distro.includes('centos')) {
57
- console.log(' Fedora/RHEL/CentOS:');
58
- console.log(' sudo dnf install liburing-devel\n');
59
- } else if (distro.includes('arch')) {
60
- console.log(' Arch Linux:');
61
- console.log(' sudo pacman -S liburing\n');
62
- } else if (distro.includes('opensuse')) {
63
- console.log(' openSUSE:');
64
- console.log(' sudo zypper install liburing-devel\n');
65
- } else if (distro.includes('alpine')) {
66
- console.log(' Alpine Linux:');
67
- console.log(' sudo apk add liburing-dev\n');
54
+ console.log("Installation instructions:");
55
+
56
+ if (distro.includes("ubuntu") || distro.includes("debian")) {
57
+ console.log(" Debian/Ubuntu:");
58
+ console.log(" sudo apt-get update");
59
+ console.log(" sudo apt-get install liburing-dev\n");
60
+ } else if (
61
+ distro.includes("fedora") ||
62
+ distro.includes("rhel") ||
63
+ distro.includes("centos")
64
+ ) {
65
+ console.log(" Fedora/RHEL/CentOS:");
66
+ console.log(" sudo dnf install liburing-devel\n");
67
+ } else if (distro.includes("arch")) {
68
+ console.log(" Arch Linux:");
69
+ console.log(" sudo pacman -S liburing\n");
70
+ } else if (distro.includes("opensuse")) {
71
+ console.log(" openSUSE:");
72
+ console.log(" sudo zypper install liburing-devel\n");
73
+ } else if (distro.includes("alpine")) {
74
+ console.log(" Alpine Linux:");
75
+ console.log(" sudo apk add liburing-dev\n");
68
76
  } else {
69
- console.log(' Please install liburing-dev (or liburing-devel) for your distribution.\n');
77
+ console.log(
78
+ " Please install liburing-dev (or liburing-devel) for your distribution.\n"
79
+ );
70
80
  }
71
-
72
- console.log('ℹ️ Yo will work without liburing, but async I/O operations will not be available.');
81
+
82
+ console.log(
83
+ "ℹ️ Yo will work without liburing, but async I/O operations will not be available."
84
+ );
73
85
  // console.log(' You can compile with --allocator libc to avoid any io_uring dependencies.\n');
74
86
  }
75
87
 
@@ -254,7 +254,7 @@ ArrayList :: (fn(compt(T): Type) -> compt(Type))
254
254
 
255
255
  _free_elements :: ((fn(self : Self) -> unit)
256
256
  cond(
257
- Type.contains_gc_type(T) => {
257
+ Type.contains_rc_type(T) => {
258
258
  i := usize(0);
259
259
  base_ptr := self._ptr.unwrap();
260
260
  while(i < self._length, i = (i + usize(1)), {
@@ -294,7 +294,7 @@ ArrayList :: (fn(compt(T): Type) -> compt(Type))
294
294
  .Some(ptr) => {
295
295
  // Free elements that will be removed if they contain ARC types
296
296
  cond(
297
- Type.contains_gc_type(T) => {
297
+ Type.contains_rc_type(T) => {
298
298
  i := usize(0);
299
299
  while(i < actual_count, i = (i + usize(1)), {
300
300
  element_ptr := (ptr &+ (start + i));