@ox-content/vite-plugin-react 2.66.0 → 2.68.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/dist/index.d.cts CHANGED
@@ -2,30 +2,62 @@ import { PluginOption } from "vite";
2
2
  import { OxContentOptions, oxContent } from "@ox-content/vite-plugin";
3
3
 
4
4
  //#region src/types.d.ts
5
+ /**
6
+ * Code annotation options for the React integration.
7
+ *
8
+ * The React integration supports the same opt-in fence metadata as the core
9
+ * plugin, but only exposes the attribute key because rendering is handled by
10
+ * the React markdown transform.
11
+ */
5
12
  interface CodeAnnotationsOptions {
13
+ /**
14
+ * Attribute name read from the code fence meta string.
15
+ *
16
+ * @default 'annotate'
17
+ */
6
18
  metaKey?: string;
7
19
  }
8
20
  interface ResolvedCodeAnnotationsOptions {
9
21
  enabled: boolean;
10
22
  metaKey: string;
11
23
  }
24
+ /**
25
+ * Map from Markdown component names to import paths.
26
+ */
12
27
  type ComponentsMap = Record<string, string>;
13
28
  /**
14
29
  * Component registration options.
30
+ *
15
31
  * Can be a map, a glob pattern, or an array of glob patterns.
32
+ * Globbed components are resolved relative to the Vite project root during
33
+ * `configResolved`.
16
34
  */
17
35
  type ComponentsOption = ComponentsMap | string | string[];
36
+ /**
37
+ * React integration plugin options.
38
+ *
39
+ * This extends the core ox-content options with React component registration and
40
+ * JSX runtime controls. Markdown files are transformed into React-aware modules
41
+ * while the core plugin still provides shared parsing, embeds, and environment
42
+ * setup.
43
+ */
18
44
  interface ReactIntegrationOptions extends OxContentOptions {
19
45
  /**
20
46
  * Markdown-like file extensions to process.
47
+ *
48
+ * Values are normalized with a leading dot before matching file paths.
49
+ *
21
50
  * @default ['.md', '.markdown', '.mdx']
22
51
  */
23
52
  extensions?: string[];
24
53
  /**
25
54
  * Components to register for use in Markdown.
55
+ *
26
56
  * Can be a map of names to paths, a glob pattern, or an array of globs.
27
57
  * When using glob patterns, component names are derived from file names.
28
58
  *
59
+ * @default {}
60
+ *
29
61
  * @example
30
62
  * ```ts
31
63
  * // Glob pattern (recommended)
@@ -36,25 +68,101 @@ interface ReactIntegrationOptions extends OxContentOptions {
36
68
  * ```
37
69
  */
38
70
  components?: ComponentsOption;
71
+ /**
72
+ * Enable opt-in line annotations for fenced code blocks.
73
+ *
74
+ * Pass `true` to use the default `annotate` meta key, or an object to change it.
75
+ *
76
+ * @default false
77
+ */
39
78
  codeAnnotations?: boolean | CodeAnnotationsOptions;
79
+ /**
80
+ * JSX runtime used by generated React modules.
81
+ *
82
+ * `automatic` matches modern React setups. Use `classic` only for projects
83
+ * that still require explicit `React.createElement` output.
84
+ *
85
+ * @default 'automatic'
86
+ */
40
87
  jsxRuntime?: "automatic" | "classic";
88
+ /**
89
+ * Built-in static embeds rendered during Markdown transformation.
90
+ *
91
+ * Set to `false` to disable all built-in embeds.
92
+ * Configure individual fetch-related options under `github` and `openGraph`.
93
+ *
94
+ * @default { github: true, openGraph: true }
95
+ */
41
96
  embeds?: BuiltinEmbedOptions | false;
42
97
  }
