remove last two master updates and remove proxy

This commit is contained in:
2025-06-23 10:21:07 -05:00
parent 6eb33b8e48
commit 632b038561
3 changed files with 5 additions and 1105 deletions

View File

@@ -40,14 +40,14 @@ function console_rec(line, file, msg) {
var console_mod = cell.hidden.console
var logs = {}
logs.console = function(msg)
globalThis.log = {}
log.console = function(msg)
{
var caller = caller_data(2)
console_mod.print(console_rec(caller.line, caller.file, msg))
}
logs.error = function(msg = new Error())
log.error = function(msg = new Error())
{
var caller = caller_data(4)
@@ -57,21 +57,11 @@ logs.error = function(msg = new Error())
console_mod.print(console_rec(caller.line,caller.file,msg))
}
logs.system = function(msg) {
log.system = function(msg) {
msg = "[SYSTEM] " + msg
log.console(msg)
}
function noop() {}
globalThis.log = new Proxy(logs, {
get(target,prop,receiver) {
if (target[prop])
return (...args) => target[prop](args.join(' '))
return noop
}
})
// Get hidden modules from cell.hidden before stripping it
var hidden = cell.hidden
var actor_mod = hidden.actor

View File

@@ -751,7 +751,6 @@ void script_startup(cell_rt *prt)
JS_AddIntrinsicRegExp(js);
JS_AddIntrinsicJSON(js);
JS_AddIntrinsicMapSet(js);
JS_AddIntrinsicProxy(js);
JS_SetContextOpaque(js, prt);
prt->context = js;
@@ -870,79 +869,6 @@ int main(int argc, char **argv)
int profile_enabled = 0;
int script_start = 1;
/* Check for --script flag - execute script directly without engine */
if (argc > 2 && strcmp(argv[1], "--script") == 0) {
/* Read and execute the script file */
FILE *f = fopen(argv[2], "rb");
if (!f) {
perror("fopen");
return 1;
}
fseek(f, 0, SEEK_END);
long size = ftell(f);
if (size < 0) {
perror("ftell");
fclose(f);
return 1;
}
char *script = malloc(size + 1);
if (!script) {
perror("malloc");
fclose(f);
return 1;
}
rewind(f);
if (fread(script, 1, size, f) != size) {
perror("fread");
free(script);
fclose(f);
return 1;
}
fclose(f);
script[size] = '\0';
/* Create minimal JS runtime */
JSRuntime *rt = JS_NewRuntime();
JSContext *js = JS_NewContextRaw(rt);
/* Add basic intrinsics */
JS_AddIntrinsicBaseObjects(js);
JS_AddIntrinsicEval(js);
JS_AddIntrinsicRegExp(js);
JS_AddIntrinsicJSON(js);
JS_AddIntrinsicMapSet(js);
JS_AddIntrinsicProxy(js);
cell_rt *prt = malloc(sizeof(*prt));
JS_SetContextOpaque(js, prt);
/* Load FFI functions */
ffi_load(js);
/* Execute the script */
JSValue result = JS_Eval(js, script, size, argv[2], 0);
free(script);
/* Check for exceptions */
if (JS_IsException(result)) {
JSValue exp = JS_GetException(js);
const char *str = JS_ToCString(js, exp);
if (str) {
fprintf(stderr, "Exception: %s\n", str);
JS_FreeCString(js, str);
}
JS_FreeValue(js, exp);
}
JS_FreeValue(js, result);
JS_FreeContext(js);
JS_FreeRuntime(rt);
return 0;
}
/* Check for --profile flag */
if (argc > 1 && strcmp(argv[1], "--profile") == 0) {
profile_enabled = 1; script_start = 2;

File diff suppressed because it is too large Load Diff