watch('./', { recursive: true, filter:  FILTER }, function (evt, name) { if (evt === 'update') { compileVueToRn(name); } else if (evt === 'remove') { remove(name); } });
551632
function compileVueToRn(resource) {
  const code = resource.toString();
  const cparsed = compiler.parseComponent(code, { pad: 'line' });

  // console.log(cparsed);

  let output = '';
  let mappings = '';

  // add react-vue import
  output += `import ${constants.VUE}, { observer as ${
    constants.OBSERVER
    } } from 'vue-native-core'`;
  output += '\n';

  // // add react import
  // output += `import ${constants.REACT} from 'react'`
  // output += '\n';

  // add react-native import
  output += `import ${constants.REACT_NATIVE} from 'react-native'`;
  output += '\n';

  // add prop-type import
  output += `import ${constants.PROP_TYPE} from 'prop-types'`;
  output += '\n';

  // add component builder import
  output += `import { buildNativeComponent as ${
    constants.BUILD_COMPONENT
    } } from 'vue-native-helper'`;
  output += '\n';

  // parse template
  const template = cparsed.template;

  //Consider the start of template for debugging
  //
  let templateStartIndex = code.indexOf("<");
  let tempStringBeforeStart = code.substring(0, templateStartIndex);
  let templateLineNumber = tempStringBeforeStart.split(splitRE).length - 1;

  // Get tags and location of tags from template
  //
  let nodes = [];
  const templateFragments = parse5.parseFragment(cparsed.template.content, { sourceCodeLocationInfo: true });
  if (templateFragments.childNodes) {
    traverse(templateFragments, nodes);
  }


  let templateParsed = DEFAULT_OUTPUT.template;
  if (template) {
    const templateContent = template.content.replace(/\/\/\n/g, '').trim();
    if (templateContent) {
      templateParsed = parseTemplate(templateContent);
    }
  }

  // add render dep import
  output += templateParsed.import;
  output += '\n';

  // parse script
  const script = cparsed.script;
  let scriptParsed = DEFAULT_OUTPUT.script;
  if (script) {
    const scriptContent = script.content.replace(/\/\/\n/g, '').trim();
    scriptParsed = parseScript(scriptContent);
    mappings = generateSourceMap(code);
  }

  if (mappings) {
    // Start of the script content
    //
    var beforeLines = output.split(splitRE).length;
    // Start of the script content of the original code
    //
    var scriptLine = code.slice(0, cparsed.script.start).split(splitRE).length + 1;
    var exportDefaultIndex = code.indexOf('export default');
    var tempString = code.substring(0, exportDefaultIndex);
    var exportDefaultLineNumber = tempString.split('\n').length;
  }

  // add vue options
  output += scriptParsed;
  output += '\n\n';

  var endLines = output.split(splitRE).length - 1;
  for (; scriptLine < endLines; scriptLine++) {
    //Skip export default line
    if (scriptLine !== exportDefaultLineNumber) {
      mappings.addMapping({
        source: mappings._hashedFilename,
        generated: {
          line: beforeLines,
          column: 0
        },
        original: {
          line: scriptLine,
          column: 0
        }
      });
    }
    beforeLines++;
  }

  // add render funtion
  let beautifiedRender = beautify(addvm(templateParsed.render, { indent_size: 2 }));
  output += beautifiedRender;
  output += '\n\n';

  // Get last line of render code
  //
  let renderEndLine = beautifiedRender.split(splitRE).length - 1;

  // Search Elements and postion based on render function
  //
  var reactVueElementRegex = /__react__vue__createElement/;
  let foundLines = lineNumber(beautifiedRender, reactVueElementRegex);
  if (mappings) {
    foundLines.forEach((line, index) => {
      let renderJsLine = endLines + line.number;
      if (foundLines[index + 1]) {
        for (let i = line.number; i < foundLines[index + 1].number; i++) {
          // Add Mapping
          if (nodes[index]) {
            mappings.addMapping({
              source: mappings._hashedFilename,
              generated: {
                line: renderJsLine++,
                column: 0
              },
              original: {
                line: nodes[index].startTag.startLine + templateLineNumber,
                column: 0
              }
            });
          }
        }
      } else if (nodes[index] && nodes[index].startTag) {
        // Last Line
        for (let i = line.number; i < renderEndLine; i++) {
          // Add Mapping
          mappings.addMapping({
            source: mappings._hashedFilename,
            generated: {
              line: renderJsLine++,
              column: 0
            },
            original: {
              line: nodes[index].startTag.startLine + templateLineNumber,
              column: 0
            }
          });
        }
      }
    });
  }

  // parse css
  const styles = cparsed.styles;
  let cssParsed = {};
  styles.forEach(function (v) {
    const cssAst = cssParse(v.content);
    cssParsed = Object.assign({}, cssParsed, parseCss(cssAst));
  });

  // add css obj
  output += `const ${constants.CSS} = ${JSON.stringify(cssParsed)}`;
  output += '\n\n';

  // add builder
  output += `const ${constants.COMPONENT_BUILDED} = ${
    constants.BUILD_COMPONENT
    }(${constants.TEMPLATE_RENDER}, ${constants.SCRIPT_OPTIONS}, {Component: ${
    constants.COMPONENT
    }, PropTypes: ${constants.PROP_TYPE}, Vue: ${constants.VUE}, ReactNative: ${
    constants.REACT_NATIVE
    }, css: ${constants.CSS}})`;
  output += '\n\n';

  // export default
  output += `export default ${constants.OBSERVER}(${
    constants.COMPONENT_BUILDED
    })`;

  // beautiful
  // output = beautify(output, { indent_size: 2 });
  return { output, mappings: mappings ? mappings.toJSON() : null };

  // fs.writeFile(name.replace(FILTER, '.js'), output, function(err) {
  //   if (err) {
  //     throw err;
  //   }
  // });
}
1268036
function watchChanges() {
  function buildChange(file) {
    log.info('File changed:', file);
    try {
      siteBuilder.buildChange(file);
    } catch (e) {
      log.error('Error building site:', e);
    }
  }

  // TODO: What happens when files/dirs are added?
  var dirs = [];
  siteBuilder.fileMap.files.forEach(function(file) {
    if (file.type === 'dir') {
      dirs.push(file.name);
    }
  });

  watch(dirs, buildChange);
}
511690
function(evt) {
    if (evt !== 'change' && evt !== 'rename') {
      return;
    }
    fs.stat(file, function(err, current) {
      if (err) {
        self.logger_.error(err.message);
        self.emit('error.watch', err.message);
        return;
      }
      if (current.size !== prev.size || +current.mtime > +prev.mtime) {
        prev = current; // save new stats
        self.logger_.debug(util.format('%s has been modified', file));
        self.emit('watch');
      }
    });
  }