98
+ /**
99
+ * Fetch options for React GitHub embeds.
100
+ */
43
101
  interface GitHubEmbedOptions {
102
+ /**
103
+ * GitHub API token used for higher rate limits and private repository access.
104
+ * @default ''
105
+ */
44
106
  token?: string;
107
+ /**
108
+ * Cache fetched repository and source data in memory for the current process.
109
+ * @default true
110
+ */
45
111
  cache?: boolean;
112
+ /**
113
+ * Cache TTL in milliseconds.
114
+ * @default 3600000
115
+ */
46
116
  cacheTTL?: number;
117
+ /**
118
+ * Maximum source file size to inline in bytes.
119
+ * @default 200000
120
+ */
47
121
  maxSourceBytes?: number;
122
+ /**
123
+ * Maximum source lines to inline when no line range is specified.
124
+ * @default 120
125
+ */
48
126
  maxSourceLines?: number;
49
127
  }
128
+ /**
129
+ * Fetch options for React Open Graph embeds.
130
+ */
50
131
  interface OpenGraphEmbedOptions {
132
+ /**
133
+ * Request timeout in milliseconds.
134
+ * @default 10000
135
+ */
51
136
  timeout?: number;
137
+ /**
138
+ * Cache fetched Open Graph metadata in memory for the current process.
139
+ * @default true
140
+ */
52
141
  cache?: boolean;
142
+ /**
143
+ * Cache TTL in milliseconds.
144
+ * @default 3600000
145
+ */
53
146
  cacheTTL?: number;
147
+ /**
148
+ * User agent sent with metadata fetch requests.
149
+ * @default 'ox-content-ogp-bot/1.0 (compatible; +https://github.com/ubugeeei-prod/ox-content)'
150
+ */
54
151
  userAgent?: string;
55
152
  }
153
+ /**
154
+ * Built-in embed options for the React integration.
155
+ */
56
156
  interface BuiltinEmbedOptions {
157
+ /**
158
+ * Render `<GitHub repo="owner/name" />` repository cards.
159
+ * @default true
160
+ */
57
161
  github?: boolean | GitHubEmbedOptions;
162
+ /**
163
+ * Render `<OgCard url="https://example.com" />` Open Graph link cards.
164
+ * @default true
165
+ */
58
166
  openGraph?: boolean | OpenGraphEmbedOptions;
59
167
  }
60
168
  interface ResolvedBuiltinEmbedOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;UAEiB,sBAAA;EACf,OAAA;AAAA;AAAA,UAGe,8BAAA;EACf,OAAA;EACA,OAAA;AAAA;AAAA,KAGU,aAAA,GAAgB,MAAA;AAL5B;;;;AAAA,KAWY,gBAAA,GAAmB,aAAA;AAAA,UAEd,uBAAA,SAAgC,gBAAA;EARxB;;;;EAavB,UAAA;EAP0B;;;;AAE5B;;;;;;;;;;EAqBE,UAAA,GAAa,gBAAA;EACb,eAAA,aAA4B,sBAAA;EAC5B,UAAA;EACA,MAAA,GAAS,mBAAA;AAAA;AAAA,UAGM,kBAAA;EACf,KAAA;EACA,KAAA;EACA,QAAA;EACA,cAAA;EACA,cAAA;AAAA;AAAA,UAGe,qBAAA;EACf,OAAA;EACA,KAAA;EACA,QAAA;EACA,SAAA;AAAA;AAAA,UAGe,mBAAA;EACf,MAAA,aAAmB,kBAAA;EACnB,SAAA,aAAsB,qBAAA;AAAA;AAAA,UAGP,2BAAA;EACf,MAAA,EAA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C9D4B;;;;EDoE5B,QAAA;ECpEqE;;;;ED0ErE,SAAA;AAAA;;;;UAMe,mBAAA;;;;;EAKf,MAAA,aAAmB,kBAAA;;;;;EAMnB,SAAA,aAAsB,qBAAA;AAAA;AAAA,UAGP,2BAAA;EACf,MAAA,EAAQ,kBAAA;EACR,SAAA,EAAW,qBAAA;AAAA;AAAA,UAGI,oBAAA;EACf,MAAA;EACA,MAAA;EACA,IAAA;EACA,UAAA;EACA,GAAA;EACA,WAAA;EACA,GAAA;EACA,WAAA;EACA,eAAA,EAAiB,8BAAA;EACjB,UAAA,EAAY,aAAA;EACZ,UAAA;EACA,MAAA,EAAQ,2BAAA;EACR,IAAA;AAAA;AAAA,UAGe,oBAAA;EACf,IAAA;EACA,GAAA;EACA,cAAA;EACA,WAAA,EAAa,MAAA;AAAA;AAAA,UAGE,eAAA;EACf,IAAA;EACA,KAAA,EAAO,MAAA;EACP,QAAA;EACA,EAAA;EACA,OAAA;AAAA;;;;AAxMF;;;;;AAQA;;;;;AASA;;;;;AAUA;;;;;;;iBC8CgB,cAAA,CAAe,OAAA,GAAS,uBAAA,GAA+B,YAAA"}
