MCPcopy
hub / github.com/thinkjs/thinkjs / _watcherCallBack

Method _watcherCallBack

lib/application.js:50–75  ·  view source on GitHub ↗

* watcher callback

(fileInfo)

Source from the content-addressed store, hash-verified

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 */

Callers 2

startWatcherMethod · 0.95
application.jsFile · 0.80

Calls 4

notifierMethod · 0.95
errorMethod · 0.80
infoMethod · 0.80
forceReloadWorkersMethod · 0.80

Tested by

no test coverage detected