<commit_before>import { compileScript, compileTemplate, isVue3 } from 'vue-inbrowser-compiler-demi'
import { EvaluableComponent } from './types'

const EXAMPLE_FILENAME = 'example.vue'

export function compileTemplateForEval(compiledComponent: EvaluableComponent) {
	if (compiledComponent.template) {
		const { bindings } = compileScript(
			{
				cssVars: [],
				script: {
					type: 'script',
					content: `export default (function () {${compiledComponent.script}})()`
				},
				scriptSetup: null
			},
			{}
		)
		compiledComponent.script = `
${isVue3 ? 'const Vue = require("vue")' : ''}
const comp = (function() {${compiledComponent.script}})()
comp.render = function() {${
			compileTemplate({
				source: compiledComponent.template,
				filename: EXAMPLE_FILENAME,
				id: '',
				compilerOptions: {
					bindingMetadata: bindings,
					prefixIdentifiers: true,
					mode: 'function'
				}
			}).code
		}}
return comp`
		delete compiledComponent.template
	}
}
<commit_msg>fix vue3 render function<commit_after>import { compileScript, compileTemplate, isVue3 } from 'vue-inbrowser-compiler-demi'
import { EvaluableComponent } from './types'

const EXAMPLE_FILENAME = 'example.vue'

export function compileTemplateForEval(compiledComponent: EvaluableComponent) {
	if (compiledComponent.template) {
		const { bindings } = compileScript(
			{
				cssVars: [],
				script: {
					type: 'script',
					content: `export default (function () {${compiledComponent.script}})()`
				},
				scriptSetup: null
			},
			{}
		)
		compiledComponent.script = `
${isVue3 ? 'const Vue = require("vue")' : ''}
const comp = (function() {${compiledComponent.script}})()
comp.render = function() {${
			compileTemplate({
				source: compiledComponent.template,
				filename: EXAMPLE_FILENAME,
				id: '',
				compilerOptions: {
					bindingMetadata: bindings,
					prefixIdentifiers: true,
					mode: 'function'
				}
			}).code
		}}
${isVue3 ? `comp.render = comp.render()` : ``}
return comp`
		delete compiledComponent.template
	}
}

{'fraction_non_alphanumeric': 0.1404549950544016, 'fraction_numerical': 0.002967359050445104, 'mean_word_length': 3.9221411192214113, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6744150', 'n_tokens_mistral': 750, 'n_tokens_neox': 602, 'n_words': 130}