@ox-content/vite-plugin 2.12.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -683,13 +683,25 @@ const DEFAULT_DOCS_INCLUDE = [
683
683
  */
684
684
  async function extractDocs(srcDirs, options) {
685
685
  const napi = await require_mermaid.importNapiModule();
686
+ if (options.entryPoints?.length) {
687
+ const extractDocsFromEntryPoints = napi.extractDocsFromEntryPoints;
688
+ if (!extractDocsFromEntryPoints) throw new Error("[ox-content] extractDocsFromEntryPoints is not available from @ox-content/napi.");
689
+ return extractDocsFromEntryPoints(options.entryPoints, {
690
+ root: process.cwd(),
691
+ private: options.private,
692
+ internal: options.internal
693
+ }).map((doc) => ({
694
+ file: doc.file,
695
+ entries: doc.entries
696
+ }));
697
+ }
686
698
  const extractFileDocEntries = napi.extractFileDocEntries;
687
699
  if (!extractFileDocEntries) throw new Error("[ox-content] extractFileDocEntries is not available from @ox-content/napi.");
688
700
  const results = [];
689
701
  for (const srcDir of srcDirs) {
690
702
  const files = napi.collectDocsSourceFiles(srcDir, options.include, options.exclude);
691
703
  for (const file of files) {
692
- const entries = extractFileDocEntries(file, options.private);
704
+ const entries = extractFileDocEntries(file, options.private, options.internal);
693
705
  if (entries.length > 0) results.push({
694
706
  file,
695
707
  entries
@@ -781,8 +793,10 @@ function resolveDocsOptions(options) {
781
793
  "**/*.spec.*",
782
794
  "node_modules"
783
795
  ],
796
+ entryPoints: opts.entryPoints?.map((entryPoint) => typeof entryPoint === "string" ? { path: entryPoint } : entryPoint),
784
797
  format: opts.format ?? "markdown",
785
798
  private: opts.private ?? false,
799
+ internal: opts.internal ?? false,
786
800
  toc: false,
787
801
  groupBy: opts.groupBy ?? "file",
788
802
  githubUrl: opts.githubUrl,