From 6f8d753ae0d9416c29fbe5940b0e869890011bd1 Mon Sep 17 00:00:00 2001 From: vben Date: Tue, 1 Dec 2020 21:02:37 +0800 Subject: [PATCH] chore: update deps --- build/utils.ts | 1 + .../plugin/transform/dynamic-import/index.ts | 5 +- index.html | 1 + package.json | 14 +- src/router/menus/modules/demo/comp.ts | 7 +- vite.config.ts | 101 +++------------ yarn.lock | 122 +++++++++--------- 7 files changed, 99 insertions(+), 152 deletions(-) diff --git a/build/utils.ts b/build/utils.ts index 86afb4b3..662cd123 100644 --- a/build/utils.ts +++ b/build/utils.ts @@ -102,6 +102,7 @@ export interface ViteEnv { VITE_USE_CDN: boolean; VITE_DROP_CONSOLE: boolean; VITE_BUILD_GZIP: boolean; + VITE_DYNAMIC_IMPORT: boolean; } // Read all environment variable configuration files to process.env diff --git a/build/vite/plugin/transform/dynamic-import/index.ts b/build/vite/plugin/transform/dynamic-import/index.ts index 7fd52379..fbe20b9b 100644 --- a/build/vite/plugin/transform/dynamic-import/index.ts +++ b/build/vite/plugin/transform/dynamic-import/index.ts @@ -12,7 +12,7 @@ function getPath(path: string) { return path.replace('src/views', ''); } -const dynamicImportTransform = function (env: any = {}): Transform { +const dynamicImportTransform = function (enableDynamicImport: boolean): Transform { return { test({ path }) { // Only convert the file @@ -22,8 +22,7 @@ const dynamicImportTransform = function (env: any = {}): Transform { ); }, transform({ code }) { - const { VITE_DYNAMIC_IMPORT } = env; - if (!VITE_DYNAMIC_IMPORT) { + if (!enableDynamicImport) { return code; } diff --git a/index.html b/index.html index 10e33a16..515d2521 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,7 @@ justify-content: center; align-items: center; flex-direction: column; + background: #f0f2f5; } .app-loading .app-loading-wrap { diff --git a/package.json b/package.json index 4fa309b3..17762210 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,10 @@ "path-to-regexp": "^6.2.0", "qrcode": "^1.4.4", "sortablejs": "^1.12.0", - "vditor": "^3.6.6", + "vditor": "^3.7.0", "vue": "^3.0.3", "vue-i18n": "^9.0.0-beta.8", - "vue-router": "^4.0.0-rc.5", + "vue-router": "^4.0.0-rc.6", "vue-types": "^3.0.1", "vuex": "^4.0.0-rc.2", "vuex-module-decorators": "^1.0.1", @@ -47,7 +47,7 @@ "devDependencies": { "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", - "@iconify/json": "^1.1.264", + "@iconify/json": "^1.1.266", "@ls-lint/ls-lint": "^1.9.2", "@purge-icons/generated": "^0.4.1", "@types/echarts": "^4.9.2", @@ -62,8 +62,8 @@ "@types/sortablejs": "^1.10.6", "@types/yargs": "^15.0.10", "@types/zxcvbn": "^4.4.0", - "@typescript-eslint/eslint-plugin": "^4.8.2", - "@typescript-eslint/parser": "^4.8.2", + "@typescript-eslint/eslint-plugin": "^4.9.0", + "@typescript-eslint/parser": "^4.9.0", "@vue/compiler-sfc": "^3.0.3", "@vuedx/typecheck": "^0.2.4-0", "@vuedx/typescript-plugin-vue": "^0.2.4-0", @@ -87,7 +87,7 @@ "lint-staged": "^10.5.2", "portfinder": "^1.0.28", "postcss-import": "^12.0.1", - "prettier": "^2.2.0", + "prettier": "^2.2.1", "rimraf": "^3.0.2", "rollup-plugin-visualizer": "^4.1.2", "stylelint": "^13.8.0", @@ -101,7 +101,7 @@ "vite-plugin-html": "^1.0.0-beta.2", "vite-plugin-mock": "^1.0.6", "vite-plugin-purge-icons": "^0.4.5", - "vite-plugin-pwa": "^0.1.5", + "vite-plugin-pwa": "^0.1.7", "vue-eslint-parser": "^7.1.1", "yargs": "^16.1.0" }, diff --git a/src/router/menus/modules/demo/comp.ts b/src/router/menus/modules/demo/comp.ts index 6b467693..f167cc9b 100644 --- a/src/router/menus/modules/demo/comp.ts +++ b/src/router/menus/modules/demo/comp.ts @@ -5,7 +5,9 @@ const menu: MenuModule = { menu: { name: 'routes.demo.comp.comp', path: '/comp', - + tag: { + dot: true, + }, children: [ { path: 'basic', @@ -47,6 +49,9 @@ const menu: MenuModule = { { path: 'loading', name: 'routes.demo.comp.loading', + tag: { + content: 'new', + }, }, { path: 'scroll', diff --git a/vite.config.ts b/vite.config.ts index 67d1ddc2..9fe937e6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,4 @@ -import type { UserConfig } from 'vite'; - +import type { UserConfig, Resolver } from 'vite'; import { resolve } from 'path'; import { modifyVars } from './build/config/lessModifyVars'; @@ -16,94 +15,41 @@ const pkg = require('./package.json'); const viteEnv = loadEnv(); -const { - VITE_PORT, - VITE_PUBLIC_PATH, - VITE_PROXY, - VITE_DROP_CONSOLE, - // VITE_USE_CDN, -} = viteEnv; +const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY, VITE_DROP_CONSOLE, VITE_DYNAMIC_IMPORT } = viteEnv; function pathResolve(dir: string) { return resolve(__dirname, '.', dir); } +const alias: Record = { + '/@/': pathResolve('src'), +}; + +const root: string = process.cwd(); + +const resolvers: Resolver[] = []; + const viteConfig: UserConfig = { - /** - * Entry. Use this to specify a js entry file in setting cases where an - * `index.html` does not exist (e.g. serving vite assets from a different host) - * @default 'index.html' - */ - // TODO build error - // entry: 'public/index.html', + root, + alias, /** * port * @default '3000' */ port: VITE_PORT, - /** - * @default 'localhost' - */ - hostname: 'localhost', - /** - * Run to open the browser automatically - * @default 'false' - */ - open: false, - /** - * Set to `false` to disable minification, or specify the minifier to setting. - * Available options are 'terser' or 'esbuild'. - * @default 'terser' - */ - minify: 'terser', + /** * Base public path when served in production. * @default '/' */ base: VITE_PUBLIC_PATH, - /** - * Directory relative from `root` where build output will be placed. If the - * directory exists, it will be removed before the build. - * @default 'dist' - */ - outDir: 'dist', - /** - * Whether to generate sourcemap - * @default false - */ - sourcemap: false, - /** - * Directory relative from `outDir` where the built js/css/image assets will - * be placed. - * @default '_assets' - */ - assetsDir: '_assets', - /** - * Static asset files smaller than this number (in bytes) will be inlined as - * base64 strings. Default limit is `4096` (4kb). Set to `0` to disable. - * @default 4096 - */ - assetsInlineLimit: 4096, /** * Transpile target for esbuild. * @default 'es2020' */ esbuildTarget: 'es2019', - /** - * Whether to log asset info to console - * @default false - */ - silent: false, - /** - * Import alias. The entries can either be exact request -> request mappings - * (exact, no wildcard syntax), or request path -> fs directory mappings. - * When using directory mappings, the key **must start and end with a slash**. - * ``` - */ - alias: { - '/@/': pathResolve('src'), - }, + // terser options terserOptions: { compress: { @@ -134,25 +80,20 @@ const viteConfig: UserConfig = { ], }, - // Local cross-domain proxy proxy: createProxy(VITE_PROXY), plugins: createVitePlugins(viteEnv), rollupInputOptions: { - // TODO - // external: VITE_USE_CDN ? externals : [], plugins: createRollupPlugin(), }, -}; - -export default { - ...viteConfig, transforms: [ globbyTransform({ - resolvers: viteConfig.resolvers, - root: viteConfig.root, - alias: viteConfig.alias, + resolvers: resolvers, + root: root, + alias: alias, includes: [resolve('src/router'), resolve('src/locales')], }), - dynamicImportTransform(viteEnv), + dynamicImportTransform(VITE_DYNAMIC_IMPORT), ], -} as UserConfig; +}; + +export default viteConfig; diff --git a/yarn.lock b/yarn.lock index 896fb405..548a0466 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1061,10 +1061,10 @@ resolved "https://registry.npmjs.org/@iconify/iconify/-/iconify-2.0.0-rc.2.tgz#c4a95ddc06ca9b9496df03604e66fdefb39f4c4b" integrity sha512-BybEHU5/I9EQ0CcwKAqmreZ2bMnAXrqLCTptAc6vPetHMbrXdZfejP5mt57e/8PNSt/qE7BHniU5PCYA+PGIHw== -"@iconify/json@^1.1.264": - version "1.1.264" - resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.264.tgz#c8a96a63452aa5a45ffdd752e9eb5db4d81285ba" - integrity sha512-8roHMDJ/dt9kg2ggXOS7LTXs4BR6vHQDFLIdrKhyXEIRLKRokwOIG1XpdGWVc36VZh/5itwENq5xvdd3r40Ckw== +"@iconify/json@^1.1.266": + version "1.1.266" + resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.266.tgz#3537de808399652b3ca2c89a561216324121b785" + integrity sha512-I8S9lChQATaRroMGccdOQkFbBtMt4C2V/PQGiSjDq9yzdyqDCrPNN9X1qM4FoQt84zfW/+JMHIgShi42E+SXeA== "@koa/cors@^3.1.0": version "3.1.0" @@ -1552,61 +1552,61 @@ resolved "https://registry.npmjs.org/@types/zxcvbn/-/zxcvbn-4.4.0.tgz#fbc1d941cc6d9d37d18405c513ba6b294f89b609" integrity sha512-GQLOT+SN20a+AI51y3fAimhyTF4Y0RG+YP3gf91OibIZ7CJmPFgoZi+ZR5a+vRbS01LbQosITWum4ATmJ1Z6Pg== -"@typescript-eslint/eslint-plugin@^4.8.2": - version "4.8.2" - resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.8.2.tgz#cf9102ec800391caa574f589ffe0623cca1d9308" - integrity sha512-gQ06QLV5l1DtvYtqOyFLXD9PdcILYqlrJj2l+CGDlPtmgLUzc1GpqciJFIRvyfvgLALpnxYINFuw+n9AZhPBKQ== +"@typescript-eslint/eslint-plugin@^4.9.0": + version "4.9.0" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.9.0.tgz#8fde15743413661fdc086c9f1f5d74a80b856113" + integrity sha512-WrVzGMzzCrgrpnQMQm4Tnf+dk+wdl/YbgIgd5hKGa2P+lnJ2MON+nQnbwgbxtN9QDLi8HO+JAq0/krMnjQK6Cw== dependencies: - "@typescript-eslint/experimental-utils" "4.8.2" - "@typescript-eslint/scope-manager" "4.8.2" + "@typescript-eslint/experimental-utils" "4.9.0" + "@typescript-eslint/scope-manager" "4.9.0" debug "^4.1.1" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.8.2": - version "4.8.2" - resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.8.2.tgz#8909a5732f19329cf5ef0c39766170476bff5e50" - integrity sha512-hpTw6o6IhBZEsQsjuw/4RWmceRyESfAiEzAEnXHKG1X7S5DXFaZ4IO1JO7CW1aQ604leQBzjZmuMI9QBCAJX8Q== +"@typescript-eslint/experimental-utils@4.9.0": + version "4.9.0" + resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.9.0.tgz#23a296b85d243afba24e75a43fd55aceda5141f0" + integrity sha512-0p8GnDWB3R2oGhmRXlEnCvYOtaBCijtA5uBfH5GxQKsukdSQyI4opC4NGTUb88CagsoNQ4rb/hId2JuMbzWKFQ== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.8.2" - "@typescript-eslint/types" "4.8.2" - "@typescript-eslint/typescript-estree" "4.8.2" + "@typescript-eslint/scope-manager" "4.9.0" + "@typescript-eslint/types" "4.9.0" + "@typescript-eslint/typescript-estree" "4.9.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^4.8.2": - version "4.8.2" - resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.8.2.tgz#78dccbe5124de2b8dea2d4c363dee9f769151ca8" - integrity sha512-u0leyJqmclYr3KcXOqd2fmx6SDGBO0MUNHHAjr0JS4Crbb3C3d8dwAdlazy133PLCcPn+aOUFiHn72wcuc5wYw== +"@typescript-eslint/parser@^4.9.0": + version "4.9.0" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.9.0.tgz#bb65f1214b5e221604996db53ef77c9d62b09249" + integrity sha512-QRSDAV8tGZoQye/ogp28ypb8qpsZPV6FOLD+tbN4ohKUWHD2n/u0Q2tIBnCsGwQCiD94RdtLkcqpdK4vKcLCCw== dependencies: - "@typescript-eslint/scope-manager" "4.8.2" - "@typescript-eslint/types" "4.8.2" - "@typescript-eslint/typescript-estree" "4.8.2" + "@typescript-eslint/scope-manager" "4.9.0" + "@typescript-eslint/types" "4.9.0" + "@typescript-eslint/typescript-estree" "4.9.0" debug "^4.1.1" -"@typescript-eslint/scope-manager@4.8.2": - version "4.8.2" - resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.8.2.tgz#a18388c63ae9c17adde519384f539392f2c4f0d9" - integrity sha512-qHQ8ODi7mMin4Sq2eh/6eu03uVzsf5TX+J43xRmiq8ujng7ViQSHNPLOHGw/Wr5dFEoxq/ubKhzClIIdQy5q3g== +"@typescript-eslint/scope-manager@4.9.0": + version "4.9.0" + resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.9.0.tgz#5eefe305d6b71d1c85af6587b048426bfd4d3708" + integrity sha512-q/81jtmcDtMRE+nfFt5pWqO0R41k46gpVLnuefqVOXl4QV1GdQoBWfk5REcipoJNQH9+F5l+dwa9Li5fbALjzg== dependencies: - "@typescript-eslint/types" "4.8.2" - "@typescript-eslint/visitor-keys" "4.8.2" + "@typescript-eslint/types" "4.9.0" + "@typescript-eslint/visitor-keys" "4.9.0" -"@typescript-eslint/types@4.8.2": - version "4.8.2" - resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.8.2.tgz#c862dd0e569d9478eb82d6aee662ea53f5661a36" - integrity sha512-z1/AVcVF8ju5ObaHe2fOpZYEQrwHyZ7PTOlmjd3EoFeX9sv7UekQhfrCmgUO7PruLNfSHrJGQvrW3Q7xQ8EoAw== +"@typescript-eslint/types@4.9.0": + version "4.9.0" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.9.0.tgz#3fe8c3632abd07095c7458f7451bd14c85d0033c" + integrity sha512-luzLKmowfiM/IoJL/rus1K9iZpSJK6GlOS/1ezKplb7MkORt2dDcfi8g9B0bsF6JoRGhqn0D3Va55b+vredFHA== -"@typescript-eslint/typescript-estree@4.8.2": - version "4.8.2" - resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.8.2.tgz#eeec34707d8577600fb21661b5287226cc8b3bed" - integrity sha512-HToGNwI6fekH0dOw3XEVESUm71Onfam0AKin6f26S2FtUmO7o3cLlWgrIaT1q3vjB3wCTdww3Dx2iGq5wtUOCg== +"@typescript-eslint/typescript-estree@4.9.0": + version "4.9.0" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.9.0.tgz#38a98df6ee281cfd6164d6f9d91795b37d9e508c" + integrity sha512-rmDR++PGrIyQzAtt3pPcmKWLr7MA+u/Cmq9b/rON3//t5WofNR4m/Ybft2vOLj0WtUzjn018ekHjTsnIyBsQug== dependencies: - "@typescript-eslint/types" "4.8.2" - "@typescript-eslint/visitor-keys" "4.8.2" + "@typescript-eslint/types" "4.9.0" + "@typescript-eslint/visitor-keys" "4.9.0" debug "^4.1.1" globby "^11.0.1" is-glob "^4.0.1" @@ -1614,12 +1614,12 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@4.8.2": - version "4.8.2" - resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.8.2.tgz#62cd3fbbbf65f8eccfbe6f159eb1b84a243a3f77" - integrity sha512-Vg+/SJTMZJEKKGHW7YC21QxgKJrSbxoYYd3MEUGtW7zuytHuEcksewq0DUmo4eh/CTNrVJGSdIY9AtRb6riWFw== +"@typescript-eslint/visitor-keys@4.9.0": + version "4.9.0" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.9.0.tgz#f284e9fac43f2d6d35094ce137473ee321f266c8" + integrity sha512-sV45zfdRqQo1A97pOSx3fsjR+3blmwtdCt8LDrXgCX36v4Vmz4KHrhpV6Fo2cRdXmyumxx11AHw0pNJqCNpDyg== dependencies: - "@typescript-eslint/types" "4.8.2" + "@typescript-eslint/types" "4.9.0" eslint-visitor-keys "^2.0.0" "@vue/compiler-core@*", "@vue/compiler-core@3.0.2", "@vue/compiler-core@^3.0.0-rc.5": @@ -6468,10 +6468,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.2.0: - version "2.2.0" - resolved "https://registry.npmjs.org/prettier/-/prettier-2.2.0.tgz#8a03c7777883b29b37fb2c4348c66a78e980418b" - integrity sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw== +prettier@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== pretty-bytes@^5.3.0: version "5.4.1" @@ -8158,10 +8158,10 @@ vary@^1.1.2: resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= -vditor@^3.6.6: - version "3.6.6" - resolved "https://registry.npmjs.org/vditor/-/vditor-3.6.6.tgz#210255dbf76a504ce085d207ccbae577b89d42c5" - integrity sha512-qG4HlI4+krRqPW7NFDdDczS4OsYGIdiHlJ3BHbIoPp9SO7RK5O75y+rI4zGW7EN1lPye40Jwo3zmsPbPhn5nsA== +vditor@^3.7.0: + version "3.7.0" + resolved "https://registry.npmjs.org/vditor/-/vditor-3.7.0.tgz#8699b7cd8cf1b4406e5e11aa6f966df2b6c009d7" + integrity sha512-8DnHoIZyHo5cZe4f4D3ZeY0CEdZwwXxKhrbocjo+eiw0ipX6iC+OCLVYE3l8tJ0Ze7w99DnxU7XRxbKj3xYFkw== dependencies: diff-match-patch "^1.0.5" @@ -8215,10 +8215,10 @@ vite-plugin-purge-icons@^0.4.5: "@purge-icons/generated" "^0.4.1" rollup-plugin-purge-icons "^0.4.5" -vite-plugin-pwa@^0.1.5: - version "0.1.5" - resolved "https://registry.npmjs.org/vite-plugin-pwa/-/vite-plugin-pwa-0.1.5.tgz#df14fa3041639a2087391bef87e7fb9d449b322d" - integrity sha512-7zUCeg0v1z8JpR+1yKN8Bz0d2d6UvV9whi+GkLGc70ms7G1XvkV0WieBSZwTT0lCwrdxthnvbgJJzJlYPHd0KQ== +vite-plugin-pwa@^0.1.7: + version "0.1.7" + resolved "https://registry.npmjs.org/vite-plugin-pwa/-/vite-plugin-pwa-0.1.7.tgz#3e13faf2d61b1f5a1b341f6b08f32216ffae1f55" + integrity sha512-S5Hc1x/rcfb6cgKjlW7yxSTv1er6fquzGZt/+xC1wavSBa7Qf6wdf6QzYiYdwmUom5yUSDEawc2gEYgq5SsZFg== dependencies: debug "^4.3.0" fast-glob "^3.2.4" @@ -8314,10 +8314,10 @@ vue-i18n@^9.0.0-beta.8: dependencies: source-map "0.6.1" -vue-router@^4.0.0-rc.5: - version "4.0.0-rc.5" - resolved "https://registry.npmjs.org/vue-router/-/vue-router-4.0.0-rc.5.tgz#191d32e3d5276641ff21e881d34e33a71dc6e8f0" - integrity sha512-Q8Tt6VGwGMN5qASeIdjSydU3uRADK9AUkqnbnzmTz+zZKS0W6GZOAuP235lf3y5/MqEFSKRJGaTWPEY0t+Rjmg== +vue-router@^4.0.0-rc.6: + version "4.0.0-rc.6" + resolved "https://registry.npmjs.org/vue-router/-/vue-router-4.0.0-rc.6.tgz#8fa9e2d612c28ccf9b2bfa9421052932808ce24b" + integrity sha512-hVHC8A4/0yku1Z6+oUtX9odeHv78XwDI7putt1hd7os27P7mLabkjArN7f3TI3e/cz17MxAUz5Yp+m8ZE3sPsw== vue-types@^3.0.0, vue-types@^3.0.1: version "3.0.1" -- GitLab