{
  "manifest": {
    "name": "ignore",
    "version": "5.3.1",
    "description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.",
    "files": [
      "legacy.js",
      "index.js",
      "index.d.ts",
      "LICENSE-MIT"
    ],
    "scripts": {
      "prepublishOnly": "npm run build",
      "build": "babel -o legacy.js index.js",
      "test:lint": "eslint .",
      "test:tsc": "tsc ./test/ts/simple.ts --lib ES6",
      "test:ts": "node ./test/ts/simple.js",
      "tap": "tap --reporter classic",
      "test:git": "npm run tap test/git-check-ignore.js",
      "test:ignore": "npm run tap test/ignore.js",
      "test:others": "npm run tap test/others.js",
      "test:cases": "npm run tap test/*.js -- --coverage",
      "test:no-coverage": "npm run tap test/*.js -- --no-check-coverage",
      "test:only": "npm run test:lint && npm run test:tsc && npm run test:ts && npm run test:cases",
      "test": "npm run test:only",
      "test:win32": "IGNORE_TEST_WIN32=1 npm run test",
      "report": "tap --coverage-report=html",
      "posttest": "npm run report && codecov"
    },
    "repository": {
      "type": "git",
      "url": "git@github.com:kaelzhang/node-ignore.git"
    },
    "keywords": [
      "ignore",
      ".gitignore",
      "gitignore",
      "npmignore",
      "rules",
      "manager",
      "filter",
      "regexp",
      "regex",
      "fnmatch",
      "glob",
      "asterisks",
      "regular-expression"
    ],
    "author": {
      "name": "kael"
    },
    "license": "MIT",
    "bugs": {
      "url": "https://github.com/kaelzhang/node-ignore/issues"
    },
    "devDependencies": {
      "@babel/cli": "^7.22.9",
      "@babel/core": "^7.22.9",
      "@babel/preset-env": "^7.22.9",
      "codecov": "^3.8.2",
      "debug": "^4.3.4",
      "eslint": "^8.46.0",
      "eslint-config-ostai": "^3.0.0",
      "eslint-plugin-import": "^2.28.0",
      "mkdirp": "^3.0.1",
      "pre-suf": "^1.1.1",
      "rimraf": "^5.0.1",
      "spawn-sync": "^2.0.0",
      "tap": "^16.3.9",
      "tmp": "0.2.1",
      "typescript": "^5.1.6"
    },
    "engines": {
      "node": ">= 4"
    },
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-ignore-5.3.1-5073e554cd42c5b33b394375f538b8593e34d4ef-integrity/node_modules/ignore/package.json",
    "readmeFilename": "README.md",
    "readme": "<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n    <th>Downloads</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://github.com/kaelzhang/node-ignore/actions/workflows/nodejs.yml\">\n    <img\n      src=\"https://github.com/kaelzhang/node-ignore/actions/workflows/nodejs.yml/badge.svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/kaelzhang/node-ignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/kaelzhang/node-ignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/kaelzhang/node-ignore\">\n    <img\n      src=\"https://codecov.io/gh/kaelzhang/node-ignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://www.npmjs.org/package/ignore\">\n    <img\n      src=\"http://img.shields.io/npm/dm/ignore.svg\"\n      alt=\"npm module downloads per month\" /></a>\n  </td>\n</tr></tbody></table>\n\n# ignore\n\n`ignore` is a manager, filter and parser which implemented in pure JavaScript according to the [.gitignore spec 2.22.1](http://git-scm.com/docs/gitignore).\n\n`ignore` is used by eslint, gitbook and [many others](https://www.npmjs.com/browse/depended/ignore).\n\nPay **ATTENTION** that [`minimatch`](https://www.npmjs.org/package/minimatch) (which used by `fstream-ignore`) does not follow the gitignore spec.\n\nTo filter filenames according to a .gitignore file, I recommend this npm package, `ignore`.\n\nTo parse an `.npmignore` file, you should use `minimatch`, because an `.npmignore` file is parsed by npm using `minimatch` and it does not work in the .gitignore way.\n\n### Tested on\n\n`ignore` is fully tested, and has more than **five hundreds** of unit tests.\n\n- Linux + Node: `0.8` - `7.x`\n- Windows + Node: `0.10` - `7.x`, node < `0.10` is not tested due to the lack of support of appveyor.\n\nActually, `ignore` does not rely on any versions of node specially.\n\nSince `4.0.0`, ignore will no longer support `node < 6` by default, to use in node < 6, `require('ignore/legacy')`. For details, see [CHANGELOG](https://github.com/kaelzhang/node-ignore/blob/master/CHANGELOG.md).\n\n## Table Of Main Contents\n\n- [Usage](#usage)\n- [`Pathname` Conventions](#pathname-conventions)\n- See Also:\n  - [`glob-gitignore`](https://www.npmjs.com/package/glob-gitignore) matches files using patterns and filters them according to gitignore rules.\n- [Upgrade Guide](#upgrade-guide)\n\n## Install\n\n```sh\nnpm i ignore\n```\n\n## Usage\n\n```js\nimport ignore from 'ignore'\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\n### Filter the given paths\n\n```js\nconst paths = [\n  '.abc/a.js',    // filtered out\n  '.abc/d/e.js'   // included\n]\n\nig.filter(paths)        // ['.abc/d/e.js']\nig.ignores('.abc/a.js') // true\n```\n\n### As the filter function\n\n```js\npaths.filter(ig.createFilter()); // ['.abc/d/e.js']\n```\n\n### Win32 paths will be handled\n\n```js\nig.filter(['.abc\\\\a.js', '.abc\\\\d\\\\e.js'])\n// if the code above runs on windows, the result will be\n// ['.abc\\\\d\\\\e.js']\n```\n\n## Why another ignore?\n\n- `ignore` is a standalone module, and is much simpler so that it could easy work with other programs, unlike [isaacs](https://npmjs.org/~isaacs)'s [fstream-ignore](https://npmjs.org/package/fstream-ignore) which must work with the modules of the fstream family.\n\n- `ignore` only contains utility methods to filter paths according to the specified ignore rules, so\n  - `ignore` never try to find out ignore rules by traversing directories or fetching from git configurations.\n  - `ignore` don't cares about sub-modules of git projects.\n\n- Exactly according to [gitignore man page](http://git-scm.com/docs/gitignore), fixes some known matching issues of fstream-ignore, such as:\n  - '`/*.js`' should only match '`a.js`', but not '`abc/a.js`'.\n  - '`**/foo`' should match '`foo`' anywhere.\n  - Prevent re-including a file if a parent directory of that file is excluded.\n  - Handle trailing whitespaces:\n    - `'a '`(one space) should not match `'a  '`(two spaces).\n    - `'a \\ '` matches `'a  '`\n  - All test cases are verified with the result of `git check-ignore`.\n\n# Methods\n\n## .add(pattern: string | Ignore): this\n## .add(patterns: Array<string | Ignore>): this\n\n- **pattern** `String | Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array<String | Ignore>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\n\nNotice that a line starting with `'#'`(hash) is treated as a comment. Put a backslash (`'\\'`) in front of the first hash for patterns that begin with a hash, if you want to ignore a file with a hash at the beginning of the filename.\n\n```js\nignore().add('#abc').ignores('#abc')    // false\nignore().add('\\\\#abc').ignores('#abc')   // true\n```\n\n`pattern` could either be a line of ignore pattern or a string of multiple ignore patterns, which means we could just `ignore().add()` the content of a ignore file:\n\n```js\nignore()\n.add(fs.readFileSync(filenameOfGitignore).toString())\n.filter(filenames)\n```\n\n`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance.\n\n## <strike>.addIgnoreFile(path)</strike>\n\nREMOVED in `3.x` for now.\n\nTo upgrade `ignore@2.x` up to `3.x`, use\n\n```js\nimport fs from 'fs'\n\nif (fs.existsSync(filename)) {\n  ignore().add(fs.readFileSync(filename).toString())\n}\n```\n\ninstead.\n\n## .filter(paths: Array&lt;Pathname&gt;): Array&lt;Pathname&gt;\n\n```ts\ntype Pathname = string\n```\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<Pathname>` The array of `pathname`s to be filtered.\n\n### `Pathname` Conventions:\n\n#### 1. `Pathname` should be a `path.relative()`d pathname\n\n`Pathname` should be a string that have been `path.join()`ed, or the return value of `path.relative()` to the current directory,\n\n```js\n// WRONG, an error will be thrown\nig.ignores('./abc')\n\n// WRONG, for it will never happen, and an error will be thrown\n// If the gitignore rule locates at the root directory,\n// `'/abc'` should be changed to `'abc'`.\n// ```\n// path.relative('/', '/abc')  -> 'abc'\n// ```\nig.ignores('/abc')\n\n// WRONG, that it is an absolute path on Windows, an error will be thrown\nig.ignores('C:\\\\abc')\n\n// Right\nig.ignores('abc')\n\n// Right\nig.ignores(path.join('./abc'))  // path.join('./abc') -> 'abc'\n```\n\nIn other words, each `Pathname` here should be a relative path to the directory of the gitignore rules.\n\nSuppose the dir structure is:\n\n```\n/path/to/your/repo\n    |-- a\n    |   |-- a.js\n    |\n    |-- .b\n    |\n    |-- .c\n         |-- .DS_store\n```\n\nThen the `paths` might be like this:\n\n```js\n[\n  'a/a.js'\n  '.b',\n  '.c/.DS_store'\n]\n```\n\n#### 2. filenames and dirnames\n\n`node-ignore` does NO `fs.stat` during path matching, so for the example below:\n\n```js\n// First, we add a ignore pattern to ignore a directory\nig.add('config/')\n\n// `ig` does NOT know if 'config', in the real world,\n//   is a normal file, directory or something.\n\nig.ignores('config')\n// `ig` treats `config` as a file, so it returns `false`\n\nig.ignores('config/')\n// returns `true`\n```\n\nSpecially for people who develop some library based on `node-ignore`, it is important to understand that.\n\nUsually, you could use [`glob`](http://npmjs.org/package/glob) with `option.mark = true` to fetch the structure of the current directory:\n\n```js\nimport glob from 'glob'\n\nglob('**', {\n  // Adds a / character to directory matches.\n  mark: true\n}, (err, files) => {\n  if (err) {\n    return console.error(err)\n  }\n\n  let filtered = ignore().add(patterns).filter(files)\n  console.log(filtered)\n})\n```\n\n## .ignores(pathname: Pathname): boolean\n\n> new in 3.2.0\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n## .createFilter()\n\nCreates a filter function which could filter an array of paths with `Array.prototype.filter`.\n\nReturns `function(path)` the filter function.\n\n## .test(pathname: Pathname) since 5.0.0\n\nReturns `TestResult`\n\n```ts\ninterface TestResult {\n  ignored: boolean\n  // true if the `pathname` is finally unignored by some negative pattern\n  unignored: boolean\n}\n```\n\n- `{ignored: true, unignored: false}`: the `pathname` is ignored\n- `{ignored: false, unignored: true}`: the `pathname` is unignored\n- `{ignored: false, unignored: false}`: the `pathname` is never matched by any ignore rules.\n\n## static `ignore.isPathValid(pathname): boolean` since 5.0.0\n\nCheck whether the `pathname` is an valid `path.relative()`d path according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname).\n\nThis method is **NOT** used to check if an ignore pattern is valid.\n\n```js\nignore.isPathValid('./foo')  // false\n```\n\n## ignore(options)\n\n### `options.ignorecase` since 4.0.0\n\nSimilar as the `core.ignorecase` option of [git-config](https://git-scm.com/docs/git-config), `node-ignore` will be case insensitive if `options.ignorecase` is set to `true` (the default value), otherwise case sensitive.\n\n```js\nconst ig = ignore({\n  ignorecase: false\n})\n\nig.add('*.png')\n\nig.ignores('*.PNG')  // false\n```\n\n### `options.ignoreCase?: boolean` since 5.2.0\n\nWhich is alternative to `options.ignoreCase`\n\n### `options.allowRelativePaths?: boolean` since 5.2.0\n\nThis option brings backward compatibility with projects which based on `ignore@4.x`. If `options.allowRelativePaths` is `true`, `ignore` will not check whether the given path to be tested is [`path.relative()`d](#pathname-conventions).\n\nHowever, passing a relative path, such as `'./foo'` or `'../foo'`, to test if it is ignored or not is not a good practise, which might lead to unexpected behavior\n\n```js\nignore({\n  allowRelativePaths: true\n}).ignores('../foo/bar.js') // And it will not throw\n```\n\n****\n\n# Upgrade Guide\n\n## Upgrade 4.x -> 5.x\n\nSince `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory.\n\nWhile `ignore < 5.0.0` did not make sure what the return value was, as well as\n\n```ts\n.ignores(pathname: Pathname): boolean\n\n.filter(pathnames: Array<Pathname>): Array<Pathname>\n\n.createFilter(): (pathname: Pathname) => boolean\n\n.test(pathname: Pathname): {ignored: boolean, unignored: boolean}\n```\n\nSee the convention [here](#1-pathname-should-be-a-pathrelatived-pathname) for details.\n\nIf there are invalid pathnames, the conversion and filtration should be done by users.\n\n```js\nimport {isPathValid} from 'ignore' // introduced in 5.0.0\n\nconst paths = [\n  // invalid\n  //////////////////\n  '',\n  false,\n  '../foo',\n  '.',\n  //////////////////\n\n  // valid\n  'foo'\n]\n.filter(isValidPath)\n\nig.filter(paths)\n```\n\n## Upgrade 3.x -> 4.x\n\nSince `4.0.0`, `ignore` will no longer support node < 6, to use `ignore` in node < 6:\n\n```js\nvar ignore = require('ignore/legacy')\n```\n\n## Upgrade 2.x -> 3.x\n\n- All `options` of 2.x are unnecessary and removed, so just remove them.\n- `ignore()` instance is no longer an [`EventEmitter`](nodejs.org/api/events.html), and all events are unnecessary and removed.\n- `.addIgnoreFile()` is removed, see the [.addIgnoreFile](#addignorefilepath) section for details.\n\n****\n\n# Collaborators\n\n- [@whitecolor](https://github.com/whitecolor) *Alex*\n- [@SamyPesse](https://github.com/SamyPesse) *Samy Pessé*\n- [@azproduction](https://github.com/azproduction) *Mikhail Davydov*\n- [@TrySound](https://github.com/TrySound) *Bogdan Chadkin*\n- [@JanMattner](https://github.com/JanMattner) *Jan Mattner*\n- [@ntwb](https://github.com/ntwb) *Stephen Edgar*\n- [@kasperisager](https://github.com/kasperisager) *Kasper Isager*\n- [@sandersn](https://github.com/sandersn) *Nathan Shively-Sanders*\n"
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz",
    "hash": "5073e554cd42c5b33b394375f538b8593e34d4ef",
    "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==",
    "registry": "npm",
    "packageName": "ignore",
    "cacheIntegrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== sha1-UHPlVM1CxbM7OUN19Ti4WT401O8="
  },
  "registry": "npm",
  "hash": "5073e554cd42c5b33b394375f538b8593e34d4ef"
}