mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-01 14:08:38 -06:00
Scripting: script.run reports .jsxbin scripts as unsupported (#176)
`effectcraft-cli script FILE` passes the file's text to script.run, which ran a compiled .jsxbin script as JavaScript and failed with "SyntaxError: unexpected '@'" at 1:1, while file.runScript already says .jsxbin isn't supported. script.run now refuses a script named `.jsxbin` or whose text starts with the `@JSXBIN@` header, with file.runScript's message (one shared constant). The check is in the command, so the CLI with or without --bridge, MCP run_script and the Script Console all report it. Tests: engine_entry_points (by header and by name), script_file_and_eval (the CLI exits 1 with the message and no SyntaxError). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
50f26e6a47
commit
3aaa840471
@@ -376,6 +376,12 @@ fn engine_entry_points() {
|
||||
// Scripts can't run scripts.
|
||||
let r = s.execute("script.run", json!({"code": "app.run('script.run', {code: '1'})"})).unwrap();
|
||||
assert!(r["error"]["message"].as_str().unwrap().contains("scripts can't run scripts"), "{r}");
|
||||
// Compiled .jsxbin scripts (by name or by their header) are unsupported, not a SyntaxError
|
||||
// at 1:1 (#176).
|
||||
for p in [json!({"code": "@JSXBIN@ES@2.0@MyBbyBn0AB", "name": "compiled.bin"}), json!({"code": "1", "name": "/x/compiled.JSXBIN"})] {
|
||||
let e = s.execute("script.run", p.clone()).unwrap_err().to_string();
|
||||
assert!(e.contains(".jsxbin scripts are not supported: run the .jsx source"), "{p}: {e}");
|
||||
}
|
||||
// File ▸ Scripts ▸ Run Script File… runs .jsx as JavaScript.
|
||||
let dir = std::env::temp_dir().join(format!("ec-script-file-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user