@nuxtjs/mdc 0.8.2 → 0.9.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.
Files changed (39) hide show
  1. package/dist/config.d.mts +1 -3
  2. package/dist/config.d.ts +1 -3
  3. package/dist/config.mjs +5 -7
  4. package/dist/module.d.mts +14 -77
  5. package/dist/module.d.ts +14 -77
  6. package/dist/module.json +2 -2
  7. package/dist/module.mjs +2 -4
  8. package/dist/runtime/components/MDC.vue +1 -1
  9. package/dist/runtime/components/MDCRenderer.vue.d.ts +309 -6
  10. package/dist/runtime/components/MDCSlot.vue +1 -1
  11. package/dist/runtime/components/MDCSlot.vue.d.ts +6 -6
  12. package/dist/runtime/components/prose/ProseA.vue +3 -3
  13. package/dist/runtime/components/prose/ProseH1.vue +2 -2
  14. package/dist/runtime/components/prose/ProseH2.vue +3 -3
  15. package/dist/runtime/components/prose/ProseH3.vue +3 -3
  16. package/dist/runtime/components/prose/ProseH4.vue +3 -3
  17. package/dist/runtime/components/prose/ProseH5.vue +3 -3
  18. package/dist/runtime/components/prose/ProseH6.vue +3 -3
  19. package/dist/runtime/components/prose/ProseImg.vue +3 -3
  20. package/dist/runtime/highlighter/shiki.js +36 -20
  21. package/dist/runtime/index.d.ts +1 -1
  22. package/dist/runtime/parser/handlers/code.d.ts +1 -1
  23. package/dist/runtime/parser/handlers/containerComponent.d.ts +1 -1
  24. package/dist/runtime/parser/handlers/emphasis.d.ts +1 -1
  25. package/dist/runtime/parser/handlers/html.d.ts +1 -1
  26. package/dist/runtime/parser/handlers/image.d.ts +1 -1
  27. package/dist/runtime/parser/handlers/inlineCode.d.ts +1 -1
  28. package/dist/runtime/parser/handlers/link.d.ts +1 -1
  29. package/dist/runtime/parser/handlers/list.d.ts +1 -1
  30. package/dist/runtime/parser/handlers/paragraph.d.ts +1 -1
  31. package/dist/runtime/parser/handlers/strong.d.ts +1 -1
  32. package/dist/runtime/parser/index.d.ts +1 -1
  33. package/dist/runtime/parser/utils/plugins.d.ts +2 -1
  34. package/dist/runtime/utils/slot.d.ts +1 -1
  35. package/dist/shared/mdc.4762b8bc.d.mts +66 -0
  36. package/dist/shared/mdc.4762b8bc.d.ts +66 -0
  37. package/dist/types.d.mts +1 -17
  38. package/dist/types.d.ts +1 -17
  39. package/package.json +23 -23
package/dist/config.d.mts CHANGED
@@ -1,6 +1,4 @@
1
- export { defineConfig } from './module.mjs';
2
- import '@nuxt/schema';
1
+ export { d as defineConfig } from './shared/mdc.4762b8bc.mjs';
3
2
  import 'shiki';
4
- import 'remark-rehype';
5
3
  import 'unified';
6
4
  import 'hast';
package/dist/config.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- export { defineConfig } from './module.js';
2
- import '@nuxt/schema';
1
+ export { d as defineConfig } from './shared/mdc.4762b8bc.js';
3
2
  import 'shiki';
4
- import 'remark-rehype';
5
3
  import 'unified';
6
4
  import 'hast';
package/dist/config.mjs CHANGED
@@ -1,7 +1,5 @@
1
- export { defineConfig } from './module.mjs';
2
- import 'node:fs';
3
- import '@nuxt/kit';
4
- import 'defu';
5
- import 'pathe';
6
- import 'node:fs/promises';
7
- import 'scule';
1
+ function defineConfig(config) {
2
+ return config;
3
+ }
4
+
5
+ export { defineConfig };
package/dist/module.d.mts CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { BuiltinTheme, Highlighter as Highlighter$1, ShikiTransformer, HighlighterCore, BundledLanguage, LanguageRegistration, BundledTheme, ThemeRegistrationAny } from 'shiki';
2
+ import { BundledLanguage, LanguageRegistration, BundledTheme, ThemeRegistrationAny } from 'shiki';
3
3
  import { Options } from 'remark-rehype';
