Skip to content

Commit 133ea09

Browse files
chore: repo cleanup and modernization
1 parent c37b22d commit 133ea09

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

deps.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dependencies:
2-
bun.sh: ^1.3.10
2+
bun.sh: ^1.3.11
33
redis: ^7.4.7

packages/devtools/src/cli.ts

100644100755
File mode changed.

packages/devtools/src/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,16 @@ async function renderStxPage(templateName: string, wsUrl: string, req: Request):
130130
const content = await Bun.file(templatePath).text()
131131

132132
const context = { __filename: templatePath, __dirname: path.dirname(templatePath) }
133-
// Skip signals runtime injection for page fragments — the shell provides it
134-
const pageConfig = { ...stxConfig, skipSignalsRuntime: true }
135-
let pageHtml = await processDirectives(content, context, templatePath, pageConfig, new Set())
133+
let pageHtml = await processDirectives(content, context, templatePath, stxConfig, new Set())
136134
pageHtml = stripDocumentWrapper(pageHtml)
137135

136+
// Strip the signals runtime from page fragment — the shell already provides it in <head>
137+
pageHtml = pageHtml.replace(/<script data-stx-scoped>\(function\(\)\{'use strict';var cloakStyle[\s\S]*?<\/script>/, '')
138+
139+
// Extract the SFC setup function name so we can bind it to the content wrapper
140+
const setupMatch = pageHtml.match(/function (__stx_setup_\w+)/)
141+
const pageSetupName = setupMatch ? setupMatch[1] : null
142+
138143
// SPA navigation — return fragment only
139144
if (isSpaNavigation(req)) {
140145
return new Response(pageHtml, {
@@ -163,7 +168,7 @@ async function renderStxPage(templateName: string, wsUrl: string, req: Request):
163168
</head>
164169
<body class="bg-[#0a0a0f] text-zinc-50 leading-relaxed min-h-screen">
165170
${shell.before}
166-
<div data-stx-content>${pageHtml}</div>
171+
<div data-stx-content${pageSetupName ? ` data-stx="${pageSetupName}"` : ''}>${pageHtml}</div>
167172
${shell.after}
168173
${shell.scripts}
169174
${getRouterScriptTag()}

0 commit comments

Comments
 (0)