diff options
| author | t <t@tjp.lol> | 2026-07-04 09:50:12 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-07-05 16:23:49 -0600 |
| commit | f759f149377942c4e04802c45162cda1c9bfb2b3 (patch) | |
| tree | 397dd2fc35839d8fcbf6a5c237bee363c6ed3c07 /src/luarocks_runtime.zig | |
| parent | 1ed07e2e4473b91c669c062bbfef6bb499f7d2b7 (diff) | |
big cli/tui gaps project
Diffstat (limited to 'src/luarocks_runtime.zig')
| -rw-r--r-- | src/luarocks_runtime.zig | 19 |
1 files changed, 15 insertions, 4 deletions
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 = [] \\ |
