diff --git a/packages/core/src/runtime/evaluate-scripts.ts b/packages/core/src/runtime/evaluate-scripts.ts index 8b14f24..80e111b 100644 --- a/packages/core/src/runtime/evaluate-scripts.ts +++ b/packages/core/src/runtime/evaluate-scripts.ts @@ -35,9 +35,6 @@ export async function evaluateServerScripts(_html: string, event: H3Event) { method: event.method, query, body, - url: event.node.req.url, - statusCode: event.node.req.statusCode, - statusMessage: event.node.req.statusMessage, } // console.log('>>> Event (from core)', McFlyGlobal) @@ -81,7 +78,6 @@ function evaluateServerScript(html: string) { // @ts-ignore .map((n) => n.declarations[0].id.name) //['declarations'][0].id.name) - // const McFly=${JSON.stringify(McFlyGlobal)}; const constructor = `(function(){}.constructor)(\` const McFly=${JSON.stringify(McFlyGlobal)} ${script}; @@ -123,6 +119,10 @@ function evaluateServerScript(html: string) { } }) + // stringify objects + finalValue = + typeof finalValue === 'object' ? JSON.stringify(finalValue) : finalValue + html = html.replace(key, finalValue ?? '') regex.lastIndex = -1 } diff --git a/site/src/pages/cozy.html b/site/src/pages/cozy.html index 5ce11e7..31b80e8 100644 --- a/site/src/pages/cozy.html +++ b/site/src/pages/cozy.html @@ -6,22 +6,15 @@ Cozy (McFly)

{{ appName }} - {{McFly.hello}}

-
- + + -
\ No newline at end of file