{"_id":"@bytriska/find-up","name":"@bytriska/find-up","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bytriska/find-up","type":"module","version":"1.0.0","description":"Find files by walking up parent directories and resolving them based on an ordered priority manifest.","author":{"name":"Triska Mahfud K","url":"https://github.com/bytriska"},"license":"MIT","funding":"https://github.com/sponsors/bytriska","homepage":"https://github.com/bytriska/find-up#readme","repository":{"type":"git","url":"git+https://github.com/bytriska/find-up.git"},"bugs":{"url":"https://github.com/bytriska/find-up/issues"},"keywords":["find-up","priority-search","tiered-search","filesystem","config-resolver","typescript","nodejs"],"exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","devDependencies":{"@antfu/eslint-config":"^6.7.3","@types/node":"^25.0.3","@vitest/coverage-v8":"^4.0.16","bumpp":"^10.3.2","eslint":"^9.39.2","lint-staged":"^16.2.7","prettier":"3.3.3","simple-git-hooks":"^2.13.1","tsup":"^8.5.1","typescript":"<5.9.0","vitest":"^4.0.16"},"simple-git-hooks":{"pre-commit":"pnpm test && pnpm lint:fix"},"lint-staged":{"*.{js,ts,cjs,mjs,json,yaml,md}":["eslint --fix","prettier --write"]},"scripts":{"build":"tsup","prepublish":"pnpm build","release":"pnpm test && bumpp","lint":"prettier --check . && eslint .","lint:fix":"prettier --write . && eslint --fix .","test":"vitest run","test:coverage":"vitest run --coverage"},"_id":"@bytriska/find-up@1.0.0","_integrity":"sha512-Gqv+2t1rgF5LkRuraeGasHpwGF958eEIGBXYPz60/ewmhu0XCsNGI2TfkIu53WRDICj7aygS8gHrv293Tild9A==","_resolved":"/tmp/8ad68f04bad670d8047e67173cf74c5f/bytriska-find-up-1.0.0.tgz","_from":"file:bytriska-find-up-1.0.0.tgz","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-Gqv+2t1rgF5LkRuraeGasHpwGF958eEIGBXYPz60/ewmhu0XCsNGI2TfkIu53WRDICj7aygS8gHrv293Tild9A==","shasum":"5c6cb20d648ce9389cc1b57223259c7ef0aecdd4","tarball":"https://registry.npmjs.org/@bytriska/find-up/-/find-up-1.0.0.tgz","fileCount":9,"unpackedSize":18707,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bytriska%2ffind-up@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC9FdvkJtVpkgv0g9EN7HPNPFE/+LWv+P4gcLK3BqaL7QIhAPbA7IXzqCrVJj7h8AQprn6bQvazgZREkljL5k8E4FZe"}]},"_npmUser":{"name":"bytriska","email":"im.triskuy@gmail.com"},"directories":{},"maintainers":[{"name":"bytriska","email":"im.triskuy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/find-up_1.0.0_1772470130775_0.9195381098581183"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-02T16:48:50.692Z","1.0.0":"2026-03-02T16:48:50.931Z","modified":"2026-03-02T16:48:51.330Z"},"maintainers":[{"name":"bytriska","email":"im.triskuy@gmail.com"}],"description":"Find files by walking up parent directories and resolving them based on an ordered priority manifest.","homepage":"https://github.com/bytriska/find-up#readme","keywords":["find-up","priority-search","tiered-search","filesystem","config-resolver","typescript","nodejs"],"repository":{"type":"git","url":"git+https://github.com/bytriska/find-up.git"},"author":{"name":"Triska Mahfud K","url":"https://github.com/bytriska"},"bugs":{"url":"https://github.com/bytriska/find-up/issues"},"license":"MIT","readme":"# @bytriska/find-up\n\n**A priority-aware file discovery utility that respects manifest order over directory depth.**\n\nUnlike libraries like [find-up](https://github.com/sindresorhus/find-up.git) which return the first file encountered while walking up the directory tree, `@bytriska/find-up` prioritizes your manifest order. It ensures that if a higher-priority file exists anywhere in the path up to the root, it will be preferred over a lower-priority file found closer to the current working directory.\n\n## The Difference\n\nConsider this file structure:\n\n```text\n/\n└── home\n    └── user\n        ├── high-priority.png\n        └── project\n            └── src\n                ├── low-priority.png\n                └── app.js\n```\n\n### Standard `find-up` behavior\n\n`find-up` stops at the first match it sees while walking up.\n\n```js\nimport { findUp } from 'find-up'\n// Starts at /src, finds 'low-priority.png' first.\nawait findUp(['high-priority.png', 'low-priority.png'])\n// => '/home/user/project/src/low-priority.png'\n```\n\n### `@bytriska/find-up` behavior\n\nThis library ensures the search respects the order of your array, regardless of depth.\n\n```js\nimport { resolveOne } from '@bytriska/find-up'\n\nawait resolveOne(['high-priority.png', 'low-priority.png'])\n// => { path: '/home/user/high-priority.png', priority: 0, ... }\n```\n\n---\n\n## Installation\n\n```bash\nnpm install @bytriska/find-up\n# or\npnpm add @bytriska/find-up\n```\n\n---\n\n## API Reference\n\n### `resolveOne(manifest, options?)`\n\nFinds the single highest-priority match based on the manifest order.\n\n- **manifest**: `string | string[] | string[][]` - An ordered list of candidates.\n- **options**: `ResolveOptions`\n  - `cwd`: Starting directory (default: `process.cwd()`).\n  - `boundaryDir`: Where to stop searching (default: system root).\n\n**Returns**: `Promise<ResolutionEntry | null>`\n\n### `resolveAll(manifest, options?)`\n\nFinds all occurrences of items in the manifest, returned in the order of their priority.\n\n**Returns**: `Promise<ResolutionEntry[]>`\n\n### The `ResolutionEntry` Object\n\nMatches are returned with the following metadata:\n\n| Property     | Type     | Description                                                     |\n| :----------- | :------- | :-------------------------------------------------------------- |\n| `path`       | `string` | The absolute path to the file/folder.                           |\n| `priority`   | `number` | The index position in your manifest (lower is higher priority). |\n| `identifier` | `string` | The name of the file that was matched.                          |\n| `distance`   | `number` | Levels of directories traversed (0 = current directory).        |\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-bd45c3ef8af12a6784f84b3bdd66dbca"}