package/dist/index.d.mts CHANGED
@@ -2,30 +2,62 @@ import { OxContentOptions, oxContent } from "@ox-content/vite-plugin";
2
2
  import { PluginOption } from "vite";
3
3
 
4
4
  //#region src/types.d.ts
5
+ /**
6
+ * Code annotation options for the React integration.
7
+ *
8
+ * The React integration supports the same opt-in fence metadata as the core
9
+ * plugin, but only exposes the attribute key because rendering is handled by
10
+ * the React markdown transform.
11
+ */
5
12
  interface CodeAnnotationsOptions {
13
+ /**
14
+ * Attribute name read from the code fence meta string.
15
+ *
16
+ * @default 'annotate'
17
+ */
6
18
  metaKey?: string;
7
19
  }
8
20
  interface ResolvedCodeAnnotationsOptions {
9
21
  enabled: boolean;
10
22
  metaKey: string;
11
23
  }
24
+ /**
25
+ * Map from Markdown component names to import paths.
26
+ */
12
27
  type ComponentsMap = Record<string, string>;
13
28
  /**
14
29
  * Component registration options.
30
+ *
15
31
  * Can be a map, a glob pattern, or an array of glob patterns.
32
+ * Globbed components are resolved relative to the Vite project root during
33
+ * `configResolved`.
16
34
  */
17
35
  type ComponentsOption = ComponentsMap | string | string[];
36
+ /**
37
+ * React integration plugin options.
38
+ *
39
+ * This extends the core ox-content options with React component registration and
40
+ * JSX runtime controls. Markdown files are transformed into React-aware modules
41
+ * while the core plugin still provides shared parsing, embeds, and environment
42
+ * setup.
43
+ */
18
44
  interface ReactIntegrationOptions extends OxContentOptions {
19
45
  /**
20
46
  * Markdown-like file extensions to process.
47
+ *
48
+ * Values are normalized with a leading dot before matching file paths.
49
+ *
21
50
  * @default ['.md', '.markdown', '.mdx']
22
51
  */
23
52
  extensions?: string[];
24
53
  /**
25
54
  * Components to register for use in Markdown.
55
+ *
26
56
  * Can be a map of names to paths, a glob pattern, or an array of globs.
27
57
  * When using glob patterns, component names are derived from file names.
28
58
  *
59
+ * @default {}
60
+ *
29
61
  * @example
30
62
  * ```ts
31
63
  * // Glob pattern (recommended)
@@ -36,25 +68,101 @@ interface ReactIntegrationOptions extends OxContentOptions {
36
68
  * ```
37
69
  */
38
70
  components?: ComponentsOption;
71
+ /**
72
+ * Enable opt-in line annotations for fenced code blocks.
73
+ *
74
+ * Pass `true` to use the default `annotate` meta key, or an object to change it.
75
+ *
76
+ * @default false
77
+ */
39
78
  codeAnnotations?: boolean | CodeAnnotationsOptions;
79
+ /**
80
+ * JSX runtime used by generated React modules.
81
+ *
82
+ * `automatic` matches modern React setups. Use `classic` only for projects
83
+ * that still require explicit `React.createElement` output.
84
+ *
85
+ * @default 'automatic'
86
+ */
40
87
  jsxRuntime?: "automatic" | "classic";
88
+ /**
89
+ * Built-in static embeds rendered during Markdown transformation.
90
+ *
91
+ * Set to `false` to disable all built-in embeds.
92
+ * Configure individual fetch-related options under `github` and `openGraph`.
93
+ *
94
+ * @default { github: true, openGraph: true }
95
+ */
41
96
  embeds?: BuiltinEmbedOptions | false;
42
97
  }
