@farming-labs/docs 0.2.43 → 0.2.45

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.
@@ -105,36 +105,36 @@ async function main() {
105
105
  ]
106
106
  };
107
107
  if (!parsedCommand.command || parsedCommand.command === "init") {
108
- const { init } = await import("../init-Ds7QM9po.mjs");
108
+ const { init } = await import("../init-Ch5On0zm.mjs");
109
109
  await init(initOptions);
110
110
  } else if (parsedCommand.command === "dev") {
111
- const { dev } = await import("../dev-CBha7knT.mjs");
111
+ const { dev } = await import("../dev-Tm9Ss4D6.mjs");
112
112
  await dev(devOptions);
113
113
  } else if (parsedCommand.command === "deploy") {
114
- const { runCloudDeploy } = await import("../cloud-Bk-eppay.mjs");
114
+ const { runCloudDeploy } = await import("../cloud-C_Ok9rC5.mjs");
115
115
  await runCloudDeploy(cloudOptions);
116
116
  } else if (parsedCommand.command === "preview") {
117
- const { runCloudPreview } = await import("../cloud-Bk-eppay.mjs");
117
+ const { runCloudPreview } = await import("../cloud-C_Ok9rC5.mjs");
118
118
  await runCloudPreview(cloudOptions);
119
119
  } else if (parsedCommand.command === "cloud" && subcommand === "deploy") {
120
- const { runCloudDeploy } = await import("../cloud-Bk-eppay.mjs");
120
+ const { runCloudDeploy } = await import("../cloud-C_Ok9rC5.mjs");
121
121
  await runCloudDeploy(cloudOptions);
122
122
  } else if (parsedCommand.command === "cloud" && subcommand === "preview") {
123
- const { runCloudPreview } = await import("../cloud-Bk-eppay.mjs");
123
+ const { runCloudPreview } = await import("../cloud-C_Ok9rC5.mjs");
124
124
  await runCloudPreview(cloudOptions);
125
125
  } else if (parsedCommand.command === "cloud" && subcommand === "init") {
126
- const { runCloudInit } = await import("../cloud-Bk-eppay.mjs");
126
+ const { runCloudInit } = await import("../cloud-C_Ok9rC5.mjs");
127
127
  await runCloudInit(cloudOptions);
128
128
  } else if (parsedCommand.command === "cloud" && subcommand === "sync") {
129
- const { syncCloudConfig } = await import("../cloud-Bk-eppay.mjs");
129
+ const { syncCloudConfig } = await import("../cloud-C_Ok9rC5.mjs");
130
130
  await syncCloudConfig(cloudOptions);
131
131
  } else if (parsedCommand.command === "cloud" && subcommand === "check") {
132
- const { runCloudCheck } = await import("../cloud-Bk-eppay.mjs");
132
+ const { runCloudCheck } = await import("../cloud-C_Ok9rC5.mjs");
133
133
  await runCloudCheck(cloudOptions);
134
134
  } else if (parsedCommand.command === "cloud") {
135
135
  console.error(pc.red(`Unknown cloud subcommand: ${subcommand ?? "(missing)"}`));
136
136
  console.error();
137
- const { printCloudHelp } = await import("../cloud-Bk-eppay.mjs");
137
+ const { printCloudHelp } = await import("../cloud-C_Ok9rC5.mjs");
138
138
  printCloudHelp();
139
139
  process.exit(1);
140
140
  } else if (parsedCommand.command === "mcp") {
@@ -235,7 +235,7 @@ async function main() {
235
235
  printRobotsGenerateHelp();
236
236
  process.exit(1);
237
237
  } else if (parsedCommand.command === "downgrade") {
238
- const { downgrade } = await import("../downgrade-7PGER59g.mjs");
238
+ const { downgrade } = await import("../downgrade-CYEaOctn.mjs");
239
239
  const framework = (typeof flags.framework === "string" ? flags.framework : void 0) ?? (args[1] && !args[1].startsWith("--") ? args[1] : void 0);
240
240
  const hasVersionFlag = args.includes("--version") || args.some((arg) => arg.startsWith("--version="));
241
241
  await downgrade({
@@ -244,7 +244,7 @@ async function main() {
244
244
  dryRun: flags["dry-run"] === true
245
245
  });
246
246
  } else if (parsedCommand.command === "upgrade") {
247
- const { upgrade } = await import("../upgrade-CkdKWRlk.mjs");
247
+ const { upgrade } = await import("../upgrade-DzQtpgJM.mjs");
248
248
  const framework = (typeof flags.framework === "string" ? flags.framework : void 0) ?? (args[1] && !args[1].startsWith("--") ? args[1] : void 0);
249
249
  const hasVersionFlag = args.includes("--version") || args.some((arg) => arg.startsWith("--version="));
250
250
  const version = typeof flags.version === "string" ? flags.version : hasVersionFlag ? "" : void 0;
@@ -634,7 +634,6 @@ function resolveApiReferenceRoot(snapshot) {
634
634
  return readStringProperty(apiReferenceBlock, "path");
635
635
  }
636
636
  function resolveConnectedDocsProfile(params) {
637
- if (params.explicit) return params.explicit;
638
637
  if (!(params.snapshot.content?.includes(FUMADOCS_CONNECT_MARKER) || !params.snapshot.path)) return void 0;
639
638
  const detectedProfile = detectConnectedFumadocsProfile(params.rootDir);
640
639
  if (detectedProfile) return detectedProfile;
@@ -665,8 +664,9 @@ function resolveDocsRoot(rootDir, snapshot, existing, docsInfraProfile) {
665
664
  return fs.existsSync(path.join(rootDir, "app", entry)) ? path.join("app", entry) : entry;
666
665
  }
667
666
  function resolveDocsBlock(rootDir, snapshot, existing, docsInfraProfile) {
668
- const detectedFramework = detectFramework(rootDir);
669
667
  const existingDocs = existing?.docs;
668
+ if (!snapshot.path && existingDocs) return existingDocs;
669
+ const detectedFramework = detectFramework(rootDir);
670
670
  const runtime = detectedFramework ?? docsInfraProfile?.runtime ?? existingDocs?.runtime ?? "nextjs";
671
671
  if (!Boolean(snapshot.path || detectedFramework) && existingDocs) return existingDocs;
672
672
  return {
@@ -675,10 +675,10 @@ function resolveDocsBlock(rootDir, snapshot, existing, docsInfraProfile) {
675
675
  root: existingDocs?.root || "."
676
676
  };
677
677
  }
678
- function resolveExtensions(existing, docsInfraProfile) {
678
+ function resolveExtensions(existing, docsInfraProfile, options = {}) {
679
679
  const existingExtensions = toJsonRecord(existing?.extensions);
680
680
  if (!docsInfraProfile) {
681
- if (!existingExtensions?.docsInfraProfile) return existingExtensions;
681
+ if (!existingExtensions?.docsInfraProfile || options.dropStaleDocsInfraProfile === false) return existingExtensions;
682
682
  const { docsInfraProfile: _staleDocsInfraProfile, ...rest } = existingExtensions;
683
683
  return Object.keys(rest).length > 0 ? rest : void 0;
684
684
  }
@@ -689,17 +689,16 @@ function resolveExtensions(existing, docsInfraProfile) {
689
689
  }
690
690
  function materializeDocsJsonObject(params) {
691
691
  const cloud = resolveCloudConfig(params.snapshot, params.existing);
692
- const docsInfraProfile = resolveConnectedDocsProfile({
692
+ const docsInfraProfile = params.docsInfraProfile ?? (params.detectConnectedDocsProfile === false ? void 0 : resolveConnectedDocsProfile({
693
693
  rootDir: params.rootDir,
694
694
  snapshot: params.snapshot,
695
- existing: params.existing,
696
- explicit: params.docsInfraProfile
697
- });
695
+ existing: params.existing
696
+ }));
698
697
  const docsRoot = resolveDocsRoot(params.rootDir, params.snapshot, params.existing, docsInfraProfile);
699
698
  const apiReferenceRoot = resolveApiReferenceRoot(params.snapshot);
700
699
  const existingContent = toJsonRecord(params.existing?.content);
701
700
  const site = resolveSiteConfig(params.rootDir, params.snapshot, params.existing);
702
- const extensions = resolveExtensions(params.existing, docsInfraProfile);
701
+ const extensions = resolveExtensions(params.existing, docsInfraProfile, { dropStaleDocsInfraProfile: params.dropStaleDocsInfraProfile });
703
702
  const content = {
704
703
  ...existingContent,
705
704
  docsRoot,
@@ -719,29 +718,55 @@ function materializeDocsJsonObject(params) {
719
718
  function serializeMaterializedDocsJson(config) {
720
719
  return `${JSON.stringify(config, null, 2)}\n`;
721
720
  }
722
- async function materializeCloudConfig(options = {}) {
723
- const rootDir = options.rootDir ?? process.cwd();
724
- const docsJsonPath = path.join(rootDir, DOCS_JSON_FILE);
725
- const existing = readExistingDocsJson(docsJsonPath);
726
- const snapshot = await loadDocsConfigSnapshot(rootDir, options.configPath);
721
+ function withCloudInitDefaults(cloud, existingCloud, apiKeyEnv) {
722
+ const normalized = normalizeCloudConfig(cloud);
723
+ if (!existingCloud?.apiKey?.env) normalized.apiKey = { env: apiKeyEnv };
724
+ if (!normalized.deploy) normalized.deploy = { enabled: true };
725
+ if (typeof normalized.analytics === "undefined") normalized.analytics = {
726
+ enabled: true,
727
+ console: false,
728
+ includeInputs: false
729
+ };
730
+ return normalizeCloudConfig(normalized);
731
+ }
732
+ function writeMaterializedCloudConfig(params) {
727
733
  const config = materializeDocsJsonObject({
728
- rootDir,
729
- snapshot,
730
- existing,
731
- docsInfraProfile: options.docsInfraProfile
734
+ rootDir: params.rootDir,
735
+ snapshot: params.snapshot,
736
+ existing: params.existing,
737
+ docsInfraProfile: params.docsInfraProfile,
738
+ detectConnectedDocsProfile: params.detectConnectedDocsProfile,
739
+ dropStaleDocsInfraProfile: params.dropStaleDocsInfraProfile
732
740
  });
741
+ if (params.cloudInitApiKeyEnv) config.cloud = withCloudInitDefaults(config.cloud, params.existing?.cloud, params.cloudInitApiKeyEnv);
733
742
  const serialized = serializeMaterializedDocsJson(config);
734
- const updated = (existing ? fs.readFileSync(docsJsonPath, "utf-8") : void 0) !== serialized;
735
- if (updated) fs.writeFileSync(docsJsonPath, serialized, "utf-8");
743
+ const updated = (params.existing ? fs.readFileSync(params.docsJsonPath, "utf-8") : void 0) !== serialized;
744
+ if (updated) fs.writeFileSync(params.docsJsonPath, serialized, "utf-8");
736
745
  return {
737
- configPath: snapshot.path ?? docsJsonPath,
738
- docsJsonPath,
746
+ configPath: params.snapshot.path ?? params.docsJsonPath,
747
+ docsJsonPath: params.docsJsonPath,
739
748
  config,
740
749
  apiKeyEnv: config.cloud?.apiKey?.env ?? DOCS_CLOUD_DEFAULT_API_KEY_ENV,
741
- created: !existing,
750
+ created: !params.existing,
742
751
  updated
743
752
  };
744
753
  }
754
+ async function materializeCloudConfig(options = {}) {
755
+ const rootDir = options.rootDir ?? process.cwd();
756
+ const docsJsonPath = path.join(rootDir, DOCS_JSON_FILE);
757
+ const existing = readExistingDocsJson(docsJsonPath);
758
+ const snapshot = await loadDocsConfigSnapshot(rootDir, options.configPath);
759
+ const useDocsJsonAsSource = Boolean(existing && !snapshot.path);
760
+ return writeMaterializedCloudConfig({
761
+ rootDir,
762
+ docsJsonPath,
763
+ existing,
764
+ snapshot,
765
+ docsInfraProfile: options.docsInfraProfile,
766
+ detectConnectedDocsProfile: !useDocsJsonAsSource,
767
+ dropStaleDocsInfraProfile: !useDocsJsonAsSource
768
+ });
769
+ }
745
770
  function readCombinedEnv(rootDir) {
746
771
  const env = { ...loadProjectEnv(rootDir) };
747
772
  for (const [key, value] of Object.entries(process.env)) if (typeof value === "string") env[key] = value;
@@ -1415,9 +1440,35 @@ async function syncCloudConfig(options = {}) {
1415
1440
  }
1416
1441
  async function initCloudConfig(options = {}) {
1417
1442
  const rootDir = options.rootDir ?? process.cwd();
1443
+ const docsJsonPath = path.join(rootDir, DOCS_JSON_FILE);
1444
+ const existingDocsJson = readExistingDocsJson(docsJsonPath);
1418
1445
  const apiKeyEnv = normalizeEnvName(options.apiKeyEnv, DOCS_CLOUD_DEFAULT_API_KEY_ENV);
1419
1446
  const existingConfigPath = tryResolveDocsConfigPath(rootDir, options.configPath);
1420
- const docsInfraProfile = options.docsInfraProfile ?? (existingConfigPath ? void 0 : detectConnectedFumadocsProfile(rootDir));
1447
+ const useDocsJsonAsSource = Boolean(existingDocsJson && !existingConfigPath);
1448
+ const docsInfraProfile = options.docsInfraProfile ?? (existingConfigPath || existingDocsJson ? void 0 : detectConnectedFumadocsProfile(rootDir));
1449
+ if (useDocsJsonAsSource) {
1450
+ const materialized = writeMaterializedCloudConfig({
1451
+ rootDir,
1452
+ docsJsonPath,
1453
+ existing: existingDocsJson,
1454
+ snapshot: {},
1455
+ docsInfraProfile,
1456
+ cloudInitApiKeyEnv: apiKeyEnv,
1457
+ detectConnectedDocsProfile: false,
1458
+ dropStaleDocsInfraProfile: false
1459
+ });
1460
+ return {
1461
+ configPath: materialized.configPath,
1462
+ docsJsonPath: materialized.docsJsonPath,
1463
+ apiKeyEnv: materialized.apiKeyEnv,
1464
+ analyticsProjectIdEnv: DOCS_CLOUD_DEFAULT_ANALYTICS_PROJECT_ID_ENV,
1465
+ configCreated: false,
1466
+ configUpdated: false,
1467
+ docsJsonCreated: false,
1468
+ docsJsonUpdated: materialized.updated,
1469
+ ...docsInfraProfile ? { docsInfraProfile } : {}
1470
+ };
1471
+ }
1421
1472
  const configUpdate = ensureDocsConfigCloudInit({
1422
1473
  rootDir,
1423
1474
  configPath: options.configPath,
@@ -1,5 +1,5 @@
1
1
  import { i as detectPackageManagerFromProject } from "./utils-D-xTRNuh.mjs";
2
- import { K as rootLayoutTemplate, W as postcssConfigTemplate, g as docsLayoutTemplate, v as globalCssTemplate, yt as tsconfigTemplate } from "./templates-CEcOVbV0.mjs";
2
+ import { K as rootLayoutTemplate, W as postcssConfigTemplate, g as docsLayoutTemplate, v as globalCssTemplate, yt as tsconfigTemplate } from "./templates-uaauJcTO.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
1
  import { c as fileExists, o as exec, s as execOutput } from "./utils-D-xTRNuh.mjs";
2
- import { a as getPackagesForFramework, c as resolveDocsPackageManager, l as validateUpgradeVersion, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework } from "./package-version-DPQSBBsX.mjs";
2
+ import { a as getPackagesForFramework, c as resolveDocsPackageManager, l as validateUpgradeVersion, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework } from "./package-version-C8PigBZk.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
1
  import { a as devInstallCommand, c as fileExists, d as readFileSafe, f as spawnAndWaitFor, i as detectPackageManagerFromProject, l as formatPackageManagerDetection, n as detectGlobalCssFiles, o as exec, p as writeFileSafe, r as detectNextAppDir, t as detectFramework, u as installCommand } from "./utils-D-xTRNuh.mjs";
2
- import { $ as svelteDocsPublicHookTemplate, A as nextConfigMergedTemplate, B as nuxtServerApiDocsRouteTemplate, C as injectRootProviderIntoLayout, D as injectTanstackVitePlugins, E as injectTanstackRootProviderIntoRoute, F as nuxtDocsConfigTemplate, G as quickstartPageTemplate, H as nuxtServerDocsPublicMiddlewareTemplate, I as nuxtDocsPageTemplate, J as svelteDocsApiRouteTemplate, K as rootLayoutTemplate, L as nuxtGlobalCssTemplate, M as nextLocaleDocPageTemplate, N as nextLocalizedPageTemplate, O as installationPageTemplate, P as nuxtConfigTemplate, Q as svelteDocsPageTemplate, R as nuxtInstallationPageTemplate, S as injectNuxtCssImport, T as injectSvelteDocsPublicHook, U as nuxtWelcomePageTemplate, V as nuxtServerApiReferenceRouteTemplate, W as postcssConfigTemplate, X as svelteDocsLayoutServerTemplate, Y as svelteDocsConfigTemplate, Z as svelteDocsLayoutTemplate, _ as getAstroAdapterPkg, _t as tanstackViteConfigTemplate, a as astroDocsIndexTemplate, at as svelteWelcomePageTemplate, b as injectAstroDocsMiddleware, bt as welcomePageTemplate, c as astroDocsServerTemplate, ct as tanstackDocsCatchAllRouteTemplate, d as astroQuickstartPageTemplate, dt as tanstackDocsIndexRouteTemplate, et as svelteDocsServerTemplate, f as astroWelcomePageTemplate, ft as tanstackDocsPublicRouteTemplate, g as docsLayoutTemplate, gt as tanstackRootRouteTemplate, h as docsConfigTemplate, ht as tanstackQuickstartPageTemplate, i as astroDocsConfigTemplate, it as svelteRootLayoutTemplate, j as nextConfigTemplate, k as nextApiReferencePageTemplate, l as astroGlobalCssTemplate, lt as tanstackDocsConfigTemplate, m as customThemeTsTemplate, mt as tanstackInstallationPageTemplate, n as astroApiRouteTemplate, nt as svelteInstallationPageTemplate, o as astroDocsMiddlewareTemplate, ot as tanstackApiDocsRouteTemplate, p as customThemeCssTemplate, pt as tanstackDocsServerTemplate, q as svelteApiReferenceRouteTemplate, r as astroConfigTemplate, rt as svelteQuickstartPageTemplate, s as astroDocsPageTemplate, st as tanstackApiReferenceRouteTemplate, t as astroApiReferenceRouteTemplate, tt as svelteGlobalCssTemplate, u as astroInstallationPageTemplate, ut as tanstackDocsFunctionsTemplate, v as globalCssTemplate, vt as tanstackWelcomePageTemplate, w as injectSvelteCssImport, x as injectCssImport, y as injectAstroCssImport, yt as tsconfigTemplate, z as nuxtQuickstartPageTemplate } from "./templates-CEcOVbV0.mjs";
2
+ import { $ as svelteDocsPublicHookTemplate, A as nextConfigMergedTemplate, B as nuxtServerApiDocsRouteTemplate, C as injectRootProviderIntoLayout, D as injectTanstackVitePlugins, E as injectTanstackRootProviderIntoRoute, F as nuxtDocsConfigTemplate, G as quickstartPageTemplate, H as nuxtServerDocsPublicMiddlewareTemplate, I as nuxtDocsPageTemplate, J as svelteDocsApiRouteTemplate, K as rootLayoutTemplate, L as nuxtGlobalCssTemplate, M as nextLocaleDocPageTemplate, N as nextLocalizedPageTemplate, O as installationPageTemplate, P as nuxtConfigTemplate, Q as svelteDocsPageTemplate, R as nuxtInstallationPageTemplate, S as injectNuxtCssImport, T as injectSvelteDocsPublicHook, U as nuxtWelcomePageTemplate, V as nuxtServerApiReferenceRouteTemplate, W as postcssConfigTemplate, X as svelteDocsLayoutServerTemplate, Y as svelteDocsConfigTemplate, Z as svelteDocsLayoutTemplate, _ as getAstroAdapterPkg, _t as tanstackViteConfigTemplate, a as astroDocsIndexTemplate, at as svelteWelcomePageTemplate, b as injectAstroDocsMiddleware, bt as welcomePageTemplate, c as astroDocsServerTemplate, ct as tanstackDocsCatchAllRouteTemplate, d as astroQuickstartPageTemplate, dt as tanstackDocsIndexRouteTemplate, et as svelteDocsServerTemplate, f as astroWelcomePageTemplate, ft as tanstackDocsPublicRouteTemplate, g as docsLayoutTemplate, gt as tanstackRootRouteTemplate, h as docsConfigTemplate, ht as tanstackQuickstartPageTemplate, i as astroDocsConfigTemplate, it as svelteRootLayoutTemplate, j as nextConfigTemplate, k as nextApiReferencePageTemplate, l as astroGlobalCssTemplate, lt as tanstackDocsConfigTemplate, m as customThemeTsTemplate, mt as tanstackInstallationPageTemplate, n as astroApiRouteTemplate, nt as svelteInstallationPageTemplate, o as astroDocsMiddlewareTemplate, ot as tanstackApiDocsRouteTemplate, p as customThemeCssTemplate, pt as tanstackDocsServerTemplate, q as svelteApiReferenceRouteTemplate, r as astroConfigTemplate, rt as svelteQuickstartPageTemplate, s as astroDocsPageTemplate, st as tanstackApiReferenceRouteTemplate, t as astroApiReferenceRouteTemplate, tt as svelteGlobalCssTemplate, u as astroInstallationPageTemplate, ut as tanstackDocsFunctionsTemplate, v as globalCssTemplate, vt as tanstackWelcomePageTemplate, w as injectSvelteCssImport, x as injectCssImport, y as injectAstroCssImport, yt as tsconfigTemplate, z as nuxtQuickstartPageTemplate } from "./templates-uaauJcTO.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import pc from "picocolors";
@@ -188,7 +188,7 @@ async function configureDocsCloudOnboarding(options) {
188
188
  enabled = cloudAnswer;
189
189
  }
190
190
  if (!enabled) return;
191
- const { initCloudConfig } = await import("./cloud-Bk-eppay.mjs");
191
+ const { initCloudConfig } = await import("./cloud-C_Ok9rC5.mjs");
192
192
  printDocsCloudOnboardingInstructions(await initCloudConfig({
193
193
  rootDir: options.rootDir,
194
194
  configPath: getDocsCloudConfigPathForFramework(options.framework)
@@ -792,7 +792,7 @@ async function init(options = {}) {
792
792
  p.log.info(`Using ${pc.cyan(pm)} as package manager`);
793
793
  const s2 = p.spinner();
794
794
  s2.start("Installing dependencies");
795
- const docsRuntimeInstallCommand = framework === "tanstack-start" ? `${installCommand(pm)} @farming-labs/docs @farming-labs/theme @farming-labs/tanstack-start` : framework === "sveltekit" ? `${installCommand(pm)} @farming-labs/docs @farming-labs/svelte @farming-labs/svelte-theme` : framework === "astro" ? `${installCommand(pm)} @farming-labs/docs @farming-labs/astro @farming-labs/astro-theme ${getAstroAdapterPkg(cfg.astroAdapter ?? "vercel")}` : framework === "nuxt" ? `${installCommand(pm)} @farming-labs/docs @farming-labs/nuxt @farming-labs/nuxt-theme` : `${installCommand(pm)} @farming-labs/docs @farming-labs/next @farming-labs/theme`;
795
+ const docsRuntimeInstallCommand = framework === "tanstack-start" ? `${installCommand(pm)} @farming-labs/docs @farming-labs/theme @farming-labs/tanstack-start` : framework === "sveltekit" ? `${installCommand(pm)} @farming-labs/docs @farming-labs/svelte @farming-labs/svelte-theme @farming-labs/theme` : framework === "astro" ? `${installCommand(pm)} @farming-labs/docs @farming-labs/astro @farming-labs/astro-theme @farming-labs/theme ${getAstroAdapterPkg(cfg.astroAdapter ?? "vercel")}` : framework === "nuxt" ? `${installCommand(pm)} @farming-labs/docs @farming-labs/nuxt @farming-labs/nuxt-theme @farming-labs/theme` : `${installCommand(pm)} @farming-labs/docs @farming-labs/next @farming-labs/theme`;
796
796
  try {
797
797
  exec(docsRuntimeInstallCommand, cwd);
798
798
  if (framework === "tanstack-start") {
@@ -24,17 +24,20 @@ const PACKAGES_BY_FRAMEWORK = {
24
24
  nuxt: [
25
25
  "@farming-labs/docs",
26
26
  "@farming-labs/nuxt",
27
- "@farming-labs/nuxt-theme"
27
+ "@farming-labs/nuxt-theme",
28
+ "@farming-labs/theme"
28
29
  ],
29
30
  sveltekit: [
30
31
  "@farming-labs/docs",
31
32
  "@farming-labs/svelte",
32
- "@farming-labs/svelte-theme"
33
+ "@farming-labs/svelte-theme",
34
+ "@farming-labs/theme"
33
35
  ],
34
36
  astro: [
35
37
  "@farming-labs/docs",
36
38
  "@farming-labs/astro",
37
- "@farming-labs/astro-theme"
39
+ "@farming-labs/astro-theme",
40
+ "@farming-labs/theme"
38
41
  ]
39
42
  };
40
43
  function presetFromFramework(fw) {
@@ -8,10 +8,7 @@ const THEME_INFO = {
8
8
  svelteImport: "@farming-labs/svelte-theme",
9
9
  astroImport: "@farming-labs/astro-theme",
10
10
  nuxtImport: "@farming-labs/nuxt-theme",
11
- nextCssImport: "default",
12
- svelteCssTheme: "fumadocs",
13
- astroCssTheme: "fumadocs",
14
- nuxtCssTheme: "fumadocs"
11
+ nextCssImport: "default"
15
12
  },
16
13
  darksharp: {
17
14
  factory: "darksharp",
@@ -19,10 +16,7 @@ const THEME_INFO = {
19
16
  svelteImport: "@farming-labs/svelte-theme/darksharp",
20
17
  astroImport: "@farming-labs/astro-theme/darksharp",
21
18
  nuxtImport: "@farming-labs/nuxt-theme/darksharp",
22
- nextCssImport: "darksharp",
23
- svelteCssTheme: "darksharp",
24
- astroCssTheme: "darksharp",
25
- nuxtCssTheme: "darksharp"
19
+ nextCssImport: "darksharp"
26
20
  },
27
21
  "pixel-border": {
28
22
  factory: "pixelBorder",
@@ -30,10 +24,7 @@ const THEME_INFO = {
30
24
  svelteImport: "@farming-labs/svelte-theme/pixel-border",
31
25
  astroImport: "@farming-labs/astro-theme/pixel-border",
32
26
  nuxtImport: "@farming-labs/nuxt-theme/pixel-border",
33
- nextCssImport: "pixel-border",
34
- svelteCssTheme: "pixel-border",
35
- astroCssTheme: "pixel-border",
36
- nuxtCssTheme: "pixel-border"
27
+ nextCssImport: "pixel-border"
37
28
  },
38
29
  colorful: {
39
30
  factory: "colorful",
@@ -41,10 +32,7 @@ const THEME_INFO = {
41
32
  svelteImport: "@farming-labs/svelte-theme/colorful",
42
33
  astroImport: "@farming-labs/astro-theme/colorful",
43
34
  nuxtImport: "@farming-labs/nuxt-theme/colorful",
44
- nextCssImport: "colorful",
45
- svelteCssTheme: "colorful",
46
- astroCssTheme: "colorful",
47
- nuxtCssTheme: "colorful"
35
+ nextCssImport: "colorful"
48
36
  },
49
37
  darkbold: {
50
38
  factory: "darkbold",
@@ -52,10 +40,7 @@ const THEME_INFO = {
52
40
  svelteImport: "@farming-labs/svelte-theme/darkbold",
53
41
  astroImport: "@farming-labs/astro-theme/darkbold",
54
42
  nuxtImport: "@farming-labs/nuxt-theme/darkbold",
55
- nextCssImport: "darkbold",
56
- svelteCssTheme: "darkbold",
57
- astroCssTheme: "darkbold",
58
- nuxtCssTheme: "darkbold"
43
+ nextCssImport: "darkbold"
59
44
  },
60
45
  shiny: {
61
46
  factory: "shiny",
@@ -63,10 +48,7 @@ const THEME_INFO = {
63
48
  svelteImport: "@farming-labs/svelte-theme/shiny",
64
49
  astroImport: "@farming-labs/astro-theme/shiny",
65
50
  nuxtImport: "@farming-labs/nuxt-theme/shiny",
66
- nextCssImport: "shiny",
67
- svelteCssTheme: "shiny",
68
- astroCssTheme: "shiny",
69
- nuxtCssTheme: "shiny"
51
+ nextCssImport: "shiny"
70
52
  },
71
53
  ledger: {
72
54
  factory: "ledger",
@@ -74,10 +56,7 @@ const THEME_INFO = {
74
56
  svelteImport: "@farming-labs/svelte-theme/ledger",
75
57
  astroImport: "@farming-labs/astro-theme/ledger",
76
58
  nuxtImport: "@farming-labs/nuxt-theme/ledger",
77
- nextCssImport: "ledger",
78
- svelteCssTheme: "ledger",
79
- astroCssTheme: "ledger",
80
- nuxtCssTheme: "ledger"
59
+ nextCssImport: "ledger"
81
60
  },
82
61
  greentree: {
83
62
  factory: "greentree",
@@ -85,10 +64,7 @@ const THEME_INFO = {
85
64
  svelteImport: "@farming-labs/svelte-theme/greentree",
86
65
  astroImport: "@farming-labs/astro-theme/greentree",
87
66
  nuxtImport: "@farming-labs/nuxt-theme/greentree",
88
- nextCssImport: "greentree",
89
- svelteCssTheme: "greentree",
90
- astroCssTheme: "greentree",
91
- nuxtCssTheme: "greentree"
67
+ nextCssImport: "greentree"
92
68
  },
93
69
  concrete: {
94
70
  factory: "concrete",
@@ -96,10 +72,7 @@ const THEME_INFO = {
96
72
  svelteImport: "@farming-labs/svelte-theme/concrete",
97
73
  astroImport: "@farming-labs/astro-theme/concrete",
98
74
  nuxtImport: "@farming-labs/nuxt-theme/concrete",
99
- nextCssImport: "concrete",
100
- svelteCssTheme: "concrete",
101
- astroCssTheme: "concrete",
102
- nuxtCssTheme: "concrete"
75
+ nextCssImport: "concrete"
103
76
  },
104
77
  "command-grid": {
105
78
  factory: "commandGrid",
@@ -107,10 +80,7 @@ const THEME_INFO = {
107
80
  svelteImport: "@farming-labs/svelte-theme/command-grid",
108
81
  astroImport: "@farming-labs/astro-theme/command-grid",
109
82
  nuxtImport: "@farming-labs/nuxt-theme/command-grid",
110
- nextCssImport: "command-grid",
111
- svelteCssTheme: "command-grid",
112
- astroCssTheme: "command-grid",
113
- nuxtCssTheme: "command-grid"
83
+ nextCssImport: "command-grid"
114
84
  },
115
85
  hardline: {
116
86
  factory: "hardline",
@@ -118,15 +88,18 @@ const THEME_INFO = {
118
88
  svelteImport: "@farming-labs/svelte-theme/hardline",
119
89
  astroImport: "@farming-labs/astro-theme/hardline",
120
90
  nuxtImport: "@farming-labs/nuxt-theme/hardline",
121
- nextCssImport: "hardline",
122
- svelteCssTheme: "hardline",
123
- astroCssTheme: "hardline",
124
- nuxtCssTheme: "hardline"
91
+ nextCssImport: "hardline"
125
92
  }
126
93
  };
127
94
  function getThemeInfo(theme) {
128
95
  return THEME_INFO[theme] ?? THEME_INFO.fumadocs;
129
96
  }
97
+ function getThemeCssImport(theme) {
98
+ return `@farming-labs/theme/${getThemeInfo(theme).nextCssImport}/css`;
99
+ }
100
+ function hasBuiltInThemeCssImport(content) {
101
+ return /["']@farming-labs\/(?:theme|svelte-theme|astro-theme|nuxt-theme)\/[^"'\n]*\/css["']/.test(content);
102
+ }
130
103
  function toPosixPath(value) {
131
104
  return value.replace(/\\/g, "/");
132
105
  }
@@ -415,13 +388,13 @@ function globalCssTemplate(theme, customThemeName, globalCssRelPath) {
415
388
  `;
416
389
  return `\
417
390
  @import "tailwindcss";
418
- @import "@farming-labs/theme/${getThemeInfo(theme).nextCssImport}/css";
391
+ @import "${getThemeCssImport(theme)}";
419
392
  `;
420
393
  }
421
394
  function injectCssImport(existingContent, theme, customThemeName, globalCssRelPath) {
422
- const importLine = theme === "custom" && customThemeName && globalCssRelPath ? `@import "${getCustomThemeCssImportPath(globalCssRelPath, customThemeName.replace(/\.css$/i, ""))}";` : `@import "@farming-labs/theme/${getThemeInfo(theme).nextCssImport}/css";`;
395
+ const importLine = theme === "custom" && customThemeName && globalCssRelPath ? `@import "${getCustomThemeCssImportPath(globalCssRelPath, customThemeName.replace(/\.css$/i, ""))}";` : `@import "${getThemeCssImport(theme)}";`;
423
396
  if (existingContent.includes(importLine)) return null;
424
- if (theme !== "custom" && existingContent.includes("@farming-labs/theme/") && existingContent.includes("/css")) return null;
397
+ if (theme !== "custom" && hasBuiltInThemeCssImport(existingContent)) return null;
425
398
  if (theme === "custom" && existingContent.includes("themes/") && existingContent.includes(".css")) return null;
426
399
  const lines = existingContent.split("\n");
427
400
  const lastImportIdx = lines.reduce((acc, l, i) => l.trimStart().startsWith("@import") ? i : acc, -1);
@@ -1435,17 +1408,17 @@ function svelteGlobalCssTemplate(theme, customThemeName, globalCssRelPath) {
1435
1408
  @import "${getCustomThemeCssImportPath(globalCssRelPath, customThemeName.replace(/\.css$/i, ""))}";
1436
1409
  `;
1437
1410
  return `\
1438
- @import "@farming-labs/svelte-theme/${theme}/css";
1411
+ @import "${getThemeCssImport(theme)}";
1439
1412
  `;
1440
1413
  }
1441
1414
  function svelteCssImportLine(theme, customThemeName, globalCssRelPath) {
1442
1415
  if (theme === "custom" && customThemeName && globalCssRelPath) return `@import "${getCustomThemeCssImportPath(globalCssRelPath, customThemeName.replace(/\.css$/i, ""))}";`;
1443
- return `@import "@farming-labs/svelte-theme/${theme}/css";`;
1416
+ return `@import "${getThemeCssImport(theme)}";`;
1444
1417
  }
1445
1418
  function injectSvelteCssImport(existingContent, theme, customThemeName, globalCssRelPath) {
1446
1419
  const importLine = svelteCssImportLine(theme, customThemeName, globalCssRelPath);
1447
1420
  if (existingContent.includes(importLine)) return null;
1448
- if (theme !== "custom" && existingContent.includes("@farming-labs/svelte-theme/") && existingContent.includes("/css")) return null;
1421
+ if (theme !== "custom" && hasBuiltInThemeCssImport(existingContent)) return null;
1449
1422
  if (theme === "custom" && existingContent.includes("themes/") && existingContent.includes(".css")) return null;
1450
1423
  const lines = existingContent.split("\n");
1451
1424
  const lastImportIdx = lines.reduce((acc, l, i) => l.trimStart().startsWith("@import") ? i : acc, -1);
@@ -1503,7 +1476,7 @@ Follow these steps to install and configure ${cfg.projectName}.
1503
1476
  ## Install Dependencies
1504
1477
 
1505
1478
  \`\`\`bash
1506
- pnpm add @farming-labs/docs @farming-labs/svelte @farming-labs/svelte-theme
1479
+ pnpm add @farming-labs/docs @farming-labs/svelte @farming-labs/svelte-theme @farming-labs/theme
1507
1480
  \`\`\`
1508
1481
 
1509
1482
  ## Configuration
@@ -1738,7 +1711,7 @@ import DocsContent from "@farming-labs/astro-theme/src/components/DocsContent.as
1738
1711
  import SearchDialog from "@farming-labs/astro-theme/src/components/SearchDialog.astro";
1739
1712
  import config from "${astroPageConfigImport(cfg.useAlias, 2)}";
1740
1713
  import { load } from "${astroPageServerImport(cfg.useAlias, 2)}";
1741
- import "${`@farming-labs/astro-theme/${getThemeInfo(cfg.theme).astroCssTheme}/css`}";
1714
+ import "${getThemeCssImport(cfg.theme)}";
1742
1715
 
1743
1716
  const data = await load(Astro.url.pathname);
1744
1717
  ---
@@ -1766,7 +1739,7 @@ import DocsContent from "@farming-labs/astro-theme/src/components/DocsContent.as
1766
1739
  import SearchDialog from "@farming-labs/astro-theme/src/components/SearchDialog.astro";
1767
1740
  import config from "${astroPageConfigImport(cfg.useAlias, 2)}";
1768
1741
  import { load } from "${astroPageServerImport(cfg.useAlias, 2)}";
1769
- import "${`@farming-labs/astro-theme/${getThemeInfo(cfg.theme).astroCssTheme}/css`}";
1742
+ import "${getThemeCssImport(cfg.theme)}";
1770
1743
 
1771
1744
  const data = await load(Astro.url.pathname);
1772
1745
  ---
@@ -1903,17 +1876,17 @@ function astroGlobalCssTemplate(theme, customThemeName, globalCssRelPath) {
1903
1876
  @import "${getCustomThemeCssImportPath(globalCssRelPath, customThemeName.replace(/\.css$/i, ""))}";
1904
1877
  `;
1905
1878
  return `\
1906
- @import "@farming-labs/astro-theme/${theme}/css";
1879
+ @import "${getThemeCssImport(theme)}";
1907
1880
  `;
1908
1881
  }
1909
1882
  function astroCssImportLine(theme, customThemeName, globalCssRelPath) {
1910
1883
  if (theme === "custom" && customThemeName && globalCssRelPath) return `@import "${getCustomThemeCssImportPath(globalCssRelPath, customThemeName.replace(/\.css$/i, ""))}";`;
1911
- return `@import "@farming-labs/astro-theme/${theme}/css";`;
1884
+ return `@import "${getThemeCssImport(theme)}";`;
1912
1885
  }
1913
1886
  function injectAstroCssImport(existingContent, theme, customThemeName, globalCssRelPath) {
1914
1887
  const importLine = astroCssImportLine(theme, customThemeName, globalCssRelPath);
1915
1888
  if (existingContent.includes(importLine)) return null;
1916
- if (theme !== "custom" && existingContent.includes("@farming-labs/astro-theme/") && existingContent.includes("/css")) return null;
1889
+ if (theme !== "custom" && hasBuiltInThemeCssImport(existingContent)) return null;
1917
1890
  if (theme === "custom" && existingContent.includes("themes/") && existingContent.includes(".css")) return null;
1918
1891
  const lines = existingContent.split("\n");
1919
1892
  const lastImportIdx = lines.reduce((acc, l, i) => l.trimStart().startsWith("@import") ? i : acc, -1);
@@ -1971,7 +1944,7 @@ Follow these steps to install and configure ${cfg.projectName}.
1971
1944
  ## Install Dependencies
1972
1945
 
1973
1946
  \\\`\\\`\\\`bash
1974
- pnpm add @farming-labs/docs @farming-labs/astro @farming-labs/astro-theme
1947
+ pnpm add @farming-labs/docs @farming-labs/astro @farming-labs/astro-theme @farming-labs/theme
1975
1948
  \\\`\\\`\\\`
1976
1949
 
1977
1950
  ## Configuration
@@ -2195,11 +2168,11 @@ function nuxtConfigTemplate(cfg) {
2195
2168
  export default defineNuxtConfig({
2196
2169
  compatibilityDate: "2024-11-01",
2197
2170
 
2198
- css: ["@farming-labs/nuxt-theme/${getThemeInfo(cfg.theme).nuxtCssTheme}/css"],
2171
+ css: ["${getThemeCssImport(cfg.theme)}"],
2199
2172
 
2200
2173
  vite: {
2201
2174
  optimizeDeps: {
2202
- include: ["@farming-labs/docs", "@farming-labs/nuxt", "@farming-labs/nuxt-theme"],
2175
+ include: ["@farming-labs/docs", "@farming-labs/nuxt", "@farming-labs/nuxt-theme", "@farming-labs/theme"],
2203
2176
  },
2204
2177
  },
2205
2178
 
@@ -2264,7 +2237,7 @@ Follow these steps to install and configure ${cfg.projectName}.
2264
2237
  ## Install Dependencies
2265
2238
 
2266
2239
  \`\`\`bash
2267
- pnpm add @farming-labs/docs @farming-labs/nuxt @farming-labs/nuxt-theme
2240
+ pnpm add @farming-labs/docs @farming-labs/nuxt @farming-labs/nuxt-theme @farming-labs/theme
2268
2241
  \`\`\`
2269
2242
 
2270
2243
  ## Configuration
@@ -2370,17 +2343,17 @@ function nuxtGlobalCssTemplate(theme, customThemeName, globalCssRelPath) {
2370
2343
  @import "${getCustomThemeCssImportPath(globalCssRelPath, customThemeName.replace(/\.css$/i, ""))}";
2371
2344
  `;
2372
2345
  return `\
2373
- @import "@farming-labs/nuxt-theme/${theme}/css";
2346
+ @import "${getThemeCssImport(theme)}";
2374
2347
  `;
2375
2348
  }
2376
2349
  function nuxtCssImportLine(theme, customThemeName, globalCssRelPath) {
2377
2350
  if (theme === "custom" && customThemeName && globalCssRelPath) return `@import "${getCustomThemeCssImportPath(globalCssRelPath, customThemeName.replace(/\.css$/i, ""))}";`;
2378
- return `@import "@farming-labs/nuxt-theme/${theme}/css";`;
2351
+ return `@import "${getThemeCssImport(theme)}";`;
2379
2352
  }
2380
2353
  function injectNuxtCssImport(existingContent, theme, customThemeName, globalCssRelPath) {
2381
2354
  const importLine = nuxtCssImportLine(theme, customThemeName, globalCssRelPath);
2382
2355
  if (existingContent.includes(importLine)) return null;
2383
- if (theme !== "custom" && existingContent.includes("@farming-labs/nuxt-theme/") && existingContent.includes("/css")) return null;
2356
+ if (theme !== "custom" && hasBuiltInThemeCssImport(existingContent)) return null;
2384
2357
  if (theme === "custom" && existingContent.includes("themes/") && existingContent.includes(".css")) return null;
2385
2358
  const lines = existingContent.split("\n");
2386
2359
  const lastImportIdx = lines.reduce((acc, l, i) => l.trimStart().startsWith("@import") ? i : acc, -1);
@@ -1,5 +1,5 @@
1
1
  import { c as fileExists, o as exec } from "./utils-D-xTRNuh.mjs";
2
- import { a as getPackagesForFramework, c as resolveDocsPackageManager, i as frameworkFromPreset, l as validateUpgradeVersion, n as PRESETS, o as presetFromFramework, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework, t as PACKAGES_BY_FRAMEWORK } from "./package-version-DPQSBBsX.mjs";
2
+ import { a as getPackagesForFramework, c as resolveDocsPackageManager, i as frameworkFromPreset, l as validateUpgradeVersion, n as PRESETS, o as presetFromFramework, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework, t as PACKAGES_BY_FRAMEWORK } from "./package-version-C8PigBZk.mjs";
3
3
  import path from "node:path";
4
4
  import pc from "picocolors";
5
5
  import * as p from "@clack/prompts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.2.43",
3
+ "version": "0.2.45",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",