eliscript 0.0.2 → 0.0.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.
@@ -14,9 +14,12 @@ import { compileProject, compileSource, outputPathFor } from "./host.mjs";
14
14
  function externalResolver(runtimeBase) {
15
15
  if (typeof runtimeBase !== "string" || runtimeBase.length === 0) return undefined;
16
16
  const base = new URL(runtimeBase);
17
- return (specifier) => specifier.startsWith("eliscript/")
18
- ? new URL(specifier.slice("eliscript/".length), base).href
19
- : undefined;
17
+ return (specifier) => {
18
+ if (!specifier.startsWith("eliscript/")) return undefined;
19
+ const subpath = specifier.slice("eliscript/".length);
20
+ const normalized = /\.[a-z0-9]+$/iu.test(subpath) ? subpath : `${subpath}.mjs`;
21
+ return new URL(normalized, base).href;
22
+ };
20
23
  }
21
24
 
22
25
  function compile(request) {