@fumadocs/cli 1.7.5 → 1.7.6
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/{ai-BoUGzPvv.js → ai-CvrtLYh1.js} +8 -6
- package/dist/ai-CvrtLYh1.js.map +1 -0
- package/dist/all-bAINnjNQ.js +26 -0
- package/dist/{all-DgAfTffR.js.map → all-bAINnjNQ.js.map} +1 -1
- package/dist/codemod/index.d.ts +1 -1
- package/dist/codemod/index.js +1 -2
- package/dist/{codemod-auol-p4R.js → codemod-Wc9nRqrw.js} +60 -39
- package/dist/codemod-Wc9nRqrw.js.map +1 -0
- package/dist/{config-Bw0kmF01.js → config-BpiQyqBs.js} +13 -8
- package/dist/config-BpiQyqBs.js.map +1 -0
- package/dist/{config-Bfg4yG8S.d.ts → config-Z-4b_Y_C.d.ts} +1 -3
- package/dist/config-Z-4b_Y_C.d.ts.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -2
- package/dist/{docs-qRGwd9Yp.js → docs---dy-BSm.js} +286 -32
- package/dist/docs---dy-BSm.js.map +1 -0
- package/dist/{epub-DbOh5Q2D.js → epub-BKvZ4ppz.js} +12 -13
- package/dist/epub-BKvZ4ppz.js.map +1 -0
- package/dist/features/ai.d.ts +2 -3
- package/dist/features/ai.d.ts.map +1 -1
- package/dist/features/ai.js +1 -2
- package/dist/features/all.d.ts +1 -3
- package/dist/features/all.d.ts.map +1 -1
- package/dist/features/all.js +1 -2
- package/dist/features/docs/index.d.ts +2 -4
- package/dist/features/docs/index.d.ts.map +1 -1
- package/dist/features/docs/index.js +1 -2
- package/dist/features/epub.d.ts +1 -3
- package/dist/features/epub.d.ts.map +1 -1
- package/dist/features/epub.js +1 -2
- package/dist/features/feedback.d.ts +1 -3
- package/dist/features/feedback.d.ts.map +1 -1
- package/dist/features/feedback.js +1 -2
- package/dist/features/index.d.ts +1 -1
- package/dist/features/index.js +1 -2
- package/dist/features/lint.d.ts +1 -3
- package/dist/features/lint.d.ts.map +1 -1
- package/dist/features/lint.js +1 -2
- package/dist/features/llms.d.ts +6 -7
- package/dist/features/llms.d.ts.map +1 -1
- package/dist/features/llms.js +1 -2
- package/dist/features/mcp.d.ts +5 -7
- package/dist/features/mcp.d.ts.map +1 -1
- package/dist/features/mcp.js +1 -2
- package/dist/features/og.d.ts +2 -3
- package/dist/features/og.d.ts.map +1 -1
- package/dist/features/og.js +1 -2
- package/dist/features/search.d.ts +10 -10
- package/dist/features/search.d.ts.map +1 -1
- package/dist/features/search.js +1 -2
- package/dist/features/utils.d.ts +2 -2
- package/dist/features/utils.js +1 -2
- package/dist/features/webmcp.d.ts +2 -3
- package/dist/features/webmcp.d.ts.map +1 -1
- package/dist/features/webmcp.js +1 -2
- package/dist/{features-Do6x9Tsz.js → features-C_FG2WD0.js} +5 -6
- package/dist/{features-Do6x9Tsz.js.map → features-C_FG2WD0.js.map} +1 -1
- package/dist/{feedback-DpXYMKtX.js → feedback-7u1-eklc.js} +6 -7
- package/dist/feedback-7u1-eklc.js.map +1 -0
- package/dist/{fs-D6J9dOEx.js → fs-Dqr1VJSD.js} +2 -3
- package/dist/{fs-D6J9dOEx.js.map → fs-Dqr1VJSD.js.map} +1 -1
- package/dist/{index-Cs7hw2un.d.ts → index-CAIqrY1S.d.ts} +3 -5
- package/dist/index-CAIqrY1S.d.ts.map +1 -0
- package/dist/{index-DI66DoV8.d.ts → index-DCJbgkgf.d.ts} +4 -8
- package/dist/index-DCJbgkgf.d.ts.map +1 -0
- package/dist/{index-Ck0EPdgu.d.ts → index-w9FHKPPs.d.ts} +6 -16
- package/dist/index-w9FHKPPs.d.ts.map +1 -0
- package/dist/index.js +22 -31
- package/dist/index.js.map +1 -1
- package/dist/{installer-C4662Woc.js → installer-CEOV0fBv.js} +3 -5
- package/dist/{installer-C4662Woc.js.map → installer-CEOV0fBv.js.map} +1 -1
- package/dist/{lint-zkXUULgO.js → lint-AC2ClOfa.js} +3 -4
- package/dist/{lint-zkXUULgO.js.map → lint-AC2ClOfa.js.map} +1 -1
- package/dist/{llms-DQzAst6R.js → llms-Cge1uefC.js} +11 -12
- package/dist/llms-Cge1uefC.js.map +1 -0
- package/dist/{mcp-BpFZ_fdV.js → mcp-BVpVFl6G.js} +7 -9
- package/dist/mcp-BVpVFl6G.js.map +1 -0
- package/dist/{og-CY4RS9Un.js → og-DuPd9kNq.js} +10 -11
- package/dist/og-DuPd9kNq.js.map +1 -0
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +1 -2
- package/dist/{project-DwRVTm4p.js → project-D655VGTX.js} +19 -10
- package/dist/project-D655VGTX.js.map +1 -0
- package/dist/registry/installer.d.ts +1 -3
- package/dist/registry/installer.d.ts.map +1 -1
- package/dist/registry/installer.js +1 -2
- package/dist/{search-BCHEW0-K.js → search-B44II4bM.js} +39 -30
- package/dist/search-B44II4bM.js.map +1 -0
- package/dist/{utils-DbMe7h6c.js → utils-Btt-BJ53.js} +6 -12
- package/dist/utils-Btt-BJ53.js.map +1 -0
- package/dist/{utils-CxJ7kw39.d.ts → utils-DlGz_4va.d.ts} +6 -12
- package/dist/utils-DlGz_4va.d.ts.map +1 -0
- package/dist/{webmcp-I9L7xzmw.js → webmcp-lY3_RsR3.js} +6 -8
- package/dist/webmcp-lY3_RsR3.js.map +1 -0
- package/package.json +7 -7
- package/dist/ai-BoUGzPvv.js.map +0 -1
- package/dist/all-DgAfTffR.js +0 -27
- package/dist/codemod-auol-p4R.js.map +0 -1
- package/dist/config-Bfg4yG8S.d.ts.map +0 -1
- package/dist/config-Bw0kmF01.js.map +0 -1
- package/dist/docs-qRGwd9Yp.js.map +0 -1
- package/dist/epub-DbOh5Q2D.js.map +0 -1
- package/dist/feedback-DpXYMKtX.js.map +0 -1
- package/dist/index-Ck0EPdgu.d.ts.map +0 -1
- package/dist/index-Cs7hw2un.d.ts.map +0 -1
- package/dist/index-DI66DoV8.d.ts.map +0 -1
- package/dist/llms-DQzAst6R.js.map +0 -1
- package/dist/mcp-BpFZ_fdV.js.map +0 -1
- package/dist/og-CY4RS9Un.js.map +0 -1
- package/dist/project-DwRVTm4p.js.map +0 -1
- package/dist/search-BCHEW0-K.js.map +0 -1
- package/dist/utils-CxJ7kw39.d.ts.map +0 -1
- package/dist/utils-DbMe7h6c.js.map +0 -1
- package/dist/webmcp-I9L7xzmw.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as docs } from "./docs-
|
|
2
|
-
import { r as findSource } from "./utils-
|
|
1
|
+
import { t as docs } from "./docs---dy-BSm.js";
|
|
2
|
+
import { r as findSource } from "./utils-Btt-BJ53.js";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
|
|
4
|
+
// src/features/ai.ts
|
|
5
5
|
const providers = {
|
|
6
6
|
openrouter: {
|
|
7
7
|
label: "AI SDK",
|
|
@@ -32,7 +32,10 @@ const ai = {
|
|
|
32
32
|
hint
|
|
33
33
|
}))
|
|
34
34
|
} },
|
|
35
|
-
supports: (project) =>
|
|
35
|
+
supports: (project) => {
|
|
36
|
+
if (project.framework === "astro") return "Astro is not supported by this feature";
|
|
37
|
+
return project.static ? "AI chat requires a server to run the chat route handler." : true;
|
|
38
|
+
},
|
|
36
39
|
async apply(ctx, { provider }) {
|
|
37
40
|
await ctx.install(`ai/${provider}`);
|
|
38
41
|
ctx.env(providers[provider].env, "");
|
|
@@ -87,7 +90,6 @@ async function readDynamicSource(ctx) {
|
|
|
87
90
|
file.s.replaceAll("await page.data.getText('processed')", "page.data.content");
|
|
88
91
|
}))) ctx.note("Read pages from `getSource()` in the chat route, the search index is built from `page.data.content`.");
|
|
89
92
|
}
|
|
90
|
-
//#endregion
|
|
91
93
|
export { ai as t };
|
|
92
94
|
|
|
93
|
-
//# sourceMappingURL=ai-
|
|
95
|
+
//# sourceMappingURL=ai-CvrtLYh1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-CvrtLYh1.js","names":[],"sources":["../src/features/ai.ts"],"sourcesContent":["import path from 'node:path';\nimport type { ImportDeclaration } from 'oxc-parser';\nimport type { Feature, FeatureContext } from '@/features';\nimport { findSource } from './utils';\nimport { docs } from './docs';\n\nconst providers = {\n openrouter: { label: 'AI SDK', hint: 'default to OpenRouter', env: 'OPENROUTER_API_KEY' },\n llmgateway: {\n label: 'LLMGateway',\n hint: 'open-source LLM gateway, API key required',\n env: 'LLM_GATEWAY_API_KEY',\n },\n inkeep: { label: 'Inkeep AI', hint: 'API key required', env: 'INKEEP_API_KEY' },\n};\n\nexport type AIProvider = keyof typeof providers;\n\nexport const ai: Feature<{ provider: AIProvider }> = {\n id: 'ai',\n title: 'AI Chat',\n description: 'Ask AI dialog for your docs',\n requires: [docs],\n options: {\n provider: {\n message: 'Choose an AI provider',\n choices: Object.entries(providers).map(([value, { label, hint }]) => ({\n value: value as AIProvider,\n label,\n hint,\n })),\n },\n },\n supports: (project) => {\n if (project.framework === 'astro') return 'Astro is not supported by this feature';\n return project.static ? 'AI chat requires a server to run the chat route handler.' : true;\n },\n async apply(ctx, { provider }) {\n await ctx.install(`ai/${provider}`);\n ctx.env(providers[provider].env, '');\n if (ctx.project.source.dynamic) await readDynamicSource(ctx);\n\n const { cwd, baseDir, info, config } = ctx.project;\n // e.g. `./components` -> `@/components/ai/layout`\n const clientLayoutImport = `@/${path.posix.join(config.aliases.componentsDir, 'ai/layout')}`;\n const layout = await findSource(cwd, path.join(baseDir, info.routesDir), '<DocsLayout');\n let layoutModule: string | undefined;\n let wired = false;\n\n if (layout !== undefined) {\n await ctx.source(layout, (file) => {\n wired = file.code.includes(`'${clientLayoutImport}'`);\n // `aiChat` takes client state, render the layout from a client component\n const declaration =\n !wired &&\n file.program.body.find(\n (node): node is ImportDeclaration =>\n node.type === 'ImportDeclaration' &&\n node.importKind !== 'type' &&\n /^fumadocs-ui\\/layouts\\/(docs|notebook|glass|spacious)$/.test(node.source.value) &&\n node.specifiers.length === 1 &&\n node.specifiers[0].local.name === 'DocsLayout',\n );\n if (!declaration) return;\n\n layoutModule = declaration.source.value;\n file.s.overwrite(\n declaration.source.start,\n declaration.source.end,\n `'${clientLayoutImport}'`,\n );\n });\n }\n\n if (layoutModule) {\n await ctx.write(\n path.join(baseDir, config.aliases.componentsDir, 'ai/layout.tsx'),\n clientLayout(layoutModule),\n );\n } else if (!wired) {\n ctx.note(\n 'Pass the AI chat to your docs layout, see https://fumadocs.dev/docs/integrations/llms#ask-ai.',\n );\n }\n ctx.note(`Set ${providers[provider].env} in \\`.env.local\\`.`);\n },\n};\n\n/** a client component rendering the docs layout with the installed chat */\nfunction clientLayout(layoutModule: string) {\n // Glass and Spacious layouts have their own trigger\n const trigger = /\\/(docs|notebook)$/.test(layoutModule);\n\n return `'use client';\nimport { DocsLayout as Layout, type DocsLayoutProps } from '${layoutModule}';\nimport { AIChat, AIChatPanel,${trigger ? ' AIChatTrigger,' : ''} useAIChat } from './search';\n\nexport function DocsLayout(props: DocsLayoutProps) {\n return (\n <AIChat>\n <ChatLayout {...props} />${trigger ? '\\n <AIChatTrigger />' : ''}\n </AIChat>\n );\n}\n\nfunction ChatLayout(props: DocsLayoutProps) {\n const { open, setOpen } = useAIChat();\n\n return <Layout {...props} aiChat={{ open, onOpenChange: setOpen, panel: <AIChatPanel /> }} />;\n}\n`;\n}\n\n/** the installed chat route indexes pages of a static `source`, runtime sources resolve on demand */\nasync function readDynamicSource(ctx: FeatureContext) {\n const { cwd, baseDir } = ctx.project;\n const route = await findSource(cwd, baseDir, 'createSearchServer');\n const edited =\n route !== undefined &&\n (await ctx.source(route, (file) => {\n file.s.replaceAll(\n \"import { source } from '@/lib/source';\",\n \"import { getSource } from '@/lib/source';\",\n );\n file.s.replaceAll('source.getPages()', '(await getSource()).getPages()');\n // every page of a runtime source carries its Markdown\n file.s.replaceAll(\" if (!('getText' in page.data)) return null;\\n\\n\", '');\n file.s.replaceAll(\"await page.data.getText('processed')\", 'page.data.content');\n }));\n\n if (!edited)\n ctx.note(\n 'Read pages from `getSource()` in the chat route, the search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,WAAW,EAAE,CAAC,MAAM,SAAS,YACtC;GACF,IAAI,CAAC,aAAa;GAElB,eAAe,YAAY,OAAO;GAClC,KAAK,EAAE,UACL,YAAY,OAAO,OACnB,YAAY,OAAO,KACnB,IAAI,mBAAmB,EACzB;EACF,CAAC;EAGH,IAAI,cACF,MAAM,IAAI,MACR,KAAK,KAAK,SAAS,OAAO,QAAQ,eAAe,eAAe,GAChE,aAAa,YAAY,CAC3B;OACK,IAAI,CAAC,OACV,IAAI,KACF,+FACF;EAEF,IAAI,KAAK,OAAO,UAAU,SAAS,CAAC,IAAI,oBAAoB;CAC9D;AACF;;AAGA,SAAS,aAAa,cAAsB;CAE1C,MAAM,UAAU,qBAAqB,KAAK,YAAY;CAEtD,OAAO;8DACqD,aAAa;+BAC5C,UAAU,oBAAoB,GAAG;;;;;iCAK/B,UAAU,8BAA8B,GAAG;;;;;;;;;;;AAW5E;;AAGA,eAAe,kBAAkB,KAAqB;CACpD,MAAM,EAAE,KAAK,YAAY,IAAI;CAC7B,MAAM,QAAQ,MAAM,WAAW,KAAK,SAAS,oBAAoB;CAcjE,IAAI,EAZF,UAAU,KAAA,KACT,MAAM,IAAI,OAAO,QAAQ,SAAS;EACjC,KAAK,EAAE,WACL,0CACA,2CACF;EACA,KAAK,EAAE,WAAW,qBAAqB,gCAAgC;EAEvE,KAAK,EAAE,WAAW,yDAAyD,EAAE;EAC7E,KAAK,EAAE,WAAW,wCAAwC,mBAAmB;CAC/E,CAAC,IAGD,IAAI,KACF,sGACF;AACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { t as docs } from "./docs---dy-BSm.js";
|
|
2
|
+
import { t as ai } from "./ai-CvrtLYh1.js";
|
|
3
|
+
import { r as llms } from "./llms-Cge1uefC.js";
|
|
4
|
+
import { t as og } from "./og-DuPd9kNq.js";
|
|
5
|
+
import { t as search } from "./search-B44II4bM.js";
|
|
6
|
+
import { t as mcp } from "./mcp-BVpVFl6G.js";
|
|
7
|
+
import { n as webmcp } from "./webmcp-lY3_RsR3.js";
|
|
8
|
+
import { t as feedback } from "./feedback-7u1-eklc.js";
|
|
9
|
+
import { t as epub } from "./epub-BKvZ4ppz.js";
|
|
10
|
+
import { t as lint } from "./lint-AC2ClOfa.js";
|
|
11
|
+
// src/features/all.ts
|
|
12
|
+
const features = [
|
|
13
|
+
docs,
|
|
14
|
+
ai,
|
|
15
|
+
llms,
|
|
16
|
+
mcp,
|
|
17
|
+
webmcp,
|
|
18
|
+
og,
|
|
19
|
+
search,
|
|
20
|
+
feedback,
|
|
21
|
+
epub,
|
|
22
|
+
lint
|
|
23
|
+
];
|
|
24
|
+
export { features as t };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=all-bAINnjNQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-
|
|
1
|
+
{"version":3,"file":"all-bAINnjNQ.js","names":[],"sources":["../src/features/all.ts"],"sourcesContent":["import type { AnyFeature } from '.';\nimport { docs } from './docs';\nimport { ai } from './ai';\nimport { llms } from './llms';\nimport { og } from './og';\nimport { search } from './search';\nimport { mcp } from './mcp';\nimport { webmcp } from './webmcp';\nimport { feedback } from './feedback';\nimport { epub } from './epub';\nimport { lint } from './lint';\n\nexport const features: AnyFeature[] = [\n docs,\n ai,\n llms,\n mcp,\n webmcp,\n og,\n search,\n feedback,\n epub,\n lint,\n];\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,WAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
package/dist/codemod/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as getDefaultExport, D as parseSourceFile, E as lineIndent, O as prependJsxChildren, S as findJsxElement, T as getStringValue, _ as appendJsxChildren, a as addReactRouterRoute, b as filterElements, c as addNextRewrites, d as wrapNextConfig, f as NodeOfType, g as addJsxAttribute, h as addImport, i as addReactRouterPrerenderArray, l as addVitePlugin, m as addElements, n as enableProcessedMarkdown, o as filterReactRouterPrerenderArray, p as SourceFile, r as addTanstackPrerender, s as filterReactRouterRoute, t as addProxyMatcher, u as getConfigObject, v as createSourceFile, w as getProperty, x as find, y as descendants } from "../index-
|
|
1
|
+
import { C as getDefaultExport, D as parseSourceFile, E as lineIndent, O as prependJsxChildren, S as findJsxElement, T as getStringValue, _ as appendJsxChildren, a as addReactRouterRoute, b as filterElements, c as addNextRewrites, d as wrapNextConfig, f as NodeOfType, g as addJsxAttribute, h as addImport, i as addReactRouterPrerenderArray, l as addVitePlugin, m as addElements, n as enableProcessedMarkdown, o as filterReactRouterPrerenderArray, p as SourceFile, r as addTanstackPrerender, s as filterReactRouterRoute, t as addProxyMatcher, u as getConfigObject, v as createSourceFile, w as getProperty, x as find, y as descendants } from "../index-w9FHKPPs.js";
|
|
2
2
|
export { NodeOfType, SourceFile, addElements, addImport, addJsxAttribute, addNextRewrites, addProxyMatcher, addReactRouterPrerenderArray, addReactRouterRoute, addTanstackPrerender, addVitePlugin, appendJsxChildren, createSourceFile, descendants, enableProcessedMarkdown, filterElements, filterReactRouterPrerenderArray, filterReactRouterRoute, find, findJsxElement, getConfigObject, getDefaultExport, getProperty, getStringValue, lineIndent, parseSourceFile, prependJsxChildren, wrapNextConfig };
|
package/dist/codemod/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { addElements, addImport, addJsxAttribute, addNextRewrites, addProxyMatcher, addReactRouterPrerenderArray, addReactRouterRoute, addTanstackPrerender, addVitePlugin, appendJsxChildren, createSourceFile, descendants, enableProcessedMarkdown, filterElements, filterReactRouterPrerenderArray, filterReactRouterRoute, find, findJsxElement, getConfigObject, getDefaultExport, getProperty, getStringValue, lineIndent, parseSourceFile, prependJsxChildren, wrapNextConfig };
|
|
1
|
+
export { f as addElements, p as addImport, m as addJsxAttribute, c as addNextRewrites, t as addProxyMatcher, i as addReactRouterPrerenderArray, a as addReactRouterRoute, r as addTanstackPrerender, l as addVitePlugin, h as appendJsxChildren, g as createSourceFile, _ as descendants, n as enableProcessedMarkdown, v as filterElements, o as filterReactRouterPrerenderArray, s as filterReactRouterRoute, y as find, b as findJsxElement, u as getConfigObject, x as getDefaultExport, S as getProperty, C as getStringValue, w as lineIndent, T as parseSourceFile, E as prependJsxChildren, d as wrapNextConfig } from "../codemod-Wc9nRqrw.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import { parseSync } from "oxc-parser";
|
|
3
3
|
import MagicString from "magic-string";
|
|
4
|
-
|
|
4
|
+
// src/codemod/shared.ts
|
|
5
5
|
function parseSourceFile(path, code) {
|
|
6
6
|
const { program, errors } = parseSync(path, code);
|
|
7
7
|
if (errors.length > 0) throw new Error(`Failed to parse ${path}: ${errors[0].message}`);
|
|
@@ -130,8 +130,13 @@ function addElements(file, container, items) {
|
|
|
130
130
|
const last = getElements(container).at(-1);
|
|
131
131
|
const multiline = code.slice(container.start, container.end).includes("\n");
|
|
132
132
|
if (!last) {
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
let inner = items.join(", ");
|
|
134
|
+
if (container.type === "ObjectExpression") {
|
|
135
|
+
const indent = lineIndent(code, container.start);
|
|
136
|
+
inner = `${items.map((item) => `\n${indent} ${item.replaceAll("\n", `\n${indent} `)},`).join("")}\n${indent}`;
|
|
137
|
+
}
|
|
138
|
+
if (container.end - container.start === 2) s.appendLeft(container.end - 1, inner);
|
|
139
|
+
else s.overwrite(container.start + 1, container.end - 1, inner);
|
|
135
140
|
return;
|
|
136
141
|
}
|
|
137
142
|
if (!multiline) {
|
|
@@ -167,8 +172,7 @@ function filterElements(file, container, keep) {
|
|
|
167
172
|
else s.remove(lastKept.end, element.end);
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
|
-
|
|
171
|
-
//#region src/codemod/config.ts
|
|
175
|
+
// src/codemod/config.ts
|
|
172
176
|
/**
|
|
173
177
|
* The options object of a config file, e.g. the argument of `defineConfig({ ... })`, or the object in `export default { ... }`
|
|
174
178
|
*/
|
|
@@ -192,26 +196,34 @@ function getConfigObject(file) {
|
|
|
192
196
|
}
|
|
193
197
|
}
|
|
194
198
|
/**
|
|
195
|
-
* Add a plugin call to the `plugins`
|
|
199
|
+
* Add a plugin call to an array of a config file, like the `plugins` of Vite or the `integrations` of Astro, skip if the same plugin is already added.
|
|
196
200
|
*
|
|
197
|
-
* @param path - property path to the
|
|
201
|
+
* @param path - property path to the array, e.g. `['vite', 'plugins']` for Waku, missing objects on it are created
|
|
198
202
|
*/
|
|
199
203
|
function addVitePlugin(file, plugin, path = ["plugins"]) {
|
|
200
204
|
let object = getConfigObject(file);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
let depth = 0;
|
|
206
|
+
for (; object && depth < path.length - 1; depth++) {
|
|
207
|
+
let value = getProperty(object, path[depth])?.value;
|
|
208
|
+
if (!value) break;
|
|
209
|
+
while (value.type === "TSSatisfiesExpression" || value.type === "TSAsExpression") value = value.expression;
|
|
210
|
+
object = value.type === "ObjectExpression" ? value : void 0;
|
|
205
211
|
}
|
|
206
212
|
if (!object) return false;
|
|
207
213
|
const call = plugin.call ?? `${plugin.name}()`;
|
|
208
|
-
const plugins = getProperty(object, path[
|
|
209
|
-
if (!plugins)
|
|
210
|
-
|
|
214
|
+
const plugins = getProperty(object, path[depth])?.value;
|
|
215
|
+
if (!plugins) {
|
|
216
|
+
let item = `[${call}]`;
|
|
217
|
+
for (let i = path.length - 1; i > depth; i--) item = `{ ${path[i]}: ${item} }`;
|
|
218
|
+
addElements(file, object, [`${path[depth]}: ${item}`]);
|
|
219
|
+
} else if (plugins.type === "ArrayExpression") {
|
|
211
220
|
for (const element of plugins.elements) if (element?.type === "CallExpression" && element.callee.type === "Identifier" && element.callee.name === plugin.name) return true;
|
|
212
221
|
addElements(file, plugins, [call]);
|
|
213
222
|
} else return false;
|
|
214
|
-
addImport(file, {
|
|
223
|
+
addImport(file, plugin.default ? {
|
|
224
|
+
from: plugin.from,
|
|
225
|
+
default: plugin.name
|
|
226
|
+
} : {
|
|
215
227
|
from: plugin.from,
|
|
216
228
|
named: [plugin.name]
|
|
217
229
|
});
|
|
@@ -245,8 +257,7 @@ function addNextRewrites(file, rewrites) {
|
|
|
245
257
|
addElements(file, config, [`async rewrites() {\n return [\n${rewrites.map(({ source, destination }) => ` {\n source: '${source}',\n destination: '${destination}',\n },`).join("\n")}\n ];\n}`]);
|
|
246
258
|
return true;
|
|
247
259
|
}
|
|
248
|
-
|
|
249
|
-
//#region src/codemod/react-router.ts
|
|
260
|
+
// src/codemod/react-router.ts
|
|
250
261
|
/**
|
|
251
262
|
* filter items in a specific array initializer in the prerender function
|
|
252
263
|
*/
|
|
@@ -320,8 +331,7 @@ function getPrerenderMethod(file) {
|
|
|
320
331
|
const property = options && getProperty(options, "prerender");
|
|
321
332
|
if (property?.method) return property;
|
|
322
333
|
}
|
|
323
|
-
|
|
324
|
-
//#region src/codemod/tanstack-start.ts
|
|
334
|
+
// src/codemod/tanstack-start.ts
|
|
325
335
|
/**
|
|
326
336
|
* Add path to the `pages` array in tanstack start vite config.
|
|
327
337
|
*
|
|
@@ -355,36 +365,48 @@ function getTanstackStartCall(file) {
|
|
|
355
365
|
if (plugins?.type !== "ArrayExpression") return;
|
|
356
366
|
for (const element of plugins.elements) if (element?.type === "CallExpression" && element.callee.type === "Identifier" && element.callee.name === "tanstackStart") return element;
|
|
357
367
|
}
|
|
358
|
-
|
|
359
|
-
//#region src/codemod/source.ts
|
|
368
|
+
// src/codemod/source.ts
|
|
360
369
|
/**
|
|
361
|
-
* Enable `includeProcessedMarkdown` on the `defineDocs()` call
|
|
370
|
+
* Enable `includeProcessedMarkdown` on the `defineDocs()` call, or on the Fumadocs integration of an Astro config
|
|
362
371
|
*
|
|
363
372
|
* @returns `false` if the call cannot be found
|
|
364
373
|
*/
|
|
365
374
|
function enableProcessedMarkdown(file) {
|
|
366
|
-
|
|
367
|
-
|
|
375
|
+
let integration;
|
|
376
|
+
for (const node of file.program.body) {
|
|
377
|
+
if (node.type !== "ImportDeclaration" || node.source.value !== "@fumadocs/astro") continue;
|
|
378
|
+
for (const spec of node.specifiers) if (spec.type === "ImportDefaultSpecifier") integration = spec.local.name;
|
|
379
|
+
}
|
|
380
|
+
const call = find(file.program, "CallExpression", (node) => node.callee.type === "Identifier" && node.callee.name === (integration ?? "defineDocs"));
|
|
381
|
+
if (!call) return false;
|
|
368
382
|
const flag = "includeProcessedMarkdown: true";
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
383
|
+
const path = integration ? [] : ["docs", "postprocess"];
|
|
384
|
+
const nest = (keys) => {
|
|
385
|
+
let item = flag;
|
|
386
|
+
for (let i = keys.length - 1; i >= 0; i--) item = `${keys[i]}: {\n ${item.replaceAll("\n", "\n ")},\n}`;
|
|
387
|
+
return item;
|
|
388
|
+
};
|
|
389
|
+
let options = call.arguments[0];
|
|
390
|
+
if (!options) {
|
|
391
|
+
file.s.appendLeft(call.end - 1, `{ ${nest(path)} }`);
|
|
372
392
|
return true;
|
|
373
393
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
394
|
+
for (let i = 0; i < path.length; i++) {
|
|
395
|
+
if (options.type !== "ObjectExpression") return false;
|
|
396
|
+
const value = getProperty(options, path[i])?.value;
|
|
397
|
+
if (!value) {
|
|
398
|
+
addElements(file, options, [nest(path.slice(i))]);
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
options = value;
|
|
379
402
|
}
|
|
380
|
-
if (
|
|
381
|
-
const existing = getProperty(
|
|
382
|
-
if (!existing) addElements(file,
|
|
403
|
+
if (options.type !== "ObjectExpression") return false;
|
|
404
|
+
const existing = getProperty(options, "includeProcessedMarkdown")?.value;
|
|
405
|
+
if (!existing) addElements(file, options, [flag]);
|
|
383
406
|
else if (existing.type === "Literal" && existing.value === false) file.s.overwrite(existing.start, existing.end, "true");
|
|
384
407
|
return true;
|
|
385
408
|
}
|
|
386
|
-
|
|
387
|
-
//#region src/codemod/next-proxy.ts
|
|
409
|
+
// src/codemod/next-proxy.ts
|
|
388
410
|
/**
|
|
389
411
|
* Add patterns to the `matcher` of `export const config` in a Next.js proxy (middleware) file
|
|
390
412
|
*/
|
|
@@ -398,7 +420,6 @@ function addProxyMatcher(file, patterns) {
|
|
|
398
420
|
addElements(file, matcher, patterns.filter((pattern) => !existing.has(pattern)).map((pattern) => `'${pattern}'`));
|
|
399
421
|
return true;
|
|
400
422
|
}
|
|
401
|
-
//#endregion
|
|
402
423
|
export { getStringValue as C, prependJsxChildren as E, getProperty as S, parseSourceFile as T, descendants as _, addReactRouterRoute as a, findJsxElement as b, addNextRewrites as c, wrapNextConfig as d, addElements as f, createSourceFile as g, appendJsxChildren as h, addReactRouterPrerenderArray as i, addVitePlugin as l, addJsxAttribute as m, enableProcessedMarkdown as n, filterReactRouterPrerenderArray as o, addImport as p, addTanstackPrerender as r, filterReactRouterRoute as s, addProxyMatcher as t, getConfigObject as u, filterElements as v, lineIndent as w, getDefaultExport as x, find as y };
|
|
403
424
|
|
|
404
|
-
//# sourceMappingURL=codemod-
|
|
425
|
+
//# sourceMappingURL=codemod-Wc9nRqrw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codemod-Wc9nRqrw.js","names":[],"sources":["../src/codemod/shared.ts","../src/codemod/config.ts","../src/codemod/react-router.ts","../src/codemod/tanstack-start.ts","../src/codemod/source.ts","../src/codemod/next-proxy.ts"],"sourcesContent":["import {\n parseSync,\n type ArrayExpression,\n type ExportDefaultDeclaration,\n type ImportDeclaration,\n type JSXElement,\n type JSXOpeningElement,\n type Node,\n type ObjectExpression,\n type ObjectProperty,\n type Program,\n type Span,\n} from 'oxc-parser';\nimport MagicString from 'magic-string';\nimport fs from 'node:fs/promises';\n\nexport type NodeOfType<T extends Node['type']> = Extract<Node, { type: T }>;\n\nexport interface SourceFile {\n path: string;\n /** the original content */\n code: string;\n program: Program;\n /** the edited content */\n s: MagicString;\n save(): Promise<void>;\n}\n\nexport function parseSourceFile(path: string, code: string): SourceFile {\n const { program, errors } = parseSync(path, code);\n if (errors.length > 0) throw new Error(`Failed to parse ${path}: ${errors[0].message}`);\n const s = new MagicString(code);\n\n return {\n path,\n code,\n program,\n s,\n save: () => fs.writeFile(path, s.toString()),\n };\n}\n\nexport async function createSourceFile(path: string): Promise<SourceFile> {\n return parseSourceFile(path, await fs.readFile(path, 'utf-8'));\n}\n\n/** the value of a string literal, or a template literal without expressions */\nexport function getStringValue(node: Node): string | undefined {\n if (node.type === 'Literal' && typeof node.value === 'string') return node.value;\n if (node.type === 'TemplateLiteral' && node.expressions.length === 0)\n return node.quasis[0].value.cooked ?? undefined;\n}\n\nexport function* descendants(node: Node): Generator<Node> {\n for (const key in node) {\n if (key === 'parent') continue;\n const value = (node as unknown as Record<string, unknown>)[key];\n for (const child of Array.isArray(value) ? value : [value]) {\n if (child && typeof child === 'object' && 'type' in child) {\n yield child as Node;\n yield* descendants(child as Node);\n }\n }\n }\n}\n\nexport function find<T extends Node['type']>(\n node: Node,\n type: T,\n predicate?: (node: NodeOfType<T>) => boolean,\n): NodeOfType<T> | undefined {\n for (const child of descendants(node)) {\n if (child.type === type && (!predicate || predicate(child as NodeOfType<T>)))\n return child as NodeOfType<T>;\n }\n}\n\nexport function getDefaultExport(file: SourceFile): ExportDefaultDeclaration | undefined {\n return file.program.body.find((node) => node.type === 'ExportDefaultDeclaration');\n}\n\nexport function findJsxElement(file: SourceFile, tagName: string): JSXElement | undefined {\n return find(file.program, 'JSXElement', ({ openingElement: { name } }) => {\n return name.type === 'JSXIdentifier' && name.name === tagName;\n });\n}\n\nexport function addJsxAttribute(file: SourceFile, element: JSXOpeningElement, attribute: string) {\n const { code, s } = file;\n const anchor = element.attributes.at(-1) ?? element.name;\n const multiline = code.slice(element.start, element.end).includes('\\n');\n s.appendLeft(\n anchor.end,\n `${multiline ? `\\n${lineIndent(code, anchor.start)}` : ' '}${attribute}`,\n );\n}\n\n/**\n * Insert JSX before the children of the element, re-indenting the children\n */\nexport function prependJsxChildren(file: SourceFile, element: JSXElement, jsx: string) {\n const { closingElement, openingElement } = element;\n if (!closingElement) return;\n const { code, s } = file;\n const indent = lineIndent(code, element.start);\n const prior = dedent(code.slice(openingElement.end, closingElement.start));\n const body = `${jsx}\\n\\n${prior}`.replaceAll(/^(?=.)/gm, `${indent} `);\n s.overwrite(openingElement.end, closingElement.start, `\\n${body}\\n${indent}`);\n}\n\n/**\n * Insert JSX after the children of the element\n */\nexport function appendJsxChildren(file: SourceFile, element: JSXElement, jsx: string) {\n const { closingElement } = element;\n if (!closingElement) return;\n const { code, s } = file;\n const indent = lineIndent(code, element.start);\n const body = jsx.replaceAll(/^(?=.)/gm, `${indent} `);\n // children end with the indentation of the closing tag\n s.appendLeft(closingElement.start - indent.length, `${body}\\n`);\n}\n\n/** trim, and remove the common indentation */\nfunction dedent(text: string): string {\n const lines = text.trim().split('\\n');\n let indent: string | undefined;\n for (const line of lines.slice(1)) {\n if (line.trim().length === 0) continue;\n const current = /^[ \\t]*/.exec(line)![0];\n if (indent === undefined || current.length < indent.length) indent = current;\n }\n if (!indent) return lines.join('\\n');\n return lines\n .map((line, i) => (i > 0 && line.startsWith(indent) ? line.slice(indent.length) : line))\n .join('\\n');\n}\n\nexport function getProperty(object: ObjectExpression, name: string): ObjectProperty | undefined {\n for (const property of object.properties) {\n if (property.type !== 'Property') continue;\n const { key } = property;\n if (\n key.type === 'Identifier' ? key.name === name : key.type === 'Literal' && key.value === name\n )\n return property;\n }\n}\n\n/** indentation of the line containing `index` */\nexport function lineIndent(code: string, index: number): string {\n const start = code.lastIndexOf('\\n', index - 1) + 1;\n return /^[ \\t]*/.exec(code.slice(start, index))![0];\n}\n\nexport function addImport(\n file: SourceFile,\n declaration: { from: string; default?: string; named?: string[] },\n) {\n const { s, program } = file;\n const existing = program.body.find(\n (node): node is ImportDeclaration =>\n node.type === 'ImportDeclaration' &&\n node.importKind !== 'type' &&\n node.source.value === declaration.from,\n );\n\n if (existing && !declaration.default && declaration.named) {\n const imported = new Set<string>();\n let last: Span | undefined;\n for (const spec of existing.specifiers) {\n if (spec.type !== 'ImportSpecifier') continue;\n imported.add(spec.local.name);\n last = spec;\n }\n\n const missing = declaration.named.filter((name) => !imported.has(name));\n if (last && missing.length > 0) s.appendLeft(last.end, `, ${missing.join(', ')}`);\n if (last) return;\n }\n\n const parts: string[] = [];\n if (declaration.default) parts.push(declaration.default);\n if (declaration.named?.length) parts.push(`{ ${declaration.named.join(', ')} }`);\n const statement = `import ${parts.join(', ')} from '${declaration.from}';`;\n\n const last = program.body.findLast((node) => node.type === 'ImportDeclaration');\n if (last) s.appendLeft(last.end, `\\n${statement}`);\n else s.prepend(`${statement}\\n\\n`);\n}\n\ntype Container = ArrayExpression | ObjectExpression;\ntype ElementOf<C extends Container> = C extends ArrayExpression\n ? NonNullable<ArrayExpression['elements'][number]>\n : ObjectExpression['properties'][number];\n\nfunction getElements<C extends Container>(container: C): ElementOf<C>[] {\n const elements = container.type === 'ArrayExpression' ? container.elements : container.properties;\n return elements.filter((element) => element !== null) as ElementOf<C>[];\n}\n\n/**\n * Append items to an array or object literal, following its formatting\n */\nexport function addElements(file: SourceFile, container: Container, items: string[]) {\n if (items.length === 0) return;\n const { code, s } = file;\n const last = getElements(container).at(-1);\n const multiline = code.slice(container.start, container.end).includes('\\n');\n\n if (!last) {\n let inner = items.join(', ');\n // e.g. `defineConfig({})`, properties go on their own lines\n if (container.type === 'ObjectExpression') {\n const indent = lineIndent(code, container.start);\n inner = `${items.map((item) => `\\n${indent} ${item.replaceAll('\\n', `\\n${indent} `)},`).join('')}\\n${indent}`;\n }\n // `[]` is a zero-length range which cannot be overwritten\n if (container.end - container.start === 2) s.appendLeft(container.end - 1, inner);\n else s.overwrite(container.start + 1, container.end - 1, inner);\n return;\n }\n\n if (!multiline) {\n s.appendLeft(last.end, items.map((item) => `, ${item}`).join(''));\n return;\n }\n\n const indent = lineIndent(code, last.start);\n s.appendLeft(\n last.end,\n items.map((item) => `,\\n${indent}${item.replaceAll('\\n', `\\n${indent}`)}`).join(''),\n );\n}\n\n/**\n * Remove the items of an array or object literal that don't pass the filter\n */\nexport function filterElements<C extends Container>(\n file: SourceFile,\n container: C,\n keep: (element: ElementOf<C>) => boolean,\n) {\n const { s } = file;\n const elements = getElements(container);\n const keeps = elements.map(keep);\n let kept = 0;\n for (const keep of keeps) if (keep) kept++;\n if (kept === elements.length) return;\n if (kept === 0) {\n s.remove(container.start + 1, container.end - 1);\n return;\n }\n\n let lastKept: ElementOf<C> | undefined;\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n if (keeps[i]) {\n lastKept = element;\n continue;\n }\n const next = elements[i + 1];\n // remove along with the separator: up to the next item, or from the last kept item\n if (next) s.remove(element.start, next.start);\n else s.remove(lastKept!.end, element.end);\n }\n}\n","import type { Expression, ObjectExpression } from 'oxc-parser';\nimport {\n addElements,\n addImport,\n find,\n getDefaultExport,\n getProperty,\n type SourceFile,\n} from './shared';\n\n/**\n * The options object of a config file, e.g. the argument of `defineConfig({ ... })`, or the object in `export default { ... }`\n */\nexport function getConfigObject(file: SourceFile): ObjectExpression | undefined {\n const exported = getDefaultExport(file);\n if (!exported) return;\n let expr = exported.declaration as Expression;\n\n while (true) {\n if (expr.type === 'ObjectExpression') return expr;\n if (expr.type === 'TSSatisfiesExpression' || expr.type === 'TSAsExpression') {\n expr = expr.expression;\n } else if (expr.type === 'CallExpression' && expr.arguments.length > 0) {\n const arg = expr.arguments[0];\n if (arg.type === 'SpreadElement') return;\n expr = arg;\n } else if (expr.type === 'Identifier') {\n const { name } = expr;\n const init = find(\n file.program,\n 'VariableDeclarator',\n (node) => node.id.type === 'Identifier' && node.id.name === name,\n )?.init;\n if (!init) return;\n expr = init;\n } else {\n return;\n }\n }\n}\n\n/**\n * Add a plugin call to an array of a config file, like the `plugins` of Vite or the `integrations` of Astro, skip if the same plugin is already added.\n *\n * @param path - property path to the array, e.g. `['vite', 'plugins']` for Waku, missing objects on it are created\n */\nexport function addVitePlugin(\n file: SourceFile,\n plugin: {\n name: string;\n from: string;\n call?: string;\n /** imported as the default export */\n default?: boolean;\n },\n path: string[] = ['plugins'],\n): boolean {\n let object = getConfigObject(file);\n let depth = 0;\n for (; object && depth < path.length - 1; depth++) {\n let value = getProperty(object, path[depth])?.value;\n if (!value) break;\n // e.g. `vite: { ... } satisfies UserConfig as Config['vite']`\n while (value.type === 'TSSatisfiesExpression' || value.type === 'TSAsExpression')\n value = value.expression;\n object = value.type === 'ObjectExpression' ? value : undefined;\n }\n if (!object) return false;\n\n const call = plugin.call ?? `${plugin.name}()`;\n const plugins = getProperty(object, path[depth])?.value;\n if (!plugins) {\n // e.g. `vite: { plugins: [tailwindcss()] }`\n let item = `[${call}]`;\n for (let i = path.length - 1; i > depth; i--) item = `{ ${path[i]}: ${item} }`;\n addElements(file, object, [`${path[depth]}: ${item}`]);\n } else if (plugins.type === 'ArrayExpression') {\n for (const element of plugins.elements) {\n if (\n element?.type === 'CallExpression' &&\n element.callee.type === 'Identifier' &&\n element.callee.name === plugin.name\n )\n return true;\n }\n addElements(file, plugins, [call]);\n } else {\n return false;\n }\n\n addImport(\n file,\n plugin.default\n ? { from: plugin.from, default: plugin.name }\n : { from: plugin.from, named: [plugin.name] },\n );\n return true;\n}\n\n/**\n * Wrap the default export of `next.config.*` with `createMDX()`\n */\nexport function wrapNextConfig(file: SourceFile): boolean {\n if (file.code.includes('fumadocs-mdx/next')) return true;\n const exported = getDefaultExport(file);\n if (!exported) return false;\n const { declaration, start } = exported;\n if (declaration.type === 'FunctionDeclaration' || declaration.type === 'ClassDeclaration')\n return false;\n\n file.s.prependLeft(start, `const withMDX = createMDX();\\n\\n`);\n file.s.appendLeft(declaration.start, 'withMDX(');\n file.s.appendRight(declaration.end, ')');\n addImport(file, { from: 'fumadocs-mdx/next', named: ['createMDX'] });\n return true;\n}\n\n/**\n * Add rewrites to a Next.js config, skip if `rewrites` is already defined\n */\nexport function addNextRewrites(\n file: SourceFile,\n rewrites: { source: string; destination: string }[],\n): boolean {\n const config = getConfigObject(file);\n if (!config) return false;\n if (getProperty(config, 'rewrites')) return false;\n\n const items = rewrites.map(\n ({ source, destination }) =>\n ` {\\n source: '${source}',\\n destination: '${destination}',\\n },`,\n );\n addElements(file, config, [`async rewrites() {\\n return [\\n${items.join('\\n')}\\n ];\\n}`]);\n return true;\n}\n","import type { ArrayExpression, ObjectProperty } from 'oxc-parser';\nimport {\n addElements,\n filterElements,\n find,\n getStringValue,\n getDefaultExport,\n getProperty,\n type SourceFile,\n} from '@/codemod/shared';\n\n/**\n * filter items in a specific array initializer in the prerender function\n */\nexport function filterReactRouterPrerenderArray(\n file: SourceFile,\n array: 'paths' | 'excluded',\n filter: (item: string) => boolean,\n) {\n const initializer = getPrerenderArray(file, array);\n if (!initializer) return;\n\n filterElements(file, initializer, (element) => {\n const value = getStringValue(element);\n return value === undefined || filter(value);\n });\n}\n\n/**\n * add items to a specific array initializer in the prerender function, skip existing ones\n */\nexport function addReactRouterPrerenderArray(\n file: SourceFile,\n array: 'paths' | 'excluded',\n items: string[],\n) {\n const initializer = getPrerenderArray(file, array);\n if (!initializer) return;\n\n const existing = new Set<string>();\n for (const element of initializer.elements) {\n const value = element ? getStringValue(element) : undefined;\n if (value !== undefined) existing.add(value);\n }\n addElements(\n file,\n initializer,\n items.filter((item) => !existing.has(item)).map((item) => `'${item}'`),\n );\n}\n\nfunction getPrerenderArray(file: SourceFile, array: string): ArrayExpression | undefined {\n const method = getPrerenderMethod(file);\n if (!method) return;\n\n const initializer = find(\n method.value,\n 'VariableDeclarator',\n (item) => item.id.type === 'Identifier' && item.id.name === array,\n )?.init;\n if (initializer?.type === 'ArrayExpression') return initializer;\n}\n\n/**\n * Add new routes to route config, an item can be raw code (e.g. `layout(...)`)\n */\nexport function addReactRouterRoute(\n file: SourceFile,\n routes: ({ path: string; entry: string } | string)[],\n): boolean {\n return modifyReactRouterRoutes(file, (arr) => {\n addElements(\n file,\n arr,\n routes.map((item) =>\n typeof item === 'string' ? item : `route('${item.path}', '${item.entry}')`,\n ),\n );\n });\n}\n\n/**\n * Remove routes from route config (root level only)\n */\nexport function filterReactRouterRoute(\n file: SourceFile,\n filter: (item: { path: string; entry: string }) => boolean,\n) {\n modifyReactRouterRoutes(file, (arr) => {\n filterElements(file, arr, (element) => {\n if (element.type !== 'CallExpression') return true;\n const { callee, arguments: args } = element;\n if (callee.type !== 'Identifier' || callee.name !== 'route') return true;\n\n const path = getStringValue(args[0]);\n const entry = getStringValue(args[1]);\n return path === undefined || entry === undefined || filter({ path, entry });\n });\n });\n}\n\n/** @returns `false` if the route config isn't an array literal (e.g. file-based routes) */\nfunction modifyReactRouterRoutes(file: SourceFile, mod: (array: ArrayExpression) => void): boolean {\n const exported = getDefaultExport(file);\n const initializer = exported && find(exported, 'ArrayExpression');\n if (!initializer) return false;\n mod(initializer);\n return true;\n}\n\n/**\n * Find the prerender method from the config\n */\nfunction getPrerenderMethod(file: SourceFile): ObjectProperty | undefined {\n const exported = getDefaultExport(file);\n const options = exported && find(exported, 'ObjectExpression');\n const property = options && getProperty(options, 'prerender');\n if (property?.method) return property;\n}\n","import type { CallExpression } from 'oxc-parser';\nimport {\n addElements,\n find,\n getStringValue,\n getDefaultExport,\n getProperty,\n type SourceFile,\n} from '@/codemod/shared';\n\n/**\n * Add path to the `pages` array in tanstack start vite config.\n *\n * If the `pages` property doesn't exist, create one.\n */\nexport function addTanstackPrerender(file: SourceFile, paths: string[]) {\n const options = getTanstackStartCall(file)?.arguments[0];\n if (options?.type !== 'ObjectExpression') return;\n\n const toItem = (path: string) => `{ path: '${path}' }`;\n const pages = getProperty(options, 'pages')?.value;\n if (!pages) {\n addElements(file, options, [\n `pages: [\\n${paths.map((path) => ` ${toItem(path)}`).join(',\\n')}\\n]`,\n ]);\n return;\n }\n if (pages.type !== 'ArrayExpression') return;\n\n const existingPaths = new Set<string>();\n for (const element of pages.elements) {\n const value = element?.type === 'ObjectExpression' && getProperty(element, 'path')?.value;\n const path = value ? getStringValue(value) : undefined;\n if (path !== undefined) existingPaths.add(path);\n }\n addElements(file, pages, paths.filter((path) => !existingPaths.has(path)).map(toItem));\n}\n\n/**\n * Find the tanstackStart call expression\n */\nfunction getTanstackStartCall(file: SourceFile): CallExpression | undefined {\n const exported = getDefaultExport(file);\n const options = exported && find(exported, 'ObjectExpression');\n const plugins = options && getProperty(options, 'plugins')?.value;\n if (plugins?.type !== 'ArrayExpression') return;\n\n for (const element of plugins.elements) {\n if (\n element?.type === 'CallExpression' &&\n element.callee.type === 'Identifier' &&\n element.callee.name === 'tanstackStart'\n )\n return element;\n }\n}\n","import { addElements, find, getProperty, type SourceFile } from './shared';\n\n/**\n * Enable `includeProcessedMarkdown` on the `defineDocs()` call, or on the Fumadocs integration of an Astro config\n *\n * @returns `false` if the call cannot be found\n */\nexport function enableProcessedMarkdown(file: SourceFile): boolean {\n let integration: string | undefined;\n for (const node of file.program.body) {\n if (node.type !== 'ImportDeclaration' || node.source.value !== '@fumadocs/astro') continue;\n for (const spec of node.specifiers) {\n if (spec.type === 'ImportDefaultSpecifier') integration = spec.local.name;\n }\n }\n const call = find(\n file.program,\n 'CallExpression',\n (node) =>\n node.callee.type === 'Identifier' && node.callee.name === (integration ?? 'defineDocs'),\n );\n if (!call) return false;\n const flag = 'includeProcessedMarkdown: true';\n // Fumadocs MDX takes it in `docs.postprocess`\n const path = integration ? [] : ['docs', 'postprocess'];\n const nest = (keys: string[]) => {\n let item = flag;\n for (let i = keys.length - 1; i >= 0; i--)\n item = `${keys[i]}: {\\n ${item.replaceAll('\\n', '\\n ')},\\n}`;\n return item;\n };\n\n let options = call.arguments[0];\n if (!options) {\n file.s.appendLeft(call.end - 1, `{ ${nest(path)} }`);\n return true;\n }\n for (let i = 0; i < path.length; i++) {\n if (options.type !== 'ObjectExpression') return false;\n const value = getProperty(options, path[i])?.value;\n if (!value) {\n addElements(file, options, [nest(path.slice(i))]);\n return true;\n }\n options = value;\n }\n if (options.type !== 'ObjectExpression') return false;\n\n const existing = getProperty(options, 'includeProcessedMarkdown')?.value;\n if (!existing) addElements(file, options, [flag]);\n else if (existing.type === 'Literal' && existing.value === false)\n file.s.overwrite(existing.start, existing.end, 'true');\n return true;\n}\n","import { addElements, find, getProperty, type SourceFile } from './shared';\n\n/**\n * Add patterns to the `matcher` of `export const config` in a Next.js proxy (middleware) file\n */\nexport function addProxyMatcher(file: SourceFile, patterns: string[]): boolean {\n const config = find(\n file.program,\n 'VariableDeclarator',\n (node) => node.id.type === 'Identifier' && node.id.name === 'config',\n )?.init;\n if (config?.type !== 'ObjectExpression') return false;\n const matcher = getProperty(config, 'matcher')?.value;\n if (matcher?.type !== 'ArrayExpression') return false;\n\n const existing = new Set<string>();\n for (const element of matcher.elements) {\n if (element?.type === 'Literal' && typeof element.value === 'string')\n existing.add(element.value);\n }\n addElements(\n file,\n matcher,\n patterns.filter((pattern) => !existing.has(pattern)).map((pattern) => `'${pattern}'`),\n );\n return true;\n}\n"],"mappings":";;;;AA4BA,SAAgB,gBAAgB,MAAc,MAA0B;CACtE,MAAM,EAAE,SAAS,WAAW,UAAU,MAAM,IAAI;CAChD,IAAI,OAAO,SAAS,GAAG,MAAM,IAAI,MAAM,mBAAmB,KAAK,IAAI,OAAO,EAAE,CAAC,SAAS;CACtF,MAAM,IAAI,IAAI,YAAY,IAAI;CAE9B,OAAO;EACL;EACA;EACA;EACA;EACA,YAAY,GAAG,UAAU,MAAM,EAAE,SAAS,CAAC;CAC7C;AACF;AAEA,eAAsB,iBAAiB,MAAmC;CACxE,OAAO,gBAAgB,MAAM,MAAM,GAAG,SAAS,MAAM,OAAO,CAAC;AAC/D;;AAGA,SAAgB,eAAe,MAAgC;CAC7D,IAAI,KAAK,SAAS,aAAa,OAAO,KAAK,UAAU,UAAU,OAAO,KAAK;CAC3E,IAAI,KAAK,SAAS,qBAAqB,KAAK,YAAY,WAAW,GACjE,OAAO,KAAK,OAAO,EAAE,CAAC,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S,QAAQ,YAAY,CAAC,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,YAAY,IAAI,QAAQ,EAAE,CACtF;CACA,OAAO;AACT"}
|
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { detectFramework } from "fuma-cli/detect";
|
|
6
|
-
|
|
6
|
+
// src/config.ts
|
|
7
7
|
const frameworks = [
|
|
8
8
|
"next",
|
|
9
9
|
"astro",
|
|
@@ -14,6 +14,12 @@ const frameworks = [
|
|
|
14
14
|
function isSupportedFramework(v) {
|
|
15
15
|
return frameworks.includes(v);
|
|
16
16
|
}
|
|
17
|
+
/** `fuma-cli` doesn't detect Astro */
|
|
18
|
+
async function detect(cwd) {
|
|
19
|
+
if ((await fs.readdir(cwd).catch(() => [])).some((file) => file.startsWith("astro.config."))) return "astro";
|
|
20
|
+
const framework = await detectFramework(cwd);
|
|
21
|
+
return isSupportedFramework(framework) ? framework : "next";
|
|
22
|
+
}
|
|
17
23
|
/** directories from shadcn's `components.json`, so components are installed at the same place */
|
|
18
24
|
async function readShadcnAliases(cwd) {
|
|
19
25
|
const content = await fs.readFile(path.join(cwd, "components.json"), "utf-8").catch(() => null);
|
|
@@ -38,8 +44,7 @@ async function createConfigSchema(cwd = process.cwd()) {
|
|
|
38
44
|
libDir: shadcn.lib ?? "./lib",
|
|
39
45
|
utils: shadcn.utils
|
|
40
46
|
};
|
|
41
|
-
|
|
42
|
-
if (!isSupportedFramework(framework)) framework = "next";
|
|
47
|
+
const framework = await detect(cwd);
|
|
43
48
|
return z.object({
|
|
44
49
|
$schema: z.string().default("node_modules/@fumadocs/cli/dist/schema.json").optional(),
|
|
45
50
|
aliases: z.object({
|
|
@@ -56,10 +61,11 @@ async function createConfigSchema(cwd = process.cwd()) {
|
|
|
56
61
|
const routes = {
|
|
57
62
|
next: "app",
|
|
58
63
|
waku: "pages",
|
|
59
|
-
"tanstack-start": "routes"
|
|
60
|
-
|
|
64
|
+
"tanstack-start": "routes",
|
|
65
|
+
astro: "pages"
|
|
66
|
+
}[framework];
|
|
61
67
|
if (existsSync(path.resolve(cwd, "src", routes))) return "src";
|
|
62
|
-
if (
|
|
68
|
+
if (existsSync(path.resolve(cwd, routes))) return "";
|
|
63
69
|
return existsSync(path.resolve(cwd, "src")) ? "src" : "";
|
|
64
70
|
}),
|
|
65
71
|
uiLibrary: z.enum(["radix-ui", "base-ui"]).default("base-ui"),
|
|
@@ -91,7 +97,6 @@ async function initConfig(file = "./cli.json") {
|
|
|
91
97
|
async function getDefaultConfig(cwd) {
|
|
92
98
|
return (await createConfigSchema(cwd)).parse({});
|
|
93
99
|
}
|
|
94
|
-
//#endregion
|
|
95
100
|
export { initConfig as i, createOrLoadConfig as n, getDefaultConfig as r, createConfigSchema as t };
|
|
96
101
|
|
|
97
|
-
//# sourceMappingURL=config-
|
|
102
|
+
//# sourceMappingURL=config-BpiQyqBs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-BpiQyqBs.js","names":[],"sources":["../src/config.ts"],"sourcesContent":["import fs from 'node:fs/promises';\nimport { z } from 'zod';\nimport { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { detectFramework } from 'fuma-cli/detect';\n\n// self-contained, the tsdown config imports this file\nconst frameworks = ['next', 'astro', 'waku', 'react-router', 'tanstack-start'] as const;\nexport type Framework = (typeof frameworks)[number];\n\nfunction isSupportedFramework(v: string): v is Framework {\n return frameworks.includes(v as Framework);\n}\n\n/** `fuma-cli` doesn't detect Astro */\nasync function detect(cwd: string): Promise<Framework> {\n const files = await fs.readdir(cwd).catch(() => []);\n if (files.some((file) => file.startsWith('astro.config.'))) return 'astro';\n const framework = await detectFramework(cwd);\n return isSupportedFramework(framework) ? framework : 'next';\n}\n\n/** directories from shadcn's `components.json`, so components are installed at the same place */\nasync function readShadcnAliases(cwd: string): Promise<Record<string, string>> {\n const content = await fs.readFile(path.join(cwd, 'components.json'), 'utf-8').catch(() => null);\n if (!content) return {};\n const out: Record<string, string> = {};\n let aliases: Record<string, unknown> = {};\n try {\n aliases = JSON.parse(content).aliases ?? {};\n } catch {\n return out;\n }\n for (const [key, alias] of Object.entries(aliases)) {\n // e.g. `@/components/ui` -> `./components/ui`\n if (typeof alias === 'string') out[key] = `.${alias.slice(alias.indexOf('/'))}`;\n }\n return out;\n}\n\nexport async function createConfigSchema(cwd = process.cwd()) {\n const shadcn = await readShadcnAliases(cwd);\n const defaultAliases = {\n uiDir: shadcn.ui ?? './components/ui',\n componentsDir: shadcn.components ?? './components',\n layoutDir: './layouts',\n cssDir: './styles',\n libDir: shadcn.lib ?? './lib',\n utils: shadcn.utils,\n };\n\n const framework = await detect(cwd);\n\n return z.object({\n $schema: z.string().default('node_modules/@fumadocs/cli/dist/schema.json').optional(),\n aliases: z\n .object({\n uiDir: z.string().default(defaultAliases.uiDir),\n componentsDir: z.string().default(defaultAliases.componentsDir),\n layoutDir: z.string().default(defaultAliases.layoutDir),\n cssDir: z.string().default(defaultAliases.cssDir),\n libDir: z.string().default(defaultAliases.libDir),\n /** module exporting `cn`, installed components import it instead of `lib/cn.ts` */\n utils: shadcn.utils ? z.string().default(shadcn.utils) : z.string().optional(),\n })\n .default(defaultAliases),\n\n baseDir: z.string().default(() => {\n if (framework === 'react-router') return 'app';\n // the routes directory of the framework decides whether app code lives in `src`\n const routes = { next: 'app', waku: 'pages', 'tanstack-start': 'routes', astro: 'pages' }[\n framework\n ];\n if (existsSync(path.resolve(cwd, 'src', routes))) return 'src';\n if (existsSync(path.resolve(cwd, routes))) return '';\n return existsSync(path.resolve(cwd, 'src')) ? 'src' : '';\n }),\n uiLibrary: z.enum(['radix-ui', 'base-ui']).default('base-ui'),\n framework: z.literal(frameworks).default(framework),\n\n commands: z\n .object({\n /**\n * command to format output code automatically\n */\n format: z.string().optional(),\n })\n .default({}),\n });\n}\n\ntype ConfigSchema = Awaited<ReturnType<typeof createConfigSchema>>;\n\nexport type ConfigInput = z.input<ConfigSchema>;\nexport type LoadedConfig = z.output<ConfigSchema>;\n\nexport async function createOrLoadConfig(file = './cli.json'): Promise<LoadedConfig> {\n const inited = await initConfig(file);\n if (inited) return inited;\n\n const content = await fs.readFile(file, 'utf-8');\n const configSchema = await createConfigSchema();\n\n return configSchema.parse(JSON.parse(content));\n}\n\n/**\n * Write new config, skip if a config already exists\n *\n * @returns the created config, `undefined` if not created\n */\nexport async function initConfig(file = './cli.json'): Promise<LoadedConfig | undefined> {\n if (\n await fs\n .stat(file)\n .then(() => true)\n .catch(() => false)\n ) {\n return;\n }\n\n const defaultConfig = await getDefaultConfig();\n await fs.writeFile(file, JSON.stringify(defaultConfig, null, 2));\n return defaultConfig;\n}\n\nexport async function getDefaultConfig(cwd?: string) {\n const schema = await createConfigSchema(cwd);\n return schema.parse({} satisfies ConfigInput);\n}\n"],"mappings":";;;;;;AAOA,MAAM,aAAa;CAAC;CAAQ;CAAS;CAAQ;CAAgB;AAAgB;AAG7E,SAAS,qBAAqB,GAA2B;CACvD,OAAO,WAAW,SAAS,CAAc;AAC3C;;AAGA,eAAe,OAAO,KAAiC;CAErD,KAAI,MADgB,GAAG,QAAQ,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,EAAA,CACxC,MAAM,SAAS,KAAK,WAAW,eAAe,CAAC,GAAG,OAAO;CACnE,MAAM,YAAY,MAAM,gBAAgB,GAAG;CAC3C,OAAO,qBAAqB,SAAS,IAAI,YAAY;AACvD;;AAGA,eAAe,kBAAkB,KAA8C;CAC7E,MAAM,UAAU,MAAM,GAAG,SAAS,KAAK,KAAK,KAAK,iBAAiB,GAAG,OAAO,CAAC,CAAC,YAAY,IAAI;CAC9F,IAAI,CAAC,SAAS,OAAO,CAAC;CACtB,MAAM,MAA8B,CAAC;CACrC,IAAI,UAAmC,CAAC;CACxC,IAAI;EACF,UAAU,KAAK,MAAM,OAAO,CAAC,CAAC,WAAW,CAAC;CAC5C,QAAQ;EACN,OAAO;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MAAM,CAAC,GAAG,OAAO;GAClD,OAAO,WAAW,KAAK,QAAQ,KAAK,KAAK,CAAC,IAAI,QAAQ;EACxD,CAAC;EACD,WAAW,EAAE,KAAK,CAAC,YAAY,SAAS,CAAC,CAAC,CAAC,QAAQ,SAAS;EAC5D,WAAW,EAAE,QAAQ,UAAU,CAAC,CAAC,QAAQ,SAAS;EAElD,UAAU,EACP,OAAO;;;;AAIN,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,EAC9B,CAAC,CAAC,CACD,QAAQ,CAAC,CAAC;CACf,CAAC;AACH;AAOA,eAAsB,mBAAmB,OAAO,cAAqC;CACnF,MAAM,SAAS,MAAM,WAAW,IAAI;CACpC,IAAI,QAAQ,OAAO;CAEnB,MAAM,UAAU,MAAM,GAAG,SAAS,MAAM,OAAO;CAG/C,QAAO,MAFoB,mBAAmB,EAAA,CAE1B,MAAM,KAAK,MAAM,OAAO,CAAC;AAC/C;;;;;;AAOA,eAAsB,WAAW,OAAO,cAAiD;CACvF,IACE,MAAM,GACH,KAAK,IAAI,CAAC,CACV,WAAW,IAAI,CAAC,CAChB,YAAY,KAAK,GAEpB;CAGF,MAAM,gBAAgB,MAAM,iBAAiB;CAC7C,MAAM,GAAG,UAAU,MAAM,KAAK,UAAU,eAAe,MAAM,CAAC,CAAC;CAC/D,OAAO;AACT;AAEA,eAAsB,iBAAiB,KAAc;CAEnD,QAAO,MADc,mBAAmB,GAAG,EAAA,CAC7B,MAAM,CAAC,CAAuB;AAC9C"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/config.d.ts
|
|
3
2
|
declare const frameworks: readonly ['next', 'astro', 'waku', 'react-router', 'tanstack-start'];
|
|
4
3
|
type Framework = (typeof frameworks)[number];
|
|
5
4
|
declare function createConfigSchema(cwd?: string): Promise<z.ZodObject<{
|
|
@@ -49,6 +48,5 @@ declare function getDefaultConfig(cwd?: string): Promise<{
|
|
|
49
48
|
format?: string | undefined;
|
|
50
49
|
};
|
|
51
50
|
}>;
|
|
52
|
-
//#endregion
|
|
53
51
|
export { createOrLoadConfig as a, createConfigSchema as i, Framework as n, getDefaultConfig as o, LoadedConfig as r, initConfig as s, ConfigInput as t };
|
|
54
|
-
//# sourceMappingURL=config-
|
|
52
|
+
//# sourceMappingURL=config-Z-4b_Y_C.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-Z-4b_Y_C.d.ts","names":[],"sources":["../src/config.ts"],"mappings":";cAOM;KACM,oBAAoB;iBAgCV,mBAAmB,eAAmB,QAAA,EAAA;;;;;;;;;;;;;;;;;;;GAiD3D,EAAA,KAAA;KAEI,eAAe,QAAQ,kBAAkB;KAElC,cAAc,EAAE,MAAM;KACtB,eAAe,EAAE,OAAO;iBAEd,mBAAmB,gBAAsB,QAAQ;;;;;;iBAejD,WAAW,gBAAsB,QAAQ;iBAezC,iBAAiB,eAAY"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createOrLoadConfig, i as createConfigSchema, n as Framework, o as getDefaultConfig, r as LoadedConfig, s as initConfig, t as ConfigInput } from "./config-
|
|
1
|
+
import { a as createOrLoadConfig, i as createConfigSchema, n as Framework, o as getDefaultConfig, r as LoadedConfig, s as initConfig, t as ConfigInput } from "./config-Z-4b_Y_C.js";
|
|
2
2
|
export { ConfigInput, Framework, LoadedConfig, createConfigSchema, createOrLoadConfig, getDefaultConfig, initConfig };
|
package/dist/config.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createConfigSchema, createOrLoadConfig, getDefaultConfig, initConfig };
|
|
1
|
+
export { t as createConfigSchema, n as createOrLoadConfig, r as getDefaultConfig, i as initConfig } from "./config-BpiQyqBs.js";
|