@ai-ecoverse/slicc-kernel 1.160.1 → 1.160.2

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.
@@ -7365,7 +7365,7 @@ var init_version = __esm({
7365
7365
  "src/version.ts"() {
7366
7366
  "use strict";
7367
7367
  init_captured_globals();
7368
- KERNEL_VERSION = true ? "1.160.1" : "0.0.0-dev";
7368
+ KERNEL_VERSION = true ? "1.160.2" : "0.0.0-dev";
7369
7369
  OS_RELEASE = "6.0.0-slicc";
7370
7370
  }
7371
7371
  });
@@ -16796,7 +16796,8 @@ async function runJs(init, port3, deps, thread) {
16796
16796
  });
16797
16797
  try {
16798
16798
  (deps.lockdown ?? lockdown)();
16799
- const { url, glue } = init.program;
16799
+ const { url, glue, source } = init.program;
16800
+ if (url && source !== void 0) deps.moduleSource?.(url, source);
16800
16801
  main = mainOf(await (url ? import(url) : (deps.load ?? importSource)(glue)));
16801
16802
  deps.imported?.();
16802
16803
  } catch (err) {
@@ -19619,15 +19620,26 @@ var BASE64_MODULE = "data:text/javascript;base64,";
19619
19620
  var fromBase64 = capturedBuffer.from.bind(capturedBuffer);
19620
19621
  var toText = capturedFunction.prototype.call.bind(capturedBuffer.prototype.toString);
19621
19622
  var PLAIN_BASE64 = /^[A-Za-z0-9+/]+={0,2}$/;
19623
+ var SOURCE_MODULE = "slicc-module:";
19624
+ var sources = new capturedMap();
19625
+ function moduleSource(url, source) {
19626
+ sources.set(url, source);
19627
+ }
19622
19628
  function refuseModules() {
19623
19629
  registerHooks({
19624
19630
  resolve(specifier, context, next2) {
19631
+ if (specifier.startsWith(SOURCE_MODULE)) {
19632
+ if (!sources.has(specifier)) throw refused(specifier);
19633
+ return { url: specifier, shortCircuit: true };
19634
+ }
19625
19635
  if (isBuiltin(specifier)) throw refused(specifier);
19626
19636
  const resolved2 = next2(specifier, context);
19627
19637
  if (!resolved2.url.startsWith("data:")) throw refused(resolved2.url);
19628
19638
  return resolved2;
19629
19639
  },
19630
19640
  load(url, context, next2) {
19641
+ const known = sources.get(url);
19642
+ if (known !== void 0) return { format: "module", source: known, shortCircuit: true };
19631
19643
  const payload = url.startsWith(BASE64_MODULE) ? url.slice(BASE64_MODULE.length) : "";
19632
19644
  const typed = capturedObject.keys(context.importAttributes ?? {}).length > 0;
19633
19645
  if (typed || payload.length % 4 !== 0 || !PLAIN_BASE64.test(payload))
@@ -19998,6 +20010,7 @@ var onMessage = processEntry(
19998
20010
  memory: nodeMemory,
19999
20011
  asyncContext: nodeAsyncContext,
20000
20012
  runScript: nodeRunScript,
20013
+ moduleSource,
20001
20014
  promiseState: nodePromiseState,
20002
20015
  imported
20003
20016
  }),
@@ -20007,6 +20020,7 @@ var onMessage = processEntry(
20007
20020
  memory: nodeMemory,
20008
20021
  asyncContext: nodeAsyncContext,
20009
20022
  runScript: nodeRunScript,
20023
+ moduleSource,
20010
20024
  promiseState: nodePromiseState,
20011
20025
  imported
20012
20026
  })