phantom-pr 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index/indexer.js +3 -1
- package/dist/core/index/indexer.js.map +1 -1
- package/package.json +3 -7
- package/node_modules/ignore/LICENSE-MIT +0 -21
- package/node_modules/ignore/README.md +0 -452
- package/node_modules/ignore/index.d.ts +0 -81
- package/node_modules/ignore/index.js +0 -784
- package/node_modules/ignore/legacy.js +0 -681
- package/node_modules/ignore/package.json +0 -87
- package/node_modules/yaml/LICENSE +0 -13
- package/node_modules/yaml/README.md +0 -172
- package/node_modules/yaml/bin.mjs +0 -11
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +0 -88
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +0 -43
- package/node_modules/yaml/browser/dist/compose/compose-node.js +0 -102
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +0 -86
- package/node_modules/yaml/browser/dist/compose/composer.js +0 -217
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +0 -115
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +0 -198
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +0 -49
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +0 -37
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +0 -207
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +0 -223
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +0 -146
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +0 -34
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +0 -26
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +0 -15
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +0 -13
- package/node_modules/yaml/browser/dist/doc/Document.js +0 -335
- package/node_modules/yaml/browser/dist/doc/anchors.js +0 -71
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +0 -55
- package/node_modules/yaml/browser/dist/doc/createNode.js +0 -88
- package/node_modules/yaml/browser/dist/doc/directives.js +0 -176
- package/node_modules/yaml/browser/dist/errors.js +0 -57
- package/node_modules/yaml/browser/dist/index.js +0 -17
- package/node_modules/yaml/browser/dist/log.js +0 -11
- package/node_modules/yaml/browser/dist/nodes/Alias.js +0 -114
- package/node_modules/yaml/browser/dist/nodes/Collection.js +0 -147
- package/node_modules/yaml/browser/dist/nodes/Node.js +0 -38
- package/node_modules/yaml/browser/dist/nodes/Pair.js +0 -36
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +0 -24
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +0 -144
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +0 -113
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +0 -63
- package/node_modules/yaml/browser/dist/nodes/identity.js +0 -36
- package/node_modules/yaml/browser/dist/nodes/toJS.js +0 -37
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +0 -214
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +0 -61
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +0 -97
- package/node_modules/yaml/browser/dist/parse/cst.js +0 -98
- package/node_modules/yaml/browser/dist/parse/lexer.js +0 -717
- package/node_modules/yaml/browser/dist/parse/line-counter.js +0 -39
- package/node_modules/yaml/browser/dist/parse/parser.js +0 -967
- package/node_modules/yaml/browser/dist/public-api.js +0 -102
- package/node_modules/yaml/browser/dist/schema/Schema.js +0 -37
- package/node_modules/yaml/browser/dist/schema/common/map.js +0 -17
- package/node_modules/yaml/browser/dist/schema/common/null.js +0 -15
- package/node_modules/yaml/browser/dist/schema/common/seq.js +0 -17
- package/node_modules/yaml/browser/dist/schema/common/string.js +0 -14
- package/node_modules/yaml/browser/dist/schema/core/bool.js +0 -19
- package/node_modules/yaml/browser/dist/schema/core/float.js +0 -43
- package/node_modules/yaml/browser/dist/schema/core/int.js +0 -38
- package/node_modules/yaml/browser/dist/schema/core/schema.js +0 -23
- package/node_modules/yaml/browser/dist/schema/json/schema.js +0 -62
- package/node_modules/yaml/browser/dist/schema/tags.js +0 -96
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +0 -58
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +0 -26
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +0 -46
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +0 -71
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +0 -64
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +0 -74
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +0 -78
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +0 -39
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +0 -93
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +0 -101
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +0 -146
- package/node_modules/yaml/browser/dist/stringify/stringify.js +0 -128
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +0 -143
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +0 -20
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +0 -85
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +0 -24
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +0 -150
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +0 -336
- package/node_modules/yaml/browser/dist/util.js +0 -11
- package/node_modules/yaml/browser/dist/visit.js +0 -233
- package/node_modules/yaml/browser/index.js +0 -5
- package/node_modules/yaml/browser/package.json +0 -3
- package/node_modules/yaml/dist/cli.d.ts +0 -8
- package/node_modules/yaml/dist/cli.mjs +0 -201
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +0 -11
- package/node_modules/yaml/dist/compose/compose-collection.js +0 -90
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +0 -7
- package/node_modules/yaml/dist/compose/compose-doc.js +0 -45
- package/node_modules/yaml/dist/compose/compose-node.d.ts +0 -29
- package/node_modules/yaml/dist/compose/compose-node.js +0 -105
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +0 -5
- package/node_modules/yaml/dist/compose/compose-scalar.js +0 -88
- package/node_modules/yaml/dist/compose/composer.d.ts +0 -63
- package/node_modules/yaml/dist/compose/composer.js +0 -222
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +0 -6
- package/node_modules/yaml/dist/compose/resolve-block-map.js +0 -117
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +0 -11
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +0 -200
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +0 -6
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +0 -51
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +0 -6
- package/node_modules/yaml/dist/compose/resolve-end.js +0 -39
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +0 -7
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +0 -209
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +0 -10
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +0 -225
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +0 -23
- package/node_modules/yaml/dist/compose/resolve-props.js +0 -148
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +0 -2
- package/node_modules/yaml/dist/compose/util-contains-newline.js +0 -36
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +0 -2
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +0 -28
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +0 -3
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +0 -17
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +0 -4
- package/node_modules/yaml/dist/compose/util-map-includes.js +0 -15
- package/node_modules/yaml/dist/doc/Document.d.ts +0 -141
- package/node_modules/yaml/dist/doc/Document.js +0 -337
- package/node_modules/yaml/dist/doc/anchors.d.ts +0 -24
- package/node_modules/yaml/dist/doc/anchors.js +0 -76
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +0 -9
- package/node_modules/yaml/dist/doc/applyReviver.js +0 -57
- package/node_modules/yaml/dist/doc/createNode.d.ts +0 -17
- package/node_modules/yaml/dist/doc/createNode.js +0 -90
- package/node_modules/yaml/dist/doc/directives.d.ts +0 -49
- package/node_modules/yaml/dist/doc/directives.js +0 -178
- package/node_modules/yaml/dist/errors.d.ts +0 -21
- package/node_modules/yaml/dist/errors.js +0 -62
- package/node_modules/yaml/dist/index.d.ts +0 -25
- package/node_modules/yaml/dist/index.js +0 -50
- package/node_modules/yaml/dist/log.d.ts +0 -3
- package/node_modules/yaml/dist/log.js +0 -19
- package/node_modules/yaml/dist/nodes/Alias.d.ts +0 -29
- package/node_modules/yaml/dist/nodes/Alias.js +0 -116
- package/node_modules/yaml/dist/nodes/Collection.d.ts +0 -73
- package/node_modules/yaml/dist/nodes/Collection.js +0 -151
- package/node_modules/yaml/dist/nodes/Node.d.ts +0 -53
- package/node_modules/yaml/dist/nodes/Node.js +0 -40
- package/node_modules/yaml/dist/nodes/Pair.d.ts +0 -22
- package/node_modules/yaml/dist/nodes/Pair.js +0 -39
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +0 -43
- package/node_modules/yaml/dist/nodes/Scalar.js +0 -27
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +0 -53
- package/node_modules/yaml/dist/nodes/YAMLMap.js +0 -147
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +0 -60
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +0 -115
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +0 -4
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +0 -65
- package/node_modules/yaml/dist/nodes/identity.d.ts +0 -23
- package/node_modules/yaml/dist/nodes/identity.js +0 -53
- package/node_modules/yaml/dist/nodes/toJS.d.ts +0 -29
- package/node_modules/yaml/dist/nodes/toJS.js +0 -39
- package/node_modules/yaml/dist/options.d.ts +0 -344
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +0 -64
- package/node_modules/yaml/dist/parse/cst-scalar.js +0 -218
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +0 -8
- package/node_modules/yaml/dist/parse/cst-stringify.js +0 -63
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +0 -39
- package/node_modules/yaml/dist/parse/cst-visit.js +0 -99
- package/node_modules/yaml/dist/parse/cst.d.ts +0 -109
- package/node_modules/yaml/dist/parse/cst.js +0 -112
- package/node_modules/yaml/dist/parse/lexer.d.ts +0 -87
- package/node_modules/yaml/dist/parse/lexer.js +0 -719
- package/node_modules/yaml/dist/parse/line-counter.d.ts +0 -22
- package/node_modules/yaml/dist/parse/line-counter.js +0 -41
- package/node_modules/yaml/dist/parse/parser.d.ts +0 -84
- package/node_modules/yaml/dist/parse/parser.js +0 -972
- package/node_modules/yaml/dist/public-api.d.ts +0 -44
- package/node_modules/yaml/dist/public-api.js +0 -107
- package/node_modules/yaml/dist/schema/Schema.d.ts +0 -17
- package/node_modules/yaml/dist/schema/Schema.js +0 -39
- package/node_modules/yaml/dist/schema/common/map.d.ts +0 -2
- package/node_modules/yaml/dist/schema/common/map.js +0 -19
- package/node_modules/yaml/dist/schema/common/null.d.ts +0 -4
- package/node_modules/yaml/dist/schema/common/null.js +0 -17
- package/node_modules/yaml/dist/schema/common/seq.d.ts +0 -2
- package/node_modules/yaml/dist/schema/common/seq.js +0 -19
- package/node_modules/yaml/dist/schema/common/string.d.ts +0 -2
- package/node_modules/yaml/dist/schema/common/string.js +0 -16
- package/node_modules/yaml/dist/schema/core/bool.d.ts +0 -4
- package/node_modules/yaml/dist/schema/core/bool.js +0 -21
- package/node_modules/yaml/dist/schema/core/float.d.ts +0 -4
- package/node_modules/yaml/dist/schema/core/float.js +0 -47
- package/node_modules/yaml/dist/schema/core/int.d.ts +0 -4
- package/node_modules/yaml/dist/schema/core/int.js +0 -42
- package/node_modules/yaml/dist/schema/core/schema.d.ts +0 -1
- package/node_modules/yaml/dist/schema/core/schema.js +0 -25
- package/node_modules/yaml/dist/schema/json/schema.d.ts +0 -2
- package/node_modules/yaml/dist/schema/json/schema.js +0 -64
- package/node_modules/yaml/dist/schema/json-schema.d.ts +0 -69
- package/node_modules/yaml/dist/schema/tags.d.ts +0 -48
- package/node_modules/yaml/dist/schema/tags.js +0 -99
- package/node_modules/yaml/dist/schema/types.d.ts +0 -92
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +0 -2
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +0 -70
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +0 -7
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +0 -29
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +0 -4
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +0 -50
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +0 -5
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +0 -76
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +0 -9
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +0 -68
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +0 -22
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +0 -77
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +0 -10
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +0 -82
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +0 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +0 -41
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +0 -28
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +0 -96
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +0 -6
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +0 -105
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +0 -34
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +0 -151
- package/node_modules/yaml/dist/stringify/stringify.d.ts +0 -21
- package/node_modules/yaml/dist/stringify/stringify.js +0 -131
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +0 -17
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +0 -145
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +0 -10
- package/node_modules/yaml/dist/stringify/stringifyComment.js +0 -24
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +0 -4
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +0 -87
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +0 -2
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +0 -26
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +0 -3
- package/node_modules/yaml/dist/stringify/stringifyPair.js +0 -152
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +0 -9
- package/node_modules/yaml/dist/stringify/stringifyString.js +0 -338
- package/node_modules/yaml/dist/test-events.d.ts +0 -4
- package/node_modules/yaml/dist/test-events.js +0 -134
- package/node_modules/yaml/dist/util.d.ts +0 -16
- package/node_modules/yaml/dist/util.js +0 -28
- package/node_modules/yaml/dist/visit.d.ts +0 -102
- package/node_modules/yaml/dist/visit.js +0 -236
- package/node_modules/yaml/package.json +0 -97
- package/node_modules/yaml/util.js +0 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import
|
|
3
|
+
import ignoreModule from 'ignore';
|
|
4
4
|
import { stableStringify } from '../stableJson.js';
|
|
5
|
+
// Handle both ignore v5/v6 (exports .default) and v7 (exports function directly)
|
|
6
|
+
const ignore = typeof ignoreModule === 'function' ? ignoreModule : ignoreModule.default;
|
|
5
7
|
const DENY_DIRS = new Set([
|
|
6
8
|
'.git',
|
|
7
9
|
'.phantom-pr',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../../../src/core/index/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../../../src/core/index/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,iFAAiF;AACjF,MAAM,MAAM,GAAG,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAE,YAAiD,CAAC,OAAO,CAAC;AA4B9H,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,MAAM;IACN,aAAa;IACb,cAAc;IACd,MAAM;IACN,OAAO;CACR,CAAC,CAAC;AAEH,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACxB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,SAAS,CAAC,KAAe;IAChC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,C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9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAgB;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAChD,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,yEAAyE;IACzE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;IACjE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phantom-pr",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CI-friendly CLI that opens PRs with passing Jest unit tests.",
|
|
6
6
|
"keywords": [
|
|
@@ -39,13 +39,9 @@
|
|
|
39
39
|
"...": "..."
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"ignore": "
|
|
43
|
-
"yaml": "
|
|
42
|
+
"ignore": ">=5.0.0 <8.0.0",
|
|
43
|
+
"yaml": ">=2.0.0 <3.0.0"
|
|
44
44
|
},
|
|
45
|
-
"bundledDependencies": [
|
|
46
|
-
"ignore",
|
|
47
|
-
"yaml"
|
|
48
|
-
],
|
|
49
45
|
"devDependencies": {
|
|
50
46
|
"@types/node": "^18.0.0",
|
|
51
47
|
"nock": "^13.3.0",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2013 Kael Zhang <i@kael.me>, contributors
|
|
2
|
-
http://kael.me/
|
|
3
|
-
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
-
a copy of this software and associated documentation files (the
|
|
6
|
-
"Software"), to deal in the Software without restriction, including
|
|
7
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
-
the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be
|
|
13
|
-
included in all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
| Linux / MacOS / Windows | Coverage | Downloads |
|
|
2
|
-
| ----------------------- | -------- | --------- |
|
|
3
|
-
| [![build][bb]][bl] | [![coverage][cb]][cl] | [![downloads][db]][dl] |
|
|
4
|
-
|
|
5
|
-
[bb]: https://github.com/kaelzhang/node-ignore/actions/workflows/nodejs.yml/badge.svg
|
|
6
|
-
[bl]: https://github.com/kaelzhang/node-ignore/actions/workflows/nodejs.yml
|
|
7
|
-
|
|
8
|
-
[cb]: https://codecov.io/gh/kaelzhang/node-ignore/branch/master/graph/badge.svg
|
|
9
|
-
[cl]: https://codecov.io/gh/kaelzhang/node-ignore
|
|
10
|
-
|
|
11
|
-
[db]: http://img.shields.io/npm/dm/ignore.svg
|
|
12
|
-
[dl]: https://www.npmjs.org/package/ignore
|
|
13
|
-
|
|
14
|
-
# ignore
|
|
15
|
-
|
|
16
|
-
`ignore` is a manager, filter and parser which implemented in pure JavaScript according to the [.gitignore spec 2.22.1](http://git-scm.com/docs/gitignore).
|
|
17
|
-
|
|
18
|
-
`ignore` is used by eslint, gitbook and [many others](https://www.npmjs.com/browse/depended/ignore).
|
|
19
|
-
|
|
20
|
-
Pay **ATTENTION** that [`minimatch`](https://www.npmjs.org/package/minimatch) (which used by `fstream-ignore`) does not follow the gitignore spec.
|
|
21
|
-
|
|
22
|
-
To filter filenames according to a .gitignore file, I recommend this npm package, `ignore`.
|
|
23
|
-
|
|
24
|
-
To parse an `.npmignore` file, you should use `minimatch`, because an `.npmignore` file is parsed by npm using `minimatch` and it does not work in the .gitignore way.
|
|
25
|
-
|
|
26
|
-
### Tested on
|
|
27
|
-
|
|
28
|
-
`ignore` is fully tested, and has more than **five hundreds** of unit tests.
|
|
29
|
-
|
|
30
|
-
- Linux + Node: `0.8` - `7.x`
|
|
31
|
-
- Windows + Node: `0.10` - `7.x`, node < `0.10` is not tested due to the lack of support of appveyor.
|
|
32
|
-
|
|
33
|
-
Actually, `ignore` does not rely on any versions of node specially.
|
|
34
|
-
|
|
35
|
-
Since `4.0.0`, ignore will no longer support `node < 6` by default, to use in node < 6, `require('ignore/legacy')`. For details, see [CHANGELOG](https://github.com/kaelzhang/node-ignore/blob/master/CHANGELOG.md).
|
|
36
|
-
|
|
37
|
-
## Table Of Main Contents
|
|
38
|
-
|
|
39
|
-
- [Usage](#usage)
|
|
40
|
-
- [`Pathname` Conventions](#pathname-conventions)
|
|
41
|
-
- See Also:
|
|
42
|
-
- [`glob-gitignore`](https://www.npmjs.com/package/glob-gitignore) matches files using patterns and filters them according to gitignore rules.
|
|
43
|
-
- [Upgrade Guide](#upgrade-guide)
|
|
44
|
-
|
|
45
|
-
## Install
|
|
46
|
-
|
|
47
|
-
```sh
|
|
48
|
-
npm i ignore
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Usage
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
import ignore from 'ignore'
|
|
55
|
-
const ig = ignore().add(['.abc/*', '!.abc/d/'])
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Filter the given paths
|
|
59
|
-
|
|
60
|
-
```js
|
|
61
|
-
const paths = [
|
|
62
|
-
'.abc/a.js', // filtered out
|
|
63
|
-
'.abc/d/e.js' // included
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
ig.filter(paths) // ['.abc/d/e.js']
|
|
67
|
-
ig.ignores('.abc/a.js') // true
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### As the filter function
|
|
71
|
-
|
|
72
|
-
```js
|
|
73
|
-
paths.filter(ig.createFilter()); // ['.abc/d/e.js']
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Win32 paths will be handled
|
|
77
|
-
|
|
78
|
-
```js
|
|
79
|
-
ig.filter(['.abc\\a.js', '.abc\\d\\e.js'])
|
|
80
|
-
// if the code above runs on windows, the result will be
|
|
81
|
-
// ['.abc\\d\\e.js']
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Why another ignore?
|
|
85
|
-
|
|
86
|
-
- `ignore` is a standalone module, and is much simpler so that it could easy work with other programs, unlike [isaacs](https://npmjs.org/~isaacs)'s [fstream-ignore](https://npmjs.org/package/fstream-ignore) which must work with the modules of the fstream family.
|
|
87
|
-
|
|
88
|
-
- `ignore` only contains utility methods to filter paths according to the specified ignore rules, so
|
|
89
|
-
- `ignore` never try to find out ignore rules by traversing directories or fetching from git configurations.
|
|
90
|
-
- `ignore` don't cares about sub-modules of git projects.
|
|
91
|
-
|
|
92
|
-
- Exactly according to [gitignore man page](http://git-scm.com/docs/gitignore), fixes some known matching issues of fstream-ignore, such as:
|
|
93
|
-
- '`/*.js`' should only match '`a.js`', but not '`abc/a.js`'.
|
|
94
|
-
- '`**/foo`' should match '`foo`' anywhere.
|
|
95
|
-
- Prevent re-including a file if a parent directory of that file is excluded.
|
|
96
|
-
- Handle trailing whitespaces:
|
|
97
|
-
- `'a '`(one space) should not match `'a '`(two spaces).
|
|
98
|
-
- `'a \ '` matches `'a '`
|
|
99
|
-
- All test cases are verified with the result of `git check-ignore`.
|
|
100
|
-
|
|
101
|
-
# Methods
|
|
102
|
-
|
|
103
|
-
## .add(pattern: string | Ignore): this
|
|
104
|
-
## .add(patterns: Array<string | Ignore>): this
|
|
105
|
-
## .add({pattern: string, mark?: string}): this since 7.0.0
|
|
106
|
-
|
|
107
|
-
- **pattern** `string | Ignore` An ignore pattern string, or the `Ignore` instance
|
|
108
|
-
- **patterns** `Array<string | Ignore>` Array of ignore patterns.
|
|
109
|
-
- **mark?** `string` Pattern mark, which is used to associate the pattern with a certain marker, such as the line no of the `.gitignore` file. Actually it could be an arbitrary string and is optional.
|
|
110
|
-
|
|
111
|
-
Adds a rule or several rules to the current manager.
|
|
112
|
-
|
|
113
|
-
Returns `this`
|
|
114
|
-
|
|
115
|
-
Notice 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.
|
|
116
|
-
|
|
117
|
-
```js
|
|
118
|
-
ignore().add('#abc').ignores('#abc') // false
|
|
119
|
-
ignore().add('\\#abc').ignores('#abc') // true
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
`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:
|
|
123
|
-
|
|
124
|
-
```js
|
|
125
|
-
ignore()
|
|
126
|
-
.add(fs.readFileSync(filenameOfGitignore).toString())
|
|
127
|
-
.filter(filenames)
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance.
|
|
131
|
-
|
|
132
|
-
## .ignores(pathname: [Pathname](#pathname-conventions)): boolean
|
|
133
|
-
|
|
134
|
-
> new in 3.2.0
|
|
135
|
-
|
|
136
|
-
Returns `Boolean` whether `pathname` should be ignored.
|
|
137
|
-
|
|
138
|
-
```js
|
|
139
|
-
ig.ignores('.abc/a.js') // true
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Please **PAY ATTENTION** that `.ignores()` is **NOT** equivalent to `git check-ignore` although in most cases they return equivalent results.
|
|
143
|
-
|
|
144
|
-
However, for the purposes of imitating the behavior of `git check-ignore`, please use `.checkIgnore()` instead.
|
|
145
|
-
|
|
146
|
-
### `Pathname` Conventions:
|
|
147
|
-
|
|
148
|
-
#### 1. `Pathname` should be a `path.relative()`d pathname
|
|
149
|
-
|
|
150
|
-
`Pathname` should be a string that have been `path.join()`ed, or the return value of `path.relative()` to the current directory,
|
|
151
|
-
|
|
152
|
-
```js
|
|
153
|
-
// WRONG, an error will be thrown
|
|
154
|
-
ig.ignores('./abc')
|
|
155
|
-
|
|
156
|
-
// WRONG, for it will never happen, and an error will be thrown
|
|
157
|
-
// If the gitignore rule locates at the root directory,
|
|
158
|
-
// `'/abc'` should be changed to `'abc'`.
|
|
159
|
-
// ```
|
|
160
|
-
// path.relative('/', '/abc') -> 'abc'
|
|
161
|
-
// ```
|
|
162
|
-
ig.ignores('/abc')
|
|
163
|
-
|
|
164
|
-
// WRONG, that it is an absolute path on Windows, an error will be thrown
|
|
165
|
-
ig.ignores('C:\\abc')
|
|
166
|
-
|
|
167
|
-
// Right
|
|
168
|
-
ig.ignores('abc')
|
|
169
|
-
|
|
170
|
-
// Right
|
|
171
|
-
ig.ignores(path.join('./abc')) // path.join('./abc') -> 'abc'
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
In other words, each `Pathname` here should be a relative path to the directory of the gitignore rules.
|
|
175
|
-
|
|
176
|
-
Suppose the dir structure is:
|
|
177
|
-
|
|
178
|
-
```
|
|
179
|
-
/path/to/your/repo
|
|
180
|
-
|-- a
|
|
181
|
-
| |-- a.js
|
|
182
|
-
|
|
|
183
|
-
|-- .b
|
|
184
|
-
|
|
|
185
|
-
|-- .c
|
|
186
|
-
|-- .DS_store
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Then the `paths` might be like this:
|
|
190
|
-
|
|
191
|
-
```js
|
|
192
|
-
[
|
|
193
|
-
'a/a.js'
|
|
194
|
-
'.b',
|
|
195
|
-
'.c/.DS_store'
|
|
196
|
-
]
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
#### 2. filenames and dirnames
|
|
200
|
-
|
|
201
|
-
`node-ignore` does NO `fs.stat` during path matching, so `node-ignore` treats
|
|
202
|
-
- `foo` as a file
|
|
203
|
-
- **`foo/` as a directory**
|
|
204
|
-
|
|
205
|
-
For the example below:
|
|
206
|
-
|
|
207
|
-
```js
|
|
208
|
-
// First, we add a ignore pattern to ignore a directory
|
|
209
|
-
ig.add('config/')
|
|
210
|
-
|
|
211
|
-
// `ig` does NOT know if 'config', in the real world,
|
|
212
|
-
// is a normal file, directory or something.
|
|
213
|
-
|
|
214
|
-
ig.ignores('config')
|
|
215
|
-
// `ig` treats `config` as a file, so it returns `false`
|
|
216
|
-
|
|
217
|
-
ig.ignores('config/')
|
|
218
|
-
// returns `true`
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
Specially for people who develop some library based on `node-ignore`, it is important to understand that.
|
|
222
|
-
|
|
223
|
-
Usually, you could use [`glob`](http://npmjs.org/package/glob) with `option.mark = true` to fetch the structure of the current directory:
|
|
224
|
-
|
|
225
|
-
```js
|
|
226
|
-
import glob from 'glob'
|
|
227
|
-
|
|
228
|
-
glob('**', {
|
|
229
|
-
// Adds a / character to directory matches.
|
|
230
|
-
mark: true
|
|
231
|
-
}, (err, files) => {
|
|
232
|
-
if (err) {
|
|
233
|
-
return console.error(err)
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
let filtered = ignore().add(patterns).filter(files)
|
|
237
|
-
console.log(filtered)
|
|
238
|
-
})
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
## .filter(paths: Array<Pathname>): Array<Pathname>
|
|
243
|
-
|
|
244
|
-
```ts
|
|
245
|
-
type Pathname = string
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
Filters the given array of pathnames, and returns the filtered array.
|
|
249
|
-
|
|
250
|
-
- **paths** `Array.<Pathname>` The array of `pathname`s to be filtered.
|
|
251
|
-
|
|
252
|
-
## .createFilter()
|
|
253
|
-
|
|
254
|
-
Creates a filter function which could filter an array of paths with `Array.prototype.filter`.
|
|
255
|
-
|
|
256
|
-
Returns `function(path)` the filter function.
|
|
257
|
-
|
|
258
|
-
## .test(pathname: Pathname): TestResult
|
|
259
|
-
|
|
260
|
-
> New in 5.0.0
|
|
261
|
-
|
|
262
|
-
Returns `TestResult`
|
|
263
|
-
|
|
264
|
-
```ts
|
|
265
|
-
// Since 5.0.0
|
|
266
|
-
interface TestResult {
|
|
267
|
-
ignored: boolean
|
|
268
|
-
// true if the `pathname` is finally unignored by some negative pattern
|
|
269
|
-
unignored: boolean
|
|
270
|
-
// The `IgnoreRule` which ignores the pathname
|
|
271
|
-
rule?: IgnoreRule
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// Since 7.0.0
|
|
275
|
-
interface IgnoreRule {
|
|
276
|
-
// The original pattern
|
|
277
|
-
pattern: string
|
|
278
|
-
// Whether the pattern is a negative pattern
|
|
279
|
-
negative: boolean
|
|
280
|
-
// Which is used for other packages to build things upon `node-ignore`
|
|
281
|
-
mark?: string
|
|
282
|
-
}
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
- `{ignored: true, unignored: false}`: the `pathname` is ignored
|
|
286
|
-
- `{ignored: false, unignored: true}`: the `pathname` is unignored
|
|
287
|
-
- `{ignored: false, unignored: false}`: the `pathname` is never matched by any ignore rules.
|
|
288
|
-
|
|
289
|
-
## .checkIgnore(target: string): TestResult
|
|
290
|
-
|
|
291
|
-
> new in 7.0.0
|
|
292
|
-
|
|
293
|
-
Debugs gitignore / exclude files, which is equivalent to `git check-ignore -v`. Usually this method is used for other packages to implement the function of `git check-ignore -v` upon `node-ignore`
|
|
294
|
-
|
|
295
|
-
- **target** `string` the target to test.
|
|
296
|
-
|
|
297
|
-
Returns `TestResult`
|
|
298
|
-
|
|
299
|
-
```js
|
|
300
|
-
ig.add({
|
|
301
|
-
pattern: 'foo/*',
|
|
302
|
-
mark: '60'
|
|
303
|
-
})
|
|
304
|
-
|
|
305
|
-
const {
|
|
306
|
-
ignored,
|
|
307
|
-
rule
|
|
308
|
-
} = checkIgnore('foo/')
|
|
309
|
-
|
|
310
|
-
if (ignored) {
|
|
311
|
-
console.log(`.gitignore:${result}:${rule.mark}:${rule.pattern} foo/`)
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// .gitignore:60:foo/* foo/
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
Please pay attention that this method does not have a strong built-in cache mechanism.
|
|
318
|
-
|
|
319
|
-
The purpose of introducing this method is to make it possible to implement the `git check-ignore` command in JavaScript based on `node-ignore`.
|
|
320
|
-
|
|
321
|
-
So do not use this method in those situations where performance is extremely important.
|
|
322
|
-
|
|
323
|
-
## static `isPathValid(pathname): boolean` since 5.0.0
|
|
324
|
-
|
|
325
|
-
Check whether the `pathname` is an valid `path.relative()`d path according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname).
|
|
326
|
-
|
|
327
|
-
This method is **NOT** used to check if an ignore pattern is valid.
|
|
328
|
-
|
|
329
|
-
```js
|
|
330
|
-
import {isPathValid} from 'ignore'
|
|
331
|
-
|
|
332
|
-
isPathValid('./foo') // false
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
## <strike>.addIgnoreFile(path)</strike>
|
|
336
|
-
|
|
337
|
-
REMOVED in `3.x` for now.
|
|
338
|
-
|
|
339
|
-
To upgrade `ignore@2.x` up to `3.x`, use
|
|
340
|
-
|
|
341
|
-
```js
|
|
342
|
-
import fs from 'fs'
|
|
343
|
-
|
|
344
|
-
if (fs.existsSync(filename)) {
|
|
345
|
-
ignore().add(fs.readFileSync(filename).toString())
|
|
346
|
-
}
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
instead.
|
|
350
|
-
|
|
351
|
-
## ignore(options)
|
|
352
|
-
|
|
353
|
-
### `options.ignorecase` since 4.0.0
|
|
354
|
-
|
|
355
|
-
Similar to the `core.ignorecase` option of [git-config](https://git-scm.com/docs/git-config), `node-ignore` will be case insensitive if `options.ignorecase` is set to `true` (the default value), otherwise case sensitive.
|
|
356
|
-
|
|
357
|
-
```js
|
|
358
|
-
const ig = ignore({
|
|
359
|
-
ignorecase: false
|
|
360
|
-
})
|
|
361
|
-
|
|
362
|
-
ig.add('*.png')
|
|
363
|
-
|
|
364
|
-
ig.ignores('*.PNG') // false
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### `options.ignoreCase?: boolean` since 5.2.0
|
|
368
|
-
|
|
369
|
-
Which is an alternative to `options.ignoreCase`
|
|
370
|
-
|
|
371
|
-
### `options.allowRelativePaths?: boolean` since 5.2.0
|
|
372
|
-
|
|
373
|
-
This option brings backward compatibility with projects which based on `ignore@4.x`. If `options.allowRelativePaths` is `true`, `ignore` will not check whether the given path to be tested is [`path.relative()`d](#pathname-conventions).
|
|
374
|
-
|
|
375
|
-
However, passing a relative path, such as `'./foo'` or `'../foo'`, to test if it is ignored or not is not a good practise, which might lead to unexpected behavior
|
|
376
|
-
|
|
377
|
-
```js
|
|
378
|
-
ignore({
|
|
379
|
-
allowRelativePaths: true
|
|
380
|
-
}).ignores('../foo/bar.js') // And it will not throw
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
****
|
|
384
|
-
|
|
385
|
-
# Upgrade Guide
|
|
386
|
-
|
|
387
|
-
## Upgrade 4.x -> 5.x
|
|
388
|
-
|
|
389
|
-
Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory.
|
|
390
|
-
|
|
391
|
-
While `ignore < 5.0.0` did not make sure what the return value was, as well as
|
|
392
|
-
|
|
393
|
-
```ts
|
|
394
|
-
.ignores(pathname: Pathname): boolean
|
|
395
|
-
|
|
396
|
-
.filter(pathnames: Array<Pathname>): Array<Pathname>
|
|
397
|
-
|
|
398
|
-
.createFilter(): (pathname: Pathname) => boolean
|
|
399
|
-
|
|
400
|
-
.test(pathname: Pathname): {ignored: boolean, unignored: boolean}
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
See the convention [here](#1-pathname-should-be-a-pathrelatived-pathname) for details.
|
|
404
|
-
|
|
405
|
-
If there are invalid pathnames, the conversion and filtration should be done by users.
|
|
406
|
-
|
|
407
|
-
```js
|
|
408
|
-
import {isPathValid} from 'ignore' // introduced in 5.0.0
|
|
409
|
-
|
|
410
|
-
const paths = [
|
|
411
|
-
// invalid
|
|
412
|
-
//////////////////
|
|
413
|
-
'',
|
|
414
|
-
false,
|
|
415
|
-
'../foo',
|
|
416
|
-
'.',
|
|
417
|
-
//////////////////
|
|
418
|
-
|
|
419
|
-
// valid
|
|
420
|
-
'foo'
|
|
421
|
-
]
|
|
422
|
-
.filter(isPathValid)
|
|
423
|
-
|
|
424
|
-
ig.filter(paths)
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
## Upgrade 3.x -> 4.x
|
|
428
|
-
|
|
429
|
-
Since `4.0.0`, `ignore` will no longer support node < 6, to use `ignore` in node < 6:
|
|
430
|
-
|
|
431
|
-
```js
|
|
432
|
-
var ignore = require('ignore/legacy')
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
## Upgrade 2.x -> 3.x
|
|
436
|
-
|
|
437
|
-
- All `options` of 2.x are unnecessary and removed, so just remove them.
|
|
438
|
-
- `ignore()` instance is no longer an [`EventEmitter`](nodejs.org/api/events.html), and all events are unnecessary and removed.
|
|
439
|
-
- `.addIgnoreFile()` is removed, see the [.addIgnoreFile](#addignorefilepath) section for details.
|
|
440
|
-
|
|
441
|
-
****
|
|
442
|
-
|
|
443
|
-
# Collaborators
|
|
444
|
-
|
|
445
|
-
- [@whitecolor](https://github.com/whitecolor) *Alex*
|
|
446
|
-
- [@SamyPesse](https://github.com/SamyPesse) *Samy Pessé*
|
|
447
|
-
- [@azproduction](https://github.com/azproduction) *Mikhail Davydov*
|
|
448
|
-
- [@TrySound](https://github.com/TrySound) *Bogdan Chadkin*
|
|
449
|
-
- [@JanMattner](https://github.com/JanMattner) *Jan Mattner*
|
|
450
|
-
- [@ntwb](https://github.com/ntwb) *Stephen Edgar*
|
|
451
|
-
- [@kasperisager](https://github.com/kasperisager) *Kasper Isager*
|
|
452
|
-
- [@sandersn](https://github.com/sandersn) *Nathan Shively-Sanders*
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
type Pathname = string
|
|
2
|
-
|
|
3
|
-
interface IgnoreRule {
|
|
4
|
-
pattern: string
|
|
5
|
-
mark?: string
|
|
6
|
-
negative: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface TestResult {
|
|
10
|
-
ignored: boolean
|
|
11
|
-
unignored: boolean
|
|
12
|
-
rule?: IgnoreRule
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface PatternParams {
|
|
16
|
-
pattern: string
|
|
17
|
-
mark?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Creates new ignore manager.
|
|
22
|
-
*/
|
|
23
|
-
declare function ignore(options?: ignore.Options): ignore.Ignore
|
|
24
|
-
declare namespace ignore {
|
|
25
|
-
interface Ignore {
|
|
26
|
-
/**
|
|
27
|
-
* Adds one or several rules to the current manager.
|
|
28
|
-
* @param {string[]} patterns
|
|
29
|
-
* @returns IgnoreBase
|
|
30
|
-
*/
|
|
31
|
-
add(
|
|
32
|
-
patterns: string | Ignore | readonly (string | Ignore)[] | PatternParams
|
|
33
|
-
): this
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Filters the given array of pathnames, and returns the filtered array.
|
|
37
|
-
* NOTICE that each path here should be a relative path to the root of your repository.
|
|
38
|
-
* @param paths the array of paths to be filtered.
|
|
39
|
-
* @returns The filtered array of paths
|
|
40
|
-
*/
|
|
41
|
-
filter(pathnames: readonly Pathname[]): Pathname[]
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Creates a filter function which could filter
|
|
45
|
-
* an array of paths with Array.prototype.filter.
|
|
46
|
-
*/
|
|
47
|
-
createFilter(): (pathname: Pathname) => boolean
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Returns Boolean whether pathname should be ignored.
|
|
51
|
-
* @param {string} pathname a path to check
|
|
52
|
-
* @returns boolean
|
|
53
|
-
*/
|
|
54
|
-
ignores(pathname: Pathname): boolean
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns whether pathname should be ignored or unignored
|
|
58
|
-
* @param {string} pathname a path to check
|
|
59
|
-
* @returns TestResult
|
|
60
|
-
*/
|
|
61
|
-
test(pathname: Pathname): TestResult
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Debugs ignore rules and returns the checking result, which is
|
|
65
|
-
* equivalent to `git check-ignore -v`.
|
|
66
|
-
* @returns TestResult
|
|
67
|
-
*/
|
|
68
|
-
checkIgnore(pathname: Pathname): TestResult
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
interface Options {
|
|
72
|
-
ignorecase?: boolean
|
|
73
|
-
// For compatibility
|
|
74
|
-
ignoreCase?: boolean
|
|
75
|
-
allowRelativePaths?: boolean
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function isPathValid(pathname: string): boolean
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export = ignore
|