for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
'use strict'
const minimatch = require('minimatch')
const _ = require('lodash')
const request = require('../util').request
const Module = require('../containers/Module')
const reload = _.debounce(function (containerToken, path, event) {
request(containerToken + '/ws', {
type: 'autoreload',
payload: {
path: path,
event: event
}
}, {
'Content-Type': 'multipart/form-data'
}).end()
}, 120)
module.exports = function (containerToken, path, event) {
Module.getManifest(function (manifest) {
var options = manifest.getDevOption('autoreload')
if (!options || !('paths' in options)) {
return
if (typeof options.paths === 'string') {
options.paths = [options.paths]
var matched = false
for (var i in options.paths) {
if (!options.paths.hasOwnProperty(i)) {
continue
if (minimatch(path, options.paths[i])) {
matched = true
break
if (!matched) {
reload(containerToken, path, event)
})