@ox-content/vite-plugin-solid 2.90.0 → 3.0.0-alpha.10

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.cjs CHANGED
@@ -165,7 +165,8 @@ function resolveSolidOptions(options) {
165
165
  tocMaxDepth: options.tocMaxDepth ?? 3,
166
166
  codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
167
167
  verifySolidPlugin: options.verifySolidPlugin ?? true,
168
- embeds: resolveBuiltinEmbedOptions(options.embeds)
168
+ embeds: resolveBuiltinEmbedOptions(options.embeds),
169
+ mdx: options.mdx
169
170
  };
170
171
  }
171
172
  function normalizeMarkdownExtensions(extensions) {
@@ -217,10 +218,10 @@ function resolveSingleEmbedOptions(options) {
217
218
  * — `vite-plugin-solid` compiles this into DOM or SSR instructions — so unlike
218
219
  * the React and Vue integrations there is no factory-call form to emit.
219
220
  */
220
- function generateSolidModule(content, usedComponents, islands, frontmatter, options, id) {
221
+ function generateSolidModule(content, usedComponents, _islands, frontmatter, options, id, localBindings) {
221
222
  const rawHtml = JSON.stringify(content);
222
223
  const frontmatterLiteral = JSON.stringify(frontmatter);
223
- if (islands.length === 0) return `
224
+ if (usedComponents.length === 0) return `
224
225
  export const frontmatter = ${frontmatterLiteral};
225
226
 
226
227
  const rawHtml = ${rawHtml};
@@ -232,8 +233,13 @@ export default function MarkdownContent() {
232
233
  return `
233
234
  import { onCleanup, onMount } from 'solid-js';
234
235
  import { render } from 'solid-js/web';
235
- import { initIslands } from '@ox-content/islands';
236
- ${renderComponentImports(usedComponents, options, id)}
236
+ import { initIslands, readIslandSlotHtml } from '@ox-content/islands';
237
+ ${(0, _ox_content_vite_plugin.renderIslandComponentImports)(usedComponents, {
238
+ globalComponents: options.components,
239
+ localBindings,
240
+ documentPath: id,
241
+ root: options.root
242
+ })}
237
243
 
238
244
  export const frontmatter = ${frontmatterLiteral};
239
245
 
@@ -250,7 +256,7 @@ function createSolidHydrate() {
250
256
 
251
257
  // Read the slot content before clearing: the island element still holds the
252
258
  // markup the Markdown transform left behind.
253
- const islandContent = element.dataset.oxContent || element.innerHTML;
259
+ const islandContent = readIslandSlotHtml(element);
254
260
  element.innerHTML = '';
255
261
 
256
262
  const dispose = render(
@@ -280,18 +286,6 @@ export default function MarkdownContent() {
280
286
  }
281
287
  `;
282
288
  }
283
- /** Rewrites registered component paths as imports relative to the Markdown file. */
284
- function renderComponentImports(usedComponents, options, id) {
285
- const mdDir = path.dirname(id);
286
- const root = options.root || process.cwd();
287
- return usedComponents.map((name) => {
288
- const componentPath = options.components[name];
289
- if (!componentPath) return "";
290
- const absolutePath = path.resolve(root, componentPath.replace(/^\.\//, ""));
291
- const relativePath = path.relative(mdDir, absolutePath).replace(/\\/g, "/");
292
- return `import ${name} from '${relativePath.startsWith(".") ? relativePath : "./" + relativePath}';`;
293
- }).filter(Boolean).join("\n");
294
- }
295
289
  //#endregion
296
290
  //#region src/markdown.ts
297
291
  const COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\s*([^>]*?)\s*(?:\/>|>([\s\S]*?)<\/\1>)/g;
@@ -452,9 +446,32 @@ async function transformMarkdownWithSolid(code, id, options) {
452
446
  content: code,
453
447
  frontmatter: {}
454
448
  };
449
+ const mdx = (0, _ox_content_vite_plugin.resolveMdxForFilePath)(id, options.mdx);
450
+ const baseOptions = createBaseOptions(options, mdx);
451
+ if (mdx) {
452
+ const transformed = await (0, _ox_content_vite_plugin.transformMarkdown)(markdownContent, id, baseOptions);
453
+ const discovered = await (0, _ox_content_vite_plugin.discoverDocumentMdxIslands)({
454
+ source: markdownContent,
455
+ html: transformed.html,
456
+ components: options.components,
457
+ imports: transformed.imports,
458
+ documentPath: id,
459
+ contentRoot: (0, _ox_content_vite_plugin.resolveContentRootPath)({
460
+ srcDir: options.srcDir,
461
+ root: options.root
462
+ }),
463
+ srcDir: options.srcDir
464
+ });
465
+ return {
466
+ code: generateSolidModule(options.renderIsland ? await (0, _ox_content_vite_plugin.applyIslandSsrHtml)(transformed.html, options.renderIsland, id, discovered.usedComponents) : transformed.html, discovered.usedComponents, discovered.usedComponents, frontmatter, options, id, discovered.localBindings),
467
+ map: null,
468
+ usedComponents: discovered.usedComponents,
469
+ frontmatter
470
+ };
471
+ }
455
472
  const scanned = scanComponents(markdownContent, options.components);
456
473
  return {
457
- code: generateSolidModule(injectIslandMarkers((await (0, _ox_content_vite_plugin.transformMarkdown)(scanned.content, id, createBaseOptions(options))).html, scanned.islands), scanned.usedComponents, scanned.islands, frontmatter, options, id),
474
+ code: generateSolidModule(injectIslandMarkers((await (0, _ox_content_vite_plugin.transformMarkdown)(scanned.content, id, baseOptions)).html, scanned.islands), scanned.usedComponents, scanned.islands, frontmatter, options, id),
458
475
  map: null,
459
476
  usedComponents: scanned.usedComponents,
460
477
  frontmatter
@@ -468,19 +485,27 @@ async function transformMarkdownWithSolid(code, id, options) {
468
485
  * and the host app owns everything around it. Frontmatter is stripped before
469
486
  * this point, so the core parser sees a body-only document.
470
487
  */
471
- function createBaseOptions(options) {
488
+ function createBaseOptions(options, mdx) {
472
489
  return {
473
490
  srcDir: options.srcDir,
474
491
  outDir: options.outDir,
475
492
  base: options.base,
476
493
  extensions: options.extensions,
494
+ mdx,
477
495
  ssg: {
478
496
  enabled: false,
479
497
  extension: ".html",
480
498
  clean: false,
481
499
  bare: false,
482
500
  generateOgImage: false,
483
- lastUpdated: false
501
+ lastUpdated: false,
502
+ pagination: false,
503
+ breadcrumbs: false,
504
+ jsonLd: false,
505
+ readerChrome: false,
506
+ localeSwitcher: false,
507
+ a11y: false,
508
+ pageChrome: false
484
509
  },
485
510
  gfm: options.gfm,
486
511
  frontmatter: false,
@@ -493,8 +518,6 @@ function createBaseOptions(options) {
493
518
  strikethrough: true,
494
519
  autolinks: options.autolinks,
495
520
  highlight: false,
496
- highlightTheme: "github-dark",
497
- highlightLangs: [],
498
521
  mermaid: false,
499
522
  ogImage: false,
500
523
  ogImageOptions: {
@@ -599,7 +622,8 @@ function oxContentSolid(options = {}) {
599
622
  const result = await transformMarkdownWithSolid(code, id, {
600
623
  ...resolved,
601
624
  components: Object.fromEntries(componentMap),
602
- root: config.root
625
+ root: config.root,
626
+ renderIsland: options.renderIsland
603
627
  });
604
628
  return {
605
629
  code: result.code,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PluginOption } from "vite";
2
- import { OxContentOptions, oxContent } from "@ox-content/vite-plugin";
2
+ import { OxContentOptions, RenderIslandFn, oxContent } from "@ox-content/vite-plugin";
3
3
  //#region src/types.d.ts
4
4
  /**
5
5
  * Code annotation options for the Solid integration.
@@ -110,6 +110,12 @@ interface SolidIntegrationOptions extends OxContentOptions {
110
110
  * @default { github: true, openGraph: true }
111
111
  */
112
112
  embeds?: BuiltinEmbedOptions | false;
113
+ /**
114
+ * Optional adapter hook that replaces island inner HTML at transform time.
115
+ * The core renderer stays framework-neutral; do not import a framework SSR
116
+ * runtime from `@ox-content/vite-plugin`.
117
+ */
118
+ renderIsland?: RenderIslandFn;
113
119
  }
114
120
  /**
115
121
  * Fetch options for Solid GitHub embeds.
@@ -199,7 +205,9 @@ interface ResolvedSolidOptions {
199
205
  components: ComponentsMap;
200
206
  verifySolidPlugin: boolean;
201
207
  embeds: ResolvedBuiltinEmbedOptions;
208
+ mdx?: boolean;
202
209
  root?: string;
210
+ renderIsland?: RenderIslandFn;
203
211
  }
204
212
  interface SolidTransformResult {
205
213
  code: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;;;;;;;;;;;UAYd,gCAAgC;;;;;;;;EAQ/C;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;EAyB5B;;;;;;;;;EAUA,SAAS;;;;;UAMM;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf,mBAAmB;;;;;EAMnB,sBAAsB;;UAGP;EACf,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB,YAAY;EACZ;EACA,QAAQ;EACR;;UAGe;EACf;EACA;EACA;EACA,aAAa;;UAGE;EACf;EACA,OAAO;EACP;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBC9Kc,eAAe,UAAS,0BAA+B"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;;;;;;;;;;;UAYd,gCAAgC;;;;;;;;EAQ/C;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;EAyB5B;;;;;;;;;EAUA,SAAS;;;;;;EAOT,eAAe;;;;;UAMA;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf,mBAAmB;;;;;EAMnB,sBAAsB;;UAGP;EACf,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB,YAAY;EACZ;EACA,QAAQ;EACR;EACA;EACA,eAAe;;UAGA;EACf;EACA;EACA;EACA,aAAa;;UAGE;EACf;EACA,OAAO;EACP;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCvLc,eAAe,UAAS,0BAA+B"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { OxContentOptions, oxContent } from "@ox-content/vite-plugin";
1
+ import { OxContentOptions, RenderIslandFn, oxContent } from "@ox-content/vite-plugin";
2
2
  import { PluginOption } from "vite";
3
3
  //#region src/types.d.ts
4
4
  /**
@@ -110,6 +110,12 @@ interface SolidIntegrationOptions extends OxContentOptions {
110
110
  * @default { github: true, openGraph: true }
111
111
  */
112
112
  embeds?: BuiltinEmbedOptions | false;
113
+ /**
114
+ * Optional adapter hook that replaces island inner HTML at transform time.
115
+ * The core renderer stays framework-neutral; do not import a framework SSR
116
+ * runtime from `@ox-content/vite-plugin`.
117
+ */
118
+ renderIsland?: RenderIslandFn;
113
119
  }
114
120
  /**
115
121
  * Fetch options for Solid GitHub embeds.
@@ -199,7 +205,9 @@ interface ResolvedSolidOptions {
199
205
  components: ComponentsMap;
200
206
  verifySolidPlugin: boolean;
201
207
  embeds: ResolvedBuiltinEmbedOptions;
208
+ mdx?: boolean;
202
209
  root?: string;
210
+ renderIsland?: RenderIslandFn;
203
211
  }
204
212
  interface SolidTransformResult {
205
213
  code: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;;;;;;;;;;;UAYd,gCAAgC;;;;;;;;EAQ/C;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;EAyB5B;;;;;;;;;EAUA,SAAS;;;;;UAMM;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf,mBAAmB;;;;;EAMnB,sBAAsB;;UAGP;EACf,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB,YAAY;EACZ;EACA,QAAQ;EACR;;UAGe;EACf;EACA;EACA;EACA,aAAa;;UAGE;EACf;EACA,OAAO;EACP;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBC9Kc,eAAe,UAAS,0BAA+B"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;;;;;;;;;;;UAYd,gCAAgC;;;;;;;;EAQ/C;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;EAyB5B;;;;;;;;;EAUA,SAAS;;;;;;EAOT,eAAe;;;;;UAMA;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf,mBAAmB;;;;;EAMnB,sBAAsB;;UAGP;EACf,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB,YAAY;EACZ;EACA,QAAQ;EACR;EACA;EACA,eAAe;;UAGA;EACf;EACA;EACA;EACA,aAAa;;UAGE;EACf;EACA,OAAO;EACP;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCvLc,eAAe,UAAS,0BAA+B"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { oxContent, oxContent as oxContent$1, transformMarkdown } from "@ox-content/vite-plugin";
1
+ import { applyIslandSsrHtml, discoverDocumentMdxIslands, oxContent, oxContent as oxContent$1, renderIslandComponentImports, resolveContentRootPath, resolveMdxForFilePath, transformMarkdown } from "@ox-content/vite-plugin";
2
2
  import * as fs from "fs";
3
3
  import * as path from "path";
4
4
  //#region src/components.ts
@@ -140,7 +140,8 @@ function resolveSolidOptions(options) {
140
140
  tocMaxDepth: options.tocMaxDepth ?? 3,
141
141
  codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
142
142
  verifySolidPlugin: options.verifySolidPlugin ?? true,
143
- embeds: resolveBuiltinEmbedOptions(options.embeds)
143
+ embeds: resolveBuiltinEmbedOptions(options.embeds),
144
+ mdx: options.mdx
144
145
  };
145
146
  }
146
147
  function normalizeMarkdownExtensions(extensions) {
@@ -192,10 +193,10 @@ function resolveSingleEmbedOptions(options) {
192
193
  * — `vite-plugin-solid` compiles this into DOM or SSR instructions — so unlike
193
194
  * the React and Vue integrations there is no factory-call form to emit.
194
195
  */
195
- function generateSolidModule(content, usedComponents, islands, frontmatter, options, id) {
196
+ function generateSolidModule(content, usedComponents, _islands, frontmatter, options, id, localBindings) {
196
197
  const rawHtml = JSON.stringify(content);
197
198
  const frontmatterLiteral = JSON.stringify(frontmatter);
198
- if (islands.length === 0) return `
199
+ if (usedComponents.length === 0) return `
199
200
  export const frontmatter = ${frontmatterLiteral};
200
201
 
201
202
  const rawHtml = ${rawHtml};
@@ -207,8 +208,13 @@ export default function MarkdownContent() {
207
208
  return `
208
209
  import { onCleanup, onMount } from 'solid-js';
209
210
  import { render } from 'solid-js/web';
210
- import { initIslands } from '@ox-content/islands';
211
- ${renderComponentImports(usedComponents, options, id)}
211
+ import { initIslands, readIslandSlotHtml } from '@ox-content/islands';
212
+ ${renderIslandComponentImports(usedComponents, {
213
+ globalComponents: options.components,
214
+ localBindings,
215
+ documentPath: id,
216
+ root: options.root
217
+ })}
212
218
 
213
219
  export const frontmatter = ${frontmatterLiteral};
214
220
 
@@ -225,7 +231,7 @@ function createSolidHydrate() {
225
231
 
226
232
  // Read the slot content before clearing: the island element still holds the
227
233
  // markup the Markdown transform left behind.
228
- const islandContent = element.dataset.oxContent || element.innerHTML;
234
+ const islandContent = readIslandSlotHtml(element);
229
235
  element.innerHTML = '';
230
236
 
231
237
  const dispose = render(
@@ -255,18 +261,6 @@ export default function MarkdownContent() {
255
261
  }
256
262
  `;
257
263
  }
258
- /** Rewrites registered component paths as imports relative to the Markdown file. */
259
- function renderComponentImports(usedComponents, options, id) {
260
- const mdDir = path.dirname(id);
261
- const root = options.root || process.cwd();
262
- return usedComponents.map((name) => {
263
- const componentPath = options.components[name];
264
- if (!componentPath) return "";
265
- const absolutePath = path.resolve(root, componentPath.replace(/^\.\//, ""));
266
- const relativePath = path.relative(mdDir, absolutePath).replace(/\\/g, "/");
267
- return `import ${name} from '${relativePath.startsWith(".") ? relativePath : "./" + relativePath}';`;
268
- }).filter(Boolean).join("\n");
269
- }
270
264
  //#endregion
271
265
  //#region src/markdown.ts
272
266
  const COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\s*([^>]*?)\s*(?:\/>|>([\s\S]*?)<\/\1>)/g;
@@ -427,9 +421,32 @@ async function transformMarkdownWithSolid(code, id, options) {
427
421
  content: code,
428
422
  frontmatter: {}
429
423
  };
424
+ const mdx = resolveMdxForFilePath(id, options.mdx);
425
+ const baseOptions = createBaseOptions(options, mdx);
426
+ if (mdx) {
427
+ const transformed = await transformMarkdown(markdownContent, id, baseOptions);
428
+ const discovered = await discoverDocumentMdxIslands({
429
+ source: markdownContent,
430
+ html: transformed.html,
431
+ components: options.components,
432
+ imports: transformed.imports,
433
+ documentPath: id,
434
+ contentRoot: resolveContentRootPath({
435
+ srcDir: options.srcDir,
436
+ root: options.root
437
+ }),
438
+ srcDir: options.srcDir
439
+ });
440
+ return {
441
+ code: generateSolidModule(options.renderIsland ? await applyIslandSsrHtml(transformed.html, options.renderIsland, id, discovered.usedComponents) : transformed.html, discovered.usedComponents, discovered.usedComponents, frontmatter, options, id, discovered.localBindings),
442
+ map: null,
443
+ usedComponents: discovered.usedComponents,
444
+ frontmatter
445
+ };
446
+ }
430
447
  const scanned = scanComponents(markdownContent, options.components);
431
448
  return {
432
- code: generateSolidModule(injectIslandMarkers((await transformMarkdown(scanned.content, id, createBaseOptions(options))).html, scanned.islands), scanned.usedComponents, scanned.islands, frontmatter, options, id),
449
+ code: generateSolidModule(injectIslandMarkers((await transformMarkdown(scanned.content, id, baseOptions)).html, scanned.islands), scanned.usedComponents, scanned.islands, frontmatter, options, id),
433
450
  map: null,
434
451
  usedComponents: scanned.usedComponents,
435
452
  frontmatter
@@ -443,19 +460,27 @@ async function transformMarkdownWithSolid(code, id, options) {
443
460
  * and the host app owns everything around it. Frontmatter is stripped before
444
461
  * this point, so the core parser sees a body-only document.
445
462
  */
446
- function createBaseOptions(options) {
463
+ function createBaseOptions(options, mdx) {
447
464
  return {
448
465
  srcDir: options.srcDir,
449
466
  outDir: options.outDir,
450
467
  base: options.base,
451
468
  extensions: options.extensions,
469
+ mdx,
452
470
  ssg: {
453
471
  enabled: false,
454
472
  extension: ".html",
455
473
  clean: false,
456
474
  bare: false,
457
475
  generateOgImage: false,
458
- lastUpdated: false
476
+ lastUpdated: false,
477
+ pagination: false,
478
+ breadcrumbs: false,
479
+ jsonLd: false,
480
+ readerChrome: false,
481
+ localeSwitcher: false,
482
+ a11y: false,
483
+ pageChrome: false
459
484
  },
460
485
  gfm: options.gfm,
461
486
  frontmatter: false,
@@ -468,8 +493,6 @@ function createBaseOptions(options) {
468
493
  strikethrough: true,
469
494
  autolinks: options.autolinks,
470
495
  highlight: false,
471
- highlightTheme: "github-dark",
472
- highlightLangs: [],
473
496
  mermaid: false,
474
497
  ogImage: false,
475
498
  ogImageOptions: {
@@ -574,7 +597,8 @@ function oxContentSolid(options = {}) {
574
597
  const result = await transformMarkdownWithSolid(code, id, {
575
598
  ...resolved,
576
599
  components: Object.fromEntries(componentMap),
577
- root: config.root
600
+ root: config.root,
601
+ renderIsland: options.renderIsland
578
602
  });
579
603
  return {
580
604
  code: result.code,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["baseTransformMarkdown","oxContent"],"sources":["../src/components.ts","../src/environment.ts","../src/options.ts","../src/codegen.ts","../src/markdown.ts","../src/transform.ts","../src/verify.ts","../src/index.ts"],"sourcesContent":["/**\n * Resolves the `components` option into a name → path map, expanding glob\n * patterns against the Vite project root.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { ComponentsMap, ComponentsOption } from \"./types\";\n\nexport async function resolveComponentsGlob(\n componentsOption: ComponentsOption,\n root: string,\n): Promise<ComponentsMap> {\n if (typeof componentsOption === \"object\" && !Array.isArray(componentsOption)) {\n return componentsOption;\n }\n\n const patterns = Array.isArray(componentsOption) ? componentsOption : [componentsOption];\n const result: ComponentsMap = {};\n\n for (const pattern of patterns) {\n for (const file of await globFiles(pattern, root)) {\n const baseName = path.basename(file, path.extname(file));\n const relativePath = \"./\" + path.relative(root, file).replace(/\\\\/g, \"/\");\n result[toPascalCase(baseName)] = relativePath;\n }\n }\n\n return result;\n}\n\nasync function globFiles(pattern: string, root: string): Promise<string[]> {\n const files: string[] = [];\n const normalized = pattern.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\");\n\n if (!hasWildcard(normalized)) {\n const fullPath = path.resolve(root, normalized);\n if (fs.existsSync(fullPath)) {\n files.push(fullPath);\n }\n return files;\n }\n\n // Walk from the deepest wildcard-free prefix, then keep only the paths the\n // whole pattern matches. Deriving the base directory alone is not enough:\n // `src/components/**/*.tsx` must not collect the non-component files below\n // `src/components`, and the generated module would fail to import them.\n const baseDir = path.resolve(root, staticPrefix(normalized));\n if (!fs.existsSync(baseDir)) {\n return files;\n }\n\n // Only a pattern whose wildcards are confined to the file name can stay\n // shallow. A wildcard in a directory segment (`src/*/Button.tsx`) puts its\n // matches below `baseDir`, and `**` crosses directory boundaries even inside\n // the last segment, so both need the recursive walk.\n const segments = normalized.split(\"/\");\n const crossesDirectories = normalized.includes(\"**\") || segments.slice(0, -1).some(hasWildcard);\n\n const candidates: string[] = [];\n if (crossesDirectories) {\n await walkDir(baseDir, candidates);\n } else {\n const entries = await fs.promises.readdir(baseDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile()) {\n candidates.push(path.join(baseDir, entry.name));\n }\n }\n }\n\n const matcher = globToRegExp(normalized);\n for (const candidate of candidates) {\n if (matcher.test(path.relative(root, candidate).replace(/\\\\/g, \"/\"))) {\n files.push(candidate);\n }\n }\n\n return files;\n}\n\n/** Whether a pattern (or one segment of it) contains a wildcard `globToRegExp` expands. */\nfunction hasWildcard(pattern: string): boolean {\n return pattern.includes(\"*\") || pattern.includes(\"?\");\n}\n\n/** Leading path segments of a pattern that contain no wildcard. */\nfunction staticPrefix(pattern: string): string {\n const segments: string[] = [];\n for (const segment of pattern.split(\"/\")) {\n if (hasWildcard(segment)) break;\n segments.push(segment);\n }\n return segments.join(\"/\");\n}\n\n/**\n * Translates a glob into an anchored `RegExp`: `**` crosses directory\n * boundaries, `*` and `?` stay within one segment.\n */\nfunction globToRegExp(pattern: string): RegExp {\n let source = \"\";\n let index = 0;\n\n while (index < pattern.length) {\n const char = pattern[index];\n if (char === \"*\") {\n if (pattern[index + 1] === \"*\") {\n index += 2;\n if (pattern[index] === \"/\") {\n index += 1;\n source += \"(?:[^/]+/)*\";\n } else {\n source += \".*\";\n }\n continue;\n }\n source += \"[^/]*\";\n } else if (char === \"?\") {\n source += \"[^/]\";\n } else {\n source += char.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n }\n index += 1;\n }\n\n return new RegExp(`^${source}$`);\n}\n\nasync function walkDir(dir: string, files: string[]): Promise<void> {\n const entries = await fs.promises.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n await walkDir(fullPath, files);\n } else if (entry.isFile()) {\n files.push(fullPath);\n }\n }\n}\n\nfunction toPascalCase(str: string): string {\n return str.replace(/[-_](\\w)/g, (_, c) => c.toUpperCase()).replace(/^\\w/, (c) => c.toUpperCase());\n}\n","import type { EnvironmentOptions } from \"vite\";\nimport type { ResolvedSolidOptions } from \"./types\";\n\nexport function createSolidMarkdownEnvironment(\n mode: \"ssr\" | \"client\",\n options: ResolvedSolidOptions,\n): EnvironmentOptions {\n const isSSR = mode === \"ssr\";\n\n return {\n build: {\n outDir: isSSR ? `${options.outDir}/.ox-content/ssr` : `${options.outDir}/.ox-content/client`,\n ssr: isSSR,\n rollupOptions: {\n output: {\n format: \"esm\",\n entryFileNames: isSSR ? \"[name].js\" : \"[name].[hash].js\",\n },\n },\n ...(isSSR && { target: \"node18\", minify: false }),\n },\n resolve: {\n // `solid` must lead: Solid libraries ship their uncompiled JSX behind that\n // condition, and the server/client split then comes from `node`/`browser`.\n conditions: isSSR ? [\"solid\", \"node\", \"import\"] : [\"solid\", \"browser\", \"import\"],\n },\n optimizeDeps: {\n include: isSSR ? [] : [\"solid-js\", \"solid-js/web\"],\n exclude: [\"@ox-content/vite-plugin\", \"@ox-content/vite-plugin-solid\"],\n },\n };\n}\n","import type { BuiltinEmbedOptions, ResolvedSolidOptions, SolidIntegrationOptions } from \"./types\";\n\nconst DEFAULT_MARKDOWN_EXTENSIONS = [\".md\", \".markdown\", \".mdx\"] as const;\n\nexport function resolveSolidOptions(\n options: SolidIntegrationOptions,\n): Omit<ResolvedSolidOptions, \"components\"> {\n return {\n srcDir: options.srcDir ?? \"docs\",\n outDir: options.outDir ?? \"dist\",\n base: options.base ?? \"/\",\n extensions: normalizeMarkdownExtensions(options.extensions),\n gfm: options.gfm ?? true,\n autolinks: options.autolinks ?? options.gfm ?? true,\n frontmatter: options.frontmatter ?? true,\n toc: options.toc ?? true,\n tocMaxDepth: options.tocMaxDepth ?? 3,\n codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),\n verifySolidPlugin: options.verifySolidPlugin ?? true,\n embeds: resolveBuiltinEmbedOptions(options.embeds),\n };\n}\n\nexport function normalizeMarkdownExtensions(extensions?: readonly string[]): string[] {\n const values = extensions?.length ? extensions : DEFAULT_MARKDOWN_EXTENSIONS;\n return Array.from(\n new Map(\n values.map((extension) => {\n const value = extension.startsWith(\".\") ? extension : `.${extension}`;\n return [value.toLowerCase(), value] as const;\n }),\n ).values(),\n );\n}\n\nexport function isMarkdownFilePath(filePath: string, extensions: readonly string[]): boolean {\n const pathname = filePath.split(\"?\")[0].split(\"#\")[0].toLowerCase();\n return extensions.some((extension) => pathname.endsWith(extension.toLowerCase()));\n}\n\nfunction resolveCodeAnnotationsOptions(\n options: SolidIntegrationOptions[\"codeAnnotations\"],\n): ResolvedSolidOptions[\"codeAnnotations\"] {\n if (!options) {\n return { enabled: false, metaKey: \"annotate\" };\n }\n\n if (options === true) {\n return { enabled: true, metaKey: \"annotate\" };\n }\n\n return { enabled: true, metaKey: options.metaKey ?? \"annotate\" };\n}\n\nfunction resolveBuiltinEmbedOptions(\n options: BuiltinEmbedOptions | false | undefined,\n): ResolvedSolidOptions[\"embeds\"] {\n if (options === false) return { github: false, openGraph: false };\n return {\n github: resolveSingleEmbedOptions(options?.github),\n openGraph: resolveSingleEmbedOptions(options?.openGraph),\n };\n}\n\nfunction resolveSingleEmbedOptions<T extends object>(options: boolean | T | undefined): T | false {\n if (options === false) return false;\n if (options === true || options === undefined) return {} as T;\n return options;\n}\n","/**\n * Generates the Solid module a Markdown file compiles to.\n *\n * The output is JSX on purpose. Solid has no runtime element factory to target\n * — `vite-plugin-solid` compiles this into DOM or SSR instructions — so unlike\n * the React and Vue integrations there is no factory-call form to emit.\n */\n\nimport * as path from \"path\";\nimport type { ComponentIsland, ResolvedSolidOptions } from \"./types\";\n\nexport function generateSolidModule(\n content: string,\n usedComponents: string[],\n islands: ComponentIsland[],\n frontmatter: Record<string, unknown>,\n options: ResolvedSolidOptions & { root?: string },\n id: string,\n): string {\n const rawHtml = JSON.stringify(content);\n const frontmatterLiteral = JSON.stringify(frontmatter);\n\n // Markdown with no registered component skips the island runtime entirely and\n // compiles to a single `innerHTML` binding — no imports needed, because Solid\n // injects whatever its compiled output requires.\n if (islands.length === 0) {\n return `\nexport const frontmatter = ${frontmatterLiteral};\n\nconst rawHtml = ${rawHtml};\n\nexport default function MarkdownContent() {\n return <div class=\"ox-content\" innerHTML={rawHtml} />;\n}\n`;\n }\n\n const imports = renderComponentImports(usedComponents, options, id);\n const componentMap = usedComponents.map((name) => ` ${name},`).join(\"\\n\");\n\n return `\nimport { onCleanup, onMount } from 'solid-js';\nimport { render } from 'solid-js/web';\nimport { initIslands } from '@ox-content/islands';\n${imports}\n\nexport const frontmatter = ${frontmatterLiteral};\n\nconst rawHtml = ${rawHtml};\nconst components = {\n${componentMap}\n};\n\nfunction createSolidHydrate() {\n return (element, props) => {\n const componentName = element.dataset.oxIsland;\n const Component = components[componentName];\n if (!Component) return;\n\n // Read the slot content before clearing: the island element still holds the\n // markup the Markdown transform left behind.\n const islandContent = element.dataset.oxContent || element.innerHTML;\n element.innerHTML = '';\n\n const dispose = render(\n () =>\n islandContent\n ? <Component {...props}><div innerHTML={islandContent} /></Component>\n : <Component {...props} />,\n element,\n );\n\n return () => dispose();\n };\n}\n\nexport default function MarkdownContent() {\n let container;\n\n onMount(() => {\n if (!container) return;\n const controller = initIslands(createSolidHydrate(), {\n selector: '.ox-content [data-ox-island]',\n });\n onCleanup(() => controller.destroy());\n });\n\n return <div class=\"ox-content\" ref={container} innerHTML={rawHtml} />;\n}\n`;\n}\n\n/** Rewrites registered component paths as imports relative to the Markdown file. */\nfunction renderComponentImports(\n usedComponents: string[],\n options: ResolvedSolidOptions & { root?: string },\n id: string,\n): string {\n const mdDir = path.dirname(id);\n const root = options.root || process.cwd();\n\n return usedComponents\n .map((name) => {\n const componentPath = options.components[name];\n if (!componentPath) return \"\";\n const absolutePath = path.resolve(root, componentPath.replace(/^\\.\\//, \"\"));\n const relativePath = path.relative(mdDir, absolutePath).replace(/\\\\/g, \"/\");\n const importPath = relativePath.startsWith(\".\") ? relativePath : \"./\" + relativePath;\n return `import ${name} from '${importPath}';`;\n })\n .filter(Boolean)\n .join(\"\\n\");\n}\n","/**\n * Markdown-side scanning shared by the Solid transform: locating component\n * tags, keeping fenced samples literal, and round-tripping islands through the\n * rendered HTML as placeholder markers.\n */\n\nimport type { ComponentIsland, ComponentsMap } from \"./types\";\n\nconst COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\\s*([^>]*?)\\s*(?:\\/>|>([\\s\\S]*?)<\\/\\1>)/g;\nconst PROP_REGEX = /([a-zA-Z0-9-]+)(?:=(?:\"([^\"]*)\"|'([^']*)'|{([^}]*)}|\\[([^\\]]*)\\]))?/g;\n\nconst ISLAND_MARKER_PREFIX = \"OXCONTENT-ISLAND-\";\nconst ISLAND_MARKER_SUFFIX = \"-PLACEHOLDER\";\n\ninterface Range {\n start: number;\n end: number;\n}\n\nexport interface ScannedMarkdown {\n /** Markdown with component tags replaced by island placeholder markers. */\n content: string;\n islands: ComponentIsland[];\n usedComponents: string[];\n}\n\n/**\n * Replaces every registered component tag with a placeholder marker that\n * survives Markdown rendering, so the island can be re-attached to the produced\n * HTML afterwards. Tags inside fenced code blocks are left as literal text.\n */\nexport function scanComponents(markdown: string, components: ComponentsMap): ScannedMarkdown {\n const usedComponents: string[] = [];\n const islands: ComponentIsland[] = [];\n const fenceRanges = collectFenceRanges(markdown);\n\n let islandIndex = 0;\n let content = \"\";\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n COMPONENT_REGEX.lastIndex = 0;\n while ((match = COMPONENT_REGEX.exec(markdown)) !== null) {\n const [fullMatch, componentName, propsString, rawIslandContent] = match;\n const matchStart = match.index;\n const matchEnd = matchStart + fullMatch.length;\n\n if (\n !Object.prototype.hasOwnProperty.call(components, componentName) ||\n isInRanges(matchStart, matchEnd, fenceRanges)\n ) {\n content += markdown.slice(lastIndex, matchEnd);\n lastIndex = matchEnd;\n continue;\n }\n\n if (!usedComponents.includes(componentName)) {\n usedComponents.push(componentName);\n }\n\n const islandId = `ox-island-${islandIndex++}`;\n islands.push({\n name: componentName,\n props: parseProps(propsString),\n position: matchStart,\n id: islandId,\n content: typeof rawIslandContent === \"string\" ? rawIslandContent.trim() : undefined,\n });\n\n content += markdown.slice(lastIndex, matchStart) + createIslandMarker(islandId);\n lastIndex = matchEnd;\n }\n\n content += markdown.slice(lastIndex);\n\n return { content, islands, usedComponents };\n}\n\n/** Swaps the placeholder markers in rendered HTML for island mount points. */\nexport function injectIslandMarkers(html: string, islands: ComponentIsland[]): string {\n let output = html;\n\n for (const island of islands) {\n const marker = createIslandMarker(island.id);\n const propsAttr =\n Object.keys(island.props).length > 0\n ? ` data-ox-props='${JSON.stringify(island.props).replace(/'/g, \"&#39;\")}'`\n : \"\";\n const contentAttr = island.content\n ? ` data-ox-content='${island.content.replace(/'/g, \"&#39;\")}'`\n : \"\";\n const attrs = `data-ox-island=\"${island.name}\"${propsAttr}${contentAttr}`;\n output = output.replaceAll(`<p>${marker}</p>`, `<div ${attrs}></div>`);\n output = output.replaceAll(marker, `<span ${attrs}></span>`);\n }\n\n return output;\n}\n\nexport function extractFrontmatter(content: string): {\n content: string;\n frontmatter: Record<string, unknown>;\n} {\n const frontmatterRegex = /^---\\n([\\s\\S]*?)\\n---\\n/;\n const match = frontmatterRegex.exec(content);\n\n if (!match) {\n return { content, frontmatter: {} };\n }\n\n const frontmatter: Record<string, unknown> = {};\n\n for (const line of match[1].split(\"\\n\")) {\n const colonIndex = line.indexOf(\":\");\n if (colonIndex > 0) {\n const key = line.slice(0, colonIndex).trim();\n let value: unknown = line.slice(colonIndex + 1).trim();\n try {\n value = JSON.parse(value as string);\n } catch {\n if (\n typeof value === \"string\" &&\n ((value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\")))\n ) {\n value = value.slice(1, -1);\n }\n }\n frontmatter[key] = value;\n }\n }\n\n return { content: content.slice(match[0].length), frontmatter };\n}\n\nfunction createIslandMarker(islandId: string): string {\n return `${ISLAND_MARKER_PREFIX}${islandId}${ISLAND_MARKER_SUFFIX}`;\n}\n\nfunction collectFenceRanges(content: string): Range[] {\n const ranges: Range[] = [];\n let inFence = false;\n let fenceChar = \"\";\n let fenceLength = 0;\n let fenceStart = 0;\n let pos = 0;\n\n while (pos < content.length) {\n const lineEnd = content.indexOf(\"\\n\", pos);\n const next = lineEnd === -1 ? content.length : lineEnd + 1;\n const line = content.slice(pos, lineEnd === -1 ? content.length : lineEnd);\n const fenceMatch = line.match(/^\\s{0,3}([`~]{3,})/);\n\n if (fenceMatch) {\n const marker = fenceMatch[1];\n if (!inFence) {\n inFence = true;\n fenceChar = marker[0];\n fenceLength = marker.length;\n fenceStart = pos;\n } else if (marker[0] === fenceChar && marker.length >= fenceLength) {\n inFence = false;\n ranges.push({ start: fenceStart, end: next });\n fenceChar = \"\";\n fenceLength = 0;\n }\n }\n\n pos = next;\n }\n\n if (inFence) {\n ranges.push({ start: fenceStart, end: content.length });\n }\n\n return ranges;\n}\n\nfunction isInRanges(start: number, end: number, ranges: Range[]): boolean {\n for (const range of ranges) {\n if (start < range.end && end > range.start) {\n return true;\n }\n }\n return false;\n}\n\nfunction parseProps(propsString: string): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n if (!propsString) return props;\n\n PROP_REGEX.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = PROP_REGEX.exec(propsString)) !== null) {\n const [, name, doubleQuoted, singleQuoted, braceValue, bracketValue] = match;\n if (!name) continue;\n\n if (doubleQuoted !== undefined) props[name] = doubleQuoted;\n else if (singleQuoted !== undefined) props[name] = singleQuoted;\n else if (braceValue !== undefined) {\n try {\n props[name] = JSON.parse(braceValue);\n } catch {\n props[name] = braceValue;\n }\n } else if (bracketValue !== undefined) {\n try {\n props[name] = JSON.parse(`[${bracketValue}]`);\n } catch {\n props[name] = bracketValue;\n }\n } else props[name] = true;\n }\n\n return props;\n}\n","import { transformMarkdown as baseTransformMarkdown } from \"@ox-content/vite-plugin\";\nimport { generateSolidModule } from \"./codegen\";\nimport { extractFrontmatter, injectIslandMarkers, scanComponents } from \"./markdown\";\nimport type { ResolvedSolidOptions, SolidTransformResult } from \"./types\";\n\nexport async function transformMarkdownWithSolid(\n code: string,\n id: string,\n options: ResolvedSolidOptions,\n): Promise<SolidTransformResult> {\n // `frontmatter: false` means the body is taken verbatim, so a leading `---`\n // block stays in the rendered document instead of becoming module exports.\n const { content: markdownContent, frontmatter } = options.frontmatter\n ? extractFrontmatter(code)\n : { content: code, frontmatter: {} };\n const scanned = scanComponents(markdownContent, options.components);\n\n const transformed = await baseTransformMarkdown(scanned.content, id, createBaseOptions(options));\n\n const htmlWithIslands = injectIslandMarkers(transformed.html, scanned.islands);\n\n return {\n code: generateSolidModule(\n htmlWithIslands,\n scanned.usedComponents,\n scanned.islands,\n frontmatter,\n options,\n id,\n ),\n map: null,\n usedComponents: scanned.usedComponents,\n frontmatter,\n };\n}\n\n/**\n * Options handed to the core Markdown transform.\n *\n * The site-level features (SSG, search, OG images, highlighting) are turned off\n * here: this path only produces the HTML that gets embedded in a Solid module,\n * and the host app owns everything around it. Frontmatter is stripped before\n * this point, so the core parser sees a body-only document.\n */\nfunction createBaseOptions(\n options: ResolvedSolidOptions,\n): Parameters<typeof baseTransformMarkdown>[2] {\n return {\n srcDir: options.srcDir,\n outDir: options.outDir,\n base: options.base,\n extensions: options.extensions,\n ssg: {\n enabled: false,\n extension: \".html\",\n clean: false,\n bare: false,\n generateOgImage: false,\n lastUpdated: false,\n },\n gfm: options.gfm,\n frontmatter: false,\n toc: options.toc,\n tocMaxDepth: options.tocMaxDepth,\n codeAnnotations: options.codeAnnotations,\n footnotes: true,\n tables: true,\n taskLists: true,\n strikethrough: true,\n autolinks: options.autolinks,\n highlight: false,\n highlightTheme: \"github-dark\",\n highlightLangs: [],\n mermaid: false,\n ogImage: false,\n ogImageOptions: {\n vuePlugin: \"vitejs\",\n width: 1200,\n height: 630,\n cache: true,\n concurrency: 1,\n },\n transformers: [],\n docs: false,\n ogViewer: false,\n search: {\n enabled: false,\n limit: 10,\n prefix: true,\n placeholder: \"Search...\",\n hotkey: \"k\",\n },\n embeds: options.embeds,\n i18n: false,\n } as unknown as Parameters<typeof baseTransformMarkdown>[2];\n}\n","/**\n * Guards against the two ways `vite-plugin-solid` can fail to compile the\n * Markdown modules this plugin emits.\n *\n * Both are configuration mistakes with silent-until-cryptic failure modes, so\n * each is checked as early as it can be observed: plugin presence and ordering\n * are known once the config resolves, while the `extensions` option is held in\n * the Solid plugin's closure and can only be inferred from whether the generated\n * JSX actually got compiled.\n */\n\nimport type { ResolvedConfig } from \"vite\";\n\nexport const TRANSFORM_PLUGIN_NAME = \"ox-content:solid-transform\";\n\nconst SOLID_PLUGIN_NAME = \"solid\";\n\n/**\n * Emitted by both generated module shapes. Solid's JSX has no runtime factory,\n * so this attribute only survives into the final module when nothing compiled\n * the JSX away — which is exactly the misconfiguration worth reporting.\n */\nexport const UNCOMPILED_JSX_MARKER = \"innerHTML={rawHtml}\";\n\nexport function formatSolidPluginError(reason: \"missing\" | \"ordering\" | \"extensions\"): string {\n const example = [\n \" plugins: [\",\n \" oxContentSolid({ srcDir: 'docs' }),\",\n \" solid({ extensions: ['.md', '.markdown', '.mdx'] }),\",\n \" ]\",\n ].join(\"\\n\");\n\n const detail = {\n missing:\n \"vite-plugin-solid was not found in the Vite config. Markdown files are emitted as Solid JSX, which only runs after babel-preset-solid compiles it.\",\n ordering:\n \"vite-plugin-solid runs before oxContentSolid(), so it sees raw Markdown instead of the generated JSX. Both plugins are `enforce: 'pre'`, so their order follows the `plugins` array.\",\n extensions:\n \"vite-plugin-solid did not compile the generated Markdown module. Its `extensions` option must list the Markdown extensions; by default it only looks at .jsx/.tsx files.\",\n }[reason];\n\n return `[ox-content:solid] ${detail}\\n\\n${example}\\n`;\n}\n\n/**\n * Throws when `vite-plugin-solid` is absent, or placed where it would see raw\n * Markdown instead of the JSX this plugin generates.\n */\nexport function verifySolidPluginOrder(config: ResolvedConfig): void {\n const names = config.plugins.map((plugin) => plugin.name);\n const solidIndex = names.indexOf(SOLID_PLUGIN_NAME);\n\n if (solidIndex === -1) {\n throw new Error(formatSolidPluginError(\"missing\"));\n }\n\n const transformIndex = names.indexOf(TRANSFORM_PLUGIN_NAME);\n if (transformIndex !== -1 && solidIndex < transformIndex) {\n throw new Error(formatSolidPluginError(\"ordering\"));\n }\n}\n","/**\n * Vite Plugin for Ox Content Solid Integration\n *\n * Uses Vite's Environment API to enable embedding Solid components in Markdown.\n */\n\nimport type { Plugin, PluginOption, ResolvedConfig } from \"vite\";\nimport { oxContent } from \"@ox-content/vite-plugin\";\nimport { resolveComponentsGlob } from \"./components\";\nimport { createSolidMarkdownEnvironment } from \"./environment\";\nimport { isMarkdownFilePath, resolveSolidOptions } from \"./options\";\nimport { transformMarkdownWithSolid } from \"./transform\";\nimport {\n formatSolidPluginError,\n TRANSFORM_PLUGIN_NAME,\n UNCOMPILED_JSX_MARKER,\n verifySolidPluginOrder,\n} from \"./verify\";\nimport type { SolidIntegrationOptions } from \"./types\";\n\nexport type {\n SolidIntegrationOptions,\n ResolvedSolidOptions,\n ComponentsOption,\n ComponentsMap,\n BuiltinEmbedOptions,\n GitHubEmbedOptions,\n OpenGraphEmbedOptions,\n ResolvedBuiltinEmbedOptions,\n SolidTransformResult,\n ComponentIsland,\n} from \"./types\";\n\n/**\n * Creates the Ox Content Solid integration plugin.\n *\n * Unlike the React and Svelte integrations, this plugin must be listed **before**\n * `vite-plugin-solid`, and that plugin must be told about the Markdown\n * extensions. Markdown is turned into Solid JSX here, and Solid's JSX is\n * compile-time only — `vite-plugin-solid` is what turns it into DOM or SSR\n * instructions.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import solid from 'vite-plugin-solid';\n * import { oxContentSolid } from '@ox-content/vite-plugin-solid';\n *\n * export default defineConfig({\n * plugins: [\n * oxContentSolid({\n * srcDir: 'docs',\n * components: {\n * Counter: './src/components/Counter.tsx',\n * },\n * }),\n * solid({ extensions: ['.md', '.markdown', '.mdx'] }),\n * ],\n * });\n * ```\n */\nexport function oxContentSolid(options: SolidIntegrationOptions = {}): PluginOption[] {\n const resolved = resolveSolidOptions(options);\n let componentMap = new Map<string, string>();\n let config: ResolvedConfig;\n\n if (typeof options.components === \"object\" && !Array.isArray(options.components)) {\n componentMap = new Map(Object.entries(options.components));\n }\n\n const solidTransformPlugin: Plugin = {\n name: TRANSFORM_PLUGIN_NAME,\n enforce: \"pre\",\n\n async configResolved(resolvedConfig) {\n config = resolvedConfig;\n\n if (resolved.verifySolidPlugin) {\n verifySolidPluginOrder(resolvedConfig);\n }\n\n const componentsOption = options.components;\n if (componentsOption) {\n const resolvedComponents = await resolveComponentsGlob(componentsOption, config.root);\n componentMap = new Map(Object.entries(resolvedComponents));\n }\n },\n\n async transform(code, id) {\n if (!isMarkdownFilePath(id, resolved.extensions)) {\n return null;\n }\n\n const result = await transformMarkdownWithSolid(code, id, {\n ...resolved,\n components: Object.fromEntries(componentMap),\n root: config.root,\n });\n\n return {\n code: result.code,\n map: result.map,\n };\n },\n };\n\n // `post` so every `pre`/normal plugin — vite-plugin-solid included — has\n // already had its turn at the module.\n const solidVerifyPlugin: Plugin = {\n name: \"ox-content:solid-verify\",\n enforce: \"post\",\n\n transform(code, id) {\n if (!resolved.verifySolidPlugin) return null;\n if (!isMarkdownFilePath(id, resolved.extensions)) return null;\n if (!code.includes(UNCOMPILED_JSX_MARKER)) return null;\n\n this.error(formatSolidPluginError(\"extensions\"));\n },\n };\n\n const solidEnvironmentPlugin: Plugin = {\n name: \"ox-content:solid-environment\",\n\n config() {\n const envOptions = {\n ...resolved,\n components: Object.fromEntries(componentMap),\n };\n return {\n environments: {\n oxcontent_ssr: createSolidMarkdownEnvironment(\"ssr\", envOptions),\n oxcontent_client: createSolidMarkdownEnvironment(\"client\", envOptions),\n },\n };\n },\n\n resolveId(id) {\n if (id === \"virtual:ox-content-solid/components\") {\n return \"\\0virtual:ox-content-solid/components\";\n }\n return null;\n },\n\n load(id) {\n if (id === \"\\0virtual:ox-content-solid/components\") {\n return generateComponentsModule(componentMap);\n }\n return null;\n },\n\n applyToEnvironment(environment) {\n return [\"oxcontent_ssr\", \"oxcontent_client\", \"client\", \"ssr\"].includes(environment.name);\n },\n };\n\n const solidHmrPlugin: Plugin = {\n name: \"ox-content:solid-hmr\",\n apply: \"serve\",\n\n handleHotUpdate({ file, server, modules }) {\n const isComponent = Array.from(componentMap.values()).some((path) =>\n file.endsWith(path.replace(/^\\.\\//, \"\")),\n );\n\n if (isComponent) {\n const mdModules = Array.from(server.moduleGraph.idToModuleMap.values()).filter(\n (mod) => mod.file && isMarkdownFilePath(mod.file, resolved.extensions),\n );\n\n if (mdModules.length > 0) {\n server.ws.send({\n type: \"custom\",\n event: \"ox-content:solid-update\",\n data: { file },\n });\n return [...modules, ...mdModules];\n }\n }\n\n return modules;\n },\n };\n\n const basePlugins = oxContent(options).flatMap((plugin) =>\n Array.isArray(plugin) ? plugin : [plugin],\n ) as Plugin[];\n const environmentPlugin = basePlugins.find((plugin) => plugin.name === \"ox-content:environment\");\n const plugins: Plugin[] = [\n solidTransformPlugin,\n solidVerifyPlugin,\n solidEnvironmentPlugin,\n solidHmrPlugin,\n ];\n\n if (environmentPlugin) {\n plugins.push(environmentPlugin);\n }\n\n return plugins;\n}\n\nfunction generateComponentsModule(componentMap: Map<string, string>): string {\n const imports: string[] = [];\n const exports: string[] = [];\n\n componentMap.forEach((path, name) => {\n imports.push(`import ${name} from '${path}';`);\n exports.push(` ${name},`);\n });\n\n return `\n${imports.join(\"\\n\")}\n\nexport const components = {\n${exports.join(\"\\n\")}\n};\n\nexport default components;\n`;\n}\n\nexport { oxContent } from \"@ox-content/vite-plugin\";\n"],"mappings":";;;;;;;;AASA,eAAsB,sBACpB,kBACA,MACwB;CACxB,IAAI,OAAO,qBAAqB,YAAY,CAAC,MAAM,QAAQ,gBAAgB,GACzE,OAAO;CAGT,MAAM,WAAW,MAAM,QAAQ,gBAAgB,IAAI,mBAAmB,CAAC,gBAAgB;CACvF,MAAM,SAAwB,CAAC;CAE/B,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,MAAM,UAAU,SAAS,IAAI,G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AK,aAAa,OAAO,CAAC,CAAC,CAAC,MAAM,SAC1D,KAAK,SAAS,KAAK,QAAQ,SAAS,EAAE,CAAC,CAG3B,GAAG;IACf,MAAM,YAAY,MAAM,KAAK,OAAO,YAAY,cAAc,OAAO,CAAC,CAAC,CAAC,QACrE,QAAQ,IAAI,QAAQ,mBAAmB,IAAI,MAAM,SAAS,UAAU,CACvE;IAEA,IAAI,UAAU,SAAS,GAAG;KACxB,OAAO,GAAG,KAAK;MACb,MAAM;MACN,OAAO;MACP,MAAM,EAAE,KAAK;KACf,CAAC;KACD,OAAO,CAAC,GAAG,SAAS,GAAG,SAAS;IAClC;GACF;GAEA,OAAO;EACT;CACF;CAKA,MAAM,oBAHcC,YAAU,OAAO,CAAC,CAAC,SAAS,WAC9C,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM,CAEN,CAAC,CAAC,MAAM,WAAW,OAAO,SAAS,wBAAwB;CAC/F,MAAM,UAAoB;EACxB;EACA;EACA;EACA;CACF;CAEA,IAAI,mBACF,QAAQ,KAAK,iBAAiB;CAGhC,OAAO;AACT;AAEA,SAAS,yBAAyB,cAA2C;CAC3E,MAAM,UAAoB,CAAC;CAC3B,MAAM,UAAoB,CAAC;CAE3B,aAAa,SAAS,MAAM,SAAS;EACnC,QAAQ,KAAK,UAAU,KAAK,SAAS,KAAK,GAAG;EAC7C,QAAQ,KAAK,KAAK,KAAK,EAAE;CAC3B,CAAC;CAED,OAAO;EACP,QAAQ,KAAK,IAAI,EAAE;;;EAGnB,QAAQ,KAAK,IAAI,EAAE;;;;;AAKrB"}
1
+ {"version":3,"file":"index.mjs","names":["baseTransformMarkdown","oxContent"],"sources":["../src/components.ts","../src/environment.ts","../src/options.ts","../src/codegen.ts","../src/markdown.ts","../src/transform.ts","../src/verify.ts","../src/index.ts"],"sourcesContent":["/**\n * Resolves the `components` option into a name → path map, expanding glob\n * patterns against the Vite project root.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { ComponentsMap, ComponentsOption } from \"./types\";\n\nexport async function resolveComponentsGlob(\n componentsOption: ComponentsOption,\n root: string,\n): Promise<ComponentsMap> {\n if (typeof componentsOption === \"object\" && !Array.isArray(componentsOption)) {\n return componentsOption;\n }\n\n const patterns = Array.isArray(componentsOption) ? componentsOption : [componentsOption];\n const result: ComponentsMap = {};\n\n for (const pattern of patterns) {\n for (const file of await globFiles(pattern, root)) {\n const baseName = path.basename(file, path.extname(file));\n const relativePath = \"./\" + path.relative(root, file).replace(/\\\\/g, \"/\");\n result[toPascalCase(baseName)] = relativePath;\n }\n }\n\n return result;\n}\n\nasync function globFiles(pattern: string, root: string): Promise<string[]> {\n const files: string[] = [];\n const normalized = pattern.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\");\n\n if (!hasWildcard(normalized)) {\n const fullPath = path.resolve(root, normalized);\n if (fs.existsSync(fullPath)) {\n files.push(fullPath);\n }\n return files;\n }\n\n // Walk from the deepest wildcard-free prefix, then keep only the paths the\n // whole pattern matches. Deriving the base directory alone is not enough:\n // `src/components/**/*.tsx` must not collect the non-component files below\n // `src/components`, and the generated module would fail to import them.\n const baseDir = path.resolve(root, staticPrefix(normalized));\n if (!fs.existsSync(baseDir)) {\n return files;\n }\n\n // Only a pattern whose wildcards are confined to the file name can stay\n // shallow. A wildcard in a directory segment (`src/*/Button.tsx`) puts its\n // matches below `baseDir`, and `**` crosses directory boundaries even inside\n // the last segment, so both need the recursive walk.\n const segments = normalized.split(\"/\");\n const crossesDirectories = normalized.includes(\"**\") || segments.slice(0, -1).some(hasWildcard);\n\n const candidates: string[] = [];\n if (crossesDirectories) {\n await walkDir(baseDir, candidates);\n } else {\n const entries = await fs.promises.readdir(baseDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile()) {\n candidates.push(path.join(baseDir, entry.name));\n }\n }\n }\n\n const matcher = globToRegExp(normalized);\n for (const candidate of candidates) {\n if (matcher.test(path.relative(root, candidate).replace(/\\\\/g, \"/\"))) {\n files.push(candidate);\n }\n }\n\n return files;\n}\n\n/** Whether a pattern (or one segment of it) contains a wildcard `globToRegExp` expands. */\nfunction hasWildcard(pattern: string): boolean {\n return pattern.includes(\"*\") || pattern.includes(\"?\");\n}\n\n/** Leading path segments of a pattern that contain no wildcard. */\nfunction staticPrefix(pattern: string): string {\n const segments: string[] = [];\n for (const segment of pattern.split(\"/\")) {\n if (hasWildcard(segment)) break;\n segments.push(segment);\n }\n return segments.join(\"/\");\n}\n\n/**\n * Translates a glob into an anchored `RegExp`: `**` crosses directory\n * boundaries, `*` and `?` stay within one segment.\n */\nfunction globToRegExp(pattern: string): RegExp {\n let source = \"\";\n let index = 0;\n\n while (index < pattern.length) {\n const char = pattern[index];\n if (char === \"*\") {\n if (pattern[index + 1] === \"*\") {\n index += 2;\n if (pattern[index] === \"/\") {\n index += 1;\n source += \"(?:[^/]+/)*\";\n } else {\n source += \".*\";\n }\n continue;\n }\n source += \"[^/]*\";\n } else if (char === \"?\") {\n source += \"[^/]\";\n } else {\n source += char.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n }\n index += 1;\n }\n\n return new RegExp(`^${source}$`);\n}\n\nasync function walkDir(dir: string, files: string[]): Promise<void> {\n const entries = await fs.promises.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n await walkDir(fullPath, files);\n } else if (entry.isFile()) {\n files.push(fullPath);\n }\n }\n}\n\nfunction toPascalCase(str: string): string {\n return str.replace(/[-_](\\w)/g, (_, c) => c.toUpperCase()).replace(/^\\w/, (c) => c.toUpperCase());\n}\n","import type { EnvironmentOptions } from \"vite\";\nimport type { ResolvedSolidOptions } from \"./types\";\n\nexport function createSolidMarkdownEnvironment(\n mode: \"ssr\" | \"client\",\n options: ResolvedSolidOptions,\n): EnvironmentOptions {\n const isSSR = mode === \"ssr\";\n\n return {\n build: {\n outDir: isSSR ? `${options.outDir}/.ox-content/ssr` : `${options.outDir}/.ox-content/client`,\n ssr: isSSR,\n rollupOptions: {\n output: {\n format: \"esm\",\n entryFileNames: isSSR ? \"[name].js\" : \"[name].[hash].js\",\n },\n },\n ...(isSSR && { target: \"node18\", minify: false }),\n },\n resolve: {\n // `solid` must lead: Solid libraries ship their uncompiled JSX behind that\n // condition, and the server/client split then comes from `node`/`browser`.\n conditions: isSSR ? [\"solid\", \"node\", \"import\"] : [\"solid\", \"browser\", \"import\"],\n },\n optimizeDeps: {\n include: isSSR ? [] : [\"solid-js\", \"solid-js/web\"],\n exclude: [\"@ox-content/vite-plugin\", \"@ox-content/vite-plugin-solid\"],\n },\n };\n}\n","import type { BuiltinEmbedOptions, ResolvedSolidOptions, SolidIntegrationOptions } from \"./types\";\n\nconst DEFAULT_MARKDOWN_EXTENSIONS = [\".md\", \".markdown\", \".mdx\"] as const;\n\nexport function resolveSolidOptions(\n options: SolidIntegrationOptions,\n): Omit<ResolvedSolidOptions, \"components\"> {\n return {\n srcDir: options.srcDir ?? \"docs\",\n outDir: options.outDir ?? \"dist\",\n base: options.base ?? \"/\",\n extensions: normalizeMarkdownExtensions(options.extensions),\n gfm: options.gfm ?? true,\n autolinks: options.autolinks ?? options.gfm ?? true,\n frontmatter: options.frontmatter ?? true,\n toc: options.toc ?? true,\n tocMaxDepth: options.tocMaxDepth ?? 3,\n codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),\n verifySolidPlugin: options.verifySolidPlugin ?? true,\n embeds: resolveBuiltinEmbedOptions(options.embeds),\n mdx: options.mdx,\n };\n}\n\nexport function normalizeMarkdownExtensions(extensions?: readonly string[]): string[] {\n const values = extensions?.length ? extensions : DEFAULT_MARKDOWN_EXTENSIONS;\n return Array.from(\n new Map(\n values.map((extension) => {\n const value = extension.startsWith(\".\") ? extension : `.${extension}`;\n return [value.toLowerCase(), value] as const;\n }),\n ).values(),\n );\n}\n\nexport function isMarkdownFilePath(filePath: string, extensions: readonly string[]): boolean {\n const pathname = filePath.split(\"?\")[0].split(\"#\")[0].toLowerCase();\n return extensions.some((extension) => pathname.endsWith(extension.toLowerCase()));\n}\n\nfunction resolveCodeAnnotationsOptions(\n options: SolidIntegrationOptions[\"codeAnnotations\"],\n): ResolvedSolidOptions[\"codeAnnotations\"] {\n if (!options) {\n return { enabled: false, metaKey: \"annotate\" };\n }\n\n if (options === true) {\n return { enabled: true, metaKey: \"annotate\" };\n }\n\n return { enabled: true, metaKey: options.metaKey ?? \"annotate\" };\n}\n\nfunction resolveBuiltinEmbedOptions(\n options: BuiltinEmbedOptions | false | undefined,\n): ResolvedSolidOptions[\"embeds\"] {\n if (options === false) return { github: false, openGraph: false };\n return {\n github: resolveSingleEmbedOptions(options?.github),\n openGraph: resolveSingleEmbedOptions(options?.openGraph),\n };\n}\n\nfunction resolveSingleEmbedOptions<T extends object>(options: boolean | T | undefined): T | false {\n if (options === false) return false;\n if (options === true || options === undefined) return {} as T;\n return options;\n}\n","/**\n * Generates the Solid module a Markdown file compiles to.\n *\n * The output is JSX on purpose. Solid has no runtime element factory to target\n * — `vite-plugin-solid` compiles this into DOM or SSR instructions — so unlike\n * the React and Vue integrations there is no factory-call form to emit.\n */\n\nimport {\n renderIslandComponentImports,\n type ResolvedDocumentComponentImport,\n} from \"@ox-content/vite-plugin\";\nimport type { ComponentIsland, ResolvedSolidOptions } from \"./types\";\n\nexport function generateSolidModule(\n content: string,\n usedComponents: string[],\n _islands: ComponentIsland[] | string[],\n frontmatter: Record<string, unknown>,\n options: ResolvedSolidOptions & { root?: string },\n id: string,\n localBindings?: ReadonlyMap<string, ResolvedDocumentComponentImport>,\n): string {\n const rawHtml = JSON.stringify(content);\n const frontmatterLiteral = JSON.stringify(frontmatter);\n\n // Markdown with no registered component skips the island runtime entirely and\n // compiles to a single `innerHTML` binding — no imports needed, because Solid\n // injects whatever its compiled output requires.\n if (usedComponents.length === 0) {\n return `\nexport const frontmatter = ${frontmatterLiteral};\n\nconst rawHtml = ${rawHtml};\n\nexport default function MarkdownContent() {\n return <div class=\"ox-content\" innerHTML={rawHtml} />;\n}\n`;\n }\n\n const imports = renderIslandComponentImports(usedComponents, {\n globalComponents: options.components,\n localBindings,\n documentPath: id,\n root: options.root,\n });\n const componentMap = usedComponents.map((name) => ` ${name},`).join(\"\\n\");\n\n return `\nimport { onCleanup, onMount } from 'solid-js';\nimport { render } from 'solid-js/web';\nimport { initIslands, readIslandSlotHtml } from '@ox-content/islands';\n${imports}\n\nexport const frontmatter = ${frontmatterLiteral};\n\nconst rawHtml = ${rawHtml};\nconst components = {\n${componentMap}\n};\n\nfunction createSolidHydrate() {\n return (element, props) => {\n const componentName = element.dataset.oxIsland;\n const Component = components[componentName];\n if (!Component) return;\n\n // Read the slot content before clearing: the island element still holds the\n // markup the Markdown transform left behind.\n const islandContent = readIslandSlotHtml(element);\n element.innerHTML = '';\n\n const dispose = render(\n () =>\n islandContent\n ? <Component {...props}><div innerHTML={islandContent} /></Component>\n : <Component {...props} />,\n element,\n );\n\n return () => dispose();\n };\n}\n\nexport default function MarkdownContent() {\n let container;\n\n onMount(() => {\n if (!container) return;\n const controller = initIslands(createSolidHydrate(), {\n selector: '.ox-content [data-ox-island]',\n });\n onCleanup(() => controller.destroy());\n });\n\n return <div class=\"ox-content\" ref={container} innerHTML={rawHtml} />;\n}\n`;\n}\n","/**\n * Markdown-side scanning shared by the Solid transform: locating component\n * tags, keeping fenced samples literal, and round-tripping islands through the\n * rendered HTML as placeholder markers.\n */\n\nimport type { ComponentIsland, ComponentsMap } from \"./types\";\n\nconst COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\\s*([^>]*?)\\s*(?:\\/>|>([\\s\\S]*?)<\\/\\1>)/g;\nconst PROP_REGEX = /([a-zA-Z0-9-]+)(?:=(?:\"([^\"]*)\"|'([^']*)'|{([^}]*)}|\\[([^\\]]*)\\]))?/g;\n\nconst ISLAND_MARKER_PREFIX = \"OXCONTENT-ISLAND-\";\nconst ISLAND_MARKER_SUFFIX = \"-PLACEHOLDER\";\n\ninterface Range {\n start: number;\n end: number;\n}\n\nexport interface ScannedMarkdown {\n /** Markdown with component tags replaced by island placeholder markers. */\n content: string;\n islands: ComponentIsland[];\n usedComponents: string[];\n}\n\n/**\n * Replaces every registered component tag with a placeholder marker that\n * survives Markdown rendering, so the island can be re-attached to the produced\n * HTML afterwards. Tags inside fenced code blocks are left as literal text.\n */\nexport function scanComponents(markdown: string, components: ComponentsMap): ScannedMarkdown {\n const usedComponents: string[] = [];\n const islands: ComponentIsland[] = [];\n const fenceRanges = collectFenceRanges(markdown);\n\n let islandIndex = 0;\n let content = \"\";\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n COMPONENT_REGEX.lastIndex = 0;\n while ((match = COMPONENT_REGEX.exec(markdown)) !== null) {\n const [fullMatch, componentName, propsString, rawIslandContent] = match;\n const matchStart = match.index;\n const matchEnd = matchStart + fullMatch.length;\n\n if (\n !Object.prototype.hasOwnProperty.call(components, componentName) ||\n isInRanges(matchStart, matchEnd, fenceRanges)\n ) {\n content += markdown.slice(lastIndex, matchEnd);\n lastIndex = matchEnd;\n continue;\n }\n\n if (!usedComponents.includes(componentName)) {\n usedComponents.push(componentName);\n }\n\n const islandId = `ox-island-${islandIndex++}`;\n islands.push({\n name: componentName,\n props: parseProps(propsString),\n position: matchStart,\n id: islandId,\n content: typeof rawIslandContent === \"string\" ? rawIslandContent.trim() : undefined,\n });\n\n content += markdown.slice(lastIndex, matchStart) + createIslandMarker(islandId);\n lastIndex = matchEnd;\n }\n\n content += markdown.slice(lastIndex);\n\n return { content, islands, usedComponents };\n}\n\n/** Swaps the placeholder markers in rendered HTML for island mount points. */\nexport function injectIslandMarkers(html: string, islands: ComponentIsland[]): string {\n let output = html;\n\n for (const island of islands) {\n const marker = createIslandMarker(island.id);\n const propsAttr =\n Object.keys(island.props).length > 0\n ? ` data-ox-props='${JSON.stringify(island.props).replace(/'/g, \"&#39;\")}'`\n : \"\";\n const contentAttr = island.content\n ? ` data-ox-content='${island.content.replace(/'/g, \"&#39;\")}'`\n : \"\";\n const attrs = `data-ox-island=\"${island.name}\"${propsAttr}${contentAttr}`;\n output = output.replaceAll(`<p>${marker}</p>`, `<div ${attrs}></div>`);\n output = output.replaceAll(marker, `<span ${attrs}></span>`);\n }\n\n return output;\n}\n\nexport function extractFrontmatter(content: string): {\n content: string;\n frontmatter: Record<string, unknown>;\n} {\n const frontmatterRegex = /^---\\n([\\s\\S]*?)\\n---\\n/;\n const match = frontmatterRegex.exec(content);\n\n if (!match) {\n return { content, frontmatter: {} };\n }\n\n const frontmatter: Record<string, unknown> = {};\n\n for (const line of match[1].split(\"\\n\")) {\n const colonIndex = line.indexOf(\":\");\n if (colonIndex > 0) {\n const key = line.slice(0, colonIndex).trim();\n let value: unknown = line.slice(colonIndex + 1).trim();\n try {\n value = JSON.parse(value as string);\n } catch {\n if (\n typeof value === \"string\" &&\n ((value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\")))\n ) {\n value = value.slice(1, -1);\n }\n }\n frontmatter[key] = value;\n }\n }\n\n return { content: content.slice(match[0].length), frontmatter };\n}\n\nfunction createIslandMarker(islandId: string): string {\n return `${ISLAND_MARKER_PREFIX}${islandId}${ISLAND_MARKER_SUFFIX}`;\n}\n\nfunction collectFenceRanges(content: string): Range[] {\n const ranges: Range[] = [];\n let inFence = false;\n let fenceChar = \"\";\n let fenceLength = 0;\n let fenceStart = 0;\n let pos = 0;\n\n while (pos < content.length) {\n const lineEnd = content.indexOf(\"\\n\", pos);\n const next = lineEnd === -1 ? content.length : lineEnd + 1;\n const line = content.slice(pos, lineEnd === -1 ? content.length : lineEnd);\n const fenceMatch = line.match(/^\\s{0,3}([`~]{3,})/);\n\n if (fenceMatch) {\n const marker = fenceMatch[1];\n if (!inFence) {\n inFence = true;\n fenceChar = marker[0];\n fenceLength = marker.length;\n fenceStart = pos;\n } else if (marker[0] === fenceChar && marker.length >= fenceLength) {\n inFence = false;\n ranges.push({ start: fenceStart, end: next });\n fenceChar = \"\";\n fenceLength = 0;\n }\n }\n\n pos = next;\n }\n\n if (inFence) {\n ranges.push({ start: fenceStart, end: content.length });\n }\n\n return ranges;\n}\n\nfunction isInRanges(start: number, end: number, ranges: Range[]): boolean {\n for (const range of ranges) {\n if (start < range.end && end > range.start) {\n return true;\n }\n }\n return false;\n}\n\nfunction parseProps(propsString: string): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n if (!propsString) return props;\n\n PROP_REGEX.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = PROP_REGEX.exec(propsString)) !== null) {\n const [, name, doubleQuoted, singleQuoted, braceValue, bracketValue] = match;\n if (!name) continue;\n\n if (doubleQuoted !== undefined) props[name] = doubleQuoted;\n else if (singleQuoted !== undefined) props[name] = singleQuoted;\n else if (braceValue !== undefined) {\n try {\n props[name] = JSON.parse(braceValue);\n } catch {\n props[name] = braceValue;\n }\n } else if (bracketValue !== undefined) {\n try {\n props[name] = JSON.parse(`[${bracketValue}]`);\n } catch {\n props[name] = bracketValue;\n }\n } else props[name] = true;\n }\n\n return props;\n}\n","import {\n applyIslandSsrHtml,\n discoverDocumentMdxIslands,\n resolveContentRootPath,\n resolveMdxForFilePath,\n transformMarkdown as baseTransformMarkdown,\n} from \"@ox-content/vite-plugin\";\nimport { generateSolidModule } from \"./codegen\";\nimport { extractFrontmatter, injectIslandMarkers, scanComponents } from \"./markdown\";\nimport type { ResolvedSolidOptions, SolidTransformResult } from \"./types\";\n\nexport async function transformMarkdownWithSolid(\n code: string,\n id: string,\n options: ResolvedSolidOptions,\n): Promise<SolidTransformResult> {\n // `frontmatter: false` means the body is taken verbatim, so a leading `---`\n // block stays in the rendered document instead of becoming module exports.\n const { content: markdownContent, frontmatter } = options.frontmatter\n ? extractFrontmatter(code)\n : { content: code, frontmatter: {} };\n const mdx = resolveMdxForFilePath(id, options.mdx);\n const baseOptions = createBaseOptions(options, mdx);\n\n if (mdx) {\n const transformed = await baseTransformMarkdown(markdownContent, id, baseOptions);\n const discovered = await discoverDocumentMdxIslands({\n source: markdownContent,\n html: transformed.html,\n components: options.components,\n imports: transformed.imports,\n documentPath: id,\n contentRoot: resolveContentRootPath({\n srcDir: options.srcDir,\n root: options.root,\n }),\n srcDir: options.srcDir,\n });\n const html = options.renderIsland\n ? await applyIslandSsrHtml(\n transformed.html,\n options.renderIsland,\n id,\n discovered.usedComponents,\n )\n : transformed.html;\n return {\n code: generateSolidModule(\n html,\n discovered.usedComponents,\n discovered.usedComponents,\n frontmatter,\n options,\n id,\n discovered.localBindings,\n ),\n map: null,\n usedComponents: discovered.usedComponents,\n frontmatter,\n };\n }\n\n const scanned = scanComponents(markdownContent, options.components);\n const transformed = await baseTransformMarkdown(scanned.content, id, baseOptions);\n const htmlWithIslands = injectIslandMarkers(transformed.html, scanned.islands);\n\n return {\n code: generateSolidModule(\n htmlWithIslands,\n scanned.usedComponents,\n scanned.islands,\n frontmatter,\n options,\n id,\n ),\n map: null,\n usedComponents: scanned.usedComponents,\n frontmatter,\n };\n}\n\n/**\n * Options handed to the core Markdown transform.\n *\n * The site-level features (SSG, search, OG images, highlighting) are turned off\n * here: this path only produces the HTML that gets embedded in a Solid module,\n * and the host app owns everything around it. Frontmatter is stripped before\n * this point, so the core parser sees a body-only document.\n */\nfunction createBaseOptions(\n options: ResolvedSolidOptions,\n mdx: boolean,\n): Parameters<typeof baseTransformMarkdown>[2] {\n return {\n srcDir: options.srcDir,\n outDir: options.outDir,\n base: options.base,\n extensions: options.extensions,\n mdx,\n ssg: {\n enabled: false,\n extension: \".html\",\n clean: false,\n bare: false,\n generateOgImage: false,\n lastUpdated: false,\n pagination: false,\n breadcrumbs: false,\n jsonLd: false,\n readerChrome: false,\n localeSwitcher: false,\n a11y: false,\n pageChrome: false,\n },\n gfm: options.gfm,\n frontmatter: false,\n toc: options.toc,\n tocMaxDepth: options.tocMaxDepth,\n codeAnnotations: options.codeAnnotations,\n footnotes: true,\n tables: true,\n taskLists: true,\n strikethrough: true,\n autolinks: options.autolinks,\n highlight: false,\n mermaid: false,\n ogImage: false,\n ogImageOptions: {\n vuePlugin: \"vitejs\",\n width: 1200,\n height: 630,\n cache: true,\n concurrency: 1,\n },\n transformers: [],\n docs: false,\n ogViewer: false,\n search: {\n enabled: false,\n limit: 10,\n prefix: true,\n placeholder: \"Search...\",\n hotkey: \"k\",\n },\n embeds: options.embeds,\n i18n: false,\n } as unknown as Parameters<typeof baseTransformMarkdown>[2];\n}\n","/**\n * Guards against the two ways `vite-plugin-solid` can fail to compile the\n * Markdown modules this plugin emits.\n *\n * Both are configuration mistakes with silent-until-cryptic failure modes, so\n * each is checked as early as it can be observed: plugin presence and ordering\n * are known once the config resolves, while the `extensions` option is held in\n * the Solid plugin's closure and can only be inferred from whether the generated\n * JSX actually got compiled.\n */\n\nimport type { ResolvedConfig } from \"vite\";\n\nexport const TRANSFORM_PLUGIN_NAME = \"ox-content:solid-transform\";\n\nconst SOLID_PLUGIN_NAME = \"solid\";\n\n/**\n * Emitted by both generated module shapes. Solid's JSX has no runtime factory,\n * so this attribute only survives into the final module when nothing compiled\n * the JSX away — which is exactly the misconfiguration worth reporting.\n */\nexport const UNCOMPILED_JSX_MARKER = \"innerHTML={rawHtml}\";\n\nexport function formatSolidPluginError(reason: \"missing\" | \"ordering\" | \"extensions\"): string {\n const example = [\n \" plugins: [\",\n \" oxContentSolid({ srcDir: 'docs' }),\",\n \" solid({ extensions: ['.md', '.markdown', '.mdx'] }),\",\n \" ]\",\n ].join(\"\\n\");\n\n const detail = {\n missing:\n \"vite-plugin-solid was not found in the Vite config. Markdown files are emitted as Solid JSX, which only runs after babel-preset-solid compiles it.\",\n ordering:\n \"vite-plugin-solid runs before oxContentSolid(), so it sees raw Markdown instead of the generated JSX. Both plugins are `enforce: 'pre'`, so their order follows the `plugins` array.\",\n extensions:\n \"vite-plugin-solid did not compile the generated Markdown module. Its `extensions` option must list the Markdown extensions; by default it only looks at .jsx/.tsx files.\",\n }[reason];\n\n return `[ox-content:solid] ${detail}\\n\\n${example}\\n`;\n}\n\n/**\n * Throws when `vite-plugin-solid` is absent, or placed where it would see raw\n * Markdown instead of the JSX this plugin generates.\n */\nexport function verifySolidPluginOrder(config: ResolvedConfig): void {\n const names = config.plugins.map((plugin) => plugin.name);\n const solidIndex = names.indexOf(SOLID_PLUGIN_NAME);\n\n if (solidIndex === -1) {\n throw new Error(formatSolidPluginError(\"missing\"));\n }\n\n const transformIndex = names.indexOf(TRANSFORM_PLUGIN_NAME);\n if (transformIndex !== -1 && solidIndex < transformIndex) {\n throw new Error(formatSolidPluginError(\"ordering\"));\n }\n}\n","/**\n * Vite Plugin for Ox Content Solid Integration\n *\n * Uses Vite's Environment API to enable embedding Solid components in Markdown.\n */\n\nimport type { Plugin, PluginOption, ResolvedConfig } from \"vite\";\nimport { oxContent } from \"@ox-content/vite-plugin\";\nimport { resolveComponentsGlob } from \"./components\";\nimport { createSolidMarkdownEnvironment } from \"./environment\";\nimport { isMarkdownFilePath, resolveSolidOptions } from \"./options\";\nimport { transformMarkdownWithSolid } from \"./transform\";\nimport {\n formatSolidPluginError,\n TRANSFORM_PLUGIN_NAME,\n UNCOMPILED_JSX_MARKER,\n verifySolidPluginOrder,\n} from \"./verify\";\nimport type { SolidIntegrationOptions } from \"./types\";\n\nexport type {\n SolidIntegrationOptions,\n ResolvedSolidOptions,\n ComponentsOption,\n ComponentsMap,\n BuiltinEmbedOptions,\n GitHubEmbedOptions,\n OpenGraphEmbedOptions,\n ResolvedBuiltinEmbedOptions,\n SolidTransformResult,\n ComponentIsland,\n} from \"./types\";\n\n/**\n * Creates the Ox Content Solid integration plugin.\n *\n * Unlike the React and Svelte integrations, this plugin must be listed **before**\n * `vite-plugin-solid`, and that plugin must be told about the Markdown\n * extensions. Markdown is turned into Solid JSX here, and Solid's JSX is\n * compile-time only — `vite-plugin-solid` is what turns it into DOM or SSR\n * instructions.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import solid from 'vite-plugin-solid';\n * import { oxContentSolid } from '@ox-content/vite-plugin-solid';\n *\n * export default defineConfig({\n * plugins: [\n * oxContentSolid({\n * srcDir: 'docs',\n * components: {\n * Counter: './src/components/Counter.tsx',\n * },\n * }),\n * solid({ extensions: ['.md', '.markdown', '.mdx'] }),\n * ],\n * });\n * ```\n */\nexport function oxContentSolid(options: SolidIntegrationOptions = {}): PluginOption[] {\n const resolved = resolveSolidOptions(options);\n let componentMap = new Map<string, string>();\n let config: ResolvedConfig;\n\n if (typeof options.components === \"object\" && !Array.isArray(options.components)) {\n componentMap = new Map(Object.entries(options.components));\n }\n\n const solidTransformPlugin: Plugin = {\n name: TRANSFORM_PLUGIN_NAME,\n enforce: \"pre\",\n\n async configResolved(resolvedConfig) {\n config = resolvedConfig;\n\n if (resolved.verifySolidPlugin) {\n verifySolidPluginOrder(resolvedConfig);\n }\n\n const componentsOption = options.components;\n if (componentsOption) {\n const resolvedComponents = await resolveComponentsGlob(componentsOption, config.root);\n componentMap = new Map(Object.entries(resolvedComponents));\n }\n },\n\n async transform(code, id) {\n if (!isMarkdownFilePath(id, resolved.extensions)) {\n return null;\n }\n\n const result = await transformMarkdownWithSolid(code, id, {\n ...resolved,\n components: Object.fromEntries(componentMap),\n root: config.root,\n renderIsland: options.renderIsland,\n });\n\n return {\n code: result.code,\n map: result.map,\n };\n },\n };\n\n // `post` so every `pre`/normal plugin — vite-plugin-solid included — has\n // already had its turn at the module.\n const solidVerifyPlugin: Plugin = {\n name: \"ox-content:solid-verify\",\n enforce: \"post\",\n\n transform(code, id) {\n if (!resolved.verifySolidPlugin) return null;\n if (!isMarkdownFilePath(id, resolved.extensions)) return null;\n if (!code.includes(UNCOMPILED_JSX_MARKER)) return null;\n\n this.error(formatSolidPluginError(\"extensions\"));\n },\n };\n\n const solidEnvironmentPlugin: Plugin = {\n name: \"ox-content:solid-environment\",\n\n config() {\n const envOptions = {\n ...resolved,\n components: Object.fromEntries(componentMap),\n };\n return {\n environments: {\n oxcontent_ssr: createSolidMarkdownEnvironment(\"ssr\", envOptions),\n oxcontent_client: createSolidMarkdownEnvironment(\"client\", envOptions),\n },\n };\n },\n\n resolveId(id) {\n if (id === \"virtual:ox-content-solid/components\") {\n return \"\\0virtual:ox-content-solid/components\";\n }\n return null;\n },\n\n load(id) {\n if (id === \"\\0virtual:ox-content-solid/components\") {\n return generateComponentsModule(componentMap);\n }\n return null;\n },\n\n applyToEnvironment(environment) {\n return [\"oxcontent_ssr\", \"oxcontent_client\", \"client\", \"ssr\"].includes(environment.name);\n },\n };\n\n const solidHmrPlugin: Plugin = {\n name: \"ox-content:solid-hmr\",\n apply: \"serve\",\n\n handleHotUpdate({ file, server, modules }) {\n const isComponent = Array.from(componentMap.values()).some((path) =>\n file.endsWith(path.replace(/^\\.\\//, \"\")),\n );\n\n if (isComponent) {\n const mdModules = Array.from(server.moduleGraph.idToModuleMap.values()).filter(\n (mod) => mod.file && isMarkdownFilePath(mod.file, resolved.extensions),\n );\n\n if (mdModules.length > 0) {\n server.ws.send({\n type: \"custom\",\n event: \"ox-content:solid-update\",\n data: { file },\n });\n return [...modules, ...mdModules];\n }\n }\n\n return modules;\n },\n };\n\n const basePlugins = oxContent(options).flatMap((plugin) =>\n Array.isArray(plugin) ? plugin : [plugin],\n ) as Plugin[];\n const environmentPlugin = basePlugins.find((plugin) => plugin.name === \"ox-content:environment\");\n const plugins: Plugin[] = [\n solidTransformPlugin,\n solidVerifyPlugin,\n solidEnvironmentPlugin,\n solidHmrPlugin,\n ];\n\n if (environmentPlugin) {\n plugins.push(environmentPlugin);\n }\n\n return plugins;\n}\n\nfunction generateComponentsModule(componentMap: Map<string, string>): string {\n const imports: string[] = [];\n const exports: string[] = [];\n\n componentMap.forEach((path, name) => {\n imports.push(`import ${name} from '${path}';`);\n exports.push(` ${name},`);\n });\n\n return `\n${imports.join(\"\\n\")}\n\nexport const components = {\n${exports.join(\"\\n\")}\n};\n\nexport default components;\n`;\n}\n\nexport { oxContent } from \"@ox-content/vite-plugin\";\n"],"mappings":";;;;;;;;AASA,eAAsB,s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oB,CAAC;CAE3B,aAAa,SAAS,MAAM,SAAS;EACnC,QAAQ,KAAK,UAAU,KAAK,SAAS,KAAK,GAAG;EAC7C,QAAQ,KAAK,KAAK,KAAK,EAAE;CAC3B,CAAC;CAED,OAAO;EACP,QAAQ,KAAK,IAAI,EAAE;;;EAGnB,QAAQ,KAAK,IAAI,EAAE;;;;;AAKrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/vite-plugin-solid",
3
- "version": "2.90.0",
3
+ "version": "3.0.0-alpha.10",
4
4
  "description": "Solid integration for Ox Content - Embed Solid components in Markdown",
5
5
  "keywords": [
6
6
  "markdown",
@@ -35,20 +35,20 @@
35
35
  "provenance": true
36
36
  },
37
37
  "dependencies": {
38
- "@ox-content/islands": "2.90.0",
39
- "@ox-content/vite-plugin": "2.90.0"
38
+ "@ox-content/islands": "3.0.0-alpha.10",
39
+ "@ox-content/vite-plugin": "3.0.0-alpha.10"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/node": "^26.1.2",
42
+ "@types/node": "^26.2.0",
43
43
  "@typescript/native-preview": "^7.0.0-dev.20260707.2",
44
- "solid-js": "^1.9.14",
44
+ "solid-js": "^1.9.15",
45
45
  "typescript": "^7.0.2",
46
46
  "vite": "npm:@voidzero-dev/vite-plus-core@0.2.8",
47
47
  "vite-plugin-solid": "^2.11.14",
48
- "vite-plus": "0.2.8"
48
+ "vite-plus": "0.2.9"
49
49
  },
50
50
  "peerDependencies": {
51
- "solid-js": "^1.9.14",
51
+ "solid-js": "^1.9.15",
52
52
  "vite": "^0.2.8 || ^8.0.0",
53
53
  "vite-plugin-solid": "^2.11.14"
54
54
  },