@ox-content/vite-plugin 2.63.0 → 2.64.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/incremental-dom.cjs +179 -0
- package/dist/incremental-dom.cjs.map +1 -0
- package/dist/incremental-dom.d.cts +101 -0
- package/dist/incremental-dom.d.cts.map +1 -0
- package/dist/incremental-dom.d.mts +101 -0
- package/dist/incremental-dom.d.mts.map +1 -0
- package/dist/incremental-dom.mjs +170 -0
- package/dist/incremental-dom.mjs.map +1 -0
- package/dist/index.cjs +107 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +84 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +103 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
package/dist/index.cjs
CHANGED
|
@@ -3035,6 +3035,108 @@ function generateI18nModule(options, root) {
|
|
|
3035
3035
|
throw new Error("[ox-content:i18n] @ox-content/napi does not expose generateI18nModule. Please rebuild the NAPI package.");
|
|
3036
3036
|
}
|
|
3037
3037
|
//#endregion
|
|
3038
|
+
//#region src/incremental.ts
|
|
3039
|
+
function toNativeParserOptions(options = {}) {
|
|
3040
|
+
return {
|
|
3041
|
+
gfm: options.gfm ?? true,
|
|
3042
|
+
footnotes: options.footnotes,
|
|
3043
|
+
taskLists: options.taskLists,
|
|
3044
|
+
tables: options.tables,
|
|
3045
|
+
strikethrough: options.strikethrough,
|
|
3046
|
+
autolinks: options.autolinks
|
|
3047
|
+
};
|
|
3048
|
+
}
|
|
3049
|
+
function parseAstJson(json) {
|
|
3050
|
+
return json ? JSON.parse(json) : null;
|
|
3051
|
+
}
|
|
3052
|
+
function normalizeParseResult(result) {
|
|
3053
|
+
const { ast, pendingAst, ...rest } = result;
|
|
3054
|
+
return {
|
|
3055
|
+
...rest,
|
|
3056
|
+
ast: parseAstJson(ast),
|
|
3057
|
+
astJson: ast,
|
|
3058
|
+
pendingAst: parseAstJson(pendingAst),
|
|
3059
|
+
pendingAstJson: pendingAst
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3062
|
+
var IncrementalMarkdownParser = class {
|
|
3063
|
+
#native;
|
|
3064
|
+
#includePendingAst;
|
|
3065
|
+
#completeInline;
|
|
3066
|
+
constructor(options = {}) {
|
|
3067
|
+
const napi = require_napi.importNapiModuleSync();
|
|
3068
|
+
this.#native = new napi.IncrementalMarkdownParser(toNativeParserOptions(options));
|
|
3069
|
+
this.#includePendingAst = options.includePendingAst ?? false;
|
|
3070
|
+
this.#completeInline = options.completeInline ?? true;
|
|
3071
|
+
}
|
|
3072
|
+
append(chunk, options = {}) {
|
|
3073
|
+
return normalizeParseResult(this.#native.append(chunk, {
|
|
3074
|
+
isFinal: options.final ?? false,
|
|
3075
|
+
includePendingAst: options.includePendingAst ?? this.#includePendingAst,
|
|
3076
|
+
completeInline: options.completeInline ?? this.#completeInline
|
|
3077
|
+
}));
|
|
3078
|
+
}
|
|
3079
|
+
finish(options = {}) {
|
|
3080
|
+
return normalizeParseResult(this.#native.finish({
|
|
3081
|
+
includePendingAst: options.includePendingAst ?? this.#includePendingAst,
|
|
3082
|
+
completeInline: options.completeInline ?? this.#completeInline
|
|
3083
|
+
}));
|
|
3084
|
+
}
|
|
3085
|
+
reset() {
|
|
3086
|
+
this.#native.reset();
|
|
3087
|
+
}
|
|
3088
|
+
get pendingMarkdown() {
|
|
3089
|
+
return this.#native.pendingMarkdown;
|
|
3090
|
+
}
|
|
3091
|
+
get committedBytes() {
|
|
3092
|
+
return this.#native.committedBytes;
|
|
3093
|
+
}
|
|
3094
|
+
get totalBytes() {
|
|
3095
|
+
return this.#native.totalBytes;
|
|
3096
|
+
}
|
|
3097
|
+
};
|
|
3098
|
+
var IncrementalMarkdownRenderer = class {
|
|
3099
|
+
#native;
|
|
3100
|
+
#renderPending;
|
|
3101
|
+
#completeInline;
|
|
3102
|
+
constructor(options = {}) {
|
|
3103
|
+
const napi = require_napi.importNapiModuleSync();
|
|
3104
|
+
this.#native = new napi.IncrementalMarkdownRenderer(toNativeParserOptions(options));
|
|
3105
|
+
this.#renderPending = options.renderPending ?? true;
|
|
3106
|
+
this.#completeInline = options.completeInline ?? true;
|
|
3107
|
+
}
|
|
3108
|
+
append(chunk, options = {}) {
|
|
3109
|
+
return this.#native.append(chunk, {
|
|
3110
|
+
isFinal: options.final ?? false,
|
|
3111
|
+
renderPending: options.renderPending ?? this.#renderPending,
|
|
3112
|
+
completeInline: options.completeInline ?? this.#completeInline
|
|
3113
|
+
});
|
|
3114
|
+
}
|
|
3115
|
+
finish() {
|
|
3116
|
+
return this.#native.finish();
|
|
3117
|
+
}
|
|
3118
|
+
reset() {
|
|
3119
|
+
this.#native.reset();
|
|
3120
|
+
}
|
|
3121
|
+
get committedHtml() {
|
|
3122
|
+
return this.#native.committedHtml;
|
|
3123
|
+
}
|
|
3124
|
+
get pendingMarkdown() {
|
|
3125
|
+
return this.#native.pendingMarkdown;
|
|
3126
|
+
}
|
|
3127
|
+
};
|
|
3128
|
+
function createIncrementalMarkdownParser(options) {
|
|
3129
|
+
return new IncrementalMarkdownParser(options);
|
|
3130
|
+
}
|
|
3131
|
+
function createIncrementalMarkdownRenderer(options) {
|
|
3132
|
+
return new IncrementalMarkdownRenderer(options);
|
|
3133
|
+
}
|
|
3134
|
+
async function* renderMarkdownStream(chunks, options = {}) {
|
|
3135
|
+
const renderer = createIncrementalMarkdownRenderer(options);
|
|
3136
|
+
for await (const chunk of chunks) yield renderer.append(chunk);
|
|
3137
|
+
yield renderer.finish();
|
|
3138
|
+
}
|
|
3139
|
+
//#endregion
|
|
3038
3140
|
//#region src/docs-tests.ts
|
|
3039
3141
|
var DocsTestRunError = class extends Error {
|
|
3040
3142
|
result;
|
|
@@ -4787,6 +4889,8 @@ exports.DEFAULT_MARKDOWN_EXTENSIONS = DEFAULT_MARKDOWN_EXTENSIONS;
|
|
|
4787
4889
|
exports.DefaultTheme = DefaultTheme;
|
|
4788
4890
|
exports.DocsTestRunError = DocsTestRunError;
|
|
4789
4891
|
exports.Fragment = Fragment;
|
|
4892
|
+
exports.IncrementalMarkdownParser = IncrementalMarkdownParser;
|
|
4893
|
+
exports.IncrementalMarkdownRenderer = IncrementalMarkdownRenderer;
|
|
4790
4894
|
exports.buildSearchIndex = buildSearchIndex;
|
|
4791
4895
|
exports.buildSsg = buildSsg;
|
|
4792
4896
|
exports.clearRenderContext = clearRenderContext;
|
|
@@ -4797,6 +4901,8 @@ exports.collectOgpUrls = require_ogp.collectOgpUrls;
|
|
|
4797
4901
|
exports.convertVitePressNav = require_vitepress.convertVitePressNav;
|
|
4798
4902
|
exports.convertVitePressSidebar = require_vitepress.convertVitePressSidebar;
|
|
4799
4903
|
exports.createI18nPlugin = createI18nPlugin;
|
|
4904
|
+
exports.createIncrementalMarkdownParser = createIncrementalMarkdownParser;
|
|
4905
|
+
exports.createIncrementalMarkdownRenderer = createIncrementalMarkdownRenderer;
|
|
4800
4906
|
exports.createMarkdownEnvironment = createMarkdownEnvironment;
|
|
4801
4907
|
exports.createTheme = createTheme;
|
|
4802
4908
|
exports.defaultTheme = require_vitepress.defaultTheme;
|
|
@@ -4841,6 +4947,7 @@ exports.prefetchGitHubSources = require_github.prefetchGitHubSources;
|
|
|
4841
4947
|
exports.prefetchOgpData = require_ogp.prefetchOgpData;
|
|
4842
4948
|
exports.raw = raw;
|
|
4843
4949
|
exports.renderAllPages = renderAllPages;
|
|
4950
|
+
exports.renderMarkdownStream = renderMarkdownStream;
|
|
4844
4951
|
exports.renderPage = renderPage;
|
|
4845
4952
|
exports.renderToString = renderToString;
|
|
4846
4953
|
exports.resolveBuiltinEmbedOptions = resolveBuiltinEmbedOptions;
|