{"name":"napi-postinstall","version":"0.3.4","type":"commonjs","description":"The `postinstall` script helper for handling native bindings in legacy `npm` versions","repository":{"type":"git","url":"git+https://github.com/un-ts/napi-postinstall.git"},"author":{"name":"JounQin","email":"admin@1stg.me","url":"https://www.1stG.me"},"funding":"https://opencollective.com/napi-postinstall","license":"MIT","engines":{"node":"^12.20.0 || ^14.18.0 || >=16.0.0"},"bin":{"napi-postinstall":"lib/cli.js"},"main":"./lib/index.js","types":"./lib/index.d.ts","exports":{".":{"types":"./lib/index.d.ts","default":"./lib/index.js"},"./fallback":{"types":"./lib/fallback.d.ts","default":"./lib/fallback.js"},"./package.json":"./package.json"},"gitHead":"95a44d2c79e875a6207ef0a0de05ebfc29922000","_id":"napi-postinstall@0.3.4","bugs":{"url":"https://github.com/un-ts/napi-postinstall/issues"},"homepage":"https://github.com/un-ts/napi-postinstall#readme","_nodeVersion":"22.20.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==","shasum":"7af256d6588b5f8e952b9190965d6b019653bbb9","tarball":"http://registry-npm.ywwl.com/napi-postinstall/download/napi-postinstall-0.3.4.tgz","fileCount":24,"unpackedSize":59652,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/napi-postinstall@0.3.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC+sQVqoAEfNwW70WLhELUV9wdhp1y+SBY4VkzRrmKgmgIhAKYKkvHRiwvmn2uWijRD16FxKrW234S3Mh/brZQvtT0x"}],"size":15465,"noattachment":false,"key":"/napi-postinstall/-/napi-postinstall-0.3.4.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:eded7bcf-f80e-4cb0-bf7e-fe9b21a47cac"}},"directories":{},"maintainers":[{"name":"jounqin","email":"admin@1stg.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/napi-postinstall_0.3.4_1759559732773_0.9591710354561451"},"_hasShrinkwrap":false,"readme":"# napi-postinstall\n\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/un-ts/napi-postinstall/ci.yml?branch=main)](https://github.com/un-ts/napi-postinstall/actions/workflows/ci.yml?query=branch%3Amain)\n[![Codecov](https://img.shields.io/codecov/c/github/un-ts/napi-postinstall.svg)](https://codecov.io/gh/un-ts/napi-postinstall)\n[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Fnapi-postinstall%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)\n[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/un-ts/napi-postinstall)](https://coderabbit.ai)\n[![npm](https://img.shields.io/npm/v/napi-postinstall.svg)](https://www.npmjs.com/package/napi-postinstall)\n[![GitHub Release](https://img.shields.io/github/release/un-ts/napi-postinstall)](https://github.com/un-ts/napi-postinstall/releases)\n\n[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/changesets/changesets)\n\nThe `postinstall` script helper for handling native bindings in legacy `npm` versions, this is a reimplementation of the [`node-install`][node-install] functionality from [`esbuild`][esbuild] for [`napi-rs`][napi-rs] ecosystem packages like [`rollup`][rollup], [`@swc/core`][swc-core] and [`unrs-resolver`][unrs-resolver].\n\nFor more details, please refer to the following issues:\n\n- [npm/cli#4828](https://github.com/npm/cli/issues/4828) -- root cause\n- [napi-rs/napi-rs#2569](https://github.com/napi-rs/napi-rs/issues/2569)\n- [unrs/unrs-resolver#56](https://github.com/unrs/unrs-resolver/issues/56)\n\n## TOC <!-- omit in toc -->\n\n- [Usage](#usage)\n  - [Install](#install)\n  - [CLI](#cli)\n  - [API](#api)\n    - [Types](#types)\n    - [Example](#example)\n- [Sponsors and Backers](#sponsors-and-backers)\n  - [Sponsors](#sponsors)\n  - [Backers](#backers)\n- [Changelog](#changelog)\n- [License](#license)\n\n## Usage\n\n### Install\n\n```sh\n# pnpm\npnpm add napi-postinstall\n\n# yarn\nyarn add napi-postinstall\n\n# npm\nnpm i napi-postinstall\n\n# bun\nbun add napi-postinstall\n```\n\n### CLI\n\n```sh\nnapi-postinstall unrs-resolver #<napi-package-name>\n```\n\nYou can put it into `scripts#postinstall` of your `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"postinstall\": \"napi-postinstall unrs-resolver\"\n  }\n}\n```\n\nThis will check and prepare the napi binding packages for you automatically.\n\n### API\n\n#### Types\n\n```ts\n// napi-postinstall\nexport interface PackageJson {\n  name: string\n  version: string\n}\n\nexport declare function checkAndPreparePackage(\n  packageNameOrPackageJson: PackageJson | string,\n  checkVersion?: boolean,\n): Promise<void>\n\n// napi-postinstall/fallback\ndeclare function fallback<T = unknown>(\n  packageJsonPath: string,\n  checkVersion?: boolean,\n): T\nexport = fallback\n```\n\n#### Example\n\n```js\n// index.js\nconst { checkAndPreparePackage, isNpm } = require('napi-postinstall')\n\nif (isNpm()) {\n  void checkAndPreparePackage('unrs-resolver' /* <napi-package-name> */)\n}\n\n// fallback.js\nmodule.exports = require('napi-postinstall/fallback')(\n  require.resolve('./package.json') /* <napi-package-json-path> */,\n  true /* <check-version> */,\n)\n```\n\n## Sponsors and Backers\n\n[![Sponsors](https://raw.githubusercontent.com/1stG/static/master/sponsors.svg)](https://github.com/sponsors/JounQin)\n\n### Sponsors\n\n| 1stG                                                                                                                   | RxTS                                                                                                                   | UnTS                                                                                                                   |\n| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| [![1stG Open Collective sponsors](https://opencollective.com/1stG/organizations.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective sponsors](https://opencollective.com/rxts/organizations.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective sponsors](https://opencollective.com/unts/organizations.svg)](https://opencollective.com/unts) |\n\n### Backers\n\n| 1stG                                                                                                                | RxTS                                                                                                                | UnTS                                                                                                                |\n| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |\n| [![1stG Open Collective backers](https://opencollective.com/1stG/individuals.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers](https://opencollective.com/rxts/individuals.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers](https://opencollective.com/unts/individuals.svg)](https://opencollective.com/unts) |\n\n## Changelog\n\nDetailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).\n\n## License\n\n[MIT][] © [JounQin][]@[1stG.me][]\n\n[node-install]: https://github.com/evanw/esbuild/blob/4475787eef4c4923b92b9fa37ebba1c88b9e1d9b/lib/npm/node-install.ts\n[esbuild]: https://github.com/evanw/esbuild\n[napi-rs]: https://github.com/napi-rs/napi-rs\n[rollup]: https://github.com/rollup/rollup\n[swc-core]: https://github.com/swc-project/swc\n[unrs-resolver]: https://github.com/unrs/unrs-resolver\n[1stG.me]: https://www.1stG.me\n[JounQin]: https://github.com/JounQin\n[MIT]: http://opensource.org/licenses/MIT\n","publish_time":1759559732966,"_cnpm_publish_time":1759559732966,"dist-tags":{"latest":"0.3.8"}}