{"id":20513805,"url":"https://github.com/webreflection/umeta","last_synced_at":"2025-04-14T00:02:01.424Z","repository":{"id":57385597,"uuid":"248950791","full_name":"WebReflection/umeta","owner":"WebReflection","description":"A micro helper for import.meta data.","archived":false,"fork":false,"pushed_at":"2024-01-12T10:51:24.000Z","size":14,"stargazers_count":32,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T18:06:15.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebReflection.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-03-21T10:13:10.000Z","updated_at":"2024-03-22T13:48:25.000Z","dependencies_parsed_at":"2024-02-01T16:28:14.134Z","dependency_job_id":"80fef91a-ec69-4630-a3b9-321ae37ec87b","html_url":"https://github.com/WebReflection/umeta","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fumeta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fumeta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fumeta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fumeta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/umeta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799933,"owners_count":21163403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T21:13:20.985Z","updated_at":"2025-04-14T00:02:01.376Z","avatar_url":"https://github.com/WebReflection.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cem\u003eµ\u003c/em\u003emeta\n\n[![Build Status](https://travis-ci.com/WebReflection/umeta.svg?branch=master)](https://travis-ci.com/WebReflection/umeta) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/umeta/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/umeta?branch=master)\n\nA _micro_ helper for `import.meta` data.\n\n# Announcement\n\nThis module is currently redundant thanks to `import.meta.dirname` and `import.meta.filename` landed in NodeJS LTS.\n\nIn Bun those would be the equivalent of `import.meta.dir` and `import.meta.dir + '/' + import.meta.file`.\n\nI think it'd be rather better to normalize Bun than keep parsing `import.meta.url` but basically all I am saying is that this module is dead for good.\n\n### normalization for both NodeJS and Bun\n\n```js\nconst {\n  dirname = import.meta.dir,\n  filename = `${import.meta.dir}/${import.meta.file}`,\n} = import.meta;\n\nconsole.log(dirname);\nconsole.log(filename);\n```\n\n- - -\n\n```js\nimport umeta from 'umeta';\n\nconst {dirName, fileName, require} = umeta(import.meta);\n```\n\nThe `dirName` and `fileName` respectively represent `__dirname` and `__filename`, while the `require` utility helps importing conditionally, or on demand, CommonJS friendly modules.\n\n### How to transform `import.meta` for CommonJS ?\n\nThere are at least two options:\n\n  * [ascjs](https://github.com/WebReflection/ascjs/#readme), based on `@babel/parser`\n  * [ucjs](https://github.com/WebReflection/ucjs/#readme), based on `@babel/core` and with minimal dependencies (compatible with dynamic `import(...)` too)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fumeta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fumeta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fumeta/lists"}