@tishlang/tish 1.0.13 → 1.0.14

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 (103) hide show
  1. package/crates/js_to_tish/Cargo.toml +4 -2
  2. package/crates/js_to_tish/src/span_util.rs +1 -1
  3. package/crates/js_to_tish/src/transform/expr.rs +15 -15
  4. package/crates/js_to_tish/src/transform/stmt.rs +7 -7
  5. package/crates/js_to_tish/src/transform.rs +1 -1
  6. package/crates/tish/Cargo.toml +22 -22
  7. package/crates/tish/src/main.rs +46 -46
  8. package/crates/tish/src/repl_completion.rs +4 -4
  9. package/crates/tish/tests/integration_test.rs +28 -28
  10. package/crates/tish_ast/Cargo.toml +3 -1
  11. package/crates/tish_ast/src/ast.rs +1 -1
  12. package/crates/tish_build_utils/Cargo.toml +3 -1
  13. package/crates/tish_build_utils/src/lib.rs +18 -6
  14. package/crates/tish_builtins/Cargo.toml +5 -3
  15. package/crates/tish_builtins/src/array.rs +2 -2
  16. package/crates/tish_builtins/src/globals.rs +3 -3
  17. package/crates/tish_builtins/src/helpers.rs +1 -1
  18. package/crates/tish_builtins/src/lib.rs +3 -3
  19. package/crates/tish_builtins/src/math.rs +1 -1
  20. package/crates/tish_builtins/src/object.rs +2 -2
  21. package/crates/tish_builtins/src/string.rs +1 -1
  22. package/crates/tish_bytecode/Cargo.toml +9 -7
  23. package/crates/tish_bytecode/src/chunk.rs +1 -1
  24. package/crates/tish_bytecode/src/compiler.rs +1 -1
  25. package/crates/tish_bytecode/src/encoding.rs +6 -6
  26. package/crates/tish_bytecode/tests/constant_folding.rs +7 -7
  27. package/crates/tish_bytecode/tests/shortcircuit.rs +11 -11
  28. package/crates/tish_bytecode/tests/sort_optimization.rs +3 -3
  29. package/crates/tish_compile/Cargo.toml +6 -4
  30. package/crates/tish_compile/src/codegen.rs +96 -96
  31. package/crates/tish_compile/src/lib.rs +2 -2
  32. package/crates/tish_compile/src/resolve.rs +7 -7
  33. package/crates/tish_compile/src/types.rs +1 -1
  34. package/crates/tish_compile_js/Cargo.toml +8 -6
  35. package/crates/tish_compile_js/src/codegen.rs +12 -12
  36. package/crates/tish_compile_js/src/js_intrinsics.rs +1 -1
  37. package/crates/tish_compile_js/src/lib.rs +2 -2
  38. package/crates/tish_compile_js/src/tests_jsx.rs +2 -2
  39. package/crates/tish_compiler_wasm/Cargo.toml +8 -6
  40. package/crates/tish_compiler_wasm/src/lib.rs +12 -12
  41. package/crates/tish_compiler_wasm/src/resolve_virtual.rs +3 -3
  42. package/crates/tish_core/Cargo.toml +3 -1
  43. package/crates/tish_core/src/lib.rs +1 -1
  44. package/crates/tish_core/src/macros.rs +1 -1
  45. package/crates/tish_core/src/value.rs +1 -1
  46. package/crates/tish_cranelift/Cargo.toml +6 -4
  47. package/crates/tish_cranelift/src/lib.rs +2 -2
  48. package/crates/tish_cranelift/src/link.rs +11 -11
  49. package/crates/tish_cranelift/src/lower.rs +3 -3
  50. package/crates/tish_cranelift_runtime/Cargo.toml +9 -7
  51. package/crates/tish_cranelift_runtime/src/lib.rs +2 -2
  52. package/crates/tish_eval/Cargo.toml +10 -8
  53. package/crates/tish_eval/src/eval.rs +35 -35
  54. package/crates/tish_eval/src/http.rs +1 -1
  55. package/crates/tish_eval/src/lib.rs +3 -3
  56. package/crates/tish_eval/src/natives.rs +2 -2
  57. package/crates/tish_eval/src/regex.rs +2 -2
  58. package/crates/tish_eval/src/value.rs +7 -7
  59. package/crates/tish_eval/src/value_convert.rs +3 -3
  60. package/crates/tish_fmt/Cargo.toml +3 -3
  61. package/crates/tish_fmt/src/bin/tish-fmt.rs +1 -1
  62. package/crates/tish_fmt/src/lib.rs +3 -3
  63. package/crates/tish_jsx_web/Cargo.toml +3 -1
  64. package/crates/tish_lexer/Cargo.toml +3 -1
  65. package/crates/tish_lint/Cargo.toml +3 -3
  66. package/crates/tish_lint/src/bin/tish-lint.rs +3 -3
  67. package/crates/tish_lint/src/lib.rs +15 -15
  68. package/crates/tish_llvm/Cargo.toml +7 -5
  69. package/crates/tish_llvm/src/lib.rs +10 -10
  70. package/crates/tish_lsp/Cargo.toml +5 -5
  71. package/crates/tish_lsp/src/main.rs +35 -35
  72. package/crates/tish_native/Cargo.toml +10 -8
  73. package/crates/tish_native/src/build.rs +8 -8
  74. package/crates/tish_native/src/lib.rs +39 -39
  75. package/crates/tish_opt/Cargo.toml +5 -3
  76. package/crates/tish_opt/src/lib.rs +27 -27
  77. package/crates/tish_parser/Cargo.toml +5 -3
  78. package/crates/tish_parser/src/lib.rs +4 -4
  79. package/crates/tish_parser/src/parser.rs +2 -2
  80. package/crates/tish_runtime/Cargo.toml +7 -5
  81. package/crates/tish_runtime/src/http.rs +1 -1
  82. package/crates/tish_runtime/src/http_fetch.rs +2 -2
  83. package/crates/tish_runtime/src/lib.rs +21 -21
  84. package/crates/tish_runtime/src/native_promise.rs +1 -1
  85. package/crates/tish_runtime/src/promise.rs +2 -2
  86. package/crates/tish_runtime/src/promise_io.rs +1 -1
  87. package/crates/tish_runtime/src/timers.rs +1 -1
  88. package/crates/tish_runtime/src/ws.rs +1 -1
  89. package/crates/tish_runtime/tests/fetch_readable_stream.rs +2 -2
  90. package/crates/tish_vm/Cargo.toml +14 -12
  91. package/crates/tish_vm/src/lib.rs +2 -2
  92. package/crates/tish_vm/src/vm.rs +42 -42
  93. package/crates/tish_wasm/Cargo.toml +8 -6
  94. package/crates/tish_wasm/src/lib.rs +17 -17
  95. package/crates/tish_wasm_runtime/Cargo.toml +9 -7
  96. package/crates/tish_wasm_runtime/src/lib.rs +4 -4
  97. package/justfile +4 -4
  98. package/package.json +1 -1
  99. package/platform/darwin-arm64/tish +0 -0
  100. package/platform/darwin-x64/tish +0 -0
  101. package/platform/linux-arm64/tish +0 -0
  102. package/platform/linux-x64/tish +0 -0
  103. package/platform/win32-x64/tish.exe +0 -0
@@ -5,13 +5,13 @@ use std::collections::HashMap;
5
5
  use std::rc::Rc;
6
6
  use std::sync::Arc;
7
7
 
8
- use tish_ast::{BinOp, UnaryOp};
9
- use tish_builtins::array as arr_builtins;
10
- use tish_builtins::string as str_builtins;
11
- use tish_builtins::globals as globals_builtins;
12
- use tish_builtins::math as math_builtins;
13
- use tish_bytecode::{u8_to_binop, u8_to_unaryop, Chunk, Constant, Opcode, NO_REST_PARAM};
14
- use tish_core::Value;
8
+ use tishlang_ast::{BinOp, UnaryOp};
9
+ use tishlang_builtins::array as arr_builtins;
10
+ use tishlang_builtins::string as str_builtins;
11
+ use tishlang_builtins::globals as globals_builtins;
12
+ use tishlang_builtins::math as math_builtins;
13
+ use tishlang_bytecode::{u8_to_binop, u8_to_unaryop, Chunk, Constant, Opcode, NO_REST_PARAM};
14
+ use tishlang_core::Value;
15
15
 
16
16
  type ArrayMethodFn = Rc<dyn Fn(&[Value]) -> Value>;
17
17
 
@@ -25,12 +25,12 @@ fn get_builtin_export(spec: &str, export_name: &str) -> Option<Value> {
25
25
  #[cfg(feature = "fs")]
26
26
  if spec == "tish:fs" {
27
27
  return match export_name {
28
- "readFile" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::read_file(args)))),
29
- "writeFile" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::write_file(args)))),
30
- "fileExists" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::file_exists(args)))),
31
- "isDir" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::is_dir(args)))),
32
- "readDir" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::read_dir(args)))),
33
- "mkdir" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::mkdir(args)))),
28
+ "readFile" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::read_file(args)))),
29
+ "writeFile" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::write_file(args)))),
30
+ "fileExists" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::file_exists(args)))),
31
+ "isDir" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::is_dir(args)))),
32
+ "readDir" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::read_dir(args)))),
33
+ "mkdir" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::mkdir(args)))),
34
34
  _ => None,
