fumadocs-core 15.6.9 → 15.6.11
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/{algolia-UCGCELZZ.js → algolia-KPRGMSJO.js} +26 -18
- package/dist/chunk-CNWEGOUF.js +53 -0
- package/dist/{chunk-62HKBTBF.js → chunk-KIJ7AMBP.js} +9 -1
- package/dist/mdx-plugins/index.js +122 -90
- package/dist/{mixedbread-2MQ3PSN7.js → mixedbread-AG5AAOKO.js} +1 -2
- package/dist/{orama-cloud-6T5Z4MZY.js → orama-cloud-BYTAI6QU.js} +25 -19
- package/dist/search/client.d.ts +3 -3
- package/dist/search/client.js +4 -4
- package/dist/search/server.d.ts +3 -2
- package/dist/search/server.js +5 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/shared-ORgOfXFw.d.ts +19 -0
- package/dist/{static-7YX4RCT6.js → static-IWYDJ3C5.js} +2 -1
- package/package.json +8 -8
- package/dist/types-Ch8gnVgO.d.ts +0 -8
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContentHighlighter
|
|
3
|
+
} from "./chunk-CNWEGOUF.js";
|
|
1
4
|
import "./chunk-JSBRDJBE.js";
|
|
2
5
|
|
|
3
6
|
// src/search/client/algolia.ts
|
|
@@ -24,24 +27,29 @@ function groupResults(hits) {
|
|
|
24
27
|
return grouped;
|
|
25
28
|
}
|
|
26
29
|
async function searchDocs(query, { indexName, onSearch, client, locale, tag }) {
|
|
27
|
-
if (query.length
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
if (query.trim().length === 0) return [];
|
|
31
|
+
const result = onSearch ? await onSearch(query, tag, locale) : await client.searchForHits({
|
|
32
|
+
requests: [
|
|
33
|
+
{
|
|
34
|
+
type: "default",
|
|
35
|
+
indexName,
|
|
36
|
+
query,
|
|
37
|
+
distinct: 5,
|
|
38
|
+
hitsPerPage: 10,
|
|
39
|
+
filters: tag ? `tag:${tag}` : void 0
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
const highlighter = createContentHighlighter(query);
|
|
44
|
+
return groupResults(result.results[0].hits).flatMap((hit) => {
|
|
45
|
+
if (hit.type === "page") {
|
|
46
|
+
return {
|
|
47
|
+
...hit,
|
|
48
|
+
contentWithHighlights: hit.contentWithHighlights ?? highlighter.highlight(hit.content)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return [];
|
|
52
|
+
});
|
|
45
53
|
}
|
|
46
54
|
export {
|
|
47
55
|
groupResults,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/search/shared.ts
|
|
2
|
+
function escapeRegExp(input) {
|
|
3
|
+
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4
|
+
}
|
|
5
|
+
function buildRegexFromQuery(q) {
|
|
6
|
+
const trimmed = q.trim();
|
|
7
|
+
if (trimmed.length === 0) return null;
|
|
8
|
+
const terms = Array.from(
|
|
9
|
+
new Set(
|
|
10
|
+
trimmed.split(/\s+/).map((t) => t.trim()).filter(Boolean)
|
|
11
|
+
)
|
|
12
|
+
);
|
|
13
|
+
if (terms.length === 0) return null;
|
|
14
|
+
const escaped = terms.map(escapeRegExp).join("|");
|
|
15
|
+
return new RegExp(`(${escaped})`, "gi");
|
|
16
|
+
}
|
|
17
|
+
function createContentHighlighter(query) {
|
|
18
|
+
const regex = typeof query === "string" ? buildRegexFromQuery(query) : query;
|
|
19
|
+
return {
|
|
20
|
+
highlight(content) {
|
|
21
|
+
if (!regex) return [{ type: "text", content }];
|
|
22
|
+
const out = [];
|
|
23
|
+
let i = 0;
|
|
24
|
+
for (const match of content.matchAll(regex)) {
|
|
25
|
+
if (i < match.index) {
|
|
26
|
+
out.push({
|
|
27
|
+
type: "text",
|
|
28
|
+
content: content.substring(i, match.index)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
out.push({
|
|
32
|
+
type: "text",
|
|
33
|
+
content: match[0],
|
|
34
|
+
styles: {
|
|
35
|
+
highlight: true
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
i = match.index + match[0].length;
|
|
39
|
+
}
|
|
40
|
+
if (i < content.length) {
|
|
41
|
+
out.push({
|
|
42
|
+
type: "text",
|
|
43
|
+
content: content.substring(i)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
createContentHighlighter
|
|
53
|
+
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
removeUndefined
|
|
3
3
|
} from "./chunk-KAOEMCTI.js";
|
|
4
|
+
import {
|
|
5
|
+
createContentHighlighter
|
|
6
|
+
} from "./chunk-CNWEGOUF.js";
|
|
4
7
|
|
|
5
8
|
// src/search/orama/search/simple.ts
|
|
6
9
|
import { search } from "@orama/orama";
|
|
7
10
|
async function searchSimple(db, query, params = {}) {
|
|
11
|
+
const highlighter = createContentHighlighter(query);
|
|
8
12
|
const result = await search(db, {
|
|
9
13
|
term: query,
|
|
10
14
|
tolerance: 1,
|
|
@@ -17,6 +21,7 @@ async function searchSimple(db, query, params = {}) {
|
|
|
17
21
|
return result.hits.map((hit) => ({
|
|
18
22
|
type: "page",
|
|
19
23
|
content: hit.document.title,
|
|
24
|
+
contentWithHighlights: highlighter.highlight(hit.document.title),
|
|
20
25
|
id: hit.document.url,
|
|
21
26
|
url: hit.document.url
|
|
22
27
|
}));
|
|
@@ -47,16 +52,18 @@ async function searchAdvanced(db, query, tag = [], extraParams = {}) {
|
|
|
47
52
|
properties: ["content"]
|
|
48
53
|
};
|
|
49
54
|
}
|
|
55
|
+
const highlighter = createContentHighlighter(query);
|
|
50
56
|
const result = await search2(db, params);
|
|
51
57
|
const list = [];
|
|
52
58
|
for (const item of result.groups ?? []) {
|
|
53
59
|
const pageId = item.values[0];
|
|
54
|
-
const page =
|
|
60
|
+
const page = getByID(db, pageId);
|
|
55
61
|
if (!page) continue;
|
|
56
62
|
list.push({
|
|
57
63
|
id: pageId,
|
|
58
64
|
type: "page",
|
|
59
65
|
content: page.content,
|
|
66
|
+
contentWithHighlights: highlighter.highlight(page.content),
|
|
60
67
|
url: page.url
|
|
61
68
|
});
|
|
62
69
|
for (const hit of item.result) {
|
|
@@ -64,6 +71,7 @@ async function searchAdvanced(db, query, tag = [], extraParams = {}) {
|
|
|
64
71
|
list.push({
|
|
65
72
|
id: hit.document.id.toString(),
|
|
66
73
|
content: hit.document.content,
|
|
74
|
+
contentWithHighlights: highlighter.highlight(hit.document.content),
|
|
67
75
|
type: hit.document.type,
|
|
68
76
|
url: hit.document.url
|
|
69
77
|
});
|
|
@@ -308,6 +308,7 @@ import * as path from "path";
|
|
|
308
308
|
import { visit } from "unist-util-visit";
|
|
309
309
|
import { imageSize } from "image-size";
|
|
310
310
|
import { imageSizeFromFile } from "image-size/fromFile";
|
|
311
|
+
import { fileURLToPath } from "url";
|
|
311
312
|
var VALID_BLUR_EXT = [".jpeg", ".png", ".webp", ".avif", ".jpg"];
|
|
312
313
|
var EXTERNAL_URL_REGEX = /^https?:\/\//;
|
|
313
314
|
function remarkImage({
|
|
@@ -320,79 +321,21 @@ function remarkImage({
|
|
|
320
321
|
return async (tree, file) => {
|
|
321
322
|
const importsToInject = [];
|
|
322
323
|
const promises = [];
|
|
323
|
-
function
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
visit(tree, "image", (node) => {
|
|
333
|
-
const url = decodeURI(node.url);
|
|
334
|
-
if (!url) return;
|
|
335
|
-
const isExternal = EXTERNAL_URL_REGEX.test(url);
|
|
336
|
-
if (isExternal && external || !useImport) {
|
|
337
|
-
const task = getImageSize(url, publicDir).then((size) => {
|
|
338
|
-
if (!size.width || !size.height) return;
|
|
339
|
-
Object.assign(node, {
|
|
340
|
-
type: "mdxJsxFlowElement",
|
|
341
|
-
name: "img",
|
|
342
|
-
attributes: [
|
|
343
|
-
{
|
|
344
|
-
type: "mdxJsxAttribute",
|
|
345
|
-
name: "alt",
|
|
346
|
-
value: node.alt ?? "image"
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
type: "mdxJsxAttribute",
|
|
350
|
-
name: "src",
|
|
351
|
-
value: url
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
type: "mdxJsxAttribute",
|
|
355
|
-
name: "width",
|
|
356
|
-
value: size.width.toString()
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
type: "mdxJsxAttribute",
|
|
360
|
-
name: "height",
|
|
361
|
-
value: size.height.toString()
|
|
362
|
-
}
|
|
363
|
-
],
|
|
364
|
-
children: []
|
|
365
|
-
});
|
|
366
|
-
}).catch((e) => {
|
|
367
|
-
if (onError === "hide") {
|
|
368
|
-
Object.assign(node, {
|
|
369
|
-
type: "mdxJsxFlowElement",
|
|
370
|
-
name: null,
|
|
371
|
-
attributes: [],
|
|
372
|
-
children: []
|
|
373
|
-
});
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
if (onError === "ignore") return;
|
|
377
|
-
if (onError === "error") {
|
|
378
|
-
throw new Error(
|
|
379
|
-
`[Remark Image] Failed obtain image size for ${url} (public directory configured as ${publicDir})`,
|
|
380
|
-
{
|
|
381
|
-
cause: e
|
|
382
|
-
}
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
onError(e);
|
|
386
|
-
});
|
|
387
|
-
promises.push(task);
|
|
388
|
-
} else if (!isExternal) {
|
|
389
|
-
const variableName = `__img${importsToInject.length.toString()}`;
|
|
390
|
-
const hasBlur = placeholder === "blur" && VALID_BLUR_EXT.some((ext) => url.endsWith(ext));
|
|
324
|
+
async function onImage(src, node) {
|
|
325
|
+
if (src.type === "file" && useImport) {
|
|
326
|
+
const variableName = `__img${importsToInject.length}`;
|
|
327
|
+
const hasBlur = placeholder === "blur" && VALID_BLUR_EXT.some((ext) => src.file.endsWith(ext));
|
|
328
|
+
if (!file.dirname) {
|
|
329
|
+
throw new Error(
|
|
330
|
+
"When `useImport` is enabled, you must specify `dirname` in the VFile passed to compiler."
|
|
331
|
+
);
|
|
332
|
+
}
|
|
391
333
|
importsToInject.push({
|
|
392
334
|
variableName,
|
|
393
|
-
importPath: getImportPath(
|
|
335
|
+
importPath: getImportPath(src.file, file.dirname)
|
|
394
336
|
});
|
|
395
|
-
|
|
337
|
+
const out = {
|
|
338
|
+
children: [],
|
|
396
339
|
type: "mdxJsxFlowElement",
|
|
397
340
|
name: "img",
|
|
398
341
|
attributes: [
|
|
@@ -401,11 +344,6 @@ function remarkImage({
|
|
|
401
344
|
name: "alt",
|
|
402
345
|
value: node.alt ?? "image"
|
|
403
346
|
},
|
|
404
|
-
hasBlur && {
|
|
405
|
-
type: "mdxJsxAttribute",
|
|
406
|
-
name: "placeholder",
|
|
407
|
-
value: "blur"
|
|
408
|
-
},
|
|
409
347
|
{
|
|
410
348
|
type: "mdxJsxAttribute",
|
|
411
349
|
name: "src",
|
|
@@ -419,14 +357,83 @@ function remarkImage({
|
|
|
419
357
|
type: "ExpressionStatement",
|
|
420
358
|
expression: { type: "Identifier", name: variableName }
|
|
421
359
|
}
|
|
422
|
-
]
|
|
360
|
+
],
|
|
361
|
+
type: "Program",
|
|
362
|
+
sourceType: "script"
|
|
423
363
|
}
|
|
424
364
|
}
|
|
425
365
|
}
|
|
426
366
|
}
|
|
427
|
-
]
|
|
428
|
-
}
|
|
367
|
+
]
|
|
368
|
+
};
|
|
369
|
+
if (hasBlur) {
|
|
370
|
+
out.attributes.push({
|
|
371
|
+
type: "mdxJsxAttribute",
|
|
372
|
+
name: "placeholder",
|
|
373
|
+
value: "blur"
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
return out;
|
|
429
377
|
}
|
|
378
|
+
if (src.type === "url" && !external) return;
|
|
379
|
+
const size = await getImageSize(src).catch((e) => {
|
|
380
|
+
throw new Error(
|
|
381
|
+
`[Remark Image] Failed obtain image size for ${node.url} (public directory configured as ${publicDir})`,
|
|
382
|
+
{
|
|
383
|
+
cause: e
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
});
|
|
387
|
+
return {
|
|
388
|
+
type: "mdxJsxFlowElement",
|
|
389
|
+
name: "img",
|
|
390
|
+
attributes: [
|
|
391
|
+
{
|
|
392
|
+
type: "mdxJsxAttribute",
|
|
393
|
+
name: "alt",
|
|
394
|
+
value: node.alt ?? "image"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
type: "mdxJsxAttribute",
|
|
398
|
+
name: "src",
|
|
399
|
+
// `src` doesn't support file paths, we can use `node.url` for files and let the underlying framework handle it
|
|
400
|
+
value: src.type === "url" ? src.url.toString() : node.url
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
type: "mdxJsxAttribute",
|
|
404
|
+
name: "width",
|
|
405
|
+
value: size.width.toString()
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
type: "mdxJsxAttribute",
|
|
409
|
+
name: "height",
|
|
410
|
+
value: size.height.toString()
|
|
411
|
+
}
|
|
412
|
+
],
|
|
413
|
+
children: []
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
visit(tree, "image", (node) => {
|
|
417
|
+
const src = parseSrc(decodeURI(node.url), publicDir, file.dirname);
|
|
418
|
+
if (!src) return;
|
|
419
|
+
const task = onImage(src, node).catch((e) => {
|
|
420
|
+
if (onError === "ignore" || node.url.endsWith(".svg")) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (onError === "hide") {
|
|
424
|
+
return {
|
|
425
|
+
type: "mdxJsxFlowElement",
|
|
426
|
+
name: null,
|
|
427
|
+
attributes: [],
|
|
428
|
+
children: []
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
if (onError === "error") throw e;
|
|
432
|
+
onError(e);
|
|
433
|
+
}).then((res) => {
|
|
434
|
+
if (res) Object.assign(node, res);
|
|
435
|
+
});
|
|
436
|
+
promises.push(task);
|
|
430
437
|
});
|
|
431
438
|
await Promise.all(promises);
|
|
432
439
|
if (importsToInject.length === 0) return;
|
|
@@ -454,22 +461,47 @@ function remarkImage({
|
|
|
454
461
|
tree.children.unshift(...imports);
|
|
455
462
|
};
|
|
456
463
|
}
|
|
457
|
-
|
|
458
|
-
const
|
|
459
|
-
|
|
464
|
+
function getImportPath(file, dir) {
|
|
465
|
+
const relative2 = slash(path.relative(dir, file));
|
|
466
|
+
return relative2.startsWith("../") ? relative2 : `./${relative2}`;
|
|
467
|
+
}
|
|
468
|
+
function parseSrc(src, publicDir, dir) {
|
|
469
|
+
if (src.startsWith("file:///"))
|
|
470
|
+
return { type: "file", file: fileURLToPath(src) };
|
|
460
471
|
if (EXTERNAL_URL_REGEX.test(src)) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
url = base.toString();
|
|
466
|
-
} else {
|
|
467
|
-
return imageSizeFromFile(isRelative ? path.join(dir, src) : src);
|
|
472
|
+
return {
|
|
473
|
+
type: "url",
|
|
474
|
+
url: new URL(src)
|
|
475
|
+
};
|
|
468
476
|
}
|
|
469
|
-
|
|
477
|
+
if (src.startsWith("/")) {
|
|
478
|
+
if (EXTERNAL_URL_REGEX.test(publicDir)) {
|
|
479
|
+
const url = new URL(publicDir);
|
|
480
|
+
url.pathname = joinPath(url.pathname, src);
|
|
481
|
+
return { type: "url", url };
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
type: "file",
|
|
485
|
+
file: path.join(publicDir, src)
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
if (!dir) {
|
|
489
|
+
console.warn(
|
|
490
|
+
`[Remark Image] found relative path ${src} but missing 'dirname' in VFile, this image will be skipped for now.`
|
|
491
|
+
);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
type: "file",
|
|
496
|
+
file: path.join(dir, src)
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
async function getImageSize(src) {
|
|
500
|
+
if (src.type === "file") return imageSizeFromFile(src.file);
|
|
501
|
+
const res = await fetch(src.url);
|
|
470
502
|
if (!res.ok) {
|
|
471
503
|
throw new Error(
|
|
472
|
-
`[Remark Image] Failed to fetch ${url} (${res.status}): ${await res.text()}`
|
|
504
|
+
`[Remark Image] Failed to fetch ${src.url} (${res.status}): ${await res.text()}`
|
|
473
505
|
);
|
|
474
506
|
}
|
|
475
507
|
return imageSize(new Uint8Array(await res.arrayBuffer()));
|
|
@@ -88,7 +88,7 @@ async function search(query, options) {
|
|
|
88
88
|
return_metadata: true
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
|
|
91
|
+
return res.data.flatMap((item) => {
|
|
92
92
|
const metadata = item.generated_metadata;
|
|
93
93
|
const url = metadata.url || "#";
|
|
94
94
|
const title = metadata.title || "Untitled";
|
|
@@ -112,7 +112,6 @@ async function search(query, options) {
|
|
|
112
112
|
}
|
|
113
113
|
return chunkResults;
|
|
114
114
|
});
|
|
115
|
-
return results;
|
|
116
115
|
}
|
|
117
116
|
export {
|
|
118
117
|
search
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
removeUndefined
|
|
3
3
|
} from "./chunk-KAOEMCTI.js";
|
|
4
|
+
import {
|
|
5
|
+
createContentHighlighter
|
|
6
|
+
} from "./chunk-CNWEGOUF.js";
|
|
4
7
|
import "./chunk-JSBRDJBE.js";
|
|
5
8
|
|
|
6
9
|
// src/search/client/orama-cloud.ts
|
|
7
10
|
async function searchDocs(query, options) {
|
|
11
|
+
const highlighter = createContentHighlighter(query);
|
|
8
12
|
const list = [];
|
|
9
13
|
const { index = "default", client, params: extraParams = {}, tag } = options;
|
|
10
14
|
if (index === "crawler") {
|
|
@@ -20,26 +24,26 @@ async function searchDocs(query, options) {
|
|
|
20
24
|
limit: 10
|
|
21
25
|
});
|
|
22
26
|
if (!result2) return list;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return list;
|
|
27
|
+
for (const hit of result2.hits) {
|
|
28
|
+
const doc = hit.document;
|
|
29
|
+
list.push(
|
|
30
|
+
{
|
|
31
|
+
id: hit.id,
|
|
32
|
+
type: "page",
|
|
33
|
+
content: doc.title,
|
|
34
|
+
contentWithHighlights: highlighter.highlight(doc.title),
|
|
35
|
+
url: doc.path
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "page" + hit.id,
|
|
39
|
+
type: "text",
|
|
40
|
+
content: doc.content,
|
|
41
|
+
contentWithHighlights: highlighter.highlight(doc.content),
|
|
42
|
+
url: doc.path
|
|
43
|
+
}
|
|
44
|
+
);
|
|
42
45
|
}
|
|
46
|
+
return list;
|
|
43
47
|
}
|
|
44
48
|
const params = {
|
|
45
49
|
...extraParams,
|
|
@@ -65,6 +69,7 @@ async function searchDocs(query, options) {
|
|
|
65
69
|
id: doc.page_id,
|
|
66
70
|
type: "page",
|
|
67
71
|
content: doc.title,
|
|
72
|
+
contentWithHighlights: highlighter.highlight(doc.title),
|
|
68
73
|
url: doc.url
|
|
69
74
|
});
|
|
70
75
|
addedHead = true;
|
|
@@ -72,6 +77,7 @@ async function searchDocs(query, options) {
|
|
|
72
77
|
list.push({
|
|
73
78
|
id: doc.id,
|
|
74
79
|
content: doc.content,
|
|
80
|
+
contentWithHighlights: highlighter.highlight(doc.content),
|
|
75
81
|
type: doc.content === doc.section ? "heading" : "text",
|
|
76
82
|
url: doc.section_id ? `${doc.url}#${doc.section_id}` : doc.url
|
|
77
83
|
});
|
package/dist/search/client.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { S as SortedResult } from '../types-Ch8gnVgO.js';
|
|
2
1
|
import { AnyOrama } from '@orama/orama';
|
|
2
|
+
import '../remark-structure-DVje0Sib.js';
|
|
3
3
|
import { BaseIndex } from './algolia.js';
|
|
4
4
|
import { LiteClient, SearchResponse } from 'algoliasearch/lite';
|
|
5
5
|
import { OramaClient, ClientSearchParams } from '@oramacloud/client';
|
|
6
6
|
import Mixedbread from '@mixedbread/sdk';
|
|
7
|
-
import '
|
|
8
|
-
import '../remark-structure-DVje0Sib.js';
|
|
7
|
+
import { S as SortedResult } from '../shared-ORgOfXFw.js';
|
|
9
8
|
import 'mdast';
|
|
10
9
|
import 'unified';
|
|
11
10
|
import 'mdast-util-mdx-jsx';
|
|
11
|
+
import 'algoliasearch';
|
|
12
12
|
|
|
13
13
|
interface FetchOptions {
|
|
14
14
|
/**
|
package/dist/search/client.js
CHANGED
|
@@ -69,19 +69,19 @@ function useDocsSearch(clientOptions, _locale, _tag, _delayMs = 100, _allowEmpty
|
|
|
69
69
|
return fetchDocs(debouncedValue, client);
|
|
70
70
|
}
|
|
71
71
|
if (client.type === "algolia") {
|
|
72
|
-
const { searchDocs } = await import("../algolia-
|
|
72
|
+
const { searchDocs } = await import("../algolia-KPRGMSJO.js");
|
|
73
73
|
return searchDocs(debouncedValue, client);
|
|
74
74
|
}
|
|
75
75
|
if (client.type === "orama-cloud") {
|
|
76
|
-
const { searchDocs } = await import("../orama-cloud-
|
|
76
|
+
const { searchDocs } = await import("../orama-cloud-BYTAI6QU.js");
|
|
77
77
|
return searchDocs(debouncedValue, client);
|
|
78
78
|
}
|
|
79
79
|
if (client.type === "static") {
|
|
80
|
-
const { search: search2 } = await import("../static-
|
|
80
|
+
const { search: search2 } = await import("../static-IWYDJ3C5.js");
|
|
81
81
|
return search2(debouncedValue, client);
|
|
82
82
|
}
|
|
83
83
|
if (client.type === "mixedbread") {
|
|
84
|
-
const { search: search2 } = await import("../mixedbread-
|
|
84
|
+
const { search: search2 } = await import("../mixedbread-AG5AAOKO.js");
|
|
85
85
|
return search2(debouncedValue, client);
|
|
86
86
|
}
|
|
87
87
|
throw new Error("unknown search client");
|
package/dist/search/server.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TypedDocument, Orama, Language, RawData, create, SearchParams } from '@orama/orama';
|
|
2
2
|
import { S as StructuredData } from '../remark-structure-DVje0Sib.js';
|
|
3
|
-
import { S as SortedResult } from '../
|
|
3
|
+
import { S as SortedResult } from '../shared-ORgOfXFw.js';
|
|
4
|
+
export { H as HighlightedText, c as createContentHighlighter } from '../shared-ORgOfXFw.js';
|
|
4
5
|
import { I18nConfig } from '../i18n/index.js';
|
|
5
6
|
import { LoaderOutput, LoaderConfig, InferPageType } from '../source/index.js';
|
|
6
7
|
import 'mdast';
|
|
@@ -133,4 +134,4 @@ interface AdvancedIndex {
|
|
|
133
134
|
}
|
|
134
135
|
declare function initAdvancedSearch(options: AdvancedOptions): SearchServer;
|
|
135
136
|
|
|
136
|
-
export { type AdvancedIndex, type AdvancedOptions, type Dynamic, type ExportedData, type Index, type SearchAPI, type SearchServer, type SimpleOptions, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
|
137
|
+
export { type AdvancedIndex, type AdvancedOptions, type Dynamic, type ExportedData, type Index, type SearchAPI, type SearchServer, type SimpleOptions, SortedResult, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
package/dist/search/server.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
searchAdvanced,
|
|
3
3
|
searchSimple
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-KIJ7AMBP.js";
|
|
5
5
|
import "../chunk-KAOEMCTI.js";
|
|
6
|
+
import {
|
|
7
|
+
createContentHighlighter
|
|
8
|
+
} from "../chunk-CNWEGOUF.js";
|
|
6
9
|
import {
|
|
7
10
|
basename,
|
|
8
11
|
extname
|
|
@@ -339,6 +342,7 @@ function initAdvancedSearch(options) {
|
|
|
339
342
|
};
|
|
340
343
|
}
|
|
341
344
|
export {
|
|
345
|
+
createContentHighlighter,
|
|
342
346
|
createFromSource,
|
|
343
347
|
createI18nSearchAPI,
|
|
344
348
|
createSearchAPI,
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { a as TOCItemType, T as TableOfContents, g as getTableOfContents } from '../get-toc-Cr2URuiP.js';
|
|
2
2
|
import { N as Node, I as Item, R as Root, F as Folder } from '../page-tree-bSt6K__E.js';
|
|
3
3
|
export { p as PageTree } from '../page-tree-bSt6K__E.js';
|
|
4
|
-
export { S as SortedResult } from '../types-Ch8gnVgO.js';
|
|
5
4
|
import { Metadata } from 'next';
|
|
6
5
|
import { NextRequest } from 'next/server';
|
|
7
6
|
import { LoaderOutput, LoaderConfig, InferPageType } from '../source/index.js';
|
|
7
|
+
export { S as SortedResult } from '../shared-ORgOfXFw.js';
|
|
8
8
|
import 'react';
|
|
9
9
|
import 'unified';
|
|
10
10
|
import 'vfile';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface SortedResult {
|
|
2
|
+
id: string;
|
|
3
|
+
url: string;
|
|
4
|
+
type: 'page' | 'heading' | 'text';
|
|
5
|
+
content: string;
|
|
6
|
+
contentWithHighlights?: HighlightedText[];
|
|
7
|
+
}
|
|
8
|
+
type HighlightedText = {
|
|
9
|
+
type: 'text';
|
|
10
|
+
content: string;
|
|
11
|
+
styles?: {
|
|
12
|
+
highlight?: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare function createContentHighlighter(query: string | RegExp): {
|
|
16
|
+
highlight(content: string): HighlightedText[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { type HighlightedText as H, type SortedResult as S, createContentHighlighter as c };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.6.
|
|
3
|
+
"version": "15.6.11",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -105,27 +105,27 @@
|
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@mdx-js/mdx": "^3.1.0",
|
|
108
|
-
"@mixedbread/sdk": "^0.
|
|
108
|
+
"@mixedbread/sdk": "^0.24.0",
|
|
109
109
|
"@oramacloud/client": "^2.1.4",
|
|
110
|
-
"@tanstack/react-router": "^1.
|
|
110
|
+
"@tanstack/react-router": "^1.131.7",
|
|
111
111
|
"@types/estree-jsx": "^1.0.5",
|
|
112
112
|
"@types/hast": "^3.0.4",
|
|
113
113
|
"@types/mdast": "^4.0.3",
|
|
114
114
|
"@types/negotiator": "^0.6.4",
|
|
115
|
-
"@types/node": "24.1
|
|
116
|
-
"@types/react": "^19.1.
|
|
115
|
+
"@types/node": "24.2.1",
|
|
116
|
+
"@types/react": "^19.1.10",
|
|
117
117
|
"@types/react-dom": "^19.1.7",
|
|
118
118
|
"algoliasearch": "5.35.0",
|
|
119
119
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
120
120
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
121
|
-
"next": "^15.4.
|
|
122
|
-
"react-router": "^7.
|
|
121
|
+
"next": "^15.4.6",
|
|
122
|
+
"react-router": "^7.8.0",
|
|
123
123
|
"remark-mdx": "^3.1.0",
|
|
124
124
|
"remove-markdown": "^0.6.2",
|
|
125
125
|
"typescript": "^5.9.2",
|
|
126
126
|
"unified": "^11.0.5",
|
|
127
127
|
"vfile": "^6.0.3",
|
|
128
|
-
"waku": "^0.
|
|
128
|
+
"waku": "^0.24.0",
|
|
129
129
|
"eslint-config-custom": "0.0.0",
|
|
130
130
|
"tsconfig": "0.0.0"
|
|
131
131
|
},
|