This commit is contained in:
2026-02-22 20:48:17 -06:00
parent 012b507415
commit 62440d3ed6
8 changed files with 116 additions and 8 deletions

View File

@@ -1558,6 +1558,7 @@ $_.clock(_ => {
}
env.use = function(path) {
if (path == 'prosperon/compositor') log.shop('DEBUG engine env.use: pkg=' + (pkg || '(null)'))
var ck = 'core/' + path
var _use_core_result = null
var _use_core_ok = false

View File

@@ -788,7 +788,7 @@ function resolve_mod_fn(path, pkg) {
if (dylib_path) {
handle = os.dylib_open(dylib_path)
if (handle) {
sym = pkg && _stem ? Shop.c_symbol_for_file(pkg, _stem) : null
sym = pkg ? Shop.c_symbol_for_file(pkg, _stem || fd.basename(path)) : null
return {_native: true, _handle: handle, _sym: sym}
}
}
@@ -1280,6 +1280,7 @@ Shop.is_loaded = function is_loaded(path, package_context) {
// Create a use function bound to a specific package context
function make_use_fn(pkg, force_native) {
return function(path) {
if (path == 'prosperon/compositor') log.shop('DEBUG make_use_fn: pkg=' + (is_text(pkg) ? pkg : '(non-text)') + ' force_native=' + (force_native ? 'true' : 'false'))
var _native = null
if (force_native && !native_mode) {
_native = function() {
@@ -1323,6 +1324,7 @@ function execute_module(info)
env = stone(env)
used = os.native_module_load_named(
mod_resolve.symbol._handle, mod_resolve.symbol._sym, env)
log.shop('loaded ' + info.cache_key + ' [native]')
} else {
// Build env with runtime fns, capabilities, and use function
file_info = Shop.file_info(mod_resolve.path)
@@ -1334,6 +1336,7 @@ function execute_module(info)
// Load compiled bytecode with env
used = mach_load(mod_resolve.symbol, env)
log.shop('loaded ' + info.cache_key + ' [bytecode]')
}
} else if (c_resolve.scope < 900) {
// C only
@@ -1373,6 +1376,11 @@ Shop.use = function use(path, _pkg_ctx) {
log.error("use() expects a text module path, but received a non-text value")
disrupt
}
if (path == 'prosperon/compositor') {
if (is_text(_pkg_ctx)) log.shop('DEBUG use(): _pkg_ctx=' + _pkg_ctx)
else if (_pkg_ctx == null) log.shop('DEBUG use(): _pkg_ctx=NULL')
else log.shop('DEBUG use(): _pkg_ctx is non-text non-null')
}
var package_context = is_core_dir(_pkg_ctx) ? 'core' : safe_canonicalize(_pkg_ctx)
// Check for embedded module (static builds)
var embed_key = 'embedded:' + path