{"id":16784762,"url":"https://github.com/yogeshlonkar/lua-import","last_synced_at":"2026-03-04T23:32:10.785Z","repository":{"id":226866837,"uuid":"769745597","full_name":"yogeshlonkar/lua-import","owner":"yogeshlonkar","description":"An import function to require modules with relative pattern","archived":false,"fork":false,"pushed_at":"2025-10-25T13:15:09.000Z","size":23,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T15:09:52.407Z","etag":null,"topics":["import","lua","require"],"latest_commit_sha":null,"homepage":"https://yogeshlonkar.github.io/lua-import/","language":"Lua","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/yogeshlonkar.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-09T23:44:34.000Z","updated_at":"2025-04-12T06:08:16.000Z","dependencies_parsed_at":"2025-07-14T12:32:32.168Z","dependency_job_id":"b00c99dc-d494-453e-b1aa-d770681aea28","html_url":"https://github.com/yogeshlonkar/lua-import","commit_stats":null,"previous_names":["yogeshlonkar/lua-import"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/yogeshlonkar/lua-import","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshlonkar%2Flua-import","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshlonkar%2Flua-import/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshlonkar%2Flua-import/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshlonkar%2Flua-import/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yogeshlonkar","download_url":"https://codeload.github.com/yogeshlonkar/lua-import/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshlonkar%2Flua-import/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30099396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T23:31:22.529Z","status":"ssl_error","status_checked_at":"2026-03-04T23:31:22.112Z","response_time":59,"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":["import","lua","require"],"created_at":"2024-10-13T08:07:06.887Z","updated_at":"2026-03-04T23:32:10.758Z","avatar_url":"https://github.com/yogeshlonkar.png","language":"Lua","readme":"# lua-import [![License](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENSE) [![Build Status](https://github.com/yogeshlonkar/lua-import/actions/workflows/on-push.yml/badge.svg)](https://github.com/yogeshlonkar/lua-import/actions) [![Luarocks](https://badgen.net/static/Luarocks/0.1.1-1/blue)](https://luarocks.org/modules/yogeshlonkar/lua-import)\nThe lua-import module provides a function.\nThe function takes single string argument same as require, but the argument can be a relative path to the required module.\nThe return value is the module referred by the path argument.\n\n## 💻 Install\n    \n### Using luarocks\n\n``` shell\nluarocks install lua-import\n```\n\n### Copy/ paste\n\nCopy [import.lua](import.lua) to `lua/` directory in your project.\n\n## 🧑‍💻  Usage \n\nAdd below line to init.lua or entry point of your project\n\n```lua\nrequire('import')\n```\n\n### neovim\n\nI use this package in my neovim configuration which was the main inspiration for building this package.\nAs neovim configuration directories get significantly nested, the require statements on top of some files start looking like horizontal bar chart.\n\nTo simplify require statements in neovim configurations:\n\n- Copy [import.lua](import.lua) to `lua/` directory in your neovim configuration.\n- Add `require('import')` to `init.lua`.\n\nThen you can use `import` function in lua files anywhere in your configurations.\n\n## Example\n\nBelow is the directory structure of the [tests](spec) in this package, all examples are based on it.\n\n```text\nspec\n├── fixture_three.lua\n└── unit\n    ├── fixture_one.lua\n    ├── fixture_two\n    │   ├── init.lua\n    │   └── two_dot_one.lua\n    └── import_spec.lua\n\n3 directories, 5 files\n```\n\n```lua\n-- will import same as require\nlocal m = import('spec.unit.fixture_one')\n\n-- will same as require with filepath separator\nlocal m = import('spec/unit/fixture_one')\n\n-- will import relative to current directory\nlocal m = import('./fixture_one')\n\n-- will import relative to current directory without filepath separator\nlocal m = import('fixture_one')\n\n-- will import relative to current directory with init.lua\nlocal m = import('./fixture_two')\n\n-- will import relative to current directory with init.lua withouth ./\nlocal m = import('fixture_two/two_dot_one')\n\n-- will import relative to parent directory\nlocal m = import('../fixture_three')\n\n-- will import relative to parent 2 up directories\nlocal m = import('../../import')\n```\n\n## Development\n\nTo setup project for development, run the following commands.\n\n```shell\nluarocks install --local --deps-mode all --only-deps lua-import-main-1.rockspec\neval \"$(luarocks --local path --bin)\"\n```\n\nTo run the tests\n\n```shell\nluarocks --test test\n\n# or\nbusted .\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogeshlonkar%2Flua-import","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyogeshlonkar%2Flua-import","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogeshlonkar%2Flua-import/lists"}