@vaadin/vaadin-development-mode-detector
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -5,3 +5,3 @@ { | ||
"name": "@vaadin/vaadin-development-mode-detector", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": "Vaadin Ltd", | ||
@@ -8,0 +8,0 @@ "license": "Apache-2.0", |
const DEV_MODE_CODE_REGEXP = | ||
/\/\*\*\s+vaadin-dev-mode:start([\s\S]*)vaadin-dev-mode:end\s+\*\*\//i; | ||
const FlowClients = window.Vaadin && window.Vaadin.Flow && window.Vaadin.Flow.clients; | ||
function isMinified() { | ||
@@ -16,3 +18,15 @@ function test() { | ||
try { | ||
return isForcedDevelopmentMode() || (isLocalhost() && !isMinified() && !isFlowProductionMode()); | ||
if (isForceDevelopmentMode()) { | ||
return true; | ||
} | ||
if (!isLocalhost()) { | ||
return false; | ||
} | ||
if (FlowClients) { | ||
return !isFlowProductionMode(); | ||
} | ||
return !isMinified(); | ||
} catch (e) { | ||
@@ -33,6 +47,6 @@ // Some error in this code, assume production so no further actions will be taken | ||
function isFlowProductionMode() { | ||
if (window.Vaadin && window.Vaadin.Flow && window.Vaadin.Flow.clients) { | ||
const productionModeApps = Object.keys(window.Vaadin.Flow.clients) | ||
.map(key => window.Vaadin.Flow.clients[key]) | ||
.filter(client => client.productionMode); | ||
if (FlowClients) { | ||
const productionModeApps = Object.keys(FlowClients) | ||
.map(key => FlowClients[key]) | ||
.filter(client => client.productionMode); | ||
if (productionModeApps.length > 0) { | ||
@@ -39,0 +53,0 @@ return true; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4129
85