@11ty/eleventy-dev-server
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -58,6 +58,6 @@ class Util { | ||
let newWithoutHref = to.cloneNode(); | ||
oldWithoutHref.removeAttribute("href"); | ||
newWithoutHref.removeAttribute("href"); | ||
// if all other attributes besides href match | ||
@@ -89,3 +89,3 @@ if(!oldWithoutHref.isEqualNode(newWithoutHref)) { | ||
//copy over the attributes | ||
// copy over the attributes | ||
for(let attr of [...source.attributes]) { | ||
@@ -166,3 +166,3 @@ script.setAttribute(attr.nodeName ,attr.nodeValue); | ||
}); | ||
socket.addEventListener("close", () => { | ||
@@ -209,3 +209,7 @@ this.connectionMessageShown = false; | ||
if (fromEl.nodeName === "SCRIPT" && toEl.nodeName === "SCRIPT") { | ||
Util.runScript(toEl, fromEl); | ||
if(toEl.innerHTML !== fromEl.innerHTML) { | ||
Util.log(`JavaScript modified, reload initiated.`); | ||
window.location.reload(); | ||
} | ||
return false; | ||
@@ -226,7 +230,36 @@ } | ||
}, | ||
addChild: function(parent, child) { | ||
// Declarative Shadow DOM https://github.com/11ty/eleventy-dev-server/issues/90 | ||
if(child.nodeName === "TEMPLATE" && child.hasAttribute("shadowrootmode")) { | ||
let root = parent.shadowRoot; | ||
if(root) { | ||
// remove all shadow root children | ||
while(root.firstChild) { | ||
root.removeChild(root.firstChild); | ||
} | ||
} | ||
for(let newChild of child.content.childNodes) { | ||
root.appendChild(newChild); | ||
} | ||
} else { | ||
parent.appendChild(child); | ||
} | ||
}, | ||
onNodeAdded: function (node) { | ||
if (node.nodeName === 'SCRIPT') { | ||
Util.runScript(node); | ||
Util.log(`JavaScript added, reload initiated.`); | ||
window.location.reload(); | ||
} | ||
}, | ||
onElUpdated: function(node) { | ||
// Re-attach custom elements | ||
if(customElements.get(node.tagName.toLowerCase())) { | ||
let placeholder = document.createElement("div"); | ||
node.replaceWith(placeholder); | ||
requestAnimationFrame(() => { | ||
placeholder.replaceWith(node); | ||
placeholder = undefined; | ||
}); | ||
} | ||
} | ||
}); | ||
@@ -233,0 +266,0 @@ |
{ | ||
"name": "@11ty/eleventy-dev-server", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "A minimal, modern, generic, hot-reloading local web server to help web developers.", | ||
@@ -41,15 +41,15 @@ "main": "server.js", | ||
"dependencies": { | ||
"@11ty/eleventy-utils": "^1.0.2", | ||
"@11ty/eleventy-utils": "^1.0.3", | ||
"chokidar": "^3.6.0", | ||
"debug": "^4.3.5", | ||
"debug": "^4.3.6", | ||
"dev-ip": "^1.0.1", | ||
"finalhandler": "^1.2.0", | ||
"finalhandler": "^1.3.0", | ||
"mime": "^3.0.0", | ||
"minimist": "^1.2.8", | ||
"morphdom": "^2.7.2", | ||
"morphdom": "^2.7.4", | ||
"please-upgrade-node": "^3.2.0", | ||
"send": "^0.18.0", | ||
"ssri": "^10.0.6", | ||
"ssri": "^11.0.0", | ||
"urlpattern-polyfill": "^10.0.0", | ||
"ws": "^8.17.0" | ||
"ws": "^8.18.0" | ||
}, | ||
@@ -56,0 +56,0 @@ "devDependencies": { |
@@ -38,2 +38,3 @@ const path = require("node:path"); | ||
useCache: false, // Use a cache for file contents | ||
headers: {}, // Set default response headers | ||
messageOnStart: ({ hosts, startupTime, version, options }) => { | ||
@@ -435,2 +436,6 @@ let hostsStr = " started"; | ||
for(const [key, value] of Object.entries(this.options.headers)){ | ||
res.setHeader(key, value); | ||
} | ||
if (!contentType) { | ||
@@ -437,0 +442,0 @@ return res.end(contents); |
47991
1284
+ Addedssri@11.0.0(transitive)
- Removedssri@10.0.6(transitive)
Updated@11ty/eleventy-utils@^1.0.3
Updateddebug@^4.3.6
Updatedfinalhandler@^1.3.0
Updatedmorphdom@^2.7.4
Updatedssri@^11.0.0
Updatedws@^8.18.0