view-ignored 0.1.1 → 0.2.0

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.
Files changed (164) hide show
  1. package/README.md +37 -54
  2. package/bin/viewig +2 -2
  3. package/out/src/bin.d.ts +2 -0
  4. package/out/src/bin.js +3 -0
  5. package/out/src/browser/binds/index.d.ts +45 -0
  6. package/out/src/browser/binds/index.js +78 -0
  7. package/out/src/browser/binds/plugins/git.d.ts +3 -0
  8. package/out/src/browser/binds/plugins/git.js +24 -0
  9. package/out/src/browser/binds/plugins/npm.d.ts +11 -0
  10. package/out/src/browser/binds/plugins/npm.js +71 -0
  11. package/out/src/browser/binds/plugins/vsce.d.ts +9 -0
  12. package/out/src/browser/binds/plugins/vsce.js +21 -0
  13. package/out/src/browser/binds/plugins/yarn.d.ts +16 -0
  14. package/out/src/browser/binds/plugins/yarn.js +78 -0
  15. package/out/src/browser/binds/targets.d.ts +64 -0
  16. package/out/src/browser/binds/targets.js +56 -0
  17. package/out/src/browser/errors.d.ts +10 -0
  18. package/out/src/browser/errors.js +20 -0
  19. package/out/src/browser/fileinfo.d.ts +82 -0
  20. package/out/src/browser/fileinfo.js +78 -0
  21. package/{lib → out/src/browser}/index.d.ts +0 -1
  22. package/{lib → out/src}/browser/index.js +0 -1
  23. package/out/src/browser/lib.d.ts +141 -0
  24. package/out/src/browser/lib.js +126 -0
  25. package/out/src/browser/scanner.d.ts +103 -0
  26. package/out/src/browser/scanner.js +161 -0
  27. package/out/src/browser/sorting.d.ts +41 -0
  28. package/out/src/browser/sorting.js +133 -0
  29. package/out/src/browser/sourceinfo.d.ts +62 -0
  30. package/out/src/browser/sourceinfo.js +105 -0
  31. package/out/src/browser/styling.d.ts +90 -0
  32. package/{lib → out/src}/browser/styling.js +64 -37
  33. package/out/src/cli.d.ts +92 -0
  34. package/out/src/cli.js +249 -0
  35. package/out/src/config.d.ts +141 -0
  36. package/out/src/config.js +257 -0
  37. package/{lib/browser → out/src}/index.d.ts +0 -1
  38. package/{lib → out/src}/index.js +0 -1
  39. package/{lib → out/src}/lib.d.ts +1 -2
  40. package/{lib → out/src}/lib.js +1 -2
  41. package/out/src/styling.d.ts +4 -0
  42. package/out/src/styling.js +40 -0
  43. package/package.json +20 -14
  44. package/lib/bin.d.ts +0 -3
  45. package/lib/bin.d.ts.map +0 -1
  46. package/lib/bin.js +0 -4
  47. package/lib/bin.js.map +0 -1
  48. package/lib/browser/binds/index.d.ts +0 -2
  49. package/lib/browser/binds/index.d.ts.map +0 -1
  50. package/lib/browser/binds/index.js +0 -2
  51. package/lib/browser/binds/index.js.map +0 -1
  52. package/lib/browser/binds/targets.d.ts +0 -52
  53. package/lib/browser/binds/targets.d.ts.map +0 -1
  54. package/lib/browser/binds/targets.js +0 -43
  55. package/lib/browser/binds/targets.js.map +0 -1
  56. package/lib/browser/binds.d.ts +0 -22
  57. package/lib/browser/binds.d.ts.map +0 -1
  58. package/lib/browser/binds.js +0 -14
  59. package/lib/browser/binds.js.map +0 -1
  60. package/lib/browser/fileinfo.d.ts +0 -72
  61. package/lib/browser/fileinfo.d.ts.map +0 -1
  62. package/lib/browser/fileinfo.js +0 -72
  63. package/lib/browser/fileinfo.js.map +0 -1
  64. package/lib/browser/index.d.ts.map +0 -1
  65. package/lib/browser/index.js.map +0 -1
  66. package/lib/browser/lib.d.ts +0 -141
  67. package/lib/browser/lib.d.ts.map +0 -1
  68. package/lib/browser/lib.js +0 -116
  69. package/lib/browser/lib.js.map +0 -1
  70. package/lib/browser/looker.d.ts +0 -79
  71. package/lib/browser/looker.d.ts.map +0 -1
  72. package/lib/browser/looker.js +0 -89
  73. package/lib/browser/looker.js.map +0 -1
  74. package/lib/browser/plugins/git.d.ts +0 -10
  75. package/lib/browser/plugins/git.d.ts.map +0 -1
  76. package/lib/browser/plugins/git.js +0 -23
  77. package/lib/browser/plugins/git.js.map +0 -1
  78. package/lib/browser/plugins/npm.d.ts +0 -12
  79. package/lib/browser/plugins/npm.d.ts.map +0 -1
  80. package/lib/browser/plugins/npm.js +0 -70
  81. package/lib/browser/plugins/npm.js.map +0 -1
  82. package/lib/browser/plugins/vsce.d.ts +0 -10
  83. package/lib/browser/plugins/vsce.d.ts.map +0 -1
  84. package/lib/browser/plugins/vsce.js +0 -23
  85. package/lib/browser/plugins/vsce.js.map +0 -1
  86. package/lib/browser/plugins/yarn.d.ts +0 -15
  87. package/lib/browser/plugins/yarn.d.ts.map +0 -1
  88. package/lib/browser/plugins/yarn.js +0 -46
  89. package/lib/browser/plugins/yarn.js.map +0 -1
  90. package/lib/browser/sorting.d.ts +0 -31
  91. package/lib/browser/sorting.d.ts.map +0 -1
  92. package/lib/browser/sorting.js +0 -121
  93. package/lib/browser/sorting.js.map +0 -1
  94. package/lib/browser/sourcepattern.d.ts +0 -35
  95. package/lib/browser/sourcepattern.d.ts.map +0 -1
  96. package/lib/browser/sourcepattern.js +0 -56
  97. package/lib/browser/sourcepattern.js.map +0 -1
  98. package/lib/browser/styling.d.ts +0 -47
  99. package/lib/browser/styling.d.ts.map +0 -1
  100. package/lib/browser/styling.js.map +0 -1
  101. package/lib/browser/tools/index.d.ts +0 -3
  102. package/lib/browser/tools/index.d.ts.map +0 -1
  103. package/lib/browser/tools/index.js +0 -3
  104. package/lib/browser/tools/index.js.map +0 -1
  105. package/lib/browser/tools/sorting.d.ts +0 -31
  106. package/lib/browser/tools/sorting.d.ts.map +0 -1
  107. package/lib/browser/tools/sorting.js +0 -121
  108. package/lib/browser/tools/sorting.js.map +0 -1
  109. package/lib/browser/tools/styles.d.ts +0 -16
  110. package/lib/browser/tools/styles.d.ts.map +0 -1
  111. package/lib/browser/tools/styles.js +0 -116
  112. package/lib/browser/tools/styles.js.map +0 -1
  113. package/lib/cli.d.ts +0 -61
  114. package/lib/cli.d.ts.map +0 -1
  115. package/lib/cli.js +0 -165
  116. package/lib/cli.js.map +0 -1
  117. package/lib/config.d.ts +0 -134
  118. package/lib/config.d.ts.map +0 -1
  119. package/lib/config.js +0 -142
  120. package/lib/config.js.map +0 -1
  121. package/lib/git.d.ts +0 -13
  122. package/lib/git.d.ts.map +0 -1
  123. package/lib/git.js +0 -37
  124. package/lib/git.js.map +0 -1
  125. package/lib/index.d.ts.map +0 -1
  126. package/lib/index.js.map +0 -1
  127. package/lib/lib.d.ts.map +0 -1
  128. package/lib/lib.js.map +0 -1
  129. package/lib/plugins/git.d.ts +0 -9
  130. package/lib/plugins/git.js +0 -22
  131. package/lib/plugins/git.js.map +0 -1
  132. package/lib/plugins/npm.d.ts +0 -12
  133. package/lib/plugins/npm.js +0 -74
  134. package/lib/plugins/npm.js.map +0 -1
  135. package/lib/plugins/vsce.d.ts +0 -9
  136. package/lib/plugins/vsce.js +0 -22
  137. package/lib/plugins/vsce.js.map +0 -1
  138. package/lib/plugins/yarn.d.ts +0 -15
  139. package/lib/plugins/yarn.js +0 -50
  140. package/lib/plugins/yarn.js.map +0 -1
  141. package/lib/tools/index.d.ts +0 -3
  142. package/lib/tools/index.js +0 -4
  143. package/lib/tools/index.js.map +0 -1
  144. package/lib/tools/methods.d.ts +0 -16
  145. package/lib/tools/methods.js +0 -81
  146. package/lib/tools/methods.js.map +0 -1
  147. package/lib/tools/sorting.d.ts +0 -30
  148. package/lib/tools/sorting.js +0 -121
  149. package/lib/tools/sorting.js.map +0 -1
  150. package/lib/tools/styles.d.ts +0 -15
  151. package/lib/tools/styles.js +0 -123
  152. package/lib/tools/styles.js.map +0 -1
  153. package/lib/util/index.d.ts +0 -3
  154. package/lib/util/index.js +0 -4
  155. package/lib/util/index.js.map +0 -1
  156. package/lib/util/presets.d.ts +0 -24
  157. package/lib/util/presets.js +0 -129
  158. package/lib/util/presets.js.map +0 -1
  159. package/lib/util/sorting.d.ts +0 -30
  160. package/lib/util/sorting.js +0 -121
  161. package/lib/util/sorting.js.map +0 -1
  162. package/lib/util/styles.d.ts +0 -8
  163. package/lib/util/styles.js +0 -52
  164. package/lib/util/styles.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version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"./styling.js";
