@ontrails/regrade 1.0.0-beta.32 → 1.0.0-beta.41

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.
@@ -73,6 +73,8 @@ export interface DownstreamCollectionOptions {
73
73
  readonly extensions?: readonly string[];
74
74
  /** Root-relative path globs to skip before collection. */
75
75
  readonly exclude?: readonly string[];
76
+ /** Root-relative path globs to collect. Omit to collect all matching files. */
77
+ readonly include?: readonly string[];
76
78
  }
77
79
 
78
80
  /** Outcome of classifying a single directory entry. */
@@ -204,7 +206,15 @@ export const collectDownstreamSources = (
204
206
  options
205
207
  );
206
208
  if (classification.action === 'collect') {
207
- files.push({ absolutePath, path });
209
+ if (
210
+ options.include !== undefined &&
211
+ options.include.length > 0 &&
212
+ !matchesAnyPathGlob(path, options.include)
213
+ ) {
214
+ skipped.push({ path, reason: 'not-included-glob' });
215
+ } else {
216
+ files.push({ absolutePath, path });
217
+ }
208
218
  } else if (classification.action === 'recurse') {
209
219
  queue.push(absolutePath);
210
220
  } else {
@@ -231,6 +241,10 @@ export const collectDownstreamSourcesInput = z.object({
231
241
  .array(z.string())
232
242
  .optional()
233
243
  .describe('Directory names to skip during collection'),
244
+ include: z
245
+ .array(z.string())
246
+ .optional()
247
+ .describe('Root-relative path globs to collect'),
234
248
  root: z
235
249
  .string()
236
250
  .describe('Absolute path to the downstream repo root to scan'),
@@ -267,12 +281,13 @@ export const collectDownstreamSourcesOutput = z.object({
267
281
  export const collectDownstreamSourcesTrail = trail(
268
282
  'regrade.downstream.collect',
269
283
  {
270
- blaze: (input) => {
284
+ implementation: (input) => {
271
285
  const collection = collectDownstreamSources(input.root, {
272
286
  ...(input.extensions === undefined
273
287
  ? {}
274
288
  : { extensions: input.extensions }),
275
289
  ...(input.exclude === undefined ? {} : { exclude: input.exclude }),
290
+ ...(input.include === undefined ? {} : { include: input.include }),
276
291
  ...(input.ignoredDirectories === undefined
277
292
  ? {}
278
293
  : { ignoredDirectories: input.ignoredDirectories }),