98
+ /**
99
+ * Fetch options for React GitHub embeds.
100
+ */
43
101
  interface GitHubEmbedOptions {
102
+ /**
103
+ * GitHub API token used for higher rate limits and private repository access.
104
+ * @default ''
105
+ */
44
106
  token?: string;
107
+ /**
108
+ * Cache fetched repository and source data in memory for the current process.
109
+ * @default true
110
+ */
45
111
  cache?: boolean;
112
+ /**
113
+ * Cache TTL in milliseconds.
114
+ * @default 3600000
115
+ */
46
116
  cacheTTL?: number;
117
+ /**
118
+ * Maximum source file size to inline in bytes.
119
+ * @default 200000
120
+ */
47
121
  maxSourceBytes?: number;
122
+ /**
123
+ * Maximum source lines to inline when no line range is specified.
124
+ * @default 120
125
+ */
48
126
  maxSourceLines?: number;
49
127
  }
128
+ /**
129
+ * Fetch options for React Open Graph embeds.
130
+ */
50
131
  interface OpenGraphEmbedOptions {
132
+ /**
133
+ * Request timeout in milliseconds.
134
+ * @default 10000
135
+ */
51
136
  timeout?: number;
137
+ /**
138
+ * Cache fetched Open Graph metadata in memory for the current process.
139
+ * @default true
140
+ */
52
141
  cache?: boolean;
142
+ /**
143
+ * Cache TTL in milliseconds.
144
+ * @default 3600000
145
+ */
53
146
  cacheTTL?: number;
147
+ /**
148
+ * User agent sent with metadata fetch requests.
149
+ * @default 'ox-content-ogp-bot/1.0 (compatible; +https://github.com/ubugeeei-prod/ox-content)'
150
+ */
54
151
  userAgent?: string;
55
152
  }
153
+ /**
154
+ * Built-in embed options for the React integration.
155
+ */
56
156
  interface BuiltinEmbedOptions {
157
+ /**
158
+ * Render `<GitHub repo="owner/name" />` repository cards.
159
+ * @default true
160
+ */
57
161
  github?: boolean | GitHubEmbedOptions;
162
+ /**
163
+ * Render `<OgCard url="https://example.com" />` Open Graph link cards.
164
+ * @default true
165
+ */
58
166
  openGraph?: boolean | OpenGraphEmbedOptions;
59
167
  }
60
168
  interface ResolvedBuiltinEmbedOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;UAE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;;;iBC8CgB,cAAA,CAAe,OAAA,GAAS,uBAAA,GAA+B,YAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/vite-plugin-react",
3
- "version": "2.66.0",
3
+ "version": "2.68.0",
4
4
  "description": "React integration for Ox Content - Embed React components in Markdown",
5
5
  "keywords": [
6
6
  "markdown",
@@ -35,8 +35,8 @@
35
35
  "provenance": true
36
36
  },
37
37
  "dependencies": {
38
- "@ox-content/islands": "2.66.0",
39
- "@ox-content/vite-plugin": "2.66.0"
38
+ "@ox-content/islands": "2.68.0",
39
+ "@ox-content/vite-plugin": "2.68.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^25.8.0",