@nuxtjs/mdc 0.6.0 → 0.6.1

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.6.0"
4
+ "version": "0.6.1"
5
5
  }
@@ -51,7 +51,7 @@ export default defineComponent({
51
51
  },
52
52
  async setup(props) {
53
53
  const $nuxt = getCurrentInstance()?.appContext?.app?.$nuxt;
54
- const route = $nuxt?.$route;
54
+ const route = $nuxt?.$route || $nuxt?._route;
55
55
  const { mdc } = $nuxt?.$config?.public || {};
56
56
  const tags = {
57
57
  ...mdc?.components?.prose && props.prose !== false ? proseComponentMap : {},
@@ -109,14 +109,14 @@ function renderBinding(node, h2, documentMeta, parentScope = {}) {
109
109
  const splitter = /\.|\[(\d+)\]/;
110
110
  const keys = node.props?.value.trim().split(splitter).filter(Boolean);
111
111
  const value = keys.reduce((data2, key) => {
112
- if (key in data2) {
112
+ if (data2 && key in data2) {
113
113
  if (typeof data2[key] === "function") {
114
114
  return data2[key]();
115
115
  } else {
116
116
  return data2[key];
117
117
  }
118
118
  }
119
- return {};
119
+ return void 0;
120
120
  }, data);
121
121
  const defaultValue = node.props?.defaultValue;
122
122
  return h2(Text, value ?? defaultValue ?? "");
@@ -11,5 +11,5 @@ defineProps({
11
11
  default: ''
12
12
  }
13
13
  })
14
- const isDev = import.meta.env
14
+ const isDev = import.meta.dev
15
15
  </script>
@@ -53,7 +53,7 @@ export function createShikiHighlighter({
53
53
  if (bundledLangs[lang]) {
54
54
  await shiki2.loadLanguage(bundledLangs[lang]);
55
55
  } else {
56
- if (import.meta.env) {
56
+ if (import.meta.dev) {
57
57
  console.warn(`[@nuxtjs/mdc] Language "${lang}" is not loaded to the Shiki highlighter, fallback to plain text. Add the language to "mdc.highlight.langs" to fix this.`);
58
58
  }
59
59
  lang = "text";
@@ -64,7 +64,7 @@ export function createShikiHighlighter({
64
64
  if (bundledThemes[theme2]) {
65
65
  await shiki2.loadTheme(bundledThemes[theme2]);
66
66
  } else {
67
- if (import.meta.env) {
67
+ if (import.meta.dev) {
68
68
  console.warn(`[@nuxtjs/mdc] Theme "${theme2}" is not loaded to the Shiki highlighter. Add the theme to "mdc.highlight.themes" to fix this.`);
69
69
  }
70
70
  themesObject[color] = "none";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Nuxt MDC module",
5
5
  "repository": "nuxt-modules/mdc",
6
6
  "license": "MIT",
@@ -104,9 +104,9 @@
104
104
  "@nuxt/module-builder": "^0.5.5",
105
105
  "@nuxt/schema": "^3.10.3",
106
106
  "@nuxt/test-utils": "^3.11.0",
107
- "@nuxt/ui": "^2.14.1",
107
+ "@nuxt/ui": "^2.14.2",
108
108
  "@types/mdurl": "^1.0.5",
109
- "@types/node": "^20.11.24",
109
+ "@types/node": "^20.11.25",
110
110
  "changelogen": "^0.5.5",
111
111
  "eslint": "^8.57.0",
112
112
  "nuxt": "^3.10.3",