rm of
This commit is contained in:
@@ -177,10 +177,10 @@ function disrupt(err)
|
||||
|
||||
if (underlings) {
|
||||
var unders = array(underlings)
|
||||
for (var id of unders) {
|
||||
arrfor(unders, function(id) {
|
||||
log.console(`calling on ${id} to disrupt too`)
|
||||
$_.stop(create_actor({id}))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (err) {
|
||||
@@ -449,16 +449,14 @@ $_.receiver = function receiver(fn) {
|
||||
receive_fn = fn
|
||||
}
|
||||
|
||||
$_.start = function start(cb, program, ...args) {
|
||||
$_.start = function start(cb, program) {
|
||||
if (!program) return
|
||||
|
||||
var id = guid()
|
||||
if (length(args) == 1 && is_array(args[0])) args = args[0]
|
||||
var startup = {
|
||||
id,
|
||||
overling: $_.self,
|
||||
root,
|
||||
arg: args,
|
||||
program,
|
||||
}
|
||||
greeters[id] = cb
|
||||
@@ -582,14 +580,14 @@ var need_stop = false
|
||||
return
|
||||
}
|
||||
|
||||
for (var msg of message_queue) {
|
||||
arrfor(message_queue, function(msg) {
|
||||
if (msg.startup) {
|
||||
// now is the time to actually spin up the actor
|
||||
actor_mod.createactor(msg.startup)
|
||||
} else {
|
||||
actor_send(msg.actor, msg.send)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
message_queue = []
|
||||
}
|
||||
@@ -803,7 +801,7 @@ $_.clock(_ => {
|
||||
var pkg = file_info ? file_info.package : null
|
||||
var use_fn = function(path) { return shop.use(path, pkg) }
|
||||
|
||||
// Call with signature: setup_module(args, use, ...capabilities)
|
||||
// Call with signature: setup_module(args, use, ..capabilities)
|
||||
// The script wrapper builds $_ from the injected capabilities for backward compatibility
|
||||
var val = call(locator.symbol, null, _cell.args.arg, use_fn, ...vals)
|
||||
|
||||
|
||||
@@ -360,11 +360,6 @@ var open_dls = {}
|
||||
// These map to $_ properties in engine.cm
|
||||
var SHOP_DEFAULT_INJECT = ['$self', '$overling', '$clock', '$delay', '$start', '$receiver', '$contact', '$portal', '$time_limit', '$couple', '$stop', '$unneeded', '$connection', '$fd']
|
||||
|
||||
function strip_dollar(name) {
|
||||
if (name && name[0] == '$') return text(name, 1)
|
||||
return name
|
||||
}
|
||||
|
||||
// Decide what a given module is allowed to see.
|
||||
// This is the capability gate - tweak as needed.
|
||||
Shop.script_inject_for = function(file_info) {
|
||||
@@ -387,13 +382,11 @@ function inject_params(inject) {
|
||||
}
|
||||
|
||||
function inject_values(inject) {
|
||||
var vals = []
|
||||
for (var i = 0; i < length(inject); i++) {
|
||||
var key = strip_dollar(inject[i])
|
||||
if (key == 'fd') vals.push(fd)
|
||||
else vals.push(my$_[key])
|
||||
}
|
||||
return vals
|
||||
return array(inject, function(inj) {
|
||||
var key = trim(inj, '$')
|
||||
if (key == 'fd') return fd
|
||||
return my$_[key]
|
||||
})
|
||||
}
|
||||
|
||||
// Build the use function for a specific package context
|
||||
@@ -802,7 +795,7 @@ function execute_module(info)
|
||||
var pkg = file_info.package
|
||||
var use_fn = make_use_fn(pkg)
|
||||
|
||||
// Call with signature: setup_module(args, use, ...capabilities)
|
||||
// Call with signature: setup_module(args, use, ..capabilities)
|
||||
// args is null for module loading
|
||||
used = call(mod_resolve.symbol, context, null, use_fn, ...vals)
|
||||
} else if (c_resolve.scope < 900) {
|
||||
@@ -1217,8 +1210,9 @@ Shop.build_package_scripts = function(package)
|
||||
var scripts = get_package_scripts(package)
|
||||
var pkg_dir = get_package_abs_dir(package)
|
||||
|
||||
for (var script of scripts)
|
||||
arrfor(scripts, function(script) {
|
||||
resolve_mod_fn(pkg_dir + '/' + script, package)
|
||||
})
|
||||
}
|
||||
|
||||
Shop.list_packages = function()
|
||||
@@ -1274,12 +1268,12 @@ Shop.audit_packages = function() {
|
||||
|
||||
var bad = []
|
||||
|
||||
for (var package of packages) {
|
||||
if (package == 'core') continue
|
||||
if (fd.is_dir(package)) continue
|
||||
if (fetch_remote_hash(package)) continue
|
||||
arrfor(packages, function(package) {
|
||||
if (package == 'core') return
|
||||
if (fd.is_dir(package)) return
|
||||
if (fetch_remote_hash(package)) return
|
||||
bad.push(package)
|
||||
}
|
||||
})
|
||||
|
||||
return bad
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user