* watcher callback
(fileInfo)
| 48 | * watcher callback |
| 49 | */ |
| 50 | _watcherCallBack(fileInfo) { |
| 51 | let transpiler = this.options.transpiler; |
| 52 | if (transpiler) { |
| 53 | if (!helper.isArray(transpiler)) { |
| 54 | transpiler = [transpiler]; |
| 55 | } |
| 56 | const ret = transpiler[0]({ |
| 57 | srcPath: fileInfo.path, |
| 58 | outPath: this.options.APP_PATH, |
| 59 | file: fileInfo.file, |
| 60 | options: transpiler[1] |
| 61 | }); |
| 62 | if (helper.isError(ret)) { |
| 63 | console.error(ret.stack); |
| 64 | this.notifier(ret); |
| 65 | return false; |
| 66 | } |
| 67 | if (think.logger) { |
| 68 | think.logger.info(`transpile file ${fileInfo.file} success`); |
| 69 | } |
| 70 | } |
| 71 | // reload all workers |
| 72 | if (this.masterInstance) { |
| 73 | this.masterInstance.forceReloadWorkers(); |
| 74 | } |
| 75 | } |
| 76 | /** |
| 77 | * start watcher |
| 78 | */ |
no test coverage detected