bimba-cli 0.7.4 → 0.7.6

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 +2 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimba-cli",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/HeapVoid/bimba.git"
package/serve.js CHANGED
@@ -307,21 +307,6 @@ function updateImportGraph(fromAbs, newDeps) {
307
307
  _imports.set(fromAbs, newDeps)
308
308
  }
309
309
 
310
- function transitiveImporters(absFile, skip) {
311
- const out = new Set()
312
- const stack = [absFile]
313
- while (stack.length) {
314
- const cur = stack.pop()
315
- const ups = _importers.get(cur)
316
- if (!ups) continue
317
- for (const u of ups) {
318
- if (out.has(u) || (skip && skip.has(u))) continue
319
- out.add(u)
320
- stack.push(u)
321
- }
322
- }
323
- return out
324
- }
325
310
 
326
311
  // Imba compiles tag render-cache slots as anonymous local Symbols at module top
327
312
  // level: `var $4 = Symbol(), $11 = Symbol(), ...; let c$0 = Symbol();`. Each
@@ -497,7 +482,6 @@ export function serve(entrypoint, flags) {
497
482
  const htmlDir = path.dirname(htmlPath)
498
483
  const srcDir = path.dirname(entrypoint)
499
484
  const sockets = new Set()
500
- const entryAbs = path.resolve(entrypoint)
501
485
  let importMapTag = null
502
486
 
503
487
  // ── Status line (prints current compile result, fades out on success) ──────
@@ -597,18 +581,6 @@ export function serve(entrypoint, flags) {
597
581
  printStatus(rel, 'ok')
598
582
  broadcast({ type: 'clear-error' })
599
583
  broadcast({ type: 'update', file: rel, slots: out.slots || 'shifted' })
600
-
601
- // Cascade: re-import modules that transitively import this file.
602
- // Skip the entry point — re-importing it re-runs imba.mount and
603
- // recreates global services, and traversing through it would
604
- // cascade to the entire project.
605
- const ups = transitiveImporters(path.resolve(filepath), new Set([entryAbs]))
606
- for (const upAbs of ups) {
607
- const upRel = path.relative('.', upAbs).replaceAll('\\', '/')
608
- const cached = _compileCache.get(upAbs)
609
- const slots = cached?.result?.slots || 'shifted'
610
- broadcast({ type: 'update', file: upRel, slots })
611
- }
612
584
  } catch(e) {
613
585
  printStatus(rel, 'fail', [{ message: e.message }])
614
586
  broadcast({ type: 'error', file: rel, errors: [{ message: e.message, snippet: e.stack || e.message }] })
@@ -691,6 +663,8 @@ export function serve(entrypoint, flags) {
691
663
  // Serve a resolved file: compile .imba, wrap CJS as ESM, pass ESM through
692
664
  const serveResolved = async (filePath) => {
693
665
  if (filePath.endsWith('.imba')) {
666
+ const f = Bun.file(filePath)
667
+ if (!(await f.exists())) return null
694
668
  const out = await compileFile(filePath)
695
669
  if (out.errors?.length) return new Response(out.errors.map(e => e.message).join('\n'), { status: 500 })
696
670
  return new Response(out.js, { headers: { 'Content-Type': 'application/javascript' } })