MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / vueHarness

Function vueHarness

src/artifacts/preview.ts:146–162  ·  view source on GitHub ↗
(src: string)

Source from the content-addressed store, hash-verified

144}
145
146function vueHarness(src: string): string {
147 // Use vue3-sfc-loader to render a .vue single-file component straight from source text.
148 const head = `<script src="${CDN.vue}"></script><script src="${CDN.vueSfc}"></script>`;
149 const body =
150 `<div id="__art_root"></div>` +
151 `<script>\n` +
152 `const sfcSource = ${JSON.stringify(src)};\n` +
153 `const options = {\n` +
154 ` moduleCache: { vue: Vue },\n` +
155 ` getFile: () => sfcSource,\n` +
156 ` addStyle: (t) => { const s = document.createElement('style'); s.textContent = t; document.head.appendChild(s); },\n` +
157 `};\n` +
158 `const { loadModule } = window['vue3-sfc-loader'];\n` +
159 `Vue.createApp(Vue.defineAsyncComponent(() => loadModule('artifact.vue', options))).mount('#__art_root');\n` +
160 `</script>`;
161 return htmlShell(body, head);
162}
163
164function markdownHarness(src: string): string {
165 const head = `<script src="${CDN.marked}"></script>`;

Callers 1

buildPreviewHtmlFunction · 0.85

Calls 1

htmlShellFunction · 0.85

Tested by

no test coverage detected