-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove vuepress-vite and vuepress-webpack package and support -…
…-bundler option
- Loading branch information
1 parent
16e80b1
commit c12e310
Showing
30 changed files
with
177 additions
and
232 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 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
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
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,60 @@ | ||
import type { Bundler } from '@vuepress/core' | ||
import { colors, logger } from '@vuepress/utils' | ||
|
||
export const resolveBundler = async ( | ||
bundler: 'vite' | 'webpack' | undefined, | ||
): Promise<Bundler> => { | ||
if (bundler === 'vite') { | ||
try { | ||
const { viteBundler } = await import('@vuepress/bundler-vite') | ||
|
||
return viteBundler() | ||
} catch (e) { | ||
logger.error( | ||
`You need to install dependency ${colors.magenta( | ||
'@vuepress/bundler-vite', | ||
)} to use vite bundler.`, | ||
) | ||
|
||
throw e | ||
} | ||
} | ||
|
||
if (bundler === 'webpack') { | ||
try { | ||
const { webpackBundler } = await import('@vuepress/bundler-webpack') | ||
|
||
return webpackBundler() | ||
} catch (e) { | ||
logger.error( | ||
`You need to install dependency ${colors.magenta( | ||
'@vuepress/bundler-webpack', | ||
)} to use webpack bundler.`, | ||
) | ||
|
||
throw e | ||
} | ||
} | ||
|
||
if (bundler) throw new Error(`Unsupported bundler: ${bundler}`) | ||
|
||
try { | ||
const { viteBundler } = await import('@vuepress/bundler-vite') | ||
|
||
return viteBundler() | ||
} catch (e) { | ||
try { | ||
const { webpackBundler } = await import('@vuepress/bundler-webpack') | ||
|
||
return webpackBundler() | ||
} catch (e) { | ||
logger.error( | ||
`You need to install a bundler, choose from ${colors.magenta( | ||
'@vuepress/bundler-vite', | ||
)} and ${colors.magenta('@vuepress/bundler-webpack')}.`, | ||
) | ||
|
||
throw e | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.