Skip to content

How does bun set up JavaScriptCore to run the entry point script file contents? #2398

Closed Answered by Jarred-Sumner
RaisinTen asked this question in Q&A
Discussion options

You must be logged in to vote

This function is where the script execution context is initialized:

bun/src/bun_js.zig

Lines 47 to 66 in 6f59bc7

pub fn boot(ctx_: Command.Context, file: std.fs.File, entry_path: string) !void {
var ctx = ctx_;
JSC.markBinding(@src());
bun.JSC.initialize();
js_ast.Expr.Data.Store.create(default_allocator);
js_ast.Stmt.Data.Store.create(default_allocator);
var arena = try Arena.init();
if (!ctx.debug.loaded_bunfig) {
try bun.CLI.Arguments.loadConfigPath(ctx.allocator, true, "bunfig.toml", &ctx, .RunCommand);
}
run = .{
.vm = try VirtualMachine.init(arena.allocator(), ctx.args, null, ctx.log, null),
.file =

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RaisinTen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants