feat: server logs
This commit is contained in:
parent
c288b2235f
commit
4520e65e21
3 changed files with 9 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
import { ELEMENT_NODE, parse, render, renderSync, walkSync } from 'ultrahtml'
|
||||
import { consola } from 'consola'
|
||||
import { parseScript } from 'esprima'
|
||||
import { loadConfig } from 'c12'
|
||||
import { eventHandler } from 'h3'
|
||||
|
@ -34,8 +35,6 @@ export function useMcFlyRoute({ storage }) {
|
|||
const { components: componentType } = config
|
||||
let html = await getHtml(path, storage)
|
||||
|
||||
console.log('[INFO]: Mcfly Config', loadedConfig)
|
||||
|
||||
if (html) {
|
||||
const transforms = [evaluateServerScript, deleteServerScripts]
|
||||
|
||||
|
@ -48,7 +47,7 @@ export function useMcFlyRoute({ storage }) {
|
|||
if (!!componentType && !!html) {
|
||||
html = await insertRegistry(html.toString(), componentType, storage)
|
||||
} else {
|
||||
console.error('[ERR]: Failed to insert registry', {
|
||||
consola.error('[ERR]: Failed to insert registry', {
|
||||
componentType: !componentType ? 'missing' : 'okay',
|
||||
html: !html ? 'missing' : 'okay',
|
||||
})
|
||||
|
@ -252,7 +251,7 @@ function evaluateServerScript(html) {
|
|||
try {
|
||||
finalValue = eval(rawValue)
|
||||
} catch (e) {
|
||||
console.error('ERR! Failed to evaluate expression', e)
|
||||
consola.error('[ERR]: Failed to evaluate expression', e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,12 @@
|
|||
"homepage": "https://github.com/ayoayco/McFly#readme",
|
||||
"dependencies": {
|
||||
"c12": "^2.0.1",
|
||||
"consola": "^3.3.3",
|
||||
"esbuild": "^0.24.2",
|
||||
"esprima": "^4.0.1",
|
||||
"h3": "^1.8.2",
|
||||
"ultrahtml": "^1.5.2",
|
||||
"nitropack": "~2.10.4"
|
||||
"nitropack": "~2.10.4",
|
||||
"ultrahtml": "^1.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"unstorage": "^1.14.4"
|
||||
|
|
|
@ -85,6 +85,9 @@ importers:
|
|||
c12:
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1(magicast@0.3.5)
|
||||
consola:
|
||||
specifier: ^3.3.3
|
||||
version: 3.3.3
|
||||
esbuild:
|
||||
specifier: ^0.24.2
|
||||
version: 0.24.2
|
||||
|
|
Loading…
Reference in a new issue