@nuxtjs/mdc 0.20.1 → 0.21.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/config.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as defineConfig } from './shared/mdc.CFljHne0.mjs';
1
+ export { d as defineConfig } from './shared/mdc.B7_zBGwd.mjs';
2
2
  import 'shiki';
3
3
  import 'unified';
4
4
  import 'hast';
package/dist/module.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { BundledLanguage, LanguageRegistration, BundledTheme, ThemeRegistrationAny } from 'shiki';
3
3
  import { Options } from 'remark-rehype';
4
- import { R as RehypeHighlightOption, M as MdcConfig, a as MdcThemeOptions } from './shared/mdc.CFljHne0.mjs';
5
- export { A as Awaitable, b as HighlightResult, c as Highlighter, H as HighlighterOptions, d as defineConfig } from './shared/mdc.CFljHne0.mjs';
4
+ import { R as RehypeHighlightOption, M as MdcConfig, a as MdcThemeOptions } from './shared/mdc.B7_zBGwd.mjs';
5
+ export { A as Awaitable, H as HighlightResult, b as Highlighter, c as HighlighterOptions, d as defineConfig } from './shared/mdc.B7_zBGwd.mjs';
6
6
  import { Options as Options$1 } from 'remark-stringify';
7
7
  import { YamlToStringOptions, RemarkMDCOptions } from 'remark-mdc';
8
8
  import 'unified';
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
3
  "configKey": "mdc",
4
- "version": "0.20.1",
4
+ "version": "0.21.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -287,6 +287,7 @@ const module$1 = defineNuxtModule({
287
287
  options.rehypePlugins.highlight.src ||= await resolver.resolvePath("./runtime/highlighter/rehype-nuxt");
288
288
  options.rehypePlugins.highlight.options ||= {};
289
289
  }
290
+ const nitroOptions = nuxt.options.nitro;
290
291
  const registerTemplate = (options2) => {
291
292
  const name = options2.filename.replace(/\.m?js$/, "");
292
293
  const alias = "#" + name;
@@ -295,35 +296,41 @@ const module$1 = defineNuxtModule({
295
296
  write: true
296
297
  // Write to disk for Nitro to consume
297
298
  });
298
- nuxt.options.nitro.alias ||= {};
299
- nuxt.options.nitro.externals ||= {};
300
- nuxt.options.nitro.externals.inline ||= [];
299
+ nitroOptions.alias ||= {};
300
+ nitroOptions.externals ||= {};
301
+ nitroOptions.externals.inline ||= [];
301
302
  nuxt.options.alias[alias] = results.dst;
302
- nuxt.options.nitro.alias[alias] = nuxt.options.alias[alias];
303
- nuxt.options.nitro.externals.inline.push(nuxt.options.alias[alias]);
304
- nuxt.options.nitro.externals.inline.push(alias);
303
+ nitroOptions.alias[alias] = nuxt.options.alias[alias];
304
+ nitroOptions.externals.inline.push(nuxt.options.alias[alias]);
305
+ nitroOptions.externals.inline.push(alias);
305
306
  return results;
306
307
  };
307
308
  const mdcConfigs$1 = [];
309
+ const fileConfigs = [];
308
310
  for (const layer of nuxt.options._layers) {
309
311
  let path = resolve(layer.config.srcDir, "mdc.config.ts");
310
312
  if (fs$1.existsSync(path)) {
311
- mdcConfigs$1.push(path);
313
+ fileConfigs.push(path);
312
314
  } else {
313
315
  path = resolve(layer.config.srcDir, "mdc.config.js");
314
316
  if (fs$1.existsSync(path)) {
315
- mdcConfigs$1.push(path);
317
+ fileConfigs.push(path);
316
318
  }
317
319
  }
318
320
  }
321
+ nuxt.hook("mdc:configSources", (configs) => {
322
+ for (const path of fileConfigs) {
323
+ if (!configs.includes(path)) configs.push(path);
324
+ }
325
+ });
319
326
  nuxt.hook("modules:done", () => nuxt.callHook("mdc:configSources", mdcConfigs$1));
320
327
  registerTemplate({
321
328
  filename: "mdc-configs.mjs",
322
329
  getContents: mdcConfigs,
323
330
  options: { configs: mdcConfigs$1 }
324
331
  });
