{"_id":"@ava/require-precompiled","_rev":"2-ef47fca09dfc906c7fc52a326c35b04a","name":"@ava/require-precompiled","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ava/require-precompiled","version":"1.0.0","description":"Require extension that allows for caching/precompiling","license":"MIT","repository":{"type":"git","url":"git+https://github.com/avajs/require-precompiled.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=10"},"scripts":{"test":"xo && nyc ava"},"keywords":["require","extension","cache","precompile"],"devDependencies":{"ava":"^3.2.0","fake-module-system":"^0.3.0","nyc":"^15.0.0","xo":"^0.25.3"},"nyc":{"reporter":["html","lcov","text"]},"gitHead":"73ffbe6a413524d6f86f6fe0ddc8dfb29dc2ae7d","bugs":{"url":"https://github.com/avajs/require-precompiled/issues"},"homepage":"https://github.com/avajs/require-precompiled#readme","_id":"@ava/require-precompiled@1.0.0","_nodeVersion":"12.14.1","_npmVersion":"6.13.6","dist":{"integrity":"sha512-N7w4g+P/SUL8SF+HC4Z4e/ctV6nQ5AERC90K90r4xZQ8WVrJux9albvfyYAzygyU47CSqMWh6yJwFs8DYaeWmg==","shasum":"6f4a48b75904a753eadff020bbfca81d3bbc0357","tarball":"https://registry.npmjs.org/@ava/require-precompiled/-/require-precompiled-1.0.0.tgz","fileCount":4,"unpackedSize":3576,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeQA7+CRA9TVsSAnZWagAAnDwP/0Bg7j+QybFYdLpeljpH\nc9SJKJo2YiOBi/1UDGHGbt9QGyykBcM2m3+DPst1l3f2xWF2racZniSwY0Ot\nBA+2/z7LK9DK+Q71dVSSHRRWmW/kTVUsn8M85PlIi3bZywbVTb+WcyGe/IZd\nxddDa2xL223SV61WFAfqJaCerBbe6NprTp+pW2cSt4Xrz3VZWY9wixvk2JmI\nk9sqmInrsBqkzNHkJdu/b0/3rnYNodSV7rcradBkryPPgZxripUtEJ2ip8iB\nZch60I3Y3SuJkwGh6QTNjvQmsfHH5G/l07C3Wg2E4a2ltHZUwD5RfI/qzXVz\nJoo573pMcCRYS5juh9/5ZQ4wHywnzBiVmpRU2JmvfgQThamLhGTY49oTWdvA\nu6d6BIaqkZ4cYtlqvNZoF2qOGLbw/BjYqKgd/GYKfP4B57eXiBcvVZA0P2iW\nseBfggrswwR296FxH/uyV3LNiY/4ZR6NTYwSzTxJD982cYvYEdUU8gD2MFXw\n+Jto8PJ9Y7aHVQc7mD28NwghmT2wGPMu+9KVP41xsjo0v6KDnhO1OOXQ1NUM\nqh4cY5NZWXjSYXVSa00hauijeWP3JKdQpmiHq0EkNbSS2HrK6FDO4ofHzjV7\nEyoCa5rdsBSv9lcBAKwfZ0SYxh3AlxrX2Ld/jmcJzMBB978CyGMiV2WDOxg6\nrtCG\r\n=lYnQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAT3MNudTCvgLEYaUc2mfJWEW2Tz7pg0kQPiyXYtKuPaAiBGdywb9KhrpN4R+A3sP3rEaYvaRyeiNY7Wobckay3Zbg=="}]},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"},{"name":"novemberborn","email":"mark@novemberborn.net"},{"name":"vdemedes","email":"vdemedes@gmail.com"}],"_npmUser":{"name":"novemberborn","email":"mark@novemberborn.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/require-precompiled_1.0.0_1581256445729_0.22046781184064046"},"_hasShrinkwrap":false}},"time":{"created":"2020-02-09T13:54:05.605Z","1.0.0":"2020-02-09T13:54:05.860Z","modified":"2022-04-04T16:41:56.244Z"},"maintainers":[{"email":"sindresorhus@gmail.com","name":"sindresorhus"},{"email":"mark@novemberborn.net","name":"novemberborn"}],"description":"Require extension that allows for caching/precompiling","homepage":"https://github.com/avajs/require-precompiled#readme","keywords":["require","extension","cache","precompile"],"repository":{"type":"git","url":"git+https://github.com/avajs/require-precompiled.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"bugs":{"url":"https://github.com/avajs/require-precompiled/issues"},"license":"MIT","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 => {\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) => 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 => {\n\t// ...\n}, '.cjs')\n```\n\n## License\n\nMIT © [James Talmage](https://github.com/jamestalmage)\n","readmeFilename":"readme.md"}