提交学习笔记专用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.4 KiB

  1. //#region src/filter.d.ts
  2. /**
  3. * A valid `picomatch` glob pattern, or array of patterns.
  4. */
  5. type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
  6. /**
  7. * Constructs a filter function which can be used to determine whether or not
  8. * certain modules should be operated upon.
  9. * @param include If `include` is omitted or has zero length, filter will return `true` by default.
  10. * @param exclude ID must not match any of the `exclude` patterns.
  11. * @param options Additional options.
  12. * @param options.resolve Optionally resolves the patterns against a directory other than `process.cwd()`.
  13. * If a `string` is specified, then the value will be used as the base directory.
  14. * Relative paths will be resolved against `process.cwd()` first.
  15. * If `false`, then the patterns will not be resolved against any directory.
  16. * This can be useful if you want to create a filter for virtual module names.
  17. */
  18. declare function createFilter(include?: FilterPattern, exclude?: FilterPattern, options?: {
  19. resolve?: string | false | null;
  20. }): (id: string | unknown) => boolean;
  21. //#endregion
  22. //#region src/path.d.ts
  23. /**
  24. * Converts path separators to forward slash.
  25. */
  26. declare function normalizePath(filename: string): string;
  27. //#endregion
  28. //#region src/utils.d.ts
  29. declare function toArray<T>(thing: readonly T[] | T | undefined | null): readonly T[];
  30. //#endregion
  31. export { FilterPattern, createFilter, normalizePath, toArray };