How to use the anymatch function in anymatch

To help you get started, we’ve selected a few anymatch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zinserjan / mocha-webpack / src / cli / prepareWebpack.js View on Github external
cached: false,
      reasons: false,
      source: false,
      errorDetails: true,
      chunkOrigins: false,
      colors: options.colors,
    },
    state: false, // show bundle valid / invalid
  });

  const webpackPlugins = [webpackInfoPlugin];

  if (glob || existsDirSync(file)) {
    const globPattern = glob ? file : directoryToGlob(file, options);

    const matcher = anymatch(globPattern);
    const parent = globParent(globPattern);
    const directory = path.resolve(parent);

    const context = normalizePath(path.relative(tmpPath, directory));
    const recursive = globPattern.indexOf('**') !== -1; // or via options.recursive?

    const optionsHash = hash.MD5(options); // eslint-disable-line new-cap

    const entryFilePath = path.join(tmpPath, `${optionsHash}-entry.js`);
    const outputFilePath = path.join(tmpPath, optionsHash, `${optionsHash}-output.js`);

    function matchModule(mod) { // eslint-disable-line no-inner-declarations
      // normalize path to match glob
      const correctedPath = path.join(parent, mod);
      return matcher(correctedPath);
    }
github kaola-fed / foxman / src / Plugins / watcher / watcher.es6 View on Github external
this.watching[type].forEach((pattern, idx) => {
            if (pattern && anymatch(pattern)(path)) {
                this.handlers[type][idx](path, event, stats);
            }
        });
    }
github facebook / jest / packages / jest-haste-map / src / lib / FSEventsWatcher.ts View on Github external
) {
    if (!fsevents) {
      throw new Error(
        '`fsevents` unavailable (this watcher can only be used on Darwin)',
      );
    }

    super();

    this.dot = opts.dot || false;
    this.ignored = opts.ignored;
    this.glob = Array.isArray(opts.glob) ? opts.glob : [opts.glob];

    this.hasIgnore =
      Boolean(opts.ignored) && !(Array.isArray(opts) && opts.length > 0);
    this.doIgnore = opts.ignored ? anymatch(opts.ignored) : () => false;

    this.root = path.resolve(dir);
    this.fsEventsWatchStopper = fsevents.watch(
      this.root,
      this.handleEvent.bind(this),
    );

    this._tracked = new Set();
    FSEventsWatcher.recReaddir(
      this.root,
      (filepath: string) => {
        this._tracked.add(filepath);
      },
      (filepath: string) => {
        this._tracked.add(filepath);
      },
github appnexus / sicksync / src / util.js View on Github external
export function isExcluded(filepath, excludes) {
  return anymatch(excludes, filepath);
}
github microsoft / backfill / packages / backfill / src / audit.ts View on Github external
.on("all", (event, filePath) => {
      const logLine = `${filePath} (${event})`;
      logger.silly(`[audit] File change: ${logLine}`);

      if (!anymatch(cacheFolderGlob, filePath)) {
        changedFilesOutsideScope.push(logLine);
      } else {
        changedFilesInsideScope.push(logLine);
      }
    });
}
github facebook / jest / packages / jest-haste-map / src / lib / FSEventsWatcher.ts View on Github external
        (currentDir: string) => !ignored || !anymatch(ignored, currentDir),
      )
github beakerbrowser / beaker / app / background-process / web-apis / workspaces.js View on Github external
      opts.filter = (filepath) => anymatch(ignoreRules, filepath)
    }
github kaola-fed / foxman / src / plugins / watcher / watcher.es6 View on Github external
this.watching[type].forEach((pattern, idx) => {
			if (pattern && anymatch(pattern)(path)) {
				this.handlers[type][idx](path, event, stats);
			}
		});
	}
github intuit / auto / plugins / all-contributors / src / index.ts View on Github external
const isType = (file: string) =>
                match(this.options.types[type as Contribution] || [], file);
              const isMatch = files.some(isType);

anymatch

Matches strings against configurable strings, globs, regular expressions, and/or functions

ISC
Latest version published 10 months ago

Package Health Score

80 / 100
Full package analysis

Popular anymatch functions