From 999cbfb52bc42c58467e3592d5fead9c4ee8a2c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 18 Jul 2022 20:05:26 +0200 Subject: feat: import.meta.resolve() (#15074) This commit adds new "import.meta.resolve()" API which allows to resolve specifiers relative to the module the API is called in. This API supports resolving using import maps. --- cli/dts/lib.deno.ns.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cli/dts/lib.deno.ns.d.ts') diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index b13acc238..e5499c93e 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -21,6 +21,16 @@ declare interface ImportMeta { * ``` */ main: boolean; + + /** A function that returns resolved specifier as if it would be imported + * using `import(specifier)`. + * + * ```ts + * console.log(import.meta.resolve("./foo.js")); + * // file:///dev/foo.js + * ``` + */ + resolve(specifier: string): string; } /** Deno supports user timing Level 3 (see: https://w3c.github.io/user-timing) -- cgit v1.2.3