Commit d2bdc5665e559c5eae17708426e135740510a8d7
1 parent
daf2b1e0
wip: suppoer vite2 -- import.meta.glob
Showing
7 changed files
with
44 additions
and
71 deletions
build/script/hackXlsx.ts
build/utils.ts
... | ... | @@ -11,39 +11,6 @@ export const isFunction = (arg: unknown): arg is (...args: any[]) => any => |
11 | 11 | export const isRegExp = (arg: unknown): arg is RegExp => |
12 | 12 | Object.prototype.toString.call(arg) === '[object RegExp]'; |
13 | 13 | |
14 | -/* | |
15 | - * Read all files in the specified folder, filter through regular rules, and return file path array | |
16 | - * @param root Specify the folder path | |
17 | - * [@param] reg Regular expression for filtering files, optional parameters | |
18 | - * Note: It can also be deformed to check whether the file path conforms to regular rules. The path can be a folder or a file. The path that does not exist is also fault-tolerant. | |
19 | - */ | |
20 | -export function readAllFile(root: string, reg: RegExp) { | |
21 | - let resultArr: string[] = []; | |
22 | - try { | |
23 | - if (fs.existsSync(root)) { | |
24 | - const stat = fs.lstatSync(root); | |
25 | - if (stat.isDirectory()) { | |
26 | - // dir | |
27 | - const files = fs.readdirSync(root); | |
28 | - files.forEach(function (file) { | |
29 | - const t = readAllFile(root + '/' + file, reg); | |
30 | - resultArr = resultArr.concat(t); | |
31 | - }); | |
32 | - } else { | |
33 | - if (reg !== undefined) { | |
34 | - if (isFunction(reg.test) && reg.test(root)) { | |
35 | - resultArr.push(root); | |
36 | - } | |
37 | - } else { | |
38 | - resultArr.push(root); | |
39 | - } | |
40 | - } | |
41 | - } | |
42 | - } catch (error) {} | |
43 | - | |
44 | - return resultArr; | |
45 | -} | |
46 | - | |
47 | 14 | /** |
48 | 15 | * get client ip address |
49 | 16 | */ |
... | ... | @@ -183,6 +150,3 @@ export function warnConsole(message: any) { |
183 | 150 | export function getCwdPath(...dir: string[]) { |
184 | 151 | return path.resolve(process.cwd(), ...dir); |
185 | 152 | } |
186 | - | |
187 | -// export const run = (bin: string, args: any, opts = {}) => | |
188 | -// execa(bin, args, { stdio: 'inherit', ...opts }); | ... | ... |
package.json
... | ... | @@ -3,9 +3,9 @@ |
3 | 3 | "version": "2.0.0-rc.16", |
4 | 4 | "scripts": { |
5 | 5 | "bootstrap": "yarn install", |
6 | - "serve": "cross-env vite ", | |
7 | - "build": "cross-env vite build && esno ./build/script/postBuild.ts", | |
8 | - "build:no-cache": "yarn clean:cache && npm run build", | |
6 | + "serve": "vite", | |
7 | + "build": "vite build && esno ./build/script/postBuild.ts", | |
8 | + "build:no-cache": "yarn clean:cache && npm run build", | |
9 | 9 | "report": "cross-env REPORT=true npm run build ", |
10 | 10 | "preview": "npm run build && esno ./build/script/preview.ts", |
11 | 11 | "preview:dist": "esno ./build/script/preview.ts", |
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | "devDependencies": { |
48 | 48 | "@commitlint/cli": "^11.0.0", |
49 | 49 | "@commitlint/config-conventional": "^11.0.0", |
50 | - "@iconify/json": "^1.1.283", | |
50 | + "@iconify/json": "^1.1.284", | |
51 | 51 | "@ls-lint/ls-lint": "^1.9.2", |
52 | 52 | "@purge-icons/generated": "^0.5.0", |
53 | 53 | "@types/echarts": "^4.9.3", |
... | ... | @@ -84,7 +84,7 @@ |
84 | 84 | "fs-extra": "^9.0.1", |
85 | 85 | "husky": "^4.3.7", |
86 | 86 | "koa-static": "^5.0.0", |
87 | - "less": "^4.0.0", | |
87 | + "less": "^4.1.0", | |
88 | 88 | "lint-staged": "^10.5.3", |
89 | 89 | "portfinder": "^1.0.28", |
90 | 90 | "postcss-import": "^14.0.0", |
... | ... | @@ -98,12 +98,12 @@ |
98 | 98 | "stylelint-order": "^4.1.0", |
99 | 99 | "ts-node": "^9.1.0", |
100 | 100 | "typescript": "^4.1.3", |
101 | - "vite": "^2.0.0-beta.16", | |
101 | + "vite": "^2.0.0-beta.19", | |
102 | 102 | "vite-plugin-html": "^2.0.0-beta.5", |
103 | 103 | "vite-plugin-import-context": "^1.0.0-rc.1", |
104 | 104 | "vite-plugin-mock": "^2.0.0-beta.1", |
105 | 105 | "vite-plugin-purge-icons": "^0.5.0", |
106 | - "vite-plugin-pwa": "^0.3.2", | |
106 | + "vite-plugin-pwa": "^0.3.3", | |
107 | 107 | "vue-eslint-parser": "^7.3.0", |
108 | 108 | "yargs": "^16.2.0" |
109 | 109 | }, | ... | ... |
src/locales/getMessage.ts
src/router/menus/index.ts
... | ... | @@ -9,7 +9,7 @@ import router from '/@/router'; |
9 | 9 | import { PermissionModeEnum } from '/@/enums/appEnum'; |
10 | 10 | import { pathToRegexp } from 'path-to-regexp'; |
11 | 11 | |
12 | -import modules from 'glob:./modules/**/*.ts'; | |
12 | +const modules = import.meta.globEager('./modules/**/*.ts'); | |
13 | 13 | |
14 | 14 | const menuModules: MenuModule[] = []; |
15 | 15 | ... | ... |
src/router/routes/index.ts
... | ... | @@ -6,7 +6,7 @@ import { mainOutRoutes } from './mainOut'; |
6 | 6 | import { PageEnum } from '/@/enums/pageEnum'; |
7 | 7 | import { t } from '/@/hooks/web/useI18n'; |
8 | 8 | |
9 | -import modules from 'glob:./modules/**/*.ts'; | |
9 | +const modules = import.meta.globEager('./modules/**/*.ts'); | |
10 | 10 | |
11 | 11 | const routeModuleList: AppRouteModule[] = []; |
12 | 12 | ... | ... |
yarn.lock
... | ... | @@ -1182,10 +1182,10 @@ |
1182 | 1182 | resolved "https://registry.npmjs.org/@iconify/iconify/-/iconify-2.0.0-rc.5.tgz#ac725a2ea40a0626d02dfb31482050751a0e6d84" |
1183 | 1183 | integrity sha512-A65cga+dug1Z5Y6T7euq1Fnk5Wc7Qu6yn6mVBAfo2SnPndekl9JC+eBe2M3RdTJIdIi10p7OUs7ntKKQLK1j5w== |
1184 | 1184 | |
1185 | -"@iconify/json@^1.1.283": | |
1186 | - version "1.1.283" | |
1187 | - resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.283.tgz#d82d1cce28b1e80db983d7308414f62f87b6ea18" | |
1188 | - integrity sha512-N15g8BMH7Q7xRA65f7H2Exp2oeYh3iuWBrNeC471WxHC6O5oQgyOBzST7FHJMOD3Ik++fSre2utjI+o0IrzCzw== | |
1185 | +"@iconify/json@^1.1.284": | |
1186 | + version "1.1.284" | |
1187 | + resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.284.tgz#d8a70ed9cfc76a03bbc00fabdca19cc0a9134760" | |
1188 | + integrity sha512-NjTud7YfBbZrsib5AB35Qp5fgy2FKv4suRRetqXFZxuFdTcxEje8CiMQVdB8rFLMrx96lfY0dX4VDSB7luYwVw== | |
1189 | 1189 | |
1190 | 1190 | "@intlify/core-base@9.0.0-beta.16": |
1191 | 1191 | version "9.0.0-beta.16" |
... | ... | @@ -3196,7 +3196,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3: |
3196 | 3196 | dependencies: |
3197 | 3197 | ms "2.0.0" |
3198 | 3198 | |
3199 | -debug@^3.1.0, debug@^3.1.1: | |
3199 | +debug@^3.1.0, debug@^3.1.1, debug@^3.2.6: | |
3200 | 3200 | version "3.2.7" |
3201 | 3201 | resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" |
3202 | 3202 | integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== |
... | ... | @@ -4428,7 +4428,7 @@ husky@^4.3.7: |
4428 | 4428 | slash "^3.0.0" |
4429 | 4429 | which-pm-runs "^1.0.0" |
4430 | 4430 | |
4431 | -iconv-lite@0.4.24, iconv-lite@^0.4.24: | |
4431 | +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: | |
4432 | 4432 | version "0.4.24" |
4433 | 4433 | resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" |
4434 | 4434 | integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== |
... | ... | @@ -4979,10 +4979,10 @@ koa-static@^5.0.0: |
4979 | 4979 | debug "^3.1.0" |
4980 | 4980 | koa-send "^5.0.0" |
4981 | 4981 | |
4982 | -less@^4.0.0: | |
4983 | - version "4.0.0" | |
4984 | - resolved "https://registry.npmjs.org/less/-/less-4.0.0.tgz#d238cc25576c1f722794dbca4ac82e5e3c7e9e65" | |
4985 | - integrity sha512-av1eEa2D0xZfF7fjLJS/Dld7zAYSLU7EOEJvuOELeaNI3i6L/81AdjbK5/pytaRkBwi7ZEa0433IDvMLskKCOw== | |
4982 | +less@^4.1.0: | |
4983 | + version "4.1.0" | |
4984 | + resolved "https://registry.npmjs.org/less/-/less-4.1.0.tgz#a12708d1951239db1c9d7eaa405f1ebac9a75b8d" | |
4985 | + integrity sha512-w1Ag/f34g7LwtQ/sMVSGWIyZx+gG9ZOAEtyxeX1fG75is6BMyC2lD5kG+1RueX7PkAvlQBm2Lf2aN2j0JbVr2A== | |
4986 | 4986 | dependencies: |
4987 | 4987 | copy-anything "^2.0.1" |
4988 | 4988 | parse-node-version "^1.0.1" |
... | ... | @@ -4993,7 +4993,7 @@ less@^4.0.0: |
4993 | 4993 | image-size "~0.5.0" |
4994 | 4994 | make-dir "^2.1.0" |
4995 | 4995 | mime "^1.4.1" |
4996 | - native-request "^1.0.5" | |
4996 | + needle "^2.5.2" | |
4997 | 4997 | source-map "~0.6.0" |
4998 | 4998 | |
4999 | 4999 | levn@^0.4.1: |
... | ... | @@ -5556,16 +5556,20 @@ nanopop@^2.1.0: |
5556 | 5556 | resolved "https://registry.npmjs.org/nanopop/-/nanopop-2.1.0.tgz#23476513cee2405888afd2e8a4b54066b70b9e60" |
5557 | 5557 | integrity sha512-jGTwpFRexSH+fxappnGQtN9dspgE2ipa1aOjtR24igG0pv6JCxImIAmrLRHX+zUF5+1wtsFVbKyfP51kIGAVNw== |
5558 | 5558 | |
5559 | -native-request@^1.0.5: | |
5560 | - version "1.0.8" | |
5561 | - resolved "https://registry.npmjs.org/native-request/-/native-request-1.0.8.tgz#8f66bf606e0f7ea27c0e5995eb2f5d03e33ae6fb" | |
5562 | - integrity sha512-vU2JojJVelUGp6jRcLwToPoWGxSx23z/0iX+I77J3Ht17rf2INGjrhOoQnjVo60nQd8wVsgzKkPfRXBiVdD2ag== | |
5563 | - | |
5564 | 5559 | natural-compare@^1.4.0: |
5565 | 5560 | version "1.4.0" |
5566 | 5561 | resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" |
5567 | 5562 | integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= |
5568 | 5563 | |
5564 | +needle@^2.5.2: | |
5565 | + version "2.6.0" | |
5566 | + resolved "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz#24dbb55f2509e2324b4a99d61f413982013ccdbe" | |
5567 | + integrity sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg== | |
5568 | + dependencies: | |
5569 | + debug "^3.2.6" | |
5570 | + iconv-lite "^0.4.4" | |
5571 | + sax "^1.2.4" | |
5572 | + | |
5569 | 5573 | neo-async@^2.6.0: |
5570 | 5574 | version "2.6.2" |
5571 | 5575 | resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" |
... | ... | @@ -6742,6 +6746,11 @@ safe-regex@^1.1.0: |
6742 | 6746 | resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" |
6743 | 6747 | integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== |
6744 | 6748 | |
6749 | +sax@^1.2.4: | |
6750 | + version "1.2.4" | |
6751 | + resolved "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" | |
6752 | + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== | |
6753 | + | |
6745 | 6754 | scroll-into-view-if-needed@^2.2.25: |
6746 | 6755 | version "2.2.26" |
6747 | 6756 | resolved "https://registry.npmjs.org/scroll-into-view-if-needed/-/scroll-into-view-if-needed-2.2.26.tgz#e4917da0c820135ff65ad6f7e4b7d7af568c4f13" |
... | ... | @@ -7826,20 +7835,20 @@ vite-plugin-purge-icons@^0.5.0: |
7826 | 7835 | "@purge-icons/generated" "^0.5.0" |
7827 | 7836 | rollup-plugin-purge-icons "^0.5.0" |
7828 | 7837 | |
7829 | -vite-plugin-pwa@^0.3.2: | |
7830 | - version "0.3.2" | |
7831 | - resolved "https://registry.npmjs.org/vite-plugin-pwa/-/vite-plugin-pwa-0.3.2.tgz#002ecee5ab8fa2384e5fa3cf0cb3fb1b22f5e3a9" | |
7832 | - integrity sha512-NxoueGlURbMvW4A6tBt26LQ8kw7p7QeLnGdVvfzttSeQnTHYsV1KIzhe10jRY1/91UODs4pmIPqTvRwuaatXow== | |
7838 | +vite-plugin-pwa@^0.3.3: | |
7839 | + version "0.3.3" | |
7840 | + resolved "https://registry.npmjs.org/vite-plugin-pwa/-/vite-plugin-pwa-0.3.3.tgz#00ece9b7b558153a4afa3fbbac2913c5b3ff6fa8" | |
7841 | + integrity sha512-aojgEk9u1Aaoo80zT8AdhGlPUrWHmV9fdJhbj/9vvEyj02DJQCvu7rr5gEJJRjtUSS+xtzIWzy2Rc3P+x4gD5A== | |
7833 | 7842 | dependencies: |
7834 | 7843 | debug "^4.3.2" |
7835 | 7844 | fast-glob "^3.2.4" |
7836 | 7845 | pretty-bytes "^5.5.0" |
7837 | 7846 | workbox-build "^6.0.2" |
7838 | 7847 | |
7839 | -vite@^2.0.0-beta.16: | |
7840 | - version "2.0.0-beta.16" | |
7841 | - resolved "https://registry.npmjs.org/vite/-/vite-2.0.0-beta.16.tgz#ad1c01b82072370cfe8440327adc47669e11496b" | |
7842 | - integrity sha512-+4XGgMpY+MuDoDi+kB2bq1W2dgqE5pJ1wU8HZ2VdJy8qVyYF/bo7IOP56ZbWMpij4b71Bat5SetyE+r6wrETbg== | |
7848 | +vite@^2.0.0-beta.19: | |
7849 | + version "2.0.0-beta.19" | |
7850 | + resolved "https://registry.npmjs.org/vite/-/vite-2.0.0-beta.19.tgz#9e1a3ff4843d8e72fc2b771691c43124ceeacd21" | |
7851 | + integrity sha512-6EJAPypH8m9lCK2pB1UfU+qBw65wCHFoMITtFotDAd03m5hz2d9cPXfPgaCk0PhQPgtGcgn5xeAfLIdZ5e6cPA== | |
7843 | 7852 | dependencies: |
7844 | 7853 | esbuild "^0.8.26" |
7845 | 7854 | postcss "^8.2.1" | ... | ... |