@ai-ecoverse/slicc-kernel 1.160.1 → 1.160.3

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.
@@ -1539,15 +1539,23 @@ var BASE64_MODULE = "data:text/javascript;base64,";
1539
1539
  var fromBase64 = Buffer.from.bind(Buffer);
1540
1540
  var toText = Function.prototype.call.bind(Buffer.prototype.toString);
1541
1541
  var PLAIN_BASE64 = /^[A-Za-z0-9+/]+={0,2}$/;
1542
+ var SOURCE_MODULE = "slicc-module:";
1543
+ var sources = /* @__PURE__ */ new Map();
1542
1544
  function refuseModules() {
1543
1545
  registerHooks({
1544
1546
  resolve(specifier, context, next) {
1547
+ if (specifier.startsWith(SOURCE_MODULE)) {
1548
+ if (!sources.has(specifier)) throw refused(specifier);
1549
+ return { url: specifier, shortCircuit: true };
1550
+ }
1545
1551
  if (isBuiltin(specifier)) throw refused(specifier);
1546
1552
  const resolved = next(specifier, context);
1547
1553
  if (!resolved.url.startsWith("data:")) throw refused(resolved.url);
1548
1554
  return resolved;
1549
1555
  },
1550
1556
  load(url, context, next) {
1557
+ const known = sources.get(url);
1558
+ if (known !== void 0) return { format: "module", source: known, shortCircuit: true };
1551
1559
  const payload = url.startsWith(BASE64_MODULE) ? url.slice(BASE64_MODULE.length) : "";
1552
1560
  const typed = Object.keys(context.importAttributes ?? {}).length > 0;
1553
1561
  if (typed || payload.length % 4 !== 0 || !PLAIN_BASE64.test(payload))