@nuxtjs/mdc 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -64,10 +64,18 @@ const props = defineProps({
|
|
|
64
64
|
unwrap: {
|
|
65
65
|
type: [Boolean, String],
|
|
66
66
|
default: false
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Async Data Unique Key
|
|
70
|
+
* @default `hash(props.value)`
|
|
71
|
+
*/
|
|
72
|
+
cacheKey: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: undefined
|
|
67
75
|
}
|
|
68
76
|
})
|
|
69
77
|
|
|
70
|
-
const key = computed(() => hash(props.value))
|
|
78
|
+
const key = computed(() => props.cacheKey ?? hash(props.value))
|
|
71
79
|
|
|
72
80
|
const { data, refresh, error } = await useAsyncData(key.value, async () => {
|
|
73
81
|
if (typeof props.value !== 'string') {
|
|
@@ -73,8 +73,17 @@ export const createMarkdownParser = async (inlineOptions = {}) => {
|
|
|
73
73
|
const processor = await createParseProcessor(inlineOptions);
|
|
74
74
|
return async function parse(md, { fileOptions } = {}) {
|
|
75
75
|
const { content, data: frontmatter } = await parseFrontMatter(md);
|
|
76
|
-
const
|
|
77
|
-
const
|
|
76
|
+
const cwd = typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : "/tmp";
|
|
77
|
+
const processedFile = await new Promise((resolve, reject) => {
|
|
78
|
+
processor.process({ cwd, ...fileOptions, value: content, data: frontmatter }, (err, file) => {
|
|
79
|
+
if (err) {
|
|
80
|
+
reject(err);
|
|
81
|
+
} else {
|
|
82
|
+
resolve(file);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
const result = processedFile?.result;
|
|
78
87
|
const data = Object.assign(
|
|
79
88
|
inlineOptions.contentHeading !== false ? contentHeading(result.body) : {},
|
|
80
89
|
frontmatter,
|