From 2e893ae6128c66d11a806d92ea801ccc88154ad1 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Sun, 28 Mar 2021 21:22:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(plugin-qiankun):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=88=87=E6=8D=A2=E6=97=B6=E8=87=AA=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E6=9C=AA=E6=AD=A3=E7=A1=AE=E9=94=80=E6=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fes-plugin-qiankun/examples/app1/.env | 1 + .../examples/app1/.eslintrc.js | 14 +++++ .../fes-plugin-qiankun/examples/app1/.fes.js | 12 ++++ .../examples/app1/.gitignore | 11 ++++ .../fes-plugin-qiankun/examples/app1/LICENSE | 21 +++++++ .../examples/app1/package.json | 54 ++++++++++++++++++ .../examples/app1/src/app.js | 12 ++++ .../app1/src/components/PageLoading.vue | 29 ++++++++++ .../examples/app1/src/global.css | 0 .../examples/app1/src/images/icon.png | Bin 0 -> 5586 bytes .../examples/app1/src/pages/app1/index.vue | 22 +++++++ .../examples/app1/src/pages/app1/test.vue | 22 +++++++ .../examples/app1/tsconfig.json | 37 ++++++++++++ .../fes-plugin-qiankun/examples/main/.env | 1 + .../examples/main/.eslintrc.js | 14 +++++ .../fes-plugin-qiankun/examples/main/.fes.js | 45 +++++++++++++++ .../examples/main/.gitignore | 11 ++++ .../fes-plugin-qiankun/examples/main/LICENSE | 21 +++++++ .../examples/main/package.json | 54 ++++++++++++++++++ .../examples/main/src/app.js | 15 +++++ .../main/src/components/PageLoading.vue | 29 ++++++++++ .../examples/main/src/global.css | 0 .../examples/main/src/images/icon.png | Bin 0 -> 5586 bytes .../examples/main/src/pages/app1/index.vue | 7 +++ .../examples/main/src/pages/app1/test.vue | 7 +++ .../examples/main/src/pages/index.vue | 11 ++++ .../examples/main/tsconfig.json | 37 ++++++++++++ packages/fes-plugin-qiankun/package.json | 7 ++- .../src/main/modifyRoutes.js | 5 +- .../src/main/runtime/MicroApp.tpl | 23 +++----- .../runtime/getMicroAppRouteComponent.tpl | 3 +- .../fes-plugin-qiankun/src/micro/index.js | 2 +- .../src/micro/runtime/lifecycles.tpl | 14 ++--- .../src/plugins/generateFiles/fes/fes.tpl | 5 +- packages/fes-template/.fes.js | 5 +- packages/fes-template/package.json | 3 +- yarn.lock | 41 ++++++++++++- 37 files changed, 556 insertions(+), 39 deletions(-) create mode 100644 packages/fes-plugin-qiankun/examples/app1/.env create mode 100644 packages/fes-plugin-qiankun/examples/app1/.eslintrc.js create mode 100644 packages/fes-plugin-qiankun/examples/app1/.fes.js create mode 100644 packages/fes-plugin-qiankun/examples/app1/.gitignore create mode 100644 packages/fes-plugin-qiankun/examples/app1/LICENSE create mode 100644 packages/fes-plugin-qiankun/examples/app1/package.json create mode 100644 packages/fes-plugin-qiankun/examples/app1/src/app.js create mode 100644 packages/fes-plugin-qiankun/examples/app1/src/components/PageLoading.vue create mode 100644 packages/fes-plugin-qiankun/examples/app1/src/global.css create mode 100644 packages/fes-plugin-qiankun/examples/app1/src/images/icon.png create mode 100644 packages/fes-plugin-qiankun/examples/app1/src/pages/app1/index.vue create mode 100644 packages/fes-plugin-qiankun/examples/app1/src/pages/app1/test.vue create mode 100644 packages/fes-plugin-qiankun/examples/app1/tsconfig.json create mode 100644 packages/fes-plugin-qiankun/examples/main/.env create mode 100644 packages/fes-plugin-qiankun/examples/main/.eslintrc.js create mode 100644 packages/fes-plugin-qiankun/examples/main/.fes.js create mode 100644 packages/fes-plugin-qiankun/examples/main/.gitignore create mode 100644 packages/fes-plugin-qiankun/examples/main/LICENSE create mode 100644 packages/fes-plugin-qiankun/examples/main/package.json create mode 100644 packages/fes-plugin-qiankun/examples/main/src/app.js create mode 100644 packages/fes-plugin-qiankun/examples/main/src/components/PageLoading.vue create mode 100644 packages/fes-plugin-qiankun/examples/main/src/global.css create mode 100644 packages/fes-plugin-qiankun/examples/main/src/images/icon.png create mode 100644 packages/fes-plugin-qiankun/examples/main/src/pages/app1/index.vue create mode 100644 packages/fes-plugin-qiankun/examples/main/src/pages/app1/test.vue create mode 100644 packages/fes-plugin-qiankun/examples/main/src/pages/index.vue create mode 100644 packages/fes-plugin-qiankun/examples/main/tsconfig.json diff --git a/packages/fes-plugin-qiankun/examples/app1/.env b/packages/fes-plugin-qiankun/examples/app1/.env new file mode 100644 index 00000000..e57859d2 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/.env @@ -0,0 +1 @@ +PORT=8001 diff --git a/packages/fes-plugin-qiankun/examples/app1/.eslintrc.js b/packages/fes-plugin-qiankun/examples/app1/.eslintrc.js new file mode 100644 index 00000000..6300816f --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/.eslintrc.js @@ -0,0 +1,14 @@ +module.exports = { + extends: ['@webank/eslint-config-webank/vue.js'], + overrides: [ + { + files: [ + '**/__tests__/*.{j,t}s?(x)', + '**/tests/unit/**/*.spec.{j,t}s?(x)' + ] + } + ], + env: { + jest: true + } +}; diff --git a/packages/fes-plugin-qiankun/examples/app1/.fes.js b/packages/fes-plugin-qiankun/examples/app1/.fes.js new file mode 100644 index 00000000..4540b6ee --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/.fes.js @@ -0,0 +1,12 @@ +// .fes.js 只负责管理编译时配置,只能使用plain Object + + +export default { + qiankun: { + micro: {} + }, + plugins: [ + require.resolve('../../../fes-plugin-model/lib'), + require.resolve('../../../fes-plugin-qiankun/lib'), + ] +}; diff --git a/packages/fes-plugin-qiankun/examples/app1/.gitignore b/packages/fes-plugin-qiankun/examples/app1/.gitignore new file mode 100644 index 00000000..df903b98 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/.gitignore @@ -0,0 +1,11 @@ +.DS_Store + +# dependencies +/node_modules +/coverage + +# fes +/src/.fes +/src/.fes-production +/src/.fes-test +/.env.local diff --git a/packages/fes-plugin-qiankun/examples/app1/LICENSE b/packages/fes-plugin-qiankun/examples/app1/LICENSE new file mode 100644 index 00000000..0978fbf7 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-present webank + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/fes-plugin-qiankun/examples/app1/package.json b/packages/fes-plugin-qiankun/examples/app1/package.json new file mode 100644 index 00000000..15bb6521 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/package.json @@ -0,0 +1,54 @@ +{ + "name": "app1", + "version": "2.0.0", + "description": "fes项目模版", + "scripts": { + "build": "fes build", + "prod": "FES_ENV=prod fes build", + "analyze": "ANALYZE=1 fes build", + "dev": "fes dev", + "test": "fes test" + }, + "keywords": [ + "管理端", + "fes", + "fast", + "easy", + "strong" + ], + "files": [ + ".eslintrc.js", + ".gitignore", + ".fes.js", + ".fes.prod.js", + "mock.js", + "package.json", + "README.md", + "tsconfig.json", + "/src", + "/config" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/WeBankFinTech/fes.js.git", + "directory": "packages/fes-template" + }, + "author": "harrywan", + "license": "MIT", + "bugs": { + "url": "https://github.com/WeBankFinTech/fes.js/issues" + }, + "homepage": "https://github.com/WeBankFinTech/fes.js#readme", + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@webank/eslint-config-webank": "0.2.10" + }, + "dependencies": { + "@fesjs/fes": "^2.0.0-rc.0", + "vue": "^3.0.5", + "ant-design-vue": "2.0.0" + }, + "private": true +} diff --git a/packages/fes-plugin-qiankun/examples/app1/src/app.js b/packages/fes-plugin-qiankun/examples/app1/src/app.js new file mode 100644 index 00000000..5d609f81 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/src/app.js @@ -0,0 +1,12 @@ +import PageLoading from '@/components/PageLoading'; + +export const beforeRender = { + loading: , + action() { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, 200); + }); + } +}; diff --git a/packages/fes-plugin-qiankun/examples/app1/src/components/PageLoading.vue b/packages/fes-plugin-qiankun/examples/app1/src/components/PageLoading.vue new file mode 100644 index 00000000..14f1165e --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/src/components/PageLoading.vue @@ -0,0 +1,29 @@ + + + diff --git a/packages/fes-plugin-qiankun/examples/app1/src/global.css b/packages/fes-plugin-qiankun/examples/app1/src/global.css new file mode 100644 index 00000000..e69de29b diff --git a/packages/fes-plugin-qiankun/examples/app1/src/images/icon.png b/packages/fes-plugin-qiankun/examples/app1/src/images/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ff46a842d654da25a975ac545798bbcc4fd57918 GIT binary patch literal 5586 zcmb_gXE>Zq+rD>|u!x@MRwu$LNf5*mEzzP!FRLsOEqc9mtJj2t<?%``J0I(O{(^NMLvHx8h*~k+Z+S@Vg1*C9lzf|_;(u(`lpy>3vE+DdtqhCOk_XC>_>vXCE7JtNqv)gxQT_JN=WuTS1w!fXr+6FjfDniPS96)ryWjQB^-;;py|Yw}^`gFcFYmhSWb!>YAqRt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Cv=GDNg9fRGDL^{7f3k2+x5gxg#Rl4Z@jJfkarjva{Qj z)c>>`)~9Ir)!lX$#B@=*koeK?A834Y_|0Fp5;##t`JqUn4+If7EO-B~@^Is(~|A4cAT$HF)`vzrP z>tw8-2K}^dvN}8b)oyLT($mnf35K69agndd=Mg*Y#s4<$>?2@TgIhm(m5MLcC3aVP z=2!22bszzuPKs`*l_YhDxT3fb#n_u?za3FdT&-%gUj&=MwCL68{ZorKw->n0lC3&< z4vss;c6?>qJEm5-vbIwXaC1TrmOsL|Bo-k>wx0*e*GIeUUu20|g3tT@z4V=mGpfgG6ifV(T?-=C!P{ zBL5cX{<~O8!x6qB0dB4c;n3vziJA{B{E}kzGj0-(-~bisGL31V@|n)dq-{3(+3q_Q zfj=i+>el;jUI+JNXC)l$l`C&-yipn`_|Rz!y-fOGpp*L;u*l9dKi6D&I@GsUcl%1M zsR6VP9HVK{kjy_-8i)|(sE%QZG97|ENs@CvrH&6zUVrU9`S7jld1J4}M~RwTfW`06 zf5ewFd1OF~XeZ^#qtmoxk|@#W)=d6QW}EActpLmJp_p==he(;};+TGC2`wz@LyFQM z$@eSt4d3GapH{{ohL!W{uPh4Eu6)vDN9K&|e>BDiG4f%N@|<&p^eC=Q1j>3_k(E9y3r0Pgoe7zu61mYMxWTY0heQ(~Btn^iD zIzMnBBL$5d!nSHbVANDlR=k0X%&tbX9hf134T)?HHY+l+Z|vE8_%%4Vm#0gg@`|hp ve&5jBQY9M?yDv +
+ app1 - index +
+ + +{ + "name": "index", + "title": "home" +} + + + + diff --git a/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/test.vue b/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/test.vue new file mode 100644 index 00000000..c77c3a19 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/test.vue @@ -0,0 +1,22 @@ + + +{ + "name": "index", + "title": "home" +} + + + + diff --git a/packages/fes-plugin-qiankun/examples/app1/tsconfig.json b/packages/fes-plugin-qiankun/examples/app1/tsconfig.json new file mode 100644 index 00000000..ea930c0b --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/app1/tsconfig.json @@ -0,0 +1,37 @@ +{ + "compilerOptions": { + "outDir": "build/dist", + "module": "esnext", + "target": "esnext", + "lib": ["esnext", "dom"], + "sourceMap": true, + "baseUrl": ".", + "jsx": "preserve", + "allowSyntheticDefaultImports": true, + "moduleResolution": "node", + "forceConsistentCasingInFileNames": true, + "noImplicitReturns": true, + "suppressImplicitAnyIndexErrors": true, + "noUnusedLocals": true, + "allowJs": true, + "skipLibCheck": true, + "experimentalDecorators": true, + "strict": true, + "paths": { + "@/*": ["./src/*"], + "@@/*": ["./src/.fes/*"] + } + }, + "include": [ + "src/**/*", + "tests/**/*", + "test/**/*", + "__test__/**/*", + "typings/**/*", + "config/**/*", + ".eslintrc.js", + ".stylelintrc.js", + ".prettierrc.js" + ], + "exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"] +} diff --git a/packages/fes-plugin-qiankun/examples/main/.env b/packages/fes-plugin-qiankun/examples/main/.env new file mode 100644 index 00000000..3646d14f --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/.env @@ -0,0 +1 @@ +PORT=8000 diff --git a/packages/fes-plugin-qiankun/examples/main/.eslintrc.js b/packages/fes-plugin-qiankun/examples/main/.eslintrc.js new file mode 100644 index 00000000..6300816f --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/.eslintrc.js @@ -0,0 +1,14 @@ +module.exports = { + extends: ['@webank/eslint-config-webank/vue.js'], + overrides: [ + { + files: [ + '**/__tests__/*.{j,t}s?(x)', + '**/tests/unit/**/*.spec.{j,t}s?(x)' + ] + } + ], + env: { + jest: true + } +}; diff --git a/packages/fes-plugin-qiankun/examples/main/.fes.js b/packages/fes-plugin-qiankun/examples/main/.fes.js new file mode 100644 index 00000000..e9f8587c --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/.fes.js @@ -0,0 +1,45 @@ +// .fes.js 只负责管理编译时配置,只能使用plain Object + + +export default { + access: { + roles: { + admin: ["*"] + } + }, + layout: { + title: "Fes.js", + footer: 'Created by MumbelFe', + multiTabs: false, + navigation: 'mixin', + menus: [{ + name: 'index', + icon: 'user' + }, { + title: "子应用1", + icon: 'user', + children: [{ + name: 'app1-index' + },{ + name: 'app1-test' + }] + }] + }, + qiankun: { + main: { + apps: [ + { + name: 'app1', // 唯一 id + entry: '//localhost:8001', // html entry + props: {} // 传递给子应用的数据 + } + ] + } + }, + plugins: [ + require.resolve('../../../fes-plugin-model/lib'), + require.resolve('../../../fes-plugin-layout/lib'), + require.resolve('../../../fes-plugin-access/lib'), + require.resolve('../../../fes-plugin-qiankun/lib'), + ] +}; diff --git a/packages/fes-plugin-qiankun/examples/main/.gitignore b/packages/fes-plugin-qiankun/examples/main/.gitignore new file mode 100644 index 00000000..df903b98 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/.gitignore @@ -0,0 +1,11 @@ +.DS_Store + +# dependencies +/node_modules +/coverage + +# fes +/src/.fes +/src/.fes-production +/src/.fes-test +/.env.local diff --git a/packages/fes-plugin-qiankun/examples/main/LICENSE b/packages/fes-plugin-qiankun/examples/main/LICENSE new file mode 100644 index 00000000..0978fbf7 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-present webank + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/fes-plugin-qiankun/examples/main/package.json b/packages/fes-plugin-qiankun/examples/main/package.json new file mode 100644 index 00000000..9864aa90 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/package.json @@ -0,0 +1,54 @@ +{ + "name": "main", + "version": "2.0.0", + "description": "fes项目模版", + "scripts": { + "build": "fes build", + "prod": "FES_ENV=prod fes build", + "analyze": "ANALYZE=1 fes build", + "dev": "fes dev", + "test": "fes test" + }, + "keywords": [ + "管理端", + "fes", + "fast", + "easy", + "strong" + ], + "files": [ + ".eslintrc.js", + ".gitignore", + ".fes.js", + ".fes.prod.js", + "mock.js", + "package.json", + "README.md", + "tsconfig.json", + "/src", + "/config" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/WeBankFinTech/fes.js.git", + "directory": "packages/fes-template" + }, + "author": "harrywan", + "license": "MIT", + "bugs": { + "url": "https://github.com/WeBankFinTech/fes.js/issues" + }, + "homepage": "https://github.com/WeBankFinTech/fes.js#readme", + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@webank/eslint-config-webank": "0.2.10" + }, + "dependencies": { + "@fesjs/fes": "^2.0.0-rc.0", + "vue": "^3.0.5", + "ant-design-vue": "2.0.0" + }, + "private": true +} diff --git a/packages/fes-plugin-qiankun/examples/main/src/app.js b/packages/fes-plugin-qiankun/examples/main/src/app.js new file mode 100644 index 00000000..52361d60 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/src/app.js @@ -0,0 +1,15 @@ +import { access as accessApi } from '@fesjs/fes'; +import PageLoading from '@/components/PageLoading'; + +export const beforeRender = { + loading: , + action() { + const { setRole } = accessApi; + return new Promise((resolve) => { + setTimeout(() => { + setRole('admin'); + resolve(); + }, 1000); + }); + } +}; diff --git a/packages/fes-plugin-qiankun/examples/main/src/components/PageLoading.vue b/packages/fes-plugin-qiankun/examples/main/src/components/PageLoading.vue new file mode 100644 index 00000000..14f1165e --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/src/components/PageLoading.vue @@ -0,0 +1,29 @@ + + + diff --git a/packages/fes-plugin-qiankun/examples/main/src/global.css b/packages/fes-plugin-qiankun/examples/main/src/global.css new file mode 100644 index 00000000..e69de29b diff --git a/packages/fes-plugin-qiankun/examples/main/src/images/icon.png b/packages/fes-plugin-qiankun/examples/main/src/images/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ff46a842d654da25a975ac545798bbcc4fd57918 GIT binary patch literal 5586 zcmb_gXE>Zq+rD>|u!x@MRwu$LNf5*mEzzP!FRLsOEqc9mtJj2t<?%``J0I(O{(^NMLvHx8h*~k+Z+S@Vg1*C9lzf|_;(u(`lpy>3vE+DdtqhCOk_XC>_>vXCE7JtNqv)gxQT_JN=WuTS1w!fXr+6FjfDniPS96)ryWjQB^-;;py|Yw}^`gFcFYmhSWb!>YAqRt?ObFAr86qLCWC$+n z2lgt85SM1Y4?}pvzaGm;oe&~l5-(qSY|}Tuk7&58dO1q8Ok}1t_llbQMLtT4vN8)S zFgOqd_%E$|6TBR`h^1wuc(^?N3eULt!Y@e!;(Tk`$C-i-b7aR^VsmX(ek8cB*BNhr zQ{xY5{dGC zf3C*)S-J3d%I){ z^*>xsT*Ax&^v90&m#Qrt-uvrduHKQCLlNu)weX_BV8Lf=LSHFD&eu60R9K?}#`NZC zoj`|Q^1WJs5-Hdxl$=q?h=^|jn}dt zJhtUC`$Pq=8sn0h{gBYYAE{YxUnggDAQwLVEEK6<9m(4HNBNzdEMX=G+|jGe2s8l(}(YjuNV zZTEiVbTECLBb;UoY40Q8BvJGQ=$Zk*#QWWrNcTSGr9fA{cxR%Yy8HYdcb;%+fiNq1 zT@(gm7wm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!y-fOGpp*L;u*l9dKi6D&I@GsUcl%1M zsR6VP9HVK{kjy_-8i)|(sE%QZG97|ENs@CvrH&6zUVrU9`S7jld1J4}M~RwTfW`06 zf5ewFd1OF~XeZ^#qtmoxk|@#W)=d6QW}EActpLmJp_p==he(;};+TGC2`wz@LyFQM z$@eSt4d3GapH{{ohL!W{uPh4Eu6)vDN9K&|e>BDiG4f%N@|<&p^eC=Q1j>3_k(E9y3r0Pgoe7zu61mYMxWTY0heQ(~Btn^iD zIzMnBBL$5d!nSHbVANDlR=k0X%&tbX9hf134T)?HHY+l+Z|vE8_%%4Vm#0gg@`|hp ve&5jBQY9M?yDv +{ + "name": "app1-index", + "title": "子应用1-首页", + "microApp": "app1" +} + diff --git a/packages/fes-plugin-qiankun/examples/main/src/pages/app1/test.vue b/packages/fes-plugin-qiankun/examples/main/src/pages/app1/test.vue new file mode 100644 index 00000000..bc74c396 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/src/pages/app1/test.vue @@ -0,0 +1,7 @@ + +{ + "name": "app1-test", + "title": "子应用1-测试", + "microApp": "app1" +} + diff --git a/packages/fes-plugin-qiankun/examples/main/src/pages/index.vue b/packages/fes-plugin-qiankun/examples/main/src/pages/index.vue new file mode 100644 index 00000000..e1f1c676 --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/src/pages/index.vue @@ -0,0 +1,11 @@ + + +{ + "name": "index", + "title": "首页" +} + diff --git a/packages/fes-plugin-qiankun/examples/main/tsconfig.json b/packages/fes-plugin-qiankun/examples/main/tsconfig.json new file mode 100644 index 00000000..ea930c0b --- /dev/null +++ b/packages/fes-plugin-qiankun/examples/main/tsconfig.json @@ -0,0 +1,37 @@ +{ + "compilerOptions": { + "outDir": "build/dist", + "module": "esnext", + "target": "esnext", + "lib": ["esnext", "dom"], + "sourceMap": true, + "baseUrl": ".", + "jsx": "preserve", + "allowSyntheticDefaultImports": true, + "moduleResolution": "node", + "forceConsistentCasingInFileNames": true, + "noImplicitReturns": true, + "suppressImplicitAnyIndexErrors": true, + "noUnusedLocals": true, + "allowJs": true, + "skipLibCheck": true, + "experimentalDecorators": true, + "strict": true, + "paths": { + "@/*": ["./src/*"], + "@@/*": ["./src/.fes/*"] + } + }, + "include": [ + "src/**/*", + "tests/**/*", + "test/**/*", + "__test__/**/*", + "typings/**/*", + "config/**/*", + ".eslintrc.js", + ".stylelintrc.js", + ".prettierrc.js" + ], + "exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"] +} diff --git a/packages/fes-plugin-qiankun/package.json b/packages/fes-plugin-qiankun/package.json index d5d3b761..75cf70bf 100644 --- a/packages/fes-plugin-qiankun/package.json +++ b/packages/fes-plugin-qiankun/package.json @@ -7,7 +7,9 @@ "lib" ], "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "start": "npm-run-all --parallel start:*", + "start:master": "cd ./examples/main && fes dev", + "start:app1": "cd ./examples/app1 && fes dev" }, "repository": { "type": "git", @@ -32,6 +34,9 @@ "lodash": "^4.17.15", "qiankun": "2.3.4" }, + "devDependencies": { + "npm-run-all": "^4.1.5" + }, "peerDependencies": { "@webank/fes": "^2.0.0-rc.0", "vue": "^3.0.5" diff --git a/packages/fes-plugin-qiankun/src/main/modifyRoutes.js b/packages/fes-plugin-qiankun/src/main/modifyRoutes.js index 8a1ff4e0..e113728b 100644 --- a/packages/fes-plugin-qiankun/src/main/modifyRoutes.js +++ b/packages/fes-plugin-qiankun/src/main/modifyRoutes.js @@ -2,11 +2,11 @@ import { defaultHistoryType } from '../constants'; function getMicroApp(options) { const { - microAppName, masterHistoryType, base, namespace, ...normalizedRouteProps + key, microAppName, masterHistoryType, base, namespace, ...normalizedRouteProps } = options; return `(() => { const { getMicroAppRouteComponent } = require('@@/${namespace}/getMicroAppRouteComponent'); -return getMicroAppRouteComponent({ appName: '${microAppName}', base: '${base}', masterHistoryType: '${masterHistoryType}', routeProps: ${JSON.stringify(normalizedRouteProps)} }) +return getMicroAppRouteComponent({key: '${key}', appName: '${microAppName}', base: '${base}', masterHistoryType: '${masterHistoryType}', routeProps: ${JSON.stringify(normalizedRouteProps)} }) })()`; } @@ -18,6 +18,7 @@ function modifyRoutesWithAttachMode({ _routes.forEach((route) => { if (route.meta && route.meta.microApp) { route.component = getMicroApp({ + key: route.path, microAppName: route.meta.microApp, masterHistoryType, base, diff --git a/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl b/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl index c4804697..9c642047 100644 --- a/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl +++ b/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl @@ -1,6 +1,7 @@ import { defineComponent, ref, + reactive, watch, computed, onBeforeUnmount, @@ -10,21 +11,17 @@ import { loadMicroApp } from "qiankun"; import mergeWith from "lodash/mergeWith"; // eslint-disable-next-line import/extensions import { getMasterOptions } from "./masterOptions"; -{{#HAS_PLUGIN_MODEL}} -import { useModel } from '@@/core/pluginExports'; -{{/HAS_PLUGIN_MODEL}} import { onBeforeRouteLeave } from "@@/core/coreExports"; let unmountPromise; async function unmountMicroApp(microApp) { if (microApp) { - if (microApp.mountPromise) { - await microApp.mountPromise; - } - if (!unmountPromise) { - unmountPromise = microApp.unmount(); - } - return await unmountPromise; + return microApp.mountPromise.then(_microApp => { + // Now it is safe to call unmount + if(_microApp){ + return _microApp.unmount() + } + }) } return Promise.resolve(); } @@ -47,13 +44,7 @@ export const MicroApp = defineComponent({ ...globalSettings } = getMasterOptions(); -{{#HAS_PLUGIN_MODEL}} - // 约定使用 src/models/qiankunStateForMicro 中的数据作为主应用透传给微应用的 props,优先级高于 propsFromConfig - const stateForSlave = useModel('{{{qiankunStateForMicroModelNamespace}}}'); -{{/HAS_PLUGIN_MODEL}} -{{^HAS_PLUGIN_MODEL}} const stateForSlave = reactive({}); -{{/HAS_PLUGIN_MODEL}} // 挂载节点 const containerRef = ref(null); diff --git a/packages/fes-plugin-qiankun/src/main/runtime/getMicroAppRouteComponent.tpl b/packages/fes-plugin-qiankun/src/main/runtime/getMicroAppRouteComponent.tpl index 55b3776b..074ab2cf 100644 --- a/packages/fes-plugin-qiankun/src/main/runtime/getMicroAppRouteComponent.tpl +++ b/packages/fes-plugin-qiankun/src/main/runtime/getMicroAppRouteComponent.tpl @@ -1,11 +1,12 @@ import { MicroApp } from './MicroApp'; export function getMicroAppRouteComponent({ + key, appName, base, masterHistoryType, routeProps }) { - return ; + return ; } diff --git a/packages/fes-plugin-qiankun/src/micro/index.js b/packages/fes-plugin-qiankun/src/micro/index.js index 1945e4f7..2bcd85d2 100644 --- a/packages/fes-plugin-qiankun/src/micro/index.js +++ b/packages/fes-plugin-qiankun/src/micro/index.js @@ -165,7 +165,7 @@ export default function (api) { () => ` export const bootstrap = qiankun_genBootstrap(completeClientRender, app); export const mount = qiankun_genMount('#${api.config.mountElementId}'); -export const unmount = qiankun_genUnmount('#${api.config.mountElementId}'); +export const unmount = qiankun_genUnmount(); export const update = qiankun_genUpdate(); if (!window.__POWERED_BY_QIANKUN__) { diff --git a/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl b/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl index 0bebf7c1..b429733c 100644 --- a/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl +++ b/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl @@ -46,7 +46,7 @@ export function genBootstrap(oldRender, appPromise) { } // 子应用生命周期钩子Mount -export function genMount() { +export function genMount(mountElementId) { return async (props) => { // props 有值时说明应用是通过 lifecycle 被主应用唤醒的,而不是独立运行时自己 mount if (typeof props !== 'undefined') { @@ -85,17 +85,11 @@ export function genUpdate() { } // 子应用生命周期钩子Unmount -export function genUnmount(mountElementId) { +export function genUnmount() { return async (props) => { - let container; - try { - container = props?.container - ? props.container.querySelector(mountElementId) - : document.querySelector(mountElementId); - } catch (e) {} - if (container && cacheAppPromise) { + if (cacheAppPromise) { const app = await cacheAppPromise; - app.unmount(container); + app.unmount(); } const slaveRuntime = getSlaveRuntime(); if (slaveRuntime.unmount) { diff --git a/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl b/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl index 927a6382..a586b53a 100644 --- a/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl +++ b/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl @@ -27,7 +27,7 @@ const renderClient = (opts = {}) => { const app = createApp(rootContainer); app.provide("initialState", initialState); - + plugin.applyPlugins({ key: 'onAppCreated', type: ApplyPluginsType.event, @@ -95,8 +95,5 @@ const completeClientRender = async () => { const app = completeClientRender(); -export default app; - - {{{ entryCode }}} diff --git a/packages/fes-template/.fes.js b/packages/fes-template/.fes.js index 6ffe3d69..430facd6 100644 --- a/packages/fes-template/.fes.js +++ b/packages/fes-template/.fes.js @@ -2,7 +2,10 @@ export default { - base: '', + // base: '', + qiankun: { + micro: {} + }, define: { __DEV__: false }, diff --git a/packages/fes-template/package.json b/packages/fes-template/package.json index 09552223..f9839744 100644 --- a/packages/fes-template/package.json +++ b/packages/fes-template/package.json @@ -55,11 +55,10 @@ "@fesjs/plugin-jest": "^2.0.0-rc.0", "@fesjs/plugin-vuex": "^2.0.0-rc.0", "@fesjs/plugin-request": "^2.0.0-rc.0", - "@fesjs/plugin-qiankun": "^2.0.0-alpha.0", + "@fesjs/plugin-qiankun": "^2.0.0-rc.0", "ant-design-vue": "2.0.0", "vue": "^3.0.5", "vuex": "^4.0.0" }, "private": true } - \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 55736d07..f9fab0c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6650,7 +6650,7 @@ cross-spawn@^5.0.1: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -11610,6 +11610,11 @@ memory-fs@^0.5.0: errno "^0.1.3" readable-stream "^2.0.1" +memorystream@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= + meow@^3.3.0: version "3.7.0" resolved "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" @@ -12277,6 +12282,21 @@ npm-pick-manifest@^3.0.0: npm-package-arg "^6.0.0" semver "^5.4.1" +npm-run-all@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba" + integrity sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ== + dependencies: + ansi-styles "^3.2.1" + chalk "^2.4.1" + cross-spawn "^6.0.5" + memorystream "^0.3.1" + minimatch "^3.0.4" + pidtree "^0.3.0" + read-pkg "^3.0.0" + shell-quote "^1.6.1" + string.prototype.padend "^3.0.0" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -12944,6 +12964,11 @@ picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1, picomatch@^2.2.2: resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +pidtree@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a" + integrity sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -14777,6 +14802,11 @@ shebang-regex@^3.0.0: resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shell-quote@^1.6.1: + version "1.7.2" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" + integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== + shellwords@^0.1.1: version "0.1.1" resolved "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" @@ -15229,6 +15259,15 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string.prototype.padend@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.1.2.tgz#6858ca4f35c5268ebd5e8615e1327d55f59ee311" + integrity sha512-/AQFLdYvePENU3W5rgurfWSMU6n+Ww8n/3cUt7E+vPBB/D7YDG8x+qjoFs4M/alR2bW7Qg6xMjVwWUOvuQ0XpQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.2" + string.prototype.trimend@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80"