bimba-cli 0.5.1 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/serve.js +25 -32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimba-cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/HeapVoid/bimba.git"
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
- // Always remove duplicate root elements. Re-importing a module with a
74
- // fresh ?t= query causes top-level code (e.g. imba.mount()) to run again,
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
- // JS changed: find all instances of the updated tag types, reset their
84
- // render output (innerHTML), then let imba re-render from current state.
85
- //
86
- // innerHTML = '' removes rendered DOM children but does NOT touch instance
87
- // properties so el.active, el.selectedTab etc. survive.
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
 
@@ -260,6 +236,7 @@ export function serve(entrypoint, flags) {
260
236
  let _fadeTimers = []
261
237
  let _fadeId = 0
262
238
  let _statusSaved = false
239
+ const _isTTY = process.stdout.isTTY
263
240
 
264
241
  function cancelFade() {
265
242
  _fadeTimers.forEach(t => clearTimeout(t))
@@ -267,6 +244,22 @@ export function serve(entrypoint, flags) {
267
244
  }
268
245
 
269
246
  function printStatus(file, state, errors) {
247
+ // non-TTY (pipes, Claude Code bash, CI): plain newline-terminated output,
248
+ // no ANSI cursor tricks, no fade-out — so logs stay readable.
249
+ if (!_isTTY) {
250
+ const now = new Date().toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit', second: '2-digit' })
251
+ const tag = state === 'ok' ? 'ok' : 'fail'
252
+ process.stdout.write(` ${now} ${file} ${tag}\n`)
253
+ if (errors?.length) {
254
+ for (const err of errors) {
255
+ const msg = err.message || String(err)
256
+ const line = err.range?.start?.line
257
+ process.stdout.write(` ${msg}${line ? ` (line ${line})` : ''}\n`)
258
+ }
259
+ }
260
+ return
261
+ }
262
+
270
263
  cancelFade()
271
264
  if (_statusSaved) {
272
265
  process.stdout.write('\x1b[u\x1b[J')