@nuxtjs/mdc 0.13.5 → 0.15.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/README.md +17 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/MDC.vue +9 -1
- package/dist/runtime/components/MDCRenderer.vue +8 -1
- package/dist/runtime/components/MDCRenderer.vue.d.ts +15 -211
- package/dist/runtime/highlighter/shiki.d.ts +1 -1
- package/dist/runtime/highlighter/shiki.js +2 -1
- package/dist/runtime/parser/index.js +11 -2
- package/dist/runtime/stringify/mdc-remark.js +1 -0
- package/dist/runtime/utils/slot.d.ts +1 -1
- package/package.json +26 -19
package/README.md
CHANGED
|
@@ -135,6 +135,23 @@ export default defineNuxtConfig({
|
|
|
135
135
|
})
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
In order to customize these components yourself simply make a component with the same name of the prose component you are trying to take control over. Make sure to put these prose components in their own prose folder and tell nuxt to globally register them so that MDC can get proper access.
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
export default defineNuxtConfig({
|
|
142
|
+
modules: ['@nuxtjs/mdc'],
|
|
143
|
+
mdc: {
|
|
144
|
+
components: {
|
|
145
|
+
prose: true
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
components: {
|
|
149
|
+
global: true,
|
|
150
|
+
path: './components/prose'
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
```
|
|
154
|
+
|
|
138
155
|
Here is the list of available prose components:
|
|
139
156
|
|
|
140
157
|
| Tag | Component | Source | Description |
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -104,7 +104,7 @@ async function mdcHighlighter({
|
|
|
104
104
|
} = options;
|
|
105
105
|
return [
|
|
106
106
|
"import { getMdcConfigs } from '#mdc-configs'",
|
|
107
|
-
shikiEngine === "javascript" ? "import { createJavaScriptRegexEngine } from 'shiki/engine/javascript'" : "import {
|
|
107
|
+
shikiEngine === "javascript" ? "import { createJavaScriptRegexEngine } from 'shiki/engine/javascript'" : "import { createOnigurumaEngine } from 'shiki/engine/oniguruma'",
|
|
108
108
|
code,
|
|
109
109
|
"const bundledLangs = {",
|
|
110
110
|
...Array.from(langsMap.entries()).map(([name, lang]) => typeof lang === "string" ? JSON.stringify(name) + `: () => import('shiki/langs/${lang}.mjs'),` : JSON.stringify(name) + ": " + JSON.stringify(lang) + ","),
|
|
@@ -116,7 +116,7 @@ async function mdcHighlighter({
|
|
|
116
116
|
theme: options.theme,
|
|
117
117
|
wrapperStyle: options.wrapperStyle
|
|
118
118
|
}),
|
|
119
|
-
shikiEngine === "javascript" ? "const engine = createJavaScriptRegexEngine({ forgiving: true })" : `const engine =
|
|
119
|
+
shikiEngine === "javascript" ? "const engine = createJavaScriptRegexEngine({ forgiving: true })" : `const engine = createOnigurumaEngine(() => import('shiki/wasm'))`,
|
|
120
120
|
"const highlighter = createShikiHighlighter({ bundledLangs, bundledThemes, options, getMdcConfigs, engine })",
|
|
121
121
|
"export default highlighter"
|
|
122
122
|
].join("\n");
|
|
@@ -64,10 +64,18 @@ const props = defineProps({
|
|
|
64
64
|
unwrap: {
|
|
65
65
|
type: [Boolean, String],
|
|
66
66
|
default: false
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Async Data Unique Key
|
|
70
|
+
* @default `hash(props.value)`
|
|
71
|
+
*/
|
|
72
|
+
cacheKey: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: undefined
|
|
67
75
|
}
|
|
68
76
|
})
|
|
69
77
|
|
|
70
|
-
const key = computed(() => hash(props.value))
|
|
78
|
+
const key = computed(() => props.cacheKey ?? hash(props.value))
|
|
71
79
|
|
|
72
80
|
const { data, refresh, error } = await useAsyncData(key.value, async () => {
|
|
73
81
|
if (typeof props.value !== 'string') {
|
|
@@ -4,7 +4,7 @@ import destr from "destr";
|
|
|
4
4
|
import { kebabCase, pascalCase } from "scule";
|
|
5
5
|
import { find, html } from "property-information";
|
|
6
6
|
import htmlTags from "../parser/utils/html-tags-list";
|
|
7
|
-
import { flatUnwrap } from "../utils/node";
|
|
7
|
+
import { flatUnwrap, nodeTextContent } from "../utils/node";
|
|
8
8
|
import { pick } from "../utils";
|
|
9
9
|
const DEFAULT_SLOT = "default";
|
|
10
10
|
const rxOn = /^@|^v-on:/;
|
|
@@ -137,6 +137,13 @@ function _renderNode(node, h2, options) {
|
|
|
137
137
|
return renderBinding(node, h2, documentMeta, parentScope);
|
|
138
138
|
}
|
|
139
139
|
const _resolveComponent = isUnresolvableTag(renderTag) ? (component2) => component2 : resolveComponent;
|
|
140
|
+
if (renderTag === "script") {
|
|
141
|
+
return h2(
|
|
142
|
+
"pre",
|
|
143
|
+
{ class: "script-to-pre" },
|
|
144
|
+
"<script>\n" + nodeTextContent(node) + "\n<\/script>"
|
|
145
|
+
);
|
|
146
|
+
}
|
|
140
147
|
const component = _resolveComponent(renderTag);
|
|
141
148
|
if (typeof component === "object") {
|
|
142
149
|
component.tag = originalTag;
|
|
@@ -121,12 +121,6 @@ declare const _default: DefineComponent<import("vue").ExtractPropTypes<{
|
|
|
121
121
|
unwrap: string | boolean;
|
|
122
122
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
123
123
|
export default _default;
|
|
124
|
-
declare module 'vue' {
|
|
125
|
-
interface GlobalComponents {
|
|
126
|
-
}
|
|
127
|
-
interface GlobalDirectives {
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
124
|
declare global {
|
|
131
125
|
const __VLS_intrinsicElements: __VLS_IntrinsicElements;
|
|
132
126
|
const __VLS_directiveBindingRestFields: {
|
|
@@ -137,192 +131,22 @@ declare global {
|
|
|
137
131
|
};
|
|
138
132
|
const __VLS_unref: typeof import('vue').unref;
|
|
139
133
|
const __VLS_placeholder: any;
|
|
140
|
-
|
|
141
|
-
a: HTMLAnchorElement;
|
|
142
|
-
abbr: HTMLElement;
|
|
143
|
-
address: HTMLElement;
|
|
144
|
-
area: HTMLAreaElement;
|
|
145
|
-
article: HTMLElement;
|
|
146
|
-
aside: HTMLElement;
|
|
147
|
-
audio: HTMLAudioElement;
|
|
148
|
-
b: HTMLElement;
|
|
149
|
-
base: HTMLBaseElement;
|
|
150
|
-
bdi: HTMLElement;
|
|
151
|
-
bdo: HTMLElement;
|
|
152
|
-
blockquote: HTMLQuoteElement;
|
|
153
|
-
body: HTMLBodyElement;
|
|
154
|
-
br: HTMLBRElement;
|
|
155
|
-
button: HTMLButtonElement;
|
|
156
|
-
canvas: HTMLCanvasElement;
|
|
157
|
-
caption: HTMLTableCaptionElement;
|
|
158
|
-
cite: HTMLElement;
|
|
159
|
-
code: HTMLElement;
|
|
160
|
-
col: HTMLTableColElement;
|
|
161
|
-
colgroup: HTMLTableColElement;
|
|
162
|
-
data: HTMLDataElement;
|
|
163
|
-
datalist: HTMLDataListElement;
|
|
164
|
-
dd: HTMLElement;
|
|
165
|
-
del: HTMLModElement;
|
|
166
|
-
details: HTMLDetailsElement;
|
|
167
|
-
dfn: HTMLElement;
|
|
168
|
-
dialog: HTMLDialogElement;
|
|
169
|
-
div: HTMLDivElement;
|
|
170
|
-
dl: HTMLDListElement;
|
|
171
|
-
dt: HTMLElement;
|
|
172
|
-
em: HTMLElement;
|
|
173
|
-
embed: HTMLEmbedElement;
|
|
174
|
-
fieldset: HTMLFieldSetElement;
|
|
175
|
-
figcaption: HTMLElement;
|
|
176
|
-
figure: HTMLElement;
|
|
177
|
-
footer: HTMLElement;
|
|
178
|
-
form: HTMLFormElement;
|
|
179
|
-
h1: HTMLHeadingElement;
|
|
180
|
-
h2: HTMLHeadingElement;
|
|
181
|
-
h3: HTMLHeadingElement;
|
|
182
|
-
h4: HTMLHeadingElement;
|
|
183
|
-
h5: HTMLHeadingElement;
|
|
184
|
-
h6: HTMLHeadingElement;
|
|
185
|
-
head: HTMLHeadElement;
|
|
186
|
-
header: HTMLElement;
|
|
187
|
-
hgroup: HTMLElement;
|
|
188
|
-
hr: HTMLHRElement;
|
|
189
|
-
html: HTMLHtmlElement;
|
|
190
|
-
i: HTMLElement;
|
|
191
|
-
iframe: HTMLIFrameElement;
|
|
192
|
-
img: HTMLImageElement;
|
|
193
|
-
input: HTMLInputElement;
|
|
194
|
-
ins: HTMLModElement;
|
|
195
|
-
kbd: HTMLElement;
|
|
196
|
-
label: HTMLLabelElement;
|
|
197
|
-
legend: HTMLLegendElement;
|
|
198
|
-
li: HTMLLIElement;
|
|
199
|
-
link: HTMLLinkElement;
|
|
200
|
-
main: HTMLElement;
|
|
201
|
-
map: HTMLMapElement;
|
|
202
|
-
mark: HTMLElement;
|
|
203
|
-
menu: HTMLMenuElement;
|
|
204
|
-
meta: HTMLMetaElement;
|
|
205
|
-
meter: HTMLMeterElement;
|
|
206
|
-
nav: HTMLElement;
|
|
207
|
-
noscript: HTMLElement;
|
|
208
|
-
object: HTMLObjectElement;
|
|
209
|
-
ol: HTMLOListElement;
|
|
210
|
-
optgroup: HTMLOptGroupElement;
|
|
211
|
-
option: HTMLOptionElement;
|
|
212
|
-
output: HTMLOutputElement;
|
|
213
|
-
p: HTMLParagraphElement;
|
|
214
|
-
picture: HTMLPictureElement;
|
|
215
|
-
pre: HTMLPreElement;
|
|
216
|
-
progress: HTMLProgressElement;
|
|
217
|
-
q: HTMLQuoteElement;
|
|
218
|
-
rp: HTMLElement;
|
|
219
|
-
rt: HTMLElement;
|
|
220
|
-
ruby: HTMLElement;
|
|
221
|
-
s: HTMLElement;
|
|
222
|
-
samp: HTMLElement;
|
|
223
|
-
script: HTMLScriptElement;
|
|
224
|
-
search: HTMLElement;
|
|
225
|
-
section: HTMLElement;
|
|
226
|
-
select: HTMLSelectElement;
|
|
227
|
-
slot: HTMLSlotElement;
|
|
228
|
-
small: HTMLElement;
|
|
229
|
-
source: HTMLSourceElement;
|
|
230
|
-
span: HTMLSpanElement;
|
|
231
|
-
strong: HTMLElement;
|
|
232
|
-
style: HTMLStyleElement;
|
|
233
|
-
sub: HTMLElement;
|
|
234
|
-
summary: HTMLElement;
|
|
235
|
-
sup: HTMLElement;
|
|
236
|
-
table: HTMLTableElement;
|
|
237
|
-
tbody: HTMLTableSectionElement;
|
|
238
|
-
td: HTMLTableCellElement;
|
|
239
|
-
template: HTMLTemplateElement;
|
|
240
|
-
textarea: HTMLTextAreaElement;
|
|
241
|
-
tfoot: HTMLTableSectionElement;
|
|
242
|
-
th: HTMLTableCellElement;
|
|
243
|
-
thead: HTMLTableSectionElement;
|
|
244
|
-
time: HTMLTimeElement;
|
|
245
|
-
title: HTMLTitleElement;
|
|
246
|
-
tr: HTMLTableRowElement;
|
|
247
|
-
track: HTMLTrackElement;
|
|
248
|
-
u: HTMLElement;
|
|
249
|
-
ul: HTMLUListElement;
|
|
250
|
-
var: HTMLElement;
|
|
251
|
-
video: HTMLVideoElement;
|
|
252
|
-
wbr: HTMLElement;
|
|
253
|
-
animate: SVGAnimateElement;
|
|
254
|
-
animateMotion: SVGAnimateMotionElement;
|
|
255
|
-
animateTransform: SVGAnimateTransformElement;
|
|
256
|
-
circle: SVGCircleElement;
|
|
257
|
-
clipPath: SVGClipPathElement;
|
|
258
|
-
defs: SVGDefsElement;
|
|
259
|
-
desc: SVGDescElement;
|
|
260
|
-
ellipse: SVGEllipseElement;
|
|
261
|
-
feBlend: SVGFEBlendElement;
|
|
262
|
-
feColorMatrix: SVGFEColorMatrixElement;
|
|
263
|
-
feComponentTransfer: SVGFEComponentTransferElement;
|
|
264
|
-
feComposite: SVGFECompositeElement;
|
|
265
|
-
feConvolveMatrix: SVGFEConvolveMatrixElement;
|
|
266
|
-
feDiffuseLighting: SVGFEDiffuseLightingElement;
|
|
267
|
-
feDisplacementMap: SVGFEDisplacementMapElement;
|
|
268
|
-
feDistantLight: SVGFEDistantLightElement;
|
|
269
|
-
feDropShadow: SVGFEDropShadowElement;
|
|
270
|
-
feFlood: SVGFEFloodElement;
|
|
271
|
-
feFuncA: SVGFEFuncAElement;
|
|
272
|
-
feFuncB: SVGFEFuncBElement;
|
|
273
|
-
feFuncG: SVGFEFuncGElement;
|
|
274
|
-
feFuncR: SVGFEFuncRElement;
|
|
275
|
-
feGaussianBlur: SVGFEGaussianBlurElement;
|
|
276
|
-
feImage: SVGFEImageElement;
|
|
277
|
-
feMerge: SVGFEMergeElement;
|
|
278
|
-
feMergeNode: SVGFEMergeNodeElement;
|
|
279
|
-
feMorphology: SVGFEMorphologyElement;
|
|
280
|
-
feOffset: SVGFEOffsetElement;
|
|
281
|
-
fePointLight: SVGFEPointLightElement;
|
|
282
|
-
feSpecularLighting: SVGFESpecularLightingElement;
|
|
283
|
-
feSpotLight: SVGFESpotLightElement;
|
|
284
|
-
feTile: SVGFETileElement;
|
|
285
|
-
feTurbulence: SVGFETurbulenceElement;
|
|
286
|
-
filter: SVGFilterElement;
|
|
287
|
-
foreignObject: SVGForeignObjectElement;
|
|
288
|
-
g: SVGGElement;
|
|
289
|
-
image: SVGImageElement;
|
|
290
|
-
line: SVGLineElement;
|
|
291
|
-
linearGradient: SVGLinearGradientElement;
|
|
292
|
-
marker: SVGMarkerElement;
|
|
293
|
-
mask: SVGMaskElement;
|
|
294
|
-
metadata: SVGMetadataElement;
|
|
295
|
-
mpath: SVGMPathElement;
|
|
296
|
-
path: SVGPathElement;
|
|
297
|
-
pattern: SVGPatternElement;
|
|
298
|
-
polygon: SVGPolygonElement;
|
|
299
|
-
polyline: SVGPolylineElement;
|
|
300
|
-
radialGradient: SVGRadialGradientElement;
|
|
301
|
-
rect: SVGRectElement;
|
|
302
|
-
set: SVGSetElement;
|
|
303
|
-
stop: SVGStopElement;
|
|
304
|
-
svg: SVGSVGElement;
|
|
305
|
-
switch: SVGSwitchElement;
|
|
306
|
-
symbol: SVGSymbolElement;
|
|
307
|
-
text: SVGTextElement;
|
|
308
|
-
textPath: SVGTextPathElement;
|
|
309
|
-
tspan: SVGTSpanElement;
|
|
310
|
-
use: SVGUseElement;
|
|
311
|
-
view: SVGViewElement;
|
|
312
|
-
};
|
|
134
|
+
type __VLS_NativeElements = __VLS_SpreadMerge<SVGElementTagNameMap, HTMLElementTagNameMap>;
|
|
313
135
|
type __VLS_IntrinsicElements = import('vue/jsx-runtime').JSX.IntrinsicElements;
|
|
314
136
|
type __VLS_Element = import('vue/jsx-runtime').JSX.Element;
|
|
315
|
-
type __VLS_GlobalComponents = import('vue').GlobalComponents
|
|
137
|
+
type __VLS_GlobalComponents = import('vue').GlobalComponents;
|
|
316
138
|
type __VLS_GlobalDirectives = import('vue').GlobalDirectives;
|
|
317
139
|
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
318
140
|
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
319
|
-
type
|
|
320
|
-
type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> = N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
|
|
141
|
+
type __VLS_SpreadMerge<A, B> = Omit<A, keyof B> & B;
|
|
142
|
+
type __VLS_WithComponent<N0 extends string, LocalComponents, Self, N1 extends string, N2 extends string, N3 extends string> = N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
|
|
321
143
|
[K in N0]: LocalComponents[N1];
|
|
322
144
|
} : N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
|
|
323
145
|
[K in N0]: LocalComponents[N2];
|
|
324
146
|
} : N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
|
|
325
147
|
[K in N0]: LocalComponents[N3];
|
|
148
|
+
} : Self extends object ? {
|
|
149
|
+
[K in N0]: Self;
|
|
326
150
|
} : N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
|
|
327
151
|
[K in N0]: __VLS_GlobalComponents[N1];
|
|
328
152
|
} : N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
|
|
@@ -360,32 +184,14 @@ declare global {
|
|
|
360
184
|
type __VLS_PickFunctionalComponentCtx<T, K> = NonNullable<__VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
|
|
361
185
|
__ctx?: infer Ctx;
|
|
362
186
|
} ? Ctx : never : any, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any>>;
|
|
187
|
+
type __VLS_OmitStringIndex<T> = {
|
|
188
|
+
[K in keyof T as string extends K ? never : K]: T[K];
|
|
189
|
+
};
|
|
363
190
|
type __VLS_UseTemplateRef<T> = Readonly<import('vue').ShallowRef<T | null>>;
|
|
364
|
-
function __VLS_getVForSourceType(source:
|
|
365
|
-
|
|
366
|
-
function __VLS_getVForSourceType<T extends any[]>(source: T): [
|
|
367
|
-
item: T[number],
|
|
368
|
-
key: number,
|
|
191
|
+
function __VLS_getVForSourceType<T extends number | string | any[] | Iterable<any>>(source: T): [
|
|
192
|
+
item: T extends number ? number : T extends string ? string : T extends any[] ? T[number] : T extends Iterable<infer T1> ? T1 : any,
|
|
369
193
|
index: number
|
|
370
194
|
][];
|
|
371
|
-
function __VLS_getVForSourceType<T extends {
|
|
372
|
-
[Symbol.iterator](): Iterator<any>;
|
|
373
|
-
}>(source: T): [
|
|
374
|
-
item: T extends {
|
|
375
|
-
[Symbol.iterator](): Iterator<infer T1>;
|
|
376
|
-
} ? T1 : never,
|
|
377
|
-
key: number,
|
|
378
|
-
index: undefined
|
|
379
|
-
][];
|
|
380
|
-
function __VLS_getVForSourceType<T extends number | {
|
|
381
|
-
[Symbol.iterator](): Iterator<any>;
|
|
382
|
-
}>(source: T): [
|
|
383
|
-
item: number | (Exclude<T, number> extends {
|
|
384
|
-
[Symbol.iterator](): Iterator<infer T1>;
|
|
385
|
-
} ? T1 : never),
|
|
386
|
-
key: number,
|
|
387
|
-
index: undefined
|
|
388
|
-
][];
|
|
389
195
|
function __VLS_getVForSourceType<T>(source: T): [
|
|
390
196
|
item: T[keyof T],
|
|
391
197
|
key: keyof T,
|
|
@@ -393,8 +199,7 @@ declare global {
|
|
|
393
199
|
][];
|
|
394
200
|
function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
|
|
395
201
|
function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
|
|
396
|
-
function __VLS_asFunctionalDirective<T>(dir: T): T extends import('vue').ObjectDirective ? NonNullable<T['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']> : T extends (...args: any) => any ? T :
|
|
397
|
-
function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
|
|
202
|
+
function __VLS_asFunctionalDirective<T>(dir: T): T extends import('vue').ObjectDirective ? NonNullable<T['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']> : T extends (...args: any) => any ? T : (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
|
|
398
203
|
function __VLS_makeOptional<T>(t: T): {
|
|
399
204
|
[K in keyof T]?: T[K];
|
|
400
205
|
};
|
|
@@ -409,11 +214,10 @@ declare global {
|
|
|
409
214
|
emit?: K extends {
|
|
410
215
|
$emit: infer Emit;
|
|
411
216
|
} ? Emit : any;
|
|
412
|
-
|
|
217
|
+
expose?(exposed: K): void;
|
|
413
218
|
props?: (K extends {
|
|
414
219
|
$props: infer Props;
|
|
415
220
|
} ? Props : any) & Record<string, unknown>;
|
|
416
|
-
expose?(exposed: K): void;
|
|
417
221
|
};
|
|
418
222
|
} : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T> : T extends (...args: any) => any ? T : (_: {} & Record<string, unknown>, ctx?: any) => {
|
|
419
223
|
__ctx?: {
|
|
@@ -424,8 +228,8 @@ declare global {
|
|
|
424
228
|
props?: {} & Record<string, unknown>;
|
|
425
229
|
};
|
|
426
230
|
};
|
|
427
|
-
function __VLS_elementAsFunction<T>(tag: T, endTag?: T): (_: T & Record<string, unknown>) => void;
|
|
428
231
|
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
|
|
429
|
-
function
|
|
232
|
+
function __VLS_asFunctionalElement<T>(tag: T, endTag?: T): (attrs: T & Record<string, unknown>) => void;
|
|
233
|
+
function __VLS_asFunctionalSlot<S>(slot: S): (props: NonNullable<S> extends (props: infer P) => any ? P : {}) => void;
|
|
430
234
|
function __VLS_tryAsConstant<const T>(t: T): T;
|
|
431
235
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LanguageInput, type ThemeInput, type RegexEngine } from 'shiki';
|
|
2
2
|
import type { MdcConfig, Highlighter } from '@nuxtjs/mdc';
|
|
3
3
|
export interface CreateShikiHighlighterOptions {
|
|
4
4
|
themes?: ThemeInput[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createJavaScriptRegexEngine } from "shiki";
|
|
1
2
|
export function createShikiHighlighter({
|
|
2
3
|
langs = [],
|
|
3
4
|
themes = [],
|
|
@@ -15,7 +16,7 @@ export function createShikiHighlighter({
|
|
|
15
16
|
const shiki2 = await createHighlighterCore({
|
|
16
17
|
langs,
|
|
17
18
|
themes,
|
|
18
|
-
engine
|
|
19
|
+
engine: engine || createJavaScriptRegexEngine()
|
|
19
20
|
});
|
|
20
21
|
for await (const config of await getConfigs()) {
|
|
21
22
|
await config.shiki?.setup?.(shiki2);
|
|
@@ -73,8 +73,17 @@ export const createMarkdownParser = async (inlineOptions = {}) => {
|
|
|
73
73
|
const processor = await createParseProcessor(inlineOptions);
|
|
74
74
|
return async function parse(md, { fileOptions } = {}) {
|
|
75
75
|
const { content, data: frontmatter } = await parseFrontMatter(md);
|
|
76
|
-
const
|
|
77
|
-
const
|
|
76
|
+
const cwd = typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : "/tmp";
|
|
77
|
+
const processedFile = await new Promise((resolve, reject) => {
|
|
78
|
+
processor.process({ cwd, ...fileOptions, value: content, data: frontmatter }, (err, file) => {
|
|
79
|
+
if (err) {
|
|
80
|
+
reject(err);
|
|
81
|
+
} else {
|
|
82
|
+
resolve(file);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
const result = processedFile?.result;
|
|
78
87
|
const data = Object.assign(
|
|
79
88
|
inlineOptions.contentHeading !== false ? contentHeading(result.body) : {},
|
|
80
89
|
frontmatter,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const renderSlot: (slots: Record<string, any>, name: string, props: any, ...rest: any[]) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
1
|
+
export declare const renderSlot: (slots: Record<string, any>, name: string, props: any, ...rest: any[]) => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/mdc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Nuxt MDC module",
|
|
5
5
|
"repository": "nuxt-modules/mdc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -68,11 +68,12 @@
|
|
|
68
68
|
"lint": "eslint .",
|
|
69
69
|
"typecheck": "nuxt typecheck",
|
|
70
70
|
"test": "vitest run",
|
|
71
|
-
"test:watch": "vitest watch"
|
|
71
|
+
"test:watch": "vitest watch",
|
|
72
|
+
"verify": "npm run dev:prepare && npm run lint && npm run test && npm run typecheck"
|
|
72
73
|
},
|
|
73
74
|
"dependencies": {
|
|
74
|
-
"@nuxt/kit": "^3.15.
|
|
75
|
-
"@shikijs/transformers": "^
|
|
75
|
+
"@nuxt/kit": "^3.15.4",
|
|
76
|
+
"@shikijs/transformers": "^3.0.0",
|
|
76
77
|
"@types/hast": "^3.0.4",
|
|
77
78
|
"@types/mdast": "^4.0.4",
|
|
78
79
|
"@vue/compiler-core": "^3.5.13",
|
|
@@ -83,13 +84,13 @@
|
|
|
83
84
|
"detab": "^3.0.2",
|
|
84
85
|
"github-slugger": "^2.0.0",
|
|
85
86
|
"hast-util-format": "^1.1.0",
|
|
86
|
-
"hast-util-to-mdast": "^10.1.
|
|
87
|
+
"hast-util-to-mdast": "^10.1.2",
|
|
87
88
|
"hast-util-to-string": "^3.0.1",
|
|
88
89
|
"mdast-util-to-hast": "^13.2.0",
|
|
89
90
|
"micromark-util-sanitize-uri": "^2.0.1",
|
|
90
91
|
"ohash": "^1.1.4",
|
|
91
92
|
"parse5": "^7.2.1",
|
|
92
|
-
"pathe": "^2.0.
|
|
93
|
+
"pathe": "^2.0.3",
|
|
93
94
|
"property-information": "^6.5.0",
|
|
94
95
|
"rehype-external-links": "^3.0.0",
|
|
95
96
|
"rehype-minify-whitespace": "^6.0.2",
|
|
@@ -99,13 +100,13 @@
|
|
|
99
100
|
"rehype-sort-attribute-values": "^5.0.1",
|
|
100
101
|
"rehype-sort-attributes": "^5.0.1",
|
|
101
102
|
"remark-emoji": "^5.0.1",
|
|
102
|
-
"remark-gfm": "^4.0.
|
|
103
|
-
"remark-mdc": "^3.5.
|
|
103
|
+
"remark-gfm": "^4.0.1",
|
|
104
|
+
"remark-mdc": "^3.5.3",
|
|
104
105
|
"remark-parse": "^11.0.0",
|
|
105
106
|
"remark-rehype": "^11.1.1",
|
|
106
107
|
"remark-stringify": "^11.0.0",
|
|
107
108
|
"scule": "^1.3.0",
|
|
108
|
-
"shiki": "^
|
|
109
|
+
"shiki": "^3.0.0",
|
|
109
110
|
"ufo": "^1.5.4",
|
|
110
111
|
"unified": "^11.0.5",
|
|
111
112
|
"unist-builder": "^4.0.0",
|
|
@@ -115,26 +116,26 @@
|
|
|
115
116
|
},
|
|
116
117
|
"devDependencies": {
|
|
117
118
|
"@nuxt/devtools": "latest",
|
|
118
|
-
"@nuxt/eslint-config": "^
|
|
119
|
+
"@nuxt/eslint-config": "^1.1.0",
|
|
119
120
|
"@nuxt/module-builder": "^0.8.4",
|
|
120
|
-
"@nuxt/schema": "^3.15.
|
|
121
|
-
"@nuxt/test-utils": "^3.
|
|
121
|
+
"@nuxt/schema": "^3.15.4",
|
|
122
|
+
"@nuxt/test-utils": "^3.17.0",
|
|
122
123
|
"@nuxt/ui": "^2.21.0",
|
|
123
124
|
"@nuxtjs/mdc": "link:.",
|
|
124
|
-
"@types/node": "^22.
|
|
125
|
+
"@types/node": "^22.13.5",
|
|
125
126
|
"changelogen": "^0.5.7",
|
|
126
|
-
"eslint": "^9.
|
|
127
|
-
"nuxt": "^3.15.
|
|
127
|
+
"eslint": "^9.21.0",
|
|
128
|
+
"nuxt": "^3.15.4",
|
|
128
129
|
"rehype": "^13.0.2",
|
|
129
|
-
"release-it": "^18.1.
|
|
130
|
+
"release-it": "^18.1.2",
|
|
130
131
|
"typescript": "5.6.2",
|
|
131
|
-
"vitest": "^3.0.
|
|
132
|
-
"vue-tsc": "^2.2.
|
|
132
|
+
"vitest": "^3.0.7",
|
|
133
|
+
"vue-tsc": "^2.2.4"
|
|
133
134
|
},
|
|
134
135
|
"resolutions": {
|
|
135
136
|
"@nuxtjs/mdc": "workspace:*"
|
|
136
137
|
},
|
|
137
|
-
"packageManager": "pnpm@
|
|
138
|
+
"packageManager": "pnpm@10.4.0",
|
|
138
139
|
"release-it": {
|
|
139
140
|
"git": {
|
|
140
141
|
"commitMessage": "chore(release): release v${version}"
|
|
@@ -146,5 +147,11 @@
|
|
|
146
147
|
"hooks": {
|
|
147
148
|
"after:bump": "npx changelogen@latest --no-commit --no-tag --output --r $(node -p \"require('./package.json').version\")"
|
|
148
149
|
}
|
|
150
|
+
},
|
|
151
|
+
"pnpm": {
|
|
152
|
+
"onlyBuiltDependencies": [
|
|
153
|
+
"@parcel/watcher",
|
|
154
|
+
"esbuild"
|
|
155
|
+
]
|
|
149
156
|
}
|
|
150
157
|
}
|