{"id":18738992,"url":"https://github.com/gaubee/import-meta-ponyfill","last_synced_at":"2026-02-02T00:02:15.442Z","repository":{"id":261527493,"uuid":"861215152","full_name":"Gaubee/import-meta-ponyfill","owner":"Gaubee","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-28T07:00:29.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-01T06:50:33.340Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gaubee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-22T10:13:55.000Z","updated_at":"2025-07-28T07:00:33.000Z","dependencies_parsed_at":"2024-11-07T03:09:21.974Z","dependency_job_id":"66da39b0-377a-4a5d-8695-d64fed2e84a6","html_url":"https://github.com/Gaubee/import-meta-ponyfill","commit_stats":null,"previous_names":["gaubee/import-meta-ponyfill"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Gaubee/import-meta-ponyfill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fimport-meta-ponyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fimport-meta-ponyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fimport-meta-ponyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fimport-meta-ponyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gaubee","download_url":"https://codeload.github.com/Gaubee/import-meta-ponyfill/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fimport-meta-ponyfill/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28996568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T23:10:54.274Z","status":"ssl_error","status_checked_at":"2026-02-01T23:10:47.298Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-07T15:32:22.270Z","updated_at":"2026-02-02T00:02:15.428Z","avatar_url":"https://github.com/Gaubee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# import.meta ponyfill\n\nThis library implements some standard interfaces of [import.meta](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta) with the aim of resolving the confusion caused by multiple standards in Node.js.\nIt includes unified support for the following Node.js standards:\n\n## How to use\n\n- commonjs\n  ```ts\n  const import_meta_ponyfill = require(\"import-meta-ponyfill\");\n  const importMeta = import_meta_ponyfill(require, module);\n  importMeta.resolve; // function\n  importMeta.main; // boolean\n  importMeta.url; // string\n  importMeta.filename; // string\n  importMeta.dirname; // string\n  ```\n- esmodule\n  ```ts\n  import import_meta_ponyfill from \"import-meta-ponyfill\";\n  const importMeta = import_meta_ponyfill(import.meta);\n  ```\n  - v20.6.0, v18.19.0\n    \u003e Unflag import.meta.resolve, with parentURL parameter still flagged.\n  - v20.6.0, v18.19.0\n    \u003e This API no longer throws when targeting file: URLs that do not map to an existing file on the local FS.\n  - v20.0.0, v18.19.0\n    \u003e This API now returns a string synchronously instead of a Promise.\n  - v16.2.0, v14.18.0\n    \u003e Add support for WHATWG URL object to parentURL parameter.\n\n## ImportMeta API\n\n- `url: string;`\n  \u003e A string representation of the fully qualified module URL. When the\n  \u003e module is loaded locally, the value will be a file URL (e.g.\n  \u003e `file:///path/module.ts`).\n  \u003e\n  \u003e You can also parse the string as a URL to determine more information about\n  \u003e how the current module was loaded. For example to determine if a module was\n  \u003e local or not:\n  \u003e\n  \u003e ```ts\n  \u003e const url = new URL(importMeta.url);\n  \u003e if (url.protocol === \"file:\") {\n  \u003e   console.log(\"this module was loaded locally\");\n  \u003e }\n  \u003e ```\n- `resolve(specifier: string, parent?: string | URL | undefined): string;`\n  \u003e A function that returns the resolved specifier,\n  \u003e see [`import.meta.resolve(specifier)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve),\n  \u003e even attempting to return a result for non-existent paths.\n  \u003e\n  \u003e ```ts\n  \u003e console.log(importMeta.resolve(\"./foo.js\"));\n  \u003e // file:///dev/foo.js\n  \u003e ```\n  \u003e\n  \u003e @param specifier The module specifier to resolve relative to `parent`.\n  \u003e @param parent The absolute parent module URL to resolve from.\n  \u003e @returns The absolute (`file:`) URL string for the resolved module.\n- `nodeResolve(specifier: string, parent?: string | URL | undefined): string;`\n  \u003e A function that returns resolved specifier as if it would be imported\n  \u003e using `import.meta.resolve(specifier) or require.resolve(specifier)`.\n  \u003e\n  \u003e ```ts\n  \u003e console.log(import.meta.nodeResolve(\"./foo.js\"));\n  \u003e // file:///dev/foo.js\n  \u003e ```\n  \u003e\n  \u003e @param specifier The module specifier to resolve relative to `parent`.\n  \u003e @param parent The absolute parent module URL to resolve from.\n  \u003e @returns The absolute (`file:`) URL string for the resolved module.\n- `main: boolean;`\n  \u003e A flag that indicates if the current module is the main module that was\n  \u003e called when starting the program under Deno.\n  \u003e\n  \u003e ```ts\n  \u003e if (importMeta.main) {\n  \u003e   // this was loaded as the main module, maybe do some bootstrapping\n  \u003e }\n  \u003e ```\n- `filename: string;`\n\n  \u003e The absolute path of the current module.\n  \u003e\n  \u003e This property is only provided for local modules (ie. using `file://` URLs).\n  \u003e\n  \u003e Example:\n  \u003e\n  \u003e ```ts\n  \u003e // Unix\n  \u003e console.log(importMeta.filename); // /home/alice/my_module.ts\n  \u003e\n  \u003e // Windows\n  \u003e console.log(importMeta.filename); // C:\\alice\\my_module.ts\n  \u003e ```\n\n- `dirname: string;`\n  \u003e The absolute path of the directory containing the current module.\n  \u003e\n  \u003e This property is only provided for local modules (ie. using `file://` URLs).\n  \u003e\n  \u003e \u003e Example:\n  \u003e\n  \u003e ```ts\n  \u003e // Unix\n  \u003e console.log(importMeta.dirname); // /home/alice\n  \u003e\n  \u003e // Windows\n  \u003e console.log(importMeta.dirname); // C:\\alice\n  \u003e ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaubee%2Fimport-meta-ponyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaubee%2Fimport-meta-ponyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaubee%2Fimport-meta-ponyfill/lists"}