From 303223114ee60adb8f8550051a2f9d73581544c6 Mon Sep 17 00:00:00 2001 From: xiaohuoni Date: Mon, 6 Jun 2022 17:47:11 +0800 Subject: [PATCH] feat: alita loading --- packages/alita/assets/bundle-status.html | 179 ++++++++++++++++++++ packages/alita/src/features/alitaloading.ts | 16 ++ packages/alita/src/preset.ts | 1 + 3 files changed, 196 insertions(+) create mode 100644 packages/alita/assets/bundle-status.html create mode 100644 packages/alita/src/features/alitaloading.ts diff --git a/packages/alita/assets/bundle-status.html b/packages/alita/assets/bundle-status.html new file mode 100644 index 00000000..1f6d8f18 --- /dev/null +++ b/packages/alita/assets/bundle-status.html @@ -0,0 +1,179 @@ + + + + + + + Alita Loading... + + + + +
+

Bundling...

+ +

+

+
+ + + + diff --git a/packages/alita/src/features/alitaloading.ts b/packages/alita/src/features/alitaloading.ts new file mode 100644 index 00000000..877a3b6f --- /dev/null +++ b/packages/alita/src/features/alitaloading.ts @@ -0,0 +1,16 @@ +import { cheerio } from '@umijs/utils'; +import { readFileSync } from 'fs'; +import { join } from 'path'; +import { IApi } from 'umi'; + +const assetsDir = join(__dirname, '../../assets'); + +export default (api: IApi) => { + api.register({ + key: 'modifyDevToolLoadingHTML', + fn: () => + cheerio.load( + readFileSync(join(assetsDir, 'bundle-status.html'), 'utf-8'), + ), + }); +}; diff --git a/packages/alita/src/preset.ts b/packages/alita/src/preset.ts index e16ab4b7..1694a62b 100644 --- a/packages/alita/src/preset.ts +++ b/packages/alita/src/preset.ts @@ -7,6 +7,7 @@ export default (api: IApi) => { }); const plugins = [ require.resolve('./features/config/alitaconfig'), + require.resolve('./features/alitaloading'), require.resolve('./features/apptype'), require.resolve('./features/qrcodeterminal'), require.resolve('./commands/generate/pages'),