{"_id":"@balena/dockerignore","_rev":"133-e80dac9e4dcdb4bb2ba885b46197a682","name":"@balena/dockerignore","dist-tags":{"latest":"1.0.2"},"versions":{"0.0.6-changelog-resinci-yml-1bc9e55cd43a70a391a6444687d0f0a14739b956":{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-1bc9e55cd43a70a391a6444687d0f0a14739b956","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"MIT","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-1bc9e55cd43a70a391a6444687d0f0a14739b956","maintainers":[{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"petrosagg","email":"petrosagg@gmail.com"},{"name":"balena.io","email":"accounts+npm@balena.io"}],"homepage":"https://github.com/zeit/dockerignore#readme","bugs":{"url":"https://github.com/zeit/dockerignore/issues"},"dist":{"shasum":"ca1fb87066a969a6987b0febe794a30bbb1ffff3","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6-changelog-resinci-yml-1bc9e55cd43a70a391a6444687d0f0a14739b956.tgz","fileCount":5,"integrity":"sha512-ZsBAFG6iNDv4FUX6IVV5CWk75K0hIg8rsz0nUksVi4Ifzyk0UhM6Tk3jWjeyFBCDL+tJ2foyMSCLprl9N+rZLw==","signatures":[{"sig":"MEUCIQDbfgZoCCpJNAbzvaXbdGrMQNee/2zs+7bYccGJJGwWQgIgNpyU1VByCblu2FL2wxFSuZ6xdrJC6D5ciFIAuBouGak=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10766,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemJaICRA9TVsSAnZWagAAkasP/jZW/S1Qt8BfZaIot6OL\nw9Wbh/Im94SWO+TXfnHyxy7bJ5unzHwnhSlMB3/hQTtfnTUrYormJqZ1Z7tV\naVXZnEafVWhjPrIHGuqZxDRYEUGJNLdm9cOjVrfuy9Mcet/OcXjMtJj1HIek\n2azYaewQvK6qdaWKiDrW48m9/r1Ua3u0emkXMEsVMPp0Sh/bDPYB0YjJ5O2p\nYFhXqlgu0x/pMCZpNn606OY7UnTKn/8P4BLPWgXI6zR3J8RDK4ZTTEGamnk5\nSpd7P2Od+Ln8dqz6A0GK5cBKqWFAa9xk7cxVVucpANlH0B56K1h0KoQF00ZW\nEJfSfIFkEuj9LZiSVebgOZRyRS+KBEPgKyeQe8XBFBrLchU+6TiY9jLnj2SG\nHHaWBZt5JwoSCKnMy+yaGrx5OfSVSDx6FHNYetrlnJZpqsigfnPqSzCkw0RO\nWcbirLxTnIDthGNVbeln7e0y9FVz10iiyx2cdqPRfZYkJiK6cEsPjJPfaNrG\nt8F/ZIQQ0/vBTUTqEoN75yrFimGU2THlKpuo0dS3GAvwHTDce6Bjd9UQMQtK\nO8rRSARwaZzhn56vexsQNi+mQt9mLBb+UZ25n+LKvm/AC0Os6RNd5EGv00bd\np0jCLaUuZIjFwwarN/AouW7i36TdL7IJ35CBlDSbL1k/sVGRCGXmJmYzApjl\nCjXc\r\n=dlYu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","gitHead":"1bc9e55cd43a70a391a6444687d0f0a14739b956","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","test-ci":"npm run build && nyc ava ./test/ignore.js --verbose && npm run cov-report","cov-report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","test-no-cov":"npm run build && ava ./test/ignore.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/zeit/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","codecov":"3.0.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-1bc9e55cd43a70a391a6444687d0f0a14739b956_1587058312331_0.3947947231701825","host":"s3://npm-registry-packages"}},"0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e":{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"MIT","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"9a2fb77f8e8d1bc20c38094171944bdc2ebb789b","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e.tgz","fileCount":5,"integrity":"sha512-0V9CsjWrPzkFXLaHiuNcbs1MLlH8lL1Po2avhODFWsFXGAjhpULSjfhnyH3sr+FE70EjHJzn/K1vFcvNYoCVVg==","signatures":[{"sig":"MEQCIGR5O9hsKTHciAHHT0j+c7Qr0DXZ7yyDJYoQAc1hKTDLAiBZOJS/32IXGvOn9UzEU6MrNrli501J2DkXcCeEm1DIkg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10794,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemJyBCRA9TVsSAnZWagAAU/EP/1MGlkbDQC1deifdO5TF\nXi1zEUpuqEROrCEG1+/8Wf4yHj8CIpwPQde09tL9RQQFkdPTv6Ichl7GhEdm\nIo6pdLo/XSGkGKXXVRaEceNAOwFf0VUIK58ONz712/scnZnbV0CphMaggOsV\nQB3oUTp7oBlAZxw65AMkD7gIOLCH63HQ40E/7UPvxm1h/DR2aHxJh9Xx4qyQ\nQfcUZjefPi/BNb89Mf1N064TnzoxWuX6fQ/tsu7nEcC8nCxQCvfyc/Z0bXb6\nhi094tBIRMxUT5oPF5wMcIPDnAIvmQaelvzm4M+9cmhHh0J9CW5yQSC1Z1tN\n0srG0tqhVosHYma2wdMYMjLpKbGwUMoJPQqse0ca6nWd0bGLgpiJwrnBjYEY\nzVsdWIG9lZO7rD4NrL89zbWRDSlekw/TkJaMlFUcJJ82ob7sXAq9pw+ZJ0qR\nspz8FthgD+bt+nBjQcLxQodu4c1Txmh/+Xh1c5iTrK/pc70hRzwx/5haoWQA\neuhqiCTAbTO7p3BX1gaZFFG092CrDRhKpulotDUWaVKNS2Bg/lrr6HMoSYJ6\nlBN8n/ymc6Msqt7hAO60oW6mrElDaQmyoehFJ/QiMerJ9Kht9YdoRi9ieqDs\nT0Xfg9uEFZ6h53OO1/lNtfpuU1lKRj1DY6SZliGoyKSjpSALdEp+B47guHFZ\nUVrq\r\n=MLTq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://circleci.com/gh/zeit/dockerignore\">\n    <img\n      src=\"https://circleci.com/gh/zeit/dockerignore.svg?style=svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/zeit/dockerignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/zeit/dockerignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/zeit/dockerignore\">\n    <img\n      src=\"https://codecov.io/gh/zeit/dockerignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n</tr></tbody></table>\n\n# dockerignore\n\n`dockerignore` is a manager, filter and parser which is implemented in pure JavaScript according to the .dockerignore [spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) and is used in production on [now-cli](https://github.com/zeit/now-cli/)\n\nThe `.dockerignore` spec has a few subtle differences from `.gitignore`. If you'd like a great `.gitignore` file parser, check out [ignore](https://github.com/kaelzhang/node-ignore). This package is a fork of `ignore` and follows the exact same API.\n\n#### What's different from `ignore`?\n- There are many direct differences between the `.gitignore` and `.dockerignore` specifications\n  - `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches things in the current directory (like glob). This difference is important when whitelisting after a `*` rule\n  - `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, however `.dockerignore` specifically matches on `./abc` but does not match nested files/directories like `./somedir/abc`\n  - With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using `!`) since `git` simply avoids walking through the subtree as an optimization, wheras with `.dockerignore` a subdirectory can be re-added even if a parent directory has been ignored\n  - For a complete list of differences, check out the [.gitignore spec](https://git-scm.com/docs/gitignore) and the [.dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file)\n- Under the hood, we rewrote the entire matching logic to be much simpler\n  - instead of complex Regex rule to replace patterns with regex, we scan through patterns\n  - this is also modeled directly from [docker's implementation](https://github.com/docker/docker-ce/blob/7d44629ea2c739e7803acc77b84ee8dd2a8c4746/components/engine/pkg/fileutils/fileutils.go)\n\n#### What's the same as `ignore`?\n- The entire API (In fact we even reuse the same `index.d.ts` file for TypeScript definitions)\n\n##### Tested on\n\n- Linux + Node: `9.0` (but we use `babel` and it *should* work on older version of Node. Accepting PRs if that isn't the case)\n- Windows + Node testing *coming soon*\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\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## Features\n\n- Exactly according to the [dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) \n- All test cases are verified on Circle CI by doing an actual `docker build` with the test case files and `.dockerignore` rules to ensure our tests match what happens with the real [docker](https://www.docker.com/) CLI\n- 0 external dependencies which keeps this package very small!\n\n## dockerignore vs ignore\n\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` 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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome and we are fully [commited to Open Source](https://zeit.co/blog/oss).\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Authors\n  - Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) – [▲ZEIT](https://zeit.co)\n  \n  Most of the initial work on this project was done by Kael Zhang ([@kaelzhang](https://github.com/kaelzhang)) and the [collaborators](https://github.com/kaelzhang/node-ignore#collaborators) on [node-ignore](https://github.com/kaelzhang/node-ignore)\n","gitHead":"991d541b57ffbfdea225da2bde49a1a3af7ba69e","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","test-ci":"npm run build && nyc ava ./test/ignore.js --verbose && npm run cov-report","cov-report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","test-no-cov":"npm run build && ava ./test/ignore.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","codecov":"3.0.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e_1587059840805_0.0009746643774608543","host":"s3://npm-registry-packages"}},"0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f":{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"MIT","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"a92c6ac77767b58bd66f580cbb66319130134c9f","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f.tgz","fileCount":5,"integrity":"sha512-Gfhgcy0fZWImBya2qhkP5Ilp3bA0Lv1hnxvUz+omCMzLn1otk30j0Gf+k9OFeVMuhKVz9CDxxnV+luSGUkhsSg==","signatures":[{"sig":"MEYCIQC/jtRbJCkGOx24t+2DDybMTvzIgRYexqu3Iw/Im311gAIhAKZBq6nWwGg3MwJLvxQQNDQdcbY7oqQeSvZysAm28w97","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20677,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeouUBCRA9TVsSAnZWagAAarwQAJjIp9OXhcBxzv5TJgeM\nsZs1QAQmhEn34ZPVUr8p6mgSoY02kAHYGR/QIUYrrBdSOHcbn4iyBICDAzde\nMV0RxIphuaQHdXznpL6pcL9g1/azKCJ3nGwg4+4RhUB/1f8QOM0mCJxe4iy2\nfKTDicGqOrZg3osmSy5sQRMRyKkiEifEj+pLa4/Jv7Kj4SkHKFSjwGCr/Lku\naCi6np1+nQ0SLDHerLgRiEzjffpx10jxkdbTqI9VHfjjz/e7eosQOowwtYXp\ntidvUlFqRZBV/j1njKw0gIIl4LNHjFbM/RlOz6srnLUwAuEDstReCj2ePmtV\npatbDdFx6JRf4lmkVzPROLZwbKpM7Bw83GsT/L8fI2P0IO0PLQIw8U4I4qjK\nGdrbArMgTXO3ruPXv2hJlIUNkTnIndf2srNK9HIXQkQtaiJj6X9OGNRK5kFl\nY+7igJFGgpuX4Nl16yC76wXcaYHWDqkoy0fn5p/JkrH/gIEOzNXgKdJ4e9fm\nfKM9BW8Ig45U+5tliLUULRuU3kEzZdSmV+5PyrZdRFPdvIMJuTH1wikA9YeM\nobzP+uOqYGGHyxuV5DVj1EA+K+eHx6IwZtoTBMy1nFOvRbCXsBwaiZEH4uvx\nvBYBvBB/79bYSh0QfRZUbaa/g/Y4UkyMV4HjQ9eao9PkkWgIgGR8jGAp3X3Y\ns4uJ\r\n=7jGh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://circleci.com/gh/zeit/dockerignore\">\n    <img\n      src=\"https://circleci.com/gh/zeit/dockerignore.svg?style=svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/zeit/dockerignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/zeit/dockerignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/zeit/dockerignore\">\n    <img\n      src=\"https://codecov.io/gh/zeit/dockerignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n</tr></tbody></table>\n\n# dockerignore\n\n`dockerignore` is a manager, filter and parser which is implemented in pure JavaScript according to the .dockerignore [spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) and is used in production on [now-cli](https://github.com/zeit/now-cli/)\n\nThe `.dockerignore` spec has a few subtle differences from `.gitignore`. If you'd like a great `.gitignore` file parser, check out [ignore](https://github.com/kaelzhang/node-ignore). This package is a fork of `ignore` and follows the exact same API.\n\n#### What's different from `ignore`?\n- There are many direct differences between the `.gitignore` and `.dockerignore` specifications\n  - `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches things in the current directory (like glob). This difference is important when whitelisting after a `*` rule\n  - `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, however `.dockerignore` specifically matches on `./abc` but does not match nested files/directories like `./somedir/abc`\n  - With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using `!`) since `git` simply avoids walking through the subtree as an optimization, wheras with `.dockerignore` a subdirectory can be re-added even if a parent directory has been ignored\n  - For a complete list of differences, check out the [.gitignore spec](https://git-scm.com/docs/gitignore) and the [.dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file)\n- Under the hood, we rewrote the entire matching logic to be much simpler\n  - instead of complex Regex rule to replace patterns with regex, we scan through patterns\n  - this is also modeled directly from [docker's implementation](https://github.com/docker/docker-ce/blob/7d44629ea2c739e7803acc77b84ee8dd2a8c4746/components/engine/pkg/fileutils/fileutils.go)\n\n#### What's the same as `ignore`?\n- The entire API (In fact we even reuse the same `index.d.ts` file for TypeScript definitions)\n\n##### Tested on\n\n- Linux + Node: `9.0` (but we use `babel` and it *should* work on older version of Node. Accepting PRs if that isn't the case)\n- Windows + Node testing *coming soon*\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\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## Features\n\n- Exactly according to the [dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) \n- All test cases are verified on Circle CI by doing an actual `docker build` with the test case files and `.dockerignore` rules to ensure our tests match what happens with the real [docker](https://www.docker.com/) CLI\n- 0 external dependencies which keeps this package very small!\n\n## dockerignore vs ignore\n\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` 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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome and we are fully [commited to Open Source](https://zeit.co/blog/oss).\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Authors\n  - Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) – [▲ZEIT](https://zeit.co)\n  \n  Most of the initial work on this project was done by Kael Zhang ([@kaelzhang](https://github.com/kaelzhang)) and the [collaborators](https://github.com/kaelzhang/node-ignore#collaborators) on [node-ignore](https://github.com/kaelzhang/node-ignore)\n","gitHead":"2ed05765fd08977ade902af73b29788709b7f68f","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","test-ci":"npm run build && nyc ava ./test/ignore.js --verbose && npm run cov-report","cov-report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","test-no-cov":"npm run build && ava ./test/ignore.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","codecov":"3.0.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f_1587733760896_0.8019279003588409","host":"s3://npm-registry-packages"}},"0.0.6-changelog-resinci-yml-f9467ae628f9074bf4c2499dbae137bbbf0db6fe":{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-f9467ae628f9074bf4c2499dbae137bbbf0db6fe","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"MIT","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-f9467ae628f9074bf4c2499dbae137bbbf0db6fe","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"52371d4ef37ce0b35445e2336413d274050ab288","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6-changelog-resinci-yml-f9467ae628f9074bf4c2499dbae137bbbf0db6fe.tgz","fileCount":5,"integrity":"sha512-puFLxK+1jzMYasWvHNdvWiKzfiT9HLwkGLHkPzTqBu71f0DRTuKl5aDgxo8G/HBBJdxEX7KKHeIYP7KjAOE35w==","signatures":[{"sig":"MEQCIDjqlSgfyz2TKTQP0cikAlft+/zlR6aWeUf64uz37GdkAiBB3Ow9IXRDR30gekbNI1OycJX14qCyGLYE52PjqIsV6A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20604,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeovEUCRA9TVsSAnZWagAAAw0P/1RaI0+9/yYvyVW/1MhH\ngHRNnUuh2sPI1Z4k3imVTIGQdhse7Ven8DB7DyZ0MZjHT6T3NQ13nDAW0Wd5\ne3CqC6afh+M+dzHEdswK6m5O0YQm1N9UNu3dctnQqvdEz7Eg0Si4zwV5qhUx\nnrVlTt/2H9lOur2zbJ0QGnwp4NKjIObpzkI3f80Uz/GRZaxRlecMP9bK6hKG\nx+KYiInq6sEJufct3NzVGMFfY66T4PoAUgVAyiT9hZ4Ny5/h8fmQstYd6kr6\n4Zj9g0OsLHUcSJEe3dWO30NNVdkY+oxMncjY8RbtpYE7BiFA0Nkn73pz/0ue\nG5MdjEdJ4B8Iw+9LRKg+9JUwka4iHwlbGgNgefjFIrE+MiwzyFy0mVOBLmFy\n0YWd1HlxTQZkjV5dwS0vsaM0VqMQ46al1NfoJy14qnBCVWD26jdGTZ2vh6Eg\nlasBujLwp677ek5wwBkTwZWVnC9QjHhXGmtwb4+OMF2ZDd6qRrWifiX93mFY\nIyrrNSQ0mCW/YNXVanO59tFuix+aFOo3AJjmbuhZoGqSXgDUZykC+GpTIDNz\n9jXt67w7ZRum8xk2M0Z92kHDvpd+OTJmmEu2UH8zvm0shtp8t5P0ILBsc1tw\nyxB0wzG8k5v2EI2nI0FLMoe61lq2HVjV8/xBOPZGCwDK4PWaZWrO47BN3LRi\nTacw\r\n=Ntgt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://circleci.com/gh/zeit/dockerignore\">\n    <img\n      src=\"https://circleci.com/gh/zeit/dockerignore.svg?style=svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/zeit/dockerignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/zeit/dockerignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/zeit/dockerignore\">\n    <img\n      src=\"https://codecov.io/gh/zeit/dockerignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n</tr></tbody></table>\n\n# dockerignore\n\n`dockerignore` is a manager, filter and parser which is implemented in pure JavaScript according to the .dockerignore [spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) and is used in production on [now-cli](https://github.com/zeit/now-cli/)\n\nThe `.dockerignore` spec has a few subtle differences from `.gitignore`. If you'd like a great `.gitignore` file parser, check out [ignore](https://github.com/kaelzhang/node-ignore). This package is a fork of `ignore` and follows the exact same API.\n\n#### What's different from `ignore`?\n- There are many direct differences between the `.gitignore` and `.dockerignore` specifications\n  - `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches things in the current directory (like glob). This difference is important when whitelisting after a `*` rule\n  - `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, however `.dockerignore` specifically matches on `./abc` but does not match nested files/directories like `./somedir/abc`\n  - With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using `!`) since `git` simply avoids walking through the subtree as an optimization, wheras with `.dockerignore` a subdirectory can be re-added even if a parent directory has been ignored\n  - For a complete list of differences, check out the [.gitignore spec](https://git-scm.com/docs/gitignore) and the [.dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file)\n- Under the hood, we rewrote the entire matching logic to be much simpler\n  - instead of complex Regex rule to replace patterns with regex, we scan through patterns\n  - this is also modeled directly from [docker's implementation](https://github.com/docker/docker-ce/blob/7d44629ea2c739e7803acc77b84ee8dd2a8c4746/components/engine/pkg/fileutils/fileutils.go)\n\n#### What's the same as `ignore`?\n- The entire API (In fact we even reuse the same `index.d.ts` file for TypeScript definitions)\n\n##### Tested on\n\n- Linux + Node: `9.0` (but we use `babel` and it *should* work on older version of Node. Accepting PRs if that isn't the case)\n- Windows + Node testing *coming soon*\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\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## Features\n\n- Exactly according to the [dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) \n- All test cases are verified on Circle CI by doing an actual `docker build` with the test case files and `.dockerignore` rules to ensure our tests match what happens with the real [docker](https://www.docker.com/) CLI\n- 0 external dependencies which keeps this package very small!\n\n## dockerignore vs ignore\n\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` 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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome and we are fully [commited to Open Source](https://zeit.co/blog/oss).\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Authors\n  - Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) – [▲ZEIT](https://zeit.co)\n  \n  Most of the initial work on this project was done by Kael Zhang ([@kaelzhang](https://github.com/kaelzhang)) and the [collaborators](https://github.com/kaelzhang/node-ignore#collaborators) on [node-ignore](https://github.com/kaelzhang/node-ignore)\n","gitHead":"f9467ae628f9074bf4c2499dbae137bbbf0db6fe","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","test-ci":"npm run build && nyc ava ./test/ignore.js --verbose && npm run cov-report","cov-report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","test-no-cov":"npm run build && ava ./test/ignore.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","codecov":"3.0.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-f9467ae628f9074bf4c2499dbae137bbbf0db6fe_1587736852517_0.6256467815573978","host":"s3://npm-registry-packages"}},"1.0.0-windows-support-c51302fd7e686844b097b3d08c6c1c20cf8fa528":{"name":"@balena/dockerignore","version":"1.0.0-windows-support-c51302fd7e686844b097b3d08c6c1c20cf8fa528","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"MIT","_id":"@balena/dockerignore@1.0.0-windows-support-c51302fd7e686844b097b3d08c6c1c20cf8fa528","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"cb172fbc6a9ea26b0004d1719230c4874439bd64","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.0-windows-support-c51302fd7e686844b097b3d08c6c1c20cf8fa528.tgz","fileCount":5,"integrity":"sha512-NKbO1Pfz1vSvLikfuO7uG/qNUNARwNbyooqOFkazQE+YtPk5ybrXPUhm73BJ1ecLeqDwdjsWb9IWs4MiYWe2xQ==","signatures":[{"sig":"MEYCIQDop2Lw5ddkoMVQQZ2T+cjStqq9zuYZ1xjF2OyMpOrUjgIhANLJb5o5SS1qbQZ6lvnqoIsLt9bQUszSaySLdudTcAQI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24989,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeoyMYCRA9TVsSAnZWagAAMYUP/2rtICZ8JDQOLRXCrRL6\n1m4cX1W48dKL49Da01vMISdqu5Iai9piX/rLmHYKXKXwGIrPnCibiqP/2tVO\nLql6D1745Ybse1G3JoJg6ZsRV5zbnd7Qt1UFhKhl9qs5TwzMO5AD0hW65vVR\nVQAn6vP6WMASBbwU5jWWWC8RanDAmlmul0nuL/dVD+YBo1GTgzNPKxkmWWC9\nGVJUk+hnEG5FARYrihBxzDc7W+KbU20YoRQDQIplZVpCaa9uEGA8tMrengq3\nckr+PnUHPnTC+Q5gnhlkl1yfbhDvFaWyfiOFwrLHqdjtf3NUWPtwfOJ9p/0Z\nQfv4qv8ciGMG6W4qeTpxbfmPFtjyONqlZhGctqecNzs+P7LgTetgZ3cv5n2m\nQMTwFMsC4FSLiR//5TTo555QmNe9w0TqceMHxJ4xocX+/ib9k6Ee/yThFRhe\nM4QB3PtTzR8+YpznrcXINdF5mPhFIeZzQv480/9LRU+7QNTtfzoDRM+k+aYo\n5tbxC+33hmvR35uMuznnAqsLqxPLEUIVlTEqRTlVPnr8t971HH2L/PvHcHfc\nZ0GVbI42JZp+45pEQU05ncPHBTH2BtQFK9uDj5gaKAiDwKWL5eYc4tNyouHH\n/gz2K7gUOKqB8PheplMn8hLvwG7ekBcMysWw3cuWbP6OD/6a9rkoicm+YgLY\niRbX\r\n=AWR3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several subtle differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/), currently targeting\n[ES2015](https://en.wikipedia.org/wiki/ECMAScript).\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@zeit/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the project in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"c51302fd7e686844b097b3d08c6c1c20cf8fa528","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","test-ci":"npm run build && nyc ava ./test/ignore.js --verbose && npm run cov-report","cov-report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","test-no-cov":"npm run build && ava ./test/ignore.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","codecov":"3.0.2","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.0-windows-support-c51302fd7e686844b097b3d08c6c1c20cf8fa528_1587749655735_0.052275841488087726","host":"s3://npm-registry-packages"}},"0.0.6-changelog-resinci-yml-cf5ec80fb26d91c6b0d2548b4a60010db040bf57":{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-cf5ec80fb26d91c6b0d2548b4a60010db040bf57","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-cf5ec80fb26d91c6b0d2548b4a60010db040bf57","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"98824c8a1a3dae1229a08af3bb1200a37c178dad","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6-changelog-resinci-yml-cf5ec80fb26d91c6b0d2548b4a60010db040bf57.tgz","fileCount":5,"integrity":"sha512-wq/2SNPrr3dZEc699Ne1XTxMLLYiCxwxFsp6KmHOmPIYdfAzIQAQgE0Vsn0T7eSvE1wWy0Osq1LB0kvKsQUViQ==","signatures":[{"sig":"MEUCIBjYYXhRHZOq0NeMF8CiLbYrSRz/9oZQHjeOCPozHngfAiEAlrDfgi68nERIP99iEC3qe8vHtVX/jrNV5gM/2gizeV8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20364,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeo0jHCRA9TVsSAnZWagAATQkP/iRieAvoNhA/3G8gx5AU\nOmL6nyip4RLD3tIPoH9ZP8mwVxzgNTZTlhyIMwa2CPlnfaYo6p0e6qk4nGLY\nfXyvAR0SyJfRftdxEhYVdpmX2Ss4ZosZc9t1tnEu2LEo7rVI6g3sHa9r7nR5\nAmyYqy1kAJhUrbDDk0HJ8vTVi7yWP2eq5xI9j+LKCt3GTvQdclLDVTdtw75P\nG3Ig1OZmzlQ16aAti6RxWhGpWu9SC0lfpg4k+L3DVssQ6Sz0tAkPb2e+tQ2y\nvcRUc1GtjBdvRTjvKxR4WcTIVfRgGVPdrBz1ZhhqOCvEb1n7qat6RF5lqFYo\nIYnqmMIo+dMp50pFvoOnGrj3KNTFj8WSxr0KdC2cGJNIsziINAbp8kNK7Cr/\n9Y4yBjsJxPZKuj3DUhRmXwlOIG9/vgdMb7UyJSoyFuLgJPwbUqpognYG4ZOD\ny6YgISN/QGseOtmGh8wa3lWqkYu8jRSH/M5l2kCyrnK3XmnPgzkAizJM55uu\ncJwz0Z0U0ATVIAgmMG17cU4lAjXGZaVtRmm54e/fmbPfX5C560+mf6IWMajN\nWeWWTmABx2i+1j9VIHjTuK8WiJqxJbPG/W4Hq1pzjeyUH1n6lfZGNGTuLApQ\nCSs5zmaolwIGpcxhATSie6fd/jQKn9DhwUtxEJOSEcHMCYE1iWRzjQGKfqNx\nF+Fd\r\n=HqPJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://circleci.com/gh/zeit/dockerignore\">\n    <img\n      src=\"https://circleci.com/gh/zeit/dockerignore.svg?style=svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/zeit/dockerignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/zeit/dockerignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/zeit/dockerignore\">\n    <img\n      src=\"https://codecov.io/gh/zeit/dockerignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n</tr></tbody></table>\n\n# dockerignore\n\n`dockerignore` is a manager, filter and parser which is implemented in pure JavaScript according to the .dockerignore [spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) and is used in production on [now-cli](https://github.com/zeit/now-cli/)\n\nThe `.dockerignore` spec has a few subtle differences from `.gitignore`. If you'd like a great `.gitignore` file parser, check out [ignore](https://github.com/kaelzhang/node-ignore). This package is a fork of `ignore` and follows the exact same API.\n\n#### What's different from `ignore`?\n- There are many direct differences between the `.gitignore` and `.dockerignore` specifications\n  - `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches things in the current directory (like glob). This difference is important when whitelisting after a `*` rule\n  - `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, however `.dockerignore` specifically matches on `./abc` but does not match nested files/directories like `./somedir/abc`\n  - With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using `!`) since `git` simply avoids walking through the subtree as an optimization, wheras with `.dockerignore` a subdirectory can be re-added even if a parent directory has been ignored\n  - For a complete list of differences, check out the [.gitignore spec](https://git-scm.com/docs/gitignore) and the [.dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file)\n- Under the hood, we rewrote the entire matching logic to be much simpler\n  - instead of complex Regex rule to replace patterns with regex, we scan through patterns\n  - this is also modeled directly from [docker's implementation](https://github.com/docker/docker-ce/blob/7d44629ea2c739e7803acc77b84ee8dd2a8c4746/components/engine/pkg/fileutils/fileutils.go)\n\n#### What's the same as `ignore`?\n- The entire API (In fact we even reuse the same `index.d.ts` file for TypeScript definitions)\n\n##### Tested on\n\n- Linux + Node: `9.0` (but we use `babel` and it *should* work on older version of Node. Accepting PRs if that isn't the case)\n- Windows + Node testing *coming soon*\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\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## Features\n\n- Exactly according to the [dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) \n- All test cases are verified on Circle CI by doing an actual `docker build` with the test case files and `.dockerignore` rules to ensure our tests match what happens with the real [docker](https://www.docker.com/) CLI\n- 0 external dependencies which keeps this package very small!\n\n## dockerignore vs ignore\n\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` 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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome and we are fully [commited to Open Source](https://zeit.co/blog/oss).\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Authors\n  - Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) – [▲ZEIT](https://zeit.co)\n  \n  Most of the initial work on this project was done by Kael Zhang ([@kaelzhang](https://github.com/kaelzhang)) and the [collaborators](https://github.com/kaelzhang/node-ignore#collaborators) on [node-ignore](https://github.com/kaelzhang/node-ignore)\n","gitHead":"cf5ec80fb26d91c6b0d2548b4a60010db040bf57","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-cf5ec80fb26d91c6b0d2548b4a60010db040bf57_1587759303029_0.5750565587747043","host":"s3://npm-registry-packages"}},"1.0.0-windows-support-981a661fef397cb991d3b1824433c24374708ec9":{"name":"@balena/dockerignore","version":"1.0.0-windows-support-981a661fef397cb991d3b1824433c24374708ec9","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.0-windows-support-981a661fef397cb991d3b1824433c24374708ec9","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"63e468b38b8e6eba6d0f6929054f7942fcd2dfef","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.0-windows-support-981a661fef397cb991d3b1824433c24374708ec9.tgz","fileCount":5,"integrity":"sha512-PXar7c7VAYjokzBx715Sv+q1QmIPGFpWn2CItFeqyCrRhAG3AXb4yUTsRw6Rp2wq859z1m+rL8GpMKNmsp7ViA==","signatures":[{"sig":"MEQCIAiAV6rD+2rhmLNt32rpOwbeFyFfnWAGKZyJC+NIBvJiAiANdWACcFRJ4ieA6yVSBJFp9TXDScYu3k8G82xZMCcxLg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24617,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeo1YDCRA9TVsSAnZWagAAUAIP/2lR/FU05o7Aun7tzXCj\n43nNEpbK3jG4vnwQ/x78mL3b8dIGyIRQF2XVkTvknloO6QEGiR2cezQrYDA3\nXAOYg+7wqREZHsVCFU9U4KfzQj7fTpoB7rMoZwW6yLI1fIJaoE9WtQEPXwM3\np0LjW3UDAoNWstgF0d4h5WMfnubN2DzrpZQP03gyLJFTiY1ly8jETlH7L/LG\nIqxJTn8155LgWeMEwws/rPpXfBiXH9EDivJKwCm51RWfklp4CW/vW1VVTQIh\nNu958MxL0pkVaUbB93CwUfBpl8vzvBaikU8iKSFAuq0nb8z3FnBkVf6lCxHy\ngK63e5S6pjHlKIxCHHhCFhL/tMcudJUpvn/dEmn5i2j0BRMSF/wjZNaKiUX5\nG2j3ceSzVEuXahs1TnMb3XOr2JH7W18LrGBm8Zg6/uRPHP6l2u4PFT6aB/B1\nAi7pY8t0elZFmlK8LICbprv2MiHSUXBucEYihpc7Esesr5TIFx15hvBoo4DJ\ns5IxrrtBGl+/b7VIO6wD1UKE9lp8B4hYwQmIUKYcwVaB+otzyMmIjTPxXQNK\nEVLQ9AjH2tIa8FnNrSbH6HumtHartWzeUxk4QLddTtGA5RHZrrFsjC3Trpct\nb68gyagk4xXA8fB1mp3kV+YdO9kXZ4i4zOPMvbIAU4p8vgRGHyj+v9/aRMBK\ns0Pl\r\n=yOwV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/), currently targeting\n[ES2015](https://en.wikipedia.org/wiki/ECMAScript).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore  # or yarn add @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"981a661fef397cb991d3b1824433c24374708ec9","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.0-windows-support-981a661fef397cb991d3b1824433c24374708ec9_1587762691044_0.7105660543434296","host":"s3://npm-registry-packages"}},"1.0.0-windows-support-b462715c2e14512de25e06ab3a7d46517c6eb70c":{"name":"@balena/dockerignore","version":"1.0.0-windows-support-b462715c2e14512de25e06ab3a7d46517c6eb70c","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.0-windows-support-b462715c2e14512de25e06ab3a7d46517c6eb70c","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"b499f8cbf60d3db0bcdef2889b7800b0a20c568a","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.0-windows-support-b462715c2e14512de25e06ab3a7d46517c6eb70c.tgz","fileCount":5,"integrity":"sha512-c79+GMaknl8VYSbP6J6TAh4PutOTEUUm2hej+Et9RYibYIxLy+7kiU/cblUeG6GnjbNdLVunxj0mx9CgJqNNGw==","signatures":[{"sig":"MEUCIAHt6ObgHsP5FsGlRWvmFYILCnMnNy82Q+vbNYEfX6eXAiEAwP3KrR1PjFo4YULAx0RwjSPY/uZz4tc350i4wGsolSM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24617,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeo3C5CRA9TVsSAnZWagAAJF8P/iRK2CbDqmYuDGWKOUeq\n6e/uHLVerO4zMMCpbiusGbVMIwbl4mV8wQWPf91GcWBFV4JEHrXCYxpnvl/F\nTGHus3PflDYpzdUQiK1y/NasqPXHNVmEdD6fAJD+VY6EXShIfNxluigJSPzA\nHP8wXHqOW4ugB1KaulLgFQcYkSdCH5AAATzQJZ6fFZbWu3Mq1849VzPBGlMn\nZJiaO1Ir1+iKnQL7wok4WtJXAIEnlh5SwExs6utZTTYQRUqVdIRiYmCfjm4n\n2/qB3zD+9lJD+B7+ONVXmNWIVb8sFS9Gmly4PBXRMDE/pDEtDJ7l7LwPk2tf\nbNZDK+MzpzJtdot5oqJAgsI89gY1OShXNtfjFe5WXZcg1cjIcxvDN3b1fiqu\nGUWLD+Qtq757MtzVqUqsKfx7FF5idPCXf0Qs6gV9Wnq3wKt8tRw3Whl6jGKF\nn/xacdLNnqvWEVZB57pE78ZWi5M4elOfnTTG+2VTjqzthjCgM7AkM/E/fcUB\nOhufXGiV9ti/mKoATSe1/JuGVcYUkMbA251yaKv6ZRgcwwBaPLseCXrbMR79\nWwLU/btssXUt/RCbvknBq4Fr7hdxuAlJO4ZOXRBUY2j1BqbnzQM8pCLUOXjH\nmxJt+9H7C20wU87BcmhkuJWsRmsCHSoiNfFgj8rRGa4bZwqWaxCF7EoIQmnV\nMkTY\r\n=0pXM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/), currently targeting\n[ES2015](https://en.wikipedia.org/wiki/ECMAScript).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore  # or yarn add @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"b462715c2e14512de25e06ab3a7d46517c6eb70c","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.0-windows-support-b462715c2e14512de25e06ab3a7d46517c6eb70c_1587769529097_0.14207736495100054","host":"s3://npm-registry-packages"}},"0.0.6-changelog-resinci-yml-5b55d9e81900e090b1d8ce900ed4ea53a00bc504":{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-5b55d9e81900e090b1d8ce900ed4ea53a00bc504","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-5b55d9e81900e090b1d8ce900ed4ea53a00bc504","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"0850abe094acc7a1fe166ccf1cebebc955b020f4","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6-changelog-resinci-yml-5b55d9e81900e090b1d8ce900ed4ea53a00bc504.tgz","fileCount":5,"integrity":"sha512-mKo/mMi+PFUUiCKDetG5qKHbSwrMC06N96QXW2pXIIrYgEG4xn7aQ7EErEB/xv2GSjLdqKCf4PqJdmmBB7Goew==","signatures":[{"sig":"MEYCIQD2DYg+WwTgyzCkXB+hca2QULsGxo2iuKz4FHW4S2fvLwIhAPQ4M96ts1ftsZz1+G9wtaCQTnWCbEeuKYkXuiWL4ePy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJepu/XCRA9TVsSAnZWagAAyTYP/25bpxEDO2nOq5R6LRen\nSDZYJyn5Jltj8QMW1d+2YK4o4FY3hChTbhDgEayZGPNxShFxVZ6dtJW4phmH\n5pNJJMRzWXr4iKwMmQfaDgWeG+P5zHPIYg6WRje+ed3LgSk1GNLYqSFXjAkI\neIBzWjzT5Hg5DL3sdVSI7D9XWfMehJAtNAVyURsmjn2k1+AvcYyxKbzpfPe7\nx5ubP5uEzDj585+/0hCgZd3cCa26opdqRxIXWSj/tsl5PkSSyJvB5633Q5rk\nHcN3Pa4cgGVBNgRhKKlJxzeXqOQOeAsKzFoUhHAQ67bdUUogOH7FCb40XZmO\n6zIf5mSZSxHGmzmxpZLv7pgIMD5N1U5uLKS9HvTkaLe96YHg3Z5KojxhXAHH\nHuUTHw0/su9W72zfcop+JkcHSI41oowftXcGEJzh6T8UmdhvEnqGetp7Mqk+\nkNcgMz1J9TWY1TVLDlU9MSsN9v3AShHWYRZZZHkakKKOHl0jW2lhTa6mIWTj\nUIETZ2zTEHn5KWz56ck3Nwt2CRJbGQI7Qa4XxjJUHF+294o3zMkkPWb9UuTw\nuH1KZ8fX88qVbQClM6CQwWrACAfUc+spvaVOTHARbHVj70yHfEgR3Bxen4Gm\nNJs4eYju9yVZW3Ggs+u63ubuejMDjtJJlV8iIXPACqtkTGCaWF30cLULsdBl\nd+es\r\n=8OHD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://circleci.com/gh/zeit/dockerignore\">\n    <img\n      src=\"https://circleci.com/gh/zeit/dockerignore.svg?style=svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/zeit/dockerignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/zeit/dockerignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/zeit/dockerignore\">\n    <img\n      src=\"https://codecov.io/gh/zeit/dockerignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n</tr></tbody></table>\n\n# dockerignore\n\n`dockerignore` is a manager, filter and parser which is implemented in pure JavaScript according to the .dockerignore [spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) and is used in production on [now-cli](https://github.com/zeit/now-cli/)\n\nThe `.dockerignore` spec has a few subtle differences from `.gitignore`. If you'd like a great `.gitignore` file parser, check out [ignore](https://github.com/kaelzhang/node-ignore). This package is a fork of `ignore` and follows the exact same API.\n\n#### What's different from `ignore`?\n- There are many direct differences between the `.gitignore` and `.dockerignore` specifications\n  - `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches things in the current directory (like glob). This difference is important when whitelisting after a `*` rule\n  - `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, however `.dockerignore` specifically matches on `./abc` but does not match nested files/directories like `./somedir/abc`\n  - With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using `!`) since `git` simply avoids walking through the subtree as an optimization, wheras with `.dockerignore` a subdirectory can be re-added even if a parent directory has been ignored\n  - For a complete list of differences, check out the [.gitignore spec](https://git-scm.com/docs/gitignore) and the [.dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file)\n- Under the hood, we rewrote the entire matching logic to be much simpler\n  - instead of complex Regex rule to replace patterns with regex, we scan through patterns\n  - this is also modeled directly from [docker's implementation](https://github.com/docker/docker-ce/blob/7d44629ea2c739e7803acc77b84ee8dd2a8c4746/components/engine/pkg/fileutils/fileutils.go)\n\n#### What's the same as `ignore`?\n- The entire API (In fact we even reuse the same `index.d.ts` file for TypeScript definitions)\n\n##### Tested on\n\n- Linux + Node: `9.0` (but we use `babel` and it *should* work on older version of Node. Accepting PRs if that isn't the case)\n- Windows + Node testing *coming soon*\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\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## Features\n\n- Exactly according to the [dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) \n- All test cases are verified on Circle CI by doing an actual `docker build` with the test case files and `.dockerignore` rules to ensure our tests match what happens with the real [docker](https://www.docker.com/) CLI\n- 0 external dependencies which keeps this package very small!\n\n## dockerignore vs ignore\n\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` 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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome and we are fully [commited to Open Source](https://zeit.co/blog/oss).\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Authors\n  - Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) – [▲ZEIT](https://zeit.co)\n  \n  Most of the initial work on this project was done by Kael Zhang ([@kaelzhang](https://github.com/kaelzhang)) and the [collaborators](https://github.com/kaelzhang/node-ignore#collaborators) on [node-ignore](https://github.com/kaelzhang/node-ignore)\n","gitHead":"5b55d9e81900e090b1d8ce900ed4ea53a00bc504","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-5b55d9e81900e090b1d8ce900ed4ea53a00bc504_1587998678616_0.10370775134559262","host":"s3://npm-registry-packages"}},"0.0.6-changelog-resinci-yml-05200b7d7625f7ddd62f368d0e725d3ec3f2eaaa":{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-05200b7d7625f7ddd62f368d0e725d3ec3f2eaaa","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-05200b7d7625f7ddd62f368d0e725d3ec3f2eaaa","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"7251e90d4ec7dfd1208b885790cfc3b1a1c7048b","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6-changelog-resinci-yml-05200b7d7625f7ddd62f368d0e725d3ec3f2eaaa.tgz","fileCount":5,"integrity":"sha512-Pitw5yc5VyaXqgXAwOFyj8UjHHb1VcgheX38x7OwaipvQYIy2zZ67+TaXbC2b9/T5cl2yniaxD9nTiGOqakNHQ==","signatures":[{"sig":"MEQCIFx02pXkI5UFjmzoKw4Z0gN7/N8WpZ7xaiRRgRkBPQsfAiAo+TftfhBOqaap49qtObFkmk+rKukNdZoOEBo2+YQtXg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJepvm1CRA9TVsSAnZWagAAoaYQAJZJhUELjg9QY3orG0/R\nCf0NrgjB84/vfIoOyDLliQgb2zW9RdBtsGBswHNC8qAEGWnypfgOGXKGcZ6A\n6opz1IXscXEUxobacJP383jHZCFFu8A60CwgxoOd2shgWwxZ96ag078ihuK8\nH4y1j2u+qFfPl5sY4/zMyhG48veQdXyqEKvMe8s3P7mwYh/G3D4/ptKt5aA8\n1eptfXb/neEfy+T1Qs/icohcsIn6xOJvbQC63OwxwAmIDAQ2RJKWCtB+ScD1\nBPHZeWsqYL3p5ff/ZNAn9gohsJoa4dBPtrLygFGzaXQ9fDAliHnL8Hsw80KB\nQP0fySM5O34iM8MCP8uZUIHQt5f88ea16qgHcPN8CBHGSPpYV5u7s6s53n6A\nprucBg0IFs2mlE78RDlo+4nmeX8nIwvRUN5Cqzu0ib/5VWnSAMUCZ0n3DpaP\nQaoYAlFtV7kyDZ8TXN0h4Epw8dn5IilSKxJVB299NKySOzUamZjkRdbTSyHY\nxcm5XkMHViG3IWKFmtVtTed90fZ3lJahE/uoD8ftHbSR/sgkEVGrphLK3sCv\ntNfafCtDTIUe7PDaitfKAw/QBiQiPS0R9sOHXTsB7tuYTce7IuxYk0gDoVcX\nbJ7aLGFdNEE2bSYA384aQeTVIJbgSXdeQeouHFPmdR/TjIaZYLLC5+UUgs9T\nZP07\r\n=T2pc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://circleci.com/gh/zeit/dockerignore\">\n    <img\n      src=\"https://circleci.com/gh/zeit/dockerignore.svg?style=svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/zeit/dockerignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/zeit/dockerignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/zeit/dockerignore\">\n    <img\n      src=\"https://codecov.io/gh/zeit/dockerignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n</tr></tbody></table>\n\n# dockerignore\n\n`dockerignore` is a manager, filter and parser which is implemented in pure JavaScript according to the .dockerignore [spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) and is used in production on [now-cli](https://github.com/zeit/now-cli/)\n\nThe `.dockerignore` spec has a few subtle differences from `.gitignore`. If you'd like a great `.gitignore` file parser, check out [ignore](https://github.com/kaelzhang/node-ignore). This package is a fork of `ignore` and follows the exact same API.\n\n#### What's different from `ignore`?\n- There are many direct differences between the `.gitignore` and `.dockerignore` specifications\n  - `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches things in the current directory (like glob). This difference is important when whitelisting after a `*` rule\n  - `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, however `.dockerignore` specifically matches on `./abc` but does not match nested files/directories like `./somedir/abc`\n  - With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using `!`) since `git` simply avoids walking through the subtree as an optimization, wheras with `.dockerignore` a subdirectory can be re-added even if a parent directory has been ignored\n  - For a complete list of differences, check out the [.gitignore spec](https://git-scm.com/docs/gitignore) and the [.dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file)\n- Under the hood, we rewrote the entire matching logic to be much simpler\n  - instead of complex Regex rule to replace patterns with regex, we scan through patterns\n  - this is also modeled directly from [docker's implementation](https://github.com/docker/docker-ce/blob/7d44629ea2c739e7803acc77b84ee8dd2a8c4746/components/engine/pkg/fileutils/fileutils.go)\n\n#### What's the same as `ignore`?\n- The entire API (In fact we even reuse the same `index.d.ts` file for TypeScript definitions)\n\n##### Tested on\n\n- Linux + Node: `9.0` (but we use `babel` and it *should* work on older version of Node. Accepting PRs if that isn't the case)\n- Windows + Node testing *coming soon*\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\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## Features\n\n- Exactly according to the [dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) \n- All test cases are verified on Circle CI by doing an actual `docker build` with the test case files and `.dockerignore` rules to ensure our tests match what happens with the real [docker](https://www.docker.com/) CLI\n- 0 external dependencies which keeps this package very small!\n\n## dockerignore vs ignore\n\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` 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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome and we are fully [commited to Open Source](https://zeit.co/blog/oss).\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Authors\n  - Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) – [▲ZEIT](https://zeit.co)\n  \n  Most of the initial work on this project was done by Kael Zhang ([@kaelzhang](https://github.com/kaelzhang)) and the [collaborators](https://github.com/kaelzhang/node-ignore#collaborators) on [node-ignore](https://github.com/kaelzhang/node-ignore)\n","gitHead":"05200b7d7625f7ddd62f368d0e725d3ec3f2eaaa","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-05200b7d7625f7ddd62f368d0e725d3ec3f2eaaa_1588001205402_0.4906909621955764","host":"s3://npm-registry-packages"}},"0.0.6-changelog-resinci-yml-382aba353db7996260fddafedf1b8b49ffdb6306":{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-382aba353db7996260fddafedf1b8b49ffdb6306","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-382aba353db7996260fddafedf1b8b49ffdb6306","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"7c58e0fae017b3513698c0672eaf1a755fe1b007","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6-changelog-resinci-yml-382aba353db7996260fddafedf1b8b49ffdb6306.tgz","fileCount":5,"integrity":"sha512-LkBFKwWzhC07b3llEOc+U2F6EMxO5fr4Yg6Yb4/OAuzfaPNU6JiCJ4f0ANeEaE7L9djkbv3SJT+AAW8AfsMWrQ==","signatures":[{"sig":"MEUCIQCELEBxH6MLuFKA3E+LX+jVZI9iJbO0EUB+cPRJXZelGwIgLB3eVvmoDkCPwZ/YPZh+ws/++RaQC1s0iqNW4vojIdA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20639,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeqX+6CRA9TVsSAnZWagAAmqcP/jRTPe3gm3Oz8AV30Bet\nxRFgPgzO5b9yXQknMHGocnEbd8GxcVJ+F/NZfJJRhJviV4f7p0lL9l3mcVnf\ny65WJFgmbHfJ8CMAy0S5zmNujTpFs6B0UFlwJLCxR8Q8eTEsWofvlwxRJd9H\nJjuxL9V3s6ueSPTXCg8Jj4iUahd1+lcLlyf9AKsUwUKugBmiyU9IDTJIFO0T\nhO4r/9GYE4PR9aL6iht6Qe1VpL0rrnfnXNWpp/Jl5Y6YqgXHQqr2ep32uHjZ\n/oGAllKZmX1Cx6Wychw5QAUvjUoXUzsL3PT67S+RVqRKOLO8sA6tcVCir/wD\ntkHc3GCw+IzmvLcd6SOYdosrKpQMlF81+/e2B+uliSakch+DHGgumbOKS69e\nIuvz4xTntnCWYvlnQoJqzeb7X+zchxVcLFOSvHhLk08T5gncar5z+s3Znyr4\nDQcHUiIvb3252y+ky3BWVs4MwD/Jpn+cdNMeWbSS+v3XdO6TQpx3RUn604pw\nCiUp6xOhJiXXLbX1yKLYa6+3tv7ZW51ed4g+0IafKbRzCqskH7ksgNhl0M+y\ndqcjom6Flfz4VUMZper/9vfRRTPooMNADgXQPvnZxUCpq0OKPXMxYJhIwuWW\nKgRQpJes+AuiJM/fRkmakVJtuxIo89qvlExqsuE/u2ywpdsJJBew9/mafkue\nX2L2\r\n=nxLx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://circleci.com/gh/zeit/dockerignore\">\n    <img\n      src=\"https://circleci.com/gh/zeit/dockerignore.svg?style=svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/zeit/dockerignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/zeit/dockerignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/zeit/dockerignore\">\n    <img\n      src=\"https://codecov.io/gh/zeit/dockerignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n</tr></tbody></table>\n\n# dockerignore\n\n`dockerignore` is a manager, filter and parser which is implemented in pure JavaScript according to the .dockerignore [spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) and is used in production on [now-cli](https://github.com/zeit/now-cli/)\n\nThe `.dockerignore` spec has a few subtle differences from `.gitignore`. If you'd like a great `.gitignore` file parser, check out [ignore](https://github.com/kaelzhang/node-ignore). This package is a fork of `ignore` and follows the exact same API.\n\n#### What's different from `ignore`?\n- There are many direct differences between the `.gitignore` and `.dockerignore` specifications\n  - `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches things in the current directory (like glob). This difference is important when whitelisting after a `*` rule\n  - `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, however `.dockerignore` specifically matches on `./abc` but does not match nested files/directories like `./somedir/abc`\n  - With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using `!`) since `git` simply avoids walking through the subtree as an optimization, wheras with `.dockerignore` a subdirectory can be re-added even if a parent directory has been ignored\n  - For a complete list of differences, check out the [.gitignore spec](https://git-scm.com/docs/gitignore) and the [.dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file)\n- Under the hood, we rewrote the entire matching logic to be much simpler\n  - instead of complex Regex rule to replace patterns with regex, we scan through patterns\n  - this is also modeled directly from [docker's implementation](https://github.com/docker/docker-ce/blob/7d44629ea2c739e7803acc77b84ee8dd2a8c4746/components/engine/pkg/fileutils/fileutils.go)\n\n#### What's the same as `ignore`?\n- The entire API (In fact we even reuse the same `index.d.ts` file for TypeScript definitions)\n\n##### Tested on\n\n- Linux + Node: `9.0` (but we use `babel` and it *should* work on older version of Node. Accepting PRs if that isn't the case)\n- Windows + Node testing *coming soon*\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\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## Features\n\n- Exactly according to the [dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) \n- All test cases are verified on Circle CI by doing an actual `docker build` with the test case files and `.dockerignore` rules to ensure our tests match what happens with the real [docker](https://www.docker.com/) CLI\n- 0 external dependencies which keeps this package very small!\n\n## dockerignore vs ignore\n\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` 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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome and we are fully [commited to Open Source](https://zeit.co/blog/oss).\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Authors\n  - Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) – [▲ZEIT](https://zeit.co)\n  \n  Most of the initial work on this project was done by Kael Zhang ([@kaelzhang](https://github.com/kaelzhang)) and the [collaborators](https://github.com/kaelzhang/node-ignore#collaborators) on [node-ignore](https://github.com/kaelzhang/node-ignore)\n","gitHead":"382aba353db7996260fddafedf1b8b49ffdb6306","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-382aba353db7996260fddafedf1b8b49ffdb6306_1588166585952_0.9766989600868243","host":"s3://npm-registry-packages"}},"0.0.6":{"name":"@balena/dockerignore","version":"0.0.6","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@0.0.6","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"c104cae49e60be94fc7979b4b5258e305529e907","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-0.0.6.tgz","fileCount":5,"integrity":"sha512-/xgXxFQIWYF4uo9knlkFVsGNDMleLicZtA09VsfKox+oNQLNFQCFV3ddHQHS1rU416o/0LFi9iMsKqmcXDHoVQ==","signatures":[{"sig":"MEQCIFMpVUFleqJXALk1Pm9dQPtl5t9c8mbh3Ayto0Z5owQBAiBdHnlFY1mgBabsc9eKVRNIsbOemilClTJOhgV7nNXRcA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20576,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeqZYsCRA9TVsSAnZWagAAkFAP/igbzu3vEfFyPwAuROb8\n0bzVqqVPOa5MY/OyqhtvcJ7RZT8paDJMXng36RUs1vLxWUVa5sbCWYDK3aNV\nN3ZiUrvKwIy5fLRYh7yjd+YIbahGfAJaJ/js9p7R2sXOKWm0lpchlo2Rgaaz\nDyAe5PkWXejZtSxVcwbjaVCyEBiLVH9EwuAVTUImRBy4qlUob+/4Kn6slokH\nG6gjxnfaHLconD+2gn5ioziolIhHmW6R/GBNQr1m+v9TqcNpCzHaoz2h5sM8\n8KHTqSNQGzkIwbHP+chBWaVsTXvbIcuRgm1mAgXSjGKssxPIASPpXpbr5hY6\norIBxVeJfX+kaKn5qKJ5DdNT2S+2mPmdRydANrc6GU3drnlYNJvE/Vzkumcl\nI/2paYMgKFSzFhsulXTv11JoVyQlHqyc8WAg0gEekPcE0DMgDoYot3nXam7L\n28HyEX1gHQhIZy1Bp9FP3mOUNJnpAOYOxdnD9BlfnzdsL7n1hmTLArKhpykS\no/vYIi+XZukpNmy63UfkGUMSJK0DyayrU1BdPoq60P4MzouU+0bVSbZEGjXJ\nmeBO70NSAWZ3+DZiDdK2q7NnHZhBQfCw7cI/X4TyfIg8bKgDGl7v2j/K6dqY\nyZjOF1mOyRzv2vPMMHb+Jw9RtR7fIowXl3dtgQlYEBiXl6MczrY1egR9N157\nGXFx\r\n=vSwN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","gitHead":"1fe8aed79adb7d5fd9fd0718d72bb30eb05a3804","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","pre-suf":"^1.0.4","raw-body":"^2.3.3","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_0.0.6_1588172332105_0.9888330910844296","host":"s3://npm-registry-packages"}},"1.0.0-windows-support-c26e0a015062d484f3dfdc41848bba7c5e231397":{"name":"@balena/dockerignore","version":"1.0.0-windows-support-c26e0a015062d484f3dfdc41848bba7c5e231397","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.0-windows-support-c26e0a015062d484f3dfdc41848bba7c5e231397","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"8ee520063dffd3dd8863ea27c32ba142ed3bae4f","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.0-windows-support-c26e0a015062d484f3dfdc41848bba7c5e231397.tgz","fileCount":5,"integrity":"sha512-a34B9D1FlRld6yhnZvsIz8gRzPZEuwZeSKHXZRnB1bLH6mjRyOrFfO6c3me19NFJ/4wX/DZXqOIkKX7EJwQXwg==","signatures":[{"sig":"MEUCIQDb4JWjM3MXIZr5YAh9KEDAt0OaFnj9Ii+LcVDn1BiQZAIgKPztxhBAXz02JGKFQM0jbW2o6oVY9Sp3tQhToJmmNRk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24919,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeqhK8CRA9TVsSAnZWagAAJfAP/3mImmMNeZmQNTN3ATjG\nK0Z9JpeuhPN7EmyEqAd16I20mYhcndaB1m2/iLIcdVtaB7dbVaKB3nP7Jxkt\nKE+L7fNv7eyOdMBohSCMbiniB7jPbLdvDx8xArpR5wtuXlgl6uWnUplczNJI\nSgxfGbcehHdSvLpqntdEkoGIuypUWDJtezNRF1gv/4mu4UUfShoj0EFilANA\n5utRA9nvFtlCfZS08TIccbxTxNLgn0YIkB9quSlnPR+chEZSiUIdizp9O3F0\ngttH6cUiIc7QYwz//cXZg41RAZGlHmfMvebyu410GTu54kgDeYCY0IGRUzzl\n8yTjKMpQzau8BW1AW01C+iuY4a5XUAZEVnfcU+G7ll00Ld7WnptVkMhroimC\nQu31Bie5MTnOHApSMPEm5nT3uqVMWgm40NN4oe0VHTBCyJUxSpqE8QImNnK2\nn/ywL+8YbJQO7+U522zgL3ZlK7bZV00AGclP5grA+2jr+YSODlCan6WeNhO8\n0/AFcY5LbzBZAMSOfzTDTjSMJlLBj6cSiWlaMnGcyIRu0e5p0fjc3ZVCqHEm\nfwZ2uJlNlx8KBcEIJi0HxqSCuV+eGXsgdC/Nfnm8KlfyziRDgUi4YjwSLgI+\nx++ksrirjyBubZON1jQNiokLahNwsUrh/yAT2jR6yRCtl2Xgc/5/tctQWwO+\nv4EJ\r\n=lVQy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/), currently targeting\n[ES2015](https://en.wikipedia.org/wiki/ECMAScript).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore  # or yarn add @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"c26e0a015062d484f3dfdc41848bba7c5e231397","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.0-windows-support-c26e0a015062d484f3dfdc41848bba7c5e231397_1588204219808_0.6356798547732572","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@balena/dockerignore","version":"1.0.0","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.0","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"5aec6b06f7d75fe684e7f16bd0c83cd902158304","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.0.tgz","fileCount":5,"integrity":"sha512-P0nY+vhklV+RGu1wT2xt6ErrNJxcPfK0fjTSiZF+3VVqB1OnEfUfD4xG6tqP6PxdU5tVX2FrxXPL/KxAir0XaQ==","signatures":[{"sig":"MEUCIG7FcJh/yML4E5Pf1JpY726sZOg1fHH7cov3nCXzuxEwAiEAjLVYFJz2LzGlpH0AFwMUuqzcB0TdWyED5SSFSW3nGgg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24862,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeqp5RCRA9TVsSAnZWagAARSYQAIDZh5nVyBjKNC8deDU3\n6/RwE2qTotDH46tP6AzH8sxLSxz8goyx2Zd/P1G6oB7Dc6wx6Cx27/1bMs0T\nzSCXsJ0PD+VmlMhbxh97tOUVTc3pJl3HvxHgxNXB8SEKr3Fn39xuOpr0Y5Cv\nWpRCdHyufNW8suT36EOmcn2HgfZYp1JHZ0VA5zjhvPNnt9v05OsGnRApMNTF\n6Kcmhl9S4TAodj1OxGW55RARYn2cSo7rH8L2pru4wWN8Kr/p1ttfzajrMWOX\nNw0w1e0iPPXOCIGNCuXajYeInXb7FEyCoAMGT4VUth9p00QQJrMdtcL2erQA\nPizdtUkFWdPc2MywFKCRwHoSlJofO6i56J1Vt097AaeFkdy9AyhVU8iURPqm\nsuV5hgUixMKC9An64HIkvBBUMKR7x+gKyLt3fch1wVDBTBgxNZSjtcEL9STa\nxup/FXkDRnXw2b71EnEKTTDWfOaB94AsnDfLZ9EAtmeDNPweJ50eUfMcip2W\nNN4/+ph2+0aRenzgTVYegaLPfMFk9BpiG8bKvLeWiP9xKkA04QOKqeYc5kvO\ntaMeh2dhlr16WNbsUdY/qD7eHKL/5b2+8VDqOdzfXUXCLee/1kEwWxjQCaqp\nM2eHd361JDNC4DJPAvIATaVNrmIu/ArGYmgj4ZL8+31Kbvxauf5KvFuFjb11\n8zaZ\r\n=kMWA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","gitHead":"057241097020d0ec2eac66b46db4d2af5422f785","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.0_1588239952924_0.26581690292069227","host":"s3://npm-registry-packages"}},"1.0.1-fix-npm-publish-479b2ce84a5d3669d22e3785d70c16f4aad96a20":{"name":"@balena/dockerignore","version":"1.0.1-fix-npm-publish-479b2ce84a5d3669d22e3785d70c16f4aad96a20","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.1-fix-npm-publish-479b2ce84a5d3669d22e3785d70c16f4aad96a20","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"7b0aa5787fd73cebf99976228513ca1b483dc4fc","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.1-fix-npm-publish-479b2ce84a5d3669d22e3785d70c16f4aad96a20.tgz","fileCount":5,"integrity":"sha512-wFSv6hLoaFRTnpi9ept4Ig0HdCM6HFTZ9ox46XYRSH2oaSMxW0nmBpb7xoYKM9jQxmO0nQ2Pl81UbqUnnEIOuQ==","signatures":[{"sig":"MEYCIQDREFGzUOKr6ndmmpewMbyG1MzrVlQfvLuQBxC+EeYzMgIhAIQAih5f3VaErpDdb6M6KARq4y+8RgRsUwE8Qn7cT3IA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerLf0CRA9TVsSAnZWagAA3MgP/RbGu/LnYnwL6OWsH3nM\nb6/hAgs/mUEOoJbo4vZz3Y0W8Ajz1+ynf8EbK/1oGaDZ9iJHVnHiOpxecl31\nkhhzEvvXcyR2//lsLLznbpAFuqvx2wnYqwSAETC7xxFLGW6Xm+U4Cef1qoC9\nw9EEMlg9toVX+rZ6Pyfuqq84j9eBehm9jstB8naC4zTNlF7kDH+zXLZASTsy\nQz/VGr6wwY3rA/it26xE4MP5GKgDjgeQ1xpuF9MtPDjQjyr00DOOW5eHKHRW\ne7od1HtzCwcW1CMwhYiebxK+qQ2AhOuKlxoQCFc+v0CBurJtxoPNffThaSkm\nRGpb4FUkPIkSU90af/Me9JJ6B709dfW7ybstfpVMUdpUegO23G82JZPWe70b\n1U4P1Uujs9tVA2AeGLVo+UM1JH01MMzibAy7z/Q3k6+RwoIL7RA2DsF6OGJg\nauhRF++G5syrha+G2AjtK4U9mKiYlDBNHPeg5T6kvIDcEPwW0Z/n0NuMps5v\ng1VjDSxkCwnYX0LBB6IPhYU5IJ01puoDq7APRt6UUicfWCF4Qj5z+11ADkTh\n3fXW+xGBG12hkHbsH55rWE45SyztH5p1nax31nCgoTojHhhtVAxR+ROMFXFT\nX8b54Owy9CoeAOz7yzkqiz1TFYg7JAWcuzpq00ngg/1z28tidOiztsA/bVJ/\nC/Ca\r\n=b+jm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"479b2ce84a5d3669d22e3785d70c16f4aad96a20","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"^0.25.0","nyc":"^15.0.1","tmp":"^0.2.1","chai":"^4.2.0","cuid":"^2.1.8","mkdirp":"^1.0.4","rimraf":"^3.0.2","@babel/cli":"^7.8.4","async-sema":"^3.1.0","@babel/preset-env":"^7.9.6"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.1-fix-npm-publish-479b2ce84a5d3669d22e3785d70c16f4aad96a20_1588377587749_0.2880700147026045","host":"s3://npm-registry-packages"}},"1.0.1-fix-npm-publish-77b1ca2604ba65a7fc7f2b50ca1dbccd954724d5":{"name":"@balena/dockerignore","version":"1.0.1-fix-npm-publish-77b1ca2604ba65a7fc7f2b50ca1dbccd954724d5","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.1-fix-npm-publish-77b1ca2604ba65a7fc7f2b50ca1dbccd954724d5","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"0b906e759b89087b2b749abe6cf7822ec0bd9670","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.1-fix-npm-publish-77b1ca2604ba65a7fc7f2b50ca1dbccd954724d5.tgz","fileCount":5,"integrity":"sha512-17Kx/GoAl0PaY+6xTE4Idl8b1LYLxf34BEhnuJpxqqn+N/XGlJYKO9mpmLcdTlAZaS8CWTmjVUGvQBOaGcGdEA==","signatures":[{"sig":"MEUCIBRjAF+lpyfYRkQHmVr/+3cX/dQ+cK62j2oxTYw+O97CAiEAo8Xo346es7ITfA92Yjp42DqVCcygTtiFLNNp/yIpioQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerLu/CRA9TVsSAnZWagAABd0P/1/W2XnUQioeZ4BUWcY7\nCo/quaTuQk6ZiyzMlkNXw/InM1X6KjyUWJ6qy/3cax2/DWJgX2fAISOId1QL\nid6tWFfIcwguulghf4+4sRe1HRLF5fCxEHF9Ksju+I7QOHdLhz7GA8BKXC+k\n3fQHzt14x5D1COvwYPDBxYuknsyKgjxI+1HQxa6SPNkEZlaX91gPmOfWS6IZ\nXSJPdS/Xq1m+Uw90dEHQoTDLpBvXwYXdr8j7VgNPoMbE5fjY3oeQlk1DKhPW\nBtaPFc0PqQWN4wI1XFlfZI/7Fw+l4ZPxekrYt5/Y3Cz302KkX/wStsyDS7w1\nRejZK0aABeTnHeE+KfcjwST06DlRVjbo+oPo0cCl82L+K9zvWRil/UGFbY2B\nlTQLkQqHQkYvNzLoLHA17foeSOGmY0gU5UXM+WlLGiWGpXKIfaosbjbQrPPE\nXTOjlJICZDKoV0LxmI1kKHu2e8h0TaliL15ykcIyNryKmep8d4un/pTaZ8mt\n7EFJYBdd+XOxWY409GwR7pMGoC37VZJm6SYoY4SvlGQl7qL+Pw7A0DCvVUsu\n9wz2o/0d0VeEDSADafo0HhbvCXMA8bEkd6hsz7Gm2luQa3qD5xJqfLQhpRSr\neciDQFOQ8ErkDCsep8Yl6YD5A17Dl9yzuyfy2C+w4evZYsvtI9Lnm3zPyd0X\n/oY9\r\n=DPXb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"77b1ca2604ba65a7fc7f2b50ca1dbccd954724d5","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"^0.25.0","nyc":"^15.0.1","tmp":"^0.2.1","chai":"^4.2.0","cuid":"^2.1.8","mkdirp":"^1.0.4","rimraf":"^3.0.2","@babel/cli":"^7.8.4","async-sema":"^3.1.0","@babel/preset-env":"^7.9.6"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.1-fix-npm-publish-77b1ca2604ba65a7fc7f2b50ca1dbccd954724d5_1588378559051_0.01634562760087377","host":"s3://npm-registry-packages"}},"1.0.1-fix-npm-publish-b585e1e3845f53f43ba21af29d81ce100aa32d18":{"name":"@balena/dockerignore","version":"1.0.1-fix-npm-publish-b585e1e3845f53f43ba21af29d81ce100aa32d18","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.1-fix-npm-publish-b585e1e3845f53f43ba21af29d81ce100aa32d18","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"f361d33d2ef8be4edb9e5cca248997e207efb0f6","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.1-fix-npm-publish-b585e1e3845f53f43ba21af29d81ce100aa32d18.tgz","fileCount":5,"integrity":"sha512-Q78O2y/D1cJBnjefJ/S0Lh8jtn4a6REW+zxxHutZ/Qp5LA19b72LbF2pXv9jR+F5WUHX5fw0CQwwdEATwWSc8Q==","signatures":[{"sig":"MEUCIQCQnLixPMNUBT/czzl/UlT9EFsrYwcmK6XHorxi/LSYygIgeqPF6Rg5SdRYNjLaY6yTk4INN2XZ5PwjCLvJv+9dWek=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerMDDCRA9TVsSAnZWagAAt/0P/AjL6IybUwxwSdVRhsj5\nA5ADeqdrhzQt6asKaHy40qmK3uxPX09NboAdgvoHPITKfav7jTtcv+Pp+ZWC\ncO5hr+Z5NZkVYYoUZt7ilRxrABK9jqqUqP/jzirBR2hBL/eFPgbrgyFCI2pI\nwZdwh+8NIgSnfm8mVqPSZ7F3I1VmW7T4bqtPGkVY7InQHRNBwH8U9WcP+jBc\njr6aTYVQdRB+rzXmffqjB2BBohu0k7PKzpQZvzGC9klKiZt14vPYhy/Lzo8y\nC5PMuBmsINA2x+C6y1jVMpJBedhd7WzJQvfN78Exqj4vxDtxlV2TOi8qdOZK\nrB7sc9896bbWJOzaLoG6ECRQUAgb3KIWsq2e+NW0DLFkVrOmUCSMuv4unMZ/\nNq2TKr8u3vhKU1u0stS+nEsTP2c+doYgOJ68RfBHQqQ07Axd5JIbg5e6fv79\nuFTD/YOF13Dwfck1Vy3XMgKP6W1Ic9uZxPER8K2U6sZx+FgUy/v6NJRqhCc5\nGGSD3OYyeqVbAEqlGHWPPppVpCk17v9sJfW2s6H/ngPv/4H4ENRiVSElaHNV\nr3nwT+wVxv1uXx1dppHmAmgmi+X/wAj/+Ph8eU7dB8UHsqqKsQTQVZFpr2BC\nkyESmi05M082518YNSFqxDApXQSZFDyZCmsS7LcnHhTXxztIsYBYFng9Q7JL\nNVId\r\n=PyLu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"b585e1e3845f53f43ba21af29d81ce100aa32d18","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly:":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"^0.25.0","nyc":"^15.0.1","tmp":"^0.2.1","chai":"^4.2.0","cuid":"^2.1.8","mkdirp":"^1.0.4","rimraf":"^3.0.2","@babel/cli":"^7.8.4","async-sema":"^3.1.0","@babel/preset-env":"^7.9.6"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.1-fix-npm-publish-b585e1e3845f53f43ba21af29d81ce100aa32d18_1588379842614_0.9515129380688727","host":"s3://npm-registry-packages"}},"1.0.1-fix-npm-publish-6a09906e7550ed90d6158d8032a2fc99c312e54d":{"name":"@balena/dockerignore","version":"1.0.1-fix-npm-publish-6a09906e7550ed90d6158d8032a2fc99c312e54d","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.1-fix-npm-publish-6a09906e7550ed90d6158d8032a2fc99c312e54d","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"464fccee6c8ed2a8666445909092dc4dc36a7b18","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.1-fix-npm-publish-6a09906e7550ed90d6158d8032a2fc99c312e54d.tgz","fileCount":6,"integrity":"sha512-qJsnP10CCJiDhlcOUc8d7YgFAMMIUzlWGdt6387GN8Vqqn29BCCx/3oOVcgLCaaNMDhZ0bFIwtOU+Nin8zDlGQ==","signatures":[{"sig":"MEQCIFX70ph6z2JCLiTMDXLVBQph4psBkIKlU00Beac5kL9iAiA3WKRQsD5oL/zKwKmDdUDLnsJIUpgXIJU1yMkCrQoIiA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39005,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJergJECRA9TVsSAnZWagAAsBcP/A6Nz1XK8aTqd0popyaZ\nslSSjnt3lZmNzP9txyOpiR/skn22ViPf8CQ+7QZ9dPJN1c/JsydC2LHG/+6y\npwwweUzc8cVi1kk7r5ewOXQBwrUcJHM3iPyawHUDb8lSS4hyJ33SwQ2imFsX\n+Xo3Wjj2P4m6E2sgJe/W4zQ7UWX4F78re85KDnC+rTP23q7FDHhoX5xyjIQN\n/0W5QBmnIBuyDSfmtB6wsl2ogx7tgha8IyVCULrKJK7hmLsWxKnpyLmYaBZv\nq3M0Cxj5nU2rxXhL6f7ArMF1n75aMDTYdw2sPff1TlsmUmdTNgecCjv33fdF\n8e95wLO69rfb7oSyyTsaNRfHXgfDZqvYUU2LdetfokWd2+o5IcBg8yIEDJxq\nssu1IbzJSlCY/67z3ulyHPLHSClnWiijHF0DWpb4k7DS6S6SFqtVnYyBEgvp\nFYuZeSsRdupCYQBfHxqS3TtVK8eZuWOPT/4nGacFcZAdoss0YuNrzl0NBixU\n4ndMGjzk9POINyoaV7n6GvY+YaavrQcnnvkJIxV3bBLtATG80uyx1wIQ/GoL\nr1oLPpmUI2iIX9KymWwb+HiXj097nM7WvV7VxyY8ojw3RGSh0jDHSquIxgF6\nmwRvqwlceEtxgeS1c+RR/DpGBIihKcIgxVqbWU3srO3y4zH7bK3y9ZZWqmA2\nBW52\r\n=N9iO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/), currently targeting\n[ES2015](https://en.wikipedia.org/wiki/ECMAScript).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore  # or yarn add @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"6a09906e7550ed90d6158d8032a2fc99c312e54d","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.1-fix-npm-publish-6a09906e7550ed90d6158d8032a2fc99c312e54d_1588462148233_0.5546918168153354","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@balena/dockerignore","version":"1.0.1","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.1","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"3de230cec724fc14a9dfd1eb8258fb3fa0e97629","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.1.tgz","fileCount":6,"integrity":"sha512-vuNKAQAb29O4/zCYRZWxKzjDJVFG3n3oJtUYRzEJLqTmcQ1r787uU6YIHbNiS0HR7cnzPwSnS6aDukguiOdVzA==","signatures":[{"sig":"MEYCIQC9KkTYyv3D2wtN0d2jSHY7nKy/bhyFwgGQr7n4JlRMtQIhAK6c1tR0umYth19/r1It/JRLVyzG+HhuKFcUsJautp8d","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":38948,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerg3rCRA9TVsSAnZWagAADPMQAI7txjIqWdDmxeA/+lOb\ncrjBOUOtE5iJwt5pw8jD7HXWla8/061z6ZRLFJEe01MvGALOJbRNQqLkhSgn\nppqOEap4R8yWsgT5Uz99JRrO0WPUPkabJdDt4QPrHcd9yaibNsZAFd3H18/x\nWo0pQOUqaLdAp1ZPe7CcMdXwzZVvP6Ly1OGy5qdAVpQcnMsmTiUK8jV0q512\n8+lPhTW/eSL4hCnopO0Fwsp+WYmf5ERedlStRX+7M3XsfJCCM8UknMp6yUsi\nXaGKVtZdwEyZt7Qe3IMcBNJbIHMAIbLm/Wg3bScKshhwRkWSRKBLhOd0Oe6I\nka/TCrMfIMmC82iYuhnR+hZyf/x+PHtztYQTTp93xNiM4OPOSpcdBJaX0dFz\nqyRiDJorOlN89NgJGSJtGNjey/QIbkeECG1Rau/KZF/yQW8FkqllJ3GX1Far\ngK6GlcaBuQo6txLOrBM11rgnPrri6cDPyUfZykUK27dwvip7lajOj7b7VJTN\nmxomQUOvt5KfyCti41do8t+Hzj/ew9X1tLV9+sIqbEm/msh6HKFNkneRzzc7\nYmtq0lqJ3D0oCVc8fQYjjBRbIsLOTCwgaUecfxlkuARxngnBUJtSy/k5arWS\n7cKUK31WulbNElFwTj99qlk+R5lysZXVNSBIIZY/n+y0UXemXkVbg2B4bVSV\nDJyI\r\n=IJsg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","gitHead":"43b54d32be43d35ceb320aa8786ab87ad9e06357","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"devDependencies":{"ava":"0.25.0","nyc":"11.8.0","tmp":"0.0.33","chai":"~1.7.2","cuid":"2.1.1","mkdirp":"^0.5.1","rimraf":"^2.6.2","babel-cli":"^6.26.0","async-sema":"^2.1.0","babel-preset-es2015":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.1_1588465130960_0.12773331844472957","host":"s3://npm-registry-packages"}},"1.0.2-replace-yarn-npm-28d44e5c6da2f2d498cbb0afcdfc62a5ecdea31e":{"name":"@balena/dockerignore","version":"1.0.2-replace-yarn-npm-28d44e5c6da2f2d498cbb0afcdfc62a5ecdea31e","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.2-replace-yarn-npm-28d44e5c6da2f2d498cbb0afcdfc62a5ecdea31e","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"f977f946d79702fa8a09b057a41ca8acaf7ce271","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.2-replace-yarn-npm-28d44e5c6da2f2d498cbb0afcdfc62a5ecdea31e.tgz","fileCount":6,"integrity":"sha512-T7BX1NM8jJF3cmEXHBcR6VRw9QruuCppmlh72srER0bbkYIsOVEThu251L/fl9gTxD+g7K3gmY1EA5j6yau/iw==","signatures":[{"sig":"MEYCIQCZC4VMfhztxVt5CkZu/jctLeeNiLPzPyBMnrlFydBTZwIhAIK9273jKlfSQgvtgnnx5ZTpaHvu/sp8EhafdJxRmvFJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":36749,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerhEcCRA9TVsSAnZWagAAVokP/ikJxPUH9jWy/9U+8JUI\nNFJLaGtpw51OOfiiv/QkDWlaL1RDr43ydyt4hX0yRc1l+wUqV3iV2Z1R7o4d\nbx+5wdhFfbJ+qmrzM+j20c8oU7tRlsAEi61o10w2LX1ZLHYC1qCSkZxodF6x\nch+sWMeiZvX4yQnBG08FIJhuyY1E1OagslNHNvIj8TL7SazehStVx3moXp/Z\nJKqp7HZX2JmyZDKAVHuNjVhXnL91MywGp7yxsTSj4/Mv8CGvH+RI/upTyXf6\n6mFW8xBpBHo4qmVlrP8t4Ww3KGA574GGPYMcoDug1BMYJwai/SzX5uVRl82v\nHXemeH+7ZlXCiABFFNF2cmzpXmYROKyxi7Hdze4Y8wIhEmqzA1HZOdpN5fyg\nFybnk+Fk4txKd62glDMaTj0AeEdx/qZgy6KzA8Q5oYfKrfWi/agnWrOpsmV6\nxDyianOeIUdY+uesNEdD351sSrotXtTQPFxWGeb+9VrMKTOgZVTBFxIhqrQL\nk9WciihdN5xN87W1aJpbIO0X1jsiknqkNdLXwWstJ9dFmxsecyq6mzErKHs1\nv5S/Be8QBuGHYxg/e3soyT2svKpjN55tRTKch7obILeRoZgEMRcM4/9ehpJ6\nS5y68y7cx8kxIBhZ9fsMCJXyxlkpa2ArxAXuFEEPTDU/uHJplh7CtgzlgBJz\nM82P\r\n=nQEr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","gitHead":"28d44e5c6da2f2d498cbb0afcdfc62a5ecdea31e","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.9.0","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.4.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"^0.25.0","nyc":"^15.0.1","tmp":"^0.2.1","chai":"^4.2.0","cuid":"^2.1.8","mkdirp":"^1.0.4","rimraf":"^3.0.2","@babel/cli":"^7.8.4","async-sema":"^3.1.0","@babel/preset-env":"^7.9.6"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.2-replace-yarn-npm-28d44e5c6da2f2d498cbb0afcdfc62a5ecdea31e_1588465948166_0.5651302255715953","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@balena/dockerignore","version":"1.0.2","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"Apache-2.0","_id":"@balena/dockerignore@1.0.2","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"homepage":"https://github.com/balena-io-modules/dockerignore#readme","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"dist":{"shasum":"9ffe4726915251e8eb69f44ef3547e0da2c03e0d","tarball":"https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.2.tgz","fileCount":6,"integrity":"sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==","signatures":[{"sig":"MEUCICBQuKQRS7ryhhw8UJAFoLvfsNojHa2u0oMvTzZayeoIAiEA3XSo7BqrvUU7N/AQhV4aXzi42fF/50jHWQ8BsgaZxpE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":36691,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeu7WjCRA9TVsSAnZWagAAUQIP/1Q8Sts329IlN6hketoz\ndingzFzzVwpIf54sHwjlP6yMff/ZZDqMp184zMlTAwPDl9N02bhkXRcikvpQ\nayy7hLBXwnIXyaw4BxPAnJKkGmLAUdLbrnhMtxoVHIsk6sTXrA0nwu6kAJUE\nOlHkn/zkOz5SWTstFH9mO6no4dTWYqUt1KvLLR+SgeORqQJcgQbvOdfxVZ3w\nIY5VtMKJTt/QblAoSexaetiuJzRq4EcAfMjPoVD0dUXOIUXfgFUWQ5rlN0w2\nxKXilKHIHEgqM8NEi4RHfKG8zCeemRKPFSXw7Nlc2bp0+3Ua9rboBWo8p84i\n3s+AU3DyMGb0dPHizNfi5hzM9y7bFNH9gLg+70HKPEIhuvNPCA9Hvf8OXfrQ\nlsEfm28UnIjGwakpCH1yBCxQsIWDL5Zf+kYtbQmqNNFF1Fsq0ueRfqsEGpdl\nBbccBGaMXWHFFX4KqzSfrN58ZkKU3iFzNR6zWNOI1etIlz57Vau7yjgu7j6F\nFJr57PvZy8Vkze7pfc6MMAHsDyY9RAEr8XjELPT6P2URTdHs3U3hxAATeoF/\nKbj+rUzJVh+0mvCGHKlilP8Wb0p0VHlGAD2ki3fJG5fWcQt45hSvEQcTST/K\nZM805wVvYneM6Sazw+94PF7JBBPDiAbkwUiUNFOyks0Qfn26tKy0WMhuimsw\nK0pj\r\n=xw1I\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./ignore.js","gitHead":"41f80f9469b37f1886e49ea65676ca6077a3f407","scripts":{"test":"npm run build && nyc ava ./test/ignore.js","build":"babel -o ignore.js index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"_npmVersion":"6.14.5","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","directories":{},"_nodeVersion":"10.20.1","_hasShrinkwrap":false,"devDependencies":{"ava":"^0.25.0","nyc":"^15.0.1","tmp":"^0.2.1","chai":"^4.2.0","cuid":"^2.1.8","mkdirp":"^1.0.4","rimraf":"^3.0.2","@babel/cli":"^7.8.4","async-sema":"^3.1.0","@babel/preset-env":"^7.9.6"},"_npmOperationalInternal":{"tmp":"tmp/dockerignore_1.0.2_1589360035436_0.7753049128309926","host":"s3://npm-registry-packages"}}},"time":{"created":"2020-04-16T17:31:52.159Z","modified":"2026-01-20T12:07:36.255Z","0.0.6-changelog-resinci-yml-1bc9e55cd43a70a391a6444687d0f0a14739b956":"2020-04-16T17:31:52.462Z","0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e":"2020-04-16T17:57:20.977Z","0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f":"2020-04-24T13:09:21.040Z","0.0.6-changelog-resinci-yml-f9467ae628f9074bf4c2499dbae137bbbf0db6fe":"2020-04-24T14:00:52.648Z","1.0.0-windows-support-c51302fd7e686844b097b3d08c6c1c20cf8fa528":"2020-04-24T17:34:15.881Z","0.0.6-changelog-resinci-yml-cf5ec80fb26d91c6b0d2548b4a60010db040bf57":"2020-04-24T20:15:03.217Z","1.0.0-windows-support-981a661fef397cb991d3b1824433c24374708ec9":"2020-04-24T21:11:31.173Z","1.0.0-windows-support-b462715c2e14512de25e06ab3a7d46517c6eb70c":"2020-04-24T23:05:29.222Z","0.0.6-changelog-resinci-yml-5b55d9e81900e090b1d8ce900ed4ea53a00bc504":"2020-04-27T14:44:38.740Z","0.0.6-changelog-resinci-yml-05200b7d7625f7ddd62f368d0e725d3ec3f2eaaa":"2020-04-27T15:26:45.492Z","0.0.6-changelog-resinci-yml-382aba353db7996260fddafedf1b8b49ffdb6306":"2020-04-29T13:23:06.107Z","0.0.6":"2020-04-29T14:58:52.199Z","1.0.0-windows-support-c26e0a015062d484f3dfdc41848bba7c5e231397":"2020-04-29T23:50:19.923Z","1.0.0":"2020-04-30T09:45:53.081Z","1.0.1-fix-npm-publish-479b2ce84a5d3669d22e3785d70c16f4aad96a20":"2020-05-01T23:59:47.856Z","1.0.1-fix-npm-publish-77b1ca2604ba65a7fc7f2b50ca1dbccd954724d5":"2020-05-02T00:15:59.225Z","1.0.1-fix-npm-publish-b585e1e3845f53f43ba21af29d81ce100aa32d18":"2020-05-02T00:37:22.749Z","1.0.1-fix-npm-publish-6a09906e7550ed90d6158d8032a2fc99c312e54d":"2020-05-02T23:29:08.323Z","1.0.1":"2020-05-03T00:18:51.065Z","1.0.2-replace-yarn-npm-28d44e5c6da2f2d498cbb0afcdfc62a5ecdea31e":"2020-05-03T00:32:28.274Z","1.0.2":"2020-05-13T08:53:55.553Z"},"bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"license":"Apache-2.0","homepage":"https://github.com/balena-io-modules/dockerignore#readme","keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"repository":{"url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git","type":"git"},"description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","maintainers":[{"email":"accounts+npm@balena.io","name":"balena.io"},{"email":"page@balena.io","name":"page"}],"readme":"\n# dockerignore\n\n`dockerignore` is a file filter library fully compatible with Docker's [.dockerignore\nfile](https://docs.docker.com/engine/reference/builder/#dockerignore-file), exposing the\nsame API as the popular [ignore](https://github.com/kaelzhang/node-ignore) package for the\n`.gitignore` format.\n\n`dockerignore` is also:\n\n* Compatible with Linux, macOS and Windows.\n* Compact with 0 external dependencies (production install).\n* A pure Javascript port of Docker's Golang implementation of the `.dockerignore` format.\n* Well tested with hundreds of test cases including comparison against the actual behavior\n  of `docker build` on Windows and Linux.\n* Relied on in production environments by\n  [balena-cli](https://www.balena.io/docs/reference/balena-cli/),\n  [now-cli](https://github.com/zeit/now-cli/)\n  and other prominent projects built around Docker.\n\n### What's different from `ignore`?\n\nThe `.dockerignore` spec has several differences from `.gitignore`:\n\n- `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches files in the\n  current directory (like glob). This difference is important when whitelisting after a `*` rule.\n- `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, whereas\n  in `.dockerignore` it matches only at `./abc` and not in subdirectories like `./somedir/abc`.\n- With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using\n  `!`) since `git` simply avoids walking through the subtree as an optimization. With\n  `.dockerignore`, a subdirectory can be re-added even if a parent directory has been ignored.\n- For a complete list of differences, check out the [.gitignore\n  spec](https://git-scm.com/docs/gitignore) and the [.dockerignore\n  spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file).\n\n### What's the same as `ignore`?\n\nThe entire API. `dockerignore` started as a fork of\n[node-ignore](https://github.com/kaelzhang/node-ignore), and even reuses the same `index.d.ts` file\nfor TypeScript definitions. Under the hood, `node-ignore`'s matching logic was rewritten to closely\nmatch Docker's implementation (modeled mainly around\n[dockerignore.go](https://github.com/moby/moby/blob/v19.03.8/builder/dockerignore/dockerignore.go)\nand [fileutils.go](https://github.com/moby/moby/blob/v19.03.8/pkg/fileutils/fileutils.go)).\n\n### Compatibility\n\n`dockerignore` works with Node.js version 8 and above, on Linux, macOS and Windows.\nThe code is compiled with [Babel](https://babeljs.io/docs/en/).\n\n## Install\n\n```bash\nnpm install --save @balena/dockerignore\n```\n\n## Usage\n\n```js\nconst ignore = require('@balena/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\nTypescript type definitions are also included:\n\n```typescript\nimport ignore from '@balena/dockerignore'\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### Windows paths are supported\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## Backslashes _vs._ forward slashes\n\n`dockerignore` behaves just like the Docker CLI (\"docker build\") in relation to the backslash (`\\`)\nand forward slash (`/`) characters:\n\nOS           | Location                | Slash (`/`)    | Backslash (`\\`)\n------------ | ----------------------- | ---------------| --------------------\nLinux, macOS | `.dockerignore`         | Path separator | Escape character\nLinux, macOS | `filter()`, `ignores()` | Path separator | Part of file name\nWindows      | `.dockerignore`         | Path separator | Path separator\nWindows      | `filter()`, `ignores()` | Path separator | Path separator\n\nThis means that forward slashes can be used in the `.dockerignore` file for cross-platform\ncompatibility. This is consistent with how Windows works generally: both forward slashes\nand backslashes are accepted as path separators by the Command Prompt (cmd.exe) or\nPowerShell, and by library functions like the Golang\n[filepath.Clean](https://golang.org/pkg/path/filepath/#Clean) or the Node.js\n[path.normalize](https://nodejs.org/docs/latest-v10.x/api/path.html#path_path_normalize_path).\n\nThe use of the backslash as an escape character (Linux and macOS only) is not documented in the\n`.dockerignore` specification. \"Reasonable\" uses are probably to escape the few characters that\nhave a special meaning in the `.dockerignore` file, namely `\"*#!\\\"` (excluding the double quotes),\nas opposed to characters that have a special meaning in [regular\nexpressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\ngenerally. The \"escaping\" behavior for any other characters (e.g. `'\\\\b'`) is undefined and subject\nto implementation-specific interpretation that may change at any time.\n\n## Absolute paths\n\nLeading and trailing slashes (or backslashes on Windows) are removed from `.dockerignore` patterns,\nso `'/a'`, `'a/'` and `'/a/'` are all equivalent to `'a'` in a `.dockerignore` file, and they all\nanchor to the \"leftmost\" directory when matching against relative paths. For example, pattern `'a'`\nis compared with `'x'` for a given path `'x/y/z'`. This follows Docker's Golang implementation for\ncompatibility. Conversely, a given absolute path will not match a non-wildcard pattern. More\nexamples:\n\n```js\n  ignore().add('a').ignores('a')    // true\n  ignore().add('/a').ignores('a')   // true\n  ignore().add('/a/').ignores('a')  // true\n  ignore().add('a').ignores('/a')   // false\n  ignore().add('/a').ignores('/a')  // false\n  ignore().add('/a/').ignores('/a') // false\n```\n\nConsidering pattern slash removal, the cases above may be reduced to:\n\n```js\n  ignore().add('a').ignores('a')  // true\n  ignore().add('a').ignores('/a') // false\n```\n\nThe 'false' outcome for these examples may appear to mismatch the behavior of \"docker build\", when\nthe source argument for the Dockerfile [ADD](https://docs.docker.com/engine/reference/builder/#add)\nor [COPY](https://docs.docker.com/engine/reference/builder/#copy) instructions is an absolute path\n(starting with a slash). The explanation is that docker converts absolute source paths to relative\npaths (relative to the \"build context\") **prior to pattern matching:**\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L806\nhttps://github.com/moby/moby/blob/v19.03.8/pkg/archive/archive.go#L825\n\n... while `dockerignore` mirrors the implementation of the pattern matcher itself. The advice is\nfor your application to do the same as the docker CLI: use relative paths for pattern matching.\nThis is also generally more portable across different environments: development machine, CI\npipelines, servers or end user devices.\n\n## Comments\n\nA pattern starting with `'#'` (hash) is ignored as a comment. The hash can be prefixed with\na slash or backslash in order to match a file name that also starts with a hash:\n\n```js\nignore().add('#abc').ignores('#abc')   // false\nignore().add('/#abc').ignores('#abc')  // true\nignore().add('\\\\#abc').ignores('#abc') // true\n```\n\nThis works because of the leading slash removal from patterns described in [Absolute\nPaths](#absolute-paths).\n\n## Exclusion patterns\n\nPatterns starting with `'!'` (exclamation mark) define matching exclusions (exceptions) as\ndocumented in the [.dockerignore\nspecification](https://docs.docker.com/engine/reference/builder/#dockerignore-file). For\ncompatibility with Docker's implementation, patterns starting with `'/!'` or `'!/'` (but not\n`'/!/'`) will also be considered exclusion patterns, in addition to slash removal described in\n[Absolute Paths](#absolute-paths). Backslash escaping as `'\\\\!'` may be used in order to match a\nfile or directory name that starts with the exclamation mark, but this is only possible on Linux\nand macOS, not on Windows. Again, it only behaves this way for compatibility with Docker's\nimplementation.\n\n## Options\n\nMatching is case-insensitive by default, following the `ignore` API\n([ignorecase](https://www.npmjs.com/package/ignore#optionsignorecase-since-400)).\nNote however that Docker performs case-sensitive matching.\nUse the `ignorecase: false` option to align with Docker's behavior:\n\n```js\nconst ig = ignore({ ignorecase: false }) // for case-sensitive matching\n```\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\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### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\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## Contributing\n\nContributions are always welcome!\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Acknowledgements\n\nThe initial work on this project was done by Pranay Prakash\n([@pranaygp](https://twitter.com/pranaygp)) / [▲ZEIT](https://zeit.co), Kael Zhang\n([@kaelzhang](https://github.com/kaelzhang)) and the [node-ignore\ncontributors](https://github.com/kaelzhang/node-ignore/graphs/contributors).\n\nPaulo Castro ([@pdcastro](https://github.com/pdcastro)) / [balena.io](https://www.balena.io/)\nforked the repository in year 2020 ([encouraged by\nZeit](https://github.com/zeit/dockerignore/pull/16#issuecomment-611790479)) and put in a\nsubstantial effort on Windows support, cross-platform compatibility and testing, leading to release\n1.0.0.\n","readmeFilename":"README.md"}