@ox-content/vite-plugin-solid 2.81.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/LICENSE +21 -0
- package/dist/index.cjs +701 -0
- package/dist/index.d.cts +252 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +252 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +672 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +60 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { PluginOption } from "vite";
|
|
2
|
+
import { OxContentOptions, oxContent } from "@ox-content/vite-plugin";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Code annotation options for the Solid integration.
|
|
7
|
+
*
|
|
8
|
+
* The Solid 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 Solid markdown transform.
|
|
11
|
+
*/
|
|
12
|
+
interface CodeAnnotationsOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Attribute name read from the code fence meta string.
|
|
15
|
+
*
|
|
16
|
+
* @default 'annotate'
|
|
17
|
+
*/
|
|
18
|
+
metaKey?: string;
|
|
19
|
+
}
|
|
20
|
+
interface ResolvedCodeAnnotationsOptions {
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
metaKey: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Map from Markdown component names to import paths.
|
|
26
|
+
*/
|
|
27
|
+
type ComponentsMap = Record<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Component registration options.
|
|
30
|
+
*
|
|
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`.
|
|
34
|
+
*/
|
|
35
|
+
type ComponentsOption = ComponentsMap | string | string[];
|
|
36
|
+
/**
|
|
37
|
+
* Solid integration plugin options.
|
|
38
|
+
*
|
|
39
|
+
* This extends the core ox-content options with Solid component registration.
|
|
40
|
+
* Markdown files are transformed into Solid JSX modules while the core plugin
|
|
41
|
+
* still provides shared parsing, embeds, and environment setup.
|
|
42
|
+
*
|
|
43
|
+
* Solid has no runtime JSX factory, so the generated modules must still be
|
|
44
|
+
* compiled by `vite-plugin-solid`. See {@link SolidIntegrationOptions.verifySolidPlugin}.
|
|
45
|
+
*/
|
|
46
|
+
interface SolidIntegrationOptions extends OxContentOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Markdown-like file extensions to process.
|
|
49
|
+
*
|
|
50
|
+
* Values are normalized with a leading dot before matching file paths.
|
|
51
|
+
*
|
|
52
|
+
* @default ['.md', '.markdown', '.mdx']
|
|
53
|
+
*/
|
|
54
|
+
extensions?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Components to register for use in Markdown.
|
|
57
|
+
*
|
|
58
|
+
* Can be a map of names to paths, a glob pattern, or an array of globs.
|
|
59
|
+
* When using glob patterns, component names are derived from file names.
|
|
60
|
+
*
|
|
61
|
+
* @default {}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* // Glob pattern (recommended)
|
|
66
|
+
* components: './src/components/*.tsx'
|
|
67
|
+
*
|
|
68
|
+
* // Explicit map
|
|
69
|
+
* components: { Counter: './src/components/Counter.tsx' }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
components?: ComponentsOption;
|
|
73
|
+
/**
|
|
74
|
+
* Enable opt-in line annotations for fenced code blocks.
|
|
75
|
+
*
|
|
76
|
+
* Pass `true` to use the default `annotate` meta key, or an object to change it.
|
|
77
|
+
*
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
codeAnnotations?: boolean | CodeAnnotationsOptions;
|
|
81
|
+
/**
|
|
82
|
+
* Fail fast when `vite-plugin-solid` cannot compile the generated modules.
|
|
83
|
+
*
|
|
84
|
+
* Markdown files are emitted as Solid JSX, and Solid's JSX has no runtime
|
|
85
|
+
* factory to fall back on: it only works after `babel-preset-solid` has
|
|
86
|
+
* compiled it. `vite-plugin-solid` only looks at `.jsx`/`.tsx` ids unless its
|
|
87
|
+
* own `extensions` option lists the Markdown extensions too, so a missing
|
|
88
|
+
* entry surfaces as an opaque syntax error in an unrelated file.
|
|
89
|
+
*
|
|
90
|
+
* With this enabled the plugin checks the resolved plugin list and throws a
|
|
91
|
+
* message naming the extensions that are missing. Turn it off when Solid JSX
|
|
92
|
+
* is compiled by something other than `vite-plugin-solid`.
|
|
93
|
+
*
|
|
94
|
+
* @default true
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* plugins: [
|
|
99
|
+
* solid({ extensions: ['.md', '.markdown', '.mdx'] }),
|
|
100
|
+
* oxContentSolid({ srcDir: 'docs' }),
|
|
101
|
+
* ]
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
verifySolidPlugin?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Built-in static embeds rendered during Markdown transformation.
|
|
107
|
+
*
|
|
108
|
+
* Set to `false` to disable all built-in embeds.
|
|
109
|
+
* Configure individual fetch-related options under `github` and `openGraph`.
|
|
110
|
+
*
|
|
111
|
+
* @default { github: true, openGraph: true }
|
|
112
|
+
*/
|
|
113
|
+
embeds?: BuiltinEmbedOptions | false;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Fetch options for Solid GitHub embeds.
|
|
117
|
+
*/
|
|
118
|
+
interface GitHubEmbedOptions {
|
|
119
|
+
/**
|
|
120
|
+
* GitHub API token used for higher rate limits and private repository access.
|
|
121
|
+
* @default ''
|
|
122
|
+
*/
|
|
123
|
+
token?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Cache fetched repository and source data in memory for the current process.
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
cache?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Cache TTL in milliseconds.
|
|
131
|
+
* @default 3600000
|
|
132
|
+
*/
|
|
133
|
+
cacheTTL?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Maximum source file size to inline in bytes.
|
|
136
|
+
* @default 200000
|
|
137
|
+
*/
|
|
138
|
+
maxSourceBytes?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Maximum source lines to inline when no line range is specified.
|
|
141
|
+
* @default 120
|
|
142
|
+
*/
|
|
143
|
+
maxSourceLines?: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Fetch options for Solid Open Graph embeds.
|
|
147
|
+
*/
|
|
148
|
+
interface OpenGraphEmbedOptions {
|
|
149
|
+
/**
|
|
150
|
+
* Request timeout in milliseconds.
|
|
151
|
+
* @default 10000
|
|
152
|
+
*/
|
|
153
|
+
timeout?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Cache fetched Open Graph metadata in memory for the current process.
|
|
156
|
+
* @default true
|
|
157
|
+
*/
|
|
158
|
+
cache?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Cache TTL in milliseconds.
|
|
161
|
+
* @default 3600000
|
|
162
|
+
*/
|
|
163
|
+
cacheTTL?: number;
|
|
164
|
+
/**
|
|
165
|
+
* User agent sent with metadata fetch requests.
|
|
166
|
+
* @default 'ox-content-ogp-bot/1.0 (compatible; +https://github.com/ubugeeei-prod/ox-content)'
|
|
167
|
+
*/
|
|
168
|
+
userAgent?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Built-in embed options for the Solid integration.
|
|
172
|
+
*/
|
|
173
|
+
interface BuiltinEmbedOptions {
|
|
174
|
+
/**
|
|
175
|
+
* Render `<GitHub repo="owner/name" />` repository cards.
|
|
176
|
+
* @default true
|
|
177
|
+
*/
|
|
178
|
+
github?: boolean | GitHubEmbedOptions;
|
|
179
|
+
/**
|
|
180
|
+
* Render `<OgCard url="https://example.com" />` Open Graph link cards.
|
|
181
|
+
* @default true
|
|
182
|
+
*/
|
|
183
|
+
openGraph?: boolean | OpenGraphEmbedOptions;
|
|
184
|
+
}
|
|
185
|
+
interface ResolvedBuiltinEmbedOptions {
|
|
186
|
+
github: GitHubEmbedOptions | false;
|
|
187
|
+
openGraph: OpenGraphEmbedOptions | false;
|
|
188
|
+
}
|
|
189
|
+
interface ResolvedSolidOptions {
|
|
190
|
+
srcDir: string;
|
|
191
|
+
outDir: string;
|
|
192
|
+
base: string;
|
|
193
|
+
extensions: string[];
|
|
194
|
+
gfm: boolean;
|
|
195
|
+
autolinks: boolean;
|
|
196
|
+
frontmatter: boolean;
|
|
197
|
+
toc: boolean;
|
|
198
|
+
tocMaxDepth: number;
|
|
199
|
+
codeAnnotations: ResolvedCodeAnnotationsOptions;
|
|
200
|
+
components: ComponentsMap;
|
|
201
|
+
verifySolidPlugin: boolean;
|
|
202
|
+
embeds: ResolvedBuiltinEmbedOptions;
|
|
203
|
+
root?: string;
|
|
204
|
+
}
|
|
205
|
+
interface SolidTransformResult {
|
|
206
|
+
code: string;
|
|
207
|
+
map: null;
|
|
208
|
+
usedComponents: string[];
|
|
209
|
+
frontmatter: Record<string, unknown>;
|
|
210
|
+
}
|
|
211
|
+
interface ComponentIsland {
|
|
212
|
+
name: string;
|
|
213
|
+
props: Record<string, unknown>;
|
|
214
|
+
position: number;
|
|
215
|
+
id: string;
|
|
216
|
+
content?: string;
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/index.d.ts
|
|
220
|
+
/**
|
|
221
|
+
* Creates the Ox Content Solid integration plugin.
|
|
222
|
+
*
|
|
223
|
+
* Unlike the React and Svelte integrations, this plugin must be listed **before**
|
|
224
|
+
* `vite-plugin-solid`, and that plugin must be told about the Markdown
|
|
225
|
+
* extensions. Markdown is turned into Solid JSX here, and Solid's JSX is
|
|
226
|
+
* compile-time only — `vite-plugin-solid` is what turns it into DOM or SSR
|
|
227
|
+
* instructions.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* // vite.config.ts
|
|
232
|
+
* import { defineConfig } from 'vite';
|
|
233
|
+
* import solid from 'vite-plugin-solid';
|
|
234
|
+
* import { oxContentSolid } from '@ox-content/vite-plugin-solid';
|
|
235
|
+
*
|
|
236
|
+
* export default defineConfig({
|
|
237
|
+
* plugins: [
|
|
238
|
+
* oxContentSolid({
|
|
239
|
+
* srcDir: 'docs',
|
|
240
|
+
* components: {
|
|
241
|
+
* Counter: './src/components/Counter.tsx',
|
|
242
|
+
* },
|
|
243
|
+
* }),
|
|
244
|
+
* solid({ extensions: ['.md', '.markdown', '.mdx'] }),
|
|
245
|
+
* ],
|
|
246
|
+
* });
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
declare function oxContentSolid(options?: SolidIntegrationOptions): PluginOption[];
|
|
250
|
+
//#endregion
|
|
251
|
+
export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type GitHubEmbedOptions, type OpenGraphEmbedOptions, type ResolvedBuiltinEmbedOptions, type ResolvedSolidOptions, type SolidIntegrationOptions, type SolidTransformResult, oxContent, oxContentSolid };
|
|
252
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;;;AASA;;;;UAAiB,sBAAA;EASA;;;;;EAHf,OAAA;AAAA;AAAA,UAGe,8BAAA;EACf,OAAA;EACA,OAAA;AAAA;;;;KAMU,aAAA,GAAgB,MAAA;AAqB5B;;;;;;;AAAA,KAZY,gBAAA,GAAmB,aAAA;;;;;;;;;;;UAYd,uBAAA,SAAgC,gBAAA;EAuEnB;AAM9B;;;;;;EArEE,UAAA;EA4FA;;;;AAYF;;;;;;;;;;AA6BA;;;EAlHE,UAAA,GAAa,gBAAA;EAuHb;;;;;;AASF;EAvHE,eAAA,aAA4B,sBAAA;;;;;;;;;AA4H9B;;;;;;;;;;;;;;;EAnGE,iBAAA;EA4GA;;;;;;;;EAlGA,MAAA,GAAS,mBAAA;AAAA;;AA0GX;;UApGiB,kBAAA;EAwGI;;;;EAnGnB,KAAA;EAmGa;;;AAGf;EAhGE,KAAA;;;;;EAMA,QAAA;EA6FA;;;;EAvFA,cAAA;;;;ACrFF;ED2FE,cAAA;AAAA;;;;UAMe,qBAAA;ECjGkE;;;;EDsGjF,OAAA;;;;;EAMA,KAAA;;;;;EAMA,QAAA;;;;;EAMA,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,SAAA;EACA,WAAA;EACA,GAAA;EACA,WAAA;EACA,eAAA,EAAiB,8BAAA;EACjB,UAAA,EAAY,aAAA;EACZ,iBAAA;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;;;;AA1NF;;;;;AAQA;;;;;AASA;;;;;AAYA;;;;;;;;;;;;;iBCegB,cAAA,CAAe,OAAA,GAAS,uBAAA,GAA+B,YAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { OxContentOptions, oxContent } from "@ox-content/vite-plugin";
|
|
2
|
+
import { PluginOption } from "vite";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Code annotation options for the Solid integration.
|
|
7
|
+
*
|
|
8
|
+
* The Solid 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 Solid markdown transform.
|
|
11
|
+
*/
|
|
12
|
+
interface CodeAnnotationsOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Attribute name read from the code fence meta string.
|
|
15
|
+
*
|
|
16
|
+
* @default 'annotate'
|
|
17
|
+
*/
|
|
18
|
+
metaKey?: string;
|
|
19
|
+
}
|
|
20
|
+
interface ResolvedCodeAnnotationsOptions {
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
metaKey: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Map from Markdown component names to import paths.
|
|
26
|
+
*/
|
|
27
|
+
type ComponentsMap = Record<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Component registration options.
|
|
30
|
+
*
|
|
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`.
|
|
34
|
+
*/
|
|
35
|
+
type ComponentsOption = ComponentsMap | string | string[];
|
|
36
|
+
/**
|
|
37
|
+
* Solid integration plugin options.
|
|
38
|
+
*
|
|
39
|
+
* This extends the core ox-content options with Solid component registration.
|
|
40
|
+
* Markdown files are transformed into Solid JSX modules while the core plugin
|
|
41
|
+
* still provides shared parsing, embeds, and environment setup.
|
|
42
|
+
*
|
|
43
|
+
* Solid has no runtime JSX factory, so the generated modules must still be
|
|
44
|
+
* compiled by `vite-plugin-solid`. See {@link SolidIntegrationOptions.verifySolidPlugin}.
|
|
45
|
+
*/
|
|
46
|
+
interface SolidIntegrationOptions extends OxContentOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Markdown-like file extensions to process.
|
|
49
|
+
*
|
|
50
|
+
* Values are normalized with a leading dot before matching file paths.
|
|
51
|
+
*
|
|
52
|
+
* @default ['.md', '.markdown', '.mdx']
|
|
53
|
+
*/
|
|
54
|
+
extensions?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Components to register for use in Markdown.
|
|
57
|
+
*
|
|
58
|
+
* Can be a map of names to paths, a glob pattern, or an array of globs.
|
|
59
|
+
* When using glob patterns, component names are derived from file names.
|
|
60
|
+
*
|
|
61
|
+
* @default {}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* // Glob pattern (recommended)
|
|
66
|
+
* components: './src/components/*.tsx'
|
|
67
|
+
*
|
|
68
|
+
* // Explicit map
|
|
69
|
+
* components: { Counter: './src/components/Counter.tsx' }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
components?: ComponentsOption;
|
|
73
|
+
/**
|
|
74
|
+
* Enable opt-in line annotations for fenced code blocks.
|
|
75
|
+
*
|
|
76
|
+
* Pass `true` to use the default `annotate` meta key, or an object to change it.
|
|
77
|
+
*
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
codeAnnotations?: boolean | CodeAnnotationsOptions;
|
|
81
|
+
/**
|
|
82
|
+
* Fail fast when `vite-plugin-solid` cannot compile the generated modules.
|
|
83
|
+
*
|
|
84
|
+
* Markdown files are emitted as Solid JSX, and Solid's JSX has no runtime
|
|
85
|
+
* factory to fall back on: it only works after `babel-preset-solid` has
|
|
86
|
+
* compiled it. `vite-plugin-solid` only looks at `.jsx`/`.tsx` ids unless its
|
|
87
|
+
* own `extensions` option lists the Markdown extensions too, so a missing
|
|
88
|
+
* entry surfaces as an opaque syntax error in an unrelated file.
|
|
89
|
+
*
|
|
90
|
+
* With this enabled the plugin checks the resolved plugin list and throws a
|
|
91
|
+
* message naming the extensions that are missing. Turn it off when Solid JSX
|
|
92
|
+
* is compiled by something other than `vite-plugin-solid`.
|
|
93
|
+
*
|
|
94
|
+
* @default true
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* plugins: [
|
|
99
|
+
* solid({ extensions: ['.md', '.markdown', '.mdx'] }),
|
|
100
|
+
* oxContentSolid({ srcDir: 'docs' }),
|
|
101
|
+
* ]
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
verifySolidPlugin?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Built-in static embeds rendered during Markdown transformation.
|
|
107
|
+
*
|
|
108
|
+
* Set to `false` to disable all built-in embeds.
|
|
109
|
+
* Configure individual fetch-related options under `github` and `openGraph`.
|
|
110
|
+
*
|
|
111
|
+
* @default { github: true, openGraph: true }
|
|
112
|
+
*/
|
|
113
|
+
embeds?: BuiltinEmbedOptions | false;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Fetch options for Solid GitHub embeds.
|
|
117
|
+
*/
|
|
118
|
+
interface GitHubEmbedOptions {
|
|
119
|
+
/**
|
|
120
|
+
* GitHub API token used for higher rate limits and private repository access.
|
|
121
|
+
* @default ''
|
|
122
|
+
*/
|
|
123
|
+
token?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Cache fetched repository and source data in memory for the current process.
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
cache?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Cache TTL in milliseconds.
|
|
131
|
+
* @default 3600000
|
|
132
|
+
*/
|
|
133
|
+
cacheTTL?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Maximum source file size to inline in bytes.
|
|
136
|
+
* @default 200000
|
|
137
|
+
*/
|
|
138
|
+
maxSourceBytes?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Maximum source lines to inline when no line range is specified.
|
|
141
|
+
* @default 120
|
|
142
|
+
*/
|
|
143
|
+
maxSourceLines?: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Fetch options for Solid Open Graph embeds.
|
|
147
|
+
*/
|
|
148
|
+
interface OpenGraphEmbedOptions {
|
|
149
|
+
/**
|
|
150
|
+
* Request timeout in milliseconds.
|
|
151
|
+
* @default 10000
|
|
152
|
+
*/
|
|
153
|
+
timeout?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Cache fetched Open Graph metadata in memory for the current process.
|
|
156
|
+
* @default true
|
|
157
|
+
*/
|
|
158
|
+
cache?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Cache TTL in milliseconds.
|
|
161
|
+
* @default 3600000
|
|
162
|
+
*/
|
|
163
|
+
cacheTTL?: number;
|
|
164
|
+
/**
|
|
165
|
+
* User agent sent with metadata fetch requests.
|
|
166
|
+
* @default 'ox-content-ogp-bot/1.0 (compatible; +https://github.com/ubugeeei-prod/ox-content)'
|
|
167
|
+
*/
|
|
168
|
+
userAgent?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Built-in embed options for the Solid integration.
|
|
172
|
+
*/
|
|
173
|
+
interface BuiltinEmbedOptions {
|
|
174
|
+
/**
|
|
175
|
+
* Render `<GitHub repo="owner/name" />` repository cards.
|
|
176
|
+
* @default true
|
|
177
|
+
*/
|
|
178
|
+
github?: boolean | GitHubEmbedOptions;
|
|
179
|
+
/**
|
|
180
|
+
* Render `<OgCard url="https://example.com" />` Open Graph link cards.
|
|
181
|
+
* @default true
|
|
182
|
+
*/
|
|
183
|
+
openGraph?: boolean | OpenGraphEmbedOptions;
|
|
184
|
+
}
|
|
185
|
+
interface ResolvedBuiltinEmbedOptions {
|
|
186
|
+
github: GitHubEmbedOptions | false;
|
|
187
|
+
openGraph: OpenGraphEmbedOptions | false;
|
|
188
|
+
}
|
|
189
|
+
interface ResolvedSolidOptions {
|
|
190
|
+
srcDir: string;
|
|
191
|
+
outDir: string;
|
|
192
|
+
base: string;
|
|
193
|
+
extensions: string[];
|
|
194
|
+
gfm: boolean;
|
|
195
|
+
autolinks: boolean;
|
|
196
|
+
frontmatter: boolean;
|
|
197
|
+
toc: boolean;
|
|
198
|
+
tocMaxDepth: number;
|
|
199
|
+
codeAnnotations: ResolvedCodeAnnotationsOptions;
|
|
200
|
+
components: ComponentsMap;
|
|
201
|
+
verifySolidPlugin: boolean;
|
|
202
|
+
embeds: ResolvedBuiltinEmbedOptions;
|
|
203
|
+
root?: string;
|
|
204
|
+
}
|
|
205
|
+
interface SolidTransformResult {
|
|
206
|
+
code: string;
|
|
207
|
+
map: null;
|
|
208
|
+
usedComponents: string[];
|
|
209
|
+
frontmatter: Record<string, unknown>;
|
|
210
|
+
}
|
|
211
|
+
interface ComponentIsland {
|
|
212
|
+
name: string;
|
|
213
|
+
props: Record<string, unknown>;
|
|
214
|
+
position: number;
|
|
215
|
+
id: string;
|
|
216
|
+
content?: string;
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/index.d.ts
|
|
220
|
+
/**
|
|
221
|
+
* Creates the Ox Content Solid integration plugin.
|
|
222
|
+
*
|
|
223
|
+
* Unlike the React and Svelte integrations, this plugin must be listed **before**
|
|
224
|
+
* `vite-plugin-solid`, and that plugin must be told about the Markdown
|
|
225
|
+
* extensions. Markdown is turned into Solid JSX here, and Solid's JSX is
|
|
226
|
+
* compile-time only — `vite-plugin-solid` is what turns it into DOM or SSR
|
|
227
|
+
* instructions.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* // vite.config.ts
|
|
232
|
+
* import { defineConfig } from 'vite';
|
|
233
|
+
* import solid from 'vite-plugin-solid';
|
|
234
|
+
* import { oxContentSolid } from '@ox-content/vite-plugin-solid';
|
|
235
|
+
*
|
|
236
|
+
* export default defineConfig({
|
|
237
|
+
* plugins: [
|
|
238
|
+
* oxContentSolid({
|
|
239
|
+
* srcDir: 'docs',
|
|
240
|
+
* components: {
|
|
241
|
+
* Counter: './src/components/Counter.tsx',
|
|
242
|
+
* },
|
|
243
|
+
* }),
|
|
244
|
+
* solid({ extensions: ['.md', '.markdown', '.mdx'] }),
|
|
245
|
+
* ],
|
|
246
|
+
* });
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
declare function oxContentSolid(options?: SolidIntegrationOptions): PluginOption[];
|
|
250
|
+
//#endregion
|
|
251
|
+
export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type GitHubEmbedOptions, type OpenGraphEmbedOptions, type ResolvedBuiltinEmbedOptions, type ResolvedSolidOptions, type SolidIntegrationOptions, type SolidTransformResult, oxContent, oxContentSolid };
|
|
252
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;;;AASA;;;;UAAiB,sBAAA;EASA;;;;;EAHf,OAAA;AAAA;AAAA,UAGe,8BAAA;EACf,OAAA;EACA,OAAA;AAAA;;;;KAMU,aAAA,GAAgB,MAAA;AAqB5B;;;;;;;AAAA,KAZY,gBAAA,GAAmB,aAAA;;;;;;;;;;;UAYd,uBAAA,SAAgC,gBAAA;EAuEnB;AAM9B;;;;;;EArEE,UAAA;EA4FA;;;;AAYF;;;;;;;;;;AA6BA;;;EAlHE,UAAA,GAAa,gBAAA;EAuHb;;;;;;AASF;EAvHE,eAAA,aAA4B,sBAAA;;;;;;;;;AA4H9B;;;;;;;;;;;;;;;EAnGE,iBAAA;EA4GA;;;;;;;;EAlGA,MAAA,GAAS,mBAAA;AAAA;;AA0GX;;UApGiB,kBAAA;EAwGI;;;;EAnGnB,KAAA;EAmGa;;;AAGf;EAhGE,KAAA;;;;;EAMA,QAAA;EA6FA;;;;EAvFA,cAAA;;;;ACrFF;ED2FE,cAAA;AAAA;;;;UAMe,qBAAA;ECjGkE;;;;EDsGjF,OAAA;;;;;EAMA,KAAA;;;;;EAMA,QAAA;;;;;EAMA,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,SAAA;EACA,WAAA;EACA,GAAA;EACA,WAAA;EACA,eAAA,EAAiB,8BAAA;EACjB,UAAA,EAAY,aAAA;EACZ,iBAAA;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;;;;AA1NF;;;;;AAQA;;;;;AASA;;;;;AAYA;;;;;;;;;;;;;iBCegB,cAAA,CAAe,OAAA,GAAS,uBAAA,GAA+B,YAAA"}
|