68727
function observeDOM(obj, callback) {
    const MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

    /* istanbul ignore else */
    if (MutationObserver) {
        const obs = new MutationObserver(callback);

        obs.observe(obj, {
            childList: true,
            subtree: true
        });
    } else {
        obj.addEventListener('DOMNodeInserted', callback, false);
        obj.addEventListener('DOMNodeRemoved', callback, false);
    }
}
1284633
function watch (poet, callback) {
  var watcher = fs.watch(poet.options.posts, function (event, filename) {
    poet.init().then(callback);
  });
  poet.watchers.push({
    'watcher': watcher,
    'callback': callback
  });
  return poet;
}
648696
@Override
	public void onModify(WatchEvent<?> event, Path currentPath) {
		if(this.delay < 1) {
			this.watcher.onModify(event, currentPath);
		}else {
			onDelayModify(event, currentPath);
		}
	}
879746
async function watch() {
  let webpackConfig = config

  if (get(manifest, 'skypager.webpack.build')) {
    let configToMerge = require(path.resolve(
      path.dirname(paths.appPackageJson),
      get(manifest, 'skypager.webpack.build')
    ))

    if (typeof configToMerge === 'function') {
      configToMerge = await Promise.resolve(configToMerge(argv.env || 'production', argv, config))
    }

    if (!isArray(configToMerge)) {
      // we won't try and merge webpack config if it is an array
      webpackConfig = configMerge(webpackConfig, configToMerge)
    }
  }

  const compiler = webpack(webpackConfig)

  compiler.watch({ aggregateTimeout: 1000 }, (err, stats) => {
    if (err) {
      console.error(err)
      return
    }
    const messages = formatWebpackMessages(stats.toJson({}, true))

    if (messages.errors.length) {
      // Only keep the first error. Others are often indicative
      // of the same problem, but confuse the reader with noise.
      if (messages.errors.length > 1) {
        messages.errors.length = 1
      }

      throw new Error(messages.errors.join('\n\n'))
    }
  })
}
560240
function main(browserify, options) {
	options = adjustOptions(options);
	options = defaultOptions(browserify, options);

	return browserify
		.plugin(watchAdditional, options)
		.plugin(flexiRequire, options);
}
294772
function watchAdditional(browserify, options) {
	var changingDeps = {};
	var pending = false;
	var updating = false;

	// watchify and sharing
	var sharedCache = browserify._options.cache;
	var sharedPkgcache = browserify._options.packageCache;

	var cache_target_paths = {};
	var mcached = new mutils.Cached(browserify);

	// watchfiles in watchify
	var watchify_on_files = {};
	browserify.on('bundle', function () {
		watchify_on_files = {};
	});
	browserify.on('file', function (file) {
		// NOTE : collect watch files of watchify
		watchify_on_files[file] = true;
	});

	browserify.on('bundle', function(bundle) {
		updating = true;

		var watched = false,
			ended = false;

		// NOTE : wait until browserify._recorded is update, for when used with the default options.
		var stream = through.obj(
			function transform(row, enc, next) { this.push(row); next(); }, // no-op
			function flush(done) {
				if (checkWatchify(browserify)) {
					var full_paths = mutils.toResolvePaths([].concat(options.files).concat(options.getFiles()));

					// add require target files
					mcached.collectRequirePaths(full_paths, function (collect_file_sources) {
						var collect_full_paths = Object.keys(collect_file_sources);
						// NOTE : keep wildcard path
						watchFile(_.uniq(full_paths.concat(collect_full_paths)));

						watched = true;
						oncomplete();
					});
				} else {
					watched = true;
				}
				done();
			});
		browserify.pipeline.get('record').push(stream);

		bundle.on('error', onend);
		bundle.on('end', onend);
		function onend () {
			ended = true;
			oncomplete();
		}

		function oncomplete () {
			if (!watched || !ended) return;

			if (checkWatchify(browserify)) {
				// unwatch the duplicated files from watchify
				var target_paths = _.uniq(
					Object.keys(browserify.pipeline.get('deps')._streams[0].visited)
						.concat(Object.keys(watchify_on_files)));

				unwatch(target_paths);
				target_paths.forEach(function (path) {
					cache_target_paths[path] = true;
				});
			}

			updating = false;
		}
	});


	var w = null;
	var runner = null;

	function watchFile(paths) {
		if (w) w.close();

		// TODO : support ignored

		w = chokidar.watch(paths);
		w.setMaxListeners(0);
		w.on('error', browserify.emit.bind(browserify, 'error'));
		w.on('change', function (file) {
			invalidate(file);
		});

		runner = new DelayRunner(DELAY);
	}

	function invalidate(id) {
		if (sharedCache) delete sharedCache[id];
		if (sharedPkgcache) delete sharedPkgcache[id];
		changingDeps[id] = true;

		var emit = true;
		emit = emit && !cache_target_paths[id];
		emit = emit && _.every(watchify_on_files, function (dummy, file) { return !putils.isEqualPath(id, file); });

		if (!updating && cache_target_paths[id]) {
			// remove expired path
			delete cache_target_paths[id];
		}

		if (emit) {
			// wait for the disk/editor to quiet down first:
			if (pending) clearTimeout(pending);
			pending = setTimeout(notify, DELAY);
		}
	}

	function notify() {
		if (updating) {
			pending = setTimeout(notify, DELAY);
		} else {
			pending = false;
			browserify.emit('update', Object.keys(changingDeps));
			changingDeps = {};
		}
	}

	function unwatch(paths) {
		// NOTE : do not work w.unwatch, if after immediate add.
		//        make a delay so
		runner.run(function () { w.unwatch(paths); });
	}

	function checkWatchify(browserify) {
		// XXX : _watcher is private field. judgement using watchify is not appropriate.
		//       but only this one :(
		return !!browserify._watcher;
	}

	return browserify;
}
880329
function watch() {
  gulp.watch(['src/**/*.js', '!src/**/README.md'],
    ['scripts', 'demos', 'components', reload]);
  gulp.watch(['src/**/*.{scss,css}'],
    ['styles', 'styles-grid', 'styletemplates', reload]);
  gulp.watch(['src/**/*.html'], ['pages', reload]);
  gulp.watch(['src/**/*.{svg,png,jpg}'], ['images', reload]);
  gulp.watch(['src/**/README.md'], ['pages', reload]);
  gulp.watch(['templates/**/*'], ['templates', reload]);
  gulp.watch(['docs/**/*'], ['pages', 'assets', reload]);
  gulp.watch(['package.json', 'bower.json', 'LICENSE'], ['metadata']);
}
875121
function watchCompiler(compiler, options={}){
  let watching = false
  log('Watch Building')
  const startWatchTime = Date.now()
  const watchConfig = { // watch options:
    //aggregateTimeout: 300, // wait so long for more changes
    //poll: true // use polling instead of native watchers
    // pass a number to set the polling interval
  }

  options.onRebuild = options.onRebuild || function(){}

  return new Promise(function(res,rej){  
    //webpack watch functionality
    compiler.watch(watchConfig, function(err,stats){
      if(err)return rej(err)

      if(watching){
        log('Rebuilt '+getServerTime())
        options.onRebuild(stats)
      }else{
        watching = true
        log('Watching '+(Date.now()-startWatchTime)/1000+' seconds')
        res( this )
      }
    });
  })
}
1144691
function addWatcher(dirPath) {
    Debug._l(dirPath);
    Watcher(dirPath, function (filePath, action) {
        switch (action) {
            case Watcher.ADD_EVENT:
            case Watcher.CHANGE_EVENT:
                Debug._l(generateIdFromFilePath(filePath));
                generateCache(filePath);
                break;

            case Watcher.DELETE_EVENT:
                removeCache(generateIdFromFilePath(filePath));
                break;

        }
    });

}
859541
function watchedEvents(obj) {
      var listeners = obj['__ember_meta__'].listeners, ret = [];

      if (listeners) {
        for(var eventName in listeners) {
          if (listeners[eventName]) { ret.push(eventName); }
        }
      }
      return ret;
    }
