Skip to content

Commit

Permalink
feat: use modern compiler by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Aug 20, 2024
1 parent 5269931 commit 569a3ea
Show file tree
Hide file tree
Showing 9 changed files with 378 additions and 109 deletions.
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@vuepress/plugin-cache": "workspace:*",
"@vuepress/theme-default": "workspace:*",
"mathjax-full": "3.2.2",
"sass-embedded": "1.77.8",
"sass-loader": "^16.0.1",
"vue": "^3.4.38",
"vuepress": "2.0.0-rc.15"
Expand Down
9 changes: 9 additions & 0 deletions docs/plugins/development/sass-palette/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

This plugin is mainly facing plugin and theme developers, it is more powerful than [`@vuepress/plugin-palette`](../palette.md).

::: tip

You should manually install these deps in your project:

- When using Vite bundler: `sass-embedded`
- When using Webpack bundler: `sass-embedded` and `sass-loader`

:::

## Usage

You must invoke `useSassPalettePlugin` function during plugin initialization to use this plugin.
Expand Down
9 changes: 9 additions & 0 deletions docs/zh/plugins/development/sass-palette/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

这个插件主要面向插件和主题开发者,相比 [`@vuepress/plugin-palette`](../palette.md) 更加强大。

::: tip

你应该在你的项目中手动安装这些依赖:

- 当使用 Vite 打包工具时:`sass-embedded`
- 当使用 Webpack 打包工具时:`sass-embedded``sass-loader`

:::

## 使用

你必须在插件初始化期间调用 `useSassPalettePlugin` 函数来使用此插件。
Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@vuepress/plugin-theme-data": "workspace:*",
"@vuepress/plugin-watermark": "workspace:*",
"@vuepress/theme-default": "workspace:*",
"sass": "^1.77.8",
"sass-embedded": "1.77.8",
"sass-loader": "^16.0.1",
"vue": "^3.4.38",
"vuepress": "2.0.0-rc.15"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"eslint": "^9.9.0",
"eslint-config-vuepress": "^5.1.4",
"http-server": "^14.1.1",
"husky": "^9.1.4",
"husky": "^9.1.5",
"nano-staged": "^0.8.0",
"postcss-html": "^1.7.0",
"prettier": "^3.3.3",
Expand Down
13 changes: 10 additions & 3 deletions plugins/development/plugin-sass-palette/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,25 @@
},
"dependencies": {
"@vuepress/helper": "workspace:*",
"chokidar": "^3.6.0",
"sass": "^1.77.8"
"chokidar": "^3.6.0"
},
"devDependencies": {
"@vuepress/bundler-vite": "2.0.0-rc.15",
"@vuepress/bundler-webpack": "2.0.0-rc.15"
},
"peerDependencies": {
"sass-loader": "^16.0.0",
"sass": "^1.77.8",
"sass-embedded": "1.77.8",
"sass-loader": "^16.0.1",
"vuepress": "2.0.0-rc.15"
},
"peerDependenciesMeta": {
"sass": {
"optional": true
},
"sass-embedded": {
"optional": true
},
"sass-loader": {
"optional": true
}
Expand Down
416 changes: 333 additions & 83 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions themes/theme-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,21 @@
"@vuepress/plugin-sitemap": "workspace:*",
"@vuepress/plugin-theme-data": "workspace:*",
"@vueuse/core": "^11.0.1",
"sass": "^1.77.8",
"vue": "^3.4.38"
},
"peerDependencies": {
"sass-loader": "^16.0.0",
"sass": "^1.77.8",
"sass-embedded": "1.77.8",
"sass-loader": "^16.0.1",
"vuepress": "2.0.0-rc.15"
},
"peerDependenciesMeta": {
"sass": {
"optional": true
},
"sass-embedded": {
"optional": true
},
"sass-loader": {
"optional": true
}
Expand Down
24 changes: 5 additions & 19 deletions themes/theme-default/src/node/defaultTheme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import {
addViteConfig,
addViteOptimizeDepsExclude,
Expand Down Expand Up @@ -88,26 +87,12 @@ export const defaultTheme = ({
css: {
preprocessorOptions: {
sass: {
logger: {
warn: (message, { deprecation, deprecationType }) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (deprecation && deprecationType.id === 'mixed-decls')
return

console.warn(message)
},
},
api: 'modern-compiler',
silenceDeprecations: ['mixed-decls'],
},
scss: {
logger: {
warn: (message, { deprecation, deprecationType }) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (deprecation && deprecationType.id === 'mixed-decls')
return

console.warn(message)
},
},
api: 'modern-compiler',
silenceDeprecations: ['mixed-decls'],
},
},
},
Expand All @@ -120,6 +105,7 @@ export const defaultTheme = ({
...options,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
sassOptions: {
api: 'modern-compiler',
silenceDeprecations: ['mixed-decls'],
...options.sassOptions,
},
Expand Down

0 comments on commit 569a3ea

Please sign in to comment.