How to use the sane.NodeWatcher function in sane

To help you get started, we’ve selected a few sane 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 jessieeeee / SimpleOne / node_modules / metro-bundler / node_modules / jest-haste-map / build / index.js View on Github external
hasteMap,
  hasteFS,
  moduleMap)
  {
    if (!this._options.watch) {
      return Promise.resolve();
    }

    // In watch mode, we'll only warn about module collisions and we'll retain
    // all files, even changes to node_modules.
    this._options.throwOnModuleCollision = false;
    this._options.retainAllFiles = true;

    const Watcher = canUseWatchman && this._options.useWatchman ?
    sane.WatchmanWatcher :
    sane.NodeWatcher;
    const extensions = this._options.extensions;
    const ignorePattern = this._options.ignorePattern;
    let changeQueue = Promise.resolve();
    let eventsQueue = [];
    // We only need to copy the entire haste map once on every "frame".
    let mustCopy = true;

    const createWatcher = root => {
      const watcher = new Watcher(root, {
        dot: false,
        glob: extensions.map(extension => '**/*.' + extension),
        ignored: ignorePattern });


      return new Promise((resolve, reject) => {
        const rejectTimeout = setTimeout(
github leecade / react-native-swiper / examples / node_modules / react-native / packager / react-packager / src / FileWatcher / index.js View on Github external
exec('which watchman', function(err, out) {
    if (err || out.length === 0) {
      resolve(sane.NodeWatcher);
    } else {
      resolve(sane.WatchmanWatcher);
    }
  });
});
github facebook / metro / react-packager / src / DependencyResolver / FileWatcher / index.js View on Github external
exec('which watchman', function(err, out) {
    if (err || out.length === 0) {
      resolve(sane.NodeWatcher);
    } else {
      resolve(sane.WatchmanWatcher);
    }
  });
});
github facebook / metro / react-packager / src / DependencyResolver / FileWatcher / index.js View on Github external
return detectingWatcherClass.then(Watcher => {
      if (!this._useWatchman) {
        Watcher = sane.NodeWatcher;
      }
      const watcher = new Watcher(rootConfig.dir, {
        glob: rootConfig.globs,
        dot: false,
      });

      return new Promise((resolve, reject) => {
        const rejectTimeout = setTimeout(
          () => reject(new Error(timeoutMessage(Watcher))),
          MAX_WAIT_TIME
        );

        watcher.once('ready', () => {
          clearTimeout(rejectTimeout);
          resolve(watcher);
        });
github facebook / metro / react-packager / src / node-haste / FileWatcher / index.js View on Github external
const detectWatcherClass = () => {
  try {
    execSync('watchman version', {stdio: 'ignore'});
    return sane.WatchmanWatcher;
  } catch (e) {}
  return sane.NodeWatcher;
};
github GertjanReynaert / react-native-universal / node_modules / react-native / packager / react-packager / src / FileWatcher / index.js View on Github external
exec('which watchman', function(err, out) {
    if (err || out.length === 0) {
      resolve(sane.NodeWatcher);
    } else {
      resolve(sane.WatchmanWatcher);
    }
  });
});

sane

Sane aims to be fast, small, and reliable file system watcher.

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis