@farming-labs/farmjs 0.2.119 → 0.2.121

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 (45) hide show
  1. package/README.md +25 -0
  2. package/dist/agent-skills.d.ts +13 -0
  3. package/dist/agent-skills.d.ts.map +1 -0
  4. package/dist/agent-skills.js +62 -0
  5. package/dist/agent-skills.js.map +1 -0
  6. package/dist/config-values.d.ts +9 -0
  7. package/dist/config-values.d.ts.map +1 -0
  8. package/dist/config-values.js +55 -0
  9. package/dist/config-values.js.map +1 -0
  10. package/dist/config.d.ts +8 -0
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +17 -6
  13. package/dist/config.js.map +1 -1
  14. package/dist/mdx-build-cache.d.ts +25 -0
  15. package/dist/mdx-build-cache.d.ts.map +1 -0
  16. package/dist/mdx-build-cache.js +140 -0
  17. package/dist/mdx-build-cache.js.map +1 -0
  18. package/dist/mdx-compiler-fingerprint.d.ts +5 -0
  19. package/dist/mdx-compiler-fingerprint.d.ts.map +1 -0
  20. package/dist/mdx-compiler-fingerprint.js +131 -0
  21. package/dist/mdx-compiler-fingerprint.js.map +1 -0
  22. package/dist/mdx-core.d.ts +4 -0
  23. package/dist/mdx-core.d.ts.map +1 -0
  24. package/dist/mdx-core.js +23 -0
  25. package/dist/mdx-core.js.map +1 -0
  26. package/dist/react.d.ts +2 -0
  27. package/dist/react.d.ts.map +1 -1
  28. package/dist/react.js +7 -2
  29. package/dist/react.js.map +1 -1
  30. package/dist/server.d.ts.map +1 -1
  31. package/dist/server.js +55 -14
  32. package/dist/server.js.map +1 -1
  33. package/dist/shell-plugin.d.ts +7 -0
  34. package/dist/shell-plugin.d.ts.map +1 -0
  35. package/dist/shell-plugin.js +26 -0
  36. package/dist/shell-plugin.js.map +1 -0
  37. package/dist/shell.d.ts +11 -0
  38. package/dist/shell.d.ts.map +1 -0
  39. package/dist/shell.js +11 -0
  40. package/dist/shell.js.map +1 -0
  41. package/dist/vite.d.ts +9 -0
  42. package/dist/vite.d.ts.map +1 -1
  43. package/dist/vite.js +83 -7
  44. package/dist/vite.js.map +1 -1
  45. package/package.json +9 -4
package/README.md CHANGED
@@ -66,6 +66,31 @@ same theme. This is the same unified CSS entrypoint used by the Next.js,
66
66
  TanStack Start, SvelteKit, Astro, and Nuxt integrations. The adapter does not
67
67
  ship or inject a second Farm-specific theme stylesheet.
68
68
 
69
+ ## Repeated production builds
70
+
71
+ The adapter reuses unchanged Markdown/MDX compilation and syntax highlighting
72
+ in production builds. It stores the compiled code and source maps under
73
+ `<Vite cacheDir>/farming-docs/mdx-v1.json`; Vite normally places `cacheDir` in
74
+ `node_modules/.vite`. Preserve that directory in your CI build cache to reuse
75
+ work across jobs. Deleting it only causes compilation to run again.
76
+
77
+ Cache entries are keyed by source, module path, mode, highlighting themes,
78
+ Node version, and a content fingerprint of the compiler implementation and
79
+ its dependencies. Vite still discovers and builds imports, components, CSS,
80
+ routes, and deployment output normally. Development and watch builds do not
81
+ use this cache. Missing, corrupt, incompatible, or unwritable cache files
82
+ fall back to compilation; compiler errors still fail the build.
83
+
84
+ The cache retains at most 1,024 modules and approximately 32 MiB of payload.
85
+ It does not cache rendered HTML or change client navigation or prerendering.
86
+ To diagnose a build without MDX cache reuse:
87
+
88
+ ```ts
89
+ export default withDocs(defineConfig({}), { buildCache: false });
90
+ ```
91
+
92
+ The lower-level `docsMdx({ buildCache: false })` option has the same behavior.
93
+
69
94
  ## Edge deployments
70
95
 
71
96
  Farm edge targets use the adapter's build-time compiler automatically. It
@@ -0,0 +1,13 @@
1
+ import type { Plugin } from "vite";
2
+ export interface FarmDocsAgentSkillsOptions {
3
+ /** Path to docs.config, relative to the Farm application root. */
4
+ configPath?: string;
5
+ }
6
+ /**
7
+ * Snapshot configured Agent Skills and the project-root agent documents (`skill.md`, `AGENTS.md`)
8
+ * into production builds. A deployed function such as a Vercel function contains the server
9
+ * bundle but not the project's files, so the request-time filesystem fallback finds nothing
10
+ * there. Development keeps reading the files, so edits show up without a rebuild.
11
+ */
12
+ export declare function docsAgentSkillsBundle(options?: FarmDocsAgentSkillsOptions): Plugin;
13
+ //# sourceMappingURL=agent-skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-skills.d.ts","sourceRoot":"","sources":["../src/agent-skills.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAMnD,MAAM,WAAW,0BAA0B;IACzC,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAaD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,0BAA+B,GAAG,MAAM,CAwCtF"}
@@ -0,0 +1,62 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { loadDocsConfigModule, renderDocsAgentSkillsBundle, resolveConfiguredAgentSkillsSync, } from "@farming-labs/docs/build";
4
+ const AGENT_SKILLS_BUNDLE_MODULE = "@farming-labs/docs/agent-skills-bundle";
5
+ const RESOLVED_AGENT_SKILLS_BUNDLE_MODULE = "\0farming-labs-farmjs:agent-skills-bundle";
6
+ const ROOT_DOCUMENT_FILES = ["skill.md", "AGENTS.md", "AGENT.md"];
7
+ function readRootDocuments(root) {
8
+ const documents = {};
9
+ for (const fileName of ROOT_DOCUMENT_FILES) {
10
+ const filePath = path.join(root, fileName);
11
+ if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
12
+ documents[fileName] = fs.readFileSync(filePath, "utf8");
13
+ }
14
+ }
15
+ return Object.keys(documents).length > 0 ? documents : undefined;
16
+ }
17
+ /**
18
+ * Snapshot configured Agent Skills and the project-root agent documents (`skill.md`, `AGENTS.md`)
19
+ * into production builds. A deployed function such as a Vercel function contains the server
20
+ * bundle but not the project's files, so the request-time filesystem fallback finds nothing
21
+ * there. Development keeps reading the files, so edits show up without a rebuild.
22
+ */
23
+ export function docsAgentSkillsBundle(options = {}) {
24
+ let root = process.cwd();
25
+ let source;
26
+ async function renderBundle() {
27
+ let loaded;
28
+ try {
29
+ loaded = await loadDocsConfigModule(root, options.configPath);
30
+ }
31
+ catch {
32
+ loaded = null;
33
+ }
34
+ // Without the evaluated config, keep the package's empty module so the server still reads
35
+ // skills from the filesystem, as it did before this snapshot existed.
36
+ if (!loaded)
37
+ return undefined;
38
+ const skills = resolveConfiguredAgentSkillsSync(loaded.config.agent?.skills, {
39
+ rootDir: root,
40
+ });
41
+ return renderDocsAgentSkillsBundle(skills, readRootDocuments(root));
42
+ }
43
+ return {
44
+ name: "farming-labs-farmjs-agent-skills",
45
+ enforce: "pre",
46
+ apply: "build",
47
+ configResolved(config) {
48
+ root = config.root;
49
+ },
50
+ resolveId(id) {
51
+ return id === AGENT_SKILLS_BUNDLE_MODULE ? RESOLVED_AGENT_SKILLS_BUNDLE_MODULE : undefined;
52
+ },
53
+ async load(id) {
54
+ if (id !== RESOLVED_AGENT_SKILLS_BUNDLE_MODULE)
55
+ return undefined;
56
+ source ??= renderBundle();
57
+ return ((await source) ??
58
+ "export const bundledAgentSkills = undefined;\nexport const bundledRootDocuments = undefined;\n");
59
+ },
60
+ };
61
+ }
62
+ //# sourceMappingURL=agent-skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-skills.js","sourceRoot":"","sources":["../src/agent-skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAGlC,MAAM,0BAA0B,GAAG,wCAAwC,CAAC;AAC5E,MAAM,mCAAmC,GAAG,2CAA2C,CAAC;AACxF,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC;AAO3E,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,KAAK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AE,OAAO;QACd,cAAc,CAAC,MAAsB;YACnC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QACD,SAAS,CAAC,EAAE;YACV,OAAO,EAAE,KAAK,0BAA0B,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7F,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,KAAK,mCAAmC;gBAAE,OAAO,SAAS,CAAC;YACjE,MAAM,KAAK,YAAY,EAAE,CAAC;YAC1B,OAAO,CACL,CAAC,MAAM,MAAM,CAAC;gBACd,gGAAgG,CACjG,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** True when JSON would lose part of `value`. */
2
+ export declare function hasUnserializableValues(value: unknown, seen?: WeakSet<object>): boolean;
3
+ /**
4
+ * The server's JSON copy of the config, with what JSON dropped restored from the config
5
+ * module. Everything serializable keeps the server's value, which carries the routes Farm
6
+ * derived and leaves out server-only fields such as API keys.
7
+ */
8
+ export declare function restoreUnserializableValues(serverValue: unknown, moduleValue: unknown): unknown;
9
+ //# sourceMappingURL=config-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-values.d.ts","sourceRoot":"","sources":["../src/config-values.ts"],"names":[],"mappings":"AAsBA,iDAAiD;AACjD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,kBAAwB,GAAG,OAAO,CAM7F;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAoB/F"}
@@ -0,0 +1,55 @@
1
+ // The docs config reaches the browser as JSON, which drops what React renders from it:
2
+ // elements such as icons, components, and callbacks. The server flags a config that has
3
+ // any, and the browser restores them from the config module (Farm imports it then).
4
+ function isReactValue(value) {
5
+ return (typeof value === "object" &&
6
+ value !== null &&
7
+ typeof value.$$typeof === "symbol");
8
+ }
9
+ function isUnserializable(value) {
10
+ return typeof value === "function" || isReactValue(value);
11
+ }
12
+ function isPlainObject(value) {
13
+ if (typeof value !== "object" || value === null || Array.isArray(value))
14
+ return false;
15
+ const prototype = Object.getPrototypeOf(value);
16
+ return prototype === Object.prototype || prototype === null;
17
+ }
18
+ /** True when JSON would lose part of `value`. */
19
+ export function hasUnserializableValues(value, seen = new WeakSet()) {
20
+ if (isUnserializable(value))
21
+ return true;
22
+ if (typeof value !== "object" || value === null || seen.has(value))
23
+ return false;
24
+ seen.add(value);
25
+ const entries = Array.isArray(value) ? value : isPlainObject(value) ? Object.values(value) : [];
26
+ return entries.some((entry) => hasUnserializableValues(entry, seen));
27
+ }
28
+ /**
29
+ * The server's JSON copy of the config, with what JSON dropped restored from the config
30
+ * module. Everything serializable keeps the server's value, which carries the routes Farm
31
+ * derived and leaves out server-only fields such as API keys.
32
+ */
33
+ export function restoreUnserializableValues(serverValue, moduleValue) {
34
+ if (isUnserializable(moduleValue))
35
+ return moduleValue;
36
+ if (Array.isArray(serverValue) && Array.isArray(moduleValue)) {
37
+ if (serverValue.length !== moduleValue.length)
38
+ return serverValue;
39
+ return serverValue.map((entry, index) => restoreUnserializableValues(entry, moduleValue[index]));
40
+ }
41
+ if (isPlainObject(serverValue) && isPlainObject(moduleValue)) {
42
+ const restored = { ...serverValue };
43
+ for (const [key, value] of Object.entries(moduleValue)) {
44
+ if (key in serverValue) {
45
+ restored[key] = restoreUnserializableValues(serverValue[key], value);
46
+ }
47
+ else if (hasUnserializableValues(value)) {
48
+ restored[key] = value;
49
+ }
50
+ }
51
+ return restored;
52
+ }
53
+ return serverValue;
54
+ }
55
+ //# sourceMappingURL=config-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-values.js","sourceRoot":"","sources":["../src/config-values.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wFAAwF;AACxF,oFAAoF;AAEpF,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,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AM,UAAU,2BAA2B,CAAC,WAAoB,EAAE,WAAoB;IACpF,IAAI,gBAAgB,CAAC,WAAW,CAAC;QAAE,OAAO,WAAW,CAAC;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7D,IAAI,WAAW,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM;YAAE,OAAO,WAAW,CAAC;QAClE,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACtC,2BAA2B,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CACvD,CAAC;IACJ,CAAC;IACD,IAAI,aAAa,CAAC,WAAW,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7D,MAAM,QAAQ,GAA4B,EAAE,GAAG,WAAW,EAAE,CAAC;QAC7D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACvD,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;gBACvB,QAAQ,CAAC,GAAG,CAAC,GAAG,2BAA2B,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;YACvE,CAAC;iBAAM,IAAI,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1C,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACxB,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
package/dist/config.d.ts CHANGED
@@ -14,6 +14,8 @@ export interface FarmDocsCoreConfig extends Partial<DocsConfig> {
14
14
  adapter?: FarmDocsRuntimeAdapter;
15
15
  }
16
16
  export interface FarmDocsAdapterOptions {
17
+ /** Reuse unchanged production MDX compilation. Defaults to true. */
18
+ buildCache?: boolean;
17
19
  /** Enable the docs runtime. Defaults to true when withDocs is used. */
18
20
  enabled?: boolean;
19
21
  /** Path to docs.config.ts, relative to the Farm application root. */
@@ -24,6 +26,12 @@ export interface FarmDocsAdapterOptions {
24
26
  codeBlockThemes?: FarmDocsCodeBlockThemes;
25
27
  /** Additional documentation roots outside the Farm application directory. */
26
28
  contentRoots?: string[];
29
+ /**
30
+ * Module whose default export wraps every docs page, relative to the Farm application root.
31
+ * Farm renders docs pages outside the app's root layout, so use it for what that layout adds
32
+ * to other routes, such as analytics or site-wide widgets.
33
+ */
34
+ shell?: string;
27
35
  }
28
36
  export interface FarmConfigLike {
29
37
  docs?: boolean | FarmDocsCoreConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAW,KAAK,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAElE,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,KAAK,qBAAqB,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,kBAAkB,CAAC;AAEhF,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,UAAU,CAAC;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAED,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,UAAU,CAAC,EAAE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eAdapter } from "./runtime.js";
3
+ import { docsShell } from "./shell-plugin.js";
2
4
  import { docsMdx } from "./vite.js";
3
5
  function normalizeExistingDocs(value) {
4
6
  if (!value || value === true)
5
7
  return {};
6
8
  return value;
7
9
  }
8
- function appendDocsVitePlugins(config = {}, codeBlockThemes, contentRoots) {
10
+ function appendDocsVitePlugins(config = {}, options) {
11
+ const { codeBlockThemes, contentRoots, buildCache, configPath, shell } = options;
9
12
  return {
10
13
  ...config,
11
- plugins: [docsMdx({ codeBlockThemes, contentRoots }), ...(config.plugins ?? [])],
14
+ plugins: [
15
+ docsMdx({ codeBlockThemes, contentRoots, buildCache }),
16
+ docsAgentSkillsBundle({ configPath }),
17
+ docsShell(shell),
18
+ ...(config.plugins ?? []),
19
+ ],
12
20
  };
13
21
  }
14
- function withDocsViteConfig(value, codeBlockThemes, contentRoots) {
22
+ function withDocsViteConfig(value, options) {
15
23
  if (typeof value === "function") {
16
- return (config) => appendDocsVitePlugins(value(config), codeBlockThemes, contentRoots);
24
+ return (config) => appendDocsVitePlugins(value(config), options);
17
25
  }
18
- return appendDocsVitePlugins(value, codeBlockThemes, contentRoots);
26
+ return appendDocsVitePlugins(value, options);
19
27
  }
20
28
  /**
21
29
  * Enable Farming Labs docs in a Farm.js application.
@@ -29,7 +37,10 @@ export function withDocs(farmConfig, options = {}) {
29
37
  const enabled = options.enabled ?? true;
30
38
  return {
31
39
  ...farmConfig,
32
- vite: withDocsViteConfig(farmConfig.vite, options.codeBlockThemes, options.contentRoots),
40
+ vite: withDocsViteConfig(farmConfig.vite, {
41
+ ...options,
42
+ configPath: options.configPath ?? existing.configPath,
43
+ }),
33
44
  docs: {
34
45
  ...existing,
35
46
  enabled,
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAA+B,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,OAAO,EAAgC,MAAM,WAAW,CAAC;AAyClE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EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,UAAmB,EACnB,UAAkC,EAAE;IAEpC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;IAExC,OAAO;QACL,GAAG,UAAU;QACb,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,IAAI,EAAE;YACxC,GAAG,OAAO;YACV,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU;SACtD,CAAC;QACF,IAAI,EAAE;YACJ,GAAG,QAAQ;YACX,OAAO;YACP,OAAO,EAAE,sBAAsB;YAC/B,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjE,GAAG,CAAC,OAAO,CAAC,MAAM;gBAChB,CAAC,CAAC;oBACE,MAAM,EAAE;wBACN,GAAG,QAAQ,CAAC,MAAM;wBAClB,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type mdx from "@mdx-js/rollup";
2
+ type CompiledMdx = Awaited<ReturnType<ReturnType<typeof mdx>["transform"]>>;
3
+ export declare function mdxCacheDigest(value: string | Buffer): string;
4
+ /** Only the adapter's deterministic MDX stage is cached, never the Vite graph. */
5
+ export declare class MdxBuildCache {
6
+ private readonly file;
7
+ private readonly maxBytes;
8
+ private readonly maxEntries;
9
+ private readonly entries;
10
+ private readonly entryBytes;
11
+ private readonly pending;
12
+ private loaded?;
13
+ private bytes;
14
+ private revision;
15
+ private persistedRevision;
16
+ private flushing?;
17
+ constructor(file: string, maxBytes?: number, maxEntries?: number);
18
+ private remember;
19
+ private load;
20
+ compile(id: string, key: string, compile: () => Promise<CompiledMdx>): Promise<CompiledMdx>;
21
+ flush(): Promise<void>;
22
+ private writeSnapshot;
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=mdx-build-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-build-cache.d.ts","sourceRoot":"","sources":["../src/mdx-build-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AAEtC,KAAK,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAW5E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAE7D;AAED,kFAAkF;AAClF,qBAAa,aAAa;IAWtB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAZ7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkD;IAC1E,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,CAAgB;gBAGd,IAAI,EAAE,MAAM,EACZ,QAAQ,SAAY,EACpB,UAAU,SAAc;IAG3C,OAAO,CAAC,QAAQ;YAgBF,IAAI;IAyBZ,OAAO,CACX,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,WAAW,CAAC;IA8BjB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAmBd,aAAa;CAc5B"}
@@ -0,0 +1,140 @@
1
+ import { createHash, randomUUID } from "node:crypto";
2
+ import fs from "node:fs/promises";
3
+ import path from "node:path";
4
+ const MAX_BYTES = 32 * 1024 * 1024;
5
+ const MAX_ENTRIES = 1_024;
6
+ export function mdxCacheDigest(value) {
7
+ return createHash("sha256").update(value).digest("hex");
8
+ }
9
+ /** Only the adapter's deterministic MDX stage is cached, never the Vite graph. */
10
+ export class MdxBuildCache {
11
+ file;
12
+ maxBytes;
13
+ maxEntries;
14
+ entries = new Map();
15
+ entryBytes = new Map();
16
+ pending = new Map();
17
+ loaded;
18
+ bytes = 0;
19
+ revision = 0;
20
+ persistedRevision = 0;
21
+ flushing;
22
+ constructor(file, maxBytes = MAX_BYTES, maxEntries = MAX_ENTRIES) {
23
+ this.file = file;
24
+ this.maxBytes = maxBytes;
25
+ this.maxEntries = maxEntries;
26
+ }
27
+ remember(id, entry) {
28
+ this.bytes -= this.entryBytes.get(id) ?? 0;
29
+ const size = Buffer.byteLength(JSON.stringify([id, entry]));
30
+ this.entries.delete(id);
31
+ this.entries.set(id, entry);
32
+ this.entryBytes.set(id, size);
33
+ this.bytes += size;
34
+ while (this.bytes > this.maxBytes || this.entries.size > this.maxEntries) {
35
+ const oldest = this.entries.entries().next().value;
36
+ if (!oldest)
37
+ break;
38
+ this.entries.delete(oldest[0]);
39
+ this.bytes -= this.entryBytes.get(oldest[0]) ?? 0;
40
+ this.entryBytes.delete(oldest[0]);
41
+ }
42
+ }
43
+ async load() {
44
+ try {
45
+ if ((await fs.stat(this.file)).size > this.maxBytes + 64 * 1024)
46
+ return;
47
+ const data = JSON.parse(await fs.readFile(this.file, "utf8"));
48
+ if (!Array.isArray(data))
49
+ return;
50
+ for (const item of data) {
51
+ if (!Array.isArray(item) ||
52
+ typeof item[0] !== "string" ||
53
+ typeof item[1]?.key !== "string" ||
54
+ typeof item[1]?.value !== "string" ||
55
+ item[1]?.checksum !== mdxCacheDigest(item[1].value))
56
+ continue;
57
+ const result = JSON.parse(item[1].value);
58
+ if (typeof result?.code === "string")
59
+ this.remember(item[0], item[1]);
60
+ }
61
+ }
62
+ catch {
63
+ // Missing, incompatible, truncated or unreadable caches are ordinary misses.
64
+ this.entries.clear();
65
+ this.entryBytes.clear();
66
+ this.bytes = 0;
67
+ }
68
+ }
69
+ async compile(id, key, compile) {
70
+ await (this.loaded ??= this.load());
71
+ const entry = this.entries.get(id);
72
+ if (entry?.key === key) {
73
+ // Refresh eviction order without serializing unchanged compiled output.
74
+ this.entries.delete(id);
75
+ this.entries.set(id, entry);
76
+ return JSON.parse(entry.value);
77
+ }
78
+ const pendingKey = JSON.stringify([id, key]);
79
+ let pending = this.pending.get(pendingKey);
80
+ if (!pending) {
81
+ pending = Promise.resolve()
82
+ .then(compile)
83
+ .then((result) => {
84
+ // The upstream filter deliberately skips some IDs, including virtual modules.
85
+ if (result === undefined)
86
+ return undefined;
87
+ const value = JSON.stringify(result);
88
+ this.remember(id, { key, value, checksum: mdxCacheDigest(value) });
89
+ this.revision += 1;
90
+ return value;
91
+ })
92
+ .finally(() => this.pending.delete(pendingKey));
93
+ this.pending.set(pendingKey, pending);
94
+ }
95
+ // Subsequent plugins may mutate source maps: don't share mutable results.
96
+ const value = await pending;
97
+ return value === undefined ? undefined : JSON.parse(value);
98
+ }
99
+ async flush() {
100
+ if (!this.loaded)
101
+ return;
102
+ await this.loaded;
103
+ // Multiple Vite environments can finish together. An older snapshot must
104
+ // finish before a newer one, or its rename could discard the newer entries.
105
+ while (this.flushing)
106
+ await this.flushing;
107
+ if (this.persistedRevision === this.revision)
108
+ return;
109
+ const revision = this.revision;
110
+ const flushing = this.writeSnapshot(JSON.stringify([...this.entries])).then((saved) => {
111
+ if (saved)
112
+ this.persistedRevision = revision;
113
+ });
114
+ this.flushing = flushing;
115
+ try {
116
+ await flushing;
117
+ }
118
+ finally {
119
+ if (this.flushing === flushing)
120
+ this.flushing = undefined;
121
+ }
122
+ }
123
+ async writeSnapshot(snapshot) {
124
+ const temporary = `${this.file}.${randomUUID()}.tmp`;
125
+ try {
126
+ await fs.mkdir(path.dirname(this.file), { recursive: true });
127
+ await fs.writeFile(temporary, snapshot);
128
+ await fs.rename(temporary, this.file);
129
+ return true;
130
+ }
131
+ catch {
132
+ // Keep the revision dirty so a later flush can retry a failed write.
133
+ return false;
134
+ }
135
+ finally {
136
+ await fs.unlink(temporary).catch(() => undefined);
137
+ }
138
+ }
139
+ }
140
+ //# sourceMappingURL=mdx-build-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-build-cache.js","sourceRoot":"","sources":["../src/mdx-build-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAW7B,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACnC,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,MAAM,UAAU,cAAc,CAAC,KAAsB;IACnD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,kFAAkF;AAClF,MAAM,OAAO,aAAa;IAWL;IACA;IACA;IAZF,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;IACnC,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,OAAO,GAAG,IAAI,GAAG,EAAuC,CAAC;IAClE,MAAM,CAAiB;IACvB,KAAK,GAAG,CAAC,CAAC;IACV,QAAQ,GAAG,CAAC,CAAC;IACb,iBAAiB,GAAG,CAAC,CAAC;IACtB,QAAQ,CAAiB;IAEjC,YACmB,IAAY,EACZ,WAAW,SAAS,EACpB,aAAa,W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CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7D,MAAM,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACxC,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,qEAAqE;YACrE,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ /** @internal An unavailable fingerprint disables reuse, not compilation. */
2
+ export declare function fingerprintMdxCompiler(): Promise<string | undefined>;
3
+ /** @internal Kept separate to verify changed/deleted compiler dependencies. */
4
+ export declare function fingerprintMdxFiles(directories: string[]): Promise<string>;
5
+ //# sourceMappingURL=mdx-compiler-fingerprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-compiler-fingerprint.d.ts","sourceRoot":"","sources":["../src/mdx-compiler-fingerprint.ts"],"names":[],"mappings":"AA2BA,4EAA4E;AAC5E,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAcpE;AA8CD,+EAA+E;AAC/E,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoChF"}
@@ -0,0 +1,131 @@
1
+ import { createHash } from "node:crypto";
2
+ import fs from "node:fs/promises";
3
+ import { createRequire } from "node:module";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ // Read implementation bytes, not mtimes or just package versions: linked workspace
7
+ // compilers and patched dependencies can change without a version bump.
8
+ const RUNTIME_FILE = /\.(?:[cm]?[jt]sx?|json|wasm)$/;
9
+ const MAX_FINGERPRINT_BYTES = 128 * 1024 * 1024;
10
+ let pendingFingerprint;
11
+ let loadedFingerprint;
12
+ async function packageRoot(name, importer) {
13
+ const require = createRequire(importer);
14
+ for (const base of require.resolve.paths(name) ?? []) {
15
+ const candidate = path.join(base, name);
16
+ try {
17
+ const manifest = JSON.parse(await fs.readFile(path.join(candidate, "package.json"), "utf8"));
18
+ if (manifest.name === name)
19
+ return await fs.realpath(candidate);
20
+ }
21
+ catch {
22
+ /* Try the next Node resolution location. */
23
+ }
24
+ }
25
+ throw new Error(`Cannot fingerprint MDX compiler dependency ${name}`);
26
+ }
27
+ /** @internal An unavailable fingerprint disables reuse, not compilation. */
28
+ export function fingerprintMdxCompiler() {
29
+ // Client and SSR graphs can request the same snapshot concurrently. Keep only
30
+ // in-flight work shared; a later build in this process must read inputs again.
31
+ return (pendingFingerprint ??= readCompilerFingerprint()
32
+ .then((current) => {
33
+ loadedFingerprint ??= current;
34
+ // Loaded JS modules don't change when their files are edited in place.
35
+ // Recompile without persistence rather than labeling old code's output
36
+ // with a new on-disk compiler fingerprint in a long-lived build process.
37
+ return current === loadedFingerprint ? current : undefined;
38
+ })
39
+ .finally(() => {
40
+ pendingFingerprint = undefined;
41
+ }));
42
+ }
43
+ async function readCompilerFingerprint() {
44
+ try {
45
+ const implementation = path.dirname(fileURLToPath(import.meta.url));
46
+ const importer = fileURLToPath(import.meta.url);
47
+ const docsRoot = await packageRoot("@farming-labs/docs", importer);
48
+ const directories = new Set([implementation, path.join(docsRoot, "dist")]);
49
+ const packages = new Set();
50
+ const queue = [];
51
+ for (const name of [
52
+ "@mdx-js/rollup",
53
+ "remark-gfm",
54
+ "remark-frontmatter",
55
+ "remark-mdx-frontmatter",
56
+ "fumadocs-core",
57
+ ]) {
58
+ queue.push(await packageRoot(name, importer));
59
+ }
60
+ for (const name of ["@mdx-js/mdx", "github-slugger", "parse-entities", "remark-gfm"]) {
61
+ queue.push(await packageRoot(name, path.join(docsRoot, "package.json")));
62
+ }
63
+ while (queue.length) {
64
+ const root = queue.pop();
65
+ if (packages.has(root))
66
+ continue;
67
+ packages.add(root);
68
+ directories.add(root);
69
+ const manifest = JSON.parse(await fs.readFile(path.join(root, "package.json"), "utf8"));
70
+ for (const name of Object.keys(manifest.dependencies ?? {})) {
71
+ if (!name.startsWith("@types/"))
72
+ queue.push(await packageRoot(name, path.join(root, "package.json")));
73
+ }
74
+ for (const name of Object.keys(manifest.optionalDependencies ?? {})) {
75
+ try {
76
+ queue.push(await packageRoot(name, path.join(root, "package.json")));
77
+ }
78
+ catch {
79
+ /* Optional dependency absent. */
80
+ }
81
+ }
82
+ }
83
+ return await fingerprintMdxFiles([...directories]);
84
+ }
85
+ catch {
86
+ return undefined;
87
+ }
88
+ }
89
+ /** @internal Kept separate to verify changed/deleted compiler dependencies. */
90
+ export async function fingerprintMdxFiles(directories) {
91
+ const files = new Set();
92
+ const seen = new Set();
93
+ async function visit(directory) {
94
+ const real = await fs.realpath(directory);
95
+ if (seen.has(real))
96
+ return;
97
+ seen.add(real);
98
+ for (const entry of await fs.readdir(real, { withFileTypes: true })) {
99
+ if (entry.name === "node_modules" || entry.name.startsWith("."))
100
+ continue;
101
+ const file = path.join(real, entry.name);
102
+ if (entry.isDirectory())
103
+ await visit(file);
104
+ else if (entry.isFile() &&
105
+ RUNTIME_FILE.test(entry.name) &&
106
+ !/\.d\.[cm]?ts$|\.(?:test|spec)\.[jt]sx?$/.test(entry.name))
107
+ files.add(file);
108
+ // An untracked symlink inside a compiler package could hide an input.
109
+ else if (entry.isSymbolicLink())
110
+ throw new Error("Linked compiler input");
111
+ }
112
+ }
113
+ for (const directory of directories)
114
+ await visit(directory);
115
+ const ordered = [...files].sort();
116
+ const hash = createHash("sha256");
117
+ let bytes = 0;
118
+ for (let index = 0; index < ordered.length; index += 32) {
119
+ const batch = ordered.slice(index, index + 32);
120
+ const contents = await Promise.all(batch.map((file) => fs.readFile(file)));
121
+ for (let i = 0; i < batch.length; i++) {
122
+ bytes += contents[i].byteLength;
123
+ if (bytes > MAX_FINGERPRINT_BYTES)
124
+ throw new Error("Compiler fingerprint size limit");
125
+ hash.update(JSON.stringify([batch[i], contents[i].byteLength]));
126
+ hash.update(contents[i]);
127
+ }
128
+ }
129
+ return hash.digest("hex");
130
+ }
131
+ //# sourceMappingURL=mdx-compiler-fingerprint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-compiler-fingerprint.js","sourceRoot":"","sources":["../src/mdx-compiler-fingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,mFAAmF;AACnF,wEAAwE;AACxE,MAAM,YAAY,GAAG,+BAA+B,CAAC;AACrD,MAAM,qBAAqB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAChD,IAAI,kBAA2D,CAAC;AAChE,IAAI,iBAAqC,CAAC;AAE1C,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,QAAgB;IACvD,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC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Q,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type * as Core from "@farming-labs/docs";
2
+ import type * as Server from "@farming-labs/docs/server";
3
+ export declare const applyDocsMarkdownHeadingAnchors: typeof Core.applyDocsMarkdownHeadingAnchors, encodeDocsHeadingTocUrls: typeof Core.encodeDocsHeadingTocUrls, isolateDocsMarkdownPromptReferences: typeof Core.isolateDocsMarkdownPromptReferences, remarkCodeGroup: typeof Server.remarkCodeGroup, withDocsMarkdownRenderableHeadings: typeof Core.withDocsMarkdownRenderableHeadings;
4
+ //# sourceMappingURL=mdx-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-core.d.ts","sourceRoot":"","sources":["../src/mdx-core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,MAAM,2BAA2B,CAAC;AA+BzD,eAAO,MACL,+BAA+B,+CAC/B,wBAAwB,wCACxB,mCAAmC,mDACnC,eAAe,iCACf,kCAAkC,gDACzB,CAAC"}