mustardscript 0.1.0 → 0.1.2
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 +65 -22
- package/SECURITY.md +1 -1
- package/dist/index.js +2 -0
- package/dist/lib/executor.js +16 -1
- package/dist/lib/policy.js +301 -22
- package/dist/lib/progress.js +499 -113
- package/dist/lib/runtime.js +109 -40
- package/dist/lib/structured.js +327 -11
- package/dist/native-loader.js +11 -12
- package/index.d.ts +54 -6
- package/mustard.d.ts +23 -1
- package/package.json +34 -25
- package/Cargo.lock +0 -1579
- package/Cargo.toml +0 -40
- package/crates/mustard/Cargo.toml +0 -31
- package/crates/mustard/src/cancellation.rs +0 -28
- package/crates/mustard/src/diagnostic.rs +0 -145
- package/crates/mustard/src/ir.rs +0 -435
- package/crates/mustard/src/lib.rs +0 -21
- package/crates/mustard/src/limits.rs +0 -22
- package/crates/mustard/src/parser/expressions.rs +0 -723
- package/crates/mustard/src/parser/mod.rs +0 -115
- package/crates/mustard/src/parser/operators.rs +0 -105
- package/crates/mustard/src/parser/patterns.rs +0 -123
- package/crates/mustard/src/parser/scope.rs +0 -107
- package/crates/mustard/src/parser/statements.rs +0 -298
- package/crates/mustard/src/parser/tests/acceptance.rs +0 -339
- package/crates/mustard/src/parser/tests/mod.rs +0 -2
- package/crates/mustard/src/parser/tests/rejections.rs +0 -107
- package/crates/mustard/src/runtime/accounting.rs +0 -613
- package/crates/mustard/src/runtime/api.rs +0 -192
- package/crates/mustard/src/runtime/async_runtime/mod.rs +0 -5
- package/crates/mustard/src/runtime/async_runtime/promises.rs +0 -246
- package/crates/mustard/src/runtime/async_runtime/reactions.rs +0 -400
- package/crates/mustard/src/runtime/async_runtime/scheduler.rs +0 -224
- package/crates/mustard/src/runtime/builtins/arrays.rs +0 -1205
- package/crates/mustard/src/runtime/builtins/collections.rs +0 -573
- package/crates/mustard/src/runtime/builtins/install.rs +0 -501
- package/crates/mustard/src/runtime/builtins/intl.rs +0 -553
- package/crates/mustard/src/runtime/builtins/mod.rs +0 -25
- package/crates/mustard/src/runtime/builtins/objects.rs +0 -405
- package/crates/mustard/src/runtime/builtins/primitives.rs +0 -859
- package/crates/mustard/src/runtime/builtins/promises.rs +0 -335
- package/crates/mustard/src/runtime/builtins/regexp.rs +0 -356
- package/crates/mustard/src/runtime/builtins/strings.rs +0 -803
- package/crates/mustard/src/runtime/builtins/support.rs +0 -561
- package/crates/mustard/src/runtime/bytecode.rs +0 -123
- package/crates/mustard/src/runtime/compiler/assignments.rs +0 -690
- package/crates/mustard/src/runtime/compiler/bindings.rs +0 -92
- package/crates/mustard/src/runtime/compiler/context.rs +0 -46
- package/crates/mustard/src/runtime/compiler/control.rs +0 -342
- package/crates/mustard/src/runtime/compiler/expressions.rs +0 -372
- package/crates/mustard/src/runtime/compiler/mod.rs +0 -173
- package/crates/mustard/src/runtime/compiler/statements.rs +0 -459
- package/crates/mustard/src/runtime/conversions/boundary.rs +0 -293
- package/crates/mustard/src/runtime/conversions/coercions.rs +0 -217
- package/crates/mustard/src/runtime/conversions/errors.rs +0 -118
- package/crates/mustard/src/runtime/conversions/mod.rs +0 -14
- package/crates/mustard/src/runtime/conversions/operators.rs +0 -334
- package/crates/mustard/src/runtime/env.rs +0 -355
- package/crates/mustard/src/runtime/exceptions.rs +0 -377
- package/crates/mustard/src/runtime/gc.rs +0 -595
- package/crates/mustard/src/runtime/mod.rs +0 -318
- package/crates/mustard/src/runtime/properties.rs +0 -1762
- package/crates/mustard/src/runtime/serialization.rs +0 -127
- package/crates/mustard/src/runtime/shared.rs +0 -108
- package/crates/mustard/src/runtime/snapshot_validation_tests.rs +0 -93
- package/crates/mustard/src/runtime/state.rs +0 -652
- package/crates/mustard/src/runtime/tests/async_host.rs +0 -104
- package/crates/mustard/src/runtime/tests/collections.rs +0 -50
- package/crates/mustard/src/runtime/tests/diagnostics.rs +0 -36
- package/crates/mustard/src/runtime/tests/exceptions.rs +0 -122
- package/crates/mustard/src/runtime/tests/execution.rs +0 -553
- package/crates/mustard/src/runtime/tests/gc.rs +0 -533
- package/crates/mustard/src/runtime/tests/mod.rs +0 -56
- package/crates/mustard/src/runtime/tests/serialization.rs +0 -170
- package/crates/mustard/src/runtime/validation/bytecode.rs +0 -484
- package/crates/mustard/src/runtime/validation/mod.rs +0 -14
- package/crates/mustard/src/runtime/validation/policy.rs +0 -94
- package/crates/mustard/src/runtime/validation/snapshot.rs +0 -406
- package/crates/mustard/src/runtime/validation/walk.rs +0 -206
- package/crates/mustard/src/runtime/vm.rs +0 -1016
- package/crates/mustard/src/span.rs +0 -22
- package/crates/mustard/src/structured.rs +0 -107
- package/crates/mustard-bridge/Cargo.toml +0 -17
- package/crates/mustard-bridge/src/codec.rs +0 -46
- package/crates/mustard-bridge/src/dto.rs +0 -99
- package/crates/mustard-bridge/src/lib.rs +0 -12
- package/crates/mustard-bridge/src/operations.rs +0 -142
- package/crates/mustard-node/Cargo.toml +0 -24
- package/crates/mustard-node/build.rs +0 -3
- package/crates/mustard-node/src/lib.rs +0 -236
- package/crates/mustard-sidecar/Cargo.toml +0 -21
- package/crates/mustard-sidecar/src/lib.rs +0 -134
- package/crates/mustard-sidecar/src/main.rs +0 -36
- package/dist/install.js +0 -117
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
use crate::compile;
|
|
2
|
-
|
|
3
|
-
fn assert_validation_reject(source: &str, message: &str) {
|
|
4
|
-
let error = compile(source).expect_err("source should fail validation");
|
|
5
|
-
assert!(error.to_string().contains(message));
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
#[test]
|
|
9
|
-
fn rejects_forbidden_free_require() {
|
|
10
|
-
let error = compile("require('fs');").expect_err("should reject forbidden global");
|
|
11
|
-
let text = error.to_string();
|
|
12
|
-
assert!(text.contains("forbidden ambient global `require`"));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
#[test]
|
|
16
|
-
fn rejects_free_eval() {
|
|
17
|
-
let error = compile("eval('1 + 1');").expect_err("should reject eval");
|
|
18
|
-
let text = error.to_string();
|
|
19
|
-
assert!(text.contains("forbidden ambient global `eval`"));
|
|
20
|
-
assert!(text.contains("[0..4]"));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
#[test]
|
|
24
|
-
fn rejects_free_function_constructor() {
|
|
25
|
-
let error = compile("new Function('return 1;');").expect_err("should reject Function");
|
|
26
|
-
let text = error.to_string();
|
|
27
|
-
assert!(text.contains("forbidden ambient global `Function`"));
|
|
28
|
-
assert!(text.contains("[4..12]"));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
#[test]
|
|
32
|
-
fn rejects_free_arguments() {
|
|
33
|
-
let error =
|
|
34
|
-
compile("function wrap() { return arguments[0]; }").expect_err("should reject arguments");
|
|
35
|
-
let text = error.to_string();
|
|
36
|
-
assert!(text.contains("forbidden ambient global `arguments`"));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
#[test]
|
|
40
|
-
fn rejects_module_syntax() {
|
|
41
|
-
let error = compile("export const x = 1;").expect_err("module syntax should fail");
|
|
42
|
-
assert!(error.to_string().contains("module syntax"));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
#[test]
|
|
46
|
-
fn rejects_meta_properties_even_near_supported_spread_constructs() {
|
|
47
|
-
assert_validation_reject(
|
|
48
|
-
"new.target(...values);",
|
|
49
|
-
"meta properties are not supported",
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
#[test]
|
|
54
|
-
fn rejects_delete_operator() {
|
|
55
|
-
let error = compile("delete record.value;").expect_err("delete should fail");
|
|
56
|
-
let text = error.to_string();
|
|
57
|
-
assert!(text.contains("delete is not supported in v1"));
|
|
58
|
-
assert!(text.contains("[0..19]"));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
#[test]
|
|
62
|
-
fn rejects_delete_on_array_elements() {
|
|
63
|
-
assert_validation_reject("delete values[0];", "delete is not supported in v1");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
#[test]
|
|
67
|
-
fn rejects_var_declarations() {
|
|
68
|
-
assert_validation_reject("var value = 1;", "only let and const are supported");
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
#[test]
|
|
72
|
-
fn rejects_duplicate_lexical_declarations() {
|
|
73
|
-
assert_validation_reject("let value = 1; let value = 2;", "already been declared");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#[test]
|
|
77
|
-
fn rejects_duplicate_function_and_lexical_bindings_in_the_same_scope() {
|
|
78
|
-
assert_validation_reject(
|
|
79
|
-
"function value() {} const value = 1;",
|
|
80
|
-
"already been declared",
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
#[test]
|
|
85
|
-
fn rejects_function_scoped_var_declarations() {
|
|
86
|
-
assert_validation_reject(
|
|
87
|
-
"function wrap() { var value = 1; return value; }",
|
|
88
|
-
"only let and const are supported",
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
#[test]
|
|
93
|
-
fn rejects_additional_unsupported_assignment_operators() {
|
|
94
|
-
let source = "let value = 2; value &= 3;";
|
|
95
|
-
assert_validation_reject(source, "unsupported assignment operator in v1");
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
#[test]
|
|
99
|
-
fn rejects_object_literal_accessors() {
|
|
100
|
-
let error = compile("({ get value() { return 1; } });")
|
|
101
|
-
.expect_err("object literal accessors should fail closed");
|
|
102
|
-
assert!(
|
|
103
|
-
error
|
|
104
|
-
.to_string()
|
|
105
|
-
.contains("object literal accessors are not supported in v1")
|
|
106
|
-
);
|
|
107
|
-
}
|