From f759f149377942c4e04802c45162cda1c9bfb2b3 Mon Sep 17 00:00:00 2001 From: t Date: Sat, 4 Jul 2026 09:50:12 -0600 Subject: big cli/tui gaps project --- src/luarocks_runtime.zig | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/luarocks_runtime.zig') diff --git a/src/luarocks_runtime.zig b/src/luarocks_runtime.zig index 96b2e37..1611778 100644 --- a/src/luarocks_runtime.zig +++ b/src/luarocks_runtime.zig @@ -61,6 +61,19 @@ pub const LuarocksRuntime = struct { self.layout.deinit(); self.allocator.destroy(self); } + + /// Wire one `lua_State` with the per-state half of the bootstrap: the + /// embedded luarocks searcher, the injected `luarocks.core.hardcoded`, + /// and the tree's `package.path`/`package.cpath` entries. `bootstrap` + /// runs this on its own state; each per-session interpreter (whose + /// lifetime is the session — see `extension_loader.zig`) gets the same + /// wiring so `require` resolves the staged `panto.so` and installed + /// rocks. Disk-side staging is process-level and NOT repeated here. + pub fn attachState(self: *LuarocksRuntime, L: *c.lua_State) !void { + try installEmbeddedSearcher(L, &self.modules); + try injectHardcoded(L, self.layout); + try configurePackagePaths(self.allocator, L, self.layout); + } }; /// Errors surfaced by the bootstrap pipeline. The `Luarocks*` variants @@ -164,9 +177,7 @@ pub fn bootstrap( self.modules.putAssumeCapacityNoClobber(entry.name, entry.contents); } - try installEmbeddedSearcher(L, &self.modules); - try injectHardcoded(L, layout); - try configurePackagePaths(allocator, L, layout); + try self.attachState(L); // Reconcile the batteries manifest. This may take a while on a // fresh install; subsequent runs no-op. Runs in-process — we @@ -457,7 +468,7 @@ const default_base_config = \\# account_id_jwt_claim = "https://api.openai.com/auth" \\ \\# Tool/extension availability (glob patterns). Empty allow = allow all. - \\# [tools] + \\# [extensions] \\# allow = ["std.*"] \\# deny = [] \\ -- cgit v1.3