bimba-cli 0.7.7 → 0.7.8
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 +1 -30
package/package.json
CHANGED
package/serve.js
CHANGED
|
@@ -113,8 +113,6 @@ const hmrClient = `
|
|
|
113
113
|
_collector = prev;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
console.log('[bimba HMR]', file, 'slots=' + slots, 'tags:', collected.join(', '));
|
|
117
|
-
|
|
118
116
|
// Sync _ns_ (CSS namespace) from the new classes. imba_defineTag sets
|
|
119
117
|
// _ns_ on NewClass.prototype AFTER register$ calls customElements.define,
|
|
120
118
|
// so _patchClass missed it. Now that import is done, all _ns_ values are set.
|
|
@@ -146,7 +144,6 @@ const hmrClient = `
|
|
|
146
144
|
if (slots !== 'stable') {
|
|
147
145
|
for (const tag of collected) {
|
|
148
146
|
const els = document.querySelectorAll(tag);
|
|
149
|
-
console.log('[bimba HMR] destructive:', tag, 'instances:', els.length);
|
|
150
147
|
els.forEach(el => {
|
|
151
148
|
const state = {};
|
|
152
149
|
for (const k of Object.keys(el)) state[k] = el[k];
|
|
@@ -162,36 +159,10 @@ const hmrClient = `
|
|
|
162
159
|
try { el.mount && el.mount(); } catch(_) {}
|
|
163
160
|
});
|
|
164
161
|
}
|
|
165
|
-
} else {
|
|
166
|
-
for (const tag of collected) {
|
|
167
|
-
const els = document.querySelectorAll(tag);
|
|
168
|
-
console.log('[bimba HMR] stable:', tag, 'instances:', els.length);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Snapshot DOM before commit to detect duplication
|
|
173
|
-
const _domBefore = {};
|
|
174
|
-
for (const tag of collected) {
|
|
175
|
-
_domBefore[tag] = {
|
|
176
|
-
count: document.querySelectorAll(tag).length,
|
|
177
|
-
bodyChildren: document.body.children.length,
|
|
178
|
-
};
|
|
179
162
|
}
|
|
180
163
|
|
|
181
164
|
if (typeof imba !== 'undefined') imba.commit();
|
|
182
165
|
|
|
183
|
-
// Check DOM after commit (delayed to let rAF fire)
|
|
184
|
-
requestAnimationFrame(() => {
|
|
185
|
-
for (const tag of collected) {
|
|
186
|
-
const after = document.querySelectorAll(tag).length;
|
|
187
|
-
const before = _domBefore[tag]?.count || 0;
|
|
188
|
-
if (after !== before) {
|
|
189
|
-
console.warn('[bimba HMR] DUPLICATION:', tag, before, '->', after);
|
|
190
|
-
}
|
|
191
|
-
console.log('[bimba HMR] after commit:', tag, 'count:', after, 'body children:', document.body.children.length);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
|
|
195
166
|
// Patch className on ALL custom elements: replace old CSS namespace
|
|
196
167
|
// hashes with new ones. Must be global because subclass elements
|
|
197
168
|
// (e.g. panel-agent < basic-panel) inherit the parent's _ns_ hash
|
|
@@ -398,7 +369,7 @@ async function compileFile(filepath) {
|
|
|
398
369
|
|
|
399
370
|
const errors = result.errors || []
|
|
400
371
|
if (!errors.length && result.js) {
|
|
401
|
-
const { js, slotCount } = stabilizeSymbols(result.js,
|
|
372
|
+
const { js, slotCount } = stabilizeSymbols(result.js, abs)
|
|
402
373
|
result.js = js
|
|
403
374
|
const prev = _prevSlots.get(abs)
|
|
404
375
|
result.slots = (prev === undefined || prev === slotCount) ? 'stable' : 'shifted'
|