2
- import path from "path";
3
- /**
4
- * The result of the file path scan.
5
- */
6
- export class FileInfo {
7
- constructor(
8
- /**
9
- * Relative path to the file.
10
- */
11
- filePath,
12
- /**
13
- * Parser instance. Can be used to determine if the file is ignored.
14
- * @see {@link ignored} can be used instead of it.
15
- */
16
- looker,
17
- /**
18
- * Source of patterns, used by {@link looker}.
19
- */
20
- source) {
21
- this.filePath = filePath;
22
- this.looker = looker;
23
- this.source = source;
24
- }
25
- /**
26
- * Determines if ignored file is ignored or not.
27
- */
28
- get ignored() {
29
- return this.looker.ignores(this.filePath);
30
- }
31
- static from(arg, looker, source) {
32
- if (Array.isArray(arg)) {
33
- return arg.map(path => FileInfo.from(path, looker, source));
34
- }
35
- const src = typeof source === "object" ? source : { path: '<no-source>', content: source !== null && source !== void 0 ? source : '' };
36
- return new FileInfo(arg, looker, src);
37
- }
38
- /**
39
- * @param options Styling options. Default `{}`.
40
- * @param formatEntire Determines if the path's base or the entire path should be formatted. Default `true`.
41
- * @returns Relative file path. Optionally formatted.
42
- */
43
- toString(options = {}, formatEntire = true) {
44
- const { styleName, usePrefix = false, chalk } = options;
45
- const parsed = path.parse(this.filePath);
46
- const fileIcon = styleConditionFile(styleName, this.filePath);
47
- const prefix = usePrefix ? (this.ignored ? '!' : '+') : '';
48
- if (chalk) {
49
- const clr = chalk[this.ignored ? "red" : "green"];
50
- if (formatEntire) {
51
- return fileIcon + clr(prefix + this.filePath);
52
- }
53
- return parsed.dir + '/' + fileIcon + clr(prefix + parsed.base);
54
- }
55
- if (formatEntire) {
56
- return prefix + this.filePath;
57
- }
58
- return parsed.dir + '/' + fileIcon + prefix + parsed.base;
59
- }
60
- /**
61
- * @param filter The group name.
62
- * @returns `true` if the file is contained by the filter.
63
- */
64
- isIncludedBy(filter) {
65
- const filterIgnore = (filter === "ignored") && this.ignored;
66
- const filterInclude = (filter === "included") && !this.ignored;
67
- const filterAll = filter === "all";
68
- const result = filterIgnore || filterInclude || filterAll;
69
- return result;
70
-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,GAAG,YAAY,IAAI,aAAa,IAAI,SAAS,CAAA;QACzD,OAAO,MAAM,CAAA;IACd,CAAC;CACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,UAAU,CAAA;AACvC,eAAe,WAAW,CAAA;AAC1B,cAAc,UAAU,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,UAAU,CAAA;AACvC,eAAe,WAAW,CAAA;AAC1B,cAAc,UAAU,CAAA"}
@@ -1,141 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { Looker, PatternType } from "./looker.js";
3
- import FastGlob from "fast-glob";
4
- import { FileInfo } from "./fileinfo.js";
5
- import { SourcePattern } from "./sourcepattern.js";
6
- export * from "./looker.js";
7
- export * from "./fileinfo.js";
8
- export * from "./sourcepattern.js";
9
- export * as Styling from "./styling.js";
10
- export * as Sorting from "./sorting.js";
11
- export * as Binding from "./binds/index.js";
12
- import "./plugins/git.js";
13
- import "./plugins/npm.js";
14
- import "./plugins/vsce.js";
15
- import "./plugins/yarn.js";
16
- export declare const filterNameList: readonly ["ignored", "included", "all"];
17
- export type FilterName = typeof filterNameList[number];
18
- export interface FileSystemAdapter extends FastGlob.FileSystemAdapter {
19
- readFileSync: (path: string) => Buffer;
20
- }
21
- /**
22
- * The data passed to {@link ScanMethod}.
23
- * @todo Rename -> ScanMethodData.
24
- */
25
- export interface LookMethodData {
26
- /**
27
- * The {@link Looker} instance with parsed patterns.
28
- */
29
- looker: Looker;
30
- /**
31
- * The path to the target file.
32
- */
33
- filePath: string;
34
- /**
35
- * The information about where the patterns were taken from.
36
- */
37
- sourceFile: SourceFile;
38
- }
39
- /**
40
- * Also can write rules to the {@link Looker}.
41
- * @returns `true` if the given source is valid.
42
- */
43
- export type ScanMethod = (data: LookMethodData) => boolean;
44
- /**
45
- * Contains file path and content.
46
- */
47
- export interface SourceFile {
48
- /**
49
- * The source file path.
50
- */
51
- path: string;
52
- /**
53
- * The source file content.
54
- */
55
- content: string;
56
- }
57
- /**
58
- * Represents the methodology for reading the target source.
59
- */
60
- export interface Source {
61
- /**
62
- * Git configuration property.
63
- * @see Official git documentation: {@link https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreignoreCase|ignorecase}.
64
- * @default false
65
- */
66
- ignoreCase?: boolean;
67
- /**
68
- * Additional patterns, which will be used as
69
- * other patterns in the `.gitignore` file, or `package.json` "files" property.
70
- * @default []
71
- */
72
- addPatterns?: string[];
73
- /**
74
- * First valid source will be used as {@link Looker}.
75
- */
76
- sources: SourceFile[] | SourcePattern;
77
- /**
78
- * Pattern parser name.
79
- */
80
- patternType: PatternType;
81
- /**
82
- * Scanner function. Should return `true` if the given source is valid.
83
- */
84
- method: ScanMethod;
85
- }
86
- /**
87
- * File scanning options.
88
- * @see {@link LookFolderOptions}
89
- */
90
- export interface ScanFileOptions {
91
- /**
92
- * Custom implementation of methods for working with the file system.
93
- * @default fs.*
94
- */
95
- fs?: FileSystemAdapter;
96
- /**
97
- * The current working directory in which to search.
98
- * @default process.cwd()
99
- */
100
- cwd?: string;
101
- /**
102
- * Specifies the maximum number of concurrent requests from a reader to read
103
- * directories.
104
- * @default os.cpus().length
105
- */
106
- concurrency?: number;
107
- /**
108
- * Specifies the maximum depth of a read directory relative to the start
109
- * directory.
110
- * @default Infinity
111
- */
112
- deep?: number;
113
- }
114
- /**
115
- * Folder deep scanning options.
116
- * @see {@link ScanFileOptions}
117
- * @todo Rename -> ScanFolderOptions
118
- */
119
- export interface LookFolderOptions extends ScanFileOptions {
120
- /**
121
- * Filter output.
122
- * @default "included"
123
- */
124
- filter?: FilterName;
125
- }
126
- /**
127
- * Gets info about the file: it is ignored or not.
128
- * @returns `undefined` if the source is bad.
129
- */
130
- export declare function scanFile(filePath: string, sources: Source[], options: ScanFileOptions): Promise<FileInfo | undefined>;
131
- /**
132
- * Scans project directory paths to determine whether they are being ignored.
133
- */
134
- export declare function scanPaths(allFilePaths: string[], sources: Source[], options: LookFolderOptions): Promise<FileInfo[] | undefined>;
135
- export declare function scanPaths(allFilePaths: string[], target: string, options: LookFolderOptions): Promise<FileInfo[] | undefined>;
136
- /**
137
- * Scans project directory paths to determine whether they are being ignored.
138
- */
139
- export declare function scanProject(sources: Source[], options: LookFolderOptions): Promise<FileInfo[] | undefined>;
140
- export declare function scanProject(target: string, options: LookFolderOptions): Promise<FileInfo[] | undefined>;
141
- //# sourceMappingURL=lib.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/browser/lib.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAkB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnE,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAG3C,OAAO,kBAAkB,CAAA;AACzB,OAAO,kBAAkB,CAAA;AACzB,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAG1B,eAAO,MAAM,cAAc,yCAA0C,CAAA;AACrE,MAAM,MAAM,UAAU,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAA;AAEtD,MAAM,WAAW,iBAAkB,SAAQ,QAAQ,CAAC,iBAAiB;IACpE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;C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SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAA;AACvI,wBAAsB,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAA;AAkDpI;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAA;AAC3G,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAA"}
@@ -1,116 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Looker } from "./looker.js";
11
- import { FileInfo } from "./fileinfo.js";
12
- import { findDomination, SourcePattern } from "./sourcepattern.js";
13
- import { targetGet } from "./binds/index.js";
14
- export * from "./looker.js";
15
- export * from "./fileinfo.js";
16
- export * from "./sourcepattern.js";
17
- export * as Styling from "./styling.js";
18
- export * as Sorting from "./sorting.js";
19
- export * as Binding from "./binds/index.js";
20
- //#region default binds
21
- import "./plugins/git.js";
22
- import "./plugins/npm.js";
23
- import "./plugins/vsce.js";
24
- import "./plugins/yarn.js";
25
- //#endregion
26
- export const filterNameList = ["ignored", "included", "all"];
27
- /**
28
- * Gets info about the file: it is ignored or not.
29
- * @returns `undefined` if the source is bad.
30
- */
31
- export function scanFile(filePath, sources, options) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- for (const source of sources) {
34
- const looker = new Looker({
35
- addPatterns: source.addPatterns,
36
- ignoreCase: source.ignoreCase,
37
- patternType: source.patternType,
38
- });
39
- const sources = source.sources instanceof SourcePattern
40
- ? yield source.sources.read(options)
41
- : source.sources;
42
- for (const file of sources) {
43
- const l = looker.clone();
44
- const isGoodSource = source.method({
45
- sourceFile: file,
46
- filePath: filePath,
47
- looker: l
48
- });
49
- if (isGoodSource) {
50
- return FileInfo.from(filePath, l, file);
51
- }
52
- }
53
- }
54
- });
55
- }
56
- export function scanPaths(allFilePaths, arg2, options) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- var _a;
59
- if (typeof arg2 === "string") {
60
- const bind = targetGet(arg2);
61
- if (bind === undefined) {
62
- throw TypeError(`view-ignored can not find target '${arg2}'`);
63
- }
64
- return scanPaths(allFilePaths, bind.sources, (_a = bind.scanOptions) !== null && _a !== void 0 ? _a : {});
65
- }
66
- const { filter = "included" } = options;
67
- /** Contains parsed sources: file path = parser instance. */
68
- const cache = new Map();
69
- // Find good source.
70
- for (const source of arg2) {
71
- let goodFound = false;
72
- const resultList = [];
73
- const sourceList = source.sources instanceof SourcePattern
74
- ? yield source.sources.read(options)
75
- : source.sources;
76
- for (const filePath of allFilePaths) {
77
- const possibleSource = findDomination(filePath, sourceList);
78
- if (!possibleSource) {
79
- break;
80
- }
81
- const looker = cache.get(possibleSource.path);
82
- let info;
83
- if (!looker) {
84
- const newInfo = yield scanFile(filePath, [source], options);
85
- if (!newInfo) {
86
- break;
87
- }
88
- info = newInfo;
89
- cache.set(possibleSource.path, info.looker);
90
- }
91
- else {
92
- info = FileInfo.from(filePath, looker, possibleSource);
93
- }
94
- const shouldPush = info.isIncludedBy(filter);
95
- if (shouldPush) {
96
- resultList.push(info);
97
- }
98
- goodFound = true;
99
- }
100
- if (goodFound) {
101
- return resultList;
102
- }
103
- }
104
- });
105
- }
106
- export function scanProject(arg, options) {
107
- return __awaiter(this, void 0, void 0, function* () {
108
- const paths = yield new SourcePattern("**").scan(options);
109
- if (typeof arg === "string") {
110
- return yield scanPaths(paths, arg, options);
111
- }
112
- return yield scanPaths(paths, arg, options);
113
- });
114
- }
115
- //#endregion
116
- //# sourceMappingURL=lib.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/browser/lib.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAE3C,uBAAuB;AACvB,OAAO,kBAAkB,CAAA;AACzB,OAAO,kBAAkB,CAAA;AACzB,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,YAAY;AAEZ,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAU,CAAA;AAiIrE;;;GAGG;AACH,MAAM,UAAgB,QAAQ,CAAC,QAAgB,EAAE,OAAiB,EAAE,OAAwB;;QAC3F,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAI,MAAM,CA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AAG,IAAI,CAAA;YACjB,CAAC;YACD,IAAI,SAAS,EAAE,CAAC;gBACf,OAAO,UAAU,CAAA;YAClB,CAAC;QACF,CAAC;IACF,CAAC;CAAA;AAOD,MAAM,UAAgB,WAAW,CAAC,GAAsB,EAAE,OAA0B;;QACnF,MAAM,KAAK,GAAG,MAAM,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,MAAM,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,MAAM,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CAAA;AACD,YAAY"}
@@ -1,79 +0,0 @@
1
- /**
2
- * Supported matchers/parsers by {@link Looker}.
3
- */
4
- export type PatternType = ".*ignore" | "minimatch";
5
- export interface LookerOptions {
6
- /**
7
- * @see {@link Looker.isNegated}
8
- */
9
- negated?: boolean;
10
- /**
11
- * The parser for the patterns.
12
- */
13
- patternType?: PatternType;
14
- /**
15
- * Git configuration property.
16
- * @see {@link https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreignoreCase|git-config ignorecase}.
17
- * @default false
18
- */
19
- ignoreCase?: boolean;
20
- /**
21
- * Additional patterns, which will be used as
22
- * other patterns in the `.gitignore` file, or `package.json` "files" property.
23
- * @default []
24
- */
25
- addPatterns?: string[];
26
- }
27
- /**
28
- * The Glob-like pattern of the specific matcher.
29
- */
30
- export type LookerPattern = string | string[];
31
- /**
32
- * The pattern parser. Can check if the file path is ignored.
33
- */
34
- export declare class Looker {
35
- /**
36
- * If `true`, when calling {@link Looker.ignores}, method will return `true` for ignored path.
37
- * @default false
38
- */
39
- isNegated: boolean;
40
- /**
41
- * Defines way to check paths.
42
- * @default ".*ignore"
43
- */
44
- patternType: PatternType;
45
- /**
46
- * Git configuration property.
47
- * @see {@link https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreignoreCase|git-config ignorecase}.
48
- * @default false
49
- */
50
- readonly ignoreCase: boolean;
51
- private patternList;
52
- private ignoreInstance;
53
- constructor(options?: LookerOptions);
54
- /**
55
- * Clone instance.
56
- */
57
- clone(): Looker;
58
- /**
59
- * Invert checking for the {@link add} method.
60
- */
61
- negate(): this;
62
- /**
63
- * Adds new ignore rule.
64
- * @param pattern .gitignore file specification pattern.
65
- */
66
- add(pattern: LookerPattern): this;
67
- /**
68
- * Checks if the Looker should ignore dir entry path.
69
- * @see {@link Looker.isNegated} can change the return value.
70
- * @param path Dir entry path.
71
- */
72
- ignores(path: string): boolean;
73
- /**
74
- * Checks if given pattern is valid.
75
- * @param pattern Dir entry path.
76
- */
77
- isValidPattern(pattern: LookerPattern): boolean;
78
- }
79
- //# sourceMappingURL=looker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"looker.d.ts","sourceRoot":"","sources":["../../src/browser/looker.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,WAAW,CAAA;AAElD,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IAEzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AAE7C;;GAEG;AACH,qBAAa,MAAM;IAClB;;;OAGG;IACI,SAAS,EAAE,OAAO,CAAA;IAEzB;;;OAGG;IACI,WAAW,EAAE,WAAW,CAAA;IAE/B;;;;OAIG;IACH,SAAgB,UAAU,EAAE,OAAO,CAAA;IACnC,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,cAAc,CAAQ;gBAElB,OAAO,CAAC,EAAE,aAAa;IAQnC;;OAEG;IACH,KAAK,IAAI,MAAM;IASf;;OAEG;IACH,MAAM,IAAI,IAAI;IAKd;;;OAGG;IACH,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAajC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAU9B;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;CAiB/C"}
@@ -1,89 +0,0 @@
1
- import ignore from "ignore";
2
- import { minimatch } from "minimatch";
3
- /**
4
- * The pattern parser. Can check if the file path is ignored.
5
- */
6
- export class Looker {
7
- constructor(options) {
8
- var _a, _b, _c, _d;
9
- this.patternList = [];
10
- this.isNegated = (_a = options === null || options === void 0 ? void 0 : options.negated) !== null && _a !== void 0 ? _a : false;
11
- this.patternType = (_b = options === null || options === void 0 ? void 0 : options.patternType) !== null && _b !== void 0 ? _b : ".*ignore";
12
- this.ignoreCase = (_c = options === null || options === void 0 ? void 0 : options.ignoreCase) !== null && _c !== void 0 ? _c : false;
13
- this.ignoreInstance = ignore.default(options);
14
- this.add((_d = options === null || options === void 0 ? void 0 : options.addPatterns) !== null && _d !== void 0 ? _d : []);
15
- }
16
- /**
17
- * Clone instance.
18
- */
19
- clone() {
20
- const cloned = new Looker({
21
- addPatterns: this.patternList,
22
- negated: this.isNegated,
23
- patternType: this.patternType,
24
- });
25
- return cloned;
26
- }
27
- /**
28
- * Invert checking for the {@link add} method.
29
- */
30
- negate() {
31
- this.isNegated = !this.isNegated;
32
- return this;
33
- }
34
- /**
35
- * Adds new ignore rule.
36
- * @param pattern .gitignore file specification pattern.
37
- */
38
- add(pattern) {
39
- if (typeof pattern === "string") {
40
- this.patternList.push(pattern);
41
- this.ignoreInstance.add(pattern);
42
- }
43
- else {
44
- for (const pat of pattern) {
45
- this.patternList.push(pat);
46
- this.ignoreInstance.add(pat);
47
- }
48
- }
49
- return this;
50
- }
51
- /**
52
- * Checks if the Looker should ignore dir entry path.
53
- * @see {@link Looker.isNegated} can change the return value.
54
- * @param path Dir entry path.
55
- */
56
- ignores(path) {
57
- let ignores;
58
- if (this.patternType === ".*ignore") {
59
- ignores = this.ignoreInstance.ignores(path);
60
- }
61
- else { // minimatch
62
- ignores = this.patternList.some(pattern => minimatch(path, pattern));
63
- }
64
- return this.isNegated ? !ignores : ignores;
65
- }
66
- /**
67
- * Checks if given pattern is valid.
68
- * @param pattern Dir entry path.
69
- */
70
- isValidPattern(pattern) {
71
- if (Array.isArray(pattern)) {
72
- return pattern.every(p => ignore.default.isPathValid(p));
73
- }
74
- if (this.patternType === ".*ignore") {
75
- return ignore.default.isPathValid(pattern);
76
- }
77
- if (this.patternType === "minimatch") {
78
- try {
79
- minimatch.makeRe(pattern);
80
- return true;
81
- }
82
- catch (error) {
83
- return false;
84
- }
85
- }
86
- throw new TypeError(`Unknown pattern type '${this.patternType}'.`);
87
- }
88
- }
89
- //# sourceMappingURL=looker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"looker.js","sourceRoot":"","sources":["../../src/browser/looker.ts"],"names":[],"mappings":"AAAA,OAAO,MAAkB,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAsCrC;;GAEG;AACH,MAAM,OAAO,MAAM;IAsBlB,YAAY,OAAuB;;QAH3B,gBAAW,GAAa,EAAE,CAAA;QAIjC,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,KAAK,CAAA;QAC1C,IAAI,CAAC,WAAW,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,mCAAI,UAAU,CAAA;QACrD,IAAI,CAAC,UAAU,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,mCAAI,KAAK,CAAA;QAC9C,IAAI,CAAC,cAAc,GAAG,MAAM,CA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I,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;QACrE,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,cAAc,CAAC,OAAsB;QACpC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;QACzD,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;YACrC,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAC3C,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YACtC,IAAI,CAAC;gBACJ,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;gBACzB,OAAO,IAAI,CAAA;YACZ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,KAAK,CAAA;YACb,CAAC;QACF,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,yBAAyB,IAAI,CAAC,WAAW,IAAI,CAAC,CAAA;IACnE,CAAC;CACD"}
@@ -1,10 +0,0 @@
1
- import { Binding, ScanMethod, Source } from "../index.js";
2
- export declare const id = "git";
3
- export declare const name = "Git";
4
- export declare const check = "git ls-tree -r <git-branch-name> --name-only";
5
- export declare const addPatternsExclude: string[];
6
- export declare const method: ScanMethod;
7
- export declare const sources: Source[];
8
- declare const bind: Binding.TargetBind;
9
- export default bind;
10
- //# sourceMappingURL=git.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../src/browser/plugins/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAiB,MAAM,aAAa,CAAA;AAExE,eAAO,MAAM,EAAE,QAAQ,CAAA;AACvB,eAAO,MAAM,IAAI,QAAQ,CAAA;AACzB,eAAO,MAAM,KAAK,iDAAiD,CAAA;AAEnE,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAGtC,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,UAOpB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,MAAM,EAE3B,CAAA;AAED,QAAA,MAAM,IAAI,EAAE,OAAO,CAAC,UAAqD,CAAA;AAEzE,eAAe,IAAI,CAAA"}
@@ -1,23 +0,0 @@
1
- import { Binding, SourcePattern } from "../index.js";
2
- export const id = "git";
3
- export const name = "Git";
4
- export const check = `git ls-tree -r <git-branch-name> --name-only`;
5
- export const addPatternsExclude = [
6
- "**/.git/**",
7
- "**/.DS_Store/**"
8
- ];
9
- export const method = function (data) {
10
- const { looker, sourceFile: source } = data;
11
- if (!looker.isValidPattern(source.content)) {
12
- return false;
13
- }
14
- looker.add(source.content);
15
- return true;
16
- };
17
- export const sources = [
18
- { sources: new SourcePattern("**/.gitignore"), patternType: ".*ignore", method, addPatterns: addPatternsExclude },
19
- ];
20
- const bind = { id, name, sources, testCommad: check };
21
- Binding.targetSet(bind);
22
- export default bind;
23
- //# sourceMappingURL=git.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../../src/browser/plugins/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsB,aAAa,EAAE,MAAM,aAAa,CAAA;AAExE,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,CAAA;AACvB,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAA;AACzB,MAAM,CAAC,MAAM,KAAK,GAAG,8CAA8C,CAAA;AAEnE,MAAM,CAAC,MAAM,kBAAkB,GAAa;IACxC,YAAY;IACZ,iBAAiB;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAe,UAAU,IAAI;IAC5C,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC3C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,OAAO,KAAK,CAAA;IAChB,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC1B,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAa;IAC7B,EAAE,OAAO,EAAE,IAAI,aAAa,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE;CACpH,CAAA;AAED,MAAM,IAAI,GAAuB,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAA;AACzE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AACvB,eAAe,IAAI,CAAA"}
@@ -1,12 +0,0 @@
1
- import { Binding, ScanMethod, Source } from "../index.js";
2
- export declare const id = "npm";
3
- export declare const name = "NPM";
4
- export declare const check = "npm pack --dry-run";
5
- export declare const addPatternsExclude: string[];
6
- export declare const addPatternsInclude: string[];
7
- export declare const methodGit: ScanMethod;
8
- export declare const methodPackageJsonFiles: ScanMethod;
9
- export declare const sources: Source[];
10
- declare const bind: Binding.TargetBind;
11
- export default bind;
12
- //# sourceMappingURL=npm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../../src/browser/plugins/npm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAiB,MAAM,aAAa,CAAA;AAGxE,eAAO,MAAM,EAAE,QAAQ,CAAA;AACvB,eAAO,MAAM,IAAI,QAAQ,CAAA;AACzB,eAAO,MAAM,KAAK,uBAAuB,CAAA;AAEzC,eAAO,MAAM,kBAAkB,UAe9B,CAAC;AACF,eAAO,MAAM,kBAAkB,UAS9B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,UAQvB,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,UAmBpC,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,MAAM,EAI3B,CAAA;AAGD,QAAA,MAAM,IAAI,EAAE,OAAO,CAAC,UAAqD,CAAA;AAEzE,eAAe,IAAI,CAAA"}