@nodefony/http-bundle
Advanced tools
Comparing version 6.5.7 to 6.6.0
{ | ||
"name": "@nodefony/http-bundle", | ||
"version": "6.5.7", | ||
"version": "6.6.0", | ||
"description": "Nodefony Framework Bundle HTTP ", | ||
@@ -5,0 +5,0 @@ "contributors": [], |
@@ -52,18 +52,25 @@ const Sockjs = require('sockjs'); | ||
sendStats(stats, force, connection) { | ||
if (!force && | ||
const shouldEmit = | ||
!force && | ||
stats && | ||
(!stats.errors || stats.errors.length === 0) && | ||
(!stats.warnings || stats.warnings.length === 0) && | ||
stats.assets && | ||
stats.assets.every(asset => !asset.emitted) | ||
) { | ||
return this.sockWrite('still-ok', null, connection); | ||
stats.assets.every((asset) => !asset.emitted); | ||
if (shouldEmit) { | ||
this.sockWrite('still-ok', null, connection); | ||
return; | ||
} | ||
this.sockWrite('hash', stats.hash, connection); | ||
if (stats.errors.length > 0) { | ||
this.sockWrite('errors', stats.errors, connection); | ||
} else if (stats.warnings.length > 0) { | ||
this.sockWrite('warnings', stats.warnings, connection); | ||
} else { | ||
this.sockWrite('ok', null, connection); | ||
} | ||
if (stats.errors.length > 0 || stats.warnings.length > 0) { | ||
if (stats.warnings.length > 0) { | ||
this.sockWrite('warnings', stats.warnings, connection); | ||
} | ||
if (stats.errors.length > 0) { | ||
this.sockWrite('errors', stats.errors, connection); | ||
} | ||
} else { | ||
this.sockWrite('ok', null, connection); | ||
} | ||
} | ||
@@ -112,5 +119,4 @@ | ||
this.hot = this.settings.hot || false; | ||
this.hotOnly = this.settings.hotOnly || false; | ||
this.progress = this.settings.progress || false; | ||
this.clientLogLevel = this.settings.logLevel || "none"; | ||
this.logging = this.settings.logging || "none"; | ||
this.websocket = this.settings.websocket; | ||
@@ -158,3 +164,4 @@ this.protocol = this.settings.protocol.toLowerCase(); | ||
if (progress && config.watch) { | ||
const progressPlugin = new this.compilers[basename].webpack.webpack.ProgressPlugin((percent, msg, addInfo) => { | ||
const { ProgressPlugin } = compiler.webpack || require("webpack"); | ||
const progressPlugin = new ProgressPlugin((percent, msg, addInfo, pluginName) => { | ||
percent = Math.floor(percent * 100); | ||
@@ -170,3 +177,4 @@ if (percent === 100) { | ||
percent, | ||
msg | ||
msg, | ||
pluginName | ||
}); | ||
@@ -186,9 +194,11 @@ | ||
} | ||
let hot = (config.hot || config.hotOnly) || (this.hot || this.hotOnly); | ||
let hot = (config.hot) || (this.hot); | ||
if (hot) { | ||
this.sockWrite("hot", null, conn); | ||
}else{ | ||
this.sockWrite("liveReload", null, conn); | ||
} | ||
let clientLogLevel = (config.clientLogLevel || this.clientLogLevel); | ||
if (clientLogLevel) { | ||
this.sockWrite("log-level", this.clientLogLevel, conn); | ||
if (config.logging || this.logging) { | ||
this.sockWrite("logging", (config.logging || this.logging), conn); | ||
} | ||
@@ -261,3 +271,3 @@ if (this.compilers[basename].stats) { | ||
case "change": | ||
return this.sockWrite("content-changed"); | ||
return this.sockWrite("static-changed", data); | ||
default: | ||
@@ -264,0 +274,0 @@ return; |
180092
5366