{"id":17242767,"url":"https://github.com/imcuttle/require-fallback-middle","last_synced_at":"2025-03-26T03:44:23.089Z","repository":{"id":45112696,"uuid":"307755380","full_name":"imcuttle/require-fallback-middle","owner":"imcuttle","description":"Module to fallback the Node.js require and require.resolve function","archived":false,"fork":false,"pushed_at":"2022-01-07T15:01:59.000Z","size":196,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T10:19:24.358Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imcuttle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-27T16:05:18.000Z","updated_at":"2021-01-14T07:37:53.000Z","dependencies_parsed_at":"2022-09-26T17:30:25.753Z","dependency_job_id":null,"html_url":"https://github.com/imcuttle/require-fallback-middle","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Frequire-fallback-middle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Frequire-fallback-middle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Frequire-fallback-middle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Frequire-fallback-middle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imcuttle","download_url":"https://codeload.github.com/imcuttle/require-fallback-middle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245585797,"owners_count":20639671,"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-15T06:14:01.151Z","updated_at":"2025-03-26T03:44:23.068Z","avatar_url":"https://github.com/imcuttle.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# require-fallback-middle\n\n[![Build status](https://img.shields.io/travis/imcuttle/require-fallback-middle/master.svg?style=flat-square)](https://travis-ci.org/imcuttle/require-fallback-middle)\n[![Test coverage](https://img.shields.io/codecov/c/github/imcuttle/require-fallback-middle.svg?style=flat-square)](https://codecov.io/github/imcuttle/require-fallback-middle?branch=master)\n[![NPM version](https://img.shields.io/npm/v/require-fallback-middle.svg?style=flat-square)](https://www.npmjs.com/package/require-fallback-middle)\n[![NPM Downloads](https://img.shields.io/npm/dm/require-fallback-middle.svg?style=flat-square\u0026maxAge=43200)](https://www.npmjs.com/package/require-fallback-middle)\n[![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://prettier.io/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)\n\n\u003e Module to fallback the Node.js require and require.resolve function\n\nIt's useful in global cli, Allow Node.js resolve module in `process.cwd()` (local modules) and global modules.\n\n## Installation\n\n```bash\nnpm install require-fallback-middle\n# or use yarn\nyarn add require-fallback-middle\n```\n\n## Usage\n\n```javascript\nimport requireFallbackMiddle from 'require-fallback-middle'\n\nconst { unhook } = requireFallbackMiddle()\n```\n\n## API\n\n#### `requireFallbackMiddle(match: Match, fallbackDirs?: string[] | ((id: string, parent: Module, isMain: boolean) =\u003e string[]))`\n\n- `match`: The registered module match\n- `fallbackDirs`: The registered module match (Default: `(id, parent) =\u003e [process.cwd(), dirname(parent?.filename) || __dirname]`)\n\n- **Returns:** [require-resolve-hook result](https://github.com/imcuttle/require-resolve-hook/#api)\n\n## Contributing\n\n- Fork it!\n- Create your new branch:  \n  `git checkout -b feature-new` or `git checkout -b fix-which-bug`\n- Start your magic work now\n- Make sure npm test passes\n- Commit your changes:  \n  `git commit -am 'feat: some description (close #123)'` or `git commit -am 'fix: some description (fix #123)'`\n- Push to the branch: `git push`\n- Submit a pull request :)\n\n## Authors\n\nThis library is written and maintained by imcuttle, \u003ca href=\"mailto:imcuttle@163.com\"\u003eimcuttle@163.com\u003c/a\u003e.\n\n## License\n\nMIT - [imcuttle](https://github.com/imcuttle) 🐟\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Frequire-fallback-middle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimcuttle%2Frequire-fallback-middle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Frequire-fallback-middle/lists"}