How to use the micromatch.some function in micromatch

To help you get started, we’ve selected a few micromatch 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 James-Yu / LaTeX-Workshop / src / components / manager.ts View on Github external
ioFiles.input.forEach((inputFile: string) => {
            // Drop files that are also listed as OUTPUT or should be ignored
            if (ioFiles.output.includes(inputFile) ||
                micromatch.some(inputFile, globsToIgnore, { format } as any) ||
                !fs.existsSync(inputFile)) {
                return
            }
            // Drop the current rootFile often listed as INPUT and drop any file that is already in the texFileTree
            if (baseFile === inputFile || inputFile in this.cachedContent) {
                return
            }
            if (path.extname(inputFile) === '.tex') {
                // Parse tex files as imported subfiles.
                this.cachedContent[baseFile].children.push({
                    index: Number.MAX_VALUE,
                    file: inputFile
                })
                this.parseFileAndSubs(inputFile)
            } else if (this.fileWatcher && !this.filesWatched.includes(inputFile)) {
                // Watch non-tex files.
github vueneue / vueneue / packages / @vueneue / ssr-server / lib / renderRoute.js View on Github external
module.exports = async (serverContext, ssrContext) => {
  const { ctx, spaPaths, renderer } = serverContext;

  ctx.set('content-type', 'text/html; charset=utf-8');

  // SPA route
  if (spaPaths && spaPaths.length && mm.some(ssrContext.url, spaPaths)) {
    ctx.body = spaRoute(serverContext);
    return ctx;
  }

  // SSR route
  try {
    const html = await renderer.renderToString(ssrContext);

    if (ssrContext.redirected) {
      ctx.status = ssrContext.redirected;
      return ctx;
    }

    const { errorHandler } = ssrContext.data.state;
    if (errorHandler.error) {
      ctx.status = errorHandler.statusCode || 500;
github adobe / helix-pipeline / src / html / find-embeds.js View on Github external
function embed(uri, node, whitelist = '', debug = () => {}) {
  if ((uri.scheme === 'http' || uri.scheme === 'https') && mm.some(uri.host, whitelist.split(','))) {
    const children = [{ ...node }];
    node.type = 'embed';
    node.children = children;
    node.url = URI.serialize(uri);
    if (node.value) {
      delete node.value;
    }
  } else {
    debug(`Whitelist forbids embedding of URL: ${URI.serialize(uri)}`);
  }
}
github avajs / ava / lib / globs.js View on Github external
const matches = (file, patterns) => {
	let ignore;
	({patterns, ignore} = processMatchingPatterns(patterns));
	return micromatch.some(file, patterns, {ignore});
};
github ifgyong / demo / React-native / Helloword / node_modules / metro-bundler / node_modules / sane / src / common.js View on Github external
exports.isFileIncluded = function (globs, dot, doIgnore, relativePath) {
    if (doIgnore(relativePath)) {
        return false;
    }
    return globs.length
        ? micromatch.some(relativePath, globs, {dot: dot})
        : dot || micromatch.some(relativePath, '**/*');
};
github patternplate / patternplate / packages / api / src / create-watcher.ts View on Github external
type: "change",
              payload: { file: p, contentType: Types.ContentType.Pattern }
            });
          }

          if (
            Path.basename(rel) === "pattern.json" ||
            Path.basename(rel) === "package.json"
          ) {
            next({
              type: "change",
              payload: { file: p, contentType: Types.ContentType.Pattern }
            });
          }

          if (micromatch.some(rel, docs, { matchBase: true })) {
            next({ type: "change", payload: { file: p, contentType: Types.ContentType.Doc } });
          }
        });
      })();
github amasad / sane / src / common.js View on Github external
exports.isFileIncluded = function(globs, dot, doIgnore, relativePath) {
  if (doIgnore(relativePath)) {
    return false;
  }
  return globs.length
    ? micromatch.some(relativePath, globs, { dot: dot })
    : dot || micromatch.some(relativePath, '**/*');
};

micromatch

Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.

MIT
Latest version published 2 years ago

Package Health Score

87 / 100
Full package analysis