@poi/dev-utils
Advanced tools
Comparing version 10.0.1 to 10.0.2
@@ -60,8 +60,28 @@ /** | ||
function getCurrentScriptSource() { | ||
// `document.currentScript` is the most accurate way to find the current script, | ||
// but is not supported in all browsers. | ||
if (document.currentScript) { | ||
return document.currentScript.getAttribute('src'); | ||
} | ||
// Fall back to getting all scripts in the document. | ||
var scriptElements = document.scripts || []; | ||
var currentScript = scriptElements[scriptElements.length - 1]; | ||
if (currentScript) { | ||
return currentScript.getAttribute('src'); | ||
} | ||
// Fail as there was no script to use. | ||
throw new Error('[WDS] Failed to get current script source.'); | ||
} | ||
var scriptHost = getCurrentScriptSource(); | ||
scriptHost = scriptHost.replace(/\/[^\/]+$/, ''); | ||
urlParts = url.parse(scriptHost || '/', false, true); | ||
// Connect to WebpackDevServer via a socket. | ||
var connection = new SockJS( | ||
url.format({ | ||
protocol: window.location.protocol, | ||
hostname: window.location.hostname, | ||
port: window.location.port, | ||
protocol: urlParts.protocol, | ||
hostname: urlParts.hostname, | ||
port: urlParts.port, | ||
// Hardcoded in WebpackDevServer | ||
@@ -68,0 +88,0 @@ pathname: '/sockjs-node' |
{ | ||
"name": "@poi/dev-utils", | ||
"version": "10.0.1", | ||
"version": "10.0.2", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
14166
383
1