4
- import { Processor } from 'unified';
5
- import { ElementContent as ElementContent$1 } from 'hast';
4
+ import { R as RehypeHighlightOption, M as MdcConfig, a as MdcThemeOptions } from './shared/mdc.4762b8bc.mjs';
5
+ export { A as Awaitable, b as HighlightResult, c as Highlighter, H as HighlighterOptions, d as defineConfig } from './shared/mdc.4762b8bc.mjs';
6
+ import 'unified';
7
+ import 'hast';
6
8
 
7
9
  type MDCText = {
8
10
  type: 'text';
@@ -28,65 +30,6 @@ interface MDCData extends Record<string, any> {
28
30
  description: string;
29
31
  }
30
32
 
31
- type MdcThemeOptions = BuiltinTheme | string | Record<string, BuiltinTheme | string>;
32
- interface HighlighterOptions {
33
- highlights?: number[];
34
- meta?: string;
35
- }
36
- interface HighlightResult {
37
- tree: ElementContent$1[];
38
- className?: string;
39
- style?: string;
40
- inlineStyle?: string;
41
- }
42
- type Highlighter = (code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Promise<HighlightResult>;
43
- interface RehypeHighlightOption {
44
- theme?: MdcThemeOptions;
45
- highlighter?: Highlighter;
46
- }
47
-
48
- type Awaitable<T> = T | Promise<T>;
49
- interface MdcConfig {
50
- /**
51
- * Hooks for the unified markdown pipeline
52
- */
53
- unified?: {
54
- /**
55
- * Custom setup for unified processor before other plugins
56
- */
57
- pre?: (processor: Processor) => Awaitable<void | Processor>;
58
- /**
59
- * Custom setup for unified processor after remark but before rehype
60
- */
61
- remark?: (processor: Processor) => Awaitable<void | Processor>;
62
- /**
63
- * Custom setup for unified processor after rehype
64
- */
65
- rehype?: (processor: Processor) => Awaitable<void | Processor>;
66
- /**
67
- * Custom setup for unified processor after all plugins
68
- */
69
- post?: (processor: Processor) => Awaitable<void | Processor>;
70
- };
71
- /**
72
- * Custom hightlighter, available when `highlighter` is set to `custom`
73
- */
74
- highlighter?: Highlighter$1;
75
- /**
76
- * Hooks for shiki
77
- */
78
- shiki?: {
79
- /**
80
- * Get transformers for shiki
81
- */
82
- transformers?: ShikiTransformer[] | ((code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Awaitable<ShikiTransformer[]>);
83
- /**
84
- * Custom setup for shiki instance, only called once on server or client
85
- */
86
- setup?: (highlighter: HighlighterCore) => Awaitable<void>;
87
- };
88
- }
89
-
90
33
  interface TocLink {
91
34
  id: string;
92
35
  text: string;
@@ -224,6 +167,7 @@ interface ModuleOptions {
224
167
  * ```
225
168
  */
226
169
  interface Data$1 {
170
+ [key: string]: unknown;
227
171
  }
228
172
  /**
229
173
  * One place in a source file.
@@ -330,8 +274,7 @@ interface Parent$1 extends Node$1 {
330
274
  * }
331
275
  * ```
332
276
  */
333
- interface Data extends Data$1 {
334
- }
277
+ type Data = Data$1;
335
278
  /**
336
279
  * Info associated with an element.
337
280
  */
@@ -467,8 +410,7 @@ interface Comment extends Literal {
467
410
  /**
468
411
  * Info associated with hast comments by the ecosystem.
469
412
  */
470
- interface CommentData extends Data {
471
- }
413
+ type CommentData = Data;
472
414
  /**
473
415
  * HTML document type.
474
416
  */
@@ -485,8 +427,7 @@ interface Doctype extends Node$1 {
485
427
  /**
486
428
  * Info associated with hast doctypes by the ecosystem.
487
429
  */
488
- interface DoctypeData extends Data {
489
- }
430
+ type DoctypeData = Data;
490
431
  /**
491
432
  * HTML element.
492
433
  */
@@ -520,8 +461,7 @@ interface Element extends Parent {
520
461
  /**
521
462
  * Info associated with hast elements by the ecosystem.
522
463
  */
523
- interface ElementData extends Data {
524
- }
464
+ type ElementData = Data;
525
465
  /**
526
466
  * Document fragment or a whole document.
527
467
  *
@@ -546,8 +486,7 @@ interface Root extends Parent {
546
486
  /**
547
487
  * Info associated with hast root nodes by the ecosystem.
548
488
  */
549
- interface RootData extends Data {
550
- }
489
+ type RootData = Data;
551
490
  /**
552
491
  * HTML character data (plain text).
553
492
  */
@@ -564,12 +503,10 @@ interface Text extends Literal {
564
503
  /**
565
504
  * Info associated with hast texts by the ecosystem.
566
505
  */
567
- interface TextData extends Data {
568
- }
506
+ type TextData = Data;
569
507
 
570
- declare function defineConfig(config: MdcConfig): MdcConfig;
571
508
  declare const DefaultHighlightLangs: BundledLanguage[];
572
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
509
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
573
510
 
574
511
  declare module '@nuxt/schema' {
575
512
  interface NuxtHooks {
@@ -600,4 +537,4 @@ declare module '@nuxt/schema' {
600
537
  }
601
538
  }
602
539
 
603
- export { type Awaitable, type Comment, type CommentData, type Content, type Data, DefaultHighlightLangs, type Doctype, type DoctypeData, type Element, type ElementContent, type ElementContentMap, type ElementData, type HighlightResult, type Highlighter, type HighlighterOptions, type Literal, type Literals, type MDCComment, type MDCData, type MDCElement, type MDCNode, type MDCParseOptions, type MDCParserResult, type MDCRoot, type MDCText, type MdcConfig, type MdcThemeOptions, type ModuleOptions, type Node, type Nodes, type Parent, type Parents, type Properties, type RehypeHighlightOption, type RehypePlugin, type RemarkPlugin, type Root, type RootContent, type RootContentMap, type RootData, type Text, type TextData, type Toc, type TocLink, type UnistPlugin, _default as default, defineConfig };
540
+ export { type Comment, type CommentData, type Content, type Data, DefaultHighlightLangs, type Doctype, type DoctypeData, type Element, type ElementContent, type ElementContentMap, type ElementData, type Literal, type Literals, type MDCComment, type MDCData, type MDCElement, type MDCNode, type MDCParseOptions, type MDCParserResult, type MDCRoot, type MDCText, MdcConfig, MdcThemeOptions, type ModuleOptions, type Node, type Nodes, type Parent, type Parents, type Properties, RehypeHighlightOption, type RehypePlugin, type RemarkPlugin, type Root, type RootContent, type RootContentMap, type RootData, type Text, type TextData, type Toc, type TocLink, type UnistPlugin, _default as default };
package/dist/module.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { BuiltinTheme, Highlighter as Highlighter$1, ShikiTransformer, HighlighterCore, BundledLanguage, LanguageRegistration, BundledTheme, ThemeRegistrationAny } from 'shiki';
2
+ import { BundledLanguage, LanguageRegistration, BundledTheme, ThemeRegistrationAny } from 'shiki';
3
3
  import { Options } from 'remark-rehype';
4
- import { Processor } from 'unified';
5
- import { ElementContent as ElementContent$1 } from 'hast';
4
+ import { R as RehypeHighlightOption, M as MdcConfig, a as MdcThemeOptions } from './shared/mdc.4762b8bc.js';
5
+ export { A as Awaitable, b as HighlightResult, c as Highlighter, H as HighlighterOptions, d as defineConfig } from './shared/mdc.4762b8bc.js';
6
+ import 'unified';
7
+ import 'hast';
6
8
 
7
9
  type MDCText = {
8
10
  type: 'text';
@@ -28,65 +30,6 @@ interface MDCData extends Record<string, any> {
28
30
  description: string;
29
31
  }
30
32
 
31
- type MdcThemeOptions = BuiltinTheme | string | Record<string, BuiltinTheme | string>;
32
- interface HighlighterOptions {
33
- highlights?: number[];
34
- meta?: string;
35
- }
36
- interface HighlightResult {
37
- tree: ElementContent$1[];
38
- className?: string;
39
- style?: string;
40
- inlineStyle?: string;
41
- }
42
- type Highlighter = (code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Promise<HighlightResult>;
43
- interface RehypeHighlightOption {
44
- theme?: MdcThemeOptions;
45
- highlighter?: Highlighter;
46
- }
47
-
48
- type Awaitable<T> = T | Promise<T>;
49
- interface MdcConfig {
50
- /**
51
- * Hooks for the unified markdown pipeline
52
- */
53
- unified?: {
54
- /**
55
- * Custom setup for unified processor before other plugins
56
- */
57
- pre?: (processor: Processor) => Awaitable<void | Processor>;
58
- /**
59
- * Custom setup for unified processor after remark but before rehype
60
- */
61
- remark?: (processor: Processor) => Awaitable<void | Processor>;
62
- /**
63
- * Custom setup for unified processor after rehype
64
- */
65
- rehype?: (processor: Processor) => Awaitable<void | Processor>;
66
- /**
67
- * Custom setup for unified processor after all plugins
68
- */
69
- post?: (processor: Processor) => Awaitable<void | Processor>;
70
- };
71
- /**
72
- * Custom hightlighter, available when `highlighter` is set to `custom`
73
- */
74
- highlighter?: Highlighter$1;
75
- /**
76
- * Hooks for shiki
77
- */
78
- shiki?: {
79
- /**
80
- * Get transformers for shiki
81
- */
82
- transformers?: ShikiTransformer[] | ((code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Awaitable<ShikiTransformer[]>);
83
- /**
84
- * Custom setup for shiki instance, only called once on server or client
85
- */
86
- setup?: (highlighter: HighlighterCore) => Awaitable<void>;
87
- };
88
- }
89
-
90
33
  interface TocLink {
91
34
  id: string;
92
35
  text: string;
@@ -224,6 +167,7 @@ interface ModuleOptions {
224
167
  * ```
225
168
  */
226
169
  interface Data$1 {
170
+ [key: string]: unknown;
227
171
  }
228
172
  /**
229
173
  * One place in a source file.
@@ -330,8 +274,7 @@ interface Parent$1 extends Node$1 {
330
274
  * }
331
275
  * ```
332
276
  */
333
- interface Data extends Data$1 {
334
- }
277
+ type Data = Data$1;
335
278
  /**
336
279
  * Info associated with an element.
337
280
  */
@@ -467,8 +410,7 @@ interface Comment extends Literal {
467
410
  /**
468
411
  * Info associated with hast comments by the ecosystem.
469
412
  */
470
- interface CommentData extends Data {
471
- }
413
+ type CommentData = Data;
472
414
  /**
473
415
  * HTML document type.
474
416
  */
@@ -485,8 +427,7 @@ interface Doctype extends Node$1 {
485
427
  /**
486
428
  * Info associated with hast doctypes by the ecosystem.
487
429
  */
488
- interface DoctypeData extends Data {
489
- }
430
+ type DoctypeData = Data;
490
431
  /**
491
432
  * HTML element.
492
433
  */
@@ -520,8 +461,7 @@ interface Element extends Parent {
520
461
  /**
521
462
  * Info associated with hast elements by the ecosystem.
522
463
  */
523
- interface ElementData extends Data {
524
- }
464
+ type ElementData = Data;
525
465
  /**
526
466
  * Document fragment or a whole document.
527
467
  *
@@ -546,8 +486,7 @@ interface Root extends Parent {
546
486
  /**
547
487
  * Info associated with hast root nodes by the ecosystem.
548
488
  */
549
- interface RootData extends Data {
550
- }
489
+ type RootData = Data;
551
490
  /**
552
491
  * HTML character data (plain text).
553
492
  */
@@ -564,12 +503,10 @@ interface Text extends Literal {
564
503
  /**
565
504
  * Info associated with hast texts by the ecosystem.
566
505
  */
567
- interface TextData extends Data {
568
- }
506
+ type TextData = Data;
569
507
 
570
- declare function defineConfig(config: MdcConfig): MdcConfig;
571
508
  declare const DefaultHighlightLangs: BundledLanguage[];
572
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
509
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
573
510
 
574
511
  declare module '@nuxt/schema' {
575
512
  interface NuxtHooks {
@@ -600,4 +537,4 @@ declare module '@nuxt/schema' {
600
537
  }
601
538
  }
602
539
 
603
- export { type Awaitable, type Comment, type CommentData, type Content, type Data, DefaultHighlightLangs, type Doctype, type DoctypeData, type Element, type ElementContent, type ElementContentMap, type ElementData, type HighlightResult, type Highlighter, type HighlighterOptions, type Literal, type Literals, type MDCComment, type MDCData, type MDCElement, type MDCNode, type MDCParseOptions, type MDCParserResult, type MDCRoot, type MDCText, type MdcConfig, type MdcThemeOptions, type ModuleOptions, type Node, type Nodes, type Parent, type Parents, type Properties, type RehypeHighlightOption, type RehypePlugin, type RemarkPlugin, type Root, type RootContent, type RootContentMap, type RootData, type Text, type TextData, type Toc, type TocLink, type UnistPlugin, _default as default, defineConfig };
540
+ export { type Comment, type CommentData, type Content, type Data, DefaultHighlightLangs, type Doctype, type DoctypeData, type Element, type ElementContent, type ElementContentMap, type ElementData, type Literal, type Literals, type MDCComment, type MDCData, type MDCElement, type MDCNode, type MDCParseOptions, type MDCParserResult, type MDCRoot, type MDCText, MdcConfig, MdcThemeOptions, type ModuleOptions, type Node, type Nodes, type Parent, type Parents, type Properties, RehypeHighlightOption, type RehypePlugin, type RemarkPlugin, type Root, type RootContent, type RootContentMap, type RootData, type Text, type TextData, type Toc, type TocLink, type UnistPlugin, _default as default };
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
3
  "configKey": "mdc",
4
- "version": "0.8.2",
4
+ "version": "0.9.0",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.7.1",
6
+ "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -4,6 +4,7 @@ import { defu } from 'defu';
4
4
  import { resolve } from 'pathe';
5
5
  import fs from 'node:fs/promises';
6
6
  import { pascalCase } from 'scule';
7
+ export { defineConfig } from './config.mjs';
7
8
 
8
9
  const registerMDCSlotTransformer = (resolver) => {
9
10
  extendViteConfig((config) => {
@@ -195,9 +196,6 @@ function addWasmSupport(nuxt) {
195
196
  });
196
197
  }
197
198
 
198
- function defineConfig(config) {
199
- return config;
200
- }
201
199
  const DefaultHighlightLangs = [
202
200
  "js",
203
201
  "jsx",
@@ -402,4 +400,4 @@ function resolveOptions(options) {
402
400
  }
403
401
  }
404
402
 
405
- export { DefaultHighlightLangs, module as default, defineConfig };
403
+ export { DefaultHighlightLangs, module as default };
@@ -8,7 +8,7 @@
8
8
  >
9
9
  <MDCRenderer
10
10
  v-if="body"
11
- :tag="tag"
11
+ :tag="props.tag"
12
12
  :class="props.class"
13
13
  :body="body"
14
14
  :data="data?.data"