@ox-content/vite-plugin 2.63.0 → 2.65.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
@@ -861,7 +861,8 @@ function generateMarkdown(docs, options) {
861
861
  groupOrder: options.groupOrder,
862
862
  sort: options.sort,
863
863
  sortEntryPoints: options.sortEntryPoints,
864
- kindSortOrder: options.kindSortOrder
864
+ kindSortOrder: options.kindSortOrder,
865
+ singleEntryRoot: options.singleEntryRoot
865
866
  });
866
867
  }
867
868
  /**
@@ -879,7 +880,8 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
879
880
  groupOrder: options?.groupOrder,
880
881
  sort: options?.sort,
881
882
  sortEntryPoints: options?.sortEntryPoints,
882
- kindSortOrder: options?.kindSortOrder
883
+ kindSortOrder: options?.kindSortOrder,
884
+ singleEntryRoot: options?.singleEntryRoot
883
885
  });
884
886
  }
885
887
  function toRustDocsModules(docs) {
@@ -955,6 +957,7 @@ function resolveDocsOptions(options) {
955
957
  sort: opts.sort,
956
958
  sortEntryPoints: opts.sortEntryPoints ?? true,
957
959
  kindSortOrder: opts.kindSortOrder,
960
+ singleEntryRoot: opts.singleEntryRoot ?? "preserve",
958
961
  generateNav: opts.generateNav ?? true
959
962
  };
960
963
  }
@@ -3035,6 +3038,108 @@ function generateI18nModule(options, root) {
3035
3038
  throw new Error("[ox-content:i18n] @ox-content/napi does not expose generateI18nModule. Please rebuild the NAPI package.");
3036
3039
  }
3037
3040
  //#endregion
3041
+ //#region src/incremental.ts
3042
+ function toNativeParserOptions(options = {}) {
3043
+ return {
3044
+ gfm: options.gfm ?? true,
3045
+ footnotes: options.footnotes,
3046
+ taskLists: options.taskLists,
3047
+ tables: options.tables,
3048
+ strikethrough: options.strikethrough,
3049
+ autolinks: options.autolinks
3050
+ };
3051
+ }
3052
+ function parseAstJson(json) {
3053
+ return json ? JSON.parse(json) : null;
3054
+ }
3055
+ function normalizeParseResult(result) {
3056
+ const { ast, pendingAst, ...rest } = result;
3057
+ return {
3058
+ ...rest,
3059
+ ast: parseAstJson(ast),
3060
+ astJson: ast,
3061
+ pendingAst: parseAstJson(pendingAst),
3062
+ pendingAstJson: pendingAst
3063
+ };
3064
+ }
3065
+ var IncrementalMarkdownParser = class {
3066
+ #native;
3067
+ #includePendingAst;
3068
+ #completeInline;
3069
+ constructor(options = {}) {
3070
+ const napi = require_napi.importNapiModuleSync();
3071
+ this.#native = new napi.IncrementalMarkdownParser(toNativeParserOptions(options));
3072
+ this.#includePendingAst = options.includePendingAst ?? false;
3073
+ this.#completeInline = options.completeInline ?? true;
3074
+ }
3075
+ append(chunk, options = {}) {
3076
+ return normalizeParseResult(this.#native.append(chunk, {
3077
+ isFinal: options.final ?? false,
3078
+ includePendingAst: options.includePendingAst ?? this.#includePendingAst,
3079
+ completeInline: options.completeInline ?? this.#completeInline
3080
+ }));
3081
+ }
3082
+ finish(options = {}) {
3083
+ return normalizeParseResult(this.#native.finish({
3084
+ includePendingAst: options.includePendingAst ?? this.#includePendingAst,
3085
+ completeInline: options.completeInline ?? this.#completeInline
3086
+ }));
3087
+ }
3088
+ reset() {
3089
+ this.#native.reset();
3090
+ }
3091
+ get pendingMarkdown() {
3092
+ return this.#native.pendingMarkdown;
3093
+ }
3094
+ get committedBytes() {
3095
+ return this.#native.committedBytes;
3096
+ }
3097
+ get totalBytes() {
3098
+ return this.#native.totalBytes;
3099
+ }
3100
+ };
3101
+ var IncrementalMarkdownRenderer = class {
3102
+ #native;
3103
+ #renderPending;
3104
+ #completeInline;
3105
+ constructor(options = {}) {
3106
+ const napi = require_napi.importNapiModuleSync();
3107
+ this.#native = new napi.IncrementalMarkdownRenderer(toNativeParserOptions(options));
3108
+ this.#renderPending = options.renderPending ?? true;
3109
+ this.#completeInline = options.completeInline ?? true;
3110
+ }
3111
+ append(chunk, options = {}) {
3112
+ return this.#native.append(chunk, {
3113
+ isFinal: options.final ?? false,
3114
+ renderPending: options.renderPending ?? this.#renderPending,
3115
+ completeInline: options.completeInline ?? this.#completeInline
3116
+ });
3117
+ }
3118
+ finish() {
3119
+ return this.#native.finish();
3120
+ }
3121
+ reset() {
3122
+ this.#native.reset();
3123
+ }
3124
+ get committedHtml() {
3125
+ return this.#native.committedHtml;
3126
+ }
3127
+ get pendingMarkdown() {
3128
+ return this.#native.pendingMarkdown;
3129
+ }
3130
+ };
3131
+ function createIncrementalMarkdownParser(options) {
3132
+ return new IncrementalMarkdownParser(options);
3133
+ }
3134
+ function createIncrementalMarkdownRenderer(options) {
3135
+ return new IncrementalMarkdownRenderer(options);
3136
+ }
3137
+ async function* renderMarkdownStream(chunks, options = {}) {
3138
+ const renderer = createIncrementalMarkdownRenderer(options);
3139
+ for await (const chunk of chunks) yield renderer.append(chunk);
3140
+ yield renderer.finish();
3141
+ }
3142
+ //#endregion
3038
3143
  //#region src/docs-tests.ts
3039
3144
  var DocsTestRunError = class extends Error {
3040
3145
  result;
@@ -4787,6 +4892,8 @@ exports.DEFAULT_MARKDOWN_EXTENSIONS = DEFAULT_MARKDOWN_EXTENSIONS;
4787
4892
  exports.DefaultTheme = DefaultTheme;
4788
4893
  exports.DocsTestRunError = DocsTestRunError;
4789
4894
  exports.Fragment = Fragment;
4895
+ exports.IncrementalMarkdownParser = IncrementalMarkdownParser;
4896
+ exports.IncrementalMarkdownRenderer = IncrementalMarkdownRenderer;
4790
4897
  exports.buildSearchIndex = buildSearchIndex;
4791
4898
  exports.buildSsg = buildSsg;
4792
4899
  exports.clearRenderContext = clearRenderContext;
@@ -4797,6 +4904,8 @@ exports.collectOgpUrls = require_ogp.collectOgpUrls;
4797
4904
  exports.convertVitePressNav = require_vitepress.convertVitePressNav;
4798
4905
  exports.convertVitePressSidebar = require_vitepress.convertVitePressSidebar;
4799
4906
  exports.createI18nPlugin = createI18nPlugin;
4907
+ exports.createIncrementalMarkdownParser = createIncrementalMarkdownParser;
4908
+ exports.createIncrementalMarkdownRenderer = createIncrementalMarkdownRenderer;
4800
4909
  exports.createMarkdownEnvironment = createMarkdownEnvironment;
4801
4910
  exports.createTheme = createTheme;
4802
4911
  exports.defaultTheme = require_vitepress.defaultTheme;
@@ -4841,6 +4950,7 @@ exports.prefetchGitHubSources = require_github.prefetchGitHubSources;
4841
4950
  exports.prefetchOgpData = require_ogp.prefetchOgpData;
4842
4951
  exports.raw = raw;
4843
4952
  exports.renderAllPages = renderAllPages;
4953
+ exports.renderMarkdownStream = renderMarkdownStream;
4844
4954
  exports.renderPage = renderPage;
4845
4955
  exports.renderToString = renderToString;
4846
4956
  exports.resolveBuiltinEmbedOptions = resolveBuiltinEmbedOptions;