{"id":16985382,"url":"https://github.com/fengb/module-resolve-as-caller","last_synced_at":"2026-05-07T13:47:37.035Z","repository":{"id":57300725,"uuid":"45889263","full_name":"fengb/module-resolve-as-caller","owner":"fengb","description":null,"archived":false,"fork":false,"pushed_at":"2016-04-11T22:00:01.000Z","size":6,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-26T17:57:51.883Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fengb.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}},"created_at":"2015-11-10T05:19:59.000Z","updated_at":"2019-07-08T21:55:21.000Z","dependencies_parsed_at":"2022-09-10T21:11:04.403Z","dependency_job_id":null,"html_url":"https://github.com/fengb/module-resolve-as-caller","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fengb/module-resolve-as-caller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Fmodule-resolve-as-caller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Fmodule-resolve-as-caller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Fmodule-resolve-as-caller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Fmodule-resolve-as-caller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fengb","download_url":"https://codeload.github.com/fengb/module-resolve-as-caller/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengb%2Fmodule-resolve-as-caller/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261088349,"owners_count":23107679,"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-10-14T02:43:21.338Z","updated_at":"2026-05-07T13:47:32.015Z","avatar_url":"https://github.com/fengb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# module-resolve-as-caller\n\n## Installation\n\n```bash\n$ npm install module-resolve-as-caller\n```\n\n## Example\n\n```javascript\n//* node_modules/fancy/index.js\n\nvar moduleResolveAsCaller = require('module-resolve-as-caller')\nfunction resolve (path) {\n  return moduleResolveAsCaller(path)\n}\n\nfunction require (path) {\n  return moduleResolveAsCaller.require(path)\n}\n\n//* user.js\n\nvar fancy = require('fancy')\n\n// Use node_modules when not relative path\nfancy.resolve('dependency')\nfancy.require('dependency')\n\n// Relative paths search up the callsite.\n// In this example, this is relative to **user.js**, not **fancy.js**.\nfancy.resolve('./relative')\nfancy.require('./relative')\n```\n\n## Why?\n\nSometimes, we need metaprogramming tricks to get around the standard module\nresolution:\n\n* [require-optional](https://github.com/fengb/require-optional)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengb%2Fmodule-resolve-as-caller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffengb%2Fmodule-resolve-as-caller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengb%2Fmodule-resolve-as-caller/lists"}