{"id":28903598,"url":"https://github.com/avajs/require-precompiled","last_synced_at":"2025-06-21T12:05:39.128Z","repository":{"id":57099902,"uuid":"48086183","full_name":"avajs/require-precompiled","owner":"avajs","description":"Require extension that allows for caching/precompiling","archived":false,"fork":false,"pushed_at":"2020-02-09T13:55:02.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-23T22:29:57.949Z","etag":null,"topics":["caching","nodejs","precompiling","require-extension"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/avajs.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}},"created_at":"2015-12-16T03:55:18.000Z","updated_at":"2020-12-16T05:54:38.000Z","dependencies_parsed_at":"2022-08-22T23:10:38.343Z","dependency_job_id":null,"html_url":"https://github.com/avajs/require-precompiled","commit_stats":null,"previous_names":["jamestalmage/require-precompiled"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avajs%2Frequire-precompiled","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avajs%2Frequire-precompiled/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avajs%2Frequire-precompiled/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avajs%2Frequire-precompiled/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avajs","download_url":"https://codeload.github.com/avajs/require-precompiled/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avajs%2Frequire-precompiled/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":257498315,"owners_count":22554678,"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":["caching","nodejs","precompiling","require-extension"],"created_at":"2025-06-21T12:05:31.165Z","updated_at":"2025-06-21T12:05:39.119Z","avatar_url":"https://github.com/avajs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# require-precompiled\n\nModifies `require()` so you can load precompiled module sources.\n\n## Install\n\n```\n$ npm install --save require-precompiled\n```\n\n## Usage\n\n```js\nconst installPrecompiler = require('require-precompiled');\nconst cache = require('my-cache-implementation');\n\ninstallPrecompiler(filename =\u003e {\n\tif (cache.hasEntryFor(filename)) {\n\t\treturn cache.getPrecompiledCode(filename);\n\t}\n\t// fall through to underlying extension chain\n\treturn null;\n});\n\n// any module required from this point on will be checked against the cache\nconst foo = require('some-module');\n```\n\n## API\n\n```ts\nfunction installPrecompiler(\n\tloadSource: (filename: string) =\u003e string | null,\n\text = '.js',\n): void\n```\n\nThe `loadSource()` function should return a source string when a precompiled source is available. Return `null` to fall back to Node.js' default behavior.\n\nBy default the precompiler is installed for `.js` files. You can specify alternative extensions by providing the second argument:\n\n```js\ninstallPrecompiler(filename =\u003e {\n\t// ...\n}, '.cjs')\n```\n\n## License\n\nMIT © [James Talmage](https://github.com/jamestalmage)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favajs%2Frequire-precompiled","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favajs%2Frequire-precompiled","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favajs%2Frequire-precompiled/lists"}