{"_id":"node-package-field-info","name":"node-package-field-info","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"node-package-field-info","version":"1.0.0","description":"Shared core for node-exports-info and node-imports-info: maps node version ranges to feature categories and looks up per-category flags.","main":false,"exports":{"./makeGetCategoriesForRange":"./makeGetCategoriesForRange.js","./makeGetCategory":"./makeGetCategory.js","./makeGetCategoryFlags":"./makeGetCategoryFlags.js","./makeGetCategoryInfo":"./makeGetCategoryInfo.js","./makeGetConditionsForCategory":"./makeGetConditionsForCategory.js","./makeGetRange":"./makeGetRange.js","./makeGetRangePairs":"./makeGetRangePairs.js","./makeIsCategory":"./makeIsCategory.js","./package.json":"./package.json"},"sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","lint":"eslint .","postlint":"tsc && attw -P","pretest":"npm run lint","tests-only":"nyc tape 'test/**/*.js'","test":"npm run tests-only","posttest":"npx npm@'>=10.2' audit --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"","dependencies":"DT_CLEAN_NPM_COMMAND=\"$npm_command\" npx dt-clean@^1.2.0 --auto"},"repository":{"type":"git","url":"git+https://github.com/inspect-js/node-package-field-info.git"},"keywords":["node","semver","version","ranges","categories","exports","imports","package.json","support","info"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"license":"MIT","bugs":{"url":"https://github.com/inspect-js/node-package-field-info/issues"},"homepage":"https://github.com/inspect-js/node-package-field-info#readme","dependencies":{"array.prototype.flatmap":"^1.3.3","es-errors":"^1.3.0","object.entries":"^1.1.9","semver":"^6.3.1"},"devDependencies":{"@arethetypeswrong/cli":"^0.18.4","@ljharb/eslint-config":"^22.2.3","@ljharb/tsconfig":"^0.3.2","@types/array.prototype.flatmap":"^1.2.6","@types/node":"^26.0.0","@types/object-inspect":"^1.13.0","@types/object.entries":"^1.1.1","@types/semver":"^6.2.7","auto-changelog":"^2.6.0","es-value-fixtures":"^1.7.1","eslint":"^10.5.0","for-each":"^0.3.5","in-publish":"^2.0.1","jiti":"^0.0.0","npmignore":"^0.3.5","nyc":"^10.3.2","object-inspect":"^1.13.4","safe-publish-latest":"^2.0.0","tape":"^5.10.2","typescript":"next"},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"publishConfig":{"ignore":[".github/workflows",".nycrc","eslint.config.mjs","test","types"]},"gitHead":"f3e0d0b4ce7f44c32fb4332c8addf11af3173c0b","_id":"node-package-field-info@1.0.0","_nodeVersion":"26.3.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-Hys2LZ8YEBxqQXz++NvsFPnSyXMskiOam38rSAWGBnZMDGyFGkYI+yUq6fVYPJJBu0HxvTIiZ2tWk2p2OVCrDg==","shasum":"dfc0b1908fd9565c836fb962108e7b328be8edeb","tarball":"https://registry.npmjs.org/node-package-field-info/-/node-package-field-info-1.0.0.tgz","fileCount":23,"unpackedSize":19177,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCOU+UJkWSIvs2iK56HK8pGb2f3w1CIpJIwc0/UeIvVpwIgBWkmkMyIrCNipfz1/dUvOaM5DHxP+UCUi5E6QV4iB+U="}]},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/node-package-field-info_1.0.0_1782183613415_0.5993759338379716"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-23T03:00:13.367Z","1.0.0":"2026-06-23T03:00:13.561Z","modified":"2026-06-23T03:00:13.753Z"},"maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"}],"description":"Shared core for node-exports-info and node-imports-info: maps node version ranges to feature categories and looks up per-category flags.","homepage":"https://github.com/inspect-js/node-package-field-info#readme","keywords":["node","semver","version","ranges","categories","exports","imports","package.json","support","info"],"repository":{"type":"git","url":"git+https://github.com/inspect-js/node-package-field-info.git"},"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"bugs":{"url":"https://github.com/inspect-js/node-package-field-info/issues"},"license":"MIT","readme":"# node-package-field-info <sup>[![Version Badge][npm-version-svg]][package-url]</sup>\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nShared core for [`node-exports-info`](https://www.npmjs.com/package/node-exports-info) and [`node-imports-info`](https://www.npmjs.com/package/node-imports-info): maps node version ranges to feature categories and looks up per-category flags.\n\nEach of those packages is essentially data — a `ranges` map of node semver range → category, plus per-flag tables of which categories support which feature. This package provides the (otherwise duplicated) logic that operates on that data, as factory functions: pass in the data, get back the accessor.\n\n## Entry points\nEach entry point is a factory: call it with a package's data, and it returns the corresponding accessor function.\n\n - `node-package-field-info/makeGetCategory`: `(ranges) => (nodeVersion?) => category`. Returns the latest category matching the version (defaulting to the current node version); throws if none match.\n - `node-package-field-info/makeGetCategoriesForRange`: `(ranges) => (range) => category[]`. Returns the categories whose range overlaps the given range.\n - `node-package-field-info/makeGetRange`: `(ranges) => (category) => range`. Returns the range for a category; throws for an unknown category.\n - `node-package-field-info/makeGetRangePairs`: `(ranges) => () => [range, category][]`. Returns the range/category pairs.\n - `node-package-field-info/makeIsCategory`: `(ranges) => (category) => boolean`. Returns whether a value is a known category.\n - `node-package-field-info/makeGetCategoryFlags`: `(isCategory, flagTables) => (category) => flags`. Returns an object of boolean flags (one per key in `flagTables`); throws for an unknown category.\n - `node-package-field-info/makeGetConditionsForCategory`: `(isCategory, conditionTables) => (category, moduleSystem?) => conditions`. Returns the array of supported conditions (or `null`) for a category, optionally narrowed to `'require'`/`'import'`; throws for an unknown category. `conditionTables` is `{ addonsCategories, moduleSyncCategories, nullCategories, defaultOnlyCategories }`.\n - `node-package-field-info/makeGetCategoryInfo`: `(getConditionsForCategory, getCategoryFlags) => (category, moduleSystem?) => { conditions, flags }`. Combines the two into one lookup.\n\nThe `ranges` object maps a node semver version range to a category, ordered most-recent first:\n```js\n{\n\t__proto__: null,\n\t'>= 3': 'c',\n\t'2.x': 'b',\n\t'< 2': 'a',\n}\n```\nThe `flagTables` object maps a flag name to the set of categories that support it:\n```js\n{\n\tfoo: { __proto__: null, b: true, c: true },\n\tbar: { __proto__: null, c: true },\n}\n```\n\n## Example\n```js\nvar makeGetCategory = require('node-package-field-info/makeGetCategory');\n\nvar ranges = { __proto__: null, '>= 3': 'c', '2.x': 'b', '< 2': 'a' };\nvar getCategory = makeGetCategory(ranges);\n\ngetCategory('2.5.0'); // 'b'\n```\n\n## Related packages\n - [`node-exports-info`](https://www.npmjs.com/package/node-exports-info): info about node `exports` field support\n - [`node-imports-info`](https://www.npmjs.com/package/node-imports-info): info about node `imports` field support\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/node-package-field-info\n[npm-version-svg]: https://versionbadg.es/inspect-js/node-package-field-info.svg\n[deps-svg]: https://david-dm.org/inspect-js/node-package-field-info.svg\n[deps-url]: https://david-dm.org/inspect-js/node-package-field-info\n[dev-deps-svg]: https://david-dm.org/inspect-js/node-package-field-info/dev-status.svg\n[dev-deps-url]: https://david-dm.org/inspect-js/node-package-field-info#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/node-package-field-info.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/node-package-field-info.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/node-package-field-info.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=node-package-field-info\n[codecov-image]: https://codecov.io/gh/inspect-js/node-package-field-info/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/inspect-js/node-package-field-info/\n[actions-image]: https://img.shields.io/github/check-runs/inspect-js/node-package-field-info/main\n[actions-url]: https://github.com/inspect-js/node-package-field-info/actions\n","readmeFilename":"README.md","_rev":"1-0b8a33cf2dcfcf8518e35df6214db6f3"}