@zenithbuild/core 1.2.12 → 1.2.13
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/cli/commands/dev.ts +13 -13
- package/cli/utils/logger.ts +6 -0
- package/package.json +3 -3
package/cli/commands/dev.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
94
|
+
logger.debug(`About to call registerCLI for: ${plugin.name}`)
|
|
95
95
|
if (plugin.registerCLI) {
|
|
96
96
|
plugin.registerCLI(bridgeAPI)
|
|
97
|
-
|
|
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
|
-
|
|
106
|
+
logger.debug('About to call registry.initAll...')
|
|
107
107
|
await registry.initAll(createPluginContext(rootDir))
|
|
108
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
211
|
-
|
|
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
|
-
|
|
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
|
package/cli/utils/logger.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.2.13",
|
|
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": "
|
|
67
|
+
"@zenithbuild/compiler": "file:../zenith-compiler",
|
|
68
68
|
"@zenithbuild/router": "^1.0.4",
|
|
69
69
|
"picocolors": "^1.1.1"
|
|
70
70
|
}
|
|
71
|
-
}
|
|
71
|
+
}
|