diff --git a/docs/features/minification.md b/docs/advanced/minification.md similarity index 97% rename from docs/features/minification.md rename to docs/advanced/minification.md index 9873ec3ed..e9897d7ce 100644 --- a/docs/features/minification.md +++ b/docs/advanced/minification.md @@ -17,3 +17,5 @@ If minify is enabled: :::note Farm use swc minifier under the hood, all options of swc minifier can be used in Farm. ::: + +## minify options \ No newline at end of file diff --git a/docs/features/partial-bundling.md b/docs/advanced/partial-bundling.md similarity index 100% rename from docs/features/partial-bundling.md rename to docs/advanced/partial-bundling.md diff --git a/docs/features/persistent-cache.md b/docs/advanced/persistent-cache.md similarity index 100% rename from docs/features/persistent-cache.md rename to docs/advanced/persistent-cache.md diff --git a/docs/features/polyfill.md b/docs/advanced/polyfill.md similarity index 100% rename from docs/features/polyfill.md rename to docs/advanced/polyfill.md diff --git a/docs/advanced/ssr.md b/docs/advanced/ssr.md new file mode 100644 index 000000000..245645fff --- /dev/null +++ b/docs/advanced/ssr.md @@ -0,0 +1 @@ +# Server-Side Rendering (SSR) \ No newline at end of file diff --git a/docs/features/tree-shake.md b/docs/advanced/tree-shake.md similarity index 100% rename from docs/features/tree-shake.md rename to docs/advanced/tree-shake.md diff --git a/docs/community.md b/docs/community.md new file mode 100644 index 000000000..12f796fc1 --- /dev/null +++ b/docs/community.md @@ -0,0 +1 @@ +# Community \ No newline at end of file diff --git a/docs/comparisons.md b/docs/comparisons.md new file mode 100644 index 000000000..17be2d42d --- /dev/null +++ b/docs/comparisons.md @@ -0,0 +1 @@ +# Comparisons \ No newline at end of file diff --git a/docs/concepts.md b/docs/concepts.md index d3b7f139f..3c4082332 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -1,8 +1,6 @@ # Concepts -Farm is a build tool to transform and bundle your `input` to `deployable resources`. Farm will search modules start from the input, then construct a module graph and bundle these modules into several `resources` +Farm is a build tool to transform and bundle your `input` to `deployable resources`. Farm will search modules start from the input, then construct a module graph and bundle these modules into several `resources`. -Main Concepts: -* **Input** -* **Output** -* **Plugins** -* **Partial Bundling** \ No newline at end of file +figure1: Input all kinds of resources and compile them into production resources. + +figure2: Farm architecture, Corperation of Server, Compiler, Watcher, and Plugins. \ No newline at end of file diff --git a/docs/config/compilation-options.md b/docs/config/compilation-options.md index 38c27c934..fd25a44c7 100644 --- a/docs/config/compilation-options.md +++ b/docs/config/compilation-options.md @@ -1,4 +1,4 @@ -# Configuration Reference +# Compiler Options By default, Farm reads the configuration from the `farm.config.ts|js|mjs` file in the project root directory, an example configuration file: diff --git a/docs/config/configuring-farm.md b/docs/config/configuring-farm.md new file mode 100644 index 000000000..1022b57d7 --- /dev/null +++ b/docs/config/configuring-farm.md @@ -0,0 +1,23 @@ +# Configuring Farm + +By default, Farm reads the configuration from the `farm.config.ts|js|mjs` file in the project root directory, an example configuration file: + +```ts title="farm.config.ts" {5-7} +import { defineConfig } from "@farmfe/core"; +export default defineConfig({ + root: process.cwd(), // compiled root directory + // compile options + compilation: { + //... + }, + // Dev Server options + server: { + hmr: true, + //... + }, + // plugin configuration + plugins: [], +}); +``` + +This document only covers details `compilation` options. For `server` or `shared` options, refer to [server](/docs/config/dev-server) or [shared](/docs/config/shared). \ No newline at end of file diff --git a/docs/config/dev-server.md b/docs/config/dev-server.md index ec9365306..abad7d411 100644 --- a/docs/config/dev-server.md +++ b/docs/config/dev-server.md @@ -1,4 +1,4 @@ -# Dev Server +# Dev Server Options ## DevServer Options - server diff --git a/docs/features/css.md b/docs/features/css.md index ba046580b..101cbda32 100644 --- a/docs/features/css.md +++ b/docs/features/css.md @@ -1,4 +1,4 @@ -# Css +# Css/Sass/Less Farm support Css out of box, just import the css file: ```tsx diff --git a/docs/features/dev-server.md b/docs/features/dev-server.md new file mode 100644 index 000000000..c3127bd3d --- /dev/null +++ b/docs/features/dev-server.md @@ -0,0 +1 @@ +# DevServer and HMR \ No newline at end of file diff --git a/docs/features/env.md b/docs/features/env.md new file mode 100644 index 000000000..4103bae99 --- /dev/null +++ b/docs/features/env.md @@ -0,0 +1 @@ +# Enviroment Variables and Modes \ No newline at end of file diff --git a/docs/features/script.md b/docs/features/script.md index 0f7405e20..ed8e78258 100644 --- a/docs/features/script.md +++ b/docs/features/script.md @@ -1,5 +1,4 @@ -# Script - +# TS/TSX Farm support compiling `Js/Jsx/Ts/Tsx` out of box, and compile `Jsx/Tsx` to React by default. ```tsx title="./button.tsx" diff --git a/docs/migration/from-vite.md b/docs/migration/from-vite.md new file mode 100644 index 000000000..445294044 --- /dev/null +++ b/docs/migration/from-vite.md @@ -0,0 +1 @@ +# Migrate From Vite \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index 2482a2553..612201392 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -123,12 +123,24 @@ const config = { position: "left", label: "Config", }, + { + type: "doc", + docId: "api/rust-plugin-api", + position: "left", + label: "API", + }, { type: "doc", docId: "plugins/official-plugins/overview", position: "left", label: "Plugins", }, + { + type: "doc", + docId: "community", + position: "left", + label: "Community", + }, { type: "docsVersionDropdown", position: "right", diff --git a/sidebars.js b/sidebars.js index 86d692d4e..890241087 100644 --- a/sidebars.js +++ b/sidebars.js @@ -22,7 +22,7 @@ const sidebars = { type: "category", label: "Getting Started", collapsed: false, - items: ["why-farm", "quick-start", "using-plugins"], + items: ["why-farm", "quick-start", "concepts", "using-plugins"], }, { type: "category", @@ -40,26 +40,37 @@ const sidebars = { label: "Features", collapsed: true, items: [ + "features/dev-server", "features/html", "features/css", "features/script", "features/static", + "features/env", "features/lazy-compilation", - "features/partial-bundling", "features/sourcemap", - "features/tree-shake", - "features/minification", - "features/polyfill", - "features/persistent-cache", ], }, + { + type: "category", + label: "Advanced", + collapsed: true, + items: [ + "advanced/ssr", + "advanced/partial-bundling", + "advanced/tree-shake", + "advanced/minification", + "advanced/polyfill", + "advanced/persistent-cache" + ], + }, + { + type: "category", + label: "Migration", + collapsed: true, + items: ["migration/from-vite"], + }, + "comparisons", "benchmark", - // { - // type: "category", - // label: "Benchmark", - // collapsed: false, - // items: ["benchmark"], - // }, ], configSidebar: [ { @@ -67,6 +78,7 @@ const sidebars = { label: "Configuration Reference", collapsed: false, items: [ + "config/configuring-farm", "config/compilation-options", "config/dev-server", "config/shared", @@ -74,6 +86,16 @@ const sidebars = { "config/plugins-options", ], }, + { + type: "category", + label: "CLI", + collapsed: false, + items: ["cli/cli-api"], + }, + // "config/farm-config", + // "config/cli", + ], + apiSidebar: [ { type: "category", label: "Api Reference", @@ -86,14 +108,6 @@ const sidebars = { "api/rust-api", ], }, - { - type: "category", - label: "CLI", - collapsed: false, - items: ["cli/cli-api"], - }, - // "config/farm-config", - // "config/cli", ], pluginSidebar: [ {