cspell-glob 8.18.1 → 8.19.1

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,7 +1,7 @@
1
1
  import * as Path from 'node:path';
2
2
  import { FileUrlBuilder } from '@cspell/url';
3
- import mm from 'micromatch';
4
- import { GlobPatterns, isRelativeValueNested, normalizeGlobPatterns, normalizeGlobToRoot } from './globHelper.js';
3
+ import pm from 'picomatch';
4
+ import { GlobPatterns, isRelativeValueNested, normalizeGlobPatterns, normalizeGlobToRoot, workaroundPicomatchBug, } from './globHelper.js';
5
5
  const traceMode = false;
6
6
  let idGlobMatcher = 0;
7
7
  export class GlobMatcher {
@@ -95,7 +95,7 @@ function buildMatcherFn(_id, patterns, options) {
95
95
  const matchNeg = pattern.glob.match(/^!/);
96
96
  const glob = pattern.glob.replace(/^!/, '');
97
97
  const isNeg = (matchNeg && matchNeg[0].length & 1 && true) || false;
98
- const reg = mm.makeRe(glob, makeReOptions);
98
+ const reg = pm.makeRe(workaroundPicomatchBug(glob), makeReOptions);
99
99
  const fn = pattern.glob.endsWith(suffixDir)
100
100
  ? (filename) => {
101
101
  // Note: this is a hack to get around the limitations of globs.
@@ -77,6 +77,7 @@ export declare function trimGlob(glob: string): string;
77
77
  * @returns true if the glob pattern starts with `**`
78
78
  */
79
79
  declare function isGlobalGlob(glob: string): boolean;
80
+ export declare function workaroundPicomatchBug(glob: string): string;
80
81
  export declare const __testing__: {
81
82
  rebaseGlob: typeof rebaseGlob;
82
83
  trimGlob: typeof trimGlob;
@@ -435,6 +435,13 @@ function filePathOrGlobToGlob(filePathOrGlob, root, builder) {
435
435
  const url = builder.toFileDirURL(path || './', root);
436
436
  return { root: builder.urlToFilePathOrHref(url), glob, isGlobalPattern };
437
437
  }
438
+ export function workaroundPicomatchBug(glob) {
439
+ const obj = {};
440
+ return glob
441
+ .split('/')
442
+ .map((s) => (obj[s] ? `{${s},${s}}` : s))
443
+ .join('/');
444
+ }
438
445
  export const __testing__ = {
439
446
  rebaseGlob,
440
447
  trimGlob,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { fileOrGlobToGlob, isGlobPatternNormalized, isGlobPatternWithOptionalRoot, isGlobPatternWithRoot, normalizeGlobPatterns, NormalizeOptions, } from './globHelper.js';
1
+ export { fileOrGlobToGlob, isGlobPatternNormalized, isGlobPatternWithOptionalRoot, isGlobPatternWithRoot, normalizeGlobPatterns, NormalizeOptions, workaroundPicomatchBug, } from './globHelper.js';
2
2
  export { GlobMatcher, GlobMatchOptions } from './GlobMatcher.js';
3
3
  export * from './GlobMatcherTypes.js';
4
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { fileOrGlobToGlob, isGlobPatternNormalized, isGlobPatternWithOptionalRoot, isGlobPatternWithRoot, normalizeGlobPatterns, } from './globHelper.js';
1
+ export { fileOrGlobToGlob, isGlobPatternNormalized, isGlobPatternWithOptionalRoot, isGlobPatternWithRoot, normalizeGlobPatterns, workaroundPicomatchBug, } from './globHelper.js';
2
2
  export { GlobMatcher } from './GlobMatcher.js';
3
3
  export * from './GlobMatcherTypes.js';
4
4
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "provenance": true
6
6
  },
7
- "version": "8.18.1",
7
+ "version": "8.19.1",
8
8
  "description": "Glob matcher for cspell",
9
9
  "keywords": [
10
10
  "cspell",
@@ -58,11 +58,13 @@
58
58
  "node": ">=18"
59
59
  },
60
60
  "dependencies": {
61
- "@cspell/url": "8.18.1",
62
- "micromatch": "^4.0.8"
61
+ "@cspell/url": "8.19.1",
62
+ "picomatch": "^4.0.2"
63
63
  },
64
64
  "devDependencies": {
65
- "@types/micromatch": "^4.0.9"
65
+ "@types/micromatch": "^4.0.9",
66
+ "@types/picomatch": "^4.0.0",
67
+ "micromatch": "^4.0.8"
66
68
  },
67
- "gitHead": "4d647f52891c3300221ff9b2341b0474f68b30b5"
69
+ "gitHead": "66fdb8ff1cfb93b5c90c93ad7fbbcc91df39cc2b"
68
70
  }