@zenithbuild/core 1.2.12 → 1.2.14

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.
@@ -78,7 +78,7 @@ export async function dev(options: DevOptions = {}): Promise<void> {
78
78
  // Clear any previously registered hooks (important for restarts)
79
79
  clearHooks()
80
80
 
81
- console.log('[Zenith] Config plugins:', config.plugins?.length ?? 0)
81
+ logger.debug(`Config plugins: ${config.plugins?.length ?? 0}`)
82
82
 
83
83
  // ============================================
84
84
  // Plugin Registration (Unconditional)
@@ -86,15 +86,15 @@ export async function dev(options: DevOptions = {}): Promise<void> {
86
86
  // CLI registers ALL plugins without checking which ones exist.
87
87
  // Each plugin decides what hooks to register.
88
88
  for (const plugin of config.plugins || []) {
89
- console.log('[Zenith] Registering plugin:', plugin.name)
89
+ logger.debug(`Registering plugin: ${plugin.name}`)
90
90
  registry.register(plugin)
91
91
 
92
92
  // Let plugin register its CLI hooks (if it wants to)
93
93
  // CLI does NOT check what the plugin is - it just offers the API
94
- console.log('[Zenith] About to call registerCLI for:', plugin.name)
94
+ logger.debug(`About to call registerCLI for: ${plugin.name}`)
95
95
  if (plugin.registerCLI) {
96
96
  plugin.registerCLI(bridgeAPI)
97
- console.log('[Zenith] registerCLI completed for:', plugin.name)
97
+ logger.debug(`registerCLI completed for: ${plugin.name}`)
98
98
  }
99
99
  }
100
100
 
@@ -103,20 +103,20 @@ export async function dev(options: DevOptions = {}): Promise<void> {
103
103
  // ============================================
104
104
  // Initialize ALL plugins unconditionally.
105
105
  // If no plugins, this is a no-op. CLI doesn't branch on plugin presence.
106
- console.log('[Zenith] About to call registry.initAll...')
106
+ logger.debug('About to call registry.initAll...')
107
107
  await registry.initAll(createPluginContext(rootDir))
108
- console.log('[Zenith] registry.initAll completed')
108
+ logger.debug('registry.initAll completed')
109
109
 
110
110
  // Create hook context - CLI provides this but NEVER uses getPluginData itself
111
111
  const hookCtx: HookContext = {
112
112
  projectRoot: rootDir,
113
113
  getPluginData: getPluginDataByNamespace
114
114
  }
115
- console.log('[Zenith] hookCtx created, calling runPluginHooks...')
115
+ logger.debug('hookCtx created, calling runPluginHooks...')
116
116
 
117
117
  // Dispatch lifecycle hook - plugins decide if they care
118
118
  await runPluginHooks('cli:dev:start', hookCtx)
119
- console.log('[Zenith] runPluginHooks completed')
119
+ logger.debug('runPluginHooks completed')
120
120
 
121
121
  // ============================================
122
122
  // CSS Compilation (Compiler-Owned)
@@ -125,11 +125,11 @@ export async function dev(options: DevOptions = {}): Promise<void> {
125
125
  let compiledCss = ''
126
126
 
127
127
  if (globalsCssPath) {
128
- console.log('[Zenith] Compiling CSS:', path.relative(rootDir, globalsCssPath))
128
+ logger.debug(`Compiling CSS: ${path.relative(rootDir, globalsCssPath)}`)
129
129
  const cssResult = await compileCssAsync({ input: globalsCssPath, output: ':memory:' })
130
130
  if (cssResult.success) {
131
131
  compiledCss = cssResult.css
132
- console.log(`[Zenith] CSS compiled in ${cssResult.duration}ms`)
132
+ logger.debug(`CSS compiled in ${cssResult.duration}ms`)
133
133
  } else {
134
134
  console.error('[Zenith] CSS compilation failed:', cssResult.error)
135
135
  }
@@ -207,8 +207,8 @@ export async function dev(options: DevOptions = {}): Promise<void> {
207
207
  })
208
208
  if (!result.finalized) throw new Error('Compilation failed')
209
209
 
210
- console.log('[Dev] Finalized JS Length:', result.finalized.js.length)
211
- console.log('[Dev] Finalized JS Preview:', result.finalized.js.substring(0, 500))
210
+ logger.debug(`Finalized JS Length: ${result.finalized.js.length}`)
211
+ logger.debug(`Finalized JS Preview: ${result.finalized.js.substring(0, 500)}`)
212
212
 
213
213
  const routeDef = generateRouteDefinition(pagePath, pagesDir)
214
214
 
@@ -262,7 +262,7 @@ export async function dev(options: DevOptions = {}): Promise<void> {
262
262
  // Combine: structured imports first, then cleaned script body
263
263
  const fullScript = (result.finalized.npmImports || '') + '\n\n' + jsWithoutImports
264
264
 
265
- console.log('[Dev] Page Imports:', result.finalized.npmImports ? result.finalized.npmImports.split('\n').length : 0, 'lines')
265
+ logger.debug(`Page Imports: ${result.finalized.npmImports ? result.finalized.npmImports.split('\n').length : 0} lines`)
266
266
 
267
267
  // Bundle ONLY if compiler emitted a BundlePlan (no inference)
268
268
  let bundledScript = fullScript
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenithbuild/core",
3
- "version": "1.2.12",
3
+ "version": "1.2.14",
4
4
  "description": "Core library for the Zenith framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -64,8 +64,8 @@
64
64
  "typescript": "^5.9.3"
65
65
  },
66
66
  "dependencies": {
67
- "@zenithbuild/compiler": "^1.0.12",
68
- "@zenithbuild/router": "^1.0.4",
67
+ "@zenithbuild/compiler": "^1.0.15",
68
+ "@zenithbuild/router": "^1.0.7",
69
69
  "picocolors": "^1.1.1"
70
70
  }
71
71
  }