@ai-ecoverse/slicc-kernel 1.52.0 → 1.53.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.js CHANGED
@@ -11359,7 +11359,13 @@ function keepWatching(loop, signal) {
11359
11359
  function invalidation(event) {
11360
11360
  return event.paths ?? true;
11361
11361
  }
11362
- async function openHostfs(spec, hook, fetch2, timing = {}) {
11362
+ function grantConnect(hook, fetch2) {
11363
+ return async (source, options) => {
11364
+ const grant = () => hook(source, options);
11365
+ return new HostfsClient(await grant(), grant, fetch2);
11366
+ };
11367
+ }
11368
+ async function openHostfs(spec, connect, timing = {}) {
11363
11369
  const readonly2 = spec.options?.ro !== void 0;
11364
11370
  const { port1, port2 } = new MessageChannel();
11365
11371
  const slot = mediumSlot(
@@ -11367,7 +11373,6 @@ async function openHostfs(spec, hook, fetch2, timing = {}) {
11367
11373
  () => watching.kick()
11368
11374
  );
11369
11375
  const stop = new AbortController();
11370
- const grant = () => hook(spec.source, { readonly: readonly2 });
11371
11376
  let active;
11372
11377
  const handlers = hostfsHandlers(() => active);
11373
11378
  const ranged2 = () => active?.capabilities.ranges === true ? { ranges: true } : {};
@@ -11384,7 +11389,7 @@ async function openHostfs(spec, hook, fetch2, timing = {}) {
11384
11389
  );
11385
11390
  const watching = keepWatching(
11386
11391
  {
11387
- connect: async () => new HostfsClient(await grant(), grant, fetch2),
11392
+ connect: () => connect(spec.source, { readonly: readonly2 }),
11388
11393
  up(client) {
11389
11394
  active = client;
11390
11395
  slot.insert(client, handlers);
@@ -12412,8 +12417,7 @@ var Launcher = class {
12412
12417
  throw fsError("ENODEV", "this kernel has no hostfs hook (createKernel({ hostfs }))");
12413
12418
  return openHostfs(
12414
12419
  spec,
12415
- hostfs,
12416
- hostfsFetch ?? ((url, init) => fetch(url, init)),
12420
+ grantConnect(hostfs, hostfsFetch ?? ((url, init) => fetch(url, init))),
12417
12421
  hostfsTiming
12418
12422
  );
12419
12423
  }