{"id":16682588,"url":"https://github.com/jchip/require-at","last_synced_at":"2026-03-08T02:05:59.048Z","repository":{"id":57159411,"uuid":"82267862","full_name":"jchip/require-at","owner":"jchip","description":"Call require pretending you are at another directory","archived":false,"fork":false,"pushed_at":"2020-11-28T08:32:35.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-28T10:58:43.264Z","etag":null,"topics":["another","at","directory","nodejs","require"],"latest_commit_sha":null,"homepage":"","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/jchip.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":"2017-02-17T07:05:16.000Z","updated_at":"2020-11-28T08:32:34.000Z","dependencies_parsed_at":"2022-09-08T11:03:39.505Z","dependency_job_id":null,"html_url":"https://github.com/jchip/require-at","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jchip/require-at","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Frequire-at","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Frequire-at/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Frequire-at/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Frequire-at/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchip","download_url":"https://codeload.github.com/jchip/require-at/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Frequire-at/sbom","scorecard":{"id":511372,"data":{"date":"2025-08-11","repo":{"name":"github.com/jchip/require-at","commit":"8460f9c82eebb167e224a7ee492bd234f917122d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T00:37:37.650Z","repository_id":57159411,"created_at":"2025-08-20T00:37:37.650Z","updated_at":"2025-08-20T00:37:37.650Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30242405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["another","at","directory","nodejs","require"],"created_at":"2024-10-12T14:08:01.797Z","updated_at":"2026-03-08T02:05:59.017Z","avatar_url":"https://github.com/jchip.png","language":"JavaScript","readme":"[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]\n[![Dependency Status][daviddm-image]][daviddm-url] [![devDependency Status][daviddm-dev-image]][daviddm-dev-url]\n\n# require-at\n\nAllow you to call `require` or `require.resolve` pretending that you are at another directory.\n\n## Purpose\n\nGiven the directory structure below with two NodeJS apps:\n\n    app1\n    |-+ foo\n    | +-- index.js\n    | +--+ node_modules\n    |    +--+ x \n    |       + ...\n    app2\n    |-+ bar\n    | +-- index.js\n    | +--+ node_modules\n    |    +--+ y\n    |       + ...\n\nWhen you call `require(\"x\")` in `/app1/foo/index.js`, NodeJS will search and find module `x` there.\n\nNow from the same file, if you want to resolve the module `y` under the directory `/app2/bar`, you have to use an absolute or relative path directly pointing to `y`, and you may have to do some searching, probably re-implementing Node's module searching algorithm if you don't know exactly where `y` could be.\n\nHowever, in the file `/app2/bar/index.js`, it can just do `require(\"y\")` and Node would automatically find the module for it, because that file is at the location where `y` is under.\n\nWhat if from the file `/app1/foo/index.js`, you can call `require` as if you were at the directory `/app2/bar`, then you would be able to utilize Node's module searching automatically. \n\nTo achieve this, most other implementations choose to re-implement Node's module searching algorithm.\n\nThis module's approach is to tap into Node's `module` and let it do the work.\n\n## Install\n\n    $ npm install require-at --save\n\n## Usage\n\nA single function is exported.\n\n##### `requireAt(dir, [request])`\n\n-   If you call it with just `dir`, then it returns a `require` function that's been binded to the directory `dir`.  You can use it to load any module as if you are at `dir`.  \n    -   You can also call `require.resolve` with the same effect.\n-   If you call it with `dir` and a `request`, then it will load and return the module `request` as if at `dir`.\n\n##### Example\n\n```js\nconst requireAt = require(\"require-at\");\n\n// get back a require binded to /another/dir\n\nconst requireAtAnother = requireAt(\"/another/dir/\");\nconst modXPath = requireAtAnother.resolve(\"modX\");\nconst modX = requireAtAnother(\"modX\");\n\n// load modY at /another/yet/dir directly\n\nconst modY = requireAt(\"/another/yet/dir\", \"modY\");\n```\n\n## License\n\nApache-2.0 © [Joel Chen](https://github.com/jchip)\n\n[travis-image]: https://travis-ci.org/jchip/require-at.svg?branch=master\n\n[travis-url]: https://travis-ci.org/jchip/require-at\n\n[npm-image]: https://badge.fury.io/js/require-at.svg\n\n[npm-url]: https://npmjs.org/package/require-at\n\n[daviddm-image]: https://david-dm.org/jchip/require-at/status.svg\n\n[daviddm-url]: https://david-dm.org/jchip/require-at\n\n[daviddm-dev-image]: https://david-dm.org/jchip/require-at/dev-status.svg\n\n[daviddm-dev-url]: https://david-dm.org/jchip/require-at?type=dev\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Frequire-at","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchip%2Frequire-at","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Frequire-at/lists"}