mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
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.
This commit is contained in:
parent
0d73eb3dd9
commit
999cbfb52b
6 changed files with 101 additions and 1 deletions
10
cli/dts/lib.deno.ns.d.ts
vendored
10
cli/dts/lib.deno.ns.d.ts
vendored
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue