@nuxtjs/mdc 0.3.0 → 0.3.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.3.0"
4
+ "version": "0.3.1"
5
5
  }
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createResolver, extendViteConfig, defineNuxtModule, addServerHandler, addTemplate, addComponent, addImports, addServerImports, addComponentsDir } from '@nuxt/kit';
1
+ import { createResolver, extendViteConfig, defineNuxtModule, useNitro, addServerHandler, addTemplate, addComponent, addImports, addServerImports, addComponentsDir } from '@nuxt/kit';
2
2
  import fs from 'fs';
3
3
  import { pascalCase } from 'scule';
4
4
  import { defu } from 'defu';
@@ -123,7 +123,7 @@ const module = defineNuxtModule({
123
123
  } : {}
124
124
  });
125
125
  nuxt.hook("vite:extendConfig", (viteConfig) => {
126
- const optimizeList = ["is-buffer", "debug", "flat", "node-emoji", "extend", "hast-util-raw"];
126
+ const optimizeList = ["debug", "flat", "node-emoji", "extend", "hast-util-raw"];
127
127
  viteConfig.optimizeDeps ||= {};
128
128
  viteConfig.optimizeDeps.include ||= [];
129
129
  const list = viteConfig.optimizeDeps.include;
@@ -134,8 +134,21 @@ const module = defineNuxtModule({
134
134
  });
135
135
  });
136
136
  if (options.highlight) {
137
- nuxt.options.nitro.experimental = nuxt.options.nitro.experimental || {};
138
- nuxt.options.nitro.experimental.wasm = true;
137
+ nuxt.hook("ready", () => {
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) => {
144
+ const { rollup: unwasm } = await import('unwasm/plugin');
145
+ rollupConfig.plugins = rollupConfig.plugins || [];
146
+ rollupConfig.plugins.push(unwasm({
147
+ ...nitro.options.wasm
148
+ }));
149
+ });
150
+ }
151
+ });
139
152
  addServerHandler({ route: "/api/_mdc/highlight", handler: resolver.resolve("./runtime/shiki/event-handler") });
140
153
  options.rehypePlugins = options.rehypePlugins || {};
141
154
  options.rehypePlugins.highlight = options.rehypePlugins.highlight || {};
@@ -39,7 +39,7 @@ declare const _default: DefineComponent<{
39
39
  }, {
40
40
  tags: any;
41
41
  contentKey: import("vue").ComputedRef<string>;
42
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
42
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
43
43
  /**
44
44
  * Content to render
45
45
  */
@@ -4,12 +4,9 @@ import { useShikiHighlighter } from "./highlighter.mjs";
4
4
  import { useRuntimeConfig } from "#imports";
5
5
  export default lazyEventHandler(async () => {
6
6
  const { highlight } = useRuntimeConfig().mdc;
7
- try {
8
- const wasm = await import("shikiji/onig.wasm").then((r) => r.default);
9
- await loadWasm(async (obj) => WebAssembly.instantiate(wasm, obj));
10
- } catch {
11
- await loadWasm({ data: await import("shikiji/wasm").then((r) => r.getWasmInlined()).then((r) => r.data) });
12
- }
7
+ await loadWasm(
8
+ (imports) => import("shikiji/onig.wasm").then((mod) => mod.default(imports)).then((exports) => ({ exports }))
9
+ );
13
10
  const shiki = useShikiHighlighter(highlight);
14
11
  return eventHandler(async (event) => {
15
12
  const { code, lang, theme: themeString, highlights: highlightsString } = getQuery(event);
package/dist/types.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
- import type { } from './module'
2
+ import type { } from './module.js'
3
3
 
4
4
 
5
5
 
6
6
 
7
7
 
8
- export type { default } from './module'
8
+ export type { default } from './module.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Nuxt MDC module",
5
5
  "repository": "nuxt-modules/mdc",
6
6
  "license": "MIT",
@@ -34,17 +34,17 @@
34
34
  "test:watch": "vitest watch"
35
35
  },
36
36
  "dependencies": {
37
- "@nuxt/kit": "^3.8.2",
37
+ "@nuxt/kit": "^3.9.3",
38
38
  "@types/hast": "^3.0.3",
39
39
  "@types/mdast": "^4.0.3",
40
- "@vue/compiler-core": "^3.3.13",
40
+ "@vue/compiler-core": "^3.4.15",
41
41
  "consola": "^3.2.3",
42
- "defu": "^6.1.3",
42
+ "defu": "^6.1.4",
43
43
  "destr": "^2.0.2",
44
44
  "detab": "^3.0.2",
45
45
  "github-slugger": "^2.0.0",
46
46
  "hast-util-to-string": "^3.0.0",
47
- "mdast-util-to-hast": "^13.0.2",
47
+ "mdast-util-to-hast": "^13.1.0",
48
48
  "micromark-util-sanitize-uri": "^2.0.0",
49
49
  "ohash": "^1.1.3",
50
50
  "property-information": "^6.4.0",
@@ -55,34 +55,35 @@
55
55
  "rehype-sort-attributes": "^5.0.0",
56
56
  "remark-emoji": "^4.0.1",
57
57
  "remark-gfm": "^4.0.0",
58
- "remark-mdc": "^3.0.0",
58
+ "remark-mdc": "^3.0.1",
59
59
  "remark-parse": "^11.0.0",
60
- "remark-rehype": "^11.0.0",
61
- "scule": "^1.1.1",
62
- "shikiji": "^0.9.10",
63
- "shikiji-transformers": "^0.9.10",
60
+ "remark-rehype": "^11.1.0",
61
+ "scule": "^1.2.0",
62
+ "shikiji": "^0.9.19",
63
+ "shikiji-transformers": "^0.9.19",
64
64
  "ufo": "^1.3.2",
65
65
  "unified": "^11.0.4",
66
66
  "unist-builder": "^4.0.0",
67
- "unist-util-visit": "^5.0.0"
67
+ "unist-util-visit": "^5.0.0",
68
+ "unwasm": "^0.3.7"
68
69
  },
69
70
  "devDependencies": {
70
71
  "@nuxt/devtools": "latest",
71
72
  "@nuxt/eslint-config": "^0.2.0",
72
- "@nuxt/module-builder": "^0.5.4",
73
- "@nuxt/schema": "^3.8.2",
74
- "@nuxt/test-utils": "^3.9.0",
75
- "@nuxt/ui": "^2.11.1",
73
+ "@nuxt/module-builder": "^0.5.5",
74
+ "@nuxt/schema": "^3.9.3",
75
+ "@nuxt/test-utils": "^3.10.0",
76
+ "@nuxt/ui": "^2.12.2",
76
77
  "@types/mdurl": "^1.0.5",
77
- "@types/node": "^20.10.5",
78
+ "@types/node": "^20.11.5",
78
79
  "changelogen": "^0.5.5",
79
80
  "eslint": "^8.56.0",
80
- "nuxt": "^3.8.2",
81
+ "nuxt": "^3.9.3",
81
82
  "rehype": "^13.0.1",
82
83
  "release-it": "^17.0.1",
83
- "vitest": "^1.1.0"
84
+ "vitest": "^1.2.1"
84
85
  },
85
- "packageManager": "pnpm@8.12.1",
86
+ "packageManager": "pnpm@8.14.1",
86
87
  "release-it": {
87
88
  "git": {
88
89
  "commitMessage": "chore(release): release v${version}"