├── .github ├── renovate.json5 └── workflows │ ├── deploy.yml │ ├── test.yml │ └── todo.yml ├── .gitignore ├── .husky └── pre-commit ├── .npmrc ├── .prettierignore ├── .vscode └── launch.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README-CN.md ├── README.md ├── TODO.md ├── doc-site ├── .gitignore ├── README.md ├── index.html ├── package.json ├── pages │ ├── $.mdx │ ├── 404.tsx │ ├── _assets │ │ └── outline-and-search.jpg │ ├── _theme.tsx │ ├── advanced-fs-routing$.mdx │ ├── examples │ │ └── component-library$.md │ ├── fs-routing$.mdx │ ├── i18n$.mdx │ ├── library-documentation-tools │ │ ├── demos │ │ │ └── demo1.tsx │ │ ├── index$.mdx │ │ ├── types.ts │ │ └── typesUtils.ts │ ├── magic-import$_deprecate.mdx │ ├── official-theme$.mdx │ ├── page-data$.mdx │ ├── themConfig │ │ └── footer.tsx │ ├── theme-customization$.mdx │ ├── upgrade-from-v2-to-v3$.mdx │ ├── upgrade-from-v3-to-v4$.mdx │ └── upgrade-from-v4-to-v5$.mdx ├── vite-env.d.ts └── vite.config.ts ├── package.json ├── packages ├── create-project │ ├── .gitignore │ ├── .npmignore │ ├── README.md │ ├── index.js │ ├── package.json │ ├── template-app │ │ ├── .prettierrc │ │ ├── README.md │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── pages │ │ │ ├── $.mdx │ │ │ ├── _theme.tsx │ │ │ ├── guide │ │ │ │ ├── introduce$.md │ │ │ │ ├── react │ │ │ │ │ ├── build$.md │ │ │ │ │ ├── deploy$.md │ │ │ │ │ ├── develop$.md │ │ │ │ │ └── getting-started │ │ │ │ │ │ ├── FirstExample.tsx │ │ │ │ │ │ ├── index$.md │ │ │ │ │ │ └── index.module.css │ │ │ │ └── spec │ │ │ │ │ ├── alignment$.md │ │ │ │ │ ├── color$.md │ │ │ │ │ ├── overview$.md │ │ │ │ │ └── proximity$.md │ │ │ ├── md-test1$.md │ │ │ ├── reference │ │ │ │ ├── cli-commands │ │ │ │ │ ├── command1$.md │ │ │ │ │ └── command2$.md │ │ │ │ ├── concepts │ │ │ │ │ ├── concepts1$.md │ │ │ │ │ └── concepts2$.md │ │ │ │ ├── error-codes │ │ │ │ │ ├── code1$.md │ │ │ │ │ ├── code2$.md │ │ │ │ │ └── code3$.md │ │ │ │ ├── glossary$.md │ │ │ │ └── index$.md │ │ │ ├── users │ │ │ │ ├── [userId] │ │ │ │ │ ├── index$.tsx │ │ │ │ │ └── posts │ │ │ │ │ │ └── [postId]$.tsx │ │ │ │ └── index$.tsx │ │ │ └── vite-env.d.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── template-lib-monorepo │ │ ├── README.md │ │ ├── _gitignore │ │ ├── _pnpm-workspace.yaml │ │ ├── package.json │ │ ├── packages │ │ │ ├── button │ │ │ │ ├── README.md │ │ │ │ ├── demos │ │ │ │ │ ├── demo1.tsx │ │ │ │ │ └── demo2.tsx │ │ │ │ ├── package.json │ │ │ │ ├── src │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── style.module.css │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ ├── types.ts │ │ │ │ │ └── vite-env.d.ts │ │ │ │ └── tsconfig.json │ │ │ ├── card │ │ │ │ ├── README.md │ │ │ │ ├── demos │ │ │ │ │ ├── demo1.tsx │ │ │ │ │ └── demo2.tsx │ │ │ │ ├── package.json │ │ │ │ ├── src │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── style.module.css │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ └── vite-env.d.ts │ │ │ │ └── tsconfig.json │ │ │ └── demos │ │ │ │ ├── index.html │ │ │ │ ├── package.json │ │ │ │ ├── pages │ │ │ │ ├── $.tsx │ │ │ │ ├── 404.tsx │ │ │ │ ├── _theme.tsx │ │ │ │ ├── md-test1$.md │ │ │ │ └── vite-env.d.ts │ │ │ │ ├── tsconfig.json │ │ │ │ └── vite.config.ts │ │ ├── script │ │ │ └── copy.js │ │ └── tsconfig.json │ └── template-lib │ │ ├── README.md │ │ ├── _gitignore │ │ ├── docs │ │ ├── index.html │ │ ├── package.json │ │ ├── pages │ │ │ ├── $.mdx │ │ │ ├── 404.tsx │ │ │ ├── _theme.tsx │ │ │ ├── guide$.mdx │ │ │ └── md-test1$.md │ │ └── vite.config.ts │ │ ├── package.json │ │ ├── src │ │ ├── Button │ │ │ ├── README.md │ │ │ ├── demos │ │ │ │ ├── demo1.tsx │ │ │ │ └── demo2.tsx │ │ │ ├── index.tsx │ │ │ ├── style.module.css │ │ │ ├── types.ts │ │ │ └── typesUtils.ts │ │ ├── Card │ │ │ ├── README.md │ │ │ ├── demos │ │ │ │ ├── demo1.tsx │ │ │ │ └── demo2.tsx │ │ │ ├── index.tsx │ │ │ └── style.module.css │ │ ├── index.ts │ │ └── vite-env.d.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts ├── playground │ ├── basic │ │ ├── __tests__ │ │ │ └── basic.spec.ts │ │ ├── declare.d.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── pages │ │ │ ├── _theme.tsx │ │ │ ├── dir │ │ │ │ └── page3$.md │ │ │ ├── index$.tsx │ │ │ ├── page1$.tsx │ │ │ ├── page2 │ │ │ │ └── index$.tsx │ │ │ ├── style.scss │ │ │ └── users │ │ │ │ ├── [userId] │ │ │ │ ├── index$.tsx │ │ │ │ └── posts │ │ │ │ │ └── [postId]$.tsx │ │ │ │ └── index$.tsx │ │ └── vite.config.ts │ ├── custom-find-pages │ │ ├── declare.d.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── pages │ │ │ ├── $.tsx │ │ │ ├── 404$.tsx │ │ │ └── _theme.tsx │ │ ├── src │ │ │ ├── Button │ │ │ │ ├── README.md │ │ │ │ ├── demos │ │ │ │ │ ├── demo1.tsx │ │ │ │ │ └── demo2.tsx │ │ │ │ ├── index.tsx │ │ │ │ └── style.module.css │ │ │ ├── Card │ │ │ │ ├── README.md │ │ │ │ ├── demos │ │ │ │ │ ├── demo1.tsx │ │ │ │ │ └── demo2.tsx │ │ │ │ ├── index.tsx │ │ │ │ └── style.module.css │ │ │ └── index.ts │ │ └── vite.config.ts │ ├── custom-find-pages2 │ │ ├── README.md │ │ ├── package.json │ │ └── pages │ │ │ ├── 404.tsx │ │ │ ├── _theme.tsx │ │ │ ├── declare.d.ts │ │ │ ├── images │ │ │ └── react.png │ │ │ ├── index.html │ │ │ ├── index.tsx │ │ │ ├── page1 │ │ │ └── index.mdx │ │ │ ├── sub-path │ │ │ ├── index.tsx │ │ │ └── page2 │ │ │ │ └── index.tsx │ │ │ └── vite.config.ts │ ├── lib-monorepo │ │ ├── README.md │ │ ├── _gitignore │ │ ├── package.json │ │ ├── packages │ │ │ ├── button │ │ │ │ ├── README.md │ │ │ │ ├── demos │ │ │ │ │ ├── demo1.tsx │ │ │ │ │ └── demo2.tsx │ │ │ │ ├── package.json │ │ │ │ ├── src │ │ │ │ │ ├── declare.d.ts │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── style.module.css │ │ │ │ │ └── tsconfig.json │ │ │ │ └── tsconfig.json │ │ │ ├── card │ │ │ │ ├── README.md │ │ │ │ ├── demos │ │ │ │ │ ├── demo1.tsx │ │ │ │ │ └── demo2.tsx │ │ │ │ ├── package.json │ │ │ │ ├── src │ │ │ │ │ ├── declare.d.ts │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── style.module.css │ │ │ │ │ └── tsconfig.json │ │ │ │ └── tsconfig.json │ │ │ └── demos │ │ │ │ ├── index.html │ │ │ │ ├── package.json │ │ │ │ ├── pages │ │ │ │ ├── $.tsx │ │ │ │ ├── 404$.tsx │ │ │ │ └── _theme.tsx │ │ │ │ ├── tsconfig.json │ │ │ │ └── vite.demos.ts │ │ ├── script │ │ │ └── copy.js │ │ └── tsconfig.json │ ├── package.json │ ├── tsconfig.json │ └── use-theme-doc │ │ ├── __tests__ │ │ ├── hmr.spec.ts │ │ ├── navigate-tests.ts │ │ ├── navigate.cjs.spec.ts │ │ ├── navigate.disableJS.spec.ts │ │ ├── navigate.spec.ts │ │ ├── package.json │ │ ├── snapshots.ts │ │ └── tsconfig.json │ │ ├── declare.d.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── pages │ │ ├── $.tsx │ │ ├── 404.tsx │ │ ├── Counter.tsx │ │ ├── _theme.tsx │ │ ├── components │ │ │ ├── button │ │ │ │ ├── demos │ │ │ │ │ └── demo1.tsx │ │ │ │ ├── index$.md │ │ │ │ ├── types.ts │ │ │ │ └── typesUtils.ts │ │ │ ├── card │ │ │ │ └── index$.md │ │ │ ├── divider │ │ │ │ └── index$.md │ │ │ ├── grid │ │ │ │ └── index$.md │ │ │ └── overview │ │ │ │ └── index$.tsx │ │ ├── guide │ │ │ ├── introduce$.md │ │ │ ├── react │ │ │ │ ├── build$.md │ │ │ │ ├── deploy$.md │ │ │ │ ├── develop$.md │ │ │ │ └── getting-started │ │ │ │ │ ├── FirstExample.tsx │ │ │ │ │ └── index$.md │ │ │ └── spec │ │ │ │ ├── alignment$.md │ │ │ │ ├── color$.md │ │ │ │ ├── overview$.md │ │ │ │ └── proximity$.md │ │ ├── md-test1$.mdx │ │ ├── md-test2$.md │ │ ├── md-test3$.md │ │ ├── md-test4$.md │ │ ├── page1$.tsx │ │ ├── page1.module.css │ │ ├── page2$.md │ │ ├── reference │ │ │ ├── cli-commands │ │ │ │ ├── command1$.md │ │ │ │ └── command2$.md │ │ │ ├── concepts │ │ │ │ ├── concepts1$.md │ │ │ │ └── concepts2$.md │ │ │ ├── error-codes │ │ │ │ ├── code1$.md │ │ │ │ ├── code2$.md │ │ │ │ └── code3$.md │ │ │ ├── glossary$.md │ │ │ └── index$.mdx │ │ ├── resources$.tsx │ │ ├── themeConfig │ │ │ ├── footer.tsx │ │ │ ├── i18n │ │ │ │ ├── en.ts │ │ │ │ ├── index.ts │ │ │ │ └── zh.ts │ │ │ ├── sideNavs.ts │ │ │ └── topNavs.ts │ │ ├── themeDev.tsx │ │ ├── users │ │ │ ├── [userId] │ │ │ │ ├── index$.tsx │ │ │ │ └── posts │ │ │ │ │ └── [postId]$.tsx │ │ │ └── index$.tsx │ │ └── zh │ │ │ ├── $.tsx │ │ │ ├── components │ │ │ ├── button │ │ │ │ ├── index$.md │ │ │ │ └── types.ts │ │ │ ├── card │ │ │ │ └── index$.md │ │ │ ├── divider │ │ │ │ └── index$.md │ │ │ ├── grid │ │ │ │ └── index$.md │ │ │ └── overview │ │ │ │ └── index$.tsx │ │ │ ├── page1$.tsx │ │ │ ├── page2$.md │ │ │ └── resources$.tsx │ │ ├── tsconfig.json │ │ └── vite.config.ts ├── react-pages │ ├── README.md │ ├── bin │ │ └── vite-pages.js │ ├── client.rollup.config.js │ ├── client.ts │ ├── clientTypes.d.ts │ ├── package.json │ ├── rollup.config.js │ ├── src │ │ ├── client │ │ │ ├── App.tsx │ │ │ ├── PageLoader.tsx │ │ │ ├── ctx.tsx │ │ │ ├── declare.d.ts │ │ │ ├── entries │ │ │ │ ├── ClientAppWrapper.tsx │ │ │ │ ├── csr.tsx │ │ │ │ ├── ssg-client.tsx │ │ │ │ └── ssg-server.tsx │ │ │ ├── index.html │ │ │ ├── state.ts │ │ │ ├── tsconfig.json │ │ │ ├── useAppState.tsx │ │ │ └── utils.ts │ │ └── node │ │ │ ├── cli.ts │ │ │ ├── constants.ts │ │ │ ├── index.ts │ │ │ ├── page-strategy │ │ │ ├── DefaultPageStrategy │ │ │ │ └── index.ts │ │ │ ├── PagesDataKeeper.ts │ │ │ ├── UpdateBuffer.ts │ │ │ ├── index.ts │ │ │ ├── pageUtils.ts │ │ │ └── types.doc.ts │ │ │ ├── static-site-generation │ │ │ └── index.ts │ │ │ ├── tsconfig.json │ │ │ ├── types.ts │ │ │ ├── utils │ │ │ ├── injectHTMLTag.ts │ │ │ ├── mdastUtils.ts │ │ │ ├── mdx-plugin-file-text.ts │ │ │ └── virtual-module │ │ │ │ ├── ProxyModulesManager.ts │ │ │ │ ├── README.md │ │ │ │ ├── VirtualModules.ts │ │ │ │ ├── VirtualModulesManager.ts │ │ │ │ ├── index.ts │ │ │ │ └── utils │ │ │ │ ├── File.ts │ │ │ │ ├── PendingTaskCounter.ts │ │ │ │ ├── extractStaticData.ts │ │ │ │ └── index.ts │ │ │ └── virtual-module-plugins │ │ │ ├── demo-modules │ │ │ ├── index.tsx │ │ │ └── mdx-plugin.ts │ │ │ ├── outline-info-module │ │ │ ├── extractOutlineInfo.ts │ │ │ └── index.tsx │ │ │ ├── theme.ts │ │ │ └── ts-info-module │ │ │ ├── extract.ts │ │ │ ├── index.ts │ │ │ └── mdx-plugin.ts │ ├── theme.doc.d.ts │ └── tsconfig.json └── theme-doc │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── rollup.config.mjs │ ├── scripts │ ├── copy.mjs │ └── process-github-markdown-css.ts │ ├── src │ ├── Layout │ │ ├── Demo │ │ │ ├── icons.tsx │ │ │ ├── index.module.less │ │ │ └── index.tsx │ │ ├── FileText │ │ │ └── index.tsx │ │ ├── Footer.module.less │ │ ├── Footer.tsx │ │ ├── Header.tsx │ │ ├── MDX │ │ │ ├── CodeBlock.module.less │ │ │ ├── CodeBlock.tsx │ │ │ ├── index.tsx │ │ │ └── useCopyToClipBoard.ts │ │ ├── Outline.tsx │ │ ├── Search │ │ │ ├── index.tsx │ │ │ └── search.module.less │ │ ├── Sider.tsx │ │ ├── TsInfo │ │ │ ├── index.module.less │ │ │ └── index.tsx │ │ ├── common.less │ │ ├── ctx.ts │ │ ├── github-markdown-light.css │ │ ├── index.module.less │ │ ├── index.tsx │ │ ├── renderMenu.tsx │ │ └── useLocaleSelector.tsx │ ├── ThemeConfig.doc.ts │ ├── analyzeStaticData.ts │ ├── components │ │ └── AnchorLink.tsx │ ├── ctx.ts │ ├── index.tsx │ ├── ssrPlugin.tsx │ ├── style.less │ ├── tsconfig.json │ ├── utils.ts │ └── vite-env.d.ts │ └── tsconfig.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── prettier.config.js ├── scripts └── linkBins.js ├── test-setup ├── playwright.config.ts └── utils │ ├── fsUtils.ts │ ├── index.ts │ ├── startServer.ts │ └── utils.ts └── tsconfig.json /.github/renovate.json5: -------------------------------------------------------------------------------- 1 | { 2 | extends: ['config:base', 'schedule:weekly', 'group:allNonMajor'], 3 | labels: ['dependencies'], 4 | ignorePaths: ['**/__tests__/**'], 5 | pin: false, 6 | rangeStrategy: 'bump', 7 | node: false, 8 | packageRules: [ 9 | { 10 | depTypeList: ['peerDependencies'], 11 | enabled: false, 12 | }, 13 | ], 14 | ignoreDeps: ['rollup', 'node', 'typescript', 'vite'], 15 | } 16 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: deploy to gh-pages 2 | 3 | on: 4 | push: 5 | branches: [main, test-gh-action] 6 | 7 | jobs: 8 | build: 9 | strategy: 10 | matrix: 11 | os: [ubuntu-latest] 12 | node-version: [16.x] 13 | 14 | runs-on: ${{ matrix.os }} 15 | steps: 16 | - uses: actions/checkout@v3 17 | 18 | - uses: pnpm/action-setup@v2 19 | name: Install pnpm 20 | id: pnpm-install 21 | with: 22 | version: 'latest' 23 | run_install: false 24 | 25 | - name: Setup Node 26 | uses: actions/setup-node@v3 27 | with: 28 | node-version: ${{ matrix.node-version }} 29 | cache: 'pnpm' 30 | 31 | - name: Get pnpm store directory 32 | id: pnpm-cache 33 | shell: bash 34 | run: | 35 | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT 36 | 37 | - uses: actions/cache@v3 38 | name: Setup pnpm cache 39 | with: 40 | path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} 41 | key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} 42 | restore-keys: | 43 | ${{ runner.os }}-pnpm-store- 44 | 45 | - name: Install dependencies 46 | run: pnpm install 47 | 48 | - name: Build 49 | run: pnpm build:docs 50 | 51 | - name: Deploy to GitHub Pages 52 | if: success() 53 | uses: crazy-max/ghaction-github-pages@v3 54 | with: 55 | target_branch: gh-pages 56 | build_dir: doc-site/dist 57 | # Some chunk files may start with underscores. So we need to disable jekyll. https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/ 58 | jekyll: false 59 | env: 60 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 61 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | branches: [main, test-*, playwright-test] 6 | pull_request: 7 | branches: [main] 8 | 9 | env: 10 | # Force terminal colors. @see https://www.npmjs.com/package/colors 11 | FORCE_COLOR: 1 12 | 13 | jobs: 14 | test_linux: 15 | name: ${{ matrix.os }} (${{ matrix.browser }}) 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | browser: [chromium] 20 | os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest] 21 | node-version: [16.x] 22 | runs-on: ${{ matrix.os }} 23 | # ref: https://playwright.dev/docs/ci#github-actions 24 | steps: 25 | - uses: actions/checkout@v3 26 | 27 | - uses: pnpm/action-setup@v2 28 | name: Install pnpm 29 | id: pnpm-install 30 | with: 31 | version: 'latest' 32 | run_install: false 33 | 34 | - name: Setup Node 35 | uses: actions/setup-node@v3 36 | with: 37 | node-version: ${{ matrix.node-version }} 38 | cache: 'pnpm' 39 | 40 | - name: Get pnpm store directory 41 | id: pnpm-cache 42 | shell: bash 43 | run: | 44 | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT 45 | 46 | - uses: actions/cache@v3 47 | name: Setup pnpm cache 48 | with: 49 | path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} 50 | key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} 51 | restore-keys: | 52 | ${{ runner.os }}-pnpm-store- 53 | 54 | - name: Install dependencies 55 | run: pnpm install 56 | 57 | - name: Install Playwright 58 | run: pnpm exec playwright install --with-deps ${{ matrix.browser }} 59 | - name: Run tests 60 | run: pnpm test 61 | - name: Upload test results 62 | if: always() 63 | uses: actions/upload-artifact@v3 64 | with: 65 | name: ${{ matrix.browser }}-${{ matrix.os }}-playwright-report 66 | path: playwright-report 67 | -------------------------------------------------------------------------------- /.github/workflows/todo.yml: -------------------------------------------------------------------------------- 1 | name: 'Move TODO to issue' 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main' 7 | jobs: 8 | build: 9 | runs-on: 'ubuntu-latest' 10 | steps: 11 | - uses: 'actions/checkout@v3' 12 | - name: 'TODO to Issue' 13 | uses: 'alstr/todo-to-issue-action@v4' 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | dist 4 | tmp 5 | temp 6 | /test-results/ 7 | **/playwright-report/ 8 | /playwright/.cache/ 9 | playground-temp 10 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | pnpm lint-staged 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true 2 | strict-peer-dependencies=false 3 | auto-install-peers=false 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | packages/**/node_modules 2 | packages/**/dist 3 | packages/**/lib 4 | packages/playground-temp 5 | 6 | doc-site/dist 7 | doc-site/node_modules 8 | 9 | playground-report 10 | 11 | pnpm-lock.yaml 12 | pnpm-workspace.yaml 13 | 14 | LICENSE 15 | 16 | *.md 17 | *.mdx 18 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Launch via NPM", 9 | "request": "launch", 10 | "runtimeArgs": ["run-script", "dev"], 11 | "runtimeExecutable": "npm", 12 | "skipFiles": ["/**"], 13 | "type": "node", 14 | "cwd": "${fileDirname}" 15 | }, 16 | { 17 | "type": "node", 18 | "request": "attach", 19 | "name": "Attach", 20 | "port": 9229, 21 | "skipFiles": ["/**"] 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 5.x 4 | https://vitejs.github.io/vite-plugin-react-pages/upgrade-from-v4-to-v5 5 | 6 | ## 4.x 7 | https://vitejs.github.io/vite-plugin-react-pages/upgrade-from-v3-to-v4 8 | 9 | ## 3.x 10 | https://vitejs.github.io/vite-plugin-react-pages/upgrade-from-v2-to-v3 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-present, Sirui Chen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # TODO 2 | 3 | - ✅ Polish basic theme 4 | - ✅ Let theme to decide how to render loading or loadError view 5 | - vite-pages core should not render any dom node. It should be done by theme 6 | - ✅ Let user/theme implement their own fs routing convention 7 | - 🔧 Composed pages can be merged into object(return object as PageData.filePath) 8 | - Currently they are [merged into array by vite-pages(hard-coded)](https://github.com/vitejs/vite-plugin-react-pages/blob/ba20fe4c7c69aee0b5b2507681c556c4467c23f2/packages/vite-plugin-react-pages/src/node/dynamic-modules/mergeModules.ts#L5). 9 | - 🔧 Support [static generation with external data](https://nextjs.org/learn/basics/data-fetching/with-data) (getStaticProps) 10 | - 🔧 Support [static generation with dynamic routes](https://nextjs.org/learn/basics/data-fetching/with-data) (getStaticPaths) 11 | - In development, `getStaticProps`/`getStaticPaths` runs on every request 12 | - In production, `getStaticProps`/`getStaticPaths` runs at build time 13 | - 🔧 Project cleanup: don't bump version of templates when `npm run ver:p` 14 | - 🔧 improve template-lib-monorepo 15 | - Act as a bridge between development and documentation. 16 | 17 | DATA node, graph, lazy/eager node 18 | 19 | - core 20 | - theme 21 | - pages 22 | - page1 23 | - file1.1 24 | - page2 25 | - file2.1 26 | - file2.2 (lazy) 27 | - fetched data 28 | - virtual module (lazy) 29 | - file 2.3 30 | - file 2.4 (lazy) 31 | 32 | bug: routePath don't change when route from a 404 page to another 404 page 33 | -------------------------------------------------------------------------------- /doc-site/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist -------------------------------------------------------------------------------- /doc-site/README.md: -------------------------------------------------------------------------------- 1 | # vite-plugin-react-pages doc site 2 | 3 | This is the document site of [vite-plugin-react-pages](https://github.com/vitejs/vite-plugin-react-pages). It also serves as an example. 4 | 5 | This site is deployed at [github page](https://vitejs.github.io/vite-plugin-react-pages/). 6 | 7 | ## How to use 8 | 9 | - `npm run dev` and play with the local dev environment. 10 | - `npm run build` and serve the `dist`. 11 | - `npm run ssr` and serve the `dist`. You can disable javascript in your browser, to verify if it can still render. 12 | - `npm run deploy` deploy the project onto github page. 13 | -------------------------------------------------------------------------------- /doc-site/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 📘Vite Pages 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /doc-site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "doc-site", 3 | "private": true, 4 | "version": "1.0.0", 5 | "description": "", 6 | "type": "module", 7 | "scripts": { 8 | "dev": "vite serve", 9 | "debug": "node --inspect ./node_modules/vite/bin/vite serve", 10 | "build": "rimraf dist && vite build --outDir dist && serve -s dist", 11 | "ssr": "rimraf dist && vite-pages ssr", 12 | "ssr-for-preview": "rimraf dist && vite-pages ssr && serve dist", 13 | "ssr-for-deploy": "rimraf dist && cross-env GITHUB_PAGES_DEPLOY=true vite-pages ssr", 14 | "deploy": "npm run ssr-for-deploy && touch ./dist/.nojekyll && gh-pages -d dist -t" 15 | }, 16 | "keywords": [], 17 | "author": "", 18 | "license": "ISC", 19 | "dependencies": { 20 | "react": "^18.2.0", 21 | "react-dom": "^18.2.0", 22 | "react-router-dom": "^6.21.3" 23 | }, 24 | "devDependencies": { 25 | "@types/react": "^18.2.48", 26 | "@vitejs/plugin-react": "^4.2.1", 27 | "cross-env": "^7.0.3", 28 | "gh-pages": "^6.1.1", 29 | "rimraf": "^5.0.5", 30 | "serve": "^14.2.1", 31 | "vite": "^5.0.12", 32 | "vite-pages-theme-doc": "workspace:*", 33 | "vite-plugin-react-pages": "workspace:*" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /doc-site/pages/404.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Navigate } from 'react-router-dom' 3 | 4 | const Component404 = () => { 5 | return 6 | } 7 | 8 | export default Component404 9 | -------------------------------------------------------------------------------- /doc-site/pages/_assets/outline-and-search.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitejs/vite-plugin-react-pages/eafe89dfcd1815bf10301a32d199022a43ddab06/doc-site/pages/_assets/outline-and-search.jpg -------------------------------------------------------------------------------- /doc-site/pages/_theme.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { createTheme, defaultSideNavs } from 'vite-pages-theme-doc' 3 | 4 | import Component404 from './404' 5 | import { footerConfig } from './themConfig/footer' 6 | 7 | export default createTheme({ 8 | topNavs: [ 9 | { 10 | label: 'Github', 11 | href: 'https://github.com/vitejs/vite-plugin-react-pages', 12 | icon: '⭐', 13 | }, 14 | ], 15 | logo:
📘 Vite Pages
, 16 | sideNavs(ctx) { 17 | return defaultSideNavs(ctx, { 18 | groupConfig: { 19 | '/': { 20 | advanced: { 21 | label: 'Advanced', 22 | order: 2, 23 | }, 24 | 'upgrade-guides': { 25 | label: 'Upgrade Guides', 26 | order: 3, 27 | }, 28 | }, 29 | }, 30 | }) 31 | }, 32 | footer: ({ resolvedLocale: { localeKey } }) => { 33 | return footerConfig.en 34 | }, 35 | Component404, 36 | }) 37 | -------------------------------------------------------------------------------- /doc-site/pages/fs-routing$.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Filesystem Routing 3 | order: 1 4 | --- 5 | 6 | # Filesystem Routing 7 | 8 | Vite-pages generates page routes based on your project file structure (filesystem routing). 9 | 10 | ## Basic Filesystem Routing Convention 11 | 12 | The basic filesystem routing convention is very intuitive. It works out of the box and doesn't need any config. It should satisfy most users' needs. 13 | 14 | **You can create a page by simply creating a file**: `page-name$.tsx`. Notice the `$` **at the end of the filename**. Vite-pages recognizes it and knows it is a page entry. 15 | 16 | If the filename is `index$.tsx`, the page route path will be the path of the directory. See examples below. 17 | 18 | > All file extensions `.ts|.tsx|.js|.jsx|.md|.mdx` works, as long as `$` is the last character before the extension. 19 | 20 | ## Examples 21 | 22 | | file path | page url path | 23 | | ------------------------------------------- | ---------------------- | 24 | | `index$.tsx` | `/` | 25 | | `$.tsx` (has same effect as `index$.tsx`) | `/` | 26 | | `page-one$.tsx` | `/page-one` | 27 | | `page-two$.md` | `/page-two` | 28 | | `dir-name/index$.jsx` | `/dir-name` | 29 | | `dir-name/page-three$.mdx` | `/dir-name/page-three` | 30 | | `dir-name/[id]/index$.tsx` (URL Paramater) | `/dir-name/:id` | 31 | | `dir-name/[id]/[id2]$.tsx` (URL Paramaters) | `/dir-name/:id/:id2` | 32 | 33 | Theme can decide what to render when no page matches the URL. Check out [the theme doc](/theme-customization). 34 | 35 | If a page path contains URL parameters, you can use [useParams](https://reactrouter.com/web/example/url-params) of `react-router-dom` to access the actual parameters. 36 | 37 | Check out [the basic fixture](https://github.com/vitejs/vite-plugin-react-pages/tree/main/packages/playground/basic/pages) for an example. 38 | 39 | ## Advanced Filesystem Routing 40 | 41 | The "Basic Filesystem Routing Convention" should satisfy most users' needs. For advanced users, vite-pages lets you implement your own filesystem routing convention: you can **teach vite-pages how to collect page data from your project**. Checkout [advanced fs routing](/advanced-fs-routing). 42 | -------------------------------------------------------------------------------- /doc-site/pages/library-documentation-tools/demos/demo1.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * @title Button Demo1 Title 3 | * @description Button demo1 description 4 | * @order 1 5 | */ 6 | 7 | import React from 'react' 8 | 9 | const Demo1 = () => { 10 | return 11 | } 12 | 13 | export default Demo1 14 | -------------------------------------------------------------------------------- /doc-site/pages/library-documentation-tools/typesUtils.ts: -------------------------------------------------------------------------------- 1 | export type MyImportedTypeAlias = { b: string } 2 | /** 3 | * Comment for MyImportedInterface... 4 | */ 5 | export type ReExportedInterface = { 6 | /** Comment for MyImportedInterface.prop1 */ 7 | prop1: MyImportedTypeAlias 8 | } 9 | -------------------------------------------------------------------------------- /doc-site/pages/themConfig/footer.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import type { FooterConfig } from 'vite-pages-theme-doc' 3 | import { 4 | QuestionCircleOutlined, 5 | BugOutlined, 6 | GithubFilled, 7 | TeamOutlined, 8 | LinkOutlined, 9 | } from '@ant-design/icons' 10 | 11 | export const footerConfig: { [locale: string]: FooterConfig } = { 12 | en: { 13 | message: `2020 - ${new Date().getFullYear()}`, 14 | copyright: 'Released under the MIT License.', 15 | columns: [ 16 | { 17 | icon: , 18 | title: 'Community', 19 | items: [ 20 | { 21 | icon: , 22 | label: 'Stack Overflow', 23 | url: 'https://stackoverflow.com/questions/tagged/vite-plugin-react-pages', 24 | }, 25 | { 26 | icon: , 27 | label: 'Help', 28 | url: 'https://github.com/vitejs/vite-plugin-react-pages/issues', 29 | }, 30 | ], 31 | }, 32 | { 33 | icon: , 34 | title: 'Resources', 35 | items: [ 36 | { 37 | icon: vite, 38 | label: 'Vite', 39 | url: 'https://vitejs.dev/', 40 | }, 41 | { 42 | icon: , 43 | label: 'GitHub', 44 | url: 'https://github.com/vitejs/vite-plugin-react-pages', 45 | }, 46 | ], 47 | }, 48 | ], 49 | }, 50 | zh: { 51 | message: `2020 - ${new Date().getFullYear()}`, 52 | copyright: '以 MIT 许可证发布', 53 | columns: [ 54 | { 55 | title: '社区', 56 | items: [ 57 | { 58 | label: 'Stack Overflow', 59 | url: 'https://stackoverflow.com/questions/tagged/vite-plugin-react-pages', 60 | }, 61 | { 62 | label: '帮助', 63 | url: 'https://github.com/vitejs/vite-plugin-react-pages/issues', 64 | }, 65 | ], 66 | }, 67 | { 68 | title: '更多', 69 | items: [ 70 | { 71 | label: 'Vite', 72 | url: 'https://vitejs.dev/', 73 | }, 74 | { 75 | label: 'GitHub', 76 | url: 'https://github.com/vitejs/vite-plugin-react-pages', 77 | }, 78 | ], 79 | }, 80 | ], 81 | }, 82 | } 83 | -------------------------------------------------------------------------------- /doc-site/pages/upgrade-from-v4-to-v5$.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Upgrade from v4 to v5 3 | order: 0 4 | subGroup: upgrade-guides 5 | --- 6 | 7 | # Upgrade from v4 to v5 8 | 9 | vite-plugin-react-pages v5 is released with the following improvements: 10 | 11 | - Upgrade Vite to [v5](https://vitejs.dev/guide/migration.html). 12 | - Upgrade MDX to [v3](https://mdxjs.com/migrating/v3/). 13 | 14 | Most migration is done inside this plugin. Our upstream libraries (Vite and MDX) didn't bring many significant breaking changes. So it should be **very easy** for our users to migrate! The following article will show you the migration instructions. 15 | 16 | If you encounter problems, open an issue in the repo. Or check out the [getting-stated templates](https://vitejs.github.io/vite-plugin-react-pages/#getting-stated) for working setup. 17 | 18 | ## Upgrade Node.js to 18+ 19 | 20 | As [Vite v5](https://vitejs.dev/guide/migration.html) requires Node.js 18+, you should upgrade Node.js to 18+. 21 | 22 | ## Upgrade project dependencies 23 | 24 | Upgrade these package versions: 25 | 26 | ```json 27 | { 28 | "devDependencies": { 29 | "vite": "^5.0.12", 30 | "@vitejs/plugin-react": "^4.2.1", 31 | "vite-plugin-react-pages": "^5.0.0", 32 | "vite-pages-theme-doc": "^5.0.0", 33 | "@mdx-js/react": "^3.0.0" 34 | } 35 | } 36 | ``` 37 | 38 | > you can replace `@vitejs/plugin-react` with latest version of `@vitejs/plugin-react-swc`. 39 | 40 | ## Check Upstream libraries migration 41 | 42 | Most migration is done inside this plugin. Although the upstream libraries (Vite and MDX) didn't bring many significant breaking changes for you, you should still take a look at their migration guides: 43 | 44 | - [Vite v5](https://vitejs.dev/guide/migration.html) 45 | - [MDX v3](https://mdxjs.com/migrating/v3/) 46 | -------------------------------------------------------------------------------- /doc-site/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /doc-site/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | import pages from 'vite-plugin-react-pages' 4 | 5 | export default defineConfig({ 6 | plugins: [react(), pages()], 7 | base: 8 | process.env.GITHUB_PAGES_DEPLOY === 'true' 9 | ? '/vite-plugin-react-pages/' 10 | : '/', 11 | }) 12 | -------------------------------------------------------------------------------- /packages/create-project/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /packages/create-project/.npmignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs-dist 3 | lib 4 | node_modules 5 | -------------------------------------------------------------------------------- /packages/create-project/README.md: -------------------------------------------------------------------------------- 1 | # create-vite-pages 2 | 3 | Create a [vite-pages](https://github.com/vitejs/vite-plugin-react-pages) project. 4 | 5 | ``` 6 | npm init vite-pages [new-directory-name] -- --template [app|lib|lib-monorepo] 7 | ``` 8 | 9 | For example: 10 | 11 | ``` 12 | npm init vite-pages app-demo -- --template app 13 | npm init vite-pages library-demo -- --template lib 14 | npm init vite-pages library-monorepo-demo -- --template lib-monorepo 15 | ``` 16 | 17 | If you are using **npm 6.x**, the extra double-dash before `--template` should be deleted. For example, `npm init vite-pages app-demo --template app`. 18 | 19 | After project is initialized, you should read the `README.md` of it. 20 | -------------------------------------------------------------------------------- /packages/create-project/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const path = require('path') 3 | const fs = require('fs-extra') 4 | const argv = require('minimist')(process.argv.slice(2)) 5 | 6 | async function init() { 7 | const targetDir = argv._[0] || '.' 8 | const cwd = process.cwd() 9 | const root = path.join(cwd, targetDir) 10 | const renameFiles = { 11 | _gitignore: '.gitignore', 12 | _npmrc: '.npmrc', 13 | '_pnpm-workspace.yaml': 'pnpm-workspace.yaml', 14 | } 15 | console.log(`Scaffolding project in ${root}...`) 16 | 17 | await fs.ensureDir(root) 18 | const existing = await fs.readdir(root) 19 | if (existing.length) { 20 | console.error(`Error: target directory is not empty.`) 21 | process.exit(1) 22 | } 23 | 24 | const templateDir = path.join( 25 | __dirname, 26 | `template-${argv.t || argv.template || 'app'}` 27 | ) 28 | const write = async (file, content) => { 29 | const targetPath = renameFiles[file] 30 | ? path.join(root, renameFiles[file]) 31 | : path.join(root, file) 32 | if (content) { 33 | await fs.writeFile(targetPath, content) 34 | } else { 35 | await fs.copy(path.join(templateDir, file), targetPath) 36 | } 37 | } 38 | 39 | const files = await fs.readdir(templateDir) 40 | for (const file of files.filter((f) => f !== 'package.json')) { 41 | await write(file) 42 | } 43 | 44 | const pkg = require(path.join(templateDir, `package.json`)) 45 | removeWorkspace(pkg) 46 | pkg.name = path.basename(root) 47 | await write('package.json', JSON.stringify(pkg, null, 2)) 48 | 49 | console.log(`\nDone. Now run:\n`) 50 | if (root !== cwd) { 51 | console.log(` cd ${path.relative(cwd, root)}`) 52 | } 53 | console.log(` npm install (or \`pnpm install\`)`) 54 | console.log(` npm run dev (or \`pnpm dev\`)`) 55 | console.log() 56 | } 57 | 58 | init().catch((e) => { 59 | console.error(e) 60 | }) 61 | 62 | function removeWorkspace(pkg) { 63 | rm(pkg.dependencies) 64 | rm(pkg.devDependencies) 65 | function rm(deps) { 66 | if (!deps) return 67 | Object.keys(deps).forEach((k) => { 68 | if (deps[k].startsWith('workspace:')) { 69 | deps[k] = deps[k].slice('workspace:'.length) 70 | } 71 | }) 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /packages/create-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-vite-pages", 3 | "version": "5.0.1", 4 | "keywords": [ 5 | "vite", 6 | "react", 7 | "vite-pages", 8 | "react-pages", 9 | "vite-plugin-react-pages" 10 | ], 11 | "license": "MIT", 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/vitejs/vite-plugin-react-pages.git" 15 | }, 16 | "bugs": { 17 | "url": "https://github.com/vitejs/vite-plugin-react-pages/issues" 18 | }, 19 | "homepage": "https://github.com/vitejs/vite-plugin-react-pages", 20 | "bin": { 21 | "create-vite-pages": "index.js", 22 | "cvp": "index.js" 23 | }, 24 | "dependencies": { 25 | "fs-extra": "^11.2.0", 26 | "minimist": "^1.2.8" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/create-project/template-app/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "semi": false 4 | } 5 | -------------------------------------------------------------------------------- /packages/create-project/template-app/README.md: -------------------------------------------------------------------------------- 1 | ## vite-pages app starter 2 | 3 | This is a demo project for [vite-plugin-react-pages](https://github.com/vitejs/vite-plugin-react-pages). 4 | This project demonstrate how to develop a React app using [vite-plugin-react-pages](https://github.com/vitejs/vite-plugin-react-pages) as framework. 5 | 6 | You can run this demo in [StackBlitz](https://stackblitz.com/fork/github/vitejs/vite-plugin-react-pages/tree/main/packages/create-project/template-app?file=README.md&terminal=dev), entirely in your browser! 7 | 8 | # How to use 9 | 10 | `npm install` or `pnpm install` or `yarn` 11 | 12 | `npm run dev` You can now play with the local develop environment. 13 | 14 | Edit `pages/page1$.tsx` or other source files, the playground will inflect your change instantly. 15 | 16 | `npm run build` The app are built and served. 17 | 18 | `npm run ssr` The app are built into a static site (Static-Site Generation) and served. 19 | 20 | --- 21 | 22 | Checkout [vite-plugin-react-pages](https://github.com/vitejs/vite-plugin-react-pages) for more info. 23 | -------------------------------------------------------------------------------- /packages/create-project/template-app/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | *.local -------------------------------------------------------------------------------- /packages/create-project/template-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 📘Vite Pages 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/create-project/template-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-demo", 3 | "version": "1.0.2", 4 | "private": true, 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite serve", 8 | "build": "rimraf dist && vite build --outDir dist && serve -s dist", 9 | "ssr": "rimraf dist && vite-pages ssr && serve dist" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "react": "^18.2.0", 16 | "react-dom": "^18.2.0", 17 | "react-router-dom": "^6.21.3" 18 | }, 19 | "devDependencies": { 20 | "@mdx-js/react": "^3.0.0", 21 | "@types/node": "^20.11.5", 22 | "@types/react": "^18.2.48", 23 | "@vitejs/plugin-react": "^4.2.1", 24 | "rimraf": "^5.0.5", 25 | "serve": "^14.2.1", 26 | "vite": "^5.0.12", 27 | "vite-pages-theme-doc": "^5.0.0", 28 | "vite-plugin-react-pages": "^5.0.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/create-project/template-app/pages/$.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Index Page Title 3 | --- 4 | 5 | import README from '../README.md' 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/create-project/template-app/pages/_theme.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { createTheme, defaultSideNavs } from 'vite-pages-theme-doc' 3 | 4 | export default createTheme({ 5 | logo:
📘 Vite Pages
, 6 | topNavs: [ 7 | { label: 'Home', path: '/' }, 8 | { label: 'Users', path: '/users', activeIfMatch: '/users' }, 9 | { 10 | label: 'Guide', 11 | path: '/guide/introduce', 12 | activeIfMatch: '/guide', 13 | }, 14 | { 15 | label: 'Reference', 16 | path: '/reference/glossary', 17 | activeIfMatch: '/reference', 18 | }, 19 | { label: 'Vite', href: 'https://github.com/vitejs/vite' }, 20 | { 21 | label: 'Vite Pages', 22 | href: 'https://github.com/vitejs/vite-plugin-react-pages', 23 | }, 24 | ], 25 | sideNavs: (ctx) => { 26 | return defaultSideNavs(ctx, { 27 | groupConfig: { 28 | reference: { 29 | concepts: { 30 | label: 'Concepts', 31 | order: 1, 32 | }, 33 | 'cli-commands': { 34 | label: 'CLI Commands', 35 | order: 2, 36 | }, 37 | 'error-codes': { 38 | label: 'Error Codes', 39 | order: 3, 40 | }, 41 | }, 42 | }, 43 | }) 44 | }, 45 | }) 46 | -------------------------------------------------------------------------------- /packages/create-project/template-app/pages/guide/introduce$.md: -------------------------------------------------------------------------------- 1 | # Introduction -------------------------------------------------------------------------------- /packages/create-project/template-app/pages/guide/react/build$.md: -------------------------------------------------------------------------------- 1 | # Build -------------------------------------------------------------------------------- /packages/create-project/template-app/pages/guide/react/deploy$.md: -------------------------------------------------------------------------------- 1 | # Deploy -------------------------------------------------------------------------------- /packages/create-project/template-app/pages/guide/react/develop$.md: -------------------------------------------------------------------------------- 1 | # Develop -------------------------------------------------------------------------------- /packages/create-project/template-app/pages/guide/react/getting-started/FirstExample.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import style from './index.module.css' 3 | 4 | interface Props {} 5 | 6 | const FirstExample: React.FC = (props) => { 7 | return ( 8 |