@zenithbuild/cli 0.4.8 → 0.4.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenithbuild/cli",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "description": "CLI for Zenith framework - dev server, build tools, and plugin management",
5
5
  "type": "module",
6
6
  "bin": {
@@ -50,14 +50,14 @@
50
50
  },
51
51
  "private": false,
52
52
  "peerDependencies": {
53
- "@zenithbuild/core": "latest"
53
+ "@zenithbuild/core": "^1.2.14"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/bun": "latest"
57
57
  },
58
58
  "dependencies": {
59
- "@zenithbuild/compiler": "latest",
60
- "@zenithbuild/router": "latest",
59
+ "@zenithbuild/compiler": "^1.0.15",
60
+ "@zenithbuild/router": "^1.0.7",
61
61
  "picocolors": "^1.0.0"
62
62
  }
63
63
  }
@@ -77,7 +77,7 @@ export async function dev(options: DevOptions = {}): Promise<void> {
77
77
  // Clear any previously registered hooks (important for restarts)
78
78
  clearHooks()
79
79
 
80
- console.log('[Zenith] Config plugins:', config.plugins?.length ?? 0)
80
+
81
81
 
82
82
  // ============================================
83
83
  // Plugin Registration (Unconditional)
@@ -85,7 +85,7 @@ export async function dev(options: DevOptions = {}): Promise<void> {
85
85
  // CLI registers ALL plugins without checking which ones exist.
86
86
  // Each plugin decides what hooks to register.
87
87
  for (const plugin of config.plugins || []) {
88
- console.log('[Zenith] Registering plugin:', plugin.name)
88
+
89
89
  registry.register(plugin)
90
90
 
91
91
  // Let plugin register its CLI hooks (if it wants to)
@@ -118,11 +118,11 @@ export async function dev(options: DevOptions = {}): Promise<void> {
118
118
  let compiledCss = ''
119
119
 
120
120
  if (globalsCssPath) {
121
- console.log('[Zenith] Compiling CSS:', path.relative(rootDir, globalsCssPath))
121
+ logger.debug(`Compiling CSS: ${path.relative(rootDir, globalsCssPath)}`)
122
122
  const cssResult = await compileCssAsync({ input: globalsCssPath, output: ':memory:' })
123
123
  if (cssResult.success) {
124
124
  compiledCss = cssResult.css
125
- console.log(`[Zenith] CSS compiled in ${cssResult.duration}ms`)
125
+ logger.debug(`CSS compiled in ${cssResult.duration}ms`)
126
126
  } else {
127
127
  console.error('[Zenith] CSS compilation failed:', cssResult.error)
128
128
  }
@@ -217,7 +217,7 @@ export async function dev(options: DevOptions = {}): Promise<void> {
217
217
  // Combine: structured imports first, then cleaned script body
218
218
  const fullScript = (result.finalized.npmImports || '') + '\n\n' + jsWithoutImports
219
219
 
220
- console.log('[Dev] Page Imports:', result.finalized.npmImports ? result.finalized.npmImports.split('\n').length : 0, 'lines')
220
+
221
221
 
222
222
  // Bundle ONLY if compiler emitted a BundlePlan (no inference)
223
223
  let bundledScript = fullScript
@@ -337,7 +337,7 @@ export async function dev(options: DevOptions = {}): Promise<void> {
337
337
 
338
338
  // Upgrade to WebSocket for HMR
339
339
  if (pathname === '/hmr') {
340
- const upgraded = server.upgrade(req)
340
+ const upgraded = server.upgrade(req, { data: { timestamp: Date.now() } as any })
341
341
  if (upgraded) return undefined
342
342
  }
343
343
 
@@ -450,7 +450,7 @@ function findPageForRoute(route: string, pagesDir: string): string | null {
450
450
  const staticPart = segments.slice(0, i).join('/')
451
451
  const baseDir = staticPart ? path.join(pagesDir, staticPart) : pagesDir
452
452
 
453
- // console.log(`[ZenithDev] Checking level ${i}: baseDir=${baseDir}`)
453
+
454
454
 
455
455
  // Check for [slug].zen (single segment catch)
456
456
  const singleDynamicPath = path.join(baseDir, '[slug].zen')
@@ -459,7 +459,7 @@ function findPageForRoute(route: string, pagesDir: string): string | null {
459
459
  // Check for [...slug].zen (catch-all)
460
460
  const catchAllPath = path.join(baseDir, '[...slug].zen')
461
461
  if (fs.existsSync(catchAllPath)) {
462
- console.log(`[ZenithDev] MATCH! Found ${catchAllPath}`)
462
+
463
463
  return catchAllPath
464
464
  }
465
465
  }
@@ -44,3 +44,9 @@ export function route(method: string, path: string, status: number, totalMs: num
44
44
  `${pc.dim(`(compile: ${compileMs}ms, render: ${renderMs}ms)`)}`
45
45
  )
46
46
  }
47
+
48
+ export function debug(message: string): void {
49
+ if (process.env.ZENITH_DEBUG === 'true') {
50
+ console.log(`${pc.gray('[debug]')} ${message}`)
51
+ }
52
+ }