1083411
function watchAsyncLoad() {
        if (opts.loadingAsync && !opts.isRemoved) {
          scope.$$loadingAsyncDone = false;

          $q.when(opts.loadingAsync)
            .then(function() {
              scope.$$loadingAsyncDone = true;
              delete opts.loadingAsync;
            }).then(function() {
              $$rAF(positionAndFocusMenu);
            });
        }
      }
357363
function watchTask() {
    gulp.watch(config.watchers.static, copyStaticFiles);
    gulp.watch(config.watchers.css, gulp.series(lintCSS, compileSass));
    gulp.watch(config.watchers.js, gulp.series(lintJS, concatJS, copyJS));
    gulp.watch(config.watchers.drizzle, drizzleTask);
}
171500
function startWatcherForLinting (src)
{
    watch(src,
        function (file)
        {
            if (file.path)
            {
                lintFiles(file.path);
            }
        }
    );
}
368988
function _watch(vm, vars, update) {
    var watchKeys = []
    function _handler (kp) {
        if (watchKeys.some(function(key) {
            if (_relative(kp, key)) {
                return true
            }
        })) update.apply(null, arguments)
    }

    if (vars && vars.length) {
        vars.forEach(function (k) {
            if (~keywords.indexOf(k)) return
            while (k) {
                if (!~watchKeys.indexOf(k)) watchKeys.push(k)
                k = util.digest(k)
            }
        })
        if (!watchKeys.length) return noop
        return vm.$watch(_handler)
    }
    return noop
}