bimba-cli 0.5.16 → 0.5.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/serve.js +22 -18
package/package.json
CHANGED
package/serve.js
CHANGED
|
@@ -135,23 +135,27 @@ const hmrClient = `
|
|
|
135
135
|
_oldNs.delete(tag);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
// Destructive HMR: wipe inner DOM and re-render each collected tag
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
138
|
+
// Destructive HMR: wipe inner DOM and re-render each collected tag.
|
|
139
|
+
// Skip when slots === 'stable' (CSS-only change) — no template diff,
|
|
140
|
+
// so wiping innerHTML would destroy DOM state (inputs, focus) for nothing.
|
|
141
|
+
if (slots !== 'stable') {
|
|
142
|
+
for (const tag of collected) {
|
|
143
|
+
const els = document.querySelectorAll(tag);
|
|
144
|
+
els.forEach(el => {
|
|
145
|
+
const state = {};
|
|
146
|
+
for (const k of Object.keys(el)) state[k] = el[k];
|
|
147
|
+
_disconnectDescendants(el);
|
|
148
|
+
for (const sym of Object.getOwnPropertySymbols(el)) {
|
|
149
|
+
if (Symbol.keyFor(sym) !== undefined) continue;
|
|
150
|
+
try { delete el[sym]; } catch(_) {}
|
|
151
|
+
}
|
|
152
|
+
el.innerHTML = '';
|
|
153
|
+
Object.assign(el, state);
|
|
154
|
+
try { el.render && el.render(); } catch(e) { console.error('[bimba] render error:', e); }
|
|
155
|
+
try { el.connectedCallback && el.connectedCallback(); } catch(_) {}
|
|
156
|
+
try { el.mount && el.mount(); } catch(_) {}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
if (typeof imba !== 'undefined') imba.commit();
|
|
@@ -547,7 +551,7 @@ export function serve(entrypoint, flags) {
|
|
|
547
551
|
|
|
548
552
|
printStatus(rel, 'ok')
|
|
549
553
|
broadcast({ type: 'clear-error' })
|
|
550
|
-
broadcast({ type: 'update', file: rel, slots: 'shifted' })
|
|
554
|
+
broadcast({ type: 'update', file: rel, slots: out.slots || 'shifted' })
|
|
551
555
|
|
|
552
556
|
// Cascade: re-import modules that transitively import this file.
|
|
553
557
|
// Skip the entry point — re-importing it re-runs imba.mount and
|