Skip to content

Commit

Permalink
fix: remove frontmatterMerge default
Browse files Browse the repository at this point in the history
  • Loading branch information
runyasak committed Dec 15, 2024
1 parent 39a2460 commit 3db6ed7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/core/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function createMarkdown(options: ResolvedOptions) {

scriptLines.push(
`import { computed } from 'vue'`,
`const props = ${`defineProps({ frontmatterMerge: { default: ${JSON.stringify(frontmatter)} } })`}`,
'const props = defineProps({ frontmatterMerge: { type: Object } })',
`const _frontmatter = ${JSON.stringify(frontmatter)}`,
'const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))',
)
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/excerpt.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`excerpt > raw excerpt 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {"title":"Hey"} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {"title":"Hey"}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -36,7 +36,7 @@ exports[`excerpt > rendered excerpt 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {"title":"Hey"} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {"title":"Hey"}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand Down
20 changes: 10 additions & 10 deletions test/__snapshots__/transform.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`transform > basic 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {"title":"Hey"} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {"title":"Hey"}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -27,7 +27,7 @@ exports[`transform > code escape 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -39,7 +39,7 @@ exports[`transform > couldn't expose frontmatter 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {"title":"Hey"} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {"title":"Hey"}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ test: 'test'})
Expand All @@ -56,7 +56,7 @@ exports[`transform > escapeCodeTagInterpolation 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -68,7 +68,7 @@ exports[`transform > export keyword frontmatters 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {"class":"text","default":"foo"} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {"class":"text","default":"foo"}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -84,7 +84,7 @@ exports[`transform > exposes frontmatter 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {"title":"Hey"} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {"title":"Hey"}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -100,7 +100,7 @@ exports[`transform > frontmatter interpolation 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {"name":"My Cool App"} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {"name":"My Cool App"}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -116,7 +116,7 @@ exports[`transform > script setup 1`] = `
</div></template>
<script setup lang="ts">
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -130,7 +130,7 @@ exports[`transform > style 1`] = `
</div></template>
<script setup>
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand All @@ -144,7 +144,7 @@ exports[`transform > vue directives 1`] = `
</div></template>
<script setup lang="ts">
import { computed } from 'vue'
const props = defineProps({ frontmatterMerge: { default: {"name":"My Cool App"} } })
const props = defineProps({ frontmatterMerge: { type: Object } })
const _frontmatter = {"name":"My Cool App"}
const frontmatter = computed(() => ({ ..._frontmatter, ...props.frontmatterMerge }))
defineExpose({ frontmatter: _frontmatter })
Expand Down

0 comments on commit 3db6ed7

Please sign in to comment.