1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-11 10:07:54 -05:00
denoland-deno/cli/tests/testdata/run/import_meta/main.out
Bartek Iwańczuk 60688c563e
feat: import.meta.filename and import.meta.dirname (#22061)
This commit adds `import.meta.filename` and `import.meta.dirname` APIs.

These APIs return string representation of filename and containing
dirname.
They are only defined for local modules (modules that have `file:///`
scheme).

Example:

```ts
console.log(import.meta.filename, import.meta.dirname)
```

Unix:
```
$ deno run /dev/my_module.ts
/dev/my_module.ts /dev/
```

Windows:
```
$ deno run C:\dev\my_module.ts
C:\dev\my_module.ts C:\
```
2024-01-23 23:51:07 +01:00

13 lines
747 B
Text

other remote [WILDCARD]other.ts false undefined undefined
other [WILDCARD]other.ts false [WILDCARD]other.ts [WILDCARD]
main [WILDCARD]main.ts true [WILDCARD]main.ts [WILDCARD]
Resolving ./foo.js file:///[WILDCARD]/foo.js
Resolving bare from import map https://example.com/
Resolving https://example.com/rewrite from import map https://example.com/rewritten
Resolving without a value from import map https://example.com/PASS-undefined
Resolving 1 from import map https://example.com/PASS-1
Resolving null from import map https://example.com/PASS-null
Resolving object from import map https://example.com/PASS-object
Resolving npm:cowsay npm:cowsay
Resolving npm:cowsay@1 npm:cowsay@1
Resolving npm:preact from import map https://example.com/preact