🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
37
node_modules/astro/dist/runtime/client/hmr.js
generated
vendored
Normal file
37
node_modules/astro/dist/runtime/client/hmr.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
if (import.meta.hot) {
|
||||
const injectedStyles = getInjectedStyles();
|
||||
const mo = new MutationObserver((records) => {
|
||||
var _a;
|
||||
for (const record of records) {
|
||||
for (const node of record.addedNodes) {
|
||||
if (isViteInjectedStyle(node)) {
|
||||
(_a = injectedStyles.get(node.getAttribute("data-vite-dev-id"))) == null ? void 0 : _a.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
mo.observe(document.documentElement, { subtree: true, childList: true });
|
||||
import.meta.hot.on("vite:beforeUpdate", async (payload) => {
|
||||
for (const file of payload.updates) {
|
||||
if (file.acceptedPath.includes("vue&type=style")) {
|
||||
const link = document.querySelector(`link[href="${file.acceptedPath}"]`);
|
||||
if (link) {
|
||||
link.replaceWith(link.cloneNode(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function getInjectedStyles() {
|
||||
const injectedStyles = /* @__PURE__ */ new Map();
|
||||
document.querySelectorAll("style[data-astro-dev-id]").forEach((el) => {
|
||||
injectedStyles.set(el.getAttribute("data-astro-dev-id"), el);
|
||||
});
|
||||
return injectedStyles;
|
||||
}
|
||||
function isStyle(node) {
|
||||
return node.nodeType === node.ELEMENT_NODE && node.tagName.toLowerCase() === "style";
|
||||
}
|
||||
function isViteInjectedStyle(node) {
|
||||
return isStyle(node) && node.getAttribute("type") === "text/css" && !!node.getAttribute("data-vite-dev-id");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue