summaryrefslogtreecommitdiff
path: root/deno_typescript/system_loader.js
diff options
context:
space:
mode:
Diffstat (limited to 'deno_typescript/system_loader.js')
-rw-r--r--deno_typescript/system_loader.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/deno_typescript/system_loader.js b/deno_typescript/system_loader.js
index b5b10af48..0004d055d 100644
--- a/deno_typescript/system_loader.js
+++ b/deno_typescript/system_loader.js
@@ -15,10 +15,29 @@ let System, __instantiateAsync, __instantiate;
},
};
+ async function dI(mid, src) {
+ let id = mid.replace(/\.\w+$/i, "");
+ if (id.includes("./")) {
+ const [o, ...ia] = id.split("/").reverse(),
+ [, ...sa] = src.split("/").reverse(),
+ oa = [o];
+ let s = 0,
+ i;
+ while ((i = ia.shift())) {
+ if (i === "..") s++;
+ else if (i === ".") break;
+ else oa.push(i);
+ }
+ if (s < sa.length) oa.push(...sa.slice(s));
+ id = oa.reverse().join("/");
+ }
+ return r.has(id) ? gExpA(id) : import(mid);
+ }
+
function gC(id, main) {
return {
id,
- import: async (id) => r.get(id)?.exp,
+ import: (m) => dI(m, id),
meta: { url: id, main },
};
}