@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 +1 -1
- package/dist/module.mjs +14 -7
- package/dist/runtime/shiki/index.mjs +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
-
...
|
|
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
|
|
54
|
+
_node.children = tree2[0].children || tree2;
|
|
55
55
|
}
|
|
56
56
|
if (style)
|
|
57
57
|
styles.push(style);
|