@nuxtjs/mdc 0.3.1 → 0.3.2

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.3.1"
4
+ "version": "0.3.2"
5
5
  }
package/dist/module.mjs CHANGED
@@ -136,18 +136,25 @@ const module = defineNuxtModule({
136
136
  if (options.highlight) {
137
137
  nuxt.hook("ready", () => {
138
138
  const nitro = useNitro();
139
- if (!nitro.options.experimental?.wasm) {
140
- nitro.options.externals = nitro.options.externals || {};
141
- nitro.options.externals.inline = nitro.options.externals.inline || [];
142
- nitro.options.externals.inline.push((id) => id.endsWith(".wasm"));
143
- nitro.hooks.hook("rollup:before", async (_, rollupConfig) => {
139
+ const addWasmSupport = (_nitro) => {
140
+ if (nitro.options.experimental?.wasm) {
141
+ return;
142
+ }
143
+ _nitro.options.externals = _nitro.options.externals || {};
144
+ _nitro.options.externals.inline = _nitro.options.externals.inline || [];
145
+ _nitro.options.externals.inline.push((id) => id.endsWith(".wasm"));
146
+ _nitro.hooks.hook("rollup:before", async (_, rollupConfig) => {
144
147
  const { rollup: unwasm } = await import('unwasm/plugin');
145
148
  rollupConfig.plugins = rollupConfig.plugins || [];
146
149
  rollupConfig.plugins.push(unwasm({
147
- ...nitro.options.wasm
150
+ ..._nitro.options.wasm
148
151
  }));
149
152
  });
150
- }
153
+ };
154
+ addWasmSupport(nitro);
155
+ nitro.hooks.hook("prerender:init", (prerenderer) => {
156
+ addWasmSupport(prerenderer);
157
+ });
151
158
  });
152
159
  addServerHandler({ route: "/api/_mdc/highlight", handler: resolver.resolve("./runtime/shiki/event-handler") });
153
160
  options.rehypePlugins = options.rehypePlugins || {};
@@ -51,7 +51,7 @@ export function rehypeShiki(opts = {}) {
51
51
  if (_node.children[0]?.tagName === "code") {
52
52
  _node.children[0].children = tree2;
53
53
  } else {
54
- _node.children = tree2[0].children || tree2[0];
54
+ _node.children = tree2[0].children || tree2;
55
55
  }
56
56
  if (style)
57
57
  styles.push(style);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Nuxt MDC module",
5
5
  "repository": "nuxt-modules/mdc",
6
6
  "license": "MIT",