-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init search * refactor(theme-doc): share pageGroups analysis * search data with group info * improve name * improve code style * save work * upgrade deps * no loger need @types/react-router-dom * upgrade react-dom usage * update deps * keep rollup version align with vite * migrate to react-router v6 * fix ts error * dev mode works * tweak ssr * run types-react-codemod * fix ssr * fix types * simplify ssr config * migrate DemoMdxPlugin to mdx 2.x * TsInfoMdxPlugin works with mdx 2.x * FileTextMdxPlugin works with mdx 2.x * replace ImageMdxPlugin with remcohaszing/remark-mdx-images * add comment * fix routes and topBar links * disable search for now * remove theme-basic * don't need linkBins * chore: publish 4.0.0-alpha.0 * update create-project templates * chore: publish 4.0.0-alpha.1 * fix optimizeDeps * bump deps of templates * fix mdx code tag render * fix antd style * chore: publish alpha * works in node commonjs * fix ssr issue: commonjs interop * tweak test timout * update pnpm.lock * fix ci: taskkill error https://pipelines.actions.githubusercontent.com/serviceHosts/994468f0-9514-4a95-bb54-d52b4298100c/_apis/pipelines/1/runs/209/signedlogcontent/5?urlExpires=2022-11-24T15%3A31%3A48.5125848Z&urlSigningMethod=HMACV1&urlSignature=ijfBRodz0%2FlGqMcPz3vwUYkLYFkU8vHeE2Lp2boZ2gk%3D * prepare to analyze outline info (table of content) at buildtime * tweak windows test ci * improve test-setup * fix ssr on windows * fix typo * outline info render * chore: publish alpha * fix outline render * improve demo * chore: publish alpha * fix import error in cjs env * chore: publish alpha * simplify demos * upgrade antd to 5.x * tweak demo * chore: publish alpha * fix theme style * chore: publish alpha * fix test * improve search * fix anchor link when using hash router * chore: publish alpha * fix ts error * chore: publish alpha * fix build * chore: publish alpha * fix import allPagesOutlines * chore: publish alpha * fix build * fix ci * fix anchor link scroll * improve demos * chore: publish alpha * fix cleanStaticData * OutlineInfoModuleManager should skip update it outline info didn't changed * headings (outlines) update should trigger hmr hot update instead of full reload * chore: publish alpha * make hmr works with mdx files workaround this issue: vitejs/vite-plugin-react#38 * don't show loading state when: - User navigates back to a loaded page. - Hmr update during dev. * improve file names * fix path * fix hydration layout change * chore: publish alpha * better name * update jotai and remove local copy * bundle client modules to reduce browser request during dev and avoid conflict npm package with users * update pnpm lock * jotai provider-less mode * experiment * chore: publish alpha * don't need to build client with tsc; cleanup * update deps * fix ts error * adapt to vite-plugin-react 3.0 breaking change: no longer do jsx transform to .md files * upgrade playwright test * chore: publish alpha * fix warning of useLayoutEffect during ssr * fix react warning * publish alpha * cleanup setup for doc * cleanup * warn for old mdx plugin * update lock * make setupPlugins the default export * update setup * improve vite setup * improve vite setup * update docs * publish alpha * prevent search popup scroll with page * improve mdx setup * fix outline layout * improve search popup style on narrow screen * publish alpha * add an option to turn off search * publish alpha * cleanup deps * improve antd ssr * fix ssr hydrate style flash * publish alpha * react-pages should not couple on @ant-design/cssinjs * alpha * use a rollup plugin to add style import to output bundles * implement a SSR plugin system to decouple vite-pages ssr from antd ssr steps * publish alpha * vite-pages-theme-doc have "type": "module" * pub * support ssr plugin to let user hook into the ssr process * improve ssr plugin * improve ssr plugin system: no longer need vite plugin * improve ssr plugin * fix ssr plugin * fix outline style * cleanup * update deps * remove vite-plugin-mdx * fix cleanStaticData * fix demo * fix demos * publish alpha * update contributing guide * feat: minify html for ssg mode (#102) * feat: minify html for ssg * chore: format Co-authored-by: 阿良仔 <[email protected]>
- Loading branch information
1 parent
ebda73c
commit a295d29
Showing
169 changed files
with
6,637 additions
and
6,823 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import React from 'react' | ||
import { Redirect } from 'react-router-dom' | ||
import { Navigate } from 'react-router-dom' | ||
|
||
const Component404 = () => { | ||
return <Redirect to="/" /> | ||
return <Navigate to="/" replace /> | ||
} | ||
|
||
export default Component404 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
doc-site/pages/upgrade-from-v2$.mdx → doc-site/pages/upgrade-from-v2-to-v3$.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
title: Upgrade from v3 to v4 | ||
order: 1 | ||
subGroup: upgrade-guides | ||
--- | ||
|
||
# Upgrade from v3 to v4 | ||
|
||
vite-pages v4 is released with following improvements: | ||
|
||
- Support [Vite v4](https://vitejs.dev/guide/migration.html). | ||
- Upgrade React to [18.x](https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html). | ||
- Upgrade react-router to [6.x](https://reactrouter.com/en/main/upgrading/v5). | ||
- Upgrade mdx to [2.x](https://mdxjs.com/migrating/v2/). | ||
- Upgrade antd to [5.x](https://ant.design/docs/react/migration-v5) (for vite-pages-theme-doc). | ||
- Support [Node.js ECMAScript modules](https://nodejs.org/api/esm.html). | ||
- Support markdown outline (table of content). | ||
- Support search. | ||
|
||
![outline-and-search](./_assets/outline-and-search.jpg) | ||
|
||
The following article will show you the migrate instructions. If you encounter problems, open an issue in the repo. Or checkout the [getting-stated templates](https://vitejs.github.io/vite-plugin-react-pages/#getting-stated) for reference. | ||
|
||
## Upstream libraries migration | ||
|
||
Most upgrade work for upstream libraries is already done inside `vite-plugin-react-pages` and `vite-pages-theme-doc`. But some migration need to be done in userland, if you are using some old APIs that are dropped by these upstream libraries. For example, you can no longer use `<Switch>` of `react-router`. Checkout the links above for the migration guides of upstream libraries. | ||
|
||
We expect upstream libraries migration to be very easy for framwork users, unless you used many `react-router` v5-only APIs. | ||
|
||
## Remove vite-plugin-mdx | ||
|
||
Since `vite-plugin-mdx` doesn't support mdx v2, vite-pages now includes a builtin mdx plugin. So you should remove the `vite-plugin-mdx` in vite-pages v5. | ||
|
||
Update `vite.config.ts`: | ||
|
||
```diff | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
- import mdx from 'vite-plugin-mdx' | ||
import pages from 'vite-plugin-react-pages' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
react(), | ||
- mdx(), | ||
pages() | ||
], | ||
}) | ||
``` | ||
|
||
Notice that `pages()` now return an array of vite plugins(instead of return a plugin). But vite can understand that and apply every plugin in that array. So the invoke pattern of `vite-plugin-react-pages` looks exactly the same as before! You don't need to apply the new builtin mdx plugin manually. | ||
|
||
Update `package.json`: | ||
|
||
- Remove `vite-plugin-mdx` and `@mdx-js/mdx`. | ||
- You should upgrade `@mdx-js/react` to `^2.1.5`. It is a peerDependencies of mdx, so it should be installed by your vite project. | ||
|
||
```diff | ||
{ | ||
"devDependencies": { | ||
- "@mdx-js/mdx": "^1.6.22", | ||
- "vite-plugin-mdx": "^3.5.11", | ||
- "@mdx-js/react": "^1.6.22", | ||
+ "@mdx-js/react": "^2.1.5", | ||
} | ||
} | ||
``` | ||
|
||
## Use Node.js ECMAScript modules | ||
|
||
The Node.js community is quickly migrating from CommonJS to ECMAScript modules (esm). And we encourage you to run vite on the esm mode of Node.js. | ||
|
||
How to enable esm for Node.js? Just add a `"type": "module"` field to the `package.json` of your vite project! | ||
|
||
> It is encouraged to have a dedicated `package.json` for your vite project. Your vite project should not share a `package.json` with the npm package that you are publishing (or the worspace package in the project root directory, if you are using monorepo). |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.