325
- const nitroPreset = nuxt.options.nitro.preset || process.env.NITRO_PRESET || process.env.SERVER_PRESET || "";
326
- const useWasmAssets = !nuxt.options.dev && (!!nuxt.options.nitro.experimental?.wasm || ["cloudflare-pages", "cloudflare-module", "cloudflare"].includes(nitroPreset));
332
+ const nitroPreset = nitroOptions.preset || process.env.NITRO_PRESET || process.env.SERVER_PRESET || "";
333
+ const useWasmAssets = !nuxt.options.dev && (!!nitroOptions.experimental?.wasm || ["cloudflare-pages", "cloudflare-module", "cloudflare"].includes(nitroPreset));
327
334
  registerTemplate({
328
335
  filename: "mdc-highlighter.mjs",
329
336
  getContents: mdcHighlighter,
@@ -381,8 +388,10 @@ const module$1 = defineNuxtModule({
381
388
  // from runtime/highlighter/rehype.ts
382
389
  "unified",
383
390
  // deps by all the plugins
384
- "debug"
391
+ "debug",
385
392
  // deps by many libraries but it's not an ESM
393
+ "extend"
394
+ // transitive dep of unified, CJS-only
386
395
  ];
387
396
  const exclude = [
388
397
  "@nuxtjs/mdc"
@@ -101,7 +101,7 @@ const { data, refresh, error } = await useAsyncData(key.value, async () => {
101
101
  const body = computed(() => props.excerpt ? data.value?.excerpt : data.value?.body);
102
102
  watch(() => props.value, () => {
103
103
  refresh();
104
- });
104
+ }, { immediate: true });
105
105
  function hashString(str) {
106
106
  if (typeof str !== "string") {
107
107
  str = JSON.stringify(str || "");
@@ -144,7 +144,7 @@ function _renderNode(node, h2, options, keyInParent) {
144
144
  return renderBinding(node, h2, documentMeta, parentScope);
145
145
  }
146
146
  const _resolveComponent = isUnresolvableTag(renderTag) ? (component2) => component2 : resolveComponent;
147
- if (dangerousTags.includes(renderTag)) {
147
+ if (dangerousTags.includes(pascalCase(renderTag).toLowerCase())) {
148
148
  return h2(
149
149
  "pre",
150
150
  { class: "mdc-renderer-dangerous-tag" },
@@ -9,7 +9,6 @@ export function createShikiHighlighter({
9
9
  engine
10
10
  } = {}) {
11
11
  let shiki;
12
- let configs;
13
12
  async function _getShiki() {
14
13
  const { createHighlighterCore, addClassToHast, isSpecialLang, isSpecialTheme } = await import("@shikijs/core");
15
14
  const { transformerNotationDiff, transformerNotationErrorLevel, transformerNotationFocus, transformerNotationHighlight } = await import("@shikijs/transformers");
@@ -41,12 +40,9 @@ export function createShikiHighlighter({
41
40
  return shiki;
42
41
  }
43
42
  async function getConfigs() {
44
- if (!configs) {
45
- configs = Promise.resolve(getMdcConfigs?.() || []);
46
- }
47
- return configs;
43
+ return getMdcConfigs?.() || [];
48
44
  }
49
- const highlighter = async (code, lang, theme, options = {}) => {
45
+ const highlighter = async (code, _lang, theme, options = {}) => {
50
46
  const {
51
47
  shiki: shiki2,
52
48
  addClassToHast,
@@ -54,6 +50,7 @@ export function createShikiHighlighter({
54
50
  isSpecialTheme,
55
51
  transformers: baseTransformers
56
52
  } = await getShiki();
53
+ let lang = _lang?.toLowerCase();
57
54
  const codeToHastOptions = {
58
55
  defaultColor: false,
59
56
  meta: {
@@ -64,4 +64,4 @@ interface MdcConfig {
64
64
  declare function defineConfig(config: MdcConfig): MdcConfig;
65
65
 
66
66
  export { defineConfig as d };
67
- export type { Awaitable as A, HighlighterOptions as H, MdcConfig as M, RehypeHighlightOption as R, MdcThemeOptions as a, HighlightResult as b, Highlighter as c };
67
+ export type { Awaitable as A, HighlightResult as H, MdcConfig as M, RehypeHighlightOption as R, MdcThemeOptions as a, Highlighter as b, HighlighterOptions as c };
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { type Awaitable, type HighlightResult, type Highlighter, type HighlighterOptions, type defineConfig } from './shared/mdc.CFljHne0.mjs'
1
+ export { type Awaitable, type HighlightResult, type Highlighter, type HighlighterOptions, type defineConfig } from './shared/mdc.B7_zBGwd.mjs'
2
2
 
3
3
  export { type DefaultHighlightLangs, type MdcConfig, type MdcThemeOptions, type RehypeHighlightOption, default } from './module.mjs'
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
- "version": "0.20.1",
3
+ "version": "0.21.0",
4
4
  "description": "Nuxt MDC module",
5
5
  "repository": "nuxt-content/mdc",
6
6
  "license": "MIT",
@@ -68,14 +68,14 @@
68
68
  "verify": "npm run dev:prepare && npm run lint && npm run test && npm run typecheck"
69
69
  },
70
70
  "dependencies": {
71
- "@nuxt/kit": "^4.2.2",
72
- "@shikijs/core": "^3.21.0",
73
- "@shikijs/langs": "^3.21.0",
74
- "@shikijs/themes": "^3.21.0",
75
- "@shikijs/transformers": "^3.21.0",
71
+ "@nuxt/kit": "^4.4.2",
72
+ "@shikijs/core": "^4.0.2",
73
+ "@shikijs/langs": "^4.0.2",
74
+ "@shikijs/themes": "^4.0.2",
75
+ "@shikijs/transformers": "^4.0.2",
76
76
  "@types/hast": "^3.0.4",
77
77
  "@types/mdast": "^4.0.4",
78
- "@vue/compiler-core": "^3.5.26",
78
+ "@vue/compiler-core": "^3.5.31",
79
79
  "consola": "^3.4.2",
80
80
  "debug": "^4.4.3",
81
81
  "defu": "^6.1.4",
@@ -104,35 +104,35 @@
104
104
  "remark-rehype": "^11.1.2",
105
105
  "remark-stringify": "^11.0.0",
106
106
  "scule": "^1.3.0",
107
- "shiki": "^3.21.0",
107
+ "shiki": "^4.0.2",
108
108
  "ufo": "^1.6.3",
109
109
  "unified": "^11.0.5",
110
110
  "unist-builder": "^4.0.0",
111
- "unist-util-visit": "^5.0.0",
111
+ "unist-util-visit": "^5.1.0",
112
112
  "unwasm": "^0.5.3",
113
113
  "vfile": "^6.0.3"
114
114
  },
115
115
  "devDependencies": {
116
- "@nuxt/devtools": "^3.1.1",
117
- "@nuxt/eslint-config": "^1.12.1",
116
+ "@nuxt/devtools": "^3.2.4",
117
+ "@nuxt/eslint-config": "^1.15.2",
118
118
  "@nuxt/module-builder": "^1.0.2",
119
- "@nuxt/schema": "^4.2.2",
120
- "@nuxt/test-utils": "^3.23.0",
121
- "@nuxt/ui": "^4.3.0",
119
+ "@nuxt/schema": "^4.4.2",
120
+ "@nuxt/test-utils": "^4.0.0",
121
+ "@nuxt/ui": "^4.6.0",
122
122
  "@nuxtjs/mdc": "link:.",
123
- "@types/node": "^25.0.8",
124
- "eslint": "^9.39.2",
125
- "nuxt": "^4.2.2",
123
+ "@types/node": "^25.5.0",
124
+ "eslint": "^10.1.0",
125
+ "nuxt": "^4.4.2",
126
126
  "rehype": "^13.0.2",
127
- "release-it": "^19.2.3",
128
- "typescript": "5.9.3",
129
- "vitest": "^4.0.17",
130
- "vue-tsc": "^3.2.2"
127
+ "release-it": "^19.2.4",
128
+ "typescript": "6.0.2",
129
+ "vitest": "^4.1.2",
130
+ "vue-tsc": "^3.2.6"
131
131
  },
132
132
  "resolutions": {
133
133
  "mkdist": "2.3.0"
134
134
  },
135
- "packageManager": "pnpm@10.28.0",
135
+ "packageManager": "pnpm@10.33.0",
136
136
  "release-it": {
137
137
  "git": {
138
138
  "commitMessage": "chore(release): release v${version}"