35
35
  };
36
36
  }
@@ -38,15 +38,15 @@ fn get_builtin_export(spec: &str, export_name: &str) -> Option<Value> {
38
38
  if spec == "tish:http" {
39
39
  return match export_name {
40
40
  "fetch" => Some(Value::Function(Rc::new(|args: &[Value]| {
41
- tish_runtime::fetch_promise(args.to_vec())
41
+ tishlang_runtime::fetch_promise(args.to_vec())
42
42
  }))),
43
43
  "fetchAll" => Some(Value::Function(Rc::new(|args: &[Value]| {
44
- tish_runtime::fetch_all_promise(args.to_vec())
44
+ tishlang_runtime::fetch_all_promise(args.to_vec())
45
45
  }))),
46
46
  "serve" => Some(Value::Function(Rc::new(|args: &[Value]| {
47
47
  let handler = args.get(1).cloned().unwrap_or(Value::Null);
48
48
  if let Value::Function(f) = handler {
49
- tish_runtime::http_serve(args, move |req_args| f(req_args))
49
+ tishlang_runtime::http_serve(args, move |req_args| f(req_args))
50
50
  } else {
51
51
  Value::Null
52
52
  }
@@ -57,9 +57,9 @@ fn get_builtin_export(spec: &str, export_name: &str) -> Option<Value> {
57
57
  #[cfg(feature = "process")]
58
58
  if spec == "tish:process" {
59
59
  return match export_name {
60
- "exit" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_exit(args)))),
61
- "cwd" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_cwd(args)))),
62
- "exec" => Some(Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_exec(args)))),
60
+ "exit" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_exit(args)))),
61
+ "cwd" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_cwd(args)))),
62
+ "exec" => Some(Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_exec(args)))),
63
63
  "argv" => Some(Value::Array(Rc::new(RefCell::new(
64
64
  std::env::args().map(|s| Value::String(s.into())).collect(),
65
65
  )))),
@@ -70,9 +70,9 @@ fn get_builtin_export(spec: &str, export_name: &str) -> Option<Value> {
70
70
  )))),
