@nuxtjs/mdc 0.1.4 → 0.1.5

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
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
3
  "configKey": "mdc",
4
- "version": "0.1.4"
4
+ "version": "0.1.5"
5
5
  }
package/dist/module.mjs CHANGED
@@ -62,10 +62,13 @@ const registerMDCSlotTransformer = (resolver) => {
62
62
  transform?.(node, context);
63
63
  const codegen = context.ssr ? node.ssrCodegenNode : node.codegenNode;
64
64
  codegen.callee = codegen.callee === RENDER_SLOT ? "_renderMDCSlot" : "_ssrRenderMDCSlot";
65
- context.imports.push({
66
- exp: context.ssr ? "{ ssrRenderSlot as _ssrRenderMDCSlot }" : "{ renderSlot as _renderMDCSlot }",
67
- path: resolver.resolve(`./runtime/utils/${context.ssr ? "ssrSlot" : "slot"}`)
68
- });
65
+ const importExp = context.ssr ? "{ ssrRenderSlot as _ssrRenderMDCSlot }" : "{ renderSlot as _renderMDCSlot }";
66
+ if (!context.imports.some((i) => String(i.exp) === importExp)) {
67
+ context.imports.push({
68
+ exp: importExp,
69
+ path: resolver.resolve(`./runtime/utils/${context.ssr ? "ssrSlot" : "slot"}`)
70
+ });
71
+ }
69
72
  };
70
73
  }
71
74
  if (context.nodeTransforms[0].name !== "viteMDCSlot") {
@@ -13,9 +13,10 @@
13
13
  </template>
14
14
 
15
15
  <script setup lang="ts">
16
+ import { hash } from 'ohash'
16
17
  import { useAsyncData } from 'nuxt/app'
17
18
  import { parseMarkdown } from '../parser'
18
- import { watch } from 'vue'
19
+ import { watch, computed } from 'vue'
19
20
 
20
21
  const props = defineProps({
21
22
  tag: {
@@ -28,7 +29,9 @@ const props = defineProps({
28
29
  }
29
30
  })
30
31
 
31
- const { data, refresh } = await useAsyncData(props.value, async () => await parseMarkdown(props.value, { highlight: {}}))
32
+ const key = computed(() => hash(props.value))
33
+
34
+ const { data, refresh } = await useAsyncData(key.value, async () => await parseMarkdown(props.value, { highlight: {}}))
32
35
 
33
36
  watch(() => props.value, () => {
34
37
  refresh()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Nuxt MDC module",
5
5
  "repository": "nuxt-modules/mdc",
6
6
  "license": "MIT",
@@ -43,15 +43,16 @@
43
43
  "destr": "^2.0.1",
44
44
  "detab": "^3.0.2",
45
45
  "github-slugger": "^2.0.0",
46
- "hast-util-to-string": "^2.0.0",
46
+ "hast-util-to-string": "^3.0.0",
47
47
  "mdast-util-to-hast": "^13.0.2",
48
48
  "micromark-util-sanitize-uri": "^2.0.0",
49
+ "ohash": "^1.1.3",
49
50
  "property-information": "^6.2.0",
50
51
  "rehype-external-links": "^2.1.0",
51
52
  "rehype-raw": "^6.1.1",
52
53
  "rehype-slug": "^5.1.0",
53
- "rehype-sort-attribute-values": "^4.0.0",
54
- "rehype-sort-attributes": "^4.0.0",
54
+ "rehype-sort-attribute-values": "^5.0.0",
55
+ "rehype-sort-attributes": "^5.0.0",
55
56
  "remark-emoji": "^4.0.0",
56
57
  "remark-gfm": "^3.0.1",
57
58
  "remark-mdc": "^2.0.0",