{"id":16788590,"url":"https://github.com/mna/luaprecomp","last_synced_at":"2025-08-19T23:09:20.362Z","repository":{"id":145701737,"uuid":"434369448","full_name":"mna/luaprecomp","owner":"mna","description":"Require pre-compiled Lua modules via the standard require function.","archived":false,"fork":false,"pushed_at":"2021-12-02T23:32:33.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-03T06:25:44.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["mna"],"custom":["https://www.buymeacoffee.com/mna"]}},"created_at":"2021-12-02T20:45:03.000Z","updated_at":"2021-12-02T23:32:36.000Z","dependencies_parsed_at":"2023-04-07T23:47:42.733Z","dependency_job_id":null,"html_url":"https://github.com/mna/luaprecomp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/mna/luaprecomp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fluaprecomp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fluaprecomp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fluaprecomp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fluaprecomp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mna","download_url":"https://codeload.github.com/mna/luaprecomp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fluaprecomp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271236280,"owners_count":24723978,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"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":[],"created_at":"2024-10-13T08:18:23.210Z","updated_at":"2025-08-19T23:09:20.339Z","avatar_url":"https://github.com/mna.png","language":"Lua","funding_links":["https://github.com/sponsors/mna","https://www.buymeacoffee.com/mna"],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/mna/luaprecomp/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/mna/luaprecomp/actions)\n\n# luaprecomp\n\nA small Lua library that adds support via a search to insert in `package.searchers` to `require`\npre-compiled Lua modules (pre-compiled with `luac` to bytecode). The searcher function can\nbe inserted before or after the searcher for source-code Lua modules, depending on the intended\neffect (note that inserting it *before* the source code searcher means that changes to the source\ncode of `require`d modules will not be seen until it is re-compiled to bytecode, while inserting\nit *after* means that the pre-compiled version will never be used if the source code is available).\n\nThis works \"recursively\", so to speak, in that if a pre-compiled module requires another module,\nit too will support loading from a pre-compiled file if available, and so on.\n\n## Install\n\nVia LuaRocks:\n\n```\n$ luarocks install luaprecomp\n```\n\nOr simply copy the single precomp.lua file in your project or your `LUA_PATH`.\n\n## API\n\nAssuming `local precomp = require 'precomp'`. You can check out `test/main.lua`\nfor examples of using the API.\n\n### `precomp.searcher`\n\nThe searcher function that returns a loader for pre-compiled modules. It is not\nmeant to be called directly, typically it will be inserted in the `package.searchers`\ntable so that it is used by the `require` built-in mechanism.\n\nSee https://www.lua.org/manual/5.4/manual.html#6.3 for more details.\n\nIf `precomp.path` is not set, the search path used is `package.path` with the\n`.lua` extension replaced with `.luac`. The `precomp.ext` field can be set to\nspecify a different extension to replace `.lua` with. If `precomp.path` is set,\nit is used as search path as-is.\n\nTypical use is to insert it like this before requiring the modules:\n\n```\n-- use index 2 to insert before source code, index 3 for after.\ntable.insert(package.searchers, 2, precomp.searcher)\n```\n\n### `precomp.path`\n\nThe search path for pre-compiled modules. If not set, `package.path` is used\nwith the `.lua` extension replaced with `.luac` or `precomp.ext` if set.\n\nSee https://www.lua.org/manual/5.4/manual.html#pdf-package.searchpath for\ndetails on the format and behaviour of the path.\n\n### `precomp.ext`\n\nIf set, indicates the extension to use to replace `.lua` in the `package.path`\nstring. Ignored if `precomp.path` is set. Note that it must include the leading\ndot.\n\n## Development\n\nClone the project and install the required development dependencies:\n\n* luaunit (the unit test runner)\n* luacov (recommended, test coverage)\n\nTo run tests and coverage:\n\n```\n# unit tests\n$ lua test/main.lua\n\n# test coverage\n$ lua -lluacov test/main.lua\n# generates a luacov.stats.out file\n$ luacov\n# generates a luacov.report.out file\n$ cat luacov.report.out\n```\n\n## License\n\nThe [BSD 3-clause](http://opensource.org/licenses/BSD-3-Clause) license.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmna%2Fluaprecomp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmna%2Fluaprecomp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmna%2Fluaprecomp/lists"}