cspell-glob 5.12.4 → 5.13.2

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.
@@ -1,5 +1,8 @@
1
1
  import { PathInterface, GlobMatch, GlobPattern, GlobPatternWithRoot } from './GlobMatcherTypes';
2
- export declare type GlobMatchOptions = Partial<NormalizedGlobMatchOptions>;
2
+ declare type Optional<T> = {
3
+ [P in keyof T]?: T[P] | undefined;
4
+ };
5
+ export declare type GlobMatchOptions = Optional<NormalizedGlobMatchOptions>;
3
6
  export declare type MatcherMode = 'exclude' | 'include';
4
7
  interface NormalizedGlobMatchOptions {
5
8
  /**
@@ -46,7 +49,7 @@ interface NormalizedGlobMatchOptions {
46
49
  *
47
50
  * @default false
48
51
  */
49
- nobrace?: boolean;
52
+ nobrace?: boolean | undefined;
50
53
  }
51
54
  export declare class GlobMatcher {
52
55
  /**
@@ -29,15 +29,15 @@ export interface GlobPatternWithOptionalRoot {
29
29
  * The root from which the glob pattern is relative.
30
30
  * @default: options.root
31
31
  */
32
- root?: string;
32
+ root?: string | undefined;
33
33
  /**
34
34
  * Optional value useful for tracing which file a glob pattern was defined in.
35
35
  */
36
- source?: string;
36
+ source?: string | undefined;
37
37
  /**
38
38
  * Optional line number in the source
39
39
  */
40
- line?: number;
40
+ line?: number | undefined;
41
41
  }
42
42
  export interface GlobPatternWithRoot extends GlobPatternWithOptionalRoot {
43
43
  root: string;
@@ -30,9 +30,11 @@ const relRegExp = /^\.[\\/]/;
30
30
  * @param path - optional node path methods - used for testing
31
31
  */
32
32
  function fileOrGlobToGlob(fileOrGlob, root, path = Path) {
33
+ var _a;
33
34
  const pathToGlob = path.sep === '\\' ? (p) => p.replace(/\\/g, '/') : (p) => p;
34
35
  if (typeof fileOrGlob !== 'string') {
35
- return { root, ...fileOrGlob };
36
+ const useRoot = (_a = fileOrGlob.root) !== null && _a !== void 0 ? _a : root;
37
+ return { ...fileOrGlob, root: useRoot };
36
38
  }
37
39
  if (doesRootContainPath(root, fileOrGlob, path) || relRegExp.test(fileOrGlob)) {
38
40
  const rel = path.relative(root, path.resolve(root, fileOrGlob));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-glob",
3
- "version": "5.12.4",
3
+ "version": "5.13.2",
4
4
  "description": "Glob matcher for cspell",
5
5
  "keywords": [
6
6
  "cspell",
@@ -46,9 +46,9 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/micromatch": "^4.0.2",
49
- "@types/node": "^16.11.6",
50
- "jest": "^27.3.1",
49
+ "@types/node": "^16.11.10",
50
+ "jest": "^27.4.0",
51
51
  "rimraf": "^3.0.2"
52
52
  },
53
- "gitHead": "3e9973c39725f65141683b373ed839562f28bd94"
53
+ "gitHead": "98bce0c75dcf4328b0adc80a9014809b393c0d37"
54
54
  }