gurkencheck 0.0.7 → 0.0.9
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/README.md +19 -0
- package/dist/config-parser.d.ts.map +1 -1
- package/dist/config-parser.js +7 -1
- package/dist/config-parser.js.map +1 -1
- package/dist/diagnostics.d.ts +34 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +53 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/feature-finder.d.ts +38 -0
- package/dist/feature-finder.d.ts.map +1 -1
- package/dist/feature-finder.js +86 -8
- package/dist/feature-finder.js.map +1 -1
- package/dist/formatters/index.d.ts +44 -4
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +52 -15
- package/dist/formatters/index.js.map +1 -1
- package/dist/formatters/stylish.d.ts +3 -0
- package/dist/formatters/stylish.d.ts.map +1 -1
- package/dist/formatters/stylish.js +32 -1
- package/dist/formatters/stylish.js.map +1 -1
- package/dist/formatters/tap.d.ts +14 -0
- package/dist/formatters/tap.d.ts.map +1 -1
- package/dist/formatters/tap.js +22 -7
- package/dist/formatters/tap.js.map +1 -1
- package/dist/gherkin/parse.d.ts +42 -1
- package/dist/gherkin/parse.d.ts.map +1 -1
- package/dist/gherkin/parse.js +68 -3
- package/dist/gherkin/parse.js.map +1 -1
- package/dist/index.d.ts +18 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/linter.d.ts +31 -3
- package/dist/linter.d.ts.map +1 -1
- package/dist/linter.js +82 -15
- package/dist/linter.js.map +1 -1
- package/dist/logger.d.ts +2 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +4 -0
- package/dist/logger.js.map +1 -1
- package/dist/main.d.ts +9 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +147 -26
- package/dist/main.js.map +1 -1
- package/dist/rules/no-dupe-feature-names.d.ts.map +1 -1
- package/dist/rules/no-dupe-feature-names.js +26 -13
- package/dist/rules/no-dupe-feature-names.js.map +1 -1
- package/dist/rules/no-dupe-file-names.d.ts.map +1 -1
- package/dist/rules/no-dupe-file-names.js +32 -17
- package/dist/rules/no-dupe-file-names.js.map +1 -1
- package/dist/rules/no-dupe-scenario-names.d.ts.map +1 -1
- package/dist/rules/no-dupe-scenario-names.js +34 -22
- package/dist/rules/no-dupe-scenario-names.js.map +1 -1
- package/dist/rules.d.ts +41 -3
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +112 -4
- package/dist/rules.js.map +1 -1
- package/dist/stats/collect.d.ts +8 -0
- package/dist/stats/collect.d.ts.map +1 -1
- package/dist/stats/collect.js +67 -37
- package/dist/stats/collect.js.map +1 -1
- package/dist/stats/command.d.ts +2 -1
- package/dist/stats/command.d.ts.map +1 -1
- package/dist/stats/command.js +34 -34
- package/dist/stats/command.js.map +1 -1
- package/dist/types.d.ts +47 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/util/glob.d.ts +18 -0
- package/dist/util/glob.d.ts.map +1 -1
- package/dist/util/glob.js +126 -22
- package/dist/util/glob.js.map +1 -1
- package/dist/util/stream.d.ts +31 -0
- package/dist/util/stream.d.ts.map +1 -0
- package/dist/util/stream.js +67 -0
- package/dist/util/stream.js.map +1 -0
- package/dist/watch.d.ts +36 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +203 -0
- package/dist/watch.js.map +1 -0
- package/package.json +1 -1
package/dist/util/glob.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/util/glob.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA8DpD;
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/util/glob.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA8DpD;AAgCD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,CAE7E;AAsFD,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AA0DD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,EAAE,CAsB7E;AAED;;;;;;;;;;GAUG;AACH,wBAAuB,UAAU,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,WAAgB,GACxB,cAAc,CAAC,MAAM,CAAC,CAsBxB"}
|
package/dist/util/glob.js
CHANGED
|
@@ -109,19 +109,44 @@ function staticPrefix(pattern) {
|
|
|
109
109
|
}
|
|
110
110
|
return literal.join('/');
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* The directory a pattern's search starts from - the leading run of literal
|
|
114
|
+
* segments, resolved against `cwd`. What you would watch to be told about
|
|
115
|
+
* anything the pattern could match.
|
|
116
|
+
*/
|
|
117
|
+
export function globRoot(pattern, cwd = process.cwd()) {
|
|
118
|
+
return path.resolve(cwd, staticPrefix(pattern.split(path.sep).join('/')));
|
|
119
|
+
}
|
|
112
120
|
function isHidden(name) {
|
|
113
121
|
return name.startsWith('.');
|
|
114
122
|
}
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Orders the entries of a directory so that walking depth-first reaches files
|
|
125
|
+
* in the same order that sorting the finished paths would.
|
|
126
|
+
*
|
|
127
|
+
* Everything inside a directory `d` has a path starting `d/`, so `d` has to
|
|
128
|
+
* be ordered as `d/` rather than as `d`. Otherwise a sibling file called
|
|
129
|
+
* `d-1.feature` comes after the directory here and before it in a sorted
|
|
130
|
+
* list, because `-` sorts before `/` - and a walk that hands files over as it
|
|
131
|
+
* finds them would quietly report them in a different order from one that
|
|
132
|
+
* collects and sorts.
|
|
133
|
+
*/
|
|
134
|
+
function byPathOrder(a, b) {
|
|
135
|
+
const left = a.isDirectory() ? `${a.name}/` : a.name;
|
|
136
|
+
const right = b.isDirectory() ? `${b.name}/` : b.name;
|
|
137
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
138
|
+
}
|
|
139
|
+
function readEntries(directory) {
|
|
117
140
|
try {
|
|
118
|
-
|
|
141
|
+
return fs.readdirSync(directory, { withFileTypes: true }).sort(byPathOrder);
|
|
119
142
|
}
|
|
120
143
|
catch {
|
|
121
144
|
// A missing or unreadable directory simply contributes no matches.
|
|
122
|
-
return;
|
|
145
|
+
return [];
|
|
123
146
|
}
|
|
124
|
-
|
|
147
|
+
}
|
|
148
|
+
function walk(directory, onFile) {
|
|
149
|
+
for (const entry of readEntries(directory)) {
|
|
125
150
|
if (isHidden(entry.name)) {
|
|
126
151
|
continue;
|
|
127
152
|
}
|
|
@@ -134,6 +159,43 @@ function walk(directory, onFile) {
|
|
|
134
159
|
}
|
|
135
160
|
}
|
|
136
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* The same walk, handing each file over as it is reached.
|
|
164
|
+
*
|
|
165
|
+
* Each directory is still read synchronously. `fs.promises.readdir` was tried
|
|
166
|
+
* and is about 40% slower over a tree of a couple of thousand directories -
|
|
167
|
+
* a promise for each directory costs more than reading it does - and it
|
|
168
|
+
* bought nothing, because the only thing waiting on this walk is the work
|
|
169
|
+
* being fed by it. What matters is that the walk is no longer one long block:
|
|
170
|
+
* it gives way at every file, and the reading and checking downstream happen
|
|
171
|
+
* in the gaps.
|
|
172
|
+
*/
|
|
173
|
+
async function* walkStream(root) {
|
|
174
|
+
// An explicit stack rather than recursion: a recursive async generator
|
|
175
|
+
// delegates through one `yield*` per level of nesting for every file it
|
|
176
|
+
// hands over, so a deep tree pays for its depth on every single file.
|
|
177
|
+
const stack = [{ directory: root, entries: readEntries(root), index: 0 }];
|
|
178
|
+
while (stack.length > 0) {
|
|
179
|
+
const top = stack[stack.length - 1];
|
|
180
|
+
if (top.index >= top.entries.length) {
|
|
181
|
+
stack.pop();
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const entry = top.entries[top.index++];
|
|
185
|
+
if (isHidden(entry.name)) {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const absolutePath = path.join(top.directory, entry.name);
|
|
189
|
+
if (entry.isDirectory()) {
|
|
190
|
+
// Pushed so that its contents come before the entries after it here,
|
|
191
|
+
// which is what a depth-first walk means.
|
|
192
|
+
stack.push({ directory: absolutePath, entries: readEntries(absolutePath), index: 0 });
|
|
193
|
+
}
|
|
194
|
+
else if (entry.isFile()) {
|
|
195
|
+
yield absolutePath;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
137
199
|
/**
|
|
138
200
|
* True when the path, or any directory leading to it, matches one of the
|
|
139
201
|
* patterns.
|
|
@@ -156,42 +218,84 @@ function isIgnored(relativePath, ignores) {
|
|
|
156
218
|
}
|
|
157
219
|
return false;
|
|
158
220
|
}
|
|
159
|
-
|
|
160
|
-
* Returns the files matching `pattern`, as paths relative to `cwd` using
|
|
161
|
-
* forward slashes. Directories are never returned. Results are sorted.
|
|
162
|
-
*/
|
|
163
|
-
export function globSync(pattern, options = {}) {
|
|
221
|
+
function newSearch(pattern, options) {
|
|
164
222
|
const cwd = options.cwd ?? process.cwd();
|
|
165
223
|
const normalisedPattern = pattern.split(path.sep).join('/');
|
|
166
224
|
const matches = globToRegExp(normalisedPattern);
|
|
167
225
|
const ignores = (options.ignore ?? []).map((ignorePattern) => globToRegExp(ignorePattern.split(path.sep).join('/')));
|
|
168
|
-
const searchRoot = path.resolve(cwd, staticPrefix(normalisedPattern));
|
|
169
|
-
const found = [];
|
|
170
226
|
// An absolute pattern is matched against absolute paths: comparing it with
|
|
171
227
|
// a path relative to cwd can never match, and the search would come back
|
|
172
228
|
// empty rather than wrong, which reads as "nothing to report".
|
|
173
229
|
const absolutePattern = path.isAbsolute(normalisedPattern);
|
|
230
|
+
return {
|
|
231
|
+
searchRoot: path.resolve(cwd, staticPrefix(normalisedPattern)),
|
|
232
|
+
match(absolutePath) {
|
|
233
|
+
const relativePath = path.relative(cwd, absolutePath).split(path.sep).join('/');
|
|
234
|
+
const candidate = absolutePattern ? absolutePath.split(path.sep).join('/') : relativePath;
|
|
235
|
+
if (!matches.test(candidate))
|
|
236
|
+
return undefined;
|
|
237
|
+
if (isIgnored(relativePath, ignores))
|
|
238
|
+
return undefined;
|
|
239
|
+
return relativePath;
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Returns the files matching `pattern`, as paths relative to `cwd` using
|
|
245
|
+
* forward slashes. Directories are never returned. Results are sorted.
|
|
246
|
+
*/
|
|
247
|
+
export function globSync(pattern, options = {}) {
|
|
248
|
+
const search = newSearch(pattern, options);
|
|
249
|
+
const found = [];
|
|
174
250
|
const consider = (absolutePath) => {
|
|
175
|
-
const relativePath =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (isIgnored(relativePath, ignores))
|
|
180
|
-
return;
|
|
181
|
-
found.push(relativePath);
|
|
251
|
+
const relativePath = search.match(absolutePath);
|
|
252
|
+
if (relativePath !== undefined) {
|
|
253
|
+
found.push(relativePath);
|
|
254
|
+
}
|
|
182
255
|
};
|
|
183
|
-
const stats = statOrUndefined(searchRoot);
|
|
256
|
+
const stats = statOrUndefined(search.searchRoot);
|
|
184
257
|
if (stats === undefined) {
|
|
185
258
|
return [];
|
|
186
259
|
}
|
|
187
260
|
if (stats.isFile()) {
|
|
188
|
-
consider(searchRoot);
|
|
261
|
+
consider(search.searchRoot);
|
|
189
262
|
}
|
|
190
263
|
else {
|
|
191
|
-
walk(searchRoot, consider);
|
|
264
|
+
walk(search.searchRoot, consider);
|
|
192
265
|
}
|
|
193
266
|
return found.sort();
|
|
194
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* The same search, handing each match over as it is found.
|
|
270
|
+
*
|
|
271
|
+
* Collecting a whole tree before anything else starts is time in which
|
|
272
|
+
* nothing is read, parsed or checked. This hands each match over as it is
|
|
273
|
+
* reached, so the work after it starts on the first file rather than on the
|
|
274
|
+
* last.
|
|
275
|
+
*
|
|
276
|
+
* The order is the order `globSync` returns, without anything being collected
|
|
277
|
+
* to sort: `byPathOrder` is what makes the two agree.
|
|
278
|
+
*/
|
|
279
|
+
export async function* globStream(pattern, options = {}) {
|
|
280
|
+
const search = newSearch(pattern, options);
|
|
281
|
+
const stats = statOrUndefined(search.searchRoot);
|
|
282
|
+
if (stats === undefined) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (stats.isFile()) {
|
|
286
|
+
const relativePath = search.match(search.searchRoot);
|
|
287
|
+
if (relativePath !== undefined) {
|
|
288
|
+
yield relativePath;
|
|
289
|
+
}
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
for await (const absolutePath of walkStream(search.searchRoot)) {
|
|
293
|
+
const relativePath = search.match(absolutePath);
|
|
294
|
+
if (relativePath !== undefined) {
|
|
295
|
+
yield relativePath;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
195
299
|
function statOrUndefined(target) {
|
|
196
300
|
try {
|
|
197
301
|
return fs.statSync(target);
|
package/dist/util/glob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/util/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,Y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Y,CAAC;QACrB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAc;IACrC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Working through a list without starting all of it at once.
|
|
3
|
+
*/
|
|
4
|
+
/** Values to work through, however they arrive. */
|
|
5
|
+
export type Sequence<T> = Iterable<T> | AsyncIterable<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Maps over the values, keeping at most `window` results in flight, and hands
|
|
8
|
+
* each one over in the order the values were given.
|
|
9
|
+
*
|
|
10
|
+
* `Promise.all` over a list starts every one of them at once, which for a
|
|
11
|
+
* list of files means a file descriptor each and every result held in memory
|
|
12
|
+
* until the last one arrives. A window bounds both: what is held is a
|
|
13
|
+
* property of the window rather than of the length of the list.
|
|
14
|
+
*
|
|
15
|
+
* Results come back in order whatever order they finish in, so a caller that
|
|
16
|
+
* cares about the order the values were given - and the rules looking across
|
|
17
|
+
* files do - gets it without sorting anything.
|
|
18
|
+
*
|
|
19
|
+
* Stopping early stops the work: nothing beyond the window is started, what
|
|
20
|
+
* is left is dropped, and a source still producing values is closed.
|
|
21
|
+
*
|
|
22
|
+
* The values may arrive as an array or as something producing them one at a
|
|
23
|
+
* time, so a walk of a directory tree can feed this without being collected
|
|
24
|
+
* first.
|
|
25
|
+
*
|
|
26
|
+
* `map` must not reject. A result is started before anything awaits it, so a
|
|
27
|
+
* rejection would be an unhandled one rather than something the caller could
|
|
28
|
+
* catch.
|
|
29
|
+
*/
|
|
30
|
+
export declare function mapWithWindow<T, R>(values: Sequence<T>, window: number, map: (value: T) => Promise<R>): AsyncGenerator<R>;
|
|
31
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/util/stream.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mDAAmD;AACnD,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAWzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAuB,aAAa,CAAC,CAAC,EAAE,CAAC,EACvC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAC5B,cAAc,CAAC,CAAC,CAAC,CA8BnB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Working through a list without starting all of it at once.
|
|
3
|
+
*/
|
|
4
|
+
/** One iterator over either kind, so the rest need not care which it is. */
|
|
5
|
+
async function* asAsync(values) {
|
|
6
|
+
if (Symbol.asyncIterator in values) {
|
|
7
|
+
yield* values;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
yield* values;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Maps over the values, keeping at most `window` results in flight, and hands
|
|
15
|
+
* each one over in the order the values were given.
|
|
16
|
+
*
|
|
17
|
+
* `Promise.all` over a list starts every one of them at once, which for a
|
|
18
|
+
* list of files means a file descriptor each and every result held in memory
|
|
19
|
+
* until the last one arrives. A window bounds both: what is held is a
|
|
20
|
+
* property of the window rather than of the length of the list.
|
|
21
|
+
*
|
|
22
|
+
* Results come back in order whatever order they finish in, so a caller that
|
|
23
|
+
* cares about the order the values were given - and the rules looking across
|
|
24
|
+
* files do - gets it without sorting anything.
|
|
25
|
+
*
|
|
26
|
+
* Stopping early stops the work: nothing beyond the window is started, what
|
|
27
|
+
* is left is dropped, and a source still producing values is closed.
|
|
28
|
+
*
|
|
29
|
+
* The values may arrive as an array or as something producing them one at a
|
|
30
|
+
* time, so a walk of a directory tree can feed this without being collected
|
|
31
|
+
* first.
|
|
32
|
+
*
|
|
33
|
+
* `map` must not reject. A result is started before anything awaits it, so a
|
|
34
|
+
* rejection would be an unhandled one rather than something the caller could
|
|
35
|
+
* catch.
|
|
36
|
+
*/
|
|
37
|
+
export async function* mapWithWindow(values, window, map) {
|
|
38
|
+
const width = Math.max(1, Math.trunc(window));
|
|
39
|
+
const source = asAsync(values);
|
|
40
|
+
const inFlight = [];
|
|
41
|
+
let drained = false;
|
|
42
|
+
const fill = async () => {
|
|
43
|
+
while (!drained && inFlight.length < width) {
|
|
44
|
+
const next = await source.next();
|
|
45
|
+
if (next.done === true) {
|
|
46
|
+
drained = true;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
inFlight.push(map(next.value));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
await fill();
|
|
54
|
+
while (inFlight.length > 0) {
|
|
55
|
+
// Taken from the front, so the order in is the order out.
|
|
56
|
+
const result = await inFlight.shift();
|
|
57
|
+
yield result;
|
|
58
|
+
await fill();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
// Stopping early stops the source too, so a walk feeding this does not
|
|
63
|
+
// carry on over a tree nobody is going to look at.
|
|
64
|
+
await source.return(undefined);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/util/stream.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,4EAA4E;AAC5E,KAAK,SAAS,CAAC,CAAC,OAAO,CAAI,MAAmB;IAC5C,IAAI,MAAM,CAAC,aAAa,IAAI,MAAM,EAAE,CAAC;QACnC,KAAK,CAAC,CAAC,MAAM,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,KAAK,CA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
+
import type { Diagnostics } from './diagnostics.ts';
|
|
2
|
+
/** How long changes are allowed to keep arriving before a pass starts. */
|
|
3
|
+
export declare const DEFAULT_SETTLE_MS = 80;
|
|
4
|
+
export interface WatchOptions {
|
|
5
|
+
/** Where diagnostics about the watch itself go. */
|
|
6
|
+
diagnostics: Diagnostics;
|
|
7
|
+
/**
|
|
8
|
+
* How long to wait for changes to stop arriving before checking again.
|
|
9
|
+
*
|
|
10
|
+
* Saving a file is rarely one event: an editor may write, rename and
|
|
11
|
+
* change the mode, and a formatter on save adds more. Waiting for the flurry
|
|
12
|
+
* to end means one pass rather than four.
|
|
13
|
+
*/
|
|
14
|
+
settleMs?: number;
|
|
15
|
+
/** Names to take no notice of, matched against any part of the path. */
|
|
16
|
+
ignore?: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Stops the watch when it aborts.
|
|
19
|
+
*
|
|
20
|
+
* Ctrl-C stops it too. This is for a caller that is not a terminal - a test,
|
|
21
|
+
* or an editor closing the project it was watching.
|
|
22
|
+
*/
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
/** True when a change to this path could change what a run would report. */
|
|
26
|
+
export declare function isInteresting(relativePath: string, configFileName: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Runs `check` once, then again whenever something under `roots` changes,
|
|
29
|
+
* until the process is interrupted.
|
|
30
|
+
*
|
|
31
|
+
* Resolves when it is stopped, so the caller can go on to exit tidily. A pass
|
|
32
|
+
* failing does not stop the watch: the point of watching is to be told when
|
|
33
|
+
* it stops failing.
|
|
34
|
+
*/
|
|
35
|
+
export declare function watch(roots: readonly string[], configFileName: string, options: WatchOptions, check: () => Promise<unknown>): Promise<number>;
|
|
36
|
+
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAElD,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,WAAW,EAAE,WAAW,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAGnF;AAED;;;;;;;GAOG;AACH,wBAAsB,KAAK,CACzB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,CAiLjB"}
|
package/dist/watch.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checking again whenever the feature files change.
|
|
3
|
+
*
|
|
4
|
+
* This knows about watching and nothing about linting: it is handed something
|
|
5
|
+
* to run, and runs it whenever the tree underneath changes. What that
|
|
6
|
+
* something does - which formatter, which rules - is the caller's business.
|
|
7
|
+
*
|
|
8
|
+
* Every pass is a whole run. Keeping the parsed files between passes was the
|
|
9
|
+
* obvious optimisation and is the wrong trade here: the rules that look
|
|
10
|
+
* across files rebuild their state from every file anyway, so the only thing
|
|
11
|
+
* caching saves is the reading and parsing - and it saves it by holding every
|
|
12
|
+
* syntax tree in memory for as long as the process lives, which for a suite
|
|
13
|
+
* of any size is hundreds of megabytes sitting idle between keystrokes. A
|
|
14
|
+
* whole pass over a few thousand files takes well under a second, and the
|
|
15
|
+
* memory stays where a bounded read-ahead put it.
|
|
16
|
+
*/
|
|
17
|
+
import fs from 'node:fs';
|
|
18
|
+
import path from 'node:path';
|
|
19
|
+
import { EXIT_OK } from './exit-codes.js';
|
|
20
|
+
/** How long changes are allowed to keep arriving before a pass starts. */
|
|
21
|
+
export const DEFAULT_SETTLE_MS = 80;
|
|
22
|
+
/** True when a change to this path could change what a run would report. */
|
|
23
|
+
export function isInteresting(relativePath, configFileName) {
|
|
24
|
+
const name = path.basename(relativePath);
|
|
25
|
+
return relativePath.endsWith('.feature') || name === configFileName;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Runs `check` once, then again whenever something under `roots` changes,
|
|
29
|
+
* until the process is interrupted.
|
|
30
|
+
*
|
|
31
|
+
* Resolves when it is stopped, so the caller can go on to exit tidily. A pass
|
|
32
|
+
* failing does not stop the watch: the point of watching is to be told when
|
|
33
|
+
* it stops failing.
|
|
34
|
+
*/
|
|
35
|
+
export async function watch(roots, configFileName, options, check) {
|
|
36
|
+
const { diagnostics } = options;
|
|
37
|
+
const settleMs = options.settleMs ?? DEFAULT_SETTLE_MS;
|
|
38
|
+
const ignore = options.ignore ?? [];
|
|
39
|
+
const watchers = [];
|
|
40
|
+
const changed = new Set();
|
|
41
|
+
/** Set once the watch is waiting, so a watcher failing then can end it. */
|
|
42
|
+
let stopWatching;
|
|
43
|
+
let timer;
|
|
44
|
+
let running = false;
|
|
45
|
+
let againAfterThis = false;
|
|
46
|
+
const ignored = (relativePath) => ignore.some((entry) => relativePath.split(path.sep).includes(entry));
|
|
47
|
+
/**
|
|
48
|
+
* Runs a pass, and one more afterwards if anything changed while it ran.
|
|
49
|
+
* A change arriving mid-pass may or may not have been picked up, and
|
|
50
|
+
* checking twice is cheaper than being wrong about it.
|
|
51
|
+
*/
|
|
52
|
+
const runCheck = async () => {
|
|
53
|
+
if (running) {
|
|
54
|
+
againAfterThis = true;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
running = true;
|
|
58
|
+
try {
|
|
59
|
+
do {
|
|
60
|
+
againAfterThis = false;
|
|
61
|
+
try {
|
|
62
|
+
await check();
|
|
63
|
+
}
|
|
64
|
+
catch (thrown) {
|
|
65
|
+
// What is being run belongs to the caller. A pass that falls over
|
|
66
|
+
// must not end the watch, or you would have to start it again to
|
|
67
|
+
// find out you had fixed the thing that broke it.
|
|
68
|
+
diagnostics.report({
|
|
69
|
+
level: 'error',
|
|
70
|
+
message: `The check failed: ${thrown instanceof Error ? thrown.message : String(thrown)}`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
} while (againAfterThis);
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
running = false;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const schedule = () => {
|
|
80
|
+
if (timer !== undefined) {
|
|
81
|
+
clearTimeout(timer);
|
|
82
|
+
}
|
|
83
|
+
timer = setTimeout(() => {
|
|
84
|
+
timer = undefined;
|
|
85
|
+
const what = changed.size === 1 ? ([...changed][0] ?? 'a file') : `${changed.size} files`;
|
|
86
|
+
changed.clear();
|
|
87
|
+
diagnostics.report({ level: 'notice', message: `\n${what} changed - checking again` });
|
|
88
|
+
void runCheck();
|
|
89
|
+
}, settleMs);
|
|
90
|
+
// A watch should not be the reason a process stays alive once the thing
|
|
91
|
+
// it was watching for has been dealt with.
|
|
92
|
+
timer.unref?.();
|
|
93
|
+
};
|
|
94
|
+
/** Watchers still working. A watcher that gives up takes itself out. */
|
|
95
|
+
const living = new Set();
|
|
96
|
+
for (const root of roots) {
|
|
97
|
+
// Checked before watching rather than left to fs.watch, because what
|
|
98
|
+
// fs.watch does about a missing directory is not the same everywhere: it
|
|
99
|
+
// throws on some platforms and reports an error event later on others,
|
|
100
|
+
// and the second kind would leave this waiting on a watch of nothing.
|
|
101
|
+
let directory = false;
|
|
102
|
+
try {
|
|
103
|
+
directory = fs.statSync(root).isDirectory();
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
directory = false;
|
|
107
|
+
}
|
|
108
|
+
if (!directory) {
|
|
109
|
+
diagnostics.report({
|
|
110
|
+
level: 'error',
|
|
111
|
+
message: `Could not watch "${root}": it is not a directory.`,
|
|
112
|
+
});
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
const watcher = fs.watch(root, { recursive: true }, (_event, filename) => {
|
|
117
|
+
// Some platforms hand over no name; there is nothing to filter on, so
|
|
118
|
+
// check rather than risk missing a change.
|
|
119
|
+
if (filename === null) {
|
|
120
|
+
schedule();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const relativePath = filename.toString();
|
|
124
|
+
if (ignored(relativePath) || !isInteresting(relativePath, configFileName)) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
changed.add(path.basename(relativePath));
|
|
128
|
+
schedule();
|
|
129
|
+
});
|
|
130
|
+
watcher.on('error', (thrown) => {
|
|
131
|
+
// One watch giving up should not take the others with it - but if
|
|
132
|
+
// they all give up there is nothing left to wait for, and waiting
|
|
133
|
+
// anyway would be a process that never returns.
|
|
134
|
+
diagnostics.report({
|
|
135
|
+
level: 'detail',
|
|
136
|
+
message: `No longer watching "${root}": ${thrown.message}`,
|
|
137
|
+
});
|
|
138
|
+
watcher.close();
|
|
139
|
+
living.delete(watcher);
|
|
140
|
+
if (living.size === 0) {
|
|
141
|
+
stopWatching?.();
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
watchers.push(watcher);
|
|
145
|
+
living.add(watcher);
|
|
146
|
+
}
|
|
147
|
+
catch (thrown) {
|
|
148
|
+
diagnostics.report({
|
|
149
|
+
level: 'error',
|
|
150
|
+
message: `Could not watch "${root}": ${thrown instanceof Error ? thrown.message : String(thrown)}`,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (watchers.length === 0) {
|
|
155
|
+
diagnostics.report({
|
|
156
|
+
level: 'error',
|
|
157
|
+
message: 'Nothing could be watched, so there would be nothing to wait for.',
|
|
158
|
+
});
|
|
159
|
+
return EXIT_OK;
|
|
160
|
+
}
|
|
161
|
+
await runCheck();
|
|
162
|
+
diagnostics.report({
|
|
163
|
+
level: 'notice',
|
|
164
|
+
message: '\nWatching for changes. Press Ctrl-C to stop.',
|
|
165
|
+
});
|
|
166
|
+
return await new Promise((resolve) => {
|
|
167
|
+
let stopped = false;
|
|
168
|
+
const stop = () => {
|
|
169
|
+
if (stopped) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
stopped = true;
|
|
173
|
+
process.off('SIGINT', stop);
|
|
174
|
+
process.off('SIGTERM', stop);
|
|
175
|
+
options.signal?.removeEventListener('abort', stop);
|
|
176
|
+
if (timer !== undefined) {
|
|
177
|
+
clearTimeout(timer);
|
|
178
|
+
}
|
|
179
|
+
for (const watcher of watchers) {
|
|
180
|
+
watcher.close();
|
|
181
|
+
}
|
|
182
|
+
// The ^C the terminal echoed is sitting at the start of the line.
|
|
183
|
+
diagnostics.report({ level: 'notice', message: '' });
|
|
184
|
+
resolve(EXIT_OK);
|
|
185
|
+
};
|
|
186
|
+
stopWatching = stop;
|
|
187
|
+
process.on('SIGINT', stop);
|
|
188
|
+
process.on('SIGTERM', stop);
|
|
189
|
+
// A watcher may have given up while the first pass was running, in which
|
|
190
|
+
// case there is nothing left to wait for.
|
|
191
|
+
if (living.size === 0) {
|
|
192
|
+
stop();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (options.signal?.aborted === true) {
|
|
196
|
+
stop();
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
options.signal?.addEventListener('abort', stop, { once: true });
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AA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