From 5f9d3564bfad3c50f050c92efde0e7d712fefffe Mon Sep 17 00:00:00 2001 From: winixt Date: Tue, 5 Apr 2022 19:44:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=20html=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=E4=B8=8E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/configs/sidebar/zh.ts | 1 + docs/zh/guide/builder.md | 15 +++- docs/zh/guide/template.md | 68 +++++++++---------- docs/zh/guide/upgrade2.1.md | 22 ++++++ docs/zh/reference/config/README.md | 9 ++- .../fes-build-vite/src/commands/dev/index.js | 6 -- .../fes-build-vite/src/common/getConfig.js | 1 + .../plugins/commands/webpackConfig/html.js | 18 +++-- .../commands/webpackConfig/index-default.html | 4 +- packages/fes-plugin-windicss/package.json | 2 + packages/fes-plugin-windicss/src/index.js | 68 ++++++++++++------- packages/fes-preset-built-in/src/index.js | 1 + .../src/plugins/features/proxy.js | 3 +- .../src/plugins/features/title.js | 10 +++ .../core/plugin/pluginRegister.tpl | 16 ++++- packages/fes-template-h5/.env | 1 + packages/fes-template-h5/index.html | 27 ++++++++ packages/fes-template-h5/public/index.html | 18 ----- packages/fes-template-vite/index.html | 2 +- packages/fes-template-vite/package.json | 1 + packages/fes-template/{public => }/index.html | 11 ++- packages/fes/src/cli.js | 1 - packages/fes/src/serviceWithBuiltIn.js | 9 +-- packages/fes/src/utils/fork.js | 14 ++-- packages/fes/src/utils/getCwd.js | 2 +- packages/fes/types.d.ts | 1 + yarn.lock | 17 ++++- 27 files changed, 226 insertions(+), 122 deletions(-) create mode 100644 docs/zh/guide/upgrade2.1.md create mode 100644 packages/fes-preset-built-in/src/plugins/features/title.js create mode 100644 packages/fes-template-h5/.env create mode 100644 packages/fes-template-h5/index.html delete mode 100644 packages/fes-template-h5/public/index.html rename packages/fes-template/{public => }/index.html (76%) diff --git a/docs/.vuepress/configs/sidebar/zh.ts b/docs/.vuepress/configs/sidebar/zh.ts index e46b036d5..252dba2bd 100644 --- a/docs/.vuepress/configs/sidebar/zh.ts +++ b/docs/.vuepress/configs/sidebar/zh.ts @@ -23,6 +23,7 @@ export const zh: SidebarConfig = { '/zh/guide/plugin.md', '/zh/guide/template.md', '/zh/guide/mock.md', + '/zh/guide/upgrade2.1.md', ] }, { diff --git a/docs/zh/guide/builder.md b/docs/zh/guide/builder.md index d76e64df6..fbe9c1e91 100644 --- a/docs/zh/guide/builder.md +++ b/docs/zh/guide/builder.md @@ -11,7 +11,7 @@ ### 配置 -Webpack 和 Vite 构建在配置方面有一些差异,具体可以查阅[配置](../reference/config)。 +Webpack 和 Vite 构建在配置方面有一些差异,具体可以查看[配置](../reference/config)。 ### 静态文件处理 @@ -20,3 +20,16 @@ Webpack 和 Vite 构建在配置方面有一些差异,具体可以查阅[配 ### html 模版 Webpack 对于 html 模版是没有什么限制的,而 Vite 推荐模版文件就放在项目根目录下。Webpack 有个非常强大的 [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin),Fes.js 引入了[vite-plugin-html](https://github.com/vbenjs/vite-plugin-html) 进行能力的对齐,如果开发者想要个性化定制模版,那么在配置上还是存在差异的。 + +## 升级 2.1.x + +### 不变更构建方式 + +直接添加 Webpack 构建依赖包即可: `npm i @fesjs/build-webpack -D`。 + +### 换成 Vite + +1. 安装依赖包 `npm i @fesjs/build-vite`。 +2. 将 Webpack 相关的配置换成 Vite,具体可查看[配置](../reference/config)。 +3. 将 html 模版文件从 `public/index.html` 挪到项目根目录,如果有相应的 [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) 配置,需要改成 [vite-plugin-html](https://github.com/vbenjs/vite-plugin-html) 的写法。 +4. 将 `require` 等 Vite 不支持的代码,改写成 Vite 支持的方式。 diff --git a/docs/zh/guide/template.md b/docs/zh/guide/template.md index 1f7d85eea..d03628a4c 100644 --- a/docs/zh/guide/template.md +++ b/docs/zh/guide/template.md @@ -1,56 +1,52 @@ # HTML 模板 -Fes.js 基于 [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) 实现的模板功能,默认模板内容是: +Fes.js 默认模板内容是: + ```html - - - - - <%= htmlWebpackPlugin.options.title %> - - -
- + + + + + <%= title %> + + +
+ ``` -## 自定义模板 -在 `src/public` 文件夹中创建`index.html`,Fes.js 约定如果这个文件存在,则会替换默认模板。 - -## 模板配置 -在配置文件(`.fes.js`)中配置 `html`,把[配置](https://github.com/jantimon/html-webpack-plugin#options)的对象作为参数传入 `html-webpack-plugin` 实例。 +## 修改页面标题 -举个 :chestnut: : ```js +// .fes.js export default { - html: { - title: '海贼王' - } -} + title: '这是页面标题', +}; ``` -页面的标题会设置成'海贼王'。 -## 模板变量 -当然我们也可以手动编写模板,在模板中添加`link`、`link`、`meta`等标签。在我们手动配置模板时,有时候需要用到一些环境变量,模板里可以获取到的变量如下: +页面的标题会设置成 `这是页面标题`。 -- **htmlWebpackPlugin**,特定于此插件的数据 -- **webpackConfig**,用于此编译的webpack配置。例如,它可用于获取publicPath(webpackConfig.output.publicPath)。 -- **compilation**,webpack编译对象。例如,可以使用它来获取已处理资产的内容,并将其直接内联到页面中compilation.assets[...].source() +## 模板变量 -举个 🌰 : -```html - -``` +模版中可以使用的变量: -除上述 `html-webpack-plugin` 插件提供的变量外,Fes.js 还把 `process.env` 中的环境变量添加到模板作用域内: -- `NODE_ENV` -- `FES_ENV` -- `.env` 文件中以 `FES_APP_` 开头的变量 +- `NODE_ENV`: Node.js 环境变量 +- `FES_ENV`: Fes.js 环境变量 +- `BASE_URL`: publicPath +- `.env.**`: 文件中以 `FES_APP_` 开头的变量 举个 🌰 : +```env +# .env +FES_APP_HELLO_WORLD=hello world +``` + ```html - -``` \ No newline at end of file + + +
<%= FES_APP_HELLO_WORLD %>
+ +``` diff --git a/docs/zh/guide/upgrade2.1.md b/docs/zh/guide/upgrade2.1.md new file mode 100644 index 000000000..5c3e3995a --- /dev/null +++ b/docs/zh/guide/upgrade2.1.md @@ -0,0 +1,22 @@ +# 从 2.0.x 迁移到 2.1.x + +## 版本 2.1.x 的 break + +1. 编译时的 [base](../reference/config/#base) 配置,移到了 [router.base](../reference/config/#router) 下 + +## 相关插件 + +由于需要兼容 Vite 的写法,插件也做了相关代码调整, + +## 不变更构建方式 + +1. 添加 Webpack 构建依赖包: `npm i @fesjs/build-webpack -D`。 +2. 如果有,将 `public/index.html` 文件挪到项目根目录,移除 [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) 相关配置,具体模版变量使用请查看[HTML 模版](../guide/template.html)。 + +## 换成 Vite + +1. 安装依赖包 `npm i @fesjs/build-vite`。 +2. 将 Webpack 相关的配置换成 Vite,具体可查看[配置](../reference/config)。 +3. 将 html 模版文件从 `public/index.html` 挪到项目根目录,如果有相应的 [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) 配置,需要改成 [vite-plugin-html](https://github.com/vbenjs/vite-plugin-html) 的写法。 +4. 将 `require` 等 Vite 不支持的代码,改写成 Vite 支持的方式。 +5. 由于需要兼容 Vite 写法,相关插件也做了相关调整,因此依赖的插件都需要升级最新的版本。如果用了 [@fesjs/plugin-sass](../reference/plugin/plugins/sass.html) 插件,直接移除,手动安装 `sass` 依赖即可。 diff --git a/docs/zh/reference/config/README.md b/docs/zh/reference/config/README.md index 7fed58e75..92d59d286 100644 --- a/docs/zh/reference/config/README.md +++ b/docs/zh/reference/config/README.md @@ -213,7 +213,7 @@ export default { ### router - 类型: `object` -- 默认值: `{ mode: 'hash' }` +- 默认值: `{ mode: 'hash', base: '/' }` - 详情: 配置路由,具体请查看指南中关于路由的介绍 @@ -282,6 +282,13 @@ const defaultTerserOptions = { 配置 [压缩器 terser 的配置项](https://github.com/terser/terser#minify-options) +### title + +- 类型: `string` +- 详情: + + html 页面标题 + ## webpack 专属配置 ### analyze diff --git a/packages/fes-build-vite/src/commands/dev/index.js b/packages/fes-build-vite/src/commands/dev/index.js index d1efea0a1..1f4be4233 100644 --- a/packages/fes-build-vite/src/commands/dev/index.js +++ b/packages/fes-build-vite/src/commands/dev/index.js @@ -1,12 +1,6 @@ import { createServer } from 'vite'; import getDevConfig from './getDevConfig'; -/** - * TODO - * - * 共享 webpack 和 vite 的部分配置,降低熟悉 vite 的成本 - */ - export default (api) => { const { paths, diff --git a/packages/fes-build-vite/src/common/getConfig.js b/packages/fes-build-vite/src/common/getConfig.js index 455dda342..f357e9282 100644 --- a/packages/fes-build-vite/src/common/getConfig.js +++ b/packages/fes-build-vite/src/common/getConfig.js @@ -28,6 +28,7 @@ export function getInnerCommonConfig(api) { inject: { data: { ...resolveRuntimeEnv(publicPath), + title: api.config.title || 'Fes.js', mountElementId: api.config.mountElementId, }, }, diff --git a/packages/fes-build-webpack/src/plugins/commands/webpackConfig/html.js b/packages/fes-build-webpack/src/plugins/commands/webpackConfig/html.js index 748019cb2..8c8d45ec3 100644 --- a/packages/fes-build-webpack/src/plugins/commands/webpackConfig/html.js +++ b/packages/fes-build-webpack/src/plugins/commands/webpackConfig/html.js @@ -4,11 +4,13 @@ import { winPath, resolveRuntimeEnv } from '@fesjs/utils'; export default async function createHtmlWebpackConfig({ api, cwd, config, webpackConfig, headScripts, isProd, publicPath }) { const htmlOptions = { - title: 'fes.js', filename: '[name].html', ...config.html, - templateParameters: resolveRuntimeEnv(publicPath), - mountElementId: config.mountElementId, + templateParameters: { + title: config.html?.title || api.config.title || 'Fes.js', + ...resolveRuntimeEnv(publicPath), + mountElementId: config.mountElementId, + }, }; if (isProd) { @@ -24,7 +26,7 @@ export default async function createHtmlWebpackConfig({ api, cwd, config, webpac }); } - const htmlPath = join(cwd, 'public/index.html'); + const htmlPath = join(cwd, 'index.html'); const defaultHtmlPath = resolve(__dirname, 'index-default.html'); const publicCopyIgnore = []; @@ -45,10 +47,12 @@ export default async function createHtmlWebpackConfig({ api, cwd, config, webpac if (_fileName !== 'index.html') { const _htmlOptions = { ...config.html, - title: route?.meta?.title || config.html.title || 'fes.js', filename: _fileName, - templateParameters: resolveRuntimeEnv(publicPath), - mountElementId: config.mountElementId, + templateParameters: { + title: route?.meta?.title || config.html.title || api.config.title || 'fes.js', + ...resolveRuntimeEnv(publicPath), + mountElementId: config.mountElementId, + }, }; webpackConfig.plugin(_fileName).use(require.resolve('html-webpack-plugin'), [_htmlOptions]); } diff --git a/packages/fes-build-webpack/src/plugins/commands/webpackConfig/index-default.html b/packages/fes-build-webpack/src/plugins/commands/webpackConfig/index-default.html index cdbba45cc..03ea283f8 100644 --- a/packages/fes-build-webpack/src/plugins/commands/webpackConfig/index-default.html +++ b/packages/fes-build-webpack/src/plugins/commands/webpackConfig/index-default.html @@ -6,12 +6,12 @@ - <%= htmlWebpackPlugin.options.title %> + <%= title %> -
+
\ No newline at end of file diff --git a/packages/fes-plugin-windicss/package.json b/packages/fes-plugin-windicss/package.json index 2d2f14718..1ff3e60c2 100644 --- a/packages/fes-plugin-windicss/package.json +++ b/packages/fes-plugin-windicss/package.json @@ -31,6 +31,8 @@ "vue": "^3.0.5" }, "dependencies": { + "vite-plugin-windicss": "^1.8.3", + "windicss": "^3.5.1", "windicss-webpack-plugin": "^1.6.0" }, "typings": "./types.d.ts" diff --git a/packages/fes-plugin-windicss/src/index.js b/packages/fes-plugin-windicss/src/index.js index 004ac82d8..dea921a40 100644 --- a/packages/fes-plugin-windicss/src/index.js +++ b/packages/fes-plugin-windicss/src/index.js @@ -1,35 +1,25 @@ -import WindiCSSWebpackPlugin from 'windicss-webpack-plugin'; +import WindiCSS from 'vite-plugin-windicss'; import { name } from '../package.json'; -export default (api) => { - api.describe({ - key: 'windicss', +function getWindicssConfig(api) { + const { config, ...otherOption } = api.config.windicss; + return { config: { - schema(joi) { - return joi.object(); + extract: { + // A common use case is scanning files from the root directory + include: ['**/*.{vue,jsx,js,ts,tsx}'], + // if you are excluding files, make sure you always include node_modules and .git + exclude: ['node_modules', '.git', 'dist', '.fes'], }, - default: {}, + ...config, }, - }); - - api.addEntryImportsAhead(() => [{ source: 'windi-base.css' }, { source: 'windi-components.css' }, { source: 'windi-utilities.css' }]); + ...otherOption, + }; +} +function buildWindicssWithWebpack(api) { api.chainWebpack((memo, { createCSSRule }) => { - const { config, ...otherOption } = api.config.windicss; - memo.plugin('windicss').use(WindiCSSWebpackPlugin, [ - { - config: { - extract: { - // A common use case is scanning files from the root directory - include: ['**/*.{vue,jsx,js,ts,tsx}'], - // if you are excluding files, make sure you always include node_modules and .git - exclude: ['node_modules', '.git', 'dist', '.fes'], - }, - ...config, - }, - ...otherOption, - }, - ]); + memo.plugin('windicss').use(require('windicss-webpack-plugin'), [getWindicssConfig(api)]); if (api.env === 'development') { memo.module.rule('css').test((path) => { if (path.endsWith('windi-utilities.css')) { @@ -48,6 +38,34 @@ export default (api) => { return memo; }); +} + +function buildWindicssWithVite(api) { + api.modifyBundleConfig((memo) => { + memo.plugins.push(WindiCSS(getWindicssConfig(api).config)); + + return memo; + }); +} + +export default (api) => { + api.describe({ + key: 'windicss', + config: { + schema(joi) { + return joi.object(); + }, + default: {}, + }, + }); + + api.addEntryImportsAhead(() => [{ source: 'windi-base.css' }, { source: 'windi-components.css' }, { source: 'windi-utilities.css' }]); + + if (api.builder.isVite) { + buildWindicssWithVite(api); + } else { + buildWindicssWithWebpack(api); + } api.addConfigType(() => ({ source: name, diff --git a/packages/fes-preset-built-in/src/index.js b/packages/fes-preset-built-in/src/index.js index 593082af9..19d3bd753 100644 --- a/packages/fes-preset-built-in/src/index.js +++ b/packages/fes-preset-built-in/src/index.js @@ -28,6 +28,7 @@ export default function () { require.resolve('./plugins/features/singular'), require.resolve('./plugins/features/targets'), require.resolve('./plugins/features/terserOptions'), + require.resolve('./plugins/features/title'), // route require.resolve('./plugins/route'), diff --git a/packages/fes-preset-built-in/src/plugins/features/proxy.js b/packages/fes-preset-built-in/src/plugins/features/proxy.js index 795e7e89e..2fe3d6305 100644 --- a/packages/fes-preset-built-in/src/plugins/features/proxy.js +++ b/packages/fes-preset-built-in/src/plugins/features/proxy.js @@ -2,7 +2,7 @@ import { extname } from 'path'; import historyFallback from 'connect-history-api-fallback'; const ASSET_EXT_NAMES = ['.ico', '.png', '.jpg', '.jpeg', '.gif', '.svg']; -const SKIP_PATHS_PREFIX = ['/@vite', '/@id']; +const SKIP_PATHS_PREFIX = ['/@']; const proxyMiddleware = (api) => (req, res, next) => { const proxyConfig = api.config.proxy; @@ -15,6 +15,7 @@ const proxyMiddleware = (api) => (req, res, next) => { if (ASSET_EXT_NAMES.includes(extname(req.url))) { return next(); } + const history = historyFallback(); history(req, res, next); }; diff --git a/packages/fes-preset-built-in/src/plugins/features/title.js b/packages/fes-preset-built-in/src/plugins/features/title.js new file mode 100644 index 000000000..9752385c2 --- /dev/null +++ b/packages/fes-preset-built-in/src/plugins/features/title.js @@ -0,0 +1,10 @@ +export default (api) => { + api.describe({ + key: 'title', + config: { + schema(joi) { + return joi.string(); + }, + }, + }); +}; diff --git a/packages/fes-preset-built-in/src/plugins/generateFiles/core/plugin/pluginRegister.tpl b/packages/fes-preset-built-in/src/plugins/generateFiles/core/plugin/pluginRegister.tpl index 7c530a392..d69f0ffaf 100644 --- a/packages/fes-preset-built-in/src/plugins/generateFiles/core/plugin/pluginRegister.tpl +++ b/packages/fes-preset-built-in/src/plugins/generateFiles/core/plugin/pluginRegister.tpl @@ -3,12 +3,22 @@ import { plugin } from './plugin'; import * as Plugin_{{{ index }}} from '{{{ path }}}'; {{/plugins}} -// 避免编译警告 -const defaultKey = 'default'; +function handleDefaultExport(pluginExports) { + // 避免编译警告 + const defaultKey = 'default'; + if (pluginExports[defaultKey]) { + const {default: defaultExport, ...otherExports} = pluginExports; + return { + ...defaultExport, + ...otherExports + } + } + return pluginExports; +} {{#plugins}} plugin.register({ - apply: {...Plugin_{{{ index }}}[defaultKey], ...Plugin_{{{ index }}}}, + apply: handleDefaultExport(Plugin_{{{ index }}}), path: '{{{ path }}}', }); {{/plugins}} diff --git a/packages/fes-template-h5/.env b/packages/fes-template-h5/.env new file mode 100644 index 000000000..94f1bde4e --- /dev/null +++ b/packages/fes-template-h5/.env @@ -0,0 +1 @@ +FES_APP_HELLO_WORLD=hello world diff --git a/packages/fes-template-h5/index.html b/packages/fes-template-h5/index.html new file mode 100644 index 000000000..0584633e9 --- /dev/null +++ b/packages/fes-template-h5/index.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + <%= title %> + + + + + +
+ <%= FES_APP_HELLO_WORLD %> +
+
+ + + + \ No newline at end of file diff --git a/packages/fes-template-h5/public/index.html b/packages/fes-template-h5/public/index.html deleted file mode 100644 index 750a5c09a..000000000 --- a/packages/fes-template-h5/public/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - <%= htmlWebpackPlugin.options.title %> - - - -
- - - diff --git a/packages/fes-template-vite/index.html b/packages/fes-template-vite/index.html index bdb42527e..e90f0a408 100644 --- a/packages/fes-template-vite/index.html +++ b/packages/fes-template-vite/index.html @@ -11,7 +11,7 @@ - Fes & vite + <%= title %> diff --git a/packages/fes-template-vite/package.json b/packages/fes-template-vite/package.json index d8ffef55a..57e74c429 100644 --- a/packages/fes-template-vite/package.json +++ b/packages/fes-template-vite/package.json @@ -48,6 +48,7 @@ "@fesjs/fes": "^2.0.0", "@fesjs/plugin-icon": "^2.0.0", "@fesjs/plugin-request": "^2.0.0", + "@fesjs/plugin-windicss": "^2.0.8", "@fesjs/build-vite": "^1.0.0", "vue": "^3.2.2" }, diff --git a/packages/fes-template/public/index.html b/packages/fes-template/index.html similarity index 76% rename from packages/fes-template/public/index.html rename to packages/fes-template/index.html index f61a43d60..02276de9c 100644 --- a/packages/fes-template/public/index.html +++ b/packages/fes-template/index.html @@ -1,15 +1,20 @@ + - <%= htmlWebpackPlugin.options.title %> + + <%= title %> + + -
+
- + + \ No newline at end of file diff --git a/packages/fes/src/cli.js b/packages/fes/src/cli.js index 99fc3b39b..7fd116728 100644 --- a/packages/fes/src/cli.js +++ b/packages/fes/src/cli.js @@ -17,7 +17,6 @@ function checkNodeVersion(wanted, id) { checkNodeVersion(requiredVersion, '@fesjs/fes'); -// process.argv: [node, fes.js, command, args] const rawArgv = process.argv.slice(2); const args = yParser(rawArgv); diff --git a/packages/fes/src/serviceWithBuiltIn.js b/packages/fes/src/serviceWithBuiltIn.js index b71038fc8..afb5b7ac9 100644 --- a/packages/fes/src/serviceWithBuiltIn.js +++ b/packages/fes/src/serviceWithBuiltIn.js @@ -8,16 +8,13 @@ import { Service as CoreService } from '@fesjs/compiler'; class Service extends CoreService { constructor(opts) { - process.env.FES_VERSION = require('../package').version; + process.env.FES_VERSION = require('../package.json').version; process.env.FES_DIR = dirname(require.resolve('../package')); super({ ...opts, - presets: [ - require.resolve('@fesjs/preset-built-in'), - ...(opts.presets || []) - ], - plugins: [...(opts.plugins || [])] + presets: [require.resolve('@fesjs/preset-built-in'), ...(opts.presets || [])], + plugins: [...(opts.plugins || [])], }); } } diff --git a/packages/fes/src/utils/fork.js b/packages/fes/src/utils/fork.js index 43a2d0858..20d8e59d7 100644 --- a/packages/fes/src/utils/fork.js +++ b/packages/fes/src/utils/fork.js @@ -1,15 +1,11 @@ -import { - fork -} from 'child_process'; +import { fork } from 'child_process'; const usedPorts = []; let CURRENT_PORT; -export default function start({ - scriptPath -}) { +export default function start({ scriptPath }) { const execArgv = process.execArgv.slice(0); - const inspectArgvIndex = execArgv.findIndex(argv => argv.includes('--inspect-brk'),); + const inspectArgvIndex = execArgv.findIndex((argv) => argv.includes('--inspect-brk')); if (inspectArgvIndex > -1) { const inspectArgv = execArgv[inspectArgvIndex]; @@ -39,7 +35,7 @@ export default function start({ } const child = fork(scriptPath, process.argv.slice(2), { - execArgv + execArgv, }); child.on('message', (data) => { @@ -47,7 +43,7 @@ export default function start({ if (type === 'RESTART') { child.kill(); start({ - scriptPath + scriptPath, }); } else if (type === 'UPDATE_PORT') { // set current used port diff --git a/packages/fes/src/utils/getCwd.js b/packages/fes/src/utils/getCwd.js index 325cd8c60..a25453145 100644 --- a/packages/fes/src/utils/getCwd.js +++ b/packages/fes/src/utils/getCwd.js @@ -3,7 +3,7 @@ import { join, isAbsolute } from 'path'; export default () => { const cwd = process.cwd(); if (process.env.APP_ROOT) { - // avoid repeat cwd path + // avoid repeat cwd path if (!isAbsolute(process.env.APP_ROOT)) { return join(cwd, process.env.APP_ROOT); } diff --git a/packages/fes/types.d.ts b/packages/fes/types.d.ts index 548e1afcf..d7a5224f4 100644 --- a/packages/fes/types.d.ts +++ b/packages/fes/types.d.ts @@ -107,6 +107,7 @@ interface InnerBuildConfig { singular?: boolean; targets?: object; terserOptions?: object; + title?: string; } export function defineBuildConfig(config: InnerBuildConfig & PluginBuildConfig ): InnerBuildConfig & PluginBuildConfig; diff --git a/yarn.lock b/yarn.lock index 314980c26..595059460 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3588,7 +3588,7 @@ jiti "^1.13.0" windicss "^3.5.1" -"@windicss/plugin-utils@^1.8.2": +"@windicss/plugin-utils@1.8.3", "@windicss/plugin-utils@^1.8.2": version "1.8.3" resolved "https://registry.npmmirror.com/@windicss/plugin-utils/-/plugin-utils-1.8.3.tgz#cec2bdc7703357de348e4512d61c7bd7802b049a" integrity sha512-emlMeDt73uNV1ZofLTDogcxqL9aZ5uIRYkjeHlrWiaDozFbX6Jc+a6eRo9Ieaar3JUryl6AnecTPHAiFDl4IXg== @@ -8925,6 +8925,11 @@ klona@^2.0.4: resolved "https://registry.npmmirror.com/klona/-/klona-2.0.5.tgz#d166574d90076395d9963aa7a928fabb8d76afbc" integrity sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ== +kolorist@^1.5.1: + version "1.5.1" + resolved "https://registry.npmmirror.com/kolorist/-/kolorist-1.5.1.tgz#c3d66dc4fabde4f6b7faa6efda84c00491f9e52b" + integrity sha512-lxpCM3HTvquGxKGzHeknB/sUjuVoUElLlfYnXZT73K8geR9jQbroGlSCFBax9/0mpGoD3kzcMLnOlGQPJJNyqQ== + lerna@^4.0.0: version "4.0.0" resolved "https://registry.npmmirror.com/lerna/-/lerna-4.0.0.tgz#b139d685d50ea0ca1be87713a7c2f44a5b678e9e" @@ -13389,6 +13394,16 @@ vite-plugin-html@^3.2.0: node-html-parser "^5.3.3" pathe "^0.2.0" +vite-plugin-windicss@^1.8.3: + version "1.8.3" + resolved "https://registry.npmmirror.com/vite-plugin-windicss/-/vite-plugin-windicss-1.8.3.tgz#d5fe923ad60f5d80f153a4fae5f837d56caa25cb" + integrity sha512-RIw2GD6H6cKNE8wZXVOBs4L1uTicVS0FaAkeqXvy1oyuXLC4SXmvnzEuoK0+qFuWJjW0ECNwE8eU+ZZhzNQKUg== + dependencies: + "@windicss/plugin-utils" "1.8.3" + debug "^4.3.3" + kolorist "^1.5.1" + windicss "^3.5.1" + vite@^2.8.6: version "2.9.1" resolved "https://registry.npmmirror.com/vite/-/vite-2.9.1.tgz#84bce95fae210a7beb566a0af06246748066b48f"