Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: import.meta.filename and import.meta.dirname #22061

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Jan 23, 2024

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:

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:\

@bartlomieju bartlomieju added this to the 1.40 milestone Jan 23, 2024
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bartlomieju bartlomieju merged commit 60688c5 into denoland:main Jan 23, 2024
14 checks passed
@bartlomieju bartlomieju deleted the import_meta_filename_dirname branch January 23, 2024 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants