@farming-labs/svelte 0.2.131 → 0.2.133-perf.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.
Files changed (2) hide show
  1. package/dist/server.js +8 -1
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -99,6 +99,13 @@ function joinPathParts(...parts) {
99
99
  function toPosixPath(value) {
100
100
  return value.replace(/\\\\/g, "/");
101
101
  }
102
+ // Search, llms, and MCP pages are agent-facing: report the file relative to the
103
+ // content directory so the server's own filesystem layout never leaves it.
104
+ function withContentRelativeSourcePaths(pages, contentDir) {
105
+ return pages.map((page) => page.sourcePath
106
+ ? { ...page, sourcePath: toPosixPath(path.relative(contentDir, page.sourcePath)) }
107
+ : page);
108
+ }
102
109
  function buildDirPrefix(contentDir) {
103
110
  const rel = path.isAbsolute(contentDir)
104
111
  ? toPosixPath(path.relative(process.cwd(), contentDir))
@@ -615,7 +622,7 @@ export function createDocsServer(config = {}) {
615
622
  return cached;
616
623
  const index = preloaded
617
624
  ? searchIndexFromMap(preloaded, ctx.dirPrefix, entry, ctx.locale, preloadedSitemapManifest)
618
- : loadDocsContent(ctx.contentDirAbs, entry);
625
+ : withContentRelativeSourcePaths(loadDocsContent(ctx.contentDirAbs, entry), ctx.contentDirAbs);
619
626
  searchIndexByEntry.set(key, index);
620
627
  return index;
621
628
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/svelte",
3
- "version": "0.2.131",
3
+ "version": "0.2.133-perf.0",
4
4
  "description": "SvelteKit adapter for @farming-labs/docs — content loading and navigation utilities",
5
5
  "keywords": [
6
6
  "docs",
@@ -57,7 +57,7 @@
57
57
  "@types/node": "^22.10.0",
58
58
  "typescript": "^5.9.3",
59
59
  "vitest": "^4.1.8",
60
- "@farming-labs/docs": "0.2.131"
60
+ "@farming-labs/docs": "0.2.133-perf.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@farming-labs/docs": ">=0.2.73"