bimba-cli 0.5.2 → 0.5.3
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 +8 -32
package/package.json
CHANGED
package/serve.js
CHANGED
|
@@ -67,11 +67,10 @@ const hmrClient = `
|
|
|
67
67
|
_hotTags = [];
|
|
68
68
|
|
|
69
69
|
import('/' + file + '?t=' + Date.now()).then(() => {
|
|
70
|
-
const updatedTags = _hotTags.slice();
|
|
71
70
|
_hotTags = [];
|
|
72
71
|
|
|
73
|
-
//
|
|
74
|
-
//
|
|
72
|
+
// Remove duplicate root elements. Re-importing a module with a fresh
|
|
73
|
+
// ?t= query causes top-level code (e.g. imba.mount()) to run again,
|
|
75
74
|
// which can append a second copy of the root tag to body.
|
|
76
75
|
const seen = new Set();
|
|
77
76
|
[...document.body.children].forEach(el => {
|
|
@@ -80,35 +79,12 @@ const hmrClient = `
|
|
|
80
79
|
else seen.add(tag);
|
|
81
80
|
});
|
|
82
81
|
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
// We also clear any symbol keys that point to DOM Nodes (Imba's render
|
|
90
|
-
// cache) so the new render method (which uses new module-scoped symbols)
|
|
91
|
-
// starts clean and doesn't leave orphaned nodes.
|
|
92
|
-
|
|
93
|
-
const toReset = new Set();
|
|
94
|
-
|
|
95
|
-
updatedTags.forEach(tagName => {
|
|
96
|
-
document.querySelectorAll(tagName).forEach(el => {
|
|
97
|
-
toReset.add(el);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
toReset.forEach(el => {
|
|
102
|
-
// Clear Imba render cache (symbol → Node mappings)
|
|
103
|
-
Object.getOwnPropertySymbols(el).forEach(s => {
|
|
104
|
-
try { if (el[s] instanceof Node) el[s] = undefined; } catch(_) {}
|
|
105
|
-
});
|
|
106
|
-
el.innerHTML = '';
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
if (toReset.size > 0 && typeof imba !== 'undefined') {
|
|
110
|
-
imba.commit();
|
|
111
|
-
}
|
|
82
|
+
// Let Imba re-render in place from the patched prototypes. We do NOT
|
|
83
|
+
// touch instance DOM (no innerHTML reset, no symbol cleanup) — that
|
|
84
|
+
// would destroy rendered children like open popups / dropdowns and
|
|
85
|
+
// collapse any transient UI state. Prototype patching already makes
|
|
86
|
+
// the next render use the new methods; imba.commit() triggers it.
|
|
87
|
+
if (typeof imba !== 'undefined') imba.commit();
|
|
112
88
|
});
|
|
113
89
|
}
|
|
114
90
|
|