71
71
  "process" => {
72
72
  let mut m = HashMap::new();
73
- m.insert("exit".into(), Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_exit(args))));
74
- m.insert("cwd".into(), Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_cwd(args))));
75
- m.insert("exec".into(), Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_exec(args))));
73
+ m.insert("exit".into(), Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_exit(args))));
74
+ m.insert("cwd".into(), Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_cwd(args))));
75
+ m.insert("exec".into(), Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_exec(args))));
76
76
  m.insert(
77
77
  "argv".into(),
78
78
  Value::Array(Rc::new(RefCell::new(
@@ -96,19 +96,19 @@ fn get_builtin_export(spec: &str, export_name: &str) -> Option<Value> {
96
96
  if spec == "tish:ws" {
97
97
  return match export_name {
98
98
  "WebSocket" => Some(Value::Function(Rc::new(|args: &[Value]| {
99
- tish_runtime::web_socket_client(args)
99
+ tishlang_runtime::web_socket_client(args)
100
100
  }))),
101
101
  "Server" => Some(Value::Function(Rc::new(|args: &[Value]| {
102
- tish_runtime::web_socket_server_construct(args)
102
+ tishlang_runtime::web_socket_server_construct(args)
103
103
  }))),
104
104
  "wsSend" => Some(Value::Function(Rc::new(|args: &[Value]| {
105
- Value::Bool(tish_runtime::ws_send_native(
105
+ Value::Bool(tishlang_runtime::ws_send_native(
106
106
  args.first().unwrap_or(&Value::Null),
107
107
  &args.get(1).map(|v| v.to_display_string()).unwrap_or_default(),
108
108
  ))
109
109
  }))),
110
110
  "wsBroadcast" => Some(Value::Function(Rc::new(|args: &[Value]| {
111
- tish_runtime::ws_broadcast_native(args)
111
+ tishlang_runtime::ws_broadcast_native(args)
112
112
  }))),
113
113
  _ => None,
114
114
  };
@@ -152,7 +152,7 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
152
152
  console.insert(
153
153
  "debug".into(),
154
154
  Value::Function(Rc::new(|args: &[Value]| {
155
- let s = tish_core::format_values_for_console(args, tish_core::use_console_colors());
155
+ let s = tishlang_core::format_values_for_console(args, tishlang_core::use_console_colors());
156
156
  vm_log(&s);
157
157
  Value::Null
158
158
  })),
@@ -160,7 +160,7 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
160
160
  console.insert(
161
161
  "log".into(),
162
162
  Value::Function(Rc::new(|args: &[Value]| {
163
- let s = tish_core::format_values_for_console(args, tish_core::use_console_colors());
163
+ let s = tishlang_core::format_values_for_console(args, tishlang_core::use_console_colors());
164
164
  vm_log(&s);
165
165
  Value::Null
166
166
  })),
@@ -168,7 +168,7 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
168
168
  console.insert(
169
169
  "info".into(),
170
170
  Value::Function(Rc::new(|args: &[Value]| {
171
- let s = tish_core::format_values_for_console(args, tish_core::use_console_colors());
171
+ let s = tishlang_core::format_values_for_console(args, tishlang_core::use_console_colors());
172
172
  vm_log(&s);
173
173
  Value::Null
174
174
  })),
@@ -176,7 +176,7 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
176
176
  console.insert(
177
177
  "warn".into(),
178
178
  Value::Function(Rc::new(|args: &[Value]| {
179
- let s = tish_core::format_values_for_console(args, tish_core::use_console_colors());
179
+ let s = tishlang_core::format_values_for_console(args, tishlang_core::use_console_colors());
180
180
  vm_log_err(&s);
181
181
  Value::Null
182
182
  })),
@@ -184,7 +184,7 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
184
184
  console.insert(
185
185
  "error".into(),
186
186
  Value::Function(Rc::new(|args: &[Value]| {
187
- let s = tish_core::format_values_for_console(args, tish_core::use_console_colors());
187
+ let s = tishlang_core::format_values_for_console(args, tishlang_core::use_console_colors());
188
188
  vm_log_err(&s);
189
189
  Value::Null
190
190
  })),
@@ -262,14 +262,14 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
262
262
  "parse".into(),
263
263
  Value::Function(Rc::new(|args: &[Value]| {
264
264
  let s = args.first().map(|v| v.to_display_string()).unwrap_or_default();
265
- tish_core::json_parse(&s).unwrap_or(Value::Null)
265
+ tishlang_core::json_parse(&s).unwrap_or(Value::Null)
266
266
  })),
267
267
  );
268
268
  json.insert(
269
269
  "stringify".into(),
270
270
  Value::Function(Rc::new(|args: &[Value]| {
271
271
  let v = args.first().unwrap_or(&Value::Null);
272
- Value::String(tish_core::json_stringify(v).into())
272
+ Value::String(tishlang_core::json_stringify(v).into())
273
273
  })),
274
274
  );
275
275
  g.insert("JSON".into(), Value::Object(Rc::new(RefCell::new(json))));
@@ -305,7 +305,7 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
305
305
  );
306
306
  g.insert("Date".into(), Value::Object(Rc::new(RefCell::new(date))));
307
307
 
308
- // Object methods - delegate to tish_builtins::globals
308
+ // Object methods - delegate to tishlang_builtins::globals
309
309
  let mut object_methods = HashMap::new();
310
310
  object_methods.insert(
311
311
  "assign".into(),
@@ -372,15 +372,15 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
372
372
  let mut process_obj = HashMap::new();
373
373
  process_obj.insert(
374
374
  "exit".into(),
375
- Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_exit(args))),
375
+ Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_exit(args))),
376
376
  );
377
377
  process_obj.insert(
378
378
  "cwd".into(),
379
- Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_cwd(args))),
379
+ Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_cwd(args))),
380
380
  );
381
381
  process_obj.insert(
382
382
  "exec".into(),
383
- Value::Function(Rc::new(|args: &[Value]| tish_runtime::process_exec(args))),
383
+ Value::Function(Rc::new(|args: &[Value]| tishlang_runtime::process_exec(args))),
384
384
  );
385
385
  process_obj.insert(
386
386
  "argv".into(),
@@ -406,7 +406,7 @@ fn init_globals() -> HashMap<Arc<str>, Value> {
406
406
  Value::Function(Rc::new(|args: &[Value]| {
407
407
  let handler = args.get(1).cloned().unwrap_or(Value::Null);
408
408
  if let Value::Function(f) = handler {
409
- tish_runtime::http_serve(args, move |req_args| f(req_args))
409
+ tishlang_runtime::http_serve(args, move |req_args| f(req_args))
410
410
  } else {
411
411
  Value::Null
412
412
  }
@@ -1113,8 +1113,8 @@ impl Default for Vm {
1113
1113
  }
1114
1114
 
1115
1115
  fn eval_binop(op: BinOp, l: &Value, r: &Value) -> Result<Value, String> {
1116
- use tish_ast::BinOp::*;
1117
- use tish_core::Value::*;
1116
+ use tishlang_ast::BinOp::*;
1117
+ use tishlang_core::Value::*;
1118
1118
  let ln = l.as_number().unwrap_or(f64::NAN);
1119
1119
  let rn = r.as_number().unwrap_or(f64::NAN);
1120
1120
  match op {
@@ -1165,8 +1165,8 @@ fn eval_binop(op: BinOp, l: &Value, r: &Value) -> Result<Value, String> {
1165
1165
  }
1166
1166
 
1167
1167
  fn eval_unary(op: UnaryOp, o: &Value) -> Result<Value, String> {
1168
- use tish_ast::UnaryOp::*;
1169
- use tish_core::Value::*;
1168
+ use tishlang_ast::UnaryOp::*;
1169
+ use tishlang_core::Value::*;
1170
1170
  match op {
1171
1171
  Not => Ok(Bool(!o.is_truthy())),
1172
1172
  Neg => Ok(Number(-o.as_number().unwrap_or(f64::NAN))),
@@ -1,13 +1,15 @@
1
1
  [package]
2
- name = "tish_wasm"
2
+ name = "tishlang_wasm"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
  description = "WebAssembly backend for Tish - compiles to real .wasm"
6
6
 
7
+ license-file = { workspace = true }
8
+ repository = { workspace = true }
7
9
  [dependencies]
8
- tish_build_utils = { path = "../tish_build_utils" }
9
- tish_ast = { path = "../tish_ast" }
10
- tish_compile = { path = "../tish_compile" }
11
- tish_bytecode = { path = "../tish_bytecode" }
12
- tish_opt = { path = "../tish_opt" }
10
+ tishlang_build_utils = { path = "../tish_build_utils" }
11
+ tishlang_ast = { path = "../tish_ast" }
12
+ tishlang_compile = { path = "../tish_compile" }
13
+ tishlang_bytecode = { path = "../tish_bytecode" }
14
+ tishlang_opt = { path = "../tish_opt" }
13
15
  base64 = "0.22"
@@ -8,9 +8,9 @@ use std::process::Command;
8
8
 
9
9
  use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
10
10
 
11
- use tish_ast::Program;
12
- use tish_bytecode::{serialize, Chunk};
13
- use tish_compile::{
11
+ use tishlang_ast::Program;
12
+ use tishlang_bytecode::{serialize, Chunk};
13
+ use tishlang_compile::{
14
14
  detect_cycles, extract_native_import_features, has_external_native_imports, merge_modules,
15
15
  resolve_project,
16
16
  };
@@ -47,40 +47,40 @@ fn resolve_and_compile_to_chunk(
47
47
  message: e.to_string(),
48
48
  })?;
49
49
  if optimize {
50
- tish_opt::optimize(&prog)
50
+ tishlang_opt::optimize(&prog)
51
51
  } else {
52
52
  prog
53
53
  }
54
54
  };
55
55
  let chunk = if optimize {
56
- tish_bytecode::compile(&program).map_err(|e| WasmError {
56
+ tishlang_bytecode::compile(&program).map_err(|e| WasmError {
57
57
  message: e.to_string(),
58
58
  })?
59
59
  } else {
60
- tish_bytecode::compile_unoptimized(&program).map_err(|e| WasmError {
60
+ tishlang_bytecode::compile_unoptimized(&program).map_err(|e| WasmError {
61
61
  message: e.to_string(),
62
62
  })?
63
63
  };
64
64
  Ok((chunk, program))
65
65
  }
66
66
 
67
- /// Compile a single Program (e.g. from js_to_tish) for WebAssembly.
67
+ /// Compile a single Program (e.g. from tishlang_js_to_tish) for WebAssembly.
68
68
  pub fn compile_program_to_wasm(
69
69
  program: &Program,
70
70
  output_path: &Path,
71
71
  optimize: bool,
72
72
  ) -> Result<(), WasmError> {
73
73
  let program = if optimize {
74
- tish_opt::optimize(program)
74
+ tishlang_opt::optimize(program)
75
75
  } else {
76
76
  program.clone()
77
77
  };
78
78
  let chunk = if optimize {
79
- tish_bytecode::compile(&program).map_err(|e| WasmError {
79
+ tishlang_bytecode::compile(&program).map_err(|e| WasmError {
80
80
  message: e.to_string(),
81
81
  })?
82
82
  } else {
83
- tish_bytecode::compile_unoptimized(&program).map_err(|e| WasmError {
83
+ tishlang_bytecode::compile_unoptimized(&program).map_err(|e| WasmError {
84
84
  message: e.to_string(),
85
85
  })?
86
86
  };
@@ -107,14 +107,14 @@ fn emit_wasm_from_chunk(chunk: &Chunk, output_path: &Path) -> Result<(), WasmErr
107
107
  std::fs::create_dir_all(&out_dir_abs).map_err(|e| WasmError {
108
108
  message: format!("Cannot create output directory: {}", e),
109
109
  })?;
110
- let workspace_root = tish_build_utils::find_workspace_root().map_err(|e| WasmError {
110
+ let workspace_root = tishlang_build_utils::find_workspace_root().map_err(|e| WasmError {
111
111
  message: e,
112
112
  })?;
113
113
  let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_string());
114
114
  let build_status = Command::new(&cargo)
115
115
  .current_dir(&workspace_root)
116
116
  .args([
117
- "build", "-p", "tish_wasm_runtime",
117
+ "build", "-p", "tishlang_wasm_runtime",
118
118
  "--target", "wasm32-unknown-unknown",
119
119
  "--release", "--features", "browser",
120
120
  ])
@@ -127,7 +127,7 @@ fn emit_wasm_from_chunk(chunk: &Chunk, output_path: &Path) -> Result<(), WasmErr
127
127
  });
128
128
  }
129
129
  let wasm_artifact = workspace_root
130
- .join("target/wasm32-unknown-unknown/release/tish_wasm_runtime.wasm");
130
+ .join("target/wasm32-unknown-unknown/release/tishlang_wasm_runtime.wasm");
131
131
  if !wasm_artifact.exists() {
132
132
  return Err(WasmError {
133
133
  message: format!("Wasm artifact not found: {}", wasm_artifact.display()),
@@ -233,7 +233,7 @@ pub fn compile_to_wasi(
233
233
  message: format!("Cannot create output directory: {}", e),
234
234
  })?;
235
235
 
236
- let workspace_root = tish_build_utils::find_workspace_root().map_err(|e| WasmError {
236
+ let workspace_root = tishlang_build_utils::find_workspace_root().map_err(|e| WasmError {
237
237
  message: e,
238
238
  })?;
239
239
 
@@ -248,7 +248,7 @@ pub fn compile_to_wasi(
248
248
  message: format!("Cannot write chunk: {}", e),
249
249
  })?;
250
250
 
251
- // Cargo.toml - path to tish_wasm_runtime from build_dir
251
+ // Cargo.toml - path to tishlang_wasm_runtime (crate in crates/tish_wasm_runtime)
252
252
  let runtime_path = workspace_root
253
253
  .join("crates")
254
254
  .join("tish_wasm_runtime");
@@ -283,7 +283,7 @@ name = "tish_wasi_{stem}"
283
283
  path = "src/main.rs"
284
284
 
285
285
  [dependencies]
286
- tish_wasm_runtime = {{ path = "{runtime_path_str}"{features_str} }}
286
+ tishlang_wasm_runtime = {{ path = "{runtime_path_str}"{features_str} }}
287
287
  "#,
288
288
  stem = stem,
289
289
  runtime_path_str = runtime_path_str,
@@ -297,7 +297,7 @@ tish_wasm_runtime = {{ path = "{runtime_path_str}"{features_str} }}
297
297
  let main_rs = r#"
298
298
  fn main() {
299
299
  let chunk = include_bytes!("../chunk.bin");
300
- if let Err(e) = tish_wasm_runtime::run_wasi(chunk) {
300
+ if let Err(e) = tishlang_wasm_runtime::run_wasi(chunk) {
301
301
  eprintln!("Runtime error: {}", e);
302
302
  std::process::exit(1);
303
303
  }
@@ -1,23 +1,25 @@
1
1
  [package]
2
- name = "tish_wasm_runtime"
2
+ name = "tishlang_wasm_runtime"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
  description = "Tish VM compiled to WebAssembly (browser + Wasmtime/WASI)"
6
+ license-file = { workspace = true }
7
+ repository = { workspace = true }
6
8
 
7
9
  [lib]
8
10
  crate-type = ["cdylib", "rlib"]
9
11
 
10
12
  [features]
11
13
  # For wasm32-unknown-unknown (browser): wasm-bindgen, console output
12
- browser = ["dep:wasm-bindgen", "tish_vm/wasm"]
14
+ browser = ["dep:wasm-bindgen", "tishlang_vm/wasm"]
13
15
  # Built-in modules for WASI (wasm32-wasip1): file I/O, process, http
14
- fs = ["tish_vm/fs"]
15
- process = ["tish_vm/process"]
16
- http = ["tish_vm/http"]
16
+ fs = ["tishlang_vm/fs"]
17
+ process = ["tishlang_vm/process"]
18
+ http = ["tishlang_vm/http"]
17
19
 
18
20
  [dependencies]
19
- tish_bytecode = { path = "../tish_bytecode" }
20
- tish_vm = { path = "../tish_vm" }
21
+ tishlang_bytecode = { path = "../tish_bytecode" }
22
+ tishlang_vm = { path = "../tish_vm" }
21
23
  wasm-bindgen = { version = "0.2", optional = true }
22
24
 
23
25
  # rand_core → getrandom 0.4 needs wasm_js on wasm32-unknown-unknown (browser VM build).
@@ -4,12 +4,12 @@
4
4
  //! - **Browser** (wasm32-unknown-unknown): use `--features browser`, wasm-bindgen, console output
5
5
  //! - **WASI/Wasmtime** (wasm32-wasi): no features, println! via WASI, run with `wasmtime app.wasm`
6
6
 
7
- use tish_bytecode::deserialize;
8
- use tish_vm::Vm;
7
+ use tishlang_bytecode::deserialize;
8
+ use tishlang_vm::Vm;
9
9
 
10
10
  /// Run serialized Tish bytecode (WASI/Wasmtime or native).
11
11
  ///
12
- /// `chunk` is the output of `tish_bytecode::serialize(chunk)`.
12
+ /// `chunk` is the output of `tishlang_bytecode::serialize(chunk)`.
13
13
  /// Uses println! for output (WASI fd_write when built for wasm32-wasi).
14
14
  #[cfg(not(feature = "browser"))]
15
15
  pub fn run_wasi(chunk: &[u8]) -> Result<(), String> {
@@ -21,7 +21,7 @@ pub fn run_wasi(chunk: &[u8]) -> Result<(), String> {
21
21
 
22
22
  /// Run serialized Tish bytecode in the browser.
23
23
  ///
24
- /// `chunk` is the output of `tish_bytecode::serialize(chunk)`.
24
+ /// `chunk` is the output of `tishlang_bytecode::serialize(chunk)`.
25
25
  /// Errors are returned as a JsValue (string).
26
26
  #[cfg(feature = "browser")]
27
27
  use wasm_bindgen::prelude::*;
package/justfile CHANGED
@@ -144,12 +144,12 @@ test-secure:
144
144
  cargo test --no-default-features
145
145
 
146
146
  # Install tish CLI (secure mode - no dangerous features)
147
- install:
148
- cargo install --path crates/tish --no-default-features
147
+ install *ARGS:
148
+ cargo install --path crates/tish --no-default-features {{ARGS}}
149
149
 
150
150
  # Install tish CLI with all features
151
- install-full:
152
- cargo install --path crates/tish --features full
151
+ install-full *ARGS:
152
+ cargo install --path crates/tish --features full {{ARGS}}
153
153
 
154
154
  # Check compilation for all feature combinations
155
155
  check-all:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tishlang/tish",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Tish - minimal TS/JS-compatible language. Run, REPL, compile to native.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
Binary file
Binary file
Binary file
Binary file
Binary file