- removed the 'use strip' extension

- removed the JS_EVAL_FLAG_STRIP eval flag and replaced it with JS_SetStripInfo() which has simpler semantics.
- qjs: added the '-s' and '--strip-source' options
- qjsc: added the '-s' and '--keep-source' options
This commit is contained in:
Fabrice Bellard
2025-04-12 12:14:37 +02:00
parent c50de13b15
commit 67b48ae4e6
9 changed files with 207 additions and 87 deletions

View File

@@ -3220,6 +3220,7 @@ typedef struct {
char *filename; /* module filename */
char *basename; /* module base name */
JSWorkerMessagePipe *recv_pipe, *send_pipe;
int strip_flags;
} WorkerFuncArgs;
typedef struct {
@@ -3367,6 +3368,7 @@ static void *worker_func(void *opaque)
fprintf(stderr, "JS_NewRuntime failure");
exit(1);
}
JS_SetStripInfo(rt, args->strip_flags);
js_std_init_handlers(rt);
JS_SetModuleLoaderFunc(rt, NULL, js_module_loader, NULL);
@@ -3484,6 +3486,8 @@ static JSValue js_worker_ctor(JSContext *ctx, JSValueConst new_target,
if (!args->send_pipe)
goto oom_fail;
args->strip_flags = JS_GetStripInfo(rt);
obj = js_worker_ctor_internal(ctx, new_target,
args->send_pipe, args->recv_pipe);
if (JS_IsException(obj))